dockview 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
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 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
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 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
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
  */
@@ -8228,9 +8234,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8228
8234
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8229
8235
  this._onDidPopoutGroupPositionChange = new Emitter();
8230
8236
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8237
+ this._onDidOpenPopoutWindowFail = new Emitter();
8238
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8231
8239
  this._onDidLayoutFromJSON = new Emitter();
8232
8240
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8233
- this._onDidActivePanelChange = new Emitter();
8241
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8234
8242
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8235
8243
  this._onDidMovePanel = new Emitter();
8236
8244
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8292,7 +8300,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8292
8300
  if (options.debug) {
8293
8301
  this.addDisposables(new StrictEventsSequencing(this));
8294
8302
  }
8295
- 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(() => {
8303
+ 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(() => {
8296
8304
  this.updateWatermark();
8297
8305
  }), this.onDidAdd((event) => {
8298
8306
  if (!this._moving) {
@@ -8438,13 +8446,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8438
8446
  if (_window.isDisposed) {
8439
8447
  return false;
8440
8448
  }
8441
- if (popoutContainer === null) {
8442
- popoutWindowDisposable.dispose();
8443
- return false;
8444
- }
8445
- const gready = document.createElement('div');
8446
- gready.className = 'dv-overlay-render-container';
8447
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8448
8449
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8449
8450
  ? options.referenceGroup
8450
8451
  : itemToPopout instanceof DockviewPanel
@@ -8452,7 +8453,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8452
8453
  : itemToPopout;
8453
8454
  const referenceLocation = itemToPopout.api.location.type;
8454
8455
  /**
8455
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8456
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8456
8457
  * of this case is when being called from the `fromJSON(...)` method
8457
8458
  */
8458
8459
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8465,8 +8466,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8465
8466
  }
8466
8467
  else {
8467
8468
  group = this.createGroup({ id: groupId });
8468
- this._onDidAddGroup.fire(group);
8469
+ if (popoutContainer) {
8470
+ this._onDidAddGroup.fire(group);
8471
+ }
8469
8472
  }
8473
+ if (popoutContainer === null) {
8474
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8475
+ popoutWindowDisposable.dispose();
8476
+ this._onDidOpenPopoutWindowFail.fire();
8477
+ // if the popout window was blocked, we need to move the group back to the reference group
8478
+ // and set it to visible
8479
+ this.movingLock(() => moveGroupWithoutDestroying({
8480
+ from: group,
8481
+ to: referenceGroup,
8482
+ }));
8483
+ if (!referenceGroup.api.isVisible) {
8484
+ referenceGroup.api.setVisible(true);
8485
+ }
8486
+ return false;
8487
+ }
8488
+ const gready = document.createElement('div');
8489
+ gready.className = 'dv-overlay-render-container';
8490
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8470
8491
  group.model.renderContainer = overlayRenderContainer;
8471
8492
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8472
8493
  let floatingBox;
@@ -8623,7 +8644,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8623
8644
  return true;
8624
8645
  })
8625
8646
  .catch((err) => {
8626
- console.error('dockview: failed to create popout window', err);
8647
+ console.error('dockview: failed to create popout.', err);
8627
8648
  return false;
8628
8649
  });
8629
8650
  }