@zag-js/aria-hidden 0.2.0 → 0.2.2

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.js CHANGED
@@ -28,15 +28,14 @@ function isLiveRegion(node, win) {
28
28
  return node instanceof win.HTMLElement && node.dataset.liveAnnouncer === "true";
29
29
  }
30
30
  function ariaHidden(targets, rootEl) {
31
- var _a;
32
31
  const exclude = targets.filter(Boolean);
33
32
  if (exclude.length === 0)
34
33
  return;
35
34
  const doc = exclude[0].ownerDocument || document;
36
- const win = (_a = doc.defaultView) != null ? _a : window;
35
+ const win = doc.defaultView ?? window;
37
36
  const visibleNodes = new Set(exclude);
38
37
  const hiddenNodes = /* @__PURE__ */ new Set();
39
- const root = rootEl != null ? rootEl : doc.body;
38
+ const root = rootEl ?? doc.body;
40
39
  const walker = doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
41
40
  acceptNode(node2) {
42
41
  if (isLiveRegion(node2, win)) {
@@ -55,8 +54,7 @@ function ariaHidden(targets, rootEl) {
55
54
  }
56
55
  });
57
56
  const hide = (node2) => {
58
- var _a2;
59
- let refCount = (_a2 = elementCountMap.get(node2)) != null ? _a2 : 0;
57
+ let refCount = elementCountMap.get(node2) ?? 0;
60
58
  if (node2.getAttribute("aria-hidden") === "true" && refCount === 0) {
61
59
  return;
62
60
  }
package/dist/index.mjs CHANGED
@@ -4,15 +4,14 @@ function isLiveRegion(node, win) {
4
4
  return node instanceof win.HTMLElement && node.dataset.liveAnnouncer === "true";
5
5
  }
6
6
  function ariaHidden(targets, rootEl) {
7
- var _a;
8
7
  const exclude = targets.filter(Boolean);
9
8
  if (exclude.length === 0)
10
9
  return;
11
10
  const doc = exclude[0].ownerDocument || document;
12
- const win = (_a = doc.defaultView) != null ? _a : window;
11
+ const win = doc.defaultView ?? window;
13
12
  const visibleNodes = new Set(exclude);
14
13
  const hiddenNodes = /* @__PURE__ */ new Set();
15
- const root = rootEl != null ? rootEl : doc.body;
14
+ const root = rootEl ?? doc.body;
16
15
  const walker = doc.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
17
16
  acceptNode(node2) {
18
17
  if (isLiveRegion(node2, win)) {
@@ -31,8 +30,7 @@ function ariaHidden(targets, rootEl) {
31
30
  }
32
31
  });
33
32
  const hide = (node2) => {
34
- var _a2;
35
- let refCount = (_a2 = elementCountMap.get(node2)) != null ? _a2 : 0;
33
+ let refCount = elementCountMap.get(node2) ?? 0;
36
34
  if (node2.getAttribute("aria-hidden") === "true" && refCount === 0) {
37
35
  return;
38
36
  }
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@zag-js/aria-hidden",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Hide targets from screen readers",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
5
  "keywords": [
9
6
  "js",
10
7
  "utils",
@@ -24,10 +21,25 @@
24
21
  "bugs": {
25
22
  "url": "https://github.com/chakra-ui/zag/issues"
26
23
  },
24
+ "clean-package": "../../../clean-package.config.json",
25
+ "main": "dist/index.js",
26
+ "devDependencies": {
27
+ "clean-package": "2.2.0"
28
+ },
29
+ "module": "dist/index.mjs",
30
+ "types": "dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.mjs",
35
+ "require": "./dist/index.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
27
39
  "scripts": {
28
- "build-fast": "tsup src/index.ts --format=esm,cjs",
40
+ "build-fast": "tsup src",
29
41
  "start": "pnpm build --watch",
30
- "build": "tsup src/index.ts --format=esm,cjs --dts",
42
+ "build": "tsup src --dts",
31
43
  "test": "jest --config ../../../jest.config.js --rootDir tests",
32
44
  "lint": "eslint src --ext .ts,.tsx",
33
45
  "test-ci": "pnpm test --ci --runInBand -u",