@zag-js/toast 0.0.0-dev-20230220134212 → 0.0.0-dev-20230221113221

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.
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-XQSCE3HI.mjs";
12
12
  import {
13
13
  dom
14
- } from "./chunk-AZ32UDL3.mjs";
14
+ } from "./chunk-CUDYFIYR.mjs";
15
15
 
16
16
  // src/toast-group.connect.ts
17
17
  import { subscribe } from "@zag-js/core";
@@ -18,7 +18,13 @@ function defineDomHelpers(helpers) {
18
18
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
19
19
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
20
20
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
21
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
21
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
22
+ queryById: (ctx, id) => {
23
+ const el = dom2.getById(ctx, id);
24
+ if (!el)
25
+ throw new Error(`Element with id "${id}" not found.`);
26
+ return el;
27
+ }
22
28
  };
23
29
  return {
24
30
  ...dom2,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-XQSCE3HI.mjs";
8
8
  import {
9
9
  dom
10
- } from "./chunk-AZ32UDL3.mjs";
10
+ } from "./chunk-CUDYFIYR.mjs";
11
11
 
12
12
  // src/toast.machine.ts
13
13
  import { createMachine, guards } from "@zag-js/core";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GQHI2OMI.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-AZ32UDL3.mjs";
6
+ } from "./chunk-CUDYFIYR.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compact,
3
3
  createToastMachine
4
- } from "./chunk-SSV22S55.mjs";
4
+ } from "./chunk-FNDQ2PGP.mjs";
5
5
 
6
6
  // src/toast-group.machine.ts
7
7
  import { createMachine } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -96,7 +96,13 @@ function defineDomHelpers(helpers) {
96
96
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
97
97
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
98
98
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
99
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
99
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
100
+ queryById: (ctx, id) => {
101
+ const el = dom2.getById(ctx, id);
102
+ if (!el)
103
+ throw new Error(`Element with id "${id}" not found.`);
104
+ return el;
105
+ }
100
106
  };
101
107
  return {
102
108
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-HRZITBY3.mjs";
4
+ } from "./chunk-2GSH3KLH.mjs";
5
5
  import {
6
6
  groupMachine
7
- } from "./chunk-GKMHTDAP.mjs";
7
+ } from "./chunk-T4OOXF4T.mjs";
8
8
  import {
9
9
  connect
10
- } from "./chunk-HDTOIF42.mjs";
10
+ } from "./chunk-J4KJ6G3Z.mjs";
11
11
  import {
12
12
  anatomy
13
13
  } from "./chunk-GQHI2OMI.mjs";
14
14
  import {
15
15
  createToastMachine
16
- } from "./chunk-SSV22S55.mjs";
16
+ } from "./chunk-FNDQ2PGP.mjs";
17
17
  import "./chunk-LHAZKBRJ.mjs";
18
18
  import "./chunk-XQSCE3HI.mjs";
19
- import "./chunk-AZ32UDL3.mjs";
19
+ import "./chunk-CUDYFIYR.mjs";
20
20
 
21
21
  // ../../utilities/core/src/warning.ts
22
22
  function warn(...a) {
@@ -64,7 +64,13 @@ function defineDomHelpers(helpers) {
64
64
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
65
65
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
66
66
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
67
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
67
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
68
+ queryById: (ctx, id) => {
69
+ const el = dom2.getById(ctx, id);
70
+ if (!el)
71
+ throw new Error(`Element with id "${id}" not found.`);
72
+ return el;
73
+ }
68
74
  };
69
75
  return {
70
76
  ...dom2,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-HRZITBY3.mjs";
4
+ } from "./chunk-2GSH3KLH.mjs";
5
5
  import "./chunk-GQHI2OMI.mjs";
6
6
  import "./chunk-LHAZKBRJ.mjs";
7
7
  import "./chunk-XQSCE3HI.mjs";
8
- import "./chunk-AZ32UDL3.mjs";
8
+ import "./chunk-CUDYFIYR.mjs";
9
9
  export {
10
10
  groupConnect,
11
11
  toaster
@@ -69,7 +69,13 @@ function defineDomHelpers(helpers) {
69
69
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
70
70
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
71
71
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
72
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
72
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
73
+ queryById: (ctx, id) => {
74
+ const el = dom2.getById(ctx, id);
75
+ if (!el)
76
+ throw new Error(`Element with id "${id}" not found.`);
77
+ return el;
78
+ }
73
79
  };
74
80
  return {
75
81
  ...dom2,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  groupMachine
3
- } from "./chunk-GKMHTDAP.mjs";
4
- import "./chunk-SSV22S55.mjs";
3
+ } from "./chunk-T4OOXF4T.mjs";
4
+ import "./chunk-FNDQ2PGP.mjs";
5
5
  import "./chunk-LHAZKBRJ.mjs";
6
6
  import "./chunk-XQSCE3HI.mjs";
7
- import "./chunk-AZ32UDL3.mjs";
7
+ import "./chunk-CUDYFIYR.mjs";
8
8
  export {
9
9
  groupMachine
10
10
  };
@@ -49,7 +49,13 @@ function defineDomHelpers(helpers) {
49
49
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
50
50
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
51
51
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
52
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
52
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
53
+ queryById: (ctx, id) => {
54
+ const el = dom2.getById(ctx, id);
55
+ if (!el)
56
+ throw new Error(`Element with id "${id}" not found.`);
57
+ return el;
58
+ }
53
59
  };
54
60
  return {
55
61
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-HDTOIF42.mjs";
3
+ } from "./chunk-J4KJ6G3Z.mjs";
4
4
  import "./chunk-GQHI2OMI.mjs";
5
- import "./chunk-AZ32UDL3.mjs";
5
+ import "./chunk-CUDYFIYR.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -18,6 +18,9 @@ declare const dom: {
18
18
  getById: <T = HTMLElement>(ctx: {
19
19
  getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
20
20
  }, id: string) => T | null;
21
+ queryById: <T_1 = HTMLElement>(ctx: {
22
+ getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
23
+ }, id: string) => T_1;
21
24
  } & {
22
25
  getGroupId: (placement: Placement) => string;
23
26
  getRootId: (ctx: MachineContext) => string;
package/dist/toast.dom.js CHANGED
@@ -44,7 +44,13 @@ function defineDomHelpers(helpers) {
44
44
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
45
45
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
46
46
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
47
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
47
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
48
+ queryById: (ctx, id) => {
49
+ const el = dom2.getById(ctx, id);
50
+ if (!el)
51
+ throw new Error(`Element with id "${id}" not found.`);
52
+ return el;
53
+ }
48
54
  };
49
55
  return {
50
56
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-AZ32UDL3.mjs";
3
+ } from "./chunk-CUDYFIYR.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -66,7 +66,13 @@ function defineDomHelpers(helpers) {
66
66
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
67
67
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
68
68
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
69
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
69
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
70
+ queryById: (ctx, id) => {
71
+ const el = dom2.getById(ctx, id);
72
+ if (!el)
73
+ throw new Error(`Element with id "${id}" not found.`);
74
+ return el;
75
+ }
70
76
  };
71
77
  return {
72
78
  ...dom2,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createToastMachine
3
- } from "./chunk-SSV22S55.mjs";
3
+ } from "./chunk-FNDQ2PGP.mjs";
4
4
  import "./chunk-LHAZKBRJ.mjs";
5
5
  import "./chunk-XQSCE3HI.mjs";
6
- import "./chunk-AZ32UDL3.mjs";
6
+ import "./chunk-CUDYFIYR.mjs";
7
7
  export {
8
8
  createToastMachine
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.0.0-dev-20230220134212",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@zag-js/anatomy": "0.1.4",
30
- "@zag-js/core": "0.0.0-dev-20230220134212",
30
+ "@zag-js/core": "0.0.0-dev-20230221113221",
31
31
  "@zag-js/types": "0.3.4"
32
32
  },
33
33
  "devDependencies": {