@zag-js/toast 1.46.0 → 1.48.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.
Files changed (41) hide show
  1. package/dist/index.d.mts +10 -17
  2. package/dist/index.d.ts +10 -17
  3. package/dist/index.js +18 -45
  4. package/dist/index.mjs +5 -11
  5. package/dist/toast-group.connect.d.mts +4 -8
  6. package/dist/toast-group.connect.d.ts +4 -8
  7. package/dist/toast-group.connect.js +73 -97
  8. package/dist/toast-group.connect.mjs +68 -61
  9. package/dist/toast-group.machine.d.mts +2 -8
  10. package/dist/toast-group.machine.d.ts +2 -8
  11. package/dist/toast-group.machine.js +294 -302
  12. package/dist/toast-group.machine.mjs +289 -266
  13. package/dist/toast.anatomy.d.mts +2 -6
  14. package/dist/toast.anatomy.d.ts +2 -6
  15. package/dist/toast.anatomy.js +8 -40
  16. package/dist/toast.anatomy.mjs +4 -14
  17. package/dist/toast.connect.d.mts +4 -8
  18. package/dist/toast.connect.d.ts +4 -8
  19. package/dist/toast.connect.js +133 -158
  20. package/dist/toast.connect.mjs +128 -122
  21. package/dist/toast.dom.d.mts +21 -16
  22. package/dist/toast.dom.d.ts +21 -16
  23. package/dist/toast.dom.js +56 -53
  24. package/dist/toast.dom.mjs +42 -20
  25. package/dist/toast.machine.d.mts +2 -8
  26. package/dist/toast.machine.d.ts +2 -8
  27. package/dist/toast.machine.js +272 -311
  28. package/dist/toast.machine.mjs +268 -276
  29. package/dist/toast.store.d.mts +2 -8
  30. package/dist/toast.store.d.ts +2 -8
  31. package/dist/toast.store.js +344 -299
  32. package/dist/toast.store.mjs +340 -274
  33. package/dist/toast.types.d.mts +372 -374
  34. package/dist/toast.types.d.ts +372 -374
  35. package/dist/toast.types.js +4 -18
  36. package/dist/toast.types.mjs +1 -0
  37. package/dist/toast.utils.d.mts +10 -13
  38. package/dist/toast.utils.d.ts +10 -13
  39. package/dist/toast.utils.js +169 -198
  40. package/dist/toast.utils.mjs +159 -168
  41. package/package.json +9 -9
@@ -1,282 +1,348 @@
1
- // src/toast.store.ts
2
1
  import { compact, hasProp, runIfFn, uuid, warn } from "@zag-js/utils";
3
- var withDefaults = (options, defaults) => {
4
- return { ...defaults, ...compact(options) };
2
+ // src/toast.store.ts
3
+ const withDefaults = (options, defaults) => {
4
+ return {
5
+ ...defaults,
6
+ ...compact(options)
7
+ };
5
8
  };
6
- var priorities = {
7
- error: [1, 2],
8
- warning: [3, 6],
9
- loading: [4, 5],
10
- success: [5, 7],
11
- info: [6, 8]
9
+ const priorities = {
10
+ error: [1, 2],
11
+ warning: [3, 6],
12
+ loading: [4, 5],
13
+ success: [5, 7],
14
+ info: [6, 8]
12
15
  };
13
- var DEFAULT_TYPE = "info";
14
- var getPriorityForType = (type, hasAction) => {
15
- const key = type ?? DEFAULT_TYPE;
16
- const [actionable, nonActionable] = hasProp(priorities, key) ? priorities[key] : priorities[DEFAULT_TYPE];
17
- return hasAction ? actionable : nonActionable;
16
+ const DEFAULT_TYPE = "info";
17
+ const getPriorityForType = (type, hasAction) => {
18
+ const key = type ?? DEFAULT_TYPE;
19
+ const [actionable, nonActionable] = hasProp(priorities, key) ? priorities[key] : priorities[DEFAULT_TYPE];
20
+ return hasAction ? actionable : nonActionable;
18
21
  };
19
- var sortToastsByPriority = (toastArray) => {
20
- return toastArray.sort((a, b) => {
21
- const priorityA = a.priority ?? getPriorityForType(a.type, !!a.action);
22
- const priorityB = b.priority ?? getPriorityForType(b.type, !!b.action);
23
- return priorityA - priorityB;
24
- });
22
+ const sortToastsByPriority = (toastArray) => {
23
+ return toastArray.sort((a, b) => {
24
+ return (a.priority ?? getPriorityForType(a.type, !!a.action)) - (b.priority ?? getPriorityForType(b.type, !!b.action));
25
+ });
25
26
  };
26
27
  function createToastStore(props = {}) {
27
- const attrs = withDefaults(props, {
28
- placement: "bottom",
29
- overlap: false,
30
- max: 24,
31
- gap: 16,
32
- offsets: "1rem",
33
- hotkey: ["altKey", "KeyT"],
34
- removeDelay: 200,
35
- pauseOnPageIdle: true
36
- });
37
- let subscribers = [];
38
- let toasts = [];
39
- let dismissedToasts = /* @__PURE__ */ new Set();
40
- let toastQueue = [];
41
- const closingToasts = /* @__PURE__ */ new Set();
42
- const promiseTokens = /* @__PURE__ */ new Map();
43
- let paused = false;
44
- const subscribe = (subscriber) => {
45
- subscribers.push(subscriber);
46
- let active = true;
47
- return () => {
48
- if (!active) return;
49
- active = false;
50
- const index = subscribers.indexOf(subscriber);
51
- if (index !== -1) subscribers.splice(index, 1);
52
- };
53
- };
54
- const notifications = [];
55
- let publishing = false;
56
- const publish = (...data) => {
57
- notifications.push(...data);
58
- if (publishing) return data;
59
- publishing = true;
60
- try {
61
- while (notifications.length) {
62
- const next = notifications.shift();
63
- subscribers.slice().forEach((subscriber) => subscriber(next));
64
- }
65
- } finally {
66
- publishing = false;
67
- notifications.length = 0;
68
- }
69
- return data;
70
- };
71
- const addToast = (data) => {
72
- if (toasts.length >= attrs.max) {
73
- toastQueue.push(data);
74
- return;
75
- }
76
- toasts.unshift(data);
77
- publish(data);
78
- };
79
- const processQueue = () => {
80
- toastQueue = sortToastsByPriority(toastQueue);
81
- while (toastQueue.length > 0 && toasts.length < attrs.max) {
82
- const nextToast = toastQueue.shift();
83
- if (nextToast) {
84
- const toast = { ...nextToast, paused: paused || nextToast.paused };
85
- toasts.unshift(toast);
86
- publish(toast);
87
- }
88
- }
89
- };
90
- const create = (data) => {
91
- const id = data.id ?? `toast:${uuid()}`;
92
- const exists = toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id);
93
- if (closingToasts.has(id)) return id;
94
- if (hasProp(data, "promise") && data.promise !== exists?.promise) promiseTokens.delete(id);
95
- dismissedToasts.delete(id);
96
- if (exists) {
97
- const next = { ...exists, ...data, id };
98
- if (toasts.some((toast) => toast.id === id)) {
99
- toasts = toasts.map((toast) => toast.id === id ? next : toast);
100
- publish(next);
101
- } else {
102
- toastQueue = toastQueue.map((toast) => toast.id === id ? next : toast);
103
- }
104
- } else {
105
- const newToast = {
106
- id,
107
- duration: attrs.duration,
108
- removeDelay: attrs.removeDelay,
109
- type: DEFAULT_TYPE,
110
- ...data,
111
- stacked: !attrs.overlap,
112
- gap: attrs.gap,
113
- paused
114
- };
115
- const priority = newToast.priority ?? getPriorityForType(newToast.type, !!newToast.action);
116
- addToast({ ...newToast, priority });
117
- }
118
- return id;
119
- };
120
- const remove = (id) => {
121
- const removed = id == null ? [...toasts, ...toastQueue] : [...toasts, ...toastQueue].filter((toast) => toast.id === id);
122
- const visible = id == null ? toasts : toasts.filter((toast) => toast.id === id);
123
- removed.forEach((toast) => {
124
- dismissedToasts.add(toast.id);
125
- closingToasts.delete(toast.id);
126
- promiseTokens.delete(toast.id);
127
- });
128
- if (id != null) dismissedToasts.add(id);
129
- toasts = id == null ? [] : toasts.filter((toast) => toast.id !== id);
130
- toastQueue = id == null ? [] : toastQueue.filter((toast) => toast.id !== id);
131
- if (id != null && !visible.length) publish({ id, dismiss: true });
132
- publish(...visible.map((toast) => ({ id: toast.id, dismiss: true })));
133
- processQueue();
134
- return id;
135
- };
136
- const error = (data) => {
137
- return create({ ...data, type: "error" });
138
- };
139
- const success = (data) => {
140
- return create({ ...data, type: "success" });
141
- };
142
- const info = (data) => {
143
- return create({ ...data, type: "info" });
144
- };
145
- const warning = (data) => {
146
- return create({ ...data, type: "warning" });
147
- };
148
- const loading = (data) => {
149
- return create({ ...data, type: "loading" });
150
- };
151
- const getVisibleToasts = () => {
152
- return toasts.filter((toast) => !dismissedToasts.has(toast.id));
153
- };
154
- const getCount = () => {
155
- return toasts.length;
156
- };
157
- const promise = (promise2, options, shared = {}) => {
158
- if (!options || !options.loading) {
159
- warn("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");
160
- return;
161
- }
162
- const id = create({
163
- ...shared,
164
- ...options.loading,
165
- promise: promise2,
166
- type: "loading"
167
- });
168
- const token = /* @__PURE__ */ Symbol();
169
- const current = toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id);
170
- if (current?.promise === promise2 && !closingToasts.has(id)) promiseTokens.set(id, token);
171
- const isCurrent = () => promiseTokens.get(id) === token && !closingToasts.has(id);
172
- let removable = true;
173
- let result;
174
- const prom = runIfFn(promise2).then(async (response) => {
175
- result = ["resolve", response];
176
- if (isHttpResponse(response) && !response.ok) {
177
- removable = false;
178
- const errorOptions = runIfFn(options.error, `HTTP Error! status: ${response.status}`);
179
- if (isCurrent()) create({ ...shared, ...errorOptions, id, type: "error" });
180
- } else if (options.success !== void 0) {
181
- removable = false;
182
- const successOptions = runIfFn(options.success, response);
183
- if (isCurrent()) create({ ...shared, ...successOptions, id, type: successOptions.type ?? "success" });
184
- }
185
- }).catch(async (error2) => {
186
- result = ["reject", error2];
187
- if (options.error !== void 0) {
188
- removable = false;
189
- const errorOptions = runIfFn(options.error, error2);
190
- if (isCurrent()) create({ ...shared, ...errorOptions, id, type: "error" });
191
- }
192
- }).finally(() => {
193
- if (removable && isCurrent()) {
194
- remove(id);
195
- }
196
- if (promiseTokens.get(id) === token) promiseTokens.delete(id);
197
- options.finally?.();
198
- });
199
- const unwrap = () => new Promise(
200
- (resolve, reject) => prom.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)
201
- );
202
- return { id, unwrap };
203
- };
204
- const update = (id, data) => {
205
- if (closingToasts.has(id)) return id;
206
- if (typeof data !== "function") return create({ ...data, id });
207
- const current = toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id);
208
- if (!current) return id;
209
- const next = { ...data({ ...current }), id };
210
- if (closingToasts.has(id)) return id;
211
- if (toasts.some((toast) => toast.id === id)) return create(next);
212
- if (!toastQueue.some((toast) => toast.id === id)) return id;
213
- return create(next);
214
- };
215
- const changeToasts = (data, id) => {
216
- const changed = [];
217
- toasts = toasts.map((toast) => {
218
- if (id != null && toast.id !== id || closingToasts.has(toast.id)) return toast;
219
- const next = { ...toast, ...data };
220
- changed.push(next);
221
- return next;
222
- });
223
- toastQueue = toastQueue.map((toast) => id == null || toast.id === id ? { ...toast, ...data } : toast);
224
- publish(...changed);
225
- };
226
- const pause = (id) => {
227
- if (id == null) paused = true;
228
- changeToasts({ paused: true }, id);
229
- };
230
- const resume = (id) => {
231
- if (id == null) paused = false;
232
- changeToasts({ paused: false }, id);
233
- };
234
- const dismiss = (id) => {
235
- const queued = toastQueue.filter((toast) => id == null || toast.id === id);
236
- toastQueue = toastQueue.filter((toast) => id != null && toast.id !== id);
237
- queued.forEach((toast) => {
238
- dismissedToasts.add(toast.id);
239
- promiseTokens.delete(toast.id);
240
- });
241
- const changed = toasts.filter((toast) => (id == null || toast.id === id) && !closingToasts.has(toast.id));
242
- changed.forEach((toast) => closingToasts.add(toast.id));
243
- toasts = toasts.map((toast) => closingToasts.has(toast.id) ? { ...toast, message: "DISMISS" } : toast);
244
- publish(...changed.map((toast) => ({ ...toast, message: "DISMISS" })));
245
- };
246
- const isVisible = (id) => {
247
- return !dismissedToasts.has(id) && !!toasts.find((toast) => toast.id === id);
248
- };
249
- const isDismissed = (id) => {
250
- return dismissedToasts.has(id);
251
- };
252
- const expand = () => changeToasts({ stacked: true });
253
- const collapse = () => changeToasts({ stacked: false });
254
- return {
255
- attrs,
256
- subscribe,
257
- create,
258
- update,
259
- remove,
260
- dismiss,
261
- error,
262
- success,
263
- info,
264
- warning,
265
- loading,
266
- getVisibleToasts,
267
- getCount,
268
- promise,
269
- pause,
270
- resume,
271
- isVisible,
272
- isDismissed,
273
- expand,
274
- collapse
275
- };
28
+ const attrs = withDefaults(props, {
29
+ placement: "bottom",
30
+ overlap: false,
31
+ max: 24,
32
+ gap: 16,
33
+ offsets: "1rem",
34
+ hotkey: ["altKey", "KeyT"],
35
+ removeDelay: 200,
36
+ pauseOnPageIdle: true
37
+ });
38
+ let subscribers = [];
39
+ let toasts = [];
40
+ let dismissedToasts = /* @__PURE__ */ new Set();
41
+ let toastQueue = [];
42
+ const closingToasts = /* @__PURE__ */ new Set();
43
+ const promiseTokens = /* @__PURE__ */ new Map();
44
+ let paused = false;
45
+ const layoutSubscribers = /* @__PURE__ */ new Set();
46
+ const subscribe = (subscriber) => {
47
+ subscribers.push(subscriber);
48
+ let active = true;
49
+ return () => {
50
+ if (!active) return;
51
+ active = false;
52
+ const index = subscribers.indexOf(subscriber);
53
+ if (index !== -1) subscribers.splice(index, 1);
54
+ };
55
+ };
56
+ const notifications = [];
57
+ let publishing = false;
58
+ const publish = (...data) => {
59
+ notifications.push(...data);
60
+ if (publishing) return data;
61
+ publishing = true;
62
+ try {
63
+ while (notifications.length) {
64
+ const next = notifications.shift();
65
+ subscribers.slice().forEach((subscriber) => subscriber(next));
66
+ }
67
+ } finally {
68
+ publishing = false;
69
+ notifications.length = 0;
70
+ }
71
+ return data;
72
+ };
73
+ const addToast = (data) => {
74
+ if (toasts.length >= attrs.max) {
75
+ toastQueue.push(data);
76
+ return;
77
+ }
78
+ toasts.unshift(data);
79
+ publish(data);
80
+ };
81
+ const processQueue = () => {
82
+ toastQueue = sortToastsByPriority(toastQueue);
83
+ while (toastQueue.length > 0 && toasts.length < attrs.max) {
84
+ const nextToast = toastQueue.shift();
85
+ if (nextToast) {
86
+ const toast = {
87
+ ...nextToast,
88
+ paused: paused || nextToast.paused
89
+ };
90
+ toasts.unshift(toast);
91
+ publish(toast);
92
+ }
93
+ }
94
+ };
95
+ const create = (data) => {
96
+ const id = data.id ?? `toast:${uuid()}`;
97
+ const exists = toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id);
98
+ if (closingToasts.has(id)) return id;
99
+ if (hasProp(data, "promise") && data.promise !== exists?.promise) promiseTokens.delete(id);
100
+ dismissedToasts.delete(id);
101
+ if (exists) {
102
+ const next = {
103
+ ...exists,
104
+ ...data,
105
+ id
106
+ };
107
+ if (toasts.some((toast) => toast.id === id)) {
108
+ toasts = toasts.map((toast) => toast.id === id ? next : toast);
109
+ publish(next);
110
+ } else toastQueue = toastQueue.map((toast) => toast.id === id ? next : toast);
111
+ } else {
112
+ const newToast = {
113
+ id,
114
+ duration: attrs.duration,
115
+ removeDelay: attrs.removeDelay,
116
+ type: DEFAULT_TYPE,
117
+ ...data,
118
+ gap: attrs.gap,
119
+ paused
120
+ };
121
+ const priority = newToast.priority ?? getPriorityForType(newToast.type, !!newToast.action);
122
+ addToast({
123
+ ...newToast,
124
+ priority
125
+ });
126
+ }
127
+ return id;
128
+ };
129
+ const remove = (id) => {
130
+ const removed = id == null ? [...toasts, ...toastQueue] : [...toasts, ...toastQueue].filter((toast) => toast.id === id);
131
+ const visible = id == null ? toasts : toasts.filter((toast) => toast.id === id);
132
+ removed.forEach((toast) => {
133
+ dismissedToasts.add(toast.id);
134
+ closingToasts.delete(toast.id);
135
+ promiseTokens.delete(toast.id);
136
+ });
137
+ if (id != null) dismissedToasts.add(id);
138
+ toasts = id == null ? [] : toasts.filter((toast) => toast.id !== id);
139
+ toastQueue = id == null ? [] : toastQueue.filter((toast) => toast.id !== id);
140
+ if (id != null && !visible.length) publish({
141
+ id,
142
+ dismiss: true
143
+ });
144
+ publish(...visible.map((toast) => ({
145
+ id: toast.id,
146
+ dismiss: true
147
+ })));
148
+ processQueue();
149
+ return id;
150
+ };
151
+ const error = (data) => {
152
+ return create({
153
+ ...data,
154
+ type: "error"
155
+ });
156
+ };
157
+ const success = (data) => {
158
+ return create({
159
+ ...data,
160
+ type: "success"
161
+ });
162
+ };
163
+ const info = (data) => {
164
+ return create({
165
+ ...data,
166
+ type: "info"
167
+ });
168
+ };
169
+ const warning = (data) => {
170
+ return create({
171
+ ...data,
172
+ type: "warning"
173
+ });
174
+ };
175
+ const loading = (data) => {
176
+ return create({
177
+ ...data,
178
+ type: "loading"
179
+ });
180
+ };
181
+ const getVisibleToasts = () => {
182
+ return toasts.filter((toast) => !dismissedToasts.has(toast.id));
183
+ };
184
+ const getCount = () => {
185
+ return toasts.length;
186
+ };
187
+ const promise = (promise, options, shared = {}) => {
188
+ if (!options || !options.loading) {
189
+ warn("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");
190
+ return;
191
+ }
192
+ const id = create({
193
+ ...shared,
194
+ ...options.loading,
195
+ promise,
196
+ type: "loading"
197
+ });
198
+ const token = Symbol();
199
+ if ((toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id))?.promise === promise && !closingToasts.has(id)) promiseTokens.set(id, token);
200
+ const isCurrent = () => promiseTokens.get(id) === token && !closingToasts.has(id);
201
+ let removable = true;
202
+ let result;
203
+ const prom = runIfFn(promise).then(async (response) => {
204
+ result = ["resolve", response];
205
+ if (isHttpResponse(response) && !response.ok) {
206
+ removable = false;
207
+ const errorOptions = runIfFn(options.error, `HTTP Error! status: ${response.status}`);
208
+ if (isCurrent()) create({
209
+ ...shared,
210
+ ...errorOptions,
211
+ id,
212
+ type: "error"
213
+ });
214
+ } else if (options.success !== void 0) {
215
+ removable = false;
216
+ const successOptions = runIfFn(options.success, response);
217
+ if (isCurrent()) create({
218
+ ...shared,
219
+ ...successOptions,
220
+ id,
221
+ type: successOptions.type ?? "success"
222
+ });
223
+ }
224
+ }).catch(async (error) => {
225
+ result = ["reject", error];
226
+ if (options.error !== void 0) {
227
+ removable = false;
228
+ const errorOptions = runIfFn(options.error, error);
229
+ if (isCurrent()) create({
230
+ ...shared,
231
+ ...errorOptions,
232
+ id,
233
+ type: "error"
234
+ });
235
+ }
236
+ }).finally(() => {
237
+ if (removable && isCurrent()) remove(id);
238
+ if (promiseTokens.get(id) === token) promiseTokens.delete(id);
239
+ options.finally?.();
240
+ });
241
+ const unwrap = () => new Promise((resolve, reject) => prom.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
242
+ return {
243
+ id,
244
+ unwrap
245
+ };
246
+ };
247
+ const update = (id, data) => {
248
+ if (closingToasts.has(id)) return id;
249
+ if (typeof data !== "function") return create({
250
+ ...data,
251
+ id
252
+ });
253
+ const current = toasts.find((toast) => toast.id === id) ?? toastQueue.find((toast) => toast.id === id);
254
+ if (!current) return id;
255
+ const next = {
256
+ ...data({ ...current }),
257
+ id
258
+ };
259
+ if (closingToasts.has(id)) return id;
260
+ if (toasts.some((toast) => toast.id === id)) return create(next);
261
+ if (!toastQueue.some((toast) => toast.id === id)) return id;
262
+ return create(next);
263
+ };
264
+ const changeToasts = (data, id) => {
265
+ const changed = [];
266
+ toasts = toasts.map((toast) => {
267
+ if (id != null && toast.id !== id || closingToasts.has(toast.id)) return toast;
268
+ const next = {
269
+ ...toast,
270
+ ...data
271
+ };
272
+ changed.push(next);
273
+ return next;
274
+ });
275
+ toastQueue = toastQueue.map((toast) => id == null || toast.id === id ? {
276
+ ...toast,
277
+ ...data
278
+ } : toast);
279
+ publish(...changed);
280
+ };
281
+ const pause = (id) => {
282
+ if (id == null) paused = true;
283
+ changeToasts({ paused: true }, id);
284
+ };
285
+ const resume = (id) => {
286
+ if (id == null) paused = false;
287
+ changeToasts({ paused: false }, id);
288
+ };
289
+ const dismiss = (id) => {
290
+ const queued = toastQueue.filter((toast) => id == null || toast.id === id);
291
+ toastQueue = toastQueue.filter((toast) => id != null && toast.id !== id);
292
+ queued.forEach((toast) => {
293
+ dismissedToasts.add(toast.id);
294
+ promiseTokens.delete(toast.id);
295
+ });
296
+ const changed = toasts.filter((toast) => (id == null || toast.id === id) && !closingToasts.has(toast.id));
297
+ changed.forEach((toast) => closingToasts.add(toast.id));
298
+ toasts = toasts.map((toast) => closingToasts.has(toast.id) ? {
299
+ ...toast,
300
+ message: "DISMISS"
301
+ } : toast);
302
+ publish(...changed.map((toast) => ({
303
+ ...toast,
304
+ message: "DISMISS"
305
+ })));
306
+ };
307
+ const isVisible = (id) => {
308
+ return !dismissedToasts.has(id) && !!toasts.find((toast) => toast.id === id);
309
+ };
310
+ const isDismissed = (id) => {
311
+ return dismissedToasts.has(id);
312
+ };
313
+ const subscribeLayout = (subscriber) => {
314
+ layoutSubscribers.add(subscriber);
315
+ return () => {
316
+ layoutSubscribers.delete(subscriber);
317
+ };
318
+ };
319
+ const expand = () => layoutSubscribers.forEach((subscriber) => subscriber(true));
320
+ const collapse = () => layoutSubscribers.forEach((subscriber) => subscriber(false));
321
+ return {
322
+ attrs,
323
+ subscribe,
324
+ create,
325
+ update,
326
+ remove,
327
+ dismiss,
328
+ error,
329
+ success,
330
+ info,
331
+ warning,
332
+ loading,
333
+ getVisibleToasts,
334
+ getCount,
335
+ promise,
336
+ pause,
337
+ resume,
338
+ isVisible,
339
+ isDismissed,
340
+ expand,
341
+ collapse,
342
+ subscribeLayout
343
+ };
276
344
  }
277
- var isHttpResponse = (data) => {
278
- return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
279
- };
280
- export {
281
- createToastStore
345
+ const isHttpResponse = (data) => {
346
+ return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
282
347
  };
348
+ export { createToastStore };