@veltra/styles 1.6.6 → 1.7.1
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/README.md +22 -0
- package/dist/_mixins.scss +1 -7
- package/dist/theme/component-css-vars.d.ts +24 -0
- package/dist/theme/component-css-vars.js +74 -14
- package/dist/theme/component-css-vars.js.map +1 -1
- package/dist/theme/index.d.ts +11 -7
- package/dist/theme/index.js +10 -6
- package/dist/theme/load-theme.d.ts +3 -4
- package/dist/theme/load-theme.js +15 -22
- package/dist/theme/load-theme.js.map +1 -1
- package/dist/theme/presets/ancient.d.ts +3 -2
- package/dist/theme/presets/ancient.js +6 -3
- package/dist/theme/presets/ancient.js.map +1 -1
- package/dist/theme/presets/dark.js +1 -1
- package/dist/theme/presets/dark.js.map +1 -1
- package/dist/theme/presets/glass.d.ts +7 -3
- package/dist/theme/presets/glass.js +18 -47
- package/dist/theme/presets/glass.js.map +1 -1
- package/dist/theme/presets/hero.d.ts +3 -3
- package/dist/theme/presets/hero.js +5 -41
- package/dist/theme/presets/hero.js.map +1 -1
- package/dist/theme/presets/midnight.d.ts +8 -0
- package/dist/theme/presets/midnight.js +55 -0
- package/dist/theme/presets/midnight.js.map +1 -0
- package/dist/theme/presets/neon.d.ts +8 -0
- package/dist/theme/presets/neon.js +55 -0
- package/dist/theme/presets/neon.js.map +1 -0
- package/dist/theme/presets/ocean.d.ts +8 -0
- package/dist/theme/presets/ocean.js +57 -0
- package/dist/theme/presets/ocean.js.map +1 -0
- package/dist/theme/presets/sakura.d.ts +8 -0
- package/dist/theme/presets/sakura.js +59 -0
- package/dist/theme/presets/sakura.js.map +1 -0
- package/dist/theme/type.d.ts +10 -0
- package/dist/theme/ui-theme.d.ts +21 -8
- package/dist/theme/ui-theme.js +30 -27
- package/dist/theme/ui-theme.js.map +1 -1
- package/package.json +3 -3
- package/src/_mixins.scss +1 -7
- package/src/theme/__test__/ui-theme.test.ts +84 -9
- package/src/theme/component-css-vars.ts +90 -13
- package/src/theme/index.ts +2 -0
- package/src/theme/load-theme.ts +12 -27
- package/src/theme/presets/ancient.ts +9 -2
- package/src/theme/presets/dark.ts +43 -40
- package/src/theme/presets/glass.ts +56 -67
- package/src/theme/presets/hero.ts +5 -36
- package/src/theme/presets/index.ts +7 -4
- package/src/theme/presets/midnight.ts +45 -0
- package/src/theme/presets/neon.ts +45 -0
- package/src/theme/presets/ocean.ts +40 -0
- package/src/theme/presets/sakura.ts +42 -0
- package/src/theme/type.ts +10 -0
- package/src/theme/ui-theme.ts +54 -43
- package/dist/theme/presets/shadcn.d.ts +0 -8
- package/dist/theme/presets/shadcn.js +0 -100
- package/dist/theme/presets/shadcn.js.map +0 -1
- package/src/theme/presets/shadcn.ts +0 -84
package/README.md
CHANGED
|
@@ -38,3 +38,25 @@ import '@veltra/styles/transitions/fade.css'
|
|
|
38
38
|
本包提供了一些常用的 `scss` 工具,包括常用的 `mixins` 与 常用的 `functions`, 你还可以通过覆盖变量 $namespace 来使用当前库的同一套工具体系,只不过是命名空间不一样。
|
|
39
39
|
|
|
40
40
|
## 主题加载以及切换
|
|
41
|
+
|
|
42
|
+
从 `@veltra/styles/theme` 导入预设主题,在入口(SSR 则在 `onMounted`)调用 `loadTheme`:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { loadTheme, lightTheme, heroTheme, glassTheme } from '@veltra/styles/theme'
|
|
46
|
+
|
|
47
|
+
loadTheme() // 默认 lightTheme
|
|
48
|
+
loadTheme(heroTheme) // 应用指定预设
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
预设主题按系列组织,应用主题即确定明暗(`html[data-theme]` 同步写入):
|
|
52
|
+
|
|
53
|
+
- 浅色系:`lightTheme`、`heroTheme`、`ancientTheme`
|
|
54
|
+
- 深色系:`darkTheme`、`glassTheme`
|
|
55
|
+
|
|
56
|
+
基于预设派生自定义主题:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
loadTheme(lightTheme.new({ color: { primary: '#ff6600' } }))
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
深色派生需声明系列:`lightTheme.new({...}, { series: 'dark' })`。
|
package/dist/_mixins.scss
CHANGED
|
@@ -146,17 +146,11 @@ $namespace: 'u' !default;
|
|
|
146
146
|
@return var(--#{$namespace}-breakpoint-#{$point});
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
/**
|
|
149
|
+
/** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
|
|
150
150
|
@mixin dark {
|
|
151
151
|
html[data-theme='dark'] & {
|
|
152
152
|
@content;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
@media (prefers-color-scheme: dark) {
|
|
156
|
-
html:not([data-theme='light']) & {
|
|
157
|
-
@content;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
154
|
}
|
|
161
155
|
|
|
162
156
|
@mixin xs {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/theme/component-css-vars.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 桌面组件级 `--u-*` token,随 `UITheme.render()` 按主题系列(light/dark)注入 `html`。
|
|
4
|
+
* 修改此处即可在 TS 侧统一调整组件外观,无需在各组件 `style.scss` 重复声明。
|
|
5
|
+
* nav 系列:外观(底色/前景)不在此列表,由 `navSidebarCssVars` 按主题 `nav.variant`
|
|
6
|
+
* (dark 深底浅字 / light 浅底深字,默认 dark)与 `nav` 覆盖项注入,见 `ui-theme.ts`。
|
|
7
|
+
*/
|
|
8
|
+
/** 与 SCSS `fn.use-var($basename, $nodes...)` 输出一致 */
|
|
9
|
+
declare function themeTokenVar(basename: string, ...nodes: Array<string | number>): string;
|
|
10
|
+
/** 亮色(及与暗色相同的尺寸类)下组件 token */
|
|
11
|
+
declare const componentCssVarsLight: Record<string, string>;
|
|
12
|
+
/** 暗色下组件 token(含与亮色相同的尺寸项,保证暗色 html 块自洽) */
|
|
13
|
+
declare const componentCssVarsDark: Record<string, string>;
|
|
14
|
+
declare const componentCssVarsLightDecls: string[];
|
|
15
|
+
declare const componentCssVarsDarkDecls: string[];
|
|
16
|
+
/** 侧栏外观变体:dark 深底浅字 / light 浅底深字 */
|
|
17
|
+
type NavSidebarVariant = 'dark' | 'light';
|
|
18
|
+
/** 某主题系列 + 侧栏变体下的 nav 外观 token(键为 `--u-nav-*`) */
|
|
19
|
+
declare function navSidebarTokens(series: 'light' | 'dark', variant: NavSidebarVariant): Record<string, string>;
|
|
20
|
+
/** 解析某主题系列 + 侧栏变体下的 nav 外观 token 声明列表 */
|
|
21
|
+
declare function resolveNavSidebarDecls(series: 'light' | 'dark', variant: NavSidebarVariant): string[];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { NavSidebarVariant, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, navSidebarTokens, resolveNavSidebarDecls, themeTokenVar };
|
|
24
|
+
//# sourceMappingURL=component-css-vars.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
//#region src/theme/component-css-vars.ts
|
|
2
2
|
/**
|
|
3
|
-
* 桌面组件级 `--u-*` token
|
|
3
|
+
* 桌面组件级 `--u-*` token,随 `UITheme.render()` 按主题系列(light/dark)注入 `html`。
|
|
4
4
|
* 修改此处即可在 TS 侧统一调整组件外观,无需在各组件 `style.scss` 重复声明。
|
|
5
|
+
* nav 系列:外观(底色/前景)不在此列表,由 `navSidebarCssVars` 按主题 `nav.variant`
|
|
6
|
+
* (dark 深底浅字 / light 浅底深字,默认 dark)与 `nav` 覆盖项注入,见 `ui-theme.ts`。
|
|
5
7
|
*/
|
|
6
8
|
/** 与 SCSS `fn.use-var($basename, $nodes...)` 输出一致 */
|
|
7
9
|
function themeTokenVar(basename, ...nodes) {
|
|
@@ -22,15 +24,9 @@ const componentCssVarsLight = {
|
|
|
22
24
|
"--u-table-current-color": "inherit",
|
|
23
25
|
"--u-table-checked-bg": T("color", "primary", "light-9"),
|
|
24
26
|
"--u-table-checked-color": "inherit",
|
|
25
|
-
"--u-nav-color": T("text-color", "title"),
|
|
26
|
-
"--u-nav-hover-bg": T("text-color", "title", "a", "8"),
|
|
27
|
-
"--u-nav-hover-color": T("text-color", "title"),
|
|
28
|
-
"--u-nav-active-bg": T("color", "primary", "a", "10"),
|
|
29
|
-
"--u-nav-active-color": T("color", "primary", "dark", "1"),
|
|
30
27
|
"--u-nav-height-small": "32px",
|
|
31
28
|
"--u-nav-height-default": "36px",
|
|
32
29
|
"--u-nav-height-large": "40px",
|
|
33
|
-
"--u-nav-bg-color": T("bg-color", "top"),
|
|
34
30
|
"--u-nav-bg-image": "none",
|
|
35
31
|
"--u-nav-rail-width": "56px",
|
|
36
32
|
"--u-nav-rail-labeled-width": "72px",
|
|
@@ -108,12 +104,6 @@ const componentCssVarsDark = {
|
|
|
108
104
|
"--u-table-current-color": "inherit",
|
|
109
105
|
"--u-table-checked-bg": T("color", "primary", "dark", "1"),
|
|
110
106
|
"--u-table-checked-color": "inherit",
|
|
111
|
-
"--u-nav-color": T("text-color", "main"),
|
|
112
|
-
"--u-nav-hover-bg": T("text-color", "title", "a", "8"),
|
|
113
|
-
"--u-nav-hover-color": T("text-color", "title"),
|
|
114
|
-
"--u-nav-active-bg": T("color", "primary", "a", "16"),
|
|
115
|
-
"--u-nav-active-color": T("text-color", "white"),
|
|
116
|
-
"--u-nav-bg-color": T("bg-color", "middle"),
|
|
117
107
|
"--u-radio-border": "#595959",
|
|
118
108
|
"--u-checkbox-border": "#595959",
|
|
119
109
|
"--u-button-primary-plain-bg": T("color", "primary", "dark", "9"),
|
|
@@ -162,7 +152,77 @@ function recordToDeclList(record) {
|
|
|
162
152
|
}
|
|
163
153
|
const componentCssVarsLightDecls = recordToDeclList(componentCssVarsLight);
|
|
164
154
|
const componentCssVarsDarkDecls = recordToDeclList(componentCssVarsDark);
|
|
155
|
+
/** 深侧栏 · 浅色主题下:深底(text-color.title)+ 浅前景,与浅色内容区拉开区分度 */
|
|
156
|
+
const navSidebarDarkInLight = {
|
|
157
|
+
"--u-nav-bg-color": T("text-color", "title"),
|
|
158
|
+
"--u-nav-color": "rgba(255, 255, 255, 0.72)",
|
|
159
|
+
"--u-nav-hover-bg": "rgba(255, 255, 255, 0.08)",
|
|
160
|
+
"--u-nav-hover-color": T("text-color", "white"),
|
|
161
|
+
"--u-nav-active-bg": T("color", "primary", "a", "22"),
|
|
162
|
+
"--u-nav-active-color": T("text-color", "white"),
|
|
163
|
+
"--u-nav-strong-color": T("text-color", "white"),
|
|
164
|
+
"--u-nav-second-color": "rgba(255, 255, 255, 0.45)",
|
|
165
|
+
"--u-nav-sub-border-color": "rgba(255, 255, 255, 0.15)",
|
|
166
|
+
"--u-nav-rail-bg": "rgba(0, 0, 0, 0.2)"
|
|
167
|
+
};
|
|
168
|
+
/** 浅侧栏 · 浅色主题下:比内容区 top 低一档的浅底 + 深前景 */
|
|
169
|
+
const navSidebarLightInLight = {
|
|
170
|
+
"--u-nav-bg-color": T("bg-color", "middle"),
|
|
171
|
+
"--u-nav-color": T("text-color", "title"),
|
|
172
|
+
"--u-nav-hover-bg": T("text-color", "title", "a", "8"),
|
|
173
|
+
"--u-nav-hover-color": T("text-color", "title"),
|
|
174
|
+
"--u-nav-active-bg": T("color", "primary", "a", "10"),
|
|
175
|
+
"--u-nav-active-color": T("color", "primary", "dark", "1"),
|
|
176
|
+
"--u-nav-strong-color": T("text-color", "title"),
|
|
177
|
+
"--u-nav-second-color": T("text-color", "second"),
|
|
178
|
+
"--u-nav-sub-border-color": T("border", "color", "a", "52"),
|
|
179
|
+
"--u-nav-rail-bg": T("bg-color", "bottom")
|
|
180
|
+
};
|
|
181
|
+
/** 深侧栏 · 深色主题下:比内容区 top 深一档 */
|
|
182
|
+
const navSidebarDarkInDark = {
|
|
183
|
+
"--u-nav-bg-color": T("bg-color", "middle"),
|
|
184
|
+
"--u-nav-color": T("text-color", "main"),
|
|
185
|
+
"--u-nav-hover-bg": T("text-color", "title", "a", "8"),
|
|
186
|
+
"--u-nav-hover-color": T("text-color", "title"),
|
|
187
|
+
"--u-nav-active-bg": T("color", "primary", "a", "16"),
|
|
188
|
+
"--u-nav-active-color": T("text-color", "white"),
|
|
189
|
+
"--u-nav-strong-color": T("text-color", "title"),
|
|
190
|
+
"--u-nav-second-color": T("text-color", "second"),
|
|
191
|
+
"--u-nav-sub-border-color": T("border", "color", "a", "52"),
|
|
192
|
+
"--u-nav-rail-bg": T("bg-color", "bottom")
|
|
193
|
+
};
|
|
194
|
+
/** 浅侧栏 · 深色主题下:提亮侧栏(与深色内容区反向对比) */
|
|
195
|
+
const navSidebarLightInDark = {
|
|
196
|
+
"--u-nav-bg-color": T("bg-color", "top"),
|
|
197
|
+
"--u-nav-color": T("text-color", "title"),
|
|
198
|
+
"--u-nav-hover-bg": T("text-color", "title", "a", "8"),
|
|
199
|
+
"--u-nav-hover-color": T("text-color", "title"),
|
|
200
|
+
"--u-nav-active-bg": T("color", "primary", "a", "22"),
|
|
201
|
+
"--u-nav-active-color": T("color", "primary"),
|
|
202
|
+
"--u-nav-strong-color": T("text-color", "title"),
|
|
203
|
+
"--u-nav-second-color": T("text-color", "second"),
|
|
204
|
+
"--u-nav-sub-border-color": T("border", "color", "a", "52"),
|
|
205
|
+
"--u-nav-rail-bg": T("bg-color", "middle")
|
|
206
|
+
};
|
|
207
|
+
const navSidebarCssVars = {
|
|
208
|
+
light: {
|
|
209
|
+
dark: navSidebarDarkInLight,
|
|
210
|
+
light: navSidebarLightInLight
|
|
211
|
+
},
|
|
212
|
+
dark: {
|
|
213
|
+
dark: navSidebarDarkInDark,
|
|
214
|
+
light: navSidebarLightInDark
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
/** 某主题系列 + 侧栏变体下的 nav 外观 token(键为 `--u-nav-*`) */
|
|
218
|
+
function navSidebarTokens(series, variant) {
|
|
219
|
+
return { ...navSidebarCssVars[series][variant] };
|
|
220
|
+
}
|
|
221
|
+
/** 解析某主题系列 + 侧栏变体下的 nav 外观 token 声明列表 */
|
|
222
|
+
function resolveNavSidebarDecls(series, variant) {
|
|
223
|
+
return recordToDeclList(navSidebarCssVars[series][variant]);
|
|
224
|
+
}
|
|
165
225
|
//#endregion
|
|
166
|
-
export { componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, themeTokenVar };
|
|
226
|
+
export { componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, navSidebarTokens, resolveNavSidebarDecls, themeTokenVar };
|
|
167
227
|
|
|
168
228
|
//# sourceMappingURL=component-css-vars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-css-vars.js","names":[],"sources":["../../src/theme/component-css-vars.ts"],"sourcesContent":["/**\n * 桌面组件级 `--u-*` token,与内置主题一起在 `UITheme.injectBuiltInThemes` 中注入 `html`。\n * 修改此处即可在 TS 侧统一调整组件外观,无需在各组件 `style.scss` 重复声明。\n */\n\n/** 与 SCSS `fn.use-var($basename, $nodes...)` 输出一致 */\nexport function themeTokenVar(basename: string, ...nodes: Array<string | number>): string {\n const suffix = nodes.length ? `-${nodes.map(String).join('-')}` : ''\n return `var(--u-${basename}${suffix})`\n}\n\nconst T = themeTokenVar\n\n/** 亮色(及与暗色相同的尺寸类)下组件 token */\nexport const componentCssVarsLight: Record<string, string> = {\n '--u-focus-ring': `0 0 0 3px ${T('color', 'primary', 'a', '28')}`,\n '--u-table-border-color': T('border', 'color'),\n '--u-table-header-bg': T('bg-color', 'hover'),\n '--u-table-header-color': T('text-color', 'title'),\n '--u-table-stripe-bg': T('bg-color', 'middle'),\n '--u-table-stripe-color': 'inherit',\n '--u-table-hover-bg': T('bg-color', 'hover'),\n '--u-table-hover-color': 'inherit',\n '--u-table-current-bg': T('bg-color', 'hover'),\n '--u-table-current-color': 'inherit',\n '--u-table-checked-bg': T('color', 'primary', 'light-9'),\n '--u-table-checked-color': 'inherit',\n '--u-nav-color': T('text-color', 'title'),\n '--u-nav-hover-bg': T('text-color', 'title', 'a', '8'),\n '--u-nav-hover-color': T('text-color', 'title'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '10'),\n '--u-nav-active-color': T('color', 'primary', 'dark', '1'),\n '--u-nav-height-small': '32px',\n '--u-nav-height-default': '36px',\n '--u-nav-height-large': '40px',\n '--u-nav-bg-color': T('bg-color', 'top'),\n '--u-nav-bg-image': 'none',\n '--u-nav-rail-width': '56px',\n '--u-nav-rail-labeled-width': '72px',\n '--u-tag-small': '20px',\n '--u-tag-default': '24px',\n '--u-tag-large': '28px',\n '--u-switch-height-small': '18px',\n '--u-switch-height-default': '20px',\n '--u-switch-height-large': '24px',\n '--u-breadcrumb-small': '20px',\n '--u-breadcrumb-default': '22px',\n '--u-breadcrumb-large': '24px',\n\n // ─── Button (default & plain states) ───\n '--u-button-default-bg': T('bg-color', 'top'),\n '--u-button-default-border': T('border', 'color'),\n '--u-button-default-color': T('text-color', 'main'),\n '--u-button-default-hover-bg': T('bg-color', 'hover'),\n '--u-button-default-hover-border': T('border', 'color'),\n '--u-button-primary-plain-bg': T('color', 'primary', 'light', '9'),\n '--u-button-primary-plain-shadow': T('color', 'primary', 'light', '5'),\n '--u-button-success-plain-bg': T('color', 'success', 'light', '9'),\n '--u-button-success-plain-shadow': T('color', 'success', 'light', '5'),\n '--u-button-warning-plain-bg': T('color', 'warning', 'light', '9'),\n '--u-button-warning-plain-shadow': T('color', 'warning', 'light', '5'),\n '--u-button-danger-plain-bg': T('color', 'danger', 'light', '9'),\n '--u-button-danger-plain-shadow': T('color', 'danger', 'light', '5'),\n '--u-button-info-plain-bg': T('color', 'info', 'light', '9'),\n '--u-button-info-plain-shadow': T('color', 'info', 'light', '5'),\n\n // ─── Tree selection ───\n '--u-tree-node-selected-bg': T('color', 'primary', 'light', '9'),\n '--u-tree-node-selected-color': T('color', 'primary'),\n\n // ─── Cascade option active ───\n '--u-cascade-node-active-bg': T('color', 'primary', 'light', '9'),\n '--u-cascade-node-active-color': T('color', 'primary'),\n\n // ─── Expression Editor Chip ───\n '--u-expression-editor-chip-bg': T('color', 'primary', 'light', '9'),\n '--u-expression-editor-chip-color': T('color', 'primary'),\n\n // ─── Paginator active buttons ───\n '--u-paginator-btn-hover-bg': T('color', 'primary', 'light', '9'),\n '--u-paginator-btn-hover-color': T('text-color', 'title'),\n '--u-paginator-btn-active-bg': T('color', 'primary', 'light', '9'),\n '--u-paginator-btn-active-color': T('color', 'primary'),\n\n // ─── Tabs List background ───\n '--u-tabs-bar-bg': T('bg-color', 'hover'),\n '--u-tabs-active-bg': T('bg-color', 'top'),\n\n // ─── Tag Component Colors ───\n '--u-tag-primary-bg': T('color', 'primary', 'light', '9'),\n '--u-tag-primary-color': T('color', 'primary'),\n '--u-tag-primary-border': T('color', 'primary'),\n '--u-tag-success-bg': T('color', 'success', 'light', '9'),\n '--u-tag-success-color': T('color', 'success'),\n '--u-tag-success-border': T('color', 'success'),\n '--u-tag-warning-bg': T('color', 'warning', 'light', '9'),\n '--u-tag-warning-color': T('color', 'warning'),\n '--u-tag-warning-border': T('color', 'warning'),\n '--u-tag-danger-bg': T('color', 'danger', 'light', '9'),\n '--u-tag-danger-color': T('color', 'danger'),\n '--u-tag-danger-border': T('color', 'danger'),\n '--u-tag-info-bg': T('color', 'info', 'light', '9'),\n '--u-tag-info-color': T('color', 'info'),\n '--u-tag-info-border': T('color', 'info'),\n\n // ─── File Picker Colors ───\n '--u-file-picker-hover-bg': T('color', 'primary', 'light', '9'),\n '--u-card-header-bg': 'rgba(0, 0, 0, 0.015)',\n '--u-card-action-bg': 'rgba(0, 0, 0, 0.015)',\n '--u-card-padding-small': '8px',\n '--u-card-padding-default': '12px',\n '--u-card-padding-large': '16px',\n '--u-card-radius': T('radius', 'large')\n}\n\n/** 暗色下组件 token(含与亮色相同的尺寸项,保证暗色 html 块自洽) */\nexport const componentCssVarsDark: Record<string, string> = {\n ...componentCssVarsLight,\n '--u-focus-ring': `0 0 0 3px ${T('color', 'primary', 'a', '35')}`,\n '--u-table-border-color': T('border', 'color'),\n '--u-table-header-bg': T('bg-color', 'hover'),\n '--u-table-header-color': T('text-color', 'main'),\n '--u-table-stripe-bg': T('bg-color', 'middle'),\n '--u-table-stripe-color': T('text-color', 'main'),\n '--u-table-hover-bg': T('text-color', 'title', 'a', '5'),\n '--u-table-hover-color': T('text-color', 'title'),\n '--u-table-current-bg': T('bg-color', 'hover'),\n '--u-table-current-color': 'inherit',\n '--u-table-checked-bg': T('color', 'primary', 'dark', '1'),\n '--u-table-checked-color': 'inherit',\n '--u-nav-color': T('text-color', 'main'),\n '--u-nav-hover-bg': T('text-color', 'title', 'a', '8'),\n '--u-nav-hover-color': T('text-color', 'title'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '16'),\n '--u-nav-active-color': T('text-color', 'white'),\n '--u-nav-bg-color': T('bg-color', 'middle'),\n '--u-radio-border': '#595959',\n '--u-checkbox-border': '#595959',\n\n // ─── Button (plain & text colors in dark mode) ───\n '--u-button-primary-plain-bg': T('color', 'primary', 'dark', '9'),\n '--u-button-primary-plain-shadow': T('color', 'primary', 'dark', '7'),\n '--u-button-success-plain-bg': T('color', 'success', 'dark', '9'),\n '--u-button-success-plain-shadow': T('color', 'success', 'dark', '7'),\n '--u-button-warning-plain-bg': T('color', 'warning', 'dark', '9'),\n '--u-button-warning-plain-shadow': T('color', 'warning', 'dark', '7'),\n '--u-button-danger-plain-bg': T('color', 'danger', 'dark', '9'),\n '--u-button-danger-plain-shadow': T('color', 'danger', 'dark', '7'),\n '--u-button-info-plain-bg': T('color', 'info', 'dark', '9'),\n '--u-button-info-plain-shadow': T('color', 'info', 'dark', '7'),\n\n // ─── Tree selection ───\n '--u-tree-node-selected-bg': T('color', 'primary', 'dark', '9'),\n '--u-tree-node-selected-color': T('color', 'primary'),\n\n // ─── Cascade option active ───\n '--u-cascade-node-active-bg': T('color', 'primary', 'dark', '9'),\n '--u-cascade-node-active-color': T('color', 'primary'),\n\n // ─── Expression Editor Chip ───\n '--u-expression-editor-chip-bg': T('color', 'primary', 'dark', '9'),\n '--u-expression-editor-chip-color': T('color', 'primary'),\n\n // ─── Paginator active buttons ───\n '--u-paginator-btn-hover-bg': T('color', 'primary', 'dark', '9'),\n '--u-paginator-btn-hover-color': T('color', 'primary'),\n '--u-paginator-btn-active-bg': T('color', 'primary', 'dark', '9'),\n '--u-paginator-btn-active-color': T('color', 'primary'),\n\n // ─── Tabs List background (improved dark contrast) ───\n '--u-tabs-bar-bg': T('bg-color', 'bottom'),\n '--u-tabs-active-bg': T('bg-color', 'top'),\n\n // ─── Tag Component Colors ───\n '--u-tag-primary-bg': T('color', 'primary', 'dark', '9'),\n '--u-tag-primary-color': T('color', 'primary'),\n '--u-tag-primary-border': T('color', 'primary'),\n '--u-tag-success-bg': T('color', 'success', 'dark', '9'),\n '--u-tag-success-color': T('color', 'success'),\n '--u-tag-success-border': T('color', 'success'),\n '--u-tag-warning-bg': T('color', 'warning', 'dark', '9'),\n '--u-tag-warning-color': T('color', 'warning'),\n '--u-tag-warning-border': T('color', 'warning'),\n '--u-tag-danger-bg': T('color', 'danger', 'dark', '9'),\n '--u-tag-danger-color': T('color', 'danger'),\n '--u-tag-danger-border': T('color', 'danger'),\n '--u-tag-info-bg': T('color', 'info', 'dark', '9'),\n '--u-tag-info-color': T('color', 'info'),\n '--u-tag-info-border': T('color', 'info'),\n\n // ─── File Picker Colors ───\n '--u-file-picker-hover-bg': T('color', 'primary', 'dark', '9'),\n '--u-card-header-bg': 'rgba(255, 255, 255, 0.015)',\n '--u-card-action-bg': 'rgba(255, 255, 255, 0.015)'\n}\n\nfunction recordToDeclList(record: Record<string, string>): string[] {\n return Object.entries(record).map(([k, v]) => `${k}: ${v}`)\n}\n\nexport const componentCssVarsLightDecls: string[] = recordToDeclList(componentCssVarsLight)\n\nexport const componentCssVarsDarkDecls: string[] = recordToDeclList(componentCssVarsDark)\n"],"mappings":";;;;;;AAMA,SAAgB,cAAc,UAAkB,GAAG,OAAuC;CAExF,OAAO,WAAW,WADH,MAAM,SAAS,IAAI,MAAM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QAAQ,GAAG;CAC7D,sBAAsB;CACtB,sBAAsB;AACxB;AAEA,SAAS,iBAAiB,QAA0C;CAClE,OAAO,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,IAAI,GAAG;AAC5D;AAEA,MAAa,6BAAuC,iBAAiB,qBAAqB;AAE1F,MAAa,4BAAsC,iBAAiB,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"component-css-vars.js","names":[],"sources":["../../src/theme/component-css-vars.ts"],"sourcesContent":["/**\n * 桌面组件级 `--u-*` token,随 `UITheme.render()` 按主题系列(light/dark)注入 `html`。\n * 修改此处即可在 TS 侧统一调整组件外观,无需在各组件 `style.scss` 重复声明。\n * nav 系列:外观(底色/前景)不在此列表,由 `navSidebarCssVars` 按主题 `nav.variant`\n * (dark 深底浅字 / light 浅底深字,默认 dark)与 `nav` 覆盖项注入,见 `ui-theme.ts`。\n */\n\n/** 与 SCSS `fn.use-var($basename, $nodes...)` 输出一致 */\nexport function themeTokenVar(basename: string, ...nodes: Array<string | number>): string {\n const suffix = nodes.length ? `-${nodes.map(String).join('-')}` : ''\n return `var(--u-${basename}${suffix})`\n}\n\nconst T = themeTokenVar\n\n/** 亮色(及与暗色相同的尺寸类)下组件 token */\nexport const componentCssVarsLight: Record<string, string> = {\n '--u-focus-ring': `0 0 0 3px ${T('color', 'primary', 'a', '28')}`,\n '--u-table-border-color': T('border', 'color'),\n '--u-table-header-bg': T('bg-color', 'hover'),\n '--u-table-header-color': T('text-color', 'title'),\n '--u-table-stripe-bg': T('bg-color', 'middle'),\n '--u-table-stripe-color': 'inherit',\n '--u-table-hover-bg': T('bg-color', 'hover'),\n '--u-table-hover-color': 'inherit',\n '--u-table-current-bg': T('bg-color', 'hover'),\n '--u-table-current-color': 'inherit',\n '--u-table-checked-bg': T('color', 'primary', 'light-9'),\n '--u-table-checked-color': 'inherit',\n // ─── Nav 系列(nav / dual-nav / group-nav)尺寸与资源类;外观见文件底部 navSidebarCssVars ───\n '--u-nav-height-small': '32px',\n '--u-nav-height-default': '36px',\n '--u-nav-height-large': '40px',\n '--u-nav-bg-image': 'none',\n '--u-nav-rail-width': '56px',\n '--u-nav-rail-labeled-width': '72px',\n '--u-tag-small': '20px',\n '--u-tag-default': '24px',\n '--u-tag-large': '28px',\n '--u-switch-height-small': '18px',\n '--u-switch-height-default': '20px',\n '--u-switch-height-large': '24px',\n '--u-breadcrumb-small': '20px',\n '--u-breadcrumb-default': '22px',\n '--u-breadcrumb-large': '24px',\n\n // ─── Button (default & plain states) ───\n '--u-button-default-bg': T('bg-color', 'top'),\n '--u-button-default-border': T('border', 'color'),\n '--u-button-default-color': T('text-color', 'main'),\n '--u-button-default-hover-bg': T('bg-color', 'hover'),\n '--u-button-default-hover-border': T('border', 'color'),\n '--u-button-primary-plain-bg': T('color', 'primary', 'light', '9'),\n '--u-button-primary-plain-shadow': T('color', 'primary', 'light', '5'),\n '--u-button-success-plain-bg': T('color', 'success', 'light', '9'),\n '--u-button-success-plain-shadow': T('color', 'success', 'light', '5'),\n '--u-button-warning-plain-bg': T('color', 'warning', 'light', '9'),\n '--u-button-warning-plain-shadow': T('color', 'warning', 'light', '5'),\n '--u-button-danger-plain-bg': T('color', 'danger', 'light', '9'),\n '--u-button-danger-plain-shadow': T('color', 'danger', 'light', '5'),\n '--u-button-info-plain-bg': T('color', 'info', 'light', '9'),\n '--u-button-info-plain-shadow': T('color', 'info', 'light', '5'),\n\n // ─── Tree selection ───\n '--u-tree-node-selected-bg': T('color', 'primary', 'light', '9'),\n '--u-tree-node-selected-color': T('color', 'primary'),\n\n // ─── Cascade option active ───\n '--u-cascade-node-active-bg': T('color', 'primary', 'light', '9'),\n '--u-cascade-node-active-color': T('color', 'primary'),\n\n // ─── Expression Editor Chip ───\n '--u-expression-editor-chip-bg': T('color', 'primary', 'light', '9'),\n '--u-expression-editor-chip-color': T('color', 'primary'),\n\n // ─── Paginator active buttons ───\n '--u-paginator-btn-hover-bg': T('color', 'primary', 'light', '9'),\n '--u-paginator-btn-hover-color': T('text-color', 'title'),\n '--u-paginator-btn-active-bg': T('color', 'primary', 'light', '9'),\n '--u-paginator-btn-active-color': T('color', 'primary'),\n\n // ─── Tabs List background ───\n '--u-tabs-bar-bg': T('bg-color', 'hover'),\n '--u-tabs-active-bg': T('bg-color', 'top'),\n\n // ─── Tag Component Colors ───\n '--u-tag-primary-bg': T('color', 'primary', 'light', '9'),\n '--u-tag-primary-color': T('color', 'primary'),\n '--u-tag-primary-border': T('color', 'primary'),\n '--u-tag-success-bg': T('color', 'success', 'light', '9'),\n '--u-tag-success-color': T('color', 'success'),\n '--u-tag-success-border': T('color', 'success'),\n '--u-tag-warning-bg': T('color', 'warning', 'light', '9'),\n '--u-tag-warning-color': T('color', 'warning'),\n '--u-tag-warning-border': T('color', 'warning'),\n '--u-tag-danger-bg': T('color', 'danger', 'light', '9'),\n '--u-tag-danger-color': T('color', 'danger'),\n '--u-tag-danger-border': T('color', 'danger'),\n '--u-tag-info-bg': T('color', 'info', 'light', '9'),\n '--u-tag-info-color': T('color', 'info'),\n '--u-tag-info-border': T('color', 'info'),\n\n // ─── File Picker Colors ───\n '--u-file-picker-hover-bg': T('color', 'primary', 'light', '9'),\n '--u-card-header-bg': 'rgba(0, 0, 0, 0.015)',\n '--u-card-action-bg': 'rgba(0, 0, 0, 0.015)',\n '--u-card-padding-small': '8px',\n '--u-card-padding-default': '12px',\n '--u-card-padding-large': '16px',\n '--u-card-radius': T('radius', 'large')\n}\n\n/** 暗色下组件 token(含与亮色相同的尺寸项,保证暗色 html 块自洽) */\nexport const componentCssVarsDark: Record<string, string> = {\n ...componentCssVarsLight,\n '--u-focus-ring': `0 0 0 3px ${T('color', 'primary', 'a', '35')}`,\n '--u-table-border-color': T('border', 'color'),\n '--u-table-header-bg': T('bg-color', 'hover'),\n '--u-table-header-color': T('text-color', 'main'),\n '--u-table-stripe-bg': T('bg-color', 'middle'),\n '--u-table-stripe-color': T('text-color', 'main'),\n '--u-table-hover-bg': T('text-color', 'title', 'a', '5'),\n '--u-table-hover-color': T('text-color', 'title'),\n '--u-table-current-bg': T('bg-color', 'hover'),\n '--u-table-current-color': 'inherit',\n '--u-table-checked-bg': T('color', 'primary', 'dark', '1'),\n '--u-table-checked-color': 'inherit',\n '--u-radio-border': '#595959',\n '--u-checkbox-border': '#595959',\n\n // ─── Button (plain & text colors in dark mode) ───\n '--u-button-primary-plain-bg': T('color', 'primary', 'dark', '9'),\n '--u-button-primary-plain-shadow': T('color', 'primary', 'dark', '7'),\n '--u-button-success-plain-bg': T('color', 'success', 'dark', '9'),\n '--u-button-success-plain-shadow': T('color', 'success', 'dark', '7'),\n '--u-button-warning-plain-bg': T('color', 'warning', 'dark', '9'),\n '--u-button-warning-plain-shadow': T('color', 'warning', 'dark', '7'),\n '--u-button-danger-plain-bg': T('color', 'danger', 'dark', '9'),\n '--u-button-danger-plain-shadow': T('color', 'danger', 'dark', '7'),\n '--u-button-info-plain-bg': T('color', 'info', 'dark', '9'),\n '--u-button-info-plain-shadow': T('color', 'info', 'dark', '7'),\n\n // ─── Tree selection ───\n '--u-tree-node-selected-bg': T('color', 'primary', 'dark', '9'),\n '--u-tree-node-selected-color': T('color', 'primary'),\n\n // ─── Cascade option active ───\n '--u-cascade-node-active-bg': T('color', 'primary', 'dark', '9'),\n '--u-cascade-node-active-color': T('color', 'primary'),\n\n // ─── Expression Editor Chip ───\n '--u-expression-editor-chip-bg': T('color', 'primary', 'dark', '9'),\n '--u-expression-editor-chip-color': T('color', 'primary'),\n\n // ─── Paginator active buttons ───\n '--u-paginator-btn-hover-bg': T('color', 'primary', 'dark', '9'),\n '--u-paginator-btn-hover-color': T('color', 'primary'),\n '--u-paginator-btn-active-bg': T('color', 'primary', 'dark', '9'),\n '--u-paginator-btn-active-color': T('color', 'primary'),\n\n // ─── Tabs List background (improved dark contrast) ───\n '--u-tabs-bar-bg': T('bg-color', 'bottom'),\n '--u-tabs-active-bg': T('bg-color', 'top'),\n\n // ─── Tag Component Colors ───\n '--u-tag-primary-bg': T('color', 'primary', 'dark', '9'),\n '--u-tag-primary-color': T('color', 'primary'),\n '--u-tag-primary-border': T('color', 'primary'),\n '--u-tag-success-bg': T('color', 'success', 'dark', '9'),\n '--u-tag-success-color': T('color', 'success'),\n '--u-tag-success-border': T('color', 'success'),\n '--u-tag-warning-bg': T('color', 'warning', 'dark', '9'),\n '--u-tag-warning-color': T('color', 'warning'),\n '--u-tag-warning-border': T('color', 'warning'),\n '--u-tag-danger-bg': T('color', 'danger', 'dark', '9'),\n '--u-tag-danger-color': T('color', 'danger'),\n '--u-tag-danger-border': T('color', 'danger'),\n '--u-tag-info-bg': T('color', 'info', 'dark', '9'),\n '--u-tag-info-color': T('color', 'info'),\n '--u-tag-info-border': T('color', 'info'),\n\n // ─── File Picker Colors ───\n '--u-file-picker-hover-bg': T('color', 'primary', 'dark', '9'),\n '--u-card-header-bg': 'rgba(255, 255, 255, 0.015)',\n '--u-card-action-bg': 'rgba(255, 255, 255, 0.015)'\n}\n\nfunction recordToDeclList(record: Record<string, string>): string[] {\n return Object.entries(record).map(([k, v]) => `${k}: ${v}`)\n}\n\nexport const componentCssVarsLightDecls: string[] = recordToDeclList(componentCssVarsLight)\n\nexport const componentCssVarsDarkDecls: string[] = recordToDeclList(componentCssVarsDark)\n\n// ─── Nav 侧栏外观:深/浅变体 × 明/暗主题系列 ───\n// 由 UITheme 按主题 `nav.variant`(默认 dark)选择注入,主题 `nav` 的其余键可逐项覆盖。\n\n/** 侧栏外观变体:dark 深底浅字 / light 浅底深字 */\nexport type NavSidebarVariant = 'dark' | 'light'\n\n/** 深侧栏 · 浅色主题下:深底(text-color.title)+ 浅前景,与浅色内容区拉开区分度 */\nconst navSidebarDarkInLight: Record<string, string> = {\n '--u-nav-bg-color': T('text-color', 'title'),\n '--u-nav-color': 'rgba(255, 255, 255, 0.72)',\n '--u-nav-hover-bg': 'rgba(255, 255, 255, 0.08)',\n '--u-nav-hover-color': T('text-color', 'white'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '22'),\n '--u-nav-active-color': T('text-color', 'white'),\n '--u-nav-strong-color': T('text-color', 'white'),\n '--u-nav-second-color': 'rgba(255, 255, 255, 0.45)',\n '--u-nav-sub-border-color': 'rgba(255, 255, 255, 0.15)',\n '--u-nav-rail-bg': 'rgba(0, 0, 0, 0.2)'\n}\n\n/** 浅侧栏 · 浅色主题下:比内容区 top 低一档的浅底 + 深前景 */\nconst navSidebarLightInLight: Record<string, string> = {\n '--u-nav-bg-color': T('bg-color', 'middle'),\n '--u-nav-color': T('text-color', 'title'),\n '--u-nav-hover-bg': T('text-color', 'title', 'a', '8'),\n '--u-nav-hover-color': T('text-color', 'title'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '10'),\n '--u-nav-active-color': T('color', 'primary', 'dark', '1'),\n '--u-nav-strong-color': T('text-color', 'title'),\n '--u-nav-second-color': T('text-color', 'second'),\n '--u-nav-sub-border-color': T('border', 'color', 'a', '52'),\n '--u-nav-rail-bg': T('bg-color', 'bottom')\n}\n\n/** 深侧栏 · 深色主题下:比内容区 top 深一档 */\nconst navSidebarDarkInDark: Record<string, string> = {\n '--u-nav-bg-color': T('bg-color', 'middle'),\n '--u-nav-color': T('text-color', 'main'),\n '--u-nav-hover-bg': T('text-color', 'title', 'a', '8'),\n '--u-nav-hover-color': T('text-color', 'title'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '16'),\n '--u-nav-active-color': T('text-color', 'white'),\n '--u-nav-strong-color': T('text-color', 'title'),\n '--u-nav-second-color': T('text-color', 'second'),\n '--u-nav-sub-border-color': T('border', 'color', 'a', '52'),\n '--u-nav-rail-bg': T('bg-color', 'bottom')\n}\n\n/** 浅侧栏 · 深色主题下:提亮侧栏(与深色内容区反向对比) */\nconst navSidebarLightInDark: Record<string, string> = {\n '--u-nav-bg-color': T('bg-color', 'top'),\n '--u-nav-color': T('text-color', 'title'),\n '--u-nav-hover-bg': T('text-color', 'title', 'a', '8'),\n '--u-nav-hover-color': T('text-color', 'title'),\n '--u-nav-active-bg': T('color', 'primary', 'a', '22'),\n '--u-nav-active-color': T('color', 'primary'),\n '--u-nav-strong-color': T('text-color', 'title'),\n '--u-nav-second-color': T('text-color', 'second'),\n '--u-nav-sub-border-color': T('border', 'color', 'a', '52'),\n '--u-nav-rail-bg': T('bg-color', 'middle')\n}\n\nconst navSidebarCssVars: Record<\n 'light' | 'dark',\n Record<NavSidebarVariant, Record<string, string>>\n> = {\n light: { dark: navSidebarDarkInLight, light: navSidebarLightInLight },\n dark: { dark: navSidebarDarkInDark, light: navSidebarLightInDark }\n}\n\n/** 某主题系列 + 侧栏变体下的 nav 外观 token(键为 `--u-nav-*`) */\nexport function navSidebarTokens(\n series: 'light' | 'dark',\n variant: NavSidebarVariant\n): Record<string, string> {\n return { ...navSidebarCssVars[series][variant] }\n}\n\n/** 解析某主题系列 + 侧栏变体下的 nav 外观 token 声明列表 */\nexport function resolveNavSidebarDecls(\n series: 'light' | 'dark',\n variant: NavSidebarVariant\n): string[] {\n return recordToDeclList(navSidebarCssVars[series][variant])\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,cAAc,UAAkB,GAAG,OAAuC;CAExF,OAAO,WAAW,WADH,MAAM,SAAS,IAAI,MAAM,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,MAAM,GAC9B;AACtC;AAEA,MAAM,IAAI;;AAGV,MAAa,wBAAgD;CAC3D,kBAAkB,aAAa,EAAE,SAAS,WAAW,KAAK,IAAI;CAC9D,0BAA0B,EAAE,UAAU,OAAO;CAC7C,uBAAuB,EAAE,YAAY,OAAO;CAC5C,0BAA0B,EAAE,cAAc,OAAO;CACjD,uBAAuB,EAAE,YAAY,QAAQ;CAC7C,0BAA0B;CAC1B,sBAAsB,EAAE,YAAY,OAAO;CAC3C,yBAAyB;CACzB,wBAAwB,EAAE,YAAY,OAAO;CAC7C,2BAA2B;CAC3B,wBAAwB,EAAE,SAAS,WAAW,SAAS;CACvD,2BAA2B;CAE3B,wBAAw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Variant, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, navSidebarTokens, resolveNavSidebarDecls, themeTokenVar } from "./component-css-vars.js";
|
|
3
|
+
import { ThemeSeries, UITheme, UIThemeOptions } from "./ui-theme.js";
|
|
3
4
|
import { lightTheme } from "./presets/light.js";
|
|
4
5
|
import { darkTheme } from "./presets/dark.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { heroTheme } from "./presets/hero.js";
|
|
7
|
+
import { glassTheme } from "./presets/glass.js";
|
|
8
|
+
import { ancientTheme } from "./presets/ancient.js";
|
|
9
|
+
import { sakuraTheme } from "./presets/sakura.js";
|
|
10
|
+
import { oceanTheme } from "./presets/ocean.js";
|
|
11
|
+
import { midnightTheme } from "./presets/midnight.js";
|
|
12
|
+
import { neonTheme } from "./presets/neon.js";
|
|
13
|
+
import { currentTheme, loadTheme } from "./load-theme.js";
|
|
10
14
|
import { HEXToRGB, cssVar, defineBySize, hexRgbOnly, hexWithAlpha, isHexColor, mixColor, mixColorWithAlpha } from "./helper.js";
|
|
11
|
-
export { HEXToRGB, type RGBColor, type Theme, UITheme,
|
|
15
|
+
export { HEXToRGB, NavSidebarVariant, type RGBColor, type Theme, ThemeSeries, UITheme, UIThemeOptions, ancientTheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, glassTheme, heroTheme, hexRgbOnly, hexWithAlpha, isHexColor, lightTheme, loadTheme, midnightTheme, mixColor, mixColorWithAlpha, navSidebarTokens, neonTheme, oceanTheme, resolveNavSidebarDecls, sakuraTheme, themeTokenVar };
|
package/dist/theme/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, navSidebarTokens, resolveNavSidebarDecls, themeTokenVar } from "./component-css-vars.js";
|
|
1
2
|
import { HEXToRGB, cssVar, defineBySize, hexRgbOnly, hexWithAlpha, isHexColor, mixColor, mixColorWithAlpha } from "./helper.js";
|
|
2
3
|
import { UITheme } from "./ui-theme.js";
|
|
3
4
|
import { lightTheme } from "./presets/light.js";
|
|
4
5
|
import { darkTheme } from "./presets/dark.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
6
|
+
import { heroTheme } from "./presets/hero.js";
|
|
7
|
+
import { glassTheme } from "./presets/glass.js";
|
|
8
|
+
import { ancientTheme } from "./presets/ancient.js";
|
|
9
|
+
import { sakuraTheme } from "./presets/sakura.js";
|
|
10
|
+
import { oceanTheme } from "./presets/ocean.js";
|
|
11
|
+
import { midnightTheme } from "./presets/midnight.js";
|
|
12
|
+
import { neonTheme } from "./presets/neon.js";
|
|
13
|
+
import { currentTheme, loadTheme } from "./load-theme.js";
|
|
14
|
+
export { HEXToRGB, UITheme, ancientTheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, glassTheme, heroTheme, hexRgbOnly, hexWithAlpha, isHexColor, lightTheme, loadTheme, midnightTheme, mixColor, mixColorWithAlpha, navSidebarTokens, neonTheme, oceanTheme, resolveNavSidebarDecls, sakuraTheme, themeTokenVar };
|
|
@@ -2,16 +2,15 @@ import { UITheme } from "./ui-theme.js";
|
|
|
2
2
|
import { ShallowRef } from "vue";
|
|
3
3
|
//#region src/theme/load-theme.d.ts
|
|
4
4
|
declare const currentTheme: ShallowRef<UITheme | undefined>;
|
|
5
|
-
declare function setTheme(mode: 'light' | 'dark' | 'auto'): void;
|
|
6
5
|
/**
|
|
7
6
|
* @description 加载主题, 如果你是 SSR 环境,
|
|
8
7
|
* 请在 `onMounted` 中调用,否则你可以在
|
|
9
8
|
* 项目的入口环境(通常是 main.ts)或其他全局环境中调用。
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* 主题自带系列(`theme.series`),应用时会注入全局 token 与
|
|
11
|
+
* 同系列的组件级 token,并把 `html[data-theme]` 置为对应系列。
|
|
13
12
|
*/
|
|
14
13
|
declare function loadTheme(theme?: UITheme): void;
|
|
15
14
|
//#endregion
|
|
16
|
-
export { currentTheme, loadTheme
|
|
15
|
+
export { currentTheme, loadTheme };
|
|
17
16
|
//# sourceMappingURL=load-theme.d.ts.map
|
package/dist/theme/load-theme.js
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
|
-
import { UITheme } from "./ui-theme.js";
|
|
2
1
|
import { lightTheme } from "./presets/light.js";
|
|
3
|
-
import { darkTheme } from "./presets/dark.js";
|
|
4
2
|
import { shallowRef } from "vue";
|
|
5
3
|
import { useConfig } from "@veltra/compositions";
|
|
6
4
|
//#region src/theme/load-theme.ts
|
|
7
5
|
const currentTheme = shallowRef();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const SIZES = [
|
|
7
|
+
"small",
|
|
8
|
+
"default",
|
|
9
|
+
"large"
|
|
10
|
+
];
|
|
11
11
|
/**
|
|
12
12
|
* @description 加载主题, 如果你是 SSR 环境,
|
|
13
13
|
* 请在 `onMounted` 中调用,否则你可以在
|
|
14
14
|
* 项目的入口环境(通常是 main.ts)或其他全局环境中调用。
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* 主题自带系列(`theme.series`),应用时会注入全局 token 与
|
|
17
|
+
* 同系列的组件级 token,并把 `html[data-theme]` 置为对应系列。
|
|
18
18
|
*/
|
|
19
|
-
function loadTheme(theme) {
|
|
20
|
-
currentTheme.value = theme ?? lightTheme;
|
|
21
|
-
const { config } = useConfig();
|
|
22
|
-
if (typeof document !== "undefined") document.documentElement.classList.add(config.size);
|
|
23
|
-
if (typeof document === "undefined") return;
|
|
24
|
-
if (!theme) {
|
|
25
|
-
currentTheme.value = lightTheme;
|
|
26
|
-
UITheme.injectBuiltInThemes(lightTheme, darkTheme);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
19
|
+
function loadTheme(theme = lightTheme) {
|
|
29
20
|
currentTheme.value = theme;
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
if (typeof document === "undefined") return;
|
|
22
|
+
const { config } = useConfig();
|
|
23
|
+
const classList = document.documentElement.classList;
|
|
24
|
+
classList.remove(...SIZES.filter((s) => s !== config.size));
|
|
25
|
+
classList.add(config.size);
|
|
26
|
+
theme.render();
|
|
34
27
|
}
|
|
35
28
|
//#endregion
|
|
36
|
-
export { currentTheme, loadTheme
|
|
29
|
+
export { currentTheme, loadTheme };
|
|
37
30
|
|
|
38
31
|
//# sourceMappingURL=load-theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-theme.js","names":[],"sources":["../../src/theme/load-theme.ts"],"sourcesContent":["import { useConfig } from '@veltra/compositions'\nimport { shallowRef, type ShallowRef } from 'vue'\n\nimport { lightTheme
|
|
1
|
+
{"version":3,"file":"load-theme.js","names":[],"sources":["../../src/theme/load-theme.ts"],"sourcesContent":["import { useConfig } from '@veltra/compositions'\nimport { shallowRef, type ShallowRef } from 'vue'\n\nimport { lightTheme } from './presets'\nimport type { UITheme } from './ui-theme'\n\nexport const currentTheme: ShallowRef<UITheme | undefined> = shallowRef<UITheme>()\n\nconst SIZES = ['small', 'default', 'large'] as const\n\n/**\n * @description 加载主题, 如果你是 SSR 环境,\n * 请在 `onMounted` 中调用,否则你可以在\n * 项目的入口环境(通常是 main.ts)或其他全局环境中调用。\n *\n * 主题自带系列(`theme.series`),应用时会注入全局 token 与\n * 同系列的组件级 token,并把 `html[data-theme]` 置为对应系列。\n */\nexport function loadTheme(theme: UITheme = lightTheme): void {\n currentTheme.value = theme\n\n if (typeof document === 'undefined') return\n\n const { config } = useConfig()\n const classList = document.documentElement.classList\n classList.remove(...SIZES.filter((s) => s !== config.size))\n classList.add(config.size)\n\n theme.render()\n}\n"],"mappings":";;;;AAMA,MAAa,eAAgD,WAAoB;AAEjF,MAAM,QAAQ;CAAC;CAAS;CAAW;AAAO;;;;;;;;;AAU1C,SAAgB,UAAU,QAAiB,YAAkB;CAC3D,aAAa,QAAQ;CAErB,IAAI,OAAO,aAAa,aAAa;CAErC,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,YAAY,SAAS,gBAAgB;CAC3C,UAAU,OAAO,GAAG,MAAM,QAAQ,MAAM,MAAM,OAAO,IAAI,CAAC;CAC1D,UAAU,IAAI,OAAO,IAAI;CAEzB,MAAM,OAAO;AACf"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { UITheme } from "../ui-theme.js";
|
|
2
2
|
import "../index.js";
|
|
3
3
|
//#region src/theme/presets/ancient.d.ts
|
|
4
|
-
|
|
4
|
+
/** 古风(松烟绿 + 宣纸底),天生适合浅色 */
|
|
5
|
+
declare const ancientTheme: UITheme;
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { ancientTheme };
|
|
7
8
|
//# sourceMappingURL=ancient.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { mixColor } from "../helper.js";
|
|
1
2
|
import { lightTheme } from "./light.js";
|
|
2
3
|
//#region src/theme/presets/ancient.ts
|
|
3
|
-
|
|
4
|
+
/** 古风(松烟绿 + 宣纸底),天生适合浅色 */
|
|
5
|
+
const ancientTheme = lightTheme.new({
|
|
4
6
|
color: { primary: "#3d6b58" },
|
|
5
7
|
bg: { color: {
|
|
6
8
|
bottom: "#f1ede0",
|
|
@@ -31,9 +33,10 @@ const ancientLightTheme = lightTheme.new({
|
|
|
31
33
|
y: 4,
|
|
32
34
|
blur: 16,
|
|
33
35
|
spread: -2
|
|
34
|
-
}
|
|
36
|
+
},
|
|
37
|
+
nav: { "bg-color": mixColor("#2b2a26", "#3d6b58", .28) }
|
|
35
38
|
});
|
|
36
39
|
//#endregion
|
|
37
|
-
export {
|
|
40
|
+
export { ancientTheme };
|
|
38
41
|
|
|
39
42
|
//# sourceMappingURL=ancient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ancient.js","names":[],"sources":["../../../src/theme/presets/ancient.ts"],"sourcesContent":["import { lightTheme } from './light'\nexport const
|
|
1
|
+
{"version":3,"file":"ancient.js","names":[],"sources":["../../../src/theme/presets/ancient.ts"],"sourcesContent":["import { mixColor } from '../helper'\nimport { lightTheme } from './light'\n\n/** 古风(松烟绿 + 宣纸底),天生适合浅色 */\nexport const ancientTheme = lightTheme.new({\n color: {\n primary: '#3d6b58' // 松烟绿\n },\n bg: {\n color: {\n bottom: '#f1ede0', // 宣纸底\n middle: '#f7f4ea',\n top: '#fdfbf4',\n hover: '#e9e2cf'\n }\n },\n 'text-color': {\n title: '#2b2a26', // 黛墨\n main: '#403c34',\n second: '#7a7264',\n assist: '#a89f8c',\n placeholder: '#a89f8c'\n },\n border: { width: 1, color: '#e4dcc8', mutedColor: '#d2c8ac' },\n radius: { small: 4, default: 8, large: 12 },\n shadow: { color: 'rgba(64, 54, 32, 0.14)', x: 0, y: 4, blur: 16, spread: -2 },\n nav: {\n // 松烟墨侧栏:黛墨 + 松烟绿调和\n 'bg-color': mixColor('#2b2a26', '#3d6b58', 0.28)\n }\n})\n"],"mappings":";;;;AAIA,MAAa,eAAe,WAAW,IAAI;CACzC,OAAO,EACL,SAAS,UACX;CACA,IAAI,EACF,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,OAAO;CACT,EACF;CACA,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,aAAa;CACf;CACA,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAW,YAAY;CAAU;CAC5D,QAAQ;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;CAAG;CAC1C,QAAQ;EAAE,OAAO;EAA0B,GAAG;EAAG,GAAG;EAAG,MAAM;EAAI,QAAQ;CAAG;CAC5E,KAAK,EAEH,YAAY,SAAS,WAAW,WAAW,GAAI,EACjD;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark.js","names":[],"sources":["../../../src/theme/presets/dark.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const darkTheme = lightTheme.new({\n
|
|
1
|
+
{"version":3,"file":"dark.js","names":[],"sources":["../../../src/theme/presets/dark.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const darkTheme = lightTheme.new(\n {\n color: {\n primary: '#3b82f6',\n success: '#22c55e',\n warning: '#f59e0b',\n danger: '#ef4444',\n info: '#06b6d4',\n disabled: '#27272a',\n default: '#27272a'\n },\n\n bg: {\n color: {\n bottom: '#0c0c0e',\n middle: '#141417',\n top: '#1c1c21',\n hover: '#26262c',\n black: '#000000'\n },\n filter: { blur: 'none', saturate: 'none' }\n },\n\n 'text-color': {\n title: '#f4f4f5',\n main: '#d4d4d8',\n second: '#a1a1aa',\n placeholder: '#71717a',\n assist: '#52525b',\n disabled: '#3f3f46',\n white: '#ffffff'\n },\n\n border: { color: '#37373f', mutedColor: '#42424c' },\n\n shadow: {\n color: '#00000066',\n x: 0,\n y: 1,\n blur: 3,\n spread: 0,\n emboss: 'none',\n sm: '0 1px 2px 0 rgba(0, 0, 0, 0.4)',\n lg: '0 8px 24px 0 rgba(0, 0, 0, 0.5), 0 2px 6px 0 rgba(0, 0, 0, 0.35)'\n }\n },\n { series: 'dark' }\n)\n"],"mappings":";;AAEA,MAAa,YAAY,WAAW,IAClC;CACE,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;CACX;CAEA,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;EACT;EACA,QAAQ;GAAE,MAAM;GAAQ,UAAU;EAAO;CAC3C;CAEA,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;CACT;CAEA,QAAQ;EAAE,OAAO;EAAW,YAAY;CAAU;CAElD,QAAQ;EACN,OAAO;EACP,GAAG;EACH,GAAG;EACH,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,IAAI;EACJ,IAAI;CACN;AACF,GACA,EAAE,QAAQ,OAAO,CACnB"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { UITheme } from "../ui-theme.js";
|
|
2
2
|
import "../index.js";
|
|
3
3
|
//#region src/theme/presets/glass.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 玻璃拟态,天生适合深色(半透明背景 + 背景模糊在深色下层次最好)。
|
|
6
|
+
* 背景为 rgba() 时派生 token(kbd / batch-edit 混合色)无法自动推导,
|
|
7
|
+
* 需通过组件级扩展键显式声明。
|
|
8
|
+
*/
|
|
9
|
+
declare const glassTheme: UITheme;
|
|
6
10
|
//#endregion
|
|
7
|
-
export {
|
|
11
|
+
export { glassTheme };
|
|
8
12
|
//# sourceMappingURL=glass.d.ts.map
|
|
@@ -1,54 +1,17 @@
|
|
|
1
1
|
import { lightTheme } from "./light.js";
|
|
2
2
|
//#region src/theme/presets/glass.ts
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 玻璃拟态,天生适合深色(半透明背景 + 背景模糊在深色下层次最好)。
|
|
5
|
+
* 背景为 rgba() 时派生 token(kbd / batch-edit 混合色)无法自动推导,
|
|
6
|
+
* 需通过组件级扩展键显式声明。
|
|
7
|
+
*/
|
|
8
|
+
const glassTheme = lightTheme.new({
|
|
4
9
|
color: {
|
|
5
10
|
primary: "#3B82F6",
|
|
6
11
|
success: "#10B981",
|
|
7
12
|
warning: "#F59E0B",
|
|
8
13
|
danger: "#EF4444",
|
|
9
14
|
info: "#06B6D4",
|
|
10
|
-
disabled: "#E5E7EB",
|
|
11
|
-
default: "#F3F4F6"
|
|
12
|
-
},
|
|
13
|
-
bg: {
|
|
14
|
-
color: {
|
|
15
|
-
bottom: "rgba(255, 255, 255, 0.45)",
|
|
16
|
-
middle: "rgba(255, 255, 255, 0.55)",
|
|
17
|
-
top: "rgba(255, 255, 255, 0.6)",
|
|
18
|
-
hover: "rgba(255, 255, 255, 0.75)",
|
|
19
|
-
black: "#000000"
|
|
20
|
-
},
|
|
21
|
-
filter: {
|
|
22
|
-
blur: "blur(24px)",
|
|
23
|
-
saturate: "saturate(180%)"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
border: {
|
|
27
|
-
color: "rgba(15, 23, 42, 0.14)",
|
|
28
|
-
mutedColor: "rgba(15, 23, 42, 0.08)",
|
|
29
|
-
width: 1,
|
|
30
|
-
style: "solid"
|
|
31
|
-
},
|
|
32
|
-
"text-color": {
|
|
33
|
-
title: "#1E293B",
|
|
34
|
-
main: "#334155",
|
|
35
|
-
placeholder: "#94A3B8",
|
|
36
|
-
second: "#64748B",
|
|
37
|
-
assist: "#CBD5E1",
|
|
38
|
-
disabled: "#94A3B8",
|
|
39
|
-
white: "#FFFFFF"
|
|
40
|
-
},
|
|
41
|
-
shadow: {
|
|
42
|
-
color: "#00000014",
|
|
43
|
-
x: 0,
|
|
44
|
-
y: 4,
|
|
45
|
-
blur: 24,
|
|
46
|
-
spread: 0,
|
|
47
|
-
emboss: "none"
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const glassDarkTheme = glassLightTheme.new({
|
|
51
|
-
color: {
|
|
52
15
|
disabled: "#374151",
|
|
53
16
|
default: "#1E293B"
|
|
54
17
|
},
|
|
@@ -67,7 +30,9 @@ const glassDarkTheme = glassLightTheme.new({
|
|
|
67
30
|
},
|
|
68
31
|
border: {
|
|
69
32
|
color: "rgba(255, 255, 255, 0.18)",
|
|
70
|
-
mutedColor: "rgba(255, 255, 255, 0.1)"
|
|
33
|
+
mutedColor: "rgba(255, 255, 255, 0.1)",
|
|
34
|
+
width: 1,
|
|
35
|
+
style: "solid"
|
|
71
36
|
},
|
|
72
37
|
"text-color": {
|
|
73
38
|
title: "#F8FAFC",
|
|
@@ -87,9 +52,15 @@ const glassDarkTheme = glassLightTheme.new({
|
|
|
87
52
|
emboss: "none",
|
|
88
53
|
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.4)",
|
|
89
54
|
lg: "0 8px 24px 0 rgba(0, 0, 0, 0.55), 0 2px 6px 0 rgba(0, 0, 0, 0.35)"
|
|
90
|
-
}
|
|
91
|
-
|
|
55
|
+
},
|
|
56
|
+
kbd: {
|
|
57
|
+
"inset-shadow": "rgba(0, 0, 0, 0.5)",
|
|
58
|
+
"border-shadow": "rgba(255, 255, 255, 0.09)",
|
|
59
|
+
"drop-shadow": "rgba(0, 0, 0, 0.6)"
|
|
60
|
+
},
|
|
61
|
+
"batch-edit": { "form-header-bg": "rgba(15, 23, 42, 0.8)" }
|
|
62
|
+
}, { series: "dark" });
|
|
92
63
|
//#endregion
|
|
93
|
-
export {
|
|
64
|
+
export { glassTheme };
|
|
94
65
|
|
|
95
66
|
//# sourceMappingURL=glass.js.map
|