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
  */
@@ -72,6 +72,63 @@ function getPaneData() {
72
72
  return paneTransfer.getData(PaneTransfer.prototype)[0];
73
73
  }
74
74
 
75
+ var Disposable;
76
+ (function (Disposable) {
77
+ Disposable.NONE = {
78
+ dispose: () => {
79
+ // noop
80
+ },
81
+ };
82
+ function from(func) {
83
+ return {
84
+ dispose: () => {
85
+ func();
86
+ },
87
+ };
88
+ }
89
+ Disposable.from = from;
90
+ })(Disposable || (Disposable = {}));
91
+ class CompositeDisposable {
92
+ get isDisposed() {
93
+ return this._isDisposed;
94
+ }
95
+ constructor(...args) {
96
+ this._isDisposed = false;
97
+ this._disposables = new Set(args);
98
+ }
99
+ addDisposables(...args) {
100
+ args.forEach((arg) => this._disposables.add(arg));
101
+ }
102
+ removeDisposable(disposable) {
103
+ this._disposables.delete(disposable);
104
+ }
105
+ dispose() {
106
+ if (this._isDisposed) {
107
+ return;
108
+ }
109
+ this._isDisposed = true;
110
+ this._disposables.forEach((arg) => arg.dispose());
111
+ this._disposables.clear();
112
+ }
113
+ }
114
+ class MutableDisposable {
115
+ constructor() {
116
+ this._disposable = Disposable.NONE;
117
+ }
118
+ set value(disposable) {
119
+ if (this._disposable) {
120
+ this._disposable.dispose();
121
+ }
122
+ this._disposable = disposable;
123
+ }
124
+ dispose() {
125
+ if (this._disposable) {
126
+ this._disposable.dispose();
127
+ this._disposable = Disposable.NONE;
128
+ }
129
+ }
130
+ }
131
+
75
132
  var Event;
76
133
  (function (Event) {
77
134
  Event.any = (...children) => {
@@ -159,6 +216,7 @@ class Emitter {
159
216
  this.options = options;
160
217
  this._listeners = [];
161
218
  this._disposed = false;
219
+ this._pauseTokens = new Set();
162
220
  }
163
221
  get event() {
164
222
  if (!this._event) {
@@ -187,6 +245,11 @@ class Emitter {
187
245
  }
188
246
  fire(e) {
189
247
  var _a;
248
+ if (this._pauseTokens.size > 0) {
249
+ // while paused, the event is dropped entirely — `_last` is not
250
+ // updated, so replay subscribers won't see values fired during a pause
251
+ return;
252
+ }
190
253
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
191
254
  this._last = e;
192
255
  }
@@ -194,6 +257,11 @@ class Emitter {
194
257
  listener.callback(e);
195
258
  }
196
259
  }
260
+ pause() {
261
+ const token = {};
262
+ this._pauseTokens.add(token);
263
+ return Disposable.from(() => this._pauseTokens.delete(token));
264
+ }
197
265
  dispose() {
198
266
  if (!this._disposed) {
199
267
  this._disposed = true;
@@ -275,63 +343,6 @@ class AsapEvent {
275
343
  }
276
344
  }
277
345
 
278
- var Disposable;
279
- (function (Disposable) {
280
- Disposable.NONE = {
281
- dispose: () => {
282
- // noop
283
- },
284
- };
285
- function from(func) {
286
- return {
287
- dispose: () => {
288
- func();
289
- },
290
- };
291
- }
292
- Disposable.from = from;
293
- })(Disposable || (Disposable = {}));
294
- class CompositeDisposable {
295
- get isDisposed() {
296
- return this._isDisposed;
297
- }
298
- constructor(...args) {
299
- this._isDisposed = false;
300
- this._disposables = new Set(args);
301
- }
302
- addDisposables(...args) {
303
- args.forEach((arg) => this._disposables.add(arg));
304
- }
305
- removeDisposable(disposable) {
306
- this._disposables.delete(disposable);
307
- }
308
- dispose() {
309
- if (this._isDisposed) {
310
- return;
311
- }
312
- this._isDisposed = true;
313
- this._disposables.forEach((arg) => arg.dispose());
314
- this._disposables.clear();
315
- }
316
- }
317
- class MutableDisposable {
318
- constructor() {
319
- this._disposable = Disposable.NONE;
320
- }
321
- set value(disposable) {
322
- if (this._disposable) {
323
- this._disposable.dispose();
324
- }
325
- this._disposable = disposable;
326
- }
327
- dispose() {
328
- if (this._disposable) {
329
- this._disposable.dispose();
330
- this._disposable = Disposable.NONE;
331
- }
332
- }
333
- }
334
-
335
346
  class OverflowObserver extends CompositeDisposable {
336
347
  constructor(el) {
337
348
  super();
@@ -2407,34 +2418,45 @@ class Gridview {
2407
2418
  */
2408
2419
  maxmizedViewLocation = getGridLocation(maximizedView.element);
2409
2420
  }
2410
- if (this.hasMaximizedView()) {
2411
- /**
2412
- * the saved layout cannot be in its maxmized state otherwise all of the underlying
2413
- * view dimensions will be wrong
2414
- *
2415
- * To counteract this we temporaily remove the maximized view to compute the serialized output
2416
- * of the grid before adding back the maxmized view as to not alter the layout from the users
2417
- * perspective when `.toJSON()` is called
2418
- */
2419
- this.exitMaximizedView();
2420
- }
2421
- const root = serializeBranchNode(this.getView(), this.orientation);
2422
- const resullt = {
2423
- root,
2424
- width: this.width,
2425
- height: this.height,
2426
- orientation: this.orientation,
2427
- };
2428
- if (maxmizedViewLocation) {
2429
- resullt.maximizedNode = {
2430
- location: maxmizedViewLocation,
2421
+ /**
2422
+ * We pause the onDidMaximizedNodeChange events because this method needs to
2423
+ * call `this.exitMaximizedView()`. We don't want this to invoke any listeners
2424
+ * since we undo it before leaving this method
2425
+ */
2426
+ const pauseToken = this._onDidMaximizedNodeChange.pause();
2427
+ try {
2428
+ if (this.hasMaximizedView()) {
2429
+ /**
2430
+ * the saved layout cannot be in its maxmized state otherwise all of the underlying
2431
+ * view dimensions will be wrong
2432
+ *
2433
+ * To counteract this we temporaily remove the maximized view to compute the serialized output
2434
+ * of the grid before adding back the maxmized view as to not alter the layout from the users
2435
+ * perspective when `.toJSON()` is called
2436
+ */
2437
+ this.exitMaximizedView();
2438
+ }
2439
+ const root = serializeBranchNode(this.getView(), this.orientation);
2440
+ const result = {
2441
+ root,
2442
+ width: this.width,
2443
+ height: this.height,
2444
+ orientation: this.orientation,
2431
2445
  };
2446
+ if (maxmizedViewLocation) {
2447
+ result.maximizedNode = {
2448
+ location: maxmizedViewLocation,
2449
+ };
2450
+ }
2451
+ if (maximizedView) {
2452
+ // replace any maximzied view that was removed for serialization purposes
2453
+ this.maximizeView(maximizedView);
2454
+ }
2455
+ return result;
2432
2456
  }
2433
- if (maximizedView) {
2434
- // replace any maximzied view that was removed for serialization purposes
2435
- this.maximizeView(maximizedView);
2457
+ finally {
2458
+ pauseToken.dispose();
2436
2459
  }
2437
- return resullt;
2438
2460
  }
2439
2461
  dispose() {
2440
2462
  this.disposable.dispose();
@@ -7326,8 +7348,23 @@ class Tabs extends CompositeDisposable {
7326
7348
  new PanelTransfer(this.accessor.id, this.group.id, null, tabGroup.id),
7327
7349
  ], PanelTransfer.prototype);
7328
7350
  const iframes = disableIframePointEvents();
7351
+ // The dragend listener on `_tabsList` is unreachable for chip
7352
+ // drags because cross-group drops detach the chip from the DOM
7353
+ // before dragend fires (the source tab group becomes empty, so
7354
+ // `_positionChipForGroup` removes the chip element). Without
7355
+ // bubbling, the tabsList listener never runs and `_animState`,
7356
+ // `_chipDragCleanup`, and the dragging CSS classes leak. Listen
7357
+ // directly on the chip element so cleanup happens regardless of
7358
+ // whether it's still attached. (Issue #1254.)
7359
+ const chipElement = chip.element;
7360
+ const onChipDragEnd = () => {
7361
+ chipElement.removeEventListener('dragend', onChipDragEnd);
7362
+ this.resetDragAnimation();
7363
+ };
7364
+ chipElement.addEventListener('dragend', onChipDragEnd);
7329
7365
  this._chipDragCleanup = {
7330
7366
  dispose: () => {
7367
+ chipElement.removeEventListener('dragend', onChipDragEnd);
7331
7368
  panelTransfer.clearData(PanelTransfer.prototype);
7332
7369
  iframes.release();
7333
7370
  },
@@ -11361,8 +11398,12 @@ class OverlayRenderContainer extends CompositeDisposable {
11361
11398
  if (panel.api.isVisible) {
11362
11399
  this.positionCache.invalidate();
11363
11400
  resize();
11401
+ focusContainer.style.pointerEvents = '';
11402
+ }
11403
+ else {
11404
+ focusContainer.style.visibility = 'hidden';
11405
+ focusContainer.style.pointerEvents = 'none';
11364
11406
  }
11365
- focusContainer.style.display = panel.api.isVisible ? '' : 'none';
11366
11407
  };
11367
11408
  const observerDisposable = new MutableDisposable();
11368
11409
  const correctLayerPosition = () => {
@@ -11398,7 +11439,7 @@ class OverlayRenderContainer extends CompositeDisposable {
11398
11439
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
11399
11440
  *
11400
11441
  * the dnd observer does not need to be conditional on whether the panel is visible since
11401
- * non-visible panels are 'display: none' and in such case the dnd observer will not fire.
11442
+ * non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.
11402
11443
  */
11403
11444
  new DragAndDropObserver(focusContainer, {
11404
11445
  onDragEnd: (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "6.0.6",
3
+ "version": "6.1.1",
4
4
  "description": "Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript",
5
5
  "keywords": [
6
6
  "splitview",