1 | import { DOCUMENT_MODE, type NS } from '../common/html.js';
|
2 | import type { Attribute, Location, ElementLocation } from '../common/token.js';
|
3 | import type { TreeAdapter, TreeAdapterTypeMap } from './interface.js';
|
4 | export interface Document {
|
5 |
|
6 | nodeName: '#document';
|
7 | |
8 |
|
9 |
|
10 |
|
11 | mode: DOCUMENT_MODE;
|
12 |
|
13 | childNodes: ChildNode[];
|
14 |
|
15 | sourceCodeLocation?: Location | null;
|
16 | }
|
17 | export interface DocumentFragment {
|
18 |
|
19 | nodeName: '#document-fragment';
|
20 |
|
21 | childNodes: ChildNode[];
|
22 |
|
23 | sourceCodeLocation?: Location | null;
|
24 | }
|
25 | export interface Element {
|
26 |
|
27 | nodeName: string;
|
28 |
|
29 | tagName: string;
|
30 |
|
31 | attrs: Attribute[];
|
32 |
|
33 | namespaceURI: NS;
|
34 |
|
35 | sourceCodeLocation?: ElementLocation | null;
|
36 |
|
37 | parentNode: ParentNode | null;
|
38 |
|
39 | childNodes: ChildNode[];
|
40 | }
|
41 | export interface CommentNode {
|
42 |
|
43 | nodeName: '#comment';
|
44 |
|
45 | parentNode: ParentNode | null;
|
46 |
|
47 | data: string;
|
48 |
|
49 | sourceCodeLocation?: Location | null;
|
50 | }
|
51 | export interface TextNode {
|
52 | nodeName: '#text';
|
53 |
|
54 | parentNode: ParentNode | null;
|
55 |
|
56 | value: string;
|
57 |
|
58 | sourceCodeLocation?: Location | null;
|
59 | }
|
60 | export interface Template extends Element {
|
61 | nodeName: 'template';
|
62 | tagName: 'template';
|
63 |
|
64 | content: DocumentFragment;
|
65 | }
|
66 | export interface DocumentType {
|
67 |
|
68 | nodeName: '#documentType';
|
69 |
|
70 | parentNode: ParentNode | null;
|
71 |
|
72 | name: string;
|
73 |
|
74 | publicId: string;
|
75 |
|
76 | systemId: string;
|
77 |
|
78 | sourceCodeLocation?: Location | null;
|
79 | }
|
80 | export type ParentNode = Document | DocumentFragment | Element | Template;
|
81 | export type ChildNode = Element | Template | CommentNode | TextNode | DocumentType;
|
82 | export type Node = ParentNode | ChildNode;
|
83 | export type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>;
|
84 | export declare const defaultTreeAdapter: TreeAdapter<DefaultTreeAdapterMap>;
|