Merge pull request #1372 from deepseek-harness/style/cjk-latin-autospace

Add global CJK/Latin auto-spacing via text-autospace
This commit is contained in:
Wenlu Wang
2026-08-27 17:37:08 +08:00
committed by GitHub
5 changed files with 36 additions and 2 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/web/README.md
README.md: c83cc02fb776a233b8891d05ebd72a06b6223c8d
README.zh.md: 1dd46325017169a1663387870f057fb8ddfbe8d1
README.md: c505698413b29aebe5c91d05311305c36bd7949a
README.zh.md: 176679338c0e824afe917b834293ceea0fb392a3
+2
View File
@@ -27,6 +27,8 @@ English | [中文](README.zh.md)
Use it when you assemble the browser application: `apps/web`'s Vite entry runs `new AppWebEntry(container).run()` against the mount point, and the boot page carries the user through activation. Ordinary browser callers pass no options. A pre-injected page transport is the default ahead of the `seams` override: when `globalThis.__DSH_TRANSPORT__` carries `loadBundle`, the module stage adopts it as the bundle transport and skips the immediate-tier HTTP prefetch, while explicit `seams` still win (for example jsdom tests, where external `<script>` execution cannot reach the page context).
The shell base styles apply automatic CJK/Latin spacing to ordinary content in supporting browsers. Semantic code and terminal, diff, read, and search output containers retain literal source spacing and column alignment; browsers without `text-autospace` support ignore both declarations.
### What boot looks like
Boot runs in two stages: the module stage adopts the parser-loaded bootstrap batch, builds the module system from the Host-provided boot graph, and prefetches the `immediately` tier through the shared application-batch URL, which executes once. The plugin stage then activates every graph entry and waits for all of them before handing the marked boot DOM to the UI renderer, which hydrates it and switches to the complete UI.
+2
View File
@@ -27,6 +27,8 @@ kind: "package-library"
组装浏览器应用时使用它:`apps/web` 的 Vite 入口对挂载点运行 `new AppWebEntry(container).run()`,启动页承载用户度过激活过程。普通浏览器调用方不传任何选项。预注入的页面传输是 `seams` 覆盖之前的默认:当 `globalThis.__DSH_TRANSPORT__` 携带 `loadBundle` 时,模块阶段将其采纳为 bundle 传输并跳过 `immediately` 层级的 HTTP 预取,而显式 `seams` 仍然优先(例如外部 `<script>` 执行无法到达页面上下文的 jsdom 测试)。
外壳基础样式会在支持的浏览器中为普通内容自动添加中西文间距。语义化代码以及终端、diff、读取和搜索输出容器会保留源码中的原始间距和列对齐;不支持 `text-autospace` 的浏览器会忽略这两项声明。
### 启动过程是怎样的
启动分两个阶段:模块阶段接纳 parser 已加载的 bootstrap 批次,从 Host 提供的启动图构建模块系统,并通过只执行一次的共享 application 批次 URL 预取 `immediately` 层级。插件阶段随后激活每个图 entry 并等待全部就绪,之后才把带标记的启动 DOM 交给 UI 渲染器,由它 hydrate 并切换到完整 UI。
+12
View File
@@ -28,6 +28,18 @@ body {
-moz-osx-font-smoothing: grayscale;
color: var(--dsw-alias-label-primary, #0f1115);
background: var(--dsw-alias-bg-base, #fff);
/* Supporting browsers insert CJK/Latin spacing in inherited prose. */
text-autospace: normal;
}
code,
pre,
[data-diff],
[data-read],
[data-search],
[data-terminal] {
/* Literal payloads retain source spacing and column alignment. */
text-autospace: no-autospace;
}
/* Form controls don't inherit the body font (UA sheets pin their families —
@@ -17,10 +17,28 @@ function importOrder(css: string): string[] {
}
const imports = importOrder(baseCss)
const normalizedCss = baseCss
.replaceAll(/\/\*[\s\S]*?\*\//g, '')
.replaceAll(/\s+/g, ' ')
const literalContentSelectors = [
'code',
'pre',
'[data-diff]',
'[data-read]',
'[data-search]',
'[data-terminal]',
]
describe('web shell base.css', () => {
it('leaves theme styles to the dynamic ui-theme client entry', () => {
expect(imports).toEqual([])
expect(baseCss).not.toContain(THEME_PACKAGE)
})
it('auto-spaces prose while preserving literal content', () => {
expect(baseCss).toMatch(/body\s*\{[^}]*text-autospace:\s*normal;/)
expect(normalizedCss).toContain(
`${literalContentSelectors.join(', ')} { text-autospace: no-autospace; }`,
)
})
})