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
  */
@@ -187,7 +187,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
187
187
  return this._event;
188
188
  }
189
189
  fire(e) {
190
- this._last = e;
190
+ var _a;
191
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
192
+ this._last = e;
193
+ }
191
194
  for (const listener of this._listeners) {
192
195
  listener.callback(e);
193
196
  }
@@ -3619,6 +3622,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3619
3622
  get onDidPopoutGroupPositionChange() {
3620
3623
  return this.component.onDidPopoutGroupPositionChange;
3621
3624
  }
3625
+ get onDidOpenPopoutWindowFail() {
3626
+ return this.component.onDidOpenPopoutWindowFail;
3627
+ }
3622
3628
  /**
3623
3629
  * All panel objects.
3624
3630
  */
@@ -8198,9 +8204,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8198
8204
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8199
8205
  this._onDidPopoutGroupPositionChange = new Emitter();
8200
8206
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8207
+ this._onDidOpenPopoutWindowFail = new Emitter();
8208
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8201
8209
  this._onDidLayoutFromJSON = new Emitter();
8202
8210
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8203
- this._onDidActivePanelChange = new Emitter();
8211
+ this._onDidActivePanelChange = new Emitter({ replay: true });
8204
8212
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
8205
8213
  this._onDidMovePanel = new Emitter();
8206
8214
  this.onDidMovePanel = this._onDidMovePanel.event;
@@ -8262,7 +8270,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8262
8270
  if (options.debug) {
8263
8271
  this.addDisposables(new StrictEventsSequencing(this));
8264
8272
  }
8265
- 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(() => {
8273
+ 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(() => {
8266
8274
  this.updateWatermark();
8267
8275
  }), this.onDidAdd((event) => {
8268
8276
  if (!this._moving) {
@@ -8408,13 +8416,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8408
8416
  if (_window.isDisposed) {
8409
8417
  return false;
8410
8418
  }
8411
- if (popoutContainer === null) {
8412
- popoutWindowDisposable.dispose();
8413
- return false;
8414
- }
8415
- const gready = document.createElement('div');
8416
- gready.className = 'dv-overlay-render-container';
8417
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8418
8419
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8419
8420
  ? options.referenceGroup
8420
8421
  : itemToPopout instanceof DockviewPanel
@@ -8422,7 +8423,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8422
8423
  : itemToPopout;
8423
8424
  const referenceLocation = itemToPopout.api.location.type;
8424
8425
  /**
8425
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8426
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8426
8427
  * of this case is when being called from the `fromJSON(...)` method
8427
8428
  */
8428
8429
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8435,8 +8436,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8435
8436
  }
8436
8437
  else {
8437
8438
  group = this.createGroup({ id: groupId });
8438
- this._onDidAddGroup.fire(group);
8439
+ if (popoutContainer) {
8440
+ this._onDidAddGroup.fire(group);
8441
+ }
8439
8442
  }
8443
+ if (popoutContainer === null) {
8444
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8445
+ popoutWindowDisposable.dispose();
8446
+ this._onDidOpenPopoutWindowFail.fire();
8447
+ // if the popout window was blocked, we need to move the group back to the reference group
8448
+ // and set it to visible
8449
+ this.movingLock(() => moveGroupWithoutDestroying({
8450
+ from: group,
8451
+ to: referenceGroup,
8452
+ }));
8453
+ if (!referenceGroup.api.isVisible) {
8454
+ referenceGroup.api.setVisible(true);
8455
+ }
8456
+ return false;
8457
+ }
8458
+ const gready = document.createElement('div');
8459
+ gready.className = 'dv-overlay-render-container';
8460
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8440
8461
  group.model.renderContainer = overlayRenderContainer;
8441
8462
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8442
8463
  let floatingBox;
@@ -8593,7 +8614,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8593
8614
  return true;
8594
8615
  })
8595
8616
  .catch((err) => {
8596
- console.error('dockview: failed to create popout window', err);
8617
+ console.error('dockview: failed to create popout.', err);
8597
8618
  return false;
8598
8619
  });
8599
8620
  }