@zag-js/toast 0.0.0-dev-20230202104422 → 0.0.0-dev-20230202113057

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.
@@ -33,16 +33,7 @@ var dom = defineDomHelpers({
33
33
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
34
34
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
35
35
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
36
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
37
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
38
- createPortalEl: (ctx) => {
39
- const existing = dom.getPortalEl(ctx);
40
- if (existing)
41
- return existing;
42
- const portal = dom.getDoc(ctx).createElement("toast-portal");
43
- portal.id = dom.getPortalId(ctx);
44
- return portal;
45
- }
36
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
46
37
  });
47
38
 
48
39
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compact,
3
3
  createToastMachine
4
- } from "./chunk-OA575KTP.mjs";
4
+ } from "./chunk-SSV22S55.mjs";
5
5
 
6
6
  // src/toast-group.machine.ts
7
7
  import { createMachine } from "@zag-js/core";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GQHI2OMI.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-BF5R6LHY.mjs";
6
+ } from "./chunk-AZ32UDL3.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-XQSCE3HI.mjs";
12
12
  import {
13
13
  dom
14
- } from "./chunk-BF5R6LHY.mjs";
14
+ } from "./chunk-AZ32UDL3.mjs";
15
15
 
16
16
  // src/toast-group.connect.ts
17
17
  import { subscribe } from "@zag-js/core";
@@ -119,22 +119,11 @@ function groupConnect(state, send, normalize) {
119
119
  style: getGroupPlacementStyle(state.context, placement)
120
120
  });
121
121
  },
122
- createPortal() {
123
- const doc = dom.getDoc(state.context);
124
- const exist = dom.getPortalEl(state.context);
125
- if (exist)
126
- return exist;
127
- const portal = dom.createPortalEl(state.context);
128
- doc.body.appendChild(portal);
129
- return portal;
130
- },
131
122
  subscribe(fn) {
132
123
  return subscribe(state.context.toasts, () => fn(state.context.toasts));
133
124
  }
134
125
  };
135
- if (!state.matches("unknown")) {
136
- Object.assign(toaster, group);
137
- }
126
+ Object.assign(toaster, group);
138
127
  return group;
139
128
  }
140
129
 
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-XQSCE3HI.mjs";
8
8
  import {
9
9
  dom
10
- } from "./chunk-BF5R6LHY.mjs";
10
+ } from "./chunk-AZ32UDL3.mjs";
11
11
 
12
12
  // src/toast.machine.ts
13
13
  import { createMachine, guards } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -138,16 +138,7 @@ var dom = defineDomHelpers({
138
138
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
139
139
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
140
140
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
141
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
142
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
143
- createPortalEl: (ctx) => {
144
- const existing = dom.getPortalEl(ctx);
145
- if (existing)
146
- return existing;
147
- const portal = dom.getDoc(ctx).createElement("toast-portal");
148
- portal.id = dom.getPortalId(ctx);
149
- return portal;
150
- }
141
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
151
142
  });
152
143
 
153
144
  // src/toast.utils.ts
@@ -315,22 +306,11 @@ function groupConnect(state, send, normalize) {
315
306
  style: getGroupPlacementStyle(state.context, placement)
316
307
  });
317
308
  },
318
- createPortal() {
319
- const doc = dom.getDoc(state.context);
320
- const exist = dom.getPortalEl(state.context);
321
- if (exist)
322
- return exist;
323
- const portal = dom.createPortalEl(state.context);
324
- doc.body.appendChild(portal);
325
- return portal;
326
- },
327
309
  subscribe(fn) {
328
310
  return (0, import_core.subscribe)(state.context.toasts, () => fn(state.context.toasts));
329
311
  }
330
312
  };
331
- if (!state.matches("unknown")) {
332
- Object.assign(toaster, group2);
333
- }
313
+ Object.assign(toaster, group2);
334
314
  return group2;
335
315
  }
336
316
 
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-2TE4H5B5.mjs";
4
+ } from "./chunk-HRZITBY3.mjs";
5
5
  import {
6
6
  groupMachine
7
- } from "./chunk-JPNOOB66.mjs";
7
+ } from "./chunk-GKMHTDAP.mjs";
8
8
  import {
9
9
  connect
10
- } from "./chunk-7CNVO66P.mjs";
10
+ } from "./chunk-HDTOIF42.mjs";
11
11
  import {
12
12
  anatomy
13
13
  } from "./chunk-GQHI2OMI.mjs";
14
14
  import {
15
15
  createToastMachine
16
- } from "./chunk-OA575KTP.mjs";
16
+ } from "./chunk-SSV22S55.mjs";
17
17
  import "./chunk-LHAZKBRJ.mjs";
18
18
  import "./chunk-XQSCE3HI.mjs";
19
- import "./chunk-BF5R6LHY.mjs";
19
+ import "./chunk-AZ32UDL3.mjs";
20
20
 
21
21
  // ../../utilities/core/src/warning.ts
22
22
  function warn(...a) {
@@ -21,7 +21,6 @@ declare function groupConnect<T extends PropTypes>(state: GroupState, send: Grou
21
21
  pause(id?: string): void;
22
22
  resume(id?: string): void;
23
23
  getGroupProps(options: GroupProps): T["element"];
24
- createPortal(): HTMLElement;
25
24
  subscribe(fn: (toasts: GroupMachineContext["toasts"]) => void): () => void;
26
25
  };
27
26
 
@@ -79,16 +79,7 @@ var dom = defineDomHelpers({
79
79
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
80
80
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
81
81
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
82
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
83
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
84
- createPortalEl: (ctx) => {
85
- const existing = dom.getPortalEl(ctx);
86
- if (existing)
87
- return existing;
88
- const portal = dom.getDoc(ctx).createElement("toast-portal");
89
- portal.id = dom.getPortalId(ctx);
90
- return portal;
91
- }
82
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
92
83
  });
93
84
 
94
85
  // src/toast.utils.ts
@@ -246,22 +237,11 @@ function groupConnect(state, send, normalize) {
246
237
  style: getGroupPlacementStyle(state.context, placement)
247
238
  });
248
239
  },
249
- createPortal() {
250
- const doc = dom.getDoc(state.context);
251
- const exist = dom.getPortalEl(state.context);
252
- if (exist)
253
- return exist;
254
- const portal = dom.createPortalEl(state.context);
255
- doc.body.appendChild(portal);
256
- return portal;
257
- },
258
240
  subscribe(fn) {
259
241
  return (0, import_core.subscribe)(state.context.toasts, () => fn(state.context.toasts));
260
242
  }
261
243
  };
262
- if (!state.matches("unknown")) {
263
- Object.assign(toaster, group);
264
- }
244
+ Object.assign(toaster, group);
265
245
  return group;
266
246
  }
267
247
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-2TE4H5B5.mjs";
4
+ } from "./chunk-HRZITBY3.mjs";
5
5
  import "./chunk-GQHI2OMI.mjs";
6
6
  import "./chunk-LHAZKBRJ.mjs";
7
7
  import "./chunk-XQSCE3HI.mjs";
8
- import "./chunk-BF5R6LHY.mjs";
8
+ import "./chunk-AZ32UDL3.mjs";
9
9
  export {
10
10
  groupConnect,
11
11
  toaster
@@ -106,16 +106,7 @@ var dom = defineDomHelpers({
106
106
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
107
107
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
108
108
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
109
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
110
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
111
- createPortalEl: (ctx) => {
112
- const existing = dom.getPortalEl(ctx);
113
- if (existing)
114
- return existing;
115
- const portal = dom.getDoc(ctx).createElement("toast-portal");
116
- portal.id = dom.getPortalId(ctx);
117
- return portal;
118
- }
109
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
119
110
  });
120
111
 
121
112
  // src/toast.utils.ts
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  groupMachine
3
- } from "./chunk-JPNOOB66.mjs";
4
- import "./chunk-OA575KTP.mjs";
3
+ } from "./chunk-GKMHTDAP.mjs";
4
+ import "./chunk-SSV22S55.mjs";
5
5
  import "./chunk-LHAZKBRJ.mjs";
6
6
  import "./chunk-XQSCE3HI.mjs";
7
- import "./chunk-BF5R6LHY.mjs";
7
+ import "./chunk-AZ32UDL3.mjs";
8
8
  export {
9
9
  groupMachine
10
10
  };
@@ -69,16 +69,7 @@ var dom = defineDomHelpers({
69
69
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
70
70
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
71
71
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
72
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
73
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
74
- createPortalEl: (ctx) => {
75
- const existing = dom.getPortalEl(ctx);
76
- if (existing)
77
- return existing;
78
- const portal = dom.getDoc(ctx).createElement("toast-portal");
79
- portal.id = dom.getPortalId(ctx);
80
- return portal;
81
- }
72
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
82
73
  });
83
74
 
84
75
  // src/toast.connect.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-7CNVO66P.mjs";
3
+ } from "./chunk-HDTOIF42.mjs";
4
4
  import "./chunk-GQHI2OMI.mjs";
5
- import "./chunk-BF5R6LHY.mjs";
5
+ import "./chunk-AZ32UDL3.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -25,8 +25,6 @@ declare const dom: {
25
25
  getDescriptionId: (ctx: MachineContext) => string;
26
26
  getCloseTriggerId: (ctx: MachineContext) => string;
27
27
  getPortalId: (ctx: GroupMachineContext) => string;
28
- getPortalEl: (ctx: GroupMachineContext) => HTMLElement | null;
29
- createPortalEl: (ctx: GroupMachineContext) => HTMLElement;
30
28
  };
31
29
 
32
30
  export { dom };
package/dist/toast.dom.js CHANGED
@@ -59,16 +59,7 @@ var dom = defineDomHelpers({
59
59
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
60
60
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
61
61
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
62
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
63
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
64
- createPortalEl: (ctx) => {
65
- const existing = dom.getPortalEl(ctx);
66
- if (existing)
67
- return existing;
68
- const portal = dom.getDoc(ctx).createElement("toast-portal");
69
- portal.id = dom.getPortalId(ctx);
70
- return portal;
71
- }
62
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
72
63
  });
73
64
  // Annotate the CommonJS export names for ESM import in node:
74
65
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-BF5R6LHY.mjs";
3
+ } from "./chunk-AZ32UDL3.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -100,16 +100,7 @@ var dom = defineDomHelpers({
100
100
  getTitleId: (ctx) => `toast:${ctx.id}:title`,
101
101
  getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
102
102
  getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
103
- getPortalId: (ctx) => `toast-portal:${ctx.id}`,
104
- getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
105
- createPortalEl: (ctx) => {
106
- const existing = dom.getPortalEl(ctx);
107
- if (existing)
108
- return existing;
109
- const portal = dom.getDoc(ctx).createElement("toast-portal");
110
- portal.id = dom.getPortalId(ctx);
111
- return portal;
112
- }
103
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`
113
104
  });
114
105
 
115
106
  // src/toast.utils.ts
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createToastMachine
3
- } from "./chunk-OA575KTP.mjs";
3
+ } from "./chunk-SSV22S55.mjs";
4
4
  import "./chunk-LHAZKBRJ.mjs";
5
5
  import "./chunk-XQSCE3HI.mjs";
6
- import "./chunk-BF5R6LHY.mjs";
6
+ import "./chunk-AZ32UDL3.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-20230202104422",
3
+ "version": "0.0.0-dev-20230202113057",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,14 +26,14 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "0.0.0-dev-20230202104422",
30
- "@zag-js/core": "0.0.0-dev-20230202104422",
31
- "@zag-js/types": "0.0.0-dev-20230202104422"
29
+ "@zag-js/anatomy": "0.0.0-dev-20230202113057",
30
+ "@zag-js/core": "0.0.0-dev-20230202113057",
31
+ "@zag-js/types": "0.0.0-dev-20230202113057"
32
32
  },
33
33
  "devDependencies": {
34
34
  "clean-package": "2.2.0",
35
- "@zag-js/dom-utils": "0.0.0-dev-20230202104422",
36
- "@zag-js/utils": "0.0.0-dev-20230202104422"
35
+ "@zag-js/dom-utils": "0.0.0-dev-20230202113057",
36
+ "@zag-js/utils": "0.0.0-dev-20230202113057"
37
37
  },
38
38
  "clean-package": "../../../clean-package.config.json",
39
39
  "main": "dist/index.js",