import { type Controller } from './Controller'; type ListenerFn = K extends 'destroy' ? () => void : (event: EventMap[K]) => void; interface EventMap extends DocumentEventMap { 'destroy': never; } export declare class Dom { controller: Controller; _listeners: DomListener[]; constructor(controller: any); _initListeners(): any[]; _listenerIndex(domListener: any): number; /** * Adds a DOM event listener that will get cleaned up when this component is cleaned up. * * @param type - Name of the DOM event to listen to * @param target - Optional target to add the DOM listener to. If not provided, the target is `document`. * @param listener - Listener to be called when the DOM event occurs * @param useCapture - Optional, defaults to false. If true, add the listener as a capturing listener. * * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener */ addListener(type: K, target: EventTarget, listener: ListenerFn, useCapture?: boolean): void; addListener(type: K, listener: ListenerFn, useCapture?: boolean): void; /** * Adds a DOM event listener that will get cleaned up when this component is cleaned up. * * @param type - Name of the DOM event to listen to * @param target - Optional target to add the DOM listener to. If not provided, the target is `document`. * @param listener - Listener to be called when the DOM event occurs * @param useCapture - Optional, defaults to false. If true, add the listener as a capturing listener. * * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener */ on(type: K, target: EventTarget, listener: ListenerFn, useCapture?: boolean): void; on(type: K, listener: ListenerFn, useCapture?: boolean): void; /** * Adds a one-time DOM event listener that will get cleaned up when this component is cleaned up. * * @param type - Name of the DOM event to listen to * @param target - Optional target to add the DOM listener to. If not provided, the target is `document`. * @param listener - Listener to be called when the DOM event occurs * @param useCapture - Optional, defaults to false. If true, add the listener as a capturing listener. * * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener */ once(type: K, target: EventTarget, listener: ListenerFn, useCapture?: boolean): void; once(type: K, listener: ListenerFn, useCapture?: boolean): void; /** * Removes a DOM event listener that was added via `#addListener`, `#on`, or `#once`, using the same * parameters as those methods. * * @param type - Name of the DOM event * @param target - Optional target for the DOM listener. If not provided, the target is `document`. * @param listener - Listener function that was passed to `#addListener`, `#on`, or `#once`. * @param useCapture - Optional, defaults to false. If true, removes a capturing listener. * * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener */ removeListener(type: K, target: EventTarget, listener: ListenerFn, useCapture?: boolean): void; removeListener(type: K, listener: ListenerFn, useCapture?: boolean): void; } export declare class DomListener { type: string; target: EventTarget; listener: ListenerFn; useCapture: boolean; constructor(type: string, target: EventTarget, listener: ListenerFn, useCapture?: boolean); equals(domListener: any): boolean; add(): void; remove(): void; } export declare class DestroyListener extends DomListener<'destroy'> { constructor(target: EventTarget, listener: ListenerFn<'destroy'>); add(): void; remove(): void; } export {};