import type { Percent } from "./Percent"; import type { IPointerEvent } from "../render/backend/Renderer"; import type { Sprite } from "../render/Sprite"; import * as $type from "./Type"; import type { IBounds } from "./IBounds"; import { DisposerClass, IDisposer } from "./Disposer"; /** * ============================================================================ * DOM FUNCTIONS * ============================================================================ * @hidden */ /** * Calls `f` when the DOM is ready, or right away if it already is. * * @since 5.0.2 * @param f Callback */ export declare function ready(f: () => void): void; /** * Removes a DOM element. * @param el Target element */ export declare function removeElement(el: HTMLElement): void; /** * Function that adds a disposable event listener directly to a DOM element. * * @ignore Exclude from docs * @param dom A DOM element to add event to * @param type Event type * @param listener Event listener * @returns Disposable event */ export declare function addEventListener(dom: EventTarget, type: string, listener: (event: E) => void, options?: any): IDisposer; /** * Calls `listener` when the window is resized, which also happens when the * browser's zoom changes. * * @param listener Event listener * @returns Disposable event */ export declare function onZoom(listener: () => void): IDisposer; /** * @ignore */ export declare function supports(cap: "touchevents" | "pointerevents" | "mouseevents" | "wheelevents" | "keyboardevents"): boolean; /** * @ignore */ export declare function getPointerId(event: IPointerEvent): any; /** * Removes focus from any element by shifting focus to body. * * @ignore */ export declare function blur(): void; /** * Focuses element. * * @ignore */ export declare function focus(el: HTMLElement): void; /** * @ignore */ export declare function getRendererEvent(key: string): string; /** * Returns `true` if the event came from touch or a pen, `false` if from a * mouse. * * @param ev Original event * @return Touch pointer? */ export declare function isTouchEvent(ev: MouseEvent | Touch): boolean; /** * Sets style property on DOM element. * * @ignore Exclude from docs */ export declare function setStyle(dom: HTMLElement, property: string, value: string | undefined): void; /** * Gets style property value on a DOM element. * * @ignore Exclude from docs */ export declare function getStyle(dom: HTMLElement, property: string): string | undefined; /** * Gets the target of the event, works for shadow DOM too. */ export declare function getEventTarget(event: Event | Touch): Node | null; /** * Checks if element `a` contains element `b`, or is `b`. Looks across shadow * DOM boundaries too. * * @param a Alleged ancestor * @param b Alleged descendant * @return Contains? */ export declare function contains(a: Element, b: Element): boolean; /** * Returns `true` if pointer event originated on an element within Root. * * @since 5.2.8 * @param event Event * @param target Any element of the [[Root]] to check */ export declare function isLocalEvent(event: IPointerEvent, target: Sprite): boolean | null; /** * Disables or enables interactivity of a DOM element. * * @param target Target element * @param interactive Interactive? */ export declare function setInteractive(target: HTMLElement, interactive: boolean): void; /** * Returns a normalized key name from a keyboard event. * * @ignore */ export declare function getEventKey(event: KeyboardEvent): string; /** * Returns the shadow root the node is in, or `null` if it is not in one. * * @param a Node * @return Root */ export declare function getShadowRoot(a: Node): ShadowRoot | null; /** * Defines a class for a CSS rule. * * Can be used to dynamically add CSS to the document. */ export declare class StyleRule extends DisposerClass { private _root; /** * CSS rule. */ private _rule; /** * A CSS selector text. * * E.g.: `.myClass p` * * @param selector CSS selector */ set selector(selector: string); /** * @return CSS selector */ get selector(): string; /** * Constructor. * * @param element Shadow root to add the rule to, or `null` for the document * @param selector CSS selector * @param styles An object of style attribute - value pairs * @param nonce Nonce for the `