lkt-toast 1.1.5 → 1.2.0
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 +6 -6
- package/dist/build.js +85 -111
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
- package/src/lib-components/LktToast.vue +1 -1
- package/src/lib-components/LktToastCanvas.vue +1 -2
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(
|
|
1
|
+
import { closeToast as oe } from "lkt-vue-kernel";
|
|
2
|
+
declare namespace Z {
|
|
3
|
+
function install(t: any): void;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
declare function
|
|
7
|
-
export {
|
|
5
|
+
import { openToast as ne } from "lkt-vue-kernel";
|
|
6
|
+
declare function ee(t: any): void;
|
|
7
|
+
export { oe as closeToast, Z as default, ne as openToast, ee as setToastCanvas };
|
package/dist/build.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { extractI18nValue as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
M.canvas = void 0, M.defaultCloseIcon = "";
|
|
6
|
-
let f = M;
|
|
7
|
-
const o = class o {
|
|
8
|
-
static open(s) {
|
|
9
|
-
o.components.push({ ...s, zIndex: o.zIndex }), ++o.zIndex;
|
|
10
|
-
}
|
|
11
|
-
static close(s) {
|
|
12
|
-
const n = o.components.findIndex((i) => i.zIndex === s);
|
|
13
|
-
n >= 0 && (o.components.splice(n, 1), o.components.length === 0 && (o.zIndex = 1e3));
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
o.components = [], o.zIndex = 1e3;
|
|
17
|
-
let d = o;
|
|
18
|
-
const se = (e) => {
|
|
19
|
-
if (!f.canvas) {
|
|
20
|
-
console.warn("ToastCanvas not defined");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
d.open(e), f.canvas.refresh();
|
|
24
|
-
}, D = (e) => {
|
|
25
|
-
if (!f.canvas) {
|
|
26
|
-
console.warn("ToastCanvas not defined");
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
d.close(e), f.canvas.refresh();
|
|
30
|
-
}, G = {
|
|
1
|
+
import { defineComponent as H, mergeDefaults as D, ref as m, computed as r, onMounted as $, resolveComponent as z, createElementBlock as d, openBlock as n, normalizeClass as v, createElementVNode as o, createVNode as S, createBlock as h, createCommentVNode as B, unref as i, mergeProps as T, getCurrentInstance as E, Fragment as V, renderList as R } from "vue";
|
|
2
|
+
import { extractI18nValue as P, LktSettings as F, closeToast as b, ProgressValueFormat as N, ProgressAnimation as A, getDefaultValues as U, Toast as j, ToastController as y } from "lkt-vue-kernel";
|
|
3
|
+
import { closeToast as oe, openToast as ne } from "lkt-vue-kernel";
|
|
4
|
+
const O = {
|
|
31
5
|
class: "lkt-toast-inner",
|
|
32
6
|
ref: "inner"
|
|
33
|
-
},
|
|
7
|
+
}, q = { class: "lkt-toast-header" }, w = { class: "lkt-toast-header-text" }, G = ["innerHTML"], J = ["innerHTML"], L = /* @__PURE__ */ H({
|
|
34
8
|
__name: "LktToast",
|
|
35
|
-
props: /* @__PURE__ */
|
|
9
|
+
props: /* @__PURE__ */ D({
|
|
36
10
|
type: {},
|
|
37
11
|
text: {},
|
|
38
12
|
details: {},
|
|
@@ -41,75 +15,75 @@ const se = (e) => {
|
|
|
41
15
|
duration: {},
|
|
42
16
|
buttonConfig: {},
|
|
43
17
|
zIndex: {}
|
|
44
|
-
},
|
|
45
|
-
setup(
|
|
46
|
-
const
|
|
47
|
-
let
|
|
48
|
-
return
|
|
49
|
-
}), _ =
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
18
|
+
}, U(j)),
|
|
19
|
+
setup(t) {
|
|
20
|
+
const a = t, l = m(100), u = a.duration ?? 1e4, c = m(null), p = m(!1), k = r(() => {
|
|
21
|
+
let e = [];
|
|
22
|
+
return p.value && e.push("is-visible"), a.positionX && e.push(`animation-${a.positionX}`), e.join(" ");
|
|
23
|
+
}), _ = r(() => P(a.text)), g = r(() => P(a.details)), I = F.defaultCloseToastIcon, x = () => {
|
|
24
|
+
c.value.pause();
|
|
25
|
+
}, M = () => {
|
|
26
|
+
c.value.start();
|
|
53
27
|
};
|
|
54
|
-
return
|
|
28
|
+
return $(() => {
|
|
55
29
|
setTimeout(() => {
|
|
56
|
-
|
|
30
|
+
p.value = !0;
|
|
57
31
|
}, 100);
|
|
58
|
-
}), (
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
class:
|
|
32
|
+
}), (e, f) => {
|
|
33
|
+
const s = z("lkt-icon"), X = z("lkt-progress");
|
|
34
|
+
return n(), d("section", {
|
|
35
|
+
class: v(["lkt-toast", k.value]),
|
|
62
36
|
role: "status",
|
|
63
37
|
"aria-live": "polite",
|
|
64
38
|
"aria-atomic": "true",
|
|
65
|
-
onMouseenter:
|
|
66
|
-
onMousemove:
|
|
67
|
-
onMouseleave:
|
|
39
|
+
onMouseenter: x,
|
|
40
|
+
onMousemove: x,
|
|
41
|
+
onMouseleave: M
|
|
68
42
|
}, [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
43
|
+
o("div", O, [
|
|
44
|
+
o("div", q, [
|
|
45
|
+
o("div", w, [
|
|
46
|
+
t.icon ? (n(), h(s, {
|
|
73
47
|
key: 0,
|
|
74
|
-
icon:
|
|
75
|
-
}, null, 8, ["icon"])) :
|
|
76
|
-
|
|
48
|
+
icon: t.icon
|
|
49
|
+
}, null, 8, ["icon"])) : B("", !0),
|
|
50
|
+
o("div", {
|
|
77
51
|
class: "lkt-toast-text",
|
|
78
52
|
innerHTML: _.value
|
|
79
|
-
}, null, 8,
|
|
53
|
+
}, null, 8, G)
|
|
80
54
|
]),
|
|
81
|
-
|
|
55
|
+
o("div", {
|
|
82
56
|
class: "lkt-toast-close",
|
|
83
|
-
onClick:
|
|
57
|
+
onClick: f[0] || (f[0] = (C) => i(b)(t.zIndex))
|
|
84
58
|
}, [
|
|
85
|
-
|
|
86
|
-
class:
|
|
59
|
+
o("i", {
|
|
60
|
+
class: v(i(I))
|
|
87
61
|
}, null, 2)
|
|
88
62
|
])
|
|
89
63
|
]),
|
|
90
|
-
|
|
64
|
+
o("div", {
|
|
91
65
|
class: "lkt-toast-details",
|
|
92
|
-
innerHTML:
|
|
93
|
-
}, null, 8,
|
|
94
|
-
|
|
66
|
+
innerHTML: g.value
|
|
67
|
+
}, null, 8, J),
|
|
68
|
+
S(X, T({
|
|
95
69
|
ref_key: "progressRef",
|
|
96
|
-
ref:
|
|
97
|
-
modelValue:
|
|
98
|
-
"onUpdate:modelValue":
|
|
70
|
+
ref: c,
|
|
71
|
+
modelValue: l.value,
|
|
72
|
+
"onUpdate:modelValue": f[1] || (f[1] = (C) => l.value = C)
|
|
99
73
|
}, {
|
|
100
|
-
duration:
|
|
74
|
+
duration: i(u),
|
|
101
75
|
animation: {
|
|
102
|
-
type:
|
|
76
|
+
type: i(A).Decremental,
|
|
103
77
|
autoplay: !0,
|
|
104
78
|
externalControl: !1,
|
|
105
79
|
to: 0,
|
|
106
80
|
from: 100
|
|
107
81
|
},
|
|
108
|
-
valueFormat:
|
|
82
|
+
valueFormat: i(N).Hidden,
|
|
109
83
|
pauseOnHover: !0,
|
|
110
84
|
events: {
|
|
111
|
-
updatedVisibleProgress: (
|
|
112
|
-
|
|
85
|
+
updatedVisibleProgress: (C) => {
|
|
86
|
+
C === 0 && i(b)(a.zIndex);
|
|
113
87
|
}
|
|
114
88
|
}
|
|
115
89
|
}), null, 16, ["modelValue"])
|
|
@@ -117,60 +91,60 @@ const se = (e) => {
|
|
|
117
91
|
], 34);
|
|
118
92
|
};
|
|
119
93
|
}
|
|
120
|
-
}),
|
|
94
|
+
}), K = { class: "lkt-toast-canvas" }, Q = /* @__PURE__ */ H({
|
|
121
95
|
__name: "LktToastCanvas",
|
|
122
|
-
setup(
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
var
|
|
126
|
-
(
|
|
96
|
+
setup(t, { expose: a }) {
|
|
97
|
+
const l = m(0), u = E(), c = m([]), p = () => {
|
|
98
|
+
l.value = l.value + 1, setTimeout(() => {
|
|
99
|
+
var e;
|
|
100
|
+
(e = u == null ? void 0 : u.proxy) == null || e.$forceUpdate();
|
|
127
101
|
}, 1);
|
|
128
|
-
},
|
|
129
|
-
return
|
|
130
|
-
refresh:
|
|
131
|
-
}), (
|
|
132
|
-
|
|
133
|
-
class:
|
|
102
|
+
}, k = r(() => (l.value, y.components.filter((e) => e.positionX === "left"))), _ = r(() => (l.value, y.components.filter((e) => e.positionX === "center"))), g = r(() => (l.value, y.components.filter((e) => e.positionX === "right"))), I = r(() => k.value.length === 0 ? "" : "is-visible"), x = r(() => _.value.length === 0 ? "" : "is-visible"), M = r(() => g.value.length === 0 ? "" : "is-visible");
|
|
103
|
+
return a({
|
|
104
|
+
refresh: p
|
|
105
|
+
}), (e, f) => (n(), d("section", K, [
|
|
106
|
+
o("div", {
|
|
107
|
+
class: v(["lkt-toast-stack left-stack", I.value])
|
|
134
108
|
}, [
|
|
135
|
-
(
|
|
109
|
+
(n(!0), d(V, null, R(k.value, (s) => (n(), h(L, T({
|
|
136
110
|
ref_for: !0,
|
|
137
111
|
ref_key: "instanceReferences",
|
|
138
|
-
ref:
|
|
139
|
-
key:
|
|
140
|
-
}, { ref_for: !0 },
|
|
112
|
+
ref: c,
|
|
113
|
+
key: s.zIndex
|
|
114
|
+
}, { ref_for: !0 }, s), null, 16))), 128))
|
|
141
115
|
], 2),
|
|
142
|
-
|
|
143
|
-
class:
|
|
116
|
+
o("div", {
|
|
117
|
+
class: v(["lkt-toast-stack center-stack", x.value])
|
|
144
118
|
}, [
|
|
145
|
-
(
|
|
119
|
+
(n(!0), d(V, null, R(_.value, (s) => (n(), h(L, T({
|
|
146
120
|
ref_for: !0,
|
|
147
121
|
ref_key: "instanceReferences",
|
|
148
|
-
ref:
|
|
149
|
-
key:
|
|
150
|
-
}, { ref_for: !0 },
|
|
122
|
+
ref: c,
|
|
123
|
+
key: s.zIndex
|
|
124
|
+
}, { ref_for: !0 }, s), null, 16))), 128))
|
|
151
125
|
], 2),
|
|
152
|
-
|
|
153
|
-
class:
|
|
126
|
+
o("div", {
|
|
127
|
+
class: v(["lkt-toast-stack right-stack", M.value])
|
|
154
128
|
}, [
|
|
155
|
-
(
|
|
129
|
+
(n(!0), d(V, null, R(g.value, (s) => (n(), h(L, T({
|
|
156
130
|
ref_for: !0,
|
|
157
131
|
ref_key: "instanceReferences",
|
|
158
|
-
ref:
|
|
159
|
-
key:
|
|
160
|
-
}, { ref_for: !0 },
|
|
132
|
+
ref: c,
|
|
133
|
+
key: s.zIndex
|
|
134
|
+
}, { ref_for: !0 }, s), null, 16))), 128))
|
|
161
135
|
], 2)
|
|
162
136
|
]));
|
|
163
137
|
}
|
|
164
|
-
}),
|
|
165
|
-
install: (
|
|
166
|
-
|
|
138
|
+
}), Z = {
|
|
139
|
+
install: (t) => {
|
|
140
|
+
t.component("lkt-toast-canvas") === void 0 && t.component("lkt-toast-canvas", Q), t.component("lkt-toast") === void 0 && t.component("lkt-toast", L);
|
|
167
141
|
}
|
|
168
|
-
},
|
|
169
|
-
|
|
142
|
+
}, ee = (t) => {
|
|
143
|
+
y.canvas = t;
|
|
170
144
|
};
|
|
171
145
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
146
|
+
oe as closeToast,
|
|
147
|
+
Z as default,
|
|
148
|
+
ne as openToast,
|
|
149
|
+
ee as setToastCanvas
|
|
176
150
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin } from 'vue';
|
|
2
2
|
import "./../lkt-toast.css";
|
|
3
|
-
import {
|
|
4
|
-
export { closeToast, openToast } from '
|
|
3
|
+
import { ToastCanvasInterface } from "lkt-vue-kernel";
|
|
4
|
+
export { closeToast, openToast } from 'lkt-vue-kernel';
|
|
5
5
|
declare const LktToast: Plugin;
|
|
6
6
|
export default LktToast;
|
|
7
|
-
export declare const setToastCanvas: (component:
|
|
7
|
+
export declare const setToastCanvas: (component: ToastCanvasInterface) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {computed, onMounted, ref, watch} from 'vue';
|
|
3
3
|
import {
|
|
4
|
+
closeToast,
|
|
4
5
|
extractI18nValue,
|
|
5
6
|
getDefaultValues,
|
|
6
7
|
LktSettings,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
Toast,
|
|
11
12
|
ToastConfig
|
|
12
13
|
} from "lkt-vue-kernel";
|
|
13
|
-
import {closeToast} from "../functions/functions";
|
|
14
14
|
|
|
15
15
|
const props = withDefaults(defineProps<ToastConfig>(), getDefaultValues(Toast));
|
|
16
16
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {computed, getCurrentInstance, ref} from 'vue';
|
|
3
3
|
import LktToast from "../lib-components/LktToast.vue";
|
|
4
|
-
import {ToastConfig} from "lkt-vue-kernel";
|
|
5
|
-
import {ToastController} from "../classes/ToastController";
|
|
4
|
+
import {ToastConfig, ToastController} from "lkt-vue-kernel";
|
|
6
5
|
|
|
7
6
|
const refresher = ref(0);
|
|
8
7
|
const instance = getCurrentInstance();
|