🎨 feat(web/default): add Anthropic theme preset and configurable serif typography

Introduce a switchable Anthropic-inspired color preset and a new Font customization axis so users can adopt the editorial serif look across the entire UI, including sidebar navigation, tabs, form controls, buttons, and table headers.

Theme preset

Add anthropic to the theme preset registry with warm cream canvas, slate foreground, and clay/coral accent tokens for light and dark modes
Define explicit surface colors for the Anthropic preset instead of relying on the semantic surface bridge
Exclude anthropic from the primary-color surface bridge so bespoke warm neutrals are not overridden by accent-tinted mixes
Typography system

Add @fontsource-variable/lora and a global --font-serif token with CJK serif fallbacks (Noto Serif SC, Source Han Serif, Songti SC, etc.)
Introduce a --font-body token and drive <body> font-family from it
Add a Font axis (default | sans | serif) parallel to radius/scale
Resolve font: 'default' against preset defaults (anthropic → serif)
Persist font preference via cookie and apply data-theme-font on <body>
Apply serif OpenType features (kern, liga, calt, tnum) and heading display tuning when serif is active
Remove per-component sans opt-outs so serif inherits through sidebar, tabs, inputs, buttons, badges, and table headers via natural CSS cascade
Keep monospace contexts unchanged via Tailwind preflight and .font-mono
UI and i18n

Add Font selector to the theme config drawer (Auto / Sans / Serif)
Add "Font" and "Select body font" translations for en, zh, fr, ja, ru, vi
Misc

Tighten group and status badge sizing for better balance with serif text
This commit is contained in:
t0ng7u
2026-05-26 04:31:13 +08:00
parent 3360882642
commit a64f26d1d2
16 changed files with 481 additions and 14 deletions
+18
View File
@@ -20,6 +20,19 @@ For commercial licensing, please contact support@quantumnous.com
@theme inline {
--font-sans: 'Public Sans', sans-serif;
/* Editorial serif token — the body face used by the `serif` font axis
* and by presets that opt in (currently Anthropic). Lora carries only
* Latin glyphs, so the stack walks through CJK serifs (Noto / Source Han
* / Songti / SimSun) before the generic `serif` fallback. Without these
* explicit CJK fonts the browser's generic-serif pick on Windows is
* non-deterministic at small sizes and often appears sans-like. */
--font-serif:
'Lora Variable', 'Lora', 'Source Serif Pro', 'Source Serif 4',
'Noto Serif SC', 'Noto Serif TC', 'Noto Serif JP', 'Noto Serif KR',
'Source Han Serif SC', 'Source Han Serif TC', 'Source Han Serif',
'Songti SC', 'STSong', 'STSongti-SC-Regular', 'PingFang SC', 'SimSun',
'NSimSun', '宋体', 'FangSong', '仿宋', 'KaiTi', '楷体', Georgia,
'Times New Roman', Cambria, 'Liberation Serif', serif;
--font-inter:
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
@@ -82,6 +95,11 @@ For commercial licensing, please contact support@quantumnous.com
--app-header-height: 3rem;
/* Static build-channel fallback consumed when JS hasn't booted yet. */
--app-rev: '2k6e8r7p';
/* Currently active body font. The font axis swaps this between
* `--font-sans` and `--font-serif` via `[data-theme-font='...']` blocks
* in theme-presets.css. Default mirrors `--font-sans` so behavior is
* identical when no font preference is set. */
--font-body: var(--font-sans);
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);