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