vue-toasts-lite 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,21 +20,14 @@ A lightweight toast notifications library for Vue 3.
20
20
  - 🎯 Promise support
21
21
  - 🖱️ Pause on hover
22
22
 
23
- ## Installation
23
+ ## Quick Start
24
24
 
25
+ ### 1. Install the package:
25
26
  ```bash
26
27
  npm install vue-toasts-lite
27
28
  ```
28
29
 
29
- ## Quick Start
30
-
31
- **Three steps to start using toasts:**
32
-
33
- 1. Install the package
34
- 2. Add `ToastsLiteProvider` to your app
35
- 3. Call `toasts.success()` from anywhere
36
-
37
- ### 1. Add the provider to your `App.vue`:
30
+ ### 2. Add `ToastsLiteProvider` & `vue-toasts-lite/style.css` to app:
38
31
 
39
32
  ```vue
40
33
  <script setup>
@@ -50,7 +43,7 @@ import 'vue-toasts-lite/style.css'
50
43
  </template>
51
44
  ```
52
45
 
53
- ### 2. Use anywhere in your app:
46
+ ### 3. Use anywhere in your app:
54
47
 
55
48
  ```vue
56
49
  <script setup>
@@ -129,14 +122,6 @@ await toasts.promise(
129
122
  )
130
123
  ```
131
124
 
132
- ### Custom Controller
133
-
134
- ```js
135
- import { ToastsController } from 'vue-toasts-lite'
136
-
137
- const notifications = new ToastsController()
138
- notifications.success('Hello!')
139
- ```
140
125
 
141
126
  ## Styling
142
127
 
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ export declare type ToastProps = {
47
47
 
48
48
  export declare const toasts: ToastsController;
49
49
 
50
- export declare class ToastsController implements Toast {
50
+ declare class ToastsController implements Toast {
51
51
  private counter;
52
52
  private toasts;
53
53
  constructor();
package/dist/index.js CHANGED
@@ -1,89 +1,43 @@
1
1
  var L = Object.defineProperty;
2
- var M = (a, t, e) => t in a ? L(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var f = (a, t, e) => M(a, typeof t != "symbol" ? t + "" : t, e);
4
- import { defineComponent as w, ref as h, watchEffect as O, createElementBlock as m, openBlock as d, withModifiers as E, normalizeStyle as $, createCommentVNode as U, createElementVNode as v, normalizeClass as C, toDisplayString as D, computed as k, onBeforeUpdate as x, createBlock as g, Teleport as B, Fragment as b, renderList as T, createVNode as P, TransitionGroup as A, withCtx as I, unref as N } from "vue";
5
- const S = {
6
- key: 0,
7
- class: "toasts-lite__icon"
8
- }, V = { class: "toasts-lite__content" }, z = { class: "toasts-lite__content-message" }, F = /* @__PURE__ */ w({
9
- __name: "ToastsLiteItem",
10
- props: {
11
- id: {},
12
- type: {},
13
- message: {},
14
- autoClose: { type: Boolean },
15
- duration: {},
16
- position: {}
17
- },
18
- emits: ["close"],
19
- setup(a, { expose: t, emit: e }) {
20
- const o = a, n = e, i = h(null), p = h(0), c = h(0);
21
- function s() {
22
- i.value && clearTimeout(i.value), n("close");
23
- }
24
- function r() {
25
- i.value && (clearTimeout(i.value), i.value = null, c.value = o.duration - (Date.now() - p.value));
26
- }
27
- function u() {
28
- !i.value && c.value > 0 && (i.value = setTimeout(s, c.value));
29
- }
30
- return O(() => {
31
- i.value && (clearTimeout(i.value), i.value = null), o.autoClose && (p.value = Date.now(), c.value = o.duration, i.value = setTimeout(s, o.duration));
32
- }), t({
33
- pause: r,
34
- resume: u
35
- }), (l, _) => (d(), m("div", {
36
- class: "toasts-lite__toast",
37
- style: $(`--toast-duration: ${a.duration}s;`),
38
- onClick: E(s, ["prevent"])
39
- }, [
40
- ["success", "error", "loading", "warn"].includes(a.type) ? (d(), m("div", S, [
41
- v("div", {
42
- class: C(`toasts-lite__${a.type}`)
43
- }, null, 2)
44
- ])) : U("", !0),
45
- v("div", V, [
46
- v("div", z, D(a.message), 1)
47
- ])
48
- ], 4));
49
- }
50
- });
51
- class R extends Map {
2
+ var M = (r, t, e) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var v = (r, t, e) => M(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { ref as h, defineComponent as C, watch as $, onMounted as U, onUnmounted as A, createElementBlock as _, openBlock as d, withModifiers as D, normalizeStyle as E, createCommentVNode as k, createElementVNode as p, normalizeClass as O, toDisplayString as x, computed as B, createBlock as b, Teleport as P, Fragment as T, renderList as w, unref as m, createVNode as I, TransitionGroup as N, withCtx as R } from "vue";
5
+ class S extends Map {
52
6
  constructor() {
53
7
  super(...arguments);
54
- f(this, "subscribers", []);
8
+ v(this, "subscribers", []);
55
9
  }
56
- set(e, o) {
57
- return super.set(e, o), this.notify(), this;
10
+ set(e, s) {
11
+ return super.set(e, s), this.notify(), this;
58
12
  }
59
13
  delete(e) {
60
- const o = super.delete(e);
61
- return this.notify(), o;
14
+ const s = super.delete(e);
15
+ return this.notify(), s;
62
16
  }
63
17
  clear() {
64
18
  super.clear(), this.notify();
65
19
  }
66
20
  subscribe(e) {
67
21
  return this.subscribers.push(e), () => {
68
- this.subscribers = this.subscribers.filter((o) => o !== e);
22
+ this.subscribers = this.subscribers.filter((s) => s !== e);
69
23
  };
70
24
  }
71
25
  notify() {
72
26
  this.subscribers.forEach((e) => e(Array.from(this.values())));
73
27
  }
74
28
  }
75
- const j = {
29
+ const V = {
76
30
  type: "success",
77
31
  message: "Hello from Toasts Lite",
78
32
  autoClose: !0,
79
33
  duration: 3e3,
80
34
  position: "top-center"
81
35
  };
82
- class G {
36
+ class z {
83
37
  constructor() {
84
- f(this, "counter", 0);
85
- f(this, "toasts");
86
- this.toasts = new R();
38
+ v(this, "counter", 0);
39
+ v(this, "toasts");
40
+ this.toasts = new S();
87
41
  }
88
42
  get toastList() {
89
43
  return Array.from(this.toasts.values());
@@ -95,12 +49,12 @@ class G {
95
49
  return `toast:${Date.now().toString(16)}-${this.counter++}`;
96
50
  }
97
51
  addOrUpdate(t) {
98
- let { id: e = this.ID(), ...o } = t;
52
+ let { id: e = this.ID(), ...s } = t;
99
53
  if (this.toasts.has(e)) {
100
54
  const n = this.toasts.get(e);
101
- return Object.assign(n, o), this.toasts.set(e, n), e;
55
+ return Object.assign(n, s), this.toasts.set(e, n), e;
102
56
  }
103
- return this.toasts.set(e, { id: e, ...j, ...o }), e;
57
+ return this.toasts.set(e, { id: e, ...V, ...s }), e;
104
58
  }
105
59
  /**
106
60
  * Add a toast
@@ -176,82 +130,141 @@ class G {
176
130
  * @returns The id of the toast
177
131
  */
178
132
  async promise(t, e) {
179
- const o = this.loading(e.loading, { position: e.position, id: e.id });
133
+ const s = this.loading(e.loading, { position: e.position, id: e.id });
180
134
  try {
181
- return await t, this.success(e.success, { position: e.position, id: o }), o;
135
+ return await t, this.success(e.success, { position: e.position, id: s }), s;
182
136
  } catch {
183
- throw this.error(e.error, { position: e.position, id: o }), new Error(e.error);
137
+ throw this.error(e.error, { position: e.position, id: s }), new Error(e.error);
184
138
  }
185
139
  }
186
140
  }
187
- const y = new G(), H = ["onMouseenter", "onMouseleave"], K = /* @__PURE__ */ w({
188
- __name: "ToastsLiteProvider",
189
- setup(a) {
190
- const t = [
191
- "top-left",
192
- "top-center",
193
- "top-right",
194
- "middle-center",
195
- "bottom-left",
196
- "bottom-center",
197
- "bottom-right"
198
- ], e = h(y.toastList);
199
- y.onToastsListChange((s) => {
200
- e.value = s;
201
- });
202
- const o = k(() => {
203
- const s = /* @__PURE__ */ new Map();
204
- return e.value.forEach((r) => {
205
- const u = r.position || "top-center";
206
- s.has(u) || s.set(u, []), s.get(u).push(r);
207
- }), s;
208
- }), n = h({});
209
- x(() => {
210
- for (const s of t)
211
- n.value[s] = [];
212
- });
213
- function i(s) {
214
- n.value[s] && n.value[s].forEach((r) => r == null ? void 0 : r.pause());
141
+ const y = new z();
142
+ function F() {
143
+ const r = h(/* @__PURE__ */ new Map());
144
+ function t(n, o, a) {
145
+ r.value.has(n) || r.value.set(n, []);
146
+ const i = r.value.get(n);
147
+ a && "pause" in a && "resume" in a && (i[o] = a);
148
+ }
149
+ function e(n) {
150
+ var o;
151
+ (o = r.value.get(n)) == null || o.forEach((a) => a == null ? void 0 : a.pause());
152
+ }
153
+ function s(n) {
154
+ var o;
155
+ (o = r.value.get(n)) == null || o.forEach((a) => a == null ? void 0 : a.resume());
156
+ }
157
+ return {
158
+ setRef: t,
159
+ pauseAll: e,
160
+ resumeAll: s
161
+ };
162
+ }
163
+ const j = {
164
+ key: 0,
165
+ class: "toasts-lite__icon"
166
+ }, G = { class: "toasts-lite__content" }, H = { class: "toasts-lite__content-message" }, q = /* @__PURE__ */ C({
167
+ __name: "ToastsLiteItem",
168
+ props: {
169
+ id: {},
170
+ type: {},
171
+ message: {},
172
+ autoClose: { type: Boolean },
173
+ duration: {},
174
+ position: {}
175
+ },
176
+ emits: ["close"],
177
+ setup(r, { expose: t, emit: e }) {
178
+ const s = r, n = e, o = h(null), a = h(0), i = h(0);
179
+ function c() {
180
+ o.value && clearTimeout(o.value), n("close");
181
+ }
182
+ function u() {
183
+ o.value && (clearTimeout(o.value), o.value = null, i.value = s.duration - (Date.now() - a.value));
215
184
  }
216
- function p(s) {
217
- n.value[s] && n.value[s].forEach((r) => r == null ? void 0 : r.resume());
185
+ function l() {
186
+ !o.value && i.value > 0 && (a.value = Date.now(), o.value = setTimeout(c, i.value));
218
187
  }
219
- function c(s, r) {
220
- n.value[s] || (n.value[s] = []), r && "pause" in r && "resume" in r && n.value[s].push(r);
188
+ function f() {
189
+ o.value && (clearTimeout(o.value), o.value = null), s.autoClose && (a.value = Date.now(), i.value = s.duration, o.value = setTimeout(c, s.duration));
221
190
  }
222
- return (s, r) => (d(), g(B, { to: "body" }, [
223
- (d(), m(b, null, T(t, (u) => v("div", {
191
+ return $(
192
+ () => [s.autoClose, s.duration],
193
+ () => {
194
+ f();
195
+ }
196
+ ), U(() => {
197
+ f();
198
+ }), A(() => {
199
+ o.value && clearTimeout(o.value);
200
+ }), t({
201
+ pause: u,
202
+ resume: l
203
+ }), (g, K) => (d(), _("div", {
204
+ class: "toasts-lite__toast",
205
+ style: E(`--toast-duration: ${r.duration}s;`),
206
+ onClick: D(c, ["prevent"])
207
+ }, [
208
+ ["success", "error", "loading", "warn"].includes(r.type) ? (d(), _("div", j, [
209
+ p("div", {
210
+ class: O(`toasts-lite__${r.type}`)
211
+ }, null, 2)
212
+ ])) : k("", !0),
213
+ p("div", G, [
214
+ p("div", H, x(r.message), 1)
215
+ ])
216
+ ], 4));
217
+ }
218
+ }), J = ["onMouseenter", "onMouseleave"], X = /* @__PURE__ */ C({
219
+ __name: "ToastsLiteProvider",
220
+ setup(r) {
221
+ const t = ["top-left", "top-center", "top-right", "middle-center", "bottom-left", "bottom-center", "bottom-right"], e = h(y.toastList), { setRef: s, pauseAll: n, resumeAll: o } = F();
222
+ y.onToastsListChange((i) => {
223
+ e.value = i;
224
+ });
225
+ const a = B(() => {
226
+ const i = /* @__PURE__ */ new Map();
227
+ return e.value.forEach((c) => {
228
+ const u = c.position || "top-center";
229
+ i.has(u) || i.set(u, []), i.get(u).push(c);
230
+ }), i;
231
+ });
232
+ return (i, c) => (d(), b(P, { to: "body" }, [
233
+ (d(), _(T, null, w(t, (u) => p("div", {
224
234
  key: u,
225
- class: C(["toasts-lite__toast-container", `toasts-lite__${u}`]),
226
- onMouseenter: (l) => i(u),
227
- onMouseleave: (l) => p(u)
235
+ class: O(["toasts-lite__toast-container", `toasts-lite__${u}`])
228
236
  }, [
229
- P(A, {
230
- name: "toasts-lite",
231
- appear: ""
232
- }, {
233
- default: I(() => [
234
- (d(!0), m(b, null, T(o.value.get(u) || [], (l) => (d(), g(F, {
235
- id: l.id,
236
- ref_for: !0,
237
- ref: (_) => c(u, _),
238
- key: l.id,
239
- type: l.type,
240
- message: l.message,
241
- "auto-close": l.autoClose,
242
- duration: l.duration,
243
- position: l.position,
244
- onClose: (_) => N(y).remove(l.id)
245
- }, null, 8, ["id", "type", "message", "auto-close", "duration", "position", "onClose"]))), 128))
246
- ]),
247
- _: 2
248
- }, 1024)
249
- ], 42, H)), 64))
237
+ p("div", {
238
+ class: "toasts-lite__toast-wrapper",
239
+ onMouseenter: (l) => m(n)(u),
240
+ onMouseleave: (l) => m(o)(u)
241
+ }, [
242
+ I(N, {
243
+ name: "toasts-lite",
244
+ appear: ""
245
+ }, {
246
+ default: R(() => [
247
+ (d(!0), _(T, null, w(a.value.get(u) || [], (l, f) => (d(), b(q, {
248
+ id: l.id,
249
+ ref_for: !0,
250
+ ref: (g) => m(s)(u, f, g),
251
+ key: l.id,
252
+ type: l.type,
253
+ message: l.message,
254
+ "auto-close": l.autoClose,
255
+ duration: l.duration,
256
+ position: l.position,
257
+ onClose: (g) => m(y).remove(l.id)
258
+ }, null, 8, ["id", "type", "message", "auto-close", "duration", "position", "onClose"]))), 128))
259
+ ]),
260
+ _: 2
261
+ }, 1024)
262
+ ], 40, J)
263
+ ], 2)), 64))
250
264
  ]));
251
265
  }
252
266
  });
253
267
  export {
254
- G as ToastsController,
255
- K as ToastsLiteProvider,
268
+ X as ToastsLiteProvider,
256
269
  y as toasts
257
270
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- :root{--toasts-lite-font-family: var(--tl-font-family, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif);--toasts-lite-bg: var(--tl-bg, hsl(0, 0%, 100%));--toasts-lite-text: var(--tl-text, hsl(0, 0%, 20%));--toasts-lite-border: var(--tl-border, hsl(0, 0%, 85%));--toasts-lite-shadow: var(--tl-shadow, hsla(0, 0%, 0%, .1));--toasts-lite-success: var(--tl-success, hsl(145, 63%, 42%));--toasts-lite-error: var(--tl-error, hsl(0, 79%, 63%));--toasts-lite-warn: var(--tl-warn, hsl(45, 100%, 51%));--toasts-lite-icon-color: var(--tl-icon-color, hsl(0, 0%, 100%));--toasts-lite-loading-border-main: var(--tl-loading-border, hsl(0, 0%, 15%));--toasts-lite-loading-border-bg: var(--tl-loading-bg, hsl(0, 0%, 98%))}@keyframes scaleAnimation{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes loadingRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.toasts-lite-enter-active,.toasts-lite-leave-active{transition:opacity .3s ease,transform .3s ease}.toasts-lite-enter-from,.toasts-lite-leave-to{opacity:0;transform:translateY(-10px)}.toasts-lite__toast-container{position:fixed;z-index:9999;margin:10px;overflow:visible;display:flex;flex-direction:column;align-items:center;padding-top:12px;gap:12px;pointer-events:none}.toasts-lite__toast{font-family:var(--toasts-lite-font-family);display:flex;justify-content:center;align-items:center;background:var(--toasts-lite-bg);color:var(--toasts-lite-text);border:1px solid var(--toasts-lite-border);box-shadow:var(--toasts-lite-shadow) 0 0 10px;min-width:100px;max-width:1200px;padding:10px 20px;border-radius:8px;cursor:pointer;pointer-events:auto;text-overflow:ellipsis}.toasts-lite__icon{margin-right:12px}.toasts-lite__top-left{top:0;left:0}.toasts-lite__top-center{top:0;left:50%;transform:translate(-50%);min-width:80vw}.toasts-lite__top-right{top:0;right:0}.toasts-lite__bottom-left{bottom:0;left:0}.toasts-lite__bottom-center{bottom:0;left:50%;transform:translate(-50%)}.toasts-lite__bottom-right{bottom:0;right:0}.toasts-lite__middle-center{top:50%;left:50%;transform:translate(-50%,-50%)}.toasts-lite__success{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-success);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__success:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__error{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-error);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__error:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6l-12 12" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6l-12 12" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__warn{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-warn);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__warn:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="5" stroke="currentColor" ><path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="5" stroke="currentColor" ><path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__loading{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toasts-lite-loading-border-main);border-right-color:var(--toasts-lite-loading-border-bg);animation:loadingRotate 1s linear infinite}
1
+ :root{--toasts-lite-font-family: var(--tl-font-family, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif);--toasts-lite-bg: var(--tl-bg, hsl(0, 0%, 100%));--toasts-lite-text: var(--tl-text, hsl(0, 0%, 20%));--toasts-lite-border: var(--tl-border, hsl(0, 0%, 85%));--toasts-lite-shadow: var(--tl-shadow, hsla(0, 0%, 0%, .1));--toasts-lite-success: var(--tl-success, hsl(145, 63%, 42%));--toasts-lite-error: var(--tl-error, hsl(0, 79%, 63%));--toasts-lite-warn: var(--tl-warn, hsl(45, 100%, 51%));--toasts-lite-icon-color: var(--tl-icon-color, hsl(0, 0%, 100%));--toasts-lite-loading-border-main: var(--tl-loading-border, hsl(0, 0%, 15%));--toasts-lite-loading-border-bg: var(--tl-loading-bg, hsl(0, 0%, 98%))}@keyframes scaleAnimation{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes loadingRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.toasts-lite-enter-active,.toasts-lite-leave-active{transition:opacity .3s ease,transform .3s ease}.toasts-lite-enter-from,.toasts-lite-leave-to{opacity:0;transform:translateY(-10px)}.toasts-lite__toast-container{position:fixed;z-index:9999;margin:10px;overflow:visible;display:flex;flex-direction:column;align-items:center;padding-top:12px;pointer-events:none}.toasts-lite__toast-wrapper{display:flex;flex-direction:column;align-items:center;gap:12px;pointer-events:auto}.toasts-lite__toast{font-family:var(--toasts-lite-font-family);display:flex;justify-content:center;align-items:center;background:var(--toasts-lite-bg);color:var(--toasts-lite-text);border:1px solid var(--toasts-lite-border);box-shadow:var(--toasts-lite-shadow) 0 0 10px;min-width:100px;max-width:1200px;padding:10px 20px;border-radius:8px;cursor:pointer;pointer-events:auto;text-overflow:ellipsis}.toasts-lite__icon{margin-right:12px}.toasts-lite__top-left{top:0;left:0}.toasts-lite__top-center{top:0;left:50%;transform:translate(-50%);min-width:80vw}.toasts-lite__top-right{top:0;right:0}.toasts-lite__bottom-left{bottom:0;left:0}.toasts-lite__bottom-center{bottom:0;left:50%;transform:translate(-50%)}.toasts-lite__bottom-right{bottom:0;right:0}.toasts-lite__middle-center{top:50%;left:50%;transform:translate(-50%,-50%)}.toasts-lite__success{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-success);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__success:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__error{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-error);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__error:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6l-12 12" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="4" stroke="black"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6l-12 12" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__warn{width:20px;height:20px;border-radius:10px;background-color:var(--toasts-lite-warn);position:relative;opacity:0;animation:scaleAnimation .3s cubic-bezier(.75,.885,.32,1.275) forwards;animation-delay:.1s}.toasts-lite__warn:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:12px;height:12px;mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="5" stroke="currentColor" ><path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" /></svg>');-webkit-mask-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="5" stroke="currentColor" ><path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14" /></svg>');background-color:var(--toasts-lite-icon-color);background-size:100%;background-position:center;background-repeat:no-repeat}.toasts-lite__loading{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toasts-lite-loading-border-main);border-right-color:var(--toasts-lite-loading-border-bg);animation:loadingRotate 1s linear infinite}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-toasts-lite",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "scheron",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "description": "Lightweight toast notifications for Vue 3",
13
- "keywords": [ "vue", "toast", "notification", "vue3" ],
13
+ "keywords": ["vue", "toast", "notification", "vue3"],
14
14
  "files": [
15
15
  "dist"
16
16
  ],
@@ -25,6 +25,10 @@
25
25
  },
26
26
  "scripts": {
27
27
  "dev": "vite",
28
+ "format": "prettier --write src/",
29
+ "format:example": "prettier --write example/",
30
+ "format:all": "bun run format && bun run format:example",
31
+ "typecheck": "vue-tsc",
28
32
  "build": "vite build",
29
33
  "build:example": "cd example && bun run build",
30
34
  "preview": "vite preview"
@@ -33,11 +37,14 @@
33
37
  "vue": "^3.0.0"
34
38
  },
35
39
  "devDependencies": {
40
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
36
41
  "@types/node": "^25.0.8",
37
42
  "@vitejs/plugin-vue": "^5.0.0",
43
+ "prettier": "^3.8.0",
38
44
  "typescript": "^5.8.3",
39
45
  "vite": "^5.0.0",
40
46
  "vite-plugin-dts": "^4.5.4",
41
- "vue": "^3.0.0"
47
+ "vue": "^3.0.0",
48
+ "vue-tsc": "^3.2.2"
42
49
  }
43
50
  }