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
  */
@@ -129,7 +129,7 @@
129
129
  this.value = value;
130
130
  }
131
131
  print() {
132
- console.warn(this.value);
132
+ console.warn('dockview: stacktrace', this.value);
133
133
  }
134
134
  }
135
135
  class Listener {
@@ -194,7 +194,7 @@
194
194
  var _a;
195
195
  // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
196
196
  for (const listener of this._listeners) {
197
- console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
197
+ console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
198
198
  }
199
199
  });
200
200
  }
@@ -5744,8 +5744,7 @@
5744
5744
  }
5745
5745
  }
5746
5746
 
5747
- // TODO find a better way to initialize and avoid needing null checks
5748
- const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
5747
+ const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
5749
5748
  class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5750
5749
  get location() {
5751
5750
  if (!this._group) {
@@ -5818,14 +5817,14 @@
5818
5817
  }
5819
5818
  }
5820
5819
  initialize(group) {
5821
- this._group = group;
5822
5820
  /**
5823
- * TODO: Annoying initialization order caveat
5821
+ * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
5824
5822
  *
5825
5823
  * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
5826
5824
  * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
5827
5825
  * finished ensuring the `model` is defined.
5828
5826
  */
5827
+ this._group = group;
5829
5828
  queueMicrotask(() => {
5830
5829
  this._mutableDisposable.value =
5831
5830
  this._group.model.onDidActivePanelChange((event) => {
@@ -5979,12 +5978,10 @@
5979
5978
  var _a;
5980
5979
  let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
5981
5980
  this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
5982
- if (!event.isVisible && this.isVisible) {
5983
- this._onDidVisibilityChange.fire(event);
5984
- }
5985
- else if (event.isVisible &&
5986
- !this.isVisible &&
5987
- this.group.model.isPanelActive(this.panel)) {
5981
+ const hasBecomeHidden = !event.isVisible && this.isVisible;
5982
+ const hasBecomeVisible = event.isVisible && !this.isVisible;
5983
+ const isActivePanel = this.group.model.isPanelActive(this.panel);
5984
+ if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
5988
5985
  this._onDidVisibilityChange.fire(event);
5989
5986
  }
5990
5987
  }), this.group.api.onDidLocationChange((event) => {
@@ -6070,12 +6067,6 @@
6070
6067
  const didTitleChange = title !== this.title;
6071
6068
  if (didTitleChange) {
6072
6069
  this._title = title;
6073
- this.view.update({
6074
- params: {
6075
- params: this._params,
6076
- title: this.title,
6077
- },
6078
- });
6079
6070
  this.api._onDidTitleChange.fire({ title });
6080
6071
  }
6081
6072
  }
@@ -6103,10 +6094,7 @@
6103
6094
  }
6104
6095
  // update the view with the updated props
6105
6096
  this.view.update({
6106
- params: {
6107
- params: this._params,
6108
- title: this.title,
6109
- },
6097
+ params: this._params,
6110
6098
  });
6111
6099
  }
6112
6100
  updateParentGroup(group, options) {
@@ -7221,7 +7209,7 @@
7221
7209
  return element.getBoundingClientRect();
7222
7210
  }
7223
7211
  const box = getBox();
7224
- 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;
7212
+ 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();
7225
7213
  if (itemToPopout.api.location.type === 'grid') {
7226
7214
  itemToPopout.api.setVisible(false);
7227
7215
  }
@@ -7337,24 +7325,22 @@
7337
7325
  });
7338
7326
  }
7339
7327
  }
7340
- else {
7341
- if (this.getPanel(group.id)) {
7342
- const removedGroup = this.doRemoveGroup(group, {
7343
- skipDispose: true,
7344
- skipActive: true,
7345
- });
7346
- removedGroup.model.renderContainer =
7347
- this.overlayRenderContainer;
7348
- removedGroup.model.location = { type: 'grid' };
7349
- returnedGroup = removedGroup;
7350
- }
7328
+ else if (this.getPanel(group.id)) {
7329
+ const removedGroup = this.doRemoveGroup(group, {
7330
+ skipDispose: true,
7331
+ skipActive: true,
7332
+ });
7333
+ removedGroup.model.renderContainer =
7334
+ this.overlayRenderContainer;
7335
+ removedGroup.model.location = { type: 'grid' };
7336
+ returnedGroup = removedGroup;
7351
7337
  }
7352
7338
  }));
7353
7339
  this._popoutGroups.push(value);
7354
7340
  this.updateWatermark();
7355
7341
  })
7356
7342
  .catch((err) => {
7357
- console.error(err);
7343
+ console.error('dockview: failed to create popout window', err);
7358
7344
  });
7359
7345
  }
7360
7346
  addFloatingGroup(item, coord, options) {
@@ -7397,7 +7383,7 @@
7397
7383
  this.doRemoveGroup(item, {
7398
7384
  skipDispose: true,
7399
7385
  skipPopoutReturn: true,
7400
- skipPopoutAssociated: !!popoutReferenceGroup,
7386
+ skipPopoutAssociated: false,
7401
7387
  });
7402
7388
  }
7403
7389
  }
@@ -7757,7 +7743,6 @@
7757
7743
  clear() {
7758
7744
  const groups = Array.from(this._groups.values()).map((_) => _.value);
7759
7745
  const hasActiveGroup = !!this.activeGroup;
7760
- !!this.activePanel;
7761
7746
  for (const group of groups) {
7762
7747
  // remove the group will automatically remove the panels
7763
7748
  this.removeGroup(group, { skipActive: true });
@@ -8263,7 +8248,7 @@
8263
8248
  }
8264
8249
  let id = options === null || options === void 0 ? void 0 : options.id;
8265
8250
  if (id && this._groups.has(options.id)) {
8266
- console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8251
+ console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8267
8252
  id = undefined;
8268
8253
  }
8269
8254
  if (!id) {
@@ -9480,7 +9465,7 @@
9480
9465
  }
9481
9466
  update(event) {
9482
9467
  var _a;
9483
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9468
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9484
9469
  }
9485
9470
  layout(_width, _height) {
9486
9471
  // noop
@@ -9518,7 +9503,7 @@
9518
9503
  }
9519
9504
  update(event) {
9520
9505
  var _a;
9521
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9506
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9522
9507
  }
9523
9508
  layout(_width, _height) {
9524
9509
  // noop - retrieval from api