@y14e/portal 1.2.6 → 1.2.7
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 +8 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9,11 +9,7 @@ function restoreAttributes(elements) {
|
|
|
9
9
|
continue;
|
|
10
10
|
}
|
|
11
11
|
for (const [attribute, value] of snapshot.entries()) {
|
|
12
|
-
|
|
13
|
-
element.removeAttribute(attribute);
|
|
14
|
-
} else {
|
|
15
|
-
element.setAttribute(attribute, value);
|
|
16
|
-
}
|
|
12
|
+
value === null ? element.removeAttribute(attribute) : element.setAttribute(attribute, value);
|
|
17
13
|
}
|
|
18
14
|
snapshots.delete(element);
|
|
19
15
|
}
|
|
@@ -452,13 +448,13 @@ var Portal = class {
|
|
|
452
448
|
}
|
|
453
449
|
this.#focusables.delete(focusable);
|
|
454
450
|
}
|
|
455
|
-
for (const
|
|
456
|
-
if (this.#focusables.has(
|
|
451
|
+
for (const focusable of current) {
|
|
452
|
+
if (this.#focusables.has(focusable)) {
|
|
457
453
|
continue;
|
|
458
454
|
}
|
|
459
|
-
this.#focusables.add(
|
|
460
|
-
saveAttributes([
|
|
461
|
-
|
|
455
|
+
this.#focusables.add(focusable);
|
|
456
|
+
saveAttributes([focusable], ["tabindex"]);
|
|
457
|
+
focusable.setAttribute("tabindex", "-1");
|
|
462
458
|
}
|
|
463
459
|
}
|
|
464
460
|
#createSentinel() {
|
|
@@ -514,7 +510,7 @@ function getActiveElement2() {
|
|
|
514
510
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
515
511
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
516
512
|
*
|
|
517
|
-
* @version 1.2.
|
|
513
|
+
* @version 1.2.7
|
|
518
514
|
* @author Yusuke Kamiyamane
|
|
519
515
|
* @license MIT
|
|
520
516
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -526,7 +522,7 @@ function getActiveElement2() {
|
|
|
526
522
|
(**
|
|
527
523
|
* Attributes Utils
|
|
528
524
|
*
|
|
529
|
-
* @version 1.0.
|
|
525
|
+
* @version 1.0.5
|
|
530
526
|
* @author Yusuke Kamiyamane
|
|
531
527
|
* @license MIT
|
|
532
528
|
* @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.7
|
|
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.7
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -7,11 +7,7 @@ function restoreAttributes(elements) {
|
|
|
7
7
|
continue;
|
|
8
8
|
}
|
|
9
9
|
for (const [attribute, value] of snapshot.entries()) {
|
|
10
|
-
|
|
11
|
-
element.removeAttribute(attribute);
|
|
12
|
-
} else {
|
|
13
|
-
element.setAttribute(attribute, value);
|
|
14
|
-
}
|
|
10
|
+
value === null ? element.removeAttribute(attribute) : element.setAttribute(attribute, value);
|
|
15
11
|
}
|
|
16
12
|
snapshots.delete(element);
|
|
17
13
|
}
|
|
@@ -450,13 +446,13 @@ var Portal = class {
|
|
|
450
446
|
}
|
|
451
447
|
this.#focusables.delete(focusable);
|
|
452
448
|
}
|
|
453
|
-
for (const
|
|
454
|
-
if (this.#focusables.has(
|
|
449
|
+
for (const focusable of current) {
|
|
450
|
+
if (this.#focusables.has(focusable)) {
|
|
455
451
|
continue;
|
|
456
452
|
}
|
|
457
|
-
this.#focusables.add(
|
|
458
|
-
saveAttributes([
|
|
459
|
-
|
|
453
|
+
this.#focusables.add(focusable);
|
|
454
|
+
saveAttributes([focusable], ["tabindex"]);
|
|
455
|
+
focusable.setAttribute("tabindex", "-1");
|
|
460
456
|
}
|
|
461
457
|
}
|
|
462
458
|
#createSentinel() {
|
|
@@ -512,7 +508,7 @@ function getActiveElement2() {
|
|
|
512
508
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
513
509
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
514
510
|
*
|
|
515
|
-
* @version 1.2.
|
|
511
|
+
* @version 1.2.7
|
|
516
512
|
* @author Yusuke Kamiyamane
|
|
517
513
|
* @license MIT
|
|
518
514
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -524,7 +520,7 @@ function getActiveElement2() {
|
|
|
524
520
|
(**
|
|
525
521
|
* Attributes Utils
|
|
526
522
|
*
|
|
527
|
-
* @version 1.0.
|
|
523
|
+
* @version 1.0.5
|
|
528
524
|
* @author Yusuke Kamiyamane
|
|
529
525
|
* @license MIT
|
|
530
526
|
* @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.7",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/y14e/portal#readme",
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@y14e/attributes-utils": "^1.0.
|
|
50
|
+
"@y14e/attributes-utils": "^1.0.5",
|
|
51
51
|
"bun-types": "latest",
|
|
52
52
|
"power-focusable": "^4.1.7",
|
|
53
53
|
"tsup": "^8.0.0",
|