@y14e/roving-tabindex 2.0.0 → 2.0.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/README.md CHANGED
@@ -41,11 +41,11 @@ const cleanup = createRovingTabIndex(container, options);
41
41
 
42
42
  ```ts
43
43
  interface RovingTabIndexOptions {
44
- direction?: 'horizontal' | 'vertical' | undefined; // default: both (undefined)
45
- navigationOnly?: boolean; // default: false
46
- selector?: string | undefined;
47
- typeahead?: boolean; // default: false
48
- wrap?: boolean; // default: false
44
+ direction?: 'horizontal' | 'vertical'; // default: both (undefined)
45
+ navigationOnly?: boolean; // default: false
46
+ selector?: string;
47
+ typeahead?: boolean; // default: false
48
+ wrap?: boolean; // default: false
49
49
  }
50
50
  ```
51
51
 
package/dist/index.cjs CHANGED
@@ -326,13 +326,14 @@ function createRovingTabIndex(container, options = {}) {
326
326
  console.warn("Invalid wrap option. Fallback: false.");
327
327
  wrap = false;
328
328
  }
329
- const roving = new RovingTabIndex(container, {
330
- direction,
331
- navigationOnly,
332
- selector,
333
- typeahead,
334
- wrap
335
- });
329
+ const settings = { navigationOnly, typeahead, wrap };
330
+ if (direction !== void 0) {
331
+ Object.assign(settings, { direction });
332
+ }
333
+ if (selector !== void 0) {
334
+ Object.assign(settings, { selector });
335
+ }
336
+ const roving = new RovingTabIndex(container, settings);
336
337
  return () => roving.destroy();
337
338
  }
338
339
  var RovingTabIndex = class {
@@ -438,14 +439,7 @@ var RovingTabIndex = class {
438
439
  focusElement(focusable);
439
440
  };
440
441
  #update(active) {
441
- const current = /* @__PURE__ */ new Set([
442
- ...this.#getFocusables(),
443
- ...getFocusables(this.#container, {
444
- composed: true,
445
- filter: this.#selectorFilter,
446
- skipNegativeTabIndexCheck: !this.#options.navigationOnly
447
- })
448
- ]);
442
+ const current = new Set(this.#getFocusables());
449
443
  for (const focusable of this.#focusables) {
450
444
  if (current.has(focusable)) {
451
445
  continue;
@@ -528,7 +522,7 @@ function getActiveElement() {
528
522
  * Lightweight roving tabindex utility with fully focus management.
529
523
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
530
524
  *
531
- * @version 2.0.0
525
+ * @version 2.0.2
532
526
  * @author Yusuke Kamiyamane
533
527
  * @license MIT
534
528
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -553,7 +547,7 @@ power-focusable/dist/index.js:
553
547
  * High-precision focus management utility with full composed tree support.
554
548
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
555
549
  *
556
- * @version 4.3.0
550
+ * @version 4.3.1
557
551
  * @author Yusuke Kamiyamane
558
552
  * @license MIT
559
553
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,16 +3,16 @@
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.0
6
+ * @version 2.0.2
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/roving-tabindex}
11
11
  */
12
12
  interface RovingTabIndexOptions {
13
- readonly direction?: 'horizontal' | 'vertical' | undefined;
13
+ readonly direction?: 'horizontal' | 'vertical';
14
14
  readonly navigationOnly?: boolean;
15
- readonly selector?: string | undefined;
15
+ readonly selector?: string;
16
16
  readonly typeahead?: boolean;
17
17
  readonly wrap?: boolean;
18
18
  }
package/dist/index.d.ts CHANGED
@@ -3,16 +3,16 @@
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.0
6
+ * @version 2.0.2
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
10
10
  * @see {@link https://github.com/y14e/roving-tabindex}
11
11
  */
12
12
  interface RovingTabIndexOptions {
13
- readonly direction?: 'horizontal' | 'vertical' | undefined;
13
+ readonly direction?: 'horizontal' | 'vertical';
14
14
  readonly navigationOnly?: boolean;
15
- readonly selector?: string | undefined;
15
+ readonly selector?: string;
16
16
  readonly typeahead?: boolean;
17
17
  readonly wrap?: boolean;
18
18
  }
package/dist/index.js CHANGED
@@ -324,13 +324,14 @@ function createRovingTabIndex(container, options = {}) {
324
324
  console.warn("Invalid wrap option. Fallback: false.");
325
325
  wrap = false;
326
326
  }
327
- const roving = new RovingTabIndex(container, {
328
- direction,
329
- navigationOnly,
330
- selector,
331
- typeahead,
332
- wrap
333
- });
327
+ const settings = { navigationOnly, typeahead, wrap };
328
+ if (direction !== void 0) {
329
+ Object.assign(settings, { direction });
330
+ }
331
+ if (selector !== void 0) {
332
+ Object.assign(settings, { selector });
333
+ }
334
+ const roving = new RovingTabIndex(container, settings);
334
335
  return () => roving.destroy();
335
336
  }
336
337
  var RovingTabIndex = class {
@@ -436,14 +437,7 @@ var RovingTabIndex = class {
436
437
  focusElement(focusable);
437
438
  };
438
439
  #update(active) {
439
- const current = /* @__PURE__ */ new Set([
440
- ...this.#getFocusables(),
441
- ...getFocusables(this.#container, {
442
- composed: true,
443
- filter: this.#selectorFilter,
444
- skipNegativeTabIndexCheck: !this.#options.navigationOnly
445
- })
446
- ]);
440
+ const current = new Set(this.#getFocusables());
447
441
  for (const focusable of this.#focusables) {
448
442
  if (current.has(focusable)) {
449
443
  continue;
@@ -526,7 +520,7 @@ function getActiveElement() {
526
520
  * Lightweight roving tabindex utility with fully focus management.
527
521
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
528
522
  *
529
- * @version 2.0.0
523
+ * @version 2.0.2
530
524
  * @author Yusuke Kamiyamane
531
525
  * @license MIT
532
526
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -551,7 +545,7 @@ power-focusable/dist/index.js:
551
545
  * High-precision focus management utility with full composed tree support.
552
546
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
553
547
  *
554
- * @version 4.3.0
548
+ * @version 4.3.1
555
549
  * @author Yusuke Kamiyamane
556
550
  * @license MIT
557
551
  * @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.0",
3
+ "version": "2.0.2",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@y14e/attributes-utils": "^1.0.5",
52
52
  "bun-types": "latest",
53
- "power-focusable": "^4.3.0",
53
+ "power-focusable": "^4.3.1",
54
54
  "tsup": "^8.0.0",
55
55
  "typescript": "^5.6.0"
56
56
  },