{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"masked-reveal","type":"registry:ui","title":"Masked Reveal","description":"A multi-line heading whose lines slide up from behind a mask, then an accent line draws in underneath.","dependencies":["motion"],"registryDependencies":["https://ui.mekaigames.com/r/theme.json"],"files":[{"path":"components/ui/masked-reveal.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { motion, useInView, useReducedMotion } from \"motion/react\";\nimport { useRef } from \"react\";\n\ntype MaskedRevealProps = {\n  /** One string per line of the heading. */\n  lines: string[];\n  /** The heading element to render. */\n  as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"p\";\n  /** Seconds before the first line starts. */\n  delay?: number;\n  /** Seconds between one line and the next. */\n  stagger?: number;\n  /** Seconds for each line to slide up. */\n  duration?: number;\n  /** Play only the first time the heading enters the viewport. */\n  once?: boolean;\n  /** Draw an accent line under the last line once it has landed. */\n  underline?: boolean;\n  underlineColor?: string;\n  className?: string;\n};\n\nconst EASE = [0.16, 1, 0.3, 1] as const;\n\n/** A multi-line heading whose lines slide up from behind a mask, one after another, as it enters the viewport. */\nexport function MaskedReveal({\n  lines,\n  as: Tag = \"h2\",\n  delay = 0,\n  stagger = 0.12,\n  duration = 0.9,\n  once = true,\n  underline = true,\n  underlineColor = \"#ff784f\",\n  className = \"\",\n}: MaskedRevealProps) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const inView = useInView(ref, { once, amount: 0.35 });\n  const reduce = useReducedMotion();\n  const show = Boolean(reduce) || inView;\n  const last = lines.length - 1;\n\n  return (\n    <Tag className={className}>\n      <span className=\"sr-only\">{lines.join(\" \")}</span>\n      <span ref={ref} aria-hidden=\"true\" className=\"block\">\n        {lines.map((line, i) => (\n          // The padding gives descenders and the underline room inside the mask.\n          <span key={i} className=\"-mb-[0.16em] block overflow-hidden pb-[0.16em]\">\n            <motion.span\n              className=\"relative inline-block\"\n              initial={reduce ? false : { y: \"115%\" }}\n              animate={{ y: show ? \"0%\" : \"115%\" }}\n              transition={\n                reduce\n                  ? { duration: 0 }\n                  : { duration: show ? duration : 0.3, delay: show ? delay + i * stagger : 0, ease: EASE }\n              }\n            >\n              {line}\n              {underline && i === last ? (\n                <motion.span\n                  className=\"absolute left-0 top-full h-[0.07em] min-h-[2px] w-full origin-left rounded-full\"\n                  style={{ backgroundColor: underlineColor }}\n                  initial={reduce ? false : { scaleX: 0 }}\n                  animate={{ scaleX: show ? 1 : 0 }}\n                  transition={\n                    reduce\n                      ? { duration: 0 }\n                      : {\n                          duration: show ? 0.7 : 0.2,\n                          delay: show ? delay + last * stagger + duration * 0.75 : 0,\n                          ease: EASE,\n                        }\n                  }\n                />\n              ) : null}\n            </motion.span>\n          </span>\n        ))}\n      </span>\n    </Tag>\n  );\n}\n"}]}