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
  */
@@ -1292,11 +1292,13 @@ class Splitview {
1292
1292
  document.removeEventListener('pointermove', onPointerMove);
1293
1293
  document.removeEventListener('pointerup', end);
1294
1294
  document.removeEventListener('pointercancel', end);
1295
+ document.removeEventListener('contextmenu', end);
1295
1296
  this._onDidSashEnd.fire(undefined);
1296
1297
  };
1297
1298
  document.addEventListener('pointermove', onPointerMove);
1298
1299
  document.addEventListener('pointerup', end);
1299
1300
  document.addEventListener('pointercancel', end);
1301
+ document.addEventListener('contextmenu', end);
1300
1302
  };
1301
1303
  sash.addEventListener('pointerdown', onPointerStart);
1302
1304
  const sashItem = {
@@ -3779,8 +3781,8 @@ class DockviewApi {
3779
3781
  /**
3780
3782
  * Create a component from a serialized object.
3781
3783
  */
3782
- fromJSON(data) {
3783
- this.component.fromJSON(data);
3784
+ fromJSON(data, options) {
3785
+ this.component.fromJSON(data, options);
3784
3786
  }
3785
3787
  /**
3786
3788
  * Create a serialized object of the current component.
@@ -5011,6 +5013,7 @@ class ContentContainer extends CompositeDisposable {
5011
5013
  }
5012
5014
  if (doRender) {
5013
5015
  const focusTracker = trackFocus(container);
5016
+ this.focusTracker = focusTracker;
5014
5017
  const disposable = new CompositeDisposable();
5015
5018
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
5016
5019
  this.disposable.value = disposable;
@@ -5038,6 +5041,16 @@ class ContentContainer extends CompositeDisposable {
5038
5041
  this.disposable.dispose();
5039
5042
  super.dispose();
5040
5043
  }
5044
+ /**
5045
+ * Refresh the focus tracker state to handle cases where focus state
5046
+ * gets out of sync due to programmatic panel activation
5047
+ */
5048
+ refreshFocusState() {
5049
+ var _a;
5050
+ if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
5051
+ this.focusTracker.refreshState();
5052
+ }
5053
+ }
5041
5054
  }
5042
5055
 
5043
5056
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -5147,7 +5160,7 @@ class Tab extends CompositeDisposable {
5147
5160
  }
5148
5161
  }
5149
5162
 
5150
- class WillShowOverlayLocationEvent {
5163
+ class DockviewWillShowOverlayLocationEvent {
5151
5164
  get kind() {
5152
5165
  return this.options.kind;
5153
5166
  }
@@ -5495,7 +5508,7 @@ class Tabs extends CompositeDisposable {
5495
5508
  index: this._tabs.findIndex((x) => x.value === tab),
5496
5509
  });
5497
5510
  }), tab.onWillShowOverlay((event) => {
5498
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5511
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5499
5512
  kind: 'tab',
5500
5513
  panel: this.group.activePanel,
5501
5514
  api: this.accessor.api,
@@ -5659,7 +5672,7 @@ class TabsContainer extends CompositeDisposable {
5659
5672
  index: this.tabs.size,
5660
5673
  });
5661
5674
  }), this.voidContainer.onWillShowOverlay((event) => {
5662
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5675
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5663
5676
  kind: 'header_space',
5664
5677
  panel: this.group.activePanel,
5665
5678
  api: this.accessor.api,
@@ -6053,7 +6066,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6053
6066
  }), this.tabsContainer.onWillShowOverlay((event) => {
6054
6067
  this._onWillShowOverlay.fire(event);
6055
6068
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6056
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6069
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6057
6070
  kind: 'content',
6058
6071
  panel: this.activePanel,
6059
6072
  api: this._api,
@@ -6364,8 +6377,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6364
6377
  this._activePanel = panel;
6365
6378
  if (panel) {
6366
6379
  this.tabsContainer.setActivePanel(panel);
6380
+ this.contentContainer.openPanel(panel);
6367
6381
  panel.layout(this._width, this._height);
6368
6382
  this.updateMru(panel);
6383
+ // Refresh focus state to handle programmatic activation without DOM focus change
6384
+ this.contentContainer.refreshFocusState();
6369
6385
  this._onDidActivePanelChange.fire({
6370
6386
  panel,
6371
6387
  });
@@ -6726,7 +6742,19 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6726
6742
  this.onDidLocationChange = this._onDidLocationChange.event;
6727
6743
  this._onDidActivePanelChange = new Emitter();
6728
6744
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6729
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6745
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6746
+ // When becoming visible, apply any pending size change
6747
+ if (event.isVisible && this._pendingSize) {
6748
+ super.setSize(this._pendingSize);
6749
+ this._pendingSize = undefined;
6750
+ }
6751
+ }));
6752
+ }
6753
+ setSize(event) {
6754
+ // Always store the requested size
6755
+ this._pendingSize = Object.assign({}, event);
6756
+ // Apply the size change immediately
6757
+ super.setSize(event);
6730
6758
  }
6731
6759
  close() {
6732
6760
  if (!this._group) {
@@ -7195,6 +7223,18 @@ class DockviewPanel extends CompositeDisposable {
7195
7223
  params: this._params,
7196
7224
  });
7197
7225
  }
7226
+ updateFromStateModel(state) {
7227
+ var _a, _b, _c;
7228
+ this._maximumHeight = state.maximumHeight;
7229
+ this._minimumHeight = state.minimumHeight;
7230
+ this._maximumWidth = state.maximumWidth;
7231
+ this._minimumWidth = state.minimumWidth;
7232
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7233
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7234
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7235
+ // state.contentComponent;
7236
+ // state.tabComponent;
7237
+ }
7198
7238
  updateParentGroup(group, options) {
7199
7239
  this._group = group;
7200
7240
  this.api.group = this._group;
@@ -7666,13 +7706,16 @@ class Overlay extends CompositeDisposable {
7666
7706
  let right = undefined;
7667
7707
  let width = undefined;
7668
7708
  const moveTop = () => {
7669
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7709
+ // When dragging top handle, constrain top position to prevent oversizing
7710
+ const maxTop = startPosition.originalY +
7670
7711
  startPosition.originalHeight >
7671
7712
  containerRect.height
7672
- ? this.getMinimumHeight(containerRect.height)
7713
+ ? Math.max(0, containerRect.height -
7714
+ Overlay.MINIMUM_HEIGHT)
7673
7715
  : Math.max(0, startPosition.originalY +
7674
7716
  startPosition.originalHeight -
7675
- Overlay.MINIMUM_HEIGHT));
7717
+ Overlay.MINIMUM_HEIGHT);
7718
+ top = clamp(y, 0, maxTop);
7676
7719
  height =
7677
7720
  startPosition.originalY +
7678
7721
  startPosition.originalHeight -
@@ -7683,22 +7726,27 @@ class Overlay extends CompositeDisposable {
7683
7726
  top =
7684
7727
  startPosition.originalY -
7685
7728
  startPosition.originalHeight;
7686
- height = clamp(y - top, top < 0 &&
7687
- typeof this.options
7688
- .minimumInViewportHeight === 'number'
7729
+ // When dragging bottom handle, constrain height to container height
7730
+ const minHeight = top < 0 &&
7731
+ typeof this.options.minimumInViewportHeight ===
7732
+ 'number'
7689
7733
  ? -top +
7690
7734
  this.options.minimumInViewportHeight
7691
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7735
+ : Overlay.MINIMUM_HEIGHT;
7736
+ const maxHeight = containerRect.height - Math.max(0, top);
7737
+ height = clamp(y - top, minHeight, maxHeight);
7692
7738
  bottom = containerRect.height - top - height;
7693
7739
  };
7694
7740
  const moveLeft = () => {
7695
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7741
+ const maxLeft = startPosition.originalX +
7696
7742
  startPosition.originalWidth >
7697
7743
  containerRect.width
7698
- ? this.getMinimumWidth(containerRect.width)
7744
+ ? Math.max(0, containerRect.width -
7745
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7699
7746
  : Math.max(0, startPosition.originalX +
7700
7747
  startPosition.originalWidth -
7701
- Overlay.MINIMUM_WIDTH));
7748
+ Overlay.MINIMUM_WIDTH);
7749
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7702
7750
  width =
7703
7751
  startPosition.originalX +
7704
7752
  startPosition.originalWidth -
@@ -7709,12 +7757,15 @@ class Overlay extends CompositeDisposable {
7709
7757
  left =
7710
7758
  startPosition.originalX -
7711
7759
  startPosition.originalWidth;
7712
- width = clamp(x - left, left < 0 &&
7713
- typeof this.options
7714
- .minimumInViewportWidth === 'number'
7760
+ // When dragging right handle, constrain width to container width
7761
+ const minWidth = left < 0 &&
7762
+ typeof this.options.minimumInViewportWidth ===
7763
+ 'number'
7715
7764
  ? -left +
7716
7765
  this.options.minimumInViewportWidth
7717
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7766
+ : Overlay.MINIMUM_WIDTH;
7767
+ const maxWidth = containerRect.width - Math.max(0, left);
7768
+ width = clamp(x - left, minWidth, maxWidth);
7718
7769
  right = containerRect.width - left - width;
7719
7770
  };
7720
7771
  switch (direction) {
@@ -8567,7 +8618,7 @@ class DockviewComponent extends BaseGrid {
8567
8618
  // option only available when no panels in primary grid
8568
8619
  return;
8569
8620
  }
8570
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8621
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8571
8622
  kind: 'edge',
8572
8623
  panel: undefined,
8573
8624
  api: this._api,
@@ -8981,7 +9032,7 @@ class DockviewComponent extends BaseGrid {
8981
9032
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8982
9033
  const el = group.element.querySelector('.dv-void-container');
8983
9034
  if (!el) {
8984
- throw new Error('failed to find drag handle');
9035
+ throw new Error('dockview: failed to find drag handle');
8985
9036
  }
8986
9037
  overlay.setupDrag(el, {
8987
9038
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -9053,7 +9104,7 @@ class DockviewComponent extends BaseGrid {
9053
9104
  case 'right':
9054
9105
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
9055
9106
  default:
9056
- throw new Error(`unsupported position ${position}`);
9107
+ throw new Error(`dockview: unsupported position ${position}`);
9057
9108
  }
9058
9109
  }
9059
9110
  updateOptions(options) {
@@ -9199,15 +9250,48 @@ class DockviewComponent extends BaseGrid {
9199
9250
  }
9200
9251
  return result;
9201
9252
  }
9202
- fromJSON(data) {
9253
+ fromJSON(data, options) {
9203
9254
  var _a, _b;
9255
+ const existingPanels = new Map();
9256
+ let tempGroup;
9257
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9258
+ /**
9259
+ * What are we doing here?
9260
+ *
9261
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9262
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9263
+ */
9264
+ tempGroup = this.createGroup();
9265
+ this._groups.delete(tempGroup.api.id);
9266
+ const newPanels = Object.keys(data.panels);
9267
+ for (const panel of this.panels) {
9268
+ if (newPanels.includes(panel.api.id)) {
9269
+ existingPanels.set(panel.api.id, panel);
9270
+ }
9271
+ }
9272
+ this.movingLock(() => {
9273
+ Array.from(existingPanels.values()).forEach((panel) => {
9274
+ this.moveGroupOrPanel({
9275
+ from: {
9276
+ groupId: panel.api.group.api.id,
9277
+ panelId: panel.api.id,
9278
+ },
9279
+ to: {
9280
+ group: tempGroup,
9281
+ position: 'center',
9282
+ },
9283
+ keepEmptyGroups: true,
9284
+ });
9285
+ });
9286
+ });
9287
+ }
9204
9288
  this.clear();
9205
9289
  if (typeof data !== 'object' || data === null) {
9206
- throw new Error('serialized layout must be a non-null object');
9290
+ throw new Error('dockview: serialized layout must be a non-null object');
9207
9291
  }
9208
9292
  const { grid, panels, activeGroup } = data;
9209
9293
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9210
- throw new Error('root must be of type branch');
9294
+ throw new Error('dockview: root must be of type branch');
9211
9295
  }
9212
9296
  try {
9213
9297
  // take note of the existing dimensions
@@ -9216,7 +9300,7 @@ class DockviewComponent extends BaseGrid {
9216
9300
  const createGroupFromSerializedState = (data) => {
9217
9301
  const { id, locked, hideHeader, views, activeView } = data;
9218
9302
  if (typeof id !== 'string') {
9219
- throw new Error('group id must be of type string');
9303
+ throw new Error('dockview: group id must be of type string');
9220
9304
  }
9221
9305
  const group = this.createGroup({
9222
9306
  id,
@@ -9231,17 +9315,38 @@ class DockviewComponent extends BaseGrid {
9231
9315
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9232
9316
  * due to a corruption of input data.
9233
9317
  */
9234
- const panel = this._deserializer.fromJSON(panels[child], group);
9235
- createdPanels.push(panel);
9318
+ const existingPanel = existingPanels.get(child);
9319
+ if (tempGroup && existingPanel) {
9320
+ this.movingLock(() => {
9321
+ tempGroup.model.removePanel(existingPanel);
9322
+ });
9323
+ createdPanels.push(existingPanel);
9324
+ existingPanel.updateFromStateModel(panels[child]);
9325
+ }
9326
+ else {
9327
+ const panel = this._deserializer.fromJSON(panels[child], group);
9328
+ createdPanels.push(panel);
9329
+ }
9236
9330
  }
9237
9331
  for (let i = 0; i < views.length; i++) {
9238
9332
  const panel = createdPanels[i];
9239
9333
  const isActive = typeof activeView === 'string' &&
9240
9334
  activeView === panel.id;
9241
- group.model.openPanel(panel, {
9242
- skipSetActive: !isActive,
9243
- skipSetGroupActive: true,
9244
- });
9335
+ const hasExisting = existingPanels.has(panel.api.id);
9336
+ if (hasExisting) {
9337
+ this.movingLock(() => {
9338
+ group.model.openPanel(panel, {
9339
+ skipSetActive: !isActive,
9340
+ skipSetGroupActive: true,
9341
+ });
9342
+ });
9343
+ }
9344
+ else {
9345
+ group.model.openPanel(panel, {
9346
+ skipSetActive: !isActive,
9347
+ skipSetGroupActive: true,
9348
+ });
9349
+ }
9245
9350
  }
9246
9351
  if (!group.activePanel && group.panels.length > 0) {
9247
9352
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9280,7 +9385,9 @@ class DockviewComponent extends BaseGrid {
9280
9385
  setTimeout(() => {
9281
9386
  this.addPopoutGroup(group, {
9282
9387
  position: position !== null && position !== void 0 ? position : undefined,
9283
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9388
+ overridePopoutGroup: gridReferenceGroup
9389
+ ? group
9390
+ : undefined,
9284
9391
  referenceGroup: gridReferenceGroup
9285
9392
  ? this.getPanel(gridReferenceGroup)
9286
9393
  : undefined,
@@ -9366,11 +9473,11 @@ class DockviewComponent extends BaseGrid {
9366
9473
  addPanel(options) {
9367
9474
  var _a, _b;
9368
9475
  if (this.panels.find((_) => _.id === options.id)) {
9369
- throw new Error(`panel with id ${options.id} already exists`);
9476
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9370
9477
  }
9371
9478
  let referenceGroup;
9372
9479
  if (options.position && options.floating) {
9373
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9480
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9374
9481
  }
9375
9482
  const initial = {
9376
9483
  width: options.initialWidth,
@@ -9384,7 +9491,7 @@ class DockviewComponent extends BaseGrid {
9384
9491
  : options.position.referencePanel;
9385
9492
  index = options.position.index;
9386
9493
  if (!referencePanel) {
9387
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9494
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9388
9495
  }
9389
9496
  referenceGroup = this.findGroup(referencePanel);
9390
9497
  }
@@ -9395,7 +9502,7 @@ class DockviewComponent extends BaseGrid {
9395
9502
  : options.position.referenceGroup;
9396
9503
  index = options.position.index;
9397
9504
  if (!referenceGroup) {
9398
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9505
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9399
9506
  }
9400
9507
  }
9401
9508
  else {
@@ -9507,7 +9614,7 @@ class DockviewComponent extends BaseGrid {
9507
9614
  }) {
9508
9615
  const group = panel.group;
9509
9616
  if (!group) {
9510
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9617
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9511
9618
  }
9512
9619
  group.model.removePanel(panel, {
9513
9620
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9556,11 +9663,11 @@ class DockviewComponent extends BaseGrid {
9556
9663
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9557
9664
  : options.referencePanel;
9558
9665
  if (!referencePanel) {
9559
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9666
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9560
9667
  }
9561
9668
  referenceGroup = this.findGroup(referencePanel);
9562
9669
  if (!referenceGroup) {
9563
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9670
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9564
9671
  }
9565
9672
  }
9566
9673
  else if (isGroupOptionsWithGroup(options)) {
@@ -9569,7 +9676,7 @@ class DockviewComponent extends BaseGrid {
9569
9676
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9570
9677
  : options.referenceGroup;
9571
9678
  if (!referenceGroup) {
9572
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9679
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9573
9680
  }
9574
9681
  }
9575
9682
  else {
@@ -9637,7 +9744,7 @@ class DockviewComponent extends BaseGrid {
9637
9744
  }
9638
9745
  return floatingGroup.group;
9639
9746
  }
9640
- throw new Error('failed to find floating group');
9747
+ throw new Error('dockview: failed to find floating group');
9641
9748
  }
9642
9749
  if (group.api.location.type === 'popout') {
9643
9750
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9668,7 +9775,7 @@ class DockviewComponent extends BaseGrid {
9668
9775
  this.updateWatermark();
9669
9776
  return selectedGroup.popoutGroup;
9670
9777
  }
9671
- throw new Error('failed to find popout group');
9778
+ throw new Error('dockview: failed to find popout group');
9672
9779
  }
9673
9780
  const re = super.doRemoveGroup(group, options);
9674
9781
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9699,7 +9806,7 @@ class DockviewComponent extends BaseGrid {
9699
9806
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9700
9807
  : undefined;
9701
9808
  if (!sourceGroup) {
9702
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9809
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9703
9810
  }
9704
9811
  if (sourceItemId === undefined) {
9705
9812
  /**
@@ -9724,9 +9831,9 @@ class DockviewComponent extends BaseGrid {
9724
9831
  skipSetActiveGroup: true,
9725
9832
  }));
9726
9833
  if (!removedPanel) {
9727
- throw new Error(`No panel with id ${sourceItemId}`);
9834
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9728
9835
  }
9729
- if (sourceGroup.model.size === 0) {
9836
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9730
9837
  // remove the group and do not set a new group as active
9731
9838
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9732
9839
  }
@@ -9736,7 +9843,8 @@ class DockviewComponent extends BaseGrid {
9736
9843
  var _a;
9737
9844
  return destinationGroup.model.openPanel(removedPanel, {
9738
9845
  index: destinationIndex,
9739
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9846
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9847
+ !isDestinationGroupEmpty,
9740
9848
  skipSetGroupActive: true,
9741
9849
  });
9742
9850
  });
@@ -9747,6 +9855,13 @@ class DockviewComponent extends BaseGrid {
9747
9855
  panel: removedPanel,
9748
9856
  from: sourceGroup,
9749
9857
  });
9858
+ /**
9859
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9860
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9861
+ */
9862
+ requestAnimationFrame(() => {
9863
+ this.overlayRenderContainer.updateAllPositions();
9864
+ });
9750
9865
  }
9751
9866
  else {
9752
9867
  /**
@@ -9791,7 +9906,9 @@ class DockviewComponent extends BaseGrid {
9791
9906
  }));
9792
9907
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9793
9908
  const newGroup = this.createGroupAtLocation(targetLocation);
9794
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9909
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9910
+ skipSetActive: true,
9911
+ }));
9795
9912
  this.doSetGroupAndPanelActive(newGroup);
9796
9913
  this._onDidMovePanel.fire({
9797
9914
  panel: this.getGroupPanel(sourceItemId),
@@ -9824,7 +9941,7 @@ class DockviewComponent extends BaseGrid {
9824
9941
  skipSetActiveGroup: true,
9825
9942
  }));
9826
9943
  if (!removedPanel) {
9827
- throw new Error(`No panel with id ${sourceItemId}`);
9944
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9828
9945
  }
9829
9946
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9830
9947
  const group = this.createGroupAtLocation(dropLocation);
@@ -9879,7 +9996,7 @@ class DockviewComponent extends BaseGrid {
9879
9996
  case 'floating': {
9880
9997
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9881
9998
  if (!selectedFloatingGroup) {
9882
- throw new Error('failed to find floating group');
9999
+ throw new Error('dockview: failed to find floating group');
9883
10000
  }
9884
10001
  selectedFloatingGroup.dispose();
9885
10002
  break;
@@ -9887,7 +10004,7 @@ class DockviewComponent extends BaseGrid {
9887
10004
  case 'popout': {
9888
10005
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9889
10006
  if (!selectedPopoutGroup) {
9890
- throw new Error('failed to find popout group');
10007
+ throw new Error('dockview: failed to find popout group');
9891
10008
  }
9892
10009
  // Remove from popout groups list to prevent automatic restoration
9893
10010
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);
@@ -11175,5 +11292,5 @@ function createPaneview(element, options) {
11175
11292
  return new PaneviewApi(component);
11176
11293
  }
11177
11294
 
11178
- export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, LayoutPriority, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewUnhandledDragOverEvent, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, Tab, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, orthogonal, positionToDirection, themeAbyss, themeAbyssSpaced, themeDark, themeDracula, themeLight, themeLightSpaced, themeReplit, themeVisualStudio, toTarget };
11295
+ export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DockviewWillShowOverlayLocationEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, LayoutPriority, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewUnhandledDragOverEvent, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, Tab, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, orthogonal, positionToDirection, themeAbyss, themeAbyssSpaced, themeDark, themeDracula, themeLight, themeLightSpaced, themeReplit, themeVisualStudio, toTarget };
11179
11296
  //# sourceMappingURL=dockview-core.esm.js.map