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.noStyle.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
|
*/
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
this.value = value;
|
|
130
130
|
}
|
|
131
131
|
print() {
|
|
132
|
-
console.warn(this.value);
|
|
132
|
+
console.warn('dockview: stacktrace', this.value);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
class Listener {
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
var _a;
|
|
195
195
|
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
196
196
|
for (const listener of this._listeners) {
|
|
197
|
-
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
197
|
+
console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}
|
|
@@ -224,18 +224,49 @@
|
|
|
224
224
|
},
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
/**
|
|
228
|
+
*
|
|
229
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
230
|
+
*
|
|
231
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
232
|
+
* This implementation exists to avoid external dependencies.
|
|
233
|
+
*
|
|
234
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
235
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
236
|
+
*/
|
|
237
|
+
class AsapEvent {
|
|
228
238
|
constructor() {
|
|
229
239
|
this._onFired = new Emitter();
|
|
230
|
-
this.
|
|
240
|
+
this._currentFireCount = 0;
|
|
241
|
+
this._queued = false;
|
|
242
|
+
this.onEvent = (e) => {
|
|
243
|
+
/**
|
|
244
|
+
* when the event is first subscribed to take note of the current fire count
|
|
245
|
+
*/
|
|
246
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
247
|
+
return this._onFired.event(() => {
|
|
248
|
+
/**
|
|
249
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
250
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
251
|
+
*
|
|
252
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
253
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
254
|
+
*/
|
|
255
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
256
|
+
e();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
};
|
|
231
260
|
}
|
|
232
261
|
fire() {
|
|
233
|
-
|
|
234
|
-
|
|
262
|
+
this._currentFireCount++;
|
|
263
|
+
if (this._queued) {
|
|
264
|
+
return;
|
|
235
265
|
}
|
|
236
|
-
this.
|
|
266
|
+
this._queued = true;
|
|
267
|
+
queueMicrotask(() => {
|
|
268
|
+
this._queued = false;
|
|
237
269
|
this._onFired.fire();
|
|
238
|
-
clearTimeout(this.timer);
|
|
239
270
|
});
|
|
240
271
|
}
|
|
241
272
|
dispose() {
|
|
@@ -2553,15 +2584,14 @@
|
|
|
2553
2584
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
2554
2585
|
this._id = nextLayoutId$1.next();
|
|
2555
2586
|
this._groups = new Map();
|
|
2556
|
-
this._onDidLayoutChange = new Emitter();
|
|
2557
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2558
2587
|
this._onDidRemove = new Emitter();
|
|
2559
2588
|
this.onDidRemove = this._onDidRemove.event;
|
|
2560
2589
|
this._onDidAdd = new Emitter();
|
|
2561
2590
|
this.onDidAdd = this._onDidAdd.event;
|
|
2562
2591
|
this._onDidActiveChange = new Emitter();
|
|
2563
2592
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2564
|
-
this._bufferOnDidLayoutChange = new
|
|
2593
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2594
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2565
2595
|
this.element.style.height = '100%';
|
|
2566
2596
|
this.element.style.width = '100%';
|
|
2567
2597
|
options.parentElement.appendChild(this.element);
|
|
@@ -2576,13 +2606,11 @@
|
|
|
2576
2606
|
this._bufferOnDidLayoutChange.fire();
|
|
2577
2607
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2578
2608
|
this._bufferOnDidLayoutChange.fire();
|
|
2579
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2580
|
-
this._onDidLayoutChange.fire();
|
|
2581
2609
|
}), this._bufferOnDidLayoutChange);
|
|
2582
2610
|
}
|
|
2583
2611
|
setVisible(panel, visible) {
|
|
2584
2612
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2585
|
-
this.
|
|
2613
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2586
2614
|
}
|
|
2587
2615
|
isVisible(panel) {
|
|
2588
2616
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -2688,7 +2716,6 @@
|
|
|
2688
2716
|
this._onDidActiveChange.dispose();
|
|
2689
2717
|
this._onDidAdd.dispose();
|
|
2690
2718
|
this._onDidRemove.dispose();
|
|
2691
|
-
this._onDidLayoutChange.dispose();
|
|
2692
2719
|
for (const group of this.groups) {
|
|
2693
2720
|
group.dispose();
|
|
2694
2721
|
}
|
|
@@ -5717,8 +5744,7 @@
|
|
|
5717
5744
|
}
|
|
5718
5745
|
}
|
|
5719
5746
|
|
|
5720
|
-
|
|
5721
|
-
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5747
|
+
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
5722
5748
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5723
5749
|
get location() {
|
|
5724
5750
|
if (!this._group) {
|
|
@@ -5791,14 +5817,14 @@
|
|
|
5791
5817
|
}
|
|
5792
5818
|
}
|
|
5793
5819
|
initialize(group) {
|
|
5794
|
-
this._group = group;
|
|
5795
5820
|
/**
|
|
5796
|
-
* TODO: Annoying initialization order caveat
|
|
5821
|
+
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
5797
5822
|
*
|
|
5798
5823
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5799
5824
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5800
5825
|
* finished ensuring the `model` is defined.
|
|
5801
5826
|
*/
|
|
5827
|
+
this._group = group;
|
|
5802
5828
|
queueMicrotask(() => {
|
|
5803
5829
|
this._mutableDisposable.value =
|
|
5804
5830
|
this._group.model.onDidActivePanelChange((event) => {
|
|
@@ -5952,12 +5978,10 @@
|
|
|
5952
5978
|
var _a;
|
|
5953
5979
|
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5954
5980
|
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
!this.isVisible &&
|
|
5960
|
-
this.group.model.isPanelActive(this.panel)) {
|
|
5981
|
+
const hasBecomeHidden = !event.isVisible && this.isVisible;
|
|
5982
|
+
const hasBecomeVisible = event.isVisible && !this.isVisible;
|
|
5983
|
+
const isActivePanel = this.group.model.isPanelActive(this.panel);
|
|
5984
|
+
if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
|
|
5961
5985
|
this._onDidVisibilityChange.fire(event);
|
|
5962
5986
|
}
|
|
5963
5987
|
}), this.group.api.onDidLocationChange((event) => {
|
|
@@ -6043,12 +6067,6 @@
|
|
|
6043
6067
|
const didTitleChange = title !== this.title;
|
|
6044
6068
|
if (didTitleChange) {
|
|
6045
6069
|
this._title = title;
|
|
6046
|
-
this.view.update({
|
|
6047
|
-
params: {
|
|
6048
|
-
params: this._params,
|
|
6049
|
-
title: this.title,
|
|
6050
|
-
},
|
|
6051
|
-
});
|
|
6052
6070
|
this.api._onDidTitleChange.fire({ title });
|
|
6053
6071
|
}
|
|
6054
6072
|
}
|
|
@@ -6076,10 +6094,7 @@
|
|
|
6076
6094
|
}
|
|
6077
6095
|
// update the view with the updated props
|
|
6078
6096
|
this.view.update({
|
|
6079
|
-
params:
|
|
6080
|
-
params: this._params,
|
|
6081
|
-
title: this.title,
|
|
6082
|
-
},
|
|
6097
|
+
params: this._params,
|
|
6083
6098
|
});
|
|
6084
6099
|
}
|
|
6085
6100
|
updateParentGroup(group, options) {
|
|
@@ -7194,7 +7209,7 @@
|
|
|
7194
7209
|
return element.getBoundingClientRect();
|
|
7195
7210
|
}
|
|
7196
7211
|
const box = getBox();
|
|
7197
|
-
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();
|
|
7212
|
+
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();
|
|
7198
7213
|
if (itemToPopout.api.location.type === 'grid') {
|
|
7199
7214
|
itemToPopout.api.setVisible(false);
|
|
7200
7215
|
}
|
|
@@ -7310,24 +7325,22 @@
|
|
|
7310
7325
|
});
|
|
7311
7326
|
}
|
|
7312
7327
|
}
|
|
7313
|
-
else {
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
returnedGroup = removedGroup;
|
|
7323
|
-
}
|
|
7328
|
+
else if (this.getPanel(group.id)) {
|
|
7329
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7330
|
+
skipDispose: true,
|
|
7331
|
+
skipActive: true,
|
|
7332
|
+
});
|
|
7333
|
+
removedGroup.model.renderContainer =
|
|
7334
|
+
this.overlayRenderContainer;
|
|
7335
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7336
|
+
returnedGroup = removedGroup;
|
|
7324
7337
|
}
|
|
7325
7338
|
}));
|
|
7326
7339
|
this._popoutGroups.push(value);
|
|
7327
7340
|
this.updateWatermark();
|
|
7328
7341
|
})
|
|
7329
7342
|
.catch((err) => {
|
|
7330
|
-
console.error(err);
|
|
7343
|
+
console.error('dockview: failed to create popout window', err);
|
|
7331
7344
|
});
|
|
7332
7345
|
}
|
|
7333
7346
|
addFloatingGroup(item, coord, options) {
|
|
@@ -7370,7 +7383,7 @@
|
|
|
7370
7383
|
this.doRemoveGroup(item, {
|
|
7371
7384
|
skipDispose: true,
|
|
7372
7385
|
skipPopoutReturn: true,
|
|
7373
|
-
skipPopoutAssociated:
|
|
7386
|
+
skipPopoutAssociated: false,
|
|
7374
7387
|
});
|
|
7375
7388
|
}
|
|
7376
7389
|
}
|
|
@@ -7730,7 +7743,6 @@
|
|
|
7730
7743
|
clear() {
|
|
7731
7744
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7732
7745
|
const hasActiveGroup = !!this.activeGroup;
|
|
7733
|
-
!!this.activePanel;
|
|
7734
7746
|
for (const group of groups) {
|
|
7735
7747
|
// remove the group will automatically remove the panels
|
|
7736
7748
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7914,7 +7926,6 @@
|
|
|
7914
7926
|
}
|
|
7915
7927
|
addGroup(options) {
|
|
7916
7928
|
var _a;
|
|
7917
|
-
const group = this.createGroup(options);
|
|
7918
7929
|
if (options) {
|
|
7919
7930
|
let referenceGroup;
|
|
7920
7931
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7948,6 +7959,7 @@
|
|
|
7948
7959
|
const target = toTarget(options.direction || 'within');
|
|
7949
7960
|
const location = getGridLocation(referenceGroup.element);
|
|
7950
7961
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7962
|
+
const group = this.createGroup(options);
|
|
7951
7963
|
this.doAddGroup(group, relativeLocation);
|
|
7952
7964
|
if (!options.skipSetActive) {
|
|
7953
7965
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7955,6 +7967,7 @@
|
|
|
7955
7967
|
return group;
|
|
7956
7968
|
}
|
|
7957
7969
|
else {
|
|
7970
|
+
const group = this.createGroup(options);
|
|
7958
7971
|
this.doAddGroup(group);
|
|
7959
7972
|
this.doSetGroupAndPanelActive(group);
|
|
7960
7973
|
return group;
|
|
@@ -8235,7 +8248,7 @@
|
|
|
8235
8248
|
}
|
|
8236
8249
|
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
8237
8250
|
if (id && this._groups.has(options.id)) {
|
|
8238
|
-
console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
8251
|
+
console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
8239
8252
|
id = undefined;
|
|
8240
8253
|
}
|
|
8241
8254
|
if (!id) {
|
|
@@ -9452,7 +9465,7 @@
|
|
|
9452
9465
|
}
|
|
9453
9466
|
update(event) {
|
|
9454
9467
|
var _a;
|
|
9455
|
-
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
9468
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
|
|
9456
9469
|
}
|
|
9457
9470
|
layout(_width, _height) {
|
|
9458
9471
|
// noop
|
|
@@ -9490,7 +9503,7 @@
|
|
|
9490
9503
|
}
|
|
9491
9504
|
update(event) {
|
|
9492
9505
|
var _a;
|
|
9493
|
-
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
9506
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });
|
|
9494
9507
|
}
|
|
9495
9508
|
layout(_width, _height) {
|
|
9496
9509
|
// noop - retrieval from api
|