@y14e/portal 1.2.21 → 1.2.22

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/README.md CHANGED
@@ -10,14 +10,14 @@ npm i @y14e/portal
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import { createPortal } from '@y14e/portal@1.2.21';
13
+ import { createPortal } from '@y14e/portal@1.2.22';
14
14
 
15
15
  // CDNs
16
- import { createPortal } from 'https://esm.sh/@y14e/portal@1.2.21';
16
+ import { createPortal } from 'https://esm.sh/@y14e/portal@1.2.22';
17
17
  // or
18
- import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.21/+esm';
18
+ import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.22/+esm';
19
19
  // or
20
- import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.21';
20
+ import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.22';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -433,12 +433,12 @@ var Portal = class {
433
433
  }
434
434
  #onFocusIn = (event) => {
435
435
  const current = event.target;
436
- const before = event.relatedTarget;
437
- if (!(before instanceof Element)) {
436
+ const previous = event.relatedTarget;
437
+ if (!(previous instanceof Element)) {
438
438
  return;
439
439
  }
440
440
  if (current === this.#entranceSentinel) {
441
- if (this.#host.contains(before)) {
441
+ if (this.#host.contains(previous)) {
442
442
  this.#moveFocus("previous");
443
443
  return;
444
444
  }
@@ -454,7 +454,7 @@ var Portal = class {
454
454
  next && focusElement(next);
455
455
  }
456
456
  } else if (current === this.#exitSentinel) {
457
- if (this.#host.contains(before)) {
457
+ if (this.#host.contains(previous)) {
458
458
  this.#moveFocus("next");
459
459
  return;
460
460
  }
@@ -463,11 +463,11 @@ var Portal = class {
463
463
  if (last) {
464
464
  focusElement(last);
465
465
  } else {
466
- const previous = getPreviousFocusable(document.body, {
466
+ const previous2 = getPreviousFocusable(document.body, {
467
467
  anchor: this.#entranceSentinel,
468
468
  composed: true
469
469
  });
470
- previous && focusElement(previous);
470
+ previous2 && focusElement(previous2);
471
471
  }
472
472
  }
473
473
  };
@@ -557,7 +557,7 @@ function containsComposed2(container, element) {
557
557
  * Lightweight DOM portal (teleport) utility with fully focus management.
558
558
  * Designed for accessible dialogs, menus, overlays, popovers.
559
559
  *
560
- * @version 1.2.21
560
+ * @version 1.2.22
561
561
  * @author Yusuke Kamiyamane
562
562
  * @license MIT
563
563
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -431,12 +431,12 @@ var Portal = class {
431
431
  }
432
432
  #onFocusIn = (event) => {
433
433
  const current = event.target;
434
- const before = event.relatedTarget;
435
- if (!(before instanceof Element)) {
434
+ const previous = event.relatedTarget;
435
+ if (!(previous instanceof Element)) {
436
436
  return;
437
437
  }
438
438
  if (current === this.#entranceSentinel) {
439
- if (this.#host.contains(before)) {
439
+ if (this.#host.contains(previous)) {
440
440
  this.#moveFocus("previous");
441
441
  return;
442
442
  }
@@ -452,7 +452,7 @@ var Portal = class {
452
452
  next && focusElement(next);
453
453
  }
454
454
  } else if (current === this.#exitSentinel) {
455
- if (this.#host.contains(before)) {
455
+ if (this.#host.contains(previous)) {
456
456
  this.#moveFocus("next");
457
457
  return;
458
458
  }
@@ -461,11 +461,11 @@ var Portal = class {
461
461
  if (last) {
462
462
  focusElement(last);
463
463
  } else {
464
- const previous = getPreviousFocusable(document.body, {
464
+ const previous2 = getPreviousFocusable(document.body, {
465
465
  anchor: this.#entranceSentinel,
466
466
  composed: true
467
467
  });
468
- previous && focusElement(previous);
468
+ previous2 && focusElement(previous2);
469
469
  }
470
470
  }
471
471
  };
@@ -555,7 +555,7 @@ function containsComposed2(container, element) {
555
555
  * Lightweight DOM portal (teleport) utility with fully focus management.
556
556
  * Designed for accessible dialogs, menus, overlays, popovers.
557
557
  *
558
- * @version 1.2.21
558
+ * @version 1.2.22
559
559
  * @author Yusuke Kamiyamane
560
560
  * @license MIT
561
561
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -76,12 +76,12 @@ var Portal = class {
76
76
  }
77
77
  #onFocusIn = (event) => {
78
78
  const current = event.target;
79
- const before = event.relatedTarget;
80
- if (!(before instanceof Element)) {
79
+ const previous = event.relatedTarget;
80
+ if (!(previous instanceof Element)) {
81
81
  return;
82
82
  }
83
83
  if (current === this.#entranceSentinel) {
84
- if (this.#host.contains(before)) {
84
+ if (this.#host.contains(previous)) {
85
85
  this.#moveFocus("previous");
86
86
  return;
87
87
  }
@@ -97,7 +97,7 @@ var Portal = class {
97
97
  next && powerFocusable.focusElement(next);
98
98
  }
99
99
  } else if (current === this.#exitSentinel) {
100
- if (this.#host.contains(before)) {
100
+ if (this.#host.contains(previous)) {
101
101
  this.#moveFocus("next");
102
102
  return;
103
103
  }
@@ -106,11 +106,11 @@ var Portal = class {
106
106
  if (last) {
107
107
  powerFocusable.focusElement(last);
108
108
  } else {
109
- const previous = powerFocusable.getPreviousFocusable(document.body, {
109
+ const previous2 = powerFocusable.getPreviousFocusable(document.body, {
110
110
  anchor: this.#entranceSentinel,
111
111
  composed: true
112
112
  });
113
- previous && powerFocusable.focusElement(previous);
113
+ previous2 && powerFocusable.focusElement(previous2);
114
114
  }
115
115
  }
116
116
  };
@@ -200,7 +200,7 @@ function containsComposed(container, element) {
200
200
  * Lightweight DOM portal (teleport) utility with fully focus management.
201
201
  * Designed for accessible dialogs, menus, overlays, popovers.
202
202
  *
203
- * @version 1.2.21
203
+ * @version 1.2.22
204
204
  * @author Yusuke Kamiyamane
205
205
  * @license MIT
206
206
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Lightweight DOM portal (teleport) utility with fully focus management.
4
4
  * Designed for accessible dialogs, menus, overlays, popovers.
5
5
  *
6
- * @version 1.2.21
6
+ * @version 1.2.22
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Lightweight DOM portal (teleport) utility with fully focus management.
4
4
  * Designed for accessible dialogs, menus, overlays, popovers.
5
5
  *
6
- * @version 1.2.21
6
+ * @version 1.2.22
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -74,12 +74,12 @@ var Portal = class {
74
74
  }
75
75
  #onFocusIn = (event) => {
76
76
  const current = event.target;
77
- const before = event.relatedTarget;
78
- if (!(before instanceof Element)) {
77
+ const previous = event.relatedTarget;
78
+ if (!(previous instanceof Element)) {
79
79
  return;
80
80
  }
81
81
  if (current === this.#entranceSentinel) {
82
- if (this.#host.contains(before)) {
82
+ if (this.#host.contains(previous)) {
83
83
  this.#moveFocus("previous");
84
84
  return;
85
85
  }
@@ -95,7 +95,7 @@ var Portal = class {
95
95
  next && focusElement(next);
96
96
  }
97
97
  } else if (current === this.#exitSentinel) {
98
- if (this.#host.contains(before)) {
98
+ if (this.#host.contains(previous)) {
99
99
  this.#moveFocus("next");
100
100
  return;
101
101
  }
@@ -104,11 +104,11 @@ var Portal = class {
104
104
  if (last) {
105
105
  focusElement(last);
106
106
  } else {
107
- const previous = getPreviousFocusable(document.body, {
107
+ const previous2 = getPreviousFocusable(document.body, {
108
108
  anchor: this.#entranceSentinel,
109
109
  composed: true
110
110
  });
111
- previous && focusElement(previous);
111
+ previous2 && focusElement(previous2);
112
112
  }
113
113
  }
114
114
  };
@@ -198,7 +198,7 @@ function containsComposed(container, element) {
198
198
  * Lightweight DOM portal (teleport) utility with fully focus management.
199
199
  * Designed for accessible dialogs, menus, overlays, popovers.
200
200
  *
201
- * @version 1.2.21
201
+ * @version 1.2.22
202
202
  * @author Yusuke Kamiyamane
203
203
  * @license MIT
204
204
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/portal",
3
- "version": "1.2.21",
3
+ "version": "1.2.22",
4
4
  "description": "Lightweight DOM portal (teleport) utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",