kitzo 2.3.33 → 2.3.34
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.
|
@@ -31,17 +31,19 @@ function c(t = !0) {
|
|
|
31
31
|
}
|
|
32
32
|
document.addEventListener("pointerdown", (t) => {
|
|
33
33
|
const s = t.target.closest(".kitzo-toast");
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
s && (e = s, l = s.id, u = t.clientX, r = 0, i = !0, o = !1, a = t.pointerId);
|
|
35
|
+
});
|
|
36
|
+
document.addEventListener("pointermove", (t) => {
|
|
37
|
+
if (!i || !e) return;
|
|
38
|
+
if (r = t.clientX - u, !o && Math.abs(r) > w) {
|
|
39
|
+
o = !0, e.classList.add("is-swiping");
|
|
36
40
|
try {
|
|
37
|
-
|
|
41
|
+
e.setPointerCapture(t.pointerId), document.body.style.userSelect = "none";
|
|
38
42
|
} catch {
|
|
39
|
-
console.error("");
|
|
43
|
+
console.error("Failed to capture pointer");
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
document.addEventListener("pointermove", (t) => {
|
|
44
|
-
if (!i || !e || (r = t.clientX - u, !o && Math.abs(r) > w && (o = !0, e.classList.add("is-swiping")), !o)) return;
|
|
46
|
+
if (!o) return;
|
|
45
47
|
const s = d(e) ? r : b(r);
|
|
46
48
|
e.style.setProperty("--swipe-x", `${s}px`);
|
|
47
49
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createToast as
|
|
1
|
+
import { createToast as o, updateToast as s, genId as c } from "./createToast.js";
|
|
2
2
|
import { notify as e } from "./listenar.js";
|
|
3
3
|
const i = (r, t) => {
|
|
4
4
|
r != null && e(
|
|
5
|
-
|
|
5
|
+
o({
|
|
6
6
|
type: "default",
|
|
7
7
|
action: "add",
|
|
8
8
|
content: r,
|
|
@@ -11,11 +11,11 @@ const i = (r, t) => {
|
|
|
11
11
|
);
|
|
12
12
|
};
|
|
13
13
|
i.dismiss = (r) => {
|
|
14
|
-
e({ action: "dismiss", id: r });
|
|
14
|
+
console.log(r), e({ action: "dismiss", id: r });
|
|
15
15
|
};
|
|
16
16
|
i.info = (r, t) => {
|
|
17
17
|
r != null && e(
|
|
18
|
-
|
|
18
|
+
o({
|
|
19
19
|
action: "add",
|
|
20
20
|
type: "info",
|
|
21
21
|
content: r,
|
|
@@ -25,7 +25,7 @@ i.info = (r, t) => {
|
|
|
25
25
|
};
|
|
26
26
|
i.success = (r, t) => {
|
|
27
27
|
r != null && e(
|
|
28
|
-
|
|
28
|
+
o({
|
|
29
29
|
action: "add",
|
|
30
30
|
type: "success",
|
|
31
31
|
content: r,
|
|
@@ -35,7 +35,7 @@ i.success = (r, t) => {
|
|
|
35
35
|
};
|
|
36
36
|
i.warning = (r, t) => {
|
|
37
37
|
r != null && e(
|
|
38
|
-
|
|
38
|
+
o({
|
|
39
39
|
action: "add",
|
|
40
40
|
type: "warning",
|
|
41
41
|
content: r,
|
|
@@ -45,7 +45,7 @@ i.warning = (r, t) => {
|
|
|
45
45
|
};
|
|
46
46
|
i.error = (r, t) => {
|
|
47
47
|
r != null && e(
|
|
48
|
-
|
|
48
|
+
o({
|
|
49
49
|
action: "add",
|
|
50
50
|
type: "error",
|
|
51
51
|
content: r,
|
|
@@ -55,7 +55,7 @@ i.error = (r, t) => {
|
|
|
55
55
|
};
|
|
56
56
|
i.loading = (r, t) => {
|
|
57
57
|
r != null && e(
|
|
58
|
-
|
|
58
|
+
o({
|
|
59
59
|
action: "add",
|
|
60
60
|
type: "loading",
|
|
61
61
|
content: r,
|
|
@@ -65,7 +65,7 @@ i.loading = (r, t) => {
|
|
|
65
65
|
};
|
|
66
66
|
i.custom = (r, t) => {
|
|
67
67
|
r != null && e(
|
|
68
|
-
|
|
68
|
+
o({
|
|
69
69
|
action: "add",
|
|
70
70
|
type: "custom",
|
|
71
71
|
content: r,
|
|
@@ -79,7 +79,7 @@ i.update = (r, t, n) => {
|
|
|
79
79
|
i.promise = (async (r, t, n) => {
|
|
80
80
|
const u = c();
|
|
81
81
|
e(
|
|
82
|
-
|
|
82
|
+
o({
|
|
83
83
|
action: "add",
|
|
84
84
|
type: "loading",
|
|
85
85
|
content: t.loading,
|
|
@@ -88,11 +88,11 @@ i.promise = (async (r, t, n) => {
|
|
|
88
88
|
})
|
|
89
89
|
);
|
|
90
90
|
try {
|
|
91
|
-
const
|
|
92
|
-
return i.update(u, d, { ...n, type: "success" }),
|
|
93
|
-
} catch (
|
|
94
|
-
const d = typeof t.error == "function" ? await t.error(
|
|
95
|
-
throw i.update(u, d, { ...n, type: "error" }),
|
|
91
|
+
const a = await r, d = typeof t.success == "function" ? await t.success(a) : t.success;
|
|
92
|
+
return i.update(u, d, { ...n, type: "success" }), a;
|
|
93
|
+
} catch (a) {
|
|
94
|
+
const d = typeof t.error == "function" ? await t.error(a) : t.error;
|
|
95
|
+
throw i.update(u, d, { ...n, type: "error" }), a;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
export {
|