import type { AnimatorNode } from '@arwes/animator'; import type { AnimatedProp, AnimatedElementPropsSettings, AnimatedCSSProps, AnimatedXAnimation } from '@arwes/animated'; type ContextType = Record; export type FrameSettingsElementCommon = { name?: string; id?: string; className?: string; style?: AnimatedCSSProps; animatedSettings?: Omit; animated?: AnimatedProp; contexts?: { [C in keyof Contexts]?: { [S in Contexts[C]]?: { className?: string; style?: AnimatedCSSProps; animate?: AnimatedXAnimation; }; }; }; }; export type FrameSettingsSVG = FrameSettingsElementCommon & { type: 'svg'; viewBox: string; x: number | string; y: number | string; width: number | string; height: number | string; elements: string | Array>; draw?: (config: { element: SVGSVGElement; width: number; height: number; }) => void; contexts?: { [C in keyof Contexts]?: { [S in Contexts[C]]?: { className?: string; style?: AnimatedCSSProps; animate?: AnimatedXAnimation; viewBox?: string; x?: number | string; y?: number | string; width?: number | string; height?: number | string; }; }; }; }; export type FrameSettingsG = FrameSettingsElementCommon & { type: 'g'; draw?: (config: { element: SVGGElement; width: number; height: number; }) => void; elements: string | Array>; }; export type FrameSettingsDefs = FrameSettingsElementCommon & { type: 'defs'; draw?: (config: { element: SVGDefsElement; width: number; height: number; }) => void; elements: string | Array>; }; export type FrameSettingsClipPath = FrameSettingsElementCommon & { type: 'clipPath'; draw?: (config: { element: SVGClipPathElement; width: number; height: number; }) => void; elements: string | Array>; }; export type FrameSettingsMask = FrameSettingsElementCommon & { type: 'mask'; draw?: (config: { element: SVGMaskElement; width: number; height: number; }) => void; elements: string | Array>; }; export type FrameSettingsPathDimension = number | string; export type FrameSettingsPathCommandName = 'M' | 'm' | 'L' | 'l' | 'H' | 'h' | 'V' | 'v' | 'C' | 'c' | 'S' | 's' | 'Q' | 'q' | 'T' | 't' | 'A' | 'a'; export type FrameSettingsPathCommand = 'Z' | 'z' | [FrameSettingsPathCommandName, ...FrameSettingsPathDimension[]]; export type FrameSettingsPathDefinition = FrameSettingsPathCommand[]; export type FrameSettingsPath = FrameSettingsElementCommon & { type?: 'path'; path: string | FrameSettingsPathDefinition | ((config: { width: number; height: number; }) => string); draw?: (config: { element: SVGPathElement; width: number; height: number; }) => void; contexts?: { [C in keyof Contexts]?: { [S in Contexts[C]]?: { className?: string; style?: AnimatedCSSProps; animate?: AnimatedXAnimation; path?: string | FrameSettingsPathDefinition | ((config: { width: number; height: number; }) => string); }; }; }; }; export type FrameSettingsRect = FrameSettingsElementCommon & { type: 'rect'; x: number | string; y: number | string; width: number | string; height: number | string; rx?: number | string; ry?: number | string; draw?: (config: { element: SVGRectElement; width: number; height: number; }) => void; contexts?: { [C in keyof Contexts]?: { [S in Contexts[C]]?: { className?: string; style?: AnimatedCSSProps; animate?: AnimatedXAnimation; x?: number | string; y?: number | string; width?: number | string; height?: number | string; rx?: number | string; ry?: number | string; }; }; }; }; export type FrameSettingsEllipse = FrameSettingsElementCommon & { type: 'ellipse'; cx: number | string; cy: number | string; rx: number | string; ry: number | string; draw?: (config: { element: SVGEllipseElement; width: number; height: number; }) => void; contexts?: { [C in keyof Contexts]?: { [S in Contexts[C]]?: { className?: string; style?: AnimatedCSSProps; animate?: AnimatedXAnimation; cx?: number | string; cy?: number | string; rx?: number | string; ry?: number | string; }; }; }; }; export type FrameSettingsElement = FrameSettingsSVG | FrameSettingsG | FrameSettingsDefs | FrameSettingsClipPath | FrameSettingsMask | FrameSettingsPath | FrameSettingsRect | FrameSettingsEllipse; export interface FrameSettings { container?: SVGGElement; elements: Array>; contexts?: Contexts; animator?: AnimatorNode; } type FrameTransition = (context: C, state: S) => void; export type Frame = { contexts: Contexts; render: () => void; transition: FrameTransition; cancel: () => void; remove: () => void; }; export {};