vue-toastification
Version:
Toasts for Vue made easy!
3 lines (2 loc) • 22 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VueToastification={},t.Vue)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s,o,i,a=n(e);function r(t,e,n,s){return new(n||(n=Promise))((function(o,i){function a(t){try{c(s.next(t))}catch(t){i(t)}}function r(t){try{c(s.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,r)}c((s=s.apply(t,e||[])).next())}))}function c(t,e){var n,s,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function r(i){return function(r){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,s&&(o=2&i[0]?s.return:i[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,i[1])).done)return o;switch(s=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],s=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,r])}}}(s=t.TYPE||(t.TYPE={})).SUCCESS="success",s.ERROR="error",s.WARNING="warning",s.INFO="info",s.DEFAULT="default",(o=t.POSITION||(t.POSITION={})).TOP_LEFT="top-left",o.TOP_CENTER="top-center",o.TOP_RIGHT="top-right",o.BOTTOM_LEFT="bottom-left",o.BOTTOM_CENTER="bottom-center",o.BOTTOM_RIGHT="bottom-right",function(t){t.ADD="add",t.DISMISS="dismiss",t.UPDATE="update",t.CLEAR="clear",t.UPDATE_DEFAULTS="update_defaults"}(i||(i={}));var u,l="Vue-Toastification",d={type:{type:String,default:t.TYPE.DEFAULT},classNames:{type:[String,Array],default:function(){return[]}},trueBoolean:{type:Boolean,default:!0}},f={type:d.type,customIcon:{type:[String,Boolean,Object,Function],default:!0}},h={component:{type:[String,Object,Function,Boolean],default:"button"},classNames:d.classNames,showOnHover:Boolean,ariaLabel:{type:String,default:"close"}},p={timeout:{type:[Number,Boolean],default:5e3},hideProgressBar:Boolean,isRunning:Boolean},v={transition:{type:[Object,String],default:l+"__bounce"},transitionDuration:{type:[Number,Object],default:750}},m={CORE_TOAST:{position:{type:String,default:t.POSITION.TOP_RIGHT},draggable:d.trueBoolean,draggablePercent:{type:Number,default:.6},pauseOnFocusLoss:d.trueBoolean,pauseOnHover:d.trueBoolean,closeOnClick:d.trueBoolean,timeout:p.timeout,hideProgressBar:p.hideProgressBar,toastClassName:d.classNames,bodyClassName:d.classNames,icon:f.customIcon,closeButton:h.component,closeButtonClassName:h.classNames,showCloseButtonOnHover:h.showOnHover,accessibility:{type:Object,default:function(){return{toastRole:"alert",closeButtonLabel:"close"}}},rtl:Boolean,eventBus:Object},TOAST:{id:{type:[String,Number],required:!0},type:d.type,content:{type:[String,Object,Function],required:!0},onClick:Function,onClose:Function},CONTAINER:{container:{type:void 0,default:function(){return document.body}},newestOnTop:d.trueBoolean,maxToasts:{type:Number,default:20},transition:v.transition,transitionDuration:v.transitionDuration,toastDefaults:Object,filterBeforeCreate:{type:Function,default:function(t){return t}},filterToasts:{type:Function,default:function(t){return t}},containerClassName:d.classNames,onMounted:Function},PROGRESS_BAR:p,ICON:f,TRANSITION:v,CLOSE_BUTTON:h},g=function(t){return"function"==typeof t},b=function(t){return"string"==typeof t},T=function(t){return b(t)&&t.trim().length>0},y=function(t){return"number"==typeof t},_=function(t){return void 0===t},C=function(t){return"object"==typeof t&&null!==t},E=function(t){return P(t,"tag")&&T(t.tag)},O=function(t){return window.TouchEvent&&t instanceof TouchEvent},S=function(t){return P(t,"component")&&R(t.component)},D=function(t){return!!function(t){return g(t)&&P(t,"cid")}(t)||!!C(t)&&(!(!t.extends&&!t._Ctor)||(!!b(t.template)||I(t)))},R=function(t){return!_(t)&&(b(t)||function(t){return t instanceof a.default||D(t)}(t)||I(t)||E(t)||S(t))},w=function(t){return C(t)&&y(t.height)&&y(t.width)&&y(t.right)&&y(t.left)&&y(t.top)&&y(t.bottom)},P=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},I=function(t){return P(t,"render")&&g(t.render)},N=(u=0,function(){return u++});function B(t){return O(t)?t.targetTouches[0].clientX:t.clientX}function x(t){return O(t)?t.targetTouches[0].clientY:t.clientY}var $=function(t){_(t.remove)?t.parentNode&&t.parentNode.removeChild(t):t.remove()},L=function(t){return S(t)?L(t.component):E(t)?{render:function(){return t}}:t};function A(t,e,n,s,o,i,a,r,c,u){"boolean"!=typeof a&&(c=r,r=a,a=!1);const l="function"==typeof n?n.options:n;let d;if(t&&t.render&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,o&&(l.functional=!0)),s&&(l._scopeId=s),i?(d=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},l._ssrRegister=d):e&&(d=a?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),d)if(l.functional){const t=l.render;l.render=function(e,n){return d.call(n),t(e,n)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,d):[d]}return n}const F=a.default.extend({props:m.PROGRESS_BAR,data:function(){return{hasClass:!0}},computed:{style:function(){return{animationDuration:this.timeout+"ms",animationPlayState:this.isRunning?"running":"paused",opacity:this.hideProgressBar?0:1}},cpClass:function(){return this.hasClass?l+"__progress-bar":""}},mounted:function(){this.$el.addEventListener("animationend",this.animationEnded)},beforeDestroy:function(){this.$el.removeEventListener("animationend",this.animationEnded)},methods:{animationEnded:function(){this.$emit("close-toast")}},watch:{timeout:function(){var t=this;this.hasClass=!1,this.$nextTick((function(){return t.hasClass=!0}))}}});var j=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{class:t.cpClass,style:t.style})};j._withStripped=!0;const M=A({render:j,staticRenderFns:[]},undefined,F,undefined,false,undefined,!1,void 0,void 0,void 0);const U=a.default.extend({props:m.CLOSE_BUTTON,computed:{buttonComponent:function(){return!1!==this.component?L(this.component):"button"},classes:function(){var t=[l+"__close-button"];return this.showOnHover&&t.push("show-on-hover"),t.concat(this.classNames)}}});var k=function(){var t=this,e=t.$createElement;return(t._self._c||e)(t.buttonComponent,t._g({tag:"component",class:t.classes,attrs:{"aria-label":t.ariaLabel}},t.$listeners),[t._v("\n ×\n")])};k._withStripped=!0;const H=A({render:k,staticRenderFns:[]},undefined,U,undefined,false,undefined,!1,void 0,void 0,void 0);const Y={};var V=function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{staticClass:"svg-inline--fa fa-check-circle fa-w-16",attrs:{"aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"check-circle",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"}},[e("path",{attrs:{fill:"currentColor",d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"}})])};V._withStripped=!0;const z=A({render:V,staticRenderFns:[]},undefined,Y,undefined,false,undefined,!1,void 0,void 0,void 0);const G={};var X=function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{staticClass:"svg-inline--fa fa-info-circle fa-w-16",attrs:{"aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"info-circle",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"}},[e("path",{attrs:{fill:"currentColor",d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"}})])};X._withStripped=!0;const q=A({render:X,staticRenderFns:[]},undefined,G,undefined,false,undefined,!1,void 0,void 0,void 0);const W={};var J=function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{staticClass:"svg-inline--fa fa-exclamation-circle fa-w-16",attrs:{"aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"exclamation-circle",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"}},[e("path",{attrs:{fill:"currentColor",d:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}})])};J._withStripped=!0;const K=A({render:J,staticRenderFns:[]},undefined,W,undefined,false,undefined,!1,void 0,void 0,void 0);const Q={};var Z=function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{staticClass:"svg-inline--fa fa-exclamation-triangle fa-w-18",attrs:{"aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"exclamation-triangle",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"}},[e("path",{attrs:{fill:"currentColor",d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}})])};Z._withStripped=!0;const tt=A({render:Z,staticRenderFns:[]},undefined,Q,undefined,false,undefined,!1,void 0,void 0,void 0);const et=a.default.extend({props:m.ICON,computed:{customIconChildren:function(){return P(this.customIcon,"iconChildren")?this.trimValue(this.customIcon.iconChildren):""},customIconClass:function(){return b(this.customIcon)?this.trimValue(this.customIcon):P(this.customIcon,"iconClass")?this.trimValue(this.customIcon.iconClass):""},customIconTag:function(){return P(this.customIcon,"iconTag")?this.trimValue(this.customIcon.iconTag,"i"):"i"},hasCustomIcon:function(){return this.customIconClass.length>0},component:function(){return this.hasCustomIcon?this.customIconTag:R(this.customIcon)?L(this.customIcon):this.iconTypeComponent},iconTypeComponent:function(){var e;return((e={})[t.TYPE.DEFAULT]=q,e[t.TYPE.INFO]=q,e[t.TYPE.SUCCESS]=z,e[t.TYPE.ERROR]=tt,e[t.TYPE.WARNING]=K,e)[this.type]},iconClasses:function(){var t=[l+"__icon"];return this.hasCustomIcon?t.concat(this.customIconClass):t}},methods:{trimValue:function(t,e){return void 0===e&&(e=""),T(t)?t.trim():e}}});var nt=function(){var t=this,e=t.$createElement;return(t._self._c||e)(t.component,{tag:"component",class:t.iconClasses},[t._v(t._s(t.customIconChildren))])};nt._withStripped=!0;const st=A({render:nt,staticRenderFns:[]},undefined,et,undefined,false,undefined,!1,void 0,void 0,void 0);const ot=a.default.extend({components:{ProgressBar:M,CloseButton:H,Icon:st},inheritAttrs:!1,props:Object.assign({},m.CORE_TOAST,m.TOAST),data:function(){return{isRunning:!0,disableTransitions:!1,beingDragged:!1,dragStart:0,dragPos:{x:0,y:0},dragRect:{}}},computed:{classes:function(){var t=[l+"__toast",l+"__toast--"+this.type,""+this.position].concat(this.toastClassName);return this.disableTransitions&&t.push("disable-transition"),this.rtl&&t.push(l+"__toast--rtl"),t},bodyClasses:function(){return[l+"__toast-"+(b(this.content)?"body":"component-body")].concat(this.bodyClassName)},draggableStyle:function(){return this.dragStart===this.dragPos.x?{}:this.beingDragged?{transform:"translateX("+this.dragDelta+"px)",opacity:1-Math.abs(this.dragDelta/this.removalDistance)}:{transition:"transform 0.2s, opacity 0.2s",transform:"translateX(0)",opacity:1}},dragDelta:function(){return this.beingDragged?this.dragPos.x-this.dragStart:0},removalDistance:function(){return w(this.dragRect)?(this.dragRect.right-this.dragRect.left)*this.draggablePercent:0}},mounted:function(){this.draggable&&this.draggableSetup(),this.pauseOnFocusLoss&&this.focusSetup()},beforeDestroy:function(){this.draggable&&this.draggableCleanup(),this.pauseOnFocusLoss&&this.focusCleanup()},destroyed:function(){var t=this;setTimeout((function(){$(t.$el)}),1e3)},methods:{getVueComponentFromObj:L,closeToast:function(){this.eventBus.$emit(i.DISMISS,this.id)},clickHandler:function(){this.onClick&&this.onClick(this.closeToast),this.closeOnClick&&(this.beingDragged&&this.dragStart!==this.dragPos.x||this.closeToast())},timeoutHandler:function(){this.closeToast()},hoverPause:function(){this.pauseOnHover&&(this.isRunning=!1)},hoverPlay:function(){this.pauseOnHover&&(this.isRunning=!0)},focusPause:function(){this.isRunning=!1},focusPlay:function(){this.isRunning=!0},focusSetup:function(){addEventListener("blur",this.focusPause),addEventListener("focus",this.focusPlay)},focusCleanup:function(){removeEventListener("blur",this.focusPause),removeEventListener("focus",this.focusPlay)},draggableSetup:function(){var t=this.$el;t.addEventListener("touchstart",this.onDragStart,{passive:!0}),t.addEventListener("mousedown",this.onDragStart),addEventListener("touchmove",this.onDragMove,{passive:!1}),addEventListener("mousemove",this.onDragMove),addEventListener("touchend",this.onDragEnd),addEventListener("mouseup",this.onDragEnd)},draggableCleanup:function(){var t=this.$el;t.removeEventListener("touchstart",this.onDragStart),t.removeEventListener("mousedown",this.onDragStart),removeEventListener("touchmove",this.onDragMove),removeEventListener("mousemove",this.onDragMove),removeEventListener("touchend",this.onDragEnd),removeEventListener("mouseup",this.onDragEnd)},onDragStart:function(t){this.beingDragged=!0,this.dragPos={x:B(t),y:x(t)},this.dragStart=B(t),this.dragRect=this.$el.getBoundingClientRect()},onDragMove:function(t){this.beingDragged&&(t.preventDefault(),this.isRunning&&(this.isRunning=!1),this.dragPos={x:B(t),y:x(t)})},onDragEnd:function(){var t=this;this.beingDragged&&(Math.abs(this.dragDelta)>=this.removalDistance?(this.disableTransitions=!0,this.$nextTick((function(){return t.closeToast()}))):setTimeout((function(){t.beingDragged=!1,w(t.dragRect)&&t.pauseOnHover&&t.dragRect.bottom>=t.dragPos.y&&t.dragPos.y>=t.dragRect.top&&t.dragRect.left<=t.dragPos.x&&t.dragPos.x<=t.dragRect.right?t.isRunning=!1:t.isRunning=!0})))}}});var it=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.classes,style:t.draggableStyle,on:{click:t.clickHandler,mouseenter:t.hoverPause,mouseleave:t.hoverPlay}},[t.icon?n("Icon",{attrs:{"custom-icon":t.icon,type:t.type}}):t._e(),t._v(" "),n("div",{class:t.bodyClasses,attrs:{role:t.accessibility.toastRole||"alert"}},["string"==typeof t.content?[t._v(t._s(t.content))]:n(t.getVueComponentFromObj(t.content),t._g(t._b({tag:"component",attrs:{"toast-id":t.id},on:{"close-toast":t.closeToast}},"component",t.content.props,!1),t.content.listeners))],2),t._v(" "),t.closeButton?n("CloseButton",{attrs:{component:t.closeButton,"class-names":t.closeButtonClassName,"show-on-hover":t.showCloseButtonOnHover,"aria-label":t.accessibility.closeButtonLabel},on:{click:function(e){return e.stopPropagation(),t.closeToast(e)}}}):t._e(),t._v(" "),t.timeout?n("ProgressBar",{attrs:{"is-running":t.isRunning,"hide-progress-bar":t.hideProgressBar,timeout:t.timeout},on:{"close-toast":t.timeoutHandler}}):t._e()],1)};it._withStripped=!0;const at=A({render:it,staticRenderFns:[]},undefined,ot,undefined,false,undefined,!1,void 0,void 0,void 0);const rt=a.default.extend({inheritAttrs:!1,props:m.TRANSITION,methods:{beforeEnter:function(t){var e="number"==typeof this.transitionDuration?this.transitionDuration:this.transitionDuration.enter;t.style.animationDuration=e+"ms",t.style.animationFillMode="both",this.$emit("before-enter",t)},afterEnter:function(t){this.cleanUpStyles(t),this.$emit("after-enter",t)},afterLeave:function(t){this.cleanUpStyles(t),this.$emit("after-leave",t)},beforeLeave:function(t){var e="number"==typeof this.transitionDuration?this.transitionDuration:this.transitionDuration.leave;t.style.animationDuration=e+"ms",t.style.animationFillMode="both",this.$emit("before-leave",t)},leave:function(t,e){this.setAbsolutePosition(t),this.$emit("leave",t,e)},setAbsolutePosition:function(t){t.style.left=t.offsetLeft+"px",t.style.top=t.offsetTop+"px",t.style.width=getComputedStyle(t).width,t.style.height=getComputedStyle(t).height,t.style.position="absolute"},cleanUpStyles:function(t){t.style.animationFillMode="",t.style.animationDuration=""}}});var ct=function(){var t=this,e=t.$createElement;return(t._self._c||e)("transition-group",{attrs:{tag:"div","enter-active-class":t.transition.enter?t.transition.enter:t.transition+"-enter-active","move-class":t.transition.move?t.transition.move:t.transition+"-move","leave-active-class":t.transition.leave?t.transition.leave:t.transition+"-leave-active"},on:{leave:t.leave,"before-enter":t.beforeEnter,"before-leave":t.beforeLeave,"after-enter":t.afterEnter,"after-leave":t.afterLeave}},[t._t("default")],2)};ct._withStripped=!0;const ut=A({render:ct,staticRenderFns:[]},undefined,rt,undefined,false,undefined,!1,void 0,void 0,void 0);const lt=a.default.extend({components:{Toast:at,VtTransition:ut},props:Object.assign({},m.CORE_TOAST,m.CONTAINER,m.TRANSITION),data:function(){return{count:0,positions:Object.values(t.POSITION),toasts:{},defaults:{}}},computed:{toastArray:function(){return Object.values(this.toasts)},filteredToasts:function(){return this.defaults.filterToasts(this.toastArray)}},beforeMount:function(){this.setup(this.container);var t=this.eventBus;t.$on(i.ADD,this.addToast),t.$on(i.CLEAR,this.clearToasts),t.$on(i.DISMISS,this.dismissToast),t.$on(i.UPDATE,this.updateToast),t.$on(i.UPDATE_DEFAULTS,this.updateDefaults),this.defaults=this.$props},methods:{setup:function(t){return r(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return g(t)?[4,t()]:[3,2];case 1:t=e.sent(),e.label=2;case 2:return $(this.$el),t.appendChild(this.$el),[2]}}))}))},setToast:function(t){_(t.id)||this.$set(this.toasts,t.id,t)},addToast:function(t){var e=Object.assign({},this.defaults,t.type&&this.defaults.toastDefaults&&this.defaults.toastDefaults[t.type],t),n=this.defaults.filterBeforeCreate(e,this.toastArray);n&&this.setToast(n)},dismissToast:function(t){var e=this.toasts[t];_(e)||_(e.onClose)||e.onClose(),this.$delete(this.toasts,t)},clearToasts:function(){var t=this;Object.keys(this.toasts).forEach((function(e){t.dismissToast(e)}))},getPositionToasts:function(t){var e=this.filteredToasts.filter((function(e){return e.position===t})).slice(0,this.defaults.maxToasts);return this.defaults.newestOnTop?e.reverse():e},updateDefaults:function(t){_(t.container)||this.setup(t.container),this.defaults=Object.assign({},this.defaults,t)},updateToast:function(t){var e=t.id,n=t.options,s=t.create;this.toasts[e]?(n.timeout&&n.timeout===this.toasts[e].timeout&&n.timeout++,this.setToast(Object.assign({},this.toasts[e],n))):s&&this.addToast(Object.assign({},{id:e},n))},getClasses:function(t){return[l+"__container",t].concat(this.defaults.containerClassName)}}});var dt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",t._l(t.positions,(function(e){return n("div",{key:e},[n("VtTransition",{class:t.getClasses(e),attrs:{transition:t.defaults.transition,"transition-duration":t.defaults.transitionDuration}},t._l(t.getPositionToasts(e),(function(e){return n("Toast",t._b({key:e.id},"Toast",e,!1))})),1)],1)})),0)};dt._withStripped=!0;const ft=A({render:dt,staticRenderFns:[]},undefined,lt,undefined,false,undefined,!1,void 0,void 0,void 0);var ht=function(e,n,s){void 0===n&&(n={}),void 0===s&&(s=!0);var o=n.eventBus=n.eventBus||new e;if(s){var a=new(e.extend(ft))({el:document.createElement("div"),propsData:n}),r=n.onMounted;_(r)||r(a)}var c=function(e,n){var s=Object.assign({},{id:N(),type:t.TYPE.DEFAULT},n,{content:e});return o.$emit(i.ADD,s),s.id};return c.clear=function(){return o.$emit(i.CLEAR)},c.updateDefaults=function(t){o.$emit(i.UPDATE_DEFAULTS,t)},c.dismiss=function(t){o.$emit(i.DISMISS,t)},c.update=function(t,e,n){var s=e.content,a=e.options;void 0===n&&(n=!1),o.$emit(i.UPDATE,{id:t,options:Object.assign({},a,{content:s}),create:n})},c.success=function(e,n){return c(e,Object.assign({},n,{type:t.TYPE.SUCCESS}))},c.info=function(e,n){return c(e,Object.assign({},n,{type:t.TYPE.INFO}))},c.error=function(e,n){return c(e,Object.assign({},n,{type:t.TYPE.ERROR}))},c.warning=function(e,n){return c(e,Object.assign({},n,{type:t.TYPE.WARNING}))},c};function pt(t,e){void 0===e&&(e=a.default);return t instanceof e?ht(e,{eventBus:t},!1):ht(e,t,!0)}t.createToastInterface=pt,t.default=function(t,e){var n=pt(e,t);t.$toast=n,t.prototype.$toast=n},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.min.js.map