react-resizable-panels 0.0.33 → 0.0.34

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.
@@ -139,9 +139,9 @@ function $6ff1a22b27cc039d$var$getSerializationKey(panels) {
139
139
  return order ? `${order}:${minSize}` : `${minSize}`;
140
140
  }).sort((a, b)=>a.localeCompare(b)).join(",");
141
141
  }
142
- function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) {
142
+ function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage) {
143
143
  try {
144
- const serialized = localStorage.getItem(`PanelGroup:sizes:${autoSaveId}`);
144
+ const serialized = storage.getItem(`PanelGroup:sizes:${autoSaveId}`);
145
145
  if (serialized) {
146
146
  const parsed = JSON.parse(serialized);
147
147
  if (typeof parsed === "object" && parsed != null) return parsed;
@@ -149,20 +149,20 @@ function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) {
149
149
  } catch (error) {}
150
150
  return null;
151
151
  }
152
- function $6ff1a22b27cc039d$export$9c80c6617f0386da(autoSaveId, panels) {
153
- const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId);
152
+ function $6ff1a22b27cc039d$export$9c80c6617f0386da(autoSaveId, panels, storage) {
153
+ const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage);
154
154
  if (state) {
155
155
  const key = $6ff1a22b27cc039d$var$getSerializationKey(panels);
156
156
  return state[key] || null;
157
157
  }
158
158
  return null;
159
159
  }
160
- function $6ff1a22b27cc039d$export$af183b313c61be4f(autoSaveId, panels, sizes) {
160
+ function $6ff1a22b27cc039d$export$af183b313c61be4f(autoSaveId, panels, sizes, storage) {
161
161
  const key = $6ff1a22b27cc039d$var$getSerializationKey(panels);
162
- const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) || {};
162
+ const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage) || {};
163
163
  state[key] = sizes;
164
164
  try {
165
- localStorage.setItem(`PanelGroup:sizes:${autoSaveId}`, JSON.stringify(state));
165
+ storage.setItem(`PanelGroup:sizes:${autoSaveId}`, JSON.stringify(state));
166
166
  } catch (error) {
167
167
  console.error(error);
168
168
  }
@@ -173,10 +173,14 @@ const $fc25b75732bfda27$export$d6d3992f3becc879 = 10;
173
173
 
174
174
 
175
175
 
176
- function $f30c804b5fe6cc1a$export$f50bae335f53943c(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse) {
177
- if (delta === 0) return prevSizes;
176
+ function $f30c804b5fe6cc1a$export$f50bae335f53943c(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse, initialDragState) {
177
+ const { sizes: initialSizes } = initialDragState || {};
178
+ // If we're resizing by mouse or touch, use the initial sizes as a base.
179
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
180
+ const baseSizes = initialSizes || prevSizes;
181
+ if (delta === 0) return baseSizes;
178
182
  const panelsArray = $f30c804b5fe6cc1a$export$a861c0ad45885494(panels);
179
- const nextSizes = prevSizes.concat();
183
+ const nextSizes = baseSizes.concat();
180
184
  let deltaApplied = 0;
181
185
  // A resizing panel affects the panels before or after it.
182
186
  //
@@ -190,25 +194,29 @@ function $f30c804b5fe6cc1a$export$f50bae335f53943c(event, panels, idBefore, idAf
190
194
  const pivotId = delta < 0 ? idAfter : idBefore;
191
195
  const index = panelsArray.findIndex((panel)=>panel.id === pivotId);
192
196
  const panel = panelsArray[index];
193
- const prevSize = prevSizes[index];
194
- const nextSize = $f30c804b5fe6cc1a$var$safeResizePanel(panel, Math.abs(delta), prevSize, event);
195
- if (prevSize === nextSize) return prevSizes;
197
+ const baseSize = baseSizes[index];
198
+ const nextSize = $f30c804b5fe6cc1a$var$safeResizePanel(panel, Math.abs(delta), baseSize, event);
199
+ if (baseSize === nextSize) // If there's no room for the pivot panel to grow, we can ignore this drag update.
200
+ return baseSizes;
196
201
  else {
197
- if (nextSize === 0 && prevSize > 0) panelSizeBeforeCollapse.set(pivotId, prevSize);
198
- delta = delta < 0 ? prevSize - nextSize : nextSize - prevSize;
202
+ if (nextSize === 0 && baseSize > 0) panelSizeBeforeCollapse.set(pivotId, baseSize);
203
+ delta = delta < 0 ? baseSize - nextSize : nextSize - baseSize;
199
204
  }
200
205
  }
201
206
  let pivotId1 = delta < 0 ? idBefore : idAfter;
202
207
  let index1 = panelsArray.findIndex((panel)=>panel.id === pivotId1);
203
208
  while(true){
204
209
  const panel1 = panelsArray[index1];
205
- const prevSize1 = prevSizes[index1];
206
- const nextSize1 = $f30c804b5fe6cc1a$var$safeResizePanel(panel1, 0 - Math.abs(delta), prevSize1, event);
207
- if (prevSize1 !== nextSize1) {
208
- if (nextSize1 === 0 && prevSize1 > 0) panelSizeBeforeCollapse.set(panel1.id, prevSize1);
209
- deltaApplied += prevSize1 - nextSize1;
210
+ const baseSize1 = baseSizes[index1];
211
+ const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
212
+ const nextSize1 = $f30c804b5fe6cc1a$var$safeResizePanel(panel1, 0 - deltaRemaining, baseSize1, event);
213
+ if (baseSize1 !== nextSize1) {
214
+ if (nextSize1 === 0 && baseSize1 > 0) panelSizeBeforeCollapse.set(panel1.id, baseSize1);
215
+ deltaApplied += baseSize1 - nextSize1;
210
216
  nextSizes[index1] = nextSize1;
211
- if (deltaApplied.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) >= delta.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) break;
217
+ if (deltaApplied.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)).localeCompare(Math.abs(delta).toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)), undefined, {
218
+ numeric: true
219
+ }) >= 0) break;
212
220
  }
213
221
  if (delta < 0) {
214
222
  if (--index1 < 0) break;
@@ -218,11 +226,11 @@ function $f30c804b5fe6cc1a$export$f50bae335f53943c(event, panels, idBefore, idAf
218
226
  }
219
227
  // If we were unable to resize any of the panels panels, return the previous state.
220
228
  // This will essentially bailout and ignore the "mousemove" event.
221
- if (deltaApplied === 0) return prevSizes;
229
+ if (deltaApplied === 0) return baseSizes;
222
230
  // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
223
231
  pivotId1 = delta < 0 ? idAfter : idBefore;
224
232
  index1 = panelsArray.findIndex((panel)=>panel.id === pivotId1);
225
- nextSizes[index1] = prevSizes[index1] + deltaApplied;
233
+ nextSizes[index1] = baseSizes[index1] + deltaApplied;
226
234
  return nextSizes;
227
235
  }
228
236
  function $f30c804b5fe6cc1a$export$b8e48269e4faa934(panelsArray, prevSizes, nextSizes) {
@@ -327,7 +335,7 @@ function $f30c804b5fe6cc1a$var$safeResizePanel(panel, delta, prevSize, event) {
327
335
  }
328
336
 
329
337
 
330
- function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset = 0) {
338
+ function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset = 0, initialHandleElementRect = null) {
331
339
  const isHorizontal = direction === "horizontal";
332
340
  let pointerOffset = 0;
333
341
  if ($96f6397ae645d178$export$764db16956f554f8(event)) pointerOffset = isHorizontal ? event.clientX : event.clientY;
@@ -336,11 +344,15 @@ function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, i
336
344
  pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;
337
345
  } else return 0;
338
346
  const handleElement = (0, $f30c804b5fe6cc1a$export$2e27d3a347680388)(handleId);
339
- const rect = handleElement.getBoundingClientRect();
347
+ const rect = initialHandleElementRect || handleElement.getBoundingClientRect();
340
348
  const elementOffset = isHorizontal ? rect.left : rect.top;
341
349
  return pointerOffset - elementOffset - initialOffset;
342
350
  }
343
- function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, panelsArray, direction, sizes, initialOffset) {
351
+ function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, panelsArray, direction, prevSizes, initialDragState) {
352
+ const { dragOffset: dragOffset = 0 , dragHandleRect: dragHandleRect , sizes: initialSizes } = initialDragState || {};
353
+ // If we're resizing by mouse or touch, use the initial sizes as a base.
354
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
355
+ const baseSizes = initialSizes || prevSizes;
344
356
  if ($96f6397ae645d178$export$e7bf60a870f429b0(event)) {
345
357
  const isHorizontal = direction === "horizontal";
346
358
  const groupElement = (0, $f30c804b5fe6cc1a$export$5e67632cf3550a9c)(groupId);
@@ -378,11 +390,11 @@ function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, pan
378
390
  const targetPanelIndex = panelsArray.findIndex((panel)=>panel.id === targetPanelId);
379
391
  const targetPanel = panelsArray[targetPanelIndex];
380
392
  if (targetPanel.collapsible) {
381
- const prevSize = sizes[targetPanelIndex];
382
- if (prevSize === 0 || prevSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) === targetPanel.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.minSize * groupSizeInPixels : targetPanel.minSize * groupSizeInPixels;
393
+ const baseSize = baseSizes[targetPanelIndex];
394
+ if (baseSize === 0 || baseSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) === targetPanel.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.minSize * groupSizeInPixels : targetPanel.minSize * groupSizeInPixels;
383
395
  }
384
396
  return movement;
385
- } else return $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset);
397
+ } else return $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, dragOffset, dragHandleRect);
386
398
  }
387
399
  function $96f6397ae645d178$export$e7bf60a870f429b0(event) {
388
400
  return event.type === "keydown";
@@ -444,7 +456,7 @@ function $99ad02c951ec80d0$export$d9fcbe062527d159({ committedValuesRef: committ
444
456
  let delta = 0;
445
457
  if (size.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) <= panelData.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) delta = direction === "horizontal" ? width : height;
446
458
  else delta = -(direction === "horizontal" ? width : height);
447
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, sizes, panelSizeBeforeCollapse.current);
459
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, sizes, panelSizeBeforeCollapse.current, null);
448
460
  if (sizes !== nextSizes) setSizes(nextSizes);
449
461
  }
450
462
  }
@@ -559,12 +571,32 @@ function $480430d8582e6616$export$2e2bcd8739ae039(callback, durationMs = 10) {
559
571
  }
560
572
 
561
573
 
574
+ function $f5f5dfb280167863$export$b141efd0b0fb9174(arrayA, arrayB) {
575
+ if (arrayA.length !== arrayB.length) return false;
576
+ for(let index = 0; index < arrayA.length; index++){
577
+ if (arrayA[index] !== arrayB[index]) return false;
578
+ }
579
+ return true;
580
+ }
581
+
582
+
562
583
  // Limit the frequency of localStorage updates.
563
584
  const $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced = (0, $480430d8582e6616$export$2e2bcd8739ae039)((0, $6ff1a22b27cc039d$export$af183b313c61be4f), 100);
564
- function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , id: idFromProps = null , onLayout: onLayout = null , style: styleFromProps = {} , tagName: Type = "div" }) {
585
+ function $eb1c4d3cf38334c2$var$throwServerError() {
586
+ throw new Error('PanelGroup "storage" prop required for server rendering.');
587
+ }
588
+ const $eb1c4d3cf38334c2$var$defaultStorage = {
589
+ getItem: typeof localStorage !== "undefined" ? (name)=>localStorage.getItem(name) : $eb1c4d3cf38334c2$var$throwServerError,
590
+ setItem: typeof localStorage !== "undefined" ? (name, value)=>localStorage.setItem(name, value) : $eb1c4d3cf38334c2$var$throwServerError
591
+ };
592
+ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , id: idFromProps = null , onLayout: onLayout = null , storage: storage = $eb1c4d3cf38334c2$var$defaultStorage , style: styleFromProps = {} , tagName: Type = "div" }) {
565
593
  const groupId = (0, $968185313205dcfa$export$2e2bcd8739ae039)(idFromProps);
566
594
  const [activeHandleId, setActiveHandleId] = (0, $fpI56$useState)(null);
567
595
  const [panels, setPanels] = (0, $fpI56$useState)(new Map());
596
+ // When resizing is done via mouse/touch event–
597
+ // We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
598
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
599
+ const initialDragStateRef = (0, $fpI56$useRef)(null);
568
600
  // Use a ref to guard against users passing inline props
569
601
  const callbacksRef = (0, $fpI56$useRef)({
570
602
  onLayout: onLayout
@@ -574,11 +606,9 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
574
606
  });
575
607
  // 0-1 values representing the relative size of each panel.
576
608
  const [sizes, setSizes] = (0, $fpI56$useState)([]);
577
- // Resize is calculated by the distance between the current pointer event and the resize handle being "dragged"
578
- // This value accounts for the initial offset when the touch/click starts, so the handle doesn't appear to "jump"
579
- const dragOffsetRef = (0, $fpI56$useRef)(0);
580
609
  // Used to support imperative collapse/expand API.
581
610
  const panelSizeBeforeCollapse = (0, $fpI56$useRef)(new Map());
611
+ const prevDeltaRef = (0, $fpI56$useRef)(0);
582
612
  // Store committed values to avoid unnecessarily re-running memoization/effects functions.
583
613
  const committedValuesRef = (0, $fpI56$useRef)({
584
614
  direction: direction,
@@ -635,7 +665,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
635
665
  let defaultSizes = undefined;
636
666
  if (autoSaveId) {
637
667
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
638
- defaultSizes = (0, $6ff1a22b27cc039d$export$9c80c6617f0386da)(autoSaveId, panelsArray);
668
+ defaultSizes = (0, $6ff1a22b27cc039d$export$9c80c6617f0386da)(autoSaveId, panelsArray, storage);
639
669
  }
640
670
  if (defaultSizes != null) setSizes(defaultSizes);
641
671
  else {
@@ -668,7 +698,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
668
698
  if (autoSaveId) {
669
699
  if (sizes.length === 0 || sizes.length !== panels.size) return;
670
700
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
671
- $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced(autoSaveId, panelsArray, sizes);
701
+ $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced(autoSaveId, panelsArray, sizes, storage);
672
702
  }
673
703
  }, [
674
704
  autoSaveId,
@@ -718,27 +748,37 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
718
748
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
719
749
  const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$68d3a33c21dfbe27)(groupId, handleId, panelsArray);
720
750
  if (idBefore == null || idAfter == null) return;
721
- const movement = (0, $96f6397ae645d178$export$354b17c0684607ed)(event, groupId, handleId, panelsArray, direction, prevSizes, dragOffsetRef.current);
751
+ const movement = (0, $96f6397ae645d178$export$354b17c0684607ed)(event, groupId, handleId, panelsArray, direction, prevSizes, initialDragStateRef.current);
722
752
  if (movement === 0) return;
723
753
  const groupElement = (0, $f30c804b5fe6cc1a$export$5e67632cf3550a9c)(groupId);
724
754
  const rect = groupElement.getBoundingClientRect();
725
755
  const isHorizontal = direction === "horizontal";
726
756
  const size = isHorizontal ? rect.width : rect.height;
727
757
  const delta = movement / size * 100;
728
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
729
- if (prevSizes === nextSizes) {
730
- // If the pointer has moved too far to resize the panel any further,
731
- // update the cursor style for a visual clue.
732
- // This mimics VS Code behavior.
733
- if (isHorizontal) (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "horizontal-min" : "horizontal-max");
734
- else (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "vertical-min" : "vertical-max");
735
- } else {
736
- // Reset the cursor style to the the normal resize cursor.
737
- (0, $60180881129f5dc3$export$d395b5dfd066a659)(isHorizontal ? "horizontal" : "vertical");
758
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, initialDragStateRef.current);
759
+ const sizesChanged = !(0, $f5f5dfb280167863$export$b141efd0b0fb9174)(prevSizes, nextSizes);
760
+ // Don't update cursor for resizes triggered by keyboard interactions.
761
+ if ((0, $96f6397ae645d178$export$764db16956f554f8)(event) || (0, $96f6397ae645d178$export$c4dfce035d43d1e0)(event)) // Watch for multiple subsequent deltas; this might occur for tiny cursor movements.
762
+ // In this case, Panel sizes might not change–
763
+ // but updating cursor in this scenario would cause a flicker.
764
+ {
765
+ if (prevDeltaRef.current != delta) {
766
+ if (!sizesChanged) {
767
+ // If the pointer has moved too far to resize the panel any further,
768
+ // update the cursor style for a visual clue.
769
+ // This mimics VS Code behavior.
770
+ if (isHorizontal) (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "horizontal-min" : "horizontal-max");
771
+ else (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "vertical-min" : "vertical-max");
772
+ } else // Reset the cursor style to the the normal resize cursor.
773
+ (0, $60180881129f5dc3$export$d395b5dfd066a659)(isHorizontal ? "horizontal" : "vertical");
774
+ }
775
+ }
776
+ if (sizesChanged) {
738
777
  // If resize change handlers have been declared, this is the time to call them.
739
778
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
740
779
  setSizes(nextSizes);
741
780
  }
781
+ prevDeltaRef.current = delta;
742
782
  };
743
783
  return resizeHandler;
744
784
  }, [
@@ -767,7 +807,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
767
807
  if (idBefore == null || idAfter == null) return;
768
808
  const isLastPanel = index === panelsArray.length - 1;
769
809
  const delta = isLastPanel ? currentSize : 0 - currentSize;
770
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
810
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
771
811
  if (prevSizes !== nextSizes) {
772
812
  // If resize change handlers have been declared, this is the time to call them.
773
813
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -790,7 +830,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
790
830
  if (idBefore == null || idAfter == null) return;
791
831
  const isLastPanel = index === panelsArray.length - 1;
792
832
  const delta = isLastPanel ? 0 - sizeBeforeCollapse : sizeBeforeCollapse;
793
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
833
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
794
834
  if (prevSizes !== nextSizes) {
795
835
  // If resize change handlers have been declared, this is the time to call them.
796
836
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -806,11 +846,13 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
806
846
  if (index < 0) return;
807
847
  const currentSize = prevSizes[index];
808
848
  if (currentSize === nextSize) return;
849
+ if (panel.collapsible && nextSize === 0) ;
850
+ else nextSize = Math.min(panel.maxSize, Math.max(panel.minSize, nextSize));
809
851
  const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$5a5b0c1d38c23c3b)(id, panelsArray);
810
852
  if (idBefore == null || idAfter == null) return;
811
853
  const isLastPanel = index === panelsArray.length - 1;
812
854
  const delta = isLastPanel ? currentSize - nextSize : nextSize - currentSize;
813
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
855
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
814
856
  if (prevSizes !== nextSizes) {
815
857
  // If resize change handlers have been declared, this is the time to call them.
816
858
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -829,11 +871,19 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
829
871
  resizePanel: resizePanel,
830
872
  startDragging: (id, event)=>{
831
873
  setActiveHandleId(id);
832
- dragOffsetRef.current = (0, $96f6397ae645d178$export$ec391ce65b083ed4)(event, id, direction);
874
+ if ((0, $96f6397ae645d178$export$764db16956f554f8)(event) || (0, $96f6397ae645d178$export$c4dfce035d43d1e0)(event)) {
875
+ const handleElement = (0, $f30c804b5fe6cc1a$export$2e27d3a347680388)(id);
876
+ initialDragStateRef.current = {
877
+ dragHandleRect: handleElement.getBoundingClientRect(),
878
+ dragOffset: (0, $96f6397ae645d178$export$ec391ce65b083ed4)(event, id, direction),
879
+ sizes: committedValuesRef.current.sizes
880
+ };
881
+ }
833
882
  },
834
883
  stopDragging: ()=>{
835
884
  (0, $60180881129f5dc3$export$b61932ee18f96e08)();
836
885
  setActiveHandleId(null);
886
+ initialDragStateRef.current = null;
837
887
  },
838
888
  unregisterPanel: unregisterPanel
839
889
  }), [
@@ -859,6 +909,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
859
909
  children: (0, $fpI56$createElement)(Type, {
860
910
  children: children,
861
911
  className: classNameFromProps,
912
+ "data-panel-group": "",
862
913
  "data-panel-group-direction": direction,
863
914
  "data-panel-group-id": groupId,
864
915
  style: {