lkt-toast 1.1.5 → 1.2.0

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