@y14e/portal 1.2.7 → 1.2.8
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/dist/index.cjs +18 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -36,15 +36,19 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
36
36
|
}
|
|
37
37
|
let { composed = false, filter, include } = options;
|
|
38
38
|
if (typeof composed !== "boolean") {
|
|
39
|
-
console.warn("Invalid composed. Fallback: false.");
|
|
39
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
40
40
|
composed = false;
|
|
41
41
|
}
|
|
42
42
|
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
43
|
-
console.warn(
|
|
43
|
+
console.warn(
|
|
44
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
45
|
+
);
|
|
44
46
|
filter = void 0;
|
|
45
47
|
}
|
|
46
48
|
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
47
|
-
console.warn(
|
|
49
|
+
console.warn(
|
|
50
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
51
|
+
);
|
|
48
52
|
include = void 0;
|
|
49
53
|
}
|
|
50
54
|
const elements = [];
|
|
@@ -139,19 +143,23 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
139
143
|
return null;
|
|
140
144
|
}
|
|
141
145
|
if (typeof composed !== "boolean") {
|
|
142
|
-
console.warn("Invalid composed. Fallback: false.");
|
|
146
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
143
147
|
composed = false;
|
|
144
148
|
}
|
|
145
149
|
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
146
|
-
console.warn(
|
|
150
|
+
console.warn(
|
|
151
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
152
|
+
);
|
|
147
153
|
filter = void 0;
|
|
148
154
|
}
|
|
149
155
|
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
150
|
-
console.warn(
|
|
156
|
+
console.warn(
|
|
157
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
158
|
+
);
|
|
151
159
|
include = void 0;
|
|
152
160
|
}
|
|
153
161
|
if (typeof wrap !== "boolean") {
|
|
154
|
-
console.warn("Invalid wrap. Fallback: false.");
|
|
162
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
155
163
|
wrap = false;
|
|
156
164
|
}
|
|
157
165
|
const focusables = getFocusables(container, { composed, filter, include });
|
|
@@ -443,9 +451,7 @@ var Portal = class {
|
|
|
443
451
|
if (current.has(focusable)) {
|
|
444
452
|
continue;
|
|
445
453
|
}
|
|
446
|
-
|
|
447
|
-
restoreAttributes([focusable]);
|
|
448
|
-
}
|
|
454
|
+
focusable.isConnected && restoreAttributes([focusable]);
|
|
449
455
|
this.#focusables.delete(focusable);
|
|
450
456
|
}
|
|
451
457
|
for (const focusable of current) {
|
|
@@ -510,7 +516,7 @@ function getActiveElement2() {
|
|
|
510
516
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
511
517
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
512
518
|
*
|
|
513
|
-
* @version 1.2.
|
|
519
|
+
* @version 1.2.8
|
|
514
520
|
* @author Yusuke Kamiyamane
|
|
515
521
|
* @license MIT
|
|
516
522
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -535,7 +541,7 @@ power-focusable/dist/index.js:
|
|
|
535
541
|
* High-precision focus management utility with full composed tree support.
|
|
536
542
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
537
543
|
*
|
|
538
|
-
* @version 4.1.
|
|
544
|
+
* @version 4.1.8
|
|
539
545
|
* @author Yusuke Kamiyamane
|
|
540
546
|
* @license MIT
|
|
541
547
|
* @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.8
|
|
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.8
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -34,15 +34,19 @@ function getFocusables(container = document.body, options = {}) {
|
|
|
34
34
|
}
|
|
35
35
|
let { composed = false, filter, include } = options;
|
|
36
36
|
if (typeof composed !== "boolean") {
|
|
37
|
-
console.warn("Invalid composed. Fallback: false.");
|
|
37
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
38
38
|
composed = false;
|
|
39
39
|
}
|
|
40
40
|
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
41
|
-
console.warn(
|
|
41
|
+
console.warn(
|
|
42
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
43
|
+
);
|
|
42
44
|
filter = void 0;
|
|
43
45
|
}
|
|
44
46
|
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
45
|
-
console.warn(
|
|
47
|
+
console.warn(
|
|
48
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
49
|
+
);
|
|
46
50
|
include = void 0;
|
|
47
51
|
}
|
|
48
52
|
const elements = [];
|
|
@@ -137,19 +141,23 @@ function getRelativeFocusable(container, offset, options) {
|
|
|
137
141
|
return null;
|
|
138
142
|
}
|
|
139
143
|
if (typeof composed !== "boolean") {
|
|
140
|
-
console.warn("Invalid composed. Fallback: false.");
|
|
144
|
+
console.warn("Invalid composed option. Fallback: false.");
|
|
141
145
|
composed = false;
|
|
142
146
|
}
|
|
143
147
|
if (typeof filter !== "undefined" && typeof filter !== "function") {
|
|
144
|
-
console.warn(
|
|
148
|
+
console.warn(
|
|
149
|
+
"Invalid filter function. Fallback: no filter function (undefined)."
|
|
150
|
+
);
|
|
145
151
|
filter = void 0;
|
|
146
152
|
}
|
|
147
153
|
if (typeof include !== "undefined" && typeof include !== "function") {
|
|
148
|
-
console.warn(
|
|
154
|
+
console.warn(
|
|
155
|
+
"Invalid include function. Fallback: no include function (undefined)."
|
|
156
|
+
);
|
|
149
157
|
include = void 0;
|
|
150
158
|
}
|
|
151
159
|
if (typeof wrap !== "boolean") {
|
|
152
|
-
console.warn("Invalid wrap. Fallback: false.");
|
|
160
|
+
console.warn("Invalid wrap option. Fallback: false.");
|
|
153
161
|
wrap = false;
|
|
154
162
|
}
|
|
155
163
|
const focusables = getFocusables(container, { composed, filter, include });
|
|
@@ -441,9 +449,7 @@ var Portal = class {
|
|
|
441
449
|
if (current.has(focusable)) {
|
|
442
450
|
continue;
|
|
443
451
|
}
|
|
444
|
-
|
|
445
|
-
restoreAttributes([focusable]);
|
|
446
|
-
}
|
|
452
|
+
focusable.isConnected && restoreAttributes([focusable]);
|
|
447
453
|
this.#focusables.delete(focusable);
|
|
448
454
|
}
|
|
449
455
|
for (const focusable of current) {
|
|
@@ -508,7 +514,7 @@ function getActiveElement2() {
|
|
|
508
514
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
509
515
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
510
516
|
*
|
|
511
|
-
* @version 1.2.
|
|
517
|
+
* @version 1.2.8
|
|
512
518
|
* @author Yusuke Kamiyamane
|
|
513
519
|
* @license MIT
|
|
514
520
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -533,7 +539,7 @@ power-focusable/dist/index.js:
|
|
|
533
539
|
* High-precision focus management utility with full composed tree support.
|
|
534
540
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
535
541
|
*
|
|
536
|
-
* @version 4.1.
|
|
542
|
+
* @version 4.1.8
|
|
537
543
|
* @author Yusuke Kamiyamane
|
|
538
544
|
* @license MIT
|
|
539
545
|
* @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.8",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@y14e/attributes-utils": "^1.0.5",
|
|
51
51
|
"bun-types": "latest",
|
|
52
|
-
"power-focusable": "^4.1.
|
|
52
|
+
"power-focusable": "^4.1.8",
|
|
53
53
|
"tsup": "^8.0.0",
|
|
54
54
|
"typescript": "^5.6.0"
|
|
55
55
|
},
|