fix(tasks): 小条的状态词与活动行统一字体(修掉 1px 基线错位)

用户反馈「运行中和正在分析请求没对齐」。实测是字体度量差异,不是布局:
两者行盒完全一致(11px/14px、align-items: center 下同一位置),但 11px 下
sans 字族的 fontBoundingBox ascent/descent 是 11/2,mono 字族是 10/3 ——
基线低 1px。中文在 mono 栈里本来就走同一个 CJK 回退(PingFang SC),
mono 只改到句中的拉丁片段,等于半句等宽 + 整体低一像素。

修法:.barActivity 不再声明 font-family,两段文字共用小条自己的字族;
机器文本的等宽语气保留在 meta 行 / 后台任务行 / 终端输出井。
theme.spec 新增守护(.barActivity 不得声明 font-family)。

真机证据:真实运行中卡片的小条(3× DPR 截图 17-bar-real.png)两段同处一行,
两个 span 的 font-family 计算值完全相同;此前同一小条 3× 截图里蓝字明显偏低。

验证:typecheck / lint ✅;pnpm test 1257 passed / 9 skipped(新增 1 例)。

(cherry picked from commit 6816af76828a436eaf201205e385c1aa4f77dcd5)
This commit is contained in:
Menghuan1918
2026-09-27 22:18:57 +08:00
parent 7cce50c493
commit 421fd3fde7
3 changed files with 35 additions and 2 deletions
+12
View File
@@ -181,6 +181,18 @@ describe('skin contract: the plugin owns no color of its own', () => {
expect(frames).toContain('transform: translateX(100%)')
})
it('the running bar keeps its state word and activity on ONE font stack', () => {
// Reader report: 运行中 and 正在分析请求 sat at different heights. The
// cause is metric, not layout — at 11px the sans stack is ascent/descent
// 11/2 against the mono stack's 10/3, so a mono activity line rests 1px
// lower. Both texts must therefore inherit the bar's own font.
const styles = readFileSync(resolve(ROOT, 'src/client/tasks-graph.module.css'), 'utf8')
const block = /\.barActivity \{([\s\S]*?)\n\}/.exec(styles)?.[1]
if (block === undefined) throw new Error('the .barActivity rule must exist')
expect(block).not.toContain('font-family')
expect(block).not.toContain('--ds-font-family-code')
})
it('the empty-pane welcome capsule follows the host guide recipe', () => {
// The card is the same surface as DSH's own guide capsule ("pick what
// opens here"), so this pins the shared geometry and the token-only