Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kyvg/vue3-notification

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kyvg/vue3-notification - npm Package Compare versions

Comparing version 3.1.0-5 to 3.1.0-6

70

dist/index.es.js
(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)}})();
import { defineComponent as S, createVNode as l, TransitionGroup as H, ref as b, computed as g, onMounted as et, Fragment as L, isVNode as nt } from "vue";
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";
const R = /* @__PURE__ */ new Map();

@@ -31,10 +31,10 @@ class it {

}
const T = ot(), E = "[-+]?[0-9]*.?[0-9]+", M = [
const T = ot(), b = "[-+]?[0-9]*.?[0-9]+", M = [
{
name: "px",
regexp: new RegExp(`^${E}px$`)
regexp: new RegExp(`^${b}px$`)
},
{
name: "%",
regexp: new RegExp(`^${E}%$`)
regexp: new RegExp(`^${b}%$`)
},

@@ -47,3 +47,3 @@ /**

name: "px",
regexp: new RegExp(`^${E}$`)
regexp: new RegExp(`^${b}$`)
}

@@ -86,3 +86,3 @@ ], at = (t) => {

}), { x: n, y: o };
}, D = {
}, E = {
position: ["top", "right"],

@@ -100,3 +100,3 @@ cssAnimation: "vn-fade",

}
}, ut = /* @__PURE__ */ S({
}, ut = /* @__PURE__ */ D({
name: "velocity-group",

@@ -114,3 +114,3 @@ inheritAttrs: !1,

leave: (t, n) => !0,
"after-leave": () => !0
afterLeave: () => !0
/* eslint-enable @typescript-eslint/no-unused-vars */

@@ -127,3 +127,3 @@ },

}, h = () => {
o("after-leave");
o("afterLeave");
};

@@ -144,3 +144,3 @@ return () => l(H, {

}
}), ft = /* @__PURE__ */ S({
}), ft = /* @__PURE__ */ D({
name: "css-group",

@@ -172,3 +172,3 @@ inheritAttrs: !1,

DESTROYED: 2
}, pt = /* @__PURE__ */ S({
}, pt = /* @__PURE__ */ D({
// eslint-disable-next-line vue/multi-word-component-names

@@ -195,3 +195,3 @@ name: "notifications",

type: [String, Array],
default: () => D.position
default: () => E.position
},

@@ -212,3 +212,3 @@ classes: {

default() {
return D.velocityAnimation;
return E.velocityAnimation;
}

@@ -218,3 +218,3 @@ },

type: String,
default: D.cssAnimation
default: E.cssAnimation
},

@@ -268,11 +268,11 @@ speed: {

}) => {
const s = b([]), h = b(null), c = b(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)), w = g(() => {
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)), N = g(() => rt(t.width)), A = g(() => {
const {
x: e,
y: i
} = ct(t.position), r = A.value.value, d = A.value.type, m = {
} = ct(t.position), r = N.value.value, d = N.value.type, m = {
width: r + d
};
return i && (m[i] = "0px"), e && (e === "center" ? m.left = `calc(50% - ${+r / 2}${d})` : m[e] = "0px"), m;
}), O = g(() => "bottom" in w.value), B = (e) => {
}), w = g(() => "bottom" in A.value), B = (e) => {
n("click", e), t.closeOnClick && y(e);

@@ -309,5 +309,5 @@ }, V = () => {

i >= 0 && (h.value = new it(() => y(p), p.length, p));
const Z = t.reverse ? !O.value : O.value;
const Z = t.reverse ? !w.value : w.value;
let v = -1;
const tt = f.value.some((C) => C.title === e.title && C.text === e.text);
const tt = f.value.some((L) => L.title === e.title && L.text === e.text);
(!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]));

@@ -319,3 +319,3 @@ }, _ = (e) => {

}, y = (e) => {
clearTimeout(e.timer), e.state = x.DESTROYED, $(), n("destroy", e);
clearTimeout(e.timer), e.state = x.DESTROYED, I(), n("destroy", e);
}, W = (e) => {

@@ -326,3 +326,3 @@ const i = s.value.find((r) => r.id === e);

f.value.forEach(y);
}, I = (e, i) => {
}, O = (e, i) => {
var d;

@@ -334,4 +334,4 @@ const r = (d = t.animation) == null ? void 0 : d[e];

return;
const r = I("enter", e);
c.value(e, r, {
const r = O("enter", e);
c(e, r, {
duration: t.speed,

@@ -343,4 +343,4 @@ complete: i

return;
const r = I("leave", e);
c.value(e, r, {
const r = O("leave", e);
c(e, r, {
duration: t.speed,

@@ -350,3 +350,3 @@ complete: i

};
function $() {
function I() {
s.value = s.value.filter((e) => e.state !== x.DESTROYED);

@@ -360,3 +360,3 @@ }

class: "vue-notification-group",
style: w.value
style: A.value
}, [l(j.value, {

@@ -366,3 +366,3 @@ name: t.animationName,

onLeave: J,
"onAfter-leave": $
onAfterLeave: I
}, dt(e = f.value.map((i) => l("div", {

@@ -382,3 +382,3 @@ key: i.id,

onClick: () => B(i)
}, [t.dangerouslySetInnerHtml ? l(L, null, [i.title ? l("div", {
}, [t.dangerouslySetInnerHtml ? l(C, null, [i.title ? l("div", {
class: "notification-title",

@@ -389,3 +389,3 @@ innerHTML: i.title

innerHTML: i.text
}, null)]) : l(L, null, [i.title ? l("div", {
}, null)]) : l(C, null, [i.title ? l("div", {
class: "notification-title"

@@ -399,13 +399,13 @@ }, [i.title]) : null, l("div", {

}
}), N = (t) => {
}), S = (t) => {
typeof t == "string" && (t = { title: "", text: t }), typeof t == "object" && T.emit("add", t);
};
N.close = (t) => {
S.close = (t) => {
T.emit("close", t);
};
const vt = () => ({ notify: N }), yt = "Notifications";
const vt = () => ({ notify: S }), yt = "Notifications";
function mt(t, n = {}) {
Object.entries(n).forEach((a) => R.set(...a));
const o = n.name || "notify";
t.config.globalProperties["$" + o] = N, t.component(n.componentName || yt, pt);
t.config.globalProperties["$" + o] = S, t.component(n.componentName || yt, pt);
}

@@ -418,4 +418,4 @@ const xt = {

xt as default,
N as notify,
S as notify,
vt as useNotification
};
(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)}})();
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.notifications={},l.Vue))})(this,function(l,i){"use strict";const D=new Map;class j{constructor(n,a,r){this.remaining=a,this.callback=n,this.notifyItem=r,this.resume()}pause(){clearTimeout(this.notifyItem.timer),this.remaining-=Date.now()-this.start}resume(){this.start=Date.now(),clearTimeout(this.notifyItem.timer),this.notifyItem.timer=setTimeout(this.callback,this.remaining)}}function L(t){return{all:t=t||new Map,on:function(n,a){var r=t.get(n);r?r.push(a):t.set(n,[a])},off:function(n,a){var r=t.get(n);r&&(a?r.splice(r.indexOf(a)>>>0,1):t.set(n,[]))},emit:function(n,a){var r=t.get(n);r&&r.slice().map(function(c){c(a)}),(r=t.get("*"))&&r.slice().map(function(c){c(n,a)})}}}const x=L(),E="[-+]?[0-9]*.?[0-9]+",A=[{name:"px",regexp:new RegExp(`^${E}px$`)},{name:"%",regexp:new RegExp(`^${E}%$`)},{name:"px",regexp:new RegExp(`^${E}$`)}],k=t=>{if(t==="auto")return{type:t,value:0};for(let n=0;n<A.length;n++){const a=A[n];if(a.regexp.test(t))return{type:a.name,value:parseFloat(t)}}return{type:"",value:t}},H=t=>{switch(typeof t){case"number":return{type:"px",value:t};case"string":return k(t);default:return{type:"",value:t}}},O={x:new Set(["left","center","right"]),y:new Set(["top","bottom"])},R=(t=>()=>t++)(0),B=t=>typeof t!="string"?[]:t.split(/\s+/gi).filter(Boolean),_=t=>{typeof t=="string"&&(t=B(t));let n=null,a=null;return t.forEach(r=>{O.y.has(r)&&(a=r),O.x.has(r)&&(n=r)}),{x:n,y:a}},S={position:["top","right"],cssAnimation:"vn-fade",velocityAnimation:{enter:t=>({height:[t.clientHeight,0],opacity:[1,0]}),leave:{height:0,opacity:[0,1]}}},G=i.defineComponent({name:"velocity-group",inheritAttrs:!1,props:{name:{type:String,default:""}},emits:{enter:(t,n)=>!0,leave:(t,n)=>!0,"after-leave":()=>!0},setup:(t,{slots:n,emit:a})=>{const r=(u,f)=>{a("enter",u,f)},c=(u,f)=>{a("leave",u,f)},h=()=>{a("after-leave")};return()=>i.createVNode(i.TransitionGroup,{tag:"name",css:!1,name:t.name,onEnter:r,onLeave:c,onAfterLeave:h},{default:()=>{var u;return[(u=n.default)==null?void 0:u.call(n)]}})}}),Y=i.defineComponent({name:"css-group",inheritAttrs:!1,props:{name:{type:String,default:""}},setup:(t,{slots:n})=>()=>i.createVNode(i.TransitionGroup,{tag:"name",name:t.name},{default:()=>{var a;return[(a=n.default)==null?void 0:a.call(n)]}})}),dt="";function F(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!i.isVNode(t)}const N={IDLE:0,DESTROYED:2},w=i.defineComponent({name:"notifications",props:{group:{type:String,default:""},width:{type:[Number,String],default:300},reverse:{type:Boolean,default:!1},position:{type:[String,Array],default:()=>S.position},classes:{type:String,default:"vue-notification"},animationType:{type:String,default:"css",validator(t){return t==="css"||t==="velocity"}},animation:{type:Object,default(){return S.velocityAnimation}},animationName:{type:String,default:S.cssAnimation},speed:{type:Number,default:300},duration:{type:Number,default:3e3},delay:{type:Number,default:0},max:{type:Number,default:1/0},ignoreDuplicates:{type:Boolean,default:!1},closeOnClick:{type:Boolean,default:!0},pauseOnHover:{type:Boolean,default:!1},dangerouslySetInnerHtml:{type:Boolean,default:!1}},emits:{click:t=>!0,destroy:t=>!0,start:t=>!0},setup:(t,{emit:n,slots:a,expose:r})=>{const c=i.ref([]),h=i.ref(null),u=i.ref(D.get("velocity")),f=i.computed(()=>t.animationType==="velocity"),J=i.computed(()=>f.value?G:Y),d=i.computed(()=>c.value.filter(e=>e.state!==N.DESTROYED)),V=i.computed(()=>H(t.width)),v=i.computed(()=>{const{x:e,y:o}=_(t.position),s=V.value.value,p=V.value.type,g={width:s+p};return o&&(g[o]="0px"),e&&(e==="center"?g.left=`calc(50% - ${+s/2}${p})`:g[e]="0px"),g}),I=i.computed(()=>"bottom"in v.value),K=e=>{n("click",e),t.closeOnClick&&y(e)},Q=()=>{var e;t.pauseOnHover&&((e=h.value)==null||e.pause())},U=()=>{var e;t.pauseOnHover&&((e=h.value)==null||e.resume())},X=(e={})=>{if(e.group||(e.group=""),e.data||(e.data={}),t.group!==e.group)return;if(e.clean||e.clear){it();return}const o=typeof e.duration=="number"?e.duration:t.duration,s=typeof e.speed=="number"?e.speed:t.speed,p=typeof e.ignoreDuplicates=="boolean"?e.ignoreDuplicates:t.ignoreDuplicates,{title:g,text:rt,type:st,data:ct,id:lt}=e,m={id:lt||R(),title:g,text:rt,type:st,state:N.IDLE,speed:s,length:o+2*s,data:ct};o>=0&&(h.value=new j(()=>y(m),m.length,m));const ut=t.reverse?!I.value:I.value;let b=-1;const ft=d.value.some($=>$.title===e.title&&$.text===e.text);(!p||!ft)&&(ut?(c.value.push(m),n("start",m),d.value.length>t.max&&(b=0)):(c.value.unshift(m),n("start",m),d.value.length>t.max&&(b=d.value.length-1)),b!==-1&&y(d.value[b]))},Z=e=>{nt(e)},tt=e=>["vue-notification-template",t.classes,e.type||""],et=e=>f.value?void 0:{transition:`all ${e.speed}ms`},y=e=>{clearTimeout(e.timer),e.state=N.DESTROYED,M(),n("destroy",e)},nt=e=>{const o=c.value.find(s=>s.id===e);o&&y(o)},it=()=>{d.value.forEach(y)},C=(e,o)=>{var p;const s=(p=t.animation)==null?void 0:p[e];return typeof s=="function"?s(o):s},ot=(e,o)=>{if(!f.value)return;const s=C("enter",e);u.value(e,s,{duration:t.speed,complete:o})},at=(e,o)=>{if(!f.value)return;const s=C("leave",e);u.value(e,s,{duration:t.speed,complete:o})};function M(){c.value=c.value.filter(e=>e.state!==N.DESTROYED)}return i.onMounted(()=>{x.on("add",X),x.on("close",Z)}),()=>{let e;return i.createVNode("div",{class:"vue-notification-group",style:v.value},[i.createVNode(J.value,{name:t.animationName,onEnter:ot,onLeave:at,"onAfter-leave":M},F(e=d.value.map(o=>i.createVNode("div",{key:o.id,class:"vue-notification-wrapper",style:et(o),"data-id":o.id,onMouseenter:Q,onMouseleave:U},[a.body?a.body({item:o,class:[t.classes,o.type].join(""),close:()=>y(o)}):i.createVNode("div",{class:tt(o),onClick:()=>K(o)},[t.dangerouslySetInnerHtml?i.createVNode(i.Fragment,null,[o.title?i.createVNode("div",{class:"notification-title",innerHTML:o.title},null):null,i.createVNode("div",{class:"notification-content",innerHTML:o.text},null)]):i.createVNode(i.Fragment,null,[o.title?i.createVNode("div",{class:"notification-title"},[o.title]):null,i.createVNode("div",{class:"notification-content"},[o.text])])])])))?e:{default:()=>[e]})])}}}),T=t=>{typeof t=="string"&&(t={title:"",text:t}),typeof t=="object"&&x.emit("add",t)};T.close=t=>{x.emit("close",t)};const P=()=>({notify:T}),W="Notifications";function q(t,n={}){Object.entries(n).forEach(r=>D.set(...r));const a=n.name||"notify";t.config.globalProperties["$"+a]=T,t.component(n.componentName||W,w)}const z={install:q};l.Notifications=w,l.default=z,l.notify=T,l.useNotification=P,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.notifications={},l.Vue))})(this,function(l,i){"use strict";const D=new Map;class ${constructor(n,a,r){this.remaining=a,this.callback=n,this.notifyItem=r,this.resume()}pause(){clearTimeout(this.notifyItem.timer),this.remaining-=Date.now()-this.start}resume(){this.start=Date.now(),clearTimeout(this.notifyItem.timer),this.notifyItem.timer=setTimeout(this.callback,this.remaining)}}function j(t){return{all:t=t||new Map,on:function(n,a){var r=t.get(n);r?r.push(a):t.set(n,[a])},off:function(n,a){var r=t.get(n);r&&(a?r.splice(r.indexOf(a)>>>0,1):t.set(n,[]))},emit:function(n,a){var r=t.get(n);r&&r.slice().map(function(c){c(a)}),(r=t.get("*"))&&r.slice().map(function(c){c(n,a)})}}}const x=j(),E="[-+]?[0-9]*.?[0-9]+",A=[{name:"px",regexp:new RegExp(`^${E}px$`)},{name:"%",regexp:new RegExp(`^${E}%$`)},{name:"px",regexp:new RegExp(`^${E}$`)}],k=t=>{if(t==="auto")return{type:t,value:0};for(let n=0;n<A.length;n++){const a=A[n];if(a.regexp.test(t))return{type:a.name,value:parseFloat(t)}}return{type:"",value:t}},H=t=>{switch(typeof t){case"number":return{type:"px",value:t};case"string":return k(t);default:return{type:"",value:t}}},O={x:new Set(["left","center","right"]),y:new Set(["top","bottom"])},R=(t=>()=>t++)(0),B=t=>typeof t!="string"?[]:t.split(/\s+/gi).filter(Boolean),_=t=>{typeof t=="string"&&(t=B(t));let n=null,a=null;return t.forEach(r=>{O.y.has(r)&&(a=r),O.x.has(r)&&(n=r)}),{x:n,y:a}},S={position:["top","right"],cssAnimation:"vn-fade",velocityAnimation:{enter:t=>({height:[t.clientHeight,0],opacity:[1,0]}),leave:{height:0,opacity:[0,1]}}},G=i.defineComponent({name:"velocity-group",inheritAttrs:!1,props:{name:{type:String,default:""}},emits:{enter:(t,n)=>!0,leave:(t,n)=>!0,afterLeave:()=>!0},setup:(t,{slots:n,emit:a})=>{const r=(u,f)=>{a("enter",u,f)},c=(u,f)=>{a("leave",u,f)},h=()=>{a("afterLeave")};return()=>i.createVNode(i.TransitionGroup,{tag:"name",css:!1,name:t.name,onEnter:r,onLeave:c,onAfterLeave:h},{default:()=>{var u;return[(u=n.default)==null?void 0:u.call(n)]}})}}),Y=i.defineComponent({name:"css-group",inheritAttrs:!1,props:{name:{type:String,default:""}},setup:(t,{slots:n})=>()=>i.createVNode(i.TransitionGroup,{tag:"name",name:t.name},{default:()=>{var a;return[(a=n.default)==null?void 0:a.call(n)]}})}),dt="";function F(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!i.isVNode(t)}const N={IDLE:0,DESTROYED:2},w=i.defineComponent({name:"notifications",props:{group:{type:String,default:""},width:{type:[Number,String],default:300},reverse:{type:Boolean,default:!1},position:{type:[String,Array],default:()=>S.position},classes:{type:String,default:"vue-notification"},animationType:{type:String,default:"css",validator(t){return t==="css"||t==="velocity"}},animation:{type:Object,default(){return S.velocityAnimation}},animationName:{type:String,default:S.cssAnimation},speed:{type:Number,default:300},duration:{type:Number,default:3e3},delay:{type:Number,default:0},max:{type:Number,default:1/0},ignoreDuplicates:{type:Boolean,default:!1},closeOnClick:{type:Boolean,default:!0},pauseOnHover:{type:Boolean,default:!1},dangerouslySetInnerHtml:{type:Boolean,default:!1}},emits:{click:t=>!0,destroy:t=>!0,start:t=>!0},setup:(t,{emit:n,slots:a,expose:r})=>{const c=i.ref([]),h=i.ref(null),u=D.get("velocity"),f=i.computed(()=>t.animationType==="velocity"),J=i.computed(()=>f.value?G:Y),d=i.computed(()=>c.value.filter(e=>e.state!==N.DESTROYED)),V=i.computed(()=>H(t.width)),I=i.computed(()=>{const{x:e,y:o}=_(t.position),s=V.value.value,p=V.value.type,g={width:s+p};return o&&(g[o]="0px"),e&&(e==="center"?g.left=`calc(50% - ${+s/2}${p})`:g[e]="0px"),g}),v=i.computed(()=>"bottom"in I.value),K=e=>{n("click",e),t.closeOnClick&&y(e)},Q=()=>{var e;t.pauseOnHover&&((e=h.value)==null||e.pause())},U=()=>{var e;t.pauseOnHover&&((e=h.value)==null||e.resume())},X=(e={})=>{if(e.group||(e.group=""),e.data||(e.data={}),t.group!==e.group)return;if(e.clean||e.clear){it();return}const o=typeof e.duration=="number"?e.duration:t.duration,s=typeof e.speed=="number"?e.speed:t.speed,p=typeof e.ignoreDuplicates=="boolean"?e.ignoreDuplicates:t.ignoreDuplicates,{title:g,text:rt,type:st,data:ct,id:lt}=e,m={id:lt||R(),title:g,text:rt,type:st,state:N.IDLE,speed:s,length:o+2*s,data:ct};o>=0&&(h.value=new $(()=>y(m),m.length,m));const ut=t.reverse?!v.value:v.value;let b=-1;const ft=d.value.some(M=>M.title===e.title&&M.text===e.text);(!p||!ft)&&(ut?(c.value.push(m),n("start",m),d.value.length>t.max&&(b=0)):(c.value.unshift(m),n("start",m),d.value.length>t.max&&(b=d.value.length-1)),b!==-1&&y(d.value[b]))},Z=e=>{nt(e)},tt=e=>["vue-notification-template",t.classes,e.type||""],et=e=>f.value?void 0:{transition:`all ${e.speed}ms`},y=e=>{clearTimeout(e.timer),e.state=N.DESTROYED,C(),n("destroy",e)},nt=e=>{const o=c.value.find(s=>s.id===e);o&&y(o)},it=()=>{d.value.forEach(y)},L=(e,o)=>{var p;const s=(p=t.animation)==null?void 0:p[e];return typeof s=="function"?s(o):s},ot=(e,o)=>{if(!f.value)return;const s=L("enter",e);u(e,s,{duration:t.speed,complete:o})},at=(e,o)=>{if(!f.value)return;const s=L("leave",e);u(e,s,{duration:t.speed,complete:o})};function C(){c.value=c.value.filter(e=>e.state!==N.DESTROYED)}return i.onMounted(()=>{x.on("add",X),x.on("close",Z)}),()=>{let e;return i.createVNode("div",{class:"vue-notification-group",style:I.value},[i.createVNode(J.value,{name:t.animationName,onEnter:ot,onLeave:at,onAfterLeave:C},F(e=d.value.map(o=>i.createVNode("div",{key:o.id,class:"vue-notification-wrapper",style:et(o),"data-id":o.id,onMouseenter:Q,onMouseleave:U},[a.body?a.body({item:o,class:[t.classes,o.type].join(""),close:()=>y(o)}):i.createVNode("div",{class:tt(o),onClick:()=>K(o)},[t.dangerouslySetInnerHtml?i.createVNode(i.Fragment,null,[o.title?i.createVNode("div",{class:"notification-title",innerHTML:o.title},null):null,i.createVNode("div",{class:"notification-content",innerHTML:o.text},null)]):i.createVNode(i.Fragment,null,[o.title?i.createVNode("div",{class:"notification-title"},[o.title]):null,i.createVNode("div",{class:"notification-content"},[o.text])])])])))?e:{default:()=>[e]})])}}}),T=t=>{typeof t=="string"&&(t={title:"",text:t}),typeof t=="object"&&x.emit("add",t)};T.close=t=>{x.emit("close",t)};const P=()=>({notify:T}),W="Notifications";function q(t,n={}){Object.entries(n).forEach(r=>D.set(...r));const a=n.name||"notify";t.config.globalProperties["$"+a]=T,t.component(n.componentName||W,w)}const z={install:q};l.Notifications=w,l.default=z,l.notify=T,l.useNotification=P,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
{
"name": "@kyvg/vue3-notification",
"description": "Vue.js Notification Library",
"version": "3.1.0-5",
"version": "3.1.0-6",
"author": "kyvg",

@@ -18,3 +18,2 @@ "private": false,

"build:resolver": "vite build -c vite.resolver.config.js",
"dev": "vite serve -c vite.demo.config.js",
"unit": "vitest",

@@ -21,0 +20,0 @@ "unit:watch": "vitest --watch",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc