dockview 1.13.0 → 1.13.1
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/dockview.amd.js +43 -15
- 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 +43 -15
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +43 -15
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +43 -15
- 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 +43 -15
- 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 +43 -15
- package/dist/dockview.noStyle.js.map +1 -1
- package/package.json +2 -2
package/dist/dockview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.13.
|
|
3
|
+
* @version 1.13.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -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
|
}
|
|
@@ -7944,7 +7971,6 @@
|
|
|
7944
7971
|
}
|
|
7945
7972
|
addGroup(options) {
|
|
7946
7973
|
var _a;
|
|
7947
|
-
const group = this.createGroup(options);
|
|
7948
7974
|
if (options) {
|
|
7949
7975
|
let referenceGroup;
|
|
7950
7976
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7978,6 +8004,7 @@
|
|
|
7978
8004
|
const target = toTarget(options.direction || 'within');
|
|
7979
8005
|
const location = getGridLocation(referenceGroup.element);
|
|
7980
8006
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
8007
|
+
const group = this.createGroup(options);
|
|
7981
8008
|
this.doAddGroup(group, relativeLocation);
|
|
7982
8009
|
if (!options.skipSetActive) {
|
|
7983
8010
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7985,6 +8012,7 @@
|
|
|
7985
8012
|
return group;
|
|
7986
8013
|
}
|
|
7987
8014
|
else {
|
|
8015
|
+
const group = this.createGroup(options);
|
|
7988
8016
|
this.doAddGroup(group);
|
|
7989
8017
|
this.doSetGroupAndPanelActive(group);
|
|
7990
8018
|
return group;
|