react-resizable-panels 0.0.11 → 0.0.13
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 +9 -0
- package/README.md +6 -5
- package/dist/react-resizable-panels.d.ts +5 -4
- package/dist/react-resizable-panels.d.ts.map +1 -1
- package/dist/react-resizable-panels.js +66 -50
- package/dist/react-resizable-panels.js.map +1 -1
- package/dist/react-resizable-panels.module.js +67 -51
- package/dist/react-resizable-panels.module.js.map +1 -1
- package/package.json +1 -1
- package/src/Panel.tsx +12 -9
- package/src/PanelContexts.ts +2 -2
- package/src/PanelGroup.tsx +21 -6
- package/src/PanelResizeHandle.tsx +13 -11
- package/src/hooks/useUniqueId.ts +7 -3
- package/src/utils/coordinates.ts +31 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.13
|
|
4
|
+
* [#18](https://github.com/bvaughn/react-resizable-panels/issues/18): Support server-side rendering (e.g. Next JS) by using `useId` (when available). `Panel` components no longer _require_ a user-provided `id` prop and will also fall back to using `useId` when none is provided.
|
|
5
|
+
* `PanelGroup` component now sets `position: relative` style by default, as well as an explicit `height` and `width` style.
|
|
6
|
+
|
|
7
|
+
## 0.0.12
|
|
8
|
+
* Bug fix: [#19](https://github.com/bvaughn/react-resizable-panels/issues/19): Fix initial "jump" that could occur when dragging started.
|
|
9
|
+
* Bug fix: [#20](https://github.com/bvaughn/react-resizable-panels/issues/20): Stop resize/drag operation on "contextmenu" event.
|
|
10
|
+
* Bug fix: [#21](https://github.com/bvaughn/react-resizable-panels/issues/21): Disable text selection while dragging active (Firefox only)
|
|
11
|
+
|
|
3
12
|
## 0.0.11
|
|
4
13
|
* Drag UX change: Reversing drag after dragging past the min/max size of a panel will no longer have an effect until the pointer overlaps with the resize handle. (Thanks @davidkpiano for the suggestion!)
|
|
5
14
|
* Bug fix: Resize handles are no longer left in a "focused" state after a touch/mouse event.
|
package/README.md
CHANGED
|
@@ -5,15 +5,15 @@ React components for resizable panel groups/layouts
|
|
|
5
5
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
6
6
|
|
|
7
7
|
<PanelGroup autoSaveId="example" direction="horizontal">
|
|
8
|
-
<Panel defaultSize={0.3}
|
|
8
|
+
<Panel defaultSize={0.3}>
|
|
9
9
|
<SourcesExplorer />
|
|
10
10
|
</Panel>
|
|
11
|
-
<Panel defaultSize={0.5}
|
|
11
|
+
<Panel defaultSize={0.5}>
|
|
12
12
|
<PanelResizeHandle />
|
|
13
13
|
<SourceViewer />
|
|
14
14
|
<PanelResizeHandle />
|
|
15
15
|
</Panel>
|
|
16
|
-
<Panel defaultSize={0.2}
|
|
16
|
+
<Panel defaultSize={0.2}>
|
|
17
17
|
<Console />
|
|
18
18
|
</Panel>
|
|
19
19
|
</PanelGroup>
|
|
@@ -29,6 +29,7 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
|
29
29
|
| `className` | `?string` | Class name
|
|
30
30
|
| `direction` | `"horizontal" \| "vertical"` | Group orientation
|
|
31
31
|
| `height` | `number` | Height of group (in pixels)
|
|
32
|
+
| `id` | `?string` | Optional group id; falls back to `useId` when not provided
|
|
32
33
|
| `width` | `number` | Width of group (in pixels)
|
|
33
34
|
|
|
34
35
|
### `Panel`
|
|
@@ -37,7 +38,7 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
|
37
38
|
| `children` | `ReactNode` | Arbitrary React element(s)
|
|
38
39
|
| `className` | `?string` | Class name
|
|
39
40
|
| `defaultSize` | `?number` | Initial size of panel (relative to other panels within the group)
|
|
40
|
-
| `id` |
|
|
41
|
+
| `id` | `?string` | Optional panel id (unique within group); falls back to `useId` when not provided
|
|
41
42
|
| `minSize` | `?number` | Minum allowable size of panel (0.0 - 1.0)
|
|
42
43
|
| `order` | `?number` | Order of panel within group; required for groups with conditionally rendered panels
|
|
43
44
|
|
|
@@ -47,7 +48,7 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
|
47
48
|
| `children` | `?ReactNode` | Custom drag UI; can be any arbitrary React element(s)
|
|
48
49
|
| `className` | `?string` | Class name
|
|
49
50
|
| `disabled` | `?boolean` | Disable drag handle
|
|
50
|
-
| `id` | `?string` | Optional resize handle id (
|
|
51
|
+
| `id` | `?string` | Optional resize handle id (unique within group); falls back to `useId` when not provided
|
|
51
52
|
|
|
52
53
|
### `PanelContext`
|
|
53
54
|
| prop | type | description
|
|
@@ -3,11 +3,11 @@ type Direction = "horizontal" | "vertical";
|
|
|
3
3
|
export const PanelContext: import("react").Context<{
|
|
4
4
|
activeHandleId: string | null;
|
|
5
5
|
}>;
|
|
6
|
-
export function Panel({ children, className, defaultSize, id, minSize, order, }: {
|
|
6
|
+
export function Panel({ children, className, defaultSize, id: idFromProps, minSize, order, }: {
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
className?: string;
|
|
9
9
|
defaultSize?: number;
|
|
10
|
-
id
|
|
10
|
+
id?: string | null;
|
|
11
11
|
minSize?: number;
|
|
12
12
|
order?: number | null;
|
|
13
13
|
}): JSX.Element;
|
|
@@ -17,10 +17,11 @@ type Props = {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
direction: Direction;
|
|
19
19
|
height: number;
|
|
20
|
+
id?: string | null;
|
|
20
21
|
width: number;
|
|
21
22
|
};
|
|
22
|
-
export function PanelGroup({ autoSaveId, children, className, direction, height, width, }: Props): JSX.Element;
|
|
23
|
-
export function PanelResizeHandle({ children, className, disabled, id:
|
|
23
|
+
export function PanelGroup({ autoSaveId, children, className, direction, height, id: idFromProps, width, }: Props): JSX.Element;
|
|
24
|
+
export function PanelResizeHandle({ children, className, disabled, id: idFromProps, }: {
|
|
24
25
|
children?: ReactNode;
|
|
25
26
|
className?: string;
|
|
26
27
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";
|
|
1
|
+
{"mappings":";ACAA,iBAAwB,YAAY,GAAG,UAAU,CAAC;ACIlD,OAAO,MAAM;oBACK,MAAM,GAAG,IAAI;EAChB,CAAC;ACEhB,sBAA8B,EAC5B,QAAe,EACf,SAAc,EACd,WAAiB,EACjB,EAAE,EAAE,WAAkB,EACtB,OAAa,EACb,KAAY,GACb,EAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,eA+CA;AMlCD,aAAa;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAMF,2BAAmC,EACjC,UAAU,EACV,QAAe,EACf,SAAc,EACd,SAAS,EACT,MAAM,EACN,EAAE,EAAE,WAAkB,EACtB,KAAK,GACN,EAAE,KAAK,eAyOP;ACpRD,kCAA0C,EACxC,QAAe,EACf,SAAc,EACd,QAAgB,EAChB,EAAE,EAAE,WAAkB,GACvB,EAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,eAuGA","sources":["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.tsx","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/PanelGroup.tsx","packages/react-resizable-panels/src/src/PanelResizeHandle.tsx","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,"import Panel from \"./Panel\";\nimport { PanelContext } from \"./PanelContexts\";\nimport PanelGroup from \"./PanelGroup\";\nimport PanelResizeHandle from \"./PanelResizeHandle\";\n\nexport { Panel, PanelContext, PanelGroup, PanelResizeHandle };\n"],"names":[],"version":3,"file":"react-resizable-panels.d.ts.map"}
|
|
@@ -12,13 +12,24 @@ $parcel$export(module.exports, "PanelResizeHandle", () => $d578a49f00f1bdeb$expo
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
let $6d548a0d130941e3$var$counter = 0;
|
|
16
|
+
function $6d548a0d130941e3$export$2e2bcd8739ae039(idFromParams = null) {
|
|
17
|
+
const idFromUseId = typeof (0, $b2QPe$react.useId) === "function" ? (0, $b2QPe$react.useId)() : null;
|
|
18
|
+
const idRef = (0, $b2QPe$react.useRef)(idFromParams || idFromUseId || null);
|
|
19
|
+
if (idRef.current === null) idRef.current = "" + $6d548a0d130941e3$var$counter++;
|
|
20
|
+
return idRef.current;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
15
25
|
const $3251d17c1c3bce6c$export$f34532ac99e32150 = (0, $b2QPe$react.createContext)(null);
|
|
16
26
|
const $3251d17c1c3bce6c$export$7d8c6d083caec74a = (0, $b2QPe$react.createContext)(null);
|
|
17
27
|
|
|
18
28
|
|
|
19
|
-
function $6d390b7f2e6b107f$export$2e2bcd8739ae039({ children: children = null , className: className = "" , defaultSize: defaultSize = 0.1 , id:
|
|
29
|
+
function $6d390b7f2e6b107f$export$2e2bcd8739ae039({ children: children = null , className: className = "" , defaultSize: defaultSize = 0.1 , id: idFromProps = null , minSize: minSize = 0.1 , order: order = null }) {
|
|
20
30
|
const context = (0, $b2QPe$react.useContext)((0, $3251d17c1c3bce6c$export$7d8c6d083caec74a));
|
|
21
31
|
if (context === null) throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
32
|
+
const panelId = (0, $6d548a0d130941e3$export$2e2bcd8739ae039)(idFromProps);
|
|
22
33
|
if (minSize > defaultSize) {
|
|
23
34
|
console.error(`Panel minSize ${minSize} cannot be greater than defaultSize ${defaultSize}`);
|
|
24
35
|
defaultSize = minSize;
|
|
@@ -27,27 +38,27 @@ function $6d390b7f2e6b107f$export$2e2bcd8739ae039({ children: children = null ,
|
|
|
27
38
|
(0, $b2QPe$react.useLayoutEffect)(()=>{
|
|
28
39
|
const panel = {
|
|
29
40
|
defaultSize: defaultSize,
|
|
30
|
-
id:
|
|
41
|
+
id: panelId,
|
|
31
42
|
minSize: minSize,
|
|
32
43
|
order: order
|
|
33
44
|
};
|
|
34
|
-
registerPanel(
|
|
45
|
+
registerPanel(panelId, panel);
|
|
35
46
|
return ()=>{
|
|
36
|
-
unregisterPanel(
|
|
47
|
+
unregisterPanel(panelId);
|
|
37
48
|
};
|
|
38
49
|
}, [
|
|
39
50
|
defaultSize,
|
|
40
|
-
|
|
51
|
+
panelId,
|
|
41
52
|
minSize,
|
|
42
53
|
order,
|
|
43
54
|
registerPanel,
|
|
44
55
|
unregisterPanel
|
|
45
56
|
]);
|
|
46
|
-
const style = getPanelStyle(
|
|
57
|
+
const style = getPanelStyle(panelId);
|
|
47
58
|
return /*#__PURE__*/ (0, $b2QPe$reactjsxruntime.jsx)("div", {
|
|
48
59
|
className: className,
|
|
49
|
-
"data-panel-id":
|
|
50
|
-
id: `data-panel-id-${
|
|
60
|
+
"data-panel-id": panelId,
|
|
61
|
+
id: `data-panel-id-${panelId}`,
|
|
51
62
|
style: style,
|
|
52
63
|
children: children
|
|
53
64
|
});
|
|
@@ -58,15 +69,6 @@ function $6d390b7f2e6b107f$export$2e2bcd8739ae039({ children: children = null ,
|
|
|
58
69
|
|
|
59
70
|
|
|
60
71
|
|
|
61
|
-
let $6d548a0d130941e3$var$counter = 0;
|
|
62
|
-
function $6d548a0d130941e3$export$2e2bcd8739ae039(id = null) {
|
|
63
|
-
const idRef = (0, $b2QPe$react.useRef)(id);
|
|
64
|
-
if (idRef.current === null) idRef.current = "" + $6d548a0d130941e3$var$counter++;
|
|
65
|
-
return idRef.current;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
72
|
function $e045b0dd313f33c7$var$loadSerializedPanelGroupState(autoSaveId) {
|
|
71
73
|
try {
|
|
72
74
|
const serialized = localStorage.getItem(`PanelGroup:sizes:${autoSaveId}`);
|
|
@@ -191,9 +193,20 @@ function $d520236daad9c5d5$export$31b21d0167753bb4(panels, id, direction, sizes,
|
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
function $f5af57c8e042a4ad$export$ec391ce65b083ed4(event, handleId, direction, initialOffset = 0) {
|
|
197
|
+
const isHorizontal = direction === "horizontal";
|
|
198
|
+
let pointerOffset = 0;
|
|
199
|
+
if ($f5af57c8e042a4ad$export$764db16956f554f8(event)) pointerOffset = isHorizontal ? event.clientX : event.clientY;
|
|
200
|
+
else if ($f5af57c8e042a4ad$export$c4dfce035d43d1e0(event)) {
|
|
201
|
+
const firstTouch = event.touches[0];
|
|
202
|
+
pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;
|
|
203
|
+
} else return 0;
|
|
204
|
+
const handleElement = (0, $d520236daad9c5d5$export$2e27d3a347680388)(handleId);
|
|
205
|
+
const rect = handleElement.getBoundingClientRect();
|
|
206
|
+
const elementOffset = isHorizontal ? rect.left : rect.top;
|
|
207
|
+
return pointerOffset - elementOffset - initialOffset;
|
|
208
|
+
}
|
|
209
|
+
function $f5af57c8e042a4ad$export$354b17c0684607ed(event, handleId, { height: height , width: width }, direction, initialOffset) {
|
|
197
210
|
const isHorizontal = direction === "horizontal";
|
|
198
211
|
const size = isHorizontal ? width : height;
|
|
199
212
|
if ($f5af57c8e042a4ad$export$e7bf60a870f429b0(event)) {
|
|
@@ -215,27 +228,16 @@ function $f5af57c8e042a4ad$export$354b17c0684607ed(event, handleId, { height: he
|
|
|
215
228
|
if (isHorizontal) return -size;
|
|
216
229
|
else return -size;
|
|
217
230
|
}
|
|
218
|
-
} else
|
|
219
|
-
const handleElement = (0, $d520236daad9c5d5$export$2e27d3a347680388)(handleId);
|
|
220
|
-
const rect = handleElement.getBoundingClientRect();
|
|
221
|
-
const elementOffset = isHorizontal ? rect.left : rect.top;
|
|
222
|
-
let pointerOffset = 0;
|
|
223
|
-
if ($f5af57c8e042a4ad$export$5107d838cdd17dee(event)) pointerOffset = isHorizontal ? event.clientX : event.clientY;
|
|
224
|
-
else {
|
|
225
|
-
const firstTouch = event.touches[0];
|
|
226
|
-
pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;
|
|
227
|
-
}
|
|
228
|
-
return pointerOffset - elementOffset;
|
|
229
|
-
}
|
|
231
|
+
} else return $f5af57c8e042a4ad$export$ec391ce65b083ed4(event, handleId, direction, initialOffset);
|
|
230
232
|
}
|
|
231
233
|
function $f5af57c8e042a4ad$export$e7bf60a870f429b0(event) {
|
|
232
234
|
return event.type === "keydown";
|
|
233
235
|
}
|
|
234
|
-
function $f5af57c8e042a4ad$export$
|
|
235
|
-
return event.type
|
|
236
|
+
function $f5af57c8e042a4ad$export$764db16956f554f8(event) {
|
|
237
|
+
return event.type.startsWith("mouse");
|
|
236
238
|
}
|
|
237
|
-
function $f5af57c8e042a4ad$export$
|
|
238
|
-
return event.type
|
|
239
|
+
function $f5af57c8e042a4ad$export$c4dfce035d43d1e0(event) {
|
|
240
|
+
return event.type.startsWith("touch");
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
|
|
@@ -340,12 +342,14 @@ function $63be9a96d8675f03$export$33b0bea6ac3ffb03({ disabled: disabled , handle
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
+
|
|
346
|
+
function $d428eaeef644efb2$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , children: children = null , className: className = "" , direction: direction , height: height , id: idFromProps = null , width: width }) {
|
|
347
|
+
const groupId = (0, $6d548a0d130941e3$export$2e2bcd8739ae039)(idFromProps);
|
|
345
348
|
const [activeHandleId, setActiveHandleId] = (0, $b2QPe$react.useState)(null);
|
|
346
349
|
const [panels, setPanels] = (0, $b2QPe$react.useState)(new Map());
|
|
347
350
|
// 0-1 values representing the relative size of each panel.
|
|
348
351
|
const [sizes, setSizes] = (0, $b2QPe$react.useState)([]);
|
|
352
|
+
const dragOffsetRef = (0, $b2QPe$react.useRef)(0);
|
|
349
353
|
// Store committed values to avoid unnecessarily re-running memoization/effects functions.
|
|
350
354
|
const committedValuesRef = (0, $b2QPe$react.useRef)({
|
|
351
355
|
direction: direction,
|
|
@@ -449,7 +453,7 @@ function $d428eaeef644efb2$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
|
|
|
449
453
|
const movement = (0, $f5af57c8e042a4ad$export$354b17c0684607ed)(event, handleId, {
|
|
450
454
|
height: height,
|
|
451
455
|
width: width
|
|
452
|
-
}, direction);
|
|
456
|
+
}, direction, dragOffsetRef.current);
|
|
453
457
|
const isHorizontal = direction === "horizontal";
|
|
454
458
|
const delta = isHorizontal ? movement / width : movement / height;
|
|
455
459
|
const nextSizes = (0, $d520236daad9c5d5$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes);
|
|
@@ -473,7 +477,10 @@ function $d428eaeef644efb2$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
|
|
|
473
477
|
groupId: groupId,
|
|
474
478
|
registerPanel: registerPanel,
|
|
475
479
|
registerResizeHandle: registerResizeHandle,
|
|
476
|
-
startDragging: (id)=>
|
|
480
|
+
startDragging: (id, event)=>{
|
|
481
|
+
setActiveHandleId(id);
|
|
482
|
+
dragOffsetRef.current = (0, $f5af57c8e042a4ad$export$ec391ce65b083ed4)(event, id, direction);
|
|
483
|
+
},
|
|
477
484
|
stopDragging: ()=>{
|
|
478
485
|
setActiveHandleId(null);
|
|
479
486
|
},
|
|
@@ -497,6 +504,12 @@ function $d428eaeef644efb2$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
|
|
|
497
504
|
value: panelGroupContext,
|
|
498
505
|
children: /*#__PURE__*/ (0, $b2QPe$reactjsxruntime.jsx)("div", {
|
|
499
506
|
className: className,
|
|
507
|
+
"data-panel-group-id": groupId,
|
|
508
|
+
style: {
|
|
509
|
+
height: height,
|
|
510
|
+
position: "relative",
|
|
511
|
+
width: width
|
|
512
|
+
},
|
|
500
513
|
children: children
|
|
501
514
|
})
|
|
502
515
|
})
|
|
@@ -509,15 +522,15 @@ function $d428eaeef644efb2$export$2e2bcd8739ae039({ autoSaveId: autoSaveId , chi
|
|
|
509
522
|
|
|
510
523
|
|
|
511
524
|
|
|
512
|
-
function $d578a49f00f1bdeb$export$2e2bcd8739ae039({ children: children = null , className: className = "" , disabled: disabled = false , id:
|
|
525
|
+
function $d578a49f00f1bdeb$export$2e2bcd8739ae039({ children: children = null , className: className = "" , disabled: disabled = false , id: idFromProps = null }) {
|
|
513
526
|
const divElementRef = (0, $b2QPe$react.useRef)(null);
|
|
514
527
|
const panelContext = (0, $b2QPe$react.useContext)((0, $3251d17c1c3bce6c$export$f34532ac99e32150));
|
|
515
528
|
const panelGroupContext = (0, $b2QPe$react.useContext)((0, $3251d17c1c3bce6c$export$7d8c6d083caec74a));
|
|
516
529
|
if (panelContext === null || panelGroupContext === null) throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
517
|
-
const id = (0, $6d548a0d130941e3$export$2e2bcd8739ae039)(idProp);
|
|
518
530
|
const { activeHandleId: activeHandleId } = panelContext;
|
|
519
531
|
const { direction: direction , groupId: groupId , registerResizeHandle: registerResizeHandle , startDragging: startDragging , stopDragging: stopDragging } = panelGroupContext;
|
|
520
|
-
const
|
|
532
|
+
const resizeHandleId = (0, $6d548a0d130941e3$export$2e2bcd8739ae039)(idFromProps);
|
|
533
|
+
const isDragging = activeHandleId === resizeHandleId;
|
|
521
534
|
const [resizeHandler, setResizeHandler] = (0, $b2QPe$react.useState)(null);
|
|
522
535
|
const stopDraggingAndBlur = (0, $b2QPe$react.useCallback)(()=>{
|
|
523
536
|
// Clicking on the drag handle shouldn't leave it focused;
|
|
@@ -531,12 +544,12 @@ function $d578a49f00f1bdeb$export$2e2bcd8739ae039({ children: children = null ,
|
|
|
531
544
|
(0, $b2QPe$react.useEffect)(()=>{
|
|
532
545
|
if (disabled) setResizeHandler(null);
|
|
533
546
|
else {
|
|
534
|
-
const resizeHandler = registerResizeHandle(
|
|
547
|
+
const resizeHandler = registerResizeHandle(resizeHandleId);
|
|
535
548
|
setResizeHandler(()=>resizeHandler);
|
|
536
549
|
}
|
|
537
550
|
}, [
|
|
538
551
|
disabled,
|
|
539
|
-
|
|
552
|
+
resizeHandleId,
|
|
540
553
|
registerResizeHandle
|
|
541
554
|
]);
|
|
542
555
|
(0, $b2QPe$react.useEffect)(()=>{
|
|
@@ -545,12 +558,14 @@ function $d578a49f00f1bdeb$export$2e2bcd8739ae039({ children: children = null ,
|
|
|
545
558
|
const onMove = (event)=>{
|
|
546
559
|
resizeHandler(event);
|
|
547
560
|
};
|
|
561
|
+
document.body.addEventListener("contextmenu", stopDraggingAndBlur);
|
|
548
562
|
document.body.addEventListener("mouseleave", stopDraggingAndBlur);
|
|
549
563
|
document.body.addEventListener("mousemove", onMove);
|
|
550
564
|
document.body.addEventListener("touchmove", onMove);
|
|
551
565
|
document.body.addEventListener("mouseup", stopDraggingAndBlur);
|
|
552
566
|
return ()=>{
|
|
553
567
|
document.body.style.cursor = "";
|
|
568
|
+
document.body.removeEventListener("contextmenu", stopDraggingAndBlur);
|
|
554
569
|
document.body.removeEventListener("mouseleave", stopDraggingAndBlur);
|
|
555
570
|
document.body.removeEventListener("mousemove", onMove);
|
|
556
571
|
document.body.removeEventListener("touchmove", onMove);
|
|
@@ -565,24 +580,25 @@ function $d578a49f00f1bdeb$export$2e2bcd8739ae039({ children: children = null ,
|
|
|
565
580
|
]);
|
|
566
581
|
(0, $63be9a96d8675f03$export$33b0bea6ac3ffb03)({
|
|
567
582
|
disabled: disabled,
|
|
568
|
-
handleId:
|
|
583
|
+
handleId: resizeHandleId,
|
|
569
584
|
resizeHandler: resizeHandler
|
|
570
585
|
});
|
|
571
586
|
return /*#__PURE__*/ (0, $b2QPe$reactjsxruntime.jsx)("div", {
|
|
572
587
|
className: className,
|
|
573
588
|
"data-panel-group-id": groupId,
|
|
574
589
|
"data-panel-resize-handle-enabled": !disabled,
|
|
575
|
-
"data-panel-resize-handle-id":
|
|
576
|
-
onMouseDown: ()=>startDragging(
|
|
590
|
+
"data-panel-resize-handle-id": resizeHandleId,
|
|
591
|
+
onMouseDown: (event)=>startDragging(resizeHandleId, event.nativeEvent),
|
|
577
592
|
onMouseUp: stopDraggingAndBlur,
|
|
578
593
|
onTouchCancel: stopDraggingAndBlur,
|
|
579
594
|
onTouchEnd: stopDraggingAndBlur,
|
|
580
|
-
onTouchStart: ()=>startDragging(
|
|
595
|
+
onTouchStart: (event)=>startDragging(resizeHandleId, event.nativeEvent),
|
|
581
596
|
ref: divElementRef,
|
|
582
597
|
role: "separator",
|
|
583
598
|
style: {
|
|
584
599
|
cursor: direction === "horizontal" ? "ew-resize" : "ns-resize",
|
|
585
|
-
touchAction: "none"
|
|
600
|
+
touchAction: "none",
|
|
601
|
+
userSelect: "none"
|
|
586
602
|
},
|
|
587
603
|
tabIndex: 0,
|
|
588
604
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mapp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I,CAAC,mBAAmB,CAAC,aAAa;YAC/C,SAAS,IAAI,CAAC,mBAAmB,CAAC,aAAa;YAC/C,SAAS,IAAI,CAAC,mBAAmB,CAAC,WAAW;QAC/C;IACF,GAAG;QAAC;QAAW;QAAU;QAAY;QAAe;KAAoB;IAExE,CAAA,GAAA,yCAAsC,AAAD,EAAE;kBACrC;QACA,UAAU;uBACV;IACF;IAEA,qBACE,gCAAC;QACC,WAAW;QACX,uBAAqB;QACrB,oCAAkC,CAAC;QACnC,+BAA6B;QAC7B,aAAa,IAAM,cAAc;QACjC,WAAW;QACX,eAAe;QACf,YAAY;QACZ,cAAc,IAAM,cAAc;QAClC,KAAK;QACL,MAAK;QACL,OAAO;YACL,QAAQ,cAAc,eAAe,cAAc,WAAW;YAC9D,aAAa;QACf;QACA,UAAU;kBAET;;AAGP;","sources":["packages/react-resizable-panels/src/index.ts","packages/react-resizable-panels/src/Panel.tsx","packages/react-resizable-panels/src/PanelContexts.ts","packages/react-resizable-panels/src/PanelGroup.tsx","packages/react-resizable-panels/src/hooks/useUniqueId.ts","packages/react-resizable-panels/src/utils/serialization.ts","packages/react-resizable-panels/src/utils/coordinates.ts","packages/react-resizable-panels/src/utils/group.ts","packages/react-resizable-panels/src/constants.ts","packages/react-resizable-panels/src/hooks/useWindowSplitterBehavior.ts","packages/react-resizable-panels/src/PanelResizeHandle.tsx"],"sourcesContent":["import Panel from \"./Panel\";\nimport { PanelContext } from \"./PanelContexts\";\nimport PanelGroup from \"./PanelGroup\";\nimport PanelResizeHandle from \"./PanelResizeHandle\";\n\nexport { Panel, PanelContext, PanelGroup, PanelResizeHandle };\n","import { ReactNode, useContext, useLayoutEffect } from \"react\";\n\nimport { PanelGroupContext } from \"./PanelContexts\";\n\n// TODO [panels]\n// Support min pixel size too.\n// PanelGroup should warn if total width is less min pixel widths.\nexport default function Panel({\n children = null,\n className = \"\",\n defaultSize = 0.1,\n id,\n minSize = 0.1,\n order = null,\n}: {\n children?: ReactNode;\n className?: string;\n defaultSize?: number;\n id: string;\n minSize?: number;\n order?: number | null;\n}) {\n const context = useContext(PanelGroupContext);\n if (context === null) {\n throw Error(\n `Panel components must be rendered within a PanelGroup container`\n );\n }\n\n if (minSize > defaultSize) {\n console.error(\n `Panel minSize ${minSize} cannot be greater than defaultSize ${defaultSize}`\n );\n\n defaultSize = minSize;\n }\n\n const { getPanelStyle, registerPanel, unregisterPanel } = context;\n\n useLayoutEffect(() => {\n const panel = {\n defaultSize,\n id,\n minSize,\n order,\n };\n\n registerPanel(id, panel);\n\n return () => {\n unregisterPanel(id);\n };\n }, [defaultSize, id, minSize, order, registerPanel, unregisterPanel]);\n\n const style = getPanelStyle(id);\n\n return (\n <div\n className={className}\n data-panel-id={id}\n id={`data-panel-id-${id}`}\n style={style}\n >\n {children}\n </div>\n );\n}\n","import { CSSProperties, createContext } from \"react\";\n\nimport { PanelData, ResizeHandler } from \"./types\";\n\nexport const PanelContext = createContext<{\n activeHandleId: string | null;\n} | null>(null);\n\nexport const PanelGroupContext = createContext<{\n direction: \"horizontal\" | \"vertical\";\n getPanelStyle: (id: string) => CSSProperties;\n groupId: string;\n registerPanel: (id: string, panel: PanelData) => void;\n registerResizeHandle: (id: string) => ResizeHandler;\n startDragging: (id: string) => void;\n stopDragging: () => void;\n unregisterPanel: (id: string) => void;\n} | null>(null);\n","import {\n CSSProperties,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport useUniqueId from \"./hooks/useUniqueId\";\n\nimport { PanelContext, PanelGroupContext } from \"./PanelContexts\";\nimport { Direction, PanelData, ResizeEvent } from \"./types\";\nimport { loadPanelLayout, savePanelGroupLayout } from \"./utils/serialization\";\nimport { getMovement } from \"./utils/coordinates\";\nimport {\n adjustByDelta,\n getOffset,\n getResizeHandlePanelIds,\n getSize,\n panelsMapToSortedArray,\n} from \"./utils/group\";\nimport { useWindowSplitterPanelGroupBehavior } from \"./hooks/useWindowSplitterBehavior\";\n\nexport type CommittedValues = {\n direction: Direction;\n height: number;\n panels: Map<string, PanelData>;\n sizes: number[];\n width: number;\n};\n\nexport type PanelDataMap = Map<string, PanelData>;\n\ntype Props = {\n autoSaveId?: string;\n children?: ReactNode;\n className?: string;\n direction: Direction;\n height: number;\n width: number;\n};\n\n// TODO [panels]\n// Within an active drag, remember original positions to refine more easily on expand.\n// Look at what the Chrome devtools Sources does.\n\nexport default function PanelGroup({\n autoSaveId,\n children = null,\n className = \"\",\n direction,\n height,\n width,\n}: Props) {\n const groupId = useUniqueId();\n\n const [activeHandleId, setActiveHandleId] = useState<string | null>(null);\n const [panels, setPanels] = useState<PanelDataMap>(new Map());\n\n // 0-1 values representing the relative size of each panel.\n const [sizes, setSizes] = useState<number[]>([]);\n\n // Store committed values to avoid unnecessarily re-running memoization/effects functions.\n const committedValuesRef = useRef<CommittedValues>({\n direction,\n height,\n panels,\n sizes,\n width,\n });\n\n useLayoutEffect(() => {\n committedValuesRef.current.direction = direction;\n committedValuesRef.current.height = height;\n committedValuesRef.current.panels = panels;\n committedValuesRef.current.sizes = sizes;\n committedValuesRef.current.width = width;\n });\n\n useWindowSplitterPanelGroupBehavior({\n committedValuesRef,\n groupId,\n panels,\n setSizes,\n sizes,\n });\n\n // Once all panels have registered themselves,\n // Compute the initial sizes based on default weights.\n // This assumes that panels register during initial mount (no conditional rendering)!\n useLayoutEffect(() => {\n const sizes = committedValuesRef.current.sizes;\n if (sizes.length === panels.size) {\n return;\n }\n\n // TODO [panels]\n // Validate that the total minSize is <= 1.\n\n // If this panel has been configured to persist sizing information,\n // default size should be restored from local storage if possible.\n let defaultSizes: number[] | undefined = undefined;\n if (autoSaveId) {\n const panelIds = panelsMapToSortedArray(panels).map((panel) => panel.id);\n defaultSizes = loadPanelLayout(autoSaveId, panelIds);\n }\n\n if (defaultSizes != null) {\n setSizes(defaultSizes);\n } else {\n const panelsArray = panelsMapToSortedArray(panels);\n const totalWeight = panelsArray.reduce((weight, panel) => {\n return weight + panel.defaultSize;\n }, 0);\n\n setSizes(panelsArray.map((panel) => panel.defaultSize / totalWeight));\n }\n }, [autoSaveId, panels]);\n\n useEffect(() => {\n // If this panel has been configured to persist sizing information, save sizes to local storage.\n if (autoSaveId) {\n if (sizes.length === 0 || sizes.length !== panels.size) {\n return;\n }\n\n const panelIds = panelsMapToSortedArray(panels).map((panel) => panel.id);\n savePanelGroupLayout(autoSaveId, panelIds, sizes);\n }\n }, [autoSaveId, panels, sizes]);\n\n const getPanelStyle = useCallback(\n (id: string): CSSProperties => {\n const { panels } = committedValuesRef.current;\n\n const offset = getOffset(panels, id, direction, sizes, height, width);\n const size = getSize(panels, id, direction, sizes, height, width);\n\n if (direction === \"horizontal\") {\n return {\n height: \"100%\",\n position: \"absolute\",\n left: offset,\n top: 0,\n width: size,\n };\n } else {\n return {\n height: size,\n position: \"absolute\",\n left: 0,\n top: offset,\n width: \"100%\",\n };\n }\n },\n [direction, height, sizes, width]\n );\n\n const registerPanel = useCallback((id: string, panel: PanelData) => {\n setPanels((prevPanels) => {\n if (prevPanels.has(id)) {\n return prevPanels;\n }\n\n const nextPanels = new Map(prevPanels);\n nextPanels.set(id, panel);\n\n return nextPanels;\n });\n }, []);\n\n const registerResizeHandle = useCallback(\n (handleId: string) => {\n const resizeHandler = (event: ResizeEvent) => {\n event.preventDefault();\n\n const {\n direction,\n height,\n panels,\n sizes: prevSizes,\n width,\n } = committedValuesRef.current;\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const [idBefore, idAfter] = getResizeHandlePanelIds(\n groupId,\n handleId,\n panelsArray\n );\n if (idBefore == null || idAfter == null) {\n return;\n }\n\n const movement = getMovement(\n event,\n handleId,\n { height, width },\n direction\n );\n\n const isHorizontal = direction === \"horizontal\";\n const delta = isHorizontal ? movement / width : movement / height;\n\n const nextSizes = adjustByDelta(\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes\n );\n if (prevSizes !== nextSizes) {\n setSizes(nextSizes);\n }\n };\n\n return resizeHandler;\n },\n [groupId]\n );\n\n const unregisterPanel = useCallback((id: string) => {\n setPanels((prevPanels) => {\n if (!prevPanels.has(id)) {\n return prevPanels;\n }\n\n const nextPanels = new Map(prevPanels);\n nextPanels.delete(id);\n\n return nextPanels;\n });\n }, []);\n\n const panelGroupContext = useMemo(\n () => ({\n direction,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n startDragging: (id: string) => setActiveHandleId(id),\n stopDragging: () => {\n setActiveHandleId(null);\n },\n unregisterPanel,\n }),\n [\n direction,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n unregisterPanel,\n ]\n );\n\n const panelContext = useMemo(\n () => ({\n activeHandleId,\n }),\n [activeHandleId]\n );\n\n return (\n <PanelContext.Provider value={panelContext}>\n <PanelGroupContext.Provider value={panelGroupContext}>\n <div className={className}>{children}</div>\n </PanelGroupContext.Provider>\n </PanelContext.Provider>\n );\n}\n","import { useRef } from \"react\";\n\nlet counter = 0;\n\nexport default function useUniqueId(id: string | null = null): string {\n const idRef = useRef<string | null>(id);\n if (idRef.current === null) {\n idRef.current = \"\" + counter++;\n }\n\n return idRef.current;\n}\n","import { PanelData } from \"../types\";\n\ntype SerializedPanelGroupState = { [panelIds: string]: number[] };\n\nfunction loadSerializedPanelGroupState(\n autoSaveId: string\n): SerializedPanelGroupState | null {\n try {\n const serialized = localStorage.getItem(`PanelGroup:sizes:${autoSaveId}`);\n if (serialized) {\n const parsed = JSON.parse(serialized);\n if (typeof parsed === \"object\" && parsed != null) {\n return parsed;\n }\n }\n } catch (error) {}\n\n return null;\n}\n\nexport function loadPanelLayout(\n autoSaveId: string,\n panelIds: string[]\n): number[] | null {\n const state = loadSerializedPanelGroupState(autoSaveId);\n if (state) {\n return state[panelIds.join(\",\")] ?? null;\n }\n\n return null;\n}\n\nexport function savePanelGroupLayout(\n autoSaveId: string,\n panelIds: string[],\n sizes: number[]\n): void {\n const state = loadSerializedPanelGroupState(autoSaveId) || {};\n state[panelIds.join(\",\")] = sizes;\n\n try {\n localStorage.setItem(\n `PanelGroup:sizes:${autoSaveId}`,\n JSON.stringify(state)\n );\n } catch (error) {\n console.error(error);\n }\n}\n","import { Direction, ResizeEvent } from \"../types\";\nimport { getResizeHandle } from \"./group\";\n\nexport type Coordinates = {\n movement: number;\n offset: number;\n};\n\nexport type Size = {\n height: number;\n width: number;\n};\n\nconst element = document.createElement(\"div\");\nelement.getBoundingClientRect();\n\n// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX\nexport function getMovement(\n event: ResizeEvent,\n handleId: string,\n { height, width }: Size,\n direction: Direction\n): number {\n const isHorizontal = direction === \"horizontal\";\n const size = isHorizontal ? width : height;\n\n if (isKeyDown(event)) {\n const denominator = event.shiftKey ? 10 : 100;\n const delta = size / denominator;\n\n switch (event.key) {\n case \"ArrowDown\":\n return delta;\n case \"ArrowLeft\":\n return -delta;\n case \"ArrowRight\":\n return delta;\n case \"ArrowUp\":\n return -delta;\n case \"End\":\n if (isHorizontal) {\n return size;\n } else {\n return size;\n }\n case \"Home\":\n if (isHorizontal) {\n return -size;\n } else {\n return -size;\n }\n }\n } else {\n const handleElement = getResizeHandle(handleId)!;\n const rect = handleElement.getBoundingClientRect();\n const elementOffset = isHorizontal ? rect.left : rect.top;\n\n let pointerOffset = 0;\n if (isMouseMoveEvent(event)) {\n pointerOffset = isHorizontal ? event.clientX : event.clientY;\n } else {\n const firstTouch = event.touches[0];\n pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;\n }\n\n return pointerOffset - elementOffset;\n }\n}\n\nexport function isKeyDown(event: ResizeEvent): event is KeyboardEvent {\n return event.type === \"keydown\";\n}\n\nexport function isMouseMoveEvent(event: ResizeEvent): event is MouseEvent {\n return event.type === \"mousemove\";\n}\n\nexport function isTouchMoveEvent(event: ResizeEvent): event is TouchEvent {\n return event.type === \"touchmove\";\n}\n","import { PRECISION } from \"../constants\";\nimport { Direction, PanelData } from \"../types\";\n\nexport function adjustByDelta(\n panels: Map<string, PanelData>,\n idBefore: string,\n idAfter: string,\n delta: number,\n prevSizes: number[]\n): number[] {\n if (delta === 0) {\n return prevSizes;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const nextSizes = prevSizes.concat();\n\n let deltaApplied = 0;\n\n // A resizing panel affects the panels before or after it.\n //\n // A negative delta means the panel immediately after the resizer should grow/expand by decreasing its offset.\n // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.\n //\n // A positive delta means the panel immediately before the resizer should \"expand\".\n // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resizer.\n let pivotId = delta < 0 ? idBefore : idAfter;\n let index = panelsArray.findIndex((panel) => panel.id === pivotId);\n while (true) {\n const panel = panelsArray[index];\n const prevSize = prevSizes[index];\n const nextSize = Math.max(prevSize - Math.abs(delta), panel.minSize);\n if (prevSize !== nextSize) {\n deltaApplied += prevSize - nextSize;\n\n nextSizes[index] = nextSize;\n\n if (deltaApplied.toPrecision(PRECISION) >= delta.toPrecision(PRECISION)) {\n break;\n }\n }\n\n if (delta < 0) {\n if (--index < 0) {\n break;\n }\n } else {\n if (++index >= panelsArray.length) {\n break;\n }\n }\n }\n\n // If we were unable to resize any of the panels panels, return the previous state.\n // This will essentially bailout and ignore the \"mousemove\" event.\n if (deltaApplied === 0) {\n return prevSizes;\n }\n\n // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.\n pivotId = delta < 0 ? idAfter : idBefore;\n index = panelsArray.findIndex((panel) => panel.id === pivotId);\n nextSizes[index] = prevSizes[index] + deltaApplied;\n\n return nextSizes;\n}\n\nexport function getOffset(\n panels: Map<string, PanelData>,\n id: string,\n direction: Direction,\n sizes: number[],\n height: number,\n width: number\n): number {\n const panelsArray = panelsMapToSortedArray(panels);\n\n let index = panelsArray.findIndex((panel) => panel.id === id);\n if (index < 0) {\n return 0;\n }\n\n let scaledOffset = 0;\n\n for (index = index - 1; index >= 0; index--) {\n const panel = panelsArray[index];\n scaledOffset += getSize(panels, panel.id, direction, sizes, height, width);\n }\n\n return Math.round(scaledOffset);\n}\n\nexport function getPanel(id: string): HTMLDivElement | null {\n const element = document.querySelector(`[data-panel-id=\"${id}\"]`);\n if (element) {\n return element as HTMLDivElement;\n }\n return null;\n}\n\nexport function getResizeHandle(id: string): HTMLDivElement | null {\n const element = document.querySelector(\n `[data-panel-resize-handle-id=\"${id}\"]`\n );\n if (element) {\n return element as HTMLDivElement;\n }\n return null;\n}\n\nexport function getResizeHandleIndex(id: string): number | null {\n const handles = getResizeHandles();\n const index = handles.findIndex(\n (handle) => handle.getAttribute(\"data-panel-resize-handle-id\") === id\n );\n return index ?? null;\n}\n\nexport function getResizeHandles(): HTMLDivElement[] {\n return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id]`));\n}\n\nexport function getResizeHandlesForGroup(groupId: string): HTMLDivElement[] {\n return Array.from(\n document.querySelectorAll(\n `[data-panel-resize-handle-id][data-panel-group-id=\"${groupId}\"]`\n )\n );\n}\n\nexport function getResizeHandlePanelIds(\n groupId: string,\n handleId: string,\n panelsArray: PanelData[]\n): [idBefore: string | null, idAfter: string | null] {\n const handle = getResizeHandle(handleId);\n const handles = getResizeHandlesForGroup(groupId);\n const index = handles.indexOf(handle);\n\n const idBefore: string | null = panelsArray[index]?.id ?? null;\n const idAfter: string | null = panelsArray[index + 1]?.id ?? null;\n\n return [idBefore, idAfter];\n}\n\nexport function panelsMapToSortedArray(\n panels: Map<string, PanelData>\n): PanelData[] {\n return Array.from(panels.values()).sort((a, b) => a.order - b.order);\n}\n\nexport function getSize(\n panels: Map<string, PanelData>,\n id: string,\n direction: Direction,\n sizes: number[],\n height: number,\n width: number\n): number {\n const totalSize = direction === \"horizontal\" ? width : height;\n\n if (panels.size === 1) {\n return totalSize;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.findIndex((panel) => panel.id === id);\n const size = sizes[index];\n if (size == null) {\n return 0;\n }\n\n return Math.round(size * totalSize);\n}\n","export const PRECISION = 5;\n","import { RefObject, useEffect } from \"react\";\nimport { PRECISION } from \"../constants\";\n\nimport { CommittedValues, PanelDataMap } from \"../PanelGroup\";\nimport { ResizeHandler } from \"../types\";\nimport {\n adjustByDelta,\n getPanel,\n getResizeHandle,\n getResizeHandleIndex,\n getResizeHandlePanelIds,\n getResizeHandles,\n getResizeHandlesForGroup,\n getSize,\n panelsMapToSortedArray,\n} from \"../utils/group\";\n\n// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\nexport function useWindowSplitterPanelGroupBehavior({\n committedValuesRef,\n groupId,\n panels,\n setSizes,\n sizes,\n}: {\n committedValuesRef: RefObject<CommittedValues>;\n groupId: string;\n panels: PanelDataMap;\n setSizes: (sizes: number[]) => void;\n sizes: number[];\n}): void {\n useEffect(() => {\n const { direction, height, panels, width } = committedValuesRef.current;\n\n const handles = getResizeHandlesForGroup(groupId);\n const cleanupFunctions = handles.map((handle) => {\n const handleId = handle.getAttribute(\"data-panel-resize-handle-id\");\n const panelsArray = panelsMapToSortedArray(panels);\n\n const [idBefore, idAfter] = getResizeHandlePanelIds(\n groupId,\n handleId,\n panelsArray\n );\n if (idBefore == null || idAfter == null) {\n return () => {};\n }\n\n const ariaValueMax = panelsArray.reduce((difference, panel) => {\n if (panel.id !== idBefore) {\n return difference - panel.minSize;\n }\n return difference;\n }, 1);\n\n const ariaValueMin =\n panelsArray.find((panel) => panel.id == idBefore)?.minSize ?? 0;\n\n const size = getSize(panels, idBefore, direction, sizes, height, width);\n const ariaValueNow = size / (direction === \"horizontal\" ? width : height);\n\n handle.setAttribute(\"aria-valuemax\", \"\" + Math.round(100 * ariaValueMax));\n handle.setAttribute(\"aria-valuemin\", \"\" + Math.round(100 * ariaValueMin));\n handle.setAttribute(\"aria-valuenow\", \"\" + Math.round(100 * ariaValueNow));\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Enter\": {\n const index = panelsArray.findIndex(\n (panel) => panel.id === idBefore\n );\n if (index >= 0) {\n const panelData = panelsArray[index];\n const size = sizes[index];\n if (size != null) {\n let delta = 0;\n if (\n size.toPrecision(PRECISION) <=\n panelData.minSize.toPrecision(PRECISION)\n ) {\n delta = direction === \"horizontal\" ? width : height;\n } else {\n delta = -(direction === \"horizontal\" ? width : height);\n }\n\n const nextSizes = adjustByDelta(\n panels,\n idBefore,\n idAfter,\n delta,\n sizes\n );\n if (sizes !== nextSizes) {\n setSizes(nextSizes);\n }\n }\n }\n break;\n }\n }\n };\n\n handle.addEventListener(\"keydown\", onKeyDown);\n\n const panelBefore = getPanel(idBefore);\n if (panelBefore != null) {\n handle.setAttribute(\"aria-controls\", panelBefore.id);\n }\n\n return () => {\n handle.removeAttribute(\"aria-valuemax\");\n handle.removeAttribute(\"aria-valuemin\");\n handle.removeAttribute(\"aria-valuenow\");\n\n handle.removeEventListener(\"keydown\", onKeyDown);\n\n if (panelBefore != null) {\n handle.removeAttribute(\"aria-controls\");\n }\n };\n });\n\n return () => {\n cleanupFunctions.forEach((cleanupFunction) => cleanupFunction());\n };\n }, [groupId, panels, sizes]);\n}\n\nexport function useWindowSplitterResizeHandlerBehavior({\n disabled,\n handleId,\n resizeHandler,\n}: {\n disabled: boolean;\n handleId: string;\n resizeHandler: ResizeHandler | null;\n}): void {\n useEffect(() => {\n if (disabled || resizeHandler == null) {\n return;\n }\n\n const handleElement = getResizeHandle(handleId);\n if (handleElement == null) {\n return;\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowDown\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"ArrowUp\":\n case \"End\":\n case \"Home\": {\n resizeHandler(event);\n break;\n }\n case \"F6\": {\n const handles = getResizeHandles();\n const index = getResizeHandleIndex(handleId);\n\n const nextIndex = event.shiftKey\n ? index > 0\n ? index - 1\n : handles.length - 1\n : index + 1 < handles.length\n ? index + 1\n : 0;\n\n const nextHandle = handles[nextIndex] as HTMLDivElement;\n nextHandle.focus();\n\n break;\n }\n }\n };\n\n handleElement.addEventListener(\"keydown\", onKeyDown);\n return () => {\n handleElement.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [disabled, handleId, resizeHandler]);\n}\n","import {\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport useUniqueId from \"./hooks/useUniqueId\";\nimport { useWindowSplitterResizeHandlerBehavior } from \"./hooks/useWindowSplitterBehavior\";\nimport { PanelContext, PanelGroupContext } from \"./PanelContexts\";\nimport type { ResizeHandler, ResizeEvent } from \"./types\";\n\nexport default function PanelResizeHandle({\n children = null,\n className = \"\",\n disabled = false,\n id: idProp = null,\n}: {\n children?: ReactNode;\n className?: string;\n disabled?: boolean;\n id?: string | null;\n}) {\n const divElementRef = useRef<HTMLDivElement>(null);\n\n const panelContext = useContext(PanelContext);\n const panelGroupContext = useContext(PanelGroupContext);\n if (panelContext === null || panelGroupContext === null) {\n throw Error(\n `PanelResizeHandle components must be rendered within a PanelGroup container`\n );\n }\n\n const id = useUniqueId(idProp);\n\n const { activeHandleId } = panelContext;\n const {\n direction,\n groupId,\n registerResizeHandle,\n startDragging,\n stopDragging,\n } = panelGroupContext;\n\n const isDragging = activeHandleId === id;\n\n const [resizeHandler, setResizeHandler] = useState<ResizeHandler | null>(\n null\n );\n\n const stopDraggingAndBlur = useCallback(() => {\n // Clicking on the drag handle shouldn't leave it focused;\n // That would cause the PanelGroup to think it was still active.\n const div = divElementRef.current!;\n div.blur();\n\n stopDragging();\n }, [stopDragging]);\n\n useEffect(() => {\n if (disabled) {\n setResizeHandler(null);\n } else {\n const resizeHandler = registerResizeHandle(id);\n setResizeHandler(() => resizeHandler);\n }\n }, [disabled, id, registerResizeHandle]);\n\n useEffect(() => {\n if (disabled || resizeHandler == null || !isDragging) {\n return;\n }\n\n document.body.style.cursor =\n direction === \"horizontal\" ? \"ew-resize\" : \"ns-resize\";\n\n const onMove = (event: ResizeEvent) => {\n resizeHandler(event);\n };\n\n document.body.addEventListener(\"mouseleave\", stopDraggingAndBlur);\n document.body.addEventListener(\"mousemove\", onMove);\n document.body.addEventListener(\"touchmove\", onMove);\n document.body.addEventListener(\"mouseup\", stopDraggingAndBlur);\n\n return () => {\n document.body.style.cursor = \"\";\n\n document.body.removeEventListener(\"mouseleave\", stopDraggingAndBlur);\n document.body.removeEventListener(\"mousemove\", onMove);\n document.body.removeEventListener(\"touchmove\", onMove);\n document.body.removeEventListener(\"mouseup\", stopDraggingAndBlur);\n };\n }, [direction, disabled, isDragging, resizeHandler, stopDraggingAndBlur]);\n\n useWindowSplitterResizeHandlerBehavior({\n disabled,\n handleId: id,\n resizeHandler,\n });\n\n return (\n <div\n className={className}\n data-panel-group-id={groupId}\n data-panel-resize-handle-enabled={!disabled}\n data-panel-resize-handle-id={id}\n onMouseDown={() => startDragging(id)}\n onMouseUp={stopDraggingAndBlur}\n onTouchCancel={stopDraggingAndBlur}\n onTouchEnd={stopDraggingAndBlur}\n onTouchStart={() => startDragging(id)}\n ref={divElementRef}\n role=\"separator\"\n style={{\n cursor: direction === \"horizontal\" ? \"ew-resize\" : \"ns-resize\",\n touchAction: \"none\",\n }}\n tabIndex={0}\n >\n {children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"react-resizable-panels.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;ACAA;;ACAA;AAEA,IAAI,gCAAU;AAEC,kDACb,eAA8B,IAAI,EAC1B;IACR,MAAM,cAAc,OAAO,CAAA,GAAA,kBAAK,AAAD,MAAM,aAAa,CAAA,GAAA,kBAAK,AAAD,MAAM,IAAI;IAEhE,MAAM,QAAQ,CAAA,GAAA,mBAAM,AAAD,EAAiB,gBAAgB,eAAe,IAAI;IACvE,IAAI,MAAM,OAAO,KAAK,IAAI,EACxB,MAAM,OAAO,GAAG,KAAK;IAGvB,OAAO,MAAM,OAAO;AACtB;;;ACfA;AAIO,MAAM,4CAAe,CAAA,GAAA,0BAAY,EAE9B,IAAI;AAEP,MAAM,4CAAoB,CAAA,GAAA,0BAAY,EASnC,IAAI;;;AF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AI,CAAC,gBAAgB,CAAC,WAAW;QAE1C,OAAO,IAAM;YACX,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG;YAE7B,SAAS,IAAI,CAAC,mBAAmB,CAAC,eAAe;YACjD,SAAS,IAAI,CAAC,mBAAmB,CAAC,cAAc;YAChD,SAAS,IAAI,CAAC,mBAAmB,CAAC,aAAa;YAC/C,SAAS,IAAI,CAAC,mBAAmB,CAAC,aAAa;YAC/C,SAAS,IAAI,CAAC,mBAAmB,CAAC,WAAW;QAC/C;IACF,GAAG;QAAC;QAAW;QAAU;QAAY;QAAe;KAAoB;IAExE,CAAA,GAAA,yCAAsC,AAAD,EAAE;kBACrC;QACA,UAAU;uBACV;IACF;IAEA,qBACE,gCAAC;QACC,WAAW;QACX,uBAAqB;QACrB,oCAAkC,CAAC;QACnC,+BAA6B;QAC7B,aAAa,CAAC,QAAU,cAAc,gBAAgB,MAAM,WAAW;QACvE,WAAW;QACX,eAAe;QACf,YAAY;QACZ,cAAc,CAAC,QAAU,cAAc,gBAAgB,MAAM,WAAW;QACxE,KAAK;QACL,MAAK;QACL,OAAO;YACL,QAAQ,cAAc,eAAe,cAAc,WAAW;YAC9D,aAAa;YACb,YAAY;QACd;QACA,UAAU;kBAET;;AAGP;","sources":["packages/react-resizable-panels/src/index.ts","packages/react-resizable-panels/src/Panel.tsx","packages/react-resizable-panels/src/hooks/useUniqueId.ts","packages/react-resizable-panels/src/PanelContexts.ts","packages/react-resizable-panels/src/PanelGroup.tsx","packages/react-resizable-panels/src/utils/serialization.ts","packages/react-resizable-panels/src/utils/coordinates.ts","packages/react-resizable-panels/src/utils/group.ts","packages/react-resizable-panels/src/constants.ts","packages/react-resizable-panels/src/hooks/useWindowSplitterBehavior.ts","packages/react-resizable-panels/src/PanelResizeHandle.tsx"],"sourcesContent":["import Panel from \"./Panel\";\nimport { PanelContext } from \"./PanelContexts\";\nimport PanelGroup from \"./PanelGroup\";\nimport PanelResizeHandle from \"./PanelResizeHandle\";\n\nexport { Panel, PanelContext, PanelGroup, PanelResizeHandle };\n","import { ReactNode, useContext, useLayoutEffect } from \"react\";\nimport useUniqueId from \"./hooks/useUniqueId\";\n\nimport { PanelGroupContext } from \"./PanelContexts\";\n\n// TODO [panels]\n// Support min pixel size too.\n// PanelGroup should warn if total width is less min pixel widths.\nexport default function Panel({\n children = null,\n className = \"\",\n defaultSize = 0.1,\n id: idFromProps = null,\n minSize = 0.1,\n order = null,\n}: {\n children?: ReactNode;\n className?: string;\n defaultSize?: number;\n id?: string | null;\n minSize?: number;\n order?: number | null;\n}) {\n const context = useContext(PanelGroupContext);\n if (context === null) {\n throw Error(\n `Panel components must be rendered within a PanelGroup container`\n );\n }\n\n const panelId = useUniqueId(idFromProps);\n\n if (minSize > defaultSize) {\n console.error(\n `Panel minSize ${minSize} cannot be greater than defaultSize ${defaultSize}`\n );\n\n defaultSize = minSize;\n }\n\n const { getPanelStyle, registerPanel, unregisterPanel } = context;\n\n useLayoutEffect(() => {\n const panel = {\n defaultSize,\n id: panelId,\n minSize,\n order,\n };\n\n registerPanel(panelId, panel);\n\n return () => {\n unregisterPanel(panelId);\n };\n }, [defaultSize, panelId, minSize, order, registerPanel, unregisterPanel]);\n\n const style = getPanelStyle(panelId);\n\n return (\n <div\n className={className}\n data-panel-id={panelId}\n id={`data-panel-id-${panelId}`}\n style={style}\n >\n {children}\n </div>\n );\n}\n","import { useId, useRef } from \"react\";\n\nlet counter = 0;\n\nexport default function useUniqueId(\n idFromParams: string | null = null\n): string {\n const idFromUseId = typeof useId === \"function\" ? useId() : null;\n\n const idRef = useRef<string | null>(idFromParams || idFromUseId || null);\n if (idRef.current === null) {\n idRef.current = \"\" + counter++;\n }\n\n return idRef.current;\n}\n","import { CSSProperties, createContext } from \"react\";\n\nimport { PanelData, ResizeEvent, ResizeHandler } from \"./types\";\n\nexport const PanelContext = createContext<{\n activeHandleId: string | null;\n} | null>(null);\n\nexport const PanelGroupContext = createContext<{\n direction: \"horizontal\" | \"vertical\";\n getPanelStyle: (id: string) => CSSProperties;\n groupId: string;\n registerPanel: (id: string, panel: PanelData) => void;\n registerResizeHandle: (id: string) => ResizeHandler;\n startDragging: (id: string, event: ResizeEvent) => void;\n stopDragging: () => void;\n unregisterPanel: (id: string) => void;\n} | null>(null);\n","import {\n CSSProperties,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { PanelContext, PanelGroupContext } from \"./PanelContexts\";\nimport { Direction, PanelData, ResizeEvent } from \"./types\";\nimport { loadPanelLayout, savePanelGroupLayout } from \"./utils/serialization\";\nimport { getDragOffset, getMovement } from \"./utils/coordinates\";\nimport {\n adjustByDelta,\n getOffset,\n getResizeHandlePanelIds,\n getSize,\n panelsMapToSortedArray,\n} from \"./utils/group\";\nimport { useWindowSplitterPanelGroupBehavior } from \"./hooks/useWindowSplitterBehavior\";\nimport useUniqueId from \"./hooks/useUniqueId\";\n\nexport type CommittedValues = {\n direction: Direction;\n height: number;\n panels: Map<string, PanelData>;\n sizes: number[];\n width: number;\n};\n\nexport type PanelDataMap = Map<string, PanelData>;\n\ntype Props = {\n autoSaveId?: string;\n children?: ReactNode;\n className?: string;\n direction: Direction;\n height: number;\n id?: string | null;\n width: number;\n};\n\n// TODO [panels]\n// Within an active drag, remember original positions to refine more easily on expand.\n// Look at what the Chrome devtools Sources does.\n\nexport default function PanelGroup({\n autoSaveId,\n children = null,\n className = \"\",\n direction,\n height,\n id: idFromProps = null,\n width,\n}: Props) {\n const groupId = useUniqueId(idFromProps);\n\n const [activeHandleId, setActiveHandleId] = useState<string | null>(null);\n const [panels, setPanels] = useState<PanelDataMap>(new Map());\n\n // 0-1 values representing the relative size of each panel.\n const [sizes, setSizes] = useState<number[]>([]);\n\n const dragOffsetRef = useRef<number>(0);\n\n // Store committed values to avoid unnecessarily re-running memoization/effects functions.\n const committedValuesRef = useRef<CommittedValues>({\n direction,\n height,\n panels,\n sizes,\n width,\n });\n\n useLayoutEffect(() => {\n committedValuesRef.current.direction = direction;\n committedValuesRef.current.height = height;\n committedValuesRef.current.panels = panels;\n committedValuesRef.current.sizes = sizes;\n committedValuesRef.current.width = width;\n });\n\n useWindowSplitterPanelGroupBehavior({\n committedValuesRef,\n groupId,\n panels,\n setSizes,\n sizes,\n });\n\n // Once all panels have registered themselves,\n // Compute the initial sizes based on default weights.\n // This assumes that panels register during initial mount (no conditional rendering)!\n useLayoutEffect(() => {\n const sizes = committedValuesRef.current.sizes;\n if (sizes.length === panels.size) {\n return;\n }\n\n // TODO [panels]\n // Validate that the total minSize is <= 1.\n\n // If this panel has been configured to persist sizing information,\n // default size should be restored from local storage if possible.\n let defaultSizes: number[] | undefined = undefined;\n if (autoSaveId) {\n const panelIds = panelsMapToSortedArray(panels).map((panel) => panel.id);\n defaultSizes = loadPanelLayout(autoSaveId, panelIds);\n }\n\n if (defaultSizes != null) {\n setSizes(defaultSizes);\n } else {\n const panelsArray = panelsMapToSortedArray(panels);\n const totalWeight = panelsArray.reduce((weight, panel) => {\n return weight + panel.defaultSize;\n }, 0);\n\n setSizes(panelsArray.map((panel) => panel.defaultSize / totalWeight));\n }\n }, [autoSaveId, panels]);\n\n useEffect(() => {\n // If this panel has been configured to persist sizing information, save sizes to local storage.\n if (autoSaveId) {\n if (sizes.length === 0 || sizes.length !== panels.size) {\n return;\n }\n\n const panelIds = panelsMapToSortedArray(panels).map((panel) => panel.id);\n savePanelGroupLayout(autoSaveId, panelIds, sizes);\n }\n }, [autoSaveId, panels, sizes]);\n\n const getPanelStyle = useCallback(\n (id: string): CSSProperties => {\n const { panels } = committedValuesRef.current;\n\n const offset = getOffset(panels, id, direction, sizes, height, width);\n const size = getSize(panels, id, direction, sizes, height, width);\n\n if (direction === \"horizontal\") {\n return {\n height: \"100%\",\n position: \"absolute\",\n left: offset,\n top: 0,\n width: size,\n };\n } else {\n return {\n height: size,\n position: \"absolute\",\n left: 0,\n top: offset,\n width: \"100%\",\n };\n }\n },\n [direction, height, sizes, width]\n );\n\n const registerPanel = useCallback((id: string, panel: PanelData) => {\n setPanels((prevPanels) => {\n if (prevPanels.has(id)) {\n return prevPanels;\n }\n\n const nextPanels = new Map(prevPanels);\n nextPanels.set(id, panel);\n\n return nextPanels;\n });\n }, []);\n\n const registerResizeHandle = useCallback(\n (handleId: string) => {\n const resizeHandler = (event: ResizeEvent) => {\n event.preventDefault();\n\n const {\n direction,\n height,\n panels,\n sizes: prevSizes,\n width,\n } = committedValuesRef.current;\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const [idBefore, idAfter] = getResizeHandlePanelIds(\n groupId,\n handleId,\n panelsArray\n );\n if (idBefore == null || idAfter == null) {\n return;\n }\n\n const movement = getMovement(\n event,\n handleId,\n { height, width },\n direction,\n dragOffsetRef.current\n );\n\n const isHorizontal = direction === \"horizontal\";\n const delta = isHorizontal ? movement / width : movement / height;\n\n const nextSizes = adjustByDelta(\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes\n );\n if (prevSizes !== nextSizes) {\n setSizes(nextSizes);\n }\n };\n\n return resizeHandler;\n },\n [groupId]\n );\n\n const unregisterPanel = useCallback((id: string) => {\n setPanels((prevPanels) => {\n if (!prevPanels.has(id)) {\n return prevPanels;\n }\n\n const nextPanels = new Map(prevPanels);\n nextPanels.delete(id);\n\n return nextPanels;\n });\n }, []);\n\n const panelGroupContext = useMemo(\n () => ({\n direction,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n startDragging: (id: string, event: ResizeEvent) => {\n setActiveHandleId(id);\n\n dragOffsetRef.current = getDragOffset(event, id, direction);\n },\n stopDragging: () => {\n setActiveHandleId(null);\n },\n unregisterPanel,\n }),\n [\n direction,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n unregisterPanel,\n ]\n );\n\n const panelContext = useMemo(\n () => ({\n activeHandleId,\n }),\n [activeHandleId]\n );\n\n return (\n <PanelContext.Provider value={panelContext}>\n <PanelGroupContext.Provider value={panelGroupContext}>\n <div\n className={className}\n data-panel-group-id={groupId}\n style={{ height, position: \"relative\", width }}\n >\n {children}\n </div>\n </PanelGroupContext.Provider>\n </PanelContext.Provider>\n );\n}\n","import { PanelData } from \"../types\";\n\ntype SerializedPanelGroupState = { [panelIds: string]: number[] };\n\nfunction loadSerializedPanelGroupState(\n autoSaveId: string\n): SerializedPanelGroupState | null {\n try {\n const serialized = localStorage.getItem(`PanelGroup:sizes:${autoSaveId}`);\n if (serialized) {\n const parsed = JSON.parse(serialized);\n if (typeof parsed === \"object\" && parsed != null) {\n return parsed;\n }\n }\n } catch (error) {}\n\n return null;\n}\n\nexport function loadPanelLayout(\n autoSaveId: string,\n panelIds: string[]\n): number[] | null {\n const state = loadSerializedPanelGroupState(autoSaveId);\n if (state) {\n return state[panelIds.join(\",\")] ?? null;\n }\n\n return null;\n}\n\nexport function savePanelGroupLayout(\n autoSaveId: string,\n panelIds: string[],\n sizes: number[]\n): void {\n const state = loadSerializedPanelGroupState(autoSaveId) || {};\n state[panelIds.join(\",\")] = sizes;\n\n try {\n localStorage.setItem(\n `PanelGroup:sizes:${autoSaveId}`,\n JSON.stringify(state)\n );\n } catch (error) {\n console.error(error);\n }\n}\n","import { Direction, ResizeEvent } from \"../types\";\nimport { getResizeHandle } from \"./group\";\n\nexport type Coordinates = {\n movement: number;\n offset: number;\n};\n\nexport type Size = {\n height: number;\n width: number;\n};\n\nexport function getDragOffset(\n event: ResizeEvent,\n handleId: string,\n direction: Direction,\n initialOffset: number = 0\n): number {\n const isHorizontal = direction === \"horizontal\";\n\n let pointerOffset = 0;\n if (isMouseEvent(event)) {\n pointerOffset = isHorizontal ? event.clientX : event.clientY;\n } else if (isTouchEvent(event)) {\n const firstTouch = event.touches[0];\n pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;\n } else {\n return 0;\n }\n\n const handleElement = getResizeHandle(handleId);\n const rect = handleElement.getBoundingClientRect();\n const elementOffset = isHorizontal ? rect.left : rect.top;\n\n return pointerOffset - elementOffset - initialOffset;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX\nexport function getMovement(\n event: ResizeEvent,\n handleId: string,\n { height, width }: Size,\n direction: Direction,\n initialOffset: number\n): number {\n const isHorizontal = direction === \"horizontal\";\n const size = isHorizontal ? width : height;\n\n if (isKeyDown(event)) {\n const denominator = event.shiftKey ? 10 : 100;\n const delta = size / denominator;\n\n switch (event.key) {\n case \"ArrowDown\":\n return delta;\n case \"ArrowLeft\":\n return -delta;\n case \"ArrowRight\":\n return delta;\n case \"ArrowUp\":\n return -delta;\n case \"End\":\n if (isHorizontal) {\n return size;\n } else {\n return size;\n }\n case \"Home\":\n if (isHorizontal) {\n return -size;\n } else {\n return -size;\n }\n }\n } else {\n return getDragOffset(event, handleId, direction, initialOffset);\n }\n}\n\nexport function isKeyDown(event: ResizeEvent): event is KeyboardEvent {\n return event.type === \"keydown\";\n}\n\nexport function isMouseEvent(event: ResizeEvent): event is MouseEvent {\n return event.type.startsWith(\"mouse\");\n}\n\nexport function isTouchEvent(event: ResizeEvent): event is TouchEvent {\n return event.type.startsWith(\"touch\");\n}\n","import { PRECISION } from \"../constants\";\nimport { Direction, PanelData } from \"../types\";\n\nexport function adjustByDelta(\n panels: Map<string, PanelData>,\n idBefore: string,\n idAfter: string,\n delta: number,\n prevSizes: number[]\n): number[] {\n if (delta === 0) {\n return prevSizes;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const nextSizes = prevSizes.concat();\n\n let deltaApplied = 0;\n\n // A resizing panel affects the panels before or after it.\n //\n // A negative delta means the panel immediately after the resizer should grow/expand by decreasing its offset.\n // Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.\n //\n // A positive delta means the panel immediately before the resizer should \"expand\".\n // This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resizer.\n let pivotId = delta < 0 ? idBefore : idAfter;\n let index = panelsArray.findIndex((panel) => panel.id === pivotId);\n while (true) {\n const panel = panelsArray[index];\n const prevSize = prevSizes[index];\n const nextSize = Math.max(prevSize - Math.abs(delta), panel.minSize);\n if (prevSize !== nextSize) {\n deltaApplied += prevSize - nextSize;\n\n nextSizes[index] = nextSize;\n\n if (deltaApplied.toPrecision(PRECISION) >= delta.toPrecision(PRECISION)) {\n break;\n }\n }\n\n if (delta < 0) {\n if (--index < 0) {\n break;\n }\n } else {\n if (++index >= panelsArray.length) {\n break;\n }\n }\n }\n\n // If we were unable to resize any of the panels panels, return the previous state.\n // This will essentially bailout and ignore the \"mousemove\" event.\n if (deltaApplied === 0) {\n return prevSizes;\n }\n\n // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.\n pivotId = delta < 0 ? idAfter : idBefore;\n index = panelsArray.findIndex((panel) => panel.id === pivotId);\n nextSizes[index] = prevSizes[index] + deltaApplied;\n\n return nextSizes;\n}\n\nexport function getOffset(\n panels: Map<string, PanelData>,\n id: string,\n direction: Direction,\n sizes: number[],\n height: number,\n width: number\n): number {\n const panelsArray = panelsMapToSortedArray(panels);\n\n let index = panelsArray.findIndex((panel) => panel.id === id);\n if (index < 0) {\n return 0;\n }\n\n let scaledOffset = 0;\n\n for (index = index - 1; index >= 0; index--) {\n const panel = panelsArray[index];\n scaledOffset += getSize(panels, panel.id, direction, sizes, height, width);\n }\n\n return Math.round(scaledOffset);\n}\n\nexport function getPanel(id: string): HTMLDivElement | null {\n const element = document.querySelector(`[data-panel-id=\"${id}\"]`);\n if (element) {\n return element as HTMLDivElement;\n }\n return null;\n}\n\nexport function getResizeHandle(id: string): HTMLDivElement | null {\n const element = document.querySelector(\n `[data-panel-resize-handle-id=\"${id}\"]`\n );\n if (element) {\n return element as HTMLDivElement;\n }\n return null;\n}\n\nexport function getResizeHandleIndex(id: string): number | null {\n const handles = getResizeHandles();\n const index = handles.findIndex(\n (handle) => handle.getAttribute(\"data-panel-resize-handle-id\") === id\n );\n return index ?? null;\n}\n\nexport function getResizeHandles(): HTMLDivElement[] {\n return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id]`));\n}\n\nexport function getResizeHandlesForGroup(groupId: string): HTMLDivElement[] {\n return Array.from(\n document.querySelectorAll(\n `[data-panel-resize-handle-id][data-panel-group-id=\"${groupId}\"]`\n )\n );\n}\n\nexport function getResizeHandlePanelIds(\n groupId: string,\n handleId: string,\n panelsArray: PanelData[]\n): [idBefore: string | null, idAfter: string | null] {\n const handle = getResizeHandle(handleId);\n const handles = getResizeHandlesForGroup(groupId);\n const index = handles.indexOf(handle);\n\n const idBefore: string | null = panelsArray[index]?.id ?? null;\n const idAfter: string | null = panelsArray[index + 1]?.id ?? null;\n\n return [idBefore, idAfter];\n}\n\nexport function panelsMapToSortedArray(\n panels: Map<string, PanelData>\n): PanelData[] {\n return Array.from(panels.values()).sort((a, b) => a.order - b.order);\n}\n\nexport function getSize(\n panels: Map<string, PanelData>,\n id: string,\n direction: Direction,\n sizes: number[],\n height: number,\n width: number\n): number {\n const totalSize = direction === \"horizontal\" ? width : height;\n\n if (panels.size === 1) {\n return totalSize;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.findIndex((panel) => panel.id === id);\n const size = sizes[index];\n if (size == null) {\n return 0;\n }\n\n return Math.round(size * totalSize);\n}\n","export const PRECISION = 5;\n","import { RefObject, useEffect } from \"react\";\nimport { PRECISION } from \"../constants\";\n\nimport { CommittedValues, PanelDataMap } from \"../PanelGroup\";\nimport { ResizeHandler } from \"../types\";\nimport {\n adjustByDelta,\n getPanel,\n getResizeHandle,\n getResizeHandleIndex,\n getResizeHandlePanelIds,\n getResizeHandles,\n getResizeHandlesForGroup,\n getSize,\n panelsMapToSortedArray,\n} from \"../utils/group\";\n\n// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/\n\nexport function useWindowSplitterPanelGroupBehavior({\n committedValuesRef,\n groupId,\n panels,\n setSizes,\n sizes,\n}: {\n committedValuesRef: RefObject<CommittedValues>;\n groupId: string;\n panels: PanelDataMap;\n setSizes: (sizes: number[]) => void;\n sizes: number[];\n}): void {\n useEffect(() => {\n const { direction, height, panels, width } = committedValuesRef.current;\n\n const handles = getResizeHandlesForGroup(groupId);\n const cleanupFunctions = handles.map((handle) => {\n const handleId = handle.getAttribute(\"data-panel-resize-handle-id\");\n const panelsArray = panelsMapToSortedArray(panels);\n\n const [idBefore, idAfter] = getResizeHandlePanelIds(\n groupId,\n handleId,\n panelsArray\n );\n if (idBefore == null || idAfter == null) {\n return () => {};\n }\n\n const ariaValueMax = panelsArray.reduce((difference, panel) => {\n if (panel.id !== idBefore) {\n return difference - panel.minSize;\n }\n return difference;\n }, 1);\n\n const ariaValueMin =\n panelsArray.find((panel) => panel.id == idBefore)?.minSize ?? 0;\n\n const size = getSize(panels, idBefore, direction, sizes, height, width);\n const ariaValueNow = size / (direction === \"horizontal\" ? width : height);\n\n handle.setAttribute(\"aria-valuemax\", \"\" + Math.round(100 * ariaValueMax));\n handle.setAttribute(\"aria-valuemin\", \"\" + Math.round(100 * ariaValueMin));\n handle.setAttribute(\"aria-valuenow\", \"\" + Math.round(100 * ariaValueNow));\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Enter\": {\n const index = panelsArray.findIndex(\n (panel) => panel.id === idBefore\n );\n if (index >= 0) {\n const panelData = panelsArray[index];\n const size = sizes[index];\n if (size != null) {\n let delta = 0;\n if (\n size.toPrecision(PRECISION) <=\n panelData.minSize.toPrecision(PRECISION)\n ) {\n delta = direction === \"horizontal\" ? width : height;\n } else {\n delta = -(direction === \"horizontal\" ? width : height);\n }\n\n const nextSizes = adjustByDelta(\n panels,\n idBefore,\n idAfter,\n delta,\n sizes\n );\n if (sizes !== nextSizes) {\n setSizes(nextSizes);\n }\n }\n }\n break;\n }\n }\n };\n\n handle.addEventListener(\"keydown\", onKeyDown);\n\n const panelBefore = getPanel(idBefore);\n if (panelBefore != null) {\n handle.setAttribute(\"aria-controls\", panelBefore.id);\n }\n\n return () => {\n handle.removeAttribute(\"aria-valuemax\");\n handle.removeAttribute(\"aria-valuemin\");\n handle.removeAttribute(\"aria-valuenow\");\n\n handle.removeEventListener(\"keydown\", onKeyDown);\n\n if (panelBefore != null) {\n handle.removeAttribute(\"aria-controls\");\n }\n };\n });\n\n return () => {\n cleanupFunctions.forEach((cleanupFunction) => cleanupFunction());\n };\n }, [groupId, panels, sizes]);\n}\n\nexport function useWindowSplitterResizeHandlerBehavior({\n disabled,\n handleId,\n resizeHandler,\n}: {\n disabled: boolean;\n handleId: string;\n resizeHandler: ResizeHandler | null;\n}): void {\n useEffect(() => {\n if (disabled || resizeHandler == null) {\n return;\n }\n\n const handleElement = getResizeHandle(handleId);\n if (handleElement == null) {\n return;\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowDown\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"ArrowUp\":\n case \"End\":\n case \"Home\": {\n resizeHandler(event);\n break;\n }\n case \"F6\": {\n const handles = getResizeHandles();\n const index = getResizeHandleIndex(handleId);\n\n const nextIndex = event.shiftKey\n ? index > 0\n ? index - 1\n : handles.length - 1\n : index + 1 < handles.length\n ? index + 1\n : 0;\n\n const nextHandle = handles[nextIndex] as HTMLDivElement;\n nextHandle.focus();\n\n break;\n }\n }\n };\n\n handleElement.addEventListener(\"keydown\", onKeyDown);\n return () => {\n handleElement.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [disabled, handleId, resizeHandler]);\n}\n","import {\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport useUniqueId from \"./hooks/useUniqueId\";\n\nimport { useWindowSplitterResizeHandlerBehavior } from \"./hooks/useWindowSplitterBehavior\";\nimport { PanelContext, PanelGroupContext } from \"./PanelContexts\";\nimport type { ResizeHandler, ResizeEvent } from \"./types\";\n\nexport default function PanelResizeHandle({\n children = null,\n className = \"\",\n disabled = false,\n id: idFromProps = null,\n}: {\n children?: ReactNode;\n className?: string;\n disabled?: boolean;\n id?: string | null;\n}) {\n const divElementRef = useRef<HTMLDivElement>(null);\n\n const panelContext = useContext(PanelContext);\n const panelGroupContext = useContext(PanelGroupContext);\n if (panelContext === null || panelGroupContext === null) {\n throw Error(\n `PanelResizeHandle components must be rendered within a PanelGroup container`\n );\n }\n\n const { activeHandleId } = panelContext;\n const {\n direction,\n groupId,\n registerResizeHandle,\n startDragging,\n stopDragging,\n } = panelGroupContext;\n\n const resizeHandleId = useUniqueId(idFromProps);\n const isDragging = activeHandleId === resizeHandleId;\n\n const [resizeHandler, setResizeHandler] = useState<ResizeHandler | null>(\n null\n );\n\n const stopDraggingAndBlur = useCallback(() => {\n // Clicking on the drag handle shouldn't leave it focused;\n // That would cause the PanelGroup to think it was still active.\n const div = divElementRef.current!;\n div.blur();\n\n stopDragging();\n }, [stopDragging]);\n\n useEffect(() => {\n if (disabled) {\n setResizeHandler(null);\n } else {\n const resizeHandler = registerResizeHandle(resizeHandleId);\n setResizeHandler(() => resizeHandler);\n }\n }, [disabled, resizeHandleId, registerResizeHandle]);\n\n useEffect(() => {\n if (disabled || resizeHandler == null || !isDragging) {\n return;\n }\n\n document.body.style.cursor =\n direction === \"horizontal\" ? \"ew-resize\" : \"ns-resize\";\n\n const onMove = (event: ResizeEvent) => {\n resizeHandler(event);\n };\n\n document.body.addEventListener(\"contextmenu\", stopDraggingAndBlur);\n document.body.addEventListener(\"mouseleave\", stopDraggingAndBlur);\n document.body.addEventListener(\"mousemove\", onMove);\n document.body.addEventListener(\"touchmove\", onMove);\n document.body.addEventListener(\"mouseup\", stopDraggingAndBlur);\n\n return () => {\n document.body.style.cursor = \"\";\n\n document.body.removeEventListener(\"contextmenu\", stopDraggingAndBlur);\n document.body.removeEventListener(\"mouseleave\", stopDraggingAndBlur);\n document.body.removeEventListener(\"mousemove\", onMove);\n document.body.removeEventListener(\"touchmove\", onMove);\n document.body.removeEventListener(\"mouseup\", stopDraggingAndBlur);\n };\n }, [direction, disabled, isDragging, resizeHandler, stopDraggingAndBlur]);\n\n useWindowSplitterResizeHandlerBehavior({\n disabled,\n handleId: resizeHandleId,\n resizeHandler,\n });\n\n return (\n <div\n className={className}\n data-panel-group-id={groupId}\n data-panel-resize-handle-enabled={!disabled}\n data-panel-resize-handle-id={resizeHandleId}\n onMouseDown={(event) => startDragging(resizeHandleId, event.nativeEvent)}\n onMouseUp={stopDraggingAndBlur}\n onTouchCancel={stopDraggingAndBlur}\n onTouchEnd={stopDraggingAndBlur}\n onTouchStart={(event) => startDragging(resizeHandleId, event.nativeEvent)}\n ref={divElementRef}\n role=\"separator\"\n style={{\n cursor: direction === \"horizontal\" ? \"ew-resize\" : \"ns-resize\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n tabIndex={0}\n >\n {children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"react-resizable-panels.js.map"}
|