feat(ds-flow): Phase 1.1-1.2 — 原型单源目录 + tokens.css 迁为真源

- design/prototype/serve.mjs:零依赖热重载预览服务器(照搬 jiu,check-ds
  存在性守护,Phase 5 前静默跳过)
- design/prototype/tokens.css:token 真源(现结构已满足 ds-flow 的
  base :root + [data-theme=dark],字节迁移保证 codegen 零 diff)
- design/colors_and_type.css:退化为薄 @import 别名(供历史 preview/*.html
  浏览器内引用;codegen 不再读它)
- 三个 codegen(Flutter gen_flutter_tokens / website+usercenter build-tokens)
  + drift 检查全部重指向 prototype/tokens.css
- 生成产物 diff 仅头注释源路径行,token 数值零变化(已验证)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-08 00:00:38 +08:00
parent 3311430db6
commit 805bf8e2ca
11 changed files with 341 additions and 236 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
/**
* gen_flutter_tokens.mjs — CSS token → Dart codegen
*
* 唯一真相源:design/colors_and_type.css
* 唯一真相源:design/prototype/tokens.css
* 输出: client/lib/pangolin_tokens.gen.dart
*
* 生成内容(纯数据层,无 Flutter 实现逻辑):
@@ -20,7 +20,7 @@ import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
const __dirname = dirname(fileURLToPath(import.meta.url));
const SRC = resolve(__dirname, '../colors_and_type.css');
const SRC = resolve(__dirname, '../prototype/tokens.css');
const OUT = resolve(__dirname, '../../client/lib/pangolin_tokens.gen.dart');
if (!existsSync(SRC)) {
@@ -125,7 +125,7 @@ const lines = [];
lines.push(`// pangolin_tokens.gen.dart`);
lines.push(`// AUTO-GENERATED — 勿手改。`);
lines.push(`// 源: design/colors_and_type.css`);
lines.push(`// 源: design/prototype/tokens.css`);
lines.push(`// 生成器: design/codegen/gen_flutter_tokens.mjs`);
lines.push(`//`);
lines.push(`// 包含:PangolinColors · PangolinSpacing · PangolinRadius · PangolinMotion · PangolinShadow`);
@@ -136,7 +136,7 @@ lines.push(``);
// ── PangolinColors ──────────────────────────────────────────────────
lines.push(`/// ── Primitive color ramps ───────────────────────────────────────────`);
lines.push(`/// Auto-generated from design/colors_and_type.css :root color ramps.`);
lines.push(`/// Auto-generated from design/prototype/tokens.css :root color ramps.`);
lines.push(`class PangolinColors {`);
lines.push(` PangolinColors._();`);
lines.push(``);