react-resizable-panels 0.0.53 → 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.
Files changed (34) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/declarations/src/Panel.d.ts +2 -2
  3. package/dist/declarations/src/PanelGroup.d.ts +2 -2
  4. package/dist/declarations/src/PanelResizeHandle.d.ts +5 -2
  5. package/dist/declarations/src/index.d.ts +7 -7
  6. package/dist/declarations/src/types.d.ts +2 -1
  7. package/dist/react-resizable-panels.browser.cjs.js +1432 -0
  8. package/dist/react-resizable-panels.browser.cjs.mjs +5 -0
  9. package/dist/react-resizable-panels.browser.development.cjs.js +1455 -0
  10. package/dist/react-resizable-panels.browser.development.cjs.mjs +5 -0
  11. package/dist/react-resizable-panels.browser.development.esm.js +1429 -0
  12. package/dist/react-resizable-panels.browser.esm.js +1406 -0
  13. package/dist/react-resizable-panels.cjs.js +10 -18
  14. package/dist/react-resizable-panels.development.cjs.js +35 -27
  15. package/dist/react-resizable-panels.development.cjs.mjs +5 -0
  16. package/dist/react-resizable-panels.development.esm.js +35 -27
  17. package/dist/react-resizable-panels.development.node.cjs.js +1373 -0
  18. package/dist/react-resizable-panels.development.node.cjs.mjs +5 -0
  19. package/dist/react-resizable-panels.development.node.esm.js +1347 -0
  20. package/dist/react-resizable-panels.esm.js +10 -18
  21. package/dist/react-resizable-panels.node.cjs.js +1345 -0
  22. package/dist/react-resizable-panels.node.cjs.mjs +5 -0
  23. package/dist/react-resizable-panels.node.esm.js +1319 -0
  24. package/package.json +26 -1
  25. package/src/Panel.ts +5 -5
  26. package/src/PanelContexts.ts +1 -4
  27. package/src/PanelGroup.ts +48 -10
  28. package/src/PanelResizeHandle.ts +1 -4
  29. package/src/env-conditions/browser.ts +1 -0
  30. package/src/env-conditions/node.ts +1 -0
  31. package/src/env-conditions/unknown.ts +1 -0
  32. package/src/hooks/useIsomorphicEffect.ts +2 -9
  33. package/src/types.ts +1 -0
  34. 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 canUseEffectHooks = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
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
 
@@ -821,6 +816,11 @@ function PanelGroupWithForwardedRef({
821
816
  // We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
822
817
  // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
823
818
  const initialDragStateRef = useRef(null);
819
+ useRef({
820
+ didLogDefaultSizeWarning: false,
821
+ didLogIdAndOrderWarning: false,
822
+ prevPanelIds: []
823
+ });
824
824
 
825
825
  // Use a ref to guard against users passing inline props
826
826
  const callbacksRef = useRef({
@@ -1268,10 +1268,6 @@ const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwar
1268
1268
  ...props,
1269
1269
  forwardedRef: ref
1270
1270
  }));
1271
-
1272
- // Workaround for Parcel scope hoisting (which renames objects/functions).
1273
- // Casting to :any is required to avoid corrupting the generated TypeScript types.
1274
- // See github.com/parcel-bundler/parcel/issues/8724
1275
1271
  PanelGroupWithForwardedRef.displayName = "PanelGroup";
1276
1272
  PanelGroup.displayName = "forwardRef(PanelGroup)";
1277
1273
 
@@ -1407,10 +1403,6 @@ function PanelResizeHandle({
1407
1403
  tabIndex: 0
1408
1404
  });
1409
1405
  }
1410
-
1411
- // Workaround for Parcel scope hoisting (which renames objects/functions).
1412
- // Casting to :any is required to avoid corrupting the generated TypeScript types.
1413
- // See github.com/parcel-bundler/parcel/issues/8724
1414
1406
  PanelResizeHandle.displayName = "PanelResizeHandle";
1415
1407
 
1416
1408
  export { Panel, PanelGroup, PanelResizeHandle };