@edgar208/sileo-vue 1.2.1 → 1.2.2

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