dockview-react 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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.3.0
3
+ * @version 4.4.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -221,7 +221,10 @@
221
221
  return this._event;
222
222
  }
223
223
  fire(e) {
224
- this._last = e;
224
+ var _a;
225
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
226
+ this._last = e;
227
+ }
225
228
  for (const listener of this._listeners) {
226
229
  listener.callback(e);
227
230
  }
@@ -3653,6 +3656,9 @@
3653
3656
  get onDidPopoutGroupPositionChange() {
3654
3657
  return this.component.onDidPopoutGroupPositionChange;
3655
3658
  }
3659
+ get onDidOpenPopoutWindowFail() {
3660
+ return this.component.onDidOpenPopoutWindowFail;
3661
+ }
3656
3662
  /**
3657
3663
  * All panel objects.
3658
3664
  */
@@ -8232,9 +8238,11 @@
8232
8238
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8233
8239
  this._onDidPopoutGroupPositionChange = new Emitter();
8234
8240
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8241
+ this._onDidOpenPopoutWindowFail = new Emitter();
8242
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8235
8243
  this._onDidLayoutFromJSON = new Emitter();
8236
8244
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8237
- this._onDidActivePanelChange = new Emitter();
8245
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8238
8246
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8239
8247
  this._onDidMovePanel = new Emitter();
8240
8248
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8296,7 +8304,7 @@
8296
8304
  if (options.debug) {
8297
8305
  this.addDisposables(new StrictEventsSequencing(this));
8298
8306
  }
8299
- 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(() => {
8307
+ 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(() => {
8300
8308
  this.updateWatermark();
8301
8309
  }), this.onDidAdd((event) => {
8302
8310
  if (!this._moving) {
@@ -8442,13 +8450,6 @@
8442
8450
  if (_window.isDisposed) {
8443
8451
  return false;
8444
8452
  }
8445
- if (popoutContainer === null) {
8446
- popoutWindowDisposable.dispose();
8447
- return false;
8448
- }
8449
- const gready = document.createElement('div');
8450
- gready.className = 'dv-overlay-render-container';
8451
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8452
8453
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8453
8454
  ? options.referenceGroup
8454
8455
  : itemToPopout instanceof DockviewPanel
@@ -8456,7 +8457,7 @@
8456
8457
  : itemToPopout;
8457
8458
  const referenceLocation = itemToPopout.api.location.type;
8458
8459
  /**
8459
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8460
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8460
8461
  * of this case is when being called from the `fromJSON(...)` method
8461
8462
  */
8462
8463
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8469,8 +8470,28 @@
8469
8470
  }
8470
8471
  else {
8471
8472
  group = this.createGroup({ id: groupId });
8472
- this._onDidAddGroup.fire(group);
8473
+ if (popoutContainer) {
8474
+ this._onDidAddGroup.fire(group);
8475
+ }
8473
8476
  }
8477
+ if (popoutContainer === null) {
8478
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8479
+ popoutWindowDisposable.dispose();
8480
+ this._onDidOpenPopoutWindowFail.fire();
8481
+ // if the popout window was blocked, we need to move the group back to the reference group
8482
+ // and set it to visible
8483
+ this.movingLock(() => moveGroupWithoutDestroying({
8484
+ from: group,
8485
+ to: referenceGroup,
8486
+ }));
8487
+ if (!referenceGroup.api.isVisible) {
8488
+ referenceGroup.api.setVisible(true);
8489
+ }
8490
+ return false;
8491
+ }
8492
+ const gready = document.createElement('div');
8493
+ gready.className = 'dv-overlay-render-container';
8494
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8474
8495
  group.model.renderContainer = overlayRenderContainer;
8475
8496
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8476
8497
  let floatingBox;
@@ -8627,7 +8648,7 @@
8627
8648
  return true;
8628
8649
  })
8629
8650
  .catch((err) => {
8630
- console.error('dockview: failed to create popout window', err);
8651
+ console.error('dockview: failed to create popout.', err);
8631
8652
  return false;
8632
8653
  });
8633
8654
  }