onda-engine 0.1.0 → 0.2.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 +60 -39
- package/dist/cinema.js +1 -1
- package/dist/cinema.js.map +1 -1
- package/dist/components.d.ts +12 -1
- package/dist/components.js +24 -1
- package/dist/components.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/react.d.ts +3 -1
- package/dist/react.js +101 -17
- package/dist/react.js.map +1 -1
- package/dist/wasm/pkg/onda_wasm.d.ts +195 -0
- package/dist/wasm/pkg/onda_wasm_bg.wasm.d.ts +34 -0
- package/dist/wasm-audio/pkg/onda_wasm_audio.d.ts +106 -0
- package/dist/wasm-audio/pkg/onda_wasm_audio_bg.wasm.d.ts +20 -0
- package/dist/wasm-vello/index.d.ts +1 -0
- package/dist/wasm-vello/pkg/onda_wasm_vello.d.ts +96 -0
- package/dist/wasm-vello/pkg/onda_wasm_vello_bg.wasm.d.ts +24 -0
- package/package.json +7 -7
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../react/src/interpolate.ts","../../react/src/color.ts","../../react/src/clip.ts","../../react/src/gradient.ts","../../react/src/morph.ts","../../react/src/frame.ts","../../react/src/components.ts","../../react/src/spring.ts","../../react/src/sequence.ts","../../react/src/random.ts","../../react/src/particles.ts","../../react/src/transitions.ts","../../react/src/host-config.ts","../../react/src/reconciler.ts","../../react/src/fonts.ts","../../react/src/warmers.ts"],"names":["stops","clamp01","zoom","useContext","createElement","h","lerp","fade","scale","Children","isValidElement","createContext","chromaticAberration"],"mappings":";;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAA,EAAQ,CAAC,CAAA,KAAc,CAAA;AAAA;AAAA,EAEvB,IAAA,EAAM,CAAC,CAAA,KAAc,CAAA,GAAI,CAAA;AAAA,EACzB,KAAA,EAAO,CAAC,CAAA,KAAc,CAAA,GAAI,CAAA,GAAI,CAAA;AA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,EAC7B;AACA,EAAA,OAAO,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,CAAA,EAAI,MAAM,CAAC,CAAA,CAAA;AAClC;AAMO,SAAS,aAAa,IAAA,EAAwB;AACnD,EAAA,MAAM,GAAA,GAAM,UAAU,IAAI,CAAA;AAC1B,EAAA,IAAI,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA,EAAG;AACnB,EAAA,IAAA,CAAK,IAAI,GAAG,CAAA;AACZ,EAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AACjB;AAIO,SAAS,eAAA,GAAyC;AACvD,EAAA,OAAO,MAAM,KAAA,EAAM;AACrB;AAIO,SAAS,oBAAA,GAA6B;AAC3C,EAAA,KAAA,CAAM,MAAA,GAAS,CAAA;AACf,EAAA,IAAA,CAAK,KAAA,EAAM;AACb;;;ACrCA,IAAM,UAAoB,EAAC;AAGpB,SAAS,qBAAqB,IAAA,EAAoB;AACvD,EAAA,IAAI,CAAC,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA,EAAG,OAAA,CAAQ,KAAK,IAAI,CAAA;AAChD;AAIA,eAAsB,gBAAA,GAAkC;AACtD,EAAA,MAAM,OAAA,CAAQ,IAAI,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,EAAE,CAAE,KAAA,CAAM,MAAM;AAAA,EAAC,CAAC,CAAC,CAAC,CAAA;AAC3D","file":"react.js","sourcesContent":["//! `interpolate` — map a value through input/output ranges, the workhorse for\n//! frame-driven animation. Mirrors Remotion's API closely.\n\nexport type EasingFn = (t: number) => number\n\n/** Easing presets + factories. Remotion-compatible: use a preset as an `EasingFn`\n * (`Easing.linear`, `Easing.cubic`, …) or call the `Easing.bezier(x1,y1,x2,y2)`\n * factory. The Remotion-named curves (`quad`/`cubic`/`sin`/`ease`/`bezier`) exist\n * so components authored against Remotion port without rewriting their easing. */\nexport const Easing = {\n linear: (t: number) => t,\n // Remotion-named curves (drop-in for `Easing.quad`/`.cubic`/`.sin`/`.ease`).\n quad: (t: number) => t * t,\n cubic: (t: number) => t * t * t,\n sin: (t: number) => 1 - Math.cos((t * Math.PI) / 2),\n ease: cubicBezier(0.42, 0, 1, 1),\n easeInQuad: (t: number) => t * t,\n easeOutQuad: (t: number) => 1 - (1 - t) * (1 - t),\n easeInOutQuad: (t: number) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2),\n easeInCubic: (t: number) => t ** 3,\n easeOutCubic: (t: number) => 1 - (1 - t) ** 3,\n easeInOutCubic: (t: number) => (t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2),\n smoothStep: (t: number) => t * t * (3 - 2 * t),\n easeInBack: (t: number) => 2.70158 * t ** 3 - 1.70158 * t ** 2,\n easeOutBack: (t: number) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2,\n /** CSS cubic-bézier factory — Remotion's `Easing.bezier(x1,y1,x2,y2)`. */\n bezier: (x1: number, y1: number, x2: number, y2: number): EasingFn => cubicBezier(x1, y1, x2, y2),\n}\n\n/** A CSS-style cubic-bézier ease with control points `(x1,y1)`, `(x2,y2)` and\n * fixed endpoints `(0,0)`–`(1,1)`. Matches `onda-animation`'s `CubicBezier`. */\nexport function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingFn {\n const comp = (c1: number, c2: number, s: number) => {\n const u = 1 - s\n return 3 * u * u * s * c1 + 3 * u * s * s * c2 + s * s * s\n }\n const deriv = (c1: number, c2: number, s: number) => {\n const u = 1 - s\n return 3 * u * u * c1 + 6 * u * s * (c2 - c1) + 3 * s * s * (1 - c2)\n }\n return (x: number) => {\n let s = x\n for (let i = 0; i < 8; i++) {\n const dx = comp(x1, x2, s) - x\n if (Math.abs(dx) < 1e-5) break\n const d = deriv(x1, x2, s)\n if (Math.abs(d) < 1e-6) break\n s -= dx / d\n }\n return comp(y1, y2, Math.min(1, Math.max(0, s)))\n }\n}\n\nexport interface InterpolateOptions {\n easing?: EasingFn\n /** How to handle inputs below the range. Default `'clamp'`. */\n extrapolateLeft?: 'clamp' | 'extend'\n /** How to handle inputs above the range. Default `'clamp'`. */\n extrapolateRight?: 'clamp' | 'extend'\n}\n\n/**\n * Map `input` from `inputRange` to `outputRange` (both ascending, equal length\n * ≥ 2). Out-of-range inputs clamp by default. Example:\n * `interpolate(frame, [0, 30], [0, 1])` fades in over 30 frames.\n */\nexport function interpolate(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n options: InterpolateOptions = {},\n): number {\n if (inputRange.length < 2 || inputRange.length !== outputRange.length) {\n throw new Error('interpolate: inputRange and outputRange must be the same length (>= 2)')\n }\n const { easing = Easing.linear, extrapolateLeft = 'clamp', extrapolateRight = 'clamp' } = options\n const last = inputRange.length - 1\n\n if (input <= at(inputRange, 0)) {\n if (extrapolateLeft === 'clamp') return at(outputRange, 0)\n return segment(input, inputRange, outputRange, 0, easing)\n }\n if (input >= at(inputRange, last)) {\n if (extrapolateRight === 'clamp') return at(outputRange, last)\n return segment(input, inputRange, outputRange, last - 1, easing)\n }\n\n let i = 0\n while (i < last - 1 && input >= at(inputRange, i + 1)) i++\n return segment(input, inputRange, outputRange, i, easing)\n}\n\n/** Read `arr[i]` as a number; throws if out of range (keeps the type honest\n * under `noUncheckedIndexedAccess` without non-null assertions). */\nfunction at(arr: readonly number[], i: number): number {\n const value = arr[i]\n if (value === undefined) throw new Error(`interpolate: index ${i} out of range`)\n return value\n}\n\n/** Interpolate within the segment starting at index `i`. */\nfunction segment(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n i: number,\n easing: EasingFn,\n): number {\n const x0 = at(inputRange, i)\n const x1 = at(inputRange, i + 1)\n const y0 = at(outputRange, i)\n const y1 = at(outputRange, i + 1)\n const span = x1 - x0\n const t = span === 0 ? 0 : (input - x0) / span\n return y0 + (y1 - y0) * easing(t)\n}\n","import { type InterpolateOptions, interpolate } from './interpolate.js'\nimport type { Color } from './scene.js'\n\n/** A color as a hex string (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`) or an\n * explicit 0..1 {@link Color}. */\nexport type ColorInput = string | Color\n\n/** Normalize a {@link ColorInput} into the engine's 0..1 sRGB {@link Color}. */\nexport function parseColor(input: ColorInput): Color {\n // CSS keywords — common footgun: `fill: 'none'` should be transparent, not a crash.\n if (input === 'none' || input === 'transparent') return { r: 0, g: 0, b: 0, a: 0 }\n if (typeof input !== 'string') {\n // Object form: must be a real {r,g,b} color. A non-color value (boolean,\n // null, array, partial object) would otherwise produce a scene node missing\n // channels and fail deep in the Rust deserializer with a cryptic\n // `missing field r` — fail fast here with an actionable message instead.\n if (\n input == null ||\n typeof input !== 'object' ||\n typeof (input as Color).r !== 'number' ||\n typeof (input as Color).g !== 'number' ||\n typeof (input as Color).b !== 'number'\n ) {\n throw new Error(\n `invalid color ${JSON.stringify(input)}: expected a hex string or a {r,g,b} object with numeric 0..1 channels`,\n )\n }\n return { r: input.r, g: input.g, b: input.b, ...(input.a !== undefined ? { a: input.a } : {}) }\n }\n\n let hex = input.trim().replace(/^#/, '')\n if (hex.length === 3 || hex.length === 4) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('')\n }\n if ((hex.length !== 6 && hex.length !== 8) || !/^[0-9a-fA-F]+$/.test(hex)) {\n throw new Error(`invalid color '${input}': expected #rgb, #rgba, #rrggbb, or #rrggbbaa`)\n }\n\n const channel = (i: number) => Number.parseInt(hex.slice(i, i + 2), 16) / 255\n const color: Color = { r: channel(0), g: channel(2), b: channel(4) }\n if (hex.length === 8) color.a = channel(6)\n return color\n}\n\nconst clamp01 = (v: number): number => (v < 0 ? 0 : v > 1 ? 1 : v)\nconst toHex = (v: number): string =>\n Math.round(clamp01(v) * 255)\n .toString(16)\n .padStart(2, '0')\n\n/**\n * Interpolate between colors — like {@link interpolate}, but each output is a\n * {@link ColorInput}. Channels are mixed in 0..1 sRGB and returned as a hex\n * string (`#rrggbb`, or `#rrggbbaa` when any stop has alpha). Out-of-range\n * inputs clamp by default. Mirrors Remotion's `interpolateColors`.\n *\n * @example `interpolateColors(frame, [0, 30], ['#d96b82', '#2974f2'])`\n */\nexport function interpolateColors(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly ColorInput[],\n options: InterpolateOptions = {},\n): string {\n const colors = outputRange.map(parseColor)\n const mix = (sel: (c: Color) => number) =>\n interpolate(input, inputRange, colors.map(sel), options)\n const hasAlpha = colors.some((c) => c.a !== undefined && c.a < 1)\n const rgb = `${toHex(mix((c) => c.r))}${toHex(mix((c) => c.g))}${toHex(mix((c) => c.b))}`\n return `#${rgb}${hasAlpha ? toHex(mix((c) => c.a ?? 1)) : ''}`\n}\n","//! Author-facing clip shapes, normalized into the engine's {@link ShapeGeometry}.\n\nimport type { ShapeGeometry } from './scene.js'\n\n/** A clip region as authored: a rect (optionally rounded), ellipse, or path. */\nexport type ClipInput =\n | { type: 'rect'; width: number; height: number; cornerRadius?: number }\n | { type: 'ellipse'; width: number; height: number }\n | { type: 'path'; d: string }\n\n/** Normalize a {@link ClipInput} into the engine's {@link ShapeGeometry}. */\nexport function parseClip(input: ClipInput): ShapeGeometry {\n switch (input.type) {\n case 'rect':\n return {\n shape: 'rect',\n size: { width: input.width, height: input.height },\n ...(input.cornerRadius != null ? { corner_radius: input.cornerRadius } : {}),\n }\n case 'ellipse':\n return { shape: 'ellipse', size: { width: input.width, height: input.height } }\n case 'path':\n return { shape: 'path', data: input.d }\n }\n}\n\n/** A rounded/square rectangle clip. */\nexport function clipRect(width: number, height: number, cornerRadius?: number): ClipInput {\n return { type: 'rect', width, height, cornerRadius }\n}\n\n/** An ellipse clip inscribed in `width`×`height`. */\nexport function clipEllipse(width: number, height: number): ClipInput {\n return { type: 'ellipse', width, height }\n}\n\n/** An arbitrary clip from SVG path data. */\nexport function clipPath(d: string): ClipInput {\n return { type: 'path', d }\n}\n","//! Author-facing gradient inputs, normalized into the engine's {@link Gradient}.\n\nimport { type ColorInput, parseColor } from './color.js'\nimport type { Gradient, Vec2 } from './scene.js'\n\n/** A point as an `{ x, y }` or a `[x, y]` tuple. */\nexport type Point = Vec2 | [number, number]\n\n/** A color stop: a color at a normalized position 0..1 along the gradient. */\nexport interface GradientStopInput {\n offset: number\n color: ColorInput\n}\n\n/** A gradient as authored: hex/`Color` stops and tuple-or-`Vec2` points. */\nexport type GradientInput =\n | { type: 'linear'; start: Point; end: Point; stops: GradientStopInput[] }\n | { type: 'radial'; center: Point; radius: number; stops: GradientStopInput[] }\n | {\n /** Fractal-noise (\"expensive\") gradient — fBm over Simplex noise. The field\n * value 0..1 samples the stops; `scale` ~0.8–1.2 + `warp` ~0.4–0.6 gives the\n * soft Stripe/Linear register (higher = busier turbulence). Animate `time`\n * per frame for a living gradient. Rendered natively (full quality on\n * `onda export`); the browser preview degrades to a smooth gradient. */\n type: 'fbm'\n stops: GradientStopInput[]\n scale?: number\n time?: number\n warp?: number\n }\n\nfunction toVec2(point: Point): Vec2 {\n return Array.isArray(point) ? { x: point[0], y: point[1] } : point\n}\n\nfunction stops(input: GradientStopInput[]): Gradient['stops'] {\n return input.map((s) => ({ offset: s.offset, color: parseColor(s.color) }))\n}\n\n/** Normalize a {@link GradientInput} into the engine's {@link Gradient} JSON. */\nexport function parseGradient(input: GradientInput): Gradient {\n if (input.type === 'linear') {\n return {\n gradient: 'linear',\n start: toVec2(input.start),\n end: toVec2(input.end),\n stops: stops(input.stops),\n }\n }\n if (input.type === 'fbm') {\n return {\n gradient: 'fbm',\n stops: stops(input.stops),\n scale: input.scale ?? 1.0,\n time: input.time ?? 0,\n warp: input.warp ?? 0.5,\n }\n }\n return {\n gradient: 'radial',\n center: toVec2(input.center),\n radius: input.radius,\n stops: stops(input.stops),\n }\n}\n\n/** Build a linear gradient input from two points and color stops. */\nexport function linearGradient(\n start: Point,\n end: Point,\n stops: GradientStopInput[],\n): GradientInput {\n return { type: 'linear', start, end, stops }\n}\n\n/** Build a radial gradient input from a center, radius, and color stops. */\nexport function radialGradient(\n center: Point,\n radius: number,\n stops: GradientStopInput[],\n): GradientInput {\n return { type: 'radial', center, radius, stops }\n}\n\n/** Build an fBm fractal-noise (\"expensive\") gradient — the soft, flowing\n * Stripe/Linear backdrop. `scale` ~0.8–1.2 + `warp` ~0.4–0.6 reads premium;\n * animate `time` (e.g. `frame / fps * speed`) for a living gradient. */\nexport function fbmGradient(\n stops: GradientStopInput[],\n opts: { scale?: number; time?: number; warp?: number } = {},\n): GradientInput {\n return { type: 'fbm', stops, ...opts }\n}\n","//! Path morphing — the Apple/ElevenLabs \"magic move\": one shape continuously\n//! morphing into another. The engine draws whatever path `d` it's handed, so this\n//! is a pure authoring helper (no engine change): it returns the in-between `d`\n//! string for a given progress `t`, which you feed to a `<Path>`.\n//!\n//! Backed by flubber, which solves the hard part — point CORRESPONDENCE between\n//! two arbitrary outlines (a naive `d`-string lerp tears shapes apart). The\n//! interpolator for a given (from → to) pair is cached, so calling `morphPath`\n//! every frame is cheap.\n\n// flubber ships CommonJS, and the two runtimes disagree on how to import it: Node's\n// ESM loader exposes only a `default` (the module.exports — a NAMED import throws),\n// while Vite's browser pre-bundle exposes the NAMED exports but no usable `default`.\n// So neither `import { interpolate }` nor `import flubber` works in both. A namespace\n// import + this lookup resolves `interpolate` under Node AND Vite.\nimport * as flubberNs from 'flubber'\n\ntype FlubberInterpolate = typeof import('flubber').interpolate\nconst flubberResolved = flubberNs as unknown as {\n interpolate?: FlubberInterpolate\n default?: { interpolate?: FlubberInterpolate }\n}\n// biome-ignore lint/style/noNonNullAssertion: CJS/ESM interop — one of the two forms always exists\nconst flubberInterpolate: FlubberInterpolate = (flubberResolved.interpolate ??\n flubberResolved.default?.interpolate)!\n\nconst clamp01 = (t: number): number => (t < 0 ? 0 : t > 1 ? 1 : t)\n\nexport interface MorphOptions {\n /** Subdivide segments longer than this (user units) for a smoother morph.\n * Lower = smoother + slower to build. Default `2`. */\n maxSegmentLength?: number\n /** Wind both shapes the same way before interpolating (flubber default `true`). */\n single?: boolean\n}\n\nconst cache = new Map<string, (t: number) => string>()\n\nfunction interpolator(from: string, to: string, opts: MorphOptions): (t: number) => string {\n const maxSegmentLength = opts.maxSegmentLength ?? 2\n const key = `${from}\u0000${to}\u0000${maxSegmentLength}`\n let interp = cache.get(key)\n if (!interp) {\n interp = flubberInterpolate(from, to, { maxSegmentLength })\n cache.set(key, interp)\n }\n return interp\n}\n\n/**\n * The in-between SVG path `d` morphing `from` → `to` at progress `t` (0..1).\n * Pass two `<Path>` `d` strings (or any flubber-acceptable shape) and an animated\n * `t`; feed the result to a `<Path d=...>`.\n *\n * @example\n * const d = morphPath(CIRCLE, RULE, ramp(frame, 70, 95))\n * return <Path d={d} fill=\"#fff\" />\n */\nexport function morphPath(from: string, to: string, t: number, options: MorphOptions = {}): string {\n return interpolator(from, to, options)(clamp01(t))\n}\n\n/**\n * Morph through an ordered list of shapes as `t` runs 0..1 — `[A, B, C]` spends\n * the first half on A→B and the second on B→C. Useful for a multi-stage magic\n * move under one progress value.\n */\nexport function morphPathSequence(shapes: string[], t: number, options: MorphOptions = {}): string {\n const first = shapes[0]\n if (first === undefined) return ''\n if (shapes.length === 1) return first\n const tt = clamp01(t)\n const segments = shapes.length - 1\n const scaled = tt * segments\n const i = Math.min(segments - 1, Math.floor(scaled))\n return interpolator(shapes[i] as string, shapes[i + 1] as string, options)(scaled - i)\n}\n","//! Frame context + hooks. The engine renders a composition once per frame, with\n//! the current frame supplied via React context; components read it with\n//! {@link useCurrentFrame} and compute props from it (Remotion's model).\n\nimport { createContext, useContext } from 'react'\n\n/** Resolution and timing of the composition being rendered. */\nexport interface VideoConfig {\n width: number\n height: number\n fps: number\n durationInFrames: number\n}\n\ninterface FrameState extends VideoConfig {\n frame: number\n}\n\n/** @internal Provided by the renderer for each frame. */\nexport const FrameContext = createContext<FrameState | null>(null)\n\nfunction useFrameState(hook: string): FrameState {\n const state = useContext(FrameContext)\n if (state === null) {\n throw new Error(\n `${hook} must be called inside a <Composition> rendered by renderFrame/renderFrames`,\n )\n }\n return state\n}\n\n/** The frame currently being rendered (0-based). */\nexport function useCurrentFrame(): number {\n return useFrameState('useCurrentFrame').frame\n}\n\n/** The composition's resolution and timing. */\nexport function useVideoConfig(): VideoConfig {\n const { width, height, fps, durationInFrames } = useFrameState('useVideoConfig')\n return { width, height, fps, durationInFrames }\n}\n","//! The ONDA React components. Each is a thin typed wrapper that emits an\n//! internal host element; the reconciler maps those to scene-graph nodes.\n//!\n//! ```tsx\n//! <Composition width={1200} height={360} fps={30} durationInFrames={30}>\n//! <Rect width={1200} height={360} fill=\"#0a0d17\" />\n//! <Text fontSize={96} color=\"#fff\" x={96} y={110}>Hello ONDA</Text>\n//! </Composition>\n//! ```\n\nimport { type ReactElement, type ReactNode, createElement } from 'react'\nimport type { ClipInput } from './clip.js'\nimport type { ColorInput } from './color.js'\nimport { useCurrentFrame, useVideoConfig } from './frame.js'\nimport type { GradientInput } from './gradient.js'\nimport type { BlendMode, Camera3D, Effect, ImageFit, Layout, MatteMode } from './scene.js'\n\n/** Properties shared by every scene node: identity, placement, opacity, clip. */\nexport interface NodeProps {\n /** Stable id, required to target the node from an animation timeline. */\n id?: number\n /** Translation in pixels. */\n x?: number\n y?: number\n /** Scale factor (1 = identity). */\n scaleX?: number\n scaleY?: number\n /** Clockwise rotation in degrees, about the transform origin (default (0,0)).\n * Renders on the GPU (Vello) backend; the CPU reference rasterizer ignores it. */\n rotation?: number\n /** Pivot for scale + rotation in local px (CSS transform-origin). Default (0,0).\n * For \"about the center\", pass half the node's width/height. */\n originX?: number\n originY?: number\n /** Opacity, 0..1. */\n opacity?: number\n /** DEPTH (z) of this layer for depth-of-field, in the same arbitrary units as\n * `<Composition dof={{ focus }}>`. Layers at the focus depth stay sharp; the\n * farther a layer's `depth` is from `focus`, the more it defocuses (a blur the\n * reconciler computes from the camera aperture). Animate the comp's `focus` for a\n * rack-focus pull. No effect unless the comp sets `dof`. */\n depth?: number\n /** 3D LAYER position `[x, y, z]` in world pixels — meaningful only inside a\n * `<Scene3D>`. `z = 0` is the framing plane (matches the 2D placement); larger\n * `z` is farther into the screen (smaller), negative `z` nearer the camera (After\n * Effects convention). Animate for fly-throughs / parallax / exploded views. */\n position3d?: [number, number, number]\n /** 3D LAYER rotation `[x, y, z]` in degrees (Z·Y·X): X pitch (tilt toward/away),\n * Y yaw (swing), Z roll (in-plane spin). Inside `<Scene3D>` only. GPU-only — the\n * CPU reference degrades to a flat depth-sorted composite (no out-of-plane tilt). */\n rotation3d?: [number, number, number]\n /** Pivot within this layer's content plane (px) that `position3d`/`rotation3d`\n * act about. Default: the layer's center. */\n anchor3d?: [number, number]\n /** EXTRUDE this layer's 2D outline into a lit 3D SOLID (the \"3D logo / title\"):\n * inside a `<Scene3D>`, a shape or text layer becomes a mesh with `depth`\n * thickness + side walls, shaded by a directional light so it catches the light\n * as it rotates. GPU only — the CPU reference + live preview draw the flat outline. */\n extrude?: number | { depth: number }\n /** Blend this node's subtree against the backdrop (CSS mix-blend-mode).\n * GPU/Vello-rendered (e.g. `'screen'`, `'multiply'`, `'overlay'`). */\n blendMode?: BlendMode\n /** Clip this node and its subtree to a region (local space). */\n clip?: ClipInput\n /** Matte (track matte / mask): a stencil SUBTREE, passed as a React element,\n * through which this node's content is revealed. The matte's alpha — or its\n * luminance, per `matteMode` — multiplies the content's alpha, so the content\n * (this node's children) shows only where the matte covers. The\n * strictly-more-powerful sibling of `clip`: the matte is a fully rendered,\n * animatable subtree (giant text, a gradient, a shape) — the signature\n * \"media-through-type\" move (a photo seen only through animated type). */\n matte?: ReactElement\n /** Which channel of the {@link NodeProps.matte} subtree drives the reveal (CSS\n * `mask-mode`). `'alpha'` (default): content alpha ×= matte alpha. `'luminance'`:\n * content alpha ×= luma(matte) × matte alpha (white reveals, black hides). */\n matteMode?: MatteMode\n /** Ordered, low-level screen-space effects on this node + subtree (render-to-texture). */\n effects?: Effect[]\n /** Gaussian blur std-dev in output px; sugar for `effects: [{ effect: 'blur', sigma }]`.\n * Honored by Vello AND the CPU reference once Phase 1 lands. */\n blur?: number\n /** Directional (motion) blur sugar for `effects: [{ effect: 'directional_blur', … }]`:\n * a 1D blur of std-dev `sigma` (px) along `angle` (radians, default 0 = horizontal) —\n * the cinematic \"in-motion\" smear. Honored by Vello AND the CPU reference. */\n directionalBlur?: { sigma: number; angle?: number }\n /** Chromatic-aberration sugar: R/B split by `amount` px radially from centre. */\n chromaticAberration?: number\n /** Vignette sugar — radial edge darkening. `amount` 0..1; `softness` 0..1 (default 0.5). */\n vignette?: number | { amount: number; softness?: number }\n /** Posterize sugar: quantize each channel to `levels` (≥2) discrete steps. */\n posterize?: number\n /** Duotone sugar: map luminance to a gradient from `shadow` to `highlight`. */\n duotone?: { shadow: ColorInput; highlight: ColorInput }\n /** Chroma-key sugar: knock out `color`; `threshold` (default 0.4) + `smoothness`\n * (default 0.1) shape the soft matte edge. */\n chromaKey?: { color: ColorInput; threshold?: number; smoothness?: number }\n /** Glow / bloom sugar for `effects: [{ effect: 'bloom', ... }]`: bright regions\n * (luminance above `threshold`, default 0.7; scaled by `intensity`, default 1)\n * blur with `sigma` and composite additively over the sharp subtree. Honored by\n * Vello AND the CPU reference. */\n bloom?: number | { sigma: number; threshold?: number; intensity?: number }\n /** Cinematic color-grade sugar for `effects: [{ effect: 'color_grade', ... }]` —\n * the \"land AI media\" wedge: one grade unifies mismatched clips into a single\n * look. All five fields are optional and default to the neutral identity\n * (`exposure` 0, `contrast` 1, `saturation` 1, `temperature` 0, `tint` 0), so\n * `{}` is a no-op. Honored by Vello AND the CPU reference. */\n grade?: {\n /** Linear exposure gain (`2^exposure`); 0 = identity. */\n exposure?: number\n /** Contrast around a 0.5 pivot; 1 = identity. */\n contrast?: number\n /** Saturation; 1 = identity, 0 = grayscale, >1 = punchier. */\n saturation?: number\n /** Warm/cool shift (R up / B down for positive); 0 = neutral. */\n temperature?: number\n /** Green/magenta shift on G (positive = green); 0 = neutral. */\n tint?: number\n }\n /** Gooey / liquid / metaball-morph sugar for `effects: [{ effect: 'goo', ... }]`:\n * the subtree is blurred with `sigma`, then its alpha is sharpened around\n * `threshold` (the 0..1 cutoff, default 0.5) so overlapping shapes fuse into\n * solid forms joined by smooth necks (the \"drops of liquid coalescing\" look).\n * A bare number is the `sigma`. Honored by Vello AND the CPU reference. */\n goo?: number | { sigma: number; threshold?: number }\n /** Film-grain sugar for `effects: [{ effect: 'grain', ... }]`: luminance-banded,\n * animated monochrome noise added late over the subtree — the compositing \"glue\"\n * that makes mismatched sources read as one photographed image, and the dither\n * that hides 8-bit banding on dark gradients. A bare number is the `intensity`\n * (~0.04–0.1 is filmic); the object form adds `size` (grain scale in px, default\n * 1) and `seed` (animation offset — pass the current frame for *living* grain,\n * default 0 = static). Honored by Vello AND the CPU reference. */\n grain?: number | { intensity: number; size?: number; seed?: number }\n /** Frosted-glass sugar for `effects: [{ effect: 'backdrop_blur', ... }]`: samples\n * the already-composited BACKDROP *behind* this node (not its own subtree),\n * blurs it by `sigma` (output px), and draws it as the node's backing — then the\n * node's own content (e.g. a translucent panel `fill`) composites on top. A bare\n * number is just the `sigma`; the object form adds a `tint` (its alpha = tint\n * strength), a `brightness` and a `saturation` (CSS-style, `1` = identity).\n * Honored by Vello AND the CPU reference. */\n backdropBlur?:\n | number\n | { sigma: number; tint?: ColorInput; brightness?: number; saturation?: number }\n /** Light-wrap sugar for `effects: [{ effect: 'light_wrap', ... }]`: bleeds the\n * blurred BACKDROP behind this node onto its own feathered EDGES — the #1\n * \"shot in, not pasted on\" compositing tell for a cut-out plate. A bare number\n * is the `sigma` (the backdrop blur / rim width); the object form adds a\n * `strength` (0 = off, ~1 = a natural spill). EXPORT/NATIVE only — the live\n * preview draws the node un-wrapped. */\n lightWrap?: number | { sigma: number; strength?: number }\n children?: ReactNode\n}\n\n/** Paint props shared by shapes: a solid fill, a gradient (which takes\n * precedence), and a stroke. */\nexport interface PaintProps {\n fill?: ColorInput\n gradient?: GradientInput\n stroke?: ColorInput\n strokeWidth?: number\n /** Stroke end-cap (CSS stroke-linecap). Default 'butt'. */\n strokeCap?: 'butt' | 'round' | 'square'\n /** Stroke corner-join (CSS stroke-linejoin). Default 'miter'. */\n strokeJoin?: 'miter' | 'round' | 'bevel'\n /** Dash pattern: alternating on/off px (e.g. [12, 8]). Omit for solid. */\n strokeDash?: number[]\n /** Phase offset into the dash pattern (px) — animate for a draw-on reveal. */\n strokeDashOffset?: number\n /** TRIM PATHS (mograph line-draw): draw only a slice of the stroked outline.\n * `trimStart`/`trimEnd` are fractions 0..1 of the path's length (default 0 / 1);\n * `trimOffset` rotates the visible window around the path. Animate `trimEnd` 0→1\n * for a draw-on reveal. Needs a `stroke`; length is measured by the engine. */\n trimStart?: number\n trimEnd?: number\n trimOffset?: number\n /** Drop shadow / glow behind the shape (CSS box-shadow). `blur` is the gaussian\n * std-dev; `(0,0)` offset reads as a centered glow. GPU/Vello-rendered. */\n shadow?: {\n color: ColorInput\n blur: number\n offsetX?: number\n offsetY?: number\n spread?: number\n }\n}\n\nexport interface CompositionProps {\n width: number\n height: number\n fps: number\n durationInFrames: number\n /** Opt into the cinematic LINEAR + ACES finishing pipeline (correct bloom/light,\n * light-wrap, halation). GPU/export only; off by default (gamma). */\n linear?: boolean\n /** Composition-level cinematic FINISH: a linear-HDR finishing chain run after the\n * comp rasterizes — bloom bleeding REAL light (highlights exceed 1.0 and roll off),\n * warm halation — ending in one ACES film tone-map. The correct \"looks shot\" output\n * transform (unlike per-node effects, no HDR is lost between passes). GPU/export only. */\n finish?: {\n /** Linear exposure multiplier before the tone-map (1 = neutral; >1 brightens). */\n exposure?: number\n /** Comp-level bloom in linear HDR. `sigma` = halo blur radius (px). */\n bloom?: { sigma: number; threshold?: number; intensity?: number }\n /** Warm red/orange halation around highlights (0 = off, ~0.6 filmic). */\n halation?: number\n /** Grade — white balance: + warm (boost red/cut blue), − cool. 0 = neutral. */\n temperature?: number\n /** Grade — contrast around mid-grey. 1 = identity, >1 punchier. */\n contrast?: number\n /** Grade — saturation. 1 = identity, 0 = greyscale, >1 richer. */\n saturation?: number\n /** Vignette — radial edge darkening of the finished frame. 0 = off. */\n vignette?: number\n /** Film grain intensity added in linear light (luminance-banded). 0 = off; the\n * current frame is used as the animation seed automatically. */\n grain?: number\n /** A cinematic 3D color LUT applied as the FINAL finish step (after grade + ACES\n * + sRGB), as a trilinear lookup. `table` holds `size³` RGB triples in 0..1 with\n * RED varying fastest, then green, then blue. Honored by BOTH backends. */\n lut?: { size: number; table: number[] }\n }\n /** Per-object MOTION BLUR via temporal supersampling: each output frame is the\n * average of `samples` sub-frames spread across the shutter window, so anything\n * that MOVES smears by its own motion and static elements stay sharp — the\n * shutter-angle blur every pro comp ships with. `true` = a 180° shutter, 16\n * samples. Cost is `samples`× the render, so it's an EXPORT feature (the live\n * preview shows the sharp frame). */\n motionBlur?:\n | boolean\n | {\n /** Shutter angle in degrees: how much of the frame the shutter is open. 180 =\n * half a frame (the film default); 360 = full-frame (heavier blur). */\n shutter?: number\n /** Sub-frames averaged per output frame. More = smoother smear, linearly costlier. */\n samples?: number\n }\n /** DEPTH OF FIELD (2.5D rack focus): with this set, any layer carrying a `depth`\n * prop defocuses by how far its `depth` is from `focus` — sharp at the focus plane,\n * blurrier away from it. Animate `focus` for a focus pull. Resolved as a per-layer\n * blur (reuses the blur effect), so it works on both backends. */\n dof?: {\n /** The `depth` value that is in sharp focus. */\n focus: number\n /** How fast blur grows with depth distance (px of blur per unit of depth past the\n * in-focus band). Bigger = shallower depth of field. Default 0.04. */\n aperture?: number\n /** A sharp band (± in depth units) around `focus` that stays unblurred. Default 0. */\n range?: number\n /** Clamp the blur σ (px) so far layers don't blur to mush. Default 40. */\n maxBlur?: number\n }\n children?: ReactNode\n}\n\n/** The root of every ONDA tree: resolution + timing, like Remotion's. */\nexport function Composition(props: CompositionProps) {\n return createElement('onda-composition', props)\n}\n\nexport type GroupProps = NodeProps\n\n/** A transform/opacity container with no visual of its own. */\nexport function Group(props: GroupProps) {\n return createElement('onda-group', props)\n}\n\n/** Props for {@link Repeater} (After Effects' shape \"Repeater\"). */\nexport interface RepeaterProps {\n /** Number of copies (including the original). */\n count: number\n /** Per-copy translation, applied cumulatively (copy i is offset i×). */\n offsetX?: number\n offsetY?: number\n /** Per-copy rotation in degrees, applied cumulatively (a radial array / spiral). */\n rotation?: number\n /** Per-copy scale factor, applied cumulatively (copy i is `scale**i`). 1 = none. */\n scale?: number\n /** Pivot for the per-copy rotation/scale (local px). Default (0,0). */\n originX?: number\n originY?: number\n /** Opacity of the first / last copy; the rest interpolate (a fade-out trail). */\n startOpacity?: number\n endOpacity?: number\n children?: ReactNode\n}\n\n/** REPEATER — stamp `children` `count` times, each copy COMPOUNDING one more step of\n * the transform (offset / rotation / scale) and a step of the opacity ramp: grids,\n * radial arrays, spirals, motion trails. Mirrors After Effects' shape Repeater.\n *\n * Implemented as `count` nested transform groups (each adds one increment on top of\n * the previous, so the transforms truly compound into a spiral rather than a naive\n * `i×` fan), with a copy of `children` drawn at every level. Pure composition — it\n * renders identically on every backend. */\nexport function Repeater({\n count,\n offsetX = 0,\n offsetY = 0,\n rotation = 0,\n scale = 1,\n originX = 0,\n originY = 0,\n startOpacity = 1,\n endOpacity = 1,\n children,\n}: RepeaterProps): ReactElement {\n const n = Math.max(1, Math.floor(count))\n const opacityAt = (i: number): number =>\n startOpacity + (endOpacity - startOpacity) * (n > 1 ? i / (n - 1) : 0)\n // Build inside-out: level L sits inside L increment groups → transform compounded\n // L times. Each level draws ONE copy (with its own ramped opacity) plus the deeper,\n // further-incremented levels.\n const buildLevel = (level: number): ReactElement | null => {\n if (level >= n) return null\n const copy = createElement(Group, { key: 'copy', opacity: opacityAt(level) }, children)\n const deeper = buildLevel(level + 1)\n // Level 0 is the identity copy; every deeper level adds one transform increment.\n const transform =\n level === 0\n ? {}\n : { x: offsetX, y: offsetY, rotation, scaleX: scale, scaleY: scale, originX, originY }\n return createElement(Group, { key: level, ...transform }, copy, deeper)\n }\n return buildLevel(0) ?? createElement(Group, null)\n}\n\n/** Props for {@link Merge} (After Effects' shape \"Merge Paths\"). */\nexport interface MergeProps extends PaintProps, Omit<NodeProps, 'children'> {\n /** Boolean operation over the SHAPE children: `union` (add) / `difference` (the\n * first minus the rest) / `intersect` (common area) / `xor` (symmetric difference).\n * Default `union`. */\n op?: 'union' | 'difference' | 'intersect' | 'xor'\n children?: ReactNode\n}\n\n/** MERGE PATHS — combine the SHAPE children into ONE outline via a boolean `op`\n * (union / difference / intersect / xor). A ring = circle − circle; a lens =\n * circle ∩ circle; a speech bubble = rect ∪ triangle. The children are folded into\n * the result (not drawn separately), so fill/stroke the `<Merge>` itself. Curve\n * outlines are flattened before the boolean; resolved on both backends (i_overlay). */\nexport function Merge(props: MergeProps) {\n return createElement('onda-boolean', props)\n}\n\nexport type PrecompProps = NodeProps\n\n/** PRECOMP — flatten this subtree to a SINGLE layer (render-to-texture) before its\n * `opacity` / `blendMode` / effects apply, the way After Effects' precomp /\n * collapse-transformations does. Reach for it when you fade or blend-mode a GROUP of\n * overlapping layers and don't want the overlaps to double-up, or to treat a group as\n * one unit. (It's a `<Group>` carrying the `isolate` effect.) */\nexport function Precomp(props: PrecompProps) {\n const effects: Effect[] = [{ effect: 'isolate' }, ...(props.effects ?? [])]\n return createElement(Group, { ...props, effects })\n}\n\n/** Flex layout props for {@link Flex} / {@link AbsoluteFill} (CSS-flexbox subset). */\nexport interface FlexProps extends NodeProps, Layout {}\n\n/** A flex container: lays out its direct children (row/column, with\n * justify/align/gap/padding) instead of requiring absolute x/y. Resolved to\n * absolute positions by the engine's layout pass. */\nexport function Flex(props: FlexProps) {\n const { direction, justify, align, gap, padding, wrap, width, height, ...rest } = props\n const layout: Layout = { direction, justify, align, gap, padding, wrap, width, height }\n return createElement('onda-group', { ...rest, layout })\n}\n\nexport interface CenterProps extends Omit<NodeProps, 'children'> {\n /** Top of the centering row (px). Default 0. */\n y?: number\n /** Height of the row the content is centered within (px). Omit to size to content. */\n height?: number\n children?: ReactNode\n}\n\n/** Horizontally CENTER children across the composition width at vertical position `y` —\n * sugar for a full-width `<Flex justify=\"center\">`. The reliable way to center text:\n * the layout pass measures the real glyph width natively, so you never hand-compute an\n * `x` (which mis-centers the moment the text, font, or size changes). */\nexport function Center(props: CenterProps) {\n const { children, y, height, ...rest } = props\n const { width } = useVideoConfig()\n return createElement(\n Flex,\n {\n ...rest,\n x: 0,\n y: y ?? 0,\n width,\n ...(height !== undefined ? { height } : {}),\n justify: 'center',\n align: 'center',\n },\n children,\n )\n}\n\nexport type AbsoluteFillProps = Omit<FlexProps, 'width' | 'height'>\n\n/** A full-canvas flex container (like Remotion's `<AbsoluteFill>`): fills the\n * composition and lays children out (column by default) — ideal for centering\n * or stacking. Combine with `justify`/`align` to center content. */\nexport function AbsoluteFill(props: AbsoluteFillProps) {\n const { width, height } = useVideoConfig()\n return Flex({ direction: 'column', ...props, width, height })\n}\n\nexport interface CameraProps {\n /** The world — children laid out in absolute WORLD-pixel coordinates. */\n children?: ReactNode\n /** World x (px) to center in the viewport. Default: viewport center (no pan). */\n focusX?: number\n /** World y (px) to center in the viewport. Default: viewport center (no pan). */\n focusY?: number\n /** Zoom about the focus point. 1 = neutral, >1 = pushed in. */\n zoom?: number\n /** Camera roll in degrees (2D rotation about the focus point). GPU-only. */\n rotate?: number\n /** Viewport size; defaults to the composition canvas. */\n viewportWidth?: number\n viewportHeight?: number\n}\n\n/**\n * A 2D camera: frames an oversized \"world\" (its children, laid out in world-pixel\n * coordinates) by centering a world point in the viewport at a given zoom + roll —\n * pans across a grid larger than the canvas, push-in fly-overs, focus moves.\n *\n * Pure translate/scale/rotate — a STACK OF {@link Group}s, no new scene node:\n * `translate(vw/2,vh/2) ∘ [scale·rotate about origin] ∘ translate(-focus)`, so the\n * world point `focus` lands at the viewport center, scaled by `zoom`. (`rotate`\n * renders on the GPU/Vello backend only, like {@link NodeProps.rotation}.) Animate\n * focus/zoom per frame ({@link useCurrentFrame} + interpolate) for a moving camera.\n */\nexport function Camera(props: CameraProps) {\n const { children, focusX, focusY, zoom = 1, rotate = 0, viewportWidth, viewportHeight } = props\n const { width, height } = useVideoConfig()\n const vw = viewportWidth ?? width\n const vh = viewportHeight ?? height\n const fx = focusX ?? vw / 2\n const fy = focusY ?? vh / 2\n return createElement(\n Group,\n { x: vw / 2, y: vh / 2 },\n createElement(\n Group,\n { rotation: rotate, scaleX: zoom, scaleY: zoom, originX: 0, originY: 0 },\n createElement(Group, { x: -fx, y: -fy }, children),\n ),\n )\n}\n\nexport interface Scene3DProps extends Omit<NodeProps, 'children'> {\n /** The perspective camera for this 3D world. Omit fields to derive a default that\n * frames the `z = 0` plane to fill the comp (so layers at `z = 0` match their 2D\n * placement). Animate `position`/`target` per frame for camera moves. */\n camera?: Camera3D\n /** The 3D LAYERS — direct children, each placed by its `position3d` / `rotation3d`\n * / `anchor3d`. Layers without a `position3d` sit at `z = 0` (their 2D spot). */\n children?: ReactNode\n}\n\n/**\n * A 3D SCENE: its direct children become 3D LAYERS in one shared 3D world, viewed\n * through a perspective `camera`. Each layer is a flat plane (its rendered 2D\n * content) placed by `position3d` (world x/y/z) and tilted by `rotation3d`, then\n * depth-sorted and composited as a single layer. The mograph core of \"3D\" —\n * camera fly-throughs, card walls, parallax, exploded UI, billboard text.\n *\n * GPU (Vello) runs true perspective; the CPU reference degrades to a 2.5D\n * depth-sorted composite (per-layer distance scale, no out-of-plane tilt). A layer\n * at `z = 0` with no rotation renders pixel-identical to its 2D placement, so\n * wrapping content in `<Scene3D>` changes nothing until you move layers in z.\n */\nexport function Scene3D(props: Scene3DProps) {\n const { camera, children, ...rest } = props\n return createElement('onda-group', { ...rest, camera3d: camera ?? {} }, children)\n}\n\nexport interface RectProps extends NodeProps, PaintProps {\n width: number\n height: number\n cornerRadius?: number\n}\n\nexport function Rect(props: RectProps) {\n return createElement('onda-rect', props)\n}\n\nexport interface EllipseProps extends NodeProps, PaintProps {\n width: number\n height: number\n}\n\nexport function Ellipse(props: EllipseProps) {\n return createElement('onda-ellipse', props)\n}\n\nexport interface PathProps extends NodeProps, PaintProps {\n /** SVG path data (e.g. `\"M0 0 L100 0 Z\"`), in the node's local space. */\n d: string\n}\n\n/** An arbitrary vector outline from SVG path data. Renders on the GPU (Vello)\n * backend; the CPU reference rasterizer skips paths. */\nexport function Path(props: PathProps) {\n return createElement('onda-path', props)\n}\n\n/** One styled run for rich `<Text>` — overrides the node's style. */\nexport interface TextRunInput {\n text: string\n color?: ColorInput\n fontSize?: number\n /** Font family (must be loaded; bundled: \"Open Sans\", \"IBM Plex Sans\"). */\n fontFamily?: string\n /** CSS weight 1..1000 (700 = bold). */\n fontWeight?: number\n italic?: boolean\n}\n\nexport interface TextProps extends NodeProps {\n fontSize?: number\n color?: ColorInput\n /** Font family (must be loaded; bundled: \"Open Sans\", \"IBM Plex Sans\"). */\n fontFamily?: string\n /** CSS weight 1..1000 (700 = bold). */\n fontWeight?: number\n italic?: boolean\n /** Extra px between glyphs (CSS `letter-spacing` / tracking). `0` = natural;\n * negative tightens. Applied on the GPU/preview (Vello) text path. */\n letterSpacing?: number\n /** Rich multi-style runs. When set, these replace the text children — each run\n * may override color/size/family/weight/style. Renders per-run on the GPU\n * (Vello); the CPU backend draws their concatenated text in the node style. */\n runs?: TextRunInput[]\n children?: ReactNode\n}\n\nexport function Text(props: TextProps) {\n return createElement('onda-text', props)\n}\n\nexport interface ImageProps extends NodeProps {\n src: string\n /** Target box width in px. With `height`, the decoded image is fitted into this\n * box per `fit` — the renderer measures the image, so the component doesn't\n * need its intrinsic size. Omit both for the image's intrinsic pixel size. */\n width?: number\n height?: number\n /** How to fit the image into the `width`×`height` box (default `'cover'`). */\n fit?: ImageFit\n /** Gaussian blur radius (sigma, in source pixels) applied to the decoded image\n * by the engine's image pass. `0`/omitted leaves it sharp; animating it gives\n * a soft→sharp \"focus pull\" entrance. Identical on every backend. */\n blur?: number\n}\n\nexport function Image(props: ImageProps) {\n return createElement('onda-image', props)\n}\n\nexport interface VideoProps extends NodeProps {\n /** Path, URL, or `data:` URI of the video. The frame at the current time is\n * decoded by the player (browser: an off-screen `<video>`/WebCodecs) or by\n * `onda export` (native ffmpeg) — the author layer never decodes. */\n src: string\n /** Seconds into the SOURCE shown at this clip's frame 0 (trim the head).\n * Default `0`. */\n startFrom?: number\n /** Source seconds advanced per composition second (1 = realtime, 2 = 2× fast,\n * 0.5 = slow-mo). Default `1`. */\n playbackRate?: number\n /** Seconds into the SOURCE to stop at (trim the tail). Past it the clip holds\n * its last frame, unless `loop` is set. Omit to play to the source's end. */\n endAt?: number\n /** Loop the trimmed span `[startFrom, endAt)` (requires `endAt`). The source\n * time wraps so the clip repeats for as long as the `<Sequence>` shows it. */\n loop?: boolean\n /** Target box width in px. With `height`, the frame is fitted into this box\n * per `fit`. Omit both for the video's intrinsic pixel size. */\n width?: number\n height?: number\n /** How to fit the frame into the `width`×`height` box (default `'cover'`). */\n fit?: ImageFit\n /**\n * Preview-only behaviour when the browser can't composite this source — i.e. a\n * cross-origin video without CORS headers. **Never affects `onda export`**,\n * which always composites via ffmpeg.\n * - `'skip'` (default): leave it blank in preview + log a one-time hint.\n * - `'element'`: overlay a plain `<video>` so it still *plays* in preview\n * (display-only — no engine effects, and it sits above the canvas). Useful\n * for prototyping with a third-party URL you can't add CORS to. For your own\n * assets, serving them same-origin or with CORS is better (full compositing).\n */\n previewFallback?: 'skip' | 'element'\n}\n\n/** A video clip. At composition frame *f* it shows the source frame at\n * `startFrom + (f / fps) * playbackRate` seconds; the player/engine decodes that\n * exact frame (browser: `<video>`/WebCodecs; native export: ffmpeg) and the\n * renderer draws it like an image. Place/scale it like any node; combine with a\n * `<Sequence>` to position it on the timeline. */\nexport function Video({ startFrom = 0, playbackRate = 1, endAt, loop, ...rest }: VideoProps) {\n const frame = useCurrentFrame()\n const { fps } = useVideoConfig()\n // Resolve the source time IN THE AUTHOR LAYER (the engine just gets a number):\n // advance from the trim-head at playbackRate, then trim-tail / loop the span.\n let time = startFrom + (frame / Math.max(1, fps)) * playbackRate\n if (endAt != null && endAt > startFrom) {\n const span = endAt - startFrom\n time = loop\n ? startFrom + ((((time - startFrom) % span) + span) % span) // wrap to repeat\n : Math.min(time, endAt) // hold the last frame past the tail\n }\n return createElement('onda-video', { ...rest, time: Math.max(0, time) })\n}\n\nexport interface AudioProps {\n /** Path, URL, or `data:` URI of the audio. */\n src: string\n /** Composition time (seconds) at which the clip begins playing. Default 0. */\n start?: number\n /** Seconds into the source to begin from (trim the head). Default 0. */\n startAt?: number\n /** Linear gain, 0..1. Default 1. */\n volume?: number\n}\n\n/** A non-visual audio clip on the timeline. It draws nothing — the player plays\n * it during preview (and export muxes it). Place it anywhere in the tree; `start`\n * sets when it begins (seconds), `startAt` trims into the source, `volume`\n * scales its gain. The higher-level `<AudioClip>` (`@onda-engine/components`) wraps this\n * with a fade envelope. */\nexport function Audio(props: AudioProps) {\n return createElement('onda-audio', props)\n}\n\nexport interface SvgProps extends NodeProps {\n /** A file path/URL to the SVG (resolved at render time by `onda render`). */\n src?: string\n /** Inline SVG markup (self-contained; preferred when present). */\n markup?: string\n}\n\n/** An SVG document, expanded into vector nodes by the engine (`onda-svg`).\n * Use `x`/`y`/`scaleX`/`scaleY` to place and size it. Renders on the GPU\n * (Vello) backend. */\nexport function Svg(props: SvgProps) {\n return createElement('onda-svg', props)\n}\n","//! `spring()` — natural motion as a deterministic, frame-keyed value.\n//!\n//! A damped harmonic oscillator pulled from 0 toward 1, integrated with explicit\n//! Euler at a stable sub-frame step. Pure function of `frame` (IEEE-754 math), so\n//! renders are reproducible across machines. Use it like Remotion's spring —\n//! including `durationInFrames` to re-time how fast it settles.\n//!\n//! Why sub-stepping: explicit Euler diverges unless `dt < ~2/ω`, where `ω` is the\n//! fastest rate in the system. A heavily-overdamped config like the Onda house\n//! spring (damping 200) has `ω ≈ 200`, so a naive `dt = 1/fps` (≈0.033) blows up\n//! to NaN. We pick a stable sub-frame `dt` instead, independent of `fps`.\n\nexport interface SpringConfig {\n mass?: number\n stiffness?: number\n damping?: number\n}\n\nexport interface SpringOptions {\n /** Current frame (e.g. from `useCurrentFrame()`). */\n frame: number\n /** Composition frame rate. */\n fps: number\n /** Output at rest start (default 0). */\n from?: number\n /** Output at settle (default 1). */\n to?: number\n config?: SpringConfig\n /** Re-time the spring so it settles in this many frames (like Remotion's\n * `durationInFrames`). Without it, the settle is governed purely by the\n * spring physics — and for an overdamped config (e.g. the Onda house spring)\n * that can be far slower than you want. */\n durationInFrames?: number\n /** When `durationInFrames` is set, the spring counts as \"settled\" once it\n * stays within this distance of `to` with near-zero velocity. Default 0.005. */\n durationRestThreshold?: number\n}\n\n/** A stable explicit-Euler step (seconds) for this mass-spring-damper. Sized to\n * `dt < 2/ω` with margin so the integration never diverges, and capped at 1/60s\n * so soft configs are still sampled smoothly. */\nfunction stableStep(mass: number, stiffness: number, damping: number): number {\n const omega = Math.max(damping / mass, Math.sqrt(stiffness / mass), 1e-6)\n return Math.min(1 / 60, 1.6 / omega)\n}\n\n/** Normalized spring position (0 at rest → 1 at settle, may overshoot if\n * underdamped) after `timeSec` seconds. Pure function of time. */\nfunction positionAt(\n timeSec: number,\n mass: number,\n stiffness: number,\n damping: number,\n dt: number,\n): number {\n if (timeSec <= 0) return 0\n const steps = Math.max(1, Math.round(timeSec / dt))\n let position = 0\n let velocity = 0\n for (let i = 0; i < steps; i++) {\n const force = -stiffness * (position - 1) - damping * velocity\n velocity += (force / mass) * dt\n position += velocity * dt\n }\n return position\n}\n\n// Memoized natural-settle measurement, keyed by (config, dt, threshold). Pure\n// memoization of a pure function — no effect on determinism.\nconst settleCache = new Map<string, number>()\n\n/** Seconds the natural spring takes to settle within `threshold` of 1 with\n * near-zero velocity. Used to re-time when `durationInFrames` is set. */\nfunction measureSettleSeconds(\n mass: number,\n stiffness: number,\n damping: number,\n dt: number,\n threshold: number,\n): number {\n const key = `${mass}|${stiffness}|${damping}|${dt}|${threshold}`\n const cached = settleCache.get(key)\n if (cached !== undefined) return cached\n\n let position = 0\n let velocity = 0\n const maxSteps = 5_000_000\n let result = maxSteps * dt\n for (let i = 0; i < maxSteps; i++) {\n const force = -stiffness * (position - 1) - damping * velocity\n velocity += (force / mass) * dt\n position += velocity * dt\n if (Math.abs(1 - position) < threshold && Math.abs(velocity) < threshold) {\n result = (i + 1) * dt\n break\n }\n }\n settleCache.set(key, result)\n return result\n}\n\n/** Spring value at `frame`. Settles toward `to`; underdamped configs overshoot.\n * With `durationInFrames`, the whole settle is time-remapped to land in that\n * many frames. */\nexport function spring({\n frame,\n fps,\n from = 0,\n to = 1,\n config = {},\n durationInFrames,\n durationRestThreshold = 0.005,\n}: SpringOptions): number {\n const { mass = 1, stiffness = 100, damping = 10 } = config\n let position = 0\n if (fps > 0 && frame > 0) {\n const dt = stableStep(mass, stiffness, damping)\n let timeSec = frame / fps\n if (durationInFrames != null && durationInFrames > 0) {\n // Re-time by stretching the time axis: the value at `frame` is the natural\n // spring's value at `frame * naturalSettle / durationInFrames`, clamped at\n // the natural settle so post-settle frames just read `to`.\n const naturalSec = measureSettleSeconds(mass, stiffness, damping, dt, durationRestThreshold)\n const durationSec = durationInFrames / fps\n timeSec = Math.min((frame / fps) * (naturalSec / durationSec), naturalSec)\n }\n position = positionAt(timeSec, mass, stiffness, damping, dt)\n }\n return from + (to - from) * position\n}\n","//! Time-shifting composition primitives — `<Sequence>`, `<Series>`, `<Loop>`.\n//!\n//! These manipulate the frame context: children inside a `<Sequence from={N}>`\n//! see `useCurrentFrame()` shifted by `-N` and render only within their window.\n//! This is Remotion's compositional grammar, the way you assemble a timeline.\n\nimport {\n Children,\n Fragment,\n type ReactElement,\n type ReactNode,\n createElement,\n isValidElement,\n useContext,\n} from 'react'\nimport { FrameContext } from './frame.js'\n\nexport interface SequenceProps {\n /** Frame at which this sequence starts (children's frame 0). Default 0. */\n from?: number\n /** How many frames it lasts; unbounded if omitted. */\n durationInFrames?: number\n children?: ReactNode\n}\n\n/** Shift children in time: inside, the frame is `outerFrame - from`, and the\n * children render only while `0 <= localFrame < durationInFrames`. When a\n * `durationInFrames` is given, children's `useVideoConfig().durationInFrames`\n * reflects the SEQUENCE's length (Remotion semantics) — so a component can ask\n * \"how long is my clip?\" and fit its entrance to it. */\nexport function Sequence({\n from = 0,\n durationInFrames,\n children,\n}: SequenceProps): ReactElement | null {\n const ctx = useContext(FrameContext)\n if (!ctx) return null\n const local = ctx.frame - from\n const visible = local >= 0 && (durationInFrames === undefined || local < durationInFrames)\n if (!visible) return null\n const value =\n durationInFrames === undefined\n ? { ...ctx, frame: local }\n : { ...ctx, frame: local, durationInFrames }\n return createElement(FrameContext.Provider, { value }, children)\n}\n\nexport interface LoopProps {\n /** Length of one loop iteration in frames. */\n durationInFrames: number\n children?: ReactNode\n}\n\n/** Repeat children forever: children see `frame % durationInFrames`. */\nexport function Loop({ durationInFrames, children }: LoopProps): ReactElement | null {\n const ctx = useContext(FrameContext)\n if (!ctx || durationInFrames <= 0) return null\n const local = ((ctx.frame % durationInFrames) + durationInFrames) % durationInFrames\n return createElement(FrameContext.Provider, { value: { ...ctx, frame: local } }, children)\n}\n\nexport interface SeriesSequenceProps {\n durationInFrames: number\n children?: ReactNode\n}\n\n// Marker element; never rendered directly — `<Series>` reads its props.\nfunction SeriesSequence(_props: SeriesSequenceProps): ReactElement | null {\n return null\n}\n\ninterface SeriesProps {\n children?: ReactNode\n}\n\n/** Play `<Series.Sequence>` children back-to-back: each starts where the\n * previous ended (cumulative offsets from their `durationInFrames`). */\nfunction SeriesRoot({ children }: SeriesProps): ReactElement {\n let offset = 0\n const items = Children.map(children, (child) => {\n if (!isValidElement(child) || child.type !== SeriesSequence) {\n throw new Error('<Series> children must be <Series.Sequence>')\n }\n const props = child.props as SeriesSequenceProps\n const element = createElement(\n Sequence,\n { from: offset, durationInFrames: props.durationInFrames },\n props.children,\n )\n offset += props.durationInFrames\n return element\n })\n return createElement(Fragment, null, items)\n}\n\n/** `<Series>` with `<Series.Sequence durationInFrames={…}>` children. */\nexport const Series = Object.assign(SeriesRoot, { Sequence: SeriesSequence })\n","//! Seeded, deterministic randomness for frame-driven motion.\n//!\n//! Compositions must render identically every time (same frame → same pixels),\n//! so `Math.random()` is off-limits. These are pure functions of their inputs:\n//! `random(seed)` for uniform values and `noise2D/3D` for smooth, organic motion\n//! (jitter, drift, wobble). Same seed + coords always yield the same result.\n//!\n//! THE SEEDING MODEL (the convention every seeded component follows):\n//! - Every component with randomness takes a `seed` prop with a fixed default —\n//! so an instance is deterministic out of the box and STABLE across renders,\n//! previews and exports (same seed → same pixels, every machine).\n//! - Per-element streams derive from the seed by salting (`random(seed + i *\n//! prime)` or `random(`${seed}-${i}-part`)`), never by consuming a stateful\n//! generator — order of evaluation can't change the result.\n//! - Want a DIFFERENT take, not a different look? Pass `variant` (an integer):\n//! {@link variantSeed} derives a new well-mixed seed from `(seed, variant)`,\n//! so alternates never require hand-edited magic seeds. `variant: 0` (or\n//! omitted) is the identity — existing renders are untouched.\n\n/** Hash a seed (number or string) to a 32-bit unsigned integer. */\nfunction hashSeed(seed: number | string): number {\n if (typeof seed === 'number') {\n // Mix the bits so nearby seeds (0, 1, 2…) diverge.\n let h = Math.imul(seed ^ (seed >>> 16), 2246822507) >>> 0\n h = Math.imul(h ^ (h >>> 13), 3266489909) >>> 0\n return (h ^ (h >>> 16)) >>> 0\n }\n let h = 2166136261 >>> 0\n for (let i = 0; i < seed.length; i++) {\n h ^= seed.charCodeAt(i)\n h = Math.imul(h, 16777619) >>> 0\n }\n return h >>> 0\n}\n\n/** Derive a deterministic alternate seed from `(seed, variant)` — the cheap\n * \"give me take #N\" knob. `variant` 0/undefined returns `seed` UNCHANGED\n * (identity — existing compositions keep their exact pixels); any other\n * integer yields a well-mixed, stable new numeric seed. Pure. */\nexport function variantSeed(seed: number, variant?: number): number\nexport function variantSeed(seed: number | string, variant?: number): number | string\nexport function variantSeed(seed: number | string, variant?: number): number | string {\n if (!variant) return seed\n // Mix the base seed's hash with the variant through the same avalanche the\n // PRNG uses, so variant 1 and 2 are as unrelated as two arbitrary seeds.\n let h = (hashSeed(seed) ^ Math.imul(variant | 0, 0x9e3779b9)) >>> 0\n h = Math.imul(h ^ (h >>> 13), 3266489909) >>> 0\n return (h ^ (h >>> 16)) >>> 0\n}\n\n/** A deterministic value in `[0, 1)` for `seed` (mulberry32, one step). */\nexport function random(seed: number | string): number {\n let a = hashSeed(seed)\n a = (a + 0x6d2b79f5) | 0\n let t = Math.imul(a ^ (a >>> 15), 1 | a)\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n}\n\n/** Deterministic `[0, 1)` from a seed + integer coordinates (noise lattice). */\nfunction hashUnit(s: number, ...coords: number[]): number {\n let h = (s ^ 0x9e3779b9) >>> 0\n for (const c of coords) {\n h ^= c | 0\n h = Math.imul(h, 16777619) >>> 0\n h ^= h >>> 13\n }\n h = Math.imul(h ^ (h >>> 15), 2246822507) >>> 0\n return (h >>> 0) / 4294967296\n}\n\n/** Quintic smoothstep (Perlin's fade) — C2-continuous, so noise looks smooth. */\nfunction fade(t: number): number {\n return t * t * t * (t * (t * 6 - 15) + 10)\n}\n\nfunction lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t\n}\n\n/** Smooth 2D value noise in `[-1, 1]` — coherent (nearby inputs give nearby\n * outputs), deterministic per `seed`. Scale `x`/`y` to set the frequency. */\nexport function noise2D(seed: number | string, x: number, y: number): number {\n const s = hashSeed(seed)\n const ix = Math.floor(x)\n const iy = Math.floor(y)\n const fx = x - ix\n const fy = y - iy\n const u = fade(fx)\n const v = fade(fy)\n const n = lerp(\n lerp(hashUnit(s, ix, iy), hashUnit(s, ix + 1, iy), u),\n lerp(hashUnit(s, ix, iy + 1), hashUnit(s, ix + 1, iy + 1), u),\n v,\n )\n return n * 2 - 1\n}\n\n/** Smooth 3D value noise in `[-1, 1]` (e.g. animate `z` over frames for drift). */\nexport function noise3D(seed: number | string, x: number, y: number, z: number): number {\n const s = hashSeed(seed)\n const ix = Math.floor(x)\n const iy = Math.floor(y)\n const iz = Math.floor(z)\n const u = fade(x - ix)\n const v = fade(y - iy)\n const w = fade(z - iz)\n const c = (dx: number, dy: number, dz: number) => hashUnit(s, ix + dx, iy + dy, iz + dz)\n const front = lerp(lerp(c(0, 0, 0), c(1, 0, 0), u), lerp(c(0, 1, 0), c(1, 1, 0), u), v)\n const back = lerp(lerp(c(0, 0, 1), c(1, 0, 1), u), lerp(c(0, 1, 1), c(1, 1, 1), u), v)\n return lerp(front, back, w) * 2 - 1\n}\n","//! `<Particles>` — a deterministic particle emitter. Every particle's whole state\n//! (spawn point, velocity, age, size, opacity, colour, spin) is a PURE function of\n//! `(frame, seed, index)` via the `random(seed)` hash, so the same comp renders the\n//! same field on every frame and every machine — no `Math.random`, no wall-clock,\n//! and no engine change: each live particle is just a circle/square in one\n//! full-canvas `<Group>`. Frame-based units (velocity = px/frame, gravity =\n//! px/frame²), so it composes with the rest of the timeline.\n\nimport { type ReactElement, createElement } from 'react'\nimport { Ellipse, Group, Rect } from './components.js'\nimport { useCurrentFrame } from './frame.js'\nimport { random } from './random.js'\n\nexport interface ParticlesProps {\n /** Number of particles. */\n count?: number\n /** Seed for every per-particle random — the same seed always renders the same field. */\n seed?: number | string\n /** Emitter origin (px). */\n x?: number\n y?: number\n /** Particles spawn at a random point within this radius of the origin (0 = a point). */\n spawnRadius?: number\n /** Base launch speed (px per frame). */\n speed?: number\n /** Random speed reduction, 0..1 (each particle gets `speed × (1 − variance×rand)`). */\n speedVariance?: number\n /** Launch direction in degrees: 0 = right, −90 = up, 90 = down, 180 = left. */\n angle?: number\n /** Spread cone around `angle`, in degrees (360 = omnidirectional burst). */\n spread?: number\n /** Constant downward acceleration (px per frame²). */\n gravity?: number\n /** Particle lifetime in frames. */\n lifetime?: number\n /** Stagger the emission across this many frames (0 = a single burst). */\n emitOver?: number\n /** Re-emit each particle when it dies → a continuous stream (set `emitOver`≈`lifetime`). */\n loop?: boolean\n /** Frames before emission begins. */\n delay?: number\n /** Particle shape. */\n shape?: 'circle' | 'square'\n /** Diameter (px) at birth → death (lerped over the lifetime). A number = constant. */\n size?: number | [number, number]\n /** Opacity at birth → death. */\n opacity?: [number, number]\n /** Palette each particle picks one colour from. */\n colors?: string[]\n /** Rotation in degrees over the lifetime (visible on `square`). */\n spin?: number\n}\n\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n\n/** A deterministic particle emitter — bursts, fountains, confetti, sparks, dust,\n * snow. See {@link ParticlesProps}. */\nexport function Particles({\n count = 60,\n seed = 1,\n x = 0,\n y = 0,\n spawnRadius = 0,\n speed = 4,\n speedVariance = 0.5,\n angle = -90,\n spread = 360,\n gravity = 0,\n lifetime = 60,\n emitOver = 0,\n loop = false,\n delay = 0,\n shape = 'circle',\n size = 8,\n opacity = [1, 0],\n colors = ['#e85494', '#ffd36b', '#5ad1ff'],\n spin = 0,\n}: ParticlesProps): ReactElement {\n const frame = useCurrentFrame()\n const key = String(seed)\n const [s0, s1] = typeof size === 'number' ? [size, size] : size\n const particles: ReactElement[] = []\n\n for (let i = 0; i < count; i++) {\n const r = (suffix: string): number => random(`${key}-${i}-${suffix}`)\n const emitFrame = delay + (emitOver > 0 ? (i / count) * emitOver : 0)\n let age = frame - emitFrame\n if (loop && age >= 0) age %= lifetime\n if (age < 0 || age >= lifetime) continue\n\n // Spawn point: uniform within the spawn disc (√rand for even area distribution).\n const sa = r('sa') * Math.PI * 2\n const sr = Math.sqrt(r('sr')) * spawnRadius\n const ox = x + Math.cos(sa) * sr\n const oy = y + Math.sin(sa) * sr\n\n // Launch velocity: `angle ± spread/2`, speed with variance.\n const dir = ((angle + (r('ang') - 0.5) * spread) * Math.PI) / 180\n const spd = speed * (1 - speedVariance * r('spd'))\n const vx = Math.cos(dir) * spd\n const vy = Math.sin(dir) * spd\n\n // Integrate position (closed form: launch + gravity).\n const px = ox + vx * age\n const py = oy + vy * age + 0.5 * gravity * age * age\n\n const t = age / lifetime\n const sz = lerp(s0, s1, t)\n const op = lerp(opacity[0], opacity[1], t)\n const color = colors[Math.floor(r('col') * colors.length) % colors.length]\n const inner =\n shape === 'square'\n ? createElement(Rect, { x: -sz / 2, y: -sz / 2, width: sz, height: sz, fill: color })\n : createElement(Ellipse, { x: -sz / 2, y: -sz / 2, width: sz, height: sz, fill: color })\n particles.push(\n createElement(\n Group,\n { key: i, x: px, y: py, opacity: op, rotation: spin * t, originX: 0, originY: 0 },\n inner,\n ),\n )\n }\n return createElement(Group, null, ...particles)\n}\n","//! Transitions between sequences — `<TransitionSeries>`.\n//!\n//! Like `<Series>`, but consecutive sequences can *overlap* by a transition's\n//! duration, during which the outgoing scene animates out and the incoming one\n//! animates in. Built entirely on the existing primitives: a transition is just\n//! `opacity` (fade), `translate` (slide), or a `clip` mask (wipe) driven by the\n//! transition's progress — no engine support needed.\n//!\n//! ```tsx\n//! <TransitionSeries>\n//! <TransitionSeries.Sequence durationInFrames={60}><A /></TransitionSeries.Sequence>\n//! <TransitionSeries.Transition presentation={fade()} timing={linearTiming({ durationInFrames: 20 })} />\n//! <TransitionSeries.Sequence durationInFrames={60}><B /></TransitionSeries.Sequence>\n//! </TransitionSeries>\n//! ```\n\nimport { Children, type ReactElement, type ReactNode, createElement, isValidElement } from 'react'\nimport { clipEllipse, clipPath, clipRect } from './clip.js'\nimport { Group, Rect } from './components.js'\nimport { useCurrentFrame, useVideoConfig } from './frame.js'\nimport { linearGradient, radialGradient } from './gradient.js'\nimport { Sequence } from './sequence.js'\nimport { type SpringConfig, spring } from './spring.js'\n\n// ---------------------------------------------------------------------------\n// Timings — how a transition's progress evolves over its duration.\n// ---------------------------------------------------------------------------\n\n/** Maps a frame within a transition to progress `0..1` (may overshoot 1 for\n * springs). `durationInFrames` is how long the transition (overlap) lasts. */\nexport interface TransitionTiming {\n durationInFrames: number\n getProgress(frame: number, fps: number): number\n}\n\n/** A linear transition over `durationInFrames`. */\nexport function linearTiming({ durationInFrames }: { durationInFrames: number }): TransitionTiming {\n return {\n durationInFrames,\n getProgress: (frame) =>\n durationInFrames <= 0 ? 1 : Math.min(1, Math.max(0, frame / durationInFrames)),\n }\n}\n\n/** A spring-driven transition (natural ease, optional overshoot). */\nexport function springTiming({\n durationInFrames = 30,\n config,\n}: {\n durationInFrames?: number\n config?: SpringConfig\n} = {}): TransitionTiming {\n return {\n durationInFrames,\n getProgress: (frame, fps) => Math.max(0, spring({ frame, fps, config })),\n }\n}\n\n// ---------------------------------------------------------------------------\n// Presentations — how the entering/exiting scenes look at a given progress.\n// ---------------------------------------------------------------------------\n\n/** Which edge a slide/wipe moves from. */\nexport type SlideDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom'\n\nexport interface PresentationState {\n /** Transition progress `0..1` (0 = fully out, 1 = fully in). */\n progress: number\n /** True for the incoming scene, false for the outgoing one. */\n entering: boolean\n width: number\n height: number\n}\n\n/** Wraps a scene to present it at a point in a transition. Identity at the\n * resting state (entering progress 1 / exiting progress 0). */\nexport type TransitionPresentation = (children: ReactNode, state: PresentationState) => ReactElement\n\n/** Cross-fade via opacity. */\nexport function fade(): TransitionPresentation {\n return (children, { progress, entering }) =>\n createElement(Group, { opacity: entering ? progress : 1 - progress }, children)\n}\n\n/** Slide the scenes across; `direction` is where the incoming scene comes from. */\nexport function slide({\n direction = 'from-right',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const axisX = direction === 'from-left' || direction === 'from-right'\n const span = axisX ? width : height\n const sign = direction === 'from-right' || direction === 'from-bottom' ? 1 : -1\n // Entering: starts off-screen on `direction`'s edge, slides to 0.\n // Exiting: slides off the opposite edge in lock-step with the incoming one.\n const offset = entering ? (1 - progress) * span * sign : -progress * span * sign\n const props = axisX ? { x: offset } : { y: offset }\n return createElement(Group, props, children)\n }\n}\n\n/** Wipe the incoming scene over the outgoing one with a growing clip mask. */\nexport function wipe({\n direction = 'from-left',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n // The incoming scene is masked (it reveals over the outgoing one). The\n // outgoing scene fades out faster than the wipe completes — so it doesn't\n // linger at full opacity beneath an incoming scene that has transparent\n // areas (otherwise the old scene bleeds through the new one's gaps). Gone\n // by ~60% of the wipe.\n if (!entering) {\n const fade = Math.max(0, 1 - progress / 0.6)\n return createElement(Group, { opacity: fade }, children)\n }\n const p = Math.min(1, Math.max(0, progress))\n switch (direction) {\n case 'from-left':\n return createElement(Group, { clip: clipRect(width * p, height) }, children)\n case 'from-top':\n return createElement(Group, { clip: clipRect(width, height * p) }, children)\n case 'from-right': {\n // Reveal the rightmost p·W: shift content left, clip at the origin, shift back.\n const w = width * p\n return createElement(\n Group,\n { x: width - w },\n createElement(Group, { x: -(width - w), clip: clipRect(w, height) }, children),\n )\n }\n case 'from-bottom': {\n const h = height * p\n return createElement(\n Group,\n { y: height - h },\n createElement(Group, { y: -(height - h), clip: clipRect(width, h) }, children),\n )\n }\n }\n }\n}\n\n/** A hard cut — the overlap timing with no visual effect. The incoming scene\n * (drawn on top) simply replaces the outgoing one. */\nexport function none(): TransitionPresentation {\n return (children) => createElement(Group, {}, children)\n}\n\n/** Scale `children` by (sx, sy) about the pivot `(px, py)` — translate to the\n * pivot, scale, then translate back (node scale pivots on the local origin). */\nfunction scaleAbout(\n children: ReactNode,\n sx: number,\n sy: number,\n px: number,\n py: number,\n): ReactElement {\n return createElement(\n Group,\n { x: px, y: py },\n createElement(\n Group,\n { scaleX: sx, scaleY: sy },\n createElement(Group, { x: -px, y: -py }, children),\n ),\n )\n}\n\n/** A 2D card flip: the outgoing scene collapses horizontally to the centre line\n * by the midpoint, then the incoming scene expands out of it. */\nexport function flip(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sx = entering\n ? Math.max(0, progress * 2 - 1) // incoming expands over the back half\n : Math.max(0, 1 - progress * 2) // outgoing collapses over the front half\n return scaleAbout(children, sx, 1, width / 2, height / 2)\n }\n}\n\nconst round = (n: number): number => Math.round(n * 1000) / 1000\n\n/** Iris: a circular reveal of the incoming scene expanding from the centre. The\n * outgoing scene stays full beneath it (the incoming draws on top). */\nexport function iris(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering || progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cx = width / 2\n const cy = height / 2\n const r = progress * Math.hypot(cx, cy) // cover the corners at progress 1\n // Centre a 2r×2r ellipse clip on (cx,cy): translate the clipped group to the\n // clip box's origin, then untranslate the children back (cf. `wipe`).\n return createElement(\n Group,\n { x: cx - r, y: cy - r, clip: clipEllipse(2 * r, 2 * r) },\n createElement(Group, { x: -(cx - r), y: -(cy - r) }, children),\n )\n }\n}\n\n/** Clock wipe: an angular sweep revealing the incoming scene clockwise from 12\n * o'clock. Outgoing stays full beneath (the incoming draws on top). The wedge is\n * a polygon fan (M/L/Z only — no arc command) so it clips on any path renderer. */\nexport function clockWipe(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering || progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cx = width / 2\n const cy = height / 2\n const r = Math.hypot(cx, cy) // reach the corners\n const theta = progress * Math.PI * 2 // clockwise from the top\n const steps = Math.max(2, Math.ceil((theta / (Math.PI * 2)) * 64))\n let d = `M ${round(cx)} ${round(cy)}`\n for (let i = 0; i <= steps; i++) {\n const a = (theta * i) / steps\n d += ` L ${round(cx + r * Math.sin(a))} ${round(cy - r * Math.cos(a))}`\n }\n d += ' Z'\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\nexport type PushDirection = 'left' | 'right' | 'up' | 'down'\n\nconst PUSH_VECTOR: Record<PushDirection, { x: number; y: number }> = {\n left: { x: -1, y: 0 },\n right: { x: 1, y: 0 },\n up: { x: 0, y: -1 },\n down: { x: 0, y: 1 },\n}\n\n/** Both scenes translate together in `direction`, like a camera pan. */\nexport function push({\n direction = 'left',\n}: { direction?: PushDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n return createElement(Group, { x: tx, y: ty }, children)\n }\n}\n\n/** Scale-and-fade punch. `direction` 'in' pushes toward the viewer, 'out' pulls back. */\nexport function zoom({\n direction = 'in',\n scaleAmount = 0.2,\n}: { direction?: 'in' | 'out'; scaleAmount?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const s = scaleAmount\n let scale: number\n if (direction === 'in') {\n scale = entering ? 1 + s / 2 - (s / 2) * progress : 1 + s * progress\n } else {\n scale = entering ? 1 - s / 2 + (s / 2) * progress : 1 - s * progress\n }\n const opacity = entering ? progress : 1 - progress\n return createElement(\n Group,\n { opacity },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Push with parallax depth — a scale layered on the translate (a camera dolly). */\nexport function depthPush({\n direction = 'left',\n scaleAmount = 0.08,\n}: { direction?: PushDirection; scaleAmount?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n const scale = entering ? 1 + scaleAmount * (1 - progress) : 1 - scaleAmount * progress\n return createElement(\n Group,\n { x: tx, y: ty },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Outgoing fades to `color`, incoming fades up from it (dip-to-black/white). */\nexport function dipToColor({ color = '#08080a' }: { color?: string } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sceneOpacity = entering ? Math.max(0, progress * 2 - 1) : Math.max(0, 1 - progress * 2)\n const colorOpacity = entering\n ? Math.max(0, 1 - (progress - 0.5) * 2)\n : Math.min(1, progress * 2)\n return createElement(\n Group,\n null,\n createElement(Group, { opacity: sceneOpacity }, children),\n createElement(\n Group,\n { opacity: colorOpacity },\n createElement(Rect, { width, height, fill: color }),\n ),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// Effect transitions — approximated in the presentation layer (no engine blur).\n// `blur`/`glassWipe` use a multi-tap smear (`blurStack`); the rest are\n// transform/clip tricks. Crude vs a true Gaussian, but convincing at transition\n// speed and zero engine cost.\n// ---------------------------------------------------------------------------\n\n// Ring of unit offsets; a tap is drawn at each, scaled by the blur radius, so the\n// copies smear into a soft blur. (A true Gaussian would need an engine pass.)\nconst BLUR_RING: ReadonlyArray<readonly [number, number]> = [\n [0, 0],\n [1, 0],\n [-1, 0],\n [0, 1],\n [0, -1],\n [0.7, 0.7],\n [-0.7, 0.7],\n [0.7, -0.7],\n [-0.7, -0.7],\n]\n\n/** Draw `children` at each ring offset (scaled by `radius`) at equal opacity so\n * the copies sum to a soft blur. `radius` ≤ ~0.5px → a single sharp draw. */\nfunction blurStack(children: ReactNode, radius: number): ReactElement {\n if (radius <= 0.5) return createElement(Group, {}, children)\n const op = 1 / BLUR_RING.length\n return createElement(\n Group,\n {},\n ...BLUR_RING.map(([dx, dy], i) =>\n createElement(Group, { key: i, x: dx * radius, y: dy * radius, opacity: op }, children),\n ),\n )\n}\n\n/** Blur cross: each scene blurs toward the midpoint and sharpens at rest, with an\n * opacity cross. (Multi-tap approximation — see {@link blurStack}.) */\nexport function blur({ maxBlur = 24 }: { maxBlur?: number } = {}): TransitionPresentation {\n return (children, { progress, entering }) => {\n const sharp = entering ? progress : 1 - progress // 1 at rest\n return createElement(\n Group,\n { opacity: entering ? progress : 1 - progress },\n blurStack(children, (1 - sharp) * maxBlur),\n )\n }\n}\n\n/** Motion-blur smear: render copies offset ALONG (dx,dy) — a directional swish,\n * unlike {@link blurStack}'s isotropic ring. Used by {@link whipPan}. */\nfunction directionalSmear(\n children: ReactNode,\n dx: number,\n dy: number,\n radius: number,\n): ReactElement {\n if (radius <= 0.5) return createElement(Group, {}, children)\n const N = 6\n const op = 1 / N\n return createElement(\n Group,\n {},\n ...Array.from({ length: N }, (_, i) => {\n const t = (i / (N - 1) - 0.5) * 2 // -1..1 along the axis\n return createElement(\n Group,\n { key: i, x: dx * t * radius, y: dy * t * radius, opacity: op },\n children,\n )\n }),\n )\n}\n\n/** Zoom-blur / \"smooth zoom\" — the punch-in (or -out) with a motion-blur smear\n * heaviest mid-transition, snapping sharp at rest, with an opacity cross. The\n * most-used viral/social transition. `direction` 'in' rushes toward the viewer,\n * 'out' pulls back. */\nexport function zoomBlur({\n direction = 'in',\n scaleAmount = 0.35,\n maxBlur = 28,\n}: {\n direction?: 'in' | 'out'\n scaleAmount?: number\n maxBlur?: number\n} = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const s = scaleAmount\n const dirSign = direction === 'in' ? 1 : -1\n // Entering settles to 1 from an over/under-scale; exiting departs from 1.\n const scale = entering ? 1 + dirSign * s * (1 - progress) : 1 + dirSign * s * progress\n const sharp = entering ? progress : 1 - progress // 1 at rest\n const opacity = entering ? progress : 1 - progress\n return createElement(\n Group,\n { opacity },\n scaleAbout(blurStack(children, (1 - sharp) * maxBlur), scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Whip-pan — a fast directional swish with a motion-blur smear ALONG the pan\n * axis (the high-energy \"camera whip\" cut, best paired with a whoosh SFX).\n * `direction` is where the camera swings toward (left/right/up/down). */\nexport function whipPan({\n direction = 'left',\n maxBlur = 40,\n}: { direction?: PushDirection; maxBlur?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n const sharp = entering ? progress : 1 - progress\n return createElement(\n Group,\n { x: tx, y: ty },\n directionalSmear(children, x, y, (1 - sharp) * maxBlur),\n )\n }\n}\n\n/** Film-burn / light-leak — the scenes crossfade while a warm leak blooms over the\n * cut, screen-blended and peaking at the midpoint (the cinematic-warmth flare).\n * The leak draws once (on the incoming layer); a dark gradient screen-blends to\n * ~nothing, so only the warm centre flares. */\nexport function filmBurn({ color = '#ffb070' }: { color?: string } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sceneOpacity = entering ? progress : 1 - progress\n const burn = Math.sin(Math.min(1, Math.max(0, progress)) * Math.PI) // 0 → 1 → 0\n const scene = createElement(Group, { opacity: sceneOpacity }, children)\n if (!entering) return scene\n const leak = createElement(\n Group,\n { opacity: burn * 0.85, blendMode: 'screen' },\n createElement(Rect, {\n width,\n height,\n gradient: radialGradient([width * 0.72, height * 0.28], Math.max(width, height) * 0.95, [\n { offset: 0, color },\n { offset: 0.45, color: '#7a3a12' },\n { offset: 1, color: '#000000' },\n ]),\n }),\n )\n return createElement(Group, null, scene, leak)\n }\n}\n\n/** Luma-wipe — reveal the incoming scene through a soft LUMINANCE ramp that sweeps\n * across (a gradient matte; white reveals, black hides). The organic, edge-feathered\n * reveal Premiere/Resolve ship as a workhorse. */\nexport function lumaWipe(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering) {\n // The outgoing scene fades as the incoming reveals over it.\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n }\n const p = Math.min(1, Math.max(0, progress))\n const feather = 0.22\n const lead = p * (1 + feather)\n const matte = createElement(Rect, {\n width,\n height,\n gradient: linearGradient(\n [0, 0],\n [width, 0],\n [\n { offset: 0, color: '#ffffff' },\n { offset: Math.max(0, Math.min(1, lead - feather)), color: '#ffffff' },\n { offset: Math.max(0, Math.min(1, lead)), color: '#000000' },\n { offset: 1, color: '#000000' },\n ],\n ),\n })\n return createElement(Group, { matte, matteMode: 'luminance' }, children)\n }\n}\n\n/** Chromatic split: the scene tears into horizontally offset ghosts that spread\n * at the midpoint and converge at rest (an RGB-fringe feel — the engine has no\n * per-channel tint, so the copies are uncoloured). */\nexport function chromaticAberration({\n maxShift = 22,\n}: { maxShift?: number } = {}): TransitionPresentation {\n return (children, { progress, entering }) => {\n const sharp = entering ? progress : 1 - progress\n const d = (1 - sharp) * maxShift\n const opacity = entering ? progress : 1 - progress\n if (d <= 0.5) return createElement(Group, { opacity }, children)\n return createElement(\n Group,\n { opacity },\n createElement(Group, { x: -d, opacity: 0.5 }, children),\n createElement(Group, { x: d, opacity: 0.5 }, children),\n createElement(Group, {}, children),\n )\n }\n}\n\n/** Device pullback: the outgoing scene shrinks back (and lifts) as if pulled into\n * the distance, uncovering the incoming scene that settles forward into place. */\nexport function devicePullback(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (entering) {\n const scale = 1.12 - 0.12 * progress\n return createElement(\n Group,\n { opacity: progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n const scale = 1 - 0.45 * progress\n return createElement(\n Group,\n { opacity: 1 - progress, y: -progress * height * 0.06 },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Expand morph: the incoming scene bursts open from the centre while the\n * outgoing one balloons out and dissolves — a quick morph-expand. */\nexport function expandMorph(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (entering) {\n const scale = 0.3 + 0.7 * progress\n return createElement(\n Group,\n { opacity: Math.min(1, progress * 1.5) },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n const scale = 1 + 0.5 * progress\n return createElement(\n Group,\n { opacity: 1 - progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Morph: a soft scale-and-fade blend — the scenes ease through each other with a\n * gentle breathing scale. */\nexport function morph(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const scale = entering ? 0.94 + 0.06 * progress : 1 + 0.06 * progress\n return createElement(\n Group,\n { opacity: entering ? progress : 1 - progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Glass wipe: the incoming scene reveals behind a sweeping edge and blurs sharp\n * as the \"frosted panel\" passes (blur is the {@link blurStack} approximation). */\nexport function glassWipe({\n direction = 'from-left',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n const p = Math.min(1, Math.max(0, progress))\n const frosted = blurStack(children, (1 - p) * 18)\n switch (direction) {\n case 'from-top':\n return createElement(Group, { clip: clipRect(width, height * p) }, frosted)\n case 'from-right': {\n const w = width * p\n return createElement(\n Group,\n { x: width - w },\n createElement(Group, { x: -(width - w), clip: clipRect(w, height) }, frosted),\n )\n }\n case 'from-bottom': {\n const h = height * p\n return createElement(\n Group,\n { y: height - h },\n createElement(Group, { y: -(height - h), clip: clipRect(width, h) }, frosted),\n )\n }\n default:\n return createElement(Group, { clip: clipRect(width * p, height) }, frosted)\n }\n }\n}\n\n// Deterministic per-cell phase for the grid scatter (a hashed fract, stable\n// across renders — no Math.random, so the reveal is identical every frame).\nfunction cellPhase(i: number, j: number): number {\n const n = Math.sin(i * 12.9898 + j * 78.233) * 43758.5453\n return n - Math.floor(n)\n}\n\n/** Grid pixelate: the incoming scene fills in as a grid of blocks, each popping\n * on in a deterministic scatter (a blocky reveal — true pixelation needs an\n * engine sampling pass). */\nexport function gridPixelate({\n cols = 16,\n rows = 9,\n}: { cols?: number; rows?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n if (progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cw = width / cols\n const ch = height / rows\n let d = ''\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) {\n if (cellPhase(i, j) < progress) {\n const x = round(i * cw)\n const y = round(j * ch)\n d += `M ${x} ${y} L ${round(x + cw)} ${y} L ${round(x + cw)} ${round(y + ch)} L ${x} ${round(y + ch)} Z `\n }\n }\n }\n if (d === '') return createElement(Group, { opacity: 0 }, children)\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\n/** Type mask: the incoming scene reveals through a row of vertical bars that\n * widen into place — a typographic blinds reveal. */\nexport function typeMask({ bars = 12 }: { bars?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n if (progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const slot = width / bars\n const w = round(slot * Math.min(1, progress))\n let d = ''\n for (let i = 0; i < bars; i++) {\n const x = round(i * slot)\n d += `M ${x} 0 L ${round(x + w)} 0 L ${round(x + w)} ${round(height)} L ${x} ${round(height)} Z `\n }\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\n/** Alias of {@link fade} — Studio's \"cross-fade\" slug. */\nexport const crossFade = fade\n\n// ---------------------------------------------------------------------------\n// <TransitionSeries>\n// ---------------------------------------------------------------------------\n\nexport interface TransitionSeriesSequenceProps {\n durationInFrames: number\n children?: ReactNode\n}\n\nexport interface TransitionSeriesTransitionProps {\n presentation: TransitionPresentation\n timing: TransitionTiming\n}\n\n// Marker components; never rendered directly — <TransitionSeries> reads props.\nfunction TransitionSequence(_props: TransitionSeriesSequenceProps): ReactElement | null {\n return null\n}\nfunction TransitionTransition(_props: TransitionSeriesTransitionProps): ReactElement | null {\n return null\n}\n\n/** Renders one sequence's content with its entering/exiting presentations\n * applied, reading the (sequence-local) frame to compute progress. */\nfunction TransitionItem({\n duration,\n enter,\n exit,\n children,\n}: {\n duration: number\n enter?: { presentation: TransitionPresentation; timing: TransitionTiming }\n exit?: { presentation: TransitionPresentation; timing: TransitionTiming }\n children: ReactNode\n}): ReactElement {\n const frame = useCurrentFrame()\n const { fps, width, height } = useVideoConfig()\n\n let content: ReactNode = children\n if (exit) {\n const t = exit.timing.durationInFrames\n const start = duration - t\n const progress = frame >= start ? exit.timing.getProgress(frame - start, fps) : 0\n content = exit.presentation(content, { progress, entering: false, width, height })\n }\n if (enter) {\n const t = enter.timing.durationInFrames\n const progress = frame < t ? enter.timing.getProgress(frame, fps) : 1\n content = enter.presentation(content, { progress, entering: true, width, height })\n }\n return createElement(Group, null, content)\n}\n\nfunction TransitionSeriesRoot({ children }: { children?: ReactNode }): ReactElement {\n // Flatten children into an alternating [seq, (transition, seq)*] list.\n const items = Children.toArray(children).filter(isValidElement)\n const sequences: TransitionSeriesSequenceProps[] = []\n const transitions: (TransitionSeriesTransitionProps | null)[] = [] // transition AFTER sequence i\n\n for (const el of items) {\n if (el.type === TransitionSequence) {\n sequences.push(el.props as TransitionSeriesSequenceProps)\n transitions.push(null)\n } else if (el.type === TransitionTransition) {\n if (sequences.length === 0 || transitions[transitions.length - 1] != null) {\n throw new Error('<TransitionSeries.Transition> must sit between two sequences')\n }\n transitions[transitions.length - 1] = el.props as TransitionSeriesTransitionProps\n } else {\n throw new Error(\n '<TransitionSeries> children must be <TransitionSeries.Sequence> or .Transition',\n )\n }\n }\n\n // Place each sequence; a transition before a sequence overlaps it by its duration.\n let offset = 0\n const rendered: ReactElement[] = []\n for (const [i, seq] of sequences.entries()) {\n const before = i > 0 ? (transitions[i - 1] ?? null) : null\n const after = transitions[i] ?? null\n const enter = before ? { presentation: before.presentation, timing: before.timing } : undefined\n const exit = after ? { presentation: after.presentation, timing: after.timing } : undefined\n\n rendered.push(\n createElement(\n Sequence,\n { key: i, from: offset, durationInFrames: seq.durationInFrames },\n createElement(TransitionItem, {\n duration: seq.durationInFrames,\n enter,\n exit,\n // biome-ignore lint/correctness/noChildrenProp: raw createElement props object, not JSX\n children: seq.children,\n }),\n ),\n )\n\n offset += seq.durationInFrames - (after ? after.timing.durationInFrames : 0)\n }\n\n return createElement(Group, null, ...rendered)\n}\n\n/** Play sequences back-to-back with overlapping transitions between them. */\nexport const TransitionSeries = Object.assign(TransitionSeriesRoot, {\n Sequence: TransitionSequence,\n Transition: TransitionTransition,\n})\n","//! react-reconciler host config.\n//!\n//! ONDA's scene graph is a static snapshot, so this renderer just builds a\n//! mutable tree of [`HostNode`]s as React reconciles, which `reconciler.ts` then\n//! serializes once. Mutation mode; targets **react-reconciler 0.33 (React 19)**.\n\nimport { createContext } from 'react'\nimport type ReactReconciler from 'react-reconciler'\nimport { DefaultEventPriority } from 'react-reconciler/constants.js'\n\n/** An intermediate node built while reconciling, later mapped to a scene node. */\nexport interface HostNode {\n type: string\n props: Record<string, unknown>\n children: HostNode[]\n /** Text content, for `onda-text` (see `shouldSetTextContent`). */\n text?: string\n}\n\n/** The render target: holds the top-level element(s). */\nexport interface RootContainer {\n children: HostNode[]\n}\n\ntype Props = Record<string, unknown>\n// Must be NON-NULL: react-reconciler uses `null` as its internal NO_CONTEXT\n// sentinel, so returning `null` here trips \"Expected host context to exist\".\n// ONDA needs no host context, so a single shared empty object suffices.\ntype HostContext = Record<string, never>\nconst HOST_CONTEXT: HostContext = {}\ntype TimeoutHandle = ReturnType<typeof setTimeout>\n\n/** Flatten React text children (string/number, possibly nested arrays) to text. */\nfunction childrenToText(children: unknown): string {\n if (children == null || children === false || children === true) return ''\n if (Array.isArray(children)) return children.map(childrenToText).join('')\n if (typeof children === 'string') return children\n if (typeof children === 'number') return String(children)\n return ''\n}\n\n// react-reconciler 0.33 requires a host-transition context (React 19's <form>\n// action transitions). ONDA renders static frames — no transitions — so the\n// status is always null.\nconst HostTransitionContext = createContext<null>(null)\n\n// 0.33 replaced `getCurrentEventPriority` with explicit update-priority\n// tracking. A static one-shot render has no real event priority — track the\n// last set value and default to `DefaultEventPriority`.\nlet currentUpdatePriority: number = DefaultEventPriority\n\nexport const hostConfig: ReactReconciler.HostConfig<\n string, // Type\n Props, // Props\n RootContainer, // Container\n HostNode, // Instance\n HostNode, // TextInstance\n never, // SuspenseInstance\n never, // HydratableInstance\n never, // FormInstance\n HostNode, // PublicInstance\n HostContext, // HostContext\n never, // ChildSet\n TimeoutHandle, // TimeoutHandle\n -1, // NoTimeout\n null // TransitionStatus\n> = {\n supportsMutation: true,\n supportsPersistence: false,\n supportsHydration: false,\n isPrimaryRenderer: true,\n\n noTimeout: -1,\n scheduleTimeout: (fn, delay) => setTimeout(fn, delay),\n cancelTimeout: (handle) => clearTimeout(handle),\n\n createInstance(type, props) {\n const node: HostNode = { type, props, children: [] }\n if (type === 'onda-text') node.text = childrenToText(props.children)\n return node\n },\n\n createTextInstance(text) {\n return { type: '#text', props: {}, children: [], text }\n },\n\n appendInitialChild(parent, child) {\n parent.children.push(child)\n },\n finalizeInitialChildren() {\n return false\n },\n\n shouldSetTextContent(type) {\n return type === 'onda-text'\n },\n\n getRootHostContext() {\n return HOST_CONTEXT\n },\n getChildHostContext(parentContext) {\n return parentContext\n },\n getPublicInstance(instance) {\n return instance\n },\n\n prepareForCommit() {\n return null\n },\n resetAfterCommit() {},\n preparePortalMount() {},\n\n // 0.33: `prepareUpdate` is gone; `commitUpdate` receives the new props\n // directly (no diff payload) and applies them.\n commitUpdate(instance, type, _prevProps, nextProps) {\n instance.props = nextProps\n if (type === 'onda-text') instance.text = childrenToText(nextProps.children)\n },\n commitTextUpdate(textInstance, _oldText, newText) {\n textInstance.text = newText\n },\n resetTextContent() {},\n commitMount() {},\n\n appendChild(parent, child) {\n parent.children.push(child)\n },\n appendChildToContainer(container, child) {\n container.children.push(child)\n },\n insertBefore(parent, child, beforeChild) {\n const index = parent.children.indexOf(beforeChild)\n parent.children.splice(index < 0 ? parent.children.length : index, 0, child)\n },\n insertInContainerBefore(container, child, beforeChild) {\n const index = container.children.indexOf(beforeChild)\n container.children.splice(index < 0 ? container.children.length : index, 0, child)\n },\n removeChild(parent, child) {\n const index = parent.children.indexOf(child)\n if (index >= 0) parent.children.splice(index, 1)\n },\n removeChildFromContainer(container, child) {\n const index = container.children.indexOf(child)\n if (index >= 0) container.children.splice(index, 1)\n },\n clearContainer(container) {\n container.children.length = 0\n },\n\n getInstanceFromNode() {\n return null\n },\n beforeActiveInstanceBlur() {},\n afterActiveInstanceBlur() {},\n prepareScopeUpdate() {},\n getInstanceFromScope() {\n return null\n },\n detachDeletedInstance() {},\n\n // ── react-reconciler 0.33 (React 19) additions ─────────────────────────────\n // ONDA is a static, single-pass renderer with no suspense, forms, or\n // transitions, so these are inert (return the \"nothing pending / never\n // suspend / commit immediately\" answers).\n setCurrentUpdatePriority(newPriority) {\n currentUpdatePriority = newPriority\n },\n getCurrentUpdatePriority() {\n return currentUpdatePriority\n },\n resolveUpdatePriority() {\n return DefaultEventPriority\n },\n NotPendingTransition: null,\n // React's public `Context` type omits the internal fields (`_currentValue`,\n // `_threadCount`) the reconciler reads; the runtime object has them.\n // biome-ignore lint/suspicious/noExplicitAny: bridge React's public Context to the reconciler's ReactContext.\n HostTransitionContext: HostTransitionContext as any,\n resetFormInstance() {},\n requestPostPaintCallback() {},\n shouldAttemptEagerTransition() {\n return false\n },\n trackSchedulerEvent() {},\n resolveEventType() {\n return null\n },\n resolveEventTimeStamp() {\n return -1\n },\n maySuspendCommit() {\n return false\n },\n preloadInstance() {\n return true // already \"loaded\" — never suspends the commit\n },\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady() {\n return null // commit is always ready immediately\n },\n}\n","//! Render a React element tree into an ONDA scene graph.\n\nimport { type ReactElement, createElement } from 'react'\nimport Reconciler from 'react-reconciler'\nimport { type ClipInput, parseClip } from './clip.js'\nimport { type ColorInput, parseColor } from './color.js'\nimport { Composition, type CompositionProps, type TextRunInput } from './components.js'\nimport { FrameContext, type VideoConfig } from './frame.js'\nimport { type GradientInput, parseGradient } from './gradient.js'\nimport { type HostNode, type RootContainer, hostConfig } from './host-config.js'\nimport type {\n BooleanOp,\n BooleanOperand,\n Camera3D,\n Color,\n Effect,\n Extrude,\n Finish,\n Gradient,\n Layout,\n NodeKind,\n Scene,\n SceneNode,\n Shadow,\n ShapeGeometry,\n Stroke,\n Transform,\n Transform3D,\n} from './scene.js'\n\nconst reconciler = Reconciler(hostConfig)\n\n/** The frame context active during the current {@link renderFrame} pass\n * (`{ ...VideoConfig, frame }`). Captured here so {@link elementToNode} can\n * reconcile a `matte` prop-element under the SAME frame context as the main\n * tree — its hooks (`useCurrentFrame`/`useVideoConfig`) read the live frame, so\n * the matte animates per-frame just like the content. `null` outside a render. */\nlet activeFrameState: (VideoConfig & { frame: number }) | null = null\n\n/** Resolved depth-of-field for the comp being rendered (`<Composition dof={…}>`), or\n * `null`. Set per render so {@link toNode} can defocus any layer carrying a `depth`. */\nlet activeDof: { focus: number; aperture: number; range: number; maxBlur: number } | null = null\n\n/** Render `element` (root must be `<Composition>`) at `frame` to a static\n * {@link Scene}. Components read the frame via {@link useCurrentFrame}. */\nexport function renderFrame(element: ReactElement, frame: number): Scene {\n const config = videoConfig(element)\n const frameState = { ...config, frame }\n const prevFrameState = activeFrameState\n activeFrameState = frameState\n try {\n const container: RootContainer = { children: [] }\n const root = reconciler.createContainer(\n container,\n 0, // LegacyRoot — renders synchronously\n null, // hydrationCallbacks\n false, // isStrictMode\n null, // concurrentUpdatesByDefaultOverride\n '', // identifierPrefix\n (error: Error) => {\n throw error // onUncaughtError\n },\n (error: Error) => {\n throw error // onCaughtError\n },\n () => {}, // onRecoverableError — non-fatal (e.g. hydration); ignore\n () => {}, // onDefaultTransitionIndicator — no transitions in a static render\n )\n // React 19's reconciler no longer flushes the initial mount synchronously via\n // `updateContainer`; use the explicit sync API so ONDA can read the built tree\n // immediately after.\n reconciler.updateContainerSync(\n createElement(FrameContext.Provider, { value: frameState }, element),\n root,\n null,\n null,\n )\n reconciler.flushSyncWork()\n\n const top = container.children[0]\n if (container.children.length !== 1 || !top || top.type !== 'onda-composition') {\n throw new Error('render: the root element must be a single <Composition>')\n }\n const scene = compositionToScene(top)\n // Unmount (runs effect cleanups), synchronously.\n reconciler.updateContainerSync(null, root, null, null)\n reconciler.flushSyncWork()\n return scene\n } finally {\n activeFrameState = prevFrameState\n }\n}\n\n/** Render the composition once, at frame 0. */\nexport function renderToScene(element: ReactElement): Scene {\n return renderFrame(element, 0)\n}\n\n/** The MOTION BLUR config declared on `<Composition motionBlur={…}>`, normalised, or\n * `undefined` when off. `true` → a 180° shutter at 16 samples; `samples < 2` is off.\n * Exported so the export orchestration can pass the matching `--motion-blur K`. */\nexport function motionBlurConfig(\n element: ReactElement,\n): { shutter: number; samples: number } | undefined {\n const mb = (element.props as Record<string, unknown>).motionBlur\n if (!mb) return undefined\n if (mb === true) return { shutter: 180, samples: 16 }\n if (typeof mb !== 'object') return undefined\n const o = mb as { shutter?: number; samples?: number }\n const samples = typeof o.samples === 'number' ? Math.max(1, Math.round(o.samples)) : 16\n if (samples < 2) return undefined // a single sample is just the sharp frame\n const shutter = typeof o.shutter === 'number' ? Math.min(720, Math.max(1, o.shutter)) : 180\n return { shutter, samples }\n}\n\n/** The scene(s) for ONE output frame: a single render normally, or `samples`\n * sub-frames spread symmetrically across the shutter window when motion blur is on\n * (the CLI's `--motion-blur K` averages each group of K back into one frame). */\nfunction outputFrameScenes(\n element: ReactElement,\n frame: number,\n mb: { shutter: number; samples: number } | undefined,\n): Scene[] {\n if (!mb) return [renderFrame(element, frame)]\n const shutterFrames = mb.shutter / 360 // shutter-open time, in frames\n const scenes: Scene[] = []\n for (let i = 0; i < mb.samples; i++) {\n const t = ((i + 0.5) / mb.samples - 0.5) * shutterFrames\n scenes.push(renderFrame(element, frame + t))\n }\n return scenes\n}\n\n/** Render every frame `0..durationInFrames` to static scenes. With\n * `<Composition motionBlur>`, each frame expands to `samples` sub-frame scenes for\n * the CLI to average (so the array length is `durationInFrames × samples`). */\nexport function renderFrames(element: ReactElement): Scene[] {\n const { durationInFrames } = videoConfig(element)\n const mb = motionBlurConfig(element)\n const frames: Scene[] = []\n for (let frame = 0; frame < durationInFrames; frame++) {\n frames.push(...outputFrameScenes(element, frame, mb))\n }\n return frames\n}\n\n/** Render a sub-range `[startFrame, endFrame)` to static scenes.\n * The returned array starts at index 0; the scenes carry the original frame\n * numbers so `useCurrentFrame()` reads the correct composition time. Motion blur\n * expands each frame to `samples` sub-frames, exactly like {@link renderFrames}. */\nexport function renderFramesRange(\n element: ReactElement,\n startFrame: number,\n endFrame: number,\n): Scene[] {\n const mb = motionBlurConfig(element)\n const frames: Scene[] = []\n for (let frame = startFrame; frame < endFrame; frame++) {\n frames.push(...outputFrameScenes(element, frame, mb))\n }\n return frames\n}\n\n/** Render frame 0 to a JSON string (for `onda render`). */\nexport function renderToSceneJSON(element: ReactElement, space = 2): string {\n return JSON.stringify(renderToScene(element), null, space)\n}\n\n/** Render all frames to a JSON array of scenes (for `onda export-frames`). */\nexport function renderFramesJSON(element: ReactElement, space = 0): string {\n return JSON.stringify(renderFrames(element), null, space)\n}\n\n/** Render a sub-range `[startFrame, endFrame)` to a JSON array (for `onda export-frames`).\n * Produces a short clip covering only those frames — useful for fast scene-level iteration. */\nexport function renderFrameRangeJSON(\n element: ReactElement,\n startFrame: number,\n endFrame: number,\n space = 0,\n): string {\n return JSON.stringify(renderFramesRange(element, startFrame, endFrame), null, space)\n}\n\nfunction videoConfig(element: ReactElement): VideoConfig {\n if (element.type !== Composition) {\n throw new Error('render: the root element must be a <Composition>')\n }\n const props = element.props as Record<string, unknown>\n return {\n width: numberProp(props, 'width', 'Composition'),\n height: numberProp(props, 'height', 'Composition'),\n fps: numberProp(props, 'fps', 'Composition'),\n durationInFrames: numberProp(props, 'durationInFrames', 'Composition'),\n }\n}\n\n/** Build a scene-level {@link Finish} from the `<Composition finish={...}>` prop —\n * pass through the numeric fields, dropping anything malformed so a bad value can't\n * corrupt the scene JSON (validate at the boundary). */\nfunction parseFinish(f: NonNullable<CompositionProps['finish']>): Finish {\n const out: Finish = {}\n if (typeof f.exposure === 'number') out.exposure = f.exposure\n if (f.bloom && typeof f.bloom.sigma === 'number') {\n out.bloom = { sigma: f.bloom.sigma }\n if (typeof f.bloom.threshold === 'number') out.bloom.threshold = f.bloom.threshold\n if (typeof f.bloom.intensity === 'number') out.bloom.intensity = f.bloom.intensity\n }\n if (typeof f.halation === 'number') out.halation = f.halation\n if (typeof f.temperature === 'number') out.temperature = f.temperature\n if (typeof f.contrast === 'number') out.contrast = f.contrast\n if (typeof f.saturation === 'number') out.saturation = f.saturation\n if (typeof f.vignette === 'number') out.vignette = f.vignette\n if (typeof f.grain === 'number' && f.grain > 0) {\n out.grain = f.grain\n // Inject the current frame as the seed so grain *lives* (varies per frame).\n out.grain_seed = activeFrameState?.frame ?? 0\n }\n // A 3D color LUT — only if well-formed (size ≥ 2 and `table` holds exactly\n // size³ RGB triples). A malformed cube is dropped at the boundary so the\n // renderer never trilinear-samples out of bounds.\n if (\n f.lut &&\n typeof f.lut.size === 'number' &&\n f.lut.size >= 2 &&\n Array.isArray(f.lut.table) &&\n f.lut.table.length === f.lut.size ** 3 * 3\n ) {\n out.lut = { size: f.lut.size, table: f.lut.table }\n }\n return out\n}\n\n/** Resolve the `<Composition dof={…}>` prop (depth of field) with defaults, or null. */\nfunction parseDof(\n dof: CompositionProps['dof'],\n): { focus: number; aperture: number; range: number; maxBlur: number } | null {\n if (!dof || typeof dof.focus !== 'number') return null\n return {\n focus: dof.focus,\n aperture: typeof dof.aperture === 'number' ? dof.aperture : 0.04,\n range: typeof dof.range === 'number' ? dof.range : 0,\n maxBlur: typeof dof.maxBlur === 'number' ? dof.maxBlur : 40,\n }\n}\n\n/** Blur σ (px) for a layer at `depth` under the active depth of field — a circle of\n * confusion that grows linearly with distance from the in-focus band. */\nfunction dofBlur(depth: number, dof: NonNullable<ReturnType<typeof parseDof>>): number {\n const dist = Math.max(0, Math.abs(depth - dof.focus) - dof.range)\n return Math.min(dist * dof.aperture, dof.maxBlur)\n}\n\nfunction isVec3(v: unknown): v is [number, number, number] {\n return Array.isArray(v) && v.length === 3 && v.every((n) => typeof n === 'number')\n}\nfunction isVec2(v: unknown): v is [number, number] {\n return Array.isArray(v) && v.length === 2 && v.every((n) => typeof n === 'number')\n}\n\n/** Resolve a `<Scene3D camera>` prop into a scene `Camera3D`, keeping only set fields\n * (the engine derives the rest to frame the z = 0 plane). */\nfunction parseCamera3D(input: unknown): Camera3D {\n const c = (input ?? {}) as Record<string, unknown>\n const out: Camera3D = {}\n if (isVec3(c.position)) out.position = c.position\n if (isVec3(c.target)) out.target = c.target\n if (isVec3(c.up)) out.up = c.up\n if (typeof c.fov === 'number') out.fov = c.fov\n if (typeof c.near === 'number') out.near = c.near\n if (typeof c.far === 'number') out.far = c.far\n return out\n}\n\n/** Resolve a layer's `extrude` prop (a `depth` number or `{ depth }`) into an\n * `Extrude`, or null when absent / non-positive. */\nfunction parseExtrude(input: unknown): Extrude | null {\n if (typeof input === 'number') return input > 0 ? { depth: input } : null\n if (input && typeof input === 'object') {\n const d = (input as { depth?: unknown }).depth\n if (typeof d === 'number' && d > 0) return { depth: d }\n }\n return null\n}\n\n/** Build a layer's `Transform3D` from its `position3d`/`rotation3d`/`anchor3d` props,\n * or null when the layer carries none (so it serializes only where used). */\nfunction parseTransform3D(props: Record<string, unknown>): Transform3D | null {\n const { position3d, rotation3d, anchor3d } = props\n if (!isVec3(position3d) && !isVec3(rotation3d) && !isVec2(anchor3d)) return null\n const out: Transform3D = {}\n if (isVec3(position3d)) out.position = position3d\n if (isVec3(rotation3d)) out.rotation = rotation3d\n if (isVec2(anchor3d)) out.anchor = anchor3d\n return out\n}\n\nfunction compositionToScene(node: HostNode): Scene {\n const { props } = node\n // Depth of field: read by every descendant's `toNode` via the module-level activeDof.\n activeDof = parseDof(props.dof as CompositionProps['dof'])\n const children = node.children.length ? node.children.map(toNode) : null\n activeDof = null\n return {\n composition: {\n width: numberProp(props, 'width', 'Composition'),\n height: numberProp(props, 'height', 'Composition'),\n fps: numberProp(props, 'fps', 'Composition'),\n duration_in_frames: numberProp(props, 'durationInFrames', 'Composition'),\n // Opt-in cinematic LINEAR + ACES finishing (gpu/export only); omitted (→ gamma)\n // unless explicitly enabled, so existing scenes stay byte-identical.\n ...(props.linear === true ? { linear: true } : {}),\n // Composition-level cinematic FINISH (linear-HDR chain + ACES); omitted unless set.\n ...(props.finish ? { finish: parseFinish(props.finish) } : {}),\n },\n root: {\n kind: { type: 'group' },\n ...(children ? { children } : {}),\n },\n }\n}\n\n/** Reconcile a SINGLE prop-element (e.g. a `matte` subtree) into one\n * {@link SceneNode}. Mirrors {@link renderFrame}'s machinery — create a fresh\n * container, render the element, flush synchronously, take the single root host\n * child, and {@link toNode} it — but for one element rather than a whole tree.\n *\n * The element is wrapped in the SAME {@link FrameContext} as the main tree (the\n * module-level {@link activeFrameState}, set by the enclosing `renderFrame`), so\n * its hooks (`useCurrentFrame`/`useVideoConfig`) read the live frame and the\n * matte ANIMATES per-frame — `renderFrames` re-runs this for every frame. The\n * prop-element must resolve to exactly one root host node (e.g. a single\n * `<Text>`/`<Rect>`/`<Group>`); wrap multiple nodes in a `<Group>`. */\nfunction elementToNode(element: ReactElement): SceneNode {\n const container: RootContainer = { children: [] }\n const root = reconciler.createContainer(\n container,\n 0, // LegacyRoot — renders synchronously\n null,\n false,\n null,\n '',\n (error: Error) => {\n throw error\n },\n (error: Error) => {\n throw error\n },\n () => {},\n () => {},\n )\n // Reconcile under the active frame context so the matte animates per-frame.\n const wrapped = activeFrameState\n ? createElement(FrameContext.Provider, { value: activeFrameState }, element)\n : element\n reconciler.updateContainerSync(wrapped, root, null, null)\n reconciler.flushSyncWork()\n const top = container.children[0]\n if (container.children.length !== 1 || !top) {\n throw new Error(\n 'matte: the matte element must resolve to a single node (wrap many in a <Group>)',\n )\n }\n const node = toNode(top)\n reconciler.updateContainerSync(null, root, null, null)\n reconciler.flushSyncWork()\n return node\n}\n\nfunction toNode(node: HostNode): SceneNode {\n const { props } = node\n const base: Omit<SceneNode, 'kind'> = {}\n if (typeof props.id === 'number') base.id = props.id\n const transform = transformOf(props)\n if (transform) base.transform = transform\n if (typeof props.opacity === 'number') base.opacity = props.opacity\n if (props.clip !== undefined) base.clip = parseClip(props.clip as ClipInput)\n if (props.matte !== undefined) {\n base.matte = {\n mode: props.matteMode === 'luminance' ? 'luminance' : 'alpha',\n source: elementToNode(props.matte as ReactElement),\n }\n }\n if (typeof props.blendMode === 'string') base.blend = props.blendMode as SceneNode['blend']\n const effects: Effect[] = Array.isArray(props.effects) ? [...(props.effects as Effect[])] : []\n if (typeof props.blur === 'number' && props.blur > 0)\n effects.unshift({ effect: 'blur', sigma: props.blur })\n const directionalBlur = parseDirectionalBlur(props.directionalBlur)\n if (directionalBlur) effects.unshift(directionalBlur)\n const chromaticAberration = parseChromaticAberration(props.chromaticAberration)\n if (chromaticAberration) effects.push(chromaticAberration)\n const vignette = parseVignette(props.vignette)\n if (vignette) effects.push(vignette)\n const posterize = parsePosterize(props.posterize)\n if (posterize) effects.push(posterize)\n const duotone = parseDuotone(props.duotone)\n if (duotone) effects.push(duotone)\n const chromaKey = parseChromaKey(props.chromaKey)\n if (chromaKey) effects.push(chromaKey)\n const bloom = parseBloom(props.bloom)\n if (bloom) effects.push(bloom)\n const grade = parseGrade(props.grade)\n if (grade) effects.push(grade)\n const goo = parseGoo(props.goo)\n if (goo) effects.push(goo)\n const grain = parseGrain(props.grain)\n if (grain) effects.push(grain)\n const backdropBlur = parseBackdropBlur(props.backdropBlur)\n if (backdropBlur) effects.push(backdropBlur)\n const lightWrap = parseLightWrap(props.lightWrap)\n if (lightWrap) effects.push(lightWrap)\n // Depth of field: a layer carrying `depth` defocuses by its distance from the comp's\n // focus plane — a per-layer blur, so a rack focus is just animating the comp's `focus`.\n if (activeDof && typeof props.depth === 'number') {\n const sigma = dofBlur(props.depth, activeDof)\n if (sigma > 0.4) effects.unshift({ effect: 'blur', sigma })\n }\n if (effects.length) base.effects = effects\n // 3D: a `camera3d` prop makes this node a 3D scene root; `position3d`/`rotation3d`/\n // `anchor3d` place this node as a layer inside an ancestor 3D scene.\n if (props.camera3d !== undefined) base.camera3d = parseCamera3D(props.camera3d)\n const transform3d = parseTransform3D(props)\n if (transform3d) base.transform3d = transform3d\n const extrude = parseExtrude(props.extrude)\n if (extrude) base.extrude = extrude\n if (props.layout !== undefined) base.layout = parseLayout(props.layout as Layout)\n const children = node.children.map(toNode)\n const withChildren = children.length ? { children } : {}\n\n switch (node.type) {\n case 'onda-group':\n return { ...base, kind: { type: 'group' }, ...withChildren }\n\n case 'onda-rect': {\n const geometry: ShapeGeometry = {\n shape: 'rect',\n size: {\n width: numberProp(props, 'width', 'Rect'),\n height: numberProp(props, 'height', 'Rect'),\n },\n ...(typeof props.cornerRadius === 'number' ? { corner_radius: props.cornerRadius } : {}),\n }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-ellipse': {\n const geometry: ShapeGeometry = {\n shape: 'ellipse',\n size: {\n width: numberProp(props, 'width', 'Ellipse'),\n height: numberProp(props, 'height', 'Ellipse'),\n },\n }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-path': {\n const geometry: ShapeGeometry = { shape: 'path', data: stringProp(props, 'd', 'Path') }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-boolean': {\n const op: BooleanOp =\n props.op === 'difference' || props.op === 'intersect' || props.op === 'xor'\n ? props.op\n : 'union'\n // Fold the (already-built) shape children into operands — geometry + the child's\n // own transform. They're consumed by the boolean, not drawn separately, so the\n // result is a single shape node with no children.\n const operands: BooleanOperand[] = []\n for (const c of children) {\n if (c.kind.type === 'shape') {\n operands.push({ geometry: c.kind.geometry, transform: c.transform ?? {} })\n }\n }\n const geometry: ShapeGeometry = { shape: 'boolean', op, operands }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) } }\n }\n\n case 'onda-text': {\n const kind: Extract<NodeKind, { type: 'text' }> = {\n type: 'text',\n content: node.text ?? '',\n ...(typeof props.fontSize === 'number' ? { font_size: props.fontSize } : {}),\n ...(props.color !== undefined ? { color: parseColor(props.color as never) } : {}),\n ...(typeof props.fontFamily === 'string' ? { font_family: props.fontFamily } : {}),\n ...(typeof props.fontWeight === 'number' ? { weight: props.fontWeight } : {}),\n ...(props.italic === true ? { italic: true } : {}),\n ...(typeof props.letterSpacing === 'number' ? { letter_spacing: props.letterSpacing } : {}),\n }\n if (Array.isArray(props.runs)) {\n kind.runs = (props.runs as TextRunInput[]).map((r) => ({\n text: r.text,\n ...(r.color !== undefined ? { color: parseColor(r.color) } : {}),\n ...(typeof r.fontSize === 'number' ? { font_size: r.fontSize } : {}),\n ...(typeof r.fontFamily === 'string' ? { font_family: r.fontFamily } : {}),\n ...(typeof r.fontWeight === 'number' ? { weight: r.fontWeight } : {}),\n ...(r.italic === true ? { italic: true } : {}),\n }))\n }\n return { ...base, kind, ...withChildren }\n }\n\n case 'onda-image':\n return {\n ...base,\n kind: {\n type: 'image',\n src: stringProp(props, 'src', 'Image'),\n ...(typeof props.width === 'number' ? { width: props.width } : {}),\n ...(typeof props.height === 'number' ? { height: props.height } : {}),\n ...(props.fit === 'fill' || props.fit === 'cover' || props.fit === 'contain'\n ? { fit: props.fit }\n : {}),\n ...(typeof props.blur === 'number' && props.blur > 0 ? { blur: props.blur } : {}),\n },\n ...withChildren,\n }\n\n case 'onda-video':\n return {\n ...base,\n kind: {\n type: 'video',\n src: stringProp(props, 'src', 'Video'),\n ...(typeof props.time === 'number' ? { time: props.time } : {}),\n ...(typeof props.width === 'number' ? { width: props.width } : {}),\n ...(typeof props.height === 'number' ? { height: props.height } : {}),\n ...(props.fit === 'fill' || props.fit === 'cover' || props.fit === 'contain'\n ? { fit: props.fit }\n : {}),\n ...(props.previewFallback === 'element' || props.previewFallback === 'skip'\n ? { previewFallback: props.previewFallback }\n : {}),\n },\n ...withChildren,\n }\n\n case 'onda-audio':\n return {\n ...base,\n kind: {\n type: 'audio',\n src: stringProp(props, 'src', 'Audio'),\n ...(typeof props.start === 'number' ? { start: props.start } : {}),\n ...(typeof props.startAt === 'number' ? { start_at: props.startAt } : {}),\n ...(typeof props.volume === 'number' ? { volume: props.volume } : {}),\n },\n ...withChildren,\n }\n\n case 'onda-svg': {\n if (typeof props.src !== 'string' && typeof props.markup !== 'string') {\n throw new Error(\"<Svg> requires a 'src' or 'markup' prop\")\n }\n return {\n ...base,\n kind: {\n type: 'svg',\n ...(typeof props.src === 'string' ? { src: props.src } : {}),\n ...(typeof props.markup === 'string' ? { markup: props.markup } : {}),\n },\n ...withChildren,\n }\n }\n\n case '#text':\n throw new Error(\n `renderToScene: raw text \"${String(node.text ?? '').slice(0, 60)}\" was placed inside a non-Text node. String children are only valid inside <Text>. Wrap it: h(Text, { x, y, fontSize, color }, '${String(node.text ?? '').slice(0, 30)}')`,\n )\n\n default:\n throw new Error(\n `renderToScene: unsupported element type \"${node.type}\". Only ONDA primitives (Group/Rect/Ellipse/Path/Text/Image/Video/Svg) are valid. DOM elements like <div>/<span> and custom types are not rendered — use @onda-engine/react primitives only.`,\n )\n }\n}\n\nfunction transformOf(props: Record<string, unknown>): Transform | undefined {\n const transform: Transform = {}\n if (typeof props.x === 'number' || typeof props.y === 'number') {\n transform.translate = { x: (props.x as number) ?? 0, y: (props.y as number) ?? 0 }\n }\n if (typeof props.scaleX === 'number' || typeof props.scaleY === 'number') {\n transform.scale = { x: (props.scaleX as number) ?? 1, y: (props.scaleY as number) ?? 1 }\n }\n if (typeof props.rotation === 'number') {\n transform.rotate = props.rotation\n }\n if (typeof props.originX === 'number' || typeof props.originY === 'number') {\n transform.origin = { x: (props.originX as number) ?? 0, y: (props.originY as number) ?? 0 }\n }\n return transform.translate ||\n transform.scale ||\n transform.rotate !== undefined ||\n transform.origin\n ? transform\n : undefined\n}\n\n// Tolerate CSS flexbox spellings on justify/align. The engine's layout enum is\n// `start | center | end` (+ `space-*` for justify), but components ported from\n// the browser — and agent payloads written against CSS — use `flex-start` /\n// `flex-end` / edge words. Normalize here, at the single layout→scene boundary,\n// so every node is forgiving rather than failing scene-graph deserialization.\nconst ALIGN_ALIASES: Record<string, string> = {\n 'flex-start': 'start',\n 'flex-end': 'end',\n left: 'start',\n top: 'start',\n right: 'end',\n bottom: 'end',\n middle: 'center',\n 'space-evenly': 'space-around',\n}\nconst normAlign = (v: unknown): unknown =>\n typeof v === 'string' && v in ALIGN_ALIASES ? ALIGN_ALIASES[v] : v\n\n/** Copy the defined layout fields (names/values already match the scene JSON). */\n/** Resolve the `bloom` sugar prop into a `{ effect: 'bloom', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `sigma`; the object\n * form overrides `threshold` (default 0.7) / `intensity` (default 1). */\n/** Resolve the `directionalBlur` sugar prop into a `{ effect: 'directional_blur', … }`\n * effect, or `undefined` when absent / non-positive sigma. `angle` (radians)\n * defaults to 0 (horizontal). */\nfunction parseDirectionalBlur(\n input: unknown,\n): Extract<Effect, { effect: 'directional_blur' }> | undefined {\n if (input && typeof input === 'object') {\n const d = input as { sigma?: number; angle?: number }\n if (typeof d.sigma === 'number' && d.sigma > 0) {\n return {\n effect: 'directional_blur',\n sigma: d.sigma,\n angle: typeof d.angle === 'number' ? d.angle : 0,\n }\n }\n }\n return undefined\n}\n\nfunction parseChromaticAberration(\n input: unknown,\n): Extract<Effect, { effect: 'chromatic_aberration' }> | undefined {\n return typeof input === 'number' && input > 0\n ? { effect: 'chromatic_aberration', amount: input }\n : undefined\n}\n\nfunction parseVignette(input: unknown): Extract<Effect, { effect: 'vignette' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'vignette', amount: input, softness: 0.5 } : undefined\n }\n if (input && typeof input === 'object') {\n const v = input as { amount?: number; softness?: number }\n if (typeof v.amount === 'number' && v.amount > 0) {\n return {\n effect: 'vignette',\n amount: v.amount,\n softness: typeof v.softness === 'number' ? v.softness : 0.5,\n }\n }\n }\n return undefined\n}\n\nfunction parsePosterize(input: unknown): Extract<Effect, { effect: 'posterize' }> | undefined {\n return typeof input === 'number' && input >= 2\n ? { effect: 'posterize', levels: input }\n : undefined\n}\n\nfunction parseDuotone(input: unknown): Extract<Effect, { effect: 'duotone' }> | undefined {\n if (input && typeof input === 'object') {\n const d = input as { shadow?: ColorInput; highlight?: ColorInput }\n if (d.shadow !== undefined && d.highlight !== undefined) {\n const s = parseColor(d.shadow)\n const h = parseColor(d.highlight)\n return { effect: 'duotone', shadow: [s.r, s.g, s.b], highlight: [h.r, h.g, h.b] }\n }\n }\n return undefined\n}\n\nfunction parseChromaKey(input: unknown): Extract<Effect, { effect: 'chroma_key' }> | undefined {\n if (input && typeof input === 'object') {\n const c = input as { color?: ColorInput; threshold?: number; smoothness?: number }\n if (c.color !== undefined) {\n const k = parseColor(c.color)\n return {\n effect: 'chroma_key',\n key: [k.r, k.g, k.b],\n threshold: typeof c.threshold === 'number' ? c.threshold : 0.4,\n smoothness: typeof c.smoothness === 'number' ? c.smoothness : 0.1,\n }\n }\n }\n return undefined\n}\n\nfunction parseBloom(input: unknown): Extract<Effect, { effect: 'bloom' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'bloom', threshold: 0.7, intensity: 1, sigma: input } : undefined\n }\n if (input && typeof input === 'object') {\n const b = input as { sigma?: number; threshold?: number; intensity?: number }\n if (typeof b.sigma === 'number' && b.sigma > 0) {\n return {\n effect: 'bloom',\n threshold: typeof b.threshold === 'number' ? b.threshold : 0.7,\n intensity: typeof b.intensity === 'number' ? b.intensity : 1,\n sigma: b.sigma,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `grade` sugar prop into a `{ effect: 'color_grade', ... }` effect,\n * or `undefined` when absent or a neutral identity (which would be a render\n * no-op). Each field defaults to the neutral identity (exposure 0, contrast 1,\n * saturation 1, temperature 0, tint 0). */\nfunction parseGrade(input: unknown): Extract<Effect, { effect: 'color_grade' }> | undefined {\n if (!input || typeof input !== 'object') return undefined\n const g = input as {\n exposure?: number\n contrast?: number\n saturation?: number\n temperature?: number\n tint?: number\n }\n const exposure = typeof g.exposure === 'number' ? g.exposure : 0\n const contrast = typeof g.contrast === 'number' ? g.contrast : 1\n const saturation = typeof g.saturation === 'number' ? g.saturation : 1\n const temperature = typeof g.temperature === 'number' ? g.temperature : 0\n const tint = typeof g.tint === 'number' ? g.tint : 0\n // The neutral identity is a no-op — omit it so a plain `grade={{}}` stays a\n // zero-diff (matching the engine's neutral fast path).\n if (exposure === 0 && contrast === 1 && saturation === 1 && temperature === 0 && tint === 0) {\n return undefined\n }\n return { effect: 'color_grade', exposure, contrast, saturation, temperature, tint }\n}\n\n/** Resolve the `goo` sugar prop into a `{ effect: 'goo', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `sigma`; the object\n * form overrides `threshold` (default 0.5). A non-positive `sigma` is dropped\n * (no blur → nothing to fuse). */\nfunction parseGoo(input: unknown): Extract<Effect, { effect: 'goo' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'goo', sigma: input, threshold: 0.5 } : undefined\n }\n if (input && typeof input === 'object') {\n const g = input as { sigma?: number; threshold?: number }\n if (typeof g.sigma === 'number' && g.sigma > 0) {\n return {\n effect: 'goo',\n sigma: g.sigma,\n threshold: typeof g.threshold === 'number' ? g.threshold : 0.5,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `grain` sugar prop into a `{ effect: 'grain', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `intensity`; the object\n * form adds `size` (grain scale in px, default 1) and `seed` (animation offset,\n * default 0). A non-positive `intensity` is dropped (no grain to add). */\nfunction parseGrain(input: unknown): Extract<Effect, { effect: 'grain' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'grain', intensity: input, size: 1, seed: 0 } : undefined\n }\n if (input && typeof input === 'object') {\n const g = input as { intensity?: number; size?: number; seed?: number }\n if (typeof g.intensity === 'number' && g.intensity > 0) {\n return {\n effect: 'grain',\n intensity: g.intensity,\n size: typeof g.size === 'number' ? g.size : 1,\n seed: typeof g.seed === 'number' ? g.seed : 0,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `backdropBlur` sugar prop into a `{ effect: 'backdrop_blur', ... }`\n * effect, or `undefined` when absent/degenerate. A bare number is the `sigma`; the\n * object form adds a `tint` (any {@link ColorInput} — its alpha is the strength),\n * a `brightness` and a `saturation` (both default to the `1` identity). An omitted\n * tint emits transparent `{r:0,g:0,b:0,a:0}`. A non-positive `sigma` is dropped (no\n * blur → nothing to frost). */\nfunction parseBackdropBlur(\n input: unknown,\n): Extract<Effect, { effect: 'backdrop_blur' }> | undefined {\n const TRANSPARENT: Color = { r: 0, g: 0, b: 0, a: 0 }\n if (typeof input === 'number') {\n return input > 0\n ? { effect: 'backdrop_blur', sigma: input, tint: TRANSPARENT, brightness: 1, saturation: 1 }\n : undefined\n }\n if (input && typeof input === 'object') {\n const b = input as {\n sigma?: number\n tint?: ColorInput\n brightness?: number\n saturation?: number\n }\n if (typeof b.sigma === 'number' && b.sigma > 0) {\n return {\n effect: 'backdrop_blur',\n sigma: b.sigma,\n tint: b.tint !== undefined ? parseColor(b.tint) : TRANSPARENT,\n brightness: typeof b.brightness === 'number' ? b.brightness : 1,\n saturation: typeof b.saturation === 'number' ? b.saturation : 1,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `lightWrap` sugar prop into a `{ effect: 'light_wrap', ... }` effect,\n * or `undefined` when absent/degenerate. A bare number is the `sigma` (backdrop\n * blur / rim width); the object form adds a `strength` (defaults to the `1` natural\n * spill). A non-positive `sigma` is dropped (no spill → nothing to wrap). */\nfunction parseLightWrap(input: unknown): Extract<Effect, { effect: 'light_wrap' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'light_wrap', sigma: input, strength: 1 } : undefined\n }\n if (input && typeof input === 'object') {\n const w = input as { sigma?: number; strength?: number }\n if (typeof w.sigma === 'number' && w.sigma > 0) {\n return {\n effect: 'light_wrap',\n sigma: w.sigma,\n strength: typeof w.strength === 'number' ? w.strength : 1,\n }\n }\n }\n return undefined\n}\n\nfunction parseLayout(layout: Layout): Layout {\n const out: Layout = {}\n if (layout.direction !== undefined) out.direction = layout.direction\n if (layout.justify !== undefined) out.justify = normAlign(layout.justify) as Layout['justify']\n if (layout.align !== undefined) out.align = normAlign(layout.align) as Layout['align']\n if (typeof layout.gap === 'number') out.gap = layout.gap\n if (typeof layout.padding === 'number') out.padding = layout.padding\n if (layout.wrap === true) out.wrap = true\n if (typeof layout.width === 'number') out.width = layout.width\n if (typeof layout.height === 'number') out.height = layout.height\n return out\n}\n\nfunction fillStroke(props: Record<string, unknown>): {\n fill?: ReturnType<typeof parseColor>\n gradient?: Gradient\n stroke?: Stroke\n shadow?: Shadow\n} {\n const out: {\n fill?: ReturnType<typeof parseColor>\n gradient?: Gradient\n stroke?: Stroke\n shadow?: Shadow\n } = {}\n if (props.fill !== undefined) out.fill = parseColor(props.fill as never)\n if (props.gradient !== undefined) out.gradient = parseGradient(props.gradient as GradientInput)\n const sh = props.shadow as\n | { color: unknown; blur?: number; offsetX?: number; offsetY?: number; spread?: number }\n | undefined\n if (sh && typeof sh.blur === 'number') {\n out.shadow = {\n color: parseColor(sh.color as never),\n blur: sh.blur,\n ...(typeof sh.offsetX === 'number' || typeof sh.offsetY === 'number'\n ? { offset: { x: sh.offsetX ?? 0, y: sh.offsetY ?? 0 } }\n : {}),\n ...(typeof sh.spread === 'number' ? { spread: sh.spread } : {}),\n }\n }\n if (props.stroke !== undefined) {\n const trim = parseTrim(props)\n out.stroke = {\n color: parseColor(props.stroke as never),\n width: typeof props.strokeWidth === 'number' ? props.strokeWidth : 1,\n ...(props.strokeCap === 'round' || props.strokeCap === 'square'\n ? { cap: props.strokeCap }\n : {}),\n ...(props.strokeJoin === 'round' || props.strokeJoin === 'bevel'\n ? { join: props.strokeJoin }\n : {}),\n ...(Array.isArray(props.strokeDash) && props.strokeDash.length\n ? { dash: props.strokeDash as number[] }\n : {}),\n ...(typeof props.strokeDashOffset === 'number'\n ? { dash_offset: props.strokeDashOffset }\n : {}),\n ...(trim ? { trim } : {}),\n }\n }\n return out\n}\n\n/** Resolve the `trimStart`/`trimEnd`/`trimOffset` props into a stroke {@link Stroke.trim}\n * (the mograph line-draw), or `undefined` when none is set. */\nfunction parseTrim(props: Record<string, unknown>): Stroke['trim'] | undefined {\n const { trimStart, trimEnd, trimOffset } = props\n if (\n typeof trimStart !== 'number' &&\n typeof trimEnd !== 'number' &&\n typeof trimOffset !== 'number'\n ) {\n return undefined\n }\n const trim: NonNullable<Stroke['trim']> = {}\n if (typeof trimStart === 'number') trim.start = trimStart\n if (typeof trimEnd === 'number') trim.end = trimEnd\n if (typeof trimOffset === 'number') trim.offset = trimOffset\n return trim\n}\n\nfunction numberProp(props: Record<string, unknown>, key: string, ctx: string): number {\n const value = props[key]\n if (typeof value !== 'number') throw new Error(`<${ctx}> requires a numeric '${key}' prop`)\n return value\n}\n\nfunction stringProp(props: Record<string, unknown>, key: string, ctx: string): string {\n const value = props[key]\n if (typeof value !== 'string') throw new Error(`<${ctx}> requires a string '${key}' prop`)\n return value\n}\n","//! Font registry — the single source for a composition's custom fonts.\n//!\n//! An author declares a font ONCE (via `@onda-engine/components`' `loadFont`, which loads\n//! it into the author-time measurement engine AND calls `registerFont` here). The\n//! render harness (`@onda-engine/render`) then drains this registry, materializes the\n//! bytes to temp files, and hands them to the `onda` CLI (`--font`) — so the font\n//! used to MEASURE the text (glyph placement) is the same one the renderer DRAWS,\n//! with no separate flag. Same hub pattern as the engine-warmer registry: bytes\n//! flow through `@onda-engine/react`, so neither `@onda-engine/components` nor `@onda-engine/render`\n//! depends on the other.\n\nconst fonts: Uint8Array[] = []\nconst seen = new Set<string>()\n\n/** A content signature so re-declaring the same font is a no-op. FNV-1a over all\n * bytes — O(n), but this runs once per `loadFont` (not per frame), and a full\n * hash (vs sampled bytes) means two distinct fonts never collide. */\nfunction signature(data: Uint8Array): string {\n let h = 0x811c9dc5\n for (let i = 0; i < data.length; i++) {\n h ^= data[i] as number\n h = Math.imul(h, 0x01000193)\n }\n return `${data.length}:${h >>> 0}`\n}\n\n/** Retain font bytes so the render harness can pass them to the renderer. Deduped\n * by content signature — declaring the same font twice is harmless. Synchronous\n * and independent of any async engine load, so the bytes are registered the\n * instant `loadFont` is called, even before the wasm measurement engine warms. */\nexport function registerFont(data: Uint8Array): void {\n const sig = signature(data)\n if (seen.has(sig)) return\n seen.add(sig)\n fonts.push(data)\n}\n\n/** A snapshot of the fonts declared so far — for the render harness to write out\n * and pass to the CLI. Callers receive a copy and must not mutate the registry. */\nexport function registeredFonts(): readonly Uint8Array[] {\n return fonts.slice()\n}\n\n/** Clear the registry — for tests, or a long-running process between renders of\n * different compositions (so one comp's fonts don't leak into the next). */\nexport function clearRegisteredFonts(): void {\n fonts.length = 0\n seen.clear()\n}\n","//! Engine-warmer registry — a hook for packages that need to load async engine\n//! assets (e.g. the wasm text-measurement module) BEFORE the synchronous frame\n//! render, so components bake exact values instead of estimates on export.\n//!\n//! `@onda-engine/react` is the shared hub: `@onda-engine/components` registers its warmer on\n//! import (`registerEngineWarmer(preloadTextMetrics)`), and `@onda-engine/render` awaits\n//! `runEngineWarmers()` before `renderFramesJSON`. No package-to-package coupling,\n//! and it's automatic — importing the components that need warming registers it.\n\ntype Warmer = () => Promise<void>\n\nconst warmers: Warmer[] = []\n\n/** Register an async warmer to run before a render. Idempotent per function. */\nexport function registerEngineWarmer(warm: Warmer): void {\n if (!warmers.includes(warm)) warmers.push(warm)\n}\n\n/** Run all registered warmers (best-effort — a warmer that throws is ignored, so\n * the render still proceeds with whatever fallback the component uses). */\nexport async function runEngineWarmers(): Promise<void> {\n await Promise.all(warmers.map((w) => w().catch(() => {})))\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../react/src/interpolate.ts","../../react/src/color.ts","../../react/src/clip.ts","../../react/src/gradient.ts","../../react/src/morph.ts","../../react/src/frame.ts","../../react/src/components.ts","../../react/src/spring.ts","../../react/src/sequence.ts","../../react/src/random.ts","../../react/src/particles.ts","../../react/src/transitions.ts","../../react/src/host-config.ts","../../react/src/reconciler.ts","../../react/src/fonts.ts","../../react/src/warmers.ts"],"names":["stops","clamp01","zoom","useContext","createElement","h","lerp","fade","scale","Children","isValidElement","createContext","chromaticAberration","TRANSPARENT"],"mappings":";;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,MAAA,EAAQ,CAAC,CAAA,KAAc,CAAA;AAAA;AAAA,EAEvB,IAAA,EAAM,CAAC,CAAA,KAAc,CAAA,GAAI,CAAA;AAAA,EACzB,KAAA,EAAO,CAAC,CAAA,KAAc,CAAA,GAAI,CAAA,GAAI,CAAA;AAAA,EAC9B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\n//! frame-driven animation. Mirrors Remotion's API closely.\n\nexport type EasingFn = (t: number) => number\n\n/** Easing presets + factories. Remotion-compatible: use a preset as an `EasingFn`\n * (`Easing.linear`, `Easing.cubic`, …) or call the `Easing.bezier(x1,y1,x2,y2)`\n * factory. The Remotion-named curves (`quad`/`cubic`/`sin`/`ease`/`bezier`) exist\n * so components authored against Remotion port without rewriting their easing. */\nexport const Easing = {\n linear: (t: number) => t,\n // Remotion-named curves (drop-in for `Easing.quad`/`.cubic`/`.sin`/`.ease`).\n quad: (t: number) => t * t,\n cubic: (t: number) => t * t * t,\n sin: (t: number) => 1 - Math.cos((t * Math.PI) / 2),\n ease: cubicBezier(0.42, 0, 1, 1),\n easeInQuad: (t: number) => t * t,\n easeOutQuad: (t: number) => 1 - (1 - t) * (1 - t),\n easeInOutQuad: (t: number) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2),\n easeInCubic: (t: number) => t ** 3,\n easeOutCubic: (t: number) => 1 - (1 - t) ** 3,\n easeInOutCubic: (t: number) => (t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2),\n smoothStep: (t: number) => t * t * (3 - 2 * t),\n easeInBack: (t: number) => 2.70158 * t ** 3 - 1.70158 * t ** 2,\n easeOutBack: (t: number) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2,\n /** CSS cubic-bézier factory — Remotion's `Easing.bezier(x1,y1,x2,y2)`. */\n bezier: (x1: number, y1: number, x2: number, y2: number): EasingFn => cubicBezier(x1, y1, x2, y2),\n}\n\n/** A CSS-style cubic-bézier ease with control points `(x1,y1)`, `(x2,y2)` and\n * fixed endpoints `(0,0)`–`(1,1)`. Matches `onda-animation`'s `CubicBezier`. */\nexport function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingFn {\n const comp = (c1: number, c2: number, s: number) => {\n const u = 1 - s\n return 3 * u * u * s * c1 + 3 * u * s * s * c2 + s * s * s\n }\n const deriv = (c1: number, c2: number, s: number) => {\n const u = 1 - s\n return 3 * u * u * c1 + 6 * u * s * (c2 - c1) + 3 * s * s * (1 - c2)\n }\n return (x: number) => {\n let s = x\n for (let i = 0; i < 8; i++) {\n const dx = comp(x1, x2, s) - x\n if (Math.abs(dx) < 1e-5) break\n const d = deriv(x1, x2, s)\n if (Math.abs(d) < 1e-6) break\n s -= dx / d\n }\n return comp(y1, y2, Math.min(1, Math.max(0, s)))\n }\n}\n\nexport interface InterpolateOptions {\n easing?: EasingFn\n /** How to handle inputs below the range. Default `'clamp'`. */\n extrapolateLeft?: 'clamp' | 'extend'\n /** How to handle inputs above the range. Default `'clamp'`. */\n extrapolateRight?: 'clamp' | 'extend'\n}\n\n/**\n * Map `input` from `inputRange` to `outputRange` (both ascending, equal length\n * ≥ 2). Out-of-range inputs clamp by default. Example:\n * `interpolate(frame, [0, 30], [0, 1])` fades in over 30 frames.\n */\nexport function interpolate(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n options: InterpolateOptions = {},\n): number {\n if (inputRange.length < 2 || inputRange.length !== outputRange.length) {\n throw new Error('interpolate: inputRange and outputRange must be the same length (>= 2)')\n }\n const { easing = Easing.linear, extrapolateLeft = 'clamp', extrapolateRight = 'clamp' } = options\n const last = inputRange.length - 1\n\n if (input <= at(inputRange, 0)) {\n if (extrapolateLeft === 'clamp') return at(outputRange, 0)\n return segment(input, inputRange, outputRange, 0, easing)\n }\n if (input >= at(inputRange, last)) {\n if (extrapolateRight === 'clamp') return at(outputRange, last)\n return segment(input, inputRange, outputRange, last - 1, easing)\n }\n\n let i = 0\n while (i < last - 1 && input >= at(inputRange, i + 1)) i++\n return segment(input, inputRange, outputRange, i, easing)\n}\n\n/** Read `arr[i]` as a number; throws if out of range (keeps the type honest\n * under `noUncheckedIndexedAccess` without non-null assertions). */\nfunction at(arr: readonly number[], i: number): number {\n const value = arr[i]\n if (value === undefined) throw new Error(`interpolate: index ${i} out of range`)\n return value\n}\n\n/** Interpolate within the segment starting at index `i`. */\nfunction segment(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n i: number,\n easing: EasingFn,\n): number {\n const x0 = at(inputRange, i)\n const x1 = at(inputRange, i + 1)\n const y0 = at(outputRange, i)\n const y1 = at(outputRange, i + 1)\n const span = x1 - x0\n const t = span === 0 ? 0 : (input - x0) / span\n return y0 + (y1 - y0) * easing(t)\n}\n","import { type InterpolateOptions, interpolate } from './interpolate.js'\nimport type { Color } from './scene.js'\n\n/** A color as a hex string (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`) or an\n * explicit 0..1 {@link Color}. */\nexport type ColorInput = string | Color\n\nconst clamp01 = (v: number): number => (v < 0 ? 0 : v > 1 ? 1 : v)\n\n/** A missing / unparseable color degrades to TRANSPARENT — the renderer must NEVER hard-crash a\n * whole frame over one bad color value (one stray `'white'` or `'accent'` used to throw and kill\n * the entire still). Degrade + warn so the defect is visible without taking the render down. */\nconst TRANSPARENT: Color = { r: 0, g: 0, b: 0, a: 0 }\n\n/** Common CSS named colors → hex. NOT the full 140 — the ones a brief / template / preview path\n * plausibly emits. Anything outside this set + the rgb()/hsl() parsers degrades to transparent. */\nconst NAMED_COLORS: Record<string, string> = {\n black: '#000000',\n white: '#ffffff',\n red: '#ff0000',\n green: '#008000',\n blue: '#0000ff',\n yellow: '#ffff00',\n orange: '#ffa500',\n purple: '#800080',\n pink: '#ffc0cb',\n gray: '#808080',\n grey: '#808080',\n cyan: '#00ffff',\n magenta: '#ff00ff',\n brown: '#a52a2a',\n navy: '#000080',\n teal: '#008080',\n lime: '#00ff00',\n silver: '#c0c0c0',\n gold: '#ffd700',\n maroon: '#800000',\n olive: '#808000',\n aqua: '#00ffff',\n fuchsia: '#ff00ff',\n indigo: '#4b0082',\n violet: '#ee82ee',\n beige: '#f5f5dc',\n coral: '#ff7f50',\n crimson: '#dc143c',\n khaki: '#f0e68c',\n salmon: '#fa8072',\n turquoise: '#40e0d0',\n tan: '#d2b48c',\n ivory: '#fffff0',\n lavender: '#e6e6fa',\n mint: '#98ff98',\n}\n\n/** Hex (`#rgb`/`#rgba`/`#rrggbb`/`#rrggbbaa`) → Color, or null if not valid hex. */\nfunction hexToColor(input: string): Color | null {\n let hex = input.trim().replace(/^#/, '')\n if (hex.length === 3 || hex.length === 4) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('')\n }\n if ((hex.length !== 6 && hex.length !== 8) || !/^[0-9a-fA-F]+$/.test(hex)) return null\n const channel = (i: number) => Number.parseInt(hex.slice(i, i + 2), 16) / 255\n const color: Color = { r: channel(0), g: channel(2), b: channel(4) }\n if (hex.length === 8) color.a = channel(6)\n return color\n}\n\nconst hslToColor = (hDeg: number, sPct: number, lPct: number, a: number): Color => {\n const s = sPct / 100\n const l = lPct / 100\n const k = (n: number) => (n + hDeg / 30) % 12\n const f = (n: number) =>\n clamp01(l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)))\n return { r: f(0), g: f(8), b: f(4), ...(a < 1 ? { a } : {}) }\n}\n\n/** Parse common CSS forms (named, `rgb()/rgba()`, `hsl()/hsla()`) → Color, else null. */\nfunction cssToColor(input: string): Color | null {\n const s = input.trim().toLowerCase()\n const named = NAMED_COLORS[s]\n if (named) return hexToColor(named)\n const parts = (body: string | undefined): string[] =>\n (body ?? '').split(/[\\s,/]+/).filter(Boolean)\n const alpha = (v: string | undefined) =>\n v === undefined\n ? 1\n : clamp01(v.endsWith('%') ? Number.parseFloat(v) / 100 : Number.parseFloat(v))\n const rgb = s.match(/^rgba?\\(([^)]+)\\)$/)\n if (rgb) {\n const [r, g, b, a] = parts(rgb[1])\n if (r !== undefined && g !== undefined && b !== undefined)\n return {\n r: clamp01(Number.parseFloat(r) / 255),\n g: clamp01(Number.parseFloat(g) / 255),\n b: clamp01(Number.parseFloat(b) / 255),\n ...(alpha(a) < 1 ? { a: alpha(a) } : {}),\n }\n }\n const hsl = s.match(/^hsla?\\(([^)]+)\\)$/)\n if (hsl) {\n const [h, sat, light, a] = parts(hsl[1])\n if (h !== undefined && sat !== undefined && light !== undefined)\n return hslToColor(\n Number.parseFloat(h),\n Number.parseFloat(sat),\n Number.parseFloat(light),\n alpha(a),\n )\n }\n return null\n}\n\n/** Normalize a {@link ColorInput} into the engine's 0..1 sRGB {@link Color}. Tolerant by design —\n * parses hex, common named colors, and `rgb()/hsl()`; anything else degrades to transparent (with\n * a warning) rather than throwing, so one bad value never crashes the render. */\nexport function parseColor(input: ColorInput): Color {\n // CSS keywords — common footgun: `fill: 'none'` should be transparent, not a crash.\n if (input === 'none' || input === 'transparent') return { r: 0, g: 0, b: 0, a: 0 }\n if (typeof input !== 'string') {\n // Object form: must be a real {r,g,b} color. A non-color value (boolean, null, array, partial\n // object) would produce a scene node missing channels and fail deep in the Rust deserializer\n // (`missing field r`) — degrade to transparent + warn here instead of crashing.\n if (\n input == null ||\n typeof input !== 'object' ||\n typeof (input as Color).r !== 'number' ||\n typeof (input as Color).g !== 'number' ||\n typeof (input as Color).b !== 'number'\n ) {\n console.warn(\n `onda: invalid color ${JSON.stringify(input)} — expected a hex string or a {r,g,b} object; using transparent.`,\n )\n return { ...TRANSPARENT }\n }\n return { r: input.r, g: input.g, b: input.b, ...(input.a !== undefined ? { a: input.a } : {}) }\n }\n\n const hex = hexToColor(input)\n if (hex) return hex\n const css = cssToColor(input)\n if (css) return css\n // NEVER throw — a stray color string must not take down the whole still.\n console.warn(\n `onda: unrecognized color '${input}' — using transparent. Supply hex (#rrggbb), rgb()/hsl(), or a common name.`,\n )\n return { ...TRANSPARENT }\n}\nconst toHex = (v: number): string =>\n Math.round(clamp01(v) * 255)\n .toString(16)\n .padStart(2, '0')\n\n/**\n * Interpolate between colors — like {@link interpolate}, but each output is a\n * {@link ColorInput}. Channels are mixed in 0..1 sRGB and returned as a hex\n * string (`#rrggbb`, or `#rrggbbaa` when any stop has alpha). Out-of-range\n * inputs clamp by default. Mirrors Remotion's `interpolateColors`.\n *\n * @example `interpolateColors(frame, [0, 30], ['#d96b82', '#2974f2'])`\n */\nexport function interpolateColors(\n input: number,\n inputRange: readonly number[],\n outputRange: readonly ColorInput[],\n options: InterpolateOptions = {},\n): string {\n const colors = outputRange.map(parseColor)\n const mix = (sel: (c: Color) => number) =>\n interpolate(input, inputRange, colors.map(sel), options)\n const hasAlpha = colors.some((c) => c.a !== undefined && c.a < 1)\n const rgb = `${toHex(mix((c) => c.r))}${toHex(mix((c) => c.g))}${toHex(mix((c) => c.b))}`\n return `#${rgb}${hasAlpha ? toHex(mix((c) => c.a ?? 1)) : ''}`\n}\n","//! Author-facing clip shapes, normalized into the engine's {@link ShapeGeometry}.\n\nimport type { ShapeGeometry } from './scene.js'\n\n/** A clip region as authored: a rect (optionally rounded), ellipse, or path. */\nexport type ClipInput =\n | { type: 'rect'; width: number; height: number; cornerRadius?: number }\n | { type: 'ellipse'; width: number; height: number }\n | { type: 'path'; d: string }\n\n/** Normalize a {@link ClipInput} into the engine's {@link ShapeGeometry}. */\nexport function parseClip(input: ClipInput): ShapeGeometry {\n switch (input.type) {\n case 'rect':\n return {\n shape: 'rect',\n size: { width: input.width, height: input.height },\n ...(input.cornerRadius != null ? { corner_radius: input.cornerRadius } : {}),\n }\n case 'ellipse':\n return { shape: 'ellipse', size: { width: input.width, height: input.height } }\n case 'path':\n return { shape: 'path', data: input.d }\n }\n}\n\n/** A rounded/square rectangle clip. */\nexport function clipRect(width: number, height: number, cornerRadius?: number): ClipInput {\n return { type: 'rect', width, height, cornerRadius }\n}\n\n/** An ellipse clip inscribed in `width`×`height`. */\nexport function clipEllipse(width: number, height: number): ClipInput {\n return { type: 'ellipse', width, height }\n}\n\n/** An arbitrary clip from SVG path data. */\nexport function clipPath(d: string): ClipInput {\n return { type: 'path', d }\n}\n","//! Author-facing gradient inputs, normalized into the engine's {@link Gradient}.\n\nimport { type ColorInput, parseColor } from './color.js'\nimport type { Gradient, Vec2 } from './scene.js'\n\n/** A point as an `{ x, y }` or a `[x, y]` tuple. */\nexport type Point = Vec2 | [number, number]\n\n/** A color stop: a color at a normalized position 0..1 along the gradient. */\nexport interface GradientStopInput {\n offset: number\n color: ColorInput\n}\n\n/** A gradient as authored: hex/`Color` stops and tuple-or-`Vec2` points. */\nexport type GradientInput =\n | { type: 'linear'; start: Point; end: Point; stops: GradientStopInput[] }\n | { type: 'radial'; center: Point; radius: number; stops: GradientStopInput[] }\n | {\n /** Fractal-noise (\"expensive\") gradient — fBm over Simplex noise. The field\n * value 0..1 samples the stops; `scale` ~0.8–1.2 + `warp` ~0.4–0.6 gives the\n * soft Stripe/Linear register (higher = busier turbulence). Animate `time`\n * per frame for a living gradient. Rendered natively (full quality on\n * `onda export`); the browser preview degrades to a smooth gradient. */\n type: 'fbm'\n stops: GradientStopInput[]\n scale?: number\n time?: number\n warp?: number\n }\n\nfunction toVec2(point: Point): Vec2 {\n return Array.isArray(point) ? { x: point[0], y: point[1] } : point\n}\n\nfunction stops(input: GradientStopInput[]): Gradient['stops'] {\n return input.map((s) => ({ offset: s.offset, color: parseColor(s.color) }))\n}\n\n/** Normalize a {@link GradientInput} into the engine's {@link Gradient} JSON. */\nexport function parseGradient(input: GradientInput): Gradient {\n if (input.type === 'linear') {\n return {\n gradient: 'linear',\n start: toVec2(input.start),\n end: toVec2(input.end),\n stops: stops(input.stops),\n }\n }\n if (input.type === 'fbm') {\n return {\n gradient: 'fbm',\n stops: stops(input.stops),\n scale: input.scale ?? 1.0,\n time: input.time ?? 0,\n warp: input.warp ?? 0.5,\n }\n }\n return {\n gradient: 'radial',\n center: toVec2(input.center),\n radius: input.radius,\n stops: stops(input.stops),\n }\n}\n\n/** Build a linear gradient input from two points and color stops. */\nexport function linearGradient(\n start: Point,\n end: Point,\n stops: GradientStopInput[],\n): GradientInput {\n return { type: 'linear', start, end, stops }\n}\n\n/** Build a radial gradient input from a center, radius, and color stops. */\nexport function radialGradient(\n center: Point,\n radius: number,\n stops: GradientStopInput[],\n): GradientInput {\n return { type: 'radial', center, radius, stops }\n}\n\n/** Build an fBm fractal-noise (\"expensive\") gradient — the soft, flowing\n * Stripe/Linear backdrop. `scale` ~0.8–1.2 + `warp` ~0.4–0.6 reads premium;\n * animate `time` (e.g. `frame / fps * speed`) for a living gradient. */\nexport function fbmGradient(\n stops: GradientStopInput[],\n opts: { scale?: number; time?: number; warp?: number } = {},\n): GradientInput {\n return { type: 'fbm', stops, ...opts }\n}\n","//! Path morphing — the Apple/ElevenLabs \"magic move\": one shape continuously\n//! morphing into another. The engine draws whatever path `d` it's handed, so this\n//! is a pure authoring helper (no engine change): it returns the in-between `d`\n//! string for a given progress `t`, which you feed to a `<Path>`.\n//!\n//! Backed by flubber, which solves the hard part — point CORRESPONDENCE between\n//! two arbitrary outlines (a naive `d`-string lerp tears shapes apart). The\n//! interpolator for a given (from → to) pair is cached, so calling `morphPath`\n//! every frame is cheap.\n\n// flubber ships CommonJS, and the two runtimes disagree on how to import it: Node's\n// ESM loader exposes only a `default` (the module.exports — a NAMED import throws),\n// while Vite's browser pre-bundle exposes the NAMED exports but no usable `default`.\n// So neither `import { interpolate }` nor `import flubber` works in both. A namespace\n// import + this lookup resolves `interpolate` under Node AND Vite.\nimport * as flubberNs from 'flubber'\n\ntype FlubberInterpolate = typeof import('flubber').interpolate\nconst flubberResolved = flubberNs as unknown as {\n interpolate?: FlubberInterpolate\n default?: { interpolate?: FlubberInterpolate }\n}\n// biome-ignore lint/style/noNonNullAssertion: CJS/ESM interop — one of the two forms always exists\nconst flubberInterpolate: FlubberInterpolate = (flubberResolved.interpolate ??\n flubberResolved.default?.interpolate)!\n\nconst clamp01 = (t: number): number => (t < 0 ? 0 : t > 1 ? 1 : t)\n\nexport interface MorphOptions {\n /** Subdivide segments longer than this (user units) for a smoother morph.\n * Lower = smoother + slower to build. Default `2`. */\n maxSegmentLength?: number\n /** Wind both shapes the same way before interpolating (flubber default `true`). */\n single?: boolean\n}\n\nconst cache = new Map<string, (t: number) => string>()\n\nfunction interpolator(from: string, to: string, opts: MorphOptions): (t: number) => string {\n const maxSegmentLength = opts.maxSegmentLength ?? 2\n const key = `${from}\u0000${to}\u0000${maxSegmentLength}`\n let interp = cache.get(key)\n if (!interp) {\n interp = flubberInterpolate(from, to, { maxSegmentLength })\n cache.set(key, interp)\n }\n return interp\n}\n\n/**\n * The in-between SVG path `d` morphing `from` → `to` at progress `t` (0..1).\n * Pass two `<Path>` `d` strings (or any flubber-acceptable shape) and an animated\n * `t`; feed the result to a `<Path d=...>`.\n *\n * @example\n * const d = morphPath(CIRCLE, RULE, ramp(frame, 70, 95))\n * return <Path d={d} fill=\"#fff\" />\n */\nexport function morphPath(from: string, to: string, t: number, options: MorphOptions = {}): string {\n return interpolator(from, to, options)(clamp01(t))\n}\n\n/**\n * Morph through an ordered list of shapes as `t` runs 0..1 — `[A, B, C]` spends\n * the first half on A→B and the second on B→C. Useful for a multi-stage magic\n * move under one progress value.\n */\nexport function morphPathSequence(shapes: string[], t: number, options: MorphOptions = {}): string {\n const first = shapes[0]\n if (first === undefined) return ''\n if (shapes.length === 1) return first\n const tt = clamp01(t)\n const segments = shapes.length - 1\n const scaled = tt * segments\n const i = Math.min(segments - 1, Math.floor(scaled))\n return interpolator(shapes[i] as string, shapes[i + 1] as string, options)(scaled - i)\n}\n","//! Frame context + hooks. The engine renders a composition once per frame, with\n//! the current frame supplied via React context; components read it with\n//! {@link useCurrentFrame} and compute props from it (Remotion's model).\n\nimport { createContext, useContext } from 'react'\n\n/** Resolution and timing of the composition being rendered. */\nexport interface VideoConfig {\n width: number\n height: number\n fps: number\n durationInFrames: number\n}\n\ninterface FrameState extends VideoConfig {\n frame: number\n}\n\n/** @internal Provided by the renderer for each frame. */\nexport const FrameContext = createContext<FrameState | null>(null)\n\nfunction useFrameState(hook: string): FrameState {\n const state = useContext(FrameContext)\n if (state === null) {\n throw new Error(\n `${hook} must be called inside a <Composition> rendered by renderFrame/renderFrames`,\n )\n }\n return state\n}\n\n/** The frame currently being rendered (0-based). */\nexport function useCurrentFrame(): number {\n return useFrameState('useCurrentFrame').frame\n}\n\n/** The composition's resolution and timing. */\nexport function useVideoConfig(): VideoConfig {\n const { width, height, fps, durationInFrames } = useFrameState('useVideoConfig')\n return { width, height, fps, durationInFrames }\n}\n","//! The ONDA React components. Each is a thin typed wrapper that emits an\n//! internal host element; the reconciler maps those to scene-graph nodes.\n//!\n//! ```tsx\n//! <Composition width={1200} height={360} fps={30} durationInFrames={30}>\n//! <Rect width={1200} height={360} fill=\"#0a0d17\" />\n//! <Text fontSize={96} color=\"#fff\" x={96} y={110}>Hello ONDA</Text>\n//! </Composition>\n//! ```\n\nimport { type ReactElement, type ReactNode, createElement } from 'react'\nimport type { ClipInput } from './clip.js'\nimport type { ColorInput } from './color.js'\nimport { useCurrentFrame, useVideoConfig } from './frame.js'\nimport type { GradientInput } from './gradient.js'\nimport type { BlendMode, Camera3D, Effect, ImageFit, Layout, MatteMode } from './scene.js'\n\n/** Properties shared by every scene node: identity, placement, opacity, clip. */\nexport interface NodeProps {\n /** Stable id, required to target the node from an animation timeline. */\n id?: number\n /** Translation in pixels. */\n x?: number\n y?: number\n /** Scale factor (1 = identity). */\n scaleX?: number\n scaleY?: number\n /** Clockwise rotation in degrees, about the transform origin (default (0,0)).\n * Renders on the GPU (Vello) backend; the CPU reference rasterizer ignores it. */\n rotation?: number\n /** Pivot for scale + rotation in local px (CSS transform-origin). Default (0,0).\n * For \"about the center\", pass half the node's width/height. */\n originX?: number\n originY?: number\n /** Opacity, 0..1. */\n opacity?: number\n /** DEPTH (z) of this layer for depth-of-field, in the same arbitrary units as\n * `<Composition dof={{ focus }}>`. Layers at the focus depth stay sharp; the\n * farther a layer's `depth` is from `focus`, the more it defocuses (a blur the\n * reconciler computes from the camera aperture). Animate the comp's `focus` for a\n * rack-focus pull. No effect unless the comp sets `dof`. */\n depth?: number\n /** 3D LAYER position `[x, y, z]` in world pixels — meaningful only inside a\n * `<Scene3D>`. `z = 0` is the framing plane (matches the 2D placement); larger\n * `z` is farther into the screen (smaller), negative `z` nearer the camera (After\n * Effects convention). Animate for fly-throughs / parallax / exploded views. */\n position3d?: [number, number, number]\n /** 3D LAYER rotation `[x, y, z]` in degrees (Z·Y·X): X pitch (tilt toward/away),\n * Y yaw (swing), Z roll (in-plane spin). Inside `<Scene3D>` only. GPU-only — the\n * CPU reference degrades to a flat depth-sorted composite (no out-of-plane tilt). */\n rotation3d?: [number, number, number]\n /** Pivot within this layer's content plane (px) that `position3d`/`rotation3d`\n * act about. Default: the layer's center. */\n anchor3d?: [number, number]\n /** EXTRUDE this layer's 2D outline into a lit 3D SOLID (the \"3D logo / title\"):\n * inside a `<Scene3D>`, a shape or text layer becomes a mesh with `depth`\n * thickness + side walls, shaded by a directional light so it catches the light\n * as it rotates. GPU only — the CPU reference + live preview draw the flat outline. */\n extrude?: number | { depth: number }\n /** Blend this node's subtree against the backdrop (CSS mix-blend-mode).\n * GPU/Vello-rendered (e.g. `'screen'`, `'multiply'`, `'overlay'`). */\n blendMode?: BlendMode\n /** Clip this node and its subtree to a region (local space). */\n clip?: ClipInput\n /** Matte (track matte / mask): a stencil SUBTREE, passed as a React element,\n * through which this node's content is revealed. The matte's alpha — or its\n * luminance, per `matteMode` — multiplies the content's alpha, so the content\n * (this node's children) shows only where the matte covers. The\n * strictly-more-powerful sibling of `clip`: the matte is a fully rendered,\n * animatable subtree (giant text, a gradient, a shape) — the signature\n * \"media-through-type\" move (a photo seen only through animated type). */\n matte?: ReactElement\n /** Which channel of the {@link NodeProps.matte} subtree drives the reveal (CSS\n * `mask-mode`). `'alpha'` (default): content alpha ×= matte alpha. `'luminance'`:\n * content alpha ×= luma(matte) × matte alpha (white reveals, black hides). */\n matteMode?: MatteMode\n /** Ordered, low-level screen-space effects on this node + subtree (render-to-texture). */\n effects?: Effect[]\n /** Gaussian blur std-dev in output px; sugar for `effects: [{ effect: 'blur', sigma }]`.\n * Honored by Vello AND the CPU reference once Phase 1 lands. */\n blur?: number\n /** Directional (motion) blur sugar for `effects: [{ effect: 'directional_blur', … }]`:\n * a 1D blur of std-dev `sigma` (px) along `angle` (radians, default 0 = horizontal) —\n * the cinematic \"in-motion\" smear. Honored by Vello AND the CPU reference. */\n directionalBlur?: { sigma: number; angle?: number }\n /** Chromatic-aberration sugar: R/B split by `amount` px radially from centre. */\n chromaticAberration?: number\n /** Vignette sugar — radial edge darkening. `amount` 0..1; `softness` 0..1 (default 0.5). */\n vignette?: number | { amount: number; softness?: number }\n /** Posterize sugar: quantize each channel to `levels` (≥2) discrete steps. */\n posterize?: number\n /** Duotone sugar: map luminance to a gradient from `shadow` to `highlight`. */\n duotone?: { shadow: ColorInput; highlight: ColorInput }\n /** Chroma-key sugar: knock out `color`; `threshold` (default 0.4) + `smoothness`\n * (default 0.1) shape the soft matte edge. */\n chromaKey?: { color: ColorInput; threshold?: number; smoothness?: number }\n /** Glow / bloom sugar for `effects: [{ effect: 'bloom', ... }]`: bright regions\n * (luminance above `threshold`, default 0.7; scaled by `intensity`, default 1)\n * blur with `sigma` and composite additively over the sharp subtree. Honored by\n * Vello AND the CPU reference. */\n bloom?: number | { sigma: number; threshold?: number; intensity?: number }\n /** Cinematic color-grade sugar for `effects: [{ effect: 'color_grade', ... }]` —\n * the \"land AI media\" wedge: one grade unifies mismatched clips into a single\n * look. All five fields are optional and default to the neutral identity\n * (`exposure` 0, `contrast` 1, `saturation` 1, `temperature` 0, `tint` 0), so\n * `{}` is a no-op. Honored by Vello AND the CPU reference. */\n grade?: {\n /** Linear exposure gain (`2^exposure`); 0 = identity. */\n exposure?: number\n /** Contrast around a 0.5 pivot; 1 = identity. */\n contrast?: number\n /** Saturation; 1 = identity, 0 = grayscale, >1 = punchier. */\n saturation?: number\n /** Warm/cool shift (R up / B down for positive); 0 = neutral. */\n temperature?: number\n /** Green/magenta shift on G (positive = green); 0 = neutral. */\n tint?: number\n }\n /** Gooey / liquid / metaball-morph sugar for `effects: [{ effect: 'goo', ... }]`:\n * the subtree is blurred with `sigma`, then its alpha is sharpened around\n * `threshold` (the 0..1 cutoff, default 0.5) so overlapping shapes fuse into\n * solid forms joined by smooth necks (the \"drops of liquid coalescing\" look).\n * A bare number is the `sigma`. Honored by Vello AND the CPU reference. */\n goo?: number | { sigma: number; threshold?: number }\n /** Film-grain sugar for `effects: [{ effect: 'grain', ... }]`: luminance-banded,\n * animated monochrome noise added late over the subtree — the compositing \"glue\"\n * that makes mismatched sources read as one photographed image, and the dither\n * that hides 8-bit banding on dark gradients. A bare number is the `intensity`\n * (~0.04–0.1 is filmic); the object form adds `size` (grain scale in px, default\n * 1) and `seed` (animation offset — pass the current frame for *living* grain,\n * default 0 = static). Honored by Vello AND the CPU reference. */\n grain?: number | { intensity: number; size?: number; seed?: number }\n /** Frosted-glass sugar for `effects: [{ effect: 'backdrop_blur', ... }]`: samples\n * the already-composited BACKDROP *behind* this node (not its own subtree),\n * blurs it by `sigma` (output px), and draws it as the node's backing — then the\n * node's own content (e.g. a translucent panel `fill`) composites on top. A bare\n * number is just the `sigma`; the object form adds a `tint` (its alpha = tint\n * strength), a `brightness` and a `saturation` (CSS-style, `1` = identity).\n * Honored by Vello AND the CPU reference. */\n backdropBlur?:\n | number\n | { sigma: number; tint?: ColorInput; brightness?: number; saturation?: number }\n /** Light-wrap sugar for `effects: [{ effect: 'light_wrap', ... }]`: bleeds the\n * blurred BACKDROP behind this node onto its own feathered EDGES — the #1\n * \"shot in, not pasted on\" compositing tell for a cut-out plate. A bare number\n * is the `sigma` (the backdrop blur / rim width); the object form adds a\n * `strength` (0 = off, ~1 = a natural spill). EXPORT/NATIVE only — the live\n * preview draws the node un-wrapped. */\n lightWrap?: number | { sigma: number; strength?: number }\n children?: ReactNode\n}\n\n/** Paint props shared by shapes: a solid fill, a gradient (which takes\n * precedence), and a stroke. */\nexport interface PaintProps {\n fill?: ColorInput\n gradient?: GradientInput\n stroke?: ColorInput\n strokeWidth?: number\n /** Stroke end-cap (CSS stroke-linecap). Default 'butt'. */\n strokeCap?: 'butt' | 'round' | 'square'\n /** Stroke corner-join (CSS stroke-linejoin). Default 'miter'. */\n strokeJoin?: 'miter' | 'round' | 'bevel'\n /** Dash pattern: alternating on/off px (e.g. [12, 8]). Omit for solid. */\n strokeDash?: number[]\n /** Phase offset into the dash pattern (px) — animate for a draw-on reveal. */\n strokeDashOffset?: number\n /** TRIM PATHS (mograph line-draw): draw only a slice of the stroked outline.\n * `trimStart`/`trimEnd` are fractions 0..1 of the path's length (default 0 / 1);\n * `trimOffset` rotates the visible window around the path. Animate `trimEnd` 0→1\n * for a draw-on reveal. Needs a `stroke`; length is measured by the engine. */\n trimStart?: number\n trimEnd?: number\n trimOffset?: number\n /** Drop shadow / glow behind the shape (CSS box-shadow). `blur` is the gaussian\n * std-dev; `(0,0)` offset reads as a centered glow. GPU/Vello-rendered. */\n shadow?: {\n color: ColorInput\n blur: number\n offsetX?: number\n offsetY?: number\n spread?: number\n }\n}\n\nexport interface CompositionProps {\n width: number\n height: number\n fps: number\n durationInFrames: number\n /** Opt into the cinematic LINEAR + ACES finishing pipeline (correct bloom/light,\n * light-wrap, halation). GPU/export only; off by default (gamma). */\n linear?: boolean\n /** Composition-level cinematic FINISH: a linear-HDR finishing chain run after the\n * comp rasterizes — bloom bleeding REAL light (highlights exceed 1.0 and roll off),\n * warm halation — ending in one ACES film tone-map. The correct \"looks shot\" output\n * transform (unlike per-node effects, no HDR is lost between passes). GPU/export only. */\n finish?: {\n /** Linear exposure multiplier before the tone-map (1 = neutral; >1 brightens). */\n exposure?: number\n /** Comp-level bloom in linear HDR. `sigma` = halo blur radius (px). */\n bloom?: { sigma: number; threshold?: number; intensity?: number }\n /** Warm red/orange halation around highlights (0 = off, ~0.6 filmic). */\n halation?: number\n /** Grade — white balance: + warm (boost red/cut blue), − cool. 0 = neutral. */\n temperature?: number\n /** Grade — contrast around mid-grey. 1 = identity, >1 punchier. */\n contrast?: number\n /** Grade — saturation. 1 = identity, 0 = greyscale, >1 richer. */\n saturation?: number\n /** Vignette — radial edge darkening of the finished frame. 0 = off. */\n vignette?: number\n /** Film grain intensity added in linear light (luminance-banded). 0 = off; the\n * current frame is used as the animation seed automatically. */\n grain?: number\n /** A cinematic 3D color LUT applied as the FINAL finish step (after grade + ACES\n * + sRGB), as a trilinear lookup. `table` holds `size³` RGB triples in 0..1 with\n * RED varying fastest, then green, then blue. Honored by BOTH backends. */\n lut?: { size: number; table: number[] }\n }\n /** Per-object MOTION BLUR via temporal supersampling: each output frame is the\n * average of `samples` sub-frames spread across the shutter window, so anything\n * that MOVES smears by its own motion and static elements stay sharp — the\n * shutter-angle blur every pro comp ships with. `true` = a 180° shutter, 16\n * samples. Cost is `samples`× the render, so it's an EXPORT feature (the live\n * preview shows the sharp frame). */\n motionBlur?:\n | boolean\n | {\n /** Shutter angle in degrees: how much of the frame the shutter is open. 180 =\n * half a frame (the film default); 360 = full-frame (heavier blur). */\n shutter?: number\n /** Sub-frames averaged per output frame. More = smoother smear, linearly costlier. */\n samples?: number\n }\n /** DEPTH OF FIELD (2.5D rack focus): with this set, any layer carrying a `depth`\n * prop defocuses by how far its `depth` is from `focus` — sharp at the focus plane,\n * blurrier away from it. Animate `focus` for a focus pull. Resolved as a per-layer\n * blur (reuses the blur effect), so it works on both backends. */\n dof?: {\n /** The `depth` value that is in sharp focus. */\n focus: number\n /** How fast blur grows with depth distance (px of blur per unit of depth past the\n * in-focus band). Bigger = shallower depth of field. Default 0.04. */\n aperture?: number\n /** A sharp band (± in depth units) around `focus` that stays unblurred. Default 0. */\n range?: number\n /** Clamp the blur σ (px) so far layers don't blur to mush. Default 40. */\n maxBlur?: number\n }\n children?: ReactNode\n}\n\n/** The root of every ONDA tree: resolution + timing, like Remotion's. */\nexport function Composition(props: CompositionProps) {\n return createElement('onda-composition', props)\n}\n\nexport type GroupProps = NodeProps\n\n/** A transform/opacity container with no visual of its own. */\nexport function Group(props: GroupProps) {\n return createElement('onda-group', props)\n}\n\n/** Props for {@link Repeater} (After Effects' shape \"Repeater\"). */\nexport interface RepeaterProps {\n /** Number of copies (including the original). */\n count: number\n /** Per-copy translation, applied cumulatively (copy i is offset i×). */\n offsetX?: number\n offsetY?: number\n /** Per-copy rotation in degrees, applied cumulatively (a radial array / spiral). */\n rotation?: number\n /** Per-copy scale factor, applied cumulatively (copy i is `scale**i`). 1 = none. */\n scale?: number\n /** Pivot for the per-copy rotation/scale (local px). Default (0,0). */\n originX?: number\n originY?: number\n /** Opacity of the first / last copy; the rest interpolate (a fade-out trail). */\n startOpacity?: number\n endOpacity?: number\n children?: ReactNode\n}\n\n/** REPEATER — stamp `children` `count` times, each copy COMPOUNDING one more step of\n * the transform (offset / rotation / scale) and a step of the opacity ramp: grids,\n * radial arrays, spirals, motion trails. Mirrors After Effects' shape Repeater.\n *\n * Implemented as `count` nested transform groups (each adds one increment on top of\n * the previous, so the transforms truly compound into a spiral rather than a naive\n * `i×` fan), with a copy of `children` drawn at every level. Pure composition — it\n * renders identically on every backend. */\nexport function Repeater({\n count,\n offsetX = 0,\n offsetY = 0,\n rotation = 0,\n scale = 1,\n originX = 0,\n originY = 0,\n startOpacity = 1,\n endOpacity = 1,\n children,\n}: RepeaterProps): ReactElement {\n const n = Math.max(1, Math.floor(count))\n const opacityAt = (i: number): number =>\n startOpacity + (endOpacity - startOpacity) * (n > 1 ? i / (n - 1) : 0)\n // Build inside-out: level L sits inside L increment groups → transform compounded\n // L times. Each level draws ONE copy (with its own ramped opacity) plus the deeper,\n // further-incremented levels.\n const buildLevel = (level: number): ReactElement | null => {\n if (level >= n) return null\n const copy = createElement(Group, { key: 'copy', opacity: opacityAt(level) }, children)\n const deeper = buildLevel(level + 1)\n // Level 0 is the identity copy; every deeper level adds one transform increment.\n const transform =\n level === 0\n ? {}\n : { x: offsetX, y: offsetY, rotation, scaleX: scale, scaleY: scale, originX, originY }\n return createElement(Group, { key: level, ...transform }, copy, deeper)\n }\n return buildLevel(0) ?? createElement(Group, null)\n}\n\n/** Props for {@link Merge} (After Effects' shape \"Merge Paths\"). */\nexport interface MergeProps extends PaintProps, Omit<NodeProps, 'children'> {\n /** Boolean operation over the SHAPE children: `union` (add) / `difference` (the\n * first minus the rest) / `intersect` (common area) / `xor` (symmetric difference).\n * Default `union`. */\n op?: 'union' | 'difference' | 'intersect' | 'xor'\n children?: ReactNode\n}\n\n/** MERGE PATHS — combine the SHAPE children into ONE outline via a boolean `op`\n * (union / difference / intersect / xor). A ring = circle − circle; a lens =\n * circle ∩ circle; a speech bubble = rect ∪ triangle. The children are folded into\n * the result (not drawn separately), so fill/stroke the `<Merge>` itself. Curve\n * outlines are flattened before the boolean; resolved on both backends (i_overlay). */\nexport function Merge(props: MergeProps) {\n return createElement('onda-boolean', props)\n}\n\nexport type PrecompProps = NodeProps\n\n/** PRECOMP — flatten this subtree to a SINGLE layer (render-to-texture) before its\n * `opacity` / `blendMode` / effects apply, the way After Effects' precomp /\n * collapse-transformations does. Reach for it when you fade or blend-mode a GROUP of\n * overlapping layers and don't want the overlaps to double-up, or to treat a group as\n * one unit. (It's a `<Group>` carrying the `isolate` effect.) */\nexport function Precomp(props: PrecompProps) {\n const effects: Effect[] = [{ effect: 'isolate' }, ...(props.effects ?? [])]\n return createElement(Group, { ...props, effects })\n}\n\n/** Flex layout props for {@link Flex} / {@link AbsoluteFill} (CSS-flexbox subset). */\nexport interface FlexProps extends NodeProps, Layout {}\n\n/** A flex container: lays out its direct children (row/column, with\n * justify/align/gap/padding) instead of requiring absolute x/y. Resolved to\n * absolute positions by the engine's layout pass. */\nexport function Flex(props: FlexProps) {\n const { direction, justify, align, gap, padding, wrap, width, height, ...rest } = props\n const layout: Layout = { direction, justify, align, gap, padding, wrap, width, height }\n return createElement('onda-group', { ...rest, layout })\n}\n\nexport interface CenterProps extends Omit<NodeProps, 'children'> {\n /** Top of the centering row (px). Default 0. */\n y?: number\n /** Height of the row the content is centered within (px). Omit to size to content. */\n height?: number\n children?: ReactNode\n}\n\n/** Horizontally CENTER children across the composition width at vertical position `y` —\n * sugar for a full-width `<Flex justify=\"center\">`. The reliable way to center text:\n * the layout pass measures the real glyph width natively, so you never hand-compute an\n * `x` (which mis-centers the moment the text, font, or size changes). */\nexport function Center(props: CenterProps) {\n const { children, y, height, ...rest } = props\n const { width } = useVideoConfig()\n return createElement(\n Flex,\n {\n ...rest,\n x: 0,\n y: y ?? 0,\n width,\n ...(height !== undefined ? { height } : {}),\n justify: 'center',\n align: 'center',\n },\n children,\n )\n}\n\nexport type AbsoluteFillProps = Omit<FlexProps, 'width' | 'height'>\n\n/** A full-canvas flex container (like Remotion's `<AbsoluteFill>`): fills the\n * composition and lays children out (column by default) — ideal for centering\n * or stacking. Combine with `justify`/`align` to center content. */\nexport function AbsoluteFill(props: AbsoluteFillProps) {\n const { width, height } = useVideoConfig()\n return Flex({ direction: 'column', ...props, width, height })\n}\n\nexport interface CameraProps {\n /** The world — children laid out in absolute WORLD-pixel coordinates. */\n children?: ReactNode\n /** World x (px) to center in the viewport. Default: viewport center (no pan). */\n focusX?: number\n /** World y (px) to center in the viewport. Default: viewport center (no pan). */\n focusY?: number\n /** Zoom about the focus point. 1 = neutral, >1 = pushed in. */\n zoom?: number\n /** Camera roll in degrees (2D rotation about the focus point). GPU-only. */\n rotate?: number\n /** Viewport size; defaults to the composition canvas. */\n viewportWidth?: number\n viewportHeight?: number\n}\n\n/**\n * A 2D camera: frames an oversized \"world\" (its children, laid out in world-pixel\n * coordinates) by centering a world point in the viewport at a given zoom + roll —\n * pans across a grid larger than the canvas, push-in fly-overs, focus moves.\n *\n * Pure translate/scale/rotate — a STACK OF {@link Group}s, no new scene node:\n * `translate(vw/2,vh/2) ∘ [scale·rotate about origin] ∘ translate(-focus)`, so the\n * world point `focus` lands at the viewport center, scaled by `zoom`. (`rotate`\n * renders on the GPU/Vello backend only, like {@link NodeProps.rotation}.) Animate\n * focus/zoom per frame ({@link useCurrentFrame} + interpolate) for a moving camera.\n */\nexport function Camera(props: CameraProps) {\n const { children, focusX, focusY, zoom = 1, rotate = 0, viewportWidth, viewportHeight } = props\n const { width, height } = useVideoConfig()\n const vw = viewportWidth ?? width\n const vh = viewportHeight ?? height\n const fx = focusX ?? vw / 2\n const fy = focusY ?? vh / 2\n return createElement(\n Group,\n { x: vw / 2, y: vh / 2 },\n createElement(\n Group,\n { rotation: rotate, scaleX: zoom, scaleY: zoom, originX: 0, originY: 0 },\n createElement(Group, { x: -fx, y: -fy }, children),\n ),\n )\n}\n\nexport interface Scene3DProps extends Omit<NodeProps, 'children'> {\n /** The perspective camera for this 3D world. Omit fields to derive a default that\n * frames the `z = 0` plane to fill the comp (so layers at `z = 0` match their 2D\n * placement). Animate `position`/`target` per frame for camera moves. */\n camera?: Camera3D\n /** The 3D LAYERS — direct children, each placed by its `position3d` / `rotation3d`\n * / `anchor3d`. Layers without a `position3d` sit at `z = 0` (their 2D spot). */\n children?: ReactNode\n}\n\n/**\n * A 3D SCENE: its direct children become 3D LAYERS in one shared 3D world, viewed\n * through a perspective `camera`. Each layer is a flat plane (its rendered 2D\n * content) placed by `position3d` (world x/y/z) and tilted by `rotation3d`, then\n * depth-sorted and composited as a single layer. The mograph core of \"3D\" —\n * camera fly-throughs, card walls, parallax, exploded UI, billboard text.\n *\n * GPU (Vello) runs true perspective; the CPU reference degrades to a 2.5D\n * depth-sorted composite (per-layer distance scale, no out-of-plane tilt). A layer\n * at `z = 0` with no rotation renders pixel-identical to its 2D placement, so\n * wrapping content in `<Scene3D>` changes nothing until you move layers in z.\n */\nexport function Scene3D(props: Scene3DProps) {\n const { camera, children, ...rest } = props\n return createElement('onda-group', { ...rest, camera3d: camera ?? {} }, children)\n}\n\nexport interface RectProps extends NodeProps, PaintProps {\n width: number\n height: number\n cornerRadius?: number\n}\n\nexport function Rect(props: RectProps) {\n return createElement('onda-rect', props)\n}\n\nexport interface EllipseProps extends NodeProps, PaintProps {\n width: number\n height: number\n}\n\nexport function Ellipse(props: EllipseProps) {\n return createElement('onda-ellipse', props)\n}\n\nexport interface PathProps extends NodeProps, PaintProps {\n /** SVG path data (e.g. `\"M0 0 L100 0 Z\"`), in the node's local space. */\n d: string\n}\n\n/** An arbitrary vector outline from SVG path data. Renders on the GPU (Vello)\n * backend; the CPU reference rasterizer skips paths. */\nexport function Path(props: PathProps) {\n return createElement('onda-path', props)\n}\n\n/** One styled run for rich `<Text>` — overrides the node's style. */\nexport interface TextRunInput {\n text: string\n color?: ColorInput\n fontSize?: number\n /** Font family (must be loaded; bundled: \"Open Sans\", \"IBM Plex Sans\"). */\n fontFamily?: string\n /** CSS weight 1..1000 (700 = bold). */\n fontWeight?: number\n italic?: boolean\n}\n\nexport interface TextProps extends NodeProps {\n fontSize?: number\n color?: ColorInput\n /** Font family (must be loaded; bundled: \"Open Sans\", \"IBM Plex Sans\"). */\n fontFamily?: string\n /** CSS weight 1..1000 (700 = bold). */\n fontWeight?: number\n italic?: boolean\n /** Extra px between glyphs (CSS `letter-spacing` / tracking). `0` = natural;\n * negative tightens. Applied on the GPU/preview (Vello) text path. */\n letterSpacing?: number\n /** Rich multi-style runs. When set, these replace the text children — each run\n * may override color/size/family/weight/style. Renders per-run on the GPU\n * (Vello); the CPU backend draws their concatenated text in the node style. */\n runs?: TextRunInput[]\n children?: ReactNode\n}\n\nexport function Text(props: TextProps) {\n return createElement('onda-text', props)\n}\n\nexport interface ImageProps extends NodeProps {\n src: string\n /** Target box width in px. With `height`, the decoded image is fitted into this\n * box per `fit` — the renderer measures the image, so the component doesn't\n * need its intrinsic size. Omit both for the image's intrinsic pixel size. */\n width?: number\n height?: number\n /** How to fit the image into the `width`×`height` box (default `'cover'`). */\n fit?: ImageFit\n /** Gaussian blur radius (sigma, in source pixels) applied to the decoded image\n * by the engine's image pass. `0`/omitted leaves it sharp; animating it gives\n * a soft→sharp \"focus pull\" entrance. Identical on every backend. */\n blur?: number\n}\n\nexport function Image(props: ImageProps) {\n return createElement('onda-image', props)\n}\n\nexport interface VideoProps extends NodeProps {\n /** Path, URL, or `data:` URI of the video. The frame at the current time is\n * decoded by the player (browser: an off-screen `<video>`/WebCodecs) or by\n * `onda export` (native ffmpeg) — the author layer never decodes. */\n src: string\n /** Seconds into the SOURCE shown at this clip's frame 0 (trim the head).\n * Default `0`. */\n startFrom?: number\n /** Source seconds advanced per composition second (1 = realtime, 2 = 2× fast,\n * 0.5 = slow-mo). Default `1`. */\n playbackRate?: number\n /** Seconds into the SOURCE to stop at (trim the tail). Past it the clip holds\n * its last frame, unless `loop` is set. Omit to play to the source's end. */\n endAt?: number\n /** Loop the trimmed span `[startFrom, endAt)` (requires `endAt`). The source\n * time wraps so the clip repeats for as long as the `<Sequence>` shows it. */\n loop?: boolean\n /** Target box width in px. With `height`, the frame is fitted into this box\n * per `fit`. Omit both for the video's intrinsic pixel size. */\n width?: number\n height?: number\n /** How to fit the frame into the `width`×`height` box (default `'cover'`). */\n fit?: ImageFit\n /**\n * Preview-only behaviour when the browser can't composite this source — i.e. a\n * cross-origin video without CORS headers. **Never affects `onda export`**,\n * which always composites via ffmpeg.\n * - `'skip'` (default): leave it blank in preview + log a one-time hint.\n * - `'element'`: overlay a plain `<video>` so it still *plays* in preview\n * (display-only — no engine effects, and it sits above the canvas). Useful\n * for prototyping with a third-party URL you can't add CORS to. For your own\n * assets, serving them same-origin or with CORS is better (full compositing).\n */\n previewFallback?: 'skip' | 'element'\n}\n\n/** A video clip. At composition frame *f* it shows the source frame at\n * `startFrom + (f / fps) * playbackRate` seconds; the player/engine decodes that\n * exact frame (browser: `<video>`/WebCodecs; native export: ffmpeg) and the\n * renderer draws it like an image. Place/scale it like any node; combine with a\n * `<Sequence>` to position it on the timeline. */\nexport function Video({ startFrom = 0, playbackRate = 1, endAt, loop, ...rest }: VideoProps) {\n const frame = useCurrentFrame()\n const { fps } = useVideoConfig()\n // Resolve the source time IN THE AUTHOR LAYER (the engine just gets a number):\n // advance from the trim-head at playbackRate, then trim-tail / loop the span.\n let time = startFrom + (frame / Math.max(1, fps)) * playbackRate\n if (endAt != null && endAt > startFrom) {\n const span = endAt - startFrom\n time = loop\n ? startFrom + ((((time - startFrom) % span) + span) % span) // wrap to repeat\n : Math.min(time, endAt) // hold the last frame past the tail\n }\n return createElement('onda-video', { ...rest, time: Math.max(0, time) })\n}\n\nexport interface AudioProps {\n /** Path, URL, or `data:` URI of the audio. */\n src: string\n /** Composition time (seconds) at which the clip begins playing. Default 0. */\n start?: number\n /** Seconds into the source to begin from (trim the head). Default 0. */\n startAt?: number\n /** Linear gain, 0..1. Default 1. */\n volume?: number\n}\n\n/** A non-visual audio clip on the timeline. It draws nothing — the player plays\n * it during preview (and export muxes it). Place it anywhere in the tree; `start`\n * sets when it begins (seconds), `startAt` trims into the source, `volume`\n * scales its gain. The higher-level `<AudioClip>` (`@onda-engine/components`) wraps this\n * with a fade envelope. */\nexport function Audio(props: AudioProps) {\n return createElement('onda-audio', props)\n}\n\nexport interface SvgProps extends NodeProps {\n /** A file path/URL to the SVG (resolved at render time by `onda render`). */\n src?: string\n /** Inline SVG markup (self-contained; preferred when present). */\n markup?: string\n}\n\n/** An SVG document, expanded into vector nodes by the engine (`onda-svg`).\n * Use `x`/`y`/`scaleX`/`scaleY` to place and size it. Renders on the GPU\n * (Vello) backend. */\nexport function Svg(props: SvgProps) {\n return createElement('onda-svg', props)\n}\n","//! `spring()` — natural motion as a deterministic, frame-keyed value.\n//!\n//! A damped harmonic oscillator pulled from 0 toward 1, integrated with explicit\n//! Euler at a stable sub-frame step. Pure function of `frame` (IEEE-754 math), so\n//! renders are reproducible across machines. Use it like Remotion's spring —\n//! including `durationInFrames` to re-time how fast it settles.\n//!\n//! Why sub-stepping: explicit Euler diverges unless `dt < ~2/ω`, where `ω` is the\n//! fastest rate in the system. A heavily-overdamped config like the Onda house\n//! spring (damping 200) has `ω ≈ 200`, so a naive `dt = 1/fps` (≈0.033) blows up\n//! to NaN. We pick a stable sub-frame `dt` instead, independent of `fps`.\n\nexport interface SpringConfig {\n mass?: number\n stiffness?: number\n damping?: number\n}\n\nexport interface SpringOptions {\n /** Current frame (e.g. from `useCurrentFrame()`). */\n frame: number\n /** Composition frame rate. */\n fps: number\n /** Output at rest start (default 0). */\n from?: number\n /** Output at settle (default 1). */\n to?: number\n config?: SpringConfig\n /** Re-time the spring so it settles in this many frames (like Remotion's\n * `durationInFrames`). Without it, the settle is governed purely by the\n * spring physics — and for an overdamped config (e.g. the Onda house spring)\n * that can be far slower than you want. */\n durationInFrames?: number\n /** When `durationInFrames` is set, the spring counts as \"settled\" once it\n * stays within this distance of `to` with near-zero velocity. Default 0.005. */\n durationRestThreshold?: number\n}\n\n/** A stable explicit-Euler step (seconds) for this mass-spring-damper. Sized to\n * `dt < 2/ω` with margin so the integration never diverges, and capped at 1/60s\n * so soft configs are still sampled smoothly. */\nfunction stableStep(mass: number, stiffness: number, damping: number): number {\n const omega = Math.max(damping / mass, Math.sqrt(stiffness / mass), 1e-6)\n return Math.min(1 / 60, 1.6 / omega)\n}\n\n/** Normalized spring position (0 at rest → 1 at settle, may overshoot if\n * underdamped) after `timeSec` seconds. Pure function of time. */\nfunction positionAt(\n timeSec: number,\n mass: number,\n stiffness: number,\n damping: number,\n dt: number,\n): number {\n if (timeSec <= 0) return 0\n const steps = Math.max(1, Math.round(timeSec / dt))\n let position = 0\n let velocity = 0\n for (let i = 0; i < steps; i++) {\n const force = -stiffness * (position - 1) - damping * velocity\n velocity += (force / mass) * dt\n position += velocity * dt\n }\n return position\n}\n\n// Memoized natural-settle measurement, keyed by (config, dt, threshold). Pure\n// memoization of a pure function — no effect on determinism.\nconst settleCache = new Map<string, number>()\n\n/** Seconds the natural spring takes to settle within `threshold` of 1 with\n * near-zero velocity. Used to re-time when `durationInFrames` is set. */\nfunction measureSettleSeconds(\n mass: number,\n stiffness: number,\n damping: number,\n dt: number,\n threshold: number,\n): number {\n const key = `${mass}|${stiffness}|${damping}|${dt}|${threshold}`\n const cached = settleCache.get(key)\n if (cached !== undefined) return cached\n\n let position = 0\n let velocity = 0\n const maxSteps = 5_000_000\n let result = maxSteps * dt\n for (let i = 0; i < maxSteps; i++) {\n const force = -stiffness * (position - 1) - damping * velocity\n velocity += (force / mass) * dt\n position += velocity * dt\n if (Math.abs(1 - position) < threshold && Math.abs(velocity) < threshold) {\n result = (i + 1) * dt\n break\n }\n }\n settleCache.set(key, result)\n return result\n}\n\n/** Spring value at `frame`. Settles toward `to`; underdamped configs overshoot.\n * With `durationInFrames`, the whole settle is time-remapped to land in that\n * many frames. */\nexport function spring({\n frame,\n fps,\n from = 0,\n to = 1,\n config = {},\n durationInFrames,\n durationRestThreshold = 0.005,\n}: SpringOptions): number {\n const { mass = 1, stiffness = 100, damping = 10 } = config\n let position = 0\n if (fps > 0 && frame > 0) {\n const dt = stableStep(mass, stiffness, damping)\n let timeSec = frame / fps\n if (durationInFrames != null && durationInFrames > 0) {\n // Re-time by stretching the time axis: the value at `frame` is the natural\n // spring's value at `frame * naturalSettle / durationInFrames`, clamped at\n // the natural settle so post-settle frames just read `to`.\n const naturalSec = measureSettleSeconds(mass, stiffness, damping, dt, durationRestThreshold)\n const durationSec = durationInFrames / fps\n timeSec = Math.min((frame / fps) * (naturalSec / durationSec), naturalSec)\n }\n position = positionAt(timeSec, mass, stiffness, damping, dt)\n }\n return from + (to - from) * position\n}\n","//! Time-shifting composition primitives — `<Sequence>`, `<Series>`, `<Loop>`.\n//!\n//! These manipulate the frame context: children inside a `<Sequence from={N}>`\n//! see `useCurrentFrame()` shifted by `-N` and render only within their window.\n//! This is Remotion's compositional grammar, the way you assemble a timeline.\n\nimport {\n Children,\n Fragment,\n type ReactElement,\n type ReactNode,\n createElement,\n isValidElement,\n useContext,\n} from 'react'\nimport { FrameContext } from './frame.js'\n\nexport interface SequenceProps {\n /** Frame at which this sequence starts (children's frame 0). Default 0. */\n from?: number\n /** How many frames it lasts; unbounded if omitted. */\n durationInFrames?: number\n children?: ReactNode\n}\n\n/** Shift children in time: inside, the frame is `outerFrame - from`, and the\n * children render only while `0 <= localFrame < durationInFrames`. When a\n * `durationInFrames` is given, children's `useVideoConfig().durationInFrames`\n * reflects the SEQUENCE's length (Remotion semantics) — so a component can ask\n * \"how long is my clip?\" and fit its entrance to it. */\nexport function Sequence({\n from = 0,\n durationInFrames,\n children,\n}: SequenceProps): ReactElement | null {\n const ctx = useContext(FrameContext)\n if (!ctx) return null\n const local = ctx.frame - from\n const visible = local >= 0 && (durationInFrames === undefined || local < durationInFrames)\n if (!visible) return null\n const value =\n durationInFrames === undefined\n ? { ...ctx, frame: local }\n : { ...ctx, frame: local, durationInFrames }\n return createElement(FrameContext.Provider, { value }, children)\n}\n\nexport interface LoopProps {\n /** Length of one loop iteration in frames. */\n durationInFrames: number\n children?: ReactNode\n}\n\n/** Repeat children forever: children see `frame % durationInFrames`. */\nexport function Loop({ durationInFrames, children }: LoopProps): ReactElement | null {\n const ctx = useContext(FrameContext)\n if (!ctx || durationInFrames <= 0) return null\n const local = ((ctx.frame % durationInFrames) + durationInFrames) % durationInFrames\n return createElement(FrameContext.Provider, { value: { ...ctx, frame: local } }, children)\n}\n\nexport interface SeriesSequenceProps {\n durationInFrames: number\n children?: ReactNode\n}\n\n// Marker element; never rendered directly — `<Series>` reads its props.\nfunction SeriesSequence(_props: SeriesSequenceProps): ReactElement | null {\n return null\n}\n\ninterface SeriesProps {\n children?: ReactNode\n}\n\n/** Play `<Series.Sequence>` children back-to-back: each starts where the\n * previous ended (cumulative offsets from their `durationInFrames`). */\nfunction SeriesRoot({ children }: SeriesProps): ReactElement {\n let offset = 0\n const items = Children.map(children, (child) => {\n if (!isValidElement(child) || child.type !== SeriesSequence) {\n throw new Error('<Series> children must be <Series.Sequence>')\n }\n const props = child.props as SeriesSequenceProps\n const element = createElement(\n Sequence,\n { from: offset, durationInFrames: props.durationInFrames },\n props.children,\n )\n offset += props.durationInFrames\n return element\n })\n return createElement(Fragment, null, items)\n}\n\n/** `<Series>` with `<Series.Sequence durationInFrames={…}>` children. */\nexport const Series = Object.assign(SeriesRoot, { Sequence: SeriesSequence })\n","//! Seeded, deterministic randomness for frame-driven motion.\n//!\n//! Compositions must render identically every time (same frame → same pixels),\n//! so `Math.random()` is off-limits. These are pure functions of their inputs:\n//! `random(seed)` for uniform values and `noise2D/3D` for smooth, organic motion\n//! (jitter, drift, wobble). Same seed + coords always yield the same result.\n//!\n//! THE SEEDING MODEL (the convention every seeded component follows):\n//! - Every component with randomness takes a `seed` prop with a fixed default —\n//! so an instance is deterministic out of the box and STABLE across renders,\n//! previews and exports (same seed → same pixels, every machine).\n//! - Per-element streams derive from the seed by salting (`random(seed + i *\n//! prime)` or `random(`${seed}-${i}-part`)`), never by consuming a stateful\n//! generator — order of evaluation can't change the result.\n//! - Want a DIFFERENT take, not a different look? Pass `variant` (an integer):\n//! {@link variantSeed} derives a new well-mixed seed from `(seed, variant)`,\n//! so alternates never require hand-edited magic seeds. `variant: 0` (or\n//! omitted) is the identity — existing renders are untouched.\n\n/** Hash a seed (number or string) to a 32-bit unsigned integer. */\nfunction hashSeed(seed: number | string): number {\n if (typeof seed === 'number') {\n // Mix the bits so nearby seeds (0, 1, 2…) diverge.\n let h = Math.imul(seed ^ (seed >>> 16), 2246822507) >>> 0\n h = Math.imul(h ^ (h >>> 13), 3266489909) >>> 0\n return (h ^ (h >>> 16)) >>> 0\n }\n let h = 2166136261 >>> 0\n for (let i = 0; i < seed.length; i++) {\n h ^= seed.charCodeAt(i)\n h = Math.imul(h, 16777619) >>> 0\n }\n return h >>> 0\n}\n\n/** Derive a deterministic alternate seed from `(seed, variant)` — the cheap\n * \"give me take #N\" knob. `variant` 0/undefined returns `seed` UNCHANGED\n * (identity — existing compositions keep their exact pixels); any other\n * integer yields a well-mixed, stable new numeric seed. Pure. */\nexport function variantSeed(seed: number, variant?: number): number\nexport function variantSeed(seed: number | string, variant?: number): number | string\nexport function variantSeed(seed: number | string, variant?: number): number | string {\n if (!variant) return seed\n // Mix the base seed's hash with the variant through the same avalanche the\n // PRNG uses, so variant 1 and 2 are as unrelated as two arbitrary seeds.\n let h = (hashSeed(seed) ^ Math.imul(variant | 0, 0x9e3779b9)) >>> 0\n h = Math.imul(h ^ (h >>> 13), 3266489909) >>> 0\n return (h ^ (h >>> 16)) >>> 0\n}\n\n/** A deterministic value in `[0, 1)` for `seed` (mulberry32, one step). */\nexport function random(seed: number | string): number {\n let a = hashSeed(seed)\n a = (a + 0x6d2b79f5) | 0\n let t = Math.imul(a ^ (a >>> 15), 1 | a)\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n}\n\n/** Deterministic `[0, 1)` from a seed + integer coordinates (noise lattice). */\nfunction hashUnit(s: number, ...coords: number[]): number {\n let h = (s ^ 0x9e3779b9) >>> 0\n for (const c of coords) {\n h ^= c | 0\n h = Math.imul(h, 16777619) >>> 0\n h ^= h >>> 13\n }\n h = Math.imul(h ^ (h >>> 15), 2246822507) >>> 0\n return (h >>> 0) / 4294967296\n}\n\n/** Quintic smoothstep (Perlin's fade) — C2-continuous, so noise looks smooth. */\nfunction fade(t: number): number {\n return t * t * t * (t * (t * 6 - 15) + 10)\n}\n\nfunction lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t\n}\n\n/** Smooth 2D value noise in `[-1, 1]` — coherent (nearby inputs give nearby\n * outputs), deterministic per `seed`. Scale `x`/`y` to set the frequency. */\nexport function noise2D(seed: number | string, x: number, y: number): number {\n const s = hashSeed(seed)\n const ix = Math.floor(x)\n const iy = Math.floor(y)\n const fx = x - ix\n const fy = y - iy\n const u = fade(fx)\n const v = fade(fy)\n const n = lerp(\n lerp(hashUnit(s, ix, iy), hashUnit(s, ix + 1, iy), u),\n lerp(hashUnit(s, ix, iy + 1), hashUnit(s, ix + 1, iy + 1), u),\n v,\n )\n return n * 2 - 1\n}\n\n/** Smooth 3D value noise in `[-1, 1]` (e.g. animate `z` over frames for drift). */\nexport function noise3D(seed: number | string, x: number, y: number, z: number): number {\n const s = hashSeed(seed)\n const ix = Math.floor(x)\n const iy = Math.floor(y)\n const iz = Math.floor(z)\n const u = fade(x - ix)\n const v = fade(y - iy)\n const w = fade(z - iz)\n const c = (dx: number, dy: number, dz: number) => hashUnit(s, ix + dx, iy + dy, iz + dz)\n const front = lerp(lerp(c(0, 0, 0), c(1, 0, 0), u), lerp(c(0, 1, 0), c(1, 1, 0), u), v)\n const back = lerp(lerp(c(0, 0, 1), c(1, 0, 1), u), lerp(c(0, 1, 1), c(1, 1, 1), u), v)\n return lerp(front, back, w) * 2 - 1\n}\n","//! `<Particles>` — a deterministic particle emitter. Every particle's whole state\n//! (spawn point, velocity, age, size, opacity, colour, spin) is a PURE function of\n//! `(frame, seed, index)` via the `random(seed)` hash, so the same comp renders the\n//! same field on every frame and every machine — no `Math.random`, no wall-clock,\n//! and no engine change: each live particle is just a circle/square in one\n//! full-canvas `<Group>`. Frame-based units (velocity = px/frame, gravity =\n//! px/frame²), so it composes with the rest of the timeline.\n\nimport { type ReactElement, createElement } from 'react'\nimport { Ellipse, Group, Rect } from './components.js'\nimport { useCurrentFrame } from './frame.js'\nimport { random } from './random.js'\n\nexport interface ParticlesProps {\n /** Number of particles. */\n count?: number\n /** Seed for every per-particle random — the same seed always renders the same field. */\n seed?: number | string\n /** Emitter origin (px). */\n x?: number\n y?: number\n /** Particles spawn at a random point within this radius of the origin (0 = a point). */\n spawnRadius?: number\n /** Base launch speed (px per frame). */\n speed?: number\n /** Random speed reduction, 0..1 (each particle gets `speed × (1 − variance×rand)`). */\n speedVariance?: number\n /** Launch direction in degrees: 0 = right, −90 = up, 90 = down, 180 = left. */\n angle?: number\n /** Spread cone around `angle`, in degrees (360 = omnidirectional burst). */\n spread?: number\n /** Constant downward acceleration (px per frame²). */\n gravity?: number\n /** Particle lifetime in frames. */\n lifetime?: number\n /** Stagger the emission across this many frames (0 = a single burst). */\n emitOver?: number\n /** Re-emit each particle when it dies → a continuous stream (set `emitOver`≈`lifetime`). */\n loop?: boolean\n /** Frames before emission begins. */\n delay?: number\n /** Particle shape. */\n shape?: 'circle' | 'square'\n /** Diameter (px) at birth → death (lerped over the lifetime). A number = constant. */\n size?: number | [number, number]\n /** Opacity at birth → death. */\n opacity?: [number, number]\n /** Palette each particle picks one colour from. */\n colors?: string[]\n /** Rotation in degrees over the lifetime (visible on `square`). */\n spin?: number\n}\n\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n\n/** A deterministic particle emitter — bursts, fountains, confetti, sparks, dust,\n * snow. See {@link ParticlesProps}. */\nexport function Particles({\n count = 60,\n seed = 1,\n x = 0,\n y = 0,\n spawnRadius = 0,\n speed = 4,\n speedVariance = 0.5,\n angle = -90,\n spread = 360,\n gravity = 0,\n lifetime = 60,\n emitOver = 0,\n loop = false,\n delay = 0,\n shape = 'circle',\n size = 8,\n opacity = [1, 0],\n colors = ['#e85494', '#ffd36b', '#5ad1ff'],\n spin = 0,\n}: ParticlesProps): ReactElement {\n const frame = useCurrentFrame()\n const key = String(seed)\n const [s0, s1] = typeof size === 'number' ? [size, size] : size\n const particles: ReactElement[] = []\n\n for (let i = 0; i < count; i++) {\n const r = (suffix: string): number => random(`${key}-${i}-${suffix}`)\n const emitFrame = delay + (emitOver > 0 ? (i / count) * emitOver : 0)\n let age = frame - emitFrame\n if (loop && age >= 0) age %= lifetime\n if (age < 0 || age >= lifetime) continue\n\n // Spawn point: uniform within the spawn disc (√rand for even area distribution).\n const sa = r('sa') * Math.PI * 2\n const sr = Math.sqrt(r('sr')) * spawnRadius\n const ox = x + Math.cos(sa) * sr\n const oy = y + Math.sin(sa) * sr\n\n // Launch velocity: `angle ± spread/2`, speed with variance.\n const dir = ((angle + (r('ang') - 0.5) * spread) * Math.PI) / 180\n const spd = speed * (1 - speedVariance * r('spd'))\n const vx = Math.cos(dir) * spd\n const vy = Math.sin(dir) * spd\n\n // Integrate position (closed form: launch + gravity).\n const px = ox + vx * age\n const py = oy + vy * age + 0.5 * gravity * age * age\n\n const t = age / lifetime\n const sz = lerp(s0, s1, t)\n const op = lerp(opacity[0], opacity[1], t)\n const color = colors[Math.floor(r('col') * colors.length) % colors.length]\n const inner =\n shape === 'square'\n ? createElement(Rect, { x: -sz / 2, y: -sz / 2, width: sz, height: sz, fill: color })\n : createElement(Ellipse, { x: -sz / 2, y: -sz / 2, width: sz, height: sz, fill: color })\n particles.push(\n createElement(\n Group,\n { key: i, x: px, y: py, opacity: op, rotation: spin * t, originX: 0, originY: 0 },\n inner,\n ),\n )\n }\n return createElement(Group, null, ...particles)\n}\n","//! Transitions between sequences — `<TransitionSeries>`.\n//!\n//! Like `<Series>`, but consecutive sequences can *overlap* by a transition's\n//! duration, during which the outgoing scene animates out and the incoming one\n//! animates in. Built entirely on the existing primitives: a transition is just\n//! `opacity` (fade), `translate` (slide), or a `clip` mask (wipe) driven by the\n//! transition's progress — no engine support needed.\n//!\n//! ```tsx\n//! <TransitionSeries>\n//! <TransitionSeries.Sequence durationInFrames={60}><A /></TransitionSeries.Sequence>\n//! <TransitionSeries.Transition presentation={fade()} timing={linearTiming({ durationInFrames: 20 })} />\n//! <TransitionSeries.Sequence durationInFrames={60}><B /></TransitionSeries.Sequence>\n//! </TransitionSeries>\n//! ```\n\nimport { Children, type ReactElement, type ReactNode, createElement, isValidElement } from 'react'\nimport { clipEllipse, clipPath, clipRect } from './clip.js'\nimport { Group, Rect } from './components.js'\nimport { useCurrentFrame, useVideoConfig } from './frame.js'\nimport { linearGradient, radialGradient } from './gradient.js'\nimport { Sequence } from './sequence.js'\nimport { type SpringConfig, spring } from './spring.js'\n\n// ---------------------------------------------------------------------------\n// Timings — how a transition's progress evolves over its duration.\n// ---------------------------------------------------------------------------\n\n/** Maps a frame within a transition to progress `0..1` (may overshoot 1 for\n * springs). `durationInFrames` is how long the transition (overlap) lasts. */\nexport interface TransitionTiming {\n durationInFrames: number\n getProgress(frame: number, fps: number): number\n}\n\n/** A linear transition over `durationInFrames`. */\nexport function linearTiming({ durationInFrames }: { durationInFrames: number }): TransitionTiming {\n return {\n durationInFrames,\n getProgress: (frame) =>\n durationInFrames <= 0 ? 1 : Math.min(1, Math.max(0, frame / durationInFrames)),\n }\n}\n\n/** A spring-driven transition (natural ease, optional overshoot). */\nexport function springTiming({\n durationInFrames = 30,\n config,\n}: {\n durationInFrames?: number\n config?: SpringConfig\n} = {}): TransitionTiming {\n return {\n durationInFrames,\n getProgress: (frame, fps) => Math.max(0, spring({ frame, fps, config })),\n }\n}\n\n// ---------------------------------------------------------------------------\n// Presentations — how the entering/exiting scenes look at a given progress.\n// ---------------------------------------------------------------------------\n\n/** Which edge a slide/wipe moves from. */\nexport type SlideDirection = 'from-left' | 'from-right' | 'from-top' | 'from-bottom'\n\nexport interface PresentationState {\n /** Transition progress `0..1` (0 = fully out, 1 = fully in). */\n progress: number\n /** True for the incoming scene, false for the outgoing one. */\n entering: boolean\n width: number\n height: number\n}\n\n/** Wraps a scene to present it at a point in a transition. Identity at the\n * resting state (entering progress 1 / exiting progress 0). */\nexport type TransitionPresentation = (children: ReactNode, state: PresentationState) => ReactElement\n\n/** Cross-fade via opacity. */\nexport function fade(): TransitionPresentation {\n return (children, { progress, entering }) =>\n createElement(Group, { opacity: entering ? progress : 1 - progress }, children)\n}\n\n/** Slide the scenes across; `direction` is where the incoming scene comes from. */\nexport function slide({\n direction = 'from-right',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const axisX = direction === 'from-left' || direction === 'from-right'\n const span = axisX ? width : height\n const sign = direction === 'from-right' || direction === 'from-bottom' ? 1 : -1\n // Entering: starts off-screen on `direction`'s edge, slides to 0.\n // Exiting: slides off the opposite edge in lock-step with the incoming one.\n const offset = entering ? (1 - progress) * span * sign : -progress * span * sign\n const props = axisX ? { x: offset } : { y: offset }\n return createElement(Group, props, children)\n }\n}\n\n/** Wipe the incoming scene over the outgoing one with a growing clip mask. */\nexport function wipe({\n direction = 'from-left',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n // The incoming scene is masked (it reveals over the outgoing one). The\n // outgoing scene fades out faster than the wipe completes — so it doesn't\n // linger at full opacity beneath an incoming scene that has transparent\n // areas (otherwise the old scene bleeds through the new one's gaps). Gone\n // by ~60% of the wipe.\n if (!entering) {\n const fade = Math.max(0, 1 - progress / 0.6)\n return createElement(Group, { opacity: fade }, children)\n }\n const p = Math.min(1, Math.max(0, progress))\n switch (direction) {\n case 'from-left':\n return createElement(Group, { clip: clipRect(width * p, height) }, children)\n case 'from-top':\n return createElement(Group, { clip: clipRect(width, height * p) }, children)\n case 'from-right': {\n // Reveal the rightmost p·W: shift content left, clip at the origin, shift back.\n const w = width * p\n return createElement(\n Group,\n { x: width - w },\n createElement(Group, { x: -(width - w), clip: clipRect(w, height) }, children),\n )\n }\n case 'from-bottom': {\n const h = height * p\n return createElement(\n Group,\n { y: height - h },\n createElement(Group, { y: -(height - h), clip: clipRect(width, h) }, children),\n )\n }\n }\n }\n}\n\n/** A hard cut — the overlap timing with no visual effect. The incoming scene\n * (drawn on top) simply replaces the outgoing one. */\nexport function none(): TransitionPresentation {\n return (children) => createElement(Group, {}, children)\n}\n\n/** Scale `children` by (sx, sy) about the pivot `(px, py)` — translate to the\n * pivot, scale, then translate back (node scale pivots on the local origin). */\nfunction scaleAbout(\n children: ReactNode,\n sx: number,\n sy: number,\n px: number,\n py: number,\n): ReactElement {\n return createElement(\n Group,\n { x: px, y: py },\n createElement(\n Group,\n { scaleX: sx, scaleY: sy },\n createElement(Group, { x: -px, y: -py }, children),\n ),\n )\n}\n\n/** A 2D card flip: the outgoing scene collapses horizontally to the centre line\n * by the midpoint, then the incoming scene expands out of it. */\nexport function flip(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sx = entering\n ? Math.max(0, progress * 2 - 1) // incoming expands over the back half\n : Math.max(0, 1 - progress * 2) // outgoing collapses over the front half\n return scaleAbout(children, sx, 1, width / 2, height / 2)\n }\n}\n\nconst round = (n: number): number => Math.round(n * 1000) / 1000\n\n/** Iris: a circular reveal of the incoming scene expanding from the centre. The\n * outgoing scene stays full beneath it (the incoming draws on top). */\nexport function iris(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering || progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cx = width / 2\n const cy = height / 2\n const r = progress * Math.hypot(cx, cy) // cover the corners at progress 1\n // Centre a 2r×2r ellipse clip on (cx,cy): translate the clipped group to the\n // clip box's origin, then untranslate the children back (cf. `wipe`).\n return createElement(\n Group,\n { x: cx - r, y: cy - r, clip: clipEllipse(2 * r, 2 * r) },\n createElement(Group, { x: -(cx - r), y: -(cy - r) }, children),\n )\n }\n}\n\n/** Clock wipe: an angular sweep revealing the incoming scene clockwise from 12\n * o'clock. Outgoing stays full beneath (the incoming draws on top). The wedge is\n * a polygon fan (M/L/Z only — no arc command) so it clips on any path renderer. */\nexport function clockWipe(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering || progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cx = width / 2\n const cy = height / 2\n const r = Math.hypot(cx, cy) // reach the corners\n const theta = progress * Math.PI * 2 // clockwise from the top\n const steps = Math.max(2, Math.ceil((theta / (Math.PI * 2)) * 64))\n let d = `M ${round(cx)} ${round(cy)}`\n for (let i = 0; i <= steps; i++) {\n const a = (theta * i) / steps\n d += ` L ${round(cx + r * Math.sin(a))} ${round(cy - r * Math.cos(a))}`\n }\n d += ' Z'\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\nexport type PushDirection = 'left' | 'right' | 'up' | 'down'\n\nconst PUSH_VECTOR: Record<PushDirection, { x: number; y: number }> = {\n left: { x: -1, y: 0 },\n right: { x: 1, y: 0 },\n up: { x: 0, y: -1 },\n down: { x: 0, y: 1 },\n}\n\n/** Both scenes translate together in `direction`, like a camera pan. */\nexport function push({\n direction = 'left',\n}: { direction?: PushDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n return createElement(Group, { x: tx, y: ty }, children)\n }\n}\n\n/** Scale-and-fade punch. `direction` 'in' pushes toward the viewer, 'out' pulls back. */\nexport function zoom({\n direction = 'in',\n scaleAmount = 0.2,\n}: { direction?: 'in' | 'out'; scaleAmount?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const s = scaleAmount\n let scale: number\n if (direction === 'in') {\n scale = entering ? 1 + s / 2 - (s / 2) * progress : 1 + s * progress\n } else {\n scale = entering ? 1 - s / 2 + (s / 2) * progress : 1 - s * progress\n }\n const opacity = entering ? progress : 1 - progress\n return createElement(\n Group,\n { opacity },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Push with parallax depth — a scale layered on the translate (a camera dolly). */\nexport function depthPush({\n direction = 'left',\n scaleAmount = 0.08,\n}: { direction?: PushDirection; scaleAmount?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n const scale = entering ? 1 + scaleAmount * (1 - progress) : 1 - scaleAmount * progress\n return createElement(\n Group,\n { x: tx, y: ty },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Outgoing fades to `color`, incoming fades up from it (dip-to-black/white). */\nexport function dipToColor({ color = '#08080a' }: { color?: string } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sceneOpacity = entering ? Math.max(0, progress * 2 - 1) : Math.max(0, 1 - progress * 2)\n const colorOpacity = entering\n ? Math.max(0, 1 - (progress - 0.5) * 2)\n : Math.min(1, progress * 2)\n return createElement(\n Group,\n null,\n createElement(Group, { opacity: sceneOpacity }, children),\n createElement(\n Group,\n { opacity: colorOpacity },\n createElement(Rect, { width, height, fill: color }),\n ),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// Effect transitions — approximated in the presentation layer (no engine blur).\n// `blur`/`glassWipe` use a multi-tap smear (`blurStack`); the rest are\n// transform/clip tricks. Crude vs a true Gaussian, but convincing at transition\n// speed and zero engine cost.\n// ---------------------------------------------------------------------------\n\n// Ring of unit offsets; a tap is drawn at each, scaled by the blur radius, so the\n// copies smear into a soft blur. (A true Gaussian would need an engine pass.)\nconst BLUR_RING: ReadonlyArray<readonly [number, number]> = [\n [0, 0],\n [1, 0],\n [-1, 0],\n [0, 1],\n [0, -1],\n [0.7, 0.7],\n [-0.7, 0.7],\n [0.7, -0.7],\n [-0.7, -0.7],\n]\n\n/** Draw `children` at each ring offset (scaled by `radius`) at equal opacity so\n * the copies sum to a soft blur. `radius` ≤ ~0.5px → a single sharp draw. */\nfunction blurStack(children: ReactNode, radius: number): ReactElement {\n if (radius <= 0.5) return createElement(Group, {}, children)\n const op = 1 / BLUR_RING.length\n return createElement(\n Group,\n {},\n ...BLUR_RING.map(([dx, dy], i) =>\n createElement(Group, { key: i, x: dx * radius, y: dy * radius, opacity: op }, children),\n ),\n )\n}\n\n/** Blur cross: each scene blurs toward the midpoint and sharpens at rest, with an\n * opacity cross. (Multi-tap approximation — see {@link blurStack}.) */\nexport function blur({ maxBlur = 24 }: { maxBlur?: number } = {}): TransitionPresentation {\n return (children, { progress, entering }) => {\n const sharp = entering ? progress : 1 - progress // 1 at rest\n return createElement(\n Group,\n { opacity: entering ? progress : 1 - progress },\n blurStack(children, (1 - sharp) * maxBlur),\n )\n }\n}\n\n/** Motion-blur smear: render copies offset ALONG (dx,dy) — a directional swish,\n * unlike {@link blurStack}'s isotropic ring. Used by {@link whipPan}. */\nfunction directionalSmear(\n children: ReactNode,\n dx: number,\n dy: number,\n radius: number,\n): ReactElement {\n if (radius <= 0.5) return createElement(Group, {}, children)\n const N = 6\n const op = 1 / N\n return createElement(\n Group,\n {},\n ...Array.from({ length: N }, (_, i) => {\n const t = (i / (N - 1) - 0.5) * 2 // -1..1 along the axis\n return createElement(\n Group,\n { key: i, x: dx * t * radius, y: dy * t * radius, opacity: op },\n children,\n )\n }),\n )\n}\n\n/** Zoom-blur / \"smooth zoom\" — the punch-in (or -out) with a motion-blur smear\n * heaviest mid-transition, snapping sharp at rest, with an opacity cross. The\n * most-used viral/social transition. `direction` 'in' rushes toward the viewer,\n * 'out' pulls back. */\nexport function zoomBlur({\n direction = 'in',\n scaleAmount = 0.35,\n maxBlur = 28,\n}: {\n direction?: 'in' | 'out'\n scaleAmount?: number\n maxBlur?: number\n} = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const s = scaleAmount\n const dirSign = direction === 'in' ? 1 : -1\n // Entering settles to 1 from an over/under-scale; exiting departs from 1.\n const scale = entering ? 1 + dirSign * s * (1 - progress) : 1 + dirSign * s * progress\n const sharp = entering ? progress : 1 - progress // 1 at rest\n const opacity = entering ? progress : 1 - progress\n return createElement(\n Group,\n { opacity },\n scaleAbout(blurStack(children, (1 - sharp) * maxBlur), scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Whip-pan — a fast directional swish with a motion-blur smear ALONG the pan\n * axis (the high-energy \"camera whip\" cut, best paired with a whoosh SFX).\n * `direction` is where the camera swings toward (left/right/up/down). */\nexport function whipPan({\n direction = 'left',\n maxBlur = 40,\n}: { direction?: PushDirection; maxBlur?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const { x, y } = PUSH_VECTOR[direction]\n const tx = (entering ? -x * (1 - progress) : x * progress) * width\n const ty = (entering ? -y * (1 - progress) : y * progress) * height\n const sharp = entering ? progress : 1 - progress\n return createElement(\n Group,\n { x: tx, y: ty },\n directionalSmear(children, x, y, (1 - sharp) * maxBlur),\n )\n }\n}\n\n/** Film-burn / light-leak — the scenes crossfade while a warm leak blooms over the\n * cut, screen-blended and peaking at the midpoint (the cinematic-warmth flare).\n * The leak draws once (on the incoming layer); a dark gradient screen-blends to\n * ~nothing, so only the warm centre flares. */\nexport function filmBurn({ color = '#ffb070' }: { color?: string } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const sceneOpacity = entering ? progress : 1 - progress\n const burn = Math.sin(Math.min(1, Math.max(0, progress)) * Math.PI) // 0 → 1 → 0\n const scene = createElement(Group, { opacity: sceneOpacity }, children)\n if (!entering) return scene\n const leak = createElement(\n Group,\n { opacity: burn * 0.85, blendMode: 'screen' },\n createElement(Rect, {\n width,\n height,\n gradient: radialGradient([width * 0.72, height * 0.28], Math.max(width, height) * 0.95, [\n { offset: 0, color },\n { offset: 0.45, color: '#7a3a12' },\n { offset: 1, color: '#000000' },\n ]),\n }),\n )\n return createElement(Group, null, scene, leak)\n }\n}\n\n/** Luma-wipe — reveal the incoming scene through a soft LUMINANCE ramp that sweeps\n * across (a gradient matte; white reveals, black hides). The organic, edge-feathered\n * reveal Premiere/Resolve ship as a workhorse. */\nexport function lumaWipe(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering) {\n // The outgoing scene fades as the incoming reveals over it.\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n }\n const p = Math.min(1, Math.max(0, progress))\n const feather = 0.22\n const lead = p * (1 + feather)\n const matte = createElement(Rect, {\n width,\n height,\n gradient: linearGradient(\n [0, 0],\n [width, 0],\n [\n { offset: 0, color: '#ffffff' },\n { offset: Math.max(0, Math.min(1, lead - feather)), color: '#ffffff' },\n { offset: Math.max(0, Math.min(1, lead)), color: '#000000' },\n { offset: 1, color: '#000000' },\n ],\n ),\n })\n return createElement(Group, { matte, matteMode: 'luminance' }, children)\n }\n}\n\n/** Chromatic split: the scene tears into horizontally offset ghosts that spread\n * at the midpoint and converge at rest (an RGB-fringe feel — the engine has no\n * per-channel tint, so the copies are uncoloured). */\nexport function chromaticAberration({\n maxShift = 22,\n}: { maxShift?: number } = {}): TransitionPresentation {\n return (children, { progress, entering }) => {\n const sharp = entering ? progress : 1 - progress\n const d = (1 - sharp) * maxShift\n const opacity = entering ? progress : 1 - progress\n if (d <= 0.5) return createElement(Group, { opacity }, children)\n return createElement(\n Group,\n { opacity },\n createElement(Group, { x: -d, opacity: 0.5 }, children),\n createElement(Group, { x: d, opacity: 0.5 }, children),\n createElement(Group, {}, children),\n )\n }\n}\n\n/** Device pullback: the outgoing scene shrinks back (and lifts) as if pulled into\n * the distance, uncovering the incoming scene that settles forward into place. */\nexport function devicePullback(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (entering) {\n const scale = 1.12 - 0.12 * progress\n return createElement(\n Group,\n { opacity: progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n const scale = 1 - 0.45 * progress\n return createElement(\n Group,\n { opacity: 1 - progress, y: -progress * height * 0.06 },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Expand morph: the incoming scene bursts open from the centre while the\n * outgoing one balloons out and dissolves — a quick morph-expand. */\nexport function expandMorph(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (entering) {\n const scale = 0.3 + 0.7 * progress\n return createElement(\n Group,\n { opacity: Math.min(1, progress * 1.5) },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n const scale = 1 + 0.5 * progress\n return createElement(\n Group,\n { opacity: 1 - progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Morph: a soft scale-and-fade blend — the scenes ease through each other with a\n * gentle breathing scale. */\nexport function morph(): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n const scale = entering ? 0.94 + 0.06 * progress : 1 + 0.06 * progress\n return createElement(\n Group,\n { opacity: entering ? progress : 1 - progress },\n scaleAbout(children, scale, scale, width / 2, height / 2),\n )\n }\n}\n\n/** Glass wipe: the incoming scene reveals behind a sweeping edge and blurs sharp\n * as the \"frosted panel\" passes (blur is the {@link blurStack} approximation). */\nexport function glassWipe({\n direction = 'from-left',\n}: { direction?: SlideDirection } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n const p = Math.min(1, Math.max(0, progress))\n const frosted = blurStack(children, (1 - p) * 18)\n switch (direction) {\n case 'from-top':\n return createElement(Group, { clip: clipRect(width, height * p) }, frosted)\n case 'from-right': {\n const w = width * p\n return createElement(\n Group,\n { x: width - w },\n createElement(Group, { x: -(width - w), clip: clipRect(w, height) }, frosted),\n )\n }\n case 'from-bottom': {\n const h = height * p\n return createElement(\n Group,\n { y: height - h },\n createElement(Group, { y: -(height - h), clip: clipRect(width, h) }, frosted),\n )\n }\n default:\n return createElement(Group, { clip: clipRect(width * p, height) }, frosted)\n }\n }\n}\n\n// Deterministic per-cell phase for the grid scatter (a hashed fract, stable\n// across renders — no Math.random, so the reveal is identical every frame).\nfunction cellPhase(i: number, j: number): number {\n const n = Math.sin(i * 12.9898 + j * 78.233) * 43758.5453\n return n - Math.floor(n)\n}\n\n/** Grid pixelate: the incoming scene fills in as a grid of blocks, each popping\n * on in a deterministic scatter (a blocky reveal — true pixelation needs an\n * engine sampling pass). */\nexport function gridPixelate({\n cols = 16,\n rows = 9,\n}: { cols?: number; rows?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n if (progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const cw = width / cols\n const ch = height / rows\n let d = ''\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) {\n if (cellPhase(i, j) < progress) {\n const x = round(i * cw)\n const y = round(j * ch)\n d += `M ${x} ${y} L ${round(x + cw)} ${y} L ${round(x + cw)} ${round(y + ch)} L ${x} ${round(y + ch)} Z `\n }\n }\n }\n if (d === '') return createElement(Group, { opacity: 0 }, children)\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\n/** Type mask: the incoming scene reveals through a row of vertical bars that\n * widen into place — a typographic blinds reveal. */\nexport function typeMask({ bars = 12 }: { bars?: number } = {}): TransitionPresentation {\n return (children, { progress, entering, width, height }) => {\n if (!entering)\n return createElement(Group, { opacity: Math.max(0, 1 - progress / 0.7) }, children)\n if (progress >= 1) return createElement(Group, {}, children)\n if (progress <= 0) return createElement(Group, { opacity: 0 }, children)\n const slot = width / bars\n const w = round(slot * Math.min(1, progress))\n let d = ''\n for (let i = 0; i < bars; i++) {\n const x = round(i * slot)\n d += `M ${x} 0 L ${round(x + w)} 0 L ${round(x + w)} ${round(height)} L ${x} ${round(height)} Z `\n }\n return createElement(Group, { clip: clipPath(d) }, children)\n }\n}\n\n/** Alias of {@link fade} — Studio's \"cross-fade\" slug. */\nexport const crossFade = fade\n\n// ---------------------------------------------------------------------------\n// <TransitionSeries>\n// ---------------------------------------------------------------------------\n\nexport interface TransitionSeriesSequenceProps {\n durationInFrames: number\n children?: ReactNode\n}\n\nexport interface TransitionSeriesTransitionProps {\n presentation: TransitionPresentation\n timing: TransitionTiming\n}\n\n// Marker components; never rendered directly — <TransitionSeries> reads props.\nfunction TransitionSequence(_props: TransitionSeriesSequenceProps): ReactElement | null {\n return null\n}\nfunction TransitionTransition(_props: TransitionSeriesTransitionProps): ReactElement | null {\n return null\n}\n\n/** Renders one sequence's content with its entering/exiting presentations\n * applied, reading the (sequence-local) frame to compute progress. */\nfunction TransitionItem({\n duration,\n enter,\n exit,\n children,\n}: {\n duration: number\n enter?: { presentation: TransitionPresentation; timing: TransitionTiming }\n exit?: { presentation: TransitionPresentation; timing: TransitionTiming }\n children: ReactNode\n}): ReactElement {\n const frame = useCurrentFrame()\n const { fps, width, height } = useVideoConfig()\n\n let content: ReactNode = children\n if (exit) {\n const t = exit.timing.durationInFrames\n const start = duration - t\n const progress = frame >= start ? exit.timing.getProgress(frame - start, fps) : 0\n content = exit.presentation(content, { progress, entering: false, width, height })\n }\n if (enter) {\n const t = enter.timing.durationInFrames\n const progress = frame < t ? enter.timing.getProgress(frame, fps) : 1\n content = enter.presentation(content, { progress, entering: true, width, height })\n }\n return createElement(Group, null, content)\n}\n\nfunction TransitionSeriesRoot({ children }: { children?: ReactNode }): ReactElement {\n // Flatten children into an alternating [seq, (transition, seq)*] list.\n const items = Children.toArray(children).filter(isValidElement)\n const sequences: TransitionSeriesSequenceProps[] = []\n const transitions: (TransitionSeriesTransitionProps | null)[] = [] // transition AFTER sequence i\n\n for (const el of items) {\n if (el.type === TransitionSequence) {\n sequences.push(el.props as TransitionSeriesSequenceProps)\n transitions.push(null)\n } else if (el.type === TransitionTransition) {\n if (sequences.length === 0 || transitions[transitions.length - 1] != null) {\n throw new Error('<TransitionSeries.Transition> must sit between two sequences')\n }\n transitions[transitions.length - 1] = el.props as TransitionSeriesTransitionProps\n } else {\n throw new Error(\n '<TransitionSeries> children must be <TransitionSeries.Sequence> or .Transition',\n )\n }\n }\n\n // Place each sequence; a transition before a sequence overlaps it by its duration.\n let offset = 0\n const rendered: ReactElement[] = []\n for (const [i, seq] of sequences.entries()) {\n const before = i > 0 ? (transitions[i - 1] ?? null) : null\n const after = transitions[i] ?? null\n const enter = before ? { presentation: before.presentation, timing: before.timing } : undefined\n const exit = after ? { presentation: after.presentation, timing: after.timing } : undefined\n\n rendered.push(\n createElement(\n Sequence,\n { key: i, from: offset, durationInFrames: seq.durationInFrames },\n createElement(TransitionItem, {\n duration: seq.durationInFrames,\n enter,\n exit,\n // biome-ignore lint/correctness/noChildrenProp: raw createElement props object, not JSX\n children: seq.children,\n }),\n ),\n )\n\n offset += seq.durationInFrames - (after ? after.timing.durationInFrames : 0)\n }\n\n return createElement(Group, null, ...rendered)\n}\n\n/** Play sequences back-to-back with overlapping transitions between them. */\nexport const TransitionSeries = Object.assign(TransitionSeriesRoot, {\n Sequence: TransitionSequence,\n Transition: TransitionTransition,\n})\n","//! react-reconciler host config.\n//!\n//! ONDA's scene graph is a static snapshot, so this renderer just builds a\n//! mutable tree of [`HostNode`]s as React reconciles, which `reconciler.ts` then\n//! serializes once. Mutation mode; targets **react-reconciler 0.33 (React 19)**.\n\nimport { createContext } from 'react'\nimport type ReactReconciler from 'react-reconciler'\nimport { DefaultEventPriority } from 'react-reconciler/constants.js'\n\n/** An intermediate node built while reconciling, later mapped to a scene node. */\nexport interface HostNode {\n type: string\n props: Record<string, unknown>\n children: HostNode[]\n /** Text content, for `onda-text` (see `shouldSetTextContent`). */\n text?: string\n}\n\n/** The render target: holds the top-level element(s). */\nexport interface RootContainer {\n children: HostNode[]\n}\n\ntype Props = Record<string, unknown>\n// Must be NON-NULL: react-reconciler uses `null` as its internal NO_CONTEXT\n// sentinel, so returning `null` here trips \"Expected host context to exist\".\n// ONDA needs no host context, so a single shared empty object suffices.\ntype HostContext = Record<string, never>\nconst HOST_CONTEXT: HostContext = {}\ntype TimeoutHandle = ReturnType<typeof setTimeout>\n\n/** Flatten React text children (string/number, possibly nested arrays) to text. */\nfunction childrenToText(children: unknown): string {\n if (children == null || children === false || children === true) return ''\n if (Array.isArray(children)) return children.map(childrenToText).join('')\n if (typeof children === 'string') return children\n if (typeof children === 'number') return String(children)\n return ''\n}\n\n// react-reconciler 0.33 requires a host-transition context (React 19's <form>\n// action transitions). ONDA renders static frames — no transitions — so the\n// status is always null.\nconst HostTransitionContext = createContext<null>(null)\n\n// 0.33 replaced `getCurrentEventPriority` with explicit update-priority\n// tracking. A static one-shot render has no real event priority — track the\n// last set value and default to `DefaultEventPriority`.\nlet currentUpdatePriority: number = DefaultEventPriority\n\nexport const hostConfig: ReactReconciler.HostConfig<\n string, // Type\n Props, // Props\n RootContainer, // Container\n HostNode, // Instance\n HostNode, // TextInstance\n never, // SuspenseInstance\n never, // HydratableInstance\n never, // FormInstance\n HostNode, // PublicInstance\n HostContext, // HostContext\n never, // ChildSet\n TimeoutHandle, // TimeoutHandle\n -1, // NoTimeout\n null // TransitionStatus\n> = {\n supportsMutation: true,\n supportsPersistence: false,\n supportsHydration: false,\n isPrimaryRenderer: true,\n\n noTimeout: -1,\n scheduleTimeout: (fn, delay) => setTimeout(fn, delay),\n cancelTimeout: (handle) => clearTimeout(handle),\n\n createInstance(type, props) {\n const node: HostNode = { type, props, children: [] }\n if (type === 'onda-text') node.text = childrenToText(props.children)\n return node\n },\n\n createTextInstance(text) {\n return { type: '#text', props: {}, children: [], text }\n },\n\n appendInitialChild(parent, child) {\n parent.children.push(child)\n },\n finalizeInitialChildren() {\n return false\n },\n\n shouldSetTextContent(type) {\n return type === 'onda-text'\n },\n\n getRootHostContext() {\n return HOST_CONTEXT\n },\n getChildHostContext(parentContext) {\n return parentContext\n },\n getPublicInstance(instance) {\n return instance\n },\n\n prepareForCommit() {\n return null\n },\n resetAfterCommit() {},\n preparePortalMount() {},\n\n // 0.33: `prepareUpdate` is gone; `commitUpdate` receives the new props\n // directly (no diff payload) and applies them.\n commitUpdate(instance, type, _prevProps, nextProps) {\n instance.props = nextProps\n if (type === 'onda-text') instance.text = childrenToText(nextProps.children)\n },\n commitTextUpdate(textInstance, _oldText, newText) {\n textInstance.text = newText\n },\n resetTextContent() {},\n commitMount() {},\n\n appendChild(parent, child) {\n parent.children.push(child)\n },\n appendChildToContainer(container, child) {\n container.children.push(child)\n },\n insertBefore(parent, child, beforeChild) {\n const index = parent.children.indexOf(beforeChild)\n parent.children.splice(index < 0 ? parent.children.length : index, 0, child)\n },\n insertInContainerBefore(container, child, beforeChild) {\n const index = container.children.indexOf(beforeChild)\n container.children.splice(index < 0 ? container.children.length : index, 0, child)\n },\n removeChild(parent, child) {\n const index = parent.children.indexOf(child)\n if (index >= 0) parent.children.splice(index, 1)\n },\n removeChildFromContainer(container, child) {\n const index = container.children.indexOf(child)\n if (index >= 0) container.children.splice(index, 1)\n },\n clearContainer(container) {\n container.children.length = 0\n },\n\n getInstanceFromNode() {\n return null\n },\n beforeActiveInstanceBlur() {},\n afterActiveInstanceBlur() {},\n prepareScopeUpdate() {},\n getInstanceFromScope() {\n return null\n },\n detachDeletedInstance() {},\n\n // ── react-reconciler 0.33 (React 19) additions ─────────────────────────────\n // ONDA is a static, single-pass renderer with no suspense, forms, or\n // transitions, so these are inert (return the \"nothing pending / never\n // suspend / commit immediately\" answers).\n setCurrentUpdatePriority(newPriority) {\n currentUpdatePriority = newPriority\n },\n getCurrentUpdatePriority() {\n return currentUpdatePriority\n },\n resolveUpdatePriority() {\n return DefaultEventPriority\n },\n NotPendingTransition: null,\n // React's public `Context` type omits the internal fields (`_currentValue`,\n // `_threadCount`) the reconciler reads; the runtime object has them.\n // biome-ignore lint/suspicious/noExplicitAny: bridge React's public Context to the reconciler's ReactContext.\n HostTransitionContext: HostTransitionContext as any,\n resetFormInstance() {},\n requestPostPaintCallback() {},\n shouldAttemptEagerTransition() {\n return false\n },\n trackSchedulerEvent() {},\n resolveEventType() {\n return null\n },\n resolveEventTimeStamp() {\n return -1\n },\n maySuspendCommit() {\n return false\n },\n preloadInstance() {\n return true // already \"loaded\" — never suspends the commit\n },\n startSuspendingCommit() {},\n suspendInstance() {},\n waitForCommitToBeReady() {\n return null // commit is always ready immediately\n },\n}\n","//! Render a React element tree into an ONDA scene graph.\n\nimport { type ReactElement, createElement } from 'react'\nimport Reconciler from 'react-reconciler'\nimport { type ClipInput, parseClip } from './clip.js'\nimport { type ColorInput, parseColor } from './color.js'\nimport { Composition, type CompositionProps, type TextRunInput } from './components.js'\nimport { FrameContext, type VideoConfig } from './frame.js'\nimport { type GradientInput, parseGradient } from './gradient.js'\nimport { type HostNode, type RootContainer, hostConfig } from './host-config.js'\nimport type {\n BooleanOp,\n BooleanOperand,\n Camera3D,\n Color,\n Effect,\n Extrude,\n Finish,\n Gradient,\n Layout,\n NodeKind,\n Scene,\n SceneNode,\n Shadow,\n ShapeGeometry,\n Stroke,\n Transform,\n Transform3D,\n} from './scene.js'\n\nconst reconciler = Reconciler(hostConfig)\n\n/** The frame context active during the current {@link renderFrame} pass\n * (`{ ...VideoConfig, frame }`). Captured here so {@link elementToNode} can\n * reconcile a `matte` prop-element under the SAME frame context as the main\n * tree — its hooks (`useCurrentFrame`/`useVideoConfig`) read the live frame, so\n * the matte animates per-frame just like the content. `null` outside a render. */\nlet activeFrameState: (VideoConfig & { frame: number }) | null = null\n\n/** Resolved depth-of-field for the comp being rendered (`<Composition dof={…}>`), or\n * `null`. Set per render so {@link toNode} can defocus any layer carrying a `depth`. */\nlet activeDof: { focus: number; aperture: number; range: number; maxBlur: number } | null = null\n\n/** Render `element` (root must be `<Composition>`) at `frame` to a static\n * {@link Scene}. Components read the frame via {@link useCurrentFrame}. */\nexport function renderFrame(element: ReactElement, frame: number): Scene {\n const config = videoConfig(element)\n const frameState = { ...config, frame }\n const prevFrameState = activeFrameState\n activeFrameState = frameState\n try {\n const container: RootContainer = { children: [] }\n const root = reconciler.createContainer(\n container,\n 0, // LegacyRoot — renders synchronously\n null, // hydrationCallbacks\n false, // isStrictMode\n null, // concurrentUpdatesByDefaultOverride\n '', // identifierPrefix\n (error: Error) => {\n throw error // onUncaughtError\n },\n (error: Error) => {\n throw error // onCaughtError\n },\n () => {}, // onRecoverableError — non-fatal (e.g. hydration); ignore\n () => {}, // onDefaultTransitionIndicator — no transitions in a static render\n )\n // React 19's reconciler no longer flushes the initial mount synchronously via\n // `updateContainer`; use the explicit sync API so ONDA can read the built tree\n // immediately after.\n reconciler.updateContainerSync(\n createElement(FrameContext.Provider, { value: frameState }, element),\n root,\n null,\n null,\n )\n reconciler.flushSyncWork()\n\n const top = container.children[0]\n if (container.children.length !== 1 || !top || top.type !== 'onda-composition') {\n throw new Error('render: the root element must be a single <Composition>')\n }\n const scene = compositionToScene(top)\n // Unmount (runs effect cleanups), synchronously.\n reconciler.updateContainerSync(null, root, null, null)\n reconciler.flushSyncWork()\n return scene\n } finally {\n activeFrameState = prevFrameState\n }\n}\n\n/** Render the composition once, at frame 0. */\nexport function renderToScene(element: ReactElement): Scene {\n return renderFrame(element, 0)\n}\n\n/** The MOTION BLUR config declared on `<Composition motionBlur={…}>`, normalised, or\n * `undefined` when off. `true` → a 180° shutter at 16 samples; `samples < 2` is off.\n * Exported so the export orchestration can pass the matching `--motion-blur K`. */\nexport function motionBlurConfig(\n element: ReactElement,\n): { shutter: number; samples: number } | undefined {\n const mb = (element.props as Record<string, unknown>).motionBlur\n if (!mb) return undefined\n if (mb === true) return { shutter: 180, samples: 16 }\n if (typeof mb !== 'object') return undefined\n const o = mb as { shutter?: number; samples?: number }\n const samples = typeof o.samples === 'number' ? Math.max(1, Math.round(o.samples)) : 16\n if (samples < 2) return undefined // a single sample is just the sharp frame\n const shutter = typeof o.shutter === 'number' ? Math.min(720, Math.max(1, o.shutter)) : 180\n return { shutter, samples }\n}\n\n/** The scene(s) for ONE output frame: a single render normally, or `samples`\n * sub-frames spread symmetrically across the shutter window when motion blur is on\n * (the CLI's `--motion-blur K` averages each group of K back into one frame). */\nfunction outputFrameScenes(\n element: ReactElement,\n frame: number,\n mb: { shutter: number; samples: number } | undefined,\n): Scene[] {\n if (!mb) return [renderFrame(element, frame)]\n const shutterFrames = mb.shutter / 360 // shutter-open time, in frames\n const scenes: Scene[] = []\n for (let i = 0; i < mb.samples; i++) {\n const t = ((i + 0.5) / mb.samples - 0.5) * shutterFrames\n scenes.push(renderFrame(element, frame + t))\n }\n return scenes\n}\n\n/** Render every frame `0..durationInFrames` to static scenes. With\n * `<Composition motionBlur>`, each frame expands to `samples` sub-frame scenes for\n * the CLI to average (so the array length is `durationInFrames × samples`). */\nexport function renderFrames(element: ReactElement): Scene[] {\n const { durationInFrames } = videoConfig(element)\n const mb = motionBlurConfig(element)\n const frames: Scene[] = []\n for (let frame = 0; frame < durationInFrames; frame++) {\n frames.push(...outputFrameScenes(element, frame, mb))\n }\n return frames\n}\n\n/** Render a sub-range `[startFrame, endFrame)` to static scenes.\n * The returned array starts at index 0; the scenes carry the original frame\n * numbers so `useCurrentFrame()` reads the correct composition time. Motion blur\n * expands each frame to `samples` sub-frames, exactly like {@link renderFrames}. */\nexport function renderFramesRange(\n element: ReactElement,\n startFrame: number,\n endFrame: number,\n): Scene[] {\n const mb = motionBlurConfig(element)\n const frames: Scene[] = []\n for (let frame = startFrame; frame < endFrame; frame++) {\n frames.push(...outputFrameScenes(element, frame, mb))\n }\n return frames\n}\n\n/** Render frame 0 to a JSON string (for `onda render`). */\nexport function renderToSceneJSON(element: ReactElement, space = 2): string {\n return JSON.stringify(renderToScene(element), null, space)\n}\n\n/** Render all frames to a JSON array of scenes (for `onda export-frames`). */\nexport function renderFramesJSON(element: ReactElement, space = 0): string {\n return JSON.stringify(renderFrames(element), null, space)\n}\n\n/** Render a sub-range `[startFrame, endFrame)` to a JSON array (for `onda export-frames`).\n * Produces a short clip covering only those frames — useful for fast scene-level iteration. */\nexport function renderFrameRangeJSON(\n element: ReactElement,\n startFrame: number,\n endFrame: number,\n space = 0,\n): string {\n return JSON.stringify(renderFramesRange(element, startFrame, endFrame), null, space)\n}\n\nfunction videoConfig(element: ReactElement): VideoConfig {\n if (element.type !== Composition) {\n throw new Error('render: the root element must be a <Composition>')\n }\n const props = element.props as Record<string, unknown>\n return {\n width: numberProp(props, 'width', 'Composition'),\n height: numberProp(props, 'height', 'Composition'),\n fps: numberProp(props, 'fps', 'Composition'),\n durationInFrames: numberProp(props, 'durationInFrames', 'Composition'),\n }\n}\n\n/** Build a scene-level {@link Finish} from the `<Composition finish={...}>` prop —\n * pass through the numeric fields, dropping anything malformed so a bad value can't\n * corrupt the scene JSON (validate at the boundary). */\nfunction parseFinish(f: NonNullable<CompositionProps['finish']>): Finish {\n const out: Finish = {}\n if (typeof f.exposure === 'number') out.exposure = f.exposure\n if (f.bloom && typeof f.bloom.sigma === 'number') {\n out.bloom = { sigma: f.bloom.sigma }\n if (typeof f.bloom.threshold === 'number') out.bloom.threshold = f.bloom.threshold\n if (typeof f.bloom.intensity === 'number') out.bloom.intensity = f.bloom.intensity\n }\n if (typeof f.halation === 'number') out.halation = f.halation\n if (typeof f.temperature === 'number') out.temperature = f.temperature\n if (typeof f.contrast === 'number') out.contrast = f.contrast\n if (typeof f.saturation === 'number') out.saturation = f.saturation\n if (typeof f.vignette === 'number') out.vignette = f.vignette\n if (typeof f.grain === 'number' && f.grain > 0) {\n out.grain = f.grain\n // Inject the current frame as the seed so grain *lives* (varies per frame).\n out.grain_seed = activeFrameState?.frame ?? 0\n }\n // A 3D color LUT — only if well-formed (size ≥ 2 and `table` holds exactly\n // size³ RGB triples). A malformed cube is dropped at the boundary so the\n // renderer never trilinear-samples out of bounds.\n if (\n f.lut &&\n typeof f.lut.size === 'number' &&\n f.lut.size >= 2 &&\n Array.isArray(f.lut.table) &&\n f.lut.table.length === f.lut.size ** 3 * 3\n ) {\n out.lut = { size: f.lut.size, table: f.lut.table }\n }\n return out\n}\n\n/** Resolve the `<Composition dof={…}>` prop (depth of field) with defaults, or null. */\nfunction parseDof(\n dof: CompositionProps['dof'],\n): { focus: number; aperture: number; range: number; maxBlur: number } | null {\n if (!dof || typeof dof.focus !== 'number') return null\n return {\n focus: dof.focus,\n aperture: typeof dof.aperture === 'number' ? dof.aperture : 0.04,\n range: typeof dof.range === 'number' ? dof.range : 0,\n maxBlur: typeof dof.maxBlur === 'number' ? dof.maxBlur : 40,\n }\n}\n\n/** Blur σ (px) for a layer at `depth` under the active depth of field — a circle of\n * confusion that grows linearly with distance from the in-focus band. */\nfunction dofBlur(depth: number, dof: NonNullable<ReturnType<typeof parseDof>>): number {\n const dist = Math.max(0, Math.abs(depth - dof.focus) - dof.range)\n return Math.min(dist * dof.aperture, dof.maxBlur)\n}\n\nfunction isVec3(v: unknown): v is [number, number, number] {\n return Array.isArray(v) && v.length === 3 && v.every((n) => typeof n === 'number')\n}\nfunction isVec2(v: unknown): v is [number, number] {\n return Array.isArray(v) && v.length === 2 && v.every((n) => typeof n === 'number')\n}\n\n/** Resolve a `<Scene3D camera>` prop into a scene `Camera3D`, keeping only set fields\n * (the engine derives the rest to frame the z = 0 plane). */\nfunction parseCamera3D(input: unknown): Camera3D {\n const c = (input ?? {}) as Record<string, unknown>\n const out: Camera3D = {}\n if (isVec3(c.position)) out.position = c.position\n if (isVec3(c.target)) out.target = c.target\n if (isVec3(c.up)) out.up = c.up\n if (typeof c.fov === 'number') out.fov = c.fov\n if (typeof c.near === 'number') out.near = c.near\n if (typeof c.far === 'number') out.far = c.far\n return out\n}\n\n/** Resolve a layer's `extrude` prop (a `depth` number or `{ depth }`) into an\n * `Extrude`, or null when absent / non-positive. */\nfunction parseExtrude(input: unknown): Extrude | null {\n if (typeof input === 'number') return input > 0 ? { depth: input } : null\n if (input && typeof input === 'object') {\n const d = (input as { depth?: unknown }).depth\n if (typeof d === 'number' && d > 0) return { depth: d }\n }\n return null\n}\n\n/** Build a layer's `Transform3D` from its `position3d`/`rotation3d`/`anchor3d` props,\n * or null when the layer carries none (so it serializes only where used). */\nfunction parseTransform3D(props: Record<string, unknown>): Transform3D | null {\n const { position3d, rotation3d, anchor3d } = props\n if (!isVec3(position3d) && !isVec3(rotation3d) && !isVec2(anchor3d)) return null\n const out: Transform3D = {}\n if (isVec3(position3d)) out.position = position3d\n if (isVec3(rotation3d)) out.rotation = rotation3d\n if (isVec2(anchor3d)) out.anchor = anchor3d\n return out\n}\n\nfunction compositionToScene(node: HostNode): Scene {\n const { props } = node\n // Depth of field: read by every descendant's `toNode` via the module-level activeDof.\n activeDof = parseDof(props.dof as CompositionProps['dof'])\n const children = node.children.length ? node.children.map(toNode) : null\n activeDof = null\n return {\n composition: {\n width: numberProp(props, 'width', 'Composition'),\n height: numberProp(props, 'height', 'Composition'),\n fps: numberProp(props, 'fps', 'Composition'),\n duration_in_frames: numberProp(props, 'durationInFrames', 'Composition'),\n // Opt-in cinematic LINEAR + ACES finishing (gpu/export only); omitted (→ gamma)\n // unless explicitly enabled, so existing scenes stay byte-identical.\n ...(props.linear === true ? { linear: true } : {}),\n // Composition-level cinematic FINISH (linear-HDR chain + ACES); omitted unless set.\n ...(props.finish ? { finish: parseFinish(props.finish) } : {}),\n },\n root: {\n kind: { type: 'group' },\n ...(children ? { children } : {}),\n },\n }\n}\n\n/** Reconcile a SINGLE prop-element (e.g. a `matte` subtree) into one\n * {@link SceneNode}. Mirrors {@link renderFrame}'s machinery — create a fresh\n * container, render the element, flush synchronously, take the single root host\n * child, and {@link toNode} it — but for one element rather than a whole tree.\n *\n * The element is wrapped in the SAME {@link FrameContext} as the main tree (the\n * module-level {@link activeFrameState}, set by the enclosing `renderFrame`), so\n * its hooks (`useCurrentFrame`/`useVideoConfig`) read the live frame and the\n * matte ANIMATES per-frame — `renderFrames` re-runs this for every frame. The\n * prop-element must resolve to exactly one root host node (e.g. a single\n * `<Text>`/`<Rect>`/`<Group>`); wrap multiple nodes in a `<Group>`. */\nfunction elementToNode(element: ReactElement): SceneNode {\n const container: RootContainer = { children: [] }\n const root = reconciler.createContainer(\n container,\n 0, // LegacyRoot — renders synchronously\n null,\n false,\n null,\n '',\n (error: Error) => {\n throw error\n },\n (error: Error) => {\n throw error\n },\n () => {},\n () => {},\n )\n // Reconcile under the active frame context so the matte animates per-frame.\n const wrapped = activeFrameState\n ? createElement(FrameContext.Provider, { value: activeFrameState }, element)\n : element\n reconciler.updateContainerSync(wrapped, root, null, null)\n reconciler.flushSyncWork()\n const top = container.children[0]\n if (container.children.length !== 1 || !top) {\n throw new Error(\n 'matte: the matte element must resolve to a single node (wrap many in a <Group>)',\n )\n }\n const node = toNode(top)\n reconciler.updateContainerSync(null, root, null, null)\n reconciler.flushSyncWork()\n return node\n}\n\nfunction toNode(node: HostNode): SceneNode {\n const { props } = node\n const base: Omit<SceneNode, 'kind'> = {}\n if (typeof props.id === 'number') base.id = props.id\n const transform = transformOf(props)\n if (transform) base.transform = transform\n if (typeof props.opacity === 'number') base.opacity = props.opacity\n if (props.clip !== undefined) base.clip = parseClip(props.clip as ClipInput)\n if (props.matte !== undefined) {\n base.matte = {\n mode: props.matteMode === 'luminance' ? 'luminance' : 'alpha',\n source: elementToNode(props.matte as ReactElement),\n }\n }\n if (typeof props.blendMode === 'string') base.blend = props.blendMode as SceneNode['blend']\n const effects: Effect[] = Array.isArray(props.effects) ? [...(props.effects as Effect[])] : []\n if (typeof props.blur === 'number' && props.blur > 0)\n effects.unshift({ effect: 'blur', sigma: props.blur })\n const directionalBlur = parseDirectionalBlur(props.directionalBlur)\n if (directionalBlur) effects.unshift(directionalBlur)\n const chromaticAberration = parseChromaticAberration(props.chromaticAberration)\n if (chromaticAberration) effects.push(chromaticAberration)\n const vignette = parseVignette(props.vignette)\n if (vignette) effects.push(vignette)\n const posterize = parsePosterize(props.posterize)\n if (posterize) effects.push(posterize)\n const duotone = parseDuotone(props.duotone)\n if (duotone) effects.push(duotone)\n const chromaKey = parseChromaKey(props.chromaKey)\n if (chromaKey) effects.push(chromaKey)\n const bloom = parseBloom(props.bloom)\n if (bloom) effects.push(bloom)\n const grade = parseGrade(props.grade)\n if (grade) effects.push(grade)\n const goo = parseGoo(props.goo)\n if (goo) effects.push(goo)\n const grain = parseGrain(props.grain)\n if (grain) effects.push(grain)\n const backdropBlur = parseBackdropBlur(props.backdropBlur)\n if (backdropBlur) effects.push(backdropBlur)\n const lightWrap = parseLightWrap(props.lightWrap)\n if (lightWrap) effects.push(lightWrap)\n // Depth of field: a layer carrying `depth` defocuses by its distance from the comp's\n // focus plane — a per-layer blur, so a rack focus is just animating the comp's `focus`.\n if (activeDof && typeof props.depth === 'number') {\n const sigma = dofBlur(props.depth, activeDof)\n if (sigma > 0.4) effects.unshift({ effect: 'blur', sigma })\n }\n if (effects.length) base.effects = effects\n // 3D: a `camera3d` prop makes this node a 3D scene root; `position3d`/`rotation3d`/\n // `anchor3d` place this node as a layer inside an ancestor 3D scene.\n if (props.camera3d !== undefined) base.camera3d = parseCamera3D(props.camera3d)\n const transform3d = parseTransform3D(props)\n if (transform3d) base.transform3d = transform3d\n const extrude = parseExtrude(props.extrude)\n if (extrude) base.extrude = extrude\n if (props.layout !== undefined) base.layout = parseLayout(props.layout as Layout)\n const children = node.children.map(toNode)\n const withChildren = children.length ? { children } : {}\n\n switch (node.type) {\n case 'onda-group':\n return { ...base, kind: { type: 'group' }, ...withChildren }\n\n case 'onda-rect': {\n const geometry: ShapeGeometry = {\n shape: 'rect',\n size: {\n width: numberProp(props, 'width', 'Rect'),\n height: numberProp(props, 'height', 'Rect'),\n },\n ...(typeof props.cornerRadius === 'number' ? { corner_radius: props.cornerRadius } : {}),\n }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-ellipse': {\n const geometry: ShapeGeometry = {\n shape: 'ellipse',\n size: {\n width: numberProp(props, 'width', 'Ellipse'),\n height: numberProp(props, 'height', 'Ellipse'),\n },\n }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-path': {\n const geometry: ShapeGeometry = { shape: 'path', data: stringProp(props, 'd', 'Path') }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) }, ...withChildren }\n }\n\n case 'onda-boolean': {\n const op: BooleanOp =\n props.op === 'difference' || props.op === 'intersect' || props.op === 'xor'\n ? props.op\n : 'union'\n // Fold the (already-built) shape children into operands — geometry + the child's\n // own transform. They're consumed by the boolean, not drawn separately, so the\n // result is a single shape node with no children.\n const operands: BooleanOperand[] = []\n for (const c of children) {\n if (c.kind.type === 'shape') {\n operands.push({ geometry: c.kind.geometry, transform: c.transform ?? {} })\n }\n }\n const geometry: ShapeGeometry = { shape: 'boolean', op, operands }\n return { ...base, kind: { type: 'shape', geometry, ...fillStroke(props) } }\n }\n\n case 'onda-text': {\n const kind: Extract<NodeKind, { type: 'text' }> = {\n type: 'text',\n content: node.text ?? '',\n ...(typeof props.fontSize === 'number' ? { font_size: props.fontSize } : {}),\n ...(props.color !== undefined ? { color: parseColor(props.color as never) } : {}),\n ...(typeof props.fontFamily === 'string' ? { font_family: props.fontFamily } : {}),\n ...(typeof props.fontWeight === 'number' ? { weight: props.fontWeight } : {}),\n ...(props.italic === true ? { italic: true } : {}),\n ...(typeof props.letterSpacing === 'number' ? { letter_spacing: props.letterSpacing } : {}),\n }\n if (Array.isArray(props.runs)) {\n kind.runs = (props.runs as TextRunInput[]).map((r) => ({\n text: r.text,\n ...(r.color !== undefined ? { color: parseColor(r.color) } : {}),\n ...(typeof r.fontSize === 'number' ? { font_size: r.fontSize } : {}),\n ...(typeof r.fontFamily === 'string' ? { font_family: r.fontFamily } : {}),\n ...(typeof r.fontWeight === 'number' ? { weight: r.fontWeight } : {}),\n ...(r.italic === true ? { italic: true } : {}),\n }))\n }\n return { ...base, kind, ...withChildren }\n }\n\n case 'onda-image':\n return {\n ...base,\n kind: {\n type: 'image',\n src: stringProp(props, 'src', 'Image'),\n ...(typeof props.width === 'number' ? { width: props.width } : {}),\n ...(typeof props.height === 'number' ? { height: props.height } : {}),\n ...(props.fit === 'fill' || props.fit === 'cover' || props.fit === 'contain'\n ? { fit: props.fit }\n : {}),\n ...(typeof props.blur === 'number' && props.blur > 0 ? { blur: props.blur } : {}),\n },\n ...withChildren,\n }\n\n case 'onda-video':\n return {\n ...base,\n kind: {\n type: 'video',\n src: stringProp(props, 'src', 'Video'),\n ...(typeof props.time === 'number' ? { time: props.time } : {}),\n ...(typeof props.width === 'number' ? { width: props.width } : {}),\n ...(typeof props.height === 'number' ? { height: props.height } : {}),\n ...(props.fit === 'fill' || props.fit === 'cover' || props.fit === 'contain'\n ? { fit: props.fit }\n : {}),\n ...(props.previewFallback === 'element' || props.previewFallback === 'skip'\n ? { previewFallback: props.previewFallback }\n : {}),\n },\n ...withChildren,\n }\n\n case 'onda-audio':\n return {\n ...base,\n kind: {\n type: 'audio',\n src: stringProp(props, 'src', 'Audio'),\n ...(typeof props.start === 'number' ? { start: props.start } : {}),\n ...(typeof props.startAt === 'number' ? { start_at: props.startAt } : {}),\n ...(typeof props.volume === 'number' ? { volume: props.volume } : {}),\n },\n ...withChildren,\n }\n\n case 'onda-svg': {\n if (typeof props.src !== 'string' && typeof props.markup !== 'string') {\n throw new Error(\"<Svg> requires a 'src' or 'markup' prop\")\n }\n return {\n ...base,\n kind: {\n type: 'svg',\n ...(typeof props.src === 'string' ? { src: props.src } : {}),\n ...(typeof props.markup === 'string' ? { markup: props.markup } : {}),\n },\n ...withChildren,\n }\n }\n\n case '#text':\n throw new Error(\n `renderToScene: raw text \"${String(node.text ?? '').slice(0, 60)}\" was placed inside a non-Text node. String children are only valid inside <Text>. Wrap it: h(Text, { x, y, fontSize, color }, '${String(node.text ?? '').slice(0, 30)}')`,\n )\n\n default:\n throw new Error(\n `renderToScene: unsupported element type \"${node.type}\". Only ONDA primitives (Group/Rect/Ellipse/Path/Text/Image/Video/Svg) are valid. DOM elements like <div>/<span> and custom types are not rendered — use @onda-engine/react primitives only.`,\n )\n }\n}\n\nfunction transformOf(props: Record<string, unknown>): Transform | undefined {\n const transform: Transform = {}\n if (typeof props.x === 'number' || typeof props.y === 'number') {\n transform.translate = { x: (props.x as number) ?? 0, y: (props.y as number) ?? 0 }\n }\n if (typeof props.scaleX === 'number' || typeof props.scaleY === 'number') {\n transform.scale = { x: (props.scaleX as number) ?? 1, y: (props.scaleY as number) ?? 1 }\n }\n if (typeof props.rotation === 'number') {\n transform.rotate = props.rotation\n }\n if (typeof props.originX === 'number' || typeof props.originY === 'number') {\n transform.origin = { x: (props.originX as number) ?? 0, y: (props.originY as number) ?? 0 }\n }\n return transform.translate ||\n transform.scale ||\n transform.rotate !== undefined ||\n transform.origin\n ? transform\n : undefined\n}\n\n// Tolerate CSS flexbox spellings on justify/align. The engine's layout enum is\n// `start | center | end` (+ `space-*` for justify), but components ported from\n// the browser — and agent payloads written against CSS — use `flex-start` /\n// `flex-end` / edge words. Normalize here, at the single layout→scene boundary,\n// so every node is forgiving rather than failing scene-graph deserialization.\nconst ALIGN_ALIASES: Record<string, string> = {\n 'flex-start': 'start',\n 'flex-end': 'end',\n left: 'start',\n top: 'start',\n right: 'end',\n bottom: 'end',\n middle: 'center',\n 'space-evenly': 'space-around',\n}\nconst normAlign = (v: unknown): unknown =>\n typeof v === 'string' && v in ALIGN_ALIASES ? ALIGN_ALIASES[v] : v\n\n/** Copy the defined layout fields (names/values already match the scene JSON). */\n/** Resolve the `bloom` sugar prop into a `{ effect: 'bloom', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `sigma`; the object\n * form overrides `threshold` (default 0.7) / `intensity` (default 1). */\n/** Resolve the `directionalBlur` sugar prop into a `{ effect: 'directional_blur', … }`\n * effect, or `undefined` when absent / non-positive sigma. `angle` (radians)\n * defaults to 0 (horizontal). */\nfunction parseDirectionalBlur(\n input: unknown,\n): Extract<Effect, { effect: 'directional_blur' }> | undefined {\n if (input && typeof input === 'object') {\n const d = input as { sigma?: number; angle?: number }\n if (typeof d.sigma === 'number' && d.sigma > 0) {\n return {\n effect: 'directional_blur',\n sigma: d.sigma,\n angle: typeof d.angle === 'number' ? d.angle : 0,\n }\n }\n }\n return undefined\n}\n\nfunction parseChromaticAberration(\n input: unknown,\n): Extract<Effect, { effect: 'chromatic_aberration' }> | undefined {\n return typeof input === 'number' && input > 0\n ? { effect: 'chromatic_aberration', amount: input }\n : undefined\n}\n\nfunction parseVignette(input: unknown): Extract<Effect, { effect: 'vignette' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'vignette', amount: input, softness: 0.5 } : undefined\n }\n if (input && typeof input === 'object') {\n const v = input as { amount?: number; softness?: number }\n if (typeof v.amount === 'number' && v.amount > 0) {\n return {\n effect: 'vignette',\n amount: v.amount,\n softness: typeof v.softness === 'number' ? v.softness : 0.5,\n }\n }\n }\n return undefined\n}\n\nfunction parsePosterize(input: unknown): Extract<Effect, { effect: 'posterize' }> | undefined {\n return typeof input === 'number' && input >= 2\n ? { effect: 'posterize', levels: input }\n : undefined\n}\n\nfunction parseDuotone(input: unknown): Extract<Effect, { effect: 'duotone' }> | undefined {\n if (input && typeof input === 'object') {\n const d = input as { shadow?: ColorInput; highlight?: ColorInput }\n if (d.shadow !== undefined && d.highlight !== undefined) {\n const s = parseColor(d.shadow)\n const h = parseColor(d.highlight)\n return { effect: 'duotone', shadow: [s.r, s.g, s.b], highlight: [h.r, h.g, h.b] }\n }\n }\n return undefined\n}\n\nfunction parseChromaKey(input: unknown): Extract<Effect, { effect: 'chroma_key' }> | undefined {\n if (input && typeof input === 'object') {\n const c = input as { color?: ColorInput; threshold?: number; smoothness?: number }\n if (c.color !== undefined) {\n const k = parseColor(c.color)\n return {\n effect: 'chroma_key',\n key: [k.r, k.g, k.b],\n threshold: typeof c.threshold === 'number' ? c.threshold : 0.4,\n smoothness: typeof c.smoothness === 'number' ? c.smoothness : 0.1,\n }\n }\n }\n return undefined\n}\n\nfunction parseBloom(input: unknown): Extract<Effect, { effect: 'bloom' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'bloom', threshold: 0.7, intensity: 1, sigma: input } : undefined\n }\n if (input && typeof input === 'object') {\n const b = input as { sigma?: number; threshold?: number; intensity?: number }\n if (typeof b.sigma === 'number' && b.sigma > 0) {\n return {\n effect: 'bloom',\n threshold: typeof b.threshold === 'number' ? b.threshold : 0.7,\n intensity: typeof b.intensity === 'number' ? b.intensity : 1,\n sigma: b.sigma,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `grade` sugar prop into a `{ effect: 'color_grade', ... }` effect,\n * or `undefined` when absent or a neutral identity (which would be a render\n * no-op). Each field defaults to the neutral identity (exposure 0, contrast 1,\n * saturation 1, temperature 0, tint 0). */\nfunction parseGrade(input: unknown): Extract<Effect, { effect: 'color_grade' }> | undefined {\n if (!input || typeof input !== 'object') return undefined\n const g = input as {\n exposure?: number\n contrast?: number\n saturation?: number\n temperature?: number\n tint?: number\n }\n const exposure = typeof g.exposure === 'number' ? g.exposure : 0\n const contrast = typeof g.contrast === 'number' ? g.contrast : 1\n const saturation = typeof g.saturation === 'number' ? g.saturation : 1\n const temperature = typeof g.temperature === 'number' ? g.temperature : 0\n const tint = typeof g.tint === 'number' ? g.tint : 0\n // The neutral identity is a no-op — omit it so a plain `grade={{}}` stays a\n // zero-diff (matching the engine's neutral fast path).\n if (exposure === 0 && contrast === 1 && saturation === 1 && temperature === 0 && tint === 0) {\n return undefined\n }\n return { effect: 'color_grade', exposure, contrast, saturation, temperature, tint }\n}\n\n/** Resolve the `goo` sugar prop into a `{ effect: 'goo', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `sigma`; the object\n * form overrides `threshold` (default 0.5). A non-positive `sigma` is dropped\n * (no blur → nothing to fuse). */\nfunction parseGoo(input: unknown): Extract<Effect, { effect: 'goo' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'goo', sigma: input, threshold: 0.5 } : undefined\n }\n if (input && typeof input === 'object') {\n const g = input as { sigma?: number; threshold?: number }\n if (typeof g.sigma === 'number' && g.sigma > 0) {\n return {\n effect: 'goo',\n sigma: g.sigma,\n threshold: typeof g.threshold === 'number' ? g.threshold : 0.5,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `grain` sugar prop into a `{ effect: 'grain', ... }` effect, or\n * `undefined` when absent/degenerate. A bare number is the `intensity`; the object\n * form adds `size` (grain scale in px, default 1) and `seed` (animation offset,\n * default 0). A non-positive `intensity` is dropped (no grain to add). */\nfunction parseGrain(input: unknown): Extract<Effect, { effect: 'grain' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'grain', intensity: input, size: 1, seed: 0 } : undefined\n }\n if (input && typeof input === 'object') {\n const g = input as { intensity?: number; size?: number; seed?: number }\n if (typeof g.intensity === 'number' && g.intensity > 0) {\n return {\n effect: 'grain',\n intensity: g.intensity,\n size: typeof g.size === 'number' ? g.size : 1,\n seed: typeof g.seed === 'number' ? g.seed : 0,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `backdropBlur` sugar prop into a `{ effect: 'backdrop_blur', ... }`\n * effect, or `undefined` when absent/degenerate. A bare number is the `sigma`; the\n * object form adds a `tint` (any {@link ColorInput} — its alpha is the strength),\n * a `brightness` and a `saturation` (both default to the `1` identity). An omitted\n * tint emits transparent `{r:0,g:0,b:0,a:0}`. A non-positive `sigma` is dropped (no\n * blur → nothing to frost). */\nfunction parseBackdropBlur(\n input: unknown,\n): Extract<Effect, { effect: 'backdrop_blur' }> | undefined {\n const TRANSPARENT: Color = { r: 0, g: 0, b: 0, a: 0 }\n if (typeof input === 'number') {\n return input > 0\n ? { effect: 'backdrop_blur', sigma: input, tint: TRANSPARENT, brightness: 1, saturation: 1 }\n : undefined\n }\n if (input && typeof input === 'object') {\n const b = input as {\n sigma?: number\n tint?: ColorInput\n brightness?: number\n saturation?: number\n }\n if (typeof b.sigma === 'number' && b.sigma > 0) {\n return {\n effect: 'backdrop_blur',\n sigma: b.sigma,\n tint: b.tint !== undefined ? parseColor(b.tint) : TRANSPARENT,\n brightness: typeof b.brightness === 'number' ? b.brightness : 1,\n saturation: typeof b.saturation === 'number' ? b.saturation : 1,\n }\n }\n }\n return undefined\n}\n\n/** Resolve the `lightWrap` sugar prop into a `{ effect: 'light_wrap', ... }` effect,\n * or `undefined` when absent/degenerate. A bare number is the `sigma` (backdrop\n * blur / rim width); the object form adds a `strength` (defaults to the `1` natural\n * spill). A non-positive `sigma` is dropped (no spill → nothing to wrap). */\nfunction parseLightWrap(input: unknown): Extract<Effect, { effect: 'light_wrap' }> | undefined {\n if (typeof input === 'number') {\n return input > 0 ? { effect: 'light_wrap', sigma: input, strength: 1 } : undefined\n }\n if (input && typeof input === 'object') {\n const w = input as { sigma?: number; strength?: number }\n if (typeof w.sigma === 'number' && w.sigma > 0) {\n return {\n effect: 'light_wrap',\n sigma: w.sigma,\n strength: typeof w.strength === 'number' ? w.strength : 1,\n }\n }\n }\n return undefined\n}\n\nfunction parseLayout(layout: Layout): Layout {\n const out: Layout = {}\n if (layout.direction !== undefined) out.direction = layout.direction\n if (layout.justify !== undefined) out.justify = normAlign(layout.justify) as Layout['justify']\n if (layout.align !== undefined) out.align = normAlign(layout.align) as Layout['align']\n if (typeof layout.gap === 'number') out.gap = layout.gap\n if (typeof layout.padding === 'number') out.padding = layout.padding\n if (layout.wrap === true) out.wrap = true\n if (typeof layout.width === 'number') out.width = layout.width\n if (typeof layout.height === 'number') out.height = layout.height\n return out\n}\n\nfunction fillStroke(props: Record<string, unknown>): {\n fill?: ReturnType<typeof parseColor>\n gradient?: Gradient\n stroke?: Stroke\n shadow?: Shadow\n} {\n const out: {\n fill?: ReturnType<typeof parseColor>\n gradient?: Gradient\n stroke?: Stroke\n shadow?: Shadow\n } = {}\n if (props.fill !== undefined) out.fill = parseColor(props.fill as never)\n if (props.gradient !== undefined) out.gradient = parseGradient(props.gradient as GradientInput)\n const sh = props.shadow as\n | { color: unknown; blur?: number; offsetX?: number; offsetY?: number; spread?: number }\n | undefined\n if (sh && typeof sh.blur === 'number') {\n out.shadow = {\n color: parseColor(sh.color as never),\n blur: sh.blur,\n ...(typeof sh.offsetX === 'number' || typeof sh.offsetY === 'number'\n ? { offset: { x: sh.offsetX ?? 0, y: sh.offsetY ?? 0 } }\n : {}),\n ...(typeof sh.spread === 'number' ? { spread: sh.spread } : {}),\n }\n }\n if (props.stroke !== undefined) {\n const trim = parseTrim(props)\n out.stroke = {\n color: parseColor(props.stroke as never),\n width: typeof props.strokeWidth === 'number' ? props.strokeWidth : 1,\n ...(props.strokeCap === 'round' || props.strokeCap === 'square'\n ? { cap: props.strokeCap }\n : {}),\n ...(props.strokeJoin === 'round' || props.strokeJoin === 'bevel'\n ? { join: props.strokeJoin }\n : {}),\n ...(Array.isArray(props.strokeDash) && props.strokeDash.length\n ? { dash: props.strokeDash as number[] }\n : {}),\n ...(typeof props.strokeDashOffset === 'number'\n ? { dash_offset: props.strokeDashOffset }\n : {}),\n ...(trim ? { trim } : {}),\n }\n }\n return out\n}\n\n/** Resolve the `trimStart`/`trimEnd`/`trimOffset` props into a stroke {@link Stroke.trim}\n * (the mograph line-draw), or `undefined` when none is set. */\nfunction parseTrim(props: Record<string, unknown>): Stroke['trim'] | undefined {\n const { trimStart, trimEnd, trimOffset } = props\n if (\n typeof trimStart !== 'number' &&\n typeof trimEnd !== 'number' &&\n typeof trimOffset !== 'number'\n ) {\n return undefined\n }\n const trim: NonNullable<Stroke['trim']> = {}\n if (typeof trimStart === 'number') trim.start = trimStart\n if (typeof trimEnd === 'number') trim.end = trimEnd\n if (typeof trimOffset === 'number') trim.offset = trimOffset\n return trim\n}\n\nfunction numberProp(props: Record<string, unknown>, key: string, ctx: string): number {\n const value = props[key]\n if (typeof value !== 'number') throw new Error(`<${ctx}> requires a numeric '${key}' prop`)\n return value\n}\n\nfunction stringProp(props: Record<string, unknown>, key: string, ctx: string): string {\n const value = props[key]\n if (typeof value !== 'string') throw new Error(`<${ctx}> requires a string '${key}' prop`)\n return value\n}\n","//! Font registry — the single source for a composition's custom fonts.\n//!\n//! An author declares a font ONCE (via `@onda-engine/components`' `loadFont`, which loads\n//! it into the author-time measurement engine AND calls `registerFont` here). The\n//! render harness (`@onda-engine/render`) then drains this registry, materializes the\n//! bytes to temp files, and hands them to the `onda` CLI (`--font`) — so the font\n//! used to MEASURE the text (glyph placement) is the same one the renderer DRAWS,\n//! with no separate flag. Same hub pattern as the engine-warmer registry: bytes\n//! flow through `@onda-engine/react`, so neither `@onda-engine/components` nor `@onda-engine/render`\n//! depends on the other.\n\nconst fonts: Uint8Array[] = []\nconst seen = new Set<string>()\n\n/** A content signature so re-declaring the same font is a no-op. FNV-1a over all\n * bytes — O(n), but this runs once per `loadFont` (not per frame), and a full\n * hash (vs sampled bytes) means two distinct fonts never collide. */\nfunction signature(data: Uint8Array): string {\n let h = 0x811c9dc5\n for (let i = 0; i < data.length; i++) {\n h ^= data[i] as number\n h = Math.imul(h, 0x01000193)\n }\n return `${data.length}:${h >>> 0}`\n}\n\n/** Retain font bytes so the render harness can pass them to the renderer. Deduped\n * by content signature — declaring the same font twice is harmless. Synchronous\n * and independent of any async engine load, so the bytes are registered the\n * instant `loadFont` is called, even before the wasm measurement engine warms. */\nexport function registerFont(data: Uint8Array): void {\n const sig = signature(data)\n if (seen.has(sig)) return\n seen.add(sig)\n fonts.push(data)\n}\n\n/** A snapshot of the fonts declared so far — for the render harness to write out\n * and pass to the CLI. Callers receive a copy and must not mutate the registry. */\nexport function registeredFonts(): readonly Uint8Array[] {\n return fonts.slice()\n}\n\n/** Clear the registry — for tests, or a long-running process between renders of\n * different compositions (so one comp's fonts don't leak into the next). */\nexport function clearRegisteredFonts(): void {\n fonts.length = 0\n seen.clear()\n}\n","//! Engine-warmer registry — a hook for packages that need to load async engine\n//! assets (e.g. the wasm text-measurement module) BEFORE the synchronous frame\n//! render, so components bake exact values instead of estimates on export.\n//!\n//! `@onda-engine/react` is the shared hub: `@onda-engine/components` registers its warmer on\n//! import (`registerEngineWarmer(preloadTextMetrics)`), and `@onda-engine/render` awaits\n//! `runEngineWarmers()` before `renderFramesJSON`. No package-to-package coupling,\n//! and it's automatic — importing the components that need warming registers it.\n\ntype Warmer = () => Promise<void>\n\nconst warmers: Warmer[] = []\n\n/** Register an async warmer to run before a render. Idempotent per function. */\nexport function registerEngineWarmer(warm: Warmer): void {\n if (!warmers.includes(warm)) warmers.push(warm)\n}\n\n/** Run all registered warmers (best-effort — a warmer that throws is ignored, so\n * the render still proceeds with whatever fallback the component uses). */\nexport async function runEngineWarmers(): Promise<void> {\n await Promise.all(warmers.map((w) => w().catch(() => {})))\n}\n"]}
|