{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader-status-feed",
  "type": "registry:component",
  "title": "Loader Status Feed",
  "description": "Status lines are typed out one at a time with a block caret and a spinner, then checked off with a timing as the next line scrolls in. Good for long jobs that should show what they are doing.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "loaders",
    "loader",
    "status",
    "typewriter",
    "steps",
    "agent",
    "log"
  ],
  "docs": "https://hyperblur.dev/effects/loader-status-feed",
  "files": [
    {
      "path": "registry/hyperblur/loader-status-feed.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/loader-status-feed.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoaderStatusFeedProps extends React.HTMLAttributes<HTMLDivElement> {\n  steps?: string[];\n  step?: number;\n  visible?: number;\n  typeSpeed?: number;\n  hold?: number;\n  color?: string;\n  accent?: string;\n  label?: string;\n}\n\nfunction hash(n: number) {\n  let x = (n * 2654435761) >>> 0;\n  x = Math.imul(x ^ (x >>> 15), 0x2c1b3c6d) >>> 0;\n  x = Math.imul(x ^ (x >>> 12), 0x297a2d39) >>> 0;\n  return ((x ^ (x >>> 15)) >>> 0) / 4294967295;\n}\n\nconst css = `\n.hb-vk7 {\n  position: relative;\n  width: 100%;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n  --hb-vk7-lh: 24px;\n}\n.hb-vk7 *, .hb-vk7 *::before, .hb-vk7 *::after { box-sizing: border-box; }\n.hb-vk7-win {\n  position: relative;\n  height: calc(var(--hb-vk7-lh) * var(--hb-vk7-v));\n  overflow: hidden;\n  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 calc(var(--hb-vk7-lh) * 0.7));\n  mask-image: linear-gradient(180deg, transparent 0, #000 calc(var(--hb-vk7-lh) * 0.7));\n}\n.hb-vk7-list {\n  position: absolute;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  display: flex;\n  flex-direction: column;\n  animation: hb-vk7-scroll 420ms cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-vk7-row {\n  display: flex;\n  align-items: center;\n  gap: 9px;\n  height: var(--hb-vk7-lh);\n  min-width: 0;\n  font-size: 12.5px;\n  line-height: 1;\n}\n.hb-vk7-ic {\n  position: relative;\n  flex: none;\n  width: 14px;\n  height: 14px;\n  display: grid;\n  place-items: center;\n}\n.hb-vk7-ic svg { display: block; width: 14px; height: 14px; }\n.hb-vk7-spin {\n  width: 12px;\n  height: 12px;\n  border-radius: 50%;\n  border: 1.5px solid color-mix(in srgb, var(--hb-vk7-c) 25%, transparent);\n  border-top-color: var(--hb-vk7-a);\n  animation: hb-vk7-rot 700ms linear infinite;\n}\n.hb-vk7-tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-vk7-row[data-done=\"true\"] .hb-vk7-tx { color: #8f8f8f; }\n.hb-vk7-tm { flex: none; font-size: 11px; color: #5f5f5f; font-variant-numeric: tabular-nums; }\n.hb-vk7-car {\n  display: inline-block;\n  width: 7px;\n  height: 13px;\n  margin-left: 2px;\n  vertical-align: -2px;\n  background: var(--hb-vk7-a);\n  border-radius: 1px;\n  animation: hb-vk7-caret 1s steps(1) infinite;\n}\n.hb-vk7-chk path {\n  stroke-dasharray: 14;\n  stroke-dashoffset: 0;\n  animation: hb-vk7-draw 360ms cubic-bezier(0.65, 0, 0.35, 1);\n}\n.hb-vk7-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n@keyframes hb-vk7-scroll { from { transform: translateY(var(--hb-vk7-lh)); } }\n@keyframes hb-vk7-rot { to { transform: rotate(360deg); } }\n@keyframes hb-vk7-caret { 50% { opacity: 0; } }\n@keyframes hb-vk7-draw { from { stroke-dashoffset: 14; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vk7-list, .hb-vk7-spin, .hb-vk7-car, .hb-vk7-chk path { animation: none; }\n}\n`;\n\nconst defaultSteps = [\n  \"Reading 14 files in src/checkout\",\n  \"Tracing the failing test\",\n  \"Planning a fix for rounding\",\n  \"Editing cart-total.ts\",\n  \"Running 212 tests\",\n  \"Writing the summary\",\n];\n\nexport function LoaderStatusFeed({\n  steps = defaultSteps,\n  step,\n  visible = 4,\n  typeSpeed = 26,\n  hold = 700,\n  color = \"#2f7bff\",\n  accent = \"#7fb3ff\",\n  label = \"Working\",\n  className = \"\",\n  style,\n  ...rest\n}: LoaderStatusFeedProps) {\n  const list = steps.length ? steps : defaultSteps;\n  const controlled = typeof step === \"number\" && Number.isFinite(step);\n  const [auto, setAuto] = React.useState(0);\n  const [typed, setTyped] = React.useState({ idx: 0, chars: 0 });\n  const [still, setStill] = React.useState(false);\n  const idx = Math.max(0, Math.min(list.length - 1, controlled ? Math.floor(step as number) : auto));\n  const text = list[idx];\n  const chars = still ? text.length : typed.idx === idx ? typed.chars : 0;\n  const done = controlled && (step as number) >= list.length;\n\n  React.useEffect(() => {\n    const raf = requestAnimationFrame(() => {\n      if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) setStill(true);\n    });\n    return () => cancelAnimationFrame(raf);\n  }, []);\n\n  React.useEffect(() => {\n    if (still) return;\n    let id = 0;\n    if (chars < text.length) {\n      id = window.setTimeout(() => setTyped({ idx, chars: chars + 1 }), typeSpeed);\n    } else if (!controlled) {\n      const last = idx >= list.length - 1;\n      id = window.setTimeout(() => {\n        setAuto(last ? 0 : idx + 1);\n        setTyped({ idx: last ? 0 : idx + 1, chars: 0 });\n      }, last ? hold * 3 : hold + Math.round(hash(idx) * hold));\n    }\n    return () => window.clearTimeout(id);\n  }, [still, chars, text, idx, controlled, list.length, typeSpeed, hold]);\n\n  const v = Math.max(1, Math.min(10, Math.round(visible)));\n  const finished = done || (still && !controlled);\n  const end = finished ? list.length - 1 : idx;\n  const start = Math.max(0, end - v);\n  const rows = [];\n  for (let i = start; i <= end; i++) rows.push(i);\n\n  const vars = {\n    \"--hb-vk7-c\": color,\n    \"--hb-vk7-a\": accent,\n    \"--hb-vk7-v\": v,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-loader-status-feed\" precedence=\"default\">{css}</style>\n      <div className={`hb-vk7 ${className}`} style={vars} {...rest}>\n        <span className=\"hb-vk7-sr\" role=\"status\">\n          {finished ? `${label}: done` : `${label}: ${text}`}\n        </span>\n        <div className=\"hb-vk7-win\" aria-hidden=\"true\">\n          <div className=\"hb-vk7-list\" key={end}>\n            {rows.map((i) => {\n              const isDone = finished || i < idx;\n              return (\n                <div className=\"hb-vk7-row\" data-done={isDone} key={i}>\n                  <span className=\"hb-vk7-ic\">\n                    {isDone ? (\n                      <svg className=\"hb-vk7-chk\" viewBox=\"0 0 14 14\" fill=\"none\">\n                        <circle cx=\"7\" cy=\"7\" r=\"6.25\" stroke={color} strokeOpacity=\"0.35\" />\n                        <path d=\"M4.2 7.2l1.9 1.9 3.7-3.9\" stroke={accent} strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                      </svg>\n                    ) : (\n                      <span className=\"hb-vk7-spin\" />\n                    )}\n                  </span>\n                  <span className=\"hb-vk7-tx\">\n                    {isDone ? list[i] : list[i].slice(0, chars)}\n                    {!isDone ? <span className=\"hb-vk7-car\" /> : null}\n                  </span>\n                  {isDone ? <span className=\"hb-vk7-tm\">{(0.4 + hash(i + 3) * 2.6).toFixed(1)}s</span> : null}\n                </div>\n              );\n            })}\n          </div>\n        </div>\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}