dockview-core 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/cjs/dockview/dockviewComponent.js +2 -1
- package/dist/cjs/events.d.ts +13 -2
- package/dist/cjs/events.js +44 -12
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/cjs/gridview/baseComponentGridview.js +3 -7
- package/dist/dockview-core.amd.js +43 -15
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +43 -15
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +43 -15
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +43 -15
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +43 -15
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +43 -15
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +2 -1
- package/dist/esm/events.d.ts +13 -2
- package/dist/esm/events.js +37 -6
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/esm/gridview/baseComponentGridview.js +4 -8
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.13.
|
|
3
|
+
* @version 1.13.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -250,18 +250,49 @@ function addDisposableListener(element, type, listener, options) {
|
|
|
250
250
|
},
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
256
|
+
*
|
|
257
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
258
|
+
* This implementation exists to avoid external dependencies.
|
|
259
|
+
*
|
|
260
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
261
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
262
|
+
*/
|
|
263
|
+
class AsapEvent {
|
|
254
264
|
constructor() {
|
|
255
265
|
this._onFired = new Emitter();
|
|
256
|
-
this.
|
|
266
|
+
this._currentFireCount = 0;
|
|
267
|
+
this._queued = false;
|
|
268
|
+
this.onEvent = (e) => {
|
|
269
|
+
/**
|
|
270
|
+
* when the event is first subscribed to take note of the current fire count
|
|
271
|
+
*/
|
|
272
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
273
|
+
return this._onFired.event(() => {
|
|
274
|
+
/**
|
|
275
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
276
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
277
|
+
*
|
|
278
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
279
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
280
|
+
*/
|
|
281
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
282
|
+
e();
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
};
|
|
257
286
|
}
|
|
258
287
|
fire() {
|
|
259
|
-
|
|
260
|
-
|
|
288
|
+
this._currentFireCount++;
|
|
289
|
+
if (this._queued) {
|
|
290
|
+
return;
|
|
261
291
|
}
|
|
262
|
-
this.
|
|
292
|
+
this._queued = true;
|
|
293
|
+
queueMicrotask(() => {
|
|
294
|
+
this._queued = false;
|
|
263
295
|
this._onFired.fire();
|
|
264
|
-
clearTimeout(this.timer);
|
|
265
296
|
});
|
|
266
297
|
}
|
|
267
298
|
dispose() {
|
|
@@ -2579,15 +2610,14 @@ class BaseGrid extends Resizable {
|
|
|
2579
2610
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
2580
2611
|
this._id = nextLayoutId$1.next();
|
|
2581
2612
|
this._groups = new Map();
|
|
2582
|
-
this._onDidLayoutChange = new Emitter();
|
|
2583
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2584
2613
|
this._onDidRemove = new Emitter();
|
|
2585
2614
|
this.onDidRemove = this._onDidRemove.event;
|
|
2586
2615
|
this._onDidAdd = new Emitter();
|
|
2587
2616
|
this.onDidAdd = this._onDidAdd.event;
|
|
2588
2617
|
this._onDidActiveChange = new Emitter();
|
|
2589
2618
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2590
|
-
this._bufferOnDidLayoutChange = new
|
|
2619
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2620
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2591
2621
|
this.element.style.height = '100%';
|
|
2592
2622
|
this.element.style.width = '100%';
|
|
2593
2623
|
options.parentElement.appendChild(this.element);
|
|
@@ -2602,13 +2632,11 @@ class BaseGrid extends Resizable {
|
|
|
2602
2632
|
this._bufferOnDidLayoutChange.fire();
|
|
2603
2633
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2604
2634
|
this._bufferOnDidLayoutChange.fire();
|
|
2605
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2606
|
-
this._onDidLayoutChange.fire();
|
|
2607
2635
|
}), this._bufferOnDidLayoutChange);
|
|
2608
2636
|
}
|
|
2609
2637
|
setVisible(panel, visible) {
|
|
2610
2638
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2611
|
-
this.
|
|
2639
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2612
2640
|
}
|
|
2613
2641
|
isVisible(panel) {
|
|
2614
2642
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -2714,7 +2742,6 @@ class BaseGrid extends Resizable {
|
|
|
2714
2742
|
this._onDidActiveChange.dispose();
|
|
2715
2743
|
this._onDidAdd.dispose();
|
|
2716
2744
|
this._onDidRemove.dispose();
|
|
2717
|
-
this._onDidLayoutChange.dispose();
|
|
2718
2745
|
for (const group of this.groups) {
|
|
2719
2746
|
group.dispose();
|
|
2720
2747
|
}
|
|
@@ -7963,7 +7990,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7963
7990
|
}
|
|
7964
7991
|
addGroup(options) {
|
|
7965
7992
|
var _a;
|
|
7966
|
-
const group = this.createGroup(options);
|
|
7967
7993
|
if (options) {
|
|
7968
7994
|
let referenceGroup;
|
|
7969
7995
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7997,6 +8023,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7997
8023
|
const target = toTarget(options.direction || 'within');
|
|
7998
8024
|
const location = getGridLocation(referenceGroup.element);
|
|
7999
8025
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
8026
|
+
const group = this.createGroup(options);
|
|
8000
8027
|
this.doAddGroup(group, relativeLocation);
|
|
8001
8028
|
if (!options.skipSetActive) {
|
|
8002
8029
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -8004,6 +8031,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
8004
8031
|
return group;
|
|
8005
8032
|
}
|
|
8006
8033
|
else {
|
|
8034
|
+
const group = this.createGroup(options);
|
|
8007
8035
|
this.doAddGroup(group);
|
|
8008
8036
|
this.doSetGroupAndPanelActive(group);
|
|
8009
8037
|
return group;
|