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