clash-verge-rev/src/index.html
Tunglies ec82b69786
refactor: eliminate startup flicker — defer window show until overlay renders
- Remove Rust-side `eval(INITIAL_LOADING_OVERLAY)` that prematurely
  dismissed the overlay before React/MUI theme was ready
- Defer `window.show()` from Rust `activate_window` to an inline
  `<script>` in index.html, executed after the themed overlay is in DOM
- Remove `useAppInitialization` hook (duplicate of `useLoadingOverlay`
  with no themeReady gate)
- Simplify overlay to pure theme-colored background — no spinner or
  loading text — so fast startup feels instant
- Simplify `hideInitialOverlay` API and reduce overlay fade to 0.2s
- Clean up unused CSS variables (spinner-track, spinner-top, etc.)
2026-04-06 01:53:40 +08:00

70 lines
1.5 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="shortcut icon"
href="./assets/image/logo.ico"
type="image/x-icon"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clash Verge</title>
<style>
:root {
--bg-color: #f5f5f5;
--text-color: #333;
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #2e303d;
--text-color: #ffffff;
color-scheme: dark;
}
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
color: var(--text-color);
}
#root {
width: 100%;
height: 100%;
}
#initial-loading-overlay {
position: fixed;
inset: 0;
background: var(--bg-color);
z-index: 9999;
transition: opacity 0.2s ease-out;
}
#initial-loading-overlay[data-hidden='true'] {
opacity: 0;
pointer-events: none;
}
</style>
</head>
<body>
<div id="initial-loading-overlay"></div>
<script>
if (window.__TAURI_INTERNALS__) {
window.__TAURI_INTERNALS__
.invoke('plugin:window|show', { label: 'main' })
.catch(function () {});
window.__TAURI_INTERNALS__
.invoke('plugin:window|set_focus', { label: 'main' })
.catch(function () {});
}
</script>
<div id="root"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>