@vef-framework/shared 2.0.4 → 2.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.
Files changed (61) hide show
  1. package/dist/cjs/color/color-ops.cjs +1 -76
  2. package/dist/cjs/color/index.cjs +1 -24
  3. package/dist/cjs/color/name.cjs +1 -49
  4. package/dist/cjs/color/palette.cjs +1 -126
  5. package/dist/cjs/constants/color-names.cjs +1 -1580
  6. package/dist/cjs/constants/color-palettes.cjs +1 -372
  7. package/dist/cjs/constants/index.cjs +1 -14
  8. package/dist/cjs/index.cjs +1 -339
  9. package/dist/cjs/types/color.cjs +1 -3
  10. package/dist/cjs/types/common.cjs +1 -3
  11. package/dist/cjs/types/deep-keys.cjs +1 -3
  12. package/dist/cjs/types/index.cjs +1 -7
  13. package/dist/cjs/utils/chrono.cjs +1 -139
  14. package/dist/cjs/utils/equal.cjs +1 -175
  15. package/dist/cjs/utils/error.cjs +3 -60
  16. package/dist/cjs/utils/event.cjs +1 -62
  17. package/dist/cjs/utils/format.cjs +1 -31
  18. package/dist/cjs/utils/function.cjs +1 -49
  19. package/dist/cjs/utils/id.cjs +1 -38
  20. package/dist/cjs/utils/index.cjs +1 -86
  21. package/dist/cjs/utils/key.cjs +1 -34
  22. package/dist/cjs/utils/lib.cjs +1 -234
  23. package/dist/cjs/utils/object.cjs +1 -20
  24. package/dist/cjs/utils/path.cjs +1 -63
  25. package/dist/cjs/utils/pinyin.cjs +1 -53
  26. package/dist/cjs/utils/security.cjs +1 -44
  27. package/dist/cjs/utils/string.cjs +1 -13
  28. package/dist/cjs/utils/task.cjs +1 -17
  29. package/dist/cjs/utils/tree.cjs +1 -262
  30. package/dist/cjs/utils/zod.cjs +1 -14
  31. package/dist/es/color/color-ops.js +64 -58
  32. package/dist/es/color/index.js +18 -4
  33. package/dist/es/color/name.js +24 -37
  34. package/dist/es/color/palette.js +67 -100
  35. package/dist/es/constants/color-names.js +6 -9
  36. package/dist/es/constants/color-palettes.js +8 -15
  37. package/dist/es/constants/index.js +8 -3
  38. package/dist/es/index.js +165 -30
  39. package/dist/es/types/color.js +1 -1
  40. package/dist/es/types/common.js +1 -1
  41. package/dist/es/types/deep-keys.js +1 -1
  42. package/dist/es/types/index.js +3 -4
  43. package/dist/es/utils/chrono.js +71 -88
  44. package/dist/es/utils/equal.js +111 -161
  45. package/dist/es/utils/error.js +28 -25
  46. package/dist/es/utils/event.js +18 -23
  47. package/dist/es/utils/format.js +16 -22
  48. package/dist/es/utils/function.js +32 -32
  49. package/dist/es/utils/id.js +18 -27
  50. package/dist/es/utils/index.js +80 -18
  51. package/dist/es/utils/key.js +19 -25
  52. package/dist/es/utils/lib.js +64 -10
  53. package/dist/es/utils/object.js +11 -14
  54. package/dist/es/utils/path.js +57 -48
  55. package/dist/es/utils/pinyin.js +28 -29
  56. package/dist/es/utils/security.js +29 -37
  57. package/dist/es/utils/string.js +7 -8
  58. package/dist/es/utils/task.js +7 -12
  59. package/dist/es/utils/tree.js +156 -219
  60. package/dist/es/utils/zod.js +7 -6
  61. package/package.json +1 -1
@@ -1,31 +1,20 @@
1
- /*! @vef-framework/shared v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.127Z */
2
- import dayjs from 'dayjs';
3
- import locale from 'dayjs/locale/zh-cn';
4
- import customParseFormat from 'dayjs/plugin/customParseFormat';
5
- import duration from 'dayjs/plugin/duration';
6
- import localizedFormat from 'dayjs/plugin/localizedFormat';
7
- import relativeTime from 'dayjs/plugin/relativeTime';
8
-
9
- dayjs.locale(locale);
10
- dayjs.extend(localizedFormat);
11
- dayjs.extend(customParseFormat);
12
- dayjs.extend(duration);
13
- dayjs.extend(relativeTime);
14
- const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
15
- const DEFAULT_TIME_FORMAT = "HH:mm:ss";
16
- const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
17
- const LOCALIZED_DATETIME_FORMAT = "LLLL";
18
- const LOCALIZED_DATE_FORMAT = "LLdddd";
19
- const YEAR_FORMATS = ["YYYY"];
20
- const QUARTER_FORMATS = ["YYYY-Q季度"];
21
- const MONTH_FORMATS = [
1
+ import t from "dayjs";
2
+ import i from "dayjs/locale/zh-cn";
3
+ import a from "dayjs/plugin/customParseFormat";
4
+ import u from "dayjs/plugin/duration";
5
+ import c from "dayjs/plugin/localizedFormat";
6
+ import f from "dayjs/plugin/relativeTime";
7
+ t.locale(i);
8
+ t.extend(c);
9
+ t.extend(a);
10
+ t.extend(u);
11
+ t.extend(f);
12
+ const T = "YYYY-MM-DD", H = "HH:mm:ss", m = "YYYY-MM-DD HH:mm:ss", A = "LLLL", E = "LLdddd", F = ["YYYY"], d = ["YYYY-Q季度"], _ = [
22
13
  "YYYY-MM",
23
14
  "YYYY/MM",
24
15
  "YYYY.MM",
25
16
  "YYYYMM"
26
- ];
27
- const WEEK_FORMATS = ["YYYY-wo"];
28
- const DATE_FORMATS = [
17
+ ], O = ["YYYY-wo"], M = [
29
18
  "YYYY-MM-DD",
30
19
  "YYYY/MM/DD",
31
20
  "YYYY.MM.DD",
@@ -33,11 +22,7 @@ const DATE_FORMATS = [
33
22
  "YY/MM/DD",
34
23
  "YY.MM.DD",
35
24
  "YYMMDD"
36
- ];
37
- const TIME_FORMATS = ["HH:mm:ss", "HH.mm.ss", "HHmmss"];
38
- const HOUR_FORMATS = ["HH"];
39
- const MINUTE_FORMATS = ["HH:mm", "HH.mm", "HHmm"];
40
- const DATETIME_FORMATS = [
25
+ ], R = ["HH:mm:ss", "HH.mm.ss", "HHmmss"], l = ["HH"], L = ["HH:mm", "HH.mm", "HHmm"], D = [
41
26
  "YYYY-MM-DD HH:mm:ss",
42
27
  "YYYY/MM/DD HH:mm:ss",
43
28
  "YYYY.MM.DD HH.mm.ss",
@@ -47,75 +32,73 @@ const DATETIME_FORMATS = [
47
32
  "YY.MM.DD HH.mm.ss",
48
33
  "YYMMDDHHmmss"
49
34
  ];
50
- function formatDuration(seconds, unit = "seconds") {
51
- const duration2 = dayjs.duration(seconds, unit);
52
- const days = Math.floor(duration2.asDays());
53
- const hours = duration2.hours();
54
- const minutes = duration2.minutes();
55
- if (days > 0) {
56
- return `${days}天${hours}小时${minutes}分钟`;
57
- }
58
- if (hours > 0) {
59
- return `${hours}小时${minutes}分钟`;
60
- }
61
- return `${minutes}分钟`;
35
+ function $(o, r = "seconds") {
36
+ const n = t.duration(o, r), Y = Math.floor(n.asDays()), s = n.hours(), e = n.minutes();
37
+ return Y > 0 ? `${Y}天${s}小时${e}分钟` : s > 0 ? `${s}小时${e}分钟` : `${e}分钟`;
62
38
  }
63
- function parseDate(date, format = DEFAULT_DATETIME_FORMAT) {
64
- if (date instanceof Date) {
65
- return dayjs(date);
66
- }
67
- return format ? dayjs(date, format) : dayjs(date);
39
+ function h(o, r = m) {
40
+ return o instanceof Date ? t(o) : r ? t(o, r) : t(o);
68
41
  }
69
- function tryParseDate(date) {
70
- for (const format of DATETIME_FORMATS) {
71
- const parsed = dayjs(date, format, true);
72
- if (parsed.isValid()) {
73
- return parsed;
74
- }
75
- }
76
- for (const format of DATE_FORMATS) {
77
- const parsed = dayjs(date, format, true);
78
- if (parsed.isValid()) {
79
- return parsed;
80
- }
42
+ function x(o) {
43
+ for (const n of D) {
44
+ const Y = t(o, n, !0);
45
+ if (Y.isValid())
46
+ return Y;
81
47
  }
82
- const defaultParsed = dayjs(date);
83
- if (defaultParsed.isValid()) {
84
- return defaultParsed;
48
+ for (const n of M) {
49
+ const Y = t(o, n, !0);
50
+ if (Y.isValid())
51
+ return Y;
85
52
  }
86
- return null;
53
+ const r = t(o);
54
+ return r.isValid() ? r : null;
87
55
  }
88
- function formatDate(date, format = DEFAULT_DATETIME_FORMAT) {
89
- return date.format(format);
56
+ function y(o, r = m) {
57
+ return o.format(r);
90
58
  }
91
- function getNow() {
92
- return dayjs();
59
+ function P() {
60
+ return t();
93
61
  }
94
- function getNowDateString() {
95
- return dayjs().format(DEFAULT_DATE_FORMAT);
62
+ function V() {
63
+ return t().format(T);
96
64
  }
97
- function getNowTimeString() {
98
- return dayjs().format(DEFAULT_TIME_FORMAT);
65
+ function z() {
66
+ return t().format(H);
99
67
  }
100
- function getNowDateTimeString() {
101
- return dayjs().format(DEFAULT_DATETIME_FORMAT);
68
+ function C() {
69
+ return t().format(m);
102
70
  }
103
- function getLocalizedDateTime(includeTime = true) {
104
- return dayjs().format(includeTime ? LOCALIZED_DATETIME_FORMAT : LOCALIZED_DATE_FORMAT);
71
+ function Q(o = !0) {
72
+ return t().format(o ? A : E);
105
73
  }
106
- const FORMAT_MAP = {
107
- year: YEAR_FORMATS,
108
- quarter: QUARTER_FORMATS,
109
- month: MONTH_FORMATS,
110
- week: WEEK_FORMATS,
111
- date: DATE_FORMATS,
112
- time: TIME_FORMATS,
113
- hour: HOUR_FORMATS,
114
- minute: MINUTE_FORMATS,
115
- datetime: DATETIME_FORMATS
74
+ const S = {
75
+ year: F,
76
+ quarter: d,
77
+ month: _,
78
+ week: O,
79
+ date: M,
80
+ time: R,
81
+ hour: l,
82
+ minute: L,
83
+ datetime: D
116
84
  };
117
- function getTemporalFormats(mode) {
118
- return FORMAT_MAP[mode];
85
+ function Z(o) {
86
+ return S[o];
119
87
  }
120
-
121
- export { DEFAULT_DATETIME_FORMAT, DEFAULT_DATE_FORMAT, DEFAULT_TIME_FORMAT, LOCALIZED_DATETIME_FORMAT, LOCALIZED_DATE_FORMAT, formatDate, formatDuration, getLocalizedDateTime, getNow, getNowDateString, getNowDateTimeString, getNowTimeString, getTemporalFormats, parseDate, tryParseDate };
88
+ export {
89
+ m as DEFAULT_DATETIME_FORMAT,
90
+ T as DEFAULT_DATE_FORMAT,
91
+ H as DEFAULT_TIME_FORMAT,
92
+ A as LOCALIZED_DATETIME_FORMAT,
93
+ E as LOCALIZED_DATE_FORMAT,
94
+ y as formatDate,
95
+ $ as formatDuration,
96
+ Q as getLocalizedDateTime,
97
+ P as getNow,
98
+ V as getNowDateString,
99
+ C as getNowDateTimeString,
100
+ z as getNowTimeString,
101
+ Z as getTemporalFormats,
102
+ h as parseDate,
103
+ x as tryParseDate
104
+ };
@@ -1,170 +1,120 @@
1
- /*! @vef-framework/shared v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.127Z */
2
- function isShallowEqual(value1, value2) {
3
- if (Object.is(value1, value2)) {
4
- return true;
1
+ function j(n, o) {
2
+ if (Object.is(n, o))
3
+ return !0;
4
+ if (typeof n != "object" || n === null || typeof o != "object" || o === null)
5
+ return !1;
6
+ if (n instanceof Map && o instanceof Map) {
7
+ if (n.size !== o.size)
8
+ return !1;
9
+ for (const [r, e] of n)
10
+ if (!o.has(r) || !Object.is(e, o.get(r)))
11
+ return !1;
12
+ return !0;
5
13
  }
6
- if (typeof value1 !== "object" || value1 === null || typeof value2 !== "object" || value2 === null) {
7
- return false;
14
+ if (n instanceof Set && o instanceof Set) {
15
+ if (n.size !== o.size)
16
+ return !1;
17
+ for (const r of n)
18
+ if (!o.has(r))
19
+ return !1;
20
+ return !0;
8
21
  }
9
- if (value1 instanceof Map && value2 instanceof Map) {
10
- if (value1.size !== value2.size) {
11
- return false;
12
- }
13
- for (const [k, v] of value1) {
14
- if (!value2.has(k) || !Object.is(v, value2.get(k))) {
15
- return false;
16
- }
17
- }
18
- return true;
19
- }
20
- if (value1 instanceof Set && value2 instanceof Set) {
21
- if (value1.size !== value2.size) {
22
- return false;
23
- }
24
- for (const v of value1) {
25
- if (!value2.has(v)) {
26
- return false;
27
- }
28
- }
29
- return true;
30
- }
31
- const isArray1 = Array.isArray(value1);
32
- const isArray2 = Array.isArray(value2);
33
- if (isArray1 !== isArray2) {
34
- return false;
35
- }
36
- if (value1.constructor !== value2.constructor) {
37
- return false;
38
- }
39
- const keysA = Object.keys(value1);
40
- if (keysA.length !== Object.keys(value2).length) {
41
- return false;
42
- }
43
- for (const element of keysA) {
44
- if (!Object.hasOwn(value2, element) || !Object.is(value1[element], value2[element])) {
45
- return false;
46
- }
47
- }
48
- return true;
22
+ const O = Array.isArray(n), h = Array.isArray(o);
23
+ if (O !== h || n.constructor !== o.constructor)
24
+ return !1;
25
+ const l = Object.keys(n);
26
+ if (l.length !== Object.keys(o).length)
27
+ return !1;
28
+ for (const r of l)
29
+ if (!Object.hasOwn(o, r) || !Object.is(n[r], o[r]))
30
+ return !1;
31
+ return !0;
49
32
  }
50
- function isDeepEqual(value1, value2) {
51
- const { valueOf, toString } = Object.prototype;
52
- const visited = /* @__PURE__ */ new WeakMap();
53
- const compareValues = (currentFirst, currentSecond) => {
54
- if (currentFirst === currentSecond) {
55
- return true;
56
- }
57
- if (typeof currentFirst !== "object" || typeof currentSecond !== "object" || !currentFirst || !currentSecond) {
58
- return currentFirst !== currentFirst && currentSecond !== currentSecond;
59
- }
60
- if (Object.getPrototypeOf(currentFirst) !== Object.getPrototypeOf(currentSecond)) {
61
- return false;
62
- }
63
- const { constructor } = currentFirst;
64
- if (constructor === Date) {
65
- return currentFirst.getTime() === currentSecond.getTime();
66
- }
67
- if (constructor === RegExp) {
68
- const firstRegex = currentFirst;
69
- const secondRegex = currentSecond;
70
- return firstRegex.source === secondRegex.source && firstRegex.flags === secondRegex.flags;
71
- }
72
- if (constructor === Set) {
73
- const firstSet = currentFirst;
74
- const secondSet = currentSecond;
75
- if (firstSet.size !== secondSet.size) {
76
- return false;
77
- }
78
- for (const value of firstSet) {
79
- let found = false;
80
- for (const secondValue of secondSet) {
81
- if (compareValues(value, secondValue)) {
82
- found = true;
33
+ function A(n, o) {
34
+ const { valueOf: O, toString: h } = Object.prototype, l = /* @__PURE__ */ new WeakMap(), r = (e, f) => {
35
+ if (e === f)
36
+ return !0;
37
+ if (typeof e != "object" || typeof f != "object" || !e || !f)
38
+ return e !== e && f !== f;
39
+ if (Object.getPrototypeOf(e) !== Object.getPrototypeOf(f))
40
+ return !1;
41
+ const { constructor: a } = e;
42
+ if (a === Date)
43
+ return e.getTime() === f.getTime();
44
+ if (a === RegExp) {
45
+ const t = e, s = f;
46
+ return t.source === s.source && t.flags === s.flags;
47
+ }
48
+ if (a === Set) {
49
+ const t = e, s = f;
50
+ if (t.size !== s.size)
51
+ return !1;
52
+ for (const i of t) {
53
+ let y = !1;
54
+ for (const c of s)
55
+ if (r(i, c)) {
56
+ y = !0;
83
57
  break;
84
58
  }
85
- }
86
- if (!found) {
87
- return false;
88
- }
89
- }
90
- return true;
91
- }
92
- if (constructor === ArrayBuffer) {
93
- const firstView = new DataView(currentFirst);
94
- const secondView = new DataView(currentSecond);
95
- return compareValues(firstView, secondView);
96
- }
97
- if (constructor === DataView || ArrayBuffer.isView(currentFirst)) {
98
- let firstView;
99
- let secondView;
100
- if (constructor === DataView) {
101
- firstView = currentFirst;
102
- secondView = currentSecond;
103
- } else {
104
- const firstTyped = currentFirst;
105
- const secondTyped = currentSecond;
106
- firstView = new DataView(firstTyped.buffer, firstTyped.byteOffset, firstTyped.byteLength);
107
- secondView = new DataView(secondTyped.buffer, secondTyped.byteOffset, secondTyped.byteLength);
108
- }
109
- if (firstView.byteLength !== secondView.byteLength) {
110
- return false;
111
- }
112
- for (let index = firstView.byteLength; index-- !== 0; ) {
113
- if (firstView.getUint8(index) !== secondView.getUint8(index)) {
114
- return false;
115
- }
116
- }
117
- return true;
118
- }
119
- if (visited.has(currentFirst) && visited.get(currentFirst) === currentSecond) {
120
- return true;
121
- }
122
- visited.set(currentFirst, currentSecond);
123
- if (constructor === Array) {
124
- const firstArray = currentFirst;
125
- const secondArray = currentSecond;
126
- if (firstArray.length !== secondArray.length) {
127
- return false;
59
+ if (!y)
60
+ return !1;
128
61
  }
129
- for (let index = firstArray.length; index-- !== 0; ) {
130
- if (!compareValues(firstArray[index], secondArray[index])) {
131
- return false;
132
- }
62
+ return !0;
63
+ }
64
+ if (a === ArrayBuffer) {
65
+ const t = new DataView(e), s = new DataView(f);
66
+ return r(t, s);
67
+ }
68
+ if (a === DataView || ArrayBuffer.isView(e)) {
69
+ let t, s;
70
+ if (a === DataView)
71
+ t = e, s = f;
72
+ else {
73
+ const i = e, y = f;
74
+ t = new DataView(i.buffer, i.byteOffset, i.byteLength), s = new DataView(y.buffer, y.byteOffset, y.byteLength);
133
75
  }
134
- return true;
135
- }
136
- if (constructor === Map) {
137
- const firstMap = currentFirst;
138
- const secondMap = currentSecond;
139
- if (firstMap.size !== secondMap.size) {
140
- return false;
141
- }
142
- for (const [key, value] of firstMap) {
143
- if (!secondMap.has(key) || !compareValues(value, secondMap.get(key))) {
144
- return false;
145
- }
146
- }
147
- return true;
148
- }
149
- const firstAsAny = currentFirst;
150
- const secondAsAny = currentSecond;
151
- if (firstAsAny.valueOf !== valueOf && typeof firstAsAny.valueOf === "function" && typeof secondAsAny.valueOf === "function") {
152
- return firstAsAny.valueOf() === secondAsAny.valueOf();
153
- }
154
- if (firstAsAny.toString !== toString && typeof firstAsAny.toString === "function" && typeof secondAsAny.toString === "function") {
155
- return firstAsAny.toString() === secondAsAny.toString();
156
- }
157
- const firstKeys = Object.keys(currentFirst);
158
- let currentKey;
159
- for (let index = firstKeys.length; index-- !== 0; ) {
160
- currentKey = firstKeys[index];
161
- if (!Object.hasOwn(currentSecond, currentKey) || !compareValues(firstAsAny[currentKey], secondAsAny[currentKey])) {
162
- return false;
163
- }
164
- }
165
- return Object.keys(currentSecond).length === firstKeys.length;
76
+ if (t.byteLength !== s.byteLength)
77
+ return !1;
78
+ for (let i = t.byteLength; i-- !== 0; )
79
+ if (t.getUint8(i) !== s.getUint8(i))
80
+ return !1;
81
+ return !0;
82
+ }
83
+ if (l.has(e) && l.get(e) === f)
84
+ return !0;
85
+ if (l.set(e, f), a === Array) {
86
+ const t = e, s = f;
87
+ if (t.length !== s.length)
88
+ return !1;
89
+ for (let i = t.length; i-- !== 0; )
90
+ if (!r(t[i], s[i]))
91
+ return !1;
92
+ return !0;
93
+ }
94
+ if (a === Map) {
95
+ const t = e, s = f;
96
+ if (t.size !== s.size)
97
+ return !1;
98
+ for (const [i, y] of t)
99
+ if (!s.has(i) || !r(y, s.get(i)))
100
+ return !1;
101
+ return !0;
102
+ }
103
+ const g = e, b = f;
104
+ if (g.valueOf !== O && typeof g.valueOf == "function" && typeof b.valueOf == "function")
105
+ return g.valueOf() === b.valueOf();
106
+ if (g.toString !== h && typeof g.toString == "function" && typeof b.toString == "function")
107
+ return g.toString() === b.toString();
108
+ const w = Object.keys(e);
109
+ let p;
110
+ for (let t = w.length; t-- !== 0; )
111
+ if (p = w[t], !Object.hasOwn(f, p) || !r(g[p], b[p]))
112
+ return !1;
113
+ return Object.keys(f).length === w.length;
166
114
  };
167
- return compareValues(value1, value2);
115
+ return r(n, o);
168
116
  }
169
-
170
- export { isDeepEqual, isShallowEqual };
117
+ export {
118
+ A as isDeepEqual,
119
+ j as isShallowEqual
120
+ };
@@ -1,33 +1,36 @@
1
- /*! @vef-framework/shared v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.127Z */
2
- import * as stackTrace from 'stacktrace-js';
3
- import { getBaseName } from './path.js';
4
-
5
- async function parseErrorStack(error, filter) {
6
- return await stackTrace.fromError(error, {
7
- offline: true,
8
- filter
1
+ import * as t from "stacktrace-js";
2
+ import { getBaseName as o } from "./path.js";
3
+ async function i(e, r) {
4
+ return await t.fromError(e, {
5
+ offline: !0,
6
+ filter: r
9
7
  });
10
8
  }
11
- function filterUserFrame(stackFrame) {
12
- return !stackFrame.fileName || !stackFrame.fileName.includes("node_modules");
9
+ function u(e) {
10
+ return !e.fileName || !e.fileName.includes("node_modules");
13
11
  }
14
- async function getSanitizedErrorStack(error) {
15
- const frames = await parseErrorStack(error, filterUserFrame);
16
- const cleanStack = frames.map((frame) => ` at ${frame.functionName || "anonymous"} (${frame.fileName ? getBaseName(frame.fileName, true) : "unknown"}:${frame.lineNumber}:${frame.columnNumber})`).join("\n");
17
- return `${error.name}: ${error.message}
18
- ${cleanStack}`;
12
+ async function f(e) {
13
+ const a = (await i(e, u)).map((n) => ` at ${n.functionName || "anonymous"} (${n.fileName ? o(n.fileName, !0) : "unknown"}:${n.lineNumber}:${n.columnNumber})`).join(`
14
+ `);
15
+ return `${e.name}: ${e.message}
16
+ ${a}`;
19
17
  }
20
- async function getCurrentStack(filter) {
21
- return await stackTrace.get({
22
- offline: true,
23
- filter
18
+ async function m(e) {
19
+ return await t.get({
20
+ offline: !0,
21
+ filter: e
24
22
  });
25
23
  }
26
- function getCurrentStackSync(filter) {
27
- return stackTrace.getSync({
28
- offline: true,
29
- filter
24
+ function s(e) {
25
+ return t.getSync({
26
+ offline: !0,
27
+ filter: e
30
28
  });
31
29
  }
32
-
33
- export { filterUserFrame, getCurrentStack, getCurrentStackSync, getSanitizedErrorStack, parseErrorStack };
30
+ export {
31
+ u as filterUserFrame,
32
+ m as getCurrentStack,
33
+ s as getCurrentStackSync,
34
+ f as getSanitizedErrorStack,
35
+ i as parseErrorStack
36
+ };
@@ -1,9 +1,7 @@
1
- /*! @vef-framework/shared v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.127Z */
2
- import mitt from 'mitt';
3
-
4
- class EventEmitter {
1
+ import r from "mitt";
2
+ class s {
5
3
  /** Private mitt instance for handling the actual event operations */
6
- #bus = mitt();
4
+ #t = r();
7
5
  /**
8
6
  * Subscribe to an event with a listener function.
9
7
  * Returns an unsubscribe function for easy cleanup.
@@ -12,18 +10,13 @@ class EventEmitter {
12
10
  * @param eventListener - The function to call when the event is emitted
13
11
  * @returns A function that removes this specific listener when called
14
12
  */
15
- on(eventType, eventListener) {
16
- this.#bus.on(eventType, eventListener);
17
- return () => {
18
- this.#bus.off(eventType, eventListener);
13
+ on(t, i) {
14
+ return this.#t.on(t, i), () => {
15
+ this.#t.off(t, i);
19
16
  };
20
17
  }
21
- emit(eventType, eventPayload) {
22
- if (eventPayload) {
23
- this.#bus.emit(eventType, eventPayload);
24
- } else {
25
- this.#bus.emit(eventType);
26
- }
18
+ emit(t, i) {
19
+ i ? this.#t.emit(t, i) : this.#t.emit(t);
27
20
  }
28
21
  /**
29
22
  * Remove a specific listener for an event type.
@@ -32,26 +25,28 @@ class EventEmitter {
32
25
  * @param eventType - The type of event to remove listeners from
33
26
  * @param eventListener - Optional specific listener to remove
34
27
  */
35
- off(eventType, eventListener) {
36
- this.#bus.off(eventType, eventListener);
28
+ off(t, i) {
29
+ this.#t.off(t, i);
37
30
  }
38
31
  /**
39
32
  * Remove all event listeners from all event types.
40
33
  * Useful for cleanup when the emitter is no longer needed.
41
34
  */
42
35
  clear() {
43
- this.#bus.all.clear();
36
+ this.#t.all.clear();
44
37
  }
45
38
  /**
46
39
  * Get all registered listeners for debugging purposes.
47
40
  * Returns a Map of event types to their listener arrays.
48
41
  */
49
42
  getAllListeners() {
50
- return this.#bus.all;
43
+ return this.#t.all;
51
44
  }
52
45
  }
53
- function createEventEmitter() {
54
- return new EventEmitter();
46
+ function l() {
47
+ return new s();
55
48
  }
56
-
57
- export { EventEmitter, createEventEmitter };
49
+ export {
50
+ s as EventEmitter,
51
+ l as createEventEmitter
52
+ };
@@ -1,26 +1,20 @@
1
- /*! @vef-framework/shared v2.0.2 made with ❤️ by Venus | 2025-11-25T15:03:13.127Z */
2
- const BYTES_UNIT = 1024;
3
- const BYTE_SIZES = ["B", "KB", "MB", "GB", "TB", "PB"];
4
- const NUMBER_UNIT = 1e3;
5
- const NUMBER_UNITS = ["", "K", "M", "B", "T"];
6
- function formatBytes(bytes, decimals = 2) {
7
- if (bytes === 0) {
1
+ const a = ["B", "KB", "MB", "GB", "TB", "PB"];
2
+ const N = ["", "K", "M", "B", "T"];
3
+ function M(t, r = 2) {
4
+ if (t === 0)
8
5
  return "0 B";
9
- }
10
- const dm = Math.max(decimals, 0);
11
- const i = Math.floor(Math.log(bytes) / Math.log(BYTES_UNIT));
12
- return `${Number.parseFloat((bytes / BYTES_UNIT ** i).toFixed(dm))} ${BYTE_SIZES[i]}`;
6
+ const B = Math.max(r, 0), o = Math.floor(Math.log(t) / Math.log(1024));
7
+ return `${Number.parseFloat((t / 1024 ** o).toFixed(B))} ${a[o]}`;
13
8
  }
14
- function formatNumber(num, decimals = 2) {
15
- if (num === 0) {
9
+ function n(t, r = 2) {
10
+ if (t === 0)
16
11
  return "0";
17
- }
18
- if (num < NUMBER_UNIT) {
19
- return num.toString();
20
- }
21
- const dm = Math.max(decimals, 0);
22
- const i = Math.floor(Math.log(num) / Math.log(NUMBER_UNIT));
23
- return `${Number.parseFloat((num / NUMBER_UNIT ** i).toFixed(dm))} ${NUMBER_UNITS[i]}`;
12
+ if (t < 1e3)
13
+ return t.toString();
14
+ const B = Math.max(r, 0), o = Math.floor(Math.log(t) / Math.log(1e3));
15
+ return `${Number.parseFloat((t / 1e3 ** o).toFixed(B))} ${N[o]}`;
24
16
  }
25
-
26
- export { formatBytes, formatNumber };
17
+ export {
18
+ M as formatBytes,
19
+ n as formatNumber
20
+ };