@vef-framework/shared 2.0.10 → 2.1.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/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/color/color-ops.cjs +1 -1
- package/dist/cjs/color/index.cjs +1 -1
- package/dist/cjs/color/name.cjs +1 -1
- package/dist/cjs/color/palette.cjs +1 -1
- package/dist/cjs/constants/color-names.cjs +1 -1
- package/dist/cjs/constants/color-palettes.cjs +1 -1
- package/dist/cjs/constants/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/types/color.cjs +0 -1
- package/dist/cjs/types/common.cjs +0 -1
- package/dist/cjs/types/deep-keys.cjs +0 -1
- package/dist/cjs/types/index.cjs +0 -1
- package/dist/cjs/utils/chrono.cjs +1 -1
- package/dist/cjs/utils/equal.cjs +1 -1
- package/dist/cjs/utils/error.cjs +2 -3
- package/dist/cjs/utils/event.cjs +1 -1
- package/dist/cjs/utils/format.cjs +1 -1
- package/dist/cjs/utils/function.cjs +1 -1
- package/dist/cjs/utils/id.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/key.cjs +1 -1
- package/dist/cjs/utils/lib.cjs +1 -1
- package/dist/cjs/utils/object.cjs +1 -1
- package/dist/cjs/utils/path.cjs +1 -1
- package/dist/cjs/utils/pinyin.cjs +1 -1
- package/dist/cjs/utils/security.cjs +1 -1
- package/dist/cjs/utils/string.cjs +1 -1
- package/dist/cjs/utils/table.cjs +1 -0
- package/dist/cjs/utils/task.cjs +1 -1
- package/dist/cjs/utils/tree.cjs +1 -1
- package/dist/cjs/utils/zod.cjs +1 -1
- package/dist/es/color/color-ops.js +55 -68
- package/dist/es/color/index.js +4 -18
- package/dist/es/color/name.js +25 -27
- package/dist/es/color/palette.js +70 -82
- package/dist/es/constants/color-names.js +1572 -1572
- package/dist/es/constants/color-palettes.js +1085 -360
- package/dist/es/constants/index.js +3 -8
- package/dist/es/index.js +25 -165
- package/dist/es/types/color.js +1 -1
- package/dist/es/types/common.js +1 -1
- package/dist/es/types/deep-keys.js +1 -1
- package/dist/es/types/index.js +1 -3
- package/dist/es/utils/chrono.js +77 -92
- package/dist/es/utils/equal.js +83 -118
- package/dist/es/utils/error.js +27 -29
- package/dist/es/utils/event.js +27 -51
- package/dist/es/utils/format.js +27 -18
- package/dist/es/utils/function.js +26 -36
- package/dist/es/utils/id.js +21 -21
- package/dist/es/utils/index.js +18 -79
- package/dist/es/utils/key.js +17 -23
- package/dist/es/utils/lib.js +8 -64
- package/dist/es/utils/object.js +12 -12
- package/dist/es/utils/path.js +37 -58
- package/dist/es/utils/pinyin.js +41 -43
- package/dist/es/utils/security.js +73 -31
- package/dist/es/utils/string.js +19 -7
- package/dist/es/utils/table.js +15 -0
- package/dist/es/utils/task.js +6 -7
- package/dist/es/utils/tree.js +159 -181
- package/dist/es/utils/zod.js +7 -7
- package/dist/types/constants/color-names.d.ts +2 -2
- package/dist/types/constants/color-palettes.d.ts +2 -2
- package/dist/types/src/color/color-ops.d.ts +84 -0
- package/dist/types/src/color/index.d.ts +3 -0
- package/dist/types/src/color/name.d.ts +7 -0
- package/dist/types/src/color/palette.d.ts +8 -0
- package/dist/types/src/constants/color-names.d.ts +11 -0
- package/dist/types/src/constants/color-palettes.d.ts +823 -0
- package/dist/types/src/constants/index.d.ts +2 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/types/color.d.ts +25 -0
- package/dist/types/src/types/common.d.ts +29 -0
- package/dist/types/src/types/deep-keys.d.ts +37 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/utils/chrono.d.ts +152 -0
- package/dist/types/src/utils/equal.d.ts +16 -0
- package/dist/types/src/utils/error.d.ts +22 -0
- package/dist/types/src/utils/event.d.ts +46 -0
- package/dist/types/src/utils/format.d.ts +31 -0
- package/dist/types/src/utils/function.d.ts +27 -0
- package/dist/types/src/utils/id.d.ts +6 -0
- package/dist/types/src/utils/index.d.ts +18 -0
- package/dist/types/src/utils/key.d.ts +5 -0
- package/dist/types/src/utils/lib.d.ts +5 -0
- package/dist/types/src/utils/object.d.ts +9 -0
- package/dist/types/src/utils/path.d.ts +13 -0
- package/dist/types/src/utils/pinyin.d.ts +40 -0
- package/dist/types/src/utils/security.d.ts +60 -0
- package/dist/types/src/utils/string.d.ts +15 -0
- package/dist/types/src/utils/table.d.ts +25 -0
- package/dist/types/src/utils/task.d.ts +4 -0
- package/dist/types/src/utils/tree.d.ts +216 -0
- package/dist/types/src/utils/zod.d.ts +2 -0
- package/dist/types/types/color.d.ts +1 -49
- package/dist/types/types/common.d.ts +7 -3
- package/dist/types/types/deep-keys.d.ts +28 -0
- package/dist/types/utils/chrono.d.ts +3 -13
- package/dist/types/utils/error.d.ts +5 -21
- package/dist/types/utils/event.d.ts +9 -31
- package/dist/types/utils/format.d.ts +0 -2
- package/dist/types/utils/function.d.ts +4 -36
- package/dist/types/utils/id.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/key.d.ts +2 -4
- package/dist/types/utils/path.d.ts +7 -70
- package/dist/types/utils/pinyin.d.ts +2 -3
- package/dist/types/utils/security.d.ts +44 -2
- package/dist/types/utils/string.d.ts +8 -0
- package/dist/types/utils/table.d.ts +25 -0
- package/dist/types/utils/task.d.ts +1 -3
- package/dist/types/utils/tree.d.ts +8 -0
- package/dist/types/utils/zod.d.ts +1 -0
- package/package.json +13 -13
package/dist/es/utils/pinyin.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { isString as e } from "./lib.js";
|
|
3
|
+
import t from "@pinyin-pro/data/modern";
|
|
4
|
+
import { addDict as n, pinyin as r } from "pinyin-pro";
|
|
5
|
+
//#region src/utils/pinyin.ts
|
|
6
|
+
n(t);
|
|
7
|
+
var i = {
|
|
8
|
+
type: "array",
|
|
9
|
+
toneType: "none",
|
|
10
|
+
multiple: !1,
|
|
11
|
+
nonZh: "consecutive",
|
|
12
|
+
surname: "head"
|
|
13
|
+
}, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
14
|
+
function s(e) {
|
|
15
|
+
let t = a.get(e);
|
|
16
|
+
if (t) return t;
|
|
17
|
+
let n = r(e, {
|
|
18
|
+
...i,
|
|
19
|
+
pattern: "pinyin"
|
|
20
|
+
});
|
|
21
|
+
return a.set(e, n), n;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
function c(e) {
|
|
24
|
+
let t = o.get(e);
|
|
25
|
+
if (t) return t;
|
|
26
|
+
let n = r(e, {
|
|
27
|
+
...i,
|
|
28
|
+
pattern: "first"
|
|
29
|
+
});
|
|
30
|
+
return o.set(e, n), n;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
function l(t, ...n) {
|
|
33
|
+
let r = { ...t };
|
|
34
|
+
for (let i of n) {
|
|
35
|
+
let n = t[i];
|
|
36
|
+
if (e(n)) {
|
|
37
|
+
let e = `${i}Pinyin`, t = `${i}PinyinInitials`;
|
|
38
|
+
r[e] = s(n).join(""), r[t] = c(n).join("");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return r;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
m as getPinyinInitials,
|
|
45
|
-
g as withPinyin
|
|
46
|
-
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { s as getPinyin, c as getPinyinInitials, l as withPinyin };
|
|
@@ -1,31 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
import "./lib.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { isNullish as e } from "./lib.js";
|
|
3
|
+
import t from "jsencrypt";
|
|
4
|
+
//#region src/utils/security.ts
|
|
5
|
+
var n = new Uint8Array([
|
|
6
|
+
90,
|
|
7
|
+
75,
|
|
8
|
+
60,
|
|
9
|
+
45,
|
|
10
|
+
30,
|
|
11
|
+
15,
|
|
12
|
+
154,
|
|
13
|
+
139,
|
|
14
|
+
124,
|
|
15
|
+
109,
|
|
16
|
+
94,
|
|
17
|
+
79,
|
|
18
|
+
58,
|
|
19
|
+
43,
|
|
20
|
+
28,
|
|
21
|
+
13
|
|
22
|
+
]);
|
|
23
|
+
function r(e) {
|
|
24
|
+
if (!e) return new Uint8Array();
|
|
25
|
+
let t = new TextEncoder().encode(e), r = new Uint8Array(t.length);
|
|
26
|
+
for (let [e, i] of t.entries()) r[e] = i ^ n[e % n.length];
|
|
27
|
+
return r;
|
|
28
|
+
}
|
|
29
|
+
function i(e) {
|
|
30
|
+
if (!e?.length) return "";
|
|
31
|
+
let t = e instanceof Uint8Array ? e : new Uint8Array(e), r = new Uint8Array(t.length);
|
|
32
|
+
for (let [e, i] of t.entries()) r[e] = i ^ n[e % n.length];
|
|
33
|
+
return new TextDecoder("utf-8").decode(r);
|
|
34
|
+
}
|
|
35
|
+
function a(e) {
|
|
36
|
+
return [...r(e)].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
37
|
+
}
|
|
38
|
+
function o(e) {
|
|
39
|
+
if (!e) return "";
|
|
40
|
+
let t = new Uint8Array(e.length / 2);
|
|
41
|
+
for (let n = 0; n < e.length; n += 2) t[n / 2] = Number.parseInt(e.slice(n, n + 2), 16);
|
|
42
|
+
return i(t);
|
|
43
|
+
}
|
|
44
|
+
function s(e) {
|
|
45
|
+
let t = r(e);
|
|
46
|
+
if (t.length === 0) return "";
|
|
47
|
+
let n = String.fromCodePoint(...t);
|
|
48
|
+
return btoa(n);
|
|
49
|
+
}
|
|
50
|
+
function c(e) {
|
|
51
|
+
if (!e) return "";
|
|
52
|
+
let t = atob(e), n = new Uint8Array(t.length);
|
|
53
|
+
for (let e = 0; e < t.length; e++) n[e] = t.codePointAt(e);
|
|
54
|
+
return i(n);
|
|
55
|
+
}
|
|
56
|
+
function l(n, r) {
|
|
57
|
+
if (e(n) || !r?.trim()) throw Error("Failed to encrypt data using RSA: invalid input");
|
|
58
|
+
let i = new t();
|
|
59
|
+
i.setPublicKey(r);
|
|
60
|
+
let a = i.encrypt(n);
|
|
61
|
+
if (!a) throw console.error("Failed to encrypt data using RSA"), Error("Failed to encrypt data using RSA");
|
|
62
|
+
return a;
|
|
63
|
+
}
|
|
64
|
+
function u(n, r) {
|
|
65
|
+
if (e(n) || !r?.trim()) throw Error("Failed to decrypt data using RSA: invalid input");
|
|
66
|
+
let i = new t();
|
|
67
|
+
i.setPrivateKey(r);
|
|
68
|
+
let a = i.decrypt(n);
|
|
69
|
+
if (!a) throw console.error("Failed to decrypt data using RSA"), Error("Failed to decrypt data using RSA");
|
|
70
|
+
return a;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { u as decryptUsingRSA, l as encryptUsingRSA, i as obfuscateDecode, c as obfuscateDecodeFromBase64, o as obfuscateDecodeFromHex, r as obfuscateEncode, s as obfuscateEncodeToBase64, a as obfuscateEncodeToHex };
|
package/dist/es/utils/string.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { snakeCase as e } from "./lib.js";
|
|
3
|
+
//#region src/utils/string.ts
|
|
4
|
+
function t(t) {
|
|
5
|
+
return e(t).toUpperCase();
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function n(e, t = !0) {
|
|
8
|
+
if (e === null) return t ? "" : "null";
|
|
9
|
+
if (e === void 0) return t ? "" : "undefined";
|
|
10
|
+
if (typeof e == "string") return e;
|
|
11
|
+
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return String(e);
|
|
12
|
+
if (typeof e == "symbol" || typeof e == "function") return e.toString();
|
|
13
|
+
try {
|
|
14
|
+
return JSON.stringify(e);
|
|
15
|
+
} catch {
|
|
16
|
+
return String(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as constantCase, n as stringify };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { isDeepEqual as e, isShallowEqual as t } from "./equal.js";
|
|
3
|
+
import { isPlainObject as n } from "./lib.js";
|
|
4
|
+
//#region src/utils/table.ts
|
|
5
|
+
var r = {
|
|
6
|
+
reference: (e, t) => e === t,
|
|
7
|
+
shallow: t,
|
|
8
|
+
deep: e
|
|
9
|
+
};
|
|
10
|
+
function i(e, ...t) {
|
|
11
|
+
let i = n(e) && "compare" in e, a = i ? e : {}, o = i ? t : [e, ...t], s = r[a.compare ?? "reference"];
|
|
12
|
+
return (e, t) => o.some((n) => !s(e?.[n], t?.[n]));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { i as shouldUpdateByKeys };
|
package/dist/es/utils/task.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
//#region src/utils/task.ts
|
|
3
|
+
function e(e) {
|
|
4
|
+
typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as scheduleMicrotask };
|
package/dist/es/utils/tree.js
CHANGED
|
@@ -1,189 +1,167 @@
|
|
|
1
|
-
|
|
2
|
-
import { isArray as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
a(x) && r(x, f, i + 1);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return r(s), e;
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { isArray as e, isFunction as t, isNullish as n } from "./lib.js";
|
|
3
|
+
//#region src/utils/tree.ts
|
|
4
|
+
function r(n, r = {}) {
|
|
5
|
+
let { childrenKey: i = "children", includeParent: a = !1, includeLevel: o = !1, transform: s, filter: c } = r, l = [];
|
|
6
|
+
function u(n, r, d = 0) {
|
|
7
|
+
if (e(n)) for (let f of n) {
|
|
8
|
+
let n = {
|
|
9
|
+
parent: r,
|
|
10
|
+
level: d
|
|
11
|
+
};
|
|
12
|
+
if (t(c) && !c(f, n)) {
|
|
13
|
+
let t = f[i];
|
|
14
|
+
e(t) && u(t, f, d + 1);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
let p = f;
|
|
18
|
+
if (t(s)) p = s(f, n);
|
|
19
|
+
else if (a || o) {
|
|
20
|
+
let e = { data: f };
|
|
21
|
+
a && (e.parent = r), o && (e.level = d), p = e;
|
|
22
|
+
}
|
|
23
|
+
l.push(p);
|
|
24
|
+
let m = f[i];
|
|
25
|
+
e(m) && u(m, f, d + 1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return u(n), l;
|
|
33
29
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
30
|
+
function i(e, n) {
|
|
31
|
+
return t(n) ? n(e) : e[n];
|
|
36
32
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
const u = n;
|
|
67
|
-
return r.map((i) => t(i));
|
|
68
|
-
}
|
|
69
|
-
return r;
|
|
33
|
+
function a(r, a = {}) {
|
|
34
|
+
let { idKey: o = "id", parentIdKey: s = "parentId", childrenKey: c = "children", rootValue: l, transform: u } = a;
|
|
35
|
+
if (!e(r) || r.length === 0) return [];
|
|
36
|
+
let d = /* @__PURE__ */ new Map(), f = [];
|
|
37
|
+
for (let e of r) {
|
|
38
|
+
let t = i(e, o);
|
|
39
|
+
d.set(t, { ...e });
|
|
40
|
+
}
|
|
41
|
+
for (let a of r) {
|
|
42
|
+
let r = i(a, o), u = i(a, s), p = d.get(r);
|
|
43
|
+
if (t(l) ? l(a) : u === l || n(u)) f.push(p);
|
|
44
|
+
else {
|
|
45
|
+
let t = d.get(u);
|
|
46
|
+
t ? (e(t[c]) || (t[c] = []), t[c].push(p)) : f.push(p);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (t(u)) {
|
|
50
|
+
let t = u;
|
|
51
|
+
function n(r, i = 0) {
|
|
52
|
+
let a = r[c], o = t(r, {
|
|
53
|
+
children: a,
|
|
54
|
+
level: i
|
|
55
|
+
});
|
|
56
|
+
return e(a) && (o[c] = a.map((e) => n(e, i + 1))), o;
|
|
57
|
+
}
|
|
58
|
+
return f.map((e) => n(e));
|
|
59
|
+
}
|
|
60
|
+
return f;
|
|
70
61
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
function o(t, n, r = "children") {
|
|
63
|
+
function i(t, a, o = 0) {
|
|
64
|
+
if (e(t)) for (let s of t) {
|
|
65
|
+
if (n(s, {
|
|
66
|
+
parent: a,
|
|
67
|
+
level: o
|
|
68
|
+
})) return s;
|
|
69
|
+
let t = s[r];
|
|
70
|
+
if (e(t)) {
|
|
71
|
+
let e = i(t, s, o + 1);
|
|
72
|
+
if (e) return e;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return i(t);
|
|
86
77
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
c(s);
|
|
127
|
-
}
|
|
78
|
+
function s(t, n, r = {}) {
|
|
79
|
+
let { strategy: i = "dfs", childrenKey: a = "children" } = r;
|
|
80
|
+
if (e(t)) if (i === "bfs") {
|
|
81
|
+
let r = t.map((e, t) => ({
|
|
82
|
+
node: e,
|
|
83
|
+
level: 0,
|
|
84
|
+
index: t
|
|
85
|
+
})), i = 0;
|
|
86
|
+
for (; i < r.length;) {
|
|
87
|
+
let t = r[i++];
|
|
88
|
+
n(t.node, {
|
|
89
|
+
parent: t.parent,
|
|
90
|
+
level: t.level,
|
|
91
|
+
index: t.index
|
|
92
|
+
});
|
|
93
|
+
let o = t.node[a];
|
|
94
|
+
if (e(o)) for (let [e, n] of o.entries()) r.push({
|
|
95
|
+
node: n,
|
|
96
|
+
parent: t.node,
|
|
97
|
+
level: t.level + 1,
|
|
98
|
+
index: e
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
function r(t, i, o = 0) {
|
|
103
|
+
if (e(t)) for (let [s, c] of t.entries()) {
|
|
104
|
+
n(c, {
|
|
105
|
+
parent: i,
|
|
106
|
+
level: o,
|
|
107
|
+
index: s
|
|
108
|
+
});
|
|
109
|
+
let t = c[a];
|
|
110
|
+
e(t) && r(t, c, o + 1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
r(t);
|
|
114
|
+
}
|
|
128
115
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
function c(t, n, r = "children") {
|
|
117
|
+
function i(t, a, o = 0) {
|
|
118
|
+
return e(t) ? t.map((t, s) => {
|
|
119
|
+
let c = n(t, {
|
|
120
|
+
parent: a,
|
|
121
|
+
level: o,
|
|
122
|
+
index: s
|
|
123
|
+
}), l = t[r];
|
|
124
|
+
return e(l) && (c[r] = i(l, t, o + 1)), c;
|
|
125
|
+
}) : [];
|
|
126
|
+
}
|
|
127
|
+
return i(t);
|
|
141
128
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return h(s);
|
|
129
|
+
function l(t, n, r = "children") {
|
|
130
|
+
function i(t, a, o = 0) {
|
|
131
|
+
return e(t) ? t.reduce((t, s, c) => {
|
|
132
|
+
if (!n(s, {
|
|
133
|
+
parent: a,
|
|
134
|
+
level: o,
|
|
135
|
+
index: c
|
|
136
|
+
})) return t;
|
|
137
|
+
let l = s[r], u = { ...s };
|
|
138
|
+
if (l && e(l)) {
|
|
139
|
+
let e = i(l, s, o + 1);
|
|
140
|
+
e.length > 0 ? u[r] = e : delete u[r];
|
|
141
|
+
}
|
|
142
|
+
return t.push(u), t;
|
|
143
|
+
}, []) : [];
|
|
144
|
+
}
|
|
145
|
+
return i(t);
|
|
160
146
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return h(s);
|
|
147
|
+
function u(t, n, r = "children") {
|
|
148
|
+
function i(t, a, o = 0) {
|
|
149
|
+
if (!e(t)) return [];
|
|
150
|
+
let s = [];
|
|
151
|
+
for (let [c, l] of t.entries()) {
|
|
152
|
+
let t = n(l, {
|
|
153
|
+
parent: a,
|
|
154
|
+
level: o,
|
|
155
|
+
index: c
|
|
156
|
+
}), u = l[r], d = e(u) ? i(u, l, o + 1) : [];
|
|
157
|
+
if (t || d.length > 0) {
|
|
158
|
+
let e = { ...l };
|
|
159
|
+
d.length > 0 ? e[r] = d : delete e[r], s.push(e);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return s;
|
|
163
|
+
}
|
|
164
|
+
return i(t);
|
|
180
165
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
V as filterTree,
|
|
184
|
-
b as filterTreeWithAncestors,
|
|
185
|
-
C as findNodeInTree,
|
|
186
|
-
y as flattenTree,
|
|
187
|
-
R as mapTree,
|
|
188
|
-
F as traverseTree
|
|
189
|
-
};
|
|
166
|
+
//#endregion
|
|
167
|
+
export { a as buildTree, l as filterTree, u as filterTreeWithAncestors, o as findNodeInTree, r as flattenTree, c as mapTree, s as traverseTree };
|
package/dist/es/utils/zod.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { z as t } from "zod";
|
|
3
|
-
import { zhCN as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
1
|
+
/*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
|
|
2
|
+
import { z as e, z as t } from "zod";
|
|
3
|
+
import { zhCN as n } from "zod/locales";
|
|
4
|
+
//#region src/utils/zod.ts
|
|
5
|
+
e.config(n());
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as z };
|