{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "anneal",
  "type": "registry:ui",
  "title": "Anneal",
  "description": "Text that resolves from a soft blur into sharp focus, staggered by word or character, when it scrolls into view. Falls back to a fade under reduced motion.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/text/anneal/anneal.tsx",
      "type": "registry:ui",
      "target": "components/crucible/anneal.tsx",
      "content": "\"use client\";\n\nimport { motion, type HTMLMotionProps, type Variants } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface AnnealProps\n  extends Omit<HTMLMotionProps<\"span\">, \"children\" | \"initial\" | \"whileInView\" | \"viewport\" | \"transition\"> {\n  /** The text to reveal. */\n  children: string;\n  /** Split granularity. Words keep natural line-wrapping; chars are more dramatic. */\n  by?: \"word\" | \"char\";\n  /** Seconds before the reveal starts. */\n  delay?: number;\n  /** Seconds between each segment's reveal. */\n  stagger?: number;\n  /** Seconds each segment takes to sharpen. */\n  duration?: number;\n  /** Starting blur radius in px. */\n  blur?: number;\n  /** Re-trigger every time the text scrolls into view (default: once). */\n  repeat?: boolean;\n}\n\n/**\n * Anneal — text that resolves from a soft blur into sharp focus, one segment\n * at a time, when it enters the viewport. Like metal normalizing as it cools.\n * Falls back to a simple fade when the user prefers reduced motion.\n */\nexport function Anneal({\n  children,\n  by = \"word\",\n  delay = 0,\n  stagger = 0.045,\n  duration = 0.5,\n  blur = 10,\n  repeat = false,\n  className,\n  ...props\n}: AnnealProps) {\n  const reducedMotion = useReducedMotion();\n\n  // Words keep trailing spaces attached so layout is identical to plain text.\n  // In char mode each word's characters are grouped in a nowrap wrapper so the\n  // line only ever breaks at spaces, never mid-word.\n  const words = React.useMemo(() => children.split(/(?<=\\s)/), [children]);\n\n  const variants: Variants = reducedMotion\n    ? {\n        // Reset filter/y explicitly: useReducedMotion returns false during SSR, so\n        // the non-reduced hidden pose (blur + y offset) may already be committed as\n        // the initial inline style. Without resetting them here, whileInView drives\n        // only opacity and the text freezes blurred/offset. (Same class as surface.)\n        hidden: { opacity: 0 },\n        visible: { opacity: 1, filter: \"blur(0px)\", y: \"0em\", transition: { duration: 0.3 } },\n      }\n    : {\n        hidden: { opacity: 0, filter: `blur(${blur}px)`, y: \"0.3em\" },\n        visible: {\n          opacity: 1,\n          filter: \"blur(0px)\",\n          y: \"0em\",\n          transition: { duration, ease: [0.25, 0.4, 0.25, 1] },\n        },\n      };\n\n  return (\n    <motion.span\n      className={cn(\"inline-block\", className)}\n      initial=\"hidden\"\n      whileInView=\"visible\"\n      viewport={{ once: !repeat, amount: 0.6 }}\n      transition={{ staggerChildren: reducedMotion ? 0 : stagger, delayChildren: delay }}\n      aria-label={children}\n      {...props}\n    >\n      {by === \"char\"\n        ? words.map((word, wi) => (\n            <span key={wi} aria-hidden className=\"inline-block whitespace-nowrap\">\n              {[...word].map((ch, ci) => (\n                <motion.span\n                  key={ci}\n                  variants={variants}\n                  className=\"inline-block whitespace-pre will-change-[filter,transform,opacity]\"\n                >\n                  {ch}\n                </motion.span>\n              ))}\n            </span>\n          ))\n        : words.map((segment, i) => (\n            <motion.span\n              key={i}\n              aria-hidden\n              variants={variants}\n              className=\"inline-block whitespace-pre will-change-[filter,transform,opacity]\"\n            >\n              {segment}\n            </motion.span>\n          ))}\n    </motion.span>\n  );\n}\n"
    }
  ]
}