dockview 1.13.0 → 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/cjs/dockview/reactContentPart.js +1 -1
- package/dist/cjs/dockview/reactHeaderPart.js +1 -1
- package/dist/dockview.amd.js +68 -55
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +68 -55
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +68 -55
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +68 -55
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +68 -55
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +68 -55
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/reactContentPart.js +1 -1
- package/dist/esm/dockview/reactHeaderPart.js +1 -1
- package/package.json +2 -2
package/dist/dockview.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 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
|
}
|
|
@@ -251,18 +251,49 @@ function addDisposableListener(element, type, listener, options) {
|
|
|
251
251
|
},
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
|
|
254
|
+
/**
|
|
255
|
+
*
|
|
256
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
257
|
+
*
|
|
258
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
259
|
+
* This implementation exists to avoid external dependencies.
|
|
260
|
+
*
|
|
261
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
262
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
263
|
+
*/
|
|
264
|
+
class AsapEvent {
|
|
255
265
|
constructor() {
|
|
256
266
|
this._onFired = new Emitter();
|
|
257
|
-
this.
|
|
267
|
+
this._currentFireCount = 0;
|
|
268
|
+
this._queued = false;
|
|
269
|
+
this.onEvent = (e) => {
|
|
270
|
+
/**
|
|
271
|
+
* when the event is first subscribed to take note of the current fire count
|
|
272
|
+
*/
|
|
273
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
274
|
+
return this._onFired.event(() => {
|
|
275
|
+
/**
|
|
276
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
277
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
278
|
+
*
|
|
279
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
280
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
281
|
+
*/
|
|
282
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
283
|
+
e();
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
};
|
|
258
287
|
}
|
|
259
288
|
fire() {
|
|
260
|
-
|
|
261
|
-
|
|
289
|
+
this._currentFireCount++;
|
|
290
|
+
if (this._queued) {
|
|
291
|
+
return;
|
|
262
292
|
}
|
|
263
|
-
this.
|
|
293
|
+
this._queued = true;
|
|
294
|
+
queueMicrotask(() => {
|
|
295
|
+
this._queued = false;
|
|
264
296
|
this._onFired.fire();
|
|
265
|
-
clearTimeout(this.timer);
|
|
266
297
|
});
|
|
267
298
|
}
|
|
268
299
|
dispose() {
|
|
@@ -2580,15 +2611,14 @@ class BaseGrid extends Resizable {
|
|
|
2580
2611
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
2581
2612
|
this._id = nextLayoutId$1.next();
|
|
2582
2613
|
this._groups = new Map();
|
|
2583
|
-
this._onDidLayoutChange = new Emitter();
|
|
2584
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2585
2614
|
this._onDidRemove = new Emitter();
|
|
2586
2615
|
this.onDidRemove = this._onDidRemove.event;
|
|
2587
2616
|
this._onDidAdd = new Emitter();
|
|
2588
2617
|
this.onDidAdd = this._onDidAdd.event;
|
|
2589
2618
|
this._onDidActiveChange = new Emitter();
|
|
2590
2619
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2591
|
-
this._bufferOnDidLayoutChange = new
|
|
2620
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2621
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2592
2622
|
this.element.style.height = '100%';
|
|
2593
2623
|
this.element.style.width = '100%';
|
|
2594
2624
|
options.parentElement.appendChild(this.element);
|
|
@@ -2603,13 +2633,11 @@ class BaseGrid extends Resizable {
|
|
|
2603
2633
|
this._bufferOnDidLayoutChange.fire();
|
|
2604
2634
|
}), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2605
2635
|
this._bufferOnDidLayoutChange.fire();
|
|
2606
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2607
|
-
this._onDidLayoutChange.fire();
|
|
2608
2636
|
}), this._bufferOnDidLayoutChange);
|
|
2609
2637
|
}
|
|
2610
2638
|
setVisible(panel, visible) {
|
|
2611
2639
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2612
|
-
this.
|
|
2640
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2613
2641
|
}
|
|
2614
2642
|
isVisible(panel) {
|
|
2615
2643
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -2715,7 +2743,6 @@ class BaseGrid extends Resizable {
|
|
|
2715
2743
|
this._onDidActiveChange.dispose();
|
|
2716
2744
|
this._onDidAdd.dispose();
|
|
2717
2745
|
this._onDidRemove.dispose();
|
|
2718
|
-
this._onDidLayoutChange.dispose();
|
|
2719
2746
|
for (const group of this.groups) {
|
|
2720
2747
|
group.dispose();
|
|
2721
2748
|
}
|
|
@@ -5744,8 +5771,7 @@ class GridviewPanel extends BasePanelView {
|
|
|
5744
5771
|
}
|
|
5745
5772
|
}
|
|
5746
5773
|
|
|
5747
|
-
|
|
5748
|
-
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5774
|
+
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
5749
5775
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5750
5776
|
get location() {
|
|
5751
5777
|
if (!this._group) {
|
|
@@ -5818,14 +5844,14 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5818
5844
|
}
|
|
5819
5845
|
}
|
|
5820
5846
|
initialize(group) {
|
|
5821
|
-
this._group = group;
|
|
5822
5847
|
/**
|
|
5823
|
-
* TODO: Annoying initialization order caveat
|
|
5848
|
+
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
5824
5849
|
*
|
|
5825
5850
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5826
5851
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5827
5852
|
* finished ensuring the `model` is defined.
|
|
5828
5853
|
*/
|
|
5854
|
+
this._group = group;
|
|
5829
5855
|
queueMicrotask(() => {
|
|
5830
5856
|
this._mutableDisposable.value =
|
|
5831
5857
|
this._group.model.onDidActivePanelChange((event) => {
|
|
@@ -5979,12 +6005,10 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5979
6005
|
var _a;
|
|
5980
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
|
|
5981
6007
|
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
!this.isVisible &&
|
|
5987
|
-
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)) {
|
|
5988
6012
|
this._onDidVisibilityChange.fire(event);
|
|
5989
6013
|
}
|
|
5990
6014
|
}), this.group.api.onDidLocationChange((event) => {
|
|
@@ -6070,12 +6094,6 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
6070
6094
|
const didTitleChange = title !== this.title;
|
|
6071
6095
|
if (didTitleChange) {
|
|
6072
6096
|
this._title = title;
|
|
6073
|
-
this.view.update({
|
|
6074
|
-
params: {
|
|
6075
|
-
params: this._params,
|
|
6076
|
-
title: this.title,
|
|
6077
|
-
},
|
|
6078
|
-
});
|
|
6079
6097
|
this.api._onDidTitleChange.fire({ title });
|
|
6080
6098
|
}
|
|
6081
6099
|
}
|
|
@@ -6103,10 +6121,7 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
6103
6121
|
}
|
|
6104
6122
|
// update the view with the updated props
|
|
6105
6123
|
this.view.update({
|
|
6106
|
-
params:
|
|
6107
|
-
params: this._params,
|
|
6108
|
-
title: this.title,
|
|
6109
|
-
},
|
|
6124
|
+
params: this._params,
|
|
6110
6125
|
});
|
|
6111
6126
|
}
|
|
6112
6127
|
updateParentGroup(group, options) {
|
|
@@ -7221,7 +7236,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7221
7236
|
return element.getBoundingClientRect();
|
|
7222
7237
|
}
|
|
7223
7238
|
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();
|
|
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();
|
|
7225
7240
|
if (itemToPopout.api.location.type === 'grid') {
|
|
7226
7241
|
itemToPopout.api.setVisible(false);
|
|
7227
7242
|
}
|
|
@@ -7337,24 +7352,22 @@ class DockviewComponent extends BaseGrid {
|
|
|
7337
7352
|
});
|
|
7338
7353
|
}
|
|
7339
7354
|
}
|
|
7340
|
-
else {
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
returnedGroup = removedGroup;
|
|
7350
|
-
}
|
|
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;
|
|
7351
7364
|
}
|
|
7352
7365
|
}));
|
|
7353
7366
|
this._popoutGroups.push(value);
|
|
7354
7367
|
this.updateWatermark();
|
|
7355
7368
|
})
|
|
7356
7369
|
.catch((err) => {
|
|
7357
|
-
console.error(err);
|
|
7370
|
+
console.error('dockview: failed to create popout window', err);
|
|
7358
7371
|
});
|
|
7359
7372
|
}
|
|
7360
7373
|
addFloatingGroup(item, coord, options) {
|
|
@@ -7397,7 +7410,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7397
7410
|
this.doRemoveGroup(item, {
|
|
7398
7411
|
skipDispose: true,
|
|
7399
7412
|
skipPopoutReturn: true,
|
|
7400
|
-
skipPopoutAssociated:
|
|
7413
|
+
skipPopoutAssociated: false,
|
|
7401
7414
|
});
|
|
7402
7415
|
}
|
|
7403
7416
|
}
|
|
@@ -7757,7 +7770,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7757
7770
|
clear() {
|
|
7758
7771
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7759
7772
|
const hasActiveGroup = !!this.activeGroup;
|
|
7760
|
-
!!this.activePanel;
|
|
7761
7773
|
for (const group of groups) {
|
|
7762
7774
|
// remove the group will automatically remove the panels
|
|
7763
7775
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7941,7 +7953,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7941
7953
|
}
|
|
7942
7954
|
addGroup(options) {
|
|
7943
7955
|
var _a;
|
|
7944
|
-
const group = this.createGroup(options);
|
|
7945
7956
|
if (options) {
|
|
7946
7957
|
let referenceGroup;
|
|
7947
7958
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7975,6 +7986,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7975
7986
|
const target = toTarget(options.direction || 'within');
|
|
7976
7987
|
const location = getGridLocation(referenceGroup.element);
|
|
7977
7988
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7989
|
+
const group = this.createGroup(options);
|
|
7978
7990
|
this.doAddGroup(group, relativeLocation);
|
|
7979
7991
|
if (!options.skipSetActive) {
|
|
7980
7992
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7982,6 +7994,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7982
7994
|
return group;
|
|
7983
7995
|
}
|
|
7984
7996
|
else {
|
|
7997
|
+
const group = this.createGroup(options);
|
|
7985
7998
|
this.doAddGroup(group);
|
|
7986
7999
|
this.doSetGroupAndPanelActive(group);
|
|
7987
8000
|
return group;
|
|
@@ -8262,7 +8275,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
8262
8275
|
}
|
|
8263
8276
|
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
8264
8277
|
if (id && this._groups.has(options.id)) {
|
|
8265
|
-
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`);
|
|
8266
8279
|
id = undefined;
|
|
8267
8280
|
}
|
|
8268
8281
|
if (!id) {
|
|
@@ -9479,7 +9492,7 @@ class ReactPanelContentPart {
|
|
|
9479
9492
|
}
|
|
9480
9493
|
update(event) {
|
|
9481
9494
|
var _a;
|
|
9482
|
-
(_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 });
|
|
9483
9496
|
}
|
|
9484
9497
|
layout(_width, _height) {
|
|
9485
9498
|
// noop
|
|
@@ -9517,7 +9530,7 @@ class ReactPanelHeaderPart {
|
|
|
9517
9530
|
}
|
|
9518
9531
|
update(event) {
|
|
9519
9532
|
var _a;
|
|
9520
|
-
(_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 });
|
|
9521
9534
|
}
|
|
9522
9535
|
layout(_width, _height) {
|
|
9523
9536
|
// noop - retrieval from api
|