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
  */
@@ -3779,8 +3779,8 @@ class DockviewApi {
3779
3779
  /**
3780
3780
  * Create a component from a serialized object.
3781
3781
  */
3782
- fromJSON(data) {
3783
- this.component.fromJSON(data);
3782
+ fromJSON(data, options) {
3783
+ this.component.fromJSON(data, options);
3784
3784
  }
3785
3785
  /**
3786
3786
  * Create a serialized object of the current component.
@@ -5011,6 +5011,7 @@ class ContentContainer extends CompositeDisposable {
5011
5011
  }
5012
5012
  if (doRender) {
5013
5013
  const focusTracker = trackFocus(container);
5014
+ this.focusTracker = focusTracker;
5014
5015
  const disposable = new CompositeDisposable();
5015
5016
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
5016
5017
  this.disposable.value = disposable;
@@ -5038,6 +5039,16 @@ class ContentContainer extends CompositeDisposable {
5038
5039
  this.disposable.dispose();
5039
5040
  super.dispose();
5040
5041
  }
5042
+ /**
5043
+ * Refresh the focus tracker state to handle cases where focus state
5044
+ * gets out of sync due to programmatic panel activation
5045
+ */
5046
+ refreshFocusState() {
5047
+ var _a;
5048
+ if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
5049
+ this.focusTracker.refreshState();
5050
+ }
5051
+ }
5041
5052
  }
5042
5053
 
5043
5054
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -6364,8 +6375,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6364
6375
  this._activePanel = panel;
6365
6376
  if (panel) {
6366
6377
  this.tabsContainer.setActivePanel(panel);
6378
+ this.contentContainer.openPanel(panel);
6367
6379
  panel.layout(this._width, this._height);
6368
6380
  this.updateMru(panel);
6381
+ // Refresh focus state to handle programmatic activation without DOM focus change
6382
+ this.contentContainer.refreshFocusState();
6369
6383
  this._onDidActivePanelChange.fire({
6370
6384
  panel,
6371
6385
  });
@@ -6789,11 +6803,16 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6789
6803
  }
6790
6804
  }
6791
6805
 
6806
+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
6792
6807
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
6793
6808
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6794
6809
  class DockviewGroupPanel extends GridviewPanel {
6795
6810
  get minimumWidth() {
6796
6811
  var _a;
6812
+ // Check for explicitly set group constraint first
6813
+ if (typeof this._explicitConstraints.minimumWidth === 'number') {
6814
+ return this._explicitConstraints.minimumWidth;
6815
+ }
6797
6816
  const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6798
6817
  if (typeof activePanelMinimumWidth === 'number') {
6799
6818
  return activePanelMinimumWidth;
@@ -6802,6 +6821,10 @@ class DockviewGroupPanel extends GridviewPanel {
6802
6821
  }
6803
6822
  get minimumHeight() {
6804
6823
  var _a;
6824
+ // Check for explicitly set group constraint first
6825
+ if (typeof this._explicitConstraints.minimumHeight === 'number') {
6826
+ return this._explicitConstraints.minimumHeight;
6827
+ }
6805
6828
  const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6806
6829
  if (typeof activePanelMinimumHeight === 'number') {
6807
6830
  return activePanelMinimumHeight;
@@ -6810,6 +6833,10 @@ class DockviewGroupPanel extends GridviewPanel {
6810
6833
  }
6811
6834
  get maximumWidth() {
6812
6835
  var _a;
6836
+ // Check for explicitly set group constraint first
6837
+ if (typeof this._explicitConstraints.maximumWidth === 'number') {
6838
+ return this._explicitConstraints.maximumWidth;
6839
+ }
6813
6840
  const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6814
6841
  if (typeof activePanelMaximumWidth === 'number') {
6815
6842
  return activePanelMaximumWidth;
@@ -6818,6 +6845,10 @@ class DockviewGroupPanel extends GridviewPanel {
6818
6845
  }
6819
6846
  get maximumHeight() {
6820
6847
  var _a;
6848
+ // Check for explicitly set group constraint first
6849
+ if (typeof this._explicitConstraints.maximumHeight === 'number') {
6850
+ return this._explicitConstraints.maximumHeight;
6851
+ }
6821
6852
  const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6822
6853
  if (typeof activePanelMaximumHeight === 'number') {
6823
6854
  return activePanelMaximumHeight;
@@ -6849,14 +6880,39 @@ class DockviewGroupPanel extends GridviewPanel {
6849
6880
  var _a, _b, _c, _d, _e, _f;
6850
6881
  super(id, 'groupview_default', {
6851
6882
  minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6852
- minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6883
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6853
6884
  maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6854
6885
  maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6855
6886
  }, new DockviewGroupPanelApiImpl(id, accessor));
6887
+ // Track explicitly set constraints to override panel constraints
6888
+ this._explicitConstraints = {};
6856
6889
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6857
6890
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
6858
6891
  this.addDisposables(this.model.onDidActivePanelChange((event) => {
6859
6892
  this.api._onDidActivePanelChange.fire(event);
6893
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6894
+ // Track explicitly set constraints to override panel constraints
6895
+ // Extract numeric values from functions or values
6896
+ if (event.minimumWidth !== undefined) {
6897
+ this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
6898
+ ? event.minimumWidth()
6899
+ : event.minimumWidth;
6900
+ }
6901
+ if (event.minimumHeight !== undefined) {
6902
+ this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
6903
+ ? event.minimumHeight()
6904
+ : event.minimumHeight;
6905
+ }
6906
+ if (event.maximumWidth !== undefined) {
6907
+ this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
6908
+ ? event.maximumWidth()
6909
+ : event.maximumWidth;
6910
+ }
6911
+ if (event.maximumHeight !== undefined) {
6912
+ this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
6913
+ ? event.maximumHeight()
6914
+ : event.maximumHeight;
6915
+ }
6860
6916
  }));
6861
6917
  }
6862
6918
  focus() {
@@ -7153,6 +7209,18 @@ class DockviewPanel extends CompositeDisposable {
7153
7209
  params: this._params,
7154
7210
  });
7155
7211
  }
7212
+ updateFromStateModel(state) {
7213
+ var _a, _b, _c;
7214
+ this._maximumHeight = state.maximumHeight;
7215
+ this._minimumHeight = state.minimumHeight;
7216
+ this._maximumWidth = state.maximumWidth;
7217
+ this._minimumWidth = state.minimumWidth;
7218
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7219
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7220
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7221
+ // state.contentComponent;
7222
+ // state.tabComponent;
7223
+ }
7156
7224
  updateParentGroup(group, options) {
7157
7225
  this._group = group;
7158
7226
  this.api.group = this._group;
@@ -8939,7 +9007,7 @@ class DockviewComponent extends BaseGrid {
8939
9007
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8940
9008
  const el = group.element.querySelector('.dv-void-container');
8941
9009
  if (!el) {
8942
- throw new Error('failed to find drag handle');
9010
+ throw new Error('dockview: failed to find drag handle');
8943
9011
  }
8944
9012
  overlay.setupDrag(el, {
8945
9013
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -9011,7 +9079,7 @@ class DockviewComponent extends BaseGrid {
9011
9079
  case 'right':
9012
9080
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
9013
9081
  default:
9014
- throw new Error(`unsupported position ${position}`);
9082
+ throw new Error(`dockview: unsupported position ${position}`);
9015
9083
  }
9016
9084
  }
9017
9085
  updateOptions(options) {
@@ -9157,15 +9225,48 @@ class DockviewComponent extends BaseGrid {
9157
9225
  }
9158
9226
  return result;
9159
9227
  }
9160
- fromJSON(data) {
9228
+ fromJSON(data, options) {
9161
9229
  var _a, _b;
9230
+ const existingPanels = new Map();
9231
+ let tempGroup;
9232
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9233
+ /**
9234
+ * What are we doing here?
9235
+ *
9236
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9237
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9238
+ */
9239
+ tempGroup = this.createGroup();
9240
+ this._groups.delete(tempGroup.api.id);
9241
+ const newPanels = Object.keys(data.panels);
9242
+ for (const panel of this.panels) {
9243
+ if (newPanels.includes(panel.api.id)) {
9244
+ existingPanels.set(panel.api.id, panel);
9245
+ }
9246
+ }
9247
+ this.movingLock(() => {
9248
+ Array.from(existingPanels.values()).forEach((panel) => {
9249
+ this.moveGroupOrPanel({
9250
+ from: {
9251
+ groupId: panel.api.group.api.id,
9252
+ panelId: panel.api.id,
9253
+ },
9254
+ to: {
9255
+ group: tempGroup,
9256
+ position: 'center',
9257
+ },
9258
+ keepEmptyGroups: true,
9259
+ });
9260
+ });
9261
+ });
9262
+ }
9162
9263
  this.clear();
9163
9264
  if (typeof data !== 'object' || data === null) {
9164
- throw new Error('serialized layout must be a non-null object');
9265
+ throw new Error('dockview: serialized layout must be a non-null object');
9165
9266
  }
9166
9267
  const { grid, panels, activeGroup } = data;
9167
9268
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9168
- throw new Error('root must be of type branch');
9269
+ throw new Error('dockview: root must be of type branch');
9169
9270
  }
9170
9271
  try {
9171
9272
  // take note of the existing dimensions
@@ -9174,7 +9275,7 @@ class DockviewComponent extends BaseGrid {
9174
9275
  const createGroupFromSerializedState = (data) => {
9175
9276
  const { id, locked, hideHeader, views, activeView } = data;
9176
9277
  if (typeof id !== 'string') {
9177
- throw new Error('group id must be of type string');
9278
+ throw new Error('dockview: group id must be of type string');
9178
9279
  }
9179
9280
  const group = this.createGroup({
9180
9281
  id,
@@ -9189,17 +9290,38 @@ class DockviewComponent extends BaseGrid {
9189
9290
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9190
9291
  * due to a corruption of input data.
9191
9292
  */
9192
- const panel = this._deserializer.fromJSON(panels[child], group);
9193
- createdPanels.push(panel);
9293
+ const existingPanel = existingPanels.get(child);
9294
+ if (tempGroup && existingPanel) {
9295
+ this.movingLock(() => {
9296
+ tempGroup.model.removePanel(existingPanel);
9297
+ });
9298
+ createdPanels.push(existingPanel);
9299
+ existingPanel.updateFromStateModel(panels[child]);
9300
+ }
9301
+ else {
9302
+ const panel = this._deserializer.fromJSON(panels[child], group);
9303
+ createdPanels.push(panel);
9304
+ }
9194
9305
  }
9195
9306
  for (let i = 0; i < views.length; i++) {
9196
9307
  const panel = createdPanels[i];
9197
9308
  const isActive = typeof activeView === 'string' &&
9198
9309
  activeView === panel.id;
9199
- group.model.openPanel(panel, {
9200
- skipSetActive: !isActive,
9201
- skipSetGroupActive: true,
9202
- });
9310
+ const hasExisting = existingPanels.has(panel.api.id);
9311
+ if (hasExisting) {
9312
+ this.movingLock(() => {
9313
+ group.model.openPanel(panel, {
9314
+ skipSetActive: !isActive,
9315
+ skipSetGroupActive: true,
9316
+ });
9317
+ });
9318
+ }
9319
+ else {
9320
+ group.model.openPanel(panel, {
9321
+ skipSetActive: !isActive,
9322
+ skipSetGroupActive: true,
9323
+ });
9324
+ }
9203
9325
  }
9204
9326
  if (!group.activePanel && group.panels.length > 0) {
9205
9327
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9238,7 +9360,9 @@ class DockviewComponent extends BaseGrid {
9238
9360
  setTimeout(() => {
9239
9361
  this.addPopoutGroup(group, {
9240
9362
  position: position !== null && position !== void 0 ? position : undefined,
9241
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9363
+ overridePopoutGroup: gridReferenceGroup
9364
+ ? group
9365
+ : undefined,
9242
9366
  referenceGroup: gridReferenceGroup
9243
9367
  ? this.getPanel(gridReferenceGroup)
9244
9368
  : undefined,
@@ -9324,11 +9448,11 @@ class DockviewComponent extends BaseGrid {
9324
9448
  addPanel(options) {
9325
9449
  var _a, _b;
9326
9450
  if (this.panels.find((_) => _.id === options.id)) {
9327
- throw new Error(`panel with id ${options.id} already exists`);
9451
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9328
9452
  }
9329
9453
  let referenceGroup;
9330
9454
  if (options.position && options.floating) {
9331
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9455
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9332
9456
  }
9333
9457
  const initial = {
9334
9458
  width: options.initialWidth,
@@ -9342,7 +9466,7 @@ class DockviewComponent extends BaseGrid {
9342
9466
  : options.position.referencePanel;
9343
9467
  index = options.position.index;
9344
9468
  if (!referencePanel) {
9345
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9469
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9346
9470
  }
9347
9471
  referenceGroup = this.findGroup(referencePanel);
9348
9472
  }
@@ -9353,7 +9477,7 @@ class DockviewComponent extends BaseGrid {
9353
9477
  : options.position.referenceGroup;
9354
9478
  index = options.position.index;
9355
9479
  if (!referenceGroup) {
9356
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9480
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9357
9481
  }
9358
9482
  }
9359
9483
  else {
@@ -9465,7 +9589,7 @@ class DockviewComponent extends BaseGrid {
9465
9589
  }) {
9466
9590
  const group = panel.group;
9467
9591
  if (!group) {
9468
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9592
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9469
9593
  }
9470
9594
  group.model.removePanel(panel, {
9471
9595
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9514,11 +9638,11 @@ class DockviewComponent extends BaseGrid {
9514
9638
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9515
9639
  : options.referencePanel;
9516
9640
  if (!referencePanel) {
9517
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9641
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9518
9642
  }
9519
9643
  referenceGroup = this.findGroup(referencePanel);
9520
9644
  if (!referenceGroup) {
9521
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9645
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9522
9646
  }
9523
9647
  }
9524
9648
  else if (isGroupOptionsWithGroup(options)) {
@@ -9527,7 +9651,7 @@ class DockviewComponent extends BaseGrid {
9527
9651
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9528
9652
  : options.referenceGroup;
9529
9653
  if (!referenceGroup) {
9530
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9654
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9531
9655
  }
9532
9656
  }
9533
9657
  else {
@@ -9595,7 +9719,7 @@ class DockviewComponent extends BaseGrid {
9595
9719
  }
9596
9720
  return floatingGroup.group;
9597
9721
  }
9598
- throw new Error('failed to find floating group');
9722
+ throw new Error('dockview: failed to find floating group');
9599
9723
  }
9600
9724
  if (group.api.location.type === 'popout') {
9601
9725
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9626,7 +9750,7 @@ class DockviewComponent extends BaseGrid {
9626
9750
  this.updateWatermark();
9627
9751
  return selectedGroup.popoutGroup;
9628
9752
  }
9629
- throw new Error('failed to find popout group');
9753
+ throw new Error('dockview: failed to find popout group');
9630
9754
  }
9631
9755
  const re = super.doRemoveGroup(group, options);
9632
9756
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9657,7 +9781,7 @@ class DockviewComponent extends BaseGrid {
9657
9781
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9658
9782
  : undefined;
9659
9783
  if (!sourceGroup) {
9660
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9784
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9661
9785
  }
9662
9786
  if (sourceItemId === undefined) {
9663
9787
  /**
@@ -9682,9 +9806,9 @@ class DockviewComponent extends BaseGrid {
9682
9806
  skipSetActiveGroup: true,
9683
9807
  }));
9684
9808
  if (!removedPanel) {
9685
- throw new Error(`No panel with id ${sourceItemId}`);
9809
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9686
9810
  }
9687
- if (sourceGroup.model.size === 0) {
9811
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9688
9812
  // remove the group and do not set a new group as active
9689
9813
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9690
9814
  }
@@ -9694,7 +9818,8 @@ class DockviewComponent extends BaseGrid {
9694
9818
  var _a;
9695
9819
  return destinationGroup.model.openPanel(removedPanel, {
9696
9820
  index: destinationIndex,
9697
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9821
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9822
+ !isDestinationGroupEmpty,
9698
9823
  skipSetGroupActive: true,
9699
9824
  });
9700
9825
  });
@@ -9749,7 +9874,9 @@ class DockviewComponent extends BaseGrid {
9749
9874
  }));
9750
9875
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9751
9876
  const newGroup = this.createGroupAtLocation(targetLocation);
9752
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9877
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9878
+ skipSetActive: true,
9879
+ }));
9753
9880
  this.doSetGroupAndPanelActive(newGroup);
9754
9881
  this._onDidMovePanel.fire({
9755
9882
  panel: this.getGroupPanel(sourceItemId),
@@ -9782,7 +9909,7 @@ class DockviewComponent extends BaseGrid {
9782
9909
  skipSetActiveGroup: true,
9783
9910
  }));
9784
9911
  if (!removedPanel) {
9785
- throw new Error(`No panel with id ${sourceItemId}`);
9912
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9786
9913
  }
9787
9914
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9788
9915
  const group = this.createGroupAtLocation(dropLocation);
@@ -9837,7 +9964,7 @@ class DockviewComponent extends BaseGrid {
9837
9964
  case 'floating': {
9838
9965
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9839
9966
  if (!selectedFloatingGroup) {
9840
- throw new Error('failed to find floating group');
9967
+ throw new Error('dockview: failed to find floating group');
9841
9968
  }
9842
9969
  selectedFloatingGroup.dispose();
9843
9970
  break;
@@ -9845,7 +9972,7 @@ class DockviewComponent extends BaseGrid {
9845
9972
  case 'popout': {
9846
9973
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9847
9974
  if (!selectedPopoutGroup) {
9848
- throw new Error('failed to find popout group');
9975
+ throw new Error('dockview: failed to find popout group');
9849
9976
  }
9850
9977
  // Remove from popout groups list to prevent automatic restoration
9851
9978
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);