{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "text-block-wipe",
  "type": "registry:component",
  "title": "Text Block Wipe",
  "description": "Two stacked color bars sweep across each line, cover it and pull away to uncover the text, like an editorial title card. Lines run in sequence and the text settles with a short slide.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "text",
    "reveal",
    "wipe",
    "editorial",
    "headline",
    "bar",
    "scroll"
  ],
  "docs": "https://hyperblur.dev/effects/text-block-wipe",
  "files": [
    {
      "path": "registry/hyperblur/text-block-wipe.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/text-block-wipe.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TextBlockWipeProps extends React.HTMLAttributes<HTMLDivElement> {\n  text: string;\n  color?: string;\n  trail?: string;\n  direction?: \"left\" | \"right\";\n  duration?: number;\n  stagger?: number;\n  delay?: number;\n  trigger?: \"view\" | \"mount\";\n  loop?: number;\n}\n\nconst css = `\n@keyframes hb-vi1-bar {\n  0% { transform: scaleX(0); transform-origin: var(--hb-vi1-from) 50%; }\n  46% { transform: scaleX(1); transform-origin: var(--hb-vi1-from) 50%; }\n  54% { transform: scaleX(1); transform-origin: var(--hb-vi1-to) 50%; }\n  100% { transform: scaleX(0); transform-origin: var(--hb-vi1-to) 50%; }\n}\n@keyframes hb-vi1-text {\n  0%, 49.9% { opacity: 0; transform: translate3d(var(--hb-vi1-shift), 0, 0); }\n  50% { opacity: 1; transform: translate3d(var(--hb-vi1-shift), 0, 0); }\n  100% { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n.hb-vi1 { display: block; font-family: inherit; box-sizing: border-box; }\n.hb-vi1 *, .hb-vi1 *::before, .hb-vi1 *::after { box-sizing: border-box; }\n.hb-vi1-sr {\n  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;\n  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n}\n.hb-vi1-row { display: block; }\n.hb-vi1-l {\n  position: relative;\n  display: inline-block;\n  padding: 0 0.04em;\n  margin: 0 -0.04em;\n}\n.hb-vi1-t { display: inline-block; opacity: 0; }\n.hb-vi1-b, .hb-vi1-g {\n  position: absolute;\n  left: 0; right: 0;\n  top: 0.08em; bottom: 0.06em;\n  transform: scaleX(0);\n  pointer-events: none;\n}\n.hb-vi1-g { background: var(--hb-vi1-trail); }\n.hb-vi1-b { background: var(--hb-vi1-color); }\n.hb-vi1[data-active] .hb-vi1-g {\n  animation: hb-vi1-bar var(--hb-vi1-dur) cubic-bezier(.76, 0, .2, 1) both;\n  animation-delay: calc(var(--hb-vi1-delay) + var(--hb-vi1-n) * var(--hb-vi1-stagger));\n}\n.hb-vi1[data-active] .hb-vi1-b {\n  animation: hb-vi1-bar var(--hb-vi1-dur) cubic-bezier(.76, 0, .2, 1) both;\n  animation-delay: calc(var(--hb-vi1-delay) + var(--hb-vi1-n) * var(--hb-vi1-stagger) + var(--hb-vi1-dur) * 0.09);\n}\n.hb-vi1[data-active] .hb-vi1-t {\n  animation: hb-vi1-text calc(var(--hb-vi1-dur) * 1.25) cubic-bezier(.16, 1, .3, 1) both;\n  animation-delay: calc(var(--hb-vi1-delay) + var(--hb-vi1-n) * var(--hb-vi1-stagger) + var(--hb-vi1-dur) * 0.09);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vi1 .hb-vi1-t { opacity: 1; animation: none !important; transform: none; }\n  .hb-vi1 .hb-vi1-b, .hb-vi1 .hb-vi1-g { display: none; }\n}\n`;\n\nexport function TextBlockWipe({\n  text,\n  color = \"#2f7bff\",\n  trail = \"#7fb3ff\",\n  direction = \"left\",\n  duration = 1.1,\n  stagger = 0.14,\n  delay = 0,\n  trigger = \"view\",\n  loop = 0,\n  className = \"\",\n  style,\n  ...rest\n}: TextBlockWipeProps) {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const [inView, setInView] = React.useState(false);\n  const [cycle, setCycle] = React.useState(0);\n  const [resting, setResting] = React.useState(false);\n  const lines = React.useMemo(() => text.split(\"\\n\"), [text]);\n\n  React.useEffect(() => {\n    if (trigger === \"mount\") {\n      const id = requestAnimationFrame(() => setInView(true));\n      return () => cancelAnimationFrame(id);\n    }\n    const el = ref.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") {\n      const id = requestAnimationFrame(() => setInView(true));\n      return () => cancelAnimationFrame(id);\n    }\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          setInView(true);\n          io.disconnect();\n        }\n      },\n      { threshold: 0.3 },\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, [trigger]);\n\n  React.useEffect(() => {\n    if (!inView || loop <= 0) return;\n    if (resting) {\n      const id = setTimeout(() => {\n        setResting(false);\n        setCycle((c) => c + 1);\n      }, 380);\n      return () => clearTimeout(id);\n    }\n    const total = (delay + duration * 1.4 + stagger * lines.length + loop) * 1000;\n    const id = setTimeout(() => setResting(true), total);\n    return () => clearTimeout(id);\n  }, [inView, loop, resting, delay, duration, stagger, lines.length]);\n\n  const vars = {\n    \"--hb-vi1-color\": color,\n    \"--hb-vi1-trail\": trail,\n    \"--hb-vi1-dur\": `${duration}s`,\n    \"--hb-vi1-delay\": `${delay}s`,\n    \"--hb-vi1-stagger\": `${stagger}s`,\n    \"--hb-vi1-from\": direction === \"left\" ? \"0%\" : \"100%\",\n    \"--hb-vi1-to\": direction === \"left\" ? \"100%\" : \"0%\",\n    \"--hb-vi1-shift\": direction === \"left\" ? \"-0.18em\" : \"0.18em\",\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      ref={ref}\n      className={`hb-vi1 ${className}`}\n      style={vars}\n      data-active={inView && !resting ? \"\" : undefined}\n      {...rest}\n    >\n      <style href=\"hb-text-block-wipe\" precedence=\"default\">{css}</style>\n      <span className=\"hb-vi1-sr\">{text.replace(/\\n/g, \" \")}</span>\n      {lines.map((line, i) => (\n        <span className=\"hb-vi1-row\" key={`${cycle}-${i}`} aria-hidden=\"true\">\n          <span className=\"hb-vi1-l\" style={{ \"--hb-vi1-n\": i } as React.CSSProperties}>\n            <span className=\"hb-vi1-t\">{line || \" \"}</span>\n            <span className=\"hb-vi1-g\" />\n            <span className=\"hb-vi1-b\" />\n          </span>\n        </span>\n      ))}\n    </div>\n  );\n}\n"
    }
  ]
}