Wires the Phase 1 store into a full appearance layer. ThemeContext is rewritten to load/save UiAppearance from the server (with a localStorage anti-flash cache + a one-time migration of the legacy per-browser theme keys), apply ~12 dimensions to <html>, and theme the login page pre-auth. New Settings controls (外观 / 数据与格式): free-hex accent (+ presets + apply scope), dark intensity (soft / OLED black), sidebar style, background (solid / gradient / uploaded image with opacity + blur), font presets, UI scale, reduce-motion, high-contrast, default-collapsed sidebar, 12h/24h time format (wired into logs + overview timestamps). - index.html gains a pre-paint bootstrap script that applies the cached theme before the bundle mounts, eliminating the dark/OLED/scale FOUC. - server saveUiConfig is now a section-level merge so appearance-only and layout-only saves never clobber each other. - reduce-motion uses Framer MotionConfig; the background renders on a fixed layer revealed by transparent app roots; custom-accent hex and ui-scale are validated/clamped before use (localStorage-tamper hardening). Verified across 2 adversarial review rounds (FOUC + CSS-injection + impure state-updater + ref-staleness all fixed).
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])