@edgar208/sileo-vue 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sileo-vue.js CHANGED
@@ -1,173 +1,148 @@
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 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
6
  }), J = () => Math.random().toString(36).substring(2, 9);
7
- function j() {
8
- const e = (t) => {
7
+ function A() {
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
- }, i = typeof t == "string" ? { message: t } : t;
17
- p.length >= (C.maxToasts || 5) && p.shift();
18
- const n = J(), s = {
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
- ...i,
21
- id: n,
20
+ ...a,
21
+ id: s,
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 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
- }, 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
+ }, v = 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 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 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;
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;
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: () => p.length = 0,
52
- config: (t) => Object.assign(C, t)
51
+ clear: () => m.length = 0,
52
+ config: (e) => Object.assign(T, e)
53
53
  });
54
54
  return {
55
- toasts: p,
56
- toast: m,
57
- removeToast: f,
58
- updateToast: y
55
+ toasts: m,
56
+ toast: v,
57
+ removeToast: y,
58
+ updateToast: d
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 = {
65
- key: 1,
66
- style: { "font-size": "16px", "line-height": "1" }
61
+ const E = A(), K = { class: "sileo-combined-shape" }, Q = { class: "sileo-header-pill" }, Y = {
62
+ key: 0,
63
+ class: "sileo-sweep-left"
67
64
  }, Z = {
65
+ key: 1,
66
+ class: "sileo-sweep-right"
67
+ }, _ = { class: "sileo-icon-wrapper" }, tt = {
68
+ key: 1,
69
+ class: "sileo-emoji"
70
+ }, et = {
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
+ }, ot = {
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
+ }, st = {
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
+ }, nt = {
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 = {
82
+ class: "sileo-icon-circle bg-error"
83
+ }, it = {
90
84
  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" }
96
- }, nt = {
85
+ class: "sileo-icon-circle bg-warning"
86
+ }, at = {
97
87
  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"
106
- }, 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 = {
88
+ class: "sileo-icon-circle bg-info"
89
+ }, rt = { class: "sileo-main-body" }, lt = { class: "sileo-body-content" }, ct = { class: "sileo-message" }, ut = {
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";
124
- 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";
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";
127
104
  return {
128
- transform: `translateX(${u}px) scale(${E})`,
105
+ transform: `translateX(${f}px) scale(${C})`,
129
106
  opacity: r,
130
- transition: o.value ? "none" : "all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",
107
+ transition: o.value ? "none" : "opacity 0.4s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1)",
131
108
  display: "flex",
132
109
  flexDirection: "column",
133
110
  alignItems: N,
134
111
  width: "100%",
135
112
  pointerEvents: "auto",
136
- marginBottom: "16px"
113
+ marginBottom: "16px",
114
+ "--sileo-y-dir": P.value ? "-50px" : "50px"
137
115
  };
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) => {
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) => {
143
119
  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));
120
+ const r = "touches" in f ? f.touches[0].clientX : f.clientX;
121
+ s.value = (r - a.value) * 0.8;
122
+ }, 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));
148
124
  };
149
125
  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", {
126
+ window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", w), window.removeEventListener("touchmove", p), window.removeEventListener("touchend", w);
127
+ }), (f, r) => (l(), u("div", {
152
128
  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),
156
- onMousedown: $,
157
- onTouchstart: $
129
+ ref: e,
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
158
134
  }, [
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), {
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
- 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", {
142
+ class: "sileo-custom-icon"
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,129 +150,159 @@ const L = j(), K = { class: "sileo-combined-shape" }, Q = {
175
150
  stroke: "currentColor",
176
151
  "stroke-width": "5"
177
152
  }, 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)
153
+ ])])) : t.toast.type === "success" ? (l(), u("div", st, [...r[3] || (r[3] = [
154
+ i("svg", {
155
+ viewBox: "0 0 24 24",
156
+ fill: "none",
157
+ class: "sileo-stroke-icon"
158
+ }, [
159
+ i("polyline", { points: "20 6 9 17 4 12" })
160
+ ], -1)
161
+ ])])) : t.toast.type === "error" ? (l(), u("div", nt, [...r[4] || (r[4] = [
162
+ i("svg", {
163
+ viewBox: "0 0 24 24",
164
+ fill: "none",
165
+ class: "sileo-stroke-icon"
166
+ }, [
167
+ i("line", {
168
+ x1: "18",
169
+ y1: "6",
170
+ x2: "6",
171
+ y2: "18"
172
+ }),
173
+ i("line", {
174
+ x1: "6",
175
+ y1: "6",
176
+ x2: "18",
177
+ y2: "18"
178
+ })
179
+ ], -1)
180
+ ])])) : t.toast.type === "warning" ? (l(), u("div", it, [...r[5] || (r[5] = [
181
+ i("svg", {
182
+ viewBox: "0 0 24 24",
183
+ fill: "none",
184
+ class: "sileo-stroke-icon"
185
+ }, [
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", {
188
+ x1: "12",
189
+ y1: "9",
190
+ x2: "12",
191
+ y2: "13"
192
+ }),
193
+ i("line", {
194
+ x1: "12",
195
+ y1: "17",
196
+ x2: "12.01",
197
+ y2: "17"
198
+ })
199
+ ], -1)
200
+ ])])) : (l(), u("div", at, [...r[6] || (r[6] = [
201
+ i("svg", {
202
+ viewBox: "0 0 24 24",
203
+ fill: "none",
204
+ class: "sileo-stroke-icon"
205
+ }, [
206
+ i("circle", {
207
+ cx: "12",
208
+ cy: "12",
209
+ r: "10"
210
+ }),
211
+ i("line", {
212
+ x1: "12",
213
+ y1: "16",
214
+ x2: "12",
215
+ y2: "12"
216
+ }),
217
+ i("line", {
218
+ x1: "12",
219
+ y1: "8",
220
+ x2: "12.01",
221
+ y2: "8"
222
+ })
223
+ ], -1)
225
224
  ])]))
226
225
  ]))
227
226
  ]),
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,
227
+ t.toast.title ? (l(), u("span", {
228
+ key: 2,
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", {
232
+ key: 3,
231
233
  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", {
234
+ onClick: r[0] || (r[0] = O((C) => f.$emit("close"), ["stop"]))
235
+ }, [...r[7] || (r[7] = [
236
+ i("svg", {
237
+ viewBox: "0 0 24 24",
238
+ fill: "none"
239
+ }, [
240
+ i("line", {
236
241
  x1: "18",
237
242
  y1: "6",
238
243
  x2: "6",
239
244
  y2: "18"
240
- }, null, -1),
241
- l("line", {
245
+ }),
246
+ i("line", {
242
247
  x1: "6",
243
248
  y1: "6",
244
249
  x2: "18",
245
250
  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", {
251
+ })
252
+ ], -1)
253
+ ])])) : x("", !0)
254
+ ]),
255
+ i("div", rt, [
256
+ i("div", lt, [
257
+ i("p", ct, b(t.toast.message), 1),
258
+ t.toast.action ? (l(), u("button", {
254
259
  key: 0,
255
260
  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)
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)
258
263
  ]),
259
- e.toast.duration > 0 && e.toast.showProgress ? (c(), d("div", ct, [
260
- l("div", {
264
+ t.toast.duration > 0 && t.toast.showProgress ? (l(), u("div", ut, [
265
+ i("div", {
261
266
  class: "sileo-timer-fill",
262
- style: T({ animationDuration: `${e.toast.duration}ms` })
267
+ style: L({ animationDuration: `${t.toast.duration}ms` })
263
268
  }, null, 4)
264
- ])) : b("", !0)
269
+ ])) : x("", !0)
265
270
  ])
266
271
  ])
267
272
  ], 38));
268
273
  }
269
- }), dt = { class: "sileo-root-wrapper" }, yt = /* @__PURE__ */ X({
274
+ }), ft = { class: "sileo-root-wrapper" }, yt = /* @__PURE__ */ I({
270
275
  __name: "ToastContainer",
271
- setup(e) {
272
- const { toasts: f, removeToast: y } = j(), m = [
276
+ setup(t) {
277
+ const { toasts: y, removeToast: d } = A(), v = [
273
278
  "top-left",
274
279
  "top-center",
275
280
  "top-right",
276
281
  "bottom-left",
277
282
  "bottom-center",
278
283
  "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");
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");
281
286
  return {
282
287
  position: "absolute",
283
- top: n ? "0" : "auto",
284
- bottom: n ? "auto" : "0",
285
- left: s ? "0" : a ? "50%" : "auto",
286
- right: !s && !a ? "0" : "auto",
287
- transform: a ? "translateX(-50%)" : "none",
288
+ top: s ? "0" : "auto",
289
+ bottom: s ? "auto" : "0",
290
+ left: n ? "0" : c ? "50%" : "auto",
291
+ right: !n && !c ? "0" : "auto",
292
+ transform: c ? "translateX(-50%)" : "none",
288
293
  padding: "24px",
289
294
  display: "flex",
290
295
  pointerEvents: "none",
291
296
  boxSizing: "border-box",
292
- alignItems: s ? "flex-start" : a ? "center" : "flex-end",
293
- flexDirection: n ? "column" : "column-reverse"
297
+ alignItems: n ? "flex-start" : c ? "center" : "flex-end",
298
+ flexDirection: s ? "column" : "column-reverse"
294
299
  };
295
300
  };
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))
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))
301
306
  }, [
302
307
  W(F, {
303
308
  name: "sileo-list",
@@ -305,10 +310,10 @@ const L = j(), K = { class: "sileo-combined-shape" }, Q = {
305
310
  class: "sileo-stack"
306
311
  }, {
307
312
  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)
313
+ (l(!0), u(M, null, S(e(n), (c) => (l(), z(dt, {
314
+ key: c.id,
315
+ toast: c,
316
+ onClose: (g) => U(d)(c.id)
312
317
  }, null, 8, ["toast", "onClose"]))), 128))
313
318
  ]),
314
319
  _: 2
@@ -317,21 +322,21 @@ const L = j(), K = { class: "sileo-combined-shape" }, Q = {
317
322
  ]));
318
323
  }
319
324
  }), 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
+ 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({
325
330
  render: () => H(yt)
326
- }).mount(m));
331
+ }).mount(v));
327
332
  }
328
- e.config.globalProperties.$toast = L.toast, e.provide("toast", L.toast);
333
+ t.config.globalProperties.$toast = E.toast, t.provide("toast", E.toast);
329
334
  }
330
335
  };
331
336
  export {
332
337
  mt as SileoPlugin,
333
- ut as Toast,
338
+ dt as Toast,
334
339
  yt as ToastContainer,
335
- L as toastManager,
336
- j as useToast
340
+ E as toastManager,
341
+ A as useToast
337
342
  };
@@ -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 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: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: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:20px 20px 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:24px!important}.sileo-align-right .sileo-header-pill{align-self:flex-end!important;border-bottom-right-radius:0!important;margin-right:24px!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.1",
3
+ "version": "1.3.1",
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",