dsh-multipane 1.0.47 → 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,11 @@ 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
+
164
169
  ### 1.0.47 (2026-11-11)
165
170
 
166
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.
package/README.md CHANGED
@@ -160,6 +160,11 @@ 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
+
163
168
  ### 1.0.47(2026-11-11)
164
169
 
165
170
  - **修「分栏后第一次打开,右侧轮次导航条根本不出现,得把某一栏拖得很宽才出来」**:宿主的这条导航要等一次真实事件才会把 `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.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)}
@@ -3786,8 +3790,44 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3786
3790
  };
3787
3791
  }
3788
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
+
3789
3823
  /**
3790
- * 栏内标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个(在当前栏的标签之间循环)。
3824
+ * 标签切换:Ctrl+Tab 切到下一个、Ctrl+Shift+Tab 切到上一个。
3825
+ *
3826
+ * 1.0.48 起**跨栏**:把所有栏的标签按「栏的左右顺序 + 栏内标签顺序」拉成一条环,
3827
+ * 走到本栏最后一个标签就进下一栏的第一个,最后一栏的末尾绕回第一栏开头,反向同理。
3828
+ * 焦点栏跟着目标标签一起走(focusPaneId)—— 否则高亮、底栏数字都留在旧栏。
3829
+ * 键盘焦点本身不挪(见上面 cycleHint),连按的方向因此不会打乒乓。
3830
+ * 整条环只有 1 个标签时不做任何事(保持「没有第二个标签就不响应」的老手感)。
3791
3831
  *
3792
3832
  * 宿主的 Ctrl+Tab 是空闲的:主进程 `globalShortcut.register` 0 处,5 个
3793
3833
  * `before-input-event` 只处理 F12 / 快捷键转发 / iframe 遮罩,都不碰 Tab。
@@ -3801,23 +3841,36 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3801
3841
  const state = LIVE_STATE;
3802
3842
  if (state === null || state === void 0 || typeof LIVE_APPLY !== "function") return;
3803
3843
  const active = document.activeElement;
3804
- const focusedPane =
3844
+ const domPaneEl =
3805
3845
  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"]');
3846
+ const domPaneId = domPaneEl === null ? null : domPaneEl.getAttribute("data-pane-id");
3847
+ const paneEl = currentPaneEl();
3807
3848
  if (paneEl === null) return;
3808
3849
  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);
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);
3812
3862
  if (index < 0) return;
3813
3863
  const step = event.shiftKey === true ? -1 : 1;
3814
- const next = pane.tabs[(index + step + pane.tabs.length) % pane.tabs.length];
3864
+ const target = ring[(index + step + ring.length) % ring.length];
3815
3865
  event.preventDefault();
3816
3866
  event.stopPropagation();
3867
+ cycleHint = { fromPaneId: domPaneId, paneId: target.paneId };
3817
3868
  LIVE_APPLY((prev) => ({
3818
3869
  ...prev,
3819
- focusPaneId: paneId,
3820
- 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
+ )
3821
3874
  }));
3822
3875
  };
3823
3876
  window.addEventListener("keydown", onKey, true);
@@ -3923,10 +3976,7 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
3923
3976
  closeWindow();
3924
3977
  return;
3925
3978
  }
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"]');
3979
+ const paneEl = currentPaneEl();
3930
3980
  if (paneEl === null || paneEl === void 0) return;
3931
3981
  event.preventDefault();
3932
3982
  event.stopPropagation();
@@ -4158,11 +4208,13 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
4158
4208
  /* 扣掉「+ 按钮」占宽。可拖窗口区(44px)只在**非最后一栏**要额外扣:
4159
4209
  最后一栏的 padding-right 已经是窗口按钮的让位区,本身就是空白,
4160
4210
  再扣 44 会把标签挤到只剩 24px。 */
4161
- /* 可用宽度 = 栏宽 − 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 切掉一截。
4162
4214
  最后一栏:header 的 padding-right 是 145(窗口按钮让位),它已经从
4163
4215
  pane 宽度里被 header 的 padding 吃掉,所以再扣 145;不再扣 44 拖拽区
4164
4216
  (那块让位区本身就是可拖窗口区)。 */
4165
- const CHROME_W = 16 + 24;
4217
+ const CHROME_W = 16 + 26;
4166
4218
  const stripW = Math.max(0, headW - CHROME_W - (isLast ? 145 : 44));
4167
4219
  /* 每个标签的标题:渲染进标签和「算宽度」共用同一份结果(否则两处逻辑会漂) */
4168
4220
  const tabLabels = pane.tabs.map((tab) => {
@@ -9514,7 +9566,7 @@ if (typeof renderFactorySlot !== "function") return h("div", { className: "dsv-e
9514
9566
  };
9515
9567
  }, "dsh-split-view: attachments drop routing");
9516
9568
 
9517
- /* 栏内标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9569
+ /* 跨栏标签切换:Ctrl+Tab / Ctrl+Shift+Tab。设置页没有 .dsv-pane,自然不会触发。 */
9518
9570
  ctx.effect(() => installTabCycling(), "dsh-split-view: tab cycling shortcut");
9519
9571
  ctx.effect(() => installCloseTabShortcut(), "dsh-split-view: ctrl+w closes the tab");
9520
9572
  /* 把宿主的 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.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": {