dsh-multipane 1.0.46 → 1.0.48

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,15 @@ node scripts/check-names.cjs # package name / version / release-age allowanc
161
161
 
162
162
  ## Changelog
163
163
 
164
+ ### 1.0.48 (2026-11-11)
165
+
166
+ - **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.
167
+ - **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.
168
+
169
+ ### 1.0.47 (2026-11-11)
170
+
171
+ - **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.
172
+
164
173
  ### 1.0.46 (2026-11-11)
165
174
 
166
175
  - **Fixed the turn navigator flickering in and out, and never coming back after a resize**: 1.0.45 hid the rail below 480px with `display:none`, but the host's rail measures its own height for a virtual scroller - taking it out of layout recorded a height of 0 with nothing to recompute it when the pane grew back, so the rail stayed gone. The rail now keeps its layout at every width and is hidden only by `visibility` below 240px, which leaves the measurement valid and restores instantly.
package/README.md CHANGED
@@ -160,6 +160,15 @@ node scripts/check-names.cjs # 包名 / 版本 / 冷却豁免三处是否一
160
160
 
161
161
  ## 更新记录
162
162
 
163
+ ### 1.0.48(2026-11-11)
164
+
165
+ - **Ctrl+Tab / Ctrl+Shift+Tab 可以跨栏切标签了**:以前只在当前栏的标签之间循环,某一栏只有一个标签时按下去没反应,也永远进不了隔壁栏。现在把所有栏的标签按「从左到右、栏内标签顺序」串成一圈:本栏最后一个的下一个就是下一栏的第一个,最后一栏绕回第一栏,反向同理;焦点栏跟着目标标签一起走,切完直接能在新栏里接着打字
166
+ - **标签条右边的「+」加大**:原来是 20×20 的小方块,比标签矮一截、也不太点得中。现在高度拉满整条标签条(与标签同高),宽度加到 26px,悬停底色和 6px 圆角也跟标签一致。只放宽了标签条里的这一颗,设置页等其它地方的按钮不受影响
167
+
168
+ ### 1.0.47(2026-11-11)
169
+
170
+ - **修「分栏后第一次打开,右侧轮次导航条根本不出现,得把某一栏拖得很宽才出来」**:宿主的这条导航要等一次真实事件才会把 `initialized` 置真,而窗格首次挂载时那次机会已经错过;小幅拖宽度不足以叫醒它,只有大幅重排引发的滚动才行——所以两栏、三栏、四栏重启后都是空白的,切换激活栏也无用。现在本栏激活后会自适应补敲:每 250ms 检查一次有没有那条导航,没有就补一次合成 `scroll` 事件(不动滚动条、不改布局),每三次升级成 8px 真滚动并立刻还原,出现即停、5 秒封顶。
171
+
163
172
  ### 1.0.46(2026-11-11)
164
173
 
165
174
  - **修「右侧轮次导航条忽隐忽现、拉窄后再拖宽也回不来」**:1.0.45 用 `display:none` 在 480px 以下收起这条,但宿主的这条导航内部是虚拟滚动,`display` 一关就把可用高度量成 0 并留在状态里,宽度回来也不会重算 —— 成了单向棘轮。现在显示恒为 `block`,只有窄到 240px 以下才隐藏**可见性**(`visibility:hidden`),布局与测量始终保留,恢复宽度立刻可见。
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.46";
20
+ const PLUGIN_VERSION = "1.0.48";
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)}
@@ -3268,7 +3272,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3268
3272
  * the tab's session through the scope provider.
3269
3273
  */
3270
3274
  function TabContent(props) {
3271
- const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn } = props;
3275
+ const { sessionId, hero, sessions, renderFactorySlot, SessionProvider, renderSlot, viewBarOn, active } = props;
3272
3276
  const { reference, status } = useSessionReference(sessions, sessionId);
3273
3277
  const phase = hero ? "hero" : "active";
3274
3278
  /* The host's own conversation panel is a slot entry in `main.conversation`
@@ -3312,7 +3316,51 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3312
3316
  return null;
3313
3317
  }, []);
3314
3318
 
3315
- if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
3319
+ const paneId = react.useContext(PaneIdCtx);
3320
+
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
+ ]);
3362
+
3363
+ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-empty" }, t("这个版本没有提供会话内容区域"));
3316
3364
 
3317
3365
  // A blank tab is the host's own "new session" page: the content factory
3318
3366
  // rendered with no session in scope, which is exactly what the native
@@ -3742,8 +3790,44 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3742
3790
  };
3743
3791
  }
3744
3792
 
3793
+ /* Ctrl+Tab 跨栏跳过去之后**不抢键盘焦点**(插入符留在原栏的输入框里,回头再按一次
3794
+ 就能接着打字)。但「当前栏」原本是按 document.activeElement 判的 —— 不记一笔,
3795
+ 连按 Ctrl+Tab 会每次都从旧栏重新算,在两栏之间打乒乓;Ctrl+W 也会关掉旧栏的标签。
3796
+ 所以这里记一个「刚刚把焦点栏挪到哪」:只要键盘焦点还停在来源栏、
3797
+ 而状态里的焦点栏仍是目标栏,就以目标栏为准。用户一按鼠标(pointerdown 会把
3798
+ focusPaneId 改成落点栏)、或在别处换掉焦点栏,条件不成立 → 自动作废。 */
3799
+ let cycleHint = null;
3800
+
3801
+ const paneElById = (paneId) => (typeof paneId === "string" && paneId !== "" ? document.querySelector('.dsv-pane[data-pane-id="' + paneId + '"]') : null);
3802
+
3803
+ /**
3804
+ * 「当前栏」的唯一判定口径,Ctrl+Tab 与 Ctrl+W 共用,避免两个快捷键各算一套。
3805
+ * 顺序:键盘焦点所在栏 → cycleHint 记住的目标栏 → 状态里的焦点栏 → data-focus。
3806
+ */
3807
+ function currentPaneEl() {
3808
+ const active = document.activeElement;
3809
+ const domPane =
3810
+ active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3811
+ const domId = domPane === null ? null : domPane.getAttribute("data-pane-id");
3812
+ const state = LIVE_STATE;
3813
+ const stateId = state === null || state === void 0 ? null : state.focusPaneId ?? null;
3814
+ if (cycleHint !== null && domId === cycleHint.fromPaneId && stateId === cycleHint.paneId) {
3815
+ const hinted = paneElById(cycleHint.paneId);
3816
+ if (hinted !== null) return hinted;
3817
+ }
3818
+ cycleHint = null;
3819
+ if (domPane !== null) return domPane;
3820
+ return paneElById(stateId) ?? document.querySelector('.dsv-pane[data-focus="1"]');
3821
+ }
3822
+
3745
3823
  /**
3746
- * 栏内标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个(在当前栏的标签之间循环)。
3824
+ * 标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个。
3825
+ *
3826
+ * 1.0.48 起**跨栏**:把所有栏的标签按「栏的左右顺序 + 栏内标签顺序」拉成一条环,
3827
+ * 走到本栏最后一个标签就进下一栏的第一个,最后一栏的末尾绕回第一栏开头,反向同理。
3828
+ * 焦点栏跟着目标标签一起走(focusPaneId)—— 否则高亮、底栏数字都留在旧栏。
3829
+ * 键盘焦点本身不挪(见上面 cycleHint),连按的方向因此不会打乒乓。
3830
+ * 整条环只有 1 个标签时不做任何事(保持「没有第二个标签就不响应」的老手感)。
3747
3831
  *
3748
3832
  * 宿主的 Ctrl+Tab 是空闲的:主进程 `globalShortcut.register` 0 处,5 个
3749
3833
  * `before-input-event` 只处理 F12 / 快捷键转发 / iframe 遮罩,都不碰 Tab。
@@ -3757,23 +3841,36 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3757
3841
  const state = LIVE_STATE;
3758
3842
  if (state === null || state === void 0 || typeof LIVE_APPLY !== "function") return;
3759
3843
  const active = document.activeElement;
3760
- const focusedPane =
3844
+ const domPaneEl =
3761
3845
  active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3762
- const paneEl = focusedPane ?? document.querySelector('.dsv-pane[data-focus="1"]');
3846
+ const domPaneId = domPaneEl === null ? null : domPaneEl.getAttribute("data-pane-id");
3847
+ const paneEl = currentPaneEl();
3763
3848
  if (paneEl === null) return;
3764
3849
  const paneId = paneEl.getAttribute("data-pane-id");
3765
- const pane = (state.panes ?? []).find((item) => item.id === paneId);
3766
- if (pane === void 0 || (pane.tabs ?? []).length < 2) return;
3767
- const index = pane.tabs.findIndex((tab) => tab.id === pane.activeTabId);
3850
+ const panes = state.panes ?? [];
3851
+ /* 拉平成一条环:空栏不占位,栏序就是屏幕上的排列顺序。 */
3852
+ const ring = [];
3853
+ for (const pane of panes) {
3854
+ for (const tab of pane.tabs ?? []) ring.push({ paneId: pane.id, tabId: tab.id });
3855
+ }
3856
+ if (ring.length < 2) return;
3857
+ const origin = panes.find((item) => item.id === paneId);
3858
+ if (origin === void 0) return;
3859
+ let index = ring.findIndex((entry) => entry.paneId === paneId && entry.tabId === origin.activeTabId);
3860
+ /* 空白标签/尚无激活标签的栏:从本栏第一个标签算起,保证按键总有去处。 */
3861
+ if (index < 0) index = ring.findIndex((entry) => entry.paneId === paneId);
3768
3862
  if (index < 0) return;
3769
3863
  const step = event.shiftKey === true ? -1 : 1;
3770
- const next = pane.tabs[(index + step + pane.tabs.length) % pane.tabs.length];
3864
+ const target = ring[(index + step + ring.length) % ring.length];
3771
3865
  event.preventDefault();
3772
3866
  event.stopPropagation();
3867
+ cycleHint = { fromPaneId: domPaneId, paneId: target.paneId };
3773
3868
  LIVE_APPLY((prev) => ({
3774
3869
  ...prev,
3775
- focusPaneId: paneId,
3776
- panes: prev.panes.map((item) => (item.id === paneId ? { ...item, activeTabId: next.id } : item))
3870
+ focusPaneId: target.paneId,
3871
+ panes: prev.panes.map((item) =>
3872
+ item.id === target.paneId ? { ...item, activeTabId: target.tabId } : item
3873
+ )
3777
3874
  }));
3778
3875
  };
3779
3876
  window.addEventListener("keydown", onKey, true);
@@ -3879,10 +3976,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
3879
3976
  closeWindow();
3880
3977
  return;
3881
3978
  }
3882
- const active = document.activeElement;
3883
- const focusedPane =
3884
- active !== null && active !== void 0 && typeof active.closest === "function" ? active.closest(".dsv-pane") : null;
3885
- const paneEl = focusedPane ?? document.querySelector('.dsv-pane[data-focus="1"]');
3979
+ const paneEl = currentPaneEl();
3886
3980
  if (paneEl === null || paneEl === void 0) return;
3887
3981
  event.preventDefault();
3888
3982
  event.stopPropagation();
@@ -4114,11 +4208,13 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
4114
4208
  /* 扣掉「+ 按钮」占宽。可拖窗口区(44px)只在**非最后一栏**要额外扣:
4115
4209
  最后一栏的 padding-right 已经是窗口按钮的让位区,本身就是空白,
4116
4210
  再扣 44 会把标签挤到只剩 24px。 */
4117
- /* 可用宽度 = 栏宽 − header 左右 padding(16) − + 按钮(24) − 拖拽区。
4211
+ /* 可用宽度 = 栏宽 − header 左右 padding(16) − + 按钮(26) − 拖拽区。
4212
+ 「+」的宽度必须与 CSS `.dsv-paneheader .dsv-btn` 的 min-width 一致(1.0.48 起 26px,
4213
+ 以前是 20px),否则标签宽度会多算出几像素、最后一个标签被 overflow:hidden 切掉一截。
4118
4214
  最后一栏:header 的 padding-right 是 145(窗口按钮让位),它已经从
4119
4215
  pane 宽度里被 header 的 padding 吃掉,所以再扣 145;不再扣 44 拖拽区
4120
4216
  (那块让位区本身就是可拖窗口区)。 */
4121
- const CHROME_W = 16 + 24;
4217
+ const CHROME_W = 16 + 26;
4122
4218
  const stripW = Math.max(0, headW - CHROME_W - (isLast ? 145 : 44));
4123
4219
  /* 每个标签的标题:渲染进标签和「算宽度」共用同一份结果(否则两处逻辑会漂) */
4124
4220
  const tabLabels = pane.tabs.map((tab) => {
@@ -4591,6 +4687,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
4591
4687
  h(TabContentMemo, {
4592
4688
  sessionId: tabSessionId,
4593
4689
  hero: tabHero,
4690
+ active: tabActive,
4594
4691
  sessions,
4595
4692
  renderFactorySlot,
4596
4693
  SessionProvider,
@@ -9469,7 +9566,7 @@ const TAB_LABEL_CHROME_DOT_PX = 46;
9469
9566
  };
9470
9567
  }, "dsh-split-view: attachments drop routing");
9471
9568
 
9472
- /* 栏内标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9569
+ /* 跨栏标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9473
9570
  ctx.effect(() => installTabCycling(), "dsh-split-view: tab cycling shortcut");
9474
9571
  ctx.effect(() => installCloseTabShortcut(), "dsh-split-view: ctrl+w closes the tab");
9475
9572
  /* 把宿主的 page.close 绑定交出来,否则 Ctrl+W 在原生层就被吃掉、插件永远收不到。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multipane",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
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": {