@zag-js/aria-hidden 0.69.0 → 0.71.0
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 +6 -30
- package/dist/index.mjs +4 -5
- package/package.json +3 -4
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/src/index.ts +0 -30
package/dist/index.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ariaHidden$1 = require('aria-hidden');
|
|
19
4
|
|
|
20
5
|
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
ariaHidden: () => ariaHidden
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_aria_hidden = require("aria-hidden");
|
|
27
6
|
var raf = (fn) => {
|
|
28
7
|
const frameId = requestAnimationFrame(() => fn());
|
|
29
8
|
return () => cancelAnimationFrame(frameId);
|
|
@@ -36,15 +15,12 @@ function ariaHidden(targetsOrFn, options = {}) {
|
|
|
36
15
|
func(() => {
|
|
37
16
|
const targets = typeof targetsOrFn === "function" ? targetsOrFn() : targetsOrFn;
|
|
38
17
|
const elements = targets.filter(Boolean);
|
|
39
|
-
cleanups.push(
|
|
18
|
+
cleanups.push(ariaHidden$1.hideOthers(elements));
|
|
40
19
|
})
|
|
41
20
|
);
|
|
42
21
|
return () => {
|
|
43
22
|
cleanups.forEach((fn) => fn?.());
|
|
44
23
|
};
|
|
45
24
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ariaHidden
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
25
|
+
|
|
26
|
+
exports.ariaHidden = ariaHidden;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { hideOthers } from 'aria-hidden';
|
|
2
|
+
|
|
1
3
|
// src/index.ts
|
|
2
|
-
import { hideOthers } from "aria-hidden";
|
|
3
4
|
var raf = (fn) => {
|
|
4
5
|
const frameId = requestAnimationFrame(() => fn());
|
|
5
6
|
return () => cancelAnimationFrame(frameId);
|
|
@@ -19,7 +20,5 @@ function ariaHidden(targetsOrFn, options = {}) {
|
|
|
19
20
|
cleanups.forEach((fn) => fn?.());
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=index.mjs.map
|
|
23
|
+
|
|
24
|
+
export { ariaHidden };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/aria-hidden",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"description": "Hide targets from screen readers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/utilities/aria-hidden",
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
"src"
|
|
16
|
+
"dist"
|
|
18
17
|
],
|
|
19
18
|
"publishConfig": {
|
|
20
19
|
"access": "public"
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
},
|
|
43
42
|
"scripts": {
|
|
44
43
|
"build": "tsup",
|
|
45
|
-
"test": "
|
|
44
|
+
"test": "vitest",
|
|
46
45
|
"lint": "eslint src",
|
|
47
46
|
"test-ci": "pnpm test --ci --runInBand -u",
|
|
48
47
|
"test-watch": "pnpm test --watchAll"
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { hideOthers } from \"aria-hidden\"\n\nconst raf = (fn: VoidFunction) => {\n const frameId = requestAnimationFrame(() => fn())\n return () => cancelAnimationFrame(frameId)\n}\n\ntype MaybeElement = HTMLElement | null\ntype Targets = Array<MaybeElement>\ntype TargetsOrFn = Targets | (() => Targets)\n\ntype Options = {\n defer?: boolean\n}\n\nexport function ariaHidden(targetsOrFn: TargetsOrFn, options: Options = {}) {\n const { defer = true } = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const targets = typeof targetsOrFn === \"function\" ? targetsOrFn() : targetsOrFn\n const elements = targets.filter(Boolean) as HTMLElement[]\n cleanups.push(hideOthers(elements))\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA2B;AAE3B,IAAM,MAAM,CAAC,OAAqB;AAChC,QAAM,UAAU,sBAAsB,MAAM,GAAG,CAAC;AAChD,SAAO,MAAM,qBAAqB,OAAO;AAC3C;AAUO,SAAS,WAAW,aAA0B,UAAmB,CAAC,GAAG;AAC1E,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,OAAO,QAAQ,MAAM,CAAC,MAAW,EAAE;AACzC,QAAM,WAAyC,CAAC;AAChD,WAAS;AAAA,IACP,KAAK,MAAM;AACT,YAAM,UAAU,OAAO,gBAAgB,aAAa,YAAY,IAAI;AACpE,YAAM,WAAW,QAAQ,OAAO,OAAO;AACvC,eAAS,SAAK,+BAAW,QAAQ,CAAC;AAAA,IACpC,CAAC;AAAA,EACH;AACA,SAAO,MAAM;AACX,aAAS,QAAQ,CAAC,OAAO,KAAK,CAAC;AAAA,EACjC;AACF;","names":[]}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { hideOthers } from \"aria-hidden\"\n\nconst raf = (fn: VoidFunction) => {\n const frameId = requestAnimationFrame(() => fn())\n return () => cancelAnimationFrame(frameId)\n}\n\ntype MaybeElement = HTMLElement | null\ntype Targets = Array<MaybeElement>\ntype TargetsOrFn = Targets | (() => Targets)\n\ntype Options = {\n defer?: boolean\n}\n\nexport function ariaHidden(targetsOrFn: TargetsOrFn, options: Options = {}) {\n const { defer = true } = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const targets = typeof targetsOrFn === \"function\" ? targetsOrFn() : targetsOrFn\n const elements = targets.filter(Boolean) as HTMLElement[]\n cleanups.push(hideOthers(elements))\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,IAAM,MAAM,CAAC,OAAqB;AAChC,QAAM,UAAU,sBAAsB,MAAM,GAAG,CAAC;AAChD,SAAO,MAAM,qBAAqB,OAAO;AAC3C;AAUO,SAAS,WAAW,aAA0B,UAAmB,CAAC,GAAG;AAC1E,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,OAAO,QAAQ,MAAM,CAAC,MAAW,EAAE;AACzC,QAAM,WAAyC,CAAC;AAChD,WAAS;AAAA,IACP,KAAK,MAAM;AACT,YAAM,UAAU,OAAO,gBAAgB,aAAa,YAAY,IAAI;AACpE,YAAM,WAAW,QAAQ,OAAO,OAAO;AACvC,eAAS,KAAK,WAAW,QAAQ,CAAC;AAAA,IACpC,CAAC;AAAA,EACH;AACA,SAAO,MAAM;AACX,aAAS,QAAQ,CAAC,OAAO,KAAK,CAAC;AAAA,EACjC;AACF;","names":[]}
|
package/src/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { hideOthers } from "aria-hidden"
|
|
2
|
-
|
|
3
|
-
const raf = (fn: VoidFunction) => {
|
|
4
|
-
const frameId = requestAnimationFrame(() => fn())
|
|
5
|
-
return () => cancelAnimationFrame(frameId)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
type MaybeElement = HTMLElement | null
|
|
9
|
-
type Targets = Array<MaybeElement>
|
|
10
|
-
type TargetsOrFn = Targets | (() => Targets)
|
|
11
|
-
|
|
12
|
-
type Options = {
|
|
13
|
-
defer?: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function ariaHidden(targetsOrFn: TargetsOrFn, options: Options = {}) {
|
|
17
|
-
const { defer = true } = options
|
|
18
|
-
const func = defer ? raf : (v: any) => v()
|
|
19
|
-
const cleanups: (VoidFunction | undefined)[] = []
|
|
20
|
-
cleanups.push(
|
|
21
|
-
func(() => {
|
|
22
|
-
const targets = typeof targetsOrFn === "function" ? targetsOrFn() : targetsOrFn
|
|
23
|
-
const elements = targets.filter(Boolean) as HTMLElement[]
|
|
24
|
-
cleanups.push(hideOthers(elements))
|
|
25
|
-
}),
|
|
26
|
-
)
|
|
27
|
-
return () => {
|
|
28
|
-
cleanups.forEach((fn) => fn?.())
|
|
29
|
-
}
|
|
30
|
-
}
|