- design/uiMode.ts:档位纯逻辑(localStorage `cyrene.ui-mode` 持久化、跨标签页同步、未知值回落默认档), 只改 <html> 类名与 data 属性 ⇒ 不碰 React 树、不重挂载、几何尺寸不变 - 性能档=**现状**:tokens.css / styles/index.css 的改动**全为新增(0 删除)**,且全部限定在 `:root.ui-mode-fancy` 下;75 元素签名比对证明性能档渲染与改动前逐元素一致 - 华丽档对齐六大核心:连续曲率 corner-shape / 多层 Surface 环境光 / 弹簧动效 / 深色优先(浅色单列补偿)/ 毛玻璃升级 / Liquid Glass(4 折射 + RGB 色差 + 鼠标跟踪 + 双层动态边框) - 开关挂载:main.tsx 在 createRoot 之前 initUiMode(零闪烁);TopBar/Nav/AdminTopBar 三处挂载, 窄屏(<640px)按既有约定收起(实测否则 375px 角色块被压到 27px、面板溢出 73px),移动端由侧栏抽屉覆盖 - 复核:tsc 0 错 + vite build 成功;uiMode 38 项 node 测试 + headless Chrome 真渲染 30 项(真点击/真持久化/ 真指针事件);变异反证(去掉读回 → 持久化往返必红)
29 lines
931 B
TypeScript
29 lines
931 B
TypeScript
import { StrictMode } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import App from "./App";
|
|
import { initUiMode } from "./design/uiMode";
|
|
import "./styles/index.css";
|
|
|
|
// PWA: register the service worker (production only — the dev server's caching
|
|
// would otherwise serve stale modules).
|
|
if ("serviceWorker" in navigator && import.meta.env.PROD) {
|
|
window.addEventListener("load", () => {
|
|
navigator.serviceWorker.register("/sw.js").catch(() => {
|
|
// Non-fatal: the app still works without the offline shell.
|
|
});
|
|
});
|
|
}
|
|
|
|
const container = document.getElementById("root");
|
|
if (!container) throw new Error("#root not found");
|
|
|
|
// 双档 UI 模式(裁决 16.4.4):必须在 React 渲染前装载,让持久化的「华丽档」
|
|
// 在首帧就已生效——否则会先闪一帧性能档再切过去。
|
|
initUiMode();
|
|
|
|
createRoot(container).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>
|
|
);
|