/
types.d.ts
76 lines (68 loc) · 2.43 KB
/
types.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { Dictionary } from '../../../../configuration/interfaces';
import { SelectorErrorBase } from '../../../../shared/errors/index';
import selectorFilter from './selector-executor/filter';
export interface FilterOptions {
filterVisible: boolean;
filterHidden: boolean;
counterMode: boolean;
collectionMode: boolean;
index: number | null;
getVisibleValueMode: boolean;
}
export interface APIInfo {
apiFnChain: string[];
apiFnID: number;
}
export interface FnInfo {
apiFnChain: string[];
apiFnIndex: number | null;
}
type CustomDOMProperties = Dictionary<(n: Node) => unknown>;
export interface SelectorDependencies extends Dictionary<unknown> {
selectorFilter: typeof selectorFilter;
filterOptions: FilterOptions;
apiInfo: APIInfo;
boundArgs?: unknown[];
customDOMProperties?: CustomDOMProperties;
}
type SelectorErrorCb = (fn: FnInfo | null) => SelectorErrorBase;
export interface NativeMethods {
Function: typeof Function;
Node: typeof Node;
objectKeys: ObjectConstructor['keys'];
objectAssign: ObjectConstructor['assign'];
objectGetPrototypeOf: ObjectConstructor['getPrototypeOf'];
objectToString: Object['toString']; // eslint-disable-line @typescript-eslint/ban-types
Promise: typeof Promise;
dateNow: DateConstructor['now'];
isArray: ArrayConstructor['isArray'];
arrayFilter: any[]['filter'];
NodeList: typeof NodeList;
HTMLCollection: typeof HTMLCollection;
setTimeout: Window['setTimeout'];
elementClass: typeof Element;
svgElementClass: typeof SVGElement;
closest: Element['closest'];
matches: Element['matches'];
getAttribute: Element['getAttribute'];
querySelector: HTMLElement['querySelector'];
querySelectorAll: HTMLElement['querySelectorAll'];
contentWindowGetter: () => HTMLIFrameElement['contentWindow'];
scrollTo: Window['scrollTo'];
}
export interface ClientFunctionAdapter {
isProxyless: boolean;
nativeMethods: NativeMethods;
PromiseCtor: typeof Promise;
delay (ms: number): Promise<void>;
isShadowRoot (el: Node): boolean;
isDomElement (el: unknown): boolean;
isTextNode (el: unknown): boolean;
isOptionElement (el: unknown): boolean;
getTagName (el: Element): string;
isOptionElementVisible (el: Node): boolean;
isElementVisible (el: Node): boolean;
isIframeElement (el: Node): boolean;
isIframeVisible (el: Node): boolean;
getActiveElement (): Node;
}