@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.amd.js
CHANGED
|
@@ -1,11 +1,55 @@
|
|
|
1
1
|
define((function () { 'use strict';
|
|
2
2
|
|
|
3
|
+
class WindowApi {
|
|
4
|
+
/** 默认的配置 */
|
|
5
|
+
defaultApi = {
|
|
6
|
+
document: document,
|
|
7
|
+
window: window,
|
|
8
|
+
globalThis: globalThis,
|
|
9
|
+
self: self,
|
|
10
|
+
top: top,
|
|
11
|
+
};
|
|
12
|
+
/** 使用的配置 */
|
|
13
|
+
api;
|
|
14
|
+
constructor(option) {
|
|
15
|
+
if (option) {
|
|
16
|
+
if (option.globalThis == null) {
|
|
17
|
+
option.globalThis = option.window;
|
|
18
|
+
}
|
|
19
|
+
if (option.self == null) {
|
|
20
|
+
option.self = option.window;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!option) {
|
|
24
|
+
option = Object.assign({}, this.defaultApi);
|
|
25
|
+
}
|
|
26
|
+
// @ts-ignore
|
|
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
|
+
}
|
|
45
|
+
|
|
3
46
|
/** 通用工具类 */
|
|
4
47
|
const DOMUtilsCommonUtils = {
|
|
5
|
-
windowApi: {
|
|
6
|
-
window: window,
|
|
48
|
+
windowApi: new WindowApi({
|
|
7
49
|
document: document,
|
|
8
|
-
|
|
50
|
+
window: window,
|
|
51
|
+
top: top,
|
|
52
|
+
}),
|
|
9
53
|
/**
|
|
10
54
|
* 判断元素是否已显示或已连接
|
|
11
55
|
* @param element
|
|
@@ -111,7 +155,7 @@ define((function () { 'use strict';
|
|
|
111
155
|
|
|
112
156
|
/* 数据 */
|
|
113
157
|
const DOMUtilsData = {
|
|
114
|
-
/** .on
|
|
158
|
+
/** .on添加在元素存储的事件 */
|
|
115
159
|
SymbolEvents: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
|
|
116
160
|
};
|
|
117
161
|
|
|
@@ -121,40 +165,6 @@ define((function () { 'use strict';
|
|
|
121
165
|
},
|
|
122
166
|
};
|
|
123
167
|
|
|
124
|
-
class WindowApi {
|
|
125
|
-
/** 默认的配置 */
|
|
126
|
-
defaultApi = {
|
|
127
|
-
document: document,
|
|
128
|
-
window: window,
|
|
129
|
-
globalThis: globalThis,
|
|
130
|
-
self: self,
|
|
131
|
-
top: top,
|
|
132
|
-
};
|
|
133
|
-
/** 使用的配置 */
|
|
134
|
-
api;
|
|
135
|
-
constructor(option) {
|
|
136
|
-
if (!option) {
|
|
137
|
-
option = Object.assign({}, this.defaultApi);
|
|
138
|
-
}
|
|
139
|
-
this.api = Object.assign({}, option);
|
|
140
|
-
}
|
|
141
|
-
get document() {
|
|
142
|
-
return this.api.document;
|
|
143
|
-
}
|
|
144
|
-
get window() {
|
|
145
|
-
return this.api.window;
|
|
146
|
-
}
|
|
147
|
-
get globalThis() {
|
|
148
|
-
return this.api.globalThis;
|
|
149
|
-
}
|
|
150
|
-
get self() {
|
|
151
|
-
return this.api.self;
|
|
152
|
-
}
|
|
153
|
-
get top() {
|
|
154
|
-
return this.api.top;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
168
|
class DOMUtilsEvent {
|
|
159
169
|
windowApi;
|
|
160
170
|
constructor(windowApiOption) {
|
|
@@ -967,7 +977,7 @@ define((function () { 'use strict';
|
|
|
967
977
|
super(option);
|
|
968
978
|
}
|
|
969
979
|
/** 版本号 */
|
|
970
|
-
version = "2024.
|
|
980
|
+
version = "2024.11.6";
|
|
971
981
|
attr(element, attrName, attrValue) {
|
|
972
982
|
let DOMUtilsContext = this;
|
|
973
983
|
if (typeof element === "string") {
|