{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"blur-text","type":"registry:ui","title":"Blur Text","description":"Words that sharpen out of a blur, one after another, when the text scrolls into view.","dependencies":["motion"],"registryDependencies":["https://ui.mekaigames.com/r/theme.json"],"files":[{"path":"components/ui/blur-text.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { motion, useInView, useReducedMotion } from \"motion/react\";\nimport { Fragment, useRef } from \"react\";\n\ntype BlurTextProps = {\n  text: string;\n  /** Seconds before the first word starts. */\n  delay?: number;\n  /** Seconds between one word and the next. */\n  stagger?: number;\n  /** \"up\" makes words rise into place, \"down\" makes them drop in. */\n  direction?: \"up\" | \"down\";\n  /** Play only the first time the text enters the viewport. */\n  once?: boolean;\n  className?: string;\n};\n\nconst EASE = [0.22, 1, 0.36, 1] as const;\n\n/** Words that sharpen out of a blur, one after another, when the text scrolls into view. */\nexport function BlurText({\n  text,\n  delay = 0,\n  stagger = 0.08,\n  direction = \"up\",\n  once = true,\n  className = \"\",\n}: BlurTextProps) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const inView = useInView(ref, { once, amount: 0.3 });\n  const reduce = useReducedMotion();\n  const words = text.split(/\\s+/).filter(Boolean);\n\n  const hidden = { opacity: 0, filter: \"blur(12px)\", y: direction === \"up\" ? \"0.45em\" : \"-0.45em\" };\n  const shown = { opacity: 1, filter: \"blur(0px)\", y: \"0em\" };\n\n  return (\n    <span ref={ref} className={className}>\n      <span className=\"sr-only\">{text}</span>\n      <span aria-hidden=\"true\">\n        {words.map((word, i) => (\n          <Fragment key={i}>\n            {i > 0 ? \" \" : null}\n            <motion.span\n              className=\"inline-block will-change-[filter,transform]\"\n              initial={reduce ? false : hidden}\n              animate={reduce || inView ? shown : hidden}\n              transition={\n                reduce\n                  ? { duration: 0 }\n                  : inView\n                    ? { duration: 0.8, delay: delay + i * stagger, ease: EASE }\n                    : { duration: 0.3, ease: EASE }\n              }\n            >\n              {word}\n            </motion.span>\n          </Fragment>\n        ))}\n      </span>\n    </span>\n  );\n}\n"}]}