feat(frontend): M9 模态 UI(mode 系统+共享 store+WS 客户端 + chat(思维链/工具回显/情绪徽标)/code/Agent 监控/后台思考页 + Miuix 设计 token + PWA);tsc+vite build 通过

This commit is contained in:
Aska committed 2026-09-06 07:44:40 +08:00
1 parent b3ffd51736
commit 4c48e94659
40 files changed
+5321

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
export type ThemeMode = "dark" | "light";
const THEME_KEY = "cyrene.theme";
/** Read the persisted theme, defaulting to dark-first (Miuix). */
export function readTheme(): ThemeMode {
const saved = localStorage.getItem(THEME_KEY);
return saved === "light" ? "light" : "dark";
}
/** Apply a theme by toggling the `.theme-light` class on <html>. */
export function applyTheme(theme: ThemeMode): void {
document.documentElement.classList.toggle("theme-light", theme === "light");
localStorage.setItem(THEME_KEY, theme);
const meta = document.querySelector('meta[name="theme-color"]');
if (meta) meta.setAttribute("content", theme === "light" ? "#f6f6f8" : "#161616");
}
/** Apply the persisted theme on app start. */
export function initTheme(): void {
applyTheme(readTheme());
}