dockview-core 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.
Files changed (34) hide show
  1. package/dist/cjs/api/dockviewGroupPanelApi.js +4 -5
  2. package/dist/cjs/api/dockviewPanelApi.js +4 -6
  3. package/dist/cjs/dockview/dockviewComponent.js +13 -16
  4. package/dist/cjs/dockview/dockviewPanel.js +1 -10
  5. package/dist/cjs/events.js +3 -3
  6. package/dist/dockview-core.amd.js +24 -39
  7. package/dist/dockview-core.amd.js.map +1 -1
  8. package/dist/dockview-core.amd.min.js +2 -2
  9. package/dist/dockview-core.amd.min.js.map +1 -1
  10. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  11. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  12. package/dist/dockview-core.amd.noStyle.js +24 -39
  13. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  14. package/dist/dockview-core.cjs.js +24 -39
  15. package/dist/dockview-core.cjs.js.map +1 -1
  16. package/dist/dockview-core.esm.js +24 -39
  17. package/dist/dockview-core.esm.js.map +1 -1
  18. package/dist/dockview-core.esm.min.js +2 -2
  19. package/dist/dockview-core.esm.min.js.map +1 -1
  20. package/dist/dockview-core.js +24 -39
  21. package/dist/dockview-core.js.map +1 -1
  22. package/dist/dockview-core.min.js +2 -2
  23. package/dist/dockview-core.min.js.map +1 -1
  24. package/dist/dockview-core.min.noStyle.js +2 -2
  25. package/dist/dockview-core.min.noStyle.js.map +1 -1
  26. package/dist/dockview-core.noStyle.js +24 -39
  27. package/dist/dockview-core.noStyle.js.map +1 -1
  28. package/dist/esm/api/dockviewGroupPanelApi.js +3 -4
  29. package/dist/esm/api/dockviewPanelApi.js +4 -6
  30. package/dist/esm/dockview/components/titlebar/tabsContainer.js +1 -1
  31. package/dist/esm/dockview/dockviewComponent.js +13 -16
  32. package/dist/esm/dockview/dockviewPanel.js +1 -10
  33. package/dist/esm/events.js +3 -3
  34. package/package.json +1 -1
@@ -20,8 +20,7 @@ var droptarget_1 = require("../dnd/droptarget");
20
20
  var events_1 = require("../events");
21
21
  var lifecycle_1 = require("../lifecycle");
22
22
  var gridviewPanelApi_1 = require("./gridviewPanelApi");
23
- // TODO find a better way to initialize and avoid needing null checks
24
- var NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
23
+ var NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
25
24
  var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
26
25
  __extends(DockviewGroupPanelApiImpl, _super);
27
26
  function DockviewGroupPanelApiImpl(id, accessor) {
@@ -100,15 +99,15 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
100
99
  }
101
100
  };
102
101
  DockviewGroupPanelApiImpl.prototype.initialize = function (group) {
103
- var _this = this;
104
- this._group = group;
105
102
  /**
106
- * TODO: Annoying initialization order caveat
103
+ * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
107
104
  *
108
105
  * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
109
106
  * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
110
107
  * finished ensuring the `model` is defined.
111
108
  */
109
+ var _this = this;
110
+ this._group = group;
112
111
  queueMicrotask(function () {
113
112
  _this._mutableDisposable.value =
114
113
  _this._group.model.onDidActivePanelChange(function (event) {
@@ -133,12 +133,10 @@ var DockviewPanelApiImpl = /** @class */ (function (_super) {
133
133
  var _a;
134
134
  var _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
135
135
  this.groupEventsDisposable.value = new lifecycle_1.CompositeDisposable(this.group.api.onDidVisibilityChange(function (event) {
136
- if (!event.isVisible && _this.isVisible) {
137
- _this._onDidVisibilityChange.fire(event);
138
- }
139
- else if (event.isVisible &&
140
- !_this.isVisible &&
141
- _this.group.model.isPanelActive(_this.panel)) {
136
+ var hasBecomeHidden = !event.isVisible && _this.isVisible;
137
+ var hasBecomeVisible = event.isVisible && !_this.isVisible;
138
+ var isActivePanel = _this.group.model.isPanelActive(_this.panel);
139
+ if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
142
140
  _this._onDidVisibilityChange.fire(event);
143
141
  }
144
142
  }), this.group.api.onDidLocationChange(function (event) {
@@ -447,7 +447,7 @@ var DockviewComponent = /** @class */ (function (_super) {
447
447
  return element.getBoundingClientRect();
448
448
  }
449
449
  var box = getBox();
450
- var 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;
450
+ var 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();
451
451
  if (itemToPopout.api.location.type === 'grid') {
452
452
  itemToPopout.api.setVisible(false);
453
453
  }
@@ -567,24 +567,22 @@ var DockviewComponent = /** @class */ (function (_super) {
567
567
  });
568
568
  }
569
569
  }
570
- else {
571
- if (_this.getPanel(group.id)) {
572
- var removedGroup = _this.doRemoveGroup(group, {
573
- skipDispose: true,
574
- skipActive: true,
575
- });
576
- removedGroup.model.renderContainer =
577
- _this.overlayRenderContainer;
578
- removedGroup.model.location = { type: 'grid' };
579
- returnedGroup = removedGroup;
580
- }
570
+ else if (_this.getPanel(group.id)) {
571
+ var removedGroup = _this.doRemoveGroup(group, {
572
+ skipDispose: true,
573
+ skipActive: true,
574
+ });
575
+ removedGroup.model.renderContainer =
576
+ _this.overlayRenderContainer;
577
+ removedGroup.model.location = { type: 'grid' };
578
+ returnedGroup = removedGroup;
581
579
  }
582
580
  }));
583
581
  _this._popoutGroups.push(value);
584
582
  _this.updateWatermark();
585
583
  })
586
584
  .catch(function (err) {
587
- console.error(err);
585
+ console.error('dockview: failed to create popout window', err);
588
586
  });
589
587
  };
590
588
  DockviewComponent.prototype.addFloatingGroup = function (item, coord, options) {
@@ -634,7 +632,7 @@ var DockviewComponent = /** @class */ (function (_super) {
634
632
  this.doRemoveGroup(item, {
635
633
  skipDispose: true,
636
634
  skipPopoutReturn: true,
637
- skipPopoutAssociated: !!popoutReferenceGroup_1,
635
+ skipPopoutAssociated: false,
638
636
  });
639
637
  }
640
638
  }
@@ -1104,7 +1102,6 @@ var DockviewComponent = /** @class */ (function (_super) {
1104
1102
  var e_13, _a;
1105
1103
  var groups = Array.from(this._groups.values()).map(function (_) { return _.value; });
1106
1104
  var hasActiveGroup = !!this.activeGroup;
1107
- var hasActivePanel = !!this.activePanel;
1108
1105
  try {
1109
1106
  for (var groups_1 = __values(groups), groups_1_1 = groups_1.next(); !groups_1_1.done; groups_1_1 = groups_1.next()) {
1110
1107
  var group = groups_1_1.value;
@@ -1671,7 +1668,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1671
1668
  }
1672
1669
  var id = options === null || options === void 0 ? void 0 : options.id;
1673
1670
  if (id && this._groups.has(options.id)) {
1674
- console.warn("Duplicate group id ".concat(options === null || options === void 0 ? void 0 : options.id, ". reassigning group id to avoid errors"));
1671
+ console.warn("dockview: Duplicate group id ".concat(options === null || options === void 0 ? void 0 : options.id, ". reassigning group id to avoid errors"));
1675
1672
  id = undefined;
1676
1673
  }
1677
1674
  if (!id) {
@@ -123,12 +123,6 @@ var DockviewPanel = /** @class */ (function (_super) {
123
123
  var didTitleChange = title !== this.title;
124
124
  if (didTitleChange) {
125
125
  this._title = title;
126
- this.view.update({
127
- params: {
128
- params: this._params,
129
- title: this.title,
130
- },
131
- });
132
126
  this.api._onDidTitleChange.fire({ title: title });
133
127
  }
134
128
  };
@@ -167,10 +161,7 @@ var DockviewPanel = /** @class */ (function (_super) {
167
161
  }
168
162
  // update the view with the updated props
169
163
  this.view.update({
170
- params: {
171
- params: this._params,
172
- title: this.title,
173
- },
164
+ params: this._params,
174
165
  });
175
166
  };
176
167
  DockviewPanel.prototype.updateParentGroup = function (group, options) {
@@ -79,7 +79,7 @@ var Stacktrace = /** @class */ (function () {
79
79
  return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
80
80
  };
81
81
  Stacktrace.prototype.print = function () {
82
- console.warn(this.value);
82
+ console.warn('dockview: stacktrace', this.value);
83
83
  };
84
84
  return Stacktrace;
85
85
  }());
@@ -129,7 +129,7 @@ var Emitter = /** @class */ (function () {
129
129
  }
130
130
  else if (Emitter.ENABLE_TRACKING) {
131
131
  // console.warn(
132
- // `Listener already disposed`,
132
+ // `dockview: listener already disposed`,
133
133
  // Stacktrace.create().print()
134
134
  // );
135
135
  }
@@ -175,7 +175,7 @@ var Emitter = /** @class */ (function () {
175
175
  // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
176
176
  for (var _c = __values(_this._listeners), _d = _c.next(); !_d.done; _d = _c.next()) {
177
177
  var listener = _d.value;
178
- console.warn((_b = listener.stacktrace) === null || _b === void 0 ? void 0 : _b.print());
178
+ console.warn('dockview: stacktrace', (_b = listener.stacktrace) === null || _b === void 0 ? void 0 : _b.print());
179
179
  }
180
180
  }
181
181
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.13.1
3
+ * @version 1.14.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -155,7 +155,7 @@ define(['exports'], (function (exports) { 'use strict';
155
155
  this.value = value;
156
156
  }
157
157
  print() {
158
- console.warn(this.value);
158
+ console.warn('dockview: stacktrace', this.value);
159
159
  }
160
160
  }
161
161
  class Listener {
@@ -220,7 +220,7 @@ define(['exports'], (function (exports) { 'use strict';
220
220
  var _a;
221
221
  // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
222
222
  for (const listener of this._listeners) {
223
- console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
223
+ console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
224
224
  }
225
225
  });
226
226
  }
@@ -5770,8 +5770,7 @@ define(['exports'], (function (exports) { 'use strict';
5770
5770
  }
5771
5771
  }
5772
5772
 
5773
- // TODO find a better way to initialize and avoid needing null checks
5774
- const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
5773
+ const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
5775
5774
  class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
5776
5775
  get location() {
5777
5776
  if (!this._group) {
@@ -5844,14 +5843,14 @@ define(['exports'], (function (exports) { 'use strict';
5844
5843
  }
5845
5844
  }
5846
5845
  initialize(group) {
5847
- this._group = group;
5848
5846
  /**
5849
- * TODO: Annoying initialization order caveat
5847
+ * TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
5850
5848
  *
5851
5849
  * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
5852
5850
  * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
5853
5851
  * finished ensuring the `model` is defined.
5854
5852
  */
5853
+ this._group = group;
5855
5854
  queueMicrotask(() => {
5856
5855
  this._mutableDisposable.value =
5857
5856
  this._group.model.onDidActivePanelChange((event) => {
@@ -6005,12 +6004,10 @@ define(['exports'], (function (exports) { 'use strict';
6005
6004
  var _a;
6006
6005
  let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
6007
6006
  this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
6008
- if (!event.isVisible && this.isVisible) {
6009
- this._onDidVisibilityChange.fire(event);
6010
- }
6011
- else if (event.isVisible &&
6012
- !this.isVisible &&
6013
- this.group.model.isPanelActive(this.panel)) {
6007
+ const hasBecomeHidden = !event.isVisible && this.isVisible;
6008
+ const hasBecomeVisible = event.isVisible && !this.isVisible;
6009
+ const isActivePanel = this.group.model.isPanelActive(this.panel);
6010
+ if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
6014
6011
  this._onDidVisibilityChange.fire(event);
6015
6012
  }
6016
6013
  }), this.group.api.onDidLocationChange((event) => {
@@ -6096,12 +6093,6 @@ define(['exports'], (function (exports) { 'use strict';
6096
6093
  const didTitleChange = title !== this.title;
6097
6094
  if (didTitleChange) {
6098
6095
  this._title = title;
6099
- this.view.update({
6100
- params: {
6101
- params: this._params,
6102
- title: this.title,
6103
- },
6104
- });
6105
6096
  this.api._onDidTitleChange.fire({ title });
6106
6097
  }
6107
6098
  }
@@ -6129,10 +6120,7 @@ define(['exports'], (function (exports) { 'use strict';
6129
6120
  }
6130
6121
  // update the view with the updated props
6131
6122
  this.view.update({
6132
- params: {
6133
- params: this._params,
6134
- title: this.title,
6135
- },
6123
+ params: this._params,
6136
6124
  });
6137
6125
  }
6138
6126
  updateParentGroup(group, options) {
@@ -7270,7 +7258,7 @@ define(['exports'], (function (exports) { 'use strict';
7270
7258
  return element.getBoundingClientRect();
7271
7259
  }
7272
7260
  const box = getBox();
7273
- 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;
7261
+ 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();
7274
7262
  if (itemToPopout.api.location.type === 'grid') {
7275
7263
  itemToPopout.api.setVisible(false);
7276
7264
  }
@@ -7386,24 +7374,22 @@ define(['exports'], (function (exports) { 'use strict';
7386
7374
  });
7387
7375
  }
7388
7376
  }
7389
- else {
7390
- if (this.getPanel(group.id)) {
7391
- const removedGroup = this.doRemoveGroup(group, {
7392
- skipDispose: true,
7393
- skipActive: true,
7394
- });
7395
- removedGroup.model.renderContainer =
7396
- this.overlayRenderContainer;
7397
- removedGroup.model.location = { type: 'grid' };
7398
- returnedGroup = removedGroup;
7399
- }
7377
+ else if (this.getPanel(group.id)) {
7378
+ const removedGroup = this.doRemoveGroup(group, {
7379
+ skipDispose: true,
7380
+ skipActive: true,
7381
+ });
7382
+ removedGroup.model.renderContainer =
7383
+ this.overlayRenderContainer;
7384
+ removedGroup.model.location = { type: 'grid' };
7385
+ returnedGroup = removedGroup;
7400
7386
  }
7401
7387
  }));
7402
7388
  this._popoutGroups.push(value);
7403
7389
  this.updateWatermark();
7404
7390
  })
7405
7391
  .catch((err) => {
7406
- console.error(err);
7392
+ console.error('dockview: failed to create popout window', err);
7407
7393
  });
7408
7394
  }
7409
7395
  addFloatingGroup(item, coord, options) {
@@ -7446,7 +7432,7 @@ define(['exports'], (function (exports) { 'use strict';
7446
7432
  this.doRemoveGroup(item, {
7447
7433
  skipDispose: true,
7448
7434
  skipPopoutReturn: true,
7449
- skipPopoutAssociated: !!popoutReferenceGroup,
7435
+ skipPopoutAssociated: false,
7450
7436
  });
7451
7437
  }
7452
7438
  }
@@ -7806,7 +7792,6 @@ define(['exports'], (function (exports) { 'use strict';
7806
7792
  clear() {
7807
7793
  const groups = Array.from(this._groups.values()).map((_) => _.value);
7808
7794
  const hasActiveGroup = !!this.activeGroup;
7809
- !!this.activePanel;
7810
7795
  for (const group of groups) {
7811
7796
  // remove the group will automatically remove the panels
7812
7797
  this.removeGroup(group, { skipActive: true });
@@ -8312,7 +8297,7 @@ define(['exports'], (function (exports) { 'use strict';
8312
8297
  }
8313
8298
  let id = options === null || options === void 0 ? void 0 : options.id;
8314
8299
  if (id && this._groups.has(options.id)) {
8315
- console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8300
+ console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
8316
8301
  id = undefined;
8317
8302
  }
8318
8303
  if (!id) {