react-resizable-panels 0.0.39 → 0.0.41
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 -0
- package/README.md +2 -0
- package/dist/react-resizable-panels.d.ts +5 -28
- package/dist/react-resizable-panels.d.ts.map +1 -1
- package/dist/react-resizable-panels.js +53 -24
- package/dist/react-resizable-panels.js.map +1 -1
- package/dist/react-resizable-panels.module.js +53 -24
- package/dist/react-resizable-panels.module.js.map +1 -1
- package/package.json +2 -2
- package/src/Panel.ts +1 -1
- package/src/PanelGroup.ts +45 -9
- package/src/PanelResizeHandle.ts +4 -4
- package/src/hooks/useWindowSplitterBehavior.ts +7 -4
- package/src/index.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/assert.ts +10 -0
- package/src/utils/coordinates.ts +2 -2
- package/src/utils/debounce.ts +3 -1
- package/src/utils/group.ts +15 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
|
19
19
|
</PanelGroup>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
### If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/)
|
|
23
|
+
|
|
22
24
|
## Props
|
|
23
25
|
|
|
24
26
|
### `PanelGroup`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ElementType, ReactNode
|
|
1
|
+
import { CSSProperties, ElementType, ReactNode } from "react";
|
|
2
2
|
type Direction = "horizontal" | "vertical";
|
|
3
3
|
export type PanelGroupStorage = {
|
|
4
4
|
getItem(name: string): string | null;
|
|
@@ -8,19 +8,6 @@ type PanelGroupOnLayout = (sizes: number[]) => void;
|
|
|
8
8
|
type PanelOnCollapse = (collapsed: boolean) => void;
|
|
9
9
|
type PanelOnResize = (size: number) => void;
|
|
10
10
|
type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
|
|
11
|
-
type PanelData = {
|
|
12
|
-
callbacksRef: RefObject<{
|
|
13
|
-
onCollapse: PanelOnCollapse | null;
|
|
14
|
-
onResize: PanelOnResize | null;
|
|
15
|
-
}>;
|
|
16
|
-
collapsible: boolean;
|
|
17
|
-
defaultSize: number;
|
|
18
|
-
id: string;
|
|
19
|
-
maxSize: number;
|
|
20
|
-
minSize: number;
|
|
21
|
-
order: number | null;
|
|
22
|
-
};
|
|
23
|
-
type ResizeEvent = KeyboardEvent | MouseEvent | TouchEvent;
|
|
24
11
|
export type PanelProps = {
|
|
25
12
|
children?: ReactNode;
|
|
26
13
|
className?: string;
|
|
@@ -55,20 +42,10 @@ export type PanelGroupProps = {
|
|
|
55
42
|
style?: CSSProperties;
|
|
56
43
|
tagName?: ElementType;
|
|
57
44
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
expandPanel: (id: string) => void;
|
|
63
|
-
getPanelStyle: (id: string) => CSSProperties;
|
|
64
|
-
groupId: string;
|
|
65
|
-
registerPanel: (id: string, panel: PanelData) => void;
|
|
66
|
-
registerResizeHandle: (id: string) => import("types").ResizeHandler;
|
|
67
|
-
resizePanel: (id: string, percentage: number) => void;
|
|
68
|
-
startDragging: (id: string, event: ResizeEvent) => void;
|
|
69
|
-
stopDragging: () => void;
|
|
70
|
-
unregisterPanel: (id: string) => void;
|
|
71
|
-
}>>;
|
|
45
|
+
type ImperativePanelGroupHandle = {
|
|
46
|
+
setLayout: (panelSizes: number[]) => void;
|
|
47
|
+
};
|
|
48
|
+
export const PanelGroup: import("react").ForwardRefExoticComponent<PanelGroupProps & import("react").RefAttributes<ImperativePanelGroupHandle>>;
|
|
72
49
|
export type PanelResizeHandleProps = {
|
|
73
50
|
children?: ReactNode;
|
|
74
51
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AGEA,iBAAwB,YAAY,GAAG,UAAU,CAAC;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,WAAW,CAAC;CACvB,CAAC;AAEF,kCAAkC,EAChC,QAAe,EACf,SAAS,EAAE,kBAAuB,EAClC,QAAgB,EAChB,EAAE,EAAE,WAAkB,EACtB,UAAU,EACV,KAAK,EAAE,cAAmB,EAC1B,OAAO,EAAE,IAAY,GACtB,EAAE,sBAAsB,0FAoJxB","sources":["packages/react-resizable-panels/src/src/vendor/react.ts","packages/react-resizable-panels/src/src/hooks/useIsomorphicEffect.ts","packages/react-resizable-panels/src/src/hooks/useUniqueId.ts","packages/react-resizable-panels/src/src/types.ts","packages/react-resizable-panels/src/src/PanelContexts.ts","packages/react-resizable-panels/src/src/Panel.ts","packages/react-resizable-panels/src/src/utils/serialization.ts","packages/react-resizable-panels/src/src/constants.ts","packages/react-resizable-panels/src/src/utils/group.ts","packages/react-resizable-panels/src/src/utils/coordinates.ts","packages/react-resizable-panels/src/src/utils/assert.ts","packages/react-resizable-panels/src/src/hooks/useWindowSplitterBehavior.ts","packages/react-resizable-panels/src/src/utils/cursor.ts","packages/react-resizable-panels/src/src/utils/debounce.ts","packages/react-resizable-panels/src/src/utils/arrays.ts","packages/react-resizable-panels/src/src/PanelGroup.ts","packages/react-resizable-panels/src/src/PanelResizeHandle.ts","packages/react-resizable-panels/src/src/index.ts","packages/react-resizable-panels/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import { Panel } from \"./Panel\";\nimport { PanelGroup } from \"./PanelGroup\";\nimport { PanelResizeHandle } from \"./PanelResizeHandle\";\n\nimport type { ImperativePanelHandle, PanelProps } from \"./Panel\";\nimport type { ImperativePanelGroupHandle, PanelGroupProps } from \"./PanelGroup\";\nimport type { PanelResizeHandleProps } from \"./PanelResizeHandle\";\nimport type { PanelGroupStorage } from \"./types\";\n\nexport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n\n // TypeScript types\n ImperativePanelHandle,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n};\n"],"names":[],"version":3,"file":"react-resizable-panels.d.ts.map"}
|
|
@@ -223,34 +223,34 @@ function $cda3cc4b1114cf23$export$f50bae335f53943c(event, panels, idBefore, idAf
|
|
|
223
223
|
delta = delta < 0 ? baseSize - nextSize : nextSize - baseSize;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
let
|
|
227
|
-
let
|
|
226
|
+
let pivotId = delta < 0 ? idBefore : idAfter;
|
|
227
|
+
let index = panelsArray.findIndex((panel)=>panel.id === pivotId);
|
|
228
228
|
while(true){
|
|
229
|
-
const
|
|
230
|
-
const
|
|
229
|
+
const panel = panelsArray[index];
|
|
230
|
+
const baseSize = baseSizes[index];
|
|
231
231
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
if (
|
|
235
|
-
deltaApplied +=
|
|
236
|
-
nextSizes[
|
|
232
|
+
const nextSize = $cda3cc4b1114cf23$var$safeResizePanel(panel, 0 - deltaRemaining, baseSize, event);
|
|
233
|
+
if (baseSize !== nextSize) {
|
|
234
|
+
if (nextSize === 0 && baseSize > 0) panelSizeBeforeCollapse.set(panel.id, baseSize);
|
|
235
|
+
deltaApplied += baseSize - nextSize;
|
|
236
|
+
nextSizes[index] = nextSize;
|
|
237
237
|
if (deltaApplied.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)).localeCompare(Math.abs(delta).toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)), undefined, {
|
|
238
238
|
numeric: true
|
|
239
239
|
}) >= 0) break;
|
|
240
240
|
}
|
|
241
241
|
if (delta < 0) {
|
|
242
|
-
if (--
|
|
242
|
+
if (--index < 0) break;
|
|
243
243
|
} else {
|
|
244
|
-
if (++
|
|
244
|
+
if (++index >= panelsArray.length) break;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
// If we were unable to resize any of the panels panels, return the previous state.
|
|
248
248
|
// This will essentially bailout and ignore the "mousemove" event.
|
|
249
249
|
if (deltaApplied === 0) return baseSizes;
|
|
250
250
|
// Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
nextSizes[
|
|
251
|
+
pivotId = delta < 0 ? idAfter : idBefore;
|
|
252
|
+
index = panelsArray.findIndex((panel)=>panel.id === pivotId);
|
|
253
|
+
nextSizes[index] = baseSizes[index] + deltaApplied;
|
|
254
254
|
return nextSizes;
|
|
255
255
|
}
|
|
256
256
|
function $cda3cc4b1114cf23$export$b8e48269e4faa934(panelsArray, prevSizes, nextSizes) {
|
|
@@ -325,7 +325,7 @@ function $cda3cc4b1114cf23$export$68d3a33c21dfbe27(groupId, handleId, panelsArra
|
|
|
325
325
|
var _panelsArray_index, _panelsArray_;
|
|
326
326
|
const handle = $cda3cc4b1114cf23$export$2e27d3a347680388(handleId);
|
|
327
327
|
const handles = $cda3cc4b1114cf23$export$ae14931f0a0256a3(groupId);
|
|
328
|
-
const index = handles.indexOf(handle);
|
|
328
|
+
const index = handle ? handles.indexOf(handle) : -1;
|
|
329
329
|
var _panelsArray_index_id;
|
|
330
330
|
const idBefore = (_panelsArray_index_id = (_panelsArray_index = panelsArray[index]) === null || _panelsArray_index === void 0 ? void 0 : _panelsArray_index.id) !== null && _panelsArray_index_id !== void 0 ? _panelsArray_index_id : null;
|
|
331
331
|
var _panelsArray__id;
|
|
@@ -336,7 +336,14 @@ function $cda3cc4b1114cf23$export$68d3a33c21dfbe27(groupId, handleId, panelsArra
|
|
|
336
336
|
];
|
|
337
337
|
}
|
|
338
338
|
function $cda3cc4b1114cf23$export$a861c0ad45885494(panels) {
|
|
339
|
-
return Array.from(panels.values()).sort((
|
|
339
|
+
return Array.from(panels.values()).sort((panelA, panelB)=>{
|
|
340
|
+
const orderA = panelA.order;
|
|
341
|
+
const orderB = panelB.order;
|
|
342
|
+
if (orderA == null && orderB == null) return 0;
|
|
343
|
+
else if (orderA == null) return -1;
|
|
344
|
+
else if (orderB == null) return 1;
|
|
345
|
+
else return orderA - orderB;
|
|
346
|
+
});
|
|
340
347
|
}
|
|
341
348
|
function $cda3cc4b1114cf23$var$safeResizePanel(panel, delta, prevSize, event) {
|
|
342
349
|
const nextSizeUnsafe = prevSize + delta;
|
|
@@ -437,6 +444,14 @@ function $47eee9224cfec8e8$export$c4dfce035d43d1e0(event) {
|
|
|
437
444
|
|
|
438
445
|
|
|
439
446
|
|
|
447
|
+
function $3b727a2145ecd6f8$export$a7a9523472993e97(expectedCondition, message = "Assertion failed!") {
|
|
448
|
+
if (!expectedCondition) {
|
|
449
|
+
console.error(message);
|
|
450
|
+
throw Error(message);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
|
|
440
455
|
function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committedValuesRef , groupId: groupId , panels: panels , setSizes: setSizes , sizes: sizes , panelSizeBeforeCollapse: panelSizeBeforeCollapse }) {
|
|
441
456
|
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
442
457
|
const { direction: direction , panels: panels } = committedValuesRef.current;
|
|
@@ -535,6 +550,7 @@ function $a695670cc57a5969$export$33b0bea6ac3ffb03({ disabled: disabled , handle
|
|
|
535
550
|
event.preventDefault();
|
|
536
551
|
const handles = (0, $cda3cc4b1114cf23$export$8d0cd3c32ddc045e)();
|
|
537
552
|
const index = (0, $cda3cc4b1114cf23$export$96a40be80fb6c3c8)(handleId);
|
|
553
|
+
(0, $3b727a2145ecd6f8$export$a7a9523472993e97)(index !== null);
|
|
538
554
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
539
555
|
const nextHandle = handles[nextIndex];
|
|
540
556
|
nextHandle.focus();
|
|
@@ -594,7 +610,7 @@ function $08745f7373322b05$export$d395b5dfd066a659(state) {
|
|
|
594
610
|
function $2e8572579e31d898$export$2e2bcd8739ae039(callback, durationMs = 10) {
|
|
595
611
|
let timeoutId = null;
|
|
596
612
|
let callable = (...args)=>{
|
|
597
|
-
clearTimeout(timeoutId);
|
|
613
|
+
if (timeoutId !== null) clearTimeout(timeoutId);
|
|
598
614
|
timeoutId = setTimeout(()=>{
|
|
599
615
|
callback(...args);
|
|
600
616
|
}, durationMs);
|
|
@@ -612,6 +628,7 @@ function $d31ef7445a11a6c5$export$b141efd0b0fb9174(arrayA, arrayB) {
|
|
|
612
628
|
}
|
|
613
629
|
|
|
614
630
|
|
|
631
|
+
|
|
615
632
|
// Limit the frequency of localStorage updates.
|
|
616
633
|
const $cec4cafe75f3db78$var$savePanelGroupLayoutDebounced = (0, $2e8572579e31d898$export$2e2bcd8739ae039)((0, $f9cb001fbb908626$export$af183b313c61be4f), 100);
|
|
617
634
|
function $cec4cafe75f3db78$var$throwServerError() {
|
|
@@ -621,7 +638,7 @@ const $cec4cafe75f3db78$var$defaultStorage = {
|
|
|
621
638
|
getItem: typeof localStorage !== "undefined" ? (name)=>localStorage.getItem(name) : $cec4cafe75f3db78$var$throwServerError,
|
|
622
639
|
setItem: typeof localStorage !== "undefined" ? (name, value)=>localStorage.setItem(name, value) : $cec4cafe75f3db78$var$throwServerError
|
|
623
640
|
};
|
|
624
|
-
function $cec4cafe75f3db78$
|
|
641
|
+
function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , disablePointerEventsDuringResize: disablePointerEventsDuringResize = false , forwardedRef: forwardedRef , id: idFromProps = null , onLayout: onLayout , storage: storage = $cec4cafe75f3db78$var$defaultStorage , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
625
642
|
const groupId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
626
643
|
const [activeHandleId, setActiveHandleId] = (0, $6e687094f9ca8395$export$60241385465d0a34)(null);
|
|
627
644
|
const [panels, setPanels] = (0, $6e687094f9ca8395$export$60241385465d0a34)(new Map());
|
|
@@ -647,6 +664,13 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
647
664
|
panels: panels,
|
|
648
665
|
sizes: sizes
|
|
649
666
|
});
|
|
667
|
+
(0, $6e687094f9ca8395$export$d5a552a76deda3c2)(forwardedRef, ()=>({
|
|
668
|
+
setLayout: (sizes)=>{
|
|
669
|
+
const total = sizes.reduce((accumulated, current)=>accumulated + current, 0);
|
|
670
|
+
(0, $3b727a2145ecd6f8$export$a7a9523472993e97)(total === 100, "Panel sizes must add up to 100%");
|
|
671
|
+
setSizes(sizes);
|
|
672
|
+
}
|
|
673
|
+
}), []);
|
|
650
674
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
651
675
|
committedValuesRef.current.direction = direction;
|
|
652
676
|
committedValuesRef.current.panels = panels;
|
|
@@ -694,14 +718,14 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
694
718
|
return;
|
|
695
719
|
// If this panel has been configured to persist sizing information,
|
|
696
720
|
// default size should be restored from local storage if possible.
|
|
697
|
-
let defaultSizes =
|
|
721
|
+
let defaultSizes = null;
|
|
698
722
|
if (autoSaveId) {
|
|
699
723
|
const panelsArray = (0, $cda3cc4b1114cf23$export$a861c0ad45885494)(panels);
|
|
700
724
|
defaultSizes = (0, $f9cb001fbb908626$export$9c80c6617f0386da)(autoSaveId, panelsArray, storage);
|
|
701
725
|
}
|
|
702
726
|
if (defaultSizes != null) setSizes(defaultSizes);
|
|
703
727
|
else {
|
|
704
|
-
const
|
|
728
|
+
const panelsArray = (0, $cda3cc4b1114cf23$export$a861c0ad45885494)(panels);
|
|
705
729
|
let panelsWithNullDefaultSize = 0;
|
|
706
730
|
let totalDefaultSize = 0;
|
|
707
731
|
let totalMinSize = 0;
|
|
@@ -709,14 +733,14 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
709
733
|
// Implicit default size calculations below do not account for inferred min/max size values.
|
|
710
734
|
// e.g. if Panel A has a maxSize of 40 then Panels A and B can't both have an implicit default size of 50.
|
|
711
735
|
// For now, these logic edge cases are left to the user to handle via props.
|
|
712
|
-
|
|
736
|
+
panelsArray.forEach((panel)=>{
|
|
713
737
|
totalMinSize += panel.minSize;
|
|
714
738
|
if (panel.defaultSize === null) panelsWithNullDefaultSize++;
|
|
715
739
|
else totalDefaultSize += panel.defaultSize;
|
|
716
740
|
});
|
|
717
741
|
if (totalDefaultSize > 100) throw new Error(`The sum of the defaultSize of all panels in a group cannot exceed 100.`);
|
|
718
742
|
else if (totalMinSize > 100) throw new Error(`The sum of the minSize of all panels in a group cannot exceed 100.`);
|
|
719
|
-
setSizes(
|
|
743
|
+
setSizes(panelsArray.map((panel)=>{
|
|
720
744
|
if (panel.defaultSize === null) return (100 - totalDefaultSize) / panelsWithNullDefaultSize;
|
|
721
745
|
return panel.defaultSize;
|
|
722
746
|
}));
|
|
@@ -954,10 +978,15 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
954
978
|
value: context
|
|
955
979
|
});
|
|
956
980
|
}
|
|
981
|
+
const $cec4cafe75f3db78$export$1d05749f6f573bb = (0, $6e687094f9ca8395$export$257a8862b851cb5b)((props, ref)=>(0, $6e687094f9ca8395$export$c8a8987d4410bf2d)($cec4cafe75f3db78$var$PanelGroupWithForwardedRef, {
|
|
982
|
+
...props,
|
|
983
|
+
forwardedRef: ref
|
|
984
|
+
}));
|
|
957
985
|
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
958
986
|
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
959
987
|
// See github.com/parcel-bundler/parcel/issues/8724
|
|
960
|
-
$cec4cafe75f3db78$
|
|
988
|
+
$cec4cafe75f3db78$var$PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
989
|
+
$cec4cafe75f3db78$export$1d05749f6f573bb.displayName = "forwardRef(PanelGroup)";
|
|
961
990
|
|
|
962
991
|
|
|
963
992
|
|
|
@@ -965,7 +994,7 @@ $cec4cafe75f3db78$export$1d05749f6f573bb.displayName = "PanelGroup";
|
|
|
965
994
|
|
|
966
995
|
|
|
967
996
|
|
|
968
|
-
function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null , className: classNameFromProps = "" , disabled: disabled = false , id: idFromProps = null , onDragging: onDragging
|
|
997
|
+
function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null , className: classNameFromProps = "" , disabled: disabled = false , id: idFromProps = null , onDragging: onDragging , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
969
998
|
const divElementRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(null);
|
|
970
999
|
// Use a ref to guard against users passing inline props
|
|
971
1000
|
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|