/** * Type definitions for lottie-web library. */ import type { AnimationItem } from 'lottie-web'; import { type Breakpoint } from '@divi/types'; declare global { interface Window { diviBreakpointData?: { enabledBreakpoints: Breakpoint.Item[]; enabledBreakpointNames: Breakpoint.Names; baseBreakpointName: Breakpoint.Name; }; } } declare global { interface Window { lottie: LottieStatic; diviModuleLottieData?: LottieData[]; } } export interface BreakpointWithDimensions { name: string; baseDevice?: boolean; maxWidth?: { value: string; }; minWidth?: { value: string; }; } /** * Configuration object for lottie-web loadAnimation method. * Supports both path (URL) and animationData (JSON object) configurations. */ export type LottieConfig = { container: HTMLElement; renderer: 'svg' | 'canvas' | 'html'; loop: boolean; } & ( | { path: string; } | { animationData: unknown; } ); /** * Global type augmentation for Lottie library. * Only includes methods that are actually used in the codebase. * * @since ?? */ export interface LottieStatic { loadAnimation: (params: LottieConfig) => AnimationItem; } export interface LottieData { selector: string; } export interface LottieSettings { src: string; selector: string; trigger: 'onLoad' | 'onView' | 'onHover' | 'onClick' | 'onScroll'; loop: boolean; speed: number; direction: string; mode: string; } export interface LottieInstance { animation: AnimationItem; settings: LottieSettings; container: HTMLElement; } /** * Type for multiview data items (simplified for lottie usage). * Represents the structure of items in window.diviElementMultiViewData. */ export type MultiViewDataItem = { action: string; selector: string; hoverSelector?: string; data: Record>; }; export type LottiePresetInteractionData = { presetId?: string; lottieRuntimeAttributes?: Record; }; export type LottiePresetInteractionContext = { element: Element; interaction: LottiePresetInteractionData; action: 'toggle' | 'add' | 'remove'; moduleName: string; kebabModuleName: string; }; export type LottiePresetInteractionHooksWindow = Window & { wp?: { hooks?: { addFilter?: ( hookName: string, namespace: string, callback: (context: LottiePresetInteractionContext) => LottiePresetInteractionContext | void, ) => void; }; }; diviInteractionsPresetAfterHandle?: (context: LottiePresetInteractionContext) => void; }; export type LottiePresetAfterHandleEvent = CustomEvent;