dsh-ui-alt 0.2.9 → 0.2.10
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 +223 -51
- 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.10';
|
|
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"] {
|
|
@@ -218,6 +230,10 @@ html[data-dcc-nav] nav[class*="_panelList"] > * + * {
|
|
|
218
230
|
margin-top: 0 !important;
|
|
219
231
|
margin-bottom: 0 !important;
|
|
220
232
|
}
|
|
233
|
+
/* 折叠箭头自己就有上下内边距,紧随其后的分组标题不再额外留白 */
|
|
234
|
+
html[data-dcc-nav] [class*="_sectionHeader"] {
|
|
235
|
+
margin-top: 0 !important;
|
|
236
|
+
}
|
|
221
237
|
|
|
222
238
|
/* ---------- 侧栏导航:默认只留前两项;悬停时工作区平移、其余按钮只做渐显 ---------- */
|
|
223
239
|
/* 导航行左右内边距与图标/文字间距稍微放宽(折叠窄栏由宿主规则覆盖) */
|
|
@@ -226,37 +242,63 @@ html[data-dcc-nav]:not(:has([data-sidebar-collapsed="true"])) nav[class*="_panel
|
|
|
226
242
|
padding-right: calc(var(--dsh-sidebar-row-padding) - var(--dsh-sidebar-paint-inset) + 3px);
|
|
227
243
|
gap: calc(var(--dsh-sidebar-label-gap) + 2px);
|
|
228
244
|
}
|
|
229
|
-
/*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
245
|
+
/* 收起态:只保留前两项。用 max-height 过渡让列表能平滑展开/收起;
|
|
246
|
+
折叠高度与展开高度都由脚本按实测行高写进 CSS 变量,过渡速度才是均匀的。 */
|
|
247
|
+
html[data-dcc-nav] nav[class*="_panelList"] {
|
|
248
|
+
overflow: hidden;
|
|
249
|
+
transition: max-height .15s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1));
|
|
250
|
+
}
|
|
251
|
+
html[data-dcc-nav="collapsed"] nav[class*="_panelList"] {
|
|
252
|
+
max-height: var(--dcc-nav-collapsed-height, 70px);
|
|
253
|
+
}
|
|
254
|
+
html[data-dcc-nav="expanded"] nav[class*="_panelList"] {
|
|
255
|
+
max-height: var(--dcc-nav-expanded-height, 1200px);
|
|
234
256
|
}
|
|
235
257
|
|
|
236
258
|
/* 导航底部的展开/收起箭头 */
|
|
259
|
+
/* 整行都能点(点击区不变),但高亮只画在图标那一小块上:背景交给中心伪元素,
|
|
260
|
+
按钮本身保持透明,所以整行悬停时也只有中间那个矩形亮起来。 */
|
|
237
261
|
.dcc-nav-toggle {
|
|
262
|
+
position: relative;
|
|
238
263
|
display: flex;
|
|
239
264
|
align-items: center;
|
|
240
265
|
justify-content: center;
|
|
241
266
|
width: calc(100% - 8px);
|
|
242
|
-
margin: 0 4px
|
|
267
|
+
margin: 0 4px;
|
|
243
268
|
padding: 2px 0;
|
|
244
269
|
border: 0;
|
|
245
270
|
border-radius: var(--dsw-radius-md, 6px);
|
|
246
271
|
background: transparent;
|
|
247
272
|
color: var(--dsw-alias-label-tertiary);
|
|
248
273
|
cursor: pointer;
|
|
249
|
-
transition:
|
|
274
|
+
transition: color .15s;
|
|
275
|
+
}
|
|
276
|
+
.dcc-nav-toggle::before {
|
|
277
|
+
content: "";
|
|
278
|
+
position: absolute;
|
|
279
|
+
top: 50%;
|
|
280
|
+
left: 50%;
|
|
281
|
+
width: 26px;
|
|
282
|
+
height: 20px;
|
|
283
|
+
margin: -10px 0 0 -13px;
|
|
284
|
+
border-radius: var(--dsw-radius-md, 6px);
|
|
285
|
+
background: transparent;
|
|
286
|
+
transition: background-color .15s;
|
|
287
|
+
pointer-events: none;
|
|
250
288
|
}
|
|
251
289
|
.dcc-nav-toggle:hover {
|
|
252
|
-
background:
|
|
290
|
+
background: transparent;
|
|
253
291
|
color: var(--dsw-alias-label-secondary);
|
|
254
292
|
}
|
|
293
|
+
.dcc-nav-toggle:hover::before {
|
|
294
|
+
background: var(--dsw-alias-interactive-bg-hover);
|
|
295
|
+
}
|
|
255
296
|
.dcc-nav-toggle svg {
|
|
256
297
|
display: block;
|
|
257
298
|
width: 14px;
|
|
258
299
|
height: 14px;
|
|
259
|
-
|
|
300
|
+
/* 与宿主工作区折叠箭头同一套曲线:.15s + var(--ds-ease-in-out) */
|
|
301
|
+
transition: transform .15s var(--ds-ease-in-out);
|
|
260
302
|
}
|
|
261
303
|
html[data-dcc-nav="collapsed"] .dcc-nav-toggle svg {
|
|
262
304
|
transform: rotate(180deg);
|
|
@@ -317,42 +359,61 @@ html [class*="_projectRow"]:hover [class*="_chevron"] {
|
|
|
317
359
|
display: none !important;
|
|
318
360
|
}
|
|
319
361
|
|
|
320
|
-
/* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ----------
|
|
362
|
+
/* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ----------
|
|
363
|
+
归在「紧凑圆角与密度」开关下:密度本来就是一整套,字号不再单独开一项。 */
|
|
321
364
|
/* 「工作区」分组标题:更小、更弱,并与下方项目行左对齐 */
|
|
322
|
-
html[data-dcc-
|
|
365
|
+
html[data-dcc-radius="on"] [class*="_sectionHeader"] {
|
|
323
366
|
height: 30px !important;
|
|
324
367
|
margin-bottom: 2px !important;
|
|
325
368
|
}
|
|
326
|
-
html[data-dcc-
|
|
369
|
+
html[data-dcc-radius="on"] [class*="_sectionHeader"] [class*="_sectionLabel"]:not([class*="_sectionLabelHidden"]) {
|
|
327
370
|
font-size: 13px;
|
|
328
371
|
left: -2px;
|
|
329
372
|
opacity: .72;
|
|
330
373
|
color: var(--dsw-alias-label-tertiary);
|
|
331
374
|
}
|
|
332
|
-
html[data-dcc-
|
|
333
|
-
html[data-dcc-
|
|
375
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_title"],
|
|
376
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] [class*="_title"] {
|
|
334
377
|
font-size: 13px !important;
|
|
335
378
|
line-height: 18px !important;
|
|
336
379
|
}
|
|
337
|
-
html[data-dcc-
|
|
380
|
+
html[data-dcc-radius="on"] [class*="_projectRow"] {
|
|
338
381
|
height: 32px !important;
|
|
339
382
|
}
|
|
340
|
-
html[data-dcc-
|
|
383
|
+
html[data-dcc-radius="on"] [class*="_sessionRow"] {
|
|
341
384
|
height: 30px !important;
|
|
342
385
|
}
|
|
343
386
|
/* 左下角账户区:整体压矮一点 */
|
|
344
|
-
html[data-dcc-
|
|
387
|
+
html[data-dcc-radius="on"] [class*="_trigger"][data-signed-out="false"]:not([data-collapsed="true"]) {
|
|
345
388
|
height: 38px !important;
|
|
346
389
|
padding-top: 4px !important;
|
|
347
390
|
padding-bottom: 4px !important;
|
|
348
391
|
gap: 6px !important;
|
|
349
392
|
font-size: 13px !important;
|
|
350
393
|
}
|
|
351
|
-
html[data-dcc-
|
|
394
|
+
html[data-dcc-radius="on"] [class*="_trigger"][data-signed-out="false"] [class*="_avatar"] {
|
|
352
395
|
width: 22px !important;
|
|
353
396
|
height: 22px !important;
|
|
354
397
|
}
|
|
355
398
|
|
|
399
|
+
/* ---------- 工作区 / 会话行的悬停提示卡片 ---------- */
|
|
400
|
+
/* 宿主把卡片挂在 body 下(_card / _preview / _bridge 三段),fixed + z-index:100。
|
|
401
|
+
打开「移除悬停提示」后直接不渲染,滑动侧栏时不再闪出卡片,也不会因定位计算掉帧。 */
|
|
402
|
+
html[data-dcc-hover="off"] [class*="_card_bgejw"],
|
|
403
|
+
html[data-dcc-hover="off"] [class*="_preview_bgejw"],
|
|
404
|
+
html[data-dcc-hover="off"] [class*="_bridge_bgejw"] {
|
|
405
|
+
display: none !important;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* ---------- 会话行悬停按钮 ---------- */
|
|
409
|
+
/* 悬停时行尾会冒出一排按钮:「…」菜单在 rowActions 里,其余(宿主归档、以及各插件
|
|
410
|
+
塞进 rowQuickActions 的按钮)紧跟在后面。DOM 上它们只有同一个 iconButton 类,
|
|
411
|
+
分不出谁是谁,所以保留哪几个由脚本按 data-context-menu-trigger / aria-label 判定,
|
|
412
|
+
再打上 data-dcc-hidden,这里只负责隐藏。 */
|
|
413
|
+
html[data-dcc-row-buttons="on"] [class*="_sessionRow"] [class*="_rowActions"] button[data-dcc-hidden] {
|
|
414
|
+
display: none !important;
|
|
415
|
+
}
|
|
416
|
+
|
|
356
417
|
/* ---------- 已归档会话:标题画删除线 ---------- */
|
|
357
418
|
html [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
|
|
358
419
|
text-decoration: line-through;
|
|
@@ -584,6 +645,23 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
584
645
|
const nav = findNav();
|
|
585
646
|
const count = nav === null ? 0 : nav.children.length;
|
|
586
647
|
btn.style.display = count > 2 ? '' : 'none';
|
|
648
|
+
/* 折叠高度 = 前两项实测高度 + 一项行距;展开高度 = 全部实测高度。
|
|
649
|
+
写进变量后,max-height 的过渡是匀速的,不会「弹一下再停」。 */
|
|
650
|
+
if (nav !== null) {
|
|
651
|
+
const items = Array.from(nav.children);
|
|
652
|
+
const gap = parseFloat(window.getComputedStyle(nav).rowGap) || 0;
|
|
653
|
+
let collapsedHeight = 0;
|
|
654
|
+
let full = 0;
|
|
655
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
656
|
+
const h = items[i].getBoundingClientRect().height;
|
|
657
|
+
full += h;
|
|
658
|
+
if (i < 2) collapsedHeight += h;
|
|
659
|
+
}
|
|
660
|
+
full += Math.max(0, items.length - 1) * gap;
|
|
661
|
+
if (items.length > 1) collapsedHeight += gap;
|
|
662
|
+
nav.style.setProperty('--dcc-nav-collapsed-height', `${Math.ceil(collapsedHeight)}px`);
|
|
663
|
+
nav.style.setProperty('--dcc-nav-expanded-height', `${Math.ceil(full)}px`);
|
|
664
|
+
}
|
|
587
665
|
const collapsed = document.documentElement.dataset.dccNav === 'collapsed';
|
|
588
666
|
const label = collapsed ? (isZh() ? '展开导航' : 'Expand navigation') : (isZh() ? '收起导航' : 'Collapse navigation');
|
|
589
667
|
btn.setAttribute('aria-label', label);
|
|
@@ -716,14 +794,16 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
716
794
|
}, 350);
|
|
717
795
|
};
|
|
718
796
|
|
|
719
|
-
/*
|
|
797
|
+
/* 标题元素被撑满整行,空白处也在它盒子里;只有落在文字实际矩形上才算点击。
|
|
798
|
+
左侧再放宽一点,把标题与返回箭头之间那段 padding 空隙也算进来。 */
|
|
799
|
+
const LABEL_LEFT_SLACK = 14;
|
|
720
800
|
const hitsLabel = (title, event) => {
|
|
721
801
|
const range = document.createRange();
|
|
722
802
|
range.selectNodeContents(title);
|
|
723
803
|
const rects = range.getClientRects();
|
|
724
804
|
for (let i = 0; i < rects.length; i += 1) {
|
|
725
805
|
const rect = rects[i];
|
|
726
|
-
if (event.clientX >= rect.left && event.clientX <= rect.right
|
|
806
|
+
if (event.clientX >= rect.left - LABEL_LEFT_SLACK && event.clientX <= rect.right
|
|
727
807
|
&& event.clientY >= rect.top && event.clientY <= rect.bottom) return true;
|
|
728
808
|
}
|
|
729
809
|
return false;
|
|
@@ -784,6 +864,84 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
784
864
|
};
|
|
785
865
|
}
|
|
786
866
|
|
|
867
|
+
/**
|
|
868
|
+
* 会话行悬停时只留「…」菜单和置顶按钮,其余(宿主的归档、各插件加的)隐藏。
|
|
869
|
+
* 按钮上只有共用的 iconButton 类,所以按 data-context-menu-trigger 和 aria-label
|
|
870
|
+
* 认人:菜单按钮带前者,置顶按钮的 aria-label 里是「置顶会话 / 取消置顶 / pin」。
|
|
871
|
+
*/
|
|
872
|
+
function installRowActionFilter() {
|
|
873
|
+
let observer = null;
|
|
874
|
+
let timer = null;
|
|
875
|
+
let lastRow = null;
|
|
876
|
+
|
|
877
|
+
const isPinButton = (btn) => /置顶|pin/i.test(btn.getAttribute('aria-label') || '');
|
|
878
|
+
|
|
879
|
+
const filterRow = (row) => {
|
|
880
|
+
if (row === null) return;
|
|
881
|
+
const actions = row.querySelector('[class*="_rowActions"]');
|
|
882
|
+
if (actions === null) return;
|
|
883
|
+
const buttons = Array.from(actions.querySelectorAll('button'));
|
|
884
|
+
/* 认不出置顶按钮(例如界面是其它语言,或这一行本来就没有置顶)时整行不动:
|
|
885
|
+
宁可不生效,也不要把用户需要的按钮误藏掉。 */
|
|
886
|
+
if (!buttons.some(isPinButton)) return;
|
|
887
|
+
for (const btn of buttons) {
|
|
888
|
+
const keep = btn.hasAttribute('data-context-menu-trigger') || isPinButton(btn);
|
|
889
|
+
if (keep) {
|
|
890
|
+
if (btn.hasAttribute('data-dcc-hidden')) btn.removeAttribute('data-dcc-hidden');
|
|
891
|
+
} else if (!btn.hasAttribute('data-dcc-hidden')) {
|
|
892
|
+
btn.setAttribute('data-dcc-hidden', '');
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const onPointer = (event) => {
|
|
898
|
+
if (document.documentElement.dataset.dccRowButtons !== 'on') return;
|
|
899
|
+
const target = event.target;
|
|
900
|
+
if (!(target instanceof Element)) return;
|
|
901
|
+
const row = target.closest('[class*="_sessionRow"]');
|
|
902
|
+
if (row === null || row === lastRow) return;
|
|
903
|
+
lastRow = row;
|
|
904
|
+
filterRow(row);
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
/* 兜底:行是复用的,按钮可能在后来的渲染里才挂上去,定期把没扫过的行补一遍 */
|
|
908
|
+
const sweep = () => {
|
|
909
|
+
if (document.documentElement.dataset.dccRowButtons !== 'on') return;
|
|
910
|
+
const rows = document.querySelectorAll('[class*="_sessionRow"]:not([data-dcc-scanned])');
|
|
911
|
+
for (const row of rows) {
|
|
912
|
+
filterRow(row);
|
|
913
|
+
row.setAttribute('data-dcc-scanned', '');
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
const schedule = () => {
|
|
918
|
+
if (timer !== null) return;
|
|
919
|
+
timer = window.setTimeout(() => {
|
|
920
|
+
timer = null;
|
|
921
|
+
lastRow = null;
|
|
922
|
+
sweep();
|
|
923
|
+
}, 400);
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
document.addEventListener('pointerover', onPointer, true);
|
|
927
|
+
document.addEventListener('focusin', onPointer, true);
|
|
928
|
+
sweep();
|
|
929
|
+
observer = new MutationObserver(schedule);
|
|
930
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
931
|
+
|
|
932
|
+
return () => {
|
|
933
|
+
document.removeEventListener('pointerover', onPointer, true);
|
|
934
|
+
document.removeEventListener('focusin', onPointer, true);
|
|
935
|
+
observer.disconnect();
|
|
936
|
+
if (timer !== null) clearTimeout(timer);
|
|
937
|
+
const marked = document.querySelectorAll('[data-dcc-hidden], [data-dcc-scanned]');
|
|
938
|
+
for (const el of marked) {
|
|
939
|
+
el.removeAttribute('data-dcc-hidden');
|
|
940
|
+
el.removeAttribute('data-dcc-scanned');
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
787
945
|
function Switch(props) {
|
|
788
946
|
return h('label', { className: 'dcc-switch' },
|
|
789
947
|
h('input', {
|
|
@@ -818,63 +976,74 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
818
976
|
return h('div', { className: 'dcc-page' },
|
|
819
977
|
h('div', { className: 'dcc-title' }, zh ? 'UI 改进' : 'UI improvements'),
|
|
820
978
|
h('p', { className: 'dcc-intro' },
|
|
821
|
-
zh ? '
|
|
979
|
+
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
980
|
h('div', { className: 'dcc-group' },
|
|
823
981
|
h('div', { className: 'dcc-group-title' }, zh ? '外观' : 'Appearance'),
|
|
824
982
|
h(Row, {
|
|
825
|
-
title: zh ? '
|
|
826
|
-
desc: zh ? '
|
|
983
|
+
title: zh ? '隐藏左上角 Logo' : 'Hide the top-left logo',
|
|
984
|
+
desc: zh ? '隐藏侧栏顶部的 Logo。' : 'Hide the logo at the top of the sidebar.',
|
|
985
|
+
checked: prefs.hideLogo,
|
|
986
|
+
onChange: update('hideLogo'),
|
|
987
|
+
}),
|
|
988
|
+
h(Row, {
|
|
989
|
+
title: zh ? 'Windows 默认微软雅黑字体' : 'Microsoft YaHei on Windows',
|
|
990
|
+
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
991
|
checked: prefs.winFont,
|
|
828
992
|
onChange: update('winFont'),
|
|
829
|
-
}),
|
|
993
|
+
})),
|
|
994
|
+
h('div', { className: 'dcc-group' },
|
|
995
|
+
h('div', { className: 'dcc-group-title' }, zh ? '布局' : 'Layout'),
|
|
830
996
|
h(Row, {
|
|
831
|
-
title: zh ? '
|
|
832
|
-
desc: zh ? '
|
|
997
|
+
title: zh ? '减小圆角与紧凑界面' : 'Smaller radii and a tighter layout',
|
|
998
|
+
desc: zh ? '缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效。' : 'Smaller global radii, smaller sidebar type and tighter spacing, for a more efficient interface.',
|
|
833
999
|
checked: prefs.radiusDensity,
|
|
834
1000
|
onChange: update('radiusDensity'),
|
|
835
1001
|
}),
|
|
836
1002
|
h(Row, {
|
|
837
|
-
title: zh ? '
|
|
838
|
-
desc: zh ? '
|
|
1003
|
+
title: zh ? '统一新会话按钮样式' : 'Unified new-session button',
|
|
1004
|
+
desc: zh ? '将新会话按钮样式改为与导航按钮一致的样式。' : 'Style the new-session button the same as the navigation buttons.',
|
|
839
1005
|
checked: prefs.invertNewSession,
|
|
840
1006
|
onChange: update('invertNewSession'),
|
|
841
1007
|
}),
|
|
842
1008
|
h(Row, {
|
|
843
|
-
title: zh ? '
|
|
844
|
-
desc: zh ? '
|
|
1009
|
+
title: zh ? '折叠侧栏导航功能' : 'Collapsible sidebar navigation',
|
|
1010
|
+
desc: zh ? '折叠侧栏导航功能,可点击箭头展开收起。' : 'Collapse the sidebar navigation; click the arrow to expand or collapse it.',
|
|
845
1011
|
checked: prefs.collapseNav,
|
|
846
1012
|
onChange: update('collapseNav'),
|
|
847
1013
|
}),
|
|
848
1014
|
h(Row, {
|
|
849
1015
|
title: zh ? '弱化工作区名称' : 'Dim workspace names',
|
|
850
|
-
desc: zh ? '
|
|
1016
|
+
desc: zh ? '工作区名称弱化,使工作区和会话更易区分。' : 'Dim workspace names so workspaces and sessions are easier to tell apart.',
|
|
851
1017
|
checked: prefs.dimSessions,
|
|
852
1018
|
onChange: update('dimSessions'),
|
|
853
1019
|
}),
|
|
854
1020
|
h(Row, {
|
|
855
|
-
title: zh ? '
|
|
856
|
-
desc: zh ? '
|
|
857
|
-
checked: prefs.
|
|
858
|
-
onChange: update('
|
|
1021
|
+
title: zh ? '会话前圆点' : 'Session leading dot',
|
|
1022
|
+
desc: zh ? '会话前显示一个圆点。' : 'Show a dot before each session.',
|
|
1023
|
+
checked: prefs.sessionDot,
|
|
1024
|
+
onChange: update('sessionDot'),
|
|
859
1025
|
}),
|
|
860
1026
|
h(Row, {
|
|
861
|
-
title: zh ? '
|
|
862
|
-
desc: zh ? '
|
|
863
|
-
checked: prefs.
|
|
864
|
-
onChange: update('
|
|
1027
|
+
title: zh ? '移除工作区与会话悬停提示' : 'Remove workspace and session hover hints',
|
|
1028
|
+
desc: zh ? '悬停在侧栏工作区、会话上时,不再显示详情卡片。使滚动更流畅。' : 'Hovering a workspace or session no longer shows a details card, which keeps scrolling smooth.',
|
|
1029
|
+
checked: prefs.hideHoverCard,
|
|
1030
|
+
onChange: update('hideHoverCard'),
|
|
865
1031
|
}),
|
|
866
1032
|
h(Row, {
|
|
867
|
-
title: zh ? '
|
|
868
|
-
desc: zh ? '
|
|
869
|
-
checked: prefs.
|
|
870
|
-
onChange: update('
|
|
1033
|
+
title: zh ? '隐藏会话悬停多余按钮' : 'Hide extra session-row buttons',
|
|
1034
|
+
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.',
|
|
1035
|
+
checked: prefs.hideRowButtons,
|
|
1036
|
+
onChange: update('hideRowButtons'),
|
|
871
1037
|
}),
|
|
872
1038
|
h(Row, {
|
|
873
1039
|
title: zh ? '设置面板全屏' : 'Full-screen settings panel',
|
|
874
|
-
desc: zh ? '
|
|
1040
|
+
desc: zh ? '使用非窗口化的设置页面。' : 'Use a non-windowed settings page.',
|
|
875
1041
|
checked: prefs.settingsFullscreen,
|
|
876
1042
|
onChange: update('settingsFullscreen'),
|
|
877
|
-
}))
|
|
1043
|
+
})),
|
|
1044
|
+
h('p', { className: 'dcc-meta' },
|
|
1045
|
+
/* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
|
|
1046
|
+
zh ? `版本:${VERSION}\u3000更新日期:${UPDATED}` : `Version: ${VERSION} Updated: ${UPDATED}`));
|
|
878
1047
|
}
|
|
879
1048
|
|
|
880
1049
|
function SectionIcon(props) {
|
|
@@ -905,21 +1074,24 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
|
|
|
905
1074
|
const removeNewSessionRow = installNewSessionRow();
|
|
906
1075
|
const removeNavToggle = installNavToggle();
|
|
907
1076
|
const removeSettingsBack = installSettingsBackButton();
|
|
1077
|
+
const removeRowActionFilter = installRowActionFilter();
|
|
908
1078
|
return () => {
|
|
909
1079
|
removeCss();
|
|
910
1080
|
removeNewSessionRow();
|
|
911
1081
|
removeNavToggle();
|
|
912
1082
|
removeSettingsBack();
|
|
1083
|
+
removeRowActionFilter();
|
|
913
1084
|
const root = document.documentElement;
|
|
914
1085
|
delete root.dataset.dccRadius;
|
|
915
1086
|
delete root.dataset.dccNew;
|
|
916
1087
|
delete root.dataset.dccNav;
|
|
917
1088
|
delete root.dataset.dccDim;
|
|
918
1089
|
delete root.dataset.dccLogo;
|
|
919
|
-
delete root.dataset.dccWs;
|
|
920
1090
|
delete root.dataset.dccDot;
|
|
921
1091
|
delete root.dataset.dccFont;
|
|
922
1092
|
delete root.dataset.dccFull;
|
|
1093
|
+
delete root.dataset.dccHover;
|
|
1094
|
+
delete root.dataset.dccRowButtons;
|
|
923
1095
|
};
|
|
924
1096
|
}, 'dsh-ui-alt: styles and preference attributes');
|
|
925
1097
|
|
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.10",
|
|
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": [
|