@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.umd.js
CHANGED
|
@@ -4,12 +4,56 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DOMUtils = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
+
class WindowApi {
|
|
8
|
+
/** 默认的配置 */
|
|
9
|
+
defaultApi = {
|
|
10
|
+
document: document,
|
|
11
|
+
window: window,
|
|
12
|
+
globalThis: globalThis,
|
|
13
|
+
self: self,
|
|
14
|
+
top: top,
|
|
15
|
+
};
|
|
16
|
+
/** 使用的配置 */
|
|
17
|
+
api;
|
|
18
|
+
constructor(option) {
|
|
19
|
+
if (option) {
|
|
20
|
+
if (option.globalThis == null) {
|
|
21
|
+
option.globalThis = option.window;
|
|
22
|
+
}
|
|
23
|
+
if (option.self == null) {
|
|
24
|
+
option.self = option.window;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!option) {
|
|
28
|
+
option = Object.assign({}, this.defaultApi);
|
|
29
|
+
}
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
this.api = Object.assign({}, option);
|
|
32
|
+
}
|
|
33
|
+
get document() {
|
|
34
|
+
return this.api.document;
|
|
35
|
+
}
|
|
36
|
+
get window() {
|
|
37
|
+
return this.api.window;
|
|
38
|
+
}
|
|
39
|
+
get globalThis() {
|
|
40
|
+
return this.api.globalThis;
|
|
41
|
+
}
|
|
42
|
+
get self() {
|
|
43
|
+
return this.api.self;
|
|
44
|
+
}
|
|
45
|
+
get top() {
|
|
46
|
+
return this.api.top;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
7
50
|
/** 通用工具类 */
|
|
8
51
|
const DOMUtilsCommonUtils = {
|
|
9
|
-
windowApi: {
|
|
10
|
-
window: window,
|
|
52
|
+
windowApi: new WindowApi({
|
|
11
53
|
document: document,
|
|
12
|
-
|
|
54
|
+
window: window,
|
|
55
|
+
top: top,
|
|
56
|
+
}),
|
|
13
57
|
/**
|
|
14
58
|
* 判断元素是否已显示或已连接
|
|
15
59
|
* @param element
|
|
@@ -115,7 +159,7 @@
|
|
|
115
159
|
|
|
116
160
|
/* 数据 */
|
|
117
161
|
const DOMUtilsData = {
|
|
118
|
-
/** .on
|
|
162
|
+
/** .on添加在元素存储的事件 */
|
|
119
163
|
SymbolEvents: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
|
|
120
164
|
};
|
|
121
165
|
|
|
@@ -125,40 +169,6 @@
|
|
|
125
169
|
},
|
|
126
170
|
};
|
|
127
171
|
|
|
128
|
-
class WindowApi {
|
|
129
|
-
/** 默认的配置 */
|
|
130
|
-
defaultApi = {
|
|
131
|
-
document: document,
|
|
132
|
-
window: window,
|
|
133
|
-
globalThis: globalThis,
|
|
134
|
-
self: self,
|
|
135
|
-
top: top,
|
|
136
|
-
};
|
|
137
|
-
/** 使用的配置 */
|
|
138
|
-
api;
|
|
139
|
-
constructor(option) {
|
|
140
|
-
if (!option) {
|
|
141
|
-
option = Object.assign({}, this.defaultApi);
|
|
142
|
-
}
|
|
143
|
-
this.api = Object.assign({}, option);
|
|
144
|
-
}
|
|
145
|
-
get document() {
|
|
146
|
-
return this.api.document;
|
|
147
|
-
}
|
|
148
|
-
get window() {
|
|
149
|
-
return this.api.window;
|
|
150
|
-
}
|
|
151
|
-
get globalThis() {
|
|
152
|
-
return this.api.globalThis;
|
|
153
|
-
}
|
|
154
|
-
get self() {
|
|
155
|
-
return this.api.self;
|
|
156
|
-
}
|
|
157
|
-
get top() {
|
|
158
|
-
return this.api.top;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
172
|
class DOMUtilsEvent {
|
|
163
173
|
windowApi;
|
|
164
174
|
constructor(windowApiOption) {
|
|
@@ -971,7 +981,7 @@
|
|
|
971
981
|
super(option);
|
|
972
982
|
}
|
|
973
983
|
/** 版本号 */
|
|
974
|
-
version = "2024.
|
|
984
|
+
version = "2024.11.6";
|
|
975
985
|
attr(element, attrName, attrValue) {
|
|
976
986
|
let DOMUtilsContext = this;
|
|
977
987
|
if (typeof element === "string") {
|