/** * Options for the `EventManager` class. * * @property {Element | Document} [domElement=document] - The DOM element or document to attach event listeners to. * @property {null | { eventType: string; keypress: string[] }} [keyboardEvent] - The keyboard event type and key presses to listen for. * @property {null | string} [clickOrTouchEvent] - The click event or touch event if touch device is supported. * @property {boolean} [attachToRootElement=false] - Attach the event listener to the root element (`document`) instead of the provided `domElement`. * This option should be used with caution, as it can lead to increased performance issues and unexpected behavior if not managed properly. */ type LiveOptions = { domElement?: Element | Document; keyboardEvent?: { eventType: string; keypress: string[]; } | null; clickOrTouchEvent?: string | string[] | null; attachToRootElement?: boolean; }; type EventCallback = (event: Event, target: Element | null) => void; /** * Attaches one or more event listeners to the specified DOM element, using the provided selector, * callback function, and optional event types. If no options are provided, the default options will be used. * * @param {string} selector - The CSS selector to match elements for the event listener. * @param {EventCallback} callback - The function to call when the event is triggered. * @param {Partial} options - The options for the event listener. */ export default class EventManager { private static eventListenerMap; static live(selector: string, fn: EventCallback, options?: Partial): void; /** * Creates an event listener function that checks if the provided event should be handled based on the * provided event types and keyboard event. If the event should be handled, it retrieves the closest * element that matches the given selector from the event target and calls the provided callback function * with the event and target as arguments. */ private static createEventListener; /** * Checks if the provided event should be handled based on the given event types and keyboard event. * @returns `true` if the event should be handled, `false` otherwise. */ private static shouldHandleEvent; /** * Retrieves the closest element matching the provided selector from the event target. */ private static getEventTarget; /** * Removes all event listeners associated with the provided selector from the given DOM element. */ static removeEventListener(selector: string, domElement?: Element | Document): void; /** * Removes all event listeners associated with any registered selectors from the given DOM element. */ static removeAllEventListeners(domElement?: Element | Document): void; } export {};