{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "text-foil-sweep",
  "type": "registry:component",
  "title": "Text Foil Sweep",
  "description": "Text printed like holographic foil: a metal base, a band of spectrum colors and a hard specular streak that sweeps across. With a mouse, the streak follows the pointer instead.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "text",
    "foil",
    "holographic",
    "metal",
    "shine",
    "gradient",
    "premium"
  ],
  "docs": "https://hyperblur.dev/effects/text-foil-sweep",
  "files": [
    {
      "path": "registry/hyperblur/text-foil-sweep.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/text-foil-sweep.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TextFoilSweepProps extends React.HTMLAttributes<HTMLSpanElement> {\n  text: string;\n  tone?: \"silver\" | \"gold\" | \"graphite\";\n  speed?: number;\n  intensity?: number;\n  interactive?: boolean;\n}\n\nconst tones = {\n  silver: \"#f7f8fa 0%, #b9bec7 22%, #ffffff 38%, #7c828d 56%, #e6e9ee 74%, #9aa0aa 100%\",\n  gold: \"#fff4d6 0%, #d9a44a 24%, #fff1c2 40%, #9c6a1c 58%, #f3cf7a 76%, #b07d2c 100%\",\n  graphite: \"#d9dce2 0%, #6b707a 24%, #c8ccd4 40%, #3c4048 58%, #9ea3ad 76%, #555a63 100%\",\n};\n\nconst css = `\n@keyframes hb-vi5-sweep {\n  0% { --hb-vi5-p: -0.25; }\n  62%, 100% { --hb-vi5-p: 1.25; }\n}\n@property --hb-vi5-p {\n  syntax: \"<number>\";\n  inherits: true;\n  initial-value: 0.5;\n}\n.hb-vi5 {\n  position: relative;\n  display: inline-block;\n  font-family: inherit;\n  box-sizing: border-box;\n  --hb-vi5-p: 0.5;\n}\n.hb-vi5-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-vi5-t {\n  display: inline-block;\n  color: transparent;\n  background-image:\n    linear-gradient(105deg, transparent calc(var(--hb-vi5-p) * 100% - 14%), rgba(255, 255, 255, 0.96) calc(var(--hb-vi5-p) * 100%), transparent calc(var(--hb-vi5-p) * 100% + 14%)),\n    linear-gradient(100deg, transparent calc(var(--hb-vi5-p) * 100% - 34%), rgba(255, 120, 200, var(--hb-vi5-i)) calc(var(--hb-vi5-p) * 100% - 18%), rgba(120, 220, 255, var(--hb-vi5-i)) calc(var(--hb-vi5-p) * 100% - 4%), rgba(170, 255, 170, var(--hb-vi5-i)) calc(var(--hb-vi5-p) * 100% + 10%), rgba(255, 230, 120, var(--hb-vi5-i)) calc(var(--hb-vi5-p) * 100% + 22%), transparent calc(var(--hb-vi5-p) * 100% + 36%)),\n    linear-gradient(180deg, var(--hb-vi5-tone));\n  background-blend-mode: normal, color, normal;\n  -webkit-background-clip: text;\n  background-clip: text;\n  filter: drop-shadow(0 0.02em 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0.08em 0.12em rgba(0, 0, 0, 0.35));\n  animation: hb-vi5-sweep var(--hb-vi5-speed) cubic-bezier(.55, .05, .3, 1) infinite;\n}\n.hb-vi5[data-pointer] .hb-vi5-t {\n  animation: none;\n  transition: --hb-vi5-p 0.5s cubic-bezier(.22, 1, .36, 1);\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vi5 .hb-vi5-t { animation: none; transition: none; }\n}\n`;\n\nexport function TextFoilSweep({\n  text,\n  tone = \"silver\",\n  speed = 3.2,\n  intensity = 0.65,\n  interactive = true,\n  className = \"\",\n  style,\n  onPointerMove,\n  onPointerLeave,\n  ...rest\n}: TextFoilSweepProps) {\n  const ref = React.useRef<HTMLSpanElement>(null);\n  const [pointer, setPointer] = React.useState(false);\n\n  const vars = {\n    \"--hb-vi5-tone\": tones[tone] ?? tones.silver,\n    \"--hb-vi5-speed\": `${speed}s`,\n    \"--hb-vi5-i\": Math.max(0, Math.min(1, intensity)).toFixed(2),\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <span\n      ref={ref}\n      className={`hb-vi5 ${className}`}\n      style={vars}\n      data-pointer={pointer ? \"\" : undefined}\n      onPointerMove={(e) => {\n        if (interactive && e.pointerType === \"mouse\" && ref.current) {\n          const r = ref.current.getBoundingClientRect();\n          const p = (e.clientX - r.left) / Math.max(1, r.width);\n          ref.current.style.setProperty(\"--hb-vi5-p\", (0.15 + p * 0.7).toFixed(3));\n          if (!pointer) setPointer(true);\n        }\n        onPointerMove?.(e);\n      }}\n      onPointerLeave={(e) => {\n        if (ref.current) ref.current.style.removeProperty(\"--hb-vi5-p\");\n        setPointer(false);\n        onPointerLeave?.(e);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-text-foil-sweep\" precedence=\"default\">{css}</style>\n      <span className=\"hb-vi5-sr\">{text}</span>\n      <span className=\"hb-vi5-t\" aria-hidden=\"true\">{text}</span>\n    </span>\n  );\n}\n"
    }
  ]
}