dsh-multipane 1.0.48 → 1.0.49

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,11 @@ node scripts/check-names.cjs # package name / version / release-age allowanc
161
161
 
162
162
  ## Changelog
163
163
 
164
+ ### 1.0.49 (2026-11-11)
165
+
166
+ - **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.
167
+ - **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.
168
+
164
169
  ### 1.0.48 (2026-11-11)
165
170
 
166
171
  - **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,11 @@ node scripts/check-names.cjs # 包名 / 版本 / 冷却豁免三处是否一
160
160
 
161
161
  ## 更新记录
162
162
 
163
+ ### 1.0.49(2026-11-11)
164
+
165
+ - **修「窗格里的轮次导航条不出现」,第一步:之前的自动补救敲错了元素**。窗格里内容滚动的所有权在宿主的 `[data-conversation-scroll]` 上,它的滚动监听器第一行就会判断「事件来源是不是我自己(scroller)」,不是就直接返回;1.0.47 的合成滚动打在标签内容里那层列表壳上,既不是监听对象,改它的 `scrollTop` 也不会产生任何滚动事件,所以补了 5 秒等于没补。现在对准真正的滚动容器,按「scroll 事件 → scrollend 事件 → 1px 真滚动(下一帧还原)」逐级升级,出现即停
166
+ - **新增一处取证**:每栏会把「导航条有没有出现、宿主内部的读取状态(initialized / followingTail)、滚动容器高度与两个 CSS 变量」写进 `localStorage` 的 `dsv-rail-diag`(最多 12 条)。这是给「没有开发者工具也要定位」准备的,不影响界面
167
+
163
168
  ### 1.0.48(2026-11-11)
164
169
 
165
170
  - **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.49";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
22
 
23
23
 
@@ -3271,6 +3271,104 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3271
3271
  * The conversation body of one tab: the host's own content factory, bound to
3272
3272
  * the tab's session through the scope provider.
3273
3273
  */
3274
+ /* ── 1.0.49 诊断工具:把一个窗格里「轮次导航条」的现状拍成快照 ───────────────
3275
+ 只读 DOM 与计算样式,不改任何东西。写进 localStorage 的 `dsv-rail-diag`,
3276
+ 由台式机读 Electron 的 leveldb 取证(用户不用做任何操作)。 */
3277
+ const RAIL_DIAG_KEY = "dsv-rail-diag";
3278
+ const roundPx = (value) => (typeof value === "number" && Number.isFinite(value) ? Math.round(value) : null);
3279
+ const rectOf = (element) => {
3280
+ if (element === null || element === void 0) return null;
3281
+ const rect = element.getBoundingClientRect();
3282
+ return { w: roundPx(rect.width), h: roundPx(rect.height), x: roundPx(rect.left), y: roundPx(rect.top) };
3283
+ };
3284
+ /* 从 DOM 节点摸到 React fiber,沿 return 链找 useChatReading 的 state
3285
+ (形状固定为 { initialized, followingTail, activeTurn })。这是唯一能在
3286
+ initialized 为假时区分「没渲染」和「渲染了被藏起来」的办法。 */
3287
+ function readingStateOf(node) {
3288
+ if (node === null || node === void 0) return null;
3289
+ try {
3290
+ const key = Object.keys(node).find((name) => name.startsWith("__reactFiber$"));
3291
+ if (key === void 0) return null;
3292
+ let fiber = node[key];
3293
+ for (let depth = 0; fiber !== null && fiber !== void 0 && depth < 80; depth += 1, fiber = fiber.return) {
3294
+ let hook = fiber.memoizedState;
3295
+ for (let slot = 0; hook !== null && hook !== void 0 && typeof hook === "object" && slot < 40; slot += 1, hook = hook.next) {
3296
+ const state = hook.memoizedState;
3297
+ if (state !== null && typeof state === "object" && typeof state.initialized === "boolean" && typeof state.followingTail === "boolean") {
3298
+ return {
3299
+ initialized: state.initialized,
3300
+ followingTail: state.followingTail,
3301
+ activeTurn: state.activeTurn ?? null
3302
+ };
3303
+ }
3304
+ }
3305
+ }
3306
+ } catch {
3307
+ /* 宿主内部结构变了就放弃这一项,不影响其它诊断 */
3308
+ }
3309
+ return null;
3310
+ }
3311
+ function railDiagOf(paneEl) {
3312
+ const slot = paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
3313
+ const scroller = slot === null ? null : slot.querySelector("[data-conversation-scroll]");
3314
+ const flow = slot === null ? null : slot.querySelector("[data-chat-flow]");
3315
+ const nav = slot === null ? null : slot.querySelector("nav");
3316
+ const root = flow === null ? null : flow.parentElement === null ? null : flow.parentElement.parentElement;
3317
+ const navStyle = nav === null ? null : getComputedStyle(nav);
3318
+ const scrollerStyle = scroller === null ? null : getComputedStyle(scroller);
3319
+ return {
3320
+ slot: rectOf(slot),
3321
+ scroller:
3322
+ scroller === null
3323
+ ? null
3324
+ : {
3325
+ rect: rectOf(scroller),
3326
+ clientH: scroller.clientHeight,
3327
+ scrollH: scroller.scrollHeight,
3328
+ scrollTop: roundPx(scroller.scrollTop),
3329
+ viewportVar: scrollerStyle.getPropertyValue("--dsh-conversation-viewport-height").trim(),
3330
+ composerVar: scrollerStyle.getPropertyValue("--dsh-composer-height").trim()
3331
+ },
3332
+ flow: rectOf(flow),
3333
+ followingTailAttr: root === null ? null : root.hasAttribute("data-chat-following-tail"),
3334
+ nav:
3335
+ nav === null
3336
+ ? null
3337
+ : {
3338
+ rect: rectOf(nav),
3339
+ buttons: nav.querySelectorAll("button[data-index]").length,
3340
+ display: navStyle.display,
3341
+ visibility: navStyle.visibility,
3342
+ maxHeight: navStyle.maxHeight,
3343
+ height: navStyle.height,
3344
+ top: navStyle.top,
3345
+ band: navStyle.getPropertyValue("--turn-rail-band").trim()
3346
+ },
3347
+ reading: readingStateOf(flow)
3348
+ };
3349
+ }
3350
+ function writeRailDiag(entry) {
3351
+ try {
3352
+ const storage = window.localStorage;
3353
+ if (storage === null || storage === void 0) return;
3354
+ let list = [];
3355
+ const raw = storage.getItem(RAIL_DIAG_KEY);
3356
+ if (typeof raw === "string" && raw !== "") {
3357
+ try {
3358
+ const parsed = JSON.parse(raw);
3359
+ if (Array.isArray(parsed)) list = parsed;
3360
+ } catch {
3361
+ /* 旧值坏了就覆盖 */
3362
+ }
3363
+ }
3364
+ list.push(entry);
3365
+ while (list.length > 12) list.shift();
3366
+ storage.setItem(RAIL_DIAG_KEY, JSON.stringify(list));
3367
+ } catch {
3368
+ /* localStorage 不可用就算了,不影响功能 */
3369
+ }
3370
+ }
3371
+
3274
3372
  function TabContent(props) {
3275
3373
  const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn, active } = props;
3276
3374
  const { reference, status } = useSessionReference(sessions, sessionId);
@@ -3318,47 +3416,105 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3318
3416
 
3319
3417
  const paneId = react.useContext(PaneIdCtx);
3320
3418
 
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
- ]);
3419
+ /* ── 1.0.49:轮次导航条在窗格里不出现的取证 + 修正刺激 ──────────────────
3420
+ 宿主源码(app.asar → dsh-client-ui-chat/lib/client.js)里,那条短横线要同时满足:
3421
+ 1) `scroll.initialized === true` 才渲染 TurnNavigator(第 3622 行);
3422
+ 2) `items.length >= 2`,只有一轮会话时组件自己 `return null`(第 434 行);
3423
+ 3) `.frame` 在容器宽度 ≤900px 时被宿主 `@container` 设为 display:none。
3424
+
3425
+ 而滚动的所有权是这样的:`ChatViewport.attach()` 把 scroll/scrollend 监听器挂在
3426
+ `list.closest("[data-conversation-scroll]")` 上,`onScroll` 第一行就
3427
+ `if (event.target !== this.elements.scroller) return`。1.0.47 的补敲打在
3428
+ `[data-chat-flow].parentElement` 上 —— 那是 `div.scroll`(列表壳,不滚动),
3429
+ 既不是监听器所在的元素,改它的 scrollTop 也不产生任何滚动事件:
3430
+ synthetic scroll 与「8px 真滚动」双双落空,所以怎么补都没用。
3431
+
3432
+ 1.0.49 对准真正的滚动容器 `[data-conversation-scroll]`,并逐级升级刺激强度:
3433
+ scroll 事件 → scrollend 事件 → 1px 真滚动(下一帧还原)。每一步都把
3434
+ 「有没有出现短横线、React 侧 reading 状态」写进 localStorage 的
3435
+ `dsv-rail-diag`,这样修不修得好都有据可查,不靠猜。 */
3436
+ react.useEffect(() => {
3437
+ /* 只对「本栏当前显示的那个标签」做一次:隐藏的 slot 是 display:none,
3438
+ 量出来的高度全是 0,去戳它也没有意义,只会刷出错误结论。 */
3439
+ if (active !== true || sessionId === null) return;
3440
+ const paneEl = paneId === null || paneId === void 0 ? null : document.querySelector(`.dsv-pane[data-pane-id="${paneId}"]`);
3441
+ if (paneEl === null) return;
3442
+ const slotOf = () => paneEl.querySelector('.dsv-tab-slot[data-active="1"]');
3443
+ const railCount = () => {
3444
+ const slot = slotOf();
3445
+ return slot === null ? 0 : slot.querySelectorAll("nav button[data-index]").length;
3446
+ };
3447
+ const entry = {
3448
+ at: new Date().toISOString(),
3449
+ version: PLUGIN_VERSION,
3450
+ paneId,
3451
+ sessionId,
3452
+ before: railDiagOf(paneEl),
3453
+ steps: []
3454
+ };
3455
+ let stopped = false;
3456
+ let timer = 0;
3457
+ const finish = (result) => {
3458
+ if (stopped) return;
3459
+ stopped = true;
3460
+ window.clearTimeout(timer);
3461
+ entry.result = result;
3462
+ entry.after = railDiagOf(paneEl);
3463
+ writeRailDiag(entry);
3464
+ };
3465
+ if (railCount() > 0) {
3466
+ finish("already");
3467
+ return () => {
3468
+ stopped = true;
3469
+ };
3470
+ }
3471
+ const step = (index) => {
3472
+ if (stopped) return;
3473
+ if (index >= 18) {
3474
+ finish("timeout");
3475
+ return;
3476
+ }
3477
+ const kind = ["scroll", "scrollend", "real"][index % 3];
3478
+ const slot = slotOf();
3479
+ const scroller = slot === null ? null : slot.querySelector("[data-conversation-scroll]");
3480
+ if (scroller !== null) {
3481
+ if (kind === "scroll") scroller.dispatchEvent(new Event("scroll"));
3482
+ else if (kind === "scrollend") scroller.dispatchEvent(new Event("scrollend"));
3483
+ else {
3484
+ const before = scroller.scrollTop;
3485
+ const target = before > 8 ? before - 6 : before + 6;
3486
+ scroller.scrollTop = target;
3487
+ window.requestAnimationFrame(() => {
3488
+ scroller.scrollTop = before;
3489
+ });
3490
+ }
3491
+ }
3492
+ timer = window.setTimeout(() => {
3493
+ if (stopped) return;
3494
+ const rail = railCount();
3495
+ entry.steps.push({
3496
+ kind,
3497
+ rail,
3498
+ reachedScroller: scroller !== null,
3499
+ reading: readingStateOf(slot === null ? null : slot.querySelector("[data-chat-flow]"))
3500
+ });
3501
+ if (rail > 0) {
3502
+ finish(kind);
3503
+ return;
3504
+ }
3505
+ step(index + 1);
3506
+ }, 320);
3507
+ };
3508
+ timer = window.setTimeout(() => step(0), 420);
3509
+ return () => {
3510
+ stopped = true;
3511
+ window.clearTimeout(timer);
3512
+ };
3513
+ }, [
3514
+ active,
3515
+ sessionId,
3516
+ paneId
3517
+ ]);
3362
3518
 
3363
3519
  if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
3364
3520
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
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": {