perf: optimize app startup and background lifecycles

This commit is contained in:
inman
2026-08-19 00:56:15 +08:00
parent 31332f6d76
commit 927e13349b
121 changed files with 4359 additions and 1400 deletions

View File

@@ -62,6 +62,22 @@ describe('light visual system', () => {
expect(transcriptRule).not.toContain('contain-intrinsic-size');
});
it('keeps overlays opaque and disables backdrop sampling', () => {
const overlaySource = [
readSource('components/ui/dialog.tsx'),
readSource('components/ui/sheet.tsx'),
readSource('components/layout/Sidebar.tsx'),
readSource('pages/Chat/ChatMessage.tsx'),
readSource('pages/ImagePromptMuseum/index.tsx'),
readSource('pages/Workbench/index.tsx'),
].join('\n');
const globalsSource = readSource('styles/globals.css');
expect(overlaySource).not.toContain('backdrop-blur');
expect(globalsSource).toContain('backdrop-filter: none !important;');
expect(globalsSource).toContain('-webkit-backdrop-filter: none !important;');
});
it('uses bundled mixed-script typography with language-aware fallbacks', () => {
const globalsSource = readSource('styles/globals.css');
const tailwindSource = readFileSync(join(process.cwd(), 'tailwind.config.js'), 'utf8');
@@ -69,7 +85,7 @@ describe('light visual system', () => {
expect(globalsSource).toContain('font-family: "Makelore Latin";');
expect(globalsSource).toContain('font-family: "Makelore CJK";');
expect(globalsSource).toContain('SourceHanSansSC-Regular.otf');
expect(globalsSource).toContain('SourceHanSansSC-Regular.woff2');
expect(globalsSource).toContain('unicode-range: U+2E80-2EFF');
expect(globalsSource).toContain('font-display: swap;');
expect(tailwindSource).toContain("var(--font-sans)");
@@ -77,8 +93,9 @@ describe('light visual system', () => {
expect(appSource).toContain("root.lang = resolvedLanguage === 'zh' ? 'zh-CN' : resolvedLanguage;");
expect(existsSync(join(process.cwd(), 'src/assets/fonts/InterVariable.woff2'))).toBe(true);
expect(existsSync(join(process.cwd(), 'src/assets/fonts/InterVariable-Italic.woff2'))).toBe(true);
expect(existsSync(join(process.cwd(), 'src/assets/fonts/SourceHanSansSC-Regular.otf'))).toBe(true);
expect(existsSync(join(process.cwd(), 'src/assets/fonts/InterVariable-Italic.woff2'))).toBe(false);
expect(existsSync(join(process.cwd(), 'src/assets/fonts/SourceHanSansSC-Regular.otf'))).toBe(false);
expect(existsSync(join(process.cwd(), 'src/assets/fonts/SourceHanSansSC-Regular.woff2'))).toBe(true);
expect(existsSync(join(process.cwd(), 'public/fonts/licenses/OFL-1.1.txt'))).toBe(true);
expect(existsSync(join(process.cwd(), 'public/fonts/licenses/NOTICE.md'))).toBe(true);
});