lkt-toast 1.1.0 → 1.1.2
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.css +1 -1
- package/dist/build.d.ts +6 -6
- package/dist/build.js +95 -90
- package/package.json +3 -5
- package/src/lib-components/LktToast.vue +11 -4
- package/theme/default.css +1 -1
package/dist/build.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.lkt-toast-canvas{display:block;position:fixed;bottom:0;left:0;right:0;z-index:999}.lkt-toast-stack{display:flex;flex-direction:column-reverse;gap:var(--lkt-toast--stack--gap);position:absolute;bottom:0}.lkt-toast-stack.is-visible{padding-bottom:var(--lkt-toast--stack--padding)}.lkt-toast-stack.right-stack.is-visible{padding-right:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack.is-visible{padding-left:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack{left:0;align-items:flex-start}.lkt-toast-stack.center-stack{left:50%;transform:translate(-50%);align-items:center}.lkt-toast-stack.right-stack{right:0;align-items:flex-end}.lkt-toast{padding:var(--lkt-toast--toast--padding);border-radius:var(--lkt-toast--toast--border-radius);background:var(--lkt-toast--toast--
|
|
1
|
+
.lkt-toast-canvas{display:block;position:fixed;bottom:0;left:0;right:0;z-index:999}.lkt-toast-stack{display:flex;flex-direction:column-reverse;gap:var(--lkt-toast--stack--gap);position:absolute;bottom:0}.lkt-toast-stack.is-visible{padding-bottom:var(--lkt-toast--stack--padding)}.lkt-toast-stack.right-stack.is-visible{padding-right:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack.is-visible{padding-left:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack{left:0;align-items:flex-start}.lkt-toast-stack.center-stack{left:50%;transform:translate(-50%);align-items:center}.lkt-toast-stack.right-stack{right:0;align-items:flex-end}.lkt-toast{padding:var(--lkt-toast--toast--padding);border-radius:var(--lkt-toast--toast--border-radius);background:var(--lkt-toast--toast--background);transition:var(--lkt-toast--toast--transition);width:var(--lkt-toast--toast--width);border:var(--lkt-toast--toast--border-width) var(--lkt-toast--toast--border-style) var(--lkt-toast--toast--border-color)}.lkt-toast.animation-left{transform:translate(-100%)}.lkt-toast.animation-right{transform:translate(100%)}.lkt-toast.animation-left.is-visible,.lkt-toast.animation-right.is-visible{transform:translate(0)}.lkt-toast.animation-center{transform:translateY(100%)}.lkt-toast.animation-center.is-visible{transform:translateY(0)}.lkt-toast-inner{display:flex;flex-direction:column;gap:var(--lkt-toast--toast--gap)}.lkt-toast-header{display:flex;align-items:center;justify-content:space-between;gap:var(--lkt-toast--toast--gap);font-size:var(--lkt-toast--header--font-size);font-weight:var(--lkt-toast--header--font-weight)}.lkt-toast-header-text{display:flex;align-items:center;justify-content:center;gap:var(--lkt-toast--toast--gap)}.lkt-toast-details{font-size:var(--lkt-toast--details--font-size);font-weight:var(--lkt-toast--details--font-weight)}.lkt-toast .lkt-progress{--lkt-progress-bar-height: var(--lkt-toast--progress--height);--lkt-progress-min-height: var(--lkt-toast--progress--height);--lkt-progress-bar-percentage-color: var(--lkt-toast--progress--color)}
|
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function $(
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(
|
|
1
|
+
declare function $(e: any): void;
|
|
2
|
+
declare namespace se {
|
|
3
|
+
function install(e: any): void;
|
|
4
4
|
}
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
export { $ as closeToast,
|
|
5
|
+
declare function te(e: any): void;
|
|
6
|
+
declare function ne(e: any): void;
|
|
7
|
+
export { $ as closeToast, se as default, te as openToast, ne as setToastCanvas };
|
package/dist/build.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { defineComponent as D, mergeDefaults as
|
|
2
|
-
import { extractI18nValue as P, getDefaultValues as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as D, mergeDefaults as N, ref as m, computed as c, onMounted as w, resolveComponent as E, createElementBlock as p, openBlock as l, normalizeClass as k, createElementVNode as r, createVNode as U, createBlock as C, createCommentVNode as j, unref as M, getCurrentInstance as A, Fragment as R, renderList as V, mergeProps as X } from "vue";
|
|
2
|
+
import { extractI18nValue as P, LktSettings as F, getDefaultValues as S, Toast as q } from "lkt-vue-kernel";
|
|
3
|
+
const z = class z {
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
let f =
|
|
7
|
-
const
|
|
8
|
-
static open(
|
|
9
|
-
|
|
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
10
|
}
|
|
11
|
-
static close(
|
|
12
|
-
const
|
|
13
|
-
|
|
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
14
|
}
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
let v =
|
|
18
|
-
const
|
|
16
|
+
a.components = [], a.zIndex = 1e3;
|
|
17
|
+
let v = a;
|
|
18
|
+
const te = (e) => {
|
|
19
19
|
if (!f.canvas) {
|
|
20
20
|
console.warn("ToastCanvas not defined");
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
v.open(
|
|
24
|
-
}, $ = (
|
|
23
|
+
v.open(e), f.canvas.refresh();
|
|
24
|
+
}, $ = (e) => {
|
|
25
25
|
if (!f.canvas) {
|
|
26
26
|
console.warn("ToastCanvas not defined");
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
v.close(
|
|
30
|
-
},
|
|
29
|
+
v.close(e), f.canvas.refresh();
|
|
30
|
+
}, G = {
|
|
31
31
|
class: "lkt-toast-inner",
|
|
32
32
|
ref: "inner"
|
|
33
|
-
},
|
|
33
|
+
}, J = { class: "lkt-toast-header" }, K = { class: "lkt-toast-header-text" }, O = ["innerHTML"], Q = ["innerHTML"], T = /* @__PURE__ */ D({
|
|
34
34
|
__name: "LktToast",
|
|
35
|
-
props: /* @__PURE__ */
|
|
35
|
+
props: /* @__PURE__ */ N({
|
|
36
36
|
type: {},
|
|
37
37
|
text: {},
|
|
38
38
|
details: {},
|
|
@@ -41,59 +41,64 @@ const Z = (t) => {
|
|
|
41
41
|
duration: {},
|
|
42
42
|
buttonConfig: {},
|
|
43
43
|
zIndex: {}
|
|
44
|
-
},
|
|
45
|
-
setup(
|
|
46
|
-
const
|
|
47
|
-
let
|
|
48
|
-
return
|
|
49
|
-
}), x = c(() => P(
|
|
50
|
-
$(
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
44
|
+
}, S(q)),
|
|
45
|
+
setup(e) {
|
|
46
|
+
const s = e, n = m(100), u = s.duration ?? 1e4, d = m(null), h = m(!1), g = c(() => {
|
|
47
|
+
let i = [];
|
|
48
|
+
return h.value && i.push("is-visible"), s.positionX && i.push(`animation-${s.positionX}`), i.join(" ");
|
|
49
|
+
}), x = c(() => P(s.text)), _ = c(() => P(s.details)), L = F.defaultCloseToastIcon, y = () => {
|
|
50
|
+
$(s.zIndex);
|
|
51
|
+
}, I = () => {
|
|
52
|
+
d.value.pause();
|
|
53
|
+
}, o = () => {
|
|
54
|
+
d.value.start();
|
|
55
55
|
};
|
|
56
|
-
return
|
|
56
|
+
return w(() => {
|
|
57
57
|
setTimeout(() => {
|
|
58
|
-
|
|
58
|
+
h.value = !0;
|
|
59
59
|
}, 100);
|
|
60
|
-
}), (
|
|
61
|
-
const
|
|
60
|
+
}), (i, t) => {
|
|
61
|
+
const H = E("lkt-icon"), B = E("lkt-progress");
|
|
62
62
|
return l(), p("section", {
|
|
63
|
-
class:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
class: k(["lkt-toast", g.value]),
|
|
64
|
+
role: "status",
|
|
65
|
+
"aria-live": "polite",
|
|
66
|
+
"aria-atomic": "true",
|
|
67
|
+
onMouseenter: I,
|
|
68
|
+
onMousemove: I,
|
|
69
|
+
onMouseleave: o
|
|
67
70
|
}, [
|
|
68
|
-
r("div",
|
|
69
|
-
r("div",
|
|
70
|
-
r("div",
|
|
71
|
-
|
|
71
|
+
r("div", G, [
|
|
72
|
+
r("div", J, [
|
|
73
|
+
r("div", K, [
|
|
74
|
+
i.icon ? (l(), C(H, {
|
|
72
75
|
key: 0,
|
|
73
|
-
icon:
|
|
74
|
-
}, null, 8, ["icon"])) :
|
|
76
|
+
icon: i.icon
|
|
77
|
+
}, null, 8, ["icon"])) : j("", !0),
|
|
75
78
|
r("div", {
|
|
76
79
|
class: "lkt-toast-text",
|
|
77
80
|
innerHTML: x.value
|
|
78
|
-
}, null, 8,
|
|
81
|
+
}, null, 8, O)
|
|
79
82
|
]),
|
|
80
83
|
r("div", {
|
|
81
84
|
class: "lkt-toast-close",
|
|
82
|
-
onClick:
|
|
83
|
-
},
|
|
84
|
-
r("i", {
|
|
85
|
-
|
|
85
|
+
onClick: t[0] || (t[0] = (b) => M($)(i.zIndex))
|
|
86
|
+
}, [
|
|
87
|
+
r("i", {
|
|
88
|
+
class: k(M(L))
|
|
89
|
+
}, null, 2)
|
|
90
|
+
])
|
|
86
91
|
]),
|
|
87
92
|
r("div", {
|
|
88
93
|
class: "lkt-toast-details",
|
|
89
|
-
innerHTML:
|
|
90
|
-
}, null, 8,
|
|
91
|
-
|
|
94
|
+
innerHTML: _.value
|
|
95
|
+
}, null, 8, Q),
|
|
96
|
+
U(B, {
|
|
92
97
|
ref_key: "progressRef",
|
|
93
|
-
ref:
|
|
94
|
-
modelValue:
|
|
95
|
-
"onUpdate:modelValue":
|
|
96
|
-
duration:
|
|
98
|
+
ref: d,
|
|
99
|
+
modelValue: n.value,
|
|
100
|
+
"onUpdate:modelValue": t[1] || (t[1] = (b) => n.value = b),
|
|
101
|
+
duration: M(u),
|
|
97
102
|
type: "decremental",
|
|
98
103
|
"value-format": "hidden",
|
|
99
104
|
"pause-on-hover": "",
|
|
@@ -103,60 +108,60 @@ const Z = (t) => {
|
|
|
103
108
|
], 34);
|
|
104
109
|
};
|
|
105
110
|
}
|
|
106
|
-
}),
|
|
111
|
+
}), W = { class: "lkt-toast-canvas" }, Y = /* @__PURE__ */ D({
|
|
107
112
|
__name: "LktToastCanvas",
|
|
108
|
-
setup(
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
(
|
|
113
|
+
setup(e, { expose: s }) {
|
|
114
|
+
const n = m(0), u = A(), d = m([]), h = () => {
|
|
115
|
+
n.value = n.value + 1, setTimeout(() => {
|
|
116
|
+
var o;
|
|
117
|
+
(o = u == null ? void 0 : u.proxy) == null || o.$forceUpdate();
|
|
113
118
|
}, 1);
|
|
114
|
-
},
|
|
115
|
-
return
|
|
116
|
-
refresh:
|
|
117
|
-
}), (
|
|
119
|
+
}, g = c(() => (n.value, v.components.filter((o) => o.positionX === "left"))), x = c(() => (n.value, v.components.filter((o) => o.positionX === "center"))), _ = c(() => (n.value, v.components.filter((o) => o.positionX === "right"))), L = c(() => g.value.length === 0 ? "" : "is-visible"), y = c(() => x.value.length === 0 ? "" : "is-visible"), I = c(() => _.value.length === 0 ? "" : "is-visible");
|
|
120
|
+
return s({
|
|
121
|
+
refresh: h
|
|
122
|
+
}), (o, i) => (l(), p("section", W, [
|
|
118
123
|
r("div", {
|
|
119
|
-
class:
|
|
124
|
+
class: k(["lkt-toast-stack left-stack", L.value])
|
|
120
125
|
}, [
|
|
121
|
-
(l(!0), p(
|
|
126
|
+
(l(!0), p(R, null, V(g.value, (t) => (l(), C(T, X({
|
|
122
127
|
ref_for: !0,
|
|
123
128
|
ref_key: "instanceReferences",
|
|
124
|
-
ref:
|
|
125
|
-
key:
|
|
126
|
-
},
|
|
129
|
+
ref: d,
|
|
130
|
+
key: t.zIndex
|
|
131
|
+
}, t), null, 16))), 128))
|
|
127
132
|
], 2),
|
|
128
133
|
r("div", {
|
|
129
|
-
class:
|
|
134
|
+
class: k(["lkt-toast-stack center-stack", y.value])
|
|
130
135
|
}, [
|
|
131
|
-
(l(!0), p(
|
|
136
|
+
(l(!0), p(R, null, V(x.value, (t) => (l(), C(T, X({
|
|
132
137
|
ref_for: !0,
|
|
133
138
|
ref_key: "instanceReferences",
|
|
134
|
-
ref:
|
|
135
|
-
key:
|
|
136
|
-
},
|
|
139
|
+
ref: d,
|
|
140
|
+
key: t.zIndex
|
|
141
|
+
}, t), null, 16))), 128))
|
|
137
142
|
], 2),
|
|
138
143
|
r("div", {
|
|
139
|
-
class:
|
|
144
|
+
class: k(["lkt-toast-stack right-stack", I.value])
|
|
140
145
|
}, [
|
|
141
|
-
(l(!0), p(
|
|
146
|
+
(l(!0), p(R, null, V(_.value, (t) => (l(), C(T, X({
|
|
142
147
|
ref_for: !0,
|
|
143
148
|
ref_key: "instanceReferences",
|
|
144
|
-
ref:
|
|
145
|
-
key:
|
|
146
|
-
},
|
|
149
|
+
ref: d,
|
|
150
|
+
key: t.zIndex
|
|
151
|
+
}, t), null, 16))), 128))
|
|
147
152
|
], 2)
|
|
148
153
|
]));
|
|
149
154
|
}
|
|
150
|
-
}),
|
|
151
|
-
install: (
|
|
152
|
-
|
|
155
|
+
}), se = {
|
|
156
|
+
install: (e) => {
|
|
157
|
+
e.component("lkt-toast-canvas") === void 0 && e.component("lkt-toast-canvas", Y), e.component("lkt-toast") === void 0 && e.component("lkt-toast", T);
|
|
153
158
|
}
|
|
154
|
-
},
|
|
155
|
-
f.canvas =
|
|
159
|
+
}, ne = (e) => {
|
|
160
|
+
f.canvas = e;
|
|
156
161
|
};
|
|
157
162
|
export {
|
|
158
163
|
$ as closeToast,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
se as default,
|
|
165
|
+
te as openToast,
|
|
166
|
+
ne as setToastCanvas
|
|
162
167
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkt-toast",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/build.js",
|
|
@@ -39,11 +39,9 @@
|
|
|
39
39
|
"vue": "^3.3.0",
|
|
40
40
|
"vue-tsc": "^2.2.0"
|
|
41
41
|
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
},
|
|
44
42
|
"peerDependencies": {
|
|
45
|
-
"lkt-loader": "^1.0
|
|
46
|
-
"lkt-vue-kernel": "^1.0.
|
|
43
|
+
"lkt-loader": "^1.2.0",
|
|
44
|
+
"lkt-vue-kernel": "^1.0.51",
|
|
47
45
|
"vue": "^3.3.0"
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {computed, onMounted, ref} from 'vue';
|
|
3
|
-
import {extractI18nValue, getDefaultValues, Toast, ToastConfig} from "lkt-vue-kernel";
|
|
3
|
+
import {extractI18nValue, getDefaultValues, LktSettings, Toast, ToastConfig} from "lkt-vue-kernel";
|
|
4
4
|
import {closeToast} from "../functions/functions";
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(defineProps<ToastConfig>(), getDefaultValues(Toast));
|
|
@@ -20,13 +20,17 @@ const classes = computed(() => {
|
|
|
20
20
|
computedDetails = computed(() => extractI18nValue(props.details))
|
|
21
21
|
;
|
|
22
22
|
|
|
23
|
+
const calculatedCloseIcon = LktSettings.defaultCloseToastIcon
|
|
24
|
+
|
|
23
25
|
const onProgressEnd = () => {
|
|
24
26
|
closeToast(props.zIndex);
|
|
25
27
|
},
|
|
26
28
|
onProgressMouseEnter = () => {
|
|
29
|
+
//@ts-ignore
|
|
27
30
|
progressRef.value.pause();
|
|
28
31
|
},
|
|
29
32
|
onProgressMouseLeave = () => {
|
|
33
|
+
//@ts-ignore
|
|
30
34
|
progressRef.value.start();
|
|
31
35
|
};
|
|
32
36
|
|
|
@@ -41,6 +45,9 @@ onMounted(() => {
|
|
|
41
45
|
<template>
|
|
42
46
|
<section class="lkt-toast"
|
|
43
47
|
:class="classes"
|
|
48
|
+
role="status"
|
|
49
|
+
aria-live="polite"
|
|
50
|
+
aria-atomic="true"
|
|
44
51
|
@mouseenter="onProgressMouseEnter"
|
|
45
52
|
@mousemove="onProgressMouseEnter"
|
|
46
53
|
@mouseleave="onProgressMouseLeave">
|
|
@@ -48,13 +55,13 @@ onMounted(() => {
|
|
|
48
55
|
<div class="lkt-toast-header">
|
|
49
56
|
<div class="lkt-toast-header-text">
|
|
50
57
|
<lkt-icon v-if="icon" :icon="icon"/>
|
|
51
|
-
<div class="lkt-toast-text" v-html="computedText"
|
|
58
|
+
<div class="lkt-toast-text" v-html="computedText"/>
|
|
52
59
|
</div>
|
|
53
60
|
<div class="lkt-toast-close" @click="closeToast(zIndex)">
|
|
54
|
-
<i class="
|
|
61
|
+
<i :class="calculatedCloseIcon"/>
|
|
55
62
|
</div>
|
|
56
63
|
</div>
|
|
57
|
-
<div class="lkt-toast-details" v-html="computedDetails"
|
|
64
|
+
<div class="lkt-toast-details" v-html="computedDetails"/>
|
|
58
65
|
<lkt-progress
|
|
59
66
|
ref="progressRef"
|
|
60
67
|
v-model="progressPercentage"
|
package/theme/default.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--lkt-toast--toast--gap: 10px;
|
|
6
6
|
--lkt-toast--toast--padding: 15px;
|
|
7
7
|
--lkt-toast--toast--border-radius: 20px;
|
|
8
|
-
--lkt-toast--toast--
|
|
8
|
+
--lkt-toast--toast--background: #ffffff;
|
|
9
9
|
--lkt-toast--toast--transition: 300ms;
|
|
10
10
|
--lkt-toast--toast--width: 250px;
|
|
11
11
|
--lkt-toast--toast--border-width: 1px;
|