From 75f92f677c3a720818bf35190f866206aa0975b3 Mon Sep 17 00:00:00 2001 From: argszero Date: Fri, 11 Sep 2026 23:59:49 +0800 Subject: [PATCH] fix(ui): define the orphan .mono class and restore the .nb nowrap span MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two class-parity defects measured by the C1986 audit (`tmp/classparity.py`, three independent extractions) are fixed here; both were silent, because the affected elements still rendered — just without the intended styling rule. 1. `.mono` was referenced but never defined anywhere The sharing table's Key cell has been written as `` since the initial UI commit (d70e032) while no commit ever contained a `.mono` rule, so the cell fell back to the UI font. Measured (headless computed styles, both themes/languages): before `font-family: -apple-system, "system-ui", …` and `font-variant-numeric: normal`, while the `.num` cells in the same row got `ui-monospace, …` + `tabular-nums`. After: `ui-monospace, …`. Alignment is deliberately left alone (the prototype writes `class="num"` on that cell, which would also right-align it); this only restores the monospace face. 2. `.nb` (white-space: nowrap) lost together with its span The login brand headline used to wrap "token plan" in ``, and the prototype defines `.nb { white-space: nowrap }` (line 132) so the phrase never breaks. Both the span and the rule were dropped in the migration, and the ZH headline then broke inside the phrase. Measured at 1024/1280/1440/1912: before, `token` and `plan` sat on different lines (top 137 vs 185, 149 vs 203) in all four widths; after, both on the same line (137==137, 149==149), with a real `` in the DOM whose computed white-space is `nowrap`. Since `applyStatic()` injects i18n values via `innerHTML`, the span lives in the `login.brand.headline` values for both ZH and EN (markup inside i18n values already exists for `login.foot` / `ops.users.sub`); the static ZH default in index.html is kept identical to the i18n value. Also bumps the asset cache-bust token `?v=20260911-5` -> `?v=20260911-6` (5 refs) so the CSS/JS changes are picked up. Verification - `cargo test`: 148 passed / 0 failed - `cargo fmt --check` clean, `cargo clippy --all-targets -- -D warnings` clean - `node --check` on api.js / data.js / i18n.js / app.js: all OK - i18n parity gate: ZH 762 == EN 762, 0 unresolved - `classparity.py`: bucket [1] 4 -> 3 (only the disproved JS toggle hooks `admin-pane` / `ops-pane` and the globally-covered `tx-count` remain), bucket [2] 17 -> 16 (`.cap` resolved as a deliberate rename to `.recent-label`), bucket [3] still 0 -> the global reset layer stays complete. - A/B acceptance probe over both trees built by the same generator (`git archive HEAD ui` vs the working tree): `.mono` monospace false -> true in both languages; `.nb` phrase split true -> false at every measured width. - Reset-layer regression guard re-run: native control count still 0 / 140. --- ui/css/style.css | 13 +++++++++++++ ui/index.html | 12 ++++++------ ui/js/i18n.js | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ui/css/style.css b/ui/css/style.css index db8198b..e7897ee 100644 --- a/ui/css/style.css +++ b/ui/css/style.css @@ -139,6 +139,19 @@ h1, h2, h3 { text-wrap: balance; } 的元素一直由下方 `.table .num` 规则兜住,故此前未被发现。 */ .num { font-family: var(--mono); font-variant-numeric: tabular-nums; } +/* 标识符等宽(共享管理「Key」列)。 + 该格自 UI 原型 commit d70e032 起就写着 class="mono",但**任何提交里都不存在 + .mono 规则**,因此一直是无样式孤儿类 —— 实测 computed font-family 为 + -apple-system、font-variant-numeric 为 normal,同排 .num 兄弟却是等宽 + 表格数字。 + 这里补上定义;对齐保持左对齐(原型对该格直接复用 .num 会连带右对齐, + 本次不改变既有排版,只修复失效的等宽)。 */ +.mono { font-family: var(--mono); } + +/* 短语不换行(原型 .nb,用于登录页品牌标题里的 "token plan")。 + 原型 markup 是 token plan,迁移时 span 与规则一并丢失: + 实测同视口下原型 token/plan 同行(149==149),实现被拆成两行(149/203)。 */ +.nb { white-space: nowrap; } + /* 小标签 / 图标按钮(原型 .eyebrow / .icon-btn,PR2 起供登录页与侧边栏使用) */ .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; diff --git a/ui/index.html b/ui/index.html index 900712e..96b04b7 100644 --- a/ui/index.html +++ b/ui/index.html @@ -5,7 +5,7 @@ AITokenPool - + @@ -20,7 +20,7 @@