{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-trace",
  "type": "registry:component",
  "title": "Button Trace",
  "description": "A blueprint style button whose outline is drawn around its perimeter on hover, led by a bright comet that keeps circling afterwards. Corner ticks spring outward and a click flashes the face.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "button",
    "outline",
    "stroke",
    "draw",
    "svg",
    "blueprint"
  ],
  "docs": "https://hyperblur.dev/effects/button-trace",
  "files": [
    {
      "path": "registry/hyperblur/button-trace.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-trace.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonTraceProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"color\"> {\n  accent?: string;\n  radius?: number;\n  duration?: number;\n  size?: \"sm\" | \"md\" | \"lg\";\n  shortcut?: string;\n}\n\nconst css = `\n.hb-xa12 {\n  --hb-xa12-c: #7fb3ff;\n  --hb-xa12-t: 0.9s;\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.65em;\n  box-sizing: border-box;\n  margin: 0;\n  padding: 1em 1.6em;\n  font-family: var(--font-grotesk, inherit);\n  font-size: 15px;\n  font-weight: 500;\n  line-height: 1;\n  letter-spacing: -0.005em;\n  color: #e6e6e6;\n  background: #0d0d0f;\n  border: 0;\n  box-shadow: inset 0 0 0 1px #2a2a2e, 0 12px 28px -18px rgba(0, 0, 0, 0.9);\n  cursor: pointer;\n  isolation: isolate;\n  user-select: none;\n  -webkit-tap-highlight-color: transparent;\n  transition: color 0.4s ease, background 0.4s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);\n}\n.hb-xa12 *, .hb-xa12 *::before, .hb-xa12 *::after { box-sizing: border-box; }\n.hb-xa12[data-size=\"sm\"] { font-size: 13px; }\n.hb-xa12[data-size=\"lg\"] { font-size: 17px; }\n.hb-xa12:hover:not(:disabled), .hb-xa12:focus-visible { color: #fff; background: #0f1219; }\n.hb-xa12:active:not(:disabled) { transform: scale(0.98); }\n.hb-xa12:focus-visible { outline: 2px solid var(--hb-xa12-c); outline-offset: 5px; }\n.hb-xa12:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-xa12-svg {\n  position: absolute;\n  inset: 0;\n  width: 100%;\n  height: 100%;\n  overflow: visible;\n  pointer-events: none;\n  z-index: 1;\n}\n.hb-xa12-draw {\n  fill: none;\n  stroke: var(--hb-xa12-c);\n  stroke-width: 1.4;\n  stroke-dasharray: 100 100;\n  stroke-dashoffset: 100;\n  transition: stroke-dashoffset var(--hb-xa12-t) cubic-bezier(0.7, 0, 0.2, 1);\n}\n.hb-xa12-head {\n  fill: none;\n  stroke: #fff;\n  stroke-width: 2;\n  stroke-linecap: round;\n  stroke-dasharray: 6 94;\n  stroke-dashoffset: 6;\n  opacity: 0;\n  filter: drop-shadow(0 0 4px var(--hb-xa12-c));\n}\n.hb-xa12:hover:not(:disabled) .hb-xa12-draw,\n.hb-xa12:focus-visible .hb-xa12-draw { stroke-dashoffset: 0; }\n.hb-xa12:hover:not(:disabled) .hb-xa12-head,\n.hb-xa12:focus-visible .hb-xa12-head { animation: hb-xa12-lead var(--hb-xa12-t) cubic-bezier(0.7, 0, 0.2, 1), hb-xa12-orbit 3.2s linear var(--hb-xa12-t) infinite; }\n.hb-xa12-fill { fill: var(--hb-xa12-c); opacity: 0; }\n.hb-xa12[data-flash=\"a\"] .hb-xa12-fill { animation: hb-xa12-fa 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }\n.hb-xa12[data-flash=\"b\"] .hb-xa12-fill { animation: hb-xa12-fb 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }\n.hb-xa12-tick {\n  position: absolute;\n  width: 7px;\n  height: 7px;\n  z-index: 2;\n  border-color: color-mix(in srgb, var(--hb-xa12-c) 70%, #fff);\n  border-style: solid;\n  border-width: 0;\n  opacity: 0.55;\n  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;\n  pointer-events: none;\n}\n.hb-xa12-tick[data-k=\"tl\"] { left: -4px; top: -4px; border-left-width: 1.5px; border-top-width: 1.5px; }\n.hb-xa12-tick[data-k=\"tr\"] { right: -4px; top: -4px; border-right-width: 1.5px; border-top-width: 1.5px; }\n.hb-xa12-tick[data-k=\"bl\"] { left: -4px; bottom: -4px; border-left-width: 1.5px; border-bottom-width: 1.5px; }\n.hb-xa12-tick[data-k=\"br\"] { right: -4px; bottom: -4px; border-right-width: 1.5px; border-bottom-width: 1.5px; }\n.hb-xa12:hover:not(:disabled) .hb-xa12-tick, .hb-xa12:focus-visible .hb-xa12-tick { opacity: 1; }\n.hb-xa12:hover:not(:disabled) .hb-xa12-tick[data-k=\"tl\"], .hb-xa12:focus-visible .hb-xa12-tick[data-k=\"tl\"] { transform: translate(-3px, -3px); }\n.hb-xa12:hover:not(:disabled) .hb-xa12-tick[data-k=\"tr\"], .hb-xa12:focus-visible .hb-xa12-tick[data-k=\"tr\"] { transform: translate(3px, -3px); }\n.hb-xa12:hover:not(:disabled) .hb-xa12-tick[data-k=\"bl\"], .hb-xa12:focus-visible .hb-xa12-tick[data-k=\"bl\"] { transform: translate(-3px, 3px); }\n.hb-xa12:hover:not(:disabled) .hb-xa12-tick[data-k=\"br\"], .hb-xa12:focus-visible .hb-xa12-tick[data-k=\"br\"] { transform: translate(3px, 3px); }\n.hb-xa12-label { position: relative; z-index: 2; white-space: nowrap; }\n.hb-xa12-kbd {\n  position: relative;\n  z-index: 2;\n  padding: 0.3em 0.45em;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: 0.72em;\n  color: #8f8f8f;\n  border-radius: 4px;\n  box-shadow: inset 0 0 0 1px #2a2a2e;\n  transition: color 0.3s ease, box-shadow 0.3s ease;\n}\n.hb-xa12:hover:not(:disabled) .hb-xa12-kbd, .hb-xa12:focus-visible .hb-xa12-kbd { color: var(--hb-xa12-c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-xa12-c) 45%, transparent); }\n@keyframes hb-xa12-lead { 0% { opacity: 1; stroke-dashoffset: 106; } 100% { opacity: 1; stroke-dashoffset: 6; } }\n@keyframes hb-xa12-orbit { 0% { opacity: 1; stroke-dashoffset: 6; } 100% { opacity: 1; stroke-dashoffset: -94; } }\n@keyframes hb-xa12-fa { 0% { opacity: 0.22; } 100% { opacity: 0; } }\n@keyframes hb-xa12-fb { 0% { opacity: 0.22; } 100% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xa12, .hb-xa12-draw, .hb-xa12-tick, .hb-xa12-kbd { transition: none; }\n  .hb-xa12:hover:not(:disabled) .hb-xa12-head, .hb-xa12:focus-visible .hb-xa12-head,\n  .hb-xa12[data-flash] .hb-xa12-fill { animation: none; }\n}\n`;\n\nexport function ButtonTrace({\n  children = \"Request access\",\n  accent = \"#7fb3ff\",\n  radius = 4,\n  duration = 0.9,\n  size = \"md\",\n  shortcut = \"R\",\n  type = \"button\",\n  disabled = false,\n  className = \"\",\n  style,\n  onClick,\n  ...rest\n}: ButtonTraceProps) {\n  const ref = React.useRef<HTMLButtonElement>(null);\n  const [box, setBox] = React.useState({ w: 0, h: 0 });\n  const [flash, setFlash] = React.useState<\"a\" | \"b\" | undefined>(undefined);\n\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const measure = () => setBox({ w: el.offsetWidth, h: el.offsetHeight });\n    measure();\n    if (typeof ResizeObserver === \"undefined\") return;\n    const ro = new ResizeObserver(measure);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  const r = Math.max(0, Math.min(radius, box.h / 2));\n  const vars = {\n    \"--hb-xa12-c\": accent,\n    \"--hb-xa12-t\": `${Math.max(0.1, duration).toFixed(2)}s`,\n    borderRadius: `${r}px`,\n    ...style,\n  } as React.CSSProperties;\n  const rect = { x: 0.5, y: 0.5, width: Math.max(0, box.w - 1), height: Math.max(0, box.h - 1), rx: r, pathLength: 100 };\n\n  return (\n    <>\n      <style href=\"hb-button-trace\" precedence=\"default\">{css}</style>\n      <button\n        ref={ref}\n        type={type}\n        className={`hb-xa12 ${className}`}\n        style={vars}\n        data-size={size}\n        data-flash={flash}\n        disabled={disabled}\n        onClick={(e) => {\n          setFlash((f) => (f === \"a\" ? \"b\" : \"a\"));\n          onClick?.(e);\n        }}\n        {...rest}\n      >\n        {box.w > 0 ? (\n          <svg className=\"hb-xa12-svg\" aria-hidden=\"true\">\n            <rect className=\"hb-xa12-fill\" {...rect} />\n            <rect className=\"hb-xa12-draw\" {...rect} />\n            <rect className=\"hb-xa12-head\" {...rect} />\n          </svg>\n        ) : null}\n        <span className=\"hb-xa12-tick\" data-k=\"tl\" aria-hidden=\"true\" />\n        <span className=\"hb-xa12-tick\" data-k=\"tr\" aria-hidden=\"true\" />\n        <span className=\"hb-xa12-tick\" data-k=\"bl\" aria-hidden=\"true\" />\n        <span className=\"hb-xa12-tick\" data-k=\"br\" aria-hidden=\"true\" />\n        <span className=\"hb-xa12-label\">{children}</span>\n        {shortcut ? <kbd className=\"hb-xa12-kbd\" aria-hidden=\"true\">{shortcut}</kbd> : null}\n      </button>\n    </>\n  );\n}\n"
    }
  ]
}