lkt-toast 1.0.0 → 1.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/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare function P(t: any): void;
|
|
2
|
-
declare namespace
|
|
2
|
+
declare namespace W {
|
|
3
3
|
function install(t: any): void;
|
|
4
4
|
}
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
export { P as closeToast,
|
|
5
|
+
declare function S(t: any): void;
|
|
6
|
+
declare function Y(t: any): void;
|
|
7
|
+
export { P as closeToast, W as default, S as openToast, Y as setToastCanvas };
|
package/dist/build.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as $, ref as m, computed as
|
|
2
|
-
import { extractI18nValue as U } from "lkt-vue-kernel";
|
|
1
|
+
import { defineComponent as $, mergeDefaults as B, ref as m, computed as c, onMounted as D, resolveComponent as b, createElementBlock as v, openBlock as l, normalizeClass as C, createElementVNode as i, createVNode as N, createBlock as _, createCommentVNode as w, unref as E, getCurrentInstance as H, Fragment as L, renderList as M, mergeProps as R } from "vue";
|
|
2
|
+
import { extractI18nValue as U, getDefaultValues as j, Toast as A } from "lkt-vue-kernel";
|
|
3
3
|
const y = class y {
|
|
4
4
|
};
|
|
5
5
|
y.canvas = void 0, y.defaultCloseIcon = "";
|
|
6
|
-
let
|
|
6
|
+
let p = y;
|
|
7
7
|
const o = class o {
|
|
8
8
|
static open(n) {
|
|
9
9
|
o.components.push({ ...n, zIndex: o.zIndex }), ++o.zIndex;
|
|
@@ -14,25 +14,25 @@ const o = class o {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
o.components = [], o.zIndex = 1e3;
|
|
17
|
-
let
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
17
|
+
let f = o;
|
|
18
|
+
const S = (t) => {
|
|
19
|
+
if (!p.canvas) {
|
|
20
20
|
console.warn("ToastCanvas not defined");
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
f.open(t), p.canvas.refresh();
|
|
24
24
|
}, P = (t) => {
|
|
25
|
-
if (!
|
|
25
|
+
if (!p.canvas) {
|
|
26
26
|
console.warn("ToastCanvas not defined");
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
},
|
|
29
|
+
f.close(t), p.canvas.refresh();
|
|
30
|
+
}, F = {
|
|
31
31
|
class: "lkt-toast-inner",
|
|
32
32
|
ref: "inner"
|
|
33
|
-
},
|
|
33
|
+
}, q = { class: "lkt-toast-header" }, G = ["innerHTML"], z = /* @__PURE__ */ $({
|
|
34
34
|
__name: "LktToast",
|
|
35
|
-
props: {
|
|
35
|
+
props: /* @__PURE__ */ B({
|
|
36
36
|
type: {},
|
|
37
37
|
text: {},
|
|
38
38
|
icon: {},
|
|
@@ -40,40 +40,40 @@ const K = (t) => {
|
|
|
40
40
|
duration: {},
|
|
41
41
|
buttonConfig: {},
|
|
42
42
|
zIndex: {}
|
|
43
|
-
},
|
|
43
|
+
}, j(A)),
|
|
44
44
|
setup(t) {
|
|
45
|
-
const n = t, s = m(100), u = n.duration ?? 1e4, d = m(null), k = m(!1), h =
|
|
45
|
+
const n = t, s = m(100), u = n.duration ?? 1e4, d = m(null), k = m(!1), h = c(() => {
|
|
46
46
|
let r = [];
|
|
47
47
|
return k.value && r.push("is-visible"), n.positionX && r.push(`animation-${n.positionX}`), r.join(" ");
|
|
48
|
-
}),
|
|
48
|
+
}), g = c(() => U(n.text)), x = () => {
|
|
49
49
|
P(n.zIndex);
|
|
50
50
|
}, I = () => {
|
|
51
51
|
d.value.pause();
|
|
52
52
|
}, T = () => {
|
|
53
53
|
d.value.start();
|
|
54
54
|
};
|
|
55
|
-
return
|
|
55
|
+
return D(() => {
|
|
56
56
|
setTimeout(() => {
|
|
57
57
|
k.value = !0;
|
|
58
58
|
}, 100);
|
|
59
59
|
}), (r, e) => {
|
|
60
60
|
const V = b("lkt-icon"), a = b("lkt-progress");
|
|
61
|
-
return
|
|
61
|
+
return l(), v("section", {
|
|
62
62
|
class: C(["lkt-toast", h.value]),
|
|
63
63
|
onMouseenter: I,
|
|
64
64
|
onMousemove: I,
|
|
65
65
|
onMouseleave: T
|
|
66
66
|
}, [
|
|
67
|
-
i("div",
|
|
68
|
-
i("div",
|
|
69
|
-
r.icon ? (
|
|
67
|
+
i("div", F, [
|
|
68
|
+
i("div", q, [
|
|
69
|
+
r.icon ? (l(), _(V, {
|
|
70
70
|
key: 0,
|
|
71
71
|
icon: r.icon
|
|
72
72
|
}, null, 8, ["icon"])) : w("", !0),
|
|
73
73
|
i("div", {
|
|
74
74
|
class: "lkt-toast-text",
|
|
75
|
-
innerHTML:
|
|
76
|
-
}, null, 8,
|
|
75
|
+
innerHTML: g.value
|
|
76
|
+
}, null, 8, G),
|
|
77
77
|
i("div", {
|
|
78
78
|
class: "lkt-toast-close",
|
|
79
79
|
onClick: e[0] || (e[0] = (X) => E(P)(r.zIndex))
|
|
@@ -90,13 +90,13 @@ const K = (t) => {
|
|
|
90
90
|
type: "decremental",
|
|
91
91
|
"value-format": "hidden",
|
|
92
92
|
"pause-on-hover": "",
|
|
93
|
-
onEnd:
|
|
93
|
+
onEnd: x
|
|
94
94
|
}, null, 8, ["modelValue", "duration"])
|
|
95
95
|
], 512)
|
|
96
96
|
], 34);
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
}),
|
|
99
|
+
}), J = { class: "lkt-toast-canvas" }, K = /* @__PURE__ */ $({
|
|
100
100
|
__name: "LktToastCanvas",
|
|
101
101
|
setup(t, { expose: n }) {
|
|
102
102
|
const s = m(0), u = H(), d = m([]), k = () => {
|
|
@@ -104,14 +104,14 @@ const K = (t) => {
|
|
|
104
104
|
var e;
|
|
105
105
|
(e = u == null ? void 0 : u.proxy) == null || e.$forceUpdate();
|
|
106
106
|
}, 1);
|
|
107
|
-
}, h =
|
|
107
|
+
}, h = c(() => (s.value, f.components.filter((e) => e.positionX === "left"))), g = c(() => (s.value, f.components.filter((e) => e.positionX === "center"))), x = c(() => (s.value, f.components.filter((e) => e.positionX === "right"))), I = c(() => h.value.length === 0 ? "" : "is-visible"), T = c(() => g.value.length === 0 ? "" : "is-visible"), r = c(() => x.value.length === 0 ? "" : "is-visible");
|
|
108
108
|
return n({
|
|
109
109
|
refresh: k
|
|
110
|
-
}), (e, V) => (
|
|
110
|
+
}), (e, V) => (l(), v("section", J, [
|
|
111
111
|
i("div", {
|
|
112
112
|
class: C(["lkt-toast-stack left-stack", I.value])
|
|
113
113
|
}, [
|
|
114
|
-
(
|
|
114
|
+
(l(!0), v(L, null, M(h.value, (a) => (l(), _(z, R({
|
|
115
115
|
ref_for: !0,
|
|
116
116
|
ref_key: "instanceReferences",
|
|
117
117
|
ref: d,
|
|
@@ -121,7 +121,7 @@ const K = (t) => {
|
|
|
121
121
|
i("div", {
|
|
122
122
|
class: C(["lkt-toast-stack center-stack", T.value])
|
|
123
123
|
}, [
|
|
124
|
-
(
|
|
124
|
+
(l(!0), v(L, null, M(g.value, (a) => (l(), _(z, R({
|
|
125
125
|
ref_for: !0,
|
|
126
126
|
ref_key: "instanceReferences",
|
|
127
127
|
ref: d,
|
|
@@ -131,7 +131,7 @@ const K = (t) => {
|
|
|
131
131
|
i("div", {
|
|
132
132
|
class: C(["lkt-toast-stack right-stack", r.value])
|
|
133
133
|
}, [
|
|
134
|
-
(
|
|
134
|
+
(l(!0), v(L, null, M(x.value, (a) => (l(), _(z, R({
|
|
135
135
|
ref_for: !0,
|
|
136
136
|
ref_key: "instanceReferences",
|
|
137
137
|
ref: d,
|
|
@@ -140,16 +140,16 @@ const K = (t) => {
|
|
|
140
140
|
], 2)
|
|
141
141
|
]));
|
|
142
142
|
}
|
|
143
|
-
}),
|
|
143
|
+
}), W = {
|
|
144
144
|
install: (t) => {
|
|
145
|
-
t.component("lkt-toast-canvas") === void 0 && t.component("lkt-toast-canvas",
|
|
145
|
+
t.component("lkt-toast-canvas") === void 0 && t.component("lkt-toast-canvas", K), t.component("lkt-toast") === void 0 && t.component("lkt-toast", z);
|
|
146
146
|
}
|
|
147
|
-
},
|
|
148
|
-
|
|
147
|
+
}, Y = (t) => {
|
|
148
|
+
p.canvas = t;
|
|
149
149
|
};
|
|
150
150
|
export {
|
|
151
151
|
P as closeToast,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
W as default,
|
|
153
|
+
S as openToast,
|
|
154
|
+
Y as setToastCanvas
|
|
155
155
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { ToastConfig } from "lkt-vue-kernel";
|
|
2
|
-
declare const _default: import("vue").DefineComponent<ToastConfig, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToastConfig> & Readonly<{}>, {
|
|
2
|
+
declare const _default: import("vue").DefineComponent<ToastConfig, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToastConfig> & Readonly<{}>, {
|
|
3
|
+
type: import("lkt-vue-kernel").ToastType;
|
|
4
|
+
positionX: import("lkt-vue-kernel").ToastPositionX;
|
|
5
|
+
zIndex: number;
|
|
6
|
+
text: string | number;
|
|
7
|
+
icon: string | number;
|
|
8
|
+
duration: number;
|
|
9
|
+
buttonConfig: import("lkt-vue-kernel").ButtonConfig;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
11
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {computed, onMounted, ref} from 'vue';
|
|
3
|
-
import {extractI18nValue, ToastConfig} from "lkt-vue-kernel";
|
|
3
|
+
import {extractI18nValue, getDefaultValues, Toast, ToastConfig} from "lkt-vue-kernel";
|
|
4
4
|
import {closeToast} from "../functions/functions";
|
|
5
5
|
|
|
6
|
-
const props = withDefaults(defineProps<ToastConfig>(),
|
|
6
|
+
const props = withDefaults(defineProps<ToastConfig>(), getDefaultValues(Toast));
|
|
7
7
|
|
|
8
8
|
const progressPercentage = ref(100),
|
|
9
9
|
timeoutDuration = props.duration ?? 10000,
|