|
import { DOCUMENT_MODE, type NS } from '../common/html.js'; |
|
import type { Attribute, Location, ElementLocation } from '../common/token.js'; |
|
import type { TreeAdapter, TreeAdapterTypeMap } from './interface.js'; |
|
export interface Document { |
|
|
|
nodeName: '#document'; |
|
|
|
|
|
|
|
|
|
mode: DOCUMENT_MODE; |
|
|
|
childNodes: ChildNode[]; |
|
|
|
sourceCodeLocation?: Location | null; |
|
} |
|
export interface DocumentFragment { |
|
|
|
nodeName: '#document-fragment'; |
|
|
|
childNodes: ChildNode[]; |
|
|
|
sourceCodeLocation?: Location | null; |
|
} |
|
export interface Element { |
|
|
|
nodeName: string; |
|
|
|
tagName: string; |
|
|
|
attrs: Attribute[]; |
|
|
|
namespaceURI: NS; |
|
|
|
sourceCodeLocation?: ElementLocation | null; |
|
|
|
parentNode: ParentNode | null; |
|
|
|
childNodes: ChildNode[]; |
|
} |
|
export interface CommentNode { |
|
|
|
nodeName: '#comment'; |
|
|
|
parentNode: ParentNode | null; |
|
|
|
data: string; |
|
|
|
sourceCodeLocation?: Location | null; |
|
} |
|
export interface TextNode { |
|
nodeName: '#text'; |
|
|
|
parentNode: ParentNode | null; |
|
|
|
value: string; |
|
|
|
sourceCodeLocation?: Location | null; |
|
} |
|
export interface Template extends Element { |
|
nodeName: 'template'; |
|
tagName: 'template'; |
|
|
|
content: DocumentFragment; |
|
} |
|
export interface DocumentType { |
|
|
|
nodeName: '#documentType'; |
|
|
|
parentNode: ParentNode | null; |
|
|
|
name: string; |
|
|
|
publicId: string; |
|
|
|
systemId: string; |
|
|
|
sourceCodeLocation?: Location | null; |
|
} |
|
export type ParentNode = Document | DocumentFragment | Element | Template; |
|
export type ChildNode = Element | Template | CommentNode | TextNode | DocumentType; |
|
export type Node = ParentNode | ChildNode; |
|
export type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>; |
|
export declare const defaultTreeAdapter: TreeAdapter<DefaultTreeAdapterMap>; |
|
|