@zag-js/live-region 0.10.2 → 0.10.4
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.d.ts +3 -5
- package/dist/index.js +9 -31
- package/dist/index.mjs +5 -6
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
type LiveRegionOptions = {
|
|
1
|
+
export type LiveRegionOptions = {
|
|
2
2
|
level: "polite" | "assertive";
|
|
3
3
|
document?: Document;
|
|
4
4
|
root?: HTMLElement | null;
|
|
5
5
|
delay?: number;
|
|
6
6
|
};
|
|
7
|
-
type LiveRegion = ReturnType<typeof createLiveRegion>;
|
|
8
|
-
declare function createLiveRegion(opts?: Partial<LiveRegionOptions>): {
|
|
7
|
+
export type LiveRegion = ReturnType<typeof createLiveRegion>;
|
|
8
|
+
export declare function createLiveRegion(opts?: Partial<LiveRegionOptions>): {
|
|
9
9
|
announce: (message: string, delay?: number) => void;
|
|
10
10
|
destroy: () => void;
|
|
11
11
|
toJSON(): string;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
export { LiveRegion, LiveRegionOptions, createLiveRegion };
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
19
4
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
createLiveRegion: () => createLiveRegion
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_visually_hidden = require("@zag-js/visually-hidden");
|
|
27
|
-
var ID = "__live-region__";
|
|
5
|
+
const visuallyHidden = require('@zag-js/visually-hidden');
|
|
6
|
+
|
|
7
|
+
const ID = "__live-region__";
|
|
28
8
|
function createLiveRegion(opts = {}) {
|
|
29
9
|
const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
|
|
30
10
|
const win = doc.defaultView ?? window;
|
|
@@ -39,7 +19,7 @@ function createLiveRegion(opts = {}) {
|
|
|
39
19
|
const role = level !== "assertive" ? "status" : "alert";
|
|
40
20
|
region.setAttribute("aria-live", level);
|
|
41
21
|
region.setAttribute("role", role);
|
|
42
|
-
|
|
22
|
+
visuallyHidden.setVisuallyHidden(region);
|
|
43
23
|
parent.appendChild(region);
|
|
44
24
|
win.setTimeout(() => {
|
|
45
25
|
region.textContent = message;
|
|
@@ -57,7 +37,5 @@ function createLiveRegion(opts = {}) {
|
|
|
57
37
|
}
|
|
58
38
|
};
|
|
59
39
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
createLiveRegion
|
|
63
|
-
});
|
|
40
|
+
|
|
41
|
+
exports.createLiveRegion = createLiveRegion;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { setVisuallyHidden } from '@zag-js/visually-hidden';
|
|
2
|
+
|
|
3
|
+
const ID = "__live-region__";
|
|
4
4
|
function createLiveRegion(opts = {}) {
|
|
5
5
|
const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
|
|
6
6
|
const win = doc.defaultView ?? window;
|
|
@@ -33,6 +33,5 @@ function createLiveRegion(opts = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
36
|
+
|
|
37
|
+
export { createLiveRegion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/live-region",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "Implementing live region for screen readers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"src"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@zag-js/visually-hidden": "0.10.
|
|
20
|
+
"@zag-js/visually-hidden": "0.10.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"clean-package": "2.2.0"
|
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build
|
|
45
|
-
"start": "pnpm build --watch",
|
|
46
|
-
"build": "tsup src --dts",
|
|
44
|
+
"build": "vite build -c ../../../vite.config.ts",
|
|
47
45
|
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
48
46
|
"lint": "eslint src --ext .ts,.tsx",
|
|
49
47
|
"test-ci": "pnpm test --ci --runInBand -u",
|