react-resizable-panels 2.1.0 → 2.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.
- package/CHANGELOG.md +6 -1
- package/dist/react-resizable-panels.browser.cjs.js +2 -2
- package/dist/react-resizable-panels.browser.development.cjs.js +2 -2
- package/dist/react-resizable-panels.browser.development.esm.js +2 -2
- package/dist/react-resizable-panels.browser.esm.js +2 -2
- package/dist/react-resizable-panels.cjs.js +2 -2
- package/dist/react-resizable-panels.development.cjs.js +2 -2
- package/dist/react-resizable-panels.development.esm.js +2 -2
- package/dist/react-resizable-panels.development.node.cjs.js +2 -2
- package/dist/react-resizable-panels.development.node.esm.js +2 -2
- package/dist/react-resizable-panels.esm.js +2 -2
- package/dist/react-resizable-panels.node.cjs.js +2 -2
- package/dist/react-resizable-panels.node.esm.js +2 -2
- package/package.json +1 -1
- package/src/PanelGroup.ts +1 -1
- package/src/PanelResizeHandle.test.tsx +21 -2
- package/src/PanelResizeHandleRegistry.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
- Fix `onDragging` regression (#391)
|
|
6
|
+
- Fix cursor icon behavior in nested panels (#390)
|
|
7
|
+
|
|
3
8
|
## 2.1.0
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
- Add opt-in support for setting the [`"nonce"` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) for the global cursor style (#386)
|
|
6
11
|
- Support disabling global cursor styles (#387)
|
|
7
12
|
|
|
8
13
|
## 2.0.23
|
|
@@ -517,7 +517,7 @@ function handlePointerMove(event) {
|
|
|
517
517
|
|
|
518
518
|
// Edge case (see #340)
|
|
519
519
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
520
|
-
if (event.buttons === 0) {
|
|
520
|
+
if (isPointerDown && event.buttons === 0) {
|
|
521
521
|
isPointerDown = false;
|
|
522
522
|
updateResizeHandlerStates("up", event);
|
|
523
523
|
}
|
|
@@ -1992,7 +1992,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1992
1992
|
// but updating cursor in this scenario would cause a flicker.
|
|
1993
1993
|
if (prevDeltaRef.current != delta) {
|
|
1994
1994
|
prevDeltaRef.current = delta;
|
|
1995
|
-
if (!layoutChanged) {
|
|
1995
|
+
if (!layoutChanged && delta !== 0) {
|
|
1996
1996
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1997
1997
|
// This mimics VS Code behavior.
|
|
1998
1998
|
if (isHorizontal) {
|
|
@@ -523,7 +523,7 @@ function handlePointerMove(event) {
|
|
|
523
523
|
|
|
524
524
|
// Edge case (see #340)
|
|
525
525
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
526
|
-
if (event.buttons === 0) {
|
|
526
|
+
if (isPointerDown && event.buttons === 0) {
|
|
527
527
|
isPointerDown = false;
|
|
528
528
|
updateResizeHandlerStates("up", event);
|
|
529
529
|
}
|
|
@@ -2098,7 +2098,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2098
2098
|
// but updating cursor in this scenario would cause a flicker.
|
|
2099
2099
|
if (prevDeltaRef.current != delta) {
|
|
2100
2100
|
prevDeltaRef.current = delta;
|
|
2101
|
-
if (!layoutChanged) {
|
|
2101
|
+
if (!layoutChanged && delta !== 0) {
|
|
2102
2102
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
2103
2103
|
// This mimics VS Code behavior.
|
|
2104
2104
|
if (isHorizontal) {
|
|
@@ -499,7 +499,7 @@ function handlePointerMove(event) {
|
|
|
499
499
|
|
|
500
500
|
// Edge case (see #340)
|
|
501
501
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
502
|
-
if (event.buttons === 0) {
|
|
502
|
+
if (isPointerDown && event.buttons === 0) {
|
|
503
503
|
isPointerDown = false;
|
|
504
504
|
updateResizeHandlerStates("up", event);
|
|
505
505
|
}
|
|
@@ -2074,7 +2074,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2074
2074
|
// but updating cursor in this scenario would cause a flicker.
|
|
2075
2075
|
if (prevDeltaRef.current != delta) {
|
|
2076
2076
|
prevDeltaRef.current = delta;
|
|
2077
|
-
if (!layoutChanged) {
|
|
2077
|
+
if (!layoutChanged && delta !== 0) {
|
|
2078
2078
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
2079
2079
|
// This mimics VS Code behavior.
|
|
2080
2080
|
if (isHorizontal) {
|
|
@@ -493,7 +493,7 @@ function handlePointerMove(event) {
|
|
|
493
493
|
|
|
494
494
|
// Edge case (see #340)
|
|
495
495
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
496
|
-
if (event.buttons === 0) {
|
|
496
|
+
if (isPointerDown && event.buttons === 0) {
|
|
497
497
|
isPointerDown = false;
|
|
498
498
|
updateResizeHandlerStates("up", event);
|
|
499
499
|
}
|
|
@@ -1968,7 +1968,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1968
1968
|
// but updating cursor in this scenario would cause a flicker.
|
|
1969
1969
|
if (prevDeltaRef.current != delta) {
|
|
1970
1970
|
prevDeltaRef.current = delta;
|
|
1971
|
-
if (!layoutChanged) {
|
|
1971
|
+
if (!layoutChanged && delta !== 0) {
|
|
1972
1972
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1973
1973
|
// This mimics VS Code behavior.
|
|
1974
1974
|
if (isHorizontal) {
|
|
@@ -519,7 +519,7 @@ function handlePointerMove(event) {
|
|
|
519
519
|
|
|
520
520
|
// Edge case (see #340)
|
|
521
521
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
522
|
-
if (event.buttons === 0) {
|
|
522
|
+
if (isPointerDown && event.buttons === 0) {
|
|
523
523
|
isPointerDown = false;
|
|
524
524
|
updateResizeHandlerStates("up", event);
|
|
525
525
|
}
|
|
@@ -1994,7 +1994,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1994
1994
|
// but updating cursor in this scenario would cause a flicker.
|
|
1995
1995
|
if (prevDeltaRef.current != delta) {
|
|
1996
1996
|
prevDeltaRef.current = delta;
|
|
1997
|
-
if (!layoutChanged) {
|
|
1997
|
+
if (!layoutChanged && delta !== 0) {
|
|
1998
1998
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1999
1999
|
// This mimics VS Code behavior.
|
|
2000
2000
|
if (isHorizontal) {
|
|
@@ -530,7 +530,7 @@ function handlePointerMove(event) {
|
|
|
530
530
|
|
|
531
531
|
// Edge case (see #340)
|
|
532
532
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
533
|
-
if (event.buttons === 0) {
|
|
533
|
+
if (isPointerDown && event.buttons === 0) {
|
|
534
534
|
isPointerDown = false;
|
|
535
535
|
updateResizeHandlerStates("up", event);
|
|
536
536
|
}
|
|
@@ -2105,7 +2105,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2105
2105
|
// but updating cursor in this scenario would cause a flicker.
|
|
2106
2106
|
if (prevDeltaRef.current != delta) {
|
|
2107
2107
|
prevDeltaRef.current = delta;
|
|
2108
|
-
if (!layoutChanged) {
|
|
2108
|
+
if (!layoutChanged && delta !== 0) {
|
|
2109
2109
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
2110
2110
|
// This mimics VS Code behavior.
|
|
2111
2111
|
if (isHorizontal) {
|
|
@@ -506,7 +506,7 @@ function handlePointerMove(event) {
|
|
|
506
506
|
|
|
507
507
|
// Edge case (see #340)
|
|
508
508
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
509
|
-
if (event.buttons === 0) {
|
|
509
|
+
if (isPointerDown && event.buttons === 0) {
|
|
510
510
|
isPointerDown = false;
|
|
511
511
|
updateResizeHandlerStates("up", event);
|
|
512
512
|
}
|
|
@@ -2081,7 +2081,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2081
2081
|
// but updating cursor in this scenario would cause a flicker.
|
|
2082
2082
|
if (prevDeltaRef.current != delta) {
|
|
2083
2083
|
prevDeltaRef.current = delta;
|
|
2084
|
-
if (!layoutChanged) {
|
|
2084
|
+
if (!layoutChanged && delta !== 0) {
|
|
2085
2085
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
2086
2086
|
// This mimics VS Code behavior.
|
|
2087
2087
|
if (isHorizontal) {
|
|
@@ -492,7 +492,7 @@ function handlePointerMove(event) {
|
|
|
492
492
|
|
|
493
493
|
// Edge case (see #340)
|
|
494
494
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
495
|
-
if (event.buttons === 0) {
|
|
495
|
+
if (isPointerDown && event.buttons === 0) {
|
|
496
496
|
isPointerDown = false;
|
|
497
497
|
updateResizeHandlerStates("up", event);
|
|
498
498
|
}
|
|
@@ -1873,7 +1873,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1873
1873
|
// but updating cursor in this scenario would cause a flicker.
|
|
1874
1874
|
if (prevDeltaRef.current != delta) {
|
|
1875
1875
|
prevDeltaRef.current = delta;
|
|
1876
|
-
if (!layoutChanged) {
|
|
1876
|
+
if (!layoutChanged && delta !== 0) {
|
|
1877
1877
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1878
1878
|
// This mimics VS Code behavior.
|
|
1879
1879
|
if (isHorizontal) {
|
|
@@ -468,7 +468,7 @@ function handlePointerMove(event) {
|
|
|
468
468
|
|
|
469
469
|
// Edge case (see #340)
|
|
470
470
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
471
|
-
if (event.buttons === 0) {
|
|
471
|
+
if (isPointerDown && event.buttons === 0) {
|
|
472
472
|
isPointerDown = false;
|
|
473
473
|
updateResizeHandlerStates("up", event);
|
|
474
474
|
}
|
|
@@ -1849,7 +1849,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1849
1849
|
// but updating cursor in this scenario would cause a flicker.
|
|
1850
1850
|
if (prevDeltaRef.current != delta) {
|
|
1851
1851
|
prevDeltaRef.current = delta;
|
|
1852
|
-
if (!layoutChanged) {
|
|
1852
|
+
if (!layoutChanged && delta !== 0) {
|
|
1853
1853
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1854
1854
|
// This mimics VS Code behavior.
|
|
1855
1855
|
if (isHorizontal) {
|
|
@@ -495,7 +495,7 @@ function handlePointerMove(event) {
|
|
|
495
495
|
|
|
496
496
|
// Edge case (see #340)
|
|
497
497
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
498
|
-
if (event.buttons === 0) {
|
|
498
|
+
if (isPointerDown && event.buttons === 0) {
|
|
499
499
|
isPointerDown = false;
|
|
500
500
|
updateResizeHandlerStates("up", event);
|
|
501
501
|
}
|
|
@@ -1970,7 +1970,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1970
1970
|
// but updating cursor in this scenario would cause a flicker.
|
|
1971
1971
|
if (prevDeltaRef.current != delta) {
|
|
1972
1972
|
prevDeltaRef.current = delta;
|
|
1973
|
-
if (!layoutChanged) {
|
|
1973
|
+
if (!layoutChanged && delta !== 0) {
|
|
1974
1974
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1975
1975
|
// This mimics VS Code behavior.
|
|
1976
1976
|
if (isHorizontal) {
|
|
@@ -481,7 +481,7 @@ function handlePointerMove(event) {
|
|
|
481
481
|
|
|
482
482
|
// Edge case (see #340)
|
|
483
483
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
484
|
-
if (event.buttons === 0) {
|
|
484
|
+
if (isPointerDown && event.buttons === 0) {
|
|
485
485
|
isPointerDown = false;
|
|
486
486
|
updateResizeHandlerStates("up", event);
|
|
487
487
|
}
|
|
@@ -1772,7 +1772,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1772
1772
|
// but updating cursor in this scenario would cause a flicker.
|
|
1773
1773
|
if (prevDeltaRef.current != delta) {
|
|
1774
1774
|
prevDeltaRef.current = delta;
|
|
1775
|
-
if (!layoutChanged) {
|
|
1775
|
+
if (!layoutChanged && delta !== 0) {
|
|
1776
1776
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1777
1777
|
// This mimics VS Code behavior.
|
|
1778
1778
|
if (isHorizontal) {
|
|
@@ -457,7 +457,7 @@ function handlePointerMove(event) {
|
|
|
457
457
|
|
|
458
458
|
// Edge case (see #340)
|
|
459
459
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
460
|
-
if (event.buttons === 0) {
|
|
460
|
+
if (isPointerDown && event.buttons === 0) {
|
|
461
461
|
isPointerDown = false;
|
|
462
462
|
updateResizeHandlerStates("up", event);
|
|
463
463
|
}
|
|
@@ -1748,7 +1748,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1748
1748
|
// but updating cursor in this scenario would cause a flicker.
|
|
1749
1749
|
if (prevDeltaRef.current != delta) {
|
|
1750
1750
|
prevDeltaRef.current = delta;
|
|
1751
|
-
if (!layoutChanged) {
|
|
1751
|
+
if (!layoutChanged && delta !== 0) {
|
|
1752
1752
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
1753
1753
|
// This mimics VS Code behavior.
|
|
1754
1754
|
if (isHorizontal) {
|
package/package.json
CHANGED
package/src/PanelGroup.ts
CHANGED
|
@@ -676,7 +676,7 @@ function PanelGroupWithForwardedRef({
|
|
|
676
676
|
if (prevDeltaRef.current != delta) {
|
|
677
677
|
prevDeltaRef.current = delta;
|
|
678
678
|
|
|
679
|
-
if (!layoutChanged) {
|
|
679
|
+
if (!layoutChanged && delta !== 0) {
|
|
680
680
|
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
681
681
|
// This mimics VS Code behavior.
|
|
682
682
|
if (isHorizontal) {
|
|
@@ -336,13 +336,32 @@ describe("PanelResizeHandle", () => {
|
|
|
336
336
|
expect(onDraggingLeft).toHaveBeenCalledWith(true);
|
|
337
337
|
|
|
338
338
|
expect(cursorUtils.resetGlobalCursorStyle).not.toHaveBeenCalled();
|
|
339
|
-
expect(cursorUtils.setGlobalCursorStyle).
|
|
339
|
+
expect(cursorUtils.setGlobalCursorStyle).toHaveBeenCalled();
|
|
340
|
+
|
|
341
|
+
onDraggingLeft.mockReset();
|
|
342
|
+
|
|
343
|
+
act(() => {
|
|
344
|
+
dispatchPointerEvent("pointermove", leftElement);
|
|
345
|
+
});
|
|
346
|
+
expect(onDraggingLeft).not.toHaveBeenCalled();
|
|
347
|
+
|
|
348
|
+
act(() => {
|
|
349
|
+
dispatchPointerEvent("pointerup", leftElement);
|
|
350
|
+
});
|
|
351
|
+
expect(onDraggingLeft).toHaveBeenCalledTimes(1);
|
|
352
|
+
expect(onDraggingLeft).toHaveBeenCalledWith(false);
|
|
353
|
+
|
|
354
|
+
onDraggingLeft.mockReset();
|
|
355
|
+
|
|
356
|
+
act(() => {
|
|
357
|
+
dispatchPointerEvent("pointermove", leftElement);
|
|
358
|
+
});
|
|
359
|
+
expect(onDraggingLeft).not.toHaveBeenCalled();
|
|
340
360
|
|
|
341
361
|
act(() => {
|
|
342
362
|
root.unmount();
|
|
343
363
|
});
|
|
344
364
|
|
|
345
365
|
expect(cursorUtils.resetGlobalCursorStyle).toHaveBeenCalled();
|
|
346
|
-
expect(cursorUtils.setGlobalCursorStyle).toHaveBeenCalledTimes(1);
|
|
347
366
|
});
|
|
348
367
|
});
|
|
@@ -109,7 +109,7 @@ function handlePointerMove(event: PointerEvent) {
|
|
|
109
109
|
|
|
110
110
|
// Edge case (see #340)
|
|
111
111
|
// Detect when the pointer has been released outside an iframe on a different domain
|
|
112
|
-
if (event.buttons === 0) {
|
|
112
|
+
if (isPointerDown && event.buttons === 0) {
|
|
113
113
|
isPointerDown = false;
|
|
114
114
|
|
|
115
115
|
updateResizeHandlerStates("up", event);
|