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