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.
package/dist/dockview.js CHANGED
@@ -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
  */
@@ -159,7 +159,7 @@
159
159
  this.value = value;
160
160
  }
161
161
  print() {
162
- console.warn(this.value);
162
+ console.warn('dockview: stacktrace', this.value);
163
163
  }
164
164
  }
165
165
  class Listener {
@@ -224,7 +224,7 @@
224
224
  var _a;
225
225
  // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
226
226
  for (const listener of this._listeners) {
227
- console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
227
+ console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
228
228
  }
229
229
  });
230
230
  }
@@ -5774,8 +5774,7 @@
5774
5774
  }
5775
5775
  }
5776
5776
 
5777
- // TODO find a better way to initialize and avoid needing null checks
5778
- const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
5777
+ const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
5779
5778
  class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5780
5779
  get location() {
5781
5780
  if (!this._group) {
@@ -5848,14 +5847,14 @@
5848
5847
  }
5849
5848
  }
5850
5849
  initialize(group) {
5851
- this._group = group;
5852
5850
  /**
5853
- * TODO: Annoying initialization order caveat
5851
+ * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
5854
5852
  *
5855
5853
  * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
5856
5854
  * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
5857
5855
  * finished ensuring the `model` is defined.
5858
5856
  */
5857
+ this._group = group;
5859
5858
  queueMicrotask(() => {
5860
5859
  this._mutableDisposable.value =
5861
5860
  this._group.model.onDidActivePanelChange((event) => {
@@ -6009,12 +6008,10 @@
6009
6008
  var _a;
6010
6009
  let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
6011
6010
  this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
6012
- if (!event.isVisible && this.isVisible) {
6013
- this._onDidVisibilityChange.fire(event);
6014
- }
6015
- else if (event.isVisible &&
6016
- !this.isVisible &&
6017
- this.group.model.isPanelActive(this.panel)) {
6011
+ const hasBecomeHidden = !event.isVisible && this.isVisible;
6012
+ const hasBecomeVisible = event.isVisible && !this.isVisible;
6013
+ const isActivePanel = this.group.model.isPanelActive(this.panel);
6014
+ if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
6018
6015
  this._onDidVisibilityChange.fire(event);
6019
6016
  }
6020
6017
  }), this.group.api.onDidLocationChange((event) => {
@@ -6100,12 +6097,6 @@
6100
6097
  const didTitleChange = title !== this.title;
6101
6098
  if (didTitleChange) {
6102
6099
  this._title = title;
6103
- this.view.update({
6104
- params: {
6105
- params: this._params,
6106
- title: this.title,
6107
- },
6108
- });
6109
6100
  this.api._onDidTitleChange.fire({ title });
6110
6101
  }
6111
6102
  }
@@ -6133,10 +6124,7 @@
6133
6124
  }
6134
6125
  // update the view with the updated props
6135
6126
  this.view.update({
6136
- params: {
6137
- params: this._params,
6138
- title: this.title,
6139
- },
6127
+ params: this._params,
6140
6128
  });
6141
6129
  }
6142
6130
  updateParentGroup(group, options) {
@@ -7251,7 +7239,7 @@
7251
7239
  return element.getBoundingClientRect();
7252
7240
  }
7253
7241
  const box = getBox();
7254
- 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;
7242
+ 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();
7255
7243
  if (itemToPopout.api.location.type === 'grid') {
7256
7244
  itemToPopout.api.setVisible(false);
7257
7245
  }
@@ -7367,24 +7355,22 @@
7367
7355
  });
7368
7356
  }
7369
7357
  }
7370
- else {
7371
- if (this.getPanel(group.id)) {
7372
- const removedGroup = this.doRemoveGroup(group, {
7373
- skipDispose: true,
7374
- skipActive: true,
7375
- });
7376
- removedGroup.model.renderContainer =
7377
- this.overlayRenderContainer;
7378
- removedGroup.model.location = { type: 'grid' };
7379
- returnedGroup = removedGroup;
7380
- }
7358
+ else if (this.getPanel(group.id)) {
7359
+ const removedGroup = this.doRemoveGroup(group, {
7360
+ skipDispose: true,
7361
+ skipActive: true,
7362
+ });
7363
+ removedGroup.model.renderContainer =
7364
+ this.overlayRenderContainer;
7365
+ removedGroup.model.location = { type: 'grid' };
7366
+ returnedGroup = removedGroup;
7381
7367
  }
7382
7368
  }));
7383
7369
  this._popoutGroups.push(value);
7384
7370
  this.updateWatermark();
7385
7371
  })
7386
7372
  .catch((err) => {
7387
- console.error(err);
7373
+ console.error('dockview: failed to create popout window', err);
7388
7374
  });
7389
7375
  }
7390
7376
  addFloatingGroup(item, coord, options) {
@@ -7427,7 +7413,7 @@
7427
7413
  this.doRemoveGroup(item, {
7428
7414
  skipDispose: true,
7429
7415
  skipPopoutReturn: true,
7430
- skipPopoutAssociated: !!popoutReferenceGroup,
7416
+ skipPopoutAssociated: false,
7431
7417
  });
7432
7418
  }
7433
7419
  }
@@ -7787,7 +7773,6 @@
7787
7773
  clear() {
7788
7774
  const groups = Array.from(this._groups.values()).map((_) => _.value);
7789
7775
  const hasActiveGroup = !!this.activeGroup;
7790
- !!this.activePanel;
7791
7776
  for (const group of groups) {
7792
7777
  // remove the group will automatically remove the panels
7793
7778
  this.removeGroup(group, { skipActive: true });
@@ -8293,7 +8278,7 @@
8293
8278
  }
8294
8279
  let id = options === null || options === void 0 ? void 0 : options.id;
8295
8280
  if (id && this._groups.has(options.id)) {
8296
- console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8281
+ console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8297
8282
  id = undefined;
8298
8283
  }
8299
8284
  if (!id) {
@@ -9510,7 +9495,7 @@
9510
9495
  }
9511
9496
  update(event) {
9512
9497
  var _a;
9513
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9498
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9514
9499
  }
9515
9500
  layout(_width, _height) {
9516
9501
  // noop
@@ -9548,7 +9533,7 @@
9548
9533
  }
9549
9534
  update(event) {
9550
9535
  var _a;
9551
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
9536
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
9552
9537
  }
9553
9538
  layout(_width, _height) {
9554
9539
  // noop - retrieval from api