dockview-core 4.10.0 → 4.12.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 (47) hide show
  1. package/dist/cjs/api/component.api.d.ts +3 -1
  2. package/dist/cjs/api/component.api.js +2 -2
  3. package/dist/cjs/api/dockviewPanelApi.d.ts +1 -1
  4. package/dist/cjs/dockview/components/panel/content.d.ts +7 -0
  5. package/dist/cjs/dockview/components/panel/content.js +11 -0
  6. package/dist/cjs/dockview/dockviewComponent.d.ts +7 -1
  7. package/dist/cjs/dockview/dockviewComponent.js +159 -84
  8. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -0
  9. package/dist/cjs/dockview/dockviewGroupPanel.js +43 -1
  10. package/dist/cjs/dockview/dockviewGroupPanelModel.js +3 -0
  11. package/dist/cjs/dockview/dockviewPanel.d.ts +6 -4
  12. package/dist/cjs/dockview/dockviewPanel.js +12 -0
  13. package/dist/dockview-core.amd.js +162 -35
  14. package/dist/dockview-core.amd.js.map +1 -1
  15. package/dist/dockview-core.amd.min.js +2 -2
  16. package/dist/dockview-core.amd.min.js.map +1 -1
  17. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  18. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  19. package/dist/dockview-core.amd.noStyle.js +162 -35
  20. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  21. package/dist/dockview-core.cjs.js +162 -35
  22. package/dist/dockview-core.cjs.js.map +1 -1
  23. package/dist/dockview-core.esm.js +162 -35
  24. package/dist/dockview-core.esm.js.map +1 -1
  25. package/dist/dockview-core.esm.min.js +2 -2
  26. package/dist/dockview-core.esm.min.js.map +1 -1
  27. package/dist/dockview-core.js +162 -35
  28. package/dist/dockview-core.js.map +1 -1
  29. package/dist/dockview-core.min.js +2 -2
  30. package/dist/dockview-core.min.js.map +1 -1
  31. package/dist/dockview-core.min.noStyle.js +2 -2
  32. package/dist/dockview-core.min.noStyle.js.map +1 -1
  33. package/dist/dockview-core.noStyle.js +162 -35
  34. package/dist/dockview-core.noStyle.js.map +1 -1
  35. package/dist/esm/api/component.api.d.ts +3 -1
  36. package/dist/esm/api/component.api.js +2 -2
  37. package/dist/esm/api/dockviewPanelApi.d.ts +1 -1
  38. package/dist/esm/dockview/components/panel/content.d.ts +7 -0
  39. package/dist/esm/dockview/components/panel/content.js +11 -0
  40. package/dist/esm/dockview/dockviewComponent.d.ts +7 -1
  41. package/dist/esm/dockview/dockviewComponent.js +90 -31
  42. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -0
  43. package/dist/esm/dockview/dockviewGroupPanel.js +43 -1
  44. package/dist/esm/dockview/dockviewGroupPanelModel.js +3 -0
  45. package/dist/esm/dockview/dockviewPanel.d.ts +6 -4
  46. package/dist/esm/dockview/dockviewPanel.js +12 -0
  47. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.10.0
3
+ * @version 4.12.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3781,8 +3781,8 @@ class DockviewApi {
3781
3781
  /**
3782
3782
  * Create a component from a serialized object.
3783
3783
  */
3784
- fromJSON(data) {
3785
- this.component.fromJSON(data);
3784
+ fromJSON(data, options) {
3785
+ this.component.fromJSON(data, options);
3786
3786
  }
3787
3787
  /**
3788
3788
  * Create a serialized object of the current component.
@@ -5013,6 +5013,7 @@ class ContentContainer extends CompositeDisposable {
5013
5013
  }
5014
5014
  if (doRender) {
5015
5015
  const focusTracker = trackFocus(container);
5016
+ this.focusTracker = focusTracker;
5016
5017
  const disposable = new CompositeDisposable();
5017
5018
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
5018
5019
  this.disposable.value = disposable;
@@ -5040,6 +5041,16 @@ class ContentContainer extends CompositeDisposable {
5040
5041
  this.disposable.dispose();
5041
5042
  super.dispose();
5042
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
+ }
5043
5054
  }
5044
5055
 
5045
5056
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -6366,8 +6377,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6366
6377
  this._activePanel = panel;
6367
6378
  if (panel) {
6368
6379
  this.tabsContainer.setActivePanel(panel);
6380
+ this.contentContainer.openPanel(panel);
6369
6381
  panel.layout(this._width, this._height);
6370
6382
  this.updateMru(panel);
6383
+ // Refresh focus state to handle programmatic activation without DOM focus change
6384
+ this.contentContainer.refreshFocusState();
6371
6385
  this._onDidActivePanelChange.fire({
6372
6386
  panel,
6373
6387
  });
@@ -6791,11 +6805,16 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6791
6805
  }
6792
6806
  }
6793
6807
 
6808
+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
6794
6809
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
6795
6810
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6796
6811
  class DockviewGroupPanel extends GridviewPanel {
6797
6812
  get minimumWidth() {
6798
6813
  var _a;
6814
+ // Check for explicitly set group constraint first
6815
+ if (typeof this._explicitConstraints.minimumWidth === 'number') {
6816
+ return this._explicitConstraints.minimumWidth;
6817
+ }
6799
6818
  const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6800
6819
  if (typeof activePanelMinimumWidth === 'number') {
6801
6820
  return activePanelMinimumWidth;
@@ -6804,6 +6823,10 @@ class DockviewGroupPanel extends GridviewPanel {
6804
6823
  }
6805
6824
  get minimumHeight() {
6806
6825
  var _a;
6826
+ // Check for explicitly set group constraint first
6827
+ if (typeof this._explicitConstraints.minimumHeight === 'number') {
6828
+ return this._explicitConstraints.minimumHeight;
6829
+ }
6807
6830
  const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6808
6831
  if (typeof activePanelMinimumHeight === 'number') {
6809
6832
  return activePanelMinimumHeight;
@@ -6812,6 +6835,10 @@ class DockviewGroupPanel extends GridviewPanel {
6812
6835
  }
6813
6836
  get maximumWidth() {
6814
6837
  var _a;
6838
+ // Check for explicitly set group constraint first
6839
+ if (typeof this._explicitConstraints.maximumWidth === 'number') {
6840
+ return this._explicitConstraints.maximumWidth;
6841
+ }
6815
6842
  const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6816
6843
  if (typeof activePanelMaximumWidth === 'number') {
6817
6844
  return activePanelMaximumWidth;
@@ -6820,6 +6847,10 @@ class DockviewGroupPanel extends GridviewPanel {
6820
6847
  }
6821
6848
  get maximumHeight() {
6822
6849
  var _a;
6850
+ // Check for explicitly set group constraint first
6851
+ if (typeof this._explicitConstraints.maximumHeight === 'number') {
6852
+ return this._explicitConstraints.maximumHeight;
6853
+ }
6823
6854
  const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6824
6855
  if (typeof activePanelMaximumHeight === 'number') {
6825
6856
  return activePanelMaximumHeight;
@@ -6851,14 +6882,39 @@ class DockviewGroupPanel extends GridviewPanel {
6851
6882
  var _a, _b, _c, _d, _e, _f;
6852
6883
  super(id, 'groupview_default', {
6853
6884
  minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6854
- minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6885
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6855
6886
  maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6856
6887
  maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6857
6888
  }, new DockviewGroupPanelApiImpl(id, accessor));
6889
+ // Track explicitly set constraints to override panel constraints
6890
+ this._explicitConstraints = {};
6858
6891
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6859
6892
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
6860
6893
  this.addDisposables(this.model.onDidActivePanelChange((event) => {
6861
6894
  this.api._onDidActivePanelChange.fire(event);
6895
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6896
+ // Track explicitly set constraints to override panel constraints
6897
+ // Extract numeric values from functions or values
6898
+ if (event.minimumWidth !== undefined) {
6899
+ this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
6900
+ ? event.minimumWidth()
6901
+ : event.minimumWidth;
6902
+ }
6903
+ if (event.minimumHeight !== undefined) {
6904
+ this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
6905
+ ? event.minimumHeight()
6906
+ : event.minimumHeight;
6907
+ }
6908
+ if (event.maximumWidth !== undefined) {
6909
+ this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
6910
+ ? event.maximumWidth()
6911
+ : event.maximumWidth;
6912
+ }
6913
+ if (event.maximumHeight !== undefined) {
6914
+ this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
6915
+ ? event.maximumHeight()
6916
+ : event.maximumHeight;
6917
+ }
6862
6918
  }));
6863
6919
  }
6864
6920
  focus() {
@@ -7155,6 +7211,18 @@ class DockviewPanel extends CompositeDisposable {
7155
7211
  params: this._params,
7156
7212
  });
7157
7213
  }
7214
+ updateFromStateModel(state) {
7215
+ var _a, _b, _c;
7216
+ this._maximumHeight = state.maximumHeight;
7217
+ this._minimumHeight = state.minimumHeight;
7218
+ this._maximumWidth = state.maximumWidth;
7219
+ this._minimumWidth = state.minimumWidth;
7220
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7221
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7222
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7223
+ // state.contentComponent;
7224
+ // state.tabComponent;
7225
+ }
7158
7226
  updateParentGroup(group, options) {
7159
7227
  this._group = group;
7160
7228
  this.api.group = this._group;
@@ -8941,7 +9009,7 @@ class DockviewComponent extends BaseGrid {
8941
9009
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8942
9010
  const el = group.element.querySelector('.dv-void-container');
8943
9011
  if (!el) {
8944
- throw new Error('failed to find drag handle');
9012
+ throw new Error('dockview: failed to find drag handle');
8945
9013
  }
8946
9014
  overlay.setupDrag(el, {
8947
9015
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -9013,7 +9081,7 @@ class DockviewComponent extends BaseGrid {
9013
9081
  case 'right':
9014
9082
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
9015
9083
  default:
9016
- throw new Error(`unsupported position ${position}`);
9084
+ throw new Error(`dockview: unsupported position ${position}`);
9017
9085
  }
9018
9086
  }
9019
9087
  updateOptions(options) {
@@ -9159,15 +9227,48 @@ class DockviewComponent extends BaseGrid {
9159
9227
  }
9160
9228
  return result;
9161
9229
  }
9162
- fromJSON(data) {
9230
+ fromJSON(data, options) {
9163
9231
  var _a, _b;
9232
+ const existingPanels = new Map();
9233
+ let tempGroup;
9234
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9235
+ /**
9236
+ * What are we doing here?
9237
+ *
9238
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9239
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9240
+ */
9241
+ tempGroup = this.createGroup();
9242
+ this._groups.delete(tempGroup.api.id);
9243
+ const newPanels = Object.keys(data.panels);
9244
+ for (const panel of this.panels) {
9245
+ if (newPanels.includes(panel.api.id)) {
9246
+ existingPanels.set(panel.api.id, panel);
9247
+ }
9248
+ }
9249
+ this.movingLock(() => {
9250
+ Array.from(existingPanels.values()).forEach((panel) => {
9251
+ this.moveGroupOrPanel({
9252
+ from: {
9253
+ groupId: panel.api.group.api.id,
9254
+ panelId: panel.api.id,
9255
+ },
9256
+ to: {
9257
+ group: tempGroup,
9258
+ position: 'center',
9259
+ },
9260
+ keepEmptyGroups: true,
9261
+ });
9262
+ });
9263
+ });
9264
+ }
9164
9265
  this.clear();
9165
9266
  if (typeof data !== 'object' || data === null) {
9166
- throw new Error('serialized layout must be a non-null object');
9267
+ throw new Error('dockview: serialized layout must be a non-null object');
9167
9268
  }
9168
9269
  const { grid, panels, activeGroup } = data;
9169
9270
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9170
- throw new Error('root must be of type branch');
9271
+ throw new Error('dockview: root must be of type branch');
9171
9272
  }
9172
9273
  try {
9173
9274
  // take note of the existing dimensions
@@ -9176,7 +9277,7 @@ class DockviewComponent extends BaseGrid {
9176
9277
  const createGroupFromSerializedState = (data) => {
9177
9278
  const { id, locked, hideHeader, views, activeView } = data;
9178
9279
  if (typeof id !== 'string') {
9179
- throw new Error('group id must be of type string');
9280
+ throw new Error('dockview: group id must be of type string');
9180
9281
  }
9181
9282
  const group = this.createGroup({
9182
9283
  id,
@@ -9191,17 +9292,38 @@ class DockviewComponent extends BaseGrid {
9191
9292
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9192
9293
  * due to a corruption of input data.
9193
9294
  */
9194
- const panel = this._deserializer.fromJSON(panels[child], group);
9195
- createdPanels.push(panel);
9295
+ const existingPanel = existingPanels.get(child);
9296
+ if (tempGroup && existingPanel) {
9297
+ this.movingLock(() => {
9298
+ tempGroup.model.removePanel(existingPanel);
9299
+ });
9300
+ createdPanels.push(existingPanel);
9301
+ existingPanel.updateFromStateModel(panels[child]);
9302
+ }
9303
+ else {
9304
+ const panel = this._deserializer.fromJSON(panels[child], group);
9305
+ createdPanels.push(panel);
9306
+ }
9196
9307
  }
9197
9308
  for (let i = 0; i < views.length; i++) {
9198
9309
  const panel = createdPanels[i];
9199
9310
  const isActive = typeof activeView === 'string' &&
9200
9311
  activeView === panel.id;
9201
- group.model.openPanel(panel, {
9202
- skipSetActive: !isActive,
9203
- skipSetGroupActive: true,
9204
- });
9312
+ const hasExisting = existingPanels.has(panel.api.id);
9313
+ if (hasExisting) {
9314
+ this.movingLock(() => {
9315
+ group.model.openPanel(panel, {
9316
+ skipSetActive: !isActive,
9317
+ skipSetGroupActive: true,
9318
+ });
9319
+ });
9320
+ }
9321
+ else {
9322
+ group.model.openPanel(panel, {
9323
+ skipSetActive: !isActive,
9324
+ skipSetGroupActive: true,
9325
+ });
9326
+ }
9205
9327
  }
9206
9328
  if (!group.activePanel && group.panels.length > 0) {
9207
9329
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9240,7 +9362,9 @@ class DockviewComponent extends BaseGrid {
9240
9362
  setTimeout(() => {
9241
9363
  this.addPopoutGroup(group, {
9242
9364
  position: position !== null && position !== void 0 ? position : undefined,
9243
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9365
+ overridePopoutGroup: gridReferenceGroup
9366
+ ? group
9367
+ : undefined,
9244
9368
  referenceGroup: gridReferenceGroup
9245
9369
  ? this.getPanel(gridReferenceGroup)
9246
9370
  : undefined,
@@ -9326,11 +9450,11 @@ class DockviewComponent extends BaseGrid {
9326
9450
  addPanel(options) {
9327
9451
  var _a, _b;
9328
9452
  if (this.panels.find((_) => _.id === options.id)) {
9329
- throw new Error(`panel with id ${options.id} already exists`);
9453
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9330
9454
  }
9331
9455
  let referenceGroup;
9332
9456
  if (options.position && options.floating) {
9333
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9457
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9334
9458
  }
9335
9459
  const initial = {
9336
9460
  width: options.initialWidth,
@@ -9344,7 +9468,7 @@ class DockviewComponent extends BaseGrid {
9344
9468
  : options.position.referencePanel;
9345
9469
  index = options.position.index;
9346
9470
  if (!referencePanel) {
9347
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9471
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9348
9472
  }
9349
9473
  referenceGroup = this.findGroup(referencePanel);
9350
9474
  }
@@ -9355,7 +9479,7 @@ class DockviewComponent extends BaseGrid {
9355
9479
  : options.position.referenceGroup;
9356
9480
  index = options.position.index;
9357
9481
  if (!referenceGroup) {
9358
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9482
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9359
9483
  }
9360
9484
  }
9361
9485
  else {
@@ -9467,7 +9591,7 @@ class DockviewComponent extends BaseGrid {
9467
9591
  }) {
9468
9592
  const group = panel.group;
9469
9593
  if (!group) {
9470
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9594
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9471
9595
  }
9472
9596
  group.model.removePanel(panel, {
9473
9597
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9516,11 +9640,11 @@ class DockviewComponent extends BaseGrid {
9516
9640
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9517
9641
  : options.referencePanel;
9518
9642
  if (!referencePanel) {
9519
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9643
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9520
9644
  }
9521
9645
  referenceGroup = this.findGroup(referencePanel);
9522
9646
  if (!referenceGroup) {
9523
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9647
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9524
9648
  }
9525
9649
  }
9526
9650
  else if (isGroupOptionsWithGroup(options)) {
@@ -9529,7 +9653,7 @@ class DockviewComponent extends BaseGrid {
9529
9653
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9530
9654
  : options.referenceGroup;
9531
9655
  if (!referenceGroup) {
9532
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9656
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9533
9657
  }
9534
9658
  }
9535
9659
  else {
@@ -9597,7 +9721,7 @@ class DockviewComponent extends BaseGrid {
9597
9721
  }
9598
9722
  return floatingGroup.group;
9599
9723
  }
9600
- throw new Error('failed to find floating group');
9724
+ throw new Error('dockview: failed to find floating group');
9601
9725
  }
9602
9726
  if (group.api.location.type === 'popout') {
9603
9727
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9628,7 +9752,7 @@ class DockviewComponent extends BaseGrid {
9628
9752
  this.updateWatermark();
9629
9753
  return selectedGroup.popoutGroup;
9630
9754
  }
9631
- throw new Error('failed to find popout group');
9755
+ throw new Error('dockview: failed to find popout group');
9632
9756
  }
9633
9757
  const re = super.doRemoveGroup(group, options);
9634
9758
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9659,7 +9783,7 @@ class DockviewComponent extends BaseGrid {
9659
9783
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9660
9784
  : undefined;
9661
9785
  if (!sourceGroup) {
9662
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9786
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9663
9787
  }
9664
9788
  if (sourceItemId === undefined) {
9665
9789
  /**
@@ -9684,9 +9808,9 @@ class DockviewComponent extends BaseGrid {
9684
9808
  skipSetActiveGroup: true,
9685
9809
  }));
9686
9810
  if (!removedPanel) {
9687
- throw new Error(`No panel with id ${sourceItemId}`);
9811
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9688
9812
  }
9689
- if (sourceGroup.model.size === 0) {
9813
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9690
9814
  // remove the group and do not set a new group as active
9691
9815
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9692
9816
  }
@@ -9696,7 +9820,8 @@ class DockviewComponent extends BaseGrid {
9696
9820
  var _a;
9697
9821
  return destinationGroup.model.openPanel(removedPanel, {
9698
9822
  index: destinationIndex,
9699
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9823
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9824
+ !isDestinationGroupEmpty,
9700
9825
  skipSetGroupActive: true,
9701
9826
  });
9702
9827
  });
@@ -9751,7 +9876,9 @@ class DockviewComponent extends BaseGrid {
9751
9876
  }));
9752
9877
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9753
9878
  const newGroup = this.createGroupAtLocation(targetLocation);
9754
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9879
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9880
+ skipSetActive: true,
9881
+ }));
9755
9882
  this.doSetGroupAndPanelActive(newGroup);
9756
9883
  this._onDidMovePanel.fire({
9757
9884
  panel: this.getGroupPanel(sourceItemId),
@@ -9784,7 +9911,7 @@ class DockviewComponent extends BaseGrid {
9784
9911
  skipSetActiveGroup: true,
9785
9912
  }));
9786
9913
  if (!removedPanel) {
9787
- throw new Error(`No panel with id ${sourceItemId}`);
9914
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9788
9915
  }
9789
9916
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9790
9917
  const group = this.createGroupAtLocation(dropLocation);
@@ -9839,7 +9966,7 @@ class DockviewComponent extends BaseGrid {
9839
9966
  case 'floating': {
9840
9967
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9841
9968
  if (!selectedFloatingGroup) {
9842
- throw new Error('failed to find floating group');
9969
+ throw new Error('dockview: failed to find floating group');
9843
9970
  }
9844
9971
  selectedFloatingGroup.dispose();
9845
9972
  break;
@@ -9847,7 +9974,7 @@ class DockviewComponent extends BaseGrid {
9847
9974
  case 'popout': {
9848
9975
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9849
9976
  if (!selectedPopoutGroup) {
9850
- throw new Error('failed to find popout group');
9977
+ throw new Error('dockview: failed to find popout group');
9851
9978
  }
9852
9979
  // Remove from popout groups list to prevent automatic restoration
9853
9980
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);