power-focusable 4.3.18 → 4.3.19

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
@@ -24,11 +24,11 @@ import {
24
24
  } from 'power-focusable';
25
25
 
26
26
  // CDNs
27
- import { ... } 'https://esm.sh/power-focusable@4.3.18';
27
+ import { ... } 'https://esm.sh/power-focusable@4.3.19';
28
28
  // or
29
- import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.18/+esm';
29
+ import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.19/+esm';
30
30
  // or
31
- import { ... } 'https://esm.unpkg.com/power-focusable@4.3.18';
31
+ import { ... } 'https://esm.unpkg.com/power-focusable@4.3.19';
32
32
  ```
33
33
 
34
34
  ## 🪄 Options
package/dist/index.cjs CHANGED
@@ -96,14 +96,14 @@ function getFocusables(container = document.body, options = {}) {
96
96
  console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
97
97
  skipVisibilityCheck = false;
98
98
  }
99
- const elements = [];
99
+ const candidates = [];
100
100
  if (composed || include) {
101
101
  let traverse2 = function(node) {
102
102
  if (isFocusable(node, {
103
103
  skipNegativeTabIndexCheck,
104
104
  skipVisibilityCheck
105
105
  }) || include?.(node)) {
106
- elements[elements.length] = node;
106
+ candidates[candidates.length] = node;
107
107
  }
108
108
  const children2 = composed ? getComposedChildren(node) : getChildren(node);
109
109
  for (let i = 0, l = children2.length; i < l; i++) {
@@ -117,21 +117,22 @@ function getFocusables(container = document.body, options = {}) {
117
117
  child && traverse2(child);
118
118
  }
119
119
  } else {
120
- const candidates = container.querySelectorAll(
120
+ const matches = container.querySelectorAll(
121
121
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
122
122
  );
123
- for (let i = 0, l = candidates.length; i < l; i++) {
124
- const candidate = candidates[i];
125
- if (candidate && isFocusable(candidate, {
123
+ for (let i = 0, l = matches.length; i < l; i++) {
124
+ const matched = matches[i];
125
+ if (matched && isFocusable(matched, {
126
126
  skipNegativeTabIndexCheck,
127
127
  skipVisibilityCheck
128
128
  })) {
129
- elements[elements.length] = candidate;
129
+ candidates[candidates.length] = matched;
130
130
  }
131
131
  }
132
132
  }
133
- const filtered = filter ? elements.filter(filter) : elements;
134
- return normalizeRadioGroup(sortByTabIndex(filtered));
133
+ return normalizeRadioGroup(
134
+ sortByTabIndex(filter ? candidates.filter(filter) : candidates)
135
+ );
135
136
  }
136
137
  function getNextFocusable(container = document.body, options = {}) {
137
138
  return getRelativeFocusable(container, 1, options);
@@ -265,12 +266,12 @@ function getRelativeFocusable(container, offset, options) {
265
266
  skipNegativeTabIndexCheck,
266
267
  skipVisibilityCheck
267
268
  };
268
- const candidates = getFocusables(container, settings);
269
- const { length } = candidates;
269
+ const focusables = getFocusables(container, settings);
270
+ const { length } = focusables;
270
271
  if (!length) {
271
272
  return null;
272
273
  }
273
- const anchorIndex = candidates.indexOf(anchor);
274
+ const anchorIndex = focusables.indexOf(anchor);
274
275
  if (anchorIndex === -1) {
275
276
  return null;
276
277
  }
@@ -278,7 +279,7 @@ function getRelativeFocusable(container, offset, options) {
278
279
  if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
279
280
  return null;
280
281
  }
281
- return candidates[(offsetIndex + length) % length] ?? null;
282
+ return focusables[(offsetIndex + length) % length] ?? null;
282
283
  }
283
284
  function isDisabledDeep(element) {
284
285
  let current = element;
@@ -493,7 +494,7 @@ function isUngroupedRadio(element) {
493
494
  * High-precision focus management utility with full composed tree support.
494
495
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
495
496
  *
496
- * @version 4.3.18
497
+ * @version 4.3.19
497
498
  * @author Yusuke Kamiyamane
498
499
  * @license MIT
499
500
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-precision focus management utility with full composed tree support.
4
4
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
5
5
  *
6
- * @version 4.3.18
6
+ * @version 4.3.19
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
  * High-precision focus management utility with full composed tree support.
4
4
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
5
5
  *
6
- * @version 4.3.18
6
+ * @version 4.3.19
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -94,14 +94,14 @@ function getFocusables(container = document.body, options = {}) {
94
94
  console.warn("Invalid skipVisibilityCheck option. Fallback: false.");
95
95
  skipVisibilityCheck = false;
96
96
  }
97
- const elements = [];
97
+ const candidates = [];
98
98
  if (composed || include) {
99
99
  let traverse2 = function(node) {
100
100
  if (isFocusable(node, {
101
101
  skipNegativeTabIndexCheck,
102
102
  skipVisibilityCheck
103
103
  }) || include?.(node)) {
104
- elements[elements.length] = node;
104
+ candidates[candidates.length] = node;
105
105
  }
106
106
  const children2 = composed ? getComposedChildren(node) : getChildren(node);
107
107
  for (let i = 0, l = children2.length; i < l; i++) {
@@ -115,21 +115,22 @@ function getFocusables(container = document.body, options = {}) {
115
115
  child && traverse2(child);
116
116
  }
117
117
  } else {
118
- const candidates = container.querySelectorAll(
118
+ const matches = container.querySelectorAll(
119
119
  skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
120
120
  );
121
- for (let i = 0, l = candidates.length; i < l; i++) {
122
- const candidate = candidates[i];
123
- if (candidate && isFocusable(candidate, {
121
+ for (let i = 0, l = matches.length; i < l; i++) {
122
+ const matched = matches[i];
123
+ if (matched && isFocusable(matched, {
124
124
  skipNegativeTabIndexCheck,
125
125
  skipVisibilityCheck
126
126
  })) {
127
- elements[elements.length] = candidate;
127
+ candidates[candidates.length] = matched;
128
128
  }
129
129
  }
130
130
  }
131
- const filtered = filter ? elements.filter(filter) : elements;
132
- return normalizeRadioGroup(sortByTabIndex(filtered));
131
+ return normalizeRadioGroup(
132
+ sortByTabIndex(filter ? candidates.filter(filter) : candidates)
133
+ );
133
134
  }
134
135
  function getNextFocusable(container = document.body, options = {}) {
135
136
  return getRelativeFocusable(container, 1, options);
@@ -263,12 +264,12 @@ function getRelativeFocusable(container, offset, options) {
263
264
  skipNegativeTabIndexCheck,
264
265
  skipVisibilityCheck
265
266
  };
266
- const candidates = getFocusables(container, settings);
267
- const { length } = candidates;
267
+ const focusables = getFocusables(container, settings);
268
+ const { length } = focusables;
268
269
  if (!length) {
269
270
  return null;
270
271
  }
271
- const anchorIndex = candidates.indexOf(anchor);
272
+ const anchorIndex = focusables.indexOf(anchor);
272
273
  if (anchorIndex === -1) {
273
274
  return null;
274
275
  }
@@ -276,7 +277,7 @@ function getRelativeFocusable(container, offset, options) {
276
277
  if ((offsetIndex < 0 || offsetIndex >= length) && !wrap) {
277
278
  return null;
278
279
  }
279
- return candidates[(offsetIndex + length) % length] ?? null;
280
+ return focusables[(offsetIndex + length) % length] ?? null;
280
281
  }
281
282
  function isDisabledDeep(element) {
282
283
  let current = element;
@@ -491,7 +492,7 @@ function isUngroupedRadio(element) {
491
492
  * High-precision focus management utility with full composed tree support.
492
493
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
493
494
  *
494
- * @version 4.3.18
495
+ * @version 4.3.19
495
496
  * @author Yusuke Kamiyamane
496
497
  * @license MIT
497
498
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-focusable",
3
- "version": "4.3.18",
3
+ "version": "4.3.19",
4
4
  "description": "High-precision focus management utility with full composed tree support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",