dockview-core 4.3.0 → 4.4.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 (33) hide show
  1. package/dist/cjs/api/component.api.d.ts +1 -0
  2. package/dist/cjs/api/component.api.js +7 -0
  3. package/dist/cjs/dockview/dockviewComponent.d.ts +3 -0
  4. package/dist/cjs/dockview/dockviewComponent.js +29 -12
  5. package/dist/cjs/events.js +7 -4
  6. package/dist/dockview-core.amd.js +35 -14
  7. package/dist/dockview-core.amd.js.map +1 -1
  8. package/dist/dockview-core.amd.min.js +2 -2
  9. package/dist/dockview-core.amd.min.js.map +1 -1
  10. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  11. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  12. package/dist/dockview-core.amd.noStyle.js +35 -14
  13. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  14. package/dist/dockview-core.cjs.js +35 -14
  15. package/dist/dockview-core.cjs.js.map +1 -1
  16. package/dist/dockview-core.esm.js +35 -14
  17. package/dist/dockview-core.esm.js.map +1 -1
  18. package/dist/dockview-core.esm.min.js +2 -2
  19. package/dist/dockview-core.esm.min.js.map +1 -1
  20. package/dist/dockview-core.js +35 -14
  21. package/dist/dockview-core.js.map +1 -1
  22. package/dist/dockview-core.min.js +2 -2
  23. package/dist/dockview-core.min.js.map +1 -1
  24. package/dist/dockview-core.min.noStyle.js +2 -2
  25. package/dist/dockview-core.min.noStyle.js.map +1 -1
  26. package/dist/dockview-core.noStyle.js +35 -14
  27. package/dist/dockview-core.noStyle.js.map +1 -1
  28. package/dist/esm/api/component.api.d.ts +1 -0
  29. package/dist/esm/api/component.api.js +3 -0
  30. package/dist/esm/dockview/dockviewComponent.d.ts +3 -0
  31. package/dist/esm/dockview/dockviewComponent.js +27 -12
  32. package/dist/esm/events.js +4 -1
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.3.0
3
+ * @version 4.4.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -217,7 +217,10 @@ class Emitter {
217
217
  return this._event;
218
218
  }
219
219
  fire(e) {
220
- this._last = e;
220
+ var _a;
221
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
222
+ this._last = e;
223
+ }
221
224
  for (const listener of this._listeners) {
222
225
  listener.callback(e);
223
226
  }
@@ -3649,6 +3652,9 @@ class DockviewApi {
3649
3652
  get onDidPopoutGroupPositionChange() {
3650
3653
  return this.component.onDidPopoutGroupPositionChange;
3651
3654
  }
3655
+ get onDidOpenPopoutWindowFail() {
3656
+ return this.component.onDidOpenPopoutWindowFail;
3657
+ }
3652
3658
  /**
3653
3659
  * All panel objects.
3654
3660
  */
@@ -8251,9 +8257,11 @@ class DockviewComponent extends BaseGrid {
8251
8257
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8252
8258
  this._onDidPopoutGroupPositionChange = new Emitter();
8253
8259
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8260
+ this._onDidOpenPopoutWindowFail = new Emitter();
8261
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8254
8262
  this._onDidLayoutFromJSON = new Emitter();
8255
8263
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8256
- this._onDidActivePanelChange = new Emitter();
8264
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8257
8265
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8258
8266
  this._onDidMovePanel = new Emitter();
8259
8267
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8315,7 +8323,7 @@ class DockviewComponent extends BaseGrid {
8315
8323
  if (options.debug) {
8316
8324
  this.addDisposables(new StrictEventsSequencing(this));
8317
8325
  }
8318
- this.addDisposables(this.rootDropTargetContainer, 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._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8326
+ this.addDisposables(this.rootDropTargetContainer, 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._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8319
8327
  this.updateWatermark();
8320
8328
  }), this.onDidAdd((event) => {
8321
8329
  if (!this._moving) {
@@ -8461,13 +8469,6 @@ class DockviewComponent extends BaseGrid {
8461
8469
  if (_window.isDisposed) {
8462
8470
  return false;
8463
8471
  }
8464
- if (popoutContainer === null) {
8465
- popoutWindowDisposable.dispose();
8466
- return false;
8467
- }
8468
- const gready = document.createElement('div');
8469
- gready.className = 'dv-overlay-render-container';
8470
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8471
8472
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8472
8473
  ? options.referenceGroup
8473
8474
  : itemToPopout instanceof DockviewPanel
@@ -8475,7 +8476,7 @@ class DockviewComponent extends BaseGrid {
8475
8476
  : itemToPopout;
8476
8477
  const referenceLocation = itemToPopout.api.location.type;
8477
8478
  /**
8478
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8479
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8479
8480
  * of this case is when being called from the `fromJSON(...)` method
8480
8481
  */
8481
8482
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8488,8 +8489,28 @@ class DockviewComponent extends BaseGrid {
8488
8489
  }
8489
8490
  else {
8490
8491
  group = this.createGroup({ id: groupId });
8491
- this._onDidAddGroup.fire(group);
8492
+ if (popoutContainer) {
8493
+ this._onDidAddGroup.fire(group);
8494
+ }
8492
8495
  }
8496
+ if (popoutContainer === null) {
8497
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8498
+ popoutWindowDisposable.dispose();
8499
+ this._onDidOpenPopoutWindowFail.fire();
8500
+ // if the popout window was blocked, we need to move the group back to the reference group
8501
+ // and set it to visible
8502
+ this.movingLock(() => moveGroupWithoutDestroying({
8503
+ from: group,
8504
+ to: referenceGroup,
8505
+ }));
8506
+ if (!referenceGroup.api.isVisible) {
8507
+ referenceGroup.api.setVisible(true);
8508
+ }
8509
+ return false;
8510
+ }
8511
+ const gready = document.createElement('div');
8512
+ gready.className = 'dv-overlay-render-container';
8513
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8493
8514
  group.model.renderContainer = overlayRenderContainer;
8494
8515
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8495
8516
  let floatingBox;
@@ -8646,7 +8667,7 @@ class DockviewComponent extends BaseGrid {
8646
8667
  return true;
8647
8668
  })
8648
8669
  .catch((err) => {
8649
- console.error('dockview: failed to create popout window', err);
8670
+ console.error('dockview: failed to create popout.', err);
8650
8671
  return false;
8651
8672
  });
8652
8673
  }