react-resizable-panels 2.1.6 → 2.1.7

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 (87) hide show
  1. package/dist/react-resizable-panels.browser.cjs.js +7 -7
  2. package/dist/react-resizable-panels.browser.development.cjs.js +7 -7
  3. package/dist/react-resizable-panels.browser.development.esm.js +7 -7
  4. package/dist/react-resizable-panels.browser.esm.js +7 -7
  5. package/dist/react-resizable-panels.cjs.js +7 -7
  6. package/dist/react-resizable-panels.development.cjs.js +7 -7
  7. package/dist/react-resizable-panels.development.esm.js +7 -7
  8. package/dist/react-resizable-panels.development.node.cjs.js +7 -7
  9. package/dist/react-resizable-panels.development.node.esm.js +7 -7
  10. package/dist/react-resizable-panels.esm.js +7 -7
  11. package/dist/react-resizable-panels.node.cjs.js +7 -7
  12. package/dist/react-resizable-panels.node.esm.js +7 -7
  13. package/package.json +7 -1
  14. package/.eslintrc.cjs +0 -27
  15. package/CHANGELOG.md +0 -574
  16. package/jest.config.js +0 -10
  17. package/src/Panel.test.tsx +0 -1084
  18. package/src/Panel.ts +0 -259
  19. package/src/PanelGroup.test.tsx +0 -443
  20. package/src/PanelGroup.ts +0 -999
  21. package/src/PanelGroupContext.ts +0 -42
  22. package/src/PanelResizeHandle.test.tsx +0 -367
  23. package/src/PanelResizeHandle.ts +0 -246
  24. package/src/PanelResizeHandleRegistry.ts +0 -336
  25. package/src/constants.ts +0 -1
  26. package/src/env-conditions/browser.ts +0 -1
  27. package/src/env-conditions/development.ts +0 -1
  28. package/src/env-conditions/node.ts +0 -1
  29. package/src/env-conditions/production.ts +0 -1
  30. package/src/env-conditions/unknown.ts +0 -1
  31. package/src/hooks/useForceUpdate.ts +0 -7
  32. package/src/hooks/useIsomorphicEffect.ts +0 -8
  33. package/src/hooks/useUniqueId.ts +0 -19
  34. package/src/hooks/useWindowSplitterBehavior.ts +0 -90
  35. package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +0 -201
  36. package/src/index.ts +0 -77
  37. package/src/types.ts +0 -5
  38. package/src/utils/adjustLayoutByDelta.test.ts +0 -2061
  39. package/src/utils/adjustLayoutByDelta.ts +0 -308
  40. package/src/utils/arrays.ts +0 -13
  41. package/src/utils/assert.ts +0 -10
  42. package/src/utils/calculateAriaValues.test.ts +0 -106
  43. package/src/utils/calculateAriaValues.ts +0 -45
  44. package/src/utils/calculateDeltaPercentage.ts +0 -63
  45. package/src/utils/calculateDragOffsetPercentage.ts +0 -40
  46. package/src/utils/calculateUnsafeDefaultLayout.test.ts +0 -87
  47. package/src/utils/calculateUnsafeDefaultLayout.ts +0 -50
  48. package/src/utils/callPanelCallbacks.ts +0 -49
  49. package/src/utils/compareLayouts.test.ts +0 -9
  50. package/src/utils/compareLayouts.ts +0 -12
  51. package/src/utils/computePanelFlexBoxStyle.test.ts +0 -123
  52. package/src/utils/computePanelFlexBoxStyle.ts +0 -50
  53. package/src/utils/csp.ts +0 -9
  54. package/src/utils/cursor.ts +0 -103
  55. package/src/utils/debounce.ts +0 -18
  56. package/src/utils/determinePivotIndices.ts +0 -15
  57. package/src/utils/dom/getPanelElement.ts +0 -10
  58. package/src/utils/dom/getPanelElementsForGroup.ts +0 -8
  59. package/src/utils/dom/getPanelGroupElement.ts +0 -21
  60. package/src/utils/dom/getResizeHandleElement.ts +0 -10
  61. package/src/utils/dom/getResizeHandleElementIndex.ts +0 -13
  62. package/src/utils/dom/getResizeHandleElementsForGroup.ts +0 -10
  63. package/src/utils/dom/getResizeHandlePanelIds.ts +0 -19
  64. package/src/utils/events/getResizeEventCoordinates.ts +0 -23
  65. package/src/utils/events/getResizeEventCursorPosition.ts +0 -14
  66. package/src/utils/events/index.ts +0 -13
  67. package/src/utils/getInputType.ts +0 -5
  68. package/src/utils/initializeDefaultStorage.ts +0 -26
  69. package/src/utils/numbers/fuzzyCompareNumbers.test.ts +0 -16
  70. package/src/utils/numbers/fuzzyCompareNumbers.ts +0 -21
  71. package/src/utils/numbers/fuzzyLayoutsEqual.ts +0 -22
  72. package/src/utils/numbers/fuzzyNumbersEqual.ts +0 -9
  73. package/src/utils/rects/getIntersectingRectangle.test.ts +0 -198
  74. package/src/utils/rects/getIntersectingRectangle.ts +0 -28
  75. package/src/utils/rects/intersects.test.ts +0 -197
  76. package/src/utils/rects/intersects.ts +0 -23
  77. package/src/utils/rects/types.ts +0 -6
  78. package/src/utils/resizePanel.test.ts +0 -59
  79. package/src/utils/resizePanel.ts +0 -47
  80. package/src/utils/serialization.ts +0 -87
  81. package/src/utils/test-utils.ts +0 -205
  82. package/src/utils/validatePanelConstraints.test.ts +0 -143
  83. package/src/utils/validatePanelConstraints.ts +0 -69
  84. package/src/utils/validatePanelGroupLayout.test.ts +0 -148
  85. package/src/utils/validatePanelGroupLayout.ts +0 -95
  86. package/src/vendor/react.ts +0 -73
  87. package/src/vendor/stacking-order.ts +0 -139
@@ -1,73 +0,0 @@
1
- // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
2
- // and limitations with ParcelJS parsing of the useId workaround (used below).
3
- // For the time being, all react-resizable-panels must import "react" with the "* as React" syntax.
4
- // To avoid mistakes, we use the ESLint "no-restricted-imports" to prevent "react" imports except in this file.
5
- // See https://github.com/bvaughn/react-resizable-panels/issues/118
6
-
7
- // eslint-disable-next-line no-restricted-imports
8
- import * as React from "react";
9
-
10
- // eslint-disable-next-line no-restricted-imports
11
- import type {
12
- CSSProperties,
13
- ElementType,
14
- ForwardedRef,
15
- HTMLAttributes,
16
- MouseEvent,
17
- PropsWithChildren,
18
- ReactElement,
19
- ReactNode,
20
- RefObject,
21
- TouchEvent,
22
- } from "react";
23
-
24
- const {
25
- createElement,
26
- createContext,
27
- createRef,
28
- forwardRef,
29
- useCallback,
30
- useContext,
31
- useEffect,
32
- useImperativeHandle,
33
- useLayoutEffect,
34
- useMemo,
35
- useRef,
36
- useState,
37
- } = React;
38
-
39
- // `Math.random()` and `.slice(0, 5)` prevents bundlers from trying to `import { useId } from 'react'`
40
- const useId = (React as any)[
41
- `useId${Math.random()}`.slice(0, 5)
42
- ] as () => string;
43
-
44
- const useLayoutEffect_do_not_use_directly = useLayoutEffect;
45
-
46
- export {
47
- createElement,
48
- createContext,
49
- createRef,
50
- forwardRef,
51
- useCallback,
52
- useContext,
53
- useEffect,
54
- useId,
55
- useImperativeHandle,
56
- useLayoutEffect_do_not_use_directly,
57
- useMemo,
58
- useRef,
59
- useState,
60
- };
61
-
62
- export type {
63
- CSSProperties,
64
- ElementType,
65
- ForwardedRef,
66
- HTMLAttributes,
67
- MouseEvent,
68
- PropsWithChildren,
69
- ReactElement,
70
- ReactNode,
71
- RefObject,
72
- TouchEvent,
73
- };
@@ -1,139 +0,0 @@
1
- // Forked from NPM stacking-order@2.0.0
2
- // Background at https://github.com/Rich-Harris/stacking-order/issues/3
3
- // Background at https://github.com/Rich-Harris/stacking-order/issues/6
4
-
5
- import { assert } from "..";
6
-
7
- /**
8
- * Determine which of two nodes appears in front of the other —
9
- * if `a` is in front, returns 1, otherwise returns -1
10
- * @param {HTMLElement} a
11
- * @param {HTMLElement} b
12
- */
13
- export function compare(a: HTMLElement, b: HTMLElement): number {
14
- if (a === b) throw new Error("Cannot compare node with itself");
15
-
16
- const ancestors = {
17
- a: get_ancestors(a),
18
- b: get_ancestors(b),
19
- };
20
-
21
- let common_ancestor;
22
-
23
- // remove shared ancestors
24
- while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
25
- a = ancestors.a.pop() as HTMLElement;
26
- b = ancestors.b.pop() as HTMLElement;
27
-
28
- common_ancestor = a;
29
- }
30
-
31
- assert(
32
- common_ancestor,
33
- "Stacking order can only be calculated for elements with a common ancestor"
34
- );
35
-
36
- const z_indexes = {
37
- a: get_z_index(find_stacking_context(ancestors.a)),
38
- b: get_z_index(find_stacking_context(ancestors.b)),
39
- };
40
-
41
- if (z_indexes.a === z_indexes.b) {
42
- const children = common_ancestor.childNodes;
43
-
44
- const furthest_ancestors = {
45
- a: ancestors.a.at(-1),
46
- b: ancestors.b.at(-1),
47
- };
48
-
49
- let i = children.length;
50
- while (i--) {
51
- const child = children[i];
52
- if (child === furthest_ancestors.a) return 1;
53
- if (child === furthest_ancestors.b) return -1;
54
- }
55
- }
56
-
57
- return Math.sign(z_indexes.a - z_indexes.b);
58
- }
59
-
60
- const props =
61
- /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
62
-
63
- /** @param {HTMLElement} node */
64
- function is_flex_item(node: HTMLElement) {
65
- // @ts-ignore
66
- const display = getComputedStyle(get_parent(node) ?? node).display;
67
- return display === "flex" || display === "inline-flex";
68
- }
69
-
70
- /** @param {HTMLElement} node */
71
- function creates_stacking_context(node: HTMLElement) {
72
- const style = getComputedStyle(node);
73
-
74
- // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
75
- if (style.position === "fixed") return true;
76
- // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
77
- // if (
78
- // (style.zIndex !== "auto" && style.position !== "static") ||
79
- // is_flex_item(node)
80
- // )
81
- if (
82
- style.zIndex !== "auto" &&
83
- (style.position !== "static" || is_flex_item(node))
84
- )
85
- return true;
86
- if (+style.opacity < 1) return true;
87
- if ("transform" in style && style.transform !== "none") return true;
88
- if ("webkitTransform" in style && style.webkitTransform !== "none")
89
- return true;
90
- if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
91
- if ("filter" in style && style.filter !== "none") return true;
92
- if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
93
- if ("isolation" in style && style.isolation === "isolate") return true;
94
- if (props.test(style.willChange)) return true;
95
- // @ts-expect-error
96
- if (style.webkitOverflowScrolling === "touch") return true;
97
-
98
- return false;
99
- }
100
-
101
- /** @param {HTMLElement[]} nodes */
102
- function find_stacking_context(nodes: HTMLElement[]) {
103
- let i = nodes.length;
104
-
105
- while (i--) {
106
- const node = nodes[i];
107
- assert(node, "Missing node");
108
- if (creates_stacking_context(node)) return node;
109
- }
110
-
111
- return null;
112
- }
113
-
114
- /** @param {HTMLElement} node */
115
- function get_z_index(node: HTMLElement | null) {
116
- return (node && Number(getComputedStyle(node).zIndex)) || 0;
117
- }
118
-
119
- /** @param {HTMLElement} node */
120
- function get_ancestors(node: HTMLElement | null) {
121
- const ancestors = [];
122
-
123
- while (node) {
124
- ancestors.push(node);
125
- // @ts-ignore
126
- node = get_parent(node);
127
- }
128
-
129
- return ancestors; // [ node, ... <body>, <html>, document ]
130
- }
131
-
132
- /** @param {HTMLElement} node */
133
- function get_parent(node: HTMLElement) {
134
- const { parentNode } = node;
135
- if (parentNode && parentNode instanceof ShadowRoot) {
136
- return parentNode.host
137
- }
138
- return parentNode;
139
- }