react-resizable-panels 0.0.38 → 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 +3 -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 +65 -52
- package/dist/react-resizable-panels.js.map +1 -1
- package/dist/react-resizable-panels.module.js +65 -52
- 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 +1 -1
- package/src/hooks/useIsomorphicEffect.ts +1 -1
- package/src/hooks/useUniqueId.ts +4 -8
- package/src/hooks/useWindowSplitterBehavior.ts +9 -2
- package/src/types.ts +1 -1
- package/src/vendor/react.ts +61 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ignorePatterns": [".parcel-cache", "dist", "node_modules"],
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"parserOptions": { "project": ["../../tsconfig.json"] },
|
|
5
|
+
"plugins": ["@typescript-eslint", "no-restricted-imports", "react-hooks"],
|
|
6
|
+
"root": true,
|
|
7
|
+
"rules": {
|
|
8
|
+
"no-restricted-imports": [
|
|
9
|
+
"error",
|
|
10
|
+
{
|
|
11
|
+
"paths": ["react"]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"react-hooks/rules-of-hooks": "error",
|
|
15
|
+
"react-hooks/exhaustive-deps": [
|
|
16
|
+
"warn",
|
|
17
|
+
{
|
|
18
|
+
"additionalHooks": "(useIsomorphicLayoutEffect)"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.39
|
|
4
|
+
* [#118](https://github.com/bvaughn/react-resizable-panels/issues/118): Fix import regression from 0.0.38.
|
|
5
|
+
|
|
3
6
|
## 0.0.38
|
|
4
7
|
* [#117](https://github.com/bvaughn/react-resizable-panels/issues/117): `Panel` collapse behavior works better near viewport edges.
|
|
5
8
|
* [#115](https://github.com/bvaughn/react-resizable-panels/pull/115): `PanelResizeHandle` logic calls `event.preventDefault` for events it handles.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";
|
|
1
|
+
{"mappings":"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","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/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,"import { Panel } from \"./Panel\";\nimport { PanelGroup } from \"./PanelGroup\";\nimport { PanelResizeHandle } from \"./PanelResizeHandle\";\n\nimport type { ImperativePanelHandle, PanelProps } from \"./Panel\";\nimport type { 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"}
|
|
@@ -7,29 +7,37 @@ function $parcel$export(e, n, v, s) {
|
|
|
7
7
|
$parcel$export(module.exports, "Panel", () => $45da0e827c614f1d$export$2ddb90ad54e5f587);
|
|
8
8
|
$parcel$export(module.exports, "PanelGroup", () => $cec4cafe75f3db78$export$1d05749f6f573bb);
|
|
9
9
|
$parcel$export(module.exports, "PanelResizeHandle", () => $3a26a712c9163348$export$8829ecf6b6b15484);
|
|
10
|
+
// This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
|
|
11
|
+
// and limitations with ParcelJS parsing of the useId workaround (used below).
|
|
12
|
+
// For the time being, all react-resizable-panels must import "react" with the "* as React" syntax.
|
|
13
|
+
// To avoid mistakes, we use the ESLint "no-restricted-imports" to prevent "react" imports except in this file.
|
|
14
|
+
// See https://github.com/bvaughn/react-resizable-panels/issues/118
|
|
15
|
+
// eslint-disable-next-line no-restricted-imports
|
|
16
|
+
|
|
17
|
+
const { createElement: $6e687094f9ca8395$export$c8a8987d4410bf2d , createContext: $6e687094f9ca8395$export$fd42f52fd3ae1109 , forwardRef: $6e687094f9ca8395$export$257a8862b851cb5b , useCallback: $6e687094f9ca8395$export$35808ee640e87ca7 , useContext: $6e687094f9ca8395$export$fae74005e78b1a27 , useEffect: $6e687094f9ca8395$export$6d9c69b0de29b591 , useImperativeHandle: $6e687094f9ca8395$export$d5a552a76deda3c2 , useLayoutEffect: $6e687094f9ca8395$export$e5c5a5f917a5871c , useMemo: $6e687094f9ca8395$export$1538c33de8887b59 , useRef: $6e687094f9ca8395$export$b8f5890fc79d6aca , useState: $6e687094f9ca8395$export$60241385465d0a34 } = $2IMI0$react;
|
|
18
|
+
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
19
|
+
const $6e687094f9ca8395$export$f680877a34711e37 = $2IMI0$react["useId".toString()];
|
|
20
|
+
|
|
10
21
|
|
|
11
22
|
|
|
12
23
|
const $129b5b9a317dcc10$var$canUseEffectHooks = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
13
|
-
const $129b5b9a317dcc10$var$useIsomorphicLayoutEffect = $129b5b9a317dcc10$var$canUseEffectHooks ? (0, $
|
|
24
|
+
const $129b5b9a317dcc10$var$useIsomorphicLayoutEffect = $129b5b9a317dcc10$var$canUseEffectHooks ? (0, $6e687094f9ca8395$export$e5c5a5f917a5871c) : ()=>{};
|
|
14
25
|
var $129b5b9a317dcc10$export$2e2bcd8739ae039 = $129b5b9a317dcc10$var$useIsomorphicLayoutEffect;
|
|
15
26
|
|
|
16
27
|
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
// Support React versions older than 18.0
|
|
20
|
-
// Workaround for https://github.com/webpack/webpack/issues/14814
|
|
21
|
-
const $b1693d8d8f570e9c$var$useId = $2IMI0$react["useId".toString()];
|
|
29
|
+
const $b1693d8d8f570e9c$var$wrappedUseId = typeof (0, $6e687094f9ca8395$export$f680877a34711e37) === "function" ? (0, $6e687094f9ca8395$export$f680877a34711e37) : ()=>null;
|
|
22
30
|
let $b1693d8d8f570e9c$var$counter = 0;
|
|
23
31
|
function $b1693d8d8f570e9c$export$2e2bcd8739ae039(idFromParams = null) {
|
|
24
|
-
const idFromUseId =
|
|
25
|
-
const idRef = (0, $
|
|
32
|
+
const idFromUseId = $b1693d8d8f570e9c$var$wrappedUseId();
|
|
33
|
+
const idRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(idFromParams || idFromUseId || null);
|
|
26
34
|
if (idRef.current === null) idRef.current = "" + $b1693d8d8f570e9c$var$counter++;
|
|
27
35
|
return idRef.current;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
|
|
31
39
|
|
|
32
|
-
const $b9cf028330e7f243$export$7d8c6d083caec74a = (0, $
|
|
40
|
+
const $b9cf028330e7f243$export$7d8c6d083caec74a = (0, $6e687094f9ca8395$export$fd42f52fd3ae1109)(null);
|
|
33
41
|
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
34
42
|
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
35
43
|
// See github.com/parcel-bundler/parcel/issues/8724
|
|
@@ -37,16 +45,16 @@ $b9cf028330e7f243$export$7d8c6d083caec74a.displayName = "PanelGroupContext";
|
|
|
37
45
|
|
|
38
46
|
|
|
39
47
|
function $45da0e827c614f1d$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" }) {
|
|
40
|
-
const context = (0, $
|
|
48
|
+
const context = (0, $6e687094f9ca8395$export$fae74005e78b1a27)((0, $b9cf028330e7f243$export$7d8c6d083caec74a));
|
|
41
49
|
if (context === null) throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
42
50
|
const panelId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
43
51
|
const { collapsePanel: collapsePanel , expandPanel: expandPanel , getPanelStyle: getPanelStyle , registerPanel: registerPanel , resizePanel: resizePanel , unregisterPanel: unregisterPanel } = context;
|
|
44
52
|
// Use a ref to guard against users passing inline props
|
|
45
|
-
const callbacksRef = (0, $
|
|
53
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
46
54
|
onCollapse: onCollapse,
|
|
47
55
|
onResize: onResize
|
|
48
56
|
});
|
|
49
|
-
(0, $
|
|
57
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
50
58
|
callbacksRef.current.onCollapse = onCollapse;
|
|
51
59
|
callbacksRef.current.onResize = onResize;
|
|
52
60
|
});
|
|
@@ -85,13 +93,13 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
85
93
|
unregisterPanel
|
|
86
94
|
]);
|
|
87
95
|
const style = getPanelStyle(panelId);
|
|
88
|
-
const committedValuesRef = (0, $
|
|
96
|
+
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
89
97
|
size: $45da0e827c614f1d$var$parseSizeFromStyle(style)
|
|
90
98
|
});
|
|
91
99
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
92
100
|
committedValuesRef.current.size = $45da0e827c614f1d$var$parseSizeFromStyle(style);
|
|
93
101
|
});
|
|
94
|
-
(0, $
|
|
102
|
+
(0, $6e687094f9ca8395$export$d5a552a76deda3c2)(forwardedRef, ()=>({
|
|
95
103
|
collapse: ()=>collapsePanel(panelId),
|
|
96
104
|
expand: ()=>expandPanel(panelId),
|
|
97
105
|
getCollapsed () {
|
|
@@ -107,7 +115,7 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
107
115
|
panelId,
|
|
108
116
|
resizePanel
|
|
109
117
|
]);
|
|
110
|
-
return (0, $
|
|
118
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
111
119
|
children: children,
|
|
112
120
|
className: classNameFromProps,
|
|
113
121
|
"data-panel": "",
|
|
@@ -121,7 +129,7 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
121
129
|
}
|
|
122
130
|
});
|
|
123
131
|
}
|
|
124
|
-
const $45da0e827c614f1d$export$2ddb90ad54e5f587 = (0, $
|
|
132
|
+
const $45da0e827c614f1d$export$2ddb90ad54e5f587 = (0, $6e687094f9ca8395$export$257a8862b851cb5b)((props, ref)=>(0, $6e687094f9ca8395$export$c8a8987d4410bf2d)($45da0e827c614f1d$var$PanelWithForwardedRef, {
|
|
125
133
|
...props,
|
|
126
134
|
forwardedRef: ref
|
|
127
135
|
}));
|
|
@@ -430,7 +438,7 @@ function $47eee9224cfec8e8$export$c4dfce035d43d1e0(event) {
|
|
|
430
438
|
|
|
431
439
|
|
|
432
440
|
function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committedValuesRef , groupId: groupId , panels: panels , setSizes: setSizes , sizes: sizes , panelSizeBeforeCollapse: panelSizeBeforeCollapse }) {
|
|
433
|
-
(0, $
|
|
441
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
434
442
|
const { direction: direction , panels: panels } = committedValuesRef.current;
|
|
435
443
|
const groupElement = (0, $cda3cc4b1114cf23$export$5e67632cf3550a9c)(groupId);
|
|
436
444
|
const { height: height , width: width } = groupElement.getBoundingClientRect();
|
|
@@ -497,13 +505,16 @@ function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
497
505
|
cleanupFunctions.forEach((cleanupFunction)=>cleanupFunction());
|
|
498
506
|
};
|
|
499
507
|
}, [
|
|
508
|
+
committedValuesRef,
|
|
500
509
|
groupId,
|
|
501
510
|
panels,
|
|
511
|
+
panelSizeBeforeCollapse,
|
|
512
|
+
setSizes,
|
|
502
513
|
sizes
|
|
503
514
|
]);
|
|
504
515
|
}
|
|
505
516
|
function $a695670cc57a5969$export$33b0bea6ac3ffb03({ disabled: disabled , handleId: handleId , resizeHandler: resizeHandler }) {
|
|
506
|
-
(0, $
|
|
517
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
507
518
|
if (disabled || resizeHandler == null) return;
|
|
508
519
|
const handleElement = (0, $cda3cc4b1114cf23$export$2e27d3a347680388)(handleId);
|
|
509
520
|
if (handleElement == null) return;
|
|
@@ -612,26 +623,26 @@ const $cec4cafe75f3db78$var$defaultStorage = {
|
|
|
612
623
|
};
|
|
613
624
|
function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , disablePointerEventsDuringResize: disablePointerEventsDuringResize = false , id: idFromProps = null , onLayout: onLayout = null , storage: storage = $cec4cafe75f3db78$var$defaultStorage , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
614
625
|
const groupId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
615
|
-
const [activeHandleId, setActiveHandleId] = (0, $
|
|
616
|
-
const [panels, setPanels] = (0, $
|
|
626
|
+
const [activeHandleId, setActiveHandleId] = (0, $6e687094f9ca8395$export$60241385465d0a34)(null);
|
|
627
|
+
const [panels, setPanels] = (0, $6e687094f9ca8395$export$60241385465d0a34)(new Map());
|
|
617
628
|
// When resizing is done via mouse/touch event–
|
|
618
629
|
// We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
|
|
619
630
|
// This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
|
|
620
|
-
const initialDragStateRef = (0, $
|
|
631
|
+
const initialDragStateRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(null);
|
|
621
632
|
// Use a ref to guard against users passing inline props
|
|
622
|
-
const callbacksRef = (0, $
|
|
633
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
623
634
|
onLayout: onLayout
|
|
624
635
|
});
|
|
625
|
-
(0, $
|
|
636
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
626
637
|
callbacksRef.current.onLayout = onLayout;
|
|
627
638
|
});
|
|
628
639
|
// 0-1 values representing the relative size of each panel.
|
|
629
|
-
const [sizes, setSizes] = (0, $
|
|
640
|
+
const [sizes, setSizes] = (0, $6e687094f9ca8395$export$60241385465d0a34)([]);
|
|
630
641
|
// Used to support imperative collapse/expand API.
|
|
631
|
-
const panelSizeBeforeCollapse = (0, $
|
|
632
|
-
const prevDeltaRef = (0, $
|
|
642
|
+
const panelSizeBeforeCollapse = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(new Map());
|
|
643
|
+
const prevDeltaRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(0);
|
|
633
644
|
// Store committed values to avoid unnecessarily re-running memoization/effects functions.
|
|
634
|
-
const committedValuesRef = (0, $
|
|
645
|
+
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
635
646
|
direction: direction,
|
|
636
647
|
panels: panels,
|
|
637
648
|
sizes: sizes
|
|
@@ -650,7 +661,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
650
661
|
panelSizeBeforeCollapse: panelSizeBeforeCollapse
|
|
651
662
|
});
|
|
652
663
|
// Notify external code when sizes have changed.
|
|
653
|
-
(0, $
|
|
664
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
654
665
|
const { onLayout: onLayout } = callbacksRef.current;
|
|
655
666
|
if (onLayout) {
|
|
656
667
|
const { sizes: sizes } = committedValuesRef.current;
|
|
@@ -662,7 +673,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
662
673
|
]);
|
|
663
674
|
// Notify Panel listeners about their initial sizes and collapsed state after mount.
|
|
664
675
|
// Subsequent changes will be called by the resizeHandler.
|
|
665
|
-
const didNotifyCallbacksAfterMountRef = (0, $
|
|
676
|
+
const didNotifyCallbacksAfterMountRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(false);
|
|
666
677
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
667
678
|
if (didNotifyCallbacksAfterMountRef.current) return;
|
|
668
679
|
const { panels: panels , sizes: sizes } = committedValuesRef.current;
|
|
@@ -712,9 +723,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
712
723
|
}
|
|
713
724
|
}, [
|
|
714
725
|
autoSaveId,
|
|
715
|
-
panels
|
|
726
|
+
panels,
|
|
727
|
+
storage
|
|
716
728
|
]);
|
|
717
|
-
(0, $
|
|
729
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
718
730
|
// If this panel has been configured to persist sizing information, save sizes to local storage.
|
|
719
731
|
if (autoSaveId) {
|
|
720
732
|
if (sizes.length === 0 || sizes.length !== panels.size) return;
|
|
@@ -724,9 +736,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
724
736
|
}, [
|
|
725
737
|
autoSaveId,
|
|
726
738
|
panels,
|
|
727
|
-
sizes
|
|
739
|
+
sizes,
|
|
740
|
+
storage
|
|
728
741
|
]);
|
|
729
|
-
const getPanelStyle = (0, $
|
|
742
|
+
const getPanelStyle = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
730
743
|
const { panels: panels } = committedValuesRef.current;
|
|
731
744
|
// Before mounting, Panels will not yet have registered themselves.
|
|
732
745
|
// This includes server rendering.
|
|
@@ -751,10 +764,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
751
764
|
};
|
|
752
765
|
}, [
|
|
753
766
|
activeHandleId,
|
|
754
|
-
|
|
767
|
+
disablePointerEventsDuringResize,
|
|
755
768
|
sizes
|
|
756
769
|
]);
|
|
757
|
-
const registerPanel = (0, $
|
|
770
|
+
const registerPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id, panel)=>{
|
|
758
771
|
setPanels((prevPanels)=>{
|
|
759
772
|
if (prevPanels.has(id)) return prevPanels;
|
|
760
773
|
const nextPanels = new Map(prevPanels);
|
|
@@ -762,7 +775,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
762
775
|
return nextPanels;
|
|
763
776
|
});
|
|
764
777
|
}, []);
|
|
765
|
-
const registerResizeHandle = (0, $
|
|
778
|
+
const registerResizeHandle = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((handleId)=>{
|
|
766
779
|
const resizeHandler = (event)=>{
|
|
767
780
|
event.preventDefault();
|
|
768
781
|
const { direction: direction , panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
@@ -805,7 +818,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
805
818
|
}, [
|
|
806
819
|
groupId
|
|
807
820
|
]);
|
|
808
|
-
const unregisterPanel = (0, $
|
|
821
|
+
const unregisterPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
809
822
|
setPanels((prevPanels)=>{
|
|
810
823
|
if (!prevPanels.has(id)) return prevPanels;
|
|
811
824
|
const nextPanels = new Map(prevPanels);
|
|
@@ -813,7 +826,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
813
826
|
return nextPanels;
|
|
814
827
|
});
|
|
815
828
|
}, []);
|
|
816
|
-
const collapsePanel = (0, $
|
|
829
|
+
const collapsePanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
817
830
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
818
831
|
const panel = panels.get(id);
|
|
819
832
|
if (panel == null || !panel.collapsible) return;
|
|
@@ -835,7 +848,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
835
848
|
setSizes(nextSizes);
|
|
836
849
|
}
|
|
837
850
|
}, []);
|
|
838
|
-
const expandPanel = (0, $
|
|
851
|
+
const expandPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
839
852
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
840
853
|
const panel = panels.get(id);
|
|
841
854
|
if (panel == null) return;
|
|
@@ -858,7 +871,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
858
871
|
setSizes(nextSizes);
|
|
859
872
|
}
|
|
860
873
|
}, []);
|
|
861
|
-
const resizePanel = (0, $
|
|
874
|
+
const resizePanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id, nextSize)=>{
|
|
862
875
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
863
876
|
const panel = panels.get(id);
|
|
864
877
|
if (panel == null) return;
|
|
@@ -880,7 +893,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
880
893
|
setSizes(nextSizes);
|
|
881
894
|
}
|
|
882
895
|
}, []);
|
|
883
|
-
const context = (0, $
|
|
896
|
+
const context = (0, $6e687094f9ca8395$export$1538c33de8887b59)(()=>({
|
|
884
897
|
activeHandleId: activeHandleId,
|
|
885
898
|
collapsePanel: collapsePanel,
|
|
886
899
|
direction: direction,
|
|
@@ -926,8 +939,8 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
926
939
|
overflow: "hidden",
|
|
927
940
|
width: "100%"
|
|
928
941
|
};
|
|
929
|
-
return (0, $
|
|
930
|
-
children: (0, $
|
|
942
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)((0, $b9cf028330e7f243$export$7d8c6d083caec74a).Provider, {
|
|
943
|
+
children: (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
931
944
|
children: children,
|
|
932
945
|
className: classNameFromProps,
|
|
933
946
|
"data-panel-group": "",
|
|
@@ -953,22 +966,22 @@ $cec4cafe75f3db78$export$1d05749f6f573bb.displayName = "PanelGroup";
|
|
|
953
966
|
|
|
954
967
|
|
|
955
968
|
function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null , className: classNameFromProps = "" , disabled: disabled = false , id: idFromProps = null , onDragging: onDragging = null , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
956
|
-
const divElementRef = (0, $
|
|
969
|
+
const divElementRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(null);
|
|
957
970
|
// Use a ref to guard against users passing inline props
|
|
958
|
-
const callbacksRef = (0, $
|
|
971
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
959
972
|
onDragging: onDragging
|
|
960
973
|
});
|
|
961
|
-
(0, $
|
|
974
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
962
975
|
callbacksRef.current.onDragging = onDragging;
|
|
963
976
|
});
|
|
964
|
-
const panelGroupContext = (0, $
|
|
977
|
+
const panelGroupContext = (0, $6e687094f9ca8395$export$fae74005e78b1a27)((0, $b9cf028330e7f243$export$7d8c6d083caec74a));
|
|
965
978
|
if (panelGroupContext === null) throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
966
979
|
const { activeHandleId: activeHandleId , direction: direction , groupId: groupId , registerResizeHandle: registerResizeHandle , startDragging: startDragging , stopDragging: stopDragging } = panelGroupContext;
|
|
967
980
|
const resizeHandleId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
968
981
|
const isDragging = activeHandleId === resizeHandleId;
|
|
969
|
-
const [isFocused, setIsFocused] = (0, $
|
|
970
|
-
const [resizeHandler, setResizeHandler] = (0, $
|
|
971
|
-
const stopDraggingAndBlur = (0, $
|
|
982
|
+
const [isFocused, setIsFocused] = (0, $6e687094f9ca8395$export$60241385465d0a34)(false);
|
|
983
|
+
const [resizeHandler, setResizeHandler] = (0, $6e687094f9ca8395$export$60241385465d0a34)(null);
|
|
984
|
+
const stopDraggingAndBlur = (0, $6e687094f9ca8395$export$35808ee640e87ca7)(()=>{
|
|
972
985
|
// Clicking on the drag handle shouldn't leave it focused;
|
|
973
986
|
// That would cause the PanelGroup to think it was still active.
|
|
974
987
|
const div = divElementRef.current;
|
|
@@ -979,7 +992,7 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
979
992
|
}, [
|
|
980
993
|
stopDragging
|
|
981
994
|
]);
|
|
982
|
-
(0, $
|
|
995
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
983
996
|
if (disabled) setResizeHandler(null);
|
|
984
997
|
else {
|
|
985
998
|
const resizeHandler = registerResizeHandle(resizeHandleId);
|
|
@@ -990,7 +1003,7 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
990
1003
|
resizeHandleId,
|
|
991
1004
|
registerResizeHandle
|
|
992
1005
|
]);
|
|
993
|
-
(0, $
|
|
1006
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
994
1007
|
if (disabled || resizeHandler == null || !isDragging) return;
|
|
995
1008
|
const onMove = (event)=>{
|
|
996
1009
|
resizeHandler(event);
|
|
@@ -1031,7 +1044,7 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
1031
1044
|
touchAction: "none",
|
|
1032
1045
|
userSelect: "none"
|
|
1033
1046
|
};
|
|
1034
|
-
return (0, $
|
|
1047
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
1035
1048
|
children: children,
|
|
1036
1049
|
className: classNameFromProps,
|
|
1037
1050
|
"data-resize-handle-active": isDragging ? "pointer" : isFocused ? "keyboard" : undefined,
|