dsh-multipane 1.0.48 → 1.0.50

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 CHANGED
@@ -161,6 +161,17 @@ node scripts/check-names.cjs # package name / version / release-age allowanc
161
161
 
162
162
  ## Changelog
163
163
 
164
+ ### 1.0.50 (2026-11-11)
165
+
166
+ - **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.
167
+ - **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.
168
+ - 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.
169
+
170
+ ### 1.0.49 (2026-11-11)
171
+
172
+ - **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.
173
+ - **Added evidence capture**: each pane writes whether the rail appeared, the host's internal reading state (`initialized` / `followingTail`), the scroll container's size and the two CSS variables into `localStorage` under `dsv-rail-diag` (last 12 entries). It exists so the root cause can be pinned down without DevTools and does not affect the UI.
174
+
164
175
  ### 1.0.48 (2026-11-11)
165
176
 
166
177
  - **Ctrl+Tab / Ctrl+Shift+Tab now cross panes.** Before, cycling only ran inside the current pane's tabs, so a pane with a single tab did nothing and the neighbouring pane was unreachable from the keyboard. All panes' tabs are now chained into one ring in left-to-right order (and in-strip order within a pane): the tab after a pane's last one is the next pane's first, the last pane wraps back to the first, and the reverse direction mirrors that. Focus follows the target tab, so you can keep typing in the pane you landed in.
package/README.md CHANGED
@@ -160,6 +160,17 @@ node scripts/check-names.cjs # 包名 / 版本 / 冷却豁免三处是否一
160
160
 
161
161
  ## 更新记录
162
162
 
163
+ ### 1.0.50(2026-11-11)
164
+
165
+ - **修「窗格里的轮次导航条不出现」的根因**:导航条是死锁的。宿主在容器宽度 ≤900px 时把它 `display:none`;一旦隐藏,它内部的虚拟滚动量不到高度,就一条短横线都不渲染;而插件之前用「里面有没有短横线」当显示开关,于是永远不成立、永远放不出来 —— 分到 2/3 栏(每栏五百多像素)必然全空白,拖到 900px 以上突然出现,就是这个原因。现在只看结构定位那颗导航,与里面有没有短横线无关
166
+ - **补上它的高度来源**:宿主用两个 CSS 变量(可视高度、输入框高度)算导航条的高度上限,标签页被隐藏时它量到 `0px` 并写了下去,之后没人再量,高度上限就一直是 0。现在插件按同样口径补写这两个变量(只在不一致时写,幂等)
167
+ - 1.0.49 那条「对准真正的滚动容器」的补救继续保留:它负责把宿主的「已初始化」标志叫醒,实测一次滚动通知就够
168
+
169
+ ### 1.0.49(2026-11-11)
170
+
171
+ - **修「窗格里的轮次导航条不出现」,第一步:之前的自动补救敲错了元素**。窗格里内容滚动的所有权在宿主的 `[data-conversation-scroll]` 上,它的滚动监听器第一行就会判断「事件来源是不是我自己(scroller)」,不是就直接返回;1.0.47 的合成滚动打在标签内容里那层列表壳上,既不是监听对象,改它的 `scrollTop` 也不会产生任何滚动事件,所以补了 5 秒等于没补。现在对准真正的滚动容器,按「scroll 事件 → scrollend 事件 → 1px 真滚动(下一帧还原)」逐级升级,出现即停
172
+ - **新增一处取证**:每栏会把「导航条有没有出现、宿主内部的读取状态(initialized / followingTail)、滚动容器高度与两个 CSS 变量」写进 `localStorage` 的 `dsv-rail-diag`(最多 12 条)。这是给「没有开发者工具也要定位」准备的,不影响界面
173
+
163
174
  ### 1.0.48(2026-11-11)
164
175
 
165
176
  - **Ctrl+Tab / Ctrl+Shift+Tab 可以跨栏切标签了**:以前只在当前栏的标签之间循环,某一栏只有一个标签时按下去没反应,也永远进不了隔壁栏。现在把所有栏的标签按「从左到右、栏内标签顺序」串成一圈:本栏最后一个的下一个就是下一栏的第一个,最后一栏绕回第一栏,反向同理;焦点栏跟着目标标签一起走,切完直接能在新栏里接着打字
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
- const PLUGIN_VERSION = "1.0.48";
20
+ const PLUGIN_VERSION = "1.0.50";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
22
 
23
23
 
@@ -2307,10 +2307,15 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2307
2307
  会让宿主的虚拟滚动把可用高度量成 0 并留在状态里,宽度回来也没人重算 ——
2308
2308
  拉窄消失后拖回原宽度也回不来(单向棘轮)。现在显示恒为 block(布局与测量
2309
2309
  一直在),只有窄到放不下时才隐藏**可见性**,恢复宽度立刻可见。
2310
- 选择器用结构条件 nav:has(button[data-index]),不写宿主的哈希类名
2311
- (如 SNx2jG_*),宿主升级换了哈希也不会失效。 */
2312
- .dsv-pane .dsv-body nav:has(button[data-index]){display:block!important}
2313
- @container (width<=240px){.dsv-pane .dsv-body nav:has(button[data-index]){visibility:hidden;pointer-events:none}}
2310
+ 选择器用结构条件、不写宿主的哈希类名(如 SNx2jG_*),宿主升级换了哈希也不会失效。
2311
+
2312
+ ⚠️ 1.0.50 修正:不能用 nav:has(button[data-index]) 当开关。宿主在容器宽度
2313
+ ≤900px 时把这条导航 display:none;一旦隐藏,它内部的虚拟滚动量不到高度,就一条
2314
+ 短横线都不渲染 —— 于是 :has(button) 永远不成立,插件也就永远没法把它放出来,
2315
+ 成了死锁。这也正是「分到 3 栏(每栏 ~567px)怎么补都不出现、拖宽到 900px 以上
2316
+ 突然出现」的原因。现在只按结构定位这颗 nav,与里面有没有按钮无关。 */
2317
+ .dsv-pane .dsv-body [data-conversation-scroll] nav{display:block!important}
2318
+ @container (width<=240px){.dsv-pane .dsv-body [data-conversation-scroll] nav{visibility:hidden;pointer-events:none}}
2314
2319
  /* 窗口最大化时外框有约 7px 溢出到屏幕外,标题栏最顶上那一截落在屏幕外;
2315
2320
  标签原来只有 ~26px 高、上下留 9px,光标贴屏幕最顶时落在标签上方的空白里,点不到标签。
2316
2321
  把标签命中区拉到标题栏整高(内容仍垂直居中)。只改标签自身横向范围,
@@ -3271,6 +3276,132 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3271
3276
  * The conversation body of one tab: the host's own content factory, bound to
3272
3277
  * the tab's session through the scope provider.
3273
3278
  */
3279
+ /* ── 1.0.49 诊断工具:把一个窗格里「轮次导航条」的现状拍成快照 ───────────────
3280
+ 只读 DOM 与计算样式,不改任何东西。写进 localStorage 的 `dsv-rail-diag`,
3281
+ 由台式机读 Electron 的 leveldb 取证(用户不用做任何操作)。 */
3282
+ const RAIL_DIAG_KEY = "dsv-rail-diag";
3283
+ const roundPx = (value) => (typeof value === "number" && Number.isFinite(value) ? Math.round(value) : null);
3284
+ const rectOf = (element) => {
3285
+ if (element === null || element === void 0) return null;
3286
+ const rect = element.getBoundingClientRect();
3287
+ return { w: roundPx(rect.width), h: roundPx(rect.height), x: roundPx(rect.left), y: roundPx(rect.top) };
3288
+ };
3289
+ /* 从 DOM 节点摸到 React fiber,沿 return 链找 useChatReading 的 state
3290
+ (形状固定为 { initialized, followingTail, activeTurn })。这是唯一能在
3291
+ initialized 为假时区分「没渲染」和「渲染了被藏起来」的办法。 */
3292
+ function readingStateOf(node) {
3293
+ if (node === null || node === void 0) return null;
3294
+ try {
3295
+ const key = Object.keys(node).find((name) => name.startsWith("__reactFiber$"));
3296
+ if (key === void 0) return null;
3297
+ let fiber = node[key];
3298
+ for (let depth = 0; fiber !== null && fiber !== void 0 && depth < 80; depth += 1, fiber = fiber.return) {
3299
+ let hook = fiber.memoizedState;
3300
+ for (let slot = 0; hook !== null && hook !== void 0 && typeof hook === "object" && slot < 40; slot += 1, hook = hook.next) {
3301
+ const state = hook.memoizedState;
3302
+ if (state !== null && typeof state === "object" && typeof state.initialized === "boolean" && typeof state.followingTail === "boolean") {
3303
+ return {
3304
+ initialized: state.initialized,
3305
+ followingTail: state.followingTail,
3306
+ activeTurn: state.activeTurn ?? null
3307
+ };
3308
+ }
3309
+ }
3310
+ }
3311
+ } catch {
3312
+ /* 宿主内部结构变了就放弃这一项,不影响其它诊断 */
3313
+ }
3314
+ return null;
3315
+ }
3316
+ function railDiagOf(paneEl) {
3317
+ const slot = paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
3318
+ const scroller = slot === null ? null : slot.querySelector("[data-conversation-scroll]");
3319
+ const flow = slot === null ? null : slot.querySelector("[data-chat-flow]");
3320
+ const nav = slot === null ? null : slot.querySelector("nav");
3321
+ const root = flow === null ? null : flow.parentElement === null ? null : flow.parentElement.parentElement;
3322
+ const navStyle = nav === null ? null : getComputedStyle(nav);
3323
+ const scrollerStyle = scroller === null ? null : getComputedStyle(scroller);
3324
+ return {
3325
+ slot: rectOf(slot),
3326
+ scroller:
3327
+ scroller === null
3328
+ ? null
3329
+ : {
3330
+ rect: rectOf(scroller),
3331
+ clientH: scroller.clientHeight,
3332
+ scrollH: scroller.scrollHeight,
3333
+ scrollTop: roundPx(scroller.scrollTop),
3334
+ viewportVar: scrollerStyle.getPropertyValue("--dsh-conversation-viewport-height").trim(),
3335
+ composerVar: scrollerStyle.getPropertyValue("--dsh-composer-height").trim()
3336
+ },
3337
+ flow: rectOf(flow),
3338
+ followingTailAttr: root === null ? null : root.hasAttribute("data-chat-following-tail"),
3339
+ nav:
3340
+ nav === null
3341
+ ? null
3342
+ : {
3343
+ rect: rectOf(nav),
3344
+ buttons: nav.querySelectorAll("button[data-index]").length,
3345
+ display: navStyle.display,
3346
+ visibility: navStyle.visibility,
3347
+ maxHeight: navStyle.maxHeight,
3348
+ height: navStyle.height,
3349
+ top: navStyle.top,
3350
+ band: navStyle.getPropertyValue("--turn-rail-band").trim()
3351
+ },
3352
+ reading: readingStateOf(flow)
3353
+ };
3354
+ }
3355
+ function writeRailDiag(entry) {
3356
+ try {
3357
+ const storage = window.localStorage;
3358
+ if (storage === null || storage === void 0) return;
3359
+ let list = [];
3360
+ const raw = storage.getItem(RAIL_DIAG_KEY);
3361
+ if (typeof raw === "string" && raw !== "") {
3362
+ try {
3363
+ const parsed = JSON.parse(raw);
3364
+ if (Array.isArray(parsed)) list = parsed;
3365
+ } catch {
3366
+ /* 旧值坏了就覆盖 */
3367
+ }
3368
+ }
3369
+ list.push(entry);
3370
+ while (list.length > 12) list.shift();
3371
+ storage.setItem(RAIL_DIAG_KEY, JSON.stringify(list));
3372
+ } catch {
3373
+ /* localStorage 不可用就算了,不影响功能 */
3374
+ }
3375
+ }
3376
+
3377
+ /* 宿主那两个 CSS 变量是它在 composer seat 的 ResizeObserver 里写的:
3378
+ `--dsh-conversation-viewport-height` = scroller.clientHeight、
3379
+ `--dsh-composer-height` = seat.offsetHeight。标签槽被 `display:none` 时它量到 0px
3380
+ 并写了下去,之后就没人再量(1.0.49 的取证里两栏都读到 `0px` / `0px`),
3381
+ `--turn-rail-band` 于是变成 `calc(0px - 0px)`,导航条的 max-height 也被压成 0。
3382
+ 这里按宿主同样的口径补写一次,只在不一致时写,幂等,不改别的样式。 */
3383
+ function syncPaneRailVars(paneEl) {
3384
+ const slot = paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
3385
+ if (slot === null) return;
3386
+ const scroller = slot.querySelector("[data-conversation-scroll]");
3387
+ if (scroller === null) return;
3388
+ const viewport = scroller.clientHeight;
3389
+ if (viewport <= 0) return;
3390
+ const seat = scroller.querySelector("[data-composer-seat]");
3391
+ const composer = seat === null ? 0 : seat.offsetHeight;
3392
+ const computed = getComputedStyle(scroller);
3393
+ const read = (name) => {
3394
+ const value = parseFloat(computed.getPropertyValue(name));
3395
+ return Number.isFinite(value) ? value : null;
3396
+ };
3397
+ if (read("--dsh-conversation-viewport-height") !== viewport) {
3398
+ scroller.style.setProperty("--dsh-conversation-viewport-height", `${viewport}px`);
3399
+ }
3400
+ if (read("--dsh-composer-height") !== composer) {
3401
+ scroller.style.setProperty("--dsh-composer-height", `${composer}px`);
3402
+ }
3403
+ }
3404
+
3274
3405
  function TabContent(props) {
3275
3406
  const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn, active } = props;
3276
3407
  const { reference, status } = useSessionReference(sessions, sessionId);
@@ -3318,47 +3449,122 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3318
3449
 
3319
3450
  const paneId = react.useContext(PaneIdCtx);
3320
3451
 
3321
- /* 1.0.47:宿主的轮次导航条要等一次「真实的滚动/重排事件」才会把 initialized
3322
- 置真,而窗格初次挂载时那次机会已经错过;之后小幅改宽度也不会把它叫醒
3323
- (只有大幅拖宽引发的内容重排 + 滚动才行)。这里不猜刺激强度:本栏激活后
3324
- 每 250ms 看一眼有没有那条导航,没有就补一次合成 scroll 事件(不动滚动
3325
- 条、不改布局),每三次升级成 8px 真滚动并立刻还原;出现即停,5 秒封顶。 */
3326
- react.useEffect(() => {
3327
- if (active !== true || sessionId === null) return;
3328
- const paneEl = paneId === null || paneId === void 0 ? null : document.querySelector(`.dsv-pane[data-pane-id="${paneId}"]`);
3329
- if (paneEl === null) return;
3330
- let tries = 0;
3331
- let timer = 0;
3332
- let cancelled = false;
3333
- const hasRail = () => paneEl.querySelector("nav button[data-index]") !== null;
3334
- const tick = () => {
3335
- if (cancelled || hasRail() || tries >= 20) return;
3336
- tries += 1;
3337
- const column = paneEl.querySelector('.dsv-tab-slot[data-active="1"] [data-chat-flow]');
3338
- const scroller = column === null ? null : column.parentElement;
3339
- if (scroller !== null) {
3340
- if (tries % 3 === 0) {
3341
- const before = scroller.scrollTop;
3342
- scroller.scrollTop = before + 8;
3343
- window.requestAnimationFrame(() => {
3344
- scroller.scrollTop = before;
3345
- });
3346
- } else {
3347
- scroller.dispatchEvent(new Event("scroll"));
3348
- }
3349
- }
3350
- timer = window.setTimeout(tick, 250);
3351
- };
3352
- timer = window.setTimeout(tick, 250);
3353
- return () => {
3354
- cancelled = true;
3355
- window.clearTimeout(timer);
3356
- };
3357
- }, [
3358
- active,
3359
- sessionId,
3360
- paneId
3361
- ]);
3452
+ /* ── 1.0.49:轮次导航条在窗格里不出现的取证 + 修正刺激 ──────────────────
3453
+ 宿主源码(app.asar → dsh-client-ui-chat/lib/client.js)里,那条短横线要同时满足:
3454
+ 1) `scroll.initialized === true` 才渲染 TurnNavigator(第 3622 行);
3455
+ 2) `items.length >= 2`,只有一轮会话时组件自己 `return null`(第 434 行);
3456
+ 3) `.frame` 在容器宽度 ≤900px 时被宿主 `@container` 设为 display:none。
3457
+
3458
+ 而滚动的所有权是这样的:`ChatViewport.attach()` 把 scroll/scrollend 监听器挂在
3459
+ `list.closest("[data-conversation-scroll]")` 上,`onScroll` 第一行就
3460
+ `if (event.target !== this.elements.scroller) return`。1.0.47 的补敲打在
3461
+ `[data-chat-flow].parentElement` 上 —— 那是 `div.scroll`(列表壳,不滚动),
3462
+ 既不是监听器所在的元素,改它的 scrollTop 也不产生任何滚动事件:
3463
+ synthetic scroll 与「8px 真滚动」双双落空,所以怎么补都没用。
3464
+
3465
+ 1.0.49 对准真正的滚动容器 `[data-conversation-scroll]`,并逐级升级刺激强度:
3466
+ scroll 事件 → scrollend 事件 → 1px 真滚动(下一帧还原)。每一步都把
3467
+ 「有没有出现短横线、React 侧 reading 状态」写进 localStorage 的
3468
+ `dsv-rail-diag`,这样修不修得好都有据可查,不靠猜。 */
3469
+ react.useEffect(() => {
3470
+ /* 只对「本栏当前显示的那个标签」做一次:隐藏的 slot 是 display:none,
3471
+ 量出来的高度全是 0,去戳它也没有意义,只会刷出错误结论。 */
3472
+ if (active !== true || sessionId === null) return;
3473
+ const paneEl = paneId === null || paneId === void 0 ? null : document.querySelector(`.dsv-pane[data-pane-id="${paneId}"]`);
3474
+ if (paneEl === null) return;
3475
+ const slotOf = () => paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
3476
+ const scrollerOf = () => {
3477
+ const slot = slotOf();
3478
+ return slot === null ? null : slot.querySelector("[data-conversation-scroll]");
3479
+ };
3480
+ /* 先修变量:band 是 0 的时候,哪怕 display 放开了,导航条的高度上限仍然是 0。 */
3481
+ syncPaneRailVars(paneEl);
3482
+ let variablesObserver = null;
3483
+ const scrollerForVars = scrollerOf();
3484
+ if (scrollerForVars !== null && typeof ResizeObserver === "function") {
3485
+ const seatForVars = scrollerForVars.querySelector("[data-composer-seat]");
3486
+ variablesObserver = new ResizeObserver(() => syncPaneRailVars(paneEl));
3487
+ variablesObserver.observe(scrollerForVars);
3488
+ if (seatForVars !== null) variablesObserver.observe(seatForVars);
3489
+ }
3490
+ const railCount = () => {
3491
+ const slot = slotOf();
3492
+ return slot === null ? 0 : slot.querySelectorAll("nav button[data-index]").length;
3493
+ };
3494
+ const entry = {
3495
+ at: new Date().toISOString(),
3496
+ version: PLUGIN_VERSION,
3497
+ paneId,
3498
+ sessionId,
3499
+ before: railDiagOf(paneEl),
3500
+ steps: []
3501
+ };
3502
+ let stopped = false;
3503
+ let timer = 0;
3504
+ const finish = (result) => {
3505
+ if (stopped) return;
3506
+ stopped = true;
3507
+ window.clearTimeout(timer);
3508
+ entry.result = result;
3509
+ entry.after = railDiagOf(paneEl);
3510
+ writeRailDiag(entry);
3511
+ };
3512
+ if (railCount() > 0) {
3513
+ finish("already");
3514
+ return () => {
3515
+ stopped = true;
3516
+ };
3517
+ }
3518
+ const step = (index) => {
3519
+ if (stopped) return;
3520
+ if (index >= 18) {
3521
+ finish("timeout");
3522
+ return;
3523
+ }
3524
+ /* 变量在标签切换 / 拖动分隔条后可能又被打回 0px,每轮补一次。 */
3525
+ syncPaneRailVars(paneEl);
3526
+ const kind = ["scroll", "scrollend", "real"][index % 3];
3527
+ const slot = slotOf();
3528
+ const scroller = scrollerOf();
3529
+ if (scroller !== null) {
3530
+ if (kind === "scroll") scroller.dispatchEvent(new Event("scroll"));
3531
+ else if (kind === "scrollend") scroller.dispatchEvent(new Event("scrollend"));
3532
+ else {
3533
+ const before = scroller.scrollTop;
3534
+ const target = before > 8 ? before - 6 : before + 6;
3535
+ scroller.scrollTop = target;
3536
+ window.requestAnimationFrame(() => {
3537
+ scroller.scrollTop = before;
3538
+ });
3539
+ }
3540
+ }
3541
+ timer = window.setTimeout(() => {
3542
+ if (stopped) return;
3543
+ const rail = railCount();
3544
+ entry.steps.push({
3545
+ kind,
3546
+ rail,
3547
+ reachedScroller: scroller !== null,
3548
+ reading: readingStateOf(slot === null ? null : slot.querySelector("[data-chat-flow]"))
3549
+ });
3550
+ if (rail > 0) {
3551
+ finish(kind);
3552
+ return;
3553
+ }
3554
+ step(index + 1);
3555
+ }, 320);
3556
+ };
3557
+ timer = window.setTimeout(() => step(0), 420);
3558
+ return () => {
3559
+ stopped = true;
3560
+ window.clearTimeout(timer);
3561
+ if (variablesObserver !== null) variablesObserver.disconnect();
3562
+ };
3563
+ }, [
3564
+ active,
3565
+ sessionId,
3566
+ paneId
3567
+ ]);
3362
3568
 
3363
3569
  if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
3364
3570
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
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": {