refactor(web): extract design tokens to tokens.json source of truth

The Flutter client (#356) needs to consume the same FabledSword tokens
the web SPA uses. Move the data into a structured tokens.json file and
generate tokens.generated.css from it on every Vite build. The Flutter
side gets its own generator pointed at the same JSON.

No visual change — generated CSS matches the previous hand-written file.

Also installs @types/node devDependency: tsconfig already declared
"types": ["node"] but no Node builtins were referenced in TS until now,
so the missing types were latent. The new vite.config.ts plugin imports
node:child_process, surfacing the gap.
This commit is contained in:
2026-05-02 14:55:46 -04:00
parent 261c2c4301
commit ea22807a3f
8 changed files with 94 additions and 55 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
@import './lib/styles/fabledsword-tokens.css';
@import './lib/styles/tokens.generated.css';
@tailwind base;
@tailwind components;
-52
View File
@@ -1,52 +0,0 @@
/*
* FabledSword design system tokens
*
* Shared palette across FabledSword apps (Minstrel, Scribe, Forge, ...).
* Per-app accent colour is overridable via the `[data-fs-app="<name>"]`
* attribute hook. The `:root` default is forest-teal for Minstrel, the
* only consumer of this file today.
*/
:root {
/* Surfaces */
--fs-obsidian: #14171A;
--fs-iron: #1E2228;
--fs-slate: #2C313A;
--fs-pewter: #3F4651;
/* Text */
--fs-parchment: #E8E4D8;
--fs-vellum: #C2BFB4;
--fs-ash: #9C9A92;
/* Action */
--fs-moss: #4A5D3F;
--fs-bronze: #8B7355;
--fs-oxblood: #6B2118;
/* Semantic */
--fs-warning: #8B6F1E;
--fs-error: #C04A1F;
--fs-info: #3D5A6E;
/* Accent (per-app; default = Minstrel forest-teal) */
--fs-accent: #4A6B5C;
/* Radii */
--fs-radius-sm: 4px;
--fs-radius-md: 8px;
--fs-radius-lg: 12px;
--fs-radius-xl: 16px;
/* Fonts */
--fs-font-display: 'Fraunces', Georgia, serif;
--fs-font-body: 'Inter', system-ui, sans-serif;
--fs-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}
/* Per-app accent overrides. Set `data-fs-app="minstrel"` on <html> or any
* ancestor to scope; the :root default already matches Minstrel, so this
* block is documentation / future override-point for other FS apps. */
[data-fs-app="minstrel"] {
--fs-accent: #4A6B5C;
}
+34
View File
@@ -0,0 +1,34 @@
{
"colors": {
"obsidian": "#14171A",
"iron": "#1E2228",
"slate": "#2C313A",
"pewter": "#3F4651",
"parchment": "#E8E4D8",
"vellum": "#C2BFB4",
"ash": "#9C9A92",
"moss": "#4A5D3F",
"bronze": "#8B7355",
"oxblood": "#6B2118",
"warning": "#8B6F1E",
"error": "#C04A1F",
"info": "#3D5A6E",
"accent": "#4A6B5C"
},
"radii": {
"sm": "4px",
"md": "8px",
"lg": "12px",
"xl": "16px"
},
"fonts": {
"display": "Fraunces",
"body": "Inter",
"mono": "JetBrains Mono"
},
"fontStacks": {
"display": "'Fraunces', Georgia, serif",
"body": "'Inter', system-ui, sans-serif",
"mono": "'JetBrains Mono', ui-monospace, monospace"
}
}