@editora/toast 2.0.0 → 2.0.1
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 +28 -26
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.esm.js +79 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { ToastOptions, ToastInstance, ToastConfig, ToastPlugin, ToastPromiseOptions } from './core/types';
|
|
2
|
-
export type ToastLevel = 'info' | 'success' | 'error';
|
|
3
|
-
export interface ToastOptionsLegacy {
|
|
1
|
+
import { ToastOptions, ToastInstance, ToastConfig, ToastPlugin, ToastPromiseOptions, ToastTheme, ToastPosition } from './core/types';
|
|
2
|
+
export type ToastLevel = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
|
3
|
+
export interface ToastOptionsLegacy extends ToastOptions {
|
|
4
4
|
message: string;
|
|
5
|
-
duration?: number;
|
|
6
|
-
level?: ToastLevel;
|
|
7
5
|
}
|
|
8
6
|
export declare const toast: {
|
|
9
|
-
info: (msg: string,
|
|
7
|
+
info: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
10
8
|
dismiss: () => void;
|
|
11
9
|
};
|
|
12
|
-
success: (msg: string,
|
|
10
|
+
success: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
13
11
|
dismiss: () => void;
|
|
14
12
|
};
|
|
15
|
-
error: (msg: string,
|
|
13
|
+
error: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
14
|
+
dismiss: () => void;
|
|
15
|
+
};
|
|
16
|
+
warning: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
17
|
+
dismiss: () => void;
|
|
18
|
+
};
|
|
19
|
+
loading: (msg: string, optionsOrDuration?: Partial<ToastOptions> | number, theme?: ToastTheme, position?: ToastPosition) => ToastInstance | {
|
|
16
20
|
dismiss: () => void;
|
|
17
21
|
};
|
|
18
22
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -149,7 +149,7 @@ class H {
|
|
|
149
149
|
this.showToast(t);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
class
|
|
152
|
+
class A {
|
|
153
153
|
constructor(t = {}) {
|
|
154
154
|
var s, e, i, r;
|
|
155
155
|
this.config = {
|
|
@@ -166,19 +166,19 @@ class L {
|
|
|
166
166
|
...r
|
|
167
167
|
};
|
|
168
168
|
let o, a = !1;
|
|
169
|
-
const
|
|
169
|
+
const l = Object.keys(s).reduce((u, p) => (u[p] = s[p].from, u), {}), d = Object.keys(s).reduce((u, p) => (u[p] = 0, u), {}), m = () => {
|
|
170
170
|
if (a)
|
|
171
171
|
return;
|
|
172
172
|
let u = !0;
|
|
173
173
|
Object.keys(s).forEach((g) => {
|
|
174
|
-
const b = s[g].to, y =
|
|
175
|
-
d[g] +=
|
|
174
|
+
const b = s[g].to, y = l[g], w = d[g], f = -n.stiffness * (y - b), v = -n.damping * w, x = (f + v) / n.mass;
|
|
175
|
+
d[g] += x * 0.016, l[g] += d[g] * 0.016, (Math.abs(y - b) > n.precision || Math.abs(w) > n.precision) && (u = !1);
|
|
176
176
|
});
|
|
177
|
-
const
|
|
177
|
+
const p = Object.keys(l).reduce((g, b) => {
|
|
178
178
|
const y = s[b].unit || "px";
|
|
179
|
-
return g[b] = `${
|
|
179
|
+
return g[b] = `${l[b]}${y}`, g;
|
|
180
180
|
}, {});
|
|
181
|
-
e(
|
|
181
|
+
e(p), u ? (a = !0, i == null || i()) : o = requestAnimationFrame(m);
|
|
182
182
|
};
|
|
183
183
|
return o = requestAnimationFrame(m), () => {
|
|
184
184
|
a = !0, o && cancelAnimationFrame(o);
|
|
@@ -187,7 +187,7 @@ class L {
|
|
|
187
187
|
}
|
|
188
188
|
class M {
|
|
189
189
|
constructor() {
|
|
190
|
-
this.springAnimation = new
|
|
190
|
+
this.springAnimation = new A();
|
|
191
191
|
}
|
|
192
192
|
// Show toast with specified animation
|
|
193
193
|
async showToast(t, s, e) {
|
|
@@ -303,10 +303,10 @@ class M {
|
|
|
303
303
|
return new Promise((e) => {
|
|
304
304
|
var d, m, u;
|
|
305
305
|
t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
|
|
306
|
-
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 800, a = n === "gentle" ? 0.05 : n === "strong" ? 0.15 : 0.1,
|
|
306
|
+
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 800, a = n === "gentle" ? 0.05 : n === "strong" ? 0.15 : 0.1, l = r === "up" ? 30 : r === "down" ? -30 : r === "left" ? 30 : -30;
|
|
307
307
|
t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
|
|
308
308
|
"transform",
|
|
309
|
-
r === "left" || r === "right" ? `translateX(${
|
|
309
|
+
r === "left" || r === "right" ? `translateX(${l}px) scale(${1 - a})` : `translateY(${l}px) scale(${1 - a})`,
|
|
310
310
|
"important"
|
|
311
311
|
), t.offsetHeight, setTimeout(() => {
|
|
312
312
|
t.style.setProperty(
|
|
@@ -336,8 +336,8 @@ class M {
|
|
|
336
336
|
return new Promise((e) => {
|
|
337
337
|
var d, m, u;
|
|
338
338
|
t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
|
|
339
|
-
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.distance || 100, o = s.easing || "ease-out", a = s.duration || 400,
|
|
340
|
-
t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform",
|
|
339
|
+
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.distance || 100, o = s.easing || "ease-out", a = s.duration || 400, l = r === "up" ? `translateY(${n}px)` : r === "down" ? `translateY(-${n}px)` : r === "left" ? `translateX(${n}px)` : `translateX(-${n}px)`;
|
|
340
|
+
t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", l, "important"), t.offsetHeight, setTimeout(() => {
|
|
341
341
|
t.style.setProperty("transition", `opacity ${a}ms ${o}, transform ${a}ms ${o}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
|
|
342
342
|
t.style.setProperty("transition", "none", "important"), e();
|
|
343
343
|
}, a);
|
|
@@ -439,10 +439,10 @@ class M {
|
|
|
439
439
|
return new Promise((e) => {
|
|
440
440
|
var d, m, u;
|
|
441
441
|
t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
|
|
442
|
-
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 1e3, a = n === "gentle" ? 0.1 : n === "strong" ? 0.3 : 0.2,
|
|
442
|
+
const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((m = t.parentElement) == null ? void 0 : m.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 1e3, a = n === "gentle" ? 0.1 : n === "strong" ? 0.3 : 0.2, l = r === "up" ? 40 : r === "down" ? -40 : r === "left" ? 40 : -40;
|
|
443
443
|
t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
|
|
444
444
|
"transform",
|
|
445
|
-
r === "left" || r === "right" ? `translateX(${
|
|
445
|
+
r === "left" || r === "right" ? `translateX(${l}px) scale(${1 + a})` : `translateY(${l}px) scale(${1 + a})`,
|
|
446
446
|
"important"
|
|
447
447
|
), t.offsetHeight, setTimeout(() => {
|
|
448
448
|
t.style.setProperty(
|
|
@@ -492,8 +492,8 @@ class M {
|
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
const
|
|
496
|
-
class
|
|
495
|
+
const S = new M();
|
|
496
|
+
class q {
|
|
497
497
|
constructor(t) {
|
|
498
498
|
this.containers = /* @__PURE__ */ new Map(), this.cssInjected = !1, this.config = t;
|
|
499
499
|
}
|
|
@@ -554,19 +554,19 @@ class A {
|
|
|
554
554
|
if (n.appendChild(o), s.progress) {
|
|
555
555
|
const a = document.createElement("div");
|
|
556
556
|
a.className = "editora-toast-progress";
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
557
|
+
const l = document.createElement("div");
|
|
558
|
+
if (l.className = "editora-toast-progress-bar", l.style.width = `${Math.min(100, Math.max(0, s.progress.value))}%`, s.progress.showPercentage) {
|
|
559
559
|
const d = document.createElement("span");
|
|
560
560
|
d.className = "editora-toast-progress-text", d.textContent = `${Math.round(s.progress.value)}%`, a.appendChild(d);
|
|
561
561
|
}
|
|
562
|
-
a.appendChild(
|
|
562
|
+
a.appendChild(l), n.appendChild(a);
|
|
563
563
|
}
|
|
564
564
|
if (e.appendChild(n), s.actions && s.actions.length > 0) {
|
|
565
565
|
const a = document.createElement("div");
|
|
566
|
-
a.className = "editora-toast-actions", s.actions.forEach((
|
|
566
|
+
a.className = "editora-toast-actions", s.actions.forEach((l) => {
|
|
567
567
|
const d = document.createElement("button");
|
|
568
|
-
d.className = `editora-toast-action ${
|
|
569
|
-
m.stopPropagation(),
|
|
568
|
+
d.className = `editora-toast-action ${l.primary ? "primary" : ""}`, d.textContent = l.label, d.onclick = (m) => {
|
|
569
|
+
m.stopPropagation(), l.onClick();
|
|
570
570
|
}, a.appendChild(d);
|
|
571
571
|
}), e.appendChild(a);
|
|
572
572
|
}
|
|
@@ -582,7 +582,7 @@ class A {
|
|
|
582
582
|
const s = this.ensureContainer(t.options.position || this.config.position), e = this.createToastElement(t);
|
|
583
583
|
t.element = e, s.appendChild(e);
|
|
584
584
|
const i = t.options.animation || this.config.animation || { type: "css" };
|
|
585
|
-
if (await
|
|
585
|
+
if (await S.showToast(e, t, i), this.config.enableAccessibility && this.announceToast(t), (n = (r = t.options).onShow) == null || n.call(r), !t.options.persistent && t.options.duration !== 0) {
|
|
586
586
|
const o = t.options.duration || this.config.duration;
|
|
587
587
|
t.timeoutId = window.setTimeout(() => {
|
|
588
588
|
this.hideToast(t);
|
|
@@ -596,7 +596,7 @@ class A {
|
|
|
596
596
|
return;
|
|
597
597
|
t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0);
|
|
598
598
|
const s = t.options.animation || this.config.animation || { type: "css" };
|
|
599
|
-
await
|
|
599
|
+
await S.hideToast(t.element, t, s), t.element && t.element.parentNode && (t.element.parentNode.removeChild(t.element), t.element = void 0), (i = (e = t.options).onHide) == null || i.call(e);
|
|
600
600
|
}
|
|
601
601
|
// Update toast content
|
|
602
602
|
async updateToast(t, s) {
|
|
@@ -605,7 +605,7 @@ class A {
|
|
|
605
605
|
return;
|
|
606
606
|
const e = t.options.animation || this.config.animation || { type: "css" };
|
|
607
607
|
if (e.type === "custom" && e.update) {
|
|
608
|
-
await
|
|
608
|
+
await S.updateToast(t.element, t, s, e);
|
|
609
609
|
return;
|
|
610
610
|
}
|
|
611
611
|
Object.assign(t.options, s), s.level && (t.element.className = t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g, ""), t.element.classList.add(`editora-toast--${s.level}`));
|
|
@@ -626,16 +626,16 @@ class A {
|
|
|
626
626
|
if (s.progress) {
|
|
627
627
|
if (!o) {
|
|
628
628
|
o = document.createElement("div"), o.className = "editora-toast-progress";
|
|
629
|
-
const
|
|
630
|
-
|
|
629
|
+
const l = t.element.querySelector(".editora-toast-content");
|
|
630
|
+
l && l.appendChild(o);
|
|
631
631
|
}
|
|
632
632
|
const a = o.querySelector(".editora-toast-progress-bar");
|
|
633
633
|
if (a && (a.style.width = `${Math.min(100, Math.max(0, s.progress.value))}%`), s.progress.showPercentage) {
|
|
634
|
-
let
|
|
635
|
-
|
|
634
|
+
let l = o.querySelector(".editora-toast-progress-text");
|
|
635
|
+
l || (l = document.createElement("span"), l.className = "editora-toast-progress-text", o.insertBefore(l, o.firstChild)), l.textContent = `${Math.round(s.progress.value)}%`;
|
|
636
636
|
} else {
|
|
637
|
-
const
|
|
638
|
-
|
|
637
|
+
const l = o.querySelector(".editora-toast-progress-text");
|
|
638
|
+
l && l.remove();
|
|
639
639
|
}
|
|
640
640
|
} else
|
|
641
641
|
o && o.remove();
|
|
@@ -643,10 +643,10 @@ class A {
|
|
|
643
643
|
if (s.actions !== void 0) {
|
|
644
644
|
let o = t.element.querySelector(".editora-toast-actions");
|
|
645
645
|
s.actions && s.actions.length > 0 ? (o ? o.innerHTML = "" : (o = document.createElement("div"), o.className = "editora-toast-actions", t.element.appendChild(o)), o && s.actions.forEach((a) => {
|
|
646
|
-
const
|
|
647
|
-
|
|
646
|
+
const l = document.createElement("button");
|
|
647
|
+
l.className = `editora-toast-action ${a.primary ? "primary" : ""}`, l.textContent = a.label, l.onclick = (d) => {
|
|
648
648
|
d.stopPropagation(), a.onClick();
|
|
649
|
-
}, o.appendChild(
|
|
649
|
+
}, o.appendChild(l);
|
|
650
650
|
})) : o && o.remove();
|
|
651
651
|
}
|
|
652
652
|
(n = (r = t.options).onUpdate) == null || n.call(r, s);
|
|
@@ -667,26 +667,26 @@ class A {
|
|
|
667
667
|
addSwipeDismiss(t, s) {
|
|
668
668
|
let e = 0, i = 0, r = !1;
|
|
669
669
|
const n = s.options.swipeDirection || this.config.swipeDirection || "any", o = 40;
|
|
670
|
-
let a = "",
|
|
671
|
-
const d = (
|
|
672
|
-
r = !0,
|
|
673
|
-
}, m = (
|
|
670
|
+
let a = "", l = !1;
|
|
671
|
+
const d = (p) => {
|
|
672
|
+
r = !0, l = !1, e = "touches" in p ? p.touches[0].clientX : p.clientX, i = "touches" in p ? p.touches[0].clientY : p.clientY, a = t.style.transform || "", t.style.transition = "none", t.style.cursor = "grabbing", p.preventDefault();
|
|
673
|
+
}, m = (p) => {
|
|
674
674
|
if (!r)
|
|
675
675
|
return;
|
|
676
|
-
const g = "touches" in
|
|
677
|
-
if ((Math.abs(y) > f || Math.abs(w) > f) && (
|
|
678
|
-
const v = Math.abs(w) > Math.abs(y) ? 25 : 20, P = Math.min(Math.max(y * 0.2, -v), v),
|
|
679
|
-
t.style.transform = `${a} translate(${P}px, ${
|
|
676
|
+
const g = "touches" in p ? p.touches[0].clientX : p.clientX, b = "touches" in p ? p.touches[0].clientY : p.clientY, y = g - e, w = b - i, f = 5;
|
|
677
|
+
if ((Math.abs(y) > f || Math.abs(w) > f) && (l = !0), l) {
|
|
678
|
+
const v = Math.abs(w) > Math.abs(y) ? 25 : 20, P = Math.min(Math.max(y * 0.2, -v), v), x = Math.min(Math.max(w * 0.2, -v), v);
|
|
679
|
+
t.style.transform = `${a} translate(${P}px, ${x}px)`;
|
|
680
680
|
}
|
|
681
|
-
(Math.abs(w) > Math.abs(y) || n === "vertical" || n === "up" || n === "down") &&
|
|
682
|
-
}, u = (
|
|
681
|
+
(Math.abs(w) > Math.abs(y) || n === "vertical" || n === "up" || n === "down") && p.preventDefault();
|
|
682
|
+
}, u = (p) => {
|
|
683
683
|
if (!r)
|
|
684
684
|
return;
|
|
685
|
-
if (t.style.transform = a, t.style.transition = "", t.style.cursor = "", !
|
|
685
|
+
if (t.style.transform = a, t.style.transition = "", t.style.cursor = "", !l) {
|
|
686
686
|
r = !1;
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
|
-
const g = "changedTouches" in
|
|
689
|
+
const g = "changedTouches" in p ? p.changedTouches[0].clientX : p.clientX, b = "changedTouches" in p ? p.changedTouches[0].clientY : p.clientY, y = g - e, w = b - i;
|
|
690
690
|
let f = !1;
|
|
691
691
|
const v = n === "vertical" || n === "up" || n === "down", P = v ? 35 : o;
|
|
692
692
|
switch (n) {
|
|
@@ -714,7 +714,7 @@ class A {
|
|
|
714
714
|
}
|
|
715
715
|
v && console.log(`Vertical swipe attempt: direction=${n}, deltaY=${w}, effectiveMinDistance=${P}, shouldDismiss=${f}`), f && s.dismiss(), r = !1;
|
|
716
716
|
};
|
|
717
|
-
t.addEventListener("dragstart", (
|
|
717
|
+
t.addEventListener("dragstart", (p) => p.preventDefault()), t.addEventListener("touchstart", d, { passive: !1 }), t.addEventListener("touchmove", m, { passive: !1 }), t.addEventListener("touchend", u, { passive: !1 }), t.addEventListener("mousedown", d), t.addEventListener("mousemove", m), t.addEventListener("mouseup", u), t.addEventListener("mouseleave", u);
|
|
718
718
|
}
|
|
719
719
|
// Drag dismiss (simplified)
|
|
720
720
|
addDragDismiss(t, s) {
|
|
@@ -754,7 +754,7 @@ class A {
|
|
|
754
754
|
}), this.containers.clear();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
class
|
|
757
|
+
class Y {
|
|
758
758
|
constructor() {
|
|
759
759
|
this.plugins = [], this.hooks = {
|
|
760
760
|
beforeShow: [],
|
|
@@ -864,7 +864,7 @@ class q {
|
|
|
864
864
|
});
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
|
-
const
|
|
867
|
+
const X = {
|
|
868
868
|
position: "bottom-right",
|
|
869
869
|
duration: 4e3,
|
|
870
870
|
maxVisible: 5,
|
|
@@ -884,9 +884,9 @@ const Y = {
|
|
|
884
884
|
animation: { type: "css" }
|
|
885
885
|
// Default to CSS animations
|
|
886
886
|
};
|
|
887
|
-
class
|
|
887
|
+
class C {
|
|
888
888
|
constructor(t = {}) {
|
|
889
|
-
this.idCounter = 0, this.pausedToasts = /* @__PURE__ */ new Set(), this.config = { ...
|
|
889
|
+
this.idCounter = 0, this.pausedToasts = /* @__PURE__ */ new Set(), this.config = { ...X, ...t }, this.store = new k(this.config), this.queue = new H(this.config), this.renderer = new q(this.config), this.lifecycle = new Y(), this.setupWindowFocusHandling();
|
|
890
890
|
}
|
|
891
891
|
// Core API
|
|
892
892
|
show(t) {
|
|
@@ -1012,16 +1012,30 @@ class S {
|
|
|
1012
1012
|
this.windowBlurHandler && typeof window != "undefined" && window.removeEventListener("blur", this.windowBlurHandler), this.windowFocusHandler && typeof window != "undefined" && window.removeEventListener("focus", this.windowFocusHandler), this.clear(), this.renderer.destroy(), this.lifecycle.destroy();
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
|
-
const h = new
|
|
1016
|
-
function
|
|
1015
|
+
const h = new C();
|
|
1016
|
+
function T(c) {
|
|
1017
1017
|
return typeof document == "undefined" ? { dismiss: () => {
|
|
1018
1018
|
} } : h.show(c);
|
|
1019
1019
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1020
|
+
function E(c, t, s, e) {
|
|
1021
|
+
const i = { position: "top-right", theme: "light" };
|
|
1022
|
+
let r = {};
|
|
1023
|
+
return t && typeof t == "object" ? r = { ...t } : typeof t == "number" && (r.duration = t), s && (r.theme = s), e && (r.position = e), {
|
|
1024
|
+
message: c,
|
|
1025
|
+
...r,
|
|
1026
|
+
duration: r.duration,
|
|
1027
|
+
level: r.level || void 0,
|
|
1028
|
+
position: r.position || i.position,
|
|
1029
|
+
theme: r.theme || i.theme
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
const L = {
|
|
1033
|
+
info: (c, t, s, e) => T({ ...E(c, t, s, e), level: "info" }),
|
|
1034
|
+
success: (c, t, s, e) => T({ ...E(c, t, s, e), level: "success" }),
|
|
1035
|
+
error: (c, t, s, e) => T({ ...E(c, t, s, e), level: "error" }),
|
|
1036
|
+
warning: (c, t, s, e) => T({ ...E(c, t, s, e), level: "warning" }),
|
|
1037
|
+
loading: (c, t, s, e) => T({ ...E(c, t, s, e), level: "loading" })
|
|
1038
|
+
}, $ = {
|
|
1025
1039
|
// Core methods
|
|
1026
1040
|
show: (c) => h.show(c),
|
|
1027
1041
|
update: (c, t) => h.update(c, t),
|
|
@@ -1048,14 +1062,14 @@ const C = {
|
|
|
1048
1062
|
// Cleanup
|
|
1049
1063
|
destroy: () => h.destroy()
|
|
1050
1064
|
};
|
|
1051
|
-
typeof window != "undefined" && typeof document != "undefined" && (window.toast =
|
|
1052
|
-
detail: { toast:
|
|
1065
|
+
typeof window != "undefined" && typeof document != "undefined" && (window.toast = L, window.toastAdvanced = $, window.toastPro = $, window.ToastManager = C, window.dispatchEvent(new CustomEvent("toastReady", {
|
|
1066
|
+
detail: { toast: L, toastAdvanced: $, toastPro: $, ToastManager: C }
|
|
1053
1067
|
})));
|
|
1054
1068
|
export {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1069
|
+
C as ToastManager,
|
|
1070
|
+
L as default,
|
|
1071
|
+
L as toast,
|
|
1072
|
+
$ as toastAdvanced,
|
|
1073
|
+
$ as toastPro
|
|
1060
1074
|
};
|
|
1061
1075
|
//# sourceMappingURL=index.esm.js.map
|