power-focusable 2.1.7 → 2.1.8

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
@@ -21,12 +21,12 @@ function getFocusables(container = document.body, options = {}) {
21
21
  }
22
22
  }
23
23
  if (node instanceof HTMLSlotElement) {
24
- const assigned = node.assignedElements({ flatten: true });
25
- if (assigned.length) {
26
- for (let i = 0, l = assigned.length; i < l; i++) {
27
- const a = assigned[i];
28
- if (a) {
29
- traverse2(a);
24
+ const assigneds = node.assignedElements({ flatten: true });
25
+ if (assigneds.length) {
26
+ for (let i = 0, l = assigneds.length; i < l; i++) {
27
+ const assigned = assigneds[i];
28
+ if (assigned) {
29
+ traverse2(assigned);
30
30
  }
31
31
  }
32
32
  return;
@@ -114,9 +114,6 @@ function getRelativeFocusable(container, offset, options) {
114
114
  if (!active || !containsDeep(container, active)) {
115
115
  return null;
116
116
  }
117
- if (!(active instanceof HTMLElement)) {
118
- throw new Error("Unreachable");
119
- }
120
117
  const currentIndex = focusables.indexOf(active);
121
118
  if (currentIndex === -1) {
122
119
  return null;
@@ -197,7 +194,7 @@ function normalizeRadioGroup(elements) {
197
194
  let map = null;
198
195
  for (let i = 0, l = elements.length; i < l; i++) {
199
196
  const element = elements[i];
200
- if (!(element instanceof HTMLInputElement) || !isUngroupedRadio(element)) {
197
+ if (!isUngroupedRadio(element)) {
201
198
  continue;
202
199
  }
203
200
  if (!map) {
@@ -228,9 +225,6 @@ function sortByTabIndex(elements) {
228
225
  const natural = [];
229
226
  for (let i = 0, l = elements.length; i < l; i++) {
230
227
  const element = elements[i];
231
- if (!element) {
232
- throw new Error("Unreachable");
233
- }
234
228
  const target = getTabIndex(element) > 0 ? ordered : natural;
235
229
  target[target.length] = element;
236
230
  }
@@ -250,7 +244,7 @@ function sortByTabIndex(elements) {
250
244
  * High-precision focus management utility with shadow DOM support.
251
245
  * Handles complex focus rules including tabindex ordering, radio groups, etc.
252
246
  *
253
- * @version 2.1.7
247
+ * @version 2.1.8
254
248
  * @author Yusuke Kamiyamane
255
249
  * @license MIT
256
250
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-precision focus management utility with shadow DOM support.
4
4
  * Handles complex focus rules including tabindex ordering, radio groups, etc.
5
5
  *
6
- * @version 2.1.7
6
+ * @version 2.1.8
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 shadow DOM support.
4
4
  * Handles complex focus rules including tabindex ordering, radio groups, etc.
5
5
  *
6
- * @version 2.1.7
6
+ * @version 2.1.8
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -19,12 +19,12 @@ function getFocusables(container = document.body, options = {}) {
19
19
  }
20
20
  }
21
21
  if (node instanceof HTMLSlotElement) {
22
- const assigned = node.assignedElements({ flatten: true });
23
- if (assigned.length) {
24
- for (let i = 0, l = assigned.length; i < l; i++) {
25
- const a = assigned[i];
26
- if (a) {
27
- traverse2(a);
22
+ const assigneds = node.assignedElements({ flatten: true });
23
+ if (assigneds.length) {
24
+ for (let i = 0, l = assigneds.length; i < l; i++) {
25
+ const assigned = assigneds[i];
26
+ if (assigned) {
27
+ traverse2(assigned);
28
28
  }
29
29
  }
30
30
  return;
@@ -112,9 +112,6 @@ function getRelativeFocusable(container, offset, options) {
112
112
  if (!active || !containsDeep(container, active)) {
113
113
  return null;
114
114
  }
115
- if (!(active instanceof HTMLElement)) {
116
- throw new Error("Unreachable");
117
- }
118
115
  const currentIndex = focusables.indexOf(active);
119
116
  if (currentIndex === -1) {
120
117
  return null;
@@ -195,7 +192,7 @@ function normalizeRadioGroup(elements) {
195
192
  let map = null;
196
193
  for (let i = 0, l = elements.length; i < l; i++) {
197
194
  const element = elements[i];
198
- if (!(element instanceof HTMLInputElement) || !isUngroupedRadio(element)) {
195
+ if (!isUngroupedRadio(element)) {
199
196
  continue;
200
197
  }
201
198
  if (!map) {
@@ -226,9 +223,6 @@ function sortByTabIndex(elements) {
226
223
  const natural = [];
227
224
  for (let i = 0, l = elements.length; i < l; i++) {
228
225
  const element = elements[i];
229
- if (!element) {
230
- throw new Error("Unreachable");
231
- }
232
226
  const target = getTabIndex(element) > 0 ? ordered : natural;
233
227
  target[target.length] = element;
234
228
  }
@@ -248,7 +242,7 @@ function sortByTabIndex(elements) {
248
242
  * High-precision focus management utility with shadow DOM support.
249
243
  * Handles complex focus rules including tabindex ordering, radio groups, etc.
250
244
  *
251
- * @version 2.1.7
245
+ * @version 2.1.8
252
246
  * @author Yusuke Kamiyamane
253
247
  * @license MIT
254
248
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-focusable",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "High-precision focus management utility with shadow DOM support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",