@y14e/portal 1.3.2 → 1.3.3
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 +9 -9
- package/dist/index.bundle.js +9 -9
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/package.json +6 -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.3.
|
|
16
|
+
import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.3';
|
|
17
17
|
// or
|
|
18
|
-
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.
|
|
18
|
+
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.3/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.
|
|
20
|
+
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.3';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// node_modules/@y14e/attribute-
|
|
3
|
+
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
4
4
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function restoreAttributes(element_or_elements) {
|
|
6
6
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
@@ -209,11 +209,11 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
209
209
|
}
|
|
210
210
|
const settings = {
|
|
211
211
|
composed,
|
|
212
|
-
filter,
|
|
213
|
-
include,
|
|
214
212
|
skipNegativeTabIndexCheck,
|
|
215
213
|
skipVisibilityCheck
|
|
216
214
|
};
|
|
215
|
+
filter && Object.assign(settings, { filter });
|
|
216
|
+
include && Object.assign(settings, { include });
|
|
217
217
|
const focusables = getFocusables(container, settings);
|
|
218
218
|
const { length } = focusables;
|
|
219
219
|
if (!length) {
|
|
@@ -577,7 +577,7 @@ function containsComposed2(container, element) {
|
|
|
577
577
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
578
578
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
579
579
|
*
|
|
580
|
-
* @version 1.3.
|
|
580
|
+
* @version 1.3.3
|
|
581
581
|
* @author Yusuke Kamiyamane
|
|
582
582
|
* @license MIT
|
|
583
583
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -585,15 +585,15 @@ function containsComposed2(container, element) {
|
|
|
585
585
|
*/
|
|
586
586
|
/*! Bundled license information:
|
|
587
587
|
|
|
588
|
-
@y14e/attribute-
|
|
588
|
+
@y14e/attribute-utils/dist/index.js:
|
|
589
589
|
(**
|
|
590
|
-
* Attribute
|
|
590
|
+
* Attribute Utils
|
|
591
591
|
*
|
|
592
|
-
* @version 2.0.
|
|
592
|
+
* @version 2.0.5
|
|
593
593
|
* @author Yusuke Kamiyamane
|
|
594
594
|
* @license MIT
|
|
595
595
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
596
|
-
* @see {@link https://github.com/y14e/attribute-
|
|
596
|
+
* @see {@link https://github.com/y14e/attribute-utils}
|
|
597
597
|
*)
|
|
598
598
|
|
|
599
599
|
power-focusable/dist/index.js:
|
|
@@ -602,7 +602,7 @@ power-focusable/dist/index.js:
|
|
|
602
602
|
* High-precision focus management utility with full composed tree support.
|
|
603
603
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
604
604
|
*
|
|
605
|
-
* @version 4.3.
|
|
605
|
+
* @version 4.3.26
|
|
606
606
|
* @author Yusuke Kamiyamane
|
|
607
607
|
* @license MIT
|
|
608
608
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/@y14e/attribute-
|
|
1
|
+
// node_modules/@y14e/attribute-utils/dist/index.js
|
|
2
2
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function restoreAttributes(element_or_elements) {
|
|
4
4
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
@@ -207,11 +207,11 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
207
207
|
}
|
|
208
208
|
const settings = {
|
|
209
209
|
composed,
|
|
210
|
-
filter,
|
|
211
|
-
include,
|
|
212
210
|
skipNegativeTabIndexCheck,
|
|
213
211
|
skipVisibilityCheck
|
|
214
212
|
};
|
|
213
|
+
filter && Object.assign(settings, { filter });
|
|
214
|
+
include && Object.assign(settings, { include });
|
|
215
215
|
const focusables = getFocusables(container, settings);
|
|
216
216
|
const { length } = focusables;
|
|
217
217
|
if (!length) {
|
|
@@ -575,7 +575,7 @@ function containsComposed2(container, element) {
|
|
|
575
575
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
576
576
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
577
577
|
*
|
|
578
|
-
* @version 1.3.
|
|
578
|
+
* @version 1.3.3
|
|
579
579
|
* @author Yusuke Kamiyamane
|
|
580
580
|
* @license MIT
|
|
581
581
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -583,15 +583,15 @@ function containsComposed2(container, element) {
|
|
|
583
583
|
*/
|
|
584
584
|
/*! Bundled license information:
|
|
585
585
|
|
|
586
|
-
@y14e/attribute-
|
|
586
|
+
@y14e/attribute-utils/dist/index.js:
|
|
587
587
|
(**
|
|
588
|
-
* Attribute
|
|
588
|
+
* Attribute Utils
|
|
589
589
|
*
|
|
590
|
-
* @version 2.0.
|
|
590
|
+
* @version 2.0.5
|
|
591
591
|
* @author Yusuke Kamiyamane
|
|
592
592
|
* @license MIT
|
|
593
593
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
594
|
-
* @see {@link https://github.com/y14e/attribute-
|
|
594
|
+
* @see {@link https://github.com/y14e/attribute-utils}
|
|
595
595
|
*)
|
|
596
596
|
|
|
597
597
|
power-focusable/dist/index.js:
|
|
@@ -600,7 +600,7 @@ power-focusable/dist/index.js:
|
|
|
600
600
|
* High-precision focus management utility with full composed tree support.
|
|
601
601
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
602
602
|
*
|
|
603
|
-
* @version 4.3.
|
|
603
|
+
* @version 4.3.26
|
|
604
604
|
* @author Yusuke Kamiyamane
|
|
605
605
|
* @license MIT
|
|
606
606
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var utils = require('@y14e/attribute-utils');
|
|
4
4
|
var pf = require('power-focusable');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
|
|
|
21
21
|
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var utils__namespace = /*#__PURE__*/_interopNamespace(utils);
|
|
25
25
|
var pf__namespace = /*#__PURE__*/_interopNamespace(pf);
|
|
26
26
|
|
|
27
27
|
// src/index.ts
|
|
@@ -78,7 +78,7 @@ var Portal = class {
|
|
|
78
78
|
this.#isDestroyed = true;
|
|
79
79
|
this.#controller?.abort();
|
|
80
80
|
this.#controller = null;
|
|
81
|
-
|
|
81
|
+
utils__namespace.restoreAttributes([...this.#focusables]);
|
|
82
82
|
this.#focusables.clear();
|
|
83
83
|
this.#exitSentinel.after(this.#host);
|
|
84
84
|
this.#entranceSentinel.remove();
|
|
@@ -154,14 +154,14 @@ var Portal = class {
|
|
|
154
154
|
]);
|
|
155
155
|
for (const focusable of this.#focusables) {
|
|
156
156
|
if (!current.has(focusable)) {
|
|
157
|
-
|
|
157
|
+
utils__namespace.restoreAttributes(focusable);
|
|
158
158
|
this.#focusables.delete(focusable);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
for (const focusable of current) {
|
|
162
162
|
if (!this.#focusables.has(focusable)) {
|
|
163
163
|
this.#focusables.add(focusable);
|
|
164
|
-
|
|
164
|
+
utils__namespace.saveAttributes(focusable, "tabindex");
|
|
165
165
|
focusable.setAttribute("tabindex", "-1");
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -209,7 +209,7 @@ function containsComposed(container, element) {
|
|
|
209
209
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
210
210
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
211
211
|
*
|
|
212
|
-
* @version 1.3.
|
|
212
|
+
* @version 1.3.3
|
|
213
213
|
* @author Yusuke Kamiyamane
|
|
214
214
|
* @license MIT
|
|
215
215
|
* @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.3.
|
|
6
|
+
* @version 1.3.3
|
|
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.3.
|
|
6
|
+
* @version 1.3.3
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as utils from '@y14e/attribute-utils';
|
|
2
2
|
import * as pf from 'power-focusable';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
@@ -55,7 +55,7 @@ var Portal = class {
|
|
|
55
55
|
this.#isDestroyed = true;
|
|
56
56
|
this.#controller?.abort();
|
|
57
57
|
this.#controller = null;
|
|
58
|
-
|
|
58
|
+
utils.restoreAttributes([...this.#focusables]);
|
|
59
59
|
this.#focusables.clear();
|
|
60
60
|
this.#exitSentinel.after(this.#host);
|
|
61
61
|
this.#entranceSentinel.remove();
|
|
@@ -131,14 +131,14 @@ var Portal = class {
|
|
|
131
131
|
]);
|
|
132
132
|
for (const focusable of this.#focusables) {
|
|
133
133
|
if (!current.has(focusable)) {
|
|
134
|
-
|
|
134
|
+
utils.restoreAttributes(focusable);
|
|
135
135
|
this.#focusables.delete(focusable);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
for (const focusable of current) {
|
|
139
139
|
if (!this.#focusables.has(focusable)) {
|
|
140
140
|
this.#focusables.add(focusable);
|
|
141
|
-
|
|
141
|
+
utils.saveAttributes(focusable, "tabindex");
|
|
142
142
|
focusable.setAttribute("tabindex", "-1");
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -186,7 +186,7 @@ function containsComposed(container, element) {
|
|
|
186
186
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
187
187
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
188
188
|
*
|
|
189
|
-
* @version 1.3.
|
|
189
|
+
* @version 1.3.3
|
|
190
190
|
* @author Yusuke Kamiyamane
|
|
191
191
|
* @license MIT
|
|
192
192
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/portal",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -54,8 +54,11 @@
|
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=18"
|
|
56
56
|
},
|
|
57
|
+
"allowScripts": {
|
|
58
|
+
"esbuild": true
|
|
59
|
+
},
|
|
57
60
|
"dependencies": {
|
|
58
|
-
"@y14e/attribute-
|
|
59
|
-
"power-focusable": "^4.3.
|
|
61
|
+
"@y14e/attribute-utils": "^2.0.5",
|
|
62
|
+
"power-focusable": "^4.3.26"
|
|
60
63
|
}
|
|
61
64
|
}
|