mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-22 17:39:12 +01:00
Migrate to Vite+ unified toolchain (#428)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { fireAndForget } from '../fireAndForget';
|
||||
|
||||
export type Appearance = 'light' | 'dark';
|
||||
|
||||
@@ -22,13 +23,13 @@ export function subscribeToWindowAppearanceChange(
|
||||
unsubscribe: () => {},
|
||||
};
|
||||
|
||||
getCurrentWebviewWindow()
|
||||
fireAndForget(getCurrentWebviewWindow()
|
||||
.onThemeChanged((t) => {
|
||||
cb(t.payload);
|
||||
})
|
||||
.then((l) => {
|
||||
container.unsubscribe = l;
|
||||
});
|
||||
}));
|
||||
|
||||
return () => container.unsubscribe();
|
||||
}
|
||||
@@ -43,6 +44,6 @@ export function resolveAppearance(
|
||||
|
||||
export function subscribeToPreferredAppearance(cb: (a: Appearance) => void) {
|
||||
cb(getCSSAppearance());
|
||||
getWindowAppearance().then(cb);
|
||||
fireAndForget(getWindowAppearance().then(cb));
|
||||
subscribeToWindowAppearanceChange(cb);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ export function getThemeCSS(theme: Theme): string {
|
||||
theme.components.toast = theme.components.toast ?? theme.components.menu ?? {};
|
||||
const { components, id, label } = theme;
|
||||
const colors = Object.keys(theme.base).reduce((prev, key) => {
|
||||
// biome-ignore lint/performance/noAccumulatingSpread: none
|
||||
// oxlint-disable-next-line no-accumulating-spread
|
||||
return { ...prev, [key]: theme.base[key as YaakColorKey] };
|
||||
}, {}) as ThemeComponentColors;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user