@y14e/portal 1.2.29 → 1.2.31

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
@@ -13,11 +13,11 @@ npm i @y14e/portal
13
13
  import { createPortal } from '@y14e/portal';
14
14
 
15
15
  // CDNs
16
- import { createPortal } from 'https://esm.sh/@y14e/portal@1.2.29';
16
+ import { createPortal } from 'https://esm.sh/@y14e/portal@1.2.31';
17
17
  // or
18
- import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.29/+esm';
18
+ import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.31/+esm';
19
19
  // or
20
- import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.29';
20
+ import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.31';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -428,8 +428,7 @@ var Portal = class {
428
428
  this.#host.setAttribute("data-portaled", "");
429
429
  }
430
430
  #onFocus = (event) => {
431
- const sentinel = event.target;
432
- const previous = event.relatedTarget;
431
+ const { currentTarget: sentinel, relatedTarget: previous } = event;
433
432
  if (!(previous instanceof Element)) {
434
433
  return;
435
434
  }
@@ -467,7 +466,7 @@ var Portal = class {
467
466
  const focusables = this.#getFocusables();
468
467
  if (focusables.length) {
469
468
  const index = focusables.indexOf(active);
470
- if (index !== -1) {
469
+ if (index >= 0) {
471
470
  event.preventDefault();
472
471
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
473
472
  focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
@@ -537,7 +536,7 @@ function containsComposed2(container, element) {
537
536
  * Lightweight DOM portal (teleport) utility with fully focus management.
538
537
  * Designed for accessible dialogs, menus, overlays, popovers.
539
538
  *
540
- * @version 1.2.29
539
+ * @version 1.2.31
541
540
  * @author Yusuke Kamiyamane
542
541
  * @license MIT
543
542
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -426,8 +426,7 @@ var Portal = class {
426
426
  this.#host.setAttribute("data-portaled", "");
427
427
  }
428
428
  #onFocus = (event) => {
429
- const sentinel = event.target;
430
- const previous = event.relatedTarget;
429
+ const { currentTarget: sentinel, relatedTarget: previous } = event;
431
430
  if (!(previous instanceof Element)) {
432
431
  return;
433
432
  }
@@ -465,7 +464,7 @@ var Portal = class {
465
464
  const focusables = this.#getFocusables();
466
465
  if (focusables.length) {
467
466
  const index = focusables.indexOf(active);
468
- if (index !== -1) {
467
+ if (index >= 0) {
469
468
  event.preventDefault();
470
469
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
471
470
  focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
@@ -535,7 +534,7 @@ function containsComposed2(container, element) {
535
534
  * Lightweight DOM portal (teleport) utility with fully focus management.
536
535
  * Designed for accessible dialogs, menus, overlays, popovers.
537
536
  *
538
- * @version 1.2.29
537
+ * @version 1.2.31
539
538
  * @author Yusuke Kamiyamane
540
539
  * @license MIT
541
540
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -71,8 +71,7 @@ var Portal = class {
71
71
  this.#host.setAttribute("data-portaled", "");
72
72
  }
73
73
  #onFocus = (event) => {
74
- const sentinel = event.target;
75
- const previous = event.relatedTarget;
74
+ const { currentTarget: sentinel, relatedTarget: previous } = event;
76
75
  if (!(previous instanceof Element)) {
77
76
  return;
78
77
  }
@@ -110,7 +109,7 @@ var Portal = class {
110
109
  const focusables = this.#getFocusables();
111
110
  if (focusables.length) {
112
111
  const index = focusables.indexOf(active);
113
- if (index !== -1) {
112
+ if (index >= 0) {
114
113
  event.preventDefault();
115
114
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
116
115
  focusable ? powerFocusable.focusElement(focusable) : this.#focusSentinel(shiftKey);
@@ -180,7 +179,7 @@ function containsComposed(container, element) {
180
179
  * Lightweight DOM portal (teleport) utility with fully focus management.
181
180
  * Designed for accessible dialogs, menus, overlays, popovers.
182
181
  *
183
- * @version 1.2.29
182
+ * @version 1.2.31
184
183
  * @author Yusuke Kamiyamane
185
184
  * @license MIT
186
185
  * @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.29
6
+ * @version 1.2.31
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.29
6
+ * @version 1.2.31
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -69,8 +69,7 @@ var Portal = class {
69
69
  this.#host.setAttribute("data-portaled", "");
70
70
  }
71
71
  #onFocus = (event) => {
72
- const sentinel = event.target;
73
- const previous = event.relatedTarget;
72
+ const { currentTarget: sentinel, relatedTarget: previous } = event;
74
73
  if (!(previous instanceof Element)) {
75
74
  return;
76
75
  }
@@ -108,7 +107,7 @@ var Portal = class {
108
107
  const focusables = this.#getFocusables();
109
108
  if (focusables.length) {
110
109
  const index = focusables.indexOf(active);
111
- if (index !== -1) {
110
+ if (index >= 0) {
112
111
  event.preventDefault();
113
112
  const focusable = focusables[index + (shiftKey ? -1 : 1)];
114
113
  focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
@@ -178,7 +177,7 @@ function containsComposed(container, element) {
178
177
  * Lightweight DOM portal (teleport) utility with fully focus management.
179
178
  * Designed for accessible dialogs, menus, overlays, popovers.
180
179
  *
181
- * @version 1.2.29
180
+ * @version 1.2.31
182
181
  * @author Yusuke Kamiyamane
183
182
  * @license MIT
184
183
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/portal",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "description": "Lightweight DOM portal (teleport) utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",