ono-react-element 0.0.4 → 0.0.6
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/dist/es/{AutoSliderList-DqaQhmce.js → AutoSliderList-DN4Sec6L.js} +2 -2
- package/dist/es/{InjunctiveBox-CmZg4sIq.js → InjunctiveBox-CGpy0PxH.js} +1 -1
- package/dist/es/{Input-wORRaL9-.js → Input-DoY3kR7J.js} +1 -1
- package/dist/es/{Message-BMimz-k2.js → Message-TfweOOpK.js} +1 -1
- package/dist/es/{Modal-BAJOEXRd.js → Modal-CHgTYu-I.js} +1 -1
- package/dist/es/{Switch-hGQGZVO2.js → Switch-DwDBR0sG.js} +1 -1
- package/dist/es/{TemplateDialog-DuURiDPX.js → TemplateDialog-SXrElzoR.js} +6 -6
- package/dist/es/{Toast-CkC8zQdq.js → Toast-C7ybVNyd.js} +1 -1
- package/dist/es/{Tooltip-C_gPojr9.js → Tooltip-BtzG0TSW.js} +1 -1
- package/dist/es/{VirtualList-D8M5JJ-W.js → VirtualList-OG7kqLe0.js} +1 -1
- package/dist/es/{Waterfall-BXE2_5Sj.js → Waterfall-GHdJxww4.js} +1 -1
- package/dist/es/{hooks-Bj-aT2k8.js → hooks-CQN6qu4t.js} +5 -5
- package/dist/es/index.js +132 -124
- package/dist/es/{utils-ziqvBIOU.js → utils-BLV_TQU3.js} +138 -120
- package/dist/types/index.d.ts +3 -3
- package/dist/umd/index.umd.cjs +52 -52
- package/package.json +2 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
const
|
|
1
|
+
import { p as R } from "./PortalRenderer-8Iur-eZp.js";
|
|
2
|
+
const E = (t, n) => {
|
|
3
3
|
const e = document.createElement("style");
|
|
4
4
|
e.setAttribute("type", "text/css"), e.setAttribute("data-style-tag", n), e.textContent = t, document.head.appendChild(e);
|
|
5
5
|
}, U = (t) => {
|
|
6
6
|
document.head.querySelectorAll("style").forEach(
|
|
7
7
|
(e) => e.getAttribute("data-style-tag") === t && e.remove()
|
|
8
8
|
);
|
|
9
|
-
},
|
|
9
|
+
}, L = (t) => {
|
|
10
10
|
const n = "ono-view-transition-clip-path-circle", { element: e, duration: s = 300, themeRules: r, onChangeTheme: o } = t, i = r != null && r() || document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
11
11
|
if (!document.startViewTransition)
|
|
12
12
|
return o(i === "dark" ? "light" : "dark");
|
|
13
13
|
const a = document.startViewTransition(() => {
|
|
14
|
-
const
|
|
15
|
-
o(
|
|
16
|
-
}), { top: l, left: u, width: c, height: g } = e.getBoundingClientRect(),
|
|
17
|
-
Math.max(
|
|
14
|
+
const j = document.documentElement.classList.contains("dark");
|
|
15
|
+
o(j ? "light" : "dark");
|
|
16
|
+
}), { top: l, left: u, width: c, height: g } = e.getBoundingClientRect(), d = u + c / 2, f = l + g / 2, F = Math.hypot(
|
|
17
|
+
Math.max(d, window.innerWidth - d),
|
|
18
18
|
Math.max(f, window.innerHeight - f)
|
|
19
19
|
), S = [
|
|
20
|
-
`circle(0% at ${
|
|
21
|
-
`circle(${
|
|
20
|
+
`circle(0% at ${d}px ${f}px)`,
|
|
21
|
+
`circle(${F}px at ${d}px ${f}px)`
|
|
22
22
|
];
|
|
23
|
-
|
|
23
|
+
E(
|
|
24
24
|
`
|
|
25
25
|
::view-transition-old(root),
|
|
26
26
|
::view-transition-new(root) {
|
|
@@ -55,9 +55,9 @@ const L = (t, n) => {
|
|
|
55
55
|
}
|
|
56
56
|
), setTimeout(() => U(n), s + 100);
|
|
57
57
|
});
|
|
58
|
-
},
|
|
59
|
-
changeThemeClipPathCircle:
|
|
60
|
-
},
|
|
58
|
+
}, xt = {
|
|
59
|
+
changeThemeClipPathCircle: L
|
|
60
|
+
}, Mt = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])[\da-zA-Z]{8,}$/, x = (t) => t <= 11 ? Math.random().toString(36).substring(2, 2 + t).padEnd(t, "0") : x(11) + x(t - 11), z = ({
|
|
61
61
|
el: t,
|
|
62
62
|
str: n = "hello world",
|
|
63
63
|
speed: e = 100,
|
|
@@ -95,7 +95,7 @@ const L = (t, n) => {
|
|
|
95
95
|
}
|
|
96
96
|
}, H = (t, n) => {
|
|
97
97
|
t.toString().startsWith("2") ? n.onSuccess && n.onSuccess() : t.toString().startsWith("4") || t.toString().startsWith("5") ? n.onFail && n.onFail() : console.log("未知状态码");
|
|
98
|
-
},
|
|
98
|
+
}, yt = (t) => {
|
|
99
99
|
const n = t.getBoundingClientRect();
|
|
100
100
|
return { x: n.left + n.width / 2, y: n.top + n.height / 2 };
|
|
101
101
|
}, K = (t, n, e) => {
|
|
@@ -104,11 +104,11 @@ const L = (t, n) => {
|
|
|
104
104
|
}, q = (t) => {
|
|
105
105
|
const n = Math.floor(t / 3600), e = Math.floor(t % 3600 / 60), s = Math.floor(t % 60), r = (o) => o.toString().padStart(2, "0");
|
|
106
106
|
return (n > 0 ? `${r(n)}:${r(e)}:${r(s)}` : `${r(e)}:${r(s)}`) + (t < 10 ? ".00" : t < 100 ? ".0" : "");
|
|
107
|
-
},
|
|
107
|
+
}, M = (t) => {
|
|
108
108
|
if (t.length < 2) return t;
|
|
109
109
|
const n = t[0], e = t.slice(1).filter((r) => r <= n), s = t.slice(1).filter((r) => r > n);
|
|
110
|
-
return [...
|
|
111
|
-
},
|
|
110
|
+
return [...M(e), n, ...M(s)];
|
|
111
|
+
}, V = (t, n) => {
|
|
112
112
|
const e = ["B", "KB", "MB", "GB", "TB"];
|
|
113
113
|
let r = e.indexOf((n == null ? void 0 : n.unit) ?? "B");
|
|
114
114
|
if (r === -1)
|
|
@@ -119,16 +119,20 @@ const L = (t, n) => {
|
|
|
119
119
|
return `${(t / Math.pow(1024, r)).toFixed(
|
|
120
120
|
(n == null ? void 0 : n.decimalPlaces) ?? 0
|
|
121
121
|
)} ${e[r]}`;
|
|
122
|
-
},
|
|
123
|
-
const e = Math.floor(t /
|
|
122
|
+
}, J = (t, n) => {
|
|
123
|
+
const e = Math.floor(t / A(t, n)), s = Math.floor(n / A(t, n));
|
|
124
124
|
return `${e}:${s}`;
|
|
125
|
-
},
|
|
125
|
+
}, A = (t, n) => {
|
|
126
126
|
for (; n !== 0; ) {
|
|
127
127
|
const e = n;
|
|
128
128
|
n = t % n, t = e;
|
|
129
129
|
}
|
|
130
130
|
return t;
|
|
131
|
-
},
|
|
131
|
+
}, $t = (t, n, e) => {
|
|
132
|
+
t.muted = !0, t.play();
|
|
133
|
+
const s = new AudioContext(), r = s.state === "running";
|
|
134
|
+
s.close(), r ? (t.muted = !1, n == null || n()) : e == null || e();
|
|
135
|
+
}, Z = (t) => new URLSearchParams(window.location.search).get(t), G = (t) => {
|
|
132
136
|
let n;
|
|
133
137
|
const e = new Proxy(t, {
|
|
134
138
|
construct(s, r) {
|
|
@@ -136,49 +140,57 @@ const L = (t, n) => {
|
|
|
136
140
|
}
|
|
137
141
|
});
|
|
138
142
|
return e.prototype.construct = e, e;
|
|
139
|
-
},
|
|
143
|
+
}, Q = (t) => typeof t != "string" || t.length === 0 ? "" : t.charAt(0).toUpperCase() + t.slice(1), I = (t) => {
|
|
140
144
|
if (typeof t != "object" || t === null) return t;
|
|
141
145
|
const n = Array.isArray(t) ? [] : {};
|
|
142
146
|
for (const e in t)
|
|
143
|
-
Object.prototype.hasOwnProperty.call(t, e) && (n[e] =
|
|
147
|
+
Object.prototype.hasOwnProperty.call(t, e) && (n[e] = I(
|
|
144
148
|
t[e]
|
|
145
149
|
));
|
|
146
150
|
return n;
|
|
147
|
-
},
|
|
151
|
+
}, _ = (t) => new Promise((n) => {
|
|
148
152
|
const e = new Image();
|
|
149
153
|
e.src = typeof t == "string" ? t : URL.createObjectURL(t), e.onload = () => n({ width: e.width, height: e.height });
|
|
150
|
-
}),
|
|
154
|
+
}), St = (t) => {
|
|
155
|
+
if (typeof t != "number" || isNaN(t))
|
|
156
|
+
throw new Error("请输入有效的数字");
|
|
157
|
+
const n = t.toString().split(".");
|
|
158
|
+
return n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), n.join(".");
|
|
159
|
+
}, At = (t) => parseFloat(t.replace(/[^0-9.]/g, "")), X = (t, n, e, s) => Math.sqrt((t - e) ** 2 + (n - s) ** 2), tt = (t) => navigator.clipboard.writeText(t), It = (t, n, e) => 0.2126 * t + 0.7152 * n + 0.0722 * e, Tt = (t) => {
|
|
160
|
+
const n = {};
|
|
161
|
+
return t.replace(/([^?=&]+)=([^&]+)/g, (e, s, r) => n[s] = r), n;
|
|
162
|
+
}, Ct = (t, ...n) => Object.fromEntries(Object.entries(t).filter(([e]) => n.includes(e))), T = (t) => {
|
|
151
163
|
if (!t) return "";
|
|
152
164
|
const n = t.lastIndexOf(".");
|
|
153
|
-
return n === -1 ?
|
|
165
|
+
return n === -1 ? T(t.substring(t.lastIndexOf("/") + 1)) : t.substring(0, n);
|
|
154
166
|
}, et = (t) => {
|
|
155
167
|
if (!t) return "";
|
|
156
168
|
const n = t.lastIndexOf(".");
|
|
157
169
|
return t.substring(n + 1);
|
|
158
|
-
},
|
|
159
|
-
randomString:
|
|
170
|
+
}, kt = {
|
|
171
|
+
randomString: x,
|
|
160
172
|
printStr: z,
|
|
161
173
|
downloadFile: W,
|
|
162
174
|
createIntersectionObserver: K,
|
|
163
175
|
checkDeviceIsMobile: Y,
|
|
164
176
|
checkStatusCode: H,
|
|
165
177
|
formatSecondes: q,
|
|
166
|
-
quickSort:
|
|
167
|
-
formatFileSize:
|
|
168
|
-
calculateAspectRatio:
|
|
169
|
-
getURLSearchParams:
|
|
170
|
-
singleton:
|
|
171
|
-
safeCapitalizeWord:
|
|
172
|
-
deepCopy:
|
|
173
|
-
getImageSIze:
|
|
174
|
-
getPointDistance:
|
|
178
|
+
quickSort: M,
|
|
179
|
+
formatFileSize: V,
|
|
180
|
+
calculateAspectRatio: J,
|
|
181
|
+
getURLSearchParams: Z,
|
|
182
|
+
singleton: G,
|
|
183
|
+
safeCapitalizeWord: Q,
|
|
184
|
+
deepCopy: I,
|
|
185
|
+
getImageSIze: _,
|
|
186
|
+
getPointDistance: X,
|
|
175
187
|
copy2Clipboard: tt,
|
|
176
|
-
getFileName:
|
|
188
|
+
getFileName: T,
|
|
177
189
|
getFileSuffix: et
|
|
178
190
|
};
|
|
179
|
-
let
|
|
180
|
-
const h = [],
|
|
181
|
-
id: `${e}-${
|
|
191
|
+
let y = 1;
|
|
192
|
+
const h = [], Nt = (t, n, e) => (h.length === 0 && (y = 1), nt(n.instancesKey || "", t, {
|
|
193
|
+
id: `${e}-${y++}`,
|
|
182
194
|
key: n.instancesKey || "",
|
|
183
195
|
reactNode: t,
|
|
184
196
|
props: n,
|
|
@@ -187,23 +199,23 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
187
199
|
height: 0,
|
|
188
200
|
bottomOffset: 0
|
|
189
201
|
}
|
|
190
|
-
}), h),
|
|
202
|
+
}), h), vt = (t) => {
|
|
191
203
|
const n = h.findIndex((e) => e.id === t);
|
|
192
204
|
n !== -1 && h.splice(n, 1);
|
|
193
|
-
},
|
|
205
|
+
}, Ot = (t, n) => {
|
|
194
206
|
const e = h.findIndex((s) => s.id === t);
|
|
195
207
|
e < 0 || (h[e].offsetOptions = n);
|
|
196
|
-
},
|
|
208
|
+
}, Bt = (t) => {
|
|
197
209
|
const n = h.findIndex((e) => e.id === t);
|
|
198
210
|
return n <= 0 ? 0 : h[n - 1].offsetOptions.topOffset;
|
|
199
|
-
},
|
|
211
|
+
}, Dt = (t) => {
|
|
200
212
|
const n = h.findIndex((e) => e.id === t);
|
|
201
213
|
return n <= 0 ? 0 : h[n - 1].offsetOptions.bottomOffset;
|
|
202
214
|
}, nt = (t, n, e) => {
|
|
203
|
-
const s = (i) =>
|
|
215
|
+
const s = (i) => R(
|
|
204
216
|
n,
|
|
205
217
|
{
|
|
206
|
-
zIndex: 999 +
|
|
218
|
+
zIndex: 999 + y - 1,
|
|
207
219
|
...i.props,
|
|
208
220
|
id: i.id
|
|
209
221
|
},
|
|
@@ -241,7 +253,7 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
241
253
|
destroy: i
|
|
242
254
|
});
|
|
243
255
|
}
|
|
244
|
-
},
|
|
256
|
+
}, Pt = (t) => {
|
|
245
257
|
var n;
|
|
246
258
|
return t ? (n = h.find((e) => e.key === t)) == null ? void 0 : n.props : null;
|
|
247
259
|
}, m = /\d+/g, rt = () => "#" + Math.random().toString(16).slice(2, 8).padEnd(6, "0"), p = (t) => {
|
|
@@ -260,7 +272,7 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
260
272
|
return r(o);
|
|
261
273
|
}
|
|
262
274
|
return r(n);
|
|
263
|
-
},
|
|
275
|
+
}, $ = (t) => {
|
|
264
276
|
const n = t.split("#")[1], e = (s) => {
|
|
265
277
|
const r = parseInt(s.slice(0, 2), 16), o = parseInt(s.slice(2, 4), 16), i = parseInt(s.slice(4, 6), 16);
|
|
266
278
|
return [r, o, i];
|
|
@@ -300,15 +312,15 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
300
312
|
a /= 6;
|
|
301
313
|
}
|
|
302
314
|
return `hsl(${Math.round(a * 360)}, ${Math.round(l * 100)}%, ${Math.round(u * 100)}%)`;
|
|
303
|
-
},
|
|
315
|
+
}, C = (t) => {
|
|
304
316
|
const n = t.match(m), e = Number(n[0]) / 360, s = Number(n[1]) / 100, r = Number(n[2]) / 100;
|
|
305
317
|
let o, i, a;
|
|
306
|
-
function l(g,
|
|
307
|
-
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 1 / 6 ? g + (
|
|
318
|
+
function l(g, d, f) {
|
|
319
|
+
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 1 / 6 ? g + (d - g) * 6 * f : f < 1 / 2 ? d : f < 2 / 3 ? g + (d - g) * (2 / 3 - f) * 6 : g;
|
|
308
320
|
}
|
|
309
321
|
let u = r < 0.5 ? r * (1 + s) : r + s - r * s, c = 2 * r - u;
|
|
310
322
|
return o = l(c, u, e + 1 / 3), i = l(c, u, e), a = l(c, u, e - 1 / 3), `rgb(${Math.round(o * 255)}, ${Math.round(i * 255)}, ${Math.round(a * 255)})`;
|
|
311
|
-
},
|
|
323
|
+
}, k = (t) => w($(t)), N = (t) => p(C(t)), v = (t) => {
|
|
312
324
|
const n = t.match(m);
|
|
313
325
|
let e = Number(n[0]) / 255, s = Number(n[1]) / 255, r = Number(n[2]) / 255;
|
|
314
326
|
const o = Math.max(e, s, r), i = Math.min(e, s, r);
|
|
@@ -333,42 +345,42 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
333
345
|
return `hsv(${a * 360}, ${l * 100}, ${u * 100})`;
|
|
334
346
|
}, O = (t) => {
|
|
335
347
|
const n = t.match(m);
|
|
336
|
-
let e = Number(n[0]) / 360, s = Number(n[1]) / 100, r = Number(n[2]) / 100, o, i, a, l, u, c, g,
|
|
348
|
+
let e = Number(n[0]) / 360, s = Number(n[1]) / 100, r = Number(n[2]) / 100, o, i, a, l, u, c, g, d;
|
|
337
349
|
if (e && s === 0)
|
|
338
350
|
o = i = a = r;
|
|
339
351
|
else
|
|
340
|
-
switch (e /= 60, l = Math.floor(e), u = e - l, c = r * (1 - s), g = r * (1 - s * u),
|
|
352
|
+
switch (e /= 60, l = Math.floor(e), u = e - l, c = r * (1 - s), g = r * (1 - s * u), d = r * (1 - s * (1 - u)), l) {
|
|
341
353
|
case 0:
|
|
342
|
-
o = r, i =
|
|
354
|
+
o = r, i = d, a = c;
|
|
343
355
|
break;
|
|
344
356
|
case 1:
|
|
345
357
|
o = g, i = r, a = c;
|
|
346
358
|
break;
|
|
347
359
|
case 2:
|
|
348
|
-
o = c, i = r, a =
|
|
360
|
+
o = c, i = r, a = d;
|
|
349
361
|
break;
|
|
350
362
|
case 3:
|
|
351
363
|
o = c, i = g, a = r;
|
|
352
364
|
break;
|
|
353
365
|
case 4:
|
|
354
|
-
o =
|
|
366
|
+
o = d, i = c, a = r;
|
|
355
367
|
break;
|
|
356
368
|
default:
|
|
357
369
|
o = r, i = c, a = g;
|
|
358
370
|
}
|
|
359
371
|
return `rgb(${Math.round(o * 255)}, ${Math.round(i * 255)}, ${Math.round(a * 255)})`;
|
|
360
|
-
}, ot = (t) =>
|
|
372
|
+
}, ot = (t) => v($(t)), it = (t) => p(O(t)), at = (t, n, e = "rgba") => {
|
|
361
373
|
const s = t.match(m);
|
|
362
374
|
let r = Number(s[0]) / 255, o = Number(s[1]) / 255, i = Number(s[2]) / 255;
|
|
363
375
|
return e === "rgba" ? `rgba(${r},${o},${i},${n})` : e === "rgb" ? t : e === "hex" ? p(t) : e === "hsl" ? w(`rgba(${r},${o},${i},${n})`) : `rgba(${r},${o},${i},${n})`;
|
|
364
376
|
}, ct = (t) => {
|
|
365
377
|
const n = /^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/, e = /^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/;
|
|
366
378
|
return !!(n.test(t) || e.test(t));
|
|
367
|
-
},
|
|
379
|
+
}, B = (t) => {
|
|
368
380
|
const n = /^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/, e = /^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/;
|
|
369
381
|
return n.test(t) ? "hex" : e.test(t) ? "rgb" : "unknown";
|
|
370
382
|
}, lt = (t, n, e) => {
|
|
371
|
-
const s =
|
|
383
|
+
const s = B(t);
|
|
372
384
|
if (s === "hex") {
|
|
373
385
|
const r = t.replace("#", ""), o = parseInt(r.slice(0, 2), 16), i = parseInt(r.slice(2, 4), 16), a = parseInt(r.slice(4, 6), 16);
|
|
374
386
|
if (n === "lighten") {
|
|
@@ -411,21 +423,21 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
411
423
|
return s(o);
|
|
412
424
|
}, gt = (t, n, e) => {
|
|
413
425
|
let s = [];
|
|
414
|
-
if (t.includes("#")) s =
|
|
426
|
+
if (t.includes("#")) s = k(t).match(m);
|
|
415
427
|
else if (t.includes("rgb")) s = w(t).match(m);
|
|
416
428
|
else if (t.includes("hsl")) s = t.match(m);
|
|
417
429
|
else throw new Error("颜色格式错误");
|
|
418
430
|
const r = () => n === "light" ? Number(s[2]) + e > 100 ? 100 : Number(s[2]) + e : Number(s[2]) - e < 0 ? 0 : Number(s[2]) - e;
|
|
419
|
-
return
|
|
431
|
+
return N(
|
|
420
432
|
`${s[0]}, ${s[1]}%, ${r()}%`
|
|
421
433
|
);
|
|
422
|
-
},
|
|
434
|
+
}, Ft = { randomColor: rt, rgb2hex: p, hex2rgb: $, rgb2rgba: st, rgb2hsl: w, hsl2rgb: C, hex2hsl: k, hsl2hex: N, rgb2hsv: v, hsv2rgb: O, hex2hsv: ot, hsv2hex: it, formatColor: at, getContrastColor: ht, adjustColor: lt, isValidColor: ct, getColorType: B, hex3To6: ut, adjustingColors: gt }, jt = (t) => {
|
|
423
435
|
const n = t.split(","), e = n[0].match(/:(.*?);/)[1], s = atob(n[1]);
|
|
424
436
|
let r = s.length;
|
|
425
437
|
const o = new Uint8Array(r);
|
|
426
438
|
for (; r--; ) o[r] = s.charCodeAt(r);
|
|
427
439
|
return new Blob([o], { type: e });
|
|
428
|
-
},
|
|
440
|
+
}, Rt = (t, n) => {
|
|
429
441
|
const e = t.split(","), s = e[0].match(/:(.*?);/u)[1], r = atob(e[1]);
|
|
430
442
|
let o = r.length, i = s.split("/")[1] === "jpeg" ? ".jpg" : "." + s.split("/")[1];
|
|
431
443
|
const a = new Uint8Array(o);
|
|
@@ -442,15 +454,15 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
442
454
|
const o = ((i = s.target) == null ? void 0 : i.result).split(",")[1];
|
|
443
455
|
n(o);
|
|
444
456
|
};
|
|
445
|
-
}),
|
|
457
|
+
}), dt = (t, n = "abc.jpg") => new File([t], n, { type: t.type }), Et = (t) => new Promise((n) => {
|
|
446
458
|
const e = new FileReader();
|
|
447
459
|
e.readAsDataURL(t), e.onload = (s) => {
|
|
448
460
|
var r;
|
|
449
461
|
return n((r = s.target) == null ? void 0 : r.result);
|
|
450
462
|
};
|
|
451
|
-
}),
|
|
463
|
+
}), Ut = (t) => t.slice(0, t.size, t.type), D = async (t) => await (await fetch(t)).blob(), Lt = async (t) => dt(await D(t)), zt = async (t) => await ft(await D(t)), b = (t) => t < 10 ? `0${t}` : `${t}`, P = (t) => t.toString().length > 13 ? new Date(Number(t.toString().substring(0, 13))) : t.toString().length === 13 ? new Date(t) : t.toString().length < 13 && t.toString().length > 10 ? new Date(Number((t.toString() + "000").substring(0, 13))) : t.toString().length === 10 ? new Date(t * 1e3) : new Date(
|
|
452
464
|
Number((t.toString() + "000000000000").substring(0, 13))
|
|
453
|
-
),
|
|
465
|
+
), bt = (t, n) => {
|
|
454
466
|
const e = {
|
|
455
467
|
en: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
456
468
|
cn: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]
|
|
@@ -488,23 +500,23 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
488
500
|
})[n][Number(t) - 1], pt = (t, n) => {
|
|
489
501
|
let e;
|
|
490
502
|
return n === "en" ? t === "01" || t === "21" || t === "31" ? e = Number(t) + "st" : t === "02" || t === "22" ? e = Number(t) + "nd" : t === "03" || t === "23" ? e = Number(t) + "rd" : e = Number(t) + "th" : t === "01" ? e = "一日" : t === "02" ? e = "二日" : t === "03" ? e = "三日" : t === "04" ? e = "四日" : t === "05" ? e = "五日" : t === "06" ? e = "六日" : t === "07" ? e = "七日" : t === "08" ? e = "八日" : t === "09" ? e = "九日" : t === "10" ? e = "十日" : t === "11" ? e = "十一日" : t === "12" ? e = "十二日" : t === "13" ? e = "十三日" : t === "14" ? e = "十四日" : t === "15" ? e = "十五日" : t === "16" ? e = "十六日" : t === "17" ? e = "十七日" : t === "18" ? e = "十八日" : t === "19" ? e = "十九日" : t === "20" ? e = "二十日" : t === "21" ? e = "二十一日" : t === "22" ? e = "二十二日" : t === "23" ? e = "二十三日" : t === "24" ? e = "二十四日" : t === "25" ? e = "二十五日" : t === "26" ? e = "二十六日" : t === "27" ? e = "二十七日" : t === "28" ? e = "二十八日" : t === "29" ? e = "二十九日" : t === "30" ? e = "三十日" : t === "31" && (e = "三十一日"), e ?? t;
|
|
491
|
-
},
|
|
492
|
-
const e = ["YY", "MM", "DD", "hh", "mm", "ss"], s = [], r =
|
|
493
|
-
s.push(r.getFullYear().toString()), s.push(
|
|
503
|
+
}, Yt = (t, n = "YY-MM-DD hh:mm:ss") => {
|
|
504
|
+
const e = ["YY", "MM", "DD", "hh", "mm", "ss"], s = [], r = P(t);
|
|
505
|
+
s.push(r.getFullYear().toString()), s.push(b(r.getMonth() + 1)), s.push(b(r.getDate())), s.push(b(r.getHours())), s.push(b(r.getMinutes())), s.push(b(r.getSeconds()));
|
|
494
506
|
for (let o in s) n = n.replace(e[o], s[o]);
|
|
495
507
|
return n;
|
|
496
|
-
},
|
|
497
|
-
const s = ["YY", "MM", "DD", "hh", "mm", "ss"], r = [], o =
|
|
498
|
-
r.push(
|
|
508
|
+
}, Wt = (t, n = "YY-MM-DD hh:mm:ss", e = "cn") => {
|
|
509
|
+
const s = ["YY", "MM", "DD", "hh", "mm", "ss"], r = [], o = P(t);
|
|
510
|
+
r.push(bt(o.getFullYear().toString(), e)), r.push(mt(b(o.getMonth() + 1), e)), r.push(pt(b(o.getDate()), e)), r.push(b(o.getHours())), r.push(b(o.getMinutes())), r.push(b(o.getSeconds()));
|
|
499
511
|
for (let i in r) n = n.replace(s[i], r[i]);
|
|
500
512
|
return n;
|
|
501
|
-
},
|
|
513
|
+
}, Ht = (t, n) => {
|
|
502
514
|
const e = ["DD", "hh", "mm", "ss"], s = [];
|
|
503
|
-
s.push(Math.floor(t / (3600 * 24))), s.push(
|
|
515
|
+
s.push(Math.floor(t / (3600 * 24))), s.push(b(Math.floor(t % (3600 * 24) / 3600))), s.push(b(Math.floor(t % 3600 / 60))), s.push(b(t % 60));
|
|
504
516
|
for (let r = 0; r < e.length; r++)
|
|
505
517
|
n = n.replace(e[r], s[r].toString());
|
|
506
518
|
return n;
|
|
507
|
-
},
|
|
519
|
+
}, Kt = (t, n) => {
|
|
508
520
|
const e = {
|
|
509
521
|
year: 31536e3,
|
|
510
522
|
month: 2592e3,
|
|
@@ -520,48 +532,54 @@ const h = [], St = (t, n, e) => (h.length === 0 && ($ = 1), nt(n.instancesKey ||
|
|
|
520
532
|
return Math.floor(t / e[n]);
|
|
521
533
|
};
|
|
522
534
|
export {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
535
|
+
q as A,
|
|
536
|
+
Yt as B,
|
|
537
|
+
yt as C,
|
|
538
|
+
T as D,
|
|
539
|
+
et as E,
|
|
540
|
+
_ as F,
|
|
541
|
+
X as G,
|
|
542
|
+
Z as H,
|
|
543
|
+
It as I,
|
|
544
|
+
Wt as J,
|
|
545
|
+
$t as K,
|
|
546
|
+
Tt as L,
|
|
547
|
+
Mt as M,
|
|
548
|
+
Ct as N,
|
|
549
|
+
z as O,
|
|
550
|
+
M as P,
|
|
551
|
+
x as Q,
|
|
552
|
+
Q as R,
|
|
553
|
+
Ht as S,
|
|
554
|
+
G as T,
|
|
555
|
+
zt as U,
|
|
556
|
+
D as V,
|
|
557
|
+
Lt as W,
|
|
558
|
+
xt as X,
|
|
559
|
+
Pt as a,
|
|
560
|
+
Ot as b,
|
|
561
|
+
Nt as c,
|
|
562
|
+
Dt as d,
|
|
563
|
+
vt as e,
|
|
546
564
|
gt as f,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
565
|
+
Bt as g,
|
|
566
|
+
St as h,
|
|
567
|
+
jt as i,
|
|
568
|
+
Rt as j,
|
|
569
|
+
ft as k,
|
|
570
|
+
dt as l,
|
|
571
|
+
J as m,
|
|
572
|
+
Y as n,
|
|
573
|
+
H as o,
|
|
574
|
+
At as p,
|
|
575
|
+
Ft as q,
|
|
576
|
+
kt as r,
|
|
577
|
+
Kt as s,
|
|
578
|
+
tt as t,
|
|
579
|
+
K as u,
|
|
580
|
+
I as v,
|
|
581
|
+
W as w,
|
|
582
|
+
Et as x,
|
|
583
|
+
Ut as y,
|
|
584
|
+
V as z
|
|
567
585
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AutoSliderList, AvatarCrop, AwaitList, Button, Card3D, Checkbox, createDataSource, Direction, EstimatedVirtualList, ImageItem, List, MenuButton, message, Modal, OnoInput, OnoSelect, OnoTextarea, Pagination, portalRenderer, Radio, RadioGroup, SvgImg, Switch, TemplateDialog, toast, Tooltip, Waterfall } from './components';
|
|
2
|
-
import { useClickOutSide, useCountdown, useEventListener, useGetElementSize, useKeyPress, useTheme,
|
|
2
|
+
import { ThemeType, useClickOutSide, useCountdown, useEventListener, useGetElementSize, useKeyPress, useTheme, useThemePro } from './hooks';
|
|
3
3
|
import { default as colorUtils, adjustingColors } from './utils/colorUtils';
|
|
4
|
-
import { default as common, calculateAspectRatio, checkDeviceIsMobile, checkStatusCode, copy2Clipboard, createIntersectionObserver, deepCopy, downloadFile, formatFileSize, formatSecondes, getFileName, getFileSuffix, getImageSIze, getPointDistance, getURLSearchParams, printStr, quickSort, randomString, safeCapitalizeWord, singleton } from './utils/common';
|
|
4
|
+
import { default as common, addCommasToNumber, calculateAspectRatio, checkDeviceIsMobile, checkStatusCode, copy2Clipboard, createIntersectionObserver, deepCopy, downloadFile, formatFileSize, formatSecondes, getElementCenterPosition, getFileName, getFileSuffix, getImageSIze, getPointDistance, getURLSearchParams, grayColor, mediaAutoplayPolicies, parseQuery, passwordStrength, pick, printStr, pureNumber, quickSort, randomString, safeCapitalizeWord, singleton } from './utils/common';
|
|
5
5
|
import { base64ToBlob, base64ToFile, blobToBase64, blobToFile, fileToBase64, fileToBlob, urlToBase64, urlToBlob, urlToFile } from './utils/fileFormatConversion';
|
|
6
6
|
import { convertSecondToOtherTime, formatTime, localFormat, second2Day } from './utils/formatTimeUtils';
|
|
7
|
-
export { adjustingColors, AutoSliderList, AvatarCrop, AwaitList, base64ToBlob, base64ToFile, blobToBase64, blobToFile, Button, calculateAspectRatio, Card3D, Checkbox, checkDeviceIsMobile, checkStatusCode, colorUtils, common, convertSecondToOtherTime, copy2Clipboard, createDataSource, createIntersectionObserver, deepCopy, Direction, downloadFile, EstimatedVirtualList, fileToBase64, fileToBlob, formatFileSize, formatSecondes, formatTime, getFileName, getFileSuffix, getImageSIze, getPointDistance, getURLSearchParams, List, localFormat, MenuButton, message, Modal, OnoInput, OnoSelect, OnoTextarea, Pagination, portalRenderer, printStr, quickSort, Radio, RadioGroup, randomString, safeCapitalizeWord, second2Day, singleton, SvgImg, Switch, TemplateDialog, toast, Tooltip, urlToBase64, urlToBlob, urlToFile, useClickOutSide, useCountdown, useEventListener, useGetElementSize, useKeyPress, useTheme, useThemePro, Waterfall };
|
|
7
|
+
export { addCommasToNumber, adjustingColors, AutoSliderList, AvatarCrop, AwaitList, base64ToBlob, base64ToFile, blobToBase64, blobToFile, Button, calculateAspectRatio, Card3D, Checkbox, checkDeviceIsMobile, checkStatusCode, colorUtils, common, convertSecondToOtherTime, copy2Clipboard, createDataSource, createIntersectionObserver, deepCopy, Direction, downloadFile, EstimatedVirtualList, fileToBase64, fileToBlob, formatFileSize, formatSecondes, formatTime, getElementCenterPosition, getFileName, getFileSuffix, getImageSIze, getPointDistance, getURLSearchParams, grayColor, List, localFormat, mediaAutoplayPolicies, MenuButton, message, Modal, OnoInput, OnoSelect, OnoTextarea, Pagination, parseQuery, passwordStrength, pick, portalRenderer, printStr, pureNumber, quickSort, Radio, RadioGroup, randomString, safeCapitalizeWord, second2Day, singleton, SvgImg, Switch, TemplateDialog, toast, Tooltip, urlToBase64, urlToBlob, urlToFile, useClickOutSide, useCountdown, useEventListener, useGetElementSize, useKeyPress, useTheme, useThemePro, Waterfall };
|
|
8
8
|
export type { ImageItem, ThemeType };
|