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.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
|
*/
|
|
@@ -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
|
}
|
|
@@ -254,18 +254,49 @@
|
|
|
254
254
|
},
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
/**
|
|
258
|
+
*
|
|
259
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
260
|
+
*
|
|
261
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
262
|
+
* This implementation exists to avoid external dependencies.
|
|
263
|
+
*
|
|
264
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
265
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
266
|
+
*/
|
|
267
|
+
class AsapEvent {
|
|
258
268
|
constructor() {
|
|
259
269
|
this._onFired = new Emitter();
|
|
260
|
-
this.
|
|
270
|
+
this._currentFireCount = 0;
|
|
271
|
+
this._queued = false;
|
|
272
|
+
this.onEvent = (e) => {
|
|
273
|
+
/**
|
|
274
|
+
* when the event is first subscribed to take note of the current fire count
|
|
275
|
+
*/
|
|
276
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
277
|
+
return this._onFired.event(() => {
|
|
278
|
+
/**
|
|
279
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
280
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
281
|
+
*
|
|
282
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
283
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
284
|
+
*/
|
|
285
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
286
|
+
e();
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
};
|
|
261
290
|
}
|
|
262
291
|
fire() {
|
|
263
|
-
|
|
264
|
-
|
|
292
|
+
this._currentFireCount++;
|
|
293
|
+
if (this._queued) {
|
|
294
|
+
return;
|
|
265
295
|
}
|
|
266
|
-
this.
|
|
296
|
+
this._queued = true;
|
|
297
|
+
queueMicrotask(() => {
|
|
298
|
+
this._queued = false;
|
|
267
299
|
this._onFired.fire();
|
|
268
|
-
clearTimeout(this.timer);
|
|
269
300
|
});
|
|
270
301
|
}
|
|
271
302
|
dispose() {
|
|
@@ -2583,15 +2614,14 @@
|
|
|
2583
2614
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
2584
2615
|
this._id = nextLayoutId$1.next();
|
|
2585
2616
|
this._groups = new Map();
|
|
2586
|
-
this._onDidLayoutChange = new Emitter();
|
|
2587
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2588
2617
|
this._onDidRemove = new Emitter();
|
|
2589
2618
|
this.onDidRemove = this._onDidRemove.event;
|
|
2590
2619
|
this._onDidAdd = new Emitter();
|
|
2591
2620
|
this.onDidAdd = this._onDidAdd.event;
|
|
2592
2621
|
this._onDidActiveChange = new Emitter();
|
|
2593
2622
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2594
|
-
this._bufferOnDidLayoutChange = new
|
|
2623
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2624
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2595
2625
|
this.element.style.height = '100%';
|
|
2596
2626
|
this.element.style.width = '100%';
|
|
2597
2627
|
options.parentElement.appendChild(this.element);
|
|
@@ -2606,13 +2636,11 @@
|
|
|
2606
2636
|
this._bufferOnDidLayoutChange.fire();
|
|
2607
2637
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2608
2638
|
this._bufferOnDidLayoutChange.fire();
|
|
2609
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2610
|
-
this._onDidLayoutChange.fire();
|
|
2611
2639
|
}), this._bufferOnDidLayoutChange);
|
|
2612
2640
|
}
|
|
2613
2641
|
setVisible(panel, visible) {
|
|
2614
2642
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2615
|
-
this.
|
|
2643
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2616
2644
|
}
|
|
2617
2645
|
isVisible(panel) {
|
|
2618
2646
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -2718,7 +2746,6 @@
|
|
|
2718
2746
|
this._onDidActiveChange.dispose();
|
|
2719
2747
|
this._onDidAdd.dispose();
|
|
2720
2748
|
this._onDidRemove.dispose();
|
|
2721
|
-
this._onDidLayoutChange.dispose();
|
|
2722
2749
|
for (const group of this.groups) {
|
|
2723
2750
|
group.dispose();
|
|
2724
2751
|
}
|
|
@@ -5747,8 +5774,7 @@
|
|
|
5747
5774
|
}
|
|
5748
5775
|
}
|
|
5749
5776
|
|
|
5750
|
-
|
|
5751
|
-
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5777
|
+
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
5752
5778
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5753
5779
|
get location() {
|
|
5754
5780
|
if (!this._group) {
|
|
@@ -5821,14 +5847,14 @@
|
|
|
5821
5847
|
}
|
|
5822
5848
|
}
|
|
5823
5849
|
initialize(group) {
|
|
5824
|
-
this._group = group;
|
|
5825
5850
|
/**
|
|
5826
|
-
* TODO: Annoying initialization order caveat
|
|
5851
|
+
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
5827
5852
|
*
|
|
5828
5853
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5829
5854
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5830
5855
|
* finished ensuring the `model` is defined.
|
|
5831
5856
|
*/
|
|
5857
|
+
this._group = group;
|
|
5832
5858
|
queueMicrotask(() => {
|
|
5833
5859
|
this._mutableDisposable.value =
|
|
5834
5860
|
this._group.model.onDidActivePanelChange((event) => {
|
|
@@ -5982,12 +6008,10 @@
|
|
|
5982
6008
|
var _a;
|
|
5983
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
|
|
5984
6010
|
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
!this.isVisible &&
|
|
5990
|
-
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)) {
|
|
5991
6015
|
this._onDidVisibilityChange.fire(event);
|
|
5992
6016
|
}
|
|
5993
6017
|
}), this.group.api.onDidLocationChange((event) => {
|
|
@@ -6073,12 +6097,6 @@
|
|
|
6073
6097
|
const didTitleChange = title !== this.title;
|
|
6074
6098
|
if (didTitleChange) {
|
|
6075
6099
|
this._title = title;
|
|
6076
|
-
this.view.update({
|
|
6077
|
-
params: {
|
|
6078
|
-
params: this._params,
|
|
6079
|
-
title: this.title,
|
|
6080
|
-
},
|
|
6081
|
-
});
|
|
6082
6100
|
this.api._onDidTitleChange.fire({ title });
|
|
6083
6101
|
}
|
|
6084
6102
|
}
|
|
@@ -6106,10 +6124,7 @@
|
|
|
6106
6124
|
}
|
|
6107
6125
|
// update the view with the updated props
|
|
6108
6126
|
this.view.update({
|
|
6109
|
-
params:
|
|
6110
|
-
params: this._params,
|
|
6111
|
-
title: this.title,
|
|
6112
|
-
},
|
|
6127
|
+
params: this._params,
|
|
6113
6128
|
});
|
|
6114
6129
|
}
|
|
6115
6130
|
updateParentGroup(group, options) {
|
|
@@ -7224,7 +7239,7 @@
|
|
|
7224
7239
|
return element.getBoundingClientRect();
|
|
7225
7240
|
}
|
|
7226
7241
|
const box = getBox();
|
|
7227
|
-
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();
|
|
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();
|
|
7228
7243
|
if (itemToPopout.api.location.type === 'grid') {
|
|
7229
7244
|
itemToPopout.api.setVisible(false);
|
|
7230
7245
|
}
|
|
@@ -7340,24 +7355,22 @@
|
|
|
7340
7355
|
});
|
|
7341
7356
|
}
|
|
7342
7357
|
}
|
|
7343
|
-
else {
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
returnedGroup = removedGroup;
|
|
7353
|
-
}
|
|
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;
|
|
7354
7367
|
}
|
|
7355
7368
|
}));
|
|
7356
7369
|
this._popoutGroups.push(value);
|
|
7357
7370
|
this.updateWatermark();
|
|
7358
7371
|
})
|
|
7359
7372
|
.catch((err) => {
|
|
7360
|
-
console.error(err);
|
|
7373
|
+
console.error('dockview: failed to create popout window', err);
|
|
7361
7374
|
});
|
|
7362
7375
|
}
|
|
7363
7376
|
addFloatingGroup(item, coord, options) {
|
|
@@ -7400,7 +7413,7 @@
|
|
|
7400
7413
|
this.doRemoveGroup(item, {
|
|
7401
7414
|
skipDispose: true,
|
|
7402
7415
|
skipPopoutReturn: true,
|
|
7403
|
-
skipPopoutAssociated:
|
|
7416
|
+
skipPopoutAssociated: false,
|
|
7404
7417
|
});
|
|
7405
7418
|
}
|
|
7406
7419
|
}
|
|
@@ -7760,7 +7773,6 @@
|
|
|
7760
7773
|
clear() {
|
|
7761
7774
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7762
7775
|
const hasActiveGroup = !!this.activeGroup;
|
|
7763
|
-
!!this.activePanel;
|
|
7764
7776
|
for (const group of groups) {
|
|
7765
7777
|
// remove the group will automatically remove the panels
|
|
7766
7778
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7944,7 +7956,6 @@
|
|
|
7944
7956
|
}
|
|
7945
7957
|
addGroup(options) {
|
|
7946
7958
|
var _a;
|
|
7947
|
-
const group = this.createGroup(options);
|
|
7948
7959
|
if (options) {
|
|
7949
7960
|
let referenceGroup;
|
|
7950
7961
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7978,6 +7989,7 @@
|
|
|
7978
7989
|
const target = toTarget(options.direction || 'within');
|
|
7979
7990
|
const location = getGridLocation(referenceGroup.element);
|
|
7980
7991
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7992
|
+
const group = this.createGroup(options);
|
|
7981
7993
|
this.doAddGroup(group, relativeLocation);
|
|
7982
7994
|
if (!options.skipSetActive) {
|
|
7983
7995
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7985,6 +7997,7 @@
|
|
|
7985
7997
|
return group;
|
|
7986
7998
|
}
|
|
7987
7999
|
else {
|
|
8000
|
+
const group = this.createGroup(options);
|
|
7988
8001
|
this.doAddGroup(group);
|
|
7989
8002
|
this.doSetGroupAndPanelActive(group);
|
|
7990
8003
|
return group;
|
|
@@ -8265,7 +8278,7 @@
|
|
|
8265
8278
|
}
|
|
8266
8279
|
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
8267
8280
|
if (id && this._groups.has(options.id)) {
|
|
8268
|
-
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`);
|
|
8269
8282
|
id = undefined;
|
|
8270
8283
|
}
|
|
8271
8284
|
if (!id) {
|
|
@@ -9482,7 +9495,7 @@
|
|
|
9482
9495
|
}
|
|
9483
9496
|
update(event) {
|
|
9484
9497
|
var _a;
|
|
9485
|
-
(_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 });
|
|
9486
9499
|
}
|
|
9487
9500
|
layout(_width, _height) {
|
|
9488
9501
|
// noop
|
|
@@ -9520,7 +9533,7 @@
|
|
|
9520
9533
|
}
|
|
9521
9534
|
update(event) {
|
|
9522
9535
|
var _a;
|
|
9523
|
-
(_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 });
|
|
9524
9537
|
}
|
|
9525
9538
|
layout(_width, _height) {
|
|
9526
9539
|
// noop - retrieval from api
|