@y14e/roving-tabindex 1.2.1 → 1.2.2
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 +22 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -9
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
4
|
-
function addTokenToAttribute(element, attribute, token) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
5
|
+
const { caseInsensitive = false } = options;
|
|
6
|
+
const value = element.getAttribute(attribute)?.trim();
|
|
7
|
+
const tokens = value ? value.split(/\s+/) : [];
|
|
8
|
+
if (caseInsensitive) {
|
|
9
|
+
const lower = token.toLowerCase();
|
|
10
|
+
if (tokens.some((token2) => token2.toLowerCase() === lower)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
tokens.push(token);
|
|
14
|
+
element.setAttribute(attribute, tokens.join(" "));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const set = new Set(tokens);
|
|
18
|
+
set.add(token);
|
|
19
|
+
element.setAttribute(attribute, [...set].join(" "));
|
|
20
|
+
return;
|
|
10
21
|
}
|
|
11
22
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
12
23
|
function restoreAttributes(elements) {
|
|
@@ -421,7 +432,9 @@ var RovingTabIndex = class {
|
|
|
421
432
|
if (char) {
|
|
422
433
|
keys.add(char);
|
|
423
434
|
saveAttributes([c], ["aria-keyshortcuts"]);
|
|
424
|
-
addTokenToAttribute(c, "aria-keyshortcuts", char
|
|
435
|
+
addTokenToAttribute(c, "aria-keyshortcuts", char, {
|
|
436
|
+
caseInsensitive: true
|
|
437
|
+
});
|
|
425
438
|
}
|
|
426
439
|
keys.forEach((key) => {
|
|
427
440
|
const focusables = this.#focusablesByFirstChar.get(key) ?? [];
|
|
@@ -466,7 +479,7 @@ function getActiveElement() {
|
|
|
466
479
|
* Lightweight roving tabindex utility with fully focus management.
|
|
467
480
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
468
481
|
*
|
|
469
|
-
* @version 1.2.
|
|
482
|
+
* @version 1.2.2
|
|
470
483
|
* @author Yusuke Kamiyamane
|
|
471
484
|
* @license MIT
|
|
472
485
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -478,7 +491,7 @@ function getActiveElement() {
|
|
|
478
491
|
(**
|
|
479
492
|
* Attributes Utils
|
|
480
493
|
*
|
|
481
|
-
* @version 1.0.
|
|
494
|
+
* @version 1.0.3
|
|
482
495
|
* @author Yusuke Kamiyamane
|
|
483
496
|
* @license MIT
|
|
484
497
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Lightweight roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.2
|
|
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 roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.2
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
// node_modules/@y14e/attributes-utils/dist/index.js
|
|
2
|
-
function addTokenToAttribute(element, attribute, token) {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
3
|
+
const { caseInsensitive = false } = options;
|
|
4
|
+
const value = element.getAttribute(attribute)?.trim();
|
|
5
|
+
const tokens = value ? value.split(/\s+/) : [];
|
|
6
|
+
if (caseInsensitive) {
|
|
7
|
+
const lower = token.toLowerCase();
|
|
8
|
+
if (tokens.some((token2) => token2.toLowerCase() === lower)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
tokens.push(token);
|
|
12
|
+
element.setAttribute(attribute, tokens.join(" "));
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const set = new Set(tokens);
|
|
16
|
+
set.add(token);
|
|
17
|
+
element.setAttribute(attribute, [...set].join(" "));
|
|
18
|
+
return;
|
|
8
19
|
}
|
|
9
20
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
10
21
|
function restoreAttributes(elements) {
|
|
@@ -419,7 +430,9 @@ var RovingTabIndex = class {
|
|
|
419
430
|
if (char) {
|
|
420
431
|
keys.add(char);
|
|
421
432
|
saveAttributes([c], ["aria-keyshortcuts"]);
|
|
422
|
-
addTokenToAttribute(c, "aria-keyshortcuts", char
|
|
433
|
+
addTokenToAttribute(c, "aria-keyshortcuts", char, {
|
|
434
|
+
caseInsensitive: true
|
|
435
|
+
});
|
|
423
436
|
}
|
|
424
437
|
keys.forEach((key) => {
|
|
425
438
|
const focusables = this.#focusablesByFirstChar.get(key) ?? [];
|
|
@@ -464,7 +477,7 @@ function getActiveElement() {
|
|
|
464
477
|
* Lightweight roving tabindex utility with fully focus management.
|
|
465
478
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
466
479
|
*
|
|
467
|
-
* @version 1.2.
|
|
480
|
+
* @version 1.2.2
|
|
468
481
|
* @author Yusuke Kamiyamane
|
|
469
482
|
* @license MIT
|
|
470
483
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -476,7 +489,7 @@ function getActiveElement() {
|
|
|
476
489
|
(**
|
|
477
490
|
* Attributes Utils
|
|
478
491
|
*
|
|
479
|
-
* @version 1.0.
|
|
492
|
+
* @version 1.0.3
|
|
480
493
|
* @author Yusuke Kamiyamane
|
|
481
494
|
* @license MIT
|
|
482
495
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/roving-tabindex",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Lightweight roving tabindex utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/y14e/roving-tabindex#readme",
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@y14e/attributes-utils": "^1.0.
|
|
51
|
+
"@y14e/attributes-utils": "^1.0.3",
|
|
52
52
|
"bun-types": "latest",
|
|
53
53
|
"power-focusable": "^4.1.7",
|
|
54
54
|
"tsup": "^8.0.0",
|