{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ascii-wave",
  "title": "ASCII Wave",
  "description": "Function field f(x,y,t) mapped through a luminance ramp — one text node per frame.",
  "dependencies": [],
  "registryDependencies": [
    "@atroui/utils",
    "@atroui/ascii-rig"
  ],
  "files": [
    {
      "path": "registry/default/ui/ascii-wave.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/lib/utils\"\nimport { ASCII_RAMPS, rampAt, resolveAsciiRamp, useAsciiTick } from \"@/lib/ascii-rig\"\n\nexport type AsciiWaveProps = {\n  /** Grid width in character cells. */\n  cols?: number\n  /** Grid height in lines. */\n  rows?: number\n  /** Field speed multiplier. */\n  speed?: number\n  /** Luminance ramp, dim → bright. A literal string or a rig ramp name. */\n  chars?: string\n  /** Accessible description of the decorative field. */\n  label?: string\n  className?: string\n}\n\nconst DEFAULT_RAMP = ASCII_RAMPS.classic\n\nfunction clampInt(v: number, min: number, max: number) {\n  return Math.min(max, Math.max(min, Math.round(v)))\n}\n\n/**\n * ASCII Wave — a pure function-field: every visible cell is\n * f(x, y, t) — two travelling sines over a diagonal carrier — mapped\n * through a luminance ramp. Rendered as one text node per frame.\n */\nexport function AsciiWave({\n  cols: colsProp = 56,\n  rows: rowsProp = 16,\n  speed = 1,\n  chars,\n  label = \"Interference wave of characters\",\n  className,\n}: AsciiWaveProps) {\n  const cols = clampInt(colsProp, 16, 160)\n  const rows = clampInt(rowsProp, 4, 64)\n  const ramp = resolveAsciiRamp(chars ?? DEFAULT_RAMP)\n  const hostRef = React.useRef<HTMLDivElement>(null)\n  const [frame, setFrame] = React.useState(\"\") // first paint: static frame\n\n  const draw = React.useCallback(\n    (t: number) => {\n      const out: string[] = []\n      for (let r = 0; r < rows; r++) {\n        let line = \"\"\n        for (let c = 0; c < cols; c++) {\n          const v =\n            0.5 +\n            (Math.sin(c * 0.55 + t * 1.3 * speed) +\n              Math.sin(r * 0.42 - t * 0.9 * speed) +\n              Math.sin((c + r) * 0.18 + t * 0.55 * speed)) /\n              3\n          line += rampAt(ramp, Math.min(1, Math.max(0, v)))\n        }\n        out.push(line)\n      }\n      // React bails out on identical values, so same-frame strings settle.\n      setFrame(out.join(\"\\n\"))\n    },\n    [rows, cols, ramp, speed]\n  )\n\n  useAsciiTick(hostRef, draw, { fps: 16 })\n\n  return (\n    <div ref={hostRef} aria-label={label} role=\"img\" className={cn(\"min-w-0\", className)}>\n      <pre\n        aria-hidden=\"true\"\n        className=\"m-0 select-none whitespace-pre font-mono text-[11px] leading-[1.35] text-foreground/70\"\n      >\n        {frame}\n      </pre>\n    </div>\n  )\n}\n",
      "type": "registry:ui",
      "target": "components/ui/ascii-wave.tsx"
    }
  ],
  "type": "registry:ui"
}