{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"modern-loader","type":"registry:ui","title":"Modern Loader","description":"A gradient comet arc orbits with a glowing head while the ring breathes between circle and squircle, around a counter-spinning inner arc and a morphing core.","dependencies":[],"registryDependencies":[],"files":[{"path":"registry/ui/modern-loader.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { CSSProperties } from \"react\";\n\nexport interface ModernLoaderProps {\n  /** Px. */\n  size?: number;\n  /** Gradient stops of the arc, tail to head. */\n  colors?: string[];\n  /** Ring thickness in px. */\n  thickness?: number;\n  /** Speed multiplier. */\n  speed?: number;\n  /** Announced to screen readers. */\n  label?: string;\n  className?: string;\n}\n\n// A conic gradient masked down to a ring (the mask follows border-radius, so the\n// ring morphs with it) spins while its shape breathes between circle and squircle.\nconst css = `\n.mldr-ring{padding:var(--t);mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor}\n.mldr-a{animation:mldr-spin calc(var(--d)*1.1s) linear infinite,mldr-morph calc(var(--d)*3.2s) ease-in-out infinite}\n.mldr-b{animation:mldr-spin calc(var(--d)*1.6s) linear infinite reverse,mldr-morph calc(var(--d)*3.2s) ease-in-out infinite reverse}\n.mldr-glow{animation:mldr-spin calc(var(--d)*4s) linear infinite,mldr-morph calc(var(--d)*3.2s) ease-in-out infinite}\n.mldr-core{animation:mldr-morph calc(var(--d)*1.6s) ease-in-out infinite,mldr-breathe calc(var(--d)*1.6s) ease-in-out infinite}\n@keyframes mldr-spin{to{transform:rotate(1turn)}}\n@keyframes mldr-morph{0%,100%{border-radius:50%}25%{border-radius:42% 58% 55% 45%/48% 42% 58% 52%}50%{border-radius:32%}75%{border-radius:58% 42% 45% 55%/52% 58% 42% 48%}}\n@keyframes mldr-breathe{0%,100%{transform:scale(.7) rotate(0)}50%{transform:scale(1) rotate(90deg)}}\n@media (prefers-reduced-motion:reduce){.mldr-a,.mldr-b,.mldr-glow,.mldr-core{animation:none}}\n`;\n\nexport function ModernLoader({\n  size = 96,\n  colors = [\"#22d3ee\", \"#a855f7\", \"#f43f5e\"],\n  thickness = 6,\n  speed = 1,\n  label = \"Loading\",\n  className,\n}: ModernLoaderProps) {\n  const stops = colors.length ? colors : [\"currentColor\"];\n  const head = stops[stops.length - 1];\n  const arc = `conic-gradient(from 0deg, transparent 0turn, ${stops.map((c, i) => `${c} ${0.2 + (0.8 * (i + 1)) / stops.length}turn`).join(\", \")})`;\n  const back = `conic-gradient(from 180deg, transparent 0turn, ${[...stops].reverse().join(\", \")}, transparent)`;\n  const style = { width: size, height: size, \"--d\": 1 / Math.max(0.1, speed), \"--t\": `${thickness}px` } as CSSProperties;\n\n  return (\n    <span role=\"status\" className={`relative inline-grid shrink-0 place-items-center ${className ?? \"\"}`} style={style}>\n      <style href=\"modern-loader\" precedence=\"default\">\n        {css}\n      </style>\n      <span className=\"sr-only\">{label}</span>\n      <span aria-hidden className=\"mldr-glow absolute inset-[8%] opacity-50 blur-xl\" style={{ background: arc }} />\n      <span aria-hidden className=\"mldr-ring mldr-a absolute inset-0\" style={{ background: arc }} />\n      <span aria-hidden className=\"mldr-a absolute inset-0\">\n        <span\n          className=\"absolute top-0 left-1/2 -translate-x-1/2 rounded-full\"\n          style={{ width: thickness, height: thickness, background: head, boxShadow: `0 0 ${thickness * 2}px ${thickness / 2}px ${head}` }}\n        />\n      </span>\n      <span\n        aria-hidden\n        className=\"mldr-ring mldr-b absolute inset-[22%] opacity-80\"\n        style={{ background: back, \"--t\": `${Math.max(2, thickness * 0.6)}px` } as CSSProperties}\n      />\n      <span\n        aria-hidden\n        className=\"mldr-core absolute inset-[40%]\"\n        style={{ background: `linear-gradient(135deg, ${stops.join(\", \")})` }}\n      />\n    </span>\n  );\n}\n"}]}