The component library says when to use each piece: search by how people ask, show NAME, props and upstream names (#315)

An agent asked for "the effect template for composer animations with Claude" found nothing: the catalog had one thin
line per item and the search only read names and that line. Now:

- tools/library-meta.sh (enrich.ts, props.ts, upstream.ts, words.ts, hand.json) matches each of the 609 items by
  content to the upstream component it came from (all 609 match; snapcn's terminal-simulator and text-highlight are
  ui/terminal-session and text/highlight-sweep here) and writes into catalog.json: upstream (a search alias only),
  what (what it draws and how it moves), use_when and avoid_when (upstream's useWhen/avoidWhen in plain words, other
  libraries' names out, pointers rewritten to our category/name or dropped), asked_as (upstream's askedAs plus the
  words people use for its kind: template, effect, composer, chat input, AI prompt, terminal, Claude Code...), props
  (name, type, default and a line each, read from its Props type with the TypeScript parser), length, fps, size,
  aspect and vibe. snapcn's and React Video Editor's items have no when-to-use upstream: hand.json holds those, 134.
- raea make component list WORDS searches names, upstream names and asked_as heavily, what and use_when once; filler
  words are skipped and "template"/"effect"/"preset" alone list the items that are one with how to narrow it.
- raea make component show NAME prints one item in full; list/show --json give the same as JSON.
- sdk/guides/craft/components.md: a template, an effect or a branded screen goes to the library first.

Co-authored-by: shinyobjectz <[email protected]>
This commit is contained in:
shaneandshinyobjectz authored and GitHub committed 2026-12-03 12:29:09 -08:00
1 parent 2cbfa8c608
commit 8dfd71eb92
13 files changed
+27632 -650

No files matched your search

+10 -4
View File
@@ -13,9 +13,12 @@ every project to import as `@shared/components/NAME`. `raea part` is the old nam
Beside raea's own sets is the library: several hundred open-source components (text reveals, counters, charts,
transitions, product-screen demos, game HUDs and more), sorted by what they're for rather than who made them.
`raea make component list` ends with its categories; `list WORDS` searches it by a category (`text`), a category and
type (`text/reveal`), or words in a name or description (`"count up"`). `add NAME` copies the component into
`components/CATEGORY/NAME/`, with the shared helpers it needs under `components/_lib/`. Each file's first line names
the library it came from, and `CREDITS.md` in sdk/raea/library/components holds their licences.
type (`text/reveal`), a name or the name it had upstream, the phrases people ask for it with (`"chat input"`,
`composer`, `"lower third"`, `template`), or words in what it does (`"count up"`). `show NAME` tells one in full: what
it draws and how it moves, when to use it and when not, the size and length it was designed at, and each prop with its
type, default and what it does; `--json` gives the same as JSON, for every hit of a `list`. `add NAME` copies the
component into `components/CATEGORY/NAME/`, with the shared helpers it needs under `components/_lib/`. Each file's
first line names the library it came from, and `CREDITS.md` in sdk/raea/library/components holds their licences.
```sh
raea make component list
@@ -23,6 +26,8 @@ raea make component add captions end-card
raea make component add reel --shared
raea make component list text/reveal
raea make component list count up
raea make component list chat input
raea make component show prompt-send
raea make component add soft-blur-in
```
@@ -31,7 +36,7 @@ raea make component add soft-blur-in
## Usage
```sh
raea make component list [WORDS] | raea make component add NAME ... [--shared] [--force] (a ready component or set copied into components/, or the workspace's shared/components/ with --shared, yours to change; WORDS search the library by use: text/reveal, "count up")
raea make component list [WORDS] [--json] | raea make component show NAME [--json] | raea make component add NAME ... [--shared] [--force] (a ready component or set copied into components/, or the workspace's shared/components/ with --shared, yours to change; WORDS search the library by use and by how people ask: text/reveal, "count up", "chat input", template; show tells one in full: what it draws, when to use it and when not, its props)
```
Headless: it needs nothing running and opens no window. Takes any number of arguments besides its flags.
@@ -41,6 +46,7 @@ Headless: it needs nothing running and opens no window. Takes any number of argu
| Flag | Takes | What it does |
| --- | --- | --- |
| `--force` | – | Replace a component's files that are already there. Without it, an existing component is left alone and the command stops. |
| `--json` | – | The library's items as JSON (`list`: every hit, best first; `show`: the one), each with its props, when to use it and when not, and the phrases it's asked for with. |
| `--shared` | – | Copy into the workspace's `shared/components/` instead, where every project in the workspace imports it as `/components/NAME`. |
<!-- generated:end -->
+36 -2
View File
@@ -1,9 +1,10 @@
// The component library (sdk/raea/library/components, catalog.ts): every listed file is there, every relative import
// in it lands on a file of the library, nothing imports another video framework, and the search finds by use.
// in it lands on a file of the library, nothing imports another video framework, the search finds by use and by the
// words people ask with, and each item carries what an agent picks by (tools/library-meta.sh writes it).
import { describe, expect, test } from "bun:test";
import { existsSync, readFileSync } from "node:fs";
import { dirname, join, normalize } from "node:path";
import { listed, type Item } from "../src/catalog";
import { listed, searched, shown, terms, type Item } from "../src/catalog";
const lib = join(import.meta.dir, "../../../sdk/raea/library/components");
const cat = JSON.parse(readFileSync(join(lib, "catalog.json"), "utf8")) as { sources: Record<string, { licence: string }>; items: Item[] };
@@ -45,4 +46,37 @@ describe("the component library", () => {
expect(listed(cat.items, ["count", "up"]).split("\n")[0]).toContain("count");
expect(listed(cat.items, ["zzqx"])).toContain("no component in the library");
});
test("each item says what it draws, when to use it and not, how it's asked for, and its props", () => {
const thin = cat.items.filter((i) => !i.what || !i.use_when?.length || !i.avoid_when?.length || !i.asked_as?.length || !Array.isArray(i.props) || !i.aspect);
expect(thin.map((i) => i.name)).toEqual([]);
// its props are the ones its file declares
const flash = cat.items.find((i) => i.name === "flash-count")!;
expect(flash.props!.find((p) => p.name === "value")).toMatchObject({ type: "number", default: "3600" });
});
test("its words name no other library or its tooling: the components are raea's", () => {
const named = cat.items.flatMap((i) => [i.what ?? "", ...(i.use_when ?? []), ...(i.avoid_when ?? [])].filter((s) => /\b(remotion|remocn|snapcn|snap-cn|shadcn)\b/i.test(s)).map((s) => `${i.name}: ${s}`));
expect(named).toEqual([]);
});
test("search by the words people use: a product's UI, a composer, a chat input, a template, an AI prompt", () => {
const top = (q: string, n = 3) => searched(cat.items, terms([q])).slice(0, n).map((i) => `${i.category}/${i.name}`);
expect(top("claude code").every((n) => /terminal|agent/.test(n))).toBe(true);
expect(top("composer")).toEqual(expect.arrayContaining(["ui/prompt-send"]));
expect(top("chat input", 5)).toEqual(expect.arrayContaining(["ui/input", "ui/prompt-send"]));
expect(top("AI prompt").every((n) => n.startsWith("ui/prompt-"))).toBe(true);
expect(top("composer animations with claude")).toEqual(expect.arrayContaining(["ui/prompt-send"]));
// the upstream name is a search alias: snapcn's terminal-simulator is ui/terminal-session here
expect(top("terminal simulator", 2).sort()).toEqual(["ui/terminal-session", "ui/terminal-simulator"]);
// "template" alone: the items that are one, and how to narrow it
expect(listed(cat.items, ["template"])).toContain("say what it shows to narrow it");
expect(listed(cat.items, ["cli"])).not.toContain("click-type");
});
test("show: one item in full, with its props and when to use it", () => {
const i = cat.items.find((i) => i.name === "prompt-send")!;
const s = shown(i);
for (const want of ["ui/prompt-send", "use it when:", "not when:", "props:", "text?: string", "raea make component add prompt-send", 'import { PromptSend } from "./components/ui/prompt-send"']) expect(s).toContain(want);
});
});
+88 -24
View File
@@ -6,7 +6,15 @@
import { existsSync, readFileSync, realpathSync } from "node:fs";
import { dirname, join } from "node:path";
export type Item = { name: string; category: string; type: string; says: string; component: string; default?: boolean; files: string[]; needs: string[]; fonts: string[]; packages?: string[]; from: string };
/** One of a component's props, read from its Props type: its type as written, its default, a line on what it does */
export type Prop = { name: string; type: string; default?: string; says?: string; required?: boolean };
/** An item; the fields after `from` are tools/library-meta.sh's: the upstream component it was matched to by content
* (a search alias, never its name here), what it draws and how it moves, when to use it and when not, the phrases
* people ask for it with, its props, and the length, frame rate, size, aspect and feel it was designed at */
export type Item = {
name: string; category: string; type: string; says: string; component: string; default?: boolean; files: string[]; needs: string[]; fonts: string[]; packages?: string[]; from: string;
upstream?: string; what?: string; use_when?: string[]; avoid_when?: string[]; asked_as?: string[]; props?: Prop[]; length?: number; fps?: number; size?: string; aspect?: string; vibe?: string;
};
type Catalog = { sources: Record<string, { url: string; licence: string }>; items: Item[] };
export type Got = { item: Item; licence: string; files: Record<string, string> };
@@ -17,6 +25,9 @@ function home(raea: string, env: Record<string, string | undefined>): string | u
return [env.RAEA_HOME && join(env.RAEA_HOME, rel), join(bin, "../share/raea", rel), join(bin, "../..", rel)].find((p) => p && existsSync(join(p, "catalog.json")));
}
/** An item by its name, category/name or category/type/name */
export const found = (items: Item[], want: string) => items.find((i) => i.name === want || `${i.category}/${i.name}` === want || `${i.category}/${i.type}/${i.name}` === want);
/** Host op "components": {op: "list"} is every item, {op: "get", name} one item with its files' text (by its path in
* the library, which is its path under components/). No library beside this raea: an empty list, and no item. */
export function componentsHost(raea: string, env: Record<string, string | undefined>, a: Record<string, unknown>): Item[] | Got | null {
@@ -25,46 +36,99 @@ export function componentsHost(raea: string, env: Record<string, string | undefi
const cat = JSON.parse(readFileSync(join(dir, "catalog.json"), "utf8")) as Catalog;
if (a.op !== "get") return cat.items;
const want = String(a.name).replace(/^\/+|\/+$/g, "");
const item = cat.items.find((i) => i.name === want || `${i.category}/${i.name}` === want || `${i.category}/${i.type}/${i.name}` === want);
const item = found(cat.items, want);
if (!item) return null;
const files = Object.fromEntries([...item.files, ...item.needs].map((f) => [f, readFileSync(join(dir, f), "utf8")]));
return { item, licence: cat.sources[item.from]?.licence ?? "", files };
}
const row = (i: Item) => `${`${i.category}/${i.name}`.padEnd(34)} ${i.type.padEnd(13)} ${i.says.split(". ")[0].slice(0, 110)}`;
// what a row says: the item's own line, or what it draws when that line is a few words
const line = (i: Item) => (i.says.length >= 40 || !i.what ? i.says : i.what).split(". ")[0];
const row = (i: Item) => `${`${i.category}/${i.name}`.padEnd(34)} ${i.type.padEnd(13)} ${line(i).slice(0, 110)}`;
// words that say nothing about which one ("a", "animation", "component") are skipped; "template", "effect" and
// "preset" narrow to the items that are one when they're all a search says, and only rank otherwise
const FILLER = new Set(["a", "an", "the", "with", "for", "of", "and", "in", "on", "to", "my", "our", "some", "please", "use", "using", "raea", "component", "components", "animation", "animations", "animated", "thing", "something", "from", "like", "one"]);
const SOFT = new Set(["template", "templates", "effect", "effects", "preset", "presets"]);
const esc = (w: string) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
// a word at a word's start ("count" finds "counter"); a short one only whole ("cli" isn't "click", "ai" isn't "aim")
const finds = (w: string) => (w.length <= 3 ? new RegExp(`(^|[^a-z0-9])${esc(w)}(s|es)?($|[^a-z0-9])`, "i") : new RegExp(`(^|[^a-z0-9])${esc(w.replace(/s$/, ""))}`, "i"));
/** How well an item answers the words: 0 when a word that matters isn't anywhere in it. The name, the upstream name
* and the phrases people ask for it with count most; what it does and when to use it count once */
export function scored(i: Item, ws: string[]): number {
const asked = (i.asked_as ?? []).join(" | ");
const told = [i.says, i.what ?? "", ...(i.use_when ?? [])].join(" ");
const named = (n: string | undefined, w: string) => (!n ? 0 : n.split("-").includes(w) ? 3 : w.length > 3 && n.includes(w) ? 2 : 0);
const key = ws.filter((w) => !SOFT.has(w));
let s = 0;
// the words together, as written: a phrase people ask with, a name, or a sentence of what it does
const phrase = key.join(" ");
if (key.length > 1) s += (i.asked_as ?? []).some((a) => a.toLowerCase().includes(phrase)) ? 6 : [i.name, i.upstream ?? ""].includes(key.join("-")) ? 6 : told.toLowerCase().includes(phrase) ? 3 : 0;
for (const w of ws) {
const [c, t] = w.split("/");
const re = finds(w);
let got = 0;
if (w.includes("/")) got = i.category === c && (!t || i.type === t) ? 4 : 0;
else if (i.category === w || i.type === w) got = 4;
// its name (or upstream's), the phrases it's asked for with, and its own words each add
else got = Math.max(named(i.name, w), named(i.upstream, w)) + (re.test(asked) ? 3 : 0) + (re.test(told) || i.from === w ? 1 : 0);
if (!got && !SOFT.has(w)) return 0;
s += got;
}
return s;
}
/** `raea make component list`'s lines for the library: with no words, each category and its types; with words, the
* items they name. A word is a category ("text"), a category/type ("text/reveal"), or anything in a name or in what
* an item does; every word must be found, and a name's own words count first. */
* items they name. A word is a category ("text"), a category/type ("text/reveal"), a name or upstream name, or
* anything in the phrases people ask with, what it does or when to use it; every word that matters must be found */
export function listed(items: Item[], words: string[]): string {
if (!items.length) return "";
if (!words.length) {
const ws = terms(words);
if (!ws.length) {
const cats = [...new Set(items.map((i) => i.category))].sort();
const line = (c: string) => {
const of = items.filter((i) => i.category === c);
const types = [...new Set(of.map((i) => i.type))].sort().map((t) => `${t} ${of.filter((i) => i.type === t).length}`);
return `${c.padEnd(14)} ${String(of.length).padStart(3)} ${types.join(", ")}`;
};
return `\nThe library, by what a component is for (raea make component list text, list text/reveal, list "count up"; add NAME copies one):\n${cats.map(line).join("\n")}\n`;
return `\nThe library, by what a component is for (raea make component list text, list text/reveal, list "chat input", list "count up"; show NAME tells one in full; add NAME copies one):\n${cats.map(line).join("\n")}\n`;
}
const ws = words.join(" ").toLowerCase().split(/\s+/).filter(Boolean);
const phrase = ws.join(" ");
const score = (i: Item) => {
// the words together, as written, in what it does: ahead of the same words scattered
let s = ws.length > 1 && i.says.toLowerCase().includes(phrase) ? 3 : 0;
for (const w of ws) {
const [c, t] = w.split("/");
if (w.includes("/") ? i.category === c && (!t || i.type === t) : i.category === w || i.type === w) s += 4;
else if (i.name.split("-").includes(w)) s += 3;
else if (i.name.includes(w)) s += 2;
else if (i.says.toLowerCase().includes(w)) s += 1;
else return 0;
}
return s;
};
const found = items.map((i) => [score(i), i] as const).filter(([s]) => s > 0).sort((a, b) => b[0] - a[0] || a[1].name.localeCompare(b[1].name));
const found = searched(items, ws);
if (!found.length) return `no component in the library for "${words.join(" ")}" (raea make component list shows the categories)\n`;
return found.map(([, i]) => row(i)).join("\n") + "\n";
// "template" or "effect" alone: the items that are one, a page of them, and how to narrow it
if (ws.every((w) => SOFT.has(w))) {
const top = found.slice(0, 30);
return `${found.length} components are a ${ws[0].replace(/s$/, "")}; say what it shows to narrow it (list ${ws[0]} chat, list ${ws[0]} logo, list "${ws[0]} product demo"):\n${top.map(row).join("\n")}\n${found.length > top.length ? `... and ${found.length - top.length} more\n` : ""}`;
}
return found.map(row).join("\n") + "\n";
}
/** A search's words that matter, in lower case */
export const terms = (words: string[]) => words.join(" ").toLowerCase().split(/\s+/).filter((w) => w && !FILLER.has(w));
/** The items the words find, best first */
export function searched(items: Item[], ws: string[]): Item[] {
// equal scores: the one more of whose asked-for phrases the words are in is more about them
const res = ws.filter((w) => !w.includes("/")).map(finds);
const fit = (i: Item) => (i.asked_as ?? []).filter((a) => res.some((re) => re.test(a))).length;
return items
.map((i) => [scored(i, ws), fit(i), i] as const)
.filter(([s]) => s > 0)
.sort((a, b) => b[0] - a[0] || b[1] - a[1] || a[2].name.localeCompare(b[2].name))
.map(([, , i]) => i);
}
/** `raea make component show NAME`: everything an agent picks by, without opening the file */
export function shown(i: Item, from = "./components"): string {
const list = (head: string, xs?: string[]) => (xs?.length ? `${head}\n${xs.map((x) => ` - ${x}`).join("\n")}\n` : "");
const made = [i.size && `${i.size} (${i.aspect})`, !i.size && i.aspect, i.length && `${i.length} frames at ${i.fps ?? 30} fps`, i.vibe && `feels ${i.vibe}`].filter(Boolean).join(", ");
const props = (i.props ?? []).map((p) => ` ${p.name}${p.required ? "" : "?"}: ${p.type}${p.default !== undefined ? ` = ${p.default}` : ""}${p.says ? `\n ${p.says}` : ""}`);
return `${i.category}/${i.name} (${i.type}; from ${i.from}${i.upstream ? `, ${i.upstream} there` : ""})
${i.what ?? i.says}
${list("use it when:", i.use_when)}${list("not when:", i.avoid_when)}${i.asked_as?.length ? `asked for as: ${i.asked_as.join("; ")}\n` : ""}${made ? `designed at: ${made}\n` : ""}${props.length ? `props:\n${props.join("\n")}\n` : "props: none (its words and colours are written in the file)\n"}add it: raea make component add ${i.name}
import ${i.default ? i.component : `{ ${i.component} }`} from "${from}/${i.category}/${i.name}";
`;
}
/** What `add` says of a copied item: where it is, how to import it, the fonts it loads, whose it was */
+1 -1
View File
@@ -149,7 +149,7 @@ pub fn run(args: &[String]) -> R<String> {
let usage = format!("{usage}\n raea spec FILE.ts [--as brief|script|taste|parts] (a spec's default export as JSON, checked against its schema: brief.ts, script.ts, taste.ts, NAME.parts.ts)\n raea workspace init [NAME] [--layout LAYOUT] | raea workspace adopt DIR [--name NAME] | raea workspace [--json] (a workspace: a git repo of projects under raea.root, ~/Documents/raea unless git config says)\n raea project new NAME [--storage inline|submodule] [--client NAME] | raea project tag [NAME] [--client NAME] [--no-client] | raea project split NAME [--remote URL] | raea project join NAME | raea project [--json] (a project in the workspace: its folder, brief.ts, media/, out/; its client, what raea.app files every card shown from it under (raea cloud's tags: projects don't nest); split and join keep its history)\n raea check EDIT.tsx --quick [--shape S] [--platform P] [--taste T] [-o check.json] (three stills of a composition checked for text: clipped, cramped, safe areas, sizes; about a second)\n raea hook [claude|codex|gemini|kimi] (every agent's tool hooks, which raea skills install adds: before a shell command, media opened in the Mac's viewer while the raea app is installed is stopped once for raea show (the same command again goes through); after a save, the quick check on a composition)\n raea doctor [--fix] [DIR] (what doesn't match this raea: old brief files, an older workspace format, an agent's skill from another version)\n raea app run|check|bundle APP.tsx [--target web|native] [--size WxH] [--script steps.json] [--png DIR] [-o App.app] (a TSX app on @raea/ui: its window, the headless check, a Mac app; web is Blitz on Bevy, native is Rune; the app's `export const app` sets the target, web when it doesn't; raea rune ... is --target native)\n {}\n {}\n {} ({})\n {}\n {}\n {}", skill::USAGE, tools::blender::USAGE, tools::motion::SETUP_USAGE, tools::motion::SETUP_ABOUT, raea_app_engines::godot::USAGE, raea_app_engines::shot::USAGE, raea_app_engines::round::USAGE);
let (export_game, capcut, layers, xml, scene, physics, splat, wear, bake) = (raea_app_game::USAGE, raea_app_capcut::USAGE, raea_app_layers::USAGE, raea_app_layers::USAGE_XML, raea_app_scene::USAGE, motion::physics::USAGE, tools::splat::USAGE, raea_runtime_wear::USAGE, raea_app_lightbake::USAGE);
let apps = format!(" {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n", raea_app_direction::check::USAGE, raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_ask::USAGE, format!("{GOAL_USAGE}\n {}", raea_app_make::USAGE), raea_app_direction::USAGE, raea_app_direction::findings::USAGE, raea_app_notes::USAGE, raea_app_fingerprint::USAGE, raea_sys_index::cli::USAGE);
return Ok(usage::under_make(&format!("raea: renders, plays and checks raea compositions (React and TypeScript) on the GPU.\n\nusage: {usage}\n raea init (a project's files where they're missing: edit.tsx, cuts.ts, components/, AGENTS.md)\n raea cut TAKE \"line\" ... | --at A-B ... [--append] (cuts.ts and words.json: a take under media/ cut in the pauses around each line it says, transcribed first if it has no TAKE.words.json; or at those seconds)\n raea words FILE [-o OUT.words.json] (what FILE says, word by word, into its words.json beside it: parakeet-mlx on a Mac, the farm's Whisper on a raea cloud box)\n raea frame TAKE [--at S] (how a take fits the edit: a talking take for <FaceFrame>, a screen for <ScreenFit>, from where its face is)\n raea make component list [WORDS] | raea make component add NAME ... [--shared] [--force] (a ready component or set copied into components/, or the workspace's shared/components/ with --shared, yours to change; WORDS search the library by use: text/reveal, \"count up\")\n raea brand DOMAIN|URL (the brand kit read from its website on this machine: brand/brand.css, brand/brand.json, BRAND.md, logos in media/brand; says when a plain fetch saw too little)\n raea guide [NAME] (craft, the floor read before any edit; the modes: pitch, explain, story, play, tool; motion, music, layout and the rest; bevy and bevy/NAME for 3D)\n raea context PROJECT (what to read before working on a project: taste, brief, look, the floor and its modes' guides)\n{apps} raea play EDIT.tsx [--input | --input-script KEYS.json] [--size WxH] [--seconds N|end] (a game, live; also: --input-log FILE --offscreen --snapshot T FILE --json FILE --seek F FILE --pick X,Y --view YAW,PITCH,DISTANCE --scrub N --baked --autoplay --no-vsync --master --3d)\n {export_game} (a game as a program of its own: a Mac app or a command)\n {} ({})\n {capcut}\n {layers}\n {xml}\n {scene} (what each 3D part rests on: floating, sunk and clipping parts; light: the scene's lighting)\n {physics} (the bakes <Physics> and <Goo> make)\n {bake}\n {wear} (a .glb's weathering causes for raea/wear: the model with a second UV set and its cause maps, made once in the asset store)\n {splat} (footage trained into a Gaussian splat for <Splat>; setup installs its tools)\n raea run SCRIPT.ts (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)\n raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" | gen plan|run FLOW.ts|FLOW.json | gen comfy import|export|run|schema FILE | gen models | gen balance (generated media through made.app, fal, Replicate, OpenRouter, Modal or ComfyUI; ComfyUI workflows both ways: raea gen alone lists its flags)\n {neural_usage} (DLSS 5 neural rendering on a `render --aov` folder, with its motion and depth: your own MLX-DLSS build and weights, RAEA_MLXDLSS and RAEA_DLSS_MODEL)\n {light_usage} (each scene on each light path against its path-traced reference: distance in stops, the worst tile, a moving shot's flicker, a frame's cost; DIR/report.json)\n {} (each case on each denoiser against its converged truth: FLIP, RMSE, bias, flicker, blotches, lag after a disocclusion or a light going out, a frame's cost, and how many of MetalFX's numbers each meets; DIR/report.json)\n raea mezz [--check] PATH... (an intra-only ProRes copy of each long-GOP source over 1080p, for smooth scrubbing; --check says which would get one)\n raea traces [show [N|last|DIR]] (the sessions raea left, newest first: how each ended, its glitches; show tells one in full)", raea_app_playable::USAGE, raea_app_playable::ABOUT, raea_denoise_bench::USAGE)));
return Ok(usage::under_make(&format!("raea: renders, plays and checks raea compositions (React and TypeScript) on the GPU.\n\nusage: {usage}\n raea init (a project's files where they're missing: edit.tsx, cuts.ts, components/, AGENTS.md)\n raea cut TAKE \"line\" ... | --at A-B ... [--append] (cuts.ts and words.json: a take under media/ cut in the pauses around each line it says, transcribed first if it has no TAKE.words.json; or at those seconds)\n raea words FILE [-o OUT.words.json] (what FILE says, word by word, into its words.json beside it: parakeet-mlx on a Mac, the farm's Whisper on a raea cloud box)\n raea frame TAKE [--at S] (how a take fits the edit: a talking take for <FaceFrame>, a screen for <ScreenFit>, from where its face is)\n raea make component list [WORDS] [--json] | raea make component show NAME [--json] | raea make component add NAME ... [--shared] [--force] (a ready component or set copied into components/, or the workspace's shared/components/ with --shared, yours to change; WORDS search the library by use and by how people ask: text/reveal, \"count up\", \"chat input\", template; show tells one in full: what it draws, when to use it and when not, its props)\n raea brand DOMAIN|URL (the brand kit read from its website on this machine: brand/brand.css, brand/brand.json, BRAND.md, logos in media/brand; says when a plain fetch saw too little)\n raea guide [NAME] (craft, the floor read before any edit; the modes: pitch, explain, story, play, tool; motion, music, layout and the rest; bevy and bevy/NAME for 3D)\n raea context PROJECT (what to read before working on a project: taste, brief, look, the floor and its modes' guides)\n{apps} raea play EDIT.tsx [--input | --input-script KEYS.json] [--size WxH] [--seconds N|end] (a game, live; also: --input-log FILE --offscreen --snapshot T FILE --json FILE --seek F FILE --pick X,Y --view YAW,PITCH,DISTANCE --scrub N --baked --autoplay --no-vsync --master --3d)\n {export_game} (a game as a program of its own: a Mac app or a command)\n {} ({})\n {capcut}\n {layers}\n {xml}\n {scene} (what each 3D part rests on: floating, sunk and clipping parts; light: the scene's lighting)\n {physics} (the bakes <Physics> and <Goo> make)\n {bake}\n {wear} (a .glb's weathering causes for raea/wear: the model with a second UV set and its cause maps, made once in the asset store)\n {splat} (footage trained into a Gaussian splat for <Splat>; setup installs its tools)\n raea run SCRIPT.ts (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)\n raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" | gen plan|run FLOW.ts|FLOW.json | gen comfy import|export|run|schema FILE | gen models | gen balance (generated media through made.app, fal, Replicate, OpenRouter, Modal or ComfyUI; ComfyUI workflows both ways: raea gen alone lists its flags)\n {neural_usage} (DLSS 5 neural rendering on a `render --aov` folder, with its motion and depth: your own MLX-DLSS build and weights, RAEA_MLXDLSS and RAEA_DLSS_MODEL)\n {light_usage} (each scene on each light path against its path-traced reference: distance in stops, the worst tile, a moving shot's flicker, a frame's cost; DIR/report.json)\n {} (each case on each denoiser against its converged truth: FLIP, RMSE, bias, flicker, blotches, lag after a disocclusion or a light going out, a frame's cost, and how many of MetalFX's numbers each meets; DIR/report.json)\n raea mezz [--check] PATH... (an intra-only ProRes copy of each long-GOP source over 1080p, for smooth scrubbing; --check says which would get one)\n raea traces [show [N|last|DIR]] (the sessions raea left, newest first: how each ended, its glitches; show tells one in full)", raea_app_playable::USAGE, raea_app_playable::ABOUT, raea_denoise_bench::USAGE)));
}
// `--version`: the release's version, which a skill's front matter names (docs/skills.feature SK6)
if args.len() == 1 && matches!(args[0].as_str(), "--version" | "-V") {
+13 -3
View File
@@ -28,7 +28,7 @@ import { absolute, fromCwd, labelsIn, showVerb } from "./show";
// `raea make clothes` (clothes.ts): garments for SOMA's body from words
import { clothesVerb } from "./clothes";
// the component library (catalog.ts): open components sorted by use, listed and copied by `raea make component`
import { added, listed, type Got, type Item } from "./catalog";
import { added, found, listed, searched, shown as inFull, terms, type Got, type Item } from "./catalog";
// `raea bug` (bug.ts): an agent's report of a bug in raea, to raea's server
import { bugVerb } from "./bug";
@@ -199,8 +199,18 @@ export function raeaHandler(host?: Host, engine?: Engine) {
// the library beside this raea (none in a shell with no host: raea's own sets are all it lists)
const shelf = (): Item[] => (host ? (host("components", { op: "list" }) as Item[]) : []);
if (args[1] === undefined) return out(parts() + listed(shelf(), []), 0, was);
if (args[1] === "list") return out(clean(args.slice(2)).length ? listed(shelf(), clean(args.slice(2))) : parts() + listed(shelf(), []), 0, was);
if (args[1] !== "add") return out("", 2, `${was}raea make component list [WORDS] | raea make component add NAME ... [--shared] [--force]\n`);
const ws = clean(args.slice(2));
// --json: the items found (each with its props, when to use it and when not) for an agent to pick from
if (args[1] === "list" && args.includes("--json")) return out(`${JSON.stringify(ws.length ? searched(shelf(), terms(ws)) : shelf(), null, 1)}\n`, 0, was);
if (args[1] === "list") return out(ws.length ? listed(shelf(), ws) : parts() + listed(shelf(), []), 0, was);
// show: one item in full, so it can be picked without opening its file
if (args[1] === "show") {
const item = ws[0] ? found(shelf(), ws[0]) : undefined;
if (!item) return out("", 1, `${was}raea make component show: no "${ws[0] ?? ""}" in the library (raea make component list WORDS finds one)\n`);
const at = (await c.fs.exists(p("compositions"))) ? "../components" : "./components";
return out(args.includes("--json") ? `${JSON.stringify(item, null, 1)}\n` : inFull(item, at), 0, was);
}
if (args[1] !== "add") return out("", 2, `${was}raea make component list [WORDS] [--json] | show NAME [--json] | add NAME ... [--shared] [--force]\n`);
const names = clean(args.slice(2));
if (!names.length) return out("", 2, `${was}raea make component add NAME ... (raea make component list shows them)\n`);
const force = args.includes("--force");
+23 -2
View File
@@ -12,8 +12,9 @@ docs/components.md in the raea repository.
every thing the piece needs as a component: `Kitchen`, `Kettle`, `Steam`, `BrushedSteel`, `MorningLook`,
`PriceCard`. One component is one concern: one object, one surface, one effect, one card.
2. **Look before making.** `raea make component list` shows raea's own and the library's categories; `raea make
component list WORDS` searches the library by what a piece is for (`text/reveal`, `numbers/counter`, `transitions`,
`"count up"`): several hundred open-source text reveals, counters, charts, logo stings, HUDs and screen demos. A
component list WORDS` searches the library by what a piece is for and how people ask for it (`text/reveal`,
`numbers/counter`, `"count up"`, `"chat input"`, `template`): several hundred open-source text reveals, counters,
charts, logo stings, HUDs and screen demos, and `raea make component show NAME` says when to use one and its props. A
project's `components/` and the workspace's `shared/components/` hold what this person already has; `raea library
search "WORDS"` finds their assets. Interface pieces (forms, tables, dashboards) come from shadcn, never rebuilt:
see "shadcn" below. A library piece arrives with its source's sample words, colours and fonts: pass the brief's.
@@ -28,6 +29,26 @@ docs/components.md in the raea repository.
A piece written as one long file of meshes and numbers can't be reused, checked part by part, tuned by a person or
fixed by a note that names a thing. Write components even for a one-off: the next note will name one of them.
## A template, an effect, a branded screen: the library first
When the person asks for a template, an effect, a preset, "something from remocn" (or snapcn), or a known kind of app
screen moving (a chat box or composer, an AI prompt, a terminal, an agent at work, a phone or laptop showing an app),
the library has it more often than not, already made and timed. Look there before drawing anything:
1. `raea make component list WORDS`, with the person's own words: `list composer`, `list "chat input"`, `list "AI
prompt"`, `list "claude code"`, `list terminal`, `list template product`, `list "lower third"`. It searches each
component's name, the name it had upstream, the phrases people ask for it with, and what it does; `list template`
or `list effect` alone lists the ones that are and says how to narrow it.
2. `raea make component show NAME` for the best hits: what it draws and how it moves, when to use it and when not
(naming the better pick for the other case), the size, length and frame rate it was designed at, and every prop
with its type, default and what it does. `list WORDS --json` gives the same for every hit. Pick from these;
there's no need to open the files, and never fetch the upstream sources by hand.
3. `raea make component add NAME`, then pass the brief's words, colours, fonts and logo through its props. A
component with no props (some templates) has them written in its file: change them there.
Only when nothing fits is it written new, as a component (step 4). A brand's own product UI that isn't in the library
(a particular app's chat window, say) is built from the nearest one: `add` it and restyle it.
## What a component is
A component is a React function component that draws one thing from its props and the frame:
File diff suppressed because it is too large. Load diff
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# The component library's catalog, given what an agent picks a component by (tools/library-meta/enrich.ts): each item
# matched by content to the upstream component it came from, with what it draws, when to use it and when not, the
# phrases people ask for it with, its props, and the length and size it was designed at. `raea make component list
# WORDS` searches these and `raea make component show NAME` prints them.
# tools/library-meta.sh [UPSTREAM] UPSTREAM holds a checkout of each source catalog.json names, in a folder named as
# the catalog names it (remocn, snapcn, rve-templates); with none given they're
# cloned (shallow) from the catalog's urls into a scratch folder, removed after
# REPORT=1 tools/library-meta.sh also lists the upstream components the library didn't take
# Run it after adding to the library or after upstream's docs change, then read the diff: hand.json beside enrich.ts
# holds the words written by hand (snapcn's and React Video Editor's components have no when-to-use docs upstream).
set -euo pipefail
ROOT=$(cd "$(dirname "$0")/.." && pwd)
cat=$ROOT/sdk/raea/library/components/catalog.json
up=${1:-}
if [ -z "$up" ]; then
up=$(mktemp -d "${TMPDIR:-/tmp}/library-meta.XXXXXX")
trap 'rm -rf "$up"' EXIT
jq -r '.sources | to_entries[] | "\(.key) \(.value.url)"' "$cat" | while read -r key url; do
GIT_LFS_SKIP_SMUDGE=1 git clone -q --depth 1 "$url.git" "$up/$key"
done
fi
for d in $(jq -r '.sources | keys[]' "$cat"); do [ -d "$up/$d" ] || { echo "library-meta: no $up/$d" >&2; exit 2; }; done
bun "$ROOT/tools/library-meta/enrich.ts" "$up" ${REPORT:+--report}
+129
View File
@@ -0,0 +1,129 @@
// The component library's catalog (sdk/raea/library/components/catalog.json), given what an agent picks a component
// by: each item matched by content to the upstream component it was taken from (its name there kept as `upstream`, a
// search alias, never its name here), then what it draws and how it moves, when to use it and when not, the phrases
// people ask for it with, its props (name, type, default, one line) read from its own source, and the length, frame
// rate, size and feel it was designed at. Hand-written words in hand.json beside this win over upstream's.
//
// bun tools/library-meta/enrich.ts UPSTREAM [--report] UPSTREAM holds checkouts of remocn, snapcn, rve-templates
// (tools/library-meta.sh clones them and runs this). Run again after the library changes: it only rewrites these fields.
import { readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { type Prop, readProps } from "./props";
import { documented, similarity, tokens, type Up, upstream } from "./upstream";
import { phrases, relink, veil } from "./words";
type Hand = { what?: string; use_when?: string[]; avoid_when?: string[]; asked_as?: string[]; vibe?: string };
type Item = Record<string, unknown> & { name: string; category: string; type: string; says: string; component: string; files: string[]; from: string };
const [up, ...flags] = process.argv.slice(2);
if (!up) throw new Error("usage: bun tools/library-meta/enrich.ts UPSTREAM [--report]");
const lib = join(import.meta.dir, "../../sdk/raea/library/components");
const catPath = join(lib, "catalog.json");
const cat = JSON.parse(readFileSync(catPath, "utf8")) as { sources: unknown; items: Item[] };
const hand = JSON.parse(readFileSync(join(import.meta.dir, "hand.json"), "utf8")) as Record<string, Hand>;
const ups = upstream(up);
// each item's upstream original: the same source's component whose identifiers and strings it shares most
const match = new Map<string, { u: Up; score: number }>();
for (const i of cat.items) {
const t = tokens(i.files.map((f) => readFileSync(join(lib, f), "utf8")).join("\n"));
let best: { u: Up; score: number } | undefined;
for (const u of ups) if (u.source === i.from) {
const score = similarity(t, u.tokens);
if (!best || score > best.score) best = { u, score };
}
if (best && best.score >= 0.3) match.set(i.name, best);
}
const ours = new Map([...cat.items].flatMap((i) => (match.has(i.name) ? [[match.get(i.name)!.u.name, `${i.category}/${i.name}`] as const] : [])));
const known = new Set([...ups.map((u) => u.name), ...documented(up).map((d) => d.name)]);
const sentences = (s: string) => s.split(/(?<=[.!?])\s+(?=[A-Z`"'(])/).filter(Boolean);
// upstream's words in ours: names out, pointers at our names, markdown's emphasis and links as plain words
const said = (s: string) => relink(veil(s.replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")), ours, known);
const stop = (s: string) => (s && !/[.!?:]$/.test(s) ? `${s}.` : s);
/** what it draws and how it moves: the first sentences that describe, not the ones that list props or themes */
function what(i: Item, u?: Up): string {
const pick = (s?: string) =>
sentences(said(s ?? ""))
.filter((x) => !/^(Pass|It ships|Ships|Install|Standalone|Use it|Import|Wrap|Set |Every |All )/.test(x) && !/`raea make component add`/.test(x))
.slice(0, 2)
.join(" ");
if (i.from === "rve-templates") return [i.says.split(". ")[0].replace(/\.?$/, "."), u?.description && `(${u.description}.)`].filter(Boolean).join(" ") + " No props: its words and colours are written in the file.";
// snapcn's description says what it draws and its Usage how it's built; remocn's Usage says how it moves
const d = stop(pick(u?.description));
let w = i.from === "snapcn" ? d : pick(u?.usage);
if (!w || w.length < 100) w = [d, stop(pick(i.from === "snapcn" ? u?.usage : ""))].filter((x, k, a) => x && a.indexOf(x) === k).join(" ");
if (!w) w = i.says;
return w.length > 420 ? `${sentences(w)[0]}` : w;
}
function props(i: Item, u?: Up): Prop[] {
const file = i.files.find((f) => f.endsWith("/index.tsx")) ?? i.files.find((f) => f.endsWith(".tsx")) ?? i.files[0];
const rows = new Map((u?.rows ?? []).map((r) => [r.name, r]));
return readProps(readFileSync(join(lib, file), "utf8"), i.component).map((p) => {
const r = rows.get(p.name);
const says = p.says ?? (r?.description ? said(r.description) : undefined);
const dflt = p.default ?? r?.default;
return { name: p.name, type: p.type, ...(dflt !== undefined ? { default: dflt } : {}), ...(says ? { says: veil(says) } : {}), ...(p.required ? { required: true } : {}) };
});
}
const gcd = (a: number, b: number): number => (b ? gcd(b, a % b) : a);
const uniq = (xs: string[]) => {
const seen = new Set<string>();
return xs.filter((x) => x && !seen.has(x.toLowerCase()) && seen.add(x.toLowerCase()));
};
const missing: string[] = [];
cat.items = cat.items.map((i) => {
const m = match.get(i.name);
const u = m?.u;
const h = hand[i.name] ?? {};
const base: Item = { ...i };
for (const k of ["upstream", "what", "use_when", "avoid_when", "asked_as", "props", "length", "fps", "size", "aspect", "vibe"]) delete base[k];
const use = h.use_when ?? (u?.useWhen ?? []).map(said);
const avoid = h.avoid_when ?? (u?.avoidWhen ?? []).map(said);
if (!use.length) missing.push(`${i.category}/${i.name}`);
const g = u?.width && u.height ? gcd(u.width, u.height) : 0;
return {
...base,
...(u ? { upstream: u.name } : {}),
what: h.what ?? what(i, u),
use_when: use,
avoid_when: avoid,
asked_as: uniq([...(h.asked_as ?? []), ...(u?.askedAs ?? []).map(veil), ...phrases({ ...i, section: u?.section, upstream: u?.name })]),
props: props(i, u),
...(u?.frames ? { length: u.frames, fps: u.fps ?? 30 } : {}),
...(g ? { size: `${u!.width}x${u!.height}`, aspect: `${u!.width! / g}:${u!.height! / g}` } : { aspect: "any: it fills the frame it's given" }),
...((h.vibe ?? u?.vibe) ? { vibe: h.vibe ?? u?.vibe } : {}),
};
});
// hand.json's names, and the components (or category/type) its words point at, must be the library's
const names = new Set(cat.items.flatMap((i) => [`${i.category}/${i.name}`, `${i.category}/${i.type}`]));
const bad = Object.entries(hand).flatMap(([n, h]) => [
...(cat.items.some((i) => i.name === n) ? [] : [`hand.json: no item ${n}`]),
...[...JSON.stringify(h).matchAll(/`([a-z]+\/[a-z0-9-]+)`/g)].filter(([, r]) => !names.has(r)).map(([, r]) => `hand.json ${n}: no item ${r}`),
]);
if (bad.length) throw new Error(bad.join("\n"));
// one prop to a line, so the file reads (and diffs) by item
const lines: string[] = [];
const text = JSON.stringify(cat, (k, v) => (k === "props" && Array.isArray(v) ? v.map((p) => `\u0001${lines.push(JSON.stringify(p)) - 1}`) : v), 1);
writeFileSync(catPath, `${text.replace(/"\\u0001(\d+)"/g, (_, n) => lines[Number(n)])}\n`);
const mapped = cat.items.filter((i) => i.upstream).length;
console.log(`${cat.items.length} items enriched, ${mapped} matched to an upstream component (${cat.items.filter((i) => i.upstream && i.upstream !== i.name).length} under another name there)`);
const unmatched = cat.items.filter((i) => !i.upstream).map((i) => `${i.category}/${i.name}`);
if (unmatched.length) console.log(`no upstream match (check by hand): ${unmatched.join(", ")}`);
if (missing.length) console.log(`no use_when (add it to hand.json): ${missing.length}: ${missing.join(", ")}`);
if (flags.includes("--report")) {
// upstream components the library didn't take, by docs section
const took = new Set(cat.items.filter((i) => i.upstream).map((i) => `${i.from}/${i.upstream}`));
const left = new Map<string, string[]>();
const regs = new Set(ups.map((u) => `${u.source}/${u.name}`));
for (const d of documented(up))
if (regs.has(`${d.source}/${d.name}`) && !took.has(`${d.source}/${d.name}`)) left.set(`${d.source} ${d.section}`, [...(left.get(`${d.source} ${d.section}`) ?? []), d.name]);
for (const u of ups) if (u.source !== "rve-templates" && !u.section && !took.has(`${u.source}/${u.name}`)) left.set(`${u.source} (no docs page)`, [...(left.get(`${u.source} (no docs page)`) ?? []), u.name]);
for (const u of ups) if (u.source === "rve-templates" && !took.has(`${u.source}/${u.name}`)) left.set("rve-templates", [...(left.get("rve-templates") ?? []), u.name]);
console.log("\nnot vendored:");
for (const [k, v] of [...left].sort()) console.log(`${k} (${v.length}): ${v.sort().join(", ")}`);
}
+137
View File
@@ -0,0 +1,137 @@
{
"agent-steps": {"use_when": ["Showing an AI agent at work: a prompt in a pill, then a log of steps that each run and flip to done, ending on one answer chip.", "A product demo beat where the point is 'it does the steps for you': research, build, render."], "avoid_when": ["You want the answer text itself to stream in: use `ui/answer-stream`.", "You want a terminal with commands and output: use `ui/terminal-simulator` or `ui/terminal-session`."], "asked_as": ["agent working", "AI agent steps", "agent log", "thinking steps", "tool calls", "Claude working on a task", "agent narrating its work"]},
"answer-stream": {"use_when": ["The beat after a prompt is sent: a close shot on the send button that cuts to an AI answer writing itself while the camera pulls back.", "Following `ui/prompt-zoom` or `ui/prompt-send` in an AI product demo."], "avoid_when": ["You only need the prompt being typed: use `ui/prompt-send`.", "You want one sentence of the answer picked out: use `text/answer-highlight`."], "asked_as": ["AI answer streaming", "chat response typing", "streaming reply", "LLM response", "answer writes itself", "send then answer"]},
"button-press": {"use_when": ["A call to action being clicked: a cursor walks onto a split button, hovers, presses, a spinner runs, a tick draws.", "Any 'one click and it's done' beat in an app demo."], "avoid_when": ["You need a cursor moving over your own screen: use `ui/cursor-track`.", "You want a switch flipping on: use `ui/toggle-on`."], "asked_as": ["button click", "click the button", "CTA click", "press button", "loading spinner then check", "submit button"]},
"capture-reveal": {"use_when": ["A screenshot or copy-to-clipboard moment: a toast counts up over a browser window, which drops away while a headline rises from behind it.", "Introducing a capture, clip or export feature."], "avoid_when": ["You want a camera tour of a still screenshot: use `ui/screenshot-tour`."], "asked_as": ["screenshot capture", "copied to clipboard", "toast notification", "browser window", "capture tool"]},
"caret": {"use_when": ["You are building your own typing scene and need a blinking text caret that blinks on the frame clock.", "Adding a caret to a title or field you made yourself."], "avoid_when": ["You want a whole field that types: use `ui/input`, `ui/prompt-send` or `ui/click-type`."], "asked_as": ["blinking cursor", "text caret", "typing cursor", "insertion point"]},
"click-type": {"use_when": ["Opening an AI or search demo: a composer writes its own placeholder, a cursor flies in and clicks, then a hard cut to the field typing the prompt at the caret.", "A short 'type your idea here' beat for any app with a prompt box."], "avoid_when": ["You want the prompt to be sent and the camera to ride the caret: use `ui/prompt-send`.", "You want a plain form field with states: use `ui/input`."], "asked_as": ["click and type", "type into the box", "prompt composer typing", "cursor clicks the input", "typing a prompt"]},
"cursor-track": {"use_when": ["Walking a cursor over your own screen, screenshot or UI along waypoints, with a ring pulse on each click.", "Turning a static app screen into a guided click-through."], "avoid_when": ["You want a cursor clicking one button with a spinner and tick: use `ui/button-press`.", "You want several collaborators' cursors: use `ui/multiplayer-cursors`."], "asked_as": ["cursor over screen", "mouse moves and clicks", "click-through demo", "guided tour cursor", "walkthrough"]},
"input": {"use_when": ["A single text field that moves through idle, hover, focus, typing, blur and invalid on the timeline: sign-up forms, email capture, a search box.", "Building your own form or chat scene from parts."], "avoid_when": ["You want a full AI prompt composer with send: use `ui/prompt-send` or `ui/click-type`."], "asked_as": ["text field", "form field", "email input", "input box", "focus ring", "typing in a field", "validation error"]},
"phone-frame": {"use_when": ["Showing an app, screen recording or screenshot inside a phone that rises in and floats, flat, tilted or with a 3D crane move.", "Mobile app launches and app-store style promos."], "avoid_when": ["You want several phones playing clips: use `ui/phone-stack`.", "You need a laptop: use `overlays/laptop-frame`."], "asked_as": ["iPhone mockup", "phone mockup", "device frame", "app on a phone", "mobile screen recording"]},
"phone-stack": {"use_when": ["Several vertical clips or app screens, each in its own phone, rising out of a blur and pushing the older ones back.", "Showing a run of short-form videos or app screens one after another."], "avoid_when": ["One phone is enough: use `ui/phone-frame`.", "You want a turning wall of clips: use `gallery/reel-wall`."], "asked_as": ["stacked phones", "multiple phone screens", "phone clips", "vertical videos in phones"]},
"prompt-mark": {"use_when": ["A brand intro for an AI product: a short prompt types into a pill, the camera pans to send, and the send arrow becomes your logo lockup.", "Ending an AI demo on the logo."], "avoid_when": ["The prompt is longer than about 11 characters: the pan was measured for a short one; use `ui/prompt-send`.", "You don't need a logo at the end: use `ui/prompt-zoom`."], "asked_as": ["prompt to logo", "AI logo reveal", "send button becomes logo", "prompt box logo intro"]},
"prompt-send": {"use_when": ["An AI chat composer that unrolls from a hairline, writes a brief while the camera rides the caret, then a pointer sends it.", "The opening of any 'tell the AI what you want' demo; pair with `ui/answer-stream` for the reply."], "avoid_when": ["You want the zoom into the caret mid-sentence: use `ui/prompt-zoom`.", "You want the send to end on a logo: use `ui/prompt-mark`."], "asked_as": ["AI prompt typing", "chat composer", "composer", "prompt box", "chat input", "send a prompt", "type a message and send", "Claude chat input", "ChatGPT-style prompt"]},
"prompt-zoom": {"use_when": ["A prompt field types a sentence and, partway through, cuts in one frame to a close-up of the caret while the typing carries on.", "A punchy AI-input beat inside a fast edit."], "avoid_when": ["You want the send and a pointer: use `ui/prompt-send`.", "You want the answer after it: follow it with `ui/answer-stream`."], "asked_as": ["prompt zoom", "zoom into the prompt", "caret close-up", "AI prompt typing", "composer close-up"]},
"roster-grant": {"use_when": ["Access, invites or seats being granted: rows of people cards stream past a button, a pointer clicks it, and the avatars turn to the accent colour one by one.", "Team, waitlist or early-access announcements."], "avoid_when": ["You want a social follower count rushing up: use `social/upvote-burst` or a number counter."], "asked_as": ["access granted", "invite team", "waitlist approved", "user avatars", "team members", "early access"]},
"terminal-session": {"use_when": ["A developer tool or CLI launch: one camera flies from a headline to an install command panel to a green terminal typing its output.", "Showing a command, its install and its result in one continuous move."], "avoid_when": ["You want a plain terminal window that types and scrolls: use `ui/terminal-simulator`.", "You want the camera locked to the typing cursor: use `ui/terminal-cursor-zoom`."], "asked_as": ["terminal", "terminal session", "install command", "npm install", "CLI demo", "command line", "Claude Code", "coding agent terminal", "dev tool launch"]},
"karaoke-captions": {"use_when": ["Whole-line captions where a colour fill sweeps across the words as they are spoken, with keywords in the accent colour.", "Talking-head and podcast clips that need readable, paced captions."], "avoid_when": ["You want one word at a time popping: use `captions/word-captions`."], "asked_as": ["karaoke captions", "highlighted captions", "subtitle fill", "spoken words highlight"]},
"word-captions": {"use_when": ["Burned-in word-by-word captions from a timed transcript, in a pill inside the safe area, each word popping as it is spoken.", "Short-form vertical clips (reels, shorts) of someone talking."], "avoid_when": ["You want the whole line visible with a fill sweep: use `captions/karaoke-captions`."], "asked_as": ["TikTok captions", "word by word captions", "burned in subtitles", "short-form captions", "auto captions"]},
"card-rail": {"use_when": ["A row of cards (screens, products, posts) flicked sideways across a tilted plane that slows and rests one card along.", "Showing breadth: many examples passing in one move."], "avoid_when": ["You want a 3D turning wall: use `gallery/reel-wall`."], "asked_as": ["card carousel", "sliding cards", "flick cards", "product cards row"]},
"moodboard-reveal": {"use_when": ["A four-beat montage: a kinetic headline, a scattered photo gallery, a camera push from dark to light, landing on a hero image.", "Brand or campaign openers built from photos."], "avoid_when": ["You want a simple grid of photos: use `gallery/gallery-grid`."], "asked_as": ["moodboard", "photo montage", "image collage intro", "brand photos"]},
"orbit-gallery": {"use_when": ["A hero where a stream of photos spirals in from the edges toward a title held in the middle; works in any aspect.", "Showing a large library of images or user work at once."], "avoid_when": ["You want photos landing on a pile: use `gallery/photo-stack`."], "asked_as": ["spiral gallery", "image vortex", "photos orbit", "image universe"]},
"reel-collage": {"use_when": ["A photo reel between two captions shuts like an eyelid, the words swap, and a collage blooms in around them: a short three-beat scene.", "A 'before you were here / now you are' style reveal with pictures."], "avoid_when": ["You want a calm grid: use `gallery/gallery-grid`."], "asked_as": ["photo collage", "reel collage", "eyelid transition", "photo reveal"]},
"reel-wall": {"use_when": ["A curved wall of vertical clips turning in the dark, for as long as the composition runs.", "Showing many short videos or creators at once."], "avoid_when": ["You want flat cards sliding sideways: use `gallery/card-rail`."], "asked_as": ["video wall", "3D carousel of clips", "reels wall", "rotating wall of videos"]},
"bloom-lockup": {"use_when": ["A logo reveal where a wall of finished work blooms out from your logo, cuts in tight, then bends away through a lens and flash as the wordmark arrives.", "Closing a portfolio, agency or product film on the brand."], "avoid_when": ["You want a quick, plain logo fade: use `logo/logo-fade-reveal`."], "asked_as": ["logo reveal", "logo with work behind it", "brand lockup", "portfolio logo outro"]},
"cut-lockup": {"use_when": ["A logo reveal in hard cuts: huge on grid paper, three cuts down, a night push where its construction lines draw, then paper wipes to the lockup.", "Design-led brands that want the logo's construction shown."], "avoid_when": ["You want a soft single-move reveal: use `logo/logo-blur-reveal`."], "asked_as": ["logo construction", "logo grid reveal", "hard cut logo", "brand lockup"]},
"gather-lockup": {"use_when": ["A line of type over a wall of your work falls apart word by word, the wall cuts to four slots, and the last hands over to your mark and wordmark.", "Agency or creator brand outros at 24 fps."], "avoid_when": ["Your edit runs at 30 or 60 and you can't keep this at 24: it cuts between held poses; use `logo/bloom-lockup`."], "asked_as": ["logo outro", "work wall to logo", "brand lockup", "agency sting"]},
"hero-launch": {"use_when": ["A product launch hero: two cards slide into formation as the headline reveals above them.", "Opening a launch or announcement film with the product shots."], "avoid_when": ["You want a whole launch story: use `text/announce-title` or a `logo/` launch item."], "asked_as": ["launch hero", "product launch", "hero section video", "announcement opener"]},
"logo-assemble": {"use_when": ["A scatter of cards collapses into one brand card that lands tilted and settles, showing the logo and name.", "A brand reveal after a montage of features."], "avoid_when": ["You want the logo drawn as a line: use `logo/logo-stroke-draw`."], "asked_as": ["logo assemble", "cards into logo", "brand card reveal"]},
"logo-drift": {"use_when": ["A field of tiles (integrations, partners, tools) drifts past a headline while the camera pulls back.", "'Works with everything you use' scenes."], "avoid_when": ["You want a fixed logo wall: use `logo/ecosystem-constellation`."], "asked_as": ["integrations wall", "partner logos", "logo cloud", "works with", "tool logos drifting"]},
"logo-flicker": {"use_when": ["Images flip past very fast, slow down and fade, and the logo and name resolve: a studio-ident style reveal.", "Opening a film with a burst of its own footage."], "avoid_when": ["You don't have a stack of images: use `logo/logo-glitch-reveal` or `logo/logo-blur-reveal`."], "asked_as": ["flicker logo reveal", "studio intro", "images flip into logo", "film ident"]},
"sky-lockup": {"use_when": ["A one-line promise comes apart word by word, the page washes to a soft sky, and the mark inside the sentence slides over and becomes the logo, in under two seconds.", "A short brand outro that doesn't slow the end of a video."], "avoid_when": ["You want a long, dramatic reveal: use `logo/bloom-lockup`."], "asked_as": ["logo outro", "sky reveal", "short brand ending", "tagline to logo"]},
"wordmark-cut": {"use_when": ["A wordmark twice the frame's width cooling from a lit gradient to ink, then a cut closer onto its last letters.", "Typographic brands whose name is the logo."], "avoid_when": ["You have an icon mark rather than a wordmark: use `logo/logo-assemble`."], "asked_as": ["wordmark reveal", "big logo type", "brand name reveal"]},
"count-grid": {"use_when": ["A grid of cards rushes in and settles on five, then every empty cell fills from the middle out as the count jumps to five hundred: scale in one beat.", "A 1.5-second beat inside a longer edit."], "avoid_when": ["You need a standalone stat with its own hold: use `numbers/compact-stat` or `numbers/flash-count`."], "asked_as": ["grid count", "from 5 to 500", "scale up count", "number of users grid"]},
"laptop-frame": {"use_when": ["A laptop opens, shows a notch notification, then the camera dives into the screen until your screenshot or recording fills the frame.", "Moving from a device shot into a full-screen product demo."], "avoid_when": ["A phone: use `ui/phone-frame`.", "A plain browser window: use a `ui/` browser item."], "asked_as": ["MacBook mockup", "laptop mockup", "device mockup", "screen recording in a laptop", "zoom into the screen"]},
"brand-wheel": {"use_when": ["A lead word and a wheel of platform or brand pills rolling through until a cursor clicks the last one: 'ship to X, Y and Z'.", "Listing the places a product publishes to."], "avoid_when": ["You want a drifting logo wall: use `logo/logo-drift`."], "asked_as": ["platform wheel", "brand pills", "publish everywhere", "rolling brands"]},
"announce-title": {"use_when": ["A four-shot announcement title: an eyebrow rushes past on a receding type plane, the name builds on paper, and the tagline writes itself last word first.", "Launch films that need a title with real camera moves from three strings."], "avoid_when": ["A single-move title is enough: use `text/feature-headline` or `text/crash-zoom`."], "asked_as": ["launch title", "announcement", "product name reveal", "introducing title"]},
"answer-highlight": {"use_when": ["An AI chat answer writes itself under a question, then a selection is dragged across the one sentence that matters and settles on one word.", "Pointing at the key line of a chatbot reply."], "avoid_when": ["You want the answer to stream after a send: use `ui/answer-stream`."], "asked_as": ["AI answer highlight", "ChatGPT-style answer", "chat response highlight", "select the answer"]},
"check-cycle": {"use_when": ["A sentence that keeps finishing itself: the word beside a ticked checkbox rolls through a list (Intros, Demos, Launches...) and rests.", "Listing what a product makes or does in one line."], "avoid_when": ["You want words flipping in 3D: use `text/word-flip`."], "asked_as": ["checkbox list", "rolling words", "use cases cycle", "it does X Y Z"]},
"drop-line": {"use_when": ["Words cut past one card at a time, then the last word sinks out from under the dot of its own i: a 38-frame title beat.", "Fast, punchy openers."], "avoid_when": ["You want a slower statement: use `text/punch-lines`."], "asked_as": ["fast words", "word by word cut", "punchy title"]},
"font-shuffle": {"use_when": ["A launch title decodes out of scrambled glyphs, flashes the accent, then the product name tries on eleven typefaces.", "Type, design and font tools; playful launches."], "avoid_when": ["You want a clean decode only: use `text/matrix-decode`."], "asked_as": ["font shuffle", "typeface cycle", "scrambled text", "font change animation"]},
"hello-zoom": {"use_when": ["Words flicker in place, one line types on, then the camera dives through its own letters into the next card.", "A greeting or opener that leads into the next scene."], "avoid_when": ["You want a camera push without the dive: use `text/crash-zoom`."], "asked_as": ["hello", "zoom through text", "dive into letters", "typing intro"]},
"highlight-sweep": {"use_when": ["Emphasising a span of text that is visible from frame one: a mark wipes open, with five emphasis presets for the highlighted words.", "Pointing at the key words of a headline."], "avoid_when": ["You want the words themselves to arrive: use a `text/reveal` item."], "asked_as": ["text highlight", "highlighter", "emphasis", "marker sweep", "underline words"]},
"portal-intro": {"use_when": ["A sentence with a picture chip in it leans in until the chip takes the frame, then a title types over the picture and the mark arrives.", "Intros that move from words into footage."], "avoid_when": ["You want words only: use `text/hello-zoom`."], "asked_as": ["portal intro", "zoom into image in text", "picture in sentence", "intro"]},
"punch-lines": {"use_when": ["Full-frame title cards cutting hard between beats: a statement flicked in line by line, then a hero line whose words punch up and push forward.", "Hook openers and manifesto-style ads."], "avoid_when": ["You want one quiet line: use `text/cool-down`."], "asked_as": ["punchy text", "hook", "title cards", "statement lines", "kinetic typography ad"]},
"spec-sweep": {"use_when": ["A one-line spec slides in word by word while a highlight runs along it and an icon charges up.", "Product specs and feature claims (battery, speed, size)."], "avoid_when": ["A spec with a big number: use a `numbers/` stat."], "asked_as": ["spec line", "feature claim", "product spec", "charging icon"]},
"status-cycle": {"use_when": ["A status pill whose label rolls through states while its width springs, then a column of chips steps up.", "Showing an app's states (Queued, Rendering, Done) or a list of options."], "avoid_when": ["You want an agent log: use `ui/agent-steps`."], "asked_as": ["status pill", "status changes", "loading states", "chips"]},
"text-rewrite": {"use_when": ["A line writes itself, is selected, has its opening cut away, and gets a new ending: rewriting, editing or AI writing tools.", "'Change one word and it all changes' beats."], "avoid_when": ["You want one line replaced by another whole: use `text/text-swap`."], "asked_as": ["rewrite text", "edit sentence", "AI rewriting", "text replaced"]},
"text-select": {"use_when": ["A line writes itself a word at a time, pushes forward, and is selected under a gradient with a glint: the beat before copying.", "Calling out a quote or a key sentence."], "avoid_when": ["The copy should be visible from frame one: use `text/highlight-sweep`."], "asked_as": ["text selection", "select text", "copy text", "highlighted line"]},
"text-swap": {"use_when": ["Replacing one line with another: the old line rushes the camera and flies past, revealing the new one behind it.", "'Not this, but this' beats."], "avoid_when": ["Only one word changes: use `text/word-flip`."], "asked_as": ["swap text", "replace line", "text change", "before after text"]},
"text-swell": {"use_when": ["The lead word rises and floats toward you, then the rest of the sentence pushes in from the right, bouncing, and shoves it aside.", "Playful, bouncy statements."], "avoid_when": ["A calm, steady line: use `text/cool-down`."], "asked_as": ["bouncy text", "swelling word", "playful title"]},
"title-sweep": {"use_when": ["An end title lit by a gradient travelling through its letters, a cut to dark, and a second title taking over.", "Endings and chapter closers."], "avoid_when": ["You want rolling credits: use `text/credits-roll`."], "asked_as": ["end title", "gradient title", "closing title", "outro title"]},
"type-morph": {"use_when": ["A headline types under a glowing caret, sheds its lead, morphs letter by letter and ends under a colour flood.", "AI and writing products' titles."], "avoid_when": ["You only need typing: use `text/typewriter-subtitle`."], "asked_as": ["typing headline", "morphing text", "caret title", "AI typing"]},
"word-flip": {"use_when": ["A headline types out, then one word cycles on a 3D flip: 'Make [videos / ads / games]'.", "One sentence that covers many uses."], "avoid_when": ["A reel that stops on one word: use `text/word-wheel`."], "asked_as": ["rotating word", "word cycle", "changing word in headline", "flip text"]},
"word-gather": {"use_when": ["A sentence arrives one word at a time, out of order, and gathers into place in the accent colour, turning to ink as it settles.", "Short statements that should feel composed."], "avoid_when": ["Words in reading order: use a `text/reveal` item."], "asked_as": ["words gather", "words fly in", "sentence assembles"]},
"word-wheel": {"use_when": ["A column of words spins like a slot reel and stops on one beside a fixed lead-in.", "Picking one answer from many: 'Made for [designers]'."], "avoid_when": ["You want it to keep cycling: use `text/word-flip`."], "asked_as": ["slot machine words", "word reel", "spinning words", "word roulette"]},
"dot-bloom": {"use_when": ["A halftone transition: the outgoing shot washes to cream, breaks into drifting dots, and they thin onto the next shot.", "Soft, printed-looking scene changes."], "avoid_when": ["A plain dissolve: use `transitions/cross-dissolve`."], "asked_as": ["halftone transition", "dot transition", "dissolve to dots"]},
"sound-wave": {"use_when": ["A quick audio visual: bars moving like a waveform, for music, podcasts or voice.", "A placeholder audio meter you'll restyle in the file."], "avoid_when": ["You want it driven by the real sound or set by props: edit the file, it's a loop of sine waves."], "asked_as": ["audio visualizer", "waveform", "sound bars", "equalizer", "podcast audio"]},
"bokeh-circles": {"use_when": ["A soft, out-of-focus moving background behind titles."], "avoid_when": ["You want props for colours and count: it's written in the file; for a designed backdrop use `backgrounds/synthwave` or `backgrounds/phyllotaxis`."], "asked_as": ["bokeh", "soft lights background", "blurry circles"]},
"geometric-patterns": {"use_when": ["A slowly turning line-pattern background behind text."], "avoid_when": ["You want a designed pattern with props: use `backgrounds/pattern-tile` or `backgrounds/truchet-flip`."], "asked_as": ["geometric background", "shapes pattern", "abstract background"]},
"gradient-shift": {"use_when": ["A calm moving colour gradient behind titles or a lower third."], "avoid_when": ["You want brand colours from props: edit the file's colours."], "asked_as": ["gradient background", "moving gradient", "ambient background"]},
"grid-pulse": {"use_when": ["A tech-feeling dot grid that pulses in waves behind content."], "avoid_when": ["You want a pattern with props: use `backgrounds/pattern-tile`."], "asked_as": ["dot grid", "pulse grid", "tech background"]},
"liquid-wave": {"use_when": ["A rolling wave across the bottom of the frame, for water, calm or fill themes."], "avoid_when": ["You want a liquid filling a shape: use `depth/liquid-fill`."], "asked_as": ["wave", "water wave", "liquid background"]},
"matrix-rain": {"use_when": ["Falling green code for hacker, AI or data themes."], "avoid_when": ["You want text decoding from code: use `text/matrix-decode`."], "asked_as": ["matrix", "code rain", "hacker background", "falling code"]},
"particle-explosion": {"use_when": ["A burst of particles from the centre for a reveal or celebration."], "avoid_when": ["You want confetti: use `marks/confetti`.", "A burst of strokes: use `marks/radial-burst`."], "asked_as": ["particle burst", "explosion", "particles"]},
"starfield": {"use_when": ["Flying through stars for space, speed or launch moments."], "avoid_when": ["You want a retro horizon: use `backgrounds/synthwave`."], "asked_as": ["starfield", "space", "warp speed", "stars"]},
"area-chart": {"use_when": ["A simple area chart revealing left to right, data written in the file."], "avoid_when": ["You want data from props and a designed look: use `charts/growth-line` or `charts/area-compare`."], "asked_as": ["area chart", "growth chart"]},
"chart-animation": {"use_when": ["A basic bar chart growing in turn, data written in the file."], "avoid_when": ["You want bars set by props: use `charts/animated-bar-chart` or `charts/spring-bars`."], "asked_as": ["bar chart", "bars growing", "column chart"]},
"comparison-chart": {"use_when": ["Two bars comparing a before and after."], "avoid_when": ["You want a designed versus scene: use `charts/versus-split` or `charts/dumbbell-shift`."], "asked_as": ["before after chart", "comparison", "vs chart"]},
"donut-chart": {"use_when": ["A donut showing a share with a centre number."], "avoid_when": ["You want it from props: use `charts/share-donut`."], "asked_as": ["donut chart", "ring chart", "percentage ring"]},
"line-chart": {"use_when": ["A line with points drawing left to right, data in the file."], "avoid_when": ["You want props and labels: use `charts/animated-line-chart`."], "asked_as": ["line chart", "line graph", "trend"]},
"pie-chart": {"use_when": ["A pie chart sweeping in slice by slice."], "avoid_when": ["A donut from props: use `charts/share-donut`."], "asked_as": ["pie chart", "slices", "share chart"]},
"progress-bars": {"use_when": ["Labelled horizontal bars filling to their values in turn."], "avoid_when": ["Ranked bars that race: use `charts/benchmark-race`."], "asked_as": ["progress bars", "skill bars", "horizontal bars"]},
"card-flip": {"use_when": ["A card flipping in 3D from front to back: before/after, question/answer."], "avoid_when": ["A fan of cards: use `depth/card-fan`."], "asked_as": ["card flip", "flip card", "3D card"]},
"gallery-grid": {"use_when": ["A 2x3 grid of photos filling in tile by tile."], "avoid_when": ["A designed montage: use `gallery/moodboard-reveal`."], "asked_as": ["photo grid", "image grid", "gallery"]},
"image-carousel": {"use_when": ["Photos sliding past with the centre one in focus."], "avoid_when": ["Cards flicked on a tilted plane: use `gallery/card-rail`."], "asked_as": ["carousel", "image slider", "slideshow"]},
"image-comparison-slider": {"use_when": ["A divider sliding across a before and after image."], "avoid_when": ["A scan that reveals a fixed build: use `ui/scan-fix`."], "asked_as": ["before after slider", "image comparison", "compare photos"]},
"image-zoom-reveal": {"use_when": ["A photo revealed through a growing window as it zooms out."], "avoid_when": ["A slow pan over a still: use `looks/ken-burns`."], "asked_as": ["image reveal", "zoom out reveal", "photo reveal"]},
"masonry-gallery": {"use_when": ["Photos dropping into a masonry wall of mixed sizes."], "avoid_when": ["A plain grid: use `gallery/gallery-grid`."], "asked_as": ["masonry", "pinterest grid", "photo wall"]},
"photo-stack": {"use_when": ["Photos landing on a pile, each slightly turned: memories, recaps."], "avoid_when": ["A spiral of many photos: use `gallery/orbit-gallery`."], "asked_as": ["photo pile", "stack of photos", "polaroids"]},
"rotating-carousel": {"use_when": ["Cards turning round a 3D carousel."], "avoid_when": ["A turning wall of video: use `gallery/reel-wall`."], "asked_as": ["3D carousel", "rotating cards"]},
"spotlight-reveal": {"use_when": ["A spotlight sweeping the dark to reveal a word or image."], "avoid_when": ["A designed light sting: use `logo/spotlight`."], "asked_as": ["spotlight", "reveal in the dark", "circle reveal"]},
"end-card": {"use_when": ["A plain closing card with a thank-you and subscribe button for a channel video."], "avoid_when": ["A brand outro: use a `logo/lockup` item like `logo/sky-lockup`."], "asked_as": ["end card", "outro", "subscribe end screen", "thanks for watching"]},
"logo-blur-reveal": {"use_when": ["A logo pulling focus from a heavy blur, quick and plain."], "avoid_when": ["A designed reveal: use `logo/first-light` or `logo/sky-lockup`."], "asked_as": ["logo blur", "logo focus pull"]},
"logo-bounce-drop": {"use_when": ["A logo dropping in and bouncing to rest: playful brands."], "avoid_when": ["A designed bounce: use `logo/snap-click`."], "asked_as": ["logo bounce", "logo drop"]},
"logo-fade-reveal": {"use_when": ["The simplest logo reveal: logo and name fading up together."], "avoid_when": ["You want a moment: use a `logo/sting` item."], "asked_as": ["logo fade in", "simple logo reveal"]},
"logo-glitch-reveal": {"use_when": ["A logo appearing through RGB glitch: tech, gaming, music."], "avoid_when": ["You want a whole glitch transition: use a `transitions/` item."], "asked_as": ["glitch logo", "RGB split logo"]},
"logo-scale-rotate": {"use_when": ["A logo scaling up while turning into place."], "avoid_when": ["A 3D spin: use `logo/logo-spin-reveal`."], "asked_as": ["logo spin scale", "logo rotate in"]},
"logo-spin-reveal": {"use_when": ["A logo spinning on its vertical axis and settling."], "avoid_when": ["A turntable of a product: use `depth/turntable`."], "asked_as": ["logo spin", "3D logo spin"]},
"logo-split-reveal": {"use_when": ["Two halves of a logo sliding together."], "avoid_when": ["A designed split: use `logo/split-match`."], "asked_as": ["logo split", "halves join"]},
"logo-stroke-draw": {"use_when": ["An outline logo drawn as a line, then filled: hand-made, architectural or line-art marks."], "avoid_when": ["Your logo isn't an SVG path: use `logo/logo-fade-reveal`."], "asked_as": ["logo draw", "line drawing logo", "stroke animation", "signature"]},
"logo-typewriter": {"use_when": ["An icon with the company name typed beside it."], "avoid_when": ["A typed headline: use `text/typewriter-subtitle`."], "asked_as": ["logo typewriter", "typed company name"]},
"camera-shake": {"use_when": ["A decaying shake on impact moments, around anything it wraps."], "avoid_when": ["A designed impact frame: use `marks/impact-shake`."], "asked_as": ["camera shake", "screen shake", "impact"]},
"ken-burns": {"use_when": ["A slow pan and zoom over a still photo: documentaries, memorials, recaps."], "avoid_when": ["Depth from a flat photo: use `depth/parallax-depth`."], "asked_as": ["ken burns", "pan and zoom", "photo motion"]},
"noise-grain": {"use_when": ["A light film grain over the whole frame for texture."], "avoid_when": ["A whole print look: use `looks/riso-print`."], "asked_as": ["film grain", "noise overlay", "texture"]},
"vignette-pulse": {"use_when": ["Dark edges breathing in and out: tension, heartbeat, focus."], "avoid_when": ["You want a static vignette: edit the file's pulse."], "asked_as": ["vignette", "dark edges", "pulse"]},
"circular-progress": {"use_when": ["A ring filling to a percentage with the number counting in its centre."], "avoid_when": ["Rings like a fitness app: use `numbers/activity-rings`."], "asked_as": ["progress ring", "percentage circle", "loading ring"]},
"countdown-intro": {"use_when": ["A 3, 2, 1, GO ring countdown into an opening card."], "avoid_when": ["A designed countdown: use `numbers/countdown` or `numbers/t-minus`."], "asked_as": ["countdown", "3 2 1", "intro countdown"]},
"countdown-timer": {"use_when": ["Large digits ticking down 5 to GO with a spring."], "avoid_when": ["A real clock or timer: use `numbers/drop-timer` or `hud/shot-clock`."], "asked_as": ["countdown timer", "timer"]},
"progress-steps": {"use_when": ["Numbered steps lighting along a line: onboarding, how it works."], "avoid_when": ["An agent working through steps: use `ui/agent-steps`."], "asked_as": ["steps", "progress steps", "how it works", "stepper"]},
"stat-counter": {"use_when": ["A plain big number counting up with commas and a label."], "avoid_when": ["You want props and a designed stat: use `numbers/compact-stat` or `numbers/flash-count`."], "asked_as": ["stat counter", "count up", "big number"]},
"lower-third": {"use_when": ["A news-style name and title bar for an interview or talking head."], "avoid_when": ["You want words from props: edit the file's name and title."], "asked_as": ["lower third", "name tag", "name and title", "chyron"]},
"notification-pop": {"use_when": ["Phone-style notifications stacking in: messages, sales, alerts."], "avoid_when": ["A pile of notifications as a full scene: use a `ui/` phone item."], "asked_as": ["notifications", "push notification", "toast stack"]},
"picture-in-picture": {"use_when": ["A small inset window over the main shot: a face cam over a screen."], "avoid_when": ["Two shots side by side: use `overlays/split-screen`."], "asked_as": ["picture in picture", "PiP", "face cam", "inset video"]},
"polaroid-frame": {"use_when": ["A photo dropping in as a polaroid with a white border."], "avoid_when": ["Many photos on a pile: use `gallery/photo-stack`."], "asked_as": ["polaroid", "instant photo frame"]},
"split-screen": {"use_when": ["Two panels sliding to meet: comparisons, two people, before and after."], "avoid_when": ["A small inset: use `overlays/picture-in-picture`."], "asked_as": ["split screen", "side by side", "two videos"]},
"subscribe-reminder": {"use_when": ["A floating subscribe button with a cursor click and bell for channel videos."], "avoid_when": ["A brand CTA: use `ui/button-press`."], "asked_as": ["subscribe button", "like and subscribe", "bell"]},
"animated-list": {"use_when": ["A bulleted list with rows sliding in one after another."], "avoid_when": ["A designed feature list: use `text/index-list` or `text/feature-trio`."], "asked_as": ["bullet list", "list animation", "agenda"]},
"animated-text": {"use_when": ["A headline whose letters spring in one by one, quick and plain."], "avoid_when": ["A designed reveal with props: use a `text/reveal` item like `text/per-character-rise`."], "asked_as": ["letter animation", "text reveal", "headline animation"]},
"bounce-text": {"use_when": ["Words dropping in and bouncing: playful titles."], "avoid_when": ["A designed bounce: use `text/text-swell`."], "asked_as": ["bouncy text", "bounce in"]},
"bubble-pop-text": {"use_when": ["Letters popping in as bubbles: kids, games, playful brands."], "avoid_when": ["A sober title: use `text/cool-down`."], "asked_as": ["bubble text", "pop letters"]},
"chapter-title": {"use_when": ["A chapter number and title card to split a long video into parts."], "avoid_when": ["An end title: use `text/title-sweep`."], "asked_as": ["chapter title", "section card", "part 1"]},
"cinematic-title-intro": {"use_when": ["A wide-spaced title fading up between letterbox bars: trailers, film openers."], "avoid_when": ["A designed film title: use `text/announce-title`."], "asked_as": ["cinematic title", "movie title", "trailer title"]},
"credits-roll": {"use_when": ["End credits scrolling up the frame."], "avoid_when": ["One end title: use `text/title-sweep`."], "asked_as": ["credits", "end credits", "rolling credits"]},
"floating-bubble-text": {"use_when": ["A word floating in a bobbing bubble: labels, tags."], "avoid_when": ["A pill that takes over the line: use `text/inline-pill-takeover`."], "asked_as": ["floating label", "text chip", "bubble label"]},
"glitch-text": {"use_when": ["A word glitching with RGB splits: tech, gaming, music."], "avoid_when": ["A chromatic wave over a line: use `text/chromatic-wave`."], "asked_as": ["glitch text", "RGB split", "distorted text"]},
"popping-text": {"use_when": ["Words popping in with a scale punch."], "avoid_when": ["A designed punch: use `text/hook-punch`."], "asked_as": ["pop text", "scale pop"]},
"pulsing-text": {"use_when": ["A word pulsing gently for emphasis on a hold."], "avoid_when": ["A one-time emphasis: use `text/highlight-sweep`."], "asked_as": ["pulsing text", "heartbeat text"]},
"quote-card": {"use_when": ["A pull quote with attribution on a card."], "avoid_when": ["A designed quote: use `social/quote-hero` or `social/said-who`."], "asked_as": ["quote", "quote card", "testimonial"]},
"slide-text": {"use_when": ["A line of text sliding in from the side, plain."], "avoid_when": ["Lines sliding in one by one with props: use `text/line-by-line-slide`."], "asked_as": ["slide in text", "text slide"]},
"text-highlight": {"use_when": ["A marker highlight sweeping behind words of a line in turn."], "avoid_when": ["A designed highlight with props: use `text/highlight-sweep` or `marks/marker-highlight`."], "asked_as": ["highlight words", "marker", "highlighter"]},
"title-split": {"use_when": ["A title splitting apart to reveal a second line."], "avoid_when": ["A designed split: use `text/beam-split`."], "asked_as": ["split title", "title reveal"]},
"typewriter-subtitle": {"use_when": ["A subtitle typed letter by letter with a cursor."], "avoid_when": ["A typing AI prompt: use `ui/prompt-send`.", "Handwriting: use `text/handwrite`."], "asked_as": ["typewriter", "typing text", "typed subtitle"]},
"blinds-transition": {"use_when": ["Blinds closing over one scene and opening on the next."], "avoid_when": ["A designed split: use `transitions/mondrian-split`."], "asked_as": ["blinds", "venetian blinds transition"]},
"clock-wipe": {"use_when": ["A radial wipe sweeping round like a clock hand."], "avoid_when": ["A slash: use `transitions/slash-wipe`."], "asked_as": ["clock wipe", "radial wipe"]},
"cross-dissolve": {"use_when": ["The classic dissolve between two scenes."], "avoid_when": ["You want a styled dissolve: use `transitions/dot-bloom`."], "asked_as": ["cross dissolve", "crossfade", "fade between"]},
"fade-through-black": {"use_when": ["A dip to black between scenes: time passing, chapter changes."], "avoid_when": ["A dip through a colour: use `transitions/fade-through`."], "asked_as": ["fade to black", "dip to black"]},
"film-burn": {"use_when": ["A warm film-burn flare washing across the frame: vintage, nostalgia."], "avoid_when": ["An anamorphic lens flare: use `transitions/anamorphic-flare`."], "asked_as": ["film burn", "light leak", "flare"]},
"iris-transition": {"use_when": ["A circle closing on one scene and opening on the next: silent-film or cartoon style."], "avoid_when": ["A designed reveal: use `transitions/torn-edge`."], "asked_as": ["iris", "circle wipe"]},
"letterbox-reveal": {"use_when": ["Letterbox bars opening to reveal the scene: cinematic openers."], "avoid_when": ["A whole title: use `text/cinematic-title-intro`."], "asked_as": ["letterbox", "cinema bars", "black bars"]},
"morph-transition": {"use_when": ["One shape morphing into another to carry a cut."], "avoid_when": ["A shared-axis move: use `transitions/shared-axis-z`."], "asked_as": ["morph", "shape morph transition"]},
"pixel-transition": {"use_when": ["The frame breaking into pixels and rebuilding as the next scene: games, retro."], "avoid_when": ["A pixel look on a whole shot: use `looks/brick-mosaic`."], "asked_as": ["pixel transition", "pixelate", "8-bit transition"]},
"push-transition": {"use_when": ["The next scene pushing the old one out of frame."], "avoid_when": ["Doors sliding apart: use `transitions/slide-doors`."], "asked_as": ["push", "slide transition"]},
"slide-wipe": {"use_when": ["A coloured panel wiping across to the next scene."], "avoid_when": ["A slashed wipe: use `transitions/slash-wipe`."], "asked_as": ["wipe", "panel wipe", "colour wipe"]},
"whip-pan": {"use_when": ["A fast blurred whip pan between two scenes: energy, travel, comedy."], "avoid_when": ["A camera crash zoom on text: use `text/crash-zoom`."], "asked_as": ["whip pan", "swish pan", "fast pan"]},
"zoom-through": {"use_when": ["Zooming through the frame into the next scene."], "avoid_when": ["A dolly zoom: use `depth/dolly-zoom`."], "asked_as": ["zoom transition", "zoom through"]}
}
+101
View File
@@ -0,0 +1,101 @@
// A library component's props, read from its own source with the TypeScript parser: each member of its Props type
// (the type of its first parameter, or COMPONENTProps), its type as written, the default its destructuring gives it,
// and the doc comment above it. Members of an interface it extends, or of a type it intersects, count when they're
// in the same file. A default that's a constant of the file (`slant = SLANT`) is shown as that constant's value.
import ts from "../../sdk/shell/node_modules/typescript/lib/typescript.js";
export type Prop = { name: string; type: string; default?: string; says?: string; required?: boolean };
const flat = (s: string) => s.replace(/\s+/g, " ").trim();
export function readProps(src: string, component: string): Prop[] {
const sf = ts.createSourceFile("index.tsx", src, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
const types = new Map<string, ts.InterfaceDeclaration | ts.TypeAliasDeclaration>();
const consts = new Map<string, string>();
let fn: ts.FunctionLikeDeclaration | undefined;
// `const X: React.FC<XProps> = (...)`: the props' type is the annotation's argument
let annotated: ts.TypeNode | undefined;
for (const st of sf.statements) {
if (ts.isInterfaceDeclaration(st) || ts.isTypeAliasDeclaration(st)) types.set(st.name.text, st);
if (ts.isFunctionDeclaration(st) && st.name?.text === component) fn = st;
if (ts.isVariableStatement(st))
for (const d of st.declarationList.declarations) {
if (!ts.isIdentifier(d.name) || !d.initializer) continue;
const init = d.initializer;
if (d.name.text === component && (ts.isArrowFunction(init) || ts.isFunctionExpression(init))) {
fn = init;
if (d.type && ts.isTypeReferenceNode(d.type)) annotated = d.type.typeArguments?.[0];
}
else if (ts.isStringLiteral(init) || ts.isNumericLiteral(init) || init.kind === ts.SyntaxKind.TrueKeyword || init.kind === ts.SyntaxKind.FalseKeyword || ts.isNoSubstitutionTemplateLiteral(init) || ts.isPrefixUnaryExpression(init))
consts.set(d.name.text, init.getText(sf));
}
}
// its props' type: the first parameter's, else COMPONENTProps
const param = fn?.parameters[0];
const typeNode: ts.TypeNode | undefined = param?.type ?? annotated;
const props = new Map<string, Prop>();
const seen = new Set<string>();
const doc = (m: ts.Node) =>
flat(
ts
.getJSDocCommentsAndTags(m)
.map((j) => (typeof j.comment === "string" ? j.comment : (j.comment ?? []).map((c) => c.text).join("")))
.join(" "),
) ||
flat(
(ts.getLeadingCommentRanges(sf.text, m.getFullStart()) ?? [])
.map((r) => sf.text.slice(r.pos, r.end))
.filter((c) => c.startsWith("//"))
.map((c) => c.replace(/^\/\/\s?/, ""))
.join(" "),
);
const members = (ms: readonly ts.TypeElement[]) => {
for (const m of ms) {
if (!ts.isPropertySignature(m) || !m.name) continue;
const name = m.name.getText(sf).replace(/^["']|["']$/g, "");
if (props.has(name)) continue;
const says = doc(m);
props.set(name, { name, type: m.type ? flat(m.type.getText(sf)) : "unknown", ...(says ? { says } : {}), ...(m.questionToken ? {} : { required: true }) });
}
};
const walk = (t: ts.TypeNode | undefined) => {
if (!t) return;
if (ts.isTypeLiteralNode(t)) members(t.members);
else if (ts.isIntersectionTypeNode(t)) t.types.forEach(walk);
else if (ts.isParenthesizedTypeNode(t)) walk(t.type);
else if (ts.isTypeReferenceNode(t)) {
const name = t.typeName.getText(sf);
// Partial<X>, Readonly<X> and the like: X's members
if (t.typeArguments?.length && !types.has(name)) t.typeArguments.forEach(walk);
else named(name);
}
};
const named = (name: string) => {
const d = types.get(name);
if (!d || seen.has(name)) return;
seen.add(name);
if (ts.isInterfaceDeclaration(d)) {
members(d.members);
for (const h of d.heritageClauses ?? []) for (const e of h.types) named(e.expression.getText(sf));
} else walk(d.type);
};
if (typeNode) walk(typeNode);
else named(`${component}Props`);
// defaults: the first parameter's destructuring, else `const { ... } = props` in the body
let pattern = param && ts.isObjectBindingPattern(param.name) ? param.name : undefined;
if (!pattern && param && ts.isIdentifier(param.name) && fn?.body) {
const id = param.name.text;
const find = (n: ts.Node): ts.ObjectBindingPattern | undefined =>
ts.isVariableDeclaration(n) && ts.isObjectBindingPattern(n.name) && n.initializer && ts.isIdentifier(n.initializer) && n.initializer.text === id ? n.name : ts.forEachChild(n, find);
pattern = find(fn.body);
}
for (const el of pattern?.elements ?? []) {
const name = (el.propertyName ?? el.name).getText(sf);
if (!el.initializer || !props.has(name)) continue;
let d = flat(el.initializer.getText(sf));
if (consts.has(d)) d = consts.get(d) as string;
if (d.length > 160) d = `${d.slice(0, 157)}...`;
props.get(name)!.default = d;
}
return [...props.values()];
}
+191
View File
@@ -0,0 +1,191 @@
// The upstream libraries the component library was taken from, read from plain checkouts of them (tools/library-meta.sh
// clones them): each upstream component's source (for matching by content), its docs page (what it is, when to use
// it and when not, how people ask for it, its props table, the motion described under Usage) and its preview's size
// and length. Nothing here runs upstream code: the files are read as text.
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
import { basename, join, relative } from "node:path";
export type Row = { name: string; type?: string; default?: string; description?: string };
export type Up = {
source: string; // the catalog's `from`
name: string; // upstream's own name for it
section?: string; // its docs section (ai, numbers, product-scenes, ...)
tokens: Set<string>;
description?: string;
useWhen: string[];
avoidWhen: string[];
askedAs: string[];
vibe?: string;
usage?: string; // the first paragraph of prose under Usage
rows: Row[]; // its docs' props table
frames?: number;
fps?: number;
width?: number;
height?: number;
};
const read = (p: string) => (existsSync(p) ? readFileSync(p, "utf8") : "");
const dirs = (p: string) => (existsSync(p) ? readdirSync(p).filter((d) => !d.startsWith("_") && statSync(join(p, d)).isDirectory()) : []);
const walk = (p: string): string[] => (existsSync(p) ? readdirSync(p).flatMap((f) => (statSync(join(p, f)).isDirectory() ? walk(join(p, f)) : [join(p, f)])) : []);
/** What a source file is made of, for matching: its identifiers and its strings, without comments or imports */
export function tokens(src: string): Set<string> {
const body = src
.replace(/\/\*[\s\S]*?\*\//g, " ")
.replace(/(^|[^:"'`])\/\/.*$/gm, "$1")
.replace(/^\s*import[\s\S]*?from\s+["'][^"']+["'];?/gm, " ");
const out = new Set<string>();
for (const [, s] of body.matchAll(/"([^"\n]{3,80})"|'([^'\n]{3,80})'/g)) if (s) out.add(`"${s}`);
for (const [w] of body.matchAll(/[A-Za-z_$][\w$]{2,}/g)) out.add(w);
return out;
}
export function similarity(a: Set<string>, b: Set<string>): number {
let both = 0;
for (const t of a) if (b.has(t)) both++;
return both / (a.size + b.size - both || 1);
}
/** A docs page's frontmatter: scalars and lists of strings, the only YAML these pages use */
function frontmatter(text: string): Record<string, string | string[]> {
const m = text.match(/^---\n([\s\S]*?)\n---/);
const out: Record<string, string | string[]> = {};
let key = "";
const unq = (v: string) => {
v = v.trim();
if (v.startsWith('"')) {
try {
return JSON.parse(v) as string;
} catch {
return v.slice(1, -1);
}
}
return v.startsWith("'") ? v.slice(1, -1).replace(/''/g, "'") : v;
};
for (const line of (m?.[1] ?? "").split("\n")) {
const kv = line.match(/^(\w+):\s*(.*)$/);
if (kv) {
key = kv[1];
out[key] = kv[2].trim() ? unq(kv[2]) : [];
} else if (/^\s+-\s/.test(line) && Array.isArray(out[key])) (out[key] as string[]).push(unq(line.replace(/^\s+-\s/, "")));
}
return out;
}
/** A docs page's <PropsTable rows={[...]}>: each row's string fields */
function propsTable(text: string): Row[] {
const at = text.indexOf("<PropsTable");
if (at < 0) return [];
const end = text.indexOf("/>", at);
const block = text.slice(at, end < 0 ? undefined : end);
const rows: Row[] = [];
for (const [obj] of block.matchAll(/\{[^{}]*\}/g)) {
const row: Record<string, string> = {};
for (const [, k, v] of obj.matchAll(/(\w+):\s*("(?:[^"\\]|\\.)*")/g)) {
try {
row[k] = JSON.parse(v);
} catch {
row[k] = v.slice(1, -1);
}
}
if (row.name) rows.push(row as Row);
}
return rows;
}
/** The first paragraph of prose under ## Usage, after its code block */
function usage(text: string): string | undefined {
const at = text.search(/^## Usage/m);
if (at < 0) return undefined;
const rest = text.slice(at).replace(/^## Usage\n/, "").replace(/```[\s\S]*?```/g, "\n\n");
const para = rest
.split(/\n\s*\n/)
.map((p) => p.trim())
.find((p) => p && !p.startsWith("<") && !p.startsWith("#") && !p.startsWith("|") && !p.startsWith("import "));
return para?.replace(/\s+/g, " ");
}
/** A preview config's length and size (W, H and FPS are the libraries' shared 1280x720 at 30) */
function config(text: string): Pick<Up, "frames" | "fps" | "width" | "height"> {
const num = (k: string, named: Record<string, number>) => {
const v = text.match(new RegExp(`\\b${k}:\\s*([\\w.]+)`))?.[1];
return v === undefined ? undefined : /^\d/.test(v) ? Number(v) : named[v];
};
return { frames: num("durationInFrames", {}), fps: num("fps", { FPS: 30 }), width: num("compositionWidth", { W: 1280 }), height: num("compositionHeight", { H: 720 }) };
}
function page(docs: string, name: string, byComponent: Map<string, string>): Partial<Up> {
const file = byComponent.get(name);
if (!file) return {};
const text = read(file);
const fm = frontmatter(text);
const list = (k: string) => (Array.isArray(fm[k]) ? (fm[k] as string[]) : []);
return {
section: relative(docs, file).split("/")[0],
description: typeof fm.description === "string" ? fm.description : undefined,
useWhen: list("useWhen"),
avoidWhen: list("avoidWhen"),
askedAs: list("askedAs"),
vibe: typeof fm.vibe === "string" ? fm.vibe : undefined,
usage: usage(text),
rows: propsTable(text),
};
}
/** Each docs page by the component it documents (its frontmatter's `component`, else its file name) */
function docsIndex(docs: string): Map<string, string> {
const by = new Map<string, string>();
for (const f of walk(docs).filter((f) => f.endsWith(".mdx") && !f.endsWith("/index.mdx"))) {
const c = read(f).match(/^component:\s*"?([\w-]+)"?/m)?.[1] ?? basename(f, ".mdx");
if (!by.has(c)) by.set(c, f);
}
return by;
}
function registry(source: string, root: string, regs: string[], docs: string): Up[] {
const byComponent = docsIndex(docs);
return regs.flatMap((reg) =>
dirs(join(root, reg)).map((name) => {
const dir = join(root, reg, name);
const src = readdirSync(dir)
.filter((f) => /\.tsx?$/.test(f) && f !== "config.ts")
.map((f) => read(join(dir, f)))
.join("\n");
return { source, name, tokens: tokens(src), useWhen: [], avoidWhen: [], askedAs: [], rows: [], ...config(read(join(dir, "config.ts"))), ...page(docs, name, byComponent) };
}),
);
}
/** Every upstream component, from checkouts at UP/remocn, UP/snapcn and UP/rve-templates (React Video Editor's) */
export function upstream(up: string): Up[] {
const rve = join(up, "rve-templates");
const table = new Map<string, string>();
for (const [, file, said] of read(join(rve, "README.md")).matchAll(/^\|[^|]+\|\s*`([\w-]+)\.tsx`\s*\|\s*([^|]+?)\s*\|/gm)) table.set(file, said);
const templates = walk(join(rve, "templates"))
.filter((f) => f.endsWith(".tsx"))
.map((f) => {
const name = basename(f, ".tsx");
return { source: "rve-templates", name, tokens: tokens(read(f)), description: table.get(name), useWhen: [], avoidWhen: [], askedAs: [], rows: [] } as Up;
});
return [
...registry("remocn", join(up, "remocn"), ["registry/remocn"], join(up, "remocn/content/docs")),
...registry("snapcn", join(up, "snapcn"), ["registry/snap-cn", "registry/snap-cn-ui"], join(up, "snapcn/content/docs")),
...templates,
];
}
/** Docs pages with no registry folder behind them (a section's overview, a guide) aren't components; these are */
export function documented(up: string): { source: string; name: string; section: string; description?: string }[] {
const out: { source: string; name: string; section: string; description?: string }[] = [];
for (const [source, docs, skip] of [
["remocn", join(up, "remocn/content/docs"), /^(guides|getting-started|craft|icons)$/],
["snapcn", join(up, "snapcn/content/docs"), /^(getting-started|collections)$/],
] as const)
for (const [name, file] of docsIndex(docs)) {
const section = relative(docs, file).split("/")[0];
if (skip.test(section) || !file.includes("/", docs.length + 1)) continue;
const fm = frontmatter(read(file));
out.push({ source, name, section, description: typeof fm.description === "string" ? fm.description : undefined });
}
return out;
}
+85
View File
@@ -0,0 +1,85 @@
// The words the catalog gives each component: upstream's own (what it is, when to use it, how people ask for it) put
// in raea's plain voice with the other libraries' names taken out, and the phrases a person says for a kind of thing
// ("chat input", "terminal", "lower third") added by what the component is.
/** Upstream's text with the libraries' and their tooling's names out: the component is raea's now */
export function veil(s: string): string {
return s
.replace(/\s*(for|in) Remotion\b/g, "")
.replace(/\bRemotion `?<Composition>`?/g, "raea composition")
.replace(/`?@[a-z-]+\/captions`?/g, "raea's captions")
.replace(/`@[a-z-]+\/[\w-]+`/g, "raea")
.replace(/`?npx shadcn@latest add [^`\s]+`?/g, "`raea make component add`")
.replace(/\b(the|a) (Remocn|remocn|snapcn) (repo|registry|site|docs)\b/gi, "the original library")
.replace(/\bthe word Remocn\b/g, "a sample wordmark")
.replace(/\b(Remocn|remocn|snapcn|snap-cn)[- ]ui\b/gi, "the shared UI kit")
.replace(/\b(the|its|a) (Remocn|remocn|snapcn|snap-cn)('s)? (mark|logo|lime|brand|wordmark)\b/gi, "$1 sample $4")
.replace(/remocn-only/gi, "not shipped")
.replace(/\bRemotion\b/g, "raea")
.replace(/\bshadcn\b/gi, "UI-kit")
.replace(/\b(the|a|an) (Remocn|remocn|snapcn|snap-cn)\b/gi, "the brand")
.replace(/\b(Remocn|remocn|snapcn|snap-cn)\b/g, "the brand")
.replace(/(^|[.!?:]\s+)the brand/g, "$1The brand")
.replace(/\bthe customi[sz]er\b/gi, "a form")
.replace(/\s+—\s+/g, ": ")
.replace(/\s{2,}/g, " ")
.trim();
}
/** Other components named in `backticks` by their upstream name: ours (category/name) where we have it; where we
* don't, the pointer goes and the reason stays ("You need X: use `y`" becomes "You need X") */
export function relink(s: string, ours: Map<string, string>, known: Set<string>): string {
const M = "\u0000";
const swapped = s.replace(/`([a-z0-9]+(?:-[a-z0-9]+)*)`/g, (m, n) => (ours.has(n) ? `\`${ours.get(n)}\`` : known.has(n) ? M : m));
if (!swapped.includes(M)) return swapped;
return swapped
.replace(new RegExp(`\\s*\\((${M}[,\\s]*(or\\s+|and\\s+)?)+\\)`, "g"), "")
.replace(new RegExp(`${M}(\\s*(,|or|and)\\s*${M})+`, "g"), M)
.replace(new RegExp(`\\s*(,|or|and)\\s*${M}`, "g"), "")
.replace(new RegExp(`${M}\\s*(,|or|and)\\s*`, "g"), "")
.replace(new RegExp(`[:;,.]?\\s*(then |instead )?(use|try|reach for|pair (it )?with|see|choose|pick)\\s+(the\\s+)?${M}[^.;]*`, "gi"), "")
.replace(new RegExp(M, "g"), "another component")
.replace(/\s+[-:;,]?\s*\.$/, ".")
.replace(/\s+([.,;:])/g, "$1")
.replace(/[:;,]\s*$/, "")
.trim();
}
export type Shape = { name: string; category: string; type: string; section?: string; upstream?: string };
/** The phrases people say for what a component is, beyond its own docs' (a person asking for "a terminal", "a
* composer" or "a template" means one of these) */
export function phrases(i: Shape): string[] {
const n = `${i.name} ${i.upstream ?? ""}`;
const out: string[] = [];
const add = (...p: string[]) => out.push(...p);
// a whole scene to fill with your words (a product demo, a launch, a testimonial): what people mean by "a template"
const scene = /^(product-scenes|compositions|ui-blocks|scenes|templates)$/.test(i.section ?? "") || /^(end-card|launch)$/.test(i.type) || i.category === "social";
if (scene) add("template", "scene template", "preset");
if (/^(looks|transitions|marks|backgrounds|depth)$/.test(i.category) || /^(effects|graphic-looks|camera|motion-graphics|filters|shaders)$/.test(i.section ?? "")) add("effect", "preset");
// a box a person types a prompt or message into (the "composer" of a chat app)
if (i.type === "prompt" || /^(prompt-|click-type$|input$|caret-dolly$|card-push-line$|ghost-complete$|chat-to-preview)/.test(i.name))
add("AI prompt", "prompt box", "chat input", "composer", "chat composer", "message box", "Claude composer", "branded UI animation");
// an AI assistant's side of it: answers, agents, voice
if (i.type === "ai" || /^(answer-|agent-|voice-agent)/.test(i.name)) add("AI chat", "chat UI", "AI assistant", "chatbot", "LLM", "AI product demo");
if (/^(agent-steps|terminal-)/.test(i.name)) add("Claude Code", "coding agent", "agent working");
if (/terminal/.test(n)) add("terminal", "command line", "CLI", "shell", "console", "Claude Code terminal", "dev tool");
if (i.type === "code") add("developer", "dev tool", "code");
if (/cursor|click|button-press/.test(n)) add("mouse cursor", "click", "pointer");
if (i.category === "ui") add("UI animation", "app demo", "product UI", "screen recording look");
if (i.type === "phone" || /phone/.test(n)) add("phone mockup", "mobile app", "iPhone");
if (/laptop|browser/.test(n) || i.type === "browser") add("laptop mockup", "browser window", "website");
if (i.category === "text") add("text animation", "kinetic type", "kinetic typography", "title");
if (i.category === "numbers") add("stat", "number", "counter", "big number");
if (i.category === "charts") add("chart", "graph", "data viz");
if (i.category === "captions") add("captions", "subtitles");
if (i.category === "logo") add("logo reveal", "logo animation", "intro", "outro", "sting");
if (i.type === "lower-third") add("lower third", "name title", "name tag");
if (i.category === "transitions") add("transition", "scene change", "wipe");
if (i.category === "backgrounds") add("background", "backdrop", "loop");
if (i.category === "social" || i.type === "social") add("social post", "social media");
if (i.category === "hud") add("HUD", "game overlay", "scoreboard");
if (i.category === "gallery") add("photo gallery", "image grid", "photos");
if (i.category === "looks") add("look", "filter", "grade");
return out;
}