@hlw-uni/mp-vue 2.1.50 → 2.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/theme/index.d.ts +2 -1
- package/dist/index.js +11 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
- package/src/composables/theme/index.ts +17 -2
|
@@ -7,7 +7,8 @@ export declare const THEME_CHANGE_EVENT = "hlw:theme-change";
|
|
|
7
7
|
/**
|
|
8
8
|
* 只注入会随主题变化的变量(字号档位、主题色、外观模式)。
|
|
9
9
|
*
|
|
10
|
-
* 语义排版 token(--text-title-size
|
|
10
|
+
* 语义排版 token(--text-title-size 等)和业务视觉变量(如边框色)
|
|
11
|
+
* 是静态值、不随主题变化,
|
|
11
12
|
* 放在项目的全局 CSS(static/css/style.scss)里作为 page{} 默认值即可,
|
|
12
13
|
* 让业务侧可以自由 override,不被运行时注入覆盖。
|
|
13
14
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1485,12 +1485,22 @@ var __publicField = (obj, key, value) => {
|
|
|
1485
1485
|
return vars;
|
|
1486
1486
|
}
|
|
1487
1487
|
const { varsToStyle } = useColor();
|
|
1488
|
+
const CSS_CONTROLLED_THEME_VARS = /* @__PURE__ */ new Set(["--border-color", "--border-color-light", "--border-color-focus"]);
|
|
1488
1489
|
const THEME_CHANGE_EVENT = "hlw:theme-change";
|
|
1490
|
+
function omitCssControlledThemeVars(vars) {
|
|
1491
|
+
const next = {};
|
|
1492
|
+
Object.entries(vars).forEach(([name, value]) => {
|
|
1493
|
+
if (!CSS_CONTROLLED_THEME_VARS.has(name)) {
|
|
1494
|
+
next[name] = value;
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
return next;
|
|
1498
|
+
}
|
|
1489
1499
|
function buildThemeStyle() {
|
|
1490
1500
|
return varsToStyle({
|
|
1491
1501
|
...getCurrentFontVars(),
|
|
1492
1502
|
...getCurrentThemeVars(),
|
|
1493
|
-
...getCurrentAppearanceVars()
|
|
1503
|
+
...omitCssControlledThemeVars(getCurrentAppearanceVars())
|
|
1494
1504
|
});
|
|
1495
1505
|
}
|
|
1496
1506
|
function useThemePageStyle() {
|
package/dist/index.mjs
CHANGED
|
@@ -1484,12 +1484,22 @@ function getCurrentTypographyVars() {
|
|
|
1484
1484
|
return vars;
|
|
1485
1485
|
}
|
|
1486
1486
|
const { varsToStyle } = useColor();
|
|
1487
|
+
const CSS_CONTROLLED_THEME_VARS = /* @__PURE__ */ new Set(["--border-color", "--border-color-light", "--border-color-focus"]);
|
|
1487
1488
|
const THEME_CHANGE_EVENT = "hlw:theme-change";
|
|
1489
|
+
function omitCssControlledThemeVars(vars) {
|
|
1490
|
+
const next = {};
|
|
1491
|
+
Object.entries(vars).forEach(([name, value]) => {
|
|
1492
|
+
if (!CSS_CONTROLLED_THEME_VARS.has(name)) {
|
|
1493
|
+
next[name] = value;
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
return next;
|
|
1497
|
+
}
|
|
1488
1498
|
function buildThemeStyle() {
|
|
1489
1499
|
return varsToStyle({
|
|
1490
1500
|
...getCurrentFontVars(),
|
|
1491
1501
|
...getCurrentThemeVars(),
|
|
1492
|
-
...getCurrentAppearanceVars()
|
|
1502
|
+
...omitCssControlledThemeVars(getCurrentAppearanceVars())
|
|
1493
1503
|
});
|
|
1494
1504
|
}
|
|
1495
1505
|
function useThemePageStyle() {
|
package/package.json
CHANGED
|
@@ -7,16 +7,31 @@ import { getCurrentFontVars } from "./font";
|
|
|
7
7
|
import { getCurrentThemeVars } from "./palette";
|
|
8
8
|
import { getCurrentAppearanceVars } from "./appearance";
|
|
9
9
|
|
|
10
|
+
const CSS_CONTROLLED_THEME_VARS = new Set(["--border-color", "--border-color-light", "--border-color-focus"]);
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* @deprecated 历史事件名;现已改用 pinia store 响应式驱动,emit 不再有效。
|
|
12
14
|
* 保留 export 仅为不破坏外部 import(不影响功能)。
|
|
13
15
|
*/
|
|
14
16
|
export const THEME_CHANGE_EVENT = "hlw:theme-change";
|
|
15
17
|
|
|
18
|
+
function omitCssControlledThemeVars(vars: Record<string, string>) {
|
|
19
|
+
const next: Record<string, string> = {};
|
|
20
|
+
|
|
21
|
+
Object.entries(vars).forEach(([name, value]) => {
|
|
22
|
+
if (!CSS_CONTROLLED_THEME_VARS.has(name)) {
|
|
23
|
+
next[name] = value;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return next;
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
/**
|
|
17
31
|
* 只注入会随主题变化的变量(字号档位、主题色、外观模式)。
|
|
18
32
|
*
|
|
19
|
-
* 语义排版 token(--text-title-size
|
|
33
|
+
* 语义排版 token(--text-title-size 等)和业务视觉变量(如边框色)
|
|
34
|
+
* 是静态值、不随主题变化,
|
|
20
35
|
* 放在项目的全局 CSS(static/css/style.scss)里作为 page{} 默认值即可,
|
|
21
36
|
* 让业务侧可以自由 override,不被运行时注入覆盖。
|
|
22
37
|
*/
|
|
@@ -24,7 +39,7 @@ export function buildThemeStyle(): string {
|
|
|
24
39
|
return varsToStyle({
|
|
25
40
|
...getCurrentFontVars(),
|
|
26
41
|
...getCurrentThemeVars(),
|
|
27
|
-
...getCurrentAppearanceVars(),
|
|
42
|
+
...omitCssControlledThemeVars(getCurrentAppearanceVars()),
|
|
28
43
|
});
|
|
29
44
|
}
|
|
30
45
|
|