vue-toasts-lite 0.1.0 → 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
@@ -1,7 +1,15 @@
1
1
  # Vue Toasts Lite
2
2
 
3
+ [![npm version](https://badge.fury.io/js/vue-toasts-lite.svg)](https://www.npmjs.com/package/vue-toasts-lite)
4
+ [![Documentation](https://img.shields.io/badge/docs-available-brightgreen)](https://scheron.github.io/vue-toasts-lite/)
5
+
3
6
  A lightweight toast notifications library for Vue 3.
4
7
 
8
+ 📖 **[Check docs](https://scheron.github.io/vue-toasts-lite/)**
9
+
10
+ > ⚠️ **Note**: This is primarily a personal utility library created for my own use. I don't discourage others from using it, but I should mention that I'm not currently using it in production myself. The main purpose of this library is to provide me with a simple and quick way to integrate toast notifications into my personal projects without the need to configure and set up larger, more complex libraries. If you find it useful, feel free to use it, but keep in mind that it's tailored to my personal needs and workflow.
11
+
12
+
5
13
  ## Features
6
14
 
7
15
  - 🚀 Lightweight and easy to use
@@ -12,21 +20,14 @@ A lightweight toast notifications library for Vue 3.
12
20
  - 🎯 Promise support
13
21
  - 🖱️ Pause on hover
14
22
 
15
- ## Installation
23
+ ## Quick Start
16
24
 
25
+ ### 1. Install the package:
17
26
  ```bash
18
27
  npm install vue-toasts-lite
19
28
  ```
20
29
 
21
- ## Quick Start
22
-
23
- **Three steps to start using toasts:**
24
-
25
- 1. Install the package
26
- 2. Add `ToastsLiteProvider` to your app
27
- 3. Call `toasts.success()` from anywhere
28
-
29
- ### 1. Add the provider to your `App.vue`:
30
+ ### 2. Add `ToastsLiteProvider` & `vue-toasts-lite/style.css` to app:
30
31
 
31
32
  ```vue
32
33
  <script setup>
@@ -42,7 +43,7 @@ import 'vue-toasts-lite/style.css'
42
43
  </template>
43
44
  ```
44
45
 
45
- ### 2. Use anywhere in your app:
46
+ ### 3. Use anywhere in your app:
46
47
 
47
48
  ```vue
48
49
  <script setup>
@@ -121,14 +122,6 @@ await toasts.promise(
121
122
  )
122
123
  ```
123
124
 
124
- ### Custom Controller
125
-
126
- ```js
127
- import { ToastsController } from 'vue-toasts-lite'
128
-
129
- const notifications = new ToastsController()
130
- notifications.success('Hello!')
131
- ```
132
125
 
133
126
  ## Styling
134
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
- var M = Object.defineProperty;
2
- var O = (a, t, e) => t in a ? M(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var v = (a, t, e) => O(a, typeof t != "symbol" ? t + "" : t, e);
4
- import { defineComponent as C, ref as h, watchEffect as E, createElementBlock as f, openBlock as c, withModifiers as $, normalizeStyle as U, createCommentVNode as k, createElementVNode as _, normalizeClass as L, toDisplayString as D, computed as g, onBeforeUpdate as x, createBlock as b, Teleport as B, Fragment as T, renderList as w, createVNode as A, TransitionGroup as I, withCtx as N, unref as P } 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__ */ C({
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, l = h(null), p = h(0), d = h(0);
21
- function s() {
22
- l.value && clearTimeout(l.value), n("close");
23
- }
24
- function r() {
25
- l.value && (clearTimeout(l.value), l.value = null, d.value = o.duration - (Date.now() - p.value));
26
- }
27
- function i() {
28
- !l.value && d.value > 0 && (l.value = setTimeout(s, d.value));
29
- }
30
- return E(() => {
31
- o.autoClose && (p.value = Date.now(), d.value = o.duration, l.value = setTimeout(s, o.duration));
32
- }), t({
33
- pause: r,
34
- resume: i
35
- }), (u, m) => (c(), f("div", {
36
- class: "toasts-lite__toast",
37
- style: U(`--toast-duration: ${a.duration}s;`),
38
- onClick: $(s, ["prevent"])
39
- }, [
40
- ["success", "error", "loading", "warn"].includes(a.type) ? (c(), f("div", S, [
41
- _("div", {
42
- class: L(`toasts-lite__${a.type}`)
43
- }, null, 2)
44
- ])) : k("", !0),
45
- _("div", V, [
46
- _("div", z, D(a.message), 1)
47
- ])
48
- ], 4));
49
- }
50
- });
51
- class R extends Map {
1
+ var L = Object.defineProperty;
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
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
38
  v(this, "counter", 0);
85
39
  v(this, "toasts");
86
- this.toasts = new R();
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,71 +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__ */ C({
188
- __name: "ToastsLiteProvider",
189
- setup(a) {
190
- const t = h(y.toastList);
191
- y.onToastsListChange((s) => {
192
- t.value = s;
193
- });
194
- const e = g(() => {
195
- const s = /* @__PURE__ */ new Map();
196
- return t.value.forEach((r) => {
197
- const i = r.position || "top-center";
198
- s.has(i) || s.set(i, []), s.get(i).push(r);
199
- }), s;
200
- }), o = g(() => Array.from(e.value.keys())), n = h({});
201
- x(() => {
202
- for (const s of o.value)
203
- n.value[s] = [];
204
- });
205
- function l(s) {
206
- 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");
207
181
  }
208
- function p(s) {
209
- n.value[s] && n.value[s].forEach((r) => r == null ? void 0 : r.resume());
182
+ function u() {
183
+ o.value && (clearTimeout(o.value), o.value = null, i.value = s.duration - (Date.now() - a.value));
210
184
  }
211
- function d(s, r) {
212
- n.value[s] || (n.value[s] = []), r && "pause" in r && "resume" in r && n.value[s].push(r);
185
+ function l() {
186
+ !o.value && i.value > 0 && (a.value = Date.now(), o.value = setTimeout(c, i.value));
213
187
  }
214
- return (s, r) => (c(), b(B, { to: "body" }, [
215
- (c(!0), f(T, null, w(o.value, (i) => (c(), f("div", {
216
- key: i,
217
- class: L(["toasts-lite__toast-container", `toasts-lite__${i}`]),
218
- onMouseenter: (u) => l(i),
219
- onMouseleave: (u) => p(i)
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));
190
+ }
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", {
234
+ key: u,
235
+ class: O(["toasts-lite__toast-container", `toasts-lite__${u}`])
220
236
  }, [
221
- A(I, { name: "toasts-lite" }, {
222
- default: N(() => [
223
- (c(!0), f(T, null, w(e.value.get(i), (u) => (c(), b(F, {
224
- id: u.id,
225
- ref_for: !0,
226
- ref: (m) => d(i, m),
227
- key: u.id,
228
- type: u.type,
229
- message: u.message,
230
- "auto-close": u.autoClose,
231
- duration: u.duration,
232
- position: u.position,
233
- onClose: (m) => P(y).remove(u.id)
234
- }, null, 8, ["id", "type", "message", "auto-close", "duration", "position", "onClose"]))), 128))
235
- ]),
236
- _: 2
237
- }, 1024)
238
- ], 42, H))), 128))
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))
239
264
  ]));
240
265
  }
241
266
  });
242
267
  export {
243
- G as ToastsController,
244
- K as ToastsLiteProvider,
268
+ X as ToastsLiteProvider,
245
269
  y as toasts
246
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.0",
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,18 +25,26 @@
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",
33
+ "build:example": "cd example && bun run build",
29
34
  "preview": "vite preview"
30
35
  },
31
36
  "peerDependencies": {
32
37
  "vue": "^3.0.0"
33
38
  },
34
39
  "devDependencies": {
40
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
35
41
  "@types/node": "^25.0.8",
36
42
  "@vitejs/plugin-vue": "^5.0.0",
43
+ "prettier": "^3.8.0",
37
44
  "typescript": "^5.8.3",
38
45
  "vite": "^5.0.0",
39
46
  "vite-plugin-dts": "^4.5.4",
40
- "vue": "^3.0.0"
47
+ "vue": "^3.0.0",
48
+ "vue-tsc": "^3.2.2"
41
49
  }
42
50
  }