react-resizable-panels 3.0.1 → 3.0.3

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.
@@ -659,9 +659,10 @@ function updateCursor() {
659
659
  resetGlobalCursorStyle();
660
660
  }
661
661
  }
662
- let listenersAbortController = new AbortController();
662
+ let listenersAbortController;
663
663
  function updateListeners() {
664
- listenersAbortController.abort();
664
+ var _listenersAbortContro;
665
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
665
666
  listenersAbortController = new AbortController();
666
667
  const options = {
667
668
  capture: true,
@@ -1081,14 +1082,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1081
1082
  return index != null ? [index, index + 1] : [-1, -1];
1082
1083
  }
1083
1084
 
1085
+ function isHTMLElement(target) {
1086
+ if (target instanceof HTMLElement) {
1087
+ return true;
1088
+ }
1089
+
1090
+ // Fallback to duck typing to handle edge case of portals within a popup window
1091
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1092
+ }
1093
+
1084
1094
  function getPanelGroupElement(id, rootElement = document) {
1085
- var _dataset;
1086
- //If the root element is the PanelGroup
1087
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1095
+ // If the root element is the PanelGroup
1096
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1088
1097
  return rootElement;
1089
1098
  }
1090
1099
 
1091
- //Else query children
1100
+ // Else query children
1092
1101
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1093
1102
  if (element) {
1094
1103
  return element;
@@ -653,9 +653,10 @@ function updateCursor() {
653
653
  resetGlobalCursorStyle();
654
654
  }
655
655
  }
656
- let listenersAbortController = new AbortController();
656
+ let listenersAbortController;
657
657
  function updateListeners() {
658
- listenersAbortController.abort();
658
+ var _listenersAbortContro;
659
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
659
660
  listenersAbortController = new AbortController();
660
661
  const options = {
661
662
  capture: true,
@@ -1075,14 +1076,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1075
1076
  return index != null ? [index, index + 1] : [-1, -1];
1076
1077
  }
1077
1078
 
1079
+ function isHTMLElement(target) {
1080
+ if (target instanceof HTMLElement) {
1081
+ return true;
1082
+ }
1083
+
1084
+ // Fallback to duck typing to handle edge case of portals within a popup window
1085
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1086
+ }
1087
+
1078
1088
  function getPanelGroupElement(id, rootElement = document) {
1079
- var _dataset;
1080
- //If the root element is the PanelGroup
1081
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1089
+ // If the root element is the PanelGroup
1090
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1082
1091
  return rootElement;
1083
1092
  }
1084
1093
 
1085
- //Else query children
1094
+ // Else query children
1086
1095
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1087
1096
  if (element) {
1088
1097
  return element;
@@ -629,9 +629,10 @@ function updateCursor() {
629
629
  resetGlobalCursorStyle();
630
630
  }
631
631
  }
632
- let listenersAbortController = new AbortController();
632
+ let listenersAbortController;
633
633
  function updateListeners() {
634
- listenersAbortController.abort();
634
+ var _listenersAbortContro;
635
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
635
636
  listenersAbortController = new AbortController();
636
637
  const options = {
637
638
  capture: true,
@@ -1012,14 +1013,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1012
1013
  return index != null ? [index, index + 1] : [-1, -1];
1013
1014
  }
1014
1015
 
1016
+ function isHTMLElement(target) {
1017
+ if (target instanceof HTMLElement) {
1018
+ return true;
1019
+ }
1020
+
1021
+ // Fallback to duck typing to handle edge case of portals within a popup window
1022
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1023
+ }
1024
+
1015
1025
  function getPanelGroupElement(id, rootElement = document) {
1016
- var _dataset;
1017
- //If the root element is the PanelGroup
1018
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1026
+ // If the root element is the PanelGroup
1027
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1019
1028
  return rootElement;
1020
1029
  }
1021
1030
 
1022
- //Else query children
1031
+ // Else query children
1023
1032
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1024
1033
  if (element) {
1025
1034
  return element;
@@ -666,9 +666,10 @@ function updateCursor() {
666
666
  resetGlobalCursorStyle();
667
667
  }
668
668
  }
669
- let listenersAbortController = new AbortController();
669
+ let listenersAbortController;
670
670
  function updateListeners() {
671
- listenersAbortController.abort();
671
+ var _listenersAbortContro;
672
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
672
673
  listenersAbortController = new AbortController();
673
674
  const options = {
674
675
  capture: true,
@@ -1088,14 +1089,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1088
1089
  return index != null ? [index, index + 1] : [-1, -1];
1089
1090
  }
1090
1091
 
1092
+ function isHTMLElement(target) {
1093
+ if (target instanceof HTMLElement) {
1094
+ return true;
1095
+ }
1096
+
1097
+ // Fallback to duck typing to handle edge case of portals within a popup window
1098
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1099
+ }
1100
+
1091
1101
  function getPanelGroupElement(id, rootElement = document) {
1092
- var _dataset;
1093
- //If the root element is the PanelGroup
1094
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1102
+ // If the root element is the PanelGroup
1103
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1095
1104
  return rootElement;
1096
1105
  }
1097
1106
 
1098
- //Else query children
1107
+ // Else query children
1099
1108
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1100
1109
  if (element) {
1101
1110
  return element;
@@ -618,9 +618,10 @@ function updateCursor() {
618
618
  resetGlobalCursorStyle();
619
619
  }
620
620
  }
621
- let listenersAbortController = new AbortController();
621
+ let listenersAbortController;
622
622
  function updateListeners() {
623
- listenersAbortController.abort();
623
+ var _listenersAbortContro;
624
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
624
625
  listenersAbortController = new AbortController();
625
626
  const options = {
626
627
  capture: true,
@@ -1001,14 +1002,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1001
1002
  return index != null ? [index, index + 1] : [-1, -1];
1002
1003
  }
1003
1004
 
1005
+ function isHTMLElement(target) {
1006
+ if (target instanceof HTMLElement) {
1007
+ return true;
1008
+ }
1009
+
1010
+ // Fallback to duck typing to handle edge case of portals within a popup window
1011
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1012
+ }
1013
+
1004
1014
  function getPanelGroupElement(id, rootElement = document) {
1005
- var _dataset;
1006
- //If the root element is the PanelGroup
1007
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1015
+ // If the root element is the PanelGroup
1016
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1008
1017
  return rootElement;
1009
1018
  }
1010
1019
 
1011
- //Else query children
1020
+ // Else query children
1012
1021
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1013
1022
  if (element) {
1014
1023
  return element;
@@ -655,9 +655,10 @@ function updateCursor() {
655
655
  resetGlobalCursorStyle();
656
656
  }
657
657
  }
658
- let listenersAbortController = new AbortController();
658
+ let listenersAbortController;
659
659
  function updateListeners() {
660
- listenersAbortController.abort();
660
+ var _listenersAbortContro;
661
+ (_listenersAbortContro = listenersAbortController) === null || _listenersAbortContro === void 0 ? void 0 : _listenersAbortContro.abort();
661
662
  listenersAbortController = new AbortController();
662
663
  const options = {
663
664
  capture: true,
@@ -1077,14 +1078,22 @@ function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
1077
1078
  return index != null ? [index, index + 1] : [-1, -1];
1078
1079
  }
1079
1080
 
1081
+ function isHTMLElement(target) {
1082
+ if (target instanceof HTMLElement) {
1083
+ return true;
1084
+ }
1085
+
1086
+ // Fallback to duck typing to handle edge case of portals within a popup window
1087
+ return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
1088
+ }
1089
+
1080
1090
  function getPanelGroupElement(id, rootElement = document) {
1081
- var _dataset;
1082
- //If the root element is the PanelGroup
1083
- if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
1091
+ // If the root element is the PanelGroup
1092
+ if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
1084
1093
  return rootElement;
1085
1094
  }
1086
1095
 
1087
- //Else query children
1096
+ // Else query children
1088
1097
  const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
1089
1098
  if (element) {
1090
1099
  return element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "type": "module",
5
5
  "description": "React components for resizable panel groups/layouts",
6
6
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",