@y14e/roving-tabindex 1.2.7 → 1.2.9

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 CHANGED
@@ -59,15 +59,19 @@ function getFocusables(container = document.body, options = {}) {
59
59
  }
60
60
  let { composed = false, filter, include } = options;
61
61
  if (typeof composed !== "boolean") {
62
- console.warn("Invalid composed. Fallback: false.");
62
+ console.warn("Invalid composed option. Fallback: false.");
63
63
  composed = false;
64
64
  }
65
65
  if (typeof filter !== "undefined" && typeof filter !== "function") {
66
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
66
+ console.warn(
67
+ "Invalid filter function. Fallback: no filter function (undefined)."
68
+ );
67
69
  filter = void 0;
68
70
  }
69
71
  if (typeof include !== "undefined" && typeof include !== "function") {
70
- console.warn("Invalid include. Fallback: no include function (undefined).");
72
+ console.warn(
73
+ "Invalid include function. Fallback: no include function (undefined)."
74
+ );
71
75
  include = void 0;
72
76
  }
73
77
  const elements = [];
@@ -264,7 +268,7 @@ function createRovingTabIndex(container, options = {}) {
264
268
  }
265
269
  let { direction, selector, typeahead = false, wrap = false } = options;
266
270
  if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
267
- console.warn("Invalid direction. Fallback: both (undefined).");
271
+ console.warn("Invalid direction option. Fallback: both (undefined).");
268
272
  direction = void 0;
269
273
  }
270
274
  if (typeof selector !== "undefined" && typeof selector !== "string") {
@@ -274,11 +278,11 @@ function createRovingTabIndex(container, options = {}) {
274
278
  selector = void 0;
275
279
  }
276
280
  if (typeof typeahead !== "boolean") {
277
- console.warn("Invalid typeahead. Fallback: false.");
281
+ console.warn("Invalid typeahead option. Fallback: false.");
278
282
  typeahead = false;
279
283
  }
280
284
  if (typeof wrap !== "boolean") {
281
- console.warn("Invalid wrap. Fallback: false.");
285
+ console.warn("Invalid wrap option. Fallback: false.");
282
286
  wrap = false;
283
287
  }
284
288
  const roving = new RovingTabIndex(container, {
@@ -340,8 +344,10 @@ var RovingTabIndex = class {
340
344
  "Home",
341
345
  ...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
342
346
  ...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
343
- ].includes(key) && (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase()))) {
344
- return;
347
+ ].includes(key)) {
348
+ if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
349
+ return;
350
+ }
345
351
  }
346
352
  const active = getActiveElement();
347
353
  if (!(active instanceof HTMLElement)) {
@@ -404,15 +410,11 @@ var RovingTabIndex = class {
404
410
  if (current.has(focusable)) {
405
411
  continue;
406
412
  }
407
- if (focusable.isConnected) {
408
- restoreAttributes([focusable]);
409
- }
413
+ focusable.isConnected && restoreAttributes([focusable]);
410
414
  this.#focusables.delete(focusable);
411
415
  this.#focusablesByFirstChar.forEach((focusables) => {
412
416
  const index = focusables.indexOf(focusable);
413
- if (index >= 0) {
414
- focusables.splice(index, 1);
415
- }
417
+ index >= 0 && focusables.splice(index, 1);
416
418
  });
417
419
  }
418
420
  for (const focusable of current) {
@@ -480,7 +482,7 @@ function getActiveElement() {
480
482
  * Lightweight roving tabindex utility with fully focus management.
481
483
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
482
484
  *
483
- * @version 1.2.7
485
+ * @version 1.2.9
484
486
  * @author Yusuke Kamiyamane
485
487
  * @license MIT
486
488
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -505,7 +507,7 @@ power-focusable/dist/index.js:
505
507
  * High-precision focus management utility with full composed tree support.
506
508
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
507
509
  *
508
- * @version 4.1.7
510
+ * @version 4.1.8
509
511
  * @author Yusuke Kamiyamane
510
512
  * @license MIT
511
513
  * @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.7
6
+ * @version 1.2.9
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.7
6
+ * @version 1.2.9
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -57,15 +57,19 @@ function getFocusables(container = document.body, options = {}) {
57
57
  }
58
58
  let { composed = false, filter, include } = options;
59
59
  if (typeof composed !== "boolean") {
60
- console.warn("Invalid composed. Fallback: false.");
60
+ console.warn("Invalid composed option. Fallback: false.");
61
61
  composed = false;
62
62
  }
63
63
  if (typeof filter !== "undefined" && typeof filter !== "function") {
64
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
64
+ console.warn(
65
+ "Invalid filter function. Fallback: no filter function (undefined)."
66
+ );
65
67
  filter = void 0;
66
68
  }
67
69
  if (typeof include !== "undefined" && typeof include !== "function") {
68
- console.warn("Invalid include. Fallback: no include function (undefined).");
70
+ console.warn(
71
+ "Invalid include function. Fallback: no include function (undefined)."
72
+ );
69
73
  include = void 0;
70
74
  }
71
75
  const elements = [];
@@ -262,7 +266,7 @@ function createRovingTabIndex(container, options = {}) {
262
266
  }
263
267
  let { direction, selector, typeahead = false, wrap = false } = options;
264
268
  if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
265
- console.warn("Invalid direction. Fallback: both (undefined).");
269
+ console.warn("Invalid direction option. Fallback: both (undefined).");
266
270
  direction = void 0;
267
271
  }
268
272
  if (typeof selector !== "undefined" && typeof selector !== "string") {
@@ -272,11 +276,11 @@ function createRovingTabIndex(container, options = {}) {
272
276
  selector = void 0;
273
277
  }
274
278
  if (typeof typeahead !== "boolean") {
275
- console.warn("Invalid typeahead. Fallback: false.");
279
+ console.warn("Invalid typeahead option. Fallback: false.");
276
280
  typeahead = false;
277
281
  }
278
282
  if (typeof wrap !== "boolean") {
279
- console.warn("Invalid wrap. Fallback: false.");
283
+ console.warn("Invalid wrap option. Fallback: false.");
280
284
  wrap = false;
281
285
  }
282
286
  const roving = new RovingTabIndex(container, {
@@ -338,8 +342,10 @@ var RovingTabIndex = class {
338
342
  "Home",
339
343
  ...isBoth ? ["ArrowLeft", "ArrowUp"] : [`Arrow${isHorizontal ? "Left" : "Up"}`],
340
344
  ...isBoth ? ["ArrowRight", "ArrowDown"] : [`Arrow${isHorizontal ? "Right" : "Down"}`]
341
- ].includes(key) && (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase()))) {
342
- return;
345
+ ].includes(key)) {
346
+ if (!typeahead || !/^\S$/i.test(key) || !this.#focusablesByFirstChar.has(key.toUpperCase())) {
347
+ return;
348
+ }
343
349
  }
344
350
  const active = getActiveElement();
345
351
  if (!(active instanceof HTMLElement)) {
@@ -402,15 +408,11 @@ var RovingTabIndex = class {
402
408
  if (current.has(focusable)) {
403
409
  continue;
404
410
  }
405
- if (focusable.isConnected) {
406
- restoreAttributes([focusable]);
407
- }
411
+ focusable.isConnected && restoreAttributes([focusable]);
408
412
  this.#focusables.delete(focusable);
409
413
  this.#focusablesByFirstChar.forEach((focusables) => {
410
414
  const index = focusables.indexOf(focusable);
411
- if (index >= 0) {
412
- focusables.splice(index, 1);
413
- }
415
+ index >= 0 && focusables.splice(index, 1);
414
416
  });
415
417
  }
416
418
  for (const focusable of current) {
@@ -478,7 +480,7 @@ function getActiveElement() {
478
480
  * Lightweight roving tabindex utility with fully focus management.
479
481
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
480
482
  *
481
- * @version 1.2.7
483
+ * @version 1.2.9
482
484
  * @author Yusuke Kamiyamane
483
485
  * @license MIT
484
486
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -503,7 +505,7 @@ power-focusable/dist/index.js:
503
505
  * High-precision focus management utility with full composed tree support.
504
506
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
505
507
  *
506
- * @version 4.1.7
508
+ * @version 4.1.8
507
509
  * @author Yusuke Kamiyamane
508
510
  * @license MIT
509
511
  * @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.7",
3
+ "version": "1.2.9",
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.1.7",
53
+ "power-focusable": "^4.1.8",
54
54
  "tsup": "^8.0.0",
55
55
  "typescript": "^5.6.0"
56
56
  },