ph-utils 0.12.8 → 0.12.9
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/lib/theme.d.ts +2 -1
- package/lib/theme.js +3 -2
- package/package.json +1 -1
package/lib/theme.d.ts
CHANGED
@@ -18,9 +18,10 @@ export declare function getTheme(): string;
|
|
18
18
|
* 应用主题
|
19
19
|
* @param theme 待应用的主题
|
20
20
|
* @param cache 是否缓存应用的主题, 让应用下一次启动的时候, 可以应用主题, 默认: true
|
21
|
+
* @param transition 是否使用过渡动画, 注意浏览器必须支持 document.startViewTransition, 默认: true
|
21
22
|
* @returns 应用的主题
|
22
23
|
*/
|
23
|
-
export declare function applyTheme(theme?: "light" | "dark" | "auto", cache?: boolean): Promise<unknown>;
|
24
|
+
export declare function applyTheme(theme?: "light" | "dark" | "auto", cache?: boolean, transition?: boolean): Promise<unknown>;
|
24
25
|
/** 获取当前主题色 */
|
25
26
|
export declare function getColorTheme(defaultValue?: string): string | undefined;
|
26
27
|
/**
|
package/lib/theme.js
CHANGED
@@ -88,13 +88,14 @@ export function getTheme() {
|
|
88
88
|
* 应用主题
|
89
89
|
* @param theme 待应用的主题
|
90
90
|
* @param cache 是否缓存应用的主题, 让应用下一次启动的时候, 可以应用主题, 默认: true
|
91
|
+
* @param transition 是否使用过渡动画, 注意浏览器必须支持 document.startViewTransition, 默认: true
|
91
92
|
* @returns 应用的主题
|
92
93
|
*/
|
93
|
-
export async function applyTheme(theme, cache = true) {
|
94
|
+
export async function applyTheme(theme, cache = true, transition = true) {
|
94
95
|
if (cache === true) {
|
95
96
|
localStorage.setItem("web-theme-appearance", theme == null ? "auto" : theme);
|
96
97
|
}
|
97
|
-
return toggleTheme(theme);
|
98
|
+
return toggleTheme(theme, transition);
|
98
99
|
}
|
99
100
|
/** 获取当前主题色 */
|
100
101
|
export function getColorTheme(defaultValue) {
|