{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "steps-circuit",
  "type": "registry:component",
  "title": "Steps Circuit",
  "description": "Steps drawn as chips on a dotted board, joined by rounded circuit traces that fill up to the current step while a signal pulse travels the route. Below, a panel explains the step with a typed terminal log.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "how-it-works",
    "how it works",
    "stepper",
    "circuit",
    "terminal",
    "auto advance",
    "developer"
  ],
  "docs": "https://hyperblur.dev/effects/steps-circuit",
  "files": [
    {
      "path": "registry/hyperblur/steps-circuit.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/steps-circuit.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CircuitStep {\n  title: string;\n  caption: string;\n  detail: string;\n  log: string[];\n}\n\nexport interface StepsCircuitProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  steps?: CircuitStep[];\n  defaultStep?: number;\n  step?: number;\n  onStepChange?: (index: number) => void;\n  autoPlay?: boolean;\n  interval?: number;\n  accent?: string;\n}\n\nconst defaultSteps: CircuitStep[] = [\n  {\n    title: \"Connect a source\",\n    caption: \"Postgres, MySQL, S3\",\n    detail: \"Paste a read-only connection string. Relay opens a tunnel, reads the schema and never writes to your database.\",\n    log: [\"relay connect postgres://ro@db.internal:5432/app\", \"tunnel open · tls 1.3\", \"found 42 tables · 1.8M rows\"],\n  },\n  {\n    title: \"Map the fields\",\n    caption: \"Rename, cast, drop\",\n    detail: \"Relay proposes types and joins from the schema. Accept them, or rename and cast columns before anything moves.\",\n    log: [\"orders.total -> numeric(12,2)\", \"users.email -> lowercase, unique\", \"3 columns dropped · pii.ssn masked\"],\n  },\n  {\n    title: \"Validate a sample\",\n    caption: \"10,000 rows, dry run\",\n    detail: \"A dry run on a sample checks every rule and shows the rows that would fail, with the reason next to each one.\",\n    log: [\"sampling 10,000 rows\", \"9,987 passed · 13 flagged\", \"flagged: null customer_id (13)\"],\n  },\n  {\n    title: \"Sync on a schedule\",\n    caption: \"Every 15 minutes\",\n    detail: \"Turn the pipeline on. Incremental syncs pick up only changed rows and alert the channel you choose when one fails.\",\n    log: [\"schedule 0,15,30,45 * * * *\", \"first sync 1,802,114 rows in 4m 12s\", \"next run in 15m · alerts #data-ops\"],\n  },\n];\n\nconst css = `\n.hb-we4 {\n  --hb-we4-accent: #34d399;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-we4 *, .hb-we4 *::before, .hb-we4 *::after { box-sizing: border-box; }\n.hb-we4-inner { max-width: 1120px; margin: 0 auto; padding: clamp(56px, 8cqi, 104px) clamp(18px, 4cqi, 40px); }\n.hb-we4-head { display: grid; gap: 14px; justify-items: center; text-align: center; margin-bottom: clamp(28px, 4cqi, 48px); }\n.hb-we4-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0; height: 28px; padding: 0 12px; border-radius: 999px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--hb-we4-accent); background: color-mix(in srgb, var(--hb-we4-accent) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-we4-accent) 25%, transparent); }\n.hb-we4-title { margin: 0; max-width: 20ch; font-family: var(--font-grotesk, inherit); font-size: clamp(28px, 4.4cqi, 48px); font-weight: 600; line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }\n.hb-we4-sub { margin: 0; max-width: 54ch; color: #a1a1a1; font-size: 15px; line-height: 1.6; }\n.hb-we4-board {\n  position: relative; border-radius: 24px; overflow: hidden;\n  background:\n    radial-gradient(60% 80% at 50% 0%, color-mix(in srgb, var(--hb-we4-accent) 8%, transparent), transparent 70%),\n    radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.2px) 0 0 / 22px 22px,\n    #0d0f0e;\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.05);\n}\n.hb-we4-map { position: relative; width: 100%; }\n.hb-we4-map[data-o=\"h\"] { aspect-ratio: 1000 / 340; }\n.hb-we4-map[data-o=\"v\"] { aspect-ratio: 360 / 760; display: none; }\n.hb-we4-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }\n.hb-we4-trace { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }\n.hb-we4-via { fill: #0d0f0e; stroke: rgba(255,255,255,.16); stroke-width: 2; }\n.hb-we4-fill { fill: none; stroke: var(--hb-we4-accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100 100; stroke-dashoffset: var(--hb-we4-off, 100); transition: stroke-dashoffset 1.1s cubic-bezier(.65,0,.25,1); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hb-we4-accent) 70%, transparent)); }\n.hb-we4-packet { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1.5 98.5; animation: hb-we4-run 3.2s cubic-bezier(.45,0,.55,1) infinite; opacity: .85; }\n.hb-we4-chip {\n  position: absolute; left: var(--hb-we4-x); top: var(--hb-we4-y); transform: translate(-50%, -50%);\n  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px; width: clamp(150px, 19cqi, 210px);\n  padding: 12px 14px; border: 0; border-radius: 14px; cursor: pointer; text-align: left; color: inherit; font: inherit;\n  background: linear-gradient(180deg, #1a1c1b, #121413); box-shadow: inset 0 0 0 1px rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.07), 0 18px 30px -16px rgba(0,0,0,.9);\n  transition: box-shadow .4s ease, transform .4s cubic-bezier(.2,.8,.2,1);\n}\n.hb-we4-chip::before, .hb-we4-chip::after { content: \"\"; position: absolute; left: 18px; right: 18px; height: 4px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 3px, transparent 3px 8px); }\n.hb-we4-chip::before { top: -4px; }\n.hb-we4-chip::after { bottom: -4px; }\n.hb-we4-chip:hover { transform: translate(-50%, -50%) translateY(-2px); }\n.hb-we4-chip[data-s=\"active\"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-we4-accent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 4px color-mix(in srgb, var(--hb-we4-accent) 12%, transparent), 0 20px 40px -16px color-mix(in srgb, var(--hb-we4-accent) 40%, #000); }\n.hb-we4-chip:focus-visible { outline: 2px solid var(--hb-we4-accent); outline-offset: 4px; }\n.hb-we4-num { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: #8f8f8f; background: #0b0c0c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: color .3s ease, background .3s ease; }\n.hb-we4-chip[data-s=\"done\"] .hb-we4-num { color: var(--hb-we4-accent); }\n.hb-we4-chip[data-s=\"active\"] .hb-we4-num { color: #062014; background: var(--hb-we4-accent); box-shadow: none; }\n.hb-we4-ct { min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-we4-cc { display: flex; align-items: center; gap: 6px; min-width: 0; color: #8f8f8f; font-size: 12px; white-space: nowrap; }\n.hb-we4-led { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #3a3a3a; }\n.hb-we4-chip[data-s=\"done\"] .hb-we4-led { background: var(--hb-we4-accent); }\n.hb-we4-chip[data-s=\"active\"] .hb-we4-led { background: var(--hb-we4-accent); animation: hb-we4-blink 1.2s ease-in-out infinite; }\n.hb-we4-panel { display: grid; gap: 16px; margin: 0 clamp(12px, 2.4cqi, 24px) clamp(12px, 2.4cqi, 24px); padding: clamp(16px, 2.4cqi, 24px); border-radius: 18px; background: rgba(10,10,10,.75); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }\n.hb-we4-pt { display: flex; align-items: baseline; gap: 12px; margin: 0 0 6px; font-size: 17px; font-weight: 600; }\n.hb-we4-pt span { color: var(--hb-we4-accent); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; font-weight: 500; }\n.hb-we4-pd { margin: 0; color: #a1a1a1; font-size: 14px; line-height: 1.6; max-width: 52ch; }\n.hb-we4-term { margin: 0; padding: 14px 16px; border-radius: 12px; background: #070807; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.8; color: #cfcfcf; overflow: hidden; min-width: 0; }\n.hb-we4-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; animation: hb-we4-type .5s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--hb-we4-k) * 380ms + 250ms); }\n.hb-we4-line::before { content: \"$ \"; color: var(--hb-we4-accent); }\n.hb-we4-line + .hb-we4-line::before { content: \"› \"; color: #6b6b6b; }\n.hb-we4-panel > * { animation: hb-we4-in .5s cubic-bezier(.2,.8,.2,1) both; }\n@keyframes hb-we4-run { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }\n@keyframes hb-we4-blink { 50% { opacity: .25; } }\n@keyframes hb-we4-type { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }\n@keyframes hb-we4-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }\n@container (min-width: 820px) {\n  .hb-we4-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; }\n}\n@container (max-width: 719px) {\n  .hb-we4-map[data-o=\"h\"] { display: none; }\n  .hb-we4-map[data-o=\"v\"] { display: block; }\n  .hb-we4-chip { width: min(62%, 220px); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-we4 *, .hb-we4 *::before, .hb-we4 *::after { transition: none !important; animation: none !important; }\n  .hb-we4-line { opacity: 1; }\n  .hb-we4-packet { display: none; }\n}\n`;\n\ntype Pt = { x: number; y: number };\n\nfunction route(points: Pt[], vertical: boolean) {\n  const r = 18;\n  let d = `M ${points[0].x} ${points[0].y}`;\n  for (let i = 0; i < points.length - 1; i++) {\n    const a = points[i];\n    const b = points[i + 1];\n    if (!vertical) {\n      const mx = (a.x + b.x) / 2;\n      const dir = b.y > a.y ? 1 : -1;\n      d += ` L ${mx - r} ${a.y} Q ${mx} ${a.y} ${mx} ${a.y + dir * r} L ${mx} ${b.y - dir * r} Q ${mx} ${b.y} ${mx + r} ${b.y} L ${b.x} ${b.y}`;\n    } else {\n      const my = (a.y + b.y) / 2;\n      const dir = b.x > a.x ? 1 : -1;\n      d += ` L ${a.x} ${my - r} Q ${a.x} ${my} ${a.x + dir * r} ${my} L ${b.x - dir * r} ${my} Q ${b.x} ${my} ${b.x} ${my + r} L ${b.x} ${b.y}`;\n    }\n  }\n  return d;\n}\n\nfunction layout(n: number, vertical: boolean): Pt[] {\n  return Array.from({ length: n }, (_, i) => {\n    const t = (i + 0.5) / n;\n    const alt = i % 2 === 0;\n    return vertical ? { x: alt ? 120 : 240, y: Math.round(t * 760) } : { x: Math.round(t * 1000), y: alt ? 105 : 235 };\n  });\n}\n\nexport function StepsCircuit({\n  eyebrow = \"How Relay works\",\n  title = \"From a connection string to a live pipeline in four moves\",\n  subtitle = \"Every step is wired to the next. Click any stage to jump there, or let the signal run on its own.\",\n  steps = defaultSteps,\n  defaultStep = 0,\n  step,\n  onStepChange,\n  autoPlay = true,\n  interval = 3400,\n  accent = \"#34d399\",\n  className,\n  style,\n  ...rest\n}: StepsCircuitProps) {\n  const [inner, setInner] = React.useState(defaultStep);\n  const active = Math.max(0, Math.min(steps.length - 1, step ?? inner));\n  const [paused, setPaused] = React.useState(false);\n  const [reduced, setReduced] = React.useState(false);\n  const uid = React.useId().replace(/:/g, \"\");\n\n  const go = React.useCallback(\n    (i: number) => {\n      if (step === undefined) setInner(i);\n      onStepChange?.(i);\n    },\n    [step, onStepChange],\n  );\n\n  React.useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const on = () => setReduced(mq.matches);\n    const t = window.setTimeout(on, 0);\n    mq.addEventListener(\"change\", on);\n    return () => {\n      window.clearTimeout(t);\n      mq.removeEventListener(\"change\", on);\n    };\n  }, []);\n\n  const playing = autoPlay && !paused && !reduced && steps.length > 1;\n  React.useEffect(() => {\n    if (!playing) return;\n    const t = window.setTimeout(() => go((active + 1) % steps.length), interval);\n    return () => window.clearTimeout(t);\n  }, [playing, active, interval, steps.length, go]);\n\n  const n = steps.length;\n  const off = n > 1 ? 100 - (active / (n - 1)) * 100 : 0;\n  const info = steps[active];\n\n  const map = (vertical: boolean) => {\n    const pts = layout(n, vertical);\n    const d = route(pts, vertical);\n    const w = vertical ? 360 : 1000;\n    const h = vertical ? 760 : 340;\n    return (\n      <div className=\"hb-we4-map\" data-o={vertical ? \"v\" : \"h\"}>\n        <svg viewBox={`0 0 ${w} ${h}`} aria-hidden=\"true\">\n          <defs>\n            <linearGradient id={`${uid}${vertical ? \"v\" : \"h\"}`} x1=\"0\" x2={vertical ? \"0\" : \"1\"} y1=\"0\" y2={vertical ? \"1\" : \"0\"}>\n              <stop offset=\"0\" stopColor=\"rgba(255,255,255,.04)\" />\n              <stop offset=\".5\" stopColor=\"rgba(255,255,255,.12)\" />\n              <stop offset=\"1\" stopColor=\"rgba(255,255,255,.04)\" />\n            </linearGradient>\n          </defs>\n          {[0.2, 0.8].map((k) =>\n            vertical ? (\n              <path key={k} d={`M ${k * w} 0 V ${h}`} stroke={`url(#${uid}v)`} strokeWidth=\"1\" strokeDasharray=\"2 8\" fill=\"none\" />\n            ) : (\n              <path key={k} d={`M 0 ${k * h} H ${w}`} stroke={`url(#${uid}h)`} strokeWidth=\"1\" strokeDasharray=\"2 8\" fill=\"none\" />\n            ),\n          )}\n          <path className=\"hb-we4-trace\" d={d} />\n          <path className=\"hb-we4-fill\" d={d} pathLength={100} style={{ \"--hb-we4-off\": off.toFixed(2) } as React.CSSProperties} />\n          {playing ? <path className=\"hb-we4-packet\" d={d} pathLength={100} /> : null}\n          {pts.slice(0, -1).map((p, i) => {\n            const q = pts[i + 1];\n            const c = vertical ? { x: (p.x + q.x) / 2, y: (p.y + q.y) / 2 } : { x: (p.x + q.x) / 2, y: (p.y + q.y) / 2 };\n            return <circle key={i} className=\"hb-we4-via\" cx={c.x} cy={c.y} r=\"5\" />;\n          })}\n        </svg>\n        {steps.map((s, i) => {\n          const p = pts[i];\n          const state = i < active ? \"done\" : i === active ? \"active\" : \"next\";\n          return (\n            <button\n              key={s.title}\n              type=\"button\"\n              className=\"hb-we4-chip\"\n              data-s={state}\n              aria-current={i === active ? \"step\" : undefined}\n              aria-label={`Step ${i + 1}: ${s.title}`}\n              style={{ \"--hb-we4-x\": `${((p.x / w) * 100).toFixed(2)}%`, \"--hb-we4-y\": `${((p.y / h) * 100).toFixed(2)}%` } as React.CSSProperties}\n              onClick={() => go(i)}\n              onKeyDown={(e) => {\n                if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n                  e.preventDefault();\n                  go(Math.min(n - 1, i + 1));\n                  const next = e.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\".hb-we4-chip\")[Math.min(n - 1, i + 1)];\n                  next?.focus();\n                } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n                  e.preventDefault();\n                  go(Math.max(0, i - 1));\n                  const prev = e.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\".hb-we4-chip\")[Math.max(0, i - 1)];\n                  prev?.focus();\n                }\n              }}\n            >\n              <span className=\"hb-we4-num\">{String(i + 1).padStart(2, \"0\")}</span>\n              <span className=\"hb-we4-ct\">{s.title}</span>\n              <span className=\"hb-we4-cc\"><span className=\"hb-we4-led\" />{s.caption}</span>\n            </button>\n          );\n        })}\n      </div>\n    );\n  };\n\n  return (\n    <section\n      className={[\"hb-we4\", className].filter(Boolean).join(\" \")}\n      style={{ \"--hb-we4-accent\": accent, ...style } as React.CSSProperties}\n      onMouseEnter={() => setPaused(true)}\n      onMouseLeave={() => setPaused(false)}\n      onFocus={() => setPaused(true)}\n      onBlur={(e) => {\n        if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setPaused(false);\n      }}\n      {...rest}\n    >\n      <style href=\"hb-steps-circuit\" precedence=\"default\">{css}</style>\n      <div className=\"hb-we4-inner\">\n        <header className=\"hb-we4-head\">\n          {eyebrow ? <p className=\"hb-we4-eyebrow\">{eyebrow}</p> : null}\n          <h2 className=\"hb-we4-title\">{title}</h2>\n          {subtitle ? <p className=\"hb-we4-sub\">{subtitle}</p> : null}\n        </header>\n        <div className=\"hb-we4-board\">\n          {map(false)}\n          {map(true)}\n          <div className=\"hb-we4-panel\" key={active} aria-live=\"polite\">\n            <div>\n              <h3 className=\"hb-we4-pt\"><span>{String(active + 1).padStart(2, \"0\")} / {String(n).padStart(2, \"0\")}</span>{info.title}</h3>\n              <p className=\"hb-we4-pd\">{info.detail}</p>\n            </div>\n            <pre className=\"hb-we4-term\">\n              {info.log.map((l, k) => (\n                <span key={k} className=\"hb-we4-line\" style={{ \"--hb-we4-k\": k } as React.CSSProperties}>{l}</span>\n              ))}\n            </pre>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}