vue3-toastify
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),x={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},$={LIGHT:"light",DARK:"dark",COLORED:"colored",AUTO:"auto"},m={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Se={BOUNCE:"bounce",SLIDE:"slide",FLIP:"flip",ZOOM:"zoom",NONE:"none"},ne={dangerouslyHTMLString:!1,multiple:!0,position:x.TOP_RIGHT,autoClose:5e3,transition:"bounce",hideProgressBar:!1,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,className:"",bodyClassName:"",style:{},progressClassName:"",progressStyle:{},role:"alert",theme:"light"},Ne={rtl:!1,newestOnTop:!1,toastClassName:""},oe={...ne,...Ne};({...ne,type:m.DEFAULT});var i=(e=>(e[e.COLLAPSE_DURATION=300]="COLLAPSE_DURATION",e[e.DEBOUNCE_DURATION=50]="DEBOUNCE_DURATION",e.CSS_NAMESPACE="Toastify",e))(i||{}),G=(e=>(e.ENTRANCE_ANIMATION_END="d",e))(G||{});const ae={enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0},se={enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0},re={enter:"Toastify--animate Toastify__zoom-enter",exit:"Toastify--animate Toastify__zoom-exit"},ie={enter:"Toastify--animate Toastify__flip-enter",exit:"Toastify--animate Toastify__flip-exit"},ee="Toastify--animate Toastify__none-enter";function le(e,t=!1){var a;let n=ae;if(!e||typeof e=="string")switch(e){case"flip":n=ie;break;case"zoom":n=re;break;case"slide":n=se;break}else n=e;if(t)n.enter=ee;else if(n.enter===ee){const s=(a=n.exit.split("__")[1])==null?void 0:a.split("-")[0];n.enter=`Toastify--animate Toastify__${s}-enter`}return n}function Ae(e){return e.containerId||String(e.position)}const H="will-unmount";function _e(e=x.TOP_RIGHT){return!!document.querySelector(`.${i.CSS_NAMESPACE}__toast-container--${e}`)}function Ie(e=x.TOP_RIGHT){return`${i.CSS_NAMESPACE}__toast-container--${e}`}function he(e,t,n=!1){const a=[`${i.CSS_NAMESPACE}__toast-container`,`${i.CSS_NAMESPACE}__toast-container--${e}`,n?`${i.CSS_NAMESPACE}__toast-container--rtl`:null].filter(Boolean).join(" ");return L(t)?t({position:e,rtl:n,defaultClassName:a}):`${a} ${t||""}`}function Oe(e){var C;const{position:t,containerClassName:n,rtl:a=!1,style:s={}}=e,r=i.CSS_NAMESPACE,d=Ie(t),y=document.querySelector(`.${r}`),u=document.querySelector(`.${d}`),S=!!u&&!((C=u.className)!=null&&C.includes(H)),f=y||document.createElement("div"),T=document.createElement("div");T.className=he(t,n,a),T.dataset.testid=`${i.CSS_NAMESPACE}__toast-container--${t}`,T.id=Ae(e);for(const v in s)if(Object.prototype.hasOwnProperty.call(s,v)){const N=s[v];T.style[v]=N}return y||(f.className=i.CSS_NAMESPACE,document.body.appendChild(f)),S||f.appendChild(T),T}function Q(e){var a,s,r;const t=typeof e=="string"?e:((a=e.currentTarget)==null?void 0:a.id)||((s=e.target)==null?void 0:s.id),n=document.getElementById(t);n&&n.removeEventListener("animationend",Q,!1);try{w[t].unmount(),(r=document.getElementById(t))==null||r.remove(),delete w[t],delete c[t]}catch{}}const w=o.reactive({});function de(e,t){const n=document.getElementById(String(t));n&&(w[n.id]=e)}function D(e,t=!0){const n=String(e);if(!w[n])return;const a=document.getElementById(n);a&&a.classList.add(H),t?(be(e),a&&a.addEventListener("animationend",Q,!1)):Q(n),p.items=p.items.filter(s=>s.containerId!==e)}function ue(e){for(const t in w)D(t,e);p.items=[]}function Y(e,t){const n=document.getElementById(e.toastId);if(n){let a=e;a={...a,...le(a.transition)};const s=a.appendPosition?`${a.exit}--${a.position}`:a.exit;n.className+=` ${s}`,t&&t(n)}}function be(e){for(const t in c)if(t===e)for(const n of c[t]||[])Y(n)}function Pe(e){const n=b().find(a=>a.toastId===e);return n==null?void 0:n.containerId}function X(e){return document.getElementById(e)}function Le(e){const t=X(e.containerId);return t&&t.classList.contains(H)}function te(e){var n;const t=o.isVNode(e.content)?o.toRaw(e.content.props):null;return t!=null?t:o.toRaw((n=e.data)!=null?n:{})}function $e(e){return e?p.items.filter(n=>n.containerId===e).length>0:p.items.length>0}function ce(){if(p.items.length>0){const e=p.items.shift();R(e==null?void 0:e.toastContent,e==null?void 0:e.toastProps)}}const c=o.reactive({}),p=o.reactive({items:[]});function b(){const e=o.toRaw(c);return Object.values(e).reduce((t,n)=>[...t,...n],[])}function fe(e){return b().find(n=>n.toastId===e)}function R(e,t={}){if(Le(t)){const n=X(t.containerId);n&&n.addEventListener("animationend",W.bind(null,e,t),!1)}else W(e,t)}function W(e,t={}){const n=X(t.containerId);n&&n.removeEventListener("animationend",W.bind(null,e,t),!1);const a=c[t.containerId]||[],s=a.length>0;if(!s&&!_e(t.position)){const r=Oe(t),d=o.createApp(ye,t);d.mount(r),de(d,r.id)}s&&!t.updateId&&(t.position=a[0].position),o.nextTick(()=>{t.updateId?g.update(t):g.add(e,t)})}const g={add(e,t){const{containerId:n=""}=t;n&&(c[n]=c[n]||[],c[n].find(a=>a.toastId===t.toastId)||setTimeout(()=>{var a,s;t.newestOnTop?(a=c[n])==null||a.unshift(t):(s=c[n])==null||s.push(t),t.onOpen&&t.onOpen(te(t))},t.delay||0))},remove(e){if(e){const t=Pe(e);if(t){const n=c[t];let a=n.find(s=>s.toastId===e);c[t]=n.filter(s=>s.toastId!==e),!c[t].length&&!$e(t)&&D(t,!1),ce(),o.nextTick(()=>{a!=null&&a.onClose&&(a.onClose(te(a)),a=void 0)})}}},update(e={}){const{containerId:t=""}=e;if(t&&e.updateId){c[t]=c[t]||[];const n=c[t].find(r=>r.toastId===e.toastId),a=(n==null?void 0:n.position)!==e.position||(n==null?void 0:n.transition)!==e.transition,s={...e,disabledEnterTransition:!a,updateId:void 0};g.dismissForce(e==null?void 0:e.toastId),setTimeout(()=>{l(s.content,s)},e.delay||0)}},clear(e,t=!0){e?D(e,t):ue(t)},dismissCallback(e){var a;const t=(a=e.currentTarget)==null?void 0:a.id,n=document.getElementById(t);n&&(n.removeEventListener("animationend",g.dismissCallback,!1),setTimeout(()=>{g.remove(t)}))},dismiss(e){if(e){const t=b();for(const n of t)if(n.toastId===e){Y(n,a=>{a.addEventListener("animationend",g.dismissCallback,!1)});break}}},dismissForce(e){if(e){const t=b();for(const n of t)if(n.toastId===e){const a=document.getElementById(e);a&&(a.remove(),a.removeEventListener("animationend",g.dismissCallback,!1),g.remove(e));break}}}},J=o.reactive({}),U=o.reactive({});function me(){return Math.random().toString(36).substring(2,9)}function we(e){return typeof e=="number"&&!isNaN(e)}function Z(e){return typeof e=="string"}function L(e){return typeof e=="function"}function V(...e){return o.mergeProps(...e)}function k(e){return typeof e=="object"&&(!!(e!=null&&e.render)||!!(e!=null&&e.setup)||typeof(e==null?void 0:e.type)=="object")}function qe(e={}){J[`${i.CSS_NAMESPACE}-default-options`]=e}function Be(){return J[`${i.CSS_NAMESPACE}-default-options`]||oe}function Re(){return document.documentElement.classList.contains("dark")?"dark":"light"}var M=(e=>(e[e.Enter=0]="Enter",e[e.Exit=1]="Exit",e))(M||{});const ge={containerId:{type:[String,Number],required:!1,default:""},clearOnUrlChange:{type:Boolean,required:!1,default:!0},disabledEnterTransition:{type:Boolean,required:!1,default:!1},dangerouslyHTMLString:{type:Boolean,required:!1,default:!1},multiple:{type:Boolean,required:!1,default:!0},limit:{type:Number,required:!1,default:void 0},position:{type:String,required:!1,default:x.TOP_LEFT},bodyClassName:{type:String,required:!1,default:""},autoClose:{type:[Number,Boolean],required:!1,default:!1},closeButton:{type:[Boolean,Function,Object],required:!1,default:void 0},transition:{type:[String,Object],required:!1,default:"bounce"},hideProgressBar:{type:Boolean,required:!1,default:!1},pauseOnHover:{type:Boolean,required:!1,default:!0},pauseOnFocusLoss:{type:Boolean,required:!1,default:!0},closeOnClick:{type:Boolean,required:!1,default:!0},progress:{type:Number,required:!1,default:void 0},progressClassName:{type:String,required:!1,default:""},toastStyle:{type:Object,required:!1,default(){return{}}},progressStyle:{type:Object,required:!1,default(){return{}}},role:{type:String,required:!1,default:"alert"},theme:{type:String,required:!1,default:$.AUTO},content:{type:[String,Object,Function],required:!1,default:""},toastId:{type:[String,Number],required:!1,default:""},data:{type:[Object,String],required:!1,default(){return{}}},type:{type:String,required:!1,default:m.DEFAULT},icon:{type:[Boolean,String,Number,Object,Function],required:!1,default:void 0},delay:{type:Number,required:!1,default:void 0},onOpen:{type:Function,required:!1,default:void 0},onClose:{type:Function,required:!1,default:void 0},onClick:{type:Function,required:!1,default:void 0},isLoading:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},toastClassName:{type:String,required:!1,default:""},updateId:{type:[String,Number],required:!1,default:""},contentProps:{type:Object,required:!1,default:null}},Me={autoClose:{type:[Number,Boolean],required:!0},isRunning:{type:Boolean,required:!1,default:void 0},type:{type:String,required:!1,default:m.DEFAULT},theme:{type:String,required:!1,default:$.AUTO},hide:{type:Boolean,required:!1,default:void 0},className:{type:[String,Function],required:!1,default:""},controlledProgress:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:void 0},isIn:{type:Boolean,required:!1,default:void 0},progress:{type:Number,required:!1,default:void 0},closeToast:{type:Function,required:!1,default:void 0}},Fe=o.defineComponent({name:"ProgressBar",props:Me,setup(e,{attrs:t}){const n=o.ref(),a=o.computed(()=>e.hide?"true":"false"),s=o.computed(()=>({...t.style||{},animationDuration:`${e.autoClose===!0?5e3:e.autoClose}ms`,animationPlayState:e.isRunning?"running":"paused",opacity:e.hide||e.autoClose===!1?0:1,transform:e.controlledProgress?`scaleX(${e.progress})`:"none"})),r=o.computed(()=>[`${i.CSS_NAMESPACE}__progress-bar`,e.controlledProgress?`${i.CSS_NAMESPACE}__progress-bar--controlled`:`${i.CSS_NAMESPACE}__progress-bar--animated`,`${i.CSS_NAMESPACE}__progress-bar-theme--${e.theme}`,`${i.CSS_NAMESPACE}__progress-bar--${e.type}`,e.rtl?`${i.CSS_NAMESPACE}__progress-bar--rtl`:null].filter(Boolean).join(" ")),d=o.computed(()=>`${r.value} ${(t==null?void 0:t.class)||""}`),y=()=>{n.value&&(n.value.onanimationend=null,n.value.ontransitionend=null)},u=()=>{e.isIn&&e.closeToast&&e.autoClose!==!1&&(e.closeToast(),y())},S=o.computed(()=>e.controlledProgress?null:u),f=o.computed(()=>e.controlledProgress?u:null);return o.watchEffect(()=>{n.value&&(y(),n.value.onanimationend=S.value,n.value.ontransitionend=f.value)}),()=>o.createVNode("div",{ref:n,role:"progressbar","aria-hidden":a.value,"aria-label":"notification timer",class:d.value,style:s.value},null)}}),Ue=o.defineComponent({name:"CloseButton",inheritAttrs:!1,props:{theme:{type:String,required:!1,default:$.AUTO},type:{type:String,required:!1,default:$.LIGHT},ariaLabel:{type:String,required:!1,default:"close"},closeToast:{type:Function,required:!1,default:void 0}},setup(e){return()=>o.createVNode("button",{class:`${i.CSS_NAMESPACE}__close-button ${i.CSS_NAMESPACE}__close-button--${e.theme}`,type:"button",onClick:t=>{t.stopPropagation(),e.closeToast&&e.closeToast(t)},"aria-label":e.ariaLabel},[o.createVNode("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},[o.createVNode("path",{"fill-rule":"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"},null)])])}}),j=({theme:e,type:t,path:n,...a})=>o.createVNode("svg",o.mergeProps({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`},a),[o.createVNode("path",{d:n},null)]);function xe(e){return o.createVNode(j,o.mergeProps(e,{path:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}),null)}function ke(e){return o.createVNode(j,o.mergeProps(e,{path:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}),null)}function De(e){return o.createVNode(j,o.mergeProps(e,{path:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}),null)}function He(e){return o.createVNode(j,o.mergeProps(e,{path:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}),null)}function Ve(){return o.createVNode("div",{class:`${i.CSS_NAMESPACE}__spinner`},null)}const K={info:ke,warning:xe,success:De,error:He,spinner:Ve},je=e=>e in K;function ze({theme:e,type:t,isLoading:n,icon:a}){let s;const r={theme:e,type:t};return n?s=K.spinner():a===!1?s=void 0:k(a)?s=o.toRaw(a):L(a)?s=a(r):o.isVNode(a)?s=o.cloneVNode(a,r):Z(a)||we(a)?s=a:je(t)&&(s=K[t](r)),s}const Ge=()=>{};function Qe(e,t,n=i.COLLAPSE_DURATION){const{scrollHeight:a,style:s}=e,r=n;requestAnimationFrame(()=>{s.minHeight="initial",s.height=a+"px",s.transition=`all ${r}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(t,r)})})}function Ce(e){const t=o.ref(!1),n=o.ref(!1),a=o.ref(!1),s=o.ref(M.Enter),r=o.reactive({...e,appendPosition:e.appendPosition||!1,collapse:typeof e.collapse>"u"?!0:e.collapse,collapseDuration:e.collapseDuration||i.COLLAPSE_DURATION}),d=r.done||Ge,y=o.computed(()=>r.appendPosition?`${r.enter}--${r.position}`:r.enter),u=o.computed(()=>r.appendPosition?`${r.exit}--${r.position}`:r.exit),S=o.computed(()=>e.pauseOnHover?{onMouseenter:_,onMouseleave:A}:{});function f(){const E=y.value.split(" ");C().addEventListener(G.ENTRANCE_ANIMATION_END,A,{once:!0});const I=P=>{const B=C();P.target===B&&(B.dispatchEvent(new Event(G.ENTRANCE_ANIMATION_END)),B.removeEventListener("animationend",I),B.removeEventListener("animationcancel",I),s.value===M.Enter&&P.type!=="animationcancel"&&B.classList.remove(...E))},h=()=>{const P=C();P.classList.add(...E),P.addEventListener("animationend",I),P.addEventListener("animationcancel",I)};e.pauseOnFocusLoss&&v(),h()}function T(){if(!C())return;const E=()=>{const h=C();h.removeEventListener("animationend",E),r.collapse?Qe(h,d,r.collapseDuration):d()},I=()=>{const h=C();s.value=M.Exit,h&&(h.className+=` ${u.value}`,h.addEventListener("animationend",E))};n.value||(a.value?E():setTimeout(I))}function C(){return e.toastRef.value}function v(){document.hasFocus()||_(),window.addEventListener("focus",A),window.addEventListener("blur",_)}function N(){window.removeEventListener("focus",A),window.removeEventListener("blur",_)}function A(){(!e.loading.value||e.isLoading===void 0)&&(t.value=!0)}function _(){t.value=!1}function q(E){E&&(E.stopPropagation(),E.preventDefault()),n.value=!1}return o.watchEffect(T),o.watchEffect(()=>{const E=b();n.value=E.findIndex(I=>I.toastId===r.toastId)>-1}),o.watchEffect(()=>{e.isLoading!==void 0&&(e.loading.value?_():A())}),o.onMounted(f),o.onUnmounted(()=>{e.pauseOnFocusLoss&&N()}),{isIn:n,isRunning:t,hideToast:q,eventHandlers:S}}const We=o.defineComponent({name:"ToastItem",inheritAttrs:!1,props:ge,setup(e){const t=o.ref(),n=o.computed(()=>!!e.isLoading),a=o.computed(()=>e.progress!==void 0&&e.progress!==null),s=o.computed(()=>ze(e)),r=o.computed(()=>[`${i.CSS_NAMESPACE}__toast`,`${i.CSS_NAMESPACE}__toast-theme--${e.theme}`,`${i.CSS_NAMESPACE}__toast--${e.type}`,e.rtl?`${i.CSS_NAMESPACE}__toast--rtl`:void 0,e.toastClassName||""].filter(Boolean).join(" ")),{isRunning:d,isIn:y,hideToast:u,eventHandlers:S}=Ce({toastRef:t,loading:n,done:()=>{g.remove(e.toastId)},...le(e.transition,e.disabledEnterTransition),...e});return()=>o.createVNode("div",o.mergeProps({id:e.toastId,class:r.value,style:e.toastStyle||{},ref:t,"data-testid":`toast-item-${e.toastId}`,onClick:f=>{e.closeOnClick&&u(),e.onClick&&e.onClick(f)}},S.value),[o.createVNode("div",{role:e.role,"data-testid":"toast-body",class:`${i.CSS_NAMESPACE}__toast-body ${e.bodyClassName||""}`},[s.value!=null&&o.createVNode("div",{"data-testid":`toast-icon-${e.type}`,class:[`${i.CSS_NAMESPACE}__toast-icon`,e.isLoading?"":`${i.CSS_NAMESPACE}--animate-icon ${i.CSS_NAMESPACE}__zoom-enter`].join(" ")},[k(s.value)?o.h(o.toRaw(s.value),{theme:e.theme,type:e.type}):L(s.value)?s.value({theme:e.theme,type:e.type}):s.value]),e.contentProps?o.createVNode("div",{"data-testid":"toast-content"},[o.h(o.toRaw(e.content),{contentProps:e.contentProps})]):o.createVNode("div",{"data-testid":"toast-content"},[k(e.content)?o.h(o.toRaw(e.content),{toastProps:o.toRaw(e),closeToast:u,data:e.data}):L(e.content)?e.content({toastProps:o.toRaw(e),closeToast:u,data:e.data}):e.dangerouslyHTMLString?o.h("div",{innerHTML:e.content}):e.content])]),(e.closeButton===void 0||e.closeButton===!0)&&o.createVNode(Ue,{theme:e.theme,closeToast:f=>{f.stopPropagation(),f.preventDefault(),u()}},null),k(e.closeButton)?o.h(o.toRaw(e.closeButton),{closeToast:u,type:e.type,theme:e.theme}):L(e.closeButton)?e.closeButton({closeToast:u,type:e.type,theme:e.theme}):null,o.createVNode(Fe,{className:e.progressClassName,style:e.progressStyle,rtl:e.rtl,theme:e.theme,isIn:y.value,type:e.type,hide:e.hideProgressBar,isRunning:d.value,autoClose:e.autoClose,controlledProgress:a.value,progress:e.progress,closeToast:e.isLoading?void 0:u},null)])}});let F=0;function Ee(){typeof window>"u"||(F&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(Ee),U.lastUrl!==window.location.href&&(U.lastUrl=window.location.href,g.clear()))}const ye=o.defineComponent({name:"ToastifyContainer",inheritAttrs:!1,props:ge,setup(e){const t=o.computed(()=>e.containerId),n=o.computed(()=>c[t.value]||[]),a=o.computed(()=>n.value.filter(s=>s.position===e.position));return o.onMounted(()=>{typeof window<"u"&&e.clearOnUrlChange&&window.requestAnimationFrame(Ee)}),o.onUnmounted(()=>{typeof window<"u"&&F&&(window.cancelAnimationFrame(F),U.lastUrl="")}),()=>o.createVNode(o.Fragment,null,[a.value.map(s=>{const{toastId:r=""}=s;return o.createVNode(We,o.mergeProps({key:r},s),null)})])}});let z=!1;function Te(){const e=[];return b().forEach(n=>{const a=document.getElementById(n.containerId);a&&!a.classList.contains(H)&&e.push(n)}),e}function Ze(e){const t=Te().length,n=e!=null?e:0;return n>0&&t+p.items.length>=n}function Ke(e){Ze(e.limit)&&!e.updateId&&p.items.push({toastId:e.toastId,containerId:e.containerId,toastContent:e.content,toastProps:e})}function O(e,t,n={}){if(z)return;n=V(Be(),{type:t},o.toRaw(n)),(!n.toastId||typeof n.toastId!="string"&&typeof n.toastId!="number")&&(n.toastId=me()),n={...n,content:e,containerId:n.containerId||String(n.position)};const a=Number(n==null?void 0:n.progress);return a<0&&(n.progress=0),a>1&&(n.progress=1),n.theme==="auto"&&(n.theme=Re()),Ke(n),U.lastUrl=window.location.href,n.multiple?p.items.length?n.updateId&&R(e,n):R(e,n):(z=!0,l.clearAll(void 0,!1),setTimeout(()=>{R(e,n)},0),setTimeout(()=>{z=!1},390)),n.toastId}const l=(e,t)=>O(e,m.DEFAULT,t);l.info=(e,t)=>O(e,m.DEFAULT,{...t,type:m.INFO});l.error=(e,t)=>O(e,m.DEFAULT,{...t,type:m.ERROR});l.warning=(e,t)=>O(e,m.DEFAULT,{...t,type:m.WARNING});l.warn=l.warning;l.success=(e,t)=>O(e,m.DEFAULT,{...t,type:m.SUCCESS});l.loading=(e,t)=>O(e,m.DEFAULT,V(t,{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1}));l.dark=(e,t)=>O(e,m.DEFAULT,V(t,{theme:$.DARK}));l.remove=e=>{e?g.dismiss(e):g.clear()};l.clearAll=(e,t)=>{o.nextTick(()=>{g.clear(e,t)})};l.isActive=e=>{let t=!1;return t=Te().findIndex(a=>a.toastId===e)>-1,t};l.update=(e,t={})=>{setTimeout(()=>{const n=fe(e);if(n){const a=o.toRaw(n),{content:s}=a,r={...a,...t,toastId:t.toastId||e,updateId:me()},d=r.render||s;delete r.render,O(d,r.type,r)}},0)};l.done=e=>{l.update(e,{isLoading:!1,progress:1})};l.promise=Ye;function Ye(e,{pending:t,error:n,success:a},s){var f,T,C;let r;const d={...s||{},autoClose:!1};t&&(r=Z(t)?l.loading(t,d):l.loading(t.render,{...d,...t}));const y={autoClose:(f=s==null?void 0:s.autoClose)!=null?f:!0,closeOnClick:(T=s==null?void 0:s.closeOnClick)!=null?T:!0,closeButton:(C=s==null?void 0:s.autoClose)!=null?C:null,isLoading:void 0,draggable:null,delay:100},u=(v,N,A)=>{if(N==null){l.remove(r);return}const _={type:v,...y,...s,data:A},q=Z(N)?{render:N}:N;return r?l.update(r,{..._,...q,isLoading:!1}):l(q.render,{..._,...q,isLoading:!1}),A},S=L(e)?e():e;return S.then(v=>{u("success",a,v)}).catch(v=>{u("error",n,v)}),S}l.POSITION=x;l.THEME=$;l.TYPE=m;l.TRANSITIONS=Se;const ve={install(e,t={}){pe(t)}};typeof window<"u"&&(window.Vue3Toastify=ve);function pe(e={}){const t=V(oe,e);qe(t)}exports.AnimationStep=M;exports.Bounce=ae;exports.Flip=ie;exports.Slide=se;exports.ToastActions=g;exports.ToastifyContainer=ye;exports.Zoom=re;exports.addExitAnimateToNode=Y;exports.appendFromQueue=ce;exports.cacheRenderInstance=de;exports.clearContainers=ue;exports.containerInstances=w;exports.default=ve;exports.doAppend=R;exports.getAllToast=b;exports.getToast=fe;exports.globalCache=U;exports.globalOptions=J;exports.queue=p;exports.removeContainer=D;exports.toast=l;exports.toastContainers=c;exports.updateGlobalOptions=pe;exports.useCssTransition=Ce; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),k={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},$={LIGHT:"light",DARK:"dark",COLORED:"colored",AUTO:"auto"},m={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Se={BOUNCE:"bounce",SLIDE:"slide",FLIP:"flip",ZOOM:"zoom",NONE:"none"},ne={dangerouslyHTMLString:!1,multiple:!0,position:k.TOP_RIGHT,autoClose:5e3,transition:"bounce",hideProgressBar:!1,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,className:"",bodyClassName:"",style:{},progressClassName:"",progressStyle:{},role:"alert",theme:"light"},Ne={rtl:!1,newestOnTop:!1,toastClassName:""},ae={...ne,...Ne};({...ne,type:m.DEFAULT});var i=(e=>(e[e.COLLAPSE_DURATION=300]="COLLAPSE_DURATION",e[e.DEBOUNCE_DURATION=50]="DEBOUNCE_DURATION",e.CSS_NAMESPACE="Toastify",e))(i||{}),G=(e=>(e.ENTRANCE_ANIMATION_END="d",e))(G||{});const oe={enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0},se={enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0},re={enter:"Toastify--animate Toastify__zoom-enter",exit:"Toastify--animate Toastify__zoom-exit"},ie={enter:"Toastify--animate Toastify__flip-enter",exit:"Toastify--animate Toastify__flip-exit"},ee="Toastify--animate Toastify__none-enter";function le(e,t=!1){var o;let n=oe;if(!e||typeof e=="string")switch(e){case"flip":n=ie;break;case"zoom":n=re;break;case"slide":n=se;break}else n=e;if(t)n.enter=ee;else if(n.enter===ee){const s=(o=n.exit.split("__")[1])==null?void 0:o.split("-")[0];n.enter=`Toastify--animate Toastify__${s}-enter`}return n}function Ae(e){return e.containerId||String(e.position)}const H="will-unmount";function he(e=k.TOP_RIGHT){return!!document.querySelector(`.${i.CSS_NAMESPACE}__toast-container--${e}`)}function _e(e=k.TOP_RIGHT){return`${i.CSS_NAMESPACE}__toast-container--${e}`}function Ie(e,t,n=!1){const o=[`${i.CSS_NAMESPACE}__toast-container`,`${i.CSS_NAMESPACE}__toast-container--${e}`,n?`${i.CSS_NAMESPACE}__toast-container--rtl`:null].filter(Boolean).join(" ");return L(t)?t({position:e,rtl:n,defaultClassName:o}):`${o} ${t||""}`}function Oe(e){var C;const{position:t,containerClassName:n,rtl:o=!1,style:s={}}=e,r=i.CSS_NAMESPACE,d=_e(t),y=document.querySelector(`.${r}`),u=document.querySelector(`.${d}`),S=!!u&&!((C=u.className)!=null&&C.includes(H)),f=y||document.createElement("div"),T=document.createElement("div");T.className=Ie(t,n,o),T.dataset.testid=`${i.CSS_NAMESPACE}__toast-container--${t}`,T.id=Ae(e);for(const v in s)if(Object.prototype.hasOwnProperty.call(s,v)){const N=s[v];T.style[v]=N}return y||(f.className=i.CSS_NAMESPACE,document.body.appendChild(f)),S||f.appendChild(T),T}function Q(e){var o,s,r;const t=typeof e=="string"?e:((o=e.currentTarget)==null?void 0:o.id)||((s=e.target)==null?void 0:s.id),n=document.getElementById(t);n&&n.removeEventListener("animationend",Q,!1);try{w[t].unmount(),(r=document.getElementById(t))==null||r.remove(),delete w[t],delete c[t]}catch{}}const w=a.reactive({});function de(e,t){const n=document.getElementById(String(t));n&&(w[n.id]=e)}function D(e,t=!0){const n=String(e);if(!w[n])return;const o=document.getElementById(n);o&&o.classList.add(H),t?(be(e),o&&o.addEventListener("animationend",Q,!1)):Q(n),p.items=p.items.filter(s=>s.containerId!==e)}function ue(e){for(const t in w)D(t,e);p.items=[]}function Y(e,t){const n=document.getElementById(e.toastId);if(n){let o=e;o={...o,...le(o.transition)};const s=o.appendPosition?`${o.exit}--${o.position}`:o.exit;n.className+=` ${s}`,t&&t(n)}}function be(e){for(const t in c)if(t===e)for(const n of c[t]||[])Y(n)}function Pe(e){const n=b().find(o=>o.toastId===e);return n==null?void 0:n.containerId}function X(e){return document.getElementById(e)}function Le(e){const t=X(e.containerId);return t&&t.classList.contains(H)}function te(e){var n;const t=a.isVNode(e.content)?a.toRaw(e.content.props):null;return t!=null?t:a.toRaw((n=e.data)!=null?n:{})}function $e(e){return e?p.items.filter(n=>n.containerId===e).length>0:p.items.length>0}function ce(){if(p.items.length>0){const e=p.items.shift();M(e==null?void 0:e.toastContent,e==null?void 0:e.toastProps)}}const c=a.reactive({}),p=a.reactive({items:[]});function b(){const e=a.toRaw(c);return Object.values(e).reduce((t,n)=>[...t,...n],[])}function fe(e){return b().find(n=>n.toastId===e)}function M(e,t={}){if(Le(t)){const n=X(t.containerId);n&&n.addEventListener("animationend",W.bind(null,e,t),!1)}else W(e,t)}function W(e,t={}){const n=X(t.containerId);n&&n.removeEventListener("animationend",W.bind(null,e,t),!1);const o=c[t.containerId]||[],s=o.length>0;if(!s&&!he(t.position)){const r=Oe(t),d=a.createApp(ye,t);d.mount(r),de(d,r.id)}s&&!t.updateId&&(t.position=o[0].position),a.nextTick(()=>{t.updateId?g.update(t):g.add(e,t)})}const g={add(e,t){const{containerId:n=""}=t;n&&(c[n]=c[n]||[],c[n].find(o=>o.toastId===t.toastId)||setTimeout(()=>{var o,s;t.newestOnTop?(o=c[n])==null||o.unshift(t):(s=c[n])==null||s.push(t),t.onOpen&&t.onOpen(te(t))},t.delay||0))},remove(e){if(e){const t=Pe(e);if(t){const n=c[t];let o=n.find(s=>s.toastId===e);c[t]=n.filter(s=>s.toastId!==e),!c[t].length&&!$e(t)&&D(t,!1),ce(),a.nextTick(()=>{o!=null&&o.onClose&&(o.onClose(te(o)),o=void 0)})}}},update(e={}){const{containerId:t=""}=e;if(t&&e.updateId){c[t]=c[t]||[];const n=c[t].find(r=>r.toastId===e.toastId),o=(n==null?void 0:n.position)!==e.position||(n==null?void 0:n.transition)!==e.transition,s={...e,disabledEnterTransition:!o,updateId:void 0};g.dismissForce(e==null?void 0:e.toastId),setTimeout(()=>{l(s.content,s)},e.delay||0)}},clear(e,t=!0){e?D(e,t):ue(t)},dismissCallback(e){var o;const t=(o=e.currentTarget)==null?void 0:o.id,n=document.getElementById(t);n&&(n.removeEventListener("animationend",g.dismissCallback,!1),setTimeout(()=>{g.remove(t)}))},dismiss(e){if(e){const t=b();for(const n of t)if(n.toastId===e){Y(n,o=>{o.addEventListener("animationend",g.dismissCallback,!1)});break}}},dismissForce(e){if(e){const t=b();for(const n of t)if(n.toastId===e){const o=document.getElementById(e);o&&(o.remove(),o.removeEventListener("animationend",g.dismissCallback,!1),g.remove(e));break}}}},J=a.reactive({}),U=a.reactive({});function me(){return Math.random().toString(36).substring(2,9)}function we(e){return typeof e=="number"&&!isNaN(e)}function Z(e){return typeof e=="string"}function L(e){return typeof e=="function"}function V(...e){return a.mergeProps(...e)}function x(e){return typeof e=="object"&&(!!(e!=null&&e.render)||!!(e!=null&&e.setup)||typeof(e==null?void 0:e.type)=="object")}function qe(e={}){J[`${i.CSS_NAMESPACE}-default-options`]=e}function Be(){return J[`${i.CSS_NAMESPACE}-default-options`]||ae}function Me(){const e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return document.documentElement.classList.contains("dark")||e?"dark":"light"}var R=(e=>(e[e.Enter=0]="Enter",e[e.Exit=1]="Exit",e))(R||{});const ge={containerId:{type:[String,Number],required:!1,default:""},clearOnUrlChange:{type:Boolean,required:!1,default:!0},disabledEnterTransition:{type:Boolean,required:!1,default:!1},dangerouslyHTMLString:{type:Boolean,required:!1,default:!1},multiple:{type:Boolean,required:!1,default:!0},limit:{type:Number,required:!1,default:void 0},position:{type:String,required:!1,default:k.TOP_LEFT},bodyClassName:{type:String,required:!1,default:""},autoClose:{type:[Number,Boolean],required:!1,default:!1},closeButton:{type:[Boolean,Function,Object],required:!1,default:void 0},transition:{type:[String,Object],required:!1,default:"bounce"},hideProgressBar:{type:Boolean,required:!1,default:!1},pauseOnHover:{type:Boolean,required:!1,default:!0},pauseOnFocusLoss:{type:Boolean,required:!1,default:!0},closeOnClick:{type:Boolean,required:!1,default:!0},progress:{type:Number,required:!1,default:void 0},progressClassName:{type:String,required:!1,default:""},toastStyle:{type:Object,required:!1,default(){return{}}},progressStyle:{type:Object,required:!1,default(){return{}}},role:{type:String,required:!1,default:"alert"},theme:{type:String,required:!1,default:$.AUTO},content:{type:[String,Object,Function],required:!1,default:""},toastId:{type:[String,Number],required:!1,default:""},data:{type:[Object,String],required:!1,default(){return{}}},type:{type:String,required:!1,default:m.DEFAULT},icon:{type:[Boolean,String,Number,Object,Function],required:!1,default:void 0},delay:{type:Number,required:!1,default:void 0},onOpen:{type:Function,required:!1,default:void 0},onClose:{type:Function,required:!1,default:void 0},onClick:{type:Function,required:!1,default:void 0},isLoading:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:!1},toastClassName:{type:String,required:!1,default:""},updateId:{type:[String,Number],required:!1,default:""},contentProps:{type:Object,required:!1,default:null}},Re={autoClose:{type:[Number,Boolean],required:!0},isRunning:{type:Boolean,required:!1,default:void 0},type:{type:String,required:!1,default:m.DEFAULT},theme:{type:String,required:!1,default:$.AUTO},hide:{type:Boolean,required:!1,default:void 0},className:{type:[String,Function],required:!1,default:""},controlledProgress:{type:Boolean,required:!1,default:void 0},rtl:{type:Boolean,required:!1,default:void 0},isIn:{type:Boolean,required:!1,default:void 0},progress:{type:Number,required:!1,default:void 0},closeToast:{type:Function,required:!1,default:void 0}},Fe=a.defineComponent({name:"ProgressBar",props:Re,setup(e,{attrs:t}){const n=a.ref(),o=a.computed(()=>e.hide?"true":"false"),s=a.computed(()=>({...t.style||{},animationDuration:`${e.autoClose===!0?5e3:e.autoClose}ms`,animationPlayState:e.isRunning?"running":"paused",opacity:e.hide||e.autoClose===!1?0:1,transform:e.controlledProgress?`scaleX(${e.progress})`:"none"})),r=a.computed(()=>[`${i.CSS_NAMESPACE}__progress-bar`,e.controlledProgress?`${i.CSS_NAMESPACE}__progress-bar--controlled`:`${i.CSS_NAMESPACE}__progress-bar--animated`,`${i.CSS_NAMESPACE}__progress-bar-theme--${e.theme}`,`${i.CSS_NAMESPACE}__progress-bar--${e.type}`,e.rtl?`${i.CSS_NAMESPACE}__progress-bar--rtl`:null].filter(Boolean).join(" ")),d=a.computed(()=>`${r.value} ${(t==null?void 0:t.class)||""}`),y=()=>{n.value&&(n.value.onanimationend=null,n.value.ontransitionend=null)},u=()=>{e.isIn&&e.closeToast&&e.autoClose!==!1&&(e.closeToast(),y())},S=a.computed(()=>e.controlledProgress?null:u),f=a.computed(()=>e.controlledProgress?u:null);return a.watchEffect(()=>{n.value&&(y(),n.value.onanimationend=S.value,n.value.ontransitionend=f.value)}),()=>a.createVNode("div",{ref:n,role:"progressbar","aria-hidden":o.value,"aria-label":"notification timer",class:d.value,style:s.value},null)}}),Ue=a.defineComponent({name:"CloseButton",inheritAttrs:!1,props:{theme:{type:String,required:!1,default:$.AUTO},type:{type:String,required:!1,default:$.LIGHT},ariaLabel:{type:String,required:!1,default:"close"},closeToast:{type:Function,required:!1,default:void 0}},setup(e){return()=>a.createVNode("button",{class:`${i.CSS_NAMESPACE}__close-button ${i.CSS_NAMESPACE}__close-button--${e.theme}`,type:"button",onClick:t=>{t.stopPropagation(),e.closeToast&&e.closeToast(t)},"aria-label":e.ariaLabel},[a.createVNode("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},[a.createVNode("path",{"fill-rule":"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"},null)])])}}),j=({theme:e,type:t,path:n,...o})=>a.createVNode("svg",a.mergeProps({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`},o),[a.createVNode("path",{d:n},null)]);function ke(e){return a.createVNode(j,a.mergeProps(e,{path:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}),null)}function xe(e){return a.createVNode(j,a.mergeProps(e,{path:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}),null)}function De(e){return a.createVNode(j,a.mergeProps(e,{path:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}),null)}function He(e){return a.createVNode(j,a.mergeProps(e,{path:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}),null)}function Ve(){return a.createVNode("div",{class:`${i.CSS_NAMESPACE}__spinner`},null)}const K={info:xe,warning:ke,success:De,error:He,spinner:Ve},je=e=>e in K;function ze({theme:e,type:t,isLoading:n,icon:o}){let s;const r={theme:e,type:t};return n?s=K.spinner():o===!1?s=void 0:x(o)?s=a.toRaw(o):L(o)?s=o(r):a.isVNode(o)?s=a.cloneVNode(o,r):Z(o)||we(o)?s=o:je(t)&&(s=K[t](r)),s}const Ge=()=>{};function Qe(e,t,n=i.COLLAPSE_DURATION){const{scrollHeight:o,style:s}=e,r=n;requestAnimationFrame(()=>{s.minHeight="initial",s.height=o+"px",s.transition=`all ${r}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(t,r)})})}function Ce(e){const t=a.ref(!1),n=a.ref(!1),o=a.ref(!1),s=a.ref(R.Enter),r=a.reactive({...e,appendPosition:e.appendPosition||!1,collapse:typeof e.collapse>"u"?!0:e.collapse,collapseDuration:e.collapseDuration||i.COLLAPSE_DURATION}),d=r.done||Ge,y=a.computed(()=>r.appendPosition?`${r.enter}--${r.position}`:r.enter),u=a.computed(()=>r.appendPosition?`${r.exit}--${r.position}`:r.exit),S=a.computed(()=>e.pauseOnHover?{onMouseenter:h,onMouseleave:A}:{});function f(){const E=y.value.split(" ");C().addEventListener(G.ENTRANCE_ANIMATION_END,A,{once:!0});const _=P=>{const B=C();P.target===B&&(B.dispatchEvent(new Event(G.ENTRANCE_ANIMATION_END)),B.removeEventListener("animationend",_),B.removeEventListener("animationcancel",_),s.value===R.Enter&&P.type!=="animationcancel"&&B.classList.remove(...E))},I=()=>{const P=C();P.classList.add(...E),P.addEventListener("animationend",_),P.addEventListener("animationcancel",_)};e.pauseOnFocusLoss&&v(),I()}function T(){if(!C())return;const E=()=>{const I=C();I.removeEventListener("animationend",E),r.collapse?Qe(I,d,r.collapseDuration):d()},_=()=>{const I=C();s.value=R.Exit,I&&(I.className+=` ${u.value}`,I.addEventListener("animationend",E))};n.value||(o.value?E():setTimeout(_))}function C(){return e.toastRef.value}function v(){document.hasFocus()||h(),window.addEventListener("focus",A),window.addEventListener("blur",h)}function N(){window.removeEventListener("focus",A),window.removeEventListener("blur",h)}function A(){(!e.loading.value||e.isLoading===void 0)&&(t.value=!0)}function h(){t.value=!1}function q(E){E&&(E.stopPropagation(),E.preventDefault()),n.value=!1}return a.watchEffect(T),a.watchEffect(()=>{const E=b();n.value=E.findIndex(_=>_.toastId===r.toastId)>-1}),a.watchEffect(()=>{e.isLoading!==void 0&&(e.loading.value?h():A())}),a.onMounted(f),a.onUnmounted(()=>{e.pauseOnFocusLoss&&N()}),{isIn:n,isRunning:t,hideToast:q,eventHandlers:S}}const We=a.defineComponent({name:"ToastItem",inheritAttrs:!1,props:ge,setup(e){const t=a.ref(),n=a.computed(()=>!!e.isLoading),o=a.computed(()=>e.progress!==void 0&&e.progress!==null),s=a.computed(()=>ze(e)),r=a.computed(()=>[`${i.CSS_NAMESPACE}__toast`,`${i.CSS_NAMESPACE}__toast-theme--${e.theme}`,`${i.CSS_NAMESPACE}__toast--${e.type}`,e.rtl?`${i.CSS_NAMESPACE}__toast--rtl`:void 0,e.toastClassName||""].filter(Boolean).join(" ")),{isRunning:d,isIn:y,hideToast:u,eventHandlers:S}=Ce({toastRef:t,loading:n,done:()=>{g.remove(e.toastId)},...le(e.transition,e.disabledEnterTransition),...e});return()=>a.createVNode("div",a.mergeProps({id:e.toastId,class:r.value,style:e.toastStyle||{},ref:t,"data-testid":`toast-item-${e.toastId}`,onClick:f=>{e.closeOnClick&&u(),e.onClick&&e.onClick(f)}},S.value),[a.createVNode("div",{role:e.role,"data-testid":"toast-body",class:`${i.CSS_NAMESPACE}__toast-body ${e.bodyClassName||""}`},[s.value!=null&&a.createVNode("div",{"data-testid":`toast-icon-${e.type}`,class:[`${i.CSS_NAMESPACE}__toast-icon`,e.isLoading?"":`${i.CSS_NAMESPACE}--animate-icon ${i.CSS_NAMESPACE}__zoom-enter`].join(" ")},[x(s.value)?a.h(a.toRaw(s.value),{theme:e.theme,type:e.type}):L(s.value)?s.value({theme:e.theme,type:e.type}):s.value]),e.contentProps?a.createVNode("div",{"data-testid":"toast-content"},[a.h(a.toRaw(e.content),{contentProps:e.contentProps})]):a.createVNode("div",{"data-testid":"toast-content"},[x(e.content)?a.h(a.toRaw(e.content),{toastProps:a.toRaw(e),closeToast:u,data:e.data}):L(e.content)?e.content({toastProps:a.toRaw(e),closeToast:u,data:e.data}):e.dangerouslyHTMLString?a.h("div",{innerHTML:e.content}):e.content])]),(e.closeButton===void 0||e.closeButton===!0)&&a.createVNode(Ue,{theme:e.theme,closeToast:f=>{f.stopPropagation(),f.preventDefault(),u()}},null),x(e.closeButton)?a.h(a.toRaw(e.closeButton),{closeToast:u,type:e.type,theme:e.theme}):L(e.closeButton)?e.closeButton({closeToast:u,type:e.type,theme:e.theme}):null,a.createVNode(Fe,{className:e.progressClassName,style:e.progressStyle,rtl:e.rtl,theme:e.theme,isIn:y.value,type:e.type,hide:e.hideProgressBar,isRunning:d.value,autoClose:e.autoClose,controlledProgress:o.value,progress:e.progress,closeToast:e.isLoading?void 0:u},null)])}});let F=0;function Ee(){typeof window>"u"||(F&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(Ee),U.lastUrl!==window.location.href&&(U.lastUrl=window.location.href,g.clear()))}const ye=a.defineComponent({name:"ToastifyContainer",inheritAttrs:!1,props:ge,setup(e){const t=a.computed(()=>e.containerId),n=a.computed(()=>c[t.value]||[]),o=a.computed(()=>n.value.filter(s=>s.position===e.position));return a.onMounted(()=>{typeof window<"u"&&e.clearOnUrlChange&&window.requestAnimationFrame(Ee)}),a.onUnmounted(()=>{typeof window<"u"&&F&&(window.cancelAnimationFrame(F),U.lastUrl="")}),()=>a.createVNode(a.Fragment,null,[o.value.map(s=>{const{toastId:r=""}=s;return a.createVNode(We,a.mergeProps({key:r},s),null)})])}});let z=!1;function Te(){const e=[];return b().forEach(n=>{const o=document.getElementById(n.containerId);o&&!o.classList.contains(H)&&e.push(n)}),e}function Ze(e){const t=Te().length,n=e!=null?e:0;return n>0&&t+p.items.length>=n}function Ke(e){Ze(e.limit)&&!e.updateId&&p.items.push({toastId:e.toastId,containerId:e.containerId,toastContent:e.content,toastProps:e})}function O(e,t,n={}){if(z)return;n=V(Be(),{type:t},a.toRaw(n)),(!n.toastId||typeof n.toastId!="string"&&typeof n.toastId!="number")&&(n.toastId=me()),n={...n,content:e,containerId:n.containerId||String(n.position)};const o=Number(n==null?void 0:n.progress);return o<0&&(n.progress=0),o>1&&(n.progress=1),n.theme==="auto"&&(n.theme=Me()),Ke(n),U.lastUrl=window.location.href,n.multiple?p.items.length?n.updateId&&M(e,n):M(e,n):(z=!0,l.clearAll(void 0,!1),setTimeout(()=>{M(e,n)},0),setTimeout(()=>{z=!1},390)),n.toastId}const l=(e,t)=>O(e,m.DEFAULT,t);l.info=(e,t)=>O(e,m.DEFAULT,{...t,type:m.INFO});l.error=(e,t)=>O(e,m.DEFAULT,{...t,type:m.ERROR});l.warning=(e,t)=>O(e,m.DEFAULT,{...t,type:m.WARNING});l.warn=l.warning;l.success=(e,t)=>O(e,m.DEFAULT,{...t,type:m.SUCCESS});l.loading=(e,t)=>O(e,m.DEFAULT,V(t,{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1}));l.dark=(e,t)=>O(e,m.DEFAULT,V(t,{theme:$.DARK}));l.remove=e=>{e?g.dismiss(e):g.clear()};l.clearAll=(e,t)=>{a.nextTick(()=>{g.clear(e,t)})};l.isActive=e=>{let t=!1;return t=Te().findIndex(o=>o.toastId===e)>-1,t};l.update=(e,t={})=>{setTimeout(()=>{const n=fe(e);if(n){const o=a.toRaw(n),{content:s}=o,r={...o,...t,toastId:t.toastId||e,updateId:me()},d=r.render||s;delete r.render,O(d,r.type,r)}},0)};l.done=e=>{l.update(e,{isLoading:!1,progress:1})};l.promise=Ye;function Ye(e,{pending:t,error:n,success:o},s){var f,T,C;let r;const d={...s||{},autoClose:!1};t&&(r=Z(t)?l.loading(t,d):l.loading(t.render,{...d,...t}));const y={autoClose:(f=s==null?void 0:s.autoClose)!=null?f:!0,closeOnClick:(T=s==null?void 0:s.closeOnClick)!=null?T:!0,closeButton:(C=s==null?void 0:s.autoClose)!=null?C:null,isLoading:void 0,draggable:null,delay:100},u=(v,N,A)=>{if(N==null){l.remove(r);return}const h={type:v,...y,...s,data:A},q=Z(N)?{render:N}:N;return r?l.update(r,{...h,...q,isLoading:!1}):l(q.render,{...h,...q,isLoading:!1}),A},S=L(e)?e():e;return S.then(v=>{u("success",o,v)}).catch(v=>{u("error",n,v)}),S}l.POSITION=k;l.THEME=$;l.TYPE=m;l.TRANSITIONS=Se;const ve={install(e,t={}){pe(t)}};typeof window<"u"&&(window.Vue3Toastify=ve);function pe(e={}){const t=V(ae,e);qe(t)}exports.AnimationStep=R;exports.Bounce=oe;exports.Flip=ie;exports.Slide=se;exports.ToastActions=g;exports.ToastifyContainer=ye;exports.Zoom=re;exports.addExitAnimateToNode=Y;exports.appendFromQueue=ce;exports.cacheRenderInstance=de;exports.clearContainers=ue;exports.containerInstances=w;exports.default=ve;exports.doAppend=M;exports.getAllToast=b;exports.getToast=fe;exports.globalCache=U;exports.globalOptions=J;exports.queue=p;exports.removeContainer=D;exports.toast=l;exports.toastContainers=c;exports.updateGlobalOptions=pe;exports.useCssTransition=Ce; |
{ | ||
"name": "vue3-toastify", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"type": "module", | ||
@@ -88,10 +88,10 @@ "description": "🎉 Vue3-Toastify allows you to add notifications to your app with ease. No more nonsense!", | ||
"@babel/preset-typescript": "^7.26.0", | ||
"@commitlint/cli": "^19.5.0", | ||
"@commitlint/config-conventional": "^19.5.0", | ||
"@stylistic/eslint-plugin-js": "^2.9.0", | ||
"@stylistic/eslint-plugin-jsx": "^2.9.0", | ||
"@stylistic/eslint-plugin-plus": "^2.9.0", | ||
"@stylistic/eslint-plugin-ts": "^2.9.0", | ||
"@swc/core": "^1.7.40", | ||
"@testing-library/jest-dom": "^6.6.2", | ||
"@commitlint/cli": "^19.6.0", | ||
"@commitlint/config-conventional": "^19.6.0", | ||
"@stylistic/eslint-plugin-js": "^2.11.0", | ||
"@stylistic/eslint-plugin-jsx": "^2.11.0", | ||
"@stylistic/eslint-plugin-plus": "^2.11.0", | ||
"@stylistic/eslint-plugin-ts": "^2.11.0", | ||
"@swc/core": "^1.9.3", | ||
"@testing-library/jest-dom": "^6.6.3", | ||
"@testing-library/user-event": "^14.5.2", | ||
@@ -101,7 +101,7 @@ "@testing-library/vue": "^8.1.0", | ||
"@types/lz-string": "^1.5.0", | ||
"@types/node": "^20.17.1", | ||
"@typescript-eslint/parser": "^8.11.0", | ||
"@vitejs/plugin-vue": "^5.1.4", | ||
"@vitejs/plugin-vue-jsx": "^4.0.1", | ||
"@vitest/ui": "^2.1.3", | ||
"@types/node": "^22.10.0", | ||
"@typescript-eslint/parser": "^8.16.0", | ||
"@vitejs/plugin-vue": "^5.2.1", | ||
"@vitejs/plugin-vue-jsx": "^4.1.1", | ||
"@vitest/ui": "^2.1.6", | ||
"@vue/babel-plugin-jsx": "^1.2.5", | ||
@@ -111,19 +111,19 @@ "autoprefixer": "^10.4.20", | ||
"browserslist-to-esbuild": "^2.1.1", | ||
"bumpp": "^9.7.1", | ||
"core-js": "^3.38.1", | ||
"bumpp": "^9.8.1", | ||
"core-js": "^3.39.0", | ||
"cssnano": "^7.0.6", | ||
"esbuild-plugin-babel": "^0.2.3", | ||
"eslint-plugin-vue": "^9.29.1", | ||
"husky": "^9.1.6", | ||
"eslint-plugin-vue": "^9.31.0", | ||
"husky": "^9.1.7", | ||
"jsdom": "^25.0.1", | ||
"lint-staged": "^15.2.10", | ||
"npm": "^10.9.0", | ||
"npm": "^10.9.1", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.47", | ||
"postcss": "^8.4.49", | ||
"postcss-cli": "^11.0.0", | ||
"postcss-loader": "^8.1.1", | ||
"postcss-nested": "^6.2.0", | ||
"postcss-nested": "^7.0.2", | ||
"postcss-scss": "^4.0.9", | ||
"rimraf": "^5.0.10", | ||
"sass": "^1.80.4", | ||
"sass": "^1.81.0", | ||
"shelljs": "^0.8.5", | ||
@@ -134,10 +134,10 @@ "stylelint": "^16.10.0", | ||
"tsup": "^8.3.5", | ||
"typescript": "^5.6.3", | ||
"vite": "^5.4.10", | ||
"typescript": "~5.6.3", | ||
"vite": "^6.0.1", | ||
"vite-plugin-dts": "^4.3.0", | ||
"vite-plugin-eslint": "^1.8.1", | ||
"vite-plugin-style-import": "^2.0.0", | ||
"vitest": "^2.1.3", | ||
"vitest": "^2.1.6", | ||
"vue-eslint-parser": "^9.4.3", | ||
"vue-tsc": "^2.1.8" | ||
"vue-tsc": "^2.1.10" | ||
}, | ||
@@ -144,0 +144,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91673
1772
30
1
2
0
6