@ug666/ui-core 0.3.0-beta.1 → 0.3.0-beta.2
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/THIRD_PARTY_NOTICES.txt +98 -0
- package/dist/calendar.d.ts +26 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/chunk-5S74COKZ.js +256 -0
- package/dist/chunk-5S74COKZ.js.map +1 -0
- package/dist/color.d.ts +17 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/date-picker-modes.d.ts +16 -0
- package/dist/date-picker-modes.d.ts.map +1 -0
- package/dist/date-range.d.ts +9 -0
- package/dist/date-range.d.ts.map +1 -0
- package/dist/date-time.d.ts +43 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/form-state.d.ts +30 -0
- package/dist/form-state.d.ts.map +1 -0
- package/dist/form-validation.d.ts +2 -1
- package/dist/form-validation.d.ts.map +1 -1
- package/dist/image-preview.d.ts +8 -0
- package/dist/image-preview.d.ts.map +1 -0
- package/dist/index.cjs +1061 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +790 -3
- package/dist/index.js.map +1 -1
- package/dist/rating.d.ts +6 -0
- package/dist/rating.d.ts.map +1 -0
- package/dist/selection-list.d.ts +31 -0
- package/dist/selection-list.d.ts.map +1 -0
- package/dist/table-layout.d.ts +20 -0
- package/dist/table-layout.d.ts.map +1 -0
- package/dist/table-structure.d.ts +29 -0
- package/dist/table-structure.d.ts.map +1 -0
- package/dist/theme.cjs +231 -2
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.ts +47 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +22 -3
- package/dist/tree-check.d.ts +23 -0
- package/dist/tree-check.d.ts.map +1 -0
- package/dist/tree-drag.d.ts +8 -0
- package/dist/tree-drag.d.ts.map +1 -0
- package/dist/tree-path.d.ts +29 -0
- package/dist/tree-path.d.ts.map +1 -0
- package/dist/tree-table.d.ts +21 -0
- package/dist/tree-table.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/chunk-S4DT6FOD.js +0 -35
- package/dist/chunk-S4DT6FOD.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Arco Design
|
|
2
|
+
Source: https://github.com/arco-design/arco-design
|
|
3
|
+
Version: 2.66.16
|
|
4
|
+
Commit: fbf2ec0a8cc28a5d20f1f82de6c2c4196ef66950
|
|
5
|
+
Also adapted from Arco Design Vue:
|
|
6
|
+
Source: https://github.com/arco-design/arco-design-vue
|
|
7
|
+
Version: 2.58.0
|
|
8
|
+
Commit: 5a707cc60c1130d8dae3aefb2e93616541952a66
|
|
9
|
+
UG UI includes adapted portions of Arco Design. Source mappings and local
|
|
10
|
+
modifications are documented in docs/UI_DEVELOPMENT_GUIDE.md.
|
|
11
|
+
|
|
12
|
+
MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2021 Bytedance, Inc. and its affiliates.
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
33
|
+
|
|
34
|
+
Element Plus
|
|
35
|
+
Source: https://github.com/element-plus/element-plus
|
|
36
|
+
Version: 2.14.7
|
|
37
|
+
Commit: 77d5c32c4ebcfffde67e51f6325c6d350ca668a0
|
|
38
|
+
Also adapted from Version: 2.13.1
|
|
39
|
+
Commit: d8c723219a471c711fa2a798a8b85a1f06e2e63d
|
|
40
|
+
UG UI adapts the TreeSelect depth-first node lookup algorithm from 2.14.7,
|
|
41
|
+
and default control surfaces, border/radius tokens and plain-button state
|
|
42
|
+
mixing from 2.13.1. React/Vue components use UG primitives, themes and public
|
|
43
|
+
APIs. Source mappings and local modifications are documented in
|
|
44
|
+
docs/UI_DEVELOPMENT_GUIDE.md.
|
|
45
|
+
|
|
46
|
+
MIT License
|
|
47
|
+
|
|
48
|
+
Copyright (c) 2020-PRESENT Element Plus
|
|
49
|
+
|
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
51
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
52
|
+
in the Software without restriction, including without limitation the rights
|
|
53
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
54
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
55
|
+
furnished to do so, subject to the following conditions:
|
|
56
|
+
|
|
57
|
+
The above copyright notice and this permission notice shall be included in all
|
|
58
|
+
copies or substantial portions of the Software.
|
|
59
|
+
|
|
60
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
61
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
62
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
63
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
64
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
65
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
66
|
+
SOFTWARE.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Element UI
|
|
70
|
+
Source: https://github.com/ElemeFE/element
|
|
71
|
+
Version: 2.15.14
|
|
72
|
+
Commit: 290e68ea6aa6c56b7d83182b650e3be4f77ff1b0
|
|
73
|
+
UG UI adapts color conversion algorithms and selected interaction/structure
|
|
74
|
+
contracts into native React/Vue components, semantic tokens and replaceable
|
|
75
|
+
callbacks. No Element runtime is required. Source mappings and local changes
|
|
76
|
+
are documented in docs/UI_DEVELOPMENT_GUIDE.md.
|
|
77
|
+
|
|
78
|
+
The MIT License (MIT)
|
|
79
|
+
|
|
80
|
+
Copyright (c) 2016-present ElemeFE
|
|
81
|
+
|
|
82
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
83
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
84
|
+
in the Software without restriction, including without limitation the rights
|
|
85
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
86
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
87
|
+
furnished to do so, subject to the following conditions:
|
|
88
|
+
|
|
89
|
+
The above copyright notice and this permission notice shall be included in all
|
|
90
|
+
copies or substantial portions of the Software.
|
|
91
|
+
|
|
92
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
93
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
94
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
95
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
96
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
97
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
98
|
+
SOFTWARE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: Calendar 跨框架日期计算工具,统一 React 与 Vue 的本地日期语义
|
|
3
|
+
* @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。
|
|
4
|
+
* @date: 2026-08-14
|
|
5
|
+
*/
|
|
6
|
+
export type CalendarWeekStartsOn = 0 | 1;
|
|
7
|
+
export interface CalendarDay {
|
|
8
|
+
date: Date;
|
|
9
|
+
key: string;
|
|
10
|
+
day: number;
|
|
11
|
+
outside: boolean;
|
|
12
|
+
today: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function isValidCalendarDate(value: Date | null | undefined): value is Date;
|
|
15
|
+
export declare function normalizeCalendarDate(value: Date | null | undefined, fallback?: Date): Date;
|
|
16
|
+
export declare function startOfCalendarMonth(value: Date): Date;
|
|
17
|
+
export declare function addCalendarDays(value: Date, amount: number): Date;
|
|
18
|
+
export declare function addCalendarMonths(value: Date, amount: number): Date;
|
|
19
|
+
export declare function calendarDateKey(value: Date): string;
|
|
20
|
+
export declare function compareCalendarDates(left: Date, right: Date): number;
|
|
21
|
+
export declare function isSameCalendarDay(left: Date | null | undefined, right: Date | null | undefined): boolean;
|
|
22
|
+
export declare function buildCalendarMonth(month: Date, weekStartsOn?: CalendarWeekStartsOn): CalendarDay[];
|
|
23
|
+
export declare function buildCalendarWeekdays(locale?: string, weekStartsOn?: CalendarWeekStartsOn): string[];
|
|
24
|
+
export declare function formatCalendarMonth(value: Date, locale?: string): string;
|
|
25
|
+
export declare function formatCalendarDay(value: Date, locale?: string): string;
|
|
26
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../src/calendar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,CAAC,CAAA;AAExC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,IAAI,IAAI,CAEjF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,OAAa,GAAG,IAAI,CAGjG;AASD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAEtD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEnE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,CAInD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,CAIpE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMxG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,GAAE,oBAAwB,GAAG,WAAW,EAAE,CAgBrG;AAED,wBAAgB,qBAAqB,CAAC,MAAM,SAAU,EAAE,YAAY,GAAE,oBAAwB,GAAG,MAAM,EAAE,CASxG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,SAAU,GAAG,MAAM,CAMzE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,SAAU,GAAG,MAAM,CAMvE"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
// src/theme.ts
|
|
4
|
+
var defaultUGThemeNavigationColors = {
|
|
5
|
+
default: {
|
|
6
|
+
light: {
|
|
7
|
+
background: "#ffffff",
|
|
8
|
+
text: "#475569",
|
|
9
|
+
activeBackground: "#ecf5ff",
|
|
10
|
+
activeText: "#1d4ed8",
|
|
11
|
+
hoverBackground: "#f1f5f9"
|
|
12
|
+
},
|
|
13
|
+
dark: {
|
|
14
|
+
background: "#151c28",
|
|
15
|
+
text: "#cbd5e1",
|
|
16
|
+
activeBackground: "#3178c2",
|
|
17
|
+
activeText: "#ffffff",
|
|
18
|
+
hoverBackground: "#293442"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
minimal: {
|
|
22
|
+
light: {
|
|
23
|
+
background: "#ffffff",
|
|
24
|
+
text: "#334155",
|
|
25
|
+
activeBackground: "#e0f2fe",
|
|
26
|
+
activeText: "#0369a1",
|
|
27
|
+
hoverBackground: "#f8fafc"
|
|
28
|
+
},
|
|
29
|
+
dark: {
|
|
30
|
+
background: "#111827",
|
|
31
|
+
text: "#d1d5db",
|
|
32
|
+
activeBackground: "#164e63",
|
|
33
|
+
activeText: "#ecfeff",
|
|
34
|
+
hoverBackground: "#1f2937"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
mecha: {
|
|
38
|
+
light: {
|
|
39
|
+
background: "#eef2f6",
|
|
40
|
+
text: "#334155",
|
|
41
|
+
activeBackground: "#cffafe",
|
|
42
|
+
activeText: "#0e7490",
|
|
43
|
+
hoverBackground: "#e2e8f0"
|
|
44
|
+
},
|
|
45
|
+
dark: {
|
|
46
|
+
background: "#0b1220",
|
|
47
|
+
text: "#cbd5e1",
|
|
48
|
+
activeBackground: "#155e75",
|
|
49
|
+
activeText: "#ecfeff",
|
|
50
|
+
hoverBackground: "#172033"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var defaultUGNavigationColors = defaultUGThemeNavigationColors.default;
|
|
55
|
+
function resolveUGNavigationPalette(mode, prefersDark = false) {
|
|
56
|
+
if (mode === "dark") return "dark";
|
|
57
|
+
if (mode === "light") return "light";
|
|
58
|
+
return prefersDark ? "dark" : "light";
|
|
59
|
+
}
|
|
60
|
+
var defaultUGAccentNavigationColors = {
|
|
61
|
+
cyan: {
|
|
62
|
+
light: { activeBackground: "#cffafe", activeText: "#0e7490" },
|
|
63
|
+
dark: { activeBackground: "#0e7490", activeText: "#ecfeff" }
|
|
64
|
+
},
|
|
65
|
+
blue: {
|
|
66
|
+
light: { activeBackground: "#dbeafe", activeText: "#1d4ed8" },
|
|
67
|
+
dark: { activeBackground: "#1d4ed8", activeText: "#eff6ff" }
|
|
68
|
+
},
|
|
69
|
+
violet: {
|
|
70
|
+
light: { activeBackground: "#ede9fe", activeText: "#6d28d9" },
|
|
71
|
+
dark: { activeBackground: "#6d28d9", activeText: "#f5f3ff" }
|
|
72
|
+
},
|
|
73
|
+
emerald: {
|
|
74
|
+
light: { activeBackground: "#d1fae5", activeText: "#047857" },
|
|
75
|
+
dark: { activeBackground: "#047857", activeText: "#ecfdf5" }
|
|
76
|
+
},
|
|
77
|
+
rose: {
|
|
78
|
+
light: { activeBackground: "#ffe4e6", activeText: "#be123c" },
|
|
79
|
+
dark: { activeBackground: "#be123c", activeText: "#fff1f2" }
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function resolveUGNavigationColors(preset, palette, overrides, accent = "theme") {
|
|
83
|
+
if (overrides) return overrides;
|
|
84
|
+
const themeColors = preset in defaultUGThemeNavigationColors ? defaultUGThemeNavigationColors[preset] : defaultUGThemeNavigationColors.default;
|
|
85
|
+
const resolvedColors = themeColors[palette];
|
|
86
|
+
if (accent in defaultUGAccentNavigationColors) {
|
|
87
|
+
return {
|
|
88
|
+
...resolvedColors,
|
|
89
|
+
...defaultUGAccentNavigationColors[accent][palette]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return resolvedColors;
|
|
93
|
+
}
|
|
94
|
+
var ugThemeProfileFields = [
|
|
95
|
+
"density",
|
|
96
|
+
"radius",
|
|
97
|
+
"shadow",
|
|
98
|
+
"font",
|
|
99
|
+
"contrast",
|
|
100
|
+
"motion",
|
|
101
|
+
"background"
|
|
102
|
+
];
|
|
103
|
+
var defaultUGTheme = {
|
|
104
|
+
preset: "default",
|
|
105
|
+
mode: "system",
|
|
106
|
+
surface: "workspace",
|
|
107
|
+
density: "comfortable",
|
|
108
|
+
radius: "default",
|
|
109
|
+
shadow: "standard",
|
|
110
|
+
font: "system",
|
|
111
|
+
contrast: "standard",
|
|
112
|
+
motion: "standard",
|
|
113
|
+
background: "grid",
|
|
114
|
+
accent: "theme"
|
|
115
|
+
};
|
|
116
|
+
var defaultUGThemeProfiles = [
|
|
117
|
+
{
|
|
118
|
+
id: "balanced",
|
|
119
|
+
label: "\u5747\u8861",
|
|
120
|
+
description: "\u8212\u9002\u3001\u6E05\u6670\uFF0C\u9002\u5408\u65E5\u5E38\u901A\u7528\u64CD\u4F5C\u3002",
|
|
121
|
+
value: {
|
|
122
|
+
density: "comfortable",
|
|
123
|
+
radius: "default",
|
|
124
|
+
shadow: "standard",
|
|
125
|
+
font: "system",
|
|
126
|
+
contrast: "standard",
|
|
127
|
+
motion: "standard",
|
|
128
|
+
background: "plain"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "efficient",
|
|
133
|
+
label: "\u9AD8\u6548",
|
|
134
|
+
description: "\u7D27\u51D1\u3001\u5229\u843D\uFF0C\u9002\u5408\u9AD8\u9891\u64CD\u4F5C\u548C\u6570\u636E\u5DE5\u4F5C\u3002",
|
|
135
|
+
value: {
|
|
136
|
+
density: "compact",
|
|
137
|
+
radius: "sharp",
|
|
138
|
+
shadow: "flat",
|
|
139
|
+
font: "compact",
|
|
140
|
+
contrast: "strong",
|
|
141
|
+
motion: "reduced",
|
|
142
|
+
background: "plain"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "readable",
|
|
147
|
+
label: "\u6613\u8BFB",
|
|
148
|
+
description: "\u5BBD\u677E\u3001\u6E05\u6670\uFF0C\u9002\u5408\u957F\u65F6\u95F4\u9605\u8BFB\u548C\u4F4E\u523A\u6FC0\u64CD\u4F5C\u3002",
|
|
149
|
+
value: {
|
|
150
|
+
density: "spacious",
|
|
151
|
+
radius: "soft",
|
|
152
|
+
shadow: "standard",
|
|
153
|
+
font: "readable",
|
|
154
|
+
contrast: "strong",
|
|
155
|
+
motion: "reduced",
|
|
156
|
+
background: "plain"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
var defaultUGThemeConfiguratorOptions = {
|
|
161
|
+
presets: [
|
|
162
|
+
{ value: "default", label: "\u9ED8\u8BA4", description: "\u5747\u8861\u7684\u8FB9\u754C\u3001\u5C42\u6B21\u4E0E\u4FE1\u606F\u5BC6\u5EA6\u3002" },
|
|
163
|
+
{ value: "minimal", label: "\u7B80\u6D01", description: "\u51CF\u5C11\u88C5\u9970\uFF0C\u8BA9\u5185\u5BB9\u6210\u4E3A\u89C6\u89C9\u4E2D\u5FC3\u3002" },
|
|
164
|
+
{ value: "mecha", label: "\u673A\u68B0", description: "\u786C\u6717\u8FB9\u754C\u4E0E\u7D27\u51D1\u7684\u63A7\u5236\u53F0\u8282\u594F\u3002" }
|
|
165
|
+
],
|
|
166
|
+
modes: [
|
|
167
|
+
{ value: "system", label: "\u8DDF\u968F\u7CFB\u7EDF", description: "\u81EA\u52A8\u5339\u914D\u8BBE\u5907\u5916\u89C2\u3002" },
|
|
168
|
+
{ value: "light", label: "\u4EAE\u8272", description: "\u59CB\u7EC8\u4F7F\u7528\u4EAE\u8272\u754C\u9762\u3002" },
|
|
169
|
+
{ value: "dark", label: "\u6697\u8272", description: "\u59CB\u7EC8\u4F7F\u7528\u6697\u8272\u754C\u9762\u3002" }
|
|
170
|
+
],
|
|
171
|
+
surfaces: [
|
|
172
|
+
{ value: "workspace", label: "\u5DE5\u4F5C\u533A" },
|
|
173
|
+
{ value: "showcase", label: "\u5C55\u793A\u9875" },
|
|
174
|
+
{ value: "auth", label: "\u8BA4\u8BC1\u9875" },
|
|
175
|
+
{ value: "content", label: "\u5185\u5BB9\u9875" }
|
|
176
|
+
],
|
|
177
|
+
densities: [
|
|
178
|
+
{ value: "comfortable", label: "\u8212\u9002" },
|
|
179
|
+
{ value: "compact", label: "\u7D27\u51D1" },
|
|
180
|
+
{ value: "spacious", label: "\u5BBD\u677E" }
|
|
181
|
+
],
|
|
182
|
+
radii: [
|
|
183
|
+
{ value: "sharp", label: "\u5229\u843D" },
|
|
184
|
+
{ value: "default", label: "\u9ED8\u8BA4" },
|
|
185
|
+
{ value: "soft", label: "\u67D4\u548C" }
|
|
186
|
+
],
|
|
187
|
+
shadows: [
|
|
188
|
+
{ value: "flat", label: "\u5E73\u9762" },
|
|
189
|
+
{ value: "standard", label: "\u6807\u51C6" },
|
|
190
|
+
{ value: "layered", label: "\u5C42\u6B21" }
|
|
191
|
+
],
|
|
192
|
+
fonts: [
|
|
193
|
+
{ value: "system", label: "\u7CFB\u7EDF" },
|
|
194
|
+
{ value: "readable", label: "\u6613\u8BFB" },
|
|
195
|
+
{ value: "compact", label: "\u7D27\u51D1" }
|
|
196
|
+
],
|
|
197
|
+
contrasts: [
|
|
198
|
+
{ value: "soft", label: "\u67D4\u548C" },
|
|
199
|
+
{ value: "standard", label: "\u6807\u51C6" },
|
|
200
|
+
{ value: "strong", label: "\u6E05\u6670" }
|
|
201
|
+
],
|
|
202
|
+
motions: [
|
|
203
|
+
{ value: "reduced", label: "\u51CF\u5C11" },
|
|
204
|
+
{ value: "standard", label: "\u6807\u51C6" },
|
|
205
|
+
{ value: "lively", label: "\u7075\u52A8" }
|
|
206
|
+
],
|
|
207
|
+
backgrounds: [
|
|
208
|
+
{ value: "plain", label: "\u7EAF\u51C0" },
|
|
209
|
+
{ value: "grid", label: "\u7F51\u683C" },
|
|
210
|
+
{ value: "soft", label: "\u67D4\u5149" }
|
|
211
|
+
],
|
|
212
|
+
accents: [
|
|
213
|
+
{ value: "theme", label: "\u4E3B\u9898\u9ED8\u8BA4" },
|
|
214
|
+
{ value: "cyan", label: "UG \u9752" },
|
|
215
|
+
{ value: "blue", label: "\u6D77\u84DD" },
|
|
216
|
+
{ value: "violet", label: "\u7D2B\u6676" },
|
|
217
|
+
{ value: "emerald", label: "\u677E\u7EFF" },
|
|
218
|
+
{ value: "rose", label: "\u73AB\u7EA2" }
|
|
219
|
+
]
|
|
220
|
+
};
|
|
221
|
+
function createUGThemeValue(parent, overrides) {
|
|
222
|
+
return {
|
|
223
|
+
preset: overrides.preset ?? parent.preset,
|
|
224
|
+
mode: overrides.mode ?? parent.mode,
|
|
225
|
+
surface: overrides.surface ?? parent.surface,
|
|
226
|
+
density: overrides.density ?? parent.density,
|
|
227
|
+
radius: overrides.radius ?? parent.radius,
|
|
228
|
+
shadow: overrides.shadow ?? parent.shadow,
|
|
229
|
+
font: overrides.font ?? parent.font,
|
|
230
|
+
contrast: overrides.contrast ?? parent.contrast,
|
|
231
|
+
motion: overrides.motion ?? parent.motion,
|
|
232
|
+
background: overrides.background ?? parent.background,
|
|
233
|
+
accent: overrides.accent ?? parent.accent
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function applyUGThemeProfile(current, profile) {
|
|
237
|
+
return createUGThemeValue(current, profile.value);
|
|
238
|
+
}
|
|
239
|
+
function isUGThemeProfileModified(current, profile) {
|
|
240
|
+
return ugThemeProfileFields.some((field) => current[field] !== profile.value[field]);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export {
|
|
244
|
+
defaultUGThemeNavigationColors,
|
|
245
|
+
defaultUGNavigationColors,
|
|
246
|
+
resolveUGNavigationPalette,
|
|
247
|
+
resolveUGNavigationColors,
|
|
248
|
+
ugThemeProfileFields,
|
|
249
|
+
defaultUGTheme,
|
|
250
|
+
defaultUGThemeProfiles,
|
|
251
|
+
defaultUGThemeConfiguratorOptions,
|
|
252
|
+
createUGThemeValue,
|
|
253
|
+
applyUGThemeProfile,
|
|
254
|
+
isUGThemeProfileModified
|
|
255
|
+
};
|
|
256
|
+
//# sourceMappingURL=chunk-5S74COKZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme.ts"],"sourcesContent":["/**\n * @description: UG UI 平台无关主题语义与组合规则\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-07-21\n */\nexport type UGThemePreset = 'default' | 'minimal' | 'mecha' | (string & {})\nexport type UGThemeMode = 'light' | 'dark' | 'system'\nexport type UGThemeSurfaceValue = 'workspace' | 'showcase' | 'auth' | 'content' | (string & {})\nexport type UGThemeDensity = 'comfortable' | 'compact' | 'spacious' | (string & {})\nexport type UGThemeRadius = 'sharp' | 'default' | 'soft' | (string & {})\nexport type UGThemeShadow = 'flat' | 'standard' | 'layered' | (string & {})\nexport type UGThemeFont = 'system' | 'readable' | 'compact' | (string & {})\nexport type UGThemeContrast = 'soft' | 'standard' | 'strong' | (string & {})\nexport type UGThemeMotion = 'reduced' | 'standard' | 'lively' | (string & {})\nexport type UGThemeBackground = 'plain' | 'grid' | 'soft' | (string & {})\nexport type UGThemeAccent = 'theme' | 'cyan' | 'blue' | 'violet' | 'emerald' | 'rose' | (string & {})\nexport type UGNavigationMode = 'sidebar' | 'header'\nexport type UGNavigationPalette = 'light' | 'dark'\n\nexport interface UGNavigationColors {\n background: string\n text: string\n activeBackground: string\n activeText: string\n hoverBackground: string\n}\n\nexport type UGThemeNavigationColors = Readonly<Record<UGNavigationPalette, UGNavigationColors>>\n\nexport const defaultUGThemeNavigationColors: Readonly<Record<'default' | 'minimal' | 'mecha', UGThemeNavigationColors>> = {\n default: {\n light: {\n background: '#ffffff',\n text: '#475569',\n activeBackground: '#ecf5ff',\n activeText: '#1d4ed8',\n hoverBackground: '#f1f5f9',\n },\n dark: {\n background: '#151c28',\n text: '#cbd5e1',\n activeBackground: '#3178c2',\n activeText: '#ffffff',\n hoverBackground: '#293442',\n },\n },\n minimal: {\n light: {\n background: '#ffffff',\n text: '#334155',\n activeBackground: '#e0f2fe',\n activeText: '#0369a1',\n hoverBackground: '#f8fafc',\n },\n dark: {\n background: '#111827',\n text: '#d1d5db',\n activeBackground: '#164e63',\n activeText: '#ecfeff',\n hoverBackground: '#1f2937',\n },\n },\n mecha: {\n light: {\n background: '#eef2f6',\n text: '#334155',\n activeBackground: '#cffafe',\n activeText: '#0e7490',\n hoverBackground: '#e2e8f0',\n },\n dark: {\n background: '#0b1220',\n text: '#cbd5e1',\n activeBackground: '#155e75',\n activeText: '#ecfeff',\n hoverBackground: '#172033',\n },\n },\n}\n\n/** 兼容旧调用方:未声明主题时使用 default 主题的导航配色。 */\nexport const defaultUGNavigationColors: UGThemeNavigationColors = defaultUGThemeNavigationColors.default\n\n/** 将主题显示模式解析为导航默认明暗;显式导航颜色仍由调用方优先覆盖。 */\nexport function resolveUGNavigationPalette(\n mode: UGThemeMode,\n prefersDark = false,\n): UGNavigationPalette {\n if (mode === 'dark') return 'dark'\n if (mode === 'light') return 'light'\n return prefersDark ? 'dark' : 'light'\n}\n\ntype UGNavigationActiveColors = Pick<UGNavigationColors, 'activeBackground' | 'activeText'>\n\nconst defaultUGAccentNavigationColors: Readonly<Record<\n 'cyan' | 'blue' | 'violet' | 'emerald' | 'rose',\n Readonly<Record<UGNavigationPalette, UGNavigationActiveColors>>\n>> = {\n cyan: {\n light: { activeBackground: '#cffafe', activeText: '#0e7490' },\n dark: { activeBackground: '#0e7490', activeText: '#ecfeff' },\n },\n blue: {\n light: { activeBackground: '#dbeafe', activeText: '#1d4ed8' },\n dark: { activeBackground: '#1d4ed8', activeText: '#eff6ff' },\n },\n violet: {\n light: { activeBackground: '#ede9fe', activeText: '#6d28d9' },\n dark: { activeBackground: '#6d28d9', activeText: '#f5f3ff' },\n },\n emerald: {\n light: { activeBackground: '#d1fae5', activeText: '#047857' },\n dark: { activeBackground: '#047857', activeText: '#ecfdf5' },\n },\n rose: {\n light: { activeBackground: '#ffe4e6', activeText: '#be123c' },\n dark: { activeBackground: '#be123c', activeText: '#fff1f2' },\n },\n}\n\nexport function resolveUGNavigationColors(\n preset: UGThemePreset,\n palette: UGNavigationPalette,\n overrides?: UGNavigationColors,\n accent: UGThemeAccent = 'theme',\n): UGNavigationColors {\n if (overrides) return overrides\n const themeColors = preset in defaultUGThemeNavigationColors\n ? defaultUGThemeNavigationColors[preset as keyof typeof defaultUGThemeNavigationColors]\n : defaultUGThemeNavigationColors.default\n const resolvedColors = themeColors[palette]\n if (accent in defaultUGAccentNavigationColors) {\n return {\n ...resolvedColors,\n ...defaultUGAccentNavigationColors[accent as keyof typeof defaultUGAccentNavigationColors][palette],\n }\n }\n return resolvedColors\n}\n\nexport interface UGThemeContextValue {\n preset: UGThemePreset\n mode: UGThemeMode\n surface: UGThemeSurfaceValue\n density: UGThemeDensity\n radius: UGThemeRadius\n shadow: UGThemeShadow\n font: UGThemeFont\n contrast: UGThemeContrast\n motion: UGThemeMotion\n background: UGThemeBackground\n accent: UGThemeAccent\n}\n\nexport const ugThemeProfileFields = [\n 'density',\n 'radius',\n 'shadow',\n 'font',\n 'contrast',\n 'motion',\n 'background',\n] as const\n\nexport type UGThemeProfileField = (typeof ugThemeProfileFields)[number]\nexport type UGThemeProfileValue = Pick<UGThemeContextValue, UGThemeProfileField>\n\nexport interface UGThemeProfileDefinition {\n readonly id: string\n readonly label: string\n readonly description: string\n readonly value: UGThemeProfileValue\n}\n\nexport interface UGThemeChoiceOption<TValue extends string = string> {\n readonly value: TValue\n readonly label: string\n readonly description?: string\n}\n\nexport interface UGThemeConfiguratorOptions {\n readonly presets: readonly UGThemeChoiceOption<UGThemePreset>[]\n readonly modes: readonly UGThemeChoiceOption<UGThemeMode>[]\n readonly surfaces: readonly UGThemeChoiceOption<UGThemeSurfaceValue>[]\n readonly densities: readonly UGThemeChoiceOption<UGThemeDensity>[]\n readonly radii: readonly UGThemeChoiceOption<UGThemeRadius>[]\n readonly shadows: readonly UGThemeChoiceOption<UGThemeShadow>[]\n readonly fonts: readonly UGThemeChoiceOption<UGThemeFont>[]\n readonly contrasts: readonly UGThemeChoiceOption<UGThemeContrast>[]\n readonly motions: readonly UGThemeChoiceOption<UGThemeMotion>[]\n readonly backgrounds: readonly UGThemeChoiceOption<UGThemeBackground>[]\n readonly accents: readonly UGThemeChoiceOption<UGThemeAccent>[]\n}\n\nexport const defaultUGTheme: UGThemeContextValue = {\n preset: 'default', mode: 'system', surface: 'workspace', density: 'comfortable', radius: 'default',\n shadow: 'standard', font: 'system', contrast: 'standard', motion: 'standard', background: 'grid', accent: 'theme',\n}\n\nexport const defaultUGThemeProfiles: readonly UGThemeProfileDefinition[] = [\n {\n id: 'balanced',\n label: '均衡',\n description: '舒适、清晰,适合日常通用操作。',\n value: {\n density: 'comfortable',\n radius: 'default',\n shadow: 'standard',\n font: 'system',\n contrast: 'standard',\n motion: 'standard',\n background: 'plain',\n },\n },\n {\n id: 'efficient',\n label: '高效',\n description: '紧凑、利落,适合高频操作和数据工作。',\n value: {\n density: 'compact',\n radius: 'sharp',\n shadow: 'flat',\n font: 'compact',\n contrast: 'strong',\n motion: 'reduced',\n background: 'plain',\n },\n },\n {\n id: 'readable',\n label: '易读',\n description: '宽松、清晰,适合长时间阅读和低刺激操作。',\n value: {\n density: 'spacious',\n radius: 'soft',\n shadow: 'standard',\n font: 'readable',\n contrast: 'strong',\n motion: 'reduced',\n background: 'plain',\n },\n },\n] as const\n\nexport const defaultUGThemeConfiguratorOptions: UGThemeConfiguratorOptions = {\n presets: [\n { value: 'default', label: '默认', description: '均衡的边界、层次与信息密度。' },\n { value: 'minimal', label: '简洁', description: '减少装饰,让内容成为视觉中心。' },\n { value: 'mecha', label: '机械', description: '硬朗边界与紧凑的控制台节奏。' },\n ],\n modes: [\n { value: 'system', label: '跟随系统', description: '自动匹配设备外观。' },\n { value: 'light', label: '亮色', description: '始终使用亮色界面。' },\n { value: 'dark', label: '暗色', description: '始终使用暗色界面。' },\n ],\n surfaces: [\n { value: 'workspace', label: '工作区' },\n { value: 'showcase', label: '展示页' },\n { value: 'auth', label: '认证页' },\n { value: 'content', label: '内容页' },\n ],\n densities: [\n { value: 'comfortable', label: '舒适' },\n { value: 'compact', label: '紧凑' },\n { value: 'spacious', label: '宽松' },\n ],\n radii: [\n { value: 'sharp', label: '利落' },\n { value: 'default', label: '默认' },\n { value: 'soft', label: '柔和' },\n ],\n shadows: [\n { value: 'flat', label: '平面' },\n { value: 'standard', label: '标准' },\n { value: 'layered', label: '层次' },\n ],\n fonts: [\n { value: 'system', label: '系统' },\n { value: 'readable', label: '易读' },\n { value: 'compact', label: '紧凑' },\n ],\n contrasts: [\n { value: 'soft', label: '柔和' },\n { value: 'standard', label: '标准' },\n { value: 'strong', label: '清晰' },\n ],\n motions: [\n { value: 'reduced', label: '减少' },\n { value: 'standard', label: '标准' },\n { value: 'lively', label: '灵动' },\n ],\n backgrounds: [\n { value: 'plain', label: '纯净' },\n { value: 'grid', label: '网格' },\n { value: 'soft', label: '柔光' },\n ],\n accents: [\n { value: 'theme', label: '主题默认' },\n { value: 'cyan', label: 'UG 青' },\n { value: 'blue', label: '海蓝' },\n { value: 'violet', label: '紫晶' },\n { value: 'emerald', label: '松绿' },\n { value: 'rose', label: '玫红' },\n ],\n}\n\nexport function createUGThemeValue(parent: UGThemeContextValue, overrides: Partial<UGThemeContextValue>): UGThemeContextValue {\n return {\n preset: overrides.preset ?? parent.preset,\n mode: overrides.mode ?? parent.mode,\n surface: overrides.surface ?? parent.surface,\n density: overrides.density ?? parent.density,\n radius: overrides.radius ?? parent.radius,\n shadow: overrides.shadow ?? parent.shadow,\n font: overrides.font ?? parent.font,\n contrast: overrides.contrast ?? parent.contrast,\n motion: overrides.motion ?? parent.motion,\n background: overrides.background ?? parent.background,\n accent: overrides.accent ?? parent.accent,\n }\n}\n\nexport function applyUGThemeProfile(\n current: UGThemeContextValue,\n profile: UGThemeProfileDefinition,\n): UGThemeContextValue {\n return createUGThemeValue(current, profile.value)\n}\n\nexport function isUGThemeProfileModified(\n current: UGThemeContextValue,\n profile: UGThemeProfileDefinition,\n): boolean {\n return ugThemeProfileFields.some((field) => current[field] !== profile.value[field])\n}\n"],"mappings":";;;AA6BO,IAAM,iCAA6G;AAAA,EACxH,SAAS;AAAA,IACP,OAAO;AAAA,MACL,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACnB;AAAA,IACA,MAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACnB;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,MACL,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACnB;AAAA,IACA,MAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,iBAAiB;AAAA,IACnB;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,OAAO;AAAA,MACL,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ACqB;AACrB,SAAO,mBAAmB,SAAS,QAAQ,KAAK;AAClD;AAEO,SAAS,yBACd,SACA,SACS;AACT,SAAO,qBAAqB,KAAK,CAAC,UAAU,QAAQ,KAAK,MAAM,QAAQ,MAAM,KAAK,CAAC;AACrF;","names":[]}
|
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: 颜色选择的纯 HSV/HEX 转换;不依赖 DOM 或框架
|
|
3
|
+
* @author: UG
|
|
4
|
+
* @date: 2026-10-11
|
|
5
|
+
* @source: Element UI 2.15.14 packages/color-picker/src/color.js
|
|
6
|
+
* commit 290e68ea6aa6c56b7d83182b650e3be4f77ff1b0, MIT, Copyright ElemeFE.
|
|
7
|
+
* 改编:移除 Color 可变类和宽松解析,只接受完整 HEX,保留 alpha 精度。
|
|
8
|
+
*/
|
|
9
|
+
export interface ColorHsva {
|
|
10
|
+
h: number;
|
|
11
|
+
s: number;
|
|
12
|
+
v: number;
|
|
13
|
+
a: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseColorHex(value: string): ColorHsva | undefined;
|
|
16
|
+
export declare function formatColorHex(color: ColorHsva, alpha?: boolean): string;
|
|
17
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AAIzE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAgBlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,UAAQ,GAAG,MAAM,CAYtE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type DateTimeValueConstraints, type DateValueConstraints } from './date-time';
|
|
2
|
+
export type DatePickerMode = 'date' | 'year' | 'month' | 'week' | 'multiple';
|
|
3
|
+
export type DatePickerDates = readonly string[];
|
|
4
|
+
export type DateTimeRangeValue = readonly [string, string];
|
|
5
|
+
export interface DateRangeShortcut {
|
|
6
|
+
label: string;
|
|
7
|
+
value: readonly [string, string] | (() => readonly [string, string]);
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function isoWeekStart(date: Date): Date;
|
|
11
|
+
export declare function datePickerModeKey(date: Date, mode: DatePickerMode): string;
|
|
12
|
+
export declare function parseDatePickerModeKey(value: string, mode: DatePickerMode): Date | null;
|
|
13
|
+
export declare function validateDatePickerModeValue(value: string, mode?: DatePickerMode, policy?: DateValueConstraints): string | undefined;
|
|
14
|
+
export declare function validateDateTimeRangeValue(value: DateTimeRangeValue, policy?: DateTimeValueConstraints): string | undefined;
|
|
15
|
+
export declare function validateDateRangeShortcut(value: readonly [string, string], policy?: DateValueConstraints): string | undefined;
|
|
16
|
+
//# sourceMappingURL=date-picker-modes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-modes.d.ts","sourceRoot":"","sources":["../src/date-picker-modes.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyB,KAAK,wBAAwB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC7G,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAA;AAC5E,MAAM,MAAM,eAAe,GAAG,SAAS,MAAM,EAAE,CAAA;AAC/C,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC1D,MAAM,WAAW,iBAAiB;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE;AAG9I,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAA0J;AACxM,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAS1E;AACD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAQvF;AACD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,cAAuB,EAAE,MAAM,GAAE,oBAAyB,GAAG,MAAM,GAAG,SAAS,CAuB/I;AACD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,GAAE,wBAA6B,GAAG,MAAM,GAAG,SAAS,CAI/H;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAE,oBAAyB,GAAG,MAAM,GAAG,SAAS,CAGjI"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type DateRangeValue = readonly [string, string];
|
|
2
|
+
export type CalendarRange = readonly [Date | null, Date | null];
|
|
3
|
+
export type CalendarRangePosition = 'start' | 'end' | 'middle' | 'single';
|
|
4
|
+
/** 严格解析 YYYY-MM-DD;拒绝日期溢出并保留 0000–0099 年。 */
|
|
5
|
+
export declare function parseCalendarDateKey(value: string | undefined): Date | null;
|
|
6
|
+
export declare function parseCalendarRange(value: DateRangeValue): CalendarRange;
|
|
7
|
+
/** 反向或单边草稿只显示真实端点,不伪造中间范围。 */
|
|
8
|
+
export declare function getCalendarRangePosition(date: Date, range?: CalendarRange): CalendarRangePosition | undefined;
|
|
9
|
+
//# sourceMappingURL=date-range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../src/date-range.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtD,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAA;AAC/D,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEzE,6CAA6C;AAC7C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAU3E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,CAEvE;AAED,8BAA8B;AAC9B,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,qBAAqB,GAAG,SAAS,CAQ7G"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type TimeRangeValue = readonly [string, string];
|
|
2
|
+
export interface TimeValueConstraints {
|
|
3
|
+
showSeconds?: boolean;
|
|
4
|
+
min?: string;
|
|
5
|
+
max?: string;
|
|
6
|
+
disabledTime?: (value: string) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface DateValueConstraints {
|
|
9
|
+
min?: string;
|
|
10
|
+
max?: string;
|
|
11
|
+
disabledDate?: (date: Date) => boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DateTimeValueConstraints extends TimeValueConstraints {
|
|
14
|
+
disabledDate?: (date: Date) => boolean;
|
|
15
|
+
}
|
|
16
|
+
/** HH:mm 或 HH:mm:ss,24:00、溢出、缺少补零均无效。 */
|
|
17
|
+
export declare function parseTimeValue(value: string | undefined, showSeconds?: boolean): number | null;
|
|
18
|
+
export declare function formatTimeValue(seconds: number, showSeconds?: boolean): string;
|
|
19
|
+
/** 同一个本地日历规则用于单日期和日期时间;不使用 Date.parse。 */
|
|
20
|
+
export declare function validateDateValue(value: string, options?: DateValueConstraints): string | undefined;
|
|
21
|
+
export declare function validateTimeValue(value: string, options?: TimeValueConstraints): string | undefined;
|
|
22
|
+
export declare function parseLocalDateTimeValue(value: string, showSeconds?: boolean): {
|
|
23
|
+
date: Date;
|
|
24
|
+
time: string;
|
|
25
|
+
} | null;
|
|
26
|
+
export declare function validateDateTimeValue(value: string, options?: DateTimeValueConstraints): string | undefined;
|
|
27
|
+
export declare function validateTimeRangeValue(value: TimeRangeValue, options?: TimeValueConstraints): string | undefined;
|
|
28
|
+
/** 固定时间段列表;无效或零步长返回空列表,最多一天的分钟数,不会死循环。 */
|
|
29
|
+
export declare function buildTimeSelectOptions(start?: string, end?: string, step?: string, constraints?: TimeValueConstraints): {
|
|
30
|
+
value: string;
|
|
31
|
+
label: string;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
}[];
|
|
34
|
+
/** 面板只枚举实际合法时刻;列切换能够跨越不连续的可选区间。 */
|
|
35
|
+
export declare function getAvailableTimeValues(options?: TimeValueConstraints): number[];
|
|
36
|
+
export declare function getTimeColumnChoices(available: readonly number[], current: number, unit: 'hour' | 'minute' | 'second'): {
|
|
37
|
+
label: string;
|
|
38
|
+
value: number;
|
|
39
|
+
time: number | undefined;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
}[];
|
|
42
|
+
export declare function localDateTimeKey(date: Date, time: string): string;
|
|
43
|
+
//# sourceMappingURL=date-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time.d.ts","sourceRoot":"","sources":["../src/date-time.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtD,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAA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SAAU,EAAE,IAAI,SAAU,EAAE,WAAW,GAAE,oBAAyB;WAKnG,MAAM;WAAS,MAAM;cAAY,OAAO;IAMjE;AAED,mCAAmC;AACnC,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,EAAE,CASnF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ;;;;;IAcrH;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @description 表单嵌套路径的不可变读写与动态数组身份;不含框架和 DOM。 @author UG @date 2026-10-11 */
|
|
2
|
+
export type FormFieldName<T> = Extract<keyof T, string> | (string & {});
|
|
3
|
+
export type FormSetFieldValue<T> = <Key extends FormFieldName<T>>(name: Key, value: Key extends keyof T ? T[Key] : unknown) => void;
|
|
4
|
+
export declare function isFormPathWithin(field: string, parent: string): boolean;
|
|
5
|
+
export interface FormFieldArrayEntry<T = unknown> {
|
|
6
|
+
id: string;
|
|
7
|
+
index: number;
|
|
8
|
+
name: string;
|
|
9
|
+
value: T;
|
|
10
|
+
}
|
|
11
|
+
export interface FormFieldArray<T = unknown> {
|
|
12
|
+
readonly fields: readonly FormFieldArrayEntry<T>[];
|
|
13
|
+
append(value: T): void;
|
|
14
|
+
insert(index: number, value: T): void;
|
|
15
|
+
remove(index: number): void;
|
|
16
|
+
move(from: number, to: number): void;
|
|
17
|
+
replace(values: readonly T[]): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function normalizeFormPath(path: string): string;
|
|
20
|
+
export declare function getFormPath(values: unknown, path: string): unknown;
|
|
21
|
+
/** 数组删除后不存在的数字索引不参与校验;普通未填写字段仍参与 required。 */
|
|
22
|
+
export declare function isFormPathActive(values: unknown, path: string): boolean;
|
|
23
|
+
export declare function setFormPath<T>(values: T, path: string, value: unknown): T;
|
|
24
|
+
export declare function getFormPaths(values: unknown, prefix?: string): string[];
|
|
25
|
+
export declare function isFormValueEqual(left: unknown, right: unknown): boolean;
|
|
26
|
+
export declare function createFormFieldArray<T>(path: string, read: () => unknown, write: (values: readonly T[]) => void): {
|
|
27
|
+
controller: FormFieldArray<T>;
|
|
28
|
+
resetIds(): void;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=form-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../src/form-state.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AACvE,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;AACnI,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGvE;AACD,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAAI,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE;AACvG,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAA;IAClD,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACtB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAA;CACpC;AACD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AACD,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOlE;AACD,8CAA8C;AAC9C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOvE;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAWzE;AACD,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,SAAK,GAAG,MAAM,EAAE,CAQnE;AACD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAQvE;AACD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,IAAI;;;EAgC/G"}
|
|
@@ -8,6 +8,7 @@ export type FormValueType = 'string' | 'number' | 'boolean' | 'array' | 'date' |
|
|
|
8
8
|
export interface FormRule<Value = unknown, Values extends Record<string, unknown> = Record<string, unknown>> {
|
|
9
9
|
required?: boolean;
|
|
10
10
|
message?: string;
|
|
11
|
+
/** change/blur 控制即时校验时机;提交与主动 validate 始终检查全部规则。 */
|
|
11
12
|
trigger?: FormValidationTrigger | FormValidationTrigger[];
|
|
12
13
|
type?: FormValueType;
|
|
13
14
|
min?: number;
|
|
@@ -19,7 +20,7 @@ export interface FormRule<Value = unknown, Values extends Record<string, unknown
|
|
|
19
20
|
export type FormFieldRules<Value = unknown, Values extends Record<string, unknown> = Record<string, unknown>> = FormRule<Value, Values> | FormRule<Value, Values>[];
|
|
20
21
|
export type FormRules<Values extends Record<string, unknown>> = Partial<{
|
|
21
22
|
[Key in keyof Values]: FormFieldRules<Values[Key], Values>;
|
|
22
|
-
}
|
|
23
|
+
}> & Partial<Record<`${string}.${string}` | `${string}[${number}]${string}`, FormFieldRules<unknown, Values>>>;
|
|
23
24
|
export declare function isEmptyFormValue(value: unknown): boolean;
|
|
24
25
|
export declare function validateFormValue<Values extends Record<string, unknown>, Key extends keyof Values>(value: Values[Key], fieldRules: FormFieldRules<Values[Key], Values> | undefined, values: Values, trigger?: FormValidationTrigger): Promise<string | undefined>;
|
|
25
26
|
//# sourceMappingURL=form-validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-validation.d.ts","sourceRoot":"","sources":["../src/form-validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AAChE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;AAEhG,MAAM,WAAW,QAAQ,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzG,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,CAAA;IACzD,IAAI,CAAC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,CAAC,EACtC,GAAG,SAAS,MAAM,MAAM,EAExB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAClB,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3D,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAAgC,GACxC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAyC7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @description: 图片适配、缩放及旋转后的真实滚动画布尺寸 @author: UG @date: 2026-10-11 */
|
|
2
|
+
export declare function getImagePreviewLayout(width: number, height: number, viewportWidth: number, viewportHeight: number, zoom?: number, rotation?: number): {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
canvasWidth: number;
|
|
6
|
+
canvasHeight: number;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=image-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-preview.d.ts","sourceRoot":"","sources":["../src/image-preview.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,QAAQ,SAAI;;;;;EAQzI"}
|