Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: check list
kapishdima863c3c4c2aac
diff --git a/components/docs/examples/check-list-example.tsx b/components/docs/examples/check-list-example.tsxnew file mode 100644index 00000000..a5b3cb7c--- /dev/null+++ b/components/docs/examples/check-list-example.tsx@@ -0,0 +1,91 @@+"use client";++import { AbsoluteFill } from "remotion";+import { CheckList } from "@/registry/remocn/check-list";++const WIDTH = 820;++export const ITEMS = [+ "Render on your own machine",+ "No watermark, ever",+ "Every component MIT",+ { text: "Ships as source", checked: false },+];++const ITEMS_SOURCE = `[+ "Render on your own machine",+ "No watermark, ever",+ "Every component MIT",+ { text: "Ships as source", checked: false },+]`;++export function CheckListExampleScene({+ fontSize,+ itemGap,+ closeGap,+ perStep,+ strokeWidth,+ color,+ tickColor,+ step,+}: {+ fontSize?: number;+ itemGap?: number;+ closeGap?: number;+ perStep?: number;+ strokeWidth?: number;+ color?: string;+ tickColor?: string;+ step?: number;+}) {+ return (+ <AbsoluteFill style={{ alignItems: "center", justifyContent: "center" }}>+ <CheckList+ items={ITEMS}+ width={WIDTH}+ fontSize={fontSize}+ itemGap={itemGap}+ closeGap={closeGap}+ perStep={perStep}+ strokeWidth={strokeWidth}+ color={color}+ tickColor={tickColor}+ step={step}+ />+ </AbsoluteFill>+ );+}++export const checkListExampleCode = (+ values: Record<string, unknown>,+): string => {+ const fontSize = (values.fontSize as number) ?? 40;+ const itemGap = (values.itemGap as number) ?? 18;+ const closeGap = (values.closeGap as number) ?? 9;+ const perStep = (values.perStep as number) ?? 1.6;+ const strokeWidth = (values.strokeWidth as number) ?? 3;+ const color = (values.color as string) ?? "#26242c";+ const tickColor = (values.tickColor as string) ?? "#6f7f35";+ const step = (values.step as number) ?? 3;+ return `import { AbsoluteFill } from "remotion";+import { CheckList } from "@/components/remocn/check-list";++const items = ${ITEMS_SOURCE};++export const MyScene = () => (+ <AbsoluteFill style={{ alignItems: "center", justifyContent: "center" }}>+ <CheckList+ items={items}+ width={${WIDTH}}+ fontSize={${fontSize}}+ itemGap={${itemGap}}+ closeGap={${closeGap}}+ perStep={${perStep}}+ strokeWidth={${strokeWidth}}+ color="${color}"+ tickColor="${tickColor}"+ step={${step}}+ />+ </AbsoluteFill>+);`;+};diff --git a/content/docs/components.mdx b/content/docs/components.mdxindex d48e15f0..0b5c0d6d 100644--- a/content/docs/components.mdx+++ b/content/docs/components.mdx@@ -348,6 +348,12 @@ Pre-assembled interface elements: code editors, layouts, charts, and workflow vi<ComponentCardGriditems={[+ {+ name: "CheckList",+ description: "A handwritten checklist that writes itself out, then ticks and strikes through every done item",+ status: "stable",+ href: "/docs/ui-blocks/check-list",+ },{name: "PaperSticker",description: "A taped paper chip that slaps onto the scene over two stop-motion poses",diff --git a/content/docs/ui-blocks/check-list.mdx b/content/docs/ui-blocks/check-list.mdxnew file mode 100644index 00000000..bb5e98c7--- /dev/null+++ b/content/docs/ui-blocks/check-list.mdx@@ -0,0 +1,207 @@+---+title: Check List+description: A handwritten checklist that writes itself out, then ticks and strikes through every done item+---++<ComponentPreview name="check-list" />++## Installation++<InstallBlock name="check-list" />++## Usage++The list runs in two phases. First it **writes itself out**: each row draws its+box closed and then has its label written inside, with rows starting `itemGap`+frames apart and free to overlap. Only once the **whole** list has finished+writing does the second phase begin — each done item gets its tick, then a+stroke dragged through its label, one item after another `closeGap` frames+apart.++That ordering is the point: you read the full list before anything starts being+crossed off.++```tsx+// src/Root.tsx+import { AbsoluteFill, Composition, Sequence } from "remotion";+import { CheckList, checkListDuration } from "@/components/remocn/check-list";++const items = [+ "Render on your own machine",+ "No watermark, ever",+ "Every component MIT",+ { text: "Ships as source", checked: false },+];++const LIST_FROM = 12;+const LIST_DURATION = checkListDuration(items);++const CheckListScene = () => (+ <AbsoluteFill+ style={{+ background: "#f1eee7",+ alignItems: "center",+ justifyContent: "center",+ }}+ >+ <Sequence from={LIST_FROM} durationInFrames={LIST_DURATION}>+ <CheckList items={items} width={820} />+ </Sequence>+ </AbsoluteFill>+);++export const RemotionRoot = () => (+ <Composition+ id="CheckList"+ component={CheckListScene}+ durationInFrames={LIST_FROM + LIST_DURATION}+ fps={30}+ width={1280}+ height={720}+ />+);+```++### Items that never get ticked++A bare string is shorthand for an item that eventually gets ticked. Pass an+object with `checked: false` and the row keeps its box and its clean label+forever — no tick, no stroke through it. That is the "not yet" line in a+roadmap or a comparison, and it is skipped when the close phase counts out its+turns, so it never leaves a gap in the rhythm.++```tsx+<CheckList+ items={["Shipped today", { text: "Landing next", checked: false }]}+ width={620}+/>+```++### Sizing the scene++`checkListDuration` returns the frame the last stroke ends on. Pass the same+timing options you pass the component, and `delay` if you set it there — the+returned frame is absolute and includes it.++```tsx+const total = checkListDuration(items, { delay: 12, itemGap: 24, step: 4 });+```++`checkListEnterEnd` returns the frame the writing phase finishes on — the+moment the first tick lands. Use it to fire something else off the same beat,+such as a heading or a stamp arriving once the list is fully written.++```tsx+const written = checkListEnterEnd(items);+```++Both are maxima over the whole list, not the last row's: rows overlap, so an+early long label can outlast a later short one, and a list whose longest item+is unchecked still has that item decide when the writing phase ends. If nothing+is checked there is no close phase, and `checkListDuration` equals+`checkListEnterEnd`.++### Why width is required++Labels are written by `handwrite`, which centres itself absolutely. Inside an+auto-sized cell that collapses to zero width and the text silently vanishes, so+the list takes its width explicitly and derives every label cell, box offset,+and row from it. The component sets no background and no jitter of its own —+wrap it in `paper-wobble` to put it on the desk.++## Props++<PropsTable+ rows={[+ {+ name: "items",+ type: "(string | { text: string; checked?: boolean })[]",+ required: true,+ description: "Rows to draw; a bare string is an item that gets ticked",+ },+ {+ name: "width",+ type: "number",+ required: true,+ description: "List width; the label cell, box offset, and rows derive from it",+ },+ {+ name: "fontSize",+ type: "number",+ default: "40",+ description: "Label size; the box and row height scale from it",+ },+ {+ name: "color",+ type: "string",+ default: "\"#26242c\"",+ description: "Ink colour of the labels",+ },+ {+ name: "boxColor",+ type: "string",+ default: "\"#26242c\"",+ description: "Ink colour of the boxes",+ },+ {+ name: "tickColor",+ type: "string",+ default: "\"#6f7f35\"",+ description: "Ink colour of the ticks and the strokes through done labels",+ },+ {+ name: "delay",+ type: "number",+ default: "0",+ description: "Local frame the first box starts drawing",+ },+ {+ name: "itemGap",+ type: "number",+ default: "step * 6",+ description: "Frames between item starts while the list writes itself; rows may overlap",+ },+ {+ name: "closeGap",+ type: "number",+ default: "step * 3",+ description: "Frames between one item being ticked and the next, after the list is written",+ },+ {+ name: "rowGap",+ type: "number",+ default: "fontSize * 0.55",+ description: "Pixels between rows",+ },+ {+ name: "strokeWidth",+ type: "number",+ default: "3",+ description: "Pen width of the box; the tick is one unit heavier",+ },+ {+ name: "perStep",+ type: "number",+ default: "1.6",+ description: "Letters written per pose, forwarded to the labels",+ },+ {+ name: "weight",+ type: "400 | 500 | 600 | 700",+ default: "600",+ description: "Label font weight",+ },+ {+ name: "seed",+ type: "string",+ default: "\"checklist\"",+ description: "Seed for the per-box corner wobble",+ },+ {+ name: "step",+ type: "number",+ default: "3",+ description: "Frames per stop-motion pose",+ },+ ]}+/>diff --git a/content/docs/ui-blocks/meta.json b/content/docs/ui-blocks/meta.jsonindex e68d68b4..55a0a24f 100644--- a/content/docs/ui-blocks/meta.json+++ b/content/docs/ui-blocks/meta.json@@ -12,6 +12,7 @@"data-flow-pipes","progress-steps","paper-sticker",- "polaroid"+ "polaroid",+ "check-list"]}diff --git a/registry-artifacts/check-list.json b/registry-artifacts/check-list.jsonnew file mode 100644index 00000000..59197cff--- /dev/null+++ b/registry-artifacts/check-list.json@@ -0,0 +1,17 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "check-list",+ "title": "Check List",+ "description": "A handwritten checklist that writes itself out in full, then ticks and strikes through every done item, one at a time.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/stop-motion", "@remocn/handwrite"],+ "files": [+ {+ "path": "registry/remocn/check-list/index.tsx",+ "content": "\"use client\";\n\nimport { useCurrentFrame } from \"remotion\";\nimport { Handwrite, handwriteDuration } from \"@/components/remocn/handwrite\";\nimport { DEFAULT_STEP, hashRange, steppedRamp } from \"@/lib/remocn/stop-motion\";\n\nconst easeOutCubic = (t: number) => 1 - (1 - t) ** 3;\n\nconst DEFAULT_PER_STEP = 1.6;\n\nexport type CheckListItem = {\n text: string;\n checked?: boolean;\n};\n\nexport type CheckListEntry = {\n text: string;\n checked: boolean;\n};\n\nexport type CheckListGeometry = {\n boxSize: number;\n boxGap: number;\n rowHeight: number;\n labelWidth: number;\n};\n\nexport type CheckListBeat = {\n boxFrom: number;\n boxTo: number;\n labelAt: number;\n labelEnd: number;\n tickFrom?: number;\n tickTo?: number;\n strikeFrom?: number;\n strikeTo?: number;\n};\n\nexport type CheckListTiming = {\n delay?: number;\n itemGap?: number;\n perStep?: number;\n step?: number;\n closeGap?: number;\n};\n\nexport function normalizeCheckListItems(\n items: (string | CheckListItem)[],\n): CheckListEntry[] {\n return items.map((item) =>\n typeof item === \"string\"\n ? { text: item, checked: true }\n : { text: item.text, checked: item.checked ?? true },\n );\n}\n\nexport function checkListGeometry(\n width: number,\n fontSize: number,\n): CheckListGeometry {\n const boxSize = Math.round(fontSize * 0.62);\n const boxGap = Math.round(fontSize * 0.4);\n return {\n boxSize,\n boxGap,\n rowHeight: Math.round(fontSize * 1.15),\n labelWidth: Math.max(fontSize * 2, width - boxSize - boxGap),\n };\n}\n\nexport function checkListRowWidth(width: number, fontSize: number): number {\n const { boxSize, boxGap, labelWidth } = checkListGeometry(width, fontSize);\n return boxSize + boxGap + labelWidth;\n}\n\nexport function checkListEnterEnd(\n items: (string | CheckListItem)[],\n options?: CheckListTiming,\n): number {\n const step = options?.step ?? DEFAULT_STEP;\n const delay = options?.delay ?? 0;\n const itemGap = options?.itemGap ?? step * 6;\n const perStep = options?.perStep ?? DEFAULT_PER_STEP;\n\n return normalizeCheckListItems(items).reduce(\n (end, item, i) =>\n Math.max(\n end,\n delay +\n i * itemGap +\n step * 2 +\n handwriteDuration(item.text, { perStep, step }),\n ),\n delay,\n );\n}\n\nexport function checkListSchedule(\n items: (string | CheckListItem)[],\n options?: CheckListTiming,\n): CheckListBeat[] {\n const step = options?.step ?? DEFAULT_STEP;\n const delay = options?.delay ?? 0;\n const itemGap = options?.itemGap ?? step * 6;\n const perStep = options?.perStep ?? DEFAULT_PER_STEP;\n const closeGap = options?.closeGap ?? step * 3;\n const entries = normalizeCheckListItems(items);\n const enterEnd = checkListEnterEnd(entries, options);\n\n const closeOrder = new Map<number, number>();\n entries.forEach((item, i) => {\n if (item.checked) {\n closeOrder.set(i, closeOrder.size);\n }\n });\n\n return entries.map((item, i) => {\n const boxFrom = delay + i * itemGap;\n const boxTo = boxFrom + step * 2;\n const labelEnd = boxTo + handwriteDuration(item.text, { perStep, step });\n const slot = closeOrder.get(i);\n if (slot === undefined) {\n return { boxFrom, boxTo, labelAt: boxTo, labelEnd };\n }\n const tickFrom = enterEnd + slot * closeGap;\n const tickTo = tickFrom + step * 2;\n return {\n boxFrom,\n boxTo,\n labelAt: boxTo,\n labelEnd,\n tickFrom,\n tickTo,\n strikeFrom: tickTo,\n strikeTo: tickTo + step * 2,\n };\n });\n}\n\nexport function checkListDuration(\n items: (string | CheckListItem)[],\n options?: CheckListTiming,\n): number {\n return checkListSchedule(items, options).reduce(\n (end, beat) => Math.max(end, beat.strikeTo ?? beat.labelEnd),\n 0,\n );\n}\n\nconst boxPath = (size: number, seed: string, index: number): string => {\n const nudge = (n: number) => hashRange(`${seed}:${index}:c${n}`, -1.5, 1.5);\n const lo = size * 0.08;\n const hi = size - lo;\n const corners: [number, number][] = [\n [lo + nudge(0), lo + nudge(1)],\n [hi + nudge(2), lo + nudge(3)],\n [hi + nudge(4), hi + nudge(5)],\n [lo + nudge(6), hi + nudge(7)],\n ];\n const [start, ...rest] = corners;\n return `M ${start[0]} ${start[1]} ${rest\n .map(([x, y]) => `L ${x} ${y}`)\n .join(\" \")} Z`;\n};\n\nconst tickPath = (size: number): string =>\n `M ${size * 0.2} ${size * 0.52} L ${size * 0.42} ${size * 0.78} L ${size * 0.88} ${size * 0.14}`;\n\nconst CAVEAT_ADVANCE = 0.36;\n\nexport function checkListStrikeWidth(\n text: string,\n fontSize: number,\n labelWidth: number,\n): number {\n return Math.min(\n labelWidth,\n Array.from(text).length * fontSize * CAVEAT_ADVANCE,\n );\n}\n\nconst strikePath = (\n reach: number,\n fontSize: number,\n rowHeight: number,\n seed: string,\n index: number,\n): string => {\n const lift = (n: number) => hashRange(`${seed}:${index}:s${n}`, -1.6, 1.6);\n const overshoot = fontSize * 0.07;\n const mid = rowHeight / 2;\n return `M ${-overshoot} ${mid + lift(0)} C ${reach * 0.35} ${mid + lift(1)}, ${reach * 0.7} ${mid + lift(2)}, ${reach + overshoot} ${mid + lift(3)}`;\n};\n\nexport interface CheckListProps {\n items: (string | CheckListItem)[];\n width: number;\n fontSize?: number;\n color?: string;\n boxColor?: string;\n tickColor?: string;\n delay?: number;\n itemGap?: number;\n closeGap?: number;\n rowGap?: number;\n strokeWidth?: number;\n perStep?: number;\n weight?: 400 | 500 | 600 | 700;\n seed?: string;\n step?: number;\n}\n\nexport function CheckList({\n items,\n width,\n fontSize = 40,\n color = \"#26242c\",\n boxColor = \"#26242c\",\n tickColor = \"#6f7f35\",\n delay = 0,\n itemGap,\n closeGap,\n rowGap,\n strokeWidth = 3,\n perStep = DEFAULT_PER_STEP,\n weight = 600,\n seed = \"checklist\",\n step = DEFAULT_STEP,\n}: CheckListProps) {\n const frame = useCurrentFrame();\n const entries = normalizeCheckListItems(items);\n const schedule = checkListSchedule(entries, {\n delay,\n itemGap,\n closeGap,\n perStep,\n step,\n });\n const { boxSize, boxGap, rowHeight, labelWidth } = checkListGeometry(\n width,\n fontSize,\n );\n\n return (\n <div\n style={{\n width: checkListRowWidth(width, fontSize),\n display: \"flex\",\n flexDirection: \"column\",\n gap: rowGap ?? fontSize * 0.55,\n }}\n >\n {entries.map((item, i) => {\n const beat = schedule[i];\n const boxProgress = steppedRamp(frame, beat.boxFrom, beat.boxTo, {\n ease: easeOutCubic,\n step,\n });\n const tickProgress =\n beat.tickFrom === undefined || beat.tickTo === undefined\n ? 0\n : steppedRamp(frame, beat.tickFrom, beat.tickTo, {\n ease: easeOutCubic,\n step,\n });\n const strikeProgress =\n beat.strikeFrom === undefined || beat.strikeTo === undefined\n ? 0\n : steppedRamp(frame, beat.strikeFrom, beat.strikeTo, {\n ease: easeOutCubic,\n step,\n });\n\n return (\n <div\n key={`${item.text}:${i}`}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: boxGap,\n height: rowHeight,\n }}\n >\n <svg\n width={boxSize}\n height={boxSize}\n viewBox={`0 0 ${boxSize} ${boxSize}`}\n style={{ display: \"block\", overflow: \"visible\", flexShrink: 0 }}\n >\n <path\n d={boxPath(boxSize, seed, i)}\n stroke={boxColor}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - boxProgress}\n opacity={boxProgress > 0 ? 0.9 : 0}\n />\n {item.checked ? (\n <path\n d={tickPath(boxSize)}\n stroke={tickColor}\n strokeWidth={strokeWidth + 1}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - tickProgress}\n opacity={tickProgress > 0 ? 1 : 0}\n />\n ) : null}\n </svg>\n <div\n style={{\n position: \"relative\",\n flexShrink: 0,\n width: labelWidth,\n height: rowHeight,\n }}\n >\n <Handwrite\n text={item.text}\n fontSize={fontSize}\n color={color}\n delay={beat.labelAt}\n perStep={perStep}\n weight={weight}\n align=\"left\"\n step={step}\n />\n {item.checked ? (\n <svg\n width={labelWidth}\n height={rowHeight}\n viewBox={`0 0 ${labelWidth} ${rowHeight}`}\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"block\",\n overflow: \"visible\",\n }}\n >\n <path\n d={strikePath(\n checkListStrikeWidth(item.text, fontSize, labelWidth),\n fontSize,\n rowHeight,\n seed,\n i,\n )}\n stroke={tickColor}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n fill=\"none\"\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - strikeProgress}\n opacity={strikeProgress > 0 ? 0.85 : 0}\n />\n </svg>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/check-list.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.jsonindex c27c032b..60656226 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -1373,6 +1373,21 @@],"type": "registry:component"},+ {+ "name": "check-list",+ "title": "Check List",+ "description": "A handwritten checklist that writes itself out in full, then ticks and strikes through every done item, one at a time.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/stop-motion", "@remocn/handwrite"],+ "files": [+ {+ "path": "registry/remocn/check-list/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/check-list.tsx"+ }+ ],+ "type": "registry:component"+ },{"name": "page-turn","title": "Page Turn",diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex f0134f59..e0b3baa6 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -8,6 +8,7 @@ import { blurOutUpConfig } from "@/registry/remocn/blur-out-up/config";import { bottomUpLettersConfig } from "@/registry/remocn/bottom-up-letters/config";import { chatGptConfig } from "@/registry/remocn/chat-gpt/config";import { chatToPreviewLayoutConfig } from "@/registry/remocn/chat-to-preview-layout/config";+import { checkListConfig } from "@/registry/remocn/check-list/config";import { claudeChatConfig } from "@/registry/remocn/claude-chat/config";import { claudeCodeConfig } from "@/registry/remocn/claude-code/config";import { confettiConfig } from "@/registry/remocn/confetti/config";@@ -1557,6 +1558,13 @@ const registry: Record<string, RegistryEntry> = {})),config: polaroidConfig,},+ "check-list": {+ load: () =>+ import("@/components/docs/examples/check-list-example").then((m) => ({+ default: m.CheckListExampleScene,+ })),+ config: checkListConfig,+ },"page-turn": {load: () =>import("@/components/docs/examples/page-turn-example").then((m) => ({diff --git a/registry/remocn/check-list/__tests__/check-list.test.ts b/registry/remocn/check-list/__tests__/check-list.test.tsnew file mode 100644index 00000000..1c18c53d--- /dev/null+++ b/registry/remocn/check-list/__tests__/check-list.test.ts@@ -0,0 +1,337 @@+import { describe, expect, it } from "bun:test";++import { ITEMS as PREVIEW_ITEMS } from "@/components/docs/examples/check-list-example";+import { checkListConfig } from "../config";+import {+ type CheckListBeat,+ checkListDuration,+ checkListEnterEnd,+ checkListGeometry,+ checkListRowWidth,+ checkListSchedule,+ checkListStrikeWidth,+ normalizeCheckListItems,+} from "../index";++const tickWindow = (beat: CheckListBeat) => {+ if (beat.tickFrom === undefined || beat.tickTo === undefined) {+ throw new Error(`expected a tick window at frame ${beat.boxFrom}`);+ }+ return { from: beat.tickFrom, to: beat.tickTo };+};++const numberControl = (name: string) => {+ const control = checkListConfig.controls[name];+ if (control.type !== "number") {+ throw new Error(`${name} is not a number control`);+ }+ return control;+};++const PREVIEW_WORST_CASE = {+ itemGap: numberControl("itemGap").max,+ perStep: numberControl("perStep").min,+ step: numberControl("step").max,+};++describe("normalizeCheckListItems", () => {+ it("treats a bare string as a checked item", () => {+ expect(normalizeCheckListItems(["Ship faster"])).toEqual([+ { text: "Ship faster", checked: true },+ ]);+ });++ it("defaults an object without checked to true", () => {+ expect(normalizeCheckListItems([{ text: "Ship faster" }])).toEqual([+ { text: "Ship faster", checked: true },+ ]);+ });++ it("preserves checked: false", () => {+ expect(+ normalizeCheckListItems([{ text: "Ships as source", checked: false }]),+ ).toEqual([{ text: "Ships as source", checked: false }]);+ });++ it("mixes both spellings in one list", () => {+ expect(+ normalizeCheckListItems(["a", { text: "b", checked: false }, "c"]),+ ).toEqual([+ { text: "a", checked: true },+ { text: "b", checked: false },+ { text: "c", checked: true },+ ]);+ });+});++describe("checkListSchedule", () => {+ it("starts items itemGap apart", () => {+ const beats = checkListSchedule(["a", "b", "c"], { itemGap: 18 });+ expect(beats.map((b) => b.boxFrom)).toEqual([0, 18, 36]);+ });++ it("offsets every start by delay", () => {+ const beats = checkListSchedule(["a", "b"], { delay: 30, itemGap: 18 });+ expect(beats.map((b) => b.boxFrom)).toEqual([30, 48]);+ });++ it("defaults itemGap to step * 6", () => {+ expect(+ checkListSchedule(["a", "b"], { step: 5 }).map((b) => b.boxFrom),+ ).toEqual([0, 30]);+ });++ it("orders every window box < label < tick < strike", () => {+ const beats = checkListSchedule(+ ["Render on your own machine", "No watermark, ever", "MIT"],+ { itemGap: 12 },+ );+ for (const beat of beats) {+ const tick = tickWindow(beat);+ expect(beat.boxFrom).toBeLessThan(beat.labelAt);+ expect(beat.labelAt).toBeLessThan(beat.labelEnd);+ expect(beat.labelEnd).toBeLessThanOrEqual(tick.from);+ expect(tick.from).toBeLessThan(tick.to);+ expect(tick.to).toBe(beat.strikeFrom);+ expect(beat.strikeFrom).toBeLessThan(beat.strikeTo as number);+ }+ });++ it("starts no tick until the whole list has finished writing", () => {+ const items = [+ "Render on your own machine",+ "No watermark, ever",+ "Every component MIT",+ ];+ const beats = checkListSchedule(items, { itemGap: 12 });+ const enterEnd = checkListEnterEnd(items, { itemGap: 12 });+ expect(enterEnd).toBe(Math.max(...beats.map((b) => b.labelEnd)));+ for (const beat of beats) {+ expect(tickWindow(beat).from).toBeGreaterThanOrEqual(enterEnd);+ }+ });++ it("closes items in list order, closeGap apart, skipping unchecked ones", () => {+ const beats = checkListSchedule(+ ["a", { text: "b", checked: false }, "c", "d"],+ { closeGap: 10 },+ );+ const enterEnd = checkListEnterEnd([+ "a",+ { text: "b", checked: false },+ "c",+ "d",+ ]);+ expect(beats[1].tickFrom).toBeUndefined();+ expect(beats[0].tickFrom).toBe(enterEnd);+ expect(beats[2].tickFrom).toBe(enterEnd + 10);+ expect(beats[3].tickFrom).toBe(enterEnd + 20);+ });++ it("closes the box before the first character is written", () => {+ const [beat] = checkListSchedule(["Ship faster"], { step: 4 });+ expect(beat.boxTo).toBe(8);+ expect(beat.labelAt).toBe(beat.boxTo);+ });++ it("lets one long label delay the close phase for every item", () => {+ const short = checkListSchedule(["Ship", "Ship"], { itemGap: 18 });+ const long = checkListSchedule(+ ["Zero configuration required for teams", "Ship"],+ { itemGap: 18 },+ );+ expect(long[1].boxFrom).toBe(short[1].boxFrom);+ expect(long[1].labelEnd).toBe(short[1].labelEnd);+ expect(tickWindow(long[1]).from).toBeGreaterThan(tickWindow(short[1]).from);+ });++ it("gives an unchecked item no tick and no strike", () => {+ const [checked, unchecked] = checkListSchedule([+ "Ship faster",+ { text: "Ships as source", checked: false },+ ]);+ expect(checked.tickFrom).toBeNumber();+ expect(checked.strikeTo).toBeNumber();+ expect(unchecked.tickFrom).toBeUndefined();+ expect(unchecked.tickTo).toBeUndefined();+ expect(unchecked.strikeFrom).toBeUndefined();+ expect(unchecked.strikeTo).toBeUndefined();+ expect(unchecked.labelEnd).toBeGreaterThan(unchecked.labelAt);+ });++ it("matches the plan's two-item counterexample exactly", () => {+ const items = ["Zero configuration required for teams", "Ship faster"];+ expect(checkListEnterEnd(items)).toBe(81);+ const beats = checkListSchedule(items);+ expect(beats[0]).toEqual({+ boxFrom: 0,+ boxTo: 6,+ labelAt: 6,+ labelEnd: 81,+ tickFrom: 81,+ tickTo: 87,+ strikeFrom: 87,+ strikeTo: 93,+ });+ expect(beats[1]).toEqual({+ boxFrom: 18,+ boxTo: 24,+ labelAt: 24,+ labelEnd: 48,+ tickFrom: 90,+ tickTo: 96,+ strikeFrom: 96,+ strikeTo: 102,+ });+ });+});++describe("checkListStrikeWidth", () => {+ it("grows with the glyph count", () => {+ expect(checkListStrikeWidth("ab", 40, 800)).toBeLessThan(+ checkListStrikeWidth("abcd", 40, 800),+ );+ });++ it("never overruns the label cell", () => {+ expect(checkListStrikeWidth("x".repeat(200), 40, 300)).toBe(300);+ });++ it("counts unicode glyphs, not UTF-16 code units", () => {+ expect("👋".length).toBe(2);+ expect(checkListStrikeWidth("👋", 40, 800)).toBe(+ checkListStrikeWidth("a", 40, 800),+ );+ });+});++describe("checkListGeometry", () => {+ it("derives the box and row from fontSize", () => {+ expect(checkListGeometry(820, 40)).toEqual({+ boxSize: 25,+ boxGap: 16,+ rowHeight: 46,+ labelWidth: 779,+ });+ });++ it("tracks boxSize to fontSize, not width", () => {+ expect(checkListGeometry(200, 40).boxSize).toBe(+ checkListGeometry(2000, 40).boxSize,+ );+ expect(checkListGeometry(820, 64).boxSize).toBeGreaterThan(+ checkListGeometry(820, 24).boxSize,+ );+ });++ it("engages the clamp at the extreme corner", () => {+ const clamped = checkListGeometry(100, 64);+ expect(100 - clamped.boxSize - clamped.boxGap).toBeLessThan(64 * 2);+ expect(clamped.labelWidth).toBe(128);+ });++ it("leaves the clamp idle at a comfortable width", () => {+ expect(checkListGeometry(820, 64).labelWidth).toBe(820 - 40 - 26);+ });++ it("widens the row the layout renders when the clamp fires", () => {+ expect(checkListRowWidth(100, 64)).toBeGreaterThan(100);+ expect(checkListRowWidth(100, 64)).toBe(40 + 26 + 128);+ expect(checkListRowWidth(60, 64)).toBeGreaterThan(60);+ });++ it("renders a row exactly as wide as width whenever the clamp is idle", () => {+ for (const width of [420, 620, 820, 1200]) {+ for (const fontSize of [24, 32, 40, 48, 56, 64]) {+ const { labelWidth } = checkListGeometry(width, fontSize);+ expect(labelWidth).toBeGreaterThan(fontSize * 2);+ expect(checkListRowWidth(width, fontSize)).toBe(width);+ }+ }+ });+});++describe("checkListDuration", () => {+ it("ends on the last strike, not the last item's label", () => {+ const items = ["Zero configuration required for teams", "Ship faster"];+ expect(checkListDuration(items)).toBe(102);+ });++ it("lets an unchecked item decide when the writing phase ends", () => {+ expect(PREVIEW_WORST_CASE).toEqual({ itemGap: 48, perStep: 0.8, step: 6 });+ const beats = checkListSchedule(PREVIEW_ITEMS, PREVIEW_WORST_CASE);+ expect(checkListEnterEnd(PREVIEW_ITEMS, PREVIEW_WORST_CASE)).toBe(276);+ expect(beats[3].tickTo).toBeUndefined();+ expect(beats[3].labelEnd).toBe(276);+ expect(beats.map((b) => b.labelEnd)).toEqual([216, 204, 258, 276]);+ expect(checkListDuration(PREVIEW_ITEMS, PREVIEW_WORST_CASE)).toBe(336);+ });++ it("falls back to the writing phase when nothing is checked", () => {+ const items = [+ { text: "Ships as source", checked: false },+ { text: "Landing next", checked: false },+ ];+ expect(checkListDuration(items)).toBe(checkListEnterEnd(items));+ });++ it("fits the preview duration anywhere in the control matrix", () => {+ const values = (name: string) => {+ const { min, max, step } = numberControl(name);+ return Array.from(+ { length: Math.floor((max - min) / step + 1e-9) + 1 },+ (_, i) => min + i * step,+ );+ };+ const paces = values("perStep");+ expect(paces.at(0)).toBeCloseTo(0.8);+ expect(paces.at(-1)).toBeCloseTo(3);+ for (const itemGap of values("itemGap")) {+ for (const perStep of paces) {+ for (const step of values("step")) {+ for (const closeGap of values("closeGap")) {+ expect(+ checkListDuration(PREVIEW_ITEMS, {+ itemGap,+ closeGap,+ perStep,+ step,+ }),+ ).toBeLessThanOrEqual(checkListConfig.durationInFrames);+ }+ }+ }+ }+ });++ it("runs 123 frames at the defaults, the length the skill reference quotes", () => {+ expect(checkListDuration(PREVIEW_ITEMS)).toBe(123);+ expect(checkListEnterEnd(PREVIEW_ITEMS)).toBe(93);+ });++ it("grows with closeGap", () => {+ expect(checkListDuration(PREVIEW_ITEMS, { closeGap: 18 })).toBeGreaterThan(+ checkListDuration(PREVIEW_ITEMS, { closeGap: 9 }),+ );+ });++ it("includes delay as an absolute frame", () => {+ expect(checkListDuration(["Ship faster"], { delay: 30 })).toBe(+ checkListDuration(["Ship faster"]) + 30,+ );+ });++ it("grows with itemGap", () => {+ const items = ["Ship faster", "No watermark, ever", "Every component MIT"];+ expect(checkListDuration(items, { itemGap: 36 })).toBeGreaterThan(+ checkListDuration(items, { itemGap: 18 }),+ );+ expect(checkListDuration(items, { itemGap: 48 })).toBeGreaterThan(+ checkListDuration(items, { itemGap: 36 }),+ );+ });++ it("returns 0 for an empty list", () => {+ expect(checkListDuration([])).toBe(0);+ });+});diff --git a/registry/remocn/check-list/config.ts b/registry/remocn/check-list/config.tsnew file mode 100644index 00000000..30c25760--- /dev/null+++ b/registry/remocn/check-list/config.ts@@ -0,0 +1,65 @@+import { checkListExampleCode } from "@/components/docs/examples/check-list-example";+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const checkListConfig: ComponentConfig = {+ componentName: "CheckList",+ importPath: "@/components/remocn/check-list",+ controls: {+ fontSize: {+ type: "number",+ default: 40,+ min: 24,+ max: 64,+ step: 2,+ label: "Font size",+ },+ itemGap: {+ type: "number",+ default: 18,+ min: 6,+ max: 48,+ step: 3,+ label: "Frames between items",+ },+ closeGap: {+ type: "number",+ default: 9,+ min: 3,+ max: 24,+ step: 3,+ label: "Frames between ticks",+ },+ perStep: {+ type: "number",+ default: 1.6,+ min: 0.8,+ max: 3,+ step: 0.2,+ label: "Letters / pose",+ },+ strokeWidth: {+ type: "number",+ default: 3,+ min: 1,+ max: 8,+ step: 1,+ label: "Stroke width",+ },+ color: { type: "color", default: "#26242c", label: "Label color" },+ tickColor: { type: "color", default: "#6f7f35", label: "Tick color" },+ step: {+ type: "number",+ default: 3,+ min: 1,+ max: 6,+ step: 1,+ label: "Frames / pose",+ },+ },+ snippet: checkListExampleCode,+ durationInFrames: 360,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ previewBackdrop: { type: "color", value: "#f1eee7" },+};diff --git a/registry/remocn/check-list/index.tsx b/registry/remocn/check-list/index.tsxnew file mode 100644index 00000000..0a2fa954--- /dev/null+++ b/registry/remocn/check-list/index.tsx@@ -0,0 +1,372 @@+"use client";++import { useCurrentFrame } from "remotion";+import { Handwrite, handwriteDuration } from "@/components/remocn/handwrite";+import { DEFAULT_STEP, hashRange, steppedRamp } from "@/lib/remocn/stop-motion";++const easeOutCubic = (t: number) => 1 - (1 - t) ** 3;++const DEFAULT_PER_STEP = 1.6;++export type CheckListItem = {+ text: string;+ checked?: boolean;+};++export type CheckListEntry = {+ text: string;+ checked: boolean;+};++export type CheckListGeometry = {+ boxSize: number;+ boxGap: number;+ rowHeight: number;+ labelWidth: number;+};++export type CheckListBeat = {+ boxFrom: number;+ boxTo: number;+ labelAt: number;+ labelEnd: number;+ tickFrom?: number;+ tickTo?: number;+ strikeFrom?: number;+ strikeTo?: number;+};++export type CheckListTiming = {+ delay?: number;+ itemGap?: number;+ perStep?: number;+ step?: number;+ closeGap?: number;+};++export function normalizeCheckListItems(+ items: (string | CheckListItem)[],+): CheckListEntry[] {+ return items.map((item) =>+ typeof item === "string"+ ? { text: item, checked: true }+ : { text: item.text, checked: item.checked ?? true },+ );+}++export function checkListGeometry(+ width: number,+ fontSize: number,+): CheckListGeometry {+ const boxSize = Math.round(fontSize * 0.62);+ const boxGap = Math.round(fontSize * 0.4);+ return {+ boxSize,+ boxGap,+ rowHeight: Math.round(fontSize * 1.15),+ labelWidth: Math.max(fontSize * 2, width - boxSize - boxGap),+ };+}++export function checkListRowWidth(width: number, fontSize: number): number {+ const { boxSize, boxGap, labelWidth } = checkListGeometry(width, fontSize);+ return boxSize + boxGap + labelWidth;+}++export function checkListEnterEnd(+ items: (string | CheckListItem)[],+ options?: CheckListTiming,+): number {+ const step = options?.step ?? DEFAULT_STEP;+ const delay = options?.delay ?? 0;+ const itemGap = options?.itemGap ?? step * 6;+ const perStep = options?.perStep ?? DEFAULT_PER_STEP;++ return normalizeCheckListItems(items).reduce(+ (end, item, i) =>+ Math.max(+ end,+ delay ++ i * itemGap ++ step * 2 ++ handwriteDuration(item.text, { perStep, step }),+ ),+ delay,+ );+}++export function checkListSchedule(+ items: (string | CheckListItem)[],+ options?: CheckListTiming,+): CheckListBeat[] {+ const step = options?.step ?? DEFAULT_STEP;+ const delay = options?.delay ?? 0;+ const itemGap = options?.itemGap ?? step * 6;+ const perStep = options?.perStep ?? DEFAULT_PER_STEP;+ const closeGap = options?.closeGap ?? step * 3;+ const entries = normalizeCheckListItems(items);+ const enterEnd = checkListEnterEnd(entries, options);++ const closeOrder = new Map<number, number>();+ entries.forEach((item, i) => {+ if (item.checked) {+ closeOrder.set(i, closeOrder.size);+ }+ });++ return entries.map((item, i) => {+ const boxFrom = delay + i * itemGap;+ const boxTo = boxFrom + step * 2;+ const labelEnd = boxTo + handwriteDuration(item.text, { perStep, step });+ const slot = closeOrder.get(i);+ if (slot === undefined) {+ return { boxFrom, boxTo, labelAt: boxTo, labelEnd };+ }+ const tickFrom = enterEnd + slot * closeGap;+ const tickTo = tickFrom + step * 2;+ return {+ boxFrom,+ boxTo,+ labelAt: boxTo,+ labelEnd,+ tickFrom,+ tickTo,+ strikeFrom: tickTo,+ strikeTo: tickTo + step * 2,+ };+ });+}++export function checkListDuration(+ items: (string | CheckListItem)[],+ options?: CheckListTiming,+): number {+ return checkListSchedule(items, options).reduce(+ (end, beat) => Math.max(end, beat.strikeTo ?? beat.labelEnd),+ 0,+ );+}++const boxPath = (size: number, seed: string, index: number): string => {+ const nudge = (n: number) => hashRange(`${seed}:${index}:c${n}`, -1.5, 1.5);+ const lo = size * 0.08;+ const hi = size - lo;+ const corners: [number, number][] = [+ [lo + nudge(0), lo + nudge(1)],+ [hi + nudge(2), lo + nudge(3)],+ [hi + nudge(4), hi + nudge(5)],+ [lo + nudge(6), hi + nudge(7)],+ ];+ const [start, ...rest] = corners;+ return `M ${start[0]} ${start[1]} ${rest+ .map(([x, y]) => `L ${x} ${y}`)+ .join(" ")} Z`;+};++const tickPath = (size: number): string =>+ `M ${size * 0.2} ${size * 0.52} L ${size * 0.42} ${size * 0.78} L ${size * 0.88} ${size * 0.14}`;++const CAVEAT_ADVANCE = 0.36;++export function checkListStrikeWidth(+ text: string,+ fontSize: number,+ labelWidth: number,+): number {+ return Math.min(+ labelWidth,+ Array.from(text).length * fontSize * CAVEAT_ADVANCE,+ );+}++const strikePath = (+ reach: number,+ fontSize: number,+ rowHeight: number,+ seed: string,+ index: number,+): string => {+ const lift = (n: number) => hashRange(`${seed}:${index}:s${n}`, -1.6, 1.6);+ const overshoot = fontSize * 0.07;+ const mid = rowHeight / 2;+ return `M ${-overshoot} ${mid + lift(0)} C ${reach * 0.35} ${mid + lift(1)}, ${reach * 0.7} ${mid + lift(2)}, ${reach + overshoot} ${mid + lift(3)}`;+};++export interface CheckListProps {+ items: (string | CheckListItem)[];+ width: number;+ fontSize?: number;+ color?: string;+ boxColor?: string;+ tickColor?: string;+ delay?: number;+ itemGap?: number;+ closeGap?: number;+ rowGap?: number;+ strokeWidth?: number;+ perStep?: number;+ weight?: 400 | 500 | 600 | 700;+ seed?: string;+ step?: number;+}++export function CheckList({+ items,+ width,+ fontSize = 40,+ color = "#26242c",+ boxColor = "#26242c",+ tickColor = "#6f7f35",+ delay = 0,+ itemGap,+ closeGap,+ rowGap,+ strokeWidth = 3,+ perStep = DEFAULT_PER_STEP,+ weight = 600,+ seed = "checklist",+ step = DEFAULT_STEP,+}: CheckListProps) {+ const frame = useCurrentFrame();+ const entries = normalizeCheckListItems(items);+ const schedule = checkListSchedule(entries, {+ delay,+ itemGap,+ closeGap,+ perStep,+ step,+ });+ const { boxSize, boxGap, rowHeight, labelWidth } = checkListGeometry(+ width,+ fontSize,+ );++ return (+ <div+ style={{+ width: checkListRowWidth(width, fontSize),+ display: "flex",+ flexDirection: "column",+ gap: rowGap ?? fontSize * 0.55,+ }}+ >+ {entries.map((item, i) => {+ const beat = schedule[i];+ const boxProgress = steppedRamp(frame, beat.boxFrom, beat.boxTo, {+ ease: easeOutCubic,+ step,+ });+ const tickProgress =+ beat.tickFrom === undefined || beat.tickTo === undefined+ ? 0+ : steppedRamp(frame, beat.tickFrom, beat.tickTo, {+ ease: easeOutCubic,+ step,+ });+ const strikeProgress =+ beat.strikeFrom === undefined || beat.strikeTo === undefined+ ? 0+ : steppedRamp(frame, beat.strikeFrom, beat.strikeTo, {+ ease: easeOutCubic,+ step,+ });++ return (+ <div+ key={`${item.text}:${i}`}+ style={{+ display: "flex",+ alignItems: "center",+ gap: boxGap,+ height: rowHeight,+ }}+ >+ <svg+ width={boxSize}+ height={boxSize}+ viewBox={`0 0 ${boxSize} ${boxSize}`}+ style={{ display: "block", overflow: "visible", flexShrink: 0 }}+ >+ <path+ d={boxPath(boxSize, seed, i)}+ stroke={boxColor}+ strokeWidth={strokeWidth}+ strokeLinecap="round"+ strokeLinejoin="round"+ fill="none"+ pathLength={1}+ strokeDasharray={1}+ strokeDashoffset={1 - boxProgress}+ opacity={boxProgress > 0 ? 0.9 : 0}+ />+ {item.checked ? (+ <path+ d={tickPath(boxSize)}+ stroke={tickColor}+ strokeWidth={strokeWidth + 1}+ strokeLinecap="round"+ strokeLinejoin="round"+ fill="none"+ pathLength={1}+ strokeDasharray={1}+ strokeDashoffset={1 - tickProgress}+ opacity={tickProgress > 0 ? 1 : 0}+ />+ ) : null}+ </svg>+ <div+ style={{+ position: "relative",+ flexShrink: 0,+ width: labelWidth,+ height: rowHeight,+ }}+ >+ <Handwrite+ text={item.text}+ fontSize={fontSize}+ color={color}+ delay={beat.labelAt}+ perStep={perStep}+ weight={weight}+ align="left"+ step={step}+ />+ {item.checked ? (+ <svg+ width={labelWidth}+ height={rowHeight}+ viewBox={`0 0 ${labelWidth} ${rowHeight}`}+ style={{+ position: "absolute",+ inset: 0,+ display: "block",+ overflow: "visible",+ }}+ >+ <path+ d={strikePath(+ checkListStrikeWidth(item.text, fontSize, labelWidth),+ fontSize,+ rowHeight,+ seed,+ i,+ )}+ stroke={tickColor}+ strokeWidth={strokeWidth}+ strokeLinecap="round"+ fill="none"+ pathLength={1}+ strokeDasharray={1}+ strokeDashoffset={1 - strikeProgress}+ opacity={strikeProgress > 0 ? 0.85 : 0}+ />+ </svg>+ ) : null}+ </div>+ </div>+ );+ })}+ </div>+ );+}diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex d5c7d89a..96be4f7c 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -1373,6 +1373,21 @@}]},+ {+ "name": "check-list",+ "type": "registry:component",+ "title": "Check List",+ "description": "A handwritten checklist that writes itself out in full, then ticks and strikes through every done item, one at a time.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/stop-motion", "@remocn/handwrite"],+ "files": [+ {+ "path": "check-list/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/check-list.tsx"+ }+ ]+ },{"name": "page-turn","type": "registry:component",