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