@hlw-uni/mp-vue 2.1.59 → 2.1.60
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 +388 -213
- package/dist/composables/index.d.ts +0 -8
- package/dist/composables/request/service.d.ts +2 -6
- package/dist/core/index.d.ts +1 -0
- package/dist/core/theme.d.ts +8 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +9 -384
- package/dist/index.mjs +8 -384
- package/package.json +1 -1
- package/src/components/hlw-nav-bar/index.vue +121 -0
- package/src/components/hlw-page/index.vue +24 -120
- package/src/composables/index.ts +1 -31
- package/src/composables/request/service.ts +10 -3
- package/src/core/index.ts +1 -0
- package/src/core/theme.ts +12 -0
- package/src/env.d.ts +8 -0
- package/src/index.ts +1 -2
- package/dist/composables/theme/appearance.d.ts +0 -55
- package/dist/composables/theme/font.d.ts +0 -32
- package/dist/composables/theme/index.d.ts +0 -46
- package/dist/composables/theme/palette.d.ts +0 -37
- package/dist/composables/theme/typography.d.ts +0 -41
- package/dist/stores/theme.d.ts +0 -56
- package/src/composables/theme/README.md +0 -131
- package/src/composables/theme/appearance.ts +0 -129
- package/src/composables/theme/font.ts +0 -95
- package/src/composables/theme/index.ts +0 -89
- package/src/composables/theme/palette.ts +0 -117
- package/src/composables/theme/typography.ts +0 -90
- package/src/stores/theme.ts +0 -114
|
@@ -9,11 +9,3 @@ export { useShare, type ShareConfig, } from './share';
|
|
|
9
9
|
export { useHlwAd, type AdRes } from './ad';
|
|
10
10
|
export { useUtils, withQuery, toQuery, signText, toNumber, toBoolean, copy, paste, auth, saveImage, saveVideoFile, download, saveImageUrl, saveVideoUrl, type DownloadOpt, type DownloadRes, } from './utils';
|
|
11
11
|
export { useNavigate, type NavigateType, type NavigateOptions } from './navigator';
|
|
12
|
-
export type { FontScale, FontPreset } from './theme';
|
|
13
|
-
export { FONT_SCALE_KEY, FONT_PRESETS, getCurrentFontScale, getCurrentFontVars, THEME_CHANGE_EVENT, buildThemeStyle, useThemePageStyle, } from './theme';
|
|
14
|
-
export type { ThemeColor } from './theme';
|
|
15
|
-
export { THEME_COLOR_KEY, THEME_SEMANTIC_COLORS, DEFAULT_THEMES, getCurrentThemeColor, getCurrentThemeVars, } from './theme';
|
|
16
|
-
export type { Appearance, AppearanceMode, AppearancePreset } from './theme';
|
|
17
|
-
export { APPEARANCE_KEY, APPEARANCE_PRESETS, APPEARANCE_VAR_MAP, getCurrentAppearance, getCurrentAppearanceMode, getCurrentAppearanceVars, resolveAppearance, } from './theme';
|
|
18
|
-
export type { TypographyRole } from './theme';
|
|
19
|
-
export { TYPOGRAPHY_ROLES, getCurrentTypographyVars } from './theme';
|
|
@@ -94,10 +94,6 @@ export declare function ServicePrefix(value: string | ServicePrefixOptions): (ta
|
|
|
94
94
|
}) => void;
|
|
95
95
|
/**
|
|
96
96
|
* 插件服务类装饰器。
|
|
97
|
-
* 自动使用 `import.meta.env.VITE_PLUGIN_NAME`
|
|
97
|
+
* 自动使用 `import.meta.env.VITE_PLUGIN_NAME` 作为服务前缀(通过 globalThis 动态读取)。
|
|
98
98
|
*/
|
|
99
|
-
export declare function PluginService(target:
|
|
100
|
-
prototype: {
|
|
101
|
-
servicePrefix?: string;
|
|
102
|
-
};
|
|
103
|
-
}): void;
|
|
99
|
+
export declare function PluginService(target: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './theme';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
export * from './composables';
|
|
11
11
|
export type { HlwMenuItem } from './components/hlw-menu/types';
|
|
12
12
|
export type { HlwPagingRef, HlwPagingInstance } from './components/hlw-paging/types';
|
|
13
|
-
export { useThemeStore } from './stores/theme';
|
|
14
13
|
export { useApp } from './app';
|
|
15
14
|
export { hlw, type HlwInstance } from './hlw';
|
|
16
15
|
export { vCopy } from './directives';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("@dcloudio/uni-app")
|
|
3
|
-
})(this, function(exports2, vue, uniApp
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("@dcloudio/uni-app")) : typeof define === "function" && define.amd ? define(["exports", "vue", "@dcloudio/uni-app"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.HlwUniVue = {}, global.vue, global.uniApp));
|
|
3
|
+
})(this, function(exports2, vue, uniApp) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -281,7 +281,6 @@ var __publicField = (obj, key, value) => {
|
|
|
281
281
|
}
|
|
282
282
|
return { uploading, upload };
|
|
283
283
|
}
|
|
284
|
-
var define_import_meta_env_default = {};
|
|
285
284
|
class BaseService {
|
|
286
285
|
/**
|
|
287
286
|
* 发送服务请求。会自动拼接前缀与命名空间。
|
|
@@ -338,7 +337,13 @@ var __publicField = (obj, key, value) => {
|
|
|
338
337
|
};
|
|
339
338
|
}
|
|
340
339
|
function PluginService(target) {
|
|
341
|
-
target.prototype
|
|
340
|
+
Object.defineProperty(target.prototype, "servicePrefix", {
|
|
341
|
+
get() {
|
|
342
|
+
return globalThis.VITE_PLUGIN_NAME || "";
|
|
343
|
+
},
|
|
344
|
+
enumerable: true,
|
|
345
|
+
configurable: true
|
|
346
|
+
});
|
|
342
347
|
}
|
|
343
348
|
function useMsg() {
|
|
344
349
|
function toast(opts) {
|
|
@@ -964,364 +969,6 @@ var __publicField = (obj, key, value) => {
|
|
|
964
969
|
miniProgram: (appId, options) => navigate("miniprogram", appId, options)
|
|
965
970
|
};
|
|
966
971
|
}
|
|
967
|
-
const useThemeStore = pinia.defineStore(
|
|
968
|
-
"theme",
|
|
969
|
-
() => {
|
|
970
|
-
const scale = vue.ref("normal");
|
|
971
|
-
function setScale(s) {
|
|
972
|
-
scale.value = s;
|
|
973
|
-
uni.setStorageSync(FONT_SCALE_KEY, s);
|
|
974
|
-
uni.$emit(THEME_CHANGE_EVENT);
|
|
975
|
-
}
|
|
976
|
-
const fontOptions = Object.keys(FONT_PRESETS).map((key) => ({
|
|
977
|
-
value: key,
|
|
978
|
-
label: FONT_PRESETS[key].label
|
|
979
|
-
}));
|
|
980
|
-
const primaryColor = vue.ref(DEFAULT_THEMES[0].value);
|
|
981
|
-
const themes = DEFAULT_THEMES;
|
|
982
|
-
const activeTheme = vue.computed(
|
|
983
|
-
() => themes.find((t) => t.value === primaryColor.value) ?? { label: "自定义", value: primaryColor.value }
|
|
984
|
-
);
|
|
985
|
-
function setTheme(color) {
|
|
986
|
-
primaryColor.value = color;
|
|
987
|
-
uni.setStorageSync(THEME_COLOR_KEY, color);
|
|
988
|
-
uni.$emit(THEME_CHANGE_EVENT);
|
|
989
|
-
}
|
|
990
|
-
const appearance = vue.ref("auto");
|
|
991
|
-
const appearanceOptions = APPEARANCE_PRESETS;
|
|
992
|
-
const appearanceMode = vue.computed(() => resolveAppearance(appearance.value));
|
|
993
|
-
const isDark = vue.computed(() => appearanceMode.value === "dark");
|
|
994
|
-
function setAppearance(a) {
|
|
995
|
-
appearance.value = a;
|
|
996
|
-
uni.setStorageSync(APPEARANCE_KEY, a);
|
|
997
|
-
uni.$emit(THEME_CHANGE_EVENT);
|
|
998
|
-
}
|
|
999
|
-
return {
|
|
1000
|
-
// 字体
|
|
1001
|
-
scale,
|
|
1002
|
-
fontOptions,
|
|
1003
|
-
setScale,
|
|
1004
|
-
// 主题色
|
|
1005
|
-
primaryColor,
|
|
1006
|
-
themes,
|
|
1007
|
-
activeTheme,
|
|
1008
|
-
setTheme,
|
|
1009
|
-
// 外观模式
|
|
1010
|
-
appearance,
|
|
1011
|
-
appearanceOptions,
|
|
1012
|
-
appearanceMode,
|
|
1013
|
-
isDark,
|
|
1014
|
-
setAppearance
|
|
1015
|
-
};
|
|
1016
|
-
},
|
|
1017
|
-
{ unistorage: true }
|
|
1018
|
-
);
|
|
1019
|
-
const FONT_SCALE_KEY = "hlw_font_scale";
|
|
1020
|
-
const FONT_PRESETS = {
|
|
1021
|
-
small: {
|
|
1022
|
-
label: "较小",
|
|
1023
|
-
vars: {
|
|
1024
|
-
"--font-xs": "16rpx",
|
|
1025
|
-
"--font-sm": "20rpx",
|
|
1026
|
-
"--font-base": "24rpx",
|
|
1027
|
-
"--font-md": "28rpx",
|
|
1028
|
-
"--font-lg": "32rpx",
|
|
1029
|
-
"--font-xl": "36rpx"
|
|
1030
|
-
}
|
|
1031
|
-
},
|
|
1032
|
-
compact: {
|
|
1033
|
-
label: "略小",
|
|
1034
|
-
vars: {
|
|
1035
|
-
"--font-xs": "18rpx",
|
|
1036
|
-
"--font-sm": "22rpx",
|
|
1037
|
-
"--font-base": "26rpx",
|
|
1038
|
-
"--font-md": "30rpx",
|
|
1039
|
-
"--font-lg": "34rpx",
|
|
1040
|
-
"--font-xl": "38rpx"
|
|
1041
|
-
}
|
|
1042
|
-
},
|
|
1043
|
-
normal: {
|
|
1044
|
-
label: "标准",
|
|
1045
|
-
vars: {
|
|
1046
|
-
"--font-xs": "20rpx",
|
|
1047
|
-
"--font-sm": "24rpx",
|
|
1048
|
-
"--font-base": "28rpx",
|
|
1049
|
-
"--font-md": "32rpx",
|
|
1050
|
-
"--font-lg": "36rpx",
|
|
1051
|
-
"--font-xl": "40rpx"
|
|
1052
|
-
}
|
|
1053
|
-
},
|
|
1054
|
-
medium: {
|
|
1055
|
-
label: "适中",
|
|
1056
|
-
vars: {
|
|
1057
|
-
"--font-xs": "22rpx",
|
|
1058
|
-
"--font-sm": "28rpx",
|
|
1059
|
-
"--font-base": "32rpx",
|
|
1060
|
-
"--font-md": "36rpx",
|
|
1061
|
-
"--font-lg": "42rpx",
|
|
1062
|
-
"--font-xl": "46rpx"
|
|
1063
|
-
}
|
|
1064
|
-
},
|
|
1065
|
-
large: {
|
|
1066
|
-
label: "较大",
|
|
1067
|
-
vars: {
|
|
1068
|
-
"--font-xs": "24rpx",
|
|
1069
|
-
"--font-sm": "30rpx",
|
|
1070
|
-
"--font-base": "34rpx",
|
|
1071
|
-
"--font-md": "40rpx",
|
|
1072
|
-
"--font-lg": "46rpx",
|
|
1073
|
-
"--font-xl": "52rpx"
|
|
1074
|
-
}
|
|
1075
|
-
},
|
|
1076
|
-
xlarge: {
|
|
1077
|
-
label: "超大",
|
|
1078
|
-
vars: {
|
|
1079
|
-
"--font-xs": "28rpx",
|
|
1080
|
-
"--font-sm": "36rpx",
|
|
1081
|
-
"--font-base": "42rpx",
|
|
1082
|
-
"--font-md": "48rpx",
|
|
1083
|
-
"--font-lg": "56rpx",
|
|
1084
|
-
"--font-xl": "64rpx"
|
|
1085
|
-
}
|
|
1086
|
-
},
|
|
1087
|
-
xxlarge: {
|
|
1088
|
-
label: "特大",
|
|
1089
|
-
vars: {
|
|
1090
|
-
"--font-xs": "32rpx",
|
|
1091
|
-
"--font-sm": "42rpx",
|
|
1092
|
-
"--font-base": "48rpx",
|
|
1093
|
-
"--font-md": "56rpx",
|
|
1094
|
-
"--font-lg": "64rpx",
|
|
1095
|
-
"--font-xl": "72rpx"
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
};
|
|
1099
|
-
function getCurrentFontScale() {
|
|
1100
|
-
try {
|
|
1101
|
-
const v = uni.getStorageSync(FONT_SCALE_KEY);
|
|
1102
|
-
if (v === "small" || v === "compact" || v === "medium" || v === "large" || v === "xlarge" || v === "xxlarge")
|
|
1103
|
-
return v;
|
|
1104
|
-
} catch {
|
|
1105
|
-
}
|
|
1106
|
-
return "normal";
|
|
1107
|
-
}
|
|
1108
|
-
function getCurrentFontVars() {
|
|
1109
|
-
return FONT_PRESETS[getCurrentFontScale()].vars;
|
|
1110
|
-
}
|
|
1111
|
-
const THEME_COLOR_KEY = "hlw_theme_color";
|
|
1112
|
-
const THEME_SEMANTIC_COLORS = {
|
|
1113
|
-
success: "#10b981",
|
|
1114
|
-
warning: "#f59e0b",
|
|
1115
|
-
error: "#ef4444",
|
|
1116
|
-
info: "#64748b"
|
|
1117
|
-
};
|
|
1118
|
-
const DEFAULT_THEMES = [
|
|
1119
|
-
{ label: "翡翠绿", value: "#10b981" },
|
|
1120
|
-
{ label: "活力橙", value: "#f97316" },
|
|
1121
|
-
{ label: "默认蓝", value: "#3b82f6" },
|
|
1122
|
-
{ label: "玫瑰粉", value: "#f43f5e" },
|
|
1123
|
-
{ label: "紫罗兰", value: "#8b5cf6" },
|
|
1124
|
-
{ label: "青石灰", value: "#64748b" }
|
|
1125
|
-
];
|
|
1126
|
-
function getCurrentThemeColor() {
|
|
1127
|
-
try {
|
|
1128
|
-
const v = uni.getStorageSync(THEME_COLOR_KEY);
|
|
1129
|
-
if (v && typeof v === "string")
|
|
1130
|
-
return v;
|
|
1131
|
-
} catch {
|
|
1132
|
-
}
|
|
1133
|
-
return DEFAULT_THEMES[0].value;
|
|
1134
|
-
}
|
|
1135
|
-
function getCurrentThemeVars() {
|
|
1136
|
-
const color = getCurrentThemeColor();
|
|
1137
|
-
return {
|
|
1138
|
-
"--primary-color": color,
|
|
1139
|
-
"--primary-light": hexToRgba(color, 0.12),
|
|
1140
|
-
"--primary-dark": darkenHex(color),
|
|
1141
|
-
"--primary-success": THEME_SEMANTIC_COLORS.success,
|
|
1142
|
-
"--primary-success-light": hexToRgba(THEME_SEMANTIC_COLORS.success, 0.12),
|
|
1143
|
-
"--primary-success-dark": darkenHex(THEME_SEMANTIC_COLORS.success),
|
|
1144
|
-
"--primary-warning": THEME_SEMANTIC_COLORS.warning,
|
|
1145
|
-
"--primary-warning-light": hexToRgba(THEME_SEMANTIC_COLORS.warning, 0.12),
|
|
1146
|
-
"--primary-warning-dark": darkenHex(THEME_SEMANTIC_COLORS.warning),
|
|
1147
|
-
"--primary-error": THEME_SEMANTIC_COLORS.error,
|
|
1148
|
-
"--primary-error-light": hexToRgba(THEME_SEMANTIC_COLORS.error, 0.12),
|
|
1149
|
-
"--primary-error-dark": darkenHex(THEME_SEMANTIC_COLORS.error),
|
|
1150
|
-
"--primary-info": THEME_SEMANTIC_COLORS.info,
|
|
1151
|
-
"--primary-info-light": hexToRgba(THEME_SEMANTIC_COLORS.info, 0.12),
|
|
1152
|
-
"--primary-info-dark": darkenHex(THEME_SEMANTIC_COLORS.info),
|
|
1153
|
-
"--success-color": THEME_SEMANTIC_COLORS.success,
|
|
1154
|
-
"--success-light": hexToRgba(THEME_SEMANTIC_COLORS.success, 0.12),
|
|
1155
|
-
"--success-dark": darkenHex(THEME_SEMANTIC_COLORS.success),
|
|
1156
|
-
"--warning-color": THEME_SEMANTIC_COLORS.warning,
|
|
1157
|
-
"--warning-light": hexToRgba(THEME_SEMANTIC_COLORS.warning, 0.12),
|
|
1158
|
-
"--warning-dark": darkenHex(THEME_SEMANTIC_COLORS.warning),
|
|
1159
|
-
"--error-color": THEME_SEMANTIC_COLORS.error,
|
|
1160
|
-
"--error-light": hexToRgba(THEME_SEMANTIC_COLORS.error, 0.12),
|
|
1161
|
-
"--error-dark": darkenHex(THEME_SEMANTIC_COLORS.error),
|
|
1162
|
-
"--info-color": THEME_SEMANTIC_COLORS.info,
|
|
1163
|
-
"--info-light": hexToRgba(THEME_SEMANTIC_COLORS.info, 0.12),
|
|
1164
|
-
"--info-dark": darkenHex(THEME_SEMANTIC_COLORS.info)
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
const HEX_RE = /^#[0-9a-fA-F]{6}$/;
|
|
1168
|
-
function parseHex(hex) {
|
|
1169
|
-
if (!HEX_RE.test(hex))
|
|
1170
|
-
throw new Error(`Invalid hex color: ${hex}`);
|
|
1171
|
-
return [
|
|
1172
|
-
parseInt(hex.slice(1, 3), 16),
|
|
1173
|
-
parseInt(hex.slice(3, 5), 16),
|
|
1174
|
-
parseInt(hex.slice(5, 7), 16)
|
|
1175
|
-
];
|
|
1176
|
-
}
|
|
1177
|
-
function hexToRgba(hex, alpha) {
|
|
1178
|
-
const [r, g, b] = parseHex(hex);
|
|
1179
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
1180
|
-
}
|
|
1181
|
-
function darkenHex(hex, amount = 0.15) {
|
|
1182
|
-
const [r, g, b] = parseHex(hex);
|
|
1183
|
-
const darken = (value) => Math.max(0, Math.round(value * (1 - amount)));
|
|
1184
|
-
return `#${darken(r).toString(16).padStart(2, "0")}${darken(g).toString(16).padStart(2, "0")}${darken(b).toString(16).padStart(2, "0")}`;
|
|
1185
|
-
}
|
|
1186
|
-
const APPEARANCE_KEY = "hlw_appearance";
|
|
1187
|
-
const APPEARANCE_PRESETS = [
|
|
1188
|
-
{ value: "light", label: "浅色模式" },
|
|
1189
|
-
{ value: "dark", label: "深色模式" },
|
|
1190
|
-
{ value: "auto", label: "跟随系统" }
|
|
1191
|
-
];
|
|
1192
|
-
const LIGHT_VARS = {
|
|
1193
|
-
"--bg-page": "#f6f6f6",
|
|
1194
|
-
"--bg-elevated": "#ffffff",
|
|
1195
|
-
"--surface-card": "#ffffff",
|
|
1196
|
-
"--surface-card-muted": "#f8fafc",
|
|
1197
|
-
"--surface-secondary": "#f1f5f9",
|
|
1198
|
-
"--surface-tertiary": "#e2e8f0",
|
|
1199
|
-
"--text-primary": "#0f172a",
|
|
1200
|
-
"--text-secondary": "#334155",
|
|
1201
|
-
"--text-muted": "#64748b",
|
|
1202
|
-
"--text-subtle": "#94a3b8",
|
|
1203
|
-
"--text-disabled": "#cbd5e1",
|
|
1204
|
-
"--border-color": "#e2e8f0",
|
|
1205
|
-
"--border-color-light": "#f1f5f9",
|
|
1206
|
-
"--border-color-focus": "#bfdbfe",
|
|
1207
|
-
"--shadow-soft": "0 2rpx 8rpx rgba(15, 23, 42, 0.04)",
|
|
1208
|
-
"--shadow-card": "0 4rpx 16rpx rgba(15, 23, 42, 0.06)"
|
|
1209
|
-
};
|
|
1210
|
-
const DARK_VARS = {
|
|
1211
|
-
"--bg-page": "#0b1020",
|
|
1212
|
-
"--bg-elevated": "#111827",
|
|
1213
|
-
"--surface-card": "#1e293b",
|
|
1214
|
-
"--surface-card-muted": "#273549",
|
|
1215
|
-
"--surface-secondary": "#273549",
|
|
1216
|
-
"--surface-tertiary": "#334155",
|
|
1217
|
-
"--text-primary": "#f8fafc",
|
|
1218
|
-
"--text-secondary": "#cbd5e1",
|
|
1219
|
-
"--text-muted": "#94a3b8",
|
|
1220
|
-
"--text-subtle": "#64748b",
|
|
1221
|
-
"--text-disabled": "#475569",
|
|
1222
|
-
"--border-color": "#334155",
|
|
1223
|
-
"--border-color-light": "#1e293b",
|
|
1224
|
-
"--border-color-focus": "#3b82f6",
|
|
1225
|
-
"--shadow-soft": "0 2rpx 8rpx rgba(0, 0, 0, 0.3)",
|
|
1226
|
-
"--shadow-card": "0 4rpx 16rpx rgba(0, 0, 0, 0.35)"
|
|
1227
|
-
};
|
|
1228
|
-
const APPEARANCE_VAR_MAP = {
|
|
1229
|
-
light: LIGHT_VARS,
|
|
1230
|
-
dark: DARK_VARS
|
|
1231
|
-
};
|
|
1232
|
-
function getCurrentAppearance() {
|
|
1233
|
-
try {
|
|
1234
|
-
const v = uni.getStorageSync(APPEARANCE_KEY);
|
|
1235
|
-
if (v === "light" || v === "dark" || v === "auto")
|
|
1236
|
-
return v;
|
|
1237
|
-
} catch {
|
|
1238
|
-
}
|
|
1239
|
-
return "auto";
|
|
1240
|
-
}
|
|
1241
|
-
function resolveAppearance(appearance) {
|
|
1242
|
-
if (appearance === "light" || appearance === "dark")
|
|
1243
|
-
return appearance;
|
|
1244
|
-
try {
|
|
1245
|
-
const info = uni.getSystemInfoSync();
|
|
1246
|
-
if (info.theme === "dark")
|
|
1247
|
-
return "dark";
|
|
1248
|
-
} catch {
|
|
1249
|
-
}
|
|
1250
|
-
return "light";
|
|
1251
|
-
}
|
|
1252
|
-
function getCurrentAppearanceMode() {
|
|
1253
|
-
return resolveAppearance(getCurrentAppearance());
|
|
1254
|
-
}
|
|
1255
|
-
function getCurrentAppearanceVars() {
|
|
1256
|
-
return APPEARANCE_VAR_MAP[getCurrentAppearanceMode()];
|
|
1257
|
-
}
|
|
1258
|
-
const TYPOGRAPHY_ROLES = {
|
|
1259
|
-
"title-lg": {
|
|
1260
|
-
size: "var(--font-xl)",
|
|
1261
|
-
weight: "600",
|
|
1262
|
-
lineHeight: "1.2",
|
|
1263
|
-
color: "var(--text-primary)"
|
|
1264
|
-
},
|
|
1265
|
-
"title": {
|
|
1266
|
-
size: "var(--font-md)",
|
|
1267
|
-
weight: "500",
|
|
1268
|
-
lineHeight: "1.3",
|
|
1269
|
-
color: "var(--text-primary)"
|
|
1270
|
-
},
|
|
1271
|
-
"subtitle": {
|
|
1272
|
-
size: "var(--font-base)",
|
|
1273
|
-
weight: "500",
|
|
1274
|
-
lineHeight: "1.3",
|
|
1275
|
-
color: "var(--text-secondary)"
|
|
1276
|
-
},
|
|
1277
|
-
"body": {
|
|
1278
|
-
size: "var(--font-base)",
|
|
1279
|
-
weight: "400",
|
|
1280
|
-
lineHeight: "1.5",
|
|
1281
|
-
color: "var(--text-secondary)"
|
|
1282
|
-
},
|
|
1283
|
-
"desc": {
|
|
1284
|
-
size: "var(--font-sm)",
|
|
1285
|
-
weight: "400",
|
|
1286
|
-
lineHeight: "1.4",
|
|
1287
|
-
color: "var(--text-subtle)"
|
|
1288
|
-
},
|
|
1289
|
-
"caption": {
|
|
1290
|
-
size: "var(--font-xs)",
|
|
1291
|
-
weight: "500",
|
|
1292
|
-
lineHeight: "1.3",
|
|
1293
|
-
color: "var(--text-muted)"
|
|
1294
|
-
}
|
|
1295
|
-
};
|
|
1296
|
-
function getCurrentTypographyVars() {
|
|
1297
|
-
const vars = {};
|
|
1298
|
-
for (const [role, cfg] of Object.entries(TYPOGRAPHY_ROLES)) {
|
|
1299
|
-
vars[`--text-${role}-size`] = cfg.size;
|
|
1300
|
-
vars[`--text-${role}-weight`] = cfg.weight;
|
|
1301
|
-
vars[`--text-${role}-line-height`] = cfg.lineHeight;
|
|
1302
|
-
vars[`--text-${role}-color`] = cfg.color;
|
|
1303
|
-
}
|
|
1304
|
-
return vars;
|
|
1305
|
-
}
|
|
1306
|
-
const THEME_CHANGE_EVENT = "hlw:theme-change";
|
|
1307
|
-
function buildThemeStyle() {
|
|
1308
|
-
return varsToStyle({
|
|
1309
|
-
...getCurrentFontVars(),
|
|
1310
|
-
...getCurrentThemeVars()
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
function varsToStyle(vars) {
|
|
1314
|
-
return Object.entries(vars).map(([key, value]) => `${key}:${value}`).join(";") + ";";
|
|
1315
|
-
}
|
|
1316
|
-
function useThemePageStyle() {
|
|
1317
|
-
const store = useThemeStore();
|
|
1318
|
-
const themePageStyle = vue.computed(() => {
|
|
1319
|
-
void store.scale;
|
|
1320
|
-
void store.primaryColor;
|
|
1321
|
-
return buildThemeStyle();
|
|
1322
|
-
});
|
|
1323
|
-
return { themePageStyle };
|
|
1324
|
-
}
|
|
1325
972
|
let _msg = null;
|
|
1326
973
|
let _utils = null;
|
|
1327
974
|
const hlw = {
|
|
@@ -1396,42 +1043,22 @@ var __publicField = (obj, key, value) => {
|
|
|
1396
1043
|
injectTap(vnode, binding);
|
|
1397
1044
|
}
|
|
1398
1045
|
};
|
|
1399
|
-
exports2.APPEARANCE_KEY = APPEARANCE_KEY;
|
|
1400
|
-
exports2.APPEARANCE_PRESETS = APPEARANCE_PRESETS;
|
|
1401
|
-
exports2.APPEARANCE_VAR_MAP = APPEARANCE_VAR_MAP;
|
|
1402
1046
|
exports2.BaseService = BaseService;
|
|
1403
|
-
exports2.DEFAULT_THEMES = DEFAULT_THEMES;
|
|
1404
|
-
exports2.FONT_PRESETS = FONT_PRESETS;
|
|
1405
|
-
exports2.FONT_SCALE_KEY = FONT_SCALE_KEY;
|
|
1406
1047
|
exports2.PluginService = PluginService;
|
|
1407
1048
|
exports2.ServiceNamespace = ServiceNamespace;
|
|
1408
1049
|
exports2.ServicePrefix = ServicePrefix;
|
|
1409
|
-
exports2.THEME_CHANGE_EVENT = THEME_CHANGE_EVENT;
|
|
1410
|
-
exports2.THEME_COLOR_KEY = THEME_COLOR_KEY;
|
|
1411
|
-
exports2.THEME_SEMANTIC_COLORS = THEME_SEMANTIC_COLORS;
|
|
1412
|
-
exports2.TYPOGRAPHY_ROLES = TYPOGRAPHY_ROLES;
|
|
1413
1050
|
exports2.adapters = adapters;
|
|
1414
1051
|
exports2.alistAdapter = alistAdapter;
|
|
1415
1052
|
exports2.auth = auth;
|
|
1416
|
-
exports2.buildThemeStyle = buildThemeStyle;
|
|
1417
1053
|
exports2.clearDeviceCache = clearDeviceCache;
|
|
1418
1054
|
exports2.copy = copy;
|
|
1419
1055
|
exports2.cosAdapter = cosAdapter;
|
|
1420
1056
|
exports2.download = download;
|
|
1421
1057
|
exports2.getAdapter = getAdapter;
|
|
1422
|
-
exports2.getCurrentAppearance = getCurrentAppearance;
|
|
1423
|
-
exports2.getCurrentAppearanceMode = getCurrentAppearanceMode;
|
|
1424
|
-
exports2.getCurrentAppearanceVars = getCurrentAppearanceVars;
|
|
1425
|
-
exports2.getCurrentFontScale = getCurrentFontScale;
|
|
1426
|
-
exports2.getCurrentFontVars = getCurrentFontVars;
|
|
1427
|
-
exports2.getCurrentThemeColor = getCurrentThemeColor;
|
|
1428
|
-
exports2.getCurrentThemeVars = getCurrentThemeVars;
|
|
1429
|
-
exports2.getCurrentTypographyVars = getCurrentTypographyVars;
|
|
1430
1058
|
exports2.hlw = hlw;
|
|
1431
1059
|
exports2.ossAdapter = ossAdapter;
|
|
1432
1060
|
exports2.paste = paste;
|
|
1433
1061
|
exports2.qiniuAdapter = qiniuAdapter;
|
|
1434
|
-
exports2.resolveAppearance = resolveAppearance;
|
|
1435
1062
|
exports2.saveImage = saveImage;
|
|
1436
1063
|
exports2.saveImageUrl = saveImageUrl;
|
|
1437
1064
|
exports2.saveVideoFile = saveVideoFile;
|
|
@@ -1448,8 +1075,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1448
1075
|
exports2.useRefs = useRefs;
|
|
1449
1076
|
exports2.useRequest = useRequest;
|
|
1450
1077
|
exports2.useShare = useShare;
|
|
1451
|
-
exports2.useThemePageStyle = useThemePageStyle;
|
|
1452
|
-
exports2.useThemeStore = useThemeStore;
|
|
1453
1078
|
exports2.useUpload = useUpload;
|
|
1454
1079
|
exports2.useUtils = useUtils;
|
|
1455
1080
|
exports2.vCopy = vCopy;
|