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
  */
@@ -3751,8 +3751,8 @@ define(['exports'], (function (exports) { 'use strict';
3751
3751
  /**
3752
3752
  * Create a component from a serialized object.
3753
3753
  */
3754
- fromJSON(data) {
3755
- this.component.fromJSON(data);
3754
+ fromJSON(data, options) {
3755
+ this.component.fromJSON(data, options);
3756
3756
  }
3757
3757
  /**
3758
3758
  * Create a serialized object of the current component.
@@ -4983,6 +4983,7 @@ define(['exports'], (function (exports) { 'use strict';
4983
4983
  }
4984
4984
  if (doRender) {
4985
4985
  const focusTracker = trackFocus(container);
4986
+ this.focusTracker = focusTracker;
4986
4987
  const disposable = new CompositeDisposable();
4987
4988
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
4988
4989
  this.disposable.value = disposable;
@@ -5010,6 +5011,16 @@ define(['exports'], (function (exports) { 'use strict';
5010
5011
  this.disposable.dispose();
5011
5012
  super.dispose();
5012
5013
  }
5014
+ /**
5015
+ * Refresh the focus tracker state to handle cases where focus state
5016
+ * gets out of sync due to programmatic panel activation
5017
+ */
5018
+ refreshFocusState() {
5019
+ var _a;
5020
+ if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
5021
+ this.focusTracker.refreshState();
5022
+ }
5023
+ }
5013
5024
  }
5014
5025
 
5015
5026
  function addGhostImage(dataTransfer, ghostElement, options) {
@@ -6336,8 +6347,11 @@ define(['exports'], (function (exports) { 'use strict';
6336
6347
  this._activePanel = panel;
6337
6348
  if (panel) {
6338
6349
  this.tabsContainer.setActivePanel(panel);
6350
+ this.contentContainer.openPanel(panel);
6339
6351
  panel.layout(this._width, this._height);
6340
6352
  this.updateMru(panel);
6353
+ // Refresh focus state to handle programmatic activation without DOM focus change
6354
+ this.contentContainer.refreshFocusState();
6341
6355
  this._onDidActivePanelChange.fire({
6342
6356
  panel,
6343
6357
  });
@@ -6761,11 +6775,16 @@ define(['exports'], (function (exports) { 'use strict';
6761
6775
  }
6762
6776
  }
6763
6777
 
6778
+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
6764
6779
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
6765
6780
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6766
6781
  class DockviewGroupPanel extends GridviewPanel {
6767
6782
  get minimumWidth() {
6768
6783
  var _a;
6784
+ // Check for explicitly set group constraint first
6785
+ if (typeof this._explicitConstraints.minimumWidth === 'number') {
6786
+ return this._explicitConstraints.minimumWidth;
6787
+ }
6769
6788
  const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6770
6789
  if (typeof activePanelMinimumWidth === 'number') {
6771
6790
  return activePanelMinimumWidth;
@@ -6774,6 +6793,10 @@ define(['exports'], (function (exports) { 'use strict';
6774
6793
  }
6775
6794
  get minimumHeight() {
6776
6795
  var _a;
6796
+ // Check for explicitly set group constraint first
6797
+ if (typeof this._explicitConstraints.minimumHeight === 'number') {
6798
+ return this._explicitConstraints.minimumHeight;
6799
+ }
6777
6800
  const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6778
6801
  if (typeof activePanelMinimumHeight === 'number') {
6779
6802
  return activePanelMinimumHeight;
@@ -6782,6 +6805,10 @@ define(['exports'], (function (exports) { 'use strict';
6782
6805
  }
6783
6806
  get maximumWidth() {
6784
6807
  var _a;
6808
+ // Check for explicitly set group constraint first
6809
+ if (typeof this._explicitConstraints.maximumWidth === 'number') {
6810
+ return this._explicitConstraints.maximumWidth;
6811
+ }
6785
6812
  const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6786
6813
  if (typeof activePanelMaximumWidth === 'number') {
6787
6814
  return activePanelMaximumWidth;
@@ -6790,6 +6817,10 @@ define(['exports'], (function (exports) { 'use strict';
6790
6817
  }
6791
6818
  get maximumHeight() {
6792
6819
  var _a;
6820
+ // Check for explicitly set group constraint first
6821
+ if (typeof this._explicitConstraints.maximumHeight === 'number') {
6822
+ return this._explicitConstraints.maximumHeight;
6823
+ }
6793
6824
  const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6794
6825
  if (typeof activePanelMaximumHeight === 'number') {
6795
6826
  return activePanelMaximumHeight;
@@ -6821,14 +6852,39 @@ define(['exports'], (function (exports) { 'use strict';
6821
6852
  var _a, _b, _c, _d, _e, _f;
6822
6853
  super(id, 'groupview_default', {
6823
6854
  minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6824
- minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6855
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6825
6856
  maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6826
6857
  maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6827
6858
  }, new DockviewGroupPanelApiImpl(id, accessor));
6859
+ // Track explicitly set constraints to override panel constraints
6860
+ this._explicitConstraints = {};
6828
6861
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6829
6862
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
6830
6863
  this.addDisposables(this.model.onDidActivePanelChange((event) => {
6831
6864
  this.api._onDidActivePanelChange.fire(event);
6865
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6866
+ // Track explicitly set constraints to override panel constraints
6867
+ // Extract numeric values from functions or values
6868
+ if (event.minimumWidth !== undefined) {
6869
+ this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
6870
+ ? event.minimumWidth()
6871
+ : event.minimumWidth;
6872
+ }
6873
+ if (event.minimumHeight !== undefined) {
6874
+ this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
6875
+ ? event.minimumHeight()
6876
+ : event.minimumHeight;
6877
+ }
6878
+ if (event.maximumWidth !== undefined) {
6879
+ this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
6880
+ ? event.maximumWidth()
6881
+ : event.maximumWidth;
6882
+ }
6883
+ if (event.maximumHeight !== undefined) {
6884
+ this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
6885
+ ? event.maximumHeight()
6886
+ : event.maximumHeight;
6887
+ }
6832
6888
  }));
6833
6889
  }
6834
6890
  focus() {
@@ -7125,6 +7181,18 @@ define(['exports'], (function (exports) { 'use strict';
7125
7181
  params: this._params,
7126
7182
  });
7127
7183
  }
7184
+ updateFromStateModel(state) {
7185
+ var _a, _b, _c;
7186
+ this._maximumHeight = state.maximumHeight;
7187
+ this._minimumHeight = state.minimumHeight;
7188
+ this._maximumWidth = state.maximumWidth;
7189
+ this._minimumWidth = state.minimumWidth;
7190
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
7191
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
7192
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
7193
+ // state.contentComponent;
7194
+ // state.tabComponent;
7195
+ }
7128
7196
  updateParentGroup(group, options) {
7129
7197
  this._group = group;
7130
7198
  this.api.group = this._group;
@@ -8911,7 +8979,7 @@ define(['exports'], (function (exports) { 'use strict';
8911
8979
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
8912
8980
  const el = group.element.querySelector('.dv-void-container');
8913
8981
  if (!el) {
8914
- throw new Error('failed to find drag handle');
8982
+ throw new Error('dockview: failed to find drag handle');
8915
8983
  }
8916
8984
  overlay.setupDrag(el, {
8917
8985
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -8983,7 +9051,7 @@ define(['exports'], (function (exports) { 'use strict';
8983
9051
  case 'right':
8984
9052
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
8985
9053
  default:
8986
- throw new Error(`unsupported position ${position}`);
9054
+ throw new Error(`dockview: unsupported position ${position}`);
8987
9055
  }
8988
9056
  }
8989
9057
  updateOptions(options) {
@@ -9129,15 +9197,48 @@ define(['exports'], (function (exports) { 'use strict';
9129
9197
  }
9130
9198
  return result;
9131
9199
  }
9132
- fromJSON(data) {
9200
+ fromJSON(data, options) {
9133
9201
  var _a, _b;
9202
+ const existingPanels = new Map();
9203
+ let tempGroup;
9204
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
9205
+ /**
9206
+ * What are we doing here?
9207
+ *
9208
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
9209
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
9210
+ */
9211
+ tempGroup = this.createGroup();
9212
+ this._groups.delete(tempGroup.api.id);
9213
+ const newPanels = Object.keys(data.panels);
9214
+ for (const panel of this.panels) {
9215
+ if (newPanels.includes(panel.api.id)) {
9216
+ existingPanels.set(panel.api.id, panel);
9217
+ }
9218
+ }
9219
+ this.movingLock(() => {
9220
+ Array.from(existingPanels.values()).forEach((panel) => {
9221
+ this.moveGroupOrPanel({
9222
+ from: {
9223
+ groupId: panel.api.group.api.id,
9224
+ panelId: panel.api.id,
9225
+ },
9226
+ to: {
9227
+ group: tempGroup,
9228
+ position: 'center',
9229
+ },
9230
+ keepEmptyGroups: true,
9231
+ });
9232
+ });
9233
+ });
9234
+ }
9134
9235
  this.clear();
9135
9236
  if (typeof data !== 'object' || data === null) {
9136
- throw new Error('serialized layout must be a non-null object');
9237
+ throw new Error('dockview: serialized layout must be a non-null object');
9137
9238
  }
9138
9239
  const { grid, panels, activeGroup } = data;
9139
9240
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
9140
- throw new Error('root must be of type branch');
9241
+ throw new Error('dockview: root must be of type branch');
9141
9242
  }
9142
9243
  try {
9143
9244
  // take note of the existing dimensions
@@ -9146,7 +9247,7 @@ define(['exports'], (function (exports) { 'use strict';
9146
9247
  const createGroupFromSerializedState = (data) => {
9147
9248
  const { id, locked, hideHeader, views, activeView } = data;
9148
9249
  if (typeof id !== 'string') {
9149
- throw new Error('group id must be of type string');
9250
+ throw new Error('dockview: group id must be of type string');
9150
9251
  }
9151
9252
  const group = this.createGroup({
9152
9253
  id,
@@ -9161,17 +9262,38 @@ define(['exports'], (function (exports) { 'use strict';
9161
9262
  * In running this section first we avoid firing lots of 'add' events in the event of a failure
9162
9263
  * due to a corruption of input data.
9163
9264
  */
9164
- const panel = this._deserializer.fromJSON(panels[child], group);
9165
- createdPanels.push(panel);
9265
+ const existingPanel = existingPanels.get(child);
9266
+ if (tempGroup && existingPanel) {
9267
+ this.movingLock(() => {
9268
+ tempGroup.model.removePanel(existingPanel);
9269
+ });
9270
+ createdPanels.push(existingPanel);
9271
+ existingPanel.updateFromStateModel(panels[child]);
9272
+ }
9273
+ else {
9274
+ const panel = this._deserializer.fromJSON(panels[child], group);
9275
+ createdPanels.push(panel);
9276
+ }
9166
9277
  }
9167
9278
  for (let i = 0; i < views.length; i++) {
9168
9279
  const panel = createdPanels[i];
9169
9280
  const isActive = typeof activeView === 'string' &&
9170
9281
  activeView === panel.id;
9171
- group.model.openPanel(panel, {
9172
- skipSetActive: !isActive,
9173
- skipSetGroupActive: true,
9174
- });
9282
+ const hasExisting = existingPanels.has(panel.api.id);
9283
+ if (hasExisting) {
9284
+ this.movingLock(() => {
9285
+ group.model.openPanel(panel, {
9286
+ skipSetActive: !isActive,
9287
+ skipSetGroupActive: true,
9288
+ });
9289
+ });
9290
+ }
9291
+ else {
9292
+ group.model.openPanel(panel, {
9293
+ skipSetActive: !isActive,
9294
+ skipSetGroupActive: true,
9295
+ });
9296
+ }
9175
9297
  }
9176
9298
  if (!group.activePanel && group.panels.length > 0) {
9177
9299
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -9210,7 +9332,9 @@ define(['exports'], (function (exports) { 'use strict';
9210
9332
  setTimeout(() => {
9211
9333
  this.addPopoutGroup(group, {
9212
9334
  position: position !== null && position !== void 0 ? position : undefined,
9213
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
9335
+ overridePopoutGroup: gridReferenceGroup
9336
+ ? group
9337
+ : undefined,
9214
9338
  referenceGroup: gridReferenceGroup
9215
9339
  ? this.getPanel(gridReferenceGroup)
9216
9340
  : undefined,
@@ -9296,11 +9420,11 @@ define(['exports'], (function (exports) { 'use strict';
9296
9420
  addPanel(options) {
9297
9421
  var _a, _b;
9298
9422
  if (this.panels.find((_) => _.id === options.id)) {
9299
- throw new Error(`panel with id ${options.id} already exists`);
9423
+ throw new Error(`dockview: panel with id ${options.id} already exists`);
9300
9424
  }
9301
9425
  let referenceGroup;
9302
9426
  if (options.position && options.floating) {
9303
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
9427
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
9304
9428
  }
9305
9429
  const initial = {
9306
9430
  width: options.initialWidth,
@@ -9314,7 +9438,7 @@ define(['exports'], (function (exports) { 'use strict';
9314
9438
  : options.position.referencePanel;
9315
9439
  index = options.position.index;
9316
9440
  if (!referencePanel) {
9317
- throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
9441
+ throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
9318
9442
  }
9319
9443
  referenceGroup = this.findGroup(referencePanel);
9320
9444
  }
@@ -9325,7 +9449,7 @@ define(['exports'], (function (exports) { 'use strict';
9325
9449
  : options.position.referenceGroup;
9326
9450
  index = options.position.index;
9327
9451
  if (!referenceGroup) {
9328
- throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
9452
+ throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
9329
9453
  }
9330
9454
  }
9331
9455
  else {
@@ -9437,7 +9561,7 @@ define(['exports'], (function (exports) { 'use strict';
9437
9561
  }) {
9438
9562
  const group = panel.group;
9439
9563
  if (!group) {
9440
- throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
9564
+ throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
9441
9565
  }
9442
9566
  group.model.removePanel(panel, {
9443
9567
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -9486,11 +9610,11 @@ define(['exports'], (function (exports) { 'use strict';
9486
9610
  ? this.panels.find((panel) => panel.id === options.referencePanel)
9487
9611
  : options.referencePanel;
9488
9612
  if (!referencePanel) {
9489
- throw new Error(`reference panel ${options.referencePanel} does not exist`);
9613
+ throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
9490
9614
  }
9491
9615
  referenceGroup = this.findGroup(referencePanel);
9492
9616
  if (!referenceGroup) {
9493
- throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
9617
+ throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
9494
9618
  }
9495
9619
  }
9496
9620
  else if (isGroupOptionsWithGroup(options)) {
@@ -9499,7 +9623,7 @@ define(['exports'], (function (exports) { 'use strict';
9499
9623
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
9500
9624
  : options.referenceGroup;
9501
9625
  if (!referenceGroup) {
9502
- throw new Error(`reference group ${options.referenceGroup} does not exist`);
9626
+ throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
9503
9627
  }
9504
9628
  }
9505
9629
  else {
@@ -9567,7 +9691,7 @@ define(['exports'], (function (exports) { 'use strict';
9567
9691
  }
9568
9692
  return floatingGroup.group;
9569
9693
  }
9570
- throw new Error('failed to find floating group');
9694
+ throw new Error('dockview: failed to find floating group');
9571
9695
  }
9572
9696
  if (group.api.location.type === 'popout') {
9573
9697
  const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
@@ -9598,7 +9722,7 @@ define(['exports'], (function (exports) { 'use strict';
9598
9722
  this.updateWatermark();
9599
9723
  return selectedGroup.popoutGroup;
9600
9724
  }
9601
- throw new Error('failed to find popout group');
9725
+ throw new Error('dockview: failed to find popout group');
9602
9726
  }
9603
9727
  const re = super.doRemoveGroup(group, options);
9604
9728
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -9629,7 +9753,7 @@ define(['exports'], (function (exports) { 'use strict';
9629
9753
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
9630
9754
  : undefined;
9631
9755
  if (!sourceGroup) {
9632
- throw new Error(`Failed to find group id ${sourceGroupId}`);
9756
+ throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
9633
9757
  }
9634
9758
  if (sourceItemId === undefined) {
9635
9759
  /**
@@ -9654,9 +9778,9 @@ define(['exports'], (function (exports) { 'use strict';
9654
9778
  skipSetActiveGroup: true,
9655
9779
  }));
9656
9780
  if (!removedPanel) {
9657
- throw new Error(`No panel with id ${sourceItemId}`);
9781
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9658
9782
  }
9659
- if (sourceGroup.model.size === 0) {
9783
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
9660
9784
  // remove the group and do not set a new group as active
9661
9785
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9662
9786
  }
@@ -9666,7 +9790,8 @@ define(['exports'], (function (exports) { 'use strict';
9666
9790
  var _a;
9667
9791
  return destinationGroup.model.openPanel(removedPanel, {
9668
9792
  index: destinationIndex,
9669
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9793
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
9794
+ !isDestinationGroupEmpty,
9670
9795
  skipSetGroupActive: true,
9671
9796
  });
9672
9797
  });
@@ -9721,7 +9846,9 @@ define(['exports'], (function (exports) { 'use strict';
9721
9846
  }));
9722
9847
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9723
9848
  const newGroup = this.createGroupAtLocation(targetLocation);
9724
- this.movingLock(() => newGroup.model.openPanel(removedPanel));
9849
+ this.movingLock(() => newGroup.model.openPanel(removedPanel, {
9850
+ skipSetActive: true,
9851
+ }));
9725
9852
  this.doSetGroupAndPanelActive(newGroup);
9726
9853
  this._onDidMovePanel.fire({
9727
9854
  panel: this.getGroupPanel(sourceItemId),
@@ -9754,7 +9881,7 @@ define(['exports'], (function (exports) { 'use strict';
9754
9881
  skipSetActiveGroup: true,
9755
9882
  }));
9756
9883
  if (!removedPanel) {
9757
- throw new Error(`No panel with id ${sourceItemId}`);
9884
+ throw new Error(`dockview: No panel with id ${sourceItemId}`);
9758
9885
  }
9759
9886
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
9760
9887
  const group = this.createGroupAtLocation(dropLocation);
@@ -9809,7 +9936,7 @@ define(['exports'], (function (exports) { 'use strict';
9809
9936
  case 'floating': {
9810
9937
  const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
9811
9938
  if (!selectedFloatingGroup) {
9812
- throw new Error('failed to find floating group');
9939
+ throw new Error('dockview: failed to find floating group');
9813
9940
  }
9814
9941
  selectedFloatingGroup.dispose();
9815
9942
  break;
@@ -9817,7 +9944,7 @@ define(['exports'], (function (exports) { 'use strict';
9817
9944
  case 'popout': {
9818
9945
  const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
9819
9946
  if (!selectedPopoutGroup) {
9820
- throw new Error('failed to find popout group');
9947
+ throw new Error('dockview: failed to find popout group');
9821
9948
  }
9822
9949
  // Remove from popout groups list to prevent automatic restoration
9823
9950
  const index = this._popoutGroups.indexOf(selectedPopoutGroup);