-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArrayHTML.d.mts
51 lines (51 loc) · 1.92 KB
/
ArrayHTML.d.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
declare const EVENT_LISTENERS: unique symbol,
OBJECT_PROPERTIES: unique symbol;
type AddDOMEventListenerParameters = [
keyof HTMLElementEventMap,
((this: HTMLElement, event: HTMLElementEventMap[keyof HTMLElementEventMap]) => any) | EventListenerObject,
(boolean | AddEventListenerOptions)?
];
type AddCustomEventListenerParameters = [
string,
((this: HTMLElement, event: Event) => any) | EventListenerObject,
(boolean | AddEventListenerOptions)?
]
type ArrayHTMLElementNode = [
keyof HTMLElementTagNameMap,
((ArrayHTMLCollectionContent | ArrayHTMLShadowRootNode)[] | ArrayHTMLNodeContent | Node)?,
{
style?: Partial<CSSStyleDeclaration> | string,
class?: string[] | string,
[EVENT_LISTENERS]?: (AddDOMEventListenerParameters | AddCustomEventListenerParameters)[],
[OBJECT_PROPERTIES]?: object,
[key: string]: any
}?,
string?,
boolean?
];
type ArrayHTMLTextNode = [
"#comment" | "#text",
ArrayHTMLNodeContent?,
void?,
string?,
boolean?
];
type ArrayHTMLShadowRootNode = [
"#shadow",
ArrayHTMLCollection | ArrayHTMLNodeContent | Node | void,
ShadowRootInit,
string?
];
type ArrayHTMLNodeContent = string | boolean | number | bigint;
type ArrayHTMLCollectionContent = ArrayHTMLElementNode | ArrayHTMLTextNode | string | ArrayHTMLNodeContent | Node;
type ArrayHTMLCollection = ArrayHTMLCollectionContent[];
type CaughtNode = HTMLElementTagNameMap[keyof HTMLElementTagNameMap] | Comment | Text | ShadowRoot;
type CaughtNodes = { [key: string]: CaughtNode | CaughtNode[] };
declare function serialize(node: Node, onlyChildren?: boolean): ArrayHTMLCollection;
declare function parse(ArrayHTML: ArrayHTMLCollection): DocumentFragment;
declare function parseAndGetNodes(ArrayHTML: ArrayHTMLCollection): {
documentFragment: DocumentFragment,
nodes: CaughtNodes
};
declare function parseAndGetNodes(ArrayHTML: ArrayHTMLCollection, appendTo: Node): CaughtNodes;
export { parse, serialize, parseAndGetNodes, EVENT_LISTENERS, OBJECT_PROPERTIES }