react-resizable-panels 0.0.37 → 0.0.39
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/.eslintrc.json +22 -0
- package/CHANGELOG.md +8 -0
- package/dist/react-resizable-panels.d.ts +1 -1
- package/dist/react-resizable-panels.d.ts.map +1 -1
- package/dist/react-resizable-panels.js +83 -54
- package/dist/react-resizable-panels.js.map +1 -1
- package/dist/react-resizable-panels.module.js +84 -55
- package/dist/react-resizable-panels.module.js.map +1 -1
- package/package.json +5 -1
- package/src/Panel.ts +1 -1
- package/src/PanelContexts.ts +1 -1
- package/src/PanelGroup.ts +4 -4
- package/src/PanelResizeHandle.ts +21 -9
- package/src/hooks/useIsomorphicEffect.ts +1 -1
- package/src/hooks/useUniqueId.ts +5 -2
- package/src/hooks/useWindowSplitterBehavior.ts +23 -2
- package/src/types.ts +1 -1
- package/src/vendor/react.ts +61 -0
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as $jhddX$react from "react";
|
|
2
|
+
|
|
3
|
+
// This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
|
|
4
|
+
// and limitations with ParcelJS parsing of the useId workaround (used below).
|
|
5
|
+
// For the time being, all react-resizable-panels must import "react" with the "* as React" syntax.
|
|
6
|
+
// To avoid mistakes, we use the ESLint "no-restricted-imports" to prevent "react" imports except in this file.
|
|
7
|
+
// See https://github.com/bvaughn/react-resizable-panels/issues/118
|
|
8
|
+
// eslint-disable-next-line no-restricted-imports
|
|
9
|
+
|
|
10
|
+
const { createElement: $ef07efbe5fa7d87e$export$c8a8987d4410bf2d , createContext: $ef07efbe5fa7d87e$export$fd42f52fd3ae1109 , forwardRef: $ef07efbe5fa7d87e$export$257a8862b851cb5b , useCallback: $ef07efbe5fa7d87e$export$35808ee640e87ca7 , useContext: $ef07efbe5fa7d87e$export$fae74005e78b1a27 , useEffect: $ef07efbe5fa7d87e$export$6d9c69b0de29b591 , useImperativeHandle: $ef07efbe5fa7d87e$export$d5a552a76deda3c2 , useLayoutEffect: $ef07efbe5fa7d87e$export$e5c5a5f917a5871c , useMemo: $ef07efbe5fa7d87e$export$1538c33de8887b59 , useRef: $ef07efbe5fa7d87e$export$b8f5890fc79d6aca , useState: $ef07efbe5fa7d87e$export$60241385465d0a34 } = $jhddX$react;
|
|
11
|
+
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
12
|
+
const $ef07efbe5fa7d87e$export$f680877a34711e37 = $jhddX$react["useId".toString()];
|
|
2
13
|
|
|
3
14
|
|
|
4
15
|
|
|
5
16
|
const $3f95d3e171760903$var$canUseEffectHooks = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
6
|
-
const $3f95d3e171760903$var$useIsomorphicLayoutEffect = $3f95d3e171760903$var$canUseEffectHooks ? (0, $
|
|
17
|
+
const $3f95d3e171760903$var$useIsomorphicLayoutEffect = $3f95d3e171760903$var$canUseEffectHooks ? (0, $ef07efbe5fa7d87e$export$e5c5a5f917a5871c) : ()=>{};
|
|
7
18
|
var $3f95d3e171760903$export$2e2bcd8739ae039 = $3f95d3e171760903$var$useIsomorphicLayoutEffect;
|
|
8
19
|
|
|
9
20
|
|
|
10
21
|
|
|
22
|
+
const $e504a2438473eda9$var$wrappedUseId = typeof (0, $ef07efbe5fa7d87e$export$f680877a34711e37) === "function" ? (0, $ef07efbe5fa7d87e$export$f680877a34711e37) : ()=>null;
|
|
11
23
|
let $e504a2438473eda9$var$counter = 0;
|
|
12
24
|
function $e504a2438473eda9$export$2e2bcd8739ae039(idFromParams = null) {
|
|
13
|
-
const idFromUseId =
|
|
14
|
-
const idRef = (0, $
|
|
25
|
+
const idFromUseId = $e504a2438473eda9$var$wrappedUseId();
|
|
26
|
+
const idRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(idFromParams || idFromUseId || null);
|
|
15
27
|
if (idRef.current === null) idRef.current = "" + $e504a2438473eda9$var$counter++;
|
|
16
28
|
return idRef.current;
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
|
|
20
32
|
|
|
21
|
-
const $af466b485b9d515d$export$7d8c6d083caec74a = (0, $
|
|
33
|
+
const $af466b485b9d515d$export$7d8c6d083caec74a = (0, $ef07efbe5fa7d87e$export$fd42f52fd3ae1109)(null);
|
|
22
34
|
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
23
35
|
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
24
36
|
// See github.com/parcel-bundler/parcel/issues/8724
|
|
@@ -26,16 +38,16 @@ $af466b485b9d515d$export$7d8c6d083caec74a.displayName = "PanelGroupContext";
|
|
|
26
38
|
|
|
27
39
|
|
|
28
40
|
function $c33df6d7c39fd3ee$var$PanelWithForwardedRef({ children: children = null , className: classNameFromProps = "" , collapsible: collapsible = false , defaultSize: defaultSize = null , forwardedRef: forwardedRef , id: idFromProps = null , maxSize: maxSize = 100 , minSize: minSize = 10 , onCollapse: onCollapse = null , onResize: onResize = null , order: order = null , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
29
|
-
const context = (0, $
|
|
41
|
+
const context = (0, $ef07efbe5fa7d87e$export$fae74005e78b1a27)((0, $af466b485b9d515d$export$7d8c6d083caec74a));
|
|
30
42
|
if (context === null) throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
31
43
|
const panelId = (0, $e504a2438473eda9$export$2e2bcd8739ae039)(idFromProps);
|
|
32
44
|
const { collapsePanel: collapsePanel , expandPanel: expandPanel , getPanelStyle: getPanelStyle , registerPanel: registerPanel , resizePanel: resizePanel , unregisterPanel: unregisterPanel } = context;
|
|
33
45
|
// Use a ref to guard against users passing inline props
|
|
34
|
-
const callbacksRef = (0, $
|
|
46
|
+
const callbacksRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)({
|
|
35
47
|
onCollapse: onCollapse,
|
|
36
48
|
onResize: onResize
|
|
37
49
|
});
|
|
38
|
-
(0, $
|
|
50
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
39
51
|
callbacksRef.current.onCollapse = onCollapse;
|
|
40
52
|
callbacksRef.current.onResize = onResize;
|
|
41
53
|
});
|
|
@@ -74,13 +86,13 @@ function $c33df6d7c39fd3ee$var$PanelWithForwardedRef({ children: children = null
|
|
|
74
86
|
unregisterPanel
|
|
75
87
|
]);
|
|
76
88
|
const style = getPanelStyle(panelId);
|
|
77
|
-
const committedValuesRef = (0, $
|
|
89
|
+
const committedValuesRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)({
|
|
78
90
|
size: $c33df6d7c39fd3ee$var$parseSizeFromStyle(style)
|
|
79
91
|
});
|
|
80
92
|
(0, $3f95d3e171760903$export$2e2bcd8739ae039)(()=>{
|
|
81
93
|
committedValuesRef.current.size = $c33df6d7c39fd3ee$var$parseSizeFromStyle(style);
|
|
82
94
|
});
|
|
83
|
-
(0, $
|
|
95
|
+
(0, $ef07efbe5fa7d87e$export$d5a552a76deda3c2)(forwardedRef, ()=>({
|
|
84
96
|
collapse: ()=>collapsePanel(panelId),
|
|
85
97
|
expand: ()=>expandPanel(panelId),
|
|
86
98
|
getCollapsed () {
|
|
@@ -96,7 +108,7 @@ function $c33df6d7c39fd3ee$var$PanelWithForwardedRef({ children: children = null
|
|
|
96
108
|
panelId,
|
|
97
109
|
resizePanel
|
|
98
110
|
]);
|
|
99
|
-
return (0, $
|
|
111
|
+
return (0, $ef07efbe5fa7d87e$export$c8a8987d4410bf2d)(Type, {
|
|
100
112
|
children: children,
|
|
101
113
|
className: classNameFromProps,
|
|
102
114
|
"data-panel": "",
|
|
@@ -110,7 +122,7 @@ function $c33df6d7c39fd3ee$var$PanelWithForwardedRef({ children: children = null
|
|
|
110
122
|
}
|
|
111
123
|
});
|
|
112
124
|
}
|
|
113
|
-
const $c33df6d7c39fd3ee$export$2ddb90ad54e5f587 = (0, $
|
|
125
|
+
const $c33df6d7c39fd3ee$export$2ddb90ad54e5f587 = (0, $ef07efbe5fa7d87e$export$257a8862b851cb5b)((props, ref)=>(0, $ef07efbe5fa7d87e$export$c8a8987d4410bf2d)($c33df6d7c39fd3ee$var$PanelWithForwardedRef, {
|
|
114
126
|
...props,
|
|
115
127
|
forwardedRef: ref
|
|
116
128
|
}));
|
|
@@ -419,7 +431,7 @@ function $8f51c2d77bf1da88$export$c4dfce035d43d1e0(event) {
|
|
|
419
431
|
|
|
420
432
|
|
|
421
433
|
function $4a90471e7083b52f$export$d9fcbe062527d159({ committedValuesRef: committedValuesRef , groupId: groupId , panels: panels , setSizes: setSizes , sizes: sizes , panelSizeBeforeCollapse: panelSizeBeforeCollapse }) {
|
|
422
|
-
(0, $
|
|
434
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
423
435
|
const { direction: direction , panels: panels } = committedValuesRef.current;
|
|
424
436
|
const groupElement = (0, $d6f7e4c3aa9e02d7$export$5e67632cf3550a9c)(groupId);
|
|
425
437
|
const { height: height , width: width } = groupElement.getBoundingClientRect();
|
|
@@ -450,9 +462,11 @@ function $4a90471e7083b52f$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
450
462
|
handle.setAttribute("aria-valuemin", "" + Math.round(ariaValueMin));
|
|
451
463
|
handle.setAttribute("aria-valuenow", "" + Math.round(parseInt(flexGrow)));
|
|
452
464
|
const onKeyDown = (event)=>{
|
|
465
|
+
if (event.defaultPrevented) return;
|
|
453
466
|
switch(event.key){
|
|
454
467
|
case "Enter":
|
|
455
468
|
{
|
|
469
|
+
event.preventDefault();
|
|
456
470
|
const index = panelsArray.findIndex((panel)=>panel.id === idBefore);
|
|
457
471
|
if (index >= 0) {
|
|
458
472
|
const panelData = panelsArray[index];
|
|
@@ -484,17 +498,21 @@ function $4a90471e7083b52f$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
484
498
|
cleanupFunctions.forEach((cleanupFunction)=>cleanupFunction());
|
|
485
499
|
};
|
|
486
500
|
}, [
|
|
501
|
+
committedValuesRef,
|
|
487
502
|
groupId,
|
|
488
503
|
panels,
|
|
504
|
+
panelSizeBeforeCollapse,
|
|
505
|
+
setSizes,
|
|
489
506
|
sizes
|
|
490
507
|
]);
|
|
491
508
|
}
|
|
492
509
|
function $4a90471e7083b52f$export$33b0bea6ac3ffb03({ disabled: disabled , handleId: handleId , resizeHandler: resizeHandler }) {
|
|
493
|
-
(0, $
|
|
510
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
494
511
|
if (disabled || resizeHandler == null) return;
|
|
495
512
|
const handleElement = (0, $d6f7e4c3aa9e02d7$export$2e27d3a347680388)(handleId);
|
|
496
513
|
if (handleElement == null) return;
|
|
497
514
|
const onKeyDown = (event)=>{
|
|
515
|
+
if (event.defaultPrevented) return;
|
|
498
516
|
switch(event.key){
|
|
499
517
|
case "ArrowDown":
|
|
500
518
|
case "ArrowLeft":
|
|
@@ -502,10 +520,12 @@ function $4a90471e7083b52f$export$33b0bea6ac3ffb03({ disabled: disabled , handle
|
|
|
502
520
|
case "ArrowUp":
|
|
503
521
|
case "End":
|
|
504
522
|
case "Home":
|
|
523
|
+
event.preventDefault();
|
|
505
524
|
resizeHandler(event);
|
|
506
525
|
break;
|
|
507
526
|
case "F6":
|
|
508
527
|
{
|
|
528
|
+
event.preventDefault();
|
|
509
529
|
const handles = (0, $d6f7e4c3aa9e02d7$export$8d0cd3c32ddc045e)();
|
|
510
530
|
const index = (0, $d6f7e4c3aa9e02d7$export$96a40be80fb6c3c8)(handleId);
|
|
511
531
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
@@ -596,26 +616,26 @@ const $3daa5d4c086ea816$var$defaultStorage = {
|
|
|
596
616
|
};
|
|
597
617
|
function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , disablePointerEventsDuringResize: disablePointerEventsDuringResize = false , id: idFromProps = null , onLayout: onLayout = null , storage: storage = $3daa5d4c086ea816$var$defaultStorage , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
598
618
|
const groupId = (0, $e504a2438473eda9$export$2e2bcd8739ae039)(idFromProps);
|
|
599
|
-
const [activeHandleId, setActiveHandleId] = (0, $
|
|
600
|
-
const [panels, setPanels] = (0, $
|
|
619
|
+
const [activeHandleId, setActiveHandleId] = (0, $ef07efbe5fa7d87e$export$60241385465d0a34)(null);
|
|
620
|
+
const [panels, setPanels] = (0, $ef07efbe5fa7d87e$export$60241385465d0a34)(new Map());
|
|
601
621
|
// When resizing is done via mouse/touch event–
|
|
602
622
|
// We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
|
|
603
623
|
// This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
|
|
604
|
-
const initialDragStateRef = (0, $
|
|
624
|
+
const initialDragStateRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(null);
|
|
605
625
|
// Use a ref to guard against users passing inline props
|
|
606
|
-
const callbacksRef = (0, $
|
|
626
|
+
const callbacksRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)({
|
|
607
627
|
onLayout: onLayout
|
|
608
628
|
});
|
|
609
|
-
(0, $
|
|
629
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
610
630
|
callbacksRef.current.onLayout = onLayout;
|
|
611
631
|
});
|
|
612
632
|
// 0-1 values representing the relative size of each panel.
|
|
613
|
-
const [sizes, setSizes] = (0, $
|
|
633
|
+
const [sizes, setSizes] = (0, $ef07efbe5fa7d87e$export$60241385465d0a34)([]);
|
|
614
634
|
// Used to support imperative collapse/expand API.
|
|
615
|
-
const panelSizeBeforeCollapse = (0, $
|
|
616
|
-
const prevDeltaRef = (0, $
|
|
635
|
+
const panelSizeBeforeCollapse = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(new Map());
|
|
636
|
+
const prevDeltaRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(0);
|
|
617
637
|
// Store committed values to avoid unnecessarily re-running memoization/effects functions.
|
|
618
|
-
const committedValuesRef = (0, $
|
|
638
|
+
const committedValuesRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)({
|
|
619
639
|
direction: direction,
|
|
620
640
|
panels: panels,
|
|
621
641
|
sizes: sizes
|
|
@@ -634,7 +654,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
634
654
|
panelSizeBeforeCollapse: panelSizeBeforeCollapse
|
|
635
655
|
});
|
|
636
656
|
// Notify external code when sizes have changed.
|
|
637
|
-
(0, $
|
|
657
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
638
658
|
const { onLayout: onLayout } = callbacksRef.current;
|
|
639
659
|
if (onLayout) {
|
|
640
660
|
const { sizes: sizes } = committedValuesRef.current;
|
|
@@ -646,7 +666,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
646
666
|
]);
|
|
647
667
|
// Notify Panel listeners about their initial sizes and collapsed state after mount.
|
|
648
668
|
// Subsequent changes will be called by the resizeHandler.
|
|
649
|
-
const didNotifyCallbacksAfterMountRef = (0, $
|
|
669
|
+
const didNotifyCallbacksAfterMountRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(false);
|
|
650
670
|
(0, $3f95d3e171760903$export$2e2bcd8739ae039)(()=>{
|
|
651
671
|
if (didNotifyCallbacksAfterMountRef.current) return;
|
|
652
672
|
const { panels: panels , sizes: sizes } = committedValuesRef.current;
|
|
@@ -696,9 +716,10 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
696
716
|
}
|
|
697
717
|
}, [
|
|
698
718
|
autoSaveId,
|
|
699
|
-
panels
|
|
719
|
+
panels,
|
|
720
|
+
storage
|
|
700
721
|
]);
|
|
701
|
-
(0, $
|
|
722
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
702
723
|
// If this panel has been configured to persist sizing information, save sizes to local storage.
|
|
703
724
|
if (autoSaveId) {
|
|
704
725
|
if (sizes.length === 0 || sizes.length !== panels.size) return;
|
|
@@ -708,9 +729,10 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
708
729
|
}, [
|
|
709
730
|
autoSaveId,
|
|
710
731
|
panels,
|
|
711
|
-
sizes
|
|
732
|
+
sizes,
|
|
733
|
+
storage
|
|
712
734
|
]);
|
|
713
|
-
const getPanelStyle = (0, $
|
|
735
|
+
const getPanelStyle = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id)=>{
|
|
714
736
|
const { panels: panels } = committedValuesRef.current;
|
|
715
737
|
// Before mounting, Panels will not yet have registered themselves.
|
|
716
738
|
// This includes server rendering.
|
|
@@ -735,10 +757,10 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
735
757
|
};
|
|
736
758
|
}, [
|
|
737
759
|
activeHandleId,
|
|
738
|
-
|
|
760
|
+
disablePointerEventsDuringResize,
|
|
739
761
|
sizes
|
|
740
762
|
]);
|
|
741
|
-
const registerPanel = (0, $
|
|
763
|
+
const registerPanel = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id, panel)=>{
|
|
742
764
|
setPanels((prevPanels)=>{
|
|
743
765
|
if (prevPanels.has(id)) return prevPanels;
|
|
744
766
|
const nextPanels = new Map(prevPanels);
|
|
@@ -746,7 +768,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
746
768
|
return nextPanels;
|
|
747
769
|
});
|
|
748
770
|
}, []);
|
|
749
|
-
const registerResizeHandle = (0, $
|
|
771
|
+
const registerResizeHandle = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((handleId)=>{
|
|
750
772
|
const resizeHandler = (event)=>{
|
|
751
773
|
event.preventDefault();
|
|
752
774
|
const { direction: direction , panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
@@ -789,7 +811,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
789
811
|
}, [
|
|
790
812
|
groupId
|
|
791
813
|
]);
|
|
792
|
-
const unregisterPanel = (0, $
|
|
814
|
+
const unregisterPanel = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id)=>{
|
|
793
815
|
setPanels((prevPanels)=>{
|
|
794
816
|
if (!prevPanels.has(id)) return prevPanels;
|
|
795
817
|
const nextPanels = new Map(prevPanels);
|
|
@@ -797,7 +819,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
797
819
|
return nextPanels;
|
|
798
820
|
});
|
|
799
821
|
}, []);
|
|
800
|
-
const collapsePanel = (0, $
|
|
822
|
+
const collapsePanel = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id)=>{
|
|
801
823
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
802
824
|
const panel = panels.get(id);
|
|
803
825
|
if (panel == null || !panel.collapsible) return;
|
|
@@ -819,7 +841,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
819
841
|
setSizes(nextSizes);
|
|
820
842
|
}
|
|
821
843
|
}, []);
|
|
822
|
-
const expandPanel = (0, $
|
|
844
|
+
const expandPanel = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id)=>{
|
|
823
845
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
824
846
|
const panel = panels.get(id);
|
|
825
847
|
if (panel == null) return;
|
|
@@ -842,7 +864,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
842
864
|
setSizes(nextSizes);
|
|
843
865
|
}
|
|
844
866
|
}, []);
|
|
845
|
-
const resizePanel = (0, $
|
|
867
|
+
const resizePanel = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)((id, nextSize)=>{
|
|
846
868
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
847
869
|
const panel = panels.get(id);
|
|
848
870
|
if (panel == null) return;
|
|
@@ -864,7 +886,7 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
864
886
|
setSizes(nextSizes);
|
|
865
887
|
}
|
|
866
888
|
}, []);
|
|
867
|
-
const context = (0, $
|
|
889
|
+
const context = (0, $ef07efbe5fa7d87e$export$1538c33de8887b59)(()=>({
|
|
868
890
|
activeHandleId: activeHandleId,
|
|
869
891
|
collapsePanel: collapsePanel,
|
|
870
892
|
direction: direction,
|
|
@@ -910,8 +932,8 @@ function $3daa5d4c086ea816$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
910
932
|
overflow: "hidden",
|
|
911
933
|
width: "100%"
|
|
912
934
|
};
|
|
913
|
-
return (0, $
|
|
914
|
-
children: (0, $
|
|
935
|
+
return (0, $ef07efbe5fa7d87e$export$c8a8987d4410bf2d)((0, $af466b485b9d515d$export$7d8c6d083caec74a).Provider, {
|
|
936
|
+
children: (0, $ef07efbe5fa7d87e$export$c8a8987d4410bf2d)(Type, {
|
|
915
937
|
children: children,
|
|
916
938
|
className: classNameFromProps,
|
|
917
939
|
"data-panel-group": "",
|
|
@@ -937,22 +959,22 @@ $3daa5d4c086ea816$export$1d05749f6f573bb.displayName = "PanelGroup";
|
|
|
937
959
|
|
|
938
960
|
|
|
939
961
|
function $971f2c37f9d2b98e$export$8829ecf6b6b15484({ children: children = null , className: classNameFromProps = "" , disabled: disabled = false , id: idFromProps = null , onDragging: onDragging = null , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
940
|
-
const divElementRef = (0, $
|
|
962
|
+
const divElementRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)(null);
|
|
941
963
|
// Use a ref to guard against users passing inline props
|
|
942
|
-
const callbacksRef = (0, $
|
|
964
|
+
const callbacksRef = (0, $ef07efbe5fa7d87e$export$b8f5890fc79d6aca)({
|
|
943
965
|
onDragging: onDragging
|
|
944
966
|
});
|
|
945
|
-
(0, $
|
|
967
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
946
968
|
callbacksRef.current.onDragging = onDragging;
|
|
947
969
|
});
|
|
948
|
-
const panelGroupContext = (0, $
|
|
970
|
+
const panelGroupContext = (0, $ef07efbe5fa7d87e$export$fae74005e78b1a27)((0, $af466b485b9d515d$export$7d8c6d083caec74a));
|
|
949
971
|
if (panelGroupContext === null) throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
950
972
|
const { activeHandleId: activeHandleId , direction: direction , groupId: groupId , registerResizeHandle: registerResizeHandle , startDragging: startDragging , stopDragging: stopDragging } = panelGroupContext;
|
|
951
973
|
const resizeHandleId = (0, $e504a2438473eda9$export$2e2bcd8739ae039)(idFromProps);
|
|
952
974
|
const isDragging = activeHandleId === resizeHandleId;
|
|
953
|
-
const [isFocused, setIsFocused] = (0, $
|
|
954
|
-
const [resizeHandler, setResizeHandler] = (0, $
|
|
955
|
-
const stopDraggingAndBlur = (0, $
|
|
975
|
+
const [isFocused, setIsFocused] = (0, $ef07efbe5fa7d87e$export$60241385465d0a34)(false);
|
|
976
|
+
const [resizeHandler, setResizeHandler] = (0, $ef07efbe5fa7d87e$export$60241385465d0a34)(null);
|
|
977
|
+
const stopDraggingAndBlur = (0, $ef07efbe5fa7d87e$export$35808ee640e87ca7)(()=>{
|
|
956
978
|
// Clicking on the drag handle shouldn't leave it focused;
|
|
957
979
|
// That would cause the PanelGroup to think it was still active.
|
|
958
980
|
const div = divElementRef.current;
|
|
@@ -963,7 +985,7 @@ function $971f2c37f9d2b98e$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
963
985
|
}, [
|
|
964
986
|
stopDragging
|
|
965
987
|
]);
|
|
966
|
-
(0, $
|
|
988
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
967
989
|
if (disabled) setResizeHandler(null);
|
|
968
990
|
else {
|
|
969
991
|
const resizeHandler = registerResizeHandle(resizeHandleId);
|
|
@@ -974,20 +996,27 @@ function $971f2c37f9d2b98e$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
974
996
|
resizeHandleId,
|
|
975
997
|
registerResizeHandle
|
|
976
998
|
]);
|
|
977
|
-
(0, $
|
|
999
|
+
(0, $ef07efbe5fa7d87e$export$6d9c69b0de29b591)(()=>{
|
|
978
1000
|
if (disabled || resizeHandler == null || !isDragging) return;
|
|
979
1001
|
const onMove = (event)=>{
|
|
980
1002
|
resizeHandler(event);
|
|
981
1003
|
};
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1004
|
+
const onMouseLeave = (event)=>{
|
|
1005
|
+
resizeHandler(event);
|
|
1006
|
+
};
|
|
1007
|
+
const divElement = divElementRef.current;
|
|
1008
|
+
const targetDocument = divElement.ownerDocument;
|
|
1009
|
+
targetDocument.body.addEventListener("contextmenu", stopDraggingAndBlur);
|
|
1010
|
+
targetDocument.body.addEventListener("mousemove", onMove);
|
|
1011
|
+
targetDocument.body.addEventListener("touchmove", onMove);
|
|
1012
|
+
targetDocument.body.addEventListener("mouseleave", onMouseLeave);
|
|
985
1013
|
window.addEventListener("mouseup", stopDraggingAndBlur);
|
|
986
1014
|
window.addEventListener("touchend", stopDraggingAndBlur);
|
|
987
1015
|
return ()=>{
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1016
|
+
targetDocument.body.removeEventListener("contextmenu", stopDraggingAndBlur);
|
|
1017
|
+
targetDocument.body.removeEventListener("mousemove", onMove);
|
|
1018
|
+
targetDocument.body.removeEventListener("touchmove", onMove);
|
|
1019
|
+
targetDocument.body.removeEventListener("mouseleave", onMouseLeave);
|
|
991
1020
|
window.removeEventListener("mouseup", stopDraggingAndBlur);
|
|
992
1021
|
window.removeEventListener("touchend", stopDraggingAndBlur);
|
|
993
1022
|
};
|
|
@@ -1008,7 +1037,7 @@ function $971f2c37f9d2b98e$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
1008
1037
|
touchAction: "none",
|
|
1009
1038
|
userSelect: "none"
|
|
1010
1039
|
};
|
|
1011
|
-
return (0, $
|
|
1040
|
+
return (0, $ef07efbe5fa7d87e$export$c8a8987d4410bf2d)(Type, {
|
|
1012
1041
|
children: children,
|
|
1013
1042
|
className: classNameFromProps,
|
|
1014
1043
|
"data-resize-handle-active": isDragging ? "pointer" : isFocused ? "keyboard" : undefined,
|