@whitesev/domutils 1.1.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +155 -115
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +155 -115
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +155 -115
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +155 -115
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +155 -115
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +155 -115
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtils.d.ts +3 -3
- package/dist/types/src/DOMUtilsCommonUtils.d.ts +2 -0
- package/dist/types/src/DOMUtilsEvent.d.ts +4 -2
- package/dist/types/src/WindowApi.d.ts +22 -0
- package/package.json +5 -3
- package/src/DOMUtils.ts +1791 -0
- package/src/DOMUtilsCommonUtils.ts +111 -0
- package/src/DOMUtilsData.ts +9 -0
- package/src/DOMUtilsEvent.ts +1259 -0
- package/src/DOMUtilsOriginPrototype.ts +7 -0
- package/src/WindowApi.ts +44 -0
- package/src/types/global.d.ts +5 -0
- package/src/types/gm.d.ts +2 -0
- package/dist/types/src/DOMUtilsCore.d.ts +0 -15
package/src/WindowApi.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置类型
|
|
3
|
+
*/
|
|
4
|
+
export type UtilsWindowApiOption = {
|
|
5
|
+
document: Document;
|
|
6
|
+
window: Window & typeof globalThis;
|
|
7
|
+
globalThis: typeof globalThis | Window;
|
|
8
|
+
self: Window & typeof globalThis;
|
|
9
|
+
top: Window;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export class WindowApi {
|
|
13
|
+
/** 默认的配置 */
|
|
14
|
+
private defaultApi: UtilsWindowApiOption = {
|
|
15
|
+
document: document,
|
|
16
|
+
window: window,
|
|
17
|
+
globalThis: globalThis,
|
|
18
|
+
self: self,
|
|
19
|
+
top: top!,
|
|
20
|
+
};
|
|
21
|
+
/** 使用的配置 */
|
|
22
|
+
private api: UtilsWindowApiOption;
|
|
23
|
+
constructor(option?: UtilsWindowApiOption) {
|
|
24
|
+
if (!option) {
|
|
25
|
+
option = Object.assign({}, this.defaultApi);
|
|
26
|
+
}
|
|
27
|
+
this.api = Object.assign({}, option);
|
|
28
|
+
}
|
|
29
|
+
get document() {
|
|
30
|
+
return this.api.document;
|
|
31
|
+
}
|
|
32
|
+
get window() {
|
|
33
|
+
return this.api.window;
|
|
34
|
+
}
|
|
35
|
+
get globalThis() {
|
|
36
|
+
return this.api.globalThis;
|
|
37
|
+
}
|
|
38
|
+
get self() {
|
|
39
|
+
return this.api.self;
|
|
40
|
+
}
|
|
41
|
+
get top() {
|
|
42
|
+
return this.api.top;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface DOMUtilsCoreOption {
|
|
2
|
-
document: Document;
|
|
3
|
-
window: Window | typeof globalThis;
|
|
4
|
-
globalThis: Window | typeof globalThis;
|
|
5
|
-
self: Window | typeof globalThis;
|
|
6
|
-
top: Window | typeof globalThis;
|
|
7
|
-
}
|
|
8
|
-
declare const DOMUtilsCore: {
|
|
9
|
-
init(option?: DOMUtilsCoreOption): void;
|
|
10
|
-
readonly document: Document;
|
|
11
|
-
readonly window: typeof globalThis | Window;
|
|
12
|
-
readonly globalThis: typeof globalThis | Window;
|
|
13
|
-
readonly self: typeof globalThis | Window;
|
|
14
|
-
};
|
|
15
|
-
export { DOMUtilsCore };
|