dockview-core 4.11.0 → 4.13.0

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 (67) hide show
  1. package/dist/cjs/api/component.api.d.ts +5 -3
  2. package/dist/cjs/api/component.api.js +2 -2
  3. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +3 -1
  4. package/dist/cjs/api/dockviewGroupPanelApi.js +24 -1
  5. package/dist/cjs/dockview/components/panel/content.d.ts +7 -0
  6. package/dist/cjs/dockview/components/panel/content.js +11 -0
  7. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +2 -2
  8. package/dist/cjs/dockview/components/titlebar/tabs.js +1 -1
  9. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +3 -3
  10. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +1 -1
  11. package/dist/cjs/dockview/dockviewComponent.d.ts +10 -4
  12. package/dist/cjs/dockview/dockviewComponent.js +167 -85
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +2 -2
  14. package/dist/cjs/dockview/dockviewGroupPanelModel.js +4 -1
  15. package/dist/cjs/dockview/dockviewPanel.d.ts +6 -4
  16. package/dist/cjs/dockview/dockviewPanel.js +12 -0
  17. package/dist/cjs/dockview/events.d.ts +4 -4
  18. package/dist/cjs/dockview/events.js +14 -14
  19. package/dist/cjs/index.d.ts +2 -1
  20. package/dist/cjs/index.js +7 -2
  21. package/dist/cjs/overlay/overlay.js +25 -14
  22. package/dist/cjs/splitview/splitview.js +2 -0
  23. package/dist/dockview-core.amd.js +172 -54
  24. package/dist/dockview-core.amd.js.map +1 -1
  25. package/dist/dockview-core.amd.min.js +2 -2
  26. package/dist/dockview-core.amd.min.js.map +1 -1
  27. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  28. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  29. package/dist/dockview-core.amd.noStyle.js +172 -54
  30. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  31. package/dist/dockview-core.cjs.js +172 -54
  32. package/dist/dockview-core.cjs.js.map +1 -1
  33. package/dist/dockview-core.esm.js +172 -55
  34. package/dist/dockview-core.esm.js.map +1 -1
  35. package/dist/dockview-core.esm.min.js +2 -2
  36. package/dist/dockview-core.esm.min.js.map +1 -1
  37. package/dist/dockview-core.js +172 -54
  38. package/dist/dockview-core.js.map +1 -1
  39. package/dist/dockview-core.min.js +2 -2
  40. package/dist/dockview-core.min.js.map +1 -1
  41. package/dist/dockview-core.min.noStyle.js +2 -2
  42. package/dist/dockview-core.min.noStyle.js.map +1 -1
  43. package/dist/dockview-core.noStyle.js +172 -54
  44. package/dist/dockview-core.noStyle.js.map +1 -1
  45. package/dist/esm/api/component.api.d.ts +5 -3
  46. package/dist/esm/api/component.api.js +2 -2
  47. package/dist/esm/api/dockviewGroupPanelApi.d.ts +3 -1
  48. package/dist/esm/api/dockviewGroupPanelApi.js +13 -1
  49. package/dist/esm/dockview/components/panel/content.d.ts +7 -0
  50. package/dist/esm/dockview/components/panel/content.js +11 -0
  51. package/dist/esm/dockview/components/titlebar/tabs.d.ts +2 -2
  52. package/dist/esm/dockview/components/titlebar/tabs.js +2 -2
  53. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +3 -3
  54. package/dist/esm/dockview/components/titlebar/tabsContainer.js +2 -2
  55. package/dist/esm/dockview/dockviewComponent.d.ts +10 -4
  56. package/dist/esm/dockview/dockviewComponent.js +99 -33
  57. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +2 -2
  58. package/dist/esm/dockview/dockviewGroupPanelModel.js +5 -2
  59. package/dist/esm/dockview/dockviewPanel.d.ts +6 -4
  60. package/dist/esm/dockview/dockviewPanel.js +12 -0
  61. package/dist/esm/dockview/events.d.ts +4 -4
  62. package/dist/esm/dockview/events.js +1 -1
  63. package/dist/esm/index.d.ts +2 -1
  64. package/dist/esm/index.js +2 -1
  65. package/dist/esm/overlay/overlay.js +26 -15
  66. package/dist/esm/splitview/splitview.js +2 -0
  67. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.11.0
3
+ * @version 4.13.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1298,11 +1298,13 @@
1298
1298
  document.removeEventListener('pointermove', onPointerMove);
1299
1299
  document.removeEventListener('pointerup', end);
1300
1300
  document.removeEventListener('pointercancel', end);
1301
+ document.removeEventListener('contextmenu', end);
1301
1302
  this._onDidSashEnd.fire(undefined);
1302
1303
  };
1303
1304
  document.addEventListener('pointermove', onPointerMove);
1304
1305
  document.addEventListener('pointerup', end);
1305
1306
  document.addEventListener('pointercancel', end);
1307
+ document.addEventListener('contextmenu', end);
1306
1308
  };
1307
1309
  sash.addEventListener('pointerdown', onPointerStart);
1308
1310
  const sashItem = {
@@ -3785,8 +3787,8 @@
3785
3787
  /**
3786
3788
  * Create a component from a serialized object.
3787
3789
  */
3788
- fromJSON(data) {
3789
- this.component.fromJSON(data);
3790
+ fromJSON(data, options) {
3791
+ this.component.fromJSON(data, options);
3790
3792
  }
3791
3793
  /**
3792
3794
  * Create a serialized object of the current component.
@@ -5017,6 +5019,7 @@
5017
5019
  }
5018
5020
  if (doRender) {
5019
5021
  const focusTracker = trackFocus(container);
5022
+ this.focusTracker = focusTracker;
5020
5023
  const disposable = new CompositeDisposable();
5021
5024
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
5022
5025
  this.disposable.value = disposable;
@@ -5044,6 +5047,16 @@
5044
5047
  this.disposable.dispose();
5045
5048
  super.dispose();
5046
5049
  }
5050
+ /**
5051
+ * Refresh the focus tracker state to handle cases where focus state
5052
+ * gets out of sync due to programmatic panel activation
5053
+ */
5054
+ refreshFocusState() {
5055
+ var _a;
5056
+ if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
5057
+ this.focusTracker.refreshState();
5058
+ }
5059
+ }
5047
5060
  }
5048
5061
 
5049
5062
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -5153,7 +5166,7 @@
5153
5166
  }
5154
5167
  }
5155
5168
 
5156
- class WillShowOverlayLocationEvent {
5169
+ class DockviewWillShowOverlayLocationEvent {
5157
5170
  get kind() {
5158
5171
  return this.options.kind;
5159
5172
  }
@@ -5501,7 +5514,7 @@
5501
5514
  index: this._tabs.findIndex((x) => x.value === tab),
5502
5515
  });
5503
5516
  }), tab.onWillShowOverlay((event) => {
5504
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5517
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5505
5518
  kind: 'tab',
5506
5519
  panel: this.group.activePanel,
5507
5520
  api: this.accessor.api,
@@ -5665,7 +5678,7 @@
5665
5678
  index: this.tabs.size,
5666
5679
  });
5667
5680
  }), this.voidContainer.onWillShowOverlay((event) => {
5668
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5681
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5669
5682
  kind: 'header_space',
5670
5683
  panel: this.group.activePanel,
5671
5684
  api: this.accessor.api,
@@ -6059,7 +6072,7 @@
6059
6072
  }), this.tabsContainer.onWillShowOverlay((event) => {
6060
6073
  this._onWillShowOverlay.fire(event);
6061
6074
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6062
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6075
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6063
6076
  kind: 'content',
6064
6077
  panel: this.activePanel,
6065
6078
  api: this._api,
@@ -6370,8 +6383,11 @@
6370
6383
  this._activePanel = panel;
6371
6384
  if (panel) {
6372
6385
  this.tabsContainer.setActivePanel(panel);
6386
+ this.contentContainer.openPanel(panel);
6373
6387
  panel.layout(this._width, this._height);
6374
6388
  this.updateMru(panel);
6389
+ // Refresh focus state to handle programmatic activation without DOM focus change
6390
+ this.contentContainer.refreshFocusState();
6375
6391
  this._onDidActivePanelChange.fire({
6376
6392
  panel,
6377
6393
  });
@@ -6732,7 +6748,19 @@
6732
6748
  this.onDidLocationChange = this._onDidLocationChange.event;
6733
6749
  this._onDidActivePanelChange = new Emitter();
6734
6750
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6735
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6751
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6752
+ // When becoming visible, apply any pending size change
6753
+ if (event.isVisible && this._pendingSize) {
6754
+ super.setSize(this._pendingSize);
6755
+ this._pendingSize = undefined;
6756
+ }
6757
+ }));
6758
+ }
6759
+ setSize(event) {
6760
+ // Always store the requested size
6761
+ this._pendingSize = Object.assign({}, event);
6762
+ // Apply the size change immediately
6763
+ super.setSize(event);
6736
6764
  }
6737
6765
  close() {
6738
6766
  if (!this._group) {
@@ -7201,6 +7229,18 @@
7201
7229
  params: this._params,
7202
7230
  });
7203
7231
  }
7232
+ updateFromStateModel(state) {
7233
+ var _a, _b, _c;
7234
+ this._maximumHeight = state.maximumHeight;
7235
+ this._minimumHeight = state.minimumHeight;
7236
+ this._maximumWidth = state.maximumWidth;
7237
+ this._minimumWidth = state.minimumWidth;
7238
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7239
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7240
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7241
+ // state.contentComponent;
7242
+ // state.tabComponent;
7243
+ }
7204
7244
  updateParentGroup(group, options) {
7205
7245
  this._group = group;
7206
7246
  this.api.group = this._group;
@@ -7672,13 +7712,16 @@
7672
7712
  let right = undefined;
7673
7713
  let width = undefined;
7674
7714
  const moveTop = () => {
7675
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7715
+ // When dragging top handle, constrain top position to prevent oversizing
7716
+ const maxTop = startPosition.originalY +
7676
7717
  startPosition.originalHeight >
7677
7718
  containerRect.height
7678
- ? this.getMinimumHeight(containerRect.height)
7719
+ ? Math.max(0, containerRect.height -
7720
+ Overlay.MINIMUM_HEIGHT)
7679
7721
  : Math.max(0, startPosition.originalY +
7680
7722
  startPosition.originalHeight -
7681
- Overlay.MINIMUM_HEIGHT));
7723
+ Overlay.MINIMUM_HEIGHT);
7724
+ top = clamp(y, 0, maxTop);
7682
7725
  height =
7683
7726
  startPosition.originalY +
7684
7727
  startPosition.originalHeight -
@@ -7689,22 +7732,27 @@
7689
7732
  top =
7690
7733
  startPosition.originalY -
7691
7734
  startPosition.originalHeight;
7692
- height = clamp(y - top, top < 0 &&
7693
- typeof this.options
7694
- .minimumInViewportHeight === 'number'
7735
+ // When dragging bottom handle, constrain height to container height
7736
+ const minHeight = top < 0 &&
7737
+ typeof this.options.minimumInViewportHeight ===
7738
+ 'number'
7695
7739
  ? -top +
7696
7740
  this.options.minimumInViewportHeight
7697
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7741
+ : Overlay.MINIMUM_HEIGHT;
7742
+ const maxHeight = containerRect.height - Math.max(0, top);
7743
+ height = clamp(y - top, minHeight, maxHeight);
7698
7744
  bottom = containerRect.height - top - height;
7699
7745
  };
7700
7746
  const moveLeft = () => {
7701
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7747
+ const maxLeft = startPosition.originalX +
7702
7748
  startPosition.originalWidth >
7703
7749
  containerRect.width
7704
- ? this.getMinimumWidth(containerRect.width)
7750
+ ? Math.max(0, containerRect.width -
7751
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7705
7752
  : Math.max(0, startPosition.originalX +
7706
7753
  startPosition.originalWidth -
7707
- Overlay.MINIMUM_WIDTH));
7754
+ Overlay.MINIMUM_WIDTH);
7755
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7708
7756
  width =
7709
7757
  startPosition.originalX +
7710
7758
  startPosition.originalWidth -
@@ -7715,12 +7763,15 @@
7715
7763
  left =
7716
7764
  startPosition.originalX -
7717
7765
  startPosition.originalWidth;
7718
- width = clamp(x - left, left < 0 &&
7719
- typeof this.options
7720
- .minimumInViewportWidth === 'number'
7766
+ // When dragging right handle, constrain width to container width
7767
+ const minWidth = left < 0 &&
7768
+ typeof this.options.minimumInViewportWidth ===
7769
+ 'number'
7721
7770
  ? -left +
7722
7771
  this.options.minimumInViewportWidth
7723
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7772
+ : Overlay.MINIMUM_WIDTH;
7773
+ const maxWidth = containerRect.width - Math.max(0, left);
7774
+ width = clamp(x - left, minWidth, maxWidth);
7724
7775
  right = containerRect.width - left - width;
7725
7776
  };
7726
7777
  switch (direction) {
@@ -8573,7 +8624,7 @@
8573
8624
  // option only available when no panels in primary grid
8574
8625
  return;
8575
8626
  }
8576
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8627
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8577
8628
  kind: 'edge',
8578
8629
  panel: undefined,
8579
8630
  api: this._api,
@@ -8987,7 +9038,7 @@
8987
9038
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8988
9039
  const el = group.element.querySelector('.dv-void-container');
8989
9040
  if (!el) {
8990
- throw new Error('failed to find drag handle');
9041
+ throw new Error('dockview: failed to find drag handle');
8991
9042
  }
8992
9043
  overlay.setupDrag(el, {
8993
9044
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -9059,7 +9110,7 @@
9059
9110
  case 'right':
9060
9111
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
9061
9112
  default:
9062
- throw new Error(`unsupported position ${position}`);
9113
+ throw new Error(`dockview: unsupported position ${position}`);
9063
9114
  }
9064
9115
  }
9065
9116
  updateOptions(options) {
@@ -9205,15 +9256,48 @@
9205
9256
  }
9206
9257
  return result;
9207
9258
  }
9208
- fromJSON(data) {
9259
+ fromJSON(data, options) {
9209
9260
  var _a, _b;
9261
+ const existingPanels = new Map();
9262
+ let tempGroup;
9263
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9264
+ /**
9265
+ * What are we doing here?
9266
+ *
9267
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9268
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9269
+ */
9270
+ tempGroup = this.createGroup();
9271
+ this._groups.delete(tempGroup.api.id);
9272
+ const newPanels = Object.keys(data.panels);
9273
+ for (const panel of this.panels) {
9274
+ if (newPanels.includes(panel.api.id)) {
9275
+ existingPanels.set(panel.api.id, panel);
9276
+ }
9277
+ }
9278
+ this.movingLock(() => {
9279
+ Array.from(existingPanels.values()).forEach((panel) => {
9280
+ this.moveGroupOrPanel({
9281
+ from: {
9282
+ groupId: panel.api.group.api.id,
9283
+ panelId: panel.api.id,
9284
+ },
9285
+ to: {
9286
+ group: tempGroup,
9287
+ position: 'center',
9288
+ },
9289
+ keepEmptyGroups: true,
9290
+ });
9291
+ });
9292
+ });
9293
+ }
9210
9294
  this.clear();
9211
9295
  if (typeof data !== 'object' || data === null) {
9212
- throw new Error('serialized layout must be a non-null object');
9296
+ throw new Error('dockview: serialized layout must be a non-null object');
9213
9297
  }
9214
9298
  const { grid, panels, activeGroup } = data;
9215
9299
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9216
- throw new Error('root must be of type branch');
9300
+ throw new Error('dockview: root must be of type branch');
9217
9301
  }
9218
9302
  try {
9219
9303
  // take note of the existing dimensions
@@ -9222,7 +9306,7 @@
9222
9306
  const createGroupFromSerializedState = (data) => {
9223
9307
  const { id, locked, hideHeader, views, activeView } = data;
9224
9308
  if (typeof id !== 'string') {
9225
- throw new Error('group id must be of type string');
9309
+ throw new Error('dockview: group id must be of type string');
9226
9310
  }
9227
9311
  const group = this.createGroup({
9228
9312
  id,
@@ -9237,17 +9321,38 @@
9237
9321
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9238
9322
  * due to a corruption of input data.
9239
9323
  */
9240
- const panel = this._deserializer.fromJSON(panels[child], group);
9241
- createdPanels.push(panel);
9324
+ const existingPanel = existingPanels.get(child);
9325
+ if (tempGroup && existingPanel) {
9326
+ this.movingLock(() => {
9327
+ tempGroup.model.removePanel(existingPanel);
9328
+ });
9329
+ createdPanels.push(existingPanel);
9330
+ existingPanel.updateFromStateModel(panels[child]);
9331
+ }
9332
+ else {
9333
+ const panel = this._deserializer.fromJSON(panels[child], group);
9334
+ createdPanels.push(panel);
9335
+ }
9242
9336
  }
9243
9337
  for (let i = 0; i < views.length; i++) {
9244
9338
  const panel = createdPanels[i];
9245
9339
  const isActive = typeof activeView === 'string' &&
9246
9340
  activeView === panel.id;
9247
- group.model.openPanel(panel, {
9248
- skipSetActive: !isActive,
9249
- skipSetGroupActive: true,
9250
- });
9341
+ const hasExisting = existingPanels.has(panel.api.id);
9342
+ if (hasExisting) {
9343
+ this.movingLock(() => {
9344
+ group.model.openPanel(panel, {
9345
+ skipSetActive: !isActive,
9346
+ skipSetGroupActive: true,
9347
+ });
9348
+ });
9349
+ }
9350
+ else {
9351
+ group.model.openPanel(panel, {
9352
+ skipSetActive: !isActive,
9353
+ skipSetGroupActive: true,
9354
+ });
9355
+ }
9251
9356
  }
9252
9357
  if (!group.activePanel && group.panels.length > 0) {
9253
9358
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9286,7 +9391,9 @@
9286
9391
  setTimeout(() => {
9287
9392
  this.addPopoutGroup(group, {
9288
9393
  position: position !== null && position !== void 0 ? position : undefined,
9289
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9394
+ overridePopoutGroup: gridReferenceGroup
9395
+ ? group
9396
+ : undefined,
9290
9397
  referenceGroup: gridReferenceGroup
9291
9398
  ? this.getPanel(gridReferenceGroup)
9292
9399
  : undefined,
@@ -9372,11 +9479,11 @@
9372
9479
  addPanel(options) {
9373
9480
  var _a, _b;
9374
9481
  if (this.panels.find((_) => _.id === options.id)) {
9375
- throw new Error(`panel with id ${options.id} already exists`);
9482
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9376
9483
  }
9377
9484
  let referenceGroup;
9378
9485
  if (options.position && options.floating) {
9379
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9486
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9380
9487
  }
9381
9488
  const initial = {
9382
9489
  width: options.initialWidth,
@@ -9390,7 +9497,7 @@
9390
9497
  : options.position.referencePanel;
9391
9498
  index = options.position.index;
9392
9499
  if (!referencePanel) {
9393
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9500
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9394
9501
  }
9395
9502
  referenceGroup = this.findGroup(referencePanel);
9396
9503
  }
@@ -9401,7 +9508,7 @@
9401
9508
  : options.position.referenceGroup;
9402
9509
  index = options.position.index;
9403
9510
  if (!referenceGroup) {
9404
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9511
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9405
9512
  }
9406
9513
  }
9407
9514
  else {
@@ -9513,7 +9620,7 @@
9513
9620
  }) {
9514
9621
  const group = panel.group;
9515
9622
  if (!group) {
9516
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9623
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9517
9624
  }
9518
9625
  group.model.removePanel(panel, {
9519
9626
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9562,11 +9669,11 @@
9562
9669
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9563
9670
  : options.referencePanel;
9564
9671
  if (!referencePanel) {
9565
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9672
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9566
9673
  }
9567
9674
  referenceGroup = this.findGroup(referencePanel);
9568
9675
  if (!referenceGroup) {
9569
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9676
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9570
9677
  }
9571
9678
  }
9572
9679
  else if (isGroupOptionsWithGroup(options)) {
@@ -9575,7 +9682,7 @@
9575
9682
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9576
9683
  : options.referenceGroup;
9577
9684
  if (!referenceGroup) {
9578
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9685
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9579
9686
  }
9580
9687
  }
9581
9688
  else {
@@ -9643,7 +9750,7 @@
9643
9750
  }
9644
9751
  return floatingGroup.group;
9645
9752
  }
9646
- throw new Error('failed to find floating group');
9753
+ throw new Error('dockview: failed to find floating group');
9647
9754
  }
9648
9755
  if (group.api.location.type === 'popout') {
9649
9756
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9674,7 +9781,7 @@
9674
9781
  this.updateWatermark();
9675
9782
  return selectedGroup.popoutGroup;
9676
9783
  }
9677
- throw new Error('failed to find popout group');
9784
+ throw new Error('dockview: failed to find popout group');
9678
9785
  }
9679
9786
  const re = super.doRemoveGroup(group, options);
9680
9787
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9705,7 +9812,7 @@
9705
9812
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9706
9813
  : undefined;
9707
9814
  if (!sourceGroup) {
9708
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9815
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9709
9816
  }
9710
9817
  if (sourceItemId === undefined) {
9711
9818
  /**
@@ -9730,9 +9837,9 @@
9730
9837
  skipSetActiveGroup: true,
9731
9838
  }));
9732
9839
  if (!removedPanel) {
9733
- throw new Error(`No panel with id ${sourceItemId}`);
9840
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9734
9841
  }
9735
- if (sourceGroup.model.size === 0) {
9842
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9736
9843
  // remove the group and do not set a new group as active
9737
9844
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9738
9845
  }
@@ -9742,7 +9849,8 @@
9742
9849
  var _a;
9743
9850
  return destinationGroup.model.openPanel(removedPanel, {
9744
9851
  index: destinationIndex,
9745
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9852
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9853
+ !isDestinationGroupEmpty,
9746
9854
  skipSetGroupActive: true,
9747
9855
  });
9748
9856
  });
@@ -9753,6 +9861,13 @@
9753
9861
  panel: removedPanel,
9754
9862
  from: sourceGroup,
9755
9863
  });
9864
+ /**
9865
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9866
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9867
+ */
9868
+ requestAnimationFrame(() => {
9869
+ this.overlayRenderContainer.updateAllPositions();
9870
+ });
9756
9871
  }
9757
9872
  else {
9758
9873
  /**
@@ -9797,7 +9912,9 @@
9797
9912
  }));
9798
9913
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9799
9914
  const newGroup = this.createGroupAtLocation(targetLocation);
9800
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9915
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9916
+ skipSetActive: true,
9917
+ }));
9801
9918
  this.doSetGroupAndPanelActive(newGroup);
9802
9919
  this._onDidMovePanel.fire({
9803
9920
  panel: this.getGroupPanel(sourceItemId),
@@ -9830,7 +9947,7 @@
9830
9947
  skipSetActiveGroup: true,
9831
9948
  }));
9832
9949
  if (!removedPanel) {
9833
- throw new Error(`No panel with id ${sourceItemId}`);
9950
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9834
9951
  }
9835
9952
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9836
9953
  const group = this.createGroupAtLocation(dropLocation);
@@ -9885,7 +10002,7 @@
9885
10002
  case 'floating': {
9886
10003
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9887
10004
  if (!selectedFloatingGroup) {
9888
- throw new Error('failed to find floating group');
10005
+ throw new Error('dockview: failed to find floating group');
9889
10006
  }
9890
10007
  selectedFloatingGroup.dispose();
9891
10008
  break;
@@ -9893,7 +10010,7 @@
9893
10010
  case 'popout': {
9894
10011
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9895
10012
  if (!selectedPopoutGroup) {
9896
- throw new Error('failed to find popout group');
10013
+ throw new Error('dockview: failed to find popout group');
9897
10014
  }
9898
10015
  // Remove from popout groups list to prevent automatic restoration
9899
10016
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);
@@ -11196,6 +11313,7 @@
11196
11313
  exports.DockviewPanel = DockviewPanel;
11197
11314
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
11198
11315
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
11316
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
11199
11317
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
11200
11318
  exports.Gridview = Gridview;
11201
11319
  exports.GridviewApi = GridviewApi;