react-resizable-panels 2.0.5 → 2.0.6
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/vendor/react.d.ts +3 -2
- package/dist/react-resizable-panels.browser.cjs.js +3 -2
- package/dist/react-resizable-panels.browser.development.cjs.js +3 -2
- package/dist/react-resizable-panels.browser.development.esm.js +3 -2
- package/dist/react-resizable-panels.browser.esm.js +3 -2
- package/dist/react-resizable-panels.cjs.js +3 -2
- package/dist/react-resizable-panels.development.cjs.js +3 -2
- package/dist/react-resizable-panels.development.esm.js +3 -2
- package/dist/react-resizable-panels.development.node.cjs.js +0 -3
- package/dist/react-resizable-panels.development.node.esm.js +0 -3
- package/dist/react-resizable-panels.esm.js +3 -2
- package/dist/react-resizable-panels.node.cjs.js +0 -3
- package/dist/react-resizable-panels.node.esm.js +0 -3
- package/package.json +1 -1
- package/src/PanelResizeHandle.ts +2 -2
- package/src/hooks/useIsomorphicEffect.ts +4 -2
- package/src/vendor/react.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
- Replace `useLayoutEffect` usage with SSR-safe wrapper hook (#294)
|
|
6
|
+
|
|
3
7
|
## 2.0.5
|
|
4
8
|
|
|
5
9
|
- Resize handle hit detection considers [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context) when determining hit detection (#291)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { CSSProperties, ElementType, ForwardedRef, HTMLAttributes, MouseEvent, PropsWithChildren, ReactElement, ReactNode, RefObject, TouchEvent } from "react";
|
|
3
|
-
declare const createElement: typeof React.createElement, createContext: typeof React.createContext, createRef: typeof React.createRef, forwardRef: typeof React.forwardRef, useCallback: typeof React.useCallback, useContext: typeof React.useContext, useEffect: typeof React.useEffect, useImperativeHandle: typeof React.useImperativeHandle,
|
|
3
|
+
declare const createElement: typeof React.createElement, createContext: typeof React.createContext, createRef: typeof React.createRef, forwardRef: typeof React.forwardRef, useCallback: typeof React.useCallback, useContext: typeof React.useContext, useEffect: typeof React.useEffect, useImperativeHandle: typeof React.useImperativeHandle, useMemo: typeof React.useMemo, useRef: typeof React.useRef, useState: typeof React.useState;
|
|
4
4
|
declare const useId: () => string;
|
|
5
|
-
|
|
5
|
+
declare const useLayoutEffect_do_not_use_directly: typeof React.useLayoutEffect;
|
|
6
|
+
export { createElement, createContext, createRef, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect_do_not_use_directly, useMemo, useRef, useState, };
|
|
6
7
|
export type { CSSProperties, ElementType, ForwardedRef, HTMLAttributes, MouseEvent, PropsWithChildren, ReactElement, ReactNode, RefObject, TouchEvent, };
|
|
@@ -46,11 +46,12 @@ const {
|
|
|
46
46
|
|
|
47
47
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
48
48
|
const useId = React__namespace["useId".toString()];
|
|
49
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
49
50
|
|
|
50
51
|
const PanelGroupContext = createContext(null);
|
|
51
52
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
52
53
|
|
|
53
|
-
const useIsomorphicLayoutEffect =
|
|
54
|
+
const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
|
|
54
55
|
|
|
55
56
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
56
57
|
let counter = 0;
|
|
@@ -2098,7 +2099,7 @@ function PanelResizeHandle({
|
|
|
2098
2099
|
const committedValuesRef = useRef({
|
|
2099
2100
|
state
|
|
2100
2101
|
});
|
|
2101
|
-
|
|
2102
|
+
useIsomorphicLayoutEffect(() => {
|
|
2102
2103
|
committedValuesRef.current.state = state;
|
|
2103
2104
|
});
|
|
2104
2105
|
useEffect(() => {
|
|
@@ -46,11 +46,12 @@ const {
|
|
|
46
46
|
|
|
47
47
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
48
48
|
const useId = React__namespace["useId".toString()];
|
|
49
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
49
50
|
|
|
50
51
|
const PanelGroupContext = createContext(null);
|
|
51
52
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
52
53
|
|
|
53
|
-
const useIsomorphicLayoutEffect =
|
|
54
|
+
const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
|
|
54
55
|
|
|
55
56
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
56
57
|
let counter = 0;
|
|
@@ -2204,7 +2205,7 @@ function PanelResizeHandle({
|
|
|
2204
2205
|
const committedValuesRef = useRef({
|
|
2205
2206
|
state
|
|
2206
2207
|
});
|
|
2207
|
-
|
|
2208
|
+
useIsomorphicLayoutEffect(() => {
|
|
2208
2209
|
committedValuesRef.current.state = state;
|
|
2209
2210
|
});
|
|
2210
2211
|
useEffect(() => {
|
|
@@ -22,11 +22,12 @@ const {
|
|
|
22
22
|
|
|
23
23
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
24
24
|
const useId = React["useId".toString()];
|
|
25
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
25
26
|
|
|
26
27
|
const PanelGroupContext = createContext(null);
|
|
27
28
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
28
29
|
|
|
29
|
-
const useIsomorphicLayoutEffect =
|
|
30
|
+
const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
|
|
30
31
|
|
|
31
32
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
32
33
|
let counter = 0;
|
|
@@ -2180,7 +2181,7 @@ function PanelResizeHandle({
|
|
|
2180
2181
|
const committedValuesRef = useRef({
|
|
2181
2182
|
state
|
|
2182
2183
|
});
|
|
2183
|
-
|
|
2184
|
+
useIsomorphicLayoutEffect(() => {
|
|
2184
2185
|
committedValuesRef.current.state = state;
|
|
2185
2186
|
});
|
|
2186
2187
|
useEffect(() => {
|
|
@@ -22,11 +22,12 @@ const {
|
|
|
22
22
|
|
|
23
23
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
24
24
|
const useId = React["useId".toString()];
|
|
25
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
25
26
|
|
|
26
27
|
const PanelGroupContext = createContext(null);
|
|
27
28
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
28
29
|
|
|
29
|
-
const useIsomorphicLayoutEffect =
|
|
30
|
+
const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
|
|
30
31
|
|
|
31
32
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
32
33
|
let counter = 0;
|
|
@@ -2074,7 +2075,7 @@ function PanelResizeHandle({
|
|
|
2074
2075
|
const committedValuesRef = useRef({
|
|
2075
2076
|
state
|
|
2076
2077
|
});
|
|
2077
|
-
|
|
2078
|
+
useIsomorphicLayoutEffect(() => {
|
|
2078
2079
|
committedValuesRef.current.state = state;
|
|
2079
2080
|
});
|
|
2080
2081
|
useEffect(() => {
|
|
@@ -48,11 +48,12 @@ const {
|
|
|
48
48
|
|
|
49
49
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
50
50
|
const useId = React__namespace["useId".toString()];
|
|
51
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
51
52
|
|
|
52
53
|
const PanelGroupContext = createContext(null);
|
|
53
54
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
54
55
|
|
|
55
|
-
const useIsomorphicLayoutEffect = isBrowser ?
|
|
56
|
+
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect_do_not_use_directly : () => {};
|
|
56
57
|
|
|
57
58
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
58
59
|
let counter = 0;
|
|
@@ -2100,7 +2101,7 @@ function PanelResizeHandle({
|
|
|
2100
2101
|
const committedValuesRef = useRef({
|
|
2101
2102
|
state
|
|
2102
2103
|
});
|
|
2103
|
-
|
|
2104
|
+
useIsomorphicLayoutEffect(() => {
|
|
2104
2105
|
committedValuesRef.current.state = state;
|
|
2105
2106
|
});
|
|
2106
2107
|
useEffect(() => {
|
|
@@ -48,11 +48,12 @@ const {
|
|
|
48
48
|
|
|
49
49
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
50
50
|
const useId = React__namespace["useId".toString()];
|
|
51
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
51
52
|
|
|
52
53
|
const PanelGroupContext = createContext(null);
|
|
53
54
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
54
55
|
|
|
55
|
-
const useIsomorphicLayoutEffect = isBrowser ?
|
|
56
|
+
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect_do_not_use_directly : () => {};
|
|
56
57
|
|
|
57
58
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
58
59
|
let counter = 0;
|
|
@@ -2211,7 +2212,7 @@ function PanelResizeHandle({
|
|
|
2211
2212
|
const committedValuesRef = useRef({
|
|
2212
2213
|
state
|
|
2213
2214
|
});
|
|
2214
|
-
|
|
2215
|
+
useIsomorphicLayoutEffect(() => {
|
|
2215
2216
|
committedValuesRef.current.state = state;
|
|
2216
2217
|
});
|
|
2217
2218
|
useEffect(() => {
|
|
@@ -24,11 +24,12 @@ const {
|
|
|
24
24
|
|
|
25
25
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
26
26
|
const useId = React["useId".toString()];
|
|
27
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
27
28
|
|
|
28
29
|
const PanelGroupContext = createContext(null);
|
|
29
30
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
30
31
|
|
|
31
|
-
const useIsomorphicLayoutEffect = isBrowser ?
|
|
32
|
+
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect_do_not_use_directly : () => {};
|
|
32
33
|
|
|
33
34
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
34
35
|
let counter = 0;
|
|
@@ -2187,7 +2188,7 @@ function PanelResizeHandle({
|
|
|
2187
2188
|
const committedValuesRef = useRef({
|
|
2188
2189
|
state
|
|
2189
2190
|
});
|
|
2190
|
-
|
|
2191
|
+
useIsomorphicLayoutEffect(() => {
|
|
2191
2192
|
committedValuesRef.current.state = state;
|
|
2192
2193
|
});
|
|
2193
2194
|
useEffect(() => {
|
|
@@ -1980,9 +1980,6 @@ function PanelResizeHandle({
|
|
|
1980
1980
|
const committedValuesRef = useRef({
|
|
1981
1981
|
state
|
|
1982
1982
|
});
|
|
1983
|
-
useLayoutEffect(() => {
|
|
1984
|
-
committedValuesRef.current.state = state;
|
|
1985
|
-
});
|
|
1986
1983
|
useEffect(() => {
|
|
1987
1984
|
if (disabled) {
|
|
1988
1985
|
setResizeHandler(null);
|
|
@@ -1956,9 +1956,6 @@ function PanelResizeHandle({
|
|
|
1956
1956
|
const committedValuesRef = useRef({
|
|
1957
1957
|
state
|
|
1958
1958
|
});
|
|
1959
|
-
useLayoutEffect(() => {
|
|
1960
|
-
committedValuesRef.current.state = state;
|
|
1961
|
-
});
|
|
1962
1959
|
useEffect(() => {
|
|
1963
1960
|
if (disabled) {
|
|
1964
1961
|
setResizeHandler(null);
|
|
@@ -24,11 +24,12 @@ const {
|
|
|
24
24
|
|
|
25
25
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
26
26
|
const useId = React["useId".toString()];
|
|
27
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
27
28
|
|
|
28
29
|
const PanelGroupContext = createContext(null);
|
|
29
30
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
30
31
|
|
|
31
|
-
const useIsomorphicLayoutEffect = isBrowser ?
|
|
32
|
+
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect_do_not_use_directly : () => {};
|
|
32
33
|
|
|
33
34
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
34
35
|
let counter = 0;
|
|
@@ -2076,7 +2077,7 @@ function PanelResizeHandle({
|
|
|
2076
2077
|
const committedValuesRef = useRef({
|
|
2077
2078
|
state
|
|
2078
2079
|
});
|
|
2079
|
-
|
|
2080
|
+
useIsomorphicLayoutEffect(() => {
|
|
2080
2081
|
committedValuesRef.current.state = state;
|
|
2081
2082
|
});
|
|
2082
2083
|
useEffect(() => {
|
|
@@ -1879,9 +1879,6 @@ function PanelResizeHandle({
|
|
|
1879
1879
|
const committedValuesRef = useRef({
|
|
1880
1880
|
state
|
|
1881
1881
|
});
|
|
1882
|
-
useLayoutEffect(() => {
|
|
1883
|
-
committedValuesRef.current.state = state;
|
|
1884
|
-
});
|
|
1885
1882
|
useEffect(() => {
|
|
1886
1883
|
if (disabled) {
|
|
1887
1884
|
setResizeHandler(null);
|
|
@@ -1855,9 +1855,6 @@ function PanelResizeHandle({
|
|
|
1855
1855
|
const committedValuesRef = useRef({
|
|
1856
1856
|
state
|
|
1857
1857
|
});
|
|
1858
|
-
useLayoutEffect(() => {
|
|
1859
|
-
committedValuesRef.current.state = state;
|
|
1860
|
-
});
|
|
1861
1858
|
useEffect(() => {
|
|
1862
1859
|
if (disabled) {
|
|
1863
1860
|
setResizeHandler(null);
|
package/package.json
CHANGED
package/src/PanelResizeHandle.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ReactElement,
|
|
8
8
|
useContext,
|
|
9
9
|
useEffect,
|
|
10
|
-
useLayoutEffect,
|
|
11
10
|
useRef,
|
|
12
11
|
useState,
|
|
13
12
|
} from "./vendor/react";
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
ResizeHandlerAction,
|
|
25
24
|
} from "./PanelResizeHandleRegistry";
|
|
26
25
|
import { assert } from "./utils/assert";
|
|
26
|
+
import useIsomorphicLayoutEffect from "./hooks/useIsomorphicEffect";
|
|
27
27
|
|
|
28
28
|
export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
|
|
29
29
|
export type ResizeHandlerState = "drag" | "hover" | "inactive";
|
|
@@ -97,7 +97,7 @@ export function PanelResizeHandle({
|
|
|
97
97
|
state,
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
useIsomorphicLayoutEffect(() => {
|
|
101
101
|
committedValuesRef.current.state = state;
|
|
102
102
|
});
|
|
103
103
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isBrowser } from "#is-browser";
|
|
2
|
-
import {
|
|
2
|
+
import { useLayoutEffect_do_not_use_directly } from "../vendor/react";
|
|
3
3
|
|
|
4
|
-
const useIsomorphicLayoutEffect = isBrowser
|
|
4
|
+
const useIsomorphicLayoutEffect = isBrowser
|
|
5
|
+
? useLayoutEffect_do_not_use_directly
|
|
6
|
+
: () => {};
|
|
5
7
|
|
|
6
8
|
export default useIsomorphicLayoutEffect;
|
package/src/vendor/react.ts
CHANGED
|
@@ -39,6 +39,8 @@ const {
|
|
|
39
39
|
// `toString()` prevents bundlers from trying to `import { useId } from 'react'`
|
|
40
40
|
const useId = (React as any)["useId".toString()] as () => string;
|
|
41
41
|
|
|
42
|
+
const useLayoutEffect_do_not_use_directly = useLayoutEffect;
|
|
43
|
+
|
|
42
44
|
export {
|
|
43
45
|
createElement,
|
|
44
46
|
createContext,
|
|
@@ -49,7 +51,7 @@ export {
|
|
|
49
51
|
useEffect,
|
|
50
52
|
useId,
|
|
51
53
|
useImperativeHandle,
|
|
52
|
-
|
|
54
|
+
useLayoutEffect_do_not_use_directly,
|
|
53
55
|
useMemo,
|
|
54
56
|
useRef,
|
|
55
57
|
useState,
|