From 3ceae1e983e28ed9266b846de405688a660774fd Mon Sep 17 00:00:00 2001 From: "xiaohan.yuan" Date: Sun, 18 Oct 2026 18:36:43 +0800 Subject: [PATCH] chore(design-system): add extraction artifact and token drift gate Record the design decisions actually in use and add a static gate that blocks new bare colors, bare sizes, important overrides, and wb token definitions outside token sources. --- design-system.md | 467 ++++ package.json | 1 + scripts/check-design-tokens.mjs | 501 ++++ scripts/design-token-baseline.json | 3694 ++++++++++++++++++++++++++++ 4 files changed, 4663 insertions(+) create mode 100644 design-system.md create mode 100644 scripts/check-design-tokens.mjs create mode 100644 scripts/design-token-baseline.json diff --git a/design-system.md b/design-system.md new file mode 100644 index 0000000..8f1abff --- /dev/null +++ b/design-system.md @@ -0,0 +1,467 @@ +# YCode 设计系统现状(Extract,2026-10-18) + +> **本文件是现状快照,不是目标方案。** 只记录当前仓库里实际生效的 token、刻度、组件与约定,供后续 Build / Audit 逐条对照。 +> 目标分层、兼容层边界与迁移顺序见 `docs/设计系统提取与统一方案-2026-10-18.md`(本文件第 6 节只做指向,不复制方案内容)。 +> 采集范围:`src/renderer/src`(统计时排除第三方资产目录 `workbuddy/artifacts/recovered-pierre/`、`workbuddy/workbench/source-code-assets/`)与构建产物 `out/renderer/`。 +> 采集方式:`rg` 文本检索 + 正则统计 + PowerShell 逐字节读取文件;未做浏览器运行时取值,未改动任何实现文件。 +> 工作树快照说明:提取期间同批 P0 工作已落地 `scripts/check-design-tokens.mjs`、`scripts/design-token-baseline.json`(`npm run check:tokens`)并更新 `scripts/verify-ui.mjs`;本文件第 5.5 / 6 节按**当前工作树**(含这些未提交改动)记录。 + +## 0. 规模与测量基线 + +| 指标 | 实测值 | 说明 | +| --- | ---: | --- | +| CSS 文件 / TSX 文件 | 109 / 151 | `src/renderer/src` 全量,含恢复层 | +| CSS 行数 | 19,790 | 逐文件 `Get-Content` 行数求和 | +| `var(--yc-*)` 引用 | 1,372 | 与方案文档记录的 1,372 一致 | +| `var(--wb-*)` 引用 | 22,766 | 方案文档记录 22,756(本文件实测多 10 处) | +| `!important` | 926 | 方案文档记录 925(本文件实测多 1 处) | +| `tokens.css` 中 `--yc-*` 声明 | 271 | `:root` 229 + `html[data-theme='dark']` 18 + `.cb-font-size-fixed` 24 | +| `workbuddy/typography/tokens.css` 中 `--wb-*` 声明 | 115 | 唯一的根级 `--wb-*` 家族(排版/间距) | +| 原生控件 | `