react-resizable-panels 2.0.12 → 2.0.13

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.
Binary file
@@ -0,0 +1,2 @@
1
+ 114864213
2
+ 1680459541679979000
Binary file
Binary file
Binary file
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.13
4
+
5
+ - Fix potential cycle in stacking-order logic for an unmounted node (#317)
6
+
3
7
  ## 2.0.12
4
8
 
5
9
  - Improve resize for edge cases with collapsed panels; intermediate resize states should now fall back to the most recent valid layout rather than the initial layout (#311)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Brian Vaughn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -349,7 +349,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
349
349
 
350
350
  /** @param {HTMLElement} node */
351
351
  function is_flex_item(node) {
352
- const display = getComputedStyle(get_parent(node)).display;
352
+ var _get_parent;
353
+ // @ts-ignore
354
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
353
355
  return display === "flex" || display === "inline-flex";
354
356
  }
355
357
 
@@ -399,6 +401,7 @@ function get_ancestors(node) {
399
401
  const ancestors = [];
400
402
  while (node) {
401
403
  ancestors.push(node);
404
+ // @ts-ignore
402
405
  node = get_parent(node);
403
406
  }
404
407
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -406,9 +409,13 @@ function get_ancestors(node) {
406
409
 
407
410
  /** @param {HTMLElement} node */
408
411
  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
+ const {
413
+ parentNode
414
+ } = node;
415
+ if (parentNode && parentNode instanceof ShadowRoot) {
416
+ return parentNode.host;
417
+ }
418
+ return parentNode;
412
419
  }
413
420
 
414
421
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -355,7 +355,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
355
355
 
356
356
  /** @param {HTMLElement} node */
357
357
  function is_flex_item(node) {
358
- const display = getComputedStyle(get_parent(node)).display;
358
+ var _get_parent;
359
+ // @ts-ignore
360
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
359
361
  return display === "flex" || display === "inline-flex";
360
362
  }
361
363
 
@@ -405,6 +407,7 @@ function get_ancestors(node) {
405
407
  const ancestors = [];
406
408
  while (node) {
407
409
  ancestors.push(node);
410
+ // @ts-ignore
408
411
  node = get_parent(node);
409
412
  }
410
413
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -412,9 +415,13 @@ function get_ancestors(node) {
412
415
 
413
416
  /** @param {HTMLElement} node */
414
417
  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
+ const {
419
+ parentNode
420
+ } = node;
421
+ if (parentNode && parentNode instanceof ShadowRoot) {
422
+ return parentNode.host;
423
+ }
424
+ return parentNode;
418
425
  }
419
426
 
420
427
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -331,7 +331,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
331
331
 
332
332
  /** @param {HTMLElement} node */
333
333
  function is_flex_item(node) {
334
- const display = getComputedStyle(get_parent(node)).display;
334
+ var _get_parent;
335
+ // @ts-ignore
336
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
335
337
  return display === "flex" || display === "inline-flex";
336
338
  }
337
339
 
@@ -381,6 +383,7 @@ function get_ancestors(node) {
381
383
  const ancestors = [];
382
384
  while (node) {
383
385
  ancestors.push(node);
386
+ // @ts-ignore
384
387
  node = get_parent(node);
385
388
  }
386
389
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -388,9 +391,13 @@ function get_ancestors(node) {
388
391
 
389
392
  /** @param {HTMLElement} node */
390
393
  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
+ const {
395
+ parentNode
396
+ } = node;
397
+ if (parentNode && parentNode instanceof ShadowRoot) {
398
+ return parentNode.host;
399
+ }
400
+ return parentNode;
394
401
  }
395
402
 
396
403
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -325,7 +325,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
325
325
 
326
326
  /** @param {HTMLElement} node */
327
327
  function is_flex_item(node) {
328
- const display = getComputedStyle(get_parent(node)).display;
328
+ var _get_parent;
329
+ // @ts-ignore
330
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
329
331
  return display === "flex" || display === "inline-flex";
330
332
  }
331
333
 
@@ -375,6 +377,7 @@ function get_ancestors(node) {
375
377
  const ancestors = [];
376
378
  while (node) {
377
379
  ancestors.push(node);
380
+ // @ts-ignore
378
381
  node = get_parent(node);
379
382
  }
380
383
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -382,9 +385,13 @@ function get_ancestors(node) {
382
385
 
383
386
  /** @param {HTMLElement} node */
384
387
  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
+ const {
389
+ parentNode
390
+ } = node;
391
+ if (parentNode && parentNode instanceof ShadowRoot) {
392
+ return parentNode.host;
393
+ }
394
+ return parentNode;
388
395
  }
389
396
 
390
397
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -351,7 +351,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
351
351
 
352
352
  /** @param {HTMLElement} node */
353
353
  function is_flex_item(node) {
354
- const display = getComputedStyle(get_parent(node)).display;
354
+ var _get_parent;
355
+ // @ts-ignore
356
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
355
357
  return display === "flex" || display === "inline-flex";
356
358
  }
357
359
 
@@ -401,6 +403,7 @@ function get_ancestors(node) {
401
403
  const ancestors = [];
402
404
  while (node) {
403
405
  ancestors.push(node);
406
+ // @ts-ignore
404
407
  node = get_parent(node);
405
408
  }
406
409
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -408,9 +411,13 @@ function get_ancestors(node) {
408
411
 
409
412
  /** @param {HTMLElement} node */
410
413
  function get_parent(node) {
411
- var _node$parentNode;
412
- // @ts-ignore
413
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
414
+ const {
415
+ parentNode
416
+ } = node;
417
+ if (parentNode && parentNode instanceof ShadowRoot) {
418
+ return parentNode.host;
419
+ }
420
+ return parentNode;
414
421
  }
415
422
 
416
423
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -362,7 +362,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
362
362
 
363
363
  /** @param {HTMLElement} node */
364
364
  function is_flex_item(node) {
365
- const display = getComputedStyle(get_parent(node)).display;
365
+ var _get_parent;
366
+ // @ts-ignore
367
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
366
368
  return display === "flex" || display === "inline-flex";
367
369
  }
368
370
 
@@ -412,6 +414,7 @@ function get_ancestors(node) {
412
414
  const ancestors = [];
413
415
  while (node) {
414
416
  ancestors.push(node);
417
+ // @ts-ignore
415
418
  node = get_parent(node);
416
419
  }
417
420
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -419,9 +422,13 @@ function get_ancestors(node) {
419
422
 
420
423
  /** @param {HTMLElement} node */
421
424
  function get_parent(node) {
422
- var _node$parentNode;
423
- // @ts-ignore
424
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
425
+ const {
426
+ parentNode
427
+ } = node;
428
+ if (parentNode && parentNode instanceof ShadowRoot) {
429
+ return parentNode.host;
430
+ }
431
+ return parentNode;
425
432
  }
426
433
 
427
434
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -338,7 +338,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
338
338
 
339
339
  /** @param {HTMLElement} node */
340
340
  function is_flex_item(node) {
341
- const display = getComputedStyle(get_parent(node)).display;
341
+ var _get_parent;
342
+ // @ts-ignore
343
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
342
344
  return display === "flex" || display === "inline-flex";
343
345
  }
344
346
 
@@ -388,6 +390,7 @@ function get_ancestors(node) {
388
390
  const ancestors = [];
389
391
  while (node) {
390
392
  ancestors.push(node);
393
+ // @ts-ignore
391
394
  node = get_parent(node);
392
395
  }
393
396
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -395,9 +398,13 @@ function get_ancestors(node) {
395
398
 
396
399
  /** @param {HTMLElement} node */
397
400
  function get_parent(node) {
398
- var _node$parentNode;
399
- // @ts-ignore
400
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
401
+ const {
402
+ parentNode
403
+ } = node;
404
+ if (parentNode && parentNode instanceof ShadowRoot) {
405
+ return parentNode.host;
406
+ }
407
+ return parentNode;
401
408
  }
402
409
 
403
410
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -324,7 +324,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
324
324
 
325
325
  /** @param {HTMLElement} node */
326
326
  function is_flex_item(node) {
327
- const display = getComputedStyle(get_parent(node)).display;
327
+ var _get_parent;
328
+ // @ts-ignore
329
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
328
330
  return display === "flex" || display === "inline-flex";
329
331
  }
330
332
 
@@ -374,6 +376,7 @@ function get_ancestors(node) {
374
376
  const ancestors = [];
375
377
  while (node) {
376
378
  ancestors.push(node);
379
+ // @ts-ignore
377
380
  node = get_parent(node);
378
381
  }
379
382
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -381,9 +384,13 @@ function get_ancestors(node) {
381
384
 
382
385
  /** @param {HTMLElement} node */
383
386
  function get_parent(node) {
384
- var _node$parentNode;
385
- // @ts-ignore
386
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
387
+ const {
388
+ parentNode
389
+ } = node;
390
+ if (parentNode && parentNode instanceof ShadowRoot) {
391
+ return parentNode.host;
392
+ }
393
+ return parentNode;
387
394
  }
388
395
 
389
396
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -300,7 +300,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
300
300
 
301
301
  /** @param {HTMLElement} node */
302
302
  function is_flex_item(node) {
303
- const display = getComputedStyle(get_parent(node)).display;
303
+ var _get_parent;
304
+ // @ts-ignore
305
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
304
306
  return display === "flex" || display === "inline-flex";
305
307
  }
306
308
 
@@ -350,6 +352,7 @@ function get_ancestors(node) {
350
352
  const ancestors = [];
351
353
  while (node) {
352
354
  ancestors.push(node);
355
+ // @ts-ignore
353
356
  node = get_parent(node);
354
357
  }
355
358
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -357,9 +360,13 @@ function get_ancestors(node) {
357
360
 
358
361
  /** @param {HTMLElement} node */
359
362
  function get_parent(node) {
360
- var _node$parentNode;
361
- // @ts-ignore
362
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
363
+ const {
364
+ parentNode
365
+ } = node;
366
+ if (parentNode && parentNode instanceof ShadowRoot) {
367
+ return parentNode.host;
368
+ }
369
+ return parentNode;
363
370
  }
364
371
 
365
372
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -327,7 +327,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
327
327
 
328
328
  /** @param {HTMLElement} node */
329
329
  function is_flex_item(node) {
330
- const display = getComputedStyle(get_parent(node)).display;
330
+ var _get_parent;
331
+ // @ts-ignore
332
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
331
333
  return display === "flex" || display === "inline-flex";
332
334
  }
333
335
 
@@ -377,6 +379,7 @@ function get_ancestors(node) {
377
379
  const ancestors = [];
378
380
  while (node) {
379
381
  ancestors.push(node);
382
+ // @ts-ignore
380
383
  node = get_parent(node);
381
384
  }
382
385
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -384,9 +387,13 @@ function get_ancestors(node) {
384
387
 
385
388
  /** @param {HTMLElement} node */
386
389
  function get_parent(node) {
387
- var _node$parentNode;
388
- // @ts-ignore
389
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
390
+ const {
391
+ parentNode
392
+ } = node;
393
+ if (parentNode && parentNode instanceof ShadowRoot) {
394
+ return parentNode.host;
395
+ }
396
+ return parentNode;
390
397
  }
391
398
 
392
399
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -313,7 +313,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
313
313
 
314
314
  /** @param {HTMLElement} node */
315
315
  function is_flex_item(node) {
316
- const display = getComputedStyle(get_parent(node)).display;
316
+ var _get_parent;
317
+ // @ts-ignore
318
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
317
319
  return display === "flex" || display === "inline-flex";
318
320
  }
319
321
 
@@ -363,6 +365,7 @@ function get_ancestors(node) {
363
365
  const ancestors = [];
364
366
  while (node) {
365
367
  ancestors.push(node);
368
+ // @ts-ignore
366
369
  node = get_parent(node);
367
370
  }
368
371
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -370,9 +373,13 @@ function get_ancestors(node) {
370
373
 
371
374
  /** @param {HTMLElement} node */
372
375
  function get_parent(node) {
373
- var _node$parentNode;
374
- // @ts-ignore
375
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
376
+ const {
377
+ parentNode
378
+ } = node;
379
+ if (parentNode && parentNode instanceof ShadowRoot) {
380
+ return parentNode.host;
381
+ }
382
+ return parentNode;
376
383
  }
377
384
 
378
385
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
@@ -289,7 +289,9 @@ const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMo
289
289
 
290
290
  /** @param {HTMLElement} node */
291
291
  function is_flex_item(node) {
292
- const display = getComputedStyle(get_parent(node)).display;
292
+ var _get_parent;
293
+ // @ts-ignore
294
+ const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
293
295
  return display === "flex" || display === "inline-flex";
294
296
  }
295
297
 
@@ -339,6 +341,7 @@ function get_ancestors(node) {
339
341
  const ancestors = [];
340
342
  while (node) {
341
343
  ancestors.push(node);
344
+ // @ts-ignore
342
345
  node = get_parent(node);
343
346
  }
344
347
  return ancestors; // [ node, ... <body>, <html>, document ]
@@ -346,9 +349,13 @@ function get_ancestors(node) {
346
349
 
347
350
  /** @param {HTMLElement} node */
348
351
  function get_parent(node) {
349
- var _node$parentNode;
350
- // @ts-ignore
351
- return ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.host) || node.parentNode;
352
+ const {
353
+ parentNode
354
+ } = node;
355
+ if (parentNode && parentNode instanceof ShadowRoot) {
356
+ return parentNode.host;
357
+ }
358
+ return parentNode;
352
359
  }
353
360
 
354
361
  const EXCEEDED_HORIZONTAL_MIN = 0b0001;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-resizable-panels",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "React components for resizable panel groups/layouts",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
6
6
  "license": "MIT",
@@ -60,12 +60,6 @@
60
60
  }
61
61
  },
62
62
  "types": "dist/react-resizable-panels.cjs.d.ts",
63
- "scripts": {
64
- "lint": "eslint \"src/**/*.{ts,tsx}\"",
65
- "test": "jest --config=jest.config.js",
66
- "test:watch": "jest --config=jest.config.js --watch",
67
- "watch": "parcel watch --port=2345"
68
- },
69
63
  "devDependencies": {
70
64
  "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
71
65
  "@babel/plugin-proposal-optional-chaining": "7.21.0",
@@ -83,5 +77,11 @@
83
77
  },
84
78
  "browserslist": [
85
79
  "Chrome 79"
86
- ]
87
- }
80
+ ],
81
+ "scripts": {
82
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
83
+ "test": "jest --config=jest.config.js",
84
+ "test:watch": "jest --config=jest.config.js --watch",
85
+ "watch": "parcel watch --port=2345"
86
+ }
87
+ }
@@ -1,5 +1,6 @@
1
1
  // Forked from NPM stacking-order@2.0.0
2
2
  // Background at https://github.com/Rich-Harris/stacking-order/issues/3
3
+ // Background at https://github.com/Rich-Harris/stacking-order/issues/6
3
4
 
4
5
  import { assert } from "..";
5
6
 
@@ -61,7 +62,8 @@ const props =
61
62
 
62
63
  /** @param {HTMLElement} node */
63
64
  function is_flex_item(node: HTMLElement) {
64
- const display = getComputedStyle(get_parent(node)).display;
65
+ // @ts-ignore
66
+ const display = getComputedStyle(get_parent(node) ?? node).display;
65
67
  return display === "flex" || display === "inline-flex";
66
68
  }
67
69
 
@@ -115,11 +117,12 @@ function get_z_index(node: HTMLElement | null) {
115
117
  }
116
118
 
117
119
  /** @param {HTMLElement} node */
118
- function get_ancestors(node: HTMLElement) {
120
+ function get_ancestors(node: HTMLElement | null) {
119
121
  const ancestors = [];
120
122
 
121
123
  while (node) {
122
124
  ancestors.push(node);
125
+ // @ts-ignore
123
126
  node = get_parent(node);
124
127
  }
125
128
 
@@ -128,6 +131,9 @@ function get_ancestors(node: HTMLElement) {
128
131
 
129
132
  /** @param {HTMLElement} node */
130
133
  function get_parent(node: HTMLElement) {
131
- // @ts-ignore
132
- return node.parentNode?.host || node.parentNode;
134
+ const { parentNode } = node;
135
+ if (parentNode && parentNode instanceof ShadowRoot) {
136
+ return parentNode.host
137
+ }
138
+ return parentNode;
133
139
  }