@y14e/roving-tabindex 2.0.6 → 2.0.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/README.md +4 -4
- package/dist/index.cjs +9 -17
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/roving-tabindex
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import { createRovingTabIndex } from '@y14e/roving-tabindex@2.0.
|
|
13
|
+
import { createRovingTabIndex } from '@y14e/roving-tabindex@2.0.8';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@2.0.
|
|
16
|
+
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@2.0.8';
|
|
17
17
|
// or
|
|
18
|
-
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@2.0.
|
|
18
|
+
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@2.0.8/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@2.0.
|
|
20
|
+
import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@2.0.8';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.cjs
CHANGED
|
@@ -13,11 +13,10 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
13
13
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
14
14
|
if (caseInsensitive) {
|
|
15
15
|
const lower = token.toLowerCase();
|
|
16
|
-
if (tokens.
|
|
17
|
-
|
|
16
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
17
|
+
tokens.push(token);
|
|
18
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
18
19
|
}
|
|
19
|
-
tokens.push(token);
|
|
20
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
const set = new Set(tokens);
|
|
@@ -327,12 +326,8 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
327
326
|
wrap = false;
|
|
328
327
|
}
|
|
329
328
|
const settings = { navigationOnly, typeahead, wrap };
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
if (selector) {
|
|
334
|
-
Object.assign(settings, { selector });
|
|
335
|
-
}
|
|
329
|
+
direction && Object.assign(settings, { direction });
|
|
330
|
+
selector && Object.assign(settings, { selector });
|
|
336
331
|
const roving = new RovingTabIndex(container, settings);
|
|
337
332
|
return () => roving.destroy();
|
|
338
333
|
}
|
|
@@ -444,10 +439,7 @@ var RovingTabIndex = class {
|
|
|
444
439
|
}
|
|
445
440
|
}
|
|
446
441
|
const focusable = target.at(newIndex);
|
|
447
|
-
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
focusElement(focusable);
|
|
442
|
+
focusable && focusElement(focusable);
|
|
451
443
|
};
|
|
452
444
|
#update(active) {
|
|
453
445
|
const current = new Set(this.#getFocusables());
|
|
@@ -534,7 +526,7 @@ function getActiveElement() {
|
|
|
534
526
|
* Lightweight roving tabindex utility with fully focus management.
|
|
535
527
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
536
528
|
*
|
|
537
|
-
* @version 2.0.
|
|
529
|
+
* @version 2.0.8
|
|
538
530
|
* @author Yusuke Kamiyamane
|
|
539
531
|
* @license MIT
|
|
540
532
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -546,7 +538,7 @@ function getActiveElement() {
|
|
|
546
538
|
(**
|
|
547
539
|
* Attributes Utils
|
|
548
540
|
*
|
|
549
|
-
* @version 1.1.
|
|
541
|
+
* @version 1.1.1
|
|
550
542
|
* @author Yusuke Kamiyamane
|
|
551
543
|
* @license MIT
|
|
552
544
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -559,7 +551,7 @@ power-focusable/dist/index.js:
|
|
|
559
551
|
* High-precision focus management utility with full composed tree support.
|
|
560
552
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
561
553
|
*
|
|
562
|
-
* @version 4.3.
|
|
554
|
+
* @version 4.3.2
|
|
563
555
|
* @author Yusuke Kamiyamane
|
|
564
556
|
* @license MIT
|
|
565
557
|
* @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 2.0.
|
|
6
|
+
* @version 2.0.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 roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 2.0.
|
|
6
|
+
* @version 2.0.8
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -11,11 +11,10 @@ function addTokenToAttribute(element, attribute, token, options = {}) {
|
|
|
11
11
|
const tokens = value ? parse(value).filter(Boolean) : [];
|
|
12
12
|
if (caseInsensitive) {
|
|
13
13
|
const lower = token.toLowerCase();
|
|
14
|
-
if (tokens.
|
|
15
|
-
|
|
14
|
+
if (tokens.every((token2) => token2.toLowerCase() !== lower)) {
|
|
15
|
+
tokens.push(token);
|
|
16
|
+
element.setAttribute(attribute, serialize(tokens));
|
|
16
17
|
}
|
|
17
|
-
tokens.push(token);
|
|
18
|
-
element.setAttribute(attribute, serialize(tokens));
|
|
19
18
|
return;
|
|
20
19
|
}
|
|
21
20
|
const set = new Set(tokens);
|
|
@@ -325,12 +324,8 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
325
324
|
wrap = false;
|
|
326
325
|
}
|
|
327
326
|
const settings = { navigationOnly, typeahead, wrap };
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
if (selector) {
|
|
332
|
-
Object.assign(settings, { selector });
|
|
333
|
-
}
|
|
327
|
+
direction && Object.assign(settings, { direction });
|
|
328
|
+
selector && Object.assign(settings, { selector });
|
|
334
329
|
const roving = new RovingTabIndex(container, settings);
|
|
335
330
|
return () => roving.destroy();
|
|
336
331
|
}
|
|
@@ -442,10 +437,7 @@ var RovingTabIndex = class {
|
|
|
442
437
|
}
|
|
443
438
|
}
|
|
444
439
|
const focusable = target.at(newIndex);
|
|
445
|
-
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
focusElement(focusable);
|
|
440
|
+
focusable && focusElement(focusable);
|
|
449
441
|
};
|
|
450
442
|
#update(active) {
|
|
451
443
|
const current = new Set(this.#getFocusables());
|
|
@@ -532,7 +524,7 @@ function getActiveElement() {
|
|
|
532
524
|
* Lightweight roving tabindex utility with fully focus management.
|
|
533
525
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
534
526
|
*
|
|
535
|
-
* @version 2.0.
|
|
527
|
+
* @version 2.0.8
|
|
536
528
|
* @author Yusuke Kamiyamane
|
|
537
529
|
* @license MIT
|
|
538
530
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -544,7 +536,7 @@ function getActiveElement() {
|
|
|
544
536
|
(**
|
|
545
537
|
* Attributes Utils
|
|
546
538
|
*
|
|
547
|
-
* @version 1.1.
|
|
539
|
+
* @version 1.1.1
|
|
548
540
|
* @author Yusuke Kamiyamane
|
|
549
541
|
* @license MIT
|
|
550
542
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -557,7 +549,7 @@ power-focusable/dist/index.js:
|
|
|
557
549
|
* High-precision focus management utility with full composed tree support.
|
|
558
550
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
559
551
|
*
|
|
560
|
-
* @version 4.3.
|
|
552
|
+
* @version 4.3.2
|
|
561
553
|
* @author Yusuke Kamiyamane
|
|
562
554
|
* @license MIT
|
|
563
555
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/roving-tabindex",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Lightweight roving tabindex utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/y14e/roving-tabindex#readme",
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@y14e/attributes-utils": "^1.1.
|
|
51
|
+
"@y14e/attributes-utils": "^1.1.1",
|
|
52
52
|
"bun-types": "latest",
|
|
53
|
-
"power-focusable": "^4.3.
|
|
53
|
+
"power-focusable": "^4.3.2",
|
|
54
54
|
"tsup": "^8.0.0",
|
|
55
55
|
"typescript": "^5.6.0"
|
|
56
56
|
},
|