dockview-react 4.12.0 → 4.13.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.12.0
3
+ * @version 4.13.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1297,11 +1297,13 @@ class Splitview {
1297
1297
  document.removeEventListener('pointermove', onPointerMove);
1298
1298
  document.removeEventListener('pointerup', end);
1299
1299
  document.removeEventListener('pointercancel', end);
1300
+ document.removeEventListener('contextmenu', end);
1300
1301
  this._onDidSashEnd.fire(undefined);
1301
1302
  };
1302
1303
  document.addEventListener('pointermove', onPointerMove);
1303
1304
  document.addEventListener('pointerup', end);
1304
1305
  document.addEventListener('pointercancel', end);
1306
+ document.addEventListener('contextmenu', end);
1305
1307
  };
1306
1308
  sash.addEventListener('pointerdown', onPointerStart);
1307
1309
  const sashItem = {
@@ -5163,7 +5165,7 @@ class Tab extends CompositeDisposable {
5163
5165
  }
5164
5166
  }
5165
5167
 
5166
- class WillShowOverlayLocationEvent {
5168
+ class DockviewWillShowOverlayLocationEvent {
5167
5169
  get kind() {
5168
5170
  return this.options.kind;
5169
5171
  }
@@ -5511,7 +5513,7 @@ class Tabs extends CompositeDisposable {
5511
5513
  index: this._tabs.findIndex((x) => x.value === tab),
5512
5514
  });
5513
5515
  }), tab.onWillShowOverlay((event) => {
5514
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5516
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5515
5517
  kind: 'tab',
5516
5518
  panel: this.group.activePanel,
5517
5519
  api: this.accessor.api,
@@ -5675,7 +5677,7 @@ class TabsContainer extends CompositeDisposable {
5675
5677
  index: this.tabs.size,
5676
5678
  });
5677
5679
  }), this.voidContainer.onWillShowOverlay((event) => {
5678
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5680
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5679
5681
  kind: 'header_space',
5680
5682
  panel: this.group.activePanel,
5681
5683
  api: this.accessor.api,
@@ -6069,7 +6071,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6069
6071
  }), this.tabsContainer.onWillShowOverlay((event) => {
6070
6072
  this._onWillShowOverlay.fire(event);
6071
6073
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6072
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6074
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6073
6075
  kind: 'content',
6074
6076
  panel: this.activePanel,
6075
6077
  api: this._api,
@@ -6745,7 +6747,19 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6745
6747
  this.onDidLocationChange = this._onDidLocationChange.event;
6746
6748
  this._onDidActivePanelChange = new Emitter();
6747
6749
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6748
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6750
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6751
+ // When becoming visible, apply any pending size change
6752
+ if (event.isVisible && this._pendingSize) {
6753
+ super.setSize(this._pendingSize);
6754
+ this._pendingSize = undefined;
6755
+ }
6756
+ }));
6757
+ }
6758
+ setSize(event) {
6759
+ // Always store the requested size
6760
+ this._pendingSize = Object.assign({}, event);
6761
+ // Apply the size change immediately
6762
+ super.setSize(event);
6749
6763
  }
6750
6764
  close() {
6751
6765
  if (!this._group) {
@@ -7697,13 +7711,16 @@ class Overlay extends CompositeDisposable {
7697
7711
  let right = undefined;
7698
7712
  let width = undefined;
7699
7713
  const moveTop = () => {
7700
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7714
+ // When dragging top handle, constrain top position to prevent oversizing
7715
+ const maxTop = startPosition.originalY +
7701
7716
  startPosition.originalHeight >
7702
7717
  containerRect.height
7703
- ? this.getMinimumHeight(containerRect.height)
7718
+ ? Math.max(0, containerRect.height -
7719
+ Overlay.MINIMUM_HEIGHT)
7704
7720
  : Math.max(0, startPosition.originalY +
7705
7721
  startPosition.originalHeight -
7706
- Overlay.MINIMUM_HEIGHT));
7722
+ Overlay.MINIMUM_HEIGHT);
7723
+ top = clamp(y, 0, maxTop);
7707
7724
  height =
7708
7725
  startPosition.originalY +
7709
7726
  startPosition.originalHeight -
@@ -7714,22 +7731,27 @@ class Overlay extends CompositeDisposable {
7714
7731
  top =
7715
7732
  startPosition.originalY -
7716
7733
  startPosition.originalHeight;
7717
- height = clamp(y - top, top < 0 &&
7718
- typeof this.options
7719
- .minimumInViewportHeight === 'number'
7734
+ // When dragging bottom handle, constrain height to container height
7735
+ const minHeight = top < 0 &&
7736
+ typeof this.options.minimumInViewportHeight ===
7737
+ 'number'
7720
7738
  ? -top +
7721
7739
  this.options.minimumInViewportHeight
7722
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7740
+ : Overlay.MINIMUM_HEIGHT;
7741
+ const maxHeight = containerRect.height - Math.max(0, top);
7742
+ height = clamp(y - top, minHeight, maxHeight);
7723
7743
  bottom = containerRect.height - top - height;
7724
7744
  };
7725
7745
  const moveLeft = () => {
7726
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7746
+ const maxLeft = startPosition.originalX +
7727
7747
  startPosition.originalWidth >
7728
7748
  containerRect.width
7729
- ? this.getMinimumWidth(containerRect.width)
7749
+ ? Math.max(0, containerRect.width -
7750
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7730
7751
  : Math.max(0, startPosition.originalX +
7731
7752
  startPosition.originalWidth -
7732
- Overlay.MINIMUM_WIDTH));
7753
+ Overlay.MINIMUM_WIDTH);
7754
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7733
7755
  width =
7734
7756
  startPosition.originalX +
7735
7757
  startPosition.originalWidth -
@@ -7740,12 +7762,15 @@ class Overlay extends CompositeDisposable {
7740
7762
  left =
7741
7763
  startPosition.originalX -
7742
7764
  startPosition.originalWidth;
7743
- width = clamp(x - left, left < 0 &&
7744
- typeof this.options
7745
- .minimumInViewportWidth === 'number'
7765
+ // When dragging right handle, constrain width to container width
7766
+ const minWidth = left < 0 &&
7767
+ typeof this.options.minimumInViewportWidth ===
7768
+ 'number'
7746
7769
  ? -left +
7747
7770
  this.options.minimumInViewportWidth
7748
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7771
+ : Overlay.MINIMUM_WIDTH;
7772
+ const maxWidth = containerRect.width - Math.max(0, left);
7773
+ width = clamp(x - left, minWidth, maxWidth);
7749
7774
  right = containerRect.width - left - width;
7750
7775
  };
7751
7776
  switch (direction) {
@@ -8575,7 +8600,7 @@ class DockviewComponent extends BaseGrid {
8575
8600
  // option only available when no panels in primary grid
8576
8601
  return;
8577
8602
  }
8578
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8603
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8579
8604
  kind: 'edge',
8580
8605
  panel: undefined,
8581
8606
  api: this._api,
@@ -9812,6 +9837,13 @@ class DockviewComponent extends BaseGrid {
9812
9837
  panel: removedPanel,
9813
9838
  from: sourceGroup,
9814
9839
  });
9840
+ /**
9841
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9842
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9843
+ */
9844
+ requestAnimationFrame(() => {
9845
+ this.overlayRenderContainer.updateAllPositions();
9846
+ });
9815
9847
  }
9816
9848
  else {
9817
9849
  /**
@@ -12123,6 +12155,7 @@ exports.DockviewPanel = DockviewPanel;
12123
12155
  exports.DockviewReact = DockviewReact;
12124
12156
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
12125
12157
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
12158
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
12126
12159
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
12127
12160
  exports.Gridview = Gridview;
12128
12161
  exports.GridviewApi = GridviewApi;