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

mosha-vue-toastify

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mosha-vue-toastify - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/config.d.ts

1

dist/components/createToast.d.ts
import { ToastOptions, ToastContent } from '../types';
export declare const initializeOptions: (options: ToastOptions) => ToastOptions;
export declare const createToast: (content: ToastContent, options?: ToastOptions | undefined) => void;

3

dist/hooks/useTransitionType.d.ts
import { Position, TransitionType } from '../types';
declare const useTransitionType: (position: Position, transition: TransitionType, swiped: any) => {
import { Ref } from 'vue';
declare const useTransitionType: (position: Position, transition: TransitionType, swiped: Ref<number>) => {
transitionType: import("vue").ComputedRef<string>;
};
export default useTransitionType;

@@ -1,1 +0,1 @@

var e=Object.defineProperty,t=Object.prototype.hasOwnProperty,o=Object.getOwnPropertySymbols,n=Object.prototype.propertyIsEnumerable,s=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,i=(e,i)=>{for(var l in i||(i={}))t.call(i,l)&&s(e,l,i[l]);if(o)for(var l of o(i))n.call(i,l)&&s(e,l,i[l]);return e};import{ref as l,onMounted as a,onUnmounted as r,computed as p,defineComponent as u,openBlock as c,createBlock as h,createVNode as v,watchEffect as d,resolveComponent as f,Transition as m,withCtx as g,createCommentVNode as _,toDisplayString as w,render as y}from"vue";const b={"top-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"},"top-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"top-center":{bounce:"mosha__bounceInDown",flip:"mosha__flipIn",slide:"mosha__slideInDown"},"bottom-center":{bounce:"mosha__bounceInUp",flip:"mosha__flipIn",slide:"mosha__slideInUp"},"bottom-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"bottom-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"}};var x=u({props:{type:{type:String,default:"default"}}});const I={class:"mosha__icon"},C={key:0,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},M=v("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3zM12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),B={key:1,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},S=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),T={key:2,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},L=v("path",{d:"M0 0h24v24H0V0z",fill:"none"},null,-1),z=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"},null,-1),k={key:3,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#616161"},H=v("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),P=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1),D={key:4,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},V=v("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),$=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1);x.render=function(e,t,o,n,s,i){return c(),h("span",I,["warning"===e.type?(c(),h("svg",C,[M])):"danger"===e.type?(c(),h("svg",B,[S])):"success"===e.type?(c(),h("svg",T,[L,z])):"default"===e.type?(c(),h("svg",k,[H,P])):(c(),h("svg",D,[V,$]))])};var E=u({name:"MToast",components:{MIcon:x},props:{visible:Boolean,text:String,description:String,toastBackgroundColor:String,type:{type:String,default:"default"},onCloseHandler:{type:Function,required:!0},offset:Number,id:{type:Number,required:!0},timeout:{type:Number,default:5e3},position:{type:String,required:!0},showCloseButton:{type:Boolean,default:!0},swipeClose:{type:Boolean,default:!0},hideProgressBar:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},transition:{type:String,default:"bounce"}},setup(e){const t=l(),{swipedDiff:o,startSwipeHandler:n,swipeStyle:s,cleanUpMove:u}=((e,t,o)=>{const n=l(),s=l(void 0),a=l(),p=e=>e instanceof MouseEvent,u=l=>{!1!==o&&n.value&&(p(l)?s.value=n.value.clientX-l.clientX:s.value=n.value.touches[0].clientX-l.touches[0].clientX,e.endsWith("left")?a.value=i(i({},a.value),{transition:"none",left:-s.value+"px"}):a.value=i(i({},a.value),{transition:"none",right:`${s.value}px`}),Math.abs(s.value)>200&&t())},c=e=>{!1!==o&&(n.value&&(n.value=void 0),s.value&&(s.value=void 0),removeEventListener(e,u))};return r((()=>{!1!==o&&(c("mousemove"),c("touchmove"))})),{swipedDiff:s,swipeStart:n,swipeStyle:a,swipeHandler:u,startSwipeHandler:t=>{if(!1===o)return;n.value=t;const s=p(t)?"mousemove":"touchmove",l=p(t)?"mouseup":"touchend";addEventListener(s,u),addEventListener(l,(()=>{n.value=void 0,e.endsWith("left")?a.value=i(i({},a.value),{transition:"left .3s ease-out",left:0}):a.value=i(i({},a.value),{transition:"right .3s ease-out",right:0}),removeEventListener(s,u)}))},cleanUpMove:c}})(e.position,e.onCloseHandler,e.swipeClose),{transitionType:c}=(h=e.position,v=e.transition,f=o,{transitionType:p((()=>f.value>0?"mosha__fadeOutLeft":f.value<0?"mosha__fadeOutRight":b[h][v]))});var h,v,f;const{start:m,stop:g,progress:_}=((e,t)=>{const o=l(),n=l(0),s=l(t),i=l(),p=l(100),u=()=>{clearInterval(i.value),clearTimeout(o.value)};return a((()=>{})),r((()=>{u()})),{start:()=>{n.value=Date.now(),clearTimeout(o.value),i.value=setInterval((()=>{p.value--}),t/100-2),o.value=setTimeout(e,s.value)},stop:()=>{clearInterval(i.value),clearTimeout(o.value),s.value-=Date.now()-n.value},clear:u,progress:p}})((()=>{e.onCloseHandler()}),e.timeout),w=()=>{e.timeout>0&&m()};return d((()=>{const{customStyle:o}=((e,t,o)=>{const n=p((()=>{switch(e){case"top-left":return{left:"0",top:`${t}px`};case"bottom-left":return{left:"0",bottom:`${t}px`};case"bottom-right":return{right:"0",bottom:`${t}px`};case"top-center":return{top:`${t}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};case"bottom-center":return{bottom:`${t}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};default:return{right:"0",top:`${t}px`}}}));return o&&(n.value.backgroundColor=o),{customStyle:n}})(e.position,e.offset,e.toastBackgroundColor);t.value=o.value})),a((()=>{w()})),{style:t,transitionType:c,startTimer:w,stopTimer:()=>{e.timeout>0&&g()},progress:_,onTouchStart:e=>{n(e)},onMouseLeave:()=>{u("mousemove"),w()},onMouseDown:e=>{n(e)},swipeStyle:s}}});const N={class:"mosha__toast__content-wrapper"},O={class:"mosha__toast__content"},R={class:"mosha__toast__content__text"},j={key:0,class:"mosha__toast__content__description"};E.render=function(e,t,o,n,s,i){const l=f("MIcon");return c(),h(m,{name:e.transitionType,type:"animation"},{default:g((()=>[e.visible?(c(),h("div",{key:0,class:["mosha__toast",e.toastBackgroundColor?null:e.type],style:[e.style,e.swipeStyle],onMouseenter:t[2]||(t[2]=(...t)=>e.stopTimer&&e.stopTimer(...t)),onMouseleave:t[3]||(t[3]=(...t)=>e.onMouseLeave&&e.onMouseLeave(...t)),onTouchstart:t[4]||(t[4]=(...t)=>e.onTouchStart&&e.onTouchStart(...t)),onMousedown:t[5]||(t[5]=(...t)=>e.onMouseDown&&e.onMouseDown(...t))},[v("div",N,[e.showIcon?(c(),h(l,{key:0,type:e.type},null,8,["type"])):_("",!0),v("div",O,[v("div",R,w(e.text),1),e.description?(c(),h("div",j,w(e.description),1)):_("",!0)])]),e.showCloseButton?(c(),h("div",{key:0,class:"mosha__toast__close-icon",onClick:t[1]||(t[1]=(...t)=>e.onCloseHandler&&e.onCloseHandler(...t))})):_("",!0),e.hideProgressBar?_("",!0):(c(),h("div",{key:1,class:"mosha__toast__progress",style:{width:`${e.progress}%`}},null,4))],38)):_("",!0)])),_:1},8,["name"])};const U={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[],"top-center":[],"bottom-center":[]},X={type:"default",timeout:5e3,showCloseButton:!0,position:"top-right",transition:"bounce",hideProgressBar:!1,swipeClose:!0};let q=0;const W=(e,t)=>{const o=t?(e=>{const t=i(i({},e),{type:e.type||X.type,timeout:e.timeout||X.timeout,showCloseButton:e.showCloseButton,position:e.position||X.position,showIcon:e.showIcon,swipeClose:e.swipeClose,transition:e.transition||X.transition});return t.hideProgressBar=void 0!==t.timeout&&t.timeout<=0,void 0!==e.hideProgressBar&&(t.hideProgressBar=e.hideProgressBar),t})(t):X,n="string"==typeof e?e:e.title,s="string"==typeof e?void 0:e.description;let l=12;const a=q++;if(!o.position)return;U[o.position].forEach((({toastVNode:e})=>{const t=e.el.offsetHeight+12;l+=t||0}));const r=document.createElement("div");document.body.appendChild(r);let p=null;p=v(E,i(i({},o),{text:n,description:s,id:a,offset:l,visible:!1,onCloseHandler:()=>{F(a,o.position?o.position:"top-right")}})),y(p,r),o.position&&(U[o.position].push({toastVNode:p,container:r}),p.component&&(p.component.props.visible=!0))},F=(e,t)=>{const o=U[t],n=o.findIndex((({toastVNode:t})=>e===t.props.id));if(-1===n)return;const{container:s,toastVNode:i}=o[n],l=i.el.offsetHeight;U[t].splice(n,1),i.component.props.visible=!1,i.component.props.onClose&&i.component.props.onClose();for(let a=n;a<o.length;a++){const{toastVNode:e}=o[a];if(!e.el)return;const n=t.split("-")[0]||"top",s=parseInt(e.el.style[n],10)-l-12;if(!e.component)return;e.component.props.offset=s}setTimeout((()=>{y(null,s),document.body.removeChild(s)}),1e3)};var A={install:(e,t)=>{e.config.globalProperties.$moshaToast=W,e.provide("moshaToast",W)}};export default A;export{W as createToast};
var e=Object.defineProperty,t=Object.prototype.hasOwnProperty,o=Object.getOwnPropertySymbols,n=Object.prototype.propertyIsEnumerable,s=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,i=(e,i)=>{for(var l in i||(i={}))t.call(i,l)&&s(e,l,i[l]);if(o)for(var l of o(i))n.call(i,l)&&s(e,l,i[l]);return e};import{ref as l,onMounted as a,onUnmounted as r,computed as p,defineComponent as u,openBlock as c,createBlock as h,createVNode as v,watchEffect as d,resolveComponent as f,Transition as m,withCtx as g,createCommentVNode as _,toDisplayString as w,render as y}from"vue";const b={type:"default",timeout:5e3,showCloseButton:!0,position:"top-right",transition:"bounce",hideProgressBar:!1,swipeClose:!0},x={"top-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"},"top-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"top-center":{bounce:"mosha__bounceInDown",flip:"mosha__flipIn",slide:"mosha__slideInDown"},"bottom-center":{bounce:"mosha__bounceInUp",flip:"mosha__flipIn",slide:"mosha__slideInUp"},"bottom-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"bottom-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"}};var I=u({props:{type:{type:String,default:"default"}}});const C={class:"mosha__icon"},M={key:0,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},B=v("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3zM12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),S={key:1,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},T=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),L={key:2,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},z=v("path",{d:"M0 0h24v24H0V0z",fill:"none"},null,-1),k=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"},null,-1),H={key:3,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#616161"},P=v("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),D=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1),V={key:4,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},$=v("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),E=v("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1);I.render=function(e,t,o,n,s,i){return c(),h("span",C,["warning"===e.type?(c(),h("svg",M,[B])):"danger"===e.type?(c(),h("svg",S,[T])):"success"===e.type?(c(),h("svg",L,[z,k])):"default"===e.type?(c(),h("svg",H,[P,D])):(c(),h("svg",V,[$,E]))])};var N=u({name:"MToast",components:{MIcon:I},props:{visible:Boolean,text:String,description:String,toastBackgroundColor:String,type:{type:String,default:"default"},onCloseHandler:{type:Function,required:!0},offset:Number,id:{type:Number,required:!0},timeout:{type:Number,default:5e3},position:{type:String,required:!0},showCloseButton:{type:Boolean,default:!0},swipeClose:{type:Boolean,default:!0},hideProgressBar:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},transition:{type:String,default:"bounce"}},setup(e){const t=l(),{swipedDiff:o,startSwipeHandler:n,swipeStyle:s,cleanUpMove:u}=((e,t,o)=>{const n=l(),s=l(void 0),a=l(),p=e=>e instanceof MouseEvent,u=l=>{!1!==o&&n.value&&(p(l)?s.value=n.value.clientX-l.clientX:s.value=n.value.touches[0].clientX-l.touches[0].clientX,a.value=i(i({},a.value),{transition:"none"}),e.endsWith("left")?a.value.left=-s.value+"px":a.value.right=`${s.value}px`,Math.abs(s.value)>200&&t())},c=e=>{!1!==o&&(n.value&&(n.value=void 0),s.value&&(s.value=void 0),removeEventListener(e,u))};return r((()=>{!1!==o&&(c("mousemove"),c("touchmove"))})),{swipedDiff:s,swipeStart:n,swipeStyle:a,swipeHandler:u,startSwipeHandler:t=>{if(!1===o)return;n.value=t;const s=p(t)?"mousemove":"touchmove",l=p(t)?"mouseup":"touchend";addEventListener(s,u),addEventListener(l,(()=>{n.value=void 0,e.endsWith("left")?a.value=i(i({},a.value),{transition:"left .3s ease-out",left:0}):a.value=i(i({},a.value),{transition:"right .3s ease-out",right:0}),removeEventListener(s,u)}))},cleanUpMove:c}})(e.position,e.onCloseHandler,e.swipeClose),{transitionType:c}=(h=e.position,v=e.transition,f=o,{transitionType:p((()=>f.value>200?"mosha__fadeOutLeft":f.value<-200?"mosha__fadeOutRight":x[h][v]))});var h,v,f;const{start:m,stop:g,progress:_}=((e,t)=>{const o=l(),n=l(0),s=l(t),i=l(),p=l(100),u=()=>{clearInterval(i.value),clearTimeout(o.value)};return a((()=>{})),r((()=>{u()})),{start:()=>{n.value=Date.now(),clearTimeout(o.value),i.value=setInterval((()=>{p.value--}),t/100-2),o.value=setTimeout(e,s.value)},stop:()=>{clearInterval(i.value),clearTimeout(o.value),s.value-=Date.now()-n.value},clear:u,progress:p}})((()=>{e.onCloseHandler()}),e.timeout),w=()=>{e.timeout>0&&m()};return d((()=>{const{customStyle:o}=((e,t,o)=>{const n=p((()=>{switch(e){case"top-left":return{left:"0",top:`${t}px`};case"bottom-left":return{left:"0",bottom:`${t}px`};case"bottom-right":return{right:"0",bottom:`${t}px`};case"top-center":return{top:`${t}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};case"bottom-center":return{bottom:`${t}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};default:return{right:"0",top:`${t}px`}}}));return o&&(n.value.backgroundColor=o),{customStyle:n}})(e.position,e.offset,e.toastBackgroundColor);t.value=o.value})),a((()=>{w()})),{style:t,transitionType:c,startTimer:w,stopTimer:()=>{e.timeout>0&&g()},progress:_,onTouchStart:e=>{n(e)},onMouseLeave:()=>{u("mousemove"),w()},onMouseDown:e=>{n(e)},swipeStyle:s}}});const O={class:"mosha__toast__content-wrapper"},R={class:"mosha__toast__content"},j={class:"mosha__toast__content__text"},U={key:0,class:"mosha__toast__content__description"};N.render=function(e,t,o,n,s,i){const l=f("MIcon");return c(),h(m,{name:e.transitionType,type:"animation"},{default:g((()=>[e.visible?(c(),h("div",{key:0,class:["mosha__toast",e.toastBackgroundColor?null:e.type],style:[e.style,e.swipeStyle],onMouseenter:t[2]||(t[2]=(...t)=>e.stopTimer&&e.stopTimer(...t)),onMouseleave:t[3]||(t[3]=(...t)=>e.onMouseLeave&&e.onMouseLeave(...t)),onTouchstart:t[4]||(t[4]=(...t)=>e.onTouchStart&&e.onTouchStart(...t)),onMousedown:t[5]||(t[5]=(...t)=>e.onMouseDown&&e.onMouseDown(...t))},[v("div",O,[e.showIcon?(c(),h(l,{key:0,type:e.type},null,8,["type"])):_("",!0),v("div",R,[v("div",j,w(e.text),1),e.description?(c(),h("div",U,w(e.description),1)):_("",!0)])]),e.showCloseButton?(c(),h("div",{key:0,class:"mosha__toast__close-icon",onClick:t[1]||(t[1]=(...t)=>e.onCloseHandler&&e.onCloseHandler(...t))})):_("",!0),e.hideProgressBar?_("",!0):(c(),h("div",{key:1,class:"mosha__toast__progress",style:{width:`${e.progress}%`}},null,4))],38)):_("",!0)])),_:1},8,["name"])};const X={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[],"top-center":[],"bottom-center":[]};let q=0;const W=e=>{const t=i(i({},e),{type:e.type||b.type,timeout:e.timeout||b.timeout,showCloseButton:e.showCloseButton,position:e.position||b.position,showIcon:e.showIcon,swipeClose:e.swipeClose,transition:e.transition||b.transition});return t.hideProgressBar=void 0!==t.timeout&&t.timeout<=0,void 0!==e.hideProgressBar&&(t.hideProgressBar=e.hideProgressBar),t},F=(e,t)=>{const o=t?W(t):b,n="string"==typeof e?e:e.title,s="string"==typeof e?void 0:e.description,l=q++;let a=12;if(!o.position)return;X[o.position].forEach((({toastVNode:e})=>{const t=e.el.offsetHeight+12;a+=t||0}));const r=document.createElement("div");document.body.appendChild(r);let p=null;p=v(N,i(i({},o),{text:n,description:s,id:l,offset:a,visible:!1,onCloseHandler:()=>{A(l,o.position?o.position:"top-right")}})),y(p,r),o.position&&(X[o.position].push({toastVNode:p,container:r}),p.component&&(p.component.props.visible=!0))},A=(e,t)=>{const o=X[t],n=o.findIndex((({toastVNode:t})=>e===t.props.id));if(-1===n)return;const{container:s,toastVNode:i}=o[n],l=i.el.offsetHeight;X[t].splice(n,1),i.component.props.visible=!1,i.component.props.onClose&&i.component.props.onClose();for(let a=n;a<o.length;a++){const{toastVNode:e}=o[a];if(!e.el)return;const n=t.split("-")[0]||"top",s=parseInt(e.el.style[n],10)-l-12;if(!e.component)return;e.component.props.offset=s}setTimeout((()=>{y(null,s),document.body.removeChild(s)}),1e3)};var G={install:(e,t)=>{e.config.globalProperties.$moshaToast=F,e.provide("moshaToast",F)}};export default G;export{F as createToast,W as initializeOptions};

@@ -1,1 +0,1 @@

var __defProp=Object.defineProperty,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__assign=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["mosha-vue-toastify"]={},e.Vue)}(this,(function(e,t){"use strict";const o={"top-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"},"top-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"top-center":{bounce:"mosha__bounceInDown",flip:"mosha__flipIn",slide:"mosha__slideInDown"},"bottom-center":{bounce:"mosha__bounceInUp",flip:"mosha__flipIn",slide:"mosha__slideInUp"},"bottom-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"bottom-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"}};var n=t.defineComponent({props:{type:{type:String,default:"default"}}});const s={class:"mosha__icon"},i={key:0,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},r=t.createVNode("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3zM12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),a={key:1,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},l=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),p={key:2,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},c=t.createVNode("path",{d:"M0 0h24v24H0V0z",fill:"none"},null,-1),u=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"},null,-1),d={key:3,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#616161"},f=t.createVNode("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),m=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1),h={key:4,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},v=t.createVNode("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),_=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1);n.render=function(e,o,n,g,w,y){return t.openBlock(),t.createBlock("span",s,["warning"===e.type?(t.openBlock(),t.createBlock("svg",i,[r])):"danger"===e.type?(t.openBlock(),t.createBlock("svg",a,[l])):"success"===e.type?(t.openBlock(),t.createBlock("svg",p,[c,u])):"default"===e.type?(t.openBlock(),t.createBlock("svg",d,[f,m])):(t.openBlock(),t.createBlock("svg",h,[v,_]))])};var g=t.defineComponent({name:"MToast",components:{MIcon:n},props:{visible:Boolean,text:String,description:String,toastBackgroundColor:String,type:{type:String,default:"default"},onCloseHandler:{type:Function,required:!0},offset:Number,id:{type:Number,required:!0},timeout:{type:Number,default:5e3},position:{type:String,required:!0},showCloseButton:{type:Boolean,default:!0},swipeClose:{type:Boolean,default:!0},hideProgressBar:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},transition:{type:String,default:"bounce"}},setup(e){const n=t.ref(),{swipedDiff:s,startSwipeHandler:i,swipeStyle:r,cleanUpMove:a}=((e,o,n)=>{const s=t.ref(),i=t.ref(void 0),r=t.ref(),a=e=>e instanceof MouseEvent,l=t=>{!1!==n&&s.value&&(a(t)?i.value=s.value.clientX-t.clientX:i.value=s.value.touches[0].clientX-t.touches[0].clientX,e.endsWith("left")?r.value=__assign(__assign({},r.value),{transition:"none",left:-i.value+"px"}):r.value=__assign(__assign({},r.value),{transition:"none",right:`${i.value}px`}),Math.abs(i.value)>200&&o())},p=e=>{!1!==n&&(s.value&&(s.value=void 0),i.value&&(i.value=void 0),removeEventListener(e,l))};return t.onUnmounted((()=>{!1!==n&&(p("mousemove"),p("touchmove"))})),{swipedDiff:i,swipeStart:s,swipeStyle:r,swipeHandler:l,startSwipeHandler:t=>{if(!1===n)return;s.value=t;const o=a(t)?"mousemove":"touchmove",i=a(t)?"mouseup":"touchend";addEventListener(o,l),addEventListener(i,(()=>{s.value=void 0,e.endsWith("left")?r.value=__assign(__assign({},r.value),{transition:"left .3s ease-out",left:0}):r.value=__assign(__assign({},r.value),{transition:"right .3s ease-out",right:0}),removeEventListener(o,l)}))},cleanUpMove:p}})(e.position,e.onCloseHandler,e.swipeClose),{transitionType:l}=(p=e.position,c=e.transition,u=s,{transitionType:t.computed((()=>u.value>0?"mosha__fadeOutLeft":u.value<0?"mosha__fadeOutRight":o[p][c]))});var p,c,u;const{start:d,stop:f,progress:m}=((e,o)=>{const n=t.ref(),s=t.ref(0),i=t.ref(o),r=t.ref(),a=t.ref(100),l=()=>{clearInterval(r.value),clearTimeout(n.value)};return t.onMounted((()=>{})),t.onUnmounted((()=>{l()})),{start:()=>{s.value=Date.now(),clearTimeout(n.value),r.value=setInterval((()=>{a.value--}),o/100-2),n.value=setTimeout(e,i.value)},stop:()=>{clearInterval(r.value),clearTimeout(n.value),i.value-=Date.now()-s.value},clear:l,progress:a}})((()=>{e.onCloseHandler()}),e.timeout),h=()=>{e.timeout>0&&d()};return t.watchEffect((()=>{const{customStyle:o}=((e,o,n)=>{const s=t.computed((()=>{switch(e){case"top-left":return{left:"0",top:`${o}px`};case"bottom-left":return{left:"0",bottom:`${o}px`};case"bottom-right":return{right:"0",bottom:`${o}px`};case"top-center":return{top:`${o}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};case"bottom-center":return{bottom:`${o}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};default:return{right:"0",top:`${o}px`}}}));return n&&(s.value.backgroundColor=n),{customStyle:s}})(e.position,e.offset,e.toastBackgroundColor);n.value=o.value})),t.onMounted((()=>{h()})),{style:n,transitionType:l,startTimer:h,stopTimer:()=>{e.timeout>0&&f()},progress:m,onTouchStart:e=>{i(e)},onMouseLeave:()=>{a("mousemove"),h()},onMouseDown:e=>{i(e)},swipeStyle:r}}});const w={class:"mosha__toast__content-wrapper"},y={class:"mosha__toast__content"},b={class:"mosha__toast__content__text"},B={key:0,class:"mosha__toast__content__description"};g.render=function(e,o,n,s,i,r){const a=t.resolveComponent("MIcon");return t.openBlock(),t.createBlock(t.Transition,{name:e.transitionType,type:"animation"},{default:t.withCtx((()=>[e.visible?(t.openBlock(),t.createBlock("div",{key:0,class:["mosha__toast",e.toastBackgroundColor?null:e.type],style:[e.style,e.swipeStyle],onMouseenter:o[2]||(o[2]=(...t)=>e.stopTimer&&e.stopTimer(...t)),onMouseleave:o[3]||(o[3]=(...t)=>e.onMouseLeave&&e.onMouseLeave(...t)),onTouchstart:o[4]||(o[4]=(...t)=>e.onTouchStart&&e.onTouchStart(...t)),onMousedown:o[5]||(o[5]=(...t)=>e.onMouseDown&&e.onMouseDown(...t))},[t.createVNode("div",w,[e.showIcon?(t.openBlock(),t.createBlock(a,{key:0,type:e.type},null,8,["type"])):t.createCommentVNode("",!0),t.createVNode("div",y,[t.createVNode("div",b,t.toDisplayString(e.text),1),e.description?(t.openBlock(),t.createBlock("div",B,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),e.showCloseButton?(t.openBlock(),t.createBlock("div",{key:0,class:"mosha__toast__close-icon",onClick:o[1]||(o[1]=(...t)=>e.onCloseHandler&&e.onCloseHandler(...t))})):t.createCommentVNode("",!0),e.hideProgressBar?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock("div",{key:1,class:"mosha__toast__progress",style:{width:`${e.progress}%`}},null,4))],38)):t.createCommentVNode("",!0)])),_:1},8,["name"])};const k={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[],"top-center":[],"bottom-center":[]},C={type:"default",timeout:5e3,showCloseButton:!0,position:"top-right",transition:"bounce",hideProgressBar:!1,swipeClose:!0};let x=0;const I=(e,o)=>{const n=o?(e=>{const t=__assign(__assign({},e),{type:e.type||C.type,timeout:e.timeout||C.timeout,showCloseButton:e.showCloseButton,position:e.position||C.position,showIcon:e.showIcon,swipeClose:e.swipeClose,transition:e.transition||C.transition});return t.hideProgressBar=void 0!==t.timeout&&t.timeout<=0,void 0!==e.hideProgressBar&&(t.hideProgressBar=e.hideProgressBar),t})(o):C,s="string"==typeof e?e:e.title,i="string"==typeof e?void 0:e.description;let r=12;const a=x++;if(!n.position)return;k[n.position].forEach((({toastVNode:e})=>{const t=e.el.offsetHeight+12;r+=t||0}));const l=document.createElement("div");document.body.appendChild(l);let p=null;p=t.createVNode(g,__assign(__assign({},n),{text:s,description:i,id:a,offset:r,visible:!1,onCloseHandler:()=>{S(a,n.position?n.position:"top-right")}})),t.render(p,l),n.position&&(k[n.position].push({toastVNode:p,container:l}),p.component&&(p.component.props.visible=!0))},S=(e,o)=>{const n=k[o],s=n.findIndex((({toastVNode:t})=>e===t.props.id));if(-1===s)return;const{container:i,toastVNode:r}=n[s],a=r.el.offsetHeight;k[o].splice(s,1),r.component.props.visible=!1,r.component.props.onClose&&r.component.props.onClose();for(let t=s;t<n.length;t++){const{toastVNode:e}=n[t];if(!e.el)return;const s=o.split("-")[0]||"top",i=parseInt(e.el.style[s],10)-a-12;if(!e.component)return;e.component.props.offset=i}setTimeout((()=>{t.render(null,i),document.body.removeChild(i)}),1e3)};var M={install:(e,t)=>{e.config.globalProperties.$moshaToast=I,e.provide("moshaToast",I)}};e.createToast=I,e.default=M,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
var __defProp=Object.defineProperty,__hasOwnProp=Object.prototype.hasOwnProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,o)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__assign=(e,t)=>{for(var o in t||(t={}))__hasOwnProp.call(t,o)&&__defNormalProp(e,o,t[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(t))__propIsEnum.call(t,o)&&__defNormalProp(e,o,t[o]);return e};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["mosha-vue-toastify"]={},e.Vue)}(this,(function(e,t){"use strict";const o={type:"default",timeout:5e3,showCloseButton:!0,position:"top-right",transition:"bounce",hideProgressBar:!1,swipeClose:!0},n={"top-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"},"top-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"top-center":{bounce:"mosha__bounceInDown",flip:"mosha__flipIn",slide:"mosha__slideInDown"},"bottom-center":{bounce:"mosha__bounceInUp",flip:"mosha__flipIn",slide:"mosha__slideInUp"},"bottom-right":{bounce:"mosha__bounceInRight",flip:"mosha__flipIn",slide:"mosha__slideInRight"},"bottom-left":{bounce:"mosha__bounceInLeft",flip:"mosha__flipIn",slide:"mosha__slideInLeft"}};var s=t.defineComponent({props:{type:{type:String,default:"default"}}});const i={class:"mosha__icon"},r={key:0,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},a=t.createVNode("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3zM12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),l={key:1,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},p=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1 4h-2v-2h2v2z"},null,-1),c={key:2,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},u=t.createVNode("path",{d:"M0 0h24v24H0V0z",fill:"none"},null,-1),d=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0z"},null,-1),f={key:3,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#616161"},m=t.createVNode("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),h=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1),v={key:4,xmlns:"http://www.w3.org/2000/svg",height:"32px",viewBox:"0 0 24 24",width:"32px",fill:"#ffffff"},_=t.createVNode("path",{d:"M0 0h24v24H0z",fill:"none"},null,-1),g=t.createVNode("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},null,-1);s.render=function(e,o,n,s,w,y){return t.openBlock(),t.createBlock("span",i,["warning"===e.type?(t.openBlock(),t.createBlock("svg",r,[a])):"danger"===e.type?(t.openBlock(),t.createBlock("svg",l,[p])):"success"===e.type?(t.openBlock(),t.createBlock("svg",c,[u,d])):"default"===e.type?(t.openBlock(),t.createBlock("svg",f,[m,h])):(t.openBlock(),t.createBlock("svg",v,[_,g]))])};var w=t.defineComponent({name:"MToast",components:{MIcon:s},props:{visible:Boolean,text:String,description:String,toastBackgroundColor:String,type:{type:String,default:"default"},onCloseHandler:{type:Function,required:!0},offset:Number,id:{type:Number,required:!0},timeout:{type:Number,default:5e3},position:{type:String,required:!0},showCloseButton:{type:Boolean,default:!0},swipeClose:{type:Boolean,default:!0},hideProgressBar:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},transition:{type:String,default:"bounce"}},setup(e){const o=t.ref(),{swipedDiff:s,startSwipeHandler:i,swipeStyle:r,cleanUpMove:a}=((e,o,n)=>{const s=t.ref(),i=t.ref(void 0),r=t.ref(),a=e=>e instanceof MouseEvent,l=t=>{!1!==n&&s.value&&(a(t)?i.value=s.value.clientX-t.clientX:i.value=s.value.touches[0].clientX-t.touches[0].clientX,r.value=__assign(__assign({},r.value),{transition:"none"}),e.endsWith("left")?r.value.left=-i.value+"px":r.value.right=`${i.value}px`,Math.abs(i.value)>200&&o())},p=e=>{!1!==n&&(s.value&&(s.value=void 0),i.value&&(i.value=void 0),removeEventListener(e,l))};return t.onUnmounted((()=>{!1!==n&&(p("mousemove"),p("touchmove"))})),{swipedDiff:i,swipeStart:s,swipeStyle:r,swipeHandler:l,startSwipeHandler:t=>{if(!1===n)return;s.value=t;const o=a(t)?"mousemove":"touchmove",i=a(t)?"mouseup":"touchend";addEventListener(o,l),addEventListener(i,(()=>{s.value=void 0,e.endsWith("left")?r.value=__assign(__assign({},r.value),{transition:"left .3s ease-out",left:0}):r.value=__assign(__assign({},r.value),{transition:"right .3s ease-out",right:0}),removeEventListener(o,l)}))},cleanUpMove:p}})(e.position,e.onCloseHandler,e.swipeClose),{transitionType:l}=(p=e.position,c=e.transition,u=s,{transitionType:t.computed((()=>u.value>200?"mosha__fadeOutLeft":u.value<-200?"mosha__fadeOutRight":n[p][c]))});var p,c,u;const{start:d,stop:f,progress:m}=((e,o)=>{const n=t.ref(),s=t.ref(0),i=t.ref(o),r=t.ref(),a=t.ref(100),l=()=>{clearInterval(r.value),clearTimeout(n.value)};return t.onMounted((()=>{})),t.onUnmounted((()=>{l()})),{start:()=>{s.value=Date.now(),clearTimeout(n.value),r.value=setInterval((()=>{a.value--}),o/100-2),n.value=setTimeout(e,i.value)},stop:()=>{clearInterval(r.value),clearTimeout(n.value),i.value-=Date.now()-s.value},clear:l,progress:a}})((()=>{e.onCloseHandler()}),e.timeout),h=()=>{e.timeout>0&&d()};return t.watchEffect((()=>{const{customStyle:n}=((e,o,n)=>{const s=t.computed((()=>{switch(e){case"top-left":return{left:"0",top:`${o}px`};case"bottom-left":return{left:"0",bottom:`${o}px`};case"bottom-right":return{right:"0",bottom:`${o}px`};case"top-center":return{top:`${o}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};case"bottom-center":return{bottom:`${o}px`,left:"0",right:"0",marginRight:"auto",marginLeft:"auto"};default:return{right:"0",top:`${o}px`}}}));return n&&(s.value.backgroundColor=n),{customStyle:s}})(e.position,e.offset,e.toastBackgroundColor);o.value=n.value})),t.onMounted((()=>{h()})),{style:o,transitionType:l,startTimer:h,stopTimer:()=>{e.timeout>0&&f()},progress:m,onTouchStart:e=>{i(e)},onMouseLeave:()=>{a("mousemove"),h()},onMouseDown:e=>{i(e)},swipeStyle:r}}});const y={class:"mosha__toast__content-wrapper"},b={class:"mosha__toast__content"},B={class:"mosha__toast__content__text"},k={key:0,class:"mosha__toast__content__description"};w.render=function(e,o,n,s,i,r){const a=t.resolveComponent("MIcon");return t.openBlock(),t.createBlock(t.Transition,{name:e.transitionType,type:"animation"},{default:t.withCtx((()=>[e.visible?(t.openBlock(),t.createBlock("div",{key:0,class:["mosha__toast",e.toastBackgroundColor?null:e.type],style:[e.style,e.swipeStyle],onMouseenter:o[2]||(o[2]=(...t)=>e.stopTimer&&e.stopTimer(...t)),onMouseleave:o[3]||(o[3]=(...t)=>e.onMouseLeave&&e.onMouseLeave(...t)),onTouchstart:o[4]||(o[4]=(...t)=>e.onTouchStart&&e.onTouchStart(...t)),onMousedown:o[5]||(o[5]=(...t)=>e.onMouseDown&&e.onMouseDown(...t))},[t.createVNode("div",y,[e.showIcon?(t.openBlock(),t.createBlock(a,{key:0,type:e.type},null,8,["type"])):t.createCommentVNode("",!0),t.createVNode("div",b,[t.createVNode("div",B,t.toDisplayString(e.text),1),e.description?(t.openBlock(),t.createBlock("div",k,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])]),e.showCloseButton?(t.openBlock(),t.createBlock("div",{key:0,class:"mosha__toast__close-icon",onClick:o[1]||(o[1]=(...t)=>e.onCloseHandler&&e.onCloseHandler(...t))})):t.createCommentVNode("",!0),e.hideProgressBar?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock("div",{key:1,class:"mosha__toast__progress",style:{width:`${e.progress}%`}},null,4))],38)):t.createCommentVNode("",!0)])),_:1},8,["name"])};const C={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[],"top-center":[],"bottom-center":[]};let x=0;const I=e=>{const t=__assign(__assign({},e),{type:e.type||o.type,timeout:e.timeout||o.timeout,showCloseButton:e.showCloseButton,position:e.position||o.position,showIcon:e.showIcon,swipeClose:e.swipeClose,transition:e.transition||o.transition});return t.hideProgressBar=void 0!==t.timeout&&t.timeout<=0,void 0!==e.hideProgressBar&&(t.hideProgressBar=e.hideProgressBar),t},S=(e,n)=>{const s=n?I(n):o,i="string"==typeof e?e:e.title,r="string"==typeof e?void 0:e.description,a=x++;let l=12;if(!s.position)return;C[s.position].forEach((({toastVNode:e})=>{const t=e.el.offsetHeight+12;l+=t||0}));const p=document.createElement("div");document.body.appendChild(p);let c=null;c=t.createVNode(w,__assign(__assign({},s),{text:i,description:r,id:a,offset:l,visible:!1,onCloseHandler:()=>{M(a,s.position?s.position:"top-right")}})),t.render(c,p),s.position&&(C[s.position].push({toastVNode:c,container:p}),c.component&&(c.component.props.visible=!0))},M=(e,o)=>{const n=C[o],s=n.findIndex((({toastVNode:t})=>e===t.props.id));if(-1===s)return;const{container:i,toastVNode:r}=n[s],a=r.el.offsetHeight;C[o].splice(s,1),r.component.props.visible=!1,r.component.props.onClose&&r.component.props.onClose();for(let t=s;t<n.length;t++){const{toastVNode:e}=n[t];if(!e.el)return;const s=o.split("-")[0]||"top",i=parseInt(e.el.style[s],10)-a-12;if(!e.component)return;e.component.props.offset=i}setTimeout((()=>{t.render(null,i),document.body.removeChild(i)}),1e3)};var N={install:(e,t)=>{e.config.globalProperties.$moshaToast=S,e.provide("moshaToast",S)}};e.createToast=S,e.default=N,e.initializeOptions=I,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
{
"name": "mosha-vue-toastify",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "files": [

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