react-resizable-panels 3.0.4 → 3.0.5

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/README.md CHANGED
@@ -80,7 +80,6 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
80
80
  | `getSize(): number` | Gets the current size of the panel as a percentage (`1 - 100`). |
81
81
  | `isCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`). |
82
82
  | `isExpanded(): boolean` | Returns `true` if the panel is currently _not collapsed_ (`!isCollapsed()`). |
83
- | `getSize(): number` | Returns the most recently committed size of the panel as a percentage (`1 - 100`). |
84
83
  | `resize(size: number)` | Resize panel to the specified _percentage_ (`1 - 100`). |
85
84
 
86
85
  ### `PanelResizeHandle`
@@ -124,7 +123,7 @@ The `Panel` API doesn't _require_ `id` and `order` props because they aren't nec
124
123
  </PanelGroup>
125
124
  ```
126
125
 
127
- ### Can a attach a ref to the DOM elements?
126
+ ### Can I attach a ref to the DOM elements?
128
127
 
129
128
  No. I think exposing two refs (one for the component's imperative API and one for a DOM element) would be awkward. This library does export several utility methods for accessing the underlying DOM elements though. For example:
130
129
 
@@ -957,7 +957,7 @@ function adjustLayoutByDelta({
957
957
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
958
958
  deltaApplied += prevSize - safeSize;
959
959
  nextLayout[index] = safeSize;
960
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
960
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
961
961
  numeric: true
962
962
  }) >= 0) {
963
963
  break;
@@ -1455,12 +1455,12 @@ function computePanelFlexBoxStyle({
1455
1455
  if (size == null) {
1456
1456
  // Initial render (before panels have registered themselves)
1457
1457
  // In order to support server rendering, fall back to default size if provided
1458
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1458
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1459
1459
  } else if (panelData.length === 1) {
1460
1460
  // Special case: Single panel group should always fill full width/height
1461
1461
  flexGrow = "1";
1462
1462
  } else {
1463
- flexGrow = size.toPrecision(precision);
1463
+ flexGrow = size.toFixed(precision);
1464
1464
  }
1465
1465
  return {
1466
1466
  flexBasis: 0,
@@ -951,7 +951,7 @@ function adjustLayoutByDelta({
951
951
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
952
952
  deltaApplied += prevSize - safeSize;
953
953
  nextLayout[index] = safeSize;
954
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
954
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
955
955
  numeric: true
956
956
  }) >= 0) {
957
957
  break;
@@ -1439,12 +1439,12 @@ function computePanelFlexBoxStyle({
1439
1439
  if (size == null) {
1440
1440
  // Initial render (before panels have registered themselves)
1441
1441
  // In order to support server rendering, fall back to default size if provided
1442
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1442
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1443
1443
  } else if (panelData.length === 1) {
1444
1444
  // Special case: Single panel group should always fill full width/height
1445
1445
  flexGrow = "1";
1446
1446
  } else {
1447
- flexGrow = size.toPrecision(precision);
1447
+ flexGrow = size.toFixed(precision);
1448
1448
  }
1449
1449
  return {
1450
1450
  flexBasis: 0,
@@ -927,7 +927,7 @@ function adjustLayoutByDelta({
927
927
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
928
928
  deltaApplied += prevSize - safeSize;
929
929
  nextLayout[index] = safeSize;
930
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
930
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
931
931
  numeric: true
932
932
  }) >= 0) {
933
933
  break;
@@ -1301,12 +1301,12 @@ function computePanelFlexBoxStyle({
1301
1301
  if (size == null) {
1302
1302
  // Initial render (before panels have registered themselves)
1303
1303
  // In order to support server rendering, fall back to default size if provided
1304
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1304
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1305
1305
  } else if (panelData.length === 1) {
1306
1306
  // Special case: Single panel group should always fill full width/height
1307
1307
  flexGrow = "1";
1308
1308
  } else {
1309
- flexGrow = size.toPrecision(precision);
1309
+ flexGrow = size.toFixed(precision);
1310
1310
  }
1311
1311
  return {
1312
1312
  flexBasis: 0,
@@ -964,7 +964,7 @@ function adjustLayoutByDelta({
964
964
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
965
965
  deltaApplied += prevSize - safeSize;
966
966
  nextLayout[index] = safeSize;
967
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
967
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
968
968
  numeric: true
969
969
  }) >= 0) {
970
970
  break;
@@ -1462,12 +1462,12 @@ function computePanelFlexBoxStyle({
1462
1462
  if (size == null) {
1463
1463
  // Initial render (before panels have registered themselves)
1464
1464
  // In order to support server rendering, fall back to default size if provided
1465
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1465
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1466
1466
  } else if (panelData.length === 1) {
1467
1467
  // Special case: Single panel group should always fill full width/height
1468
1468
  flexGrow = "1";
1469
1469
  } else {
1470
- flexGrow = size.toPrecision(precision);
1470
+ flexGrow = size.toFixed(precision);
1471
1471
  }
1472
1472
  return {
1473
1473
  flexBasis: 0,
@@ -916,7 +916,7 @@ function adjustLayoutByDelta({
916
916
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
917
917
  deltaApplied += prevSize - safeSize;
918
918
  nextLayout[index] = safeSize;
919
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
919
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
920
920
  numeric: true
921
921
  }) >= 0) {
922
922
  break;
@@ -1290,12 +1290,12 @@ function computePanelFlexBoxStyle({
1290
1290
  if (size == null) {
1291
1291
  // Initial render (before panels have registered themselves)
1292
1292
  // In order to support server rendering, fall back to default size if provided
1293
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1293
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1294
1294
  } else if (panelData.length === 1) {
1295
1295
  // Special case: Single panel group should always fill full width/height
1296
1296
  flexGrow = "1";
1297
1297
  } else {
1298
- flexGrow = size.toPrecision(precision);
1298
+ flexGrow = size.toFixed(precision);
1299
1299
  }
1300
1300
  return {
1301
1301
  flexBasis: 0,
@@ -953,7 +953,7 @@ function adjustLayoutByDelta({
953
953
  if (!fuzzyNumbersEqual(prevSize, safeSize)) {
954
954
  deltaApplied += prevSize - safeSize;
955
955
  nextLayout[index] = safeSize;
956
- if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), undefined, {
956
+ if (deltaApplied.toFixed(3).localeCompare(Math.abs(delta).toFixed(3), undefined, {
957
957
  numeric: true
958
958
  }) >= 0) {
959
959
  break;
@@ -1441,12 +1441,12 @@ function computePanelFlexBoxStyle({
1441
1441
  if (size == null) {
1442
1442
  // Initial render (before panels have registered themselves)
1443
1443
  // In order to support server rendering, fall back to default size if provided
1444
- flexGrow = defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
1444
+ flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
1445
1445
  } else if (panelData.length === 1) {
1446
1446
  // Special case: Single panel group should always fill full width/height
1447
1447
  flexGrow = "1";
1448
1448
  } else {
1449
- flexGrow = size.toPrecision(precision);
1449
+ flexGrow = size.toFixed(precision);
1450
1450
  }
1451
1451
  return {
1452
1452
  flexBasis: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "type": "module",
5
5
  "description": "React components for resizable panel groups/layouts",
6
6
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
@@ -51,6 +51,15 @@
51
51
  }
52
52
  },
53
53
  "types": "dist/react-resizable-panels.d.ts",
54
+ "scripts": {
55
+ "clear": "pnpm run clear:builds & pnpm run clear:node_modules",
56
+ "clear:builds": "rm -rf ./packages/*/dist",
57
+ "clear:node_modules": "rm -rf ./node_modules",
58
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
59
+ "test:browser": "vitest",
60
+ "test:node": "vitest -c vitest.node.config.ts",
61
+ "watch": "parcel watch --port=2345"
62
+ },
54
63
  "devDependencies": {
55
64
  "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
56
65
  "@babel/plugin-proposal-optional-chaining": "7.21.0",
@@ -68,14 +77,5 @@
68
77
  },
69
78
  "browserslist": [
70
79
  "Chrome 79"
71
- ],
72
- "scripts": {
73
- "clear": "pnpm run clear:builds & pnpm run clear:node_modules",
74
- "clear:builds": "rm -rf ./packages/*/dist",
75
- "clear:node_modules": "rm -rf ./node_modules",
76
- "lint": "eslint \"src/**/*.{ts,tsx}\"",
77
- "test:browser": "vitest",
78
- "test:node": "vitest -c vitest.node.config.ts",
79
- "watch": "parcel watch --port=2345"
80
- }
81
- }
80
+ ]
81
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Brian Vaughn
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.