@unicom-cloud/utils 0.1.11 → 0.1.12
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/date/index.js +22 -0
- package/date.js +9 -0
- package/index.js +56 -54
- package/lunar/index.js +36 -0
- package/lunar/lib/Holiday.js +42 -0
- package/lunar/lib/HolidayUtil.js +128 -0
- package/lunar/lib/I18n.js +1005 -0
- package/lunar/lib/JieQi.js +40 -0
- package/lunar/lib/Lunar.js +1035 -0
- package/lunar/lib/LunarMonth.js +150 -0
- package/lunar/lib/LunarTime.js +138 -0
- package/lunar/lib/LunarUtil.js +1752 -0
- package/lunar/lib/LunarYear.js +616 -0
- package/lunar/lib/ShouXingUtil.js +6915 -0
- package/lunar/lib/Solar.js +311 -0
- package/lunar/lib/SolarHalfYear.js +45 -0
- package/lunar/lib/SolarMonth.js +55 -0
- package/lunar/lib/SolarSeason.js +42 -0
- package/lunar/lib/SolarUtil.js +256 -0
- package/lunar/lib/SolarWeek.js +153 -0
- package/lunar/lib/SolarYear.js +35 -0
- package/lunar/lib/index.js +35 -0
- package/lunar.js +36 -0
- package/package.json +1 -1
- package/snapdom/src/api/preCache.js +26 -36
- package/snapdom/src/api/snapdom.js +78 -61
- package/snapdom/src/core/capture.js +54 -54
- package/snapdom/src/core/prepare.js +46 -37
- package/snapdom/src/modules/fonts.js +90 -92
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +51 -49
- package/snapdom/src/modules/styles.js +27 -7
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/helpers.js +150 -103
- package/tinycolor/index.js +46 -0
- package/tinycolor/src/conversion.js +143 -0
- package/tinycolor/src/css-color-names.js +153 -0
- package/tinycolor/src/format-input.js +77 -0
- package/tinycolor/src/from-ratio.js +21 -0
- package/tinycolor/src/index.js +404 -0
- package/tinycolor/src/random.js +221 -0
- package/tinycolor/src/readability.js +37 -0
- package/tinycolor/src/to-ms-filter.js +15 -0
- package/tinycolor/src/util.js +32 -0
- package/tinycolor.js +46 -0
- package/tree/index.js +10 -8
- package/tree.js +9 -7
- package/types/date/index.d.ts +4 -0
- package/types/index.d.ts +4 -3
- package/types/lunar/index.d.ts +3 -0
- package/types/lunar/lib/Holiday.d.ts +17 -0
- package/types/lunar/lib/HolidayUtil.d.ts +23 -0
- package/types/lunar/lib/I18n.d.ts +23 -0
- package/types/lunar/lib/JieQi.d.ts +15 -0
- package/types/lunar/lib/Lunar.d.ts +245 -0
- package/types/lunar/lib/LunarMonth.d.ts +35 -0
- package/types/lunar/lib/LunarTime.d.ts +40 -0
- package/types/lunar/lib/LunarUtil.d.ts +128 -0
- package/types/lunar/lib/LunarYear.d.ts +61 -0
- package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
- package/types/lunar/lib/Solar.d.ts +51 -0
- package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
- package/types/lunar/lib/SolarMonth.d.ts +16 -0
- package/types/lunar/lib/SolarSeason.d.ts +15 -0
- package/types/lunar/lib/SolarUtil.d.ts +20 -0
- package/types/lunar/lib/SolarWeek.d.ts +23 -0
- package/types/lunar/lib/SolarYear.d.ts +12 -0
- package/types/lunar/lib/index.d.ts +17 -0
- package/types/snapdom/src/core/prepare.d.ts +1 -1
- package/types/snapdom/src/modules/fonts.d.ts +1 -3
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/pseudo.d.ts +1 -1
- package/types/snapdom/src/modules/styles.d.ts +1 -10
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/helpers.d.ts +1 -1
- package/types/tinycolor/index.d.ts +2 -0
- package/types/tinycolor/src/conversion.d.ts +79 -0
- package/types/tinycolor/src/css-color-names.d.ts +4 -0
- package/types/tinycolor/src/format-input.d.ts +38 -0
- package/types/tinycolor/src/from-ratio.d.ts +14 -0
- package/types/tinycolor/src/index.d.ts +214 -0
- package/types/tinycolor/src/interfaces.d.ts +57 -0
- package/types/tinycolor/src/public_api.d.ts +10 -0
- package/types/tinycolor/src/random.d.ts +24 -0
- package/types/tinycolor/src/readability.d.ts +46 -0
- package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
- package/types/tinycolor/src/umd_api.d.ts +22 -0
- package/types/tinycolor/src/util.d.ts +36 -0
- package/types/tree/index.d.ts +1 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +183 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +155 -0
- package/uiColor.js +28 -0
- package/convertTime.js +0 -4
- package/dayjs/index.js +0 -15
- package/dayjs.js +0 -5
- package/lunar-converter/index.js +0 -641
- package/lunarConverter.js +0 -4
- package/searchTree.js +0 -4
- package/types/dayjs/index.d.ts +0 -1
- package/types/lunar-converter/index.d.ts +0 -113
- /package/{convert-time/index.js → date/convertTime.js} +0 -0
- /package/{search-tree/index.js → tree/searchTree.js} +0 -0
- /package/types/{convert-time/index.d.ts → date/convertTime.d.ts} +0 -0
- /package/types/{search-tree/index.d.ts → tree/searchTree.d.ts} +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { TinyColor as l } from "./index.js";
|
|
2
|
+
function g(e = {}) {
|
|
3
|
+
if (e.count !== void 0 && e.count !== null) {
|
|
4
|
+
const a = e.count, u = [];
|
|
5
|
+
for (e.count = void 0; a > u.length; )
|
|
6
|
+
e.count = null, e.seed && (e.seed += 1), u.push(g(e));
|
|
7
|
+
return e.count = a, u;
|
|
8
|
+
}
|
|
9
|
+
const n = w(e.hue, e.seed), o = R(n, e), r = B(n, o, e), t = { h: n, s: o, v: r };
|
|
10
|
+
return e.alpha !== void 0 && (t.a = e.alpha), new l(t);
|
|
11
|
+
}
|
|
12
|
+
function w(e, n) {
|
|
13
|
+
const o = M(e);
|
|
14
|
+
let r = s(o, n);
|
|
15
|
+
return r < 0 && (r = 360 + r), r;
|
|
16
|
+
}
|
|
17
|
+
function R(e, n) {
|
|
18
|
+
if (n.hue === "monochrome")
|
|
19
|
+
return 0;
|
|
20
|
+
if (n.luminosity === "random")
|
|
21
|
+
return s([0, 100], n.seed);
|
|
22
|
+
const { saturationRange: o } = i(e);
|
|
23
|
+
let r = o[0], t = o[1];
|
|
24
|
+
switch (n.luminosity) {
|
|
25
|
+
case "bright":
|
|
26
|
+
r = 55;
|
|
27
|
+
break;
|
|
28
|
+
case "dark":
|
|
29
|
+
r = t - 10;
|
|
30
|
+
break;
|
|
31
|
+
case "light":
|
|
32
|
+
t = 55;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
return s([r, t], n.seed);
|
|
36
|
+
}
|
|
37
|
+
function B(e, n, o) {
|
|
38
|
+
let r = k(e, n), t = 100;
|
|
39
|
+
switch (o.luminosity) {
|
|
40
|
+
case "dark":
|
|
41
|
+
t = r + 20;
|
|
42
|
+
break;
|
|
43
|
+
case "light":
|
|
44
|
+
r = (t + r) / 2;
|
|
45
|
+
break;
|
|
46
|
+
case "random":
|
|
47
|
+
r = 0, t = 100;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return s([r, t], o.seed);
|
|
51
|
+
}
|
|
52
|
+
function k(e, n) {
|
|
53
|
+
const { lowerBounds: o } = i(e);
|
|
54
|
+
for (let r = 0; r < o.length - 1; r++) {
|
|
55
|
+
const t = o[r][0], a = o[r][1], u = o[r + 1][0], d = o[r + 1][1];
|
|
56
|
+
if (n >= t && n <= u) {
|
|
57
|
+
const c = (d - a) / (u - t), m = a - c * t;
|
|
58
|
+
return c * n + m;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
function M(e) {
|
|
64
|
+
const n = parseInt(e, 10);
|
|
65
|
+
if (!Number.isNaN(n) && n < 360 && n > 0)
|
|
66
|
+
return [n, n];
|
|
67
|
+
if (typeof e == "string") {
|
|
68
|
+
const o = f.find((t) => t.name === e);
|
|
69
|
+
if (o) {
|
|
70
|
+
const t = h(o);
|
|
71
|
+
if (t.hueRange)
|
|
72
|
+
return t.hueRange;
|
|
73
|
+
}
|
|
74
|
+
const r = new l(e);
|
|
75
|
+
if (r.isValid) {
|
|
76
|
+
const t = r.toHsv().h;
|
|
77
|
+
return [t, t];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return [0, 360];
|
|
81
|
+
}
|
|
82
|
+
function i(e) {
|
|
83
|
+
e >= 334 && e <= 360 && (e -= 360);
|
|
84
|
+
for (const n of f) {
|
|
85
|
+
const o = h(n);
|
|
86
|
+
if (o.hueRange && e >= o.hueRange[0] && e <= o.hueRange[1])
|
|
87
|
+
return o;
|
|
88
|
+
}
|
|
89
|
+
throw Error("Color not found");
|
|
90
|
+
}
|
|
91
|
+
function s(e, n) {
|
|
92
|
+
if (n === void 0)
|
|
93
|
+
return Math.floor(e[0] + Math.random() * (e[1] + 1 - e[0]));
|
|
94
|
+
const o = e[1] || 1, r = e[0] || 0;
|
|
95
|
+
n = (n * 9301 + 49297) % 233280;
|
|
96
|
+
const t = n / 233280;
|
|
97
|
+
return Math.floor(r + t * (o - r));
|
|
98
|
+
}
|
|
99
|
+
function h(e) {
|
|
100
|
+
const n = e.lowerBounds[0][0], o = e.lowerBounds[e.lowerBounds.length - 1][0], r = e.lowerBounds[e.lowerBounds.length - 1][1], t = e.lowerBounds[0][1];
|
|
101
|
+
return {
|
|
102
|
+
name: e.name,
|
|
103
|
+
hueRange: e.hueRange,
|
|
104
|
+
lowerBounds: e.lowerBounds,
|
|
105
|
+
saturationRange: [n, o],
|
|
106
|
+
brightnessRange: [r, t]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const f = [
|
|
110
|
+
{
|
|
111
|
+
name: "monochrome",
|
|
112
|
+
hueRange: null,
|
|
113
|
+
lowerBounds: [
|
|
114
|
+
[0, 0],
|
|
115
|
+
[100, 0]
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "red",
|
|
120
|
+
hueRange: [-26, 18],
|
|
121
|
+
lowerBounds: [
|
|
122
|
+
[20, 100],
|
|
123
|
+
[30, 92],
|
|
124
|
+
[40, 89],
|
|
125
|
+
[50, 85],
|
|
126
|
+
[60, 78],
|
|
127
|
+
[70, 70],
|
|
128
|
+
[80, 60],
|
|
129
|
+
[90, 55],
|
|
130
|
+
[100, 50]
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "orange",
|
|
135
|
+
hueRange: [19, 46],
|
|
136
|
+
lowerBounds: [
|
|
137
|
+
[20, 100],
|
|
138
|
+
[30, 93],
|
|
139
|
+
[40, 88],
|
|
140
|
+
[50, 86],
|
|
141
|
+
[60, 85],
|
|
142
|
+
[70, 70],
|
|
143
|
+
[100, 70]
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "yellow",
|
|
148
|
+
hueRange: [47, 62],
|
|
149
|
+
lowerBounds: [
|
|
150
|
+
[25, 100],
|
|
151
|
+
[40, 94],
|
|
152
|
+
[50, 89],
|
|
153
|
+
[60, 86],
|
|
154
|
+
[70, 84],
|
|
155
|
+
[80, 82],
|
|
156
|
+
[90, 80],
|
|
157
|
+
[100, 75]
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "green",
|
|
162
|
+
hueRange: [63, 178],
|
|
163
|
+
lowerBounds: [
|
|
164
|
+
[30, 100],
|
|
165
|
+
[40, 90],
|
|
166
|
+
[50, 85],
|
|
167
|
+
[60, 81],
|
|
168
|
+
[70, 74],
|
|
169
|
+
[80, 64],
|
|
170
|
+
[90, 50],
|
|
171
|
+
[100, 40]
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "blue",
|
|
176
|
+
hueRange: [179, 257],
|
|
177
|
+
lowerBounds: [
|
|
178
|
+
[20, 100],
|
|
179
|
+
[30, 86],
|
|
180
|
+
[40, 80],
|
|
181
|
+
[50, 74],
|
|
182
|
+
[60, 60],
|
|
183
|
+
[70, 52],
|
|
184
|
+
[80, 44],
|
|
185
|
+
[90, 39],
|
|
186
|
+
[100, 35]
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "purple",
|
|
191
|
+
hueRange: [258, 282],
|
|
192
|
+
lowerBounds: [
|
|
193
|
+
[20, 100],
|
|
194
|
+
[30, 87],
|
|
195
|
+
[40, 79],
|
|
196
|
+
[50, 70],
|
|
197
|
+
[60, 65],
|
|
198
|
+
[70, 59],
|
|
199
|
+
[80, 52],
|
|
200
|
+
[90, 45],
|
|
201
|
+
[100, 42]
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "pink",
|
|
206
|
+
hueRange: [283, 334],
|
|
207
|
+
lowerBounds: [
|
|
208
|
+
[20, 100],
|
|
209
|
+
[30, 90],
|
|
210
|
+
[40, 86],
|
|
211
|
+
[60, 84],
|
|
212
|
+
[80, 80],
|
|
213
|
+
[90, 75],
|
|
214
|
+
[100, 73]
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
export {
|
|
219
|
+
f as bounds,
|
|
220
|
+
g as random
|
|
221
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TinyColor as a } from "./index.js";
|
|
2
|
+
function i(n, t) {
|
|
3
|
+
const l = new a(n), e = new a(t);
|
|
4
|
+
return (Math.max(l.getLuminance(), e.getLuminance()) + 0.05) / (Math.min(l.getLuminance(), e.getLuminance()) + 0.05);
|
|
5
|
+
}
|
|
6
|
+
function f(n, t, l = { level: "AA", size: "small" }) {
|
|
7
|
+
const e = i(n, t);
|
|
8
|
+
switch ((l.level ?? "AA") + (l.size ?? "small")) {
|
|
9
|
+
case "AAsmall":
|
|
10
|
+
case "AAAlarge":
|
|
11
|
+
return e >= 4.5;
|
|
12
|
+
case "AAlarge":
|
|
13
|
+
return e >= 3;
|
|
14
|
+
case "AAAsmall":
|
|
15
|
+
return e >= 7;
|
|
16
|
+
default:
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function m(n, t, l = {
|
|
21
|
+
includeFallbackColors: !1,
|
|
22
|
+
level: "AA",
|
|
23
|
+
size: "small"
|
|
24
|
+
}) {
|
|
25
|
+
let e = null, c = 0;
|
|
26
|
+
const { includeFallbackColors: o, level: u, size: A } = l;
|
|
27
|
+
for (const s of t) {
|
|
28
|
+
const r = i(n, s);
|
|
29
|
+
r > c && (c = r, e = new a(s));
|
|
30
|
+
}
|
|
31
|
+
return f(n, e, { level: u, size: A }) || !o ? e : (l.includeFallbackColors = !1, m(n, ["#fff", "#000"], l));
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
f as isReadable,
|
|
35
|
+
m as mostReadable,
|
|
36
|
+
i as readability
|
|
37
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { rgbaToArgbHex as i } from "./conversion.js";
|
|
2
|
+
import { TinyColor as g } from "./index.js";
|
|
3
|
+
function d(s, o) {
|
|
4
|
+
const r = new g(s), e = `#${i(r.r, r.g, r.b, r.a)}`;
|
|
5
|
+
let n = e;
|
|
6
|
+
const a = r.gradientType ? "GradientType = 1, " : "";
|
|
7
|
+
if (o) {
|
|
8
|
+
const t = new g(o);
|
|
9
|
+
n = `#${i(t.r, t.g, t.b, t.a)}`;
|
|
10
|
+
}
|
|
11
|
+
return `progid:DXImageTransform.Microsoft.gradient(${a}startColorstr=${e},endColorstr=${n})`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
d as toMsFilter
|
|
15
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function o(t, r) {
|
|
2
|
+
i(t) && (t = "100%");
|
|
3
|
+
const e = n(t);
|
|
4
|
+
return t = r === 360 ? t : Math.min(r, Math.max(0, parseFloat(t))), e && (t = parseInt(String(t * r), 10) / 100), Math.abs(t - r) < 1e-6 ? 1 : (r === 360 ? t = (t < 0 ? t % r + r : t % r) / parseFloat(String(r)) : t = t % r / parseFloat(String(r)), t);
|
|
5
|
+
}
|
|
6
|
+
function u(t) {
|
|
7
|
+
return Math.min(1, Math.max(0, t));
|
|
8
|
+
}
|
|
9
|
+
function i(t) {
|
|
10
|
+
return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1;
|
|
11
|
+
}
|
|
12
|
+
function n(t) {
|
|
13
|
+
return typeof t == "string" && t.indexOf("%") !== -1;
|
|
14
|
+
}
|
|
15
|
+
function f(t) {
|
|
16
|
+
return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
|
|
17
|
+
}
|
|
18
|
+
function s(t) {
|
|
19
|
+
return Number(t) <= 1 ? `${Number(t) * 100}%` : t;
|
|
20
|
+
}
|
|
21
|
+
function p(t) {
|
|
22
|
+
return t.length === 1 ? "0" + t : String(t);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as bound01,
|
|
26
|
+
f as boundAlpha,
|
|
27
|
+
u as clamp01,
|
|
28
|
+
s as convertToPercentage,
|
|
29
|
+
i as isOnePointZero,
|
|
30
|
+
n as isPercentage,
|
|
31
|
+
p as pad2
|
|
32
|
+
};
|
package/tinycolor.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cmykToRgb as e, convertDecimalToHex as t, convertHexToDecimal as a, hslToRgb as n, hsvToRgb as b, numberInputToObject as m, parseIntFromHex as T, rgbToCmyk as i, rgbToHex as g, rgbToHsl as p, rgbToHsv as l, rgbToRgb as s, rgbaToArgbHex as x, rgbaToHex as c } from "./tinycolor/src/conversion.js";
|
|
2
|
+
import { names as f } from "./tinycolor/src/css-color-names.js";
|
|
3
|
+
import { inputToRGB as u, isValidCSSUnit as H, stringInputToObject as y } from "./tinycolor/src/format-input.js";
|
|
4
|
+
import { fromRatio as C, legacyRandom as h } from "./tinycolor/src/from-ratio.js";
|
|
5
|
+
import { TinyColor as O, TinyColor as P } from "./tinycolor/src/index.js";
|
|
6
|
+
import { bounds as k, random as A } from "./tinycolor/src/random.js";
|
|
7
|
+
import { isReadable as F, mostReadable as S, readability as B } from "./tinycolor/src/readability.js";
|
|
8
|
+
import { toMsFilter as M } from "./tinycolor/src/to-ms-filter.js";
|
|
9
|
+
import { bound01 as V, boundAlpha as Z, clamp01 as q, convertToPercentage as w, isOnePointZero as z, isPercentage as E, pad2 as J } from "./tinycolor/src/util.js";
|
|
10
|
+
export {
|
|
11
|
+
O as TinyColor,
|
|
12
|
+
V as bound01,
|
|
13
|
+
Z as boundAlpha,
|
|
14
|
+
k as bounds,
|
|
15
|
+
q as clamp01,
|
|
16
|
+
e as cmykToRgb,
|
|
17
|
+
t as convertDecimalToHex,
|
|
18
|
+
a as convertHexToDecimal,
|
|
19
|
+
w as convertToPercentage,
|
|
20
|
+
P as default,
|
|
21
|
+
C as fromRatio,
|
|
22
|
+
n as hslToRgb,
|
|
23
|
+
b as hsvToRgb,
|
|
24
|
+
u as inputToRGB,
|
|
25
|
+
z as isOnePointZero,
|
|
26
|
+
E as isPercentage,
|
|
27
|
+
F as isReadable,
|
|
28
|
+
H as isValidCSSUnit,
|
|
29
|
+
h as legacyRandom,
|
|
30
|
+
S as mostReadable,
|
|
31
|
+
f as names,
|
|
32
|
+
m as numberInputToObject,
|
|
33
|
+
J as pad2,
|
|
34
|
+
T as parseIntFromHex,
|
|
35
|
+
A as random,
|
|
36
|
+
B as readability,
|
|
37
|
+
i as rgbToCmyk,
|
|
38
|
+
g as rgbToHex,
|
|
39
|
+
p as rgbToHsl,
|
|
40
|
+
l as rgbToHsv,
|
|
41
|
+
s as rgbToRgb,
|
|
42
|
+
x as rgbaToArgbHex,
|
|
43
|
+
c as rgbaToHex,
|
|
44
|
+
y as stringInputToObject,
|
|
45
|
+
M as toMsFilter
|
|
46
|
+
};
|
package/tree/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as I } from "./searchTree.js";
|
|
1
2
|
function a(e, r, f, l = "children") {
|
|
2
3
|
if (Array.isArray(e) && (e = {
|
|
3
4
|
[l]: e
|
|
@@ -31,7 +32,7 @@ function y(e, r, f, l = "children") {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
const d = a;
|
|
34
|
-
function
|
|
35
|
+
function h(e, r, f, l = "children") {
|
|
35
36
|
if (!e) return;
|
|
36
37
|
const t = Array.isArray(e) ? [...e] : [e];
|
|
37
38
|
e: for (; t.length; ) {
|
|
@@ -50,14 +51,14 @@ function A(e, r, f, l = "children") {
|
|
|
50
51
|
t.push(i[u - 1 - n]);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function A(e, r) {
|
|
54
55
|
return y(e, "id", r);
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function m(e, r, f = !0) {
|
|
57
58
|
let l = y(e, "value", r)?.label;
|
|
58
59
|
return !l && f && (l = r), l;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function g(e, r, f, l = "children") {
|
|
61
62
|
if (!e) return;
|
|
62
63
|
let t = null;
|
|
63
64
|
function i(n) {
|
|
@@ -77,10 +78,11 @@ function m(e, r, f, l = "children") {
|
|
|
77
78
|
export {
|
|
78
79
|
y as default,
|
|
79
80
|
a as findNodeBy,
|
|
80
|
-
|
|
81
|
+
g as getChildWithParentBy,
|
|
81
82
|
y as getItemBy,
|
|
82
83
|
d as getItemBy2,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
h as getItemBy3,
|
|
85
|
+
A as getItemByID,
|
|
86
|
+
m as getLabelFromDictionaryByValue,
|
|
87
|
+
I as searchTree
|
|
86
88
|
};
|
package/tree.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as a } from "./tree/searchTree.js";
|
|
2
|
+
import { getItemBy as y, findNodeBy as m, getChildWithParentBy as B, getItemBy as g, getItemBy2 as o, getItemBy3 as I, getItemByID as d, getLabelFromDictionaryByValue as f } from "./tree/index.js";
|
|
2
3
|
export {
|
|
3
4
|
y as default,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
m as findNodeBy,
|
|
6
|
+
B as getChildWithParentBy,
|
|
7
|
+
g as getItemBy,
|
|
8
|
+
o as getItemBy2,
|
|
8
9
|
I as getItemBy3,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
d as getItemByID,
|
|
11
|
+
f as getLabelFromDictionaryByValue,
|
|
12
|
+
a as searchTree
|
|
11
13
|
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
export * as date from "./date";
|
|
1
2
|
export * as is from "./is";
|
|
2
3
|
export * as math from "./math";
|
|
3
4
|
export * as tree from "./tree";
|
|
4
5
|
export * as turboStream from "./turbo-stream";
|
|
6
|
+
export * as uiColor from "./ui-color";
|
|
5
7
|
export * as urlToolkit from "./url-toolkit";
|
|
6
8
|
export { default as caseName } from "./case-name";
|
|
7
9
|
export { default as className } from "./class-name";
|
|
8
10
|
export { default as clipboardCopy } from "./clipboard-copy";
|
|
9
|
-
export { default as convertTime } from "./convert-time";
|
|
10
11
|
export { default as decimal } from "./decimal";
|
|
11
12
|
export { default as eventEmitter } from "./event-emitter";
|
|
12
13
|
export { default as invariant } from "./invariant";
|
|
13
|
-
export { default as
|
|
14
|
+
export { default as Lunar } from "./lunar";
|
|
14
15
|
export { default as md5 } from "./md5";
|
|
15
16
|
export { default as normalizeWheel } from "./normalize-wheel";
|
|
16
17
|
export { default as numberToChinese } from "./number-to-chinese";
|
|
17
18
|
export { default as nzh } from "./nzh";
|
|
18
19
|
export { default as objectKeysSort } from "./object-keys-sort";
|
|
19
20
|
export { default as screenfull } from "./screenfull";
|
|
20
|
-
export { default as
|
|
21
|
+
export { default as tinycolor } from "./tinycolor";
|
|
21
22
|
export { default as contentDisposition, getContentDispositionFromHeader, getContentDispositionParametersFilenameFromHeader, getContentDispositionParametersFromHeader } from "./content-disposition";
|
|
22
23
|
export { default as cookie, splitCookiesString } from "./cookie";
|
|
23
24
|
export { fileToURL, saveAs } from "./file";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class Holiday {
|
|
2
|
+
private _day;
|
|
3
|
+
private _name;
|
|
4
|
+
private _work;
|
|
5
|
+
private _target;
|
|
6
|
+
constructor(day: string, name: string, work: boolean, target: string);
|
|
7
|
+
private static _ymd;
|
|
8
|
+
getDay(): string;
|
|
9
|
+
setDay(value: string): void;
|
|
10
|
+
getName(): string;
|
|
11
|
+
setName(value: string): void;
|
|
12
|
+
isWork(): boolean;
|
|
13
|
+
setWork(value: boolean): void;
|
|
14
|
+
getTarget(): string;
|
|
15
|
+
setTarget(value: string): void;
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Holiday } from './Holiday';
|
|
2
|
+
export declare class HolidayUtil {
|
|
3
|
+
static NAMES: string[];
|
|
4
|
+
static DATA: string;
|
|
5
|
+
private static _SIZE;
|
|
6
|
+
private static _ZERO;
|
|
7
|
+
private static _TAG_REMOVE;
|
|
8
|
+
private static _NAMES_IN_USE;
|
|
9
|
+
private static _DATA_IN_USE;
|
|
10
|
+
private static _padding;
|
|
11
|
+
private static _findForward;
|
|
12
|
+
private static _findBackward;
|
|
13
|
+
private static _buildHolidayForward;
|
|
14
|
+
private static _buildHolidayBackward;
|
|
15
|
+
private static _findHolidaysForward;
|
|
16
|
+
private static _findHolidaysBackward;
|
|
17
|
+
static getHoliday(yearOrYmd: number | string, month?: number, day?: number): Holiday | null;
|
|
18
|
+
static getHolidays(yearOrYmd: number | string, month?: number): Holiday[];
|
|
19
|
+
static getHolidaysByTarget(yearOrYmd: number | string, month?: number): Holiday[];
|
|
20
|
+
private static _fixNames;
|
|
21
|
+
private static _fixData;
|
|
22
|
+
static fix(a: any, b?: string): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class I18n {
|
|
2
|
+
private static _INIT;
|
|
3
|
+
private static _MESSAGES;
|
|
4
|
+
private static _OBJS;
|
|
5
|
+
private static _DICT_STRING;
|
|
6
|
+
private static _DICT_NUMBER;
|
|
7
|
+
private static _DICT_ARRAY;
|
|
8
|
+
private static _ARRAYS;
|
|
9
|
+
private static updateArray;
|
|
10
|
+
private static updateStringDictionary;
|
|
11
|
+
private static updateNumberDictionary;
|
|
12
|
+
private static updateArrayDictionary;
|
|
13
|
+
private static update;
|
|
14
|
+
static setMessages(messages: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}): void;
|
|
17
|
+
static getMessage(key: string): string;
|
|
18
|
+
private static initArray;
|
|
19
|
+
private static initArrayDictionary;
|
|
20
|
+
private static initStringDictionary;
|
|
21
|
+
private static initNumberDictionary;
|
|
22
|
+
static init(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Solar } from './Solar';
|
|
2
|
+
export declare class JieQi {
|
|
3
|
+
private _name;
|
|
4
|
+
private _solar;
|
|
5
|
+
private readonly _jie;
|
|
6
|
+
private readonly _qi;
|
|
7
|
+
constructor(name: string, solar: Solar);
|
|
8
|
+
getName(): string;
|
|
9
|
+
getSolar(): Solar;
|
|
10
|
+
setName(name: string): void;
|
|
11
|
+
setSolar(solar: Solar): void;
|
|
12
|
+
isJie(): boolean;
|
|
13
|
+
isQi(): boolean;
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|