dsh-ui-alt 0.2.13 → 0.2.86

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,6 +1,6 @@
1
1
  # dsh-ui-alt
2
2
 
3
- 在保持原版 UI 大风格不变的情况下,进行减小圆角、紧凑化、秩序化、整洁化改进。使 UI 视觉更加冷静、专业、高效。多数改动可在设置中单独开关。
3
+ 在保持原版 UI 大体布局不变的情况下,进行减小圆角、紧凑化、整洁化、高效化改进,使 UI 视觉更加冷静、专业、高效。同时添加余额显示。大部分改动可在设置中单独开关。
4
4
 
5
5
  插件由 CSS 覆盖加少量 DOM 注入组成,所有改动都可以在 设置 →「UI 改进」里逐项开关;关掉开关即恢复原版外观。
6
6
 
@@ -11,13 +11,14 @@
11
11
  | 开关 | 默认 | 效果 |
12
12
  | --- | --- | --- |
13
13
  | 隐藏左上角 Logo | 关 | 隐藏侧栏顶部的 Logo |
14
- | Windows 默认微软雅黑字体 | 关 | Windows 端默认字体改为微软雅黑,低分辨率屏幕 200% 以下缩放带 hinting,更锐利;手动设置字体或 macOS 不受影响 |
14
+ | Windows 默认微软雅黑字体 | 关 | 将 Windows 端默认字体改为微软雅黑。微软雅黑带有 hinting,使文字在显示设置低于 200% 缩放比例下,更加锐利清晰。若手动设置了字体,或使用 macOS 端,则不受影响 |
15
15
 
16
16
  **布局**
17
17
 
18
18
  | 开关 | 默认 | 效果 |
19
19
  | --- | --- | --- |
20
- | 减小圆角与紧凑界面 | 开 | 缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效 |
20
+ | 减小圆角与间距 | 开 | 缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效 |
21
+ | 会话标题栏紧凑化 | 开 | 紧凑化会话标题栏,使会话内容可视范围更大 |
21
22
  | 统一新会话按钮样式 | 开 | 新会话按钮样式改为与导航按钮一致 |
22
23
  | 折叠侧栏导航功能 | 开 | 折叠侧栏导航,点击箭头展开收起 |
23
24
  | 弱化工作区名称 | 开 | 工作区名称弱化,使工作区和会话更易区分 |
@@ -26,6 +27,22 @@
26
27
  | 隐藏会话悬停多余按钮 | 开 | 悬停会话行时只保留菜单和置顶,其余按钮(含插件添加的)隐藏;若有插件按钮未在右键菜单中,可关闭 |
27
28
  | 设置面板全屏 | 开 | 使用非窗口化的设置页面 |
28
29
 
30
+ **性能与用量信息**
31
+
32
+ | 开关 | 默认 | 效果 |
33
+ | --- | --- | --- |
34
+ | 优化布局 | 开 | 优化输入框下方性能与用量布局,将数据分布在左右两侧平衡视觉重心 |
35
+ | 显示余额 | 开 | 在输入框下方性能与用量中显示账户余额 |
36
+ | 余额警告阈值 | 3 | 余额低于此值将变为红色,最小为 0 |
37
+ | 余额小数位数 | 2 | 余额显示的小数位数 |
38
+
39
+ **规范化**
40
+
41
+ | 开关 | 默认 | 效果 |
42
+ | --- | --- | --- |
43
+ | 指针样式规范化 | 开 | 遵循桌面软件的指针样式规范,仅链接等跳转性元素会更改指针样式为「手形」 |
44
+ | 文本可选中限制 | 开 | 遵循桌面软件的规范,使 UI 界面元素的文本不可被选中;消息正文、会话标题与输入框仍可选中 |
45
+
29
46
  另有一些不挂开关的固定样式:设置导航列宽 220px、归档会话标题画删除线、选择题选中项的序号反色高亮、浅色主题下选中会话背景加强、工作区行悬停时保持文件夹图标。
30
47
 
31
48
  ## 安装
@@ -55,6 +72,12 @@ plugin_manager install_bundle target=<本仓库绝对路径>
55
72
  | `data-dcc-font` | `on` / `off` |
56
73
  | `data-dcc-full` | `on` / `off` |
57
74
  | `data-dcc-hover` | `on` / `off` |
75
+ | `data-dcc-row-buttons` | `on` / `off` |
76
+ | `data-dcc-compact-header` | `on` / `off` |
77
+ | `data-dcc-stats` | `on` / `off` |
78
+ | `data-dcc-balance` | `on` / `off` |
79
+ | `data-dcc-pointer` | `on` / `off` |
80
+ | `data-dcc-select` | `on` / `off` |
58
81
 
59
82
  ## 目录结构
60
83
 
@@ -110,7 +133,12 @@ plugin_manager install_bundle target=<本仓库绝对路径>
110
133
  - 克隆出来的新会话行没有原按钮的 Tooltip 与快捷键提示(点击行为已转发,功能正常)。
111
134
  - 设置返回按钮依赖宿主的 `_navTitle` / `_close` 类名。
112
135
  - 「统一新会话按钮」关闭时,折叠导航的首位是隐藏的克隆行,计数偏移一项;显示效果正常。
113
- - 滚动时鼠标划过会话行会触发宿主的 HoverCard 预览,可能造成卡顿;这是宿主行为,插件侧没有干预。
136
+ - 侧栏悬停与滚动的开销主要来自宿主自身的样式重算(实测渲染占 60% 以上,脚本仅 4%),插件已在事件层拦掉了悬停卡片,但无法消除宿主这一层的成本。
137
+ - 余额取自宿主账户接口,未登录或接口不可用时该项不显示;余额每分钟刷新一次。
138
+ - 余额警告阈值只接受非负数值,负数或非法输入会被归零。
139
+ - 余额用伪元素渲染(这样余额刷新时不会闪),因此图标只能用 `background-image` 贴上去、颜色写死为中灰;低于阈值时也是整段变红,做不到只染数字。
140
+ - 「指针样式规范化」会把拖拽、缩放手柄的 `grab` / `resize` 光标一并压成箭头(拖拽功能本身不受影响)。
141
+ - 「文本可选中限制」依赖宿主的 `_action` / `_time` 等类名片段来排除操作栏;宿主若改名,可能需要补充排除项。
114
142
 
115
143
  ## License
116
144
 
package/client.js CHANGED
@@ -6,8 +6,8 @@ window.__ModuleLoader__.load({
6
6
 
7
7
  const STORAGE_KEY = 'dsh-ui-alt:prefs:v1';
8
8
  /* 发版时与 package.json 的 version 一起改:设置页底部会显示这两个值 */
9
- const VERSION = '0.2.13';
10
- const UPDATED = '2026-11-09';
9
+ const VERSION = '0.2.86';
10
+ const UPDATED = '2026-11-11';
11
11
  const DEFAULTS = {
12
12
  radiusDensity: true,
13
13
  invertNewSession: true,
@@ -19,6 +19,13 @@ window.__ModuleLoader__.load({
19
19
  settingsFullscreen: true,
20
20
  hideHoverCard: true,
21
21
  hideRowButtons: true,
22
+ compactHeader: true,
23
+ optimizeStatsLayout: true,
24
+ showBalance: true,
25
+ balanceThreshold: 3,
26
+ balanceDecimals: 2,
27
+ pointerNormalize: true,
28
+ textSelectLimit: true,
22
29
  };
23
30
 
24
31
  const isZh = () => {
@@ -47,6 +54,11 @@ window.__ModuleLoader__.load({
47
54
  root.dataset.dccFull = prefs.settingsFullscreen ? 'on' : 'off';
48
55
  root.dataset.dccHover = prefs.hideHoverCard ? 'off' : 'on';
49
56
  root.dataset.dccRowButtons = prefs.hideRowButtons ? 'on' : 'off';
57
+ root.dataset.dccCompactHeader = prefs.compactHeader ? 'on' : 'off';
58
+ root.dataset.dccStats = prefs.optimizeStatsLayout ? 'on' : 'off';
59
+ root.dataset.dccBalance = prefs.showBalance ? 'on' : 'off';
60
+ root.dataset.dccPointer = prefs.pointerNormalize ? 'on' : 'off';
61
+ root.dataset.dccSelect = prefs.textSelectLimit ? 'on' : 'off';
50
62
  }
51
63
 
52
64
  function savePrefs(prefs) {
@@ -147,9 +159,14 @@ html[data-dcc-radius="on"] [class*="_trailing"] > [class*="_primary"] svg {
147
159
  width: 16px !important;
148
160
  height: 16px !important;
149
161
  }
150
- /* 输入框左下角的「+」:宿主是 999px 圆形,同样收成小圆角方形 */
162
+ /* 输入框左下角的「+」:宿主是 999px 圆形,同样收成小圆角方形;
163
+ 底色也去掉,只在悬停时给出来(宿主的原始底色就是这一档)。 */
151
164
  html[data-dcc-radius="on"] button[class*="_add"] {
152
165
  border-radius: var(--dsw-radius-md) !important;
166
+ background: transparent !important;
167
+ }
168
+ html[data-dcc-radius="on"] button[class*="_add"]:hover {
169
+ background: var(--dsw-specific-selector) !important;
153
170
  }
154
171
 
155
172
  /* 主内容区左上角的大圆角(Windows 标题栏) */
@@ -164,8 +181,12 @@ html[data-dcc-radius="on"] body {
164
181
  --dsw-shadow-lv2: 0 2px 6px rgba(0, 0, 0, .05) !important;
165
182
  --dsw-shadow-lv3: 0 8px 24px rgba(0, 0, 0, .10) !important;
166
183
  }
184
+ /* 宿主只在 _preview / _media 这两个浮层上单独定义了这个变量,压住它们本身即可。
185
+ 早先用 body * 给每个元素都写一遍,会把这套声明的失效范围放大到全文档,
186
+ 悬停/滚动时样式重算明显变慢,已收窄。 */
167
187
  html[data-dcc-radius="on"] body,
168
- html[data-dcc-radius="on"] body * {
188
+ html[data-dcc-radius="on"] [class*="_preview_"],
189
+ html[data-dcc-radius="on"] [class*="_media_"] {
169
190
  --dsw-elevation-panel: var(--dsw-elevation-stroke), 0 2px 6px rgba(0, 0, 0, .04) !important;
170
191
  }
171
192
 
@@ -410,6 +431,264 @@ html[data-dcc-row-buttons="on"] [class*="_sessionRow"] [class*="_rowActions"] bu
410
431
  display: none !important;
411
432
  }
412
433
 
434
+ /* ---------- 会话标题栏紧凑化:标签行并入顶部工具区 ---------- */
435
+ /* 注意不能 display:none:宿主按标签行的 clientWidth 计算「能显示几个视图」,
436
+ 宽度变 0 会只剩一个「对话」。所以这里只把高度压到 0(不占布局),
437
+ 宽度和可见性照旧,量出来的数量才是对的。 */
438
+ html[data-dcc-compact-header="on"] div:has(> [data-conversation-tabs]) {
439
+ height: 0 !important;
440
+ min-height: 0 !important;
441
+ max-height: 0 !important;
442
+ padding-top: 0 !important;
443
+ padding-bottom: 0 !important;
444
+ margin-top: 0 !important;
445
+ margin-bottom: 0 !important;
446
+ border: 0 !important;
447
+ overflow: hidden !important;
448
+ visibility: hidden;
449
+ pointer-events: none !important;
450
+ }
451
+ /* 标签行虽然高度归零,但它还在 DOM 里,宿主的 :has(._tabs) 依然成立,
452
+ 标题栏会死守 min-height:76px。这里直接按「没有标签行」的形态压平。 */
453
+ html[data-dcc-compact-header="on"] [class*="_header"]:has([data-conversation-tabs]) {
454
+ min-height: 0 !important;
455
+ padding-bottom: 10px !important;
456
+ border-bottom: none !important;
457
+ }
458
+ /* 去掉硬分界线后,改用 mask 让内容顶部渐隐——滚动时文字淡入而不是被一条线切断。 */
459
+ html[data-dcc-compact-header="on"] [data-conversation-scroll] {
460
+ -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
461
+ mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
462
+ }
463
+ html[data-dcc-compact-header="on"] [class*="_viewsMore"] {
464
+ display: none !important;
465
+ }
466
+ /* 开关关掉时,自绘的分段控件不出现,标签行恢复原样 */
467
+ html[data-dcc-compact-header="off"] .dcc-segmented {
468
+ display: none !important;
469
+ }
470
+ /* 分组按钮:与顶部官方按钮对齐——box-sizing 让 height 含边框,
471
+ 圆角用 sm(8px) 而不是 md(12px),描边用更浅的 l1。 */
472
+ .dcc-segmented {
473
+ box-sizing: border-box;
474
+ display: inline-flex;
475
+ align-items: stretch;
476
+ height: 24px;
477
+ /* 宿主给 headerUtilities 的 gap 是 8px;我们这层带 0.5px 描边和圆角,
478
+ 视觉上边界内缩、显得比别的元素远一点,补 2px 回来 */
479
+ margin-right: 2px;
480
+ padding: 0;
481
+ border: 0.5px solid var(--dsw-alias-border-l4);
482
+ border-radius: var(--dsw-radius-sm, 8px);
483
+ background: var(--dsw-alias-bg-layer-1);
484
+ overflow: hidden;
485
+ }
486
+ .dcc-seg {
487
+ display: inline-flex;
488
+ align-items: center;
489
+ border: 0;
490
+ background: transparent;
491
+ color: var(--dsw-alias-label-tertiary);
492
+ font: inherit;
493
+ font-size: 12px;
494
+ line-height: 1;
495
+ padding: 0 8px;
496
+ cursor: pointer;
497
+ transition: background-color .12s, color .12s;
498
+ }
499
+ .dcc-seg + .dcc-seg {
500
+ border-left: 0.5px solid var(--dsw-alias-border-l4);
501
+ }
502
+ .dcc-seg:hover:not([data-active="true"]) {
503
+ background: var(--dsw-alias-interactive-bg-hover);
504
+ color: var(--dsw-alias-label-primary);
505
+ }
506
+ .dcc-seg[data-active="true"] {
507
+ background: transparent;
508
+ color: var(--dsw-alias-state-business-primary);
509
+ font-weight: 500;
510
+ }
511
+
512
+ /* ---------- 输入框下方状态行:速率/缓存靠左,上下文环推到最右 ---------- */
513
+ /* 宿主的 _dock 只有 280px 宽且居中,里面是两个子项:左边的胶囊组和包着环的
514
+ A6Bq1a_root。这里不撑满容器,而是套用聊天内容区的宽度变量并居中——
515
+ 这样它会跟着「页面边距」一起走,不会顶到内容区外面。 */
516
+ html[data-dcc-stats="on"] [class*="_dock"]:has(button[aria-haspopup="dialog"]) {
517
+ box-sizing: border-box !important;
518
+ width: calc(var(--dsh-chat-content-width, 100%) + 24px) !important;
519
+ max-width: calc(var(--dsh-chat-content-width, 100%) + 24px) !important;
520
+ margin-inline: auto !important;
521
+ justify-content: flex-start !important;
522
+ }
523
+ /* 速率/缓存/余额成组留在左边,包着环的那个 root 吃掉剩余空间,被顶到最右 */
524
+ html[data-dcc-stats="on"] [class*="_dock"] > [class*="_root"]:has(button[aria-haspopup="dialog"]) {
525
+ margin-left: auto !important;
526
+ }
527
+
528
+ /* 余额:用伪元素 + CSS 变量渲染,不往 React 的 DOM 里插任何节点。
529
+ 旁边的速率/缓存是 React 自己渲染的,更新时只改文本;外挂节点会在
530
+ React 重排子节点时被摘掉,于是每次刷新都闪一下——伪元素没有这个问题。
531
+ 注意统计项是「activity / usage 各占一个 anchor」,不是同组,
532
+ 所以挂在「后面没有其他统计项」的那个上,也就是整排的最后一个。 */
533
+ html[data-dcc-balance="on"] [data-composer-stat]:not(:has(~ [data-composer-stat]))::after {
534
+ content: var(--dcc-balance-text, '');
535
+ display: inline-flex;
536
+ align-items: center;
537
+ align-self: center;
538
+ margin-left: 16px;
539
+ padding-left: 23px;
540
+ min-height: 16px;
541
+ font-size: 12px;
542
+ line-height: 16px;
543
+ color: var(--dsw-alias-label-tertiary);
544
+ white-space: nowrap;
545
+ /* 钱包图标用 background 贴上去:伪元素里塞不进 SVG 元素,
546
+ 图标颜色只能写死(中灰),深浅主题下都能看 */
547
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a8a8a' stroke-width='1'%3E%3Crect x='1.5' y='4' width='13' height='9' rx='2.5'/%3E%3Cpath d='M1.5 7.2h13'/%3E%3Ccircle cx='11.6' cy='9.8' r='0.9' fill='%238a8a8a' stroke='none'/%3E%3C/svg%3E");
548
+ background-repeat: no-repeat;
549
+ background-position: left center;
550
+ background-size: 16px 16px;
551
+ }
552
+ /* 低于阈值时整段变红 */
553
+ html[data-dcc-balance="on"][data-dcc-balance-low="on"] [data-composer-stat]:not(:has(~ [data-composer-stat]))::after {
554
+ color: var(--dsw-alias-state-error-primary);
555
+ }
556
+ /* 设置页的数值输入框 */
557
+ .dcc-number {
558
+ width: 72px;
559
+ flex: none;
560
+ padding: 4px 8px;
561
+ border: 1px solid var(--dsw-alias-border-l2);
562
+ border-radius: var(--dsw-radius-sm, 4px);
563
+ background: var(--dsw-alias-bg-layer-1);
564
+ color: var(--dsw-alias-label-primary);
565
+ font: inherit;
566
+ font-size: 13px;
567
+ text-align: right;
568
+ }
569
+ .dcc-number:focus {
570
+ outline: 2px solid var(--dsw-alias-brand-primary);
571
+ outline-offset: 1px;
572
+ }
573
+ /* 设置页的下拉选择框 */
574
+ .dcc-select {
575
+ flex: none;
576
+ padding: 4px 6px;
577
+ border: 1px solid var(--dsw-alias-border-l2);
578
+ border-radius: var(--dsw-radius-sm, 4px);
579
+ background: var(--dsw-alias-bg-layer-1);
580
+ color: var(--dsw-alias-label-primary);
581
+ font: inherit;
582
+ font-size: 13px;
583
+ cursor: default;
584
+ }
585
+ .dcc-select:focus {
586
+ outline: 2px solid var(--dsw-alias-brand-primary);
587
+ outline-offset: 1px;
588
+ }
589
+
590
+ /* ---------- 指针样式规范化 ---------- */
591
+ /* 桌面软件的惯例:只有可跳转的东西才给手形。Web UI 常把「可点击」和「可跳转」
592
+ 混为一谈,这里统一压回箭头,再单独放行链接和文本输入区。 */
593
+ /* 用 auto 而不是 default:auto 会按元素类型给浏览器默认光标,
594
+ 文本区仍是 I 型、输入框仍是文本光标;default 会把这些也压成箭头。 */
595
+ html[data-dcc-pointer="on"] *,
596
+ html[data-dcc-pointer="on"] *::before,
597
+ html[data-dcc-pointer="on"] *::after {
598
+ cursor: auto !important;
599
+ }
600
+ /* 跳转性元素保留手形 */
601
+ html[data-dcc-pointer="on"] a[href],
602
+ html[data-dcc-pointer="on"] [role="link"],
603
+ html[data-dcc-pointer="on"] [data-href] {
604
+ cursor: pointer !important;
605
+ }
606
+ /* 「本轮改动」卡片:表头和文件行都是跳转性的(在侧边栏打开预览),
607
+ 整张卡片放行手形——只写 button 会漏掉行内的 path / counts 等子元素 */
608
+ html[data-dcc-pointer="on"] [data-changed-files="true"],
609
+ html[data-dcc-pointer="on"] [data-changed-files="true"] * {
610
+ cursor: pointer !important;
611
+ }
612
+ /* 输入区保留文本光标 */
613
+ html[data-dcc-pointer="on"] input,
614
+ html[data-dcc-pointer="on"] textarea,
615
+ html[data-dcc-pointer="on"] [contenteditable="true"] {
616
+ cursor: text !important;
617
+ }
618
+ /* 禁用态保留「禁止」提示,比默认箭头更清楚 */
619
+ html[data-dcc-pointer="on"] :disabled,
620
+ html[data-dcc-pointer="on"] [aria-disabled="true"] {
621
+ cursor: not-allowed !important;
622
+ }
623
+
624
+ /* ---------- 文字可选范围 ---------- */
625
+ /* 界面文字一律不可选中(桌面软件的惯例:标题、按钮、标签、菜单不该拖出蓝底),
626
+ 只有消息正文与输入区保留可选中。带 !important 是因为宿主自己给若干处写了
627
+ user-select: text,类选择器的优先级高于 html body,不强化压不住。 */
628
+ html[data-dcc-select="on"] body,
629
+ html[data-dcc-select="on"] body * {
630
+ user-select: none !important;
631
+ -webkit-user-select: none !important;
632
+ }
633
+ /* 消息正文(含其后代)可选 */
634
+ html[data-dcc-select="on"] body [data-conversation-scroll],
635
+ html[data-dcc-select="on"] body [data-conversation-scroll] * {
636
+ user-select: text !important;
637
+ -webkit-user-select: text !important;
638
+ }
639
+ /* 但消息区里的界面元件不算正文:按钮、操作栏、时间、改动卡片一律压回不可选 */
640
+ html[data-dcc-select="on"] body [data-conversation-scroll] button,
641
+ html[data-dcc-select="on"] body [data-conversation-scroll] button *,
642
+ html[data-dcc-select="on"] body [data-conversation-scroll] [role="button"],
643
+ html[data-dcc-select="on"] body [data-conversation-scroll] [role="button"] *,
644
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_action"],
645
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_action"] *,
646
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_time"],
647
+ html[data-dcc-select="on"] body [data-conversation-scroll] time,
648
+ html[data-dcc-select="on"] body [data-conversation-scroll] [data-changed-files="true"],
649
+ html[data-dcc-select="on"] body [data-conversation-scroll] [data-changed-files="true"] *,
650
+ /* 进行中的状态提示(「深度求索中,用时 1 秒…」)也是界面元件,不是正文 */
651
+ html[data-dcc-select="on"] body [data-conversation-scroll] [role="status"],
652
+ html[data-dcc-select="on"] body [data-conversation-scroll] [role="status"] *,
653
+ html[data-dcc-select="on"] body [data-conversation-scroll] [aria-live],
654
+ html[data-dcc-select="on"] body [data-conversation-scroll] [aria-live] *,
655
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_running"],
656
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_running"] *,
657
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_status"],
658
+ html[data-dcc-select="on"] body [data-conversation-scroll] [class*="_status"] * {
659
+ user-select: none !important;
660
+ -webkit-user-select: none !important;
661
+ }
662
+ /* 输入框那一片再压回不可选,否则整行(速率、余额、百分比)会被一起拖蓝 */
663
+ html[data-dcc-select="on"] body [data-conversation-region="composer"],
664
+ html[data-dcc-select="on"] body [data-conversation-region="composer"] * {
665
+ user-select: none !important;
666
+ -webkit-user-select: none !important;
667
+ }
668
+ /* 「本轮改动」卡片与消息时间属于界面元件,不是正文,一并压成不可选 */
669
+ html[data-dcc-select="on"] body [data-changed-files="true"],
670
+ html[data-dcc-select="on"] body [data-changed-files="true"] *,
671
+ html[data-dcc-select="on"] body time {
672
+ user-select: none !important;
673
+ -webkit-user-select: none !important;
674
+ }
675
+ /* 输入框本身放在最后,覆盖上面那条 */
676
+ html[data-dcc-select="on"] body input,
677
+ html[data-dcc-select="on"] body textarea,
678
+ html[data-dcc-select="on"] body [contenteditable="true"] {
679
+ user-select: text !important;
680
+ -webkit-user-select: text !important;
681
+ }
682
+ /* 会话标题(面包屑那一段)可选中,方便复制标题;
683
+ 只放行标题区,右侧的按钮组仍是不可选 */
684
+ html[data-dcc-select="on"] body [class*="_titleRow"],
685
+ html[data-dcc-select="on"] body [class*="_titleCluster"],
686
+ html[data-dcc-select="on"] body [class*="_crumb"],
687
+ html[data-dcc-select="on"] body [class*="_crumb"] * {
688
+ user-select: text !important;
689
+ -webkit-user-select: text !important;
690
+ }
691
+
413
692
  /* ---------- 已归档会话:标题画删除线 ---------- */
414
693
  html [class*="_sessionRow"][class*="_archived"] [class*="_title"] {
415
694
  text-decoration: line-through;
@@ -486,14 +765,14 @@ html [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navCell"] {
486
765
  }
487
766
  .dcc-settings-back {
488
767
  position: absolute;
489
- top: 20px;
490
768
  left: 14px;
769
+ top: 0;
491
770
  z-index: 2;
492
771
  display: inline-flex;
493
772
  align-items: center;
494
773
  justify-content: center;
495
774
  width: 28px;
496
- height: 28px;
775
+ height: 24px;
497
776
  padding: 0;
498
777
  border: 0;
499
778
  border-radius: var(--dsw-radius-sm);
@@ -728,6 +1007,24 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
728
1007
  return title === null ? null : title.parentElement;
729
1008
  };
730
1009
 
1010
+ /**
1011
+ * 按钮垂直位置按「标题文字的实际矩形」算,而不是按容器盒算——
1012
+ * 容器带 padding / inline 布局时,盒子中心和文字中心并不重合。
1013
+ */
1014
+ const align = () => {
1015
+ if (btn === null || !btn.isConnected || btn.offsetParent === null) return;
1016
+ const title = document.querySelector('[class*="_navTitle"]');
1017
+ if (title === null) return;
1018
+ const range = document.createRange();
1019
+ range.selectNodeContents(title);
1020
+ const rects = range.getClientRects();
1021
+ if (rects.length === 0) return;
1022
+ const textRect = rects[0];
1023
+ const panelRect = btn.offsetParent.getBoundingClientRect();
1024
+ const centerY = textRect.top + textRect.height / 2 - panelRect.top;
1025
+ btn.style.top = `${Math.round(centerY - btn.offsetHeight / 2)}px`;
1026
+ };
1027
+
731
1028
  const closePanel = (panel) => {
732
1029
  const close = panel.querySelector('[class*="_header"] [class*="_close"]');
733
1030
  if (close !== null) close.click();
@@ -740,7 +1037,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
740
1037
  btn = null;
741
1038
  return;
742
1039
  }
743
- if (btn !== null && btn.isConnected && btn.parentElement === panel) return;
1040
+ if (btn !== null && btn.isConnected && btn.parentElement === panel) {
1041
+ align();
1042
+ return;
1043
+ }
744
1044
  if (btn !== null) btn.remove();
745
1045
  btn = document.createElement('button');
746
1046
  btn.type = 'button';
@@ -752,6 +1052,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
752
1052
  + ' stroke-linecap="round" stroke-linejoin="round"/></svg>';
753
1053
  btn.addEventListener('click', () => closePanel(panel));
754
1054
  panel.appendChild(btn);
1055
+ align();
755
1056
  };
756
1057
 
757
1058
  const insertSoon = () => {
@@ -863,8 +1164,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
863
1164
  * 认人:菜单按钮带前者,置顶按钮的 aria-label 里是「置顶会话 / 取消置顶 / pin」。
864
1165
  */
865
1166
  function installRowActionFilter() {
866
- let observer = null;
867
- let timer = null;
868
1167
  let lastRow = null;
869
1168
 
870
1169
  const isPinButton = (btn) => /置顶|pin/i.test(btn.getAttribute('aria-label') || '');
@@ -887,6 +1186,9 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
887
1186
  }
888
1187
  };
889
1188
 
1189
+ /* 只在这里处理:指针进入哪一行就标记哪一行。
1190
+ 早先还挂了一个 MutationObserver 定期全量扫描,滚动时虚拟列表频繁改 DOM,
1191
+ 每 400ms 扫一遍所有会话行,反而成了新的卡顿源,已移除。 */
890
1192
  const onPointer = (event) => {
891
1193
  if (document.documentElement.dataset.dccRowButtons !== 'on') return;
892
1194
  const target = event.target;
@@ -897,42 +1199,217 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
897
1199
  filterRow(row);
898
1200
  };
899
1201
 
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', '');
1202
+ document.addEventListener('pointerover', onPointer, true);
1203
+ document.addEventListener('focusin', onPointer, true);
1204
+ return () => {
1205
+ document.removeEventListener('pointerover', onPointer, true);
1206
+ document.removeEventListener('focusin', onPointer, true);
1207
+ const marked = document.querySelectorAll('[data-dcc-hidden]');
1208
+ for (const el of marked) el.removeAttribute('data-dcc-hidden');
1209
+ };
1210
+ }
1211
+
1212
+ /**
1213
+ * 「移除工作区与会话悬停提示」不能只把卡片藏起来:
1214
+ * 宿主仍在监听「进入行」这件事,800ms 后照样渲染卡片内容、做 fixed 定位,
1215
+ * 卡顿正是从这里来的。这里在捕获阶段截住「从行外进入行」的那一次 pointerover,
1216
+ * React 收不到事件,卡片根本不会打开。
1217
+ * 行内元素之间的移动照常放行,所以按钮的 Tooltip 不受影响。
1218
+ */
1219
+ function installHoverCardBlocker() {
1220
+ const ROW = '[class*="_sessionRow"], [class*="_projectRow"], [class*="_searchResultRow"]';
1221
+
1222
+ const onOver = (event) => {
1223
+ if (document.documentElement.dataset.dccHover !== 'off') return;
1224
+ const target = event.target;
1225
+ if (!(target instanceof Element)) return;
1226
+ const row = target.closest(ROW);
1227
+ if (row === null) return;
1228
+ /* 已经在行内移动,不是「进入」,放行给宿主 */
1229
+ const related = event.relatedTarget;
1230
+ if (related instanceof Node && row.contains(related)) return;
1231
+ event.stopPropagation();
1232
+ };
1233
+
1234
+ /* 放在 window 捕获阶段:这是事件流最早的位置,先于 React 挂在 root 容器上的
1235
+ onPointerOverCapture,才能保证宿主那一层完全收不到「进入行」这件事。 */
1236
+ window.addEventListener('pointerover', onOver, true);
1237
+ return () => window.removeEventListener('pointerover', onOver, true);
1238
+ }
1239
+
1240
+ /**
1241
+ * 会话视图切换(对话 / 轨迹)从标签行搬到顶部工具区,做成一个分段控件。
1242
+ * 原标签行只是被 CSS 隐藏,按钮仍在 DOM 里——点击自绘按钮时转发给它,
1243
+ * 选中态则跟着原按钮的 aria-selected 走,所以和宿主的真实状态永远一致。
1244
+ */
1245
+ function installViewSwitcher() {
1246
+ let bar = null;
1247
+ let observer = null;
1248
+ let timer = null;
1249
+
1250
+ const findTabs = () => document.querySelector('[data-conversation-tabs]');
1251
+ const findHost = () => document.querySelector('[class*="_headerUtilities"]');
1252
+
1253
+ const syncActive = () => {
1254
+ if (bar === null) return;
1255
+ const tabs = findTabs();
1256
+ if (tabs === null) return;
1257
+ const sources = Array.from(tabs.querySelectorAll('button[role="tab"]'));
1258
+ const items = Array.from(bar.querySelectorAll('.dcc-seg'));
1259
+ for (let i = 0; i < items.length; i += 1) {
1260
+ const on = sources[i] !== undefined && sources[i].getAttribute('aria-selected') === 'true';
1261
+ if (on) items[i].setAttribute('data-active', 'true');
1262
+ else items[i].removeAttribute('data-active');
1263
+ }
1264
+ };
1265
+
1266
+ const build = (tabs, host) => {
1267
+ if (bar !== null) bar.remove();
1268
+ bar = document.createElement('div');
1269
+ bar.className = 'dcc-segmented';
1270
+ const sources = Array.from(tabs.querySelectorAll('button[role="tab"]'));
1271
+ sources.forEach((source, index) => {
1272
+ const item = document.createElement('button');
1273
+ item.type = 'button';
1274
+ item.className = 'dcc-seg';
1275
+ item.textContent = (source.textContent || '').trim();
1276
+ item.addEventListener('click', () => {
1277
+ const current = findTabs();
1278
+ if (current === null) return;
1279
+ const target = current.querySelectorAll('button[role="tab"]')[index];
1280
+ if (target !== undefined) target.click();
1281
+ });
1282
+ bar.appendChild(item);
1283
+ });
1284
+ host.insertBefore(bar, host.firstChild);
1285
+ syncActive();
1286
+ };
1287
+
1288
+ const ensure = () => {
1289
+ /* 开关关掉时把自绘控件撤掉,标签行由 CSS 恢复原样 */
1290
+ if (document.documentElement.dataset.dccCompactHeader !== 'on') {
1291
+ if (bar !== null) { bar.remove(); bar = null; }
1292
+ return;
1293
+ }
1294
+ const tabs = findTabs();
1295
+ const host = findHost();
1296
+ if (tabs === null || host === null) {
1297
+ if (bar !== null) { bar.remove(); bar = null; }
1298
+ return;
907
1299
  }
1300
+ const count = tabs.querySelectorAll('button[role="tab"]').length;
1301
+ if (bar === null || !bar.isConnected || bar.parentElement !== host || bar.children.length !== count) {
1302
+ build(tabs, host);
1303
+ return;
1304
+ }
1305
+ syncActive();
908
1306
  };
909
1307
 
910
1308
  const schedule = () => {
911
1309
  if (timer !== null) return;
912
1310
  timer = window.setTimeout(() => {
913
1311
  timer = null;
914
- lastRow = null;
915
- sweep();
916
- }, 400);
1312
+ ensure();
1313
+ }, 350);
917
1314
  };
918
1315
 
919
- document.addEventListener('pointerover', onPointer, true);
920
- document.addEventListener('focusin', onPointer, true);
921
- sweep();
1316
+ ensure();
922
1317
  observer = new MutationObserver(schedule);
923
- observer.observe(document.body, { childList: true, subtree: true });
1318
+ observer.observe(document.body, {
1319
+ childList: true,
1320
+ subtree: true,
1321
+ attributes: true,
1322
+ attributeFilter: ['aria-selected'],
1323
+ });
924
1324
 
925
1325
  return () => {
926
- document.removeEventListener('pointerover', onPointer, true);
927
- document.removeEventListener('focusin', onPointer, true);
928
1326
  observer.disconnect();
929
1327
  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');
1328
+ if (bar !== null) bar.remove();
1329
+ };
1330
+ }
1331
+
1332
+ /**
1333
+ * 在输入框下方的状态行里显示账户余额,走宿主的账户接口
1334
+ * (ctx.remote.account.getBalance)。取不到就静默不显示,不影响其他功能。
1335
+ */
1336
+ function installBalancePill(ctx) {
1337
+ let refresh = null;
1338
+ let text = '';
1339
+ let low = false;
1340
+ /* 原始金额与币种单独留着:改小数位或阈值时要能重新格式化,
1341
+ 只存格式化后的字符串就回不去了。 */
1342
+ let rawAmount = null;
1343
+ let symbol = '¥';
1344
+
1345
+ const identity = () => ({
1346
+ version: VERSION,
1347
+ locale: navigator.language || 'zh-CN',
1348
+ timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60,
1349
+ });
1350
+
1351
+ /* 只写 CSS 变量和 html 上的标记位,不碰 React 的节点树。
1352
+ 伪元素没有「被 React 摘掉再补回」这一步,所以刷新时不会闪。 */
1353
+ const sync = () => {
1354
+ if (text === '') return;
1355
+ const root = document.documentElement;
1356
+ const next = JSON.stringify(`余额 ${text}`);
1357
+ if (root.style.getPropertyValue('--dcc-balance-text') !== next) {
1358
+ root.style.setProperty('--dcc-balance-text', next);
1359
+ }
1360
+ const flag = low ? 'on' : 'off';
1361
+ if (root.dataset.dccBalanceLow !== flag) root.dataset.dccBalanceLow = flag;
1362
+ };
1363
+
1364
+ /* 只根据已拿到的余额重算显示与「是否低于阈值」。
1365
+ 设置页改阈值或小数位时立即调用,否则要等下一分钟拉余额才生效。 */
1366
+ const recalc = () => {
1367
+ if (rawAmount === null) return;
1368
+ const prefs = readPrefs();
1369
+ const digits = Number(prefs.balanceDecimals);
1370
+ const decimals = Number.isFinite(digits) && digits >= 2 && digits <= 6 ? Math.round(digits) : 2;
1371
+ text = `${symbol}${rawAmount.toFixed(decimals)}`;
1372
+ const limit = Number(prefs.balanceThreshold);
1373
+ low = Number.isFinite(limit) && rawAmount < limit;
1374
+ sync();
1375
+ };
1376
+
1377
+ const onThreshold = () => recalc();
1378
+
1379
+ const load = async () => {
1380
+ try {
1381
+ /* 必须用 ctx.get('remote'):点号访问 ctx.remote.* 会被 trace,
1382
+ 只有在 inject 了该服务的上下文里才可读,渲染回调里拿不到。 */
1383
+ const remote = typeof ctx.get === 'function' ? ctx.get('remote') : null;
1384
+ const account = remote !== null && typeof remote === 'object' ? remote.account : undefined;
1385
+ if (account === undefined || typeof account.getBalance !== 'function') return;
1386
+ const res = await account.getBalance(identity());
1387
+ if (!res || res.ok !== true) return;
1388
+ const value = res.value;
1389
+ if (!value || value.status !== 'ready') return;
1390
+ const wallets = Array.isArray(value.value) ? value.value : [];
1391
+ const wallet = wallets.find((w) => w.currency === 'CNY') || wallets[0];
1392
+ if (!wallet || typeof wallet.balance !== 'string') return;
1393
+ const amount = Number(wallet.balance);
1394
+ if (!Number.isFinite(amount)) return;
1395
+ rawAmount = amount;
1396
+ symbol = wallet.currency === 'CNY' ? '¥' : '$';
1397
+ recalc();
1398
+ } catch {
1399
+ /* 未登录或接口不可用:不显示余额 */
934
1400
  }
935
1401
  };
1402
+
1403
+ window.addEventListener('dcc-balance-threshold', onThreshold);
1404
+ load();
1405
+ refresh = window.setInterval(load, 60000);
1406
+
1407
+ return () => {
1408
+ window.removeEventListener('dcc-balance-threshold', onThreshold);
1409
+ if (refresh !== null) window.clearInterval(refresh);
1410
+ document.documentElement.style.removeProperty('--dcc-balance-text');
1411
+ delete document.documentElement.dataset.dccBalanceLow;
1412
+ };
936
1413
  }
937
1414
 
938
1415
  function Switch(props) {
@@ -965,11 +1442,15 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
965
1442
  savePrefs(next);
966
1443
  return next;
967
1444
  });
1445
+ /* 阈值或小数位变了要立刻重算显示,通知余额模块重算一次 */
1446
+ if ((key === 'balanceThreshold' || key === 'balanceDecimals') && typeof window !== 'undefined') {
1447
+ window.dispatchEvent(new Event('dcc-balance-threshold'));
1448
+ }
968
1449
  };
969
1450
  return h('div', { className: 'dcc-page' },
970
1451
  h('div', { className: 'dcc-title' }, zh ? 'UI 改进' : 'UI improvements'),
971
1452
  h('p', { className: 'dcc-intro' },
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. Most changes can be switched on or off individually in Settings.'),
1453
+ zh ? '在保持原版 UI 大体布局不变的情况下,进行减小圆角、紧凑化、整洁化、高效化改进,使 UI 视觉更加冷静、专业、高效。同时添加余额显示。大部分改动可在设置中单独开关。' : 'Keeps the overall layout of the stock UI while tightening its radii, spacing and tidiness for a calmer, more professional and more efficient look. Also adds an account balance display. Most changes can be switched on or off individually in Settings.'),
973
1454
  h('div', { className: 'dcc-group' },
974
1455
  h('div', { className: 'dcc-group-title' }, zh ? '外观' : 'Appearance'),
975
1456
  h(Row, {
@@ -980,18 +1461,24 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
980
1461
  }),
981
1462
  h(Row, {
982
1463
  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.',
1464
+ desc: zh ? '将 Windows 端默认字体改为微软雅黑。微软雅黑带有 hinting,使文字在显示设置低于 200% 缩放比例下,更加锐利清晰。若手动设置了字体,或使用 macOS 端,则不受影响。' : 'Use Microsoft YaHei as the default Windows font. It carries hinting, which keeps text sharp below 200% display scaling. Has no effect if you set a font manually, or on macOS.',
984
1465
  checked: prefs.winFont,
985
1466
  onChange: update('winFont'),
986
1467
  })),
987
1468
  h('div', { className: 'dcc-group' },
988
1469
  h('div', { className: 'dcc-group-title' }, zh ? '布局' : 'Layout'),
989
1470
  h(Row, {
990
- title: zh ? '减小圆角与紧凑界面' : 'Smaller radii and a tighter layout',
1471
+ title: zh ? '减小圆角与间距' : 'Smaller radii and spacing',
991
1472
  desc: zh ? '缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效。' : 'Smaller global radii, smaller sidebar type and tighter spacing, for a more efficient interface.',
992
1473
  checked: prefs.radiusDensity,
993
1474
  onChange: update('radiusDensity'),
994
1475
  }),
1476
+ h(Row, {
1477
+ title: zh ? '会话标题栏紧凑化' : 'Compact session header',
1478
+ desc: zh ? '紧凑化会话标题栏,使会话内容可视范围更大。' : 'Tighten the session header so more of the conversation is visible.',
1479
+ checked: prefs.compactHeader,
1480
+ onChange: update('compactHeader'),
1481
+ }),
995
1482
  h(Row, {
996
1483
  title: zh ? '统一新会话按钮样式' : 'Unified new-session button',
997
1484
  desc: zh ? '将新会话按钮样式改为与导航按钮一致的样式。' : 'Style the new-session button the same as the navigation buttons.',
@@ -1034,6 +1521,61 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
1034
1521
  checked: prefs.settingsFullscreen,
1035
1522
  onChange: update('settingsFullscreen'),
1036
1523
  })),
1524
+ h('div', { className: 'dcc-group' },
1525
+ h('div', { className: 'dcc-group-title' }, zh ? '性能与用量信息' : 'Performance and usage'),
1526
+ h(Row, {
1527
+ title: zh ? '优化布局' : 'Optimize layout',
1528
+ desc: zh ? '优化输入框下方性能与用量布局,将数据分布在左右两侧平衡视觉重心。' : 'Improve the layout of the performance and usage row, spreading the data across both sides to balance the visual weight.',
1529
+ checked: prefs.optimizeStatsLayout,
1530
+ onChange: update('optimizeStatsLayout'),
1531
+ }),
1532
+ h(Row, {
1533
+ title: zh ? '显示余额' : 'Show balance',
1534
+ desc: zh ? '在输入框下方性能与用量中显示余额。' : 'Show the account balance in the performance and usage row.',
1535
+ checked: prefs.showBalance,
1536
+ onChange: update('showBalance'),
1537
+ }),
1538
+ h('div', { className: 'dcc-row' },
1539
+ h('div', { className: 'dcc-row-text' },
1540
+ h('div', { className: 'dcc-row-title' }, zh ? '余额警告阈值' : 'Low balance threshold'),
1541
+ h('div', { className: 'dcc-row-desc' }, zh ? '余额低于此值将变为红色。最小为 0。' : 'The balance turns red below this value. Minimum 0.')),
1542
+ h('input', {
1543
+ type: 'number',
1544
+ min: '0',
1545
+ step: '1',
1546
+ className: 'dcc-number',
1547
+ value: prefs.balanceThreshold,
1548
+ 'aria-label': zh ? '余额警告阈值' : 'Low balance threshold',
1549
+ onChange: (event) => {
1550
+ /* min 属性只是浏览器提示,拦不住手输负数或非法值,这里兜底归 0 */
1551
+ const next = Number(event.target.value);
1552
+ update('balanceThreshold')(Number.isFinite(next) && next >= 0 ? next : 0);
1553
+ },
1554
+ })),
1555
+ h('div', { className: 'dcc-row' },
1556
+ h('div', { className: 'dcc-row-text' },
1557
+ h('div', { className: 'dcc-row-title' }, zh ? '余额小数位数' : 'Balance decimal places'),
1558
+ h('div', { className: 'dcc-row-desc' }, zh ? '余额显示的小数位数。' : 'How many decimal places the balance shows.')),
1559
+ h('select', {
1560
+ className: 'dcc-select',
1561
+ value: String(prefs.balanceDecimals),
1562
+ 'aria-label': zh ? '余额小数位数' : 'Balance decimal places',
1563
+ onChange: (event) => update('balanceDecimals')(Number(event.target.value)),
1564
+ }, [2, 3, 4, 5, 6].map((n) => h('option', { key: n, value: String(n) }, `${n} 位`))))),
1565
+ h('div', { className: 'dcc-group' },
1566
+ h('div', { className: 'dcc-group-title' }, zh ? '规范化' : 'Normalization'),
1567
+ h(Row, {
1568
+ title: zh ? '指针样式规范化' : 'Normalize pointer styles',
1569
+ desc: zh ? '遵循桌面软件的指针样式规范,仅链接等跳转性元素会更改指针样式为「手形」。' : 'Follows desktop conventions: only links and other navigational elements show a hand cursor.',
1570
+ checked: prefs.pointerNormalize,
1571
+ onChange: update('pointerNormalize'),
1572
+ }),
1573
+ h(Row, {
1574
+ title: zh ? '文本可选中限制' : 'Restrict text selection',
1575
+ desc: zh ? '遵循桌面软件的规范,使 UI 界面元素的文本不可被选中。' : 'Follows desktop conventions: text in interface elements cannot be selected.',
1576
+ checked: prefs.textSelectLimit,
1577
+ onChange: update('textSelectLimit'),
1578
+ })),
1037
1579
  h('p', { className: 'dcc-meta' },
1038
1580
  /* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
1039
1581
  zh ? `版本:${VERSION}\u3000更新日期:${UPDATED}` : `Version: ${VERSION} Updated: ${UPDATED}`));
@@ -1050,7 +1592,9 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
1050
1592
 
1051
1593
  return {
1052
1594
  name: 'dsh-ui-alt',
1053
- inject: ['slots'],
1595
+ /* remote.account 是独立服务 key,和不声明就等于没有;
1596
+ 只在 inject 里写上,ctx.get('remote').account 才可用。 */
1597
+ inject: ['slots', 'remote', 'remote.account'],
1054
1598
  apply(ctx) {
1055
1599
  ctx.effect(() => {
1056
1600
  applyPrefs(readPrefs());
@@ -1068,12 +1612,18 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
1068
1612
  const removeNavToggle = installNavToggle();
1069
1613
  const removeSettingsBack = installSettingsBackButton();
1070
1614
  const removeRowActionFilter = installRowActionFilter();
1615
+ const removeHoverCardBlocker = installHoverCardBlocker();
1616
+ const removeViewSwitcher = installViewSwitcher();
1617
+ const removeBalance = installBalancePill(ctx);
1071
1618
  return () => {
1072
1619
  removeCss();
1073
1620
  removeNewSessionRow();
1074
1621
  removeNavToggle();
1075
1622
  removeSettingsBack();
1076
1623
  removeRowActionFilter();
1624
+ removeHoverCardBlocker();
1625
+ removeViewSwitcher();
1626
+ removeBalance();
1077
1627
  const root = document.documentElement;
1078
1628
  delete root.dataset.dccRadius;
1079
1629
  delete root.dataset.dccNew;
@@ -1085,6 +1635,11 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
1085
1635
  delete root.dataset.dccFull;
1086
1636
  delete root.dataset.dccHover;
1087
1637
  delete root.dataset.dccRowButtons;
1638
+ delete root.dataset.dccCompactHeader;
1639
+ delete root.dataset.dccStats;
1640
+ delete root.dataset.dccBalance;
1641
+ delete root.dataset.dccPointer;
1642
+ delete root.dataset.dccSelect;
1088
1643
  };
1089
1644
  }, 'dsh-ui-alt: styles and preference attributes');
1090
1645
 
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "UI improvements",
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. Most changes can be switched on or off individually in Settings."
4
+ "description": "Keeps the overall layout of the stock UI while tightening its radii, spacing and tidiness for a calmer, more professional and more efficient look. Also adds an account balance display. Most changes can be switched on or off 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.13",
3
+ "version": "0.2.86",
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": [