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
|
*/
|
|
@@ -220,18 +220,49 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
220
220
|
},
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
226
|
+
*
|
|
227
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
228
|
+
* This implementation exists to avoid external dependencies.
|
|
229
|
+
*
|
|
230
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
231
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
232
|
+
*/
|
|
233
|
+
class AsapEvent {
|
|
224
234
|
constructor() {
|
|
225
235
|
this._onFired = new Emitter();
|
|
226
|
-
this.
|
|
236
|
+
this._currentFireCount = 0;
|
|
237
|
+
this._queued = false;
|
|
238
|
+
this.onEvent = (e) => {
|
|
239
|
+
/**
|
|
240
|
+
* when the event is first subscribed to take note of the current fire count
|
|
241
|
+
*/
|
|
242
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
243
|
+
return this._onFired.event(() => {
|
|
244
|
+
/**
|
|
245
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
246
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
247
|
+
*
|
|
248
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
249
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
250
|
+
*/
|
|
251
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
252
|
+
e();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
};
|
|
227
256
|
}
|
|
228
257
|
fire() {
|
|
229
|
-
|
|
230
|
-
|
|
258
|
+
this._currentFireCount++;
|
|
259
|
+
if (this._queued) {
|
|
260
|
+
return;
|
|
231
261
|
}
|
|
232
|
-
this.
|
|
262
|
+
this._queued = true;
|
|
263
|
+
queueMicrotask(() => {
|
|
264
|
+
this._queued = false;
|
|
233
265
|
this._onFired.fire();
|
|
234
|
-
clearTimeout(this.timer);
|
|
235
266
|
});
|
|
236
267
|
}
|
|
237
268
|
dispose() {
|
|
@@ -2549,15 +2580,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2549
2580
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
2550
2581
|
this._id = nextLayoutId$1.next();
|
|
2551
2582
|
this._groups = new Map();
|
|
2552
|
-
this._onDidLayoutChange = new Emitter();
|
|
2553
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2554
2583
|
this._onDidRemove = new Emitter();
|
|
2555
2584
|
this.onDidRemove = this._onDidRemove.event;
|
|
2556
2585
|
this._onDidAdd = new Emitter();
|
|
2557
2586
|
this.onDidAdd = this._onDidAdd.event;
|
|
2558
2587
|
this._onDidActiveChange = new Emitter();
|
|
2559
2588
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2560
|
-
this._bufferOnDidLayoutChange = new
|
|
2589
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2590
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2561
2591
|
this.element.style.height = '100%';
|
|
2562
2592
|
this.element.style.width = '100%';
|
|
2563
2593
|
options.parentElement.appendChild(this.element);
|
|
@@ -2572,13 +2602,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2572
2602
|
this._bufferOnDidLayoutChange.fire();
|
|
2573
2603
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2574
2604
|
this._bufferOnDidLayoutChange.fire();
|
|
2575
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2576
|
-
this._onDidLayoutChange.fire();
|
|
2577
2605
|
}), this._bufferOnDidLayoutChange);
|
|
2578
2606
|
}
|
|
2579
2607
|
setVisible(panel, visible) {
|
|
2580
2608
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2581
|
-
this.
|
|
2609
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2582
2610
|
}
|
|
2583
2611
|
isVisible(panel) {
|
|
2584
2612
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -2684,7 +2712,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2684
2712
|
this._onDidActiveChange.dispose();
|
|
2685
2713
|
this._onDidAdd.dispose();
|
|
2686
2714
|
this._onDidRemove.dispose();
|
|
2687
|
-
this._onDidLayoutChange.dispose();
|
|
2688
2715
|
for (const group of this.groups) {
|
|
2689
2716
|
group.dispose();
|
|
2690
2717
|
}
|
|
@@ -7933,7 +7960,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7933
7960
|
}
|
|
7934
7961
|
addGroup(options) {
|
|
7935
7962
|
var _a;
|
|
7936
|
-
const group = this.createGroup(options);
|
|
7937
7963
|
if (options) {
|
|
7938
7964
|
let referenceGroup;
|
|
7939
7965
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7967,6 +7993,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7967
7993
|
const target = toTarget(options.direction || 'within');
|
|
7968
7994
|
const location = getGridLocation(referenceGroup.element);
|
|
7969
7995
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7996
|
+
const group = this.createGroup(options);
|
|
7970
7997
|
this.doAddGroup(group, relativeLocation);
|
|
7971
7998
|
if (!options.skipSetActive) {
|
|
7972
7999
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7974,6 +8001,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7974
8001
|
return group;
|
|
7975
8002
|
}
|
|
7976
8003
|
else {
|
|
8004
|
+
const group = this.createGroup(options);
|
|
7977
8005
|
this.doAddGroup(group);
|
|
7978
8006
|
this.doSetGroupAndPanelActive(group);
|
|
7979
8007
|
return group;
|