// axi0 Motion 0.2.0: Pixel bloom. A card fills with twinkling pixels while it is pointed at or focused, rippling out from where the pointer came in, and drains away when it leaves.
// Generated from src/pixel-bloom/meta.json by motion-pack: a thin wrapper. The loader (motion.js) must be on the page once;
// it starts the effect on the element this renders. Options left out keep the effect's own defaults.
import { createElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";

export interface PixelBloomProps extends HTMLAttributes<HTMLElement> {
  /** Pixel colors, comma separated (empty: silver with a little orange on dark pages, ink with orange on light ones) (default auto) */
  colors?: string;
  /** Pixel grid pitch (default 5) */
  gap?: number;
  /** How fast the pixels twinkle (default 1) */
  speed?: number;
  /** Where the ripple starts (default "pointer") */
  from?: "pointer" | "center";
  /** Keep the pixels on without a pointer (default false) */
  always?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));

export function PixelBloom({ as = "div", colors, gap, speed, from, always, ...rest }: PixelBloomProps) {
  return createElement(as, { ...rest, "data-motion": "pixel-bloom", "data-motion-colors": s(colors), "data-motion-gap": s(gap), "data-motion-speed": s(speed), "data-motion-from": s(from), "data-motion-always": s(always) });
}

export default PixelBloom;
