@y14e/portal 1.2.31 → 1.2.32
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 +79 -47
- package/dist/index.bundle.js +79 -47
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- 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.32';
|
|
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.32/+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.32';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
4
4
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
function restoreAttributes(
|
|
6
|
-
for (const element of
|
|
5
|
+
function restoreAttributes(element_or_elements) {
|
|
6
|
+
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
7
7
|
const snapshot = snapshots.get(element);
|
|
8
8
|
if (!snapshot) {
|
|
9
9
|
continue;
|
|
@@ -14,8 +14,9 @@ function restoreAttributes(elements) {
|
|
|
14
14
|
snapshots.delete(element);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function saveAttributes(
|
|
18
|
-
|
|
17
|
+
function saveAttributes(element_or_elements, attribute_or_attributes) {
|
|
18
|
+
const attributes = Array.isArray(attribute_or_attributes) ? attribute_or_attributes : [attribute_or_attributes];
|
|
19
|
+
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
19
20
|
let snapshot = snapshots.get(element);
|
|
20
21
|
if (!snapshot) {
|
|
21
22
|
snapshot = /* @__PURE__ */ new Map();
|
|
@@ -29,6 +30,10 @@ function saveAttributes(elements, attributes) {
|
|
|
29
30
|
|
|
30
31
|
// node_modules/power-focusable/dist/index.js
|
|
31
32
|
var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
|
|
33
|
+
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
34
|
+
/(,\s*)?\[tabindex="-1"\]/g,
|
|
35
|
+
""
|
|
36
|
+
);
|
|
32
37
|
function getFocusables(container = document.body, options = {}) {
|
|
33
38
|
if (!(container instanceof Element)) {
|
|
34
39
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
@@ -65,36 +70,43 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
65
70
|
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
66
71
|
skipVisibilityCheck = false;
|
|
67
72
|
}
|
|
68
|
-
const
|
|
73
|
+
const candidates = [];
|
|
69
74
|
if (composed || include) {
|
|
70
75
|
let traverse2 = function(node) {
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
if (isFocusable(node, {
|
|
77
|
+
skipNegativeTabIndexCheck,
|
|
78
|
+
skipVisibilityCheck
|
|
79
|
+
}) || include?.(node)) {
|
|
80
|
+
candidates[candidates.length] = node;
|
|
76
81
|
}
|
|
77
|
-
const
|
|
78
|
-
for (let i = 0, l =
|
|
79
|
-
const child =
|
|
82
|
+
const children2 = composed ? getComposedChildren(node) : getChildren(node);
|
|
83
|
+
for (let i = 0, l = children2.length; i < l; i++) {
|
|
84
|
+
const child = children2[i];
|
|
80
85
|
child && traverse2(child);
|
|
81
86
|
}
|
|
82
87
|
};
|
|
83
|
-
|
|
88
|
+
const children = composed ? getComposedChildren(container) : getChildren(container);
|
|
89
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
90
|
+
const child = children[i];
|
|
91
|
+
child && traverse2(child);
|
|
92
|
+
}
|
|
84
93
|
} else {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
const matches = container.querySelectorAll(
|
|
95
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
96
|
+
);
|
|
97
|
+
for (let i = 0, l = matches.length; i < l; i++) {
|
|
98
|
+
const matched = matches[i];
|
|
99
|
+
if (matched && isFocusable(matched, {
|
|
89
100
|
skipNegativeTabIndexCheck,
|
|
90
101
|
skipVisibilityCheck
|
|
91
102
|
})) {
|
|
92
|
-
|
|
103
|
+
candidates[candidates.length] = matched;
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
}
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
return normalizeRadioGroup(
|
|
108
|
+
sortByTabIndex(filter ? candidates.filter(filter) : candidates)
|
|
109
|
+
);
|
|
98
110
|
}
|
|
99
111
|
function getNextFocusable(container = document.body, options = {}) {
|
|
100
112
|
return getRelativeFocusable(container, 1, options);
|
|
@@ -123,7 +135,7 @@ function isFocusable(element, options = {}) {
|
|
|
123
135
|
return false;
|
|
124
136
|
}
|
|
125
137
|
if (!element.matches(
|
|
126
|
-
skipNegativeTabIndexCheck ?
|
|
138
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
127
139
|
)) {
|
|
128
140
|
return false;
|
|
129
141
|
}
|
|
@@ -195,23 +207,23 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
195
207
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
196
208
|
wrap = false;
|
|
197
209
|
}
|
|
198
|
-
const settings = {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
210
|
+
const settings = {
|
|
211
|
+
composed,
|
|
212
|
+
filter,
|
|
213
|
+
include,
|
|
214
|
+
skipNegativeTabIndexCheck,
|
|
215
|
+
skipVisibilityCheck
|
|
216
|
+
};
|
|
205
217
|
const focusables = getFocusables(container, settings);
|
|
206
218
|
const { length } = focusables;
|
|
207
219
|
if (!length) {
|
|
208
220
|
return null;
|
|
209
221
|
}
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
222
|
+
const anchorIndex = focusables.indexOf(anchor);
|
|
223
|
+
if (anchorIndex === -1) {
|
|
212
224
|
return null;
|
|
213
225
|
}
|
|
214
|
-
const offsetIndex =
|
|
226
|
+
const offsetIndex = anchorIndex + offset;
|
|
215
227
|
if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
|
|
216
228
|
return null;
|
|
217
229
|
}
|
|
@@ -259,22 +271,42 @@ function normalizeRadioGroup(elements) {
|
|
|
259
271
|
if (!map) {
|
|
260
272
|
map = /* @__PURE__ */ new Map();
|
|
261
273
|
}
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
if (
|
|
265
|
-
|
|
274
|
+
const root = element.getRootNode();
|
|
275
|
+
let value = map.get(root);
|
|
276
|
+
if (!value) {
|
|
277
|
+
value = /* @__PURE__ */ new Map();
|
|
278
|
+
map.set(root, value);
|
|
279
|
+
}
|
|
280
|
+
let v = value.get(element.form);
|
|
281
|
+
if (!v) {
|
|
282
|
+
v = /* @__PURE__ */ new Map();
|
|
283
|
+
value.set(element.form, v);
|
|
266
284
|
}
|
|
285
|
+
let vv = v.get(element.name);
|
|
286
|
+
if (!vv) {
|
|
287
|
+
vv = [];
|
|
288
|
+
v.set(element.name, vv);
|
|
289
|
+
}
|
|
290
|
+
vv[vv.length] = element;
|
|
267
291
|
}
|
|
268
292
|
if (!map) {
|
|
269
293
|
return elements;
|
|
270
294
|
}
|
|
271
295
|
const placeholder = /* @__PURE__ */ new Set();
|
|
272
|
-
for (const
|
|
273
|
-
|
|
296
|
+
for (const value of map.values()) {
|
|
297
|
+
for (const v of value.values()) {
|
|
298
|
+
for (const vv of v.values()) {
|
|
299
|
+
const radio = vv.find((element) => element.checked) ?? vv[0];
|
|
300
|
+
radio && placeholder.add(radio);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
274
303
|
}
|
|
275
|
-
return elements.filter(
|
|
276
|
-
|
|
277
|
-
|
|
304
|
+
return elements.filter((element) => {
|
|
305
|
+
if (!(element instanceof HTMLInputElement)) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return !isUngroupedRadio(element) || placeholder.has(element);
|
|
309
|
+
});
|
|
278
310
|
}
|
|
279
311
|
function sortByTabIndex(elements) {
|
|
280
312
|
const ordered = [];
|
|
@@ -357,7 +389,7 @@ function isInert(element) {
|
|
|
357
389
|
return "inert" in element && !!element.inert;
|
|
358
390
|
}
|
|
359
391
|
function isUngroupedRadio(element) {
|
|
360
|
-
return element
|
|
392
|
+
return element.type === "radio" && !!element.name;
|
|
361
393
|
}
|
|
362
394
|
|
|
363
395
|
// src/index.ts
|
|
@@ -483,14 +515,14 @@ var Portal = class {
|
|
|
483
515
|
]);
|
|
484
516
|
for (const focusable of this.#focusables) {
|
|
485
517
|
if (!current.has(focusable)) {
|
|
486
|
-
|
|
518
|
+
restoreAttributes(focusable);
|
|
487
519
|
this.#focusables.delete(focusable);
|
|
488
520
|
}
|
|
489
521
|
}
|
|
490
522
|
for (const focusable of current) {
|
|
491
523
|
if (!this.#focusables.has(focusable)) {
|
|
492
524
|
this.#focusables.add(focusable);
|
|
493
|
-
saveAttributes(
|
|
525
|
+
saveAttributes(focusable, "tabindex");
|
|
494
526
|
focusable.setAttribute("tabindex", "-1");
|
|
495
527
|
}
|
|
496
528
|
}
|
|
@@ -536,7 +568,7 @@ function containsComposed2(container, element) {
|
|
|
536
568
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
537
569
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
538
570
|
*
|
|
539
|
-
* @version 1.2.
|
|
571
|
+
* @version 1.2.32
|
|
540
572
|
* @author Yusuke Kamiyamane
|
|
541
573
|
* @license MIT
|
|
542
574
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -548,7 +580,7 @@ function containsComposed2(container, element) {
|
|
|
548
580
|
(**
|
|
549
581
|
* Attributes Utils
|
|
550
582
|
*
|
|
551
|
-
* @version 1.1.
|
|
583
|
+
* @version 1.1.4
|
|
552
584
|
* @author Yusuke Kamiyamane
|
|
553
585
|
* @license MIT
|
|
554
586
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -561,7 +593,7 @@ power-focusable/dist/index.js:
|
|
|
561
593
|
* High-precision focus management utility with full composed tree support.
|
|
562
594
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
563
595
|
*
|
|
564
|
-
* @version 4.3.
|
|
596
|
+
* @version 4.3.21
|
|
565
597
|
* @author Yusuke Kamiyamane
|
|
566
598
|
* @license MIT
|
|
567
599
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
2
2
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
3
|
-
function restoreAttributes(
|
|
4
|
-
for (const element of
|
|
3
|
+
function restoreAttributes(element_or_elements) {
|
|
4
|
+
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
5
5
|
const snapshot = snapshots.get(element);
|
|
6
6
|
if (!snapshot) {
|
|
7
7
|
continue;
|
|
@@ -12,8 +12,9 @@ function restoreAttributes(elements) {
|
|
|
12
12
|
snapshots.delete(element);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function saveAttributes(
|
|
16
|
-
|
|
15
|
+
function saveAttributes(element_or_elements, attribute_or_attributes) {
|
|
16
|
+
const attributes = Array.isArray(attribute_or_attributes) ? attribute_or_attributes : [attribute_or_attributes];
|
|
17
|
+
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
17
18
|
let snapshot = snapshots.get(element);
|
|
18
19
|
if (!snapshot) {
|
|
19
20
|
snapshot = /* @__PURE__ */ new Map();
|
|
@@ -27,6 +28,10 @@ function saveAttributes(elements, attributes) {
|
|
|
27
28
|
|
|
28
29
|
// node_modules/power-focusable/dist/index.js
|
|
29
30
|
var FOCUSABLE_SELECTOR = `:is(a[href], area[href], button, embed, iframe, input:not([type="hidden" i]), object, select, details > summary:first-of-type, textarea, [contenteditable]:not([contenteditable="false" i]), [controls], [tabindex]):not(:disabled, [hidden], [inert], [tabindex="-1"])`;
|
|
31
|
+
var FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX = FOCUSABLE_SELECTOR.replace(
|
|
32
|
+
/(,\s*)?\[tabindex="-1"\]/g,
|
|
33
|
+
""
|
|
34
|
+
);
|
|
30
35
|
function getFocusables(container = document.body, options = {}) {
|
|
31
36
|
if (!(container instanceof Element)) {
|
|
32
37
|
console.warn("Invalid container element. Fallback: <body> element.");
|
|
@@ -63,36 +68,43 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
63
68
|
console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
|
|
64
69
|
skipVisibilityCheck = false;
|
|
65
70
|
}
|
|
66
|
-
const
|
|
71
|
+
const candidates = [];
|
|
67
72
|
if (composed || include) {
|
|
68
73
|
let traverse2 = function(node) {
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
if (isFocusable(node, {
|
|
75
|
+
skipNegativeTabIndexCheck,
|
|
76
|
+
skipVisibilityCheck
|
|
77
|
+
}) || include?.(node)) {
|
|
78
|
+
candidates[candidates.length] = node;
|
|
74
79
|
}
|
|
75
|
-
const
|
|
76
|
-
for (let i = 0, l =
|
|
77
|
-
const child =
|
|
80
|
+
const children2 = composed ? getComposedChildren(node) : getChildren(node);
|
|
81
|
+
for (let i = 0, l = children2.length; i < l; i++) {
|
|
82
|
+
const child = children2[i];
|
|
78
83
|
child && traverse2(child);
|
|
79
84
|
}
|
|
80
85
|
};
|
|
81
|
-
|
|
86
|
+
const children = composed ? getComposedChildren(container) : getChildren(container);
|
|
87
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
88
|
+
const child = children[i];
|
|
89
|
+
child && traverse2(child);
|
|
90
|
+
}
|
|
82
91
|
} else {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
const matches = container.querySelectorAll(
|
|
93
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
94
|
+
);
|
|
95
|
+
for (let i = 0, l = matches.length; i < l; i++) {
|
|
96
|
+
const matched = matches[i];
|
|
97
|
+
if (matched && isFocusable(matched, {
|
|
87
98
|
skipNegativeTabIndexCheck,
|
|
88
99
|
skipVisibilityCheck
|
|
89
100
|
})) {
|
|
90
|
-
|
|
101
|
+
candidates[candidates.length] = matched;
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
return normalizeRadioGroup(
|
|
106
|
+
sortByTabIndex(filter ? candidates.filter(filter) : candidates)
|
|
107
|
+
);
|
|
96
108
|
}
|
|
97
109
|
function getNextFocusable(container = document.body, options = {}) {
|
|
98
110
|
return getRelativeFocusable(container, 1, options);
|
|
@@ -121,7 +133,7 @@ function isFocusable(element, options = {}) {
|
|
|
121
133
|
return false;
|
|
122
134
|
}
|
|
123
135
|
if (!element.matches(
|
|
124
|
-
skipNegativeTabIndexCheck ?
|
|
136
|
+
skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
|
|
125
137
|
)) {
|
|
126
138
|
return false;
|
|
127
139
|
}
|
|
@@ -193,23 +205,23 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
193
205
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
194
206
|
wrap = false;
|
|
195
207
|
}
|
|
196
|
-
const settings = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
208
|
+
const settings = {
|
|
209
|
+
composed,
|
|
210
|
+
filter,
|
|
211
|
+
include,
|
|
212
|
+
skipNegativeTabIndexCheck,
|
|
213
|
+
skipVisibilityCheck
|
|
214
|
+
};
|
|
203
215
|
const focusables = getFocusables(container, settings);
|
|
204
216
|
const { length } = focusables;
|
|
205
217
|
if (!length) {
|
|
206
218
|
return null;
|
|
207
219
|
}
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
220
|
+
const anchorIndex = focusables.indexOf(anchor);
|
|
221
|
+
if (anchorIndex === -1) {
|
|
210
222
|
return null;
|
|
211
223
|
}
|
|
212
|
-
const offsetIndex =
|
|
224
|
+
const offsetIndex = anchorIndex + offset;
|
|
213
225
|
if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
|
|
214
226
|
return null;
|
|
215
227
|
}
|
|
@@ -257,22 +269,42 @@ function normalizeRadioGroup(elements) {
|
|
|
257
269
|
if (!map) {
|
|
258
270
|
map = /* @__PURE__ */ new Map();
|
|
259
271
|
}
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
if (
|
|
263
|
-
|
|
272
|
+
const root = element.getRootNode();
|
|
273
|
+
let value = map.get(root);
|
|
274
|
+
if (!value) {
|
|
275
|
+
value = /* @__PURE__ */ new Map();
|
|
276
|
+
map.set(root, value);
|
|
277
|
+
}
|
|
278
|
+
let v = value.get(element.form);
|
|
279
|
+
if (!v) {
|
|
280
|
+
v = /* @__PURE__ */ new Map();
|
|
281
|
+
value.set(element.form, v);
|
|
264
282
|
}
|
|
283
|
+
let vv = v.get(element.name);
|
|
284
|
+
if (!vv) {
|
|
285
|
+
vv = [];
|
|
286
|
+
v.set(element.name, vv);
|
|
287
|
+
}
|
|
288
|
+
vv[vv.length] = element;
|
|
265
289
|
}
|
|
266
290
|
if (!map) {
|
|
267
291
|
return elements;
|
|
268
292
|
}
|
|
269
293
|
const placeholder = /* @__PURE__ */ new Set();
|
|
270
|
-
for (const
|
|
271
|
-
|
|
294
|
+
for (const value of map.values()) {
|
|
295
|
+
for (const v of value.values()) {
|
|
296
|
+
for (const vv of v.values()) {
|
|
297
|
+
const radio = vv.find((element) => element.checked) ?? vv[0];
|
|
298
|
+
radio && placeholder.add(radio);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
272
301
|
}
|
|
273
|
-
return elements.filter(
|
|
274
|
-
|
|
275
|
-
|
|
302
|
+
return elements.filter((element) => {
|
|
303
|
+
if (!(element instanceof HTMLInputElement)) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
return !isUngroupedRadio(element) || placeholder.has(element);
|
|
307
|
+
});
|
|
276
308
|
}
|
|
277
309
|
function sortByTabIndex(elements) {
|
|
278
310
|
const ordered = [];
|
|
@@ -355,7 +387,7 @@ function isInert(element) {
|
|
|
355
387
|
return "inert" in element && !!element.inert;
|
|
356
388
|
}
|
|
357
389
|
function isUngroupedRadio(element) {
|
|
358
|
-
return element
|
|
390
|
+
return element.type === "radio" && !!element.name;
|
|
359
391
|
}
|
|
360
392
|
|
|
361
393
|
// src/index.ts
|
|
@@ -481,14 +513,14 @@ var Portal = class {
|
|
|
481
513
|
]);
|
|
482
514
|
for (const focusable of this.#focusables) {
|
|
483
515
|
if (!current.has(focusable)) {
|
|
484
|
-
|
|
516
|
+
restoreAttributes(focusable);
|
|
485
517
|
this.#focusables.delete(focusable);
|
|
486
518
|
}
|
|
487
519
|
}
|
|
488
520
|
for (const focusable of current) {
|
|
489
521
|
if (!this.#focusables.has(focusable)) {
|
|
490
522
|
this.#focusables.add(focusable);
|
|
491
|
-
saveAttributes(
|
|
523
|
+
saveAttributes(focusable, "tabindex");
|
|
492
524
|
focusable.setAttribute("tabindex", "-1");
|
|
493
525
|
}
|
|
494
526
|
}
|
|
@@ -534,7 +566,7 @@ function containsComposed2(container, element) {
|
|
|
534
566
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
535
567
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
536
568
|
*
|
|
537
|
-
* @version 1.2.
|
|
569
|
+
* @version 1.2.32
|
|
538
570
|
* @author Yusuke Kamiyamane
|
|
539
571
|
* @license MIT
|
|
540
572
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -546,7 +578,7 @@ function containsComposed2(container, element) {
|
|
|
546
578
|
(**
|
|
547
579
|
* Attributes Utils
|
|
548
580
|
*
|
|
549
|
-
* @version 1.1.
|
|
581
|
+
* @version 1.1.4
|
|
550
582
|
* @author Yusuke Kamiyamane
|
|
551
583
|
* @license MIT
|
|
552
584
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -559,7 +591,7 @@ power-focusable/dist/index.js:
|
|
|
559
591
|
* High-precision focus management utility with full composed tree support.
|
|
560
592
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
561
593
|
*
|
|
562
|
-
* @version 4.3.
|
|
594
|
+
* @version 4.3.21
|
|
563
595
|
* @author Yusuke Kamiyamane
|
|
564
596
|
* @license MIT
|
|
565
597
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -126,14 +126,14 @@ var Portal = class {
|
|
|
126
126
|
]);
|
|
127
127
|
for (const focusable of this.#focusables) {
|
|
128
128
|
if (!current.has(focusable)) {
|
|
129
|
-
|
|
129
|
+
attributesUtils.restoreAttributes(focusable);
|
|
130
130
|
this.#focusables.delete(focusable);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
for (const focusable of current) {
|
|
134
134
|
if (!this.#focusables.has(focusable)) {
|
|
135
135
|
this.#focusables.add(focusable);
|
|
136
|
-
attributesUtils.saveAttributes(
|
|
136
|
+
attributesUtils.saveAttributes(focusable, "tabindex");
|
|
137
137
|
focusable.setAttribute("tabindex", "-1");
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -179,7 +179,7 @@ function containsComposed(container, element) {
|
|
|
179
179
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
180
180
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
181
181
|
*
|
|
182
|
-
* @version 1.2.
|
|
182
|
+
* @version 1.2.32
|
|
183
183
|
* @author Yusuke Kamiyamane
|
|
184
184
|
* @license MIT
|
|
185
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.
|
|
6
|
+
* @version 1.2.32
|
|
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.32
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -124,14 +124,14 @@ var Portal = class {
|
|
|
124
124
|
]);
|
|
125
125
|
for (const focusable of this.#focusables) {
|
|
126
126
|
if (!current.has(focusable)) {
|
|
127
|
-
|
|
127
|
+
restoreAttributes(focusable);
|
|
128
128
|
this.#focusables.delete(focusable);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
for (const focusable of current) {
|
|
132
132
|
if (!this.#focusables.has(focusable)) {
|
|
133
133
|
this.#focusables.add(focusable);
|
|
134
|
-
saveAttributes(
|
|
134
|
+
saveAttributes(focusable, "tabindex");
|
|
135
135
|
focusable.setAttribute("tabindex", "-1");
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -177,7 +177,7 @@ function containsComposed(container, element) {
|
|
|
177
177
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
178
178
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
179
179
|
*
|
|
180
|
-
* @version 1.2.
|
|
180
|
+
* @version 1.2.32
|
|
181
181
|
* @author Yusuke Kamiyamane
|
|
182
182
|
* @license MIT
|
|
183
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.
|
|
3
|
+
"version": "1.2.32",
|
|
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.4",
|
|
59
|
+
"power-focusable": "^4.3.21"
|
|
60
60
|
}
|
|
61
61
|
}
|