react-resizable-panels 0.0.52 → 0.0.54
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 +7 -0
- package/dist/declarations/src/Panel.d.ts +2 -2
- package/dist/declarations/src/PanelGroup.d.ts +2 -2
- package/dist/declarations/src/PanelResizeHandle.d.ts +5 -2
- package/dist/declarations/src/index.d.ts +7 -7
- package/dist/declarations/src/types.d.ts +2 -1
- package/dist/react-resizable-panels.browser.cjs.js +1432 -0
- package/dist/react-resizable-panels.browser.cjs.mjs +5 -0
- package/dist/react-resizable-panels.browser.development.cjs.js +1455 -0
- package/dist/react-resizable-panels.browser.development.cjs.mjs +5 -0
- package/dist/react-resizable-panels.browser.development.esm.js +1429 -0
- package/dist/react-resizable-panels.browser.esm.js +1406 -0
- package/dist/react-resizable-panels.cjs.js +17 -19
- package/dist/react-resizable-panels.development.cjs.js +42 -28
- package/dist/react-resizable-panels.development.cjs.mjs +5 -0
- package/dist/react-resizable-panels.development.esm.js +42 -28
- package/dist/react-resizable-panels.development.node.cjs.js +1373 -0
- package/dist/react-resizable-panels.development.node.cjs.mjs +5 -0
- package/dist/react-resizable-panels.development.node.esm.js +1347 -0
- package/dist/react-resizable-panels.esm.js +17 -19
- package/dist/react-resizable-panels.node.cjs.js +1345 -0
- package/dist/react-resizable-panels.node.cjs.mjs +5 -0
- package/dist/react-resizable-panels.node.esm.js +1319 -0
- package/package.json +26 -1
- package/src/Panel.ts +5 -5
- package/src/PanelContexts.ts +1 -4
- package/src/PanelGroup.ts +48 -10
- package/src/PanelResizeHandle.ts +1 -4
- package/src/env-conditions/browser.ts +1 -0
- package/src/env-conditions/node.ts +1 -0
- package/src/env-conditions/unknown.ts +1 -0
- package/src/hooks/useIsomorphicEffect.ts +2 -9
- package/src/types.ts +1 -0
- package/src/utils/group.ts +8 -2
- package/dist/react-resizable-panels.cjs.js.map +0 -1
- package/dist/react-resizable-panels.esm.js.map +0 -1
- package/src/utils/ssr.ts +0 -7
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
const isBrowser = typeof window !== "undefined";
|
|
4
|
+
|
|
3
5
|
// This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
|
|
4
6
|
|
|
5
7
|
// eslint-disable-next-line no-restricted-imports
|
|
@@ -21,8 +23,7 @@ const {
|
|
|
21
23
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
22
24
|
const useId = React["useId".toString()];
|
|
23
25
|
|
|
24
|
-
const
|
|
25
|
-
const useIsomorphicLayoutEffect = canUseEffectHooks ? useLayoutEffect : () => {};
|
|
26
|
+
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : () => {};
|
|
26
27
|
|
|
27
28
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
28
29
|
let counter = 0;
|
|
@@ -36,10 +37,6 @@ function useUniqueId(idFromParams = null) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const PanelGroupContext = createContext(null);
|
|
39
|
-
|
|
40
|
-
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
41
|
-
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
42
|
-
// See github.com/parcel-bundler/parcel/issues/8724
|
|
43
40
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
44
41
|
|
|
45
42
|
function PanelWithForwardedRef({
|
|
@@ -107,6 +104,7 @@ function PanelWithForwardedRef({
|
|
|
107
104
|
collapsible,
|
|
108
105
|
defaultSize,
|
|
109
106
|
id: panelId,
|
|
107
|
+
idWasAutoGenerated: idFromProps == null,
|
|
110
108
|
maxSize,
|
|
111
109
|
minSize,
|
|
112
110
|
order
|
|
@@ -118,6 +116,7 @@ function PanelWithForwardedRef({
|
|
|
118
116
|
panelDataRef.current.collapsible = collapsible;
|
|
119
117
|
panelDataRef.current.defaultSize = defaultSize;
|
|
120
118
|
panelDataRef.current.id = panelId;
|
|
119
|
+
panelDataRef.current.idWasAutoGenerated = idFromProps == null;
|
|
121
120
|
panelDataRef.current.maxSize = maxSize;
|
|
122
121
|
panelDataRef.current.minSize = minSize;
|
|
123
122
|
panelDataRef.current.order = order;
|
|
@@ -157,10 +156,6 @@ const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
|
|
|
157
156
|
...props,
|
|
158
157
|
forwardedRef: ref
|
|
159
158
|
}));
|
|
160
|
-
|
|
161
|
-
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
162
|
-
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
163
|
-
// See github.com/parcel-bundler/parcel/issues/8724
|
|
164
159
|
PanelWithForwardedRef.displayName = "Panel";
|
|
165
160
|
Panel.displayName = "forwardRef(Panel)";
|
|
166
161
|
|
|
@@ -262,12 +257,18 @@ function adjustByDelta(event, panels, idBefore, idAfter, delta, prevSizes, panel
|
|
|
262
257
|
}
|
|
263
258
|
function callPanelCallbacks(panelsArray, sizes, panelIdToLastNotifiedSizeMap) {
|
|
264
259
|
sizes.forEach((size, index) => {
|
|
260
|
+
const panelRef = panelsArray[index];
|
|
261
|
+
if (!panelRef) {
|
|
262
|
+
// Handle initial mount (when panels are registered too late to be in the panels array)
|
|
263
|
+
// The subsequent render+effects will handle the resize notification
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
265
266
|
const {
|
|
266
267
|
callbacksRef,
|
|
267
268
|
collapsedSize,
|
|
268
269
|
collapsible,
|
|
269
270
|
id
|
|
270
|
-
} =
|
|
271
|
+
} = panelRef.current;
|
|
271
272
|
const lastNotifiedSize = panelIdToLastNotifiedSizeMap[id];
|
|
272
273
|
if (lastNotifiedSize !== size) {
|
|
273
274
|
panelIdToLastNotifiedSizeMap[id] = size;
|
|
@@ -815,6 +816,11 @@ function PanelGroupWithForwardedRef({
|
|
|
815
816
|
// We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
|
|
816
817
|
// This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
|
|
817
818
|
const initialDragStateRef = useRef(null);
|
|
819
|
+
useRef({
|
|
820
|
+
didLogDefaultSizeWarning: false,
|
|
821
|
+
didLogIdAndOrderWarning: false,
|
|
822
|
+
prevPanelIds: []
|
|
823
|
+
});
|
|
818
824
|
|
|
819
825
|
// Use a ref to guard against users passing inline props
|
|
820
826
|
const callbacksRef = useRef({
|
|
@@ -1262,10 +1268,6 @@ const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwar
|
|
|
1262
1268
|
...props,
|
|
1263
1269
|
forwardedRef: ref
|
|
1264
1270
|
}));
|
|
1265
|
-
|
|
1266
|
-
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
1267
|
-
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
1268
|
-
// See github.com/parcel-bundler/parcel/issues/8724
|
|
1269
1271
|
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
1270
1272
|
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
1271
1273
|
|
|
@@ -1401,10 +1403,6 @@ function PanelResizeHandle({
|
|
|
1401
1403
|
tabIndex: 0
|
|
1402
1404
|
});
|
|
1403
1405
|
}
|
|
1404
|
-
|
|
1405
|
-
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
1406
|
-
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
1407
|
-
// See github.com/parcel-bundler/parcel/issues/8724
|
|
1408
1406
|
PanelResizeHandle.displayName = "PanelResizeHandle";
|
|
1409
1407
|
|
|
1410
1408
|
export { Panel, PanelGroup, PanelResizeHandle };
|