{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dither-progress",
  "title": "Dither Progress",
  "description": "A progress bar drawn in dither or ASCII, with native progressbar semantics.",
  "dependencies": [],
  "registryDependencies": [
    "https://dotgrain.space/r/engine.json"
  ],
  "files": [
    {
      "path": "registry/ui/dither-progress.tsx",
      "content": "\"use client\";\n\nimport type { CSSProperties, Ref } from \"react\";\nimport { rampGlyphs } from \"@/lib/dotgrain/glyphs\";\nimport { useDitherTokens } from \"@/lib/dotgrain/provider\";\nimport { Quantize } from \"@/lib/dotgrain/quantize\";\nimport type { DitherTokens } from \"@/lib/dotgrain/types\";\n\nexport type DitherProgressProps = Partial<DitherTokens> & {\n  /** Progress from 0 to 100. */\n  value: number;\n  /** Width of the dithered edge as a fraction of the bar (0–1). */\n  softness?: number;\n  /** Accessible name, e.g. \"Uploading\". */\n  label?: string;\n  className?: string;\n  style?: CSSProperties;\n  ref?: Ref<HTMLDivElement>;\n};\n\nexport function DitherProgress({ value, softness = 0.05, label, className, style, ref, ...tokens }: DitherProgressProps) {\n  const clamped = Math.min(100, Math.max(0, value));\n  const { mode, glyphs } = useDitherTokens(tokens);\n  const ramp = rampGlyphs(glyphs);\n  return (\n    <div\n      ref={ref}\n      role=\"progressbar\"\n      aria-valuenow={clamped}\n      aria-valuemin={0}\n      aria-valuemax={100}\n      aria-label={label}\n      className={className}\n      style={{ position: \"relative\", height: 16, ...style }}\n    >\n      <Quantize\n        source={{ kind: \"field\", field: \"progress\", params: { value: clamped / 100, softness } }}\n        ease\n        {...tokens}\n        // ASCII draws only the ramp's extremes: full cells up to the value, empty after.\n        glyphs={mode === \"ascii\" ? ramp[0] + ramp[ramp.length - 1] : tokens.glyphs}\n        style={{ position: \"absolute\", inset: 0 }}\n      />\n    </div>\n  );\n}\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "modes": [
      "dither",
      "ascii"
    ]
  },
  "categories": [
    "feedback"
  ],
  "type": "registry:ui"
}