{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "circuit-pipeline-demo",
  "type": "registry:block",
  "title": "Circuit: Webhook Pipeline",
  "description": "Animated Flow Diagram example, Webhook Pipeline: A payment webhook through a queue and a worker to three destinations, fired by a button through `apiRef.send()` with `autoPlay={false}`. Each destination's trace carries its own `color`, and the delivery log fills from `onArrive`. A take on the flow diagram (flowchart). Fits features and integrations sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "features",
    "integrations",
    "flow-diagram",
    "diagram",
    "svg",
    "interaction",
    "landing"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/circuit#circuit-pipeline-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/circuit.json"
  ],
  "files": [
    {
      "path": "components/circuit-pipeline-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { Circuit, type CircuitControls } from \"@/components/ui/circuit\";\n\nconst STEPS = [\n  { id: \"stripe\", label: \"POST /webhooks/stripe\", meta: \"invoice.paid\" },\n  { id: \"queue\", label: \"Queue\", meta: \"events · fifo\" },\n  { id: \"worker\", label: \"Worker\", meta: \"handlePaid()\" },\n];\n\nconst SINKS = [\n  { id: \"db\", label: \"Postgres\", meta: \"upsert\", color: \"#34d399\" },\n  { id: \"email\", label: \"Email\", meta: \"receipt\", color: \"#a78bfa\" },\n  { id: \"slack\", label: \"Slack\", meta: \"#revenue\", color: \"#fbbf24\" },\n];\n\nconst card =\n  \"rounded-lg border border-zinc-200 bg-white px-3 py-2 transition-[opacity,border-color,box-shadow] duration-300 dark:border-zinc-800 dark:bg-zinc-900 data-[circuit-state=dimmed]:opacity-45 data-circuit-pulse:border-zinc-400 data-circuit-pulse:shadow-[0_0_0_4px_rgb(113_113_122/0.14)] dark:data-circuit-pulse:border-zinc-500\";\n\ntype Entry = { id: number; at: string; text: string };\n\nexport function CircuitPipelineDemo() {\n  const api = React.useRef<CircuitControls>(null);\n  const [log, setLog] = React.useState<Entry[]>([]);\n  const next = React.useRef(0);\n\n  return (\n    <div className=\"@container w-full max-w-3xl\">\n      <div className=\"grid gap-8 @2xl:grid-cols-[minmax(0,1fr)_15rem]\">\n        <Circuit\n          apiRef={api}\n          autoPlay={false}\n          speed={320}\n          flow={[\n            \"stripe -> queue -> worker\",\n            ...SINKS.map((s) => ({ from: \"worker\", to: s.id, color: s.color })),\n          ]}\n          onArrive={(node, from) => {\n            const time = new Date().toLocaleTimeString([], { hour12: false });\n            next.current += 1;\n            const id = next.current;\n            setLog((l) => [{ id, at: time, text: `${from} → ${node}` }, ...l].slice(0, 7));\n          }}\n          packetClassName=\"text-zinc-900 dark:text-zinc-100\"\n          className=\"flex flex-col items-center gap-9\"\n        >\n          {STEPS.map((s) => (\n            <div key={s.id} data-circuit={s.id} className={`${card} w-56 text-center`}>\n              <p className=\"font-mono text-xs font-medium text-zinc-900 dark:text-zinc-100\">{s.label}</p>\n              <p className=\"font-mono text-[11px] text-zinc-500\">{s.meta}</p>\n            </div>\n          ))}\n          <div className=\"grid w-full grid-cols-3 gap-3\">\n            {SINKS.map((s) => (\n              <div key={s.id} data-circuit={s.id} className={`${card} text-center`}>\n                <p className=\"flex items-center justify-center gap-1.5 text-xs font-medium text-zinc-900 dark:text-zinc-100\">\n                  <span className=\"size-1.5 rounded-full\" style={{ background: s.color }} />\n                  {s.label}\n                </p>\n                <p className=\"font-mono text-[11px] text-zinc-500\">{s.meta}</p>\n              </div>\n            ))}\n          </div>\n        </Circuit>\n\n        <div className=\"flex flex-col gap-3\">\n          <button\n            type=\"button\"\n            onClick={() => api.current?.send(\"stripe\")}\n            className=\"h-9 rounded-lg bg-zinc-900 px-3 text-sm font-medium text-white transition-transform active:scale-[0.98] dark:bg-zinc-100 dark:text-zinc-900\"\n          >\n            Send test event\n          </button>\n          <ol className=\"flex min-h-48 flex-col gap-1 rounded-lg border border-dashed border-zinc-200 p-3 font-mono text-[11px] dark:border-zinc-800\">\n            {log.length === 0 && <li className=\"text-zinc-400\">No deliveries yet.</li>}\n            {log.map((e) => (\n              <li key={e.id} className=\"flex justify-between gap-3 text-zinc-600 dark:text-zinc-400\">\n                <span>{e.text}</span>\n                <span className=\"text-zinc-400 dark:text-zinc-600\">{e.at}</span>\n              </li>\n            ))}\n          </ol>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}