react-resizable-panels 2.1.5 → 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 (89) hide show
  1. package/dist/declarations/src/PanelGroup.d.ts +2 -0
  2. package/dist/react-resizable-panels.browser.cjs.js +16 -10
  3. package/dist/react-resizable-panels.browser.development.cjs.js +16 -10
  4. package/dist/react-resizable-panels.browser.development.esm.js +16 -10
  5. package/dist/react-resizable-panels.browser.esm.js +16 -10
  6. package/dist/react-resizable-panels.cjs.js +16 -10
  7. package/dist/react-resizable-panels.development.cjs.js +16 -10
  8. package/dist/react-resizable-panels.development.esm.js +16 -10
  9. package/dist/react-resizable-panels.development.node.cjs.js +16 -10
  10. package/dist/react-resizable-panels.development.node.esm.js +16 -10
  11. package/dist/react-resizable-panels.esm.js +16 -10
  12. package/dist/react-resizable-panels.node.cjs.js +16 -10
  13. package/dist/react-resizable-panels.node.esm.js +16 -10
  14. package/package.json +7 -1
  15. package/.eslintrc.cjs +0 -27
  16. package/CHANGELOG.md +0 -569
  17. package/jest.config.js +0 -10
  18. package/react-resizable-panels-2.1.5.tgz +0 -0
  19. package/src/Panel.test.tsx +0 -1084
  20. package/src/Panel.ts +0 -259
  21. package/src/PanelGroup.test.tsx +0 -443
  22. package/src/PanelGroup.ts +0 -985
  23. package/src/PanelGroupContext.ts +0 -42
  24. package/src/PanelResizeHandle.test.tsx +0 -367
  25. package/src/PanelResizeHandle.ts +0 -246
  26. package/src/PanelResizeHandleRegistry.ts +0 -336
  27. package/src/constants.ts +0 -1
  28. package/src/env-conditions/browser.ts +0 -1
  29. package/src/env-conditions/development.ts +0 -1
  30. package/src/env-conditions/node.ts +0 -1
  31. package/src/env-conditions/production.ts +0 -1
  32. package/src/env-conditions/unknown.ts +0 -1
  33. package/src/hooks/useForceUpdate.ts +0 -7
  34. package/src/hooks/useIsomorphicEffect.ts +0 -8
  35. package/src/hooks/useUniqueId.ts +0 -19
  36. package/src/hooks/useWindowSplitterBehavior.ts +0 -90
  37. package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +0 -201
  38. package/src/index.ts +0 -77
  39. package/src/types.ts +0 -5
  40. package/src/utils/adjustLayoutByDelta.test.ts +0 -2061
  41. package/src/utils/adjustLayoutByDelta.ts +0 -308
  42. package/src/utils/arrays.ts +0 -13
  43. package/src/utils/assert.ts +0 -10
  44. package/src/utils/calculateAriaValues.test.ts +0 -106
  45. package/src/utils/calculateAriaValues.ts +0 -45
  46. package/src/utils/calculateDeltaPercentage.ts +0 -63
  47. package/src/utils/calculateDragOffsetPercentage.ts +0 -40
  48. package/src/utils/calculateUnsafeDefaultLayout.test.ts +0 -87
  49. package/src/utils/calculateUnsafeDefaultLayout.ts +0 -50
  50. package/src/utils/callPanelCallbacks.ts +0 -49
  51. package/src/utils/compareLayouts.test.ts +0 -9
  52. package/src/utils/compareLayouts.ts +0 -12
  53. package/src/utils/computePanelFlexBoxStyle.test.ts +0 -123
  54. package/src/utils/computePanelFlexBoxStyle.ts +0 -50
  55. package/src/utils/csp.ts +0 -9
  56. package/src/utils/cursor.ts +0 -103
  57. package/src/utils/debounce.ts +0 -18
  58. package/src/utils/determinePivotIndices.ts +0 -15
  59. package/src/utils/dom/getPanelElement.ts +0 -10
  60. package/src/utils/dom/getPanelElementsForGroup.ts +0 -8
  61. package/src/utils/dom/getPanelGroupElement.ts +0 -21
  62. package/src/utils/dom/getResizeHandleElement.ts +0 -10
  63. package/src/utils/dom/getResizeHandleElementIndex.ts +0 -13
  64. package/src/utils/dom/getResizeHandleElementsForGroup.ts +0 -10
  65. package/src/utils/dom/getResizeHandlePanelIds.ts +0 -19
  66. package/src/utils/events/getResizeEventCoordinates.ts +0 -23
  67. package/src/utils/events/getResizeEventCursorPosition.ts +0 -14
  68. package/src/utils/events/index.ts +0 -13
  69. package/src/utils/getInputType.ts +0 -5
  70. package/src/utils/initializeDefaultStorage.ts +0 -26
  71. package/src/utils/numbers/fuzzyCompareNumbers.test.ts +0 -16
  72. package/src/utils/numbers/fuzzyCompareNumbers.ts +0 -21
  73. package/src/utils/numbers/fuzzyLayoutsEqual.ts +0 -22
  74. package/src/utils/numbers/fuzzyNumbersEqual.ts +0 -9
  75. package/src/utils/rects/getIntersectingRectangle.test.ts +0 -198
  76. package/src/utils/rects/getIntersectingRectangle.ts +0 -28
  77. package/src/utils/rects/intersects.test.ts +0 -197
  78. package/src/utils/rects/intersects.ts +0 -23
  79. package/src/utils/rects/types.ts +0 -6
  80. package/src/utils/resizePanel.test.ts +0 -59
  81. package/src/utils/resizePanel.ts +0 -47
  82. package/src/utils/serialization.ts +0 -87
  83. package/src/utils/test-utils.ts +0 -205
  84. package/src/utils/validatePanelConstraints.test.ts +0 -143
  85. package/src/utils/validatePanelConstraints.ts +0 -69
  86. package/src/utils/validatePanelGroupLayout.test.ts +0 -148
  87. package/src/utils/validatePanelGroupLayout.ts +0 -95
  88. package/src/vendor/react.ts +0 -73
  89. package/src/vendor/stacking-order.ts +0 -139
@@ -20,6 +20,7 @@ export type PanelGroupProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>,
20
20
  storage?: PanelGroupStorage;
21
21
  style?: CSSProperties;
22
22
  tagName?: keyof HTMLElementTagNameMap;
23
+ dir?: "auto" | "ltr" | "rtl" | undefined;
23
24
  }>;
24
25
  export declare const PanelGroup: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id"> & {
25
26
  autoSaveId?: string | null | undefined;
@@ -31,6 +32,7 @@ export declare const PanelGroup: import("react").ForwardRefExoticComponent<Omit<
31
32
  storage?: PanelGroupStorage | undefined;
32
33
  style?: CSSProperties | undefined;
33
34
  tagName?: keyof HTMLElementTagNameMap | undefined;
35
+ dir?: "auto" | "ltr" | "rtl" | undefined;
34
36
  } & {
35
37
  children?: import("react").ReactNode;
36
38
  } & import("react").RefAttributes<ImperativePanelGroupHandle>>;
@@ -331,8 +331,8 @@ function intersects(rectOne, rectTwo, strict) {
331
331
  /**
332
332
  * Determine which of two nodes appears in front of the other —
333
333
  * if `a` is in front, returns 1, otherwise returns -1
334
- * @param {HTMLElement} a
335
- * @param {HTMLElement} b
334
+ * @param {HTMLElement | SVGElement} a
335
+ * @param {HTMLElement | SVGElement} b
336
336
  */
337
337
  function compare(a, b) {
338
338
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -370,7 +370,7 @@ function compare(a, b) {
370
370
  }
371
371
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
372
372
 
373
- /** @param {HTMLElement} node */
373
+ /** @param {HTMLElement | SVGElement} node */
374
374
  function is_flex_item(node) {
375
375
  var _get_parent;
376
376
  // @ts-ignore
@@ -378,7 +378,7 @@ function is_flex_item(node) {
378
378
  return display === "flex" || display === "inline-flex";
379
379
  }
380
380
 
381
- /** @param {HTMLElement} node */
381
+ /** @param {HTMLElement | SVGElement} node */
382
382
  function creates_stacking_context(node) {
383
383
  const style = getComputedStyle(node);
384
384
 
@@ -403,7 +403,7 @@ function creates_stacking_context(node) {
403
403
  return false;
404
404
  }
405
405
 
406
- /** @param {HTMLElement[]} nodes */
406
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
407
407
  function find_stacking_context(nodes) {
408
408
  let i = nodes.length;
409
409
  while (i--) {
@@ -414,7 +414,7 @@ function find_stacking_context(nodes) {
414
414
  return null;
415
415
  }
416
416
 
417
- /** @param {HTMLElement} node */
417
+ /** @param {HTMLElement | SVGElement} node */
418
418
  function get_z_index(node) {
419
419
  return node && Number(getComputedStyle(node).zIndex) || 0;
420
420
  }
@@ -576,7 +576,7 @@ function recalculateIntersectingHandles({
576
576
  }) {
577
577
  intersectingHandles.splice(0);
578
578
  let targetElement = null;
579
- if (target instanceof HTMLElement) {
579
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
580
580
  targetElement = target;
581
581
  }
582
582
  registeredResizeHandlers.forEach(data => {
@@ -1949,6 +1949,14 @@ function PanelGroupWithForwardedRef({
1949
1949
  };
1950
1950
  }, []);
1951
1951
  const registerResizeHandle = useCallback(dragHandleId => {
1952
+ let isRTL = false;
1953
+ const panelGroupElement = panelGroupElementRef.current;
1954
+ if (panelGroupElement) {
1955
+ const style = window.getComputedStyle(panelGroupElement, null);
1956
+ if (style.getPropertyValue("direction") === "rtl") {
1957
+ isRTL = true;
1958
+ }
1959
+ }
1952
1960
  return function resizeHandler(event) {
1953
1961
  event.preventDefault();
1954
1962
  const panelGroupElement = panelGroupElementRef.current;
@@ -1971,10 +1979,8 @@ function PanelGroupWithForwardedRef({
1971
1979
  } = dragState !== null && dragState !== void 0 ? dragState : {};
1972
1980
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
1973
1981
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
1974
-
1975
- // Support RTL layouts
1976
1982
  const isHorizontal = direction === "horizontal";
1977
- if (document.dir === "rtl" && isHorizontal) {
1983
+ if (isHorizontal && isRTL) {
1978
1984
  delta = -delta;
1979
1985
  }
1980
1986
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -337,8 +337,8 @@ function intersects(rectOne, rectTwo, strict) {
337
337
  /**
338
338
  * Determine which of two nodes appears in front of the other —
339
339
  * if `a` is in front, returns 1, otherwise returns -1
340
- * @param {HTMLElement} a
341
- * @param {HTMLElement} b
340
+ * @param {HTMLElement | SVGElement} a
341
+ * @param {HTMLElement | SVGElement} b
342
342
  */
343
343
  function compare(a, b) {
344
344
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -376,7 +376,7 @@ function compare(a, b) {
376
376
  }
377
377
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
378
378
 
379
- /** @param {HTMLElement} node */
379
+ /** @param {HTMLElement | SVGElement} node */
380
380
  function is_flex_item(node) {
381
381
  var _get_parent;
382
382
  // @ts-ignore
@@ -384,7 +384,7 @@ function is_flex_item(node) {
384
384
  return display === "flex" || display === "inline-flex";
385
385
  }
386
386
 
387
- /** @param {HTMLElement} node */
387
+ /** @param {HTMLElement | SVGElement} node */
388
388
  function creates_stacking_context(node) {
389
389
  const style = getComputedStyle(node);
390
390
 
@@ -409,7 +409,7 @@ function creates_stacking_context(node) {
409
409
  return false;
410
410
  }
411
411
 
412
- /** @param {HTMLElement[]} nodes */
412
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
413
413
  function find_stacking_context(nodes) {
414
414
  let i = nodes.length;
415
415
  while (i--) {
@@ -420,7 +420,7 @@ function find_stacking_context(nodes) {
420
420
  return null;
421
421
  }
422
422
 
423
- /** @param {HTMLElement} node */
423
+ /** @param {HTMLElement | SVGElement} node */
424
424
  function get_z_index(node) {
425
425
  return node && Number(getComputedStyle(node).zIndex) || 0;
426
426
  }
@@ -582,7 +582,7 @@ function recalculateIntersectingHandles({
582
582
  }) {
583
583
  intersectingHandles.splice(0);
584
584
  let targetElement = null;
585
- if (target instanceof HTMLElement) {
585
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
586
586
  targetElement = target;
587
587
  }
588
588
  registeredResizeHandlers.forEach(data => {
@@ -2055,6 +2055,14 @@ function PanelGroupWithForwardedRef({
2055
2055
  };
2056
2056
  }, []);
2057
2057
  const registerResizeHandle = useCallback(dragHandleId => {
2058
+ let isRTL = false;
2059
+ const panelGroupElement = panelGroupElementRef.current;
2060
+ if (panelGroupElement) {
2061
+ const style = window.getComputedStyle(panelGroupElement, null);
2062
+ if (style.getPropertyValue("direction") === "rtl") {
2063
+ isRTL = true;
2064
+ }
2065
+ }
2058
2066
  return function resizeHandler(event) {
2059
2067
  event.preventDefault();
2060
2068
  const panelGroupElement = panelGroupElementRef.current;
@@ -2077,10 +2085,8 @@ function PanelGroupWithForwardedRef({
2077
2085
  } = dragState !== null && dragState !== void 0 ? dragState : {};
2078
2086
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
2079
2087
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
2080
-
2081
- // Support RTL layouts
2082
2088
  const isHorizontal = direction === "horizontal";
2083
- if (document.dir === "rtl" && isHorizontal) {
2089
+ if (isHorizontal && isRTL) {
2084
2090
  delta = -delta;
2085
2091
  }
2086
2092
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -313,8 +313,8 @@ function intersects(rectOne, rectTwo, strict) {
313
313
  /**
314
314
  * Determine which of two nodes appears in front of the other —
315
315
  * if `a` is in front, returns 1, otherwise returns -1
316
- * @param {HTMLElement} a
317
- * @param {HTMLElement} b
316
+ * @param {HTMLElement | SVGElement} a
317
+ * @param {HTMLElement | SVGElement} b
318
318
  */
319
319
  function compare(a, b) {
320
320
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -352,7 +352,7 @@ function compare(a, b) {
352
352
  }
353
353
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
354
354
 
355
- /** @param {HTMLElement} node */
355
+ /** @param {HTMLElement | SVGElement} node */
356
356
  function is_flex_item(node) {
357
357
  var _get_parent;
358
358
  // @ts-ignore
@@ -360,7 +360,7 @@ function is_flex_item(node) {
360
360
  return display === "flex" || display === "inline-flex";
361
361
  }
362
362
 
363
- /** @param {HTMLElement} node */
363
+ /** @param {HTMLElement | SVGElement} node */
364
364
  function creates_stacking_context(node) {
365
365
  const style = getComputedStyle(node);
366
366
 
@@ -385,7 +385,7 @@ function creates_stacking_context(node) {
385
385
  return false;
386
386
  }
387
387
 
388
- /** @param {HTMLElement[]} nodes */
388
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
389
389
  function find_stacking_context(nodes) {
390
390
  let i = nodes.length;
391
391
  while (i--) {
@@ -396,7 +396,7 @@ function find_stacking_context(nodes) {
396
396
  return null;
397
397
  }
398
398
 
399
- /** @param {HTMLElement} node */
399
+ /** @param {HTMLElement | SVGElement} node */
400
400
  function get_z_index(node) {
401
401
  return node && Number(getComputedStyle(node).zIndex) || 0;
402
402
  }
@@ -558,7 +558,7 @@ function recalculateIntersectingHandles({
558
558
  }) {
559
559
  intersectingHandles.splice(0);
560
560
  let targetElement = null;
561
- if (target instanceof HTMLElement) {
561
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
562
562
  targetElement = target;
563
563
  }
564
564
  registeredResizeHandlers.forEach(data => {
@@ -2031,6 +2031,14 @@ function PanelGroupWithForwardedRef({
2031
2031
  };
2032
2032
  }, []);
2033
2033
  const registerResizeHandle = useCallback(dragHandleId => {
2034
+ let isRTL = false;
2035
+ const panelGroupElement = panelGroupElementRef.current;
2036
+ if (panelGroupElement) {
2037
+ const style = window.getComputedStyle(panelGroupElement, null);
2038
+ if (style.getPropertyValue("direction") === "rtl") {
2039
+ isRTL = true;
2040
+ }
2041
+ }
2034
2042
  return function resizeHandler(event) {
2035
2043
  event.preventDefault();
2036
2044
  const panelGroupElement = panelGroupElementRef.current;
@@ -2053,10 +2061,8 @@ function PanelGroupWithForwardedRef({
2053
2061
  } = dragState !== null && dragState !== void 0 ? dragState : {};
2054
2062
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
2055
2063
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
2056
-
2057
- // Support RTL layouts
2058
2064
  const isHorizontal = direction === "horizontal";
2059
- if (document.dir === "rtl" && isHorizontal) {
2065
+ if (isHorizontal && isRTL) {
2060
2066
  delta = -delta;
2061
2067
  }
2062
2068
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -307,8 +307,8 @@ function intersects(rectOne, rectTwo, strict) {
307
307
  /**
308
308
  * Determine which of two nodes appears in front of the other —
309
309
  * if `a` is in front, returns 1, otherwise returns -1
310
- * @param {HTMLElement} a
311
- * @param {HTMLElement} b
310
+ * @param {HTMLElement | SVGElement} a
311
+ * @param {HTMLElement | SVGElement} b
312
312
  */
313
313
  function compare(a, b) {
314
314
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -346,7 +346,7 @@ function compare(a, b) {
346
346
  }
347
347
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
348
348
 
349
- /** @param {HTMLElement} node */
349
+ /** @param {HTMLElement | SVGElement} node */
350
350
  function is_flex_item(node) {
351
351
  var _get_parent;
352
352
  // @ts-ignore
@@ -354,7 +354,7 @@ function is_flex_item(node) {
354
354
  return display === "flex" || display === "inline-flex";
355
355
  }
356
356
 
357
- /** @param {HTMLElement} node */
357
+ /** @param {HTMLElement | SVGElement} node */
358
358
  function creates_stacking_context(node) {
359
359
  const style = getComputedStyle(node);
360
360
 
@@ -379,7 +379,7 @@ function creates_stacking_context(node) {
379
379
  return false;
380
380
  }
381
381
 
382
- /** @param {HTMLElement[]} nodes */
382
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
383
383
  function find_stacking_context(nodes) {
384
384
  let i = nodes.length;
385
385
  while (i--) {
@@ -390,7 +390,7 @@ function find_stacking_context(nodes) {
390
390
  return null;
391
391
  }
392
392
 
393
- /** @param {HTMLElement} node */
393
+ /** @param {HTMLElement | SVGElement} node */
394
394
  function get_z_index(node) {
395
395
  return node && Number(getComputedStyle(node).zIndex) || 0;
396
396
  }
@@ -552,7 +552,7 @@ function recalculateIntersectingHandles({
552
552
  }) {
553
553
  intersectingHandles.splice(0);
554
554
  let targetElement = null;
555
- if (target instanceof HTMLElement) {
555
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
556
556
  targetElement = target;
557
557
  }
558
558
  registeredResizeHandlers.forEach(data => {
@@ -1925,6 +1925,14 @@ function PanelGroupWithForwardedRef({
1925
1925
  };
1926
1926
  }, []);
1927
1927
  const registerResizeHandle = useCallback(dragHandleId => {
1928
+ let isRTL = false;
1929
+ const panelGroupElement = panelGroupElementRef.current;
1930
+ if (panelGroupElement) {
1931
+ const style = window.getComputedStyle(panelGroupElement, null);
1932
+ if (style.getPropertyValue("direction") === "rtl") {
1933
+ isRTL = true;
1934
+ }
1935
+ }
1928
1936
  return function resizeHandler(event) {
1929
1937
  event.preventDefault();
1930
1938
  const panelGroupElement = panelGroupElementRef.current;
@@ -1947,10 +1955,8 @@ function PanelGroupWithForwardedRef({
1947
1955
  } = dragState !== null && dragState !== void 0 ? dragState : {};
1948
1956
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
1949
1957
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
1950
-
1951
- // Support RTL layouts
1952
1958
  const isHorizontal = direction === "horizontal";
1953
- if (document.dir === "rtl" && isHorizontal) {
1959
+ if (isHorizontal && isRTL) {
1954
1960
  delta = -delta;
1955
1961
  }
1956
1962
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -333,8 +333,8 @@ function intersects(rectOne, rectTwo, strict) {
333
333
  /**
334
334
  * Determine which of two nodes appears in front of the other —
335
335
  * if `a` is in front, returns 1, otherwise returns -1
336
- * @param {HTMLElement} a
337
- * @param {HTMLElement} b
336
+ * @param {HTMLElement | SVGElement} a
337
+ * @param {HTMLElement | SVGElement} b
338
338
  */
339
339
  function compare(a, b) {
340
340
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -372,7 +372,7 @@ function compare(a, b) {
372
372
  }
373
373
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
374
374
 
375
- /** @param {HTMLElement} node */
375
+ /** @param {HTMLElement | SVGElement} node */
376
376
  function is_flex_item(node) {
377
377
  var _get_parent;
378
378
  // @ts-ignore
@@ -380,7 +380,7 @@ function is_flex_item(node) {
380
380
  return display === "flex" || display === "inline-flex";
381
381
  }
382
382
 
383
- /** @param {HTMLElement} node */
383
+ /** @param {HTMLElement | SVGElement} node */
384
384
  function creates_stacking_context(node) {
385
385
  const style = getComputedStyle(node);
386
386
 
@@ -405,7 +405,7 @@ function creates_stacking_context(node) {
405
405
  return false;
406
406
  }
407
407
 
408
- /** @param {HTMLElement[]} nodes */
408
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
409
409
  function find_stacking_context(nodes) {
410
410
  let i = nodes.length;
411
411
  while (i--) {
@@ -416,7 +416,7 @@ function find_stacking_context(nodes) {
416
416
  return null;
417
417
  }
418
418
 
419
- /** @param {HTMLElement} node */
419
+ /** @param {HTMLElement | SVGElement} node */
420
420
  function get_z_index(node) {
421
421
  return node && Number(getComputedStyle(node).zIndex) || 0;
422
422
  }
@@ -578,7 +578,7 @@ function recalculateIntersectingHandles({
578
578
  }) {
579
579
  intersectingHandles.splice(0);
580
580
  let targetElement = null;
581
- if (target instanceof HTMLElement) {
581
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
582
582
  targetElement = target;
583
583
  }
584
584
  registeredResizeHandlers.forEach(data => {
@@ -1951,6 +1951,14 @@ function PanelGroupWithForwardedRef({
1951
1951
  };
1952
1952
  }, []);
1953
1953
  const registerResizeHandle = useCallback(dragHandleId => {
1954
+ let isRTL = false;
1955
+ const panelGroupElement = panelGroupElementRef.current;
1956
+ if (panelGroupElement) {
1957
+ const style = window.getComputedStyle(panelGroupElement, null);
1958
+ if (style.getPropertyValue("direction") === "rtl") {
1959
+ isRTL = true;
1960
+ }
1961
+ }
1954
1962
  return function resizeHandler(event) {
1955
1963
  event.preventDefault();
1956
1964
  const panelGroupElement = panelGroupElementRef.current;
@@ -1973,10 +1981,8 @@ function PanelGroupWithForwardedRef({
1973
1981
  } = dragState !== null && dragState !== void 0 ? dragState : {};
1974
1982
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
1975
1983
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
1976
-
1977
- // Support RTL layouts
1978
1984
  const isHorizontal = direction === "horizontal";
1979
- if (document.dir === "rtl" && isHorizontal) {
1985
+ if (isHorizontal && isRTL) {
1980
1986
  delta = -delta;
1981
1987
  }
1982
1988
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -344,8 +344,8 @@ function intersects(rectOne, rectTwo, strict) {
344
344
  /**
345
345
  * Determine which of two nodes appears in front of the other —
346
346
  * if `a` is in front, returns 1, otherwise returns -1
347
- * @param {HTMLElement} a
348
- * @param {HTMLElement} b
347
+ * @param {HTMLElement | SVGElement} a
348
+ * @param {HTMLElement | SVGElement} b
349
349
  */
350
350
  function compare(a, b) {
351
351
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -383,7 +383,7 @@ function compare(a, b) {
383
383
  }
384
384
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
385
385
 
386
- /** @param {HTMLElement} node */
386
+ /** @param {HTMLElement | SVGElement} node */
387
387
  function is_flex_item(node) {
388
388
  var _get_parent;
389
389
  // @ts-ignore
@@ -391,7 +391,7 @@ function is_flex_item(node) {
391
391
  return display === "flex" || display === "inline-flex";
392
392
  }
393
393
 
394
- /** @param {HTMLElement} node */
394
+ /** @param {HTMLElement | SVGElement} node */
395
395
  function creates_stacking_context(node) {
396
396
  const style = getComputedStyle(node);
397
397
 
@@ -416,7 +416,7 @@ function creates_stacking_context(node) {
416
416
  return false;
417
417
  }
418
418
 
419
- /** @param {HTMLElement[]} nodes */
419
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
420
420
  function find_stacking_context(nodes) {
421
421
  let i = nodes.length;
422
422
  while (i--) {
@@ -427,7 +427,7 @@ function find_stacking_context(nodes) {
427
427
  return null;
428
428
  }
429
429
 
430
- /** @param {HTMLElement} node */
430
+ /** @param {HTMLElement | SVGElement} node */
431
431
  function get_z_index(node) {
432
432
  return node && Number(getComputedStyle(node).zIndex) || 0;
433
433
  }
@@ -589,7 +589,7 @@ function recalculateIntersectingHandles({
589
589
  }) {
590
590
  intersectingHandles.splice(0);
591
591
  let targetElement = null;
592
- if (target instanceof HTMLElement) {
592
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
593
593
  targetElement = target;
594
594
  }
595
595
  registeredResizeHandlers.forEach(data => {
@@ -2062,6 +2062,14 @@ function PanelGroupWithForwardedRef({
2062
2062
  };
2063
2063
  }, []);
2064
2064
  const registerResizeHandle = useCallback(dragHandleId => {
2065
+ let isRTL = false;
2066
+ const panelGroupElement = panelGroupElementRef.current;
2067
+ if (panelGroupElement) {
2068
+ const style = window.getComputedStyle(panelGroupElement, null);
2069
+ if (style.getPropertyValue("direction") === "rtl") {
2070
+ isRTL = true;
2071
+ }
2072
+ }
2065
2073
  return function resizeHandler(event) {
2066
2074
  event.preventDefault();
2067
2075
  const panelGroupElement = panelGroupElementRef.current;
@@ -2084,10 +2092,8 @@ function PanelGroupWithForwardedRef({
2084
2092
  } = dragState !== null && dragState !== void 0 ? dragState : {};
2085
2093
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
2086
2094
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
2087
-
2088
- // Support RTL layouts
2089
2095
  const isHorizontal = direction === "horizontal";
2090
- if (document.dir === "rtl" && isHorizontal) {
2096
+ if (isHorizontal && isRTL) {
2091
2097
  delta = -delta;
2092
2098
  }
2093
2099
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -320,8 +320,8 @@ function intersects(rectOne, rectTwo, strict) {
320
320
  /**
321
321
  * Determine which of two nodes appears in front of the other —
322
322
  * if `a` is in front, returns 1, otherwise returns -1
323
- * @param {HTMLElement} a
324
- * @param {HTMLElement} b
323
+ * @param {HTMLElement | SVGElement} a
324
+ * @param {HTMLElement | SVGElement} b
325
325
  */
326
326
  function compare(a, b) {
327
327
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -359,7 +359,7 @@ function compare(a, b) {
359
359
  }
360
360
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
361
361
 
362
- /** @param {HTMLElement} node */
362
+ /** @param {HTMLElement | SVGElement} node */
363
363
  function is_flex_item(node) {
364
364
  var _get_parent;
365
365
  // @ts-ignore
@@ -367,7 +367,7 @@ function is_flex_item(node) {
367
367
  return display === "flex" || display === "inline-flex";
368
368
  }
369
369
 
370
- /** @param {HTMLElement} node */
370
+ /** @param {HTMLElement | SVGElement} node */
371
371
  function creates_stacking_context(node) {
372
372
  const style = getComputedStyle(node);
373
373
 
@@ -392,7 +392,7 @@ function creates_stacking_context(node) {
392
392
  return false;
393
393
  }
394
394
 
395
- /** @param {HTMLElement[]} nodes */
395
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
396
396
  function find_stacking_context(nodes) {
397
397
  let i = nodes.length;
398
398
  while (i--) {
@@ -403,7 +403,7 @@ function find_stacking_context(nodes) {
403
403
  return null;
404
404
  }
405
405
 
406
- /** @param {HTMLElement} node */
406
+ /** @param {HTMLElement | SVGElement} node */
407
407
  function get_z_index(node) {
408
408
  return node && Number(getComputedStyle(node).zIndex) || 0;
409
409
  }
@@ -565,7 +565,7 @@ function recalculateIntersectingHandles({
565
565
  }) {
566
566
  intersectingHandles.splice(0);
567
567
  let targetElement = null;
568
- if (target instanceof HTMLElement) {
568
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
569
569
  targetElement = target;
570
570
  }
571
571
  registeredResizeHandlers.forEach(data => {
@@ -2038,6 +2038,14 @@ function PanelGroupWithForwardedRef({
2038
2038
  };
2039
2039
  }, []);
2040
2040
  const registerResizeHandle = useCallback(dragHandleId => {
2041
+ let isRTL = false;
2042
+ const panelGroupElement = panelGroupElementRef.current;
2043
+ if (panelGroupElement) {
2044
+ const style = window.getComputedStyle(panelGroupElement, null);
2045
+ if (style.getPropertyValue("direction") === "rtl") {
2046
+ isRTL = true;
2047
+ }
2048
+ }
2041
2049
  return function resizeHandler(event) {
2042
2050
  event.preventDefault();
2043
2051
  const panelGroupElement = panelGroupElementRef.current;
@@ -2060,10 +2068,8 @@ function PanelGroupWithForwardedRef({
2060
2068
  } = dragState !== null && dragState !== void 0 ? dragState : {};
2061
2069
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
2062
2070
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
2063
-
2064
- // Support RTL layouts
2065
2071
  const isHorizontal = direction === "horizontal";
2066
- if (document.dir === "rtl" && isHorizontal) {
2072
+ if (isHorizontal && isRTL) {
2067
2073
  delta = -delta;
2068
2074
  }
2069
2075
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
@@ -306,8 +306,8 @@ function intersects(rectOne, rectTwo, strict) {
306
306
  /**
307
307
  * Determine which of two nodes appears in front of the other —
308
308
  * if `a` is in front, returns 1, otherwise returns -1
309
- * @param {HTMLElement} a
310
- * @param {HTMLElement} b
309
+ * @param {HTMLElement | SVGElement} a
310
+ * @param {HTMLElement | SVGElement} b
311
311
  */
312
312
  function compare(a, b) {
313
313
  if (a === b) throw new Error("Cannot compare node with itself");
@@ -345,7 +345,7 @@ function compare(a, b) {
345
345
  }
346
346
  const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
347
347
 
348
- /** @param {HTMLElement} node */
348
+ /** @param {HTMLElement | SVGElement} node */
349
349
  function is_flex_item(node) {
350
350
  var _get_parent;
351
351
  // @ts-ignore
@@ -353,7 +353,7 @@ function is_flex_item(node) {
353
353
  return display === "flex" || display === "inline-flex";
354
354
  }
355
355
 
356
- /** @param {HTMLElement} node */
356
+ /** @param {HTMLElement | SVGElement} node */
357
357
  function creates_stacking_context(node) {
358
358
  const style = getComputedStyle(node);
359
359
 
@@ -378,7 +378,7 @@ function creates_stacking_context(node) {
378
378
  return false;
379
379
  }
380
380
 
381
- /** @param {HTMLElement[]} nodes */
381
+ /** @param {(HTMLElement| SVGElement)[]} nodes */
382
382
  function find_stacking_context(nodes) {
383
383
  let i = nodes.length;
384
384
  while (i--) {
@@ -389,7 +389,7 @@ function find_stacking_context(nodes) {
389
389
  return null;
390
390
  }
391
391
 
392
- /** @param {HTMLElement} node */
392
+ /** @param {HTMLElement | SVGElement} node */
393
393
  function get_z_index(node) {
394
394
  return node && Number(getComputedStyle(node).zIndex) || 0;
395
395
  }
@@ -551,7 +551,7 @@ function recalculateIntersectingHandles({
551
551
  }) {
552
552
  intersectingHandles.splice(0);
553
553
  let targetElement = null;
554
- if (target instanceof HTMLElement) {
554
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
555
555
  targetElement = target;
556
556
  }
557
557
  registeredResizeHandlers.forEach(data => {
@@ -1830,6 +1830,14 @@ function PanelGroupWithForwardedRef({
1830
1830
  forceUpdate();
1831
1831
  }, [forceUpdate]);
1832
1832
  const registerResizeHandle = useCallback(dragHandleId => {
1833
+ let isRTL = false;
1834
+ const panelGroupElement = panelGroupElementRef.current;
1835
+ if (panelGroupElement) {
1836
+ const style = window.getComputedStyle(panelGroupElement, null);
1837
+ if (style.getPropertyValue("direction") === "rtl") {
1838
+ isRTL = true;
1839
+ }
1840
+ }
1833
1841
  return function resizeHandler(event) {
1834
1842
  event.preventDefault();
1835
1843
  const panelGroupElement = panelGroupElementRef.current;
@@ -1852,10 +1860,8 @@ function PanelGroupWithForwardedRef({
1852
1860
  } = dragState !== null && dragState !== void 0 ? dragState : {};
1853
1861
  const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
1854
1862
  let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
1855
-
1856
- // Support RTL layouts
1857
1863
  const isHorizontal = direction === "horizontal";
1858
- if (document.dir === "rtl" && isHorizontal) {
1864
+ if (isHorizontal && isRTL) {
1859
1865
  delta = -delta;
1860
1866
  }
1861
1867
  const panelConstraints = panelDataArray.map(panelData => panelData.constraints);