@ug666/ui-core 0.3.0-beta.2 → 0.3.0-beta.3

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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/RELEASE_PROVENANCE.json +8 -0
  3. package/dist/chunk-SSXPAFU2.js +3 -0
  4. package/dist/chunk-SSXPAFU2.js.map +1 -0
  5. package/dist/compat/table-css.d.ts +12 -0
  6. package/dist/compat/table-css.d.ts.map +1 -0
  7. package/dist/controls/rating.d.ts.map +1 -0
  8. package/dist/controls/select-value.d.ts.map +1 -0
  9. package/dist/controls/selection-list.d.ts.map +1 -0
  10. package/dist/controls/text-value.d.ts.map +1 -0
  11. package/dist/date-time/calendar.d.ts.map +1 -0
  12. package/dist/date-time/date-picker-modes.d.ts.map +1 -0
  13. package/dist/date-time/date-range.d.ts.map +1 -0
  14. package/dist/date-time/date-time.d.ts.map +1 -0
  15. package/dist/form/form-state.d.ts.map +1 -0
  16. package/dist/form/form-validation.d.ts.map +1 -0
  17. package/dist/index.cjs +1 -1238
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +18 -17
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -907
  22. package/dist/index.js.map +1 -1
  23. package/dist/{table-layout.d.ts → table/table-layout.d.ts} +2 -8
  24. package/dist/table/table-layout.d.ts.map +1 -0
  25. package/dist/table/table-structure.d.ts.map +1 -0
  26. package/dist/table/tree-table.d.ts.map +1 -0
  27. package/dist/theme/color.d.ts.map +1 -0
  28. package/dist/theme/state.d.ts +79 -0
  29. package/dist/theme/state.d.ts.map +1 -0
  30. package/dist/theme.cjs +1 -287
  31. package/dist/theme.cjs.map +1 -1
  32. package/dist/theme.d.ts +2 -78
  33. package/dist/theme.d.ts.map +1 -1
  34. package/dist/theme.js +1 -26
  35. package/dist/tree/tree-check.d.ts.map +1 -0
  36. package/dist/tree/tree-drag.d.ts.map +1 -0
  37. package/dist/tree/tree-path.d.ts.map +1 -0
  38. package/package.json +2 -1
  39. package/dist/calendar.d.ts.map +0 -1
  40. package/dist/chunk-5S74COKZ.js +0 -256
  41. package/dist/chunk-5S74COKZ.js.map +0 -1
  42. package/dist/color.d.ts.map +0 -1
  43. package/dist/date-picker-modes.d.ts.map +0 -1
  44. package/dist/date-range.d.ts.map +0 -1
  45. package/dist/date-time.d.ts.map +0 -1
  46. package/dist/form-state.d.ts.map +0 -1
  47. package/dist/form-validation.d.ts.map +0 -1
  48. package/dist/rating.d.ts.map +0 -1
  49. package/dist/select-value.d.ts.map +0 -1
  50. package/dist/selection-list.d.ts.map +0 -1
  51. package/dist/table-layout.d.ts.map +0 -1
  52. package/dist/table-structure.d.ts.map +0 -1
  53. package/dist/text-value.d.ts.map +0 -1
  54. package/dist/tree-check.d.ts.map +0 -1
  55. package/dist/tree-drag.d.ts.map +0 -1
  56. package/dist/tree-path.d.ts.map +0 -1
  57. package/dist/tree-table.d.ts.map +0 -1
  58. /package/dist/{rating.d.ts → controls/rating.d.ts} +0 -0
  59. /package/dist/{select-value.d.ts → controls/select-value.d.ts} +0 -0
  60. /package/dist/{selection-list.d.ts → controls/selection-list.d.ts} +0 -0
  61. /package/dist/{text-value.d.ts → controls/text-value.d.ts} +0 -0
  62. /package/dist/{calendar.d.ts → date-time/calendar.d.ts} +0 -0
  63. /package/dist/{date-picker-modes.d.ts → date-time/date-picker-modes.d.ts} +0 -0
  64. /package/dist/{date-range.d.ts → date-time/date-range.d.ts} +0 -0
  65. /package/dist/{date-time.d.ts → date-time/date-time.d.ts} +0 -0
  66. /package/dist/{form-state.d.ts → form/form-state.d.ts} +0 -0
  67. /package/dist/{form-validation.d.ts → form/form-validation.d.ts} +0 -0
  68. /package/dist/{table-structure.d.ts → table/table-structure.d.ts} +0 -0
  69. /package/dist/{tree-table.d.ts → table/tree-table.d.ts} +0 -0
  70. /package/dist/{color.d.ts → theme/color.d.ts} +0 -0
  71. /package/dist/{tree-check.d.ts → tree/tree-check.d.ts} +0 -0
  72. /package/dist/{tree-drag.d.ts → tree/tree-drag.d.ts} +0 -0
  73. /package/dist/{tree-path.d.ts → tree/tree-path.d.ts} +0 -0
package/dist/theme.cjs CHANGED
@@ -1,289 +1,3 @@
1
1
  "use client"
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/theme.ts
22
- var theme_exports = {};
23
- __export(theme_exports, {
24
- applyUGThemeProfile: () => applyUGThemeProfile,
25
- createUGThemeValue: () => createUGThemeValue,
26
- defaultUGNavigationColors: () => defaultUGNavigationColors,
27
- defaultUGTheme: () => defaultUGTheme,
28
- defaultUGThemeConfiguratorOptions: () => defaultUGThemeConfiguratorOptions,
29
- defaultUGThemeNavigationColors: () => defaultUGThemeNavigationColors,
30
- defaultUGThemeProfiles: () => defaultUGThemeProfiles,
31
- isUGThemeProfileModified: () => isUGThemeProfileModified,
32
- resolveUGNavigationColors: () => resolveUGNavigationColors,
33
- resolveUGNavigationPalette: () => resolveUGNavigationPalette,
34
- ugThemeProfileFields: () => ugThemeProfileFields
35
- });
36
- module.exports = __toCommonJS(theme_exports);
37
- var defaultUGThemeNavigationColors = {
38
- default: {
39
- light: {
40
- background: "#ffffff",
41
- text: "#475569",
42
- activeBackground: "#ecf5ff",
43
- activeText: "#1d4ed8",
44
- hoverBackground: "#f1f5f9"
45
- },
46
- dark: {
47
- background: "#151c28",
48
- text: "#cbd5e1",
49
- activeBackground: "#3178c2",
50
- activeText: "#ffffff",
51
- hoverBackground: "#293442"
52
- }
53
- },
54
- minimal: {
55
- light: {
56
- background: "#ffffff",
57
- text: "#334155",
58
- activeBackground: "#e0f2fe",
59
- activeText: "#0369a1",
60
- hoverBackground: "#f8fafc"
61
- },
62
- dark: {
63
- background: "#111827",
64
- text: "#d1d5db",
65
- activeBackground: "#164e63",
66
- activeText: "#ecfeff",
67
- hoverBackground: "#1f2937"
68
- }
69
- },
70
- mecha: {
71
- light: {
72
- background: "#eef2f6",
73
- text: "#334155",
74
- activeBackground: "#cffafe",
75
- activeText: "#0e7490",
76
- hoverBackground: "#e2e8f0"
77
- },
78
- dark: {
79
- background: "#0b1220",
80
- text: "#cbd5e1",
81
- activeBackground: "#155e75",
82
- activeText: "#ecfeff",
83
- hoverBackground: "#172033"
84
- }
85
- }
86
- };
87
- var defaultUGNavigationColors = defaultUGThemeNavigationColors.default;
88
- function resolveUGNavigationPalette(mode, prefersDark = false) {
89
- if (mode === "dark") return "dark";
90
- if (mode === "light") return "light";
91
- return prefersDark ? "dark" : "light";
92
- }
93
- var defaultUGAccentNavigationColors = {
94
- cyan: {
95
- light: { activeBackground: "#cffafe", activeText: "#0e7490" },
96
- dark: { activeBackground: "#0e7490", activeText: "#ecfeff" }
97
- },
98
- blue: {
99
- light: { activeBackground: "#dbeafe", activeText: "#1d4ed8" },
100
- dark: { activeBackground: "#1d4ed8", activeText: "#eff6ff" }
101
- },
102
- violet: {
103
- light: { activeBackground: "#ede9fe", activeText: "#6d28d9" },
104
- dark: { activeBackground: "#6d28d9", activeText: "#f5f3ff" }
105
- },
106
- emerald: {
107
- light: { activeBackground: "#d1fae5", activeText: "#047857" },
108
- dark: { activeBackground: "#047857", activeText: "#ecfdf5" }
109
- },
110
- rose: {
111
- light: { activeBackground: "#ffe4e6", activeText: "#be123c" },
112
- dark: { activeBackground: "#be123c", activeText: "#fff1f2" }
113
- }
114
- };
115
- function resolveUGNavigationColors(preset, palette, overrides, accent = "theme") {
116
- if (overrides) return overrides;
117
- const themeColors = preset in defaultUGThemeNavigationColors ? defaultUGThemeNavigationColors[preset] : defaultUGThemeNavigationColors.default;
118
- const resolvedColors = themeColors[palette];
119
- if (accent in defaultUGAccentNavigationColors) {
120
- return {
121
- ...resolvedColors,
122
- ...defaultUGAccentNavigationColors[accent][palette]
123
- };
124
- }
125
- return resolvedColors;
126
- }
127
- var ugThemeProfileFields = [
128
- "density",
129
- "radius",
130
- "shadow",
131
- "font",
132
- "contrast",
133
- "motion",
134
- "background"
135
- ];
136
- var defaultUGTheme = {
137
- preset: "default",
138
- mode: "system",
139
- surface: "workspace",
140
- density: "comfortable",
141
- radius: "default",
142
- shadow: "standard",
143
- font: "system",
144
- contrast: "standard",
145
- motion: "standard",
146
- background: "grid",
147
- accent: "theme"
148
- };
149
- var defaultUGThemeProfiles = [
150
- {
151
- id: "balanced",
152
- label: "\u5747\u8861",
153
- description: "\u8212\u9002\u3001\u6E05\u6670\uFF0C\u9002\u5408\u65E5\u5E38\u901A\u7528\u64CD\u4F5C\u3002",
154
- value: {
155
- density: "comfortable",
156
- radius: "default",
157
- shadow: "standard",
158
- font: "system",
159
- contrast: "standard",
160
- motion: "standard",
161
- background: "plain"
162
- }
163
- },
164
- {
165
- id: "efficient",
166
- label: "\u9AD8\u6548",
167
- description: "\u7D27\u51D1\u3001\u5229\u843D\uFF0C\u9002\u5408\u9AD8\u9891\u64CD\u4F5C\u548C\u6570\u636E\u5DE5\u4F5C\u3002",
168
- value: {
169
- density: "compact",
170
- radius: "sharp",
171
- shadow: "flat",
172
- font: "compact",
173
- contrast: "strong",
174
- motion: "reduced",
175
- background: "plain"
176
- }
177
- },
178
- {
179
- id: "readable",
180
- label: "\u6613\u8BFB",
181
- description: "\u5BBD\u677E\u3001\u6E05\u6670\uFF0C\u9002\u5408\u957F\u65F6\u95F4\u9605\u8BFB\u548C\u4F4E\u523A\u6FC0\u64CD\u4F5C\u3002",
182
- value: {
183
- density: "spacious",
184
- radius: "soft",
185
- shadow: "standard",
186
- font: "readable",
187
- contrast: "strong",
188
- motion: "reduced",
189
- background: "plain"
190
- }
191
- }
192
- ];
193
- var defaultUGThemeConfiguratorOptions = {
194
- presets: [
195
- { value: "default", label: "\u9ED8\u8BA4", description: "\u5747\u8861\u7684\u8FB9\u754C\u3001\u5C42\u6B21\u4E0E\u4FE1\u606F\u5BC6\u5EA6\u3002" },
196
- { value: "minimal", label: "\u7B80\u6D01", description: "\u51CF\u5C11\u88C5\u9970\uFF0C\u8BA9\u5185\u5BB9\u6210\u4E3A\u89C6\u89C9\u4E2D\u5FC3\u3002" },
197
- { value: "mecha", label: "\u673A\u68B0", description: "\u786C\u6717\u8FB9\u754C\u4E0E\u7D27\u51D1\u7684\u63A7\u5236\u53F0\u8282\u594F\u3002" }
198
- ],
199
- modes: [
200
- { value: "system", label: "\u8DDF\u968F\u7CFB\u7EDF", description: "\u81EA\u52A8\u5339\u914D\u8BBE\u5907\u5916\u89C2\u3002" },
201
- { value: "light", label: "\u4EAE\u8272", description: "\u59CB\u7EC8\u4F7F\u7528\u4EAE\u8272\u754C\u9762\u3002" },
202
- { value: "dark", label: "\u6697\u8272", description: "\u59CB\u7EC8\u4F7F\u7528\u6697\u8272\u754C\u9762\u3002" }
203
- ],
204
- surfaces: [
205
- { value: "workspace", label: "\u5DE5\u4F5C\u533A" },
206
- { value: "showcase", label: "\u5C55\u793A\u9875" },
207
- { value: "auth", label: "\u8BA4\u8BC1\u9875" },
208
- { value: "content", label: "\u5185\u5BB9\u9875" }
209
- ],
210
- densities: [
211
- { value: "comfortable", label: "\u8212\u9002" },
212
- { value: "compact", label: "\u7D27\u51D1" },
213
- { value: "spacious", label: "\u5BBD\u677E" }
214
- ],
215
- radii: [
216
- { value: "sharp", label: "\u5229\u843D" },
217
- { value: "default", label: "\u9ED8\u8BA4" },
218
- { value: "soft", label: "\u67D4\u548C" }
219
- ],
220
- shadows: [
221
- { value: "flat", label: "\u5E73\u9762" },
222
- { value: "standard", label: "\u6807\u51C6" },
223
- { value: "layered", label: "\u5C42\u6B21" }
224
- ],
225
- fonts: [
226
- { value: "system", label: "\u7CFB\u7EDF" },
227
- { value: "readable", label: "\u6613\u8BFB" },
228
- { value: "compact", label: "\u7D27\u51D1" }
229
- ],
230
- contrasts: [
231
- { value: "soft", label: "\u67D4\u548C" },
232
- { value: "standard", label: "\u6807\u51C6" },
233
- { value: "strong", label: "\u6E05\u6670" }
234
- ],
235
- motions: [
236
- { value: "reduced", label: "\u51CF\u5C11" },
237
- { value: "standard", label: "\u6807\u51C6" },
238
- { value: "lively", label: "\u7075\u52A8" }
239
- ],
240
- backgrounds: [
241
- { value: "plain", label: "\u7EAF\u51C0" },
242
- { value: "grid", label: "\u7F51\u683C" },
243
- { value: "soft", label: "\u67D4\u5149" }
244
- ],
245
- accents: [
246
- { value: "theme", label: "\u4E3B\u9898\u9ED8\u8BA4" },
247
- { value: "cyan", label: "UG \u9752" },
248
- { value: "blue", label: "\u6D77\u84DD" },
249
- { value: "violet", label: "\u7D2B\u6676" },
250
- { value: "emerald", label: "\u677E\u7EFF" },
251
- { value: "rose", label: "\u73AB\u7EA2" }
252
- ]
253
- };
254
- function createUGThemeValue(parent, overrides) {
255
- return {
256
- preset: overrides.preset ?? parent.preset,
257
- mode: overrides.mode ?? parent.mode,
258
- surface: overrides.surface ?? parent.surface,
259
- density: overrides.density ?? parent.density,
260
- radius: overrides.radius ?? parent.radius,
261
- shadow: overrides.shadow ?? parent.shadow,
262
- font: overrides.font ?? parent.font,
263
- contrast: overrides.contrast ?? parent.contrast,
264
- motion: overrides.motion ?? parent.motion,
265
- background: overrides.background ?? parent.background,
266
- accent: overrides.accent ?? parent.accent
267
- };
268
- }
269
- function applyUGThemeProfile(current, profile) {
270
- return createUGThemeValue(current, profile.value);
271
- }
272
- function isUGThemeProfileModified(current, profile) {
273
- return ugThemeProfileFields.some((field) => current[field] !== profile.value[field]);
274
- }
275
- // Annotate the CommonJS export names for ESM import in node:
276
- 0 && (module.exports = {
277
- applyUGThemeProfile,
278
- createUGThemeValue,
279
- defaultUGNavigationColors,
280
- defaultUGTheme,
281
- defaultUGThemeConfiguratorOptions,
282
- defaultUGThemeNavigationColors,
283
- defaultUGThemeProfiles,
284
- isUGThemeProfileModified,
285
- resolveUGNavigationColors,
286
- resolveUGNavigationPalette,
287
- ugThemeProfileFields
288
- });
2
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var theme_exports={};__export(theme_exports,{applyUGThemeProfile:()=>applyUGThemeProfile,createUGThemeValue:()=>createUGThemeValue,defaultUGNavigationColors:()=>defaultUGNavigationColors,defaultUGTheme:()=>defaultUGTheme,defaultUGThemeConfiguratorOptions:()=>defaultUGThemeConfiguratorOptions,defaultUGThemeNavigationColors:()=>defaultUGThemeNavigationColors,defaultUGThemeProfiles:()=>defaultUGThemeProfiles,isUGThemeProfileModified:()=>isUGThemeProfileModified,resolveUGNavigationColors:()=>resolveUGNavigationColors,resolveUGNavigationPalette:()=>resolveUGNavigationPalette,ugThemeProfileFields:()=>ugThemeProfileFields});module.exports=__toCommonJS(theme_exports);var defaultUGThemeNavigationColors={default:{light:{background:"#ffffff",text:"#475569",activeBackground:"#ecf5ff",activeText:"#1d4ed8",hoverBackground:"#f1f5f9"},dark:{background:"#151c28",text:"#cbd5e1",activeBackground:"#3178c2",activeText:"#ffffff",hoverBackground:"#293442"}},minimal:{light:{background:"#ffffff",text:"#334155",activeBackground:"#e0f2fe",activeText:"#0369a1",hoverBackground:"#f8fafc"},dark:{background:"#111827",text:"#d1d5db",activeBackground:"#164e63",activeText:"#ecfeff",hoverBackground:"#1f2937"}},mecha:{light:{background:"#eef2f6",text:"#334155",activeBackground:"#cffafe",activeText:"#0e7490",hoverBackground:"#e2e8f0"},dark:{background:"#0b1220",text:"#cbd5e1",activeBackground:"#155e75",activeText:"#ecfeff",hoverBackground:"#172033"}}};var defaultUGNavigationColors=defaultUGThemeNavigationColors.default;function resolveUGNavigationPalette(mode,prefersDark=false){if(mode==="dark")return"dark";if(mode==="light")return"light";return prefersDark?"dark":"light"}var defaultUGAccentNavigationColors={cyan:{light:{activeBackground:"#cffafe",activeText:"#0e7490"},dark:{activeBackground:"#0e7490",activeText:"#ecfeff"}},blue:{light:{activeBackground:"#dbeafe",activeText:"#1d4ed8"},dark:{activeBackground:"#1d4ed8",activeText:"#eff6ff"}},violet:{light:{activeBackground:"#ede9fe",activeText:"#6d28d9"},dark:{activeBackground:"#6d28d9",activeText:"#f5f3ff"}},emerald:{light:{activeBackground:"#d1fae5",activeText:"#047857"},dark:{activeBackground:"#047857",activeText:"#ecfdf5"}},rose:{light:{activeBackground:"#ffe4e6",activeText:"#be123c"},dark:{activeBackground:"#be123c",activeText:"#fff1f2"}}};function resolveUGNavigationColors(preset,palette,overrides,accent="theme"){if(overrides)return overrides;const themeColors=preset in defaultUGThemeNavigationColors?defaultUGThemeNavigationColors[preset]:defaultUGThemeNavigationColors.default;const resolvedColors=themeColors[palette];if(accent in defaultUGAccentNavigationColors){return{...resolvedColors,...defaultUGAccentNavigationColors[accent][palette]}}return resolvedColors}var ugThemeProfileFields=["density","radius","shadow","font","contrast","motion","background"];var defaultUGTheme={preset:"default",mode:"system",surface:"workspace",density:"comfortable",radius:"default",shadow:"standard",font:"system",contrast:"standard",motion:"standard",background:"grid",accent:"theme"};var defaultUGThemeProfiles=[{id:"balanced",label:"\u5747\u8861",description:"\u8212\u9002\u3001\u6E05\u6670\uFF0C\u9002\u5408\u65E5\u5E38\u901A\u7528\u64CD\u4F5C\u3002",value:{density:"comfortable",radius:"default",shadow:"standard",font:"system",contrast:"standard",motion:"standard",background:"plain"}},{id:"efficient",label:"\u9AD8\u6548",description:"\u7D27\u51D1\u3001\u5229\u843D\uFF0C\u9002\u5408\u9AD8\u9891\u64CD\u4F5C\u548C\u6570\u636E\u5DE5\u4F5C\u3002",value:{density:"compact",radius:"sharp",shadow:"flat",font:"compact",contrast:"strong",motion:"reduced",background:"plain"}},{id:"readable",label:"\u6613\u8BFB",description:"\u5BBD\u677E\u3001\u6E05\u6670\uFF0C\u9002\u5408\u957F\u65F6\u95F4\u9605\u8BFB\u548C\u4F4E\u523A\u6FC0\u64CD\u4F5C\u3002",value:{density:"spacious",radius:"soft",shadow:"standard",font:"readable",contrast:"strong",motion:"reduced",background:"plain"}}];var defaultUGThemeConfiguratorOptions={presets:[{value:"default",label:"\u9ED8\u8BA4",description:"\u5747\u8861\u7684\u8FB9\u754C\u3001\u5C42\u6B21\u4E0E\u4FE1\u606F\u5BC6\u5EA6\u3002"},{value:"minimal",label:"\u7B80\u6D01",description:"\u51CF\u5C11\u88C5\u9970\uFF0C\u8BA9\u5185\u5BB9\u6210\u4E3A\u89C6\u89C9\u4E2D\u5FC3\u3002"},{value:"mecha",label:"\u673A\u68B0",description:"\u786C\u6717\u8FB9\u754C\u4E0E\u7D27\u51D1\u7684\u63A7\u5236\u53F0\u8282\u594F\u3002"}],modes:[{value:"system",label:"\u8DDF\u968F\u7CFB\u7EDF",description:"\u81EA\u52A8\u5339\u914D\u8BBE\u5907\u5916\u89C2\u3002"},{value:"light",label:"\u4EAE\u8272",description:"\u59CB\u7EC8\u4F7F\u7528\u4EAE\u8272\u754C\u9762\u3002"},{value:"dark",label:"\u6697\u8272",description:"\u59CB\u7EC8\u4F7F\u7528\u6697\u8272\u754C\u9762\u3002"}],surfaces:[{value:"workspace",label:"\u5DE5\u4F5C\u533A"},{value:"showcase",label:"\u5C55\u793A\u9875"},{value:"auth",label:"\u8BA4\u8BC1\u9875"},{value:"content",label:"\u5185\u5BB9\u9875"}],densities:[{value:"comfortable",label:"\u8212\u9002"},{value:"compact",label:"\u7D27\u51D1"},{value:"spacious",label:"\u5BBD\u677E"}],radii:[{value:"sharp",label:"\u5229\u843D"},{value:"default",label:"\u9ED8\u8BA4"},{value:"soft",label:"\u67D4\u548C"}],shadows:[{value:"flat",label:"\u5E73\u9762"},{value:"standard",label:"\u6807\u51C6"},{value:"layered",label:"\u5C42\u6B21"}],fonts:[{value:"system",label:"\u7CFB\u7EDF"},{value:"readable",label:"\u6613\u8BFB"},{value:"compact",label:"\u7D27\u51D1"}],contrasts:[{value:"soft",label:"\u67D4\u548C"},{value:"standard",label:"\u6807\u51C6"},{value:"strong",label:"\u6E05\u6670"}],motions:[{value:"reduced",label:"\u51CF\u5C11"},{value:"standard",label:"\u6807\u51C6"},{value:"lively",label:"\u7075\u52A8"}],backgrounds:[{value:"plain",label:"\u7EAF\u51C0"},{value:"grid",label:"\u7F51\u683C"},{value:"soft",label:"\u67D4\u5149"}],accents:[{value:"theme",label:"\u4E3B\u9898\u9ED8\u8BA4"},{value:"cyan",label:"UG \u9752"},{value:"blue",label:"\u6D77\u84DD"},{value:"violet",label:"\u7D2B\u6676"},{value:"emerald",label:"\u677E\u7EFF"},{value:"rose",label:"\u73AB\u7EA2"}]};function createUGThemeValue(parent,overrides){return{preset:overrides.preset??parent.preset,mode:overrides.mode??parent.mode,surface:overrides.surface??parent.surface,density:overrides.density??parent.density,radius:overrides.radius??parent.radius,shadow:overrides.shadow??parent.shadow,font:overrides.font??parent.font,contrast:overrides.contrast??parent.contrast,motion:overrides.motion??parent.motion,background:overrides.background??parent.background,accent:overrides.accent??parent.accent}}function applyUGThemeProfile(current,profile){return createUGThemeValue(current,profile.value)}function isUGThemeProfileModified(current,profile){return ugThemeProfileFields.some(field=>current[field]!==profile.value[field])}0&&(module.exports={applyUGThemeProfile,createUGThemeValue,defaultUGNavigationColors,defaultUGTheme,defaultUGThemeConfiguratorOptions,defaultUGThemeNavigationColors,defaultUGThemeProfiles,isUGThemeProfileModified,resolveUGNavigationColors,resolveUGNavigationPalette,ugThemeProfileFields});
289
3
  //# sourceMappingURL=theme.cjs.map
@@ -1 +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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,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,MACl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
+ {"version":3,"sources":["../src/theme.ts","../src/theme/state.ts"],"sourcesContent":["/** @description Core 主题公开子入口。 */\nexport * from './theme/state'\n","/**\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":";qqBAAA,4pBC6BO,IAAM,+BAA6G,CACxH,QAAS,CACP,MAAO,CACL,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,EACA,KAAM,CACJ,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,CACF,EACA,QAAS,CACP,MAAO,CACL,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,EACA,KAAM,CACJ,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,CACF,EACA,MAAO,CACL,MAAO,CACL,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,EACA,KAAM,CACJ,WAAY,UACZ,KAAM,UACN,iBAAkB,UAClB,WAAY,UACZ,gBAAiB,SACnB,CACF,CACF,EAGO,IAAM,0BAAqD,+BAA+B,QAG1F,SAAS,2BACd,KACA,YAAc,MACO,CACrB,GAAI,OAAS,OAAQ,MAAO,OAC5B,GAAI,OAAS,QAAS,MAAO,QAC7B,OAAO,YAAc,OAAS,OAChC,CAIA,IAAM,gCAGD,CACH,KAAM,CACJ,MAAO,CAAE,iBAAkB,UAAW,WAAY,SAAU,EAC5D,KAAM,CAAE,iBAAkB,UAAW,WAAY,SAAU,CAC7D,EACA,KAAM,CACJ,MAAO,CAAE,iBAAkB,UAAW,WAAY,SAAU,EAC5D,KAAM,CAAE,iBAAkB,UAAW,WAAY,SAAU,CAC7D,EACA,OAAQ,CACN,MAAO,CAAE,iBAAkB,UAAW,WAAY,SAAU,EAC5D,KAAM,CAAE,iBAAkB,UAAW,WAAY,SAAU,CAC7D,EACA,QAAS,CACP,MAAO,CAAE,iBAAkB,UAAW,WAAY,SA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MAAO,OAAQ,MAAO,cAAK,EAC7B,CAAE,MAAO,OAAQ,MAAO,cAAK,CAC/B,EACA,QAAS,CACP,CAAE,MAAO,QAAS,MAAO,0BAAO,EAChC,CAAE,MAAO,OAAQ,MAAO,WAAO,EAC/B,CAAE,MAAO,OAAQ,MAAO,cAAK,EAC7B,CAAE,MAAO,SAAU,MAAO,cAAK,EAC/B,CAAE,MAAO,UAAW,MAAO,cAAK,EAChC,CAAE,MAAO,OAAQ,MAAO,cAAK,CAC/B,CACF,EAEO,SAAS,mBAAmB,OAA6B,UAA8D,CAC5H,MAAO,CACL,OAAQ,UAAU,QAAU,OAAO,OACnC,KAAM,UAAU,MAAQ,OAAO,KAC/B,QAAS,UAAU,SAAW,OAAO,QACrC,QAAS,UAAU,SAAW,OAAO,QACrC,OAAQ,UAAU,QAAU,OAAO,OACnC,OAAQ,UAAU,QAAU,OAAO,OACnC,KAAM,UAAU,MAAQ,OAAO,KAC/B,SAAU,UAAU,UAAY,OAAO,SACvC,OAAQ,UAAU,QAAU,OAAO,OACnC,WAAY,UAAU,YAAc,OAAO,WAC3C,OAAQ,UAAU,QAAU,OAAO,MACrC,CACF,CAEO,SAAS,oBACd,QACA,QACqB,CACrB,OAAO,mBAAmB,QAAS,QAAQ,KAAK,CAClD,CAEO,SAAS,yBACd,QACA,QACS,CACT,OAAO,qBAAqB,KAAM,OAAU,QAAQ,KAAK,IAAM,QAAQ,MAAM,KAAK,CAAC,CACrF","names":[]}
package/dist/theme.d.ts CHANGED
@@ -1,79 +1,3 @@
1
- /**
2
- * @description: UG UI 平台无关主题语义与组合规则
3
- * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。
4
- * @date: 2026-07-21
5
- */
6
- export type UGThemePreset = 'default' | 'minimal' | 'mecha' | (string & {});
7
- export type UGThemeMode = 'light' | 'dark' | 'system';
8
- export type UGThemeSurfaceValue = 'workspace' | 'showcase' | 'auth' | 'content' | (string & {});
9
- export type UGThemeDensity = 'comfortable' | 'compact' | 'spacious' | (string & {});
10
- export type UGThemeRadius = 'sharp' | 'default' | 'soft' | (string & {});
11
- export type UGThemeShadow = 'flat' | 'standard' | 'layered' | (string & {});
12
- export type UGThemeFont = 'system' | 'readable' | 'compact' | (string & {});
13
- export type UGThemeContrast = 'soft' | 'standard' | 'strong' | (string & {});
14
- export type UGThemeMotion = 'reduced' | 'standard' | 'lively' | (string & {});
15
- export type UGThemeBackground = 'plain' | 'grid' | 'soft' | (string & {});
16
- export type UGThemeAccent = 'theme' | 'cyan' | 'blue' | 'violet' | 'emerald' | 'rose' | (string & {});
17
- export type UGNavigationMode = 'sidebar' | 'header';
18
- export type UGNavigationPalette = 'light' | 'dark';
19
- export interface UGNavigationColors {
20
- background: string;
21
- text: string;
22
- activeBackground: string;
23
- activeText: string;
24
- hoverBackground: string;
25
- }
26
- export type UGThemeNavigationColors = Readonly<Record<UGNavigationPalette, UGNavigationColors>>;
27
- export declare const defaultUGThemeNavigationColors: Readonly<Record<'default' | 'minimal' | 'mecha', UGThemeNavigationColors>>;
28
- /** 兼容旧调用方:未声明主题时使用 default 主题的导航配色。 */
29
- export declare const defaultUGNavigationColors: UGThemeNavigationColors;
30
- /** 将主题显示模式解析为导航默认明暗;显式导航颜色仍由调用方优先覆盖。 */
31
- export declare function resolveUGNavigationPalette(mode: UGThemeMode, prefersDark?: boolean): UGNavigationPalette;
32
- export declare function resolveUGNavigationColors(preset: UGThemePreset, palette: UGNavigationPalette, overrides?: UGNavigationColors, accent?: UGThemeAccent): UGNavigationColors;
33
- export interface UGThemeContextValue {
34
- preset: UGThemePreset;
35
- mode: UGThemeMode;
36
- surface: UGThemeSurfaceValue;
37
- density: UGThemeDensity;
38
- radius: UGThemeRadius;
39
- shadow: UGThemeShadow;
40
- font: UGThemeFont;
41
- contrast: UGThemeContrast;
42
- motion: UGThemeMotion;
43
- background: UGThemeBackground;
44
- accent: UGThemeAccent;
45
- }
46
- export declare const ugThemeProfileFields: readonly ['density', 'radius', 'shadow', 'font', 'contrast', 'motion', 'background'];
47
- export type UGThemeProfileField = (typeof ugThemeProfileFields)[number];
48
- export type UGThemeProfileValue = Pick<UGThemeContextValue, UGThemeProfileField>;
49
- export interface UGThemeProfileDefinition {
50
- readonly id: string;
51
- readonly label: string;
52
- readonly description: string;
53
- readonly value: UGThemeProfileValue;
54
- }
55
- export interface UGThemeChoiceOption<TValue extends string = string> {
56
- readonly value: TValue;
57
- readonly label: string;
58
- readonly description?: string;
59
- }
60
- export interface UGThemeConfiguratorOptions {
61
- readonly presets: readonly UGThemeChoiceOption<UGThemePreset>[];
62
- readonly modes: readonly UGThemeChoiceOption<UGThemeMode>[];
63
- readonly surfaces: readonly UGThemeChoiceOption<UGThemeSurfaceValue>[];
64
- readonly densities: readonly UGThemeChoiceOption<UGThemeDensity>[];
65
- readonly radii: readonly UGThemeChoiceOption<UGThemeRadius>[];
66
- readonly shadows: readonly UGThemeChoiceOption<UGThemeShadow>[];
67
- readonly fonts: readonly UGThemeChoiceOption<UGThemeFont>[];
68
- readonly contrasts: readonly UGThemeChoiceOption<UGThemeContrast>[];
69
- readonly motions: readonly UGThemeChoiceOption<UGThemeMotion>[];
70
- readonly backgrounds: readonly UGThemeChoiceOption<UGThemeBackground>[];
71
- readonly accents: readonly UGThemeChoiceOption<UGThemeAccent>[];
72
- }
73
- export declare const defaultUGTheme: UGThemeContextValue;
74
- export declare const defaultUGThemeProfiles: readonly UGThemeProfileDefinition[];
75
- export declare const defaultUGThemeConfiguratorOptions: UGThemeConfiguratorOptions;
76
- export declare function createUGThemeValue(parent: UGThemeContextValue, overrides: Partial<UGThemeContextValue>): UGThemeContextValue;
77
- export declare function applyUGThemeProfile(current: UGThemeContextValue, profile: UGThemeProfileDefinition): UGThemeContextValue;
78
- export declare function isUGThemeProfileModified(current: UGThemeContextValue, profile: UGThemeProfileDefinition): boolean;
1
+ /** @description Core 主题公开子入口。 */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C/D,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAA;IAC3D,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,CAAC,eAAe,CAAC,EAAE,CAAA;IACnE,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,CAAC,aAAa,CAAC,EAAE,CAAA;IAC/D,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,CAAA;IACvE,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,CAAC,aAAa,CAAC,EAAE,CAAA;CAChE;AAED,eAAO,MAAM,cAAc,EAAE,mBAG5B,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,SAAS,wBAAwB,EA2C5D,CAAA;AAEV,eAAO,MAAM,iCAAiC,EAAE,0BA4D/C,CAAA;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAc5H;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,wBAAwB,GAChC,mBAAmB,CAErB;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAET"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,cAAc,eAAe,CAAA"}
package/dist/theme.js CHANGED
@@ -1,28 +1,3 @@
1
1
  "use client"
2
- import {
3
- applyUGThemeProfile,
4
- createUGThemeValue,
5
- defaultUGNavigationColors,
6
- defaultUGTheme,
7
- defaultUGThemeConfiguratorOptions,
8
- defaultUGThemeNavigationColors,
9
- defaultUGThemeProfiles,
10
- isUGThemeProfileModified,
11
- resolveUGNavigationColors,
12
- resolveUGNavigationPalette,
13
- ugThemeProfileFields
14
- } from "./chunk-5S74COKZ.js";
15
- export {
16
- applyUGThemeProfile,
17
- createUGThemeValue,
18
- defaultUGNavigationColors,
19
- defaultUGTheme,
20
- defaultUGThemeConfiguratorOptions,
21
- defaultUGThemeNavigationColors,
22
- defaultUGThemeProfiles,
23
- isUGThemeProfileModified,
24
- resolveUGNavigationColors,
25
- resolveUGNavigationPalette,
26
- ugThemeProfileFields
27
- };
2
+ import{applyUGThemeProfile,createUGThemeValue,defaultUGNavigationColors,defaultUGTheme,defaultUGThemeConfiguratorOptions,defaultUGThemeNavigationColors,defaultUGThemeProfiles,isUGThemeProfileModified,resolveUGNavigationColors,resolveUGNavigationPalette,ugThemeProfileFields}from"./chunk-SSXPAFU2.js";export{applyUGThemeProfile,createUGThemeValue,defaultUGNavigationColors,defaultUGTheme,defaultUGThemeConfiguratorOptions,defaultUGThemeNavigationColors,defaultUGThemeProfiles,isUGThemeProfileModified,resolveUGNavigationColors,resolveUGNavigationPalette,ugThemeProfileFields};
28
3
  //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-check.d.ts","sourceRoot":"","sources":["../../src/tree/tree-check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE;AACvG,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,6BAA6B;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,UAAQ,GAAG,cAAc,CA+B1H;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAQ,GAAG,cAAc,CAiB5J"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-drag.d.ts","sourceRoot":"","sources":["../../src/tree/tree-drag.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAC5D,MAAM,WAAW,YAAY;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-path.d.ts","sourceRoot":"","sources":["../../src/tree/tree-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,CAAA;CAAE,EACjF,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,SAAS,CAAC,EAAE,CAQd"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@ug666/ui-core",
3
- "version": "0.3.0-beta.2",
3
+ "repository": { "type": "git", "url": "https://github.com/uguang2003/ug-ui.git", "directory": "packages/ui-core" },
4
+ "version": "0.3.0-beta.3",
4
5
  "description": "UG UI 平台无关主题、组件值与状态、纯算法及组合规则",
5
6
  "license": "MIT",
6
7
  "type": "module",
@@ -1 +0,0 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