{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hero-scroll-wipe",
  "type": "registry:component",
  "title": "Hero Scroll Wipe",
  "description": "A slanted wipe line sweeps across the whole hero and turns a gray spreadsheet version of the page into a polished live dashboard, headline included. A glowing handle on the line counts the progress.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hero",
    "hero",
    "scroll",
    "before after",
    "wipe",
    "dashboard",
    "saas"
  ],
  "docs": "https://hyperblur.dev/effects/hero-scroll-wipe",
  "files": [
    {
      "path": "registry/hyperblur/hero-scroll-wipe.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/hero-scroll-wipe.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface HeroScrollWipeLink {\n  label: string;\n  href: string;\n}\n\nexport interface HeroScrollWipeKpi {\n  label: string;\n  value: string;\n  delta: string;\n}\n\nexport interface HeroScrollWipeProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  brand?: string;\n  title?: string;\n  before?: string;\n  after?: string;\n  subtitle?: string;\n  kpis?: HeroScrollWipeKpi[];\n  cta?: HeroScrollWipeLink | null;\n  handleLabel?: string;\n  accent?: string;\n  progress?: number;\n  autoPlay?: boolean;\n  duration?: number;\n  length?: number;\n  height?: string;\n  headingAs?: \"h1\" | \"h2\";\n}\n\nconst defaultKpis: HeroScrollWipeKpi[] = [\n  { label: \"MRR\", value: \"$84.2k\", delta: \"+12.4%\" },\n  { label: \"Active accounts\", value: \"3,904\", delta: \"+318\" },\n  { label: \"Net churn\", value: \"1.8%\", delta: \"-0.6 pt\" },\n];\n\nconst cells = [\n  [\"Month\", \"MRR\", \"New\", \"Churn\", \"Accts\", \"ARPA\"],\n  [\"Jan\", \"61,240\", \"212\", \"2.9%\", \"2,910\", \"21.04\"],\n  [\"Feb\", \"64,880\", \"236\", \"2.6%\", \"3,018\", \"21.49\"],\n  [\"Mar\", \"69,410\", \"251\", \"2.4%\", \"3,204\", \"21.66\"],\n  [\"Apr\", \"73,020\", \"240\", \"2.3%\", \"3,388\", \"21.55\"],\n  [\"May\", \"78,760\", \"289\", \"2.0%\", \"3,640\", \"21.63\"],\n  [\"Jun\", \"84,190\", \"302\", \"1.8%\", \"3,904\", \"21.56\"],\n];\n\nconst css = `\n.hb-va9 {\n  --hb-va9-accent: #34d399;\n  --hb-va9-x: -20;\n  position: relative;\n  width: 100%;\n  height: var(--hb-va9-h);\n  font-family: inherit;\n  background: #0a0a0a;\n}\n.hb-va9[data-pinned=\"true\"] { height: calc(var(--hb-va9-h) * var(--hb-va9-len)); }\n.hb-va9 *, .hb-va9 *::before, .hb-va9 *::after { box-sizing: border-box; }\n.hb-va9-stage {\n  position: sticky;\n  top: 0;\n  height: var(--hb-va9-h);\n  overflow: hidden;\n  container-type: size;\n  isolation: isolate;\n}\n.hb-va9-layer {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  padding: 3.6cqh 5cqw 0;\n}\n.hb-va9-old {\n  background:\n    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 100% 24px,\n    #0e0e0e;\n  color: #8f8f8f;\n  font-family: var(--font-mono, ui-monospace, monospace);\n}\n.hb-va9-new {\n  z-index: 1;\n  background:\n    radial-gradient(60% 50% at 50% 100%, color-mix(in srgb, var(--hb-va9-accent) 18%, transparent), transparent 70%),\n    radial-gradient(50% 40% at 50% 0%, rgba(127, 179, 255, 0.1), transparent 70%),\n    #0a0a0a;\n  color: #ededed;\n  clip-path: polygon(0 0, calc((var(--hb-va9-x) + 8) * 1%) 0, calc((var(--hb-va9-x) - 8) * 1%) 100%, 0 100%);\n  will-change: clip-path;\n}\n.hb-va9-nav {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  width: 100%;\n  font-size: clamp(11px, 1.3cqw, 14px);\n}\n.hb-va9-logo { display: inline-flex; align-items: center; gap: 0.5em; font-weight: 700; letter-spacing: -0.02em; }\n.hb-va9-mark { width: 1.1em; height: 1.1em; border-radius: 0.3em; border: 1.5px solid currentColor; }\n.hb-va9-new .hb-va9-mark { border: 0; background: conic-gradient(from 90deg, var(--hb-va9-accent), #7fb3ff, var(--hb-va9-accent)); }\n.hb-va9-links { display: flex; gap: 1.6em; opacity: 0.7; }\n.hb-va9-title {\n  margin: 5cqh 0 0;\n  text-align: center;\n  font-size: clamp(1.5rem, 4.6cqw, 4.2rem);\n  font-weight: 600;\n  line-height: 1.02;\n  letter-spacing: -0.045em;\n}\n.hb-va9-old .hb-va9-title { font-weight: 500; letter-spacing: -0.03em; }\n.hb-va9-title span { display: block; }\n.hb-va9-old .hb-va9-title span { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: #5a5a5a; }\n.hb-va9-new .hb-va9-title span {\n  color: transparent;\n  background: linear-gradient(90deg, var(--hb-va9-accent), #7fb3ff);\n  -webkit-background-clip: text;\n  background-clip: text;\n}\n.hb-va9-sub {\n  max-width: 50ch;\n  margin: 1em 0 0;\n  text-align: center;\n  font-size: clamp(11px, 1.4cqw, 16px);\n  line-height: 1.5;\n  opacity: 0.75;\n}\n.hb-va9-cta {\n  display: inline-flex;\n  margin-top: 1.3em;\n  padding: 0.7em 1.3em;\n  border-radius: 999px;\n  font-size: clamp(12px, 1.35cqw, 15px);\n  font-weight: 600;\n  text-decoration: none;\n}\n.hb-va9-old .hb-va9-cta { border: 1px dashed #4a4a4a; color: #8f8f8f; }\n.hb-va9-new .hb-va9-cta {\n  background: #ededed;\n  color: #0a0a0a;\n  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--hb-va9-accent) 70%, transparent);\n  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;\n}\n.hb-va9-new .hb-va9-cta:hover { background: #fff; transform: translateY(-1px); }\n.hb-va9-cta:focus-visible { outline: 2px solid var(--hb-va9-accent); outline-offset: 3px; }\n.hb-va9-frame {\n  width: min(100%, 76cqw);\n  flex: 1;\n  margin-top: 4cqh;\n  padding: 1.6cqw;\n  border-radius: 1.4cqw 1.4cqw 0 0;\n  border: 1px solid #262626;\n  border-bottom: 0;\n  overflow: hidden;\n  font-size: clamp(8px, 1.1cqw, 13px);\n}\n.hb-va9-old .hb-va9-frame { background: #121212; border-style: dashed; border-color: #333; }\n.hb-va9-new .hb-va9-frame {\n  background: linear-gradient(180deg, #141516, #0f1011);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 -20px 60px -30px color-mix(in srgb, var(--hb-va9-accent) 60%, transparent);\n}\n.hb-va9-sheet { display: grid; grid-template-columns: 2.2em repeat(6, 1fr); border-left: 1px solid #2a2a2a; border-top: 1px solid #2a2a2a; }\n.hb-va9-sheet span {\n  padding: 0.45em 0.6em;\n  border-right: 1px solid #2a2a2a;\n  border-bottom: 1px solid #2a2a2a;\n  white-space: nowrap;\n  overflow: hidden;\n  text-align: right;\n}\n.hb-va9-sheet span[data-h] { background: #181818; color: #6f6f6f; text-align: center; }\n.hb-va9-sheet span[data-b] { color: #b5b5b5; }\n.hb-va9-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1cqw; }\n.hb-va9-kpi {\n  padding: 0.9em 1em;\n  border-radius: 0.8em;\n  border: 1px solid #222;\n  background: #121314;\n}\n.hb-va9-kpi small { display: block; color: #8f8f8f; }\n.hb-va9-kpi b { display: block; margin-top: 0.25em; font-size: 1.7em; font-weight: 600; letter-spacing: -0.03em; }\n.hb-va9-kpi span { font-size: 0.9em; color: var(--hb-va9-accent); }\n.hb-va9-charts { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1cqw; margin-top: 1cqw; }\n.hb-va9-chart { padding: 0.9em 1em; border-radius: 0.8em; border: 1px solid #222; background: #121314; color: #8f8f8f; }\n.hb-va9-chart svg { display: block; width: 100%; height: auto; margin-top: 0.6em; }\n.hb-va9-line {\n  position: absolute;\n  inset: 0;\n  z-index: 2;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  overflow: visible;\n}\n.hb-va9-handle {\n  position: absolute;\n  top: 52%;\n  left: calc(var(--hb-va9-x) * 1%);\n  z-index: 3;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.5em;\n  padding: 0.45em 0.8em 0.45em 0.5em;\n  transform: translate(-50%, -50%);\n  border-radius: 999px;\n  background: #0a0a0a;\n  border: 1px solid color-mix(in srgb, var(--hb-va9-accent) 60%, transparent);\n  box-shadow: 0 0 0 4px rgba(10, 10, 10, 0.6), 0 0 24px color-mix(in srgb, var(--hb-va9-accent) 50%, transparent);\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(10px, 1.15cqw, 13px);\n  color: #ededed;\n  white-space: nowrap;\n  pointer-events: none;\n}\n.hb-va9-handle i {\n  width: 0.6em;\n  height: 0.6em;\n  border-radius: 50%;\n  background: var(--hb-va9-accent);\n  box-shadow: 0 0 10px var(--hb-va9-accent);\n}\n@media (max-width: 640px) {\n  .hb-va9-links { display: none; }\n  .hb-va9-frame { width: 100%; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-va9-new .hb-va9-cta { transition: none; }\n}\n`;\n\nfunction findScroller(el: HTMLElement): HTMLElement | null {\n  let node = el.parentElement;\n  while (node && node !== document.body && node !== document.documentElement) {\n    const oy = getComputedStyle(node).overflowY;\n    if ((oy === \"auto\" || oy === \"scroll\" || oy === \"overlay\") && node.scrollHeight > node.clientHeight + 1) return node;\n    node = node.parentElement;\n  }\n  return null;\n}\n\nfunction ease(x: number) {\n  return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;\n}\n\nfunction clamp01(x: number) {\n  return Math.min(1, Math.max(0, x));\n}\n\nfunction loopAt(ms: number, duration: number) {\n  const d = Math.max(1, duration) * 1000;\n  const back = d * 0.7;\n  const hold = 1400;\n  const t = ms % (d + hold + back + 700);\n  if (t < d) return ease(t / d);\n  if (t < d + hold) return 1;\n  if (t < d + hold + back) return 1 - ease((t - d - hold) / back);\n  return 0;\n}\n\nfunction useScrollProgress(\n  ref: React.RefObject<HTMLElement | null>,\n  apply: (p: number) => void,\n  progress: number | undefined,\n  autoPlay: boolean,\n  duration: number,\n) {\n  const applyRef = React.useRef(apply);\n  React.useLayoutEffect(() => {\n    applyRef.current = apply;\n  });\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const run = (p: number) => applyRef.current(clamp01(p));\n    if (typeof progress === \"number\") {\n      run(progress);\n      return;\n    }\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      run(1);\n      return;\n    }\n    let raf = 0;\n    if (autoPlay) {\n      let visible = true;\n      let last = 0;\n      let t = 0;\n      const io = new IntersectionObserver((entries) => {\n        visible = entries[0]?.isIntersecting ?? true;\n      });\n      io.observe(el);\n      const loop = (now: number) => {\n        const dt = last ? Math.min(64, now - last) : 0;\n        last = now;\n        if (visible) {\n          t += dt;\n          run(loopAt(t, duration));\n        }\n        raf = requestAnimationFrame(loop);\n      };\n      raf = requestAnimationFrame(loop);\n      return () => {\n        cancelAnimationFrame(raf);\n        io.disconnect();\n      };\n    }\n    const sc = findScroller(el);\n    const measure = () => {\n      raf = 0;\n      const r = el.getBoundingClientRect();\n      const top = sc ? r.top - sc.getBoundingClientRect().top : r.top;\n      const vh = sc ? sc.clientHeight : window.innerHeight;\n      const span = r.height - vh;\n      run(span > 1 ? -top / span : (vh - top) / (vh + r.height));\n    };\n    const onScroll = () => {\n      if (!raf) raf = requestAnimationFrame(measure);\n    };\n    measure();\n    const target: HTMLElement | Window = sc ?? window;\n    target.addEventListener(\"scroll\", onScroll, { passive: true });\n    window.addEventListener(\"resize\", onScroll);\n    return () => {\n      cancelAnimationFrame(raf);\n      target.removeEventListener(\"scroll\", onScroll);\n      window.removeEventListener(\"resize\", onScroll);\n    };\n  }, [ref, progress, autoPlay, duration]);\n}\n\nconst area = \"M0 70 L0 52 C 20 50, 30 44, 50 46 S 80 38, 100 34 S 140 30, 160 22 S 190 16, 200 10 L200 70 Z\";\nconst line = \"M0 52 C 20 50, 30 44, 50 46 S 80 38, 100 34 S 140 30, 160 22 S 190 16, 200 10\";\n\nexport function HeroScrollWipe({\n  brand = \"Quanta\",\n  title = \"Your numbers deserve better than\",\n  before = \"a spreadsheet.\",\n  after = \"a live dashboard.\",\n  subtitle = \"Connect Postgres, Stripe or a plain CSV and get dashboards that refresh every minute, with alerts when something moves.\",\n  kpis = defaultKpis,\n  cta = { label: \"Connect your data\", href: \"#\" },\n  handleLabel = \"migrated\",\n  accent = \"#34d399\",\n  progress,\n  autoPlay = false,\n  duration = 5,\n  length = 3,\n  height = \"100vh\",\n  headingAs = \"h1\",\n  className,\n  style,\n  ...rest\n}: HeroScrollWipeProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const lineRef = React.useRef<SVGLineElement>(null);\n  const pctRef = React.useRef<HTMLSpanElement>(null);\n  const uid = React.useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const Heading = headingAs;\n  const pinned = progress === undefined && !autoPlay;\n\n  useScrollProgress(\n    ref,\n    (p) => {\n      const el = ref.current;\n      if (!el) return;\n      const x = -12 + ease(clamp01(p / 0.9)) * 124;\n      el.style.setProperty(\"--hb-va9-x\", x.toFixed(3));\n      if (lineRef.current) {\n        lineRef.current.setAttribute(\"x1\", (x + 8).toFixed(3));\n        lineRef.current.setAttribute(\"x2\", (x - 8).toFixed(3));\n      }\n      if (pctRef.current) pctRef.current.textContent = `${Math.round(clamp01((x + 8) / 116) * 100)}% ${handleLabel}`;\n    },\n    progress,\n    autoPlay,\n    duration,\n  );\n\n  const layer = (mode: \"old\" | \"new\") => {\n    const fresh = mode === \"new\";\n    return (\n      <div className={`hb-va9-layer hb-va9-${mode}`} aria-hidden={fresh ? undefined : true}>\n        <div className=\"hb-va9-nav\">\n          <span className=\"hb-va9-logo\">\n            <span className=\"hb-va9-mark\" />\n            {brand}\n          </span>\n          <span className=\"hb-va9-links\">\n            <span>Product</span>\n            <span>Pricing</span>\n            <span>Docs</span>\n          </span>\n        </div>\n        {fresh ? (\n          <Heading className=\"hb-va9-title\">\n            {title}\n            <span>{after}</span>\n          </Heading>\n        ) : (\n          <div className=\"hb-va9-title\">\n            {title}\n            <span>{before}</span>\n          </div>\n        )}\n        {subtitle ? <p className=\"hb-va9-sub\">{subtitle}</p> : null}\n        {cta ? (\n          <a className=\"hb-va9-cta\" href={cta.href} tabIndex={fresh ? undefined : -1}>\n            {cta.label}\n          </a>\n        ) : null}\n        <div className=\"hb-va9-frame\">\n          {fresh ? (\n            <>\n              <div className=\"hb-va9-kpis\">\n                {kpis.map((k) => (\n                  <div key={k.label} className=\"hb-va9-kpi\">\n                    <small>{k.label}</small>\n                    <b>{k.value}</b>\n                    <span>{k.delta}</span>\n                  </div>\n                ))}\n              </div>\n              <div className=\"hb-va9-charts\">\n                <div className=\"hb-va9-chart\">\n                  Revenue, last 6 months\n                  <svg viewBox=\"0 0 200 70\">\n                    <defs>\n                      <linearGradient id={`${uid}a`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n                        <stop offset=\"0\" stopColor={accent} stopOpacity=\"0.45\" />\n                        <stop offset=\"1\" stopColor={accent} stopOpacity=\"0\" />\n                      </linearGradient>\n                    </defs>\n                    <path d={area} fill={`url(#${uid}a)`} />\n                    <path d={line} fill=\"none\" stroke={accent} strokeWidth=\"2\" />\n                    <circle cx=\"200\" cy=\"10\" r=\"3\" fill={accent} />\n                  </svg>\n                </div>\n                <div className=\"hb-va9-chart\">\n                  New accounts\n                  <svg viewBox=\"0 0 120 70\">\n                    {[30, 38, 44, 40, 54, 62].map((h, i) => (\n                      <rect key={i} x={4 + i * 19} y={70 - h} width=\"13\" height={h} rx=\"3\" fill={i === 5 ? accent : \"#2a2f2d\"} />\n                    ))}\n                  </svg>\n                </div>\n              </div>\n            </>\n          ) : (\n            <div className=\"hb-va9-sheet\">\n              <span data-h=\"\" />\n              {[\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"].map((c) => (\n                <span key={c} data-h=\"\">\n                  {c}\n                </span>\n              ))}\n              {cells.map((row, r) => (\n                <React.Fragment key={r}>\n                  <span data-h=\"\">{r + 1}</span>\n                  {row.map((c, i) => (\n                    <span key={i} data-b={r === 0 ? \"\" : undefined}>\n                      {c}\n                    </span>\n                  ))}\n                </React.Fragment>\n              ))}\n            </div>\n          )}\n        </div>\n      </div>\n    );\n  };\n\n  return (\n    <section\n      ref={ref}\n      className={[\"hb-va9\", className].filter(Boolean).join(\" \")}\n      data-pinned={pinned ? \"true\" : \"false\"}\n      style={{ \"--hb-va9-accent\": accent, \"--hb-va9-h\": height, \"--hb-va9-len\": length, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-hero-scroll-wipe\" precedence=\"default\">{css}</style>\n      <div className=\"hb-va9-stage\">\n        {layer(\"old\")}\n        {layer(\"new\")}\n        <svg className=\"hb-va9-line\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n          <line ref={lineRef} x1=\"-4\" y1=\"0\" x2=\"-20\" y2=\"100\" stroke={accent} strokeWidth=\"2\" vectorEffect=\"non-scaling-stroke\" />\n        </svg>\n        <span className=\"hb-va9-handle\" aria-hidden=\"true\">\n          <i />\n          <span ref={pctRef}>0% {handleLabel}</span>\n        </span>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}