@y14e/portal 1.2.28 → 1.2.30
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 +3 -3
- package/dist/index.bundle.cjs +7 -7
- package/dist/index.bundle.js +7 -7
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/package.json +3 -3
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.
|
|
16
|
+
import { createPortal } from 'https://esm.sh/@y14e/portal@1.2.30';
|
|
17
17
|
// or
|
|
18
|
-
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.
|
|
18
|
+
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.2.30/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.
|
|
20
|
+
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.2.30';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -424,9 +424,6 @@ var Portal = class {
|
|
|
424
424
|
[this.#entranceSentinel, this.#exitSentinel].forEach((sentinel) => {
|
|
425
425
|
sentinel.addEventListener("focus", this.#onFocus, { signal });
|
|
426
426
|
});
|
|
427
|
-
if (!(this.#host instanceof HTMLElement)) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
427
|
this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
|
|
431
428
|
this.#host.setAttribute("data-portaled", "");
|
|
432
429
|
}
|
|
@@ -455,6 +452,9 @@ var Portal = class {
|
|
|
455
452
|
}
|
|
456
453
|
};
|
|
457
454
|
#onKeyDown = (event) => {
|
|
455
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
458
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
459
459
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
460
460
|
return;
|
|
@@ -467,7 +467,7 @@ var Portal = class {
|
|
|
467
467
|
const focusables = this.#getFocusables();
|
|
468
468
|
if (focusables.length) {
|
|
469
469
|
const index = focusables.indexOf(active);
|
|
470
|
-
if (index
|
|
470
|
+
if (index >= 0) {
|
|
471
471
|
event.preventDefault();
|
|
472
472
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
473
473
|
focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
@@ -537,7 +537,7 @@ function containsComposed2(container, element) {
|
|
|
537
537
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
538
538
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
539
539
|
*
|
|
540
|
-
* @version 1.2.
|
|
540
|
+
* @version 1.2.30
|
|
541
541
|
* @author Yusuke Kamiyamane
|
|
542
542
|
* @license MIT
|
|
543
543
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -549,7 +549,7 @@ function containsComposed2(container, element) {
|
|
|
549
549
|
(**
|
|
550
550
|
* Attributes Utils
|
|
551
551
|
*
|
|
552
|
-
* @version 1.1.
|
|
552
|
+
* @version 1.1.3
|
|
553
553
|
* @author Yusuke Kamiyamane
|
|
554
554
|
* @license MIT
|
|
555
555
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -562,7 +562,7 @@ power-focusable/dist/index.js:
|
|
|
562
562
|
* High-precision focus management utility with full composed tree support.
|
|
563
563
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
564
564
|
*
|
|
565
|
-
* @version 4.3.
|
|
565
|
+
* @version 4.3.8
|
|
566
566
|
* @author Yusuke Kamiyamane
|
|
567
567
|
* @license MIT
|
|
568
568
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -422,9 +422,6 @@ var Portal = class {
|
|
|
422
422
|
[this.#entranceSentinel, this.#exitSentinel].forEach((sentinel) => {
|
|
423
423
|
sentinel.addEventListener("focus", this.#onFocus, { signal });
|
|
424
424
|
});
|
|
425
|
-
if (!(this.#host instanceof HTMLElement)) {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
425
|
this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
|
|
429
426
|
this.#host.setAttribute("data-portaled", "");
|
|
430
427
|
}
|
|
@@ -453,6 +450,9 @@ var Portal = class {
|
|
|
453
450
|
}
|
|
454
451
|
};
|
|
455
452
|
#onKeyDown = (event) => {
|
|
453
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
456
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
457
457
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
458
458
|
return;
|
|
@@ -465,7 +465,7 @@ var Portal = class {
|
|
|
465
465
|
const focusables = this.#getFocusables();
|
|
466
466
|
if (focusables.length) {
|
|
467
467
|
const index = focusables.indexOf(active);
|
|
468
|
-
if (index
|
|
468
|
+
if (index >= 0) {
|
|
469
469
|
event.preventDefault();
|
|
470
470
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
471
471
|
focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
@@ -535,7 +535,7 @@ function containsComposed2(container, element) {
|
|
|
535
535
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
536
536
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
537
537
|
*
|
|
538
|
-
* @version 1.2.
|
|
538
|
+
* @version 1.2.30
|
|
539
539
|
* @author Yusuke Kamiyamane
|
|
540
540
|
* @license MIT
|
|
541
541
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -547,7 +547,7 @@ function containsComposed2(container, element) {
|
|
|
547
547
|
(**
|
|
548
548
|
* Attributes Utils
|
|
549
549
|
*
|
|
550
|
-
* @version 1.1.
|
|
550
|
+
* @version 1.1.3
|
|
551
551
|
* @author Yusuke Kamiyamane
|
|
552
552
|
* @license MIT
|
|
553
553
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -560,7 +560,7 @@ power-focusable/dist/index.js:
|
|
|
560
560
|
* High-precision focus management utility with full composed tree support.
|
|
561
561
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
562
562
|
*
|
|
563
|
-
* @version 4.3.
|
|
563
|
+
* @version 4.3.8
|
|
564
564
|
* @author Yusuke Kamiyamane
|
|
565
565
|
* @license MIT
|
|
566
566
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -67,9 +67,6 @@ var Portal = class {
|
|
|
67
67
|
[this.#entranceSentinel, this.#exitSentinel].forEach((sentinel) => {
|
|
68
68
|
sentinel.addEventListener("focus", this.#onFocus, { signal });
|
|
69
69
|
});
|
|
70
|
-
if (!(this.#host instanceof HTMLElement)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
70
|
this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
|
|
74
71
|
this.#host.setAttribute("data-portaled", "");
|
|
75
72
|
}
|
|
@@ -98,6 +95,9 @@ var Portal = class {
|
|
|
98
95
|
}
|
|
99
96
|
};
|
|
100
97
|
#onKeyDown = (event) => {
|
|
98
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
101
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
102
102
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
103
103
|
return;
|
|
@@ -110,7 +110,7 @@ var Portal = class {
|
|
|
110
110
|
const focusables = this.#getFocusables();
|
|
111
111
|
if (focusables.length) {
|
|
112
112
|
const index = focusables.indexOf(active);
|
|
113
|
-
if (index
|
|
113
|
+
if (index >= 0) {
|
|
114
114
|
event.preventDefault();
|
|
115
115
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
116
116
|
focusable ? powerFocusable.focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
@@ -180,7 +180,7 @@ function containsComposed(container, element) {
|
|
|
180
180
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
181
181
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
182
182
|
*
|
|
183
|
-
* @version 1.2.
|
|
183
|
+
* @version 1.2.30
|
|
184
184
|
* @author Yusuke Kamiyamane
|
|
185
185
|
* @license MIT
|
|
186
186
|
* @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.
|
|
6
|
+
* @version 1.2.30
|
|
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.
|
|
6
|
+
* @version 1.2.30
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -65,9 +65,6 @@ var Portal = class {
|
|
|
65
65
|
[this.#entranceSentinel, this.#exitSentinel].forEach((sentinel) => {
|
|
66
66
|
sentinel.addEventListener("focus", this.#onFocus, { signal });
|
|
67
67
|
});
|
|
68
|
-
if (!(this.#host instanceof HTMLElement)) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
68
|
this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
|
|
72
69
|
this.#host.setAttribute("data-portaled", "");
|
|
73
70
|
}
|
|
@@ -96,6 +93,9 @@ var Portal = class {
|
|
|
96
93
|
}
|
|
97
94
|
};
|
|
98
95
|
#onKeyDown = (event) => {
|
|
96
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
99
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
100
100
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
101
101
|
return;
|
|
@@ -108,7 +108,7 @@ var Portal = class {
|
|
|
108
108
|
const focusables = this.#getFocusables();
|
|
109
109
|
if (focusables.length) {
|
|
110
110
|
const index = focusables.indexOf(active);
|
|
111
|
-
if (index
|
|
111
|
+
if (index >= 0) {
|
|
112
112
|
event.preventDefault();
|
|
113
113
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
114
114
|
focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
@@ -178,7 +178,7 @@ function containsComposed(container, element) {
|
|
|
178
178
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
179
179
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
180
180
|
*
|
|
181
|
-
* @version 1.2.
|
|
181
|
+
* @version 1.2.30
|
|
182
182
|
* @author Yusuke Kamiyamane
|
|
183
183
|
* @license MIT
|
|
184
184
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/portal",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.30",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"node": ">=18"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@y14e/attributes-utils": "^1.1.
|
|
59
|
-
"power-focusable": "^4.3.
|
|
58
|
+
"@y14e/attributes-utils": "^1.1.3",
|
|
59
|
+
"power-focusable": "^4.3.8"
|
|
60
60
|
}
|
|
61
61
|
}
|