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 to 3.1.1

4

dist/index.es.js

@@ -125,3 +125,3 @@ (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)}})();

return () => l(H, {
tag: "name",
tag: "div",
css: !1,

@@ -151,3 +151,3 @@ name: t.name,

}) => () => l(H, {
tag: "name",
tag: "div",
name: t.name

@@ -154,0 +154,0 @@ }, {

(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 ${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"}})});
(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:"div",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:"div",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)),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&&m(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,y={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 $(()=>m(y),y.length,y));const ut=t.reverse?!I.value:I.value;let b=-1;const ft=d.value.some(M=>M.title===e.title&&M.text===e.text);(!p||!ft)&&(ut?(c.value.push(y),n("start",y),d.value.length>t.max&&(b=0)):(c.value.unshift(y),n("start",y),d.value.length>t.max&&(b=d.value.length-1)),b!==-1&&m(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`},m=e=>{clearTimeout(e.timer),e.state=N.DESTROYED,C(),n("destroy",e)},nt=e=>{const o=c.value.find(s=>s.id===e);o&&m(o)},it=()=>{d.value.forEach(m)},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:v.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:()=>m(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",
"version": "3.1.1",
"author": "kyvg",

@@ -6,0 +6,0 @@ "private": false,

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