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
  */
@@ -1268,11 +1268,13 @@
1268
1268
  document.removeEventListener('pointermove', onPointerMove);
1269
1269
  document.removeEventListener('pointerup', end);
1270
1270
  document.removeEventListener('pointercancel', end);
1271
+ document.removeEventListener('contextmenu', end);
1271
1272
  this._onDidSashEnd.fire(undefined);
1272
1273
  };
1273
1274
  document.addEventListener('pointermove', onPointerMove);
1274
1275
  document.addEventListener('pointerup', end);
1275
1276
  document.addEventListener('pointercancel', end);
1277
+ document.addEventListener('contextmenu', end);
1276
1278
  };
1277
1279
  sash.addEventListener('pointerdown', onPointerStart);
1278
1280
  const sashItem = {
@@ -3755,8 +3757,8 @@
3755
3757
  /**
3756
3758
  * Create a component from a serialized object.
3757
3759
  */
3758
- fromJSON(data) {
3759
- this.component.fromJSON(data);
3760
+ fromJSON(data, options) {
3761
+ this.component.fromJSON(data, options);
3760
3762
  }
3761
3763
  /**
3762
3764
  * Create a serialized object of the current component.
@@ -4987,6 +4989,7 @@
4987
4989
  }
4988
4990
  if (doRender) {
4989
4991
  const focusTracker = trackFocus(container);
4992
+ this.focusTracker = focusTracker;
4990
4993
  const disposable = new CompositeDisposable();
4991
4994
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
4992
4995
  this.disposable.value = disposable;
@@ -5014,6 +5017,16 @@
5014
5017
  this.disposable.dispose();
5015
5018
  super.dispose();
5016
5019
  }
5020
+ /**
5021
+ * Refresh the focus tracker state to handle cases where focus state
5022
+ * gets out of sync due to programmatic panel activation
5023
+ */
5024
+ refreshFocusState() {
5025
+ var _a;
5026
+ if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
5027
+ this.focusTracker.refreshState();
5028
+ }
5029
+ }
5017
5030
  }
5018
5031
 
5019
5032
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -5123,7 +5136,7 @@
5123
5136
  }
5124
5137
  }
5125
5138
 
5126
- class WillShowOverlayLocationEvent {
5139
+ class DockviewWillShowOverlayLocationEvent {
5127
5140
  get kind() {
5128
5141
  return this.options.kind;
5129
5142
  }
@@ -5471,7 +5484,7 @@
5471
5484
  index: this._tabs.findIndex((x) => x.value === tab),
5472
5485
  });
5473
5486
  }), tab.onWillShowOverlay((event) => {
5474
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5487
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5475
5488
  kind: 'tab',
5476
5489
  panel: this.group.activePanel,
5477
5490
  api: this.accessor.api,
@@ -5635,7 +5648,7 @@
5635
5648
  index: this.tabs.size,
5636
5649
  });
5637
5650
  }), this.voidContainer.onWillShowOverlay((event) => {
5638
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5651
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5639
5652
  kind: 'header_space',
5640
5653
  panel: this.group.activePanel,
5641
5654
  api: this.accessor.api,
@@ -6029,7 +6042,7 @@
6029
6042
  }), this.tabsContainer.onWillShowOverlay((event) => {
6030
6043
  this._onWillShowOverlay.fire(event);
6031
6044
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6032
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6045
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6033
6046
  kind: 'content',
6034
6047
  panel: this.activePanel,
6035
6048
  api: this._api,
@@ -6340,8 +6353,11 @@
6340
6353
  this._activePanel = panel;
6341
6354
  if (panel) {
6342
6355
  this.tabsContainer.setActivePanel(panel);
6356
+ this.contentContainer.openPanel(panel);
6343
6357
  panel.layout(this._width, this._height);
6344
6358
  this.updateMru(panel);
6359
+ // Refresh focus state to handle programmatic activation without DOM focus change
6360
+ this.contentContainer.refreshFocusState();
6345
6361
  this._onDidActivePanelChange.fire({
6346
6362
  panel,
6347
6363
  });
@@ -6702,7 +6718,19 @@
6702
6718
  this.onDidLocationChange = this._onDidLocationChange.event;
6703
6719
  this._onDidActivePanelChange = new Emitter();
6704
6720
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6705
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6721
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6722
+ // When becoming visible, apply any pending size change
6723
+ if (event.isVisible && this._pendingSize) {
6724
+ super.setSize(this._pendingSize);
6725
+ this._pendingSize = undefined;
6726
+ }
6727
+ }));
6728
+ }
6729
+ setSize(event) {
6730
+ // Always store the requested size
6731
+ this._pendingSize = Object.assign({}, event);
6732
+ // Apply the size change immediately
6733
+ super.setSize(event);
6706
6734
  }
6707
6735
  close() {
6708
6736
  if (!this._group) {
@@ -7171,6 +7199,18 @@
7171
7199
  params: this._params,
7172
7200
  });
7173
7201
  }
7202
+ updateFromStateModel(state) {
7203
+ var _a, _b, _c;
7204
+ this._maximumHeight = state.maximumHeight;
7205
+ this._minimumHeight = state.minimumHeight;
7206
+ this._maximumWidth = state.maximumWidth;
7207
+ this._minimumWidth = state.minimumWidth;
7208
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7209
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7210
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7211
+ // state.contentComponent;
7212
+ // state.tabComponent;
7213
+ }
7174
7214
  updateParentGroup(group, options) {
7175
7215
  this._group = group;
7176
7216
  this.api.group = this._group;
@@ -7642,13 +7682,16 @@
7642
7682
  let right = undefined;
7643
7683
  let width = undefined;
7644
7684
  const moveTop = () => {
7645
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7685
+ // When dragging top handle, constrain top position to prevent oversizing
7686
+ const maxTop = startPosition.originalY +
7646
7687
  startPosition.originalHeight >
7647
7688
  containerRect.height
7648
- ? this.getMinimumHeight(containerRect.height)
7689
+ ? Math.max(0, containerRect.height -
7690
+ Overlay.MINIMUM_HEIGHT)
7649
7691
  : Math.max(0, startPosition.originalY +
7650
7692
  startPosition.originalHeight -
7651
- Overlay.MINIMUM_HEIGHT));
7693
+ Overlay.MINIMUM_HEIGHT);
7694
+ top = clamp(y, 0, maxTop);
7652
7695
  height =
7653
7696
  startPosition.originalY +
7654
7697
  startPosition.originalHeight -
@@ -7659,22 +7702,27 @@
7659
7702
  top =
7660
7703
  startPosition.originalY -
7661
7704
  startPosition.originalHeight;
7662
- height = clamp(y - top, top < 0 &&
7663
- typeof this.options
7664
- .minimumInViewportHeight === 'number'
7705
+ // When dragging bottom handle, constrain height to container height
7706
+ const minHeight = top < 0 &&
7707
+ typeof this.options.minimumInViewportHeight ===
7708
+ 'number'
7665
7709
  ? -top +
7666
7710
  this.options.minimumInViewportHeight
7667
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7711
+ : Overlay.MINIMUM_HEIGHT;
7712
+ const maxHeight = containerRect.height - Math.max(0, top);
7713
+ height = clamp(y - top, minHeight, maxHeight);
7668
7714
  bottom = containerRect.height - top - height;
7669
7715
  };
7670
7716
  const moveLeft = () => {
7671
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7717
+ const maxLeft = startPosition.originalX +
7672
7718
  startPosition.originalWidth >
7673
7719
  containerRect.width
7674
- ? this.getMinimumWidth(containerRect.width)
7720
+ ? Math.max(0, containerRect.width -
7721
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7675
7722
  : Math.max(0, startPosition.originalX +
7676
7723
  startPosition.originalWidth -
7677
- Overlay.MINIMUM_WIDTH));
7724
+ Overlay.MINIMUM_WIDTH);
7725
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7678
7726
  width =
7679
7727
  startPosition.originalX +
7680
7728
  startPosition.originalWidth -
@@ -7685,12 +7733,15 @@
7685
7733
  left =
7686
7734
  startPosition.originalX -
7687
7735
  startPosition.originalWidth;
7688
- width = clamp(x - left, left < 0 &&
7689
- typeof this.options
7690
- .minimumInViewportWidth === 'number'
7736
+ // When dragging right handle, constrain width to container width
7737
+ const minWidth = left < 0 &&
7738
+ typeof this.options.minimumInViewportWidth ===
7739
+ 'number'
7691
7740
  ? -left +
7692
7741
  this.options.minimumInViewportWidth
7693
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7742
+ : Overlay.MINIMUM_WIDTH;
7743
+ const maxWidth = containerRect.width - Math.max(0, left);
7744
+ width = clamp(x - left, minWidth, maxWidth);
7694
7745
  right = containerRect.width - left - width;
7695
7746
  };
7696
7747
  switch (direction) {
@@ -8543,7 +8594,7 @@
8543
8594
  // option only available when no panels in primary grid
8544
8595
  return;
8545
8596
  }
8546
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8597
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8547
8598
  kind: 'edge',
8548
8599
  panel: undefined,
8549
8600
  api: this._api,
@@ -8957,7 +9008,7 @@
8957
9008
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8958
9009
  const el = group.element.querySelector('.dv-void-container');
8959
9010
  if (!el) {
8960
- throw new Error('failed to find drag handle');
9011
+ throw new Error('dockview: failed to find drag handle');
8961
9012
  }
8962
9013
  overlay.setupDrag(el, {
8963
9014
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -9029,7 +9080,7 @@
9029
9080
  case 'right':
9030
9081
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
9031
9082
  default:
9032
- throw new Error(`unsupported position ${position}`);
9083
+ throw new Error(`dockview: unsupported position ${position}`);
9033
9084
  }
9034
9085
  }
9035
9086
  updateOptions(options) {
@@ -9175,15 +9226,48 @@
9175
9226
  }
9176
9227
  return result;
9177
9228
  }
9178
- fromJSON(data) {
9229
+ fromJSON(data, options) {
9179
9230
  var _a, _b;
9231
+ const existingPanels = new Map();
9232
+ let tempGroup;
9233
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9234
+ /**
9235
+ * What are we doing here?
9236
+ *
9237
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9238
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9239
+ */
9240
+ tempGroup = this.createGroup();
9241
+ this._groups.delete(tempGroup.api.id);
9242
+ const newPanels = Object.keys(data.panels);
9243
+ for (const panel of this.panels) {
9244
+ if (newPanels.includes(panel.api.id)) {
9245
+ existingPanels.set(panel.api.id, panel);
9246
+ }
9247
+ }
9248
+ this.movingLock(() => {
9249
+ Array.from(existingPanels.values()).forEach((panel) => {
9250
+ this.moveGroupOrPanel({
9251
+ from: {
9252
+ groupId: panel.api.group.api.id,
9253
+ panelId: panel.api.id,
9254
+ },
9255
+ to: {
9256
+ group: tempGroup,
9257
+ position: 'center',
9258
+ },
9259
+ keepEmptyGroups: true,
9260
+ });
9261
+ });
9262
+ });
9263
+ }
9180
9264
  this.clear();
9181
9265
  if (typeof data !== 'object' || data === null) {
9182
- throw new Error('serialized layout must be a non-null object');
9266
+ throw new Error('dockview: serialized layout must be a non-null object');
9183
9267
  }
9184
9268
  const { grid, panels, activeGroup } = data;
9185
9269
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9186
- throw new Error('root must be of type branch');
9270
+ throw new Error('dockview: root must be of type branch');
9187
9271
  }
9188
9272
  try {
9189
9273
  // take note of the existing dimensions
@@ -9192,7 +9276,7 @@
9192
9276
  const createGroupFromSerializedState = (data) => {
9193
9277
  const { id, locked, hideHeader, views, activeView } = data;
9194
9278
  if (typeof id !== 'string') {
9195
- throw new Error('group id must be of type string');
9279
+ throw new Error('dockview: group id must be of type string');
9196
9280
  }
9197
9281
  const group = this.createGroup({
9198
9282
  id,
@@ -9207,17 +9291,38 @@
9207
9291
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9208
9292
  * due to a corruption of input data.
9209
9293
  */
9210
- const panel = this._deserializer.fromJSON(panels[child], group);
9211
- createdPanels.push(panel);
9294
+ const existingPanel = existingPanels.get(child);
9295
+ if (tempGroup && existingPanel) {
9296
+ this.movingLock(() => {
9297
+ tempGroup.model.removePanel(existingPanel);
9298
+ });
9299
+ createdPanels.push(existingPanel);
9300
+ existingPanel.updateFromStateModel(panels[child]);
9301
+ }
9302
+ else {
9303
+ const panel = this._deserializer.fromJSON(panels[child], group);
9304
+ createdPanels.push(panel);
9305
+ }
9212
9306
  }
9213
9307
  for (let i = 0; i < views.length; i++) {
9214
9308
  const panel = createdPanels[i];
9215
9309
  const isActive = typeof activeView === 'string' &&
9216
9310
  activeView === panel.id;
9217
- group.model.openPanel(panel, {
9218
- skipSetActive: !isActive,
9219
- skipSetGroupActive: true,
9220
- });
9311
+ const hasExisting = existingPanels.has(panel.api.id);
9312
+ if (hasExisting) {
9313
+ this.movingLock(() => {
9314
+ group.model.openPanel(panel, {
9315
+ skipSetActive: !isActive,
9316
+ skipSetGroupActive: true,
9317
+ });
9318
+ });
9319
+ }
9320
+ else {
9321
+ group.model.openPanel(panel, {
9322
+ skipSetActive: !isActive,
9323
+ skipSetGroupActive: true,
9324
+ });
9325
+ }
9221
9326
  }
9222
9327
  if (!group.activePanel && group.panels.length > 0) {
9223
9328
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9256,7 +9361,9 @@
9256
9361
  setTimeout(() => {
9257
9362
  this.addPopoutGroup(group, {
9258
9363
  position: position !== null && position !== void 0 ? position : undefined,
9259
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9364
+ overridePopoutGroup: gridReferenceGroup
9365
+ ? group
9366
+ : undefined,
9260
9367
  referenceGroup: gridReferenceGroup
9261
9368
  ? this.getPanel(gridReferenceGroup)
9262
9369
  : undefined,
@@ -9342,11 +9449,11 @@
9342
9449
  addPanel(options) {
9343
9450
  var _a, _b;
9344
9451
  if (this.panels.find((_) => _.id === options.id)) {
9345
- throw new Error(`panel with id ${options.id} already exists`);
9452
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9346
9453
  }
9347
9454
  let referenceGroup;
9348
9455
  if (options.position && options.floating) {
9349
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9456
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9350
9457
  }
9351
9458
  const initial = {
9352
9459
  width: options.initialWidth,
@@ -9360,7 +9467,7 @@
9360
9467
  : options.position.referencePanel;
9361
9468
  index = options.position.index;
9362
9469
  if (!referencePanel) {
9363
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9470
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9364
9471
  }
9365
9472
  referenceGroup = this.findGroup(referencePanel);
9366
9473
  }
@@ -9371,7 +9478,7 @@
9371
9478
  : options.position.referenceGroup;
9372
9479
  index = options.position.index;
9373
9480
  if (!referenceGroup) {
9374
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9481
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9375
9482
  }
9376
9483
  }
9377
9484
  else {
@@ -9483,7 +9590,7 @@
9483
9590
  }) {
9484
9591
  const group = panel.group;
9485
9592
  if (!group) {
9486
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9593
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9487
9594
  }
9488
9595
  group.model.removePanel(panel, {
9489
9596
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9532,11 +9639,11 @@
9532
9639
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9533
9640
  : options.referencePanel;
9534
9641
  if (!referencePanel) {
9535
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9642
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9536
9643
  }
9537
9644
  referenceGroup = this.findGroup(referencePanel);
9538
9645
  if (!referenceGroup) {
9539
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9646
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9540
9647
  }
9541
9648
  }
9542
9649
  else if (isGroupOptionsWithGroup(options)) {
@@ -9545,7 +9652,7 @@
9545
9652
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9546
9653
  : options.referenceGroup;
9547
9654
  if (!referenceGroup) {
9548
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9655
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9549
9656
  }
9550
9657
  }
9551
9658
  else {
@@ -9613,7 +9720,7 @@
9613
9720
  }
9614
9721
  return floatingGroup.group;
9615
9722
  }
9616
- throw new Error('failed to find floating group');
9723
+ throw new Error('dockview: failed to find floating group');
9617
9724
  }
9618
9725
  if (group.api.location.type === 'popout') {
9619
9726
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9644,7 +9751,7 @@
9644
9751
  this.updateWatermark();
9645
9752
  return selectedGroup.popoutGroup;
9646
9753
  }
9647
- throw new Error('failed to find popout group');
9754
+ throw new Error('dockview: failed to find popout group');
9648
9755
  }
9649
9756
  const re = super.doRemoveGroup(group, options);
9650
9757
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9675,7 +9782,7 @@
9675
9782
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9676
9783
  : undefined;
9677
9784
  if (!sourceGroup) {
9678
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9785
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9679
9786
  }
9680
9787
  if (sourceItemId === undefined) {
9681
9788
  /**
@@ -9700,9 +9807,9 @@
9700
9807
  skipSetActiveGroup: true,
9701
9808
  }));
9702
9809
  if (!removedPanel) {
9703
- throw new Error(`No panel with id ${sourceItemId}`);
9810
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9704
9811
  }
9705
- if (sourceGroup.model.size === 0) {
9812
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9706
9813
  // remove the group and do not set a new group as active
9707
9814
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9708
9815
  }
@@ -9712,7 +9819,8 @@
9712
9819
  var _a;
9713
9820
  return destinationGroup.model.openPanel(removedPanel, {
9714
9821
  index: destinationIndex,
9715
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9822
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9823
+ !isDestinationGroupEmpty,
9716
9824
  skipSetGroupActive: true,
9717
9825
  });
9718
9826
  });
@@ -9723,6 +9831,13 @@
9723
9831
  panel: removedPanel,
9724
9832
  from: sourceGroup,
9725
9833
  });
9834
+ /**
9835
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9836
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9837
+ */
9838
+ requestAnimationFrame(() => {
9839
+ this.overlayRenderContainer.updateAllPositions();
9840
+ });
9726
9841
  }
9727
9842
  else {
9728
9843
  /**
@@ -9767,7 +9882,9 @@
9767
9882
  }));
9768
9883
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9769
9884
  const newGroup = this.createGroupAtLocation(targetLocation);
9770
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9885
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9886
+ skipSetActive: true,
9887
+ }));
9771
9888
  this.doSetGroupAndPanelActive(newGroup);
9772
9889
  this._onDidMovePanel.fire({
9773
9890
  panel: this.getGroupPanel(sourceItemId),
@@ -9800,7 +9917,7 @@
9800
9917
  skipSetActiveGroup: true,
9801
9918
  }));
9802
9919
  if (!removedPanel) {
9803
- throw new Error(`No panel with id ${sourceItemId}`);
9920
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9804
9921
  }
9805
9922
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9806
9923
  const group = this.createGroupAtLocation(dropLocation);
@@ -9855,7 +9972,7 @@
9855
9972
  case 'floating': {
9856
9973
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9857
9974
  if (!selectedFloatingGroup) {
9858
- throw new Error('failed to find floating group');
9975
+ throw new Error('dockview: failed to find floating group');
9859
9976
  }
9860
9977
  selectedFloatingGroup.dispose();
9861
9978
  break;
@@ -9863,7 +9980,7 @@
9863
9980
  case 'popout': {
9864
9981
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9865
9982
  if (!selectedPopoutGroup) {
9866
- throw new Error('failed to find popout group');
9983
+ throw new Error('dockview: failed to find popout group');
9867
9984
  }
9868
9985
  // Remove from popout groups list to prevent automatic restoration
9869
9986
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);
@@ -11166,6 +11283,7 @@
11166
11283
  exports.DockviewPanel = DockviewPanel;
11167
11284
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
11168
11285
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
11286
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
11169
11287
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
11170
11288
  exports.Gridview = Gridview;
11171
11289
  exports.GridviewApi = GridviewApi;