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
  */
@@ -191,7 +191,10 @@
191
191
  return this._event;
192
192
  }
193
193
  fire(e) {
194
- this._last = e;
194
+ var _a;
195
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
196
+ this._last = e;
197
+ }
195
198
  for (const listener of this._listeners) {
196
199
  listener.callback(e);
197
200
  }
@@ -3623,6 +3626,9 @@
3623
3626
  get onDidPopoutGroupPositionChange() {
3624
3627
  return this.component.onDidPopoutGroupPositionChange;
3625
3628
  }
3629
+ get onDidOpenPopoutWindowFail() {
3630
+ return this.component.onDidOpenPopoutWindowFail;
3631
+ }
3626
3632
  /**
3627
3633
  * All panel objects.
3628
3634
  */
@@ -8225,9 +8231,11 @@
8225
8231
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8226
8232
  this._onDidPopoutGroupPositionChange = new Emitter();
8227
8233
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8234
+ this._onDidOpenPopoutWindowFail = new Emitter();
8235
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8228
8236
  this._onDidLayoutFromJSON = new Emitter();
8229
8237
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8230
- this._onDidActivePanelChange = new Emitter();
8238
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8231
8239
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8232
8240
  this._onDidMovePanel = new Emitter();
8233
8241
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8289,7 +8297,7 @@
8289
8297
  if (options.debug) {
8290
8298
  this.addDisposables(new StrictEventsSequencing(this));
8291
8299
  }
8292
- 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(() => {
8300
+ 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(() => {
8293
8301
  this.updateWatermark();
8294
8302
  }), this.onDidAdd((event) => {
8295
8303
  if (!this._moving) {
@@ -8435,13 +8443,6 @@
8435
8443
  if (_window.isDisposed) {
8436
8444
  return false;
8437
8445
  }
8438
- if (popoutContainer === null) {
8439
- popoutWindowDisposable.dispose();
8440
- return false;
8441
- }
8442
- const gready = document.createElement('div');
8443
- gready.className = 'dv-overlay-render-container';
8444
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8445
8446
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8446
8447
  ? options.referenceGroup
8447
8448
  : itemToPopout instanceof DockviewPanel
@@ -8449,7 +8450,7 @@
8449
8450
  : itemToPopout;
8450
8451
  const referenceLocation = itemToPopout.api.location.type;
8451
8452
  /**
8452
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8453
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8453
8454
  * of this case is when being called from the `fromJSON(...)` method
8454
8455
  */
8455
8456
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8462,8 +8463,28 @@
8462
8463
  }
8463
8464
  else {
8464
8465
  group = this.createGroup({ id: groupId });
8465
- this._onDidAddGroup.fire(group);
8466
+ if (popoutContainer) {
8467
+ this._onDidAddGroup.fire(group);
8468
+ }
8466
8469
  }
8470
+ if (popoutContainer === null) {
8471
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8472
+ popoutWindowDisposable.dispose();
8473
+ this._onDidOpenPopoutWindowFail.fire();
8474
+ // if the popout window was blocked, we need to move the group back to the reference group
8475
+ // and set it to visible
8476
+ this.movingLock(() => moveGroupWithoutDestroying({
8477
+ from: group,
8478
+ to: referenceGroup,
8479
+ }));
8480
+ if (!referenceGroup.api.isVisible) {
8481
+ referenceGroup.api.setVisible(true);
8482
+ }
8483
+ return false;
8484
+ }
8485
+ const gready = document.createElement('div');
8486
+ gready.className = 'dv-overlay-render-container';
8487
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8467
8488
  group.model.renderContainer = overlayRenderContainer;
8468
8489
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8469
8490
  let floatingBox;
@@ -8620,7 +8641,7 @@
8620
8641
  return true;
8621
8642
  })
8622
8643
  .catch((err) => {
8623
- console.error('dockview: failed to create popout window', err);
8644
+ console.error('dockview: failed to create popout.', err);
8624
8645
  return false;
8625
8646
  });
8626
8647
  }