import { IDisposable } from "../common/lifecycle.js"; export interface ISynchronizeAnimationsOptions { /** * Also synchronize animations running on descendant elements (e.g. the dots * of a spinner whose animations live on child nodes). Defaults to `false`. */ readonly subtree?: boolean; /** * When provided, further narrows synchronization to CSS animations whose * `animation-name` is in this set. Non-keyframe animations (e.g. transitions) * are always skipped regardless of this option. */ readonly animationNames?: ReadonlySet; } /** * Phase-aligns running, looping CSS animations so that every animation of the same * duration displays the same frame at the same time, regardless of when each * one started. * * All CSS animations share the document's timeline, so anchoring each * animation's `startTime` to the same origin (`0`) forces their `currentTime` * to equal the timeline time — making identical animations run in lock-step. * Per-element `animation-delay` offsets are preserved (they are part of each * animation's own timing), so intentional cascades (e.g. spinner dots) still * work while the group as a whole stays globally in phase. * * Unlike adjusting `animation-delay`, this re-seeks animations that are already * running (Chromium does not reliably re-seek a running animation when its * `animation-delay` changes). Call it whenever an animation (re)starts or * resumes after being paused offscreen — e.g. from an `animationstart` handler * or when an element scrolls back into view. * * @param element The element whose (and optionally whose descendants') CSS * animations should be synchronized. * @param options See {@link ISynchronizeAnimationsOptions}. */ export declare function synchronizeCSSAnimations(element: HTMLElement, options?: ISynchronizeAnimationsOptions): void; export interface IPauseCSSAnimationsWhenHiddenOptions extends ISynchronizeAnimationsOptions { readonly pausedClass: string; /** Reports whether the element is visible in its viewport and document. */ readonly onDidChangeVisibility?: (visible: boolean) => void; } /** * Pauses CSS animations while their element is outside the viewport or its document is hidden. * Tracking survives temporary DOM detachment; dispose it when the element is no longer reusable. */ export declare function pauseCSSAnimationsWhenHidden(element: HTMLElement, options: IPauseCSSAnimationsWhenHiddenOptions): IDisposable;