power-focusable 4.3.21 → 4.3.22
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.cjs +9 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
} from 'power-focusable';
|
|
25
25
|
|
|
26
26
|
// CDNs
|
|
27
|
-
import { ... } 'https://esm.sh/power-focusable@4.3.
|
|
27
|
+
import { ... } 'https://esm.sh/power-focusable@4.3.22';
|
|
28
28
|
// or
|
|
29
|
-
import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.
|
|
29
|
+
import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.22/+esm';
|
|
30
30
|
// or
|
|
31
|
-
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.
|
|
31
|
+
import { ... } 'https://esm.unpkg.com/power-focusable@4.3.22';
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## 🪄 Options
|
package/dist/index.cjs
CHANGED
|
@@ -149,21 +149,22 @@ function inertOutside(element) {
|
|
|
149
149
|
return () => {
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function traverse(node,
|
|
152
|
+
function traverse(node, fn) {
|
|
153
153
|
const parent = getComposedParent(node);
|
|
154
154
|
if (parent) {
|
|
155
155
|
for (const sibling of getComposedSiblings(node)) {
|
|
156
|
-
|
|
156
|
+
fn(sibling);
|
|
157
157
|
}
|
|
158
|
-
traverse(parent,
|
|
158
|
+
traverse(parent, fn);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
const elements = [];
|
|
162
162
|
traverse(element, (node) => node && applyInert(node) && elements.push(node));
|
|
163
163
|
return () => {
|
|
164
|
-
elements.
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
for (let i = 0, l = elements.length; i < l; i++) {
|
|
165
|
+
const element2 = elements[i];
|
|
166
|
+
element2 && restoreInert(element2);
|
|
167
|
+
}
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
170
|
function isFocusable(element, options = {}) {
|
|
@@ -438,7 +439,7 @@ function applyInert(element) {
|
|
|
438
439
|
if (!isInert(element) || inertRefCounts.has(element)) {
|
|
439
440
|
const count = inertRefCounts.get(element) ?? 0;
|
|
440
441
|
inertRefCounts.set(element, count + 1);
|
|
441
|
-
count
|
|
442
|
+
!count && element.setAttribute("inert", "");
|
|
442
443
|
return true;
|
|
443
444
|
} else {
|
|
444
445
|
return false;
|
|
@@ -494,7 +495,7 @@ function isUngroupedRadio(element) {
|
|
|
494
495
|
* High-precision focus management utility with full composed tree support.
|
|
495
496
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
496
497
|
*
|
|
497
|
-
* @version 4.3.
|
|
498
|
+
* @version 4.3.22
|
|
498
499
|
* @author Yusuke Kamiyamane
|
|
499
500
|
* @license MIT
|
|
500
501
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-precision focus management utility with full composed tree support.
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
5
5
|
*
|
|
6
|
-
* @version 4.3.
|
|
6
|
+
* @version 4.3.22
|
|
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
|
* High-precision focus management utility with full composed tree support.
|
|
4
4
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
5
5
|
*
|
|
6
|
-
* @version 4.3.
|
|
6
|
+
* @version 4.3.22
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -147,21 +147,22 @@ function inertOutside(element) {
|
|
|
147
147
|
return () => {
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function traverse(node,
|
|
150
|
+
function traverse(node, fn) {
|
|
151
151
|
const parent = getComposedParent(node);
|
|
152
152
|
if (parent) {
|
|
153
153
|
for (const sibling of getComposedSiblings(node)) {
|
|
154
|
-
|
|
154
|
+
fn(sibling);
|
|
155
155
|
}
|
|
156
|
-
traverse(parent,
|
|
156
|
+
traverse(parent, fn);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
const elements = [];
|
|
160
160
|
traverse(element, (node) => node && applyInert(node) && elements.push(node));
|
|
161
161
|
return () => {
|
|
162
|
-
elements.
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
for (let i = 0, l = elements.length; i < l; i++) {
|
|
163
|
+
const element2 = elements[i];
|
|
164
|
+
element2 && restoreInert(element2);
|
|
165
|
+
}
|
|
165
166
|
};
|
|
166
167
|
}
|
|
167
168
|
function isFocusable(element, options = {}) {
|
|
@@ -436,7 +437,7 @@ function applyInert(element) {
|
|
|
436
437
|
if (!isInert(element) || inertRefCounts.has(element)) {
|
|
437
438
|
const count = inertRefCounts.get(element) ?? 0;
|
|
438
439
|
inertRefCounts.set(element, count + 1);
|
|
439
|
-
count
|
|
440
|
+
!count && element.setAttribute("inert", "");
|
|
440
441
|
return true;
|
|
441
442
|
} else {
|
|
442
443
|
return false;
|
|
@@ -492,7 +493,7 @@ function isUngroupedRadio(element) {
|
|
|
492
493
|
* High-precision focus management utility with full composed tree support.
|
|
493
494
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
494
495
|
*
|
|
495
|
-
* @version 4.3.
|
|
496
|
+
* @version 4.3.22
|
|
496
497
|
* @author Yusuke Kamiyamane
|
|
497
498
|
* @license MIT
|
|
498
499
|
* @copyright Copyright (c) Yusuke Kamiyamane
|