power-focusable 4.1.6 → 4.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
@@ -46,15 +46,19 @@ function getFocusables(container = document.body, options = {}) {
46
46
  }
47
47
  let { composed = false, filter, include } = options;
48
48
  if (typeof composed !== "boolean") {
49
- console.warn("Invalid composed. Fallback: false.");
49
+ console.warn("Invalid composed option. Fallback: false.");
50
50
  composed = false;
51
51
  }
52
52
  if (typeof filter !== "undefined" && typeof filter !== "function") {
53
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
53
+ console.warn(
54
+ "Invalid filter function. Fallback: no filter function (undefined)."
55
+ );
54
56
  filter = void 0;
55
57
  }
56
58
  if (typeof include !== "undefined" && typeof include !== "function") {
57
- console.warn("Invalid include. Fallback: no include function (undefined).");
59
+ console.warn(
60
+ "Invalid include function. Fallback: no include function (undefined)."
61
+ );
58
62
  include = void 0;
59
63
  }
60
64
  const elements = [];
@@ -155,6 +159,10 @@ function isFocusable(element) {
155
159
  return true;
156
160
  }
157
161
  function getRelativeFocusable(container, offset, options) {
162
+ if (!(container instanceof Element)) {
163
+ console.warn("Invalid container element. Fallback: <body> element.");
164
+ container = document.body;
165
+ }
158
166
  let {
159
167
  anchor = getActiveElement(),
160
168
  composed = false,
@@ -177,19 +185,23 @@ function getRelativeFocusable(container, offset, options) {
177
185
  return null;
178
186
  }
179
187
  if (typeof composed !== "boolean") {
180
- console.warn("Invalid composed. Fallback: false.");
188
+ console.warn("Invalid composed option. Fallback: false.");
181
189
  composed = false;
182
190
  }
183
191
  if (typeof filter !== "undefined" && typeof filter !== "function") {
184
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
192
+ console.warn(
193
+ "Invalid filter function. Fallback: no filter function (undefined)."
194
+ );
185
195
  filter = void 0;
186
196
  }
187
197
  if (typeof include !== "undefined" && typeof include !== "function") {
188
- console.warn("Invalid include. Fallback: no include function (undefined).");
198
+ console.warn(
199
+ "Invalid include function. Fallback: no include function (undefined)."
200
+ );
189
201
  include = void 0;
190
202
  }
191
203
  if (typeof wrap !== "boolean") {
192
- console.warn("Invalid wrap. Fallback: false.");
204
+ console.warn("Invalid wrap option. Fallback: false.");
193
205
  wrap = false;
194
206
  }
195
207
  const focusables = getFocusables(container, { composed, filter, include });
@@ -423,7 +435,7 @@ function isUngroupedRadio(element) {
423
435
  * High-precision focus management utility with full composed tree support.
424
436
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
425
437
  *
426
- * @version 4.1.6
438
+ * @version 4.1.8
427
439
  * @author Yusuke Kamiyamane
428
440
  * @license MIT
429
441
  * @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.1.6
6
+ * @version 4.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 full composed tree support.
4
4
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
5
5
  *
6
- * @version 4.1.6
6
+ * @version 4.1.8
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -44,15 +44,19 @@ function getFocusables(container = document.body, options = {}) {
44
44
  }
45
45
  let { composed = false, filter, include } = options;
46
46
  if (typeof composed !== "boolean") {
47
- console.warn("Invalid composed. Fallback: false.");
47
+ console.warn("Invalid composed option. Fallback: false.");
48
48
  composed = false;
49
49
  }
50
50
  if (typeof filter !== "undefined" && typeof filter !== "function") {
51
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
51
+ console.warn(
52
+ "Invalid filter function. Fallback: no filter function (undefined)."
53
+ );
52
54
  filter = void 0;
53
55
  }
54
56
  if (typeof include !== "undefined" && typeof include !== "function") {
55
- console.warn("Invalid include. Fallback: no include function (undefined).");
57
+ console.warn(
58
+ "Invalid include function. Fallback: no include function (undefined)."
59
+ );
56
60
  include = void 0;
57
61
  }
58
62
  const elements = [];
@@ -153,6 +157,10 @@ function isFocusable(element) {
153
157
  return true;
154
158
  }
155
159
  function getRelativeFocusable(container, offset, options) {
160
+ if (!(container instanceof Element)) {
161
+ console.warn("Invalid container element. Fallback: <body> element.");
162
+ container = document.body;
163
+ }
156
164
  let {
157
165
  anchor = getActiveElement(),
158
166
  composed = false,
@@ -175,19 +183,23 @@ function getRelativeFocusable(container, offset, options) {
175
183
  return null;
176
184
  }
177
185
  if (typeof composed !== "boolean") {
178
- console.warn("Invalid composed. Fallback: false.");
186
+ console.warn("Invalid composed option. Fallback: false.");
179
187
  composed = false;
180
188
  }
181
189
  if (typeof filter !== "undefined" && typeof filter !== "function") {
182
- console.warn("Invalid filter. Fallback: no filter function (undefined).");
190
+ console.warn(
191
+ "Invalid filter function. Fallback: no filter function (undefined)."
192
+ );
183
193
  filter = void 0;
184
194
  }
185
195
  if (typeof include !== "undefined" && typeof include !== "function") {
186
- console.warn("Invalid include. Fallback: no include function (undefined).");
196
+ console.warn(
197
+ "Invalid include function. Fallback: no include function (undefined)."
198
+ );
187
199
  include = void 0;
188
200
  }
189
201
  if (typeof wrap !== "boolean") {
190
- console.warn("Invalid wrap. Fallback: false.");
202
+ console.warn("Invalid wrap option. Fallback: false.");
191
203
  wrap = false;
192
204
  }
193
205
  const focusables = getFocusables(container, { composed, filter, include });
@@ -421,7 +433,7 @@ function isUngroupedRadio(element) {
421
433
  * High-precision focus management utility with full composed tree support.
422
434
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
423
435
  *
424
- * @version 4.1.6
436
+ * @version 4.1.8
425
437
  * @author Yusuke Kamiyamane
426
438
  * @license MIT
427
439
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-focusable",
3
- "version": "4.1.6",
3
+ "version": "4.1.8",
4
4
  "description": "High-precision focus management utility with full composed tree support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",