dockview-core 2.1.1 → 2.1.3

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 (35) hide show
  1. package/dist/cjs/dockview/dockviewComponent.d.ts +1 -0
  2. package/dist/cjs/dockview/dockviewComponent.js +42 -17
  3. package/dist/cjs/dockview/dockviewGroupPanelModel.js +1 -1
  4. package/dist/cjs/dockview/strictEventsSequencing.d.ts +7 -0
  5. package/dist/cjs/dockview/strictEventsSequencing.js +63 -0
  6. package/dist/cjs/gridview/baseComponentGridview.js +1 -1
  7. package/dist/dockview-core.amd.js +81 -18
  8. package/dist/dockview-core.amd.js.map +1 -1
  9. package/dist/dockview-core.amd.min.js +2 -2
  10. package/dist/dockview-core.amd.min.js.map +1 -1
  11. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  12. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  13. package/dist/dockview-core.amd.noStyle.js +81 -18
  14. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  15. package/dist/dockview-core.cjs.js +81 -18
  16. package/dist/dockview-core.cjs.js.map +1 -1
  17. package/dist/dockview-core.esm.js +81 -18
  18. package/dist/dockview-core.esm.js.map +1 -1
  19. package/dist/dockview-core.esm.min.js +2 -2
  20. package/dist/dockview-core.esm.min.js.map +1 -1
  21. package/dist/dockview-core.js +81 -18
  22. package/dist/dockview-core.js.map +1 -1
  23. package/dist/dockview-core.min.js +2 -2
  24. package/dist/dockview-core.min.js.map +1 -1
  25. package/dist/dockview-core.min.noStyle.js +2 -2
  26. package/dist/dockview-core.min.noStyle.js.map +1 -1
  27. package/dist/dockview-core.noStyle.js +81 -18
  28. package/dist/dockview-core.noStyle.js.map +1 -1
  29. package/dist/esm/dockview/dockviewComponent.d.ts +1 -0
  30. package/dist/esm/dockview/dockviewComponent.js +38 -15
  31. package/dist/esm/dockview/dockviewGroupPanelModel.js +1 -1
  32. package/dist/esm/dockview/strictEventsSequencing.d.ts +7 -0
  33. package/dist/esm/dockview/strictEventsSequencing.js +41 -0
  34. package/dist/esm/gridview/baseComponentGridview.js +1 -1
  35. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 2.1.1
3
+ * @version 2.1.3
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -2770,7 +2770,7 @@
2770
2770
  this._bufferOnDidLayoutChange.fire();
2771
2771
  }), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
2772
2772
  this._bufferOnDidLayoutChange.fire();
2773
- }), this._bufferOnDidLayoutChange);
2773
+ }), this._onDidMaximizedChange, this._onDidViewVisibilityChangeMicroTaskQueue, this._bufferOnDidLayoutChange);
2774
2774
  }
2775
2775
  setVisible(panel, visible) {
2776
2776
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
@@ -5371,7 +5371,7 @@
5371
5371
  group: this.groupPanel,
5372
5372
  getData: getPanelData,
5373
5373
  }));
5374
- }), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent);
5374
+ }), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent, this._onDidPanelTitleChange, this._onDidPanelParametersChange);
5375
5375
  }
5376
5376
  focusContent() {
5377
5377
  this.contentContainer.element.focus();
@@ -7373,6 +7373,47 @@
7373
7373
  }
7374
7374
  }
7375
7375
 
7376
+ class StrictEventsSequencing extends CompositeDisposable {
7377
+ constructor(accessor) {
7378
+ super();
7379
+ this.accessor = accessor;
7380
+ this.init();
7381
+ }
7382
+ init() {
7383
+ const panels = new Set();
7384
+ const groups = new Set();
7385
+ this.addDisposables(this.accessor.onDidAddPanel((panel) => {
7386
+ if (panels.has(panel.api.id)) {
7387
+ throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${panel.api.id} but panel already exists`);
7388
+ }
7389
+ else {
7390
+ panels.add(panel.api.id);
7391
+ }
7392
+ }), this.accessor.onDidRemovePanel((panel) => {
7393
+ if (!panels.has(panel.api.id)) {
7394
+ throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);
7395
+ }
7396
+ else {
7397
+ panels.delete(panel.api.id);
7398
+ }
7399
+ }), this.accessor.onDidAddGroup((group) => {
7400
+ if (groups.has(group.api.id)) {
7401
+ throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${group.api.id} but group already exists`);
7402
+ }
7403
+ else {
7404
+ groups.add(group.api.id);
7405
+ }
7406
+ }), this.accessor.onDidRemoveGroup((group) => {
7407
+ if (!groups.has(group.api.id)) {
7408
+ throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);
7409
+ }
7410
+ else {
7411
+ groups.delete(group.api.id);
7412
+ }
7413
+ }));
7414
+ }
7415
+ }
7416
+
7376
7417
  const DEFAULT_ROOT_OVERLAY_MODEL = {
7377
7418
  activationSize: { type: 'pixels', value: 10 },
7378
7419
  size: { type: 'pixels', value: 20 },
@@ -7476,7 +7517,10 @@
7476
7517
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7477
7518
  toggleClass(this.gridview.element, 'dv-dockview', true);
7478
7519
  toggleClass(this.element, 'dv-debug', !!options.debug);
7479
- this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
7520
+ if (options.debug) {
7521
+ this.addDisposables(new StrictEventsSequencing(this));
7522
+ }
7523
+ this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
7480
7524
  this.updateWatermark();
7481
7525
  }), this.onDidAdd((event) => {
7482
7526
  if (!this._moving) {
@@ -7593,6 +7637,10 @@
7593
7637
  this._api = new DockviewApi(this);
7594
7638
  this.updateWatermark();
7595
7639
  }
7640
+ dispose() {
7641
+ this.clear(); // explicitly clear the layout before cleaning up
7642
+ super.dispose();
7643
+ }
7596
7644
  setVisible(panel, visible) {
7597
7645
  switch (panel.api.location.type) {
7598
7646
  case 'grid':
@@ -7651,6 +7699,7 @@
7651
7699
  return _window
7652
7700
  .open()
7653
7701
  .then((popoutContainer) => {
7702
+ var _a;
7654
7703
  if (_window.isDisposed) {
7655
7704
  return false;
7656
7705
  }
@@ -7683,6 +7732,7 @@
7683
7732
  }
7684
7733
  group.model.renderContainer = overlayRenderContainer;
7685
7734
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
7735
+ let floatingBox;
7686
7736
  if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) && isGroupAddedToDom) {
7687
7737
  if (itemToPopout instanceof DockviewPanel) {
7688
7738
  this.movingLock(() => {
@@ -7701,6 +7751,9 @@
7701
7751
  break;
7702
7752
  case 'floating':
7703
7753
  case 'popout':
7754
+ floatingBox = (_a = this._floatingGroups
7755
+ .find((value) => value.group.api.id ===
7756
+ itemToPopout.api.id)) === null || _a === void 0 ? void 0 : _a.overlay.toJSON();
7704
7757
  this.removeGroup(referenceGroup);
7705
7758
  break;
7706
7759
  }
@@ -7771,17 +7824,29 @@
7771
7824
  }
7772
7825
  }
7773
7826
  else if (this.getPanel(group.id)) {
7774
- this.doRemoveGroup(group, {
7775
- skipDispose: true,
7776
- skipActive: true,
7777
- skipPopoutReturn: true,
7778
- });
7779
7827
  const removedGroup = group;
7780
- removedGroup.model.renderContainer =
7781
- this.overlayRenderContainer;
7782
- removedGroup.model.location = { type: 'grid' };
7783
- returnedGroup = removedGroup;
7784
- this.doAddGroup(removedGroup, [0]);
7828
+ if (floatingBox) {
7829
+ this.addFloatingGroup(removedGroup, {
7830
+ height: floatingBox.height,
7831
+ width: floatingBox.width,
7832
+ position: floatingBox,
7833
+ });
7834
+ }
7835
+ else {
7836
+ this.doRemoveGroup(removedGroup, {
7837
+ skipDispose: true,
7838
+ skipActive: true,
7839
+ skipPopoutReturn: true,
7840
+ });
7841
+ removedGroup.model.renderContainer =
7842
+ this.overlayRenderContainer;
7843
+ removedGroup.model.location = { type: 'grid' };
7844
+ returnedGroup = removedGroup;
7845
+ this.movingLock(() => {
7846
+ // suppress group add events since the group already exists
7847
+ this.doAddGroup(removedGroup, [0]);
7848
+ });
7849
+ }
7785
7850
  this.doSetGroupAndPanelActive(removedGroup);
7786
7851
  }
7787
7852
  }));
@@ -8129,6 +8194,7 @@
8129
8194
  locked: !!locked,
8130
8195
  hideHeader: !!hideHeader,
8131
8196
  });
8197
+ this._onDidAddGroup.fire(group);
8132
8198
  const createdPanels = [];
8133
8199
  for (const child of views) {
8134
8200
  /**
@@ -8139,7 +8205,6 @@
8139
8205
  const panel = this._deserializer.fromJSON(panels[child], group);
8140
8206
  createdPanels.push(panel);
8141
8207
  }
8142
- this._onDidAddGroup.fire(group);
8143
8208
  for (let i = 0; i < views.length; i++) {
8144
8209
  const panel = createdPanels[i];
8145
8210
  const isActive = typeof activeView === 'string' &&
@@ -8673,9 +8738,7 @@
8673
8738
  }));
8674
8739
  this.doRemoveGroup(sourceGroup, { skipActive: true });
8675
8740
  const newGroup = this.createGroupAtLocation(targetLocation);
8676
- this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8677
- skipSetActive: true,
8678
- }));
8741
+ this.movingLock(() => newGroup.model.openPanel(removedPanel));
8679
8742
  this.doSetGroupAndPanelActive(newGroup);
8680
8743
  this._onDidMovePanel.fire({
8681
8744
  panel: this.getGroupPanel(sourceItemId),