dockview-core 1.13.0 → 1.14.0
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/api/dockviewGroupPanelApi.js +4 -5
- package/dist/cjs/api/dockviewPanelApi.js +4 -6
- package/dist/cjs/dockview/dockviewComponent.js +15 -17
- package/dist/cjs/dockview/dockviewPanel.js +1 -10
- package/dist/cjs/events.d.ts +13 -2
- package/dist/cjs/events.js +47 -15
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/cjs/gridview/baseComponentGridview.js +3 -7
- package/dist/dockview-core.amd.js +66 -53
- 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 +66 -53
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +66 -53
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +66 -53
- 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 +66 -53
- 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 +66 -53
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +3 -4
- package/dist/esm/api/dockviewPanelApi.js +4 -6
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +1 -1
- package/dist/esm/dockview/dockviewComponent.js +15 -17
- package/dist/esm/dockview/dockviewPanel.js +1 -10
- package/dist/esm/events.d.ts +13 -2
- package/dist/esm/events.js +40 -9
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/esm/gridview/baseComponentGridview.js +4 -8
- package/package.json +1 -1
|
@@ -20,8 +20,7 @@ var droptarget_1 = require("../dnd/droptarget");
|
|
|
20
20
|
var events_1 = require("../events");
|
|
21
21
|
var lifecycle_1 = require("../lifecycle");
|
|
22
22
|
var gridviewPanelApi_1 = require("./gridviewPanelApi");
|
|
23
|
-
|
|
24
|
-
var NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
23
|
+
var NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
25
24
|
var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
|
|
26
25
|
__extends(DockviewGroupPanelApiImpl, _super);
|
|
27
26
|
function DockviewGroupPanelApiImpl(id, accessor) {
|
|
@@ -100,15 +99,15 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
|
|
|
100
99
|
}
|
|
101
100
|
};
|
|
102
101
|
DockviewGroupPanelApiImpl.prototype.initialize = function (group) {
|
|
103
|
-
var _this = this;
|
|
104
|
-
this._group = group;
|
|
105
102
|
/**
|
|
106
|
-
* TODO: Annoying initialization order caveat
|
|
103
|
+
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
107
104
|
*
|
|
108
105
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
109
106
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
110
107
|
* finished ensuring the `model` is defined.
|
|
111
108
|
*/
|
|
109
|
+
var _this = this;
|
|
110
|
+
this._group = group;
|
|
112
111
|
queueMicrotask(function () {
|
|
113
112
|
_this._mutableDisposable.value =
|
|
114
113
|
_this._group.model.onDidActivePanelChange(function (event) {
|
|
@@ -133,12 +133,10 @@ var DockviewPanelApiImpl = /** @class */ (function (_super) {
|
|
|
133
133
|
var _a;
|
|
134
134
|
var _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
135
135
|
this.groupEventsDisposable.value = new lifecycle_1.CompositeDisposable(this.group.api.onDidVisibilityChange(function (event) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
!_this.isVisible &&
|
|
141
|
-
_this.group.model.isPanelActive(_this.panel)) {
|
|
136
|
+
var hasBecomeHidden = !event.isVisible && _this.isVisible;
|
|
137
|
+
var hasBecomeVisible = event.isVisible && !_this.isVisible;
|
|
138
|
+
var isActivePanel = _this.group.model.isPanelActive(_this.panel);
|
|
139
|
+
if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
|
|
142
140
|
_this._onDidVisibilityChange.fire(event);
|
|
143
141
|
}
|
|
144
142
|
}), this.group.api.onDidLocationChange(function (event) {
|
|
@@ -447,7 +447,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
447
447
|
return element.getBoundingClientRect();
|
|
448
448
|
}
|
|
449
449
|
var box = getBox();
|
|
450
|
-
var groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
|
|
450
|
+
var groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
|
|
451
451
|
if (itemToPopout.api.location.type === 'grid') {
|
|
452
452
|
itemToPopout.api.setVisible(false);
|
|
453
453
|
}
|
|
@@ -567,24 +567,22 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
else {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
returnedGroup = removedGroup;
|
|
580
|
-
}
|
|
570
|
+
else if (_this.getPanel(group.id)) {
|
|
571
|
+
var removedGroup = _this.doRemoveGroup(group, {
|
|
572
|
+
skipDispose: true,
|
|
573
|
+
skipActive: true,
|
|
574
|
+
});
|
|
575
|
+
removedGroup.model.renderContainer =
|
|
576
|
+
_this.overlayRenderContainer;
|
|
577
|
+
removedGroup.model.location = { type: 'grid' };
|
|
578
|
+
returnedGroup = removedGroup;
|
|
581
579
|
}
|
|
582
580
|
}));
|
|
583
581
|
_this._popoutGroups.push(value);
|
|
584
582
|
_this.updateWatermark();
|
|
585
583
|
})
|
|
586
584
|
.catch(function (err) {
|
|
587
|
-
console.error(err);
|
|
585
|
+
console.error('dockview: failed to create popout window', err);
|
|
588
586
|
});
|
|
589
587
|
};
|
|
590
588
|
DockviewComponent.prototype.addFloatingGroup = function (item, coord, options) {
|
|
@@ -634,7 +632,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
634
632
|
this.doRemoveGroup(item, {
|
|
635
633
|
skipDispose: true,
|
|
636
634
|
skipPopoutReturn: true,
|
|
637
|
-
skipPopoutAssociated:
|
|
635
|
+
skipPopoutAssociated: false,
|
|
638
636
|
});
|
|
639
637
|
}
|
|
640
638
|
}
|
|
@@ -1104,7 +1102,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1104
1102
|
var e_13, _a;
|
|
1105
1103
|
var groups = Array.from(this._groups.values()).map(function (_) { return _.value; });
|
|
1106
1104
|
var hasActiveGroup = !!this.activeGroup;
|
|
1107
|
-
var hasActivePanel = !!this.activePanel;
|
|
1108
1105
|
try {
|
|
1109
1106
|
for (var groups_1 = __values(groups), groups_1_1 = groups_1.next(); !groups_1_1.done; groups_1_1 = groups_1.next()) {
|
|
1110
1107
|
var group = groups_1_1.value;
|
|
@@ -1310,7 +1307,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1310
1307
|
};
|
|
1311
1308
|
DockviewComponent.prototype.addGroup = function (options) {
|
|
1312
1309
|
var _a;
|
|
1313
|
-
var group = this.createGroup(options);
|
|
1314
1310
|
if (options) {
|
|
1315
1311
|
var referenceGroup = void 0;
|
|
1316
1312
|
if ((0, options_1.isGroupOptionsWithPanel)(options)) {
|
|
@@ -1344,6 +1340,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1344
1340
|
var target = (0, baseComponentGridview_1.toTarget)(options.direction || 'within');
|
|
1345
1341
|
var location_2 = (0, gridview_1.getGridLocation)(referenceGroup.element);
|
|
1346
1342
|
var relativeLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, location_2, target);
|
|
1343
|
+
var group = this.createGroup(options);
|
|
1347
1344
|
this.doAddGroup(group, relativeLocation);
|
|
1348
1345
|
if (!options.skipSetActive) {
|
|
1349
1346
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -1351,6 +1348,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1351
1348
|
return group;
|
|
1352
1349
|
}
|
|
1353
1350
|
else {
|
|
1351
|
+
var group = this.createGroup(options);
|
|
1354
1352
|
this.doAddGroup(group);
|
|
1355
1353
|
this.doSetGroupAndPanelActive(group);
|
|
1356
1354
|
return group;
|
|
@@ -1670,7 +1668,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1670
1668
|
}
|
|
1671
1669
|
var id = options === null || options === void 0 ? void 0 : options.id;
|
|
1672
1670
|
if (id && this._groups.has(options.id)) {
|
|
1673
|
-
console.warn("Duplicate group id ".concat(options === null || options === void 0 ? void 0 : options.id, ". reassigning group id to avoid errors"));
|
|
1671
|
+
console.warn("dockview: Duplicate group id ".concat(options === null || options === void 0 ? void 0 : options.id, ". reassigning group id to avoid errors"));
|
|
1674
1672
|
id = undefined;
|
|
1675
1673
|
}
|
|
1676
1674
|
if (!id) {
|
|
@@ -123,12 +123,6 @@ var DockviewPanel = /** @class */ (function (_super) {
|
|
|
123
123
|
var didTitleChange = title !== this.title;
|
|
124
124
|
if (didTitleChange) {
|
|
125
125
|
this._title = title;
|
|
126
|
-
this.view.update({
|
|
127
|
-
params: {
|
|
128
|
-
params: this._params,
|
|
129
|
-
title: this.title,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
126
|
this.api._onDidTitleChange.fire({ title: title });
|
|
133
127
|
}
|
|
134
128
|
};
|
|
@@ -167,10 +161,7 @@ var DockviewPanel = /** @class */ (function (_super) {
|
|
|
167
161
|
}
|
|
168
162
|
// update the view with the updated props
|
|
169
163
|
this.view.update({
|
|
170
|
-
params:
|
|
171
|
-
params: this._params,
|
|
172
|
-
title: this.title,
|
|
173
|
-
},
|
|
164
|
+
params: this._params,
|
|
174
165
|
});
|
|
175
166
|
};
|
|
176
167
|
DockviewPanel.prototype.updateParentGroup = function (group, options) {
|
package/dist/cjs/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/cjs/events.js
CHANGED
|
@@ -11,7 +11,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
11
11
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.AsapEvent = exports.addDisposableListener = exports.addDisposableWindowListener = exports.Emitter = exports.DockviewEvent = exports.Event = void 0;
|
|
15
15
|
var Event;
|
|
16
16
|
(function (Event) {
|
|
17
17
|
Event.any = function () {
|
|
@@ -79,7 +79,7 @@ var Stacktrace = /** @class */ (function () {
|
|
|
79
79
|
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
80
80
|
};
|
|
81
81
|
Stacktrace.prototype.print = function () {
|
|
82
|
-
console.warn(this.value);
|
|
82
|
+
console.warn('dockview: stacktrace', this.value);
|
|
83
83
|
};
|
|
84
84
|
return Stacktrace;
|
|
85
85
|
}());
|
|
@@ -129,7 +129,7 @@ var Emitter = /** @class */ (function () {
|
|
|
129
129
|
}
|
|
130
130
|
else if (Emitter.ENABLE_TRACKING) {
|
|
131
131
|
// console.warn(
|
|
132
|
-
// `
|
|
132
|
+
// `dockview: listener already disposed`,
|
|
133
133
|
// Stacktrace.create().print()
|
|
134
134
|
// );
|
|
135
135
|
}
|
|
@@ -175,7 +175,7 @@ var Emitter = /** @class */ (function () {
|
|
|
175
175
|
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
176
176
|
for (var _c = __values(_this._listeners), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
177
177
|
var listener = _d.value;
|
|
178
|
-
console.warn((_b = listener.stacktrace) === null || _b === void 0 ? void 0 : _b.print());
|
|
178
|
+
console.warn('dockview: stacktrace', (_b = listener.stacktrace) === null || _b === void 0 ? void 0 : _b.print());
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -217,24 +217,56 @@ function addDisposableListener(element, type, listener, options) {
|
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
exports.addDisposableListener = addDisposableListener;
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
/**
|
|
221
|
+
*
|
|
222
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
223
|
+
*
|
|
224
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
225
|
+
* This implementation exists to avoid external dependencies.
|
|
226
|
+
*
|
|
227
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
228
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
229
|
+
*/
|
|
230
|
+
var AsapEvent = /** @class */ (function () {
|
|
231
|
+
function AsapEvent() {
|
|
232
|
+
var _this = this;
|
|
222
233
|
this._onFired = new Emitter();
|
|
223
|
-
this.
|
|
234
|
+
this._currentFireCount = 0;
|
|
235
|
+
this._queued = false;
|
|
236
|
+
this.onEvent = function (e) {
|
|
237
|
+
/**
|
|
238
|
+
* when the event is first subscribed to take note of the current fire count
|
|
239
|
+
*/
|
|
240
|
+
var fireCountAtTimeOfEventSubscription = _this._currentFireCount;
|
|
241
|
+
return _this._onFired.event(function () {
|
|
242
|
+
/**
|
|
243
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
244
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
245
|
+
*
|
|
246
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
247
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
248
|
+
*/
|
|
249
|
+
if (_this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
250
|
+
e();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
224
254
|
}
|
|
225
|
-
|
|
255
|
+
AsapEvent.prototype.fire = function () {
|
|
226
256
|
var _this = this;
|
|
227
|
-
|
|
228
|
-
|
|
257
|
+
this._currentFireCount++;
|
|
258
|
+
if (this._queued) {
|
|
259
|
+
return;
|
|
229
260
|
}
|
|
230
|
-
this.
|
|
261
|
+
this._queued = true;
|
|
262
|
+
queueMicrotask(function () {
|
|
263
|
+
_this._queued = false;
|
|
231
264
|
_this._onFired.fire();
|
|
232
|
-
clearTimeout(_this.timer);
|
|
233
265
|
});
|
|
234
266
|
};
|
|
235
|
-
|
|
267
|
+
AsapEvent.prototype.dispose = function () {
|
|
236
268
|
this._onFired.dispose();
|
|
237
269
|
};
|
|
238
|
-
return
|
|
270
|
+
return AsapEvent;
|
|
239
271
|
}());
|
|
240
|
-
exports.
|
|
272
|
+
exports.AsapEvent = AsapEvent;
|
|
@@ -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[];
|
|
@@ -56,15 +56,14 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
56
56
|
var _this = _super.call(this, document.createElement('div'), options.disableAutoResizing) || this;
|
|
57
57
|
_this._id = nextLayoutId.next();
|
|
58
58
|
_this._groups = new Map();
|
|
59
|
-
_this._onDidLayoutChange = new events_1.Emitter();
|
|
60
|
-
_this.onDidLayoutChange = _this._onDidLayoutChange.event;
|
|
61
59
|
_this._onDidRemove = new events_1.Emitter();
|
|
62
60
|
_this.onDidRemove = _this._onDidRemove.event;
|
|
63
61
|
_this._onDidAdd = new events_1.Emitter();
|
|
64
62
|
_this.onDidAdd = _this._onDidAdd.event;
|
|
65
63
|
_this._onDidActiveChange = new events_1.Emitter();
|
|
66
64
|
_this.onDidActiveChange = _this._onDidActiveChange.event;
|
|
67
|
-
_this._bufferOnDidLayoutChange = new events_1.
|
|
65
|
+
_this._bufferOnDidLayoutChange = new events_1.AsapEvent();
|
|
66
|
+
_this.onDidLayoutChange = _this._bufferOnDidLayoutChange.onEvent;
|
|
68
67
|
_this.element.style.height = '100%';
|
|
69
68
|
_this.element.style.width = '100%';
|
|
70
69
|
options.parentElement.appendChild(_this.element);
|
|
@@ -79,8 +78,6 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
79
78
|
_this._bufferOnDidLayoutChange.fire();
|
|
80
79
|
}), events_1.Event.any(_this.onDidAdd, _this.onDidRemove, _this.onDidActiveChange)(function () {
|
|
81
80
|
_this._bufferOnDidLayoutChange.fire();
|
|
82
|
-
}), _this._bufferOnDidLayoutChange.onEvent(function () {
|
|
83
|
-
_this._onDidLayoutChange.fire();
|
|
84
81
|
}), _this._bufferOnDidLayoutChange);
|
|
85
82
|
return _this;
|
|
86
83
|
}
|
|
@@ -166,7 +163,7 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
166
163
|
});
|
|
167
164
|
BaseGrid.prototype.setVisible = function (panel, visible) {
|
|
168
165
|
this.gridview.setViewVisible((0, gridview_1.getGridLocation)(panel.element), visible);
|
|
169
|
-
this.
|
|
166
|
+
this._bufferOnDidLayoutChange.fire();
|
|
170
167
|
};
|
|
171
168
|
BaseGrid.prototype.isVisible = function (panel) {
|
|
172
169
|
return this.gridview.isViewVisible((0, gridview_1.getGridLocation)(panel.element));
|
|
@@ -278,7 +275,6 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
278
275
|
this._onDidActiveChange.dispose();
|
|
279
276
|
this._onDidAdd.dispose();
|
|
280
277
|
this._onDidRemove.dispose();
|
|
281
|
-
this._onDidLayoutChange.dispose();
|
|
282
278
|
try {
|
|
283
279
|
for (var _b = __values(this.groups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
284
280
|
var group = _c.value;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.14.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -155,7 +155,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
155
155
|
this.value = value;
|
|
156
156
|
}
|
|
157
157
|
print() {
|
|
158
|
-
console.warn(this.value);
|
|
158
|
+
console.warn('dockview: stacktrace', this.value);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
class Listener {
|
|
@@ -220,7 +220,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
220
220
|
var _a;
|
|
221
221
|
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
222
222
|
for (const listener of this._listeners) {
|
|
223
|
-
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
223
|
+
console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
}
|
|
@@ -250,18 +250,49 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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
|
}
|
|
@@ -5743,8 +5770,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5743
5770
|
}
|
|
5744
5771
|
}
|
|
5745
5772
|
|
|
5746
|
-
|
|
5747
|
-
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5773
|
+
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
5748
5774
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5749
5775
|
get location() {
|
|
5750
5776
|
if (!this._group) {
|
|
@@ -5817,14 +5843,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5817
5843
|
}
|
|
5818
5844
|
}
|
|
5819
5845
|
initialize(group) {
|
|
5820
|
-
this._group = group;
|
|
5821
5846
|
/**
|
|
5822
|
-
* TODO: Annoying initialization order caveat
|
|
5847
|
+
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
5823
5848
|
*
|
|
5824
5849
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5825
5850
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5826
5851
|
* finished ensuring the `model` is defined.
|
|
5827
5852
|
*/
|
|
5853
|
+
this._group = group;
|
|
5828
5854
|
queueMicrotask(() => {
|
|
5829
5855
|
this._mutableDisposable.value =
|
|
5830
5856
|
this._group.model.onDidActivePanelChange((event) => {
|
|
@@ -5978,12 +6004,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5978
6004
|
var _a;
|
|
5979
6005
|
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5980
6006
|
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
!this.isVisible &&
|
|
5986
|
-
this.group.model.isPanelActive(this.panel)) {
|
|
6007
|
+
const hasBecomeHidden = !event.isVisible && this.isVisible;
|
|
6008
|
+
const hasBecomeVisible = event.isVisible && !this.isVisible;
|
|
6009
|
+
const isActivePanel = this.group.model.isPanelActive(this.panel);
|
|
6010
|
+
if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
|
|
5987
6011
|
this._onDidVisibilityChange.fire(event);
|
|
5988
6012
|
}
|
|
5989
6013
|
}), this.group.api.onDidLocationChange((event) => {
|
|
@@ -6069,12 +6093,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6069
6093
|
const didTitleChange = title !== this.title;
|
|
6070
6094
|
if (didTitleChange) {
|
|
6071
6095
|
this._title = title;
|
|
6072
|
-
this.view.update({
|
|
6073
|
-
params: {
|
|
6074
|
-
params: this._params,
|
|
6075
|
-
title: this.title,
|
|
6076
|
-
},
|
|
6077
|
-
});
|
|
6078
6096
|
this.api._onDidTitleChange.fire({ title });
|
|
6079
6097
|
}
|
|
6080
6098
|
}
|
|
@@ -6102,10 +6120,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6102
6120
|
}
|
|
6103
6121
|
// update the view with the updated props
|
|
6104
6122
|
this.view.update({
|
|
6105
|
-
params:
|
|
6106
|
-
params: this._params,
|
|
6107
|
-
title: this.title,
|
|
6108
|
-
},
|
|
6123
|
+
params: this._params,
|
|
6109
6124
|
});
|
|
6110
6125
|
}
|
|
6111
6126
|
updateParentGroup(group, options) {
|
|
@@ -7243,7 +7258,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7243
7258
|
return element.getBoundingClientRect();
|
|
7244
7259
|
}
|
|
7245
7260
|
const box = getBox();
|
|
7246
|
-
const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
|
|
7261
|
+
const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
|
|
7247
7262
|
if (itemToPopout.api.location.type === 'grid') {
|
|
7248
7263
|
itemToPopout.api.setVisible(false);
|
|
7249
7264
|
}
|
|
@@ -7359,24 +7374,22 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7359
7374
|
});
|
|
7360
7375
|
}
|
|
7361
7376
|
}
|
|
7362
|
-
else {
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
returnedGroup = removedGroup;
|
|
7372
|
-
}
|
|
7377
|
+
else if (this.getPanel(group.id)) {
|
|
7378
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7379
|
+
skipDispose: true,
|
|
7380
|
+
skipActive: true,
|
|
7381
|
+
});
|
|
7382
|
+
removedGroup.model.renderContainer =
|
|
7383
|
+
this.overlayRenderContainer;
|
|
7384
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7385
|
+
returnedGroup = removedGroup;
|
|
7373
7386
|
}
|
|
7374
7387
|
}));
|
|
7375
7388
|
this._popoutGroups.push(value);
|
|
7376
7389
|
this.updateWatermark();
|
|
7377
7390
|
})
|
|
7378
7391
|
.catch((err) => {
|
|
7379
|
-
console.error(err);
|
|
7392
|
+
console.error('dockview: failed to create popout window', err);
|
|
7380
7393
|
});
|
|
7381
7394
|
}
|
|
7382
7395
|
addFloatingGroup(item, coord, options) {
|
|
@@ -7419,7 +7432,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7419
7432
|
this.doRemoveGroup(item, {
|
|
7420
7433
|
skipDispose: true,
|
|
7421
7434
|
skipPopoutReturn: true,
|
|
7422
|
-
skipPopoutAssociated:
|
|
7435
|
+
skipPopoutAssociated: false,
|
|
7423
7436
|
});
|
|
7424
7437
|
}
|
|
7425
7438
|
}
|
|
@@ -7779,7 +7792,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7779
7792
|
clear() {
|
|
7780
7793
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7781
7794
|
const hasActiveGroup = !!this.activeGroup;
|
|
7782
|
-
!!this.activePanel;
|
|
7783
7795
|
for (const group of groups) {
|
|
7784
7796
|
// remove the group will automatically remove the panels
|
|
7785
7797
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7963,7 +7975,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7963
7975
|
}
|
|
7964
7976
|
addGroup(options) {
|
|
7965
7977
|
var _a;
|
|
7966
|
-
const group = this.createGroup(options);
|
|
7967
7978
|
if (options) {
|
|
7968
7979
|
let referenceGroup;
|
|
7969
7980
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7997,6 +8008,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7997
8008
|
const target = toTarget(options.direction || 'within');
|
|
7998
8009
|
const location = getGridLocation(referenceGroup.element);
|
|
7999
8010
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
8011
|
+
const group = this.createGroup(options);
|
|
8000
8012
|
this.doAddGroup(group, relativeLocation);
|
|
8001
8013
|
if (!options.skipSetActive) {
|
|
8002
8014
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -8004,6 +8016,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8004
8016
|
return group;
|
|
8005
8017
|
}
|
|
8006
8018
|
else {
|
|
8019
|
+
const group = this.createGroup(options);
|
|
8007
8020
|
this.doAddGroup(group);
|
|
8008
8021
|
this.doSetGroupAndPanelActive(group);
|
|
8009
8022
|
return group;
|
|
@@ -8284,7 +8297,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8284
8297
|
}
|
|
8285
8298
|
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
8286
8299
|
if (id && this._groups.has(options.id)) {
|
|
8287
|
-
console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
8300
|
+
console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
8288
8301
|
id = undefined;
|
|
8289
8302
|
}
|
|
8290
8303
|
if (!id) {
|