dsh-width-tiers 1.0.7 → 1.0.9

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
@@ -1,45 +1,41 @@
1
- # dsh-width-tiers
1
+ <h1 align="center">dsh-width-tiers</h1>
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
3
+ <p align="center">Chat content-width tiers for the DeepSeek Harness Web GUI.</p>
4
4
 
5
- A client plugin for the **DeepSeek Harness Web GUI** that adds **chat content
6
- width tiers** with a floating picker button (bottom-right, above the
7
- composer): 标准 / 中等 / 宽 / 超宽 / 全宽 / 自定义 (standard / medium / wide /
8
- ultra / full / custom).
5
+ <p align="center">
6
+ <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
+ <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
+ <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>
10
+ </p>
9
11
 
10
- ## Why
11
-
12
- The DSH Web app caps the message column — and every table inside it — at
13
- `--dsh-chat-content-width` (0.1.7–0.2.0 default `clamp(680px, column × 0.64,
14
- 920px)`), no matter how wide your window is, so wide tables always need
15
- horizontal scrolling.
16
-
17
- This plugin sets the width per tier through the app's **native width axis**
18
- (`--dsh-chat-user-width` + the app's `dsh.conversation.contentWidth`
19
- preference), letting the app clamp every value to "column − 176px handle
20
- budget" — so the built-in drag handles keep working:
12
+ ## Tiers
21
13
 
22
14
  | Tier | Content width | Sidebar |
23
- |---|---|---|
24
- | standard 标准 | app default | untouched |
25
- | medium 中等 | 1120px | untouched |
26
- | wide 宽 | 1280px | untouched |
27
- | ultra 超宽 | 1400px | untouched |
28
- | full 全宽 | column minus the handle budget (fills the available width) | collapsed to the icon rail |
29
- | custom 自定义 | your dragged width, re-selectable from the menu | untouched |
30
-
31
- The menu and the button title always show the width a tier resolves to **at
32
- the current column**, so on narrow windows a clamped tier reads its real
33
- value (e.g. `宽 668px`) instead of its nominal one.
34
-
35
- On narrow windows wider tiers are clamped to the available column, so nothing
36
- overflows under the sidebar.
37
-
38
- The choice persists in `localStorage` and is restored on the next visit; the
39
- menu highlights the current tier, and the button's five level-bars show it at
40
- a glance (all lit for custom). Dragging one of the app's native edge handles
41
- switches the picker to the custom tier — the plugin stands aside for native
42
- drags.
15
+ | --- | --- | --- |
16
+ | Standard 标准 | App default: `max(680px, min(column × 0.64, 920px))` | unchanged |
17
+ | Medium 中等 | 1120px | unchanged |
18
+ | Wide 宽 | 1280px | unchanged |
19
+ | Ultra 超宽 | 1400px | unchanged |
20
+ | Full 全宽 | `max(640px, column − 176px)` | collapsed to icon rail |
21
+ | Custom 自定义 | width recorded from a native drag | unchanged |
22
+
23
+ Fixed and custom widths are clamped by the app to
24
+ `max(640px, column − 176px)`; the standard tier follows the app default
25
+ (680–920px). On a narrow window a wider fixed tier therefore behaves like
26
+ `full`.
27
+
28
+ ## Features
29
+
30
+ - Uses the app's native width axis (`--dsh-chat-user-width` and
31
+ `dsh.conversation.contentWidth`), so the built-in drag handles keep working.
32
+ - Persists the selected tier and restores it on the next visit.
33
+ - Follows **Settings → Language** (中文 / English).
34
+ - Menu supports ArrowUp/Down, Home/End, Escape and Tab, with focus restoration.
35
+ - Tier changes sync across tabs.
36
+ - Respects `prefers-reduced-motion`.
37
+ - Never touches the right panel. Only `full` collapses the left sidebar, and
38
+ you can expand it again at any time.
43
39
 
44
40
  ## Install
45
41
 
@@ -47,66 +43,57 @@ drags.
47
43
  dsh plugin --profile web add dsh-width-tiers
48
44
  ```
49
45
 
50
- The bundle patch then inserts the `dsh-width-tiers` loader entry itself — no
51
- manual `cordis.patch.yml` edits needed.
46
+ Restart `dsh web`, then hard-refresh the page. A six-bar picker appears at the
47
+ bottom-right.
52
48
 
53
- Restart `dsh web` (the plugin loads at boot) and hard-refresh the page
54
- (Ctrl+Shift+R). A round button with five bars appears at the bottom-right.
49
+ For a local checkout:
55
50
 
56
- > Installing from a local checkout: `dsh plugin --profile web add file:/path/to/dsh-width-tiers`.
57
- > Local-development gotcha: `file:` dependencies are **copied** into the
58
- > profile's `node_modules` (pnpm does not symlink them). After editing the
59
- > plugin source, re-sync the copy (e.g. `rsync -a --delete --exclude .git
60
- > /path/to/dsh-width-tiers/ ~/.dsh/profiles/web/node_modules/dsh-width-tiers/`)
61
- > or re-install after removing it, then restart `dsh web` and hard-refresh.
51
+ ```bash
52
+ dsh plugin --profile web add link:/path/to/dsh-width-tiers
53
+ ```
62
54
 
63
55
  ## Usage
64
56
 
65
- - Click the round button → pick a tier; the current one is highlighted.
66
- - `full` collapses the sidebar to the icon rail through the app's own toggle
67
- — it is never force-hidden or locked: click a rail icon any time to expand
68
- it, and it stays expanded.
69
- - The right panel (rightbar) is never touched: its track and panel are fully
70
- owned by the app, and the conversation yields space to it on its own.
71
- `standard` leaves the layout entirely to the app.
72
-
73
- ## Language
74
-
75
- All picker copy (tier labels, button `aria-label` and title) follows the
76
- app's **Settings → Language** (中文 / English), through the app's own locale
77
- service. Switching the language re-renders the button and menu immediately;
78
- when no explicit language is chosen the app falls back to the browser's
79
- language, and Chinese is the last resort. No plugin-side setting needed.
57
+ - Click the picker and choose a tier.
58
+ - Picking `Custom` before the first drag opens a guide at the right edge; drag
59
+ a native handle to record a width.
60
+ - Dragging any native handle switches to `Custom`; the plugin steps aside while
61
+ you drag.
62
+ - `Standard` clears the width preference and returns to the app default.
63
+ - `Full` collapses the left sidebar; the icon rail stays available.
80
64
 
81
65
  ## How it works
82
66
 
83
- - The element that defines `--dsh-chat-content-width` is **located at
84
- runtime** (the first element whose computed value is non-empty) and the
85
- tier is applied as an inline override — no hashed class names, so it
86
- survives bundle upgrades.
87
- - Panels are driven through the **layout service** (`ctx.layout`), never by
88
- simulating clicks.
89
- - The sidebar is only ever collapsed by the `full` tier; returning to
90
- `standard` restores it only if this plugin collapsed it.
91
- - Dictionaries are registered with the app's **locale service**
92
- (`ctx.locale.register` / `bind`) and re-rendered through its change
93
- subscription, so the copy always matches the app's active language.
67
+ - Locates the conversation body that declares `--dsh-chat-content-width`
68
+ (prefers `[data-conversation-content]`, skips the right sidebar's embedded
69
+ conversation), then writes `--dsh-chat-user-width` on its parent.
70
+ - Stores the configured target in the app preference; only the inline width is
71
+ clamped to `max(640px, column − 176px)`.
72
+ - Watches the column with `ResizeObserver` so `full` follows sidebar, rightbar
73
+ and window changes.
74
+ - Drives panels through `ctx.layout` and registers copy through `ctx.locale`.
94
75
 
95
- ## Limitations
76
+ ## Compatibility
96
77
 
97
- - Content width cannot exceed the window: on a narrow window, wider tiers are
98
- capped by the available column (the menu shows the capped value). Use
99
- `full` (which also collapses the sidebar) for the maximum.
100
- - Requires the DSH Web client plugin system (dsh ≥ 0.1.0-rc.x with a `web`
101
- profile). Verified on dsh 0.1.7-alpha.1 and 0.2.0-rc.2.
78
+ - DSH Web 0.1.7+ with a `web` profile.
79
+ - Width axis checked against DSH 0.2.1-rc.2: 640px floor, 176px handle budget,
80
+ `--dsh-chat-*` variables, `data-width-handle`, layout/locale services.
102
81
 
103
- ## Uninstall
82
+ ## Development
104
83
 
105
84
  ```bash
106
- dsh plugin --profile web remove dsh-width-tiers
85
+ npm test
107
86
  ```
108
87
 
109
- then restart `dsh web`.
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.
91
+
92
+ ## Notes
93
+
94
+ - Wider fixed tiers are clamped on narrow windows.
95
+ - A custom width dragged on a narrow window is clamped by the app before it is
96
+ recorded.
110
97
 
111
98
  ## License
112
99
 
package/README.zh.md CHANGED
@@ -1,38 +1,38 @@
1
- # dsh-width-tiers(对话区宽度档位)
1
+ <h1 align="center">dsh-width-tiers</h1>
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
3
+ <p align="center">DeepSeek Harness Web GUI 的对话区内容宽度档位插件。</p>
4
4
 
5
- DeepSeek Harness Web GUI 的客户端插件:给对话区加**内容宽度档位选择器**
6
- (右下角圆形按钮,输入框上方),共 6 档:
7
- 标准 / 中等 / 宽 / 超宽 / 全宽 / 自定义。
5
+ <p align="center">
6
+ <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
+ <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
+ <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>
10
+ </p>
8
11
 
9
- ## 为什么需要它
10
-
11
- DSH Web 把消息列——包括里面的所有表格——的宽度限制在
12
- `--dsh-chat-content-width`(0.1.7–0.2.0 默认
13
- `clamp(680px, 列宽 × 0.64, 920px)`),不管窗口多宽都不变,宽表格只能横向滚动。
14
-
15
- 本插件通过应用自身的**原生宽度通道**(`--dsh-chat-user-width` +
16
- `dsh.conversation.contentWidth` 偏好)按档位设定宽度,由应用自身钳制到
17
- 「列宽 − 176px 手柄预留」,因此自带的原生拖拽手柄始终可用:
12
+ ## 档位
18
13
 
19
14
  | 档位 | 内容宽度 | 侧边栏 |
20
- |---|---|---|
21
- | 标准 | 应用默认 | 不动 |
15
+ | --- | --- | --- |
16
+ | 标准 | 应用默认:`max(680px, min(列宽 × 0.64, 920px))` | 不动 |
22
17
  | 中等 | 1120px | 不动 |
23
18
  | 宽 | 1280px | 不动 |
24
19
  | 超宽 | 1400px | 不动 |
25
- | 全宽 | 列宽减手柄预留(占满可用宽度) | 收起为图标轨道 |
26
- | 自定义 | 拖拽原生手柄得出,可在菜单回切 | 不动 |
20
+ | 全宽 | `max(640px, 列宽 − 176px)` | 收起为图标轨道 |
21
+ | 自定义 | 原生拖拽记录的宽度 | 不动 |
27
22
 
28
- 菜单与按钮标题显示的是**当前列宽下实际生效的 px**:窄窗口下被钳制的档位会
29
- 显示真实值(如「宽 668px」),而不是标称值。
23
+ 固定档和自定义宽度会被应用钳制到 `max(640px, 列宽 − 176px)`;标准档
24
+ 使用应用默认的 680–920px。窄窗口下较宽的固定档等同「全宽」。
30
25
 
31
- 窄窗口下超宽档位会自动被钳到可用宽度,不会溢出被侧栏覆盖。
26
+ ## 特性
32
27
 
33
- 选择会记住(localStorage),下次打开自动恢复;菜单里当前档位高亮,按钮上
34
- 的五条横条图标也直观显示当前档位(自定义档全亮)。拖动应用自带的
35
- 对话区边缘手柄会自动切到「自定义」档,插件让位于原生拖拽。
28
+ - 走应用原生宽度通道(`--dsh-chat-user-width` 与
29
+ `dsh.conversation.contentWidth`),自带拖拽手柄始终可用。
30
+ - 记住当前档位,下次打开自动恢复。
31
+ - 跟随 **设置 → 语言**(中文 / English)。
32
+ - 菜单支持方向键、Home/End、Esc、Tab,并恢复焦点。
33
+ - 档位选择跨标签页同步。
34
+ - 支持 `prefers-reduced-motion`。
35
+ - 不碰右侧面板;只有「全宽」会收起左侧栏,随时可以再展开。
36
36
 
37
37
  ## 安装
38
38
 
@@ -40,59 +40,51 @@ DSH Web 把消息列——包括里面的所有表格——的宽度限制在
40
40
  dsh plugin --profile web add dsh-width-tiers
41
41
  ```
42
42
 
43
- bundle patch 会自动插入 `dsh-width-tiers` 加载项——无需手动改
44
- `cordis.patch.yml`。
43
+ 重启 `dsh web` 并硬刷新页面。右下角会出现六条横条的圆形按钮。
45
44
 
46
- **重启 `dsh web`**(插件在启动时加载),再硬刷新页面(Ctrl+Shift+R)。
47
- 右下角会出现五条横条的圆形按钮。
45
+ 本地目录:
48
46
 
49
- > 本地目录安装:`dsh plugin --profile web add file:/path/to/dsh-width-tiers`。
50
- > 本地开发注意:`file:` 依赖会被 **拷贝** 进 profile 的 node_modules(pnpm
51
- > 不会建软链)。改完插件源码后,需要重新同步拷贝(例如 `rsync -a --delete
52
- > --exclude .git /path/to/dsh-width-tiers/
53
- > ~/.dsh/profiles/web/node_modules/dsh-width-tiers/`)或先 remove 再 add,
54
- > 然后重启 `dsh web` 并硬刷新。
47
+ ```bash
48
+ dsh plugin --profile web add link:/path/to/dsh-width-tiers
49
+ ```
55
50
 
56
51
  ## 使用
57
52
 
58
- - 点圆形按钮 → 选择档位,当前档位高亮。
59
- - 「全宽」通过应用自己的收起按钮把侧边栏收成图标轨道——**不会被锁死**:
60
- 随时点轨道图标展开,展开后保持展开。
61
- - 插件**不碰右侧面板**:右栏的轨道与面板完全由应用管理,展开时对话内容
62
- 自适应让位;「标准」档完全交给应用。
63
-
64
- ## 多语言
65
-
66
- 选择器里的所有文案(档位名、按钮的 `aria-label` 和标题)跟随应用的
67
- **设置 → 语言**(中文 / English),通过应用自身的 locale 服务实现。切换
68
- 语言后按钮和菜单会立即重渲染;未显式选择语言时,应用会回退到浏览器语言,
69
- 最后兜底中文。无需插件侧单独设置。
53
+ - 点击圆形按钮选择档位。
54
+ - 首次选择「自定义」会在右侧边缘显示引导;拖动原生手柄记录宽度。
55
+ - 拖动任意原生手柄都会切换到「自定义」;拖拽期间插件让位于应用。
56
+ - 「标准」清除宽度偏好,回到应用默认宽度。
57
+ - 「全宽」收起左侧栏,图标轨道仍可随时展开。
70
58
 
71
59
  ## 原理
72
60
 
73
- - 运行时**自动定位**定义 `--dsh-chat-content-width` 的元素(第一个计算值
74
- 非空的元素),以行内样式覆盖——**不依赖哈希类名**,dsh 升级后依旧有效。
75
- - 面板操作走 **layout 服务**(`ctx.layout`),从不模拟点击。
76
- - 侧边栏只被「全宽」档收起;回到「标准」时,只有本插件自己收起的侧边栏
77
- 才会被恢复展开(你手动收的不动)。
78
- - 字典注册到应用的 **locale 服务**(`ctx.locale.register` / `bind`),并
79
- 订阅其变更事件重渲染,文案始终与应用的当前语言一致。
61
+ - 定位声明 `--dsh-chat-content-width` 的对话 body(优先
62
+ `[data-conversation-content]`,跳过右侧栏的 embedded 对话),在它的
63
+ 父级写入 `--dsh-chat-user-width`。
64
+ - 应用偏好保存设定值,只有行内宽度按 `max(640px, 列宽 − 176px)` 钳制。
65
+ - 用 `ResizeObserver` 观察列宽,让「全宽」跟随左右栏与窗口变化。
66
+ - 面板操作走 `ctx.layout`,文案注册走 `ctx.locale`。
80
67
 
81
- ## 已知限制
68
+ ## 兼容性
82
69
 
83
- - 内容宽度不可能超过窗口:窗口窄时,高档位会被可用列宽截断(菜单会显示
84
- 截断后的实际值);想要最大空间请用「全宽」(同时收起侧边栏)。
85
- - 依赖 DSH Web 客户端插件体系(带 web profile 的 dsh ≥ 0.1.0-rc.x)。
86
- 已在 dsh 0.1.7-alpha.1 与 0.2.0-rc.2 上验证。
70
+ - DSH Web 0.1.7+,带 `web` profile。
71
+ - 宽度轴已按 DSH 0.2.1-rc.2 对照:640px 下限、176px 手柄预留、
72
+ `--dsh-chat-*` 变量、`data-width-handle`、layout/locale 服务。
87
73
 
88
- ## 卸载
74
+ ## 开发
89
75
 
90
76
  ```bash
91
- dsh plugin --profile web remove dsh-width-tiers
77
+ npm test
92
78
  ```
93
79
 
94
- 然后重启 `dsh web`。
80
+ 测试通过 DOM stub 加载已发布的 `lib/client.js`,不需要启动真实 DSH。包内
81
+ 直接发布预构建的 `lib/`,不包含 `src/`。
82
+
83
+ ## 注意
84
+
85
+ - 窄窗口下较宽的固定档位会被应用钳制。
86
+ - 窄窗口下拖出的自定义宽度会先被应用钳制,再被记录。
95
87
 
96
88
  ## 许可证
97
89
 
98
- MIT —— 见 [LICENSE](LICENSE)。Copyright (c) 2026 aaronlei。
90
+ MIT — 见 [LICENSE](LICENSE)。Copyright (c) 2026 aaronlei。