@hlw-uni-mp/use 1.1.6 → 1.1.7
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/index.js +30 -21
- package/dist/index.mjs +30 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -85,8 +85,12 @@ function getTheme() {
|
|
|
85
85
|
}
|
|
86
86
|
function applyTheme(themeState) {
|
|
87
87
|
const store = useThemeStore();
|
|
88
|
-
if (themeState.mode)
|
|
89
|
-
|
|
88
|
+
if (themeState.mode) {
|
|
89
|
+
store.mode = themeState.mode;
|
|
90
|
+
}
|
|
91
|
+
if (themeState.color) {
|
|
92
|
+
store.color = themeState.color;
|
|
93
|
+
}
|
|
90
94
|
if (themeState.fontSize && ["small", "standard", "large", "extra-large"].includes(themeState.fontSize)) {
|
|
91
95
|
store.fontSize = themeState.fontSize;
|
|
92
96
|
}
|
|
@@ -111,6 +115,25 @@ function useTheme() {
|
|
|
111
115
|
const fontFamilyClass = (0, import_vue.computed)(() => {
|
|
112
116
|
return fontFamilyPresets.find((item) => item.id === store.fontFamily)?.class || "font-family-system";
|
|
113
117
|
});
|
|
118
|
+
function setMode(targetMode) {
|
|
119
|
+
store.mode = targetMode;
|
|
120
|
+
}
|
|
121
|
+
function setColor(hexColor) {
|
|
122
|
+
store.color = hexColor;
|
|
123
|
+
}
|
|
124
|
+
function setFontSize(targetSize) {
|
|
125
|
+
if (["small", "standard", "large", "extra-large"].includes(targetSize)) {
|
|
126
|
+
store.fontSize = targetSize;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function setFontFamily(targetFont) {
|
|
130
|
+
if (["system", "sans", "serif", "kaiti"].includes(targetFont)) {
|
|
131
|
+
store.fontFamily = targetFont;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function resetTheme() {
|
|
135
|
+
Object.assign(store, DEFAULT_THEME);
|
|
136
|
+
}
|
|
114
137
|
return {
|
|
115
138
|
mode,
|
|
116
139
|
color,
|
|
@@ -121,25 +144,11 @@ function useTheme() {
|
|
|
121
144
|
colors: THEME_COLORS,
|
|
122
145
|
fontSizePresets,
|
|
123
146
|
fontFamilyPresets,
|
|
124
|
-
setMode
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
setFontSize: (targetSize) => {
|
|
131
|
-
if (["small", "standard", "large", "extra-large"].includes(targetSize)) {
|
|
132
|
-
store.fontSize = targetSize;
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
setFontFamily: (targetFont) => {
|
|
136
|
-
if (["system", "sans", "serif", "kaiti"].includes(targetFont)) {
|
|
137
|
-
store.fontFamily = targetFont;
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
resetTheme: () => {
|
|
141
|
-
Object.assign(store, DEFAULT_THEME);
|
|
142
|
-
},
|
|
147
|
+
setMode,
|
|
148
|
+
setColor,
|
|
149
|
+
setFontSize,
|
|
150
|
+
setFontFamily,
|
|
151
|
+
resetTheme,
|
|
143
152
|
applyTheme,
|
|
144
153
|
getTheme,
|
|
145
154
|
initTheme,
|
package/dist/index.mjs
CHANGED
|
@@ -50,8 +50,12 @@ function getTheme() {
|
|
|
50
50
|
}
|
|
51
51
|
function applyTheme(themeState) {
|
|
52
52
|
const store = useThemeStore();
|
|
53
|
-
if (themeState.mode)
|
|
54
|
-
|
|
53
|
+
if (themeState.mode) {
|
|
54
|
+
store.mode = themeState.mode;
|
|
55
|
+
}
|
|
56
|
+
if (themeState.color) {
|
|
57
|
+
store.color = themeState.color;
|
|
58
|
+
}
|
|
55
59
|
if (themeState.fontSize && ["small", "standard", "large", "extra-large"].includes(themeState.fontSize)) {
|
|
56
60
|
store.fontSize = themeState.fontSize;
|
|
57
61
|
}
|
|
@@ -76,6 +80,25 @@ function useTheme() {
|
|
|
76
80
|
const fontFamilyClass = computed(() => {
|
|
77
81
|
return fontFamilyPresets.find((item) => item.id === store.fontFamily)?.class || "font-family-system";
|
|
78
82
|
});
|
|
83
|
+
function setMode(targetMode) {
|
|
84
|
+
store.mode = targetMode;
|
|
85
|
+
}
|
|
86
|
+
function setColor(hexColor) {
|
|
87
|
+
store.color = hexColor;
|
|
88
|
+
}
|
|
89
|
+
function setFontSize(targetSize) {
|
|
90
|
+
if (["small", "standard", "large", "extra-large"].includes(targetSize)) {
|
|
91
|
+
store.fontSize = targetSize;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function setFontFamily(targetFont) {
|
|
95
|
+
if (["system", "sans", "serif", "kaiti"].includes(targetFont)) {
|
|
96
|
+
store.fontFamily = targetFont;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function resetTheme() {
|
|
100
|
+
Object.assign(store, DEFAULT_THEME);
|
|
101
|
+
}
|
|
79
102
|
return {
|
|
80
103
|
mode,
|
|
81
104
|
color,
|
|
@@ -86,25 +109,11 @@ function useTheme() {
|
|
|
86
109
|
colors: THEME_COLORS,
|
|
87
110
|
fontSizePresets,
|
|
88
111
|
fontFamilyPresets,
|
|
89
|
-
setMode
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
setFontSize: (targetSize) => {
|
|
96
|
-
if (["small", "standard", "large", "extra-large"].includes(targetSize)) {
|
|
97
|
-
store.fontSize = targetSize;
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
setFontFamily: (targetFont) => {
|
|
101
|
-
if (["system", "sans", "serif", "kaiti"].includes(targetFont)) {
|
|
102
|
-
store.fontFamily = targetFont;
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
resetTheme: () => {
|
|
106
|
-
Object.assign(store, DEFAULT_THEME);
|
|
107
|
-
},
|
|
112
|
+
setMode,
|
|
113
|
+
setColor,
|
|
114
|
+
setFontSize,
|
|
115
|
+
setFontFamily,
|
|
116
|
+
resetTheme,
|
|
108
117
|
applyTheme,
|
|
109
118
|
getTheme,
|
|
110
119
|
initTheme,
|