dockview 1.13.1 → 1.14.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 1.13.1
3
+ * @version 1.14.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -156,7 +156,7 @@ class Stacktrace {
156
156
  this.value = value;
157
157
  }
158
158
  print() {
159
- console.warn(this.value);
159
+ console.warn('dockview: stacktrace', this.value);
160
160
  }
161
161
  }
162
162
  class Listener {
@@ -221,7 +221,7 @@ class Emitter {
221
221
  var _a;
222
222
  // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
223
223
  for (const listener of this._listeners) {
224
- console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
224
+ console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
225
225
  }
226
226
  });
227
227
  }
@@ -5771,8 +5771,7 @@ class GridviewPanel extends BasePanelView {
5771
5771
  }
5772
5772
  }
5773
5773
 
5774
- // TODO find a better way to initialize and avoid needing null checks
5775
- const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
5774
+ const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
5776
5775
  class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5777
5776
  get location() {
5778
5777
  if (!this._group) {
@@ -5845,14 +5844,14 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5845
5844
  }
5846
5845
  }
5847
5846
  initialize(group) {
5848
- this._group = group;
5849
5847
  /**
5850
- * TODO: Annoying initialization order caveat
5848
+ * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
5851
5849
  *
5852
5850
  * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
5853
5851
  * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
5854
5852
  * finished ensuring the `model` is defined.
5855
5853
  */
5854
+ this._group = group;
5856
5855
  queueMicrotask(() => {
5857
5856
  this._mutableDisposable.value =
5858
5857
  this._group.model.onDidActivePanelChange((event) => {
@@ -6006,12 +6005,10 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
6006
6005
  var _a;
6007
6006
  let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
6008
6007
  this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
6009
- if (!event.isVisible && this.isVisible) {
6010
- this._onDidVisibilityChange.fire(event);
6011
- }
6012
- else if (event.isVisible &&
6013
- !this.isVisible &&
6014
- this.group.model.isPanelActive(this.panel)) {
6008
+ const hasBecomeHidden = !event.isVisible && this.isVisible;
6009
+ const hasBecomeVisible = event.isVisible && !this.isVisible;
6010
+ const isActivePanel = this.group.model.isPanelActive(this.panel);
6011
+ if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
6015
6012
  this._onDidVisibilityChange.fire(event);
6016
6013
  }
6017
6014
  }), this.group.api.onDidLocationChange((event) => {
@@ -6097,12 +6094,6 @@ class DockviewPanel extends CompositeDisposable {
6097
6094
  const didTitleChange = title !== this.title;
6098
6095
  if (didTitleChange) {
6099
6096
  this._title = title;
6100
- this.view.update({
6101
- params: {
6102
- params: this._params,
6103
- title: this.title,
6104
- },
6105
- });
6106
6097
  this.api._onDidTitleChange.fire({ title });
6107
6098
  }
6108
6099
  }
@@ -6130,10 +6121,7 @@ class DockviewPanel extends CompositeDisposable {
6130
6121
  }
6131
6122
  // update the view with the updated props
6132
6123
  this.view.update({
6133
- params: {
6134
- params: this._params,
6135
- title: this.title,
6136
- },
6124
+ params: this._params,
6137
6125
  });
6138
6126
  }
6139
6127
  updateParentGroup(group, options) {
@@ -7248,7 +7236,7 @@ class DockviewComponent extends BaseGrid {
7248
7236
  return element.getBoundingClientRect();
7249
7237
  }
7250
7238
  const box = getBox();
7251
- const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId(); //item.id;
7239
+ const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
7252
7240
  if (itemToPopout.api.location.type === 'grid') {
7253
7241
  itemToPopout.api.setVisible(false);
7254
7242
  }
@@ -7364,24 +7352,22 @@ class DockviewComponent extends BaseGrid {
7364
7352
  });
7365
7353
  }
7366
7354
  }
7367
- else {
7368
- if (this.getPanel(group.id)) {
7369
- const removedGroup = this.doRemoveGroup(group, {
7370
- skipDispose: true,
7371
- skipActive: true,
7372
- });
7373
- removedGroup.model.renderContainer =
7374
- this.overlayRenderContainer;
7375
- removedGroup.model.location = { type: 'grid' };
7376
- returnedGroup = removedGroup;
7377
- }
7355
+ else if (this.getPanel(group.id)) {
7356
+ const removedGroup = this.doRemoveGroup(group, {
7357
+ skipDispose: true,
7358
+ skipActive: true,
7359
+ });
7360
+ removedGroup.model.renderContainer =
7361
+ this.overlayRenderContainer;
7362
+ removedGroup.model.location = { type: 'grid' };
7363
+ returnedGroup = removedGroup;
7378
7364
  }
7379
7365
  }));
7380
7366
  this._popoutGroups.push(value);
7381
7367
  this.updateWatermark();
7382
7368
  })
7383
7369
  .catch((err) => {
7384
- console.error(err);
7370
+ console.error('dockview: failed to create popout window', err);
7385
7371
  });
7386
7372
  }
7387
7373
  addFloatingGroup(item, coord, options) {
@@ -7424,7 +7410,7 @@ class DockviewComponent extends BaseGrid {
7424
7410
  this.doRemoveGroup(item, {
7425
7411
  skipDispose: true,
7426
7412
  skipPopoutReturn: true,
7427
- skipPopoutAssociated: !!popoutReferenceGroup,
7413
+ skipPopoutAssociated: false,
7428
7414
  });
7429
7415
  }
7430
7416
  }
@@ -7784,7 +7770,6 @@ class DockviewComponent extends BaseGrid {
7784
7770
  clear() {
7785
7771
  const groups = Array.from(this._groups.values()).map((_) => _.value);
7786
7772
  const hasActiveGroup = !!this.activeGroup;
7787
- !!this.activePanel;
7788
7773
  for (const group of groups) {
7789
7774
  // remove the group will automatically remove the panels
7790
7775
  this.removeGroup(group, { skipActive: true });
@@ -8290,7 +8275,7 @@ class DockviewComponent extends BaseGrid {
8290
8275
  }
8291
8276
  let id = options === null || options === void 0 ? void 0 : options.id;
8292
8277
  if (id && this._groups.has(options.id)) {
8293
- console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8278
+ console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8294
8279
  id = undefined;
8295
8280
  }
8296
8281
  if (!id) {
@@ -9507,7 +9492,7 @@ class ReactPanelContentPart {
9507
9492
  }
9508
9493
  update(event) {
9509
9494
  var _a;
9510
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9495
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9511
9496
  }
9512
9497
  layout(_width, _height) {
9513
9498
  // noop
@@ -9545,7 +9530,7 @@ class ReactPanelHeaderPart {
9545
9530
  }
9546
9531
  update(event) {
9547
9532
  var _a;
9548
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9533
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9549
9534
  }
9550
9535
  layout(_width, _height) {
9551
9536
  // noop - retrieval from api