Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-resizable-panels

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-resizable-panels - npm Package Compare versions

Comparing version 2.0.11 to 2.0.12

src/utils/numbers/fuzzyLayoutsEqual.ts

4

CHANGELOG.md
# Changelog
## 2.0.12
- Improve resize for edge cases with collapsed panels; intermediate resize states should now fall back to the most recent valid layout rather than the initial layout (#311)
## 2.0.11

@@ -4,0 +8,0 @@

2

package.json
{
"name": "react-resizable-panels",
"version": "2.0.11",
"version": "2.0.12",
"description": "React components for resizable panel groups/layouts",

@@ -5,0 +5,0 @@ "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",

@@ -160,3 +160,3 @@ import { isDevelopment } from "#is-development";

: collapsedSize - size,
layout,
initialLayout: layout,
panelConstraints: panelDataArray.map(

@@ -170,2 +170,3 @@ (panelData) => panelData.constraints

),
prevLayout: layout,
trigger: "keyboard",

@@ -172,0 +173,0 @@ });

@@ -358,5 +358,6 @@ import { isDevelopment } from "#is-development";

delta,
layout: prevLayout,
initialLayout: prevLayout,
panelConstraints: panelConstraintsArray,
pivotIndices,
prevLayout,
trigger: "imperative-api",

@@ -419,5 +420,6 @@ });

delta,
layout: prevLayout,
initialLayout: prevLayout,
panelConstraints: panelConstraintsArray,
pivotIndices,
prevLayout,
trigger: "imperative-api",

@@ -641,5 +643,6 @@ });

delta,
layout: initialLayout ?? prevLayout,
initialLayout: initialLayout ?? prevLayout,
panelConstraints,
pivotIndices,
prevLayout,
trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch",

@@ -728,5 +731,6 @@ });

delta,
layout: prevLayout,
initialLayout: prevLayout,
panelConstraints: panelConstraintsArray,
pivotIndices,
prevLayout,
trigger: "imperative-api",

@@ -733,0 +737,0 @@ });

@@ -8,5 +8,6 @@ import { adjustLayoutByDelta } from "./adjustLayoutByDelta";

delta: 1,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -21,5 +22,6 @@ })

delta: 25,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -31,5 +33,6 @@ })

delta: 50,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -44,3 +47,3 @@ })

delta: 50,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -57,2 +60,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -67,3 +71,3 @@ })

delta: 25,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -78,2 +82,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -88,3 +93,3 @@ })

delta: 40,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -99,2 +104,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -111,3 +117,3 @@ })

delta: 5,
layout: [10, 90],
initialLayout: [10, 90],
panelConstraints: [

@@ -122,2 +128,3 @@ {

pivotIndices: [0, 1],
prevLayout: [10, 90],
trigger: "imperative-api",

@@ -134,3 +141,3 @@ })

delta: 5,
layout: [10, 90],
initialLayout: [10, 90],
panelConstraints: [

@@ -145,2 +152,3 @@ {

pivotIndices: [0, 1],
prevLayout: [10, 90],
trigger: "keyboard",

@@ -157,3 +165,3 @@ })

delta: 5,
layout: [75, 25],
initialLayout: [75, 25],
panelConstraints: [

@@ -167,2 +175,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [75, 25],
trigger: "keyboard",

@@ -179,3 +188,3 @@ })

delta: 1,
layout: [4, 96],
initialLayout: [4, 96],
panelConstraints: [

@@ -194,2 +203,3 @@ {

pivotIndices: [0, 1],
prevLayout: [4, 96],
trigger: "imperative-api",

@@ -206,3 +216,3 @@ })

delta: 1,
layout: [4, 96],
initialLayout: [4, 96],
panelConstraints: [

@@ -221,2 +231,3 @@ {

pivotIndices: [0, 1],
prevLayout: [4, 96],
trigger: "keyboard",

@@ -233,3 +244,3 @@ })

delta: 25,
layout: [4, 96],
initialLayout: [4, 96],
panelConstraints: [

@@ -248,2 +259,3 @@ {

pivotIndices: [0, 1],
prevLayout: [4, 96],
trigger: "imperative-api",

@@ -260,3 +272,3 @@ })

delta: 30,
layout: [5, 95],
initialLayout: [5, 95],
panelConstraints: [

@@ -274,2 +286,3 @@ {

pivotIndices: [0, 1],
prevLayout: [5, 95],
trigger: "imperative-api",

@@ -286,3 +299,3 @@ })

delta: 30,
layout: [5, 95],
initialLayout: [5, 95],
panelConstraints: [

@@ -300,2 +313,3 @@ {

pivotIndices: [0, 1],
prevLayout: [5, 95],
trigger: "keyboard",

@@ -312,3 +326,3 @@ })

delta: 30,
layout: [0, 100],
initialLayout: [0, 100],
panelConstraints: [

@@ -324,2 +338,3 @@ {

pivotIndices: [0, 1],
prevLayout: [0, 100],
trigger: "keyboard",

@@ -334,5 +349,6 @@ })

delta: -1,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -347,5 +363,6 @@ })

delta: -25,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -360,5 +377,6 @@ })

delta: -50,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -373,3 +391,3 @@ })

delta: -50,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -386,2 +404,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -396,3 +415,3 @@ })

delta: -25,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -407,2 +426,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -417,3 +437,3 @@ })

delta: -30,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -428,2 +448,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -436,3 +457,3 @@ })

delta: -36,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -447,2 +468,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -459,3 +481,3 @@ })

delta: -30,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [

@@ -470,2 +492,3 @@ {

pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -482,3 +505,3 @@ })

delta: -5,
layout: [90, 10],
initialLayout: [90, 10],
panelConstraints: [

@@ -493,2 +516,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [90, 10],
trigger: "keyboard",

@@ -505,3 +529,3 @@ })

delta: -5,
layout: [25, 75],
initialLayout: [25, 75],
panelConstraints: [

@@ -516,2 +540,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 75],
trigger: "keyboard",

@@ -526,5 +551,6 @@ })

delta: 1,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -539,5 +565,6 @@ })

delta: 25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -552,5 +579,6 @@ })

delta: 50,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -565,5 +593,6 @@ })

delta: 75,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -578,5 +607,6 @@ })

delta: 25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{ maxSize: 35 }, { minSize: 25 }, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -592,5 +622,6 @@ })

delta: 25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{ maxSize: 35 }, { minSize: 25 }, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -605,3 +636,3 @@ })

delta: 5,
layout: [25, 40, 35],
initialLayout: [25, 40, 35],
panelConstraints: [

@@ -617,2 +648,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 40, 35],
trigger: "imperative-api",

@@ -627,3 +659,3 @@ })

delta: 26,
layout: [25, 40, 35],
initialLayout: [25, 40, 35],
panelConstraints: [

@@ -639,2 +671,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 40, 35],
trigger: "imperative-api",

@@ -649,3 +682,3 @@ })

delta: 80,
layout: [25, 40, 35],
initialLayout: [25, 40, 35],
panelConstraints: [

@@ -661,2 +694,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 40, 35],
trigger: "imperative-api",

@@ -671,5 +705,6 @@ })

delta: -1,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -684,5 +719,6 @@ })

delta: -25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -697,5 +733,6 @@ })

delta: -1,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{ minSize: 20 }, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -710,5 +747,6 @@ })

delta: -10,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{ minSize: 20 }, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -723,3 +761,3 @@ })

delta: -5,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -733,2 +771,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -743,3 +782,3 @@ })

delta: -20,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -753,2 +792,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -763,3 +803,3 @@ })

delta: -10,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -775,2 +815,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -785,3 +826,3 @@ })

delta: -20,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -797,2 +838,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -807,3 +849,3 @@ })

delta: -20,
layout: [45, 50, 5],
initialLayout: [45, 50, 5],
panelConstraints: [

@@ -821,2 +863,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [45, 50, 5],
trigger: "imperative-api",

@@ -831,5 +874,6 @@ })

delta: -1,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -844,5 +888,6 @@ })

delta: -25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -857,5 +902,6 @@ })

delta: -50,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -870,5 +916,6 @@ })

delta: -75,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -883,5 +930,6 @@ })

delta: 5,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { minSize: 15 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -896,5 +944,6 @@ })

delta: 20,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { minSize: 15 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -909,5 +958,6 @@ })

delta: 5,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { collapsible: true, minSize: 20 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -922,5 +972,6 @@ })

delta: 10,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { collapsible: true, minSize: 20 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -933,5 +984,6 @@ })

delta: 16,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { collapsible: true, minSize: 20 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -946,5 +998,6 @@ })

delta: 1,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -959,5 +1012,6 @@ })

delta: 25,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -972,5 +1026,6 @@ })

delta: -20,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, { minSize: 40 }, {}],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -985,5 +1040,6 @@ })

delta: -10,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [{}, {}, { maxSize: 30 }],
pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -998,3 +1054,3 @@ })

delta: -35,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -1010,2 +1066,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -1018,3 +1075,3 @@ })

delta: -40,
layout: [25, 50, 25],
initialLayout: [25, 50, 25],
panelConstraints: [

@@ -1030,2 +1087,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 50, 25],
trigger: "imperative-api",

@@ -1040,3 +1098,3 @@ })

delta: -10,
layout: [25, 0, 75],
initialLayout: [25, 0, 75],
panelConstraints: [

@@ -1052,2 +1110,3 @@ {

pivotIndices: [1, 2],
prevLayout: [25, 0, 75],
trigger: "imperative-api",

@@ -1060,3 +1119,3 @@ })

delta: -20,
layout: [25, 0, 75],
initialLayout: [25, 0, 75],
panelConstraints: [

@@ -1072,2 +1131,3 @@ {

pivotIndices: [1, 2],
prevLayout: [25, 0, 75],
trigger: "imperative-api",

@@ -1083,5 +1143,6 @@ })

delta: -100,
layout: [100 / 3, 100 / 3, 100 / 3],
initialLayout: [100 / 3, 100 / 3, 100 / 3],
panelConstraints: [{}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [100 / 3, 100 / 3, 100 / 3],
trigger: "mouse-or-touch",

@@ -1096,5 +1157,6 @@ })

delta: 1,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1109,5 +1171,6 @@ })

delta: 25,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1122,5 +1185,6 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1135,5 +1199,6 @@ })

delta: 75,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1148,5 +1213,6 @@ })

delta: 25,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{ maxSize: 35 }, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1161,3 +1227,3 @@ })

delta: 100,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1170,2 +1236,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1180,3 +1247,3 @@ })

delta: 10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1201,2 +1268,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1209,3 +1277,3 @@ })

delta: 15,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1230,2 +1298,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1240,3 +1309,3 @@ })

delta: 40,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1261,2 +1330,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1271,3 +1341,3 @@ })

delta: 100,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1292,2 +1362,3 @@ {},

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1302,5 +1373,6 @@ })

delta: -1,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1315,5 +1387,6 @@ })

delta: -25,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1328,5 +1401,6 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{ minSize: 20 }, {}, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1341,5 +1415,6 @@ })

delta: -25,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, { maxSize: 35 }, {}, {}],
pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1354,3 +1429,3 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1367,2 +1442,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1375,3 +1451,3 @@ })

delta: -15,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1388,2 +1464,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1398,3 +1475,3 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1411,2 +1488,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1419,3 +1497,3 @@ })

delta: -15,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1432,2 +1510,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1448,3 +1527,3 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1461,2 +1540,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1477,3 +1557,3 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1490,2 +1570,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1502,3 +1583,3 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1515,2 +1596,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1526,3 +1608,3 @@ })

delta: -20,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1539,2 +1621,3 @@ {

pivotIndices: [0, 1],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1549,5 +1632,6 @@ })

delta: 10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1562,5 +1646,6 @@ })

delta: 30,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1575,5 +1660,6 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1588,5 +1674,6 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, { maxSize: 35 }, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1601,5 +1688,6 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, { minSize: 20 }, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1614,3 +1702,3 @@ })

delta: 10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1627,2 +1715,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1637,3 +1726,3 @@ })

delta: 30,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1650,2 +1739,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1660,3 +1750,3 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1673,2 +1763,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1683,5 +1774,6 @@ })

delta: -25,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1696,5 +1788,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1709,5 +1802,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, { minSize: 20 }, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1722,5 +1816,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{ minSize: 20 }, {}, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1735,5 +1830,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{ minSize: 20 }, { minSize: 20 }, {}, {}],
pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1748,3 +1844,3 @@ })

delta: -5,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1761,2 +1857,3 @@ {

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1771,3 +1868,3 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1784,2 +1881,3 @@ {

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1794,3 +1892,3 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1807,2 +1905,3 @@ {},

pivotIndices: [1, 2],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1817,5 +1916,6 @@ })

delta: 10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1830,5 +1930,6 @@ })

delta: 30,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1843,5 +1944,6 @@ })

delta: 30,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, { maxSize: 40 }, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1856,5 +1958,6 @@ })

delta: 30,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, { minSize: 10 }],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1869,3 +1972,3 @@ })

delta: 5,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1882,2 +1985,3 @@ {},

pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1892,3 +1996,3 @@ })

delta: 50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1905,2 +2009,3 @@ {},

pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1915,5 +2020,6 @@ })

delta: -10,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1928,5 +2034,6 @@ })

delta: -40,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1941,5 +2048,6 @@ })

delta: -100,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1954,3 +2062,3 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -1963,2 +2071,3 @@ { minSize: 10 },

pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1973,5 +2082,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, {}, {}, { maxSize: 40 }],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1986,5 +2096,6 @@ })

delta: -50,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [{}, { minSize: 5 }, {}, {}],
pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -1999,3 +2110,3 @@ })

delta: -100,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -2020,2 +2131,3 @@ {

pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -2030,3 +2142,3 @@ })

delta: -100,
layout: [25, 25, 25, 25],
initialLayout: [25, 25, 25, 25],
panelConstraints: [

@@ -2047,2 +2159,3 @@ {

pivotIndices: [2, 3],
prevLayout: [25, 25, 25, 25],
trigger: "imperative-api",

@@ -2058,5 +2171,6 @@ })

delta: 1,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{ maxSize: 50 }, {}],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -2069,5 +2183,6 @@ })

delta: 1,
layout: [50, 50],
initialLayout: [50, 50],
panelConstraints: [{}, { minSize: 50 }],
pivotIndices: [0, 1],
prevLayout: [50, 50],
trigger: "imperative-api",

@@ -2078,2 +2193,40 @@ })

});
// Edge case (issues/311)
it("should fallback to the previous layout if an intermediate layout is invalid", () => {
expect(
adjustLayoutByDelta({
delta: 1,
initialLayout: [5, 15, 40, 40],
panelConstraints: [
{ collapsedSize: 5, collapsible: true, minSize: 15, maxSize: 20 },
{ minSize: 15, maxSize: 30 },
{ minSize: 30 },
{ minSize: 20, maxSize: 40 },
],
pivotIndices: [0, 1],
prevLayout: [5, 30, 30, 36],
trigger: "imperative-api",
})
).toEqual([5, 30, 30, 36]);
});
// Edge case (issues/311)
it("should (re)collapse an already-collapsed panel that's been expanded and (re)collapsed as part of a single drag", () => {
expect(
adjustLayoutByDelta({
delta: -3,
initialLayout: [5, 15, 40, 40],
panelConstraints: [
{ collapsedSize: 5, collapsible: true, minSize: 15, maxSize: 20 },
{ minSize: 15, maxSize: 30 },
{ minSize: 30 },
{ minSize: 20, maxSize: 40 },
],
pivotIndices: [0, 1],
prevLayout: [15, 15, 30, 36],
trigger: "imperative-api",
})
).toEqual([5, 15, 40, 40]);
});
});
import { PanelConstraints } from "../Panel";
import { assert } from "./assert";
import { fuzzyCompareNumbers } from "./numbers/fuzzyCompareNumbers";
import { fuzzyLayoutsEqual } from "./numbers/fuzzyLayoutsEqual";
import { fuzzyNumbersEqual } from "./numbers/fuzzyNumbersEqual";

@@ -10,18 +11,20 @@ import { resizePanel } from "./resizePanel";

delta,
layout: prevLayout,
initialLayout,
panelConstraints: panelConstraintsArray,
pivotIndices,
prevLayout,
trigger,
}: {
delta: number;
layout: number[];
initialLayout: number[];
panelConstraints: PanelConstraints[];
pivotIndices: number[];
prevLayout: number[];
trigger: "imperative-api" | "keyboard" | "mouse-or-touch";
}): number[] {
if (fuzzyNumbersEqual(delta, 0)) {
return prevLayout;
return initialLayout;
}
const nextLayout = [...prevLayout];
const nextLayout = [...initialLayout];

@@ -34,8 +37,10 @@ const [firstPivotIndex, secondPivotIndex] = pivotIndices;

//const DEBUG = [];
//DEBUG.push(`adjustLayoutByDelta() ${prevLayout.join(", ")}`);
//DEBUG.push(` delta: ${delta}`);
//DEBUG.push(` pivotIndices: ${pivotIndices.join(", ")}`);
//DEBUG.push(` trigger: ${trigger}`);
//DEBUG.push("");
// const DEBUG = [];
// DEBUG.push(`adjustLayoutByDelta()`);
// DEBUG.push(` initialLayout: ${initialLayout.join(", ")}`);
// DEBUG.push(` prevLayout: ${prevLayout.join(", ")}`);
// DEBUG.push(` delta: ${delta}`);
// DEBUG.push(` pivotIndices: ${pivotIndices.join(", ")}`);
// DEBUG.push(` trigger: ${trigger}`);
// DEBUG.push("");

@@ -69,6 +74,6 @@ // A resizing panel affects the panels before or after it.

//DEBUG.push(`edge case check 1: ${index}`);
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
// DEBUG.push(`edge case check 1: ${index}`);
// DEBUG.push(` -> collapsible? ${collapsible}`);
if (collapsible) {
const prevSize = prevLayout[index];
const prevSize = initialLayout[index];
assert(

@@ -81,7 +86,7 @@ prevSize != null,

const localDelta = minSize - prevSize;
//DEBUG.push(` -> expand delta: ${localDelta}`);
// DEBUG.push(` -> expand delta: ${localDelta}`);
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
delta = delta < 0 ? 0 - localDelta : localDelta;
//DEBUG.push(` -> delta: ${delta}`);
// DEBUG.push(` -> delta: ${delta}`);
}

@@ -107,6 +112,6 @@ }

//DEBUG.push(`edge case check 2: ${index}`);
//DEBUG.push(` -> collapsible? ${collapsible}`);
// DEBUG.push(`edge case check 2: ${index}`);
// DEBUG.push(` -> collapsible? ${collapsible}`);
if (collapsible) {
const prevSize = prevLayout[index];
const prevSize = initialLayout[index];
assert(

@@ -119,7 +124,7 @@ prevSize != null,

const localDelta = prevSize - collapsedSize;
//DEBUG.push(` -> expand delta: ${localDelta}`);
// DEBUG.push(` -> expand delta: ${localDelta}`);
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
delta = delta < 0 ? 0 - localDelta : localDelta;
//DEBUG.push(` -> delta: ${delta}`);
// DEBUG.push(` -> delta: ${delta}`);
}

@@ -130,3 +135,3 @@ }

}
//DEBUG.push("");
// DEBUG.push("");
}

@@ -146,5 +151,5 @@

//DEBUG.push("pre calc...");
// DEBUG.push("pre calc...");
while (true) {
const prevSize = prevLayout[index];
const prevSize = initialLayout[index];
assert(

@@ -161,3 +166,3 @@ prevSize != null,

const delta = maxSafeSize - prevSize;
//DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);
// DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);

@@ -172,7 +177,7 @@ maxAvailableDelta += delta;

//DEBUG.push(` -> max available delta: ${maxAvailableDelta}`);
// DEBUG.push(` -> max available delta: ${maxAvailableDelta}`);
const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));
delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;
//DEBUG.push(` -> adjusted delta: ${delta}`);
//DEBUG.push("");
// DEBUG.push(` -> adjusted delta: ${delta}`);
// DEBUG.push("");
}

@@ -188,3 +193,3 @@

const prevSize = prevLayout[index];
const prevSize = initialLayout[index];
assert(

@@ -225,10 +230,12 @@ prevSize != null,

}
//DEBUG.push(`after 1: ${nextLayout.join(", ")}`);
//DEBUG.push(` deltaApplied: ${deltaApplied}`);
//DEBUG.push("");
// DEBUG.push(`after 1: ${nextLayout.join(", ")}`);
// DEBUG.push(` deltaApplied: ${deltaApplied}`);
// DEBUG.push("");
// If we were unable to resize any of the panels panels, return the previous state.
// This will essentially bailout and ignore e.g. drags past a panel's boundaries
if (fuzzyNumbersEqual(deltaApplied, 0)) {
//console.log(DEBUG.join("\n"));
if (fuzzyLayoutsEqual(prevLayout, nextLayout)) {
// DEBUG.push(`bailout to previous layout: ${prevLayout.join(", ")}`);
// console.log(DEBUG.join("\n"));
return prevLayout;

@@ -241,3 +248,3 @@ }

const prevSize = prevLayout[pivotIndex];
const prevSize = initialLayout[pivotIndex];
assert(

@@ -296,15 +303,20 @@ prevSize != null,

}
//DEBUG.push(`after 2: ${nextLayout.join(", ")}`);
//DEBUG.push(` deltaApplied: ${deltaApplied}`);
//DEBUG.push("");
// DEBUG.push(`after 2: ${nextLayout.join(", ")}`);
// DEBUG.push(` deltaApplied: ${deltaApplied}`);
// DEBUG.push("");
const totalSize = nextLayout.reduce((total, size) => size + total, 0);
//DEBUG.push(`total size: ${totalSize}`);
//console.log(DEBUG.join("\n"));
// DEBUG.push(`total size: ${totalSize}`);
// If our new layout doesn't add up to 100%, that means the requested delta can't be applied
// In that case, fall back to our most recent valid layout
if (!fuzzyNumbersEqual(totalSize, 100)) {
// DEBUG.push(`bailout to previous layout: ${prevLayout.join(", ")}`);
// console.log(DEBUG.join("\n"));
return prevLayout;
}
// console.log(DEBUG.join("\n"));
return nextLayout;
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc