@y14e/portal 1.2.16 → 1.2.17
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 +4 -4
- 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 +1 -1
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.
|
|
13
|
+
import { createPortal } from '@y14e/portal@1.2.17';
|
|
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.17';
|
|
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.17/+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.17';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.cjs
CHANGED
|
@@ -370,10 +370,6 @@ function createPortal(host, container = document.body) {
|
|
|
370
370
|
return () => {
|
|
371
371
|
};
|
|
372
372
|
}
|
|
373
|
-
if (!(container instanceof Element)) {
|
|
374
|
-
console.warn("Invalid container element. Fallback: <body> element.");
|
|
375
|
-
container = document.body;
|
|
376
|
-
}
|
|
377
373
|
if (containsComposed2(host, container)) {
|
|
378
374
|
console.warn("Host element cannot contain the container element");
|
|
379
375
|
return () => {
|
|
@@ -393,6 +389,10 @@ var Portal = class {
|
|
|
393
389
|
#isDestroyed = false;
|
|
394
390
|
constructor(host, container) {
|
|
395
391
|
this.#host = host;
|
|
392
|
+
if (!(container instanceof Element)) {
|
|
393
|
+
console.warn("Invalid container element. Fallback: <body> element.");
|
|
394
|
+
container = document.body;
|
|
395
|
+
}
|
|
396
396
|
this.#container = container;
|
|
397
397
|
this.#entranceSentinel = this.#createSentinel();
|
|
398
398
|
this.#exitSentinel = this.#createSentinel();
|
|
@@ -572,7 +572,7 @@ function getActiveElement2() {
|
|
|
572
572
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
573
573
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
574
574
|
*
|
|
575
|
-
* @version 1.2.
|
|
575
|
+
* @version 1.2.17
|
|
576
576
|
* @author Yusuke Kamiyamane
|
|
577
577
|
* @license MIT
|
|
578
578
|
* @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.17
|
|
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.17
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -368,10 +368,6 @@ function createPortal(host, container = document.body) {
|
|
|
368
368
|
return () => {
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
if (!(container instanceof Element)) {
|
|
372
|
-
console.warn("Invalid container element. Fallback: <body> element.");
|
|
373
|
-
container = document.body;
|
|
374
|
-
}
|
|
375
371
|
if (containsComposed2(host, container)) {
|
|
376
372
|
console.warn("Host element cannot contain the container element");
|
|
377
373
|
return () => {
|
|
@@ -391,6 +387,10 @@ var Portal = class {
|
|
|
391
387
|
#isDestroyed = false;
|
|
392
388
|
constructor(host, container) {
|
|
393
389
|
this.#host = host;
|
|
390
|
+
if (!(container instanceof Element)) {
|
|
391
|
+
console.warn("Invalid container element. Fallback: <body> element.");
|
|
392
|
+
container = document.body;
|
|
393
|
+
}
|
|
394
394
|
this.#container = container;
|
|
395
395
|
this.#entranceSentinel = this.#createSentinel();
|
|
396
396
|
this.#exitSentinel = this.#createSentinel();
|
|
@@ -570,7 +570,7 @@ function getActiveElement2() {
|
|
|
570
570
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
571
571
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
572
572
|
*
|
|
573
|
-
* @version 1.2.
|
|
573
|
+
* @version 1.2.17
|
|
574
574
|
* @author Yusuke Kamiyamane
|
|
575
575
|
* @license MIT
|
|
576
576
|
* @copyright Copyright (c) Yusuke Kamiyamane
|