dsh-width-tiers 1.0.9 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,11 +2,16 @@
2
2
 
3
3
  <p align="center">Chat content-width tiers for the DeepSeek Harness Web GUI.</p>
4
4
 
5
+ <p align="center">
6
+ <a href="README.md">English</a> | <a href="README.zh.md">中文</a>
7
+ </p>
8
+
5
9
  <p align="center">
6
10
  <a href="https://www.npmjs.com/package/dsh-width-tiers"><img alt="npm" src="https://img.shields.io/npm/v/dsh-width-tiers?style=flat-square"></a>
7
11
  <a href="https://github.com/aaronlei/dsh-width-tiers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/aaronlei/dsh-width-tiers?style=flat-square"></a>
8
12
  <a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/license-MIT-yellow?style=flat-square"></a>
9
- <a href="#compatibility"><img alt="DSH 0.1.7+" src="https://img.shields.io/badge/DSH-0.1.7%2B-blue?style=flat-square"></a>
13
+ <a href="https://www.npmjs.com/package/dsh-width-tiers"><img alt="Node version" src="https://img.shields.io/node/v/dsh-width-tiers?style=flat-square"></a>
14
+ <a href="#compatibility"><img alt="DSH 0.2.x" src="https://img.shields.io/badge/DSH-0.2.x-blue?style=flat-square"></a>
10
15
  </p>
11
16
 
12
17
  ## Tiers
@@ -30,7 +35,7 @@ Fixed and custom widths are clamped by the app to
30
35
  - Uses the app's native width axis (`--dsh-chat-user-width` and
31
36
  `dsh.conversation.contentWidth`), so the built-in drag handles keep working.
32
37
  - Persists the selected tier and restores it on the next visit.
33
- - Follows **Settings → Language** (中文 / English).
38
+ - Follows **Settings → Language** (中文 / English / 日本語 / Español / Français / Deutsch / Русский / Português).
34
39
  - Menu supports ArrowUp/Down, Home/End, Escape and Tab, with focus restoration.
35
40
  - Tier changes sync across tabs.
36
41
  - Respects `prefers-reduced-motion`.
@@ -64,6 +69,11 @@ dsh plugin --profile web add link:/path/to/dsh-width-tiers
64
69
 
65
70
  ## How it works
66
71
 
72
+ - Mounts the picker into the frame-wide `shell.overlay` slot; the plugin fiber
73
+ owns the controller lifetime, so no listeners or timers outlive it.
74
+ - The controller publishes an immutable snapshot (tier, menu, guide); the React
75
+ picker renders it and dispatches actions, so the view can remount without
76
+ rebuilding observers.
67
77
  - Locates the conversation body that declares `--dsh-chat-content-width`
68
78
  (prefers `[data-conversation-content]`, skips the right sidebar's embedded
69
79
  conversation), then writes `--dsh-chat-user-width` on its parent.
@@ -75,19 +85,26 @@ dsh plugin --profile web add link:/path/to/dsh-width-tiers
75
85
 
76
86
  ## Compatibility
77
87
 
78
- - DSH Web 0.1.7+ with a `web` profile.
88
+ - DSH Web 0.2.x with a `web` profile (`shell.overlay` slot and `slots` service).
79
89
  - Width axis checked against DSH 0.2.1-rc.2: 640px floor, 176px handle budget,
80
90
  `--dsh-chat-*` variables, `data-width-handle`, layout/locale services.
81
91
 
82
92
  ## Development
83
93
 
84
94
  ```bash
85
- npm test
95
+ pnpm install
96
+ pnpm build # src/ -> lib/ (host entry + loader-wrapped client bundle)
97
+ pnpm typecheck
98
+ pnpm test # vitest: controller (jsdom) + picker component suites
99
+ pnpm verify:client
86
100
  ```
87
101
 
88
- The test loads the shipped `lib/client.js` bundle through a DOM stub; no live
89
- DSH instance is required. The package ships prebuilt `lib/` and does not
90
- include a `src/` tree.
102
+ The sources live in `src/` (`src/index.ts` is the no-op host entry, the
103
+ feature lives in `src/client/`); `lib/` is the built, published payload. The
104
+ vitest suites import the sources directly: the controller runs under jsdom and
105
+ the picker is rendered with Testing Library, so no live DSH instance is
106
+ required. `verify:client` checks the built bundle contract. Development needs
107
+ Node 22+ and pnpm.
91
108
 
92
109
  ## Notes
93
110
 
package/README.zh.md CHANGED
@@ -2,11 +2,16 @@
2
2
 
3
3
  <p align="center">DeepSeek Harness Web GUI 的对话区内容宽度档位插件。</p>
4
4
 
5
+ <p align="center">
6
+ <a href="README.md">English</a> | <a href="README.zh.md">中文</a>
7
+ </p>
8
+
5
9
  <p align="center">
6
10
  <a href="https://www.npmjs.com/package/dsh-width-tiers"><img alt="npm" src="https://img.shields.io/npm/v/dsh-width-tiers?style=flat-square"></a>
7
11
  <a href="https://github.com/aaronlei/dsh-width-tiers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/aaronlei/dsh-width-tiers?style=flat-square"></a>
8
12
  <a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/license-MIT-yellow?style=flat-square"></a>
9
- <a href="#兼容性"><img alt="DSH 0.1.7+" src="https://img.shields.io/badge/DSH-0.1.7%2B-blue?style=flat-square"></a>
13
+ <a href="https://www.npmjs.com/package/dsh-width-tiers"><img alt="Node version" src="https://img.shields.io/node/v/dsh-width-tiers?style=flat-square"></a>
14
+ <a href="#兼容性"><img alt="DSH 0.2.x" src="https://img.shields.io/badge/DSH-0.2.x-blue?style=flat-square"></a>
10
15
  </p>
11
16
 
12
17
  ## 档位
@@ -28,7 +33,7 @@
28
33
  - 走应用原生宽度通道(`--dsh-chat-user-width` 与
29
34
  `dsh.conversation.contentWidth`),自带拖拽手柄始终可用。
30
35
  - 记住当前档位,下次打开自动恢复。
31
- - 跟随 **设置 → 语言**(中文 / English)。
36
+ - 跟随 **设置 → 语言**(中文 / English / 日本語 / Español / Français / Deutsch / Русский / Português)。
32
37
  - 菜单支持方向键、Home/End、Esc、Tab,并恢复焦点。
33
38
  - 档位选择跨标签页同步。
34
39
  - 支持 `prefers-reduced-motion`。
@@ -58,6 +63,10 @@ dsh plugin --profile web add link:/path/to/dsh-width-tiers
58
63
 
59
64
  ## 原理
60
65
 
66
+ - 挂载到 frame 级 `shell.overlay` 插槽,由插件 fiber 持有 controller 生命周期;
67
+ 插件卸载后不残留监听器或定时器。
68
+ - controller 发布不可变快照(档位、菜单、引导),React picker 只负责渲染并
69
+ 派发动作;视图重挂载不需要重建观察者。
61
70
  - 定位声明 `--dsh-chat-content-width` 的对话 body(优先
62
71
  `[data-conversation-content]`,跳过右侧栏的 embedded 对话),在它的
63
72
  父级写入 `--dsh-chat-user-width`。
@@ -67,18 +76,24 @@ dsh plugin --profile web add link:/path/to/dsh-width-tiers
67
76
 
68
77
  ## 兼容性
69
78
 
70
- - DSH Web 0.1.7+,带 `web` profile。
79
+ - DSH Web 0.2.x,带 `web` profile(`shell.overlay` 插槽与 `slots` 服务)。
71
80
  - 宽度轴已按 DSH 0.2.1-rc.2 对照:640px 下限、176px 手柄预留、
72
81
  `--dsh-chat-*` 变量、`data-width-handle`、layout/locale 服务。
73
82
 
74
83
  ## 开发
75
84
 
76
85
  ```bash
77
- npm test
86
+ pnpm install
87
+ pnpm build # src/ -> lib/(宿主入口 + loader 包装的客户端 bundle)
88
+ pnpm typecheck
89
+ pnpm test # vitest:controller(jsdom)+ picker 组件测试
90
+ pnpm verify:client
78
91
  ```
79
92
 
80
- 测试通过 DOM stub 加载已发布的 `lib/client.js`,不需要启动真实 DSH。包内
81
- 直接发布预构建的 `lib/`,不包含 `src/`。
93
+ 源码在 `src/`(`src/index.ts` 是无副作用的宿主入口,功能在
94
+ `src/client/`),`lib/` 是构建后的发布内容。vitest 直接测试源码:
95
+ controller 跑在 jsdom 下,picker 用 Testing Library 渲染,不需要启动真实
96
+ DSH。`verify:client` 校验构建产物的 loader 契约。开发需要 Node 22+ 与 pnpm。
82
97
 
83
98
  ## 注意
84
99