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