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
  */
@@ -2766,7 +2766,7 @@ define(['exports'], (function (exports) { 'use strict';
2766
2766
  this._bufferOnDidLayoutChange.fire();
2767
2767
  }), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
2768
2768
  this._bufferOnDidLayoutChange.fire();
2769
- }), this._bufferOnDidLayoutChange);
2769
+ }), this._onDidMaximizedChange, this._onDidViewVisibilityChangeMicroTaskQueue, this._bufferOnDidLayoutChange);
2770
2770
  }
2771
2771
  setVisible(panel, visible) {
2772
2772
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
@@ -5367,7 +5367,7 @@ define(['exports'], (function (exports) { 'use strict';
5367
5367
  group: this.groupPanel,
5368
5368
  getData: getPanelData,
5369
5369
  }));
5370
- }), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent);
5370
+ }), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent, this._onDidPanelTitleChange, this._onDidPanelParametersChange);
5371
5371
  }
5372
5372
  focusContent() {
5373
5373
  this.contentContainer.element.focus();
@@ -7369,6 +7369,47 @@ define(['exports'], (function (exports) { 'use strict';
7369
7369
  }
7370
7370
  }
7371
7371
 
7372
+ class StrictEventsSequencing extends CompositeDisposable {
7373
+ constructor(accessor) {
7374
+ super();
7375
+ this.accessor = accessor;
7376
+ this.init();
7377
+ }
7378
+ init() {
7379
+ const panels = new Set();
7380
+ const groups = new Set();
7381
+ this.addDisposables(this.accessor.onDidAddPanel((panel) => {
7382
+ if (panels.has(panel.api.id)) {
7383
+ throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${panel.api.id} but panel already exists`);
7384
+ }
7385
+ else {
7386
+ panels.add(panel.api.id);
7387
+ }
7388
+ }), this.accessor.onDidRemovePanel((panel) => {
7389
+ if (!panels.has(panel.api.id)) {
7390
+ throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);
7391
+ }
7392
+ else {
7393
+ panels.delete(panel.api.id);
7394
+ }
7395
+ }), this.accessor.onDidAddGroup((group) => {
7396
+ if (groups.has(group.api.id)) {
7397
+ throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${group.api.id} but group already exists`);
7398
+ }
7399
+ else {
7400
+ groups.add(group.api.id);
7401
+ }
7402
+ }), this.accessor.onDidRemoveGroup((group) => {
7403
+ if (!groups.has(group.api.id)) {
7404
+ throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);
7405
+ }
7406
+ else {
7407
+ groups.delete(group.api.id);
7408
+ }
7409
+ }));
7410
+ }
7411
+ }
7412
+
7372
7413
  const DEFAULT_ROOT_OVERLAY_MODEL = {
7373
7414
  activationSize: { type: 'pixels', value: 10 },
7374
7415
  size: { type: 'pixels', value: 20 },
@@ -7472,7 +7513,10 @@ define(['exports'], (function (exports) { 'use strict';
7472
7513
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7473
7514
  toggleClass(this.gridview.element, 'dv-dockview', true);
7474
7515
  toggleClass(this.element, 'dv-debug', !!options.debug);
7475
- 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(() => {
7516
+ if (options.debug) {
7517
+ this.addDisposables(new StrictEventsSequencing(this));
7518
+ }
7519
+ 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(() => {
7476
7520
  this.updateWatermark();
7477
7521
  }), this.onDidAdd((event) => {
7478
7522
  if (!this._moving) {
@@ -7589,6 +7633,10 @@ define(['exports'], (function (exports) { 'use strict';
7589
7633
  this._api = new DockviewApi(this);
7590
7634
  this.updateWatermark();
7591
7635
  }
7636
+ dispose() {
7637
+ this.clear(); // explicitly clear the layout before cleaning up
7638
+ super.dispose();
7639
+ }
7592
7640
  setVisible(panel, visible) {
7593
7641
  switch (panel.api.location.type) {
7594
7642
  case 'grid':
@@ -7647,6 +7695,7 @@ define(['exports'], (function (exports) { 'use strict';
7647
7695
  return _window
7648
7696
  .open()
7649
7697
  .then((popoutContainer) => {
7698
+ var _a;
7650
7699
  if (_window.isDisposed) {
7651
7700
  return false;
7652
7701
  }
@@ -7679,6 +7728,7 @@ define(['exports'], (function (exports) { 'use strict';
7679
7728
  }
7680
7729
  group.model.renderContainer = overlayRenderContainer;
7681
7730
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
7731
+ let floatingBox;
7682
7732
  if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) && isGroupAddedToDom) {
7683
7733
  if (itemToPopout instanceof DockviewPanel) {
7684
7734
  this.movingLock(() => {
@@ -7697,6 +7747,9 @@ define(['exports'], (function (exports) { 'use strict';
7697
7747
  break;
7698
7748
  case 'floating':
7699
7749
  case 'popout':
7750
+ floatingBox = (_a = this._floatingGroups
7751
+ .find((value) => value.group.api.id ===
7752
+ itemToPopout.api.id)) === null || _a === void 0 ? void 0 : _a.overlay.toJSON();
7700
7753
  this.removeGroup(referenceGroup);
7701
7754
  break;
7702
7755
  }
@@ -7767,17 +7820,29 @@ define(['exports'], (function (exports) { 'use strict';
7767
7820
  }
7768
7821
  }
7769
7822
  else if (this.getPanel(group.id)) {
7770
- this.doRemoveGroup(group, {
7771
- skipDispose: true,
7772
- skipActive: true,
7773
- skipPopoutReturn: true,
7774
- });
7775
7823
  const removedGroup = group;
7776
- removedGroup.model.renderContainer =
7777
- this.overlayRenderContainer;
7778
- removedGroup.model.location = { type: 'grid' };
7779
- returnedGroup = removedGroup;
7780
- this.doAddGroup(removedGroup, [0]);
7824
+ if (floatingBox) {
7825
+ this.addFloatingGroup(removedGroup, {
7826
+ height: floatingBox.height,
7827
+ width: floatingBox.width,
7828
+ position: floatingBox,
7829
+ });
7830
+ }
7831
+ else {
7832
+ this.doRemoveGroup(removedGroup, {
7833
+ skipDispose: true,
7834
+ skipActive: true,
7835
+ skipPopoutReturn: true,
7836
+ });
7837
+ removedGroup.model.renderContainer =
7838
+ this.overlayRenderContainer;
7839
+ removedGroup.model.location = { type: 'grid' };
7840
+ returnedGroup = removedGroup;
7841
+ this.movingLock(() => {
7842
+ // suppress group add events since the group already exists
7843
+ this.doAddGroup(removedGroup, [0]);
7844
+ });
7845
+ }
7781
7846
  this.doSetGroupAndPanelActive(removedGroup);
7782
7847
  }
7783
7848
  }));
@@ -8125,6 +8190,7 @@ define(['exports'], (function (exports) { 'use strict';
8125
8190
  locked: !!locked,
8126
8191
  hideHeader: !!hideHeader,
8127
8192
  });
8193
+ this._onDidAddGroup.fire(group);
8128
8194
  const createdPanels = [];
8129
8195
  for (const child of views) {
8130
8196
  /**
@@ -8135,7 +8201,6 @@ define(['exports'], (function (exports) { 'use strict';
8135
8201
  const panel = this._deserializer.fromJSON(panels[child], group);
8136
8202
  createdPanels.push(panel);
8137
8203
  }
8138
- this._onDidAddGroup.fire(group);
8139
8204
  for (let i = 0; i < views.length; i++) {
8140
8205
  const panel = createdPanels[i];
8141
8206
  const isActive = typeof activeView === 'string' &&
@@ -8669,9 +8734,7 @@ define(['exports'], (function (exports) { 'use strict';
8669
8734
  }));
8670
8735
  this.doRemoveGroup(sourceGroup, { skipActive: true });
8671
8736
  const newGroup = this.createGroupAtLocation(targetLocation);
8672
- this.movingLock(() => newGroup.model.openPanel(removedPanel, {
8673
- skipSetActive: true,
8674
- }));
8737
+ this.movingLock(() => newGroup.model.openPanel(removedPanel));
8675
8738
  this.doSetGroupAndPanelActive(newGroup);
8676
8739
  this._onDidMovePanel.fire({
8677
8740
  panel: this.getGroupPanel(sourceItemId),