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