dockview-core 4.3.1 → 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.
@@ -419,6 +419,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
419
419
  get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>;
420
420
  get onDidPopoutGroupSizeChange(): Event<PopoutGroupChangeSizeEvent>;
421
421
  get onDidPopoutGroupPositionChange(): Event<PopoutGroupChangePositionEvent>;
422
+ get onDidOpenPopoutWindowFail(): Event<void>;
422
423
  /**
423
424
  * All panel objects.
424
425
  */
@@ -831,6 +831,13 @@ var DockviewApi = /** @class */ (function () {
831
831
  enumerable: false,
832
832
  configurable: true
833
833
  });
834
+ Object.defineProperty(DockviewApi.prototype, "onDidOpenPopoutWindowFail", {
835
+ get: function () {
836
+ return this.component.onDidOpenPopoutWindowFail;
837
+ },
838
+ enumerable: false,
839
+ configurable: true
840
+ });
834
841
  Object.defineProperty(DockviewApi.prototype, "panels", {
835
842
  /**
836
843
  * All panel objects.
@@ -140,6 +140,7 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
140
140
  readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChanged>;
141
141
  readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>;
142
142
  readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>;
143
+ readonly onDidOpenPopoutWindowFail: Event<void>;
143
144
  readonly options: DockviewComponentOptions;
144
145
  updateOptions(options: DockviewOptions): void;
145
146
  moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
@@ -202,6 +203,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
202
203
  readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>;
203
204
  private readonly _onDidPopoutGroupPositionChange;
204
205
  readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>;
206
+ private readonly _onDidOpenPopoutWindowFail;
207
+ readonly onDidOpenPopoutWindowFail: Event<void>;
205
208
  private readonly _onDidLayoutFromJSON;
206
209
  readonly onDidLayoutFromJSON: Event<void>;
207
210
  private readonly _onDidActivePanelChange;
@@ -146,6 +146,8 @@ var DockviewComponent = /** @class */ (function (_super) {
146
146
  _this.onDidPopoutGroupSizeChange = _this._onDidPopoutGroupSizeChange.event;
147
147
  _this._onDidPopoutGroupPositionChange = new events_1.Emitter();
148
148
  _this.onDidPopoutGroupPositionChange = _this._onDidPopoutGroupPositionChange.event;
149
+ _this._onDidOpenPopoutWindowFail = new events_1.Emitter();
150
+ _this.onDidOpenPopoutWindowFail = _this._onDidOpenPopoutWindowFail.event;
149
151
  _this._onDidLayoutFromJSON = new events_1.Emitter();
150
152
  _this.onDidLayoutFromJSON = _this._onDidLayoutFromJSON.event;
151
153
  _this._onDidActivePanelChange = new events_1.Emitter({ replay: true });
@@ -210,7 +212,7 @@ var DockviewComponent = /** @class */ (function (_super) {
210
212
  if (options.debug) {
211
213
  _this.addDisposables(new strictEventsSequencing_1.StrictEventsSequencing(_this));
212
214
  }
213
- _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(function () {
215
+ _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(function () {
214
216
  _this.updateWatermark();
215
217
  }), _this.onDidAdd(function (event) {
216
218
  if (!_this._moving) {
@@ -440,13 +442,6 @@ var DockviewComponent = /** @class */ (function (_super) {
440
442
  if (_window.isDisposed) {
441
443
  return false;
442
444
  }
443
- if (popoutContainer === null) {
444
- popoutWindowDisposable.dispose();
445
- return false;
446
- }
447
- var gready = document.createElement('div');
448
- gready.className = 'dv-overlay-render-container';
449
- var overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(gready, _this);
450
445
  var referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
451
446
  ? options.referenceGroup
452
447
  : itemToPopout instanceof dockviewPanel_1.DockviewPanel
@@ -454,7 +449,7 @@ var DockviewComponent = /** @class */ (function (_super) {
454
449
  : itemToPopout;
455
450
  var referenceLocation = itemToPopout.api.location.type;
456
451
  /**
457
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
452
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
458
453
  * of this case is when being called from the `fromJSON(...)` method
459
454
  */
460
455
  var isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -467,8 +462,30 @@ var DockviewComponent = /** @class */ (function (_super) {
467
462
  }
468
463
  else {
469
464
  group = _this.createGroup({ id: groupId });
470
- _this._onDidAddGroup.fire(group);
465
+ if (popoutContainer) {
466
+ _this._onDidAddGroup.fire(group);
467
+ }
471
468
  }
469
+ if (popoutContainer === null) {
470
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
471
+ popoutWindowDisposable.dispose();
472
+ _this._onDidOpenPopoutWindowFail.fire();
473
+ // if the popout window was blocked, we need to move the group back to the reference group
474
+ // and set it to visible
475
+ _this.movingLock(function () {
476
+ return moveGroupWithoutDestroying({
477
+ from: group,
478
+ to: referenceGroup,
479
+ });
480
+ });
481
+ if (!referenceGroup.api.isVisible) {
482
+ referenceGroup.api.setVisible(true);
483
+ }
484
+ return false;
485
+ }
486
+ var gready = document.createElement('div');
487
+ gready.className = 'dv-overlay-render-container';
488
+ var overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(gready, _this);
472
489
  group.model.renderContainer = overlayRenderContainer;
473
490
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
474
491
  var floatingBox;
@@ -631,7 +648,7 @@ var DockviewComponent = /** @class */ (function (_super) {
631
648
  return true;
632
649
  })
633
650
  .catch(function (err) {
634
- console.error('dockview: failed to create popout window', err);
651
+ console.error('dockview: failed to create popout.', err);
635
652
  return false;
636
653
  });
637
654
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.3.1
3
+ * @version 4.4.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3652,6 +3652,9 @@ define(['exports'], (function (exports) { 'use strict';
3652
3652
  get onDidPopoutGroupPositionChange() {
3653
3653
  return this.component.onDidPopoutGroupPositionChange;
3654
3654
  }
3655
+ get onDidOpenPopoutWindowFail() {
3656
+ return this.component.onDidOpenPopoutWindowFail;
3657
+ }
3655
3658
  /**
3656
3659
  * All panel objects.
3657
3660
  */
@@ -8254,6 +8257,8 @@ define(['exports'], (function (exports) { 'use strict';
8254
8257
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8255
8258
  this._onDidPopoutGroupPositionChange = new Emitter();
8256
8259
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8260
+ this._onDidOpenPopoutWindowFail = new Emitter();
8261
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8257
8262
  this._onDidLayoutFromJSON = new Emitter();
8258
8263
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8259
8264
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8318,7 +8323,7 @@ define(['exports'], (function (exports) { 'use strict';
8318
8323
  if (options.debug) {
8319
8324
  this.addDisposables(new StrictEventsSequencing(this));
8320
8325
  }
8321
- 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(() => {
8326
+ 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(() => {
8322
8327
  this.updateWatermark();
8323
8328
  }), this.onDidAdd((event) => {
8324
8329
  if (!this._moving) {
@@ -8464,13 +8469,6 @@ define(['exports'], (function (exports) { 'use strict';
8464
8469
  if (_window.isDisposed) {
8465
8470
  return false;
8466
8471
  }
8467
- if (popoutContainer === null) {
8468
- popoutWindowDisposable.dispose();
8469
- return false;
8470
- }
8471
- const gready = document.createElement('div');
8472
- gready.className = 'dv-overlay-render-container';
8473
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8474
8472
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8475
8473
  ? options.referenceGroup
8476
8474
  : itemToPopout instanceof DockviewPanel
@@ -8478,7 +8476,7 @@ define(['exports'], (function (exports) { 'use strict';
8478
8476
  : itemToPopout;
8479
8477
  const referenceLocation = itemToPopout.api.location.type;
8480
8478
  /**
8481
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8479
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8482
8480
  * of this case is when being called from the `fromJSON(...)` method
8483
8481
  */
8484
8482
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8491,8 +8489,28 @@ define(['exports'], (function (exports) { 'use strict';
8491
8489
  }
8492
8490
  else {
8493
8491
  group = this.createGroup({ id: groupId });
8494
- this._onDidAddGroup.fire(group);
8492
+ if (popoutContainer) {
8493
+ this._onDidAddGroup.fire(group);
8494
+ }
8495
8495
  }
8496
+ if (popoutContainer === null) {
8497
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8498
+ popoutWindowDisposable.dispose();
8499
+ this._onDidOpenPopoutWindowFail.fire();
8500
+ // if the popout window was blocked, we need to move the group back to the reference group
8501
+ // and set it to visible
8502
+ this.movingLock(() => moveGroupWithoutDestroying({
8503
+ from: group,
8504
+ to: referenceGroup,
8505
+ }));
8506
+ if (!referenceGroup.api.isVisible) {
8507
+ referenceGroup.api.setVisible(true);
8508
+ }
8509
+ return false;
8510
+ }
8511
+ const gready = document.createElement('div');
8512
+ gready.className = 'dv-overlay-render-container';
8513
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8496
8514
  group.model.renderContainer = overlayRenderContainer;
8497
8515
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8498
8516
  let floatingBox;
@@ -8649,7 +8667,7 @@ define(['exports'], (function (exports) { 'use strict';
8649
8667
  return true;
8650
8668
  })
8651
8669
  .catch((err) => {
8652
- console.error('dockview: failed to create popout window', err);
8670
+ console.error('dockview: failed to create popout.', err);
8653
8671
  return false;
8654
8672
  });
8655
8673
  }