{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"stroke-text","type":"registry:ui","title":"Stroke Text","description":"Outlined text that fills with color on hover or focus, sweeping in from the left, the bottom or the center.","dependencies":["motion"],"registryDependencies":["https://ui.mekaigames.com/r/theme.json"],"files":[{"path":"components/ui/stroke-text.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { useState } from \"react\";\n\ntype Direction = \"left\" | \"bottom\" | \"center\";\n\ntype StrokeTextProps = {\n  text: string;\n  /** Where the fill sweeps in from. */\n  direction?: Direction;\n  /** Outline width in pixels. */\n  strokeWidth?: number;\n  strokeColor?: string;\n  fillColor?: string;\n  /** Seconds for the fill to sweep across. */\n  duration?: number;\n  /** Keep the text filled, for example for the current page in a menu. */\n  active?: boolean;\n  /** Make the text itself a tab stop. Turn off when it sits inside a link or button. */\n  focusable?: boolean;\n  className?: string;\n};\n\nconst EMPTY: Record<Direction, string> = {\n  left: \"inset(0% 100% 0% 0%)\",\n  bottom: \"inset(100% 0% 0% 0%)\",\n  center: \"circle(0% at 50% 50%)\",\n};\nconst FULL: Record<Direction, string> = {\n  left: \"inset(0% 0% 0% 0%)\",\n  bottom: \"inset(0% 0% 0% 0%)\",\n  // 72% of the reference radius reaches the corners of any box.\n  center: \"circle(72% at 50% 50%)\",\n};\n\n/** Outlined text that fills with color on hover or focus, sweeping in from the left, the bottom or the center. */\nexport function StrokeText({\n  text,\n  direction = \"left\",\n  strokeWidth = 1.5,\n  strokeColor = \"#f4ede3\",\n  fillColor = \"#ff784f\",\n  duration = 0.5,\n  active = false,\n  focusable = true,\n  className = \"\",\n}: StrokeTextProps) {\n  const reduce = useReducedMotion();\n  const [engaged, setEngaged] = useState(false);\n  const filled = active || engaged;\n\n  return (\n    <span\n      className={`relative inline-block ${className}`}\n      tabIndex={focusable ? 0 : undefined}\n      onPointerEnter={() => setEngaged(true)}\n      onPointerLeave={() => setEngaged(false)}\n      onFocus={() => setEngaged(true)}\n      onBlur={() => setEngaged(false)}\n    >\n      <span style={{ color: \"transparent\", WebkitTextStroke: `${strokeWidth}px ${strokeColor}` }}>{text}</span>\n      <motion.span\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute inset-0 select-none\"\n        style={{ color: fillColor, WebkitTextStroke: `${strokeWidth}px ${fillColor}` }}\n        initial={false}\n        animate={{ clipPath: filled ? FULL[direction] : EMPTY[direction] }}\n        transition={{ duration: reduce ? 0 : Math.max(0, duration), ease: [0.65, 0, 0.35, 1] }}\n      >\n        {text}\n      </motion.span>\n    </span>\n  );\n}\n"}]}