react-resizable-panels 2.0.8-rc.1 → 2.0.9

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.9
4
+
5
+ - Fix Flex stacking context bug (#301)
6
+ - Fix case where pointer event listeners were sometimes added to the document unnecessarily
7
+
8
+ ## 2.0.8
9
+
10
+ - `Panel`/`PanelGroup`/`PanelResizeHandle`` pass "id" prop through to DOM (#299)
11
+ - `Panel` attributes `data-panel-collapsible` and `data-panel-size` are no longer DEV-only (#297)
12
+
3
13
  ## 2.0.7
4
14
 
5
15
  - Group default layouts use `toPrecision` to avoid small layout shifts due to floating point precision differences between initial server rendering and client hydration (#295)
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var stackingOrder = require('stacking-order');
7
6
 
8
7
  function _interopNamespace(e) {
9
8
  if (e && e.__esModule) return e;
@@ -180,6 +179,7 @@ function PanelWithForwardedRef({
180
179
  ...rest,
181
180
  children,
182
181
  className: classNameFromProps,
182
+ id: idFromProps,
183
183
  style: {
184
184
  ...style,
185
185
  ...styleFromProps
@@ -303,6 +303,114 @@ function intersects(rectOne, rectTwo, strict) {
303
303
  }
304
304
  }
305
305
 
306
+ // Forked from NPM stacking-order@2.0.0
307
+
308
+ /**
309
+ * Determine which of two nodes appears in front of the other —
310
+ * if `a` is in front, returns 1, otherwise returns -1
311
+ * @param {HTMLElement} a
312
+ * @param {HTMLElement} b
313
+ */
314
+ function compare(a, b) {
315
+ if (a === b) throw new Error("Cannot compare node with itself");
316
+ const ancestors = {
317
+ a: get_ancestors(a),
318
+ b: get_ancestors(b)
319
+ };
320
+ let common_ancestor;
321
+
322
+ // remove shared ancestors
323
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
324
+ a = ancestors.a.pop();
325
+ b = ancestors.b.pop();
326
+ common_ancestor = a;
327
+ }
328
+ assert(common_ancestor);
329
+ const z_indexes = {
330
+ a: get_z_index(find_stacking_context(ancestors.a)),
331
+ b: get_z_index(find_stacking_context(ancestors.b))
332
+ };
333
+ if (z_indexes.a === z_indexes.b) {
334
+ const children = common_ancestor.childNodes;
335
+ const furthest_ancestors = {
336
+ a: ancestors.a.at(-1),
337
+ b: ancestors.b.at(-1)
338
+ };
339
+ let i = children.length;
340
+ while (i--) {
341
+ const child = children[i];
342
+ if (child === furthest_ancestors.a) return 1;
343
+ if (child === furthest_ancestors.b) return -1;
344
+ }
345
+ }
346
+ return Math.sign(z_indexes.a - z_indexes.b);
347
+ }
348
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
349
+
350
+ /** @param {HTMLElement} node */
351
+ function is_flex_item(node) {
352
+ const display = getComputedStyle(get_parent(node)).display;
353
+ return display === "flex" || display === "inline-flex";
354
+ }
355
+
356
+ /** @param {HTMLElement} node */
357
+ function creates_stacking_context(node) {
358
+ const style = getComputedStyle(node);
359
+
360
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
361
+ if (style.position === "fixed") return true;
362
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
363
+ // if (
364
+ // (style.zIndex !== "auto" && style.position !== "static") ||
365
+ // is_flex_item(node)
366
+ // )
367
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
368
+ if (+style.opacity < 1) return true;
369
+ if ("transform" in style && style.transform !== "none") return true;
370
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
371
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
372
+ if ("filter" in style && style.filter !== "none") return true;
373
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
374
+ if ("isolation" in style && style.isolation === "isolate") return true;
375
+ if (props.test(style.willChange)) return true;
376
+ // @ts-expect-error
377
+ if (style.webkitOverflowScrolling === "touch") return true;
378
+ return false;
379
+ }
380
+
381
+ /** @param {HTMLElement[]} nodes */
382
+ function find_stacking_context(nodes) {
383
+ let i = nodes.length;
384
+ while (i--) {
385
+ const node = nodes[i];
386
+ assert(node);
387
+ if (creates_stacking_context(node)) return node;
388
+ }
389
+ return null;
390
+ }
391
+
392
+ /** @param {HTMLElement} node */
393
+ function get_z_index(node) {
394
+ return node && Number(getComputedStyle(node).zIndex) || 0;
395
+ }
396
+
397
+ /** @param {HTMLElement} node */
398
+ function get_ancestors(node) {
399
+ const ancestors = [];
400
+ while (node) {
401
+ ancestors.push(node);
402
+ node = get_parent(node);
403
+ }
404
+ return ancestors; // [ node, ... <body>, <html>, document ]
405
+ }
406
+
407
+ /** @param {HTMLElement} node */
408
+ function get_parent(node) {
409
+ var _node$parentNode;
410
+ // @ts-ignore
411
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
412
+ }
413
+
306
414
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
307
415
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
308
416
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -444,7 +552,7 @@ function recalculateIntersectingHandles({
444
552
  // Calculating stacking order has a cost, so we should avoid it if possible
445
553
  // That is why we only check potentially intersecting handles,
446
554
  // and why we skip if the event target is within the handle's DOM
447
- stackingOrder.compare(targetElement, dragHandleElement) > 0) {
555
+ compare(targetElement, dragHandleElement) > 0) {
448
556
  // If the target is above the drag handle, then we also need to confirm they overlap
449
557
  // If they are beside each other (e.g. a panel and its drag handle) then the handle is still interactive
450
558
  //
@@ -515,7 +623,7 @@ function updateListeners() {
515
623
  window.removeEventListener("mouseup", handlePointerUp);
516
624
  window.removeEventListener("touchcancel", handlePointerUp);
517
625
  window.removeEventListener("touchend", handlePointerUp);
518
- if (registerResizeHandle.length > 0) {
626
+ if (registeredResizeHandlers.size > 0) {
519
627
  if (isPointerDown) {
520
628
  if (intersectingHandles.length > 0) {
521
629
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1972,11 +2080,12 @@ function PanelGroupWithForwardedRef({
1972
2080
  ...rest,
1973
2081
  children,
1974
2082
  className: classNameFromProps,
2083
+ id: idFromProps,
2084
+ ref: panelGroupElementRef,
1975
2085
  style: {
1976
2086
  ...style,
1977
2087
  ...styleFromProps
1978
2088
  },
1979
- ref: panelGroupElementRef,
1980
2089
  // CSS selectors
1981
2090
  "data-panel-group": "",
1982
2091
  "data-panel-group-direction": direction,
@@ -2180,6 +2289,7 @@ function PanelResizeHandle({
2180
2289
  ...rest,
2181
2290
  children,
2182
2291
  className: classNameFromProps,
2292
+ id: idFromProps,
2183
2293
  onBlur: () => setIsFocused(false),
2184
2294
  onFocus: () => setIsFocused(true),
2185
2295
  ref: elementRef,
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var stackingOrder = require('stacking-order');
7
6
 
8
7
  function _interopNamespace(e) {
9
8
  if (e && e.__esModule) return e;
@@ -186,6 +185,7 @@ function PanelWithForwardedRef({
186
185
  ...rest,
187
186
  children,
188
187
  className: classNameFromProps,
188
+ id: idFromProps,
189
189
  style: {
190
190
  ...style,
191
191
  ...styleFromProps
@@ -309,6 +309,114 @@ function intersects(rectOne, rectTwo, strict) {
309
309
  }
310
310
  }
311
311
 
312
+ // Forked from NPM stacking-order@2.0.0
313
+
314
+ /**
315
+ * Determine which of two nodes appears in front of the other —
316
+ * if `a` is in front, returns 1, otherwise returns -1
317
+ * @param {HTMLElement} a
318
+ * @param {HTMLElement} b
319
+ */
320
+ function compare(a, b) {
321
+ if (a === b) throw new Error("Cannot compare node with itself");
322
+ const ancestors = {
323
+ a: get_ancestors(a),
324
+ b: get_ancestors(b)
325
+ };
326
+ let common_ancestor;
327
+
328
+ // remove shared ancestors
329
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
330
+ a = ancestors.a.pop();
331
+ b = ancestors.b.pop();
332
+ common_ancestor = a;
333
+ }
334
+ assert(common_ancestor);
335
+ const z_indexes = {
336
+ a: get_z_index(find_stacking_context(ancestors.a)),
337
+ b: get_z_index(find_stacking_context(ancestors.b))
338
+ };
339
+ if (z_indexes.a === z_indexes.b) {
340
+ const children = common_ancestor.childNodes;
341
+ const furthest_ancestors = {
342
+ a: ancestors.a.at(-1),
343
+ b: ancestors.b.at(-1)
344
+ };
345
+ let i = children.length;
346
+ while (i--) {
347
+ const child = children[i];
348
+ if (child === furthest_ancestors.a) return 1;
349
+ if (child === furthest_ancestors.b) return -1;
350
+ }
351
+ }
352
+ return Math.sign(z_indexes.a - z_indexes.b);
353
+ }
354
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
355
+
356
+ /** @param {HTMLElement} node */
357
+ function is_flex_item(node) {
358
+ const display = getComputedStyle(get_parent(node)).display;
359
+ return display === "flex" || display === "inline-flex";
360
+ }
361
+
362
+ /** @param {HTMLElement} node */
363
+ function creates_stacking_context(node) {
364
+ const style = getComputedStyle(node);
365
+
366
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
367
+ if (style.position === "fixed") return true;
368
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
369
+ // if (
370
+ // (style.zIndex !== "auto" && style.position !== "static") ||
371
+ // is_flex_item(node)
372
+ // )
373
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
374
+ if (+style.opacity < 1) return true;
375
+ if ("transform" in style && style.transform !== "none") return true;
376
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
377
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
378
+ if ("filter" in style && style.filter !== "none") return true;
379
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
380
+ if ("isolation" in style && style.isolation === "isolate") return true;
381
+ if (props.test(style.willChange)) return true;
382
+ // @ts-expect-error
383
+ if (style.webkitOverflowScrolling === "touch") return true;
384
+ return false;
385
+ }
386
+
387
+ /** @param {HTMLElement[]} nodes */
388
+ function find_stacking_context(nodes) {
389
+ let i = nodes.length;
390
+ while (i--) {
391
+ const node = nodes[i];
392
+ assert(node);
393
+ if (creates_stacking_context(node)) return node;
394
+ }
395
+ return null;
396
+ }
397
+
398
+ /** @param {HTMLElement} node */
399
+ function get_z_index(node) {
400
+ return node && Number(getComputedStyle(node).zIndex) || 0;
401
+ }
402
+
403
+ /** @param {HTMLElement} node */
404
+ function get_ancestors(node) {
405
+ const ancestors = [];
406
+ while (node) {
407
+ ancestors.push(node);
408
+ node = get_parent(node);
409
+ }
410
+ return ancestors; // [ node, ... <body>, <html>, document ]
411
+ }
412
+
413
+ /** @param {HTMLElement} node */
414
+ function get_parent(node) {
415
+ var _node$parentNode;
416
+ // @ts-ignore
417
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
418
+ }
419
+
312
420
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
313
421
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
314
422
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -450,7 +558,7 @@ function recalculateIntersectingHandles({
450
558
  // Calculating stacking order has a cost, so we should avoid it if possible
451
559
  // That is why we only check potentially intersecting handles,
452
560
  // and why we skip if the event target is within the handle's DOM
453
- stackingOrder.compare(targetElement, dragHandleElement) > 0) {
561
+ compare(targetElement, dragHandleElement) > 0) {
454
562
  // If the target is above the drag handle, then we also need to confirm they overlap
455
563
  // If they are beside each other (e.g. a panel and its drag handle) then the handle is still interactive
456
564
  //
@@ -521,7 +629,7 @@ function updateListeners() {
521
629
  window.removeEventListener("mouseup", handlePointerUp);
522
630
  window.removeEventListener("touchcancel", handlePointerUp);
523
631
  window.removeEventListener("touchend", handlePointerUp);
524
- if (registerResizeHandle.length > 0) {
632
+ if (registeredResizeHandlers.size > 0) {
525
633
  if (isPointerDown) {
526
634
  if (intersectingHandles.length > 0) {
527
635
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -2078,11 +2186,12 @@ function PanelGroupWithForwardedRef({
2078
2186
  ...rest,
2079
2187
  children,
2080
2188
  className: classNameFromProps,
2189
+ id: idFromProps,
2190
+ ref: panelGroupElementRef,
2081
2191
  style: {
2082
2192
  ...style,
2083
2193
  ...styleFromProps
2084
2194
  },
2085
- ref: panelGroupElementRef,
2086
2195
  // CSS selectors
2087
2196
  "data-panel-group": "",
2088
2197
  "data-panel-group-direction": direction,
@@ -2286,6 +2395,7 @@ function PanelResizeHandle({
2286
2395
  ...rest,
2287
2396
  children,
2288
2397
  className: classNameFromProps,
2398
+ id: idFromProps,
2289
2399
  onBlur: () => setIsFocused(false),
2290
2400
  onFocus: () => setIsFocused(true),
2291
2401
  ref: elementRef,
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { compare } from 'stacking-order';
3
2
 
4
3
  // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
5
4
 
@@ -162,6 +161,7 @@ function PanelWithForwardedRef({
162
161
  ...rest,
163
162
  children,
164
163
  className: classNameFromProps,
164
+ id: idFromProps,
165
165
  style: {
166
166
  ...style,
167
167
  ...styleFromProps
@@ -285,6 +285,114 @@ function intersects(rectOne, rectTwo, strict) {
285
285
  }
286
286
  }
287
287
 
288
+ // Forked from NPM stacking-order@2.0.0
289
+
290
+ /**
291
+ * Determine which of two nodes appears in front of the other —
292
+ * if `a` is in front, returns 1, otherwise returns -1
293
+ * @param {HTMLElement} a
294
+ * @param {HTMLElement} b
295
+ */
296
+ function compare(a, b) {
297
+ if (a === b) throw new Error("Cannot compare node with itself");
298
+ const ancestors = {
299
+ a: get_ancestors(a),
300
+ b: get_ancestors(b)
301
+ };
302
+ let common_ancestor;
303
+
304
+ // remove shared ancestors
305
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
306
+ a = ancestors.a.pop();
307
+ b = ancestors.b.pop();
308
+ common_ancestor = a;
309
+ }
310
+ assert(common_ancestor);
311
+ const z_indexes = {
312
+ a: get_z_index(find_stacking_context(ancestors.a)),
313
+ b: get_z_index(find_stacking_context(ancestors.b))
314
+ };
315
+ if (z_indexes.a === z_indexes.b) {
316
+ const children = common_ancestor.childNodes;
317
+ const furthest_ancestors = {
318
+ a: ancestors.a.at(-1),
319
+ b: ancestors.b.at(-1)
320
+ };
321
+ let i = children.length;
322
+ while (i--) {
323
+ const child = children[i];
324
+ if (child === furthest_ancestors.a) return 1;
325
+ if (child === furthest_ancestors.b) return -1;
326
+ }
327
+ }
328
+ return Math.sign(z_indexes.a - z_indexes.b);
329
+ }
330
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
331
+
332
+ /** @param {HTMLElement} node */
333
+ function is_flex_item(node) {
334
+ const display = getComputedStyle(get_parent(node)).display;
335
+ return display === "flex" || display === "inline-flex";
336
+ }
337
+
338
+ /** @param {HTMLElement} node */
339
+ function creates_stacking_context(node) {
340
+ const style = getComputedStyle(node);
341
+
342
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
343
+ if (style.position === "fixed") return true;
344
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
345
+ // if (
346
+ // (style.zIndex !== "auto" && style.position !== "static") ||
347
+ // is_flex_item(node)
348
+ // )
349
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
350
+ if (+style.opacity < 1) return true;
351
+ if ("transform" in style && style.transform !== "none") return true;
352
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
353
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
354
+ if ("filter" in style && style.filter !== "none") return true;
355
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
356
+ if ("isolation" in style && style.isolation === "isolate") return true;
357
+ if (props.test(style.willChange)) return true;
358
+ // @ts-expect-error
359
+ if (style.webkitOverflowScrolling === "touch") return true;
360
+ return false;
361
+ }
362
+
363
+ /** @param {HTMLElement[]} nodes */
364
+ function find_stacking_context(nodes) {
365
+ let i = nodes.length;
366
+ while (i--) {
367
+ const node = nodes[i];
368
+ assert(node);
369
+ if (creates_stacking_context(node)) return node;
370
+ }
371
+ return null;
372
+ }
373
+
374
+ /** @param {HTMLElement} node */
375
+ function get_z_index(node) {
376
+ return node && Number(getComputedStyle(node).zIndex) || 0;
377
+ }
378
+
379
+ /** @param {HTMLElement} node */
380
+ function get_ancestors(node) {
381
+ const ancestors = [];
382
+ while (node) {
383
+ ancestors.push(node);
384
+ node = get_parent(node);
385
+ }
386
+ return ancestors; // [ node, ... <body>, <html>, document ]
387
+ }
388
+
389
+ /** @param {HTMLElement} node */
390
+ function get_parent(node) {
391
+ var _node$parentNode;
392
+ // @ts-ignore
393
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
394
+ }
395
+
288
396
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
289
397
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
290
398
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -497,7 +605,7 @@ function updateListeners() {
497
605
  window.removeEventListener("mouseup", handlePointerUp);
498
606
  window.removeEventListener("touchcancel", handlePointerUp);
499
607
  window.removeEventListener("touchend", handlePointerUp);
500
- if (registerResizeHandle.length > 0) {
608
+ if (registeredResizeHandlers.size > 0) {
501
609
  if (isPointerDown) {
502
610
  if (intersectingHandles.length > 0) {
503
611
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -2054,11 +2162,12 @@ function PanelGroupWithForwardedRef({
2054
2162
  ...rest,
2055
2163
  children,
2056
2164
  className: classNameFromProps,
2165
+ id: idFromProps,
2166
+ ref: panelGroupElementRef,
2057
2167
  style: {
2058
2168
  ...style,
2059
2169
  ...styleFromProps
2060
2170
  },
2061
- ref: panelGroupElementRef,
2062
2171
  // CSS selectors
2063
2172
  "data-panel-group": "",
2064
2173
  "data-panel-group-direction": direction,
@@ -2262,6 +2371,7 @@ function PanelResizeHandle({
2262
2371
  ...rest,
2263
2372
  children,
2264
2373
  className: classNameFromProps,
2374
+ id: idFromProps,
2265
2375
  onBlur: () => setIsFocused(false),
2266
2376
  onFocus: () => setIsFocused(true),
2267
2377
  ref: elementRef,
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { compare } from 'stacking-order';
3
2
 
4
3
  // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
5
4
 
@@ -156,6 +155,7 @@ function PanelWithForwardedRef({
156
155
  ...rest,
157
156
  children,
158
157
  className: classNameFromProps,
158
+ id: idFromProps,
159
159
  style: {
160
160
  ...style,
161
161
  ...styleFromProps
@@ -279,6 +279,114 @@ function intersects(rectOne, rectTwo, strict) {
279
279
  }
280
280
  }
281
281
 
282
+ // Forked from NPM stacking-order@2.0.0
283
+
284
+ /**
285
+ * Determine which of two nodes appears in front of the other —
286
+ * if `a` is in front, returns 1, otherwise returns -1
287
+ * @param {HTMLElement} a
288
+ * @param {HTMLElement} b
289
+ */
290
+ function compare(a, b) {
291
+ if (a === b) throw new Error("Cannot compare node with itself");
292
+ const ancestors = {
293
+ a: get_ancestors(a),
294
+ b: get_ancestors(b)
295
+ };
296
+ let common_ancestor;
297
+
298
+ // remove shared ancestors
299
+ while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
300
+ a = ancestors.a.pop();
301
+ b = ancestors.b.pop();
302
+ common_ancestor = a;
303
+ }
304
+ assert(common_ancestor);
305
+ const z_indexes = {
306
+ a: get_z_index(find_stacking_context(ancestors.a)),
307
+ b: get_z_index(find_stacking_context(ancestors.b))
308
+ };
309
+ if (z_indexes.a === z_indexes.b) {
310
+ const children = common_ancestor.childNodes;
311
+ const furthest_ancestors = {
312
+ a: ancestors.a.at(-1),
313
+ b: ancestors.b.at(-1)
314
+ };
315
+ let i = children.length;
316
+ while (i--) {
317
+ const child = children[i];
318
+ if (child === furthest_ancestors.a) return 1;
319
+ if (child === furthest_ancestors.b) return -1;
320
+ }
321
+ }
322
+ return Math.sign(z_indexes.a - z_indexes.b);
323
+ }
324
+ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
325
+
326
+ /** @param {HTMLElement} node */
327
+ function is_flex_item(node) {
328
+ const display = getComputedStyle(get_parent(node)).display;
329
+ return display === "flex" || display === "inline-flex";
330
+ }
331
+
332
+ /** @param {HTMLElement} node */
333
+ function creates_stacking_context(node) {
334
+ const style = getComputedStyle(node);
335
+
336
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
337
+ if (style.position === "fixed") return true;
338
+ // Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
339
+ // if (
340
+ // (style.zIndex !== "auto" && style.position !== "static") ||
341
+ // is_flex_item(node)
342
+ // )
343
+ if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
344
+ if (+style.opacity < 1) return true;
345
+ if ("transform" in style && style.transform !== "none") return true;
346
+ if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
347
+ if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
348
+ if ("filter" in style && style.filter !== "none") return true;
349
+ if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
350
+ if ("isolation" in style && style.isolation === "isolate") return true;
351
+ if (props.test(style.willChange)) return true;
352
+ // @ts-expect-error
353
+ if (style.webkitOverflowScrolling === "touch") return true;
354
+ return false;
355
+ }
356
+
357
+ /** @param {HTMLElement[]} nodes */
358
+ function find_stacking_context(nodes) {
359
+ let i = nodes.length;
360
+ while (i--) {
361
+ const node = nodes[i];
362
+ assert(node);
363
+ if (creates_stacking_context(node)) return node;
364
+ }
365
+ return null;
366
+ }
367
+
368
+ /** @param {HTMLElement} node */
369
+ function get_z_index(node) {
370
+ return node && Number(getComputedStyle(node).zIndex) || 0;
371
+ }
372
+
373
+ /** @param {HTMLElement} node */
374
+ function get_ancestors(node) {
375
+ const ancestors = [];
376
+ while (node) {
377
+ ancestors.push(node);
378
+ node = get_parent(node);
379
+ }
380
+ return ancestors; // [ node, ... <body>, <html>, document ]
381
+ }
382
+
383
+ /** @param {HTMLElement} node */
384
+ function get_parent(node) {
385
+ var _node$parentNode;
386
+ // @ts-ignore
387
+ return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
388
+ }
389
+
282
390
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
283
391
  const EXCEEDED_HORIZONTAL_MAX = 0b0010;
284
392
  const EXCEEDED_VERTICAL_MIN = 0b0100;
@@ -491,7 +599,7 @@ function updateListeners() {
491
599
  window.removeEventListener("mouseup", handlePointerUp);
492
600
  window.removeEventListener("touchcancel", handlePointerUp);
493
601
  window.removeEventListener("touchend", handlePointerUp);
494
- if (registerResizeHandle.length > 0) {
602
+ if (registeredResizeHandlers.size > 0) {
495
603
  if (isPointerDown) {
496
604
  if (intersectingHandles.length > 0) {
497
605
  ownerDocumentCounts.forEach((count, ownerDocument) => {
@@ -1948,11 +2056,12 @@ function PanelGroupWithForwardedRef({
1948
2056
  ...rest,
1949
2057
  children,
1950
2058
  className: classNameFromProps,
2059
+ id: idFromProps,
2060
+ ref: panelGroupElementRef,
1951
2061
  style: {
1952
2062
  ...style,
1953
2063
  ...styleFromProps
1954
2064
  },
1955
- ref: panelGroupElementRef,
1956
2065
  // CSS selectors
1957
2066
  "data-panel-group": "",
1958
2067
  "data-panel-group-direction": direction,
@@ -2156,6 +2265,7 @@ function PanelResizeHandle({
2156
2265
  ...rest,
2157
2266
  children,
2158
2267
  className: classNameFromProps,
2268
+ id: idFromProps,
2159
2269
  onBlur: () => setIsFocused(false),
2160
2270
  onFocus: () => setIsFocused(true),
2161
2271
  ref: elementRef,