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
|
@@ -1050,7 +1050,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
addGroup(options) {
|
|
1052
1052
|
var _a;
|
|
1053
|
-
const group = this.createGroup(options);
|
|
1054
1053
|
if (options) {
|
|
1055
1054
|
let referenceGroup;
|
|
1056
1055
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -1084,6 +1083,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1084
1083
|
const target = toTarget(options.direction || 'within');
|
|
1085
1084
|
const location = getGridLocation(referenceGroup.element);
|
|
1086
1085
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
1086
|
+
const group = this.createGroup(options);
|
|
1087
1087
|
this.doAddGroup(group, relativeLocation);
|
|
1088
1088
|
if (!options.skipSetActive) {
|
|
1089
1089
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -1091,6 +1091,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1091
1091
|
return group;
|
|
1092
1092
|
}
|
|
1093
1093
|
else {
|
|
1094
|
+
const group = this.createGroup(options);
|
|
1094
1095
|
this.doAddGroup(group);
|
|
1095
1096
|
this.doSetGroupAndPanelActive(group);
|
|
1096
1097
|
return group;
|
package/dist/esm/events.d.ts
CHANGED
|
@@ -47,9 +47,20 @@ export declare class Emitter<T> implements IDisposable {
|
|
|
47
47
|
}
|
|
48
48
|
export declare function addDisposableWindowListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
49
49
|
export declare function addDisposableListener<K extends keyof HTMLElementEventMap>(element: HTMLElement, type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
53
|
+
*
|
|
54
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
55
|
+
* This implementation exists to avoid external dependencies.
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
58
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
59
|
+
*/
|
|
60
|
+
export declare class AsapEvent implements IDisposable {
|
|
52
61
|
private readonly _onFired;
|
|
62
|
+
private _currentFireCount;
|
|
63
|
+
private _queued;
|
|
53
64
|
readonly onEvent: Event<void>;
|
|
54
65
|
fire(): void;
|
|
55
66
|
dispose(): void;
|
package/dist/esm/events.js
CHANGED
|
@@ -150,18 +150,49 @@ export function addDisposableListener(element, type, listener, options) {
|
|
|
150
150
|
},
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
156
|
+
*
|
|
157
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
158
|
+
* This implementation exists to avoid external dependencies.
|
|
159
|
+
*
|
|
160
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
161
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
162
|
+
*/
|
|
163
|
+
export class AsapEvent {
|
|
154
164
|
constructor() {
|
|
155
165
|
this._onFired = new Emitter();
|
|
156
|
-
this.
|
|
166
|
+
this._currentFireCount = 0;
|
|
167
|
+
this._queued = false;
|
|
168
|
+
this.onEvent = (e) => {
|
|
169
|
+
/**
|
|
170
|
+
* when the event is first subscribed to take note of the current fire count
|
|
171
|
+
*/
|
|
172
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
173
|
+
return this._onFired.event(() => {
|
|
174
|
+
/**
|
|
175
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
176
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
177
|
+
*
|
|
178
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
179
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
180
|
+
*/
|
|
181
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
182
|
+
e();
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
157
186
|
}
|
|
158
187
|
fire() {
|
|
159
|
-
|
|
160
|
-
|
|
188
|
+
this._currentFireCount++;
|
|
189
|
+
if (this._queued) {
|
|
190
|
+
return;
|
|
161
191
|
}
|
|
162
|
-
this.
|
|
192
|
+
this._queued = true;
|
|
193
|
+
queueMicrotask(() => {
|
|
194
|
+
this._queued = false;
|
|
163
195
|
this._onFired.fire();
|
|
164
|
-
clearTimeout(this.timer);
|
|
165
196
|
});
|
|
166
197
|
}
|
|
167
198
|
dispose() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event,
|
|
1
|
+
import { Event, AsapEvent } from '../events';
|
|
2
2
|
import { Gridview, IGridView } from './gridview';
|
|
3
3
|
import { Position } from '../dnd/droptarget';
|
|
4
4
|
import { IValueDisposable } from '../lifecycle';
|
|
@@ -51,15 +51,14 @@ export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizab
|
|
|
51
51
|
protected readonly _groups: Map<string, IValueDisposable<T>>;
|
|
52
52
|
protected readonly gridview: Gridview;
|
|
53
53
|
protected _activeGroup: T | undefined;
|
|
54
|
-
private _onDidLayoutChange;
|
|
55
|
-
readonly onDidLayoutChange: Event<void>;
|
|
56
54
|
private readonly _onDidRemove;
|
|
57
55
|
readonly onDidRemove: Event<T>;
|
|
58
56
|
private readonly _onDidAdd;
|
|
59
57
|
readonly onDidAdd: Event<T>;
|
|
60
58
|
private readonly _onDidActiveChange;
|
|
61
59
|
readonly onDidActiveChange: Event<T | undefined>;
|
|
62
|
-
protected readonly _bufferOnDidLayoutChange:
|
|
60
|
+
protected readonly _bufferOnDidLayoutChange: AsapEvent;
|
|
61
|
+
readonly onDidLayoutChange: Event<void>;
|
|
63
62
|
get id(): string;
|
|
64
63
|
get size(): number;
|
|
65
64
|
get groups(): T[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Emitter, Event,
|
|
1
|
+
import { Emitter, Event, AsapEvent } from '../events';
|
|
2
2
|
import { getGridLocation, Gridview } from './gridview';
|
|
3
3
|
import { Disposable } from '../lifecycle';
|
|
4
4
|
import { sequentialNumberGenerator } from '../math';
|
|
@@ -61,15 +61,14 @@ export class BaseGrid extends Resizable {
|
|
|
61
61
|
super(document.createElement('div'), options.disableAutoResizing);
|
|
62
62
|
this._id = nextLayoutId.next();
|
|
63
63
|
this._groups = new Map();
|
|
64
|
-
this._onDidLayoutChange = new Emitter();
|
|
65
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
66
64
|
this._onDidRemove = new Emitter();
|
|
67
65
|
this.onDidRemove = this._onDidRemove.event;
|
|
68
66
|
this._onDidAdd = new Emitter();
|
|
69
67
|
this.onDidAdd = this._onDidAdd.event;
|
|
70
68
|
this._onDidActiveChange = new Emitter();
|
|
71
69
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
72
|
-
this._bufferOnDidLayoutChange = new
|
|
70
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
71
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
73
72
|
this.element.style.height = '100%';
|
|
74
73
|
this.element.style.width = '100%';
|
|
75
74
|
options.parentElement.appendChild(this.element);
|
|
@@ -84,13 +83,11 @@ export class BaseGrid extends Resizable {
|
|
|
84
83
|
this._bufferOnDidLayoutChange.fire();
|
|
85
84
|
}), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
86
85
|
this._bufferOnDidLayoutChange.fire();
|
|
87
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
88
|
-
this._onDidLayoutChange.fire();
|
|
89
86
|
}), this._bufferOnDidLayoutChange);
|
|
90
87
|
}
|
|
91
88
|
setVisible(panel, visible) {
|
|
92
89
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
93
|
-
this.
|
|
90
|
+
this._bufferOnDidLayoutChange.fire();
|
|
94
91
|
}
|
|
95
92
|
isVisible(panel) {
|
|
96
93
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
@@ -196,7 +193,6 @@ export class BaseGrid extends Resizable {
|
|
|
196
193
|
this._onDidActiveChange.dispose();
|
|
197
194
|
this._onDidAdd.dispose();
|
|
198
195
|
this._onDidRemove.dispose();
|
|
199
|
-
this._onDidLayoutChange.dispose();
|
|
200
196
|
for (const group of this.groups) {
|
|
201
197
|
group.dispose();
|
|
202
198
|
}
|