Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added blurin component
dev_wandryfafd09ff1238
diff --git a/components/docs/examples/blur-in-example.tsx b/components/docs/examples/blur-in-example.tsxnew file mode 100644index 00000000..335d9f29--- /dev/null+++ b/components/docs/examples/blur-in-example.tsx@@ -0,0 +1,93 @@+"use client";++import { BlurIn } from "@/registry/remocn-ui/blur-in";+import { useBlurInTransition } from "@/registry/remocn-ui/blur-in/use-blur-in-transition";++export const blurInExampleControls = ["blur", "distance", "direction"] as const;++export interface BlurInExampleProps {+ blur?: number;+ distance?: number;+ direction?: "up" | "down" | "left" | "right";+}++export const BlurInExampleScene = (p: BlurInExampleProps = {}) => {+ const style = useBlurInTransition(+ [+ { at: 0, state: "hidden" },+ { at: 8, state: "revealed", duration: 18 },+ ],+ {+ blur: p.blur,+ distance: p.distance,+ direction: p.direction ?? "up",+ },+ );+ return (+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: "#ffffff",+ fontFamily:+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",+ }}+ >+ <BlurIn style={style}>+ <div+ style={{+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ width: 200,+ height: 120,+ borderRadius: 16,+ border: "1px solid #e5e5e5",+ background: "#fafafa",+ color: "#171717",+ fontSize: 18,+ fontWeight: 500,+ letterSpacing: "-0.01em",+ }}+ >+ Blur In+ </div>+ </BlurIn>+ </div>+ );+};++export const blurInExampleCode = (+ values: Record<string, unknown> = {},+): string => {+ const blur = values.blur as number | undefined;+ const distance = values.distance as number | undefined;+ const direction = values.direction as string | undefined;++ const hookOpts: string[] = [];+ if (direction !== undefined && direction !== "up")+ hookOpts.push(`direction: "${direction}"`);+ if (blur !== undefined && blur !== 8) hookOpts.push(`blur: ${blur}`);+ if (distance !== undefined && distance !== 12)+ hookOpts.push(`distance: ${distance}`);+ const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : "";++ return `import { BlurIn } from "@/components/remocn/blur-in";+import { useBlurInTransition } from "@/components/remocn/use-blur-in-transition";++export const Scene = () => {+ const style = useBlurInTransition([+ { at: 0, state: "hidden" },+ { at: 8, state: "revealed", duration: 18 },+ ]${optsStr});++ return (+ <BlurIn style={style}>+ <div className="rounded-2xl border px-8 py-6">Blur In</div>+ </BlurIn>+ );+};`;+};diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsxindex ff180e80..5a8bd3b7 100644--- a/components/docs/examples/index.tsx+++ b/components/docs/examples/index.tsx@@ -68,6 +68,7 @@ import {ResizableExampleScene,resizableExampleCode,} from "./resizable-example";+import { BlurInExampleScene, blurInExampleCode } from "./blur-in-example";export interface ExampleEntry {Component: ComponentType;@@ -317,4 +318,13 @@ export const examples: Record<string, ExampleEntry> = {width: W,height: H,},+ "blur-in-example": {+ Component: BlurInExampleScene,+ code: blurInExampleCode,+ // Reveal completes at 8 + dur 18 = 26; a short settle then loop.+ durationInFrames: 40,+ fps: FPS,+ width: W,+ height: H,+ },};diff --git a/components/docs/ui-component-preview.tsx b/components/docs/ui-component-preview.tsxindex bf8f8745..4cfbd1eb 100644--- a/components/docs/ui-component-preview.tsx+++ b/components/docs/ui-component-preview.tsx@@ -71,6 +71,7 @@ import {toggleGroupExampleCode,toggleGroupExampleControls,} from "./examples/toggle-group-example";+import { blurInExampleCode, blurInExampleControls } from "./examples/blur-in-example";/*** Per-component honored-key allowlist + code template, co-located with each@@ -131,6 +132,7 @@ const UI_SCENE_META: Record<string, UiSceneMeta> = {controls: toggleGroupExampleControls,code: toggleGroupExampleCode,},+ "blur-in": { controls: blurInExampleControls, code: blurInExampleCode },};/**diff --git a/content/docs/ui/components/blur-in.mdx b/content/docs/ui/components/blur-in.mdxnew file mode 100644index 00000000..e4cd505a--- /dev/null+++ b/content/docs/ui/components/blur-in.mdx@@ -0,0 +1,191 @@+---+title: Blur In+description: A wrapper that reveals a single child with blur, opacity, and a directional offset+---++<UiComponentPreview name="blur-in" />++A state atom that wraps a **single child** and reveals it with blur + opacity + a directional offset. Its appearance (`hidden`, `revealed`) 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 the other remocn-ui atoms, `blur-in` is **theme-independent**: it carries no colors and has no `theme`/`mode`/`primary` props. Its only inputs are the motion knobs — `blur`, `direction`, and `distance`.++## Installation++<InstallBlock name="blur-in" />++<Note>+Installing `blur-in` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.+</Note>++## States++`BlurInState` is:++```ts+type BlurInState =+ | "hidden" // blurred, transparent, offset `distance` px opposite `direction`+ | "revealed" // sharp, fully opaque, no offset (settled in place)+```++`hidden` is the entrance pose: the child is blurred by `blur` px, fully transparent, and starts `distance` px on the **opposite** side of `direction` — so as it reveals it travels INTO `direction` and settles in place. For example `direction="up"` starts the child below and slides it up. `revealed` is the settled pose: zero blur, full opacity, no offset.++## Snap usage (simple path)++Pass `state` directly — the component snaps instantly to that visual:++```tsx+import { BlurIn } from "@/components/remocn/blur-in";++export const Scene = () => (+ <BlurIn state="revealed" direction="up">+ <YourElement />+ </BlurIn>+);+```++To drive state from the timeline, use `useCurrentState`:++```tsx+import { useCurrentState } from "@/lib/remocn-ui";+import { BlurIn } from "@/components/remocn/blur-in";++export const Scene = () => {+ const state = useCurrentState(+ [+ { at: 0, state: "hidden" },+ { at: 8, state: "revealed" },+ ],+ "hidden",+ );++ return (+ <BlurIn state={state}>+ <YourElement />+ </BlurIn>+ );+};+```++Each `at` is a **Sequence-local authored frame**. State persists between steps. See [Concepts](/docs/ui/concepts) for the full `useCurrentState` API.++## Smooth transitions (opt-in)++State changes via `state` snap with no cross-fade. For an animated reveal, use `useBlurInTransition` from the copied `use-blur-in-transition.ts` file. It reads the frame, interpolates between the `hidden` and `revealed` presets, and returns a resolved `BlurInStyle` — pass it to the `style` prop:++```tsx+import { BlurIn } from "@/components/remocn/blur-in";+import { useBlurInTransition } from "@/components/remocn/use-blur-in-transition";++export const Scene = () => {+ const style = useBlurInTransition([+ { at: 0, state: "hidden" },+ { at: 8, state: "revealed", duration: 18 },+ ]);++ return (+ <BlurIn style={style}>+ <YourElement />+ </BlurIn>+ );+};+```++The `duration` field on each step overrides the file's `DEFAULT_DURATION` for that specific transition. To globally tune timing and easing, edit `use-blur-in-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).++`style` takes precedence over `state` when both are provided.++## Direction and distance++`direction` is the way the child travels **into place**: `up` starts below, `down` starts above, `left` starts to the right, `right` starts to the left. Pass it to `useBlurInTransition` (or the `direction` prop on the snap path) to choose the entrance vector.++Set `distance={0}` to disable the slide entirely — the child then reveals with blur + opacity only, in place.++The `direction`, `blur`, and `distance` knobs are the whole "context". There is **no theme** here: `blur-in` is purely a motion wrapper, so it composes around any element regardless of palette.++## Staggering multiple elements++`BlurIn` wraps a **single child**. To stagger a row or column, wrap each element in its own `BlurIn` and offset the `at` of each timeline:++```tsx+import { BlurIn } from "@/components/remocn/blur-in";+import { useBlurInTransition } from "@/components/remocn/use-blur-in-transition";++// One wrapper per element — the hook must be called at the top level of a+// component, never inside a `.map()` callback (Rules of Hooks).+const BlurInItem = ({ label, delay }: { label: string; delay: number }) => {+ const style = useBlurInTransition([+ { at: delay, state: "hidden" },+ { at: delay + 4, state: "revealed", duration: 18 },+ ]);+ return (+ <BlurIn style={style}>+ <div className="rounded-xl border px-6 py-4">{label}</div>+ </BlurIn>+ );+};++export const Scene = () => {+ const items = ["One", "Two", "Three"];+ return (+ <div style={{ display: "flex", gap: 16 }}>+ {items.map((label, i) => (+ <BlurInItem key={label} label={label} delay={i * 6} />+ ))}+ </div>+ );+};+```++Each child gets its own `useBlurInTransition`, staggered by its index.++## Props++<PropsTable+ rows={[+ {+ name: "state",+ type: "\"hidden\" | \"revealed\"",+ default: "\"hidden\"",+ description: "Current visual state (snap path). State changes snap — no automatic cross-fade.",+ },+ {+ name: "style",+ type: "BlurInStyle",+ description: "Resolved animated visual (smooth path). Pass an interpolated BlurInStyle from useBlurInTransition. Takes precedence over state when provided.",+ },+ {+ name: "children",+ type: "ReactNode",+ description: "The single element revealed by the blur / opacity / offset.",+ },+ {+ name: "blur",+ type: "number",+ default: "8",+ description: "Hidden-state blur radius in px. 0 = no blur.",+ },+ {+ name: "direction",+ type: "\"up\" | \"down\" | \"left\" | \"right\"",+ default: "\"up\"",+ description: "Direction the child travels INTO place. up starts below, down above, left from the right, right from the left.",+ },+ {+ name: "distance",+ type: "number",+ default: "12",+ description: "Hidden-state offset distance in px. Set to 0 to disable the slide (blur + opacity only).",+ },+ {+ name: "display",+ type: "CSSProperties[\"display\"]",+ default: "\"inline-block\"",+ description: "CSS display for the wrapper. inline-block sizes the wrapper to the child by default.",+ },+ {+ name: "className",+ type: "string",+ description: "Optional className passed to the wrapper element.",+ },+ ]}+/>diff --git a/content/docs/ui/components/meta.json b/content/docs/ui/components/meta.jsonindex 9c878de8..ddae1dfd 100644--- a/content/docs/ui/components/meta.json+++ b/content/docs/ui/components/meta.json@@ -1,5 +1,5 @@{"title": "Components","collapsible": false,- "pages": ["accordion", "alert-dialog", "button", "checkbox", "combobox", "command-menu", "context-menu", "cursor", "dialog", "drawer", "sheet", "dropdown-menu", "input", "popover", "progress", "radio", "resizable", "select", "skeleton", "slider", "spinner", "stepper", "switch", "tabs", "toast", "toggle-group", "tooltip"]+ "pages": ["accordion", "alert-dialog", "blur-in", "button", "checkbox", "combobox", "command-menu", "context-menu", "cursor", "dialog", "drawer", "sheet", "dropdown-menu", "input", "popover", "progress", "radio", "resizable", "select", "skeleton", "slider", "spinner", "stepper", "switch", "tabs", "toast", "toggle-group", "tooltip"]}diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 520969ca..d1311ae4 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -121,6 +121,8 @@ import { Checkbox } from "@/registry/remocn-ui/checkbox";import { checkboxConfig } from "@/registry/remocn-ui/checkbox/config";import { Input } from "@/registry/remocn-ui/input";import { inputConfig } from "@/registry/remocn-ui/input/config";+import { BlurInPreview } from "@/registry/remocn-ui/blur-in/preview";+import { blurInConfig } from "@/registry/remocn-ui/blur-in/config";import { Radio } from "@/registry/remocn-ui/radio";import { radioConfig } from "@/registry/remocn-ui/radio/config";import { Spinner } from "@/registry/remocn-ui/spinner";@@ -348,6 +350,10 @@ const registry: Record<string, RegistryEntry> = {"drawer": { Component: Drawer, config: drawerConfig },"checkbox": { Component: Checkbox, config: checkboxConfig },"input": { Component: Input, config: inputConfig },+ // blur-in WRAPS a single child, so the customizer Component is the+ // preview-only BlurInPreview wrapper (it supplies a fixed sample card and+ // centers it on a stage); the shipped BlurIn is a pure child-wrapper.+ "blur-in": { Component: BlurInPreview, config: blurInConfig },"radio": { Component: Radio, config: radioConfig },"switch": { Component: Switch, config: switchConfig },"select": { Component: Select, config: selectConfig },diff --git a/registry/remocn-ui/blur-in/__tests__/README.md b/registry/remocn-ui/blur-in/__tests__/README.mdnew file mode 100644index 00000000..311bcba4--- /dev/null+++ b/registry/remocn-ui/blur-in/__tests__/README.md@@ -0,0 +1,111 @@+# `blur-in` — verification tests++Pure / deterministic verification for the `blur-in` component+(`registry/remocn-ui/blur-in/`). The RENDER path needs Remotion's+`useCurrentFrame()` and cannot run headless, so the render is NOT exercised+here. This suite covers the pieces that ARE pure: `BlurInState` union+membership, `blurInConfig.controls` wiring, `blurInConfig.snippet` codegen,+`blurInStyleContext` (direction → axis/sign), `blurInStyle` presets, and+`tweenBlurInStyle` interpolation.++## Animation model — pure snap + opt-in smooth path++BlurIn ships two complementary paths:++**Snap path** (`state?: BlurInState` prop):+`BlurIn` is a frame-free pure renderer. The `state` prop (`hidden` | `revealed`)+drives all visuals. Each state maps to a complete resting visual via the+exported pure function `blurInStyle(state, ctx) => BlurInStyle`. State changes+snap instantly — no tweening inside the component.++**Smooth path** (`style?: BlurInStyle` prop):+Callers opt in to smooth transitions by passing a pre-interpolated `BlurInStyle`+to the `style` prop. The caller — typically `useBlurInTransition` — reads+`useCurrentFrame()` and calls `useStateTransition` from `core/timeline.ts` to+compute `{ from, to, progress }`, then blends the two presets via+`tweenBlurInStyle(from, to, t)`. The `BlurIn` component itself remains+frame-free; it simply renders whatever `BlurInStyle` it receives.++## Theme-independence (the one deviation)++Unlike the other state atoms (Button, Input, …), `blur-in` is+**THEME-INDEPENDENT**. It carries no colors and has no `theme`/`mode`/`primary`+props. Its "context" (`BlurInStyleContext`) is a MOTION config —+`{ blur, distance, axis, sign }` — derived from the `direction`, not a theme.+So this suite imports no theme fixture; the presets are tested with plain+`blurInStyleContext(blur, direction, distance)` calls.++## How to run++The repo uses **Bun**, which has a built-in test runner — runs TypeScript+natively, no test-framework dep.++```bash+bun install+bun test registry/remocn-ui/blur-in/__tests__+```++`blur-in.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test script+or framework dep is added to `package.json`.++## What is covered++- **`BlurInState` union** — asserts the two states `["hidden","revealed"]` are+ the complete set (via the real `controls.state.options` list from `config.ts`).+- **`blurInConfig.controls`** — the customizer control wiring. Asserts the+ `state` select (options `["hidden","revealed"]`, default `"revealed"`), the+ `direction` select (`["up","down","left","right"]`, default `"up"`), and the+ numeric `blur` (default 8, range [0,40]) and `distance` (default 12, range+ [0,80]) knobs.+- **`blurInStyleContext`** — exported pure `(blur, direction, distance) => ctx`.+ Asserts each direction's axis/sign: up→y/+1, down→y/−1, left→x/+1, right→x/−1,+ and that blur/distance pass straight through.+- **`blurInStyle` presets** — exported pure `(state, ctx) => BlurInStyle` map.+ Asserts `revealed` is always `{blur:0,opacity:1,translateX:0,translateY:0}`+ (direction-independent) and `hidden` carries `ctx.blur`, opacity 0, and the+ directional offset (`ctx.sign * ctx.distance`) on the ctx axis (other axis 0),+ for all four directions. Also: `distance=0` disables the offset.+- **`tweenBlurInStyle`** — exported pure `(a, b, t) => BlurInStyle`. Asserts:+ at t=0 all four numeric fields equal `a`; at t=1 all equal `b`; at t=0.5 each+ numeric field is the exact midpoint (blur 8→0 gives 4, opacity 0→1 gives 0.5,+ translateY 12→0 gives 6 on the y axis, translateX 12→0 gives 6 on the x axis).+- **`blurInConfig.snippet`** — REAL pure string builder. Asserts: emits+ `state="<state>"` for every option; includes `import { BlurIn }` from+ `@/components/remocn/blur-in`; omits default-equal props (`direction=up`,+ `blur=8`, `distance=12`); never emits the preview-only `speed` knob; EMITS+ non-default `direction`/`blur`/`distance`; structural round-trip (starts with+ import, contains `<BlurIn`, closes with `</BlurIn>`).++**BlurIn render** is a pure `(style | state) => visual` observable only via+Remotion render, not unit-tested here.++## Import strategy++`blur-in.test.ts` imports via **relative paths**:++- `../index` — for `BlurInState`, `BlurInDirection`, `blurInStyle`, `blurInStyleContext`+- `../use-blur-in-transition` — for `tweenBlurInStyle`+- `../config` — for `blurInConfig`++Importing `index.tsx` and `use-blur-in-transition.ts` pulls the `remotion`+module (and React), but neither `blurInStyle`, `blurInStyleContext`, nor+`tweenBlurInStyle` call `useCurrentFrame()` at import time or at call time —+they are pure value functions. `bun test` resolves tsconfig `paths`, so the+`@/lib/remocn-ui` and `@/components/remocn/blur-in` aliases the hook uses work+without additional config.++## Determinism grep checklist (run manually; must print NOTHING)++BlurIn is frame-free. The component must contain **none** of the following:++```bash+grep -nE "useCurrentFrame|useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random|requestAnimationFrame" \+ registry/remocn-ui/blur-in/index.tsx+```++Expected: no output. Any match is a determinism violation.++`use-blur-in-transition.ts` is the CALLER hook that intentionally reads+`useCurrentFrame()` (via `useStateTransition`). It is not a render component;+the smooth-path design isolates all frame-reading to the hook, keeping+`BlurIn` pure.diff --git a/registry/remocn-ui/blur-in/__tests__/blur-in.test.ts b/registry/remocn-ui/blur-in/__tests__/blur-in.test.tsnew file mode 100644index 00000000..91867166--- /dev/null+++ b/registry/remocn-ui/blur-in/__tests__/blur-in.test.ts@@ -0,0 +1,419 @@+/**+ * Verification tests for the PURE / DETERMINISTIC parts of `blur-in`.+ *+ * Scope:+ * - registry/remocn-ui/blur-in/index.tsx — BlurInState union membership,+ * blurInStyleContext (direction → axis/sign), blurInStyle presets+ * - registry/remocn-ui/blur-in/config.ts — blurInConfig.controls.state+ * wiring + blurInConfig.snippet output (the state → JSX codegen)+ * - registry/remocn-ui/blur-in/use-blur-in-transition.ts — tweenBlurInStyle lerp+ *+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.+ * Every visual is the complete resting look for that state — state changes+ * snap (no tweening). `useBlurInTransition` reads `useCurrentFrame()` via+ * `useStateTransition`; it cannot run outside a Remotion render tree.+ * So BlurIn render is NOT exercised here. The pure-testable surface is the+ * customizer wiring + snippet codegen + style presets + tween (below).+ *+ * blur-in is THEME-INDEPENDENT: no theme/mode/primary anywhere, and the+ * "context" is a MOTION config (blur/distance/axis/sign), so no theme fixture+ * is imported here (unlike the other state atoms).+ *+ * Runner: Bun's built-in test runner (TypeScript-native, no framework dep).+ * bun test registry/remocn-ui/blur-in/__tests__+ *+ * --------------------------------------------------------------------------+ * IMPORT STRATEGY+ * --------------------------------------------------------------------------+ * The pieces under test never CALL a Remotion runtime API at import time —+ * `blurInConfig` is a plain object; `.snippet` is a pure string builder;+ * `blurInStyle`/`blurInStyleContext` are pure value functions;+ * `tweenBlurInStyle` is a pure lerp function.+ * We import via RELATIVE paths (matching the existing test suite pattern),+ * annotating each import with the source it corresponds to.+ * --------------------------------------------------------------------------+ */++import { describe, expect, it } from "bun:test";+import {+ type BlurInDirection,+ type BlurInState,+ blurInStyle,+ blurInStyleContext,+} from "../index";+import { tweenBlurInStyle } from "../use-blur-in-transition";+import { blurInConfig } from "../config";++// ===========================================================================+// Shared fixtures+// ===========================================================================++/**+ * The BlurInState union, enumerated as a runtime list for membership checks.+ * Must stay in sync with `export type BlurInState` in index.tsx.+ */+const VALID_STATES: readonly BlurInState[] = ["hidden", "revealed"];++/** The BlurInDirection union, enumerated as a runtime list. */+const VALID_DIRECTIONS: readonly BlurInDirection[] = [+ "up",+ "down",+ "left",+ "right",+];++/** Minimal shape mirroring the customizer's value bag passed to snippet(). */+type SnippetValues = {+ state?: string;+ blur?: number;+ distance?: number;+ direction?: string;+};++const snippet = (values: SnippetValues): string =>+ blurInConfig.snippet(values as Record<string, unknown>);++// ===========================================================================+// 1. BlurInState union membership+// ===========================================================================++describe("BlurInState union", () => {+ it("contains exactly the two documented states", () => {+ const control = blurInConfig.controls.state;+ if (control.type !== "select")+ throw new Error("state control must be a select");+ expect(control.options).toEqual(["hidden", "revealed"]);+ });++ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {+ const control = blurInConfig.controls.state;+ if (control.type !== "select")+ throw new Error("state control must be a select");+ expect(VALID_STATES).toHaveLength(2);+ for (const s of VALID_STATES) {+ expect(control.options).toContain(s);+ }+ });+});++// ===========================================================================+// 2. blurInConfig.controls — customizer control wiring+// ===========================================================================++describe("blurInConfig.controls.state", () => {+ it("is a select control", () => {+ expect(blurInConfig.controls.state.type).toBe("select");+ });++ it("has exactly the two BlurInState options in order", () => {+ const control = blurInConfig.controls.state;+ if (control.type !== "select")+ throw new Error("state control must be a select");+ expect(control.options).toEqual(["hidden", "revealed"]);+ });++ it("defaults to 'revealed' so the preview shows the settled child", () => {+ expect(blurInConfig.controls.state.default).toBe("revealed");+ });+});++describe("blurInConfig.controls.direction", () => {+ it("is a select with the four directions, default 'up'", () => {+ const control = blurInConfig.controls.direction;+ if (control.type !== "select")+ throw new Error("direction control must be a select");+ expect(control.options).toEqual(["up", "down", "left", "right"]);+ expect(control.default).toBe("up");+ });+});++describe("blurInConfig.controls numeric knobs", () => {+ it("blur defaults to 8 within [0, 40]", () => {+ const control = blurInConfig.controls.blur;+ if (control.type !== "number")+ throw new Error("blur control must be a number");+ expect(control.default).toBe(8);+ expect(control.min).toBe(0);+ expect(control.max).toBe(40);+ });++ it("distance defaults to 12 within [0, 80]", () => {+ const control = blurInConfig.controls.distance;+ if (control.type !== "number")+ throw new Error("distance control must be a number");+ expect(control.default).toBe(12);+ expect(control.min).toBe(0);+ expect(control.max).toBe(80);+ });+});++// ===========================================================================+// 3. blurInStyleContext — direction → motion config (axis + sign)+// up → y / +1 (starts BELOW, travels up into place)+// down → y / −1 (starts above, travels down into place)+// left → x / +1 (starts to the right, travels left into place)+// right → x / −1 (starts to the left, travels right into place)+// ===========================================================================++describe("blurInStyleContext: direction → axis + sign", () => {+ it("up → axis y, sign +1", () => {+ const ctx = blurInStyleContext(8, "up", 12);+ expect(ctx.axis).toBe("y");+ expect(ctx.sign).toBe(1);+ });++ it("down → axis y, sign −1", () => {+ const ctx = blurInStyleContext(8, "down", 12);+ expect(ctx.axis).toBe("y");+ expect(ctx.sign).toBe(-1);+ });++ it("left → axis x, sign +1", () => {+ const ctx = blurInStyleContext(8, "left", 12);+ expect(ctx.axis).toBe("x");+ expect(ctx.sign).toBe(1);+ });++ it("right → axis x, sign −1", () => {+ const ctx = blurInStyleContext(8, "right", 12);+ expect(ctx.axis).toBe("x");+ expect(ctx.sign).toBe(-1);+ });++ it("carries blur and distance straight through", () => {+ const ctx = blurInStyleContext(16, "up", 40);+ expect(ctx.blur).toBe(16);+ expect(ctx.distance).toBe(40);+ });++ it("every direction yields a valid axis/sign pair", () => {+ for (const direction of VALID_DIRECTIONS) {+ const ctx = blurInStyleContext(8, direction, 12);+ expect(["x", "y"]).toContain(ctx.axis);+ expect([1, -1]).toContain(ctx.sign);+ }+ });+});++// ===========================================================================+// 4. blurInStyle presets — pure (state, ctx) => BlurInStyle+// revealed is always { blur:0, opacity:1, translateX:0, translateY:0 }.+// hidden carries ctx.blur, opacity 0, and the directional offset on the+// ctx axis (ctx.sign * ctx.distance), the other axis 0.+// Built with blur=8, distance=12 ctx (the control defaults).+// ===========================================================================++describe("blurInStyle: revealed preset (direction-independent)", () => {+ for (const direction of VALID_DIRECTIONS) {+ const ctx = blurInStyleContext(8, direction, 12);+ const s = blurInStyle("revealed", ctx);++ it(`revealed (${direction}) → blur 0, opacity 1, no offset`, () => {+ expect(s.blur).toBe(0);+ expect(s.opacity).toBe(1);+ expect(s.translateX).toBe(0);+ expect(s.translateY).toBe(0);+ });+ }+});++describe("blurInStyle: hidden preset per direction (blur=8, distance=12)", () => {+ it("up → blur 8, opacity 0, translateY +12, translateX 0", () => {+ const s = blurInStyle("hidden", blurInStyleContext(8, "up", 12));+ expect(s.blur).toBe(8);+ expect(s.opacity).toBe(0);+ expect(s.translateY).toBe(12);+ expect(s.translateX).toBe(0);+ });++ it("down → blur 8, opacity 0, translateY −12, translateX 0", () => {+ const s = blurInStyle("hidden", blurInStyleContext(8, "down", 12));+ expect(s.translateY).toBe(-12);+ expect(s.translateX).toBe(0);+ });++ it("left → blur 8, opacity 0, translateX +12, translateY 0", () => {+ const s = blurInStyle("hidden", blurInStyleContext(8, "left", 12));+ expect(s.translateX).toBe(12);+ expect(s.translateY).toBe(0);+ });++ it("right → blur 8, opacity 0, translateX −12, translateY 0", () => {+ const s = blurInStyle("hidden", blurInStyleContext(8, "right", 12));+ expect(s.translateX).toBe(-12);+ expect(s.translateY).toBe(0);+ });++ it("hidden blur equals ctx.blur (not hardcoded)", () => {+ const s = blurInStyle("hidden", blurInStyleContext(20, "up", 12));+ expect(s.blur).toBe(20);+ });++ it("distance 0 disables the offset on both axes", () => {+ for (const direction of VALID_DIRECTIONS) {+ const s = blurInStyle("hidden", blurInStyleContext(8, direction, 0));+ expect(s.translateX).toBe(0);+ expect(s.translateY).toBe(0);+ }+ });+});++// ===========================================================================+// 5. tweenBlurInStyle — pure linear interpolation between two BlurInStyles.+// All four fields are numbers and lerp linearly.+// ===========================================================================++describe("tweenBlurInStyle: t=0 returns values equal to `a`", () => {+ const a = blurInStyle("hidden", blurInStyleContext(8, "up", 12));+ const b = blurInStyle("revealed", blurInStyleContext(8, "up", 12));+ const r = tweenBlurInStyle(a, b, 0);++ it("blur equals a.blur at t=0", () => {+ expect(r.blur).toBeCloseTo(a.blur, 10);+ });+ it("opacity equals a.opacity at t=0", () => {+ expect(r.opacity).toBeCloseTo(a.opacity, 10);+ });+ it("translateX equals a.translateX at t=0", () => {+ expect(r.translateX).toBeCloseTo(a.translateX, 10);+ });+ it("translateY equals a.translateY at t=0", () => {+ expect(r.translateY).toBeCloseTo(a.translateY, 10);+ });+});++describe("tweenBlurInStyle: t=1 returns values equal to `b`", () => {+ const a = blurInStyle("hidden", blurInStyleContext(8, "up", 12));+ const b = blurInStyle("revealed", blurInStyleContext(8, "up", 12));+ const r = tweenBlurInStyle(a, b, 1);++ it("blur equals b.blur at t=1", () => {+ expect(r.blur).toBeCloseTo(b.blur, 10);+ });+ it("opacity equals b.opacity at t=1", () => {+ expect(r.opacity).toBeCloseTo(b.opacity, 10);+ });+ it("translateX equals b.translateX at t=1", () => {+ expect(r.translateX).toBeCloseTo(b.translateX, 10);+ });+ it("translateY equals b.translateY at t=1", () => {+ expect(r.translateY).toBeCloseTo(b.translateY, 10);+ });+});++describe("tweenBlurInStyle: t=0.5 midpoint numeric lerp (hidden up → revealed)", () => {+ // hidden(up): blur=8, opacity=0, translateX=0, translateY=12+ // revealed: blur=0, opacity=1, translateX=0, translateY=0+ const a = blurInStyle("hidden", blurInStyleContext(8, "up", 12));+ const b = blurInStyle("revealed", blurInStyleContext(8, "up", 12));+ const r = tweenBlurInStyle(a, b, 0.5);++ it("blur midpoint: 8 → 0 gives 4", () => {+ expect(r.blur).toBeCloseTo(4, 10);+ });+ it("opacity midpoint: 0 → 1 gives 0.5", () => {+ expect(r.opacity).toBeCloseTo(0.5, 10);+ });+ it("translateX midpoint: 0 → 0 gives 0", () => {+ expect(r.translateX).toBeCloseTo(0, 10);+ });+ it("translateY midpoint: 12 → 0 gives 6", () => {+ expect(r.translateY).toBeCloseTo(6, 10);+ });+});++describe("tweenBlurInStyle: t=0.5 midpoint on the x axis (hidden left → revealed)", () => {+ // hidden(left): blur=8, opacity=0, translateX=12, translateY=0+ const a = blurInStyle("hidden", blurInStyleContext(8, "left", 12));+ const b = blurInStyle("revealed", blurInStyleContext(8, "left", 12));+ const r = tweenBlurInStyle(a, b, 0.5);++ it("translateX midpoint: 12 → 0 gives 6", () => {+ expect(r.translateX).toBeCloseTo(6, 10);+ });+ it("translateY midpoint: 0 → 0 gives 0", () => {+ expect(r.translateY).toBeCloseTo(0, 10);+ });+});++// ===========================================================================+// 6. blurInConfig.snippet — pure string builder+// Emits `state="<state>"` always; emits direction/blur/distance ONLY when+// they differ from the control defaults (up / 8 / 12); never the speed knob.+// ===========================================================================++describe("blurInConfig.snippet: state prop emission", () => {+ it('emits state="hidden" for the hidden option', () => {+ expect(snippet({ state: "hidden" })).toContain('state="hidden"');+ });++ it('emits state="revealed" for the revealed option', () => {+ expect(snippet({ state: "revealed" })).toContain('state="revealed"');+ });++ it("emits the correct state for every control option", () => {+ for (const state of VALID_STATES) {+ expect(snippet({ state })).toContain(`state="${state}"`);+ }+ });+});++describe("blurInConfig.snippet: import line", () => {+ it("includes `import { BlurIn }` from the correct path", () => {+ const out = snippet({ state: "revealed" });+ expect(out).toContain("import { BlurIn }");+ expect(out).toContain('from "@/components/remocn/blur-in"');+ });+});++describe("blurInConfig.snippet: default props are omitted", () => {+ const allDefaults = snippet({+ state: "revealed",+ direction: "up",+ blur: 8,+ distance: 12,+ });++ it("omits direction when it equals the default 'up'", () => {+ expect(allDefaults).not.toContain("direction=");+ });+ it("omits blur when it equals the default 8", () => {+ expect(allDefaults).not.toContain("blur=");+ });+ it("omits distance when it equals the default 12", () => {+ expect(allDefaults).not.toContain("distance=");+ });+ it("never emits the preview-only speed knob", () => {+ expect(snippet({ state: "revealed" })).not.toContain("speed");+ });+});++describe("blurInConfig.snippet: non-default props are emitted", () => {+ it("emits a non-default direction", () => {+ expect(snippet({ state: "revealed", direction: "down" })).toContain(+ 'direction="down"',+ );+ });+ it("emits a non-default blur", () => {+ expect(snippet({ state: "revealed", blur: 16 })).toContain("blur={16}");+ });+ it("emits a non-default distance", () => {+ expect(snippet({ state: "revealed", distance: 40 })).toContain(+ "distance={40}",+ );+ });+});++describe("blurInConfig.snippet: structural round-trip", () => {+ const out = snippet({ state: "revealed" });++ it("starts with the import line", () => {+ expect(out.startsWith("import { BlurIn }")).toBe(true);+ });+ it("contains a <BlurIn JSX opening", () => {+ expect(out).toContain("<BlurIn");+ });+ it("closes with </BlurIn>", () => {+ expect(out.trimEnd().endsWith("</BlurIn>")).toBe(true);+ });+});diff --git a/registry/remocn-ui/blur-in/config.ts b/registry/remocn-ui/blur-in/config.tsnew file mode 100644index 00000000..4655acc3--- /dev/null+++ b/registry/remocn-ui/blur-in/config.ts@@ -0,0 +1,73 @@+import {+ type ComponentConfig,+ FPS,+ H,+ SHARED_CONTROLS,+ W,+} from "@/lib/customizer-config";+import type {+ BlurInDirection,+ BlurInState,+} from "@/registry/remocn-ui/blur-in";++export const blurInConfig: ComponentConfig = {+ componentName: "BlurIn",+ importPath: "@/components/remocn/blur-in",+ controls: {+ state: {+ type: "select",+ // Default to `revealed` so the preview shows the settled, sharp child.+ default: "revealed",+ options: ["hidden", "revealed"],+ label: "State",+ },+ blur: {+ type: "number",+ default: 8,+ min: 0,+ max: 40,+ step: 1,+ label: "Blur",+ },+ distance: {+ type: "number",+ default: 12,+ min: 0,+ max: 80,+ step: 1,+ label: "Distance",+ },+ direction: {+ type: "select",+ default: "up",+ options: ["up", "down", "left", "right"],+ label: "Direction",+ },+ ...SHARED_CONTROLS,+ },+ durationInFrames: 120,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ snippet: (values) => {+ const state = (values.state as BlurInState) ?? "revealed";+ const blur = values.blur as number | undefined;+ const distance = values.distance as number | undefined;+ const direction = values.direction as BlurInDirection | undefined;++ const props: string[] = [` state="${state}"`];+ if (direction !== undefined && direction !== "up")+ props.push(` direction="${direction}"`);+ if (blur !== undefined && blur !== 8) props.push(` blur={${blur}}`);+ if (distance !== undefined && distance !== 12)+ props.push(` distance={${distance}}`);++ return `import { BlurIn } from "@/components/remocn/blur-in";++<BlurIn+${props.join("\n")}+>+ {/* your element */}+</BlurIn>`;+ },+};diff --git a/registry/remocn-ui/blur-in/index.tsx b/registry/remocn-ui/blur-in/index.tsxnew file mode 100644index 00000000..17ce0cd7--- /dev/null+++ b/registry/remocn-ui/blur-in/index.tsx@@ -0,0 +1,123 @@+"use client";++import type { CSSProperties, ReactNode } from "react";++export type BlurInState = "hidden" | "revealed";+export type BlurInDirection = "up" | "down" | "left" | "right";++// ===========================================================================+// BlurIn visual — the COMPLETE animated look for a moment in time. A `state`+// is a named preset of this visual (`blurInStyle`); the smooth path feeds an+// interpolated `BlurInStyle` straight through. The component is a pure+// renderer of whichever `BlurInStyle` it receives — it reads NO frame.+//+// THEME-INDEPENDENT (the one deviation from the other state atoms): BlurIn+// carries no colors. It wraps a SINGLE child and reveals it with blur ++// opacity + a directional offset, so its "context" is a MOTION config+// (blur/distance/axis/sign), NOT a theme. There are no theme/mode/primary+// props. The frame is read only by `useBlurInTransition` (caller-side), exactly+// like `input`.+// ===========================================================================++export interface BlurInStyle {+ /** Animated blur radius in px. 0 = sharp. */+ blur: number;+ /** Child opacity 0→1. */+ opacity: number;+ /** Horizontal offset in px (the directional slide-into-place). */+ translateX: number;+ /** Vertical offset in px (the directional slide-into-place). */+ translateY: number;+}++/** The resolved MOTION config — the directional offset for the hidden preset. */+export interface BlurInStyleContext {+ blur: number;+ distance: number;+ axis: "x" | "y";+ sign: 1 | -1;+}++/**+ * Derive the motion config for a direction. Pure — call it once and reuse the+ * result for every `blurInStyle(state, ctx)` preset.+ *+ * `direction` is the way the child travels INTO place: `up` starts BELOW+ * (+Y), `down` starts above (−Y), `left` starts to the right (+X), `right`+ * starts to the left (−X).+ */+export function blurInStyleContext(+ blur: number,+ direction: BlurInDirection,+ distance: number,+): BlurInStyleContext {+ const axis: "x" | "y" =+ direction === "left" || direction === "right" ? "x" : "y";+ const sign: 1 | -1 = direction === "up" || direction === "left" ? 1 : -1;+ return { blur, distance, axis, sign };+}++/**+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => BlurInStyle`+ * map. To change how a state looks, edit one entry.+ */+export function blurInStyle(+ state: BlurInState,+ ctx: BlurInStyleContext,+): BlurInStyle {+ if (state === "revealed")+ return { blur: 0, opacity: 1, translateX: 0, translateY: 0 };+ return {+ blur: ctx.blur,+ opacity: 0,+ translateX: ctx.axis === "x" ? ctx.sign * ctx.distance : 0,+ translateY: ctx.axis === "y" ? ctx.sign * ctx.distance : 0,+ };+}++export interface BlurInProps {+ /** Current visual state (snap path). State changes snap (no enter-tweens). */+ state?: BlurInState;+ /**+ * Resolved animated visual (smooth path). When provided, takes precedence over+ * `state` — feed it an interpolated `BlurInStyle` from `useBlurInTransition`.+ */+ style?: BlurInStyle;+ /** The single element revealed by the blur/opacity/offset. */+ children: ReactNode;+ /** Hidden-state blur radius in px. */+ blur?: number;+ /** Direction the child travels INTO place. */+ direction?: BlurInDirection;+ /** Hidden-state offset distance in px (0 disables the slide). */+ distance?: number;+ /** CSS `display` for the wrapper (inline-block by default so it sizes to the child). */+ display?: CSSProperties["display"];+ className?: string;+}++export function BlurIn({+ state = "hidden",+ style,+ children,+ blur = 8,+ direction = "up",+ distance = 12,+ display = "inline-block",+ className,+}: BlurInProps) {+ const v = style ?? blurInStyle(state, blurInStyleContext(blur, direction, distance));+ return (+ <div+ className={className}+ style={{+ display,+ opacity: v.opacity,+ filter: v.blur > 0 ? `blur(${v.blur}px)` : "none",+ transform: `translate(${v.translateX}px, ${v.translateY}px)`,+ }}+ >+ {children}+ </div>+ );+}diff --git a/registry/remocn-ui/blur-in/preview.tsx b/registry/remocn-ui/blur-in/preview.tsxnew file mode 100644index 00000000..b350cf17--- /dev/null+++ b/registry/remocn-ui/blur-in/preview.tsx@@ -0,0 +1,66 @@+"use client";++import { BlurIn, type BlurInDirection, type BlurInState } from "./index";++export interface BlurInPreviewProps {+ state?: BlurInState;+ blur?: number;+ distance?: number;+ direction?: BlurInDirection;+ speed?: number;+}++/**+ * Preview-only wrapper for the customizer. `BlurIn` wraps a SINGLE child, so it+ * needs sample content — this thin wrapper supplies a fixed ~160×96 card and+ * centers it on a stage just for the preview. The customizer Player renders its+ * `component` as the composition root, so a bare wrapped child would sit+ * top-left. NOT shipped: not listed in registry.json files.+ */+export function BlurInPreview({+ state = "revealed",+ blur = 8,+ distance = 12,+ direction = "up",+}: BlurInPreviewProps) {+ return (+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: "#ffffff",+ fontFamily:+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",+ }}+ >+ <BlurIn+ state={state}+ blur={blur}+ distance={distance}+ direction={direction}+ >+ <div+ style={{+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ width: 160,+ height: 96,+ borderRadius: 12,+ border: "1px solid #e5e5e5",+ background: "#fafafa",+ color: "#171717",+ fontSize: 15,+ fontWeight: 500,+ letterSpacing: "-0.01em",+ }}+ >+ Blur In+ </div>+ </BlurIn>+ </div>+ );+}diff --git a/registry/remocn-ui/blur-in/use-blur-in-transition.ts b/registry/remocn-ui/blur-in/use-blur-in-transition.tsnew file mode 100644index 00000000..e0346246--- /dev/null+++ b/registry/remocn-ui/blur-in/use-blur-in-transition.ts@@ -0,0 +1,67 @@+"use client";++import {+ easings,+ type Step,+ useStateTransition,+} from "@/lib/remocn-ui";+import {+ blurInStyle,+ blurInStyleContext,+ type BlurInDirection,+ type BlurInState,+ type BlurInStyle,+} from "@/components/remocn/blur-in";+// ^ install path; resolves in-repo via the @/components/remocn/* tsconfig alias.++/** Default transition length (frames) when a step omits `duration`. Tune to taste. */+export const DEFAULT_DURATION = 18;++/** Blend two blur-in visuals: every field is a number, so all four lerp linearly. */+export function tweenBlurInStyle(+ a: BlurInStyle,+ b: BlurInStyle,+ t: number,+): BlurInStyle {+ return {+ blur: a.blur + (b.blur - a.blur) * t,+ opacity: a.opacity + (b.opacity - a.opacity) * t,+ translateX: a.translateX + (b.translateX - a.translateX) * t,+ translateY: a.translateY + (b.translateY - a.translateY) * t,+ };+}++export interface BlurInTransitionOptions {+ blur?: number;+ direction?: BlurInDirection;+ distance?: number;+ speed?: number;+ defaultDuration?: number;+}++/**+ * Timeline → resolved (eased, tweened) BlurInStyle. The CALLER invokes this; it+ * reads the frame, the `<BlurIn>` component does not. Feed the result to+ * `<BlurIn style={...} />` for smooth transitions.+ */+export function useBlurInTransition(+ steps: Step<BlurInState>[],+ opts: BlurInTransitionOptions = {},+): BlurInStyle {+ const {+ blur = 8,+ direction = "up",+ distance = 12,+ speed = 1,+ defaultDuration = DEFAULT_DURATION,+ } = opts;+ const ctx = blurInStyleContext(blur, direction, distance);+ const { from, to, progress } = useStateTransition(+ steps,+ "hidden",+ speed,+ defaultDuration,+ );+ const t = easings.out(progress);+ return tweenBlurInStyle(blurInStyle(from, ctx), blurInStyle(to, ctx), t);+}diff --git a/registry/remocn-ui/registry.json b/registry/remocn-ui/registry.jsonindex 4acddd85..c6f8132d 100644--- a/registry/remocn-ui/registry.json+++ b/registry/remocn-ui/registry.json@@ -257,6 +257,26 @@}]},+ {+ "name": "blur-in",+ "type": "registry:component",+ "title": "UI Blur In",+ "description": "A wrapper that reveals a single child with blur + opacity + a directional offset; a pure state atom, theme-independent — its context is a motion config (blur/distance/axis), not a theme.",+ "dependencies": ["remotion"],+ "registryDependencies": ["remocn-ui"],+ "files": [+ {+ "path": "blur-in/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/blur-in.tsx"+ },+ {+ "path": "blur-in/use-blur-in-transition.ts",+ "type": "registry:component",+ "target": "components/remocn/use-blur-in-transition.ts"+ }+ ]+ },{"name": "field","type": "registry:component",diff --git a/tsconfig.json b/tsconfig.jsonindex ba8534e5..e176a301 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -35,6 +35,7 @@"@/components/remocn/use-select-transition": ["./registry/remocn-ui/select/use-select-transition.ts"],"@/components/remocn/use-select-item-transition": ["./registry/remocn-ui/select-item/use-select-item-transition.ts"],"@/components/remocn/use-slider-transition": ["./registry/remocn-ui/slider/use-slider-transition.ts"],+ "@/components/remocn/use-blur-in-transition": ["./registry/remocn-ui/blur-in/use-blur-in-transition.ts"],"@/components/remocn/*": ["./registry/remocn-ui/*/index.tsx"],"@/*": ["./*"]}