@editora/toast 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(b,E){typeof exports=="object"&&typeof module!="undefined"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(b=typeof globalThis!="undefined"?globalThis:b||self,E(b.EditoraToast={}))})(this,function(b){"use strict";class E{constructor(t){this.toasts=new Map,this.groups=new Map,this.containers=new Map,this.config={...t}}addToast(t){this.toasts.set(t.id,t),this.updateGroup(t)}removeToast(t){const e=this.toasts.get(t);return e?(this.toasts.delete(t),this.updateGroup(e),!0):!1}getToast(t){return this.toasts.get(t)}getAllToasts(){return Array.from(this.toasts.values())}getToastsByPosition(t){return this.getAllToasts().filter(e=>e.options.position===t)}updateToast(t,e){const s=this.toasts.get(t);return s?(Object.assign(s,e),this.updateGroup(s),!0):!1}updateGroup(t){const e=t.options.group;if(!e)return;let s=this.groups.get(e);s||(s={id:e,toasts:[]},this.groups.set(e,s)),s.toasts=s.toasts.filter(i=>i.id!==t.id),t.options.group===e&&s.toasts.push(t),s.toasts.length===0&&this.groups.delete(e)}getGroup(t){return this.groups.get(t)}getAllGroups(){return Array.from(this.groups.values())}getContainer(t){return this.containers.get(t)}setContainer(t,e){this.containers.set(t,e)}removeContainer(t){return this.containers.delete(t)}getAllContainers(){return new Map(this.containers)}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t}}clear(){this.toasts.clear(),this.groups.clear()}getStats(){return{totalToasts:this.toasts.size,totalGroups:this.groups.size,toastsByPosition:Object.fromEntries(Array.from(this.containers.keys()).map(t=>[t,this.getToastsByPosition(t).length]))}}}class q{constructor(t){this.queue=[],this.visible=[],this.config=this.normalizeConfig(t)}enqueue(t){var r;const e=this.findDuplicate(t);if(e&&((r=t.options.preventDuplicate)!=null?r:this.config.preventDuplicate))return{show:[],hide:[],rejected:e};const s=[];if(t.options.important&&this.visible.length>=this.maxVisible){const o=this.removeLowestPriorityVisible();return this.visible.push(t),{show:[t],hide:o?[...s,o]:s}}this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.sortQueue();const i=this.processQueue();return{show:i.show,hide:[...s,...i.hide]}}dequeue(t){return this.removeFromCollections(t)?{show:this.processQueue().show,hide:[]}:{show:[],hide:[]}}updateConfig(t){return this.config=this.normalizeConfig({...this.config,...t}),this.sortQueue(),this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}isVisible(t){return this.visible.some(e=>e.id===t)}clear(){const t=[...this.visible,...this.queue];return this.queue=[],this.visible=[],t}processQueue(){const t=[],e=[];for(;this.visible.length>this.maxVisible;){const s=this.visible.pop();s&&e.push(s)}for(;this.visible.length<this.maxVisible&&this.queue.length>0;){const s=this.queue.shift();if(!s)break;this.visible.push(s),t.push(s)}return{show:t,hide:e}}removeLowestPriorityVisible(){if(this.visible.length===0)return;let t=0;for(let e=1;e<this.visible.length;e+=1)(this.visible[e].options.priority||0)<(this.visible[t].options.priority||0)&&(t=e);return this.visible.splice(t,1)[0]}removeFromCollections(t){const e=this.visible.findIndex(i=>i.id===t);if(e!==-1)return this.visible.splice(e,1)[0];const s=this.queue.findIndex(i=>i.id===t);if(s!==-1)return this.queue.splice(s,1)[0]}findDuplicate(t){const e=t.options.dedupeScope||this.config.dedupeScope,s=e==="visible"?this.visible:e==="queue"?this.queue:[...this.visible,...this.queue],i=this.getDedupeKey(t);return s.find(r=>this.getDedupeKey(r)===i)}getDedupeKey(t){return t.options.dedupeKey||`${t.options.level||"info"}:${t.options.title||""}:${t.options.message||""}:${t.options.description||""}`}sortQueue(){this.queue.sort((t,e)=>{const s=(e.options.priority||0)-(t.options.priority||0);return s!==0?s:t.createdAt-e.createdAt})}get maxVisible(){return Math.max(1,this.config.visibleToasts||this.config.maxVisible||1)}normalizeConfig(t){return{...t,maxVisible:t.visibleToasts||t.maxVisible}}}class z{constructor(t={}){var e,s,i,r;this.config={stiffness:(e=t.stiffness)!=null?e:100,damping:(s=t.damping)!=null?s:10,mass:(i=t.mass)!=null?i:1,precision:(r=t.precision)!=null?r:.01}}animate(t,e,s,i,r){const o={...this.config,...r};let n,c=!1;const p=Object.keys(e).reduce((u,l)=>(u[l]=e[l].from,u),{}),h=Object.keys(e).reduce((u,l)=>(u[l]=0,u),{}),f=()=>{if(c)return;let u=!0;Object.keys(e).forEach(y=>{const v=e[y].to,m=p[y],w=h[y],g=-o.stiffness*(m-v),P=-o.damping*w,A=(g+P)/o.mass;h[y]+=A*.016,p[y]+=h[y]*.016,(Math.abs(m-v)>o.precision||Math.abs(w)>o.precision)&&(u=!1)});const l=Object.keys(p).reduce((y,v)=>{const m=e[v].unit||"px";return y[v]=`${p[v]}${m}`,y},{});s(l),u?(c=!0,i==null||i()):n=requestAnimationFrame(f)};return n=requestAnimationFrame(f),()=>{c=!0,n&&cancelAnimationFrame(n)}}}class O{constructor(){this.springAnimation=new z}async showToast(t,e,s){switch(s.type){case"spring":await this.animateSpringShow(t,s);break;case"bounce":await this.animateBounceShow(t,s);break;case"slide":await this.animateSlideShow(t,s);break;case"zoom":await this.animateZoomShow(t,s);break;case"flip":await this.animateFlipShow(t,s);break;case"fade":await this.animateFadeShow(t,s);break;case"elastic":await this.animateElasticShow(t,s);break;case"rotate":await this.animateRotateShow(t,s);break;case"custom":s.show?await Promise.resolve(s.show(t,e)):await this.animateCssShow(t);break;case"css":default:await this.animateCssShow(t);break}}async hideToast(t,e,s){switch(s.type){case"spring":await this.animateSpringHide(t,s);break;case"bounce":await this.animateBounceHide(t,s);break;case"slide":await this.animateSlideHide(t,s);break;case"zoom":await this.animateZoomHide(t,s);break;case"flip":await this.animateFlipHide(t,s);break;case"fade":await this.animateFadeHide(t,s);break;case"elastic":await this.animateElasticHide(t,s);break;case"rotate":await this.animateRotateHide(t,s);break;case"custom":s.hide?await Promise.resolve(s.hide(t,e)):await this.animateCssHide(t);break;case"css":default:await this.animateCssHide(t);break}}async updateToast(t,e,s,i){i.type==="custom"&&i.update&&await Promise.resolve(i.update(t,e,s))}animateCssShow(t){return new Promise(e=>{requestAnimationFrame(()=>{t.classList.add("show"),window.setTimeout(e,220)})})}animateCssHide(t){return new Promise(e=>{t.classList.remove("show"),t.classList.add("hiding"),window.setTimeout(e,220)})}async animateSpringShow(t,e){return new Promise(s=>{var o,n,c;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const r=((o=t.parentElement)==null?void 0:o.classList.contains("editora-toast-bottom-right"))||((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-left"))||((c=t.parentElement)==null?void 0:c.classList.contains("editora-toast-bottom-center"))?20:-20;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`translateY(${r}px) scale(0.95)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition","opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)","important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},800)},16)})}async animateSpringHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important"),setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform","translateY(-10px) scale(0.95)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateBounceShow(t,e){return new Promise(s=>{var h,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),o=e.intensity||"normal",n=e.duration||800,c=o==="gentle"?.05:o==="strong"?.15:.1,p=r==="up"?30:r==="down"?-30:r==="left"?30:-30;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${p}px) scale(${1-c})`:`translateY(${p}px) scale(${1-c})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateBounceHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",r=i==="gentle"?.05:i==="strong"?.15:.1;setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1-r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateSlideShow(t,e){return new Promise(s=>{var h,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),o=e.distance||100,n=e.easing||"ease-out",c=e.duration||400,p=r==="up"?`translateY(${o}px)`:r==="down"?`translateY(-${o}px)`:r==="left"?`translateX(${o}px)`:`translateX(-${o}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",p,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${c}ms ${n}, transform ${c}ms ${n}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},c)},16)})}async animateSlideHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"down",r=e.distance||100,o=e.easing||"ease-in",n=e.duration||300,c=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`;setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${o}, transform ${n}ms ${o}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",c,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateZoomShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,r=e.origin||"center",o=e.easing||"ease-out",n=e.duration||500;t.style.setProperty("transform-origin",r,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${o}, transform ${n}ms ${o}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateZoomHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,r=e.origin||"center",o=e.easing||"ease-in",n=e.duration||300;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${o}, transform ${n}ms ${o}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateFlipShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",r=e.perspective||1e3,o=e.direction||"forward",n=e.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const c=o==="forward"?i==="x"?-90:90:i==="x"?90:-90;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${c}deg)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotateX(0deg) rotateY(0deg)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},n)},16)})}async animateFlipHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",r=e.perspective||1e3,o=e.direction||"backward",n=e.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const c=o==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${c}deg)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},n)},16)})}async animateFadeShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",r=e.distance||20,o=e.duration||300;let n="translateY(0) translateX(0)";i!=="none"&&(n=i==="up"?`translateY(${r}px)`:i==="down"?`translateY(-${r}px)`:i==="left"?`translateX(${r}px)`:`translateX(-${r}px)`),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",n,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},16)})}async animateFadeHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",r=e.distance||20,o=e.duration||200;let n="translateY(0) translateX(0)";i!=="none"&&(n=i==="up"?`translateY(-${r}px)`:i==="down"?`translateY(${r}px)`:i==="left"?`translateX(-${r}px)`:`translateX(${r}px)`),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",n,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},16)})}async animateElasticShow(t,e){return new Promise(s=>{var h,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=e.direction||(i?"up":"down"),o=e.intensity||"normal",n=e.duration||1e3,c=o==="gentle"?.1:o==="strong"?.3:.2,p=r==="up"?40:r==="down"?-40:r==="left"?40:-40;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",r==="left"||r==="right"?`translateX(${p}px) scale(${1+c})`:`translateY(${p}px) scale(${1+c})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateElasticHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",r=i==="gentle"?.1:i==="strong"?.3:.2;e.duration,setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1+r})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateRotateShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||360,r=e.direction||"clockwise",o=e.origin||"center",n=e.duration||500,c=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",o,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${c}deg) scale(0.8)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotate(0deg) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateRotateHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||180,r=e.direction||"counterclockwise",o=e.origin||"center",n=e.duration||300,c=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",o,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${c}deg) scale(0.8)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}}const H=new O;class I{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}updateConfig(t){this.config=t,this.containers.forEach((e,s)=>{this.applyContainerStyles(e,s),this.applyStackState(e)})}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const e=document.createElement("div");return e.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,e.setAttribute("role","region"),e.setAttribute("aria-label","Toast notifications"),e.setAttribute("aria-live","polite"),e.dataset.expand=String(this.config.expand),e.dataset.stack=String(this.config.stack),this.applyContainerStyles(e,t),document.body.appendChild(e),this.containers.set(t,e),this.injectCSS(),e}createToastElement(t){const e=t.options,s=document.createElement("div");s.className=`editora-toast editora-toast-${e.level||"info"}`,s.dataset.level=e.level||"info",e.customClass&&e.customClass.split(/\s+/).filter(Boolean).forEach(n=>s.classList.add(n)),s.setAttribute("role",e.role||(e.level==="error"?"alert":"status")),s.setAttribute("aria-atomic","true"),e.ariaLive&&e.ariaLive!=="off"&&s.setAttribute("aria-live",e.ariaLive);const i=e.theme||this.config.theme;i&&i!=="system"&&s.setAttribute("data-theme",i),(this.config.richColors||i==="colored")&&s.setAttribute("data-rich-colors","true"),(e.rtl!==void 0?e.rtl:this.config.rtl)&&(s.setAttribute("data-rtl","true"),s.setAttribute("dir","rtl"));const o=this.createContent(t);if(e.progress){const n=document.createElement("div");n.className="editora-toast-progress-track",n.setAttribute("role","progressbar"),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax","100"),n.setAttribute("aria-valuenow",String(Math.min(100,Math.max(0,e.progress.value))));const c=document.createElement("div");if(c.className="editora-toast-progress-bar",c.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`,e.progress.showPercentage){const p=document.createElement("span");p.className="editora-toast-progress-text",p.textContent=`${Math.round(e.progress.value)}%`,n.appendChild(p)}n.appendChild(c),o.appendChild(n)}if(s.appendChild(o),e.actions&&e.actions.length>0){const n=document.createElement("div");n.className="editora-toast-actions",e.actions.forEach(c=>n.appendChild(this.createActionButton(c,t))),s.appendChild(n)}if(e.closable||e.closeButton){const n=document.createElement("button");n.className="editora-toast-close",n.setAttribute("aria-label","Close notification"),n.textContent="×",n.onclick=()=>t.dismiss(),s.appendChild(n)}return e.pauseOnHover&&(s.addEventListener("mouseenter",()=>this.pauseToast(t)),s.addEventListener("mouseleave",()=>this.resumeToast(t))),e.pauseOnFocus&&(s.addEventListener("focusin",()=>this.pauseToast(t)),s.addEventListener("focusout",()=>this.resumeToast(t))),e.swipeDismiss&&this.addSwipeDismiss(s,t),e.dragDismiss&&this.addDragDismiss(s,t),s}async showToast(t){var r,o;const e=this.ensureContainer(t.options.position||this.config.position),s=this.createToastElement(t);t.element=s,e.appendChild(s),this.applyStackState(e);const i=t.options.animation||this.config.animation||{type:"css"};if(await H.showToast(s,t,i),this.config.enableAccessibility&&this.announceToast(t),(o=(r=t.options).onShow)==null||o.call(r),!t.options.persistent&&t.options.duration!==0){const n=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},n)}}async hideToast(t){var s,i;if(!t.element)return;t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0);const e=t.options.animation||this.config.animation||{type:"css"};if(await H.hideToast(t.element,t,e),t.element&&t.element.parentNode){const r=t.element.parentElement;t.element.parentNode.removeChild(t.element),t.element=void 0,r&&this.applyStackState(r)}(i=(s=t.options).onHide)==null||i.call(s)}async updateToast(t,e){var i,r;if(!t.element)return;const s=t.options.animation||this.config.animation||{type:"css"};if(s.type==="custom"&&s.update){await H.updateToast(t.element,t,e,s);return}if(Object.assign(t.options,e),e.level&&(t.element.className=t.element.className.replace(/editora-toast-(info|success|error|warning|loading|progress|promise|custom)/g,""),t.element.classList.add(`editora-toast-${e.level}`),t.element.dataset.level=e.level),e.title!==void 0||e.description!==void 0||e.message!==void 0||e.icon!==void 0||e.render){const o=t.element.querySelector(".editora-toast-content"),n=this.createContent(t);o==null||o.replaceWith(n)}if(e.progress!==void 0){let o=t.element.querySelector(".editora-toast-progress-track");if(e.progress){if(!o){o=document.createElement("div"),o.className="editora-toast-progress-track",o.setAttribute("role","progressbar"),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100");const c=t.element.querySelector(".editora-toast-content");c&&c.appendChild(o)}o.setAttribute("aria-valuenow",String(Math.min(100,Math.max(0,e.progress.value))));const n=o.querySelector(".editora-toast-progress-bar");if(n&&(n.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`),e.progress.showPercentage){let c=o.querySelector(".editora-toast-progress-text");c||(c=document.createElement("span"),c.className="editora-toast-progress-text",o.insertBefore(c,o.firstChild)),c.textContent=`${Math.round(e.progress.value)}%`}else{const c=o.querySelector(".editora-toast-progress-text");c&&c.remove()}}else o&&o.remove()}if(e.actions!==void 0||e.action!==void 0||e.cancel!==void 0){let o=t.element.querySelector(".editora-toast-actions");const n=t.options.actions||[];n.length>0?(o?o.innerHTML="":(o=document.createElement("div"),o.className="editora-toast-actions",t.element.appendChild(o)),o&&n.forEach(c=>o.appendChild(this.createActionButton(c,t)))):o&&o.remove()}if((e.duration!==void 0||e.persistent!==void 0||e.level!==void 0)&&(t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),!t.options.persistent&&t.options.duration!==0)){const o=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},o)}(r=(i=t.options).onUpdate)==null||r.call(i,e)}createContent(t){const e=t.options,s=document.createElement("div");if(s.className="editora-toast-content",e.icon){const r=document.createElement("span");r.className="editora-toast-icon",r.setAttribute("aria-hidden","true"),r.textContent=e.icon,s.appendChild(r)}const i=document.createElement("div");if(i.className="editora-toast-body",e.render)i.appendChild(e.render(t));else{if(e.title){const r=document.createElement("div");r.className="editora-toast-title",r.textContent=e.title,i.appendChild(r)}if(e.message){const r=document.createElement("div");r.className="editora-toast-message",e.html?r.innerHTML=this.sanitizeHTML(e.message):r.textContent=e.message,i.appendChild(r)}if(e.description){const r=document.createElement("div");r.className="editora-toast-description",r.textContent=e.description,i.appendChild(r)}}return s.appendChild(i),s}createActionButton(t,e){const s=document.createElement("button");return s.className=`editora-toast-action ${t.primary?"primary":""}`,s.textContent=t.label,t.altText&&s.setAttribute("aria-label",t.altText),s.onclick=i=>{i.stopPropagation(),t.onClick(),t.dismissOnClick!==!1&&e.dismiss()},s}applyContainerStyles(t,e){const s=this.toCssLength(this.config.offset),i=this.toCssLength(this.config.mobileOffset),r=this.toCssLength(this.config.gap);t.dataset.position=e,t.dataset.expand=String(this.config.expand),t.dataset.stack=String(this.config.stack),t.style.setProperty("--editora-toast-offset",s),t.style.setProperty("--editora-toast-mobile-offset",i),t.style.setProperty("--editora-toast-gap",r);const o={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:e.startsWith("top")?"column":"column-reverse",gap:r,pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box",top:"",right:"",bottom:"",left:"",transform:"",alignItems:e.includes("center")?"center":"stretch"};switch(e){case"top-left":o.top=`max(${s}, env(safe-area-inset-top))`,o.left=`max(${s}, env(safe-area-inset-left))`;break;case"top-center":o.top=`max(${s}, env(safe-area-inset-top))`,o.left="50%",o.transform="translateX(-50%)";break;case"top-right":o.top=`max(${s}, env(safe-area-inset-top))`,o.right=`max(${s}, env(safe-area-inset-right))`;break;case"bottom-left":o.bottom=`max(${s}, env(safe-area-inset-bottom))`,o.left=`max(${s}, env(safe-area-inset-left))`;break;case"bottom-center":o.bottom=`max(${s}, env(safe-area-inset-bottom))`,o.left="50%",o.transform="translateX(-50%)";break;case"bottom-right":o.bottom=`max(${s}, env(safe-area-inset-bottom))`,o.right=`max(${s}, env(safe-area-inset-right))`;break;case"center":o.top="50%",o.left="50%",o.transform="translate(-50%, -50%)",o.alignItems="center";break}Object.assign(t.style,o),t.style.setProperty("--editora-toast-mobile-left",i)}applyStackState(t){const e=Array.from(t.querySelectorAll(".editora-toast"));e.forEach((s,i)=>{const r=e.length-i-1;s.dataset.index=String(i),s.dataset.front=String(r===0),s.style.setProperty("--editora-toast-index",String(i)),s.style.setProperty("--editora-toast-before",String(r))})}toCssLength(t){return typeof t=="number"?`${t}px`:t||"16px"}pauseToast(t){t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0)}resumeToast(t){if(!t.options.persistent&&t.options.duration!==0){const e=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},e)}}addSwipeDismiss(t,e){let s=0,i=0,r=!1;const o=e.options.swipeDirection||this.config.swipeDirection||"any",n=40;let c="",p=!1;const h=l=>{r=!0,p=!1,s="touches"in l?l.touches[0].clientX:l.clientX,i="touches"in l?l.touches[0].clientY:l.clientY,c=t.style.transform||"",t.style.transition="none",t.style.cursor="grabbing",l.preventDefault()},f=l=>{if(!r)return;const y="touches"in l?l.touches[0].clientX:l.clientX,v="touches"in l?l.touches[0].clientY:l.clientY,m=y-s,w=v-i,g=5;if((Math.abs(m)>g||Math.abs(w)>g)&&(p=!0),p){const P=Math.abs(w)>Math.abs(m)?25:20,S=Math.min(Math.max(m*.2,-P),P),A=Math.min(Math.max(w*.2,-P),P);t.style.transform=`${c} translate(${S}px, ${A}px)`}(Math.abs(w)>Math.abs(m)||o==="vertical"||o==="up"||o==="down")&&l.preventDefault()},u=l=>{if(!r)return;if(t.style.transform=c,t.style.transition="",t.style.cursor="",!p){r=!1;return}const y="changedTouches"in l?l.changedTouches[0].clientX:l.clientX,v="changedTouches"in l?l.changedTouches[0].clientY:l.clientY,m=y-s,w=v-i;let g=!1;const S=o==="vertical"||o==="up"||o==="down"?35:n;switch(o){case"any":g=Math.abs(m)>n||Math.abs(w)>n;break;case"horizontal":g=Math.abs(m)>n;break;case"vertical":g=Math.abs(w)>S;break;case"left":g=m<-n;break;case"right":g=m>n;break;case"up":g=w<-S;break;case"down":g=w>S;break}g&&e.dismiss(),r=!1};t.addEventListener("dragstart",l=>l.preventDefault()),t.addEventListener("touchstart",h,{passive:!1}),t.addEventListener("touchmove",f,{passive:!1}),t.addEventListener("touchend",u,{passive:!1}),t.addEventListener("mousedown",h),t.addEventListener("mousemove",f),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",u)}addDragDismiss(t,e){this.addSwipeDismiss(t,e)}announceToast(t){if(t.options.ariaLive==="off")return;const e=document.createElement("div");e.setAttribute("aria-live",t.options.ariaLive||(t.options.level==="error"?"assertive":"polite")),e.setAttribute("aria-atomic","true"),e.style.position="absolute",e.style.left="-10000px",e.style.width="1px",e.style.height="1px",e.style.overflow="hidden";const s=[t.options.title,t.options.message,t.options.description].filter(Boolean).join(". ");e.textContent=`${t.options.level||"info"}: ${s}`,document.body.appendChild(e),setTimeout(()=>{document.body.removeChild(e)},1e3)}sanitizeHTML(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}injectCSS(){if(this.cssInjected||typeof document=="undefined")return;if(!Array.from(document.styleSheets).find(e=>{var s,i,r,o;return((i=(s=e.ownerNode)==null?void 0:s.href)==null?void 0:i.includes("toast.css"))||((o=(r=e.ownerNode)==null?void 0:r.textContent)==null?void 0:o.includes("editora-toast"))})){const e=document.createElement("style");e.setAttribute("data-editora-toast-fallback","true"),e.textContent=".editora-toast{box-sizing:border-box;pointer-events:auto}.editora-toast-container{box-sizing:border-box;pointer-events:none}.editora-toast.show{opacity:1;transform:translateY(0) scale(1)}.editora-toast.hiding{opacity:0}",document.head.appendChild(e)}this.cssInjected=!0}destroy(){this.containers.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.containers.clear()}}class Y{constructor(){this.plugins=[],this.hooks={beforeShow:[],afterShow:[],beforeHide:[],afterHide:[],beforeUpdate:[],afterUpdate:[]}}use(t){if(this.plugins.find(e=>e.name===t.name)){console.warn(`Plugin "${t.name}" is already installed`);return}this.plugins.push(t),t.install(this)}remove(t){const e=this.plugins.findIndex(i=>i.name===t);if(e===-1)return!1;const s=this.plugins[e];return s.uninstall&&s.uninstall(this),this.plugins.splice(e,1),!0}getPlugins(){return[...this.plugins]}on(t,e){this.hooks[t]&&this.hooks[t].push(e)}off(t,e){if(this.hooks[t]){const s=this.hooks[t].indexOf(e);s!==-1&&this.hooks[t].splice(s,1)}}async trigger(t,e,...s){const i=this.hooks[t];if(!(!i||i.length===0))for(const r of i)try{await r(e,...s)}catch(o){console.error(`Error in ${t} hook:`,o)}}async beforeShow(t){await this.trigger("beforeShow",t)}async afterShow(t){await this.trigger("afterShow",t)}async beforeHide(t){await this.trigger("beforeHide",t)}async afterHide(t){await this.trigger("afterHide",t)}async beforeUpdate(t,e){await this.trigger("beforeUpdate",t,e)}async afterUpdate(t,e){await this.trigger("afterUpdate",t,e)}onEditorEvent(t,e){const s=`editor:${t}`;this.hooks[s]||(this.hooks[s]=[]),this.hooks[s].push(e)}triggerEditorEvent(t,e,...s){const i=`editor:${t}`;this.trigger(i,e,...s)}async handlePromise(t,e,s,i){e();try{const r=await t;return s(r),r}catch(r){throw i(r),r}}async batchShow(t){const e=t.map(i=>this.beforeShow(i));await Promise.all(e);const s=t.map(i=>this.afterShow(i));await Promise.all(s)}async batchHide(t){const e=t.map(i=>this.beforeHide(i));await Promise.all(e);const s=t.map(i=>this.afterHide(i));await Promise.all(s)}destroy(){this.plugins.forEach(t=>{t.uninstall&&t.uninstall(this)}),this.plugins=[],Object.keys(this.hooks).forEach(t=>{this.hooks[t]=[]})}}const M={position:"bottom-right",duration:4e3,maxVisible:3,queueStrategy:"fifo",theme:"system",richColors:!1,expand:!0,stack:!1,offset:16,mobileOffset:16,gap:8,pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!0,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,closeButton:!1,preventDuplicate:!1,dedupeScope:"all",animation:{type:"css"}};class k{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.subscribers=new Set,this.config=this.normalizeConfig({...M,...t}),this.store=new E(this.config),this.queue=new q(this.config),this.renderer=new I(this.config),this.lifecycle=new Y,this.setupWindowFocusHandling()}show(t){const e=t.id||`toast-${++this.idCounter}`,s={id:e,options:this.normalizeToastOptions({...this.config,...t}),createdAt:Date.now(),dismiss:()=>this.dismiss(e),update:i=>this.update(e,i)};return this.lifecycle.beforeShow(s).then(async()=>{const i=this.queue.enqueue(s);i.rejected||(this.store.addToast(s),await this.hideToasts(i.hide,!0),await this.showToasts(i.show),this.notify())}),s}update(t,e){const s=this.store.getToast(t);return s?(this.lifecycle.beforeUpdate(s,e).then(async()=>{const i=this.normalizeToastOptions({...s.options,...e});this.store.updateToast(t,{options:i}),this.queue.isVisible(t)&&await this.renderer.updateToast(s,e),this.lifecycle.afterUpdate(s,e),this.notify()}),!0):!1}dismiss(t){const e=this.store.getToast(t);return e?(this.lifecycle.beforeHide(e).then(async()=>{const s=this.queue.isVisible(t),i=this.queue.dequeue(t);s&&await this.renderer.hideToast(e),this.store.removeToast(t),this.lifecycle.afterHide(e),await this.showToasts(i.show),this.notify()}),!0):!1}clear(){const t=this.queue.clear();Promise.all(t.map(e=>this.hideOne(e,!1))).then(()=>{this.store.clear(),this.notify()})}async promise(t,e){var i,r;const s=this.show(this.normalizeOptions(e.loading,"loading"));try{const o=await t,n=this.normalizeOptions(typeof e.success=="function"?e.success(o):e.success,"success");return n.duration===void 0&&!n.persistent&&(n.duration=this.config.duration),this.update(s.id,n),(i=e.onSuccess)==null||i.call(e,o),o}catch(o){const n=this.normalizeOptions(typeof e.error=="function"?e.error(o):e.error,"error");throw n.duration===void 0&&!n.persistent&&(n.duration=this.config.duration),this.update(s.id,n),(r=e.onError)==null||r.call(e,o),o}}group(t,e){return this.show({...e,group:t})}use(t){this.lifecycle.use(t)}configure(t){const e=this.config.pauseOnWindowBlur;this.config=this.normalizeConfig({...this.config,...t}),this.store.updateConfig(this.config),this.renderer.updateConfig(this.config);const s=this.queue.updateConfig(this.config);this.hideToasts(s.hide,!0).then(()=>this.showToasts(s.show)).then(()=>this.notify()),t.pauseOnWindowBlur!==void 0&&t.pauseOnWindowBlur!==e&&(this.teardownWindowFocusHandling(),this.setupWindowFocusHandling())}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}getState(){return{toasts:this.store.getAllToasts(),visible:this.queue.getVisible(),queued:this.queue.getQueued(),groups:this.store.getAllGroups(),config:this.getConfig()}}subscribe(t){return this.subscribers.add(t),t(this.getState()),()=>{this.subscribers.delete(t)}}getGroups(){return this.store.getAllGroups()}info(t,e){return this.show({message:t,level:"info",duration:e})}success(t,e){return this.show({message:t,level:"success",duration:e})}error(t,e){return this.show({message:t,level:"error",duration:e})}warning(t,e){return this.show({message:t,level:"warning",duration:e})}loading(t,e){return this.show({message:t,level:"loading",duration:e})}normalizeOptions(t,e){return typeof t=="string"?{message:t,level:e}:{...t,level:t.level||e}}normalizeConfig(t){const e=t.visibleToasts||t.maxVisible||M.maxVisible;return{...t,maxVisible:e,visibleToasts:e}}normalizeToastOptions(t){var r,o,n,c;const e=(o=(r=t.closeButton)!=null?r:t.closable)!=null?o:this.config.closeButton,s=t.action?{...t.action,primary:(n=t.action.primary)!=null?n:!0}:void 0,i=[...s?[s]:[],...t.cancel?[t.cancel]:[],...t.actions||[]];return{...t,closable:e,actions:i.length>0?i:void 0,ariaLive:t.ariaLive||(t.level==="error"||t.important?"assertive":"polite"),role:t.role||(t.level==="error"||t.important?"alert":"status"),preventDuplicate:(c=t.preventDuplicate)!=null?c:this.config.preventDuplicate,dedupeScope:t.dedupeScope||this.config.dedupeScope}}async showToasts(t){for(const e of t)await this.renderer.showToast(e),await this.lifecycle.afterShow(e)}async hideToasts(t,e){for(const s of t)await this.hideOne(s,e)}async hideOne(t,e){await this.lifecycle.beforeHide(t),await this.renderer.hideToast(t),e&&this.store.removeToast(t.id),await this.lifecycle.afterHide(t)}notify(){if(this.subscribers.size===0)return;const t=this.getState();this.subscribers.forEach(e=>e(t))}onEditorEvent(t,e){this.lifecycle.onEditorEvent(t,e)}triggerEditorEvent(t,e,...s){this.lifecycle.triggerEditorEvent(t,e,...s)}setupWindowFocusHandling(){typeof window=="undefined"||typeof document=="undefined"||!this.config.pauseOnWindowBlur||(this.teardownWindowFocusHandling(),this.windowBlurHandler=()=>this.pauseAllToasts(),this.windowFocusHandler=()=>this.resumeAllToasts(),this.visibilityChangeHandler=()=>{document.hidden?this.pauseAllToasts():this.resumeAllToasts()},window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),document.addEventListener("visibilitychange",this.visibilityChangeHandler))}teardownWindowFocusHandling(){typeof window!="undefined"&&(this.windowBlurHandler&&(window.removeEventListener("blur",this.windowBlurHandler),this.windowBlurHandler=void 0),this.windowFocusHandler&&(window.removeEventListener("focus",this.windowFocusHandler),this.windowFocusHandler=void 0),typeof document!="undefined"&&this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0))}pauseAllToasts(){this.store.getAllToasts().forEach(e=>{e.timeoutId&&!this.pausedToasts.has(e.id)&&(clearTimeout(e.timeoutId),e.timeoutId=void 0,this.pausedToasts.add(e.id))})}resumeAllToasts(){this.store.getAllToasts().forEach(e=>{if(this.pausedToasts.has(e.id)&&!e.options.persistent&&e.options.duration!==0){const s=e.options.duration||this.config.duration;e.timeoutId=window.setTimeout(()=>{this.dismiss(e.id)},s),this.pausedToasts.delete(e.id)}})}destroy(){this.teardownWindowFocusHandling(),this.clear(),this.renderer.destroy(),this.lifecycle.destroy()}}let T=null;function d(){return T||(T=new k),T}function $(a){return typeof document=="undefined"?{dismiss:()=>{}}:d().show(a)}function C(a,t,e,s){let i={};t&&typeof t=="object"?i={...t}:typeof t=="number"&&(i.duration=t),e&&(i.theme=e),s&&(i.position=s);const r={message:a,...i,level:i.level||void 0};return i.duration!==void 0&&(r.duration=i.duration),i.position&&(r.position=i.position),i.theme&&(r.theme=i.theme),r}const L={info:(a,t,e,s)=>$({...C(a,t,e,s),level:"info"}),success:(a,t,e,s)=>$({...C(a,t,e,s),level:"success"}),error:(a,t,e,s)=>$({...C(a,t,e,s),level:"error"}),warning:(a,t,e,s)=>$({...C(a,t,e,s),level:"warning"}),loading:(a,t,e,s)=>$({...C(a,t,e,s),level:"loading"})},x={show:a=>d().show(a),update:(a,t)=>d().update(a,t),dismiss:a=>d().dismiss(a),clear:()=>d().clear(),info:(a,t)=>d().show({message:a,level:"info",...t}),success:(a,t)=>d().show({message:a,level:"success",...t}),error:(a,t)=>d().show({message:a,level:"error",...t}),warning:(a,t)=>d().show({message:a,level:"warning",...t}),loading:(a,t)=>d().show({message:a,level:"loading",...t}),promise:(a,t)=>d().promise(a,t),group:(a,t)=>d().group(a,t),configure:a=>d().configure(a),use:a=>d().use(a),getToasts:()=>d().getToasts(),getGroups:()=>d().getGroups(),getConfig:()=>d().getConfig(),getState:()=>d().getState(),subscribe:a=>d().subscribe(a),onEditorEvent:(a,t)=>d().onEditorEvent(a,t),triggerEditorEvent:(a,t,...e)=>d().triggerEditorEvent(a,t,...e),destroy:()=>{T&&(T.destroy(),T=null)}};if(typeof window!="undefined"&&typeof document!="undefined"){const a=window;a.toast=L,a.toastAdvanced=x,a.toastPro=x,a.ToastManager=k,a.__editoraToastReady||(a.__editoraToastReady=!0,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:L,toastAdvanced:x,toastPro:x,ToastManager:k}})))}b.ToastManager=k,b.default=L,b.toast=L,b.toastAdvanced=x,b.toastPro=x,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(v,A){typeof exports=="object"&&typeof module!="undefined"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(v=typeof globalThis!="undefined"?globalThis:v||self,A(v.EditoraToast={}))})(this,(function(v){"use strict";class A{constructor(t){this.toasts=new Map,this.groups=new Map,this.containers=new Map,this.config={...t}}addToast(t){this.toasts.set(t.id,t),this.updateGroup(t)}removeToast(t){const e=this.toasts.get(t);return e?(this.toasts.delete(t),this.updateGroup(e),!0):!1}getToast(t){return this.toasts.get(t)}getAllToasts(){return Array.from(this.toasts.values())}getToastsByPosition(t){return this.getAllToasts().filter(e=>e.options.position===t)}updateToast(t,e){const s=this.toasts.get(t);return s?(Object.assign(s,e),this.updateGroup(s),!0):!1}updateGroup(t){const e=t.options.group;if(!e)return;let s=this.groups.get(e);s||(s={id:e,toasts:[]},this.groups.set(e,s)),s.toasts=s.toasts.filter(i=>i.id!==t.id),t.options.group===e&&s.toasts.push(t),s.toasts.length===0&&this.groups.delete(e)}getGroup(t){return this.groups.get(t)}getAllGroups(){return Array.from(this.groups.values())}getContainer(t){return this.containers.get(t)}setContainer(t,e){this.containers.set(t,e)}removeContainer(t){return this.containers.delete(t)}getAllContainers(){return new Map(this.containers)}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t}}clear(){this.toasts.clear(),this.groups.clear()}getStats(){return{totalToasts:this.toasts.size,totalGroups:this.groups.size,toastsByPosition:Object.fromEntries(Array.from(this.containers.keys()).map(t=>[t,this.getToastsByPosition(t).length]))}}}class z{constructor(t){this.queue=[],this.visible=[],this.config=this.normalizeConfig(t)}enqueue(t){var o;const e=this.findDuplicate(t);if(e&&((o=t.options.preventDuplicate)!=null?o:this.config.preventDuplicate))return{show:[],hide:[],rejected:e};const s=[];if(t.options.important&&this.visible.length>=this.maxVisible){const r=this.removeLowestPriorityVisible();return this.visible.push(t),{show:[t],hide:r?[...s,r]:s}}this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.sortQueue();const i=this.processQueue();return{show:i.show,hide:[...s,...i.hide]}}dequeue(t){return this.removeFromCollections(t)?{show:this.processQueue().show,hide:[]}:{show:[],hide:[]}}updateConfig(t){return this.config=this.normalizeConfig({...this.config,...t}),this.sortQueue(),this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}isVisible(t){return this.visible.some(e=>e.id===t)}clear(){const t=[...this.visible,...this.queue];return this.queue=[],this.visible=[],t}processQueue(){const t=[],e=[];for(;this.visible.length>this.maxVisible;){const s=this.visible.pop();s&&e.push(s)}for(;this.visible.length<this.maxVisible&&this.queue.length>0;){const s=this.queue.shift();if(!s)break;this.visible.push(s),t.push(s)}return{show:t,hide:e}}removeLowestPriorityVisible(){if(this.visible.length===0)return;let t=0;for(let e=1;e<this.visible.length;e+=1)(this.visible[e].options.priority||0)<(this.visible[t].options.priority||0)&&(t=e);return this.visible.splice(t,1)[0]}removeFromCollections(t){const e=this.visible.findIndex(i=>i.id===t);if(e!==-1)return this.visible.splice(e,1)[0];const s=this.queue.findIndex(i=>i.id===t);if(s!==-1)return this.queue.splice(s,1)[0]}findDuplicate(t){const e=t.options.dedupeScope||this.config.dedupeScope,s=e==="visible"?this.visible:e==="queue"?this.queue:[...this.visible,...this.queue],i=this.getDedupeKey(t);return s.find(o=>this.getDedupeKey(o)===i)}getDedupeKey(t){return t.options.dedupeKey||`${t.options.level||"info"}:${t.options.title||""}:${t.options.message||""}:${t.options.description||""}`}sortQueue(){this.queue.sort((t,e)=>{const s=(e.options.priority||0)-(t.options.priority||0);return s!==0?s:t.createdAt-e.createdAt})}get maxVisible(){return Math.max(1,this.config.visibleToasts||this.config.maxVisible||1)}normalizeConfig(t){return{...t,maxVisible:t.visibleToasts||t.maxVisible}}}const N=new Set(["a","b","strong","i","em","u","s","del","ins","mark","small","sub","sup","code","kbd","br","span","p","ul","ol","li"]),F=new Set(["script","style","iframe","frame","frameset","object","embed","applet","noscript","template","svg","math","form","input","button","textarea","select","option","head","title","link","meta","base","audio","video","canvas"]),I=/^(?:https?:|mailto:|tel:)/i;function Y(c){const t=c.replace(/[\u0000- \u007f-\u009f]/g,"");return t?I.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t):!1}function O(c,t,e){for(const s of Array.from(c.childNodes)){if(s.nodeType===Node.TEXT_NODE){t.appendChild(e.createTextNode(s.textContent||""));continue}if(s.nodeType!==Node.ELEMENT_NODE)continue;const i=s,o=i.localName.toLowerCase();if(F.has(o))continue;if(!N.has(o)){O(i,t,e);continue}const r=e.createElement(o);if(o==="a"){const n=i.getAttribute("href");n&&Y(n)&&(r.setAttribute("href",n.trim()),/^(?:https?:)?\/\//i.test(n.trim())&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer")));const a=i.getAttribute("title");a&&r.setAttribute("title",a)}O(i,r,e),t.appendChild(r)}}function V(c,t){const e=document.createElement("template");e.innerHTML=t;const s=document.createDocumentFragment();O(e.content,s,document),c.textContent="",c.appendChild(s)}class X{constructor(t={}){var e,s,i,o;this.config={stiffness:(e=t.stiffness)!=null?e:100,damping:(s=t.damping)!=null?s:10,mass:(i=t.mass)!=null?i:1,precision:(o=t.precision)!=null?o:.01}}animate(t,e,s,i,o){const r={...this.config,...o};let n,a=!1;const l=Object.keys(e).reduce((h,T)=>(h[T]=e[T].from,h),{}),d=Object.keys(e).reduce((h,T)=>(h[T]=0,h),{}),f=()=>{if(a)return;let h=!0;Object.keys(e).forEach(w=>{const P=e[w].to,$=l[w],p=d[w],y=-r.stiffness*($-P),m=-r.damping*p,x=(y+m)/r.mass;d[w]+=x*.016,l[w]+=d[w]*.016,(Math.abs($-P)>r.precision||Math.abs(p)>r.precision)&&(h=!1)});const T=Object.keys(l).reduce((w,P)=>{const $=e[P].unit||"px";return w[P]=`${l[P]}${$}`,w},{});s(T),h?(a=!0,i==null||i()):n=requestAnimationFrame(f)};return n=requestAnimationFrame(f),()=>{a=!0,n&&cancelAnimationFrame(n)}}}class j{constructor(){this.springAnimation=new X}async showToast(t,e,s){switch(s.type){case"spring":await this.animateSpringShow(t,s);break;case"bounce":await this.animateBounceShow(t,s);break;case"slide":await this.animateSlideShow(t,s);break;case"zoom":await this.animateZoomShow(t,s);break;case"flip":await this.animateFlipShow(t,s);break;case"fade":await this.animateFadeShow(t,s);break;case"elastic":await this.animateElasticShow(t,s);break;case"rotate":await this.animateRotateShow(t,s);break;case"custom":s.show?await Promise.resolve(s.show(t,e)):await this.animateCssShow(t);break;default:await this.animateCssShow(t);break}}async hideToast(t,e,s){switch(s.type){case"spring":await this.animateSpringHide(t,s);break;case"bounce":await this.animateBounceHide(t,s);break;case"slide":await this.animateSlideHide(t,s);break;case"zoom":await this.animateZoomHide(t,s);break;case"flip":await this.animateFlipHide(t,s);break;case"fade":await this.animateFadeHide(t,s);break;case"elastic":await this.animateElasticHide(t,s);break;case"rotate":await this.animateRotateHide(t,s);break;case"custom":s.hide?await Promise.resolve(s.hide(t,e)):await this.animateCssHide(t);break;default:await this.animateCssHide(t);break}}async updateToast(t,e,s,i){i.type==="custom"&&i.update&&await Promise.resolve(i.update(t,e,s))}animateCssShow(t){return new Promise(e=>{requestAnimationFrame(()=>{t.classList.add("show"),window.setTimeout(e,220)})})}animateCssHide(t){return new Promise(e=>{t.classList.remove("show"),t.classList.add("hiding"),window.setTimeout(e,220)})}async animateSpringShow(t,e){return new Promise(s=>{var r,n,a;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const o=((r=t.parentElement)==null?void 0:r.classList.contains("editora-toast-bottom-right"))||((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-left"))||((a=t.parentElement)==null?void 0:a.classList.contains("editora-toast-bottom-center"))?20:-20;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`translateY(${o}px) scale(0.95)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition","opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)","important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},800)},16)})}async animateSpringHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important"),setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform","translateY(-10px) scale(0.95)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateBounceShow(t,e){return new Promise(s=>{var d,f,h;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-center")),o=e.direction||(i?"up":"down"),r=e.intensity||"normal",n=e.duration||800,a=r==="gentle"?.05:r==="strong"?.15:.1,l=o==="up"?30:o==="down"?-30:o==="left"?30:-30;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o==="left"||o==="right"?`translateX(${l}px) scale(${1-a})`:`translateY(${l}px) scale(${1-a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateBounceHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",o=i==="gentle"?.05:i==="strong"?.15:.1;setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1-o})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateSlideShow(t,e){return new Promise(s=>{var d,f,h;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-center")),o=e.direction||(i?"up":"down"),r=e.distance||100,n=e.easing||"ease-out",a=e.duration||400,l=o==="up"?`translateY(${r}px)`:o==="down"?`translateY(-${r}px)`:o==="left"?`translateX(${r}px)`:`translateX(-${r}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",l,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ${n}, transform ${a}ms ${n}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},a)},16)})}async animateSlideHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"down",o=e.distance||100,r=e.easing||"ease-in",n=e.duration||300,a=i==="up"?`translateY(-${o}px)`:i==="down"?`translateY(${o}px)`:i==="left"?`translateX(-${o}px)`:`translateX(${o}px)`;setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${r}, transform ${n}ms ${r}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",a,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateZoomShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,o=e.origin||"center",r=e.easing||"ease-out",n=e.duration||500;t.style.setProperty("transform-origin",o,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${r}, transform ${n}ms ${r}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateZoomHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.scale||.3,o=e.origin||"center",r=e.easing||"ease-in",n=e.duration||300;t.style.setProperty("transform-origin",o,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ${r}, transform ${n}ms ${r}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${i})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateFlipShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",o=e.perspective||1e3,r=e.direction||"forward",n=e.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${o}px`,"important");const a=r==="forward"?i==="x"?-90:90:i==="x"?90:-90;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${a}deg)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotateX(0deg) rotateY(0deg)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},n)},16)})}async animateFlipHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.axis||"y",o=e.perspective||1e3,r=e.direction||"backward",n=e.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${o}px`,"important");const a=r==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate${i.toUpperCase()}(${a}deg)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-style","","important"),t.parentElement.style.setProperty("perspective","","important"),s()},n)},16)})}async animateFadeShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",o=e.distance||20,r=e.duration||300;let n="translateY(0) translateX(0)";i!=="none"&&(n=i==="up"?`translateY(${o}px)`:i==="down"?`translateY(-${o}px)`:i==="left"?`translateX(${o}px)`:`translateX(-${o}px)`),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",n,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${r}ms ease, transform ${r}ms ease`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},r)},16)})}async animateFadeHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.direction||"none",o=e.distance||20,r=e.duration||200;let n="translateY(0) translateX(0)";i!=="none"&&(n=i==="up"?`translateY(-${o}px)`:i==="down"?`translateY(${o}px)`:i==="left"?`translateX(-${o}px)`:`translateX(${o}px)`),setTimeout(()=>{t.style.setProperty("transition",`opacity ${r}ms ease, transform ${r}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",n,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},r)},16)})}async animateElasticShow(t,e){return new Promise(s=>{var d,f,h;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((d=t.parentElement)==null?void 0:d.classList.contains("editora-toast-bottom-right"))||((f=t.parentElement)==null?void 0:f.classList.contains("editora-toast-bottom-left"))||((h=t.parentElement)==null?void 0:h.classList.contains("editora-toast-bottom-center")),o=e.direction||(i?"up":"down"),r=e.intensity||"normal",n=e.duration||1e3,a=r==="gentle"?.1:r==="strong"?.3:.2,l=o==="up"?40:o==="down"?-40:o==="left"?40:-40;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o==="left"||o==="right"?`translateX(${l}px) scale(${1+a})`:`translateY(${l}px) scale(${1+a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateElasticHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.intensity||"normal",o=i==="gentle"?.1:i==="strong"?.3:.2;e.duration,setTimeout(()=>{t.style.setProperty("transition","opacity 0.4s ease, transform 0.4s ease","important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`scale(${1+o})`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},400)},16)})}async animateRotateShow(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||360,o=e.direction||"clockwise",r=e.origin||"center",n=e.duration||500,a=o==="clockwise"?i:-i;t.style.setProperty("transform-origin",r,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${a}deg) scale(0.8)`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","rotate(0deg) scale(1)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}async animateRotateHide(t,e){return new Promise(s=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=e.degrees||180,o=e.direction||"counterclockwise",r=e.origin||"center",n=e.duration||300,a=o==="clockwise"?i:-i;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}ms ease-in`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",`rotate(${a}deg) scale(0.8)`,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),t.style.setProperty("transform-origin","","important"),s()},n)},16)})}}const q=new j;class W{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}updateConfig(t){this.config=t,this.containers.forEach((e,s)=>{this.applyContainerStyles(e,s),this.applyStackState(e)})}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const e=document.createElement("div");return e.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,e.setAttribute("role","region"),e.setAttribute("aria-label","Toast notifications"),e.setAttribute("aria-live","polite"),e.dataset.expand=String(this.config.expand),e.dataset.stack=String(this.config.stack),this.applyContainerStyles(e,t),document.body.appendChild(e),this.containers.set(t,e),this.injectCSS(),e}createToastElement(t){const e=t.options,s=document.createElement("div");s.className=`editora-toast editora-toast-${e.level||"info"}`,s.dataset.level=e.level||"info",e.customClass&&e.customClass.split(/\s+/).filter(Boolean).forEach(n=>s.classList.add(n)),s.setAttribute("role",e.role||(e.level==="error"?"alert":"status")),s.setAttribute("aria-atomic","true"),e.ariaLive&&e.ariaLive!=="off"&&s.setAttribute("aria-live",e.ariaLive);const i=e.theme||this.config.theme;i&&i!=="system"&&s.setAttribute("data-theme",i),(this.config.richColors||i==="colored")&&s.setAttribute("data-rich-colors","true"),(e.rtl!==void 0?e.rtl:this.config.rtl)&&(s.setAttribute("data-rtl","true"),s.setAttribute("dir","rtl"));const r=this.createContent(t);if(e.progress){const n=document.createElement("div");n.className="editora-toast-progress-track",n.setAttribute("role","progressbar"),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax","100"),n.setAttribute("aria-valuenow",String(Math.min(100,Math.max(0,e.progress.value))));const a=document.createElement("div");if(a.className="editora-toast-progress-bar",a.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`,e.progress.showPercentage){const l=document.createElement("span");l.className="editora-toast-progress-text",l.textContent=`${Math.round(e.progress.value)}%`,n.appendChild(l)}n.appendChild(a),r.appendChild(n)}if(s.appendChild(r),e.actions&&e.actions.length>0){const n=document.createElement("div");n.className="editora-toast-actions",e.actions.forEach(a=>n.appendChild(this.createActionButton(a,t))),s.appendChild(n)}return(e.closable||e.closeButton)&&s.appendChild(this.createCloseButton(t)),e.pauseOnHover&&(s.addEventListener("mouseenter",()=>this.pauseToast(t)),s.addEventListener("mouseleave",()=>this.resumeToast(t))),e.pauseOnFocus&&(s.addEventListener("focusin",()=>this.pauseToast(t)),s.addEventListener("focusout",()=>this.resumeToast(t))),e.swipeDismiss&&this.addSwipeDismiss(s,t),e.dragDismiss&&this.addDragDismiss(s,t),s}async showToast(t){var o,r;const e=this.ensureContainer(t.options.position||this.config.position),s=this.createToastElement(t);t.element=s,e.appendChild(s),this.applyStackState(e);const i=t.options.animation||this.config.animation||{type:"css"};if(await q.showToast(s,t,i),this.config.enableAccessibility&&this.announceToast(t),(r=(o=t.options).onShow)==null||r.call(o),!t.options.persistent&&t.options.duration!==0){const n=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},n)}}async hideToast(t){var s,i;if(!t.element)return;t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0);const e=t.options.animation||this.config.animation||{type:"css"};if(await q.hideToast(t.element,t,e),t.element&&t.element.parentNode){const o=t.element.parentElement;t.element.parentNode.removeChild(t.element),t.element=void 0,o&&this.applyStackState(o)}(i=(s=t.options).onHide)==null||i.call(s)}async updateToast(t,e){var o,r,n;if(!t.element)return;const s=t.options.animation||this.config.animation||{type:"css"};if(s.type==="custom"&&s.update){await q.updateToast(t.element,t,e,s);return}if(Object.assign(t.options,e),e.level&&(t.element.className=t.element.className.replace(/editora-toast-(info|success|error|warning|loading|progress|promise|custom)/g,""),t.element.classList.add(`editora-toast-${e.level}`),t.element.dataset.level=e.level),e.title!==void 0||e.description!==void 0||e.message!==void 0||e.icon!==void 0||e.render){const a=t.element.querySelector(".editora-toast-content"),l=this.createContent(t);a==null||a.replaceWith(l)}const i=(o=e.closeButton)!=null?o:e.closable;if(i!==void 0){t.options.closable=i,t.options.closeButton=i;const a=t.element.querySelector(".editora-toast-close");i&&!a?t.element.appendChild(this.createCloseButton(t)):!i&&a&&a.remove()}if(e.progress!==void 0){let a=t.element.querySelector(".editora-toast-progress-track");if(e.progress){if(!a){a=document.createElement("div"),a.className="editora-toast-progress-track",a.setAttribute("role","progressbar"),a.setAttribute("aria-valuemin","0"),a.setAttribute("aria-valuemax","100");const d=t.element.querySelector(".editora-toast-content");d&&d.appendChild(a)}a.setAttribute("aria-valuenow",String(Math.min(100,Math.max(0,e.progress.value))));const l=a.querySelector(".editora-toast-progress-bar");if(l&&(l.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`),e.progress.showPercentage){let d=a.querySelector(".editora-toast-progress-text");d||(d=document.createElement("span"),d.className="editora-toast-progress-text",a.insertBefore(d,a.firstChild)),d.textContent=`${Math.round(e.progress.value)}%`}else{const d=a.querySelector(".editora-toast-progress-text");d&&d.remove()}}else a&&a.remove()}if(e.actions!==void 0||e.action!==void 0||e.cancel!==void 0){let a=t.element.querySelector(".editora-toast-actions");const l=t.options.actions||[];l.length>0?(a?a.innerHTML="":(a=document.createElement("div"),a.className="editora-toast-actions",t.element.appendChild(a)),a&&l.forEach(d=>a.appendChild(this.createActionButton(d,t)))):a&&a.remove()}if((e.duration!==void 0||e.persistent!==void 0||e.level!==void 0)&&(t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),!t.options.persistent&&t.options.duration!==0)){const a=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},a)}(n=(r=t.options).onUpdate)==null||n.call(r,e)}createContent(t){const e=t.options,s=document.createElement("div");if(s.className="editora-toast-content",e.icon){const o=document.createElement("span");o.className="editora-toast-icon",o.setAttribute("aria-hidden","true"),o.textContent=e.icon,s.appendChild(o)}const i=document.createElement("div");if(i.className="editora-toast-body",e.render)i.appendChild(e.render(t));else{if(e.title){const o=document.createElement("div");o.className="editora-toast-title",o.textContent=e.title,i.appendChild(o)}if(e.message){const o=document.createElement("div");o.className="editora-toast-message",e.html?V(o,e.message):o.textContent=e.message,i.appendChild(o)}if(e.description){const o=document.createElement("div");o.className="editora-toast-description",o.textContent=e.description,i.appendChild(o)}}return s.appendChild(i),s}createCloseButton(t){const e=document.createElement("button");return e.className="editora-toast-close",e.setAttribute("type","button"),e.setAttribute("aria-label","Close notification"),e.textContent="×",e.onclick=()=>t.dismiss(),e}createActionButton(t,e){const s=document.createElement("button");return s.className=`editora-toast-action ${t.primary?"primary":""}`,s.textContent=t.label,t.altText&&s.setAttribute("aria-label",t.altText),s.onclick=i=>{i.stopPropagation(),t.onClick(),t.dismissOnClick!==!1&&e.dismiss()},s}applyContainerStyles(t,e){const s=this.toCssLength(this.config.offset),i=this.toCssLength(this.config.mobileOffset),o=this.toCssLength(this.config.gap);t.dataset.position=e,t.dataset.expand=String(this.config.expand),t.dataset.stack=String(this.config.stack),t.style.setProperty("--editora-toast-offset",s),t.style.setProperty("--editora-toast-mobile-offset",i),t.style.setProperty("--editora-toast-gap",o);const r={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:e.startsWith("top")?"column":"column-reverse",gap:o,pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box",top:"",right:"",bottom:"",left:"",transform:"",alignItems:e.includes("center")?"center":"stretch"};switch(e){case"top-left":r.top=`max(${s}, env(safe-area-inset-top))`,r.left=`max(${s}, env(safe-area-inset-left))`;break;case"top-center":r.top=`max(${s}, env(safe-area-inset-top))`,r.left="50%",r.transform="translateX(-50%)";break;case"top-right":r.top=`max(${s}, env(safe-area-inset-top))`,r.right=`max(${s}, env(safe-area-inset-right))`;break;case"bottom-left":r.bottom=`max(${s}, env(safe-area-inset-bottom))`,r.left=`max(${s}, env(safe-area-inset-left))`;break;case"bottom-center":r.bottom=`max(${s}, env(safe-area-inset-bottom))`,r.left="50%",r.transform="translateX(-50%)";break;case"bottom-right":r.bottom=`max(${s}, env(safe-area-inset-bottom))`,r.right=`max(${s}, env(safe-area-inset-right))`;break;case"center":r.top="50%",r.left="50%",r.transform="translate(-50%, -50%)",r.alignItems="center";break}Object.assign(t.style,r),t.style.setProperty("--editora-toast-mobile-left",i)}applyStackState(t){const e=Array.from(t.querySelectorAll(".editora-toast"));e.forEach((s,i)=>{const o=e.length-i-1;s.dataset.index=String(i),s.dataset.front=String(o===0),s.style.setProperty("--editora-toast-index",String(i)),s.style.setProperty("--editora-toast-before",String(o))})}toCssLength(t){return typeof t=="number"?`${t}px`:t||"16px"}pauseToast(t){t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0)}resumeToast(t){if(!t.options.persistent&&t.options.duration!==0){const e=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{t.dismiss()},e)}}addSwipeDismiss(t,e){let s=0,i=0,o=!1;const r=e.options.swipeDirection||this.config.swipeDirection||"any",n=40;let a="",l=!1;const d='button, a[href], input, select, textarea, label, summary, [role="button"], [contenteditable="true"]',f=()=>{t.style.transform=a,t.style.transition="",t.style.cursor="",t.style.userSelect=""},h=(p,y)=>{if("changedTouches"in p||"touches"in p){const m=y?p.changedTouches:p.touches,g=m&&m[0];return g?{x:g.clientX,y:g.clientY}:null}return{x:p.clientX,y:p.clientY}},T=p=>{const y=p.target;if(y instanceof Element&&t.contains(y)&&y.closest(d)||"button"in p&&p.button!==0)return;const m=h(p,!1);m&&(o=!0,l=!1,s=m.x,i=m.y,a=t.style.transform||"")},w=p=>{var b,B;if(!o)return;const y=h(p,!1);if(!y)return;const m=y.x-s,g=y.y-i,x=5;if(!l&&(Math.abs(m)>x||Math.abs(g)>x)&&(l=!0,t.style.transition="none",t.style.cursor="grabbing",t.style.userSelect="none",(B=(b=window.getSelection)==null?void 0:b.call(window))==null||B.removeAllRanges()),l){const S=Math.abs(g)>Math.abs(m)?25:20,U=Math.min(Math.max(m*.2,-S),S),_=Math.min(Math.max(g*.2,-S),S);t.style.transform=`${a} translate(${U}px, ${_}px)`,p.cancelable&&p.preventDefault()}},P=p=>{if(!o)return;o=!1;const y=l;if(f(),!y)return;const m=h(p,!0);if(!m)return;const g=m.x-s,x=m.y-i;let b=!1;const S=r==="vertical"||r==="up"||r==="down"?35:n;switch(r){case"any":b=Math.abs(g)>n||Math.abs(x)>n;break;case"horizontal":b=Math.abs(g)>n;break;case"vertical":b=Math.abs(x)>S;break;case"left":b=g<-n;break;case"right":b=g>n;break;case"up":b=x<-S;break;case"down":b=x>S;break}b&&e.dismiss()},$=()=>{o&&(o=!1,l=!1,f())};t.addEventListener("dragstart",p=>p.preventDefault()),t.addEventListener("touchstart",T,{passive:!0}),t.addEventListener("touchmove",w,{passive:!1}),t.addEventListener("touchend",P),t.addEventListener("touchcancel",$),t.addEventListener("mousedown",T),t.addEventListener("mousemove",w),t.addEventListener("mouseup",P),t.addEventListener("mouseleave",P)}addDragDismiss(t,e){this.addSwipeDismiss(t,e)}announceToast(t){if(t.options.ariaLive==="off")return;const e=document.createElement("div");e.setAttribute("aria-live",t.options.ariaLive||(t.options.level==="error"?"assertive":"polite")),e.setAttribute("aria-atomic","true"),e.style.position="absolute",e.style.left="-10000px",e.style.width="1px",e.style.height="1px",e.style.overflow="hidden";const s=[t.options.title,t.options.message,t.options.description].filter(Boolean).join(". ");e.textContent=`${t.options.level||"info"}: ${s}`,document.body.appendChild(e),setTimeout(()=>{e.remove()},1e3)}injectCSS(){if(this.cssInjected||typeof document=="undefined")return;if(!Array.from(document.styleSheets).find(e=>{var s,i,o,r;return((i=(s=e.ownerNode)==null?void 0:s.href)==null?void 0:i.includes("toast.css"))||((r=(o=e.ownerNode)==null?void 0:o.textContent)==null?void 0:r.includes("editora-toast"))})){const e=document.createElement("style");e.setAttribute("data-editora-toast-fallback","true"),e.textContent=".editora-toast{box-sizing:border-box;pointer-events:auto}.editora-toast-container{box-sizing:border-box;pointer-events:none}.editora-toast.show{opacity:1;transform:translateY(0) scale(1)}.editora-toast.hiding{opacity:0}",document.head.appendChild(e)}this.cssInjected=!0}destroy(){this.containers.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.containers.clear()}}class G{constructor(){this.plugins=[],this.hooks={beforeShow:[],afterShow:[],beforeHide:[],afterHide:[],beforeUpdate:[],afterUpdate:[]}}use(t){if(this.plugins.find(e=>e.name===t.name)){console.warn(`Plugin "${t.name}" is already installed`);return}this.plugins.push(t),t.install(this)}remove(t){const e=this.plugins.findIndex(i=>i.name===t);if(e===-1)return!1;const s=this.plugins[e];return s.uninstall&&s.uninstall(this),this.plugins.splice(e,1),!0}getPlugins(){return[...this.plugins]}on(t,e){this.hooks[t]&&this.hooks[t].push(e)}off(t,e){if(this.hooks[t]){const s=this.hooks[t].indexOf(e);s!==-1&&this.hooks[t].splice(s,1)}}async trigger(t,e,...s){const i=this.hooks[t];if(!(!i||i.length===0))for(const o of i)try{await o(e,...s)}catch(r){console.error(`Error in ${t} hook:`,r)}}async beforeShow(t){await this.trigger("beforeShow",t)}async afterShow(t){await this.trigger("afterShow",t)}async beforeHide(t){await this.trigger("beforeHide",t)}async afterHide(t){await this.trigger("afterHide",t)}async beforeUpdate(t,e){await this.trigger("beforeUpdate",t,e)}async afterUpdate(t,e){await this.trigger("afterUpdate",t,e)}onEditorEvent(t,e){const s=`editor:${t}`;this.hooks[s]||(this.hooks[s]=[]),this.hooks[s].push(e)}triggerEditorEvent(t,e,...s){const i=`editor:${t}`;this.trigger(i,e,...s)}async handlePromise(t,e,s,i){e();try{const o=await t;return s(o),o}catch(o){throw i(o),o}}async batchShow(t){const e=t.map(i=>this.beforeShow(i));await Promise.all(e);const s=t.map(i=>this.afterShow(i));await Promise.all(s)}async batchHide(t){const e=t.map(i=>this.beforeHide(i));await Promise.all(e);const s=t.map(i=>this.afterHide(i));await Promise.all(s)}destroy(){this.plugins.forEach(t=>{t.uninstall&&t.uninstall(this)}),this.plugins=[],Object.keys(this.hooks).forEach(t=>{this.hooks[t]=[]})}}const D={position:"bottom-right",duration:4e3,maxVisible:3,queueStrategy:"fifo",theme:"system",richColors:!1,expand:!0,stack:!1,offset:16,mobileOffset:16,gap:8,pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!0,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,closeButton:!1,preventDuplicate:!1,dedupeScope:"all",animation:{type:"css"}};class H{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.pendingShows=new Map,this.subscribers=new Set,this.config=this.normalizeConfig({...D,...t}),this.store=new A(this.config),this.queue=new z(this.config),this.renderer=new W(this.config),this.lifecycle=new G,this.setupWindowFocusHandling()}show(t){const e=t.id||`toast-${++this.idCounter}`,s={id:e,options:this.normalizeToastOptions({...this.config,...t},t),createdAt:Date.now(),dismiss:()=>this.dismiss(e),update:r=>this.update(e,r)},i=this.lifecycle.beforeShow(s).then(async()=>{const r=this.queue.enqueue(s);r.rejected||(this.store.addToast(s),await this.hideToasts(r.hide,!0),await this.showToasts(r.show),this.notify())});this.pendingShows.set(e,i);const o=()=>{this.pendingShows.get(e)===i&&this.pendingShows.delete(e)};return i.then(o,o),s}update(t,e){const s=this.pendingShows.get(t);if(s)return s.then(()=>this.update(t,e),()=>{}),!0;const i=this.store.getToast(t);return i?(this.lifecycle.beforeUpdate(i,e).then(async()=>{const o=this.normalizeToastOptions({...i.options,...e},e);this.store.updateToast(t,{options:o}),this.queue.isVisible(t)&&await this.renderer.updateToast(i,e),this.lifecycle.afterUpdate(i,e),this.notify()}),!0):!1}dismiss(t){const e=this.pendingShows.get(t);if(e)return e.then(()=>this.dismiss(t),()=>{}),!0;const s=this.store.getToast(t);return s?(this.lifecycle.beforeHide(s).then(async()=>{const i=this.queue.isVisible(t),o=this.queue.dequeue(t);i&&await this.renderer.hideToast(s),this.store.removeToast(t),this.lifecycle.afterHide(s),await this.showToasts(o.show),this.notify()}),!0):!1}clear(){const t=this.queue.clear();Promise.all(t.map(e=>this.hideOne(e,!1))).then(()=>{this.store.clear(),this.notify()})}async promise(t,e){var i,o;const s=this.show(this.normalizeOptions(e.loading,"loading"));try{const r=await t,n=this.normalizeOptions(typeof e.success=="function"?e.success(r):e.success,"success");return n.duration===void 0&&!n.persistent&&(n.duration=this.config.duration),this.update(s.id,n),(i=e.onSuccess)==null||i.call(e,r),r}catch(r){const n=this.normalizeOptions(typeof e.error=="function"?e.error(r):e.error,"error");throw n.duration===void 0&&!n.persistent&&(n.duration=this.config.duration),this.update(s.id,n),(o=e.onError)==null||o.call(e,r),r}}group(t,e){return this.show({...e,group:t})}use(t){this.lifecycle.use(t)}configure(t){const e=this.config.pauseOnWindowBlur,s={...this.config,...t};t.maxVisible!==void 0&&t.visibleToasts===void 0&&delete s.visibleToasts,this.config=this.normalizeConfig(s),this.store.updateConfig(this.config),this.renderer.updateConfig(this.config);const i=this.queue.updateConfig(this.config);this.hideToasts(i.hide,!0).then(()=>this.showToasts(i.show)).then(()=>this.notify()),t.pauseOnWindowBlur!==void 0&&t.pauseOnWindowBlur!==e&&(this.teardownWindowFocusHandling(),this.setupWindowFocusHandling())}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}getState(){return{toasts:this.store.getAllToasts(),visible:this.queue.getVisible(),queued:this.queue.getQueued(),groups:this.store.getAllGroups(),config:this.getConfig()}}subscribe(t){return this.subscribers.add(t),t(this.getState()),()=>{this.subscribers.delete(t)}}getGroups(){return this.store.getAllGroups()}info(t,e){return this.show({message:t,level:"info",duration:e})}success(t,e){return this.show({message:t,level:"success",duration:e})}error(t,e){return this.show({message:t,level:"error",duration:e})}warning(t,e){return this.show({message:t,level:"warning",duration:e})}loading(t,e){return this.show({message:t,level:"loading",duration:e})}normalizeOptions(t,e){return typeof t=="string"?{message:t,level:e}:{...t,level:t.level||e}}normalizeConfig(t){const e=t.visibleToasts||t.maxVisible||D.maxVisible;return{...t,maxVisible:e,visibleToasts:e}}normalizeToastOptions(t,e=t){var r,n,a,l,d,f;const s=(l=(a=(n=(r=e.closeButton)!=null?r:e.closable)!=null?n:t.closable)!=null?a:t.closeButton)!=null?l:this.config.closeButton,i=t.action?{...t.action,primary:(d=t.action.primary)!=null?d:!0}:void 0,o=[...i?[i]:[],...t.cancel?[t.cancel]:[],...t.actions||[]];return{...t,closable:s,closeButton:s,actions:o.length>0?o:void 0,ariaLive:t.ariaLive||(t.level==="error"||t.important?"assertive":"polite"),role:t.role||(t.level==="error"||t.important?"alert":"status"),preventDuplicate:(f=t.preventDuplicate)!=null?f:this.config.preventDuplicate,dedupeScope:t.dedupeScope||this.config.dedupeScope}}async showToasts(t){for(const e of t)await this.renderer.showToast(e),await this.lifecycle.afterShow(e)}async hideToasts(t,e){for(const s of t)await this.hideOne(s,e)}async hideOne(t,e){await this.lifecycle.beforeHide(t),await this.renderer.hideToast(t),e&&this.store.removeToast(t.id),await this.lifecycle.afterHide(t)}notify(){if(this.subscribers.size===0)return;const t=this.getState();this.subscribers.forEach(e=>e(t))}onEditorEvent(t,e){this.lifecycle.onEditorEvent(t,e)}triggerEditorEvent(t,e,...s){this.lifecycle.triggerEditorEvent(t,e,...s)}setupWindowFocusHandling(){typeof window=="undefined"||typeof document=="undefined"||!this.config.pauseOnWindowBlur||(this.teardownWindowFocusHandling(),this.windowBlurHandler=()=>this.pauseAllToasts(),this.windowFocusHandler=()=>this.resumeAllToasts(),this.visibilityChangeHandler=()=>{document.hidden?this.pauseAllToasts():this.resumeAllToasts()},window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),document.addEventListener("visibilitychange",this.visibilityChangeHandler))}teardownWindowFocusHandling(){typeof window!="undefined"&&(this.windowBlurHandler&&(window.removeEventListener("blur",this.windowBlurHandler),this.windowBlurHandler=void 0),this.windowFocusHandler&&(window.removeEventListener("focus",this.windowFocusHandler),this.windowFocusHandler=void 0),typeof document!="undefined"&&this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0))}pauseAllToasts(){this.store.getAllToasts().forEach(e=>{e.timeoutId&&!this.pausedToasts.has(e.id)&&(clearTimeout(e.timeoutId),e.timeoutId=void 0,this.pausedToasts.add(e.id))})}resumeAllToasts(){this.store.getAllToasts().forEach(e=>{if(this.pausedToasts.has(e.id)&&!e.options.persistent&&e.options.duration!==0){const s=e.options.duration||this.config.duration;e.timeoutId=window.setTimeout(()=>{this.dismiss(e.id)},s),this.pausedToasts.delete(e.id)}})}destroy(){this.teardownWindowFocusHandling(),this.clear(),this.renderer.destroy(),this.lifecycle.destroy()}}let E=null;function u(){return E||(E=new H),E}function k(c){return typeof document=="undefined"?{dismiss:()=>{}}:u().show(c)}function L(c,t,e,s){let i={};t&&typeof t=="object"?i={...t}:typeof t=="number"&&(i.duration=t),e&&(i.theme=e),s&&(i.position=s);const o={message:c,...i,level:i.level||void 0};return i.duration!==void 0&&(o.duration=i.duration),i.position&&(o.position=i.position),i.theme&&(o.theme=i.theme),o}const M={info:(c,t,e,s)=>k({...L(c,t,e,s),level:"info"}),success:(c,t,e,s)=>k({...L(c,t,e,s),level:"success"}),error:(c,t,e,s)=>k({...L(c,t,e,s),level:"error"}),warning:(c,t,e,s)=>k({...L(c,t,e,s),level:"warning"}),loading:(c,t,e,s)=>k({...L(c,t,e,s),level:"loading"})},C={show:c=>u().show(c),update:(c,t)=>u().update(c,t),dismiss:c=>u().dismiss(c),clear:()=>u().clear(),info:(c,t)=>u().show({message:c,level:"info",...t}),success:(c,t)=>u().show({message:c,level:"success",...t}),error:(c,t)=>u().show({message:c,level:"error",...t}),warning:(c,t)=>u().show({message:c,level:"warning",...t}),loading:(c,t)=>u().show({message:c,level:"loading",...t}),promise:(c,t)=>u().promise(c,t),group:(c,t)=>u().group(c,t),configure:c=>u().configure(c),use:c=>u().use(c),getToasts:()=>u().getToasts(),getGroups:()=>u().getGroups(),getConfig:()=>u().getConfig(),getState:()=>u().getState(),subscribe:c=>u().subscribe(c),onEditorEvent:(c,t)=>u().onEditorEvent(c,t),triggerEditorEvent:(c,t,...e)=>u().triggerEditorEvent(c,t,...e),destroy:()=>{E&&(E.destroy(),E=null)}};if(typeof window!="undefined"&&typeof document!="undefined"){const c=window;c.toast=M,c.toastAdvanced=C,c.toastPro=C,c.ToastManager=H,c.__editoraToastReady||(c.__editoraToastReady=!0,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:M,toastAdvanced:C,toastPro:C,ToastManager:H}})))}v.ToastManager=H,v.default=M,v.toast=M,v.toastAdvanced=C,v.toastPro=C,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
2
2
  //# sourceMappingURL=index.umd.js.map
package/dist/toast.css CHANGED
@@ -401,6 +401,14 @@
401
401
  transform: scale(1);
402
402
  }
403
403
 
404
+ /* Touch devices have no hover, so the close button (revealed on hover above) would stay invisible there. */
405
+ @media (hover: none) {
406
+ .editora-toast-close {
407
+ opacity: 1;
408
+ transform: scale(1);
409
+ }
410
+ }
411
+
404
412
  .editora-toast-close:hover {
405
413
  background: var(--et-border);
406
414
  border-color: var(--et-border-strong);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/toast",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Enterprise toast notification library for React and web apps, with SaaS-ready UX patterns, accessibility, and high-performance lifecycle controls.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -63,15 +63,16 @@
63
63
  "access": "public"
64
64
  },
65
65
  "scripts": {
66
- "build": "vite build && vite build --config vite.umd.config.ts && tsc --emitDeclarationOnly --outDir dist",
67
- "postbuild": "cp src/toast.css dist/",
66
+ "build": "vite build && vite build --config vite.umd.config.ts && tsc --emitDeclarationOnly --outDir dist && cp src/toast.css dist/",
68
67
  "dev": "vite build --watch",
69
68
  "clean": "rm -rf dist",
70
- "prepublishOnly": "npm run clean && npm run build"
69
+ "prepublishOnly": "npm run clean && npm run build",
70
+ "test": "vitest run"
71
71
  },
72
72
  "devDependencies": {
73
73
  "typescript": "^5.0.0",
74
- "vite": "^4.5.14"
74
+ "vite": "^7.3.1",
75
+ "vitest": "^1.0.0"
75
76
  },
76
- "gitHead": "e19160591d822f5ecf242658d6db63959371838e"
77
+ "gitHead": "7883627e823aa99dd5ecb66a5201116df972f88b"
77
78
  }