@zag-js/live-region 0.1.4 → 0.2.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 CHANGED
@@ -44,13 +44,14 @@ function setVisuallyHidden(el) {
44
44
  // src/index.ts
45
45
  var ID = "__live-region__";
46
46
  function createLiveRegion(opts = {}) {
47
+ var _a;
47
48
  const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
48
- const win = doc.defaultView ?? window;
49
- const parent = root ?? doc.body;
49
+ const win = (_a = doc.defaultView) != null ? _a : window;
50
+ const parent = root != null ? root : doc.body;
50
51
  function announce(message, delay) {
51
52
  const oldRegion = doc.getElementById(ID);
52
53
  oldRegion == null ? void 0 : oldRegion.remove();
53
- delay = delay ?? _delay;
54
+ delay = delay != null ? delay : _delay;
54
55
  const region = doc.createElement("span");
55
56
  region.id = ID;
56
57
  region.dataset.liveAnnouncer = "true";
package/dist/index.mjs CHANGED
@@ -18,13 +18,14 @@ function setVisuallyHidden(el) {
18
18
  // src/index.ts
19
19
  var ID = "__live-region__";
20
20
  function createLiveRegion(opts = {}) {
21
+ var _a;
21
22
  const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
22
- const win = doc.defaultView ?? window;
23
- const parent = root ?? doc.body;
23
+ const win = (_a = doc.defaultView) != null ? _a : window;
24
+ const parent = root != null ? root : doc.body;
24
25
  function announce(message, delay) {
25
26
  const oldRegion = doc.getElementById(ID);
26
27
  oldRegion == null ? void 0 : oldRegion.remove();
27
- delay = delay ?? _delay;
28
+ delay = delay != null ? delay : _delay;
28
29
  const region = doc.createElement("span");
29
30
  region.id = ID;
30
31
  region.dataset.liveAnnouncer = "true";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/live-region",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Implementing live region for screen readers",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -19,7 +19,7 @@
19
19
  "dist/**/*"
20
20
  ],
21
21
  "devDependencies": {
22
- "@zag-js/dom-utils": "0.1.13"
22
+ "@zag-js/dom-utils": "0.2.0"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"