diff --git a/apps/web/tests/markdown-cjk-strong.e2e.ts b/apps/web/tests/markdown-cjk-strong.e2e.ts index 4d9594d771..3da0d0df9b 100644 --- a/apps/web/tests/markdown-cjk-strong.e2e.ts +++ b/apps/web/tests/markdown-cjk-strong.e2e.ts @@ -125,6 +125,36 @@ describe('web e2e: CJK-adjacent Markdown strong emphasis', () => { expect(await page.getByText(paragraph, { exact: true }).count()).toBe(1) } + const viewport = page.viewportSize()! + try { + for (const size of [{ width: 390, height: 844 }, { width: 951, height: 669 }, { width: 669, height: 951 }]) { + await page.setViewportSize(size) + expect(await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('-webkit-text-size-adjust'))) + .toBe('100%') + expect(await strong.evaluateAll(elements => elements.map(element => getComputedStyle(element).fontSize))) + .toEqual(CASES.map(() => '14px')) + } + const restoreFont = await page.evaluateHandle(() => { + const style = document.body.style + const before = style.getPropertyValue('--dsh-content-font-size') + const priority = style.getPropertyPriority('--dsh-content-font-size') + style.setProperty('--dsh-content-font-size', '18px') + return () => { + if (before) style.setProperty('--dsh-content-font-size', before, priority) + else style.removeProperty('--dsh-content-font-size') + } + }) + try { + expect(await strong.evaluateAll(elements => elements.map(element => getComputedStyle(element).fontSize))) + .toEqual(CASES.map(() => '18px')) + } finally { + await restoreFont.evaluate((restore) => { restore() }) + await restoreFont.dispose() + } + } finally { + await page.setViewportSize(viewport) + } + const snapshot = (await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd)) .split(SEED_ID).join('{{seededId}}') await compareOrRefreshGolden(UI_EXPECTED, snapshot, MODE) diff --git a/packages/client/web/README.i18n.yaml b/packages/client/web/README.i18n.yaml index 6667e00fa7..082c0ab024 100644 --- a/packages/client/web/README.i18n.yaml +++ b/packages/client/web/README.i18n.yaml @@ -15,8 +15,8 @@ en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-web/use-this-package: - en: 3105391bad2e9f06 - zh: fe0c5af5db6c241c + en: 01c1354d946e456e + zh: 33c672b64e9e33fb /deepseek-ai-dsh-client-web/use-this-package/what-boot-looks-like: en: f3b01aa878764e5c zh: f02eab65d441bfe0 diff --git a/packages/client/web/README.md b/packages/client/web/README.md index 8aaabbf2cf..e42719dcac 100644 --- a/packages/client/web/README.md +++ b/packages/client/web/README.md @@ -29,7 +29,7 @@ Use it when you assemble the browser application: `apps/web`'s Vite entry runs ` Static application pages install `__DSH_BOOT_READY__` before the entry runs. The boot page renders immediately while `run()` waits; the page owner applies the Host rows with `applyIndexInjections` (also exported from `./injections`) and resolves the deferred after all scripts finish. A rejected deferred renders a boot failure unless the caller supplies `run(onFailure)` to present the error externally while retaining the loading page. Desktop uses this callback to request native recovery. Desktop and WebWorker share the injection interpreter; server-side `tapIndex` HTML transforms apply only to served documents. -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. +The shell base styles preserve authored text sizes when mobile browsers rotate or unfold. Browser zoom and the appearance font-size setting remain available. They also 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. Web and Desktop mathematical rendering requires WOFF2 support. The [Web build](../../../apps/web/katex-fonts.ts) retains every KaTeX font face in WOFF2 and omits WOFF/TTF fallbacks; a face without WOFF2 rejects the build. Font glyphs, weights, styles, and layout rules are preserved. diff --git a/packages/client/web/README.zh.md b/packages/client/web/README.zh.md index 0b94a8e60a..8fed19ba82 100644 --- a/packages/client/web/README.zh.md +++ b/packages/client/web/README.zh.md @@ -29,7 +29,7 @@ kind: "package-library" 静态应用页面在入口运行前安装 `__DSH_BOOT_READY__`。`run()` 等待期间会立即显示启动页;页面所有者通过 `applyIndexInjections`(也从 `./injections` 导出)应用 Host 注入项,并在所有脚本完成后兑现延迟对象。延迟对象拒绝时显示启动失败;若调用方提供 `run(onFailure)`,则由外部呈现错误并保留加载页。Desktop 使用该回调请求原生恢复。Desktop 与 WebWorker 共享注入解释器;服务端 `tapIndex` HTML 转换仅适用于服务端提供的文档。 -外壳基础样式会在支持的浏览器中为普通内容自动添加中西文间距。语义化代码以及终端、diff、读取和搜索输出容器会保留源码中的原始间距和列对齐;不支持 `text-autospace` 的浏览器会忽略这两项声明。 +外壳基础样式会在移动浏览器旋转或展开屏幕时保持页面设定的字号,浏览器缩放和外观字号设置仍可使用。它还会在支持的浏览器中为普通内容自动添加中西文间距。语义化代码以及终端、diff、读取和搜索输出容器会保留源码中的原始间距和列对齐;不支持 `text-autospace` 的浏览器会忽略这两项声明。 Web 和 Desktop 的数学公式渲染要求支持 WOFF2。[Web 构建](../../../apps/web/katex-fonts.ts)以 WOFF2 保留全部 KaTeX 字体样式,并排除 WOFF/TTF 后备格式;任一字体样式缺少 WOFF2 都会使构建失败。字体的字形、字重、样式和布局规则保持不变。 diff --git a/packages/client/web/src/base.css b/packages/client/web/src/base.css index c2de24767c..57e47357f1 100644 --- a/packages/client/web/src/base.css +++ b/packages/client/web/src/base.css @@ -8,6 +8,12 @@ body, margin: 0; } +/* Preserve authored text sizes when mobile browsers rotate or unfold. */ +html { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; +} + body { font-family: var( --dsw-font-family,