{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "brush-cursor",
  "type": "registry:ui",
  "title": "Brush cursor",
  "description": "The pointer while drawing or erasing: a disc in the ink colour at the stroke width times the zoom, or a dashed ring the size of what the eraser removes; it follows the pointer in the same frame.",
  "dependencies": [],
  "registryDependencies": [
    "https://metalui.dev/r/tokens.json"
  ],
  "files": [
    {
      "path": "packages/metalui/src/components/brush-cursor/brush-cursor.tsx",
      "type": "registry:ui",
      "target": "components/metalui/brush-cursor/brush-cursor.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\n/* ─────────────────────────────────────────────────────────\n * BRUSH CURSOR (the native reference's brush cursor)\n *\n * While the draw tool (P) or the eraser (E) is on, the pointer is the brush itself, so you\n * see exactly how wide the stroke will be before you touch the canvas.\n *\n *   pen      a disc in the ink colour, the stroke width times the zoom (never under 6),\n *            with a hairline light ring and a hairline dark edge, so it reads on any ink\n *            and on both colorways; while drawing it grows with the pressure\n *   eraser   a dashed ring the size of what it will remove; dark on Bone, light on Graphite\n *   motion   it follows the pointer in the same frame and its size changes at once: a brush\n *            that eased would lie about the stroke you are about to make\n * Screen space: the host hides the system cursor over the canvas and passes the pointer\n * position. Hidden from assistive tech.\n * ───────────────────────────────────────────────────────── */\n\nexport interface BrushCursorProps {\n  /** pen draws, eraser removes. */\n  mode: 'pen' | 'eraser';\n  /** The pointer, in viewport coordinates. Null hides the brush (the pointer left the canvas). */\n  at: { x: number; y: number } | null;\n  /** The brush diameter in screen points: stroke width × zoom (× pressure while drawing). */\n  size: number;\n  /** The ink colour (pen). */\n  color?: string;\n  className?: string;\n}\n\nconst ROOT = 'mu-brush-cursor pointer-events-none fixed left-0 top-0 z-50 overflow-visible';\n\nfunction minimum() {\n  if (typeof window === 'undefined') return 6;\n  return parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--mu-r-brush-self-min')) || 6;\n}\n\n/** The brush under the pointer while drawing or erasing. */\nexport function BrushCursor({ mode, at, size, color = 'currentColor', className }: BrushCursorProps) {\n  const min = React.useMemo(minimum, []);\n  if (!at) return null;\n  const d = Math.max(size, min), r = d / 2, pad = 2, box = d + pad * 2;\n  return (\n    <svg\n      aria-hidden\n      width={box}\n      height={box}\n      viewBox={`${-box / 2} ${-box / 2} ${box} ${box}`}\n      className={className ? `${ROOT} ${className}` : ROOT}\n      style={{ translate: `${at.x - box / 2}px ${at.y - box / 2}px` }}\n      data-mode={mode}\n    >\n      {mode === 'pen' ? (\n        <>\n          <circle r={r} fill={color} />\n          <circle r={r} className=\"brush-ring\" />\n          <circle r={r + 0.5} className=\"brush-edge\" />\n        </>\n      ) : (\n        <circle r={r} className=\"brush-eraser\" />\n      )}\n    </svg>\n  );\n}\n"
    }
  ],
  "docs": "Agent guide: https://metalui.dev/r/brush-cursor.md. SwiftUI: MetalBrushCursor in the MetalUI Swift package."
}
