-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
53 lines (45 loc) · 1.28 KB
/
index.d.ts
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
52
53
import { TagTree } from 'tag-tree';
export type Selector =
| string
| { $filter: (el: HTMLElement) => boolean }
| { $map: (el: HTMLElement) => null | undefined | HTMLElement }
| {
$watch: {
attributeFilter: string[];
cond: string | ((el: HTMLElement) => boolean);
};
}
| { $or: Array<Array<Selector>> }
| { $log: string };
export interface Watcher {
sources: Array<string | null>;
tag: string;
selectors: Array<Selector>;
}
export interface Finder {
fn(root: HTMLElement): Array<HTMLElement> | NodeListOf<HTMLElement>;
interval?:
| null
| undefined
| number
| ((elementCount: number, timeRunning: number) => number);
}
export interface TagOptions {
ownedBy?: null | undefined | ReadonlyArray<string>;
}
export interface PageParserTreeOptions {
logError?:
| null
| undefined
| ((err: Error, el: undefined | HTMLElement) => void);
tags: { [tag: string]: TagOptions };
watchers: ReadonlyArray<Watcher>;
finders: { [tag: string]: Finder };
}
export default class PageParserTree {
tree: TagTree<HTMLElement>;
constructor(root: Document | HTMLElement, options: PageParserTreeOptions);
dump(): void;
// Intended for use with hot module replacement.
replaceOptions(options: PageParserTreeOptions): void;
}