dsh-multipane 1.0.47 → 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,16 @@ 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
+
169
+ ### 1.0.48 (2026-11-11)
170
+
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.
172
+ - **Bigger "+" button on the tab strip.** It used to be a 20x20 box, shorter than the tabs and fiddly to hit. It now fills the strip's full height (same height as the tabs) and is 26px wide, with the tabs' hover background and 6px radius. Only this one button inside the tab strip changed; buttons on the settings page and elsewhere are untouched.
173
+
164
174
  ### 1.0.47 (2026-11-11)
165
175
 
166
176
  - **Fixed the rail being absent the first time a pane opens** (it only appeared after dragging one pane very wide). The host's turn navigator sets its `initialized` flag on a real event, and that one chance is already gone when a pane first mounts; nudging the width slightly does not wake it up, only the scroll produced by a big reflow does - which is why two, three and four panes were all blank after a restart and switching the active pane did nothing. A pane now kicks itself adaptively: every 250ms it checks whether the rail is there and, if not, dispatches a synthetic `scroll` event (no scrolling, no layout change), escalating to an 8px real scroll that is immediately restored every third attempt. It stops as soon as the rail appears, capped at five seconds.
package/README.md CHANGED
@@ -160,6 +160,16 @@ 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
+
168
+ ### 1.0.48(2026-11-11)
169
+
170
+ - **Ctrl+Tab / Ctrl+Shift+Tab 可以跨栏切标签了**:以前只在当前栏的标签之间循环,某一栏只有一个标签时按下去没反应,也永远进不了隔壁栏。现在把所有栏的标签按「从左到右、栏内标签顺序」串成一圈:本栏最后一个的下一个就是下一栏的第一个,最后一栏绕回第一栏,反向同理;焦点栏跟着目标标签一起走,切完直接能在新栏里接着打字
171
+ - **标签条右边的「+」加大**:原来是 20×20 的小方块,比标签矮一截、也不太点得中。现在高度拉满整条标签条(与标签同高),宽度加到 26px,悬停底色和 6px 圆角也跟标签一致。只放宽了标签条里的这一颗,设置页等其它地方的按钮不受影响
172
+
163
173
  ### 1.0.47(2026-11-11)
164
174
 
165
175
  - **修「分栏后第一次打开,右侧轮次导航条根本不出现,得把某一栏拖得很宽才出来」**:宿主的这条导航要等一次真实事件才会把 `initialized` 置真,而窗格首次挂载时那次机会已经错过;小幅拖宽度不足以叫醒它,只有大幅重排引发的滚动才行——所以两栏、三栏、四栏重启后都是空白的,切换激活栏也无用。现在本栏激活后会自适应补敲:每 250ms 检查一次有没有那条导航,没有就补一次合成 `scroll` 事件(不动滚动条、不改布局),每三次升级成 8px 真滚动并立刻还原,出现即停、5 秒封顶。
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.47";
20
+ const PLUGIN_VERSION = "1.0.49";
21
21
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-multipane/latest";
22
22
 
23
23
 
@@ -2317,6 +2317,10 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
2317
2317
  标题栏空白处的拖动窗口 / 双击最大化不受影响。 */
2318
2318
  .dsv-paneheader .dsv-tabs{height:100%;align-items:stretch}
2319
2319
  .dsv-paneheader .dsv-tab{height:100%;padding:0 5px 0 8px;align-items:center;box-sizing:border-box}
2320
+ /* 标签条右边那颗「+ 新建标签」:原来沿用 .dsv-btn 的 20×20 小方块,比标签矮一截、
2321
+ 也窄得难点。这里只在这条标签条里放宽命中区,高度交给标签条拉伸(与 .dsv-tab 同高)。
2322
+ .dsv-btn 还有设置页/更多菜单等其它用处,不能全局改。 */
2323
+ .dsv-paneheader .dsv-btn{height:100%;min-width:26px;padding:0 7px;box-sizing:border-box;font-size:15px;border-radius:6px}
2320
2324
  .dsv-divider{flex:0 0 7px;position:relative;cursor:col-resize;touch-action:none;background:transparent;app-region:no-drag;-webkit-app-region:no-drag}
2321
2325
  .dsv-divider::after{content:"";position:absolute;top:0;bottom:0;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));transition:background .12s,width .12s}
2322
2326
  .dsv-divider:hover::after,.dsv-divider[data-dragging="1"]::after{background:var(--dsv-div-c,#a7aaaf);width:var(--dsv-div-w,2px)}
@@ -3267,6 +3271,104 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3267
3271
  * The conversation body of one tab: the host's own content factory, bound to
3268
3272
  * the tab's session through the scope provider.
3269
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
+
3270
3372
  function TabContent(props) {
3271
3373
  const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn, active } = props;
3272
3374
  const { reference, status } = useSessionReference(sessions, sessionId);
@@ -3314,47 +3416,105 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3314
3416
 
3315
3417
  const paneId = react.useContext(PaneIdCtx);
3316
3418
 
3317
- /* 1.0.47:宿主的轮次导航条要等一次「真实的滚动/重排事件」才会把 initialized
3318
- 置真,而窗格初次挂载时那次机会已经错过;之后小幅改宽度也不会把它叫醒
3319
- (只有大幅拖宽引发的内容重排 + 滚动才行)。这里不猜刺激强度:本栏激活后
3320
- 每 250ms 看一眼有没有那条导航,没有就补一次合成 scroll 事件(不动滚动
3321
- 条、不改布局),每三次升级成 8px 真滚动并立刻还原;出现即停,5 秒封顶。 */
3322
- react.useEffect(() => {
3323
- if (active !== true || sessionId === null) return;
3324
- const paneEl = paneId === null || paneId === void 0 ? null : document.querySelector(`.dsv-pane[data-pane-id="${paneId}"]`);
3325
- if (paneEl === null) return;
3326
- let tries = 0;
3327
- let timer = 0;
3328
- let cancelled = false;
3329
- const hasRail = () => paneEl.querySelector("nav button[data-index]") !== null;
3330
- const tick = () => {
3331
- if (cancelled || hasRail() || tries >= 20) return;
3332
- tries += 1;
3333
- const column = paneEl.querySelector('.dsv-tab-slot[data-active="1"] [data-chat-flow]');
3334
- const scroller = column === null ? null : column.parentElement;
3335
- if (scroller !== null) {
3336
- if (tries % 3 === 0) {
3337
- const before = scroller.scrollTop;
3338
- scroller.scrollTop = before + 8;
3339
- window.requestAnimationFrame(() => {
3340
- scroller.scrollTop = before;
3341
- });
3342
- } else {
3343
- scroller.dispatchEvent(new Event("scroll"));
3344
- }
3345
- }
3346
- timer = window.setTimeout(tick, 250);
3347
- };
3348
- timer = window.setTimeout(tick, 250);
3349
- return () => {
3350
- cancelled = true;
3351
- window.clearTimeout(timer);
3352
- };
3353
- }, [
3354
- active,
3355
- sessionId,
3356
- paneId
3357
- ]);
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
+ ]);
3358
3518
 
3359
3519
  if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
3360
3520
 
@@ -3786,8 +3946,44 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3786
3946
  };
3787
3947
  }
3788
3948
 
3949
+ /* Ctrl+Tab 跨栏跳过去之后**不抢键盘焦点**(插入符留在原栏的输入框里,回头再按一次
3950
+ 就能接着打字)。但「当前栏」原本是按 document.activeElement 判的 —— 不记一笔,
3951
+ 连按 Ctrl+Tab 会每次都从旧栏重新算,在两栏之间打乒乓;Ctrl+W 也会关掉旧栏的标签。
3952
+ 所以这里记一个「刚刚把焦点栏挪到哪」:只要键盘焦点还停在来源栏、
3953
+ 而状态里的焦点栏仍是目标栏,就以目标栏为准。用户一按鼠标(pointerdown 会把
3954
+ focusPaneId 改成落点栏)、或在别处换掉焦点栏,条件不成立 → 自动作废。 */
3955
+ let cycleHint = null;
3956
+
3957
+ const paneElById = (paneId) => (typeof paneId === "string" && paneId !== "" ? document.querySelector('.dsv-pane[data-pane-id="' + paneId + '"]') : null);
3958
+
3959
+ /**
3960
+ * 「当前栏」的唯一判定口径,Ctrl+Tab 与 Ctrl+W 共用,避免两个快捷键各算一套。
3961
+ * 顺序:键盘焦点所在栏 → cycleHint 记住的目标栏 → 状态里的焦点栏 → data-focus。
3962
+ */
3963
+ function currentPaneEl() {
3964
+ const active = document.activeElement;
3965
+ const domPane =
3966
+ active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3967
+ const domId = domPane === null ? null : domPane.getAttribute("data-pane-id");
3968
+ const state = LIVE_STATE;
3969
+ const stateId = state === null || state === void 0 ? null : state.focusPaneId ?? null;
3970
+ if (cycleHint !== null && domId === cycleHint.fromPaneId && stateId === cycleHint.paneId) {
3971
+ const hinted = paneElById(cycleHint.paneId);
3972
+ if (hinted !== null) return hinted;
3973
+ }
3974
+ cycleHint = null;
3975
+ if (domPane !== null) return domPane;
3976
+ return paneElById(stateId) ?? document.querySelector('.dsv-pane[data-focus="1"]');
3977
+ }
3978
+
3789
3979
  /**
3790
- * 栏内标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个(在当前栏的标签之间循环)。
3980
+ * 标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个。
3981
+ *
3982
+ * 1.0.48 起**跨栏**:把所有栏的标签按「栏的左右顺序 + 栏内标签顺序」拉成一条环,
3983
+ * 走到本栏最后一个标签就进下一栏的第一个,最后一栏的末尾绕回第一栏开头,反向同理。
3984
+ * 焦点栏跟着目标标签一起走(focusPaneId)—— 否则高亮、底栏数字都留在旧栏。
3985
+ * 键盘焦点本身不挪(见上面 cycleHint),连按的方向因此不会打乒乓。
3986
+ * 整条环只有 1 个标签时不做任何事(保持「没有第二个标签就不响应」的老手感)。
3791
3987
  *
3792
3988
  * 宿主的 Ctrl+Tab 是空闲的:主进程 `globalShortcut.register` 0 处,5 个
3793
3989
  * `before-input-event` 只处理 F12 / 快捷键转发 / iframe 遮罩,都不碰 Tab。
@@ -3801,23 +3997,36 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3801
3997
  const state = LIVE_STATE;
3802
3998
  if (state === null || state === void 0 || typeof LIVE_APPLY !== "function") return;
3803
3999
  const active = document.activeElement;
3804
- const focusedPane =
4000
+ const domPaneEl =
3805
4001
  active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3806
- const paneEl = focusedPane ?? document.querySelector('.dsv-pane[data-focus="1"]');
4002
+ const domPaneId = domPaneEl === null ? null : domPaneEl.getAttribute("data-pane-id");
4003
+ const paneEl = currentPaneEl();
3807
4004
  if (paneEl === null) return;
3808
4005
  const paneId = paneEl.getAttribute("data-pane-id");
3809
- const pane = (state.panes ?? []).find((item) => item.id === paneId);
3810
- if (pane === void 0 || (pane.tabs ?? []).length < 2) return;
3811
- const index = pane.tabs.findIndex((tab) => tab.id === pane.activeTabId);
4006
+ const panes = state.panes ?? [];
4007
+ /* 拉平成一条环:空栏不占位,栏序就是屏幕上的排列顺序。 */
4008
+ const ring = [];
4009
+ for (const pane of panes) {
4010
+ for (const tab of pane.tabs ?? []) ring.push({ paneId: pane.id, tabId: tab.id });
4011
+ }
4012
+ if (ring.length < 2) return;
4013
+ const origin = panes.find((item) => item.id === paneId);
4014
+ if (origin === void 0) return;
4015
+ let index = ring.findIndex((entry) => entry.paneId === paneId && entry.tabId === origin.activeTabId);
4016
+ /* 空白标签/尚无激活标签的栏:从本栏第一个标签算起,保证按键总有去处。 */
4017
+ if (index < 0) index = ring.findIndex((entry) => entry.paneId === paneId);
3812
4018
  if (index < 0) return;
3813
4019
  const step = event.shiftKey === true ? -1 : 1;
3814
- const next = pane.tabs[(index + step + pane.tabs.length) % pane.tabs.length];
4020
+ const target = ring[(index + step + ring.length) % ring.length];
3815
4021
  event.preventDefault();
3816
4022
  event.stopPropagation();
4023
+ cycleHint = { fromPaneId: domPaneId, paneId: target.paneId };
3817
4024
  LIVE_APPLY((prev) => ({
3818
4025
  ...prev,
3819
- focusPaneId: paneId,
3820
- panes: prev.panes.map((item) => (item.id === paneId ? { ...item, activeTabId: next.id } : item))
4026
+ focusPaneId: target.paneId,
4027
+ panes: prev.panes.map((item) =>
4028
+ item.id === target.paneId ? { ...item, activeTabId: target.tabId } : item
4029
+ )
3821
4030
  }));
3822
4031
  };
3823
4032
  window.addEventListener("keydown", onKey, true);
@@ -3923,10 +4132,7 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3923
4132
  closeWindow();
3924
4133
  return;
3925
4134
  }
3926
- const active = document.activeElement;
3927
- const focusedPane =
3928
- active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3929
- const paneEl = focusedPane ?? document.querySelector('.dsv-pane[data-focus="1"]');
4135
+ const paneEl = currentPaneEl();
3930
4136
  if (paneEl === null || paneEl === void 0) return;
3931
4137
  event.preventDefault();
3932
4138
  event.stopPropagation();
@@ -4158,11 +4364,13 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
4158
4364
  /* 扣掉「+ 按钮」占宽。可拖窗口区(44px)只在**非最后一栏**要额外扣:
4159
4365
  最后一栏的 padding-right 已经是窗口按钮的让位区,本身就是空白,
4160
4366
  再扣 44 会把标签挤到只剩 24px。 */
4161
- /* 可用宽度 = 栏宽 − header 左右 padding(16) − + 按钮(24) − 拖拽区。
4367
+ /* 可用宽度 = 栏宽 − header 左右 padding(16) − + 按钮(26) − 拖拽区。
4368
+ 「+」的宽度必须与 CSS `.dsv-paneheader .dsv-btn` 的 min-width 一致(1.0.48 起 26px,
4369
+ 以前是 20px),否则标签宽度会多算出几像素、最后一个标签被 overflow:hidden 切掉一截。
4162
4370
  最后一栏:header 的 padding-right 是 145(窗口按钮让位),它已经从
4163
4371
  pane 宽度里被 header 的 padding 吃掉,所以再扣 145;不再扣 44 拖拽区
4164
4372
  (那块让位区本身就是可拖窗口区)。 */
4165
- const CHROME_W = 16 + 24;
4373
+ const CHROME_W = 16 + 26;
4166
4374
  const stripW = Math.max(0, headW - CHROME_W - (isLast ? 145 : 44));
4167
4375
  /* 每个标签的标题:渲染进标签和「算宽度」共用同一份结果(否则两处逻辑会漂) */
4168
4376
  const tabLabels = pane.tabs.map((tab) => {
@@ -9514,7 +9722,7 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
9514
9722
  };
9515
9723
  }, "dsh-split-view: attachments drop routing");
9516
9724
 
9517
- /* 栏内标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9725
+ /* 跨栏标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9518
9726
  ctx.effect(() => installTabCycling(), "dsh-split-view: tab cycling shortcut");
9519
9727
  ctx.effect(() => installCloseTabShortcut(), "dsh-split-view: ctrl+w closes the tab");
9520
9728
  /* 把宿主的 page.close 绑定交出来,否则 Ctrl+W 在原生层就被吃掉、插件永远收不到。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.47",
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": {