{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "curtain-reveal",
  "type": "registry:component",
  "title": "Curtain Reveal",
  "description": "Two curtain panels slide apart to uncover your content, with an optional label that fades out first.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "transitions",
    "reveal",
    "curtain",
    "intro",
    "hover",
    "scroll"
  ],
  "docs": "https://hyperblur.dev/effects/curtain-reveal",
  "files": [
    {
      "path": "registry/hyperblur/curtain-reveal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/curtain-reveal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CurtainRevealProps extends React.HTMLAttributes<HTMLDivElement> {\n  children: React.ReactNode;\n  trigger?: \"mount\" | \"view\" | \"hover\";\n  direction?: \"horizontal\" | \"vertical\";\n  color?: string;\n  duration?: number;\n  delay?: number;\n  label?: React.ReactNode;\n}\n\nconst css = `\n.hb-cu { position: relative; overflow: hidden; }\n.hb-cu-content { position: relative; }\n.hb-cu-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }\n.hb-cu-panel {\n  position: absolute;\n  background-color: var(--hb-cu-c);\n  transition: transform var(--hb-cu-d) cubic-bezier(.77, 0, .18, 1);\n}\n.hb-cu-h .hb-cu-a { top: 0; bottom: 0; left: 0; width: calc(50% + 0.5px); background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 14px, rgba(0, 0, 0, 0.14) 14px 28px), linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.35)); box-shadow: 1px 0 0 rgba(255, 255, 255, 0.07); }\n.hb-cu-h .hb-cu-b { top: 0; bottom: 0; right: 0; width: calc(50% + 0.5px); background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 14px, rgba(0, 0, 0, 0.14) 14px 28px), linear-gradient(270deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.35)); box-shadow: -1px 0 0 rgba(255, 255, 255, 0.07); }\n.hb-cu-v .hb-cu-a { left: 0; right: 0; top: 0; height: calc(50% + 0.5px); background-image: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 14px, rgba(0, 0, 0, 0.14) 14px 28px), linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.35)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07); }\n.hb-cu-v .hb-cu-b { left: 0; right: 0; bottom: 0; height: calc(50% + 0.5px); background-image: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 14px, rgba(0, 0, 0, 0.14) 14px 28px), linear-gradient(0deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.35)); box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.07); }\n.hb-cu-label {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: #ededed;\n  opacity: 1;\n  transition: opacity 0.3s ease;\n}\n.hb-cu-open .hb-cu-label {\n  opacity: 0;\n  transition: opacity 0.35s ease var(--hb-cu-dl);\n}\n.hb-cu-open .hb-cu-panel { transition-delay: calc(var(--hb-cu-dl) + var(--hb-cu-lead)); }\n.hb-cu-open.hb-cu-h .hb-cu-a { transform: translateX(-100%); }\n.hb-cu-open.hb-cu-h .hb-cu-b { transform: translateX(100%); }\n.hb-cu-open.hb-cu-v .hb-cu-a { transform: translateY(-100%); }\n.hb-cu-open.hb-cu-v .hb-cu-b { transform: translateY(100%); }\n.hb-cu:focus-visible { outline: 2px solid #2f7bff; outline-offset: 2px; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-cu-panel { transition: opacity 0.3s ease; }\n  .hb-cu-open .hb-cu-panel { transition-delay: 0s; opacity: 0; }\n  .hb-cu-open.hb-cu-h .hb-cu-a, .hb-cu-open.hb-cu-h .hb-cu-b,\n  .hb-cu-open.hb-cu-v .hb-cu-a, .hb-cu-open.hb-cu-v .hb-cu-b { transform: none; }\n  .hb-cu-open .hb-cu-label { transition-delay: 0s; }\n}\n`;\n\nexport function CurtainReveal({\n  children,\n  trigger = \"mount\",\n  direction = \"horizontal\",\n  color = \"#0f0f0f\",\n  duration = 1.1,\n  delay = 0.3,\n  label,\n  className = \"\",\n  style,\n  onMouseEnter,\n  onMouseLeave,\n  onFocus,\n  onBlur,\n  ...rest\n}: CurtainRevealProps) {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const [open, setOpen] = React.useState(false);\n\n  React.useEffect(() => {\n    if (trigger === \"mount\") {\n      let second = 0;\n      const first = requestAnimationFrame(() => {\n        second = requestAnimationFrame(() => setOpen(true));\n      });\n      return () => {\n        cancelAnimationFrame(first);\n        cancelAnimationFrame(second);\n      };\n    }\n    if (trigger === \"view\") {\n      const el = ref.current;\n      if (!el) return;\n      if (typeof IntersectionObserver === \"undefined\") {\n        const id = requestAnimationFrame(() => setOpen(true));\n        return () => cancelAnimationFrame(id);\n      }\n      const io = new IntersectionObserver(\n        (entries) => {\n          if (entries.some((entry) => entry.isIntersecting)) {\n            setOpen(true);\n            io.disconnect();\n          }\n        },\n        { threshold: 0.35 },\n      );\n      io.observe(el);\n      return () => io.disconnect();\n    }\n  }, [trigger]);\n\n  function handleEnter(e: React.MouseEvent<HTMLDivElement>) {\n    onMouseEnter?.(e);\n    if (trigger === \"hover\") setOpen(true);\n  }\n\n  function handleLeave(e: React.MouseEvent<HTMLDivElement>) {\n    onMouseLeave?.(e);\n    if (trigger === \"hover\") setOpen(false);\n  }\n\n  function handleFocus(e: React.FocusEvent<HTMLDivElement>) {\n    onFocus?.(e);\n    if (trigger === \"hover\") setOpen(true);\n  }\n\n  function handleBlur(e: React.FocusEvent<HTMLDivElement>) {\n    onBlur?.(e);\n    if (trigger === \"hover\") setOpen(false);\n  }\n\n  const vars = {\n    \"--hb-cu-c\": color,\n    \"--hb-cu-d\": `${Math.max(0.1, duration)}s`,\n    \"--hb-cu-dl\": `${Math.max(0, delay)}s`,\n    \"--hb-cu-lead\": label ? \"0.3s\" : \"0s\",\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      ref={ref}\n      className={`hb-cu ${direction === \"vertical\" ? \"hb-cu-v\" : \"hb-cu-h\"}${open ? \" hb-cu-open\" : \"\"} ${className}`}\n      style={vars}\n      tabIndex={trigger === \"hover\" ? 0 : undefined}\n      onMouseEnter={handleEnter}\n      onMouseLeave={handleLeave}\n      onFocus={handleFocus}\n      onBlur={handleBlur}\n      {...rest}\n    >\n      <style href=\"hb-curtain-reveal\" precedence=\"default\">{css}</style>\n      <div className=\"hb-cu-content\">{children}</div>\n      <div className=\"hb-cu-layer\" aria-hidden=\"true\">\n        <div className=\"hb-cu-panel hb-cu-a\" />\n        <div className=\"hb-cu-panel hb-cu-b\" />\n        {label && <div className=\"hb-cu-label\">{label}</div>}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}