power-focusable 4.3.8 → 4.3.10

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