dockview-core 6.0.7 → 6.2.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/events.d.ts +2 -0
- package/dist/cjs/events.js +13 -0
- package/dist/cjs/gridview/gridview.js +36 -25
- package/dist/cjs/overlay/overlayRenderContainer.js +6 -2
- package/dist/cjs/popoutWindow.d.ts +7 -0
- package/dist/cjs/popoutWindow.js +21 -0
- package/dist/dockview-core.js +131 -85
- 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 +131 -85
- package/dist/esm/events.d.ts +2 -0
- package/dist/esm/events.js +12 -0
- package/dist/esm/gridview/gridview.js +36 -25
- package/dist/esm/overlay/overlayRenderContainer.js +6 -2
- package/dist/esm/popoutWindow.d.ts +7 -0
- package/dist/esm/popoutWindow.js +20 -0
- package/dist/package/main.cjs.js +131 -85
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +131 -85
- package/package.json +1 -1
package/dist/package/main.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 6.
|
|
3
|
+
* @version 6.2.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -74,6 +74,63 @@ function getPaneData() {
|
|
|
74
74
|
return paneTransfer.getData(PaneTransfer.prototype)[0];
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
exports.DockviewDisposable = void 0;
|
|
78
|
+
(function (Disposable) {
|
|
79
|
+
Disposable.NONE = {
|
|
80
|
+
dispose: () => {
|
|
81
|
+
// noop
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
function from(func) {
|
|
85
|
+
return {
|
|
86
|
+
dispose: () => {
|
|
87
|
+
func();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
Disposable.from = from;
|
|
92
|
+
})(exports.DockviewDisposable || (exports.DockviewDisposable = {}));
|
|
93
|
+
class CompositeDisposable {
|
|
94
|
+
get isDisposed() {
|
|
95
|
+
return this._isDisposed;
|
|
96
|
+
}
|
|
97
|
+
constructor(...args) {
|
|
98
|
+
this._isDisposed = false;
|
|
99
|
+
this._disposables = new Set(args);
|
|
100
|
+
}
|
|
101
|
+
addDisposables(...args) {
|
|
102
|
+
args.forEach((arg) => this._disposables.add(arg));
|
|
103
|
+
}
|
|
104
|
+
removeDisposable(disposable) {
|
|
105
|
+
this._disposables.delete(disposable);
|
|
106
|
+
}
|
|
107
|
+
dispose() {
|
|
108
|
+
if (this._isDisposed) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this._isDisposed = true;
|
|
112
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
113
|
+
this._disposables.clear();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
class MutableDisposable {
|
|
117
|
+
constructor() {
|
|
118
|
+
this._disposable = exports.DockviewDisposable.NONE;
|
|
119
|
+
}
|
|
120
|
+
set value(disposable) {
|
|
121
|
+
if (this._disposable) {
|
|
122
|
+
this._disposable.dispose();
|
|
123
|
+
}
|
|
124
|
+
this._disposable = disposable;
|
|
125
|
+
}
|
|
126
|
+
dispose() {
|
|
127
|
+
if (this._disposable) {
|
|
128
|
+
this._disposable.dispose();
|
|
129
|
+
this._disposable = exports.DockviewDisposable.NONE;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
77
134
|
exports.DockviewEvent = void 0;
|
|
78
135
|
(function (Event) {
|
|
79
136
|
Event.any = (...children) => {
|
|
@@ -161,6 +218,7 @@ class Emitter {
|
|
|
161
218
|
this.options = options;
|
|
162
219
|
this._listeners = [];
|
|
163
220
|
this._disposed = false;
|
|
221
|
+
this._pauseTokens = new Set();
|
|
164
222
|
}
|
|
165
223
|
get event() {
|
|
166
224
|
if (!this._event) {
|
|
@@ -189,6 +247,11 @@ class Emitter {
|
|
|
189
247
|
}
|
|
190
248
|
fire(e) {
|
|
191
249
|
var _a;
|
|
250
|
+
if (this._pauseTokens.size > 0) {
|
|
251
|
+
// while paused, the event is dropped entirely — `_last` is not
|
|
252
|
+
// updated, so replay subscribers won't see values fired during a pause
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
192
255
|
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
|
|
193
256
|
this._last = e;
|
|
194
257
|
}
|
|
@@ -196,6 +259,11 @@ class Emitter {
|
|
|
196
259
|
listener.callback(e);
|
|
197
260
|
}
|
|
198
261
|
}
|
|
262
|
+
pause() {
|
|
263
|
+
const token = {};
|
|
264
|
+
this._pauseTokens.add(token);
|
|
265
|
+
return exports.DockviewDisposable.from(() => this._pauseTokens.delete(token));
|
|
266
|
+
}
|
|
199
267
|
dispose() {
|
|
200
268
|
if (!this._disposed) {
|
|
201
269
|
this._disposed = true;
|
|
@@ -277,63 +345,6 @@ class AsapEvent {
|
|
|
277
345
|
}
|
|
278
346
|
}
|
|
279
347
|
|
|
280
|
-
exports.DockviewDisposable = void 0;
|
|
281
|
-
(function (Disposable) {
|
|
282
|
-
Disposable.NONE = {
|
|
283
|
-
dispose: () => {
|
|
284
|
-
// noop
|
|
285
|
-
},
|
|
286
|
-
};
|
|
287
|
-
function from(func) {
|
|
288
|
-
return {
|
|
289
|
-
dispose: () => {
|
|
290
|
-
func();
|
|
291
|
-
},
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
Disposable.from = from;
|
|
295
|
-
})(exports.DockviewDisposable || (exports.DockviewDisposable = {}));
|
|
296
|
-
class CompositeDisposable {
|
|
297
|
-
get isDisposed() {
|
|
298
|
-
return this._isDisposed;
|
|
299
|
-
}
|
|
300
|
-
constructor(...args) {
|
|
301
|
-
this._isDisposed = false;
|
|
302
|
-
this._disposables = new Set(args);
|
|
303
|
-
}
|
|
304
|
-
addDisposables(...args) {
|
|
305
|
-
args.forEach((arg) => this._disposables.add(arg));
|
|
306
|
-
}
|
|
307
|
-
removeDisposable(disposable) {
|
|
308
|
-
this._disposables.delete(disposable);
|
|
309
|
-
}
|
|
310
|
-
dispose() {
|
|
311
|
-
if (this._isDisposed) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
this._isDisposed = true;
|
|
315
|
-
this._disposables.forEach((arg) => arg.dispose());
|
|
316
|
-
this._disposables.clear();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
class MutableDisposable {
|
|
320
|
-
constructor() {
|
|
321
|
-
this._disposable = exports.DockviewDisposable.NONE;
|
|
322
|
-
}
|
|
323
|
-
set value(disposable) {
|
|
324
|
-
if (this._disposable) {
|
|
325
|
-
this._disposable.dispose();
|
|
326
|
-
}
|
|
327
|
-
this._disposable = disposable;
|
|
328
|
-
}
|
|
329
|
-
dispose() {
|
|
330
|
-
if (this._disposable) {
|
|
331
|
-
this._disposable.dispose();
|
|
332
|
-
this._disposable = exports.DockviewDisposable.NONE;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
348
|
class OverflowObserver extends CompositeDisposable {
|
|
338
349
|
constructor(el) {
|
|
339
350
|
super();
|
|
@@ -2409,34 +2420,45 @@ class Gridview {
|
|
|
2409
2420
|
*/
|
|
2410
2421
|
maxmizedViewLocation = getGridLocation(maximizedView.element);
|
|
2411
2422
|
}
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2423
|
+
/**
|
|
2424
|
+
* We pause the onDidMaximizedNodeChange events because this method needs to
|
|
2425
|
+
* call `this.exitMaximizedView()`. We don't want this to invoke any listeners
|
|
2426
|
+
* since we undo it before leaving this method
|
|
2427
|
+
*/
|
|
2428
|
+
const pauseToken = this._onDidMaximizedNodeChange.pause();
|
|
2429
|
+
try {
|
|
2430
|
+
if (this.hasMaximizedView()) {
|
|
2431
|
+
/**
|
|
2432
|
+
* the saved layout cannot be in its maxmized state otherwise all of the underlying
|
|
2433
|
+
* view dimensions will be wrong
|
|
2434
|
+
*
|
|
2435
|
+
* To counteract this we temporaily remove the maximized view to compute the serialized output
|
|
2436
|
+
* of the grid before adding back the maxmized view as to not alter the layout from the users
|
|
2437
|
+
* perspective when `.toJSON()` is called
|
|
2438
|
+
*/
|
|
2439
|
+
this.exitMaximizedView();
|
|
2440
|
+
}
|
|
2441
|
+
const root = serializeBranchNode(this.getView(), this.orientation);
|
|
2442
|
+
const result = {
|
|
2443
|
+
root,
|
|
2444
|
+
width: this.width,
|
|
2445
|
+
height: this.height,
|
|
2446
|
+
orientation: this.orientation,
|
|
2433
2447
|
};
|
|
2448
|
+
if (maxmizedViewLocation) {
|
|
2449
|
+
result.maximizedNode = {
|
|
2450
|
+
location: maxmizedViewLocation,
|
|
2451
|
+
};
|
|
2452
|
+
}
|
|
2453
|
+
if (maximizedView) {
|
|
2454
|
+
// replace any maximzied view that was removed for serialization purposes
|
|
2455
|
+
this.maximizeView(maximizedView);
|
|
2456
|
+
}
|
|
2457
|
+
return result;
|
|
2434
2458
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
this.maximizeView(maximizedView);
|
|
2459
|
+
finally {
|
|
2460
|
+
pauseToken.dispose();
|
|
2438
2461
|
}
|
|
2439
|
-
return resullt;
|
|
2440
2462
|
}
|
|
2441
2463
|
dispose() {
|
|
2442
2464
|
this.disposable.dispose();
|
|
@@ -11378,8 +11400,12 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
11378
11400
|
if (panel.api.isVisible) {
|
|
11379
11401
|
this.positionCache.invalidate();
|
|
11380
11402
|
resize();
|
|
11403
|
+
focusContainer.style.pointerEvents = '';
|
|
11404
|
+
}
|
|
11405
|
+
else {
|
|
11406
|
+
focusContainer.style.visibility = 'hidden';
|
|
11407
|
+
focusContainer.style.pointerEvents = 'none';
|
|
11381
11408
|
}
|
|
11382
|
-
focusContainer.style.display = panel.api.isVisible ? '' : 'none';
|
|
11383
11409
|
};
|
|
11384
11410
|
const observerDisposable = new MutableDisposable();
|
|
11385
11411
|
const correctLayerPosition = () => {
|
|
@@ -11415,7 +11441,7 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
11415
11441
|
* the dnd events for the expect behaviours to continue to occur in terms of dnd
|
|
11416
11442
|
*
|
|
11417
11443
|
* the dnd observer does not need to be conditional on whether the panel is visible since
|
|
11418
|
-
* non-visible panels
|
|
11444
|
+
* non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.
|
|
11419
11445
|
*/
|
|
11420
11446
|
new DragAndDropObserver(focusContainer, {
|
|
11421
11447
|
onDragEnd: (e) => {
|
|
@@ -11509,6 +11535,25 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
11509
11535
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
11510
11536
|
};
|
|
11511
11537
|
|
|
11538
|
+
/**
|
|
11539
|
+
* Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
|
|
11540
|
+
* `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
|
|
11541
|
+
* execute in a context the browser still associates with the opener via
|
|
11542
|
+
* `window.opener`.
|
|
11543
|
+
*/
|
|
11544
|
+
function assertSameOriginPopoutUrl(url) {
|
|
11545
|
+
let resolved;
|
|
11546
|
+
try {
|
|
11547
|
+
resolved = new URL(url, window.location.href);
|
|
11548
|
+
}
|
|
11549
|
+
catch (_a) {
|
|
11550
|
+
throw new Error(`dockview: invalid popout URL: ${url}`);
|
|
11551
|
+
}
|
|
11552
|
+
const protocolOk = resolved.protocol === 'http:' || resolved.protocol === 'https:';
|
|
11553
|
+
if (!protocolOk || resolved.origin !== window.location.origin) {
|
|
11554
|
+
throw new Error(`dockview: popout URL must be same-origin http(s); got: ${url}`);
|
|
11555
|
+
}
|
|
11556
|
+
}
|
|
11512
11557
|
class PopoutWindow extends CompositeDisposable {
|
|
11513
11558
|
get window() {
|
|
11514
11559
|
var _a, _b;
|
|
@@ -11560,6 +11605,7 @@ class PopoutWindow extends CompositeDisposable {
|
|
|
11560
11605
|
throw new Error('instance of popout window is already open');
|
|
11561
11606
|
}
|
|
11562
11607
|
const url = `${this.options.url}`;
|
|
11608
|
+
assertSameOriginPopoutUrl(url);
|
|
11563
11609
|
const features = Object.entries({
|
|
11564
11610
|
top: this.options.top,
|
|
11565
11611
|
left: this.options.left,
|