@zag-js/toast 0.2.7 → 0.2.9

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compact,
3
3
  createToastMachine
4
- } from "./chunk-YVNTR4MK.mjs";
4
+ } from "./chunk-5IFVCHQS.mjs";
5
5
 
6
6
  // src/toast-group.machine.ts
7
7
  import { createMachine } from "@zag-js/core";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  cast,
3
3
  runIfFn
4
- } from "./chunk-YVYADWQR.mjs";
4
+ } from "./chunk-6HWLSJDV.mjs";
5
5
  import {
6
6
  getToastDuration
7
- } from "./chunk-LOJTIJID.mjs";
7
+ } from "./chunk-FBM2PYRD.mjs";
8
8
  import {
9
9
  dom
10
- } from "./chunk-KHVXQ4ZE.mjs";
10
+ } from "./chunk-LN72PBJ5.mjs";
11
11
 
12
12
  // src/toast.machine.ts
13
13
  import { createMachine, guards } from "@zag-js/core";
File without changes
File without changes
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parts
3
- } from "./chunk-GQHI2OMI.mjs";
3
+ } from "./chunk-MD6LFB2J.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-KHVXQ4ZE.mjs";
6
+ } from "./chunk-LN72PBJ5.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -25,25 +25,7 @@ function defineDomHelpers(helpers) {
25
25
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
26
26
  },
27
27
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
28
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
29
- createEmitter: (ctx, target) => {
30
- const win = dom2.getWin(ctx);
31
- return function emit(evt, detail, options) {
32
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
33
- const eventName = `zag:${evt}`;
34
- const init = { bubbles, cancelable, composed, detail };
35
- const event = new win.CustomEvent(eventName, init);
36
- target.dispatchEvent(event);
37
- };
38
- },
39
- createListener: (target) => {
40
- return function listen(evt, handler) {
41
- const eventName = `zag:${evt}`;
42
- const listener = (e) => handler(e);
43
- target.addEventListener(eventName, listener);
44
- return () => target.removeEventListener(eventName, listener);
45
- };
46
- }
28
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
47
29
  };
48
30
  return {
49
31
  ...dom2,
File without changes
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  parts
3
- } from "./chunk-GQHI2OMI.mjs";
3
+ } from "./chunk-MD6LFB2J.mjs";
4
4
  import {
5
5
  runIfFn,
6
6
  uuid
7
- } from "./chunk-YVYADWQR.mjs";
7
+ } from "./chunk-6HWLSJDV.mjs";
8
8
  import {
9
9
  getGroupPlacementStyle,
10
10
  getToastsByPlacement
11
- } from "./chunk-LOJTIJID.mjs";
11
+ } from "./chunk-FBM2PYRD.mjs";
12
12
  import {
13
13
  dom
14
- } from "./chunk-KHVXQ4ZE.mjs";
14
+ } from "./chunk-LN72PBJ5.mjs";
15
15
 
16
16
  // src/toast-group.connect.ts
17
17
  import { subscribe } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ function compact(obj) {
68
68
  function warn(...a) {
69
69
  const m = a.length === 1 ? a[0] : a[1];
70
70
  const c = a.length === 2 ? a[0] : true;
71
- if (c && process.env.NODE_ENV !== "production") {
71
+ if (c && true) {
72
72
  console.warn(m);
73
73
  }
74
74
  }
@@ -103,25 +103,7 @@ function defineDomHelpers(helpers) {
103
103
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
104
104
  },
105
105
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
106
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
107
- createEmitter: (ctx, target) => {
108
- const win = dom2.getWin(ctx);
109
- return function emit(evt, detail, options) {
110
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
111
- const eventName = `zag:${evt}`;
112
- const init = { bubbles, cancelable, composed, detail };
113
- const event = new win.CustomEvent(eventName, init);
114
- target.dispatchEvent(event);
115
- };
116
- },
117
- createListener: (target) => {
118
- return function listen(evt, handler) {
119
- const eventName = `zag:${evt}`;
120
- const listener = (e) => handler(e);
121
- target.addEventListener(eventName, listener);
122
- return () => target.removeEventListener(eventName, listener);
123
- };
124
- }
106
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
125
107
  };
126
108
  return {
127
109
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,28 +1,28 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-6MVNQK7B.mjs";
4
+ } from "./chunk-PIVIE75R.mjs";
5
5
  import {
6
6
  groupMachine
7
- } from "./chunk-2E56V7D3.mjs";
7
+ } from "./chunk-2Q3XCA25.mjs";
8
8
  import {
9
9
  connect
10
- } from "./chunk-IEPKBUZZ.mjs";
10
+ } from "./chunk-FL23ZLLA.mjs";
11
11
  import {
12
12
  anatomy
13
- } from "./chunk-GQHI2OMI.mjs";
13
+ } from "./chunk-MD6LFB2J.mjs";
14
14
  import {
15
15
  createToastMachine
16
- } from "./chunk-YVNTR4MK.mjs";
17
- import "./chunk-YVYADWQR.mjs";
18
- import "./chunk-LOJTIJID.mjs";
19
- import "./chunk-KHVXQ4ZE.mjs";
16
+ } from "./chunk-5IFVCHQS.mjs";
17
+ import "./chunk-6HWLSJDV.mjs";
18
+ import "./chunk-FBM2PYRD.mjs";
19
+ import "./chunk-LN72PBJ5.mjs";
20
20
 
21
21
  // ../../utilities/core/src/warning.ts
22
22
  function warn(...a) {
23
23
  const m = a.length === 1 ? a[0] : a[1];
24
24
  const c = a.length === 2 ? a[0] : true;
25
- if (c && process.env.NODE_ENV !== "production") {
25
+ if (c && true) {
26
26
  console.warn(m);
27
27
  }
28
28
  }
@@ -71,25 +71,7 @@ function defineDomHelpers(helpers) {
71
71
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
72
72
  },
73
73
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
74
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
75
- createEmitter: (ctx, target) => {
76
- const win = dom2.getWin(ctx);
77
- return function emit(evt, detail, options) {
78
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
79
- const eventName = `zag:${evt}`;
80
- const init = { bubbles, cancelable, composed, detail };
81
- const event = new win.CustomEvent(eventName, init);
82
- target.dispatchEvent(event);
83
- };
84
- },
85
- createListener: (target) => {
86
- return function listen(evt, handler) {
87
- const eventName = `zag:${evt}`;
88
- const listener = (e) => handler(e);
89
- target.addEventListener(eventName, listener);
90
- return () => target.removeEventListener(eventName, listener);
91
- };
92
- }
74
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
93
75
  };
94
76
  return {
95
77
  ...dom2,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  groupConnect,
3
3
  toaster
4
- } from "./chunk-6MVNQK7B.mjs";
5
- import "./chunk-GQHI2OMI.mjs";
6
- import "./chunk-YVYADWQR.mjs";
7
- import "./chunk-LOJTIJID.mjs";
8
- import "./chunk-KHVXQ4ZE.mjs";
4
+ } from "./chunk-PIVIE75R.mjs";
5
+ import "./chunk-MD6LFB2J.mjs";
6
+ import "./chunk-6HWLSJDV.mjs";
7
+ import "./chunk-FBM2PYRD.mjs";
8
+ import "./chunk-LN72PBJ5.mjs";
9
9
  export {
10
10
  groupConnect,
11
11
  toaster
@@ -76,25 +76,7 @@ function defineDomHelpers(helpers) {
76
76
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
77
77
  },
78
78
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
79
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
80
- createEmitter: (ctx, target) => {
81
- const win = dom2.getWin(ctx);
82
- return function emit(evt, detail, options) {
83
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
84
- const eventName = `zag:${evt}`;
85
- const init = { bubbles, cancelable, composed, detail };
86
- const event = new win.CustomEvent(eventName, init);
87
- target.dispatchEvent(event);
88
- };
89
- },
90
- createListener: (target) => {
91
- return function listen(evt, handler) {
92
- const eventName = `zag:${evt}`;
93
- const listener = (e) => handler(e);
94
- target.addEventListener(eventName, listener);
95
- return () => target.removeEventListener(eventName, listener);
96
- };
97
- }
79
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
98
80
  };
99
81
  return {
100
82
  ...dom2,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  groupMachine
3
- } from "./chunk-2E56V7D3.mjs";
4
- import "./chunk-YVNTR4MK.mjs";
5
- import "./chunk-YVYADWQR.mjs";
6
- import "./chunk-LOJTIJID.mjs";
7
- import "./chunk-KHVXQ4ZE.mjs";
3
+ } from "./chunk-2Q3XCA25.mjs";
4
+ import "./chunk-5IFVCHQS.mjs";
5
+ import "./chunk-6HWLSJDV.mjs";
6
+ import "./chunk-FBM2PYRD.mjs";
7
+ import "./chunk-LN72PBJ5.mjs";
8
8
  export {
9
9
  groupMachine
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  anatomy,
3
3
  parts
4
- } from "./chunk-GQHI2OMI.mjs";
4
+ } from "./chunk-MD6LFB2J.mjs";
5
5
  export {
6
6
  anatomy,
7
7
  parts
@@ -56,25 +56,7 @@ function defineDomHelpers(helpers) {
56
56
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
57
57
  },
58
58
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
59
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
60
- createEmitter: (ctx, target) => {
61
- const win = dom2.getWin(ctx);
62
- return function emit(evt, detail, options) {
63
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
64
- const eventName = `zag:${evt}`;
65
- const init = { bubbles, cancelable, composed, detail };
66
- const event = new win.CustomEvent(eventName, init);
67
- target.dispatchEvent(event);
68
- };
69
- },
70
- createListener: (target) => {
71
- return function listen(evt, handler) {
72
- const eventName = `zag:${evt}`;
73
- const listener = (e) => handler(e);
74
- target.addEventListener(eventName, listener);
75
- return () => target.removeEventListener(eventName, listener);
76
- };
77
- }
59
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
78
60
  };
79
61
  return {
80
62
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-IEPKBUZZ.mjs";
4
- import "./chunk-GQHI2OMI.mjs";
5
- import "./chunk-KHVXQ4ZE.mjs";
3
+ } from "./chunk-FL23ZLLA.mjs";
4
+ import "./chunk-MD6LFB2J.mjs";
5
+ import "./chunk-LN72PBJ5.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -18,10 +18,6 @@ declare const dom: {
18
18
  getById: <T = HTMLElement>(ctx: {
19
19
  getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
20
20
  }, id: string) => T | null;
21
- createEmitter: (ctx: {
22
- getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
23
- }, target: HTMLElement) => (evt: string, detail: Record<string, any>, options?: EventInit | undefined) => void;
24
- createListener: (target: HTMLElement) => <T_1 = any>(evt: string, handler: (e: CustomEvent<T_1>) => void) => () => void;
25
21
  } & {
26
22
  getGroupId: (placement: Placement) => string;
27
23
  getRootId: (ctx: MachineContext) => string;
package/dist/toast.dom.js CHANGED
@@ -51,25 +51,7 @@ function defineDomHelpers(helpers) {
51
51
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
52
52
  },
53
53
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
54
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
55
- createEmitter: (ctx, target) => {
56
- const win = dom2.getWin(ctx);
57
- return function emit(evt, detail, options) {
58
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
59
- const eventName = `zag:${evt}`;
60
- const init = { bubbles, cancelable, composed, detail };
61
- const event = new win.CustomEvent(eventName, init);
62
- target.dispatchEvent(event);
63
- };
64
- },
65
- createListener: (target) => {
66
- return function listen(evt, handler) {
67
- const eventName = `zag:${evt}`;
68
- const listener = (e) => handler(e);
69
- target.addEventListener(eventName, listener);
70
- return () => target.removeEventListener(eventName, listener);
71
- };
72
- }
54
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
73
55
  };
74
56
  return {
75
57
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-KHVXQ4ZE.mjs";
3
+ } from "./chunk-LN72PBJ5.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -73,25 +73,7 @@ function defineDomHelpers(helpers) {
73
73
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
74
74
  },
75
75
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
76
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
77
- createEmitter: (ctx, target) => {
78
- const win = dom2.getWin(ctx);
79
- return function emit(evt, detail, options) {
80
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
81
- const eventName = `zag:${evt}`;
82
- const init = { bubbles, cancelable, composed, detail };
83
- const event = new win.CustomEvent(eventName, init);
84
- target.dispatchEvent(event);
85
- };
86
- },
87
- createListener: (target) => {
88
- return function listen(evt, handler) {
89
- const eventName = `zag:${evt}`;
90
- const listener = (e) => handler(e);
91
- target.addEventListener(eventName, listener);
92
- return () => target.removeEventListener(eventName, listener);
93
- };
94
- }
76
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
95
77
  };
96
78
  return {
97
79
  ...dom2,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createToastMachine
3
- } from "./chunk-YVNTR4MK.mjs";
4
- import "./chunk-YVYADWQR.mjs";
5
- import "./chunk-LOJTIJID.mjs";
6
- import "./chunk-KHVXQ4ZE.mjs";
3
+ } from "./chunk-5IFVCHQS.mjs";
4
+ import "./chunk-6HWLSJDV.mjs";
5
+ import "./chunk-FBM2PYRD.mjs";
6
+ import "./chunk-LN72PBJ5.mjs";
7
7
  export {
8
8
  createToastMachine
9
9
  };
@@ -3,7 +3,7 @@ import {
3
3
  getGroupPlacementStyle,
4
4
  getToastDuration,
5
5
  getToastsByPlacement
6
- } from "./chunk-LOJTIJID.mjs";
6
+ } from "./chunk-FBM2PYRD.mjs";
7
7
  export {
8
8
  defaultTimeouts,
9
9
  getGroupPlacementStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@zag-js/anatomy": "0.1.3",
30
- "@zag-js/core": "0.2.4",
31
- "@zag-js/types": "0.3.2"
30
+ "@zag-js/core": "0.2.6",
31
+ "@zag-js/types": "0.3.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "clean-package": "2.2.0",
35
- "@zag-js/dom-utils": "0.2.2",
35
+ "@zag-js/dom-utils": "0.2.3",
36
36
  "@zag-js/utils": "0.3.2"
37
37
  },
38
38
  "clean-package": "../../../clean-package.config.json",