dockview-angular 4.12.0 → 4.13.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-angular
3
- * @version 4.12.0
3
+ * @version 4.13.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1268,11 +1268,13 @@
1268
1268
  document.removeEventListener('pointermove', onPointerMove);
1269
1269
  document.removeEventListener('pointerup', end);
1270
1270
  document.removeEventListener('pointercancel', end);
1271
+ document.removeEventListener('contextmenu', end);
1271
1272
  this._onDidSashEnd.fire(undefined);
1272
1273
  };
1273
1274
  document.addEventListener('pointermove', onPointerMove);
1274
1275
  document.addEventListener('pointerup', end);
1275
1276
  document.addEventListener('pointercancel', end);
1277
+ document.addEventListener('contextmenu', end);
1276
1278
  };
1277
1279
  sash.addEventListener('pointerdown', onPointerStart);
1278
1280
  const sashItem = {
@@ -5134,7 +5136,7 @@
5134
5136
  }
5135
5137
  }
5136
5138
 
5137
- class WillShowOverlayLocationEvent {
5139
+ class DockviewWillShowOverlayLocationEvent {
5138
5140
  get kind() {
5139
5141
  return this.options.kind;
5140
5142
  }
@@ -5482,7 +5484,7 @@
5482
5484
  index: this._tabs.findIndex((x) => x.value === tab),
5483
5485
  });
5484
5486
  }), tab.onWillShowOverlay((event) => {
5485
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5487
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5486
5488
  kind: 'tab',
5487
5489
  panel: this.group.activePanel,
5488
5490
  api: this.accessor.api,
@@ -5646,7 +5648,7 @@
5646
5648
  index: this.tabs.size,
5647
5649
  });
5648
5650
  }), this.voidContainer.onWillShowOverlay((event) => {
5649
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5651
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5650
5652
  kind: 'header_space',
5651
5653
  panel: this.group.activePanel,
5652
5654
  api: this.accessor.api,
@@ -6040,7 +6042,7 @@
6040
6042
  }), this.tabsContainer.onWillShowOverlay((event) => {
6041
6043
  this._onWillShowOverlay.fire(event);
6042
6044
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6043
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6045
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6044
6046
  kind: 'content',
6045
6047
  panel: this.activePanel,
6046
6048
  api: this._api,
@@ -6716,7 +6718,19 @@
6716
6718
  this.onDidLocationChange = this._onDidLocationChange.event;
6717
6719
  this._onDidActivePanelChange = new Emitter();
6718
6720
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6719
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6721
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6722
+ // When becoming visible, apply any pending size change
6723
+ if (event.isVisible && this._pendingSize) {
6724
+ super.setSize(this._pendingSize);
6725
+ this._pendingSize = undefined;
6726
+ }
6727
+ }));
6728
+ }
6729
+ setSize(event) {
6730
+ // Always store the requested size
6731
+ this._pendingSize = Object.assign({}, event);
6732
+ // Apply the size change immediately
6733
+ super.setSize(event);
6720
6734
  }
6721
6735
  close() {
6722
6736
  if (!this._group) {
@@ -7668,13 +7682,16 @@
7668
7682
  let right = undefined;
7669
7683
  let width = undefined;
7670
7684
  const moveTop = () => {
7671
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7685
+ // When dragging top handle, constrain top position to prevent oversizing
7686
+ const maxTop = startPosition.originalY +
7672
7687
  startPosition.originalHeight >
7673
7688
  containerRect.height
7674
- ? this.getMinimumHeight(containerRect.height)
7689
+ ? Math.max(0, containerRect.height -
7690
+ Overlay.MINIMUM_HEIGHT)
7675
7691
  : Math.max(0, startPosition.originalY +
7676
7692
  startPosition.originalHeight -
7677
- Overlay.MINIMUM_HEIGHT));
7693
+ Overlay.MINIMUM_HEIGHT);
7694
+ top = clamp(y, 0, maxTop);
7678
7695
  height =
7679
7696
  startPosition.originalY +
7680
7697
  startPosition.originalHeight -
@@ -7685,22 +7702,27 @@
7685
7702
  top =
7686
7703
  startPosition.originalY -
7687
7704
  startPosition.originalHeight;
7688
- height = clamp(y - top, top < 0 &&
7689
- typeof this.options
7690
- .minimumInViewportHeight === 'number'
7705
+ // When dragging bottom handle, constrain height to container height
7706
+ const minHeight = top < 0 &&
7707
+ typeof this.options.minimumInViewportHeight ===
7708
+ 'number'
7691
7709
  ? -top +
7692
7710
  this.options.minimumInViewportHeight
7693
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7711
+ : Overlay.MINIMUM_HEIGHT;
7712
+ const maxHeight = containerRect.height - Math.max(0, top);
7713
+ height = clamp(y - top, minHeight, maxHeight);
7694
7714
  bottom = containerRect.height - top - height;
7695
7715
  };
7696
7716
  const moveLeft = () => {
7697
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7717
+ const maxLeft = startPosition.originalX +
7698
7718
  startPosition.originalWidth >
7699
7719
  containerRect.width
7700
- ? this.getMinimumWidth(containerRect.width)
7720
+ ? Math.max(0, containerRect.width -
7721
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7701
7722
  : Math.max(0, startPosition.originalX +
7702
7723
  startPosition.originalWidth -
7703
- Overlay.MINIMUM_WIDTH));
7724
+ Overlay.MINIMUM_WIDTH);
7725
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7704
7726
  width =
7705
7727
  startPosition.originalX +
7706
7728
  startPosition.originalWidth -
@@ -7711,12 +7733,15 @@
7711
7733
  left =
7712
7734
  startPosition.originalX -
7713
7735
  startPosition.originalWidth;
7714
- width = clamp(x - left, left < 0 &&
7715
- typeof this.options
7716
- .minimumInViewportWidth === 'number'
7736
+ // When dragging right handle, constrain width to container width
7737
+ const minWidth = left < 0 &&
7738
+ typeof this.options.minimumInViewportWidth ===
7739
+ 'number'
7717
7740
  ? -left +
7718
7741
  this.options.minimumInViewportWidth
7719
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7742
+ : Overlay.MINIMUM_WIDTH;
7743
+ const maxWidth = containerRect.width - Math.max(0, left);
7744
+ width = clamp(x - left, minWidth, maxWidth);
7720
7745
  right = containerRect.width - left - width;
7721
7746
  };
7722
7747
  switch (direction) {
@@ -8509,7 +8534,14 @@
8509
8534
  if (options.debug) {
8510
8535
  this.addDisposables(new StrictEventsSequencing(this));
8511
8536
  }
8512
- this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8537
+ this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidMovePanel.event(() => {
8538
+ /**
8539
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
8540
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
8541
+ * Debounced to avoid multiple calls when moving groups with multiple panels.
8542
+ */
8543
+ this.debouncedUpdateAllPositions();
8544
+ }), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8513
8545
  this.updateWatermark();
8514
8546
  }), this.onDidAdd((event) => {
8515
8547
  if (!this._moving) {
@@ -8546,7 +8578,7 @@
8546
8578
  // option only available when no panels in primary grid
8547
8579
  return;
8548
8580
  }
8549
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8581
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8550
8582
  kind: 'edge',
8551
8583
  panel: undefined,
8552
8584
  api: this._api,
@@ -9375,9 +9407,7 @@
9375
9407
  }
9376
9408
  this.updateWatermark();
9377
9409
  // Force position updates for always visible panels after DOM layout is complete
9378
- requestAnimationFrame(() => {
9379
- this.overlayRenderContainer.updateAllPositions();
9380
- });
9410
+ this.debouncedUpdateAllPositions();
9381
9411
  this._onDidLayoutFromJSON.fire();
9382
9412
  }
9383
9413
  clear() {
@@ -9713,6 +9743,15 @@
9713
9743
  }
9714
9744
  return re;
9715
9745
  }
9746
+ debouncedUpdateAllPositions() {
9747
+ if (this._updatePositionsFrameId !== undefined) {
9748
+ cancelAnimationFrame(this._updatePositionsFrameId);
9749
+ }
9750
+ this._updatePositionsFrameId = requestAnimationFrame(() => {
9751
+ this._updatePositionsFrameId = undefined;
9752
+ this.overlayRenderContainer.updateAllPositions();
9753
+ });
9754
+ }
9716
9755
  movingLock(func) {
9717
9756
  const isMoving = this._moving;
9718
9757
  try {
@@ -10023,6 +10062,7 @@
10023
10062
  from.panels.forEach((panel) => {
10024
10063
  this._onDidMovePanel.fire({ panel, from });
10025
10064
  });
10065
+ this.debouncedUpdateAllPositions();
10026
10066
  // Ensure group becomes active after move
10027
10067
  if (options.skipSetActive === false) {
10028
10068
  // Only activate when explicitly requested (skipSetActive: false)
@@ -13086,6 +13126,7 @@
13086
13126
  exports.DockviewPanel = DockviewPanel;
13087
13127
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
13088
13128
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
13129
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
13089
13130
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
13090
13131
  exports.Gridview = Gridview;
13091
13132
  exports.GridviewApi = GridviewApi;