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
  */
@@ -215,7 +215,10 @@ class Emitter {
215
215
  return this._event;
216
216
  }
217
217
  fire(e) {
218
- this._last = e;
218
+ var _a;
219
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
220
+ this._last = e;
221
+ }
219
222
  for (const listener of this._listeners) {
220
223
  listener.callback(e);
221
224
  }
@@ -3647,6 +3650,9 @@ class DockviewApi {
3647
3650
  get onDidPopoutGroupPositionChange() {
3648
3651
  return this.component.onDidPopoutGroupPositionChange;
3649
3652
  }
3653
+ get onDidOpenPopoutWindowFail() {
3654
+ return this.component.onDidOpenPopoutWindowFail;
3655
+ }
3650
3656
  /**
3651
3657
  * All panel objects.
3652
3658
  */
@@ -8249,9 +8255,11 @@ class DockviewComponent extends BaseGrid {
8249
8255
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8250
8256
  this._onDidPopoutGroupPositionChange = new Emitter();
8251
8257
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8258
+ this._onDidOpenPopoutWindowFail = new Emitter();
8259
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8252
8260
  this._onDidLayoutFromJSON = new Emitter();
8253
8261
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8254
- this._onDidActivePanelChange = new Emitter();
8262
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8255
8263
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8256
8264
  this._onDidMovePanel = new Emitter();
8257
8265
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8313,7 +8321,7 @@ class DockviewComponent extends BaseGrid {
8313
8321
  if (options.debug) {
8314
8322
  this.addDisposables(new StrictEventsSequencing(this));
8315
8323
  }
8316
- 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(() => {
8324
+ 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(() => {
8317
8325
  this.updateWatermark();
8318
8326
  }), this.onDidAdd((event) => {
8319
8327
  if (!this._moving) {
@@ -8459,13 +8467,6 @@ class DockviewComponent extends BaseGrid {
8459
8467
  if (_window.isDisposed) {
8460
8468
  return false;
8461
8469
  }
8462
- if (popoutContainer === null) {
8463
- popoutWindowDisposable.dispose();
8464
- return false;
8465
- }
8466
- const gready = document.createElement('div');
8467
- gready.className = 'dv-overlay-render-container';
8468
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8469
8470
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8470
8471
  ? options.referenceGroup
8471
8472
  : itemToPopout instanceof DockviewPanel
@@ -8473,7 +8474,7 @@ class DockviewComponent extends BaseGrid {
8473
8474
  : itemToPopout;
8474
8475
  const referenceLocation = itemToPopout.api.location.type;
8475
8476
  /**
8476
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8477
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8477
8478
  * of this case is when being called from the `fromJSON(...)` method
8478
8479
  */
8479
8480
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8486,8 +8487,28 @@ class DockviewComponent extends BaseGrid {
8486
8487
  }
8487
8488
  else {
8488
8489
  group = this.createGroup({ id: groupId });
8489
- this._onDidAddGroup.fire(group);
8490
+ if (popoutContainer) {
8491
+ this._onDidAddGroup.fire(group);
8492
+ }
8490
8493
  }
8494
+ if (popoutContainer === null) {
8495
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8496
+ popoutWindowDisposable.dispose();
8497
+ this._onDidOpenPopoutWindowFail.fire();
8498
+ // if the popout window was blocked, we need to move the group back to the reference group
8499
+ // and set it to visible
8500
+ this.movingLock(() => moveGroupWithoutDestroying({
8501
+ from: group,
8502
+ to: referenceGroup,
8503
+ }));
8504
+ if (!referenceGroup.api.isVisible) {
8505
+ referenceGroup.api.setVisible(true);
8506
+ }
8507
+ return false;
8508
+ }
8509
+ const gready = document.createElement('div');
8510
+ gready.className = 'dv-overlay-render-container';
8511
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8491
8512
  group.model.renderContainer = overlayRenderContainer;
8492
8513
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8493
8514
  let floatingBox;
@@ -8644,7 +8665,7 @@ class DockviewComponent extends BaseGrid {
8644
8665
  return true;
8645
8666
  })
8646
8667
  .catch((err) => {
8647
- console.error('dockview: failed to create popout window', err);
8668
+ console.error('dockview: failed to create popout.', err);
8648
8669
  return false;
8649
8670
  });
8650
8671
  }