import ResizeObserver from "./resize-observer"; import { ResizeObserverOptions } from "./interfaces"; export declare class ResizeWatcher { /** * FPS. */ private fps; /** * Time for FPS. */ private then; /** * ID of the requestAnimationFrame. */ private requestID; /** * Map, that contains all elements, that should be checked by ResizeObservable. */ private map; /** * Map, that contains all elements with animation, that have properties, that can change dimension of the element. */ private mapAnimationElements; /** * Map, that contains all elements with transition, that have properties, that can change dimension of the element. */ private mapTransitionElements; /** * Map, that contains all elements with hover, that have properties, that can change dimension of the element. */ private mapHoverElements; /** * Map, that contains all elements with active or focus, that have properties, * that can change dimension of the element. */ private mapActiveFocusedElements; /** * Flag for active element. */ private isElementFocused; /** * Map for elements, that currently animating. */ private mapAnimationProcessingElements; /** * Map for elements, that currently has transition. */ private mapTransitionProcessingElements; /** * Flag for listener initialization. */ private isListenersInitialized; /** * Mutation observer instance. */ private mutationObserver; /** * Previous hovered element is needed to detect, if the document need to be reflowed on the mouse event. */ private previousHoveredElement; /** * Current hovered element is needed to detect, if the document need to be reflowed on the mouse event. */ private currentHoveredElement; /** * Method, that calls recursively and check elements for change. */ private watchElements; /** * Method for EVENTS_FOR_CHECK_RESIZE array. */ private checkForUpdateListenersCb; /** * Method for EVENTS_FOR_START_REQUEST_ANIMATION_FRAME array. */ private requestListenersCb; /** * Resize cb. */ private resizeCb; private hasElementsInDom; constructor(); /** * Append element to the map, that should be used for detect changes. * * @param element HTML element. * @param options Options for observer: 'content-box' or 'border-box'. * @param instance Instance of the observable. */ addElementToMap(element: Element | SVGElement, options: ResizeObserverOptions, instance: ResizeObserver): void; /** * Remove element from the map. * * @param element HTML element. */ removeElementFromInstance(element: Element | SVGElement): void; /** * Method, that delete all elements with instance, that will be provided. * * @param instance Observer instance. */ removeInstance(instance: ResizeObserver): void; /** * Start ping changes during the animation. */ private start; /** * Stop ping changes. */ private stop; private isElementExistInTheMap; /** * Method, that forms ResizeObserverEntry object. * * @param target * @param param1 ElementData object. * * @returns {ResizeObserverEntry} */ private getTargetEntry; /** * This method will call only once, when the new element will be added to the map. * * * @param target * @param options * @param instance * * @returns {ElementData} */ private getElementData; /** * Helper method, which return sum of the properties. * * @param properties * @param computedStyles * * @returns {number} Returns sum. */ private getSumOfProperties; /** * Method, that check elements for their cahnges. */ private checkForUpdate; /** * Method, that generate map for transitions and animations elements. * This method prevent observable from running request method, * if the target element not exist in the animation map or transition map. */ private setAnimationElementsToMap; /** * Mutation observer initializer. */ private initializeMutationObserver; /** * Initialize EVENTS_FOR_START_REQUEST_ANIMATION_FRAME listeners. */ private inititalizeRequestListeners; /** * Initialize EVENTS_FOR_CHECK_RESIZE listeners. */ private initializeCheckForUpdateListeners; /** * Remove EVENTS_FOR_START_REQUEST_ANIMATION_FRAME listeners. */ private removeRequestListeners; /** * Remove EVENTS_FOR_CHECK_RESIZE listeners. */ private removeCheckForUpdateListeners; /** * Initialize all listeners and mutation observer, also generate map for all animations elements. */ private init; /** * Remove all listeners and disconnect from mutation observer, also clear all maps. */ private destroy; }