{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cavemio-scroll-story",
  "title": "Scroll story",
  "description": "A how-it-works section that tells itself as you scroll: steps light up at the middle, a rail fills, and one card reshapes into each step’s picture.",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/components/scroll-story.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { NumberRoll } from \"./number-roll\";\n\n/* ─────────────────────────────────────────────────────────\n * SCROLL STORY: a how-it-works that tells itself as you scroll\n *\n *   steps     the words scroll past a picture that stays put; the\n *             step crossing the middle of the view lights up and\n *             the others wait at a third of their strength\n *   rail      a thin line down the steps fills with the scroll,\n *             continuously, and each step's dot fills as the line\n *             reaches it\n *   picture   one card that reshapes to each step's picture: its\n *             size eases from one to the next while the old\n *             picture blurs out and the new one rises in (and\n *             plays whatever it plays when it arrives). \"02 / 04\"\n *             rolls above it\n *   narrow    the picture sticks to the top and the steps slide\n *             underneath it\n *   jump      tapping a step scrolls it to the middle\n *\n * Works with the page's scroll or inside any scrolling box.\n * ───────────────────────────────────────────────────────── */\n\nexport interface ScrollStoryStep {\n  title: string;\n  body?: React.ReactNode;\n  /** Mounted when its step arrives, so any animation in it plays then. */\n  visual: React.ReactNode;\n}\n\nexport interface ScrollStoryProps extends Omit<\n  React.HTMLAttributes<HTMLDivElement>,\n  \"children\"\n> {\n  steps: ScrollStoryStep[];\n  /** Where the picture sits when there's room for two columns. */\n  side?: \"start\" | \"end\";\n  onStepChange?: (index: number) => void;\n}\n\nconst EASE = \"cubic-bezier(0.16,1,0.3,1)\";\nconst WIDE = 520;\n\nconst reducedQuery = \"(prefers-reduced-motion: reduce)\";\nconst subscribeReduced = (onChange: () => void) => {\n  const query = window.matchMedia(reducedQuery);\n  query.addEventListener(\"change\", onChange);\n  return () => query.removeEventListener(\"change\", onChange);\n};\nconst useReducedMotion = () =>\n  React.useSyncExternalStore(\n    subscribeReduced,\n    () => window.matchMedia(reducedQuery).matches,\n    () => false,\n  );\n\n/** The nearest box that scrolls vertically, or null for the page. */\nfunction scrollParent(el: HTMLElement | null) {\n  for (\n    let p = el?.parentElement;\n    p && p !== document.body;\n    p = p.parentElement\n  ) {\n    if (/(auto|scroll)/.test(getComputedStyle(p).overflowY)) return p;\n  }\n  return null;\n}\n\n/** The card that changes shape between pictures. */\nfunction Stage({\n  index,\n  children,\n  reduced,\n}: {\n  index: number;\n  children: React.ReactNode;\n  reduced: boolean;\n}) {\n  const innerRef = React.useRef<HTMLDivElement>(null);\n  const [size, setSize] = React.useState<{ w: number; h: number } | null>(null);\n  const [ghost, setGhost] = React.useState<{\n    key: number;\n    node: React.ReactNode;\n  } | null>(null);\n  const last = React.useRef({ index, node: children });\n\n  React.useLayoutEffect(() => {\n    const el = innerRef.current;\n    if (!el) return;\n    const measure = () => setSize({ w: el.offsetWidth, h: el.offsetHeight });\n    measure();\n    const observer = new ResizeObserver(measure);\n    observer.observe(el);\n    return () => observer.disconnect();\n  }, [index]);\n\n  // A new picture: keep the old one a moment to blur out underneath, raise the new one.\n  React.useLayoutEffect(() => {\n    if (index === last.current.index) {\n      last.current.node = children;\n      return;\n    }\n    if (!reduced)\n      setGhost({ key: last.current.index, node: last.current.node });\n    last.current = { index, node: children };\n    if (reduced) return;\n    innerRef.current?.animate(\n      [\n        {\n          opacity: 0,\n          transform: \"translateY(10px) scale(0.98)\",\n          filter: \"blur(4px)\",\n        },\n        { opacity: 1, transform: \"none\", filter: \"blur(0px)\" },\n      ],\n      { duration: 420, delay: 90, easing: EASE, fill: \"backwards\" },\n    );\n  }, [index, children, reduced]);\n\n  return (\n    <div\n      className=\"relative overflow-hidden rounded-[20px] border border-border bg-card\"\n      style={{\n        width: size?.w,\n        height: size?.h,\n        transition:\n          reduced || !size\n            ? \"none\"\n            : `width 460ms ${EASE}, height 460ms ${EASE}`,\n      }}\n    >\n      {ghost && (\n        <div\n          key={`ghost-${ghost.key}`}\n          aria-hidden=\"true\"\n          className=\"pointer-events-none absolute left-0 top-0 w-max\"\n          ref={(el) => {\n            if (!el || el.dataset.out) return;\n            el.dataset.out = \"1\";\n            const a = el.animate(\n              [\n                { opacity: 1, filter: \"blur(0px)\", transform: \"none\" },\n                { opacity: 0, filter: \"blur(4px)\", transform: \"scale(0.97)\" },\n              ],\n              { duration: 240, easing: EASE, fill: \"forwards\" },\n            );\n            a.onfinish = () =>\n              setGhost((g) => (g?.key === ghost.key ? null : g));\n          }}\n        >\n          {ghost.node}\n        </div>\n      )}\n      <div key={index} ref={innerRef} className=\"w-max\">\n        {children}\n      </div>\n    </div>\n  );\n}\n\nexport function ScrollStory({\n  steps,\n  side = \"end\",\n  onStepChange,\n  className = \"\",\n  style,\n  ...props\n}: ScrollStoryProps) {\n  const reduced = useReducedMotion();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const listRef = React.useRef<HTMLDivElement>(null);\n  const stickyRef = React.useRef<HTMLDivElement>(null);\n  const trackRef = React.useRef<HTMLSpanElement>(null);\n  const fillRef = React.useRef<HTMLSpanElement>(null);\n  const stepRefs = React.useRef<(HTMLDivElement | null)[]>([]);\n  const dotRefs = React.useRef<(HTMLSpanElement | null)[]>([]);\n  const scroller = React.useRef<HTMLElement | null>(null);\n  const [active, setActive] = React.useState(0);\n  const [viewport, setViewport] = React.useState(0);\n  const activeRef = React.useRef(0);\n  const changed = React.useRef(onStepChange);\n  React.useLayoutEffect(() => {\n    changed.current = onStepChange;\n  });\n\n  // Where the reading line is: the middle of the view, or the middle of what the sticky picture leaves.\n  const line = () => {\n    const box = scroller.current?.getBoundingClientRect();\n    const top = box ? box.top : 0;\n    const height = scroller.current\n      ? scroller.current.clientHeight\n      : window.innerHeight;\n    const wide = (rootRef.current?.clientWidth ?? 0) >= WIDE;\n    const stuck = wide ? 0 : (stickyRef.current?.offsetHeight ?? 0);\n    return top + stuck + (height - stuck) * (wide ? 0.5 : 0.42);\n  };\n\n  // On scroll: the rail fills to the line (written straight to the DOM), and the step at the line becomes active.\n  const update = React.useCallback(() => {\n    const list = listRef.current;\n    const first = dotRefs.current[0];\n    const last = dotRefs.current[steps.length - 1];\n    if (!list || !first || !last) return;\n    const y = line();\n    const origin = list.getBoundingClientRect().top;\n    const a =\n      first.getBoundingClientRect().top + first.offsetHeight / 2 - origin;\n    const b = last.getBoundingClientRect().top + last.offsetHeight / 2 - origin;\n    if (trackRef.current)\n      Object.assign(trackRef.current.style, {\n        top: `${a}px`,\n        height: `${b - a}px`,\n      });\n    if (fillRef.current)\n      Object.assign(fillRef.current.style, {\n        top: `${a}px`,\n        height: `${Math.min(b - a, Math.max(0, y - origin - a))}px`,\n      });\n    let next = 0;\n    stepRefs.current.forEach((el, i) => {\n      if (el && el.getBoundingClientRect().top <= y) next = i;\n    });\n    if (next !== activeRef.current) {\n      activeRef.current = next;\n      setActive(next);\n      changed.current?.(next);\n    }\n  }, [steps.length]);\n\n  React.useLayoutEffect(() => {\n    const root = rootRef.current;\n    if (!root) return;\n    scroller.current = scrollParent(root);\n    const target: HTMLElement | Window = scroller.current ?? window;\n    let frame = 0;\n    const onScroll = () => {\n      if (frame) return;\n      frame = requestAnimationFrame(() => {\n        frame = 0;\n        update();\n      });\n    };\n    const measure = () => {\n      setViewport(\n        scroller.current ? scroller.current.clientHeight : window.innerHeight,\n      );\n      onScroll();\n    };\n    measure();\n    target.addEventListener(\"scroll\", onScroll, { passive: true });\n    window.addEventListener(\"resize\", measure);\n    const observer = new ResizeObserver(measure);\n    observer.observe(root);\n    if (scroller.current) observer.observe(scroller.current);\n    return () => {\n      cancelAnimationFrame(frame);\n      target.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", measure);\n      observer.disconnect();\n    };\n  }, [update]);\n\n  const jump = (i: number) => {\n    const el = stepRefs.current[i];\n    if (!el) return;\n    const delta = el.getBoundingClientRect().top - line() + 2;\n    const behavior: ScrollBehavior = reduced ? \"auto\" : \"smooth\";\n    if (scroller.current) scroller.current.scrollBy({ top: delta, behavior });\n    else window.scrollBy({ top: delta, behavior });\n  };\n\n  const pad = (n: number) => String(n).padStart(2, \"0\");\n\n  return (\n    <div\n      ref={rootRef}\n      className={`@container ${className}`}\n      style={{ ...style, [\"--story-h\" as string]: `${viewport || 600}px` }}\n      {...props}\n    >\n      <div className=\"grid @min-[520px]:grid-cols-2 @min-[520px]:gap-10\">\n        {/* The picture: beside the steps when there's room, stuck to the top when there isn't. */}\n        <div\n          ref={stickyRef}\n          className={`sticky top-0 z-10 -mx-2 flex h-[calc(var(--story-h)*0.46)] flex-col items-center justify-center gap-3 border-b border-border bg-background px-2 @min-[520px]:mx-0 @min-[520px]:h-[var(--story-h)] @min-[520px]:border-b-0 @min-[520px]:bg-transparent @min-[520px]:px-0 ${\n            side === \"end\" ? \"@min-[520px]:order-last\" : \"\"\n          }`}\n        >\n          <p\n            className=\"text-[11.5px] tabular-nums text-muted-foreground\"\n            aria-hidden=\"true\"\n          >\n            <NumberRoll\n              value={active + 1}\n              format={{ minimumIntegerDigits: 2 }}\n              duration={500}\n            />{\" \"}\n            / {pad(steps.length)}\n          </p>\n          <Stage index={active} reduced={reduced}>\n            {steps[active]?.visual}\n          </Stage>\n        </div>\n\n        <div\n          ref={listRef}\n          className=\"relative pb-[calc(var(--story-h)*0.12)] pt-8 @min-[520px]:pt-[calc(var(--story-h)*0.38)]\"\n        >\n          <span\n            ref={trackRef}\n            aria-hidden=\"true\"\n            className=\"absolute left-[5px] w-px bg-border\"\n          />\n          <span\n            ref={fillRef}\n            aria-hidden=\"true\"\n            className=\"absolute left-[5px] w-px bg-foreground\"\n          />\n          {steps.map((s, i) => {\n            const on = i === active;\n            const reached = i <= active;\n            return (\n              <div\n                key={i}\n                ref={(el) => {\n                  stepRefs.current[i] = el;\n                }}\n                aria-current={on ? \"step\" : undefined}\n                className=\"relative min-h-[calc(var(--story-h)*0.42)] pl-7 @min-[520px]:min-h-[calc(var(--story-h)*0.55)]\"\n              >\n                <span\n                  ref={(el) => {\n                    dotRefs.current[i] = el;\n                  }}\n                  aria-hidden=\"true\"\n                  className=\"absolute left-0 top-[3px] size-[11px] rounded-full border\"\n                  style={{\n                    borderColor: reached\n                      ? \"var(--foreground)\"\n                      : \"var(--border)\",\n                    backgroundColor: reached\n                      ? \"var(--foreground)\"\n                      : \"var(--background)\",\n                    transform: on ? \"scale(1.15)\" : \"scale(1)\",\n                    transition: reduced\n                      ? \"none\"\n                      : `background-color 240ms ${EASE}, border-color 240ms ${EASE}, transform 320ms cubic-bezier(0.34,1.36,0.64,1)`,\n                  }}\n                />\n                <div\n                  style={{\n                    opacity: on ? 1 : 0.35,\n                    transition: reduced ? \"none\" : `opacity 400ms ${EASE}`,\n                  }}\n                >\n                  <p className=\"text-[11.5px] leading-4 tabular-nums text-muted-foreground\">\n                    {pad(i + 1)}\n                  </p>\n                  <h3 className=\"mt-1.5 text-[18px] font-semibold leading-tight tracking-tight text-foreground @min-[520px]:text-[20px]\">\n                    <button\n                      type=\"button\"\n                      onClick={() => jump(i)}\n                      className=\"cursor-pointer rounded-[4px] text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40\"\n                    >\n                      {s.title}\n                    </button>\n                  </h3>\n                  {s.body && (\n                    <div className=\"mt-2 max-w-[36ch] text-[13.5px] leading-relaxed text-muted-foreground\">\n                      {s.body}\n                    </div>\n                  )}\n                </div>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    },
    {
      "path": "registry/components/number-roll.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\n/* ─────────────────────────────────────────────────────────\n * NUMBER ROLL: numbers that change like an odometer\n *\n *   rolling   each digit is a column that rolls to its new\n *             value, in the direction the number moved: going\n *             up, a 9 rolls on to 0 instead of spinning back\n *   places    new places slide open from nothing; lost ones\n *             fold away\n *   format    anything Intl.NumberFormat does: currency,\n *             percent, compact (\"1.2K\"), decimals\n *\n * The real number is always there as text for screen readers\n * and copy and paste; the columns are only what you see.\n * ───────────────────────────────────────────────────────── */\n\nexport interface NumberRollProps extends Omit<\n  React.HTMLAttributes<HTMLSpanElement>,\n  \"children\"\n> {\n  value: number;\n  /** Intl.NumberFormat options, e.g. { style: \"currency\", currency: \"USD\" }. */\n  format?: Intl.NumberFormatOptions;\n  locales?: string | string[];\n  prefix?: string;\n  suffix?: string;\n  /** Start from this value and roll to `value` once mounted, e.g. 0 for stats. */\n  from?: number;\n  /** Roll duration in ms. */\n  duration?: number;\n  /** Always roll this way, e.g. \"down\" for a countdown's seconds, which wrap from 00 to 59. Defaults to the way the number moved. */\n  direction?: \"up\" | \"down\";\n}\n\ntype Column = { key: string; char: string; digit: number | null };\n\nconst EASE = \"cubic-bezier(0.16,1,0.3,1)\";\nconst SETS = 5; // the strip repeats 0–9 five times so a roll never runs out of digits\nconst MIDDLE = 20;\n/** The strip as one text node, a digit a line: fifty lines, but one element to lay out instead of fifty. */\nconst STRIP = Array.from({ length: SETS * 10 }, (_, i) => i % 10).join(\"\\n\");\n\nconst reducedQuery = \"(prefers-reduced-motion: reduce)\";\nconst subscribeReduced = (onChange: () => void) => {\n  const query = window.matchMedia(reducedQuery);\n  query.addEventListener(\"change\", onChange);\n  return () => query.removeEventListener(\"change\", onChange);\n};\nconst useReducedMotion = () =>\n  React.useSyncExternalStore(\n    subscribeReduced,\n    () => window.matchMedia(reducedQuery).matches,\n    () => false,\n  );\n\n/** Digits are keyed by their place counted from the right, so the units column stays the units column. */\nfunction columns(text: string): Column[] {\n  const chars = [...text];\n  const seen = new Map<string, number>();\n  let place = 0;\n  const out: Column[] = [];\n  for (let i = chars.length - 1; i >= 0; i--) {\n    const char = chars[i];\n    if (/\\d/.test(char))\n      out.push({ key: `d${place++}`, char, digit: Number(char) });\n    else {\n      // Symbols are keyed by how many of the same symbol sit to their right, so a comma that shifts is the same comma.\n      const n = seen.get(char) ?? 0;\n      seen.set(char, n + 1);\n      out.push({ key: `s${char}${n}`, char, digit: null });\n    }\n  }\n  return out.reverse();\n}\n\n// Memoised: a parent that re-renders with the same number doesn't rebuild the strips.\nconst Digit = React.memo(function Digit({\n  digit,\n  trend,\n  duration,\n  reduced,\n  rollIn,\n}: {\n  digit: number;\n  trend: number;\n  duration: number;\n  reduced: boolean;\n  rollIn: boolean;\n}) {\n  const [pos, setPos] = React.useState(MIDDLE + (rollIn ? 0 : digit));\n  const [moving, setMoving] = React.useState(false);\n  const posRef = React.useRef(pos);\n  const stripRef = React.useRef<HTMLSpanElement>(null);\n\n  React.useLayoutEffect(() => {\n    const current = posRef.current;\n    const showing = ((current % 10) + 10) % 10;\n    if (showing === digit) return;\n    if (reduced) {\n      posRef.current = MIDDLE + digit;\n      setMoving(false);\n      setPos(MIDDLE + digit);\n      return;\n    }\n    const up = trend > 0 || (trend === 0 && digit > showing);\n    let target = up\n      ? current + ((digit - showing + 10) % 10)\n      : current - ((showing - digit + 10) % 10);\n    // Values arriving faster than a roll (a progress percent) never let it re-centre, so before it runs off the strip,\n    // jump the strip back by whole sets mid-roll (it looks identical) and roll on from there.\n    if (target < 10 || target > SETS * 10 - 11) {\n      const shift = Math.round((target - MIDDLE) / 10) * 10;\n      const strip = stripRef.current;\n      if (strip?.offsetHeight) {\n        let visual = current;\n        try {\n          visual =\n            -new DOMMatrixReadOnly(getComputedStyle(strip).transform).m42 /\n            (strip.offsetHeight / (SETS * 10));\n        } catch {}\n        const transition = strip.style.transition;\n        strip.style.transition = \"none\";\n        strip.style.transform = `translateY(${(-(visual - shift) * 100) / (SETS * 10)}%)`;\n        void strip.offsetHeight;\n        strip.style.transition = transition;\n      }\n      target -= shift;\n    }\n    posRef.current = target;\n    setMoving(true);\n    setPos(target);\n  }, [digit, trend, reduced]);\n\n  // After a roll, quietly re-centre on the middle set so the next roll always has room.\n  const settle = () => {\n    const centred = MIDDLE + (((posRef.current % 10) + 10) % 10);\n    posRef.current = centred;\n    setMoving(false);\n    setPos(centred);\n  };\n\n  return (\n    <span className=\"relative inline-block [clip-path:inset(0)]\">\n      <span className=\"invisible\">{digit}</span>\n      <span\n        ref={stripRef}\n        aria-hidden=\"true\"\n        onTransitionEnd={settle}\n        className=\"absolute inset-x-0 top-0 block whitespace-pre text-center\"\n        style={{\n          transform: `translateY(${(-pos * 100) / (SETS * 10)}%)`,\n          transition: moving ? `transform ${duration}ms ${EASE}` : \"none\",\n        }}\n      >\n        {STRIP}\n      </span>\n    </span>\n  );\n});\n\n/** A place that appeared after the first paint slides open; places that were there from the start just sit. */\nfunction Place({\n  enter,\n  children,\n}: {\n  enter: boolean;\n  children: React.ReactNode;\n}) {\n  const [entering] = React.useState(enter);\n  return (\n    <span\n      className={`inline-block ${entering ? \"[clip-path:inset(0)] animate-[ui-col-in_500ms_cubic-bezier(0.16,1,0.3,1)_both]\" : \"\"}`}\n    >\n      {children}\n    </span>\n  );\n}\n\nexport function NumberRoll({\n  value,\n  format,\n  locales,\n  prefix = \"\",\n  suffix = \"\",\n  from,\n  duration = 900,\n  direction,\n  className = \"\",\n  ...props\n}: NumberRollProps) {\n  const reduced = useReducedMotion();\n  const [shown, setShown] = React.useState(from ?? value);\n  const previous = React.useRef(shown);\n  const mounted = React.useRef(false);\n\n  // Roll from `from` to the real value once on screen (a frame later, so the start is painted).\n  React.useEffect(() => {\n    const frame = requestAnimationFrame(() => setShown(value));\n    return () => cancelAnimationFrame(frame);\n  }, [value]);\n\n  React.useEffect(() => {\n    mounted.current = true;\n  }, []);\n\n  const formatter = React.useMemo(\n    () => new Intl.NumberFormat(locales, format),\n    [locales, format && JSON.stringify(format)],\n  );\n  const text = `${prefix}${formatter.format(shown)}${suffix}`;\n  const cols = React.useMemo(() => columns(text), [text]);\n  const trend =\n    direction === \"up\"\n      ? 1\n      : direction === \"down\"\n        ? -1\n        : Math.sign(shown - previous.current);\n\n  // Places that disappear fold away instead of vanishing.\n  const [leaving, setLeaving] = React.useState<Column[]>([]);\n  const lastCols = React.useRef(cols);\n  React.useLayoutEffect(() => {\n    const gone = lastCols.current.filter(\n      (c) => !cols.some((n) => n.key === c.key),\n    );\n    lastCols.current = cols;\n    previous.current = shown;\n    if (!gone.length || reduced) return;\n    setLeaving(gone);\n    const timer = window.setTimeout(() => setLeaving([]), 420);\n    return () => window.clearTimeout(timer);\n  }, [cols, shown, reduced]);\n\n  return (\n    <span className={`inline-flex tabular-nums ${className}`} {...props}>\n      <span className=\"sr-only\">{`${prefix}${formatter.format(value)}${suffix}`}</span>\n      <span\n        aria-hidden=\"true\"\n        className=\"inline-flex items-baseline whitespace-pre\"\n      >\n        {leaving.map((c) => (\n          <span\n            key={`out-${c.key}`}\n            className=\"inline-block [clip-path:inset(0)] animate-[ui-col-out_400ms_cubic-bezier(0.16,1,0.3,1)_forwards]\"\n          >\n            {c.char}\n          </span>\n        ))}\n        {cols.map((c) => (\n          <Place key={c.key} enter={mounted.current && !reduced}>\n            {c.digit === null ? (\n              c.char\n            ) : (\n              <Digit\n                digit={c.digit}\n                trend={trend}\n                duration={duration}\n                reduced={reduced}\n                rollIn={mounted.current}\n              />\n            )}\n          </Place>\n        ))}\n      </span>\n    </span>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "css": {
    "@keyframes ui-col-in": {
      "from": {
        "max-width": "0",
        "opacity": "0"
      },
      "to": {
        "max-width": "1em",
        "opacity": "1"
      }
    },
    "@keyframes ui-col-out": {
      "from": {
        "max-width": "1em",
        "opacity": "1"
      },
      "to": {
        "max-width": "0",
        "opacity": "0"
      }
    }
  },
  "meta": {
    "cavemio": {
      "component": "scroll-story",
      "exportName": "ScrollStory",
      "categories": [
        "motion"
      ],
      "isNew": false,
      "usage": "import { ScrollStory } from \"@/components/scroll-story\";\n\n<ScrollStory\n  steps={[\n    { title: \"Pick a template\", body: \"Start from a page that already moves.\", visual: <PickTemplate /> },\n    { title: \"Make it yours\", body: \"Your name, your colour.\", visual: <MakeYours /> },\n    { title: \"Go live\", body: \"Push it and watch the first visitors arrive.\", visual: <GoLive /> },\n  ]}\n/>",
      "accessibility": "- It finds the nearest scrolling box itself, so it works in the page or inside a scrolling panel; give the box a height.\n- The active step has aria-current=\"step\"; each title is a button that scrolls its step into place.\n- Every step’s words stay in the page for reading and search; only the pictures come and go.\n- Installs Number roll. With reduced motion the pictures swap in place and jumps don’t smooth-scroll.",
      "previewNote": "Interactive local fixture. Data and async results are simulated in the preview; the caller supplies application services.",
      "documentation": {
        "props": [
          {
            "name": "steps",
            "type": "{ title: string; body?: ReactNode; visual: ReactNode }[]",
            "description": "– · In order. Give visuals a set width (the card sizes itself to them); keep them under about 280px wide for phones."
          },
          {
            "name": "side",
            "type": "\"start\" | \"end\"",
            "description": "\"end\" · Which side the picture sits on when there’s room for two columns."
          },
          {
            "name": "onStepChange",
            "type": "(index: number) => void",
            "description": "– · Runs when a different step becomes active."
          }
        ],
        "useCases": [
          {
            "title": "How-it-works sections",
            "description": "Explain a product in steps on a landing page."
          },
          {
            "title": "Product tours",
            "description": "A sticky picture that changes as each step comes into view."
          },
          {
            "title": "Long-form explainers",
            "description": "Case studies and feature write-ups with a picture for each part."
          },
          {
            "title": "Onboarding and docs pages",
            "description": "Walk through a setup in the order it should happen."
          }
        ],
        "features": [
          {
            "title": "The step in the middle lights up",
            "description": "Whichever step crosses the middle of the view is at full strength, and the others wait at about a third."
          },
          {
            "title": "A rail that fills",
            "description": "A thin line down the side fills with the scroll and each step’s dot fills as the line reaches it."
          },
          {
            "title": "One picture that reshapes",
            "description": "The card eases to the size of each step’s picture while the old one blurs out and the new one rises in."
          },
          {
            "title": "Pictures that play when their step arrives",
            "description": "Each picture mounts when its step becomes active, so a switch flipping or a count rolling plays right then."
          },
          {
            "title": "A phone layout",
            "description": "On narrow screens the picture sticks to the top and the steps scroll beneath it."
          },
          {
            "title": "Tap a step to go there",
            "description": "Titles are buttons that scroll their step into place, and all the words stay in the page for reading and search."
          }
        ],
        "states": [
          {
            "title": "reading line",
            "description": "The middle of the view (wide), or 42% down what the sticky picture leaves (narrow). The last step whose top has crossed it is the active one."
          },
          {
            "title": "rail",
            "description": "A 1px track from the first dot to the last; the fill follows the reading line on every scroll frame (written straight to the DOM, no re-render). Dots fill and the active one grows to 1.15× with a slight overshoot."
          },
          {
            "title": "steps",
            "description": "Inactive steps at 35% opacity, the active one at full (400ms)."
          },
          {
            "title": "picture",
            "description": "The card eases its width and height to the new picture (460ms); the old one blurs out and shrinks to 0.97 (240ms) while the new one rises 10px out of a 4px blur (420ms, 90ms in). The counter rolls."
          },
          {
            "title": "narrow",
            "description": "Under 520px of width the picture sticks to the top at 46% of the view with a thin line under it, and the steps scroll beneath."
          }
        ]
      }
    }
  },
  "type": "registry:component"
}