react-resizable-panels 0.0.51 → 0.0.52

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.
@@ -45,6 +45,7 @@ PanelGroupContext.displayName = "PanelGroupContext";
45
45
  function PanelWithForwardedRef({
46
46
  children = null,
47
47
  className: classNameFromProps = "",
48
+ collapsedSize = 0,
48
49
  collapsible = false,
49
50
  defaultSize = null,
50
51
  forwardedRef,
@@ -102,6 +103,7 @@ function PanelWithForwardedRef({
102
103
  });
103
104
  const panelDataRef = useRef({
104
105
  callbacksRef,
106
+ collapsedSize,
105
107
  collapsible,
106
108
  defaultSize,
107
109
  id: panelId,
@@ -112,6 +114,7 @@ function PanelWithForwardedRef({
112
114
  useIsomorphicLayoutEffect(() => {
113
115
  committedValuesRef.current.size = parseSizeFromStyle(style);
114
116
  panelDataRef.current.callbacksRef = callbacksRef;
117
+ panelDataRef.current.collapsedSize = collapsedSize;
115
118
  panelDataRef.current.collapsible = collapsible;
116
119
  panelDataRef.current.defaultSize = defaultSize;
117
120
  panelDataRef.current.id = panelId;
@@ -261,6 +264,7 @@ function callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap) {
261
264
  sizes.forEach((size, index) => {
262
265
  const {
263
266
  callbacksRef,
267
+ collapsedSize,
264
268
  collapsible,
265
269
  id
266
270
  } = panelsArray[index].current;
@@ -272,14 +276,12 @@ function callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap) {
272
276
  onResize
273
277
  } = callbacksRef.current;
274
278
  if (onResize) {
275
- onResize(size);
279
+ onResize(size, lastNotifiedSize);
276
280
  }
277
281
  if (collapsible && onCollapse) {
278
- // Falsy check handles both previous size of 0
279
- // and initial size of undefined (when mounting)
280
- if (!lastNotifiedSize && size !== 0) {
282
+ if ((lastNotifiedSize == null || lastNotifiedSize === collapsedSize) && size !== collapsedSize) {
281
283
  onCollapse(false);
282
- } else if (lastNotifiedSize !== 0 && size === 0) {
284
+ } else if (lastNotifiedSize !== collapsedSize && size === collapsedSize) {
283
285
  onCollapse(true);
284
286
  }
285
287
  }
@@ -371,11 +373,17 @@ function panelsMapToSortedArray(panels) {
371
373
  }
372
374
  function safeResizePanel(panel, delta, prevSize, event) {
373
375
  const nextSizeUnsafe = prevSize + delta;
374
- if (panel.current.collapsible) {
375
- if (prevSize > 0) {
376
+ const {
377
+ collapsedSize,
378
+ collapsible,
379
+ maxSize,
380
+ minSize
381
+ } = panel.current;
382
+ if (collapsible) {
383
+ if (prevSize > collapsedSize) {
376
384
  // Mimic VS COde behavior; collapse a panel if it's smaller than half of its min-size
377
- if (nextSizeUnsafe <= panel.current.minSize / 2) {
378
- return 0;
385
+ if (nextSizeUnsafe <= minSize / 2 + collapsedSize) {
386
+ return collapsedSize;
379
387
  }
380
388
  } else {
381
389
  const isKeyboardEvent = event?.type?.startsWith("key");
@@ -383,13 +391,13 @@ function safeResizePanel(panel, delta, prevSize, event) {
383
391
  // Keyboard events should expand a collapsed panel to the min size,
384
392
  // but mouse events should wait until the panel has reached its min size
385
393
  // to avoid a visual flickering when dragging between collapsed and min size.
386
- if (nextSizeUnsafe < panel.current.minSize) {
387
- return 0;
394
+ if (nextSizeUnsafe < minSize) {
395
+ return collapsedSize;
388
396
  }
389
397
  }
390
398
  }
391
399
  }
392
- const nextSize = Math.min(panel.current.maxSize, Math.max(panel.current.minSize, nextSizeUnsafe));
400
+ const nextSize = Math.min(maxSize, Math.max(minSize, nextSizeUnsafe));
393
401
  return nextSize;
394
402
  }
395
403
 
@@ -845,8 +853,8 @@ function PanelGroupWithForwardedRef({
845
853
  } = committedValuesRef.current;
846
854
  const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
847
855
  const panelsArray = panelsMapToSortedArray(panels);
848
- callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);
849
856
  setSizes(sizes);
857
+ callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);
850
858
  }
851
859
  }), []);
852
860
  useIsomorphicLayoutEffect(() => {
@@ -868,25 +876,25 @@ function PanelGroupWithForwardedRef({
868
876
  const {
869
877
  onLayout
870
878
  } = callbacksRef.current;
871
- if (onLayout) {
872
- const {
873
- panels,
874
- sizes
875
- } = committedValuesRef.current;
879
+ const {
880
+ panels,
881
+ sizes
882
+ } = committedValuesRef.current;
876
883
 
877
- // Don't commit layout until all panels have registered and re-rendered with their actual sizes.
878
- if (sizes.length > 0) {
884
+ // Don't commit layout until all panels have registered and re-rendered with their actual sizes.
885
+ if (sizes.length > 0) {
886
+ if (onLayout) {
879
887
  onLayout(sizes);
880
- const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
881
-
882
- // When possible, we notify before the next render so that rendering work can be batched together.
883
- // Some cases are difficult to detect though,
884
- // for example– panels that are conditionally rendered can affect the size of neighboring panels.
885
- // In this case, the best we can do is notify on commit.
886
- // The callPanelCallbacks() uses its own memoization to avoid notifying panels twice in these cases.
887
- const panelsArray = panelsMapToSortedArray(panels);
888
- callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);
889
888
  }
889
+ const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
890
+
891
+ // When possible, we notify before the next render so that rendering work can be batched together.
892
+ // Some cases are difficult to detect though,
893
+ // for example– panels that are conditionally rendered can affect the size of neighboring panels.
894
+ // In this case, the best we can do is notify on commit.
895
+ // The callPanelCallbacks() uses its own memoization to avoid notifying panels twice in these cases.
896
+ const panelsArray = panelsMapToSortedArray(panels);
897
+ callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);
890
898
  }
891
899
  }, [sizes]);
892
900
 
@@ -1051,10 +1059,11 @@ function PanelGroupWithForwardedRef({
1051
1059
  }
1052
1060
  if (sizesChanged) {
1053
1061
  const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
1062
+ setSizes(nextSizes);
1054
1063
 
1055
1064
  // If resize change handlers have been declared, this is the time to call them.
1065
+ // Trigger user callbacks after updating state, so that user code can override the sizes.
1056
1066
  callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);
1057
- setSizes(nextSizes);
1058
1067
  }
1059
1068
  prevDeltaRef.current = delta;
1060
1069
  };
@@ -1076,7 +1085,14 @@ function PanelGroupWithForwardedRef({
1076
1085
  sizes: prevSizes
1077
1086
  } = committedValuesRef.current;
1078
1087
  const panel = panels.get(id);
1079
- if (panel == null || !panel.current.collapsible) {
1088
+ if (panel == null) {
1089
+ return;
1090
+ }
1091
+ const {
1092
+ collapsedSize,
1093
+ collapsible
1094
+ } = panel.current;
1095
+ if (!collapsible) {
1080
1096
  return;
1081
1097
  }
1082
1098
  const panelsArray = panelsMapToSortedArray(panels);
@@ -1085,7 +1101,7 @@ function PanelGroupWithForwardedRef({
1085
1101
  return;
1086
1102
  }
1087
1103
  const currentSize = prevSizes[index];
1088
- if (currentSize === 0) {
1104
+ if (currentSize === collapsedSize) {
1089
1105
  // Panel is already collapsed.
1090
1106
  return;
1091
1107
  }
@@ -1095,14 +1111,15 @@ function PanelGroupWithForwardedRef({
1095
1111
  return;
1096
1112
  }
1097
1113
  const isLastPanel = index === panelsArray.length - 1;
1098
- const delta = isLastPanel ? currentSize : 0 - currentSize;
1114
+ const delta = isLastPanel ? currentSize : collapsedSize - currentSize;
1099
1115
  const nextSizes = adjustByDelta(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
1100
1116
  if (prevSizes !== nextSizes) {
1101
1117
  const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
1118
+ setSizes(nextSizes);
1102
1119
 
1103
1120
  // If resize change handlers have been declared, this is the time to call them.
1121
+ // Trigger user callbacks after updating state, so that user code can override the sizes.
1104
1122
  callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);
1105
- setSizes(nextSizes);
1106
1123
  }
1107
1124
  }, []);
1108
1125
  const expandPanel = useCallback(id => {
@@ -1114,7 +1131,11 @@ function PanelGroupWithForwardedRef({
1114
1131
  if (panel == null) {
1115
1132
  return;
1116
1133
  }
1117
- const sizeBeforeCollapse = panelSizeBeforeCollapse.current.get(id) || panel.current.minSize;
1134
+ const {
1135
+ collapsedSize,
1136
+ minSize
1137
+ } = panel.current;
1138
+ const sizeBeforeCollapse = panelSizeBeforeCollapse.current.get(id) || minSize;
1118
1139
  if (!sizeBeforeCollapse) {
1119
1140
  return;
1120
1141
  }
@@ -1124,7 +1145,7 @@ function PanelGroupWithForwardedRef({
1124
1145
  return;
1125
1146
  }
1126
1147
  const currentSize = prevSizes[index];
1127
- if (currentSize !== 0) {
1148
+ if (currentSize !== collapsedSize) {
1128
1149
  // Panel is already expanded.
1129
1150
  return;
1130
1151
  }
@@ -1133,14 +1154,15 @@ function PanelGroupWithForwardedRef({
1133
1154
  return;
1134
1155
  }
1135
1156
  const isLastPanel = index === panelsArray.length - 1;
1136
- const delta = isLastPanel ? 0 - sizeBeforeCollapse : sizeBeforeCollapse;
1157
+ const delta = isLastPanel ? collapsedSize - sizeBeforeCollapse : sizeBeforeCollapse;
1137
1158
  const nextSizes = adjustByDelta(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
1138
1159
  if (prevSizes !== nextSizes) {
1139
1160
  const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
1161
+ setSizes(nextSizes);
1140
1162
 
1141
1163
  // If resize change handlers have been declared, this is the time to call them.
1164
+ // Trigger user callbacks after updating state, so that user code can override the sizes.
1142
1165
  callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);
1143
- setSizes(nextSizes);
1144
1166
  }
1145
1167
  }, []);
1146
1168
  const resizePanel = useCallback((id, nextSize) => {
@@ -1152,6 +1174,12 @@ function PanelGroupWithForwardedRef({
1152
1174
  if (panel == null) {
1153
1175
  return;
1154
1176
  }
1177
+ const {
1178
+ collapsedSize,
1179
+ collapsible,
1180
+ maxSize,
1181
+ minSize
1182
+ } = panel.current;
1155
1183
  const panelsArray = panelsMapToSortedArray(panels);
1156
1184
  const index = panelsArray.indexOf(panel);
1157
1185
  if (index < 0) {
@@ -1161,8 +1189,8 @@ function PanelGroupWithForwardedRef({
1161
1189
  if (currentSize === nextSize) {
1162
1190
  return;
1163
1191
  }
1164
- if (panel.current.collapsible && nextSize === 0) ; else {
1165
- nextSize = Math.min(panel.current.maxSize, Math.max(panel.current.minSize, nextSize));
1192
+ if (collapsible && nextSize === collapsedSize) ; else {
1193
+ nextSize = Math.min(maxSize, Math.max(minSize, nextSize));
1166
1194
  }
1167
1195
  const [idBefore, idAfter] = getBeforeAndAfterIds(id, panelsArray);
1168
1196
  if (idBefore == null || idAfter == null) {
@@ -1173,10 +1201,11 @@ function PanelGroupWithForwardedRef({
1173
1201
  const nextSizes = adjustByDelta(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
1174
1202
  if (prevSizes !== nextSizes) {
1175
1203
  const panelIdToLastNotifiedSizeMap = panelIdToLastNotifiedSizeMapRef.current;
1204
+ setSizes(nextSizes);
1176
1205
 
1177
1206
  // If resize change handlers have been declared, this is the time to call them.
1207
+ // Trigger user callbacks after updating state, so that user code can override the sizes.
1178
1208
  callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);
1179
- setSizes(nextSizes);
1180
1209
  }
1181
1210
  }, []);
1182
1211
  const context = useMemo(() => ({
@@ -0,0 +1 @@
1
+ {"mappings":";;AGAA,kGAAkG;AAClG,8EAA8E;AAC9E,mGAAmG;AACnG,+GAA+G;AAC/G,mEAAmE;AAEnE,iDAAiD;;AAcjD,MAAM,iBACJ,0CAAa,iBACb,0CAAa,cACb,0CAAU,eACV,0CAAW,cACX,0CAAU,aACV,0CAAS,uBACT,0CAAmB,mBACnB,0CAAe,WACf,0CAAO,UACP,0CAAM,YACN,0CAAQ,EACT,GAAG;AAEJ,gFAAgF;AAChF,MAAM,4C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yCAAa,EAAE;QACvB,aAAa;QACb,YAAY;IACd;IAEA,OAAO,CAAA,GAAA,yCAAY,EAAE,MAAM;kBACzB;QACA,WAAW;QACX,6BAA6B,aACzB,YACA,YACA,aACA;QACJ,8BAA8B;QAC9B,uBAAuB;QACvB,oCAAoC,CAAC;QACrC,+BAA+B;QAC/B,QAAQ,IAAM,aAAa;QAC3B,SAAS,IAAM,aAAa;QAC5B,aAAa,CAAC;YACZ,cAAc,gBAAgB,MAAM;YAEpC,MAAM,cAAE,WAAU,EAAE,GAAG,aAAa;YACpC,IAAI,YACF,WAAW;QAEf;QACA,WAAW;QACX,eAAe;QACf,YAAY;QACZ,cAAc,CAAC;YACb,cAAc,gBAAgB,MAAM;YAEpC,MAAM,cAAE,WAAU,EAAE,GAAG,aAAa;YACpC,IAAI,YACF,WAAW;QAEf;QACA,KAAK;QACL,MAAM;QACN,OAAO;YACL,GAAG,KAAK;YACR,GAAG,cAAc;QACnB;QACA,UAAU;IACZ;AACF;AAEA,0EAA0E;AAC1E,kFAAkF;AAClF,mDAAmD;AAClD,0CAA0B,cAAc;","sources":["packages/react-resizable-panels/src/index.ts","packages/react-resizable-panels/src/Panel.ts","packages/react-resizable-panels/src/hooks/useIsomorphicEffect.ts","packages/react-resizable-panels/src/vendor/react.ts","packages/react-resizable-panels/src/hooks/useUniqueId.ts","packages/react-resizable-panels/src/PanelContexts.ts","packages/react-resizable-panels/src/PanelGroup.ts","packages/react-resizable-panels/src/env-conditions/production.ts","packages/react-resizable-panels/src/hooks/useWindowSplitterBehavior.ts","packages/react-resizable-panels/src/constants.ts","packages/react-resizable-panels/src/utils/group.ts","packages/react-resizable-panels/src/utils/assert.ts","packages/react-resizable-panels/src/utils/arrays.ts","packages/react-resizable-panels/src/utils/coordinates.ts","packages/react-resizable-panels/src/utils/cursor.ts","packages/react-resizable-panels/src/utils/debounce.ts","packages/react-resizable-panels/src/utils/serialization.ts","packages/react-resizable-panels/src/utils/ssr.ts","packages/react-resizable-panels/src/PanelResizeHandle.ts"],"sourcesContent":["import { Panel } from \"./Panel\";\nimport { PanelGroup } from \"./PanelGroup\";\nimport { PanelResizeHandle } from \"./PanelResizeHandle\";\n\nimport type { ImperativePanelHandle, PanelProps } from \"./Panel\";\nimport type { ImperativePanelGroupHandle, PanelGroupProps } from \"./PanelGroup\";\nimport type { PanelResizeHandleProps } from \"./PanelResizeHandle\";\nimport type {\n PanelGroupOnLayout,\n PanelGroupStorage,\n PanelOnCollapse,\n PanelOnResize,\n PanelResizeHandleOnDragging,\n} from \"./types\";\n\nexport {\n // TypeScript types\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n Panel,\n PanelOnCollapse,\n PanelOnResize,\n PanelGroup,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandle,\n PanelResizeHandleOnDragging,\n PanelResizeHandleProps,\n};\n","import useIsomorphicLayoutEffect from \"./hooks/useIsomorphicEffect\";\nimport useUniqueId from \"./hooks/useUniqueId\";\nimport {\n createElement,\n CSSProperties,\n ElementType,\n ForwardedRef,\n forwardRef,\n ReactNode,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n} from \"./vendor/react\";\n\nimport { PanelGroupContext } from \"./PanelContexts\";\nimport {\n PanelCallbackRef,\n PanelData,\n PanelOnCollapse,\n PanelOnResize,\n} from \"./types\";\n\nexport type PanelProps = {\n children?: ReactNode;\n className?: string;\n collapsedSize?: number;\n collapsible?: boolean;\n defaultSize?: number | null;\n id?: string | null;\n maxSize?: number;\n minSize?: number;\n onCollapse?: PanelOnCollapse | null;\n onResize?: PanelOnResize | null;\n order?: number | null;\n style?: CSSProperties;\n tagName?: ElementType;\n};\n\nexport type ImperativePanelHandle = {\n collapse: () => void;\n expand: () => void;\n getCollapsed(): boolean;\n getSize(): number;\n resize: (percentage: number) => void;\n};\n\nfunction PanelWithForwardedRef({\n children = null,\n className: classNameFromProps = \"\",\n collapsedSize = 0,\n collapsible = false,\n defaultSize = null,\n forwardedRef,\n id: idFromProps = null,\n maxSize = 100,\n minSize = 10,\n onCollapse = null,\n onResize = null,\n order = null,\n style: styleFromProps = {},\n tagName: Type = \"div\",\n}: PanelProps & {\n forwardedRef: ForwardedRef<ImperativePanelHandle>;\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 const {\n collapsePanel,\n expandPanel,\n getPanelStyle,\n registerPanel,\n resizePanel,\n unregisterPanel,\n } = context;\n\n // Use a ref to guard against users passing inline props\n const callbacksRef = useRef<{\n onCollapse: PanelOnCollapse | null;\n onResize: PanelOnResize | null;\n }>({ onCollapse, onResize });\n useEffect(() => {\n callbacksRef.current.onCollapse = onCollapse;\n callbacksRef.current.onResize = onResize;\n });\n\n // Basic props validation\n if (minSize < 0 || minSize > 100) {\n throw Error(`Panel minSize must be between 0 and 100, but was ${minSize}`);\n } else if (maxSize < 0 || maxSize > 100) {\n throw Error(`Panel maxSize must be between 0 and 100, but was ${maxSize}`);\n } else {\n if (defaultSize !== null) {\n if (defaultSize < 0 || defaultSize > 100) {\n throw Error(\n `Panel defaultSize must be between 0 and 100, but was ${defaultSize}`\n );\n } else if (minSize > defaultSize && !collapsible) {\n console.error(\n `Panel minSize ${minSize} cannot be greater than defaultSize ${defaultSize}`\n );\n\n defaultSize = minSize;\n }\n }\n }\n\n const style = getPanelStyle(panelId, defaultSize);\n\n const committedValuesRef = useRef<{\n size: number;\n }>({\n size: parseSizeFromStyle(style),\n });\n const panelDataRef = useRef<{\n callbacksRef: PanelCallbackRef;\n collapsedSize: number;\n collapsible: boolean;\n defaultSize: number | null;\n id: string;\n maxSize: number;\n minSize: number;\n order: number | null;\n }>({\n callbacksRef,\n collapsedSize,\n collapsible,\n defaultSize,\n id: panelId,\n maxSize,\n minSize,\n order,\n });\n useIsomorphicLayoutEffect(() => {\n committedValuesRef.current.size = parseSizeFromStyle(style);\n\n panelDataRef.current.callbacksRef = callbacksRef;\n panelDataRef.current.collapsedSize = collapsedSize;\n panelDataRef.current.collapsible = collapsible;\n panelDataRef.current.defaultSize = defaultSize;\n panelDataRef.current.id = panelId;\n panelDataRef.current.maxSize = maxSize;\n panelDataRef.current.minSize = minSize;\n panelDataRef.current.order = order;\n });\n\n useIsomorphicLayoutEffect(() => {\n registerPanel(panelId, panelDataRef as PanelData);\n\n return () => {\n unregisterPanel(panelId);\n };\n }, [order, panelId, registerPanel, unregisterPanel]);\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n collapse: () => collapsePanel(panelId),\n expand: () => expandPanel(panelId),\n getCollapsed() {\n return committedValuesRef.current.size === 0;\n },\n getSize() {\n return committedValuesRef.current.size;\n },\n resize: (percentage: number) => resizePanel(panelId, percentage),\n }),\n [collapsePanel, expandPanel, panelId, resizePanel]\n );\n\n return createElement(Type, {\n children,\n className: classNameFromProps,\n \"data-panel\": \"\",\n \"data-panel-collapsible\": collapsible || undefined,\n \"data-panel-id\": panelId,\n \"data-panel-size\": parseFloat(\"\" + style.flexGrow).toFixed(1),\n id: `data-panel-id-${panelId}`,\n style: {\n ...style,\n ...styleFromProps,\n },\n });\n}\n\nexport const Panel = forwardRef<ImperativePanelHandle, PanelProps>(\n (props: PanelProps, ref: ForwardedRef<ImperativePanelHandle>) =>\n createElement(PanelWithForwardedRef, { ...props, forwardedRef: ref })\n);\n\n// Workaround for Parcel scope hoisting (which renames objects/functions).\n// Casting to :any is required to avoid corrupting the generated TypeScript types.\n// See github.com/parcel-bundler/parcel/issues/8724\n(PanelWithForwardedRef as any).displayName = \"Panel\";\n(Panel as any).displayName = \"forwardRef(Panel)\";\n\n// HACK\nfunction parseSizeFromStyle(style: CSSProperties): number {\n const { flexGrow } = style;\n if (typeof flexGrow === \"string\") {\n return parseFloat(flexGrow);\n } else {\n return flexGrow as number;\n }\n}\n","import { useLayoutEffect } from \"../vendor/react\";\n\nconst canUseEffectHooks = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\n\nconst useIsomorphicLayoutEffect = canUseEffectHooks\n ? useLayoutEffect\n : () => {};\n\nexport default useIsomorphicLayoutEffect;\n","// This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814\n// and limitations with ParcelJS parsing of the useId workaround (used below).\n// For the time being, all react-resizable-panels must import \"react\" with the \"* as React\" syntax.\n// To avoid mistakes, we use the ESLint \"no-restricted-imports\" to prevent \"react\" imports except in this file.\n// See https://github.com/bvaughn/react-resizable-panels/issues/118\n\n// eslint-disable-next-line no-restricted-imports\nimport * as React from \"react\";\n\n// eslint-disable-next-line no-restricted-imports\nimport type {\n CSSProperties,\n ElementType,\n ForwardedRef,\n MouseEvent,\n ReactNode,\n RefObject,\n TouchEvent,\n} from \"react\";\n\nconst {\n createElement,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} = React;\n\n// `toString()` prevents bundlers from trying to `import { useId } from 'react'`\nconst useId = (React as any)[\"useId\".toString()] as () => string;\n\nexport {\n createElement,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n};\n\nexport type {\n CSSProperties,\n ElementType,\n ForwardedRef,\n MouseEvent,\n ReactNode,\n RefObject,\n TouchEvent,\n};\n","import { useId, useRef } from \"../vendor/react\";\n\nconst wrappedUseId: () => string | null =\n typeof useId === \"function\" ? useId : (): null => null;\n\nlet counter = 0;\n\nexport default function useUniqueId(\n idFromParams: string | null = null\n): string {\n const idFromUseId = wrappedUseId();\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 \"./vendor/react\";\n\nimport { PanelData, ResizeEvent, ResizeHandler } from \"./types\";\n\nexport const PanelGroupContext = createContext<{\n activeHandleId: string | null;\n collapsePanel: (id: string) => void;\n direction: \"horizontal\" | \"vertical\";\n expandPanel: (id: string) => void;\n getPanelStyle: (id: string, defaultSize: number | null) => CSSProperties;\n groupId: string;\n registerPanel: (id: string, panel: PanelData) => void;\n registerResizeHandle: (id: string) => ResizeHandler;\n resizePanel: (id: string, percentage: number) => void;\n startDragging: (id: string, event: ResizeEvent) => void;\n stopDragging: () => void;\n unregisterPanel: (id: string) => void;\n} | null>(null);\n\n// Workaround for Parcel scope hoisting (which renames objects/functions).\n// Casting to :any is required to avoid corrupting the generated TypeScript types.\n// See github.com/parcel-bundler/parcel/issues/8724\n(PanelGroupContext as any).displayName = \"PanelGroupContext\";\n","import { isDevelopment } from \"#is-development\";\nimport {\n createElement,\n CSSProperties,\n ElementType,\n ForwardedRef,\n forwardRef,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from \"./vendor/react\";\n\nimport useIsomorphicLayoutEffect from \"./hooks/useIsomorphicEffect\";\nimport useUniqueId from \"./hooks/useUniqueId\";\nimport { useWindowSplitterPanelGroupBehavior } from \"./hooks/useWindowSplitterBehavior\";\nimport { PanelGroupContext } from \"./PanelContexts\";\nimport {\n Direction,\n PanelData,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ResizeEvent,\n} from \"./types\";\nimport { areEqual } from \"./utils/arrays\";\nimport { assert } from \"./utils/assert\";\nimport {\n getDragOffset,\n getMovement,\n isMouseEvent,\n isTouchEvent,\n} from \"./utils/coordinates\";\nimport { resetGlobalCursorStyle, setGlobalCursorStyle } from \"./utils/cursor\";\nimport debounce from \"./utils/debounce\";\nimport {\n adjustByDelta,\n callPanelCallbacks,\n getBeforeAndAfterIds,\n getFlexGrow,\n getPanelGroup,\n getResizeHandle,\n getResizeHandlePanelIds,\n panelsMapToSortedArray,\n} from \"./utils/group\";\nimport { loadPanelLayout, savePanelGroupLayout } from \"./utils/serialization\";\nimport { isServerRendering } from \"./utils/ssr\";\n\nconst debounceMap: {\n [key: string]: (\n autoSaveId: string,\n panels: PanelData[],\n sizes: number[],\n storage: PanelGroupStorage\n ) => void;\n} = {};\n\n// PanelGroup might be rendering in a server-side environment where localStorage is not available\n// or on a browser with cookies/storage disabled.\n// In either case, this function avoids accessing localStorage until needed,\n// and avoids throwing user-visible errors.\nfunction initializeDefaultStorage(storageObject: PanelGroupStorage) {\n try {\n if (typeof localStorage !== \"undefined\") {\n // Bypass this check for future calls\n storageObject.getItem = (name: string) => {\n return localStorage.getItem(name);\n };\n storageObject.setItem = (name: string, value: string) => {\n localStorage.setItem(name, value);\n };\n } else {\n throw new Error(\"localStorage not supported in this environment\");\n }\n } catch (error) {\n console.error(error);\n\n storageObject.getItem = () => null;\n storageObject.setItem = () => {};\n }\n}\n\nconst defaultStorage: PanelGroupStorage = {\n getItem: (name: string) => {\n initializeDefaultStorage(defaultStorage);\n return defaultStorage.getItem(name);\n },\n setItem: (name: string, value: string) => {\n initializeDefaultStorage(defaultStorage);\n defaultStorage.setItem(name, value);\n },\n};\n\nexport type CommittedValues = {\n direction: Direction;\n panels: Map<string, PanelData>;\n sizes: number[];\n};\n\nexport type PanelDataMap = Map<string, PanelData>;\n\n// Initial drag state serves a few purposes:\n// * dragOffset:\n// Resize is calculated by the distance between the current pointer event and the resize handle being \"dragged\"\n// This value accounts for the initial offset when the touch/click starts, so the handle doesn't appear to \"jump\"\n// * dragHandleRect, sizes:\n// When resizing is done via mouse/touch event– some initial state is stored\n// so that any panels that contract will also expand if drag direction is reversed.\nexport type InitialDragState = {\n dragHandleRect: DOMRect;\n dragOffset: number;\n sizes: number[];\n};\n\n// TODO\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 type PanelGroupProps = {\n autoSaveId?: string;\n children?: ReactNode;\n className?: string;\n direction: Direction;\n disablePointerEventsDuringResize?: boolean;\n id?: string | null;\n onLayout?: PanelGroupOnLayout;\n storage?: PanelGroupStorage;\n style?: CSSProperties;\n tagName?: ElementType;\n};\n\nexport type ImperativePanelGroupHandle = {\n getLayout: () => number[];\n setLayout: (panelSizes: number[]) => void;\n};\n\nfunction PanelGroupWithForwardedRef({\n autoSaveId,\n children = null,\n className: classNameFromProps = \"\",\n direction,\n disablePointerEventsDuringResize = false,\n forwardedRef,\n id: idFromProps = null,\n onLayout,\n storage = defaultStorage,\n style: styleFromProps = {},\n tagName: Type = \"div\",\n}: PanelGroupProps & {\n forwardedRef: ForwardedRef<ImperativePanelGroupHandle>;\n}) {\n const groupId = useUniqueId(idFromProps);\n\n const [activeHandleId, setActiveHandleId] = useState<string | null>(null);\n const [panels, setPanels] = useState<PanelDataMap>(new Map());\n\n // When resizing is done via mouse/touch event–\n // We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.\n // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.\n const initialDragStateRef = useRef<InitialDragState | null>(null);\n\n // Use a ref to guard against users passing inline props\n const callbacksRef = useRef<{\n onLayout: PanelGroupOnLayout | undefined;\n }>({ onLayout });\n useEffect(() => {\n callbacksRef.current.onLayout = onLayout;\n });\n\n const panelIdToLastNotifiedSizeMapRef = useRef<Record<string, number>>({});\n\n // 0-1 values representing the relative size of each panel.\n const [sizes, setSizes] = useState<number[]>([]);\n\n // Used to support imperative collapse/expand API.\n const panelSizeBeforeCollapse = useRef<Map<string, number>>(new Map());\n\n const prevDeltaRef = useRef<number>(0);\n\n // Store committed values to avoid unnecessarily re-running memoization/effects functions.\n const committedValuesRef = useRef<CommittedValues>({\n direction,\n panels,\n sizes,\n });\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n getLayout: () => {\n const { sizes } = committedValuesRef.current;\n return sizes;\n },\n setLayout: (sizes: number[]) => {\n const total = sizes.reduce(\n (accumulated, current) => accumulated + current,\n 0\n );\n\n assert(total === 100, \"Panel sizes must add up to 100%\");\n\n const { panels } = committedValuesRef.current;\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n const panelsArray = panelsMapToSortedArray(panels);\n\n setSizes(sizes);\n\n callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);\n },\n }),\n []\n );\n\n useIsomorphicLayoutEffect(() => {\n committedValuesRef.current.direction = direction;\n committedValuesRef.current.panels = panels;\n committedValuesRef.current.sizes = sizes;\n });\n\n useWindowSplitterPanelGroupBehavior({\n committedValuesRef,\n groupId,\n panels,\n setSizes,\n sizes,\n panelSizeBeforeCollapse,\n });\n\n // Notify external code when sizes have changed.\n useEffect(() => {\n const { onLayout } = callbacksRef.current!;\n const { panels, sizes } = committedValuesRef.current;\n\n // Don't commit layout until all panels have registered and re-rendered with their actual sizes.\n if (sizes.length > 0) {\n if (onLayout) {\n onLayout(sizes);\n }\n\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n\n // When possible, we notify before the next render so that rendering work can be batched together.\n // Some cases are difficult to detect though,\n // for example– panels that are conditionally rendered can affect the size of neighboring panels.\n // In this case, the best we can do is notify on commit.\n // The callPanelCallbacks() uses its own memoization to avoid notifying panels twice in these cases.\n const panelsArray = panelsMapToSortedArray(panels);\n callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap);\n }\n }, [sizes]);\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 useIsomorphicLayoutEffect(() => {\n const sizes = committedValuesRef.current.sizes;\n if (sizes.length === panels.size) {\n // Only compute (or restore) default sizes once per panel configuration.\n return;\n }\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[] | null = null;\n if (autoSaveId) {\n const panelsArray = panelsMapToSortedArray(panels);\n defaultSizes = loadPanelLayout(autoSaveId, panelsArray, storage);\n }\n\n if (defaultSizes != null) {\n setSizes(defaultSizes);\n } else {\n const panelsArray = panelsMapToSortedArray(panels);\n\n let panelsWithNullDefaultSize = 0;\n let totalDefaultSize = 0;\n let totalMinSize = 0;\n\n // TODO\n // Implicit default size calculations below do not account for inferred min/max size values.\n // e.g. if Panel A has a maxSize of 40 then Panels A and B can't both have an implicit default size of 50.\n // For now, these logic edge cases are left to the user to handle via props.\n\n panelsArray.forEach((panel) => {\n totalMinSize += panel.current.minSize;\n\n if (panel.current.defaultSize === null) {\n panelsWithNullDefaultSize++;\n } else {\n totalDefaultSize += panel.current.defaultSize;\n }\n });\n\n if (totalDefaultSize > 100) {\n throw new Error(`Default panel sizes cannot exceed 100%`);\n } else if (\n panelsArray.length > 1 &&\n panelsWithNullDefaultSize === 0 &&\n totalDefaultSize !== 100\n ) {\n throw new Error(`Invalid default sizes specified for panels`);\n } else if (totalMinSize > 100) {\n throw new Error(`Minimum panel sizes cannot exceed 100%`);\n }\n\n setSizes(\n panelsArray.map((panel) => {\n if (panel.current.defaultSize === null) {\n return (100 - totalDefaultSize) / panelsWithNullDefaultSize;\n }\n\n return panel.current.defaultSize;\n })\n );\n }\n }, [autoSaveId, panels, storage]);\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 panelsArray = panelsMapToSortedArray(panels);\n\n // Limit the frequency of localStorage updates.\n if (!debounceMap[autoSaveId]) {\n debounceMap[autoSaveId] = debounce(savePanelGroupLayout, 100);\n }\n debounceMap[autoSaveId](autoSaveId, panelsArray, sizes, storage);\n }\n }, [autoSaveId, panels, sizes, storage]);\n\n const getPanelStyle = useCallback(\n (id: string, defaultSize: number | null): CSSProperties => {\n const { panels } = committedValuesRef.current;\n\n // Before mounting, Panels will not yet have registered themselves.\n // This includes server rendering.\n // At this point the best we can do is render everything with the same size.\n if (panels.size === 0) {\n if (isDevelopment) {\n if (isServerRendering() && defaultSize == null) {\n console.warn(\n `WARNING: Panel defaultSize prop recommended to avoid layout shift after server rendering`\n );\n }\n }\n\n return {\n flexBasis: 0,\n flexGrow: defaultSize != null ? defaultSize : undefined,\n flexShrink: 1,\n\n // Without this, Panel sizes may be unintentionally overridden by their content.\n overflow: \"hidden\",\n };\n }\n\n const flexGrow = getFlexGrow(panels, id, sizes);\n\n return {\n flexBasis: 0,\n flexGrow,\n flexShrink: 1,\n\n // Without this, Panel sizes may be unintentionally overridden by their content.\n overflow: \"hidden\",\n\n // Disable pointer events inside of a panel during resize.\n // This avoid edge cases like nested iframes.\n pointerEvents:\n disablePointerEventsDuringResize && activeHandleId !== null\n ? \"none\"\n : undefined,\n };\n },\n [activeHandleId, disablePointerEventsDuringResize, sizes]\n );\n\n const registerPanel = useCallback((id: string, panelRef: PanelData) => {\n setPanels((prevPanels) => {\n if (prevPanels.has(id)) {\n return prevPanels;\n }\n\n const nextPanels = new Map(prevPanels);\n nextPanels.set(id, panelRef);\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 panels,\n sizes: prevSizes,\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 let movement = getMovement(\n event,\n groupId,\n handleId,\n panelsArray,\n direction,\n prevSizes,\n initialDragStateRef.current\n );\n if (movement === 0) {\n return;\n }\n\n const groupElement = getPanelGroup(groupId)!;\n const rect = groupElement.getBoundingClientRect();\n const isHorizontal = direction === \"horizontal\";\n\n // Support RTL layouts\n if (document.dir === \"rtl\" && isHorizontal) {\n movement = -movement;\n }\n\n const size = isHorizontal ? rect.width : rect.height;\n const delta = (movement / size) * 100;\n\n const nextSizes = adjustByDelta(\n event,\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes,\n panelSizeBeforeCollapse.current,\n initialDragStateRef.current\n );\n\n const sizesChanged = !areEqual(prevSizes, nextSizes);\n\n // Don't update cursor for resizes triggered by keyboard interactions.\n if (isMouseEvent(event) || isTouchEvent(event)) {\n // Watch for multiple subsequent deltas; this might occur for tiny cursor movements.\n // In this case, Panel sizes might not change–\n // but updating cursor in this scenario would cause a flicker.\n if (prevDeltaRef.current != delta) {\n if (!sizesChanged) {\n // If the pointer has moved too far to resize the panel any further,\n // update the cursor style for a visual clue.\n // This mimics VS Code behavior.\n\n if (isHorizontal) {\n setGlobalCursorStyle(\n movement < 0 ? \"horizontal-min\" : \"horizontal-max\"\n );\n } else {\n setGlobalCursorStyle(\n movement < 0 ? \"vertical-min\" : \"vertical-max\"\n );\n }\n } else {\n // Reset the cursor style to the the normal resize cursor.\n setGlobalCursorStyle(isHorizontal ? \"horizontal\" : \"vertical\");\n }\n }\n }\n\n if (sizesChanged) {\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n\n setSizes(nextSizes);\n\n // If resize change handlers have been declared, this is the time to call them.\n // Trigger user callbacks after updating state, so that user code can override the sizes.\n callPanelCallbacks(\n panelsArray,\n nextSizes,\n panelIdToLastNotifiedSizeMap\n );\n }\n\n prevDeltaRef.current = delta;\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 collapsePanel = useCallback((id: string) => {\n const { panels, sizes: prevSizes } = committedValuesRef.current;\n\n const panel = panels.get(id);\n if (panel == null) {\n return;\n }\n\n const { collapsedSize, collapsible } = panel.current;\n if (!collapsible) {\n return;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.indexOf(panel);\n if (index < 0) {\n return;\n }\n\n const currentSize = prevSizes[index];\n if (currentSize === collapsedSize) {\n // Panel is already collapsed.\n return;\n }\n\n panelSizeBeforeCollapse.current.set(id, currentSize);\n\n const [idBefore, idAfter] = getBeforeAndAfterIds(id, panelsArray);\n if (idBefore == null || idAfter == null) {\n return;\n }\n\n const isLastPanel = index === panelsArray.length - 1;\n const delta = isLastPanel ? currentSize : collapsedSize - currentSize;\n\n const nextSizes = adjustByDelta(\n null,\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes,\n panelSizeBeforeCollapse.current,\n null\n );\n if (prevSizes !== nextSizes) {\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n\n setSizes(nextSizes);\n\n // If resize change handlers have been declared, this is the time to call them.\n // Trigger user callbacks after updating state, so that user code can override the sizes.\n callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);\n }\n }, []);\n\n const expandPanel = useCallback((id: string) => {\n const { panels, sizes: prevSizes } = committedValuesRef.current;\n\n const panel = panels.get(id);\n if (panel == null) {\n return;\n }\n\n const { collapsedSize, minSize } = panel.current;\n\n const sizeBeforeCollapse =\n panelSizeBeforeCollapse.current.get(id) || minSize;\n if (!sizeBeforeCollapse) {\n return;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.indexOf(panel);\n if (index < 0) {\n return;\n }\n\n const currentSize = prevSizes[index];\n if (currentSize !== collapsedSize) {\n // Panel is already expanded.\n return;\n }\n\n const [idBefore, idAfter] = getBeforeAndAfterIds(id, panelsArray);\n if (idBefore == null || idAfter == null) {\n return;\n }\n\n const isLastPanel = index === panelsArray.length - 1;\n const delta = isLastPanel\n ? collapsedSize - sizeBeforeCollapse\n : sizeBeforeCollapse;\n\n const nextSizes = adjustByDelta(\n null,\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes,\n panelSizeBeforeCollapse.current,\n null\n );\n if (prevSizes !== nextSizes) {\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n\n setSizes(nextSizes);\n\n // If resize change handlers have been declared, this is the time to call them.\n // Trigger user callbacks after updating state, so that user code can override the sizes.\n callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);\n }\n }, []);\n\n const resizePanel = useCallback((id: string, nextSize: number) => {\n const { panels, sizes: prevSizes } = committedValuesRef.current;\n\n const panel = panels.get(id);\n if (panel == null) {\n return;\n }\n\n const { collapsedSize, collapsible, maxSize, minSize } = panel.current;\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.indexOf(panel);\n if (index < 0) {\n return;\n }\n\n const currentSize = prevSizes[index];\n if (currentSize === nextSize) {\n return;\n }\n\n if (collapsible && nextSize === collapsedSize) {\n // This is a valid resize state.\n } else {\n nextSize = Math.min(maxSize, Math.max(minSize, nextSize));\n }\n\n const [idBefore, idAfter] = getBeforeAndAfterIds(id, panelsArray);\n if (idBefore == null || idAfter == null) {\n return;\n }\n\n const isLastPanel = index === panelsArray.length - 1;\n const delta = isLastPanel ? currentSize - nextSize : nextSize - currentSize;\n\n const nextSizes = adjustByDelta(\n null,\n panels,\n idBefore,\n idAfter,\n delta,\n prevSizes,\n panelSizeBeforeCollapse.current,\n null\n );\n if (prevSizes !== nextSizes) {\n const panelIdToLastNotifiedSizeMap =\n panelIdToLastNotifiedSizeMapRef.current;\n\n setSizes(nextSizes);\n\n // If resize change handlers have been declared, this is the time to call them.\n // Trigger user callbacks after updating state, so that user code can override the sizes.\n callPanelCallbacks(panelsArray, nextSizes, panelIdToLastNotifiedSizeMap);\n }\n }, []);\n\n const context = useMemo(\n () => ({\n activeHandleId,\n collapsePanel,\n direction,\n expandPanel,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n resizePanel,\n startDragging: (id: string, event: ResizeEvent) => {\n setActiveHandleId(id);\n\n if (isMouseEvent(event) || isTouchEvent(event)) {\n const handleElement = getResizeHandle(id)!;\n\n initialDragStateRef.current = {\n dragHandleRect: handleElement.getBoundingClientRect(),\n dragOffset: getDragOffset(event, id, direction),\n sizes: committedValuesRef.current.sizes,\n };\n }\n },\n stopDragging: () => {\n resetGlobalCursorStyle();\n setActiveHandleId(null);\n\n initialDragStateRef.current = null;\n },\n unregisterPanel,\n }),\n [\n activeHandleId,\n collapsePanel,\n direction,\n expandPanel,\n getPanelStyle,\n groupId,\n registerPanel,\n registerResizeHandle,\n resizePanel,\n unregisterPanel,\n ]\n );\n\n const style: CSSProperties = {\n display: \"flex\",\n flexDirection: direction === \"horizontal\" ? \"row\" : \"column\",\n height: \"100%\",\n overflow: \"hidden\",\n width: \"100%\",\n };\n\n return createElement(PanelGroupContext.Provider, {\n children: createElement(Type, {\n children,\n className: classNameFromProps,\n \"data-panel-group\": \"\",\n \"data-panel-group-direction\": direction,\n \"data-panel-group-id\": groupId,\n style: { ...style, ...styleFromProps },\n }),\n value: context,\n });\n}\n\nexport const PanelGroup = forwardRef<\n ImperativePanelGroupHandle,\n PanelGroupProps\n>((props: PanelGroupProps, ref: ForwardedRef<ImperativePanelGroupHandle>) =>\n createElement(PanelGroupWithForwardedRef, { ...props, forwardedRef: ref })\n);\n\n// Workaround for Parcel scope hoisting (which renames objects/functions).\n// Casting to :any is required to avoid corrupting the generated TypeScript types.\n// See github.com/parcel-bundler/parcel/issues/8724\n(PanelGroupWithForwardedRef as any).displayName = \"PanelGroup\";\n(PanelGroup as any).displayName = \"forwardRef(PanelGroup)\";\n","export const isDevelopment = false;\n","import { RefObject, useEffect } from \"../vendor/react\";\nimport { PRECISION } from \"../constants\";\n\nimport { CommittedValues, PanelDataMap } from \"../PanelGroup\";\nimport { ResizeHandler } from \"../types\";\nimport {\n adjustByDelta,\n getPanel,\n getPanelGroup,\n getResizeHandle,\n getResizeHandleIndex,\n getResizeHandlePanelIds,\n getResizeHandles,\n getResizeHandlesForGroup,\n getFlexGrow,\n panelsMapToSortedArray,\n} from \"../utils/group\";\nimport { assert } from \"../utils/assert\";\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 panelSizeBeforeCollapse,\n}: {\n committedValuesRef: RefObject<CommittedValues>;\n groupId: string;\n panels: PanelDataMap;\n setSizes: (sizes: number[]) => void;\n sizes: number[];\n panelSizeBeforeCollapse: RefObject<Map<string, number>>;\n}): void {\n useEffect(() => {\n const { direction, panels } = committedValuesRef.current!;\n\n const groupElement = getPanelGroup(groupId)!;\n const { height, width } = groupElement.getBoundingClientRect();\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 let minSize = 0;\n let maxSize = 100;\n let totalMinSize = 0;\n let totalMaxSize = 0;\n\n // A panel's effective min/max sizes also need to account for other panel's sizes.\n panelsArray.forEach((panelData) => {\n if (panelData.current.id === idBefore) {\n maxSize = panelData.current.maxSize;\n minSize = panelData.current.minSize;\n } else {\n totalMinSize += panelData.current.minSize;\n totalMaxSize += panelData.current.maxSize;\n }\n });\n\n const ariaValueMax = Math.min(maxSize, 100 - totalMinSize);\n const ariaValueMin = Math.max(\n minSize,\n (panelsArray.length - 1) * 100 - totalMaxSize\n );\n\n const flexGrow = getFlexGrow(panels, idBefore, sizes);\n\n handle.setAttribute(\"aria-valuemax\", \"\" + Math.round(ariaValueMax));\n handle.setAttribute(\"aria-valuemin\", \"\" + Math.round(ariaValueMin));\n handle.setAttribute(\"aria-valuenow\", \"\" + Math.round(parseInt(flexGrow)));\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.defaultPrevented) {\n return;\n }\n\n switch (event.key) {\n case \"Enter\": {\n event.preventDefault();\n\n const index = panelsArray.findIndex(\n (panel) => panel.current.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.current.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 event,\n panels,\n idBefore,\n idAfter,\n delta,\n sizes,\n panelSizeBeforeCollapse.current!,\n null\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 }, [\n committedValuesRef,\n groupId,\n panels,\n panelSizeBeforeCollapse,\n setSizes,\n sizes,\n ]);\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 if (event.defaultPrevented) {\n return;\n }\n\n switch (event.key) {\n case \"ArrowDown\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"ArrowUp\":\n case \"End\":\n case \"Home\": {\n event.preventDefault();\n\n resizeHandler(event);\n break;\n }\n case \"F6\": {\n event.preventDefault();\n\n const handles = getResizeHandles();\n const index = getResizeHandleIndex(handleId);\n\n assert(index !== null);\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","export const PRECISION = 10;\n","import { InitialDragState } from \"../PanelGroup\";\nimport { PRECISION } from \"../constants\";\nimport { PanelData, ResizeEvent } from \"../types\";\n\nexport function adjustByDelta(\n event: ResizeEvent | null,\n panels: Map<string, PanelData>,\n idBefore: string,\n idAfter: string,\n delta: number,\n prevSizes: number[],\n panelSizeBeforeCollapse: Map<string, number>,\n initialDragState: InitialDragState | null\n): number[] {\n const { sizes: initialSizes } = initialDragState || {};\n\n // If we're resizing by mouse or touch, use the initial sizes as a base.\n // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.\n const baseSizes = initialSizes || prevSizes;\n\n if (delta === 0) {\n return baseSizes;\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const nextSizes = baseSizes.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\n // Max-bounds check the panel being expanded first.\n {\n const pivotId = delta < 0 ? idAfter : idBefore;\n const index = panelsArray.findIndex(\n (panel) => panel.current.id === pivotId\n );\n const panel = panelsArray[index];\n const baseSize = baseSizes[index];\n\n const nextSize = safeResizePanel(panel, Math.abs(delta), baseSize, event);\n if (baseSize === nextSize) {\n // If there's no room for the pivot panel to grow, we can ignore this drag update.\n return baseSizes;\n } else {\n if (nextSize === 0 && baseSize > 0) {\n panelSizeBeforeCollapse.set(pivotId, baseSize);\n }\n\n delta = delta < 0 ? baseSize - nextSize : nextSize - baseSize;\n }\n }\n\n let pivotId = delta < 0 ? idBefore : idAfter;\n let index = panelsArray.findIndex((panel) => panel.current.id === pivotId);\n while (true) {\n const panel = panelsArray[index];\n const baseSize = baseSizes[index];\n\n const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);\n\n const nextSize = safeResizePanel(\n panel,\n 0 - deltaRemaining,\n baseSize,\n event\n );\n if (baseSize !== nextSize) {\n if (nextSize === 0 && baseSize > 0) {\n panelSizeBeforeCollapse.set(panel.current.id, baseSize);\n }\n\n deltaApplied += baseSize - nextSize;\n\n nextSizes[index] = nextSize;\n\n if (\n deltaApplied\n .toPrecision(PRECISION)\n .localeCompare(Math.abs(delta).toPrecision(PRECISION), undefined, {\n numeric: true,\n }) >= 0\n ) {\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 baseSizes;\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.current.id === pivotId);\n nextSizes[index] = baseSizes[index] + deltaApplied;\n\n return nextSizes;\n}\n\nexport function callPanelCallbacks(\n panelsArray: PanelData[],\n sizes: number[],\n panelIdToLastNotifiedSizeMap: Record<string, number>\n) {\n sizes.forEach((size, index) => {\n const { callbacksRef, collapsedSize, collapsible, id } =\n panelsArray[index].current;\n\n const lastNotifiedSize = panelIdToLastNotifiedSizeMap[id];\n if (lastNotifiedSize !== size) {\n panelIdToLastNotifiedSizeMap[id] = size;\n\n const { onCollapse, onResize } = callbacksRef.current!;\n\n if (onResize) {\n onResize(size, lastNotifiedSize);\n }\n\n if (collapsible && onCollapse) {\n if (\n (lastNotifiedSize == null || lastNotifiedSize === collapsedSize) &&\n size !== collapsedSize\n ) {\n onCollapse(false);\n } else if (\n lastNotifiedSize !== collapsedSize &&\n size === collapsedSize\n ) {\n onCollapse(true);\n }\n }\n }\n });\n}\n\nexport function getBeforeAndAfterIds(\n id: string,\n panelsArray: PanelData[]\n): [idBefore: string | null, idAFter: string | null] {\n if (panelsArray.length < 2) {\n return [null, null];\n }\n\n const index = panelsArray.findIndex((panel) => panel.current.id === id);\n if (index < 0) {\n return [null, null];\n }\n\n const isLastPanel = index === panelsArray.length - 1;\n const idBefore = isLastPanel ? panelsArray[index - 1].current.id : id;\n const idAfter = isLastPanel ? id : panelsArray[index + 1].current.id;\n\n return [idBefore, idAfter];\n}\n\n// This method returns a number between 1 and 100 representing\n// the % of the group's overall space this panel should occupy.\nexport function getFlexGrow(\n panels: Map<string, PanelData>,\n id: string,\n sizes: number[]\n): string {\n if (panels.size === 1) {\n return \"100\";\n }\n\n const panelsArray = panelsMapToSortedArray(panels);\n\n const index = panelsArray.findIndex((panel) => panel.current.id === id);\n const size = sizes[index];\n if (size == null) {\n return \"0\";\n }\n\n return size.toPrecision(PRECISION);\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 getPanelGroup(id: string): HTMLDivElement | null {\n const element = document.querySelector(`[data-panel-group-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 = handle ? handles.indexOf(handle) : -1;\n\n const idBefore: string | null = panelsArray[index]?.current?.id ?? null;\n const idAfter: string | null = panelsArray[index + 1]?.current?.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((panelA, panelB) => {\n const orderA = panelA.current.order;\n const orderB = panelB.current.order;\n if (orderA == null && orderB == null) {\n return 0;\n } else if (orderA == null) {\n return -1;\n } else if (orderB == null) {\n return 1;\n } else {\n return orderA - orderB;\n }\n });\n}\n\nfunction safeResizePanel(\n panel: PanelData,\n delta: number,\n prevSize: number,\n event: ResizeEvent | null\n): number {\n const nextSizeUnsafe = prevSize + delta;\n\n const { collapsedSize, collapsible, maxSize, minSize } = panel.current;\n\n if (collapsible) {\n if (prevSize > collapsedSize) {\n // Mimic VS COde behavior; collapse a panel if it's smaller than half of its min-size\n if (nextSizeUnsafe <= minSize / 2 + collapsedSize) {\n return collapsedSize;\n }\n } else {\n const isKeyboardEvent = event?.type?.startsWith(\"key\");\n if (!isKeyboardEvent) {\n // Keyboard events should expand a collapsed panel to the min size,\n // but mouse events should wait until the panel has reached its min size\n // to avoid a visual flickering when dragging between collapsed and min size.\n if (nextSizeUnsafe < minSize) {\n return collapsedSize;\n }\n }\n }\n }\n\n const nextSize = Math.min(maxSize, Math.max(minSize, nextSizeUnsafe));\n\n return nextSize;\n}\n","export function assert(\n expectedCondition: boolean,\n message: string = \"Assertion failed!\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","export function areEqual(arrayA: any[], arrayB: any[]): boolean {\n if (arrayA.length !== arrayB.length) {\n return false;\n }\n\n for (let index = 0; index < arrayA.length; index++) {\n if (arrayA[index] !== arrayB[index]) {\n return false;\n }\n }\n\n return true;\n}\n","import { PRECISION } from \"../constants\";\nimport { InitialDragState } from \"../PanelGroup\";\nimport { Direction, PanelData, ResizeEvent } from \"../types\";\nimport {\n getPanelGroup,\n getResizeHandle,\n getResizeHandlePanelIds,\n} 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 initialHandleElementRect: DOMRect | null = null\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 =\n initialHandleElementRect || 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 groupId: string,\n handleId: string,\n panelsArray: PanelData[],\n direction: Direction,\n prevSizes: number[],\n initialDragState: InitialDragState | null\n): number {\n const {\n dragOffset = 0,\n dragHandleRect,\n sizes: initialSizes,\n } = initialDragState || {};\n\n // If we're resizing by mouse or touch, use the initial sizes as a base.\n // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.\n const baseSizes = initialSizes || prevSizes;\n\n if (isKeyDown(event)) {\n const isHorizontal = direction === \"horizontal\";\n\n const groupElement = getPanelGroup(groupId)!;\n const rect = groupElement.getBoundingClientRect();\n const groupSizeInPixels = isHorizontal ? rect.width : rect.height;\n\n const denominator = event.shiftKey ? 10 : 100;\n const delta = groupSizeInPixels / denominator;\n\n let movement = 0;\n switch (event.key) {\n case \"ArrowDown\":\n movement = isHorizontal ? 0 : delta;\n break;\n case \"ArrowLeft\":\n movement = isHorizontal ? -delta : 0;\n break;\n case \"ArrowRight\":\n movement = isHorizontal ? delta : 0;\n break;\n case \"ArrowUp\":\n movement = isHorizontal ? 0 : -delta;\n break;\n case \"End\":\n movement = groupSizeInPixels;\n break;\n case \"Home\":\n movement = -groupSizeInPixels;\n break;\n }\n\n // If the Panel being resized is collapsible,\n // we need to special case resizing around the minSize boundary.\n // If contracting, Panels should shrink to their minSize and then snap to fully collapsed.\n // If expanding from collapsed, they should snap back to their minSize.\n const [idBefore, idAfter] = getResizeHandlePanelIds(\n groupId,\n handleId,\n panelsArray\n );\n const targetPanelId = movement < 0 ? idBefore : idAfter;\n const targetPanelIndex = panelsArray.findIndex(\n (panel) => panel.current.id === targetPanelId\n );\n const targetPanel = panelsArray[targetPanelIndex];\n if (targetPanel.current.collapsible) {\n const baseSize = baseSizes[targetPanelIndex];\n if (\n baseSize === 0 ||\n baseSize.toPrecision(PRECISION) ===\n targetPanel.current.minSize.toPrecision(PRECISION)\n ) {\n movement =\n movement < 0\n ? -targetPanel.current.minSize * groupSizeInPixels\n : targetPanel.current.minSize * groupSizeInPixels;\n }\n }\n\n return movement;\n } else {\n return getDragOffset(\n event,\n handleId,\n direction,\n dragOffset,\n dragHandleRect\n );\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","type CursorState =\n | \"horizontal\"\n | \"horizontal-max\"\n | \"horizontal-min\"\n | \"vertical\"\n | \"vertical-max\"\n | \"vertical-min\";\n\nlet currentState: CursorState | null = null;\nlet element: HTMLStyleElement | null = null;\n\nexport function getCursorStyle(state: CursorState): string {\n switch (state) {\n case \"horizontal\":\n return \"ew-resize\";\n case \"horizontal-max\":\n return \"w-resize\";\n case \"horizontal-min\":\n return \"e-resize\";\n case \"vertical\":\n return \"ns-resize\";\n case \"vertical-max\":\n return \"n-resize\";\n case \"vertical-min\":\n return \"s-resize\";\n }\n}\n\nexport function resetGlobalCursorStyle() {\n if (element !== null) {\n document.head.removeChild(element);\n\n currentState = null;\n element = null;\n }\n}\n\nexport function setGlobalCursorStyle(state: CursorState) {\n if (currentState === state) {\n return;\n }\n\n currentState = state;\n\n const style = getCursorStyle(state);\n\n if (element === null) {\n element = document.createElement(\"style\");\n\n document.head.appendChild(element);\n }\n\n element.innerHTML = `*{cursor: ${style}!important;}`;\n}\n","export default function debounce<T extends Function>(\n callback: T,\n durationMs: number = 10\n) {\n let timeoutId: NodeJS.Timeout | null = null;\n\n let callable = (...args: any) => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n callback(...args);\n }, durationMs);\n };\n\n return callable as unknown as T;\n}\n","import { PanelData, PanelGroupStorage } from \"../types\";\n\ntype SerializedPanelGroupState = { [panelIds: string]: number[] };\n\n// Note that Panel ids might be user-provided (stable) or useId generated (non-deterministic)\n// so they should not be used as part of the serialization key.\n// Using an attribute like minSize instead should work well enough.\n// Pre-sorting by minSize allows remembering layouts even if panels are re-ordered/dragged.\nfunction getSerializationKey(panels: PanelData[]): string {\n return panels\n .map((panel) => {\n const { minSize, order } = panel.current;\n return order ? `${order}:${minSize}` : `${minSize}`;\n })\n .sort((a, b) => a.localeCompare(b))\n .join(\",\");\n}\n\nfunction loadSerializedPanelGroupState(\n autoSaveId: string,\n storage: PanelGroupStorage\n): SerializedPanelGroupState | null {\n try {\n const serialized = storage.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 panels: PanelData[],\n storage: PanelGroupStorage\n): number[] | null {\n const state = loadSerializedPanelGroupState(autoSaveId, storage);\n if (state) {\n const key = getSerializationKey(panels);\n return state[key] ?? null;\n }\n\n return null;\n}\n\nexport function savePanelGroupLayout(\n autoSaveId: string,\n panels: PanelData[],\n sizes: number[],\n storage: PanelGroupStorage\n): void {\n const key = getSerializationKey(panels);\n const state = loadSerializedPanelGroupState(autoSaveId, storage) || {};\n state[key] = sizes;\n\n try {\n storage.setItem(`PanelGroup:sizes:${autoSaveId}`, JSON.stringify(state));\n } catch (error) {\n console.error(error);\n }\n}\n","export function isServerRendering(): boolean {\n try {\n return typeof window === undefined;\n } catch (error) {}\n\n return true;\n}\n","import {\n createElement,\n CSSProperties,\n ElementType,\n MouseEvent as ReactMouseEvent,\n ReactNode,\n TouchEvent,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"./vendor/react\";\nimport useUniqueId from \"./hooks/useUniqueId\";\n\nimport { useWindowSplitterResizeHandlerBehavior } from \"./hooks/useWindowSplitterBehavior\";\nimport { PanelGroupContext } from \"./PanelContexts\";\nimport type {\n ResizeHandler,\n ResizeEvent,\n PanelResizeHandleOnDragging,\n} from \"./types\";\nimport { getCursorStyle } from \"./utils/cursor\";\n\nexport type PanelResizeHandleProps = {\n children?: ReactNode;\n className?: string;\n disabled?: boolean;\n id?: string | null;\n onDragging?: PanelResizeHandleOnDragging;\n style?: CSSProperties;\n tagName?: ElementType;\n};\n\nexport function PanelResizeHandle({\n children = null,\n className: classNameFromProps = \"\",\n disabled = false,\n id: idFromProps = null,\n onDragging,\n style: styleFromProps = {},\n tagName: Type = \"div\",\n}: PanelResizeHandleProps) {\n const divElementRef = useRef<HTMLDivElement>(null);\n\n // Use a ref to guard against users passing inline props\n const callbacksRef = useRef<{\n onDragging: PanelResizeHandleOnDragging | undefined;\n }>({ onDragging });\n useEffect(() => {\n callbacksRef.current.onDragging = onDragging;\n });\n\n const panelGroupContext = useContext(PanelGroupContext);\n if (panelGroupContext === null) {\n throw Error(\n `PanelResizeHandle components must be rendered within a PanelGroup container`\n );\n }\n\n const {\n activeHandleId,\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 [isFocused, setIsFocused] = useState(false);\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\n const { onDragging } = callbacksRef.current;\n if (onDragging) {\n onDragging(false);\n }\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 const onMove = (event: ResizeEvent) => {\n resizeHandler(event);\n };\n\n const onMouseLeave = (event: MouseEvent) => {\n resizeHandler(event);\n };\n\n const divElement = divElementRef.current!;\n const targetDocument = divElement.ownerDocument;\n\n targetDocument.body.addEventListener(\"contextmenu\", stopDraggingAndBlur);\n targetDocument.body.addEventListener(\"mousemove\", onMove);\n targetDocument.body.addEventListener(\"touchmove\", onMove);\n targetDocument.body.addEventListener(\"mouseleave\", onMouseLeave);\n window.addEventListener(\"mouseup\", stopDraggingAndBlur);\n window.addEventListener(\"touchend\", stopDraggingAndBlur);\n\n return () => {\n targetDocument.body.removeEventListener(\n \"contextmenu\",\n stopDraggingAndBlur\n );\n targetDocument.body.removeEventListener(\"mousemove\", onMove);\n targetDocument.body.removeEventListener(\"touchmove\", onMove);\n targetDocument.body.removeEventListener(\"mouseleave\", onMouseLeave);\n window.removeEventListener(\"mouseup\", stopDraggingAndBlur);\n window.removeEventListener(\"touchend\", stopDraggingAndBlur);\n };\n }, [direction, disabled, isDragging, resizeHandler, stopDraggingAndBlur]);\n\n useWindowSplitterResizeHandlerBehavior({\n disabled,\n handleId: resizeHandleId,\n resizeHandler,\n });\n\n const style: CSSProperties = {\n cursor: getCursorStyle(direction),\n touchAction: \"none\",\n userSelect: \"none\",\n };\n\n return createElement(Type, {\n children,\n className: classNameFromProps,\n \"data-resize-handle-active\": isDragging\n ? \"pointer\"\n : isFocused\n ? \"keyboard\"\n : undefined,\n \"data-panel-group-direction\": direction,\n \"data-panel-group-id\": groupId,\n \"data-panel-resize-handle-enabled\": !disabled,\n \"data-panel-resize-handle-id\": resizeHandleId,\n onBlur: () => setIsFocused(false),\n onFocus: () => setIsFocused(true),\n onMouseDown: (event: ReactMouseEvent) => {\n startDragging(resizeHandleId, event.nativeEvent);\n\n const { onDragging } = callbacksRef.current!;\n if (onDragging) {\n onDragging(true);\n }\n },\n onMouseUp: stopDraggingAndBlur,\n onTouchCancel: stopDraggingAndBlur,\n onTouchEnd: stopDraggingAndBlur,\n onTouchStart: (event: TouchEvent) => {\n startDragging(resizeHandleId, event.nativeEvent);\n\n const { onDragging } = callbacksRef.current!;\n if (onDragging) {\n onDragging(true);\n }\n },\n ref: divElementRef,\n role: \"separator\",\n style: {\n ...style,\n ...styleFromProps,\n },\n tabIndex: 0,\n });\n}\n\n// Workaround for Parcel scope hoisting (which renames objects/functions).\n// Casting to :any is required to avoid corrupting the generated TypeScript types.\n// See github.com/parcel-bundler/parcel/issues/8724\n(PanelResizeHandle as any).displayName = \"PanelResizeHandle\";\n"],"names":[],"version":3,"file":"react-resizable-panels.esm.js.map","sourceRoot":"../../../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "React components for resizable panel groups/layouts",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
6
6
  "license": "MIT",
package/src/Panel.ts CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  export type PanelProps = {
25
25
  children?: ReactNode;
26
26
  className?: string;
27
+ collapsedSize?: number;
27
28
  collapsible?: boolean;
28
29
  defaultSize?: number | null;
29
30
  id?: string | null;
@@ -47,6 +48,7 @@ export type ImperativePanelHandle = {
47
48
  function PanelWithForwardedRef({
48
49
  children = null,
49
50
  className: classNameFromProps = "",
51
+ collapsedSize = 0,
50
52
  collapsible = false,
51
53
  defaultSize = null,
52
54
  forwardedRef,
@@ -119,6 +121,7 @@ function PanelWithForwardedRef({
119
121
  });
120
122
  const panelDataRef = useRef<{
121
123
  callbacksRef: PanelCallbackRef;
124
+ collapsedSize: number;
122
125
  collapsible: boolean;
123
126
  defaultSize: number | null;
124
127
  id: string;
@@ -127,6 +130,7 @@ function PanelWithForwardedRef({
127
130
  order: number | null;
128
131
  }>({
129
132
  callbacksRef,
133
+ collapsedSize,
130
134
  collapsible,
131
135
  defaultSize,
132
136
  id: panelId,
@@ -138,6 +142,7 @@ function PanelWithForwardedRef({
138
142
  committedValuesRef.current.size = parseSizeFromStyle(style);
139
143
 
140
144
  panelDataRef.current.callbacksRef = callbacksRef;
145
+ panelDataRef.current.collapsedSize = collapsedSize;
141
146
  panelDataRef.current.collapsible = collapsible;
142
147
  panelDataRef.current.defaultSize = defaultSize;
143
148
  panelDataRef.current.id = panelId;