dockview-core 7.0.2 → 7.0.4

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.
Files changed (98) hide show
  1. package/dist/cjs/api/dockviewGroupPanelApi.js +1 -1
  2. package/dist/cjs/dnd/dropTargetAnchorContainer.js +1 -2
  3. package/dist/cjs/dnd/pointer/longPress.js +1 -1
  4. package/dist/cjs/dnd/pointer/pointerDragController.js +9 -7
  5. package/dist/cjs/dnd/pointer/pointerDragSource.js +4 -2
  6. package/dist/cjs/dockview/components/panel/content.js +6 -6
  7. package/dist/cjs/dockview/components/popupService.js +1 -1
  8. package/dist/cjs/dockview/components/tab/tab.js +2 -2
  9. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  10. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  11. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +1 -1
  12. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  13. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +27 -5
  14. package/dist/cjs/dockview/components/titlebar/tabGroups.js +104 -54
  15. package/dist/cjs/dockview/components/titlebar/tabs.js +16 -23
  16. package/dist/cjs/dockview/components/titlebar/voidContainer.js +1 -1
  17. package/dist/cjs/dockview/dndCapabilities.js +3 -3
  18. package/dist/cjs/dockview/dockviewComponent.d.ts +5 -5
  19. package/dist/cjs/dockview/dockviewComponent.js +140 -122
  20. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -1
  21. package/dist/cjs/dockview/dockviewGroupPanelModel.js +19 -25
  22. package/dist/cjs/dockview/dockviewPanel.js +4 -5
  23. package/dist/cjs/dockview/dockviewShell.d.ts +29 -7
  24. package/dist/cjs/dockview/dockviewShell.js +94 -36
  25. package/dist/cjs/dockview/strictEventsSequencing.js +6 -6
  26. package/dist/cjs/dockview/tabGroup.js +3 -3
  27. package/dist/cjs/dockview/tabGroupAccent.js +1 -3
  28. package/dist/cjs/dom.js +1 -1
  29. package/dist/cjs/events.js +1 -1
  30. package/dist/cjs/gridview/baseComponentGridview.js +3 -8
  31. package/dist/cjs/gridview/branchNode.js +13 -17
  32. package/dist/cjs/gridview/gridview.js +8 -8
  33. package/dist/cjs/gridview/gridviewComponent.js +1 -6
  34. package/dist/cjs/overlay/overlay.js +25 -28
  35. package/dist/cjs/overlay/overlayRenderContainer.js +3 -4
  36. package/dist/cjs/paneview/draggablePaneviewPanel.js +1 -1
  37. package/dist/cjs/paneview/paneviewComponent.js +2 -6
  38. package/dist/cjs/popoutWindow.js +4 -4
  39. package/dist/cjs/scrollbar.d.ts +1 -1
  40. package/dist/cjs/scrollbar.js +7 -6
  41. package/dist/cjs/splitview/splitview.d.ts +1 -1
  42. package/dist/cjs/splitview/splitview.js +21 -20
  43. package/dist/cjs/splitview/viewItem.js +1 -1
  44. package/dist/dockview-core.js +413 -330
  45. package/dist/dockview-core.min.js +2 -2
  46. package/dist/dockview-core.min.js.map +1 -1
  47. package/dist/dockview-core.min.noStyle.js +2 -2
  48. package/dist/dockview-core.min.noStyle.js.map +1 -1
  49. package/dist/dockview-core.noStyle.js +412 -329
  50. package/dist/esm/api/dockviewGroupPanelApi.js +1 -1
  51. package/dist/esm/dnd/dropTargetAnchorContainer.js +1 -2
  52. package/dist/esm/dnd/pointer/longPress.js +1 -1
  53. package/dist/esm/dnd/pointer/pointerDragController.js +9 -7
  54. package/dist/esm/dnd/pointer/pointerDragSource.js +4 -2
  55. package/dist/esm/dockview/components/panel/content.js +6 -6
  56. package/dist/esm/dockview/components/popupService.js +1 -1
  57. package/dist/esm/dockview/components/tab/tab.js +2 -2
  58. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  59. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  60. package/dist/esm/dockview/components/titlebar/groupDragSource.js +1 -1
  61. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  62. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +27 -5
  63. package/dist/esm/dockview/components/titlebar/tabGroups.js +91 -42
  64. package/dist/esm/dockview/components/titlebar/tabs.js +17 -24
  65. package/dist/esm/dockview/components/titlebar/voidContainer.js +1 -1
  66. package/dist/esm/dockview/dndCapabilities.js +3 -3
  67. package/dist/esm/dockview/dockviewComponent.d.ts +5 -5
  68. package/dist/esm/dockview/dockviewComponent.js +61 -51
  69. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -1
  70. package/dist/esm/dockview/dockviewGroupPanelModel.js +19 -25
  71. package/dist/esm/dockview/dockviewPanel.js +1 -2
  72. package/dist/esm/dockview/dockviewShell.d.ts +29 -7
  73. package/dist/esm/dockview/dockviewShell.js +89 -37
  74. package/dist/esm/dockview/strictEventsSequencing.js +6 -6
  75. package/dist/esm/dockview/tabGroup.js +3 -3
  76. package/dist/esm/dockview/tabGroupAccent.js +1 -3
  77. package/dist/esm/dom.js +1 -1
  78. package/dist/esm/events.js +1 -1
  79. package/dist/esm/gridview/baseComponentGridview.js +3 -8
  80. package/dist/esm/gridview/branchNode.js +13 -15
  81. package/dist/esm/gridview/gridview.js +8 -8
  82. package/dist/esm/gridview/gridviewComponent.js +1 -6
  83. package/dist/esm/overlay/overlay.js +25 -28
  84. package/dist/esm/overlay/overlayRenderContainer.js +3 -4
  85. package/dist/esm/paneview/draggablePaneviewPanel.js +1 -1
  86. package/dist/esm/paneview/paneviewComponent.js +2 -6
  87. package/dist/esm/popoutWindow.js +4 -4
  88. package/dist/esm/scrollbar.d.ts +1 -1
  89. package/dist/esm/scrollbar.js +7 -6
  90. package/dist/esm/splitview/splitview.d.ts +1 -1
  91. package/dist/esm/splitview/splitview.js +21 -20
  92. package/dist/esm/splitview/viewItem.js +1 -1
  93. package/dist/package/main.cjs.js +412 -329
  94. package/dist/package/main.cjs.min.js +2 -2
  95. package/dist/package/main.esm.min.mjs +2 -2
  96. package/dist/package/main.esm.mjs +412 -329
  97. package/dist/styles/dockview.css +8 -8
  98. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 7.0.2
3
+ * @version 7.0.4
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -192,7 +192,7 @@
192
192
  class Stacktrace {
193
193
  static create() {
194
194
  var _a;
195
- return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
195
+ return new Stacktrace((_a = new Error('listener stacktrace').stack) !== null && _a !== void 0 ? _a : '');
196
196
  }
197
197
  constructor(value) {
198
198
  this.value = value;
@@ -441,7 +441,7 @@
441
441
  const onBlur = () => {
442
442
  if (hasFocus) {
443
443
  loosingFocus = true;
444
- window.setTimeout(() => {
444
+ globalThis.setTimeout(() => {
445
445
  if (loosingFocus) {
446
446
  loosingFocus = false;
447
447
  hasFocus = false;
@@ -819,7 +819,7 @@
819
819
  return this._cachedVisibleSize;
820
820
  }
821
821
  get visible() {
822
- return typeof this._cachedVisibleSize === 'undefined';
822
+ return this._cachedVisibleSize === undefined;
823
823
  }
824
824
  get minimumSize() {
825
825
  return this.visible ? this.view.minimumSize : 0;
@@ -1221,7 +1221,7 @@
1221
1221
  const viewItem = new ViewItem(container, view, viewSize, {
1222
1222
  dispose: () => {
1223
1223
  disposable.dispose();
1224
- this.viewContainer.removeChild(container);
1224
+ container.remove();
1225
1225
  },
1226
1226
  });
1227
1227
  if (index === this.viewItems.length) {
@@ -1297,29 +1297,30 @@
1297
1297
  this.distributeEmptySpace();
1298
1298
  this.layoutViews();
1299
1299
  };
1300
+ const doc = sash.ownerDocument;
1300
1301
  const end = () => {
1301
1302
  for (const item of this.viewItems) {
1302
1303
  item.enabled = true;
1303
1304
  }
1304
1305
  iframes.release();
1305
1306
  this.saveProportions();
1306
- document.removeEventListener('pointermove', onPointerMove);
1307
- document.removeEventListener('pointerup', end);
1308
- document.removeEventListener('pointercancel', end);
1309
- document.removeEventListener('contextmenu', end);
1307
+ doc.removeEventListener('pointermove', onPointerMove);
1308
+ doc.removeEventListener('pointerup', end);
1309
+ doc.removeEventListener('pointercancel', end);
1310
+ doc.removeEventListener('contextmenu', end);
1310
1311
  this._onDidSashEnd.fire(undefined);
1311
1312
  };
1312
- document.addEventListener('pointermove', onPointerMove);
1313
- document.addEventListener('pointerup', end);
1314
- document.addEventListener('pointercancel', end);
1315
- document.addEventListener('contextmenu', end);
1313
+ doc.addEventListener('pointermove', onPointerMove);
1314
+ doc.addEventListener('pointerup', end);
1315
+ doc.addEventListener('pointercancel', end);
1316
+ doc.addEventListener('contextmenu', end);
1316
1317
  };
1317
1318
  sash.addEventListener('pointerdown', onPointerStart);
1318
1319
  const sashItem = {
1319
1320
  container: sash,
1320
1321
  disposable: () => {
1321
1322
  sash.removeEventListener('pointerdown', onPointerStart);
1322
- this.sashContainer.removeChild(sash);
1323
+ sash.remove();
1323
1324
  },
1324
1325
  };
1325
1326
  this.sashContainer.appendChild(sash);
@@ -1366,7 +1367,7 @@
1366
1367
  if (!skipLayout) {
1367
1368
  this.relayout();
1368
1369
  }
1369
- if (sizing && sizing.type === 'distribute') {
1370
+ if ((sizing === null || sizing === void 0 ? void 0 : sizing.type) === 'distribute') {
1370
1371
  this.distributeViewSizes();
1371
1372
  }
1372
1373
  this._onDidRemoveView.fire(viewItem.view);
@@ -1381,7 +1382,7 @@
1381
1382
  }
1382
1383
  moveView(from, to) {
1383
1384
  const cachedVisibleSize = this.getViewCachedVisibleSize(from);
1384
- const sizing = typeof cachedVisibleSize === 'undefined'
1385
+ const sizing = cachedVisibleSize === undefined
1385
1386
  ? this.getViewSize(from)
1386
1387
  : exports.Sizing.Invisible(cachedVisibleSize);
1387
1388
  const view = this.removeView(from, undefined, true);
@@ -1391,13 +1392,7 @@
1391
1392
  const previousSize = Math.max(this.size, this._contentSize);
1392
1393
  this.size = size;
1393
1394
  this.orthogonalSize = orthogonalSize;
1394
- if (!this.proportions) {
1395
- const indexes = range(this.viewItems.length);
1396
- const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
1397
- const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
1398
- this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
1399
- }
1400
- else {
1395
+ if (this.proportions) {
1401
1396
  let total = 0;
1402
1397
  for (let i = 0; i < this.viewItems.length; i++) {
1403
1398
  const item = this.viewItems[i];
@@ -1417,6 +1412,12 @@
1417
1412
  }
1418
1413
  }
1419
1414
  }
1415
+ else {
1416
+ const indexes = range(this.viewItems.length);
1417
+ const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
1418
+ const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
1419
+ this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
1420
+ }
1420
1421
  this.distributeEmptySpace();
1421
1422
  this.layoutViews();
1422
1423
  }
@@ -1636,7 +1637,7 @@
1636
1637
  this._onDidRemoveView.dispose();
1637
1638
  for (let i = 0; i < this.element.children.length; i++) {
1638
1639
  if (this.element.children.item(i) === this.element) {
1639
- this.element.removeChild(this.element);
1640
+ this.element.remove();
1640
1641
  break;
1641
1642
  }
1642
1643
  }
@@ -1973,13 +1974,11 @@
1973
1974
  if (this.children.length === 0) {
1974
1975
  return exports.LayoutPriority.Normal;
1975
1976
  }
1976
- const priorities = this.children.map((c) => typeof c.priority === 'undefined'
1977
- ? exports.LayoutPriority.Normal
1978
- : c.priority);
1979
- if (priorities.some((p) => p === exports.LayoutPriority.High)) {
1977
+ const priorities = new Set(this.children.map((c) => { var _a; return (_a = c.priority) !== null && _a !== void 0 ? _a : exports.LayoutPriority.Normal; }));
1978
+ if (priorities.has(exports.LayoutPriority.High)) {
1980
1979
  return exports.LayoutPriority.High;
1981
1980
  }
1982
- else if (priorities.some((p) => p === exports.LayoutPriority.Low)) {
1981
+ else if (priorities.has(exports.LayoutPriority.Low)) {
1983
1982
  return exports.LayoutPriority.Low;
1984
1983
  }
1985
1984
  return exports.LayoutPriority.Normal;
@@ -2016,16 +2015,7 @@
2016
2015
  this._size = size;
2017
2016
  this.element = document.createElement('div');
2018
2017
  this.element.className = 'dv-branch-node';
2019
- if (!childDescriptors) {
2020
- this.splitview = new Splitview(this.element, {
2021
- orientation: this.orientation,
2022
- proportionalLayout,
2023
- styles,
2024
- margin,
2025
- });
2026
- this.splitview.layout(this.size, this.orthogonalSize);
2027
- }
2028
- else {
2018
+ if (childDescriptors) {
2029
2019
  const descriptor = {
2030
2020
  views: childDescriptors.map((childDescriptor) => {
2031
2021
  return {
@@ -2048,6 +2038,15 @@
2048
2038
  margin,
2049
2039
  });
2050
2040
  }
2041
+ else {
2042
+ this.splitview = new Splitview(this.element, {
2043
+ orientation: this.orientation,
2044
+ proportionalLayout,
2045
+ styles,
2046
+ margin,
2047
+ });
2048
+ this.splitview.layout(this.size, this.orthogonalSize);
2049
+ }
2051
2050
  this.disabled = disabled;
2052
2051
  this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
2053
2052
  this._onDidChange.fire({});
@@ -2545,7 +2544,7 @@
2545
2544
  if (oldRoot) {
2546
2545
  oldRoot.dispose();
2547
2546
  this._maximizedNode = undefined;
2548
- this.element.removeChild(oldRoot.element);
2547
+ oldRoot.element.remove();
2549
2548
  }
2550
2549
  this._root = root;
2551
2550
  this.element.appendChild(this._root.element);
@@ -2637,7 +2636,7 @@
2637
2636
  progmaticSelect(location, reverse = false) {
2638
2637
  const [path, node] = this.getNode(location);
2639
2638
  if (!(node instanceof LeafNode)) {
2640
- throw new Error('invalid location');
2639
+ throw new TypeError('invalid location');
2641
2640
  }
2642
2641
  for (let i = path.length - 1; i > -1; i--) {
2643
2642
  const n = path[i];
@@ -2674,7 +2673,7 @@
2674
2673
  const [rest, index] = tail(location);
2675
2674
  const [, parent] = this.getNode(rest);
2676
2675
  if (!(parent instanceof BranchNode)) {
2677
- throw new Error('Invalid from location');
2676
+ throw new TypeError('Invalid from location');
2678
2677
  }
2679
2678
  return parent.isChildVisible(index);
2680
2679
  }
@@ -2685,7 +2684,7 @@
2685
2684
  const [rest, index] = tail(location);
2686
2685
  const [, parent] = this.getNode(rest);
2687
2686
  if (!(parent instanceof BranchNode)) {
2688
- throw new Error('Invalid from location');
2687
+ throw new TypeError('Invalid from location');
2689
2688
  }
2690
2689
  this._onDidViewVisibilityChange.fire();
2691
2690
  parent.setChildVisible(index, visible);
@@ -2696,7 +2695,7 @@
2696
2695
  }
2697
2696
  const [, parent] = this.getNode(parentLocation);
2698
2697
  if (!(parent instanceof BranchNode)) {
2699
- throw new Error('Invalid location');
2698
+ throw new TypeError('Invalid location');
2700
2699
  }
2701
2700
  parent.moveChild(from, to);
2702
2701
  }
@@ -2742,11 +2741,11 @@
2742
2741
  const [rest, index] = tail(location);
2743
2742
  const [pathToParent, parent] = this.getNode(rest);
2744
2743
  if (!(parent instanceof BranchNode)) {
2745
- throw new Error('Invalid location');
2744
+ throw new TypeError('Invalid location');
2746
2745
  }
2747
2746
  const nodeToRemove = parent.children[index];
2748
2747
  if (!(nodeToRemove instanceof LeafNode)) {
2749
- throw new Error('Invalid location');
2748
+ throw new TypeError('Invalid location');
2750
2749
  }
2751
2750
  parent.removeChild(index, sizing);
2752
2751
  nodeToRemove.dispose();
@@ -2828,7 +2827,7 @@
2828
2827
  return [path, node];
2829
2828
  }
2830
2829
  if (!(node instanceof BranchNode)) {
2831
- throw new Error('Invalid location');
2830
+ throw new TypeError('Invalid location');
2832
2831
  }
2833
2832
  const [index, ...rest] = location;
2834
2833
  if (index < 0 || index >= node.children.length) {
@@ -3008,8 +3007,7 @@
3008
3007
  }), this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
3009
3008
  this.forceRelayout();
3010
3009
  }), exports.DockviewDisposable.from(() => {
3011
- var _a;
3012
- (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
3010
+ this.element.remove();
3013
3011
  }), this.gridview.onDidChange(() => {
3014
3012
  this._bufferOnDidLayoutChange.fire();
3015
3013
  }), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
@@ -3099,9 +3097,7 @@
3099
3097
  }
3100
3098
  moveToNext(options) {
3101
3099
  var _a;
3102
- if (!options) {
3103
- options = {};
3104
- }
3100
+ options !== null && options !== void 0 ? options : (options = {});
3105
3101
  if (!options.group) {
3106
3102
  if (!this.activeGroup) {
3107
3103
  return;
@@ -3114,9 +3110,7 @@
3114
3110
  }
3115
3111
  moveToPrevious(options) {
3116
3112
  var _a;
3117
- if (!options) {
3118
- options = {};
3119
- }
3113
+ options !== null && options !== void 0 ? options : (options = {});
3120
3114
  if (!options.group) {
3121
3115
  if (!this.activeGroup) {
3122
3116
  return;
@@ -4618,9 +4612,8 @@
4618
4612
  */
4619
4613
  class PointerDragController extends CompositeDisposable {
4620
4614
  static getInstance() {
4621
- if (!PointerDragController._instance) {
4622
- PointerDragController._instance = new PointerDragController();
4623
- }
4615
+ var _a;
4616
+ (_a = PointerDragController._instance) !== null && _a !== void 0 ? _a : (PointerDragController._instance = new PointerDragController());
4624
4617
  return PointerDragController._instance;
4625
4618
  }
4626
4619
  constructor() {
@@ -4685,21 +4678,24 @@
4685
4678
  this._onDragStart.fire(startEvent);
4686
4679
  // Source's owning window — popout drags fire on their own window,
4687
4680
  // not the main one.
4688
- const targetWindow = (_c = (_b = source.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) !== null && _c !== void 0 ? _c : window;
4681
+ const targetWindow = (_c = (_b = source.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) !== null && _c !== void 0 ? _c : globalThis.window;
4689
4682
  this._moveListener = addDisposableListener(targetWindow, 'pointermove', (e) => {
4690
- if (!this._active || e.pointerId !== this._active.pointerId) {
4683
+ var _a;
4684
+ if (e.pointerId !== ((_a = this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
4691
4685
  return;
4692
4686
  }
4693
4687
  this._handleMove(e);
4694
4688
  });
4695
4689
  this._upListener = addDisposableListener(targetWindow, 'pointerup', (e) => {
4696
- if (!this._active || e.pointerId !== this._active.pointerId) {
4690
+ var _a;
4691
+ if (e.pointerId !== ((_a = this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
4697
4692
  return;
4698
4693
  }
4699
4694
  this._handleEnd(e, true);
4700
4695
  });
4701
4696
  this._cancelListener = addDisposableListener(targetWindow, 'pointercancel', (e) => {
4702
- if (!this._active || e.pointerId !== this._active.pointerId) {
4697
+ var _a;
4698
+ if (e.pointerId !== ((_a = this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
4703
4699
  return;
4704
4700
  }
4705
4701
  this._handleEnd(e, false);
@@ -5039,7 +5035,9 @@
5039
5035
  ? initiationDelayOpt()
5040
5036
  : initiationDelayOpt)) !== null && _a !== void 0 ? _a : DEFAULT_TOUCH_INITIATION_DELAY;
5041
5037
  this._armed = !isTouch || initiationDelay <= 0;
5042
- if (isTouch && initiationDelay > 0 && isFinite(initiationDelay)) {
5038
+ if (isTouch &&
5039
+ initiationDelay > 0 &&
5040
+ Number.isFinite(initiationDelay)) {
5043
5041
  this._armTimer = setTimeout(() => {
5044
5042
  this._armTimer = undefined;
5045
5043
  this._armed = true;
@@ -5051,7 +5049,7 @@
5051
5049
  ? pressToleranceOpt()
5052
5050
  : pressToleranceOpt)) !== null && _c !== void 0 ? _c : DEFAULT_PRESS_TOLERANCE;
5053
5051
  // Source's owning window — popout drags fire on their own window.
5054
- const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;
5052
+ const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : globalThis.window;
5055
5053
  this._pendingMoveListener = addDisposableListener(targetWindow, 'pointermove', (moveEvent) => {
5056
5054
  if (moveEvent.pointerId !== this._pendingPointerId) {
5057
5055
  return;
@@ -5814,7 +5812,7 @@
5814
5812
  }
5815
5813
  onDrop(event) {
5816
5814
  const data = getPaneData();
5817
- if (!data || data.viewId !== this.accessor.id) {
5815
+ if ((data === null || data === void 0 ? void 0 : data.viewId) !== this.accessor.id) {
5818
5816
  // if there is no local drag event for this panel
5819
5817
  // or if the drag event was creating by another Paneview instance
5820
5818
  this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
@@ -5887,7 +5885,7 @@
5887
5885
  this.group.location.type !== 'floating') {
5888
5886
  return false;
5889
5887
  }
5890
- if (data && data.viewId === this.accessor.id) {
5888
+ if ((data === null || data === void 0 ? void 0 : data.viewId) === this.accessor.id) {
5891
5889
  return true;
5892
5890
  }
5893
5891
  return this.group.canDisplayOverlay(event, position, 'content');
@@ -5954,7 +5952,7 @@
5954
5952
  /**
5955
5953
  * If the currently attached panel is mounted directly to the content then remove it
5956
5954
  */
5957
- this._element.removeChild(this.panel.view.content.element);
5955
+ this.panel.view.content.element.remove();
5958
5956
  (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
5959
5957
  }
5960
5958
  this.panel = panel;
@@ -5972,7 +5970,7 @@
5972
5970
  break;
5973
5971
  case 'always':
5974
5972
  if (panel.view.content.element.parentElement === this._element) {
5975
- this._element.removeChild(panel.view.content.element);
5973
+ panel.view.content.element.remove();
5976
5974
  }
5977
5975
  container = this.group.renderContainer.attach({
5978
5976
  panel,
@@ -6000,11 +5998,11 @@
6000
5998
  // noop
6001
5999
  }
6002
6000
  closePanel() {
6003
- var _a, _b, _c;
6001
+ var _a, _b;
6004
6002
  if (this.panel) {
6005
6003
  if (this.panel.api.renderer === 'onlyWhenVisible') {
6006
- (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
6007
- (_c = (_b = this.panel.view.content).onHide) === null || _c === void 0 ? void 0 : _c.call(_b);
6004
+ this.panel.view.content.element.remove();
6005
+ (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
6008
6006
  }
6009
6007
  }
6010
6008
  this.panel = undefined;
@@ -6058,7 +6056,7 @@
6058
6056
  const delay = (_b = this.options.delay) !== null && _b !== void 0 ? _b : DEFAULT_DELAY;
6059
6057
  const tolerance = (_c = this.options.tolerance) !== null && _c !== void 0 ? _c : DEFAULT_TOLERANCE;
6060
6058
  // Source's owning window — popout drags fire on their own window.
6061
- const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;
6059
+ const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : globalThis.window;
6062
6060
  this._timer = setTimeout(() => {
6063
6061
  this._timer = undefined;
6064
6062
  this._cancelPending();
@@ -6177,14 +6175,14 @@
6177
6175
  }
6178
6176
  }
6179
6177
  function isCoarsePrimaryInput$1() {
6180
- if (typeof window === 'undefined' || !window.matchMedia) {
6178
+ if (globalThis.window === undefined || !globalThis.matchMedia) {
6181
6179
  return false;
6182
6180
  }
6183
6181
  // Coarse pointer without any fine pointer = phone-class device. A laptop
6184
6182
  // touchscreen reports both, and we want HTML5 to remain available there
6185
6183
  // because a real mouse is also plugged in.
6186
- const coarse = window.matchMedia('(pointer: coarse)').matches;
6187
- const fine = window.matchMedia('(pointer: fine)').matches;
6184
+ const coarse = globalThis.matchMedia('(pointer: coarse)').matches;
6185
+ const fine = globalThis.matchMedia('(pointer: fine)').matches;
6188
6186
  return coarse && !fine;
6189
6187
  }
6190
6188
 
@@ -6238,7 +6236,7 @@
6238
6236
  return false;
6239
6237
  }
6240
6238
  const data = getPanelData();
6241
- if (data && this.accessor.id === data.viewId) {
6239
+ if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
6242
6240
  // Smooth-reorder takes over the in-flight visual when active,
6243
6241
  // so individual tab overlays are suppressed for internal drags.
6244
6242
  if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
@@ -6339,7 +6337,7 @@
6339
6337
  }
6340
6338
  setContent(part) {
6341
6339
  if (this.content) {
6342
- this._element.removeChild(this.content.element);
6340
+ this.content.element.remove();
6343
6341
  }
6344
6342
  this.content = part;
6345
6343
  this._element.appendChild(this.content.element);
@@ -6497,7 +6495,7 @@
6497
6495
  this.addDisposables(this._onDragStart);
6498
6496
  const buildMultiPanelsGhost = () => {
6499
6497
  const ghostEl = document.createElement('div');
6500
- const style = window.getComputedStyle(this._element);
6498
+ const style = globalThis.getComputedStyle(this._element);
6501
6499
  const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
6502
6500
  const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
6503
6501
  ghostEl.style.backgroundColor = bgColor;
@@ -6679,7 +6677,7 @@
6679
6677
  return false;
6680
6678
  }
6681
6679
  const data = getPanelData();
6682
- if (data && this.accessor.id === data.viewId) {
6680
+ if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
6683
6681
  return true;
6684
6682
  }
6685
6683
  return group.model.canDisplayOverlay(event, position, 'header_space');
@@ -6774,15 +6772,16 @@
6774
6772
  this._scrollOffset = originalScrollOffset + delta / p;
6775
6773
  this.calculateScrollbarStyles();
6776
6774
  };
6775
+ const doc = this.element.ownerDocument;
6777
6776
  const onEnd = () => {
6778
6777
  toggleClass(this.element, 'dv-scrollable-scrolling', false);
6779
- document.removeEventListener('pointermove', onPointerMove);
6780
- document.removeEventListener('pointerup', onEnd);
6781
- document.removeEventListener('pointercancel', onEnd);
6778
+ doc.removeEventListener('pointermove', onPointerMove);
6779
+ doc.removeEventListener('pointerup', onEnd);
6780
+ doc.removeEventListener('pointercancel', onEnd);
6782
6781
  };
6783
- document.addEventListener('pointermove', onPointerMove);
6784
- document.addEventListener('pointerup', onEnd);
6785
- document.addEventListener('pointercancel', onEnd);
6782
+ doc.addEventListener('pointermove', onPointerMove);
6783
+ doc.addEventListener('pointerup', onEnd);
6784
+ doc.addEventListener('pointercancel', onEnd);
6786
6785
  }), addDisposableListener(this.element, 'scroll', () => {
6787
6786
  this.calculateScrollbarStyles();
6788
6787
  }), addDisposableListener(this.scrollableElement, 'scroll', () => {
@@ -6942,9 +6941,7 @@
6942
6941
  * palette through.
6943
6942
  */
6944
6943
  function getFallbackPalette() {
6945
- if (!_fallbackPalette) {
6946
- _fallbackPalette = new TabGroupColorPalette(DEFAULT_TAB_GROUP_COLORS, true);
6947
- }
6944
+ _fallbackPalette !== null && _fallbackPalette !== void 0 ? _fallbackPalette : (_fallbackPalette = new TabGroupColorPalette(DEFAULT_TAB_GROUP_COLORS, true));
6948
6945
  return _fallbackPalette;
6949
6946
  }
6950
6947
  /**
@@ -7186,8 +7183,7 @@
7186
7183
  const isAnimating = tg.collapsed ||
7187
7184
  tg.panelIds.some((pid) => {
7188
7185
  const te = tabMap.get(pid);
7189
- return (te &&
7190
- te.value.element.classList.contains('dv-tab--group-expanding'));
7186
+ return te === null || te === void 0 ? void 0 : te.value.element.classList.contains('dv-tab--group-expanding');
7191
7187
  });
7192
7188
  if (isAnimating && chipEl) {
7193
7189
  const chipRect = chipEl.getBoundingClientRect();
@@ -7284,7 +7280,10 @@
7284
7280
  // Ensure SVG + path child exists (created once, reused)
7285
7281
  let svg = underline.firstElementChild;
7286
7282
  let path;
7287
- if (!svg || svg.tagName !== 'svg') {
7283
+ if ((svg === null || svg === void 0 ? void 0 : svg.tagName) === 'svg') {
7284
+ path = svg.firstElementChild;
7285
+ }
7286
+ else {
7288
7287
  underline.replaceChildren();
7289
7288
  svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
7290
7289
  svg.style.display = 'block';
@@ -7293,9 +7292,6 @@
7293
7292
  svg.appendChild(path);
7294
7293
  underline.appendChild(svg);
7295
7294
  }
7296
- else {
7297
- path = svg.firstElementChild;
7298
- }
7299
7295
  path.setAttribute('stroke', color);
7300
7296
  path.setAttribute('stroke-width', String(t));
7301
7297
  if (!activeTabEntry) {
@@ -7432,6 +7428,7 @@
7432
7428
  * in the parent group model. Call after any tab group mutation.
7433
7429
  */
7434
7430
  update() {
7431
+ var _a;
7435
7432
  const model = this._ctx.group.model;
7436
7433
  const tabGroups = model.getTabGroups();
7437
7434
  // Track which group IDs are still active
@@ -7446,6 +7443,7 @@
7446
7443
  if (!activeGroupIds.has(groupId)) {
7447
7444
  entry.chip.element.remove();
7448
7445
  entry.chip.dispose();
7446
+ (_a = entry.dragSourcesDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
7449
7447
  entry.disposable.dispose();
7450
7448
  this._chipRenderers.delete(groupId);
7451
7449
  }
@@ -7574,12 +7572,13 @@
7574
7572
  this._pendingTransitionCleanups.delete(panelId);
7575
7573
  }
7576
7574
  updateDragAndDropState() {
7575
+ var _a, _b, _c;
7577
7576
  const caps = resolveDndCapabilities(this._ctx.accessor.options);
7578
7577
  for (const entry of this._chipRenderers.values()) {
7579
7578
  entry.chip.element.draggable = caps.html5;
7580
- entry.html5DragSource.setDisabled(!caps.html5);
7581
- entry.pointerDragSource.setDisabled(!caps.pointer);
7582
- entry.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
7579
+ (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.setDisabled(!caps.html5);
7580
+ (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.setDisabled(!caps.pointer);
7581
+ (_c = entry.pointerDragSource) === null || _c === void 0 ? void 0 : _c.setTouchOnly(!caps.pointerHandlesMouse);
7583
7582
  }
7584
7583
  }
7585
7584
  /**
@@ -7588,19 +7587,28 @@
7588
7587
  * iframe shield are released BEFORE the cross-group move detaches
7589
7588
  * the chip (chip dispose is scheduled on a microtask via
7590
7589
  * `_scheduleTabGroupUpdate`, which is too late for callers that read
7591
- * `getPanelData()` synchronously after the move). Idempotent — the
7592
- * subsequent `update()` will also dispose the sources.
7590
+ * `getPanelData()` synchronously after the move).
7591
+ *
7592
+ * A cross-group move dissolves the source chip entirely, but a
7593
+ * within-group reorder keeps the same chip element — so the sources are
7594
+ * cleared to `undefined` here and the subsequent `update()` re-arms them
7595
+ * via `_ensureChipForGroup`. Without that re-arm the chip would fire a
7596
+ * native `dragstart` (the element keeps `draggable=true`) but never set
7597
+ * a transfer payload, leaving the group permanently undraggable after
7598
+ * its first move. (#1410)
7593
7599
  */
7594
7600
  disposeChipDrag(tabGroupId) {
7595
- var _a, _b;
7601
+ var _a;
7596
7602
  const entry = this._chipRenderers.get(tabGroupId);
7597
7603
  if (!entry) {
7598
7604
  return;
7599
7605
  }
7600
7606
  // Optional-chained because tests may inject minimal entries
7601
7607
  // that skip the manager's normal `_ensureChipForGroup` flow.
7602
- (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.dispose();
7603
- (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.dispose();
7608
+ (_a = entry.dragSourcesDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
7609
+ entry.html5DragSource = undefined;
7610
+ entry.pointerDragSource = undefined;
7611
+ entry.dragSourcesDisposable = undefined;
7604
7612
  }
7605
7613
  /** Cloned chip rect used as the pointer follow-finger ghost. */
7606
7614
  _buildChipGhostElement(chipEl) {
@@ -7613,7 +7621,7 @@
7613
7621
  return clone;
7614
7622
  }
7615
7623
  disposeAll() {
7616
- var _a;
7624
+ var _a, _b;
7617
7625
  (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.dispose();
7618
7626
  this._indicator = null;
7619
7627
  for (const [, cleanup] of this._pendingTransitionCleanups) {
@@ -7623,12 +7631,13 @@
7623
7631
  for (const [, entry] of this._chipRenderers) {
7624
7632
  entry.chip.element.remove();
7625
7633
  entry.chip.dispose();
7634
+ (_b = entry.dragSourcesDisposable) === null || _b === void 0 ? void 0 : _b.dispose();
7626
7635
  entry.disposable.dispose();
7627
7636
  }
7628
7637
  this._chipRenderers.clear();
7629
7638
  }
7630
7639
  _ensureIndicator() {
7631
- var _a, _b;
7640
+ var _a, _b, _c;
7632
7641
  const mode = (_b = (_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabGroupIndicator) !== null && _b !== void 0 ? _b : 'wrap';
7633
7642
  const Ctor = mode === 'none' ? NoneTabGroupIndicator : WrapTabGroupIndicator;
7634
7643
  // Re-create if the indicator type changed (e.g. theme switch)
@@ -7636,28 +7645,24 @@
7636
7645
  this._indicator.dispose();
7637
7646
  this._indicator = null;
7638
7647
  }
7639
- if (!this._indicator) {
7640
- this._indicator = new Ctor({
7641
- tabsList: this._ctx.tabsList,
7642
- getTabGroups: () => this._ctx.group.model.getTabGroups(),
7643
- getActivePanelId: () => { var _a; return (_a = this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
7644
- getTabMap: () => this._ctx.getTabMap(),
7645
- getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
7646
- getDirection: () => this._ctx.getDirection(),
7647
- getHeaderPosition: () => this._ctx.group.model.headerPosition,
7648
- getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,
7649
- });
7650
- }
7648
+ (_c = this._indicator) !== null && _c !== void 0 ? _c : (this._indicator = new Ctor({
7649
+ tabsList: this._ctx.tabsList,
7650
+ getTabGroups: () => this._ctx.group.model.getTabGroups(),
7651
+ getActivePanelId: () => { var _a; return (_a = this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
7652
+ getTabMap: () => this._ctx.getTabMap(),
7653
+ getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
7654
+ getDirection: () => this._ctx.getDirection(),
7655
+ getHeaderPosition: () => this._ctx.group.model.headerPosition,
7656
+ getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,
7657
+ }));
7651
7658
  }
7652
- _ensureChipForGroup(tabGroup) {
7653
- if (this._chipRenderers.has(tabGroup.id)) {
7654
- return;
7655
- }
7656
- const createChip = this._ctx.accessor.options.createTabGroupChipComponent;
7657
- const chip = createChip
7658
- ? createChip(tabGroup)
7659
- : new TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
7660
- chip.init({ tabGroup, api: this._ctx.accessor.api });
7659
+ /**
7660
+ * Create the HTML5 + pointer drag sources for a chip (and the direct
7661
+ * dragend listener that clears the transfer synchronously). Extracted so
7662
+ * both the initial chip build and the post-move re-arm in
7663
+ * `_ensureChipForGroup` share one wiring path. (#1410)
7664
+ */
7665
+ _createChipDragSources(chip, tabGroup) {
7661
7666
  const caps = resolveDndCapabilities(this._ctx.accessor.options);
7662
7667
  chip.element.draggable = caps.html5;
7663
7668
  const panelTransfer = LocalSelectionTransfer.getInstance();
@@ -7709,9 +7714,12 @@
7709
7714
  // the listener survives chip disposal in the detach-then-dragend
7710
7715
  // cross-group path; `once: true` auto-removes after the single
7711
7716
  // dragend that we care about. (#1254)
7712
- chip.element.addEventListener('dragend', () => {
7717
+ const onDragEndClear = () => {
7713
7718
  panelTransfer.clearData(PanelTransfer.prototype);
7714
- }, { once: true });
7719
+ };
7720
+ chip.element.addEventListener('dragend', onDragEndClear, {
7721
+ once: true,
7722
+ });
7715
7723
  const pointerDragSource = pointerBackend.createDragSource(chip.element, {
7716
7724
  getData,
7717
7725
  disabled: !caps.pointer,
@@ -7726,6 +7734,41 @@
7726
7734
  this._callbacks.onChipDragStart(tabGroup, chip, event);
7727
7735
  },
7728
7736
  });
7737
+ return {
7738
+ html5DragSource,
7739
+ pointerDragSource,
7740
+ disposable: {
7741
+ dispose: () => {
7742
+ html5DragSource.dispose();
7743
+ pointerDragSource.dispose();
7744
+ chip.element.removeEventListener('dragend', onDragEndClear);
7745
+ },
7746
+ },
7747
+ };
7748
+ }
7749
+ _ensureChipForGroup(tabGroup) {
7750
+ const existing = this._chipRenderers.get(tabGroup.id);
7751
+ if (existing) {
7752
+ // A committed group move tears down the chip's drag sources via
7753
+ // `disposeChipDrag`, but a within-group reorder keeps the same
7754
+ // chip element alive. Re-arm the sources so the group stays
7755
+ // draggable; without this the chip is stuck after its first
7756
+ // move — `dragstart` still fires (the element keeps
7757
+ // `draggable=true`) but no transfer payload is set. (#1410)
7758
+ if (!existing.html5DragSource) {
7759
+ const sources = this._createChipDragSources(existing.chip, tabGroup);
7760
+ existing.html5DragSource = sources.html5DragSource;
7761
+ existing.pointerDragSource = sources.pointerDragSource;
7762
+ existing.dragSourcesDisposable = sources.disposable;
7763
+ }
7764
+ return;
7765
+ }
7766
+ const createChip = this._ctx.accessor.options.createTabGroupChipComponent;
7767
+ const chip = createChip
7768
+ ? createChip(tabGroup)
7769
+ : new TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
7770
+ chip.init({ tabGroup, api: this._ctx.accessor.api });
7771
+ const dragSources = this._createChipDragSources(chip, tabGroup);
7729
7772
  const disposables = [
7730
7773
  tabGroup.onDidChange(() => {
7731
7774
  var _a;
@@ -7739,17 +7782,19 @@
7739
7782
  tabGroup.onDidCollapseChange(() => {
7740
7783
  this._updateTabGroupClasses();
7741
7784
  }),
7742
- html5DragSource,
7743
- pointerDragSource,
7744
7785
  ];
7745
7786
  // Context menu: built-in TabGroupChip already aggregates right-click
7746
7787
  // + touch long-press into `onContextMenu`. Custom chip renderers
7747
7788
  // don't, so attach a long-press detector and contextmenu listener
7748
7789
  // directly on their element.
7749
7790
  const onContextMenu = (event) => {
7791
+ var _a, _b;
7750
7792
  // A long-press on a chip should preempt the in-flight pointer
7751
- // drag and open the menu instead.
7752
- pointerDragSource.cancelPending();
7793
+ // drag and open the menu instead. Resolve the source from the
7794
+ // entry so a post-move re-armed source is cancelled, not the
7795
+ // stale one captured at build time. (#1410)
7796
+ (_b = (_a = this._chipRenderers
7797
+ .get(tabGroup.id)) === null || _a === void 0 ? void 0 : _a.pointerDragSource) === null || _b === void 0 ? void 0 : _b.cancelPending();
7753
7798
  this._callbacks.onChipContextMenu(tabGroup, event);
7754
7799
  };
7755
7800
  if (chip instanceof TabGroupChip) {
@@ -7782,7 +7827,7 @@
7782
7827
  return false;
7783
7828
  }
7784
7829
  const data = getPanelData();
7785
- if (data && this._ctx.accessor.id === data.viewId) {
7830
+ if (this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
7786
7831
  if (((_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) ===
7787
7832
  'smooth') {
7788
7833
  return false;
@@ -7798,8 +7843,9 @@
7798
7843
  const disposable = new CompositeDisposable(...disposables);
7799
7844
  this._chipRenderers.set(tabGroup.id, {
7800
7845
  chip,
7801
- html5DragSource,
7802
- pointerDragSource,
7846
+ html5DragSource: dragSources.html5DragSource,
7847
+ pointerDragSource: dragSources.pointerDragSource,
7848
+ dragSourcesDisposable: dragSources.disposable,
7803
7849
  disposable,
7804
7850
  dropTarget,
7805
7851
  });
@@ -8403,12 +8449,10 @@
8403
8449
  parentElement.scrollTop = running;
8404
8450
  }
8405
8451
  }
8406
- else {
8407
- if (running < parentElement.scrollLeft ||
8408
- running + element.clientWidth >
8409
- parentElement.scrollLeft + parentElement.clientWidth) {
8410
- parentElement.scrollLeft = running;
8411
- }
8452
+ else if (running < parentElement.scrollLeft ||
8453
+ running + element.clientWidth >
8454
+ parentElement.scrollLeft + parentElement.clientWidth) {
8455
+ parentElement.scrollLeft = running;
8412
8456
  }
8413
8457
  }
8414
8458
  running += isVertical
@@ -8520,15 +8564,13 @@
8520
8564
  });
8521
8565
  return;
8522
8566
  }
8523
- switch (event.button) {
8524
- case 0:
8525
- if (this.group.api.location.type === 'edge') ;
8526
- else {
8527
- if (this.group.activePanel !== panel) {
8528
- this.group.model.openPanel(panel);
8529
- }
8530
- }
8531
- break;
8567
+ // Edge groups are skipped here: all their tab interaction
8568
+ // is handled by onTabClick to avoid race conditions with
8569
+ // active panel state.
8570
+ if (event.button === 0 &&
8571
+ this.group.api.location.type !== 'edge' &&
8572
+ this.group.activePanel !== panel) {
8573
+ this.group.model.openPanel(panel);
8532
8574
  }
8533
8575
  }), tab.onDrop((event) => {
8534
8576
  var _a, _b, _c, _d;
@@ -8551,12 +8593,12 @@
8551
8593
  targetTabGroupId: animState.targetTabGroupId,
8552
8594
  });
8553
8595
  if (((_b = this.accessor.options.theme) === null || _b === void 0 ? void 0 : _b.tabAnimation) === 'smooth') {
8554
- this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, animState.sourceIndex !== -1
8555
- ? {
8596
+ this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, animState.sourceIndex === -1
8597
+ ? undefined
8598
+ : {
8556
8599
  from: Math.min(animState.sourceIndex, dropIndex),
8557
8600
  to: Math.max(animState.sourceIndex, dropIndex),
8558
- }
8559
- : undefined);
8601
+ });
8560
8602
  }
8561
8603
  }
8562
8604
  else {
@@ -8806,7 +8848,7 @@
8806
8848
  return;
8807
8849
  }
8808
8850
  const data = getPanelData();
8809
- const sourceIndex = data && data.groupId === this.group.id && data.panelId
8851
+ const sourceIndex = (data === null || data === void 0 ? void 0 : data.groupId) === this.group.id && (data === null || data === void 0 ? void 0 : data.panelId)
8810
8852
  ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId)
8811
8853
  : -1;
8812
8854
  const adjustedIndex = insertionIndex -
@@ -10164,9 +10206,9 @@
10164
10206
  if (this._panelIds.includes(panelId)) {
10165
10207
  return;
10166
10208
  }
10167
- const insertIndex = index !== undefined
10168
- ? Math.max(0, Math.min(index, this._panelIds.length))
10169
- : this._panelIds.length;
10209
+ const insertIndex = index === undefined
10210
+ ? this._panelIds.length
10211
+ : Math.max(0, Math.min(index, this._panelIds.length));
10170
10212
  this._panelIds.splice(insertIndex, 0, panelId);
10171
10213
  this._onDidPanelChange.fire({ panelId, type: 'add' });
10172
10214
  }
@@ -10614,7 +10656,7 @@
10614
10656
  }
10615
10657
  // Remove from any existing group first
10616
10658
  const existingGroup = this.getTabGroupForPanel(panelId);
10617
- if (existingGroup && existingGroup.id === tabGroupId) {
10659
+ if ((existingGroup === null || existingGroup === void 0 ? void 0 : existingGroup.id) === tabGroupId) {
10618
10660
  return; // already in this group — no mutation
10619
10661
  }
10620
10662
  this._bracketTabGroupMutation(() => {
@@ -10635,7 +10677,7 @@
10635
10677
  */
10636
10678
  movePanelWithinGroup(tabGroupId, panelId, newIndex) {
10637
10679
  const tabGroup = this._tabGroupMap.get(tabGroupId);
10638
- if (!tabGroup || !tabGroup.containsPanel(panelId)) {
10680
+ if (!(tabGroup === null || tabGroup === void 0 ? void 0 : tabGroup.containsPanel(panelId))) {
10639
10681
  return;
10640
10682
  }
10641
10683
  // Remove and re-add at new index within the group
@@ -10848,7 +10890,7 @@
10848
10890
  for (let i = activePanelIndex + 1; i < this._panels.length; i++) {
10849
10891
  const candidate = this._panels[i];
10850
10892
  const candidateGroup = this._findTabGroupForPanel(candidate.id);
10851
- if (!candidateGroup || !candidateGroup.collapsed) {
10893
+ if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
10852
10894
  this.doSetActivePanel(candidate);
10853
10895
  this.updateContainer();
10854
10896
  return;
@@ -10857,7 +10899,7 @@
10857
10899
  for (let i = activePanelIndex - 1; i >= 0; i--) {
10858
10900
  const candidate = this._panels[i];
10859
10901
  const candidateGroup = this._findTabGroupForPanel(candidate.id);
10860
- if (!candidateGroup || !candidateGroup.collapsed) {
10902
+ if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
10861
10903
  this.doSetActivePanel(candidate);
10862
10904
  this.updateContainer();
10863
10905
  return;
@@ -10887,9 +10929,9 @@
10887
10929
  restoreTabGroups(serializedGroups) {
10888
10930
  // Bump counter past any restored numeric suffixes to avoid ID collisions
10889
10931
  for (const data of serializedGroups) {
10890
- const match = data.id.match(/-(\d+)$/);
10932
+ const match = /-(\d+)$/.exec(data.id);
10891
10933
  if (match) {
10892
- const num = parseInt(match[1], 10) + 1;
10934
+ const num = Number.parseInt(match[1], 10) + 1;
10893
10935
  if (num > this._tabGroupIdCounter) {
10894
10936
  this._tabGroupIdCounter = num;
10895
10937
  }
@@ -11006,32 +11048,26 @@
11006
11048
  return result;
11007
11049
  }
11008
11050
  moveToNext(options) {
11009
- if (!options) {
11010
- options = {};
11011
- }
11012
- if (!options.panel) {
11013
- options.panel = this.activePanel;
11014
- }
11051
+ var _a;
11052
+ options !== null && options !== void 0 ? options : (options = {});
11053
+ (_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
11015
11054
  const index = options.panel ? this.panels.indexOf(options.panel) : -1;
11016
11055
  let normalizedIndex;
11017
11056
  if (index < this.panels.length - 1) {
11018
11057
  normalizedIndex = index + 1;
11019
11058
  }
11020
- else if (!options.suppressRoll) {
11021
- normalizedIndex = 0;
11059
+ else if (options.suppressRoll) {
11060
+ return;
11022
11061
  }
11023
11062
  else {
11024
- return;
11063
+ normalizedIndex = 0;
11025
11064
  }
11026
11065
  this.openPanel(this.panels[normalizedIndex]);
11027
11066
  }
11028
11067
  moveToPrevious(options) {
11029
- if (!options) {
11030
- options = {};
11031
- }
11032
- if (!options.panel) {
11033
- options.panel = this.activePanel;
11034
- }
11068
+ var _a;
11069
+ options !== null && options !== void 0 ? options : (options = {});
11070
+ (_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
11035
11071
  if (!options.panel) {
11036
11072
  return;
11037
11073
  }
@@ -11040,11 +11076,11 @@
11040
11076
  if (index > 0) {
11041
11077
  normalizedIndex = index - 1;
11042
11078
  }
11043
- else if (!options.suppressRoll) {
11044
- normalizedIndex = this.panels.length - 1;
11079
+ else if (options.suppressRoll) {
11080
+ return;
11045
11081
  }
11046
11082
  else {
11047
- return;
11083
+ normalizedIndex = this.panels.length - 1;
11048
11084
  }
11049
11085
  this.openPanel(this.panels[normalizedIndex]);
11050
11086
  }
@@ -11144,7 +11180,7 @@
11144
11180
  if (!this._activePanel && this.panels.length > 0) {
11145
11181
  const candidate = this._panels.find((p) => {
11146
11182
  const tg = this._findTabGroupForPanel(p.id);
11147
- return !tg || !tg.collapsed;
11183
+ return !(tg === null || tg === void 0 ? void 0 : tg.collapsed);
11148
11184
  });
11149
11185
  if (candidate) {
11150
11186
  this.doSetActivePanel(candidate);
@@ -11683,7 +11719,7 @@
11683
11719
  getWindow() {
11684
11720
  return this.location.type === 'popout'
11685
11721
  ? this.location.getWindow()
11686
- : window;
11722
+ : globalThis.window;
11687
11723
  }
11688
11724
  setHeaderPosition(position) {
11689
11725
  if (!this._group) {
@@ -12266,9 +12302,8 @@
12266
12302
  }
12267
12303
  }
12268
12304
  update(event) {
12269
- var _a;
12270
12305
  // merge the new parameters with the existing parameters
12271
- this._params = Object.assign(Object.assign({}, ((_a = this._params) !== null && _a !== void 0 ? _a : {})), event.params);
12306
+ this._params = Object.assign(Object.assign({}, this._params), event.params);
12272
12307
  /**
12273
12308
  * delete new keys that have a value of undefined,
12274
12309
  * allow values of null
@@ -12665,19 +12700,19 @@
12665
12700
  const element = this._element.getBoundingClientRect();
12666
12701
  const result = {};
12667
12702
  if (this.verticalAlignment === 'top') {
12668
- result.top = parseFloat(this._element.style.top);
12703
+ result.top = Number.parseFloat(this._element.style.top);
12669
12704
  }
12670
12705
  else if (this.verticalAlignment === 'bottom') {
12671
- result.bottom = parseFloat(this._element.style.bottom);
12706
+ result.bottom = Number.parseFloat(this._element.style.bottom);
12672
12707
  }
12673
12708
  else {
12674
12709
  result.top = element.top - container.top;
12675
12710
  }
12676
12711
  if (this.horiziontalAlignment === 'left') {
12677
- result.left = parseFloat(this._element.style.left);
12712
+ result.left = Number.parseFloat(this._element.style.left);
12678
12713
  }
12679
12714
  else if (this.horiziontalAlignment === 'right') {
12680
- result.right = parseFloat(this._element.style.right);
12715
+ result.right = Number.parseFloat(this._element.style.right);
12681
12716
  }
12682
12717
  else {
12683
12718
  result.left = element.left - container.left;
@@ -12741,7 +12776,7 @@
12741
12776
  }
12742
12777
  }
12743
12778
  },
12744
- }, addDisposableListener(window, 'pointermove', (e) => {
12779
+ }, addDisposableListener(globalThis.window, 'pointermove', (e) => {
12745
12780
  if (this._dragCancelled) {
12746
12781
  return;
12747
12782
  }
@@ -12750,12 +12785,10 @@
12750
12785
  const y = e.clientY - containerRect.top;
12751
12786
  toggleClass(this._element, 'dv-resize-container-dragging', true);
12752
12787
  const overlayRect = this._element.getBoundingClientRect();
12753
- if (offset === null) {
12754
- offset = {
12755
- x: e.clientX - overlayRect.left,
12756
- y: e.clientY - overlayRect.top,
12757
- };
12758
- }
12788
+ offset !== null && offset !== void 0 ? offset : (offset = {
12789
+ x: e.clientX - overlayRect.left,
12790
+ y: e.clientY - overlayRect.top,
12791
+ });
12759
12792
  const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
12760
12793
  const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
12761
12794
  let proposedTop = y - offset.y;
@@ -12807,7 +12840,7 @@
12807
12840
  hasMoved = true;
12808
12841
  this._onDidStartMoving.fire();
12809
12842
  }
12810
- }), addDisposableListener(window, 'pointerup', end), addDisposableListener(window, 'pointercancel', end));
12843
+ }), addDisposableListener(globalThis.window, 'pointerup', end), addDisposableListener(globalThis.window, 'pointercancel', end));
12811
12844
  };
12812
12845
  this.addDisposables(addDisposableListener(dragTarget, 'pointerdown', (event) => {
12813
12846
  if (event.defaultPrevented) {
@@ -12861,20 +12894,18 @@
12861
12894
  move.dispose();
12862
12895
  this._onDidChangeEnd.fire();
12863
12896
  };
12864
- move.value = new CompositeDisposable(addDisposableListener(window, 'pointermove', (e) => {
12897
+ move.value = new CompositeDisposable(addDisposableListener(globalThis.window, 'pointermove', (e) => {
12865
12898
  const containerRect = this.options.container.getBoundingClientRect();
12866
12899
  const overlayRect = this._element.getBoundingClientRect();
12867
12900
  const y = e.clientY - containerRect.top;
12868
12901
  const x = e.clientX - containerRect.left;
12869
- if (startPosition === null) {
12870
- // record the initial dimensions since as all subsequence moves are relative to this
12871
- startPosition = {
12872
- originalY: y,
12873
- originalHeight: overlayRect.height,
12874
- originalX: x,
12875
- originalWidth: overlayRect.width,
12876
- };
12877
- }
12902
+ // record the initial dimensions since as all subsequence moves are relative to this
12903
+ startPosition !== null && startPosition !== void 0 ? startPosition : (startPosition = {
12904
+ originalY: y,
12905
+ originalHeight: overlayRect.height,
12906
+ originalX: x,
12907
+ originalWidth: overlayRect.width,
12908
+ });
12878
12909
  let top = undefined;
12879
12910
  let bottom = undefined;
12880
12911
  let height = undefined;
@@ -12889,7 +12920,8 @@
12889
12920
  ? Math.max(0, containerRect.height -
12890
12921
  Overlay.MINIMUM_HEIGHT)
12891
12922
  : Math.max(0, startPosition.originalY +
12892
- startPosition.originalHeight -
12923
+ startPosition
12924
+ .originalHeight -
12893
12925
  Overlay.MINIMUM_HEIGHT);
12894
12926
  top = clamp(y, 0, maxTop);
12895
12927
  height =
@@ -12904,8 +12936,8 @@
12904
12936
  startPosition.originalHeight;
12905
12937
  // When dragging bottom handle, constrain height to container height
12906
12938
  const minHeight = top < 0 &&
12907
- typeof this.options.minimumInViewportHeight ===
12908
- 'number'
12939
+ typeof this.options
12940
+ .minimumInViewportHeight === 'number'
12909
12941
  ? -top +
12910
12942
  this.options.minimumInViewportHeight
12911
12943
  : Overlay.MINIMUM_HEIGHT;
@@ -12935,8 +12967,8 @@
12935
12967
  startPosition.originalWidth;
12936
12968
  // When dragging right handle, constrain width to container width
12937
12969
  const minWidth = left < 0 &&
12938
- typeof this.options.minimumInViewportWidth ===
12939
- 'number'
12970
+ typeof this.options
12971
+ .minimumInViewportWidth === 'number'
12940
12972
  ? -left +
12941
12973
  this.options.minimumInViewportWidth
12942
12974
  : Overlay.MINIMUM_WIDTH;
@@ -13005,7 +13037,7 @@
13005
13037
  }
13006
13038
  }
13007
13039
  },
13008
- }, addDisposableListener(window, 'pointerup', end), addDisposableListener(window, 'pointercancel', end));
13040
+ }, addDisposableListener(globalThis.window, 'pointerup', end), addDisposableListener(globalThis.window, 'pointercancel', end));
13009
13041
  }));
13010
13042
  }
13011
13043
  getMinimumWidth(width) {
@@ -14119,7 +14151,7 @@
14119
14151
  }
14120
14152
  getPosition(element) {
14121
14153
  const cached = this.cache.get(element);
14122
- if (cached && cached.frameId === this.currentFrameId) {
14154
+ if ((cached === null || cached === void 0 ? void 0 : cached.frameId) === this.currentFrameId) {
14123
14155
  return cached.rect;
14124
14156
  }
14125
14157
  this.scheduleFrameUpdate();
@@ -14331,11 +14363,10 @@
14331
14363
  correctLayerPosition();
14332
14364
  }));
14333
14365
  this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
14334
- var _a;
14335
14366
  if (contentElement.parentElement === focusContainer) {
14336
- focusContainer.removeChild(contentElement);
14367
+ contentElement.remove();
14337
14368
  }
14338
- (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
14369
+ focusContainer.remove();
14339
14370
  });
14340
14371
  correctLayerPosition();
14341
14372
  queueMicrotask(() => {
@@ -14400,13 +14431,13 @@
14400
14431
  function assertSameOriginPopoutUrl(url) {
14401
14432
  let resolved;
14402
14433
  try {
14403
- resolved = new URL(url, window.location.href);
14434
+ resolved = new URL(url, globalThis.location.href);
14404
14435
  }
14405
14436
  catch (_a) {
14406
14437
  throw new Error(`dockview: invalid popout URL: ${url}`);
14407
14438
  }
14408
14439
  const protocolOk = resolved.protocol === 'http:' || resolved.protocol === 'https:';
14409
- if (!protocolOk || resolved.origin !== window.location.origin) {
14440
+ if (!protocolOk || resolved.origin !== globalThis.location.origin) {
14410
14441
  throw new Error(`dockview: popout URL must be same-origin http(s); got: ${url}`);
14411
14442
  }
14412
14443
  }
@@ -14484,7 +14515,7 @@
14484
14515
  this._window = { value: externalWindow, disposable };
14485
14516
  disposable.addDisposables(exports.DockviewDisposable.from(() => {
14486
14517
  externalWindow.close();
14487
- }), addDisposableListener(window, 'beforeunload', () => {
14518
+ }), addDisposableListener(globalThis.window, 'beforeunload', () => {
14488
14519
  /**
14489
14520
  * before the main window closes we should close this popup too
14490
14521
  * to be good citizens
@@ -14514,7 +14545,7 @@
14514
14545
  const externalDocument = externalWindow.document;
14515
14546
  externalDocument.title = document.title;
14516
14547
  externalDocument.body.appendChild(container);
14517
- addStyles(externalDocument, window.document.styleSheets, {
14548
+ addStyles(externalDocument, globalThis.document.styleSheets, {
14518
14549
  nonce: this.options.nonce,
14519
14550
  });
14520
14551
  /**
@@ -14567,11 +14598,11 @@
14567
14598
  panels.add(panel.api.id);
14568
14599
  }
14569
14600
  }), this.accessor.onDidRemovePanel((panel) => {
14570
- if (!panels.has(panel.api.id)) {
14571
- throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);
14601
+ if (panels.has(panel.api.id)) {
14602
+ panels.delete(panel.api.id);
14572
14603
  }
14573
14604
  else {
14574
- panels.delete(panel.api.id);
14605
+ throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);
14575
14606
  }
14576
14607
  }), this.accessor.onDidAddGroup((group) => {
14577
14608
  if (groups.has(group.api.id)) {
@@ -14581,11 +14612,11 @@
14581
14612
  groups.add(group.api.id);
14582
14613
  }
14583
14614
  }), this.accessor.onDidRemoveGroup((group) => {
14584
- if (!groups.has(group.api.id)) {
14585
- throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);
14615
+ if (groups.has(group.api.id)) {
14616
+ groups.delete(group.api.id);
14586
14617
  }
14587
14618
  else {
14588
- groups.delete(group.api.id);
14619
+ throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);
14589
14620
  }
14590
14621
  }));
14591
14622
  }
@@ -14600,7 +14631,7 @@
14600
14631
  return coarse && !fine;
14601
14632
  }
14602
14633
  class PopupService extends CompositeDisposable {
14603
- constructor(root, win = window) {
14634
+ constructor(root, win = globalThis.window) {
14604
14635
  super();
14605
14636
  this._active = null;
14606
14637
  this._activeDisposable = new MutableDisposable();
@@ -14717,9 +14748,8 @@
14717
14748
  }
14718
14749
  return {
14719
14750
  clear: () => {
14720
- var _a;
14721
14751
  if (this._model) {
14722
- (_a = this._model.root.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._model.root);
14752
+ this._model.root.remove();
14723
14753
  }
14724
14754
  this._model = undefined;
14725
14755
  },
@@ -14772,16 +14802,30 @@
14772
14802
  }
14773
14803
 
14774
14804
  class EdgeGroupView {
14805
+ /**
14806
+ * The effective (pre-gap) collapsed size: the measured tab-strip size when
14807
+ * available, otherwise the configured/theme base.
14808
+ */
14809
+ get _effectiveBaseCollapsed() {
14810
+ var _a;
14811
+ return (_a = this._measuredTabSize) !== null && _a !== void 0 ? _a : this._baseCollapsedSize;
14812
+ }
14775
14813
  get minimumSize() {
14776
14814
  // When collapsed, lock size to collapsedSize so sash can't drag it open
14777
- return this._isCollapsed
14778
- ? this._collapsedSize
14779
- : this._expandedMinimumSize;
14815
+ if (this._isCollapsed) {
14816
+ return this.collapsedSize;
14817
+ }
14818
+ // If the caller explicitly provides a minimumSize, respect it.
14819
+ // Otherwise fall back to collapsedSize + 50 so the expanded state is
14820
+ // visually distinguishable from the collapsed state.
14821
+ return this._baseMinimumSize !== undefined
14822
+ ? this._baseMinimumSize + this._gapAdd
14823
+ : this._effectiveBaseCollapsed + 50 + this._gapAdd;
14780
14824
  }
14781
14825
  get maximumSize() {
14782
14826
  // When collapsed, lock size to collapsedSize so sash can't drag it open
14783
14827
  return this._isCollapsed
14784
- ? this._collapsedSize
14828
+ ? this.collapsedSize
14785
14829
  : this._expandedMaximumSize;
14786
14830
  }
14787
14831
  get element() {
@@ -14794,34 +14838,62 @@
14794
14838
  return this._lastExpandedSize;
14795
14839
  }
14796
14840
  get collapsedSize() {
14797
- return this._collapsedSize;
14841
+ return this._effectiveBaseCollapsed + this._gapAdd;
14798
14842
  }
14799
- constructor(options, group, orientation) {
14843
+ constructor(options, group, orientation, gapAdd = 0) {
14800
14844
  var _a, _b, _c;
14801
14845
  this._onDidChange = new Emitter();
14802
14846
  this.onDidChange = this._onDidChange.event;
14803
14847
  this.snap = false;
14804
14848
  this.priority = exports.LayoutPriority.Low;
14805
14849
  this._isCollapsed = false;
14850
+ this._tabSizeDisposables = new CompositeDisposable();
14806
14851
  this._group = group;
14807
14852
  this._orientation = orientation;
14808
14853
  group.element.classList.add('dv-edge-group');
14809
14854
  group.element.dataset.testid = `dv-edge-group-${options.id}`;
14810
- this._collapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
14855
+ this._baseCollapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
14856
+ this._baseMinimumSize = options.minimumSize;
14857
+ this._gapAdd = gapAdd;
14811
14858
  this._expandedMaximumSize =
14812
14859
  (_b = options.maximumSize) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;
14813
- // If the caller explicitly provides a minimumSize, respect it.
14814
- // Otherwise fall back to collapsedSize + 50 so the expanded state is
14815
- // visually distinguishable from the collapsed state.
14816
- this._expandedMinimumSize =
14817
- options.minimumSize !== undefined
14818
- ? options.minimumSize
14819
- : this._collapsedSize + 50;
14820
14860
  this._lastExpandedSize = (_c = options.initialSize) !== null && _c !== void 0 ? _c : 200;
14821
14861
  if (options.collapsed) {
14822
14862
  this._isCollapsed = true;
14823
14863
  group.element.classList.add('dv-edge-collapsed');
14824
14864
  }
14865
+ this._observeTabStrip();
14866
+ }
14867
+ /**
14868
+ * Watch the group's tab strip so the collapsed size follows the live tab
14869
+ * height. The strip's cross-axis size (height for top/bottom, width for
14870
+ * left/right) is exactly what a collapsed edge group should occupy; a
14871
+ * ResizeObserver keeps them in sync when the tab height changes at runtime.
14872
+ */
14873
+ _observeTabStrip() {
14874
+ const strip = this._group.element.querySelector('.dv-tabs-and-actions-container');
14875
+ if (!strip) {
14876
+ return;
14877
+ }
14878
+ this._tabSizeDisposables.addDisposables(watchElementResize(strip, () => {
14879
+ this._applyMeasuredTabSize(this._orientation === 'vertical'
14880
+ ? strip.offsetHeight
14881
+ : strip.offsetWidth);
14882
+ }));
14883
+ }
14884
+ /**
14885
+ * Apply a freshly-measured tab-strip cross size. When the group is
14886
+ * collapsed this resizes it in the parent splitview so the collapsed strip
14887
+ * always shows the full tab height.
14888
+ */
14889
+ _applyMeasuredTabSize(size) {
14890
+ if (size <= 0 || size === this._measuredTabSize) {
14891
+ return;
14892
+ }
14893
+ this._measuredTabSize = size;
14894
+ if (this._isCollapsed) {
14895
+ this._onDidChange.fire({ size: this.collapsedSize });
14896
+ }
14825
14897
  }
14826
14898
  layout(size, orthogonalSize) {
14827
14899
  // Track the last expanded size so we can restore it after collapsing
@@ -14857,15 +14929,18 @@
14857
14929
  this._lastExpandedSize = size;
14858
14930
  }
14859
14931
  /**
14860
- * Apply new effective collapsed and expanded-minimum sizes after a theme
14861
- * or gap change. The caller (ShellManager) is responsible for computing
14862
- * the correct values from the original config and the new gap.
14932
+ * Apply a new base (pre-gap) collapsed size, base minimum size and gap
14933
+ * contribution after a theme or gap change. Base values come from the
14934
+ * original config; the ShellManager owns the gap arithmetic. A live
14935
+ * measured tab size (if any) continues to win over the base collapsed size.
14863
14936
  */
14864
- updateCollapsedSize(newCollapsedSize, newExpandedMinimumSize) {
14865
- this._collapsedSize = newCollapsedSize;
14866
- this._expandedMinimumSize = newExpandedMinimumSize;
14937
+ updateSizing(baseCollapsedSize, baseMinimumSize, gapAdd) {
14938
+ this._baseCollapsedSize = baseCollapsedSize;
14939
+ this._baseMinimumSize = baseMinimumSize;
14940
+ this._gapAdd = gapAdd;
14867
14941
  }
14868
14942
  dispose() {
14943
+ this._tabSizeDisposables.dispose();
14869
14944
  this._onDidChange.dispose();
14870
14945
  }
14871
14946
  }
@@ -14997,15 +15072,6 @@
14997
15072
  this._splitview.dispose();
14998
15073
  }
14999
15074
  }
15000
- function adjustedOpts(base, defaultCollapsed, gapAdd) {
15001
- var _a;
15002
- const effectiveCollapsed = ((_a = base.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsed) + gapAdd;
15003
- const result = Object.assign(Object.assign({}, base), { collapsedSize: effectiveCollapsed });
15004
- if (base.minimumSize !== undefined) {
15005
- result.minimumSize = base.minimumSize + gapAdd;
15006
- }
15007
- return result;
15008
- }
15009
15075
  class ShellManager {
15010
15076
  constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
15011
15077
  this._disposables = new CompositeDisposable();
@@ -15031,6 +15097,26 @@
15031
15097
  this._middleIndex = 0;
15032
15098
  this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
15033
15099
  this._disposables.addDisposables(watchElementResize(this._shellElement, (entry) => {
15100
+ /**
15101
+ * When the shell (or an ancestor) becomes hidden — e.g. a
15102
+ * nested dockview whose `onlyWhenVisible` host panel is
15103
+ * deactivated — the element collapses to (0, 0) or is detached
15104
+ * from the DOM. Propagating that zero size would relayout the
15105
+ * edge-group splitview at 0, clamping the low-priority edge
15106
+ * groups down to their minimum size and destroying the user's
15107
+ * sizing. Skip these cases so sizes are preserved while hidden;
15108
+ * mirrors the guard in the `Resizable` base class. See #1495.
15109
+ *
15110
+ * offsetParent === null is equivalent to display: none on the
15111
+ * element or one of its ancestors.
15112
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
15113
+ */
15114
+ if (!this._shellElement.offsetParent) {
15115
+ return;
15116
+ }
15117
+ if (!isInDocument(this._shellElement)) {
15118
+ return;
15119
+ }
15034
15120
  const width = Math.round(entry.contentRect.width);
15035
15121
  const height = Math.round(entry.contentRect.height);
15036
15122
  if (width === this._currentWidth &&
@@ -15067,7 +15153,7 @@
15067
15153
  const isHorizontal = position === 'left' || position === 'right';
15068
15154
  const gapAdd = isHorizontal ? outerGapAdd : innerGapAdd;
15069
15155
  const orientation = isHorizontal ? 'horizontal' : 'vertical';
15070
- const view = new EdgeGroupView(adjustedOpts(Object.assign({ collapsedSize: this._defaultCollapsedSize }, options), this._defaultCollapsedSize, gapAdd), group, orientation);
15156
+ const view = new EdgeGroupView(Object.assign({ collapsedSize: this._defaultCollapsedSize }, options), group, orientation, gapAdd);
15071
15157
  const initialSize = view.isCollapsed
15072
15158
  ? view.collapsedSize
15073
15159
  : view.lastExpandedSize;
@@ -15134,10 +15220,7 @@
15134
15220
  const updateView = (view, baseCfg, gapAdd) => {
15135
15221
  var _a;
15136
15222
  const baseCS = (_a = baseCfg.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsedSize;
15137
- const newCS = baseCS + gapAdd;
15138
- const baseMS = baseCfg.minimumSize;
15139
- const newMS = baseMS !== undefined ? baseMS + gapAdd : newCS + 50;
15140
- view.updateCollapsedSize(newCS, newMS);
15223
+ view.updateSizing(baseCS, baseCfg.minimumSize, gapAdd);
15141
15224
  };
15142
15225
  const topCfg = this._viewConfigs.get('top');
15143
15226
  if (this._topView && topCfg) {
@@ -15388,9 +15471,8 @@
15388
15471
  }
15389
15472
  }
15390
15473
  dispose() {
15391
- var _a;
15392
15474
  this._disposables.dispose();
15393
- (_a = this._shellElement.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._shellElement);
15475
+ this._shellElement.remove();
15394
15476
  }
15395
15477
  }
15396
15478
 
@@ -15427,9 +15509,9 @@
15427
15509
  * `process` is undefined.
15428
15510
  */
15429
15511
  function warnIfUsingCoreDirectly() {
15512
+ var _a;
15430
15513
  if (typeof process !== 'undefined' &&
15431
- process.env &&
15432
- process.env.NODE_ENV === 'production') {
15514
+ ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'production') {
15433
15515
  return;
15434
15516
  }
15435
15517
  if (_hasWarnedUsingCoreDirectly || isDockviewPackageLoaded()) {
@@ -15820,7 +15902,7 @@
15820
15902
  // The shell always wraps the dockview element so edge groups can be
15821
15903
  // added at any time via addEdgeGroup() without re-parenting the DOM.
15822
15904
  this.disableResizing = true;
15823
- container.removeChild(this.element);
15905
+ this.element.remove();
15824
15906
  this._shellManager = new ShellManager(container, this.element, (w, h) => this._layoutFromShell(w, h), (_d = (_c = options.theme) === null || _c === void 0 ? void 0 : _c.gap) !== null && _d !== void 0 ? _d : 0, (_e = options.theme) === null || _e === void 0 ? void 0 : _e.edgeGroupCollapsedSize);
15825
15907
  // The shell wraps the dockview element, so move the popup anchor
15826
15908
  // into the shell so overflow dropdowns in edge groups position correctly
@@ -16042,15 +16124,13 @@
16042
16124
  return _window
16043
16125
  .open()
16044
16126
  .then((popoutContainer) => {
16045
- var _a, _b, _c;
16127
+ var _a, _b, _c, _d;
16046
16128
  if (_window.isDisposed) {
16047
16129
  return false;
16048
16130
  }
16049
- const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
16050
- ? options.referenceGroup
16051
- : itemToPopout instanceof DockviewPanel
16052
- ? itemToPopout.group
16053
- : itemToPopout;
16131
+ const referenceGroup = (_a = options === null || options === void 0 ? void 0 : options.referenceGroup) !== null && _a !== void 0 ? _a : (itemToPopout instanceof DockviewPanel
16132
+ ? itemToPopout.group
16133
+ : itemToPopout);
16054
16134
  const referenceLocation = itemToPopout.api.location.type;
16055
16135
  /**
16056
16136
  * The group that is being added doesn't already exist within the DOM, the most likely occurrence
@@ -16061,7 +16141,7 @@
16061
16141
  if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {
16062
16142
  // Restoring a multi-group window: the anchor group is
16063
16143
  // already built inside the supplied gridview.
16064
- group = (_a = options.overridePopoutGroup) !== null && _a !== void 0 ? _a : referenceGroup;
16144
+ group = (_b = options.overridePopoutGroup) !== null && _b !== void 0 ? _b : referenceGroup;
16065
16145
  }
16066
16146
  else if (!isGroupAddedToDom) {
16067
16147
  group = referenceGroup;
@@ -16092,7 +16172,7 @@
16092
16172
  // a nested splitview layout. The window starts with the single
16093
16173
  // anchor group; further groups arrive via drag-and-drop. On
16094
16174
  // restore a pre-populated gridview is supplied instead.
16095
- const popoutGridview = (_b = options === null || options === void 0 ? void 0 : options.overridePopoutGridview) !== null && _b !== void 0 ? _b : this.createNestedGridview();
16175
+ const popoutGridview = (_c = options === null || options === void 0 ? void 0 : options.overridePopoutGridview) !== null && _c !== void 0 ? _c : this.createNestedGridview();
16096
16176
  if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGridview)) {
16097
16177
  popoutGridview.addView(group, exports.Sizing.Distribute, [0]);
16098
16178
  }
@@ -16133,9 +16213,9 @@
16133
16213
  break;
16134
16214
  case 'floating':
16135
16215
  case 'popout':
16136
- floatingBox = (_c = this.floatingGroups
16216
+ floatingBox = (_d = this.floatingGroups
16137
16217
  .find((value) => value.group.api.id ===
16138
- itemToPopout.api.id)) === null || _c === void 0 ? void 0 : _c.overlay.toJSON();
16218
+ itemToPopout.api.id)) === null || _d === void 0 ? void 0 : _d.overlay.toJSON();
16139
16219
  this.removeGroup(referenceGroup);
16140
16220
  break;
16141
16221
  }
@@ -16976,7 +17056,7 @@
16976
17056
  const createGroupFromSerializedState = (data) => {
16977
17057
  const { id, locked, hideHeader, headerPosition, views, activeView, } = data;
16978
17058
  if (typeof id !== 'string') {
16979
- throw new Error('dockview: group id must be of type string');
17059
+ throw new TypeError('dockview: group id must be of type string');
16980
17060
  }
16981
17061
  const group = this.createGroup({
16982
17062
  id,
@@ -17150,8 +17230,7 @@
17150
17230
  createdPanels.push(panel);
17151
17231
  }
17152
17232
  }
17153
- for (let i = 0; i < createdPanels.length; i++) {
17154
- const panel = createdPanels[i];
17233
+ for (const panel of createdPanels) {
17155
17234
  const isActive = activeView === panel.id;
17156
17235
  edgeGroup.model.openPanel(panel, {
17157
17236
  skipSetActive: !isActive,
@@ -17296,8 +17375,8 @@
17296
17375
  return this.mutation('add', () => this._doAddPanel(options));
17297
17376
  }
17298
17377
  _doAddPanel(options) {
17299
- var _a, _b;
17300
- if (this.panels.find((_) => _.id === options.id)) {
17378
+ var _a, _b, _c, _d;
17379
+ if (this.panels.some((_) => _.id === options.id)) {
17301
17380
  throw new Error(`dockview: panel with id ${options.id} already exists`);
17302
17381
  }
17303
17382
  let referenceGroup;
@@ -17316,18 +17395,24 @@
17316
17395
  : options.position.referencePanel;
17317
17396
  index = options.position.index;
17318
17397
  if (!referencePanel) {
17319
- throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
17398
+ const referenceId = typeof options.position.referencePanel === 'string'
17399
+ ? options.position.referencePanel
17400
+ : (_a = options.position.referencePanel) === null || _a === void 0 ? void 0 : _a.id;
17401
+ throw new Error(`dockview: referencePanel '${referenceId}' does not exist`);
17320
17402
  }
17321
17403
  referenceGroup = this.findGroup(referencePanel);
17322
17404
  }
17323
17405
  else if (isPanelOptionsWithGroup(options.position)) {
17324
17406
  referenceGroup =
17325
17407
  typeof options.position.referenceGroup === 'string'
17326
- ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
17408
+ ? (_b = this._groups.get(options.position.referenceGroup)) === null || _b === void 0 ? void 0 : _b.value
17327
17409
  : options.position.referenceGroup;
17328
17410
  index = options.position.index;
17329
17411
  if (!referenceGroup) {
17330
- throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
17412
+ const referenceId = typeof options.position.referenceGroup === 'string'
17413
+ ? options.position.referenceGroup
17414
+ : (_c = options.position.referenceGroup) === null || _c === void 0 ? void 0 : _c.id;
17415
+ throw new Error(`dockview: referenceGroup '${referenceId}' does not exist`);
17331
17416
  }
17332
17417
  }
17333
17418
  else {
@@ -17353,7 +17438,7 @@
17353
17438
  }
17354
17439
  let panel;
17355
17440
  if (referenceGroup) {
17356
- const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
17441
+ const target = toTarget(((_d = options.position) === null || _d === void 0 ? void 0 : _d.direction) || 'within');
17357
17442
  if (options.floating) {
17358
17443
  const group = this.createGroup();
17359
17444
  this._onDidAddGroup.fire(group);
@@ -17435,14 +17520,17 @@
17435
17520
  }
17436
17521
  return panel;
17437
17522
  }
17438
- removePanel(panel, options = {
17439
- removeEmptyGroup: true,
17440
- }) {
17441
- this.mutation('remove', () => this._doRemovePanel(panel, options));
17523
+ removePanel(panel, options) {
17524
+ this.mutation('remove', () => {
17525
+ var _a;
17526
+ return this._doRemovePanel(panel, {
17527
+ removeEmptyGroup: (_a = options === null || options === void 0 ? void 0 : options.removeEmptyGroup) !== null && _a !== void 0 ? _a : true,
17528
+ skipDispose: options === null || options === void 0 ? void 0 : options.skipDispose,
17529
+ skipSetActiveGroup: options === null || options === void 0 ? void 0 : options.skipSetActiveGroup,
17530
+ });
17531
+ });
17442
17532
  }
17443
- _doRemovePanel(panel, options = {
17444
- removeEmptyGroup: true,
17445
- }) {
17533
+ _doRemovePanel(panel, options) {
17446
17534
  const group = panel.group;
17447
17535
  if (!group) {
17448
17536
  throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
@@ -17468,28 +17556,34 @@
17468
17556
  return this.mutation('add', () => this._doAddGroup(options));
17469
17557
  }
17470
17558
  _doAddGroup(options) {
17471
- var _a;
17559
+ var _a, _b, _c;
17472
17560
  if (options) {
17473
17561
  let referenceGroup;
17474
17562
  if (isGroupOptionsWithPanel(options)) {
17475
17563
  const referencePanel = typeof options.referencePanel === 'string'
17476
17564
  ? this.panels.find((panel) => panel.id === options.referencePanel)
17477
17565
  : options.referencePanel;
17566
+ const referencePanelId = typeof options.referencePanel === 'string'
17567
+ ? options.referencePanel
17568
+ : (_a = options.referencePanel) === null || _a === void 0 ? void 0 : _a.id;
17478
17569
  if (!referencePanel) {
17479
- throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
17570
+ throw new Error(`dockview: reference panel ${referencePanelId} does not exist`);
17480
17571
  }
17481
17572
  referenceGroup = this.findGroup(referencePanel);
17482
17573
  if (!referenceGroup) {
17483
- throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
17574
+ throw new Error(`dockview: reference group for reference panel ${referencePanelId} does not exist`);
17484
17575
  }
17485
17576
  }
17486
17577
  else if (isGroupOptionsWithGroup(options)) {
17487
17578
  referenceGroup =
17488
17579
  typeof options.referenceGroup === 'string'
17489
- ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
17580
+ ? (_b = this._groups.get(options.referenceGroup)) === null || _b === void 0 ? void 0 : _b.value
17490
17581
  : options.referenceGroup;
17491
17582
  if (!referenceGroup) {
17492
- throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
17583
+ const referenceId = typeof options.referenceGroup === 'string'
17584
+ ? options.referenceGroup
17585
+ : (_c = options.referenceGroup) === null || _c === void 0 ? void 0 : _c.id;
17586
+ throw new Error(`dockview: reference group ${referenceId} does not exist`);
17493
17587
  }
17494
17588
  }
17495
17589
  else {
@@ -17612,14 +17706,14 @@
17612
17706
  if (this.detachFromNestedWindow(group)) {
17613
17707
  // The floating window hosts other groups and stays alive —
17614
17708
  // finalize just this group.
17615
- if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
17616
- this.disposeGroupRecord(group);
17617
- }
17618
- else {
17709
+ if (options === null || options === void 0 ? void 0 : options.skipDispose) {
17619
17710
  // Relocation: reset location so the destination root can
17620
17711
  // re-tag it.
17621
17712
  group.model.location = { type: 'grid' };
17622
17713
  }
17714
+ else {
17715
+ this.disposeGroupRecord(group);
17716
+ }
17623
17717
  this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);
17624
17718
  return group;
17625
17719
  }
@@ -17640,14 +17734,14 @@
17640
17734
  if (this.detachFromNestedWindow(group)) {
17641
17735
  // The popout window hosts other groups and stays alive —
17642
17736
  // finalize just this group.
17643
- if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
17644
- this.disposeGroupRecord(group);
17645
- }
17646
- else {
17737
+ if (options === null || options === void 0 ? void 0 : options.skipDispose) {
17647
17738
  // Relocation: reset location so the destination root can
17648
17739
  // re-tag it.
17649
17740
  group.model.location = { type: 'grid' };
17650
17741
  }
17742
+ else {
17743
+ this.disposeGroupRecord(group);
17744
+ }
17651
17745
  this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);
17652
17746
  return group;
17653
17747
  }
@@ -17657,7 +17751,7 @@
17657
17751
  const refGroup = selectedGroup.referenceGroup
17658
17752
  ? this.getPanel(selectedGroup.referenceGroup)
17659
17753
  : undefined;
17660
- if (refGroup && refGroup.panels.length === 0) {
17754
+ if ((refGroup === null || refGroup === void 0 ? void 0 : refGroup.panels.length) === 0) {
17661
17755
  this.removeGroup(refGroup);
17662
17756
  }
17663
17757
  }
@@ -18333,9 +18427,7 @@
18333
18427
  return id;
18334
18428
  }
18335
18429
  createGroup(options) {
18336
- if (!options) {
18337
- options = {};
18338
- }
18430
+ options !== null && options !== void 0 ? options : (options = {});
18339
18431
  let id = options === null || options === void 0 ? void 0 : options.id;
18340
18432
  if (id && this._groups.has(options.id)) {
18341
18433
  console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
@@ -18531,13 +18623,13 @@
18531
18623
  entry.gridview.margin = gap;
18532
18624
  }
18533
18625
  (_f = this._shellManager) === null || _f === void 0 ? void 0 : _f.updateTheme(gap, (_g = theme.edgeGroupCollapsedSize) !== null && _g !== void 0 ? _g : 35);
18534
- if (theme.dndOverlayBorder !== undefined) {
18535
- this.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
18536
- (_h = this._shellManager) === null || _h === void 0 ? void 0 : _h.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
18626
+ if (theme.dndOverlayBorder === undefined) {
18627
+ this.element.style.removeProperty('--dv-drag-over-border');
18628
+ (_h = this._shellManager) === null || _h === void 0 ? void 0 : _h.element.style.removeProperty('--dv-drag-over-border');
18537
18629
  }
18538
18630
  else {
18539
- this.element.style.removeProperty('--dv-drag-over-border');
18540
- (_j = this._shellManager) === null || _j === void 0 ? void 0 : _j.element.style.removeProperty('--dv-drag-over-border');
18631
+ this.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
18632
+ (_j = this._shellManager) === null || _j === void 0 ? void 0 : _j.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
18541
18633
  }
18542
18634
  switch (theme.dndOverlayMounting) {
18543
18635
  case 'absolute':
@@ -18779,12 +18871,7 @@
18779
18871
  }
18780
18872
  this._groups.forEach((groupItem) => {
18781
18873
  const group = groupItem.value;
18782
- if (group !== panel) {
18783
- group.setActive(false);
18784
- }
18785
- else {
18786
- group.setActive(true);
18787
- }
18874
+ group.setActive(group === panel);
18788
18875
  });
18789
18876
  }));
18790
18877
  this._groups.set(panel.id, {
@@ -19277,9 +19364,7 @@
19277
19364
  name: options.headerComponent,
19278
19365
  });
19279
19366
  }
19280
- if (!header) {
19281
- header = new DefaultHeader();
19282
- }
19367
+ header !== null && header !== void 0 ? header : (header = new DefaultHeader());
19283
19368
  const view = new PaneFramework({
19284
19369
  id: options.id,
19285
19370
  component: options.component,
@@ -19378,9 +19463,7 @@
19378
19463
  name: data.headerComponent,
19379
19464
  });
19380
19465
  }
19381
- if (!header) {
19382
- header = new DefaultHeader();
19383
- }
19466
+ header !== null && header !== void 0 ? header : (header = new DefaultHeader());
19384
19467
  const panel = new PaneFramework({
19385
19468
  id: data.id,
19386
19469
  component: data.component,