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