Skip to content

Commit 739d9c2

Browse files
author
kyvg
committed
3.1.3
1 parent 811ba2c commit 739d9c2

File tree

5 files changed

+37
-28
lines changed

5 files changed

+37
-28
lines changed

dist/index.d.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { ComponentCustomProps } from 'vue';
33
import { ComponentOptionsMixin } from 'vue';
44
import { DefineComponent } from 'vue';
55
import { ExtractPropTypes } from 'vue';
6+
import { HTMLAttributes } from 'vue';
67
import type { Plugin as Plugin_2 } from 'vue';
78
import { PropType } from 'vue';
9+
import { SlotsType } from 'vue';
810
import { VNodeProps } from 'vue';
911

1012
declare const _default: Plugin_2;
@@ -96,9 +98,9 @@ export declare const Notifications: DefineComponent<{
9698
default: boolean;
9799
};
98100
}, () => JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
99-
click: (item: NotificationItem) => boolean;
100-
destroy: (item: NotificationItem) => boolean;
101-
start: (item: NotificationItem) => boolean;
101+
click: (item: NotificationItem) => true;
102+
destroy: (item: NotificationItem) => true;
103+
start: (item: NotificationItem) => true;
102104
}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
103105
group: {
104106
type: StringConstructor;
@@ -201,7 +203,13 @@ export declare const Notifications: DefineComponent<{
201203
max: number;
202204
pauseOnHover: boolean;
203205
dangerouslySetInnerHtml: boolean;
204-
}, {}>;
206+
}, SlotsType<{
207+
body?: ((props: {
208+
class: HTMLAttributes['class'];
209+
item: NotificationItem;
210+
close: () => void;
211+
}) => any) | undefined;
212+
}>>;
205213

206214
export declare interface NotificationsOptions {
207215
id?: number;

dist/index.es.js

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function(){var o;"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.nonce=(o=document.head.querySelector("meta[property=csp-nonce]"))==null?void 0:o.content,e.appendChild(document.createTextNode(".vue-notification-group{display:block;position:fixed;z-index:5000}.vue-notification-wrapper{display:block;overflow:hidden;width:100%;margin:0;padding:0}.notification-title{font-weight:600}.vue-notification-template{display:block;box-sizing:border-box;background:white;text-align:left}.vue-notification{display:block;box-sizing:border-box;text-align:left;font-size:12px;padding:10px;margin:0 5px 5px;color:#fff;background:#44A4FC;border-left:5px solid #187FE7}.vue-notification.warn{background:#ffb648;border-left-color:#f48a06}.vue-notification.error{background:#E54D42;border-left-color:#b82e24}.vue-notification.success{background:#68CD86;border-left-color:#42a85f}.vn-fade-enter-active,.vn-fade-leave-active,.vn-fade-move{transition:all .5s}.vn-fade-enter-from,.vn-fade-leave-to{opacity:0}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
1+
(function(){"use strict";var o;try{if(typeof document<"u"){var e=document.createElement("style");e.nonce=(o=document.head.querySelector("meta[property=csp-nonce]"))==null?void 0:o.content,e.appendChild(document.createTextNode(".vue-notification-group{display:block;position:fixed;z-index:5000}.vue-notification-wrapper{display:block;overflow:hidden;width:100%;margin:0;padding:0}.notification-title{font-weight:600}.vue-notification-template{display:block;box-sizing:border-box;background:#fff;text-align:left}.vue-notification{display:block;box-sizing:border-box;text-align:left;font-size:12px;padding:10px;margin:0 5px 5px;color:#fff;background:#44a4fc;border-left:5px solid #187FE7}.vue-notification.warn{background:#ffb648;border-left-color:#f48a06}.vue-notification.error{background:#e54d42;border-left-color:#b82e24}.vue-notification.success{background:#68cd86;border-left-color:#42a85f}.vn-fade-enter-active,.vn-fade-leave-active,.vn-fade-move{transition:all .5s}.vn-fade-enter-from,.vn-fade-leave-to{opacity:0}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
22
import { defineComponent as D, createVNode as l, TransitionGroup as H, ref as $, computed as g, onMounted as et, Fragment as C, isVNode as nt } from "vue";
33
const R = /* @__PURE__ */ new Map();
44
class it {
@@ -28,22 +28,22 @@ function ot(t) {
2828
});
2929
} };
3030
}
31-
const T = ot(), b = "[-+]?[0-9]*.?[0-9]+", M = [
31+
const b = ot(), T = "[-+]?[0-9]*.?[0-9]+", M = [
3232
{
3333
name: "px",
34-
regexp: new RegExp(`^${b}px$`)
34+
regexp: new RegExp(`^${T}px$`)
3535
},
3636
{
3737
name: "%",
38-
regexp: new RegExp(`^${b}%$`)
38+
regexp: new RegExp(`^${T}%$`)
3939
},
4040
/**
4141
* Fallback option
4242
* If no suffix specified, assigning "px"
4343
*/
4444
{
4545
name: "px",
46-
regexp: new RegExp(`^${b}$`)
46+
regexp: new RegExp(`^${T}$`)
4747
}
4848
], at = (t) => {
4949
if (t === "auto")
@@ -75,7 +75,7 @@ const T = ot(), b = "[-+]?[0-9]*.?[0-9]+", M = [
7575
}, k = {
7676
x: /* @__PURE__ */ new Set(["left", "center", "right"]),
7777
y: /* @__PURE__ */ new Set(["top", "bottom"])
78-
}, st = ((t) => () => t++)(0), lt = (t) => typeof t != "string" ? [] : t.split(/\s+/gi).filter(Boolean), ct = (t) => {
78+
}, st = /* @__PURE__ */ ((t) => () => t++)(0), lt = (t) => typeof t != "string" ? [] : t.split(/\s+/gi).filter(Boolean), ct = (t) => {
7979
typeof t == "string" && (t = lt(t));
8080
let n = null, o = null;
8181
return t.forEach((a) => {
@@ -249,20 +249,21 @@ const x = {
249249
start: (t) => !0
250250
/* eslint-enable @typescript-eslint/no-unused-vars */
251251
},
252+
slots: Object,
252253
setup: (t, {
253254
emit: n,
254255
slots: o,
255256
expose: a
256257
}) => {
257-
const s = $([]), h = $(null), c = R.get("velocity"), u = g(() => t.animationType === "velocity"), B = g(() => u.value ? ut : ft), f = g(() => s.value.filter((e) => e.state !== x.DESTROYED)), N = g(() => rt(t.width)), A = g(() => {
258+
const s = $([]), h = $(null), c = R.get("velocity"), u = g(() => t.animationType === "velocity"), j = g(() => u.value ? ut : ft), f = g(() => s.value.filter((e) => e.state !== x.DESTROYED)), A = g(() => rt(t.width)), N = g(() => {
258259
const {
259260
x: e,
260261
y: i
261-
} = ct(t.position), r = N.value.value, d = N.value.type, m = {
262+
} = ct(t.position), r = A.value.value, d = A.value.type, m = {
262263
width: r + d
263264
};
264265
return i && (m[i] = "0px"), e && (e === "center" ? m.left = `calc(50% - ${+r / 2}${d})` : m[e] = "0px"), m;
265-
}), w = g(() => "bottom" in A.value), j = (e) => {
266+
}), O = g(() => "bottom" in N.value), B = (e) => {
266267
n("click", e), t.closeOnClick && y(e);
267268
}, V = () => {
268269
var e;
@@ -294,7 +295,7 @@ const x = {
294295
data: U
295296
};
296297
i >= 0 && (h.value = new it(() => y(p), p.length, p));
297-
const Z = t.reverse ? !w.value : w.value;
298+
const Z = t.reverse ? !O.value : O.value;
298299
let v = -1;
299300
const tt = f.value.some((L) => L.title === e.title && L.text === e.text);
300301
(!d || !tt) && (Z ? (s.value.push(p), n("start", p), f.value.length > t.max && (v = 0)) : (s.value.unshift(p), n("start", p), f.value.length > t.max && (v = f.value.length - 1)), v !== -1 && y(f.value[v]));
@@ -309,22 +310,22 @@ const x = {
309310
i && y(i);
310311
}, q = () => {
311312
f.value.forEach(y);
312-
}, O = (e, i) => {
313+
}, w = (e, i) => {
313314
var d;
314315
const r = (d = t.animation) == null ? void 0 : d[e];
315316
return typeof r == "function" ? r(i) : r;
316317
}, z = (e, i) => {
317318
if (!u.value)
318319
return;
319-
const r = O("enter", e);
320+
const r = w("enter", e);
320321
c(e, r, {
321322
duration: t.speed,
322323
complete: i
323324
});
324325
}, J = (e, i) => {
325326
if (!u.value)
326327
return;
327-
const r = O("leave", e);
328+
const r = w("leave", e);
328329
c(e, r, {
329330
duration: t.speed,
330331
complete: i
@@ -334,13 +335,13 @@ const x = {
334335
s.value = s.value.filter((e) => e.state !== x.DESTROYED);
335336
}
336337
return et(() => {
337-
T.on("add", G), T.on("close", _);
338+
b.on("add", G), b.on("close", _);
338339
}), () => {
339340
let e;
340341
return l("div", {
341342
class: "vue-notification-group",
342-
style: A.value
343-
}, [l(B.value, {
343+
style: N.value
344+
}, [l(j.value, {
344345
name: t.animationName,
345346
onEnter: z,
346347
onLeave: J,
@@ -358,7 +359,7 @@ const x = {
358359
close: () => y(i)
359360
}) : l("div", {
360361
class: F(i),
361-
onClick: () => j(i)
362+
onClick: () => B(i)
362363
}, [t.dangerouslySetInnerHtml ? l(C, null, [i.title ? l("div", {
363364
class: "notification-title",
364365
innerHTML: i.title
@@ -375,10 +376,10 @@ const x = {
375376
};
376377
}
377378
}), S = (t) => {
378-
typeof t == "string" && (t = { title: "", text: t }), typeof t == "object" && T.emit("add", t);
379+
typeof t == "string" && (t = { title: "", text: t }), typeof t == "object" && b.emit("add", t);
379380
};
380381
S.close = (t) => {
381-
T.emit("close", t);
382+
b.emit("close", t);
382383
};
383384
const vt = () => ({ notify: S }), yt = "Notifications";
384385
function mt(t, n = {}) {

0 commit comments

Comments
 (0)