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
  */
@@ -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
  */
@@ -8202,9 +8208,11 @@
8202
8208
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8203
8209
  this._onDidPopoutGroupPositionChange = new Emitter();
8204
8210
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8211
+ this._onDidOpenPopoutWindowFail = new Emitter();
8212
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8205
8213
  this._onDidLayoutFromJSON = new Emitter();
8206
8214
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8207
- this._onDidActivePanelChange = new Emitter();
8215
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8208
8216
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8209
8217
  this._onDidMovePanel = new Emitter();
8210
8218
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8266,7 +8274,7 @@
8266
8274
  if (options.debug) {
8267
8275
  this.addDisposables(new StrictEventsSequencing(this));
8268
8276
  }
8269
- 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(() => {
8277
+ 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(() => {
8270
8278
  this.updateWatermark();
8271
8279
  }), this.onDidAdd((event) => {
8272
8280
  if (!this._moving) {
@@ -8412,13 +8420,6 @@
8412
8420
  if (_window.isDisposed) {
8413
8421
  return false;
8414
8422
  }
8415
- if (popoutContainer === null) {
8416
- popoutWindowDisposable.dispose();
8417
- return false;
8418
- }
8419
- const gready = document.createElement('div');
8420
- gready.className = 'dv-overlay-render-container';
8421
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8422
8423
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8423
8424
  ? options.referenceGroup
8424
8425
  : itemToPopout instanceof DockviewPanel
@@ -8426,7 +8427,7 @@
8426
8427
  : itemToPopout;
8427
8428
  const referenceLocation = itemToPopout.api.location.type;
8428
8429
  /**
8429
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8430
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8430
8431
  * of this case is when being called from the `fromJSON(...)` method
8431
8432
  */
8432
8433
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8439,8 +8440,28 @@
8439
8440
  }
8440
8441
  else {
8441
8442
  group = this.createGroup({ id: groupId });
8442
- this._onDidAddGroup.fire(group);
8443
+ if (popoutContainer) {
8444
+ this._onDidAddGroup.fire(group);
8445
+ }
8443
8446
  }
8447
+ if (popoutContainer === null) {
8448
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8449
+ popoutWindowDisposable.dispose();
8450
+ this._onDidOpenPopoutWindowFail.fire();
8451
+ // if the popout window was blocked, we need to move the group back to the reference group
8452
+ // and set it to visible
8453
+ this.movingLock(() => moveGroupWithoutDestroying({
8454
+ from: group,
8455
+ to: referenceGroup,
8456
+ }));
8457
+ if (!referenceGroup.api.isVisible) {
8458
+ referenceGroup.api.setVisible(true);
8459
+ }
8460
+ return false;
8461
+ }
8462
+ const gready = document.createElement('div');
8463
+ gready.className = 'dv-overlay-render-container';
8464
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8444
8465
  group.model.renderContainer = overlayRenderContainer;
8445
8466
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8446
8467
  let floatingBox;
@@ -8597,7 +8618,7 @@
8597
8618
  return true;
8598
8619
  })
8599
8620
  .catch((err) => {
8600
- console.error('dockview: failed to create popout window', err);
8621
+ console.error('dockview: failed to create popout.', err);
8601
8622
  return false;
8602
8623
  });
8603
8624
  }