dockview-core 6.0.7 → 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.
@@ -45,6 +45,7 @@ export declare class Emitter<T> implements IDisposable {
45
45
  private _last?;
46
46
  private _listeners;
47
47
  private _disposed;
48
+ private readonly _pauseTokens;
48
49
  static ENABLE_TRACKING: boolean;
49
50
  static readonly MEMORY_LEAK_WATCHER: LeakageMonitor;
50
51
  static setLeakageMonitorEnabled(isEnabled: boolean): void;
@@ -52,6 +53,7 @@ export declare class Emitter<T> implements IDisposable {
52
53
  constructor(options?: EmitterOptions | undefined);
53
54
  get event(): Event<T>;
54
55
  fire(e: T): void;
56
+ pause(): IDisposable;
55
57
  dispose(): void;
56
58
  }
57
59
  export declare function addDisposableListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable;
@@ -13,6 +13,7 @@ var __values = (this && this.__values) || function(o) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.AsapEvent = exports.Emitter = exports.AcceptableEvent = exports.DockviewEvent = exports.Event = void 0;
15
15
  exports.addDisposableListener = addDisposableListener;
16
+ var lifecycle_1 = require("./lifecycle");
16
17
  var Event;
17
18
  (function (Event) {
18
19
  Event.any = function () {
@@ -114,6 +115,7 @@ var Emitter = /** @class */ (function () {
114
115
  this.options = options;
115
116
  this._listeners = [];
116
117
  this._disposed = false;
118
+ this._pauseTokens = new Set();
117
119
  }
118
120
  Emitter.setLeakageMonitorEnabled = function (isEnabled) {
119
121
  if (isEnabled !== Emitter.ENABLE_TRACKING) {
@@ -166,6 +168,11 @@ var Emitter = /** @class */ (function () {
166
168
  Emitter.prototype.fire = function (e) {
167
169
  var e_1, _a;
168
170
  var _b;
171
+ if (this._pauseTokens.size > 0) {
172
+ // while paused, the event is dropped entirely — `_last` is not
173
+ // updated, so replay subscribers won't see values fired during a pause
174
+ return;
175
+ }
169
176
  if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.replay) {
170
177
  this._last = e;
171
178
  }
@@ -183,6 +190,12 @@ var Emitter = /** @class */ (function () {
183
190
  finally { if (e_1) throw e_1.error; }
184
191
  }
185
192
  };
193
+ Emitter.prototype.pause = function () {
194
+ var _this = this;
195
+ var token = {};
196
+ this._pauseTokens.add(token);
197
+ return lifecycle_1.Disposable.from(function () { return _this._pauseTokens.delete(token); });
198
+ };
186
199
  Emitter.prototype.dispose = function () {
187
200
  var _this = this;
188
201
  if (!this._disposed) {
@@ -375,34 +375,45 @@ var Gridview = /** @class */ (function () {
375
375
  */
376
376
  maxmizedViewLocation = getGridLocation(maximizedView.element);
377
377
  }
378
- if (this.hasMaximizedView()) {
379
- /**
380
- * the saved layout cannot be in its maxmized state otherwise all of the underlying
381
- * view dimensions will be wrong
382
- *
383
- * To counteract this we temporaily remove the maximized view to compute the serialized output
384
- * of the grid before adding back the maxmized view as to not alter the layout from the users
385
- * perspective when `.toJSON()` is called
386
- */
387
- this.exitMaximizedView();
388
- }
389
- var root = serializeBranchNode(this.getView(), this.orientation);
390
- var resullt = {
391
- root: root,
392
- width: this.width,
393
- height: this.height,
394
- orientation: this.orientation,
395
- };
396
- if (maxmizedViewLocation) {
397
- resullt.maximizedNode = {
398
- location: maxmizedViewLocation,
378
+ /**
379
+ * We pause the onDidMaximizedNodeChange events because this method needs to
380
+ * call `this.exitMaximizedView()`. We don't want this to invoke any listeners
381
+ * since we undo it before leaving this method
382
+ */
383
+ var pauseToken = this._onDidMaximizedNodeChange.pause();
384
+ try {
385
+ if (this.hasMaximizedView()) {
386
+ /**
387
+ * the saved layout cannot be in its maxmized state otherwise all of the underlying
388
+ * view dimensions will be wrong
389
+ *
390
+ * To counteract this we temporaily remove the maximized view to compute the serialized output
391
+ * of the grid before adding back the maxmized view as to not alter the layout from the users
392
+ * perspective when `.toJSON()` is called
393
+ */
394
+ this.exitMaximizedView();
395
+ }
396
+ var root = serializeBranchNode(this.getView(), this.orientation);
397
+ var result = {
398
+ root: root,
399
+ width: this.width,
400
+ height: this.height,
401
+ orientation: this.orientation,
399
402
  };
403
+ if (maxmizedViewLocation) {
404
+ result.maximizedNode = {
405
+ location: maxmizedViewLocation,
406
+ };
407
+ }
408
+ if (maximizedView) {
409
+ // replace any maximzied view that was removed for serialization purposes
410
+ this.maximizeView(maximizedView);
411
+ }
412
+ return result;
400
413
  }
401
- if (maximizedView) {
402
- // replace any maximzied view that was removed for serialization purposes
403
- this.maximizeView(maximizedView);
414
+ finally {
415
+ pauseToken.dispose();
404
416
  }
405
- return resullt;
406
417
  };
407
418
  Gridview.prototype.dispose = function () {
408
419
  this.disposable.dispose();
@@ -192,8 +192,12 @@ var OverlayRenderContainer = /** @class */ (function (_super) {
192
192
  if (panel.api.isVisible) {
193
193
  _this.positionCache.invalidate();
194
194
  resize();
195
+ focusContainer.style.pointerEvents = '';
196
+ }
197
+ else {
198
+ focusContainer.style.visibility = 'hidden';
199
+ focusContainer.style.pointerEvents = 'none';
195
200
  }
196
- focusContainer.style.display = panel.api.isVisible ? '' : 'none';
197
201
  };
198
202
  var observerDisposable = new lifecycle_1.MutableDisposable();
199
203
  var correctLayerPosition = function () {
@@ -231,7 +235,7 @@ var OverlayRenderContainer = /** @class */ (function (_super) {
231
235
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
232
236
  *
233
237
  * the dnd observer does not need to be conditional on whether the panel is visible since
234
- * non-visible panels are 'display: none' and in such case the dnd observer will not fire.
238
+ * non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.
235
239
  */
236
240
  new dnd_1.DragAndDropObserver(focusContainer, {
237
241
  onDragEnd: function (e) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 6.0.7
3
+ * @version 6.1.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -108,6 +108,63 @@
108
108
  return paneTransfer.getData(PaneTransfer.prototype)[0];
109
109
  }
110
110
 
111
+ exports.DockviewDisposable = void 0;
112
+ (function (Disposable) {
113
+ Disposable.NONE = {
114
+ dispose: () => {
115
+ // noop
116
+ },
117
+ };
118
+ function from(func) {
119
+ return {
120
+ dispose: () => {
121
+ func();
122
+ },
123
+ };
124
+ }
125
+ Disposable.from = from;
126
+ })(exports.DockviewDisposable || (exports.DockviewDisposable = {}));
127
+ class CompositeDisposable {
128
+ get isDisposed() {
129
+ return this._isDisposed;
130
+ }
131
+ constructor(...args) {
132
+ this._isDisposed = false;
133
+ this._disposables = new Set(args);
134
+ }
135
+ addDisposables(...args) {
136
+ args.forEach((arg) => this._disposables.add(arg));
137
+ }
138
+ removeDisposable(disposable) {
139
+ this._disposables.delete(disposable);
140
+ }
141
+ dispose() {
142
+ if (this._isDisposed) {
143
+ return;
144
+ }
145
+ this._isDisposed = true;
146
+ this._disposables.forEach((arg) => arg.dispose());
147
+ this._disposables.clear();
148
+ }
149
+ }
150
+ class MutableDisposable {
151
+ constructor() {
152
+ this._disposable = exports.DockviewDisposable.NONE;
153
+ }
154
+ set value(disposable) {
155
+ if (this._disposable) {
156
+ this._disposable.dispose();
157
+ }
158
+ this._disposable = disposable;
159
+ }
160
+ dispose() {
161
+ if (this._disposable) {
162
+ this._disposable.dispose();
163
+ this._disposable = exports.DockviewDisposable.NONE;
164
+ }
165
+ }
166
+ }
167
+
111
168
  exports.DockviewEvent = void 0;
112
169
  (function (Event) {
113
170
  Event.any = (...children) => {
@@ -195,6 +252,7 @@
195
252
  this.options = options;
196
253
  this._listeners = [];
197
254
  this._disposed = false;
255
+ this._pauseTokens = new Set();
198
256
  }
199
257
  get event() {
200
258
  if (!this._event) {
@@ -223,6 +281,11 @@
223
281
  }
224
282
  fire(e) {
225
283
  var _a;
284
+ if (this._pauseTokens.size > 0) {
285
+ // while paused, the event is dropped entirely — `_last` is not
286
+ // updated, so replay subscribers won't see values fired during a pause
287
+ return;
288
+ }
226
289
  if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {
227
290
  this._last = e;
228
291
  }
@@ -230,6 +293,11 @@
230
293
  listener.callback(e);
231
294
  }
232
295
  }
296
+ pause() {
297
+ const token = {};
298
+ this._pauseTokens.add(token);
299
+ return exports.DockviewDisposable.from(() => this._pauseTokens.delete(token));
300
+ }
233
301
  dispose() {
234
302
  if (!this._disposed) {
235
303
  this._disposed = true;
@@ -311,63 +379,6 @@
311
379
  }
312
380
  }
313
381
 
314
- exports.DockviewDisposable = void 0;
315
- (function (Disposable) {
316
- Disposable.NONE = {
317
- dispose: () => {
318
- // noop
319
- },
320
- };
321
- function from(func) {
322
- return {
323
- dispose: () => {
324
- func();
325
- },
326
- };
327
- }
328
- Disposable.from = from;
329
- })(exports.DockviewDisposable || (exports.DockviewDisposable = {}));
330
- class CompositeDisposable {
331
- get isDisposed() {
332
- return this._isDisposed;
333
- }
334
- constructor(...args) {
335
- this._isDisposed = false;
336
- this._disposables = new Set(args);
337
- }
338
- addDisposables(...args) {
339
- args.forEach((arg) => this._disposables.add(arg));
340
- }
341
- removeDisposable(disposable) {
342
- this._disposables.delete(disposable);
343
- }
344
- dispose() {
345
- if (this._isDisposed) {
346
- return;
347
- }
348
- this._isDisposed = true;
349
- this._disposables.forEach((arg) => arg.dispose());
350
- this._disposables.clear();
351
- }
352
- }
353
- class MutableDisposable {
354
- constructor() {
355
- this._disposable = exports.DockviewDisposable.NONE;
356
- }
357
- set value(disposable) {
358
- if (this._disposable) {
359
- this._disposable.dispose();
360
- }
361
- this._disposable = disposable;
362
- }
363
- dispose() {
364
- if (this._disposable) {
365
- this._disposable.dispose();
366
- this._disposable = exports.DockviewDisposable.NONE;
367
- }
368
- }
369
- }
370
-
371
382
  class OverflowObserver extends CompositeDisposable {
372
383
  constructor(el) {
373
384
  super();
@@ -2443,34 +2454,45 @@
2443
2454
  */
2444
2455
  maxmizedViewLocation = getGridLocation(maximizedView.element);
2445
2456
  }
2446
- if (this.hasMaximizedView()) {
2447
- /**
2448
- * the saved layout cannot be in its maxmized state otherwise all of the underlying
2449
- * view dimensions will be wrong
2450
- *
2451
- * To counteract this we temporaily remove the maximized view to compute the serialized output
2452
- * of the grid before adding back the maxmized view as to not alter the layout from the users
2453
- * perspective when `.toJSON()` is called
2454
- */
2455
- this.exitMaximizedView();
2456
- }
2457
- const root = serializeBranchNode(this.getView(), this.orientation);
2458
- const resullt = {
2459
- root,
2460
- width: this.width,
2461
- height: this.height,
2462
- orientation: this.orientation,
2463
- };
2464
- if (maxmizedViewLocation) {
2465
- resullt.maximizedNode = {
2466
- location: maxmizedViewLocation,
2457
+ /**
2458
+ * We pause the onDidMaximizedNodeChange events because this method needs to
2459
+ * call `this.exitMaximizedView()`. We don't want this to invoke any listeners
2460
+ * since we undo it before leaving this method
2461
+ */
2462
+ const pauseToken = this._onDidMaximizedNodeChange.pause();
2463
+ try {
2464
+ if (this.hasMaximizedView()) {
2465
+ /**
2466
+ * the saved layout cannot be in its maxmized state otherwise all of the underlying
2467
+ * view dimensions will be wrong
2468
+ *
2469
+ * To counteract this we temporaily remove the maximized view to compute the serialized output
2470
+ * of the grid before adding back the maxmized view as to not alter the layout from the users
2471
+ * perspective when `.toJSON()` is called
2472
+ */
2473
+ this.exitMaximizedView();
2474
+ }
2475
+ const root = serializeBranchNode(this.getView(), this.orientation);
2476
+ const result = {
2477
+ root,
2478
+ width: this.width,
2479
+ height: this.height,
2480
+ orientation: this.orientation,
2467
2481
  };
2482
+ if (maxmizedViewLocation) {
2483
+ result.maximizedNode = {
2484
+ location: maxmizedViewLocation,
2485
+ };
2486
+ }
2487
+ if (maximizedView) {
2488
+ // replace any maximzied view that was removed for serialization purposes
2489
+ this.maximizeView(maximizedView);
2490
+ }
2491
+ return result;
2468
2492
  }
2469
- if (maximizedView) {
2470
- // replace any maximzied view that was removed for serialization purposes
2471
- this.maximizeView(maximizedView);
2493
+ finally {
2494
+ pauseToken.dispose();
2472
2495
  }
2473
- return resullt;
2474
2496
  }
2475
2497
  dispose() {
2476
2498
  this.disposable.dispose();
@@ -11412,8 +11434,12 @@
11412
11434
  if (panel.api.isVisible) {
11413
11435
  this.positionCache.invalidate();
11414
11436
  resize();
11437
+ focusContainer.style.pointerEvents = '';
11438
+ }
11439
+ else {
11440
+ focusContainer.style.visibility = 'hidden';
11441
+ focusContainer.style.pointerEvents = 'none';
11415
11442
  }
11416
- focusContainer.style.display = panel.api.isVisible ? '' : 'none';
11417
11443
  };
11418
11444
  const observerDisposable = new MutableDisposable();
11419
11445
  const correctLayerPosition = () => {
@@ -11449,7 +11475,7 @@
11449
11475
  * the dnd events for the expect behaviours to continue to occur in terms of dnd
11450
11476
  *
11451
11477
  * the dnd observer does not need to be conditional on whether the panel is visible since
11452
- * non-visible panels are 'display: none' and in such case the dnd observer will not fire.
11478
+ * non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.
11453
11479
  */
11454
11480
  new DragAndDropObserver(focusContainer, {
11455
11481
  onDragEnd: (e) => {