{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lattice-loader",
  "type": "registry:component",
  "title": "Lattice Loader",
  "description": "A compact loading indicator of dots or bars pulsing in a diagonal wave.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "loader",
    "spinner",
    "loading",
    "dots"
  ],
  "docs": "https://hyperblur.dev/effects/lattice-loader",
  "files": [
    {
      "path": "registry/hyperblur/lattice-loader.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/lattice-loader.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type LatticeShape = \"grid\" | \"ring\" | \"bars\";\n\nexport interface LatticeLoaderProps extends React.HTMLAttributes<HTMLSpanElement> {\n  size?: number;\n  color?: string;\n  speed?: number;\n  shape?: LatticeShape;\n  columns?: number;\n  label?: string;\n}\n\nconst css = `\n.hb-ll {\n  position: relative;\n  display: inline-block;\n  flex: none;\n  width: var(--hb-s);\n  height: var(--hb-s);\n  vertical-align: middle;\n}\n.hb-ll-grid {\n  display: grid;\n  width: 100%;\n  height: 100%;\n  grid-template-columns: repeat(var(--hb-n), 1fr);\n  grid-template-rows: repeat(var(--hb-n), 1fr);\n  place-items: center;\n}\n.hb-ll-grid > i {\n  width: 56%;\n  height: 56%;\n  border-radius: 50%;\n  background: var(--hb-c);\n  opacity: 0.3;\n  transform: scale(0.4);\n  animation: hb-ll-pulse var(--hb-d) ease-in-out infinite;\n  animation-delay: calc(var(--i) * var(--hb-d) / var(--hb-p));\n}\n.hb-ll-ring { width: 100%; height: 100%; }\n.hb-ll-ring > i {\n  position: absolute;\n  inset: 0;\n  transform: rotate(calc(var(--i) * 45deg));\n}\n.hb-ll-ring > i > b {\n  position: absolute;\n  top: 0;\n  left: 50%;\n  width: calc(var(--hb-s) * 0.18);\n  height: calc(var(--hb-s) * 0.18);\n  margin-left: calc(var(--hb-s) * -0.09);\n  border-radius: 50%;\n  background: var(--hb-c);\n  opacity: 0.3;\n  transform: scale(0.4);\n  animation: hb-ll-pulse var(--hb-d) ease-in-out infinite;\n  animation-delay: calc(var(--i) * var(--hb-d) / var(--hb-p));\n}\n.hb-ll-bars {\n  display: flex;\n  align-items: center;\n  gap: calc(var(--hb-s) * 0.08);\n  width: 100%;\n  height: 100%;\n}\n.hb-ll-bars > i {\n  flex: 1;\n  height: 100%;\n  border-radius: 999px;\n  background: var(--hb-c);\n  opacity: 0.3;\n  transform: scaleY(0.3);\n  animation: hb-ll-bar var(--hb-d) ease-in-out infinite;\n  animation-delay: calc(var(--i) * var(--hb-d) / var(--hb-p));\n}\n.hb-ll-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n  border: 0;\n}\n@keyframes hb-ll-pulse {\n  0%, 100% { transform: scale(0.4); opacity: 0.3; }\n  40% { transform: scale(1); opacity: 1; }\n}\n@keyframes hb-ll-bar {\n  0%, 100% { transform: scaleY(0.3); opacity: 0.3; }\n  40% { transform: scaleY(1); opacity: 1; }\n}\n@keyframes hb-ll-fade {\n  0%, 100% { opacity: 0.3; }\n  40% { opacity: 1; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ll-grid > i, .hb-ll-ring > i > b, .hb-ll-bars > i {\n    transform: none;\n    animation-name: hb-ll-fade;\n    animation-duration: calc(var(--hb-d) * 2);\n  }\n}\n`;\n\nexport function LatticeLoader({\n  size = 32,\n  color = \"#2f7bff\",\n  speed = 1,\n  shape = \"grid\",\n  columns = 3,\n  label = \"Loading\",\n  className = \"\",\n  style,\n  ...rest\n}: LatticeLoaderProps) {\n  const n = Math.max(2, Math.min(6, Math.round(columns)));\n  const safeSpeed = speed > 0 ? speed : 1;\n  const phases = shape === \"grid\" ? n * 2 - 1 : shape === \"ring\" ? 8 : 5;\n\n  const vars = {\n    \"--hb-s\": `${size}px`,\n    \"--hb-c\": color,\n    \"--hb-d\": `${(1.2 / safeSpeed).toFixed(3)}s`,\n    \"--hb-n\": n,\n    \"--hb-p\": phases,\n    ...style,\n  } as React.CSSProperties;\n\n  const at = (i: number) => ({ \"--i\": i }) as React.CSSProperties;\n\n  let body: React.ReactNode;\n  if (shape === \"ring\") {\n    body = (\n      <span className=\"hb-ll-ring\" aria-hidden=\"true\">\n        {Array.from({ length: 8 }, (_, i) => (\n          <i key={i} style={at(i)}>\n            <b style={at(i)} />\n          </i>\n        ))}\n      </span>\n    );\n  } else if (shape === \"bars\") {\n    body = (\n      <span className=\"hb-ll-bars\" aria-hidden=\"true\">\n        {Array.from({ length: 5 }, (_, i) => (\n          <i key={i} style={at(i)} />\n        ))}\n      </span>\n    );\n  } else {\n    body = (\n      <span className=\"hb-ll-grid\" aria-hidden=\"true\">\n        {Array.from({ length: n * n }, (_, i) => (\n          <i key={i} style={at((i % n) + Math.floor(i / n))} />\n        ))}\n      </span>\n    );\n  }\n\n  return (\n    <span role=\"status\" className={`hb-ll ${className}`} style={vars} {...rest}>\n      <style href=\"hb-lattice-loader\" precedence=\"default\">{css}</style>\n      {body}\n      <span className=\"hb-ll-sr\">{label}</span>\n    </span>\n  );\n}\n"
    }
  ]
}