power-focusable 4.3.25 → 4.3.27

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Yusuke Kamiyamane
3
+ Copyright (c) Yusuke Kamiyamane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -24,11 +24,11 @@ import {
24
24
  } from 'power-focusable';
25
25
 
26
26
  // CDNs
27
- import { ... } 'https://esm.sh/power-focusable@4.3.25';
27
+ import { ... } 'https://esm.sh/power-focusable@4.3.27';
28
28
  // or
29
- import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.25/+esm';
29
+ import { ... } 'https://cdn.jsdelivr.net/npm/power-focusable@4.3.27/+esm';
30
30
  // or
31
- import { ... } 'https://esm.unpkg.com/power-focusable@4.3.25';
31
+ import { ... } 'https://esm.unpkg.com/power-focusable@4.3.27';
32
32
  ```
33
33
 
34
34
  ## 🪄 Options
@@ -37,14 +37,14 @@ import { ... } 'https://esm.unpkg.com/power-focusable@4.3.25';
37
37
  interface PowerFocusableOptions {
38
38
  anchor: Element | null; // default: DocumentOrShadowRoot.activeElement
39
39
  composed: boolean; // default: false
40
- filter: PowerFocusableFunction; // default: undefined
41
- include: PowerFocusableFunction; // default: undefined
40
+ filter: Predicate<Element>; // default: undefined
41
+ include: Predicate<Element>; // default: undefined
42
42
  skipNegativeTabIndexCheck: boolean; // default: false
43
43
  skipVisibilityCheck: boolean; // default: false
44
44
  wrap: boolean; // default: false
45
45
  }
46
46
 
47
- type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
47
+ type Predicate<T> = (element: T) => boolean;
48
48
  ```
49
49
 
50
50
  ### `anchor`
package/dist/index.cjs CHANGED
@@ -261,11 +261,11 @@ function getRelativeFocusable(container, offset, options) {
261
261
  }
262
262
  const settings = {
263
263
  composed,
264
- filter,
265
- include,
266
264
  skipNegativeTabIndexCheck,
267
265
  skipVisibilityCheck
268
266
  };
267
+ filter && Object.assign(settings, { filter });
268
+ include && Object.assign(settings, { include });
269
269
  const focusables = getFocusables(container, settings);
270
270
  const { length } = focusables;
271
271
  if (!length) {
@@ -494,7 +494,7 @@ function isUngroupedRadio(element) {
494
494
  * High-precision focus management utility with full composed tree support.
495
495
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
496
496
  *
497
- * @version 4.3.25
497
+ * @version 4.3.27
498
498
  * @author Yusuke Kamiyamane
499
499
  * @license MIT
500
500
  * @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.25
6
+ * @version 4.3.27
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -12,13 +12,13 @@
12
12
  interface PowerFocusableOptions {
13
13
  anchor: Element | null;
14
14
  composed: boolean;
15
- filter: PowerFocusableFunction;
16
- include: PowerFocusableFunction;
15
+ filter: Predicate<Element>;
16
+ include: Predicate<Element>;
17
17
  skipNegativeTabIndexCheck: boolean;
18
18
  skipVisibilityCheck: boolean;
19
19
  wrap: boolean;
20
20
  }
21
- type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
21
+ type Predicate<T> = (element: T) => boolean;
22
22
  declare function createFocusTrap(container?: Element): () => void;
23
23
  declare function getFocusables(container?: Element, options?: Partial<Omit<PowerFocusableOptions, 'anchor' | 'wrap'>>): Element[];
24
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.25
6
+ * @version 4.3.27
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
@@ -12,13 +12,13 @@
12
12
  interface PowerFocusableOptions {
13
13
  anchor: Element | null;
14
14
  composed: boolean;
15
- filter: PowerFocusableFunction;
16
- include: PowerFocusableFunction;
15
+ filter: Predicate<Element>;
16
+ include: Predicate<Element>;
17
17
  skipNegativeTabIndexCheck: boolean;
18
18
  skipVisibilityCheck: boolean;
19
19
  wrap: boolean;
20
20
  }
21
- type PowerFocusableFunction = ((element: Element) => boolean) | undefined;
21
+ type Predicate<T> = (element: T) => boolean;
22
22
  declare function createFocusTrap(container?: Element): () => void;
23
23
  declare function getFocusables(container?: Element, options?: Partial<Omit<PowerFocusableOptions, 'anchor' | 'wrap'>>): Element[];
24
24
  declare function getNextFocusable(container?: Element, options?: Partial<PowerFocusableOptions>): Element | null;
package/dist/index.js CHANGED
@@ -259,11 +259,11 @@ function getRelativeFocusable(container, offset, options) {
259
259
  }
260
260
  const settings = {
261
261
  composed,
262
- filter,
263
- include,
264
262
  skipNegativeTabIndexCheck,
265
263
  skipVisibilityCheck
266
264
  };
265
+ filter && Object.assign(settings, { filter });
266
+ include && Object.assign(settings, { include });
267
267
  const focusables = getFocusables(container, settings);
268
268
  const { length } = focusables;
269
269
  if (!length) {
@@ -492,7 +492,7 @@ function isUngroupedRadio(element) {
492
492
  * High-precision focus management utility with full composed tree support.
493
493
  * Handles complex focus rules including tabindex ordering, radio groups, inert.
494
494
  *
495
- * @version 4.3.25
495
+ * @version 4.3.27
496
496
  * @author Yusuke Kamiyamane
497
497
  * @license MIT
498
498
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,28 +1,7 @@
1
1
  {
2
2
  "name": "power-focusable",
3
- "version": "4.3.25",
3
+ "version": "4.3.27",
4
4
  "description": "High-precision focus management utility with full composed tree support",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
14
- }
15
- },
16
- "files": [
17
- "dist",
18
- "LICENSE",
19
- "README.md"
20
- ],
21
- "scripts": {
22
- "build": "tsup",
23
- "prepublishOnly": "npm run build",
24
- "lint": "tsc --noEmit"
25
- },
26
5
  "keywords": [
27
6
  "a11y",
28
7
  "accessibility",
@@ -34,16 +13,37 @@
34
13
  "typescript",
35
14
  "utility"
36
15
  ],
37
- "author": "Yusuke Kamiyamane",
38
- "license": "MIT",
16
+ "homepage": "https://github.com/y14e/power-focusable#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/y14e/power-focusable/issues"
19
+ },
39
20
  "repository": {
40
21
  "type": "git",
41
22
  "url": "git+https://github.com/y14e/power-focusable.git"
42
23
  },
43
- "bugs": {
44
- "url": "https://github.com/y14e/power-focusable/issues"
24
+ "license": "MIT",
25
+ "author": "Yusuke Kamiyamane",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "require": "./dist/index.cjs"
32
+ }
33
+ },
34
+ "main": "./dist/index.cjs",
35
+ "module": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "files": [
38
+ "dist",
39
+ "LICENSE",
40
+ "README.md"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "lint": "tsc --noEmit",
45
+ "prepublishOnly": "npm run build"
45
46
  },
46
- "homepage": "https://github.com/y14e/power-focusable#readme",
47
47
  "devDependencies": {
48
48
  "bun-types": "latest",
49
49
  "happy-dom": "^20.9.0",
@@ -53,5 +53,8 @@
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=18"
56
+ },
57
+ "allowScripts": {
58
+ "esbuild": true
56
59
  }
57
60
  }