/** * The following code is modified based on * https://github.com/nanobrowser/nanobrowser/blob/master/chrome-extension/src/background/dom/views.ts * * Apache-2.0 License * Copyright (c) 2024 alexchenzl * https://github.com/nanobrowser/nanobrowser/blob/master/LICENSE */ import type { ViewportInfo, CoordinateSet } from './history/views'; export declare abstract class DOMBaseNode { isVisible: boolean; parent?: DOMElementNode | null; constructor(isVisible: boolean, parent?: DOMElementNode | null); } export declare class DOMTextNode extends DOMBaseNode { type: "TEXT_NODE"; text: string; constructor(text: string, isVisible: boolean, parent?: DOMElementNode | null); hasParentWithHighlightIndex(): boolean; } export declare class DOMElementNode extends DOMBaseNode { /** * xpath: the xpath of the element from the last root node (shadow root or iframe OR document if no shadow root or iframe). * To properly reference the element we need to recursively switch the root node until we find the element (work you way up the tree with `.parent`) */ tagName: string | null; xpath: string | null; cssSelector: string | null; attributes: Record; children: DOMBaseNode[]; isInteractive: boolean; isTopElement: boolean; shadowRoot: boolean; highlightIndex?: number; viewportCoordinates?: CoordinateSet; pageCoordinates?: CoordinateSet; viewportInfo?: ViewportInfo; constructor(params: { tagName: string | null; xpath: string | null; cssSelector: string | null; attributes: Record; children: DOMBaseNode[]; isVisible: boolean; isInteractive?: boolean; isTopElement?: boolean; shadowRoot?: boolean; highlightIndex?: number; viewportCoordinates?: CoordinateSet; pageCoordinates?: CoordinateSet; viewportInfo?: ViewportInfo; parent?: DOMElementNode | null; }); getAllTextTillNextClickableElement(maxDepth?: number): string; clickableElementsToString(includeAttributes?: string[]): string; getFileUploadElement(checkSiblings?: boolean): DOMElementNode | null; getAdvancedCssSelector(): string; convertSimpleXPathToCssSelector(xpath: string): string; enhancedCssSelectorForElement(includeDynamicAttributes?: boolean): string; } export interface DOMState { elementTree: DOMElementNode; selectorMap: Map; } export declare function domElementNodeToDict(elementTree: DOMBaseNode): any; //# sourceMappingURL=views.d.ts.map