Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
raea component, raea part's new name in 0.1.3 (Layout LY1-LY4), in what teaches it: each ready component's header (examples/parts, the registry the CLI copies from), the edit template, the craft guides (motion.md, motion/parts.md, motion/footage.md) and the manual's raea part page, now the old name of raea component. The graphics router in raea-skills teaches component list, add and --shared (raea-skills component-name 278f4ff); the skills check's coverage no longer finds raea component untaught
shinyobjectz55d9eeaa5065
diff --git a/docs/manual/reference/cli/index.md b/docs/manual/reference/cli/index.mdindex dcdf22f5..d7c1461e 100644--- a/docs/manual/reference/cli/index.md+++ b/docs/manual/reference/cli/index.md@@ -52,7 +52,7 @@ The workspace, its projects and what a project holds.| [`raea controller`](controller.md) | Read and change the workspace's controllers: its settings and workflows, each a TypeScript file. || [`raea spec`](spec.md) | Print a spec file's default export as JSON, checked against its schema: briefs, scripts, taste, plans and controllers. || [`raea component`](component.md) | Copy a ready-made component or set into the project's components/, or the workspace's shared/components/, to use and change as your own. |-| [`raea part`](part.md) | Copy a ready-made part into the project's components/, to use and change as your own. |+| [`raea part`](part.md) | The old name of raea component: copy a ready-made component into the project's components/, to use and change as your own. || [`raea add`](add.md) | Add, remove and install npm packages for a project, with no Node or npm: raea.lock and node_modules. || [`raea brand`](brand.md) | Read a brand kit from a website on this machine: colours, fonts and logos into brand/ and BRAND.md. || [`raea library`](library.md) | Search and manage the person's media libraries in the raea app: folders and drives indexed on this machine, searched by meaning. |diff --git a/docs/manual/reference/cli/part.md b/docs/manual/reference/cli/part.mdindex adb40fda..89096b0b 100644--- a/docs/manual/reference/cli/part.md+++ b/docs/manual/reference/cli/part.md@@ -1,12 +1,13 @@---title: "raea part"-summary: "Copy a ready-made part into the project's components/, to use and change as your own."+summary: "The old name of raea component: copy a ready-made component into the project's components/, to use and change as your own."order: 28sources: ["engine/cli/src/index.ts", "engine/cli/src/registry.gen.ts"]----Parts are ready-made components (captions, lower thirds, end cards and the like). `raea part list` shows them;-`raea part add` copies one into `components/NAME/`, where it's yours: raea never updates or overwrites it unasked.+`raea part` is the old name of [`raea component`](component.md), and still works the same. `raea part list` shows+the ready-made components; `raea part add` copies one into `components/NAME/`, where it's yours: raea never updates+or overwrites it unasked.```shraea part listdiff --git a/engine/cli/src/registry.gen.ts b/engine/cli/src/registry.gen.tsindex 282f469d..37f2568c 100644--- a/engine/cli/src/registry.gen.ts+++ b/engine/cli/src/registry.gen.ts@@ -1,15 +1,15 @@// generated by tools/pack.ts from examples/parts/ and template/: don't edit, run `bun tools/pack.ts`export const REGISTRY: Record<string, Record<string, string>> = {"brand": {- "callout.tsx": "// raea part add callout: a short labelled card that slides in with the line it supports (a step, a claim, a stat), in the\n// band away from the face. Put it in a <Sequence from durationInFrames> timed to the words (word(\"phrase\") finds them).\nimport { Easing, Region, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = {\n /** the small line above: \"Step 1\", \"Fact\", \"New\" */\n label?: string;\n title: string;\n detail?: string;\n region?: \"auto\" | \"top\" | \"bottom\" | \"center\";\n};\n\nexport default function Callout({ label, title, detail, region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const t = interpolate(f, [0, 10], [0, 1], { extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n return (\n <Region name={region}>\n <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className=\"mx-auto max-w-[86%] rounded-brand bg-brand-surface px-10 py-8 font-brand text-brand-on-surface shadow-xl\">\n {label ? <div className=\"mb-2 text-label font-bold uppercase tracking-widest text-brand-accent\">{label}</div> : null}\n <div className=\"text-title font-extrabold leading-tight\">{title}</div>\n {detail ? <div className=\"mt-2 text-body opacity-80\">{detail}</div> : null}\n </div>\n </Region>\n );\n}\n",- "captions.tsx": "// raea part add captions: the spoken words, a few at a time, the word being said lit. Reads the edit's words itself\n// (useWords(): `raea cut` writes them beside cuts.ts). Sits in the bottom band (parts take the top by default, so they\n// never share one), on the brand's surface with its own text colour, a pair the kit keeps readable on any footage.\n// Styled only from the brand's tokens (brand/brand.css); change anything here, it's yours.\nimport { Region, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = {\n /** words on screen at once */\n per?: number;\n /** where: \"bottom\" by default (parts default to \"top\"); \"auto\" keeps clear of the face */\n region?: \"auto\" | \"top\" | \"bottom\" | \"center\";\n};\n\nexport default function Captions({ per = 3, region = \"bottom\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const i = words.findIndex((w) => f >= w.from && f < w.to);\n // between words, the last group stays up until the next word starts\n const at = i >= 0 ? i : words.findLastIndex((w) => w.to <= f);\n if (at < 0) return null;\n const start = at - (at % per);\n const group = words.slice(start, start + per);\n if (group.length === 0 || f >= group[group.length - 1].to + 6) return null;\n return (\n <Region name={region}>\n <div className=\"flex justify-center\">\n <div className=\"flex max-w-[90%] flex-wrap justify-center gap-x-[0.28em] rounded-brand bg-brand-surface px-8 py-4 text-center font-brand text-caption font-extrabold leading-tight text-brand-on-surface shadow-xl\">\n {group.map((w, k) => (\n <span key={k} className={start + k === i ? \"text-brand-accent\" : \"\"}>{w.text}</span>\n ))}\n </div>\n </div>\n </Region>\n );\n}\n",- "end-card.tsx": "// raea part add end-card: the closing card: the brand's name or logo, one line, and the ask (follow, shop, try). Give it the\n// last 2 to 3 seconds in a <Sequence>; it fades in over the footage or a fill of the brand's background.\nimport { AbsoluteFill, Img, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = {\n name: string;\n /** a logo file under media/ (optional) */\n logo?: string;\n line?: string;\n /** the ask: \"Shop now\", \"Link in bio\" */\n cta?: string;\n /** cover the footage with the brand's background (default) or sit on it */\n fill?: boolean;\n};\n\nexport default function EndCard({ name, logo, line, cta, fill = true }: Props) {\n const f = useCurrentFrame();\n const t = interpolate(f, [0, 12], [0, 1], { extrapolateRight: \"clamp\" });\n return (\n <AbsoluteFill style={{ opacity: t }} className={`${fill ? \"bg-brand-bg\" : \"\"} flex flex-col items-center justify-center gap-8 px-16 text-center font-brand text-brand-ink`}>\n {logo ? <Img src={logo} className=\"h-40 object-contain\" /> : <div className=\"text-display font-black\">{name}</div>}\n {line ? <div className=\"text-title font-bold\">{line}</div> : null}\n {cta ? <div className=\"rounded-full bg-brand-accent px-12 py-5 text-title font-extrabold text-brand-on-accent\">{cta}</div> : null}\n </AbsoluteFill>\n );\n}\n",- "face-frame.tsx": "// raea part add face-frame: a talking take cropped around the face for the edit's shape. The engine finds the face\n// itself (framing=\"face\": raea-perceive's eye track, kept beside the take as TAKE.faces.json) and keeps the eyes 38%\n// down the frame as the speaker moves; punchIn tightens it (1.15 is a usual punch-in for emphasis). An objectPosition or\n// transform of your own on the Video turns the framing off, so this part sets neither.\nimport { Video } from \"raea\";\n\ntype Props = {\n src: string;\n startFrom?: number;\n endAt?: number;\n /** 1 = framed to fit; above 1 = tighter */\n punchIn?: number;\n volume?: number;\n};\n\nexport default function FaceFrame({ src, startFrom, endAt, punchIn = 1, volume = 1 }: Props) {\n return <Video src={src} startFrom={startFrom} endAt={endAt} framing=\"face\" punchIn={punchIn} volume={volume} style={{ width: \"100%\", height: \"100%\" }} />;\n}\n",- "follow.tsx": "// raea part add follow: the ask as a pill that hugs its text (\"Follow for part 2\", \"Shop the stack\"). Give it the moment the\n// speaker asks, or the last seconds.\nimport { Region, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = { text: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\nexport default function Follow({ text, region = \"top\" }: Props) {\n const t = interpolate(useCurrentFrame(), [0, 10], [0, 1], { extrapolateRight: \"clamp\" });\n return (\n <Region name={region}>\n <div className=\"flex justify-center\">\n <div style={{ opacity: t, transform: `scale(${0.85 + 0.15 * t})` }} className=\"rounded-full bg-brand-accent px-12 py-5 font-brand text-title font-extrabold text-brand-on-accent shadow-xl\">{text}</div>\n </div>\n </Region>\n );\n}\n",- "lockup.tsx": "// raea part add lockup: a few lines stacked big, each landing as it's said. \" / \" splits the lines; *word* marks the accent.\n// Put it in a <Sequence> over the words it echoes; each line appears on its first word (or one by one, 8 frames apart,\n// when the line isn't said). Styled only from the brand's tokens.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = { text: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\"; small?: boolean };\n\nexport default function Lockup({ text, region = \"top\", small = false }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const lines = text.split(\" / \");\n const at = (line: string, i: number) => {\n try {\n return findPhrase(words, line.replace(/\\*/g, \"\").split(/\\s+/).slice(0, 2).join(\" \"));\n } catch {\n return i * 8;\n }\n };\n return (\n <Region name={region}>\n <div className={`flex flex-col items-center gap-2 text-center font-brand font-black uppercase leading-none text-brand-ink [text-shadow:0_4px_24px_rgba(0,0,0,0.5)] ${small ? \"text-title\" : \"text-display\"}`}>\n {lines.map((line, i) => {\n const t = interpolate(f - at(line, i), [0, 8], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n return (\n <div key={i} style={{ opacity: t, transform: `translateY(${(1 - t) * 30}px) scale(${0.92 + 0.08 * t})` }}>\n {line.split(/(\\*[^*]+\\*)/).map((part, k) => (part.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{part.slice(1, -1)}</span> : <span key={k}>{part}</span>))}\n </div>\n );\n })}\n </div>\n </Region>\n );\n}\n",- "notthat.tsx": "// raea part add notthat: a lead statement, then the idea it rejects on a card, struck through when the speaker says\n// strikeSay (\"not X, but Y\"). strikeSay is a phrase from the transcript, word for word.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = { lead: string; not: string; strikeSay?: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\n// \" / \" splits lines and *word* marks the accent, as in a lockup\nconst lines = (t: string) =>\n t.split(\" / \").map((line, i) => (\n <div key={i}>{line.split(/(\\*[^*]+\\*)/).map((p, k) => (p.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>))}</div>\n ));\n\nexport default function NotThat({ lead, not, strikeSay, region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n let at = 24;\n if (strikeSay) {\n try { at = findPhrase(words, strikeSay); } catch { at = 24; }\n }\n const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n const card = ease(6);\n const strike = ease(at, 8);\n return (\n <Region name={region}>\n <div className=\"flex flex-col items-center gap-6 text-center font-brand\">\n <div style={{ opacity: ease(0) }} className=\"rounded-brand bg-brand-surface px-8 py-4 text-title font-extrabold text-brand-on-surface\">{lines(lead)}</div>\n <div style={{ opacity: card, transform: `scale(${0.9 + 0.1 * card})` }} className=\"relative rounded-brand bg-brand-surface px-10 py-6 text-title font-extrabold text-brand-on-surface shadow-xl\">\n <span style={{ opacity: 1 - 0.45 * strike }}>{lines(not)}</span>\n <div className=\"absolute left-6 right-6 top-1/2 h-2 rounded-full bg-brand-accent\" style={{ transform: `scaleX(${strike})`, transformOrigin: \"left\" }} />\n </div>\n </div>\n </Region>\n );\n}\n",- "screen-fit.tsx": "// raea part add screen-fit: a landscape screen recording shown whole in a vertical frame, over a soft fill of itself, instead\n// of a cover crop that cuts its sides off (every app render on 2026-10-16 lost Jetflow's UI that way). `raea frame`\n// says when a take wants this. Leaves the space above and below for a headline and captions.\nimport { AbsoluteFill, Video, useVideoConfig } from \"raea\";\n\ntype Props = {\n src: string;\n /** source frames, as <Video> takes them */\n startFrom?: number;\n endAt?: number;\n /** the recording's own aspect (width / height); 16/9 when not given */\n aspect?: number;\n /** where its centre sits, as a share of the frame's height (0.5 = the middle) */\n y?: number;\n};\n\nexport default function ScreenFit({ src, startFrom, endAt, aspect = 16 / 9, y = 0.5 }: Props) {\n const { width, height } = useVideoConfig();\n const h = width / aspect;\n const top = Math.max(0, Math.min(height - h, height * y - h / 2));\n return (\n <AbsoluteFill className=\"bg-brand-bg\">\n <Video src={src} startFrom={startFrom} endAt={endAt} muted style={{ position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\", objectFit: \"cover\", opacity: 0.35, filter: \"blur(40px)\" }} />\n <Video src={src} startFrom={startFrom} endAt={endAt} style={{ position: \"absolute\", left: 0, top, width, height: h, objectFit: \"contain\" }} className=\"rounded-brand shadow-2xl\" />\n </AbsoluteFill>\n );\n}\n",- "statcard.tsx": "// raea part add statcard: a number and up to three lines beside it (*word* marks the accent), and up to two labelled bars\n// that fill on the words that say them. Use it only when the footage says a real number; every claim comes from the\n// brand's own material or the take. *_say props are phrases from the transcript, word for word.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Bar = { label: string; value: number; say?: string };\ntype Props = { big: string; bigSay?: string; l1?: string; l2?: string; l3?: string; bars?: Bar[]; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\nconst accent = (s: string) => s.split(/(\\*[^*]+\\*)/).map((p, k) => (p.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>));\n\nexport default function StatCard({ big, bigSay, l1, l2, l3, bars = [], region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const when = (say: string | undefined, d: number) => {\n if (!say) return d;\n try { return findPhrase(words, say); } catch { return d; }\n };\n const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n const t = ease(when(bigSay, 0));\n return (\n <Region name={region}>\n <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className=\"mx-auto w-[86%] rounded-brand bg-brand-surface p-10 font-brand text-brand-on-surface shadow-xl\">\n <div className=\"flex items-center gap-8\">\n <div className=\"text-display font-black leading-none text-brand-accent\">{big}</div>\n <div className=\"flex flex-col text-body font-bold leading-snug\">\n {l1 ? <div>{accent(l1)}</div> : null}\n {l2 ? <div>{accent(l2)}</div> : null}\n {l3 ? <div>{accent(l3)}</div> : null}\n </div>\n </div>\n {bars.map((b, i) => {\n const fill = ease(when(b.say, 12 + i * 10), 18);\n return (\n <div key={i} className=\"mt-6\">\n <div className=\"mb-2 flex justify-between text-label font-bold uppercase\"><span>{b.label}</span><span>{Math.round(b.value * fill)}%</span></div>\n <div className=\"h-5 w-full rounded-full bg-brand-3\"><div className=\"h-5 rounded-full bg-brand-accent\" style={{ width: `${b.value * fill}%` }} /></div>\n </div>\n );\n })}\n </div>\n </Region>\n );\n}\n"+ "callout.tsx": "// raea component add callout: a short labelled card that slides in with the line it supports (a step, a claim, a stat), in the\n// band away from the face. Put it in a <Sequence from durationInFrames> timed to the words (word(\"phrase\") finds them).\nimport { Easing, Region, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = {\n /** the small line above: \"Step 1\", \"Fact\", \"New\" */\n label?: string;\n title: string;\n detail?: string;\n region?: \"auto\" | \"top\" | \"bottom\" | \"center\";\n};\n\nexport default function Callout({ label, title, detail, region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const t = interpolate(f, [0, 10], [0, 1], { extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n return (\n <Region name={region}>\n <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className=\"mx-auto max-w-[86%] rounded-brand bg-brand-surface px-10 py-8 font-brand text-brand-on-surface shadow-xl\">\n {label ? <div className=\"mb-2 text-label font-bold uppercase tracking-widest text-brand-accent\">{label}</div> : null}\n <div className=\"text-title font-extrabold leading-tight\">{title}</div>\n {detail ? <div className=\"mt-2 text-body opacity-80\">{detail}</div> : null}\n </div>\n </Region>\n );\n}\n",+ "captions.tsx": "// raea component add captions: the spoken words, a few at a time, the word being said lit. Reads the edit's words itself\n// (useWords(): `raea cut` writes them beside cuts.ts). Sits in the bottom band (parts take the top by default, so they\n// never share one), on the brand's surface with its own text colour, a pair the kit keeps readable on any footage.\n// Styled only from the brand's tokens (brand/brand.css); change anything here, it's yours.\nimport { Region, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = {\n /** words on screen at once */\n per?: number;\n /** where: \"bottom\" by default (parts default to \"top\"); \"auto\" keeps clear of the face */\n region?: \"auto\" | \"top\" | \"bottom\" | \"center\";\n};\n\nexport default function Captions({ per = 3, region = \"bottom\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const i = words.findIndex((w) => f >= w.from && f < w.to);\n // between words, the last group stays up until the next word starts\n const at = i >= 0 ? i : words.findLastIndex((w) => w.to <= f);\n if (at < 0) return null;\n const start = at - (at % per);\n const group = words.slice(start, start + per);\n if (group.length === 0 || f >= group[group.length - 1].to + 6) return null;\n return (\n <Region name={region}>\n <div className=\"flex justify-center\">\n <div className=\"flex max-w-[90%] flex-wrap justify-center gap-x-[0.28em] rounded-brand bg-brand-surface px-8 py-4 text-center font-brand text-caption font-extrabold leading-tight text-brand-on-surface shadow-xl\">\n {group.map((w, k) => (\n <span key={k} className={start + k === i ? \"text-brand-accent\" : \"\"}>{w.text}</span>\n ))}\n </div>\n </div>\n </Region>\n );\n}\n",+ "end-card.tsx": "// raea component add end-card: the closing card: the brand's name or logo, one line, and the ask (follow, shop, try). Give it the\n// last 2 to 3 seconds in a <Sequence>; it fades in over the footage or a fill of the brand's background.\nimport { AbsoluteFill, Img, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = {\n name: string;\n /** a logo file under media/ (optional) */\n logo?: string;\n line?: string;\n /** the ask: \"Shop now\", \"Link in bio\" */\n cta?: string;\n /** cover the footage with the brand's background (default) or sit on it */\n fill?: boolean;\n};\n\nexport default function EndCard({ name, logo, line, cta, fill = true }: Props) {\n const f = useCurrentFrame();\n const t = interpolate(f, [0, 12], [0, 1], { extrapolateRight: \"clamp\" });\n return (\n <AbsoluteFill style={{ opacity: t }} className={`${fill ? \"bg-brand-bg\" : \"\"} flex flex-col items-center justify-center gap-8 px-16 text-center font-brand text-brand-ink`}>\n {logo ? <Img src={logo} className=\"h-40 object-contain\" /> : <div className=\"text-display font-black\">{name}</div>}\n {line ? <div className=\"text-title font-bold\">{line}</div> : null}\n {cta ? <div className=\"rounded-full bg-brand-accent px-12 py-5 text-title font-extrabold text-brand-on-accent\">{cta}</div> : null}\n </AbsoluteFill>\n );\n}\n",+ "face-frame.tsx": "// raea component add face-frame: a talking take cropped around the face for the edit's shape. The engine finds the face\n// itself (framing=\"face\": raea-perceive's eye track, kept beside the take as TAKE.faces.json) and keeps the eyes 38%\n// down the frame as the speaker moves; punchIn tightens it (1.15 is a usual punch-in for emphasis). An objectPosition or\n// transform of your own on the Video turns the framing off, so this part sets neither.\nimport { Video } from \"raea\";\n\ntype Props = {\n src: string;\n startFrom?: number;\n endAt?: number;\n /** 1 = framed to fit; above 1 = tighter */\n punchIn?: number;\n volume?: number;\n};\n\nexport default function FaceFrame({ src, startFrom, endAt, punchIn = 1, volume = 1 }: Props) {\n return <Video src={src} startFrom={startFrom} endAt={endAt} framing=\"face\" punchIn={punchIn} volume={volume} style={{ width: \"100%\", height: \"100%\" }} />;\n}\n",+ "follow.tsx": "// raea component add follow: the ask as a pill that hugs its text (\"Follow for part 2\", \"Shop the stack\"). Give it the moment the\n// speaker asks, or the last seconds.\nimport { Region, interpolate, useCurrentFrame } from \"raea\";\n\ntype Props = { text: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\nexport default function Follow({ text, region = \"top\" }: Props) {\n const t = interpolate(useCurrentFrame(), [0, 10], [0, 1], { extrapolateRight: \"clamp\" });\n return (\n <Region name={region}>\n <div className=\"flex justify-center\">\n <div style={{ opacity: t, transform: `scale(${0.85 + 0.15 * t})` }} className=\"rounded-full bg-brand-accent px-12 py-5 font-brand text-title font-extrabold text-brand-on-accent shadow-xl\">{text}</div>\n </div>\n </Region>\n );\n}\n",+ "lockup.tsx": "// raea component add lockup: a few lines stacked big, each landing as it's said. \" / \" splits the lines; *word* marks the accent.\n// Put it in a <Sequence> over the words it echoes; each line appears on its first word (or one by one, 8 frames apart,\n// when the line isn't said). Styled only from the brand's tokens.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = { text: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\"; small?: boolean };\n\nexport default function Lockup({ text, region = \"top\", small = false }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const lines = text.split(\" / \");\n const at = (line: string, i: number) => {\n try {\n return findPhrase(words, line.replace(/\\*/g, \"\").split(/\\s+/).slice(0, 2).join(\" \"));\n } catch {\n return i * 8;\n }\n };\n return (\n <Region name={region}>\n <div className={`flex flex-col items-center gap-2 text-center font-brand font-black uppercase leading-none text-brand-ink [text-shadow:0_4px_24px_rgba(0,0,0,0.5)] ${small ? \"text-title\" : \"text-display\"}`}>\n {lines.map((line, i) => {\n const t = interpolate(f - at(line, i), [0, 8], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n return (\n <div key={i} style={{ opacity: t, transform: `translateY(${(1 - t) * 30}px) scale(${0.92 + 0.08 * t})` }}>\n {line.split(/(\\*[^*]+\\*)/).map((part, k) => (part.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{part.slice(1, -1)}</span> : <span key={k}>{part}</span>))}\n </div>\n );\n })}\n </div>\n </Region>\n );\n}\n",+ "notthat.tsx": "// raea component add notthat: a lead statement, then the idea it rejects on a card, struck through when the speaker says\n// strikeSay (\"not X, but Y\"). strikeSay is a phrase from the transcript, word for word.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Props = { lead: string; not: string; strikeSay?: string; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\n// \" / \" splits lines and *word* marks the accent, as in a lockup\nconst lines = (t: string) =>\n t.split(\" / \").map((line, i) => (\n <div key={i}>{line.split(/(\\*[^*]+\\*)/).map((p, k) => (p.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>))}</div>\n ));\n\nexport default function NotThat({ lead, not, strikeSay, region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n let at = 24;\n if (strikeSay) {\n try { at = findPhrase(words, strikeSay); } catch { at = 24; }\n }\n const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n const card = ease(6);\n const strike = ease(at, 8);\n return (\n <Region name={region}>\n <div className=\"flex flex-col items-center gap-6 text-center font-brand\">\n <div style={{ opacity: ease(0) }} className=\"rounded-brand bg-brand-surface px-8 py-4 text-title font-extrabold text-brand-on-surface\">{lines(lead)}</div>\n <div style={{ opacity: card, transform: `scale(${0.9 + 0.1 * card})` }} className=\"relative rounded-brand bg-brand-surface px-10 py-6 text-title font-extrabold text-brand-on-surface shadow-xl\">\n <span style={{ opacity: 1 - 0.45 * strike }}>{lines(not)}</span>\n <div className=\"absolute left-6 right-6 top-1/2 h-2 rounded-full bg-brand-accent\" style={{ transform: `scaleX(${strike})`, transformOrigin: \"left\" }} />\n </div>\n </div>\n </Region>\n );\n}\n",+ "screen-fit.tsx": "// raea component add screen-fit: a landscape screen recording shown whole in a vertical frame, over a soft fill of itself, instead\n// of a cover crop that cuts its sides off (every app render on 2026-10-16 lost Jetflow's UI that way). `raea frame`\n// says when a take wants this. Leaves the space above and below for a headline and captions.\nimport { AbsoluteFill, Video, useVideoConfig } from \"raea\";\n\ntype Props = {\n src: string;\n /** source frames, as <Video> takes them */\n startFrom?: number;\n endAt?: number;\n /** the recording's own aspect (width / height); 16/9 when not given */\n aspect?: number;\n /** where its centre sits, as a share of the frame's height (0.5 = the middle) */\n y?: number;\n};\n\nexport default function ScreenFit({ src, startFrom, endAt, aspect = 16 / 9, y = 0.5 }: Props) {\n const { width, height } = useVideoConfig();\n const h = width / aspect;\n const top = Math.max(0, Math.min(height - h, height * y - h / 2));\n return (\n <AbsoluteFill className=\"bg-brand-bg\">\n <Video src={src} startFrom={startFrom} endAt={endAt} muted style={{ position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\", objectFit: \"cover\", opacity: 0.35, filter: \"blur(40px)\" }} />\n <Video src={src} startFrom={startFrom} endAt={endAt} style={{ position: \"absolute\", left: 0, top, width, height: h, objectFit: \"contain\" }} className=\"rounded-brand shadow-2xl\" />\n </AbsoluteFill>\n );\n}\n",+ "statcard.tsx": "// raea component add statcard: a number and up to three lines beside it (*word* marks the accent), and up to two labelled bars\n// that fill on the words that say them. Use it only when the footage says a real number; every claim comes from the\n// brand's own material or the take. *_say props are phrases from the transcript, word for word.\nimport { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from \"raea\";\n\ntype Bar = { label: string; value: number; say?: string };\ntype Props = { big: string; bigSay?: string; l1?: string; l2?: string; l3?: string; bars?: Bar[]; region?: \"auto\" | \"top\" | \"bottom\" | \"center\" };\n\nconst accent = (s: string) => s.split(/(\\*[^*]+\\*)/).map((p, k) => (p.startsWith(\"*\") ? <span key={k} className=\"text-brand-accent\">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>));\n\nexport default function StatCard({ big, bigSay, l1, l2, l3, bars = [], region = \"top\" }: Props) {\n const f = useCurrentFrame();\n const words = useWords();\n const when = (say: string | undefined, d: number) => {\n if (!say) return d;\n try { return findPhrase(words, say); } catch { return d; }\n };\n const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });\n const t = ease(when(bigSay, 0));\n return (\n <Region name={region}>\n <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className=\"mx-auto w-[86%] rounded-brand bg-brand-surface p-10 font-brand text-brand-on-surface shadow-xl\">\n <div className=\"flex items-center gap-8\">\n <div className=\"text-display font-black leading-none text-brand-accent\">{big}</div>\n <div className=\"flex flex-col text-body font-bold leading-snug\">\n {l1 ? <div>{accent(l1)}</div> : null}\n {l2 ? <div>{accent(l2)}</div> : null}\n {l3 ? <div>{accent(l3)}</div> : null}\n </div>\n </div>\n {bars.map((b, i) => {\n const fill = ease(when(b.say, 12 + i * 10), 18);\n return (\n <div key={i} className=\"mt-6\">\n <div className=\"mb-2 flex justify-between text-label font-bold uppercase\"><span>{b.label}</span><span>{Math.round(b.value * fill)}%</span></div>\n <div className=\"h-5 w-full rounded-full bg-brand-3\"><div className=\"h-5 rounded-full bg-brand-accent\" style={{ width: `${b.value * fill}%` }} /></div>\n </div>\n );\n })}\n </div>\n </Region>\n );\n}\n"},"reel": {"all.ts": "// Every part of index.tsx, in the order they load: each after what it uses while it loads. The parts import\n// each other only from here, so this order holds whichever is reached first.\nexport * from \"./core\";\nexport * from \"./band\";\nexport * from \"./cards\";\nexport * from \"./captions\";\n",@@ -17,11 +17,11 @@ export const REGISTRY: Record<string, Record<string, string>> = {"captions.tsx": "// Captions and the bed.\nimport { useContext } from \"react\";\nimport { Audio, Sequence, interpolate, useCurrentFrame, useVideoConfig, useWords } from \"raea\";\nimport { PARTS } from \"./layout\";\nimport { ACCENT, AdContext, META, OVER, TOP, Words, clamp, fit, key, type } from \"./all\";\n\n// ---- captions ----------------------------------------------------------------------------------------------------\n\nexport interface CaptionsProps {\n /** words that stay lit once said, \",\" between them: \"not, more, bets\" */\n keys?: string;\n /** words as they should read, \"heard=shown\" pairs: \"two=2, followjet=Followjet\" */\n fix?: string;\n}\n\n/** Karaoke captions from the take's words: groups of up to three, the word being said lit. Inside <Ad> they sit under\n * a card, hide under a hook, a strike, the ask or the end card, and go big at the top when the band is empty. */\nexport function Captions({ keys = \"\", fix = \"\" }: CaptionsProps) {\n const f = useCurrentFrame();\n const ad = useContext(AdContext);\n const fixes: Record<string, string> = Object.fromEntries(fix.split(\",\").map((s) => s.trim().split(\"=\").map((x) => x.trim())).filter((p) => p.length === 2));\n const hot = new Set(keys.split(\",\").map((s) => s.trim().toLowerCase()).filter(Boolean));\n const ws = useWords().map((w) => ({ ...w, text: fixes[w.text] ?? fixes[w.text.replace(/[.,?!]$/, \"\")] ?? w.text }));\n const busy = ad?.band.find((b) => f >= b.from && f < b.to);\n if (busy && busy.kind !== \"card\") return null;\n const groups: Words[] = [];\n for (const w of ws) {\n const g = groups[groups.length - 1];\n const prev = g?.[g.length - 1];\n if (!g || g.length >= 3 || /[.,?!]$/.test(prev!.text) || w.from - prev!.to > 8) groups.push([w]);\n else g.push(w);\n }\n const i = groups.findIndex((g, n) => f >= g[0].from && f < Math.min(groups[n + 1]?.[0].from ?? Infinity, g[g.length - 1].to + 8));\n if (i < 0) return null;\n const g = groups[i];\n const gl = f - g[0].from;\n const text = g.map((w) => w.text).join(\" \");\n const size = busy ? 78 : fit(text, 940, 136);\n // under a card in the top band; over a card placed lower (its top less the caption's height)\n const y = !busy ? 260 : busy.top === TOP ? TOP + 476 : busy.top - 120;\n return (\n <div data-caption={text} style={{ position: \"absolute\", left: 70, top: y, width: 940, textAlign: \"center\", ...type(size, OVER, -2, true, 0.95), transform: `translateY(${key(gl, { 0: 26, 5: 0 })}px) scale(${key(gl, { 0: 0.8, 3: 1.06, 6: 1 })})` }}>\n {g.map((w, j) => {\n const isKey = hot.has(w.text.toLowerCase().replace(/[^a-z0-9%']/g, \"\"));\n const lit = isKey ? f >= w.from : f >= w.from && f < Math.max(w.to, w.from + 4);\n return <span key={j} style={{ color: lit ? ACCENT : OVER }}>{w.text + (j < g.length - 1 ? \" \" : \"\")}</span>;\n })}\n </div>\n );\n}\n\nMETA.set(Captions, PARTS.Captions);\n\n// ---- the bed -----------------------------------------------------------------------------------------------------\n\nexport interface BedProps {\n src: string;\n /** its level under the voice, dB */\n gain?: number;\n /** its level once the voice is done (the last second), dB */\n outro?: number;\n}\n\n/** Music under the voice, coming up as the voice ends and fading out over the last 1.4 s. */\nexport function Bed({ src, gain = -21, outro = -12 }: BedProps) {\n const { fps, durationInFrames: n } = useVideoConfig();\n const words = useWords();\n const done = Math.min(n - 1, (words[words.length - 1]?.to ?? n) + 2);\n const fade = Math.round(1.4 * fps);\n const db = (m: number) => key(m, { 0: gain, [done]: gain, [done + 10]: outro }) + 20 * Math.log10(Math.max(1e-4, interpolate(m, [n - fade, n], [1, 0], clamp)));\n return (\n <Sequence from={0} durationInFrames={n} name=\"bed\" layout=\"none\">\n <Audio src={src} gainDb={db} />\n </Sequence>\n );\n}\n\nMETA.set(Bed, PARTS.Bed);\n","cards.tsx": "// Strike, Phrases, Callout, Follow and EndCard.\nimport { useContext } from \"react\";\nimport { AbsoluteFill, Img, findPhrase, useCurrentFrame, useWords } from \"raea\";\nimport { PARTS } from \"./layout\";\nimport { ACCENT, BLIP, BODY, CARD, Cue, Hit, INK, LockLine, ON_ACCENT, OVER, POP, SHADOW, STRIKE, THUD, TOP, TopContext, W, accent, ems, fit, key, landings, lines, part, plain, rise, saidFrom, type } from \"./all\";\n\nexport interface StrikeProps extends Cue {\n /** the lockup above the card, \" / \" between lines: what's right */\n text: string;\n /** what's wrong, on the card (two lines at most, \" / \" between them), struck through */\n not: string;\n /** the phrase the strike lands on (a few frames before the part ends when not given) */\n strikeSay?: string;\n}\n\n/** \"this, not that\": the right way big, the wrong way on a card under it, struck through as it's dismissed. */\nexport const Strike = part<StrikeProps>(\"Strike\", PARTS.Strike, ({ text, not, strikeSay, sound, span }) => {\n const f = useCurrentFrame();\n const TOP = useContext(TopContext);\n const words = useWords();\n const len = span.to - span.from;\n const ls = lines(text).slice(0, 2);\n const rows = lines(not).slice(0, 2);\n // the struck card follows the headline by a third of a second, unless its first row is said sooner: then it lands on its words\n const rowAt = landings(words, rows, len, rows.length ? Math.min(10, saidFrom(words, rows[0])) : 10, true);\n let strike = len - 14;\n if (strikeSay) try { strike = findPhrase(words, strikeSay); } catch (e) { throw new Error(`<Strike> strikeSay: ${(e as Error).message}`); }\n // what's struck is read first: the strike waits until the last row has been up half a second (a strikeSay on the\n // card's own words struck it as it landed), while the part is still up\n if (rows.length) strike = Math.min(Math.max(strike, rowAt[rows.length - 1] + 15), len - 8);\n const card = rowAt[0];\n const rowSize = Math.min(74, ...rows.map((r) => fit(r, 820, 74)));\n const h = rows.length > 1 ? key(f, { [rowAt[1] - 1]: 120, [rowAt[1] + 5]: 192 }) : 120;\n const top = TOP + ls.length * 140 + 10;\n return (\n <>\n <div style={{ position: \"absolute\", left: 90, top: TOP, width: 900, display: \"flex\", flexDirection: \"column\" }}>\n {ls.map((l, i) => <LockLine key={i} line={l} at={0} f={f} size={fit(l, 900, i === 0 ? 130 : 110)} />)}\n </div>\n {f >= card ? (\n <div style={{ position: \"absolute\", left: 100, top, width: 880, height: h, boxSizing: \"border-box\", padding: \"22px 20px 0\", borderRadius: 32, backgroundColor: CARD, overflow: \"hidden\", transform: `translateY(${key(f - card, { 0: 30, 6: 0 })}px)` }}>\n {rows.map((r, i) => (\n <div key={i} style={{ position: \"relative\", height: 72, opacity: f >= rowAt[i] ? 1 : 0 }}>\n <div style={{ ...type(rowSize, \"#e2e2e2\", -1, false), textAlign: \"center\", transform: `translateY(${rise(f - rowAt[i])}px)` }}>{r}</div>\n <div style={{ position: \"absolute\", left: \"50%\", top: rowSize * 0.42, height: 9, borderRadius: 5, backgroundColor: STRIKE, width: key(f - strike - 4 * i, { 0: 0, 8: Math.min(820, ems(r) * rowSize) }), transform: \"translateX(-50%)\" }} />\n </div>\n ))}\n </div>\n ) : null}\n <Hit at={card} sound={sound} fallback=\"soft paper swipe whoosh, short\" gain={-22} screen={BLIP} />\n <Hit at={strike} sound={sound} fallback=\"marker pen scribble strike-through on paper, quick\" gain={-20} seconds={0.8} />\n </>\n );\n});\n\nexport interface PhrasesProps extends Cue {\n /** the lines, \" / \" between them, each a short phrase the speaker says in turn; *accent* words lit */\n text: string;\n}\n\n/** Big lines on purpose: a run of short phrases in the top band, one at a time, each landing on its words and held\n * until the next, each as big as it fits (the reference's thesis, said phrase by phrase). */\nexport const Phrases = part<PhrasesProps>(\"Phrases\", PARTS.Phrases, ({ text, sound, span }) => {\n const f = useCurrentFrame();\n const TOP = useContext(TopContext);\n const ls = lines(text);\n const at = landings(useWords(), ls, span.to - span.from, 0, true, \"Phrases\", span.from);\n const i = at.reduce((n, a, k) => (f >= a ? k : n), 0);\n const local = f - at[i];\n return (\n <>\n <div key={i} style={{ position: \"absolute\", left: 60, top: TOP, width: W, textAlign: \"center\", ...type(fit(ls[i], W, 150), OVER), opacity: local >= 0 ? 1 : 0, transform: `translateY(${key(local, { 0: 26, 5: 0 })}px) scale(${key(local, { 0: 0.8, 3: 1.06, 6: 1 })})` }}>\n {accent(ls[i])}\n </div>\n <Hit sound={sound} fallback=\"deep punchy cinematic impact hit, tight, no reverb tail\" gain={-18} seconds={1.2} screen={THUD} />\n </>\n );\n});\n\nexport interface CalloutProps extends Cue {\n /** the small line above: \"Step 1\", \"Fact\" */\n label?: string;\n title: string;\n detail?: string;\n}\n\n/** A labelled card in the top band for a step or a claim. */\nexport const Callout = part<CalloutProps>(\"Callout\", PARTS.Callout, ({ label, title, detail, sound }) => {\n const f = useCurrentFrame();\n const TOP = useContext(TopContext);\n return (\n <>\n <div style={{ position: \"absolute\", left: 60, top: TOP, width: W, boxSizing: \"border-box\", padding: \"34px 50px\", borderRadius: 44, backgroundColor: CARD, boxShadow: \"0 20px 60px rgba(0,0,0,0.35)\", transform: `translateY(${key(f, { 0: -30, 7: 0 })}px)`, opacity: key(f, { 0: 0, 4: 1 }) }}>\n {label ? <div style={{ fontFamily: BODY, fontWeight: 800, fontSize: 38, letterSpacing: 2, color: ACCENT, textTransform: \"uppercase\", marginBottom: 12 }}>{label}</div> : null}\n <div style={{ ...type(fit(title, 860, 96), INK, -1, false), whiteSpace: \"normal\" }}>{accent(title)}</div>\n {detail ? <div style={{ fontFamily: BODY, fontWeight: 600, fontSize: 40, lineHeight: 1.25, color: \"#d8d8d8\", marginTop: 14 }}>{accent(detail)}</div> : null}\n </div>\n <Hit sound={sound} fallback=\"fast clean whoosh swipe transition, short, airy\" gain={-21} screen={BLIP} />\n </>\n );\n});\n\nexport interface FollowProps extends Cue {\n text: string;\n}\n\n/** The ask as a pill in the top band: \"+ follow for more\". */\nexport const Follow = part<FollowProps>(\"Follow\", PARTS.Follow, ({ text, sound }) => {\n const f = useCurrentFrame();\n const TOP = useContext(TopContext);\n // the pill is the accent already and holds one line: stars and \" / \" read as plain words\n const said = plain(text).split(/\\s*\\/\\s*/).join(\" \");\n return (\n <>\n <div style={{ position: \"absolute\", left: 108, top: TOP + 64, width: 813, padding: 26, borderRadius: 60, backgroundColor: ACCENT, color: ON_ACCENT, fontFamily: BODY, fontWeight: 800, fontSize: Math.min(64, Math.floor(800 / (0.62 * said.length))), lineHeight: 1, letterSpacing: 2, textTransform: \"uppercase\", textAlign: \"center\", whiteSpace: \"nowrap\", boxShadow: \"0 10px 30px rgba(0,0,0,0.35)\", transform: `scale(${key(f, POP)})` }}>\n {said}\n </div>\n <Hit sound={sound} fallback=\"bubbly UI pop click, satisfying, short\" gain={-17} seconds={0.6} screen={[BLIP[0], -3, 0.6]} />\n </>\n );\n});\n\nexport interface EndCardProps extends Cue {\n name: string;\n /** a logo image (optional) */\n logo?: string;\n line?: string;\n /** the ask: \"Shop now\", \"Link in bio\" */\n cta?: string;\n}\n\n/** The closing card over the whole frame: the name or logo, one line, and the ask. */\nexport const EndCard = part<EndCardProps>(\"EndCard\", PARTS.EndCard, ({ name, logo, line, cta, sound }) => {\n const t = key(useCurrentFrame(), { 0: 0, 10: 1 });\n return (\n <>\n <AbsoluteFill style={{ opacity: t, backgroundColor: \"rgba(10,10,10,0.92)\", display: \"flex\", flexDirection: \"column\", alignItems: \"center\", justifyContent: \"center\", gap: 40, padding: 80 }}>\n {logo ? <Img src={logo} style={{ height: 180, objectFit: \"contain\" }} /> : <div style={{ ...type(fit(name, 900, 180), INK), textShadow: SHADOW }}>{name}</div>}\n {line ? <div style={{ ...type(fit(line, 900, 80), INK, -1, false), whiteSpace: \"normal\", textAlign: \"center\" }}>{accent(line)}</div> : null}\n {cta ? <div style={{ padding: \"26px 60px\", borderRadius: 60, backgroundColor: ACCENT, color: ON_ACCENT, fontFamily: BODY, fontWeight: 800, fontSize: 56, letterSpacing: 2, textTransform: \"uppercase\", transform: `scale(${t})` }}>{cta}</div> : null}\n </AbsoluteFill>\n <Hit sound={sound} fallback=\"soft rising whoosh into a gentle chime, short\" gain={-20} seconds={1.2} screen={THUD} />\n </>\n );\n});\n","core.tsx": "// The look, cues, the frame and the take.\nimport { Children, createContext, isValidElement, useContext, type CSSProperties, type ReactElement, type ReactNode } from \"react\";\nimport { AbsoluteFill, Audio, Sequence, Video, findPhrase, interpolate, sao, useCurrentFrame, useVideoConfig, useWords, Easing } from \"raea\";\nimport { PARTS, layout, spanOf, type Kind, type PartMeta, type Span, type Word } from \"./layout\";\n\nexport type Words = Word[];\n\n// ---- look --------------------------------------------------------------------------------------------------------\n\nexport const ACCENT = \"var(--brand-accent, #c8ff2e)\";\n\nexport const STRIKE = \"var(--brand-strike, #ff4d3d)\";\n\nexport const INK = \"var(--brand-ink, #ffffff)\";\n\nexport const CARD = \"var(--brand-card, rgba(12,12,12,0.88))\";\n\nexport const ON_ACCENT = \"var(--brand-on-accent, #0d0d0d)\";\n\nconst HEAD = \"var(--brand-font, 'Avenir Next Condensed')\";\n\nexport const BODY = \"var(--brand-font-body, 'Avenir Next')\";\n\nexport const SHADOW = \"0 3px 0 rgba(0,0,0,0.35), 0 0 3px rgba(0,0,0,0.5), 0 10px 36px rgba(0,0,0,0.55)\";\n\n/** type straight over the footage (hooks, a strike's lockup, captions), and its shadow: white on a dark grade by\n * default, the ink of a light screen with a soft white halo when <Ad tone=\"light\"> */\nexport const OVER = \"var(--brand-over, #ffffff)\";\n\nconst OVER_SHADOW = `var(--brand-over-shadow, ${SHADOW})`;\n\nconst LIGHT = { \"--brand-over\": \"#17191d\", \"--brand-over-shadow\": \"0 0 4px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.75)\" };\n\n/** the band's top, and its width */\nexport const TOP = 236;\n\n/** where a band part sits: its top edge for each `place` (top is the reference's, over the head) */\nconst PLACES = { top: TOP, upper: 420, middle: 760 } as const;\n\nexport type Place = keyof typeof PLACES;\n\n/** the top edge of the part being drawn */\nexport const TopContext = createContext<number>(TOP);\n\nfunction topOf(place: Place | undefined): number {\n if (place !== undefined && !(place in PLACES)) throw new Error(`place must be \"top\", \"upper\" or \"middle\", got ${JSON.stringify(place)}`);\n return PLACES[place ?? \"top\"];\n}\n\nexport const W = 960;\n\nconst OUT = Easing.out(Easing.cubic);\n\nexport const clamp = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\n\n/** a value along keys {frame: value}, eased out per segment, held outside them */\nexport function key(f: number, keys: Record<number, number>): number {\n const xs = Object.keys(keys).map(Number).sort((a, b) => a - b);\n return interpolate(f, xs, xs.map((x) => keys[x]), { easing: OUT, ...clamp });\n}\n\nexport const POP = { 0: 0.6, 4: 1.08, 8: 1 };\n\nexport const rise = (local: number) => key(local, { 0: 30, 6: 0 });\n\nexport function type(size: number, color: string = INK, tracking = -2, shadow = true, line = 0.92): CSSProperties {\n return { fontFamily: HEAD, fontWeight: 800, fontSize: size, color, lineHeight: line, textTransform: \"uppercase\", letterSpacing: tracking, textShadow: shadow ? OVER_SHADOW : undefined, whiteSpace: \"nowrap\" };\n}\n\n/** advance widths in em of Avenir Next Condensed Heavy (what weight 800 resolves to), measured from the font; a\n * brand's own face is near enough for fitting */\nconst ADVANCE: Record<string, number> = {\n A: 0.596, B: 0.58, C: 0.53, D: 0.621, E: 0.467, F: 0.454, G: 0.577, H: 0.632, I: 0.324, J: 0.485, K: 0.624, L: 0.465, M: 0.807,\n N: 0.63, O: 0.64, P: 0.562, Q: 0.65, R: 0.582, S: 0.478, T: 0.464, U: 0.6, V: 0.602, W: 0.844, X: 0.596, Y: 0.538, Z: 0.497,\n \" \": 0.2, \"%\": 0.765, \"'\": 0.254, \".\": 0.3, \",\": 0.3, \"!\": 0.35, \"?\": 0.46, \":\": 0.32, \";\": 0.32, \"-\": 0.26, \"+\": 0.666, \"/\": 0.32, \"&\": 0.66,\n};\n\n/** a line's width in em, set in capitals */\nexport const ems = (text: string) => [...text.replace(/\\*/g, \"\").toUpperCase()].reduce((n, c) => n + (ADVANCE[c] ?? (/\\d/.test(c) ? 0.56 : 0.6)), 0);\n\n/** the largest size up to `max` at which `text` fits `width`, with the type's -2 px tracking */\nexport const fit = (text: string, width: number, max: number) => Math.min(max, Math.floor((width + 2 * plain(text).length) / Math.max(1, ems(text))));\n\n/** a line with its *accent* words */\nexport const accent = (line: string, color: string = ACCENT) =>\n line.split(/(\\*[^*]+\\*)/).filter(Boolean).map((p, k) => (p.startsWith(\"*\") ? <span key={k} style={{ color }}>{p.slice(1, -1)}</span> : <span key={k}>{p}</span>));\n\nexport const lines = (text: string) => text.split(\" / \").map((l) => l.trim()).filter(Boolean);\n\n/** A lockup's lines: as given with \" / \", or a long line with none broken into two or three lines of even width (the\n * widest as narrow as it can be), so a one-line hook still reads big. */\nexport function lockup(text: string): string[] {\n const given = lines(text);\n const ws = text.trim().split(/\\s+/);\n if (given.length > 1 || ws.length < 4) return given;\n const n = ws.length > 6 ? 3 : 2;\n let best: string[] = given;\n let widest = Infinity;\n const tryCuts = (from: number, left: number, acc: string[]) => {\n if (left === 1) {\n const ls = [...acc, ws.slice(from).join(\" \")];\n const w = Math.max(...ls.map(ems));\n if (w < widest) [best, widest] = [ls, w];\n return;\n }\n for (let k = from + 1; k <= ws.length - left + 1; k++) tryCuts(k, left - 1, [...acc, ws.slice(from, k).join(\" \")]);\n };\n tryCuts(0, n, []);\n return best;\n}\n\nexport const plain = (line: string) => line.replace(/\\*/g, \"\");\n\n// ---- cues --------------------------------------------------------------------------------------------------------\n\nexport interface Cue {\n /** the phrase the part lands on, word for word from the transcript */\n say?: string;\n /** which time `say` is said, from 1 */\n occurrence?: number;\n /** the phrase it leaves on (the end of its last word) */\n until?: string;\n /** its length when there's no `until` */\n seconds?: number;\n /** a start frame, when it isn't cued on words */\n from?: number;\n /** the beat of the bed it lands on, counted from 0 (a take with no voice is cut on the music: <Ad beats>) */\n beat?: number;\n /** the last beat it's up for (it leaves as the next beat starts) */\n untilBeat?: number;\n /** foley on its moment: an SAO prompt, or false for none */\n sound?: string | false;\n /** where it sits: \"top\" (over the head, the default), \"upper\" or \"middle\" */\n place?: Place;\n}\n\n/** what <Ad> worked out: each part's span (by its place among the children) and the band's spans with their kinds */\ninterface AdLayout { spans: Map<number, Span>; band: (Span & { kind: Kind; top: number })[] }\n\nexport const AdContext = createContext<AdLayout | null>(null);\n\n/** the bed's beats in the cut's frames, from <Ad beats> */\nconst BeatsContext = createContext<number[]>([]);\n\nconst SpanContext = createContext<Span | null>(null);\n\nexport const META = new WeakMap<object, PartMeta>();\n\nexport function part<P>(name: string, meta: PartMeta, Body: (p: P & { span: Span }) => ReactNode) {\n const Part = (p: P & Cue) => {\n // a prop the part can't go without is named, with the props it was given (a wrong name reads as a missing one)\n const missing = (meta.needs ?? []).filter((k) => typeof (p as Record<string, unknown>)[k] !== \"string\");\n if (missing.length) throw new Error(`<${name}> needs ${missing.map((k) => `${k}=\"...\"`).join(\" and \")} (it was given ${Object.keys(p).join(\", \") || \"nothing\"})`);\n const given = useContext(SpanContext);\n const words = useWords();\n const beats = useContext(BeatsContext);\n const { fps, durationInFrames } = useVideoConfig();\n const span = given ?? spanOf(findPhrase, name, p, meta, words, beats, fps, durationInFrames);\n return (\n <Sequence from={span.from} durationInFrames={span.to - span.from} name={name.toLowerCase()} layout=\"none\">\n <TopContext.Provider value={topOf(p.place)}>\n <Body {...p} span={span} />\n </TopContext.Provider>\n </Sequence>\n );\n };\n Part.displayName = name;\n META.set(Part, meta);\n return Part;\n}\n\n/** The SAO hit on a part's moment (frames local to the part). */\n/** the foley a part makes in each kit: the talking reel's under a voice, and a screen piece's (golden 30's: a round\n * thud for a landing, a cartoon pop for a card, louder, as nothing is said over them) */\ntype Foley = [prompt: string, gain: number, seconds: number];\n\nexport const THUD: Foley = [\"deep round thud, a heavy object dropping onto something soft, short, no reverb\", -5, 1];\n\nexport const BLIP: Foley = [\"bubbly cartoon UI pop, satisfying and clean, short\", -5, 0.6];\n\nconst KitContext = createContext<\"voice\" | \"screen\">(\"voice\");\n\n/** The SAO hit on a part's moment (frames local to the part): `sound` when given, else the kit's. */\nexport function Hit({ at = 0, sound, fallback, gain, seconds = 1, screen }: { at?: number; sound: string | false | undefined; fallback: string; gain: number; seconds?: number; screen?: Foley }) {\n const kit = useContext(KitContext);\n if (sound === false) return null;\n const [prompt, db, len] = sound === undefined && kit === \"screen\" && screen ? screen : [sound ?? fallback, gain, seconds];\n return (\n <Sequence from={at} name=\"foley\" layout=\"none\">\n <Audio src={sao(prompt, { seconds: len })} gainDb={db} />\n </Sequence>\n );\n}\n\n// ---- the frame ---------------------------------------------------------------------------------------------------\n\nexport interface AdProps {\n children: ReactNode;\n /** the brand's accent (lime by default), its strike colour, and its typeface for the big type */\n accent?: string;\n strike?: string;\n font?: string;\n /** the dark grade under the top band, so type reads on any footage (on by default) */\n shade?: boolean;\n /** the footage's tone: \"dark\" (the default; white type on a dark grade) or \"light\" (a bright screen: dark type,\n * no grade); the host gives TONE */\n tone?: \"dark\" | \"light\";\n /** the parts' foley: \"voice\" (the talking reel's, quiet under a voice) or \"screen\" (thuds and pops at the level of\n * a piece with no voice, and a thud on each quick cut); \"screen\" when the piece is cued on beats */\n kit?: \"voice\" | \"screen\";\n /** the bed's beats in the cut's frames, for parts cued by `beat` (a take with no voice; the host gives BEATS) */\n beats?: number[];\n}\n\n/** The frame a take's parts sit in: works out every part's span from the words, gives the top band to one part at a\n * time (each ends where the next starts), and tells Captions where the band is busy. */\nexport function Ad({ children, accent: a, strike, font, tone = \"dark\", shade = tone === \"dark\", beats = [], kit = beats.length ? \"screen\" : \"voice\" }: AdProps) {\n const words = useWords();\n const { fps, durationInFrames } = useVideoConfig();\n const items = Children.toArray(children).filter(isValidElement) as ReactElement<Cue>[];\n // the parts' spans are layout.ts's, the same the feed's host lays the parts lane out with\n const nameOf = (el: ReactElement) => Object.keys(PARTS).find((k) => PARTS[k] === META.get(el.type as object));\n const placed = items.flatMap((el, i) => { const name = nameOf(el); return name ? [{ i, name, cue: el.props }] : []; });\n const laid = layout(findPhrase, placed, words, beats, fps, durationInFrames);\n const spans = laid.spans;\n const band: (Span & { kind: Kind; top: number; i: number })[] = laid.band.map((b) => ({ ...b, top: topOf(items[b.i].props.place) }));\n const vars = { ...(tone === \"light\" ? LIGHT : {}), \"--brand-accent\": a, \"--brand-strike\": strike, \"--brand-font\": font } as Record<string, string | undefined>;\n const style = Object.fromEntries(Object.entries(vars).filter(([, v]) => v)) as CSSProperties;\n return (\n <KitContext.Provider value={kit}>\n <BeatsContext.Provider value={beats}>\n <AdContext.Provider value={{ spans, band }}>\n <AbsoluteFill style={{ backgroundColor: \"#000\", ...style }}>\n {items.map((el, i) => {\n const meta = META.get(el.type as object);\n const node = meta?.kind === \"take\" && shade ? [el, <Shade key=\"shade\" />] : el;\n return spans.has(i) ? <SpanContext.Provider key={i} value={spans.get(i)!}>{node}</SpanContext.Provider> : <AdItem key={i}>{node}</AdItem>;\n })}\n </AbsoluteFill>\n </AdContext.Provider>\n </BeatsContext.Provider>\n </KitContext.Provider>\n );\n}\n\nconst AdItem = ({ children }: { children: ReactNode }) => <>{children}</>;\n\n/** The dark grade behind the top band. */\nexport function Shade() {\n return <AbsoluteFill style={{ backgroundImage: \"linear-gradient(180deg, rgba(20,16,12,0.55) 0%, rgba(20,16,12,0.35) 24%, rgba(20,16,12,0) 52%)\" }} />;\n}\n\n// ---- the take ----------------------------------------------------------------------------------------------------\n\nexport interface TakeProps {\n src: string;\n /** the take's kept stretches in its own seconds, [from, to], played one after another (a tight cut) */\n segments?: [number, number][];\n /** where the face is in the take, as shares of its picture (x across, y down); the zoom holds it in place */\n face?: { x: number; y: number };\n /** the zoom on alternate cuts: [the even cuts', the odd cuts'] (a punch-in on every other cut) */\n punch?: [number, number];\n /** the voice's gain in dB */\n gain?: number;\n /** per segment, where to look and how close, in place of `face` and `punch`: {x, y} shares of the picture held\n * still, `zoom` 1 for the whole picture (a screen recording's shots: the host gives them) */\n shots?: { x?: number; y?: number; zoom?: number }[];\n}\n\n/** A talking take, cut to its segments, each pushing in slowly, the zoom punching in on every other cut. */\nfunction TakeBody({ src, segments, face = { x: 0.5, y: 0.35 }, punch = [1.12, 1.26], gain = 0, shots }: TakeProps) {\n const { fps, durationInFrames } = useVideoConfig();\n const kit = useContext(KitContext);\n const segs = segments ?? [[0, durationInFrames / fps]];\n let at = 0;\n return (\n <>\n {segs.map(([a, b], n) => {\n const from = at;\n const len = Math.max(1, Math.round((b - a) * fps));\n at += len;\n return (\n <Sequence key={n} from={from} durationInFrames={len} name={`take ${n + 1}`}>\n {/* a screen piece's quick flips (under a second) each land with a thud, softer than a part's */}\n {kit === \"screen\" && n > 0 && len < fps ? <Hit sound={undefined} fallback={THUD[0]} gain={-12} seconds={1} /> : null}\n <Shot src={src} start={Math.round(a * fps)} len={len} face={shots?.[n] ? { x: shots[n].x ?? 0.5, y: shots[n].y ?? 0.5 } : face} zoom={shots?.[n] ? shots[n].zoom ?? 1 : punch[n % 2]} gain={gain} />\n </Sequence>\n );\n })}\n </>\n );\n}\n\nfunction Shot({ src, start, len, face, zoom, gain }: { src: string; start: number; len: number; face: { x: number; y: number }; zoom: number; gain: number }) {\n const f = useCurrentFrame();\n const { width, height } = useVideoConfig();\n const z = interpolate(f, [0, len], [zoom, zoom + 0.035], clamp);\n // cover with the face's point at its own share of the box; the zoom is about the centre, so it's shifted back to\n // keep that point still\n const tx = (1 - z) * (face.x - 0.5) * width;\n const ty = (1 - z) * (face.y - 0.5) * height;\n return (\n <AbsoluteFill style={{ overflow: \"hidden\", backgroundColor: \"#000\" }}>\n <Video src={src} startFrom={start} endAt={start + len} gainDb={gain}\n style={{ position: \"absolute\", width: \"100%\", height: \"100%\", objectFit: \"cover\", objectPosition: `${face.x * 100}% ${face.y * 100}%`, transform: `translate(${tx}px, ${ty}px) scale(${z})` }} />\n </AbsoluteFill>\n );\n}\n\nexport const Take = (p: TakeProps) => <TakeBody {...p} />;\n\nMETA.set(Take, PARTS.Take);\n",- "index.tsx": "// The reel's parts (an example: `raea part add reel` copies this folder into components/reel): designed parts for a talking take, each placed by one line and cued from the take's words\n// (docs/craft-system.md, phase 9). The look and the sound are the approved reel's (golden 10): heavy\n// condensed capitals with a three-layer shadow, a lime accent, dark cards, and SAO foley on each designed moment.\n//\n// <Ad>\n// <Take src={take} segments={[[0, 1.6], [1.72, 2.95]]} />\n// <Hook say=\"nine in ten\" text=\"*9 in 10* / buyers / read reviews first\" />\n// <StatCard say=\"only a third\" big=\"33%\" text=\"of shops / answer / *within a day*\"\n// bars={[{ label: \"answer in a day\", value: \"33%\", fill: 0.33 }, { label: \"buyers who wait\", value: \"~10%\", fill: 0.1, say: \"wait\" }]} />\n// <Captions />\n// <Follow say=\"follow\" text=\"+ follow for more\" />\n// </Ad>\n//\n// A part's `say` is a phrase from the transcript, word for word: the part lands on it. `until` is the phrase it leaves\n// on (the end of its last word), or `seconds` its length. Inside <Ad> the top band holds one part at a time, so a part\n// ends where the next one starts, and Captions keep out of the band's way: under a card, hidden under a hook, a strike\n// or the ask, and big at the top when the band is empty. `*word*` marks the accent and \" / \" splits lines.\nexport { Ad, Shade, Take, Hook, StatCard, Strike, Phrases, Callout, Follow, EndCard, Captions, Bed } from \"./all\";\nexport type { Place, Cue, AdProps, TakeProps, HookProps, Bar, StatCardProps, StrikeProps, PhrasesProps, CalloutProps, FollowProps, EndCardProps, CaptionsProps, BedProps } from \"./all\";\n\n\n",+ "index.tsx": "// The reel's parts (an example: `raea component add reel` copies this folder into components/reel): designed parts for a talking take, each placed by one line and cued from the take's words\n// (docs/craft-system.md, phase 9). The look and the sound are the approved reel's (golden 10): heavy\n// condensed capitals with a three-layer shadow, a lime accent, dark cards, and SAO foley on each designed moment.\n//\n// <Ad>\n// <Take src={take} segments={[[0, 1.6], [1.72, 2.95]]} />\n// <Hook say=\"nine in ten\" text=\"*9 in 10* / buyers / read reviews first\" />\n// <StatCard say=\"only a third\" big=\"33%\" text=\"of shops / answer / *within a day*\"\n// bars={[{ label: \"answer in a day\", value: \"33%\", fill: 0.33 }, { label: \"buyers who wait\", value: \"~10%\", fill: 0.1, say: \"wait\" }]} />\n// <Captions />\n// <Follow say=\"follow\" text=\"+ follow for more\" />\n// </Ad>\n//\n// A part's `say` is a phrase from the transcript, word for word: the part lands on it. `until` is the phrase it leaves\n// on (the end of its last word), or `seconds` its length. Inside <Ad> the top band holds one part at a time, so a part\n// ends where the next one starts, and Captions keep out of the band's way: under a card, hidden under a hook, a strike\n// or the ask, and big at the top when the band is empty. `*word*` marks the accent and \" / \" splits lines.\nexport { Ad, Shade, Take, Hook, StatCard, Strike, Phrases, Callout, Follow, EndCard, Captions, Bed } from \"./all\";\nexport type { Place, Cue, AdProps, TakeProps, HookProps, Bar, StatCardProps, StrikeProps, PhrasesProps, CalloutProps, FollowProps, EndCardProps, CaptionsProps, BedProps } from \"./all\";\n\n\n","layout.ts": "// Where <Ad>'s parts sit in time, with no React and no imports: index.tsx renders from it, and the feed's host lays a\n// composition's parts out with it (apps/app/host/parts.ts), so the parts lane on the timeline is the render's layout.\n// The phrase finder is passed in (findPhrase from raea), which keeps this file importable from anywhere.\n\nexport type Kind = \"take\" | \"band\" | \"card\" | \"captions\" | \"full\" | \"sound\";\nexport interface PartMeta {\n kind: Kind;\n seconds: number;\n ask?: boolean;\n needs?: string[];\n /** its lines are the speaker's words (Phrases): given no cue, it starts where its first line's first words are said */\n says?: boolean;\n}\n/** every part the reel has, by name */\nexport const PARTS: Record<string, PartMeta> = {\n Take: { kind: \"take\", seconds: 0 },\n Hook: { kind: \"band\", seconds: 2.5, needs: [\"text\"] },\n StatCard: { kind: \"card\", seconds: 4, needs: [\"big\"] },\n Strike: { kind: \"band\", seconds: 5, needs: [\"text\", \"not\"] },\n Phrases: { kind: \"band\", seconds: 8, needs: [\"text\"], says: true },\n Callout: { kind: \"card\", seconds: 3, needs: [\"title\"] },\n Follow: { kind: \"band\", seconds: 2.5, ask: true, needs: [\"text\"] },\n EndCard: { kind: \"full\", seconds: 2.5, ask: true, needs: [\"name\"] },\n Captions: { kind: \"captions\", seconds: 0 },\n Bed: { kind: \"sound\", seconds: 0 },\n};\n\n/** how a part is placed in time (the timing half of parts.tsx's Cue) */\nexport interface Timing {\n say?: string;\n occurrence?: number;\n until?: string;\n seconds?: number;\n from?: number;\n beat?: number;\n untilBeat?: number;\n /** the part's lines, \" / \" between them: a part that says them (Phrases) and has no cue starts on the first */\n text?: string;\n}\nexport interface Word {\n text: string;\n /** first frame */\n from: number;\n /** the frame after it ends */\n to: number;\n}\n/** findPhrase from @raea/video/phrase: the frame a phrase is said */\nexport type Find = (words: readonly Word[], phrase: string, options?: { occurrence?: number; edge?: \"start\" | \"end\" }) => number;\nexport interface Span {\n from: number;\n to: number;\n}\nexport interface Placed {\n /** its place among <Ad>'s children */\n i: number;\n name: string;\n cue: Timing;\n}\nexport interface Laid {\n spans: Map<number, Span>;\n /** the parts in the top band, the cards and the full-frame ones, in time order */\n band: (Span & { kind: Kind; i: number })[];\n}\n\n/** the shortest a part cued on the music stays up, seconds */\nexport const READ = 1.5;\n\n/** The frame of the bed's beat n; the error names the part. */\nexport function onBeat(beats: readonly number[], part: string, n: number): number {\n if (!beats.length) throw new Error(`<${part}>: beat={${n}} needs the bed's beats, as <Ad beats={BEATS}>`);\n if (!Number.isInteger(n) || n < 0 || n >= beats.length) throw new Error(`<${part}>: there is no beat ${n} (the cut has beats 0 to ${beats.length - 1})`);\n return beats[n];\n}\n\n/** Where a phrase lands, said after `after` if it can be; the error names the part. */\nexport function when(find: Find, words: readonly Word[], part: string, phrase: string, opts: { edge?: \"start\" | \"end\"; occurrence?: number; after?: number } = {}): number {\n try {\n if (opts.after !== undefined && opts.occurrence === undefined) {\n for (let n = 1; ; n++) {\n const at = find(words, phrase, { occurrence: n, edge: opts.edge });\n if (at >= opts.after) return at;\n }\n }\n return find(words, phrase, { occurrence: opts.occurrence, edge: opts.edge });\n } catch (e) {\n if (opts.after !== undefined && opts.occurrence === undefined) {\n try { return find(words, phrase, { edge: opts.edge }); } catch { /* the first error says it */ }\n }\n throw new Error(`<${part}>: ${(e as Error).message.replace(/^word\\(/, \"the phrase (\")}`);\n }\n}\n\n/** The first words of a part's first line as a phrase to find (two, or one of three letters or more; *accents* plain),\n * the words a line is said by (parts.tsx lands each line on them). */\nexport function firstWords(text: string): string[] {\n const ws = (text.split(\" / \").map((l) => l.trim()).find(Boolean) ?? \"\").replace(/\\*/g, \"\").split(/\\s+/).filter(Boolean);\n return ws.length ? [ws.slice(0, 2).join(\" \"), ...(ws.length > 1 && ws[0].length >= 3 ? [ws[0]] : [])] : [];\n}\n\n/** Where a part that says its lines starts when it isn't cued: its first line's first words, as `say` would give them\n * (undefined when they aren't said: it then starts at 0 and the part says which line isn't said). */\nfunction saidFirst(find: Find, words: readonly Word[], text: string): number | undefined {\n for (const phrase of firstWords(text)) {\n try {\n return find(words, phrase);\n } catch {\n // not said: try the first word alone\n }\n }\n return undefined;\n}\n\n/** One part's span from its own cue, before <Ad> fits the band together. */\nexport function spanOf(find: Find, name: string, p: Timing, meta: PartMeta, words: readonly Word[], beats: readonly number[], fps: number, total: number): Span {\n const from = p.from ?? (p.beat !== undefined ? onBeat(beats, name, p.beat) : p.say ? when(find, words, name, p.say, { occurrence: p.occurrence }) : meta.says && p.text ? saidFirst(find, words, p.text) ?? 0 : 0);\n // untilBeat is the last beat it's up for (as `until` is the last word): it leaves where the next beat starts\n const to = p.untilBeat !== undefined ? (p.untilBeat + 1 < beats.length ? onBeat(beats, name, p.untilBeat + 1) : (onBeat(beats, name, p.untilBeat), total)) : p.until ? when(find, words, name, p.until, { edge: \"end\", after: from }) : from + Math.round((p.seconds ?? meta.seconds) * fps);\n return { from, to: Math.min(total, Math.max(from + 1, to)) };\n}\n\n/** <Ad>'s layout: each part's span, the band's parts ending where the next starts, the ask holding to the end, and a\n * part cued on the music up at least READ seconds (else the error says how to fix it). */\nexport function layout(find: Find, items: Placed[], words: readonly Word[], beats: readonly number[], fps: number, total: number): Laid {\n const spans = new Map<number, Span>();\n const band: (Span & { kind: Kind; i: number })[] = [];\n const at = new Map(items.map((it) => [it.i, it]));\n for (const it of items) {\n const meta = PARTS[it.name];\n if (!meta || meta.kind === \"take\" || meta.kind === \"captions\") continue;\n const s = spanOf(find, it.name, it.cue, meta, words, beats, fps, total);\n spans.set(it.i, s);\n if (meta.kind === \"band\" || meta.kind === \"card\" || meta.kind === \"full\") band.push({ ...s, kind: meta.kind, i: it.i });\n }\n band.sort((x, y) => x.from - y.from);\n band.forEach((b, n) => {\n const next = band[n + 1];\n const it = at.get(b.i)!;\n const p = it.cue;\n // a part without its own `until` ends where the next one starts\n if (next && b.to > next.from) b.to = Math.max(b.from + 1, next.from);\n // the ask, last in the band and given no length, holds to the end: the piece ends on it, not on a caption\n if (!next && PARTS[it.name]?.ask && !p.until && p.untilBeat === undefined && p.seconds === undefined) b.to = total;\n // a part cued on the music is up long enough to read: a card for a flip is gone before it's seen (promo run 7 put\n // thirteen cards a beat or two each). The error says how to fix it, so the writer can.\n if (p.beat !== undefined && b.to - b.from < READ * fps && b.to < total)\n throw new Error(`<${it.name} beat={${p.beat}}> is on screen ${((b.to - b.from) / fps).toFixed(1)} s (${next && b.to === next.from ? `until the next part, at beat ${at.get(next.i)!.cue.beat}` : `through beat ${p.untilBeat}`}); a part stays up at least ${READ} s, a bar or more, so it can be read: end it later, or drop it`);\n spans.set(b.i, { from: b.from, to: b.to });\n });\n return { spans, band };\n}\n"}};export const TEMPLATE: Record<string, string> = {- "edit.tsx": "// The edit: a React composition rendered by raea (`raea render`). The clips come from cuts.ts (`raea cut` writes it),\n// the parts from components/ (`raea part add` copies them in; they're yours to change), the look from brand/brand.css.\n// Change anything here: layout, timing, what plays when. `raea check` renders it and says what's wrong.\nimport { AbsoluteFill, Audio, Composition, Series, Video, registerRoot } from \"raea\";\nimport { cuts, edit, frames, total } from \"./cuts\";\nimport { css } from \"./styles.gen\";\n\n// Before any cuts: a card saying what comes next, three seconds long. Its colours are its own on purpose, not a brand's\n// (`raea brand SITE` writes brand/brand.css); delete it once the edit has clips.\nfunction Start() {\n return (\n <AbsoluteFill style={{ background: \"#14120f\", color: \"#f2ede4\", justifyContent: \"center\", padding: \"0 8%\", fontFamily: \"Helvetica, Arial, sans-serif\" }}>\n <div style={{ fontSize: edit.width * 0.11, fontWeight: 700, letterSpacing: \"-0.02em\" }}>raea</div>\n <div style={{ fontSize: edit.width * 0.04, marginTop: edit.width * 0.03, lineHeight: 1.4, opacity: 0.8 }}>\n No clips yet. Run raea cut on a take to put its footage in cuts.ts, and this edit plays it.\n </div>\n </AbsoluteFill>\n );\n}\n\nfunction Edit() {\n if (cuts.length === 0) return <Start />;\n return (\n <AbsoluteFill className=\"bg-brand-bg\">\n <style>{css}</style>\n <Series>\n {cuts.map((c, i) => (\n <Series.Sequence key={i} durationInFrames={frames(c)}>\n {/* a talking take: <FaceFrame>; a screen recording: <ScreenFit> (`raea frame TAKE` says which); a take with\n sound alone (a voice recording) plays under whatever you put in its place */}\n {c.kind === \"audio\" ? (\n <Audio src={c.src} startFrom={Math.round(c.from * edit.fps)} endAt={Math.round(c.to * edit.fps)} />\n ) : (\n <Video src={c.src} startFrom={Math.round(c.from * edit.fps)} endAt={Math.round(c.to * edit.fps)} style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }} />\n )}\n </Series.Sequence>\n ))}\n </Series>\n </AbsoluteFill>\n );\n}\n\nregisterRoot(() => <Composition id=\"edit\" component={Edit} width={edit.width} height={edit.height} fps={edit.fps} durationInFrames={total || edit.fps * 3} />);\n",+ "edit.tsx": "// The edit: a React composition rendered by raea (`raea render`). The clips come from cuts.ts (`raea cut` writes it),\n// the parts from components/ (`raea component add` copies them in; they're yours to change), the look from brand/brand.css.\n// Change anything here: layout, timing, what plays when. `raea check` renders it and says what's wrong.\nimport { AbsoluteFill, Audio, Composition, Series, Video, registerRoot } from \"raea\";\nimport { cuts, edit, frames, total } from \"./cuts\";\nimport { css } from \"./styles.gen\";\n\n// Before any cuts: a card saying what comes next, three seconds long. Its colours are its own on purpose, not a brand's\n// (`raea brand SITE` writes brand/brand.css); delete it once the edit has clips.\nfunction Start() {\n return (\n <AbsoluteFill style={{ background: \"#14120f\", color: \"#f2ede4\", justifyContent: \"center\", padding: \"0 8%\", fontFamily: \"Helvetica, Arial, sans-serif\" }}>\n <div style={{ fontSize: edit.width * 0.11, fontWeight: 700, letterSpacing: \"-0.02em\" }}>raea</div>\n <div style={{ fontSize: edit.width * 0.04, marginTop: edit.width * 0.03, lineHeight: 1.4, opacity: 0.8 }}>\n No clips yet. Run raea cut on a take to put its footage in cuts.ts, and this edit plays it.\n </div>\n </AbsoluteFill>\n );\n}\n\nfunction Edit() {\n if (cuts.length === 0) return <Start />;\n return (\n <AbsoluteFill className=\"bg-brand-bg\">\n <style>{css}</style>\n <Series>\n {cuts.map((c, i) => (\n <Series.Sequence key={i} durationInFrames={frames(c)}>\n {/* a talking take: <FaceFrame>; a screen recording: <ScreenFit> (`raea frame TAKE` says which); a take with\n sound alone (a voice recording) plays under whatever you put in its place */}\n {c.kind === \"audio\" ? (\n <Audio src={c.src} startFrom={Math.round(c.from * edit.fps)} endAt={Math.round(c.to * edit.fps)} />\n ) : (\n <Video src={c.src} startFrom={Math.round(c.from * edit.fps)} endAt={Math.round(c.to * edit.fps)} style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }} />\n )}\n </Series.Sequence>\n ))}\n </Series>\n </AbsoluteFill>\n );\n}\n\nregisterRoot(() => <Composition id=\"edit\" component={Edit} width={edit.width} height={edit.height} fps={edit.fps} durationInFrames={total || edit.fps * 3} />);\n","theme.css": "/* The Tailwind theme every raea project compiles with: class names (text-brand-accent, bg-brand-surface, font-brand,\n text-caption, rounded-brand) mapped onto the brand kit's variables (brand/brand.css, the --brand-* format).\n Nothing here is a colour, a font or a size of its own: change the brand, and every component follows. The kit's\n sizes are the website's, so on a 1080x1920 video they're scaled up (the kit's own note: about 2.5x). */\n@theme inline {\n --color-brand-accent: var(--brand-accent);\n --color-brand-bg: var(--brand-background);\n --color-brand-surface: var(--brand-background);\n --color-brand-on-surface: var(--brand-text);\n --color-brand-ink: var(--brand-background);\n --color-brand-on-accent: var(--brand-background);\n --color-brand-1: var(--brand-color-1);\n --color-brand-2: var(--brand-color-2);\n --color-brand-3: var(--brand-color-3);\n --font-brand: var(--brand-font-heading);\n --font-brand-body: var(--brand-font);\n --text-display: calc(var(--brand-h1-size) * 3);\n --text-title: calc(var(--brand-h2-size) * 2.5);\n --text-caption: calc(var(--brand-h2-size) * 2.5);\n --text-body: calc(var(--brand-p-size) * 2.5);\n --text-label: calc(var(--brand-h4-size) * 2.2);\n --radius-brand: var(--brand-radius);\n}\n"};diff --git a/engine/cli/template/edit.tsx b/engine/cli/template/edit.tsxindex 5055549c..062829b2 100644--- a/engine/cli/template/edit.tsx+++ b/engine/cli/template/edit.tsx@@ -1,5 +1,5 @@// The edit: a React composition rendered by raea (`raea render`). The clips come from cuts.ts (`raea cut` writes it),-// the parts from components/ (`raea part add` copies them in; they're yours to change), the look from brand/brand.css.+// the parts from components/ (`raea component add` copies them in; they're yours to change), the look from brand/brand.css.// Change anything here: layout, timing, what plays when. `raea check` renders it and says what's wrong.import { AbsoluteFill, Audio, Composition, Series, Video, registerRoot } from "raea";import { cuts, edit, frames, total } from "./cuts";diff --git a/examples/parts/brand/callout.tsx b/examples/parts/brand/callout.tsxindex 105037bf..3e03c922 100644--- a/examples/parts/brand/callout.tsx+++ b/examples/parts/brand/callout.tsx@@ -1,4 +1,4 @@-// raea part add callout: a short labelled card that slides in with the line it supports (a step, a claim, a stat), in the+// raea component add callout: a short labelled card that slides in with the line it supports (a step, a claim, a stat), in the// band away from the face. Put it in a <Sequence from durationInFrames> timed to the words (word("phrase") finds them).import { Easing, Region, interpolate, useCurrentFrame } from "raea";diff --git a/examples/parts/brand/captions.tsx b/examples/parts/brand/captions.tsxindex 5d30bbab..83b4922e 100644--- a/examples/parts/brand/captions.tsx+++ b/examples/parts/brand/captions.tsx@@ -1,4 +1,4 @@-// raea part add captions: the spoken words, a few at a time, the word being said lit. Reads the edit's words itself+// raea component add captions: the spoken words, a few at a time, the word being said lit. Reads the edit's words itself// (useWords(): `raea cut` writes them beside cuts.ts). Sits in the bottom band (parts take the top by default, so they// never share one), on the brand's surface with its own text colour, a pair the kit keeps readable on any footage.// Styled only from the brand's tokens (brand/brand.css); change anything here, it's yours.diff --git a/examples/parts/brand/end-card.tsx b/examples/parts/brand/end-card.tsxindex eb1b7716..b591ecab 100644--- a/examples/parts/brand/end-card.tsx+++ b/examples/parts/brand/end-card.tsx@@ -1,4 +1,4 @@-// raea part add end-card: the closing card: the brand's name or logo, one line, and the ask (follow, shop, try). Give it the+// raea component add end-card: the closing card: the brand's name or logo, one line, and the ask (follow, shop, try). Give it the// last 2 to 3 seconds in a <Sequence>; it fades in over the footage or a fill of the brand's background.import { AbsoluteFill, Img, interpolate, useCurrentFrame } from "raea";diff --git a/examples/parts/brand/face-frame.tsx b/examples/parts/brand/face-frame.tsxindex 97df4cdb..9dd81ab8 100644--- a/examples/parts/brand/face-frame.tsx+++ b/examples/parts/brand/face-frame.tsx@@ -1,4 +1,4 @@-// raea part add face-frame: a talking take cropped around the face for the edit's shape. The engine finds the face+// raea component add face-frame: a talking take cropped around the face for the edit's shape. The engine finds the face// itself (framing="face": raea-perceive's eye track, kept beside the take as TAKE.faces.json) and keeps the eyes 38%// down the frame as the speaker moves; punchIn tightens it (1.15 is a usual punch-in for emphasis). An objectPosition or// transform of your own on the Video turns the framing off, so this part sets neither.diff --git a/examples/parts/brand/follow.tsx b/examples/parts/brand/follow.tsxindex 19c82f59..0989d4b5 100644--- a/examples/parts/brand/follow.tsx+++ b/examples/parts/brand/follow.tsx@@ -1,4 +1,4 @@-// raea part add follow: the ask as a pill that hugs its text ("Follow for part 2", "Shop the stack"). Give it the moment the+// raea component add follow: the ask as a pill that hugs its text ("Follow for part 2", "Shop the stack"). Give it the moment the// speaker asks, or the last seconds.import { Region, interpolate, useCurrentFrame } from "raea";diff --git a/examples/parts/brand/lockup.tsx b/examples/parts/brand/lockup.tsxindex 9e29cc2e..0653380c 100644--- a/examples/parts/brand/lockup.tsx+++ b/examples/parts/brand/lockup.tsx@@ -1,4 +1,4 @@-// raea part add lockup: a few lines stacked big, each landing as it's said. " / " splits the lines; *word* marks the accent.+// raea component add lockup: a few lines stacked big, each landing as it's said. " / " splits the lines; *word* marks the accent.// Put it in a <Sequence> over the words it echoes; each line appears on its first word (or one by one, 8 frames apart,// when the line isn't said). Styled only from the brand's tokens.import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";diff --git a/examples/parts/brand/notthat.tsx b/examples/parts/brand/notthat.tsxindex 25769e5a..00df7630 100644--- a/examples/parts/brand/notthat.tsx+++ b/examples/parts/brand/notthat.tsx@@ -1,4 +1,4 @@-// raea part add notthat: a lead statement, then the idea it rejects on a card, struck through when the speaker says+// raea component add notthat: a lead statement, then the idea it rejects on a card, struck through when the speaker says// strikeSay ("not X, but Y"). strikeSay is a phrase from the transcript, word for word.import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";diff --git a/examples/parts/brand/screen-fit.tsx b/examples/parts/brand/screen-fit.tsxindex 5b828950..bedecca9 100644--- a/examples/parts/brand/screen-fit.tsx+++ b/examples/parts/brand/screen-fit.tsx@@ -1,4 +1,4 @@-// raea part add screen-fit: a landscape screen recording shown whole in a vertical frame, over a soft fill of itself, instead+// raea component add screen-fit: a landscape screen recording shown whole in a vertical frame, over a soft fill of itself, instead// of a cover crop that cuts its sides off (every app render on 2026-10-16 lost Jetflow's UI that way). `raea frame`// says when a take wants this. Leaves the space above and below for a headline and captions.import { AbsoluteFill, Video, useVideoConfig } from "raea";diff --git a/examples/parts/brand/statcard.tsx b/examples/parts/brand/statcard.tsxindex 607d9533..f0fc09fe 100644--- a/examples/parts/brand/statcard.tsx+++ b/examples/parts/brand/statcard.tsx@@ -1,4 +1,4 @@-// raea part add statcard: a number and up to three lines beside it (*word* marks the accent), and up to two labelled bars+// raea component add statcard: a number and up to three lines beside it (*word* marks the accent), and up to two labelled bars// that fill on the words that say them. Use it only when the footage says a real number; every claim comes from the// brand's own material or the take. *_say props are phrases from the transcript, word for word.import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";diff --git a/examples/parts/reel/index.tsx b/examples/parts/reel/index.tsxindex 6a6168fa..73065d17 100644--- a/examples/parts/reel/index.tsx+++ b/examples/parts/reel/index.tsx@@ -1,4 +1,4 @@-// The reel's parts (an example: `raea part add reel` copies this folder into components/reel): designed parts for a talking take, each placed by one line and cued from the take's words+// The reel's parts (an example: `raea component add reel` copies this folder into components/reel): designed parts for a talking take, each placed by one line and cued from the take's words// (docs/craft-system.md, phase 9). The look and the sound are the approved reel's (golden 10): heavy// condensed capitals with a three-layer shadow, a lime accent, dark cards, and SAO foley on each designed moment.//diff --git a/sdk/guides/craft/motion.md b/sdk/guides/craft/motion.mdindex dbf29155..bdb59fd1 100644--- a/sdk/guides/craft/motion.md+++ b/sdk/guides/craft/motion.md@@ -4,7 +4,7 @@ A composition is a React component that is rendered once per frame. Every framealone, with nothing carried over between frames. The engine decodes the footage, paints the page, draws the 3Dand mixes the sound, so your job is to say what each frame looks and sounds like.-Write it in the object's own files: edit.tsx, cuts.ts (`raea cut` writes it) and components/ (`raea part add` copies+Write it in the object's own files: edit.tsx, cuts.ts (`raea cut` writes it) and components/ (`raea component add` copiesparts in). AGENTS.md lists the whole API. These files say how to use it well.## Which file to readdiff --git a/sdk/guides/craft/motion/footage.md b/sdk/guides/craft/motion/footage.mdindex ff949c9f..6b9bfed8 100644--- a/sdk/guides/craft/motion/footage.md+++ b/sdk/guides/craft/motion/footage.md@@ -11,7 +11,7 @@time shown at the clip's frame `f` is `(startFrom + f * playbackRate) / fps`. `trimBefore` and `trimAfter` are othernames for the same two props: use one name or the other, never both.- Frame a talking head on its face. `raea frame TAKE` says whether the take is a talking take (`<FaceFrame>`, from- `raea part add face-frame`) or a wide screen recording (`<ScreenFit>`). `<FaceFrame src={take} />` (or+ `raea component add face-frame`) or a wide screen recording (`<ScreenFit>`). `<FaceFrame src={take} />` (or`<Video framing="face">`) has the engine find the face and keep the eyes 38% down the frame as the speaker moves; anobjectPosition or transform of your own on that Video turns the framing off. Zoom a clip for emphasis with`punchIn={1.15}`. Alternating punched and unpunched clips between cuts gives a talking head rhythm without a zoomdiff --git a/sdk/guides/craft/motion/parts.md b/sdk/guides/craft/motion/parts.mdindex e5d9e176..53ee3df3 100644--- a/sdk/guides/craft/motion/parts.md+++ b/sdk/guides/craft/motion/parts.md@@ -1,6 +1,6 @@# Parts: a talking take, dressed by name-The reel's parts are designed parts for a talking take. They're an example the project owns: `raea part add reel`+The reel's parts are designed parts for a talking take. They're an example the project owns: `raea component add reel`copies them into components/reel/, yours to change, and you import them from "./components/reel". You place each onewith one line, and each one lands on the words that say it. You don't lay out boxes or count frames. You choose whichpart goes on which beat, and what it says.