fix(lotus): transparent-theme contrast guard; phone-only rail shrink; live URL params
- lotusTransparent without lotusTheme warns and applies the theme anyway; name tags/header/footer get a subtle text-shadow + backdrop blur under body.lotus-transparent (#21). - Landscape filmstrip shrink requires (pointer: coarse) so a short desktop/PiP window isn't reflowed as a phone (#32). - lotusParam re-reads window.location on every call (#33). Fixes #21 Fixes #32 Fixes #33 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
co-authored by
Claude Opus 5
parent
c7494e68ca
commit
e9a59336c7
+13
-14
@@ -21,27 +21,26 @@ import type { LotusWidgetActions } from "./lotusActions";
|
||||
|
||||
export { LotusWidgetActions } from "./lotusActions";
|
||||
|
||||
let cachedParams: URLSearchParams | undefined;
|
||||
|
||||
/**
|
||||
* Read a URL param from either the query string or the hash fragment (Element
|
||||
* Call passes widget params via both depending on host), without depending on
|
||||
* EC's own `getUrlParams` parser (keeps the rebase surface small).
|
||||
*
|
||||
* [lotus #33] Re-parsed from `window.location` on every call instead of being
|
||||
* cached at first use: parsing is cheap, and caching risked returning a
|
||||
* stale value if `location.hash`/`search` are ever rewritten after first
|
||||
* read (e.g. during in-iframe navigation).
|
||||
*/
|
||||
export function lotusParam(name: string): string | null {
|
||||
if (!cachedParams) {
|
||||
// Match EC's own ParamParser precedence: the hash fragment wins over the
|
||||
// query string. So seed from the fragment first, then fill gaps from query.
|
||||
const hash = window.location.hash.replace(/^#\/?/, "");
|
||||
const hashQuery = hash.includes("?")
|
||||
? hash.slice(hash.indexOf("?") + 1)
|
||||
: "";
|
||||
cachedParams = new URLSearchParams(hashQuery);
|
||||
for (const [k, v] of new URLSearchParams(window.location.search)) {
|
||||
if (!cachedParams.has(k)) cachedParams.append(k, v);
|
||||
}
|
||||
// Match EC's own ParamParser precedence: the hash fragment wins over the
|
||||
// query string. So seed from the fragment first, then fill gaps from query.
|
||||
const hash = window.location.hash.replace(/^#\/?/, "");
|
||||
const hashQuery = hash.includes("?") ? hash.slice(hash.indexOf("?") + 1) : "";
|
||||
const params = new URLSearchParams(hashQuery);
|
||||
for (const [k, v] of new URLSearchParams(window.location.search)) {
|
||||
if (!params.has(k)) params.append(k, v);
|
||||
}
|
||||
return cachedParams.get(name);
|
||||
return params.get(name);
|
||||
}
|
||||
|
||||
/** Whether a boolean-ish Lotus feature flag is enabled. */
|
||||
|
||||
Reference in New Issue
Block a user