import TinyHtml from '../TinyHtml.mjs'; import * as TinyCollision from '../../../basics/collision.mjs'; export type NodeSizes = { /** * - The height of the element in pixels. */ height: number; /** * - The width of the element in pixels. */ width: number; }; export type NodeSizesEvent = (elem: Element, sizes: { old: NodeSizes; now: NodeSizes; }, elemAmount: { old: number; now: number; }) => NodeSizes | undefined; export type ScrollListenersFunc = (payload: any) => void; export type TinySmartScrollerEvents = { /** * - Emitted when the scroll boundary state changes. */ onScrollBoundary: (data: any) => void; /** * - Emitted when the custom scroll boundary state changes. */ onExtraScrollBoundary: (data: any) => void; /** * - Emitted when an auto-scroll occurs. */ onAutoScroll: (data: any) => void; /** * - Emitted when auto-scroll is paused. */ onScrollPause: (data: any) => void; }; /** * Represents the dimensions of a DOM element. * * @typedef {Object} NodeSizes * @property {number} height - The height of the element in pixels. * @property {number} width - The width of the element in pixels. */ /** * A callback function that receives node size change data and optionally returns a modified NodeSizes object. * * @callback NodeSizesEvent * @param {Element} elem - The DOM element whose size is being tracked. * @param {{ old: NodeSizes, now: NodeSizes }} sizes - The old and new size measurements of the element. * @param {{ old: number, now: number }} elemAmount - The number of matching elements before and after the update. * @returns {NodeSizes|undefined} A modified NodeSizes object to override the default measurement, or undefined to use the original. */ /** * A generic scroll-related event listener callback function. * * @callback ScrollListenersFunc * @param {any} payload - The data payload passed when the scroll event is triggered. The type may vary depending on the event. * @returns {void} */ /** * Event map for {@link TinySmartScroller}. * @typedef {Object} TinySmartScrollerEvents * @property {(data: any) => void} onScrollBoundary - Emitted when the scroll boundary state changes. * @property {(data: any) => void} onExtraScrollBoundary - Emitted when the custom scroll boundary state changes. * @property {(data: any) => void} onAutoScroll - Emitted when an auto-scroll occurs. * @property {(data: any) => void} onScrollPause - Emitted when auto-scroll is paused. */ /** @type {new (...args: any[]) => import('../../../jsdoc/EventEmitter.mjs').ICustomEventEmitter} */ declare const TypedEventEmitter: new (...args: any[]) => import('../../../jsdoc/EventEmitter.mjs').ICustomEventEmitter; /** * TinySmartScroller is a utility class designed to enhance and manage scroll behaviors within containers or the window. * * It enables advanced scroll monitoring, auto-scrolling to bottom, preserving scroll position during DOM changes, * and detecting visibility changes of elements. This is particularly useful for dynamic UIs like chat applications, * feed viewers, or live content containers. * * Features: * - Detects when the scroll reaches the top, bottom, or custom boundaries * - Supports automatic scrolling to the bottom unless the user scrolls away * - Observes DOM mutations and resizes, and adapts scroll position accordingly * - Emits scroll-related events such as 'onScrollBoundary', 'onAutoScroll', and 'onScrollPause' * - Includes customizable scroll correction filters for layout shift mitigation * - Handles media element load events (e.g. ``, `