@unicom-cloud/utils 0.1.3 → 0.1.5
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/class-name/index.js +5 -6
- package/constant/keyboardCode.js +41 -40
- package/constant/platform.js +14 -16
- package/cookie/src/index.js +46 -46
- package/dayjs/index.js +15 -0
- package/decimal/decimal.js +56 -56
- package/event-emitter/index.js +14 -23
- package/file/fileToURL.js +8 -9
- package/file/saveAs.js +1 -1
- package/mock/MockWebSocket.js +67 -90
- package/mock/MockXMLHttpRequest.js +51 -61
- package/package.json +1 -1
- package/random/address.js +10 -10
- package/screenfull/index.js +43 -43
- package/snapdom/src/api/preCache.js +34 -24
- package/snapdom/src/api/snapdom.js +56 -56
- package/snapdom/src/core/cache.js +3 -2
- package/snapdom/src/core/capture.js +32 -32
- package/snapdom/src/core/clone.js +39 -38
- package/snapdom/src/core/prepare.js +10 -11
- package/snapdom/src/modules/background.js +45 -22
- package/snapdom/src/modules/fonts.js +148 -45
- package/snapdom/src/modules/images.js +7 -7
- package/snapdom/src/modules/pseudo.js +75 -45
- package/snapdom/src/modules/styles.js +7 -8
- package/snapdom/src/utils/helpers.js +56 -53
- package/tree/index.js +31 -32
- package/turbo-stream/src/encode.js +149 -152
- package/turbo-stream/src/shared.js +155 -173
|
@@ -1,154 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
throw TypeError(i);
|
|
4
|
-
};
|
|
5
|
-
var O = (i, t, e) => t in i ? P(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
6
|
-
var R = (i, t, e) => O(i, typeof t != "symbol" ? t + "" : t, e), N = (i, t, e) => t.has(i) || Y("Cannot " + e);
|
|
7
|
-
var s = (i, t, e) => (N(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), o = (i, t, e, n) => (N(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), x = (i, t, e) => (N(i, t, "access private method"), e);
|
|
8
|
-
const C = "A", g = "*", v = "J", j = "j", q = "b", V = "K", W = "V", k = "D", H = "E", J = "!", K = "false", Q = "k", X = "H", Z = "h", $ = "F", ee = "I", te = "L", se = "G", ie = "O", ne = "M", re = "NaN", oe = "i", ae = "z", ce = "null", he = "P", Re = "$", de = "R", _e = "<redacted>", Te = "@", ue = "r", Se = "S", fe = ":", ye = "s", Ae = "true", pe = "l", le = "g", Ee = "o", we = "C", Ie = "u", Ne = "U";
|
|
9
|
-
let b = !0;
|
|
1
|
+
const T = "A", u = "*", S = "J", f = "j", l = "b", y = "K", A = "V", p = "D", E = "E", w = "!", I = "false", N = "k", b = "H", L = "h", m = "F", B = "I", F = "L", U = "G", Y = "O", x = "M", D = "NaN", M = "i", P = "z", O = "null", z = "P", G = "$", C = "R", g = "<redacted>", v = "@", j = "r", q = "S", V = ":", W = "s", k = "true", H = "l", J = "g", K = "o", Q = "C", X = "u", Z = "U";
|
|
2
|
+
let a = !0;
|
|
10
3
|
try {
|
|
11
4
|
new File([], "");
|
|
12
5
|
} catch {
|
|
13
|
-
|
|
6
|
+
a = !1;
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
r(this, l, []);
|
|
8
|
+
class $ {
|
|
9
|
+
p = 0;
|
|
10
|
+
#t = [];
|
|
11
|
+
#e(e) {
|
|
12
|
+
this.p === 0 ? e() : this.#t.push(e);
|
|
21
13
|
}
|
|
22
14
|
add() {
|
|
23
15
|
this.p++;
|
|
24
16
|
}
|
|
25
17
|
done() {
|
|
26
18
|
if (--this.p === 0) {
|
|
27
|
-
let
|
|
28
|
-
for (; (
|
|
29
|
-
|
|
19
|
+
let e;
|
|
20
|
+
for (; (e = this.#t.shift()) !== void 0; )
|
|
21
|
+
e();
|
|
30
22
|
}
|
|
31
23
|
}
|
|
32
24
|
wait() {
|
|
33
|
-
return new Promise(
|
|
25
|
+
return new Promise(this.#e.bind(this));
|
|
34
26
|
}
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
class c {
|
|
29
|
+
promise;
|
|
30
|
+
resolve;
|
|
31
|
+
reject;
|
|
40
32
|
constructor() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
R(this, "reject");
|
|
44
|
-
this.promise = new Promise((t, e) => {
|
|
45
|
-
this.resolve = t, this.reject = e;
|
|
33
|
+
this.promise = new Promise((e, t) => {
|
|
34
|
+
this.resolve = e, this.reject = t;
|
|
46
35
|
});
|
|
47
36
|
}
|
|
48
37
|
}
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
class d {
|
|
39
|
+
iterable;
|
|
40
|
+
#t = new c();
|
|
41
|
+
#e = this.#t;
|
|
51
42
|
constructor() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
r(this, d, s(this, E));
|
|
55
|
-
this.iterable = (async function* () {
|
|
56
|
-
let t = s(this, E);
|
|
43
|
+
this.iterable = async function* () {
|
|
44
|
+
let e = this.#t;
|
|
57
45
|
for (; ; ) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
46
|
+
const t = await e.promise;
|
|
47
|
+
if (t.done)
|
|
60
48
|
return;
|
|
61
|
-
yield
|
|
49
|
+
yield t.value, e = t.next;
|
|
62
50
|
}
|
|
63
|
-
}
|
|
51
|
+
}.bind(this)();
|
|
64
52
|
}
|
|
65
53
|
resolve() {
|
|
66
|
-
|
|
54
|
+
this.#e.resolve({ done: !0 });
|
|
67
55
|
}
|
|
68
|
-
reject(
|
|
69
|
-
|
|
70
|
-
}),
|
|
56
|
+
reject(e) {
|
|
57
|
+
this.#e.promise.catch(() => {
|
|
58
|
+
}), this.#e.reject(e);
|
|
71
59
|
}
|
|
72
|
-
yield(
|
|
73
|
-
const
|
|
74
|
-
|
|
60
|
+
yield(e) {
|
|
61
|
+
const t = new c();
|
|
62
|
+
this.#e.resolve({
|
|
75
63
|
done: !1,
|
|
76
|
-
value:
|
|
77
|
-
next:
|
|
78
|
-
}),
|
|
64
|
+
value: e,
|
|
65
|
+
next: t
|
|
66
|
+
}), this.#e = t;
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
e.close();
|
|
91
|
-
} catch (n) {
|
|
92
|
-
e.error(n);
|
|
93
|
-
}
|
|
69
|
+
class ee extends d {
|
|
70
|
+
readable = new ReadableStream({
|
|
71
|
+
start: async (e) => {
|
|
72
|
+
try {
|
|
73
|
+
for await (const t of this.iterable)
|
|
74
|
+
e.enqueue(t);
|
|
75
|
+
e.close();
|
|
76
|
+
} catch (t) {
|
|
77
|
+
e.error(t);
|
|
94
78
|
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
r(this, a, {});
|
|
106
|
-
if (typeof e < "u") {
|
|
82
|
+
class h extends Blob {
|
|
83
|
+
promise;
|
|
84
|
+
#t;
|
|
85
|
+
#e;
|
|
86
|
+
#s = {};
|
|
87
|
+
constructor(e, t, s, o) {
|
|
88
|
+
if (super(), typeof e < "u") {
|
|
107
89
|
this.promise = e.promise;
|
|
108
|
-
let
|
|
109
|
-
typeof
|
|
110
|
-
let
|
|
111
|
-
typeof
|
|
90
|
+
let i = e.#s.start ?? 0;
|
|
91
|
+
typeof t < "u" && (i += t), this.#s.start = i;
|
|
92
|
+
let r = e.#s.end;
|
|
93
|
+
typeof s < "u" && (r = (e.#s.start ?? 0) + s), this.#s.end = r, this.#e = o ?? e?.type, this.#t = (r ?? e.size) - i;
|
|
112
94
|
}
|
|
113
95
|
}
|
|
114
96
|
get size() {
|
|
115
|
-
if (typeof
|
|
97
|
+
if (typeof this.#t > "u")
|
|
116
98
|
throw new Error("Size is not set");
|
|
117
|
-
return
|
|
99
|
+
return this.#t;
|
|
118
100
|
}
|
|
119
101
|
set size(e) {
|
|
120
|
-
|
|
102
|
+
this.#t = e;
|
|
121
103
|
}
|
|
122
104
|
get type() {
|
|
123
|
-
if (typeof
|
|
105
|
+
if (typeof this.#e > "u")
|
|
124
106
|
throw new Error("Type is not set");
|
|
125
|
-
return
|
|
107
|
+
return this.#e;
|
|
126
108
|
}
|
|
127
109
|
set type(e) {
|
|
128
|
-
|
|
110
|
+
this.#e = e;
|
|
129
111
|
}
|
|
130
112
|
async arrayBuffer() {
|
|
131
113
|
if (!this.promise)
|
|
132
114
|
throw new Error("Promise is not set");
|
|
133
115
|
const e = await this.promise;
|
|
134
|
-
return s
|
|
135
|
-
s
|
|
136
|
-
s
|
|
116
|
+
return this.#s ? e.slice(
|
|
117
|
+
this.#s.start,
|
|
118
|
+
this.#s.end
|
|
137
119
|
) : e;
|
|
138
120
|
}
|
|
139
121
|
bytes() {
|
|
140
122
|
return this.arrayBuffer().then((e) => new Uint8Array(e));
|
|
141
123
|
}
|
|
142
|
-
slice(e,
|
|
143
|
-
return new
|
|
124
|
+
slice(e, t, s) {
|
|
125
|
+
return new h(this, e, t, s);
|
|
144
126
|
}
|
|
145
127
|
stream() {
|
|
146
128
|
return new ReadableStream({
|
|
147
129
|
start: async (e) => {
|
|
148
130
|
try {
|
|
149
131
|
e.enqueue(await this.bytes()), e.close();
|
|
150
|
-
} catch (
|
|
151
|
-
e.error(
|
|
132
|
+
} catch (t) {
|
|
133
|
+
e.error(t);
|
|
152
134
|
}
|
|
153
135
|
}
|
|
154
136
|
});
|
|
@@ -156,76 +138,78 @@ const L = class L extends Blob {
|
|
|
156
138
|
text() {
|
|
157
139
|
return this.bytes().then((e) => new TextDecoder().decode(e));
|
|
158
140
|
}
|
|
159
|
-
}
|
|
160
|
-
_ =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
141
|
+
}
|
|
142
|
+
const _ = a ? File : Blob;
|
|
143
|
+
class R extends _ {
|
|
144
|
+
promise;
|
|
145
|
+
#t;
|
|
146
|
+
#e;
|
|
147
|
+
#s;
|
|
148
|
+
#r;
|
|
149
|
+
#i = {};
|
|
150
|
+
constructor(e, t, s, o) {
|
|
151
|
+
if (a ? super([], "") : super([]), typeof e < "u") {
|
|
168
152
|
this.promise = e.promise;
|
|
169
|
-
let
|
|
170
|
-
typeof
|
|
171
|
-
let
|
|
172
|
-
typeof
|
|
153
|
+
let i = e.#i.start ?? 0;
|
|
154
|
+
typeof t < "u" && (i += t), this.#i.start = i;
|
|
155
|
+
let r = e.#i.end;
|
|
156
|
+
typeof s < "u" && (r = (e.#i.start ?? 0) + s), this.#i.end = r, this.#e = o ?? e?.type, this.#s = e.name, this.#r = e.lastModified;
|
|
173
157
|
}
|
|
174
158
|
}
|
|
175
159
|
get name() {
|
|
176
|
-
if (typeof s
|
|
160
|
+
if (typeof this.#s > "u")
|
|
177
161
|
throw new Error("Name is not set");
|
|
178
|
-
return s
|
|
162
|
+
return this.#s;
|
|
179
163
|
}
|
|
180
164
|
set name(e) {
|
|
181
|
-
|
|
165
|
+
this.#s = e;
|
|
182
166
|
}
|
|
183
167
|
get lastModified() {
|
|
184
|
-
if (typeof
|
|
168
|
+
if (typeof this.#r > "u")
|
|
185
169
|
throw new Error("Last modified is not set");
|
|
186
|
-
return
|
|
170
|
+
return this.#r;
|
|
187
171
|
}
|
|
188
172
|
set lastModified(e) {
|
|
189
|
-
|
|
173
|
+
this.#r = e;
|
|
190
174
|
}
|
|
191
175
|
get size() {
|
|
192
|
-
if (typeof
|
|
176
|
+
if (typeof this.#t > "u")
|
|
193
177
|
throw new Error("Size is not set");
|
|
194
|
-
return
|
|
178
|
+
return this.#t;
|
|
195
179
|
}
|
|
196
180
|
set size(e) {
|
|
197
|
-
|
|
181
|
+
this.#t = e;
|
|
198
182
|
}
|
|
199
183
|
get type() {
|
|
200
|
-
if (typeof
|
|
184
|
+
if (typeof this.#e > "u")
|
|
201
185
|
throw new Error("Type is not set");
|
|
202
|
-
return
|
|
186
|
+
return this.#e;
|
|
203
187
|
}
|
|
204
188
|
set type(e) {
|
|
205
|
-
|
|
189
|
+
this.#e = e;
|
|
206
190
|
}
|
|
207
191
|
async arrayBuffer() {
|
|
208
192
|
if (!this.promise)
|
|
209
193
|
throw new Error("Promise is not set");
|
|
210
194
|
const e = await this.promise;
|
|
211
|
-
return
|
|
212
|
-
|
|
213
|
-
|
|
195
|
+
return this.#i ? e.slice(
|
|
196
|
+
this.#i.start,
|
|
197
|
+
this.#i.end
|
|
214
198
|
) : e;
|
|
215
199
|
}
|
|
216
200
|
bytes() {
|
|
217
201
|
return this.arrayBuffer().then((e) => new Uint8Array(e));
|
|
218
202
|
}
|
|
219
|
-
slice(e,
|
|
220
|
-
return new
|
|
203
|
+
slice(e, t, s) {
|
|
204
|
+
return new R(this, e, t, s);
|
|
221
205
|
}
|
|
222
206
|
stream() {
|
|
223
207
|
return new ReadableStream({
|
|
224
208
|
start: async (e) => {
|
|
225
209
|
try {
|
|
226
210
|
e.enqueue(await this.bytes()), e.close();
|
|
227
|
-
} catch (
|
|
228
|
-
e.error(
|
|
211
|
+
} catch (t) {
|
|
212
|
+
e.error(t);
|
|
229
213
|
}
|
|
230
214
|
}
|
|
231
215
|
});
|
|
@@ -233,55 +217,53 @@ const U = class U extends m {
|
|
|
233
217
|
text() {
|
|
234
218
|
return this.bytes().then((e) => new TextDecoder().decode(e));
|
|
235
219
|
}
|
|
236
|
-
}
|
|
237
|
-
p = new WeakMap(), u = new WeakMap(), S = new WeakMap(), f = new WeakMap(), c = new WeakMap();
|
|
238
|
-
let D = U;
|
|
220
|
+
}
|
|
239
221
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
222
|
+
c as Deferred,
|
|
223
|
+
d as DeferredAsyncIterable,
|
|
224
|
+
ee as DeferredReadableStream,
|
|
225
|
+
T as STR_ARRAY_BUFFER,
|
|
226
|
+
u as STR_ASYNC_ITERABLE,
|
|
227
|
+
l as STR_BIGINT,
|
|
228
|
+
S as STR_BIG_INT_64_ARRAY,
|
|
229
|
+
f as STR_BIG_UINT_64_ARRAY,
|
|
230
|
+
y as STR_BLOB,
|
|
231
|
+
A as STR_DATA_VIEW,
|
|
232
|
+
p as STR_DATE,
|
|
233
|
+
E as STR_ERROR,
|
|
234
|
+
w as STR_FAILURE,
|
|
235
|
+
I as STR_FALSE,
|
|
236
|
+
N as STR_FILE,
|
|
237
|
+
b as STR_FLOAT_32_ARRAY,
|
|
238
|
+
L as STR_FLOAT_64_ARRAY,
|
|
239
|
+
m as STR_FORM_DATA,
|
|
240
|
+
B as STR_INFINITY,
|
|
241
|
+
F as STR_INT_16_ARRAY,
|
|
242
|
+
U as STR_INT_32_ARRAY,
|
|
243
|
+
Y as STR_INT_8_ARRAY,
|
|
244
|
+
x as STR_MAP,
|
|
245
|
+
M as STR_NEGATIVE_INFINITY,
|
|
246
|
+
P as STR_NEGATIVE_ZERO,
|
|
247
|
+
O as STR_NULL,
|
|
248
|
+
D as STR_NaN,
|
|
249
|
+
z as STR_PLUGIN,
|
|
250
|
+
G as STR_PROMISE,
|
|
251
|
+
C as STR_READABLE_STREAM,
|
|
252
|
+
g as STR_REDACTED,
|
|
253
|
+
v as STR_REFERENCE_SYMBOL,
|
|
254
|
+
j as STR_REGEXP,
|
|
255
|
+
q as STR_SET,
|
|
256
|
+
V as STR_SUCCESS,
|
|
257
|
+
W as STR_SYMBOL,
|
|
258
|
+
k as STR_TRUE,
|
|
259
|
+
H as STR_UINT_16_ARRAY,
|
|
260
|
+
J as STR_UINT_32_ARRAY,
|
|
261
|
+
K as STR_UINT_8_ARRAY,
|
|
262
|
+
Q as STR_UINT_8_ARRAY_CLAMPED,
|
|
263
|
+
X as STR_UNDEFINED,
|
|
264
|
+
Z as STR_URL,
|
|
265
|
+
a as SUPPORTS_FILE,
|
|
266
|
+
h as TurboBlob,
|
|
267
|
+
R as TurboFile,
|
|
268
|
+
$ as WaitGroup
|
|
287
269
|
};
|