/** * Indicates the position of a node relative to another. */ export declare enum DocumentPosition { DISCONNECTED = 1, PRECEDING = 2, FOLLOWING = 4, CONTAINS = 8, CONTAINED_BY = 16, IMPLEMENTATION_SPECIFIC = 32 } /** * Represents the node types for elements. See * {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType}. */ export declare enum NodeType { ELEMENT_NODE = 1, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11 } /** * Indicates the dimensions and location of an element in the DOM. */ export interface Dimensions { /** * The top coordinate, in viewport dimensions. */ top?: number; /** * The left coordinate, in viewport dimensions. */ left?: number; /** * The height in pixels. */ height: number; /** * The width in pixels. */ width: number; } /** * Represents a point in screen coordinates. */ export interface ScreenCoordinate { /** * The X coordinate. */ x: number; /** * The Y coordinate. */ y: number; } /** * Gets the dimensions of an HTMLElement. * * @param element The HTMLElement for which to get the dimensions. */ export declare function getDimensions(element: HTMLElement): Dimensions; /** * Gets the dimensions of the current viewport. */ export declare function getViewport(): Dimensions; /** * Focuses on the next focusable element in the dom, relative to another * HTMLElement. * * @param contextElement The HTMLElement used to find the next focusable * element. * @param filter An optional filter to limit the set of focusable elements to * choose from. Can be a string CSS selector filter applied to the document, * or else an HTML element, in which case it will be constrained to elements * contained within. */ export declare function focusNextElement(contextElement: HTMLElement, filter?: string | HTMLElement): void; /** * Focuses on the previous focusable element in the dom, relative to another * HTMLElement. * * @param contextElement The HTMLElement used to find the previous focusable * element. * @param filter An optional filter to limit the set of focusable elements to * choose from. Can be a string CSS selector filter applied to the document, * or else an HTML element, in which case it will be constrained to elements * contained within. */ export declare function focusPreviousElement(contextElement: HTMLElement, filter?: string | HTMLElement): void; /** * Returns a list of focusable HTMLElements in the dom. * * @param element The HTMLElement to start the search from. * @param filterSelector A CSS selector to filter which element will be focused. */ export declare function getFocusableElements(element?: HTMLElement, filterSelector?: string): HTMLElement[]; /** * Returns whether or not an element can be focused. * * @param element The HTMLElement to check. * @param filterSelector An optional CSS selector that is use to customize the * definition of "focusable". The element must match this selector. */ export declare function elementIsFocusable(element: HTMLElement, filterSelector?: string): boolean; /** * Converts a rem unit to pixels. */ export declare function remToPixels(): number; /** * Converts em units to pixels. * * @param element The element to use as context (since em is a relative unit). */ export declare function emToPixels(element?: Element): number; /** * Returns an element from the DOM or undefined if the element cannot be found * within the timeout period. * * @param selector The CSS selector used to find an element. * @param timeout The maximum number of milliseconds to spend searching for the * DOM element. * @param contextElement A context element to search within. */ export declare function getElement(selector: string, timeout?: number, contextElement?: Element): Promise;