Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: refactor ui docs, remove preview, render example
dev_wandrybc2317f9a194
diff --git a/components/docs/component-preview.tsx b/components/docs/component-preview.tsxindex de94a406..16313727 100644--- a/components/docs/component-preview.tsx+++ b/components/docs/component-preview.tsx@@ -1,26 +1,14 @@"use client";-import { Player } from "@remotion/player";import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";-import { CheckIcon, LinkIcon, PlayIcon, RotateCcwIcon } from "lucide-react";+import { CheckIcon, LinkIcon, RotateCcwIcon } from "lucide-react";import { Button } from "@/components/ui/button";-import {- parseAsBoolean,- parseAsFloat,- parseAsString,- parseAsStringLiteral,- useQueryStates,-} from "nuqs";+import { useQueryStates } from "nuqs";import { Suspense, useEffect, useMemo, useRef, useState } from "react";import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";import { useTrackEvent } from "@/lib/analytics";-import {- type ComponentConfig,- type ControlConfig,- getDefaults,-} from "@/lib/customizer-config";-import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";-import { cn } from "@/lib/utils";+import { type ComponentConfig, getDefaults } from "@/lib/customizer-config";+import { buildParsers, PreviewStage } from "@/lib/ui-preview-internals";import registry from "@/registry/__index__";import { ComponentCustomizer } from "./component-customizer";@@ -46,30 +34,6 @@ export function ComponentPreview({ name }: { name: string }) {);}-function buildParsers(name: string, controls: ControlConfig) {- const parsers: Record<string, any> = {};- const urlKeys: Record<string, string> = {};- const prefix = name.replace(/-/g, "_");-- for (const [key, ctrl] of Object.entries(controls)) {- urlKeys[key] = `${prefix}_${key}`;- if (ctrl.type === "text") {- parsers[key] = parseAsString.withDefault(ctrl.default);- } else if (ctrl.type === "number") {- parsers[key] = parseAsFloat.withDefault(ctrl.default);- } else if (ctrl.type === "color") {- parsers[key] = parseAsString.withDefault(ctrl.default);- } else if (ctrl.type === "select") {- parsers[key] = parseAsStringLiteral(- ctrl.options as readonly string[],- ).withDefault(ctrl.default);- } else if (ctrl.type === "boolean") {- parsers[key] = parseAsBoolean.withDefault(ctrl.default);- }- }- return { parsers, urlKeys };-}-function Preview({name,config,@@ -156,7 +120,10 @@ function Preview({name={name}Component={Component}inputProps={values}- config={config}+ durationInFrames={config.durationInFrames}+ fps={config.fps}+ compositionWidth={config.compositionWidth}+ compositionHeight={config.compositionHeight}/></TabsContent>@@ -208,94 +175,6 @@ function Preview({);}-/**- * D2 — lazy-mount the Remotion player. Until the stage enters the viewport- * (IntersectionObserver) or the user clicks the poster, render a labeled- * poster button that exactly matches the Suspense fallback dimensions, so the- * live Player swaps in with zero layout shift.- */-function PreviewStage({- name,- Component,- inputProps,- config,-}: {- name: string;- Component: React.ComponentType<any>;- inputProps: Record<string, unknown>;- config: ComponentConfig;-}) {- const [mounted, setMounted] = useState(false);- const frameRef = useRef<HTMLDivElement>(null);- const reducedMotion = usePrefersReducedMotion();-- useEffect(() => {- if (mounted) return;- const el = frameRef.current;- if (!el || typeof IntersectionObserver === "undefined") return;- const observer = new IntersectionObserver(- (entries) => {- if (entries.some((entry) => entry.isIntersecting)) {- setMounted(true);- observer.disconnect();- }- },- { rootMargin: "200px 0px" },- );- observer.observe(el);- return () => observer.disconnect();- }, [mounted]);-- return (- <div- ref={frameRef}- // Slightly shorter than 16:9 so the player takes a touch less vertical- // space. Compositions are a strict 1280×720 (16:9), so the Player letterboxes- // the small delta against the surface-card background while staying full-width- // and aligned with the tabs/customize panel. The Suspense fallback above uses- // the same ratio to keep zero layout shift.- className="surface-card aspect-video w-full overflow-hidden rounded-2xl"- >- {mounted ? (- <div- className={cn(- "size-full",- !reducedMotion && "animate-in fade-in duration-300 ease-out",- )}- >- <Player- component={Component}- inputProps={inputProps}- durationInFrames={config.durationInFrames}- fps={config.fps}- compositionWidth={config.compositionWidth}- compositionHeight={config.compositionHeight}- style={{ width: "100%", height: "100%" }}- controls- loop- autoPlay- acknowledgeRemotionLicense- />- </div>- ) : (- <button- type="button"- onClick={() => setMounted(true)}- aria-label={`Play preview of ${name}`}- className={cn(- "group flex size-full items-center justify-center bg-muted/40 transition-colors",- "hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",- )}- >- <span className="flex size-12 items-center justify-center rounded-full bg-background/80 text-foreground transition-colors group-hover:bg-background">- <PlayIcon className="size-5 translate-x-px fill-current" />- </span>- </button>- )}- </div>- );-}-function generateCode(config: ComponentConfig, props: Record<string, unknown>) {if (config.snippet) return config.snippet(props);const propsString = Object.entries(props)diff --git a/components/docs/examples/accordion-example.tsx b/components/docs/examples/accordion-example.tsxindex 98520f7f..349ef4ba 100644--- a/components/docs/examples/accordion-example.tsx+++ b/components/docs/examples/accordion-example.tsx@@ -3,21 +3,55 @@import { Accordion } from "@/registry/remocn-ui/accordion";import { useAccordionTransition } from "@/registry/remocn-ui/accordion/use-accordion-transition";-export const AccordionExampleScene = () => {+export const accordionExampleControls = [+ "title", "content", "variant", "mode",+] as const;++export interface AccordionExampleProps {+ title?: string;+ content?: string;+ variant?: "default" | "ghost";+ mode?: "light" | "dark";+}++export const AccordionExampleScene = (p: AccordionExampleProps = {}) => {const style = useAccordionTransition([{ at: 18, state: "opened", duration: 16 },{ at: 78, state: "closed", duration: 12 },]);return (<Accordion- title="Is it accessible?"- content="Yes. It adheres to the WAI-ARIA design pattern."+ title={p.title ?? "Is it accessible?"}+ content={p.content ?? "Yes. It adheres to the WAI-ARIA design pattern."}+ variant={p.variant ?? "default"}+ mode={p.mode ?? "light"}style={style}/>);};-export const accordionExampleCode = `import { Accordion } from "@/components/remocn/accordion";+export const accordionExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const content = values.content as string | undefined;+ const variant = values.variant as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (title !== undefined && title !== "Is it accessible?")+ props.push(`title="${title}"`);+ if (+ content !== undefined &&+ content !== "Yes. It adheres to the WAI-ARIA design pattern."+ )+ props.push(`content="${content}"`);+ if (variant !== undefined && variant !== "default")+ props.push(`variant="${variant}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? `\n ${props.join("\n ")}\n ` : "";+ return `import { Accordion } from "@/components/remocn/accordion";import { useAccordionTransition } from "@/components/remocn/use-accordion-transition";export const Scene = () => {@@ -27,10 +61,7 @@ export const Scene = () => {]);return (- <Accordion- title="Is it accessible?"- content="Yes. It adheres to the WAI-ARIA design pattern."- style={style}- />+ <Accordion${propsStr === "" ? " " : propsStr}style={style} />);};`;+};diff --git a/components/docs/examples/alert-dialog-example.tsx b/components/docs/examples/alert-dialog-example.tsxindex c133ecd7..ced20cf9 100644--- a/components/docs/examples/alert-dialog-example.tsx+++ b/components/docs/examples/alert-dialog-example.tsx@@ -5,7 +5,19 @@ import { useAlertDialogTransition } from "@/registry/remocn-ui/alert-dialog/use-import { Button } from "@/registry/remocn-ui/button";import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";-export const AlertDialogExampleScene = () => {+export const alertDialogExampleControls = [+ "title", "description", "actionLabel", "cancelLabel", "mode",+] as const;++export interface AlertDialogExampleProps {+ title?: string;+ description?: string;+ actionLabel?: string;+ cancelLabel?: string;+ mode?: "light" | "dark";+}++export const AlertDialogExampleScene = (p: AlertDialogExampleProps = {}) => {// The trigger Button: idle → hover → press, the press lands just before the// dialog opens (the "click" that triggers it).const trigger = useButtonTransition(@@ -22,13 +34,39 @@ export const AlertDialogExampleScene = () => {]);return (<>- <Button label="Delete account" variant="destructive" style={trigger} />- <AlertDialog style={dialog} />+ <Button label="Delete account" variant="destructive" mode={p.mode ?? "light"} style={trigger} />+ <AlertDialog+ title={p.title ?? "Delete account?"}+ description={p.description ?? "This action cannot be undone. This will permanently remove your data from our servers."}+ actionLabel={p.actionLabel ?? "Delete"}+ cancelLabel={p.cancelLabel ?? "Cancel"}+ mode={p.mode ?? "light"}+ style={dialog}+ /></>);};-export const alertDialogExampleCode = `import { AlertDialog } from "@/components/remocn/alert-dialog";+export const alertDialogExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const description = values.description as string | undefined;+ const actionLabel = values.actionLabel as string | undefined;+ const cancelLabel = values.cancelLabel as string | undefined;+ const mode = values.mode as string | undefined;++ const alertDialogProps: string[] = [];+ if (title !== undefined && title !== "Delete account?") alertDialogProps.push(`title="${title}"`);+ if (description !== undefined && description !== "This action cannot be undone. This will permanently remove your data from our servers.") alertDialogProps.push(`description="${description}"`);+ if (actionLabel !== undefined && actionLabel !== "Delete") alertDialogProps.push(`actionLabel="${actionLabel}"`);+ if (cancelLabel !== undefined && cancelLabel !== "Cancel") alertDialogProps.push(`cancelLabel="${cancelLabel}"`);+ if (mode !== undefined && mode !== "light") alertDialogProps.push(`mode="${mode}"`);++ const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ const alertDialogPropsStr = alertDialogProps.length ? ` ${alertDialogProps.join(" ")}` : "";++ return `import { AlertDialog } from "@/components/remocn/alert-dialog";import { useAlertDialogTransition } from "@/components/remocn/use-alert-dialog-transition";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -48,8 +86,9 @@ export const Scene = () => {return (<>- <Button label="Delete account" variant="destructive" style={trigger} />- <AlertDialog style={dialog} />+ <Button label="Delete account" variant="destructive"${buttonModeStr} style={trigger} />+ <AlertDialog${alertDialogPropsStr} style={dialog} /></>);};`;+};diff --git a/components/docs/examples/button-example.tsx b/components/docs/examples/button-example.tsxindex 4eb4428e..dbaf2cd5 100644--- a/components/docs/examples/button-example.tsx+++ b/components/docs/examples/button-example.tsx@@ -3,17 +3,78 @@import { Button } from "@/registry/remocn-ui/button";import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";-export const ButtonExampleScene = () => {+/**+ * Honored display props the scene threads straight into `<Button>`. The button's+ * full flat-prop surface is label/variant/size/state/mode/primary; `state` is+ * owned by the timeline (`useButtonTransition` → `style`, which takes precedence+ * over `state`) so it is EXCLUDED, and the shared `speed` knob is excluded too.+ * This list IS the per-component honored allowlist consumed by UiComponentPreview.+ */+export const buttonExampleControls = [+ "label",+ "variant",+ "size",+ "primary",+ "mode",+] as const;++export interface ButtonExampleProps {+ label?: string;+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost";+ size?: "sm" | "default" | "lg";+ primary?: string;+ mode?: "light" | "dark";+}++export const ButtonExampleScene = (p: ButtonExampleProps = {}) => {+ // Timeline owns `state` via the interpolated style — never a flat prop.const style = useButtonTransition([{ at: 12, state: "hover" },{ at: 30, state: "press" },{ at: 48, state: "loading", duration: 6 },{ at: 96, state: "success", duration: 16 },]);- return <Button label="Continue" style={style} />;+ return (+ <Button+ label={p.label ?? "Continue"}+ variant={p.variant ?? "default"}+ size={p.size ?? "default"}+ primary={p.primary}+ mode={p.mode ?? "light"}+ style={style}+ />+ );};-export const buttonExampleCode = `import { Button } from "@/components/remocn/button";+/**+ * Code template for the Code tab. Emits the same `useButtonTransition([...])`+ * timeline form the scene runs, interpolating ONLY honored props and ONLY when+ * a value differs from its control default — never a prop the component ignores.+ */+export const buttonExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const variant = values.variant as string | undefined;+ const size = values.size as string | undefined;+ const mode = values.mode as string | undefined;+ const primary = values.primary as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Continue")+ props.push(`label="${label}"`);+ if (variant !== undefined && variant !== "default")+ props.push(`variant="${variant}"`);+ if (size !== undefined && size !== "default") props.push(`size="${size}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ if (primary !== undefined && primary !== "#171717")+ props.push(`primary="${primary}"`);++ // Default scene renders `<Button label="Continue" style={style} />`; honored+ // overrides are appended before `style` so the timeline prop stays last.+ const propsStr = props.length ? `${props.join(" ")} ` : "";++ return `import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";export const Scene = () => {@@ -24,5 +85,6 @@ export const Scene = () => {{ at: 96, state: "success", duration: 16 },]);- return <Button label="Continue" style={style} />;+ return <Button ${propsStr}style={style} />;};`;+};diff --git a/components/docs/examples/checkbox-example.tsx b/components/docs/examples/checkbox-example.tsxindex 9389c3e3..9cfc19e0 100644--- a/components/docs/examples/checkbox-example.tsx+++ b/components/docs/examples/checkbox-example.tsx@@ -3,15 +3,48 @@import { Checkbox } from "@/registry/remocn-ui/checkbox";import { useCheckboxTransition } from "@/registry/remocn-ui/checkbox/use-checkbox-transition";-export const CheckboxExampleScene = () => {+export const checkboxExampleControls = ["label", "size", "primary", "mode"] as const;++export interface CheckboxExampleProps {+ label?: string;+ size?: "sm" | "default" | "lg";+ primary?: string;+ mode?: "light" | "dark";+}++export const CheckboxExampleScene = (p: CheckboxExampleProps = {}) => {const style = useCheckboxTransition([{ at: 18, state: "checked", duration: 14 },{ at: 78, state: "unchecked", duration: 12 },]);- return <Checkbox label="Accept terms and conditions" style={style} />;+ return (+ <Checkbox+ label={p.label ?? "Accept terms and conditions"}+ size={p.size ?? "default"}+ primary={p.primary}+ mode={p.mode ?? "light"}+ style={style}+ />+ );};-export const checkboxExampleCode = `import { Checkbox } from "@/components/remocn/checkbox";+export const checkboxExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const size = values.size as string | undefined;+ const primary = values.primary as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Accept terms and conditions")+ props.push(`label="${label}"`);+ if (size !== undefined && size !== "default") props.push(`size="${size}"`);+ if (primary !== undefined) props.push(`primary="${primary}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? ` ${props.join(" ")}` : "";+ return `import { Checkbox } from "@/components/remocn/checkbox";import { useCheckboxTransition } from "@/components/remocn/use-checkbox-transition";export const Scene = () => {@@ -20,5 +53,6 @@ export const Scene = () => {{ at: 78, state: "unchecked", duration: 12 },]);- return <Checkbox label="Accept terms and conditions" style={style} />;+ return <Checkbox${propsStr} style={style} />;};`;+};diff --git a/components/docs/examples/combobox-example.tsx b/components/docs/examples/combobox-example.tsxindex 8cc769ed..25134d81 100644--- a/components/docs/examples/combobox-example.tsx+++ b/components/docs/examples/combobox-example.tsx@@ -12,7 +12,14 @@ const TYPE_START = 32;const FPS = 30;const CPS = 4;-export const ComboboxExampleScene = () => {+export const comboboxExampleControls = ["placeholder", "mode"] as const;++export interface ComboboxExampleProps {+ placeholder?: string;+ mode?: "light" | "dark";+}++export const ComboboxExampleScene = (p: ComboboxExampleProps = {}) => {const frame = useCurrentFrame();// Panel: opens at frame 16, closes at frame 100.@@ -44,12 +51,26 @@ export const ComboboxExampleScene = () => {query={QUERY}revealCount={revealed}itemStyles={[itemStyle]}+ placeholder={p.placeholder ?? "Select a fruit…"}+ mode={p.mode ?? "light"}/></div>);};-export const comboboxExampleCode = `import { useCurrentFrame } from "remotion";+export const comboboxExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const placeholder = values.placeholder as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (placeholder !== undefined && placeholder !== "Select a fruit…")+ props.push(`placeholder="${placeholder}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";++ return `import { useCurrentFrame } from "remotion";import { revealCount } from "@/lib/remocn-ui";import { Combobox } from "@/components/remocn/combobox";import { useComboboxTransition } from "@/components/remocn/use-combobox-transition";@@ -87,7 +108,7 @@ export const Scene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <Combobox+ <Combobox${extraProps}style={panelStyle}query={QUERY}revealCount={revealed}@@ -96,3 +117,4 @@ export const Scene = () => {</div>);};`;+};diff --git a/components/docs/examples/command-menu-example.tsx b/components/docs/examples/command-menu-example.tsxindex 839192b2..cc662382 100644--- a/components/docs/examples/command-menu-example.tsx+++ b/components/docs/examples/command-menu-example.tsx@@ -13,7 +13,13 @@ const TYPE_START = 20;const FPS = 30;const CPS = 4;-export const CommandMenuExampleScene = () => {+export const commandMenuExampleControls = ["mode"] as const;++export interface CommandMenuExampleProps {+ mode?: "light" | "dark";+}++export const CommandMenuExampleScene = (p: CommandMenuExampleProps = {}) => {const frame = useCurrentFrame();// Panel: closed → opened at frame 16, then closed again at frame 108.@@ -45,12 +51,22 @@ export const CommandMenuExampleScene = () => {query={QUERY}revealCount={revealed}itemStyles={[itemStyle]}+ mode={p.mode ?? "light"}/></div>);};-export const commandMenuExampleCode = `import { useCurrentFrame } from "remotion";+export const commandMenuExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";++ return `import { useCurrentFrame } from "remotion";import { revealCount } from "@/lib/remocn-ui";import { CommandMenu } from "@/components/remocn/command-menu";import { useCommandMenuTransition } from "@/components/remocn/use-command-menu-transition";@@ -88,7 +104,7 @@ export const Scene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <CommandMenu+ <CommandMenu${extraProps}style={panelStyle}query={QUERY}revealCount={revealed}@@ -97,3 +113,4 @@ export const Scene = () => {</div>);};`;+};diff --git a/components/docs/examples/context-menu-example.tsx b/components/docs/examples/context-menu-example.tsxindex 0b441205..6b98ff1e 100644--- a/components/docs/examples/context-menu-example.tsx+++ b/components/docs/examples/context-menu-example.tsx@@ -16,7 +16,14 @@ const CLICK_Y = 385;const ROW1_X = CLICK_X + 70;const ROW1_Y = CLICK_Y + 60;-export const ContextMenuExampleScene = () => {+export interface ContextMenuExampleProps {+ items?: string[];+ mode?: "light" | "dark";+}++export const contextMenuExampleControls = ["items", "mode"] as const;++export const ContextMenuExampleScene = (p: ContextMenuExampleProps = {}) => {// Cursor: park → ease to card → right-click → move DOWN onto row 1 → click it → leave.const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },@@ -44,6 +51,8 @@ export const ContextMenuExampleScene = () => {);const rowStyle = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);+ const items = p.items ?? ["Back", "Reload", "Save As…", "Inspect"];+return (<div style={{ position: "relative", width: "100%", height: "100%" }}>{/* File card — the target the cursor right-clicks on. */}@@ -89,16 +98,30 @@ export const ContextMenuExampleScene = () => {><ContextMenustyle={menuStyle}+ items={items}itemStyles={[undefined, rowStyle, undefined, undefined]}+ mode={p.mode ?? "light"}/></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} /></div>);};-export const contextMenuExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const contextMenuExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const items = values.items as string[] | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (items !== undefined) props.push(`items={${JSON.stringify(items)}}`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";+ const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { ContextMenu } from "@/components/remocn/context-menu";import { useContextMenuTransition } from "@/components/remocn/use-context-menu-transition";@@ -161,13 +184,14 @@ export const Scene = () => {{/* Context menu positioned at the click point — caller owns placement. */}<div style={{ position: "absolute", left: CLICK_X, top: CLICK_Y }}>- <ContextMenu+ <ContextMenu${extraProps}style={menuStyle}itemStyles={[undefined, rowStyle, undefined, undefined]}/></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer"${modeStr} /></div>);};`;+};diff --git a/components/docs/examples/cursor-example.tsx b/components/docs/examples/cursor-example.tsxindex 7dbe6598..75ee93ec 100644--- a/components/docs/examples/cursor-example.tsx+++ b/components/docs/examples/cursor-example.tsx@@ -8,7 +8,13 @@ import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-tranconst BTN_X = 620; // cursor tip target X (the pointer hotspot lands here)const BTN_Y = 360; // cursor tip target Y-export const CursorExampleScene = () => {+export interface CursorExampleProps {+ mode?: "light" | "dark";+}++export const cursorExampleControls = ["mode"] as const;++export const CursorExampleScene = (p: CursorExampleProps = {}) => {const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },{ at: 40, x: BTN_X, y: BTN_Y, duration: 28 },@@ -32,14 +38,21 @@ export const CursorExampleScene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Continue" style={buttonStyle} />+ <Button label="Continue" style={buttonStyle} mode={p.mode ?? "light"} /></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} /></div>);};-export const cursorExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const cursorExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const mode = values.mode as string | undefined;++ const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -74,9 +87,10 @@ export const Scene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Continue" style={buttonStyle} />+ <Button label="Continue" style={buttonStyle}${modeStr} /></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer"${modeStr} /></div>);};`;+};diff --git a/components/docs/examples/dialog-example.tsx b/components/docs/examples/dialog-example.tsxindex 8ebd55cd..c648db2c 100644--- a/components/docs/examples/dialog-example.tsx+++ b/components/docs/examples/dialog-example.tsx@@ -5,7 +5,19 @@ import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-tranimport { Dialog } from "@/registry/remocn-ui/dialog";import { useDialogTransition } from "@/registry/remocn-ui/dialog/use-dialog-transition";-export const DialogExampleScene = () => {+export const dialogExampleControls = [+ "title", "description", "actionLabel", "cancelLabel", "mode",+] as const;++export interface DialogExampleProps {+ title?: string;+ description?: string;+ actionLabel?: string;+ cancelLabel?: string;+ mode?: "light" | "dark";+}++export const DialogExampleScene = (p: DialogExampleProps = {}) => {// The trigger Button: idle → hover → press, the press lands just before the// dialog opens (the "click" that triggers it).const trigger = useButtonTransition([@@ -19,13 +31,39 @@ export const DialogExampleScene = () => {]);return (<>- <Button label="Edit profile" style={trigger} />- <Dialog style={dialog} />+ <Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />+ <Dialog+ title={p.title ?? "Edit profile"}+ description={p.description ?? "Make changes to your profile here. Click save when you're done."}+ actionLabel={p.actionLabel ?? "Save changes"}+ cancelLabel={p.cancelLabel ?? "Cancel"}+ mode={p.mode ?? "light"}+ style={dialog}+ /></>);};-export const dialogExampleCode = `import { Dialog } from "@/components/remocn/dialog";+export const dialogExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const description = values.description as string | undefined;+ const actionLabel = values.actionLabel as string | undefined;+ const cancelLabel = values.cancelLabel as string | undefined;+ const mode = values.mode as string | undefined;++ const dialogProps: string[] = [];+ if (title !== undefined && title !== "Edit profile") dialogProps.push(`title="${title}"`);+ if (description !== undefined && description !== "Make changes to your profile here. Click save when you're done.") dialogProps.push(`description="${description}"`);+ if (actionLabel !== undefined && actionLabel !== "Save changes") dialogProps.push(`actionLabel="${actionLabel}"`);+ if (cancelLabel !== undefined && cancelLabel !== "Cancel") dialogProps.push(`cancelLabel="${cancelLabel}"`);+ if (mode !== undefined && mode !== "light") dialogProps.push(`mode="${mode}"`);++ const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ const dialogPropsStr = dialogProps.length ? ` ${dialogProps.join(" ")}` : "";++ return `import { Dialog } from "@/components/remocn/dialog";import { useDialogTransition } from "@/components/remocn/use-dialog-transition";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -42,8 +80,9 @@ export const Scene = () => {return (<>- <Button label="Edit profile" style={trigger} />- <Dialog style={dialog} />+ <Button label="Edit profile"${buttonModeStr} style={trigger} />+ <Dialog${dialogPropsStr} style={dialog} /></>);};`;+};diff --git a/components/docs/examples/drawer-example.tsx b/components/docs/examples/drawer-example.tsxindex 59f9f863..ac130fe1 100644--- a/components/docs/examples/drawer-example.tsx+++ b/components/docs/examples/drawer-example.tsx@@ -5,7 +5,19 @@ import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-tranimport { Drawer } from "@/registry/remocn-ui/drawer";import { useDrawerTransition } from "@/registry/remocn-ui/drawer/use-drawer-transition";-export const DrawerExampleScene = () => {+export const drawerExampleControls = [+ "title", "description", "actionLabel", "cancelLabel", "mode",+] as const;++export interface DrawerExampleProps {+ title?: string;+ description?: string;+ actionLabel?: string;+ cancelLabel?: string;+ mode?: "light" | "dark";+}++export const DrawerExampleScene = (p: DrawerExampleProps = {}) => {// The trigger Button: idle → hover → press, the press lands just before the// drawer opens (the "click" that triggers it).const trigger = useButtonTransition([@@ -19,13 +31,39 @@ export const DrawerExampleScene = () => {]);return (<>- <Button label="Edit profile" style={trigger} />- <Drawer style={drawer} />+ <Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />+ <Drawer+ title={p.title ?? "Edit profile"}+ description={p.description ?? "Make changes to your profile here. Click save when you're done."}+ actionLabel={p.actionLabel ?? "Save changes"}+ cancelLabel={p.cancelLabel ?? "Cancel"}+ mode={p.mode ?? "light"}+ style={drawer}+ /></>);};-export const drawerExampleCode = `import { Drawer } from "@/components/remocn/drawer";+export const drawerExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const description = values.description as string | undefined;+ const actionLabel = values.actionLabel as string | undefined;+ const cancelLabel = values.cancelLabel as string | undefined;+ const mode = values.mode as string | undefined;++ const drawerProps: string[] = [];+ if (title !== undefined && title !== "Edit profile") drawerProps.push(`title="${title}"`);+ if (description !== undefined && description !== "Make changes to your profile here. Click save when you're done.") drawerProps.push(`description="${description}"`);+ if (actionLabel !== undefined && actionLabel !== "Save changes") drawerProps.push(`actionLabel="${actionLabel}"`);+ if (cancelLabel !== undefined && cancelLabel !== "Cancel") drawerProps.push(`cancelLabel="${cancelLabel}"`);+ if (mode !== undefined && mode !== "light") drawerProps.push(`mode="${mode}"`);++ const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ const drawerPropsStr = drawerProps.length ? ` ${drawerProps.join(" ")}` : "";++ return `import { Drawer } from "@/components/remocn/drawer";import { useDrawerTransition } from "@/components/remocn/use-drawer-transition";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -42,8 +80,9 @@ export const Scene = () => {return (<>- <Button label="Edit profile" style={trigger} />- <Drawer style={drawer} />+ <Button label="Edit profile"${buttonModeStr} style={trigger} />+ <Drawer${drawerPropsStr} style={drawer} /></>);};`;+};diff --git a/components/docs/examples/dropdown-menu-example.tsx b/components/docs/examples/dropdown-menu-example.tsxindex e76f03d9..f79ce8a7 100644--- a/components/docs/examples/dropdown-menu-example.tsx+++ b/components/docs/examples/dropdown-menu-example.tsx@@ -6,7 +6,14 @@ import { useDropdownMenuItemTransition } from "@/registry/remocn-ui/dropdown-menimport { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";import { useCurrentState } from "@/lib/remocn-ui";-export const DropdownMenuExampleScene = () => {+export const dropdownMenuExampleControls = ["label", "mode"] as const;++export interface DropdownMenuExampleProps {+ label?: string;+ mode?: "light" | "dark";+}++export const DropdownMenuExampleScene = (p: DropdownMenuExampleProps = {}) => {// The trigger: idle → hover → press, the press lands just before the menu// opens (the "click" that triggers it).const triggerStyle = useButtonTransition(@@ -35,13 +42,26 @@ export const DropdownMenuExampleScene = () => {return (<DropdownMenustyle={menu}+ label={p.label ?? "Options"}triggerStyle={triggerStyle}itemStyles={[undefined, row, undefined, undefined]}+ mode={p.mode ?? "light"}/>);};-export const dropdownMenuExampleCode = `import { DropdownMenu } from "@/components/remocn/dropdown-menu";+export const dropdownMenuExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Options") props.push(`label="${label}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";++ return `import { DropdownMenu } from "@/components/remocn/dropdown-menu";import { useDropdownMenuTransition } from "@/components/remocn/use-dropdown-menu-transition";import { useDropdownMenuItemTransition } from "@/components/remocn/use-dropdown-menu-item-transition";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -70,10 +90,11 @@ export const Scene = () => {const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);return (- <DropdownMenu+ <DropdownMenu${extraProps}style={menu}triggerStyle={triggerStyle}itemStyles={[undefined, row, undefined, undefined]}/>);};`;+};diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsxindex 9cbe1c8c..ff180e80 100644--- a/components/docs/examples/index.tsx+++ b/components/docs/examples/index.tsx@@ -71,7 +71,14 @@ import {export interface ExampleEntry {Component: ComponentType;- code: string;+ /**+ * Vestigial after the LiveExample → UiComponentPreview migration. The Code tab+ * now sources its template from `UI_SCENE_META[name].code` (the scene's own+ * `…ExampleCode` function), so nothing reads this field anymore — it is kept+ * only to avoid churn across all 26 entries. Safe to drop in a later cleanup.+ * Migrated entries hold a function template; any legacy entry holds a string.+ */+ code: string | ((values: Record<string, unknown>) => string);durationInFrames: number;fps: number;width: number;diff --git a/components/docs/examples/input-example.tsx b/components/docs/examples/input-example.tsxindex f86b0124..9dac8d4a 100644--- a/components/docs/examples/input-example.tsx+++ b/components/docs/examples/input-example.tsx@@ -3,7 +3,19 @@import { Input } from "@/registry/remocn-ui/input";import { useInputTransition } from "@/registry/remocn-ui/input/use-input-transition";-export const InputExampleScene = () => {+export const inputExampleControls = [+ "placeholder", "value", "size", "primary", "mode",+] as const;++export interface InputExampleProps {+ placeholder?: string;+ value?: string;+ size?: "sm" | "default" | "lg";+ primary?: string;+ mode?: "light" | "dark";+}++export const InputExampleScene = (p: InputExampleProps = {}) => {const style = useInputTransition([{ at: 10, state: "hover", duration: 8 },{ at: 24, state: "active", duration: 10 },@@ -12,14 +24,36 @@ export const InputExampleScene = () => {]);return (<Input- placeholder="[email protected]"- value="[email protected]"+ placeholder={p.placeholder ?? "[email protected]"}+ value={p.value ?? "[email protected]"}+ size={p.size ?? "default"}+ primary={p.primary}+ mode={p.mode ?? "light"}style={style}/>);};-export const inputExampleCode = `import { Input } from "@/components/remocn/input";+export const inputExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const placeholder = values.placeholder as string | undefined;+ const value = values.value as string | undefined;+ const size = values.size as string | undefined;+ const primary = values.primary as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (placeholder !== undefined && placeholder !== "[email protected]")+ props.push(`placeholder="${placeholder}"`);+ if (value !== undefined && value !== "[email protected]")+ props.push(`value="${value}"`);+ if (size !== undefined && size !== "default") props.push(`size="${size}"`);+ if (primary !== undefined) props.push(`primary="${primary}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? `\n ${props.join("\n ")}\n ` : "";+ return `import { Input } from "@/components/remocn/input";import { useInputTransition } from "@/components/remocn/use-input-transition";export const Scene = () => {@@ -31,10 +65,7 @@ export const Scene = () => {]);return (- <Input- placeholder="[email protected]"- value="[email protected]"- style={style}- />+ <Input${propsStr === "" ? " " : propsStr}style={style} />);};`;+};diff --git a/components/docs/examples/popover-example.tsx b/components/docs/examples/popover-example.tsxindex b21e6463..b11e13db 100644--- a/components/docs/examples/popover-example.tsx+++ b/components/docs/examples/popover-example.tsx@@ -9,7 +9,15 @@ import { usePopoverTransition } from "@/registry/remocn-ui/popover/use-popover-tconst CHIP_X = 640;const CHIP_Y = 360;-export const PopoverExampleScene = () => {+export const popoverExampleControls = [+ "mode",+] as const;++export interface PopoverExampleProps {+ mode?: "light" | "dark";+}++export const PopoverExampleScene = (p: PopoverExampleProps = {}) => {// Cursor: park top-left → ease onto the chip → hover → leave.const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },@@ -68,6 +76,7 @@ export const PopoverExampleScene = () => {style={popoverStyle}side="top"width={240}+ mode={p.mode ?? "light"}>{/* Hover-card content: avatar + name + bio */}<div style={{ display: "flex", gap: 12, alignItems: "flex-start" }}>@@ -123,7 +132,15 @@ export const PopoverExampleScene = () => {);};-export const popoverExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const popoverExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const mode = values.mode as string | undefined;++ const modeStr =+ mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Popover } from "@/components/remocn/popover";import { usePopoverTransition } from "@/components/remocn/use-popover-transition";@@ -181,7 +198,7 @@ export const Scene = () => {transform: "translateX(-50%)",}}>- <Popover style={popoverStyle} side="top" width={240}>+ <Popover style={popoverStyle} side="top" width={240}${modeStr}><div style={{ display: "flex", gap: 12, alignItems: "flex-start" }}><divstyle={{@@ -208,3 +225,4 @@ export const Scene = () => {</div>);};`;+};diff --git a/components/docs/examples/progress-example.tsx b/components/docs/examples/progress-example.tsxindex 9deee2a5..e6373ce5 100644--- a/components/docs/examples/progress-example.tsx+++ b/components/docs/examples/progress-example.tsx@@ -3,7 +3,14 @@import { Progress } from "@/registry/remocn-ui/progress";import { useProgressTransition } from "@/registry/remocn-ui/progress/use-progress-transition";-export const ProgressExampleScene = () => {+export const progressExampleControls = ["showLabel", "mode"] as const;++export interface ProgressExampleProps {+ showLabel?: boolean;+ mode?: "light" | "dark";+}++export const ProgressExampleScene = (p: ProgressExampleProps = {}) => {// Bar fills from 0 → 62 (arrives at frame 40), stalls for ~60 frames as if// waiting on a slow operation, then resumes to 100 (arrives at frame 130).const progressStyle = useProgressTransition([@@ -22,12 +29,24 @@ export const ProgressExampleScene = () => {justifyContent: "center",}}>- <Progress style={progressStyle} showLabel width={320} />+ <Progress style={progressStyle} showLabel={p.showLabel ?? true} width={320} mode={p.mode ?? "light"} /></div>);};-export const progressExampleCode = `import { Progress } from "@/components/remocn/progress";+export const progressExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const showLabel = values.showLabel as boolean | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (showLabel !== undefined && showLabel !== true)+ props.push(`showLabel={${showLabel}}`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? ` ${props.join(" ")}` : "";+ return `import { Progress } from "@/components/remocn/progress";import { useProgressTransition } from "@/components/remocn/use-progress-transition";export const Scene = () => {@@ -49,7 +68,8 @@ export const Scene = () => {justifyContent: "center",}}>- <Progress style={progressStyle} showLabel width={320} />+ <Progress style={progressStyle} width={320}${propsStr} /></div>);};`;+};diff --git a/components/docs/examples/radio-example.tsx b/components/docs/examples/radio-example.tsxindex 59c2e3a5..9952ac58 100644--- a/components/docs/examples/radio-example.tsx+++ b/components/docs/examples/radio-example.tsx@@ -3,15 +3,48 @@import { Radio } from "@/registry/remocn-ui/radio";import { useRadioTransition } from "@/registry/remocn-ui/radio/use-radio-transition";-export const RadioExampleScene = () => {+export const radioExampleControls = ["label", "size", "primary", "mode"] as const;++export interface RadioExampleProps {+ label?: string;+ size?: "sm" | "default" | "lg";+ primary?: string;+ mode?: "light" | "dark";+}++export const RadioExampleScene = (p: RadioExampleProps = {}) => {const style = useRadioTransition([{ at: 18, state: "checked", duration: 14 },{ at: 78, state: "unchecked", duration: 12 },]);- return <Radio label="Subscribe to updates" style={style} />;+ return (+ <Radio+ label={p.label ?? "Subscribe to updates"}+ size={p.size ?? "default"}+ primary={p.primary}+ mode={p.mode ?? "light"}+ style={style}+ />+ );};-export const radioExampleCode = `import { Radio } from "@/components/remocn/radio";+export const radioExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const size = values.size as string | undefined;+ const primary = values.primary as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Subscribe to updates")+ props.push(`label="${label}"`);+ if (size !== undefined && size !== "default") props.push(`size="${size}"`);+ if (primary !== undefined) props.push(`primary="${primary}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? ` ${props.join(" ")}` : "";+ return `import { Radio } from "@/components/remocn/radio";import { useRadioTransition } from "@/components/remocn/use-radio-transition";export const Scene = () => {@@ -20,5 +53,6 @@ export const Scene = () => {{ at: 78, state: "unchecked", duration: 12 },]);- return <Radio label="Subscribe to updates" style={style} />;+ return <Radio${propsStr} style={style} />;};`;+};diff --git a/components/docs/examples/resizable-example.tsx b/components/docs/examples/resizable-example.tsxindex af370c76..9deb97a7 100644--- a/components/docs/examples/resizable-example.tsx+++ b/components/docs/examples/resizable-example.tsx@@ -4,13 +4,21 @@ import { Cursor } from "@/registry/remocn-ui/cursor";import { useCursorPath } from "@/registry/remocn-ui/cursor/use-cursor-path";import { Resizable } from "@/registry/remocn-ui/resizable";import { useResizableTransition } from "@/registry/remocn-ui/resizable/use-resizable-transition";+import type { ResizableDirection } from "@/registry/remocn-ui/resizable";const X_CENTER = 640;const X_RIGHT = 750;const X_LEFT = 530;const HANDLE_Y = 360;-export const ResizableExampleScene = () => {+export interface ResizableExampleProps {+ direction?: ResizableDirection;+ mode?: "light" | "dark";+}++export const resizableExampleControls = ["direction", "mode"] as const;++export const ResizableExampleScene = (p: ResizableExampleProps = {}) => {const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },{ at: 32, x: X_CENTER, y: HANDLE_Y, duration: 28 },@@ -34,13 +42,29 @@ export const ResizableExampleScene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <Resizable style={resizableStyle} />- <Cursor style={cursorStyle} variant="pointer" />+ <Resizable+ style={resizableStyle}+ direction={p.direction ?? "horizontal"}+ mode={p.mode ?? "light"}+ />+ <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} /></div>);};-export const resizableExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const resizableExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const direction = values.direction as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (direction !== undefined && direction !== "horizontal") props.push(`direction="${direction}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const resizableExtraProps = props.length ? `\n ${props.join("\n ")}\n ` : "";+ const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Resizable } from "@/components/remocn/resizable";import { useResizableTransition } from "@/components/remocn/use-resizable-transition";@@ -62,7 +86,6 @@ export const Scene = () => {{ at: 184, x: X_CENTER, y: HANDLE_Y, duration: 0 },]);-const resizableStyle = useResizableTransition([{ at: 0, ratio: 0.5, handleState: "idle" },{ at: 32, handleState: "hover", duration: 8 },@@ -76,8 +99,9 @@ export const Scene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <Resizable style={resizableStyle} />- <Cursor style={cursorStyle} variant="pointer" />+ <Resizable${resizableExtraProps}style={resizableStyle} />+ <Cursor style={cursorStyle} variant="pointer"${modeStr} /></div>);};`;+};diff --git a/components/docs/examples/select-example.tsx b/components/docs/examples/select-example.tsxindex 8a19b89d..3ea85ffc 100644--- a/components/docs/examples/select-example.tsx+++ b/components/docs/examples/select-example.tsx@@ -5,7 +5,14 @@ import { Select } from "@/registry/remocn-ui/select";import { useSelectTransition } from "@/registry/remocn-ui/select/use-select-transition";import { useSelectItemTransition } from "@/registry/remocn-ui/select-item/use-select-item-transition";-export const SelectExampleScene = () => {+export const selectExampleControls = ["label", "mode"] as const;++export interface SelectExampleProps {+ label?: string;+ mode?: "light" | "dark";+}++export const SelectExampleScene = (p: SelectExampleProps = {}) => {// The trigger: idle → hover → press, the press lands just before the panel// opens (the "click" that triggers it). Fed to the Select via `triggerStyle`.const triggerStyle = useButtonTransition(@@ -29,14 +36,27 @@ export const SelectExampleScene = () => {return (<Selectstyle={panel}- label="Select a fruit"+ label={p.label ?? "Select a fruit"}triggerStyle={triggerStyle}itemStyles={[undefined, row, undefined, undefined]}+ mode={p.mode ?? "light"}/>);};-export const selectExampleCode = `import { useButtonTransition } from "@/components/remocn/use-button-transition";+export const selectExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Select a fruit")+ props.push(`label="${label}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";++ return `import { useButtonTransition } from "@/components/remocn/use-button-transition";import { Select } from "@/components/remocn/select";import { useSelectTransition } from "@/components/remocn/use-select-transition";import { useSelectItemTransition } from "@/components/remocn/use-select-item-transition";@@ -60,11 +80,11 @@ export const Scene = () => {]);return (- <Select+ <Select${extraProps}style={panel}- label="Select a fruit"triggerStyle={triggerStyle}itemStyles={[undefined, row, undefined, undefined]}/>);};`;+};diff --git a/components/docs/examples/sheet-example.tsx b/components/docs/examples/sheet-example.tsxindex 14ba84a1..4abe137e 100644--- a/components/docs/examples/sheet-example.tsx+++ b/components/docs/examples/sheet-example.tsx@@ -5,7 +5,19 @@ import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-tranimport { Sheet } from "@/registry/remocn-ui/sheet";import { useSheetTransition } from "@/registry/remocn-ui/sheet/use-sheet-transition";-export const SheetExampleScene = () => {+export const sheetExampleControls = [+ "title", "description", "actionLabel", "cancelLabel", "mode",+] as const;++export interface SheetExampleProps {+ title?: string;+ description?: string;+ actionLabel?: string;+ cancelLabel?: string;+ mode?: "light" | "dark";+}++export const SheetExampleScene = (p: SheetExampleProps = {}) => {// The trigger Button: idle → hover → press, the press lands just before the// sheet opens (the "click" that triggers it).const trigger = useButtonTransition([@@ -19,13 +31,39 @@ export const SheetExampleScene = () => {]);return (<>- <Button label="Edit profile" style={trigger} />- <Sheet style={sheet} />+ <Button label="Edit profile" mode={p.mode ?? "light"} style={trigger} />+ <Sheet+ title={p.title ?? "Edit profile"}+ description={p.description ?? "Make changes to your profile here. Click save when you're done."}+ actionLabel={p.actionLabel ?? "Save changes"}+ cancelLabel={p.cancelLabel ?? "Cancel"}+ mode={p.mode ?? "light"}+ style={sheet}+ /></>);};-export const sheetExampleCode = `import { Sheet } from "@/components/remocn/sheet";+export const sheetExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const description = values.description as string | undefined;+ const actionLabel = values.actionLabel as string | undefined;+ const cancelLabel = values.cancelLabel as string | undefined;+ const mode = values.mode as string | undefined;++ const sheetProps: string[] = [];+ if (title !== undefined && title !== "Edit profile") sheetProps.push(`title="${title}"`);+ if (description !== undefined && description !== "Make changes to your profile here. Click save when you're done.") sheetProps.push(`description="${description}"`);+ if (actionLabel !== undefined && actionLabel !== "Save changes") sheetProps.push(`actionLabel="${actionLabel}"`);+ if (cancelLabel !== undefined && cancelLabel !== "Cancel") sheetProps.push(`cancelLabel="${cancelLabel}"`);+ if (mode !== undefined && mode !== "light") sheetProps.push(`mode="${mode}"`);++ const buttonModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ const sheetPropsStr = sheetProps.length ? ` ${sheetProps.join(" ")}` : "";++ return `import { Sheet } from "@/components/remocn/sheet";import { useSheetTransition } from "@/components/remocn/use-sheet-transition";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -42,8 +80,9 @@ export const Scene = () => {return (<>- <Button label="Edit profile" style={trigger} />- <Sheet style={sheet} />+ <Button label="Edit profile"${buttonModeStr} style={trigger} />+ <Sheet${sheetPropsStr} style={sheet} /></>);};`;+};diff --git a/components/docs/examples/skeleton-example.tsx b/components/docs/examples/skeleton-example.tsxindex 3fdfe89f..711f3a73 100644--- a/components/docs/examples/skeleton-example.tsx+++ b/components/docs/examples/skeleton-example.tsx@@ -2,8 +2,16 @@import { Skeleton } from "@/registry/remocn-ui/skeleton";import { useSkeletonTransition } from "@/registry/remocn-ui/skeleton/use-skeleton-transition";+import type { SkeletonLayout } from "@/registry/remocn-ui/skeleton";-export const SkeletonExampleScene = () => {+export interface SkeletonExampleProps {+ layout?: SkeletonLayout;+ mode?: "light" | "dark";+}++export const skeletonExampleControls = ["layout", "mode"] as const;++export const SkeletonExampleScene = (p: SkeletonExampleProps = {}) => {// Shimmer for ~3 full sweep cycles (180 frames) as if waiting on data, then// crossfade to real content.const skeletonStyle = useSkeletonTransition([@@ -20,7 +28,11 @@ export const SkeletonExampleScene = () => {justifyContent: "center",}}>- <Skeleton style={skeletonStyle} layout="card">+ <Skeleton+ style={skeletonStyle}+ layout={p.layout ?? "card"}+ mode={p.mode ?? "light"}+ >{/* Real content — defines the box size; revealed on crossfade. */}<div style={{ display: "flex", gap: 14, alignItems: "center" }}><div@@ -56,7 +68,18 @@ export const SkeletonExampleScene = () => {);};-export const skeletonExampleCode = `import { Skeleton } from "@/components/remocn/skeleton";+export const skeletonExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const layout = values.layout as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (layout !== undefined && layout !== "card") props.push(`layout="${layout}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}\n ` : "";++ return `import { Skeleton } from "@/components/remocn/skeleton";import { useSkeletonTransition } from "@/components/remocn/use-skeleton-transition";export const Scene = () => {@@ -76,7 +99,7 @@ export const Scene = () => {justifyContent: "center",}}>- <Skeleton style={skeletonStyle} layout="card">+ <Skeleton${extraProps}style={skeletonStyle}>{/* Real content — defines the box size; revealed on crossfade. */}<div style={{ display: "flex", gap: 14, alignItems: "center" }}><div@@ -111,3 +134,4 @@ export const Scene = () => {</div>);};`;+};diff --git a/components/docs/examples/slider-example.tsx b/components/docs/examples/slider-example.tsxindex 69365d95..41cc1e03 100644--- a/components/docs/examples/slider-example.tsx+++ b/components/docs/examples/slider-example.tsx@@ -12,7 +12,14 @@ const THUMB_START_X = 544; // canvas x at value 20const THUMB_END_X = 736; // canvas x at value 80const THUMB_Y = 360; // canvas y of track center-export const SliderExampleScene = () => {+export const sliderExampleControls = ["showValue", "mode"] as const;++export interface SliderExampleProps {+ showValue?: boolean;+ mode?: "light" | "dark";+}++export const SliderExampleScene = (p: SliderExampleProps = {}) => {// Cursor: park top-left → ease to thumb (arrives frame 30) → drag to end (arrives frame 100) → release.const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60, },@@ -43,14 +50,27 @@ export const SliderExampleScene = () => {transform: "translate(-50%, -50%)",}}>- <Slider style={sliderStyle} width={320} showValue />+ <Slider style={sliderStyle} width={320} showValue={p.showValue ?? true} mode={p.mode ?? "light"} /></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} /></div>);};-export const sliderExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const sliderExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const showValue = values.showValue as boolean | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (showValue !== undefined && showValue !== true)+ props.push(`showValue={${showValue}}`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const sliderPropsStr = props.length ? ` ${props.join(" ")}` : "";+ const cursorModeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Slider } from "@/components/remocn/slider";import { useSliderTransition } from "@/components/remocn/use-slider-transition";@@ -93,9 +113,10 @@ export const Scene = () => {transform: "translate(-50%, -50%)",}}>- <Slider style={sliderStyle} width={320} showValue />+ <Slider style={sliderStyle} width={320}${sliderPropsStr} /></div>- <Cursor style={cursorStyle} variant="pointer" />+ <Cursor style={cursorStyle} variant="pointer"${cursorModeStr} /></div>);};`;+};diff --git a/components/docs/examples/stepper-example.tsx b/components/docs/examples/stepper-example.tsxindex 15ceed54..93f9e4b6 100644--- a/components/docs/examples/stepper-example.tsx+++ b/components/docs/examples/stepper-example.tsx@@ -3,7 +3,14 @@import { Stepper } from "@/registry/remocn-ui/stepper";import { useStepperTransition } from "@/registry/remocn-ui/stepper/use-stepper-transition";-export const StepperExampleScene = () => {+export interface StepperExampleProps {+ steps?: string[];+ mode?: "light" | "dark";+}++export const stepperExampleControls = ["steps", "mode"] as const;++export const StepperExampleScene = (p: StepperExampleProps = {}) => {// Advance through 3 steps: "Account" (0) → "Plan" (1) → "Done" (2).// Start explicitly at index 0 (else the timeline holds the first step's index// before it fires); each step arrives at the end of a 24-frame ease.@@ -16,12 +23,27 @@ export const StepperExampleScene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>{/* Stepper renders position:absolute;inset:0 — it fills and centers itself. */}- <Stepper style={stepperStyle} />+ <Stepper+ style={stepperStyle}+ steps={p.steps ?? ["Account", "Plan", "Done"]}+ mode={p.mode ?? "light"}+ /></div>);};-export const stepperExampleCode = `import { Stepper } from "@/components/remocn/stepper";+export const stepperExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const steps = values.steps as string[] | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (steps !== undefined) props.push(`steps={${JSON.stringify(steps)}}`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}\n ` : "";++ return `import { Stepper } from "@/components/remocn/stepper";import { useStepperTransition } from "@/components/remocn/use-stepper-transition";export const Scene = () => {@@ -35,7 +57,8 @@ export const Scene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <Stepper style={stepperStyle} />+ <Stepper${extraProps}style={stepperStyle} /></div>);};`;+};diff --git a/components/docs/examples/switch-example.tsx b/components/docs/examples/switch-example.tsxindex dc01f70a..e0a6ede6 100644--- a/components/docs/examples/switch-example.tsx+++ b/components/docs/examples/switch-example.tsx@@ -3,15 +3,48 @@import { Switch } from "@/registry/remocn-ui/switch";import { useSwitchTransition } from "@/registry/remocn-ui/switch/use-switch-transition";-export const SwitchExampleScene = () => {+export const switchExampleControls = ["label", "size", "primary", "mode"] as const;++export interface SwitchExampleProps {+ label?: string;+ size?: "sm" | "default" | "lg";+ primary?: string;+ mode?: "light" | "dark";+}++export const SwitchExampleScene = (p: SwitchExampleProps = {}) => {const style = useSwitchTransition([{ at: 18, state: "checked", duration: 14 },{ at: 78, state: "unchecked", duration: 12 },]);- return <Switch label="Enable notifications" style={style} />;+ return (+ <Switch+ label={p.label ?? "Enable notifications"}+ size={p.size ?? "default"}+ primary={p.primary}+ mode={p.mode ?? "light"}+ style={style}+ />+ );};-export const switchExampleCode = `import { Switch } from "@/components/remocn/switch";+export const switchExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const size = values.size as string | undefined;+ const primary = values.primary as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (label !== undefined && label !== "Enable notifications")+ props.push(`label="${label}"`);+ if (size !== undefined && size !== "default") props.push(`size="${size}"`);+ if (primary !== undefined) props.push(`primary="${primary}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);++ const propsStr = props.length ? ` ${props.join(" ")}` : "";+ return `import { Switch } from "@/components/remocn/switch";import { useSwitchTransition } from "@/components/remocn/use-switch-transition";export const Scene = () => {@@ -20,5 +53,6 @@ export const Scene = () => {{ at: 78, state: "unchecked", duration: 12 },]);- return <Switch label="Enable notifications" style={style} />;+ return <Switch${propsStr} style={style} />;};`;+};diff --git a/components/docs/examples/tabs-example.tsx b/components/docs/examples/tabs-example.tsxindex b2d1ae72..d92a82ad 100644--- a/components/docs/examples/tabs-example.tsx+++ b/components/docs/examples/tabs-example.tsx@@ -3,16 +3,40 @@import { Tabs } from "@/registry/remocn-ui/tabs";import { useTabsTransition } from "@/registry/remocn-ui/tabs/use-tabs-transition";-export const TabsExampleScene = () => {+export interface TabsExampleProps {+ variant?: "pill" | "underline";+ mode?: "light" | "dark";+}++export const tabsExampleControls = ["variant", "mode"] as const;++export const TabsExampleScene = (p: TabsExampleProps = {}) => {const style = useTabsTransition([{ at: 18, state: "Account", duration: 16 },{ at: 58, state: "Password", duration: 18 },{ at: 94, state: "Settings", duration: 12 },]);- return <Tabs style={style} />;+ return (+ <Tabs+ style={style}+ variant={p.variant ?? "pill"}+ mode={p.mode ?? "light"}+ />+ );};-export const tabsExampleCode = `import { Tabs } from "@/components/remocn/tabs";+export const tabsExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const variant = values.variant as string | undefined;+ const mode = values.mode as string | undefined;++ const props: string[] = [];+ if (variant !== undefined && variant !== "pill") props.push(`variant="${variant}"`);+ if (mode !== undefined && mode !== "light") props.push(`mode="${mode}"`);+ const extraProps = props.length ? `\n ${props.join("\n ")}` : "";++ return `import { Tabs } from "@/components/remocn/tabs";import { useTabsTransition } from "@/components/remocn/use-tabs-transition";export const Scene = () => {@@ -22,5 +46,6 @@ export const Scene = () => {{ at: 94, state: "Settings", duration: 12 },]);- return <Tabs style={style} />;+ return <Tabs style={style}${extraProps} />;};`;+};diff --git a/components/docs/examples/toast-example.tsx b/components/docs/examples/toast-example.tsxindex fbbd092b..8d3dc695 100644--- a/components/docs/examples/toast-example.tsx+++ b/components/docs/examples/toast-example.tsx@@ -11,7 +11,18 @@ import { useToastTransition } from "@/registry/remocn-ui/toast/use-toast-transitconst BTN_X = 620; // cursor tip target X (the pointer hotspot lands here)const BTN_Y = 360; // cursor tip target Y-export const ToastExampleScene = () => {+export const toastExampleControls = [+ "title", "description", "variant", "mode",+] as const;++export interface ToastExampleProps {+ title?: string;+ description?: string;+ variant?: "default" | "success" | "error";+ mode?: "light" | "dark";+}++export const ToastExampleScene = (p: ToastExampleProps = {}) => {// Cursor: park top-left → ease onto button (arrives 40) → click at 68.const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },@@ -46,7 +57,7 @@ export const ToastExampleScene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Show toast" style={buttonStyle} />+ <Button label="Show toast" style={buttonStyle} mode={p.mode ?? "light"} /></div>{/* Toast anchored bottom-right, 24px from edges */}@@ -58,9 +69,10 @@ export const ToastExampleScene = () => {}}><Toast- title="Changes saved"- description="Your preferences have been updated."- variant="success"+ title={p.title ?? "Changes saved"}+ description={p.description ?? "Your profile has been updated."}+ variant={p.variant ?? "success"}+ mode={p.mode ?? "light"}style={toastStyle}/></div>@@ -70,7 +82,33 @@ export const ToastExampleScene = () => {);};-export const toastExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const toastExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const title = values.title as string | undefined;+ const description = values.description as string | undefined;+ const variant = values.variant as string | undefined;+ const mode = values.mode as string | undefined;++ const toastProps: string[] = [];+ if (title !== undefined && title !== "Changes saved")+ toastProps.push(`title="${title}"`);+ if (+ description !== undefined &&+ description !== "Your profile has been updated."+ )+ toastProps.push(`description="${description}"`);+ if (variant !== undefined && variant !== "success")+ toastProps.push(`variant="${variant}"`);+ if (mode !== undefined && mode !== "light") toastProps.push(`mode="${mode}"`);++ const btnModeStr =+ mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";+ const toastPropsStr = toastProps.length+ ? `\n ${toastProps.join("\n ")}\n `+ : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -111,19 +149,15 @@ export const Scene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Show toast" style={buttonStyle} />+ <Button label="Show toast" style={buttonStyle}${btnModeStr} /></div><div style={{ position: "absolute", right: 24, bottom: 24 }}>- <Toast- title="Changes saved"- description="Your preferences have been updated."- variant="success"- style={toastStyle}- />+ <Toast${toastPropsStr === "" ? "\n title=\"Changes saved\"\n description=\"Your profile has been updated.\"\n variant=\"success\"\n " : toastPropsStr}style={toastStyle} /></div><Cursor style={cursorStyle} variant="pointer" /></div>);};`;+};diff --git a/components/docs/examples/toggle-group-example.tsx b/components/docs/examples/toggle-group-example.tsxindex c88f54b1..a9cedf84 100644--- a/components/docs/examples/toggle-group-example.tsx+++ b/components/docs/examples/toggle-group-example.tsx@@ -13,7 +13,13 @@ const MONTHLY_X = 596;const YEARLY_X = 684;const TOGGLE_Y = 360;-export const ToggleGroupExampleScene = () => {+export interface ToggleGroupExampleProps {+ mode?: "light" | "dark";+}++export const toggleGroupExampleControls = ["mode"] as const;++export const ToggleGroupExampleScene = (p: ToggleGroupExampleProps = {}) => {// Cursor: park → ease to "Yearly" → click → ease to "Monthly" → click.const cursorStyle = useCursorPath([{ at: 0, x: 80, y: 60 },@@ -32,13 +38,20 @@ export const ToggleGroupExampleScene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>{/* ToggleGroup renders position:absolute;inset:0 — it centers itself. */}- <ToggleGroup style={toggleStyle} />- <Cursor style={cursorStyle} variant="pointer" />+ <ToggleGroup style={toggleStyle} mode={p.mode ?? "light"} />+ <Cursor style={cursorStyle} variant="pointer" mode={p.mode ?? "light"} /></div>);};-export const toggleGroupExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const toggleGroupExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const mode = values.mode as string | undefined;++ const modeStr = mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { ToggleGroup } from "@/components/remocn/toggle-group";import { useToggleGroupTransition } from "@/components/remocn/use-toggle-group-transition";@@ -67,8 +80,9 @@ export const Scene = () => {return (<div style={{ position: "relative", width: "100%", height: "100%" }}>- <ToggleGroup style={toggleStyle} />- <Cursor style={cursorStyle} variant="pointer" />+ <ToggleGroup style={toggleStyle}${modeStr} />+ <Cursor style={cursorStyle} variant="pointer"${modeStr} /></div>);};`;+};diff --git a/components/docs/examples/tooltip-example.tsx b/components/docs/examples/tooltip-example.tsxindex 5adac5b4..87b7c0d4 100644--- a/components/docs/examples/tooltip-example.tsx+++ b/components/docs/examples/tooltip-example.tsx@@ -15,7 +15,16 @@ const BTN_Y = 360;const AWAY_X = 200;const AWAY_Y = 200;-export const TooltipExampleScene = () => {+export const tooltipExampleControls = [+ "label", "mode",+] as const;++export interface TooltipExampleProps {+ label?: string;+ mode?: "light" | "dark";+}++export const TooltipExampleScene = (p: TooltipExampleProps = {}) => {// Cursor: park top-left → ease onto button (arrives 28) → hover →// move away at frame 90 (arrives 110).const cursorStyle = useCursorPath([@@ -48,7 +57,7 @@ export const TooltipExampleScene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Hover me" style={buttonStyle} />+ <Button label="Hover me" style={buttonStyle} mode={p.mode ?? "light"} />{/* Tooltip is anchored relative to the button: centered above it. */}<div@@ -60,8 +69,9 @@ export const TooltipExampleScene = () => {}}><Tooltip- label="Keyboard shortcut ⌘K"+ label={p.label ?? "Add to library"}side="top"+ mode={p.mode ?? "light"}style={tooltipStyle}/></div>@@ -72,7 +82,17 @@ export const TooltipExampleScene = () => {);};-export const tooltipExampleCode = `import { Cursor } from "@/components/remocn/cursor";+export const tooltipExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const label = values.label as string | undefined;+ const mode = values.mode as string | undefined;++ const labelStr = label ?? "Add to library";+ const modeStr =+ mode !== undefined && mode !== "light" ? ` mode="${mode}"` : "";++ return `import { Cursor } from "@/components/remocn/cursor";import { useCursorPath } from "@/components/remocn/use-cursor-path";import { Button } from "@/components/remocn/button";import { useButtonTransition } from "@/components/remocn/use-button-transition";@@ -114,7 +134,7 @@ export const Scene = () => {transform: "translate(-50%, -50%)",}}>- <Button label="Hover me" style={buttonStyle} />+ <Button label="Hover me" style={buttonStyle}${modeStr} />{/* Tooltip sits above the button; the caller owns the anchor position. */}<div@@ -125,7 +145,7 @@ export const Scene = () => {transform: "translateX(-50%)",}}>- <Tooltip label="Keyboard shortcut ⌘K" side="top" style={tooltipStyle} />+ <Tooltip label="${labelStr}" side="top"${modeStr} style={tooltipStyle} /></div></div>@@ -133,3 +153,4 @@ export const Scene = () => {</div>);};`;+};diff --git a/components/docs/live-example.tsx b/components/docs/live-example.tsxdeleted file mode 100644index 98d708b4..00000000--- a/components/docs/live-example.tsx+++ /dev/null@@ -1,116 +0,0 @@-"use client";--import { Player } from "@remotion/player";-import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";-import { PlayIcon } from "lucide-react";-import { useEffect, useRef, useState } from "react";-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";-import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";-import { cn } from "@/lib/utils";-import { examples } from "./examples";--export function LiveExample({ name }: { name: string }) {- const entry = examples[name];-- if (!entry) {- return (- <div className="not-prose mb-6 rounded-lg border border-fd-border p-4 text-sm text-fd-muted-foreground">- Unknown component: <code>{name}</code>- </div>- );- }-- return (- <div className="not-prose mb-6 flex w-full flex-col gap-4">- <Tabs defaultValue="preview" className="gap-3">- <TabsList>- <TabsTrigger value="preview">Preview</TabsTrigger>- <TabsTrigger value="code">Code</TabsTrigger>- </TabsList>-- <TabsContent value="preview" className="mt-0">- <LivePreviewStage entry={entry} name={name} />- </TabsContent>-- <TabsContent value="code" className="mt-0">- <div className="surface-card overflow-hidden rounded-2xl [&_pre]:!rounded-none [&_pre]:!border-0 [&_pre]:!bg-transparent">- <DynamicCodeBlock lang="tsx" code={entry.code} />- </div>- </TabsContent>- </Tabs>- </div>- );-}--function LivePreviewStage({- entry,- name,-}: {- entry: (typeof examples)[string];- name: string;-}) {- const [mounted, setMounted] = useState(false);- const frameRef = useRef<HTMLDivElement>(null);- const reducedMotion = usePrefersReducedMotion();-- useEffect(() => {- if (mounted) return;- const el = frameRef.current;- if (!el || typeof IntersectionObserver === "undefined") return;- const observer = new IntersectionObserver(- (entries) => {- if (entries.some((e) => e.isIntersecting)) {- setMounted(true);- observer.disconnect();- }- },- { rootMargin: "200px 0px" },- );- observer.observe(el);- return () => observer.disconnect();- }, [mounted]);-- return (- <div- ref={frameRef}- className="surface-card aspect-video w-full overflow-hidden rounded-2xl"- >- {mounted ? (- <div- className={cn(- "size-full",- !reducedMotion && "animate-in fade-in duration-300 ease-out",- )}- >- <Player- component={entry.Component}- inputProps={{}}- durationInFrames={entry.durationInFrames}- fps={entry.fps}- compositionWidth={entry.width}- compositionHeight={entry.height}- style={{ width: "100%", height: "100%" }}- controls- loop- autoPlay- acknowledgeRemotionLicense- />- </div>- ) : (- <button- type="button"- onClick={() => setMounted(true)}- aria-label={`Play preview of ${name}`}- className={cn(- "group flex size-full items-center justify-center bg-muted/40 transition-colors",- "hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",- )}- >- <span className="flex size-12 items-center justify-center rounded-full bg-background/80 text-foreground transition-colors group-hover:bg-background">- <PlayIcon className="size-5 translate-x-px fill-current" />- </span>- </button>- )}- </div>- );-}diff --git a/components/docs/ui-component-preview.tsx b/components/docs/ui-component-preview.tsxnew file mode 100644index 00000000..bf8f8745--- /dev/null+++ b/components/docs/ui-component-preview.tsx@@ -0,0 +1,352 @@+"use client";++import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";+import { CheckIcon, LinkIcon, RotateCcwIcon } from "lucide-react";+import { useQueryStates } from "nuqs";+import { Suspense, useEffect, useMemo, useRef, useState } from "react";+import { Button } from "@/components/ui/button";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { useTrackEvent } from "@/lib/analytics";+import { type ControlConfig, getDefaults } from "@/lib/customizer-config";+import { buildParsers, PreviewStage } from "@/lib/ui-preview-internals";+import registry from "@/registry/__index__";+import { ComponentCustomizer } from "./component-customizer";+import { type ExampleEntry, examples } from "./examples";+import { buttonExampleCode, buttonExampleControls } from "./examples/button-example";+import { inputExampleCode, inputExampleControls } from "./examples/input-example";+import { toastExampleCode, toastExampleControls } from "./examples/toast-example";+import { popoverExampleCode, popoverExampleControls } from "./examples/popover-example";+import {+ accordionExampleCode,+ accordionExampleControls,+} from "./examples/accordion-example";+import { tooltipExampleCode, tooltipExampleControls } from "./examples/tooltip-example";+import { dialogExampleCode, dialogExampleControls } from "./examples/dialog-example";+import { sheetExampleCode, sheetExampleControls } from "./examples/sheet-example";+import { drawerExampleCode, drawerExampleControls } from "./examples/drawer-example";+import {+ alertDialogExampleCode,+ alertDialogExampleControls,+} from "./examples/alert-dialog-example";+import {+ checkboxExampleCode,+ checkboxExampleControls,+} from "./examples/checkbox-example";+import { radioExampleCode, radioExampleControls } from "./examples/radio-example";+import { switchExampleCode, switchExampleControls } from "./examples/switch-example";+import { sliderExampleCode, sliderExampleControls } from "./examples/slider-example";+import {+ progressExampleCode,+ progressExampleControls,+} from "./examples/progress-example";+import {+ comboboxExampleCode,+ comboboxExampleControls,+} from "./examples/combobox-example";+import { selectExampleCode, selectExampleControls } from "./examples/select-example";+import {+ commandMenuExampleCode,+ commandMenuExampleControls,+} from "./examples/command-menu-example";+import {+ dropdownMenuExampleCode,+ dropdownMenuExampleControls,+} from "./examples/dropdown-menu-example";+import {+ contextMenuExampleCode,+ contextMenuExampleControls,+} from "./examples/context-menu-example";+import { cursorExampleCode, cursorExampleControls } from "./examples/cursor-example";+import {+ resizableExampleCode,+ resizableExampleControls,+} from "./examples/resizable-example";+import {+ skeletonExampleCode,+ skeletonExampleControls,+} from "./examples/skeleton-example";+import { stepperExampleCode, stepperExampleControls } from "./examples/stepper-example";+import { tabsExampleCode, tabsExampleControls } from "./examples/tabs-example";+import {+ toggleGroupExampleCode,+ toggleGroupExampleControls,+} from "./examples/toggle-group-example";++/**+ * Per-component honored-key allowlist + code template, co-located with each+ * scene file (`<name>ExampleControls` + `<name>ExampleCode`). The preview shows+ * ONLY the controls a scene actually threads into its component (visible =+ * honored, never a blacklist), and the Code tab emits ONLY those honored props.+ *+ * Each fan-out worker adds one line here per migrated component (import the two+ * exports from `./examples/<name>-example`, register them by registry name).+ * Phase 0 seeds the button pilot.+ */+interface UiSceneMeta {+ /** Honored control keys (visible knobs); everything else is timeline-owned. */+ controls: readonly string[];+ /** Function template emitting the timeline code for the honored props. */+ code: (values: Record<string, unknown>) => string;+}++const UI_SCENE_META: Record<string, UiSceneMeta> = {+ button: { controls: buttonExampleControls, code: buttonExampleCode },+ input: { controls: inputExampleControls, code: inputExampleCode },+ toast: { controls: toastExampleControls, code: toastExampleCode },+ popover: { controls: popoverExampleControls, code: popoverExampleCode },+ accordion: { controls: accordionExampleControls, code: accordionExampleCode },+ tooltip: { controls: tooltipExampleControls, code: tooltipExampleCode },+ dialog: { controls: dialogExampleControls, code: dialogExampleCode },+ sheet: { controls: sheetExampleControls, code: sheetExampleCode },+ drawer: { controls: drawerExampleControls, code: drawerExampleCode },+ "alert-dialog": {+ controls: alertDialogExampleControls,+ code: alertDialogExampleCode,+ },+ checkbox: { controls: checkboxExampleControls, code: checkboxExampleCode },+ radio: { controls: radioExampleControls, code: radioExampleCode },+ switch: { controls: switchExampleControls, code: switchExampleCode },+ slider: { controls: sliderExampleControls, code: sliderExampleCode },+ progress: { controls: progressExampleControls, code: progressExampleCode },+ combobox: { controls: comboboxExampleControls, code: comboboxExampleCode },+ select: { controls: selectExampleControls, code: selectExampleCode },+ "command-menu": {+ controls: commandMenuExampleControls,+ code: commandMenuExampleCode,+ },+ "dropdown-menu": {+ controls: dropdownMenuExampleControls,+ code: dropdownMenuExampleCode,+ },+ "context-menu": {+ controls: contextMenuExampleControls,+ code: contextMenuExampleCode,+ },+ cursor: { controls: cursorExampleControls, code: cursorExampleCode },+ resizable: { controls: resizableExampleControls, code: resizableExampleCode },+ skeleton: { controls: skeletonExampleControls, code: skeletonExampleCode },+ stepper: { controls: stepperExampleControls, code: stepperExampleCode },+ tabs: { controls: tabsExampleControls, code: tabsExampleCode },+ "toggle-group": {+ controls: toggleGroupExampleControls,+ code: toggleGroupExampleCode,+ },+};++/**+ * Honored-only code generator (Q4). Built from the scene's `<name>ExampleCode`+ * function template — it interpolates ONLY honored keys, ONLY when a value+ * differs from its control default, and NEVER emits a prop the component+ * ignores. Same `visibleValues` feeds the Player + this generator → parity.+ * Does NOT call the legacy `config.snippet`.+ */+function generateUiCode(+ name: string,+ _exampleEntry: ExampleEntry,+ visibleValues: Record<string, unknown>,+): string {+ const meta = UI_SCENE_META[name];+ if (!meta) return "";+ return meta.code(visibleValues);+}++/** Shared "Unknown component" fallback — matches the existing docs widgets. */+function UnknownComponent({ name }: { name: string }) {+ return (+ <div className="not-prose mb-6 rounded-lg border border-fd-border p-4 text-sm text-fd-muted-foreground">+ Unknown component: <code>{name}</code>+ </div>+ );+}++export function UiComponentPreview({ name }: { name: string }) {+ const exampleEntry = examples[`${name}-example`];+ const entry = registry[name];+ const meta = UI_SCENE_META[name];++ // Q1 — join the example (scene + timing) with the registry config (controls)+ // and the per-scene honored list. Any miss → the shared Unknown fallback.+ if (!exampleEntry || !entry || !meta) {+ return <UnknownComponent name={name} />;+ }++ return (+ <Suspense+ fallback={+ <div className="not-prose mb-6 aspect-[1.9/1] w-full animate-pulse rounded-2xl bg-muted" />+ }+ >+ <UiPreview+ name={name}+ exampleEntry={exampleEntry}+ controls={entry.config.controls}+ honored={meta.controls}+ />+ </Suspense>+ );+}++function UiPreview({+ name,+ exampleEntry,+ controls,+ honored,+}: {+ name: string;+ exampleEntry: ExampleEntry;+ controls: ControlConfig;+ honored: readonly string[];+}) {+ const trackEvent = useTrackEvent();++ // visibleControls = config.controls ∩ honored[name]. This drops state/speed+ // and every structural-but-unthreaded knob — no global blacklist needed.+ const visibleControls = useMemo(+ () =>+ Object.fromEntries(+ Object.entries(controls).filter(([k]) => honored.includes(k)),+ ) as ControlConfig,+ [controls, honored],+ );++ const hasControls = Object.keys(visibleControls).length > 0;++ const { parsers, urlKeys } = useMemo(+ () => buildParsers(name, visibleControls),+ [name, visibleControls],+ );+ const defaults = useMemo(+ () => getDefaults(visibleControls),+ [visibleControls],+ );++ const [values, setValues] = useQueryStates(parsers, {+ urlKeys,+ clearOnDefault: true,+ shallow: true,+ });++ const isDefault = useMemo(+ () => Object.entries(defaults).every(([k, v]) => values[k] === v),+ [defaults, values],+ );++ const code = useMemo(+ () => generateUiCode(name, exampleEntry, values),+ [name, exampleEntry, values],+ );++ const [copied, setCopied] = useState(false);+ const handleCopyLink = () => {+ if (typeof window === "undefined") return;+ navigator.clipboard.writeText(window.location.href);+ setCopied(true);+ trackEvent("customized_link_shared", { component: name });+ setTimeout(() => setCopied(false), 1500);+ };++ const handleReset = () => {+ setValues(null);+ trackEvent("customizer_reset", { component: name });+ };++ useEffect(() => {+ trackEvent("docs_component_viewed", { component: name });+ }, [name, trackEvent]);++ const customizeTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(+ new Map(),+ );+ useEffect(() => {+ const timers = customizeTimers.current;+ return () => {+ for (const timer of timers.values()) clearTimeout(timer);+ timers.clear();+ };+ }, []);+ const handleCustomizeChange = (key: string, value: unknown) => {+ setValues((prev) => ({ ...prev, [key]: value }));+ const existing = customizeTimers.current.get(key);+ if (existing) clearTimeout(existing);+ customizeTimers.current.set(+ key,+ setTimeout(() => {+ trackEvent("component_customized", { component: name, prop: key });+ customizeTimers.current.delete(key);+ }, 500),+ );+ };++ return (+ <div className="not-prose mb-6 flex w-full flex-col gap-4">+ <Tabs defaultValue="preview" className="gap-3">+ <TabsList>+ <TabsTrigger value="preview">Preview</TabsTrigger>+ <TabsTrigger value="code">Code</TabsTrigger>+ </TabsList>++ <TabsContent value="preview" className="mt-0">+ <PreviewStage+ name={name}+ Component={exampleEntry.Component}+ inputProps={values}+ // D2 — timing is sourced from the EXAMPLE, not the config.+ durationInFrames={exampleEntry.durationInFrames}+ fps={exampleEntry.fps}+ compositionWidth={exampleEntry.width}+ compositionHeight={exampleEntry.height}+ />+ </TabsContent>++ <TabsContent value="code" className="mt-0">+ <div className="surface-card overflow-hidden rounded-2xl [&_pre]:!rounded-none [&_pre]:!border-0 [&_pre]:!bg-transparent">+ <DynamicCodeBlock lang="tsx" code={code} />+ </div>+ </TabsContent>+ </Tabs>++ {/* Empty-panel collapse (Q5): no honored controls → only the Tabs. */}+ {hasControls && (+ <div className="overflow-hidden ">+ <div className="flex items-center justify-between pt-4 pb-2">+ <span className="text-sm font-medium text-foreground">+ Customize+ </span>+ <div className="flex items-center gap-1">+ <Button+ variant="outline"+ size="icon-sm"+ onClick={handleCopyLink}+ aria-label="Copy share link"+ title="Copy share link"+ className="text-muted-foreground hover:text-foreground"+ >+ {copied ? (+ <CheckIcon className="size-3.5" />+ ) : (+ <LinkIcon className="size-3.5" />+ )}+ </Button>+ <Button+ variant="outline"+ size="icon-sm"+ onClick={handleReset}+ disabled={isDefault}+ aria-label="Reset to defaults"+ title="Reset to defaults"+ className="text-muted-foreground hover:text-foreground disabled:opacity-40"+ >+ <RotateCcwIcon className="size-3.5" />+ </Button>+ </div>+ </div>+ <ComponentCustomizer+ controls={visibleControls}+ values={values as Record<string, unknown>}+ onChange={handleCustomizeChange}+ />+ </div>+ )}+ </div>+ );+}diff --git a/content/docs/ui/components/accordion.mdx b/content/docs/ui/components/accordion.mdxindex 02bf1e35..62cea9d1 100644--- a/content/docs/ui/components/accordion.mdx+++ b/content/docs/ui/components/accordion.mdx@@ -3,7 +3,7 @@ title: Accordiondescription: An accordion panel whose open/closed state is a pure function of the timeline----<ComponentPreview name="accordion" />+<UiComponentPreview name="accordion" />A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (closed, opened) is a pure function of the `state`Installing `accordion` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="accordion-example" />-## States`AccordionState` is:diff --git a/content/docs/ui/components/alert-dialog.mdx b/content/docs/ui/components/alert-dialog.mdxindex 84246bce..aab58c70 100644--- a/content/docs/ui/components/alert-dialog.mdx+++ b/content/docs/ui/components/alert-dialog.mdx@@ -3,7 +3,7 @@ title: AlertDialogdescription: A modal alert dialog whose opened/closed state is a pure function of the timeline----<ComponentPreview name="alert-dialog" />+<UiComponentPreview name="alert-dialog" />A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: AlertDialog is a modal layer meant to compose over another scene, so it does not paint an opaque background.@@ -15,10 +15,6 @@ A state atom whose appearance (closed, opened) is a pure function of the `state`Installing `alert-dialog` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) and the `button` primitive via `registryDependencies` (`["remocn-ui", "button"]`). You do not need to install them separately — the dialog pairs with the Button as its trigger in the canonical lifecycle example.</Note>-## Example--<LiveExample name="alert-dialog-example" />-## States`AlertDialogState` is:diff --git a/content/docs/ui/components/button.mdx b/content/docs/ui/components/button.mdxindex d598d9e1..a9863f0b 100644--- a/content/docs/ui/components/button.mdx+++ b/content/docs/ui/components/button.mdx@@ -3,7 +3,7 @@ title: Buttondescription: A button whose visual state is a pure function of the timeline----<ComponentPreview name="button" />+<UiComponentPreview name="button" />A state atom whose appearance (idle, hover, press, loading, success) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (idle, hover, press, loading, success) is a pure fInstalling `button` automatically installs `spinner` and the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install either separately.</Note>-## Example--<LiveExample name="button-example" />-## States`ButtonState` is:diff --git a/content/docs/ui/components/checkbox.mdx b/content/docs/ui/components/checkbox.mdxindex c0cdeefe..d4466a7e 100644--- a/content/docs/ui/components/checkbox.mdx+++ b/content/docs/ui/components/checkbox.mdx@@ -3,7 +3,7 @@ title: Checkboxdescription: A checkbox whose checked/unchecked state is a pure function of the timeline----<ComponentPreview name="checkbox" />+<UiComponentPreview name="checkbox" />A state atom whose appearance (checked, unchecked) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (checked, unchecked) is a pure function of the `stInstalling `checkbox` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="checkbox-example" />-## States`CheckboxState` is:diff --git a/content/docs/ui/components/combobox.mdx b/content/docs/ui/components/combobox.mdxindex 50edef44..a6a19ff6 100644--- a/content/docs/ui/components/combobox.mdx+++ b/content/docs/ui/components/combobox.mdx@@ -3,7 +3,7 @@ title: Comboboxdescription: A searchable select with a typed-query input, filtered panel, and row selection----<ComponentPreview name="combobox" />+<UiComponentPreview name="combobox" />A state atom representing a searchable select: a text-input trigger and a panel of filtered options. Its appearance (`opened`, `closed`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The panel reveals below the trigger with opacity, scale, and vertical lift animations. The trigger reuses the Input visual presets; the panel rows reuse the SelectItem atom.@@ -15,10 +15,6 @@ A state atom representing a searchable select: a text-input trigger and a panelInstalling `combobox` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`), the `input` primitive, and the `select-item` atom via `registryDependencies` (`["remocn-ui", "input", "select-item"]`). You do not need to install them separately. The trigger renders from Input's visual presets, and the panel renders a column of SelectItem rows.</Note>-## Example--<LiveExample name="combobox-example" />-## States`ComboboxState` is:diff --git a/content/docs/ui/components/command-menu.mdx b/content/docs/ui/components/command-menu.mdxindex 410d66bb..46748acf 100644--- a/content/docs/ui/components/command-menu.mdx+++ b/content/docs/ui/components/command-menu.mdx@@ -3,7 +3,7 @@ title: Command Menudescription: A keyboard-driven command palette with backdrop, typing animation, and row selection----<ComponentPreview name="command-menu" />+<UiComponentPreview name="command-menu" />A state atom representing a command palette panel. Its appearance (`opened`, `closed`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The panel zooms in from 0.96 scale with a backdrop dim and fades fully in on open; reverses on close.@@ -15,10 +15,6 @@ A state atom representing a command palette panel. Its appearance (`opened`, `clInstalling `command-menu` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) and the `command-menu-item` atom via `registryDependencies` (`["remocn-ui", "command-menu-item"]`). You do not need to install either separately.</Note>-## Example--<LiveExample name="command-menu-example" />-## States`CommandMenuState` is:diff --git a/content/docs/ui/components/context-menu.mdx b/content/docs/ui/components/context-menu.mdxindex 1278e56b..5115b224 100644--- a/content/docs/ui/components/context-menu.mdx+++ b/content/docs/ui/components/context-menu.mdx@@ -3,7 +3,7 @@ title: Context Menudescription: A right-click menu panel that opens at the cursor point with no built-in trigger----<ComponentPreview name="context-menu" />+<UiComponentPreview name="context-menu" />A state atom representing a context menu panel. Its appearance (`opened`, `closed`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. Unlike `DropdownMenu`, there is no built-in trigger — the context menu opens at the cursor click point and the **caller** positions it there. The panel grows from its top-left corner (the click point) with opacity, scale, and vertical lift.@@ -15,10 +15,6 @@ A state atom representing a context menu panel. Its appearance (`opened`, `closeInstalling `context-menu` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) and the `dropdown-menu-item` atom via `registryDependencies` (`["remocn-ui", "dropdown-menu-item"]`). You do not need to install them separately. The panel rows reuse the DropdownMenuItem atom.</Note>-## Example--<LiveExample name="context-menu-example" />-## States`ContextMenuState` is:diff --git a/content/docs/ui/components/cursor.mdx b/content/docs/ui/components/cursor.mdxindex 53fadf59..267bfcd5 100644--- a/content/docs/ui/components/cursor.mdx+++ b/content/docs/ui/components/cursor.mdx@@ -3,7 +3,7 @@ title: Cursordescription: An animated cursor that follows a scripted path with click ripple and press effects----<ComponentPreview name="cursor" />+<UiComponentPreview name="cursor" />A motion atom that renders an animated cursor as a pure function of the `CursorStyle` it receives. The cursor reads no frame itself — the single time source is `useCursorPath` on the caller's side, which folds a path of waypoints into a resolved position, ripple, and press-dip visual. This is the **value-channel** variant of the primitive pattern: instead of a string-state timeline it drives numeric position channels directly.@@ -15,10 +15,6 @@ A motion atom that renders an animated cursor as a pure function of the `CursorSInstalling `cursor` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `cursor` (the renderer) and `use-cursor-path` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="cursor-example" />-## WaypointsInstead of a string-state timeline, `useCursorPath` takes an array of `CursorWaypoint` objects that describe a scripted path:diff --git a/content/docs/ui/components/dialog.mdx b/content/docs/ui/components/dialog.mdxindex 4e7a0aed..5a925d89 100644--- a/content/docs/ui/components/dialog.mdx+++ b/content/docs/ui/components/dialog.mdx@@ -3,7 +3,7 @@ title: Dialogdescription: A modal dialog whose opened/closed state is a pure function of the timeline----<ComponentPreview name="dialog" />+<UiComponentPreview name="dialog" />A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: Dialog is a modal layer meant to compose over another scene, so it does not paint an opaque background. Unlike AlertDialog, Dialog is a generic (non-destructive) modal — its primary action uses the theme `primary` color, and it renders a close (X) button in the top-right corner of the popup card.@@ -15,10 +15,6 @@ A state atom whose appearance (closed, opened) is a pure function of the `state`Installing `dialog` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. If you want to pair Dialog with the Button as its trigger in the canonical lifecycle example, install `button` separately.</Note>-## Example--<LiveExample name="dialog-example" />-## States`DialogState` is:diff --git a/content/docs/ui/components/drawer.mdx b/content/docs/ui/components/drawer.mdxindex f714de33..718bd1fe 100644--- a/content/docs/ui/components/drawer.mdx+++ b/content/docs/ui/components/drawer.mdx@@ -3,7 +3,7 @@ title: Drawerdescription: A bottom panel whose opened/closed state is a pure function of the timeline----<ComponentPreview name="drawer" />+<UiComponentPreview name="drawer" />A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: Drawer is a modal layer meant to compose over another scene, so it does not paint an opaque background. The panel is anchored to the bottom edge and slides up into view: it has rounded top corners, a drag-handle pill at the top, and no close (X) button — the handle stands in for the dismiss affordance.@@ -15,10 +15,6 @@ A state atom whose appearance (closed, opened) is a pure function of the `state`Installing `drawer` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. If you want to pair Drawer with the Button as its trigger in the canonical lifecycle example, install `button` separately.</Note>-## Example--<LiveExample name="drawer-example" />-## States`DrawerState` is:diff --git a/content/docs/ui/components/dropdown-menu.mdx b/content/docs/ui/components/dropdown-menu.mdxindex 673692e4..19452d67 100644--- a/content/docs/ui/components/dropdown-menu.mdx+++ b/content/docs/ui/components/dropdown-menu.mdx@@ -3,7 +3,7 @@ title: DropdownMenudescription: A dropdown menu container with opened/closed states and action rows----<ComponentPreview name="dropdown-menu" />+<UiComponentPreview name="dropdown-menu" />A state atom representing a complete dropdown menu: a trigger button and a panel of actionable items. Its appearance (opened, closed) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The panel reveals below the trigger with opacity, scale, and vertical translation animations.@@ -15,10 +15,6 @@ A state atom representing a complete dropdown menu: a trigger button and a panelInstalling `dropdown-menu` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`), the `button` primitive, and the `dropdown-menu-item` atom via `registryDependencies` (`["remocn-ui", "button", "dropdown-menu-item"]`). You do not need to install them separately. The trigger reuses the Button `outline` variant, and the panel renders a column of DropdownMenuItem rows.</Note>-## Example--<LiveExample name="dropdown-menu-example" />-## States`DropdownMenuState` is:diff --git a/content/docs/ui/components/input.mdx b/content/docs/ui/components/input.mdxindex 92aa3f70..b6f1d0eb 100644--- a/content/docs/ui/components/input.mdx+++ b/content/docs/ui/components/input.mdx@@ -3,7 +3,7 @@ title: Inputdescription: An input field whose visual state is a pure function of the timeline----<ComponentPreview name="input" />+<UiComponentPreview name="input" />A state atom whose appearance (idle, hover, active, typing, invalid) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (idle, hover, active, typing, invalid) is a pure fInstalling `input` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="input-example" />-## States`InputState` is:diff --git a/content/docs/ui/components/popover.mdx b/content/docs/ui/components/popover.mdxindex d5a8451c..3f2b2fe3 100644--- a/content/docs/ui/components/popover.mdx+++ b/content/docs/ui/components/popover.mdx@@ -3,7 +3,7 @@ title: Popoverdescription: A floating card that appears beside an anchor with arbitrary content----<ComponentPreview name="popover" />+<UiComponentPreview name="popover" />A state atom whose appearance (`closed`, `opened`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The card fades in at 0.97 scale, slides 6 px toward the anchor, and rests fully visible; `closed` reverses the motion. Placement is the caller's responsibility — the popover renders inline and the caller wraps it in an absolutely-positioned anchor div.@@ -17,10 +17,6 @@ The hover-card pattern (a rich profile card that appears on hover) is this compoInstalling `popover` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `popover` (the renderer) and `use-popover-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="popover-example" />-## States`PopoverState` is:diff --git a/content/docs/ui/components/progress.mdx b/content/docs/ui/components/progress.mdxindex 6ceac5cc..e80c1723 100644--- a/content/docs/ui/components/progress.mdx+++ b/content/docs/ui/components/progress.mdx@@ -3,7 +3,7 @@ title: Progressdescription: A progress bar that fills along a scripted numeric value timeline----<ComponentPreview name="progress" />+<UiComponentPreview name="progress" />A value-channel atom whose fill (`0`–`100`) is a pure function of the `value` prop or an interpolated `ProgressStyle` from `useProgressTransition`. The component reads no frame — only the value you give it. This is the **value-channel** variant of the primitive pattern: instead of a string-state timeline it drives a numeric fill channel directly, the same deviation used by the Cursor primitive.@@ -15,10 +15,6 @@ A value-channel atom whose fill (`0`–`100`) is a pure function of the `value`Installing `progress` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `progress` (the renderer) and `use-progress-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="progress-example" />-## Value stepsInstead of a string-state timeline, `useProgressTransition` takes an array of `ProgressStep` objects that describe a scripted fill path:diff --git a/content/docs/ui/components/radio.mdx b/content/docs/ui/components/radio.mdxindex 081b30f3..22cb158d 100644--- a/content/docs/ui/components/radio.mdx+++ b/content/docs/ui/components/radio.mdx@@ -3,7 +3,7 @@ title: Radiodescription: A radio whose checked/unchecked state is a pure function of the timeline----<ComponentPreview name="radio" />+<UiComponentPreview name="radio" />A state atom whose appearance (checked, unchecked) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (checked, unchecked) is a pure function of the `stInstalling `radio` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="radio-example" />-## States`RadioState` is:diff --git a/content/docs/ui/components/resizable.mdx b/content/docs/ui/components/resizable.mdxindex 078efbb7..5782754e 100644--- a/content/docs/ui/components/resizable.mdx+++ b/content/docs/ui/components/resizable.mdx@@ -3,7 +3,7 @@ title: Resizabledescription: A two-panel split container whose divider ratio and handle state are driven by a scripted dual-channel timeline----<ComponentPreview name="resizable" />+<UiComponentPreview name="resizable" />A dual-channel value atom whose panel split ratio (`0`–`1`) and handle appearance (`idle`, `hover`, `press`) are a pure function of the props it receives. The component reads no frame. This is a **dual-channel** variant of the value-channel pattern: `useResizableTransition` drives a numeric ratio channel and a handle-state channel independently through one `ResizableStyle`, so cursor-synced drag scenes compose naturally — the same pattern as the Slider primitive.@@ -15,10 +15,6 @@ A dual-channel value atom whose panel split ratio (`0`–`1`) and handle appearaInstalling `resizable` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `resizable` (the renderer) and `use-resizable-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="resizable-example" />-## Ratio & handle`useResizableTransition` takes an array of `ResizableStep` objects. Each step can advance the **ratio channel**, the **handle channel**, or both in the same keyframe:diff --git a/content/docs/ui/components/select.mdx b/content/docs/ui/components/select.mdxindex a723b7b6..a00d7184 100644--- a/content/docs/ui/components/select.mdx+++ b/content/docs/ui/components/select.mdx@@ -3,7 +3,7 @@ title: Selectdescription: A dropdown select container with opened/closed states and item panel----<ComponentPreview name="select" />+<UiComponentPreview name="select" />A state atom representing a complete select dropdown: a trigger button and a panel of selectable items. Its appearance (opened, closed) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The panel reveals below the trigger with opacity, scale, and vertical translation animations.@@ -15,10 +15,6 @@ A state atom representing a complete select dropdown: a trigger button and a panInstalling `select` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`), the `button` primitive, and the `select-item` atom via `registryDependencies` (`["remocn-ui", "button", "select-item"]`). You do not need to install them separately. The trigger reuses the Button `outline` variant, and the panel renders a column of SelectItem rows.</Note>-## Example--<LiveExample name="select-example" />-## States`SelectState` is:diff --git a/content/docs/ui/components/sheet.mdx b/content/docs/ui/components/sheet.mdxindex b9108337..d30b904f 100644--- a/content/docs/ui/components/sheet.mdx+++ b/content/docs/ui/components/sheet.mdx@@ -3,7 +3,7 @@ title: Sheetdescription: A side panel whose opened/closed state is a pure function of the timeline----<ComponentPreview name="sheet" />+<UiComponentPreview name="sheet" />A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: Sheet is a modal layer meant to compose over another scene, so it does not paint an opaque background. Unlike Dialog (a centered popup that zooms in), Sheet is a right-edge side panel: a full-height flush panel anchored to the right that slides in horizontally, with a close (X) button in its top-right corner.@@ -15,10 +15,6 @@ A state atom whose appearance (closed, opened) is a pure function of the `state`Installing `sheet` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. If you want to pair Sheet with the Button as its trigger in the canonical lifecycle example, install `button` separately.</Note>-## Example--<LiveExample name="sheet-example" />-## States`SheetState` is:diff --git a/content/docs/ui/components/skeleton.mdx b/content/docs/ui/components/skeleton.mdxindex 7613852b..cc6d7475 100644--- a/content/docs/ui/components/skeleton.mdx+++ b/content/docs/ui/components/skeleton.mdx@@ -3,7 +3,7 @@ title: Skeletondescription: A shimmer placeholder that crossfades to real content when loaded----<ComponentPreview name="skeleton" />+<UiComponentPreview name="skeleton" />A state atom that crossfades between a shimmer placeholder and real content. Its appearance (`loading`, `loaded`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the animated `SkeletonBlock` motion atom inside the placeholder does. The two opacity layers always sum to 1 so the crossfade never dims the bounding box.@@ -15,10 +15,6 @@ A state atom that crossfades between a shimmer placeholder and real content. ItsInstalling `skeleton` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) and the `skeleton-block` motion atom via `registryDependencies` (`["remocn-ui", "skeleton-block"]`). You do not need to install them separately. `skeleton` (the state atom), `use-skeleton-transition` (the hook), and `skeleton-block` (the shimmer renderer) are all copied into your project.</Note>-## Example--<LiveExample name="skeleton-example" />-## States`SkeletonState` is:diff --git a/content/docs/ui/components/slider.mdx b/content/docs/ui/components/slider.mdxindex 2763d4bd..b598cd5b 100644--- a/content/docs/ui/components/slider.mdx+++ b/content/docs/ui/components/slider.mdx@@ -3,7 +3,7 @@ title: Sliderdescription: A range slider with a draggable thumb driven by a scripted value and thumb-state timeline----<ComponentPreview name="slider" />+<UiComponentPreview name="slider" />A dual-channel value atom whose fill (`0`–`100`) and thumb appearance (`idle`, `hover`, `press`) are a pure function of the props it receives. The component reads no frame. This is a **dual-channel** variant of the value-channel pattern: `useSliderTransition` drives a numeric fill channel and a thumb-state channel independently through one `SliderStyle`, so cursor-synced drag scenes compose naturally.@@ -15,10 +15,6 @@ A dual-channel value atom whose fill (`0`–`100`) and thumb appearance (`idle`,Installing `slider` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `slider` (the renderer) and `use-slider-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="slider-example" />-## Value & thumb`useSliderTransition` takes an array of `SliderStep` objects. Each step can advance the **value channel**, the **thumb channel**, or both in the same keyframe:diff --git a/content/docs/ui/components/stepper.mdx b/content/docs/ui/components/stepper.mdxindex 7b63d703..2297dff7 100644--- a/content/docs/ui/components/stepper.mdx+++ b/content/docs/ui/components/stepper.mdx@@ -3,7 +3,7 @@ title: Stepperdescription: A multi-step progress indicator that advances along a scripted numeric position timeline----<ComponentPreview name="stepper" />+<UiComponentPreview name="stepper" />A value-channel atom whose active position (`0`–`n-1`) is a pure function of the `activeIndex` prop or an interpolated `StepperStyle` from `useStepperTransition`. The component reads no frame — only the position you give it. This is the **value-channel** variant of the primitive pattern: instead of a string-state timeline it drives a continuous numeric position channel, the same deviation used by the Progress primitive.@@ -17,10 +17,6 @@ As `position` advances, each circle fills from muted to primary, the checkmark dInstalling `stepper` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `stepper` (the renderer) and `use-stepper-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="stepper-example" />-## Step positionInstead of a string-state timeline, `useStepperTransition` takes an array of `StepperStep` objects that describe a scripted index path:diff --git a/content/docs/ui/components/switch.mdx b/content/docs/ui/components/switch.mdxindex 00b17085..733d8ce2 100644--- a/content/docs/ui/components/switch.mdx+++ b/content/docs/ui/components/switch.mdx@@ -3,7 +3,7 @@ title: Switchdescription: A switch whose checked/unchecked state is a pure function of the timeline----<ComponentPreview name="switch" />+<UiComponentPreview name="switch" />A state atom whose appearance (checked, unchecked) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (checked, unchecked) is a pure function of the `stInstalling `switch` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="switch-example" />-## States`SwitchState` is:diff --git a/content/docs/ui/components/tabs.mdx b/content/docs/ui/components/tabs.mdxindex 359eff71..487e259a 100644--- a/content/docs/ui/components/tabs.mdx+++ b/content/docs/ui/components/tabs.mdx@@ -3,7 +3,7 @@ title: Tabsdescription: A tabs widget whose active-tab state is a pure function of the timeline----<ComponentPreview name="tabs" />+<UiComponentPreview name="tabs" />A state atom whose appearance (which tab is active) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom whose appearance (which tab is active) is a pure function of the `sInstalling `tabs` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="tabs-example" />-## States`TabsState` is:diff --git a/content/docs/ui/components/toast.mdx b/content/docs/ui/components/toast.mdxindex 7672adff..922b12f7 100644--- a/content/docs/ui/components/toast.mdx+++ b/content/docs/ui/components/toast.mdx@@ -3,7 +3,7 @@ title: Toastdescription: A notification that slides in from below, holds, then auto-dismisses----<ComponentPreview name="toast" />+<UiComponentPreview name="toast" />A state atom whose appearance (`hidden`, `visible`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The toast enters from 16 px below at 0.97 scale, fades and scales up to rest, then reverses on dismiss.@@ -15,10 +15,6 @@ A state atom whose appearance (`hidden`, `visible`) is a pure function of the `sInstalling `toast` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `toast` (the renderer) and `use-toast-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="toast-example" />-## States`ToastState` is:diff --git a/content/docs/ui/components/toggle-group.mdx b/content/docs/ui/components/toggle-group.mdxindex 7b7429d7..8dd54bf6 100644--- a/content/docs/ui/components/toggle-group.mdx+++ b/content/docs/ui/components/toggle-group.mdx@@ -3,7 +3,7 @@ title: Toggle Groupdescription: A segmented control whose active value slides a thumb indicator between segments----<ComponentPreview name="toggle-group" />+<UiComponentPreview name="toggle-group" />A state atom representing a segmented button control — a row of labeled segments with a sliding thumb indicator that moves to the active one. Its appearance (which segment is active) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it.@@ -15,10 +15,6 @@ A state atom representing a segmented button control — a row of labeled segmenInstalling `toggle-group` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.</Note>-## Example--<LiveExample name="toggle-group-example" />-## States`ToggleGroupState` is:diff --git a/content/docs/ui/components/tooltip.mdx b/content/docs/ui/components/tooltip.mdxindex 3e24e316..325df11c 100644--- a/content/docs/ui/components/tooltip.mdx+++ b/content/docs/ui/components/tooltip.mdx@@ -3,7 +3,7 @@ title: Tooltipdescription: A small floating label that appears above an anchor on hover----<ComponentPreview name="tooltip" />+<UiComponentPreview name="tooltip" />A state atom whose appearance (`hidden`, `visible`) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The tooltip fades in at 0.96 scale, slides 4 px toward the anchor, and rests fully visible; `hidden` reverses the motion. Placement is the caller's responsibility — the tooltip renders inline and the caller wraps it in an absolutely-positioned anchor div.@@ -15,10 +15,6 @@ A state atom whose appearance (`hidden`, `visible`) is a pure function of the `sInstalling `tooltip` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. Both `tooltip` (the renderer) and `use-tooltip-transition` (the hook) are copied into your project.</Note>-## Example--<LiveExample name="tooltip-example" />-## States`TooltipState` is:diff --git a/lib/ui-preview-internals.tsx b/lib/ui-preview-internals.tsxnew file mode 100644index 00000000..d66d7110--- /dev/null+++ b/lib/ui-preview-internals.tsx@@ -0,0 +1,151 @@+"use client";++import { Player } from "@remotion/player";+import { PlayIcon } from "lucide-react";+import {+ parseAsBoolean,+ parseAsFloat,+ parseAsString,+ parseAsStringLiteral,+} from "nuqs";+import { useEffect, useRef, useState } from "react";+import type { ControlConfig } from "@/lib/customizer-config";+import { usePrefersReducedMotion } from "@/lib/use-prefers-reduced-motion";+import { cn } from "@/lib/utils";++/**+ * Shared internals for the docs preview widgets. Extracted verbatim from+ * `components/docs/component-preview.tsx` so both the original `ComponentPreview`+ * (animation tier) and the `UiComponentPreview` (ui tier) consume one+ * implementation — no copy-paste drift on the shared path.+ *+ * `getDefaults` already lives in `lib/customizer-config.ts`; reuse it from there.+ */++/**+ * Build nuqs parsers + URL keys from a control config. Each control becomes a+ * URL-synced query param prefixed with the component name (dashes → underscores)+ * so multiple previews on one page never collide.+ */+export function buildParsers(name: string, controls: ControlConfig) {+ const parsers: Record<string, any> = {};+ const urlKeys: Record<string, string> = {};+ const prefix = name.replace(/-/g, "_");++ for (const [key, ctrl] of Object.entries(controls)) {+ urlKeys[key] = `${prefix}_${key}`;+ if (ctrl.type === "text") {+ parsers[key] = parseAsString.withDefault(ctrl.default);+ } else if (ctrl.type === "number") {+ parsers[key] = parseAsFloat.withDefault(ctrl.default);+ } else if (ctrl.type === "color") {+ parsers[key] = parseAsString.withDefault(ctrl.default);+ } else if (ctrl.type === "select") {+ parsers[key] = parseAsStringLiteral(+ ctrl.options as readonly string[],+ ).withDefault(ctrl.default);+ } else if (ctrl.type === "boolean") {+ parsers[key] = parseAsBoolean.withDefault(ctrl.default);+ }+ }+ return { parsers, urlKeys };+}++/**+ * D2 — lazy-mount the Remotion player. Until the stage enters the viewport+ * (IntersectionObserver) or the user clicks the poster, render a labeled+ * poster button that exactly matches the Suspense fallback dimensions, so the+ * live Player swaps in with zero layout shift.+ *+ * Timing fields are passed flat (durationInFrames/fps/compositionWidth/+ * compositionHeight) so the caller can source them from either the registry+ * config (animation tier) or the example entry (ui tier — D2: example owns+ * timing).+ */+export function PreviewStage({+ name,+ Component,+ inputProps,+ durationInFrames,+ fps,+ compositionWidth,+ compositionHeight,+}: {+ name: string;+ Component: React.ComponentType<any>;+ inputProps: Record<string, unknown>;+ durationInFrames: number;+ fps: number;+ compositionWidth: number;+ compositionHeight: number;+}) {+ const [mounted, setMounted] = useState(false);+ const frameRef = useRef<HTMLDivElement>(null);+ const reducedMotion = usePrefersReducedMotion();++ useEffect(() => {+ if (mounted) return;+ const el = frameRef.current;+ if (!el || typeof IntersectionObserver === "undefined") return;+ const observer = new IntersectionObserver(+ (entries) => {+ if (entries.some((entry) => entry.isIntersecting)) {+ setMounted(true);+ observer.disconnect();+ }+ },+ { rootMargin: "200px 0px" },+ );+ observer.observe(el);+ return () => observer.disconnect();+ }, [mounted]);++ return (+ <div+ ref={frameRef}+ // Slightly shorter than 16:9 so the player takes a touch less vertical+ // space. Compositions are a strict 1280×720 (16:9), so the Player letterboxes+ // the small delta against the surface-card background while staying full-width+ // and aligned with the tabs/customize panel. The Suspense fallback above uses+ // the same ratio to keep zero layout shift.+ className="surface-card aspect-video w-full overflow-hidden rounded-2xl"+ >+ {mounted ? (+ <div+ className={cn(+ "size-full",+ !reducedMotion && "animate-in fade-in duration-300 ease-out",+ )}+ >+ <Player+ component={Component}+ inputProps={inputProps}+ durationInFrames={durationInFrames}+ fps={fps}+ compositionWidth={compositionWidth}+ compositionHeight={compositionHeight}+ style={{ width: "100%", height: "100%" }}+ controls+ loop+ autoPlay+ acknowledgeRemotionLicense+ />+ </div>+ ) : (+ <button+ type="button"+ onClick={() => setMounted(true)}+ aria-label={`Play preview of ${name}`}+ className={cn(+ "group flex size-full items-center justify-center bg-muted/40 transition-colors",+ "hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",+ )}+ >+ <span className="flex size-12 items-center justify-center rounded-full bg-background/80 text-foreground transition-colors group-hover:bg-background">+ <PlayIcon className="size-5 translate-x-px fill-current" />+ </span>+ </button>+ )}+ </div>+ );+}diff --git a/mdx-components.tsx b/mdx-components.tsxindex 5bfa6dd3..a3915174 100644--- a/mdx-components.tsx+++ b/mdx-components.tsx@@ -3,8 +3,8 @@ import type { MDXComponents } from "mdx/types";import { Note, Warning } from "@/components/docs/callout";import { ComponentCardGrid } from "@/components/docs/component-card-grid";import { ComponentPreview } from "@/components/docs/component-preview";+import { UiComponentPreview } from "@/components/docs/ui-component-preview";import { Dependencies } from "@/components/docs/dependencies";-import { LiveExample } from "@/components/docs/live-example";import { InstallBlock } from "@/components/docs/install-block";import { PropsTable } from "@/components/docs/props-table";@@ -33,7 +33,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {// Custom doc widgets — registrations only, not reimplemented here.ComponentPreview,- LiveExample,+ UiComponentPreview,InstallBlock,PropsTable,Note,