/// import EventEmitter from 'events'; import type { Callback, Debounce } from '../../types'; /** * Create a MutationObserver */ export declare const mutationEvents: EventEmitter<[never]>; /** * Set parameters for mutationObserver */ export declare function setMutationParams(params: MutationObserverInit): void; /** * Monitor scroll window */ export declare const globalViewportEvents: EventEmitter<[never]>; /** * Base viewport manager */ export interface ViewportManager { destroy(): void; } /** * Creates a manager that monitors changes to the viewport of an element * * @param element An element * @param callback A viewport change callback * @param duration Function to debounce a callback or callback delay duration, default is 200 */ export declare function createViewportManager(element: HTMLElement, callback: Callback, duration?: number | Debounce): ViewportManager; /** * Handler for removing an element from the DOM * * @param element DOM element being watched * @param callback Handler function */ export declare function onRemoveFromDOM(element: HTMLElement, callback: Callback): void; /** * Remove an element from the DOM if it exists in the DOM * * @param element DOM element */ export declare function removeFromDOM(element: HTMLElement): void; type ClassName = string | null | false | undefined; /** * Set classes for an element * * @param element DOM element * @param classNames CSS classes */ export declare function setClass(element: HTMLElement, ...classNames: ClassName[]): void; /** * Toggle classes on an element * * @param element DOM element * @param add Flag to add or remove the class * @param classNames CSS classes to toggle * * ```ts * // add class 'my-class' * toggleClass(element, true, 'my-class') * * // remove class 'my-class', 'other-class' * toggleClass(element, false, 'my-class', 'other-class') * ``` */ export declare function toggleClass(element: HTMLElement, add: boolean, ...classNames: ClassName[]): void; /** * Find DOM element by its id * * @param id The id of the element to find * @param parent The element within which to search */ export declare function findById(id: string, parent?: HTMLElement): Element | null; /** * Scroll to a position relative to top left corner of the element * * @param element DOM element * @param top Top offset relative to top left corner of the element * @param duration Animation time */ export declare function scrollByElementTo(element: HTMLElement, top: number, duration?: number): Promise | undefined; export {};