Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

docs(design): 排版立法——字重四档、字号白名单与豁免登记(#1505 PR1) (#1512)

Kirozeng31e788507831
diff --git a/apps/mobile/docs/mobile-design-guide.md b/apps/mobile/docs/mobile-design-guide.md
index 84fb1fab3a..4881596412 100644
--- a/apps/mobile/docs/mobile-design-guide.md
+++ b/apps/mobile/docs/mobile-design-guide.md
@@ -14,7 +14,7 @@
- **灰度环境**:除品牌 teal(就绪态)和 Heart Orange(运行/thinking 态)两个语义色外,界面全是黑白之间的灰阶。不引入任何品牌蓝 / 绿 / 红等装饰色。
- **圆角走四档阶梯**(与 `src/theme/tokens.ts` 的 `radius` 一致,守护测试拦截阶梯外值):`micro`(4,缩略图内 chip、勾选指示器等微元素)/ `control`(8,卡片内层控件)/ `container`(12,卡片 / 容器)/ `pill`(9999,交互元素)。**禁止**阶梯外中间值(0 / 3 / 6 / 28 等)与字面量圆角。根规范 `docs/design-rules/DESIGN.md` §5 的三档制约束的是桌面 surface;其「Mobile」节明确把 §15.13 / §16 之外的 mobile 布局细节委托给 `apps/mobile` 的实现,mobile 圆角阶梯以 `tokens.ts` 为准。
- **零阴影**:层次靠背景色差 + 1px 边框,不用 `shadow*` / `elevation`。
-- **字重克制**:只用 400 / 500,极少量大写微标签可用 600。无 700+。
+- **字重克制**:只用 400 / 500,极少量大写微标签可用 600。**UI chrome 无 700+**。唯一例外是根规范 `docs/design-rules/DESIGN.md` §3「排版豁免登记表」已登记的域——原生 Markdown strong(`src/session/MessageRenderer.tsx` 的 `markdownStrong` → `fontWeight.bold`)与登录品牌画布(`app/(auth)/login.tsx`、`src/components/LoginSkinControls.tsx`、`src/auth/loginSkinLayout.ts`)。这些是用户内容语义与品牌画布,不算 chrome;chrome 本身的上限仍是 600。
- **手机只做减法**(详见 `mobile-current-execution-plan.md`):主层信息量不超过桌面主层;视觉轻、触控够(可见图标小,hitSlop 补足热区)。
---
@@ -81,7 +81,9 @@
### 字重 `fontWeight`
-`regular '400'` · `medium '500'`(默认) · `semibold '600'`(仅限大写微标签等少量强调)。**不超过 600。**
+`regular '400'` · `medium '500'`(默认) · `semibold '600'`(仅限大写微标签等少量强调) · `bold '700'`(**仅限已登记豁免域**,见下)。**UI chrome 不超过 600。**
+
+`bold '700'` 只允许用在根规范 `docs/design-rules/DESIGN.md` §3「排版豁免登记表」登记的两处:原生 Markdown strong(`src/session/MessageRenderer.tsx` 的 `markdownStrong`)与登录品牌画布(`app/(auth)/login.tsx`、`src/components/LoginSkinControls.tsx`、`src/auth/loginSkinLayout.ts`)。除此之外一律不得使用 700,新增用途必须先改根规范的登记表。
### 等宽 `monoFont`
@@ -91,7 +93,7 @@
- 字号:`10→micro` ·`14→footnote` ·`17→body` ·`22/23/28→headline`。
- 行高:`16→caption(18)` ·`20→body(22)或 code(20)` ·`23→body(22)` ·`24/25/26→subtitle(26)` ·`28/30/31→headline(30)`。
-- 字重:`'700'→semibold('600')`(仅大写微标签,否则 `'500'`)。
+- 字重:`'700'→semibold('600')`(仅大写微标签,否则 `'500'`)。**已登记豁免域除外**(原生 Markdown strong、登录品牌画布)——那两处保留 `bold '700'`,不要按此条降档。
- 等宽:`'Courier'` 与内联 `Platform.select` → `monoFont`。
---
@@ -180,7 +182,7 @@ function Foo() {
- ❌ 写死 hex / rgba / `'Courier'`(dark 下不变色 / 字体不统一)。
- ❌ `shadow*` / `elevation`(零阴影)。
- ❌ 中间圆角(0 / 3 / 4 / 8 / 28)。
-- ❌ 字重 > 600。
+- ❌ UI chrome 字重 > 600(已登记豁免域除外:原生 Markdown strong、登录品牌画布)。
- ❌ 在组件体内内联定义 `makeStyles`(破坏缓存)。
- ❌ 渐变、装饰性插画、品牌色泛滥。
@@ -201,7 +203,7 @@ function Foo() {
- [ ] `makeStyles` 在**模块级**定义。
- [ ] 字号 / 行高 / 字重 / 圆角 / 图标尺寸全走 token,无裸数字(必要微调写注释)。
- [ ] 等宽用 `monoFont`。
-- [ ] 无 `shadow*` / `elevation`、无中间圆角、字重 ≤ 600。
+- [ ] 无 `shadow*` / `elevation`、无中间圆角、**UI chrome 字重 ≤ 600**(已登记豁免域除外:原生 Markdown strong `src/session/MessageRenderer.tsx`、登录品牌画布 `app/(auth)/login.tsx` / `src/components/LoginSkinControls.tsx` / `src/auth/loginSkinLayout.ts` —— 这两处保留 `bold '700'`,验收时不要按 ≤ 600 降档)。
- [ ] 复用了 `MobilePrimitives`,没有重复造按钮/卡片/空态。
- [ ] 在模拟器 light + dark(Cmd+Shift+A)都目检过。
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 6cc3b618d3..2e1260d2b2 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -105,27 +105,76 @@ The grayscale rule is near-absolute. The following are the **only** sanctioned n
| --------------- | -------------- | -------------- | ------- | ------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Display / Hero | Inter | 48px (3rem) | 500 | 1.00 (tight) | normal | Maximum impact headline |
| Section Heading | Inter | 36px (2.25rem) | 500 | 1.11 (tight) | normal | Feature section titles |
-| Sub-heading | Inter | 30px (1.88rem) | 400–500 | 1.20 (tight) | normal | Card headings, feature names |
+| Sub-heading | Inter | 30px (1.88rem) | 400 / 500 | 1.20 (tight) | normal | Card headings, feature names |
| Card Title | Inter | 24px (1.5rem) | 400 | 1.33 | normal | Medium emphasis headings |
-| Body Large | Inter | 18px (1.13rem) | 400–500 | 1.56 | normal | Hero descriptions, button text |
-| Body / Link | Inter | 16px (1rem) | 400–500 | 1.50 | normal | Standard body text, navigation |
+| Body Large | Inter | 18px (1.13rem) | 400 / 500 | 1.56 | normal | Hero descriptions, button text |
+| Body / Link | Inter | 16px (1rem) | 400 / 500 | 1.50 | normal | Standard body text, navigation |
| Caption | Inter | 14px (0.88rem) | 400 | 1.43 | normal | Metadata, descriptions |
-| Small | Inter | 12px (0.75rem) | 400 | 1.33 | normal | Smallest sans-serif text |
-| Micro Label | Inter | 10–13px | 400–500 | 1.20–1.40 | optional 0.5–1px tracking on uppercase | **Auxiliary / non-reading** labels only — sidebar tree section heads (13px), tree row counts, frontmatter field names, scope chips, tag pills, status badges, breadcrumb segments. Never used for body text or anything the user reads sentence-by-sentence. |
+| Small | Inter | 12px (0.75rem) | 400 | 1.33 | normal | Smallest reading-text size (auxiliary Micro Label may go smaller, floor 10px) |
+| Micro Label | Inter | 10–13px | 400 / 500 | 1.20–1.40 | optional 0.5–1px tracking on uppercase | **Auxiliary / non-reading** labels only — sidebar tree section heads (13px), tree row counts, frontmatter field names, scope chips, tag pills, status badges, breadcrumb segments. Never used for body text or anything the user reads sentence-by-sentence. |
| Code Body | JetBrains Mono | 16px (1rem) | 400 | 1.50 | normal | Inline code, commands |
| Code Caption | JetBrains Mono | 14px (0.88rem) | 400 | 1.43 | normal | Code snippets, secondary |
-| Code Small | JetBrains Mono | 11–12px | 400–500 | 1.40–1.63 | normal | Tags, labels, in-tree paths |
+| Code Small | JetBrains Mono | 11–12px | 400 / 500 | 1.40–1.63 | normal | Tags, labels, in-tree paths |
-*Positioning note: the Display / Section Heading / Sub-heading rows are for brand-scale surfaces (login, splash, empty states); everyday app chrome lives in the Body / Caption / Small / Micro rows.*
+*Positioning note: the Display / Section Heading / Sub-heading rows are conceptual role targets for **brand canvases only** (the §16 login / splash family and its self-contained pages). Their concrete values live in canvas constants and §16 tables, not in app code. The 「排版豁免登记表」 below only registers exemption domains. Everything else — everyday chrome **and** in-app empty states — lives in the Body / Caption / Small / Micro rows, and for `apps/desktop` code the normative size set is the 「桌面 UI 字号白名单」 below: this table describes roles, the whitelist constrains values.*
### Principles
- **Single sans family**: Inter carries both display headlines and body text — no typeface switching between hierarchy levels. Size and weight alone create hierarchy, keeping the typographic system maximally simple.
-- **Weight restraint**: Only two weights matter — 400 (regular) for body and 500 (medium) for headings. No bold, no light, no black weight. This extreme restraint reinforces the minimal philosophy.
+- **Weight restraint**: Everyday chrome defaults to 400 (regular) and 500 (medium); 600 is a rationed emphasis tier, and 700 lives exclusively inside registered exemption domains. No light, no black weight, no in-between values. The full ladder and its rules are in 「字重阶梯」 below (2026-08 revision, issue #1505 — this supersedes the former "400/500 only" wording).
- **Tight display, comfortable body**: Headlines compress to 1.0 line-height, while body text relaxes to 1.43–1.56. The contrast creates clear hierarchy without needing weight contrast.
- **Monospace for code only**: JetBrains Mono is reserved for inline code, terminal commands, and code blocks — never used for UI chrome.
+### 字重阶梯(2026-08 修订,issue #1505)
+
+全站字重只允许以下四档整百值,禁止一切中间值(550/650…)与 800 及以上:
+
+| 档 | 名称 | 用途 |
+| --- | --- | --- |
+| 400 | Regular | 长文阅读正文、代码 |
+| 500 | Medium | UI 默认强调、标题 —— 日常 chrome 的主力档 |
+| 600 | Semibold | 限量强调(徽标、表头、选中态等局部加重)。新增使用要能说出「为什么 500 不够」 |
+| 700 | Bold | **仅限下方豁免登记表中的域**,禁止出现在普通 UI chrome |
+
+- 与手机端 `apps/mobile/src/theme/tokens.ts` 的 `fontWeight` token(regular / medium / semibold / bold)一一对应 —— 两端一张梯子。
+- **两端 700 口径**:手机端 UI chrome 的上限仍是 600(正本为 `apps/mobile/docs/mobile-design-guide.md`,该文已同步登记本例外)。`bold` / 700 在手机端**只允许**出现在下表登记的域——原生 Markdown strong 与登录品牌画布。也就是说「四档梯子」是两端共用的**档位定义**,不等于两端 chrome 都可用 700。
+- **CJK 注记**:桌面未设 `font-synthesis: none`,中文回退字体(PingFang)公开档位到 600 —— UI 里用 700 会在中文上触发伪粗体(算法加粗、边缘发糊),且 600 与 700 在 CJK 上的渲染差异不可靠。**中文层级不得依赖 600 vs 700 区分**,强调靠字号或颜色。
+
+### 桌面 UI 字号白名单(2026-08,issue #1505)
+
+- **UI 段:{10, 11, 12, 13, 14, 15, 16}px;标题 / 内容段:{18, 20, 24, 28}px。** 下限 10px —— 9px 及以下禁止(再小就不是文字是纹理)。
+- **下限约束的是「开发者写死的档位」,不约束运行期缩放结果。** 用户可把 UI 字号设到 `appearanceSettings.uiSize` 允许的最小值 12(默认 14),`useFontSettings` 按 `uiSize / 14` 缩放并 `Math.round`,此时 `--text-10` 与 `--text-11` 都会算成 9px(两档在该设置下失去区分)。这是用户主动选择的整体缩小,不是违反下限;守卫也只检查源码里写的档位,不检查运行期计算值。**若要保住 10px 视觉下限,应在字号设置侧(提高 `uiSize` 下限或改缩放曲线)解决,而不是往白名单里加更小的档位。**
+- **写法**:一律用 `tailwind.config.ts` 的 `text-<n>` token 类(映射 `--text-<n>` 变量;doc 紧凑模式与后续字号缩放能力都挂在这层变量上,任意值类会静默漏掉这些机制)。语义类 `text-xs / text-sm / text-base / text-lg` 只收编存量(等值 12 / 14 / 16 / 18);源码侧禁止使用 `text-xl` 及以上语义档位(由守卫拦截),配置侧 `theme.extend.fontSize` 的 `xl..5xl` 遗留项不在本轮删除范围,避免删除后静默回退到 Tailwind 内置固定值、失去用户字号缩放;其清理另行处理。**禁止新增任意值 `text-[Npx]`(含一切小数)与白名单外档位**;需要新档先改本表与权威来源,再进组件。
+- **镜像约定(目标态;施工由 #1553 承接)**:当前 main 尚未建立白名单与字号实现的镜像关系。四个权威来源必须同步:本表(规范正本)与以下三处代码——`apps/desktop/tailwind.config.ts` 的 `fontSize`(类名可用性与变量映射;漏掉则 `text-<n>` 类根本不存在)、`apps/desktop/src/renderer/styles/globals.css` 的静态 `--text-<n>` 默认值(漏掉则变量未定义并回退到继承值)、`apps/desktop/src/renderer/hooks/useFontSettings.ts` 的 `UI_TEXT_TOKEN_SIZES` 运行时生效值(含用户字号缩放;漏掉则该档位不随用户设置缩放,反向漏则会写出已删档位的陈旧变量)。另有一个消费端需保持一致:`apps/desktop/src/renderer/lib/utils.ts` 的 tailwind-merge `classGroups['font-size']` 负责类名去重,不产生字号值;漏登记会让 `cn()` 合并两个字号类失效,两个类会同时留在 DOM 上。该消费端单独做一致性校验,不计入四个权威来源镜像。同一 hook 的 `SCALED_TAILWIND_TOKENS` 负责语义类运行时缩放,需与 Tailwind 语义类映射保持同步,但不改变本白名单的具体档位。PR4 的守卫按四个权威来源做镜像断言,并单独校验消费端一致性。
+- 品牌画布域(登录 / Splash 家族等设计 px 坐标系表面)不映射本白名单:字面量只允许进画布常量文件(`loginDesignTokens.ts` 的地位,对齐手机端 `loginSkinLayout.ts`)**或下表登记的自包含品牌页生成器**(`oauthResultPage.ts` 整页由 main 侧生成,其内嵌 raw CSS 即该页的常量载体),组件消费端照常受守卫扫描。
+
+### 排版豁免登记表(2026-08,issue #1505)
+
+以下是**登记过的刻意分歧**,不要当 bug「修」;新增豁免必须先改本表:
+
+| 域 | 范围 | 允许 | 理由 |
+| --- | --- | --- | --- |
+| 登录 / Splash 品牌画布 | 桌面 `LoginControls.tsx`、`loginDesignTokens.ts`(Splash 借用同族面板)、`LegacyMigrationDialog.tsx`(仅字重)、`oauthResultPage.ts`(自包含品牌页生成器,raw CSS 为其常量载体);手机 `apps/mobile/app/(auth)/login.tsx`(登录页本体)、`apps/mobile/src/components/LoginSkinControls.tsx` 与 `apps/mobile/src/auth/loginSkinLayout.ts` | 700 + 设计 px 字号 | §16 已登记 Bold,两端共用同源登录画布与 figma 坐标系;桌面守卫只扫描 `apps/desktop/src/renderer`,手机端由自身守卫体系负责,本登记不扩展 PR #1553 的扫描范围 |
+| markdown 内容 | **仅 Markdown 渲染路径**:桌面 Markdown 渲染器输出的 DOM `<strong>`(`MarkdownRenderer` 及其消费方;必须解析为绝对 700;嵌套 strong 仍封顶 700)、CodeMirror strong 语法节点(`codemirrorGithubTheme.ts` 的 `t.strong` → `fontWeight: 'bold'`)、移动端原生 Markdown strong(`apps/mobile/src/session/MessageRenderer.tsx` 的 `markdownStrong` → `fontWeight.bold`) | 700 / `bold` | 用户内容语义,非 UI chrome;编辑器内 strong 与两端渲染后的 strong 同权。当前桌面 Tailwind preflight 的相对 `bolder` 会使嵌套 strong 计算到更高档位,是已知实现缺口;规则不把该结果视为合规,待独立施工。**本行不覆盖普通 UI chrome 里直接写的 `<strong>`**(如 `MakerExperimentalView.tsx` 会话状态与事件列表)——它们同样被 preflight 的相对 `bolder` 渲染成 700,但不属豁免域,是已登记缺口,待归一为 `font-medium` / `font-semibold`。 |
+| hljs 主题移植 | `globals.css` 内 hljs 规则 | `bold` | 第三方主题移植,保真优先 |
+| 第三方查看器(用户内容) | `apps/desktop/src/renderer/vendor/drawio/viewer-static.min.js`(由 `DrawioPreview.tsx` 加载)及 `vendor/` 下其他上游产物 | 上游自带字重与字号 | 上游压缩产物,渲染的是用户绘图内容而非本产品 chrome;不改上游、不逐行归一。**守卫边界**:整个 `vendor/` 目录不纳入扫描(PR #1553 已在守卫盲区中显式登记该排除,不是未登记的漏扫)。 |
+| CodeMirror / Markdown 内容字号 | `codemirrorGithubTheme.ts` 的标题等内容层级(`2.15em` / `1.62em` 等相对值,CSS-in-JS 路径) | 相对字号(`em` 派生) | 内容标题层级必须随编辑器基础字号等比缩放,固定 token 会打断这个比例关系;相对值本身不脱离缩放链,故不要求落在 numeric 白名单。**守卫边界**:`em` / `rem` / `%` 相对值不参与 numeric 白名单判定。 |
+| 命令式第三方 API(非 DOM class 路径) | xterm 的 `ITerminalOptions.fontSize`(`features/right-sidebar/plugins/terminal/lib/xtermPool.ts`)等只接受**数值字段**、无法挂 class 的第三方配置入口;SVG 的 `fontSize="N"` 属性同理 | 数值字面量 | 这类 API 不消费 DOM class,Tailwind token 类挂不上去,只能传数字。**取值规则**:数值必须取自本白名单档位,或取自用户代码字号设置(`--app-code-font-size` / `appearanceSettings.codeSize`)解析出的运行期值 —— 不允许凭手感另取一个数。**守卫边界**:按精确签名放行(文件 + 字段 + 期望次数),不做整文件豁免,新增此类入口须先改本表。 |
+| 用户可配置代码字号(变量路径) | `--app-code-font-size` 及其派生写法(`text-[length:var(--app-code-font-size)]`、`text-[length:calc(var(--app-code-font-size)_-_1px)]` 等,消费方含 Markdown / DiffView / ToolCallCard 等约 19 个文件) | 变量与其 `calc` 派生 | 该字号是**用户设置项**,`appearanceSettings.ts` 的 `codeSize` 允许 10–24 逐整数取值,因此运行期可落在 17 / 19 / 21 / 22 / 23 等 numeric 白名单外的值;这是刻意的可配置能力,不是漏归一。本白名单约束的是**开发者写死的档位**,不约束用户设置的运行期取值。**守卫边界**:`--app-code-font-size` 的变量与 `calc` 派生写法按精确签名登记豁免(见 PR #1553 守卫的豁免表),不按 numeric 白名单判定。 |
+| 外部页注入 | `browserCommentPreload.ts` | 系统字体族 | 注入他人网页,不强加 Inter |
+| 手机 WebView HTML 生成器 | `selectableMarkdownHtml.ts` 等 | CSS 语法字面量 | 手机守卫已自登记盲区,值仍须守本阶梯 |
+| 紧凑模式派生值 | `globals.css` `.chat-rail-compact` 段 | calc / -1px 派生 | 机制本体 |
+
+### 排版 non-goals(2026-08 登记)
+
+以下漂移**已知且本轮明确不治理**,后人见到不要当「漏网」顺手修,治理需另立 issue:
+
+- line-height:桌面存在 `leading-[1.45]` / `leading-[1.55]` 等微调档与无单位 / px 混轨。
+- 语义类 `text-xs/sm/base/lg` → `text-<n>` 的机械统一:等值改写零收益,收编即可。
+- letter-spacing 与 font-family 治理。
+- 原生层排版:macOS agent-island helper 等 Swift / 原生 UI 的字号字重不在本白名单域(Web 白名单与守卫均不覆盖,治理需另立 issue)。
+
## 4. Component Stylings
> Buttons / Cards / Inputs below use the structured key-value format (adopted from the §12 pilot, 2026-07): `field → token → Default Light / Default Dark resolved values`. Token names per §10.
@@ -267,7 +316,7 @@ Three tiers — **these three only**:
- Use 12px radius on all non-interactive containers — code blocks, cards, panels
- Use 8px radius only for inner controls that can't be a pill — multi-line inputs, dropdown/menu rows (see §5)
- Keep the palette strictly grayscale — chromatic color only via the sanctioned semantic set in §2, always through tokens
-- Use Inter at weight 500 for display headings — hierarchy comes from size + weight, not typeface switching
+- Use Inter at weight 400 / 500 for display headings (per the §3 Hierarchy rows) — hierarchy comes from size + weight, not typeface switching
- Maintain zero shadows — depth comes from borders and background shifts only
- Keep content density low — each section should present one clear idea
- Use monospace for terminal commands and code — it's primary content, not decoration
@@ -278,7 +327,7 @@ Three tiers — **these three only**:
- Don't introduce any chromatic color outside the sanctioned semantic set in §2 — no brand blue, no accent green, no warm tones beyond the registered exceptions
- Don't invent arbitrary radii — only three values exist: 8px (inner controls), 12px (containers), 9999px (pill). Nothing in between, nothing else.
- Don't add shadows to any element — the flat aesthetic is intentional
-- Don't use font weights above 500 — no bold, no black weight
+- Don't use font weights above 600 in UI chrome — 700 only inside the exemption domains registered in the §3 registry (that table is the single source of truth; it currently covers markdown content, hljs theme ports, login / Splash brand canvas, third-party viewers under `vendor/`, and imperative third-party APIs). Don't re-enumerate the domains here — read §3. No 800+, no in-between values, anywhere
- Don't add decorative illustrations — Cindy's working UI carries no mascots or artwork; brand imagery appears only on the explicitly enumerated sanctioned brand surfaces in §15.7 / §16
- Don't use gradients anywhere — flat blocks and borders only
- Don't overcomplicate the layout — stick to the region structure in §5; no complex nested grids
@@ -328,7 +377,7 @@ Cindy Mobile (React Native) has its own device-class rules (phone / pad portrait
2. Keep all values grayscale — "Stone (#737373)" not "use a light color"
3. Always specify radius from the three tiers — pill (9999px) / container (12px) / inner control (8px, only for textareas & dropdown rows). Nothing else.
4. Shadows are always zero — never add them
-5. Weight is always 400 or 500 — never bold
+5. Weight is 400/500 for everyday chrome, 600 for rationed emphasis — 700 never appears in new UI (registered exemption domains in §3 only)
6. If something feels too decorated, remove it — less is always more
## 10. Theme System & Token Reference
diff --git a/docs/design-rules/cindy-design-system.md b/docs/design-rules/cindy-design-system.md
index 8a5008f888..9e146843f0 100644
--- a/docs/design-rules/cindy-design-system.md
+++ b/docs/design-rules/cindy-design-system.md
@@ -16,6 +16,7 @@
## 版本记录
- **2026-08-06(资源用量进程类别色)**:按用户对资源用量面板“icon 改为彩色”的走查要求,`DESIGN.md §2 / §10` 登记仅限 14px 进程类型 glyph 的六色 Light / Dark 调色板;颜色只编码任务 Agent、控制面服务、主进程、Renderer、GPU、Utility 类别,不表达健康或运行状态,行背景、文字、指标与操作继续保持中性。对应 token 加入外部主题导入保护,防类别色随导入主题漂移;该例外不得扩散到其它表格或进程 UI。
+- **2026-08-03(排版立法:字重四档 + 桌面字号白名单,issue #1505 PR1)**:`DESIGN.md §3` 字重梯由「仅 400/500」修订为 400/500/600/700 四档(600 = 限量强调收编存量 72 处 semibold(生产代码口径);700 仅限豁免域;800 及中间值全禁;与手机端 `fontWeight` token 对齐),§3 Principles / §7 Don'ts / §9 Iteration Guide 三处「never bold」表述同步改写;§3 新增四个小节——「字重阶梯」(含 CJK 伪粗体注记:中文层级不得依赖 600 vs 700)、「桌面 UI 字号白名单」(UI 段 {10–16} + 标题段 {18,20,24,28},禁任意值 `text-[Npx]` 与小数;语义别名只收编 `xs/sm/base/lg`,源码侧禁止 `xl` 及以上,配置侧遗留项不在本轮删除范围;**四个权威来源构成目标态镜像,另有 tailwind-merge 字号去重消费端,施工由 #1553 承接**)、「排版豁免登记表」(登录品牌画布 / markdown `<strong>` / hljs 移植 / 外部页注入 / 手机 WebView 生成器 / 紧凑模式派生值)、「排版 non-goals」(line-height 混轨等本轮明确不治理)。走查数据、三项拍板与后续施工计划见 [`design-decision-log.md`](./design-decision-log.md)「2026-08-03」条与 issue #1505。
- **2026-07-29(修正:手机端功能区落位回新稿标注值)**:手机短屏 / 长屏的 `loginY` 由 main 原值 694 / 933 改回新稿标注值 **622 / 827**;短屏以下(dh<1334)改为 `min(622, max(0, dh-640))`——保留紧凑底距 18 再钳到短屏档落位(**不是**把锚常量改成 `dh-712`:那会让 dh∈[712,1222) 全段字标被面板压盖,review 实算 dh=1000 压 40 设计px)。起因:2026-07-28 剥离手机端跳过登录时把功能区落位一并退回 main,却保留了已换新稿的品牌簇,两半拼接使「字标底↔面板顶」间距变成 **92 / 131.65** 设计px(稿内为 20 / 25.65),实机肉眼可见一条空白。修正后间距回到稿值;面板 500→440 少掉的 60 落到底部留白(90 / 175,比稿内多 60)——审图拍板「方案 B」,未采纳「品牌簇整体下移 60」的方案 A。`DESIGN.md §16.2` 表与「60 去向」条目、§16 末尾勘误块 (6) 已就地更新;`loginSkinLayout.test.ts` 新增三条不变式:「间距上界不变式」(等于稿值,替代原先只判不重叠的下界)、「锚常量连续性不变式」(dh=1334 上下不跳变)、「间距不变式(短屏以下分支)」(dh∈[850,1334) 采样点面板顶不得压到字标底),防再次只改一半、也防窄屏压盖回归。pad 竖屏不受影响(无新稿帧、品牌簇未换基准,保持 621 / 158)。
- **2026-07-28**:`DESIGN.md §2` 语义色清单新增警告橙合法消费者「workflow agent 状态方块条的运行中格子」(8×8px 方块,后台任务面板详情 + workflow 聊天卡;done/failed/queued 各走自己的语义 token),并明确「不引入新 token 的消费者由 §2 清单登记即可、需要新 token 才必须先进 §10 豁免表」;`DESIGN.md §5` 新增小例外「status micro-cells(2px)」——≤8px 的非交互状态方块保留 2px 圆角(方块条格子与 SystemCard 分类方块),档位圆角在该尺寸会把方块变成圆点、丢掉大编队一眼总览的「方块条」读法,范围严格限定非交互 / ≤8px / 仅状态,按钮·标签·行·徽章·容器一律仍走三档。
- **2026-07-28(勘误:手机端跳过登录剥离)**:手机端「跳过登录」与无账号通路整体从登录改版中剥离(2026-07-24「手机 / pad 必须有账号」拍板仍有效,07-27 的推翻缺产品侧确认);手机端只保留纯视觉改版(品牌簇新稿基准 + 避脸),面板 / 组高 / 圆钮行 / 协议行 / error 槽 / 键盘停靠锚全部回到 main 等价值。`DESIGN.md §16` 末尾新增勘误块界定「哪些值只对桌面成立」,详情与依据归档至 [`design-decision-log.md`](./design-decision-log.md)「2026-07-28」条。
diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.md
index ca070bd162..70b9f738eb 100644
--- a/docs/design-rules/design-decision-log.md
+++ b/docs/design-rules/design-decision-log.md
@@ -10,6 +10,33 @@
> 2026-07-25 起 `§15` CINDY 皮肤族的决策史(红色体系重构、caret 改稿、vibrancy
> 定稿等)已随 §15 保号重构迁入本文件,`DESIGN.md §15` 只保留现行规范。
+## 2026-08
+
+- **08-03** **排版立法:字重梯改四档、桌面字号白名单建档(拍板人 = 用户,issue #1505)**——
+ 本条**推翻**原 `DESIGN.md §3` 的「字重只允许 400/500、never bold」表述(§3 Principles /
+ §7 Don'ts / §9 Iteration Guide 三处同步改写)。背景:2026-08-03 全仓走查发现桌面端在无守卫
+ 状态下已实际漂移——`font-semibold`(600)生产代码 ×72(含测试 ×74)、`font-bold`(700)×11、
+ `font-extrabold`(800)×1,任意值字号 `text-[Npx]` 生产代码约 549 处(含 21 处小数、
+ 7 处 <10px:6×9px + 1×8.4px;计数口径 = 生产代码 occurrence,测试与注释另计);
+ 而手机端 2026-07 已收敛到
+ 400/500/600/700 四档 token 并有 `typographyTokenDiscipline.test.ts` 守卫。三项决策:
+ (1) **字重四档收编**:400/500/600/700,与手机端 `fontWeight` token 对齐,两端一张梯子;
+ 600 收编存量 72 处 semibold(合法化、不改代码),700 只许经豁免登记表(markdown `<strong>` /
+ hljs 主题移植 / 登录品牌画布),800 清零。工程理由:桌面未设 `font-synthesis: none`,
+ PingFang 公开档位到 600,UI 用 700 会触发中文伪粗体——中文层级不得依赖 600 vs 700。
+ (2) **字号「只归写法、不动数值」**:本轮不做档位迁移,白名单 = UI 段 {10–16} + 标题段
+ {18, 20, 24, 28};只做小数吸附、<10px 升下限、任意值归 `text-<n>` token;语义别名只收编
+ `xs/sm/base/lg`,源码侧禁止 `xl` 及以上(由守卫拦截)。`theme.extend.fontSize` 中的
+ `xl..5xl` 遗留项不在配置侧删除范围,避免删除后静默回退到 Tailwind 内置固定值、失去用户字号缩放;
+ 配置遗留项的清理另行处理。
+ 任意值归 token 的附带修复:
+ doc 紧凑模式(`.chat-rail-compact`)按类名枚举缩字号,任意值不在枚举内会静默漏缩。
+ (3) **`LegacyMigrationDialog` 裁决**:其 23/19/17 字号是登录画布 680→490(×0.72)的缩放
+ 产物而非手滑,但仍吸附回白名单(24/18/16,±1px);字重 700 归登录品牌域豁免。
+ line-height 混轨、语义类 `text-xs/sm` 机械统一等登记为 non-goals。
+ (→ `DESIGN.md §3`「字重阶梯 / 桌面 UI 字号白名单 / 排版豁免登记表 / 排版 non-goals」
+ 四个新小节;施工与守卫拆四个 PR,台账 = issue #1505)
+
## 2026-07
- **07-29** **「跳过登录」恢复过协议门 + 协议行整行热区 + 未登录态命名(拍板人 = 用户)**——