@y14e/roving-tabindex 3.1.9 → 3.1.10

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
@@ -13,11 +13,11 @@ npm i @y14e/roving-tabindex
13
13
  import { createRovingTabIndex } from '@y14e/roving-tabindex';
14
14
 
15
15
  // CDNs
16
- import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.1.9';
16
+ import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.1.10';
17
17
  // or
18
- import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.1.9/+esm';
18
+ import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.1.10/+esm';
19
19
  // or
20
- import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.1.9';
20
+ import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.1.10';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
@@ -38,14 +38,16 @@ const cleanup = createRovingTabIndex(container, options);
38
38
 
39
39
  ```ts
40
40
  interface RovingTabIndexOptions {
41
- direction: 'horizontal' | 'vertical'; // default: both (undefined)
42
- navigationOnly: boolean; // default: false
43
- noMemory: boolean; // default: false
44
- noStart: boolean; // default: false
45
- selector: string;
46
- typeahead: boolean; // default: false
47
- wrap: boolean; // default: false
41
+ direction: RovingTabIndexDirection; // default: 'both'
42
+ navigationOnly: boolean; // default: false
43
+ noMemory: boolean; // default: false
44
+ noStart: boolean; // default: false
45
+ selector: string; // default: ''
46
+ typeahead: boolean; // default: false
47
+ wrap: boolean; // default: false
48
48
  }
49
+
50
+ type RovingTabIndexDirection = 'both' | 'horizontal' | 'vertical';
49
51
  ```
50
52
 
51
53
  ### `navigationOnly`
@@ -315,17 +315,17 @@ var RovingTabIndex = class _RovingTabIndex {
315
315
  constructor(container, options = {}) {
316
316
  this.#container = container;
317
317
  let {
318
- direction,
318
+ direction = "both",
319
319
  navigationOnly = false,
320
320
  noMemory = false,
321
321
  noStart = false,
322
- selector,
322
+ selector = "",
323
323
  typeahead = false,
324
324
  wrap = false
325
325
  } = options;
326
- if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
327
- console.warn("Invalid direction option. Fallback: both (undefined).");
328
- direction = void 0;
326
+ if (!["both", "horizontal", "vertical"].includes(direction)) {
327
+ console.warn("Invalid direction option. Fallback: 'both'.");
328
+ direction = "both";
329
329
  }
330
330
  if (typeof navigationOnly !== "boolean") {
331
331
  console.warn("Invalid navigationOnly option. Fallback: false.");
@@ -339,11 +339,9 @@ var RovingTabIndex = class _RovingTabIndex {
339
339
  console.warn("Invalid noStart option. Fallback: false.");
340
340
  noStart = false;
341
341
  }
342
- if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
343
- console.warn(
344
- "Invalid selector. Fallback: all focusable elements (undefined)."
345
- );
346
- selector = void 0;
342
+ if (selector && (typeof selector !== "string" || !selector.trim())) {
343
+ console.warn("Invalid selector. Fallback: no selector string.");
344
+ selector = "";
347
345
  }
348
346
  if (typeof typeahead !== "boolean") {
349
347
  console.warn("Invalid typeahead option. Fallback: false.");
@@ -353,9 +351,15 @@ var RovingTabIndex = class _RovingTabIndex {
353
351
  console.warn("Invalid wrap option. Fallback: false.");
354
352
  wrap = false;
355
353
  }
356
- this.#settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
357
- direction && Object.assign(this.#settings, { direction });
358
- selector && Object.assign(this.#settings, { selector });
354
+ this.#settings = {
355
+ direction,
356
+ navigationOnly,
357
+ noMemory,
358
+ noStart,
359
+ selector,
360
+ typeahead,
361
+ wrap
362
+ };
359
363
  this.#selectorFilter = this.#createSelectorFilter();
360
364
  this.#initialize();
361
365
  }
@@ -403,7 +407,7 @@ var RovingTabIndex = class _RovingTabIndex {
403
407
  return;
404
408
  }
405
409
  const { direction, typeahead, wrap } = this.#settings;
406
- const isBoth = !direction;
410
+ const isBoth = direction === "both";
407
411
  const isHorizontal = direction === "horizontal";
408
412
  if (![
409
413
  "End",
@@ -534,7 +538,7 @@ var RovingTabIndex = class _RovingTabIndex {
534
538
  * Lightweight roving tabindex utility with fully focus management.
535
539
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
536
540
  *
537
- * @version 3.1.9
541
+ * @version 3.1.10
538
542
  * @author Yusuke Kamiyamane
539
543
  * @license MIT
540
544
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -559,7 +563,7 @@ power-focusable/dist/index.js:
559
563
  * High-precision focus management utility with full composed tree support.
560
564
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
561
565
  *
562
- * @version 4.3.10
566
+ * @version 4.3.11
563
567
  * @author Yusuke Kamiyamane
564
568
  * @license MIT
565
569
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -313,17 +313,17 @@ var RovingTabIndex = class _RovingTabIndex {
313
313
  constructor(container, options = {}) {
314
314
  this.#container = container;
315
315
  let {
316
- direction,
316
+ direction = "both",
317
317
  navigationOnly = false,
318
318
  noMemory = false,
319
319
  noStart = false,
320
- selector,
320
+ selector = "",
321
321
  typeahead = false,
322
322
  wrap = false
323
323
  } = options;
324
- if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
325
- console.warn("Invalid direction option. Fallback: both (undefined).");
326
- direction = void 0;
324
+ if (!["both", "horizontal", "vertical"].includes(direction)) {
325
+ console.warn("Invalid direction option. Fallback: 'both'.");
326
+ direction = "both";
327
327
  }
328
328
  if (typeof navigationOnly !== "boolean") {
329
329
  console.warn("Invalid navigationOnly option. Fallback: false.");
@@ -337,11 +337,9 @@ var RovingTabIndex = class _RovingTabIndex {
337
337
  console.warn("Invalid noStart option. Fallback: false.");
338
338
  noStart = false;
339
339
  }
340
- if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
341
- console.warn(
342
- "Invalid selector. Fallback: all focusable elements (undefined)."
343
- );
344
- selector = void 0;
340
+ if (selector && (typeof selector !== "string" || !selector.trim())) {
341
+ console.warn("Invalid selector. Fallback: no selector string.");
342
+ selector = "";
345
343
  }
346
344
  if (typeof typeahead !== "boolean") {
347
345
  console.warn("Invalid typeahead option. Fallback: false.");
@@ -351,9 +349,15 @@ var RovingTabIndex = class _RovingTabIndex {
351
349
  console.warn("Invalid wrap option. Fallback: false.");
352
350
  wrap = false;
353
351
  }
354
- this.#settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
355
- direction && Object.assign(this.#settings, { direction });
356
- selector && Object.assign(this.#settings, { selector });
352
+ this.#settings = {
353
+ direction,
354
+ navigationOnly,
355
+ noMemory,
356
+ noStart,
357
+ selector,
358
+ typeahead,
359
+ wrap
360
+ };
357
361
  this.#selectorFilter = this.#createSelectorFilter();
358
362
  this.#initialize();
359
363
  }
@@ -401,7 +405,7 @@ var RovingTabIndex = class _RovingTabIndex {
401
405
  return;
402
406
  }
403
407
  const { direction, typeahead, wrap } = this.#settings;
404
- const isBoth = !direction;
408
+ const isBoth = direction === "both";
405
409
  const isHorizontal = direction === "horizontal";
406
410
  if (![
407
411
  "End",
@@ -532,7 +536,7 @@ var RovingTabIndex = class _RovingTabIndex {
532
536
  * Lightweight roving tabindex utility with fully focus management.
533
537
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
534
538
  *
535
- * @version 3.1.9
539
+ * @version 3.1.10
536
540
  * @author Yusuke Kamiyamane
537
541
  * @license MIT
538
542
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -557,7 +561,7 @@ power-focusable/dist/index.js:
557
561
  * High-precision focus management utility with full composed tree support.
558
562
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
559
563
  *
560
- * @version 4.3.10
564
+ * @version 4.3.11
561
565
  * @author Yusuke Kamiyamane
562
566
  * @license MIT
563
567
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.cjs CHANGED
@@ -31,17 +31,17 @@ var RovingTabIndex = class _RovingTabIndex {
31
31
  constructor(container, options = {}) {
32
32
  this.#container = container;
33
33
  let {
34
- direction,
34
+ direction = "both",
35
35
  navigationOnly = false,
36
36
  noMemory = false,
37
37
  noStart = false,
38
- selector,
38
+ selector = "",
39
39
  typeahead = false,
40
40
  wrap = false
41
41
  } = options;
42
- if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
43
- console.warn("Invalid direction option. Fallback: both (undefined).");
44
- direction = void 0;
42
+ if (!["both", "horizontal", "vertical"].includes(direction)) {
43
+ console.warn("Invalid direction option. Fallback: 'both'.");
44
+ direction = "both";
45
45
  }
46
46
  if (typeof navigationOnly !== "boolean") {
47
47
  console.warn("Invalid navigationOnly option. Fallback: false.");
@@ -55,11 +55,9 @@ var RovingTabIndex = class _RovingTabIndex {
55
55
  console.warn("Invalid noStart option. Fallback: false.");
56
56
  noStart = false;
57
57
  }
58
- if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
59
- console.warn(
60
- "Invalid selector. Fallback: all focusable elements (undefined)."
61
- );
62
- selector = void 0;
58
+ if (selector && (typeof selector !== "string" || !selector.trim())) {
59
+ console.warn("Invalid selector. Fallback: no selector string.");
60
+ selector = "";
63
61
  }
64
62
  if (typeof typeahead !== "boolean") {
65
63
  console.warn("Invalid typeahead option. Fallback: false.");
@@ -69,9 +67,15 @@ var RovingTabIndex = class _RovingTabIndex {
69
67
  console.warn("Invalid wrap option. Fallback: false.");
70
68
  wrap = false;
71
69
  }
72
- this.#settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
73
- direction && Object.assign(this.#settings, { direction });
74
- selector && Object.assign(this.#settings, { selector });
70
+ this.#settings = {
71
+ direction,
72
+ navigationOnly,
73
+ noMemory,
74
+ noStart,
75
+ selector,
76
+ typeahead,
77
+ wrap
78
+ };
75
79
  this.#selectorFilter = this.#createSelectorFilter();
76
80
  this.#initialize();
77
81
  }
@@ -119,7 +123,7 @@ var RovingTabIndex = class _RovingTabIndex {
119
123
  return;
120
124
  }
121
125
  const { direction, typeahead, wrap } = this.#settings;
122
- const isBoth = !direction;
126
+ const isBoth = direction === "both";
123
127
  const isHorizontal = direction === "horizontal";
124
128
  if (![
125
129
  "End",
@@ -250,7 +254,7 @@ var RovingTabIndex = class _RovingTabIndex {
250
254
  * Lightweight roving tabindex utility with fully focus management.
251
255
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
252
256
  *
253
- * @version 3.1.9
257
+ * @version 3.1.10
254
258
  * @author Yusuke Kamiyamane
255
259
  * @license MIT
256
260
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,14 +3,14 @@
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 3.1.9
6
+ * @version 3.1.10
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
- direction: 'horizontal' | 'vertical';
13
+ direction: RovingTabIndexDirection;
14
14
  navigationOnly: boolean;
15
15
  noMemory: boolean;
16
16
  noStart: boolean;
@@ -18,6 +18,7 @@ interface RovingTabIndexOptions {
18
18
  typeahead: boolean;
19
19
  wrap: boolean;
20
20
  }
21
+ type RovingTabIndexDirection = 'both' | 'horizontal' | 'vertical';
21
22
  declare function createRovingTabIndex(container: Element, options?: Partial<RovingTabIndexOptions>): () => void;
22
23
 
23
24
  export { type RovingTabIndexOptions, createRovingTabIndex };
package/dist/index.d.ts CHANGED
@@ -3,14 +3,14 @@
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 3.1.9
6
+ * @version 3.1.10
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
- direction: 'horizontal' | 'vertical';
13
+ direction: RovingTabIndexDirection;
14
14
  navigationOnly: boolean;
15
15
  noMemory: boolean;
16
16
  noStart: boolean;
@@ -18,6 +18,7 @@ interface RovingTabIndexOptions {
18
18
  typeahead: boolean;
19
19
  wrap: boolean;
20
20
  }
21
+ type RovingTabIndexDirection = 'both' | 'horizontal' | 'vertical';
21
22
  declare function createRovingTabIndex(container: Element, options?: Partial<RovingTabIndexOptions>): () => void;
22
23
 
23
24
  export { type RovingTabIndexOptions, createRovingTabIndex };
package/dist/index.js CHANGED
@@ -29,17 +29,17 @@ var RovingTabIndex = class _RovingTabIndex {
29
29
  constructor(container, options = {}) {
30
30
  this.#container = container;
31
31
  let {
32
- direction,
32
+ direction = "both",
33
33
  navigationOnly = false,
34
34
  noMemory = false,
35
35
  noStart = false,
36
- selector,
36
+ selector = "",
37
37
  typeahead = false,
38
38
  wrap = false
39
39
  } = options;
40
- if (typeof direction !== "undefined" && !["horizontal", "vertical"].includes(direction)) {
41
- console.warn("Invalid direction option. Fallback: both (undefined).");
42
- direction = void 0;
40
+ if (!["both", "horizontal", "vertical"].includes(direction)) {
41
+ console.warn("Invalid direction option. Fallback: 'both'.");
42
+ direction = "both";
43
43
  }
44
44
  if (typeof navigationOnly !== "boolean") {
45
45
  console.warn("Invalid navigationOnly option. Fallback: false.");
@@ -53,11 +53,9 @@ var RovingTabIndex = class _RovingTabIndex {
53
53
  console.warn("Invalid noStart option. Fallback: false.");
54
54
  noStart = false;
55
55
  }
56
- if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
57
- console.warn(
58
- "Invalid selector. Fallback: all focusable elements (undefined)."
59
- );
60
- selector = void 0;
56
+ if (selector && (typeof selector !== "string" || !selector.trim())) {
57
+ console.warn("Invalid selector. Fallback: no selector string.");
58
+ selector = "";
61
59
  }
62
60
  if (typeof typeahead !== "boolean") {
63
61
  console.warn("Invalid typeahead option. Fallback: false.");
@@ -67,9 +65,15 @@ var RovingTabIndex = class _RovingTabIndex {
67
65
  console.warn("Invalid wrap option. Fallback: false.");
68
66
  wrap = false;
69
67
  }
70
- this.#settings = { navigationOnly, noMemory, noStart, typeahead, wrap };
71
- direction && Object.assign(this.#settings, { direction });
72
- selector && Object.assign(this.#settings, { selector });
68
+ this.#settings = {
69
+ direction,
70
+ navigationOnly,
71
+ noMemory,
72
+ noStart,
73
+ selector,
74
+ typeahead,
75
+ wrap
76
+ };
73
77
  this.#selectorFilter = this.#createSelectorFilter();
74
78
  this.#initialize();
75
79
  }
@@ -117,7 +121,7 @@ var RovingTabIndex = class _RovingTabIndex {
117
121
  return;
118
122
  }
119
123
  const { direction, typeahead, wrap } = this.#settings;
120
- const isBoth = !direction;
124
+ const isBoth = direction === "both";
121
125
  const isHorizontal = direction === "horizontal";
122
126
  if (![
123
127
  "End",
@@ -248,7 +252,7 @@ var RovingTabIndex = class _RovingTabIndex {
248
252
  * Lightweight roving tabindex utility with fully focus management.
249
253
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
250
254
  *
251
- * @version 3.1.9
255
+ * @version 3.1.10
252
256
  * @author Yusuke Kamiyamane
253
257
  * @license MIT
254
258
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/roving-tabindex",
3
- "version": "3.1.9",
3
+ "version": "3.1.10",
4
4
  "description": "Lightweight roving tabindex utility with fully focus management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -57,6 +57,6 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@y14e/attributes-utils": "^1.1.3",
60
- "power-focusable": "^4.3.10"
60
+ "power-focusable": "^4.3.11"
61
61
  }
62
62
  }