@whitesev/domutils 1.3.8 → 1.4.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/LICENSE +674 -0
- package/dist/index.amd.js +49 -39
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +49 -39
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -39
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +49 -39
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +49 -39
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +49 -39
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtils.d.ts +5 -4
- package/dist/types/src/DOMUtilsCommonUtils.d.ts +2 -2
- package/dist/types/src/DOMUtilsData.d.ts +1 -1
- package/dist/types/src/DOMUtilsEvent.d.ts +5 -204
- package/dist/types/src/WindowApi.d.ts +2 -11
- package/dist/types/src/types/DOMUtilsEvent.d.ts +238 -0
- package/dist/types/src/types/WindowApi.d.ts +10 -0
- package/package.json +1 -1
- package/src/DOMUtils.ts +6 -8
- package/src/DOMUtilsCommonUtils.ts +5 -4
- package/src/DOMUtilsData.ts +1 -1
- package/src/DOMUtilsEvent.ts +10 -242
- package/src/WindowApi.ts +13 -13
- package/src/types/DOMUtilsEvent.d.ts +238 -0
- package/src/types/WindowApi.d.ts +10 -0
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
|
+
class WindowApi {
|
|
2
|
+
/** 默认的配置 */
|
|
3
|
+
defaultApi = {
|
|
4
|
+
document: document,
|
|
5
|
+
window: window,
|
|
6
|
+
globalThis: globalThis,
|
|
7
|
+
self: self,
|
|
8
|
+
top: top,
|
|
9
|
+
};
|
|
10
|
+
/** 使用的配置 */
|
|
11
|
+
api;
|
|
12
|
+
constructor(option) {
|
|
13
|
+
if (option) {
|
|
14
|
+
if (option.globalThis == null) {
|
|
15
|
+
option.globalThis = option.window;
|
|
16
|
+
}
|
|
17
|
+
if (option.self == null) {
|
|
18
|
+
option.self = option.window;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!option) {
|
|
22
|
+
option = Object.assign({}, this.defaultApi);
|
|
23
|
+
}
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
this.api = Object.assign({}, option);
|
|
26
|
+
}
|
|
27
|
+
get document() {
|
|
28
|
+
return this.api.document;
|
|
29
|
+
}
|
|
30
|
+
get window() {
|
|
31
|
+
return this.api.window;
|
|
32
|
+
}
|
|
33
|
+
get globalThis() {
|
|
34
|
+
return this.api.globalThis;
|
|
35
|
+
}
|
|
36
|
+
get self() {
|
|
37
|
+
return this.api.self;
|
|
38
|
+
}
|
|
39
|
+
get top() {
|
|
40
|
+
return this.api.top;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
1
44
|
/** 通用工具类 */
|
|
2
45
|
const DOMUtilsCommonUtils = {
|
|
3
|
-
windowApi: {
|
|
4
|
-
window: window,
|
|
46
|
+
windowApi: new WindowApi({
|
|
5
47
|
document: document,
|
|
6
|
-
|
|
48
|
+
window: window,
|
|
49
|
+
top: top,
|
|
50
|
+
}),
|
|
7
51
|
/**
|
|
8
52
|
* 判断元素是否已显示或已连接
|
|
9
53
|
* @param element
|
|
@@ -109,7 +153,7 @@ const DOMUtilsCommonUtils = {
|
|
|
109
153
|
|
|
110
154
|
/* 数据 */
|
|
111
155
|
const DOMUtilsData = {
|
|
112
|
-
/** .on
|
|
156
|
+
/** .on添加在元素存储的事件 */
|
|
113
157
|
SymbolEvents: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
|
|
114
158
|
};
|
|
115
159
|
|
|
@@ -119,40 +163,6 @@ const OriginPrototype = {
|
|
|
119
163
|
},
|
|
120
164
|
};
|
|
121
165
|
|
|
122
|
-
class WindowApi {
|
|
123
|
-
/** 默认的配置 */
|
|
124
|
-
defaultApi = {
|
|
125
|
-
document: document,
|
|
126
|
-
window: window,
|
|
127
|
-
globalThis: globalThis,
|
|
128
|
-
self: self,
|
|
129
|
-
top: top,
|
|
130
|
-
};
|
|
131
|
-
/** 使用的配置 */
|
|
132
|
-
api;
|
|
133
|
-
constructor(option) {
|
|
134
|
-
if (!option) {
|
|
135
|
-
option = Object.assign({}, this.defaultApi);
|
|
136
|
-
}
|
|
137
|
-
this.api = Object.assign({}, option);
|
|
138
|
-
}
|
|
139
|
-
get document() {
|
|
140
|
-
return this.api.document;
|
|
141
|
-
}
|
|
142
|
-
get window() {
|
|
143
|
-
return this.api.window;
|
|
144
|
-
}
|
|
145
|
-
get globalThis() {
|
|
146
|
-
return this.api.globalThis;
|
|
147
|
-
}
|
|
148
|
-
get self() {
|
|
149
|
-
return this.api.self;
|
|
150
|
-
}
|
|
151
|
-
get top() {
|
|
152
|
-
return this.api.top;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
166
|
class DOMUtilsEvent {
|
|
157
167
|
windowApi;
|
|
158
168
|
constructor(windowApiOption) {
|
|
@@ -965,7 +975,7 @@ class DOMUtils extends DOMUtilsEvent {
|
|
|
965
975
|
super(option);
|
|
966
976
|
}
|
|
967
977
|
/** 版本号 */
|
|
968
|
-
version = "2024.
|
|
978
|
+
version = "2024.11.6";
|
|
969
979
|
attr(element, attrName, attrValue) {
|
|
970
980
|
let DOMUtilsContext = this;
|
|
971
981
|
if (typeof element === "string") {
|