dsh-ui-alt 0.0.0-stage → 0.2.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AomiRaku
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # dsh-ui-alt
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进,让界面更专业、冷静、易读。同时把「新会话」「导航折叠」这些常用控件收进更顺手的位置。
4
+
5
+ 插件由 CSS 覆盖加少量 DOM 注入组成,所有改动都可以在 设置 →「UI 改进」里逐项开关;关掉开关即恢复原版外观。
6
+
7
+ ## 功能
8
+
9
+ | 开关 | 默认 | 效果 |
10
+ | --- | --- | --- |
11
+ | Windows 默认字体微软雅黑 | 开 | 设置里未指定正文字体时,Windows 用微软雅黑;已指定则用户的字体优先,macOS 不受影响 |
12
+ | 紧凑圆角与密度 | 开 | 缩小全局圆角阶梯、收紧间距、减弱阴影,发送按钮由圆形改为小圆角方形 |
13
+ | 统一新会话按钮 | 开 | 「新会话」变成导航行的一员,只保留半透明高亮;折叠窄栏时仍用原按钮 |
14
+ | 折叠侧栏导航 | 开 | 只显示前两项导航,点列表下方的箭头展开/收起,状态会记住 |
15
+ | 弱化工作区名称 | 开 | 工作区名称用更弱的文字色,「展开其余 N 个会话」进一步淡化 |
16
+ | 隐藏左上角 Logo | 关 | 隐藏侧栏顶部的品牌标记,下方内容自动补位 |
17
+ | 工作区标题与会话小一号 | 开 | 标题 13px、会话行 30px、项目行 32px,左下账户区一并压矮 |
18
+ | 会话前圆点 | 开 | 会话行前显示一个淡化的 4px 小圆点;与收藏星标同位置时自动让位 |
19
+
20
+ 另有一些不挂开关的固定样式:设置面板全屏并带左上角返回按钮、设置导航列宽 220px、归档会话标题画删除线、选择题选中项的序号反色高亮、浅色主题下选中会话背景加强、工作区行悬停时保持文件夹图标。
21
+
22
+ ## 安装
23
+
24
+ 在 DeepSeek Harness 里用插件管理器安装本仓库目录:
25
+
26
+ ```text
27
+ plugin_manager install_bundle target=<本仓库绝对路径>
28
+ ```
29
+
30
+ 安装后刷新 Web 页面,设置里会出现「UI 改进」一栏,侧栏设置导航同时出现对应图标。
31
+
32
+ 插件以 `link` 方式登记到 profile,因此本仓库目录需要保留在原位;移动或删除目录前请先卸载。
33
+
34
+ ## 设置项与持久化
35
+
36
+ 开关状态存放在 `localStorage` 的 `dsh-ui-alt:prefs:v1` 键下,写成 `html[data-dcc-*]` 属性驱动样式:
37
+
38
+ | 属性 | 取值 |
39
+ | --- | --- |
40
+ | `data-dcc-radius` | `on` / `off` |
41
+ | `data-dcc-new` | `on` / `off` |
42
+ | `data-dcc-nav` | `collapsed` / `expanded` |
43
+ | `data-dcc-dim` | `on` / `off` |
44
+ | `data-dcc-logo` | `hidden` / `shown` |
45
+ | `data-dcc-ws` | `on` / `off` |
46
+ | `data-dcc-dot` | `on` / `off` |
47
+ | `data-dcc-font` | `on` / `off` |
48
+
49
+ ## 目录结构
50
+
51
+ ```text
52
+ dsh-ui-alt/
53
+ ├── package.json ← 名称/版本/exports/files/dsh 清单
54
+ ├── cordis.patch.yml ← 插入行:id/name = dsh-ui-alt
55
+ ├── index.js ← Host 半(空 apply,无 Host 逻辑)
56
+ ├── client.js ← 全部功能:CSS 覆盖 + 少量 DOM 注入
57
+ ├── locale/
58
+ │ ├── zh.json ← 插件管理器标题/描述
59
+ │ └── en.json
60
+ └── icon.svg ← 设置页导航图标 + 插件图标
61
+ ```
62
+
63
+ `client.js` 内部:
64
+
65
+ - 预置数据:`STORAGE_KEY`、`DEFAULTS`、`readPrefs()` / `applyPrefs()` / `savePrefs()`。
66
+ - 一大段 `css` 字符串,全部按 `html[data-dcc-*]` 条件生效;设置页自身样式用 `.dcc-*` 前缀。
67
+ - 三个 DOM 注入函数,各带一个监听 `body` 的 `MutationObserver`(350–400ms 防抖)兜底宿主重渲染:
68
+ - `installNewSessionRow()`:克隆宿主的「新会话」按钮成导航行,点击转发给原按钮。
69
+ - `installNavToggle()`:导航下方插入展开/收起箭头,点击切换 `data-dcc-nav` 并写回偏好。
70
+ - `installSettingsBackButton()`:设置面板左上角插入返回按钮,点击触发原关闭按钮。
71
+ - 设置页组件:`Section`(标题 + 说明 + 开关行)、`Switch`、`Row`、`SectionIcon`。
72
+
73
+ ## 开发
74
+
75
+ ```bash
76
+ node --check client.js
77
+ node --check index.js
78
+ node -e "JSON.parse(require('fs').readFileSync('package.json','utf8'))"
79
+ ```
80
+
81
+ 修改 `client.js` 后需要重新安装插件并刷新页面,新代码才会被加载:
82
+
83
+ ```text
84
+ plugin_manager remove_bundle target=dsh-ui-alt
85
+ plugin_manager install_bundle target=<本仓库绝对路径>
86
+ ```
87
+
88
+ ## 依赖的宿主实现
89
+
90
+ 下面这些宿主细节升级后可能失效,失效时表现为对应的那一条样式不再生效,不会报错:
91
+
92
+ - CSS module 类名后缀:`_sessionRow`、`_projectRow`、`_title`、`_dialog_`、`_menu_`、`_navCell`、`_navTitle`、`_close`、`_optionRow` 等。
93
+ - 设置面板 DOM:`_overlay` / `_panel` / `_navTitle` / `_navList` / `_navCell` / `_header` / `_close`。
94
+ - Windows 变量:`--dsh-windows-titlebar-height`、`--dsh-windows-content-radius`。
95
+ - 主题 token:`--dsw-alias-*`、`--dsw-radius-*`、`--dsw-corner-shape`。
96
+ - 第三方兼容:仅当安装了 `@michengai/dsh-archive-manager` 时,`dsham_starSlot` / `dsham_rowStar` 规则才命中,用于圆点与收藏星标的避让。
97
+
98
+ ## 已知限制
99
+
100
+ - 克隆出来的新会话行没有原按钮的 Tooltip 与快捷键提示(点击行为已转发,功能正常)。
101
+ - 设置返回按钮依赖宿主的 `_navTitle` / `_close` 类名。
102
+ - 「统一新会话按钮」关闭时,折叠导航的首位是隐藏的克隆行,计数偏移一项;显示效果正常。
103
+ - 滚动时鼠标划过会话行会触发宿主的 HoverCard 预览,可能造成卡顿;这是宿主行为,插件侧没有干预。
104
+
105
+ ## License
106
+
107
+ [MIT](./LICENSE)
package/client.js ADDED
@@ -0,0 +1,835 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-ui-alt',
3
+ factory(require) {
4
+ const React = require('react');
5
+ const h = React.createElement;
6
+
7
+ const STORAGE_KEY = 'dsh-ui-alt:prefs:v1';
8
+ const DEFAULTS = {
9
+ radiusDensity: true,
10
+ invertNewSession: true,
11
+ collapseNav: true,
12
+ dimSessions: true,
13
+ hideLogo: false,
14
+ workspaceSmall: true,
15
+ winFont: true,
16
+ sessionDot: true,
17
+ };
18
+
19
+ const isZh = () => {
20
+ const lang = (document.documentElement.getAttribute('lang') || navigator.language || '').toLowerCase();
21
+ return lang.startsWith('zh');
22
+ };
23
+
24
+ function readPrefs() {
25
+ try {
26
+ const raw = localStorage.getItem(STORAGE_KEY);
27
+ return raw === null ? { ...DEFAULTS } : { ...DEFAULTS, ...JSON.parse(raw) };
28
+ } catch {
29
+ return { ...DEFAULTS };
30
+ }
31
+ }
32
+
33
+ function applyPrefs(prefs) {
34
+ const root = document.documentElement;
35
+ root.dataset.dccRadius = prefs.radiusDensity ? 'on' : 'off';
36
+ root.dataset.dccNew = prefs.invertNewSession ? 'on' : 'off';
37
+ root.dataset.dccNav = prefs.collapseNav ? 'collapsed' : 'expanded';
38
+ root.dataset.dccDim = prefs.dimSessions ? 'on' : 'off';
39
+ root.dataset.dccLogo = prefs.hideLogo ? 'hidden' : 'shown';
40
+ root.dataset.dccWs = prefs.workspaceSmall ? 'on' : 'off';
41
+ root.dataset.dccDot = prefs.sessionDot ? 'on' : 'off';
42
+ root.dataset.dccFont = prefs.winFont ? 'on' : 'off';
43
+ }
44
+
45
+ function savePrefs(prefs) {
46
+ try {
47
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(prefs));
48
+ } catch {
49
+ /* 存储不可用时只影响下次启动的持久化 */
50
+ }
51
+ applyPrefs(prefs);
52
+ }
53
+
54
+ const css = `
55
+ /* ============================================================
56
+ dsh-ui-alt
57
+ 圆角收紧 + 紧凑 + 冷静,以及侧栏/新会话等针对性调整。
58
+ 所有效果由 html[data-dcc-*] 开关控制,设置页可逐项切换。
59
+ ============================================================ */
60
+
61
+ /* ---------- Windows 默认正文字体 ---------- */
62
+ /* 只对 Windows 生效:宿主把 platform 写在 <html data-platform>,macOS 是 darwin。
63
+ 宿主把用户设置的字体写在这里同一个变量上,但写在 body 的内联样式里,
64
+ 内联优先级更高,所以下面故意不加 !important:
65
+ - 设置里没填字体 → 本规则生效,Windows 用微软雅黑;
66
+ - 设置里填了字体 → body 内联值赢,用户的字体原样生效。 */
67
+ html[data-dcc-font="on"][data-platform="win32"] body,
68
+ html[data-dcc-font="on"][data-platform="windows"] body,
69
+ html[data-dcc-font="on"][data-windows-titlebar] body {
70
+ --dsh-font-family-text: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
71
+ }
72
+
73
+ /* ---------- 设置页(始终可用) ---------- */
74
+ .dcc-page { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 760px; }
75
+ .dcc-title { margin: 0; padding: 0 2px; font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }
76
+ .dcc-intro { margin: 0; padding: 0 2px; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
77
+ .dcc-group { display: flex; flex-direction: column; padding: 6px 20px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-1); }
78
+ .dcc-group-title { padding: 14px 2px 4px; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--dsw-alias-label-primary); }
79
+ .dcc-row { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border-top: 1px solid var(--dsw-alias-border-l1); }
80
+ .dcc-group-title + .dcc-row { border-top: none; }
81
+ .dcc-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
82
+ .dcc-row-title { font-size: 14px; line-height: 20px; color: var(--dsw-alias-label-primary); }
83
+ .dcc-row-desc { font-size: 12px; line-height: 17px; color: var(--dsw-alias-label-secondary); }
84
+ .dcc-switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; cursor: pointer; }
85
+ .dcc-input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
86
+ .dcc-track { position: absolute; inset: 0; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); transition: background .15s, border-color .15s; }
87
+ .dcc-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--dsw-alias-label-secondary); transition: transform .15s, background .15s; }
88
+ .dcc-input:checked + .dcc-track { border-color: transparent; background: var(--dsw-alias-label-primary); }
89
+ .dcc-input:checked + .dcc-track .dcc-thumb { transform: translateX(16px); background: var(--dsw-alias-label-primary-foreground); }
90
+ .dcc-input:focus-visible + .dcc-track { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
91
+
92
+ /* ---------- 圆角与密度 ---------- */
93
+ html[data-dcc-radius="on"] {
94
+ --dsw-radius-xs: 2px !important;
95
+ --dsw-radius-sm: 4px !important;
96
+ --dsw-radius-md: 6px !important;
97
+ --dsw-radius-lg: 8px !important;
98
+ --dsw-radius-xl: 10px !important;
99
+ --dsw-radius-panel: 12px !important;
100
+ --dsw-corner-shape: round !important;
101
+ }
102
+ html[data-dcc-radius="on"] [class$="_dialog"],
103
+ html[data-dcc-radius="on"] [class$="_menu"],
104
+ html[data-dcc-radius="on"] [class$="_card"],
105
+ html[data-dcc-radius="on"] [class$="_panel"],
106
+ html[data-dcc-radius="on"] [class$="_popover"],
107
+ html[data-dcc-radius="on"] [class$="_modal"],
108
+ /* 内置组件的 CSS module 类名是 _dialog_hash_n 这种三段式,上面按后缀匹配不到 */
109
+ html[data-dcc-radius="on"] [class*="_dialog_"],
110
+ html[data-dcc-radius="on"] [class*="_menu_"],
111
+ html[data-dcc-radius="on"] [class*="_modal_"],
112
+ html[data-dcc-radius="on"] [class*="_popover_"] {
113
+ border-radius: var(--dsw-radius-lg) !important;
114
+ }
115
+ html[data-dcc-radius="on"][data-windows-titlebar] [class*="_frame"] {
116
+ --dsh-windows-content-radius: 6px !important;
117
+ }
118
+ /* 选择题:选中项的序号用高亮反色(和勾选框一致) */
119
+ html [class*="_optionRow"][class*="_optionSelected"] [class*="_number"] {
120
+ background-color: var(--dsw-alias-label-primary) !important;
121
+ color: var(--dsw-alias-label-primary-foreground) !important;
122
+ font-weight: 600 !important;
123
+ }
124
+ /* 悬停选项时序号数字更明显,但序号底色不变(选中项由上面的反色规则接管) */
125
+ html [class*="_optionRow"]:not([class*="_optionSelected"]):hover [class*="_number"] {
126
+ color: var(--dsw-alias-label-primary) !important;
127
+ }
128
+
129
+ /* 发送按钮:圆形改为小圆角方形(与其它按钮一致),整体略小一点、留白更紧 */
130
+ html[data-dcc-radius="on"] [class*="_trailing"] > [class*="_primary"] {
131
+ border-radius: var(--dsw-radius-md) !important;
132
+ width: 32px !important;
133
+ height: 32px !important;
134
+ padding: 0 !important;
135
+ }
136
+ html[data-dcc-radius="on"] [class*="_trailing"] > [class*="_primary"] svg {
137
+ width: 16px !important;
138
+ height: 16px !important;
139
+ }
140
+
141
+ /* 主内容区左上角的大圆角(Windows 标题栏) */
142
+ html[data-dcc-radius="on"][data-windows-titlebar] [class*="_centerCol"] {
143
+ border-radius: 6px 0 0 0 !important;
144
+ }
145
+ html[data-dcc-radius="on"] [class*="_composerStack"] { --dsh-composer-stack-gap: 4px !important; }
146
+ html[data-dcc-radius="on"] [class*="_panelRow"] { --dsh-sidebar-row-padding: 10px !important; }
147
+ html[data-dcc-radius="on"] body {
148
+ --dsh-scrollbar-width: 4px !important;
149
+ --dsw-shadow-lv1: 0 1px 2px rgba(0, 0, 0, .04) !important;
150
+ --dsw-shadow-lv2: 0 2px 6px rgba(0, 0, 0, .05) !important;
151
+ --dsw-shadow-lv3: 0 8px 24px rgba(0, 0, 0, .10) !important;
152
+ }
153
+ html[data-dcc-radius="on"] body,
154
+ html[data-dcc-radius="on"] body * {
155
+ --dsw-elevation-panel: var(--dsw-elevation-stroke), 0 2px 6px rgba(0, 0, 0, .04) !important;
156
+ }
157
+
158
+ /* ---------- 新会话按钮:作为导航行的一员,仅颜色不同 ---------- */
159
+ /* 原按钮在展开态隐藏(折叠窄栏时仍用它),由克隆行替代 */
160
+ html[data-dcc-new="on"] button[data-dcc-original] {
161
+ display: none !important;
162
+ }
163
+ html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) button[data-dcc-original] {
164
+ display: flex !important;
165
+ }
166
+ html[data-dcc-new="on"]:has([data-sidebar-collapsed="true"]) button[data-dcc-newrow] {
167
+ display: none !important;
168
+ }
169
+ html[data-dcc-new="off"] button[data-dcc-newrow] {
170
+ display: none !important;
171
+ }
172
+ /* 克隆行直接使用 panelRow 的类,宽度/内边距/行高/焦点环全部来自宿主;
173
+ 常规底色比其它按钮的 hover 色再弱一档,悬停时恢复成 hover 色 */
174
+ html[data-dcc-new="on"] button[data-dcc-newrow] {
175
+ background-color: color-mix(in srgb, var(--dsw-alias-interactive-bg-hover) 88%, transparent) !important;
176
+ color: var(--dsw-alias-label-primary) !important;
177
+ }
178
+ html[data-dcc-new="on"] button[data-dcc-newrow]:hover {
179
+ background-color: var(--dsw-alias-interactive-bg-hover) !important;
180
+ box-shadow: inset 0 0 0 999px rgba(127, 127, 127, .1) !important;
181
+ }
182
+ .dcc-newrow-content {
183
+ display: flex;
184
+ align-items: center;
185
+ justify-content: flex-start;
186
+ gap: calc(var(--dsh-sidebar-label-gap) + 2px);
187
+ flex: 1;
188
+ min-width: 0;
189
+ }
190
+ .dcc-newrow-content svg {
191
+ width: 16px;
192
+ height: 16px;
193
+ flex: none;
194
+ color: inherit;
195
+ }
196
+ .dcc-newrow-label {
197
+ min-width: 0;
198
+ overflow: hidden;
199
+ text-overflow: ellipsis;
200
+ white-space: nowrap;
201
+ font: inherit;
202
+ color: inherit;
203
+ }
204
+ /* 显示 logo 时,给导航区留出与上方接近的下边距 */
205
+ html[data-dcc-logo="shown"] nav[class*="_panelList"] {
206
+ margin-top: 6px;
207
+ }
208
+
209
+ /* 导航行之间的间距统一收紧 */
210
+ html[data-dcc-nav] nav[class*="_panelList"] {
211
+ gap: 2px !important;
212
+ margin-bottom: 2px !important;
213
+ }
214
+ /* 清掉导航子项(包括「更多」等控件)自带的上下外边距 */
215
+ html[data-dcc-nav] nav[class*="_panelList"] > * + * {
216
+ margin-top: 0 !important;
217
+ margin-bottom: 0 !important;
218
+ }
219
+
220
+ /* ---------- 侧栏导航:默认只留前两项;悬停时工作区平移、其余按钮只做渐显 ---------- */
221
+ /* 导航行左右内边距与图标/文字间距稍微放宽(折叠窄栏由宿主规则覆盖) */
222
+ html[data-dcc-nav]:not(:has([data-sidebar-collapsed="true"])) nav[class*="_panelList"] [class*="_panelRow"] {
223
+ padding-left: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + 3px);
224
+ padding-right: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + 3px);
225
+ gap: calc(var(--dsh-sidebar-label-gap) + 2px);
226
+ }
227
+ /* 收起态:只保留前两项,其余直接不参与布局。
228
+ 之前用 max-height 估算高度,多出来的空白会露在列表和箭头之间,
229
+ 改成 display:none 后高度完全由剩下的行决定。 */
230
+ html[data-dcc-nav="collapsed"] nav[class*="_panelList"] > *:nth-child(n + 3) {
231
+ display: none;
232
+ }
233
+
234
+ /* 导航底部的展开/收起箭头 */
235
+ .dcc-nav-toggle {
236
+ display: flex;
237
+ align-items: center;
238
+ justify-content: center;
239
+ width: calc(100% - 8px);
240
+ margin: 0 4px 2px;
241
+ padding: 2px 0;
242
+ border: 0;
243
+ border-radius: var(--dsw-radius-md, 6px);
244
+ background: transparent;
245
+ color: var(--dsw-alias-label-tertiary);
246
+ cursor: pointer;
247
+ transition: background-color .15s, color .15s;
248
+ }
249
+ .dcc-nav-toggle:hover {
250
+ background: var(--dsw-alias-interactive-bg-hover);
251
+ color: var(--dsw-alias-label-secondary);
252
+ }
253
+ .dcc-nav-toggle svg {
254
+ display: block;
255
+ width: 14px;
256
+ height: 14px;
257
+ transition: transform .18s ease;
258
+ }
259
+ html[data-dcc-nav="collapsed"] .dcc-nav-toggle svg {
260
+ transform: rotate(180deg);
261
+ }
262
+
263
+ /* ---------- 工作区名称更明显,「展开其余」更淡 ---------- */
264
+ html[data-dcc-dim="on"] [class*="_projectRow"] [class*="_title"] {
265
+ color: var(--dsw-alias-label-primary) !important;
266
+ opacity: .7 !important;
267
+ }
268
+ html[data-dcc-dim="on"] [class*="_projectRow"]:hover [class*="_title"] {
269
+ opacity: 1 !important;
270
+ }
271
+ /* 会话行前面的弱化小圆点(状态点为空/不可见时露出) */
272
+ html[data-dcc-dot="on"] [class*="_sessionRow"] {
273
+ position: relative;
274
+ }
275
+ html[data-dcc-dot="on"] [class*="_sessionRow"]::before {
276
+ content: "";
277
+ position: absolute;
278
+ left: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + var(--dsh-workspace-indent, 0px) + 8px - 2px);
279
+ top: 50%;
280
+ width: 4px;
281
+ height: 4px;
282
+ margin-top: -2px;
283
+ border-radius: 50%;
284
+ background: var(--dsw-alias-label-tertiary);
285
+ opacity: .35;
286
+ pointer-events: none;
287
+ }
288
+ /* 与 archive-manager 的收藏星标共存:星标占用的正是同一个 16px 前导位置。
289
+ 星标在行悬停时总会出现(未收藏是空心、可点),已收藏则常驻,
290
+ 两种情况下都不再画自身的小圆点,避免与星标叠在一起。 */
291
+ html[data-dcc-dot="on"] [class*="_sessionRow"]:hover:has(.dsham_starSlot)::before,
292
+ html[data-dcc-dot="on"] [class*="_sessionRow"]:has(.dsham_starSlot[data-favorited="true"])::before {
293
+ display: none;
294
+ }
295
+ /* 未收藏时的空心星(悬停才出现):压到与会话标题同色,不再用偏亮的 label-primary。
296
+ 已收藏的实心金星保持 archive-manager 原色,不做处理。 */
297
+ html [class*="_sessionRow"] .dsham_starSlot:not([data-favorited="true"]) .dsham_rowStar {
298
+ color: var(--dsw-alias-label-secondary) !important;
299
+ }
300
+ /* 「展开其余 N 个会话 / 收起」比工作区标题更淡 */
301
+ html[data-dcc-dim="on"] [class*="_sessionOverflowButton"] {
302
+ color: var(--dsw-alias-label-tertiary) !important;
303
+ opacity: .6 !important;
304
+ }
305
+ html[data-dcc-dim="on"] [class*="_sessionOverflowButton"]:hover {
306
+ opacity: .9 !important;
307
+ }
308
+
309
+ /* ---------- 工作区行:悬停时不换成展开箭头,保持文件夹图标 ---------- */
310
+ /* 宿主默认:hover 时 .chevron 显示、.folder 隐藏(Rows.module.css)。这里反着压回去。 */
311
+ html [class*="_projectRow"]:hover [class*="_folder"] {
312
+ display: inline-flex !important;
313
+ }
314
+ html [class*="_projectRow"]:hover [class*="_chevron"] {
315
+ display: none !important;
316
+ }
317
+
318
+ /* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ---------- */
319
+ /* 「工作区」分组标题:更小、更弱,并与下方项目行左对齐 */
320
+ html[data-dcc-ws="on"] [class*="_sectionHeader"] {
321
+ height: 30px !important;
322
+ margin-bottom: 2px !important;
323
+ }
324
+ html[data-dcc-ws="on"] [class*="_sectionHeader"] [class*="_sectionLabel"]:not([class*="_sectionLabelHidden"]) {
325
+ font-size: 13px;
326
+ left: -2px;
327
+ opacity: .72;
328
+ color: var(--dsw-alias-label-tertiary);
329
+ }
330
+ html[data-dcc-ws="on"] [class*="_projectRow"] [class*="_title"],
331
+ html[data-dcc-ws="on"] [class*="_sessionRow"] [class*="_title"] {
332
+ font-size: 13px !important;
333
+ line-height: 18px !important;
334
+ }
335
+ html[data-dcc-ws="on"] [class*="_projectRow"] {
336
+ height: 32px !important;
337
+ }
338
+ html[data-dcc-ws="on"] [class*="_sessionRow"] {
339
+ height: 30px !important;
340
+ }
341
+ /* 左下角账户区:整体压矮一点 */
342
+ html[data-dcc-ws="on"] [class*="_trigger"][data-signed-out="false"]:not([data-collapsed="true"]) {
343
+ height: 38px !important;
344
+ padding-top: 4px !important;
345
+ padding-bottom: 4px !important;
346
+ gap: 6px !important;
347
+ font-size: 13px !important;
348
+ }
349
+ html[data-dcc-ws="on"] [class*="_trigger"][data-signed-out="false"] [class*="_avatar"] {
350
+ width: 22px !important;
351
+ height: 22px !important;
352
+ }
353
+
354
+ /* ---------- 已归档会话:标题画删除线 ---------- */
355
+ html [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
356
+ text-decoration: line-through;
357
+ text-decoration-thickness: 1px;
358
+ }
359
+
360
+ /* ---------- 主题差异微调 ---------- */
361
+ /* 深色主题背景更亮,展开文字需要再弱一档(工作区名称保持明显) */
362
+ html[data-dcc-dim="on"] body[data-ds-dark-theme] [class*="_sessionOverflowButton"] {
363
+ color: var(--dsw-alias-label-tertiary) !important;
364
+ opacity: .5 !important;
365
+ }
366
+ html[data-dcc-dot="on"] body[data-ds-dark-theme] [class*="_sessionRow"]::before {
367
+ opacity: .28;
368
+ }
369
+ /* 浅色主题下导航 hover 与新会话常规底色略微加强 */
370
+ body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"]:hover {
371
+ box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .035) !important;
372
+ }
373
+ html[data-dcc-new="on"] body:not([data-ds-dark-theme]) button[data-dcc-newrow] {
374
+ background-color: color-mix(in srgb, var(--dsw-alias-interactive-bg-hover) 82%, rgba(0, 0, 0, .05)) !important;
375
+ }
376
+ /* 浅色主题下选中会话的背景再强一点 */
377
+ body:not([data-ds-dark-theme]) [class*="_sessionRow"][class*="_selected"] {
378
+ box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .04) !important;
379
+ }
380
+
381
+ /* 导航行的悬停 / 选中:比新会话默认底更明显 */
382
+ html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"]:hover:not([data-dcc-newrow]),
383
+ html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"]:not([data-dcc-newrow]) {
384
+ background-color: var(--dsw-alias-interactive-bg-hover) !important;
385
+ box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .07) !important;
386
+ }
387
+ html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"]:hover:not([data-dcc-newrow]),
388
+ html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"]:not([data-dcc-newrow]) {
389
+ background-color: var(--dsw-alias-interactive-bg-hover) !important;
390
+ box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .1) !important;
391
+ }
392
+
393
+ /* ---------- 设置面板:全屏(避开 Electron 标题栏)+ 标题左侧返回按钮 ---------- */
394
+ html [class*="_overlay"]:has([class*="_navTitle"]) {
395
+ top: var(--dsh-windows-titlebar-height, 0px) !important;
396
+ align-items: stretch !important;
397
+ justify-content: stretch !important;
398
+ }
399
+ html [class*="_overlay"]:has([class*="_navTitle"]) > [class*="_panel"] {
400
+ width: 100% !important;
401
+ max-width: none !important;
402
+ height: 100% !important;
403
+ max-height: none !important;
404
+ border-radius: 0 !important;
405
+ box-shadow: none !important;
406
+ }
407
+ /* 只在窗口足够宽时锁定两列布局,窄窗口沿用宿主自己的单列布局 */
408
+ @media (min-width: 720px) {
409
+ html [class*="_overlay"]:has([class*="_navTitle"]) > [class*="_panel"] {
410
+ grid-template-columns: 220px minmax(0, 1fr) !important;
411
+ }
412
+ }
413
+ /* 全屏时不需要遮罩,去掉它会露出标题栏下方的一条描边 */
414
+ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_mask"] {
415
+ display: none !important;
416
+ }
417
+ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_close"] {
418
+ display: none !important;
419
+ }
420
+ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navTitle"] {
421
+ padding-left: 52px !important;
422
+ }
423
+ /* 设置导航项:略矮一点 */
424
+ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navCell"] {
425
+ position: relative;
426
+ height: 38px !important;
427
+ padding-top: 8px !important;
428
+ padding-bottom: 8px !important;
429
+ }
430
+ .dcc-settings-back {
431
+ position: absolute;
432
+ top: 20px;
433
+ left: 14px;
434
+ z-index: 2;
435
+ display: inline-flex;
436
+ align-items: center;
437
+ justify-content: center;
438
+ width: 28px;
439
+ height: 28px;
440
+ padding: 0;
441
+ border: 0;
442
+ border-radius: var(--dsw-radius-sm);
443
+ background: transparent;
444
+ color: var(--dsw-alias-label-primary);
445
+ cursor: pointer;
446
+ }
447
+ .dcc-settings-back:hover {
448
+ background: var(--dsw-alias-interactive-bg-hover);
449
+ }
450
+
451
+ /* ---------- 左上角品牌区 ---------- */
452
+ html[data-dcc-logo="hidden"] [class*="_brand"]:not([class*="_brandMark"]):not([class*="_brandName"]):not([class*="_brandIdentity"]),
453
+ html[data-dcc-logo="hidden"] [class*="_railMark"] {
454
+ display: none !important;
455
+ }
456
+ /* 隐藏 logo 后整行收平,让下方内容补位 */
457
+ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
458
+ height: 0 !important;
459
+ min-height: 0 !important;
460
+ margin: 0 !important;
461
+ padding: 0 !important;
462
+ }
463
+ `;
464
+
465
+ /**
466
+ * 把「新会话」作为导航行的一员:在 nav 首位插入一个使用 panelRow 类名的
467
+ * 克隆按钮(宽度/内边距/行高/焦点环全部由宿主样式决定),原按钮在展开态
468
+ * 隐藏、折叠窄栏时仍然使用。返回清理函数。
469
+ */
470
+ function installNewSessionRow() {
471
+ const findNav = () => document.querySelector('nav[class*="_panelList"]');
472
+ const findOriginal = () => document.querySelector('button[class*="_newSession"]');
473
+ let clone = null;
474
+ let observer = null;
475
+ let timer = null;
476
+ let rafId = 0;
477
+
478
+ const build = (nav, orig) => {
479
+ const row = nav.querySelector('button[class*="_panelRow"]');
480
+ if (row === null) return false;
481
+ if (clone !== null) clone.remove();
482
+ clone = document.createElement('button');
483
+ clone.type = 'button';
484
+ clone.setAttribute('data-dcc-newrow', '');
485
+ clone.className = [...row.classList].filter((name) => !name.includes('_panelActive')).join(' ') + ' dcc-newrow';
486
+ const aria = orig.getAttribute('aria-label');
487
+ if (aria !== null) clone.setAttribute('aria-label', aria);
488
+ const content = document.createElement('span');
489
+ content.className = 'dcc-newrow-content';
490
+ const icon = orig.querySelector('svg');
491
+ if (icon !== null) content.appendChild(icon.cloneNode(true));
492
+ const label = document.createElement('span');
493
+ label.className = 'dcc-newrow-label';
494
+ const text = orig.querySelector('[class*="_newSessionLabel"]');
495
+ label.textContent = text !== null && text.textContent !== '' ? text.textContent : (isZh() ? '新会话' : 'New session');
496
+ content.appendChild(label);
497
+ clone.appendChild(content);
498
+ clone.addEventListener('click', (event) => {
499
+ event.preventDefault();
500
+ const current = findOriginal();
501
+ if (current !== null) current.click();
502
+ });
503
+ nav.insertBefore(clone, nav.firstElementChild);
504
+ return true;
505
+ };
506
+
507
+ const ensure = () => {
508
+ const nav = findNav();
509
+ const orig = findOriginal();
510
+ if (nav === null || orig === null) return false;
511
+ if (orig.getAttribute('data-dcc-original') === null) orig.setAttribute('data-dcc-original', '');
512
+ if (clone === null || !clone.isConnected) return build(nav, orig);
513
+ if (!nav.contains(clone)) nav.insertBefore(clone, nav.firstElementChild);
514
+ /* 宿主文字(语言切换等)变化时,克隆行跟着更新 */
515
+ const label = clone.querySelector('.dcc-newrow-label');
516
+ const text = orig.querySelector('[class*="_newSessionLabel"]');
517
+ if (label !== null && text !== null && text.textContent !== '' && label.textContent !== text.textContent) {
518
+ label.textContent = text.textContent;
519
+ }
520
+ const aria = orig.getAttribute('aria-label');
521
+ if (aria !== null && clone.getAttribute('aria-label') !== aria) clone.setAttribute('aria-label', aria);
522
+ return true;
523
+ };
524
+
525
+ const schedule = () => {
526
+ if (timer !== null) return;
527
+ timer = window.setTimeout(() => {
528
+ timer = null;
529
+ ensure();
530
+ }, 400);
531
+ };
532
+
533
+ const start = () => {
534
+ if (ensure()) return;
535
+ let tries = 0;
536
+ const tick = () => {
537
+ rafId = 0;
538
+ if (ensure() || tries++ > 60) return;
539
+ rafId = window.requestAnimationFrame(tick);
540
+ };
541
+ rafId = window.requestAnimationFrame(tick);
542
+ };
543
+
544
+ start();
545
+ observer = new MutationObserver(schedule);
546
+ observer.observe(document.body, { childList: true, subtree: true });
547
+
548
+ return () => {
549
+ observer.disconnect();
550
+ if (timer !== null) clearTimeout(timer);
551
+ if (rafId !== 0) window.cancelAnimationFrame(rafId);
552
+ if (clone !== null) clone.remove();
553
+ const orig = findOriginal();
554
+ if (orig !== null) orig.removeAttribute('data-dcc-original');
555
+ };
556
+ }
557
+
558
+ /**
559
+ * 导航底部的展开/收起箭头。
560
+ * 点击切换 html[data-dcc-nav],并写回偏好,让下一次启动保持同样的折叠状态。
561
+ * 导航项超过两项时箭头可见。
562
+ */
563
+ function installNavToggle() {
564
+ const findNav = () => document.querySelector('nav[class*="_panelList"]');
565
+ let btn = null;
566
+ let observer = null;
567
+ let timer = null;
568
+
569
+ const sync = () => {
570
+ if (btn === null) return;
571
+ const nav = findNav();
572
+ const count = nav === null ? 0 : nav.children.length;
573
+ btn.style.display = count > 2 ? '' : 'none';
574
+ const collapsed = document.documentElement.dataset.dccNav === 'collapsed';
575
+ const label = collapsed ? (isZh() ? '展开导航' : 'Expand navigation') : (isZh() ? '收起导航' : 'Collapse navigation');
576
+ btn.setAttribute('aria-label', label);
577
+ btn.setAttribute('aria-expanded', collapsed ? 'false' : 'true');
578
+ btn.title = label;
579
+ };
580
+
581
+ const build = (nav) => {
582
+ if (btn !== null) btn.remove();
583
+ btn = document.createElement('button');
584
+ btn.type = 'button';
585
+ btn.className = 'dcc-nav-toggle';
586
+ btn.innerHTML = '<svg viewBox="0 0 16 16" aria-hidden="true">'
587
+ + '<path d="M4 10l4-4 4 4" fill="none" stroke="currentColor" stroke-width="1.6"'
588
+ + ' stroke-linecap="round" stroke-linejoin="round"/></svg>';
589
+ btn.addEventListener('click', () => {
590
+ const root = document.documentElement;
591
+ const next = root.dataset.dccNav === 'collapsed' ? 'expanded' : 'collapsed';
592
+ root.dataset.dccNav = next;
593
+ const nextPrefs = readPrefs();
594
+ nextPrefs.collapseNav = next === 'collapsed';
595
+ savePrefs(nextPrefs);
596
+ sync();
597
+ });
598
+ nav.parentElement.insertBefore(btn, nav.nextSibling);
599
+ sync();
600
+ };
601
+
602
+ const ensure = () => {
603
+ const nav = findNav();
604
+ if (nav === null || nav.parentElement === null) return;
605
+ if (btn !== null && btn.isConnected && btn.previousElementSibling === nav) {
606
+ sync();
607
+ return;
608
+ }
609
+ build(nav);
610
+ };
611
+
612
+ const schedule = () => {
613
+ if (timer !== null) return;
614
+ timer = window.setTimeout(() => {
615
+ timer = null;
616
+ ensure();
617
+ }, 400);
618
+ };
619
+
620
+ ensure();
621
+ observer = new MutationObserver(schedule);
622
+ observer.observe(document.body, { childList: true, subtree: true });
623
+
624
+ return () => {
625
+ observer.disconnect();
626
+ if (timer !== null) clearTimeout(timer);
627
+ if (btn !== null) btn.remove();
628
+ };
629
+ }
630
+
631
+ /**
632
+ * 设置面板左上角的返回按钮:点击触发原关闭按钮,保留原关闭逻辑。
633
+ */
634
+ function installSettingsBackButton() {
635
+ let btn = null;
636
+ let observer = null;
637
+ let timer = null;
638
+
639
+ const findPanel = () => {
640
+ const title = document.querySelector('[class*="_navTitle"]');
641
+ return title === null ? null : title.parentElement;
642
+ };
643
+
644
+ const ensure = () => {
645
+ const panel = findPanel();
646
+ if (panel === null) {
647
+ if (btn !== null) btn.remove();
648
+ btn = null;
649
+ return;
650
+ }
651
+ if (btn !== null && btn.isConnected && btn.parentElement === panel) return;
652
+ if (btn !== null) btn.remove();
653
+ btn = document.createElement('button');
654
+ btn.type = 'button';
655
+ btn.className = 'dcc-settings-back';
656
+ btn.setAttribute('aria-label', isZh() ? '返回' : 'Back');
657
+ btn.title = isZh() ? '返回' : 'Back';
658
+ btn.innerHTML = '<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true">'
659
+ + '<path d="M10 3 5 8l5 5" fill="none" stroke="currentColor" stroke-width="1.6"'
660
+ + ' stroke-linecap="round" stroke-linejoin="round"/></svg>';
661
+ btn.addEventListener('click', () => {
662
+ const close = panel.querySelector('[class*="_header"] [class*="_close"]');
663
+ if (close !== null) close.click();
664
+ });
665
+ panel.appendChild(btn);
666
+ };
667
+
668
+ const schedule = () => {
669
+ if (timer !== null) return;
670
+ timer = window.setTimeout(() => {
671
+ timer = null;
672
+ ensure();
673
+ }, 350);
674
+ };
675
+
676
+ ensure();
677
+ observer = new MutationObserver(schedule);
678
+ observer.observe(document.body, { childList: true, subtree: true });
679
+
680
+ return () => {
681
+ observer.disconnect();
682
+ if (timer !== null) clearTimeout(timer);
683
+ if (btn !== null) btn.remove();
684
+ };
685
+ }
686
+
687
+ function Switch(props) {
688
+ return h('label', { className: 'dcc-switch' },
689
+ h('input', {
690
+ type: 'checkbox',
691
+ className: 'dcc-input',
692
+ checked: props.checked,
693
+ onChange: (event) => props.onChange(event.target.checked),
694
+ 'aria-label': props.title,
695
+ }),
696
+ h('span', { className: 'dcc-track', 'aria-hidden': true },
697
+ h('span', { className: 'dcc-thumb' })));
698
+ }
699
+
700
+ function Row(props) {
701
+ return h('div', { className: 'dcc-row' },
702
+ h('div', { className: 'dcc-row-text' },
703
+ h('div', { className: 'dcc-row-title' }, props.title),
704
+ props.desc ? h('div', { className: 'dcc-row-desc' }, props.desc) : null),
705
+ h(Switch, { checked: props.checked, onChange: props.onChange, title: props.title }));
706
+ }
707
+
708
+ function Section() {
709
+ const [prefs, setPrefs] = React.useState(readPrefs);
710
+ const zh = isZh();
711
+ const update = (key) => (value) => {
712
+ setPrefs((current) => {
713
+ const next = { ...current, [key]: value };
714
+ savePrefs(next);
715
+ return next;
716
+ });
717
+ };
718
+ return h('div', { className: 'dcc-page' },
719
+ h('div', { className: 'dcc-title' }, zh ? 'UI 改进' : 'UI improvements'),
720
+ h('p', { className: 'dcc-intro' },
721
+ zh ? '基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进。使 UI 更加专业、冷静、易读。每一项改动都可在下方单独开关。' : 'Tighter, smaller-radius, more orderly styling over the stock UI for a calmer, more professional and easier-to-read look. Every change can be switched on or off individually below.'),
722
+ h('div', { className: 'dcc-group' },
723
+ h('div', { className: 'dcc-group-title' }, zh ? '外观' : 'Appearance'),
724
+ h(Row, {
725
+ title: zh ? 'Windows 默认字体微软雅黑' : 'Microsoft YaHei on Windows',
726
+ desc: zh ? '仅当设置里没填正文字体时生效;填了字体则以你的设置为准。macOS 不受影响。' : 'Applies only when no body font is set in Settings; your own font still wins. macOS is unaffected.',
727
+ checked: prefs.winFont,
728
+ onChange: update('winFont'),
729
+ }),
730
+ h(Row, {
731
+ title: zh ? '紧凑圆角与密度' : 'Compact radius and density',
732
+ desc: zh ? '缩小全局圆角、收紧间距并降低阴影。' : 'Shrink the global radius scale, tighten spacing and soften shadows.',
733
+ checked: prefs.radiusDensity,
734
+ onChange: update('radiusDensity'),
735
+ }),
736
+ h(Row, {
737
+ title: zh ? '统一新会话按钮' : 'Unified new-session button',
738
+ desc: zh ? '把新会话做成与导航行一致、只保留半透明高亮的按钮。' : 'Make the new-session row match the nav rows, with only a translucent highlight.',
739
+ checked: prefs.invertNewSession,
740
+ onChange: update('invertNewSession'),
741
+ }),
742
+ h(Row, {
743
+ title: zh ? '折叠侧栏导航' : 'Collapse sidebar navigation',
744
+ desc: zh ? '只显示前两个导航项,用导航下方的箭头展开或收起。' : 'Show the first two nav items; use the arrow below the list to expand or collapse.',
745
+ checked: prefs.collapseNav,
746
+ onChange: update('collapseNav'),
747
+ }),
748
+ h(Row, {
749
+ title: zh ? '弱化工作区名称' : 'Dim workspace names',
750
+ desc: zh ? '工作区名称用更弱的文字色,会话标题保持正常。' : 'Workspace names use a weaker text color; session titles stay normal.',
751
+ checked: prefs.dimSessions,
752
+ onChange: update('dimSessions'),
753
+ }),
754
+ h(Row, {
755
+ title: zh ? '隐藏左上角 Logo' : 'Hide corner logo',
756
+ desc: zh ? '隐藏侧栏顶部的品牌标记。' : 'Hide the brand mark at the top of the sidebar.',
757
+ checked: prefs.hideLogo,
758
+ onChange: update('hideLogo'),
759
+ }),
760
+ h(Row, {
761
+ title: zh ? '工作区标题与会话小一号' : 'Smaller workspace and sessions',
762
+ desc: zh ? '侧栏工作区名称与会话标题使用更小的字号。' : 'Use a smaller font size for sidebar workspace names and session titles.',
763
+ checked: prefs.workspaceSmall,
764
+ onChange: update('workspaceSmall'),
765
+ }),
766
+ h(Row, {
767
+ title: zh ? '会话前圆点' : 'Session leading dot',
768
+ desc: zh ? '在会话行前显示一个淡化的小圆点。' : 'Show a faint dot before each session row.',
769
+ checked: prefs.sessionDot,
770
+ onChange: update('sessionDot'),
771
+ })));
772
+ }
773
+
774
+ function SectionIcon(props) {
775
+ const size = props !== null && typeof props === 'object' && typeof props.size === 'number' ? props.size : 16;
776
+ return h('svg', {
777
+ width: size, height: size, viewBox: '0 0 64 64', fill: 'none', 'aria-hidden': true,
778
+ },
779
+ h('rect', { x: 6, y: 6, width: 52, height: 52, rx: 15, stroke: 'currentColor', strokeWidth: 4, strokeDasharray: '8 6' }),
780
+ h('rect', { x: 16, y: 16, width: 32, height: 32, rx: 5, fill: 'currentColor' }));
781
+ }
782
+
783
+ return {
784
+ name: 'dsh-ui-alt',
785
+ inject: ['slots'],
786
+ apply(ctx) {
787
+ ctx.effect(() => {
788
+ applyPrefs(readPrefs());
789
+ let removeCss;
790
+ if (typeof styles !== 'undefined' && styles !== null && typeof styles.insert === 'function') {
791
+ removeCss = styles.insert(css);
792
+ } else {
793
+ const tag = document.createElement('style');
794
+ tag.setAttribute('data-dsh-ui-alt', '');
795
+ tag.textContent = css;
796
+ document.head.appendChild(tag);
797
+ removeCss = () => tag.remove();
798
+ }
799
+ const removeNewSessionRow = installNewSessionRow();
800
+ const removeNavToggle = installNavToggle();
801
+ const removeSettingsBack = installSettingsBackButton();
802
+ return () => {
803
+ removeCss();
804
+ removeNewSessionRow();
805
+ removeNavToggle();
806
+ removeSettingsBack();
807
+ const root = document.documentElement;
808
+ delete root.dataset.dccRadius;
809
+ delete root.dataset.dccNew;
810
+ delete root.dataset.dccNav;
811
+ delete root.dataset.dccDim;
812
+ delete root.dataset.dccLogo;
813
+ delete root.dataset.dccWs;
814
+ delete root.dataset.dccDot;
815
+ delete root.dataset.dccFont;
816
+ };
817
+ }, 'dsh-ui-alt: styles and preference attributes');
818
+
819
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
820
+ name: 'settings.section',
821
+ id: 'ui-alt',
822
+ order: 90,
823
+ label: () => (isZh() ? 'UI 改进' : 'UI improvements'),
824
+ }, Section));
825
+
826
+ ctx.slots.inject('settings.section.icon', () => ctx.slots.register({
827
+ name: 'settings.section.icon',
828
+ id: 'ui-alt',
829
+ order: 90,
830
+ label: () => 'UI improvements',
831
+ }, SectionIcon));
832
+ },
833
+ };
834
+ },
835
+ });
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-ui-alt
3
+ name: 'dsh-ui-alt'
package/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
2
+ <!-- 大圆角(虚线)收成小圆角(实心) -->
3
+ <rect x="6" y="6" width="52" height="52" rx="15" stroke="#8ea7b6" stroke-width="3.5" stroke-dasharray="7 5"/>
4
+ <rect x="15" y="15" width="34" height="34" rx="5" fill="#2f5d74"/>
5
+ <path d="M15 24v-3.5A5.5 5.5 0 0 1 20.5 15H24" stroke="#cfe3ec" stroke-width="3" stroke-linecap="round"/>
6
+ </svg>
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ /** Host half of the dsh-ui-alt bundle; the Client module owns all rendering. */
2
+ export function apply() {}
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "UI improvements",
4
+ "description": "Tighter, smaller-radius and more orderly styling over the stock UI, making it calmer, more professional and easier to read. Every change can be switched on or off individually in Settings."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "UI 改进",
4
+ "description": "基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进。使 UI 更加专业、冷静、易读。可在设置中单独开关每一项改动。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "dsh-ui-alt",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.7",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进。使 UI 更加专业、冷静、易读。可在设置中单独开关每一项改动。",
7
+ "license": "MIT",
8
+ "author": "AomiRaku",
9
+ "keywords": [
10
+ "dsh",
11
+ "dsh-plugin",
12
+ "deepseek-harness",
13
+ "plugin",
14
+ "ui",
15
+ "compact"
16
+ ],
17
+ "homepage": "https://github.com/AomiRaku/dsh-ui-alt#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/AomiRaku/dsh-ui-alt.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/AomiRaku/dsh-ui-alt/issues"
24
+ },
25
+ "exports": {
26
+ ".": "./index.js",
27
+ "./client": "./client.js",
28
+ "./locale/*.json": "./locale/*.json",
29
+ "./icon": "./icon.svg"
30
+ },
31
+ "files": [
32
+ "index.js",
33
+ "client.js",
34
+ "cordis.patch.yml",
35
+ "locale/*.json",
36
+ "icon.svg",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "dsh": {
41
+ "bundle": {
42
+ "patch": "./cordis.patch.yml"
43
+ },
44
+ "client": {
45
+ "platform": "web",
46
+ "immediately": true,
47
+ "inject": [
48
+ "@deepseek-ai/dsh-client-ui-conversation",
49
+ "@deepseek-ai/dsh-client-ui-settings"
50
+ ]
51
+ }
52
+ }
53
+ }