This commit is contained in:
eric
2026-03-10 01:35:37 -05:00
parent ff51622bb6
commit be7a298604
69 changed files with 11016 additions and 57 deletions

11
app/theme-init.ts Normal file
View File

@@ -0,0 +1,11 @@
/**
* 主题初始化脚本 - 在 React 水合前执行,避免主题闪烁
* 通过 suppressHydrationWarning 在 html 上避免服务端/客户端 class 不一致警告
*/
export const themeInitScript = `
(function() {
var theme = localStorage.getItem('lms-theme');
var resolved = theme === 'light' ? 'light' : (theme === 'dark' ? 'dark' : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'));
document.documentElement.classList.add(resolved);
})();
`;