// axi0 Motion 0.2.0: Veil. A silky veil of light drifts through the dark and bends around the pointer.
// Generated from src/veil/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 VeilProps extends HTMLAttributes<HTMLElement> {
  /** left, right and the folds (default "#6d5dfc,#2bb5ff,#ff7ad9") */
  colors?: string;
  /** how fast it drifts (default 1) */
  speed?: number;
  /** how far it bends around the pointer (default 1) */
  bend?: 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 Veil({ colors, speed, bend, cover, ...rest }: VeilProps) {
  return createElement("axi0-veil", { ...rest, "colors": s(colors), "speed": s(speed), "bend": s(bend), "cover": flag(cover, false) });
}

export default Veil;
