react-resizable-panels 0.0.61 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.63
4
+
5
+ - Change default (not-yet-registered) Panel flex-grow style from 0 to 1
6
+
7
+ ## 0.0.62
8
+
9
+ - Edge case expand/collapse invalid size guard (#220)
10
+
3
11
  ## 0.0.61
4
12
 
5
13
  - Better unstable Offscreen/Activity API.
@@ -1028,9 +1028,10 @@ function computePanelFlexBoxStyle({
1028
1028
  const size = layout[panelIndex];
1029
1029
  let flexGrow;
1030
1030
  if (panelData.length === 1) {
1031
- flexGrow = "100";
1031
+ flexGrow = "1";
1032
1032
  } else if (size == null) {
1033
- flexGrow = "0";
1033
+ // Initial render (before panels have registered themselves)
1034
+ flexGrow = "1";
1034
1035
  } else {
1035
1036
  flexGrow = size.toPrecision(precision);
1036
1037
  }
@@ -1488,7 +1489,7 @@ function PanelGroupWithForwardedRef({
1488
1489
  if (panelSizePercentage === collapsedSizePercentage) {
1489
1490
  // Restore this panel to the size it was before it was collapsed, if possible.
1490
1491
  const prevPanelSizePercentage = panelSizeBeforeCollapseRef.current.get(panelData.id);
1491
- const baseSizePercentage = prevPanelSizePercentage != null ? prevPanelSizePercentage : minSizePercentage;
1492
+ const baseSizePercentage = prevPanelSizePercentage != null && prevPanelSizePercentage >= minSizePercentage ? prevPanelSizePercentage : minSizePercentage;
1492
1493
  const isLastPanel = panelDataArray.indexOf(panelData) === panelDataArray.length - 1;
1493
1494
  const delta = isLastPanel ? panelSizePercentage - baseSizePercentage : baseSizePercentage - panelSizePercentage;
1494
1495
  const nextLayout = adjustLayoutByDelta({
@@ -1044,9 +1044,10 @@ function computePanelFlexBoxStyle({
1044
1044
  const size = layout[panelIndex];
1045
1045
  let flexGrow;
1046
1046
  if (panelData.length === 1) {
1047
- flexGrow = "100";
1047
+ flexGrow = "1";
1048
1048
  } else if (size == null) {
1049
- flexGrow = "0";
1049
+ // Initial render (before panels have registered themselves)
1050
+ flexGrow = "1";
1050
1051
  } else {
1051
1052
  flexGrow = size.toPrecision(precision);
1052
1053
  }
@@ -1623,7 +1624,7 @@ function PanelGroupWithForwardedRef({
1623
1624
  if (panelSizePercentage === collapsedSizePercentage) {
1624
1625
  // Restore this panel to the size it was before it was collapsed, if possible.
1625
1626
  const prevPanelSizePercentage = panelSizeBeforeCollapseRef.current.get(panelData.id);
1626
- const baseSizePercentage = prevPanelSizePercentage != null ? prevPanelSizePercentage : minSizePercentage;
1627
+ const baseSizePercentage = prevPanelSizePercentage != null && prevPanelSizePercentage >= minSizePercentage ? prevPanelSizePercentage : minSizePercentage;
1627
1628
  const isLastPanel = panelDataArray.indexOf(panelData) === panelDataArray.length - 1;
1628
1629
  const delta = isLastPanel ? panelSizePercentage - baseSizePercentage : baseSizePercentage - panelSizePercentage;
1629
1630
  const nextLayout = adjustLayoutByDelta({
@@ -1020,9 +1020,10 @@ function computePanelFlexBoxStyle({
1020
1020
  const size = layout[panelIndex];
1021
1021
  let flexGrow;
1022
1022
  if (panelData.length === 1) {
1023
- flexGrow = "100";
1023
+ flexGrow = "1";
1024
1024
  } else if (size == null) {
1025
- flexGrow = "0";
1025
+ // Initial render (before panels have registered themselves)
1026
+ flexGrow = "1";
1026
1027
  } else {
1027
1028
  flexGrow = size.toPrecision(precision);
1028
1029
  }
@@ -1599,7 +1600,7 @@ function PanelGroupWithForwardedRef({
1599
1600
  if (panelSizePercentage === collapsedSizePercentage) {
1600
1601
  // Restore this panel to the size it was before it was collapsed, if possible.
1601
1602
  const prevPanelSizePercentage = panelSizeBeforeCollapseRef.current.get(panelData.id);
1602
- const baseSizePercentage = prevPanelSizePercentage != null ? prevPanelSizePercentage : minSizePercentage;
1603
+ const baseSizePercentage = prevPanelSizePercentage != null && prevPanelSizePercentage >= minSizePercentage ? prevPanelSizePercentage : minSizePercentage;
1603
1604
  const isLastPanel = panelDataArray.indexOf(panelData) === panelDataArray.length - 1;
1604
1605
  const delta = isLastPanel ? panelSizePercentage - baseSizePercentage : baseSizePercentage - panelSizePercentage;
1605
1606
  const nextLayout = adjustLayoutByDelta({
@@ -1004,9 +1004,10 @@ function computePanelFlexBoxStyle({
1004
1004
  const size = layout[panelIndex];
1005
1005
  let flexGrow;
1006
1006
  if (panelData.length === 1) {
1007
- flexGrow = "100";
1007
+ flexGrow = "1";
1008
1008
  } else if (size == null) {
1009
- flexGrow = "0";
1009
+ // Initial render (before panels have registered themselves)
1010
+ flexGrow = "1";
1010
1011
  } else {
1011
1012
  flexGrow = size.toPrecision(precision);
1012
1013
  }
@@ -1464,7 +1465,7 @@ function PanelGroupWithForwardedRef({
1464
1465
  if (panelSizePercentage === collapsedSizePercentage) {
1465
1466
  // Restore this panel to the size it was before it was collapsed, if possible.
1466
1467
  const prevPanelSizePercentage = panelSizeBeforeCollapseRef.current.get(panelData.id);
1467
- const baseSizePercentage = prevPanelSizePercentage != null ? prevPanelSizePercentage : minSizePercentage;
1468
+ const baseSizePercentage = prevPanelSizePercentage != null && prevPanelSizePercentage >= minSizePercentage ? prevPanelSizePercentage : minSizePercentage;
1468
1469
  const isLastPanel = panelDataArray.indexOf(panelData) === panelDataArray.length - 1;
1469
1470
  const delta = isLastPanel ? panelSizePercentage - baseSizePercentage : baseSizePercentage - panelSizePercentage;
1470
1471
  const nextLayout = adjustLayoutByDelta({
@@ -1030,9 +1030,10 @@ function computePanelFlexBoxStyle({
1030
1030
  const size = layout[panelIndex];
1031
1031
  let flexGrow;
1032
1032
  if (panelData.length === 1) {
1033
- flexGrow = "100";
1033
+ flexGrow = "1";
1034
1034
  } else if (size == null) {
1035
- flexGrow = "0";
1035
+ // Initial render (before panels have registered themselves)
1036
+ flexGrow = "1";
1036
1037
  } else {
1037
1038
  flexGrow = size.toPrecision(precision);
1038
1039
  }
@@ -1490,7 +1491,7 @@ function PanelGroupWithForwardedRef({
1490
1491
  if (panelSizePercentage === collapsedSizePercentage) {
1491
1492
  // Restore this panel to the size it was before it was collapsed, if possible.
1492
1493
  const prevPanelSizePercentage = panelSizeBeforeCollapseRef.current.get(panelData.id);
1493
- const baseSizePercentage = prevPanelSizePercentage != null ? prevPanelSizePercentage : minSizePercentage;
1494
+ const baseSizePercentage = prevPanelSizePercentage != null && prevPanelSizePercentage >= minSizePercentage ? prevPanelSizePercentage : minSizePercentage;
1494
1495
  const isLastPanel = panelDataArray.indexOf(panelData) === panelDataArray.length - 1;
1495
1496
  const delta = isLastPanel ? panelSizePercentage - baseSizePercentage : baseSizePercentage - panelSizePercentage;
1496
1497
  const nextLayout = adjustLayoutByDelta({