@y14e/roving-tabindex 1.2.0 → 1.2.1

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
@@ -10,10 +10,10 @@ function addTokenToAttribute(element, attribute, token) {
10
10
  }
11
11
  var snapshots = /* @__PURE__ */ new WeakMap();
12
12
  function restoreAttributes(elements) {
13
- elements.forEach((element) => {
13
+ for (const element of elements) {
14
14
  const snapshot = snapshots.get(element);
15
15
  if (!snapshot) {
16
- return;
16
+ continue;
17
17
  }
18
18
  for (const [attribute, value] of snapshot.entries()) {
19
19
  if (value === null) {
@@ -23,7 +23,7 @@ function restoreAttributes(elements) {
23
23
  }
24
24
  }
25
25
  snapshots.delete(element);
26
- });
26
+ }
27
27
  }
28
28
  function saveAttributes(elements, attributes) {
29
29
  elements.forEach((element) => {
@@ -388,9 +388,9 @@ var RovingTabIndex = class {
388
388
  filter: this.#selectorFilter
389
389
  })
390
390
  ]);
391
- this.#focusables.forEach((focusable) => {
391
+ for (const focusable of this.#focusables) {
392
392
  if (current.has(focusable)) {
393
- return;
393
+ continue;
394
394
  }
395
395
  if (focusable.isConnected) {
396
396
  restoreAttributes([focusable]);
@@ -402,16 +402,16 @@ var RovingTabIndex = class {
402
402
  focusables.splice(index, 1);
403
403
  }
404
404
  });
405
- });
406
- current.forEach((c) => {
405
+ }
406
+ for (const c of current) {
407
407
  if (this.#focusables.has(c)) {
408
- return;
408
+ continue;
409
409
  }
410
410
  this.#focusables.add(c);
411
411
  saveAttributes([c], ["tabindex"]);
412
412
  c.setAttribute("tabindex", "-1");
413
413
  if (!this.#options.typeahead) {
414
- return;
414
+ continue;
415
415
  }
416
416
  const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
417
417
  const keys = new Set(
@@ -428,7 +428,7 @@ var RovingTabIndex = class {
428
428
  focusables.push(c);
429
429
  this.#focusablesByFirstChar.set(key, focusables);
430
430
  });
431
- });
431
+ }
432
432
  if (active && this.#focusables.has(active)) {
433
433
  this.#focusables.forEach((focusable) => {
434
434
  focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
@@ -466,7 +466,7 @@ function getActiveElement() {
466
466
  * Lightweight roving tabindex utility with fully focus management.
467
467
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
468
468
  *
469
- * @version 1.2.0
469
+ * @version 1.2.1
470
470
  * @author Yusuke Kamiyamane
471
471
  * @license MIT
472
472
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -478,7 +478,7 @@ function getActiveElement() {
478
478
  (**
479
479
  * Attributes Utils
480
480
  *
481
- * @version 1.0.0
481
+ * @version 1.0.2
482
482
  * @author Yusuke Kamiyamane
483
483
  * @license MIT
484
484
  * @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.0
6
+ * @version 1.2.1
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.0
6
+ * @version 1.2.1
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -8,10 +8,10 @@ function addTokenToAttribute(element, attribute, token) {
8
8
  }
9
9
  var snapshots = /* @__PURE__ */ new WeakMap();
10
10
  function restoreAttributes(elements) {
11
- elements.forEach((element) => {
11
+ for (const element of elements) {
12
12
  const snapshot = snapshots.get(element);
13
13
  if (!snapshot) {
14
- return;
14
+ continue;
15
15
  }
16
16
  for (const [attribute, value] of snapshot.entries()) {
17
17
  if (value === null) {
@@ -21,7 +21,7 @@ function restoreAttributes(elements) {
21
21
  }
22
22
  }
23
23
  snapshots.delete(element);
24
- });
24
+ }
25
25
  }
26
26
  function saveAttributes(elements, attributes) {
27
27
  elements.forEach((element) => {
@@ -386,9 +386,9 @@ var RovingTabIndex = class {
386
386
  filter: this.#selectorFilter
387
387
  })
388
388
  ]);
389
- this.#focusables.forEach((focusable) => {
389
+ for (const focusable of this.#focusables) {
390
390
  if (current.has(focusable)) {
391
- return;
391
+ continue;
392
392
  }
393
393
  if (focusable.isConnected) {
394
394
  restoreAttributes([focusable]);
@@ -400,16 +400,16 @@ var RovingTabIndex = class {
400
400
  focusables.splice(index, 1);
401
401
  }
402
402
  });
403
- });
404
- current.forEach((c) => {
403
+ }
404
+ for (const c of current) {
405
405
  if (this.#focusables.has(c)) {
406
- return;
406
+ continue;
407
407
  }
408
408
  this.#focusables.add(c);
409
409
  saveAttributes([c], ["tabindex"]);
410
410
  c.setAttribute("tabindex", "-1");
411
411
  if (!this.#options.typeahead) {
412
- return;
412
+ continue;
413
413
  }
414
414
  const shortcuts = c.ariaKeyShortcuts?.trim() ?? "";
415
415
  const keys = new Set(
@@ -426,7 +426,7 @@ var RovingTabIndex = class {
426
426
  focusables.push(c);
427
427
  this.#focusablesByFirstChar.set(key, focusables);
428
428
  });
429
- });
429
+ }
430
430
  if (active && this.#focusables.has(active)) {
431
431
  this.#focusables.forEach((focusable) => {
432
432
  focusable.setAttribute("tabindex", focusable === active ? "0" : "-1");
@@ -464,7 +464,7 @@ function getActiveElement() {
464
464
  * Lightweight roving tabindex utility with fully focus management.
465
465
  * Designed for accessible menus, tabs, toolbars, and composite widgets.
466
466
  *
467
- * @version 1.2.0
467
+ * @version 1.2.1
468
468
  * @author Yusuke Kamiyamane
469
469
  * @license MIT
470
470
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -476,7 +476,7 @@ function getActiveElement() {
476
476
  (**
477
477
  * Attributes Utils
478
478
  *
479
- * @version 1.0.0
479
+ * @version 1.0.2
480
480
  * @author Yusuke Kamiyamane
481
481
  * @license MIT
482
482
  * @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.0",
3
+ "version": "1.2.1",
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.0",
51
+ "@y14e/attributes-utils": "^1.0.2",
52
52
  "bun-types": "latest",
53
53
  "power-focusable": "^4.1.7",
54
54
  "tsup": "^8.0.0",