@vtj/utils 0.7.13 → 0.7.15
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/index.cjs +5 -5
- package/dist/index.iife.js +9 -9
- package/dist/index.mjs +25 -17
- package/dist/index.umd.js +9 -9
- package/package.json +4 -4
- package/types/util.d.ts +6 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ export * from "@vtj/base";
|
|
|
4
4
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
5
5
|
* @name @vtj/utils
|
|
6
6
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
7
|
-
* @version 0.7.
|
|
7
|
+
* @version 0.7.15
|
|
8
8
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
9
9
|
*/
|
|
10
|
-
const Gn = "0.7.
|
|
10
|
+
const Gn = "0.7.15";
|
|
11
11
|
function _e(e, t) {
|
|
12
12
|
return function() {
|
|
13
13
|
return e.apply(t, arguments);
|
|
@@ -1656,7 +1656,14 @@ function Xn(e) {
|
|
|
1656
1656
|
t[n] = xn(r);
|
|
1657
1657
|
return t;
|
|
1658
1658
|
}
|
|
1659
|
-
const F = typeof window < "u", Qn = (e) =>
|
|
1659
|
+
const F = typeof window < "u", Qn = (e) => new Promise((t, n) => {
|
|
1660
|
+
const r = new FileReader();
|
|
1661
|
+
r.readAsDataURL(e), r.onload = () => {
|
|
1662
|
+
t(r.result);
|
|
1663
|
+
}, r.onerror = (s) => {
|
|
1664
|
+
n(s);
|
|
1665
|
+
};
|
|
1666
|
+
}), Yn = (e) => F ? window.requestAnimationFrame(e) : setTimeout(e, 16), Zn = (e) => F ? window.cancelAnimationFrame(e) : clearTimeout(e);
|
|
1660
1667
|
class Cn {
|
|
1661
1668
|
options = {
|
|
1662
1669
|
type: "cache",
|
|
@@ -1706,7 +1713,7 @@ class Cn {
|
|
|
1706
1713
|
r === this.caches ? this.caches = {} : r.clear();
|
|
1707
1714
|
}
|
|
1708
1715
|
}
|
|
1709
|
-
const
|
|
1716
|
+
const er = new Cn();
|
|
1710
1717
|
var _n = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1711
1718
|
function Ge(e) {
|
|
1712
1719
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -1797,7 +1804,7 @@ function Qe(e, t) {
|
|
|
1797
1804
|
const n = e.split("?")[0], r = se(e), s = Object.assign({}, r, t), o = Xe(s);
|
|
1798
1805
|
return o ? [n, o].join("?") : e;
|
|
1799
1806
|
}
|
|
1800
|
-
const
|
|
1807
|
+
const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1801
1808
|
__proto__: null,
|
|
1802
1809
|
append: Qe,
|
|
1803
1810
|
getCurrentHost: Nn,
|
|
@@ -1805,7 +1812,7 @@ const er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1805
1812
|
parse: se,
|
|
1806
1813
|
stringify: Xe
|
|
1807
1814
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1808
|
-
async function
|
|
1815
|
+
async function nr(e, t = {}) {
|
|
1809
1816
|
const { query: n = {} } = t;
|
|
1810
1817
|
e.includes("${") && (e = Ce(e)(n || {}));
|
|
1811
1818
|
const r = Qe(e, n);
|
|
@@ -1835,7 +1842,7 @@ function Dn(e, t) {
|
|
|
1835
1842
|
};
|
|
1836
1843
|
}
|
|
1837
1844
|
const Un = /* @__PURE__ */ Ge(Fn);
|
|
1838
|
-
function
|
|
1845
|
+
function rr(e, t = {}) {
|
|
1839
1846
|
return new Promise((n, r) => {
|
|
1840
1847
|
const { library: s } = t;
|
|
1841
1848
|
Un(e, t, (o, i) => {
|
|
@@ -1908,7 +1915,7 @@ class qn {
|
|
|
1908
1915
|
function Mn(e) {
|
|
1909
1916
|
return new qn(e);
|
|
1910
1917
|
}
|
|
1911
|
-
const
|
|
1918
|
+
const sr = Mn({ level: "log", bizName: "VTJ" });
|
|
1912
1919
|
/*! js-cookie v3.0.5 | MIT */
|
|
1913
1920
|
function U(e) {
|
|
1914
1921
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -1989,7 +1996,7 @@ function Wn(e) {
|
|
|
1989
1996
|
function $n(e, t) {
|
|
1990
1997
|
de.remove(e, t);
|
|
1991
1998
|
}
|
|
1992
|
-
const
|
|
1999
|
+
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1993
2000
|
__proto__: null,
|
|
1994
2001
|
get: Wn,
|
|
1995
2002
|
remove: $n,
|
|
@@ -2002,18 +2009,19 @@ export {
|
|
|
2002
2009
|
Cn as Storage,
|
|
2003
2010
|
Gn as VTJ_UTILS_VERSION,
|
|
2004
2011
|
b as axios,
|
|
2005
|
-
|
|
2006
|
-
|
|
2012
|
+
Zn as cAF,
|
|
2013
|
+
or as cookie,
|
|
2007
2014
|
xn as createApi,
|
|
2008
2015
|
Xn as createApis,
|
|
2009
2016
|
An as createRequest,
|
|
2017
|
+
Qn as fileToBase64,
|
|
2010
2018
|
Mn as getLogger,
|
|
2011
2019
|
F as isClient,
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2020
|
+
nr as jsonp,
|
|
2021
|
+
rr as loadScript,
|
|
2022
|
+
sr as logger,
|
|
2023
|
+
Yn as rAF,
|
|
2016
2024
|
Tn as request,
|
|
2017
|
-
|
|
2018
|
-
|
|
2025
|
+
er as storage,
|
|
2026
|
+
tr as url
|
|
2019
2027
|
};
|