|
| 1 | +diff --git a/dist/commonjs/index.js b/dist/commonjs/index.js |
| 2 | +index e3bdcf702702392e9a06c981545f659ee7c5970e..d88ae6b2dc5b4cf1970cb693f58a926bd12a8f45 100644 |
| 3 | +--- a/dist/commonjs/index.js |
| 4 | ++++ b/dist/commonjs/index.js |
| 5 | +@@ -757,30 +757,14 @@ function updateLayout(context, dragEvent) { |
| 6 | + panelAfter.onCollapseChange.current(false); |
| 7 | + } |
| 8 | + } |
| 9 | +- const panelBeforeIsAboutToCollapse = panelBefore.currentValue.value.eq(getUnitPixelValue(context, panelBefore.min)); |
| 10 | +- // If the panel was expanded and now is at it's min size, collapse it |
| 11 | +- if (!dragEvent.disregardCollapseBuffer && |
| 12 | +- panelBefore.collapsible && |
| 13 | +- panelBeforeIsAboutToCollapse) { |
| 14 | +- if (panelBefore.onCollapseChange?.current && |
| 15 | +- panelBefore.collapseIsControlled && |
| 16 | +- !dragEvent.controlled && |
| 17 | +- !dragEvent.isVirtual) { |
| 18 | +- panelBefore.onCollapseChange.current(true); |
| 19 | +- return { dragOvershoot: newDragOvershoot }; |
| 20 | +- } |
| 21 | +- // Make it collapsed |
| 22 | +- panelBefore.collapsed = true; |
| 23 | +- panelBeforeNewValue = getUnitPixelValue(context, panelBefore.collapsedSize); |
| 24 | +- // Add the extra space created to the before panel |
| 25 | +- panelAfterNewValue = panelAfter.currentValue.value.add(panelBeforePreviousValue.minus(panelBeforeNewValue)); |
| 26 | +- if (panelBefore.onCollapseChange?.current && |
| 27 | +- !panelBefore.collapseIsControlled && |
| 28 | +- !dragEvent.controlled && |
| 29 | +- !dragEvent.isVirtual) { |
| 30 | +- panelBefore.onCollapseChange.current(true); |
| 31 | +- } |
| 32 | +- } |
| 33 | ++ // Drag-to-collapse is disabled in this fork: every consumer of the |
| 34 | ++ // library uses controlled `collapsed` props and triggers collapse |
| 35 | ++ // explicitly (close button, ESC, URL change, etc.). The original auto- |
| 36 | ++ // collapse-on-drag logic that lived here would notify the parent when a |
| 37 | ++ // collapsible panel reached its min during a drag — keeping it for our |
| 38 | ++ // (controlled-only) case caused state-machine deadlocks when handlers |
| 39 | ++ // were no-ops, so the block is removed entirely. Panels just clamp at |
| 40 | ++ // `min` during drag now. |
| 41 | + panelBefore.currentValue = { type: "pixel", value: panelBeforeNewValue }; |
| 42 | + panelAfter.currentValue = { type: "pixel", value: panelAfterNewValue }; |
| 43 | + const leftoverSpace = new big_js_1.default(getGroupSize(context)).minus(newItems.reduce((acc, b) => acc.add(isPanelData(b) ? b.currentValue.value : b.size.value), new big_js_1.default(0))); |
| 44 | +@@ -940,7 +924,12 @@ function setCookie(name, jsonData) { |
| 45 | + function getDeltaForEvent(context, event) { |
| 46 | + const panel = getPanelWithId(context, event.panelId); |
| 47 | + if (event.type === "expandPanel") { |
| 48 | +- return new big_js_1.default(panel.sizeBeforeCollapse ?? getUnitPixelValue(context, panel.min)).minus(panel.currentValue.value); |
| 49 | ++ // Fall back to `default` before `min` so the first-ever expand of a |
| 50 | ++ // panel that started life collapsed lands at its configured default |
| 51 | ++ // size rather than getting stuck at `min`. |
| 52 | ++ const defaultPx = panel.default ? getUnitPixelValue(context, panel.default) : undefined; |
| 53 | ++ const target = panel.sizeBeforeCollapse ?? defaultPx ?? getUnitPixelValue(context, panel.min); |
| 54 | ++ return new big_js_1.default(target).minus(panel.currentValue.value); |
| 55 | + } |
| 56 | + const collapsedSize = getUnitPixelValue(context, panel.collapsedSize); |
| 57 | + return panel.currentValue.value.minus(collapsedSize); |
| 58 | +diff --git a/dist/esm/index.js b/dist/esm/index.js |
| 59 | +index f8fddd70c0f1aaed29f2fb0ca0d8093d8ce66335..d1dae8beb1447afca47b91e796b8279135f50c36 100644 |
| 60 | +--- a/dist/esm/index.js |
| 61 | ++++ b/dist/esm/index.js |
| 62 | +@@ -728,30 +728,14 @@ function updateLayout(context, dragEvent) { |
| 63 | + panelAfter.onCollapseChange.current(false); |
| 64 | + } |
| 65 | + } |
| 66 | +- const panelBeforeIsAboutToCollapse = panelBefore.currentValue.value.eq(getUnitPixelValue(context, panelBefore.min)); |
| 67 | +- // If the panel was expanded and now is at it's min size, collapse it |
| 68 | +- if (!dragEvent.disregardCollapseBuffer && |
| 69 | +- panelBefore.collapsible && |
| 70 | +- panelBeforeIsAboutToCollapse) { |
| 71 | +- if (panelBefore.onCollapseChange?.current && |
| 72 | +- panelBefore.collapseIsControlled && |
| 73 | +- !dragEvent.controlled && |
| 74 | +- !dragEvent.isVirtual) { |
| 75 | +- panelBefore.onCollapseChange.current(true); |
| 76 | +- return { dragOvershoot: newDragOvershoot }; |
| 77 | +- } |
| 78 | +- // Make it collapsed |
| 79 | +- panelBefore.collapsed = true; |
| 80 | +- panelBeforeNewValue = getUnitPixelValue(context, panelBefore.collapsedSize); |
| 81 | +- // Add the extra space created to the before panel |
| 82 | +- panelAfterNewValue = panelAfter.currentValue.value.add(panelBeforePreviousValue.minus(panelBeforeNewValue)); |
| 83 | +- if (panelBefore.onCollapseChange?.current && |
| 84 | +- !panelBefore.collapseIsControlled && |
| 85 | +- !dragEvent.controlled && |
| 86 | +- !dragEvent.isVirtual) { |
| 87 | +- panelBefore.onCollapseChange.current(true); |
| 88 | +- } |
| 89 | +- } |
| 90 | ++ // Drag-to-collapse is disabled in this fork: every consumer of the |
| 91 | ++ // library uses controlled `collapsed` props and triggers collapse |
| 92 | ++ // explicitly (close button, ESC, URL change, etc.). The original auto- |
| 93 | ++ // collapse-on-drag logic that lived here would notify the parent when a |
| 94 | ++ // collapsible panel reached its min during a drag — keeping it for our |
| 95 | ++ // (controlled-only) case caused state-machine deadlocks when handlers |
| 96 | ++ // were no-ops, so the block is removed entirely. Panels just clamp at |
| 97 | ++ // `min` during drag now. |
| 98 | + panelBefore.currentValue = { type: "pixel", value: panelBeforeNewValue }; |
| 99 | + panelAfter.currentValue = { type: "pixel", value: panelAfterNewValue }; |
| 100 | + const leftoverSpace = new Big(getGroupSize(context)).minus(newItems.reduce((acc, b) => acc.add(isPanelData(b) ? b.currentValue.value : b.size.value), new Big(0))); |
| 101 | +@@ -911,7 +895,12 @@ function setCookie(name, jsonData) { |
| 102 | + function getDeltaForEvent(context, event) { |
| 103 | + const panel = getPanelWithId(context, event.panelId); |
| 104 | + if (event.type === "expandPanel") { |
| 105 | +- return new Big(panel.sizeBeforeCollapse ?? getUnitPixelValue(context, panel.min)).minus(panel.currentValue.value); |
| 106 | ++ // Fall back to `default` before `min` so the first-ever expand of a |
| 107 | ++ // panel that started life collapsed lands at its configured default |
| 108 | ++ // size rather than getting stuck at `min`. |
| 109 | ++ const defaultPx = panel.default ? getUnitPixelValue(context, panel.default) : undefined; |
| 110 | ++ const target = panel.sizeBeforeCollapse ?? defaultPx ?? getUnitPixelValue(context, panel.min); |
| 111 | ++ return new Big(target).minus(panel.currentValue.value); |
| 112 | + } |
| 113 | + const collapsedSize = getUnitPixelValue(context, panel.collapsedSize); |
| 114 | + return panel.currentValue.value.minus(collapsedSize); |
0 commit comments