// axi0 Motion 0.2.0: Light rays. Volumetric rays pour from an edge; the pointer steers the beam and casts a shadow.
// Generated from src/light-rays/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 LightRaysProps extends HTMLAttributes<HTMLElement> {
  /** the light's color (warm white, orange on light pages) (default auto) */
  color?: string;
  /** the edge the light comes from (default "top") */
  origin?: "top" | "top-left" | "top-right" | "left" | "right" | "bottom";
  /** how wide the beam opens, in radians (default 0.85) */
  spread?: number;
  /** how fast the rays shimmer (default 1) */
  speed?: 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 LightRays({ color, origin, spread, speed, cover, ...rest }: LightRaysProps) {
  return createElement("axi0-light-rays", { ...rest, "color": s(color), "origin": s(origin), "spread": s(spread), "speed": s(speed), "cover": flag(cover, false) });
}

export default LightRays;
