{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"lustre-text","type":"registry:ui","title":"Lustre Text","description":"Polished metal lettering with a bevel and a specular glint that sweeps across, or follows your pointer.","dependencies":[],"registryDependencies":[],"files":[{"path":"registry/ui/lustre-text.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { useRef, type CSSProperties, type PointerEvent } from \"react\";\n\nconst css = `\n.lustre-text{display:inline-block;color:transparent;-webkit-background-clip:text;background-clip:text;background-repeat:no-repeat;background-size:250% 100%,100% 100%;background-position:100% 0,0 0;animation:lustre-sweep var(--lu-d) cubic-bezier(.45,0,.25,1) infinite}\n.lustre-text[data-tracking]{animation:none;background-position:var(--lu-x) 0,0 0;transition:background-position .25s ease-out}\n@keyframes lustre-sweep{0%{background-position:100% 0,0 0}70%,100%{background-position:0% 0,0 0}}\n@media (prefers-reduced-motion:reduce){.lustre-text{animation:none;background-position:40% 0,0 0}}\n`;\n\nconst metals = {\n  silver: [\"#d4d4d8\", \"#8b8b94\", \"#46464e\", \"#1c1c20\", \"#5f5f68\", \"#b4b4bc\"],\n  gold: [\"#f5d98a\", \"#c08a2e\", \"#7a4c0e\", \"#3d2505\", \"#9c6b1f\", \"#e3b95c\"],\n  rose: [\"#f3c6cf\", \"#c77a88\", \"#86424f\", \"#481c25\", \"#a45a68\", \"#e4a9b4\"],\n  titanium: [\"#cfdbe7\", \"#7b8ca2\", \"#364355\", \"#141b25\", \"#55687f\", \"#b2c1d0\"],\n};\n\nexport interface LustreTextProps {\n  text: string;\n  /** Metal finish. */\n  metal?: keyof typeof metals;\n  /** Seconds per lustre sweep (includes a short rest). */\n  speed?: number;\n  /** Highlight follows the pointer while hovered. */\n  followPointer?: boolean;\n  /** Strength of the bevel shading, 0–1. */\n  bevel?: number;\n  className?: string;\n}\n\nexport function LustreText({\n  text,\n  metal = \"silver\",\n  speed = 4,\n  followPointer = true,\n  bevel = 0.6,\n  className,\n}: LustreTextProps) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const [a, b, c, d, e, f] = metals[metal] ?? metals.silver;\n\n  const move = (ev: PointerEvent<HTMLSpanElement>) => {\n    const el = ref.current;\n    if (!followPointer || !el) return;\n    const r = el.getBoundingClientRect();\n    const fx = (ev.clientX - r.left) / r.width;\n    el.dataset.tracking = \"\";\n    el.style.setProperty(\"--lu-x\", `${((1.25 - fx) / 1.5) * 100}%`);\n  };\n  const leave = () => ref.current?.removeAttribute(\"data-tracking\");\n\n  return (\n    <span\n      ref={ref}\n      className={`lustre-text ${className ?? \"\"}`}\n      onPointerMove={move}\n      onPointerLeave={leave}\n      style={\n        {\n          \"--lu-d\": `${speed}s`,\n          backgroundImage: `linear-gradient(110deg, transparent 36%, rgba(255,255,255,.25) 44%, #fff 50%, rgba(255,255,255,.25) 56%, transparent 64%), linear-gradient(180deg, ${a} 0%, ${b} 32%, ${c} 49%, ${d} 51%, ${e} 72%, ${f} 100%)`,\n          filter: `drop-shadow(0 -1px 0 rgba(255,255,255,${0.35 * bevel})) drop-shadow(0 1px 0 rgba(0,0,0,${0.9 * bevel})) drop-shadow(0 3px 2px rgba(0,0,0,${0.5 * bevel}))`,\n        } as CSSProperties\n      }\n    >\n      <style href=\"lustre-text\" precedence=\"default\">\n        {css}\n      </style>\n      {text}\n    </span>\n  );\n}\n"}]}