// axi0 Motion 0.2.0: Aurora. Soft curtains of colored light drift across a background.
// Generated from src/aurora/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 AuroraProps extends HTMLAttributes<HTMLElement> {
  /** three colors, left to right (default "#f6a04d,#ff6b8b,#8a7dff") */
  colors?: string;
  /** how fast it drifts (default 1) */
  speed?: number;
  /** how far the curtain folds up and down (default 1) */
  amplitude?: number;
  /** brightness (0 to 1) (default 0.85) */
  glow?: number;
  /** 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 Aurora({ colors, speed, amplitude, glow, cover, ...rest }: AuroraProps) {
  return createElement("axi0-aurora", { ...rest, "colors": s(colors), "speed": s(speed), "amplitude": s(amplitude), "glow": s(glow), "cover": flag(cover, false) });
}

export default Aurora;
