{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shutter-reveal",
  "type": "registry:component",
  "title": "Shutter Reveal",
  "description": "Content is uncovered by slanted bars that slide away one after another.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "motion",
    "reveal",
    "shutter",
    "intro",
    "bars",
    "slanted"
  ],
  "docs": "https://hyperblur.dev/effects/shutter-reveal",
  "files": [
    {
      "path": "registry/hyperblur/shutter-reveal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/shutter-reveal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ShutterRevealProps extends React.HTMLAttributes<HTMLDivElement> {\n  children: React.ReactNode;\n  bars?: number;\n  color?: string;\n  duration?: number;\n  direction?: \"left\" | \"right\";\n  trigger?: \"mount\" | \"hover\";\n}\n\nconst css = `\n@keyframes hb-sr-out {\n  from { transform: translateY(0) skewX(-20deg); }\n  to { transform: translateY(calc(var(--hb-y) * 101%)) skewX(-20deg); }\n}\n.hb-sr { position: relative; display: inline-block; }\n.hb-sr > .hb-sr-clip { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }\n.hb-sr-clip > .hb-sr-bars { position: absolute; top: 0; bottom: 0; display: flex; }\n.hb-sr-bars > i {\n  flex: 0 0 var(--hb-w);\n  margin-right: -1px;\n  background: var(--hb-c);\n  transform: skewX(-20deg);\n  animation: hb-sr-out var(--hb-bd) cubic-bezier(.7, 0, .2, 1) forwards;\n  animation-delay: var(--d);\n}\n@media (prefers-reduced-motion: reduce) { .hb-sr > .hb-sr-clip { display: none; } }\n`;\n\nexport function ShutterReveal({\n  children,\n  bars = 8,\n  color = \"#2f7bff\",\n  duration = 0.9,\n  direction = \"left\",\n  trigger = \"mount\",\n  className = \"\",\n  style,\n  onMouseEnter,\n  ...rest\n}: ShutterRevealProps) {\n  const [play, setPlay] = React.useState(trigger === \"mount\");\n  const [key, setKey] = React.useState(0);\n\n  const n = Math.max(1, Math.round(bars));\n  const extra = Math.ceil(n / 3);\n  const total = n + extra * 2;\n  const barDur = duration * 0.5;\n  const step = n > 1 ? (duration - barDur) / (n - 1) : 0;\n\n  const items = Array.from({ length: total }, (_, i) => {\n    const j = Math.min(n - 1, Math.max(0, i - extra));\n    const order = direction === \"left\" ? j : n - 1 - j;\n    return { delay: order * step, dir: i % 2 === 0 ? -1 : 1 };\n  });\n\n  const vars = {\n    \"--hb-c\": color,\n    \"--hb-bd\": `${barDur}s`,\n    \"--hb-w\": `${100 / total}%`,\n    ...style,\n  } as React.CSSProperties;\n\n  function handleEnter(e: React.MouseEvent<HTMLDivElement>) {\n    onMouseEnter?.(e);\n    if (trigger !== \"hover\") return;\n    setPlay(true);\n    setKey((k) => k + 1);\n  }\n\n  return (\n    <div className={`hb-sr ${className}`} style={vars} onMouseEnter={handleEnter} {...rest}>\n      <style href=\"hb-shutter-reveal\" precedence=\"default\">{css}</style>\n      {children}\n      {play && (\n        <div className=\"hb-sr-clip\" key={key} aria-hidden=\"true\">\n          <div\n            className=\"hb-sr-bars\"\n            style={{ left: `${(-extra / n) * 100}%`, width: `${(total / n) * 100}%` }}\n          >\n            {items.map((b, i) => (\n              <i\n                key={i}\n                style={{ \"--d\": `${b.delay.toFixed(3)}s`, \"--hb-y\": b.dir } as React.CSSProperties}\n              />\n            ))}\n          </div>\n        </div>\n      )}\n    </div>\n  );\n}\n"
    }
  ]
}