power-focusable 4.3.10 → 4.3.11

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,25 +24,27 @@ import {
24
24
  } from 'power-focusable';
25
25
 
26
26
  // CDNs
27
- import { ... } 'https://esm.sh/power-focusable@4.3.10';
27
+ import { ... } 'https://esm.sh/power-focusable@4.3.11';
28
28
  // or
29
- import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.10/+esm';
29
+ import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.11/+esm';
30
30
  // or
31
- import { ... } 'https://esm.unpkg.com/power-focusable@4.3.10';
31
+ import { ... } 'https://esm.unpkg.com/power-focusable@4.3.11';
32
32
  ```
33
33
 
34
34
  ## 🪄 Options
35
35
 
36
36
  ```ts
37
37
  interface PowerFocusableOptions {
38
- anchor: Element | null; // default: active element
38
+ anchor: Element | null; // default: DocumentOrShadowRoot activeElement
39
39
  composed: boolean; // default: false
40
- filter: (element: Element) => boolean;
41
- include: (element: Element) => boolean;
40
+ filter: PowerFocusableFunction; // default: undefined
41
+ include: PowerFocusableFunction; // default: undefined
42
42
  skipNegativeTabIndexCheck: boolean; // default: false
43
43
  skipVisibilityCheck: boolean; // default: false
44
44
  wrap: boolean; // default: false
45
45
  }
46
+
47
+ type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
46
48
  ```
47
49
 
48
50
  ### `anchor`
package/dist/index.cjs CHANGED
@@ -248,9 +248,13 @@ function getRelativeFocusable(container, offset, options) {
248
248
  console.warn("Invalid wrap option. Fallback: false.");
249
249
  wrap = false;
250
250
  }
251
- const settings = { composed, skipNegativeTabIndexCheck, skipVisibilityCheck };
252
- filter && Object.assign(settings, { filter });
253
- include && Object.assign(settings, { include });
251
+ const settings = {
252
+ composed,
253
+ filter,
254
+ include,
255
+ skipNegativeTabIndexCheck,
256
+ skipVisibilityCheck
257
+ };
254
258
  const focusables = getFocusables(container, settings);
255
259
  const { length } = focusables;
256
260
  if (!length) {
@@ -472,7 +476,7 @@ function isUngroupedRadio(element) {
472
476
  * High-precision focus management utility with full composed tree support.
473
477
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
474
478
  *
475
- * @version 4.3.10
479
+ * @version 4.3.11
476
480
  * @author Yusuke Kamiyamane
477
481
  * @license MIT
478
482
  * @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.10
6
+ * @version 4.3.11
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -12,12 +12,13 @@
12
12
  interface PowerFocusableOptions {
13
13
  anchor: Element | null;
14
14
  composed: boolean;
15
- filter: (element: Element) => boolean;
16
- include: (element: Element) => boolean;
15
+ filter: PowerFocusableFunction;
16
+ include: PowerFocusableFunction;
17
17
  skipNegativeTabIndexCheck: boolean;
18
18
  skipVisibilityCheck: boolean;
19
19
  wrap: boolean;
20
20
  }
21
+ type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
21
22
  declare function createFocusTrap(container?: Element): () => void;
22
23
  declare function getFocusables(container?: Element, options?: Partial<Omit<PowerFocusableOptions, 'anchor' | 'wrap'>>): Element[];
23
24
  declare function getNextFocusable(container?: Element, options?: Partial<PowerFocusableOptions>): Element | null;
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.10
6
+ * @version 4.3.11
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -12,12 +12,13 @@
12
12
  interface PowerFocusableOptions {
13
13
  anchor: Element | null;
14
14
  composed: boolean;
15
- filter: (element: Element) => boolean;
16
- include: (element: Element) => boolean;
15
+ filter: PowerFocusableFunction;
16
+ include: PowerFocusableFunction;
17
17
  skipNegativeTabIndexCheck: boolean;
18
18
  skipVisibilityCheck: boolean;
19
19
  wrap: boolean;
20
20
  }
21
+ type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
21
22
  declare function createFocusTrap(container?: Element): () => void;
22
23
  declare function getFocusables(container?: Element, options?: Partial<Omit<PowerFocusableOptions, 'anchor' | 'wrap'>>): Element[];
23
24
  declare function getNextFocusable(container?: Element, options?: Partial<PowerFocusableOptions>): Element | null;
package/dist/index.js CHANGED
@@ -246,9 +246,13 @@ function getRelativeFocusable(container, offset, options) {
246
246
  console.warn("Invalid wrap option. Fallback: false.");
247
247
  wrap = false;
248
248
  }
249
- const settings = { composed, skipNegativeTabIndexCheck, skipVisibilityCheck };
250
- filter && Object.assign(settings, { filter });
251
- include && Object.assign(settings, { include });
249
+ const settings = {
250
+ composed,
251
+ filter,
252
+ include,
253
+ skipNegativeTabIndexCheck,
254
+ skipVisibilityCheck
255
+ };
252
256
  const focusables = getFocusables(container, settings);
253
257
  const { length } = focusables;
254
258
  if (!length) {
@@ -470,7 +474,7 @@ function isUngroupedRadio(element) {
470
474
  * High-precision focus management utility with full composed tree support.
471
475
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
472
476
  *
473
- * @version 4.3.10
477
+ * @version 4.3.11
474
478
  * @author Yusuke Kamiyamane
475
479
  * @license MIT
476
480
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-focusable",
3
- "version": "4.3.10",
3
+ "version": "4.3.11",
4
4
  "description": "High-precision focus management utility with full composed tree support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",