dsh-ui-alt 0.2.8 → 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 CHANGED
@@ -1,22 +1,30 @@
1
1
  # dsh-ui-alt
2
2
 
3
- 基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进,让界面更专业、冷静、易读。同时把「新会话」「导航折叠」这些常用控件收进更顺手的位置。
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
- | Windows 默认字体微软雅黑 | 开 | 设置里未指定正文字体时,Windows 用微软雅黑;已指定则用户的字体优先,macOS 不受影响 |
12
- | 紧凑圆角与密度 | 开 | 缩小全局圆角阶梯、收紧间距、减弱阴影,发送按钮由圆形改为小圆角方形 |
13
- | 统一新会话按钮 | 开 | 「新会话」变成导航行的一员,只保留半透明高亮;折叠窄栏时仍用原按钮 |
14
- | 折叠侧栏导航 | 开 | 只显示前两项导航,点列表下方的箭头展开/收起,状态会记住 |
15
- | 弱化工作区名称 | 开 | 工作区名称用更弱的文字色,「展开其余 N 个会话」进一步淡化 |
16
- | 隐藏左上角 Logo | 关 | 隐藏侧栏顶部的品牌标记,下方内容自动补位 |
17
- | 工作区标题与会话小一号 | 开 | 标题 13px、会话行 30px、项目行 32px,左下账户区一并压矮 |
18
- | 会话前圆点 | 开 | 会话行前显示一个淡化的 4px 小圆点;与收藏星标同位置时自动让位 |
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: 500; color: var(--dsw-alias-label-primary); }
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
- .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; }
89
- .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; }
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
- 之前用 max-height 估算高度,多出来的空白会露在列表和箭头之间,
231
- 改成 display:none 后高度完全由剩下的行决定。 */
232
- html[data-dcc-nav="collapsed"] nav[class*="_panelList"] > *:nth-child(n + 3) {
233
- display: none;
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 2px;
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: background-color .15s, color .15s;
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: var(--dsw-alias-interactive-bg-hover);
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
- transition: transform .18s ease;
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-ws="on"] [class*="_sectionHeader"] {
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-ws="on"] [class*="_sectionHeader"] [class*="_sectionLabel"]:not([class*="_sectionLabelHidden"]) {
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-ws="on"] [class*="_projectRow"] [class*="_title"],
333
- html[data-dcc-ws="on"] [class*="_sessionRow"] [class*="_title"] {
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-ws="on"] [class*="_projectRow"] {
380
+ html[data-dcc-radius="on"] [class*="_projectRow"] {
338
381
  height: 32px !important;
339
382
  }
340
- html[data-dcc-ws="on"] [class*="_sessionRow"] {
383
+ html[data-dcc-radius="on"] [class*="_sessionRow"] {
341
384
  height: 30px !important;
342
385
  }
343
386
  /* 左下角账户区:整体压矮一点 */
344
- html[data-dcc-ws="on"] [class*="_trigger"][data-signed-out="false"]:not([data-collapsed="true"]) {
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-ws="on"] [class*="_trigger"][data-signed-out="false"] [class*="_avatar"] {
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;
@@ -421,6 +482,7 @@ html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="
421
482
  }
422
483
  html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navTitle"] {
423
484
  padding-left: 52px !important;
485
+ /* 手型由脚本按文字实际矩形设置,见 installSettingsBackButton */
424
486
  }
425
487
  /* 设置导航项:略矮一点(与全屏与否无关,始终生效) */
426
488
  html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navCell"] {
@@ -445,10 +507,16 @@ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navCell"] {
445
507
  background: transparent;
446
508
  color: var(--dsw-alias-label-primary);
447
509
  cursor: pointer;
510
+ transition: background-color .15s;
448
511
  }
449
512
  .dcc-settings-back:hover {
450
513
  background: var(--dsw-alias-interactive-bg-hover);
451
514
  }
515
+ /* 悬停「设置」标题时,左侧箭头一起高亮。
516
+ 标题盒子撑满整行,:hover 会连空白一起算,所以这里认脚本按文字矩形写的属性。 */
517
+ html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"][data-dcc-hot="on"]) .dcc-settings-back {
518
+ background: var(--dsw-alias-interactive-bg-hover);
519
+ }
452
520
  /* 非全屏时用宿主自己的关闭按钮,自绘的返回箭头不出现 */
453
521
  html[data-dcc-full="off"] .dcc-settings-back {
454
522
  display: none !important;
@@ -577,6 +645,23 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
577
645
  const nav = findNav();
578
646
  const count = nav === null ? 0 : nav.children.length;
579
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
+ }
580
665
  const collapsed = document.documentElement.dataset.dccNav === 'collapsed';
581
666
  const label = collapsed ? (isZh() ? '展开导航' : 'Expand navigation') : (isZh() ? '收起导航' : 'Collapse navigation');
582
667
  btn.setAttribute('aria-label', label);
@@ -636,17 +721,25 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
636
721
 
637
722
  /**
638
723
  * 设置面板左上角的返回按钮:点击触发原关闭按钮,保留原关闭逻辑。
724
+ * 面板挂载时走 requestAnimationFrame 在下一帧补上,不让按钮比面板慢一拍;
725
+ * 其它 DOM 变动仍用 350ms 兜底,避免流式输出时每帧都做全局查询。
639
726
  */
640
727
  function installSettingsBackButton() {
641
728
  let btn = null;
642
729
  let observer = null;
643
730
  let timer = null;
731
+ let rafId = 0;
644
732
 
645
733
  const findPanel = () => {
646
734
  const title = document.querySelector('[class*="_navTitle"]');
647
735
  return title === null ? null : title.parentElement;
648
736
  };
649
737
 
738
+ const closePanel = (panel) => {
739
+ const close = panel.querySelector('[class*="_header"] [class*="_close"]');
740
+ if (close !== null) close.click();
741
+ };
742
+
650
743
  const ensure = () => {
651
744
  const panel = findPanel();
652
745
  if (panel === null) {
@@ -664,14 +757,36 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
664
757
  btn.innerHTML = '<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true">'
665
758
  + '<path d="M10 3 5 8l5 5" fill="none" stroke="currentColor" stroke-width="1.6"'
666
759
  + ' stroke-linecap="round" stroke-linejoin="round"/></svg>';
667
- btn.addEventListener('click', () => {
668
- const close = panel.querySelector('[class*="_header"] [class*="_close"]');
669
- if (close !== null) close.click();
670
- });
760
+ btn.addEventListener('click', () => closePanel(panel));
671
761
  panel.appendChild(btn);
672
762
  };
673
763
 
674
- const schedule = () => {
764
+ const insertSoon = () => {
765
+ if (rafId !== 0) return;
766
+ rafId = window.requestAnimationFrame(() => {
767
+ rafId = 0;
768
+ ensure();
769
+ /* 万一这一帧面板还没挂完,退回原来的兜底节奏 */
770
+ if (btn === null && timer === null) {
771
+ timer = window.setTimeout(() => {
772
+ timer = null;
773
+ ensure();
774
+ }, 350);
775
+ }
776
+ });
777
+ };
778
+
779
+ const schedule = (records) => {
780
+ /* 面板是「新增了包含 _navTitle 的节点」,这类变动要求下一帧就有按钮 */
781
+ for (const record of records) {
782
+ for (const node of record.addedNodes) {
783
+ if (node.nodeType !== 1) continue;
784
+ if (node.matches('[class*="_navTitle"]') || node.querySelector('[class*="_navTitle"]') !== null) {
785
+ insertSoon();
786
+ return;
787
+ }
788
+ }
789
+ }
675
790
  if (timer !== null) return;
676
791
  timer = window.setTimeout(() => {
677
792
  timer = null;
@@ -679,17 +794,154 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
679
794
  }, 350);
680
795
  };
681
796
 
797
+ /* 标题元素被撑满整行,空白处也在它盒子里;只有落在文字实际矩形上才算点击。
798
+ 左侧再放宽一点,把标题与返回箭头之间那段 padding 空隙也算进来。 */
799
+ const LABEL_LEFT_SLACK = 14;
800
+ const hitsLabel = (title, event) => {
801
+ const range = document.createRange();
802
+ range.selectNodeContents(title);
803
+ const rects = range.getClientRects();
804
+ for (let i = 0; i < rects.length; i += 1) {
805
+ const rect = rects[i];
806
+ if (event.clientX >= rect.left - LABEL_LEFT_SLACK && event.clientX <= rect.right
807
+ && event.clientY >= rect.top && event.clientY <= rect.bottom) return true;
808
+ }
809
+ return false;
810
+ };
811
+
812
+ /* 点面板标题(「设置」这几个字)也能返回;用委托,面板重渲染不会丢监听 */
813
+ const onClick = (event) => {
814
+ if (document.documentElement.dataset.dccFull !== 'on') return;
815
+ const target = event.target;
816
+ if (!(target instanceof Element)) return;
817
+ const title = target.closest('[class*="_navTitle"]');
818
+ if (title === null || title.parentElement === null) return;
819
+ if (!hitsLabel(title, event)) return;
820
+ closePanel(title.parentElement);
821
+ };
822
+
823
+ /* 手型和高亮都只跟着文字走:整行都是标题的盒子,空白不该有可点反馈 */
824
+ let cursorTitle = null;
825
+ const clearHot = () => {
826
+ if (cursorTitle === null) return;
827
+ cursorTitle.style.cursor = '';
828
+ cursorTitle.dataset.dccHot = 'off';
829
+ cursorTitle = null;
830
+ };
831
+ const onMove = (event) => {
832
+ if (document.documentElement.dataset.dccFull !== 'on') {
833
+ clearHot();
834
+ return;
835
+ }
836
+ const target = event.target;
837
+ const title = target instanceof Element ? target.closest('[class*="_navTitle"]') : null;
838
+ if (title === null) {
839
+ clearHot();
840
+ return;
841
+ }
842
+ const hot = hitsLabel(title, event);
843
+ const want = hot ? 'pointer' : '';
844
+ if (title.style.cursor !== want) title.style.cursor = want;
845
+ const wantHot = hot ? 'on' : 'off';
846
+ if (title.dataset.dccHot !== wantHot) title.dataset.dccHot = wantHot;
847
+ cursorTitle = title;
848
+ };
849
+
682
850
  ensure();
683
851
  observer = new MutationObserver(schedule);
684
852
  observer.observe(document.body, { childList: true, subtree: true });
853
+ document.addEventListener('click', onClick, true);
854
+ document.addEventListener('mousemove', onMove, true);
685
855
 
686
856
  return () => {
687
857
  observer.disconnect();
688
858
  if (timer !== null) clearTimeout(timer);
859
+ if (rafId !== 0) window.cancelAnimationFrame(rafId);
860
+ document.removeEventListener('click', onClick, true);
861
+ document.removeEventListener('mousemove', onMove, true);
862
+ if (cursorTitle !== null) clearHot();
689
863
  if (btn !== null) btn.remove();
690
864
  };
691
865
  }
692
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
+
693
945
  function Switch(props) {
694
946
  return h('label', { className: 'dcc-switch' },
695
947
  h('input', {
@@ -724,63 +976,74 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
724
976
  return h('div', { className: 'dcc-page' },
725
977
  h('div', { className: 'dcc-title' }, zh ? 'UI 改进' : 'UI improvements'),
726
978
  h('p', { className: 'dcc-intro' },
727
- 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.'),
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.'),
728
980
  h('div', { className: 'dcc-group' },
729
981
  h('div', { className: 'dcc-group-title' }, zh ? '外观' : 'Appearance'),
730
982
  h(Row, {
731
- title: zh ? 'Windows 默认字体微软雅黑' : 'Microsoft YaHei on Windows',
732
- desc: zh ? '仅当设置里没填正文字体时生效;填了字体则以你的设置为准。macOS 不受影响。' : 'Applies only when no body font is set in Settings; your own font still wins. macOS is unaffected.',
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.',
733
991
  checked: prefs.winFont,
734
992
  onChange: update('winFont'),
735
- }),
993
+ })),
994
+ h('div', { className: 'dcc-group' },
995
+ h('div', { className: 'dcc-group-title' }, zh ? '布局' : 'Layout'),
736
996
  h(Row, {
737
- title: zh ? '紧凑圆角与密度' : 'Compact radius and density',
738
- desc: zh ? '缩小全局圆角、收紧间距并降低阴影。' : 'Shrink the global radius scale, tighten spacing and soften shadows.',
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.',
739
999
  checked: prefs.radiusDensity,
740
1000
  onChange: update('radiusDensity'),
741
1001
  }),
742
1002
  h(Row, {
743
- title: zh ? '统一新会话按钮' : 'Unified new-session button',
744
- desc: zh ? '把新会话做成与导航行一致、只保留半透明高亮的按钮。' : 'Make the new-session row match the nav rows, with only a translucent highlight.',
1003
+ title: zh ? '统一新会话按钮样式' : 'Unified new-session button',
1004
+ desc: zh ? '将新会话按钮样式改为与导航按钮一致的样式。' : 'Style the new-session button the same as the navigation buttons.',
745
1005
  checked: prefs.invertNewSession,
746
1006
  onChange: update('invertNewSession'),
747
1007
  }),
748
1008
  h(Row, {
749
- title: zh ? '折叠侧栏导航' : 'Collapse sidebar navigation',
750
- desc: zh ? '只显示前两个导航项,用导航下方的箭头展开或收起。' : 'Show the first two nav items; use the arrow below the list to expand or collapse.',
1009
+ title: zh ? '折叠侧栏导航功能' : 'Collapsible sidebar navigation',
1010
+ desc: zh ? '折叠侧栏导航功能,可点击箭头展开收起。' : 'Collapse the sidebar navigation; click the arrow to expand or collapse it.',
751
1011
  checked: prefs.collapseNav,
752
1012
  onChange: update('collapseNav'),
753
1013
  }),
754
1014
  h(Row, {
755
1015
  title: zh ? '弱化工作区名称' : 'Dim workspace names',
756
- desc: zh ? '工作区名称用更弱的文字色,会话标题保持正常。' : 'Workspace names use a weaker text color; session titles stay normal.',
1016
+ desc: zh ? '工作区名称弱化,使工作区和会话更易区分。' : 'Dim workspace names so workspaces and sessions are easier to tell apart.',
757
1017
  checked: prefs.dimSessions,
758
1018
  onChange: update('dimSessions'),
759
1019
  }),
760
1020
  h(Row, {
761
- title: zh ? '隐藏左上角 Logo' : 'Hide corner logo',
762
- desc: zh ? '隐藏侧栏顶部的品牌标记。' : 'Hide the brand mark at the top of the sidebar.',
763
- checked: prefs.hideLogo,
764
- onChange: update('hideLogo'),
1021
+ title: zh ? '会话前圆点' : 'Session leading dot',
1022
+ desc: zh ? '会话前显示一个圆点。' : 'Show a dot before each session.',
1023
+ checked: prefs.sessionDot,
1024
+ onChange: update('sessionDot'),
765
1025
  }),
766
1026
  h(Row, {
767
- title: zh ? '工作区标题与会话小一号' : 'Smaller workspace and sessions',
768
- desc: zh ? '侧栏工作区名称与会话标题使用更小的字号。' : 'Use a smaller font size for sidebar workspace names and session titles.',
769
- checked: prefs.workspaceSmall,
770
- onChange: update('workspaceSmall'),
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'),
771
1031
  }),
772
1032
  h(Row, {
773
- title: zh ? '会话前圆点' : 'Session leading dot',
774
- desc: zh ? '在会话行前显示一个淡化的小圆点。' : 'Show a faint dot before each session row.',
775
- checked: prefs.sessionDot,
776
- onChange: update('sessionDot'),
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'),
777
1037
  }),
778
1038
  h(Row, {
779
1039
  title: zh ? '设置面板全屏' : 'Full-screen settings panel',
780
- desc: zh ? '设置面板铺满窗口,隐藏右上角关闭按钮,改用左上角返回箭头;关闭后恢复为居中对话框。' : 'Fill the window with the settings panel, replace its close button with a back arrow at the top left; off restores the centered dialog.',
1040
+ desc: zh ? '使用非窗口化的设置页面。' : 'Use a non-windowed settings page.',
781
1041
  checked: prefs.settingsFullscreen,
782
1042
  onChange: update('settingsFullscreen'),
783
- })));
1043
+ })),
1044
+ h('p', { className: 'dcc-meta' },
1045
+ /* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
1046
+ zh ? `版本:${VERSION}\u3000更新日期:${UPDATED}` : `Version: ${VERSION} Updated: ${UPDATED}`));
784
1047
  }
785
1048
 
786
1049
  function SectionIcon(props) {
@@ -811,21 +1074,24 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
811
1074
  const removeNewSessionRow = installNewSessionRow();
812
1075
  const removeNavToggle = installNavToggle();
813
1076
  const removeSettingsBack = installSettingsBackButton();
1077
+ const removeRowActionFilter = installRowActionFilter();
814
1078
  return () => {
815
1079
  removeCss();
816
1080
  removeNewSessionRow();
817
1081
  removeNavToggle();
818
1082
  removeSettingsBack();
1083
+ removeRowActionFilter();
819
1084
  const root = document.documentElement;
820
1085
  delete root.dataset.dccRadius;
821
1086
  delete root.dataset.dccNew;
822
1087
  delete root.dataset.dccNav;
823
1088
  delete root.dataset.dccDim;
824
1089
  delete root.dataset.dccLogo;
825
- delete root.dataset.dccWs;
826
1090
  delete root.dataset.dccDot;
827
1091
  delete root.dataset.dccFont;
828
1092
  delete root.dataset.dccFull;
1093
+ delete root.dataset.dccHover;
1094
+ delete root.dataset.dccRowButtons;
829
1095
  };
830
1096
  }, 'dsh-ui-alt: styles and preference attributes');
831
1097
 
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
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."
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "UI 改进",
4
- "description": "基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进。使 UI 更加专业、冷静、易读。可在设置中单独开关每一项改动。"
4
+ "description": "在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。可在设置中单独调整每一项改动。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "dsh-ui-alt",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "基于原版 UI 进行紧凑化、减小圆角、秩序化、整洁化改进。使 UI 更加专业、冷静、易读。可在设置中单独开关每一项改动。",
6
+ "description": "在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。可在设置中单独调整每一项改动。",
7
7
  "license": "MIT",
8
8
  "author": "AomiRaku",
9
9
  "keywords": [