// axi0 Motion 0.2.0: Glow web. Glowing threads weave across the dark and meet at luminous pinch points; they light up under the pointer and carry pulses of light on click.
// Generated from src/glow-web/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 GlowWebProps extends HTMLAttributes<HTMLElement> {
  /** How many threads (default 7) */
  threads?: number;
  /** Thread thickness (default 1) */
  width?: number;
  /** Colors, comma separated (empty: the palette for the page's theme) (default auto) */
  colors?: string;
  /** Background color (empty: the theme's) (default auto) */
  background?: string;
  /** How fast it moves (default 1) */
  speed?: number;
  /** Light or dark palette (auto: from the page behind it) (default "auto") */
  theme?: "auto" | "light" | "dark";
  /** Fill the nearest positioned parent, behind its content (default false) */
  cover?: boolean;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));
// a present attribute is on; "false" turns off an option that is on by default
const flag = (v: boolean | undefined, d: boolean) => (v === undefined || v === d ? undefined : v ? "" : "false");

export function GlowWeb({ threads, width, colors, background, speed, theme, cover, ...rest }: GlowWebProps) {
  return createElement("axi0-glow-web", { ...rest, "threads": s(threads), "width": s(width), "colors": s(colors), "background": s(background), "speed": s(speed), "theme": s(theme), "cover": flag(cover, false) });
}

export default GlowWeb;
