dsh-multipane 1.0.49 → 1.0.51
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.en.md +12 -0
- package/README.md +12 -0
- package/lib/client.js +154 -16
- package/package.json +2 -1
package/README.en.md
CHANGED
|
@@ -161,6 +161,18 @@ node scripts/check-names.cjs # package name / version / release-age allowanc
|
|
|
161
161
|
|
|
162
162
|
## Changelog
|
|
163
163
|
|
|
164
|
+
### 1.0.51 (2026-11-11)
|
|
165
|
+
|
|
166
|
+
- **The rail's hide threshold is now a setting.** A new card in Settings → UI elements, "Hide the turn rail in narrow panes", adds a 0-600px slider (default 240px, `0` = never hide). The 240px cutoff used to be hard-coded, so a narrow pane always lost the rail and there was no way to change it.
|
|
167
|
+
- Changes take effect immediately without a restart, and each pane is judged on its own width (two- and three-pane layouts do not affect each other).
|
|
168
|
+
- Under the hood the fixed `@container (width<=240px)` rule is replaced by one generated at runtime: container queries accept literals, not CSS variables, so the threshold has to be spliced into the rule text. Only `visibility` is hidden - `display` stays `block` - so the 1.0.46 ratchet (narrow it and it never comes back) cannot return.
|
|
169
|
+
|
|
170
|
+
### 1.0.50 (2026-11-11)
|
|
171
|
+
|
|
172
|
+
- **Root cause of the missing rail in panes: a deadlock.** The host hides the rail with `display:none` whenever its container is 900px or narrower. Once hidden, the rail's internal virtual scroller measures a height of zero and renders no marks at all, and the plugin used "are there marks?" as its show switch - so the switch could never turn on and the rail could never come back. That is why two or three panes (a few hundred pixels each) were always blank, and dragging a pane past 900px suddenly made it appear. The rail is now located structurally, independent of whether marks exist.
|
|
173
|
+
- **Supplied the height it depends on.** The host derives the rail's height limit from two CSS variables (viewport height, composer height). While a tab was hidden it measured `0px` and wrote that, and nothing recomputed it afterwards, so the limit stayed zero. The plugin now rewrites those two variables using the host's own formula, only when they disagree, so the write is idempotent.
|
|
174
|
+
- The 1.0.49 fix (aim the nudge at the real scroll container) stays: it is what wakes the host's `initialized` flag, and measurements show one scroll notification is enough.
|
|
175
|
+
|
|
164
176
|
### 1.0.49 (2026-11-11)
|
|
165
177
|
|
|
166
178
|
- **Turn navigator missing in panes, step one: the automatic nudge was aimed at the wrong element.** Scroll ownership inside a pane lives on the host's `[data-conversation-scroll]`; its scroll listener returns immediately unless `event.target` is that very element, and setting `scrollTop` on a non-scrolling wrapper produces no scroll event at all. The 1.0.47 nudge targeted the list wrapper inside the tab content, so five seconds of nudging did nothing. It now targets the real scroll container and escalates: `scroll` event, then `scrollend`, then a real 1px scroll restored on the next frame, stopping as soon as the rail appears.
|
package/README.md
CHANGED
|
@@ -160,6 +160,18 @@ node scripts/check-names.cjs # 包名 / 版本 / 冷却豁免三处是否一
|
|
|
160
160
|
|
|
161
161
|
## 更新记录
|
|
162
162
|
|
|
163
|
+
### 1.0.51(2026-11-11)
|
|
164
|
+
|
|
165
|
+
- **轮次导航条的隐藏阈值变成设置项**:设置页「界面元素」新增「窄栏隐藏轮次导航条」,一根 0–600px 的滑杆,默认 240px,`0` = 永不隐藏。以前 240 是写死的,栏一窄就消失、改不了
|
|
166
|
+
- 阈值即时生效、不用重启;每栏按自己的宽度单独判断(2 栏、3 栏互不影响)
|
|
167
|
+
- 实现上把 `@container (width<=240px)` 换成运行时生成的一段规则:容器查询只认固定数字、不认 CSS 变量,所以阈值只能拼进规则文本。仍然只隐藏 `visibility`,`display` 恒为 block —— 不再碰 1.0.46 那个「隐藏后拖回来不出现」的棘轮
|
|
168
|
+
|
|
169
|
+
### 1.0.50(2026-11-11)
|
|
170
|
+
|
|
171
|
+
- **修「窗格里的轮次导航条不出现」的根因**:导航条是死锁的。宿主在容器宽度 ≤900px 时把它 `display:none`;一旦隐藏,它内部的虚拟滚动量不到高度,就一条短横线都不渲染;而插件之前用「里面有没有短横线」当显示开关,于是永远不成立、永远放不出来 —— 分到 2/3 栏(每栏五百多像素)必然全空白,拖到 900px 以上突然出现,就是这个原因。现在只看结构定位那颗导航,与里面有没有短横线无关
|
|
172
|
+
- **补上它的高度来源**:宿主用两个 CSS 变量(可视高度、输入框高度)算导航条的高度上限,标签页被隐藏时它量到 `0px` 并写了下去,之后没人再量,高度上限就一直是 0。现在插件按同样口径补写这两个变量(只在不一致时写,幂等)
|
|
173
|
+
- 1.0.49 那条「对准真正的滚动容器」的补救继续保留:它负责把宿主的「已初始化」标志叫醒,实测一次滚动通知就够
|
|
174
|
+
|
|
163
175
|
### 1.0.49(2026-11-11)
|
|
164
176
|
|
|
165
177
|
- **修「窗格里的轮次导航条不出现」,第一步:之前的自动补救敲错了元素**。窗格里内容滚动的所有权在宿主的 `[data-conversation-scroll]` 上,它的滚动监听器第一行就会判断「事件来源是不是我自己(scroller)」,不是就直接返回;1.0.47 的合成滚动打在标签内容里那层列表壳上,既不是监听对象,改它的 `scrollTop` 也不会产生任何滚动事件,所以补了 5 秒等于没补。现在对准真正的滚动容器,按「scroll 事件 → scrollend 事件 → 1px 真滚动(下一帧还原)」逐级升级,出现即停
|
package/lib/client.js
CHANGED
|
@@ -17,7 +17,7 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
*/
|
|
18
18
|
const PLUGIN_LABEL = "多栏视图";
|
|
19
19
|
/* 与 package.json 的 version 必须一致(发版时两处同改;check-names.cjs 会校验)。 */
|
|
20
|
-
|
|
20
|
+
const PLUGIN_VERSION = "1.0.51";
|
|
21
21
|
const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
|
|
22
22
|
|
|
23
23
|
|
|
@@ -272,6 +272,11 @@ window.__ModuleLoader__.load({
|
|
|
272
272
|
"已开启:只剩一个标签时再按 Ctrl+W 直接关闭窗口。": "On: pressing Ctrl+W again on the last tab closes the window.",
|
|
273
273
|
"已关闭:双击标签不关闭(中键、× 仍然可用)。": "Off: double-clicking a tab does not close it (middle-click and × still work).",
|
|
274
274
|
"已开启:双击标签直接关闭(中键、× 也可用)。": "On: double-clicking a tab closes it (middle-click and × also work).",
|
|
275
|
+
"窄栏隐藏轮次导航条": "Hide the turn rail in narrow panes",
|
|
276
|
+
"栏宽不超过 {0}px 时隐藏这条导航;每栏按自己的宽度判断。": "Hidden when a pane is {0}px wide or narrower; each pane is judged on its own width.",
|
|
277
|
+
"已关闭:无论栏多窄都显示这条导航。": "Off: the rail stays visible no matter how narrow a pane gets.",
|
|
278
|
+
"隐藏阈值": "Hide below",
|
|
279
|
+
"0 = 永不隐藏;默认 240px": "0 = never hide; default 240px",
|
|
275
280
|
"在侧边栏显示入口": "Show entry in sidebar",
|
|
276
281
|
"已关闭:侧边栏不显示本插件入口。": "Off: the sidebar hides this plugin's entry.",
|
|
277
282
|
"已开启:侧边栏显示本插件入口(默认)。": "On: the sidebar shows this plugin's entry (default).",
|
|
@@ -427,6 +432,8 @@ window.__ModuleLoader__.load({
|
|
|
427
432
|
}
|
|
428
433
|
const STORAGE_KEY = "dsh-split-view:workspace:v1";
|
|
429
434
|
const STYLE_ID = "dsh-split-view-style";
|
|
435
|
+
/* 轮次导航条的阈值规则单独一张表:阈值是设置项,改一次只重写这一小段。 */
|
|
436
|
+
const RAIL_STYLE_ID = "dsh-split-view-rail-threshold";
|
|
430
437
|
const CONTENT_FACTORY = "conversation.content";
|
|
431
438
|
const PANE_SLOT = "split-view.pane";
|
|
432
439
|
const RETAIN_SOURCE = "splitView";
|
|
@@ -950,6 +957,12 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
950
957
|
const LINE_COLOR_IDS = LINE_COLORS.map((item) => item.id);
|
|
951
958
|
const DEFAULT_LINE_COLOR = "graphite";
|
|
952
959
|
|
|
960
|
+
/* 轮次导航条(会话右侧那列短横线)在栏窄到放不下时隐藏。
|
|
961
|
+
1.0.51 起阈值由设置项 railHideBelow 决定,默认 240px;0 = 永不隐藏。 */
|
|
962
|
+
const DEFAULT_RAIL_HIDE_BELOW = 240;
|
|
963
|
+
const RAIL_HIDE_MIN = 0;
|
|
964
|
+
const RAIL_HIDE_MAX = 600;
|
|
965
|
+
|
|
953
966
|
/* 线宽档位。**只作用于分隔条、拖动预览虚线框、虚位标签边框**;
|
|
954
967
|
标签下方的焦点线固定 2px,不跟这个档位走(用户明确要求)。 */
|
|
955
968
|
const LINE_WIDTHS = [
|
|
@@ -1094,7 +1107,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1094
1107
|
viewBarPlacement: state.viewBarPlacement,
|
|
1095
1108
|
viewBarOrder: cleanIdList(state.viewBarOrder),
|
|
1096
1109
|
viewBarHidden: cleanIdList(state.viewBarHidden),
|
|
1097
|
-
hostBar: state.hostBar !== false
|
|
1110
|
+
hostBar: state.hostBar !== false,
|
|
1111
|
+
railHideBelow: clampRailHide(state.railHideBelow)
|
|
1098
1112
|
}
|
|
1099
1113
|
};
|
|
1100
1114
|
}
|
|
@@ -1162,7 +1176,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1162
1176
|
const keys = Object.keys(src).filter((k) => ignore.indexOf(k) < 0);
|
|
1163
1177
|
if (keys.length === 0) throw new Error(t("文件里没有可识别的设置项"));
|
|
1164
1178
|
/* 只接受已知字段,其余忽略:别让陌生键混进 state。 */
|
|
1165
|
-
const known = ["enabled", "showInSidebar", "titlebarDrag", "lineColor", "lineWidth", "lineOpacity", "appearance", "dblclickClose", "ctrlWCloseTab", "ctrlWCloseWindowOnLast", "viewBarPlacement", "viewBarOrder", "viewBarHidden", "hostBar"];
|
|
1179
|
+
const known = ["enabled", "showInSidebar", "titlebarDrag", "lineColor", "lineWidth", "lineOpacity", "appearance", "dblclickClose", "ctrlWCloseTab", "ctrlWCloseWindowOnLast", "viewBarPlacement", "viewBarOrder", "viewBarHidden", "hostBar", "railHideBelow"];
|
|
1166
1180
|
const patch = {};
|
|
1167
1181
|
let applied = 0;
|
|
1168
1182
|
for (const k of keys) {
|
|
@@ -1301,10 +1315,19 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1301
1315
|
viewBarPlacement: DEFAULT_VIEWBAR_PLACEMENT,
|
|
1302
1316
|
viewBarOrder: [],
|
|
1303
1317
|
viewBarHidden: [],
|
|
1304
|
-
hostBar: true
|
|
1318
|
+
hostBar: true,
|
|
1319
|
+
/* 栏宽小于这个值就隐藏轮次导航条;0 = 永不隐藏。 */
|
|
1320
|
+
railHideBelow: DEFAULT_RAIL_HIDE_BELOW
|
|
1305
1321
|
};
|
|
1306
1322
|
}
|
|
1307
1323
|
|
|
1324
|
+
/** 阈值统一成 0–600、10px 一档的整数;坏值回默认,别让存坏的 JSON 把导航条弄没。 */
|
|
1325
|
+
function clampRailHide(value) {
|
|
1326
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_RAIL_HIDE_BELOW;
|
|
1327
|
+
const clamped = Math.min(RAIL_HIDE_MAX, Math.max(RAIL_HIDE_MIN, value));
|
|
1328
|
+
return Math.round(clamped / 10) * 10;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1308
1331
|
/** 只留下字符串 id,去重保序 —— 存坏了的 JSON 不该把设置页搞乱。 */
|
|
1309
1332
|
function cleanIdList(value) {
|
|
1310
1333
|
if (!Array.isArray(value)) return [];
|
|
@@ -1347,7 +1370,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1347
1370
|
viewBarPlacement: VIEWBAR_PLACEMENTS.indexOf(parsed?.viewBarPlacement) >= 0 ? parsed.viewBarPlacement : DEFAULT_VIEWBAR_PLACEMENT,
|
|
1348
1371
|
viewBarOrder: cleanIdList(parsed?.viewBarOrder),
|
|
1349
1372
|
viewBarHidden: cleanIdList(parsed?.viewBarHidden),
|
|
1350
|
-
hostBar: parsed?.hostBar !== false
|
|
1373
|
+
hostBar: parsed?.hostBar !== false,
|
|
1374
|
+
railHideBelow: clampRailHide(parsed?.railHideBelow)
|
|
1351
1375
|
};
|
|
1352
1376
|
} catch {
|
|
1353
1377
|
return DEFAULTS();
|
|
@@ -1373,7 +1397,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1373
1397
|
viewBarPlacement: VIEWBAR_PLACEMENTS.indexOf(prefs.state.viewBarPlacement) >= 0 ? prefs.state.viewBarPlacement : DEFAULT_VIEWBAR_PLACEMENT,
|
|
1374
1398
|
viewBarOrder: cleanIdList(prefs.state.viewBarOrder),
|
|
1375
1399
|
viewBarHidden: cleanIdList(prefs.state.viewBarHidden),
|
|
1376
|
-
hostBar: prefs.state.hostBar !== false
|
|
1400
|
+
hostBar: prefs.state.hostBar !== false,
|
|
1401
|
+
railHideBelow: clampRailHide(prefs.state.railHideBelow)
|
|
1377
1402
|
})
|
|
1378
1403
|
);
|
|
1379
1404
|
} catch {
|
|
@@ -1586,6 +1611,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1586
1611
|
try {
|
|
1587
1612
|
const style = document.getElementById(STYLE_ID);
|
|
1588
1613
|
if (style !== null) style.remove();
|
|
1614
|
+
const railStyle = document.getElementById(RAIL_STYLE_ID);
|
|
1615
|
+
if (railStyle !== null) railStyle.remove();
|
|
1589
1616
|
} catch {
|
|
1590
1617
|
/* 非浏览器环境 */
|
|
1591
1618
|
}
|
|
@@ -1618,6 +1645,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
1618
1645
|
/* 颜色 / 浓度 / 粗细写到 <html>:侧栏会话行在插件根之外,只有根上的变量它读得到。 */
|
|
1619
1646
|
applyLineVars();
|
|
1620
1647
|
prefs.subscribe(applyLineVars);
|
|
1648
|
+
/* 阈值改了要立刻重写那段容器查询,不用重启。 */
|
|
1649
|
+
prefs.subscribe(applyRailThreshold);
|
|
1621
1650
|
/* 把解析后的完整 prefs 立即写回一次。
|
|
1622
1651
|
老用户存的 JSON 里根本没有 showInSidebar 这个键 —— 不写回的话,
|
|
1623
1652
|
每次 read() 都用默认 true 覆盖,导致「关闭侧栏入口」改了等于没改。 */
|
|
@@ -2307,10 +2336,17 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
2307
2336
|
会让宿主的虚拟滚动把可用高度量成 0 并留在状态里,宽度回来也没人重算 ——
|
|
2308
2337
|
拉窄消失后拖回原宽度也回不来(单向棘轮)。现在显示恒为 block(布局与测量
|
|
2309
2338
|
一直在),只有窄到放不下时才隐藏**可见性**,恢复宽度立刻可见。
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2339
|
+
选择器用结构条件、不写宿主的哈希类名(如 SNx2jG_*),宿主升级换了哈希也不会失效。
|
|
2340
|
+
|
|
2341
|
+
⚠️ 1.0.50 修正:不能用 nav:has(button[data-index]) 当开关。宿主在容器宽度
|
|
2342
|
+
≤900px 时把这条导航 display:none;一旦隐藏,它内部的虚拟滚动量不到高度,就一条
|
|
2343
|
+
短横线都不渲染 —— 于是 :has(button) 永远不成立,插件也就永远没法把它放出来,
|
|
2344
|
+
成了死锁。这也正是「分到 3 栏(每栏 ~567px)怎么补都不出现、拖宽到 900px 以上
|
|
2345
|
+
突然出现」的原因。现在只按结构定位这颗 nav,与里面有没有按钮无关。 */
|
|
2346
|
+
.dsv-pane .dsv-body [data-conversation-scroll] nav{display:block!important}
|
|
2347
|
+
/* 窄到放不下时只隐藏可见性。阈值是设置项(默认 240px,0 = 永不隐藏),而容器查询
|
|
2348
|
+
只认固定数字、不认 CSS 变量,所以这条规则不写在这里:由 railThresholdCss() 生成到
|
|
2349
|
+
独立的 <style> 里,改设置即时重写。 */
|
|
2314
2350
|
/* 窗口最大化时外框有约 7px 溢出到屏幕外,标题栏最顶上那一截落在屏幕外;
|
|
2315
2351
|
标签原来只有 ~26px 高、上下留 9px,光标贴屏幕最顶时落在标签上方的空白里,点不到标签。
|
|
2316
2352
|
把标签命中区拉到标题栏整高(内容仍垂直居中)。只改标签自身横向范围,
|
|
@@ -2409,6 +2445,8 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
2409
2445
|
.dsv-settings h2{margin:0;font-size:17px;font-weight:600}
|
|
2410
2446
|
.dsv-settings p{margin:0;font-size:13px;line-height:1.65;opacity:.72}
|
|
2411
2447
|
.dsv-card{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 16px;border:1px solid var(--dsh-border-color,rgba(128,128,128,.26));border-radius:10px;background:rgba(255,255,255,.012);transition:border-color .15s ease,background-color .15s ease}
|
|
2448
|
+
/* 带滑杆的卡片:标题在上、控件占满整行(横向两列会把滑杆挤成一条缝)。 */
|
|
2449
|
+
.dsv-card-col{flex-direction:column;align-items:stretch;gap:10px}
|
|
2412
2450
|
.dsv-card:hover{border-color:var(--dsh-border-color,rgba(128,128,128,.42));background:rgba(255,255,255,.028)}
|
|
2413
2451
|
.dsv-card-text{display:flex;flex-direction:column;gap:3px;min-width:0}
|
|
2414
2452
|
.dsv-card-title{font-size:13px;font-weight:600;letter-spacing:.01em}
|
|
@@ -2540,16 +2578,42 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
2540
2578
|
可能比 apply() 早 —— 于是先闪一帧「没有样式的白板页」,再跳到正常样式。 */
|
|
2541
2579
|
installStyles();
|
|
2542
2580
|
|
|
2581
|
+
function railThresholdCss(below) {
|
|
2582
|
+
/* 容器查询只认固定数字、不认 CSS 变量,所以阈值只能拼进规则文本。
|
|
2583
|
+
0 = 永不隐藏:返回空串,表里一个字都不留。 */
|
|
2584
|
+
const px = clampRailHide(below);
|
|
2585
|
+
if (!(px > 0)) return "";
|
|
2586
|
+
return `@container (width<=${px}px){.dsv-pane .dsv-body [data-conversation-scroll] nav{visibility:hidden;pointer-events:none}}`;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
function applyRailThreshold() {
|
|
2590
|
+
try {
|
|
2591
|
+
const el = document.getElementById(RAIL_STYLE_ID);
|
|
2592
|
+
if (el === null) return;
|
|
2593
|
+
const next = railThresholdCss(prefs.state.railHideBelow);
|
|
2594
|
+
if (el.textContent !== next) el.textContent = next;
|
|
2595
|
+
} catch {
|
|
2596
|
+
/* ignore */
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2543
2600
|
/**
|
|
2544
2601
|
* Install the stylesheet once per document.
|
|
2545
2602
|
*/
|
|
2546
2603
|
function installStyles() {
|
|
2547
2604
|
try {
|
|
2548
|
-
if (document.getElementById(STYLE_ID)
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2605
|
+
if (document.getElementById(STYLE_ID) === null) {
|
|
2606
|
+
const style = document.createElement("style");
|
|
2607
|
+
style.id = STYLE_ID;
|
|
2608
|
+
style.textContent = CSS;
|
|
2609
|
+
document.head.appendChild(style);
|
|
2610
|
+
}
|
|
2611
|
+
if (document.getElementById(RAIL_STYLE_ID) === null) {
|
|
2612
|
+
const railStyle = document.createElement("style");
|
|
2613
|
+
railStyle.id = RAIL_STYLE_ID;
|
|
2614
|
+
document.head.appendChild(railStyle);
|
|
2615
|
+
}
|
|
2616
|
+
applyRailThreshold();
|
|
2553
2617
|
} catch (error) {
|
|
2554
2618
|
console.warn("[split-view] styles unavailable:", error);
|
|
2555
2619
|
}
|
|
@@ -3369,6 +3433,34 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3369
3433
|
}
|
|
3370
3434
|
}
|
|
3371
3435
|
|
|
3436
|
+
/* 宿主那两个 CSS 变量是它在 composer seat 的 ResizeObserver 里写的:
|
|
3437
|
+
`--dsh-conversation-viewport-height` = scroller.clientHeight、
|
|
3438
|
+
`--dsh-composer-height` = seat.offsetHeight。标签槽被 `display:none` 时它量到 0px
|
|
3439
|
+
并写了下去,之后就没人再量(1.0.49 的取证里两栏都读到 `0px` / `0px`),
|
|
3440
|
+
`--turn-rail-band` 于是变成 `calc(0px - 0px)`,导航条的 max-height 也被压成 0。
|
|
3441
|
+
这里按宿主同样的口径补写一次,只在不一致时写,幂等,不改别的样式。 */
|
|
3442
|
+
function syncPaneRailVars(paneEl) {
|
|
3443
|
+
const slot = paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
|
|
3444
|
+
if (slot === null) return;
|
|
3445
|
+
const scroller = slot.querySelector("[data-conversation-scroll]");
|
|
3446
|
+
if (scroller === null) return;
|
|
3447
|
+
const viewport = scroller.clientHeight;
|
|
3448
|
+
if (viewport <= 0) return;
|
|
3449
|
+
const seat = scroller.querySelector("[data-composer-seat]");
|
|
3450
|
+
const composer = seat === null ? 0 : seat.offsetHeight;
|
|
3451
|
+
const computed = getComputedStyle(scroller);
|
|
3452
|
+
const read = (name) => {
|
|
3453
|
+
const value = parseFloat(computed.getPropertyValue(name));
|
|
3454
|
+
return Number.isFinite(value) ? value : null;
|
|
3455
|
+
};
|
|
3456
|
+
if (read("--dsh-conversation-viewport-height") !== viewport) {
|
|
3457
|
+
scroller.style.setProperty("--dsh-conversation-viewport-height", `${viewport}px`);
|
|
3458
|
+
}
|
|
3459
|
+
if (read("--dsh-composer-height") !== composer) {
|
|
3460
|
+
scroller.style.setProperty("--dsh-composer-height", `${composer}px`);
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3372
3464
|
function TabContent(props) {
|
|
3373
3465
|
const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn, active } = props;
|
|
3374
3466
|
const { reference, status } = useSessionReference(sessions, sessionId);
|
|
@@ -3440,6 +3532,20 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3440
3532
|
const paneEl = paneId === null || paneId === void 0 ? null : document.querySelector(`.dsv-pane[data-pane-id="${paneId}"]`);
|
|
3441
3533
|
if (paneEl === null) return;
|
|
3442
3534
|
const slotOf = () => paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
|
|
3535
|
+
const scrollerOf = () => {
|
|
3536
|
+
const slot = slotOf();
|
|
3537
|
+
return slot === null ? null : slot.querySelector("[data-conversation-scroll]");
|
|
3538
|
+
};
|
|
3539
|
+
/* 先修变量:band 是 0 的时候,哪怕 display 放开了,导航条的高度上限仍然是 0。 */
|
|
3540
|
+
syncPaneRailVars(paneEl);
|
|
3541
|
+
let variablesObserver = null;
|
|
3542
|
+
const scrollerForVars = scrollerOf();
|
|
3543
|
+
if (scrollerForVars !== null && typeof ResizeObserver === "function") {
|
|
3544
|
+
const seatForVars = scrollerForVars.querySelector("[data-composer-seat]");
|
|
3545
|
+
variablesObserver = new ResizeObserver(() => syncPaneRailVars(paneEl));
|
|
3546
|
+
variablesObserver.observe(scrollerForVars);
|
|
3547
|
+
if (seatForVars !== null) variablesObserver.observe(seatForVars);
|
|
3548
|
+
}
|
|
3443
3549
|
const railCount = () => {
|
|
3444
3550
|
const slot = slotOf();
|
|
3445
3551
|
return slot === null ? 0 : slot.querySelectorAll("nav button[data-index]").length;
|
|
@@ -3474,9 +3580,11 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3474
3580
|
finish("timeout");
|
|
3475
3581
|
return;
|
|
3476
3582
|
}
|
|
3583
|
+
/* 变量在标签切换 / 拖动分隔条后可能又被打回 0px,每轮补一次。 */
|
|
3584
|
+
syncPaneRailVars(paneEl);
|
|
3477
3585
|
const kind = ["scroll", "scrollend", "real"][index % 3];
|
|
3478
3586
|
const slot = slotOf();
|
|
3479
|
-
const scroller =
|
|
3587
|
+
const scroller = scrollerOf();
|
|
3480
3588
|
if (scroller !== null) {
|
|
3481
3589
|
if (kind === "scroll") scroller.dispatchEvent(new Event("scroll"));
|
|
3482
3590
|
else if (kind === "scrollend") scroller.dispatchEvent(new Event("scrollend"));
|
|
@@ -3509,6 +3617,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
|
|
|
3509
3617
|
return () => {
|
|
3510
3618
|
stopped = true;
|
|
3511
3619
|
window.clearTimeout(timer);
|
|
3620
|
+
if (variablesObserver !== null) variablesObserver.disconnect();
|
|
3512
3621
|
};
|
|
3513
3622
|
}, [
|
|
3514
3623
|
active,
|
|
@@ -7907,6 +8016,35 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
|
|
|
7907
8016
|
onClick: () => prefs.update({ hostBar: p.hostBar === false })
|
|
7908
8017
|
})
|
|
7909
8018
|
),
|
|
8019
|
+
/* 轮次导航条(会话右侧那列短横线):栏窄到放不下时隐藏。
|
|
8020
|
+
阈值用户可调(1.0.51),0 = 永不隐藏。 */
|
|
8021
|
+
h(
|
|
8022
|
+
"div",
|
|
8023
|
+
{ className: "dsv-card dsv-card-col", key: "rail-threshold" },
|
|
8024
|
+
h(
|
|
8025
|
+
"div",
|
|
8026
|
+
{ className: "dsv-card-text" },
|
|
8027
|
+
h("div", { className: "dsv-card-title" }, t("窄栏隐藏轮次导航条")),
|
|
8028
|
+
h(
|
|
8029
|
+
"div",
|
|
8030
|
+
{ className: "dsv-card-desc" },
|
|
8031
|
+
clampRailHide(p.railHideBelow) > 0
|
|
8032
|
+
? t("栏宽不超过 {0}px 时隐藏这条导航;每栏按自己的宽度判断。", [
|
|
8033
|
+
String(clampRailHide(p.railHideBelow))
|
|
8034
|
+
])
|
|
8035
|
+
: t("已关闭:无论栏多窄都显示这条导航。")
|
|
8036
|
+
)
|
|
8037
|
+
),
|
|
8038
|
+
h(AppearanceWidth, {
|
|
8039
|
+
label: t("隐藏阈值"),
|
|
8040
|
+
hint: t("0 = 永不隐藏;默认 240px"),
|
|
8041
|
+
min: RAIL_HIDE_MIN,
|
|
8042
|
+
max: RAIL_HIDE_MAX,
|
|
8043
|
+
step: 10,
|
|
8044
|
+
value: clampRailHide(p.railHideBelow),
|
|
8045
|
+
onChange: (value) => prefs.update({ railHideBelow: clampRailHide(value) })
|
|
8046
|
+
})
|
|
8047
|
+
),
|
|
7910
8048
|
/* 视图切换条:开关 + 位置 + 逐项列表,三块连在一起
|
|
7911
8049
|
(用户口径 2026-11-08:开关和它的具体设置必须挨着,原来中间隔着别的卡)。 */
|
|
7912
8050
|
h(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-multipane",
|
|
3
|
-
"version":
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"description": "Split the DSH main area into up to four panes, each with its own tab strip, composer and view switcher. Drag a tab to a pane edge to split. Bilingual (zh/en).",
|
|
5
5
|
"displayName": "多栏视图",
|
|
6
6
|
"dshhub": {
|
|
@@ -84,3 +84,4 @@
|
|
|
84
84
|
"access": "public"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
|