@y14e/portal 1.2.22 → 1.2.23
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.bundle.cjs +10 -2
- package/dist/index.bundle.js +10 -2
- package/dist/index.cjs +10 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -2
- 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.23';
|
|
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.23';
|
|
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.23/+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.23';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -388,6 +388,7 @@ var Portal = class {
|
|
|
388
388
|
#exitSentinel;
|
|
389
389
|
#focusables = /* @__PURE__ */ new Set();
|
|
390
390
|
#controller = null;
|
|
391
|
+
#timer;
|
|
391
392
|
#isDestroyed = false;
|
|
392
393
|
constructor(host, container) {
|
|
393
394
|
this.#host = host;
|
|
@@ -407,6 +408,10 @@ var Portal = class {
|
|
|
407
408
|
this.#isDestroyed = true;
|
|
408
409
|
this.#controller?.abort();
|
|
409
410
|
this.#controller = null;
|
|
411
|
+
if (this.#timer !== void 0) {
|
|
412
|
+
cancelAnimationFrame(this.#timer);
|
|
413
|
+
this.#timer = void 0;
|
|
414
|
+
}
|
|
410
415
|
restoreAttributes([...this.#focusables]);
|
|
411
416
|
this.#focusables.clear();
|
|
412
417
|
this.#exitSentinel.after(this.#host);
|
|
@@ -525,7 +530,10 @@ var Portal = class {
|
|
|
525
530
|
return sentinel;
|
|
526
531
|
}
|
|
527
532
|
#focusSentinel(isPrevious) {
|
|
528
|
-
|
|
533
|
+
this.#timer && cancelAnimationFrame(this.#timer);
|
|
534
|
+
this.#timer = requestAnimationFrame(
|
|
535
|
+
() => (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus()
|
|
536
|
+
);
|
|
529
537
|
}
|
|
530
538
|
#getFocusables() {
|
|
531
539
|
return getFocusables(this.#host, {
|
|
@@ -557,7 +565,7 @@ function containsComposed2(container, element) {
|
|
|
557
565
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
558
566
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
559
567
|
*
|
|
560
|
-
* @version 1.2.
|
|
568
|
+
* @version 1.2.23
|
|
561
569
|
* @author Yusuke Kamiyamane
|
|
562
570
|
* @license MIT
|
|
563
571
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -386,6 +386,7 @@ var Portal = class {
|
|
|
386
386
|
#exitSentinel;
|
|
387
387
|
#focusables = /* @__PURE__ */ new Set();
|
|
388
388
|
#controller = null;
|
|
389
|
+
#timer;
|
|
389
390
|
#isDestroyed = false;
|
|
390
391
|
constructor(host, container) {
|
|
391
392
|
this.#host = host;
|
|
@@ -405,6 +406,10 @@ var Portal = class {
|
|
|
405
406
|
this.#isDestroyed = true;
|
|
406
407
|
this.#controller?.abort();
|
|
407
408
|
this.#controller = null;
|
|
409
|
+
if (this.#timer !== void 0) {
|
|
410
|
+
cancelAnimationFrame(this.#timer);
|
|
411
|
+
this.#timer = void 0;
|
|
412
|
+
}
|
|
408
413
|
restoreAttributes([...this.#focusables]);
|
|
409
414
|
this.#focusables.clear();
|
|
410
415
|
this.#exitSentinel.after(this.#host);
|
|
@@ -523,7 +528,10 @@ var Portal = class {
|
|
|
523
528
|
return sentinel;
|
|
524
529
|
}
|
|
525
530
|
#focusSentinel(isPrevious) {
|
|
526
|
-
|
|
531
|
+
this.#timer && cancelAnimationFrame(this.#timer);
|
|
532
|
+
this.#timer = requestAnimationFrame(
|
|
533
|
+
() => (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus()
|
|
534
|
+
);
|
|
527
535
|
}
|
|
528
536
|
#getFocusables() {
|
|
529
537
|
return getFocusables(this.#host, {
|
|
@@ -555,7 +563,7 @@ function containsComposed2(container, element) {
|
|
|
555
563
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
556
564
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
557
565
|
*
|
|
558
|
-
* @version 1.2.
|
|
566
|
+
* @version 1.2.23
|
|
559
567
|
* @author Yusuke Kamiyamane
|
|
560
568
|
* @license MIT
|
|
561
569
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var Portal = class {
|
|
|
31
31
|
#exitSentinel;
|
|
32
32
|
#focusables = /* @__PURE__ */ new Set();
|
|
33
33
|
#controller = null;
|
|
34
|
+
#timer;
|
|
34
35
|
#isDestroyed = false;
|
|
35
36
|
constructor(host, container) {
|
|
36
37
|
this.#host = host;
|
|
@@ -50,6 +51,10 @@ var Portal = class {
|
|
|
50
51
|
this.#isDestroyed = true;
|
|
51
52
|
this.#controller?.abort();
|
|
52
53
|
this.#controller = null;
|
|
54
|
+
if (this.#timer !== void 0) {
|
|
55
|
+
cancelAnimationFrame(this.#timer);
|
|
56
|
+
this.#timer = void 0;
|
|
57
|
+
}
|
|
53
58
|
attributesUtils.restoreAttributes([...this.#focusables]);
|
|
54
59
|
this.#focusables.clear();
|
|
55
60
|
this.#exitSentinel.after(this.#host);
|
|
@@ -168,7 +173,10 @@ var Portal = class {
|
|
|
168
173
|
return sentinel;
|
|
169
174
|
}
|
|
170
175
|
#focusSentinel(isPrevious) {
|
|
171
|
-
|
|
176
|
+
this.#timer && cancelAnimationFrame(this.#timer);
|
|
177
|
+
this.#timer = requestAnimationFrame(
|
|
178
|
+
() => (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus()
|
|
179
|
+
);
|
|
172
180
|
}
|
|
173
181
|
#getFocusables() {
|
|
174
182
|
return powerFocusable.getFocusables(this.#host, {
|
|
@@ -200,7 +208,7 @@ function containsComposed(container, element) {
|
|
|
200
208
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
201
209
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
202
210
|
*
|
|
203
|
-
* @version 1.2.
|
|
211
|
+
* @version 1.2.23
|
|
204
212
|
* @author Yusuke Kamiyamane
|
|
205
213
|
* @license MIT
|
|
206
214
|
* @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.23
|
|
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.23
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var Portal = class {
|
|
|
29
29
|
#exitSentinel;
|
|
30
30
|
#focusables = /* @__PURE__ */ new Set();
|
|
31
31
|
#controller = null;
|
|
32
|
+
#timer;
|
|
32
33
|
#isDestroyed = false;
|
|
33
34
|
constructor(host, container) {
|
|
34
35
|
this.#host = host;
|
|
@@ -48,6 +49,10 @@ var Portal = class {
|
|
|
48
49
|
this.#isDestroyed = true;
|
|
49
50
|
this.#controller?.abort();
|
|
50
51
|
this.#controller = null;
|
|
52
|
+
if (this.#timer !== void 0) {
|
|
53
|
+
cancelAnimationFrame(this.#timer);
|
|
54
|
+
this.#timer = void 0;
|
|
55
|
+
}
|
|
51
56
|
restoreAttributes([...this.#focusables]);
|
|
52
57
|
this.#focusables.clear();
|
|
53
58
|
this.#exitSentinel.after(this.#host);
|
|
@@ -166,7 +171,10 @@ var Portal = class {
|
|
|
166
171
|
return sentinel;
|
|
167
172
|
}
|
|
168
173
|
#focusSentinel(isPrevious) {
|
|
169
|
-
|
|
174
|
+
this.#timer && cancelAnimationFrame(this.#timer);
|
|
175
|
+
this.#timer = requestAnimationFrame(
|
|
176
|
+
() => (isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus()
|
|
177
|
+
);
|
|
170
178
|
}
|
|
171
179
|
#getFocusables() {
|
|
172
180
|
return getFocusables(this.#host, {
|
|
@@ -198,7 +206,7 @@ function containsComposed(container, element) {
|
|
|
198
206
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
199
207
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
200
208
|
*
|
|
201
|
-
* @version 1.2.
|
|
209
|
+
* @version 1.2.23
|
|
202
210
|
* @author Yusuke Kamiyamane
|
|
203
211
|
* @license MIT
|
|
204
212
|
* @copyright Copyright (c) Yusuke Kamiyamane
|