@edgar208/sileo-vue 1.1.0 → 1.2.0

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