@hlw-uni/mp-vue 2.1.59 → 2.1.69

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 (38) hide show
  1. package/README.md +388 -213
  2. package/dist/composables/index.d.ts +0 -8
  3. package/dist/composables/request/service.d.ts +2 -6
  4. package/dist/core/index.d.ts +1 -0
  5. package/dist/core/theme.d.ts +21 -0
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +113 -367
  8. package/dist/index.mjs +113 -367
  9. package/dist/stores/index.d.ts +1 -0
  10. package/dist/stores/theme.d.ts +26 -55
  11. package/package.json +1 -1
  12. package/src/components/hlw-add-mini/index.vue +147 -77
  13. package/src/components/hlw-avatar/index.vue +28 -20
  14. package/src/components/hlw-card-header/index.vue +3 -0
  15. package/src/components/hlw-cell/index.vue +6 -0
  16. package/src/components/hlw-custom/hlw-custom.vue +6 -5
  17. package/src/components/hlw-menu/index.vue +9 -3
  18. package/src/components/hlw-nav-bar/index.vue +181 -0
  19. package/src/components/hlw-page/index.vue +75 -105
  20. package/src/composables/index.ts +1 -31
  21. package/src/composables/request/service.ts +10 -3
  22. package/src/core/index.ts +1 -0
  23. package/src/core/theme.ts +62 -0
  24. package/src/env.d.ts +8 -0
  25. package/src/index.ts +10 -4
  26. package/src/stores/index.ts +1 -0
  27. package/src/stores/theme.ts +113 -101
  28. package/dist/composables/theme/appearance.d.ts +0 -55
  29. package/dist/composables/theme/font.d.ts +0 -32
  30. package/dist/composables/theme/index.d.ts +0 -46
  31. package/dist/composables/theme/palette.d.ts +0 -37
  32. package/dist/composables/theme/typography.d.ts +0 -41
  33. package/src/composables/theme/README.md +0 -131
  34. package/src/composables/theme/appearance.ts +0 -129
  35. package/src/composables/theme/font.ts +0 -95
  36. package/src/composables/theme/index.ts +0 -89
  37. package/src/composables/theme/palette.ts +0 -117
  38. package/src/composables/theme/typography.ts +0 -90
@@ -1,128 +1,98 @@
1
1
  <template>
2
- <view :class="['hlw-page', attrs.class]" :style="attrs.style">
3
- <view class="hlw-page-header">
4
- <slot name="header">
5
- <hlw-header
6
- v-if="props.title || props.isBack"
7
- :title="props.title"
8
- :is-back="props.isBack"
9
- :bg-class="props.bgClass"
10
- />
11
- </slot>
12
- </view>
13
-
14
- <scroll-view
15
- class="hlw-page-content"
16
- :scroll-y="true"
17
- :enable-flex="true"
18
- :enhanced="true"
19
- :show-scrollbar="false"
20
- :scroll-top="scrollTo"
21
- :scroll-with-animation="true"
22
- @scroll="onScroll"
23
- >
24
- <view class="hlw-page-body" :class="bodyClass" :style="bodyStyle">
25
- <slot />
26
- </view>
27
- </scroll-view>
28
-
29
- <view class="hlw-page-footer">
30
- <slot name="footer" />
31
- </view>
2
+ <view :class="[theme, fontSizeClass, fontFamilyClass]" style="padding-bottom: 100rpx">
3
+ <hlw-nav-bar :is-back="props.isBack" :title="title" :is-bar="props.isBar"></hlw-nav-bar>
4
+ <slot></slot>
32
5
  </view>
33
6
  </template>
34
7
 
35
- <script setup lang="ts">
36
- /**
37
- * hlw-page 不再负责主题 style 注入。
38
- * 业务项目可通过 @hlw-uni/mp-vite-plugin themePageMeta 自动注入 page-meta。
39
- * —— 这样才能把 CSS 变量注入到 page 根,scroll-view 等小程序原生组件内部也能继承。
40
- *
41
- * provide("hlwPageScroll") —— 给 hlw-back-top 等子组件用:
42
- * - scrollTop: Ref<number> 当前滚动位置(来自 scroll-view @scroll)
43
- * - scrollToTop(): void 滚动到顶部(带动画)
44
- */
45
-
46
- import { nextTick, provide, ref, useAttrs } from "vue";
47
-
48
- defineOptions({
49
- name: "HlwPage",
50
- inheritAttrs: false,
8
+ <script lang="ts" setup>
9
+ import { useTheme } from "@/core";
10
+ import { onLoad, onShow } from "@dcloudio/uni-app";
11
+ import { ref } from "vue";
12
+ const { theme, fontSizeClass, fontFamilyClass } = useTheme();
13
+
14
+ const props = defineProps({
15
+ isBar: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ title: {
20
+ type: String,
21
+ default: "",
22
+ },
23
+ isBack: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
51
27
  });
52
28
 
53
- type ClassValue = string | Record<string, boolean> | Array<string | Record<string, boolean>>;
54
- type StyleValue = string | Record<string, string | number>;
29
+ const title = ref(props.title);
30
+ </script>
55
31
 
56
- interface Props {
57
- title?: string;
58
- isBack?: boolean;
59
- bgClass?: string;
60
- /**
61
- * 透传到 scroll-view 内层 view 包裹(不是 scroll-view 本身)的 class,常用于直接挂 .container。
62
- * 用 view 包裹是因为 mp-weixin 的 scroll-view 是原生组件,flex/gap 行为跟普通 view 不一致。
63
- */
64
- bodyClass?: ClassValue;
65
- /** 透传到内层 view 包裹的 style,规则同 bodyClass */
66
- bodyStyle?: StyleValue;
32
+ <style lang="scss">
33
+ /* 全局系统字体大小缩放配置 */
34
+ .font-size-small {
35
+ --font-xs: 18rpx;
36
+ --font-sm: 22rpx;
37
+ --font-base: 24rpx;
38
+ --font-md: 28rpx;
39
+ --font-lg: 32rpx;
40
+ --font-xl: 36rpx;
67
41
  }
68
42
 
69
- const props = withDefaults(defineProps<Props>(), {
70
- title: "",
71
- isBack: false,
72
- bgClass: "",
73
- bodyClass: "",
74
- bodyStyle: "",
75
- });
76
- const attrs = useAttrs();
77
-
78
- const scrollTop = ref(0);
79
- const scrollTo = ref(0);
80
-
81
- function onScroll(e: any) {
82
- scrollTop.value = e?.detail?.scrollTop ?? 0;
43
+ .font-size-standard {
44
+ --font-xs: 20rpx;
45
+ --font-sm: 24rpx;
46
+ --font-base: 28rpx;
47
+ --font-md: 32rpx;
48
+ --font-lg: 36rpx;
49
+ --font-xl: 40rpx;
83
50
  }
84
51
 
85
- function scrollToTop() {
86
- // 先同步到当前位置,再动画到 0;否则同值不会触发 scroll-view 重滚
87
- scrollTo.value = scrollTop.value;
88
- nextTick(() => {
89
- scrollTo.value = 0;
90
- });
52
+ .font-size-large {
53
+ --font-xs: 22rpx;
54
+ --font-sm: 28rpx;
55
+ --font-base: 32rpx;
56
+ --font-md: 36rpx;
57
+ --font-lg: 40rpx;
58
+ --font-xl: 44rpx;
91
59
  }
92
60
 
93
- provide("hlwPageScroll", {
94
- scrollTop,
95
- scrollToTop,
96
- });
97
- </script>
98
-
99
- <style lang="scss" scoped>
100
- .hlw-page {
101
- width: 100%;
102
- height: 100vh;
103
- display: flex;
104
- flex-direction: column;
105
- overflow: hidden;
106
- color: var(--text-primary, #0f172a);
61
+ .font-size-extra-large {
62
+ --font-xs: 24rpx;
63
+ --font-sm: 32rpx;
64
+ --font-base: 36rpx;
65
+ --font-md: 40rpx;
66
+ --font-lg: 44rpx;
67
+ --font-xl: 48rpx;
107
68
  }
108
69
 
109
- .hlw-page-header {
110
- flex-shrink: 0;
70
+ /* 全局字体样式配置 */
71
+ .font-family-system {
72
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
73
+ view, text, button, input, textarea {
74
+ font-family: inherit !important;
75
+ }
111
76
  }
112
77
 
113
- .hlw-page-content {
114
- flex: 1;
115
- height: 0;
116
- width: 100%;
78
+ .font-family-sans {
79
+ font-family: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif !important;
80
+ view, text, button, input, textarea {
81
+ font-family: inherit !important;
82
+ }
117
83
  }
118
84
 
119
- .hlw-page-body {
120
- width: 100%;
121
- display: flex;
122
- flex-direction: column;
85
+ .font-family-serif {
86
+ font-family: "Songti SC", "STSong", "SimSun", "Georgia", serif !important;
87
+ view, text, button, input, textarea {
88
+ font-family: inherit !important;
89
+ }
123
90
  }
124
91
 
125
- .hlw-page-footer {
126
- flex-shrink: 0;
92
+ .font-family-kaiti {
93
+ font-family: "Kaiti SC", "STKaiti", "KaiTi", "SimKai", serif !important;
94
+ view, text, button, input, textarea {
95
+ font-family: inherit !important;
96
+ }
127
97
  }
128
98
  </style>
@@ -35,34 +35,4 @@ export {
35
35
  } from "./utils";
36
36
  export { useNavigate, type NavigateType, type NavigateOptions } from "./navigator";
37
37
 
38
- // Theme(mp-vue 自带)
39
- export type { FontScale, FontPreset } from "./theme";
40
- export {
41
- FONT_SCALE_KEY,
42
- FONT_PRESETS,
43
- getCurrentFontScale,
44
- getCurrentFontVars,
45
- THEME_CHANGE_EVENT,
46
- buildThemeStyle,
47
- useThemePageStyle,
48
- } from "./theme";
49
- export type { ThemeColor } from "./theme";
50
- export {
51
- THEME_COLOR_KEY,
52
- THEME_SEMANTIC_COLORS,
53
- DEFAULT_THEMES,
54
- getCurrentThemeColor,
55
- getCurrentThemeVars,
56
- } from "./theme";
57
- export type { Appearance, AppearanceMode, AppearancePreset } from "./theme";
58
- export {
59
- APPEARANCE_KEY,
60
- APPEARANCE_PRESETS,
61
- APPEARANCE_VAR_MAP,
62
- getCurrentAppearance,
63
- getCurrentAppearanceMode,
64
- getCurrentAppearanceVars,
65
- resolveAppearance,
66
- } from "./theme";
67
- export type { TypographyRole } from "./theme";
68
- export { TYPOGRAPHY_ROLES, getCurrentTypographyVars } from "./theme";
38
+
@@ -119,8 +119,15 @@ export function ServicePrefix(value: string | ServicePrefixOptions) {
119
119
 
120
120
  /**
121
121
  * 插件服务类装饰器。
122
- * 自动使用 `import.meta.env.VITE_PLUGIN_NAME` 作为服务前缀。
122
+ * 自动使用 `import.meta.env.VITE_PLUGIN_NAME` 作为服务前缀(通过 globalThis 动态读取)。
123
123
  */
124
- export function PluginService(target: { prototype: { servicePrefix?: string } }) {
125
- target.prototype.servicePrefix = import.meta.env.VITE_PLUGIN_NAME || "";
124
+ export function PluginService(target: any) {
125
+ Object.defineProperty(target.prototype, "servicePrefix", {
126
+ get() {
127
+ return globalThis.VITE_PLUGIN_NAME || "";
128
+ },
129
+ enumerable: true,
130
+ configurable: true
131
+ });
126
132
  }
133
+
@@ -0,0 +1 @@
1
+ export * from "./theme";
@@ -0,0 +1,62 @@
1
+ import { computed } from "vue";
2
+ import type { ComputedRef } from "vue";
3
+ import {
4
+ useThemeStore,
5
+ themePresets,
6
+ fontSizePresets,
7
+ fontFamilyPresets
8
+ } from "../stores/theme";
9
+
10
+ export {
11
+ themePresets,
12
+ type ThemePreset,
13
+ fontSizePresets,
14
+ type FontSizePreset,
15
+ fontFamilyPresets,
16
+ type FontFamilyPreset
17
+ } from "../stores/theme";
18
+
19
+ // ==========================================
20
+ // 统一个性化外观配置 Hook (useTheme)
21
+ // ==========================================
22
+
23
+ export function useTheme() {
24
+ const store = useThemeStore();
25
+
26
+ // 主题
27
+ const theme: ComputedRef<string> = computed(() => store.theme);
28
+
29
+ // 字体大小
30
+ const fontSize: ComputedRef<string> = computed(() => store.fontSize);
31
+ const fontSizeClass: ComputedRef<string> = computed(() => {
32
+ const found = fontSizePresets.find((p) => p.id === store.fontSize);
33
+ return found ? found.class : "font-size-standard";
34
+ });
35
+
36
+ // 字体样式
37
+ const fontFamily: ComputedRef<string> = computed(() => store.fontFamily);
38
+ const fontFamilyClass: ComputedRef<string> = computed(() => {
39
+ const found = fontFamilyPresets.find((p) => p.id === store.fontFamily);
40
+ return found ? found.class : "font-family-system";
41
+ });
42
+
43
+ // 动作方法
44
+ function setFontSize(size: string): void {
45
+ store.setFontSize(size);
46
+ }
47
+
48
+ function setFontFamily(font: string): void {
49
+ store.setFontFamily(font);
50
+ }
51
+
52
+ return {
53
+ theme,
54
+ fontSize,
55
+ fontSizeClass,
56
+ setFontSize,
57
+ fontFamily,
58
+ fontFamilyClass,
59
+ setFontFamily,
60
+ store,
61
+ };
62
+ }
package/src/env.d.ts CHANGED
@@ -3,3 +3,11 @@ declare module '*.vue' {
3
3
  const component: DefineComponent<object, object, unknown>
4
4
  export default component
5
5
  }
6
+
7
+ declare global {
8
+ var VITE_PLUGIN_NAME: string | undefined;
9
+ }
10
+
11
+ export {};
12
+
13
+
package/src/index.ts CHANGED
@@ -3,21 +3,27 @@
3
3
  *
4
4
  * 2.0 起合并了原 @hlw-uni/mp-core 全部内容。
5
5
  * 业务方一处 import,无需再分包:
6
- * import { useMsg, useThemePageStyle, ... } from "@hlw-uni/mp-vue";
6
+ * import { useMsg, useTheme, ... } from "@hlw-uni/mp-vue";
7
7
  *
8
8
  * UI 组件(hlw-page / hlw-button / hlw-ad 等)走 easycom 自动注册,不在这里 export。
9
9
  */
10
10
 
11
11
  // Composables / 工具 / Theme
12
12
  export * from "./composables";
13
+ export {
14
+ useTheme,
15
+ themePresets,
16
+ type ThemePreset,
17
+ fontFamilyPresets,
18
+ type FontFamilyPreset,
19
+ fontSizePresets,
20
+ type FontSizePreset
21
+ } from "./core/theme";
13
22
 
14
23
  // 类型
15
24
  export type { HlwMenuItem } from "./components/hlw-menu/types";
16
25
  export type { HlwPagingRef, HlwPagingInstance } from "./components/hlw-paging/types";
17
26
 
18
- // Pinia store
19
- export { useThemeStore } from "./stores/theme";
20
-
21
27
  // App 根上下文
22
28
  export { useApp } from "./app";
23
29
 
@@ -0,0 +1 @@
1
+ export * from "./theme";
@@ -1,114 +1,126 @@
1
- /**
2
- * Theme Store — 全局主题设置(字体档位 + 主题色)
3
- * 持久化到 storage,变更时广播 THEME_CHANGE_EVENT 通知所有页面实时刷新
4
- */
5
1
  import { defineStore } from "pinia";
6
- import { ref, computed } from "vue";
7
- import {
8
- FONT_PRESETS,
9
- FONT_SCALE_KEY,
10
- DEFAULT_THEMES,
11
- THEME_COLOR_KEY,
12
- THEME_CHANGE_EVENT,
13
- APPEARANCE_KEY,
14
- APPEARANCE_PRESETS,
15
- resolveAppearance,
16
- } from "../composables/theme";
17
- import type { FontScale, ThemeColor, Appearance, AppearanceMode } from "../composables/theme";
18
2
 
19
- /**
20
- * 统一管理全局主题、字体缩放和外观模式的 Pinia Store。
21
- */
22
- export const useThemeStore = defineStore(
23
- "theme",
24
- () => {
25
- // ─── 字体档位 ────────────────────────────
26
- /** 当前生效的字体大小档位 */
27
- const scale = ref<FontScale>("normal");
3
+ // ==========================================
4
+ // 1. 主题 (Theme) 预设与类型
5
+ // ==========================================
28
6
 
29
- /**
30
- * 改变并保存当前的字体大小档位。
31
- *
32
- * @param s 目标字体大小档位
33
- */
34
- function setScale(s: FontScale) {
35
- scale.value = s;
36
- uni.setStorageSync(FONT_SCALE_KEY, s);
37
- uni.$emit(THEME_CHANGE_EVENT);
38
- }
7
+ export interface ThemePreset {
8
+ id: string;
9
+ name: string;
10
+ color: string;
11
+ }
39
12
 
40
- /** 供界面渲染选择的字体档位选项列表 */
41
- const fontOptions = (Object.keys(FONT_PRESETS) as FontScale[]).map((key) => ({
42
- value: key,
43
- label: FONT_PRESETS[key].label,
44
- }));
45
-
46
- // ─── 主题色 ─────────────────────────────
47
- /** 当前生效的主题色十六进制值 (Hex Color) */
48
- const primaryColor = ref(DEFAULT_THEMES[0].value);
49
-
50
- /** 系统内置的预设主题颜色列表 */
51
- const themes = DEFAULT_THEMES;
13
+ export const themePresets: ThemePreset[] = [
14
+ {
15
+ id: "white-theme",
16
+ name: "白色主题",
17
+ color: "#ffffff",
18
+ },
19
+ {
20
+ id: "light-theme",
21
+ name: "简洁主题",
22
+ color: "var(--bg-page, #f8f8f8)",
23
+ },
24
+ {
25
+ id: "mono-theme",
26
+ name: "单色主题",
27
+ color: "var(--primary-color, #3b82f6)",
28
+ },
29
+ {
30
+ id: "color-theme",
31
+ name: "颜色主题",
32
+ color: "var(--primary-color, #3b82f6)",
33
+ },
34
+ ];
52
35
 
53
- /** 当前激活的主题色相关信息 */
54
- const activeTheme = computed<ThemeColor>(() =>
55
- themes.find((t: ThemeColor) => t.value === primaryColor.value)
56
- ?? { label: "自定义", value: primaryColor.value },
57
- );
36
+ // ==========================================
37
+ // 2. 字体大小 (FontSize) 预设与类型
38
+ // ==========================================
58
39
 
59
- /**
60
- * 更改并保存全局主题色。
61
- *
62
- * @param color 颜色 Hex 字符串
63
- */
64
- function setTheme(color: string) {
65
- primaryColor.value = color;
66
- uni.setStorageSync(THEME_COLOR_KEY, color);
67
- uni.$emit(THEME_CHANGE_EVENT);
68
- }
40
+ export interface FontSizePreset {
41
+ id: string;
42
+ name: string;
43
+ class: string;
44
+ }
69
45
 
70
- // ─── 外观模式(light / dark / auto) ─────────
71
- /** 当前设置的外观显示模式:浅色、深色或自动跟随系统 */
72
- const appearance = ref<Appearance>("auto");
46
+ export const fontSizePresets: FontSizePreset[] = [
47
+ {
48
+ id: "small",
49
+ name: "较小",
50
+ class: "font-size-small",
51
+ },
52
+ {
53
+ id: "standard",
54
+ name: "标准",
55
+ class: "font-size-standard",
56
+ },
57
+ {
58
+ id: "large",
59
+ name: "较大",
60
+ class: "font-size-large",
61
+ },
62
+ {
63
+ id: "extra-large",
64
+ name: "超大",
65
+ class: "font-size-extra-large",
66
+ },
67
+ ];
73
68
 
74
- /** 可供选择的外观预设配置列表 */
75
- const appearanceOptions = APPEARANCE_PRESETS;
69
+ // ==========================================
70
+ // 3. 字体样式 (FontFamily) 预设与类型
71
+ // ==========================================
76
72
 
77
- /** 当前最终解析的实际生效模式(auto 会依据系统检测解析为 light 或 dark) */
78
- const appearanceMode = computed<AppearanceMode>(() => resolveAppearance(appearance.value));
73
+ export interface FontFamilyPreset {
74
+ id: string;
75
+ name: string;
76
+ class: string;
77
+ }
79
78
 
80
- /** 是否正处于深色模式,可供业务组件在 template 中直接用作条件渲染 */
81
- const isDark = computed(() => appearanceMode.value === "dark");
79
+ export const fontFamilyPresets: FontFamilyPreset[] = [
80
+ {
81
+ id: "system",
82
+ name: "系统默认",
83
+ class: "font-family-system",
84
+ },
85
+ {
86
+ id: "sans",
87
+ name: "现代黑体",
88
+ class: "font-family-sans",
89
+ },
90
+ {
91
+ id: "serif",
92
+ name: "经典宋体",
93
+ class: "font-family-serif",
94
+ },
95
+ {
96
+ id: "kaiti",
97
+ name: "优雅楷体",
98
+ class: "font-family-kaiti",
99
+ },
100
+ ];
82
101
 
83
- /**
84
- * 改变外观设置模式。
85
- *
86
- * @param a 目标模式
87
- */
88
- function setAppearance(a: Appearance) {
89
- appearance.value = a;
90
- uni.setStorageSync(APPEARANCE_KEY, a);
91
- uni.$emit(THEME_CHANGE_EVENT);
92
- }
102
+ // ==========================================
103
+ // 4. 统一个性化配置 Store (Theme / Font)
104
+ // ==========================================
93
105
 
94
- return {
95
- // 字体
96
- scale,
97
- fontOptions,
98
- setScale,
99
- // 主题色
100
- primaryColor,
101
- themes,
102
- activeTheme,
103
- setTheme,
104
- // 外观模式
105
- appearance,
106
- appearanceOptions,
107
- appearanceMode,
108
- isDark,
109
- setAppearance,
110
- };
106
+ export const useThemeStore = defineStore("theme", {
107
+ state: () => ({
108
+ theme: "white-theme",
109
+ fontSize: "standard",
110
+ fontFamily: "system",
111
+ }),
112
+ getters: {},
113
+ actions: {
114
+ setFontSize(size: string) {
115
+ if (["small", "standard", "large", "extra-large"].includes(size)) {
116
+ this.fontSize = size;
117
+ }
118
+ },
119
+ setFontFamily(font: string) {
120
+ if (["system", "sans", "serif", "kaiti"].includes(font)) {
121
+ this.fontFamily = font;
122
+ }
123
+ },
111
124
  },
112
- { unistorage: true },
113
- );
114
-
125
+ unistorage: true,
126
+ });
@@ -1,55 +0,0 @@
1
- /**
2
- * 外观模式 — 浅色 / 深色 / 跟随系统
3
- *
4
- * 提供一套语义化 CSS 变量(--bg-page, --surface-card, --text-primary ...)。
5
- * 默认不通过 useThemePageStyle 注入,业务项目应在全局 CSS 中声明这些变量,
6
- * 避免运行时 page-meta 覆盖业务侧样式。
7
- *
8
- * 使用指南:
9
- * - 业务样式里用 `var(--text-primary)` 代替硬编码 `#0f172a`
10
- * - 用 `var(--surface-card)` 代替硬编码 `#ffffff`
11
- * - 用 `var(--border-color-light)` 代替硬编码 `#f1f5f9`
12
- */
13
- /** 外观模式选项类型:浅色模式、深色模式、跟随系统 */
14
- export type Appearance = "light" | "dark" | "auto";
15
- /** 实际生效的外观模式:仅浅色或深色 */
16
- export type AppearanceMode = "light" | "dark";
17
- /**
18
- * 外观预设配置接口。
19
- */
20
- export interface AppearancePreset {
21
- /** 选项值 */
22
- value: Appearance;
23
- /** 选项展示名称 */
24
- label: string;
25
- }
26
- /** 存储外观设置的 LocalStorage 键名 */
27
- export declare const APPEARANCE_KEY = "hlw_appearance";
28
- /** 预设外观模式列表,常供设置页渲染选择器使用 */
29
- export declare const APPEARANCE_PRESETS: AppearancePreset[];
30
- /** 不同外观模式的 CSS 变量映射 */
31
- export declare const APPEARANCE_VAR_MAP: Record<AppearanceMode, Record<string, string>>;
32
- /**
33
- * 读取用户设置的外观配置(light / dark / auto)。
34
- * 默认返回 'auto'。
35
- * @returns 设定的外观模式类型
36
- */
37
- export declare function getCurrentAppearance(): Appearance;
38
- /**
39
- * 将 auto 设置或用户选择解析为具体的 light/dark 实际模式。
40
- * 当为 auto 时,将读取系统当前的配色偏好。
41
- * @param appearance 输入的外观配置
42
- * @returns 解析后最终生效的外观模式 (light 或 dark)
43
- */
44
- export declare function resolveAppearance(appearance: Appearance): AppearanceMode;
45
- /**
46
- * 获取当前实际生效的外观模式 (light 或 dark)。
47
- * 自动根据用户偏好及系统主题进行判定。
48
- * @returns 实际生效的外观模式
49
- */
50
- export declare function getCurrentAppearanceMode(): AppearanceMode;
51
- /**
52
- * 获取当前外观对应的 CSS 变量映射表。
53
- * @returns 包含各 CSS 变量名与对应颜色值键值对
54
- */
55
- export declare function getCurrentAppearanceVars(): Record<string, string>;