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
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,13 @@
|
|
|
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
|
+
|
|
6
|
+
## 0.0.38
|
|
7
|
+
* [#117](https://github.com/bvaughn/react-resizable-panels/issues/117): `Panel` collapse behavior works better near viewport edges.
|
|
8
|
+
* [#115](https://github.com/bvaughn/react-resizable-panels/pull/115): `PanelResizeHandle` logic calls `event.preventDefault` for events it handles.
|
|
9
|
+
* [#82](https://github.com/bvaughn/react-resizable-panels/issues/82): `useId` import changed to avoid triggering errors with older versions of React. (Note this may have an impact on tree-shaking though it is presumed to be minimal, given the small `"react"` package size.)
|
|
10
|
+
|
|
3
11
|
## 0.0.37
|
|
4
12
|
* [#94](https://github.com/bvaughn/react-resizable-panels/issues/94): Add `onDragging` prop to `PanelResizeHandle` to be notified of when dragging starts/stops.
|
|
5
13
|
|
|
@@ -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,25 +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
|
|
|
29
|
+
const $b1693d8d8f570e9c$var$wrappedUseId = typeof (0, $6e687094f9ca8395$export$f680877a34711e37) === "function" ? (0, $6e687094f9ca8395$export$f680877a34711e37) : ()=>null;
|
|
18
30
|
let $b1693d8d8f570e9c$var$counter = 0;
|
|
19
31
|
function $b1693d8d8f570e9c$export$2e2bcd8739ae039(idFromParams = null) {
|
|
20
|
-
const idFromUseId =
|
|
21
|
-
const idRef = (0, $
|
|
32
|
+
const idFromUseId = $b1693d8d8f570e9c$var$wrappedUseId();
|
|
33
|
+
const idRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(idFromParams || idFromUseId || null);
|
|
22
34
|
if (idRef.current === null) idRef.current = "" + $b1693d8d8f570e9c$var$counter++;
|
|
23
35
|
return idRef.current;
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
|
|
27
39
|
|
|
28
|
-
const $b9cf028330e7f243$export$7d8c6d083caec74a = (0, $
|
|
40
|
+
const $b9cf028330e7f243$export$7d8c6d083caec74a = (0, $6e687094f9ca8395$export$fd42f52fd3ae1109)(null);
|
|
29
41
|
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
30
42
|
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
31
43
|
// See github.com/parcel-bundler/parcel/issues/8724
|
|
@@ -33,16 +45,16 @@ $b9cf028330e7f243$export$7d8c6d083caec74a.displayName = "PanelGroupContext";
|
|
|
33
45
|
|
|
34
46
|
|
|
35
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" }) {
|
|
36
|
-
const context = (0, $
|
|
48
|
+
const context = (0, $6e687094f9ca8395$export$fae74005e78b1a27)((0, $b9cf028330e7f243$export$7d8c6d083caec74a));
|
|
37
49
|
if (context === null) throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
38
50
|
const panelId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
39
51
|
const { collapsePanel: collapsePanel , expandPanel: expandPanel , getPanelStyle: getPanelStyle , registerPanel: registerPanel , resizePanel: resizePanel , unregisterPanel: unregisterPanel } = context;
|
|
40
52
|
// Use a ref to guard against users passing inline props
|
|
41
|
-
const callbacksRef = (0, $
|
|
53
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
42
54
|
onCollapse: onCollapse,
|
|
43
55
|
onResize: onResize
|
|
44
56
|
});
|
|
45
|
-
(0, $
|
|
57
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
46
58
|
callbacksRef.current.onCollapse = onCollapse;
|
|
47
59
|
callbacksRef.current.onResize = onResize;
|
|
48
60
|
});
|
|
@@ -81,13 +93,13 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
81
93
|
unregisterPanel
|
|
82
94
|
]);
|
|
83
95
|
const style = getPanelStyle(panelId);
|
|
84
|
-
const committedValuesRef = (0, $
|
|
96
|
+
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
85
97
|
size: $45da0e827c614f1d$var$parseSizeFromStyle(style)
|
|
86
98
|
});
|
|
87
99
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
88
100
|
committedValuesRef.current.size = $45da0e827c614f1d$var$parseSizeFromStyle(style);
|
|
89
101
|
});
|
|
90
|
-
(0, $
|
|
102
|
+
(0, $6e687094f9ca8395$export$d5a552a76deda3c2)(forwardedRef, ()=>({
|
|
91
103
|
collapse: ()=>collapsePanel(panelId),
|
|
92
104
|
expand: ()=>expandPanel(panelId),
|
|
93
105
|
getCollapsed () {
|
|
@@ -103,7 +115,7 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
103
115
|
panelId,
|
|
104
116
|
resizePanel
|
|
105
117
|
]);
|
|
106
|
-
return (0, $
|
|
118
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
107
119
|
children: children,
|
|
108
120
|
className: classNameFromProps,
|
|
109
121
|
"data-panel": "",
|
|
@@ -117,7 +129,7 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
117
129
|
}
|
|
118
130
|
});
|
|
119
131
|
}
|
|
120
|
-
const $45da0e827c614f1d$export$2ddb90ad54e5f587 = (0, $
|
|
132
|
+
const $45da0e827c614f1d$export$2ddb90ad54e5f587 = (0, $6e687094f9ca8395$export$257a8862b851cb5b)((props, ref)=>(0, $6e687094f9ca8395$export$c8a8987d4410bf2d)($45da0e827c614f1d$var$PanelWithForwardedRef, {
|
|
121
133
|
...props,
|
|
122
134
|
forwardedRef: ref
|
|
123
135
|
}));
|
|
@@ -426,7 +438,7 @@ function $47eee9224cfec8e8$export$c4dfce035d43d1e0(event) {
|
|
|
426
438
|
|
|
427
439
|
|
|
428
440
|
function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committedValuesRef , groupId: groupId , panels: panels , setSizes: setSizes , sizes: sizes , panelSizeBeforeCollapse: panelSizeBeforeCollapse }) {
|
|
429
|
-
(0, $
|
|
441
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
430
442
|
const { direction: direction , panels: panels } = committedValuesRef.current;
|
|
431
443
|
const groupElement = (0, $cda3cc4b1114cf23$export$5e67632cf3550a9c)(groupId);
|
|
432
444
|
const { height: height , width: width } = groupElement.getBoundingClientRect();
|
|
@@ -457,9 +469,11 @@ function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
457
469
|
handle.setAttribute("aria-valuemin", "" + Math.round(ariaValueMin));
|
|
458
470
|
handle.setAttribute("aria-valuenow", "" + Math.round(parseInt(flexGrow)));
|
|
459
471
|
const onKeyDown = (event)=>{
|
|
472
|
+
if (event.defaultPrevented) return;
|
|
460
473
|
switch(event.key){
|
|
461
474
|
case "Enter":
|
|
462
475
|
{
|
|
476
|
+
event.preventDefault();
|
|
463
477
|
const index = panelsArray.findIndex((panel)=>panel.id === idBefore);
|
|
464
478
|
if (index >= 0) {
|
|
465
479
|
const panelData = panelsArray[index];
|
|
@@ -491,17 +505,21 @@ function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
491
505
|
cleanupFunctions.forEach((cleanupFunction)=>cleanupFunction());
|
|
492
506
|
};
|
|
493
507
|
}, [
|
|
508
|
+
committedValuesRef,
|
|
494
509
|
groupId,
|
|
495
510
|
panels,
|
|
511
|
+
panelSizeBeforeCollapse,
|
|
512
|
+
setSizes,
|
|
496
513
|
sizes
|
|
497
514
|
]);
|
|
498
515
|
}
|
|
499
516
|
function $a695670cc57a5969$export$33b0bea6ac3ffb03({ disabled: disabled , handleId: handleId , resizeHandler: resizeHandler }) {
|
|
500
|
-
(0, $
|
|
517
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
501
518
|
if (disabled || resizeHandler == null) return;
|
|
502
519
|
const handleElement = (0, $cda3cc4b1114cf23$export$2e27d3a347680388)(handleId);
|
|
503
520
|
if (handleElement == null) return;
|
|
504
521
|
const onKeyDown = (event)=>{
|
|
522
|
+
if (event.defaultPrevented) return;
|
|
505
523
|
switch(event.key){
|
|
506
524
|
case "ArrowDown":
|
|
507
525
|
case "ArrowLeft":
|
|
@@ -509,10 +527,12 @@ function $a695670cc57a5969$export$33b0bea6ac3ffb03({ disabled: disabled , handle
|
|
|
509
527
|
case "ArrowUp":
|
|
510
528
|
case "End":
|
|
511
529
|
case "Home":
|
|
530
|
+
event.preventDefault();
|
|
512
531
|
resizeHandler(event);
|
|
513
532
|
break;
|
|
514
533
|
case "F6":
|
|
515
534
|
{
|
|
535
|
+
event.preventDefault();
|
|
516
536
|
const handles = (0, $cda3cc4b1114cf23$export$8d0cd3c32ddc045e)();
|
|
517
537
|
const index = (0, $cda3cc4b1114cf23$export$96a40be80fb6c3c8)(handleId);
|
|
518
538
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
@@ -603,26 +623,26 @@ const $cec4cafe75f3db78$var$defaultStorage = {
|
|
|
603
623
|
};
|
|
604
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" }) {
|
|
605
625
|
const groupId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
606
|
-
const [activeHandleId, setActiveHandleId] = (0, $
|
|
607
|
-
const [panels, setPanels] = (0, $
|
|
626
|
+
const [activeHandleId, setActiveHandleId] = (0, $6e687094f9ca8395$export$60241385465d0a34)(null);
|
|
627
|
+
const [panels, setPanels] = (0, $6e687094f9ca8395$export$60241385465d0a34)(new Map());
|
|
608
628
|
// When resizing is done via mouse/touch event–
|
|
609
629
|
// We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
|
|
610
630
|
// This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
|
|
611
|
-
const initialDragStateRef = (0, $
|
|
631
|
+
const initialDragStateRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(null);
|
|
612
632
|
// Use a ref to guard against users passing inline props
|
|
613
|
-
const callbacksRef = (0, $
|
|
633
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
614
634
|
onLayout: onLayout
|
|
615
635
|
});
|
|
616
|
-
(0, $
|
|
636
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
617
637
|
callbacksRef.current.onLayout = onLayout;
|
|
618
638
|
});
|
|
619
639
|
// 0-1 values representing the relative size of each panel.
|
|
620
|
-
const [sizes, setSizes] = (0, $
|
|
640
|
+
const [sizes, setSizes] = (0, $6e687094f9ca8395$export$60241385465d0a34)([]);
|
|
621
641
|
// Used to support imperative collapse/expand API.
|
|
622
|
-
const panelSizeBeforeCollapse = (0, $
|
|
623
|
-
const prevDeltaRef = (0, $
|
|
642
|
+
const panelSizeBeforeCollapse = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(new Map());
|
|
643
|
+
const prevDeltaRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(0);
|
|
624
644
|
// Store committed values to avoid unnecessarily re-running memoization/effects functions.
|
|
625
|
-
const committedValuesRef = (0, $
|
|
645
|
+
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
626
646
|
direction: direction,
|
|
627
647
|
panels: panels,
|
|
628
648
|
sizes: sizes
|
|
@@ -641,7 +661,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
641
661
|
panelSizeBeforeCollapse: panelSizeBeforeCollapse
|
|
642
662
|
});
|
|
643
663
|
// Notify external code when sizes have changed.
|
|
644
|
-
(0, $
|
|
664
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
645
665
|
const { onLayout: onLayout } = callbacksRef.current;
|
|
646
666
|
if (onLayout) {
|
|
647
667
|
const { sizes: sizes } = committedValuesRef.current;
|
|
@@ -653,7 +673,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
653
673
|
]);
|
|
654
674
|
// Notify Panel listeners about their initial sizes and collapsed state after mount.
|
|
655
675
|
// Subsequent changes will be called by the resizeHandler.
|
|
656
|
-
const didNotifyCallbacksAfterMountRef = (0, $
|
|
676
|
+
const didNotifyCallbacksAfterMountRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(false);
|
|
657
677
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
658
678
|
if (didNotifyCallbacksAfterMountRef.current) return;
|
|
659
679
|
const { panels: panels , sizes: sizes } = committedValuesRef.current;
|
|
@@ -703,9 +723,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
703
723
|
}
|
|
704
724
|
}, [
|
|
705
725
|
autoSaveId,
|
|
706
|
-
panels
|
|
726
|
+
panels,
|
|
727
|
+
storage
|
|
707
728
|
]);
|
|
708
|
-
(0, $
|
|
729
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
709
730
|
// If this panel has been configured to persist sizing information, save sizes to local storage.
|
|
710
731
|
if (autoSaveId) {
|
|
711
732
|
if (sizes.length === 0 || sizes.length !== panels.size) return;
|
|
@@ -715,9 +736,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
715
736
|
}, [
|
|
716
737
|
autoSaveId,
|
|
717
738
|
panels,
|
|
718
|
-
sizes
|
|
739
|
+
sizes,
|
|
740
|
+
storage
|
|
719
741
|
]);
|
|
720
|
-
const getPanelStyle = (0, $
|
|
742
|
+
const getPanelStyle = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
721
743
|
const { panels: panels } = committedValuesRef.current;
|
|
722
744
|
// Before mounting, Panels will not yet have registered themselves.
|
|
723
745
|
// This includes server rendering.
|
|
@@ -742,10 +764,10 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
742
764
|
};
|
|
743
765
|
}, [
|
|
744
766
|
activeHandleId,
|
|
745
|
-
|
|
767
|
+
disablePointerEventsDuringResize,
|
|
746
768
|
sizes
|
|
747
769
|
]);
|
|
748
|
-
const registerPanel = (0, $
|
|
770
|
+
const registerPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id, panel)=>{
|
|
749
771
|
setPanels((prevPanels)=>{
|
|
750
772
|
if (prevPanels.has(id)) return prevPanels;
|
|
751
773
|
const nextPanels = new Map(prevPanels);
|
|
@@ -753,7 +775,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
753
775
|
return nextPanels;
|
|
754
776
|
});
|
|
755
777
|
}, []);
|
|
756
|
-
const registerResizeHandle = (0, $
|
|
778
|
+
const registerResizeHandle = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((handleId)=>{
|
|
757
779
|
const resizeHandler = (event)=>{
|
|
758
780
|
event.preventDefault();
|
|
759
781
|
const { direction: direction , panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
@@ -796,7 +818,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
796
818
|
}, [
|
|
797
819
|
groupId
|
|
798
820
|
]);
|
|
799
|
-
const unregisterPanel = (0, $
|
|
821
|
+
const unregisterPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
800
822
|
setPanels((prevPanels)=>{
|
|
801
823
|
if (!prevPanels.has(id)) return prevPanels;
|
|
802
824
|
const nextPanels = new Map(prevPanels);
|
|
@@ -804,7 +826,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
804
826
|
return nextPanels;
|
|
805
827
|
});
|
|
806
828
|
}, []);
|
|
807
|
-
const collapsePanel = (0, $
|
|
829
|
+
const collapsePanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
808
830
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
809
831
|
const panel = panels.get(id);
|
|
810
832
|
if (panel == null || !panel.collapsible) return;
|
|
@@ -826,7 +848,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
826
848
|
setSizes(nextSizes);
|
|
827
849
|
}
|
|
828
850
|
}, []);
|
|
829
|
-
const expandPanel = (0, $
|
|
851
|
+
const expandPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
830
852
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
831
853
|
const panel = panels.get(id);
|
|
832
854
|
if (panel == null) return;
|
|
@@ -849,7 +871,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
849
871
|
setSizes(nextSizes);
|
|
850
872
|
}
|
|
851
873
|
}, []);
|
|
852
|
-
const resizePanel = (0, $
|
|
874
|
+
const resizePanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id, nextSize)=>{
|
|
853
875
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
854
876
|
const panel = panels.get(id);
|
|
855
877
|
if (panel == null) return;
|
|
@@ -871,7 +893,7 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
871
893
|
setSizes(nextSizes);
|
|
872
894
|
}
|
|
873
895
|
}, []);
|
|
874
|
-
const context = (0, $
|
|
896
|
+
const context = (0, $6e687094f9ca8395$export$1538c33de8887b59)(()=>({
|
|
875
897
|
activeHandleId: activeHandleId,
|
|
876
898
|
collapsePanel: collapsePanel,
|
|
877
899
|
direction: direction,
|
|
@@ -917,8 +939,8 @@ function $cec4cafe75f3db78$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
|
|
|
917
939
|
overflow: "hidden",
|
|
918
940
|
width: "100%"
|
|
919
941
|
};
|
|
920
|
-
return (0, $
|
|
921
|
-
children: (0, $
|
|
942
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)((0, $b9cf028330e7f243$export$7d8c6d083caec74a).Provider, {
|
|
943
|
+
children: (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
922
944
|
children: children,
|
|
923
945
|
className: classNameFromProps,
|
|
924
946
|
"data-panel-group": "",
|
|
@@ -944,22 +966,22 @@ $cec4cafe75f3db78$export$1d05749f6f573bb.displayName = "PanelGroup";
|
|
|
944
966
|
|
|
945
967
|
|
|
946
968
|
function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null , className: classNameFromProps = "" , disabled: disabled = false , id: idFromProps = null , onDragging: onDragging = null , style: styleFromProps = {} , tagName: Type = "div" }) {
|
|
947
|
-
const divElementRef = (0, $
|
|
969
|
+
const divElementRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)(null);
|
|
948
970
|
// Use a ref to guard against users passing inline props
|
|
949
|
-
const callbacksRef = (0, $
|
|
971
|
+
const callbacksRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
950
972
|
onDragging: onDragging
|
|
951
973
|
});
|
|
952
|
-
(0, $
|
|
974
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
953
975
|
callbacksRef.current.onDragging = onDragging;
|
|
954
976
|
});
|
|
955
|
-
const panelGroupContext = (0, $
|
|
977
|
+
const panelGroupContext = (0, $6e687094f9ca8395$export$fae74005e78b1a27)((0, $b9cf028330e7f243$export$7d8c6d083caec74a));
|
|
956
978
|
if (panelGroupContext === null) throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
957
979
|
const { activeHandleId: activeHandleId , direction: direction , groupId: groupId , registerResizeHandle: registerResizeHandle , startDragging: startDragging , stopDragging: stopDragging } = panelGroupContext;
|
|
958
980
|
const resizeHandleId = (0, $b1693d8d8f570e9c$export$2e2bcd8739ae039)(idFromProps);
|
|
959
981
|
const isDragging = activeHandleId === resizeHandleId;
|
|
960
|
-
const [isFocused, setIsFocused] = (0, $
|
|
961
|
-
const [resizeHandler, setResizeHandler] = (0, $
|
|
962
|
-
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)(()=>{
|
|
963
985
|
// Clicking on the drag handle shouldn't leave it focused;
|
|
964
986
|
// That would cause the PanelGroup to think it was still active.
|
|
965
987
|
const div = divElementRef.current;
|
|
@@ -970,7 +992,7 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
970
992
|
}, [
|
|
971
993
|
stopDragging
|
|
972
994
|
]);
|
|
973
|
-
(0, $
|
|
995
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
974
996
|
if (disabled) setResizeHandler(null);
|
|
975
997
|
else {
|
|
976
998
|
const resizeHandler = registerResizeHandle(resizeHandleId);
|
|
@@ -981,20 +1003,27 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
981
1003
|
resizeHandleId,
|
|
982
1004
|
registerResizeHandle
|
|
983
1005
|
]);
|
|
984
|
-
(0, $
|
|
1006
|
+
(0, $6e687094f9ca8395$export$6d9c69b0de29b591)(()=>{
|
|
985
1007
|
if (disabled || resizeHandler == null || !isDragging) return;
|
|
986
1008
|
const onMove = (event)=>{
|
|
987
1009
|
resizeHandler(event);
|
|
988
1010
|
};
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1011
|
+
const onMouseLeave = (event)=>{
|
|
1012
|
+
resizeHandler(event);
|
|
1013
|
+
};
|
|
1014
|
+
const divElement = divElementRef.current;
|
|
1015
|
+
const targetDocument = divElement.ownerDocument;
|
|
1016
|
+
targetDocument.body.addEventListener("contextmenu", stopDraggingAndBlur);
|
|
1017
|
+
targetDocument.body.addEventListener("mousemove", onMove);
|
|
1018
|
+
targetDocument.body.addEventListener("touchmove", onMove);
|
|
1019
|
+
targetDocument.body.addEventListener("mouseleave", onMouseLeave);
|
|
992
1020
|
window.addEventListener("mouseup", stopDraggingAndBlur);
|
|
993
1021
|
window.addEventListener("touchend", stopDraggingAndBlur);
|
|
994
1022
|
return ()=>{
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1023
|
+
targetDocument.body.removeEventListener("contextmenu", stopDraggingAndBlur);
|
|
1024
|
+
targetDocument.body.removeEventListener("mousemove", onMove);
|
|
1025
|
+
targetDocument.body.removeEventListener("touchmove", onMove);
|
|
1026
|
+
targetDocument.body.removeEventListener("mouseleave", onMouseLeave);
|
|
998
1027
|
window.removeEventListener("mouseup", stopDraggingAndBlur);
|
|
999
1028
|
window.removeEventListener("touchend", stopDraggingAndBlur);
|
|
1000
1029
|
};
|
|
@@ -1015,7 +1044,7 @@ function $3a26a712c9163348$export$8829ecf6b6b15484({ children: children = null ,
|
|
|
1015
1044
|
touchAction: "none",
|
|
1016
1045
|
userSelect: "none"
|
|
1017
1046
|
};
|
|
1018
|
-
return (0, $
|
|
1047
|
+
return (0, $6e687094f9ca8395$export$c8a8987d4410bf2d)(Type, {
|
|
1019
1048
|
children: children,
|
|
1020
1049
|
className: classNameFromProps,
|
|
1021
1050
|
"data-resize-handle-active": isDragging ? "pointer" : isFocused ? "keyboard" : undefined,
|