@vuesimple/vs-toast 1.4.18 → 3.0.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/README.md CHANGED
@@ -29,10 +29,6 @@ Code Sandbox: [Link](https://codesandbox.io/s/vs-toast-hti14)
29
29
  npm i @vuesimple/vs-toast
30
30
  ```
31
31
 
32
- ```bash
33
- yarn add @vuesimple/vs-toast
34
- ```
35
-
36
32
  <br />
37
33
 
38
34
  ### 🚀 Usage
@@ -63,6 +59,11 @@ yarn add @vuesimple/vs-toast
63
59
  <script src="https://unpkg.com/@vuesimple/vs-toast@<version>/dist/vs-toast.min.js"></script>
64
60
  ```
65
61
 
62
+ ```javascript
63
+ // Main/Entry file
64
+ app.use(VsToast);
65
+ ```
66
+
66
67
  ```html
67
68
  <script>
68
69
  export default {
@@ -0,0 +1,33 @@
1
+ import vue from '@vitejs/plugin-vue';
2
+ import VitePluginStyleInject from 'vite-plugin-style-inject';
3
+
4
+ export default {
5
+ plugins: [vue(), VitePluginStyleInject()],
6
+ build: {
7
+ // separate css file or not
8
+ cssCodeSplit: false,
9
+ lib: {
10
+ entry: './src/index.js',
11
+ formats: ['es', 'umd', 'iife'],
12
+ name: 'VsToast',
13
+ fileName: format => {
14
+ if (format === 'es') {
15
+ return 'index.js';
16
+ }
17
+ if (format === 'umd') {
18
+ return 'index.umd.js';
19
+ }
20
+ return 'index.min.js';
21
+ },
22
+ },
23
+ rollupOptions: {
24
+ // Not to bundle vue core in this plugin
25
+ external: ['vue'],
26
+ output: {
27
+ globals: {
28
+ vue: 'Vue',
29
+ },
30
+ },
31
+ },
32
+ },
33
+ };
package/dist/index.js ADDED
@@ -0,0 +1,389 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}.vs-toast{position:fixed;width:350px;max-width:350px;background-color:#fff;z-index:9999;font-family:inherit;text-align:left}.vs-toast .vs-alert{padding:15px 40px}.vs-toast .vs-alert .vs-alert-button{top:10px}.vs-toast--top-center{left:calc(50% - 175px);top:5px}.vs-toast--top-left{left:5px;top:5px}.vs-toast--top-right{right:5px;top:5px}.vs-toast--bottom-center{left:calc(50% - 175px);bottom:5px}.vs-toast--bottom-left{left:5px;bottom:5px}.vs-toast--bottom-right{right:5px;bottom:5px}.vs-toast--transition-slide-down-enter-active,.vs-toast--transition-slide-down-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:0;transform:translateY(-30px)}.vs-toast--transition-slide-up-enter-active,.vs-toast--transition-slide-up-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:0;transform:translateY(30px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { openBlock as i, createElementBlock as r, normalizeClass as h, createElementVNode as s, renderSlot as c, createCommentVNode as a, Fragment as C, createTextVNode as m, toDisplayString as p, resolveComponent as x, createBlock as b, Transition as B, withCtx as _, createVNode as T, createApp as O, h as S } from "vue";
2
+ const g = (t, e) => {
3
+ const o = t.__vccOpts || t;
4
+ for (const [l, u] of e)
5
+ o[l] = u;
6
+ return o;
7
+ }, M = {
8
+ name: "VsAlert",
9
+ props: {
10
+ variant: {
11
+ type: String,
12
+ required: !0,
13
+ validator: (t) => ["success", "error", "info", "warning", "secondary"].includes(t.toLowerCase())
14
+ },
15
+ showClose: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ title: {
20
+ type: String
21
+ },
22
+ noBg: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ small: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ toast: {
31
+ type: Boolean,
32
+ default: !1
33
+ }
34
+ },
35
+ computed: {
36
+ classList() {
37
+ return [
38
+ `vs-alert-${this.variant}`,
39
+ { "vs-alert--no-bg": this.noBg },
40
+ { "vs-alert--small": this.small },
41
+ { "vs-alert--toast": this.toast },
42
+ { "vs-alert--is-close": this.showClose }
43
+ ];
44
+ }
45
+ }
46
+ }, L = { class: "vs-alert-icon__wrapper" }, V = {
47
+ key: 0,
48
+ xmlns: "http://www.w3.org/2000/svg",
49
+ width: "16",
50
+ height: "16",
51
+ viewBox: "0 0 16 16",
52
+ role: "presentation",
53
+ focussable: "false"
54
+ }, $ = /* @__PURE__ */ s("g", {
55
+ fill: "none",
56
+ stroke: "var(--vs-alert-success-icon)"
57
+ }, [
58
+ /* @__PURE__ */ s("path", {
59
+ "stroke-linecap": "round",
60
+ "stroke-linejoin": "round",
61
+ d: "M4 9l2.5 2.5 5-5"
62
+ }),
63
+ /* @__PURE__ */ s("circle", {
64
+ cx: "7.5",
65
+ cy: "8.5",
66
+ r: "7"
67
+ })
68
+ ], -1), E = [
69
+ $
70
+ ], A = {
71
+ key: 1,
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ width: "16",
74
+ height: "16",
75
+ viewBox: "0 0 16 16",
76
+ role: "presentation",
77
+ focussable: "false"
78
+ }, H = /* @__PURE__ */ s("path", {
79
+ fill: "none",
80
+ stroke: "var(--vs-alert-warning-icon)",
81
+ "stroke-linecap": "round",
82
+ d: "M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"
83
+ }, null, -1), I = /* @__PURE__ */ s("circle", {
84
+ cx: "7.5",
85
+ cy: "12",
86
+ r: "1",
87
+ fill: "#ad5918"
88
+ }, null, -1), N = [
89
+ H,
90
+ I
91
+ ], j = {
92
+ key: 2,
93
+ xmlns: "http://www.w3.org/2000/svg",
94
+ width: "16",
95
+ height: "16",
96
+ viewBox: "0 0 16 16",
97
+ role: "presentation",
98
+ focussable: "false"
99
+ }, z = /* @__PURE__ */ s("g", {
100
+ fill: "none",
101
+ stroke: "var(--vs-alert-error-icon)"
102
+ }, [
103
+ /* @__PURE__ */ s("circle", {
104
+ cx: "7.5",
105
+ cy: "8.5",
106
+ r: "7"
107
+ }),
108
+ /* @__PURE__ */ s("path", {
109
+ "stroke-linecap": "round",
110
+ d: "M7.5 4.5V9"
111
+ })
112
+ ], -1), q = /* @__PURE__ */ s("circle", {
113
+ cx: "7.5",
114
+ cy: "12",
115
+ r: "1",
116
+ fill: "var(--vs-alert-error-icon)"
117
+ }, null, -1), D = [
118
+ z,
119
+ q
120
+ ], F = {
121
+ key: 3,
122
+ xmlns: "http://www.w3.org/2000/svg",
123
+ width: "16",
124
+ height: "16",
125
+ viewBox: "0 0 16 16",
126
+ role: "presentation",
127
+ focussable: "false"
128
+ }, P = /* @__PURE__ */ s("g", { stroke: "var(--vs-alert-info-icon)" }, [
129
+ /* @__PURE__ */ s("circle", {
130
+ cx: "7.5",
131
+ cy: "8.5",
132
+ r: "7",
133
+ fill: "none"
134
+ }),
135
+ /* @__PURE__ */ s("path", {
136
+ "stroke-linecap": "round",
137
+ d: "M7.5 12.5V8"
138
+ })
139
+ ], -1), G = /* @__PURE__ */ s("circle", {
140
+ cx: "7.5",
141
+ cy: "5",
142
+ r: "1",
143
+ fill: "var(--vs-alert-info-icon)"
144
+ }, null, -1), J = [
145
+ P,
146
+ G
147
+ ], K = {
148
+ key: 4,
149
+ xmlns: "http://www.w3.org/2000/svg",
150
+ width: "16",
151
+ height: "16",
152
+ viewBox: "0 0 16 16",
153
+ role: "presentation",
154
+ focussable: "false"
155
+ }, Q = /* @__PURE__ */ s("g", { stroke: "var(--vs-alert-secondary-icon)" }, [
156
+ /* @__PURE__ */ s("circle", {
157
+ cx: "7.5",
158
+ cy: "8.5",
159
+ r: "7",
160
+ fill: "none"
161
+ }),
162
+ /* @__PURE__ */ s("path", {
163
+ "stroke-linecap": "round",
164
+ d: "M7.5 12.5V8"
165
+ })
166
+ ], -1), R = /* @__PURE__ */ s("circle", {
167
+ cx: "7.5",
168
+ cy: "5",
169
+ r: "1",
170
+ fill: "var(--vs-alert-secondary-icon)"
171
+ }, null, -1), U = [
172
+ Q,
173
+ R
174
+ ], W = { class: "vs-alert__heading" }, X = /* @__PURE__ */ s("svg", {
175
+ xmlns: "http://www.w3.org/2000/svg",
176
+ width: "12",
177
+ height: "12",
178
+ viewBox: "0 0 12 12",
179
+ role: "presentation",
180
+ focusable: "false"
181
+ }, [
182
+ /* @__PURE__ */ s("path", {
183
+ stroke: "currentColor",
184
+ "stroke-linecap": "round",
185
+ d: "M3 9l6-6m0 6L3 3"
186
+ })
187
+ ], -1), Y = [
188
+ X
189
+ ];
190
+ function Z(t, e, o, l, u, n) {
191
+ return i(), r("div", {
192
+ class: h(["vs-alert", n.classList])
193
+ }, [
194
+ s("span", L, [
195
+ c(t.$slots, "icon", {}, () => [
196
+ o.variant === "success" ? (i(), r("svg", V, E)) : a("", !0),
197
+ o.variant === "warning" ? (i(), r("svg", A, N)) : a("", !0),
198
+ o.variant === "error" ? (i(), r("svg", j, D)) : a("", !0),
199
+ o.variant === "info" ? (i(), r("svg", F, J)) : a("", !0),
200
+ o.variant === "secondary" ? (i(), r("svg", K, U)) : a("", !0)
201
+ ])
202
+ ]),
203
+ s("div", W, [
204
+ c(t.$slots, "title", {}, () => [
205
+ o.title ? (i(), r(C, { key: 0 }, [
206
+ m(p(o.title), 1)
207
+ ], 64)) : a("", !0)
208
+ ])
209
+ ]),
210
+ c(t.$slots, "default"),
211
+ o.showClose ? (i(), r("button", {
212
+ key: 0,
213
+ class: h(["vs-alert-button", o.variant]),
214
+ onClick: e[0] || (e[0] = (f) => t.$emit("close", !0)),
215
+ "aria-label": "Close"
216
+ }, Y, 2)) : a("", !0)
217
+ ], 2);
218
+ }
219
+ const tt = /* @__PURE__ */ g(M, [["render", Z]]);
220
+ const et = {
221
+ name: "VsToast",
222
+ props: {
223
+ type: {
224
+ type: String,
225
+ default: "toast"
226
+ },
227
+ title: {
228
+ type: String
229
+ },
230
+ message: {
231
+ type: String
232
+ },
233
+ variant: {
234
+ type: String
235
+ },
236
+ showClose: {
237
+ type: Boolean,
238
+ default: !0
239
+ },
240
+ position: {
241
+ type: String,
242
+ default: "top-center",
243
+ validator: (t) => ["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"].includes(
244
+ t.toLowerCase()
245
+ )
246
+ },
247
+ animation: {
248
+ type: String
249
+ },
250
+ timeout: {
251
+ type: Number,
252
+ default: 5e3
253
+ },
254
+ isSticky: {
255
+ type: Boolean,
256
+ default: !1
257
+ }
258
+ },
259
+ components: {
260
+ VsAlert: tt
261
+ },
262
+ data() {
263
+ return {
264
+ isOpen: !1,
265
+ timerId: null,
266
+ isMouseHovered: !1,
267
+ isTimedOut: !1,
268
+ _position: "top-center"
269
+ };
270
+ },
271
+ computed: {
272
+ classList() {
273
+ return [`vs-toast--${this._position}`];
274
+ },
275
+ toggleTransition() {
276
+ var e, o;
277
+ const t = ((o = (e = this._position) == null ? void 0 : e.split("-")) == null ? void 0 : o[0]) || "";
278
+ return this._animation ? `vs-toast--transition-${this._animation}` : t === "top" ? "vs-toast--transition-slide-down" : "vs-toast--transition-slide-up";
279
+ }
280
+ },
281
+ methods: {
282
+ async open(t = {}) {
283
+ if (Object.keys(t).length !== 0) {
284
+ if (this.isOpen) {
285
+ this.close(), this.$nextTick(() => this.open(t));
286
+ return;
287
+ }
288
+ t = { ...this.$props, ...t }, Object.keys(t).forEach((e) => this[`_${e}`] = t[e] || "");
289
+ }
290
+ this.timerId && await this.close(), this.isOpen = !0, this.isTimedOut = !1, this._isSticky || (this.timerId = setTimeout(async () => {
291
+ this.isMouseHovered || await this.close(), this.isTimedOut = !0;
292
+ }, this._timeout));
293
+ },
294
+ close() {
295
+ return this.timerId && (clearTimeout(this.timerId), this.timerId = null), this.isOpen = !1, new Promise(
296
+ (t) => setTimeout(() => {
297
+ this.$emit("input", this.isOpen), t();
298
+ }, 10)
299
+ );
300
+ },
301
+ mouseHover(t = !1) {
302
+ this.isMouseHovered = t, this.isTimedOut && !this.isMouseHovered && this.close();
303
+ },
304
+ onEnter() {
305
+ this.$emit("reveal");
306
+ },
307
+ onLeave() {
308
+ this.$emit("hide");
309
+ }
310
+ }
311
+ };
312
+ function st(t, e, o, l, u, n) {
313
+ const f = x("vs-alert");
314
+ return i(), b(B, {
315
+ name: n.toggleTransition,
316
+ onAfterEnter: n.onEnter,
317
+ onAfterLeave: n.onLeave
318
+ }, {
319
+ default: _(() => [
320
+ u.isOpen ? (i(), r("div", {
321
+ key: 0,
322
+ class: h(["vs-toast", n.classList]),
323
+ role: "status",
324
+ onMouseover: e[0] || (e[0] = (k) => n.mouseHover(!0)),
325
+ onMouseleave: e[1] || (e[1] = (k) => n.mouseHover(!1))
326
+ }, [
327
+ c(t.$slots, "custom", { close: n.close }, () => [
328
+ T(f, {
329
+ title: t._title,
330
+ variant: t._variant,
331
+ "show-close": t._showClose,
332
+ onClose: n.close,
333
+ toast: t._type === "toast"
334
+ }, {
335
+ default: _(() => [
336
+ c(t.$slots, "default", {}, () => [
337
+ m(p(t._message), 1)
338
+ ])
339
+ ]),
340
+ _: 3
341
+ }, 8, ["title", "variant", "show-close", "onClose", "toast"])
342
+ ])
343
+ ], 34)) : a("", !0)
344
+ ]),
345
+ _: 3
346
+ }, 8, ["name", "onAfterEnter", "onAfterLeave"]);
347
+ }
348
+ const ot = /* @__PURE__ */ g(et, [["render", st]]), nt = ["success", "warning", "error", "info", "secondary"], w = {
349
+ title: "",
350
+ message: "",
351
+ variant: "success",
352
+ position: "top-center",
353
+ type: "toast",
354
+ timeout: 5e3,
355
+ showClose: !0,
356
+ isSticky: !1
357
+ };
358
+ let d = null;
359
+ function it() {
360
+ const t = O({
361
+ render() {
362
+ return S(ot, { ref: "toast" });
363
+ }
364
+ }), e = document.createElement("div");
365
+ return document.body.appendChild(e), t.mount(e);
366
+ }
367
+ function v() {
368
+ return d || (d = it()), d;
369
+ }
370
+ function y(t = {}) {
371
+ v().$refs.toast.open({ ...w, ...t });
372
+ }
373
+ function rt() {
374
+ v().$refs.toast.close();
375
+ }
376
+ function at() {
377
+ const t = {};
378
+ return nt.forEach((e) => t[e] = (o, l = {}) => y({ variant: e, message: o, ...l })), t;
379
+ }
380
+ const ct = {
381
+ show: y,
382
+ close: rt,
383
+ getToastCmp: v,
384
+ defaultOptions: w,
385
+ ...at()
386
+ };
387
+ export {
388
+ ct as default
389
+ };
@@ -0,0 +1 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}.vs-toast{position:fixed;width:350px;max-width:350px;background-color:#fff;z-index:9999;font-family:inherit;text-align:left}.vs-toast .vs-alert{padding:15px 40px}.vs-toast .vs-alert .vs-alert-button{top:10px}.vs-toast--top-center{left:calc(50% - 175px);top:5px}.vs-toast--top-left{left:5px;top:5px}.vs-toast--top-right{right:5px;top:5px}.vs-toast--bottom-center{left:calc(50% - 175px);bottom:5px}.vs-toast--bottom-left{left:5px;bottom:5px}.vs-toast--bottom-right{right:5px;bottom:5px}.vs-toast--transition-slide-down-enter-active,.vs-toast--transition-slide-down-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:0;transform:translateY(-30px)}.vs-toast--transition-slide-up-enter-active,.vs-toast--transition-slide-up-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:0;transform:translateY(30px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();var VsToast=function(e){"use strict";const I="",c=(t,o)=>{const s=t.__vccOpts||t;for(const[r,i]of o)s[r]=i;return s},_={name:"VsAlert",props:{variant:{type:String,required:!0,validator:t=>["success","error","info","warning","secondary"].includes(t.toLowerCase())},showClose:{type:Boolean,default:!1},title:{type:String},noBg:{type:Boolean,default:!1},small:{type:Boolean,default:!1},toast:{type:Boolean,default:!1}},computed:{classList(){return[`vs-alert-${this.variant}`,{"vs-alert--no-bg":this.noBg},{"vs-alert--small":this.small},{"vs-alert--toast":this.toast},{"vs-alert--is-close":this.showClose}]}}},f={class:"vs-alert-icon__wrapper"},p={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},g=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-success-icon)"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 9l2.5 2.5 5-5"}),e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"})],-1)],w={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},u=[e.createElementVNode("path",{fill:"none",stroke:"var(--vs-alert-warning-icon)","stroke-linecap":"round",d:"M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"},null,-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"#ad5918"},null,-1)],y={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},k=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-error-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 4.5V9"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"var(--vs-alert-error-icon)"},null,-1)],V={key:3,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},E=[e.createElementVNode("g",{stroke:"var(--vs-alert-info-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-info-icon)"},null,-1)],B={key:4,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},N=[e.createElementVNode("g",{stroke:"var(--vs-alert-secondary-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-secondary-icon)"},null,-1)],v={class:"vs-alert__heading"},C=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",role:"presentation",focusable:"false"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round",d:"M3 9l6-6m0 6L3 3"})],-1)];function x(t,o,s,r,i,n){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-alert",n.classList])},[e.createElementVNode("span",f,[e.renderSlot(t.$slots,"icon",{},()=>[s.variant==="success"?(e.openBlock(),e.createElementBlock("svg",p,g)):e.createCommentVNode("",!0),s.variant==="warning"?(e.openBlock(),e.createElementBlock("svg",w,u)):e.createCommentVNode("",!0),s.variant==="error"?(e.openBlock(),e.createElementBlock("svg",y,k)):e.createCommentVNode("",!0),s.variant==="info"?(e.openBlock(),e.createElementBlock("svg",V,E)):e.createCommentVNode("",!0),s.variant==="secondary"?(e.openBlock(),e.createElementBlock("svg",B,N)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",v,[e.renderSlot(t.$slots,"title",{},()=>[s.title?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(s.title),1)],64)):e.createCommentVNode("",!0)])]),e.renderSlot(t.$slots,"default"),s.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-alert-button",s.variant]),onClick:o[0]||(o[0]=m=>t.$emit("close",!0)),"aria-label":"Close"},C,2)):e.createCommentVNode("",!0)],2)}const S=c(_,[["render",x]]),R="",T={name:"VsToast",props:{type:{type:String,default:"toast"},title:{type:String},message:{type:String},variant:{type:String},showClose:{type:Boolean,default:!0},position:{type:String,default:"top-center",validator:t=>["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"].includes(t.toLowerCase())},animation:{type:String},timeout:{type:Number,default:5e3},isSticky:{type:Boolean,default:!1}},components:{VsAlert:S},data(){return{isOpen:!1,timerId:null,isMouseHovered:!1,isTimedOut:!1,_position:"top-center"}},computed:{classList(){return[`vs-toast--${this._position}`]},toggleTransition(){var o,s;const t=((s=(o=this._position)==null?void 0:o.split("-"))==null?void 0:s[0])||"";return this._animation?`vs-toast--transition-${this._animation}`:t==="top"?"vs-toast--transition-slide-down":"vs-toast--transition-slide-up"}},methods:{async open(t={}){if(Object.keys(t).length!==0){if(this.isOpen){this.close(),this.$nextTick(()=>this.open(t));return}t={...this.$props,...t},Object.keys(t).forEach(o=>this[`_${o}`]=t[o]||"")}this.timerId&&await this.close(),this.isOpen=!0,this.isTimedOut=!1,this._isSticky||(this.timerId=setTimeout(async()=>{this.isMouseHovered||await this.close(),this.isTimedOut=!0},this._timeout))},close(){return this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.isOpen=!1,new Promise(t=>setTimeout(()=>{this.$emit("input",this.isOpen),t()},10))},mouseHover(t=!1){this.isMouseHovered=t,this.isTimedOut&&!this.isMouseHovered&&this.close()},onEnter(){this.$emit("reveal")},onLeave(){this.$emit("hide")}}};function b(t,o,s,r,i,n){const m=e.resolveComponent("vs-alert");return e.openBlock(),e.createBlock(e.Transition,{name:n.toggleTransition,onAfterEnter:n.onEnter,onAfterLeave:n.onLeave},{default:e.withCtx(()=>[i.isOpen?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vs-toast",n.classList]),role:"status",onMouseover:o[0]||(o[0]=H=>n.mouseHover(!0)),onMouseleave:o[1]||(o[1]=H=>n.mouseHover(!1))},[e.renderSlot(t.$slots,"custom",{close:n.close},()=>[e.createVNode(m,{title:t._title,variant:t._variant,"show-close":t._showClose,onClose:n.close,toast:t._type==="toast"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t._message),1)])]),_:3},8,["title","variant","show-close","onClose","toast"])])],34)):e.createCommentVNode("",!0)]),_:3},8,["name","onAfterEnter","onAfterLeave"])}const O=c(T,[["render",b]]),M=["success","warning","error","info","secondary"],d={title:"",message:"",variant:"success",position:"top-center",type:"toast",timeout:5e3,showClose:!0,isSticky:!1};let a=null;function L(){const t=e.createApp({render(){return e.h(O,{ref:"toast"})}}),o=document.createElement("div");return document.body.appendChild(o),t.mount(o)}function l(){return a||(a=L()),a}function h(t={}){l().$refs.toast.open({...d,...t})}function $(){l().$refs.toast.close()}function A(){const t={};return M.forEach(o=>t[o]=(s,r={})=>h({variant:o,message:s,...r})),t}return{show:h,close:$,getToastCmp:l,defaultOptions:d,...A()}}(Vue);
@@ -0,0 +1 @@
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-alert{--vs-alert-success-bc: #aecfc2;--vs-alert-success-bg: #edf8f4;--vs-alert-success-color: #186146;--vs-alert-success-icon: #038153;--vs-alert-warning-bc: #fed6a8;--vs-alert-warning-bg: #fff7ed;--vs-alert-warning-color: #ad5918;--vs-alert-warning-icon: #ad5918;--vs-alert-error-bc: #f5b5ba;--vs-alert-error-bg: #fff0f1;--vs-alert-error-color: #8c232c;--vs-alert-error-icon: #cc3340;--vs-alert-info-bc: #adcce4;--vs-alert-info-bg: #edf7ff;--vs-alert-info-color: #1f73b7;--vs-alert-info-icon: #337fbd;--vs-alert-secondary-bc: #d8dcde;--vs-alert-secondary-bg: #f8f9f9;--vs-alert-secondary-color: #68737d;--vs-alert-secondary-icon: #68737d;position:relative;border-radius:4px;padding:20px 20px 20px 40px;line-height:1.42857;font-size:14px}.vs-alert-icon__wrapper svg{position:absolute;left:15px;margin-top:1px}.vs-alert__heading{font-weight:600;filter:brightness(85%)}.vs-alert-button{display:block;position:absolute;top:15px;right:10px;transition:background-color .1s ease-in-out 0s,color .25s ease-in-out 0s;border:none;background-color:transparent;cursor:pointer;padding:0;width:28px;height:28px;overflow:hidden;color:#333;font-size:0px;user-select:none}.vs-alert-button.success{color:var(--vs-alert-success-color)}.vs-alert-button.warning{color:var(--vs-alert-warning-color)}.vs-alert-button.error{color:var(--vs-alert-error-color)}.vs-alert-button.info{color:var(--vs-alert-info-color)}.vs-alert-button.secondary{color:var(--vs-alert-secondary-color)}.vs-alert-success{border:1px solid var(--vs-alert-success-bc);background-color:var(--vs-alert-success-bg);color:var(--vs-alert-success-color)}.vs-alert-warning{border:1px solid var(--vs-alert-warning-bc);background-color:var(--vs-alert-warning-bg);color:var(--vs-alert-warning-color)}.vs-alert-error{border:1px solid var(--vs-alert-error-bc);background-color:var(--vs-alert-error-bg);color:var(--vs-alert-error-color)}.vs-alert-info{border:1px solid var(--vs-alert-info-bc);background-color:var(--vs-alert-info-bg);color:var(--vs-alert-info-color)}.vs-alert-secondary{border:1px solid var(--vs-alert-secondary-bc);background-color:var(--vs-alert-secondary-bg);color:var(--vs-alert-secondary-color)}.vs-alert.vs-alert--small:not(.vs-alert--is-close){padding:12px 20px 12px 40px}.vs-alert.vs-alert--is-close:not(.vs-alert--small){padding:20px 40px}.vs-alert.vs-alert--is-close.vs-alert--small{padding:12px 40px}.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button{top:8px}.vs-alert--no-bg{background-color:transparent;border-color:transparent;padding:0 22px;font-size:13px}.vs-alert--no-bg .vs-alert-icon__wrapper svg{left:0;margin-top:0}.vs-alert--no-bg.vs-alert-warning{color:var(--vs-alert-warning-icon)}.vs-alert--no-bg.vs-alert-error{color:var(--vs-alert-error-icon)}.vs-alert--toast{background-color:transparent;border:solid 1px #d8dcde;color:#2f3941;box-shadow:#17494d26 0 20px 28px;padding:15px 40px}.vs-alert--toast .vs-alert__heading{filter:brightness(100%)}.vs-alert--toast.vs-alert-success .vs-alert__heading{color:var(--vs-alert-success-icon)}.vs-alert--toast.vs-alert-warning .vs-alert__heading{color:var(--vs-alert-warning-icon)}.vs-alert--toast.vs-alert-error .vs-alert__heading{color:var(--vs-alert-error-icon)}.vs-alert--toast.vs-alert-info .vs-alert__heading{color:var(--vs-alert-info-icon)}.vs-alert--toast.vs-alert-secondary .vs-alert__heading{color:var(--vs-alert-secondary-icon)}.vs-alert--toast .vs-alert-button{color:#68737d;top:10px}.vs-toast{position:fixed;width:350px;max-width:350px;background-color:#fff;z-index:9999;font-family:inherit;text-align:left}.vs-toast .vs-alert{padding:15px 40px}.vs-toast .vs-alert .vs-alert-button{top:10px}.vs-toast--top-center{left:calc(50% - 175px);top:5px}.vs-toast--top-left{left:5px;top:5px}.vs-toast--top-right{right:5px;top:5px}.vs-toast--bottom-center{left:calc(50% - 175px);bottom:5px}.vs-toast--bottom-left{left:5px;bottom:5px}.vs-toast--bottom-right{right:5px;bottom:5px}.vs-toast--transition-slide-down-enter-active,.vs-toast--transition-slide-down-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-down-enter-from,.vs-toast--transition-slide-down-leave-to{opacity:0;transform:translateY(-30px)}.vs-toast--transition-slide-up-enter-active,.vs-toast--transition-slide-up-leave-active{transition:.3s all ease-in-out}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:1;transform:translateY(0)}.vs-toast--transition-slide-up-enter-from,.vs-toast--transition-slide-up-leave-to{opacity:0;transform:translateY(30px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("vue")):typeof define=="function"&&define.amd?define(["vue"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.VsToast=i(e.Vue))})(this,function(e){"use strict";const i="",d=(t,o)=>{const s=t.__vccOpts||t;for(const[r,l]of o)s[r]=l;return s},f={name:"VsAlert",props:{variant:{type:String,required:!0,validator:t=>["success","error","info","warning","secondary"].includes(t.toLowerCase())},showClose:{type:Boolean,default:!1},title:{type:String},noBg:{type:Boolean,default:!1},small:{type:Boolean,default:!1},toast:{type:Boolean,default:!1}},computed:{classList(){return[`vs-alert-${this.variant}`,{"vs-alert--no-bg":this.noBg},{"vs-alert--small":this.small},{"vs-alert--toast":this.toast},{"vs-alert--is-close":this.showClose}]}}},p={class:"vs-alert-icon__wrapper"},u={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},g=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-success-icon)"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 9l2.5 2.5 5-5"}),e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"})],-1)],w={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},y=[e.createElementVNode("path",{fill:"none",stroke:"var(--vs-alert-warning-icon)","stroke-linecap":"round",d:"M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"},null,-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"#ad5918"},null,-1)],k={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},V=[e.createElementVNode("g",{fill:"none",stroke:"var(--vs-alert-error-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 4.5V9"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"12",r:"1",fill:"var(--vs-alert-error-icon)"},null,-1)],E={key:3,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},B=[e.createElementVNode("g",{stroke:"var(--vs-alert-info-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-info-icon)"},null,-1)],N={key:4,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",role:"presentation",focussable:"false"},v=[e.createElementVNode("g",{stroke:"var(--vs-alert-secondary-icon)"},[e.createElementVNode("circle",{cx:"7.5",cy:"8.5",r:"7",fill:"none"}),e.createElementVNode("path",{"stroke-linecap":"round",d:"M7.5 12.5V8"})],-1),e.createElementVNode("circle",{cx:"7.5",cy:"5",r:"1",fill:"var(--vs-alert-secondary-icon)"},null,-1)],C={class:"vs-alert__heading"},x=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",role:"presentation",focusable:"false"},[e.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round",d:"M3 9l6-6m0 6L3 3"})],-1)];function T(t,o,s,r,l,n){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-alert",n.classList])},[e.createElementVNode("span",p,[e.renderSlot(t.$slots,"icon",{},()=>[s.variant==="success"?(e.openBlock(),e.createElementBlock("svg",u,g)):e.createCommentVNode("",!0),s.variant==="warning"?(e.openBlock(),e.createElementBlock("svg",w,y)):e.createCommentVNode("",!0),s.variant==="error"?(e.openBlock(),e.createElementBlock("svg",k,V)):e.createCommentVNode("",!0),s.variant==="info"?(e.openBlock(),e.createElementBlock("svg",E,B)):e.createCommentVNode("",!0),s.variant==="secondary"?(e.openBlock(),e.createElementBlock("svg",N,v)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",C,[e.renderSlot(t.$slots,"title",{},()=>[s.title?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(s.title),1)],64)):e.createCommentVNode("",!0)])]),e.renderSlot(t.$slots,"default"),s.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-alert-button",s.variant]),onClick:o[0]||(o[0]=_=>t.$emit("close",!0)),"aria-label":"Close"},x,2)):e.createCommentVNode("",!0)],2)}const S=d(f,[["render",T]]),R="",b={name:"VsToast",props:{type:{type:String,default:"toast"},title:{type:String},message:{type:String},variant:{type:String},showClose:{type:Boolean,default:!0},position:{type:String,default:"top-center",validator:t=>["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"].includes(t.toLowerCase())},animation:{type:String},timeout:{type:Number,default:5e3},isSticky:{type:Boolean,default:!1}},components:{VsAlert:S},data(){return{isOpen:!1,timerId:null,isMouseHovered:!1,isTimedOut:!1,_position:"top-center"}},computed:{classList(){return[`vs-toast--${this._position}`]},toggleTransition(){var o,s;const t=((s=(o=this._position)==null?void 0:o.split("-"))==null?void 0:s[0])||"";return this._animation?`vs-toast--transition-${this._animation}`:t==="top"?"vs-toast--transition-slide-down":"vs-toast--transition-slide-up"}},methods:{async open(t={}){if(Object.keys(t).length!==0){if(this.isOpen){this.close(),this.$nextTick(()=>this.open(t));return}t={...this.$props,...t},Object.keys(t).forEach(o=>this[`_${o}`]=t[o]||"")}this.timerId&&await this.close(),this.isOpen=!0,this.isTimedOut=!1,this._isSticky||(this.timerId=setTimeout(async()=>{this.isMouseHovered||await this.close(),this.isTimedOut=!0},this._timeout))},close(){return this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.isOpen=!1,new Promise(t=>setTimeout(()=>{this.$emit("input",this.isOpen),t()},10))},mouseHover(t=!1){this.isMouseHovered=t,this.isTimedOut&&!this.isMouseHovered&&this.close()},onEnter(){this.$emit("reveal")},onLeave(){this.$emit("hide")}}};function O(t,o,s,r,l,n){const _=e.resolveComponent("vs-alert");return e.openBlock(),e.createBlock(e.Transition,{name:n.toggleTransition,onAfterEnter:n.onEnter,onAfterLeave:n.onLeave},{default:e.withCtx(()=>[l.isOpen?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vs-toast",n.classList]),role:"status",onMouseover:o[0]||(o[0]=I=>n.mouseHover(!0)),onMouseleave:o[1]||(o[1]=I=>n.mouseHover(!1))},[e.renderSlot(t.$slots,"custom",{close:n.close},()=>[e.createVNode(_,{title:t._title,variant:t._variant,"show-close":t._showClose,onClose:n.close,toast:t._type==="toast"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t._message),1)])]),_:3},8,["title","variant","show-close","onClose","toast"])])],34)):e.createCommentVNode("",!0)]),_:3},8,["name","onAfterEnter","onAfterLeave"])}const M=d(b,[["render",O]]),L=["success","warning","error","info","secondary"],h={title:"",message:"",variant:"success",position:"top-center",type:"toast",timeout:5e3,showClose:!0,isSticky:!1};let a=null;function $(){const t=e.createApp({render(){return e.h(M,{ref:"toast"})}}),o=document.createElement("div");return document.body.appendChild(o),t.mount(o)}function c(){return a||(a=$()),a}function m(t={}){c().$refs.toast.open({...h,...t})}function A(){c().$refs.toast.close()}function H(){const t={};return L.forEach(o=>t[o]=(s,r={})=>m({variant:o,message:s,...r})),t}return{show:m,close:A,getToastCmp:c,defaultOptions:h,...H()}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuesimple/vs-toast",
3
- "version": "1.4.18",
3
+ "version": "3.0.0",
4
4
  "description": "A simple vue toast.",
5
5
  "main": "dist/vs-toast.umd.js",
6
6
  "module": "dist/vs-toast.esm.js",
@@ -9,20 +9,14 @@
9
9
  "./sfc": "src/vs-toast.vue"
10
10
  },
11
11
  "scripts": {
12
- "build": "rm -rfv dist && npm run build:umd & npm run build:es & npm run build:unpkg",
13
- "build:umd": "rollup --config build/rollup.config.js --format umd --file dist/vs-toast.umd.js",
14
- "build:es": "rollup --config build/rollup.config.js --format es --file dist/vs-toast.esm.js",
15
- "build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/vs-toast.min.js --module-name vsToast"
12
+ "build": "rm -rfv dist && vite build --config build/vite.config.js"
16
13
  },
17
14
  "devDependencies": {
18
- "@rollup/plugin-image": "2.0.5",
19
- "minimist": "1.2.5",
20
- "rollup": "1.32.0",
21
- "rollup-plugin-babel": "4.4.0",
22
- "rollup-plugin-terser": "6.1.0",
23
- "rollup-plugin-vue": "5.1.9",
24
- "vue": "2.6.10",
25
- "vue-template-compiler": "2.6.10"
15
+ "@vitejs/plugin-vue": "^3.0.1",
16
+ "sass": "^1.54.4",
17
+ "vite": "^3.0.5",
18
+ "vite-plugin-style-inject": "0.0.1",
19
+ "vue": "^3.2.37"
26
20
  },
27
21
  "private": false,
28
22
  "repository": {
@@ -34,6 +28,7 @@
34
28
  },
35
29
  "keywords": [
36
30
  "vue",
31
+ "vue3",
37
32
  "vuejs",
38
33
  "toast",
39
34
  "notification",
@@ -51,5 +46,5 @@
51
46
  "url": "https://github.com/ashwinkshenoy/vue-simple/issues"
52
47
  },
53
48
  "homepage": "https://github.com/ashwinkshenoy/vue-simple/tree/master/packages/vs-toast",
54
- "gitHead": "d861c686610167888eb6eeaa4f8001424026a1dd"
49
+ "gitHead": "c666ac905df7e5b10f9198cd056cdd3fa88e212e"
55
50
  }
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Vue from 'vue';
1
+ import { createApp, ref, h } from 'vue';
2
2
  import VsToast from './vs-toast.vue';
3
3
 
4
4
  const variant = ['success', 'warning', 'error', 'info', 'secondary'];
@@ -17,9 +17,16 @@ const defaultOptions = {
17
17
  let toastCmp = null;
18
18
 
19
19
  function createToastCmp() {
20
- const cmp = new Vue(VsToast);
21
- document.body.appendChild(cmp.$mount().$el);
22
- return cmp;
20
+ const app = createApp({
21
+ render() {
22
+ return h(VsToast, { ref: 'toast' });
23
+ },
24
+ });
25
+ const toastElement = document.createElement('div');
26
+ document.body.appendChild(toastElement);
27
+ const vm = app.mount(toastElement);
28
+
29
+ return vm;
23
30
  }
24
31
 
25
32
  function getToastCmp() {
@@ -30,11 +37,11 @@ function getToastCmp() {
30
37
  }
31
38
 
32
39
  function show(options = {}) {
33
- getToastCmp().open({ ...defaultOptions, ...options });
40
+ getToastCmp().$refs.toast.open({ ...defaultOptions, ...options });
34
41
  }
35
42
 
36
43
  function close() {
37
- getToastCmp().close();
44
+ getToastCmp().$refs.toast.close();
38
45
  }
39
46
 
40
47
  function createShorthands() {