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
- declare function D(e: any): void;
2
- declare namespace ne {
3
- function install(e: any): void;
1
+ import { closeToast as oe } from "lkt-vue-kernel";
2
+ declare namespace Z {
3
+ function install(t: any): void;
4
4
  }
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 };
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 $, 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
- };
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
- }, J = { class: "lkt-toast-header" }, K = { class: "lkt-toast-header-text" }, Q = ["innerHTML"], W = ["innerHTML"], L = /* @__PURE__ */ $({
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__ */ E({
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
- }, S(q)),
45
- setup(e) {
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();
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 F(() => {
29
+ return $(() => {
55
30
  setTimeout(() => {
56
- x.value = !0;
31
+ p.value = !0;
57
32
  }, 100);
58
- }), (t, m) => {
59
- const a = H("lkt-icon"), B = H("lkt-progress");
60
- return l(), p("section", {
61
- class: h(["lkt-toast", g.value]),
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: I,
66
- onMousemove: I,
67
- onMouseleave: R
40
+ onMouseenter: x,
41
+ onMousemove: x,
42
+ onMouseleave: M
68
43
  }, [
69
- r("div", G, [
70
- r("div", J, [
71
- r("div", K, [
72
- e.icon ? (l(), z(a, {
44
+ n("div", O, [
45
+ n("div", q, [
46
+ n("div", w, [
47
+ t.icon ? (r(), h(o, {
73
48
  key: 0,
74
- icon: e.icon
75
- }, null, 8, ["icon"])) : w("", !0),
76
- r("div", {
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, Q)
54
+ }, null, 8, G)
80
55
  ]),
81
- r("div", {
56
+ n("div", {
82
57
  class: "lkt-toast-close",
83
- onClick: m[0] || (m[0] = (T) => v(D)(e.zIndex))
58
+ onClick: f[0] || (f[0] = (C) => i(b)(t.zIndex))
84
59
  }, [
85
- r("i", {
86
- class: h(v(V))
60
+ n("i", {
61
+ class: v(i(I))
87
62
  }, null, 2)
88
63
  ])
89
64
  ]),
90
- r("div", {
65
+ n("div", {
91
66
  class: "lkt-toast-details",
92
- innerHTML: C.value
93
- }, null, 8, W),
94
- N(B, y({
67
+ innerHTML: g.value
68
+ }, null, 8, J),
69
+ S(X, T({
95
70
  ref_key: "progressRef",
96
- ref: u,
97
- modelValue: n.value,
98
- "onUpdate:modelValue": m[1] || (m[1] = (T) => n.value = T)
71
+ ref: c,
72
+ modelValue: l.value,
73
+ "onUpdate:modelValue": f[1] || (f[1] = (C) => l.value = C)
99
74
  }, {
100
- duration: v(i),
75
+ duration: i(u),
101
76
  animation: {
102
- type: v(O).Decremental,
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: v(j).Hidden,
83
+ valueFormat: i(N).Hidden,
109
84
  pauseOnHover: !0,
110
85
  events: {
111
- updatedVisibleProgress: (T) => {
112
- T === 0 && v(D)(s.zIndex);
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
- }), Y = { class: "lkt-toast-canvas" }, Z = /* @__PURE__ */ $({
95
+ }), K = { class: "lkt-toast-canvas" }, Q = /* @__PURE__ */ H({
121
96
  __name: "LktToastCanvas",
122
- setup(e, { expose: s }) {
123
- const n = k(0), i = A(), u = k([]), x = () => {
124
- n.value = n.value + 1, setTimeout(() => {
125
- var t;
126
- (t = i == null ? void 0 : i.proxy) == null || t.$forceUpdate();
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
- }, 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");
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: x
131
- }), (t, m) => (l(), p("section", Y, [
132
- r("div", {
133
- class: h(["lkt-toast-stack left-stack", V.value])
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
- (l(!0), p(P, null, b(g.value, (a) => (l(), z(L, y({
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: u,
139
- key: a.zIndex
140
- }, { ref_for: !0 }, a), null, 16))), 128))
113
+ ref: c,
114
+ key: o.zIndex
115
+ }, { ref_for: !0 }, o), null, 16))), 128))
141
116
  ], 2),
142
- r("div", {
143
- class: h(["lkt-toast-stack center-stack", I.value])
117
+ n("div", {
118
+ class: v(["lkt-toast-stack center-stack", x.value])
144
119
  }, [
145
- (l(!0), p(P, null, b(_.value, (a) => (l(), z(L, y({
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: u,
149
- key: a.zIndex
150
- }, { ref_for: !0 }, a), null, 16))), 128))
123
+ ref: c,
124
+ key: o.zIndex
125
+ }, { ref_for: !0 }, o), null, 16))), 128))
151
126
  ], 2),
152
- r("div", {
153
- class: h(["lkt-toast-stack right-stack", R.value])
127
+ n("div", {
128
+ class: v(["lkt-toast-stack right-stack", M.value])
154
129
  }, [
155
- (l(!0), p(P, null, b(C.value, (a) => (l(), z(L, y({
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: u,
159
- key: a.zIndex
160
- }, { ref_for: !0 }, a), null, 16))), 128))
133
+ ref: c,
134
+ key: o.zIndex
135
+ }, { ref_for: !0 }, o), null, 16))), 128))
161
136
  ], 2)
162
137
  ]));
163
138
  }
164
- }), ne = {
165
- install: (e) => {
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);
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
- }, oe = (e) => {
169
- f.canvas = e;
143
+ }, ee = (t) => {
144
+ y.canvas = t;
170
145
  };
171
146
  export {
172
- D as closeToast,
173
- ne as default,
174
- se as openToast,
175
- oe as setToastCanvas
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 { ValidCanvas } from "./types/ValidCanvas";
4
- export { closeToast, openToast } from './functions/functions';
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: ValidCanvas) => void;
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,6 @@
1
1
  {
2
2
  "name": "lkt-toast",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -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();