{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "caret-rewrite",
  "title": "Caret Rewrite",
  "type": "registry:component",
  "description": "Types, backspaces and retypes with a live caret",
  "dependencies": [
    "motion@^12.43.0"
  ],
  "files": [
    {
      "path": "src/kavyn/caret-rewrite.jsx",
      "type": "registry:file",
      "target": "@components/kavyn/caret-rewrite.jsx",
      "content": "'use client'\n\nimport { useEffect, useState } from 'react'\nimport { motion } from 'motion/react'\n\nconst LINES = ['Write the release notes', 'Summarize this thread', 'Draft a reply to Priya']\n\nexport default function CaretRewrite({ lines = LINES, speed = 55 }) {\n  const [i, setI] = useState(0)\n  const [n, setN] = useState(0)\n  const [del, setDel] = useState(false)\n  useEffect(() => {\n    const full = lines[i]\n    let t\n    if (!del && n < full.length) t = setTimeout(() => setN(n + 1), speed + Math.random() * 40)\n    else if (!del) t = setTimeout(() => setDel(true), 1400)\n    else if (n > 0) t = setTimeout(() => setN(n - 1), 24)\n    else { setDel(false); setI((i + 1) % lines.length) }\n    return () => clearTimeout(t)\n  }, [n, del, i, lines, speed])\n  return (\n    <div className=\"flex h-12 w-full max-w-md items-center gap-3 rounded-xl border border-line2 bg-panel px-4 text-[15px]\">\n      <span className=\"text-acc\">✦</span>\n      <span className=\"text-tx\">{lines[i].slice(0, n)}</span>\n      <motion.span\n        className=\"-ml-2 h-5 w-[2px] rounded bg-acc\"\n        animate={{ opacity: [1, 1, 0, 0] }}\n        transition={{ repeat: Infinity, duration: 0.9, times: [0, 0.5, 0.5, 1] }}\n      />\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"
    }
  }
}
