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