dockview-react 8.7.1 → 8.8.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.
@@ -14,6 +14,6 @@ export declare class PanePanelSection implements IPanePart {
14
14
  toJSON(): {
15
15
  id: string;
16
16
  };
17
- update(params: PanelUpdateEvent): void;
17
+ update(event: PanelUpdateEvent): void;
18
18
  dispose(): void;
19
19
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 8.7.1
3
+ * @version 8.8.0
4
4
  * @link https://github.com/dockview/dockview
5
5
  * @license MIT
6
6
  */
@@ -51,7 +51,7 @@ react_dom = __toESM(react_dom);
51
51
  //#region ../dockview-core/dist/package/main.esm.mjs
52
52
  /**
53
53
  * dockview-core
54
- * @version 8.7.1
54
+ * @version 8.8.0
55
55
  * @link https://github.com/dockview/dockview
56
56
  * @license MIT
57
57
  */
@@ -165,6 +165,7 @@ react_dom = __toESM(react_dom);
165
165
  };
166
166
  let Event;
167
167
  (function(_Event) {
168
+ _Event.map = (event, fn) => (listener) => event((e) => listener(fn(e)));
168
169
  _Event.any = (...children) => {
169
170
  return (listener) => {
170
171
  const disposables = children.map((child) => child(listener));
@@ -323,31 +324,25 @@ react_dom = __toESM(react_dom);
323
324
  constructor() {
324
325
  this._onFired = new Emitter();
325
326
  this._currentFireCount = 0;
327
+ this._pending = /* @__PURE__ */ new Set();
326
328
  this._queued = false;
327
- this.onEvent = (e) => {
328
- /**
329
- * when the event is first subscribed to take note of the current fire count
330
- */
329
+ this.onEvent = (listener) => {
331
330
  const fireCountAtTimeOfEventSubscription = this._currentFireCount;
332
- return this._onFired.event(() => {
333
- /**
334
- * if the current fire count is greater than the fire count at event subscription
335
- * then the event has been fired since we subscribed and it's ok to "on_next" the event.
336
- *
337
- * if the count is not greater then what we are recieving is an event from the microtask
338
- * queue that was triggered before we actually subscribed and therfore we should ignore it.
339
- */
340
- if (this._currentFireCount > fireCountAtTimeOfEventSubscription) e();
331
+ return this._onFired.event((values) => {
332
+ if (this._currentFireCount > fireCountAtTimeOfEventSubscription) listener(values);
341
333
  });
342
334
  };
343
335
  }
344
- fire() {
336
+ fire(value) {
345
337
  this._currentFireCount++;
338
+ this._pending.add(value);
346
339
  if (this._queued) return;
347
340
  this._queued = true;
348
341
  queueMicrotask(() => {
349
342
  this._queued = false;
350
- this._onFired.fire();
343
+ const values = this._pending;
344
+ this._pending = /* @__PURE__ */ new Set();
345
+ this._onFired.fire(values);
351
346
  });
352
347
  }
353
348
  dispose() {
@@ -878,9 +873,16 @@ react_dom = __toESM(react_dom);
878
873
  this._onDidClose = new Emitter();
879
874
  this.onDidClose = this._onDidClose.event;
880
875
  this._window = null;
881
- this.addDisposables(this._onWillClose, this._onDidClose, { dispose: () => {
882
- this.close();
883
- } });
876
+ this.addDisposables(this._onWillClose, this._onDidClose);
877
+ }
878
+ /**
879
+ * Close before `super.dispose()` kills the close emitters, so an explicit
880
+ * dispose still fires `onWillClose` / `onDidClose` (the component's
881
+ * per-window teardown hangs off them). A closed window is a no-op.
882
+ */
883
+ dispose() {
884
+ this.close();
885
+ super.dispose();
884
886
  }
885
887
  dimensions() {
886
888
  if (!this._window) return null;
@@ -2272,7 +2274,8 @@ react_dom = __toESM(react_dom);
2272
2274
  const result = new BranchNode(node.orientation, node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
2273
2275
  for (let i = node.children.length - 1; i >= 0; i--) {
2274
2276
  const child = node.children[i];
2275
- result.addChild(cloneNode(child, child.size, child.orthogonalSize), childSizing(node, i, child.size), 0, true);
2277
+ const childSize = child instanceof BranchNode ? child.orthogonalSize : child.size;
2278
+ result.addChild(cloneNode(child, child.size, child.orthogonalSize), childSizing(node, i, childSize), 0, true);
2276
2279
  }
2277
2280
  return result;
2278
2281
  } else return new LeafNode(node.view, node.orientation, orthogonalSize);
@@ -2771,10 +2774,11 @@ react_dom = __toESM(react_dom);
2771
2774
  const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
2772
2775
  grandParent.removeChild(parentIndex, sizing).dispose();
2773
2776
  if (sibling instanceof BranchNode) {
2774
- sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
2777
+ const childSizes = sibling.children.map((c) => c instanceof BranchNode ? c.orthogonalSize : c.size);
2778
+ sizes.splice(parentIndex, 1, ...childSizes);
2775
2779
  for (let i = 0; i < sibling.children.length; i++) {
2776
2780
  const child = sibling.children[i];
2777
- const childSize = childSizing(sibling, i, child.size);
2781
+ const childSize = childSizing(sibling, i, childSizes[i]);
2778
2782
  grandParent.addChild(child, !isSiblingVisible && typeof childSize === "number" ? Sizing.Invisible(childSize) : childSize, parentIndex + i);
2779
2783
  }
2780
2784
  /**
@@ -2949,7 +2953,7 @@ react_dom = __toESM(react_dom);
2949
2953
  this._onDidActiveChange = new Emitter();
2950
2954
  this.onDidActiveChange = this._onDidActiveChange.event;
2951
2955
  this._bufferOnDidLayoutChange = new AsapEvent();
2952
- this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2956
+ this.onDidLayoutChange = Event.map(this._bufferOnDidLayoutChange.onEvent, (reasons) => ({ reasons }));
2953
2957
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2954
2958
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2955
2959
  this.element.style.height = "100%";
@@ -2971,14 +2975,18 @@ react_dom = __toESM(react_dom);
2971
2975
  }), Disposable.from(() => {
2972
2976
  this.element.remove();
2973
2977
  }), this.gridview.onDidChange(() => {
2974
- this._bufferOnDidLayoutChange.fire();
2975
- }), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
2976
- this._bufferOnDidLayoutChange.fire();
2978
+ this._bufferOnDidLayoutChange.fire("geometry");
2979
+ }), Event.any(this.onDidAdd, this.onDidRemove)(() => {
2980
+ this._bufferOnDidLayoutChange.fire("structure");
2981
+ }), this.onDidActiveChange(() => {
2982
+ this._bufferOnDidLayoutChange.fire("activePanel");
2983
+ }), this.onDidMaximizedChange(() => {
2984
+ this._bufferOnDidLayoutChange.fire("geometry");
2977
2985
  }), this._onDidMaximizedChange, this._onDidViewVisibilityChangeMicroTaskQueue, this._bufferOnDidLayoutChange);
2978
2986
  }
2979
2987
  setVisible(panel, visible) {
2980
2988
  this.gridview.setViewVisible(getGridLocation(panel.element), visible);
2981
- this._bufferOnDidLayoutChange.fire();
2989
+ this._bufferOnDidLayoutChange.fire("geometry");
2982
2990
  }
2983
2991
  isVisible(panel) {
2984
2992
  return this.gridview.isViewVisible(getGridLocation(panel.element));
@@ -3226,6 +3234,7 @@ react_dom = __toESM(react_dom);
3226
3234
  /**
3227
3235
  * Invoked whenever any aspect of the layout changes.
3228
3236
  * If listening to this event it may be worth debouncing ouputs.
3237
+ * The event carries the `reasons` for the change.
3229
3238
  */
3230
3239
  get onDidLayoutChange() {
3231
3240
  return this.component.onDidLayoutChange;
@@ -3344,6 +3353,7 @@ react_dom = __toESM(react_dom);
3344
3353
  }
3345
3354
  /**
3346
3355
  * Invoked when any layout change occures, an aggregation of many events.
3356
+ * The event carries the `reasons` for the change.
3347
3357
  */
3348
3358
  get onDidLayoutChange() {
3349
3359
  return this.component.onDidLayoutChange;
@@ -3484,6 +3494,7 @@ react_dom = __toESM(react_dom);
3484
3494
  }
3485
3495
  /**
3486
3496
  * Invoked when any layout change occures, an aggregation of many events.
3497
+ * The event carries the `reasons` for the change.
3487
3498
  */
3488
3499
  get onDidLayoutChange() {
3489
3500
  return this.component.onDidLayoutChange;
@@ -3714,6 +3725,7 @@ react_dom = __toESM(react_dom);
3714
3725
  }
3715
3726
  /**
3716
3727
  * Invoked when any layout change occures, an aggregation of many events.
3728
+ * The event carries the `reasons` for the change.
3717
3729
  */
3718
3730
  get onDidLayoutChange() {
3719
3731
  return this.component.onDidLayoutChange;
@@ -5312,7 +5324,9 @@ react_dom = __toESM(react_dom);
5312
5324
  var _this$_startEvent, _this$options$onDragS, _this$options2, _this$options$createG, _this$options3;
5313
5325
  const startEvent = (_this$_startEvent = this._startEvent) !== null && _this$_startEvent !== void 0 ? _this$_startEvent : triggerEvent;
5314
5326
  this._cancelPending();
5327
+ const wasPrevented = startEvent.defaultPrevented;
5315
5328
  (_this$options$onDragS = (_this$options2 = this.options).onDragStart) === null || _this$options$onDragS === void 0 || _this$options$onDragS.call(_this$options2, startEvent);
5329
+ if (startEvent.defaultPrevented && !wasPrevented) return;
5316
5330
  const ghost = (_this$options$createG = (_this$options3 = this.options).createGhost) === null || _this$options$createG === void 0 ? void 0 : _this$options$createG.call(_this$options3, startEvent);
5317
5331
  PointerDragController.getInstance().beginDrag({
5318
5332
  pointerEvent: triggerEvent,
@@ -5383,10 +5397,10 @@ react_dom = __toESM(react_dom);
5383
5397
  }
5384
5398
  };
5385
5399
  /**
5386
- * HTML5 drag source. Listens for the native `dragstart` event, calls
5387
- * `getData` to populate transfer, optionally renders the ghost via
5388
- * `setDragImage`, fires `onDragStart` / `onDragEnd`, and tears down the
5389
- * transfer disposer after `dragend`.
5400
+ * HTML5 drag source. Listens for the native `dragstart` event, fires
5401
+ * `onDragStart` (the consumer's chance to veto via `preventDefault()`), then
5402
+ * calls `getData` to populate transfer, optionally renders the ghost via
5403
+ * `setDragImage`, and tears down the transfer disposer after `dragend`.
5390
5404
  */
5391
5405
  var Html5DragSource = class extends CompositeDisposable {
5392
5406
  constructor(el, opts) {
@@ -5397,17 +5411,19 @@ react_dom = __toESM(react_dom);
5397
5411
  this._pointerEventsDisposable = new MutableDisposable();
5398
5412
  this._disabled = !!opts.disabled;
5399
5413
  this.addDisposables(this._dataDisposable, this._pointerEventsDisposable, addDisposableListener(this.el, "dragstart", (event) => {
5400
- var _this$opts$isCancelle, _this$opts, _this$el$ownerDocumen, _this$opts$createGhos, _this$opts2, _this$opts$onDragStar, _this$opts3;
5414
+ var _this$opts$isCancelle, _this$opts, _this$opts$onDragStar, _this$opts2, _this$el$ownerDocumen, _this$opts$createGhos, _this$opts3;
5401
5415
  if (event.defaultPrevented || this._disabled || ((_this$opts$isCancelle = (_this$opts = this.opts).isCancelled) === null || _this$opts$isCancelle === void 0 ? void 0 : _this$opts$isCancelle.call(_this$opts, event))) {
5402
5416
  event.preventDefault();
5403
5417
  return;
5404
5418
  }
5419
+ (_this$opts$onDragStar = (_this$opts2 = this.opts).onDragStart) === null || _this$opts$onDragStar === void 0 || _this$opts$onDragStar.call(_this$opts2, event);
5420
+ if (event.defaultPrevented) return;
5405
5421
  const iframes = disableIframePointEvents((_this$el$ownerDocumen = this.el.ownerDocument) !== null && _this$el$ownerDocumen !== void 0 ? _this$el$ownerDocumen : document);
5406
5422
  this._pointerEventsDisposable.value = { dispose: () => iframes.release() };
5407
5423
  this.el.classList.add("dv-dragged");
5408
5424
  setTimeout(() => this.el.classList.remove("dv-dragged"), 0);
5409
5425
  this._dataDisposable.value = this.opts.getData(event);
5410
- const ghost = (_this$opts$createGhos = (_this$opts2 = this.opts).createGhost) === null || _this$opts$createGhos === void 0 ? void 0 : _this$opts$createGhos.call(_this$opts2, event);
5426
+ const ghost = (_this$opts$createGhos = (_this$opts3 = this.opts).createGhost) === null || _this$opts$createGhos === void 0 ? void 0 : _this$opts$createGhos.call(_this$opts3, event);
5411
5427
  if (ghost && event.dataTransfer) {
5412
5428
  var _ghost$offsetX, _ghost$offsetY, _this$el$ownerDocumen2;
5413
5429
  addGhostImage(event.dataTransfer, ghost.element, {
@@ -5425,7 +5441,6 @@ react_dom = __toESM(react_dom);
5425
5441
  event.dataTransfer.effectAllowed = "move";
5426
5442
  if (event.dataTransfer.items.length === 0) event.dataTransfer.setData("text/plain", "");
5427
5443
  }
5428
- (_this$opts$onDragStar = (_this$opts3 = this.opts).onDragStart) === null || _this$opts$onDragStar === void 0 || _this$opts$onDragStar.call(_this$opts3, event);
5429
5444
  }), addDisposableListener(this.el, "dragend", (event) => {
5430
5445
  var _this$opts$onDragEnd, _this$opts4;
5431
5446
  this._pointerEventsDisposable.dispose();
@@ -5682,7 +5697,7 @@ react_dom = __toESM(react_dom);
5682
5697
  height
5683
5698
  });
5684
5699
  if (this.part) {
5685
- if (this._params) this.part.update(this._params.params);
5700
+ if (this._params) this.part.update({ params: this._params.params });
5686
5701
  }
5687
5702
  }
5688
5703
  init(parameters) {
@@ -5863,10 +5878,10 @@ react_dom = __toESM(react_dom);
5863
5878
  }
5864
5879
  getComponent() {
5865
5880
  return {
5866
- update: (params) => {
5881
+ update: (event) => {
5867
5882
  var _this$bodyPart, _this$headerPart;
5868
- (_this$bodyPart = this.bodyPart) === null || _this$bodyPart === void 0 || _this$bodyPart.update({ params });
5869
- (_this$headerPart = this.headerPart) === null || _this$headerPart === void 0 || _this$headerPart.update({ params });
5883
+ (_this$bodyPart = this.bodyPart) === null || _this$bodyPart === void 0 || _this$bodyPart.update(event);
5884
+ (_this$headerPart = this.headerPart) === null || _this$headerPart === void 0 || _this$headerPart.update(event);
5870
5885
  },
5871
5886
  dispose: () => {
5872
5887
  var _this$bodyPart2, _this$headerPart2;
@@ -6382,7 +6397,7 @@ react_dom = __toESM(react_dom);
6382
6397
  onDragStart: (event) => {
6383
6398
  var _this$accessor$option2;
6384
6399
  this._onDragStart.fire(event);
6385
- if (!(event instanceof PointerEvent) && ((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") requestAnimationFrame(() => {
6400
+ if (!event.defaultPrevented && !(event instanceof PointerEvent) && ((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") requestAnimationFrame(() => {
6386
6401
  toggleClass(this.element, "dv-tab--dragging", true);
6387
6402
  });
6388
6403
  },
@@ -6661,8 +6676,10 @@ react_dom = __toESM(react_dom);
6661
6676
  },
6662
6677
  onDragStart: (event) => {
6663
6678
  var _this$getFloatingOver;
6664
- (_this$getFloatingOver = this.getFloatingOverlay()) === null || _this$getFloatingOver === void 0 || _this$getFloatingOver.cancelPendingDrag();
6679
+ const wasPrevented = event.defaultPrevented;
6665
6680
  this._onDragStart.fire(event);
6681
+ if (event.defaultPrevented && !wasPrevented) return;
6682
+ (_this$getFloatingOver = this.getFloatingOverlay()) === null || _this$getFloatingOver === void 0 || _this$getFloatingOver.cancelPendingDrag();
6666
6683
  }
6667
6684
  }));
6668
6685
  const overlayMoveSub = new MutableDisposable();
@@ -9566,10 +9583,12 @@ react_dom = __toESM(react_dom);
9566
9583
  value: tab,
9567
9584
  disposable: new CompositeDisposable(tab.onDragStart((event) => {
9568
9585
  var _this$accessor$option2;
9586
+ const wasPrevented = event.defaultPrevented;
9569
9587
  this._onTabDragStart.fire({
9570
9588
  nativeEvent: event,
9571
9589
  panel
9572
9590
  });
9591
+ if (event.defaultPrevented && !wasPrevented) return;
9573
9592
  if (((_this$accessor$option2 = this.accessor.options.theme) === null || _this$accessor$option2 === void 0 ? void 0 : _this$accessor$option2.tabAnimation) === "smooth") {
9574
9593
  const tabSize = mainAxisSize(tab.element.getBoundingClientRect(), this._direction);
9575
9594
  const sourceIndex = this._tabs.findIndex((x) => x.value === tab);
@@ -13321,7 +13340,7 @@ react_dom = __toESM(react_dom);
13321
13340
  floatingGroupPanel.addDisposables(group.api.onDidActivePanelChange(() => updateDialogLabel()), overlay.onDidChange(() => {
13322
13341
  gridview.layout(gridview.width, gridview.height);
13323
13342
  }), overlay.onDidChangeEnd(() => {
13324
- this._host.fireLayoutChange();
13343
+ this._host.fireLayoutChange("geometry");
13325
13344
  }), group.onDidChange((event) => {
13326
13345
  overlay.setBounds({
13327
13346
  height: typeof (event === null || event === void 0 ? void 0 : event.height) === "number" ? event.height + overlay.headerHeight : event === null || event === void 0 ? void 0 : event.height,
@@ -16229,8 +16248,9 @@ react_dom = __toESM(react_dom);
16229
16248
  hasVisibleGridGroup() {
16230
16249
  return this.groups.some((group) => group.api.location.type === "grid" && group.api.isVisible);
16231
16250
  }
16232
- fireLayoutChange() {
16233
- this._bufferOnDidLayoutChange.fire();
16251
+ /** Ping `onDidLayoutChange` (coalesced) with why the layout changed. */
16252
+ fireLayoutChange(reason) {
16253
+ this._bufferOnDidLayoutChange.fire(reason);
16234
16254
  }
16235
16255
  /**
16236
16256
  * Promise that resolves when all popout groups from the last fromJSON call are restored.
@@ -16381,8 +16401,10 @@ react_dom = __toESM(react_dom);
16381
16401
  * Debounced to avoid multiple calls when moving groups with multiple panels.
16382
16402
  */
16383
16403
  this.debouncedUpdateAllPositions();
16384
- }), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidEdgeGroupAutoHideChange, this._onDidActiveGroupChange, this._onUnhandledDragOver, this._onDidMaximizedGroupChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidAddPopoutGroup, this._onDidRemovePopoutGroup, this._onDidChangePopouts, this._onDidAddPopoutGroup.event(() => this._onDidChangePopouts.fire()), this._onDidRemovePopoutGroup.event(() => this._onDidChangePopouts.fire()), this._onDidOpenPopoutWindowFail, this._onDidStartFloatingGroupDrag, this._onDidEndFloatingGroupDrag, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, Event.any(this.onDidPopoutGroupSizeChange, this.onDidPopoutGroupPositionChange, this.onDidCreateTabGroup, this.onDidDestroyTabGroup, this.onDidAddPanelToTabGroup, this.onDidRemovePanelFromTabGroup, this.onDidTabGroupChange, this.onDidTabGroupCollapsedChange)(() => {
16385
- this.fireLayoutChange();
16404
+ }), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidEdgeGroupAutoHideChange, this._onDidActiveGroupChange, this._onUnhandledDragOver, this._onDidMaximizedGroupChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidAddPopoutGroup, this._onDidRemovePopoutGroup, this._onDidChangePopouts, this._onDidAddPopoutGroup.event(() => this._onDidChangePopouts.fire()), this._onDidRemovePopoutGroup.event(() => this._onDidChangePopouts.fire()), this._onDidOpenPopoutWindowFail, this._onDidStartFloatingGroupDrag, this._onDidEndFloatingGroupDrag, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, Event.any(this.onDidPopoutGroupSizeChange, this.onDidPopoutGroupPositionChange)(() => {
16405
+ this.fireLayoutChange("geometry");
16406
+ }), Event.any(this.onDidCreateTabGroup, this.onDidDestroyTabGroup, this.onDidAddPanelToTabGroup, this.onDidRemovePanelFromTabGroup, this.onDidTabGroupChange, this.onDidTabGroupCollapsedChange)(() => {
16407
+ this.fireLayoutChange("structure");
16386
16408
  }), this._onDidOptionsChange, this.onDidAdd((event) => {
16387
16409
  if (!this._moving) this._onDidAddGroup.fire(event);
16388
16410
  }), this.onDidRemove((event) => {
@@ -16394,8 +16416,10 @@ react_dom = __toESM(react_dom);
16394
16416
  group: event.panel,
16395
16417
  isMaximized: event.isMaximized
16396
16418
  });
16397
- }), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidRemoveGroup, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
16398
- this._bufferOnDidLayoutChange.fire();
16419
+ }), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidRemoveGroup, this.onDidMovePanel)(() => {
16420
+ this._bufferOnDidLayoutChange.fire("structure");
16421
+ }), this.onDidActivePanelChange(() => {
16422
+ this._bufferOnDidLayoutChange.fire("activePanel");
16399
16423
  }), Disposable.from(() => {
16400
16424
  var _this$_shellManager2;
16401
16425
  this._moduleRegistry.dispose();
@@ -16766,10 +16790,13 @@ react_dom = __toESM(react_dom);
16766
16790
  }
16767
16791
  /**
16768
16792
  * Teardown for a popout window's `popoutWindowDisposable`. Runs when the
16769
- * window closes (by user, by `removeGroup`, or by component disposal):
16770
- * relocates every member group back to the main grid (or to a floating
16771
- * window when the anchor came from one), then disposes the nested gridview.
16772
- * `closeResult.returnedGroup` is read by the entry's `dispose()` contract.
16793
+ * window closes (by user, by `removeGroup` / `moveGroup`, or by component
16794
+ * disposal). On a genuine close it relocates every member group back to
16795
+ * the main grid (or to a floating window when the anchor came from one),
16796
+ * then disposes the nested gridview. On an explicit removal it only hands
16797
+ * the anchor back and disposes the nested gridview: the remover places the
16798
+ * group itself. `closeResult.returnedGroup` is read by the entry's
16799
+ * `dispose()` contract.
16773
16800
  */
16774
16801
  disposePopoutWindow(params) {
16775
16802
  var _this$_popoutWindowSe7;
@@ -16782,6 +16809,15 @@ react_dom = __toESM(react_dom);
16782
16809
  const members = this.groups.filter((candidate) => popoutGridview.element.contains(candidate.element));
16783
16810
  const anchorPresent = members.includes(group);
16784
16811
  const anchorIsSoleMember = anchorPresent && members.length === 1;
16812
+ if (!genuineClose) {
16813
+ if (anchorPresent && this.getPanel(group.id)) {
16814
+ group.model.renderContainer = this.overlayRenderContainer;
16815
+ group.model.dropTargetContainer = this.rootDropTargetContainer;
16816
+ closeResult.returnedGroup = group;
16817
+ }
16818
+ disposePopoutGridview();
16819
+ return;
16820
+ }
16785
16821
  /**
16786
16822
  * Popping a group out fires `onDidMovePanel` per panel, so closing the
16787
16823
  * window owes the caller the same: every panel in it is rehomed, into
@@ -16792,7 +16828,7 @@ react_dom = __toESM(react_dom);
16792
16828
  * their final group and location.
16793
16829
  */
16794
16830
  const movedPanels = [];
16795
- if (genuineClose) for (const member of members) {
16831
+ for (const member of members) {
16796
16832
  if (member === group) continue;
16797
16833
  this.movingLock(() => {
16798
16834
  this.doRemoveGroup(member, {
@@ -16823,15 +16859,6 @@ react_dom = __toESM(react_dom);
16823
16859
  group.model.renderContainer = this.overlayRenderContainer;
16824
16860
  group.model.dropTargetContainer = this.rootDropTargetContainer;
16825
16861
  closeResult.returnedGroup = group;
16826
- if (!genuineClose) {
16827
- /**
16828
- * If this popout group was explicitly removed then we shouldn't run the additional
16829
- * steps. The explicit remover re-docks the returned group itself; here we only hand
16830
- * it back (above) and tear down the nested gridview.
16831
- */
16832
- disposePopoutGridview();
16833
- return;
16834
- }
16835
16862
  if (floatingBox && anchorIsSoleMember) this.addFloatingGroup(group, {
16836
16863
  height: floatingBox.height,
16837
16864
  width: floatingBox.width,
@@ -17625,16 +17652,33 @@ react_dom = __toESM(react_dom);
17625
17652
  console.error("dockview: failed to deserialize layout. Reverting changes", err);
17626
17653
  /**
17627
17654
  * Takes all the successfully created groups and remove all of their panels.
17655
+ *
17656
+ * `group.panels` is the group's live array and `removePanel`
17657
+ * splices it, so iterate a copy — walking the live array skips
17658
+ * every other panel, leaving it attached to the overlay render
17659
+ * container and its `onDidRemovePanel` never fired.
17628
17660
  */
17629
- for (const group of this.groups) for (const panel of group.panels) this.removePanel(panel, {
17661
+ for (const group of this.groups) for (const panel of group.panels.slice()) this.removePanel(panel, {
17630
17662
  removeEmptyGroup: false,
17631
17663
  skipDispose: false
17632
17664
  });
17633
17665
  /**
17634
17666
  * To remove a group we cannot call this.removeGroup(...) since this makes assumptions about
17635
17667
  * the underlying HTMLElement existing in the Gridview.
17668
+ *
17669
+ * Edge groups are structural (owned by the edge-group service and
17670
+ * the shell, not the grid), so they are skipped here exactly as
17671
+ * `_doClear` and `doRemoveGroup` skip them. Disposing one would
17672
+ * leave the service holding a dead group: `addEdgeGroup` at that
17673
+ * position reports it as existing, `addPanel` against it fails,
17674
+ * and a later good `fromJSON` restores nothing into it. The panel
17675
+ * loop above has already emptied them and the `clear()` below
17676
+ * keeps them registered: the same state a successful restore of a
17677
+ * layout without that edge group leaves them in.
17636
17678
  */
17637
17679
  for (const group of this.groups) {
17680
+ var _this$_edgeGroupServi9;
17681
+ if ((_this$_edgeGroupServi9 = this._edgeGroupService) === null || _this$_edgeGroupServi9 === void 0 ? void 0 : _this$_edgeGroupServi9.includes(group)) continue;
17638
17682
  group.dispose();
17639
17683
  this._groups.delete(group.id);
17640
17684
  this._onDidRemoveGroup.fire(group);
@@ -17804,8 +17848,8 @@ react_dom = __toESM(react_dom);
17804
17848
  const groups = Array.from(this._groups.values()).map((_) => _.value);
17805
17849
  const hasActiveGroup = !!this.activeGroup;
17806
17850
  for (const group of groups) {
17807
- var _this$_edgeGroupServi9;
17808
- if ((_this$_edgeGroupServi9 = this._edgeGroupService) === null || _this$_edgeGroupServi9 === void 0 ? void 0 : _this$_edgeGroupServi9.includes(group)) {
17851
+ var _this$_edgeGroupServi10;
17852
+ if ((_this$_edgeGroupServi10 = this._edgeGroupService) === null || _this$_edgeGroupServi10 === void 0 ? void 0 : _this$_edgeGroupServi10.includes(group)) {
17809
17853
  const panels = [...group.panels];
17810
17854
  for (const panel of panels) this.removePanel(panel, { removeEmptyGroup: false });
17811
17855
  continue;
@@ -18236,8 +18280,8 @@ react_dom = __toESM(react_dom);
18236
18280
  }
18237
18281
  }
18238
18282
  doRemoveGroup(group, options) {
18239
- var _this$_edgeGroupServi10;
18240
- if ((_this$_edgeGroupServi10 = this._edgeGroupService) === null || _this$_edgeGroupServi10 === void 0 ? void 0 : _this$_edgeGroupServi10.includes(group)) return group;
18283
+ var _this$_edgeGroupServi11;
18284
+ if ((_this$_edgeGroupServi11 = this._edgeGroupService) === null || _this$_edgeGroupServi11 === void 0 ? void 0 : _this$_edgeGroupServi11.includes(group)) return group;
18241
18285
  const panels = [...group.panels];
18242
18286
  if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) for (const panel of panels) {
18243
18287
  var _options$skipDispose;
@@ -18924,8 +18968,10 @@ react_dom = __toESM(react_dom);
18924
18968
  if (this._moving) return;
18925
18969
  if (event.panel !== this.activePanel) return;
18926
18970
  if (((_this$_onDidActivePan3 = this._onDidActivePanelChange.value) === null || _this$_onDidActivePan3 === void 0 ? void 0 : _this$_onDidActivePan3.panel) !== event.panel) this.fireActivePanelChange(event.panel);
18927
- }), Event.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
18928
- this._bufferOnDidLayoutChange.fire();
18971
+ }), view.model.onDidPanelTitleChange(() => {
18972
+ this._bufferOnDidLayoutChange.fire("panelTitle");
18973
+ }), view.model.onDidPanelParametersChange(() => {
18974
+ this._bufferOnDidLayoutChange.fire("panelParameters");
18929
18975
  }));
18930
18976
  this._groups.set(view.id, {
18931
18977
  value: view,
@@ -19299,7 +19345,7 @@ react_dom = __toESM(react_dom);
19299
19345
  if (this._splitview) this._splitview.dispose();
19300
19346
  this._splitview = value;
19301
19347
  this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
19302
- this._onDidLayoutChange.fire(void 0);
19348
+ this._onDidLayoutChange.fire({ reasons: /* @__PURE__ */ new Set(["geometry"]) });
19303
19349
  }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
19304
19350
  }
19305
19351
  get minimumSize() {
@@ -19583,7 +19629,7 @@ react_dom = __toESM(react_dom);
19583
19629
  set paneview(value) {
19584
19630
  this._paneview = value;
19585
19631
  this._disposable.value = new CompositeDisposable(this._paneview.onDidChange(() => {
19586
- this._onDidLayoutChange.fire(void 0);
19632
+ this._onDidLayoutChange.fire({ reasons: /* @__PURE__ */ new Set(["geometry"]) });
19587
19633
  }), this._paneview.onDidAddView((e) => this._onDidAddView.fire(e)), this._paneview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
19588
19634
  }
19589
19635
  get paneview() {
@@ -20875,9 +20921,9 @@ react_dom = __toESM(react_dom);
20875
20921
  toJSON() {
20876
20922
  return { id: this.id };
20877
20923
  }
20878
- update(params) {
20924
+ update(event) {
20879
20925
  var _this$part;
20880
- (_this$part = this.part) === null || _this$part === void 0 || _this$part.update(params.params);
20926
+ (_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: event.params });
20881
20927
  }
20882
20928
  dispose() {
20883
20929
  var _this$part2;