vue-toastflow 0.0.1
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/toastflow.es.js +636 -0
- package/dist/toastflow.umd.js +1 -0
- package/dist/vue-toastflow.css +1 -0
- package/package.json +24 -0
- package/src/components/Toast.vue +660 -0
- package/src/components/ToastContainer.vue +350 -0
- package/src/components/ToastProgress.vue +62 -0
- package/src/components/icons/ArrowPath.vue +13 -0
- package/src/components/icons/Bell.vue +13 -0
- package/src/components/icons/CheckCircle.vue +13 -0
- package/src/components/icons/InfoCircle.vue +13 -0
- package/src/components/icons/QuestionMarkCircle.vue +13 -0
- package/src/components/icons/XCircle.vue +13 -0
- package/src/components/icons/XMark.vue +13 -0
- package/src/index.ts +17 -0
- package/src/plugin.ts +16 -0
- package/src/styles.css +180 -0
- package/src/symbols.ts +4 -0
- package/src/toast.ts +80 -0
- package/tsconfig.json +15 -0
- package/vite.config.ts +22 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import { createToastStore as at } from "toastflow-core";
|
|
2
|
+
export * from "toastflow-core";
|
|
3
|
+
import { defineComponent as G, createElementBlock as l, openBlock as r, createElementVNode as u, normalizeClass as k, inject as st, ref as y, computed as d, watch as E, createCommentVNode as Z, renderSlot as K, createBlock as X, resolveDynamicComponent as it, toDisplayString as U, normalizeStyle as W, withModifiers as rt, createVNode as Y, onMounted as lt, onUnmounted as ct, Fragment as Q, renderList as J, TransitionGroup as ut, withCtx as dt } from "vue";
|
|
4
|
+
const _ = Symbol("toast-store");
|
|
5
|
+
let q = null;
|
|
6
|
+
function ft(t) {
|
|
7
|
+
q = t;
|
|
8
|
+
}
|
|
9
|
+
function c() {
|
|
10
|
+
if (!q)
|
|
11
|
+
throw new Error(
|
|
12
|
+
"[vue-toastflow] Toast store not initialized. Did you install the plugin?"
|
|
13
|
+
);
|
|
14
|
+
return q;
|
|
15
|
+
}
|
|
16
|
+
const le = {
|
|
17
|
+
getState() {
|
|
18
|
+
return c().getState();
|
|
19
|
+
},
|
|
20
|
+
subscribeEvents(t) {
|
|
21
|
+
return c().subscribeEvents(t);
|
|
22
|
+
},
|
|
23
|
+
show(t) {
|
|
24
|
+
return c().show(t);
|
|
25
|
+
},
|
|
26
|
+
loading(t, o) {
|
|
27
|
+
return c().loading(t, o);
|
|
28
|
+
},
|
|
29
|
+
update(t, o) {
|
|
30
|
+
return c().update(t, o);
|
|
31
|
+
},
|
|
32
|
+
dismiss(t) {
|
|
33
|
+
return c().dismiss(t);
|
|
34
|
+
},
|
|
35
|
+
dismissAll() {
|
|
36
|
+
return c().dismissAll();
|
|
37
|
+
},
|
|
38
|
+
pause(t) {
|
|
39
|
+
return c().pause(t);
|
|
40
|
+
},
|
|
41
|
+
resume(t) {
|
|
42
|
+
return c().resume(t);
|
|
43
|
+
},
|
|
44
|
+
getConfig() {
|
|
45
|
+
return c().getConfig();
|
|
46
|
+
},
|
|
47
|
+
toast(t) {
|
|
48
|
+
return c().show({ ...t, type: "default" });
|
|
49
|
+
},
|
|
50
|
+
success(t) {
|
|
51
|
+
return c().show({ ...t, type: "success" });
|
|
52
|
+
},
|
|
53
|
+
error(t) {
|
|
54
|
+
return c().show({ ...t, type: "error" });
|
|
55
|
+
},
|
|
56
|
+
info(t) {
|
|
57
|
+
return c().show({ ...t, type: "info" });
|
|
58
|
+
},
|
|
59
|
+
warning(t) {
|
|
60
|
+
return c().show({ ...t, type: "warning" });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
function ce(t = {}) {
|
|
64
|
+
const o = at(t);
|
|
65
|
+
return ft(o), {
|
|
66
|
+
install(f) {
|
|
67
|
+
f.provide(_, o);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const mt = { class: "tf-toast-progress" }, vt = /* @__PURE__ */ G({
|
|
72
|
+
__name: "ToastProgress",
|
|
73
|
+
props: {
|
|
74
|
+
type: {}
|
|
75
|
+
},
|
|
76
|
+
setup(t) {
|
|
77
|
+
return (o, f) => (r(), l("div", mt, [
|
|
78
|
+
u("div", {
|
|
79
|
+
class: k(["tf-toast-progress-bar", `tf-toast-progress-bar--${t.type}`])
|
|
80
|
+
}, null, 2)
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
}), h = (t, o) => {
|
|
84
|
+
const f = t.__vccOpts || t;
|
|
85
|
+
for (const [v, g] of o)
|
|
86
|
+
f[v] = g;
|
|
87
|
+
return f;
|
|
88
|
+
}, ht = /* @__PURE__ */ h(vt, [["__scopeId", "data-v-ca0da064"]]), gt = {}, yt = {
|
|
89
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
90
|
+
viewBox: "0 0 24 24",
|
|
91
|
+
fill: "currentColor"
|
|
92
|
+
};
|
|
93
|
+
function pt(t, o) {
|
|
94
|
+
return r(), l("svg", yt, [...o[0] || (o[0] = [
|
|
95
|
+
u("path", {
|
|
96
|
+
"fill-rule": "evenodd",
|
|
97
|
+
d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
|
|
98
|
+
"clip-rule": "evenodd"
|
|
99
|
+
}, null, -1)
|
|
100
|
+
])]);
|
|
101
|
+
}
|
|
102
|
+
const wt = /* @__PURE__ */ h(gt, [["render", pt]]), bt = {}, Ct = {
|
|
103
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
104
|
+
viewBox: "0 0 24 24",
|
|
105
|
+
fill: "currentColor"
|
|
106
|
+
};
|
|
107
|
+
function At(t, o) {
|
|
108
|
+
return r(), l("svg", Ct, [...o[0] || (o[0] = [
|
|
109
|
+
u("path", {
|
|
110
|
+
"fill-rule": "evenodd",
|
|
111
|
+
d: "M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z",
|
|
112
|
+
"clip-rule": "evenodd"
|
|
113
|
+
}, null, -1)
|
|
114
|
+
])]);
|
|
115
|
+
}
|
|
116
|
+
const kt = /* @__PURE__ */ h(bt, [["render", At]]), xt = {}, $t = {
|
|
117
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
118
|
+
viewBox: "0 0 24 24",
|
|
119
|
+
fill: "currentColor"
|
|
120
|
+
};
|
|
121
|
+
function Mt(t, o) {
|
|
122
|
+
return r(), l("svg", $t, [...o[0] || (o[0] = [
|
|
123
|
+
u("path", {
|
|
124
|
+
"fill-rule": "evenodd",
|
|
125
|
+
d: "M5.25 9a6.75 6.75 0 0 1 13.5 0v.75c0 2.123.8 4.057 2.118 5.52a.75.75 0 0 1-.297 1.206c-1.544.57-3.16.99-4.831 1.243a3.75 3.75 0 1 1-7.48 0 24.585 24.585 0 0 1-4.831-1.244.75.75 0 0 1-.298-1.205A8.217 8.217 0 0 0 5.25 9.75V9Zm4.502 8.9a2.25 2.25 0 1 0 4.496 0 25.057 25.057 0 0 1-4.496 0Z",
|
|
126
|
+
"clip-rule": "evenodd"
|
|
127
|
+
}, null, -1)
|
|
128
|
+
])]);
|
|
129
|
+
}
|
|
130
|
+
const Lt = /* @__PURE__ */ h(xt, [["render", Mt]]), Tt = {}, Kt = {
|
|
131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
132
|
+
viewBox: "0 0 24 24",
|
|
133
|
+
fill: "currentColor"
|
|
134
|
+
};
|
|
135
|
+
function St(t, o) {
|
|
136
|
+
return r(), l("svg", Kt, [...o[0] || (o[0] = [
|
|
137
|
+
u("path", {
|
|
138
|
+
"fill-rule": "evenodd",
|
|
139
|
+
d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",
|
|
140
|
+
"clip-rule": "evenodd"
|
|
141
|
+
}, null, -1)
|
|
142
|
+
])]);
|
|
143
|
+
}
|
|
144
|
+
const Ht = /* @__PURE__ */ h(Tt, [["render", St]]), Bt = {}, Zt = {
|
|
145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
+
viewBox: "0 0 24 24",
|
|
147
|
+
fill: "currentColor"
|
|
148
|
+
};
|
|
149
|
+
function Wt(t, o) {
|
|
150
|
+
return r(), l("svg", Zt, [...o[0] || (o[0] = [
|
|
151
|
+
u("path", {
|
|
152
|
+
"fill-rule": "evenodd",
|
|
153
|
+
d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm11.378-3.917c-.89-.777-2.366-.777-3.255 0a.75.75 0 0 1-.988-1.129c1.454-1.272 3.776-1.272 5.23 0 1.513 1.324 1.513 3.518 0 4.842a3.75 3.75 0 0 1-.837.552c-.676.328-1.028.774-1.028 1.152v.75a.75.75 0 0 1-1.5 0v-.75c0-1.279 1.06-2.107 1.875-2.502.182-.088.351-.199.503-.331.83-.727.83-1.857 0-2.584ZM12 18a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",
|
|
154
|
+
"clip-rule": "evenodd"
|
|
155
|
+
}, null, -1)
|
|
156
|
+
])]);
|
|
157
|
+
}
|
|
158
|
+
const Et = /* @__PURE__ */ h(Bt, [["render", Wt]]), It = {}, Ft = {
|
|
159
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
fill: "currentColor"
|
|
162
|
+
};
|
|
163
|
+
function Ot(t, o) {
|
|
164
|
+
return r(), l("svg", Ft, [...o[0] || (o[0] = [
|
|
165
|
+
u("path", {
|
|
166
|
+
"fill-rule": "evenodd",
|
|
167
|
+
d: "M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",
|
|
168
|
+
"clip-rule": "evenodd"
|
|
169
|
+
}, null, -1)
|
|
170
|
+
])]);
|
|
171
|
+
}
|
|
172
|
+
const Rt = /* @__PURE__ */ h(It, [["render", Ot]]), jt = {}, zt = {
|
|
173
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
174
|
+
viewBox: "0 0 24 24",
|
|
175
|
+
fill: "currentColor"
|
|
176
|
+
};
|
|
177
|
+
function Dt(t, o) {
|
|
178
|
+
return r(), l("svg", zt, [...o[0] || (o[0] = [
|
|
179
|
+
u("path", {
|
|
180
|
+
"fill-rule": "evenodd",
|
|
181
|
+
d: "M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",
|
|
182
|
+
"clip-rule": "evenodd"
|
|
183
|
+
}, null, -1)
|
|
184
|
+
])]);
|
|
185
|
+
}
|
|
186
|
+
const Pt = /* @__PURE__ */ h(jt, [["render", Dt]]), Vt = ["role", "aria-live"], Nt = ["aria-label"], Ut = { class: "tf-toast-surface" }, Xt = { class: "tf-toast-main" }, qt = { class: "tf-toast-body" }, Gt = { class: "tf-toast-text" }, Qt = ["aria-label"], Jt = ["aria-label", "innerHTML"], Yt = ["aria-label"], _t = ["aria-label", "innerHTML"], te = {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: "tf-toast-created-at"
|
|
189
|
+
}, ee = ["aria-label"], ne = /* @__PURE__ */ G({
|
|
190
|
+
__name: "Toast",
|
|
191
|
+
props: {
|
|
192
|
+
toast: {},
|
|
193
|
+
progressResetKey: {},
|
|
194
|
+
duplicateKey: {},
|
|
195
|
+
updateKey: {},
|
|
196
|
+
bumpAnimationClass: {},
|
|
197
|
+
clearAllAnimationClass: {},
|
|
198
|
+
updateAnimationClass: {}
|
|
199
|
+
},
|
|
200
|
+
emits: ["dismiss"],
|
|
201
|
+
setup(t, { emit: o }) {
|
|
202
|
+
const f = o, v = st(_, null);
|
|
203
|
+
if (!v)
|
|
204
|
+
throw new Error("[vue-toastflow] Plugin not installed");
|
|
205
|
+
const g = v, p = y(!1), w = y(!1), A = y(!1), b = {
|
|
206
|
+
success: {
|
|
207
|
+
accent: "tf-toast-accent--success",
|
|
208
|
+
icon: "tf-toast-icon--success",
|
|
209
|
+
close: "tf-toast-close--success",
|
|
210
|
+
component: wt
|
|
211
|
+
},
|
|
212
|
+
error: {
|
|
213
|
+
accent: "tf-toast-accent--error",
|
|
214
|
+
icon: "tf-toast-icon--error",
|
|
215
|
+
close: "tf-toast-close--error",
|
|
216
|
+
component: kt
|
|
217
|
+
},
|
|
218
|
+
warning: {
|
|
219
|
+
accent: "tf-toast-accent--warning",
|
|
220
|
+
icon: "tf-toast-icon--warning",
|
|
221
|
+
close: "tf-toast-close--warning",
|
|
222
|
+
component: Lt
|
|
223
|
+
},
|
|
224
|
+
info: {
|
|
225
|
+
accent: "tf-toast-accent--info",
|
|
226
|
+
icon: "tf-toast-icon--info",
|
|
227
|
+
close: "tf-toast-close--info",
|
|
228
|
+
component: Ht
|
|
229
|
+
},
|
|
230
|
+
default: {
|
|
231
|
+
accent: "tf-toast-accent--default",
|
|
232
|
+
icon: "tf-toast-icon--default",
|
|
233
|
+
close: "tf-toast-close--default",
|
|
234
|
+
component: Et
|
|
235
|
+
},
|
|
236
|
+
loading: {
|
|
237
|
+
accent: "tf-toast-accent--loading",
|
|
238
|
+
icon: "tf-toast-icon--loading",
|
|
239
|
+
close: "tf-toast-close--loading",
|
|
240
|
+
component: Rt
|
|
241
|
+
}
|
|
242
|
+
}, I = d(function() {
|
|
243
|
+
return j.has(t.toast.type) ? "alert" : "status";
|
|
244
|
+
}), F = d(function() {
|
|
245
|
+
return j.has(t.toast.type) ? "assertive" : "polite";
|
|
246
|
+
}), O = d(function() {
|
|
247
|
+
return b[t.toast.type].accent;
|
|
248
|
+
}), R = d(function() {
|
|
249
|
+
return b[t.toast.type].icon;
|
|
250
|
+
}), m = d(function() {
|
|
251
|
+
return b[t.toast.type].close;
|
|
252
|
+
}), S = d(function() {
|
|
253
|
+
return b[t.toast.type].component;
|
|
254
|
+
}), j = /* @__PURE__ */ new Set(["error", "warning"]), H = d(function() {
|
|
255
|
+
return {
|
|
256
|
+
"--tf-toast-progress-duration": `${t.toast.duration}ms`
|
|
257
|
+
};
|
|
258
|
+
}), z = function(i) {
|
|
259
|
+
return new Date(i).toLocaleTimeString([], {
|
|
260
|
+
hour: "2-digit",
|
|
261
|
+
minute: "2-digit"
|
|
262
|
+
});
|
|
263
|
+
}, B = d(function() {
|
|
264
|
+
return !!(t.toast.showCreatedAt && Number.isFinite(t.toast.createdAt));
|
|
265
|
+
}), x = d(function() {
|
|
266
|
+
if (!B.value)
|
|
267
|
+
return "";
|
|
268
|
+
const i = typeof t.toast.createdAtFormatter == "function" ? t.toast.createdAtFormatter : z;
|
|
269
|
+
try {
|
|
270
|
+
return i(t.toast.createdAt);
|
|
271
|
+
} catch {
|
|
272
|
+
return z(t.toast.createdAt);
|
|
273
|
+
}
|
|
274
|
+
}), $ = d(function() {
|
|
275
|
+
return x.value ? `Sent at ${x.value}` : "";
|
|
276
|
+
}), M = d(function() {
|
|
277
|
+
return e(t.toast.title);
|
|
278
|
+
}), L = d(function() {
|
|
279
|
+
return e(t.toast.description);
|
|
280
|
+
}), C = d(function() {
|
|
281
|
+
const i = [];
|
|
282
|
+
return M.value && i.push(M.value), L.value && i.push(L.value), B.value && $.value && i.push($.value), i.length || i.push(`${t.toast.type} notification`), i.join(". ");
|
|
283
|
+
});
|
|
284
|
+
function e(i) {
|
|
285
|
+
return i ? s(i) : "";
|
|
286
|
+
}
|
|
287
|
+
function s(i) {
|
|
288
|
+
const T = n(i.replace(/<[^>]*>/g, " "));
|
|
289
|
+
if (typeof window > "u" || !window.document)
|
|
290
|
+
return T;
|
|
291
|
+
try {
|
|
292
|
+
const N = window.document.createElement("div");
|
|
293
|
+
return N.innerHTML = i, n(N.textContent ?? "");
|
|
294
|
+
} catch {
|
|
295
|
+
return T;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function n(i) {
|
|
299
|
+
return i.replace(/\s+/g, " ").trim();
|
|
300
|
+
}
|
|
301
|
+
function a() {
|
|
302
|
+
return {
|
|
303
|
+
id: t.toast.id,
|
|
304
|
+
position: t.toast.position,
|
|
305
|
+
type: t.toast.type,
|
|
306
|
+
title: t.toast.title,
|
|
307
|
+
description: t.toast.description,
|
|
308
|
+
createdAt: t.toast.createdAt
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function D(i) {
|
|
312
|
+
const T = a();
|
|
313
|
+
t.toast.onClick && t.toast.onClick(T, i), t.toast.closeOnClick && f("dismiss", t.toast.id);
|
|
314
|
+
}
|
|
315
|
+
function P() {
|
|
316
|
+
f("dismiss", t.toast.id);
|
|
317
|
+
}
|
|
318
|
+
function tt() {
|
|
319
|
+
t.toast.pauseOnHover && (p.value = !0, g.pause(t.toast.id));
|
|
320
|
+
}
|
|
321
|
+
function et() {
|
|
322
|
+
t.toast.pauseOnHover && (p.value = !1, g.resume(t.toast.id));
|
|
323
|
+
}
|
|
324
|
+
const V = y(0);
|
|
325
|
+
E(
|
|
326
|
+
() => t.progressResetKey,
|
|
327
|
+
function() {
|
|
328
|
+
t.progressResetKey != null && (V.value += 1);
|
|
329
|
+
}
|
|
330
|
+
), E(
|
|
331
|
+
() => t.duplicateKey,
|
|
332
|
+
function() {
|
|
333
|
+
t.duplicateKey != null && (V.value += 1, nt());
|
|
334
|
+
}
|
|
335
|
+
), E(
|
|
336
|
+
() => t.updateKey,
|
|
337
|
+
function() {
|
|
338
|
+
t.updateKey != null && ot();
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
function nt() {
|
|
342
|
+
w.value = !1, requestAnimationFrame(function() {
|
|
343
|
+
w.value = !0;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function ot() {
|
|
347
|
+
A.value = !1, requestAnimationFrame(function() {
|
|
348
|
+
A.value = !0;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
return (i, T) => (r(), l("div", {
|
|
352
|
+
role: I.value,
|
|
353
|
+
"aria-live": F.value,
|
|
354
|
+
class: "tf-toast-wrapper"
|
|
355
|
+
}, [
|
|
356
|
+
u("div", {
|
|
357
|
+
class: k(["tf-toast", [
|
|
358
|
+
O.value,
|
|
359
|
+
w.value && t.toast.phase !== "leaving" && t.toast.phase !== "clear-all" && t.bumpAnimationClass,
|
|
360
|
+
A.value && t.toast.phase !== "leaving" && t.toast.phase !== "clear-all" && t.updateAnimationClass,
|
|
361
|
+
t.toast.phase === "clear-all" && t.clearAllAnimationClass,
|
|
362
|
+
p.value && "tf-toast--paused"
|
|
363
|
+
]]),
|
|
364
|
+
"aria-label": C.value || void 0,
|
|
365
|
+
onClick: D,
|
|
366
|
+
onMouseenter: tt,
|
|
367
|
+
onMouseleave: et
|
|
368
|
+
}, [
|
|
369
|
+
u("div", Ut, [
|
|
370
|
+
u("div", Xt, [
|
|
371
|
+
u("div", {
|
|
372
|
+
class: k(["tf-toast-icon", R.value]),
|
|
373
|
+
"aria-hidden": "true"
|
|
374
|
+
}, [
|
|
375
|
+
K(i.$slots, "icon", { toast: t.toast }, () => [
|
|
376
|
+
(r(), X(it(S.value), {
|
|
377
|
+
class: k(["tf-toast-icon-svg", [t.toast.type === "loading" && "tf-toast-icon-spin"]]),
|
|
378
|
+
"aria-hidden": "true"
|
|
379
|
+
}, null, 8, ["class"]))
|
|
380
|
+
], !0)
|
|
381
|
+
], 2),
|
|
382
|
+
u("div", qt, [
|
|
383
|
+
u("div", Gt, [
|
|
384
|
+
t.toast.title && !t.toast.supportHtml ? (r(), l("p", {
|
|
385
|
+
key: 0,
|
|
386
|
+
"aria-label": M.value || void 0,
|
|
387
|
+
class: "tf-toast-title"
|
|
388
|
+
}, U(t.toast.title), 9, Qt)) : t.toast.title && t.toast.supportHtml ? (r(), l("p", {
|
|
389
|
+
key: 1,
|
|
390
|
+
class: "tf-toast-title",
|
|
391
|
+
"aria-label": M.value || void 0,
|
|
392
|
+
innerHTML: t.toast.title
|
|
393
|
+
}, null, 8, Jt)) : Z("", !0),
|
|
394
|
+
t.toast.description && !t.toast.supportHtml ? (r(), l("p", {
|
|
395
|
+
key: 2,
|
|
396
|
+
"aria-label": L.value || void 0,
|
|
397
|
+
class: "tf-toast-description"
|
|
398
|
+
}, U(t.toast.description), 9, Yt)) : t.toast.description && t.toast.supportHtml ? (r(), l("p", {
|
|
399
|
+
key: 3,
|
|
400
|
+
class: "tf-toast-description",
|
|
401
|
+
"aria-label": L.value || void 0,
|
|
402
|
+
innerHTML: t.toast.description
|
|
403
|
+
}, null, 8, _t)) : Z("", !0)
|
|
404
|
+
]),
|
|
405
|
+
K(i.$slots, "default", { toast: t.toast }, void 0, !0),
|
|
406
|
+
B.value ? (r(), l("div", te, [
|
|
407
|
+
K(i.$slots, "created-at", {
|
|
408
|
+
toast: t.toast,
|
|
409
|
+
formatted: x.value
|
|
410
|
+
}, () => [
|
|
411
|
+
u("span", {
|
|
412
|
+
"aria-label": $.value || void 0
|
|
413
|
+
}, U(x.value), 9, ee)
|
|
414
|
+
], !0)
|
|
415
|
+
])) : Z("", !0)
|
|
416
|
+
])
|
|
417
|
+
]),
|
|
418
|
+
t.toast.progressBar ? (r(), l("div", {
|
|
419
|
+
key: 0,
|
|
420
|
+
class: "tf-toast-progress-wrapper",
|
|
421
|
+
style: W(H.value)
|
|
422
|
+
}, [
|
|
423
|
+
K(i.$slots, "progress", { toast: t.toast }, () => [
|
|
424
|
+
(r(), X(ht, {
|
|
425
|
+
key: V.value,
|
|
426
|
+
type: t.toast.type
|
|
427
|
+
}, null, 8, ["type"]))
|
|
428
|
+
], !0)
|
|
429
|
+
], 4)) : Z("", !0)
|
|
430
|
+
]),
|
|
431
|
+
t.toast.closeButton ? (r(), l("button", {
|
|
432
|
+
key: 0,
|
|
433
|
+
type: "button",
|
|
434
|
+
class: k(["tf-toast-close", m.value]),
|
|
435
|
+
"aria-label": "Close notification",
|
|
436
|
+
onClick: rt(P, ["stop"])
|
|
437
|
+
}, [
|
|
438
|
+
K(i.$slots, "close-icon", { toast: t.toast }, () => [
|
|
439
|
+
Y(Pt, {
|
|
440
|
+
class: "tf-toast-close-icon",
|
|
441
|
+
"aria-hidden": "true"
|
|
442
|
+
})
|
|
443
|
+
], !0)
|
|
444
|
+
], 2)) : Z("", !0)
|
|
445
|
+
], 42, Nt)
|
|
446
|
+
], 8, Vt));
|
|
447
|
+
}
|
|
448
|
+
}), oe = /* @__PURE__ */ h(ne, [["__scopeId", "data-v-edee5727"]]), ae = ["data-position"], se = /* @__PURE__ */ G({
|
|
449
|
+
__name: "ToastContainer",
|
|
450
|
+
setup(t) {
|
|
451
|
+
const o = [
|
|
452
|
+
"top-left",
|
|
453
|
+
"top-center",
|
|
454
|
+
"top-right",
|
|
455
|
+
"bottom-left",
|
|
456
|
+
"bottom-center",
|
|
457
|
+
"bottom-right"
|
|
458
|
+
], f = c(), v = y([]), g = y({}), p = y({}), w = y({});
|
|
459
|
+
let A = null, b = null;
|
|
460
|
+
lt(function() {
|
|
461
|
+
A = f.subscribe(function(e) {
|
|
462
|
+
v.value = e.toasts;
|
|
463
|
+
}), b = f.subscribeEvents(function(e) {
|
|
464
|
+
e.kind === "timer-reset" && (g.value[e.id] = Math.random()), e.kind === "duplicate" && (p.value[e.id] = Math.random()), e.kind === "update" && (w.value[e.id] = Math.random());
|
|
465
|
+
});
|
|
466
|
+
}), ct(function() {
|
|
467
|
+
A && A(), b && b();
|
|
468
|
+
});
|
|
469
|
+
function I(e) {
|
|
470
|
+
return g.value[e] ?? 0;
|
|
471
|
+
}
|
|
472
|
+
function F(e) {
|
|
473
|
+
return p.value[e] ?? 0;
|
|
474
|
+
}
|
|
475
|
+
function O(e) {
|
|
476
|
+
return w.value[e] ?? 0;
|
|
477
|
+
}
|
|
478
|
+
const R = d(function() {
|
|
479
|
+
const e = {
|
|
480
|
+
"top-left": [],
|
|
481
|
+
"top-center": [],
|
|
482
|
+
"top-right": [],
|
|
483
|
+
"bottom-left": [],
|
|
484
|
+
"bottom-center": [],
|
|
485
|
+
"bottom-right": []
|
|
486
|
+
};
|
|
487
|
+
for (const s of v.value)
|
|
488
|
+
e[s.position].push(s);
|
|
489
|
+
return e;
|
|
490
|
+
}), m = f.getConfig(), S = y({
|
|
491
|
+
"top-left": { ...m, position: "top-left" },
|
|
492
|
+
"top-center": { ...m, position: "top-center" },
|
|
493
|
+
"top-right": { ...m, position: "top-right" },
|
|
494
|
+
"bottom-left": { ...m, position: "bottom-left" },
|
|
495
|
+
"bottom-center": { ...m, position: "bottom-center" },
|
|
496
|
+
"bottom-right": { ...m, position: "bottom-right" }
|
|
497
|
+
}), j = d(function() {
|
|
498
|
+
return v.value.length ? Math.max(...v.value.map((e) => e.zIndex)) : m.zIndex;
|
|
499
|
+
});
|
|
500
|
+
function H(e) {
|
|
501
|
+
return S.value[e] ?? { ...m, position: e };
|
|
502
|
+
}
|
|
503
|
+
function z(e) {
|
|
504
|
+
const { offset: s, width: n } = H(e), a = { width: n, maxWidth: "100%" };
|
|
505
|
+
return e.startsWith("top-") && (a.top = s), e.startsWith("bottom-") && (a.bottom = s), e.endsWith("left") ? a.left = s : e.endsWith("right") ? a.right = s : e.endsWith("center") && (a.left = "50%", a.transform = "translateX(-50%)"), a;
|
|
506
|
+
}
|
|
507
|
+
function B(e) {
|
|
508
|
+
return e.endsWith("left") ? "tf-toast-stack--left" : e.endsWith("center") ? "tf-toast-stack--center" : "tf-toast-stack--right";
|
|
509
|
+
}
|
|
510
|
+
function x(e) {
|
|
511
|
+
return e.startsWith("bottom-") ? "tf-toast-stack-inner--bottom" : null;
|
|
512
|
+
}
|
|
513
|
+
function $(e) {
|
|
514
|
+
f.dismiss(e);
|
|
515
|
+
}
|
|
516
|
+
function M(e) {
|
|
517
|
+
const s = e, n = s.parentElement;
|
|
518
|
+
if (!n || n.children.length <= 1)
|
|
519
|
+
return;
|
|
520
|
+
const a = s.offsetTop, D = n.clientHeight, P = n.clientWidth;
|
|
521
|
+
n.style.minHeight = `${D}px`, s.style.position = "absolute", s.style.width = `${P}px`, s.style.left = "0", s.style.right = "0", s.style.top = `${a}px`;
|
|
522
|
+
}
|
|
523
|
+
function L(e) {
|
|
524
|
+
const s = e, n = s.parentElement;
|
|
525
|
+
n && (n.style.minHeight = ""), s.style.position = "", s.style.width = "", s.style.left = "", s.style.right = "", s.style.top = "";
|
|
526
|
+
}
|
|
527
|
+
E(
|
|
528
|
+
v,
|
|
529
|
+
function(e) {
|
|
530
|
+
const s = new Set(
|
|
531
|
+
e.map(function(n) {
|
|
532
|
+
return n.id;
|
|
533
|
+
})
|
|
534
|
+
);
|
|
535
|
+
for (const n of Object.keys(g.value))
|
|
536
|
+
s.has(n) || delete g.value[n];
|
|
537
|
+
for (const n of Object.keys(p.value))
|
|
538
|
+
s.has(n) || delete p.value[n];
|
|
539
|
+
for (const n of Object.keys(w.value))
|
|
540
|
+
s.has(n) || delete w.value[n];
|
|
541
|
+
},
|
|
542
|
+
{ deep: !1 }
|
|
543
|
+
);
|
|
544
|
+
function C(e) {
|
|
545
|
+
return {
|
|
546
|
+
...m.animation,
|
|
547
|
+
...e.animation
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
return E(
|
|
551
|
+
R,
|
|
552
|
+
function(e) {
|
|
553
|
+
const s = { ...S.value };
|
|
554
|
+
Object.keys(e).forEach(function(n) {
|
|
555
|
+
const a = e[n][0];
|
|
556
|
+
a && (s[n] = {
|
|
557
|
+
...m,
|
|
558
|
+
...a,
|
|
559
|
+
position: n,
|
|
560
|
+
animation: {
|
|
561
|
+
...m.animation,
|
|
562
|
+
...a.animation
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}), S.value = s;
|
|
566
|
+
},
|
|
567
|
+
{ deep: !1 }
|
|
568
|
+
), (e, s) => (r(), l("div", {
|
|
569
|
+
class: "tf-toast-root",
|
|
570
|
+
style: W({ zIndex: j.value })
|
|
571
|
+
}, [
|
|
572
|
+
(r(), l(Q, null, J(o, (n) => u("div", {
|
|
573
|
+
key: n,
|
|
574
|
+
class: k(["tf-toast-stack", B(n)]),
|
|
575
|
+
style: W(z(n))
|
|
576
|
+
}, [
|
|
577
|
+
Y(ut, {
|
|
578
|
+
name: H(n).animation.name,
|
|
579
|
+
onBeforeLeave: M,
|
|
580
|
+
onAfterLeave: L,
|
|
581
|
+
tag: "div",
|
|
582
|
+
class: k(["tf-toast-stack-inner", x(n)]),
|
|
583
|
+
style: W({ gap: H(n).gap })
|
|
584
|
+
}, {
|
|
585
|
+
default: dt(() => [
|
|
586
|
+
(r(!0), l(Q, null, J(R.value[n], (a) => (r(), l("div", {
|
|
587
|
+
key: a.id,
|
|
588
|
+
class: "tf-toast-item",
|
|
589
|
+
style: W({ width: a.width, maxWidth: "100%" }),
|
|
590
|
+
"data-position": a.position
|
|
591
|
+
}, [
|
|
592
|
+
e.$slots.default ? K(e.$slots, "default", {
|
|
593
|
+
key: 0,
|
|
594
|
+
toast: a,
|
|
595
|
+
progressResetKey: I(a.id),
|
|
596
|
+
duplicateKey: F(a.id),
|
|
597
|
+
updateKey: O(a.id),
|
|
598
|
+
bumpAnimationClass: C(a).bump,
|
|
599
|
+
clearAllAnimationClass: C(a).clearAll,
|
|
600
|
+
updateAnimationClass: C(a).update,
|
|
601
|
+
dismiss: $
|
|
602
|
+
}, void 0, !0) : (r(), X(oe, {
|
|
603
|
+
key: 1,
|
|
604
|
+
toast: a,
|
|
605
|
+
progressResetKey: I(a.id),
|
|
606
|
+
duplicateKey: F(a.id),
|
|
607
|
+
updateKey: O(a.id),
|
|
608
|
+
bumpAnimationClass: C(a).bump,
|
|
609
|
+
clearAllAnimationClass: C(a).clearAll,
|
|
610
|
+
updateAnimationClass: C(a).update,
|
|
611
|
+
onDismiss: $
|
|
612
|
+
}, null, 8, ["toast", "progressResetKey", "duplicateKey", "updateKey", "bumpAnimationClass", "clearAllAnimationClass", "updateAnimationClass"]))
|
|
613
|
+
], 12, ae))), 128))
|
|
614
|
+
]),
|
|
615
|
+
_: 2
|
|
616
|
+
}, 1032, ["name", "class", "style"])
|
|
617
|
+
], 6)), 64))
|
|
618
|
+
], 4));
|
|
619
|
+
}
|
|
620
|
+
}), ue = /* @__PURE__ */ h(se, [["__scopeId", "data-v-b00384d2"]]);
|
|
621
|
+
export {
|
|
622
|
+
Rt as ArrowPath,
|
|
623
|
+
Lt as Bell,
|
|
624
|
+
wt as CheckCircle,
|
|
625
|
+
Ht as InfoCircle,
|
|
626
|
+
Et as QuestionMarkCircle,
|
|
627
|
+
oe as Toast,
|
|
628
|
+
ue as ToastContainer,
|
|
629
|
+
ht as ToastProgress,
|
|
630
|
+
kt as XCircle,
|
|
631
|
+
Pt as XMark,
|
|
632
|
+
ce as createToastflow,
|
|
633
|
+
c as getToastStore,
|
|
634
|
+
ft as setToastStore,
|
|
635
|
+
le as toast
|
|
636
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(i,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("toastflow-core"),require("vue")):typeof define=="function"&&define.amd?define(["exports","toastflow-core","vue"],w):(i=typeof globalThis<"u"?globalThis:i||self,w(i.Toastflow={},i.toastflowCore,i.Vue))})(this,(function(i,w,t){"use strict";const j=Symbol("toast-store");let H=null;function I(e){H=e}function c(){if(!H)throw new Error("[vue-toastflow] Toast store not initialized. Did you install the plugin?");return H}const J={getState(){return c().getState()},subscribeEvents(e){return c().subscribeEvents(e)},show(e){return c().show(e)},loading(e,a){return c().loading(e,a)},update(e,a){return c().update(e,a)},dismiss(e){return c().dismiss(e)},dismissAll(){return c().dismissAll()},pause(e){return c().pause(e)},resume(e){return c().resume(e)},getConfig(){return c().getConfig()},toast(e){return c().show({...e,type:"default"})},success(e){return c().show({...e,type:"success"})},error(e){return c().show({...e,type:"error"})},info(e){return c().show({...e,type:"info"})},warning(e){return c().show({...e,type:"warning"})}};function Y(e={}){const a=w.createToastStore(e);return I(a),{install(d){d.provide(j,a)}}}const _={class:"tf-toast-progress"},tt=t.defineComponent({__name:"ToastProgress",props:{type:{}},setup(e){return(a,d)=>(t.openBlock(),t.createElementBlock("div",_,[t.createElementVNode("div",{class:t.normalizeClass(["tf-toast-progress-bar",`tf-toast-progress-bar--${e.type}`])},null,2)]))}}),u=(e,a)=>{const d=e.__vccOpts||e;for(const[m,h]of a)d[m]=h;return d},P=u(tt,[["__scopeId","data-v-ca0da064"]]),et={},nt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function ot(e,a){return t.openBlock(),t.createElementBlock("svg",nt,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z","clip-rule":"evenodd"},null,-1)])])}const D=u(et,[["render",ot]]),at={},st={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function lt(e,a){return t.openBlock(),t.createElementBlock("svg",st,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z","clip-rule":"evenodd"},null,-1)])])}const F=u(at,[["render",lt]]),rt={},it={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function ct(e,a){return t.openBlock(),t.createElementBlock("svg",it,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M5.25 9a6.75 6.75 0 0 1 13.5 0v.75c0 2.123.8 4.057 2.118 5.52a.75.75 0 0 1-.297 1.206c-1.544.57-3.16.99-4.831 1.243a3.75 3.75 0 1 1-7.48 0 24.585 24.585 0 0 1-4.831-1.244.75.75 0 0 1-.298-1.205A8.217 8.217 0 0 0 5.25 9.75V9Zm4.502 8.9a2.25 2.25 0 1 0 4.496 0 25.057 25.057 0 0 1-4.496 0Z","clip-rule":"evenodd"},null,-1)])])}const R=u(rt,[["render",ct]]),dt={},ft={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function ut(e,a){return t.openBlock(),t.createElementBlock("svg",ft,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)])])}const X=u(dt,[["render",ut]]),mt={},ht={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function pt(e,a){return t.openBlock(),t.createElementBlock("svg",ht,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm11.378-3.917c-.89-.777-2.366-.777-3.255 0a.75.75 0 0 1-.988-1.129c1.454-1.272 3.776-1.272 5.23 0 1.513 1.324 1.513 3.518 0 4.842a3.75 3.75 0 0 1-.837.552c-.676.328-1.028.774-1.028 1.152v.75a.75.75 0 0 1-1.5 0v-.75c0-1.279 1.06-2.107 1.875-2.502.182-.088.351-.199.503-.331.83-.727.83-1.857 0-2.584ZM12 18a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)])])}const q=u(mt,[["render",pt]]),gt={},yt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function kt(e,a){return t.openBlock(),t.createElementBlock("svg",yt,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"},null,-1)])])}const U=u(gt,[["render",kt]]),wt={},Ct={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"};function bt(e,a){return t.openBlock(),t.createElementBlock("svg",Ct,[...a[0]||(a[0]=[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)])])}const Q=u(wt,[["render",bt]]),Bt=["role","aria-live"],At=["aria-label"],Et={class:"tf-toast-surface"},$t={class:"tf-toast-main"},St={class:"tf-toast-body"},Tt={class:"tf-toast-text"},Mt=["aria-label"],Lt=["aria-label","innerHTML"],Vt=["aria-label"],xt=["aria-label","innerHTML"],Nt={key:0,class:"tf-toast-created-at"},Kt=["aria-label"],G=u(t.defineComponent({__name:"Toast",props:{toast:{},progressResetKey:{},duplicateKey:{},updateKey:{},bumpAnimationClass:{},clearAllAnimationClass:{},updateAnimationClass:{}},emits:["dismiss"],setup(e,{emit:a}){const d=a,m=t.inject(j,null);if(!m)throw new Error("[vue-toastflow] Plugin not installed");const h=m,p=t.ref(!1),g=t.ref(!1),C=t.ref(!1),y={success:{accent:"tf-toast-accent--success",icon:"tf-toast-icon--success",close:"tf-toast-close--success",component:D},error:{accent:"tf-toast-accent--error",icon:"tf-toast-icon--error",close:"tf-toast-close--error",component:F},warning:{accent:"tf-toast-accent--warning",icon:"tf-toast-icon--warning",close:"tf-toast-close--warning",component:R},info:{accent:"tf-toast-accent--info",icon:"tf-toast-icon--info",close:"tf-toast-close--info",component:X},default:{accent:"tf-toast-accent--default",icon:"tf-toast-icon--default",close:"tf-toast-close--default",component:q},loading:{accent:"tf-toast-accent--loading",icon:"tf-toast-icon--loading",close:"tf-toast-close--loading",component:U}},L=t.computed(function(){return K.has(e.toast.type)?"alert":"status"}),V=t.computed(function(){return K.has(e.toast.type)?"assertive":"polite"}),x=t.computed(function(){return y[e.toast.type].accent}),N=t.computed(function(){return y[e.toast.type].icon}),f=t.computed(function(){return y[e.toast.type].close}),S=t.computed(function(){return y[e.toast.type].component}),K=new Set(["error","warning"]),T=t.computed(function(){return{"--tf-toast-progress-duration":`${e.toast.duration}ms`}}),v=function(r){return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},M=t.computed(function(){return!!(e.toast.showCreatedAt&&Number.isFinite(e.toast.createdAt))}),b=t.computed(function(){if(!M.value)return"";const r=typeof e.toast.createdAtFormatter=="function"?e.toast.createdAtFormatter:v;try{return r(e.toast.createdAt)}catch{return v(e.toast.createdAt)}}),B=t.computed(function(){return b.value?`Sent at ${b.value}`:""}),A=t.computed(function(){return n(e.toast.title)}),E=t.computed(function(){return n(e.toast.description)}),k=t.computed(function(){const r=[];return A.value&&r.push(A.value),E.value&&r.push(E.value),M.value&&B.value&&r.push(B.value),r.length||r.push(`${e.toast.type} notification`),r.join(". ")});function n(r){return r?l(r):""}function l(r){const $=o(r.replace(/<[^>]*>/g," "));if(typeof window>"u"||!window.document)return $;try{const O=window.document.createElement("div");return O.innerHTML=r,o(O.textContent??"")}catch{return $}}function o(r){return r.replace(/\s+/g," ").trim()}function s(){return{id:e.toast.id,position:e.toast.position,type:e.toast.type,title:e.toast.title,description:e.toast.description,createdAt:e.toast.createdAt}}function z(r){const $=s();e.toast.onClick&&e.toast.onClick($,r),e.toast.closeOnClick&&d("dismiss",e.toast.id)}function Z(){d("dismiss",e.toast.id)}function zt(){e.toast.pauseOnHover&&(p.value=!0,h.pause(e.toast.id))}function Zt(){e.toast.pauseOnHover&&(p.value=!1,h.resume(e.toast.id))}const W=t.ref(0);t.watch(()=>e.progressResetKey,function(){e.progressResetKey!=null&&(W.value+=1)}),t.watch(()=>e.duplicateKey,function(){e.duplicateKey!=null&&(W.value+=1,Wt())}),t.watch(()=>e.updateKey,function(){e.updateKey!=null&&Ot()});function Wt(){g.value=!1,requestAnimationFrame(function(){g.value=!0})}function Ot(){C.value=!1,requestAnimationFrame(function(){C.value=!0})}return(r,$)=>(t.openBlock(),t.createElementBlock("div",{role:L.value,"aria-live":V.value,class:"tf-toast-wrapper"},[t.createElementVNode("div",{class:t.normalizeClass(["tf-toast",[x.value,g.value&&e.toast.phase!=="leaving"&&e.toast.phase!=="clear-all"&&e.bumpAnimationClass,C.value&&e.toast.phase!=="leaving"&&e.toast.phase!=="clear-all"&&e.updateAnimationClass,e.toast.phase==="clear-all"&&e.clearAllAnimationClass,p.value&&"tf-toast--paused"]]),"aria-label":k.value||void 0,onClick:z,onMouseenter:zt,onMouseleave:Zt},[t.createElementVNode("div",Et,[t.createElementVNode("div",$t,[t.createElementVNode("div",{class:t.normalizeClass(["tf-toast-icon",N.value]),"aria-hidden":"true"},[t.renderSlot(r.$slots,"icon",{toast:e.toast},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.value),{class:t.normalizeClass(["tf-toast-icon-svg",[e.toast.type==="loading"&&"tf-toast-icon-spin"]]),"aria-hidden":"true"},null,8,["class"]))],!0)],2),t.createElementVNode("div",St,[t.createElementVNode("div",Tt,[e.toast.title&&!e.toast.supportHtml?(t.openBlock(),t.createElementBlock("p",{key:0,"aria-label":A.value||void 0,class:"tf-toast-title"},t.toDisplayString(e.toast.title),9,Mt)):e.toast.title&&e.toast.supportHtml?(t.openBlock(),t.createElementBlock("p",{key:1,class:"tf-toast-title","aria-label":A.value||void 0,innerHTML:e.toast.title},null,8,Lt)):t.createCommentVNode("",!0),e.toast.description&&!e.toast.supportHtml?(t.openBlock(),t.createElementBlock("p",{key:2,"aria-label":E.value||void 0,class:"tf-toast-description"},t.toDisplayString(e.toast.description),9,Vt)):e.toast.description&&e.toast.supportHtml?(t.openBlock(),t.createElementBlock("p",{key:3,class:"tf-toast-description","aria-label":E.value||void 0,innerHTML:e.toast.description},null,8,xt)):t.createCommentVNode("",!0)]),t.renderSlot(r.$slots,"default",{toast:e.toast},void 0,!0),M.value?(t.openBlock(),t.createElementBlock("div",Nt,[t.renderSlot(r.$slots,"created-at",{toast:e.toast,formatted:b.value},()=>[t.createElementVNode("span",{"aria-label":B.value||void 0},t.toDisplayString(b.value),9,Kt)],!0)])):t.createCommentVNode("",!0)])]),e.toast.progressBar?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tf-toast-progress-wrapper",style:t.normalizeStyle(T.value)},[t.renderSlot(r.$slots,"progress",{toast:e.toast},()=>[(t.openBlock(),t.createBlock(P,{key:W.value,type:e.toast.type},null,8,["type"]))],!0)],4)):t.createCommentVNode("",!0)]),e.toast.closeButton?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tf-toast-close",f.value]),"aria-label":"Close notification",onClick:t.withModifiers(Z,["stop"])},[t.renderSlot(r.$slots,"close-icon",{toast:e.toast},()=>[t.createVNode(Q,{class:"tf-toast-close-icon","aria-hidden":"true"})],!0)],2)):t.createCommentVNode("",!0)],42,At)],8,Bt))}}),[["__scopeId","data-v-edee5727"]]),vt=["data-position"],Ht=u(t.defineComponent({__name:"ToastContainer",setup(e){const a=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],d=c(),m=t.ref([]),h=t.ref({}),p=t.ref({}),g=t.ref({});let C=null,y=null;t.onMounted(function(){C=d.subscribe(function(n){m.value=n.toasts}),y=d.subscribeEvents(function(n){n.kind==="timer-reset"&&(h.value[n.id]=Math.random()),n.kind==="duplicate"&&(p.value[n.id]=Math.random()),n.kind==="update"&&(g.value[n.id]=Math.random())})}),t.onUnmounted(function(){C&&C(),y&&y()});function L(n){return h.value[n]??0}function V(n){return p.value[n]??0}function x(n){return g.value[n]??0}const N=t.computed(function(){const n={"top-left":[],"top-center":[],"top-right":[],"bottom-left":[],"bottom-center":[],"bottom-right":[]};for(const l of m.value)n[l.position].push(l);return n}),f=d.getConfig(),S=t.ref({"top-left":{...f,position:"top-left"},"top-center":{...f,position:"top-center"},"top-right":{...f,position:"top-right"},"bottom-left":{...f,position:"bottom-left"},"bottom-center":{...f,position:"bottom-center"},"bottom-right":{...f,position:"bottom-right"}}),K=t.computed(function(){return m.value.length?Math.max(...m.value.map(n=>n.zIndex)):f.zIndex});function T(n){return S.value[n]??{...f,position:n}}function v(n){const{offset:l,width:o}=T(n),s={width:o,maxWidth:"100%"};return n.startsWith("top-")&&(s.top=l),n.startsWith("bottom-")&&(s.bottom=l),n.endsWith("left")?s.left=l:n.endsWith("right")?s.right=l:n.endsWith("center")&&(s.left="50%",s.transform="translateX(-50%)"),s}function M(n){return n.endsWith("left")?"tf-toast-stack--left":n.endsWith("center")?"tf-toast-stack--center":"tf-toast-stack--right"}function b(n){return n.startsWith("bottom-")?"tf-toast-stack-inner--bottom":null}function B(n){d.dismiss(n)}function A(n){const l=n,o=l.parentElement;if(!o||o.children.length<=1)return;const s=l.offsetTop,z=o.clientHeight,Z=o.clientWidth;o.style.minHeight=`${z}px`,l.style.position="absolute",l.style.width=`${Z}px`,l.style.left="0",l.style.right="0",l.style.top=`${s}px`}function E(n){const l=n,o=l.parentElement;o&&(o.style.minHeight=""),l.style.position="",l.style.width="",l.style.left="",l.style.right="",l.style.top=""}t.watch(m,function(n){const l=new Set(n.map(function(o){return o.id}));for(const o of Object.keys(h.value))l.has(o)||delete h.value[o];for(const o of Object.keys(p.value))l.has(o)||delete p.value[o];for(const o of Object.keys(g.value))l.has(o)||delete g.value[o]},{deep:!1});function k(n){return{...f.animation,...n.animation}}return t.watch(N,function(n){const l={...S.value};Object.keys(n).forEach(function(o){const s=n[o][0];s&&(l[o]={...f,...s,position:o,animation:{...f.animation,...s.animation}})}),S.value=l},{deep:!1}),(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:"tf-toast-root",style:t.normalizeStyle({zIndex:K.value})},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(a,o=>t.createElementVNode("div",{key:o,class:t.normalizeClass(["tf-toast-stack",M(o)]),style:t.normalizeStyle(v(o))},[t.createVNode(t.TransitionGroup,{name:T(o).animation.name,onBeforeLeave:A,onAfterLeave:E,tag:"div",class:t.normalizeClass(["tf-toast-stack-inner",b(o)]),style:t.normalizeStyle({gap:T(o).gap})},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value[o],s=>(t.openBlock(),t.createElementBlock("div",{key:s.id,class:"tf-toast-item",style:t.normalizeStyle({width:s.width,maxWidth:"100%"}),"data-position":s.position},[n.$slots.default?t.renderSlot(n.$slots,"default",{key:0,toast:s,progressResetKey:L(s.id),duplicateKey:V(s.id),updateKey:x(s.id),bumpAnimationClass:k(s).bump,clearAllAnimationClass:k(s).clearAll,updateAnimationClass:k(s).update,dismiss:B},void 0,!0):(t.openBlock(),t.createBlock(G,{key:1,toast:s,progressResetKey:L(s.id),duplicateKey:V(s.id),updateKey:x(s.id),bumpAnimationClass:k(s).bump,clearAllAnimationClass:k(s).clearAll,updateAnimationClass:k(s).update,onDismiss:B},null,8,["toast","progressResetKey","duplicateKey","updateKey","bumpAnimationClass","clearAllAnimationClass","updateAnimationClass"]))],12,vt))),128))]),_:2},1032,["name","class","style"])],6)),64))],4))}}),[["__scopeId","data-v-b00384d2"]]);i.ArrowPath=U,i.Bell=R,i.CheckCircle=D,i.InfoCircle=X,i.QuestionMarkCircle=q,i.Toast=G,i.ToastContainer=Ht,i.ToastProgress=P,i.XCircle=F,i.XMark=Q,i.createToastflow=Y,i.getToastStore=c,i.setToastStore=I,i.toast=J,Object.keys(w).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(i,e)&&Object.defineProperty(i,e,{enumerable:!0,get:()=>w[e]})}),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|