dockview-core 6.0.6 → 6.1.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 6.0.6
3
+ * @version 6.1.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
- if (this.hasMaximizedView()) {
2413
- /**
2414
- * the saved layout cannot be in its maxmized state otherwise all of the underlying
2415
- * view dimensions will be wrong
2416
- *
2417
- * To counteract this we temporaily remove the maximized view to compute the serialized output
2418
- * of the grid before adding back the maxmized view as to not alter the layout from the users
2419
- * perspective when `.toJSON()` is called
2420
- */
2421
- this.exitMaximizedView();
2422
- }
2423
- const root = serializeBranchNode(this.getView(), this.orientation);
2424
- const resullt = {
2425
- root,
2426
- width: this.width,
2427
- height: this.height,
2428
- orientation: this.orientation,
2429
- };
2430
- if (maxmizedViewLocation) {
2431
- resullt.maximizedNode = {
2432
- location: maxmizedViewLocation,
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
- if (maximizedView) {
2436
- // replace any maximzied view that was removed for serialization purposes
2437
- this.maximizeView(maximizedView);
2459
+ finally {
2460
+ pauseToken.dispose();
2438
2461
  }
2439
- return resullt;
2440
2462
  }
2441
2463
  dispose() {
2442
2464
  this.disposable.dispose();
@@ -7328,8 +7350,23 @@ class Tabs extends CompositeDisposable {
7328
7350
  new PanelTransfer(this.accessor.id, this.group.id, null, tabGroup.id),
7329
7351
  ], PanelTransfer.prototype);
7330
7352
  const iframes = disableIframePointEvents();
7353
+ // The dragend listener on `_tabsList` is unreachable for chip
7354
+ // drags because cross-group drops detach the chip from the DOM
7355
+ // before dragend fires (the source tab group becomes empty, so
7356
+ // `_positionChipForGroup` removes the chip element). Without
7357
+ // bubbling, the tabsList listener never runs and `_animState`,
7358
+ // `_chipDragCleanup`, and the dragging CSS classes leak. Listen
7359
+ // directly on the chip element so cleanup happens regardless of
7360
+ // whether it's still attached. (Issue #1254.)
7361
+ const chipElement = chip.element;
7362
+ const onChipDragEnd = () => {
7363
+ chipElement.removeEventListener('dragend', onChipDragEnd);
7364
+ this.resetDragAnimation();
7365
+ };
7366
+ chipElement.addEventListener('dragend', onChipDragEnd);
7331
7367
  this._chipDragCleanup = {
7332
7368
  dispose: () => {
7369
+ chipElement.removeEventListener('dragend', onChipDragEnd);
7333
7370
  panelTransfer.clearData(PanelTransfer.prototype);
7334
7371
  iframes.release();
7335
7372
  },
@@ -11363,8 +11400,12 @@ class OverlayRenderContainer extends CompositeDisposable {
11363
11400
  if (panel.api.isVisible) {
11364
11401
  this.positionCache.invalidate();
11365
11402
  resize();
11403
+ focusContainer.style.pointerEvents = '';
11404
+ }
11405
+ else {
11406
+ focusContainer.style.visibility = 'hidden';
11407
+ focusContainer.style.pointerEvents = 'none';
11366
11408
  }
11367
- focusContainer.style.display = panel.api.isVisible ? '' : 'none';
11368
11409
  };
11369
11410
  const observerDisposable = new MutableDisposable();
11370
11411
  const correctLayerPosition = () => {
@@ -11400,7 +11441,7 @@ class OverlayRenderContainer extends CompositeDisposable {
11400
11441
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
11401
11442
  *
11402
11443
  * the dnd observer does not need to be conditional on whether the panel is visible since
11403
- * non-visible panels are 'display: none' and in such case the dnd observer will not fire.
11444
+ * non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.
11404
11445
  */
11405
11446
  new DragAndDropObserver(focusContainer, {
11406
11447
  onDragEnd: (e) => {