{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cache-ring",
  "title": "Cache Ring",
  "type": "registry:component",
  "description": "Donut ring and number spring to each new ratio",
  "dependencies": [
    "motion@^12.43.0"
  ],
  "files": [
    {
      "path": "src/kavyn/cache-ring.jsx",
      "type": "registry:file",
      "target": "@components/kavyn/cache-ring.jsx",
      "content": "'use client'\n\nimport { useEffect, useState } from 'react'\nimport { motion, useSpring, useTransform } from 'motion/react'\n\n// Cache hit ratio donut. The arc springs to each new value and the number follows it.\nexport default function CacheRing({ label = 'Cache hit ratio', values = [0.82, 0.91, 0.87, 0.94], interval = 2400, size = 180 }) {\n  const [i, setI] = useState(0)\n  const v = useSpring(0, { stiffness: 70, damping: 18 })\n  const pct = useTransform(v, (x) => `${(x * 100).toFixed(1)}%`)\n  useEffect(() => { v.set(values[i % values.length] ?? 0) }, [i, values, v])\n  useEffect(() => { const id = setInterval(() => !document.hidden && setI((n) => n + 1), interval); return () => clearInterval(id) }, [interval])\n  const r = size / 2 - 12, C = 2 * Math.PI * r\n  const dash = useTransform(v, (x) => `${x * C} ${C}`)\n  return (\n    <div className=\"flex w-[360px] max-w-full items-center gap-5 rounded-2xl border border-line bg-panel p-4\">\n      <svg width={size * 0.62} height={size * 0.62} viewBox={`0 0 ${size} ${size}`} className=\"-rotate-90 shrink-0\">\n        <circle cx={size / 2} cy={size / 2} r={r} fill=\"none\" stroke=\"var(--line)\" strokeWidth=\"12\" />\n        <motion.circle cx={size / 2} cy={size / 2} r={r} fill=\"none\" stroke=\"var(--acc)\" strokeWidth=\"12\" strokeLinecap=\"round\" style={{ strokeDasharray: dash }} />\n      </svg>\n      <div>\n        <div className=\"text-xs text-mute\">{label}</div>\n        <motion.div className=\"mt-1 font-mono text-3xl tabular-nums tracking-tight text-tx\">{pct}</motion.div>\n        <div className=\"mt-2 flex gap-3 text-[11px]\"><span className=\"flex items-center gap-1.5 text-mute\"><i className=\"size-2 rounded-sm bg-acc\" />Served from edge</span><span className=\"flex items-center gap-1.5 text-faint\"><i className=\"size-2 rounded-sm bg-line2\" />Origin</span></div>\n      </div>\n    </div>\n  )\n}\n"
    }
  ],
  "cssVars": {
    "theme": {
      "color-bg": "var(--bg)",
      "color-panel": "var(--panel)",
      "color-panel2": "var(--panel2)",
      "color-line": "var(--line)",
      "color-line2": "var(--line2)",
      "color-tx": "var(--tx)",
      "color-mute": "var(--mute)",
      "color-faint": "var(--faint)",
      "color-acc": "var(--acc)",
      "color-acc-fg": "var(--acc-fg)"
    },
    "light": {
      "bg": "#ffffff",
      "panel": "#f5f5f7",
      "panel2": "#e8e8ed",
      "line": "#e5e5ea",
      "line2": "#d2d2d7",
      "tx": "#1d1d1f",
      "mute": "#6e6e73",
      "faint": "#a1a1a6",
      "acc": "#1d1d1f",
      "acc-fg": "#ffffff"
    },
    "dark": {
      "bg": "#000000",
      "panel": "#141416",
      "panel2": "#1f1f22",
      "line": "#262628",
      "line2": "#3a3a3d",
      "tx": "#f5f5f7",
      "mute": "#a1a1a6",
      "faint": "#6e6e73",
      "acc": "#f5f5f7",
      "acc-fg": "#000000"
    }
  },
  "css": {
    ".light": {
      "--bg": "#ffffff",
      "--panel": "#f5f5f7",
      "--panel2": "#e8e8ed",
      "--line": "#e5e5ea",
      "--line2": "#d2d2d7",
      "--tx": "#1d1d1f",
      "--mute": "#6e6e73",
      "--faint": "#a1a1a6",
      "--acc": "#1d1d1f",
      "--acc-fg": "#ffffff"
    }
  }
}
