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