savor-ui 0.33.0 → 0.33.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
 
4
4
 
5
+ ## [0.33.1](https://gitee.com/mach552/savor-ui/compare/v0.33.0...v0.33.1) (2026-10-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **theme:** 修复仅设置 `lightTheme` 时暗色主题色未跟随自动生成 ([2207663](https://gitee.com/mach552/savor-ui/commits/220766393cab22de1b00d6820b99a277abfc6a62))
11
+
5
12
  # [0.33.0](https://gitee.com/mach552/savor-ui/compare/v0.32.0...v0.33.0) (2026-09-21)
6
13
 
7
14
 
@@ -2,7 +2,8 @@ import { ThemeTokens } from './types';
2
2
  type ThemeMode = "light" | "dark";
3
3
  export declare const lightTheme: ThemeTokens;
4
4
  export declare const darkTheme: ThemeTokens;
5
- export declare function resolveThemeTokens(overrides?: Partial<ThemeTokens>, mode?: ThemeMode): ThemeTokens;
6
- export declare function tokensToCssVars(tokens: ThemeTokens, mode?: ThemeMode): Record<string, string>;
7
- export declare function initTheme(light?: Partial<ThemeTokens>, dark?: Partial<ThemeTokens>): void;
5
+ export declare const resolveThemeTokens: (overrides?: Partial<ThemeTokens>, mode?: ThemeMode) => ThemeTokens;
6
+ export declare const tokensToCssVars: (tokens: ThemeTokens, mode?: ThemeMode) => Record<string, string>;
7
+ export declare const injectOrUpdateStyle: (id: string, selector: string, declarations: Record<string, string>) => void;
8
+ export declare const initTheme: (light?: Partial<ThemeTokens>, dark?: Partial<ThemeTokens>) => void;
8
9
  export {};
@@ -92,30 +92,41 @@ var t = "s", n = [
92
92
  "colorWarning",
93
93
  "colorDanger",
94
94
  "colorInfo"
95
- ]);
96
- function o(e) {
97
- return e.replace(/[A-Z]/g, (e) => "-" + e.toLowerCase()).replace(/([a-zA-Z])(\d)/g, "$1-$2").replace(/^-/, "");
98
- }
99
- function s(e, t = "light") {
100
- return {
101
- ...t === "light" ? r : i,
102
- ...e
103
- };
104
- }
105
- function c(r, i = "light") {
106
- let s = {};
107
- for (let [c, l] of Object.entries(r)) if (a.has(c)) {
108
- let r = `--${t}-${o(c)}`, a = e(l, { theme: i === "dark" ? "dark" : "default" });
109
- for (let e = 0; e < n.length; e++) s[`${r}-${n[e]}`] = a[e];
110
- } else s[`--${t}-${o(c)}`] = l;
111
- return s;
112
- }
113
- function l(e, t, n) {
95
+ ]), o = new Set([
96
+ ...n.map((e) => `colorFill${e}`),
97
+ "colorText1",
98
+ "colorText2",
99
+ "colorText3",
100
+ "colorBg1",
101
+ "colorBg2",
102
+ "colorBg3",
103
+ "shadow1",
104
+ "shadow2",
105
+ "shadow3"
106
+ ]), s = (e) => {
107
+ if (!e) return {};
108
+ let t = {};
109
+ for (let [n, r] of Object.entries(e)) o.has(n) || (t[n] = r);
110
+ return t;
111
+ }, c = (e) => e.replace(/[A-Z]/g, (e) => "-" + e.toLowerCase()).replace(/([a-zA-Z])(\d)/g, "$1-$2").replace(/^-/, ""), l = (e, t = "light") => ({
112
+ ...t === "light" ? r : i,
113
+ ...e
114
+ }), u = (r, i = "light") => {
115
+ let o = {};
116
+ for (let [s, l] of Object.entries(r)) if (a.has(s)) {
117
+ let r = `--${t}-${c(s)}`, a = e(l, { theme: i === "dark" ? "dark" : "default" });
118
+ for (let e = 0; e < n.length; e++) o[`${r}-${n[e]}`] = a[e];
119
+ } else o[`--${t}-${c(s)}`] = l;
120
+ return o;
121
+ }, d = (e, t, n) => {
114
122
  let r = document.getElementById(e);
115
123
  r || (r = document.createElement("style"), r.id = e, document.head.appendChild(r)), r.textContent = `${t} {\n${Object.entries(n).map(([e, t]) => ` ${e}: ${t};`).join("\n")}\n}`;
116
- }
117
- function u(e, t) {
118
- l("root-light-theme", ":root", c(s(e, "light"), "light")), l("root-dark-theme", "html.dark", c(s(t, "dark"), "dark"));
119
- }
124
+ }, f = (e, t) => {
125
+ let n = {
126
+ ...s(e),
127
+ ...t
128
+ };
129
+ d("root-light-theme", ":root", u(l(e, "light"), "light")), d("root-dark-theme", "html.dark", u(l(n, "dark"), "dark"));
130
+ };
120
131
  //#endregion
121
- export { i as darkTheme, u as initTheme, r as lightTheme, s as resolveThemeTokens, c as tokensToCssVars };
132
+ export { i as darkTheme, f as initTheme, r as lightTheme, l as resolveThemeTokens, u as tokensToCssVars };
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "savor-ui",
5
- "version": "0.32.0",
5
+ "version": "0.33.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "savor-ui",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "A Vue3 Components Library",
5
5
  "keywords": [
6
6
  "component library",