react-resizable-panels 2.0.9 → 2.0.10
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 +4 -0
- package/dist/declarations/src/utils/assert.d.ts +1 -1
- package/dist/react-resizable-panels.browser.cjs.js +50 -52
- package/dist/react-resizable-panels.browser.development.cjs.js +52 -54
- package/dist/react-resizable-panels.browser.development.esm.js +52 -54
- package/dist/react-resizable-panels.browser.esm.js +50 -52
- package/dist/react-resizable-panels.cjs.js +50 -52
- package/dist/react-resizable-panels.development.cjs.js +52 -54
- package/dist/react-resizable-panels.development.esm.js +52 -54
- package/dist/react-resizable-panels.development.node.cjs.js +48 -50
- package/dist/react-resizable-panels.development.node.esm.js +48 -50
- package/dist/react-resizable-panels.esm.js +50 -52
- package/dist/react-resizable-panels.node.cjs.js +46 -48
- package/dist/react-resizable-panels.node.esm.js +46 -48
- package/package.json +1 -1
- package/src/Panel.test.tsx +23 -23
- package/src/PanelGroup.test.tsx +32 -3
- package/src/PanelGroup.ts +25 -7
- package/src/PanelResizeHandle.test.tsx +3 -3
- package/src/PanelResizeHandle.ts +1 -1
- package/src/hooks/useWindowSplitterBehavior.ts +5 -2
- package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +5 -5
- package/src/utils/adjustLayoutByDelta.ts +47 -20
- package/src/utils/assert.ts +1 -1
- package/src/utils/calculateAriaValues.ts +1 -1
- package/src/utils/calculateDragOffsetPercentage.ts +6 -3
- package/src/utils/calculateUnsafeDefaultLayout.ts +2 -2
- package/src/utils/callPanelCallbacks.ts +1 -1
- package/src/utils/resizePanel.ts +4 -1
- package/src/utils/test-utils.ts +1 -1
- package/src/utils/validatePanelConstraints.ts +4 -1
- package/src/utils/validatePanelGroupLayout.ts +3 -3
- package/src/vendor/stacking-order.ts +5 -2
|
@@ -327,7 +327,7 @@ function compare(a, b) {
|
|
|
327
327
|
b = ancestors.b.pop();
|
|
328
328
|
common_ancestor = a;
|
|
329
329
|
}
|
|
330
|
-
assert(common_ancestor);
|
|
330
|
+
assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
|
|
331
331
|
const z_indexes = {
|
|
332
332
|
a: get_z_index(find_stacking_context(ancestors.a)),
|
|
333
333
|
b: get_z_index(find_stacking_context(ancestors.b))
|
|
@@ -385,7 +385,7 @@ function find_stacking_context(nodes) {
|
|
|
385
385
|
let i = nodes.length;
|
|
386
386
|
while (i--) {
|
|
387
387
|
const node = nodes[i];
|
|
388
|
-
assert(node);
|
|
388
|
+
assert(node, "Missing node");
|
|
389
389
|
if (creates_stacking_context(node)) return node;
|
|
390
390
|
}
|
|
391
391
|
return null;
|
|
@@ -672,7 +672,7 @@ function updateResizeHandlerStates(action, event) {
|
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
-
function assert(expectedCondition, message
|
|
675
|
+
function assert(expectedCondition, message) {
|
|
676
676
|
if (!expectedCondition) {
|
|
677
677
|
console.error(message);
|
|
678
678
|
throw Error(message);
|
|
@@ -703,7 +703,7 @@ function resizePanel({
|
|
|
703
703
|
size
|
|
704
704
|
}) {
|
|
705
705
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
706
|
-
assert(panelConstraints != null);
|
|
706
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
707
707
|
let {
|
|
708
708
|
collapsedSize = 0,
|
|
709
709
|
collapsible,
|
|
@@ -741,8 +741,8 @@ function adjustLayoutByDelta({
|
|
|
741
741
|
}
|
|
742
742
|
const nextLayout = [...prevLayout];
|
|
743
743
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
744
|
-
assert(firstPivotIndex != null);
|
|
745
|
-
assert(secondPivotIndex != null);
|
|
744
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
745
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
746
746
|
let deltaApplied = 0;
|
|
747
747
|
|
|
748
748
|
//const DEBUG = [];
|
|
@@ -768,19 +768,18 @@ function adjustLayoutByDelta({
|
|
|
768
768
|
// Check if we should expand a collapsed panel
|
|
769
769
|
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
770
770
|
const panelConstraints = panelConstraintsArray[index];
|
|
771
|
-
assert(panelConstraints);
|
|
771
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
772
|
+
const {
|
|
773
|
+
collapsedSize = 0,
|
|
774
|
+
collapsible,
|
|
775
|
+
minSize = 0
|
|
776
|
+
} = panelConstraints;
|
|
772
777
|
|
|
773
778
|
//DEBUG.push(`edge case check 1: ${index}`);
|
|
774
779
|
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
|
|
775
|
-
if (
|
|
780
|
+
if (collapsible) {
|
|
776
781
|
const prevSize = prevLayout[index];
|
|
777
|
-
assert(prevSize != null);
|
|
778
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
779
|
-
assert(panelConstraints);
|
|
780
|
-
const {
|
|
781
|
-
collapsedSize = 0,
|
|
782
|
-
minSize = 0
|
|
783
|
-
} = panelConstraints;
|
|
782
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
784
783
|
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
785
784
|
const localDelta = minSize - prevSize;
|
|
786
785
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -797,22 +796,18 @@ function adjustLayoutByDelta({
|
|
|
797
796
|
// Check if we should collapse a panel at its minimum size
|
|
798
797
|
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
799
798
|
const panelConstraints = panelConstraintsArray[index];
|
|
800
|
-
assert(panelConstraints);
|
|
799
|
+
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
801
800
|
const {
|
|
802
|
-
|
|
801
|
+
collapsedSize = 0,
|
|
802
|
+
collapsible,
|
|
803
|
+
minSize = 0
|
|
803
804
|
} = panelConstraints;
|
|
804
805
|
|
|
805
806
|
//DEBUG.push(`edge case check 2: ${index}`);
|
|
806
807
|
//DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
807
808
|
if (collapsible) {
|
|
808
809
|
const prevSize = prevLayout[index];
|
|
809
|
-
assert(prevSize != null);
|
|
810
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
811
|
-
assert(panelConstraints);
|
|
812
|
-
const {
|
|
813
|
-
collapsedSize = 0,
|
|
814
|
-
minSize = 0
|
|
815
|
-
} = panelConstraints;
|
|
810
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
816
811
|
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
817
812
|
const localDelta = prevSize - collapsedSize;
|
|
818
813
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -842,7 +837,7 @@ function adjustLayoutByDelta({
|
|
|
842
837
|
//DEBUG.push("pre calc...");
|
|
843
838
|
while (true) {
|
|
844
839
|
const prevSize = prevLayout[index];
|
|
845
|
-
assert(prevSize != null);
|
|
840
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
846
841
|
const maxSafeSize = resizePanel({
|
|
847
842
|
panelConstraints: panelConstraintsArray,
|
|
848
843
|
panelIndex: index,
|
|
@@ -873,7 +868,7 @@ function adjustLayoutByDelta({
|
|
|
873
868
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
874
869
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
875
870
|
const prevSize = prevLayout[index];
|
|
876
|
-
assert(prevSize != null);
|
|
871
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
877
872
|
const unsafeSize = prevSize - deltaRemaining;
|
|
878
873
|
const safeSize = resizePanel({
|
|
879
874
|
panelConstraints: panelConstraintsArray,
|
|
@@ -910,7 +905,7 @@ function adjustLayoutByDelta({
|
|
|
910
905
|
// Now distribute the applied delta to the panels in the other direction
|
|
911
906
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
912
907
|
const prevSize = prevLayout[pivotIndex];
|
|
913
|
-
assert(prevSize != null);
|
|
908
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
914
909
|
const unsafeSize = prevSize + deltaApplied;
|
|
915
910
|
const safeSize = resizePanel({
|
|
916
911
|
panelConstraints: panelConstraintsArray,
|
|
@@ -928,7 +923,7 @@ function adjustLayoutByDelta({
|
|
|
928
923
|
let index = pivotIndex;
|
|
929
924
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
930
925
|
const prevSize = nextLayout[index];
|
|
931
|
-
assert(prevSize != null);
|
|
926
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
932
927
|
const unsafeSize = prevSize + deltaRemaining;
|
|
933
928
|
const safeSize = resizePanel({
|
|
934
929
|
panelConstraints: panelConstraintsArray,
|
|
@@ -974,7 +969,7 @@ function calculateAriaValues({
|
|
|
974
969
|
let totalMinSize = 0;
|
|
975
970
|
let totalMaxSize = 0;
|
|
976
971
|
const firstIndex = pivotIndices[0];
|
|
977
|
-
assert(firstIndex != null);
|
|
972
|
+
assert(firstIndex != null, "No pivot index found");
|
|
978
973
|
|
|
979
974
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
980
975
|
panelsArray.forEach((panelData, index) => {
|
|
@@ -1083,7 +1078,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1083
1078
|
const resizeHandleElement = resizeHandleElements[index];
|
|
1084
1079
|
if (resizeHandleElement == null) ; else {
|
|
1085
1080
|
const panelData = panelDataArray[index];
|
|
1086
|
-
assert(panelData);
|
|
1081
|
+
assert(panelData, `No panel data found for index "${index}"`);
|
|
1087
1082
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1088
1083
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1089
1084
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -1104,17 +1099,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1104
1099
|
return;
|
|
1105
1100
|
}
|
|
1106
1101
|
const eagerValues = eagerValuesRef.current;
|
|
1107
|
-
assert(eagerValues);
|
|
1102
|
+
assert(eagerValues, `Eager values not found`);
|
|
1108
1103
|
const {
|
|
1109
1104
|
panelDataArray
|
|
1110
1105
|
} = eagerValues;
|
|
1111
1106
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1112
1107
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1113
1108
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1114
|
-
assert(handles);
|
|
1109
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1115
1110
|
const cleanupFunctions = handles.map(handle => {
|
|
1116
1111
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
1117
|
-
assert(handleId);
|
|
1112
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1118
1113
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1119
1114
|
if (idBefore == null || idAfter == null) {
|
|
1120
1115
|
return () => {};
|
|
@@ -1130,7 +1125,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1130
1125
|
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1131
1126
|
if (index >= 0) {
|
|
1132
1127
|
const panelData = panelDataArray[index];
|
|
1133
|
-
assert(panelData);
|
|
1128
|
+
assert(panelData, `No panel data found for index ${index}`);
|
|
1134
1129
|
const size = layout[index];
|
|
1135
1130
|
const {
|
|
1136
1131
|
collapsedSize = 0,
|
|
@@ -1189,15 +1184,15 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
1189
1184
|
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1190
1185
|
const isHorizontal = direction === "horizontal";
|
|
1191
1186
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1192
|
-
assert(handleElement);
|
|
1187
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1193
1188
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1194
|
-
assert(groupId);
|
|
1189
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1195
1190
|
let {
|
|
1196
1191
|
initialCursorPosition
|
|
1197
1192
|
} = initialDragState;
|
|
1198
1193
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1199
1194
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1200
|
-
assert(groupElement);
|
|
1195
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1201
1196
|
const groupRect = groupElement.getBoundingClientRect();
|
|
1202
1197
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1203
1198
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
@@ -1258,7 +1253,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1258
1253
|
// Distribute default sizes first
|
|
1259
1254
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1260
1255
|
const panelConstraints = panelConstraintsArray[index];
|
|
1261
|
-
assert(panelConstraints);
|
|
1256
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1262
1257
|
const {
|
|
1263
1258
|
defaultSize
|
|
1264
1259
|
} = panelConstraints;
|
|
@@ -1272,7 +1267,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1272
1267
|
// Remaining size should be distributed evenly between panels without default sizes
|
|
1273
1268
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1274
1269
|
const panelConstraints = panelConstraintsArray[index];
|
|
1275
|
-
assert(panelConstraints);
|
|
1270
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1276
1271
|
const {
|
|
1277
1272
|
defaultSize
|
|
1278
1273
|
} = panelConstraints;
|
|
@@ -1292,7 +1287,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1292
1287
|
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1293
1288
|
layout.forEach((size, index) => {
|
|
1294
1289
|
const panelData = panelsArray[index];
|
|
1295
|
-
assert(panelData);
|
|
1290
|
+
assert(panelData, `Panel data not found for index ${index}`);
|
|
1296
1291
|
const {
|
|
1297
1292
|
callbacks,
|
|
1298
1293
|
constraints,
|
|
@@ -1482,7 +1477,7 @@ function validatePanelGroupLayout({
|
|
|
1482
1477
|
} else if (!fuzzyNumbersEqual(nextLayoutTotalSize, 100)) {
|
|
1483
1478
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1484
1479
|
const unsafeSize = nextLayout[index];
|
|
1485
|
-
assert(unsafeSize != null);
|
|
1480
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1486
1481
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1487
1482
|
nextLayout[index] = safeSize;
|
|
1488
1483
|
}
|
|
@@ -1492,7 +1487,7 @@ function validatePanelGroupLayout({
|
|
|
1492
1487
|
// First pass: Validate the proposed layout given each panel's constraints
|
|
1493
1488
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1494
1489
|
const unsafeSize = nextLayout[index];
|
|
1495
|
-
assert(unsafeSize != null);
|
|
1490
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1496
1491
|
const safeSize = resizePanel({
|
|
1497
1492
|
panelConstraints,
|
|
1498
1493
|
panelIndex: index,
|
|
@@ -1509,7 +1504,7 @@ function validatePanelGroupLayout({
|
|
|
1509
1504
|
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1510
1505
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1511
1506
|
const prevSize = nextLayout[index];
|
|
1512
|
-
assert(prevSize != null);
|
|
1507
|
+
assert(prevSize != null, `No layout data found for index ${index}`);
|
|
1513
1508
|
const unsafeSize = prevSize + remainingSize;
|
|
1514
1509
|
const safeSize = resizePanel({
|
|
1515
1510
|
panelConstraints,
|
|
@@ -1675,7 +1670,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1675
1670
|
panelSize,
|
|
1676
1671
|
pivotIndices
|
|
1677
1672
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1678
|
-
assert(panelSize != null);
|
|
1673
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1679
1674
|
if (panelSize !== collapsedSize) {
|
|
1680
1675
|
// Store size before collapse;
|
|
1681
1676
|
// This is the size that gets restored if the expand() API is used.
|
|
@@ -1752,7 +1747,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1752
1747
|
const {
|
|
1753
1748
|
panelSize
|
|
1754
1749
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1755
|
-
assert(panelSize != null);
|
|
1750
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1756
1751
|
return panelSize;
|
|
1757
1752
|
}, []);
|
|
1758
1753
|
|
|
@@ -1796,7 +1791,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1796
1791
|
collapsible,
|
|
1797
1792
|
panelSize
|
|
1798
1793
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1799
|
-
assert(panelSize != null);
|
|
1794
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1800
1795
|
return !collapsible || panelSize > collapsedSize;
|
|
1801
1796
|
}, []);
|
|
1802
1797
|
const registerPanel = useCallback(panelData => {
|
|
@@ -1963,7 +1958,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1963
1958
|
panelSize,
|
|
1964
1959
|
pivotIndices
|
|
1965
1960
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1966
|
-
assert(panelSize != null);
|
|
1961
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1967
1962
|
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
1968
1963
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
1969
1964
|
const nextLayout = adjustLayoutByDelta({
|
|
@@ -2000,7 +1995,10 @@ function PanelGroupWithForwardedRef({
|
|
|
2000
1995
|
const {
|
|
2001
1996
|
panelSize: prevPanelSize
|
|
2002
1997
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2003
|
-
|
|
1998
|
+
if (prevPanelSize == null) {
|
|
1999
|
+
// It's possible that the panels in this group have changed since the last render
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2004
2002
|
if (prevCollapsible && nextCollapsible && prevPanelSize === prevCollapsedSize) {
|
|
2005
2003
|
if (prevCollapsedSize !== nextCollapsedSize) {
|
|
2006
2004
|
resizePanel(panelData, nextCollapsedSize);
|
|
@@ -2022,7 +2020,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2022
2020
|
return;
|
|
2023
2021
|
}
|
|
2024
2022
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2025
|
-
assert(handleElement);
|
|
2023
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2026
2024
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2027
2025
|
setDragState({
|
|
2028
2026
|
dragHandleId,
|
|
@@ -2151,10 +2149,10 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
2151
2149
|
{
|
|
2152
2150
|
event.preventDefault();
|
|
2153
2151
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
2154
|
-
assert(groupId);
|
|
2152
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2155
2153
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2156
2154
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2157
|
-
assert(index !== null);
|
|
2155
|
+
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2158
2156
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2159
2157
|
const nextHandle = handles[nextIndex];
|
|
2160
2158
|
nextHandle.focus();
|
|
@@ -2226,7 +2224,7 @@ function PanelResizeHandle({
|
|
|
2226
2224
|
return;
|
|
2227
2225
|
}
|
|
2228
2226
|
const element = elementRef.current;
|
|
2229
|
-
assert(element);
|
|
2227
|
+
assert(element, "Element ref not attached");
|
|
2230
2228
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2231
2229
|
if (isActive) {
|
|
2232
2230
|
switch (action) {
|
|
@@ -338,7 +338,7 @@ function compare(a, b) {
|
|
|
338
338
|
b = ancestors.b.pop();
|
|
339
339
|
common_ancestor = a;
|
|
340
340
|
}
|
|
341
|
-
assert(common_ancestor);
|
|
341
|
+
assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
|
|
342
342
|
const z_indexes = {
|
|
343
343
|
a: get_z_index(find_stacking_context(ancestors.a)),
|
|
344
344
|
b: get_z_index(find_stacking_context(ancestors.b))
|
|
@@ -396,7 +396,7 @@ function find_stacking_context(nodes) {
|
|
|
396
396
|
let i = nodes.length;
|
|
397
397
|
while (i--) {
|
|
398
398
|
const node = nodes[i];
|
|
399
|
-
assert(node);
|
|
399
|
+
assert(node, "Missing node");
|
|
400
400
|
if (creates_stacking_context(node)) return node;
|
|
401
401
|
}
|
|
402
402
|
return null;
|
|
@@ -683,7 +683,7 @@ function updateResizeHandlerStates(action, event) {
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
-
function assert(expectedCondition, message
|
|
686
|
+
function assert(expectedCondition, message) {
|
|
687
687
|
if (!expectedCondition) {
|
|
688
688
|
console.error(message);
|
|
689
689
|
throw Error(message);
|
|
@@ -714,7 +714,7 @@ function resizePanel({
|
|
|
714
714
|
size
|
|
715
715
|
}) {
|
|
716
716
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
717
|
-
assert(panelConstraints != null);
|
|
717
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
718
718
|
let {
|
|
719
719
|
collapsedSize = 0,
|
|
720
720
|
collapsible,
|
|
@@ -752,8 +752,8 @@ function adjustLayoutByDelta({
|
|
|
752
752
|
}
|
|
753
753
|
const nextLayout = [...prevLayout];
|
|
754
754
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
755
|
-
assert(firstPivotIndex != null);
|
|
756
|
-
assert(secondPivotIndex != null);
|
|
755
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
756
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
757
757
|
let deltaApplied = 0;
|
|
758
758
|
|
|
759
759
|
//const DEBUG = [];
|
|
@@ -779,19 +779,18 @@ function adjustLayoutByDelta({
|
|
|
779
779
|
// Check if we should expand a collapsed panel
|
|
780
780
|
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
781
781
|
const panelConstraints = panelConstraintsArray[index];
|
|
782
|
-
assert(panelConstraints);
|
|
782
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
783
|
+
const {
|
|
784
|
+
collapsedSize = 0,
|
|
785
|
+
collapsible,
|
|
786
|
+
minSize = 0
|
|
787
|
+
} = panelConstraints;
|
|
783
788
|
|
|
784
789
|
//DEBUG.push(`edge case check 1: ${index}`);
|
|
785
790
|
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
|
|
786
|
-
if (
|
|
791
|
+
if (collapsible) {
|
|
787
792
|
const prevSize = prevLayout[index];
|
|
788
|
-
assert(prevSize != null);
|
|
789
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
790
|
-
assert(panelConstraints);
|
|
791
|
-
const {
|
|
792
|
-
collapsedSize = 0,
|
|
793
|
-
minSize = 0
|
|
794
|
-
} = panelConstraints;
|
|
793
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
795
794
|
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
796
795
|
const localDelta = minSize - prevSize;
|
|
797
796
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -808,22 +807,18 @@ function adjustLayoutByDelta({
|
|
|
808
807
|
// Check if we should collapse a panel at its minimum size
|
|
809
808
|
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
810
809
|
const panelConstraints = panelConstraintsArray[index];
|
|
811
|
-
assert(panelConstraints);
|
|
810
|
+
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
812
811
|
const {
|
|
813
|
-
|
|
812
|
+
collapsedSize = 0,
|
|
813
|
+
collapsible,
|
|
814
|
+
minSize = 0
|
|
814
815
|
} = panelConstraints;
|
|
815
816
|
|
|
816
817
|
//DEBUG.push(`edge case check 2: ${index}`);
|
|
817
818
|
//DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
818
819
|
if (collapsible) {
|
|
819
820
|
const prevSize = prevLayout[index];
|
|
820
|
-
assert(prevSize != null);
|
|
821
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
822
|
-
assert(panelConstraints);
|
|
823
|
-
const {
|
|
824
|
-
collapsedSize = 0,
|
|
825
|
-
minSize = 0
|
|
826
|
-
} = panelConstraints;
|
|
821
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
827
822
|
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
828
823
|
const localDelta = prevSize - collapsedSize;
|
|
829
824
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -853,7 +848,7 @@ function adjustLayoutByDelta({
|
|
|
853
848
|
//DEBUG.push("pre calc...");
|
|
854
849
|
while (true) {
|
|
855
850
|
const prevSize = prevLayout[index];
|
|
856
|
-
assert(prevSize != null);
|
|
851
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
857
852
|
const maxSafeSize = resizePanel({
|
|
858
853
|
panelConstraints: panelConstraintsArray,
|
|
859
854
|
panelIndex: index,
|
|
@@ -884,7 +879,7 @@ function adjustLayoutByDelta({
|
|
|
884
879
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
885
880
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
886
881
|
const prevSize = prevLayout[index];
|
|
887
|
-
assert(prevSize != null);
|
|
882
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
888
883
|
const unsafeSize = prevSize - deltaRemaining;
|
|
889
884
|
const safeSize = resizePanel({
|
|
890
885
|
panelConstraints: panelConstraintsArray,
|
|
@@ -921,7 +916,7 @@ function adjustLayoutByDelta({
|
|
|
921
916
|
// Now distribute the applied delta to the panels in the other direction
|
|
922
917
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
923
918
|
const prevSize = prevLayout[pivotIndex];
|
|
924
|
-
assert(prevSize != null);
|
|
919
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
925
920
|
const unsafeSize = prevSize + deltaApplied;
|
|
926
921
|
const safeSize = resizePanel({
|
|
927
922
|
panelConstraints: panelConstraintsArray,
|
|
@@ -939,7 +934,7 @@ function adjustLayoutByDelta({
|
|
|
939
934
|
let index = pivotIndex;
|
|
940
935
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
941
936
|
const prevSize = nextLayout[index];
|
|
942
|
-
assert(prevSize != null);
|
|
937
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
943
938
|
const unsafeSize = prevSize + deltaRemaining;
|
|
944
939
|
const safeSize = resizePanel({
|
|
945
940
|
panelConstraints: panelConstraintsArray,
|
|
@@ -985,7 +980,7 @@ function calculateAriaValues({
|
|
|
985
980
|
let totalMinSize = 0;
|
|
986
981
|
let totalMaxSize = 0;
|
|
987
982
|
const firstIndex = pivotIndices[0];
|
|
988
|
-
assert(firstIndex != null);
|
|
983
|
+
assert(firstIndex != null, "No pivot index found");
|
|
989
984
|
|
|
990
985
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
991
986
|
panelsArray.forEach((panelData, index) => {
|
|
@@ -1104,7 +1099,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1104
1099
|
}
|
|
1105
1100
|
} else {
|
|
1106
1101
|
const panelData = panelDataArray[index];
|
|
1107
|
-
assert(panelData);
|
|
1102
|
+
assert(panelData, `No panel data found for index "${index}"`);
|
|
1108
1103
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1109
1104
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1110
1105
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -1125,17 +1120,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1125
1120
|
return;
|
|
1126
1121
|
}
|
|
1127
1122
|
const eagerValues = eagerValuesRef.current;
|
|
1128
|
-
assert(eagerValues);
|
|
1123
|
+
assert(eagerValues, `Eager values not found`);
|
|
1129
1124
|
const {
|
|
1130
1125
|
panelDataArray
|
|
1131
1126
|
} = eagerValues;
|
|
1132
1127
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1133
1128
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1134
1129
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1135
|
-
assert(handles);
|
|
1130
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1136
1131
|
const cleanupFunctions = handles.map(handle => {
|
|
1137
1132
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
1138
|
-
assert(handleId);
|
|
1133
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1139
1134
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1140
1135
|
if (idBefore == null || idAfter == null) {
|
|
1141
1136
|
return () => {};
|
|
@@ -1151,7 +1146,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1151
1146
|
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1152
1147
|
if (index >= 0) {
|
|
1153
1148
|
const panelData = panelDataArray[index];
|
|
1154
|
-
assert(panelData);
|
|
1149
|
+
assert(panelData, `No panel data found for index ${index}`);
|
|
1155
1150
|
const size = layout[index];
|
|
1156
1151
|
const {
|
|
1157
1152
|
collapsedSize = 0,
|
|
@@ -1210,15 +1205,15 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
1210
1205
|
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1211
1206
|
const isHorizontal = direction === "horizontal";
|
|
1212
1207
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1213
|
-
assert(handleElement);
|
|
1208
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1214
1209
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1215
|
-
assert(groupId);
|
|
1210
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1216
1211
|
let {
|
|
1217
1212
|
initialCursorPosition
|
|
1218
1213
|
} = initialDragState;
|
|
1219
1214
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1220
1215
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1221
|
-
assert(groupElement);
|
|
1216
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1222
1217
|
const groupRect = groupElement.getBoundingClientRect();
|
|
1223
1218
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1224
1219
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
@@ -1279,7 +1274,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1279
1274
|
// Distribute default sizes first
|
|
1280
1275
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1281
1276
|
const panelConstraints = panelConstraintsArray[index];
|
|
1282
|
-
assert(panelConstraints);
|
|
1277
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1283
1278
|
const {
|
|
1284
1279
|
defaultSize
|
|
1285
1280
|
} = panelConstraints;
|
|
@@ -1293,7 +1288,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1293
1288
|
// Remaining size should be distributed evenly between panels without default sizes
|
|
1294
1289
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1295
1290
|
const panelConstraints = panelConstraintsArray[index];
|
|
1296
|
-
assert(panelConstraints);
|
|
1291
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1297
1292
|
const {
|
|
1298
1293
|
defaultSize
|
|
1299
1294
|
} = panelConstraints;
|
|
@@ -1313,7 +1308,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1313
1308
|
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1314
1309
|
layout.forEach((size, index) => {
|
|
1315
1310
|
const panelData = panelsArray[index];
|
|
1316
|
-
assert(panelData);
|
|
1311
|
+
assert(panelData, `Panel data not found for index ${index}`);
|
|
1317
1312
|
const {
|
|
1318
1313
|
callbacks,
|
|
1319
1314
|
constraints,
|
|
@@ -1497,7 +1492,7 @@ function validatePanelConstraints({
|
|
|
1497
1492
|
{
|
|
1498
1493
|
const warnings = [];
|
|
1499
1494
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
1500
|
-
assert(panelConstraints);
|
|
1495
|
+
assert(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
1501
1496
|
const {
|
|
1502
1497
|
collapsedSize = 0,
|
|
1503
1498
|
collapsible = false,
|
|
@@ -1551,7 +1546,7 @@ function validatePanelGroupLayout({
|
|
|
1551
1546
|
}
|
|
1552
1547
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1553
1548
|
const unsafeSize = nextLayout[index];
|
|
1554
|
-
assert(unsafeSize != null);
|
|
1549
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1555
1550
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1556
1551
|
nextLayout[index] = safeSize;
|
|
1557
1552
|
}
|
|
@@ -1561,7 +1556,7 @@ function validatePanelGroupLayout({
|
|
|
1561
1556
|
// First pass: Validate the proposed layout given each panel's constraints
|
|
1562
1557
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1563
1558
|
const unsafeSize = nextLayout[index];
|
|
1564
|
-
assert(unsafeSize != null);
|
|
1559
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1565
1560
|
const safeSize = resizePanel({
|
|
1566
1561
|
panelConstraints,
|
|
1567
1562
|
panelIndex: index,
|
|
@@ -1578,7 +1573,7 @@ function validatePanelGroupLayout({
|
|
|
1578
1573
|
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1579
1574
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1580
1575
|
const prevSize = nextLayout[index];
|
|
1581
|
-
assert(prevSize != null);
|
|
1576
|
+
assert(prevSize != null, `No layout data found for index ${index}`);
|
|
1582
1577
|
const unsafeSize = prevSize + remainingSize;
|
|
1583
1578
|
const safeSize = resizePanel({
|
|
1584
1579
|
panelConstraints,
|
|
@@ -1755,7 +1750,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1755
1750
|
const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
|
|
1756
1751
|
for (let panelIndex = 0; panelIndex < panelConstraints.length; panelIndex++) {
|
|
1757
1752
|
const panelData = panelDataArray[panelIndex];
|
|
1758
|
-
assert(panelData);
|
|
1753
|
+
assert(panelData, `Panel data not found for index ${panelIndex}`);
|
|
1759
1754
|
const isValid = validatePanelConstraints({
|
|
1760
1755
|
panelConstraints,
|
|
1761
1756
|
panelId: panelData.id,
|
|
@@ -1786,7 +1781,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1786
1781
|
panelSize,
|
|
1787
1782
|
pivotIndices
|
|
1788
1783
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1789
|
-
assert(panelSize != null);
|
|
1784
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1790
1785
|
if (panelSize !== collapsedSize) {
|
|
1791
1786
|
// Store size before collapse;
|
|
1792
1787
|
// This is the size that gets restored if the expand() API is used.
|
|
@@ -1863,7 +1858,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1863
1858
|
const {
|
|
1864
1859
|
panelSize
|
|
1865
1860
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1866
|
-
assert(panelSize != null);
|
|
1861
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1867
1862
|
return panelSize;
|
|
1868
1863
|
}, []);
|
|
1869
1864
|
|
|
@@ -1907,7 +1902,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1907
1902
|
collapsible,
|
|
1908
1903
|
panelSize
|
|
1909
1904
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1910
|
-
assert(panelSize != null);
|
|
1905
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1911
1906
|
return !collapsible || panelSize > collapsedSize;
|
|
1912
1907
|
}, []);
|
|
1913
1908
|
const registerPanel = useCallback(panelData => {
|
|
@@ -2074,7 +2069,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2074
2069
|
panelSize,
|
|
2075
2070
|
pivotIndices
|
|
2076
2071
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
2077
|
-
assert(panelSize != null);
|
|
2072
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
2078
2073
|
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
2079
2074
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
2080
2075
|
const nextLayout = adjustLayoutByDelta({
|
|
@@ -2111,7 +2106,10 @@ function PanelGroupWithForwardedRef({
|
|
|
2111
2106
|
const {
|
|
2112
2107
|
panelSize: prevPanelSize
|
|
2113
2108
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2114
|
-
|
|
2109
|
+
if (prevPanelSize == null) {
|
|
2110
|
+
// It's possible that the panels in this group have changed since the last render
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2115
2113
|
if (prevCollapsible && nextCollapsible && prevPanelSize === prevCollapsedSize) {
|
|
2116
2114
|
if (prevCollapsedSize !== nextCollapsedSize) {
|
|
2117
2115
|
resizePanel(panelData, nextCollapsedSize);
|
|
@@ -2133,7 +2131,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2133
2131
|
return;
|
|
2134
2132
|
}
|
|
2135
2133
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2136
|
-
assert(handleElement);
|
|
2134
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2137
2135
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2138
2136
|
setDragState({
|
|
2139
2137
|
dragHandleId,
|
|
@@ -2262,10 +2260,10 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
2262
2260
|
{
|
|
2263
2261
|
event.preventDefault();
|
|
2264
2262
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
2265
|
-
assert(groupId);
|
|
2263
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2266
2264
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2267
2265
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2268
|
-
assert(index !== null);
|
|
2266
|
+
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2269
2267
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2270
2268
|
const nextHandle = handles[nextIndex];
|
|
2271
2269
|
nextHandle.focus();
|
|
@@ -2337,7 +2335,7 @@ function PanelResizeHandle({
|
|
|
2337
2335
|
return;
|
|
2338
2336
|
}
|
|
2339
2337
|
const element = elementRef.current;
|
|
2340
|
-
assert(element);
|
|
2338
|
+
assert(element, "Element ref not attached");
|
|
2341
2339
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2342
2340
|
if (isActive) {
|
|
2343
2341
|
switch (action) {
|