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
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
118
|
-
|
|
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,
|
|
132
|
+
export { i as darkTheme, f as initTheme, r as lightTheme, l as resolveThemeTokens, u as tokensToCssVars };
|
package/dist/json/web-types.json
CHANGED