dsh-multipane 1.0.8 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +31 -0
  2. package/lib/client.js +198 -26
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -243,3 +243,34 @@ C:\Users\weiai\.dsh\plugin-src\_probe\sync-client.ps1 -Push # 台式机 ->
243
243
  最右按钮距右边缘 8px。标签条顶边与原生标题/工具栏行同为 y=40,齐平。
244
244
  每栏的输入框与插件内容实测齐全(停止/发送、添加文件、访问模式、专家、选择模型、
245
245
  轮次步数、费用明细、tok 与缓存命中、上下文已用)。
246
+
247
+ ## 更新记录
248
+
249
+ ### 1.0.10(2026-11-10)
250
+ - **修「关掉多栏视图后侧栏样式还在」**:关闭时只清了 `data-dsv-row`,没有删除插件自己的样式表——而其中
251
+ `[data-row-key^="session:"]:not([data-dsv-row]) * { opacity: .5 }` 这条**不需要任何行标记**,
252
+ 只要样式表还在,所有会话行的文字就一直是暗的。现在关闭/卸载时把样式表、43 个 `--dsv-*` 变量、
253
+ `data-dsv-row` / `data-dsv-pulse` 标记和复用来的 `_selected` 类一起清掉;重新启用时整体恢复。
254
+
255
+ ### 1.0.9(2026-11-10)
256
+ - **修「最暗 / 最亮两个圆点不在滑轨上」**:滑杆的滑块被 Chromium 顶在轨道顶部(不自动居中),实测圈心比轨道中心高 5px;补 `margin-top` 并按 border-box 计算宽度。
257
+ - **修「调悬停浓度时预览没反应」**:预览里新增一个固定的「悬停」标签,调「悬停时浓度」能实时看到那条线的变化。
258
+ - **拖动滑杆时暂停预览里的呼吸**:呼吸一直在闪就看不出正在调的底色浓度;松手立刻恢复。
259
+ - **修「有状态点的标签被压扁、挡住文字」**:宽度计算漏了状态点 + 间隙的 9px(实测无点标签余 3.7px、加上绿点就变成缺 5px 被裁)。现在按「会不会画状态点」分别计算。
260
+ - **修偶发的「标签全被压成 12px」**:栏宽还没量到时(刚挂载 / 从最小化恢复)会走到极限压缩分支,之后 ResizeObserver 不再回调就一直不恢复;现在未量到宽度时按理想宽渲染,并补 8 次延迟重测。
261
+ - **设置页新增「检查更新」**:显示当前版本,点一下去 npm 查最新版并告诉你安装命令(只读,不改任何文件)。
262
+
263
+ ### 1.0.8(2026-11-10)
264
+ - **侧栏「运行中呼吸」**:会话执行任务时,它在侧栏那一行的底色一浓一淡地呼吸,用来表示"正在干活"。
265
+ 状态取自会话真实的运行标记,不是估算。四类会话(已激活 / 已打开且显示 / 已打开未显示 / 未打开)各自一套
266
+ 「最暗 ↔ 最亮 ↔ 节奏」,后两类可勾选"跟随已打开且显示"。
267
+ - **设置页改版**:状态徽章、四个分区(基本 / 界面元素 / 外观 / 备份与恢复)、卡片悬停、底部「怎么用」要点。
268
+ - **备份与恢复**:把设置导出成 JSON 文件(系统另存为),换机器或重装后导回即可还原全部外观与开关;文件不含会话内容。
269
+ - 预览里的会话名改用状态名(激活会话 / 打开并显示 / 打开未显示 / 未打开会话),不再显示真实会话标题。
270
+ - 修复:连点多个「展开」只有一个生效。
271
+
272
+ ### 1.0.7
273
+ - 底栏不再同时显示两份统计(原生行 + 兜底统计),并修掉 0.5 秒来回切换的闪烁。
274
+
275
+ ### 1.0.6 及更早
276
+ - 底栏统计行不再抓住被宿主抛弃的节点(「费用明细」等按钮恢复可点);Ctrl+Tab 栏内切标签;拖放只接受栏内等。
package/lib/client.js CHANGED
@@ -16,6 +16,23 @@ window.__ModuleLoader__.load({
16
16
  * 改名字只改这一行。四个字,与「多栏」语义衔接。
17
17
  */
18
18
  const PLUGIN_LABEL = "多栏视图";
19
+ /* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
20
+ const PLUGIN_VERSION = "1.0.10";
21
+ const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
+ /* 按 x.y.z 数值比较,不能用字符串比大小:字典序下 "1.0.10" < "1.0.9",
23
+ 而且降级场景(本地 1.0.10、线上 1.0.9)会被误判成「有新版本」。 */
24
+ function compareVersion(a, b) {
25
+ const pa = String(a).split(".");
26
+ const pb = String(b).split(".");
27
+ for (let index = 0; index < Math.max(pa.length, pb.length); index += 1) {
28
+ const na = parseInt(pa[index], 10);
29
+ const nb = parseInt(pb[index], 10);
30
+ const va = Number.isFinite(na) ? na : 0;
31
+ const vb = Number.isFinite(nb) ? nb : 0;
32
+ if (va !== vb) return va > vb ? 1 : -1;
33
+ }
34
+ return 0;
35
+ }
19
36
  const STORAGE_KEY = "dsh-split-view:workspace:v1";
20
37
  const STYLE_ID = "dsh-split-view-style";
21
38
  const CONTENT_FACTORY = "conversation.content";
@@ -53,6 +70,11 @@ window.__ModuleLoader__.load({
53
70
  /* 标签里除了文字之外的固定占位:左 padding 9 + 右 padding 6 + 关闭按钮 18 + 间隙 4
54
71
  + 状态点 6 + 间隙 4 + 边框 2 ≈ 49,取 52 留一点余量。 */
55
72
  const TAB_LABEL_CHROME_PX = 36;
73
+ /* 带状态点时还要多占 9px(.dsv-dot 6px + .dsv-tab 的 flex gap 3px)。
74
+ 实测:「报错排查」这种无点标签 tabW=86,子元素合计 65 + padding 13 + border 1.33 = 82.3,
75
+ 还余 3.7px;一旦前面多出绿点就变成 91.3 > 86 —— text-overflow:clip 直接把字切掉。
76
+ 用户报「右边那个标签被压得很厉害、挡住字」就是这条(截图里那个标签正好带绿点)。 */
77
+ const TAB_LABEL_CHROME_DOT_PX = 46;
56
78
  const TAB_GAP_PX = 2; /* 标签之间的间距 */
57
79
 
58
80
  /**
@@ -68,9 +90,12 @@ window.__ModuleLoader__.load({
68
90
  * 一个标签「刚好放下它的标题」需要多宽:文字宽 + 关闭按钮等固定占位。
69
91
  * 用 canvas 量文字(与布局解耦,窄栏下也准),并按标题做缓存。
70
92
  */
71
- function tabIdealWidth(label) {
93
+ function tabIdealWidth(label, withDot) {
72
94
  const text = String(label ?? "");
73
- const cached = TAB_LABEL_W_CACHE.get(text);
95
+ /* 缓存 key 必须带「有没有状态点」:同一标题两种情况占位差 9px,
96
+ 只按标题做 key 会让先渲染的那种把另一种的宽度带偏。 */
97
+ const cacheKey = `${withDot === true ? "d" : "n"}:${text}`;
98
+ const cached = TAB_LABEL_W_CACHE.get(cacheKey);
74
99
  if (cached !== void 0) return cached;
75
100
  let textW = text.length * 12.5; /* 兜底:按中文宽估 */
76
101
  try {
@@ -83,13 +108,24 @@ window.__ModuleLoader__.load({
83
108
  } catch {
84
109
  /* 忽略:用估算值 */
85
110
  }
86
- const width = Math.ceil(textW) + TAB_LABEL_CHROME_PX;
87
- TAB_LABEL_W_CACHE.set(text, width);
111
+ const width = Math.ceil(textW) + (withDot === true ? TAB_LABEL_CHROME_DOT_PX : TAB_LABEL_CHROME_PX);
112
+ TAB_LABEL_W_CACHE.set(cacheKey, width);
88
113
  return width;
89
114
  }
90
115
 
91
116
  function layoutTabWidths(available, count, idealWidths) {
92
117
  if (count <= 0) return [];
118
+ /* 可用宽度还没量到(headW 初值 0、窗口刚最小化恢复、面板刚挂载):
119
+ 一律按理想宽渲染,让 overflow 去兜底。以前会走到下面的「连 MIN 都放不下」分支,
120
+ 把每个标签压成 12px(标题、状态点、关闭按钮全看不见),而且不保证会重算。 */
121
+ if (!(available > 0)) {
122
+ const fallbackWidths = [];
123
+ for (let index = 0; index < count; index += 1) {
124
+ const rawIdeal = idealWidths !== void 0 && idealWidths[index] !== void 0 ? idealWidths[index] : TAB_PREFERRED_PX;
125
+ fallbackWidths.push(Math.max(TAB_MIN_PX, Math.min(TAB_PREFERRED_PX, Math.round(rawIdeal))));
126
+ }
127
+ return fallbackWidths;
128
+ }
93
129
  /* 每个标签的理想宽 = 自己标题的文字宽 + 固定占位(关闭按钮等),夹在 MIN..PREFERRED。
94
130
  以前统一 200 且下限被 CROSSOVER(96) 卡住 —— 「新会话」只要 70 多像素,
95
131
  却被撑到 96,多出来的全落在名字和 × 之间(用户 2026-11-09 报的就是这个)。 */
@@ -961,6 +997,10 @@ window.__ModuleLoader__.load({
961
997
  */
962
998
  function applyLineVars() {
963
999
  try {
1000
+ /* 关掉插件后不该继续往根上写变量(连同样的变量都会让宿主看起来"没关干净")。
1001
+ 重新打开时这里会再跑一遍,样式表一并补回来。 */
1002
+ if (prefs.state.enabled !== true) return;
1003
+ installStyles();
964
1004
  const el = document.documentElement;
965
1005
  const state = prefs.state;
966
1006
  const a = state.appearance ?? DEFAULT_APPEARANCE();
@@ -1047,15 +1087,36 @@ window.__ModuleLoader__.load({
1047
1087
  }
1048
1088
  }
1049
1089
 
1050
- /** 插件卸载时把留在 <html> 上的变量清掉,别给宿主留残留。 */
1051
- function clearLineVars() {
1090
+ /**
1091
+ * 把插件留在页面上的**全部**痕迹清掉(插件关掉 / 卸载时调用)。
1092
+ *
1093
+ * 三样都要清,少一样就会「关掉了但样式还在」:
1094
+ * ① 样式表本身 —— 里面有 [data-row-key^="session:"]:not([data-dsv-row]) * { opacity: .5 },
1095
+ * 这条**不需要任何行标记**,只要 style 还在,所有会话行的文字就一直是暗的;
1096
+ * ② <html> 上的 --dsv-* 变量(43 个)—— 宿主侧栏行读的就是它们;
1097
+ * ③ 行上的 data-dsv-row / data-dsv-pulse 与复用来的 _selected class。
1098
+ */
1099
+ function clearAllDsvState() {
1052
1100
  try {
1053
1101
  const el = document.documentElement;
1054
- el.style.removeProperty("--dsv-line");
1055
- el.style.removeProperty("--dsv-line-soft");
1056
- el.style.removeProperty("--dsv-line-w");
1102
+ const style = document.getElementById(STYLE_ID);
1103
+ if (style !== null) style.remove();
1104
+ const names = [];
1105
+ for (let index = 0; index < el.style.length; index += 1) {
1106
+ const name = el.style.item(index);
1107
+ if (typeof name === "string" && name.indexOf("--dsv") === 0) names.push(name);
1108
+ }
1109
+ for (const name of names) el.style.removeProperty(name);
1110
+ el.removeAttribute("data-dsv-settings");
1111
+ for (const row of document.querySelectorAll("[data-dsv-row]")) row.removeAttribute("data-dsv-row");
1112
+ for (const row of document.querySelectorAll("[data-dsv-pulse]")) row.removeAttribute("data-dsv-pulse");
1113
+ for (const row of document.querySelectorAll('[data-row-key^="session:"]')) {
1114
+ for (const cls of Array.from(row.classList)) {
1115
+ if (cls.endsWith("_selected")) row.classList.remove(cls);
1116
+ }
1117
+ }
1057
1118
  } catch {
1058
- /* 忽略 */
1119
+ /* 非浏览器环境 */
1059
1120
  }
1060
1121
  }
1061
1122
 
@@ -1212,12 +1273,9 @@ window.__ModuleLoader__.load({
1212
1273
  /* 插件关掉后必须**停手并清掉标记**,否则会话列表还带着插件的高亮,
1213
1274
  但主区域已经还给宿主了 —— 两边对不上,用户看起来就是「关不掉」。 */
1214
1275
  if (prefs.state.enabled !== true) {
1215
- for (const row of document.querySelectorAll("[data-dsv-row]")) row.removeAttribute("data-dsv-row");
1216
- for (const row of document.querySelectorAll('[data-row-key^="session:"]')) {
1217
- for (const cls of Array.from(row.classList)) {
1218
- if (cls.endsWith("_selected")) row.classList.remove(cls);
1219
- }
1220
- }
1276
+ /* 样式表还在 = 还没清过(宿主重渲染会重建行,所以每次都清也没问题:
1277
+ querySelectorAll 在没有标记时几乎零成本)。 */
1278
+ if (document.getElementById(STYLE_ID) !== null) clearAllDsvState();
1221
1279
  return;
1222
1280
  }
1223
1281
  try {
@@ -1613,6 +1671,12 @@ window.__ModuleLoader__.load({
1613
1671
  .dsv-pv-row[data-pulse="1"][data-state="open"]{background-color:var(--dsv-pv-c)!important;animation:dsv-breathe-open var(--dsv-pv-openShown-dur,3s) ease-in-out infinite}
1614
1672
  .dsv-pv-row[data-pulse="1"][data-state="open-hidden"]{background-color:var(--dsv-pv-c)!important;animation:dsv-breathe-hidden var(--dsv-pv-openHidden-dur,3s) ease-in-out infinite}
1615
1673
  .dsv-pv-row[data-pulse="1"][data-state="none"]{background-color:var(--dsv-pv-c)!important;animation:dsv-breathe-un var(--dsv-pv-unopened-dur,3s) ease-in-out infinite}
1674
+ /* 拖动滑杆时暂停预览里的呼吸:一直在闪就看不出正在调的那个值。
1675
+ 停的时候回落到「常态底板色」(正是用户要看的浓度),松手自动恢复呼吸。 */
1676
+ .dsv-preview[data-freeze="1"] .dsv-pv-row[data-state="focus"]{animation:none!important;background-color:var(--dsv-row-focus-bg,rgba(167,170,175,.15))!important}
1677
+ .dsv-preview[data-freeze="1"] .dsv-pv-row[data-state="open"]{animation:none!important;background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06))!important}
1678
+ .dsv-preview[data-freeze="1"] .dsv-pv-row[data-state="open-hidden"]{animation:none!important;background-color:var(--dsv-row-open-bg,rgba(167,170,175,.06))!important}
1679
+ .dsv-preview[data-freeze="1"] .dsv-pv-row[data-state="none"]{animation:none!important;background-color:transparent!important}
1616
1680
  /* ── 侧栏入口的选中态:跟着「是否在设置页」走 ────────────────────
1617
1681
  宿主的 PanelRow 用 active = activePanelId === id 决定高亮(.panelActive)。
1618
1682
  本插件的 panel id 就是主面板 id,所以只要插件启用、activePanelId 恒等于它,
@@ -1730,6 +1794,11 @@ window.__ModuleLoader__.load({
1730
1794
  .dsv-settings-inner{width:100%;max-width:640px;margin:0 auto;padding-top:32px;display:flex;flex-direction:column;gap:14px}
1731
1795
  /* ── 页头(2026-11-10 排版重做,只动样式)── */
1732
1796
  .dsv-page-head{display:flex;flex-direction:column;gap:8px;padding:2px 2px 6px}
1797
+ /* 版本 / 检查更新:一行文字 + 一个按钮,失败也不挡路 */
1798
+ .dsv-update-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:0 2px 4px}
1799
+ .dsv-update-text{font-size:11.5px;line-height:1.6;opacity:.62}
1800
+ .dsv-update-text[data-new="1"]{opacity:1;color:#7bd88f}
1801
+ .dsv-update-text[data-err="1"]{opacity:.95;color:#e08888}
1733
1802
  .dsv-page-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
1734
1803
  .dsv-page-title{font-size:19px;font-weight:700;letter-spacing:.01em;margin:0}
1735
1804
  .dsv-badge{display:inline-flex;align-items:center;gap:5px;height:20px;padding:0 8px;border-radius:999px;font-size:11px;font-weight:600;border:1px solid transparent}
@@ -1803,6 +1872,9 @@ window.__ModuleLoader__.load({
1803
1872
  .dsv-pv-tab[data-active="1"]{opacity:1;background:var(--dsh-surface-raised-color,rgba(128,128,128,.14));box-shadow:inset 0 calc(-1 * var(--dsv-tab-w,2px)) 0 var(--dsv-tab-focus,rgba(167,170,175,.75))}
1804
1873
  .dsv-pv-tab[data-active="1"][data-idle="1"]{opacity:.82;box-shadow:inset 0 calc(-1 * var(--dsv-tab-w,2px)) 0 var(--dsv-tab-idle,rgba(167,170,175,.3))}
1805
1874
  .dsv-pv-tab[data-locked="1"]{background:var(--dsv-misc-locked-bg,rgba(167,170,175,.12))}
1875
+ /* 第三个标签固定画「鼠标悬停在非焦点栏上」那一态:否则调「悬停时浓度」时预览毫无变化。 */
1876
+ .dsv-pv-tab[data-hover="1"]{opacity:.86;background:var(--dsv-tab-hover-bg,rgba(167,170,175,.08));border-color:var(--dsv-tab-hover-border,rgba(167,170,175,.22));box-shadow:inset 0 calc(-1 * var(--dsv-tab-w,2px)) 0 var(--dsv-tab-hover,rgba(167,170,175,.45))}
1877
+ .dsv-pv-tabs{overflow:hidden}
1806
1878
  .dsv-pv-caret{flex:0 0 auto;width:2px;align-self:stretch;margin:4px 1px;border-radius:1px;background:var(--dsv-misc-c,#a7aaaf);opacity:var(--dsv-misc-caret,.45)}
1807
1879
  .dsv-pv-divider{flex:0 0 7px;position:relative}
1808
1880
  .dsv-pv-divider::after{content:"";position:absolute;top:5px;bottom:5px;left:2px;width:var(--dsv-div-w,2px);border-radius:calc(var(--dsv-div-w,2px) / 2);background:var(--dsv-div-soft,rgba(167,170,175,.85))}
@@ -1844,11 +1916,15 @@ window.__ModuleLoader__.load({
1844
1916
  .dsv-range-mark{position:absolute;top:50%;width:3px;height:14px;transform:translate(-1.5px,-50%);background:rgba(255,255,255,.9);border-radius:1.5px;pointer-events:none;box-shadow:0 0 0 1px rgba(0,0,0,.55);z-index:3}
1845
1917
  /* 双端点滑杆(最暗↔最亮同一根轨道) */
1846
1918
  .dsv-dual{position:relative;height:22px;display:flex;align-items:center}
1847
- .dsv-dual-rail{position:absolute;left:6px;right:6px;height:4px;border-radius:2px;background:rgba(255,255,255,.16)}
1848
- .dsv-dual-fill{position:absolute;height:4px;border-radius:2px;background:color-mix(in srgb,var(--dsh-accent-color,#4a8cf7) 70%,transparent)}
1849
- .dsv-dual-input{position:absolute;left:0;top:0;width:100%;height:22px;margin:0;background:none;-webkit-appearance:none;appearance:none;pointer-events:none}
1850
- .dsv-dual-input::-webkit-slider-runnable-track{height:22px;background:transparent}
1851
- .dsv-dual-input::-webkit-slider-thumb{-webkit-appearance:none;pointer-events:auto;width:12px;height:12px;border-radius:50%;background:var(--dsh-accent-color,#4a8cf7);border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.5);cursor:pointer}
1919
+ .dsv-dual-rail{position:absolute;left:6px;right:6px;top:50%;height:4px;margin-top:-2px;border-radius:2px;background:rgba(255,255,255,.16)}
1920
+ .dsv-dual-fill{position:absolute;top:50%;height:4px;margin-top:-2px;border-radius:2px;background:color-mix(in srgb,var(--dsh-accent-color,#4a8cf7) 70%,transparent)}
1921
+ .dsv-dual-input{position:absolute;left:0;top:0;width:100%;height:22px;margin:0;padding:0;background:none;-webkit-appearance:none;appearance:none;pointer-events:none}
1922
+ .dsv-dual-input::-webkit-slider-runnable-track{height:22px;background:transparent;border:none}
1923
+ /* thumb 必须 border-box:默认 content-box 时宽度会带上边框,而轨道两端按 6px/12px 补偿。
1924
+ margin-top 必须显式给:track 高 22px 时 Chromium 会把 12px 的 thumb 顶在 track 顶部
1925
+ (不自动居中),实测圈心比轨道中心高 5px,肉眼就是「圈都不在滑轨上」。
1926
+ 5px = (22 - 12) / 2,与 .dsv-dual 的固定高度绑定,改高度要同步改这里。 */
1927
+ .dsv-dual-input::-webkit-slider-thumb{-webkit-appearance:none;pointer-events:auto;box-sizing:border-box;width:12px;height:12px;padding:0;margin-top:5px;border-radius:50%;background:var(--dsh-accent-color,#4a8cf7);border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.5);cursor:pointer}
1852
1928
  .dsv-dual-input:focus{outline:none}
1853
1929
  .dsv-width-row{display:flex;gap:6px;flex-wrap:wrap}
1854
1930
  .dsv-width-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;border-radius:7px;border:1px solid var(--dsh-border-color,rgba(128,128,128,.26));background:transparent;color:inherit;font-size:11.5px;font-family:inherit;cursor:pointer;opacity:.7}
@@ -3279,6 +3355,8 @@ window.__ModuleLoader__.load({
3279
3355
  const paneEl = document.querySelector(`.dsv-pane[data-pane-id="${pane.id}"]`);
3280
3356
  const node = paneEl ?? headRef.current;
3281
3357
  if (node === null || node === void 0) return;
3358
+ let retries = 0;
3359
+ let retryTimer = 0;
3282
3360
  const read = () => {
3283
3361
  const cs = getComputedStyle(node);
3284
3362
  const inner = node.clientWidth - (parseFloat(cs.paddingLeft) || 0) - (parseFloat(cs.paddingRight) || 0);
@@ -3286,15 +3364,33 @@ window.__ModuleLoader__.load({
3286
3364
  header 的左右 padding 与 + 按钮宽度统一在下面 stripW 里扣。
3287
3365
  侧栏折叠时标签条要整体右移让出宿主左上控件,可用宽度同步扣掉那一份;
3288
3366
  用 paneEl 而不是 node 量,避免拿已经右移过的 header 反复叠算。 */
3289
- setHeadW(Math.max(0, Math.round(inner) - (paneEl === null ? 0 : paneLeftGuard(paneEl))));
3367
+ const next = Math.max(0, Math.round(inner) - (paneEl === null ? 0 : paneLeftGuard(paneEl)));
3368
+ setHeadW(next);
3369
+ /* 读到 0 = 这一帧还没布局好(刚挂载 / 刚从最小化恢复 / 面板刚建)。
3370
+ ResizeObserver 只在尺寸「变化」时回调,读到 0 之后尺寸若不再变
3371
+ 就永远不重测,标签会一直停在极窄形态 —— 这就是「偶发」的来源。 */
3372
+ if (next <= 0 && retries < 8) {
3373
+ retries += 1;
3374
+ window.clearTimeout(retryTimer);
3375
+ retryTimer = window.setTimeout(read, 120);
3376
+ }
3290
3377
  };
3291
3378
  read();
3292
3379
  const observer = typeof ResizeObserver === "function" ? new ResizeObserver(read) : null;
3293
3380
  if (observer !== null) observer.observe(node);
3294
3381
  window.addEventListener("resize", read);
3382
+ const onVisible = () => {
3383
+ if (document.visibilityState === "visible") {
3384
+ retries = 0;
3385
+ read();
3386
+ }
3387
+ };
3388
+ document.addEventListener("visibilitychange", onVisible);
3295
3389
  return () => {
3390
+ window.clearTimeout(retryTimer);
3296
3391
  if (observer !== null) observer.disconnect();
3297
3392
  window.removeEventListener("resize", read);
3393
+ document.removeEventListener("visibilitychange", onVisible);
3298
3394
  };
3299
3395
  }, [pane.id]);
3300
3396
  /* 扣掉「+ 按钮」占宽。可拖窗口区(44px)只在**非最后一栏**要额外扣:
@@ -3315,7 +3411,19 @@ window.__ModuleLoader__.load({
3315
3411
  ? "已失效会话"
3316
3412
  : rowLabel(row) || "未命名会话";
3317
3413
  });
3318
- const tabWidths = layoutTabWidths(stripW, pane.tabs.length, tabLabels.map(tabIdealWidth));
3414
+ /* 这一标签会不会画状态点,判据必须与下面 runState 完全一致(同一个函数算两次会漂):
3415
+ 焦点栏的激活标签不画点;其余看宿主给的状态。 */
3416
+ const tabDotFlags = pane.tabs.map((tab) => {
3417
+ const sid = tab.sessionId;
3418
+ if (typeof sid !== "string" || sid === "") return false;
3419
+ if (focused === true && pane.activeTabId === tab.id) return false;
3420
+ return hostStateOf(sid) !== "";
3421
+ });
3422
+ const tabWidths = layoutTabWidths(
3423
+ stripW,
3424
+ pane.tabs.length,
3425
+ tabLabels.map((label, index) => tabIdealWidth(label, tabDotFlags[index]))
3426
+ );
3319
3427
  /* 标签条浮在窗口顶端那一行:fixed 不受宿主容器 overflow 裁剪;left/width 跟着
3320
3428
  所属栏的实时几何走(分隔条拖动、侧边栏折叠、加减栏都靠 ResizeObserver 同步)。 */
3321
3429
  const headRef = react.useRef(null);
@@ -5716,9 +5824,27 @@ window.__ModuleLoader__.load({
5716
5824
 
5717
5825
  function AppearancePreview(props) {
5718
5826
  const hl = typeof props.highlight === "string" && props.highlight !== "" ? props.highlight : "none";
5827
+ /* 正在拖任何一根滑杆 → 暂停预览里的呼吸。呼吸一直闪时看不出正在调的底色/亮度;
5828
+ 松手(pointerup / pointercancel)立刻恢复,不用再点一次。 */
5829
+ const [freeze, setFreeze] = react.useState(false);
5830
+ react.useEffect(() => {
5831
+ const isRange = (t) => t !== null && t !== void 0 && t.tagName === "INPUT" && t.type === "range";
5832
+ const down = (event) => {
5833
+ if (isRange(event.target)) setFreeze(true);
5834
+ };
5835
+ const up = () => setFreeze(false);
5836
+ window.addEventListener("pointerdown", down, true);
5837
+ window.addEventListener("pointerup", up, true);
5838
+ window.addEventListener("pointercancel", up, true);
5839
+ return () => {
5840
+ window.removeEventListener("pointerdown", down, true);
5841
+ window.removeEventListener("pointerup", up, true);
5842
+ window.removeEventListener("pointercancel", up, true);
5843
+ };
5844
+ }, []);
5719
5845
  return h(
5720
5846
  "div",
5721
- { className: "dsv-preview", "data-hl": hl },
5847
+ { className: "dsv-preview", "data-hl": hl, "data-freeze": freeze ? "1" : "0" },
5722
5848
  h(
5723
5849
  "div",
5724
5850
  { className: "dsv-pv-side" },
@@ -5738,7 +5864,8 @@ window.__ModuleLoader__.load({
5738
5864
  { className: "dsv-pv-tabs", "data-part": "tabline" },
5739
5865
  h("div", { className: "dsv-pv-tab", "data-active": "1" }, "会话 A"),
5740
5866
  h("div", { className: "dsv-pv-caret", "data-part": "misc" }),
5741
- h("div", { className: "dsv-pv-tab" }, "会话 B")
5867
+ h("div", { className: "dsv-pv-tab" }, "会话 B"),
5868
+ h("div", { className: "dsv-pv-tab", "data-hover": "1" }, "悬停")
5742
5869
  ),
5743
5870
  h("div", { className: "dsv-pv-body" })
5744
5871
  ),
@@ -6240,6 +6367,21 @@ window.__ModuleLoader__.load({
6240
6367
  const toggle = () => {
6241
6368
  prefs.update({ enabled: !p.enabled });
6242
6369
  };
6370
+ /* 检查更新:只读 registry,不下载、不写盘、不改设置。失败也只显示一行红字。 */
6371
+ const [update, setUpdate] = react.useState({ checking: false, latest: "", newer: false, error: "" });
6372
+ const checkUpdate = async () => {
6373
+ setUpdate((prev) => ({ ...prev, checking: true, error: "" }));
6374
+ try {
6375
+ const res = await fetch(`${NPM_LATEST_URL}?t=${Date.now()}`, { cache: "no-store" });
6376
+ if (res.ok !== true) throw new Error(`HTTP ${res.status}`);
6377
+ const data = await res.json();
6378
+ const latest = String((data && data.version) || "");
6379
+ if (latest === "") throw new Error("返回里没有版本号");
6380
+ setUpdate({ checking: false, latest, newer: compareVersion(latest, PLUGIN_VERSION) > 0, error: "" });
6381
+ } catch (err) {
6382
+ setUpdate({ checking: false, latest: "", newer: false, error: String((err && err.message) || err) });
6383
+ }
6384
+ };
6243
6385
  return h(
6244
6386
  "div",
6245
6387
  { className: "dsv-settings" },
@@ -6267,6 +6409,36 @@ window.__ModuleLoader__.load({
6267
6409
  "把对话区变成可分栏的工作区:多个会话并排,各自有输入框、工具调用和插件面板。"
6268
6410
  )
6269
6411
  ),
6412
+ /* 版本行:显示当前版本,点按钮去 npm 查最新版(纯前端,不改任何文件) */
6413
+ h(
6414
+ "div",
6415
+ { className: "dsv-update-row" },
6416
+ h(
6417
+ "span",
6418
+ {
6419
+ className: "dsv-update-text",
6420
+ "data-new": update.newer === true ? "1" : "0",
6421
+ "data-err": update.error !== "" ? "1" : "0"
6422
+ },
6423
+ update.error !== ""
6424
+ ? `检查更新失败:${update.error}`
6425
+ : update.latest === ""
6426
+ ? `当前版本 ${PLUGIN_VERSION}`
6427
+ : update.newer === true
6428
+ ? `有新版本 ${update.latest}(当前 ${PLUGIN_VERSION}):在「插件」页填 dsh-multipane@${update.latest} 安装,重启 App 生效`
6429
+ : `已是最新版本(${PLUGIN_VERSION})`
6430
+ ),
6431
+ h(
6432
+ "button",
6433
+ {
6434
+ type: "button",
6435
+ className: "dsv-mini-btn",
6436
+ disabled: update.checking === true,
6437
+ onClick: checkUpdate
6438
+ },
6439
+ update.checking === true ? "检查中…" : "检查更新"
6440
+ )
6441
+ ),
6270
6442
  /* ── 区块一:基本 ── */
6271
6443
  h(
6272
6444
  "div",
@@ -7803,7 +7975,7 @@ window.__ModuleLoader__.load({
7803
7975
  /* 卸载时把写在 <html> 上的线条变量清掉(应用退出 / 插件重载)。 */
7804
7976
  ctx.effect(() => {
7805
7977
  applyLineVars();
7806
- return () => clearLineVars();
7978
+ return () => clearAllDsvState();
7807
7979
  }, "dsh-split-view: line color vars");
7808
7980
 
7809
7981
  /* 拖放定向:接管宿主的 `conversation.input.attachments` 槽位。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Hermes-style tabbed workspace for the DSH main area: drag sessions in, split into up to four columns, close tabs.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",