power-focusable 4.3.9 → 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.9';
27
+ import { ... } 'https://esm.sh/power-focusable@4.3.11';
28
28
  // or
29
- import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.9/+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.9';
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,13 +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
- if (filter !== void 0) {
253
- Object.assign(settings, { filter });
254
- }
255
- if (include !== void 0) {
256
- Object.assign(settings, { include });
257
- }
251
+ const settings = {
252
+ composed,
253
+ filter,
254
+ include,
255
+ skipNegativeTabIndexCheck,
256
+ skipVisibilityCheck
257
+ };
258
258
  const focusables = getFocusables(container, settings);
259
259
  const { length } = focusables;
260
260
  if (!length) {
@@ -476,7 +476,7 @@ function isUngroupedRadio(element) {
476
476
  * High-precision focus management utility with full composed tree support.
477
477
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
478
478
  *
479
- * @version 4.3.9
479
+ * @version 4.3.11
480
480
  * @author Yusuke Kamiyamane
481
481
  * @license MIT
482
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.9
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.9
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,13 +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
- if (filter !== void 0) {
251
- Object.assign(settings, { filter });
252
- }
253
- if (include !== void 0) {
254
- Object.assign(settings, { include });
255
- }
249
+ const settings = {
250
+ composed,
251
+ filter,
252
+ include,
253
+ skipNegativeTabIndexCheck,
254
+ skipVisibilityCheck
255
+ };
256
256
  const focusables = getFocusables(container, settings);
257
257
  const { length } = focusables;
258
258
  if (!length) {
@@ -474,7 +474,7 @@ function isUngroupedRadio(element) {
474
474
  * High-precision focus management utility with full composed tree support.
475
475
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
476
476
  *
477
- * @version 4.3.9
477
+ * @version 4.3.11
478
478
  * @author Yusuke Kamiyamane
479
479
  * @license MIT
480
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.9",
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",