{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bounding-box",
  "type": "registry:component",
  "title": "BoundingBox",
  "description": "A UI annotation bounding box — a rectangle outline that strokes itself on like a selection marquee around a region, with optional corner ticks and an optional label tag pinned to the top-left corner. For highlighting a UI element in docs and tutorial videos; the accent is earned here.",
  "dependencies": [
    "remotion",
    "@remotion/paths",
    "zod",
    "react"
  ],
  "registryDependencies": [
    "lib-choreography",
    "lib-easing",
    "lib-motion"
  ],
  "files": [
    {
      "path": "registry/components/bounding-box/BoundingBox.tsx",
      "type": "registry:component",
      "target": "components/onda/bounding-box/BoundingBox.tsx",
      "content": "import React from 'react';\nimport { AbsoluteFill, useCurrentFrame, useVideoConfig, spring, interpolate } from 'remotion';\nimport { evolvePath } from '@remotion/paths';\nimport { SPRING_SMOOTH, DURATION } from '../../../lib/motion';\nimport { HOUSE_EASE } from '../../../lib/easing';\nimport { entryFade, entryScale } from '../../../lib/choreography';\nimport { boundingBoxSchema, type BoundingBoxProps } from './schema';\n\nexport { boundingBoxSchema, type BoundingBoxProps };\n\n/**\n * A UI annotation bounding box — a rectangle outline that strokes itself on\n * like a selection marquee around a region, with optional corner ticks and an\n * optional label tag pinned to the top-left corner. For highlighting a UI\n * element in docs / tutorial videos. The accent is earned here.\n *\n * @example\n * <BoundingBox label=\"Settings\" x={0.2} y={0.3} width={0.4} height={0.3} />\n */\nexport const BoundingBox: React.FC<BoundingBoxProps> = ({\n  x,\n  y,\n  width: wFrac,\n  height: hFrac,\n  label,\n  color,\n  delay,\n  drawDuration,\n  strokeWidth,\n  corners,\n  labelColor,\n  fontSize,\n  fontFamily,\n}) => {\n  const frame = useCurrentFrame();\n  const { fps, width: canvasW, height: canvasH } = useVideoConfig();\n\n  // Box geometry in pixel space.\n  const bx = x * canvasW;\n  const by = y * canvasH;\n  const bw = wFrac * canvasW;\n  const bh = hFrac * canvasH;\n\n  // Outline strokes on with SPRING_SMOOTH — calm, settled, no overshoot, just\n  // like draw-on. The marquee traces the perimeter from the top-left corner,\n  // clockwise, then stays. evolvePath turns 0→1 progress into the\n  // dasharray/dashoffset pair that \"draws\" the path.\n  const drawProgress = spring({\n    frame: Math.max(0, frame - delay),\n    fps,\n    config: SPRING_SMOOTH,\n    durationInFrames: drawDuration,\n  });\n\n  // Closed rectangle path, clockwise from the top-left corner.\n  const rectPath = `M ${bx} ${by} L ${bx + bw} ${by} L ${bx + bw} ${by + bh} L ${bx} ${by + bh} Z`;\n  const { strokeDasharray, strokeDashoffset } = evolvePath(drawProgress, rectPath);\n\n  // Corner ticks fade in once the outline has essentially landed — one move at\n  // a time. A short L-shaped mark hugs each corner just inside the outline.\n  const tickLen = Math.min(bw, bh) * 0.14;\n  const cornersDelay = delay + drawDuration;\n  const { opacity: tickOpacity } = entryFade({\n    frame,\n    fps,\n    delay: cornersDelay,\n    durationInFrames: DURATION.fast,\n  });\n\n  // Label tag pinned to the top-left corner, fading + scaling in alongside the\n  // corner ticks. The two phases — draw, then ticks + tag — keep the eye on one\n  // thing at a time.\n  const tagFade = entryFade({ frame, fps, delay: cornersDelay, durationInFrames: DURATION.base });\n  const tagScale = entryScale({ frame, fps, delay: cornersDelay, durationInFrames: DURATION.base });\n\n  // Outline opacity eases up with the draw (0.4 → 1) so the line gains presence\n  // as it lands rather than popping in at full strength.\n  const outlineOpacity = interpolate(drawProgress, [0, 1], [0.4, 1], {\n    extrapolateLeft: 'clamp',\n    extrapolateRight: 'clamp',\n    easing: HOUSE_EASE,\n  });\n\n  // L-shaped tick at a corner. `sx`/`sy` are the horizontal/vertical directions\n  // the two legs extend (inward from the corner).\n  const cornerTick = (cx: number, cy: number, sx: number, sy: number, key: string) => (\n    <path\n      key={key}\n      d={`M ${cx + sx * tickLen} ${cy} L ${cx} ${cy} L ${cx} ${cy + sy * tickLen}`}\n      stroke={color}\n      strokeWidth={strokeWidth + 1}\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      fill=\"none\"\n      opacity={tickOpacity}\n    />\n  );\n\n  return (\n    <AbsoluteFill>\n      <svg\n        width={canvasW}\n        height={canvasH}\n        viewBox={`0 0 ${canvasW} ${canvasH}`}\n        style={{ position: 'absolute', inset: 0, overflow: 'visible' }}\n      >\n        <path\n          d={rectPath}\n          stroke={color}\n          strokeWidth={strokeWidth}\n          strokeDasharray={strokeDasharray}\n          strokeDashoffset={strokeDashoffset}\n          fill=\"none\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          style={{ filter: `drop-shadow(0 0 8px ${color})` }}\n          opacity={outlineOpacity}\n        />\n        {corners && (\n          <>\n            {cornerTick(bx, by, 1, 1, 'tl')}\n            {cornerTick(bx + bw, by, -1, 1, 'tr')}\n            {cornerTick(bx + bw, by + bh, -1, -1, 'br')}\n            {cornerTick(bx, by + bh, 1, -1, 'bl')}\n          </>\n        )}\n      </svg>\n      {label !== '' && (\n        <div\n          style={{\n            position: 'absolute',\n            left: bx,\n            top: by,\n            // Pin the tag just above the top-left corner. Centering translate is\n            // chained with entryScale's scale so fade and scale stay locked.\n            transform: `translateY(-100%) ${tagScale.transform}`,\n            transformOrigin: 'bottom left',\n            opacity: tagFade.opacity,\n            backgroundColor: color,\n            borderRadius: 6,\n            padding: '4px 10px',\n            marginBottom: 6,\n          }}\n        >\n          <span\n            style={{\n              color: labelColor,\n              fontSize,\n              fontFamily,\n              fontWeight: 600,\n              letterSpacing: '0.02em',\n              whiteSpace: 'nowrap',\n            }}\n          >\n            {label}\n          </span>\n        </div>\n      )}\n    </AbsoluteFill>\n  );\n};\n\nexport default BoundingBox;\n"
    },
    {
      "path": "registry/components/bounding-box/schema.ts",
      "type": "registry:component",
      "target": "components/onda/bounding-box/schema.ts",
      "content": "import { z } from 'zod';\nimport { DURATION } from '../../../lib/motion';\n\n/** Zod schema for {@link BoundingBox} props. */\nexport const boundingBoxSchema = z.object({\n  /** Discriminator literal — matches this entry's registry slug. Auto-populated when omitted (`schema.parse({})` works as before). Lets consumers build `z.discriminatedUnion('kind', [...])` directly over onda schemas. */\n  kind: z.literal('bounding-box').default('bounding-box'),\n  /** Box left edge as a `0..1` fraction of the canvas width. */\n  x: z.number().min(0).max(1).default(0.3),\n  /** Box top edge as a `0..1` fraction of the canvas height. */\n  y: z.number().min(0).max(1).default(0.3),\n  /** Box width as a `0..1` fraction of the canvas width. */\n  width: z.number().min(0).max(1).default(0.4),\n  /** Box height as a `0..1` fraction of the canvas height. */\n  height: z.number().min(0).max(1).default(0.4),\n  /** Optional label tag pinned to the box's top-left corner. Empty string hides it. */\n  label: z.string().default(''),\n  /** Outline / tick / tag color. Defaults to the Onda accent (`--onda-accent`, `#D96B82`) — the highlight is earned here. */\n  color: z.string().default('var(--onda-accent, #D96B82)'),\n  /** Frames before the outline starts drawing. */\n  delay: z.number().int().min(0).default(0),\n  /** Frames to draw the full rectangle outline. */\n  drawDuration: z.number().int().min(1).default(DURATION.slow),\n  /** Outline stroke width in px. */\n  strokeWidth: z.number().min(0).default(3),\n  /** Draw small L-shaped tick marks at each corner after the outline lands. */\n  corners: z.boolean().default(true),\n  /** Label text color. Defaults to `--onda-bg` (`#08080A`) for contrast on the accent tag. */\n  labelColor: z.string().default('var(--onda-bg, #08080A)'),\n  /** Label font size in px. */\n  fontSize: z.number().default(16),\n  /** Onda display font. */\n  fontFamily: z.string().default('var(--onda-font-display, \"Clash Display\", sans-serif)'),\n});\n\n/** Inferred props for {@link BoundingBox}. */\nexport type BoundingBoxProps = z.infer<typeof boundingBoxSchema>;\n"
    },
    {
      "path": "registry/components/bounding-box/bounding-box.meta.json",
      "type": "registry:file",
      "target": "components/onda/bounding-box/bounding-box.meta.json",
      "content": "{\n  \"name\": \"bounding-box\",\n  \"title\": \"BoundingBox\",\n  \"description\": \"A UI annotation bounding box — a rectangle outline that strokes itself on like a selection marquee around a region, with optional corner ticks and an optional label tag pinned to the top-left corner. For highlighting a UI element in docs and tutorial videos; the accent is earned here.\",\n  \"pickWhen\": \"framing a region in a UI demo — \\\"this is the area we're talking about.\\\" Use `callout` to point at a single spot instead.\",\n  \"category\": \"graphics\",\n  \"tags\": [\n    \"annotation\",\n    \"bounding-box\",\n    \"selection\",\n    \"highlight\",\n    \"tutorial\"\n  ],\n  \"dependencies\": [\n    \"remotion\",\n    \"@remotion/paths\",\n    \"zod\",\n    \"react\"\n  ]\n}\n"
    },
    {
      "path": "registry/components/bounding-box/README.md",
      "type": "registry:file",
      "target": "components/onda/bounding-box/README.md",
      "content": "# BoundingBox\n\nA UI annotation bounding box. A rectangle outline strokes itself on like a selection marquee around a region; once it lands, optional L-shaped corner ticks fade in and an optional label tag scales in from the top-left corner. Use it to highlight a UI element in docs and tutorial videos — point the viewer at the button, panel, or field you're describing without obscuring it. The accent (`--onda-accent`, `#D96B82`) is the default here because the highlight is the whole point.\n\n## Props\n\n| Name | Type | Default | Notes |\n| --- | --- | --- | --- |\n| `x` | `number 0–1` | `0.3` | Box left edge as a fraction of canvas width. |\n| `y` | `number 0–1` | `0.3` | Box top edge as a fraction of canvas height. |\n| `width` | `number 0–1` | `0.4` | Box width as a fraction of canvas width. |\n| `height` | `number 0–1` | `0.4` | Box height as a fraction of canvas height. |\n| `label` | `string` | `\"\"` | Tag text pinned to the top-left corner. Empty string hides the tag. |\n| `color` | `string` | `\"#D96B82\"` | Outline / tick / tag color (`--onda-accent`). |\n| `delay` | `integer ≥ 0` | `0` | Frames before the outline starts drawing. |\n| `drawDuration` | `integer ≥ 1` | `DURATION.slow` (24) | Frames to draw the full rectangle outline. |\n| `strokeWidth` | `number ≥ 0` | `3` | Outline stroke width in px (corner ticks are 1px heavier). |\n| `corners` | `boolean` | `true` | Draw L-shaped tick marks at each corner after the outline lands. |\n| `labelColor` | `string` | `\"#08080A\"` | Tag text color (`--onda-bg`) — dark for contrast on the accent tag. |\n| `fontSize` | `number` | `16` | Label font size in px. |\n| `fontFamily` | `string` | `'\"Clash Display\", sans-serif'` | The Onda display font. Never default to Inter / Arial / system. |\n\n## Usage\n\n```tsx\nimport { Composition } from 'remotion';\nimport { BoundingBox, boundingBoxSchema } from './components/onda/bounding-box/BoundingBox';\n\nexport const Root: React.FC = () => (\n  <Composition\n    id=\"BoundingBox\"\n    component={BoundingBox}\n    durationInFrames={90}\n    fps={30}\n    width={1920}\n    height={1080}\n    schema={boundingBoxSchema}\n    defaultProps={{\n      x: 0.2,\n      y: 0.28,\n      width: 0.45,\n      height: 0.32,\n      label: 'Settings panel',\n      color: '#D96B82',\n      delay: 0,\n      drawDuration: 24,\n      strokeWidth: 3,\n      corners: true,\n      labelColor: '#08080A',\n      fontSize: 16,\n      fontFamily: '\"Clash Display\", sans-serif',\n    }}\n  />\n);\n```\n\n## Motion notes\n\n- **Two-phase reveal.** The outline strokes on first as a single marquee tracing the perimeter clockwise from the top-left corner, using `evolvePath` from `@remotion/paths` driven by `SPRING_SMOOTH` — calm, settled, no overshoot, exactly like `draw-on`. Once the line lands, the corner ticks and label tag fade/scale in together. One thing at a time is the Onda restraint signature.\n- **0–1 coordinate system.** `x`, `y`, `width`, and `height` are normalized fractions of the canvas (0 = left/top, 1 = right/bottom). This keeps the box resolution-independent and trivially repositionable, matching `callout`'s `x`/`y` convention.\n- **Canvas dimensions come from `useVideoConfig()`.** No need to pass them — the component reads `width` / `height` from the composition automatically.\n- **Accent earned.** The outline, ticks, and tag all default to `--onda-accent`. A single restrained accent glow (`drop-shadow`) rides the outline, and the line eases up from 0.4 → 1 opacity as it draws so it gains presence rather than popping.\n- **Deterministic.** Frame N renders correctly with zero knowledge of prior frames — all motion is a pure function of `useCurrentFrame()`. No random, no date, no state.\n- **Spring is `SPRING_SMOOTH`** for the draw; fades use the house easing (`Easing.bezier(0.16, 1, 0.3, 1)`) via `lib/choreography` helpers, all clamped at both ends.\n"
    }
  ]
}
