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.esm.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
|
*/
|
|
@@ -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
|
}
|
|
@@ -7941,7 +7968,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7941
7968
|
}
|
|
7942
7969
|
addGroup(options) {
|
|
7943
7970
|
var _a;
|
|
7944
|
-
const group = this.createGroup(options);
|
|
7945
7971
|
if (options) {
|
|
7946
7972
|
let referenceGroup;
|
|
7947
7973
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7975,6 +8001,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7975
8001
|
const target = toTarget(options.direction || 'within');
|
|
7976
8002
|
const location = getGridLocation(referenceGroup.element);
|
|
7977
8003
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
8004
|
+
const group = this.createGroup(options);
|
|
7978
8005
|
this.doAddGroup(group, relativeLocation);
|
|
7979
8006
|
if (!options.skipSetActive) {
|
|
7980
8007
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7982,6 +8009,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7982
8009
|
return group;
|
|
7983
8010
|
}
|
|
7984
8011
|
else {
|
|
8012
|
+
const group = this.createGroup(options);
|
|
7985
8013
|
this.doAddGroup(group);
|
|
7986
8014
|
this.doSetGroupAndPanelActive(group);
|
|
7987
8015
|
return group;
|