@lumencast/runtime 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/animate/frame-coalescer.d.ts +13 -0
- package/dist/animate/frame-coalescer.d.ts.map +1 -0
- package/dist/animate/frame-coalescer.js +46 -0
- package/dist/animate/frame-coalescer.js.map +1 -0
- package/dist/animate/keyframes.d.ts +1 -1
- package/dist/animate/keyframes.d.ts.map +1 -1
- package/dist/animate/keyframes.js +20 -6
- package/dist/animate/keyframes.js.map +1 -1
- package/dist/animate/transitions.d.ts +4 -1
- package/dist/animate/transitions.d.ts.map +1 -1
- package/dist/animate/transitions.js +30 -3
- package/dist/animate/transitions.js.map +1 -1
- package/dist/{broadcast-DzZ8TVGZ.js → broadcast-3vYij4k-.js} +3 -3
- package/dist/{broadcast-DzZ8TVGZ.js.map → broadcast-3vYij4k-.js.map} +1 -1
- package/dist/{control-gbDGvdR0.js → control-BFNkY7-6.js} +4 -4
- package/dist/{control-gbDGvdR0.js.map → control-BFNkY7-6.js.map} +1 -1
- package/dist/{index-oteiocFe.js → index-CyOlpZAL.js} +305 -150
- package/dist/index-CyOlpZAL.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/lumencast.js +9 -2
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +11 -1
- package/dist/mount.js.map +1 -1
- package/dist/render/bind-animate.d.ts +40 -0
- package/dist/render/bind-animate.d.ts.map +1 -0
- package/dist/render/bind-animate.js +329 -0
- package/dist/render/bind-animate.js.map +1 -0
- package/dist/render/bundle.d.ts +48 -6
- package/dist/render/bundle.d.ts.map +1 -1
- package/dist/render/bundle.js +71 -4
- package/dist/render/bundle.js.map +1 -1
- package/dist/render/color-interp.d.ts +18 -0
- package/dist/render/color-interp.d.ts.map +1 -0
- package/dist/render/color-interp.js +303 -0
- package/dist/render/color-interp.js.map +1 -0
- package/dist/render/css-color.d.ts +16 -0
- package/dist/render/css-color.d.ts.map +1 -0
- package/dist/render/css-color.js +130 -0
- package/dist/render/css-color.js.map +1 -0
- package/dist/render/diagnostics.d.ts +26 -0
- package/dist/render/diagnostics.d.ts.map +1 -0
- package/dist/render/diagnostics.js +58 -0
- package/dist/render/diagnostics.js.map +1 -0
- package/dist/render/fill.d.ts +15 -3
- package/dist/render/fill.d.ts.map +1 -1
- package/dist/render/fill.js +81 -14
- package/dist/render/fill.js.map +1 -1
- package/dist/render/filter-clamp.d.ts +35 -0
- package/dist/render/filter-clamp.d.ts.map +1 -0
- package/dist/render/filter-clamp.js +90 -0
- package/dist/render/filter-clamp.js.map +1 -0
- package/dist/render/keyframe-player.d.ts +4 -1
- package/dist/render/keyframe-player.d.ts.map +1 -1
- package/dist/render/keyframe-player.js +2 -2
- package/dist/render/keyframe-player.js.map +1 -1
- package/dist/render/primitives/frame.d.ts +16 -1
- package/dist/render/primitives/frame.d.ts.map +1 -1
- package/dist/render/primitives/frame.js +42 -7
- package/dist/render/primitives/frame.js.map +1 -1
- package/dist/render/primitives/image.d.ts +1 -1
- package/dist/render/primitives/image.d.ts.map +1 -1
- package/dist/render/primitives/image.js +6 -3
- package/dist/render/primitives/image.js.map +1 -1
- package/dist/render/primitives/index.d.ts +3 -0
- package/dist/render/primitives/index.d.ts.map +1 -1
- package/dist/render/primitives/index.js.map +1 -1
- package/dist/render/primitives/instance.d.ts +1 -1
- package/dist/render/primitives/instance.d.ts.map +1 -1
- package/dist/render/primitives/instance.js +10 -13
- package/dist/render/primitives/instance.js.map +1 -1
- package/dist/render/primitives/shape.d.ts +9 -3
- package/dist/render/primitives/shape.d.ts.map +1 -1
- package/dist/render/primitives/shape.js +56 -12
- package/dist/render/primitives/shape.js.map +1 -1
- package/dist/render/primitives/text.d.ts +35 -4
- package/dist/render/primitives/text.d.ts.map +1 -1
- package/dist/render/primitives/text.js +179 -7
- package/dist/render/primitives/text.js.map +1 -1
- package/dist/render/prop-allowlist.d.ts +10 -0
- package/dist/render/prop-allowlist.d.ts.map +1 -0
- package/dist/render/prop-allowlist.js +112 -0
- package/dist/render/prop-allowlist.js.map +1 -0
- package/dist/render/svg-path.d.ts +35 -0
- package/dist/render/svg-path.d.ts.map +1 -0
- package/dist/render/svg-path.js +211 -0
- package/dist/render/svg-path.js.map +1 -0
- package/dist/render/tree.d.ts.map +1 -1
- package/dist/render/tree.js +30 -5
- package/dist/render/tree.js.map +1 -1
- package/dist/{status-pill-Cgdl9FtP.js → status-pill-DIpXc5du.js} +2 -2
- package/dist/{status-pill-Cgdl9FtP.js.map → status-pill-DIpXc5du.js.map} +1 -1
- package/dist/{test-CAnkHA0n.js → test-ByRec1kd.js} +4 -4
- package/dist/{test-CAnkHA0n.js.map → test-ByRec1kd.js.map} +1 -1
- package/dist/tree-D5wYHpPu.js +1230 -0
- package/dist/tree-D5wYHpPu.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/animate/frame-coalescer.ts +63 -0
- package/src/animate/keyframes.ts +24 -5
- package/src/animate/transitions.ts +33 -3
- package/src/index.ts +24 -0
- package/src/mount.ts +12 -1
- package/src/render/bind-animate.tsx +370 -0
- package/src/render/bundle.ts +102 -10
- package/src/render/color-interp.ts +303 -0
- package/src/render/css-color.ts +145 -0
- package/src/render/diagnostics.ts +75 -0
- package/src/render/fill.tsx +85 -14
- package/src/render/filter-clamp.ts +99 -0
- package/src/render/keyframe-player.tsx +10 -2
- package/src/render/primitives/frame.tsx +47 -7
- package/src/render/primitives/image.tsx +6 -2
- package/src/render/primitives/index.ts +3 -0
- package/src/render/primitives/instance.tsx +14 -15
- package/src/render/primitives/shape.tsx +76 -12
- package/src/render/primitives/text.tsx +224 -7
- package/src/render/prop-allowlist.ts +119 -0
- package/src/render/svg-path.ts +215 -0
- package/src/render/tree.tsx +41 -6
- package/src/types.ts +27 -0
- package/dist/index-oteiocFe.js.map +0 -1
- package/dist/tree-DVYXwItH.js +0 -512
- package/dist/tree-DVYXwItH.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CyOlpZAL.js","sources":["../src/overlay/runtime-context.tsx","../src/app.tsx","../src/render/diagnostics.ts","../src/render/filter-clamp.ts","../src/animate/transitions.ts","../src/state/apply-delta.ts","../src/state/apply-snapshot.ts","../src/state/store.ts","../src/render/bundle.ts","../src/transport/reconnect.ts","../src/transport/ws.ts","../src/internal/validate-options.ts","../src/mount.ts","../src/render/prop-allowlist.ts"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\nimport type { Patch } from \"@lumencast/protocol\";\nimport type { Store } from \"../state/store\";\nimport type { RenderBundle } from \"../render/bundle\";\nimport type { ConnectionStatus } from \"../transport/ws\";\nimport type { LumencastMode } from \"../types\";\n\nexport interface LumencastRuntime {\n mode: LumencastMode;\n store: Store;\n bundle: RenderBundle;\n status: ConnectionStatus;\n /** Send LSDP/1 input patches to the server. */\n sendInput: (patches: Patch[]) => void;\n}\n\nconst Ctx = createContext<LumencastRuntime | null>(null);\n\nexport function LumencastRuntimeProvider({\n value,\n children,\n}: {\n value: LumencastRuntime;\n children: ReactNode;\n}) {\n return <Ctx.Provider value={value}>{children}</Ctx.Provider>;\n}\n\nexport function useLumencastRuntime(): LumencastRuntime {\n const v = useContext(Ctx);\n if (!v) {\n throw new Error(\n \"Lumencast overlay components must be rendered inside LumencastRuntimeProvider\",\n );\n }\n return v;\n}\n","// Top-level React component for a mounted Lumencast instance. Reads the runtime\n// signals (bundle / status) and dispatches to the right mode.\n//\n// Per-mode code splitting: BroadcastMode / ControlMode / TestMode live in\n// separate chunks loaded only when the corresponding mode is requested. A\n// broadcast mount never downloads the overlay or test code — the broadcast\n// chunk is the bare minimum a CEF host needs to render the scene.\n//\n// Crossfade: AnimatePresence freezes the props of an exiting child so its render\n// tree keeps using the values it held at the moment it started exiting.\n\nimport { useSignals } from \"@preact/signals-react/runtime\";\nimport type { Signal } from \"@preact/signals-react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { lazy, Suspense } from \"react\";\nimport type { Patch } from \"@lumencast/protocol\";\nimport type { Store } from \"./state/store.js\";\nimport type { RenderBundle } from \"./render/bundle.js\";\nimport type { ConnectionStatus } from \"./transport/ws.js\";\nimport { LumencastRuntimeProvider } from \"./overlay/runtime-context.js\";\nimport type { LumencastMode } from \"./types.js\";\n\nconst LazyBroadcastMode = lazy(() =>\n import(\"./modes/broadcast.js\").then((m) => ({ default: m.BroadcastMode })),\n);\nconst LazyControlMode = lazy(() =>\n import(\"./modes/control.js\").then((m) => ({ default: m.ControlMode })),\n);\nconst LazyTestMode = lazy(() => import(\"./modes/test.js\").then((m) => ({ default: m.TestMode })));\n\nexport interface LumencastAppProps {\n mode: LumencastMode;\n store: Store;\n bundleSignal: Signal<RenderBundle | null>;\n statusSignal: Signal<ConnectionStatus>;\n crossfadeKeySignal: Signal<string>;\n sendInput: (patches: Patch[]) => void;\n}\n\nexport function LumencastApp({\n mode,\n store,\n bundleSignal,\n statusSignal,\n crossfadeKeySignal,\n sendInput,\n}: LumencastAppProps) {\n useSignals();\n\n const bundle = bundleSignal.value;\n const status = statusSignal.value;\n const trackKey = crossfadeKeySignal.value;\n if (!bundle) return null;\n\n const ModeComponent =\n mode === \"broadcast\" ? LazyBroadcastMode : mode === \"control\" ? LazyControlMode : LazyTestMode;\n\n return (\n <AnimatePresence mode=\"sync\">\n <motion.div\n key={trackKey}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.4, ease: \"easeInOut\" }}\n style={{ position: \"absolute\", inset: 0 }}\n >\n <LumencastRuntimeProvider\n value={{\n mode,\n store,\n bundle,\n status,\n sendInput,\n }}\n >\n <Suspense fallback={null}>\n <ModeComponent />\n </Suspense>\n </LumencastRuntimeProvider>\n </motion.div>\n </AnimatePresence>\n );\n}\n","// Anti-silent-drop diagnostics channel (ADR 001 §3.4 D4, issue #34).\n//\n// Every render-side diagnostic — rejected colour/filter/path/typography\n// value, unknown prop, unrendered spec'd field — flows through\n// `emitDiagnostic`. The diagnostic is an EVENT, not a console.log :\n// hosts subscribe via `MountOptions.onDiagnostic` (wired by `mount()`)\n// and receive a structured `{ nodeId, field, reason }`. When no handler\n// is registered, the runtime falls back to a DEV-only `console.warn`\n// so authors still see drops during development — and `broadcast`\n// builds stay silent on the console, per the CLAUDE.md \"no logs in\n// broadcast\" rule.\n//\n// ── Hygiene contract (Bastion R9, ADR 001 §5.1) ─────────────────────\n// A diagnostic NEVER carries the value of a leaf or a prop — only the\n// node id, the field name and a STATIC reason string. Leaf values can\n// hold sensitive on-air content ; they must not transit any diagnostic\n// channel. Callers pass field names and literal reasons exclusively.\n// The R9 sentinel test (r9-sentinel.test.tsx) enforces this end to end,\n// and statically checks that `console.warn` only exists in this module.\n// ─────────────────────────────────────────────────────────────────────\n\n/** Placeholder id for nodes that don't declare an `id`. */\nexport const ANON_NODE_ID = \"<anon>\";\n\nexport interface RenderDiagnostic {\n /** `RenderNode.id` of the node the field belongs to (RC#7), or\n * `ANON_NODE_ID` when the node has none. */\n nodeId: string;\n /** Name of the field/prop concerned (e.g. `text.colour`,\n * `shape.paths.data`, `bindAnimate.opacity`). Never its value (R9). */\n field: string;\n /** Static reason — why the field was rejected or not rendered. */\n reason: string;\n}\n\nexport type DiagnosticHandler = (diagnostic: RenderDiagnostic) => void;\n\nconst handlers = new Set<DiagnosticHandler>();\n\n/**\n * Register a diagnostics handler (one per `mount()`, plus tests).\n * Returns the unregister function. Multiple concurrent mounts each\n * receive every diagnostic — node ids are bundle-scoped, so a host\n * running several mounts should disambiguate on its side.\n */\nexport function addDiagnosticsHandler(handler: DiagnosticHandler): () => void {\n handlers.add(handler);\n return () => {\n handlers.delete(handler);\n };\n}\n\n/**\n * Emit one anti-drop diagnostic. `field` and `reason` MUST be static\n * strings / field names — never interpolate a prop or leaf value (R9).\n */\nexport function emitDiagnostic(nodeId: string | undefined, field: string, reason: string): void {\n const diagnostic: RenderDiagnostic = { nodeId: nodeId ?? ANON_NODE_ID, field, reason };\n if (handlers.size > 0) {\n for (const handler of handlers) {\n try {\n handler(diagnostic);\n } catch {\n // A host handler that throws must never break the render path.\n }\n }\n return;\n }\n // DEV-only console fallback — broadcast builds log nothing.\n if (import.meta.env.DEV) {\n console.warn(\n `[lumencast] node \"${diagnostic.nodeId}\": field \"${field}\" ${reason} (value withheld per R9)`,\n );\n }\n}\n","// Runtime half of the R8 filter gate (ADR 001 §5.1 R8, issue #42).\n//\n// The compiler clamps `filter` values at lowering (`lowerFilter`,\n// packages/compiler/src/compile.ts) — but a filter value pushed by a\n// LIVE LSDP delta reaches the runtime through `resolveProps` /\n// `animateBindings` without ever passing through the compiler. R8\n// requires the clamp at compile AND at runtime : an unbounded filter is\n// a compositing DoS in CEF. Every filter value that can reach an inline\n// style at render time MUST pass through this module.\n//\n// NOTE on duplication : these caps intentionally mirror the compiler's\n// `MAX_FILTER_BLUR_PX` / `MAX_FILTER_BRIGHTNESS` constants. Unifying\n// them behind a single shared module is tracked by issue #41 (same\n// model as the shared colour module) — do NOT change one side without\n// the other until #41 lands.\n//\n// ── Linear-time justification (RC#12) ────────────────────────────────\n// The string form is validated by a single ANCHORED regex made of\n// literals and bounded quantifiers ({1,7} / {1,4} digit runs, one\n// optional space run) — exactly one possible parse per input, no\n// backtracking blow-up. Inputs longer than MAX_FILTER_STRING_LEN are\n// rejected before the regex runs.\n// ─────────────────────────────────────────────────────────────────────\n\nimport { emitDiagnostic } from \"./diagnostics\";\n\n/** Max CSS `blur()` radius accepted at runtime, in px (mirror of the\n * compiler cap — see issue #41). */\nexport const MAX_FILTER_BLUR_PX = 100;\n/** Max CSS `brightness()` factor accepted at runtime (mirror of the\n * compiler cap — see issue #41 ; spec §6.1 blesses clamping to 4). */\nexport const MAX_FILTER_BRIGHTNESS = 4;\n\nconst MAX_FILTER_STRING_LEN = 64;\n\nconst CAPS: Record<FilterChannel, number> = {\n blur: MAX_FILTER_BLUR_PX,\n brightness: MAX_FILTER_BRIGHTNESS,\n};\n\nexport type FilterChannel = \"blur\" | \"brightness\";\n\n/**\n * Gate one live numeric filter channel (R8 runtime half).\n *\n * Returns the clamped value, or `null` when the value is rejected\n * (non-number, non-finite, negative — including `-0`, which would\n * stringify to an accepted `0`). A `null` MUST be handled as \"keep the\n * last known-good value / identity\" — never apply the raw input.\n */\nexport function clampFilterChannel(channel: FilterChannel, value: unknown): number | null {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return null;\n if (value < 0 || Object.is(value, -0)) return null;\n const cap = CAPS[channel];\n return value > cap ? cap : value;\n}\n\n// The ONLY string form the compiler ever emits (`lowerFilter`) :\n// `blur(<n>px) brightness(<n>)`. Anything else — extra functions,\n// `url(`, negative signs, exponents — is rejected by construction\n// (the grammar has no `-`, no `e`, no second parenthesis pair).\nconst FILTER_STRING_RE =\n /^blur\\((\\d{1,7}(?:\\.\\d{1,4})?)px\\) brightness\\((\\d{1,7}(?:\\.\\d{1,4})?)\\)$/;\n\n/** Identity filter — matches the compiler's neutral emission and\n * `INITIAL_IDENTITY.filter` in transitions.ts. */\nexport const FILTER_IDENTITY = \"blur(0px) brightness(1)\";\n\n/**\n * Gate a CSS filter STRING reaching framer-motion at runtime\n * (`animate_initial.filter`, keyframe `steps[].filter`). Hand-crafted\n * bundles bypass the compiler clamps, so the runtime re-validates and\n * re-clamps (R8). Returns the safe, clamped canonical string or `null`\n * on rejection — never the raw input.\n */\nexport function sanitizeCssFilterString(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n if (value.length === 0 || value.length > MAX_FILTER_STRING_LEN) return null;\n const m = FILTER_STRING_RE.exec(value);\n if (!m) return null;\n const blur = clampFilterChannel(\"blur\", Number(m[1]));\n const brightness = clampFilterChannel(\"brightness\", Number(m[2]));\n if (blur === null || brightness === null) return null;\n return `blur(${blur}px) brightness(${brightness})`;\n}\n\n/**\n * Diagnostic for a rejected filter value. Bastion R9 (ADR 001 §5.1) :\n * the rejected VALUE is never logged nor forwarded — only `node.id`\n * (RC#7, issue #34), the field name and a static reason. Routed through\n * the structured diagnostics channel (events, no logs in `broadcast`).\n */\nexport function warnRejectedFilter(field: string, nodeId?: string): void {\n emitDiagnostic(\n nodeId,\n field,\n \"rejected unsafe filter value : outside the R8 caps or not a finite number >= 0\",\n );\n}\n","// Local Transition type + Framer Motion translation.\n//\n// LSML 1.0 §6 declares `animate` directives at the primitive level (transition,\n// transform, opacity, filter). LSDP/1.1 §3.2.2 added per-leaf transition\n// directives on delta patches — incoming deltas can carry a transition hint\n// that overrides the bundle-level default for the next animation cycle.\n// `parseWireTransition` ingests the wire shape ; `Store.lastTransition(path)`\n// surfaces the most-recent directive to the renderer.\n//\n// We deliberately animate only GPU-friendly properties (transform, opacity,\n// filter). Primitives enforce this at the DOM level by exposing those props as\n// motion-bindable values rather than raw CSS.\n\nimport { sanitizeCssFilterString, warnRejectedFilter } from \"../render/filter-clamp\";\n\nexport type TransitionKind = \"none\" | \"tween\" | \"spring\" | \"crossfade\";\n\nexport interface TweenTransition {\n kind: \"tween\";\n duration_ms: number;\n ease?: \"linear\" | \"cubic-in\" | \"cubic-out\" | \"cubic-in-out\";\n}\n\nexport interface SpringTransition {\n kind: \"spring\";\n stiffness?: number;\n damping?: number;\n /** LSML 1.1 §6.2 — spring mass (kg). Default 1 (framer default). */\n mass?: number;\n}\n\nexport interface CrossfadeTransition {\n kind: \"crossfade\";\n duration_ms?: number;\n}\n\nexport interface NoTransition {\n kind: \"none\";\n}\n\nexport type Transition = NoTransition | TweenTransition | SpringTransition | CrossfadeTransition;\n\nexport type FramerEasing = \"linear\" | \"easeIn\" | \"easeOut\" | \"easeInOut\";\n\nexport interface FramerTransition {\n duration?: number;\n ease?: FramerEasing;\n type?: \"tween\" | \"spring\";\n stiffness?: number;\n damping?: number;\n mass?: number;\n}\n\nconst NO_ANIMATION: FramerTransition = { duration: 0 };\n\nconst EASE_MAP: Record<string, FramerEasing> = {\n linear: \"linear\",\n \"cubic-in\": \"easeIn\",\n \"cubic-out\": \"easeOut\",\n \"cubic-in-out\": \"easeInOut\",\n};\n\nexport function toFramer(t: Transition | undefined): FramerTransition {\n if (!t || t.kind === \"none\") return NO_ANIMATION;\n if (t.kind === \"tween\") {\n return {\n type: \"tween\",\n duration: (t.duration_ms ?? 0) / 1000,\n ease: t.ease ? (EASE_MAP[t.ease] ?? \"easeOut\") : \"easeOut\",\n };\n }\n if (t.kind === \"spring\") {\n return {\n type: \"spring\",\n ...(t.stiffness !== undefined ? { stiffness: t.stiffness } : {}),\n ...(t.damping !== undefined ? { damping: t.damping } : {}),\n ...(t.mass !== undefined ? { mass: t.mass } : {}),\n };\n }\n // crossfade at the per-prop level degenerates into a tween on opacity.\n return {\n type: \"tween\",\n duration: (t.duration_ms ?? 400) / 1000,\n ease: \"easeInOut\",\n };\n}\n\n// --- mount-play (LSML 1.1 `animate.from`) ---------------------------\n\n/** Identity (animation-end) value for each framer key an `animate.from`\n * may declare. A primitive that doesn't natively animate a given key\n * still converges it to this neutral value on mount so the element ends\n * up visually correct (e.g. a `from.scale: 0.85` settles at `scale: 1`). */\nconst INITIAL_IDENTITY: Record<string, number | string> = {\n opacity: 1,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n x: 0,\n y: 0,\n // LSML §6.1 filter identity — both functions are always present so\n // framer interpolates between structurally-identical filter lists\n // (the compiler emits the same two-function form, clamped per R8).\n filter: \"blur(0px) brightness(1)\",\n};\n\nexport interface MountPlay {\n initial: Record<string, number | string>;\n animate: Record<string, number | string>;\n}\n\n/**\n * Default mount-play timing — applies when a node carries an\n * `animate_initial` (LSML 1.1 `animate.from`) but no per-prop\n * `transitions` entry resolves for any animated key. The compiler\n * documents that `from` without an explicit `transition` mount-plays\n * \"with the runtime's default timing\" ; before this constant existed the\n * fallback was `toFramer(undefined)` → `{ duration: 0 }`, which snapped\n * the element straight to its settled state (the mount-play never\n * visibly played). 400 ms ease-out matches the runtime's other implicit\n * timings (crossfade fallback, scene-track fade).\n */\nexport const DEFAULT_MOUNT_PLAY_TRANSITION: Transition = {\n kind: \"tween\",\n duration_ms: 400,\n ease: \"cubic-out\",\n};\n\n/**\n * Resolve the transition a primitive should hand framer-motion.\n *\n * `keys` are the primitive's native animated prop keys, scanned in\n * order (e.g. `[\"opacity\", \"src\"]` for Image). When the node also\n * carries an `animate_initial`, the lookup widens to the keys the\n * mount-play actually moves (`from.scale` may have lowered a `scale`\n * transition that an opacity-only primitive would otherwise never look\n * up), and — critically — falls back to\n * `DEFAULT_MOUNT_PLAY_TRANSITION` instead of \"no animation\" : a\n * mount-play must tween, never complete in zero frames.\n *\n * Without `animate_initial` the prior behaviour is preserved exactly :\n * first declared transition among `keys`, else `undefined` (deltas\n * snap unless a transition is declared).\n */\nexport function resolveTransition(\n transitionFor: (key: string) => Transition | undefined,\n keys: string[],\n animateInitial?: Record<string, number | string>,\n): Transition | undefined {\n for (const key of keys) {\n const t = transitionFor(key);\n if (t !== undefined) return t;\n }\n if (animateInitial && Object.keys(animateInitial).length > 0) {\n for (const key of Object.keys(animateInitial)) {\n const t = transitionFor(key);\n if (t !== undefined) return t;\n }\n return DEFAULT_MOUNT_PLAY_TRANSITION;\n }\n return undefined;\n}\n\n/**\n * Build framer-motion `initial` / `animate` props for a primitive that\n * may carry an LSML 1.1 `animate.from` initial state.\n *\n * `base` is the primitive's own animated target (e.g. `{ opacity }` for\n * Image/Text/Shape, or `{ opacity, x, y, scale, rotate }` for Frame).\n * `initial` is the lowered `animate.from` map (or `undefined`).\n *\n * When `initial` is absent, this returns `{ initial: base, animate: base }`\n * — framer mounts at the target and never moves, exactly the prior\n * no-mount-play behaviour (backward compatible). When `initial` is\n * present, the element mounts at `initial` and animates to `base`,\n * augmented with identity convergence for any `from` key the primitive\n * doesn't already drive — so the mount-play plays out and settles\n * correctly even on opacity-only primitives.\n */\nexport function mountPlay(\n base: Record<string, number | string>,\n initial: Record<string, number | string> | undefined,\n nodeId?: string,\n): MountPlay {\n if (!initial || Object.keys(initial).length === 0) {\n // No `from` → mount directly at target. Pinning `initial` to the\n // target (rather than letting framer infer from current style)\n // preserves the existing \"no jump, no mount-play\" behaviour.\n return { initial: base, animate: base };\n }\n // R8 runtime half (ADR 001 §5.1, issue #42) — `animate_initial` may\n // come from a hand-crafted bundle that never went through the\n // compiler clamps. Re-gate the filter string ; rejected → drop the\n // key (the element mounts at the identity filter instead).\n let from = initial;\n if (initial[\"filter\"] !== undefined) {\n const safe = sanitizeCssFilterString(initial[\"filter\"]);\n from = { ...initial };\n if (safe === null) {\n warnRejectedFilter(\"animate_initial.filter\", nodeId);\n delete from[\"filter\"];\n } else {\n from[\"filter\"] = safe;\n }\n }\n const animate: Record<string, number | string> = { ...base };\n for (const key of Object.keys(from)) {\n if (!(key in animate)) {\n animate[key] = INITIAL_IDENTITY[key] ?? 0;\n }\n }\n return { initial: from, animate };\n}\n\n/**\n * Parse a wire-format `TransitionSpec` (LSDP/1.1 §3.2.2) into the\n * runtime's local Transition type. Returns `undefined` for malformed\n * input so the caller falls back to whatever bundle-level default\n * applies. The wire shape uses kebab-case `easing` values\n * (`linear`, `ease-in`, `ease-out`, `ease-in-out`) which we map to\n * the runtime's `cubic-*` vocabulary.\n */\nexport function parseWireTransition(value: unknown): Transition | undefined {\n if (typeof value !== \"object\" || value === null) return undefined;\n const v = value as Record<string, unknown>;\n const kind = v.kind;\n if (kind === \"snap\") {\n return { kind: \"none\" };\n }\n if (kind === \"tween\") {\n const duration_ms = typeof v.duration_ms === \"number\" ? v.duration_ms : 0;\n const easing = WIRE_EASING_MAP[v.easing as string] ?? \"cubic-out\";\n return { kind: \"tween\", duration_ms, ease: easing };\n }\n if (kind === \"spring\") {\n const out: SpringTransition = { kind: \"spring\" };\n if (typeof v.stiffness === \"number\") out.stiffness = v.stiffness;\n if (typeof v.damping === \"number\") out.damping = v.damping;\n // LSML §6.2 — mass rides the same wire spring shape.\n if (typeof v.mass === \"number\") out.mass = v.mass;\n return out;\n }\n return undefined;\n}\n\nconst WIRE_EASING_MAP: Record<string, \"linear\" | \"cubic-in\" | \"cubic-out\" | \"cubic-in-out\"> = {\n linear: \"linear\",\n \"ease-in\": \"cubic-in\",\n \"ease-out\": \"cubic-out\",\n \"ease-in-out\": \"cubic-in-out\",\n};\n","import { batch } from \"@preact/signals-react\";\nimport type { DeltaFrame } from \"@lumencast/protocol\";\nimport type { Store } from \"./store.js\";\nimport { parseWireTransition } from \"../animate/transitions\";\n\n/** Apply an LSDP/1 delta. All patches in the frame land in a single signals\n * batch — components reading multiple paths see them flip in one render pass.\n *\n * LSDP/1.1 §3.2.2 — a patch may carry a `transition` directive overriding\n * the bundle-level default for the next animation cycle on that leaf. We\n * thread it through the store so the renderer reads the correct directive\n * alongside the new value. */\nexport function applyDelta(store: Store, frame: DeltaFrame): void {\n batch(() => {\n for (const patch of frame.patches) {\n const transition = parseWireTransition(patch.transition);\n if (transition !== undefined) {\n store.setWithTransition(patch.path, patch.value, transition);\n } else {\n store.set(patch.path, patch.value);\n }\n }\n });\n}\n","import type { SnapshotFrame } from \"@lumencast/protocol\";\nimport type { Store } from \"./store.js\";\n\n/** Apply an LSDP/1 snapshot to the store. Replaces the entire state — paths\n * not present in the snapshot are reset to `undefined`. */\nexport function applySnapshot(store: Store, frame: SnapshotFrame): void {\n store.reset(frame.state);\n}\n","// State store — one signal per leaf path.\n//\n// Integration point between the WS layer (snapshot + delta) and the render\n// layer. Each path Lumencast has ever seen owns a `Signal<unknown>`;\n// readers subscribe via @preact/signals-react `useSignals()` and re-render\n// only when their path's value changes.\n//\n// LSDP/1.1 §3.2.2 — incoming deltas may carry a per-leaf `transition`\n// directive. The store keeps the most-recent directive per path so the\n// renderer can pick it up on the next animation cycle. Snapshots clear\n// any pending transitions for the affected paths (snapshots are not\n// animated transitions).\n\nimport { signal, type Signal, batch } from \"@preact/signals-react\";\nimport type { Transition } from \"../animate/transitions\";\n\nexport interface Store {\n /** Get-or-create the signal for a path. New paths start as `undefined`. */\n signal(path: string): Signal<unknown>;\n /** Apply a single leaf write. */\n set(path: string, value: unknown): void;\n /** Apply a single leaf write with an LSDP/1.1 §3.2.2 transition directive.\n * The directive lives in a separate signal so the renderer can subscribe\n * to it independently. Passing `undefined` clears any pending directive. */\n setWithTransition(path: string, value: unknown, transition: Transition | undefined): void;\n /** Read the most-recent transition directive for a path (or undefined\n * when no directive has been applied since the last snapshot). The\n * returned signal is reactive — components reading via `useSignals()`\n * re-render when the directive changes. */\n transitionSignal(path: string): Signal<Transition | undefined>;\n /**\n * Replace the whole state — used by `apply-snapshot`. Existing signals are\n * reused (subscribers stay attached); paths missing from the snapshot reset\n * to `undefined`. Pending per-path transitions are cleared (a snapshot is\n * a state restore, not an animated change).\n */\n reset(state: Record<string, unknown>): void;\n /** Snapshot of every known path → current value. For debug / state inspector. */\n toRecord(): Record<string, unknown>;\n}\n\nclass StoreImpl implements Store {\n private readonly signals = new Map<string, Signal<unknown>>();\n private readonly transitions = new Map<string, Signal<Transition | undefined>>();\n\n signal(path: string): Signal<unknown> {\n let s = this.signals.get(path);\n if (!s) {\n s = signal<unknown>(undefined);\n this.signals.set(path, s);\n }\n return s;\n }\n\n transitionSignal(path: string): Signal<Transition | undefined> {\n let s = this.transitions.get(path);\n if (!s) {\n s = signal<Transition | undefined>(undefined);\n this.transitions.set(path, s);\n }\n return s;\n }\n\n set(path: string, value: unknown): void {\n const s = this.signal(path);\n if (!shallowEqual(s.peek(), value)) {\n s.value = value;\n }\n }\n\n setWithTransition(path: string, value: unknown, transition: Transition | undefined): void {\n batch(() => {\n const ts = this.transitionSignal(path);\n // Update transition before value so the render that observes the\n // new value sees the correct transition.\n if (ts.peek() !== transition) ts.value = transition;\n const s = this.signal(path);\n if (!shallowEqual(s.peek(), value)) s.value = value;\n });\n }\n\n reset(state: Record<string, unknown>): void {\n batch(() => {\n const seen = new Set<string>();\n for (const [path, value] of Object.entries(state)) {\n seen.add(path);\n const s = this.signal(path);\n if (!shallowEqual(s.peek(), value)) {\n s.value = value;\n }\n // Snapshots are not animated transitions — clear any pending\n // per-path directive (LSDP/1.1 §3.2.2 — directives apply to\n // the NEXT delta only, snapshots reseed state authoritatively).\n const ts = this.transitions.get(path);\n if (ts && ts.peek() !== undefined) ts.value = undefined;\n }\n for (const path of this.signals.keys()) {\n if (!seen.has(path)) {\n const s = this.signals.get(path);\n if (s && s.peek() !== undefined) s.value = undefined;\n }\n }\n });\n }\n\n toRecord(): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [path, s] of this.signals.entries()) {\n out[path] = s.peek();\n }\n return out;\n }\n}\n\nexport function createStore(): Store {\n return new StoreImpl();\n}\n\nfunction shallowEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (typeof a !== typeof b) return false;\n if (typeof a !== \"object\") return false;\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n const ao = a as Record<string, unknown>;\n const bo = b as Record<string, unknown>;\n const ak = Object.keys(ao);\n const bk = Object.keys(bo);\n if (ak.length !== bk.length) return false;\n for (const k of ak) {\n if (ao[k] !== bo[k]) return false;\n }\n return true;\n}\n","// Render bundle — the runtime's flat, pre-compiled representation of a scene.\n//\n// The bundle is content-addressed by `scene_version` (sha256 of the\n// canonical JSON form). Lumencast fetches it once per `scene_version` and\n// caches forever; the server serves it with long-TTL immutable cache headers.\n//\n// Note on shape: this `RenderBundle` is the flat, runtime-internal form. The\n// canonical *authoring* format (LSML 1.0, see lumencast-protocol/spec/LSML-1.md)\n// uses inline `bind: { value: \"path\" }` per primitive instead of a `bindings`\n// map. A compiler step (forthcoming `@lumencast/compiler`) will translate\n// LSML 1.0 → RenderBundle. For now, callers who want to feed an LSML 1.0\n// bundle pre-compile or use a hand-rolled adapter.\n\nimport type { Transition } from \"../animate/transitions.js\";\nimport type { Keyframes } from \"../animate/keyframes.js\";\n\n// --- bundle shape ----------------------------------------------------\n\nexport type RenderKind =\n | \"stack\"\n | \"grid\"\n | \"frame\"\n | \"text\"\n | \"image\"\n | \"shape\"\n | \"media\"\n | \"repeat\"\n | \"instance\";\n\nexport interface RenderNode {\n kind: RenderKind;\n /** Stable identifier for keyed reconciliation. */\n id?: string;\n /** Static props (frozen at build/compile time). */\n props?: Record<string, unknown>;\n /** Prop name → state path. The render layer subscribes the path's signal\n * and applies the value to the named prop on each change. */\n bindings?: Record<string, string>;\n /** Default transition per bound prop. Aligns with LSML 1.0 §6 `animate`\n * directives. The runtime applies these as CSS transitions / Framer Motion\n * configs at render time. */\n transitions?: Record<string, Transition>;\n /** LSML 1.1 §6 `animate.from` — mount-time initial state, lowered to a\n * flat framer-motion `initial` map (keys: `opacity`, `scale`, `rotate`,\n * `x`, `y`, `filter`). When present, the rendering primitive passes this\n * as framer-motion `initial={...}` so the element mounts in this state\n * and animates to its declared target on mount (mount-play). When absent,\n * the primitive applies no `initial` and the prior no-mount-play\n * behaviour holds (backward compatible). */\n animate_initial?: Record<string, number | string>;\n /** LSML 1.1 §6.3 — animation targets bound to leaf paths\n * (`bindAnimate`). Keys are the spec property names (`opacity`,\n * `transform.translate`, `transform.scale`, `transform.rotate`,\n * `filter.blur`, `filter.brightness`, plus the kind's colour-typed\n * property per §6.5 : `style.color` / `fill` / `background`) ; values\n * are LeafPaths. The runtime subscribes each path's leaf-grain signal\n * and retargets a Framer motion value on change — continuous\n * interpolation toward the live value, no remount. Deltas are\n * coalesced per frame (one retarget max per rAF per binding,\n * ADR 001 RC#13). */\n animateBindings?: Record<string, string>;\n /** LSML 1.1 §6.6 — multi-step keyframe sequence played on mount or\n * whenever `keyframes.key` (LeafPath) changes. Coexists with\n * `transitions` ; the runtime applies whichever was last triggered\n * (no blending — see §6.6 last paragraph). */\n keyframes?: Keyframes;\n /** LSML 1.1 §6.7 — only meaningful on `repeat`. Each iteration's\n * animations start `index * stagger_ms` after iteration 0. */\n stagger_ms?: number;\n /** Children — already-inlined primitives only. */\n children?: RenderNode[];\n}\n\nexport type OperatorInputType =\n | \"boolean\"\n | \"number\"\n | \"text\"\n | \"select\"\n | \"enum\"\n | \"path-ref\"\n | \"colour\"\n | \"duration\";\n\nexport interface OperatorInput {\n path: string;\n label: string;\n type: OperatorInputType;\n default?: unknown;\n group?: string;\n writable_by?: string[];\n [extra: string]: unknown;\n}\n\nexport interface ExternalAdapter {\n key: string;\n label: string;\n kind: string;\n target_paths: string[];\n [extra: string]: unknown;\n}\n\nexport interface Asset {\n id: string;\n url: string;\n kind: string;\n [extra: string]: unknown;\n}\n\nexport interface RenderBundle {\n scene_version: string;\n root: RenderNode;\n operator_inputs?: OperatorInput[];\n external_adapters?: ExternalAdapter[];\n assets?: Asset[];\n /** LSML 1.1 §17.3 — capability profiles required for correct rendering.\n * Each entry is an `x-<vendor>.<name>/<version>` string. The runtime\n * checks every behavioural entry against its supported list ; an\n * unrecognised behavioural profile raises BUNDLE_INCOMPATIBLE per\n * §17.3.1. Authoring profiles (`x-<vendor>.authoring/<major>`, §17.5.1)\n * are advisory : ignored at render time, never a rejection cause. */\n profiles?: string[];\n}\n\n/**\n * Profiles the JS runtime advertises support for. Bundle authors who\n * declare `profiles: [...]` get a hard `BUNDLE_INCOMPATIBLE` rejection\n * when any entry is not in this set (LSML 1.1 §17.3.1).\n *\n * 1.1 ships with no standard profiles ; future minors / vendor specs\n * register here. The `x-lumencast.color-srgb-1.0` entry is the\n * default-color-space marker ; bundles that opt into a perceptual\n * space (OKLCH) would request a different profile and currently\n * reject.\n */\nexport const SUPPORTED_PROFILES: ReadonlySet<string> = new Set<string>([\n \"x-lumencast.color-srgb-1.0\",\n]);\n\n// LSML 1.1 §17.5.1 + ADR 001 RC#14 — authoring-profile detection.\n//\n// An authoring profile is advisory : a runtime that does not support it\n// MUST NOT reject the bundle and renders the underlying primitives as if\n// the profile were absent. Detection matches the COMPLETE identifier form\n// `x-<vendor>.authoring/<major>` :\n//\n// - `x-` prefix, then one or more lowercase name segments separated by\n// dots, where `.authoring` is the EXACT TERMINAL segment before `/` ;\n// - `<major>` is a bare integer (no `.minor`) ;\n// - never a substring test : a behavioural profile whose name merely\n// *contains* `.authoring` in a non-terminal position is NOT exempted\n// and keeps §17.3.1 hard-rejection semantics.\n//\n// Anti-ReDoS note : both regexes below are anchored and unambiguous —\n// the character classes exclude the `.` and `/` separators, so there is\n// exactly one possible parse per input (linear time, no backtracking).\nconst AUTHORING_NAME_RE = /^x-[a-z0-9-]+(?:\\.[a-z0-9-]+)*$/;\nconst AUTHORING_MAJOR_RE = /^(?:0|[1-9][0-9]*)$/;\nconst AUTHORING_SUFFIX = \".authoring\";\n\n/** True when `id` has the complete authoring-profile form\n * `x-<vendor>.authoring/<major>` (LSML 1.1 §17.5.1, ADR 001 RC#14).\n * Such profiles are advisory : ignored at render time, never rejected. */\nexport function isAuthoringProfile(id: string): boolean {\n const slash = id.indexOf(\"/\");\n if (slash < 0) return false;\n const name = id.slice(0, slash);\n const major = id.slice(slash + 1);\n if (!AUTHORING_MAJOR_RE.test(major)) return false;\n if (!name.endsWith(AUTHORING_SUFFIX)) return false;\n // `name` minus the terminal `.authoring` segment must still be a valid\n // `x-<vendor>[.<segment>...]` prefix — this is what makes `.authoring`\n // a real terminal segment rather than a substring of another one\n // (e.g. `x-evilauthoring/1` or `x-evil.authoring.fx/1` do not match).\n return AUTHORING_NAME_RE.test(name.slice(0, -AUTHORING_SUFFIX.length));\n}\n\nexport class BundleIncompatibleError extends Error {\n public readonly code = \"BUNDLE_INCOMPATIBLE\" as const;\n public readonly unsupportedProfiles: string[];\n constructor(unsupportedProfiles: string[]) {\n super(\n `BUNDLE_INCOMPATIBLE: profile(s) not supported by this runtime: ${unsupportedProfiles.join(\n \", \",\n )}`,\n );\n this.name = \"BundleIncompatibleError\";\n this.unsupportedProfiles = unsupportedProfiles;\n }\n}\n\n/** Validate a bundle's `profiles[]` against the runtime's supported\n * set. Throws `BundleIncompatibleError` listing every offending entry\n * when at least one behavioural profile is not supported.\n *\n * Authoring profiles (`x-<vendor>.authoring/<major>`, LSML 1.1 §17.5.1)\n * are advisory and skipped : their absence from the supported set is\n * never a rejection cause. Every other (behavioural) unsupported profile\n * keeps the hard §17.3.1 `BUNDLE_INCOMPATIBLE` rejection.\n *\n * Malformed-shape guard : `bundle` may come from an unchecked\n * `json as RenderBundle` cast on untrusted server JSON\n * (`FetcherImpl.get`). A non-array `profiles` or a non-string entry is\n * therefore reachable at runtime and is rejected as\n * `BundleIncompatibleError` (typed, code BUNDLE_INCOMPATIBLE) — never a\n * raw TypeError. The diagnostic never echoes the malformed value, only a\n * shape placeholder. */\nexport function validateBundleProfiles(\n bundle: { profiles?: string[] },\n supported: ReadonlySet<string> = SUPPORTED_PROFILES,\n): void {\n const profiles: unknown = bundle.profiles;\n if (!profiles) return;\n if (!Array.isArray(profiles)) {\n throw new BundleIncompatibleError([\"<malformed: profiles is not an array>\"]);\n }\n if (profiles.length === 0) return;\n const missing = profiles\n .filter((p) => typeof p !== \"string\" || (!isAuthoringProfile(p) && !supported.has(p)))\n .map((p) => (typeof p === \"string\" ? p : \"<malformed: non-string profile entry>\"));\n if (missing.length > 0) {\n throw new BundleIncompatibleError(missing);\n }\n}\n\n// --- fetch + cache ---------------------------------------------------\n\nexport interface BundleFetcher {\n /** Fetch the bundle for a scene version. Cached forever by hash. */\n get(sceneId: string, sceneVersion: string): Promise<RenderBundle>;\n /** Inject a bundle directly — used by tests and for the \"scene already in\n * flight\" handoff path. */\n preload(bundle: RenderBundle): void;\n}\n\n/** Resolves the absolute URL of a scene's render bundle. Supplied by the\n * host (`MountOptions.resolveBundleUrl`) when the server is not at the\n * default host-root LSDP/1 layout — e.g. reached through a gateway prefix\n * (`https://gw/orion/api/v1/scenes/{id}/render-bundle?v={hash}`). */\nexport type BundleUrlResolver = (sceneId: string, sceneVersion: string) => string;\n\nexport interface BundleFetcherOptions {\n /** Base URL of the server. The fetcher constructs\n * `${baseUrl}/lsdp/v1/scenes/{id}/bundle?v={hash}`. Ignored when\n * `resolveUrl` is provided. */\n baseUrl: string;\n /** Path prefix for bundle resolution. Defaults to `/lsdp/v1/scenes`.\n * Ignored when `resolveUrl` is provided. */\n pathPrefix?: string;\n /** When set, takes full control of URL construction — the host owns the\n * whole URL (base, path prefix and `/bundle` vs `/render-bundle` suffix).\n * Lets a gateway-prefixed server be addressed without changing the\n * host-root default. */\n resolveUrl?: BundleUrlResolver;\n fetchImpl?: typeof fetch;\n}\n\nclass FetcherImpl implements BundleFetcher {\n private readonly cache = new Map<string, RenderBundle>();\n private readonly baseUrl: string;\n private readonly pathPrefix: string;\n private readonly resolveUrl: BundleUrlResolver | undefined;\n private readonly fetchImpl: typeof fetch;\n\n constructor(opts: BundleFetcherOptions) {\n this.baseUrl = opts.baseUrl.replace(/\\/$/, \"\");\n this.pathPrefix = (opts.pathPrefix ?? \"/lsdp/v1/scenes\").replace(/\\/$/, \"\");\n this.resolveUrl = opts.resolveUrl;\n this.fetchImpl = opts.fetchImpl ?? globalThis.fetch.bind(globalThis);\n }\n\n private buildUrl(sceneId: string, sceneVersion: string): string {\n if (this.resolveUrl) {\n return this.resolveUrl(sceneId, sceneVersion);\n }\n return `${this.baseUrl}${this.pathPrefix}/${encodeURIComponent(sceneId)}/bundle?v=${encodeURIComponent(sceneVersion)}`;\n }\n\n preload(bundle: RenderBundle): void {\n // LSML 1.1 §17.3.1 — reject early if any declared profile is\n // unsupported by this runtime. Authors get an actionable error\n // instead of a silent rendering glitch.\n validateBundleProfiles(bundle);\n this.cache.set(bundle.scene_version, bundle);\n }\n\n async get(sceneId: string, sceneVersion: string): Promise<RenderBundle> {\n const cached = this.cache.get(sceneVersion);\n if (cached) return cached;\n const url = this.buildUrl(sceneId, sceneVersion);\n const response = await this.fetchImpl(url);\n if (!response.ok) {\n throw new Error(`bundle fetch failed: ${response.status} ${response.statusText}`);\n }\n const json = (await response.json()) as RenderBundle;\n if (json.scene_version !== sceneVersion) {\n throw new Error(\n `bundle scene_version mismatch: expected ${sceneVersion}, got ${json.scene_version}`,\n );\n }\n validateBundleProfiles(json);\n this.cache.set(sceneVersion, json);\n return json;\n }\n}\n\nexport function createBundleFetcher(opts: BundleFetcherOptions): BundleFetcher {\n return new FetcherImpl(opts);\n}\n","// Exponential backoff schedule for the WS reconnect loop.\n//\n// Aggressive at first (200 ms, 400 ms, 800 ms…) then capped at 5 s so a\n// sustained outage doesn't hammer the gateway. Jittered to avoid thundering\n// herds when several Lumencast instances reconnect together (e.g. a CEF\n// host + a webview waking from suspend at the same time).\n//\n// The reference schedule in LSDP/1 §7 is \"0 ms, 500 ms, 1 s, 2 s, 4 s, 8 s,\n// 15 s, 30 s, 60 s cap\". This implementation defaults are tighter; both are\n// MAY-bounded by the spec.\n\nexport interface ReconnectScheduleOptions {\n /** First delay in milliseconds. */\n initial?: number;\n /** Maximum delay in milliseconds. */\n max?: number;\n /** Multiplicative factor between attempts (>= 1). */\n factor?: number;\n /** Jitter as a fraction of the delay (0 disables, 0.2 = ±20 %). */\n jitter?: number;\n /** Random source — only injected for tests. */\n random?: () => number;\n}\n\nconst DEFAULTS: Required<Omit<ReconnectScheduleOptions, \"random\">> = {\n initial: 200,\n max: 5_000,\n factor: 2,\n jitter: 0.2,\n};\n\nexport interface ReconnectSchedule {\n /** Returns the delay to wait before the n-th attempt (1-indexed). */\n delayFor(attempt: number): number;\n /** Reset to attempt 1 (called on a successful connection). */\n reset(): void;\n /** Current attempt counter. */\n readonly attempt: number;\n}\n\nclass ScheduleImpl implements ReconnectSchedule {\n private _attempt = 0;\n constructor(\n private readonly opts: Required<Omit<ReconnectScheduleOptions, \"random\">>,\n private readonly random: () => number,\n ) {}\n\n get attempt(): number {\n return this._attempt;\n }\n\n delayFor(attempt: number): number {\n if (!Number.isInteger(attempt) || attempt < 1) {\n throw new RangeError(`attempt must be a positive integer, got ${attempt}`);\n }\n this._attempt = attempt;\n const base = Math.min(\n this.opts.initial * Math.pow(this.opts.factor, attempt - 1),\n this.opts.max,\n );\n if (this.opts.jitter <= 0) return base;\n const offset = (this.random() * 2 - 1) * this.opts.jitter * base;\n return Math.max(0, base + offset);\n }\n\n reset(): void {\n this._attempt = 0;\n }\n}\n\nexport function createReconnectSchedule(opts: ReconnectScheduleOptions = {}): ReconnectSchedule {\n const merged = {\n initial: opts.initial ?? DEFAULTS.initial,\n max: opts.max ?? DEFAULTS.max,\n factor: opts.factor ?? DEFAULTS.factor,\n jitter: opts.jitter ?? DEFAULTS.jitter,\n };\n if (merged.initial <= 0) throw new RangeError(\"initial must be > 0\");\n if (merged.max < merged.initial) throw new RangeError(\"max must be >= initial\");\n if (merged.factor < 1) throw new RangeError(\"factor must be >= 1\");\n if (merged.jitter < 0 || merged.jitter > 1) throw new RangeError(\"jitter must be within [0, 1]\");\n return new ScheduleImpl(merged, opts.random ?? Math.random);\n}\n","// LSDP/1 WebSocket client.\n//\n// Lifecycle (LSDP/1 §6):\n// 1. open() — opens the WS with subprotocol `lsdp.v1`\n// 2. on open: send `subscribe` with the resolved token (and scene + session\n// for test mode)\n// 3. server replies `snapshot` (seq=1) → emit onSnapshot\n// 4. subsequent `delta` / `scene_changed` / `error` / `pong` are dispatched\n// 5. on a sequence gap → close + reconnect (fresh snapshot)\n// 6. on close → reconnect with backoff, unless close was triggered by close()\n// 7. setToken() opens a parallel WS with the new token; once its snapshot\n// lands, atomically swap and close the old socket — no rendering gap\n\nimport {\n decodeServerFrame,\n encodeFrame,\n LumencastError,\n SequenceTracker,\n WS_SUBPROTOCOL_V1_1,\n WS_SUBPROTOCOLS,\n input as inputFrame,\n subscribe as subscribeFrame,\n type DeltaFrame,\n type ErrorCode,\n type ErrorFrame,\n type Patch,\n type SceneChangedFrame,\n type SnapshotFrame,\n} from \"@lumencast/protocol\";\nimport type { LumencastToken } from \"../types.js\";\nimport {\n createReconnectSchedule,\n type ReconnectSchedule,\n type ReconnectScheduleOptions,\n} from \"./reconnect.js\";\n\nexport type ConnectionStatus = \"disconnected\" | \"connecting\" | \"live\";\n\nexport interface WsClientOptions {\n url: string;\n token: LumencastToken;\n /** Optional scene identifier (test mode). */\n scene?: string;\n /** Optional session identifier (test mode). */\n session?: string;\n /** Override the WebSocket constructor (for tests / non-browser hosts). */\n webSocketImpl?: typeof WebSocket;\n /** Reconnect tuning. */\n reconnect?: ReconnectScheduleOptions;\n /** Inject scheduler for tests. */\n scheduler?: {\n setTimeout: typeof globalThis.setTimeout;\n clearTimeout: typeof globalThis.clearTimeout;\n };\n\n onStatus?: (status: ConnectionStatus) => void;\n onSnapshot?: (frame: SnapshotFrame) => void;\n onDelta?: (frame: DeltaFrame) => void;\n onSceneChanged?: (frame: SceneChangedFrame) => void;\n onServerError?: (frame: ErrorFrame) => void;\n /** Wire-level / codec / unrecoverable errors. */\n onTransportError?: (err: TransportError) => void;\n}\n\nexport class TransportError extends Error {\n public readonly recoverable: boolean;\n public readonly code: ErrorCode;\n public override readonly cause?: unknown;\n constructor(\n message: string,\n recoverable: boolean,\n code: ErrorCode = \"INTERNAL\",\n cause?: unknown,\n ) {\n super(message);\n this.name = \"TransportError\";\n this.recoverable = recoverable;\n this.code = code;\n this.cause = cause;\n }\n}\n\ntype Timer = ReturnType<typeof setTimeout>;\n\ninterface InternalScheduler {\n setTimeout: typeof globalThis.setTimeout;\n clearTimeout: typeof globalThis.clearTimeout;\n}\n\nexport class WsClient {\n private status: ConnectionStatus = \"disconnected\";\n private socket: WebSocket | null = null;\n private token: LumencastToken;\n private readonly url: string;\n private readonly WebSocketCtor: typeof WebSocket;\n private readonly schedule: ReconnectSchedule;\n private readonly seq = new SequenceTracker();\n private readonly opts: WsClientOptions;\n private readonly scheduler: InternalScheduler;\n\n private reconnectTimer: Timer | null = null;\n private active = true;\n\n constructor(opts: WsClientOptions) {\n this.opts = opts;\n this.url = opts.url;\n this.token = opts.token;\n const ctor = opts.webSocketImpl ?? globalThis.WebSocket;\n if (!ctor) {\n throw new TypeError(\n \"Lumencast WsClient: no WebSocket implementation found in this environment\",\n );\n }\n this.WebSocketCtor = ctor;\n this.schedule = createReconnectSchedule(opts.reconnect);\n this.scheduler = opts.scheduler ?? {\n setTimeout: globalThis.setTimeout.bind(globalThis),\n clearTimeout: globalThis.clearTimeout.bind(globalThis),\n };\n }\n\n /** Open and start the connection lifecycle. Idempotent. */\n start(): void {\n if (!this.active) return;\n if (this.socket || this.status === \"connecting\") return;\n void this.openSocket();\n }\n\n /** Send `input` patches to the server. No-op if not connected. */\n sendInput(patches: Patch[]): void {\n if (!this.socket || this.socket.readyState !== this.WebSocketCtor.OPEN) return;\n if (patches.length === 0) return;\n this.socket.send(encodeFrame(inputFrame(patches)));\n }\n\n /** Replace the auth token. Closes and reopens with the new token. */\n setToken(token: LumencastToken): void {\n this.token = token;\n if (!this.active) return;\n if (this.socket) {\n this.closeSocket();\n this.scheduleReconnect(true);\n }\n }\n\n /** Tear down for good. No more reconnect attempts. */\n close(): void {\n if (!this.active) return;\n this.active = false;\n this.cancelReconnect();\n this.closeSocket();\n this.setStatus(\"disconnected\");\n }\n\n // --- internals --------------------------------------------------\n\n private async openSocket(): Promise<void> {\n if (!this.active) return;\n this.setStatus(\"connecting\");\n\n let resolvedToken: string;\n try {\n resolvedToken = await resolveToken(this.token);\n } catch (err) {\n this.opts.onTransportError?.(\n new TransportError(\n `failed to resolve token: ${(err as Error).message}`,\n true,\n \"AUTH_DENIED\",\n err,\n ),\n );\n this.scheduleReconnect();\n return;\n }\n if (!this.active) return;\n\n let socket: WebSocket;\n try {\n // Advertise both 1.1 (preferred) and 1.0 (fallback) ; the server\n // picks one. Spread to a mutable array — the WebSocket constructor\n // type expects string[].\n socket = new this.WebSocketCtor(this.url, [...WS_SUBPROTOCOLS]);\n } catch (err) {\n this.opts.onTransportError?.(\n new TransportError(\n `failed to open WebSocket: ${(err as Error).message}`,\n true,\n \"INTERNAL\",\n err,\n ),\n );\n this.scheduleReconnect();\n return;\n }\n\n this.socket = socket;\n socket.onopen = () => this.handleOpen(resolvedToken);\n socket.onmessage = (event) => this.handleMessage(event);\n socket.onerror = (event) => this.handleError(event);\n socket.onclose = (event) => this.handleClose(event);\n }\n\n private handleOpen(token: string): void {\n if (!this.socket) return;\n // LSDP/1.1 §4.1, §18 — if we have a previously-observed seq AND the\n // negotiated subprotocol is 1.1, request an incremental resume.\n // The server will EITHER ship buffered deltas (cache stays valid)\n // OR a fresh snapshot which we rebase via observeSnapshot.\n const subprotocol = this.socket.protocol;\n const canResume = subprotocol === WS_SUBPROTOCOL_V1_1 && this.seq.last > 0;\n const sinceSequence = canResume ? this.seq.last : undefined;\n if (!canResume) {\n // Fresh subscription (no resume) — reset the tracker baseline.\n this.seq.reset();\n }\n const frame = subscribeFrame({\n token,\n ...(this.opts.scene !== undefined ? { scene: this.opts.scene } : {}),\n ...(this.opts.session !== undefined ? { session: this.opts.session } : {}),\n ...(sinceSequence !== undefined ? { since_sequence: sinceSequence } : {}),\n });\n this.socket.send(encodeFrame(frame));\n }\n\n private handleMessage(event: MessageEvent): void {\n const data = typeof event.data === \"string\" ? event.data : \"\";\n if (!data) return;\n let frame;\n try {\n frame = decodeServerFrame(data);\n } catch (err) {\n const message = err instanceof LumencastError ? err.message : (err as Error).message;\n const code: ErrorCode = err instanceof LumencastError ? err.code : \"INTERNAL\";\n this.opts.onTransportError?.(new TransportError(`codec: ${message}`, true, code, err));\n this.closeSocket();\n this.scheduleReconnect();\n return;\n }\n if (frame === null) return; // unknown frame type — forward-compat ignore\n\n switch (frame.type) {\n case \"snapshot\": {\n // LSDP/1.1 §18.1.1 — snapshot rebases the tracker to its seq\n // value. This is the ONLY valid way to set or change the\n // tracker's baseline (handles fresh sub, scene_changed, and\n // back-pressure recovery uniformly).\n if (frame.seq < 1) {\n this.opts.onTransportError?.(\n new TransportError(`snapshot seq must be >= 1, got ${frame.seq}`, true, \"VERSION_GAP\"),\n );\n this.closeSocket();\n this.scheduleReconnect();\n return;\n }\n this.seq.observeSnapshot(frame.seq);\n this.schedule.reset();\n this.setStatus(\"live\");\n this.opts.onSnapshot?.(frame);\n return;\n }\n case \"delta\": {\n const obs = this.seq.observe(frame.seq);\n if (obs.kind === \"gap\") {\n this.opts.onTransportError?.(\n new TransportError(\n `sequence gap: expected ${this.seq.last + 1}, got ${frame.seq}`,\n true,\n \"VERSION_GAP\",\n ),\n );\n this.closeSocket();\n this.scheduleReconnect();\n return;\n }\n if (obs.kind === \"duplicate\") return; // silent drop per LSDP/1 §5\n this.opts.onDelta?.(frame);\n return;\n }\n case \"scene_changed\": {\n // The next snapshot will rebase the tracker via observeSnapshot.\n // Reset here so the tracker doesn't fault on the SceneChanged's\n // own seq (which advances prev's counter one final step).\n this.seq.reset();\n this.opts.onSceneChanged?.(frame);\n return;\n }\n case \"error\": {\n this.opts.onServerError?.(frame);\n if (!frame.recoverable) this.close();\n return;\n }\n case \"pong\":\n return;\n }\n }\n\n private handleError(_event: Event): void {\n // The browser does not give us a real reason — `close` will follow.\n }\n\n private handleClose(event: CloseEvent): void {\n this.socket = null;\n if (!this.active) {\n this.setStatus(\"disconnected\");\n return;\n }\n if (event.code === 4401 || event.code === 4403 || event.code === 1008) {\n // Auth-related close codes: not recoverable without operator intervention.\n this.opts.onTransportError?.(\n new TransportError(`server closed: ${event.code} ${event.reason}`, false, \"AUTH_DENIED\"),\n );\n this.close();\n return;\n }\n this.scheduleReconnect();\n }\n\n private scheduleReconnect(immediate = false): void {\n if (!this.active) return;\n this.cancelReconnect();\n const attempt = (this.schedule.attempt || 0) + 1;\n const delay = immediate ? 0 : this.schedule.delayFor(attempt);\n this.setStatus(\"disconnected\");\n this.reconnectTimer = this.scheduler.setTimeout(() => {\n this.reconnectTimer = null;\n void this.openSocket();\n }, delay);\n }\n\n private cancelReconnect(): void {\n if (this.reconnectTimer) {\n this.scheduler.clearTimeout(this.reconnectTimer);\n this.reconnectTimer = null;\n }\n }\n\n private closeSocket(): void {\n if (this.socket) {\n try {\n this.socket.close(1000, \"client closing\");\n } catch {\n // ignore\n }\n this.socket = null;\n }\n }\n\n private setStatus(next: ConnectionStatus): void {\n if (this.status === next) return;\n this.status = next;\n this.opts.onStatus?.(next);\n }\n}\n\nasync function resolveToken(token: LumencastToken): Promise<string> {\n if (typeof token === \"string\") return token;\n return await token.fetch();\n}\n","import type { MountOptions } from \"../types\";\n\n/** Throws on invalid mount options. Exposed separately so unit tests\n * can exercise it without mounting a real React root. */\nexport function validateOptions(options: MountOptions): void {\n if (!(options.target instanceof HTMLElement)) {\n throw new TypeError(\"mount: `target` must be an HTMLElement\");\n }\n if (typeof options.serverUrl !== \"string\" || options.serverUrl.length === 0) {\n throw new TypeError(\"mount: `serverUrl` must be a non-empty string\");\n }\n if (options.mode === \"test\") {\n if (!options.testSession) {\n throw new TypeError(\"mount: `testSession` is required when mode === 'test'\");\n }\n if (!options.scene) {\n throw new TypeError(\"mount: `scene` is required when mode === 'test'\");\n }\n }\n}\n","// Public mount() entry — the only surface a host (browser, CEF, OBS plugin,\n// iframe) interacts with. Lifecycle and contract: see RUNTIME-API.md.\n\nimport { signal } from \"@preact/signals-react\";\nimport { createRoot, type Root } from \"react-dom/client\";\nimport { createElement } from \"react\";\nimport { LumencastApp } from \"./app.js\";\nimport { applyDelta } from \"./state/apply-delta.js\";\nimport { applySnapshot } from \"./state/apply-snapshot.js\";\nimport { createStore } from \"./state/store.js\";\nimport { createBundleFetcher, type BundleFetcher, type RenderBundle } from \"./render/bundle.js\";\nimport { WsClient, type ConnectionStatus, type TransportError } from \"./transport/ws.js\";\nimport { validateOptions } from \"./internal/validate-options.js\";\nimport { addDiagnosticsHandler } from \"./render/diagnostics.js\";\nimport type { LumencastError, LumencastHandle, LumencastToken, MountOptions } from \"./types.js\";\n\nexport function mount(options: MountOptions): LumencastHandle {\n validateOptions(options);\n options.onStatus?.(\"disconnected\");\n\n const store = createStore();\n const baseUrl = deriveBaseUrl(options.serverUrl);\n const bundleFetcher = createBundleFetcher({\n baseUrl,\n ...(options.resolveBundleUrl !== undefined ? { resolveUrl: options.resolveBundleUrl } : {}),\n });\n\n const bundleSignal = signal<RenderBundle | null>(null);\n const statusSignal = signal<ConnectionStatus>(\"disconnected\");\n const crossfadeKeySignal = signal<string>(\"__initial__\");\n\n const setStatus = (status: ConnectionStatus): void => {\n statusSignal.value = status;\n options.onStatus?.(status);\n };\n\n const reportError = (err: LumencastError): void => {\n options.onError?.(err);\n };\n\n let active = true;\n\n // ADR 001 §3.4 (issue #34) — anti-silent-drop diagnostics are events\n // surfaced to the host, never console logs in `broadcast` mode.\n const removeDiagnosticsHandler = options.onDiagnostic\n ? addDiagnosticsHandler(options.onDiagnostic)\n : undefined;\n\n const ws = new WsClient({\n url: options.serverUrl,\n token: options.token,\n ...(options.scene !== undefined ? { scene: options.scene } : {}),\n ...(options.testSession !== undefined ? { session: options.testSession } : {}),\n onStatus: setStatus,\n onSnapshot: (frame) => {\n if (!active) return;\n void onSnapshot(\n bundleFetcher,\n bundleSignal,\n crossfadeKeySignal,\n frame.scene_id,\n frame.scene_version,\n () => applySnapshot(store, frame),\n reportError,\n );\n options.onMetric?.({\n name: \"snapshot_received\",\n scene_id: frame.scene_id,\n path_count: Object.keys(frame.state).length,\n });\n },\n onDelta: (frame) => {\n if (!active) return;\n const start = performance.now();\n applyDelta(store, frame);\n options.onMetric?.({\n name: \"delta_applied\",\n duration_ms: performance.now() - start,\n });\n options.onMetric?.({ name: \"delta_received\", count: 1, path_count: frame.patches.length });\n },\n onSceneChanged: (frame) => {\n if (!active) return;\n // The fresh snapshot that follows is the source of truth — it carries\n // the new scene_version, drives the bundle fetch, and flips the\n // crossfade key. Nothing eager to do here.\n options.onMetric?.({\n name: \"scene_changed\",\n from: bundleSignal.value?.scene_version ?? null,\n to: frame.scene_version,\n });\n },\n onServerError: (frame) => {\n reportError({\n code: frame.code,\n message: frame.message,\n recoverable: frame.recoverable,\n });\n },\n onTransportError: (err) => {\n reportError(transportToLumencastError(err));\n },\n });\n\n ws.start();\n\n const root: Root = createRoot(options.target);\n root.render(\n createElement(LumencastApp, {\n mode: options.mode,\n store,\n bundleSignal,\n statusSignal,\n crossfadeKeySignal,\n sendInput: (patches) => ws.sendInput(patches),\n }),\n );\n\n return {\n disconnect() {\n if (!active) return;\n active = false;\n removeDiagnosticsHandler?.();\n ws.close();\n root.unmount();\n },\n setToken(token: LumencastToken) {\n if (!active) return;\n ws.setToken(token);\n },\n };\n\n // --- helpers ----------------------------------------------------------\n\n async function onSnapshot(\n fetcher: BundleFetcher,\n bSignal: typeof bundleSignal,\n cSignal: typeof crossfadeKeySignal,\n sceneId: string,\n sceneVersion: string,\n applyState: () => void,\n onErr: (err: LumencastError) => void,\n ): Promise<void> {\n let bundle: RenderBundle;\n try {\n bundle = await fetcher.get(sceneId, sceneVersion);\n } catch (err) {\n onErr({\n code: \"BUNDLE_FETCH_FAILED\",\n message: err instanceof Error ? err.message : \"render bundle fetch failed\",\n recoverable: true,\n });\n return;\n }\n if (!active) return;\n applyState();\n bSignal.value = bundle;\n cSignal.value = `${sceneId}::${sceneVersion}`;\n }\n}\n\nfunction transportToLumencastError(err: TransportError): LumencastError {\n return {\n code: err.code,\n message: err.message,\n recoverable: err.recoverable,\n };\n}\n\nfunction deriveBaseUrl(wsUrl: string): string {\n // wss://<host>/lsdp/v1 → https://<host>\n // ws://<host>/lsdp/v1 → http://<host>\n try {\n const u = new URL(wsUrl);\n const httpScheme = u.protocol === \"wss:\" ? \"https:\" : \"http:\";\n return `${httpScheme}//${u.host}`;\n } catch {\n return \"\";\n }\n}\n","// Per-primitive prop allowlists (ADR 001 §3.4 D4, issue #34).\n//\n// Each primitive declares the exact set of resolved-prop keys it\n// consumes at render time. Any prop reaching the renderer outside the\n// allowlist — whether from a compiled bundle, a hand-rolled RenderNode\n// or a binding key — produces a structured diagnostic (never a silent\n// drop). Values are NEVER inspected nor reported (R9) : the check is\n// purely key-based.\n//\n// Key-based is sufficient for live deltas too : an LSDP delta can only\n// change the VALUE behind an already-declared binding key\n// (`resolveProps`, tree.tsx) — it can never introduce a new prop key.\n// The per-node key set is therefore static, and the check runs once per\n// RenderNode object (WeakSet dedup) instead of once per render.\n//\n// These sets mirror what each primitive's component ACTUALLY reads\n// today. Spec'd fields the renderer does not consume yet (e.g. `text`\n// `format`, `stack` `padding`) are deliberately NOT listed : per the\n// anti-silent-drop policy they must warn until they are implemented.\n\nimport type { RenderKind, RenderNode } from \"./bundle\";\nimport { emitDiagnostic } from \"./diagnostics\";\n\n/** Universal props consumed by the Tree renderer itself\n * (`UniversalWrapper`, LSML 1.1 §5.4) on every primitive. */\nconst UNIVERSAL_PROPS = [\"visible\", \"opacity\", \"universal_opacity\", \"rotation\", \"sizing\"] as const;\n\nfunction allow(keys: readonly string[]): ReadonlySet<string> {\n return new Set([...UNIVERSAL_PROPS, ...keys]);\n}\n\n/** Resolved-prop keys consumed per primitive (component + wrapper). */\nexport const PRIMITIVE_PROP_ALLOWLIST: Readonly<Record<RenderKind, ReadonlySet<string>>> = {\n stack: allow([\"direction\", \"gap\", \"wrap\", \"crossGap\", \"align\", \"justify\"]),\n grid: allow([\"cols\", \"rows\", \"gap\"]),\n frame: allow([\n \"x\",\n \"y\",\n \"width\",\n \"height\",\n \"scale\",\n \"rotate\",\n \"background\",\n \"backgrounds\",\n \"clipsContent\",\n ]),\n text: allow([\n \"value\",\n \"size\",\n \"font\",\n \"weight\",\n \"colour\",\n \"align\",\n \"lineHeight\",\n \"letterSpacing\",\n \"textTransform\",\n \"textDecoration\",\n \"fontStyle\",\n \"maxLines\",\n ]),\n image: allow([\"src\", \"alt\", \"fit\", \"position\", \"width\", \"height\"]),\n shape: allow([\n \"geometry\",\n \"kind\",\n \"width\",\n \"height\",\n \"radius\",\n \"fill\",\n \"fills\",\n \"stroke\",\n \"stroke_width\",\n \"strokes\",\n \"pathData\",\n \"paths\",\n \"ariaLabel\",\n ]),\n media: allow([\"src\", \"loop\", \"mute\", \"autoplay\", \"fit\"]),\n instance: allow([\"scene_id\", \"scene_version\", \"size\", \"position\"]),\n // `repeat` is dispatched specially by the tree ; its only consumed\n // binding is `items`.\n repeat: new Set([\"items\"]),\n};\n\nfunction isAllowed(kind: RenderKind, key: string): boolean {\n const allowed = PRIMITIVE_PROP_ALLOWLIST[kind];\n if (allowed === undefined) return true; // unknown kind warns separately (tree.tsx)\n if (allowed.has(key)) return true;\n // `instance` exposes bound sub-scene parameters under `params.*`\n // (LSML §4.9) — the whole namespace is part of its contract.\n if (kind === \"instance\" && (key === \"params\" || key.startsWith(\"params.\"))) return true;\n return false;\n}\n\n// One check per RenderNode object — bundles are immutable once fetched,\n// and a node's key set cannot change live (see module header).\nconst checkedNodes = new WeakSet<RenderNode>();\n\n/**\n * Audit a node's static props + binding keys against its primitive's\n * allowlist. Every unknown key emits ONE structured diagnostic naming\n * `node.id` + the prop (never the value, R9). Idempotent per node.\n */\nexport function checkNodeProps(node: RenderNode): void {\n if (checkedNodes.has(node)) return;\n checkedNodes.add(node);\n const keys = new Set<string>([\n ...Object.keys(node.props ?? {}),\n ...Object.keys(node.bindings ?? {}),\n ]);\n for (const key of keys) {\n if (!isAllowed(node.kind, key)) {\n emitDiagnostic(\n node.id,\n `${node.kind}.${key}`,\n \"is not consumed by this primitive's renderer ; the prop is ignored (anti-silent-drop, ADR 001 §3.4)\",\n );\n }\n }\n}\n"],"names":["Ctx","createContext","LumencastRuntimeProvider","value","children","jsx","useLumencastRuntime","v","useContext","LazyBroadcastMode","lazy","m","LazyControlMode","LazyTestMode","LumencastApp","mode","store","bundleSignal","statusSignal","crossfadeKeySignal","sendInput","useSignals","bundle","status","trackKey","ModeComponent","AnimatePresence","motion","Suspense","ANON_NODE_ID","handlers","addDiagnosticsHandler","handler","emitDiagnostic","nodeId","field","reason","diagnostic","MAX_FILTER_BLUR_PX","MAX_FILTER_BRIGHTNESS","MAX_FILTER_STRING_LEN","CAPS","clampFilterChannel","channel","cap","FILTER_STRING_RE","FILTER_IDENTITY","sanitizeCssFilterString","blur","brightness","warnRejectedFilter","NO_ANIMATION","EASE_MAP","toFramer","INITIAL_IDENTITY","DEFAULT_MOUNT_PLAY_TRANSITION","resolveTransition","transitionFor","keys","animateInitial","key","t","mountPlay","base","initial","from","safe","animate","parseWireTransition","kind","duration_ms","easing","WIRE_EASING_MAP","out","applyDelta","frame","batch","patch","transition","applySnapshot","StoreImpl","path","signal","s","shallowEqual","ts","state","seen","createStore","a","b","i","ao","bo","ak","bk","k","SUPPORTED_PROFILES","AUTHORING_NAME_RE","AUTHORING_MAJOR_RE","AUTHORING_SUFFIX","isAuthoringProfile","id","slash","name","major","BundleIncompatibleError","unsupportedProfiles","validateBundleProfiles","supported","profiles","missing","p","FetcherImpl","opts","sceneId","sceneVersion","cached","url","response","json","createBundleFetcher","DEFAULTS","ScheduleImpl","random","attempt","offset","createReconnectSchedule","merged","TransportError","message","recoverable","code","cause","WsClient","SequenceTracker","ctor","patches","encodeFrame","inputFrame","token","resolvedToken","resolveToken","err","socket","WS_SUBPROTOCOLS","event","canResume","WS_SUBPROTOCOL_V1_1","sinceSequence","subscribeFrame","data","decodeServerFrame","LumencastError","obs","_event","immediate","delay","next","validateOptions","options","mount","baseUrl","deriveBaseUrl","bundleFetcher","setStatus","reportError","active","removeDiagnosticsHandler","ws","onSnapshot","start","transportToLumencastError","root","createRoot","createElement","fetcher","bSignal","cSignal","applyState","onErr","wsUrl","u","UNIVERSAL_PROPS","allow","PRIMITIVE_PROP_ALLOWLIST","isAllowed","allowed","checkedNodes","checkNodeProps","node"],"mappings":";;;;;;;AAgBA,MAAMA,IAAMC,EAAuC,IAAI;AAEhD,SAASC,GAAyB;AAAA,EACvC,OAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AACD,SAAO,gBAAAC,EAACL,EAAI,UAAJ,EAAa,OAAAG,GAAe,UAAAC,EAAA,CAAS;AAC/C;AAEO,SAASE,KAAwC;AACtD,QAAMC,IAAIC,EAAWR,CAAG;AACxB,MAAI,CAACO;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAG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O,KAAKoI,EAAK,SAAS,CAAA,CAAE;AAAA,IAC/B,GAAG,OAAO,KAAKA,EAAK,YAAY,CAAA,CAAE;AAAA,EAAA,CACnC;AACD,aAAWlI,KAAOF;AAChB,IAAKgI,GAAUI,EAAK,MAAMlI,CAAG,KAC3B3B;AAAA,MACE6J,EAAK;AAAA,MACL,GAAGA,EAAK,IAAI,IAAIlI,CAAG;AAAA,MACnB;AAAA,IAAA;AAIR;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { mount } from "./mount.js";
|
|
2
|
-
export type { MountOptions, LumencastHandle, LumencastMode, LumencastStatus, LumencastToken, LumencastTokenProvider, LumencastError, LumencastMetric, ErrorCode, } from "./types.js";
|
|
3
|
-
export
|
|
2
|
+
export type { MountOptions, LumencastHandle, LumencastMode, LumencastStatus, LumencastToken, LumencastTokenProvider, LumencastError, LumencastMetric, LumencastDiagnostic, ErrorCode, } from "./types.js";
|
|
3
|
+
export { addDiagnosticsHandler, ANON_NODE_ID, type RenderDiagnostic, type DiagnosticHandler, } from "./render/diagnostics.js";
|
|
4
|
+
export { PRIMITIVE_PROP_ALLOWLIST } from "./render/prop-allowlist.js";
|
|
5
|
+
export type { RenderBundle, RenderNode, RenderKind, OperatorInput, ExternalAdapter, Asset, BundleUrlResolver, } from "./render/bundle.js";
|
|
6
|
+
export { SUPPORTED_PROFILES, BundleIncompatibleError, isAuthoringProfile, validateBundleProfiles, } from "./render/bundle.js";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,SAAS,GACV,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,KAAK,EACL,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<meta name="generator" content="@lumencast/runtime 0.
|
|
6
|
+
<meta name="generator" content="@lumencast/runtime 0.5.0" />
|
|
7
7
|
<title>Lumencast</title>
|
|
8
8
|
<style>
|
|
9
9
|
html, body { margin: 0; padding: 0; height: 100%; background: #000; }
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
// Public surface of @lumencast/runtime.
|
|
2
2
|
export { mount } from "./mount.js";
|
|
3
|
+
// Anti-silent-drop diagnostics channel (ADR 001 §3.4, issue #34) —
|
|
4
|
+
// hosts that render outside `mount()` (embedding the tree directly,
|
|
5
|
+
// tooling, tests) can subscribe here ; `mount()` wires
|
|
6
|
+
// `MountOptions.onDiagnostic` to the same channel.
|
|
7
|
+
export { addDiagnosticsHandler, ANON_NODE_ID, } from "./render/diagnostics.js";
|
|
8
|
+
export { PRIMITIVE_PROP_ALLOWLIST } from "./render/prop-allowlist.js";
|
|
9
|
+
// Profile gating (LSML 1.1 §17.3.1 / §17.5.1) — exported so hosts and the
|
|
10
|
+
// compiler-side tooling can apply the same rule outside the fetch path, and
|
|
11
|
+
// so the runtime "publishes the list of profiles it supports" per §17.3.1.
|
|
12
|
+
export { SUPPORTED_PROFILES, BundleIncompatibleError, isAuthoringProfile, validateBundleProfiles, } from "./render/bundle.js";
|
|
3
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAcnC,mEAAmE;AACnE,oEAAoE;AACpE,uDAAuD;AACvD,mDAAmD;AACnD,OAAO,EACL,qBAAqB,EACrB,YAAY,GAGb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAatE,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/lumencast.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as i, B as o, P as r, S as P, b as e, i as d, d as l, v as n } from "./index-CyOlpZAL.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
i as ANON_NODE_ID,
|
|
4
|
+
o as BundleIncompatibleError,
|
|
5
|
+
r as PRIMITIVE_PROP_ALLOWLIST,
|
|
6
|
+
P as SUPPORTED_PROFILES,
|
|
7
|
+
e as addDiagnosticsHandler,
|
|
8
|
+
d as isAuthoringProfile,
|
|
9
|
+
l as mount,
|
|
10
|
+
n as validateBundleProfiles
|
|
4
11
|
};
|
|
5
12
|
//# sourceMappingURL=lumencast.js.map
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkB,eAAe,EAAkB,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhG,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CA+I5D"}
|
package/dist/mount.js
CHANGED
|
@@ -10,12 +10,16 @@ import { createStore } from "./state/store.js";
|
|
|
10
10
|
import { createBundleFetcher } from "./render/bundle.js";
|
|
11
11
|
import { WsClient } from "./transport/ws.js";
|
|
12
12
|
import { validateOptions } from "./internal/validate-options.js";
|
|
13
|
+
import { addDiagnosticsHandler } from "./render/diagnostics.js";
|
|
13
14
|
export function mount(options) {
|
|
14
15
|
validateOptions(options);
|
|
15
16
|
options.onStatus?.("disconnected");
|
|
16
17
|
const store = createStore();
|
|
17
18
|
const baseUrl = deriveBaseUrl(options.serverUrl);
|
|
18
|
-
const bundleFetcher = createBundleFetcher({
|
|
19
|
+
const bundleFetcher = createBundleFetcher({
|
|
20
|
+
baseUrl,
|
|
21
|
+
...(options.resolveBundleUrl !== undefined ? { resolveUrl: options.resolveBundleUrl } : {}),
|
|
22
|
+
});
|
|
19
23
|
const bundleSignal = signal(null);
|
|
20
24
|
const statusSignal = signal("disconnected");
|
|
21
25
|
const crossfadeKeySignal = signal("__initial__");
|
|
@@ -27,6 +31,11 @@ export function mount(options) {
|
|
|
27
31
|
options.onError?.(err);
|
|
28
32
|
};
|
|
29
33
|
let active = true;
|
|
34
|
+
// ADR 001 §3.4 (issue #34) — anti-silent-drop diagnostics are events
|
|
35
|
+
// surfaced to the host, never console logs in `broadcast` mode.
|
|
36
|
+
const removeDiagnosticsHandler = options.onDiagnostic
|
|
37
|
+
? addDiagnosticsHandler(options.onDiagnostic)
|
|
38
|
+
: undefined;
|
|
30
39
|
const ws = new WsClient({
|
|
31
40
|
url: options.serverUrl,
|
|
32
41
|
token: options.token,
|
|
@@ -92,6 +101,7 @@ export function mount(options) {
|
|
|
92
101
|
if (!active)
|
|
93
102
|
return;
|
|
94
103
|
active = false;
|
|
104
|
+
removeDiagnosticsHandler?.();
|
|
95
105
|
ws.close();
|
|
96
106
|
root.unmount();
|
|
97
107
|
},
|
package/dist/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,sEAAsE;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAyC,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,QAAQ,EAA8C,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.js","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aAClB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC;QACvB,OAAO,CAAC,KAAK,GAAG,GAAG,OAAO,KAAK,YAAY,EAAE,CAAC;IAChD,CAAC;AACH,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAmB;IACpD,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,wCAAwC;IACxC,uCAAuC;IACvC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,UAAU,GAAG,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9D,OAAO,GAAG,UAAU,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type MotionStyle } from "framer-motion";
|
|
2
|
+
import type { Store } from "../state/store";
|
|
3
|
+
import type { RenderNode } from "./bundle";
|
|
4
|
+
import { type Transition } from "../animate/transitions";
|
|
5
|
+
/** §6.5 colour-typed bindAnimate keys → the runtime prop name the
|
|
6
|
+
* primitive reads (and re-validates through `parseCssColor`). */
|
|
7
|
+
export declare const BIND_ANIMATE_COLOR_PROPS: Readonly<Record<string, string>>;
|
|
8
|
+
/** Scalar motion channels a bindAnimate key drives. */
|
|
9
|
+
type ScalarChannel = "opacity" | "x" | "y" | "scaleX" | "scaleY" | "rotate" | "blur" | "brightness";
|
|
10
|
+
/**
|
|
11
|
+
* Validate + normalise one live bindAnimate value into per-channel
|
|
12
|
+
* numeric targets. Returns `null` on rejection (wrong JSON shape per
|
|
13
|
+
* §6.3, non-finite numbers, filter values outside the R8 caps when the
|
|
14
|
+
* channel rejects rather than clamps). A `null` keeps the last
|
|
15
|
+
* known-good target — the raw input never reaches a style.
|
|
16
|
+
*
|
|
17
|
+
* Exported pure for the hostile-delta fixture suite (issue #42).
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveScalarTargets(key: string, raw: unknown): Partial<Record<ScalarChannel, number>> | null;
|
|
20
|
+
/** Default retarget transition when neither a per-leaf wire directive
|
|
21
|
+
* nor a compiled `transitions` entry resolves : the §6.2 default
|
|
22
|
+
* spring (stiffness 170, damping 26, mass 1). A spring is the only
|
|
23
|
+
* curve with well-defined retarget semantics (velocity carry) — a
|
|
24
|
+
* documented hypothesis, see the PR for issue #33. */
|
|
25
|
+
export declare const DEFAULT_BIND_ANIMATE_TRANSITION: Transition;
|
|
26
|
+
export interface BindAnimateHandle {
|
|
27
|
+
/** Motion-value style for the wrapping `motion.div` — `null` when no
|
|
28
|
+
* scalar channel is bound (no wrapper needed). */
|
|
29
|
+
motionStyle: MotionStyle | null;
|
|
30
|
+
/** Live-interpolated colour values, keyed by the primitive prop name
|
|
31
|
+
* (`colour` / `fill` / `background`). Merged over `resolved`. */
|
|
32
|
+
colorProps: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drive a node's `animateBindings`. Must be called unconditionally
|
|
36
|
+
* (hook) ; cheap no-op when the node has no bindings.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useBindAnimate(node: RenderNode, store: Store, scope: string): BindAnimateHandle;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=bind-animate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-animate.d.ts","sourceRoot":"","sources":["../../src/render/bind-animate.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAO1F;kEACkE;AAClE,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIrE,CAAC;AAEF,uDAAuD;AACvD,KAAK,aAAa,GAAG,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC;AAEpG;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAyC/C;AAuBD;;;;uDAIuD;AACvD,eAAO,MAAM,+BAA+B,EAAE,UAK7C,CAAC;AAsBF,MAAM,WAAW,iBAAiB;IAChC;uDACmD;IACnD,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC;sEACkE;IAClE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAiL/F"}
|