dsh-ui-alt 0.2.422 → 0.2.437

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.
Files changed (3) hide show
  1. package/README.md +2 -3
  2. package/client.js +80 -294
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,11 +19,11 @@
19
19
  | 开关 | 默认 | 效果 |
20
20
  | --- | --- | --- |
21
21
  | 减小圆角与间距 | 开 | 缩小全局圆角、缩小侧栏部分字号、收紧间距,使界面更高效 |
22
+ | 增加设置窗口尺寸 | 关 | 增加设置窗口的最大宽度和高度上限,以增加可视范围 |
22
23
  | Windows 默认使用微软雅黑字体 | 关 | 将 Windows 端默认字体改为微软雅黑。微软雅黑带有 hinting,使文字在显示设置低于 200% 缩放比例下,更加锐利清晰。若手动设置了字体,或使用 macOS 端,则不受影响 |
23
24
  | 降低深色模式文字亮度 | 开 | 略微降低深色模式文字亮度,避免纯白文字过于刺眼 |
24
25
  | 为菜单和窗口添加动画 | 开 | 为菜单、对话框和压暗遮罩添加更流畅的出现和消失动画。部分菜单由于底层限制无法添加消失动画 |
25
26
  | 禁用菜单模糊效果 | 开 | 禁用原版菜单聊胜于无的模糊效果,增加流畅度和整体感 |
26
- | 设置面板全屏 | 关 | 使用非窗口化的设置页面 |
27
27
 
28
28
  **导航和工作区**
29
29
 
@@ -129,10 +129,9 @@ dsh-ui-alt/
129
129
 
130
130
  - 预置数据:`STORAGE_KEY`、`DEFAULTS`、`readPrefs()` / `applyPrefs()` / `savePrefs()`。
131
131
  - 一大段 `css` 字符串,全部按 `html[data-dcc-*]` 条件生效;设置页自身样式用 `.dcc-*` 前缀。
132
- - 十三个 DOM 注入函数,各自带总开关守卫;需要跟随宿主重渲染的还带一个监听 `body` 的 `MutationObserver`(350–400ms 防抖):
132
+ - 十二个 DOM 注入函数,各自带总开关守卫;需要跟随宿主重渲染的还带一个监听 `body` 的 `MutationObserver`(350–400ms 防抖):
133
133
  - `installNewSessionRow()`:克隆宿主的「新会话」按钮成导航行,点击转发给原按钮。
134
134
  - `installNavToggle()`:导航下方插入展开/收起箭头,点击切换 `data-dcc-nav` 并写回偏好。
135
- - `installSettingsBackButton()`:设置面板左上角插入返回按钮,点击触发原关闭按钮。
136
135
  - `installViewSwitcher()`:把视图标签行换成一个下拉按钮,展开后列出全部视图。
137
136
  - `installBalancePill()`:在状态行显示账户余额,每 40 秒刷新一次。
138
137
  - `installRowActionFilter()`:悬停会话行时只保留菜单和置顶按钮。
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.422';
10
- const UPDATED = '2026-11-17';
9
+ const VERSION = '0.2.437';
10
+ const UPDATED = '2026-11-19';
11
11
  const DEFAULTS = {
12
12
  radiusDensity: true,
13
13
  invertNewSession: true,
@@ -19,7 +19,6 @@ window.__ModuleLoader__.load({
19
19
  uiTransition: true,
20
20
  disableMenuBlur: true,
21
21
  sessionDot: false,
22
- settingsFullscreen: false,
23
22
  hideHoverCard: true,
24
23
  hideRowButtons: true,
25
24
  headerFade: true,
@@ -32,6 +31,7 @@ window.__ModuleLoader__.load({
32
31
  balanceDecimals: 2,
33
32
  pointerNormalize: true,
34
33
  textSelectLimit: true,
34
+ settingsWide: false,
35
35
  };
36
36
 
37
37
  const isZh = () => {
@@ -65,10 +65,10 @@ window.__ModuleLoader__.load({
65
65
  root.dataset.dccLogo = prefs.hideLogo ? 'hidden' : 'shown';
66
66
  root.dataset.dccDot = prefs.sessionDot ? 'on' : 'off';
67
67
  root.dataset.dccFont = prefs.winFont ? 'on' : 'off';
68
+ root.dataset.dccSettingsWide = prefs.settingsWide ? 'on' : 'off';
68
69
  root.dataset.dccTextDim = prefs.softenDarkText ? 'on' : 'off';
69
70
  root.dataset.dccTransition = prefs.uiTransition ? 'on' : 'off';
70
71
  root.dataset.dccMenuBlur = prefs.disableMenuBlur ? 'on' : 'off';
71
- root.dataset.dccFull = prefs.settingsFullscreen ? 'on' : 'off';
72
72
  root.dataset.dccHover = prefs.hideHoverCard ? 'off' : 'on';
73
73
  root.dataset.dccRowButtons = prefs.hideRowButtons ? 'on' : 'off';
74
74
  root.dataset.dccHeaderFade = prefs.headerFade ? 'on' : 'off';
@@ -649,8 +649,13 @@ html[data-dcc-transition="on"] [data-dcc-dialog-clone] [class*="_mask"] {
649
649
  }
650
650
 
651
651
  /* 压暗遮罩的入场:从透明淡到实,时长与退场的 dcc-fade-out 对齐。
652
- 带 !important,避免被其他插件的通配符动效规则压平。 */
653
- html[data-dcc-transition="on"] [class*="_mask"] {
652
+ 带 !important,避免被其他插件的通配符动效规则压平。
653
+
654
+ _mask 这个类名在宿主的 6 个以上模块里都有(对话、附件、聊天…),
655
+ 只对「紧挨着 dialog 的那一个」生效——Modal 的结构是
656
+ <div class=root><div class=mask/><div class=dialog/></div>,
657
+ 用相邻兄弟选择器锁定,别的 mask 不碰。 */
658
+ html[data-dcc-transition="on"] [class*="_mask"]:has(+ [role="dialog"]) {
654
659
  animation: dcc-fade-in .2s var(--ds-ease-in-out, cubic-bezier(.4, 0, .2, 1)) !important;
655
660
  }
656
661
 
@@ -796,15 +801,14 @@ html[data-dcc-dim="on"] [class*="_sessionOverflowButton"]:hover {
796
801
  宿主的文件夹图标是 16px,行高 32px,缩到 14px 后与 13px 的标题更协调。
797
802
  其他插件在这个位置放的图标(自定义 svg、img、字符等)也一并按同一套
798
803
  尺寸和偏移处理,保证整列左边缘对齐。 */
804
+ /* 宿主的工作区行图标容器叫 folderActive(Rows.module.css),
805
+ [class*="_folder"] 能匹配到它。_leading 在别的模块里有,但
806
+ Rows.module.css 里没有,写成 _projectRow ._leading 是条空规则,已删。 */
799
807
  html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_folder"] svg,
800
- html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_folder"] img,
801
- html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_leading"] svg,
802
- html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_leading"] img,
803
- html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_iconSlot"] svg,
804
- html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_iconSlot"] img {
808
+ html[data-dcc-radius="on"] [class*="_projectRow"] [class*="_folder"] img {
805
809
  width: 14px !important;
806
810
  height: 14px !important;
807
- /* 位置上移 1px 与文字基线对齐(横向由行的 padding 统一处理) */
811
+ /* 上移 1px 与文字基线对齐 */
808
812
  position: relative !important;
809
813
  top: -1px !important;
810
814
  /* 非正方形图标按比例缩,不拉伸 */
@@ -822,8 +826,10 @@ html[data-dcc-enabled="on"] [class*="_projectRow"]:hover [class*="_chevron"] {
822
826
 
823
827
  /* ---------- 工作区:标题与会话都小一号,并同步收一点行高 ----------
824
828
  归在「紧凑圆角与密度」开关下:密度本来就是一整套,字号不再单独开一项。 */
825
- /* 「工作区」分组标题:更小、更弱,并与下方项目行左对齐 */
826
- html[data-dcc-radius="on"] [class*="_sectionHeader"] {
829
+ /* 「工作区」分组标题:更小、更弱,并与下方项目行左对齐。
830
+ _sectionHeader 在宿主的任务页、模型设置页也用了同一个名字,
831
+ 限定在侧栏的滚动区域内,避免误伤那两处。 */
832
+ html[data-dcc-radius="on"] [data-sidebar-scrollport] [class*="_sectionHeader"] {
827
833
  height: 30px !important;
828
834
  margin-bottom: 2px !important;
829
835
  }
@@ -858,13 +864,9 @@ html[data-dcc-radius="on"] [class*="_trigger"][data-signed-out="false"] [class*=
858
864
  }
859
865
 
860
866
  /* ---------- 工作区 / 会话行的悬停提示卡片 ---------- */
861
- /* 宿主把卡片挂在 body 下(_card / _preview / _bridge 三段),fixed + z-index:100。
862
- 打开「移除悬停提示」后直接不渲染,滑动侧栏时不再闪出卡片,也不会因定位计算掉帧。 */
863
- html[data-dcc-hover="off"] [class*="_card_bgejw"],
864
- html[data-dcc-hover="off"] [class*="_preview_bgejw"],
865
- html[data-dcc-hover="off"] [class*="_bridge_bgejw"] {
866
- display: none !important;
867
- }
867
+ /* 隐藏规则在上面的 [style*="--dsh-hover-preview-fade"] 处,
868
+ 那条用宿主自带的 CSS 变量定位,比类名稳定——
869
+ 宿主 HoverCard 的哈希(bgejw)会随构建变化,写死迟早失效。 */
868
870
 
869
871
  /* ---------- 会话行悬停按钮 ---------- */
870
872
  /* 悬停时行尾会冒出一排按钮:「…」菜单在 rowActions 里,其余(宿主归档、以及各插件
@@ -1033,11 +1035,28 @@ html[data-dcc-enabled="on"] [data-dsh-boot] [data-dsh-boot-spinner],
1033
1035
  html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_spinner"] {
1034
1036
  display: none !important;
1035
1037
  }
1038
+ /* 加载页的提示也改成纵向:鲸鱼在上、文字在下,和会话页的观感一致。
1039
+ 宿主的原始排布是横向的,去掉 HARNESS 之后如果不改方向,
1040
+ 鲸鱼会和文字并排站着。 */
1041
+ html[data-dcc-enabled="on"] [data-dsh-boot] [class*="_hint"] {
1042
+ display: flex !important;
1043
+ flex-direction: column !important;
1044
+ align-items: center !important;
1045
+ gap: 10px !important;
1046
+ margin: 0 !important;
1047
+ white-space: nowrap !important;
1048
+ }
1036
1049
  /* ===== BOOT-HINT END ===== */
1037
1050
 
1038
1051
  /* 会话切换时的「载入历史」提示:挪到正文中心,鲸鱼在上、文字在下。
1039
- 文字内容由宿主写入,这里只改排版,不替换文案。 */
1040
- html[data-dcc-enabled="on"] [class*="_hint"] {
1052
+ 文字内容由宿主写入,这里只改排版,不替换文案。
1053
+
1054
+ _hint 这个类名在宿主的其它地方也复用(内置插件的详情页就有一处),
1055
+ 所以这里用白名单限定,只处理两个容器内的:
1056
+ · [data-conversation-scroll] 会话正文区
1057
+ · [data-dsh-boot] 宿主加载页(那条在 BOOT-HINT 段里单独处理)
1058
+ 其它位置的 _hint 一律不碰。 */
1059
+ html[data-dcc-enabled="on"] [data-conversation-scroll] [class*="_hint"] {
1041
1060
  position: fixed !important;
1042
1061
  /* left/top 由脚本按正文区域的中心算出来写上去 */
1043
1062
  transform: translate(-50%, -50%) !important;
@@ -1051,7 +1070,8 @@ html[data-dcc-enabled="on"] [class*="_hint"] {
1051
1070
  white-space: nowrap !important;
1052
1071
  pointer-events: none !important;
1053
1072
  }
1054
- html[data-dcc-enabled="on"] [data-dcc-hint-fish] {
1073
+ html[data-dcc-enabled="on"] [data-conversation-scroll] [data-dcc-hint-fish],
1074
+ html[data-dcc-enabled="on"] [data-dsh-boot] [data-dcc-hint-fish] {
1055
1075
  width: 56px;
1056
1076
  height: auto;
1057
1077
  opacity: .32;
@@ -1392,37 +1412,21 @@ html[data-dcc-enabled="on"] body:not([data-ds-dark-theme]) nav[class*="_panelLis
1392
1412
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .07) !important;
1393
1413
  }
1394
1414
 
1395
- /* ---------- 设置面板:全屏(避开 Electron 标题栏)+ 标题左侧返回按钮 ---------- */
1396
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) {
1397
- top: var(--dsh-windows-titlebar-height, 0px) !important;
1398
- align-items: stretch !important;
1399
- justify-content: stretch !important;
1400
- }
1401
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) > [class*="_panel"] {
1402
- width: 100% !important;
1403
- max-width: none !important;
1404
- height: 100% !important;
1405
- max-height: none !important;
1406
- border-radius: 0 !important;
1407
- box-shadow: none !important;
1408
- }
1409
- /* 只在窗口足够宽时锁定两列布局,窄窗口沿用宿主自己的单列布局 */
1410
- @media (min-width: 720px) {
1411
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) > [class*="_panel"] {
1412
- grid-template-columns: 220px minmax(0, 1fr) !important;
1413
- }
1414
- }
1415
- /* 全屏时不需要遮罩,去掉它会露出标题栏下方的一条描边 */
1416
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="_mask"] {
1417
- display: none !important;
1418
- }
1419
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="_close"] {
1420
- display: none !important;
1421
- }
1422
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navTitle"] {
1423
- padding-left: 52px !important;
1424
- /* 手型由脚本按文字实际矩形设置,见 installSettingsBackButton */
1415
+ /* 设置面板默认 800×800(宿主 SettingsRoot.module.css 里写死的),
1416
+ 打开这个开关后放宽到 1200×900,长描述和表单不再频繁换行或被滚动截断。
1417
+
1418
+ 宽度上限和最大宽度要一起放宽:宿主原值是 calc(100vw - 48px),
1419
+ 不改的话窄窗口下会被这条先钳住,改动看不出效果。
1420
+
1421
+ 高度只改上限,边距沿用宿主的:它写的是
1422
+ min(800px, calc(100vh - 2 * max(24px, var(--dsh-frame-overlay-top, 24px)))),
1423
+ max-height 那半句原样搬过来,只把 800px 换成 900px。 */
1424
+ html[data-dcc-settings-wide="on"] [class*="_overlay"]:has([class*="_navTitle"]) > [class*="_panel"] {
1425
+ width: 1200px !important;
1426
+ max-width: calc(100vw - 96px) !important;
1427
+ height: min(900px, calc(100vh - 2 * max(24px, var(--dsh-frame-overlay-top, 24px)))) !important;
1425
1428
  }
1429
+
1426
1430
  /* 设置导航项:略矮一点,归「减小圆角与间距」管 */
1427
1431
  html[data-dcc-radius="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*="_navCell"] {
1428
1432
  position: relative;
@@ -1430,39 +1434,6 @@ html[data-dcc-radius="on"] [class*="_overlay"]:has([class*="_navTitle"]) [class*
1430
1434
  padding-top: 8px !important;
1431
1435
  padding-bottom: 8px !important;
1432
1436
  }
1433
- html[data-dcc-full="on"] .dcc-settings-back {
1434
- position: absolute;
1435
- left: 14px;
1436
- top: 0;
1437
- z-index: 2;
1438
- display: inline-flex;
1439
- align-items: center;
1440
- justify-content: center;
1441
- width: 28px;
1442
- height: 24px;
1443
- padding: 0;
1444
- border: 0;
1445
- border-radius: var(--dsw-radius-sm);
1446
- background: transparent;
1447
- color: var(--dsw-alias-label-primary);
1448
- cursor: pointer;
1449
- transition: background-color .15s;
1450
- }
1451
- /* hover 也带上同样的前缀:基础规则现在是 html[data-dcc-full="on"] .dcc-settings-back
1452
- (0,2,1),比裸的 .dcc-settings-back:hover(0,2,0)高,不加前缀底色会被压回去。 */
1453
- html[data-dcc-full="on"] .dcc-settings-back:hover {
1454
- background: var(--dsw-alias-interactive-bg-hover);
1455
- }
1456
- /* 悬停「设置」标题时,左侧箭头一起高亮。
1457
- 标题盒子撑满整行,:hover 会连空白一起算,所以这里认脚本按文字矩形写的属性。 */
1458
- html[data-dcc-full="on"] [class*="_overlay"]:has([class*="_navTitle"][data-dcc-hot="on"]) .dcc-settings-back {
1459
- background: var(--dsw-alias-interactive-bg-hover);
1460
- }
1461
- /* 非全屏时用宿主自己的关闭按钮,自绘的返回箭头不出现 */
1462
- html[data-dcc-full="off"] .dcc-settings-back {
1463
- display: none !important;
1464
- }
1465
-
1466
1437
  /* ---------- 左上角品牌区 ---------- */
1467
1438
  html[data-dcc-logo="hidden"] [class*="_brand"]:not([class*="_brandMark"]):not([class*="_brandName"]):not([class*="_brandIdentity"]),
1468
1439
  html[data-dcc-logo="hidden"] [class*="_railMark"] {
@@ -1623,190 +1594,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
1623
1594
  };
1624
1595
  }
1625
1596
 
1626
-
1627
- /**
1628
- * 设置面板左上角的返回按钮:点击触发原关闭按钮,保留原关闭逻辑。
1629
- * 面板挂载时走 requestAnimationFrame 在下一帧补上,不让按钮比面板慢一拍;
1630
- * 其它 DOM 变动仍用 350ms 兜底,避免流式输出时每帧都做全局查询。
1631
- */
1632
- function installSettingsBackButton() {
1633
- let btn = null;
1634
- let observer = null;
1635
- let timer = null;
1636
- let rafId = 0;
1637
-
1638
- const findPanel = () => {
1639
- const title = document.querySelector('[class*="_navTitle"]');
1640
- return title === null ? null : title.parentElement;
1641
- };
1642
-
1643
- /**
1644
- * 按钮垂直位置按「标题文字的实际矩形」算——容器带 padding 时,
1645
- * 盒子中心和文字中心并不重合。
1646
- * 入场动画会给面板挂 transform,rect 是缩放后的,所以再除以缩放比
1647
- * 还原成布局坐标,动画前后算出来的值才一致。
1648
- */
1649
- const align = () => {
1650
- if (btn === null || !btn.isConnected || btn.offsetParent === null) return;
1651
- const title = document.querySelector('[class*="_navTitle"]');
1652
- if (title === null) return;
1653
- const range = document.createRange();
1654
- range.selectNodeContents(title);
1655
- const rects = range.getClientRects();
1656
- if (rects.length === 0) return;
1657
- const textRect = rects[0];
1658
- const panel = btn.offsetParent;
1659
- const panelRect = panel.getBoundingClientRect();
1660
- const scale = panel.offsetHeight > 0 ? panelRect.height / panel.offsetHeight : 1;
1661
- const centerY = (textRect.top + textRect.height / 2 - panelRect.top) / (scale > 0 ? scale : 1);
1662
- btn.style.top = `${Math.round(centerY - btn.offsetHeight / 2)}px`;
1663
- };
1664
-
1665
- const closePanel = (panel) => {
1666
- const close = panel.querySelector('[class*="_header"] [class*="_close"]');
1667
- if (close !== null) close.click();
1668
- };
1669
-
1670
- const ensure = () => {
1671
- /* 总开关关闭时自绘按钮也要撤掉,否则会留下一个没有样式的裸按钮 */
1672
- if (document.documentElement.dataset.dccEnabled !== 'on') {
1673
- if (btn !== null) btn.remove();
1674
- btn = null;
1675
- return;
1676
- }
1677
- const panel = findPanel();
1678
- if (panel === null) {
1679
- if (btn !== null) btn.remove();
1680
- btn = null;
1681
- return;
1682
- }
1683
- if (btn !== null && btn.isConnected && btn.parentElement === panel) {
1684
- align();
1685
- return;
1686
- }
1687
- if (btn !== null) btn.remove();
1688
- btn = document.createElement('button');
1689
- btn.type = 'button';
1690
- btn.className = 'dcc-settings-back';
1691
- btn.setAttribute('aria-label', isZh() ? '返回' : 'Back');
1692
- btn.title = isZh() ? '返回' : 'Back';
1693
- btn.innerHTML = '<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true">'
1694
- + '<path d="M10 3 5 8l5 5" fill="none" stroke="currentColor" stroke-width="1.6"'
1695
- + ' stroke-linecap="round" stroke-linejoin="round"/></svg>';
1696
- btn.addEventListener('click', () => closePanel(panel));
1697
- panel.appendChild(btn);
1698
- align();
1699
- };
1700
-
1701
- const insertSoon = () => {
1702
- if (rafId !== 0) return;
1703
- rafId = window.requestAnimationFrame(() => {
1704
- rafId = 0;
1705
- ensure();
1706
- /* 万一这一帧面板还没挂完,退回原来的兜底节奏 */
1707
- if (btn === null && timer === null) {
1708
- timer = window.setTimeout(() => {
1709
- timer = null;
1710
- ensure();
1711
- }, 350);
1712
- }
1713
- });
1714
- };
1715
-
1716
- const schedule = (records) => {
1717
- /* 面板是「新增了包含 _navTitle 的节点」,这类变动要求下一帧就有按钮 */
1718
- for (const record of records) {
1719
- for (const node of record.addedNodes) {
1720
- if (node.nodeType !== 1) continue;
1721
- if (node.matches('[class*="_navTitle"]') || node.querySelector('[class*="_navTitle"]') !== null) {
1722
- insertSoon();
1723
- return;
1724
- }
1725
- }
1726
- }
1727
- if (timer !== null) return;
1728
- timer = window.setTimeout(() => {
1729
- timer = null;
1730
- ensure();
1731
- }, 350);
1732
- };
1733
-
1734
- /* 标题元素被撑满整行,空白处也在它盒子里;只有落在文字实际矩形上才算点击。
1735
- 左侧再放宽一点,把标题与返回箭头之间那段 padding 空隙也算进来。 */
1736
- const LABEL_LEFT_SLACK = 14;
1737
- const hitsLabel = (title, event) => {
1738
- const range = document.createRange();
1739
- range.selectNodeContents(title);
1740
- const rects = range.getClientRects();
1741
- for (let i = 0; i < rects.length; i += 1) {
1742
- const rect = rects[i];
1743
- if (event.clientX >= rect.left - LABEL_LEFT_SLACK && event.clientX <= rect.right
1744
- && event.clientY >= rect.top && event.clientY <= rect.bottom) return true;
1745
- }
1746
- return false;
1747
- };
1748
-
1749
- /* 点面板标题(「设置」这几个字)也能返回;用委托,面板重渲染不会丢监听 */
1750
- const onClick = (event) => {
1751
- if (document.documentElement.dataset.dccFull !== 'on') return;
1752
- const target = event.target;
1753
- if (!(target instanceof Element)) return;
1754
- const title = target.closest('[class*="_navTitle"]');
1755
- if (title === null || title.parentElement === null) return;
1756
- if (!hitsLabel(title, event)) return;
1757
- closePanel(title.parentElement);
1758
- };
1759
-
1760
- /* 手型和高亮都只跟着文字走:整行都是标题的盒子,空白不该有可点反馈 */
1761
- let cursorTitle = null;
1762
- const clearHot = () => {
1763
- if (cursorTitle === null) return;
1764
- cursorTitle.style.cursor = '';
1765
- cursorTitle.dataset.dccHot = 'off';
1766
- cursorTitle = null;
1767
- };
1768
- const onMove = (event) => {
1769
- if (document.documentElement.dataset.dccFull !== 'on') {
1770
- clearHot();
1771
- return;
1772
- }
1773
- const target = event.target;
1774
- const title = target instanceof Element ? target.closest('[class*="_navTitle"]') : null;
1775
- if (title === null) {
1776
- clearHot();
1777
- return;
1778
- }
1779
- const hot = hitsLabel(title, event);
1780
- const want = hot ? 'pointer' : '';
1781
- if (title.style.cursor !== want) title.style.cursor = want;
1782
- const wantHot = hot ? 'on' : 'off';
1783
- if (title.dataset.dccHot !== wantHot) title.dataset.dccHot = wantHot;
1784
- cursorTitle = title;
1785
- };
1786
-
1787
- ensure();
1788
- observer = new MutationObserver(schedule);
1789
- observer.observe(document.body, { childList: true, subtree: true });
1790
- document.addEventListener('click', onClick, true);
1791
- document.addEventListener('mousemove', onMove, true);
1792
- /* 设置面板全屏 / 窗口模式切换后,返回按钮要重新对齐位置 */
1793
- const onPrefs = (event) => {
1794
- if (event.detail && event.detail.key === 'settingsFullscreen') ensure();
1795
- };
1796
- window.addEventListener('dcc-prefs-changed', onPrefs);
1797
-
1798
- return () => {
1799
- window.removeEventListener('dcc-prefs-changed', onPrefs);
1800
- observer.disconnect();
1801
- if (timer !== null) clearTimeout(timer);
1802
- if (rafId !== 0) window.cancelAnimationFrame(rafId);
1803
- document.removeEventListener('click', onClick, true);
1804
- document.removeEventListener('mousemove', onMove, true);
1805
- if (cursorTitle !== null) clearHot();
1806
- if (btn !== null) btn.remove();
1807
- };
1808
- }
1809
-
1810
1597
  /**
1811
1598
  * 会话行悬停时只留「…」菜单和置顶按钮,其余(宿主的归档、各插件加的)隐藏。
1812
1599
  * 按钮上只有共用的 iconButton 类,所以按 data-context-menu-trigger 和 aria-label
@@ -2255,11 +2042,13 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2255
2042
  let rafId = 0;
2256
2043
 
2257
2044
  const decorate = () => {
2258
- const hint = document.querySelector('[class*="_hint"]');
2045
+ /* 白名单:只在会话正文区里找 _hint。
2046
+ 宿主在别处也用了同一个类名(内置插件详情页就有一处),
2047
+ 全局 querySelector 会抓错地方。 */
2048
+ const host = document.querySelector('[data-conversation-scroll]');
2049
+ if (host === null) return;
2050
+ const hint = host.querySelector('[class*="_hint"]');
2259
2051
  if (hint === null) return;
2260
- /* 加载页的 hint 归 installBootHint 管,这里跳过,避免两个模块
2261
- 对同一个元素各改一半。 */
2262
- if (hint.closest('[data-dsh-boot]') !== null) return;
2263
2052
  if (hint.querySelector('[data-dcc-hint-fish]') !== null) return;
2264
2053
 
2265
2054
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -2279,8 +2068,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2279
2068
  };
2280
2069
  /* 按正文区域(而不是视口)的中心定位:侧栏展开时两者差一截。 */
2281
2070
  const center = (hint) => {
2282
- /* 加载页里的 hint 由 installBootHint 单独居中,这里跳过。 */
2283
- if (hint.closest('[data-dsh-boot]') !== null) return;
2284
2071
  const host = document.querySelector('[data-conversation-scroll]');
2285
2072
  if (host === null) return;
2286
2073
  const rect = host.getBoundingClientRect();
@@ -2295,10 +2082,12 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2295
2082
  手动重播一次:先摘掉动画类、强制重排、再挂回去。 */
2296
2083
  let lastHadHint = false;
2297
2084
  const replayFade = () => {
2298
-
2085
+ /* 同样限定在正文区内——_column / _marks 这些名字在别处也可能出现 */
2086
+ const area = document.querySelector('[data-conversation-scroll]');
2087
+ if (area === null) return;
2299
2088
  const targets = [
2300
- document.querySelector('[class*="_column"]'),
2301
- document.querySelector('[class*="_marks"]'),
2089
+ area.querySelector('[class*="_column"]'),
2090
+ area.querySelector('[class*="_marks"]'),
2302
2091
  ].filter((el) => el !== null && el.getBoundingClientRect().height > 0);
2303
2092
  if (targets.length === 0) return;
2304
2093
  for (const el of targets) el.removeAttribute('data-dcc-fade-in');
@@ -2308,10 +2097,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
2308
2097
  };
2309
2098
 
2310
2099
  const watchHint = () => {
2311
- /* 只看会话界面里的提示——加载页也有同一个 _hint,它消失不表示
2312
- 正文就位,跟着触发会白跑一次(虽然 targets 为空会直接返回)。 */
2313
- const hint = document.querySelector('[class*="_hint"]');
2314
- const hasHint = hint !== null && hint.closest('[data-dsh-boot]') === null;
2100
+ /* 和 decorate 一样只看正文区的提示 */
2101
+ const host = document.querySelector('[data-conversation-scroll]');
2102
+ const hint = host === null ? null : host.querySelector('[class*="_hint"]');
2103
+ const hasHint = hint !== null;
2315
2104
  /* 由「有提示」变成「没提示」,说明这一轮内容已经就位 */
2316
2105
  if (lastHadHint && !hasHint) replayFade();
2317
2106
  lastHadHint = hasHint;
@@ -3157,10 +2946,10 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
3157
2946
  onChange: update('disableMenuBlur'),
3158
2947
  }),
3159
2948
  h(Row, {
3160
- title: zh ? '设置面板全屏' : 'Full-screen settings panel',
3161
- desc: zh ? '使用非窗口化的设置页面。' : 'Use a non-windowed settings page.',
3162
- checked: prefs.settingsFullscreen,
3163
- onChange: update('settingsFullscreen'),
2949
+ title: zh ? '增加设置窗口尺寸' : 'Larger settings panel',
2950
+ desc: zh ? '增加设置窗口的最大宽度和高度上限,以增加可视范围。' : 'Raises the settings panel maximum width and height caps for more visible content.',
2951
+ checked: prefs.settingsWide,
2952
+ onChange: update('settingsWide'),
3164
2953
  }),
3165
2954
  h(Row, {
3166
2955
  title: zh ? 'Windows 默认使用微软雅黑字体' : 'Use Microsoft YaHei by default on Windows',
@@ -3320,8 +3109,8 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
3320
3109
  h('p', { className: 'dcc-meta' },
3321
3110
  /* 中文之间用一个全角空格(\u3000)分隔,比两个半角空格更稳 */
3322
3111
  zh
3323
- ? `版本:${VERSION}\u3000更新日期:${UPDATED}\n此版本基于 DSH v0.2.2-rc.3 测试`
3324
- : `Version: ${VERSION} Updated: ${UPDATED}\nTested on DSH v0.2.2-rc.3`),
3112
+ ? `版本:${VERSION}\u3000更新日期:${UPDATED}\n此版本基于 DSH v0.2.2-rc.5 测试`
3113
+ : `Version: ${VERSION} Updated: ${UPDATED}\nTested on DSH v0.2.2-rc.5`),
3325
3114
  h('button', {
3326
3115
  type: 'button',
3327
3116
  className: 'dcc-reset',
@@ -3371,7 +3160,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
3371
3160
  removeCss = () => tag.remove();
3372
3161
  }
3373
3162
  const removeNewSessionRow = installNewSessionRow();
3374
- const removeSettingsBack = installSettingsBackButton();
3375
3163
  const removeRowActionFilter = installRowActionFilter();
3376
3164
  const removeHoverCardBlocker = installHoverCardBlocker();
3377
3165
  const removeViewSwitcher = installViewSwitcher();
@@ -3386,8 +3174,7 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
3386
3174
  return () => {
3387
3175
  removeCss();
3388
3176
  removeNewSessionRow();
3389
- removeSettingsBack();
3390
- removeRowActionFilter();
3177
+ removeRowActionFilter();
3391
3178
  removeHoverCardBlocker();
3392
3179
  removeViewSwitcher();
3393
3180
  removeBalance();
@@ -3409,7 +3196,6 @@ html[data-dcc-logo="hidden"] [class*="_logoRow"] {
3409
3196
  delete root.dataset.dccTextDim;
3410
3197
  delete root.dataset.dccTransition;
3411
3198
  delete root.dataset.dccMenuBlur;
3412
- delete root.dataset.dccFull;
3413
3199
  delete root.dataset.dccHover;
3414
3200
  delete root.dataset.dccRowButtons;
3415
3201
  delete root.dataset.dccCompactHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ui-alt",
3
- "version": "0.2.422",
3
+ "version": "0.2.437",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "在保持原版 UI 大体布局不变的情况下,进行减小圆角、紧凑化、整洁化、高效化改进,使 UI 视觉更加冷静、专业、高效。同时添加余额显示。大部分改动可在设置中单独开关。",