@edgar208/sileo-vue 1.2.2 → 1.4.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.
package/dist/sileo-vue.js CHANGED
@@ -1,92 +1,92 @@
1
- import { reactive as X, markRaw as D, defineComponent as I, ref as x, computed as k, onUnmounted as N, openBlock as l, createElementBlock as d, normalizeStyle as L, normalizeClass as B, createElementVNode as s, createCommentVNode as h, createBlock as z, resolveDynamicComponent as R, toDisplayString as b, withModifiers as O, Fragment as M, renderList as S, createVNode as V, TransitionGroup as W, withCtx as Z, unref as F, createApp as G, h as U } from "vue";
2
- const y = X([]), C = X({
1
+ import { reactive as X, markRaw as D, defineComponent as I, ref as k, computed as h, onUnmounted as R, openBlock as l, createElementBlock as u, normalizeStyle as L, normalizeClass as $, createElementVNode as i, createCommentVNode as x, createBlock as z, resolveDynamicComponent as V, toDisplayString as b, withModifiers as O, Fragment as M, renderList as S, createVNode as W, TransitionGroup as F, withCtx as G, unref as U, createApp as q, h as H } from "vue";
2
+ const m = X([]), T = X({
3
3
  position: "top-right",
4
4
  duration: 4e3,
5
5
  maxToasts: 5
6
- }), q = () => Math.random().toString(36).substring(2, 9);
6
+ }), J = () => Math.random().toString(36).substring(2, 9);
7
7
  function A() {
8
8
  const t = (e) => {
9
9
  const o = {
10
10
  type: "default",
11
- duration: C.duration || 4e3,
12
- position: C.position || "top-right",
11
+ duration: T.duration || 4e3,
12
+ position: T.position || "top-right",
13
13
  showProgress: !0,
14
14
  closeOnClick: !0,
15
15
  swipeToDismiss: !0
16
- }, r = typeof e == "string" ? { message: e } : e;
17
- y.length >= (C.maxToasts || 5) && y.shift();
18
- const n = q(), i = {
16
+ }, a = typeof e == "string" ? { message: e } : e;
17
+ m.length >= (T.maxToasts || 5) && m.shift();
18
+ const s = J(), n = {
19
19
  ...o,
20
- ...r,
21
- id: n,
20
+ ...a,
21
+ id: s,
22
22
  createdAt: Date.now()
23
23
  };
24
- return i.icon && typeof i.icon != "string" && (i.icon = D(i.icon)), y.push(i), i.duration > 0 && setTimeout(() => {
25
- v(n);
26
- }, i.duration), n;
27
- }, v = (e) => {
28
- const o = y.findIndex((r) => r.id === e);
29
- o !== -1 && y.splice(o, 1);
30
- }, f = (e, o) => {
31
- const r = y.findIndex((n) => n.id === e);
32
- if (r !== -1) {
33
- const n = { ...y[r], ...o };
34
- typeof o.icon < "u" && o.icon && typeof o.icon != "string" && (n.icon = D(o.icon)), y[r] = n;
24
+ return n.icon && typeof n.icon != "string" && (n.icon = D(n.icon)), m.push(n), n.duration > 0 && setTimeout(() => {
25
+ y(s);
26
+ }, n.duration), s;
27
+ }, y = (e) => {
28
+ const o = m.findIndex((a) => a.id === e);
29
+ o !== -1 && m.splice(o, 1);
30
+ }, d = (e, o) => {
31
+ const a = m.findIndex((s) => s.id === e);
32
+ if (a !== -1) {
33
+ const s = { ...m[a], ...o };
34
+ typeof o.icon < "u" && o.icon && typeof o.icon != "string" && (s.icon = D(o.icon)), m[a] = s;
35
35
  }
36
- }, g = Object.assign(t, {
36
+ }, v = Object.assign(t, {
37
37
  success: (e) => t(typeof e == "string" ? { message: e, type: "success" } : { ...e, type: "success" }),
38
38
  error: (e) => t(typeof e == "string" ? { message: e, type: "error" } : { ...e, type: "error" }),
39
39
  warning: (e) => t(typeof e == "string" ? { message: e, type: "warning" } : { ...e, type: "warning" }),
40
40
  info: (e) => t(typeof e == "string" ? { message: e, type: "info" } : { ...e, type: "info" }),
41
41
  promise: async (e, o) => {
42
- const r = t(typeof o.loading == "string" ? { message: o.loading, type: "default", duration: 0 } : { ...o.loading, type: "default", duration: 0 });
42
+ const a = t(typeof o.loading == "string" ? { message: o.loading, type: "default", duration: 0 } : { ...o.loading, type: "default", duration: 0 });
43
43
  try {
44
- const n = await e, i = typeof o.success == "function" ? o.success(n) : o.success, c = typeof i == "string" ? { message: i, type: "success" } : { ...i, type: "success" };
45
- return f(r, { ...c, duration: c.duration || 4e3 }), setTimeout(() => v(r), c.duration || 4e3), n;
46
- } catch (n) {
47
- const i = typeof o.error == "function" ? o.error(n) : o.error, c = typeof i == "string" ? { message: i, type: "error" } : { ...i, type: "error" };
48
- throw f(r, { ...c, duration: c.duration || 4e3 }), setTimeout(() => v(r), c.duration || 4e3), n;
44
+ const s = await e, n = typeof o.success == "function" ? o.success(s) : o.success, c = typeof n == "string" ? { message: n, type: "success" } : { ...n, type: "success" };
45
+ return d(a, { ...c, duration: c.duration || 4e3 }), setTimeout(() => y(a), c.duration || 4e3), s;
46
+ } catch (s) {
47
+ const n = typeof o.error == "function" ? o.error(s) : o.error, c = typeof n == "string" ? { message: n, type: "error" } : { ...n, type: "error" };
48
+ throw d(a, { ...c, duration: c.duration || 4e3 }), setTimeout(() => y(a), c.duration || 4e3), s;
49
49
  }
50
50
  },
51
- clear: () => y.length = 0,
52
- config: (e) => Object.assign(C, e)
51
+ clear: () => m.length = 0,
52
+ config: (e) => Object.assign(T, e)
53
53
  });
54
54
  return {
55
- toasts: y,
56
- toast: g,
57
- removeToast: v,
58
- updateToast: f
55
+ toasts: m,
56
+ toast: v,
57
+ removeToast: y,
58
+ updateToast: d
59
59
  };
60
60
  }
61
- const E = A(), H = { class: "sileo-combined-shape" }, J = { class: "sileo-header-pill" }, K = {
61
+ const E = A(), K = { class: "sileo-combined-shape" }, Q = { class: "sileo-header-pill" }, Y = {
62
62
  key: 0,
63
63
  class: "sileo-sweep-left"
64
- }, Q = {
64
+ }, Z = {
65
65
  key: 1,
66
66
  class: "sileo-sweep-right"
67
- }, Y = { class: "sileo-icon-wrapper" }, _ = {
67
+ }, _ = { class: "sileo-icon-wrapper" }, tt = {
68
68
  key: 1,
69
69
  class: "sileo-emoji"
70
- }, tt = {
70
+ }, et = {
71
71
  key: 2,
72
72
  class: "sileo-default-icon"
73
- }, et = {
73
+ }, ot = {
74
74
  key: 0,
75
75
  class: "sileo-spin",
76
76
  viewBox: "0 0 50 50"
77
- }, ot = {
77
+ }, st = {
78
78
  key: 1,
79
79
  class: "sileo-icon-circle bg-success"
80
- }, st = {
80
+ }, nt = {
81
81
  key: 2,
82
82
  class: "sileo-icon-circle bg-error"
83
- }, nt = {
83
+ }, it = {
84
84
  key: 3,
85
85
  class: "sileo-icon-circle bg-warning"
86
- }, it = {
86
+ }, at = {
87
87
  key: 4,
88
88
  class: "sileo-icon-circle bg-info"
89
- }, at = { class: "sileo-main-body" }, rt = { class: "sileo-body-content" }, lt = { class: "sileo-message" }, ct = {
89
+ }, rt = { class: "sileo-main-body" }, lt = { class: "sileo-body-content" }, ct = { class: "sileo-message" }, ut = {
90
90
  key: 0,
91
91
  class: "sileo-timer"
92
92
  }, dt = /* @__PURE__ */ I({
@@ -95,79 +95,54 @@ const E = A(), H = { class: "sileo-combined-shape" }, J = { class: "sileo-header
95
95
  toast: {}
96
96
  },
97
97
  emits: ["close"],
98
- setup(t, { emit: v }) {
99
- const f = t, g = v, e = x(null), o = x(!1), r = x(0), n = x(0), i = k(() => f.toast.icon), c = k(() => f.toast.duration === 0 && (f.toast.type === "default" || !f.toast.type)), m = k(() => {
100
- const u = f.toast.position || "top-right";
101
- return u.includes("center") ? "center" : u.includes("left") ? "left" : "right";
102
- }), P = k(() => {
103
- const u = n.value, a = Math.max(0, 1 - Math.abs(u) / 300), T = o.value ? 0.95 : 1, j = m.value === "center" ? "center" : m.value === "left" ? "flex-start" : "flex-end";
98
+ setup(t, { emit: y }) {
99
+ const d = t, v = y, e = k(null), o = k(!1), a = k(0), s = k(0), n = h(() => d.toast.icon), c = h(() => d.toast.duration === 0 && (d.toast.type === "default" || !d.toast.type)), g = h(() => {
100
+ const f = d.toast.position || "top-right";
101
+ return f.includes("center") ? "center" : f.includes("left") ? "left" : "right";
102
+ }), P = h(() => (d.toast.position || "top-right").includes("top")), j = h(() => {
103
+ const f = s.value, r = Math.max(0, 1 - Math.abs(f) / 300), C = o.value ? 0.95 : 1, N = g.value === "center" ? "center" : g.value === "left" ? "flex-start" : "flex-end";
104
104
  return {
105
- transform: `translateX(${u}px) scale(${T})`,
106
- opacity: a,
107
- transition: o.value ? "none" : "all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",
105
+ transform: `translateX(${f}px) scale(${C})`,
106
+ opacity: r,
107
+ transition: o.value ? "none" : "opacity 0.4s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1)",
108
108
  display: "flex",
109
109
  flexDirection: "column",
110
- alignItems: j,
110
+ alignItems: N,
111
111
  width: "100%",
112
112
  pointerEvents: "auto",
113
- marginBottom: "16px"
113
+ marginBottom: "16px",
114
+ "--sileo-y-dir": P.value ? "-50px" : "50px"
114
115
  };
115
- }), $ = (u) => {
116
- f.toast.swipeToDismiss && (o.value = !0, r.value = "touches" in u ? u.touches[0].clientX : u.clientX, "touches" in u ? (window.addEventListener("touchmove", p), window.addEventListener("touchend", w)) : (window.addEventListener("mousemove", p), window.addEventListener("mouseup", w)));
117
- }, p = (u) => {
116
+ }), B = (f) => {
117
+ d.toast.swipeToDismiss && (o.value = !0, a.value = "touches" in f ? f.touches[0].clientX : f.clientX, "touches" in f ? (window.addEventListener("touchmove", p), window.addEventListener("touchend", w)) : (window.addEventListener("mousemove", p), window.addEventListener("mouseup", w)));
118
+ }, p = (f) => {
118
119
  if (!o.value) return;
119
- const a = "touches" in u ? u.touches[0].clientX : u.clientX;
120
- n.value = (a - r.value) * 0.8;
120
+ const r = "touches" in f ? f.touches[0].clientX : f.clientX;
121
+ s.value = (r - a.value) * 0.8;
121
122
  }, w = () => {
122
- o.value && (o.value = !1, Math.abs(n.value) > 100 ? g("close") : n.value = 0, window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", w), window.removeEventListener("touchmove", p), window.removeEventListener("touchend", w));
123
+ o.value && (o.value = !1, Math.abs(s.value) > 100 ? v("close") : s.value = 0, window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", w), window.removeEventListener("touchmove", p), window.removeEventListener("touchend", w));
123
124
  };
124
- return N(() => {
125
+ return R(() => {
125
126
  window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", w), window.removeEventListener("touchmove", p), window.removeEventListener("touchend", w);
126
- }), (u, a) => (l(), d("div", {
127
+ }), (f, r) => (l(), u("div", {
127
128
  ref_key: "toastRef",
128
129
  ref: e,
129
- class: B(["sileo-toast-outer", [`sileo-type-${t.toast.type || "default"}`, `sileo-align-${m.value}`, { "sileo-is-dragging": o.value }]]),
130
- style: L(P.value),
131
- onMousedown: $,
132
- onTouchstart: $
130
+ class: $(["sileo-toast-outer", [`sileo-type-${t.toast.type || "default"}`, `sileo-align-${g.value}`, { "sileo-is-dragging": o.value }]]),
131
+ style: L(j.value),
132
+ onMousedown: B,
133
+ onTouchstart: B
133
134
  }, [
134
- s("div", H, [
135
- s("div", J, [
136
- m.value !== "left" ? (l(), d("div", K, [...a[2] || (a[2] = [
137
- s("svg", {
138
- width: "12",
139
- height: "12",
140
- viewBox: "0 0 12 12",
141
- fill: "none",
142
- xmlns: "http://www.w3.org/2000/svg"
143
- }, [
144
- s("path", {
145
- d: "M12 0 C 5.373 0 0 5.373 0 12 L 12 12 Z",
146
- fill: "#1c1c1e"
147
- })
148
- ], -1)
149
- ])])) : h("", !0),
150
- m.value !== "right" ? (l(), d("div", Q, [...a[3] || (a[3] = [
151
- s("svg", {
152
- width: "12",
153
- height: "12",
154
- viewBox: "0 0 12 12",
155
- fill: "none",
156
- xmlns: "http://www.w3.org/2000/svg"
157
- }, [
158
- s("path", {
159
- d: "M0 0 C 6.627 0 12 5.373 12 12 L 0 12 Z",
160
- fill: "#1c1c1e"
161
- })
162
- ], -1)
163
- ])])) : h("", !0),
164
- s("div", Y, [
165
- typeof t.toast.icon != "string" && t.toast.icon ? (l(), z(R(i.value), {
135
+ i("div", K, [
136
+ i("div", Q, [
137
+ g.value !== "left" ? (l(), u("div", Y)) : x("", !0),
138
+ g.value !== "right" ? (l(), u("div", Z)) : x("", !0),
139
+ i("div", _, [
140
+ typeof t.toast.icon != "string" && t.toast.icon ? (l(), z(V(n.value), {
166
141
  key: 0,
167
142
  class: "sileo-custom-icon"
168
- })) : typeof t.toast.icon == "string" ? (l(), d("span", _, b(t.toast.icon), 1)) : (l(), d("div", tt, [
169
- c.value ? (l(), d("svg", et, [...a[4] || (a[4] = [
170
- s("circle", {
143
+ })) : typeof t.toast.icon == "string" ? (l(), u("span", tt, b(t.toast.icon), 1)) : (l(), u("div", et, [
144
+ c.value ? (l(), u("svg", ot, [...r[2] || (r[2] = [
145
+ i("circle", {
171
146
  cx: "25",
172
147
  cy: "25",
173
148
  r: "20",
@@ -175,71 +150,71 @@ const E = A(), H = { class: "sileo-combined-shape" }, J = { class: "sileo-header
175
150
  stroke: "currentColor",
176
151
  "stroke-width": "5"
177
152
  }, null, -1)
178
- ])])) : t.toast.type === "success" ? (l(), d("div", ot, [...a[5] || (a[5] = [
179
- s("svg", {
153
+ ])])) : t.toast.type === "success" ? (l(), u("div", st, [...r[3] || (r[3] = [
154
+ i("svg", {
180
155
  viewBox: "0 0 24 24",
181
156
  fill: "none",
182
157
  class: "sileo-stroke-icon"
183
158
  }, [
184
- s("polyline", { points: "20 6 9 17 4 12" })
159
+ i("polyline", { points: "20 6 9 17 4 12" })
185
160
  ], -1)
186
- ])])) : t.toast.type === "error" ? (l(), d("div", st, [...a[6] || (a[6] = [
187
- s("svg", {
161
+ ])])) : t.toast.type === "error" ? (l(), u("div", nt, [...r[4] || (r[4] = [
162
+ i("svg", {
188
163
  viewBox: "0 0 24 24",
189
164
  fill: "none",
190
165
  class: "sileo-stroke-icon"
191
166
  }, [
192
- s("line", {
167
+ i("line", {
193
168
  x1: "18",
194
169
  y1: "6",
195
170
  x2: "6",
196
171
  y2: "18"
197
172
  }),
198
- s("line", {
173
+ i("line", {
199
174
  x1: "6",
200
175
  y1: "6",
201
176
  x2: "18",
202
177
  y2: "18"
203
178
  })
204
179
  ], -1)
205
- ])])) : t.toast.type === "warning" ? (l(), d("div", nt, [...a[7] || (a[7] = [
206
- s("svg", {
180
+ ])])) : t.toast.type === "warning" ? (l(), u("div", it, [...r[5] || (r[5] = [
181
+ i("svg", {
207
182
  viewBox: "0 0 24 24",
208
183
  fill: "none",
209
184
  class: "sileo-stroke-icon"
210
185
  }, [
211
- s("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
212
- s("line", {
186
+ i("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
187
+ i("line", {
213
188
  x1: "12",
214
189
  y1: "9",
215
190
  x2: "12",
216
191
  y2: "13"
217
192
  }),
218
- s("line", {
193
+ i("line", {
219
194
  x1: "12",
220
195
  y1: "17",
221
196
  x2: "12.01",
222
197
  y2: "17"
223
198
  })
224
199
  ], -1)
225
- ])])) : (l(), d("div", it, [...a[8] || (a[8] = [
226
- s("svg", {
200
+ ])])) : (l(), u("div", at, [...r[6] || (r[6] = [
201
+ i("svg", {
227
202
  viewBox: "0 0 24 24",
228
203
  fill: "none",
229
204
  class: "sileo-stroke-icon"
230
205
  }, [
231
- s("circle", {
206
+ i("circle", {
232
207
  cx: "12",
233
208
  cy: "12",
234
209
  r: "10"
235
210
  }),
236
- s("line", {
211
+ i("line", {
237
212
  x1: "12",
238
213
  y1: "16",
239
214
  x2: "12",
240
215
  y2: "12"
241
216
  }),
242
- s("line", {
217
+ i("line", {
243
218
  x1: "12",
244
219
  y1: "8",
245
220
  x2: "12.01",
@@ -249,96 +224,96 @@ const E = A(), H = { class: "sileo-combined-shape" }, J = { class: "sileo-header
249
224
  ])]))
250
225
  ]))
251
226
  ]),
252
- t.toast.title ? (l(), d("span", {
227
+ t.toast.title ? (l(), u("span", {
253
228
  key: 2,
254
- class: B(["sileo-title-text", `text-${t.toast.type || "default"}`])
255
- }, b(t.toast.title), 3)) : h("", !0),
256
- t.toast.closeOnClick ? (l(), d("button", {
229
+ class: $(["sileo-title-text", `text-${t.toast.type || "default"}`])
230
+ }, b(t.toast.title), 3)) : x("", !0),
231
+ t.toast.closeOnClick ? (l(), u("button", {
257
232
  key: 3,
258
233
  class: "sileo-close-btn",
259
- onClick: a[0] || (a[0] = O((T) => u.$emit("close"), ["stop"]))
260
- }, [...a[9] || (a[9] = [
261
- s("svg", {
234
+ onClick: r[0] || (r[0] = O((C) => f.$emit("close"), ["stop"]))
235
+ }, [...r[7] || (r[7] = [
236
+ i("svg", {
262
237
  viewBox: "0 0 24 24",
263
238
  fill: "none"
264
239
  }, [
265
- s("line", {
240
+ i("line", {
266
241
  x1: "18",
267
242
  y1: "6",
268
243
  x2: "6",
269
244
  y2: "18"
270
245
  }),
271
- s("line", {
246
+ i("line", {
272
247
  x1: "6",
273
248
  y1: "6",
274
249
  x2: "18",
275
250
  y2: "18"
276
251
  })
277
252
  ], -1)
278
- ])])) : h("", !0)
253
+ ])])) : x("", !0)
279
254
  ]),
280
- s("div", at, [
281
- s("div", rt, [
282
- s("p", lt, b(t.toast.message), 1),
283
- t.toast.action ? (l(), d("button", {
255
+ i("div", rt, [
256
+ i("div", lt, [
257
+ i("p", ct, b(t.toast.message), 1),
258
+ t.toast.action ? (l(), u("button", {
284
259
  key: 0,
285
260
  class: "sileo-action-trigger",
286
- onClick: a[1] || (a[1] = O((T) => t.toast.action.onClick(t.toast.id), ["stop"]))
287
- }, b(t.toast.action.label), 1)) : h("", !0)
261
+ onClick: r[1] || (r[1] = O((C) => t.toast.action.onClick(t.toast.id), ["stop"]))
262
+ }, b(t.toast.action.label), 1)) : x("", !0)
288
263
  ]),
289
- t.toast.duration > 0 && t.toast.showProgress ? (l(), d("div", ct, [
290
- s("div", {
264
+ t.toast.duration > 0 && t.toast.showProgress ? (l(), u("div", ut, [
265
+ i("div", {
291
266
  class: "sileo-timer-fill",
292
267
  style: L({ animationDuration: `${t.toast.duration}ms` })
293
268
  }, null, 4)
294
- ])) : h("", !0)
269
+ ])) : x("", !0)
295
270
  ])
296
271
  ])
297
272
  ], 38));
298
273
  }
299
- }), ut = { class: "sileo-root-wrapper" }, ft = /* @__PURE__ */ I({
274
+ }), ft = { class: "sileo-root-wrapper" }, yt = /* @__PURE__ */ I({
300
275
  __name: "ToastContainer",
301
276
  setup(t) {
302
- const { toasts: v, removeToast: f } = A(), g = [
277
+ const { toasts: y, removeToast: d } = A(), v = [
303
278
  "top-left",
304
279
  "top-center",
305
280
  "top-right",
306
281
  "bottom-left",
307
282
  "bottom-center",
308
283
  "bottom-right"
309
- ], e = (r) => v.filter((n) => n.position === r), o = (r) => {
310
- const n = r.startsWith("top"), i = r.endsWith("left"), c = r.endsWith("center");
284
+ ], e = (a) => y.filter((s) => s.position === a), o = (a) => {
285
+ const s = a.startsWith("top"), n = a.endsWith("left"), c = a.endsWith("center");
311
286
  return {
312
287
  position: "absolute",
313
- top: n ? "0" : "auto",
314
- bottom: n ? "auto" : "0",
315
- left: i ? "0" : c ? "50%" : "auto",
316
- right: !i && !c ? "0" : "auto",
288
+ top: s ? "0" : "auto",
289
+ bottom: s ? "auto" : "0",
290
+ left: n ? "0" : c ? "50%" : "auto",
291
+ right: !n && !c ? "0" : "auto",
317
292
  transform: c ? "translateX(-50%)" : "none",
318
293
  padding: "24px",
319
294
  display: "flex",
320
295
  pointerEvents: "none",
321
296
  boxSizing: "border-box",
322
- alignItems: i ? "flex-start" : c ? "center" : "flex-end",
323
- flexDirection: n ? "column" : "column-reverse"
297
+ alignItems: n ? "flex-start" : c ? "center" : "flex-end",
298
+ flexDirection: s ? "column" : "column-reverse"
324
299
  };
325
300
  };
326
- return (r, n) => (l(), d("div", ut, [
327
- (l(), d(M, null, S(g, (i) => s("div", {
328
- key: i,
329
- class: B(["sileo-position-container", [`sileo-pos-${i}`]]),
330
- style: L(o(i))
301
+ return (a, s) => (l(), u("div", ft, [
302
+ (l(), u(M, null, S(v, (n) => i("div", {
303
+ key: n,
304
+ class: $(["sileo-position-container", [`sileo-pos-${n}`]]),
305
+ style: L(o(n))
331
306
  }, [
332
- V(W, {
307
+ W(F, {
333
308
  name: "sileo-list",
334
309
  tag: "div",
335
310
  class: "sileo-stack"
336
311
  }, {
337
- default: Z(() => [
338
- (l(!0), d(M, null, S(e(i), (c) => (l(), z(dt, {
312
+ default: G(() => [
313
+ (l(!0), u(M, null, S(e(n), (c) => (l(), z(dt, {
339
314
  key: c.id,
340
315
  toast: c,
341
- onClose: (m) => F(f)(c.id)
316
+ onClose: (g) => U(d)(c.id)
342
317
  }, null, 8, ["toast", "onClose"]))), 128))
343
318
  ]),
344
319
  _: 2
@@ -346,22 +321,22 @@ const E = A(), H = { class: "sileo-combined-shape" }, J = { class: "sileo-header
346
321
  ], 6)), 64))
347
322
  ]));
348
323
  }
349
- }), gt = {
350
- install(t, v = {}) {
351
- if (Object.keys(v).length > 0 && E.toast.config(v), typeof document < "u") {
352
- const f = "sileo-toast-container";
353
- let g = document.getElementById(f);
354
- g || (g = document.createElement("div"), g.id = f, document.body.appendChild(g), G({
355
- render: () => U(ft)
356
- }).mount(g));
324
+ }), mt = {
325
+ install(t, y = {}) {
326
+ if (Object.keys(y).length > 0 && E.toast.config(y), typeof document < "u") {
327
+ const d = "sileo-toast-container";
328
+ let v = document.getElementById(d);
329
+ v || (v = document.createElement("div"), v.id = d, document.body.appendChild(v), q({
330
+ render: () => H(yt)
331
+ }).mount(v));
357
332
  }
358
333
  t.config.globalProperties.$toast = E.toast, t.provide("toast", E.toast);
359
334
  }
360
335
  };
361
336
  export {
362
- gt as SileoPlugin,
337
+ mt as SileoPlugin,
363
338
  dt as Toast,
364
- ft as ToastContainer,
339
+ yt as ToastContainer,
365
340
  E as toastManager,
366
341
  A as useToast
367
342
  };
@@ -1 +1 @@
1
- (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.SileoVue={},m.Vue))})(this,function(m,e){"use strict";const g=e.reactive([]),w=e.reactive({position:"top-right",duration:4e3,maxToasts:5}),b=()=>Math.random().toString(36).substring(2,9);function h(){const t=o=>{const n={type:"default",duration:w.duration||4e3,position:w.position||"top-right",showProgress:!0,closeOnClick:!0,swipeToDismiss:!0},a=typeof o=="string"?{message:o}:o;g.length>=(w.maxToasts||5)&&g.shift();const s=b(),i={...n,...a,id:s,createdAt:Date.now()};return i.icon&&typeof i.icon!="string"&&(i.icon=e.markRaw(i.icon)),g.push(i),i.duration>0&&setTimeout(()=>{f(s)},i.duration),s},f=o=>{const n=g.findIndex(a=>a.id===o);n!==-1&&g.splice(n,1)},d=(o,n)=>{const a=g.findIndex(s=>s.id===o);if(a!==-1){const s={...g[a],...n};typeof n.icon<"u"&&n.icon&&typeof n.icon!="string"&&(s.icon=e.markRaw(n.icon)),g[a]=s}},y=Object.assign(t,{success:o=>t(typeof o=="string"?{message:o,type:"success"}:{...o,type:"success"}),error:o=>t(typeof o=="string"?{message:o,type:"error"}:{...o,type:"error"}),warning:o=>t(typeof o=="string"?{message:o,type:"warning"}:{...o,type:"warning"}),info:o=>t(typeof o=="string"?{message:o,type:"info"}:{...o,type:"info"}),promise:async(o,n)=>{const a=t(typeof n.loading=="string"?{message:n.loading,type:"default",duration:0}:{...n.loading,type:"default",duration:0});try{const s=await o,i=typeof n.success=="function"?n.success(s):n.success,c=typeof i=="string"?{message:i,type:"success"}:{...i,type:"success"};return d(a,{...c,duration:c.duration||4e3}),setTimeout(()=>f(a),c.duration||4e3),s}catch(s){const i=typeof n.error=="function"?n.error(s):n.error,c=typeof i=="string"?{message:i,type:"error"}:{...i,type:"error"};throw d(a,{...c,duration:c.duration||4e3}),setTimeout(()=>f(a),c.duration||4e3),s}},clear:()=>g.length=0,config:o=>Object.assign(w,o)});return{toasts:g,toast:y,removeToast:f,updateToast:d}}const E=h(),C={class:"sileo-combined-shape"},T={class:"sileo-header-pill"},L={key:0,class:"sileo-sweep-left"},S={key:1,class:"sileo-sweep-right"},D={class:"sileo-icon-wrapper"},$={key:1,class:"sileo-emoji"},M={key:2,class:"sileo-default-icon"},O={key:0,class:"sileo-spin",viewBox:"0 0 50 50"},z={key:1,class:"sileo-icon-circle bg-success"},X={key:2,class:"sileo-icon-circle bg-error"},I={key:3,class:"sileo-icon-circle bg-warning"},P={key:4,class:"sileo-icon-circle bg-info"},j={class:"sileo-main-body"},A={class:"sileo-body-content"},R={class:"sileo-message"},W={key:0,class:"sileo-timer"},B=e.defineComponent({__name:"Toast",props:{toast:{}},emits:["close"],setup(t,{emit:f}){const d=t,y=f,o=e.ref(null),n=e.ref(!1),a=e.ref(0),s=e.ref(0),i=e.computed(()=>d.toast.icon),c=e.computed(()=>d.toast.duration===0&&(d.toast.type==="default"||!d.toast.type)),p=e.computed(()=>{const r=d.toast.position||"top-right";return r.includes("center")?"center":r.includes("left")?"left":"right"}),q=e.computed(()=>{const r=s.value,l=Math.max(0,1-Math.abs(r)/300),x=n.value?.95:1,G=p.value==="center"?"center":p.value==="left"?"flex-start":"flex-end";return{transform:`translateX(${r}px) scale(${x})`,opacity:l,transition:n.value?"none":"all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",display:"flex",flexDirection:"column",alignItems:G,width:"100%",pointerEvents:"auto",marginBottom:"16px"}}),N=r=>{d.toast.swipeToDismiss&&(n.value=!0,a.value="touches"in r?r.touches[0].clientX:r.clientX,"touches"in r?(window.addEventListener("touchmove",k),window.addEventListener("touchend",u)):(window.addEventListener("mousemove",k),window.addEventListener("mouseup",u)))},k=r=>{if(!n.value)return;const l="touches"in r?r.touches[0].clientX:r.clientX;s.value=(l-a.value)*.8},u=()=>{n.value&&(n.value=!1,Math.abs(s.value)>100?y("close"):s.value=0,window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",u),window.removeEventListener("touchmove",k),window.removeEventListener("touchend",u))};return e.onUnmounted(()=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",u),window.removeEventListener("touchmove",k),window.removeEventListener("touchend",u)}),(r,l)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"toastRef",ref:o,class:e.normalizeClass(["sileo-toast-outer",[`sileo-type-${t.toast.type||"default"}`,`sileo-align-${p.value}`,{"sileo-is-dragging":n.value}]]),style:e.normalizeStyle(q.value),onMousedown:N,onTouchstart:N},[e.createElementVNode("div",C,[e.createElementVNode("div",T,[p.value!=="left"?(e.openBlock(),e.createElementBlock("div",L,[...l[2]||(l[2]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M12 0 C 5.373 0 0 5.373 0 12 L 12 12 Z",fill:"#1c1c1e"})],-1)])])):e.createCommentVNode("",!0),p.value!=="right"?(e.openBlock(),e.createElementBlock("div",S,[...l[3]||(l[3]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M0 0 C 6.627 0 12 5.373 12 12 L 0 12 Z",fill:"#1c1c1e"})],-1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",D,[typeof t.toast.icon!="string"&&t.toast.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{key:0,class:"sileo-custom-icon"})):typeof t.toast.icon=="string"?(e.openBlock(),e.createElementBlock("span",$,e.toDisplayString(t.toast.icon),1)):(e.openBlock(),e.createElementBlock("div",M,[c.value?(e.openBlock(),e.createElementBlock("svg",O,[...l[4]||(l[4]=[e.createElementVNode("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor","stroke-width":"5"},null,-1)])])):t.toast.type==="success"?(e.openBlock(),e.createElementBlock("div",z,[...l[5]||(l[5]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)])])):t.toast.type==="error"?(e.openBlock(),e.createElementBlock("div",X,[...l[6]||(l[6]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):t.toast.type==="warning"?(e.openBlock(),e.createElementBlock("div",I,[...l[7]||(l[7]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})],-1)])])):(e.openBlock(),e.createElementBlock("div",P,[...l[8]||(l[8]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.createElementVNode("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})],-1)])]))]))]),t.toast.title?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(["sileo-title-text",`text-${t.toast.type||"default"}`])},e.toDisplayString(t.toast.title),3)):e.createCommentVNode("",!0),t.toast.closeOnClick?(e.openBlock(),e.createElementBlock("button",{key:3,class:"sileo-close-btn",onClick:l[0]||(l[0]=e.withModifiers(x=>r.$emit("close"),["stop"]))},[...l[9]||(l[9]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",j,[e.createElementVNode("div",A,[e.createElementVNode("p",R,e.toDisplayString(t.toast.message),1),t.toast.action?(e.openBlock(),e.createElementBlock("button",{key:0,class:"sileo-action-trigger",onClick:l[1]||(l[1]=e.withModifiers(x=>t.toast.action.onClick(t.toast.id),["stop"]))},e.toDisplayString(t.toast.action.label),1)):e.createCommentVNode("",!0)]),t.toast.duration>0&&t.toast.showProgress?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",{class:"sileo-timer-fill",style:e.normalizeStyle({animationDuration:`${t.toast.duration}ms`})},null,4)])):e.createCommentVNode("",!0)])])],38))}}),F={class:"sileo-root-wrapper"},V=e.defineComponent({__name:"ToastContainer",setup(t){const{toasts:f,removeToast:d}=h(),y=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],o=a=>f.filter(s=>s.position===a),n=a=>{const s=a.startsWith("top"),i=a.endsWith("left"),c=a.endsWith("center");return{position:"absolute",top:s?"0":"auto",bottom:s?"auto":"0",left:i?"0":c?"50%":"auto",right:!i&&!c?"0":"auto",transform:c?"translateX(-50%)":"none",padding:"24px",display:"flex",pointerEvents:"none",boxSizing:"border-box",alignItems:i?"flex-start":c?"center":"flex-end",flexDirection:s?"column":"column-reverse"}};return(a,s)=>(e.openBlock(),e.createElementBlock("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(y,i=>e.createElementVNode("div",{key:i,class:e.normalizeClass(["sileo-position-container",[`sileo-pos-${i}`]]),style:e.normalizeStyle(n(i))},[e.createVNode(e.TransitionGroup,{name:"sileo-list",tag:"div",class:"sileo-stack"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o(i),c=>(e.openBlock(),e.createBlock(B,{key:c.id,toast:c,onClose:p=>e.unref(d)(c.id)},null,8,["toast","onClose"]))),128))]),_:2},1024)],6)),64))]))}}),Z={install(t,f={}){if(Object.keys(f).length>0&&E.toast.config(f),typeof document<"u"){const d="sileo-toast-container";let y=document.getElementById(d);y||(y=document.createElement("div"),y.id=d,document.body.appendChild(y),e.createApp({render:()=>e.h(V)}).mount(y))}t.config.globalProperties.$toast=E.toast,t.provide("toast",E.toast)}};m.SileoPlugin=Z,m.Toast=B,m.ToastContainer=V,m.toastManager=E,m.useToast=h,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
1
+ (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.SileoVue={},m.Vue))})(this,function(m,e){"use strict";const p=e.reactive([]),E=e.reactive({position:"top-right",duration:4e3,maxToasts:5}),b=()=>Math.random().toString(36).substring(2,9);function w(){const t=o=>{const n={type:"default",duration:E.duration||4e3,position:E.position||"top-right",showProgress:!0,closeOnClick:!0,swipeToDismiss:!0},l=typeof o=="string"?{message:o}:o;p.length>=(E.maxToasts||5)&&p.shift();const s=b(),i={...n,...l,id:s,createdAt:Date.now()};return i.icon&&typeof i.icon!="string"&&(i.icon=e.markRaw(i.icon)),p.push(i),i.duration>0&&setTimeout(()=>{f(s)},i.duration),s},f=o=>{const n=p.findIndex(l=>l.id===o);n!==-1&&p.splice(n,1)},r=(o,n)=>{const l=p.findIndex(s=>s.id===o);if(l!==-1){const s={...p[l],...n};typeof n.icon<"u"&&n.icon&&typeof n.icon!="string"&&(s.icon=e.markRaw(n.icon)),p[l]=s}},y=Object.assign(t,{success:o=>t(typeof o=="string"?{message:o,type:"success"}:{...o,type:"success"}),error:o=>t(typeof o=="string"?{message:o,type:"error"}:{...o,type:"error"}),warning:o=>t(typeof o=="string"?{message:o,type:"warning"}:{...o,type:"warning"}),info:o=>t(typeof o=="string"?{message:o,type:"info"}:{...o,type:"info"}),promise:async(o,n)=>{const l=t(typeof n.loading=="string"?{message:n.loading,type:"default",duration:0}:{...n.loading,type:"default",duration:0});try{const s=await o,i=typeof n.success=="function"?n.success(s):n.success,a=typeof i=="string"?{message:i,type:"success"}:{...i,type:"success"};return r(l,{...a,duration:a.duration||4e3}),setTimeout(()=>f(l),a.duration||4e3),s}catch(s){const i=typeof n.error=="function"?n.error(s):n.error,a=typeof i=="string"?{message:i,type:"error"}:{...i,type:"error"};throw r(l,{...a,duration:a.duration||4e3}),setTimeout(()=>f(l),a.duration||4e3),s}},clear:()=>p.length=0,config:o=>Object.assign(E,o)});return{toasts:p,toast:y,removeToast:f,updateToast:r}}const h=w(),C={class:"sileo-combined-shape"},T={class:"sileo-header-pill"},L={key:0,class:"sileo-sweep-left"},S={key:1,class:"sileo-sweep-right"},D={class:"sileo-icon-wrapper"},$={key:1,class:"sileo-emoji"},O={key:2,class:"sileo-default-icon"},M={key:0,class:"sileo-spin",viewBox:"0 0 50 50"},z={key:1,class:"sileo-icon-circle bg-success"},X={key:2,class:"sileo-icon-circle bg-error"},I={key:3,class:"sileo-icon-circle bg-warning"},P={key:4,class:"sileo-icon-circle bg-info"},j={class:"sileo-main-body"},A={class:"sileo-body-content"},R={class:"sileo-message"},W={key:0,class:"sileo-timer"},B=e.defineComponent({__name:"Toast",props:{toast:{}},emits:["close"],setup(t,{emit:f}){const r=t,y=f,o=e.ref(null),n=e.ref(!1),l=e.ref(0),s=e.ref(0),i=e.computed(()=>r.toast.icon),a=e.computed(()=>r.toast.duration===0&&(r.toast.type==="default"||!r.toast.type)),g=e.computed(()=>{const d=r.toast.position||"top-right";return d.includes("center")?"center":d.includes("left")?"left":"right"}),G=e.computed(()=>(r.toast.position||"top-right").includes("top")),U=e.computed(()=>{const d=s.value,c=Math.max(0,1-Math.abs(d)/300),x=n.value?.95:1,H=g.value==="center"?"center":g.value==="left"?"flex-start":"flex-end";return{transform:`translateX(${d}px) scale(${x})`,opacity:c,transition:n.value?"none":"opacity 0.4s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1)",display:"flex",flexDirection:"column",alignItems:H,width:"100%",pointerEvents:"auto",marginBottom:"16px","--sileo-y-dir":G.value?"-50px":"50px"}}),N=d=>{r.toast.swipeToDismiss&&(n.value=!0,l.value="touches"in d?d.touches[0].clientX:d.clientX,"touches"in d?(window.addEventListener("touchmove",u),window.addEventListener("touchend",k)):(window.addEventListener("mousemove",u),window.addEventListener("mouseup",k)))},u=d=>{if(!n.value)return;const c="touches"in d?d.touches[0].clientX:d.clientX;s.value=(c-l.value)*.8},k=()=>{n.value&&(n.value=!1,Math.abs(s.value)>100?y("close"):s.value=0,window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",k),window.removeEventListener("touchmove",u),window.removeEventListener("touchend",k))};return e.onUnmounted(()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",k),window.removeEventListener("touchmove",u),window.removeEventListener("touchend",k)}),(d,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"toastRef",ref:o,class:e.normalizeClass(["sileo-toast-outer",[`sileo-type-${t.toast.type||"default"}`,`sileo-align-${g.value}`,{"sileo-is-dragging":n.value}]]),style:e.normalizeStyle(U.value),onMousedown:N,onTouchstart:N},[e.createElementVNode("div",C,[e.createElementVNode("div",T,[g.value!=="left"?(e.openBlock(),e.createElementBlock("div",L)):e.createCommentVNode("",!0),g.value!=="right"?(e.openBlock(),e.createElementBlock("div",S)):e.createCommentVNode("",!0),e.createElementVNode("div",D,[typeof t.toast.icon!="string"&&t.toast.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{key:0,class:"sileo-custom-icon"})):typeof t.toast.icon=="string"?(e.openBlock(),e.createElementBlock("span",$,e.toDisplayString(t.toast.icon),1)):(e.openBlock(),e.createElementBlock("div",O,[a.value?(e.openBlock(),e.createElementBlock("svg",M,[...c[2]||(c[2]=[e.createElementVNode("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor","stroke-width":"5"},null,-1)])])):t.toast.type==="success"?(e.openBlock(),e.createElementBlock("div",z,[...c[3]||(c[3]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)])])):t.toast.type==="error"?(e.openBlock(),e.createElementBlock("div",X,[...c[4]||(c[4]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):t.toast.type==="warning"?(e.openBlock(),e.createElementBlock("div",I,[...c[5]||(c[5]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})],-1)])])):(e.openBlock(),e.createElementBlock("div",P,[...c[6]||(c[6]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",class:"sileo-stroke-icon"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.createElementVNode("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})],-1)])]))]))]),t.toast.title?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(["sileo-title-text",`text-${t.toast.type||"default"}`])},e.toDisplayString(t.toast.title),3)):e.createCommentVNode("",!0),t.toast.closeOnClick?(e.openBlock(),e.createElementBlock("button",{key:3,class:"sileo-close-btn",onClick:c[0]||(c[0]=e.withModifiers(x=>d.$emit("close"),["stop"]))},[...c[7]||(c[7]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",j,[e.createElementVNode("div",A,[e.createElementVNode("p",R,e.toDisplayString(t.toast.message),1),t.toast.action?(e.openBlock(),e.createElementBlock("button",{key:0,class:"sileo-action-trigger",onClick:c[1]||(c[1]=e.withModifiers(x=>t.toast.action.onClick(t.toast.id),["stop"]))},e.toDisplayString(t.toast.action.label),1)):e.createCommentVNode("",!0)]),t.toast.duration>0&&t.toast.showProgress?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",{class:"sileo-timer-fill",style:e.normalizeStyle({animationDuration:`${t.toast.duration}ms`})},null,4)])):e.createCommentVNode("",!0)])])],38))}}),F={class:"sileo-root-wrapper"},V=e.defineComponent({__name:"ToastContainer",setup(t){const{toasts:f,removeToast:r}=w(),y=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],o=l=>f.filter(s=>s.position===l),n=l=>{const s=l.startsWith("top"),i=l.endsWith("left"),a=l.endsWith("center");return{position:"absolute",top:s?"0":"auto",bottom:s?"auto":"0",left:i?"0":a?"50%":"auto",right:!i&&!a?"0":"auto",transform:a?"translateX(-50%)":"none",padding:"24px",display:"flex",pointerEvents:"none",boxSizing:"border-box",alignItems:i?"flex-start":a?"center":"flex-end",flexDirection:s?"column":"column-reverse"}};return(l,s)=>(e.openBlock(),e.createElementBlock("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(y,i=>e.createElementVNode("div",{key:i,class:e.normalizeClass(["sileo-position-container",[`sileo-pos-${i}`]]),style:e.normalizeStyle(n(i))},[e.createVNode(e.TransitionGroup,{name:"sileo-list",tag:"div",class:"sileo-stack"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o(i),a=>(e.openBlock(),e.createBlock(B,{key:a.id,toast:a,onClose:g=>e.unref(r)(a.id)},null,8,["toast","onClose"]))),128))]),_:2},1024)],6)),64))]))}}),q={install(t,f={}){if(Object.keys(f).length>0&&h.toast.config(f),typeof document<"u"){const r="sileo-toast-container";let y=document.getElementById(r);y||(y=document.createElement("div"),y.id=r,document.body.appendChild(y),e.createApp({render:()=>e.h(V)}).mount(y))}t.config.globalProperties.$toast=h.toast,t.provide("toast",h.toast)}};m.SileoPlugin=q,m.Toast=B,m.ToastContainer=V,m.toastManager=h,m.useToast=w,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .sileo-toast-outer{position:relative!important;width:380px!important;max-width:90vw!important;-webkit-user-select:none!important;user-select:none!important;z-index:10000!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif!important;box-sizing:border-box!important}.sileo-combined-shape{display:flex!important;flex-direction:column!important;width:100%!important;filter:drop-shadow(0 0 1px rgba(255,255,255,.15)) drop-shadow(0 15px 35px rgba(0,0,0,.4))!important}.sileo-header-pill{display:flex!important;align-items:center!important;gap:8px!important;background:#1c1c1e!important;padding:6px 14px 6px 12px!important;height:36px!important;border-radius:18px 18px 0 0!important;color:#fff!important;box-sizing:border-box!important;width:fit-content!important;position:relative!important;z-index:2!important;margin-bottom:-1px!important}.sileo-align-center .sileo-header-pill{align-self:center!important}.sileo-align-left .sileo-header-pill{align-self:flex-start!important;border-bottom-left-radius:0!important;margin-left:20px!important}.sileo-align-right .sileo-header-pill{align-self:flex-end!important;border-bottom-right-radius:0!important;margin-right:20px!important}.sileo-sweep-left{position:absolute!important;bottom:0!important;left:-12px!important;width:12px!important;height:12px!important;z-index:2!important;pointer-events:none!important}.sileo-sweep-right{position:absolute!important;bottom:0!important;right:-12px!important;width:12px!important;height:12px!important;z-index:2!important;pointer-events:none!important}.sileo-sweep-left svg,.sileo-sweep-right svg{display:block!important;width:100%!important;height:100%!important}.sileo-icon-wrapper{width:22px!important;height:22px!important;display:flex!important;align-items:center!important;justify-content:center!important;flex-shrink:0!important}.sileo-custom-icon{width:18px!important;height:18px!important;display:block!important}.sileo-emoji{font-size:16px!important;line-height:1!important}.sileo-default-icon{width:22px!important;height:22px!important;display:flex!important;align-items:center!important;justify-content:center!important}.sileo-icon-circle{width:22px!important;height:22px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important}.bg-success{background:#32d74b33!important;color:#32d74b!important}.bg-error{background:#ff453a33!important;color:#ff453a!important}.bg-warning{background:#ffd60a33!important;color:#ffd60a!important}.bg-info{background:#0a84ff33!important;color:#0a84ff!important}.sileo-stroke-icon{width:14px!important;height:14px!important;stroke:currentColor!important;stroke-width:3!important}.sileo-title-text{font-size:14px!important;font-weight:700!important;line-height:1!important;white-space:nowrap!important}.text-success{color:#32d74b!important}.text-error{color:#ff453a!important}.text-warning{color:#ffd60a!important}.text-info{color:#0a84ff!important}.text-default{color:#fffffff2!important}.sileo-close-btn{background:none!important;border:none!important;padding:2px!important;cursor:pointer!important;color:#fff6!important;display:flex!important;align-items:center!important}.sileo-close-btn svg{width:14px!important;height:14px!important;stroke:currentColor!important;stroke-width:3!important}.sileo-main-body{background:#1c1c1e!important;padding:16px 20px!important;border-radius:24px!important;width:100%!important;box-sizing:border-box!important;position:relative!important;z-index:1!important}.sileo-align-left .sileo-main-body{border-top-left-radius:0!important}.sileo-align-right .sileo-main-body{border-top-right-radius:0!important}.sileo-body-content{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:16px!important}.sileo-message{margin:0!important;font-size:15px!important;line-height:1.45!important;color:#ffffffe6!important;font-weight:500!important}.sileo-action-trigger{background:#fff!important;color:#000!important;border:none!important;border-radius:12px!important;padding:8px 16px!important;font-size:13px!important;font-weight:700!important;cursor:pointer!important;white-space:nowrap!important;flex-shrink:0!important}.sileo-action-trigger:hover{transform:scale(1.04)!important}.sileo-timer{position:absolute!important;bottom:6px!important;left:24px!important;right:24px!important;height:3px!important;background:#ffffff0d!important;border-radius:10px!important;overflow:hidden!important}.sileo-timer-fill{height:100%!important;background:currentColor!important;width:100%!important;animation:sileo-anim-timer linear forwards!important}@keyframes sileo-anim-timer{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes sileo-spin{to{transform:rotate(360deg)}}.sileo-spin{animation:sileo-spin 1.5s linear infinite!important;width:20px!important;height:20px!important}.sileo-spin circle{stroke:currentColor!important;stroke-linecap:round!important;animation:sileo-dash-pulse 1.5s ease-in-out infinite!important}@keyframes sileo-dash-pulse{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.sileo-list-enter-active,.sileo-list-leave-active{transition:all .5s cubic-bezier(.19,1,.22,1)!important}.sileo-list-enter-from{opacity:0!important;transform:translateY(-20px) scale(.9)!important}.sileo-list-leave-to{opacity:0!important;transform:scale(.9)!important}.sileo-root-wrapper{pointer-events:none!important;position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:999999!important;overflow:hidden!important}.sileo-stack{display:flex!important;flex-direction:column!important;gap:12px!important}.sileo-list-move{transition:transform .4s ease!important}
1
+ .sileo-toast-outer{position:relative!important;width:400px!important;max-width:90vw!important;-webkit-user-select:none!important;user-select:none!important;z-index:10000!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif!important;box-sizing:border-box!important}.sileo-combined-shape{display:flex!important;flex-direction:column!important;width:100%!important;filter:drop-shadow(0 0 1px rgba(255,255,255,.15)) drop-shadow(0 15px 35px rgba(0,0,0,.4))!important}.sileo-header-pill{display:flex!important;align-items:center!important;gap:8px!important;background:#1c1c1e!important;padding:8px 16px 8px 14px!important;height:40px!important;border-radius:24px 24px 0 0!important;color:#fff!important;box-sizing:border-box!important;width:fit-content!important;position:relative!important;z-index:2!important;margin-bottom:-1px!important}.sileo-align-center .sileo-header-pill{align-self:center!important}.sileo-align-left .sileo-header-pill{align-self:flex-start!important;border-bottom-left-radius:0!important;margin-left:0!important}.sileo-align-right .sileo-header-pill{align-self:flex-end!important;border-bottom-right-radius:0!important;margin-right:0!important}.sileo-sweep-left,.sileo-sweep-right{position:absolute!important;bottom:0!important;width:24px!important;height:24px!important;z-index:-1!important;background:#1c1c1e!important;pointer-events:none!important}.sileo-sweep-left{left:-24px!important;clip-path:path("M24 0 C24 13.255 13.255 24 0 24 L24 24 Z")!important}.sileo-sweep-right{right:-24px!important;clip-path:path("M0 0 C0 13.255 10.745 24 24 24 L0 24 Z")!important}.sileo-icon-wrapper{width:22px!important;height:22px!important;display:flex!important;align-items:center!important;justify-content:center!important;flex-shrink:0!important}.sileo-custom-icon{width:18px!important;height:18px!important;display:block!important}.sileo-emoji{font-size:16px!important;line-height:1!important}.sileo-default-icon{width:22px!important;height:22px!important;display:flex!important;align-items:center!important;justify-content:center!important}.sileo-icon-circle{width:22px!important;height:22px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;background:#ffffff14!important}.bg-success{background:#32d74b26!important;color:#32d74b!important}.bg-error{background:#ff453a26!important;color:#ff453a!important}.bg-warning{background:#ffd60a26!important;color:#ffd60a!important}.bg-info{background:#0a84ff26!important;color:#0a84ff!important}.sileo-stroke-icon{width:13px!important;height:13px!important;stroke:currentColor!important;stroke-width:3!important}.sileo-title-text{font-size:14.5px!important;font-weight:600!important;line-height:1!important;white-space:nowrap!important;letter-spacing:.2px!important}.text-success{color:#32d74b!important}.text-error{color:#ff453a!important}.text-warning{color:#ffd60a!important}.text-info{color:#0a84ff!important}.text-default{color:#fffffff2!important}.sileo-close-btn{background:none!important;border:none!important;padding:2px!important;cursor:pointer!important;color:#ffffff4d!important;display:flex!important;align-items:center!important;margin-left:2px!important}.sileo-close-btn svg{width:14px!important;height:14px!important;stroke:currentColor!important;stroke-width:2.5!important}.sileo-close-btn:hover{color:#ffffffb3!important}.sileo-main-body{background:#1c1c1e!important;padding:18px 24px!important;border-radius:28px!important;width:100%!important;box-sizing:border-box!important;position:relative!important;z-index:1!important}.sileo-align-left .sileo-main-body{border-top-left-radius:0!important}.sileo-align-right .sileo-main-body{border-top-right-radius:0!important}.sileo-body-content{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:16px!important}.sileo-message{margin:0!important;font-size:15.5px!important;line-height:1.5!important;color:#ffffffa6!important;font-weight:400!important;letter-spacing:.1px!important}.sileo-action-trigger{background:#fff!important;color:#000!important;border:none!important;border-radius:14px!important;padding:10px 18px!important;font-size:13.5px!important;font-weight:600!important;cursor:pointer!important;white-space:nowrap!important;flex-shrink:0!important}.sileo-action-trigger:hover{transform:scale(1.03)!important}.sileo-timer{position:absolute!important;bottom:8px!important;left:24px!important;right:24px!important;height:3px!important;background:#ffffff0d!important;border-radius:10px!important;overflow:hidden!important}.sileo-timer-fill{height:100%!important;background:currentColor!important;width:100%!important;animation:sileo-anim-timer linear forwards!important;opacity:.5!important}@keyframes sileo-anim-timer{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes sileo-spin{to{transform:rotate(360deg)}}.sileo-spin{animation:sileo-spin 1.5s linear infinite!important;width:20px!important;height:20px!important}.sileo-spin circle{stroke:currentColor!important;stroke-linecap:round!important;animation:sileo-dash-pulse 1.5s ease-in-out infinite!important}@keyframes sileo-dash-pulse{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.sileo-list-enter-active{transition:opacity .5s ease,transform .6s cubic-bezier(.34,1.56,.64,1)!important}.sileo-list-leave-active{transition:opacity .3s ease,transform .5s cubic-bezier(.4,0,1,1)!important}.sileo-list-enter-from{opacity:0!important;transform:translateY(var(--sileo-y-dir, -50px)) scale(.85)!important}.sileo-list-leave-to{opacity:0!important;transform:scale(.85)!important}.sileo-root-wrapper{pointer-events:none!important;position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:999999!important;overflow:hidden!important}.sileo-stack{display:flex!important;flex-direction:column!important;gap:12px!important}.sileo-list-move{transition:transform .5s cubic-bezier(.34,1.56,.64,1)!important}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgar208/sileo-vue",
3
- "version": "1.2.2",
3
+ "version": "1.4.0",
4
4
  "description": "A production-ready Vue 3 toast notification library inspired by Sileo.",
5
5
  "type": "module",
6
6
  "main": "./dist/sileo-vue.umd.cjs",