dsh-ui-alt 0.2.9 → 0.2.11
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 +19 -11
- package/client.js +230 -65
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
# dsh-ui-alt
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。可在设置中单独调整每一项改动。
|
|
4
4
|
|
|
5
5
|
插件由 CSS 覆盖加少量 DOM 注入组成,所有改动都可以在 设置 →「UI 改进」里逐项开关;关掉开关即恢复原版外观。
|
|
6
6
|
|
|
7
7
|
## 功能
|
|
8
8
|
|
|
9
|
+
**外观**
|
|
10
|
+
|
|
11
|
+
| 开关 | 默认 | 效果 |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| 隐藏左上角 Logo | 关 | 隐藏侧栏顶部的 Logo |
|
|
14
|
+
| Windows 默认微软雅黑字体 | 开 | Windows 端默认字体改为微软雅黑,低分辨率屏幕 200% 以下缩放带 hinting,更锐利;手动设置字体或 macOS 不受影响 |
|
|
15
|
+
|
|
16
|
+
**布局**
|
|
17
|
+
|
|
9
18
|
| 开关 | 默认 | 效果 |
|
|
10
19
|
| --- | --- | --- |
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
| 设置面板全屏 | 开 | 设置面板铺满窗口、隐藏右上角关闭按钮,改用左上角返回箭头;关闭后恢复为居中对话框 |
|
|
20
|
+
| 减小圆角与紧凑界面 | 开 | 缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效 |
|
|
21
|
+
| 统一新会话按钮样式 | 开 | 新会话按钮样式改为与导航按钮一致 |
|
|
22
|
+
| 折叠侧栏导航功能 | 开 | 折叠侧栏导航,点击箭头展开收起 |
|
|
23
|
+
| 弱化工作区名称 | 开 | 工作区名称弱化,使工作区和会话更易区分 |
|
|
24
|
+
| 会话前圆点 | 开 | 会话前显示一个圆点 |
|
|
25
|
+
| 移除工作区与会话悬停提示 | 开 | 悬停在侧栏工作区、会话上时不再显示详情卡片,使滚动更流畅 |
|
|
26
|
+
| 隐藏会话悬停多余按钮 | 开 | 悬停会话行时只保留菜单和置顶,其余按钮(含插件添加的)隐藏;若有插件按钮未在右键菜单中,可关闭 |
|
|
27
|
+
| 设置面板全屏 | 开 | 使用非窗口化的设置页面 |
|
|
20
28
|
|
|
21
29
|
另有一些不挂开关的固定样式:设置导航列宽 220px、归档会话标题画删除线、选择题选中项的序号反色高亮、浅色主题下选中会话背景加强、工作区行悬停时保持文件夹图标。
|
|
22
30
|
|
|
@@ -43,10 +51,10 @@ plugin_manager install_bundle target=<本仓库绝对路径>
|
|
|
43
51
|
| `data-dcc-nav` | `collapsed` / `expanded` |
|
|
44
52
|
| `data-dcc-dim` | `on` / `off` |
|
|
45
53
|
| `data-dcc-logo` | `hidden` / `shown` |
|
|
46
|
-
| `data-dcc-ws` | `on` / `off` |
|
|
47
54
|
| `data-dcc-dot` | `on` / `off` |
|
|
48
55
|
| `data-dcc-font` | `on` / `off` |
|
|
49
56
|
| `data-dcc-full` | `on` / `off` |
|
|
57
|
+
| `data-dcc-hover` | `on` / `off` |
|
|
50
58
|
|
|
51
59
|
## 目录结构
|
|
52
60
|
|
package/client.js
CHANGED
|
@@ -5,16 +5,20 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
const h = React.createElement;
|
|
6
6
|
|
|
7
7
|
const STORAGE_KEY = 'dsh-ui-alt:prefs:v1';
|
|
8
|
+
/* 发版时与 package.json 的 version 一起改:设置页底部会显示这两个值 */
|
|
9
|
+
const VERSION = '0.2.11';
|
|
10
|
+
const UPDATED = '2026-11-09';
|
|
8
11
|
const DEFAULTS = {
|
|
9
12
|
radiusDensity: true,
|
|
10
13
|
invertNewSession: true,
|
|
11
14
|
collapseNav: true,
|
|
12
15
|
dimSessions: true,
|
|
13
16
|
hideLogo: false,
|
|
14
|
-
workspaceSmall: true,
|
|
15
17
|
winFont: true,
|
|
16
18
|
sessionDot: true,
|
|
17
19
|
settingsFullscreen: true,
|
|
20
|
+
hideHoverCard: true,
|
|
21
|
+
hideRowButtons: true,
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
const isZh = () => {
|
|
@@ -38,10 +42,11 @@ window.__ModuleLoader__.load({
|
|
|
38
42
|
root.dataset.dccNav = prefs.collapseNav ? 'collapsed' : 'expanded';
|
|
39
43
|
root.dataset.dccDim = prefs.dimSessions ? 'on' : 'off';
|
|
40
44
|
root.dataset.dccLogo = prefs.hideLogo ? 'hidden' : 'shown';
|
|
41
|
-
root.dataset.dccWs = prefs.workspaceSmall ? 'on' : 'off';
|
|
42
45
|
root.dataset.dccDot = prefs.sessionDot ? 'on' : 'off';
|
|
43
46
|
root.dataset.dccFont = prefs.winFont ? 'on' : 'off';
|
|
44
47
|
root.dataset.dccFull = prefs.settingsFullscreen ? 'on' : 'off';
|
|
48
|
+
root.dataset.dccHover = prefs.hideHoverCard ? 'off' : 'on';
|
|
49
|
+
root.dataset.dccRowButtons = prefs.hideRowButtons ? 'on' : 'off';
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
function savePrefs(prefs) {
|
|
@@ -74,8 +79,9 @@ html[data-dcc-font="on"][data-windows-titlebar] body {
|
|
|
74
79
|
|
|
75
80
|
/* ---------- 设置页(始终可用) ---------- */
|
|
76
81
|
.dcc-page { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 760px; }
|
|
77
|
-
.dcc-title { margin: 0; padding: 0 2px; font-size: 16px; line-height: 24px; font-weight:
|
|
82
|
+
.dcc-title { margin: 0; padding: 0 2px; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
78
83
|
.dcc-intro { margin: 0; padding: 0 2px; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
|
|
84
|
+
.dcc-meta { margin: 0; padding: 2px 2px 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
|
|
79
85
|
.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); }
|
|
80
86
|
.dcc-group-title { padding: 14px 2px 4px; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
81
87
|
.dcc-row { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border-top: 1px solid var(--dsw-alias-border-l1); }
|
|
@@ -85,8 +91,10 @@ html[data-dcc-font="on"][data-windows-titlebar] body {
|
|
|
85
91
|
.dcc-row-desc { font-size: 12px; line-height: 17px; color: var(--dsw-alias-label-secondary); }
|
|
86
92
|
.dcc-switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; cursor: pointer; }
|
|
87
93
|
.dcc-input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
/* 宿主全站默认 corner-shape: superellipse(1.5),999px 会被渲染成圆角矩形而不是胶囊。
|
|
95
|
+
开关和滑块自己声明 round,形状不随「紧凑圆角与密度」开关变化。 */
|
|
96
|
+
.dcc-track { position: absolute; inset: 0; border-radius: 999px; corner-shape: round; border: 1px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); transition: background .15s, border-color .15s; }
|
|
97
|
+
.dcc-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; corner-shape: round; background: var(--dsw-alias-label-secondary); transition: transform .15s, background .15s; }
|
|
90
98
|
.dcc-input:checked + .dcc-track { border-color: transparent; background: var(--dsw-alias-label-primary); }
|
|
91
99
|
.dcc-input:checked + .dcc-track .dcc-thumb { transform: translateX(16px); background: var(--dsw-alias-label-primary-foreground); }
|
|
92
100
|
.dcc-input:focus-visible + .dcc-track { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
|
|
@@ -139,6 +147,10 @@ html[data-dcc-radius="on"] [class*="_trailing"] > [class*="_primary"] svg {
|
|
|
139
147
|
width: 16px !important;
|
|
140
148
|
height: 16px !important;
|
|
141
149
|
}
|
|
150
|
+
/* 输入框左下角的「+」:宿主是 999px 圆形,同样收成小圆角方形 */
|
|
151
|
+
html[data-dcc-radius="on"] button[class*="_add"] {
|
|
152
|
+
border-radius: var(--dsw-radius-md) !important;
|
|
153
|
+
}
|
|
142
154
|
|
|
143
155
|
/* 主内容区左上角的大圆角(Windows 标题栏) */
|
|
144
156
|
html[data-dcc-radius="on"][data-windows-titlebar] [class*="_centerCol"] {
|
|
@@ -172,15 +184,11 @@ html[data-dcc-new="off"] button[data-dcc-newrow] {
|
|
|
172
184
|
display: none !important;
|
|
173
185
|
}
|
|
174
186
|
/* 克隆行直接使用 panelRow 的类,宽度/内边距/行高/焦点环全部来自宿主;
|
|
175
|
-
|
|
187
|
+
默认和其它导航行一样是透明底,悬停时统一由下面的导航行规则上色 */
|
|
176
188
|
html[data-dcc-new="on"] button[data-dcc-newrow] {
|
|
177
|
-
background-color:
|
|
189
|
+
background-color: transparent !important;
|
|
178
190
|
color: var(--dsw-alias-label-primary) !important;
|
|
179
191
|
}
|
|
180
|
-
html[data-dcc-new="on"] button[data-dcc-newrow]:hover {
|
|
181
|
-
background-color: var(--dsw-alias-interactive-bg-hover) !important;
|
|
182
|
-
box-shadow: inset 0 0 0 999px rgba(127, 127, 127, .1) !important;
|
|
183
|
-
}
|
|
184
192
|
.dcc-newrow-content {
|
|
185
193
|
display: flex;
|
|
186
194
|
align-items: center;
|
|
@@ -218,6 +226,10 @@ html[data-dcc-nav] nav[class*="_panelList"] > * + * {
|
|
|
218
226
|
margin-top: 0 !important;
|
|
219
227
|
margin-bottom: 0 !important;
|
|
220
228
|
}
|
|
229
|
+
/* 折叠箭头自己就有上下内边距,紧随其后的分组标题不再额外留白 */
|
|
230
|
+
html[data-dcc-nav] [class*="_sectionHeader"] {
|
|
231
|
+
margin-top: 0 !important;
|
|
232
|
+
}
|
|
221
233
|
|
|
222
234
|
/* ---------- 侧栏导航:默认只留前两项;悬停时工作区平移、其余按钮只做渐显 ---------- */
|
|
223
235
|
/* 导航行左右内边距与图标/文字间距稍微放宽(折叠窄栏由宿主规则覆盖) */
|
|
@@ -226,37 +238,63 @@ html[data-dcc-nav]:not(:has([data-sidebar-collapsed="true"])) nav[class*="_panel
|
|
|
226
238
|
padding-right: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + 3px);
|
|
227
239
|
gap: calc(var(--dsh-sidebar-label-gap) + 2px);
|
|
228
240
|
}
|
|
229
|
-
/*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
/* 收起态:只保留前两项。用 max-height 过渡让列表能平滑展开/收起;
|
|
242
|
+
折叠高度与展开高度都由脚本按实测行高写进 CSS 变量,过渡速度才是均匀的。 */
|
|
243
|
+
html[data-dcc-nav] nav[class*="_panelList"] {
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
transition: max-height .15s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
246
|
+
}
|
|
247
|
+
html[data-dcc-nav="collapsed"] nav[class*="_panelList"] {
|
|
248
|
+
max-height: var(--dcc-nav-collapsed-height, 70px);
|
|
249
|
+
}
|
|
250
|
+
html[data-dcc-nav="expanded"] nav[class*="_panelList"] {
|
|
251
|
+
max-height: var(--dcc-nav-expanded-height, 1200px);
|
|
234
252
|
}
|
|
235
253
|
|
|
236
254
|
/* 导航底部的展开/收起箭头 */
|
|
255
|
+
/* 整行都能点(点击区不变),但高亮只画在图标那一小块上:背景交给中心伪元素,
|
|
256
|
+
按钮本身保持透明,所以整行悬停时也只有中间那个矩形亮起来。 */
|
|
237
257
|
.dcc-nav-toggle {
|
|
258
|
+
position: relative;
|
|
238
259
|
display: flex;
|
|
239
260
|
align-items: center;
|
|
240
261
|
justify-content: center;
|
|
241
262
|
width: calc(100% - 8px);
|
|
242
|
-
margin: 0 4px
|
|
263
|
+
margin: 0 4px;
|
|
243
264
|
padding: 2px 0;
|
|
244
265
|
border: 0;
|
|
245
266
|
border-radius: var(--dsw-radius-md, 6px);
|
|
246
267
|
background: transparent;
|
|
247
268
|
color: var(--dsw-alias-label-tertiary);
|
|
248
269
|
cursor: pointer;
|
|
249
|
-
transition:
|
|
270
|
+
transition: color .15s;
|
|
271
|
+
}
|
|
272
|
+
.dcc-nav-toggle::before {
|
|
273
|
+
content: "";
|
|
274
|
+
position: absolute;
|
|
275
|
+
top: 50%;
|
|
276
|
+
left: 50%;
|
|
277
|
+
width: 26px;
|
|
278
|
+
height: 20px;
|
|
279
|
+
margin: -10px 0 0 -13px;
|
|
280
|
+
border-radius: var(--dsw-radius-md, 6px);
|
|
281
|
+
background: transparent;
|
|
282
|
+
transition: background-color .15s;
|
|
283
|
+
pointer-events: none;
|
|
250
284
|
}
|
|
251
285
|
.dcc-nav-toggle:hover {
|
|
252
|
-
background:
|
|
286
|
+
background: transparent;
|
|
253
287
|
color: var(--dsw-alias-label-secondary);
|
|
254
288
|
}
|
|
289
|
+
.dcc-nav-toggle:hover::before {
|
|
290
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
291
|
+
}
|
|
255
292
|
.dcc-nav-toggle svg {
|
|
256
293
|
display: block;
|
|
257
294
|
width: 14px;
|
|
258
295
|
height: 14px;
|
|
259
|
-
|
|
296
|
+
/* 与宿主工作区折叠箭头同一套曲线:.15s + var(--ds-ease-in-out) */
|
|
297
|
+
transition: transform .15s var(--ds-ease-in-out);
|
|
260
298
|
}
|
|
261
299
|
html[data-dcc-nav="collapsed"] .dcc-nav-toggle svg {
|
|
262
300
|
transform: rotate(180deg);
|
|
@@ -317,42 +355,61 @@ html [class*="_projectRow"]:hover [class*="_chevron"] {
|
|
|
317
355
|
display: none !important;
|
|
318
356
|
}
|
|
319
357
|
|
|
320
|
-
/* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ----------
|
|
358
|
+
/* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ----------
|
|
359
|
+
归在「紧凑圆角与密度」开关下:密度本来就是一整套,字号不再单独开一项。 */
|
|
321
360
|
/* 「工作区」分组标题:更小、更弱,并与下方项目行左对齐 */
|
|
322
|
-
html[data-dcc-
|
|
361
|
+
html[data-dcc-radius="on"] [class*="_sectionHeader"] {
|
|
323
362
|
height: 30px !important;
|
|
324
363
|
margin-bottom: 2px !important;
|
|
325
364
|
}
|
|
326
|
-
html[data-dcc-
|
|
365
|
+
html[data-dcc-radius="on"] [class*="_sectionHeader"] [class*="_sectionLabel"]:not([class*="_sectionLabelHidden"]) {
|
|
327
366
|
font-size: 13px;
|
|
328
367
|
left: -2px;
|
|
329
368
|
opacity: .72;
|
|
330
369
|
color: var(--dsw-alias-label-tertiary);
|
|
331
370
|
}
|
|
332
|
-
html[data-dcc-
|
|
333
|
-
html[data-dcc-
|
|
371
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_title"],
|
|
372
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] [class*="_title"] {
|
|
334
373
|
font-size: 13px !important;
|
|
335
374
|
line-height: 18px !important;
|
|
336
375
|
}
|
|
337
|
-
html[data-dcc-
|
|
376
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] {
|
|
338
377
|
height: 32px !important;
|
|
339
378
|
}
|
|
340
|
-
html[data-dcc-
|
|
379
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] {
|
|
341
380
|
height: 30px !important;
|
|
342
381
|
}
|
|
343
382
|
/* 左下角账户区:整体压矮一点 */
|
|
344
|
-
html[data-dcc-
|
|
383
|
+
html[data-dcc-radius="on"] [class*="_trigger"][data-signed-out="false"]:not([data-collapsed="true"]) {
|
|
345
384
|
height: 38px !important;
|
|
346
385
|
padding-top: 4px !important;
|
|
347
386
|
padding-bottom: 4px !important;
|
|
348
387
|
gap: 6px !important;
|
|
349
388
|
font-size: 13px !important;
|
|
350
389
|
}
|
|
351
|
-
html[data-dcc-
|
|
390
|
+
html[data-dcc-radius="on"] [class*="_trigger"][data-signed-out="false"] [class*="_avatar"] {
|
|
352
391
|
width: 22px !important;
|
|
353
392
|
height: 22px !important;
|
|
354
393
|
}
|
|
355
394
|
|
|
395
|
+
/* ---------- 工作区 / 会话行的悬停提示卡片 ---------- */
|
|
396
|
+
/* 宿主把卡片挂在 body 下(_card / _preview / _bridge 三段),fixed + z-index:100。
|
|
397
|
+
打开「移除悬停提示」后直接不渲染,滑动侧栏时不再闪出卡片,也不会因定位计算掉帧。 */
|
|
398
|
+
html[data-dcc-hover="off"] [class*="_card_bgejw"],
|
|
399
|
+
html[data-dcc-hover="off"] [class*="_preview_bgejw"],
|
|
400
|
+
html[data-dcc-hover="off"] [class*="_bridge_bgejw"] {
|
|
401
|
+
display: none !important;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* ---------- 会话行悬停按钮 ---------- */
|
|
405
|
+
/* 悬停时行尾会冒出一排按钮:「…」菜单在 rowActions 里,其余(宿主归档、以及各插件
|
|
406
|
+
塞进 rowQuickActions 的按钮)紧跟在后面。DOM 上它们只有同一个 iconButton 类,
|
|
407
|
+
分不出谁是谁,所以保留哪几个由脚本按 data-context-menu-trigger / aria-label 判定,
|
|
408
|
+
再打上 data-dcc-hidden,这里只负责隐藏。 */
|
|
409
|
+
html[data-dcc-row-buttons="on"] [class*="_sessionRow"] [class*="_rowActions"] button[data-dcc-hidden] {
|
|
410
|
+
display: none !important;
|
|
411
|
+
}
|
|
412
|
+
|
|
356
413
|
/* ---------- 已归档会话:标题画删除线 ---------- */
|
|
357
414
|
html [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
|
|
358
415
|
text-decoration: line-through;
|
|
@@ -372,22 +429,19 @@ html[data-dcc-dot="on"] body[data-ds-dark-theme] [class*="_sessionRow"]::before
|
|
|
372
429
|
body:not([data-ds-dark-theme]) nav[class*="_panelList"] [class*="_panelRow"]:hover {
|
|
373
430
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .035) !important;
|
|
374
431
|
}
|
|
375
|
-
html[data-dcc-new="on"] body:not([data-ds-dark-theme]) button[data-dcc-newrow] {
|
|
376
|
-
background-color: color-mix(in srgb, var(--dsw-alias-interactive-bg-hover) 82%, rgba(0, 0, 0, .05)) !important;
|
|
377
|
-
}
|
|
378
432
|
/* 浅色主题下选中会话的背景再强一点 */
|
|
379
433
|
body:not([data-ds-dark-theme]) [class*="_sessionRow"][class*="_selected"] {
|
|
380
434
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .04) !important;
|
|
381
435
|
}
|
|
382
436
|
|
|
383
|
-
/* 导航行的悬停 /
|
|
384
|
-
html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"]:hover
|
|
385
|
-
html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"]
|
|
437
|
+
/* 导航行的悬停 / 选中:新会话行已经是普通导航行的一员,不再单独排除 */
|
|
438
|
+
html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"]:hover,
|
|
439
|
+
html[data-dcc-new="on"] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"] {
|
|
386
440
|
background-color: var(--dsw-alias-interactive-bg-hover) !important;
|
|
387
441
|
box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .07) !important;
|
|
388
442
|
}
|
|
389
|
-
html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"]:hover
|
|
390
|
-
html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"]
|
|
443
|
+
html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"]:hover,
|
|
444
|
+
html[data-dcc-new="on"] body[data-ds-dark-theme] nav[class*="_panelList"] [class*="_panelRow"][class*="_panelActive"] {
|
|
391
445
|
background-color: var(--dsw-alias-interactive-bg-hover) !important;
|
|
392
446
|
box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .1) !important;
|
|
393
447
|
}
|
|
@@ -584,6 +638,23 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
584
638
|
const nav = findNav();
|
|
585
639
|
const count = nav === null ? 0 : nav.children.length;
|
|
586
640
|
btn.style.display = count > 2 ? '' : 'none';
|
|
641
|
+
/* 折叠高度 = 前两项实测高度 + 一项行距;展开高度 = 全部实测高度。
|
|
642
|
+
写进变量后,max-height 的过渡是匀速的,不会「弹一下再停」。 */
|
|
643
|
+
if (nav !== null) {
|
|
644
|
+
const items = Array.from(nav.children);
|
|
645
|
+
const gap = parseFloat(window.getComputedStyle(nav).rowGap) || 0;
|
|
646
|
+
let collapsedHeight = 0;
|
|
647
|
+
let full = 0;
|
|
648
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
649
|
+
const h = items[i].getBoundingClientRect().height;
|
|
650
|
+
full += h;
|
|
651
|
+
if (i < 2) collapsedHeight += h;
|
|
652
|
+
}
|
|
653
|
+
full += Math.max(0, items.length - 1) * gap;
|
|
654
|
+
if (items.length > 1) collapsedHeight += gap;
|
|
655
|
+
nav.style.setProperty('--dcc-nav-collapsed-height', `${Math.ceil(collapsedHeight)}px`);
|
|
656
|
+
nav.style.setProperty('--dcc-nav-expanded-height', `${Math.ceil(full)}px`);
|
|
657
|
+
}
|
|
587
658
|
const collapsed = document.documentElement.dataset.dccNav === 'collapsed';
|
|
588
659
|
const label = collapsed ? (isZh() ? '展开导航' : 'Expand navigation') : (isZh() ? '收起导航' : 'Collapse navigation');
|
|
589
660
|
btn.setAttribute('aria-label', label);
|
|
@@ -716,14 +787,16 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
716
787
|
}, 350);
|
|
717
788
|
};
|
|
718
789
|
|
|
719
|
-
/*
|
|
790
|
+
/* 标题元素被撑满整行,空白处也在它盒子里;只有落在文字实际矩形上才算点击。
|
|
791
|
+
左侧再放宽一点,把标题与返回箭头之间那段 padding 空隙也算进来。 */
|
|
792
|
+
const LABEL_LEFT_SLACK = 14;
|
|
720
793
|
const hitsLabel = (title, event) => {
|
|
721
794
|
const range = document.createRange();
|
|
722
795
|
range.selectNodeContents(title);
|
|
723
796
|
const rects = range.getClientRects();
|
|
724
797
|
for (let i = 0; i < rects.length; i += 1) {
|
|
725
798
|
const rect = rects[i];
|
|
726
|
-
if (event.clientX >= rect.left && event.clientX <= rect.right
|
|
799
|
+
if (event.clientX >= rect.left - LABEL_LEFT_SLACK && event.clientX <= rect.right
|
|
727
800
|
&& event.clientY >= rect.top && event.clientY <= rect.bottom) return true;
|
|
728
801
|
}
|
|
729
802
|
return false;
|
|
@@ -784,6 +857,84 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
784
857
|
};
|
|
785
858
|
}
|
|
786
859
|
|
|
860
|
+
/**
|
|
861
|
+
* 会话行悬停时只留「…」菜单和置顶按钮,其余(宿主的归档、各插件加的)隐藏。
|
|
862
|
+
* 按钮上只有共用的 iconButton 类,所以按 data-context-menu-trigger 和 aria-label
|
|
863
|
+
* 认人:菜单按钮带前者,置顶按钮的 aria-label 里是「置顶会话 / 取消置顶 / pin」。
|
|
864
|
+
*/
|
|
865
|
+
function installRowActionFilter() {
|
|
866
|
+
let observer = null;
|
|
867
|
+
let timer = null;
|
|
868
|
+
let lastRow = null;
|
|
869
|
+
|
|
870
|
+
const isPinButton = (btn) => /置顶|pin/i.test(btn.getAttribute('aria-label') || '');
|
|
871
|
+
|
|
872
|
+
const filterRow = (row) => {
|
|
873
|
+
if (row === null) return;
|
|
874
|
+
const actions = row.querySelector('[class*="_rowActions"]');
|
|
875
|
+
if (actions === null) return;
|
|
876
|
+
const buttons = Array.from(actions.querySelectorAll('button'));
|
|
877
|
+
/* 认不出置顶按钮(例如界面是其它语言,或这一行本来就没有置顶)时整行不动:
|
|
878
|
+
宁可不生效,也不要把用户需要的按钮误藏掉。 */
|
|
879
|
+
if (!buttons.some(isPinButton)) return;
|
|
880
|
+
for (const btn of buttons) {
|
|
881
|
+
const keep = btn.hasAttribute('data-context-menu-trigger') || isPinButton(btn);
|
|
882
|
+
if (keep) {
|
|
883
|
+
if (btn.hasAttribute('data-dcc-hidden')) btn.removeAttribute('data-dcc-hidden');
|
|
884
|
+
} else if (!btn.hasAttribute('data-dcc-hidden')) {
|
|
885
|
+
btn.setAttribute('data-dcc-hidden', '');
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
const onPointer = (event) => {
|
|
891
|
+
if (document.documentElement.dataset.dccRowButtons !== 'on') return;
|
|
892
|
+
const target = event.target;
|
|
893
|
+
if (!(target instanceof Element)) return;
|
|
894
|
+
const row = target.closest('[class*="_sessionRow"]');
|
|
895
|
+
if (row === null || row === lastRow) return;
|
|
896
|
+
lastRow = row;
|
|
897
|
+
filterRow(row);
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/* 兜底:行是复用的,按钮可能在后来的渲染里才挂上去,定期把没扫过的行补一遍 */
|
|
901
|
+
const sweep = () => {
|
|
902
|
+
if (document.documentElement.dataset.dccRowButtons !== 'on') return;
|
|
903
|
+
const rows = document.querySelectorAll('[class*="_sessionRow"]:not([data-dcc-scanned])');
|
|
904
|
+
for (const row of rows) {
|
|
905
|
+
filterRow(row);
|
|
906
|
+
row.setAttribute('data-dcc-scanned', '');
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
const schedule = () => {
|
|
911
|
+
if (timer !== null) return;
|
|
912
|
+
timer = window.setTimeout(() => {
|
|
913
|
+
timer = null;
|
|
914
|
+
lastRow = null;
|
|
915
|
+
sweep();
|
|
916
|
+
}, 400);
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
document.addEventListener('pointerover', onPointer, true);
|
|
920
|
+
document.addEventListener('focusin', onPointer, true);
|
|
921
|
+
sweep();
|
|
922
|
+
observer = new MutationObserver(schedule);
|
|
923
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
924
|
+
|
|
925
|
+
return () => {
|
|
926
|
+
document.removeEventListener('pointerover', onPointer, true);
|
|
927
|
+
document.removeEventListener('focusin', onPointer, true);
|
|
928
|
+
observer.disconnect();
|
|
929
|
+
if (timer !== null) clearTimeout(timer);
|
|
930
|
+
const marked = document.querySelectorAll('[data-dcc-hidden], [data-dcc-scanned]');
|
|
931
|
+
for (const el of marked) {
|
|
932
|
+
el.removeAttribute('data-dcc-hidden');
|
|
933
|
+
el.removeAttribute('data-dcc-scanned');
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
|
|
787
938
|
function Switch(props) {
|
|
788
939
|
return h('label', { className: 'dcc-switch' },
|
|
789
940
|
h('input', {
|
|
@@ -818,63 +969,74 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
818
969
|
return h('div', { className: 'dcc-page' },
|
|
819
970
|
h('div', { className: 'dcc-title' }, zh ? 'UI 改进' : 'UI improvements'),
|
|
820
971
|
h('p', { className: 'dcc-intro' },
|
|
821
|
-
zh ? '
|
|
972
|
+
zh ? '在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。可在设置中单独调整每一项改动。' : 'A tidying pass over the stock UI that keeps its overall look: smaller radii, tighter spacing and a more orderly layout, for a calmer, more professional and more efficient interface. Every change can be adjusted individually in Settings.'),
|
|
822
973
|
h('div', { className: 'dcc-group' },
|
|
823
974
|
h('div', { className: 'dcc-group-title' }, zh ? '外观' : 'Appearance'),
|
|
824
975
|
h(Row, {
|
|
825
|
-
title: zh ? '
|
|
826
|
-
desc: zh ? '
|
|
976
|
+
title: zh ? '隐藏左上角 Logo' : 'Hide the top-left logo',
|
|
977
|
+
desc: zh ? '隐藏侧栏顶部的 Logo。' : 'Hide the logo at the top of the sidebar.',
|
|
978
|
+
checked: prefs.hideLogo,
|
|
979
|
+
onChange: update('hideLogo'),
|
|
980
|
+
}),
|
|
981
|
+
h(Row, {
|
|
982
|
+
title: zh ? 'Windows 默认微软雅黑字体' : 'Microsoft YaHei on Windows',
|
|
983
|
+
desc: zh ? '将 Windows 端默认字体改为微软雅黑,使文字在低分辨率屏幕 200% 以下缩放带有 hinting,更加锐利清晰。若手动设置了字体,或使用 macOS 端,则不受影响。' : 'Use Microsoft YaHei as the default Windows font so text keeps hinting — and stays sharp — at display scaling below 200%. Has no effect if you set a font manually, or on macOS.',
|
|
827
984
|
checked: prefs.winFont,
|
|
828
985
|
onChange: update('winFont'),
|
|
829
|
-
}),
|
|
986
|
+
})),
|
|
987
|
+
h('div', { className: 'dcc-group' },
|
|
988
|
+
h('div', { className: 'dcc-group-title' }, zh ? '布局' : 'Layout'),
|
|
830
989
|
h(Row, {
|
|
831
|
-
title: zh ? '
|
|
832
|
-
desc: zh ? '
|
|
990
|
+
title: zh ? '减小圆角与紧凑界面' : 'Smaller radii and a tighter layout',
|
|
991
|
+
desc: zh ? '缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效。' : 'Smaller global radii, smaller sidebar type and tighter spacing, for a more efficient interface.',
|
|
833
992
|
checked: prefs.radiusDensity,
|
|
834
993
|
onChange: update('radiusDensity'),
|
|
835
994
|
}),
|
|
836
995
|
h(Row, {
|
|
837
|
-
title: zh ? '
|
|
838
|
-
desc: zh ? '
|
|
996
|
+
title: zh ? '统一新会话按钮样式' : 'Unified new-session button',
|
|
997
|
+
desc: zh ? '将新会话按钮样式改为与导航按钮一致的样式。' : 'Style the new-session button the same as the navigation buttons.',
|
|
839
998
|
checked: prefs.invertNewSession,
|
|
840
999
|
onChange: update('invertNewSession'),
|
|
841
1000
|
}),
|
|
842
1001
|
h(Row, {
|
|
843
|
-
title: zh ? '
|
|
844
|
-
desc: zh ? '
|
|
1002
|
+
title: zh ? '折叠侧栏导航功能' : 'Collapsible sidebar navigation',
|
|
1003
|
+
desc: zh ? '折叠侧栏导航功能,可点击箭头展开收起。' : 'Collapse the sidebar navigation; click the arrow to expand or collapse it.',
|
|
845
1004
|
checked: prefs.collapseNav,
|
|
846
1005
|
onChange: update('collapseNav'),
|
|
847
1006
|
}),
|
|
848
1007
|
h(Row, {
|
|
849
1008
|
title: zh ? '弱化工作区名称' : 'Dim workspace names',
|
|
850
|
-
desc: zh ? '
|
|
1009
|
+
desc: zh ? '工作区名称弱化,使工作区和会话更易区分。' : 'Dim workspace names so workspaces and sessions are easier to tell apart.',
|
|
851
1010
|
checked: prefs.dimSessions,
|
|
852
1011
|
onChange: update('dimSessions'),
|
|
853
1012
|
}),
|
|
854
1013
|
h(Row, {
|
|
855
|
-
title: zh ? '
|
|
856
|
-
desc: zh ? '
|
|
857
|
-
checked: prefs.
|
|
858
|
-
onChange: update('
|
|
1014
|
+
title: zh ? '会话前圆点' : 'Session leading dot',
|
|
1015
|
+
desc: zh ? '会话前显示一个圆点。' : 'Show a dot before each session.',
|
|
1016
|
+
checked: prefs.sessionDot,
|
|
1017
|
+
onChange: update('sessionDot'),
|
|
859
1018
|
}),
|
|
860
1019
|
h(Row, {
|
|
861
|
-
title: zh ? '
|
|
862
|
-
desc: zh ? '
|
|
863
|
-
checked: prefs.
|
|
864
|
-
onChange: update('
|
|
1020
|
+
title: zh ? '移除工作区与会话悬停提示' : 'Remove workspace and session hover hints',
|
|
1021
|
+
desc: zh ? '悬停在侧栏工作区、会话上时,不再显示详情卡片。使滚动更流畅。' : 'Hovering a workspace or session no longer shows a details card, which keeps scrolling smooth.',
|
|
1022
|
+
checked: prefs.hideHoverCard,
|
|
1023
|
+
onChange: update('hideHoverCard'),
|
|
865
1024
|
}),
|
|
866
1025
|
h(Row, {
|
|
867
|
-
title: zh ? '
|
|
868
|
-
desc: zh ? '
|
|
869
|
-
checked: prefs.
|
|
870
|
-
onChange: update('
|
|
1026
|
+
title: zh ? '隐藏会话悬停多余按钮' : 'Hide extra session-row buttons',
|
|
1027
|
+
desc: zh ? '隐藏会话悬停时除了菜单和置顶之外的其他按钮,避免拥挤遮盖过多标题。正常情况下这些按钮都已经在右键菜单中包含。若其他插件添加的按钮未在右键菜单包含,可以关闭此功能。' : 'Hide every button on a hovered session row except the "…" menu and pin, so they stop crowding the title. These actions are normally in the right-click menu too; turn this off if a plugin adds a button that is not.',
|
|
1028
|
+
checked: prefs.hideRowButtons,
|
|
1029
|
+
onChange: update('hideRowButtons'),
|
|
871
1030
|
}),
|
|
872
1031
|
h(Row, {
|
|
873
1032
|
title: zh ? '设置面板全屏' : 'Full-screen settings panel',
|
|
874
|
-
desc: zh ? '
|
|
1033
|
+
desc: zh ? '使用非窗口化的设置页面。' : 'Use a non-windowed settings page.',
|
|
875
1034
|
checked: prefs.settingsFullscreen,
|
|
876
1035
|
onChange: update('settingsFullscreen'),
|
|
877
|
-
}))
|
|
1036
|
+
})),
|
|
1037
|
+
h('p', { className: 'dcc-meta' },
|
|
1038
|
+
/* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
|
|
1039
|
+
zh ? `版本:${VERSION}\u3000更新日期:${UPDATED}` : `Version: ${VERSION} Updated: ${UPDATED}`));
|
|
878
1040
|
}
|
|
879
1041
|
|
|
880
1042
|
function SectionIcon(props) {
|
|
@@ -905,21 +1067,24 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
905
1067
|
const removeNewSessionRow = installNewSessionRow();
|
|
906
1068
|
const removeNavToggle = installNavToggle();
|
|
907
1069
|
const removeSettingsBack = installSettingsBackButton();
|
|
1070
|
+
const removeRowActionFilter = installRowActionFilter();
|
|
908
1071
|
return () => {
|
|
909
1072
|
removeCss();
|
|
910
1073
|
removeNewSessionRow();
|
|
911
1074
|
removeNavToggle();
|
|
912
1075
|
removeSettingsBack();
|
|
1076
|
+
removeRowActionFilter();
|
|
913
1077
|
const root = document.documentElement;
|
|
914
1078
|
delete root.dataset.dccRadius;
|
|
915
1079
|
delete root.dataset.dccNew;
|
|
916
1080
|
delete root.dataset.dccNav;
|
|
917
1081
|
delete root.dataset.dccDim;
|
|
918
1082
|
delete root.dataset.dccLogo;
|
|
919
|
-
delete root.dataset.dccWs;
|
|
920
1083
|
delete root.dataset.dccDot;
|
|
921
1084
|
delete root.dataset.dccFont;
|
|
922
1085
|
delete root.dataset.dccFull;
|
|
1086
|
+
delete root.dataset.dccHover;
|
|
1087
|
+
delete root.dataset.dccRowButtons;
|
|
923
1088
|
};
|
|
924
1089
|
}, 'dsh-ui-alt: styles and preference attributes');
|
|
925
1090
|
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "UI improvements",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "A tidying pass over the stock UI that keeps its overall look: smaller radii, tighter spacing and a more orderly layout, for a calmer, more professional and more efficient interface. Every change can be adjusted individually in Settings."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ui-alt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。可在设置中单独调整每一项改动。",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "AomiRaku",
|
|
9
9
|
"keywords": [
|