import type { Properties as CSSProperties } from 'csstype'; import type { MotionKeyframesDefinition, AnimationOptionsWithOverrides } from '@motionone/dom'; import type { animate, timeline, stagger, spring, glide } from 'motion'; import type { AnimatorState, AnimatorDuration } from '@arwes/animator'; export type EasingFn = (x: number) => number; export type EasingName = 'linear' | 'inQuad' | 'outQuad' | 'inOutQuad' | 'inCubic' | 'outCubic' | 'inOutCubic' | 'inQuart' | 'outQuart' | 'inOutQuart' | 'inQuint' | 'outQuint' | 'inOutQuint' | 'inSine' | 'outSine' | 'inOutSine' | 'inExpo' | 'outExpo' | 'inOutExpo' | 'inCirc' | 'outCirc' | 'inOutCirc' | 'inBack' | 'outBack' | 'inOutBack' | 'inElastic' | 'outElastic' | 'inOutElastic' | 'inBounce' | 'outBounce' | 'inOutBounce'; export type Easing = EasingFn | EasingName; export type EasingMotion = AnimationOptionsWithOverrides['easing'] | Easing; export interface AnimatedCSSPropsShorthands { x?: number | string; y?: number | string; z?: number | string; rotate?: number | string; rotateX?: number | string; rotateY?: number | string; rotateZ?: number | string; skew?: number | string; skewX?: number | string; skewY?: number | string; scale?: number | string; scaleX?: number | string; scaleY?: number | string; scaleZ?: number | string; } export type AnimatedCSSProps = Omit & AnimatedCSSPropsShorthands; export type AnimatedAnimationDefinition = MotionKeyframesDefinition & { duration?: number; delay?: AnimationOptionsWithOverrides['delay']; easing?: AnimationOptionsWithOverrides['easing'] | Easing; repeat?: AnimationOptionsWithOverrides['repeat']; direction?: AnimationOptionsWithOverrides['direction']; options?: AnimationOptionsWithOverrides; }; export interface AnimatedAnimationFunctionConfig { element: HTMLElement | SVGElement; $: (query: string) => T[]; duration: number; easing: Record; nodeDuration: AnimatorDuration; animate: typeof animate; timeline: typeof timeline; stagger: typeof stagger; spring: typeof spring; glide: typeof glide; } export interface AnimatedAnimationFunctionReturn { then?: (callback?: () => void) => Promise; finished?: Promise; cancel: () => void; } export type AnimatedAnimationFunction = ((config: AnimatedAnimationFunctionConfig) => AnimatedAnimationFunctionReturn) | ((config: AnimatedAnimationFunctionConfig) => void); export type AnimatedAnimation = AnimatedAnimationFunction | AnimatedAnimationDefinition; export interface AnimatedSettings { initialAttributes?: Record; initialStyle?: AnimatedCSSProps; transitions?: { [P in AnimatorState]?: AnimatedAnimation | undefined; }; } type AnimatedPropPreset = 'fade' | 'flicker' | 'draw'; type AnimatedPropTransition = [ string, number | string, number | string, (number | string)?, (AnimationOptionsWithOverrides['easing'] | Easing)? ]; export type AnimatedProp = AnimatedSettings | Array | false | undefined; export type AnimatedXAnimationDefinition = AnimatedAnimationDefinition; export type AnimatedXAnimationFunctionConfig = Omit; export type AnimatedXAnimationFunctionReturn = AnimatedAnimationFunctionReturn; export type AnimatedXAnimationFunction = ((config: AnimatedXAnimationFunctionConfig) => AnimatedXAnimationFunctionReturn) | ((config: AnimatedXAnimationFunctionConfig) => void); export type AnimatedXAnimation = AnimatedXAnimationDefinition | AnimatedXAnimationFunction; export interface AnimatedXSettings { initialAttributes?: Record; initialStyle?: AnimatedCSSProps; transitions?: { [P in States]?: AnimatedXAnimation | undefined; }; } export type AnimatedXProp = AnimatedXSettings | Array | undefined> | false | undefined; export {};