okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-clean-7 (045843071): the app loads screens, languages, Prism and Time-skip on first use; main chunk 3,123,528 -> 755,418 B, start screen 248.5 -> 143.4 ms (p2006 Chrome, median of 10); nothing users see changes (cleanup step 7)1631a9fde

main
1.8 KiB50 linesraw
1import { StrictMode } from 'react';
2import { createRoot } from 'react-dom/client';
3import './styles/kit/tokens.css';
4import './styles/kit/components.css';
5import './styles/app.css';
6import { App } from './app/App';
7import { installDropGuard } from './components/DropZone';
8import { startRecovery } from './lib/recovery';
9import { translationsReady } from './lib/i18n';
10import { loadHighlighter } from './components/SyntaxCode';
11
12const el = document.getElementById('root');
13if (!el) throw new Error('#root missing');
14
15installDropGuard();
16startRecovery();
17
18// The saved language's strings are fetched while the rest of the code loads; the first screen is drawn once they are in (English needs no wait).
19// Code colouring (the Prism grammars, 130 kB) is not needed to show the first screen: it is fetched a few seconds later, when the browser is idle,
20// so the first code block of the session is already coloured when it appears. A block that appears sooner fetches it itself.
21window.setTimeout(() => {
22  const idle: (run: () => void) => void = 'requestIdleCallback' in window ? (run) => window.requestIdleCallback(run, { timeout: 4000 }) : (run) => window.setTimeout(run, 0);
23  idle(() => { void loadHighlighter(); void import('./components/TimeSkipPanel'); void import('./components/TimeSkipWorking'); });
24}, 3000);
25
26void translationsReady().then(() => {
27  createRoot(el).render(
28    <StrictMode>
29      <App />
30    </StrictMode>,
31  );
32});
33
34import './styles/annotation-fixes.css';
35import './styles/monitor.css';
36import './styles/time-skip.css';
37
38import './styles/model-run.css';
39
40import './styles/onboarding.css';
41
42import './styles/board.css';
43
44import './styles/gpu-roles.css';
45
46import './styles/engine-tab.css';
47
48// Loaded last: the shared depth, material and interaction treatment. See the
49// header of the file for the order of the layers and why it sits here.
50import './styles/liquid.css';