{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "steps-route",
  "title": "Steps on a route",
  "description": "How it works as a route on a map: numbered stops a pen rings in turn, joined by a line that wanders from one to the next and ends on a cross.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/steps-route.tsx",
      "content": "'use client';\n\n/**\n * steps-route — how it works, as a route on a map: numbered stops a pen rings\n * in turn, joined by a line that wanders from one to the next and ends on a\n * cross in the accent colour. On a phone the steps stack beside a rail that\n * inks down as you read.\n *\n * Built on svg-scroll-draw (MIT): https://github.com/DhruvilChauahan0210/scrollfx\n * Needs: react, svg-scroll-draw, and lib/plotter (installed with it).\n * Styling: Tailwind CSS with shadcn/ui tokens. The heading takes one emphasised\n * word between asterisks, set in `font-serif`.\n *\n * The steps are plain text in the server HTML; the route is drawn in the\n * browser. Reduced motion shows it drawn.\n */\n\nimport { useEffect, useState, type CSSProperties } from 'react';\nimport { ScrollAnimate, ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { route, scrollWindow, staggerFor } from '@/lib/plotter';\n\nexport interface Step {\n  title: string;\n  body: string;\n}\n\nexport interface StepsRouteProps {\n  eyebrow?: string;\n  heading?: string;\n  steps?: Step[];\n  accent?: string;\n  seed?: number;\n  className?: string;\n}\n\nconst DEFAULT_STEPS: Step[] = [\n  { title: 'Connect a source', body: 'Point it at your database, your warehouse or an event stream. Read-only, and nothing is copied until you say so.' },\n  { title: 'Pick what matters', body: 'Choose the tables and events to watch. Sensible dashboards are drafted for you from what it finds.' },\n  { title: 'Share the view', body: 'Invite the team, schedule the reports, and set the alerts that should wake someone up.' },\n  { title: 'Decide faster', body: 'Every number on the screen is live, and every one opens into the rows behind it.' },\n];\n\nfunction Heading({ text }: { text: string }) {\n  return <>{text.split(/(\\*[^*]+\\*)/).map((p, i) => (p.startsWith('*') ? <em key={i} className=\"italic\">{p.slice(1, -1)}</em> : <span key={i}>{p}</span>))}</>;\n}\n\nconst W = 1000, H = 140, R = 26;\n\n/** A ring round a stop, drawn as one stroke that overshoots its start a little, as a pen does. */\nconst ring = (x: number, y: number, r: number) =>\n  `M${x + r} ${y}A${r} ${r} 0 1 1 ${x + r * Math.cos(-0.35)} ${y + r * Math.sin(-0.35)}`;\n\nexport function StepsRoute({\n  eyebrow = 'How it works',\n  heading = 'Four stops, *one* line.',\n  steps = DEFAULT_STEPS,\n  accent = '#e0482a',\n  seed = 5,\n  className = '',\n}: StepsRouteProps) {\n  const [legs, setLegs] = useState<string[] | null>(null);\n  const n = steps.length;\n  const xs = steps.map((_, i) => ((i + 0.5) / n) * W);\n\n  useEffect(() => {\n    // Across, for wide screens: from ring to ring, leaving each ring on its\n    // edge so the line never crosses a number. Down, for phones.\n    const stops = xs.map((x): [number, number] => [x, H / 2]);\n    setLegs(stops.slice(0, -1).map(([x, y], i) => route([[x + R + 4, y], [stops[i + 1][0] - R - 4, y]], seed + i, 0.9)));\n    // xs follows steps.length, which the dependency covers.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [n, seed]);\n\n  const last = xs[n - 1];\n\n  return (\n    <section className={`mx-auto max-w-7xl px-6 py-28 sm:px-10 ${className}`}>\n      <p className=\"font-mono text-[11px] uppercase tracking-[0.22em] text-muted-foreground\">{eyebrow}</p>\n      <h2 className=\"mt-6 max-w-3xl font-serif text-[clamp(2.6rem,5vw,4.2rem)] leading-[0.98] tracking-[-0.03em]\">\n        <Heading text={heading} />\n      </h2>\n\n      {/* Wide screens: the route runs across above the steps. */}\n      <div className=\"relative mt-20 hidden aspect-[1000/140] md:block\">\n        {legs && (\n          // Ring, leg, ring, leg: the pen travels from stop to stop, reaching\n          // the last as the route reaches the middle of the screen.\n          <ScrollDraw stagger={staggerFor(2 * n, 1.5)} easing=\"linear\" trigger={scrollWindow(1.5)} className=\"absolute inset-0\" aria-hidden>\n            <svg viewBox={`0 0 ${W} ${H}`} className=\"size-full overflow-visible\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\">\n              {xs.flatMap((x, i) => [<path key={`r${i}`} d={ring(x, H / 2, R)} />, legs[i] ? <path key={`l${i}`} d={legs[i]} /> : null])}\n              <path d={`M${last - 9} ${H / 2 - 9 - R - 14}L${last + 9} ${H / 2 + 9 - R - 14}M${last + 9} ${H / 2 - 9 - R - 14}L${last - 9} ${H / 2 + 9 - R - 14}`} stroke={accent} strokeWidth=\"2.2\" />\n            </svg>\n          </ScrollDraw>\n        )}\n        {xs.map((x, i) => (\n          <span key={i} className=\"absolute top-1/2 -translate-x-1/2 -translate-y-1/2 font-serif text-2xl\" style={{ left: `${(x / W) * 100}%` }}>\n            {i + 1}\n          </span>\n        ))}\n      </div>\n\n      <ol className=\"relative mt-14 grid gap-12 md:mt-10 md:grid-cols-[repeat(var(--steps),minmax(0,1fr))] md:gap-10\" style={{ '--steps': n } as CSSProperties}>\n        {/* Phones: a hairline rail beside the steps, and the ink that runs down it. */}\n        <div aria-hidden className=\"absolute bottom-2 left-6 top-2 w-px bg-border md:hidden\" />\n        <ScrollAnimate aria-hidden props={{ transform: ['scaleY(0)', 'scaleY(1)'] }} trigger={{ start: 'top 70%', end: 'bottom 70%' }} easing=\"linear\" className=\"absolute bottom-2 left-6 top-2 w-px origin-top md:hidden\">\n          <div className=\"h-full w-px bg-foreground\" />\n        </ScrollAnimate>\n        {steps.map((s, i) => (\n          <li key={s.title} className=\"relative pl-16 md:pl-0 md:text-center\">\n            <span className=\"absolute left-[10px] top-0 grid size-7 place-items-center rounded-full border bg-background font-serif text-base md:hidden\">{i + 1}</span>\n            <h3 className=\"font-serif text-[1.7rem] leading-tight tracking-[-0.02em]\">{s.title}</h3>\n            <p className=\"mt-3 text-pretty leading-relaxed text-muted-foreground md:mx-auto md:max-w-[17rem]\">{s.body}</p>\n          </li>\n        ))}\n      </ol>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll to it: the pen rings each stop and travels on.",
    "tall": false
  },
  "type": "registry:block"
}