// axi0 Motion 0.2.0: Electric edge. Crackling strands of current wrap an element and surge near the pointer.
// Generated from src/electric-edge/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 ElectricEdgeProps extends HTMLAttributes<HTMLElement> {
  /** the current's color (deepened on light pages) (default "#5cc8ff") */
  color?: string;
  /** how wild the strands are (default 1) */
  amount?: number;
  /** how many strands (default 3) */
  strands?: number;
  /** sparks where the pointer is near (default true) */
  sparks?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function ElectricEdge({ as = "div", color, amount, strands, sparks, ...rest }: ElectricEdgeProps) {
  return createElement(as, { ...rest, "data-motion": "electric-edge", "data-motion-color": s(color), "data-motion-amount": s(amount), "data-motion-strands": s(strands), "data-motion-sparks": s(sparks) });
}

export default ElectricEdge;
