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
  */
@@ -1295,11 +1295,13 @@ class Splitview {
1295
1295
  document.removeEventListener('pointermove', onPointerMove);
1296
1296
  document.removeEventListener('pointerup', end);
1297
1297
  document.removeEventListener('pointercancel', end);
1298
+ document.removeEventListener('contextmenu', end);
1298
1299
  this._onDidSashEnd.fire(undefined);
1299
1300
  };
1300
1301
  document.addEventListener('pointermove', onPointerMove);
1301
1302
  document.addEventListener('pointerup', end);
1302
1303
  document.addEventListener('pointercancel', end);
1304
+ document.addEventListener('contextmenu', end);
1303
1305
  };
1304
1306
  sash.addEventListener('pointerdown', onPointerStart);
1305
1307
  const sashItem = {
@@ -5161,7 +5163,7 @@ class Tab extends CompositeDisposable {
5161
5163
  }
5162
5164
  }
5163
5165
 
5164
- class WillShowOverlayLocationEvent {
5166
+ class DockviewWillShowOverlayLocationEvent {
5165
5167
  get kind() {
5166
5168
  return this.options.kind;
5167
5169
  }
@@ -5509,7 +5511,7 @@ class Tabs extends CompositeDisposable {
5509
5511
  index: this._tabs.findIndex((x) => x.value === tab),
5510
5512
  });
5511
5513
  }), tab.onWillShowOverlay((event) => {
5512
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5514
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5513
5515
  kind: 'tab',
5514
5516
  panel: this.group.activePanel,
5515
5517
  api: this.accessor.api,
@@ -5673,7 +5675,7 @@ class TabsContainer extends CompositeDisposable {
5673
5675
  index: this.tabs.size,
5674
5676
  });
5675
5677
  }), this.voidContainer.onWillShowOverlay((event) => {
5676
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5678
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5677
5679
  kind: 'header_space',
5678
5680
  panel: this.group.activePanel,
5679
5681
  api: this.accessor.api,
@@ -6067,7 +6069,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
6067
6069
  }), this.tabsContainer.onWillShowOverlay((event) => {
6068
6070
  this._onWillShowOverlay.fire(event);
6069
6071
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6070
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6072
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6071
6073
  kind: 'content',
6072
6074
  panel: this.activePanel,
6073
6075
  api: this._api,
@@ -6743,7 +6745,19 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6743
6745
  this.onDidLocationChange = this._onDidLocationChange.event;
6744
6746
  this._onDidActivePanelChange = new Emitter();
6745
6747
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6746
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6748
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6749
+ // When becoming visible, apply any pending size change
6750
+ if (event.isVisible && this._pendingSize) {
6751
+ super.setSize(this._pendingSize);
6752
+ this._pendingSize = undefined;
6753
+ }
6754
+ }));
6755
+ }
6756
+ setSize(event) {
6757
+ // Always store the requested size
6758
+ this._pendingSize = Object.assign({}, event);
6759
+ // Apply the size change immediately
6760
+ super.setSize(event);
6747
6761
  }
6748
6762
  close() {
6749
6763
  if (!this._group) {
@@ -7695,13 +7709,16 @@ class Overlay extends CompositeDisposable {
7695
7709
  let right = undefined;
7696
7710
  let width = undefined;
7697
7711
  const moveTop = () => {
7698
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7712
+ // When dragging top handle, constrain top position to prevent oversizing
7713
+ const maxTop = startPosition.originalY +
7699
7714
  startPosition.originalHeight >
7700
7715
  containerRect.height
7701
- ? this.getMinimumHeight(containerRect.height)
7716
+ ? Math.max(0, containerRect.height -
7717
+ Overlay.MINIMUM_HEIGHT)
7702
7718
  : Math.max(0, startPosition.originalY +
7703
7719
  startPosition.originalHeight -
7704
- Overlay.MINIMUM_HEIGHT));
7720
+ Overlay.MINIMUM_HEIGHT);
7721
+ top = clamp(y, 0, maxTop);
7705
7722
  height =
7706
7723
  startPosition.originalY +
7707
7724
  startPosition.originalHeight -
@@ -7712,22 +7729,27 @@ class Overlay extends CompositeDisposable {
7712
7729
  top =
7713
7730
  startPosition.originalY -
7714
7731
  startPosition.originalHeight;
7715
- height = clamp(y - top, top < 0 &&
7716
- typeof this.options
7717
- .minimumInViewportHeight === 'number'
7732
+ // When dragging bottom handle, constrain height to container height
7733
+ const minHeight = top < 0 &&
7734
+ typeof this.options.minimumInViewportHeight ===
7735
+ 'number'
7718
7736
  ? -top +
7719
7737
  this.options.minimumInViewportHeight
7720
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7738
+ : Overlay.MINIMUM_HEIGHT;
7739
+ const maxHeight = containerRect.height - Math.max(0, top);
7740
+ height = clamp(y - top, minHeight, maxHeight);
7721
7741
  bottom = containerRect.height - top - height;
7722
7742
  };
7723
7743
  const moveLeft = () => {
7724
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7744
+ const maxLeft = startPosition.originalX +
7725
7745
  startPosition.originalWidth >
7726
7746
  containerRect.width
7727
- ? this.getMinimumWidth(containerRect.width)
7747
+ ? Math.max(0, containerRect.width -
7748
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7728
7749
  : Math.max(0, startPosition.originalX +
7729
7750
  startPosition.originalWidth -
7730
- Overlay.MINIMUM_WIDTH));
7751
+ Overlay.MINIMUM_WIDTH);
7752
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7731
7753
  width =
7732
7754
  startPosition.originalX +
7733
7755
  startPosition.originalWidth -
@@ -7738,12 +7760,15 @@ class Overlay extends CompositeDisposable {
7738
7760
  left =
7739
7761
  startPosition.originalX -
7740
7762
  startPosition.originalWidth;
7741
- width = clamp(x - left, left < 0 &&
7742
- typeof this.options
7743
- .minimumInViewportWidth === 'number'
7763
+ // When dragging right handle, constrain width to container width
7764
+ const minWidth = left < 0 &&
7765
+ typeof this.options.minimumInViewportWidth ===
7766
+ 'number'
7744
7767
  ? -left +
7745
7768
  this.options.minimumInViewportWidth
7746
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7769
+ : Overlay.MINIMUM_WIDTH;
7770
+ const maxWidth = containerRect.width - Math.max(0, left);
7771
+ width = clamp(x - left, minWidth, maxWidth);
7747
7772
  right = containerRect.width - left - width;
7748
7773
  };
7749
7774
  switch (direction) {
@@ -8573,7 +8598,7 @@ class DockviewComponent extends BaseGrid {
8573
8598
  // option only available when no panels in primary grid
8574
8599
  return;
8575
8600
  }
8576
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8601
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8577
8602
  kind: 'edge',
8578
8603
  panel: undefined,
8579
8604
  api: this._api,
@@ -9810,6 +9835,13 @@ class DockviewComponent extends BaseGrid {
9810
9835
  panel: removedPanel,
9811
9836
  from: sourceGroup,
9812
9837
  });
9838
+ /**
9839
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9840
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9841
+ */
9842
+ requestAnimationFrame(() => {
9843
+ this.overlayRenderContainer.updateAllPositions();
9844
+ });
9813
9845
  }
9814
9846
  else {
9815
9847
  /**
@@ -12104,5 +12136,5 @@ const PaneviewReact = React.forwardRef((props, ref) => {
12104
12136
  });
12105
12137
  PaneviewReact.displayName = 'PaneviewComponent';
12106
12138
 
12107
- export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, PaneviewUnhandledDragOverEvent, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactComponent, orthogonal, positionToDirection, themeAbyss, themeAbyssSpaced, themeDark, themeDracula, themeLight, themeLightSpaced, themeReplit, themeVisualStudio, toTarget, usePortalsLifecycle };
12139
+ export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DockviewWillShowOverlayLocationEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, PaneviewUnhandledDragOverEvent, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactComponent, orthogonal, positionToDirection, themeAbyss, themeAbyssSpaced, themeDark, themeDracula, themeLight, themeLightSpaced, themeReplit, themeVisualStudio, toTarget, usePortalsLifecycle };
12108
12140
  //# sourceMappingURL=dockview-react.esm.js.map