@editora/toast 2.0.0 → 2.0.2
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/CHANGELOG.md +126 -0
- package/README.md +28 -26
- package/dist/core/ToastManager.d.ts +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.esm.js +132 -106
- package/dist/index.umd.js +1 -1
- package/package.json +14 -4
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(b,$){typeof exports=="object"&&typeof module!="undefined"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(b=typeof globalThis!="undefined"?globalThis:b||self,$(b.EditoraToast={}))})(this,function(b){"use strict";class ${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 s=this.toasts.get(t);return s?(this.toasts.delete(t),this.updateGroup(s),!0):!1}getToast(t){return this.toasts.get(t)}getAllToasts(){return Array.from(this.toasts.values())}getToastsByPosition(t){return this.getAllToasts().filter(s=>s.options.position===t)}updateToast(t,s){const e=this.toasts.get(t);return e?(Object.assign(e,s),this.updateGroup(e),!0):!1}updateGroup(t){const s=t.options.group;if(!s)return;let e=this.groups.get(s);e||(e={id:s,toasts:[]},this.groups.set(s,e)),e.toasts=e.toasts.filter(i=>i.id!==t.id),t.options.group===s&&e.toasts.push(t),e.toasts.length===0&&this.groups.delete(s)}getGroup(t){return this.groups.get(t)}getAllGroups(){return Array.from(this.groups.values())}getContainer(t){return this.containers.get(t)}setContainer(t,s){this.containers.set(t,s)}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 L{constructor(t){this.queue=[],this.visible=[],this.config=t}enqueue(t){this.deduplicate(t),this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.queue.sort((s,e)=>(e.options.priority||0)-(s.options.priority||0)),this.processQueue()}dequeue(t){let s=!1;const e=this.queue.findIndex(r=>r.id===t);e!==-1&&(this.queue.splice(e,1),s=!0);const i=this.visible.findIndex(r=>r.id===t);return i!==-1&&(this.visible.splice(i,1),s=!0),s&&this.processQueue(),s}processQueue(){const t=this.config.maxVisible;for(;this.visible.length>t;){const s=this.visible.pop();this.hideToast(s)}for(;this.visible.length<t&&this.queue.length>0;){const s=this.queue.shift();this.showToast(s)}}showToast(t){this.visible.push(t)}hideToast(t){}deduplicate(t){this.queue.filter(e=>e.options.message===t.options.message&&e.options.level===t.options.level).forEach(e=>{const i=this.queue.indexOf(e);i!==-1&&this.queue.splice(i,1)})}updateConfig(t){this.config={...this.config,...t},this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}clear(){const t=[...this.visible,...this.queue];this.queue=[],this.visible=[],t.forEach(s=>{s.element&&this.hideToast(s)})}forceShow(t){if(this.visible.length>=this.config.maxVisible){const s=this.visible.reduce((e,i)=>(i.options.priority||0)<(e.options.priority||0)?i:e);this.dequeue(s.id)}this.showToast(t)}}class M{constructor(t={}){var s,e,i,r;this.config={stiffness:(s=t.stiffness)!=null?s:100,damping:(e=t.damping)!=null?e:10,mass:(i=t.mass)!=null?i:1,precision:(r=t.precision)!=null?r:.01}}animate(t,s,e,i,r){const n={...this.config,...r};let o,a=!1;const p=Object.keys(s).reduce((u,l)=>(u[l]=s[l].from,u),{}),d=Object.keys(s).reduce((u,l)=>(u[l]=0,u),{}),m=()=>{if(a)return;let u=!0;Object.keys(s).forEach(g=>{const v=s[g].to,y=p[g],w=d[g],f=-n.stiffness*(y-v),P=-n.damping*w,H=(f+P)/n.mass;d[g]+=H*.016,p[g]+=d[g]*.016,(Math.abs(y-v)>n.precision||Math.abs(w)>n.precision)&&(u=!1)});const l=Object.keys(p).reduce((g,v)=>{const y=s[v].unit||"px";return g[v]=`${p[v]}${y}`,g},{});e(l),u?(a=!0,i==null||i()):o=requestAnimationFrame(m)};return o=requestAnimationFrame(m),()=>{a=!0,o&&cancelAnimationFrame(o)}}}class A{constructor(){this.springAnimation=new M}async showToast(t,s,e){switch(e.type){case"spring":await this.animateSpringShow(t,e);break;case"bounce":await this.animateBounceShow(t,e);break;case"slide":await this.animateSlideShow(t,e);break;case"zoom":await this.animateZoomShow(t,e);break;case"flip":await this.animateFlipShow(t,e);break;case"fade":await this.animateFadeShow(t,e);break;case"elastic":await this.animateElasticShow(t,e);break;case"rotate":await this.animateRotateShow(t,e);break;case"custom":e.show?await Promise.resolve(e.show(t,s)):this.animateCssShow(t);break;case"css":default:this.animateCssShow(t);break}}async hideToast(t,s,e){switch(e.type){case"spring":await this.animateSpringHide(t,e);break;case"bounce":await this.animateBounceHide(t,e);break;case"slide":await this.animateSlideHide(t,e);break;case"zoom":await this.animateZoomHide(t,e);break;case"flip":await this.animateFlipHide(t,e);break;case"fade":await this.animateFadeHide(t,e);break;case"elastic":await this.animateElasticHide(t,e);break;case"rotate":await this.animateRotateHide(t,e);break;case"custom":e.hide?await Promise.resolve(e.hide(t,s)):this.animateCssHide(t);break;case"css":default:this.animateCssHide(t);break}}async updateToast(t,s,e,i){i.type==="custom"&&i.update&&await Promise.resolve(i.update(t,s,e))}animateCssShow(t){requestAnimationFrame(()=>{t.classList.add("show")})}animateCssHide(t){t.classList.remove("show"),t.classList.add("hiding")}async animateSpringShow(t,s){return new Promise(e=>{var n,o,a;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const r=((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-right"))||((o=t.parentElement)==null?void 0:o.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(${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"),e()},800)},16)})}async animateSpringHide(t,s){return new Promise(e=>{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"),e()},400)},16)})}async animateBounceShow(t,s){return new Promise(e=>{var d,m,u;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"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),n=s.intensity||"normal",o=s.duration||800,a=n==="gentle"?.05:n==="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-a})`:`translateY(${p}px) scale(${1-a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}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"),e()},o)},16)})}async animateBounceHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.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"),e()},400)},16)})}async animateSlideShow(t,s){return new Promise(e=>{var d,m,u;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"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),n=s.distance||100,o=s.easing||"ease-out",a=s.duration||400,p=r==="up"?`translateY(${n}px)`:r==="down"?`translateY(-${n}px)`:r==="left"?`translateX(${n}px)`:`translateX(-${n}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",p,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ${o}, transform ${a}ms ${o}`,"important"),t.style.setProperty("opacity","1","important"),t.style.setProperty("transform","translateY(0) translateX(0)","important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},a)},16)})}async animateSlideHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"down",r=s.distance||100,n=s.easing||"ease-in",o=s.duration||300,a=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 ${n}, transform ${o}ms ${n}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",a,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},o)},16)})}async animateZoomShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.scale||.3,r=s.origin||"center",n=s.easing||"ease-out",o=s.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 ${o}ms ${n}, transform ${o}ms ${n}`,"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"),e()},o)},16)})}async animateZoomHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.scale||.3,r=s.origin||"center",n=s.easing||"ease-in",o=s.duration||300;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${n}, transform ${o}ms ${n}`,"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"),e()},o)},16)})}async animateFlipShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.axis||"y",r=s.perspective||1e3,n=s.direction||"forward",o=s.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="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 ${o}ms ease, transform ${o}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"),e()},o)},16)})}async animateFlipHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.axis||"y",r=s.perspective||1e3,n=s.direction||"backward",o=s.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}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"),e()},o)},16)})}async animateFadeShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"none",r=s.distance||20,n=s.duration||300;let o="translateY(0) translateX(0)";i!=="none"&&(o=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",o,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}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"),e()},n)},16)})}async animateFadeHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.direction||"none",r=s.distance||20,n=s.duration||200;let o="translateY(0) translateX(0)";i!=="none"&&(o=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 ease, transform ${n}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),e()},n)},16)})}async animateElasticShow(t,s){return new Promise(e=>{var d,m,u;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"))||((m=t.parentElement)==null?void 0:m.classList.contains("editora-toast-bottom-left"))||((u=t.parentElement)==null?void 0:u.classList.contains("editora-toast-bottom-center")),r=s.direction||(i?"up":"down"),n=s.intensity||"normal",o=s.duration||1e3,a=n==="gentle"?.1:n==="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+a})`:`translateY(${p}px) scale(${1+a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}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"),e()},o)},16)})}async animateElasticHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.intensity||"normal",r=i==="gentle"?.1:i==="strong"?.3:.2;s.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"),e()},400)},16)})}async animateRotateShow(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.degrees||360,r=s.direction||"clockwise",n=s.origin||"center",o=s.duration||500,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"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 ${o}ms ease, transform ${o}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"),e()},o)},16)})}async animateRotateHide(t,s){return new Promise(e=>{t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=s.degrees||180,r=s.direction||"counterclockwise",n=s.origin||"center",o=s.duration||300,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}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"),e()},o)},16)})}}const C=new A;class q{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const s=document.createElement("div");s.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,s.setAttribute("role","region"),s.setAttribute("aria-label","Toast notifications"),s.setAttribute("aria-live","polite");const e={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box"};switch(t){case"top-left":e.top="16px",e.left="16px";break;case"top-right":e.top="16px",e.right="16px";break;case"bottom-left":e.bottom="16px",e.left="16px";break;case"bottom-right":e.bottom="16px",e.right="16px";break;case"center":e.top="50%",e.left="50%",e.transform="translate(-50%, -50%)",e.alignItems="center";break}return Object.assign(s.style,e),document.body.appendChild(s),this.containers.set(t,s),this.injectCSS(),s}createToastElement(t){const s=t.options,e=document.createElement("div");e.className=`editora-toast editora-toast-${s.level||"info"}`,s.customClass&&e.classList.add(s.customClass),e.setAttribute("role","alert"),e.setAttribute("aria-atomic","true");const i=s.theme||this.config.theme;i&&i!=="system"&&e.setAttribute("data-theme",i),(s.rtl!==void 0?s.rtl:this.config.rtl)&&(e.setAttribute("data-rtl","true"),e.setAttribute("dir","rtl"));const n=document.createElement("div");if(n.className="editora-toast-content",s.icon){const a=document.createElement("span");a.className="editora-toast-icon",a.textContent=s.icon,n.appendChild(a)}const o=document.createElement("span");if(o.className="editora-toast-message",s.html&&s.message)o.innerHTML=this.sanitizeHTML(s.message);else if(s.render){const a=s.render();o.appendChild(a)}else o.textContent=s.message||"";if(n.appendChild(o),s.progress){const a=document.createElement("div");a.className="editora-toast-progress";const p=document.createElement("div");if(p.className="editora-toast-progress-bar",p.style.width=`${Math.min(100,Math.max(0,s.progress.value))}%`,s.progress.showPercentage){const d=document.createElement("span");d.className="editora-toast-progress-text",d.textContent=`${Math.round(s.progress.value)}%`,a.appendChild(d)}a.appendChild(p),n.appendChild(a)}if(e.appendChild(n),s.actions&&s.actions.length>0){const a=document.createElement("div");a.className="editora-toast-actions",s.actions.forEach(p=>{const d=document.createElement("button");d.className=`editora-toast-action ${p.primary?"primary":""}`,d.textContent=p.label,d.onclick=m=>{m.stopPropagation(),p.onClick()},a.appendChild(d)}),e.appendChild(a)}if(s.closable!==!1){const a=document.createElement("button");a.className="editora-toast-close",a.setAttribute("aria-label","Close notification"),a.innerHTML="×",a.onclick=()=>t.dismiss(),e.appendChild(a)}return s.pauseOnHover&&(e.addEventListener("mouseenter",()=>this.pauseToast(t)),e.addEventListener("mouseleave",()=>this.resumeToast(t))),s.pauseOnFocus&&(e.addEventListener("focusin",()=>this.pauseToast(t)),e.addEventListener("focusout",()=>this.resumeToast(t))),s.swipeDismiss&&this.addSwipeDismiss(e,t),s.dragDismiss&&this.addDragDismiss(e,t),e}async showToast(t){var r,n;const s=this.ensureContainer(t.options.position||this.config.position),e=this.createToastElement(t);t.element=e,s.appendChild(e);const i=t.options.animation||this.config.animation||{type:"css"};if(await C.showToast(e,t,i),this.config.enableAccessibility&&this.announceToast(t),(n=(r=t.options).onShow)==null||n.call(r),!t.options.persistent&&t.options.duration!==0){const o=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},o)}}async hideToast(t){var e,i;if(!t.element)return;t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0);const s=t.options.animation||this.config.animation||{type:"css"};await C.hideToast(t.element,t,s),t.element&&t.element.parentNode&&(t.element.parentNode.removeChild(t.element),t.element=void 0),(i=(e=t.options).onHide)==null||i.call(e)}async updateToast(t,s){var r,n;if(!t.element)return;const e=t.options.animation||this.config.animation||{type:"css"};if(e.type==="custom"&&e.update){await C.updateToast(t.element,t,s,e);return}Object.assign(t.options,s),s.level&&(t.element.className=t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g,""),t.element.classList.add(`editora-toast--${s.level}`));const i=t.element.querySelector(".editora-toast-message");if(i&&s.message!==void 0)if(t.options.html&&s.message)i.innerHTML=this.sanitizeHTML(s.message);else if(t.options.render){const o=t.element.querySelector(".editora-toast-content");if(o){const a=t.options.render();o.innerHTML="",o.appendChild(a)}}else i.textContent=s.message||"";if(s.progress!==void 0){let o=t.element.querySelector(".editora-toast-progress");if(s.progress){if(!o){o=document.createElement("div"),o.className="editora-toast-progress";const p=t.element.querySelector(".editora-toast-content");p&&p.appendChild(o)}const a=o.querySelector(".editora-toast-progress-bar");if(a&&(a.style.width=`${Math.min(100,Math.max(0,s.progress.value))}%`),s.progress.showPercentage){let p=o.querySelector(".editora-toast-progress-text");p||(p=document.createElement("span"),p.className="editora-toast-progress-text",o.insertBefore(p,o.firstChild)),p.textContent=`${Math.round(s.progress.value)}%`}else{const p=o.querySelector(".editora-toast-progress-text");p&&p.remove()}}else o&&o.remove()}if(s.actions!==void 0){let o=t.element.querySelector(".editora-toast-actions");s.actions&&s.actions.length>0?(o?o.innerHTML="":(o=document.createElement("div"),o.className="editora-toast-actions",t.element.appendChild(o)),o&&s.actions.forEach(a=>{const p=document.createElement("button");p.className=`editora-toast-action ${a.primary?"primary":""}`,p.textContent=a.label,p.onclick=d=>{d.stopPropagation(),a.onClick()},o.appendChild(p)})):o&&o.remove()}(n=(r=t.options).onUpdate)==null||n.call(r,s)}pauseToast(t){t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0)}resumeToast(t){if(!t.options.persistent&&t.options.duration!==0){const s=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},s)}}addSwipeDismiss(t,s){let e=0,i=0,r=!1;const n=s.options.swipeDirection||this.config.swipeDirection||"any",o=40;let a="",p=!1;const d=l=>{r=!0,p=!1,e="touches"in l?l.touches[0].clientX:l.clientX,i="touches"in l?l.touches[0].clientY:l.clientY,a=t.style.transform||"",t.style.transition="none",t.style.cursor="grabbing",l.preventDefault()},m=l=>{if(!r)return;const g="touches"in l?l.touches[0].clientX:l.clientX,v="touches"in l?l.touches[0].clientY:l.clientY,y=g-e,w=v-i,f=5;if((Math.abs(y)>f||Math.abs(w)>f)&&(p=!0),p){const P=Math.abs(w)>Math.abs(y)?25:20,T=Math.min(Math.max(y*.2,-P),P),H=Math.min(Math.max(w*.2,-P),P);t.style.transform=`${a} translate(${T}px, ${H}px)`}(Math.abs(w)>Math.abs(y)||n==="vertical"||n==="up"||n==="down")&&l.preventDefault()},u=l=>{if(!r)return;if(t.style.transform=a,t.style.transition="",t.style.cursor="",!p){r=!1;return}const g="changedTouches"in l?l.changedTouches[0].clientX:l.clientX,v="changedTouches"in l?l.changedTouches[0].clientY:l.clientY,y=g-e,w=v-i;let f=!1;const P=n==="vertical"||n==="up"||n==="down",T=P?35:o;switch(n){case"any":f=Math.abs(y)>o||Math.abs(w)>o;break;case"horizontal":f=Math.abs(y)>o;break;case"vertical":f=Math.abs(w)>T;break;case"left":f=y<-o;break;case"right":f=y>o;break;case"up":f=w<-T;break;case"down":f=w>T;break}P&&console.log(`Vertical swipe attempt: direction=${n}, deltaY=${w}, effectiveMinDistance=${T}, shouldDismiss=${f}`),f&&s.dismiss(),r=!1};t.addEventListener("dragstart",l=>l.preventDefault()),t.addEventListener("touchstart",d,{passive:!1}),t.addEventListener("touchmove",m,{passive:!1}),t.addEventListener("touchend",u,{passive:!1}),t.addEventListener("mousedown",d),t.addEventListener("mousemove",m),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",u)}addDragDismiss(t,s){this.addSwipeDismiss(t,s)}announceToast(t){const s=document.createElement("div");s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true"),s.style.position="absolute",s.style.left="-10000px",s.style.width="1px",s.style.height="1px",s.style.overflow="hidden",s.textContent=`${t.options.level||"info"}: ${t.options.message}`,document.body.appendChild(s),setTimeout(()=>{document.body.removeChild(s)},1e3)}sanitizeHTML(t){const s=document.createElement("div");return s.textContent=t,s.innerHTML}injectCSS(){if(this.cssInjected||typeof document=="undefined")return;if(!Array.from(document.styleSheets).find(s=>{var e,i,r,n;return((i=(e=s.ownerNode)==null?void 0:e.href)==null?void 0:i.includes("toast.css"))||((n=(r=s.ownerNode)==null?void 0:r.textContent)==null?void 0:n.includes("editora-toast"))})){const s=document.createElement("link");s.rel="stylesheet",s.href="/packages/editora-toast/dist/toast.css",document.head.appendChild(s)}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(s=>s.name===t.name)){console.warn(`Plugin "${t.name}" is already installed`);return}this.plugins.push(t),t.install(this)}remove(t){const s=this.plugins.findIndex(i=>i.name===t);if(s===-1)return!1;const e=this.plugins[s];return e.uninstall&&e.uninstall(this),this.plugins.splice(s,1),!0}getPlugins(){return[...this.plugins]}on(t,s){this.hooks[t]&&this.hooks[t].push(s)}off(t,s){if(this.hooks[t]){const e=this.hooks[t].indexOf(s);e!==-1&&this.hooks[t].splice(e,1)}}async trigger(t,s,...e){const i=this.hooks[t];if(!(!i||i.length===0))for(const r of i)try{await r(s,...e)}catch(n){console.error(`Error in ${t} hook:`,n)}}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,s){await this.trigger("beforeUpdate",t,s)}async afterUpdate(t,s){await this.trigger("afterUpdate",t,s)}onEditorEvent(t,s){const e=`editor:${t}`;this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(s)}triggerEditorEvent(t,s,...e){const i=`editor:${t}`;this.trigger(i,s,...e)}async handlePromise(t,s,e,i){s();try{const r=await t;return e(r),r}catch(r){throw i(r),r}}async batchShow(t){const s=t.map(i=>this.beforeShow(i));await Promise.all(s);const e=t.map(i=>this.afterShow(i));await Promise.all(e)}async batchHide(t){const s=t.map(i=>this.beforeHide(i));await Promise.all(s);const e=t.map(i=>this.afterHide(i));await Promise.all(e)}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:5,queueStrategy:"fifo",theme:"system",pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!1,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,animation:{type:"css"}};class x{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.config={...D,...t},this.store=new $(this.config),this.queue=new L(this.config),this.renderer=new q(this.config),this.lifecycle=new Y,this.setupWindowFocusHandling()}show(t){const s=t.id||`toast-${++this.idCounter}`,e={id:s,options:{...this.config,...t},createdAt:Date.now(),dismiss:()=>this.dismiss(s),update:i=>this.update(s,i)};return this.lifecycle.beforeShow(e).then(async()=>{this.store.addToast(e),this.queue.enqueue(e),await this.renderer.showToast(e),this.lifecycle.afterShow(e)}),e}update(t,s){const e=this.store.getToast(t);return e?(this.lifecycle.beforeUpdate(e,s).then(async()=>{this.store.updateToast(t,{options:{...e.options,...s}}),await this.renderer.updateToast(e,s),this.lifecycle.afterUpdate(e,s)}),!0):!1}dismiss(t){const s=this.store.getToast(t);return s?(this.lifecycle.beforeHide(s).then(async()=>{this.queue.dequeue(t),await this.renderer.hideToast(s),this.store.removeToast(t),this.lifecycle.afterHide(s)}),!0):!1}clear(){const t=this.store.getAllToasts();this.lifecycle.batchHide(t).then(()=>{this.queue.clear(),this.store.clear()})}async promise(t,s){var i,r;const e=this.show(this.normalizeOptions(s.loading,"loading"));try{const n=await t,o=this.normalizeOptions(typeof s.success=="function"?s.success(n):s.success,"success");return this.update(e.id,o),(i=s.onSuccess)==null||i.call(s,n),n}catch(n){const o=this.normalizeOptions(typeof s.error=="function"?s.error(n):s.error,"error");throw this.update(e.id,o),(r=s.onError)==null||r.call(s,n),n}}group(t,s){return this.show({...s,group:t})}use(t){this.lifecycle.use(t)}configure(t){this.config={...this.config,...t},this.store.updateConfig(t),this.queue.updateConfig(t)}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}getGroups(){return this.store.getAllGroups()}info(t,s){return this.show({message:t,level:"info",duration:s})}success(t,s){return this.show({message:t,level:"success",duration:s})}error(t,s){return this.show({message:t,level:"error",duration:s})}warning(t,s){return this.show({message:t,level:"warning",duration:s})}loading(t,s){return this.show({message:t,level:"loading",duration:s})}normalizeOptions(t,s){return typeof t=="string"?{message:t,level:s}:{...t,level:t.level||s}}onEditorEvent(t,s){this.lifecycle.onEditorEvent(t,s)}triggerEditorEvent(t,s,...e){this.lifecycle.triggerEditorEvent(t,s,...e)}setupWindowFocusHandling(){typeof window=="undefined"||!this.config.pauseOnWindowBlur||(this.windowBlurHandler=()=>this.pauseAllToasts(),this.windowFocusHandler=()=>this.resumeAllToasts(),window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),document.addEventListener("visibilitychange",()=>{document.hidden?this.pauseAllToasts():this.resumeAllToasts()}))}pauseAllToasts(){this.store.getAllToasts().forEach(s=>{s.timeoutId&&!this.pausedToasts.has(s.id)&&(clearTimeout(s.timeoutId),s.timeoutId=void 0,this.pausedToasts.add(s.id))})}resumeAllToasts(){this.store.getAllToasts().forEach(s=>{if(this.pausedToasts.has(s.id)&&!s.options.persistent&&s.options.duration!==0){const e=s.options.duration||this.config.duration;s.timeoutId=window.setTimeout(()=>{this.dismiss(s.id)},e),this.pausedToasts.delete(s.id)}})}destroy(){this.windowBlurHandler&&typeof window!="undefined"&&window.removeEventListener("blur",this.windowBlurHandler),this.windowFocusHandler&&typeof window!="undefined"&&window.removeEventListener("focus",this.windowFocusHandler),this.clear(),this.renderer.destroy(),this.lifecycle.destroy()}}const h=new x;function k(c){return typeof document=="undefined"?{dismiss:()=>{}}:h.show(c)}const S={info:(c,t)=>k({message:c,level:"info",duration:t}),success:(c,t)=>k({message:c,level:"success",duration:t}),error:(c,t)=>k({message:c,level:"error",duration:t})},E={show:c=>h.show(c),update:(c,t)=>h.update(c,t),dismiss:c=>h.dismiss(c),clear:()=>h.clear(),info:(c,t)=>h.show({message:c,level:"info",...t}),success:(c,t)=>h.show({message:c,level:"success",...t}),error:(c,t)=>h.show({message:c,level:"error",...t}),warning:(c,t)=>h.show({message:c,level:"warning",...t}),loading:(c,t)=>h.show({message:c,level:"loading",...t}),promise:(c,t)=>h.promise(c,t),group:(c,t)=>h.group(c,t),configure:c=>h.configure(c),use:c=>h.use(c),getToasts:()=>h.getToasts(),getGroups:()=>h.getGroups(),getConfig:()=>h.getConfig(),onEditorEvent:(c,t)=>h.onEditorEvent(c,t),triggerEditorEvent:(c,t,...s)=>h.triggerEditorEvent(c,t,...s),destroy:()=>h.destroy()};typeof window!="undefined"&&typeof document!="undefined"&&(window.toast=S,window.toastAdvanced=E,window.toastPro=E,window.ToastManager=x,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:S,toastAdvanced:E,toastPro:E,ToastManager:x}}))),b.ToastManager=x,b.default=S,b.toast=S,b.toastAdvanced=E,b.toastPro=E,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(b,x){typeof exports=="object"&&typeof module!="undefined"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(b=typeof globalThis!="undefined"?globalThis:b||self,x(b.EditoraToast={}))})(this,function(b){"use strict";class x{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 A{constructor(t){this.queue=[],this.visible=[],this.config=t}enqueue(t){this.deduplicate(t),this.config.queueStrategy==="fifo"?this.queue.push(t):this.queue.unshift(t),this.queue.sort((e,s)=>(s.options.priority||0)-(e.options.priority||0)),this.processQueue()}dequeue(t){let e=!1;const s=this.queue.findIndex(r=>r.id===t);s!==-1&&(this.queue.splice(s,1),e=!0);const i=this.visible.findIndex(r=>r.id===t);return i!==-1&&(this.visible.splice(i,1),e=!0),e&&this.processQueue(),e}processQueue(){const t=this.config.maxVisible;for(;this.visible.length>t;){const e=this.visible.pop();this.hideToast(e)}for(;this.visible.length<t&&this.queue.length>0;){const e=this.queue.shift();this.showToast(e)}}showToast(t){this.visible.push(t)}hideToast(t){}deduplicate(t){this.queue.filter(s=>s.options.message===t.options.message&&s.options.level===t.options.level).forEach(s=>{const i=this.queue.indexOf(s);i!==-1&&this.queue.splice(i,1)})}updateConfig(t){this.config={...this.config,...t},this.processQueue()}getQueued(){return[...this.queue]}getVisible(){return[...this.visible]}getAll(){return[...this.visible,...this.queue]}clear(){const t=[...this.visible,...this.queue];this.queue=[],this.visible=[],t.forEach(e=>{e.element&&this.hideToast(e)})}forceShow(t){if(this.visible.length>=this.config.maxVisible){const e=this.visible.reduce((s,i)=>(i.options.priority||0)<(s.options.priority||0)?i:s);this.dequeue(e.id)}this.showToast(t)}}class q{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 n={...this.config,...r};let o,a=!1;const l=Object.keys(e).reduce((u,d)=>(u[d]=e[d].from,u),{}),p=Object.keys(e).reduce((u,d)=>(u[d]=0,u),{}),f=()=>{if(a)return;let u=!0;Object.keys(e).forEach(g=>{const v=e[g].to,y=l[g],w=p[g],m=-n.stiffness*(y-v),P=-n.damping*w,M=(m+P)/n.mass;p[g]+=M*.016,l[g]+=p[g]*.016,(Math.abs(y-v)>n.precision||Math.abs(w)>n.precision)&&(u=!1)});const d=Object.keys(l).reduce((g,v)=>{const y=e[v].unit||"px";return g[v]=`${l[v]}${y}`,g},{});s(d),u?(a=!0,i==null||i()):o=requestAnimationFrame(f)};return o=requestAnimationFrame(f),()=>{a=!0,o&&cancelAnimationFrame(o)}}}class Y{constructor(){this.springAnimation=new q}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)):this.animateCssShow(t);break;case"css":default: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)):this.animateCssHide(t);break;case"css":default: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){requestAnimationFrame(()=>{t.classList.add("show")})}animateCssHide(t){t.classList.remove("show"),t.classList.add("hiding")}async animateSpringShow(t,e){return new Promise(s=>{var n,o,a;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important"),t.style.setProperty("-webkit-transition","none","important");const r=((n=t.parentElement)==null?void 0:n.classList.contains("editora-toast-bottom-right"))||((o=t.parentElement)==null?void 0:o.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(${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 p,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.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"),n=e.intensity||"normal",o=e.duration||800,a=n==="gentle"?.05:n==="strong"?.15:.1,l=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(${l}px) scale(${1-a})`:`translateY(${l}px) scale(${1-a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}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()},o)},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 p,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.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"),n=e.distance||100,o=e.easing||"ease-out",a=e.duration||400,l=r==="up"?`translateY(${n}px)`:r==="down"?`translateY(-${n}px)`:r==="left"?`translateX(${n}px)`:`translateX(-${n}px)`;t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",l,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${a}ms ${o}, transform ${a}ms ${o}`,"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",r=e.distance||100,n=e.easing||"ease-in",o=e.duration||300,a=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 ${n}, transform ${o}ms ${n}`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",a,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},o)},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",n=e.easing||"ease-out",o=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 ${o}ms ${n}, transform ${o}ms ${n}`,"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()},o)},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",n=e.easing||"ease-in",o=e.duration||300;t.style.setProperty("transform-origin",r,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ${n}, transform ${o}ms ${n}`,"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()},o)},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,n=e.direction||"forward",o=e.duration||600;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="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 ${o}ms ease, transform ${o}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()},o)},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,n=e.direction||"backward",o=e.duration||400;t.style.setProperty("transform-style","preserve-3d","important"),t.parentElement.style.setProperty("perspective",`${r}px`,"important");const a=n==="backward"?i==="x"?-90:90:i==="x"?90:-90;setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}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()},o)},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,n=e.duration||300;let o="translateY(0) translateX(0)";i!=="none"&&(o=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",o,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${n}ms ease, transform ${n}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()},n)},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,n=e.duration||200;let o="translateY(0) translateX(0)";i!=="none"&&(o=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 ease, transform ${n}ms ease`,"important"),t.style.setProperty("opacity","0","important"),t.style.setProperty("transform",o,"important"),setTimeout(()=>{t.style.setProperty("transition","none","important"),s()},n)},16)})}async animateElasticShow(t,e){return new Promise(s=>{var p,f,u;t.classList.add("spring-animation"),t.style.setProperty("transition","none","important");const i=((p=t.parentElement)==null?void 0:p.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"),n=e.intensity||"normal",o=e.duration||1e3,a=n==="gentle"?.1:n==="strong"?.3:.2,l=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(${l}px) scale(${1+a})`:`translateY(${l}px) scale(${1+a})`,"important"),t.offsetHeight,setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}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()},o)},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",n=e.origin||"center",o=e.duration||500,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"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 ${o}ms ease, transform ${o}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()},o)},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",n=e.origin||"center",o=e.duration||300,a=r==="clockwise"?i:-i;t.style.setProperty("transform-origin",n,"important"),setTimeout(()=>{t.style.setProperty("transition",`opacity ${o}ms ease, transform ${o}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()},o)},16)})}}const k=new Y;class F{constructor(t){this.containers=new Map,this.cssInjected=!1,this.config=t}ensureContainer(t){if(this.containers.has(t))return this.containers.get(t);const e=document.createElement("div");e.className=`editora-toast-container editora-toast-${t.replace("-","-")}`,e.setAttribute("role","region"),e.setAttribute("aria-label","Toast notifications"),e.setAttribute("aria-live","polite");const s={position:"fixed",zIndex:(this.config.zIndex||2147483647).toString(),display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"100%",boxSizing:"border-box"};switch(t){case"top-left":s.top="16px",s.left="16px";break;case"top-right":s.top="16px",s.right="16px";break;case"bottom-left":s.bottom="16px",s.left="16px";break;case"bottom-right":s.bottom="16px",s.right="16px";break;case"center":s.top="50%",s.left="50%",s.transform="translate(-50%, -50%)",s.alignItems="center";break}return Object.assign(e.style,s),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"}`,e.customClass&&s.classList.add(e.customClass),s.setAttribute("role","alert"),s.setAttribute("aria-atomic","true");const i=e.theme||this.config.theme;i&&i!=="system"&&s.setAttribute("data-theme",i),(e.rtl!==void 0?e.rtl:this.config.rtl)&&(s.setAttribute("data-rtl","true"),s.setAttribute("dir","rtl"));const n=document.createElement("div");if(n.className="editora-toast-content",e.icon){const a=document.createElement("span");a.className="editora-toast-icon",a.textContent=e.icon,n.appendChild(a)}const o=document.createElement("span");if(o.className="editora-toast-message",e.html&&e.message)o.innerHTML=this.sanitizeHTML(e.message);else if(e.render){const a=e.render();o.appendChild(a)}else o.textContent=e.message||"";if(n.appendChild(o),e.progress){const a=document.createElement("div");a.className="editora-toast-progress";const l=document.createElement("div");if(l.className="editora-toast-progress-bar",l.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)}%`,a.appendChild(p)}a.appendChild(l),n.appendChild(a)}if(s.appendChild(n),e.actions&&e.actions.length>0){const a=document.createElement("div");a.className="editora-toast-actions",e.actions.forEach(l=>{const p=document.createElement("button");p.className=`editora-toast-action ${l.primary?"primary":""}`,p.textContent=l.label,p.onclick=f=>{f.stopPropagation(),l.onClick()},a.appendChild(p)}),s.appendChild(a)}if(e.closable!==!1){const a=document.createElement("button");a.className="editora-toast-close",a.setAttribute("aria-label","Close notification"),a.innerHTML="×",a.onclick=()=>t.dismiss(),s.appendChild(a)}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,n;const e=this.ensureContainer(t.options.position||this.config.position),s=this.createToastElement(t);t.element=s,e.appendChild(s);const i=t.options.animation||this.config.animation||{type:"css"};if(await k.showToast(s,t,i),this.config.enableAccessibility&&this.announceToast(t),(n=(r=t.options).onShow)==null||n.call(r),!t.options.persistent&&t.options.duration!==0){const o=t.options.duration||this.config.duration;t.timeoutId=window.setTimeout(()=>{this.hideToast(t)},o)}}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"};await k.hideToast(t.element,t,e),t.element&&t.element.parentNode&&(t.element.parentNode.removeChild(t.element),t.element=void 0),(i=(s=t.options).onHide)==null||i.call(s)}async updateToast(t,e){var r,n;if(!t.element)return;const s=t.options.animation||this.config.animation||{type:"css"};if(s.type==="custom"&&s.update){await k.updateToast(t.element,t,e,s);return}Object.assign(t.options,e),e.level&&(t.element.className=t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g,""),t.element.classList.add(`editora-toast--${e.level}`));const i=t.element.querySelector(".editora-toast-message");if(i&&e.message!==void 0)if(t.options.html&&e.message)i.innerHTML=this.sanitizeHTML(e.message);else if(t.options.render){const o=t.element.querySelector(".editora-toast-content");if(o){const a=t.options.render();o.innerHTML="",o.appendChild(a)}}else i.textContent=e.message||"";if(e.progress!==void 0){let o=t.element.querySelector(".editora-toast-progress");if(e.progress){if(!o){o=document.createElement("div"),o.className="editora-toast-progress";const l=t.element.querySelector(".editora-toast-content");l&&l.appendChild(o)}const a=o.querySelector(".editora-toast-progress-bar");if(a&&(a.style.width=`${Math.min(100,Math.max(0,e.progress.value))}%`),e.progress.showPercentage){let l=o.querySelector(".editora-toast-progress-text");l||(l=document.createElement("span"),l.className="editora-toast-progress-text",o.insertBefore(l,o.firstChild)),l.textContent=`${Math.round(e.progress.value)}%`}else{const l=o.querySelector(".editora-toast-progress-text");l&&l.remove()}}else o&&o.remove()}if(e.actions!==void 0){let o=t.element.querySelector(".editora-toast-actions");e.actions&&e.actions.length>0?(o?o.innerHTML="":(o=document.createElement("div"),o.className="editora-toast-actions",t.element.appendChild(o)),o&&e.actions.forEach(a=>{const l=document.createElement("button");l.className=`editora-toast-action ${a.primary?"primary":""}`,l.textContent=a.label,l.onclick=p=>{p.stopPropagation(),a.onClick()},o.appendChild(l)})):o&&o.remove()}(n=(r=t.options).onUpdate)==null||n.call(r,e)}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(()=>{this.hideToast(t)},e)}}addSwipeDismiss(t,e){let s=0,i=0,r=!1;const n=e.options.swipeDirection||this.config.swipeDirection||"any",o=40;let a="",l=!1;const p=d=>{r=!0,l=!1,s="touches"in d?d.touches[0].clientX:d.clientX,i="touches"in d?d.touches[0].clientY:d.clientY,a=t.style.transform||"",t.style.transition="none",t.style.cursor="grabbing",d.preventDefault()},f=d=>{if(!r)return;const g="touches"in d?d.touches[0].clientX:d.clientX,v="touches"in d?d.touches[0].clientY:d.clientY,y=g-s,w=v-i,m=5;if((Math.abs(y)>m||Math.abs(w)>m)&&(l=!0),l){const P=Math.abs(w)>Math.abs(y)?25:20,T=Math.min(Math.max(y*.2,-P),P),M=Math.min(Math.max(w*.2,-P),P);t.style.transform=`${a} translate(${T}px, ${M}px)`}(Math.abs(w)>Math.abs(y)||n==="vertical"||n==="up"||n==="down")&&d.preventDefault()},u=d=>{if(!r)return;if(t.style.transform=a,t.style.transition="",t.style.cursor="",!l){r=!1;return}const g="changedTouches"in d?d.changedTouches[0].clientX:d.clientX,v="changedTouches"in d?d.changedTouches[0].clientY:d.clientY,y=g-s,w=v-i;let m=!1;const P=n==="vertical"||n==="up"||n==="down",T=P?35:o;switch(n){case"any":m=Math.abs(y)>o||Math.abs(w)>o;break;case"horizontal":m=Math.abs(y)>o;break;case"vertical":m=Math.abs(w)>T;break;case"left":m=y<-o;break;case"right":m=y>o;break;case"up":m=w<-T;break;case"down":m=w>T;break}P&&console.log(`Vertical swipe attempt: direction=${n}, deltaY=${w}, effectiveMinDistance=${T}, shouldDismiss=${m}`),m&&e.dismiss(),r=!1};t.addEventListener("dragstart",d=>d.preventDefault()),t.addEventListener("touchstart",p,{passive:!1}),t.addEventListener("touchmove",f,{passive:!1}),t.addEventListener("touchend",u,{passive:!1}),t.addEventListener("mousedown",p),t.addEventListener("mousemove",f),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",u)}addDragDismiss(t,e){this.addSwipeDismiss(t,e)}announceToast(t){const e=document.createElement("div");e.setAttribute("aria-live","assertive"),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",e.textContent=`${t.options.level||"info"}: ${t.options.message}`,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,n;return((i=(s=e.ownerNode)==null?void 0:s.href)==null?void 0:i.includes("toast.css"))||((n=(r=e.ownerNode)==null?void 0:r.textContent)==null?void 0:n.includes("editora-toast"))})){const e=document.createElement("link");e.rel="stylesheet",e.href="/packages/editora-toast/dist/toast.css",document.head.appendChild(e)}this.cssInjected=!0}destroy(){this.containers.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.containers.clear()}}class I{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(n){console.error(`Error in ${t} hook:`,n)}}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 O={position:"bottom-right",duration:4e3,maxVisible:5,queueStrategy:"fifo",theme:"system",pauseOnHover:!0,pauseOnFocus:!1,pauseOnWindowBlur:!1,swipeDismiss:!1,swipeDirection:"any",dragDismiss:!1,rtl:!1,enableAccessibility:!0,animation:{type:"css"}};class C{constructor(t={}){this.idCounter=0,this.pausedToasts=new Set,this.config={...O,...t},this.store=new x(this.config),this.queue=new A(this.config),this.renderer=new F(this.config),this.lifecycle=new I,this.setupWindowFocusHandling()}show(t){const e=t.id||`toast-${++this.idCounter}`,s={id:e,options:{...this.config,...t},createdAt:Date.now(),dismiss:()=>this.dismiss(e),update:i=>this.update(e,i)};return this.lifecycle.beforeShow(s).then(async()=>{this.store.addToast(s),this.queue.enqueue(s),await this.renderer.showToast(s),this.lifecycle.afterShow(s)}),s}update(t,e){const s=this.store.getToast(t);return s?(this.lifecycle.beforeUpdate(s,e).then(async()=>{this.store.updateToast(t,{options:{...s.options,...e}}),await this.renderer.updateToast(s,e),this.lifecycle.afterUpdate(s,e)}),!0):!1}dismiss(t){const e=this.store.getToast(t);return e?(this.lifecycle.beforeHide(e).then(async()=>{this.queue.dequeue(t),await this.renderer.hideToast(e),this.store.removeToast(t),this.lifecycle.afterHide(e)}),!0):!1}clear(){const t=this.store.getAllToasts();this.lifecycle.batchHide(t).then(()=>{this.queue.clear(),this.store.clear()})}async promise(t,e){var i,r;const s=this.show(this.normalizeOptions(e.loading,"loading"));try{const n=await t,o=this.normalizeOptions(typeof e.success=="function"?e.success(n):e.success,"success");return this.update(s.id,o),(i=e.onSuccess)==null||i.call(e,n),n}catch(n){const o=this.normalizeOptions(typeof e.error=="function"?e.error(n):e.error,"error");throw this.update(s.id,o),(r=e.onError)==null||r.call(e,n),n}}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.config,...t},this.store.updateConfig(t),this.queue.updateConfig(t),t.pauseOnWindowBlur!==void 0&&t.pauseOnWindowBlur!==e&&(this.teardownWindowFocusHandling(),this.setupWindowFocusHandling())}getConfig(){return{...this.config}}getToasts(){return this.store.getAllToasts()}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}}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 h(){return E||(E=new C),E}function S(c){return typeof document=="undefined"?{dismiss:()=>{}}:h().show(c)}function H(c,t,e,s){const i={position:"top-right",theme:"light"};let r={};return t&&typeof t=="object"?r={...t}:typeof t=="number"&&(r.duration=t),e&&(r.theme=e),s&&(r.position=s),{message:c,...r,duration:r.duration,level:r.level||void 0,position:r.position||i.position,theme:r.theme||i.theme}}const L={info:(c,t,e,s)=>S({...H(c,t,e,s),level:"info"}),success:(c,t,e,s)=>S({...H(c,t,e,s),level:"success"}),error:(c,t,e,s)=>S({...H(c,t,e,s),level:"error"}),warning:(c,t,e,s)=>S({...H(c,t,e,s),level:"warning"}),loading:(c,t,e,s)=>S({...H(c,t,e,s),level:"loading"})},$={show:c=>h().show(c),update:(c,t)=>h().update(c,t),dismiss:c=>h().dismiss(c),clear:()=>h().clear(),info:(c,t)=>h().show({message:c,level:"info",...t}),success:(c,t)=>h().show({message:c,level:"success",...t}),error:(c,t)=>h().show({message:c,level:"error",...t}),warning:(c,t)=>h().show({message:c,level:"warning",...t}),loading:(c,t)=>h().show({message:c,level:"loading",...t}),promise:(c,t)=>h().promise(c,t),group:(c,t)=>h().group(c,t),configure:c=>h().configure(c),use:c=>h().use(c),getToasts:()=>h().getToasts(),getGroups:()=>h().getGroups(),getConfig:()=>h().getConfig(),onEditorEvent:(c,t)=>h().onEditorEvent(c,t),triggerEditorEvent:(c,t,...e)=>h().triggerEditorEvent(c,t,...e),destroy:()=>{E&&(E.destroy(),E=null)}};if(typeof window!="undefined"&&typeof document!="undefined"){const c=window;c.toast=L,c.toastAdvanced=$,c.toastPro=$,c.ToastManager=C,c.__editoraToastReady||(c.__editoraToastReady=!0,window.dispatchEvent(new CustomEvent("toastReady",{detail:{toast:L,toastAdvanced:$,toastPro:$,ToastManager:C}})))}b.ToastManager=C,b.default=L,b.toast=L,b.toastAdvanced=$,b.toastPro=$,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editora/toast",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Advanced toast notification system with enterprise features
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Advanced toast notification system for the Editora UI ecosystem with enterprise features and rich customization",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"browser": "dist/index.umd.js",
|
|
@@ -15,12 +15,18 @@
|
|
|
15
15
|
"require": "./dist/index.cjs.js",
|
|
16
16
|
"browser": "./dist/index.umd.js"
|
|
17
17
|
},
|
|
18
|
-
"./css": "./dist/toast.css"
|
|
18
|
+
"./toast.css": "./dist/toast.css"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"dist"
|
|
21
|
+
"dist/**/*.js",
|
|
22
|
+
"dist/**/*.css",
|
|
23
|
+
"dist/**/*.d.ts",
|
|
24
|
+
"README.md",
|
|
25
|
+
"CHANGELOG.md"
|
|
22
26
|
],
|
|
23
27
|
"keywords": [
|
|
28
|
+
"editora",
|
|
29
|
+
"editora ui ecosystem",
|
|
24
30
|
"toast",
|
|
25
31
|
"notification",
|
|
26
32
|
"ui",
|
|
@@ -45,6 +51,10 @@
|
|
|
45
51
|
"url": "https://github.com/ajaykr089/Editora/issues"
|
|
46
52
|
},
|
|
47
53
|
"homepage": "https://github.com/ajaykr089/Editora/tree/main/packages/editora-toast#readme",
|
|
54
|
+
"style": "dist/toast.css",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
48
58
|
"scripts": {
|
|
49
59
|
"build": "vite build && vite build --config vite.umd.config.ts && tsc --emitDeclarationOnly --outDir dist",
|
|
50
60
|
"postbuild": "cp src/toast.css dist/",
|
package/dist/index.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/core/ToastStore.ts","../src/core/ToastQueue.ts","../src/core/AnimationUtils.ts","../src/core/ToastRenderer.ts","../src/core/ToastLifecycle.ts","../src/core/ToastManager.ts","../src/index.ts"],"sourcesContent":["// ToastStore - Centralized state management for toasts\nimport { ToastInstance, ToastGroup, ToastConfig, ToastPosition } from './types';\n\nexport class ToastStore {\n private toasts = new Map<string, ToastInstance>();\n private groups = new Map<string, ToastGroup>();\n private containers = new Map<ToastPosition, HTMLElement>();\n private config: ToastConfig;\n\n constructor(config: ToastConfig) {\n this.config = { ...config };\n }\n\n // Toast management\n addToast(toast: ToastInstance): void {\n this.toasts.set(toast.id, toast);\n this.updateGroup(toast);\n }\n\n removeToast(id: string): boolean {\n const toast = this.toasts.get(id);\n if (!toast) return false;\n\n this.toasts.delete(id);\n this.updateGroup(toast);\n return true;\n }\n\n getToast(id: string): ToastInstance | undefined {\n return this.toasts.get(id);\n }\n\n getAllToasts(): ToastInstance[] {\n return Array.from(this.toasts.values());\n }\n\n getToastsByPosition(position: ToastPosition): ToastInstance[] {\n return this.getAllToasts().filter(toast => toast.options.position === position);\n }\n\n updateToast(id: string, updates: Partial<ToastInstance>): boolean {\n const toast = this.toasts.get(id);\n if (!toast) return false;\n\n Object.assign(toast, updates);\n this.updateGroup(toast);\n return true;\n }\n\n // Group management\n private updateGroup(toast: ToastInstance): void {\n const groupId = toast.options.group;\n if (!groupId) return;\n\n let group = this.groups.get(groupId);\n if (!group) {\n group = { id: groupId, toasts: [] };\n this.groups.set(groupId, group);\n }\n\n // Remove from old group if changing groups\n group.toasts = group.toasts.filter(t => t.id !== toast.id);\n\n // Add to new group\n if (toast.options.group === groupId) {\n group.toasts.push(toast);\n }\n\n // Remove empty groups\n if (group.toasts.length === 0) {\n this.groups.delete(groupId);\n }\n }\n\n getGroup(id: string): ToastGroup | undefined {\n return this.groups.get(id);\n }\n\n getAllGroups(): ToastGroup[] {\n return Array.from(this.groups.values());\n }\n\n // Container management\n getContainer(position: ToastPosition): HTMLElement | undefined {\n return this.containers.get(position);\n }\n\n setContainer(position: ToastPosition, container: HTMLElement): void {\n this.containers.set(position, container);\n }\n\n removeContainer(position: ToastPosition): boolean {\n return this.containers.delete(position);\n }\n\n getAllContainers(): Map<ToastPosition, HTMLElement> {\n return new Map(this.containers);\n }\n\n // Configuration\n getConfig(): ToastConfig {\n return { ...this.config };\n }\n\n updateConfig(config: Partial<ToastConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n // Cleanup\n clear(): void {\n this.toasts.clear();\n this.groups.clear();\n // Note: containers are managed separately\n }\n\n // Statistics\n getStats() {\n return {\n totalToasts: this.toasts.size,\n totalGroups: this.groups.size,\n toastsByPosition: Object.fromEntries(\n Array.from(this.containers.keys()).map(pos => [\n pos,\n this.getToastsByPosition(pos).length\n ])\n )\n };\n }\n}","// ToastQueue - Manages toast ordering, priority, and queue limits\nimport { ToastInstance, ToastConfig, QueueStrategy } from './types';\n\nexport class ToastQueue {\n private queue: ToastInstance[] = [];\n private visible: ToastInstance[] = [];\n private config: ToastConfig;\n\n constructor(config: ToastConfig) {\n this.config = config;\n }\n\n // Add toast to queue\n enqueue(toast: ToastInstance): void {\n // Remove duplicates if same message and level\n this.deduplicate(toast);\n\n // Add to queue based on strategy\n if (this.config.queueStrategy === 'fifo') {\n this.queue.push(toast);\n } else {\n this.queue.unshift(toast);\n }\n\n // Sort by priority (higher priority first)\n this.queue.sort((a, b) => (b.options.priority || 0) - (a.options.priority || 0));\n\n this.processQueue();\n }\n\n // Remove toast from queue/visible\n dequeue(id: string): boolean {\n let removed = false;\n\n // Remove from queue\n const queueIndex = this.queue.findIndex(t => t.id === id);\n if (queueIndex !== -1) {\n this.queue.splice(queueIndex, 1);\n removed = true;\n }\n\n // Remove from visible\n const visibleIndex = this.visible.findIndex(t => t.id === id);\n if (visibleIndex !== -1) {\n this.visible.splice(visibleIndex, 1);\n removed = true;\n }\n\n if (removed) {\n this.processQueue();\n }\n\n return removed;\n }\n\n // Process queue to show toasts within limits\n private processQueue(): void {\n const maxVisible = this.config.maxVisible;\n\n // Hide excess visible toasts\n while (this.visible.length > maxVisible) {\n const toast = this.visible.pop()!;\n this.hideToast(toast);\n }\n\n // Show queued toasts if space available\n while (this.visible.length < maxVisible && this.queue.length > 0) {\n const toast = this.queue.shift()!;\n this.showToast(toast);\n }\n }\n\n private showToast(toast: ToastInstance): void {\n this.visible.push(toast);\n // ToastRenderer will handle the actual showing\n }\n\n private hideToast(toast: ToastInstance): void {\n // ToastRenderer will handle the actual hiding\n }\n\n // Deduplicate toasts with same message and level\n private deduplicate(newToast: ToastInstance): void {\n const duplicates = this.queue.filter(t =>\n t.options.message === newToast.options.message &&\n t.options.level === newToast.options.level\n );\n\n duplicates.forEach(duplicate => {\n const index = this.queue.indexOf(duplicate);\n if (index !== -1) {\n this.queue.splice(index, 1);\n }\n });\n }\n\n // Update configuration\n updateConfig(config: Partial<ToastConfig>): void {\n this.config = { ...this.config, ...config };\n this.processQueue();\n }\n\n // Get current state\n getQueued(): ToastInstance[] {\n return [...this.queue];\n }\n\n getVisible(): ToastInstance[] {\n return [...this.visible];\n }\n\n getAll(): ToastInstance[] {\n return [...this.visible, ...this.queue];\n }\n\n // Clear all\n clear(): void {\n const allToasts = [...this.visible, ...this.queue];\n this.queue = [];\n this.visible = [];\n\n // Hide all visible toasts\n allToasts.forEach(toast => {\n if (toast.element) {\n this.hideToast(toast);\n }\n });\n }\n\n // Force show a high-priority toast (bypass queue)\n forceShow(toast: ToastInstance): void {\n if (this.visible.length >= this.config.maxVisible) {\n // Hide the lowest priority visible toast\n const lowestPriority = this.visible.reduce((lowest, current) =>\n (current.options.priority || 0) < (lowest.options.priority || 0) ? current : lowest\n );\n this.dequeue(lowestPriority.id);\n }\n\n this.showToast(toast);\n }\n}","// Animation utilities for advanced toast animations\nimport { SpringConfig, AnimationConfig, ToastInstance, ToastOptions, BounceAnimation, SlideAnimation, ZoomAnimation, FlipAnimation, FadeAnimation, ElasticAnimation, RotateAnimation } from './types';\n\n// Spring physics animation utility\nexport class SpringAnimation {\n private config: Required<SpringConfig>;\n\n constructor(config: SpringConfig = {}) {\n this.config = {\n stiffness: config.stiffness ?? 100,\n damping: config.damping ?? 10,\n mass: config.mass ?? 1,\n precision: config.precision ?? 0.01\n };\n }\n\n // Spring animation function\n animate(\n element: HTMLElement,\n properties: Record<string, { from: number; to: number; unit?: string }>,\n onUpdate: (values: Record<string, string>) => void,\n onComplete?: () => void,\n config?: Partial<SpringConfig>\n ): () => void {\n // Merge provided config with defaults\n const animConfig = {\n ...this.config,\n ...config\n };\n const startTime = Date.now();\n let animationId: number;\n let isComplete = false;\n\n // Initial values\n const currentValues = Object.keys(properties).reduce((acc, key) => {\n acc[key] = properties[key].from;\n return acc;\n }, {} as Record<string, number>);\n\n // Velocities for each property\n const velocities = Object.keys(properties).reduce((acc, key) => {\n acc[key] = 0;\n return acc;\n }, {} as Record<string, number>);\n\n const animate = () => {\n if (isComplete) return;\n\n const elapsed = Date.now() - startTime;\n let allComplete = true;\n\n // Update each property using spring physics\n Object.keys(properties).forEach(key => {\n const target = properties[key].to;\n const current = currentValues[key];\n const velocity = velocities[key];\n\n // Spring force: F = -k * (x - target)\n const force = -animConfig.stiffness * (current - target);\n\n // Damping force: F_damping = -c * v\n const dampingForce = -animConfig.damping * velocity;\n\n // Total force\n const totalForce = force + dampingForce;\n\n // Acceleration: a = F / m\n const acceleration = totalForce / animConfig.mass;\n\n // Update velocity and position\n velocities[key] += acceleration * 0.016; // Assume 60fps (16ms per frame)\n currentValues[key] += velocities[key] * 0.016;\n\n // Check if animation is complete for this property\n if (Math.abs(current - target) > animConfig.precision || Math.abs(velocity) > animConfig.precision) {\n allComplete = false;\n }\n });\n\n // Update the element\n const cssValues = Object.keys(currentValues).reduce((acc, key) => {\n const unit = properties[key].unit || 'px';\n acc[key] = `${currentValues[key]}${unit}`;\n return acc;\n }, {} as Record<string, string>);\n\n onUpdate(cssValues);\n\n if (allComplete) {\n isComplete = true;\n onComplete?.();\n } else {\n animationId = requestAnimationFrame(animate);\n }\n };\n\n animationId = requestAnimationFrame(animate);\n\n // Return cancel function\n return () => {\n isComplete = true;\n if (animationId) {\n cancelAnimationFrame(animationId);\n }\n };\n }\n}\n\n// Animation manager for handling different animation types\nexport class AnimationManager {\n private springAnimation: SpringAnimation;\n\n constructor() {\n this.springAnimation = new SpringAnimation();\n }\n\n // Show toast with specified animation\n async showToast(element: HTMLElement, toast: ToastInstance, animation: AnimationConfig): Promise<void> {\n switch (animation.type) {\n case 'spring':\n await this.animateSpringShow(element, animation);\n break;\n case 'bounce':\n await this.animateBounceShow(element, animation);\n break;\n case 'slide':\n await this.animateSlideShow(element, animation);\n break;\n case 'zoom':\n await this.animateZoomShow(element, animation);\n break;\n case 'flip':\n await this.animateFlipShow(element, animation);\n break;\n case 'fade':\n await this.animateFadeShow(element, animation);\n break;\n case 'elastic':\n await this.animateElasticShow(element, animation);\n break;\n case 'rotate':\n await this.animateRotateShow(element, animation);\n break;\n case 'custom':\n if (animation.show) {\n await Promise.resolve(animation.show(element, toast));\n } else {\n // Fallback to CSS animation\n this.animateCssShow(element);\n }\n break;\n case 'css':\n default:\n this.animateCssShow(element);\n break;\n }\n }\n\n // Hide toast with specified animation\n async hideToast(element: HTMLElement, toast: ToastInstance, animation: AnimationConfig): Promise<void> {\n switch (animation.type) {\n case 'spring':\n await this.animateSpringHide(element, animation);\n break;\n case 'bounce':\n await this.animateBounceHide(element, animation);\n break;\n case 'slide':\n await this.animateSlideHide(element, animation);\n break;\n case 'zoom':\n await this.animateZoomHide(element, animation);\n break;\n case 'flip':\n await this.animateFlipHide(element, animation);\n break;\n case 'fade':\n await this.animateFadeHide(element, animation);\n break;\n case 'elastic':\n await this.animateElasticHide(element, animation);\n break;\n case 'rotate':\n await this.animateRotateHide(element, animation);\n break;\n case 'custom':\n if (animation.hide) {\n await Promise.resolve(animation.hide(element, toast));\n } else {\n // Fallback to CSS animation\n this.animateCssHide(element);\n }\n break;\n case 'css':\n default:\n this.animateCssHide(element);\n break;\n }\n }\n\n // Update toast with specified animation\n async updateToast(\n element: HTMLElement,\n toast: ToastInstance,\n updates: Partial<ToastOptions>,\n animation: AnimationConfig\n ): Promise<void> {\n if (animation.type === 'custom' && animation.update) {\n await Promise.resolve(animation.update(element, toast, updates));\n }\n // For spring and css animations, updates are handled by the renderer\n }\n\n // CSS-based show animation (existing behavior)\n private animateCssShow(element: HTMLElement): void {\n requestAnimationFrame(() => {\n element.classList.add('show');\n });\n }\n\n // CSS-based hide animation (existing behavior)\n private animateCssHide(element: HTMLElement): void {\n element.classList.remove('show');\n element.classList.add('hiding');\n }\n\n // Spring-based show animation\n private async animateSpringShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'spring' }>): Promise<void> {\n return new Promise((resolve) => {\n // Add spring animation class to disable CSS transitions\n element.classList.add('spring-animation');\n \n // Force disable transitions with maximum priority\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('-webkit-transition', 'none', 'important');\n\n // Determine initial position\n const isBottom = element.parentElement?.classList.contains('editora-toast-bottom-right') || \n element.parentElement?.classList.contains('editora-toast-bottom-left') ||\n element.parentElement?.classList.contains('editora-toast-bottom-center');\n \n const initialTranslateY = isBottom ? 20 : -20;\n \n // Set initial state immediately\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `translateY(${initialTranslateY}px) scale(0.95)`, 'important');\n \n // Force reflow to ensure styles are applied\n void element.offsetHeight;\n \n // Small delay to ensure initial state is set, then start animation\n setTimeout(() => {\n // Apply spring transition with !important\n element.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');\n \n // Set final state\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'translateY(0) scale(1)', 'important');\n \n // Wait for animation to complete\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, 800);\n }, 16); // One frame delay\n });\n }\n\n // Spring-based hide animation\n private async animateSpringHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'spring' }>): Promise<void> {\n return new Promise((resolve) => {\n // Add spring animation class to disable CSS transitions\n element.classList.add('spring-animation');\n \n // Force disable transitions\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('-webkit-transition', 'none', 'important');\n\n // Start hide animation immediately\n setTimeout(() => {\n element.style.setProperty('transition', 'opacity 0.4s ease, transform 0.4s ease', 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', 'translateY(-10px) scale(0.95)', 'important');\n \n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, 400);\n }, 16);\n });\n }\n\n // Bounce-based show animation\n private async animateBounceShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'bounce' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const isBottom = element.parentElement?.classList.contains('editora-toast-bottom-right') || \n element.parentElement?.classList.contains('editora-toast-bottom-left') ||\n element.parentElement?.classList.contains('editora-toast-bottom-center');\n \n const direction = animation.direction || (isBottom ? 'up' : 'down');\n const intensity = animation.intensity || 'normal';\n const duration = animation.duration || 800;\n\n // Set bounce intensity\n const bounceScale = intensity === 'gentle' ? 0.05 : intensity === 'strong' ? 0.15 : 0.1;\n const initialOffset = direction === 'up' ? 30 : direction === 'down' ? -30 : \n direction === 'left' ? 30 : -30;\n\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', \n direction === 'left' || direction === 'right' \n ? `translateX(${initialOffset}px) scale(${1 - bounceScale})`\n : `translateY(${initialOffset}px) scale(${1 - bounceScale})`, \n 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', \n `opacity ${duration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${duration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`, \n 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'translateY(0) scale(1)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Bounce-based hide animation\n private async animateBounceHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'bounce' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const intensity = animation.intensity || 'normal';\n const bounceScale = intensity === 'gentle' ? 0.05 : intensity === 'strong' ? 0.15 : 0.1;\n\n setTimeout(() => {\n element.style.setProperty('transition', 'opacity 0.4s ease, transform 0.4s ease', 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `scale(${1 - bounceScale})`, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, 400);\n }, 16);\n });\n }\n\n // Slide-based show animation\n private async animateSlideShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'slide' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const isBottom = element.parentElement?.classList.contains('editora-toast-bottom-right') || \n element.parentElement?.classList.contains('editora-toast-bottom-left') ||\n element.parentElement?.classList.contains('editora-toast-bottom-center');\n \n const direction = animation.direction || (isBottom ? 'up' : 'down');\n const distance = animation.distance || 100;\n const easing = animation.easing || 'ease-out';\n const duration = animation.duration || 400;\n\n const initialTransform = \n direction === 'up' ? `translateY(${distance}px)` :\n direction === 'down' ? `translateY(-${distance}px)` :\n direction === 'left' ? `translateX(${distance}px)` :\n `translateX(-${distance}px)`;\n\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', initialTransform, 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`, 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'translateY(0) translateX(0)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Slide-based hide animation\n private async animateSlideHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'slide' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const direction = animation.direction || 'down';\n const distance = animation.distance || 100;\n const easing = animation.easing || 'ease-in';\n const duration = animation.duration || 300;\n\n const finalTransform = \n direction === 'up' ? `translateY(-${distance}px)` :\n direction === 'down' ? `translateY(${distance}px)` :\n direction === 'left' ? `translateX(-${distance}px)` :\n `translateX(${distance}px)`;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', finalTransform, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Zoom-based show animation\n private async animateZoomShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'zoom' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const scale = animation.scale || 0.3;\n const origin = animation.origin || 'center';\n const easing = animation.easing || 'ease-out';\n const duration = animation.duration || 500;\n\n element.style.setProperty('transform-origin', origin, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `scale(${scale})`, 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`, 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'scale(1)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-origin', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Zoom-based hide animation\n private async animateZoomHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'zoom' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const scale = animation.scale || 0.3;\n const origin = animation.origin || 'center';\n const easing = animation.easing || 'ease-in';\n const duration = animation.duration || 300;\n\n element.style.setProperty('transform-origin', origin, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `scale(${scale})`, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-origin', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Flip-based show animation\n private async animateFlipShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'flip' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const axis = animation.axis || 'y';\n const perspective = animation.perspective || 1000;\n const direction = animation.direction || 'forward';\n const duration = animation.duration || 600;\n\n element.style.setProperty('transform-style', 'preserve-3d', 'important');\n element.parentElement!.style.setProperty('perspective', `${perspective}px`, 'important');\n\n const initialRotation = direction === 'forward' ? (axis === 'x' ? -90 : 90) : (axis === 'x' ? 90 : -90);\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `rotate${axis.toUpperCase()}(${initialRotation}deg)`, 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`, 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'rotateX(0deg) rotateY(0deg)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-style', '', 'important');\n element.parentElement!.style.setProperty('perspective', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Flip-based hide animation\n private async animateFlipHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'flip' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const axis = animation.axis || 'y';\n const perspective = animation.perspective || 1000;\n const direction = animation.direction || 'backward';\n const duration = animation.duration || 400;\n\n element.style.setProperty('transform-style', 'preserve-3d', 'important');\n element.parentElement!.style.setProperty('perspective', `${perspective}px`, 'important');\n\n const finalRotation = direction === 'backward' ? (axis === 'x' ? -90 : 90) : (axis === 'x' ? 90 : -90);\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms ease-in`, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `rotate${axis.toUpperCase()}(${finalRotation}deg)`, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-style', '', 'important');\n element.parentElement!.style.setProperty('perspective', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Fade-based show animation\n private async animateFadeShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'fade' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const direction = animation.direction || 'none';\n const distance = animation.distance || 20;\n const duration = animation.duration || 300;\n\n let initialTransform = 'translateY(0) translateX(0)';\n if (direction !== 'none') {\n initialTransform = \n direction === 'up' ? `translateY(${distance}px)` :\n direction === 'down' ? `translateY(-${distance}px)` :\n direction === 'left' ? `translateX(${distance}px)` :\n `translateX(-${distance}px)`;\n }\n\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', initialTransform, 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms ease`, 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'translateY(0) translateX(0)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Fade-based hide animation\n private async animateFadeHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'fade' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const direction = animation.direction || 'none';\n const distance = animation.distance || 20;\n const duration = animation.duration || 200;\n\n let finalTransform = 'translateY(0) translateX(0)';\n if (direction !== 'none') {\n finalTransform = \n direction === 'up' ? `translateY(-${distance}px)` :\n direction === 'down' ? `translateY(${distance}px)` :\n direction === 'left' ? `translateX(-${distance}px)` :\n `translateX(${distance}px)`;\n }\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms ease`, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', finalTransform, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Elastic-based show animation\n private async animateElasticShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'elastic' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const isBottom = element.parentElement?.classList.contains('editora-toast-bottom-right') || \n element.parentElement?.classList.contains('editora-toast-bottom-left') ||\n element.parentElement?.classList.contains('editora-toast-bottom-center');\n \n const direction = animation.direction || (isBottom ? 'up' : 'down');\n const intensity = animation.intensity || 'normal';\n const duration = animation.duration || 1000;\n\n const elasticScale = intensity === 'gentle' ? 0.1 : intensity === 'strong' ? 0.3 : 0.2;\n const initialOffset = direction === 'up' ? 40 : direction === 'down' ? -40 : \n direction === 'left' ? 40 : -40;\n\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', \n direction === 'left' || direction === 'right' \n ? `translateX(${initialOffset}px) scale(${1 + elasticScale})`\n : `translateY(${initialOffset}px) scale(${1 + elasticScale})`, \n 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', \n `opacity ${duration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${duration}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`, \n 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'translateY(0) scale(1)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Elastic-based hide animation\n private async animateElasticHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'elastic' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const intensity = animation.intensity || 'normal';\n const elasticScale = intensity === 'gentle' ? 0.1 : intensity === 'strong' ? 0.3 : 0.2;\n const duration = animation.duration || 600;\n\n setTimeout(() => {\n element.style.setProperty('transition', 'opacity 0.4s ease, transform 0.4s ease', 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `scale(${1 + elasticScale})`, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n resolve();\n }, 400);\n }, 16);\n });\n }\n\n // Rotate-based show animation\n private async animateRotateShow(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'rotate' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const degrees = animation.degrees || 360;\n const direction = animation.direction || 'clockwise';\n const origin = animation.origin || 'center';\n const duration = animation.duration || 500;\n\n const rotation = direction === 'clockwise' ? degrees : -degrees;\n\n element.style.setProperty('transform-origin', origin, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `rotate(${rotation}deg) scale(0.8)`, 'important');\n\n void element.offsetHeight;\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`, 'important');\n element.style.setProperty('opacity', '1', 'important');\n element.style.setProperty('transform', 'rotate(0deg) scale(1)', 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-origin', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n\n // Rotate-based hide animation\n private async animateRotateHide(element: HTMLElement, animation: Extract<AnimationConfig, { type: 'rotate' }>): Promise<void> {\n return new Promise((resolve) => {\n element.classList.add('spring-animation');\n element.style.setProperty('transition', 'none', 'important');\n\n const degrees = animation.degrees || 180;\n const direction = animation.direction || 'counterclockwise';\n const origin = animation.origin || 'center';\n const duration = animation.duration || 300;\n\n const rotation = direction === 'clockwise' ? degrees : -degrees;\n\n element.style.setProperty('transform-origin', origin, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', `opacity ${duration}ms ease, transform ${duration}ms ease-in`, 'important');\n element.style.setProperty('opacity', '0', 'important');\n element.style.setProperty('transform', `rotate(${rotation}deg) scale(0.8)`, 'important');\n\n setTimeout(() => {\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('transform-origin', '', 'important');\n resolve();\n }, duration);\n }, 16);\n });\n }\n}\n\n// Export singleton instance\nexport const animationManager = new AnimationManager();","// ToastRenderer - Handles DOM creation, rendering, and animations\nimport { ToastInstance, ToastPosition, ToastConfig, AnimationConfig } from './types';\nimport { animationManager } from './AnimationUtils';\n\nexport class ToastRenderer {\n private containers = new Map<ToastPosition, HTMLElement>();\n private config: ToastConfig;\n private cssInjected = false;\n\n constructor(config: ToastConfig) {\n this.config = config;\n }\n\n // Ensure container exists for position\n ensureContainer(position: ToastPosition): HTMLElement {\n if (this.containers.has(position)) {\n return this.containers.get(position)!;\n }\n\n const container = document.createElement('div');\n container.className = `editora-toast-container editora-toast-${position.replace('-', '-')}`;\n container.setAttribute('role', 'region');\n container.setAttribute('aria-label', 'Toast notifications');\n container.setAttribute('aria-live', 'polite');\n \n // Position styles\n const styles: Partial<CSSStyleDeclaration> = {\n position: 'fixed',\n zIndex: (this.config.zIndex || 2147483647).toString(),\n display: 'flex',\n flexDirection: 'column',\n gap: '8px',\n pointerEvents: 'none',\n maxWidth: '100%',\n boxSizing: 'border-box'\n };\n\n switch (position) {\n case 'top-left':\n styles.top = '16px';\n styles.left = '16px';\n break;\n case 'top-right':\n styles.top = '16px';\n styles.right = '16px';\n break;\n case 'bottom-left':\n styles.bottom = '16px';\n styles.left = '16px';\n break;\n case 'bottom-right':\n styles.bottom = '16px';\n styles.right = '16px';\n break;\n case 'center':\n styles.top = '50%';\n styles.left = '50%';\n styles.transform = 'translate(-50%, -50%)';\n styles.alignItems = 'center';\n break;\n }\n\n Object.assign(container.style, styles);\n document.body.appendChild(container);\n this.containers.set(position, container);\n\n // Inject CSS if not already done\n this.injectCSS();\n\n return container;\n }\n\n // Create toast element\n createToastElement(toast: ToastInstance): HTMLElement {\n const options = toast.options;\n const element = document.createElement('div');\n\n element.className = `editora-toast editora-toast-${options.level || 'info'}`;\n if (options.customClass) {\n element.classList.add(options.customClass);\n }\n\n element.setAttribute('role', 'alert');\n element.setAttribute('aria-atomic', 'true');\n\n // Apply theme to individual toast\n const theme = options.theme || this.config.theme;\n if (theme && theme !== 'system') {\n element.setAttribute('data-theme', theme);\n }\n\n // Apply RTL support\n const rtl = options.rtl !== undefined ? options.rtl : this.config.rtl;\n if (rtl) {\n element.setAttribute('data-rtl', 'true');\n element.setAttribute('dir', 'rtl');\n }\n\n // Content structure\n const content = document.createElement('div');\n content.className = 'editora-toast-content';\n\n // Icon\n if (options.icon) {\n const icon = document.createElement('span');\n icon.className = 'editora-toast-icon';\n icon.textContent = options.icon;\n content.appendChild(icon);\n }\n\n // Message\n const message = document.createElement('span');\n message.className = 'editora-toast-message';\n\n if (options.html && options.message) {\n message.innerHTML = this.sanitizeHTML(options.message);\n } else if (options.render) {\n const customElement = options.render();\n message.appendChild(customElement);\n } else {\n message.textContent = options.message || '';\n }\n\n content.appendChild(message);\n\n // Progress bar\n if (options.progress) {\n const progress = document.createElement('div');\n progress.className = 'editora-toast-progress';\n\n const bar = document.createElement('div');\n bar.className = 'editora-toast-progress-bar';\n bar.style.width = `${Math.min(100, Math.max(0, options.progress.value))}%`;\n\n if (options.progress.showPercentage) {\n const percentage = document.createElement('span');\n percentage.className = 'editora-toast-progress-text';\n percentage.textContent = `${Math.round(options.progress.value)}%`;\n progress.appendChild(percentage);\n }\n\n progress.appendChild(bar);\n content.appendChild(progress);\n }\n\n element.appendChild(content);\n\n // Actions\n if (options.actions && options.actions.length > 0) {\n const actions = document.createElement('div');\n actions.className = 'editora-toast-actions';\n\n options.actions.forEach(action => {\n const button = document.createElement('button');\n button.className = `editora-toast-action ${action.primary ? 'primary' : ''}`;\n button.textContent = action.label;\n button.onclick = (e) => {\n e.stopPropagation();\n action.onClick();\n };\n actions.appendChild(button);\n });\n\n element.appendChild(actions);\n }\n\n // Close button\n if (options.closable !== false) {\n const close = document.createElement('button');\n close.className = 'editora-toast-close';\n close.setAttribute('aria-label', 'Close notification');\n close.innerHTML = '×';\n close.onclick = () => toast.dismiss();\n element.appendChild(close);\n }\n\n // Interactive features\n if (options.pauseOnHover) {\n element.addEventListener('mouseenter', () => this.pauseToast(toast));\n element.addEventListener('mouseleave', () => this.resumeToast(toast));\n }\n\n if (options.pauseOnFocus) {\n element.addEventListener('focusin', () => this.pauseToast(toast));\n element.addEventListener('focusout', () => this.resumeToast(toast));\n }\n\n if (options.swipeDismiss) {\n this.addSwipeDismiss(element, toast);\n }\n\n if (options.dragDismiss) {\n this.addDragDismiss(element, toast);\n }\n\n return element;\n }\n\n // Show toast with animation\n async showToast(toast: ToastInstance): Promise<void> {\n const container = this.ensureContainer(toast.options.position || this.config.position);\n const element = this.createToastElement(toast);\n\n toast.element = element;\n container.appendChild(element);\n\n // Get animation config (toast-specific or global default)\n const animation = toast.options.animation || this.config.animation || { type: 'css' };\n\n // Use animation manager for showing\n await animationManager.showToast(element, toast, animation);\n\n // Accessibility announcement\n if (this.config.enableAccessibility) {\n this.announceToast(toast);\n }\n\n // Call onShow callback\n toast.options.onShow?.();\n\n // Auto-dismiss if not persistent\n if (!toast.options.persistent && toast.options.duration !== 0) {\n const duration = toast.options.duration || this.config.duration;\n toast.timeoutId = window.setTimeout(() => {\n this.hideToast(toast);\n }, duration);\n }\n }\n\n // Hide toast with animation\n async hideToast(toast: ToastInstance): Promise<void> {\n if (!toast.element) return;\n\n // Clear timeout\n if (toast.timeoutId) {\n clearTimeout(toast.timeoutId);\n toast.timeoutId = undefined;\n }\n\n // Get animation config\n const animation = toast.options.animation || this.config.animation || { type: 'css' };\n\n // Use animation manager for hiding\n await animationManager.hideToast(toast.element, toast, animation);\n\n // Remove element after animation\n if (toast.element && toast.element.parentNode) {\n toast.element.parentNode.removeChild(toast.element);\n toast.element = undefined;\n }\n\n // Call onHide callback\n toast.options.onHide?.();\n }\n\n // Update toast content\n async updateToast(toast: ToastInstance, updates: Partial<ToastInstance['options']>): Promise<void> {\n if (!toast.element) return;\n\n // Get animation config\n const animation = toast.options.animation || this.config.animation || { type: 'css' };\n\n // Handle custom animation updates\n if (animation.type === 'custom' && (animation as any).update) {\n await animationManager.updateToast(toast.element, toast, updates, animation);\n return;\n }\n\n // Update the toast options\n Object.assign(toast.options, updates);\n\n // Update classes for level changes\n if (updates.level) {\n // Remove old level classes\n toast.element.className = toast.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g, '');\n // Add new level class\n toast.element.classList.add(`editora-toast--${updates.level}`);\n }\n\n // Update message content\n const messageElement = toast.element.querySelector('.editora-toast-message');\n if (messageElement && updates.message !== undefined) {\n if (toast.options.html && updates.message) {\n messageElement.innerHTML = this.sanitizeHTML(updates.message);\n } else if (toast.options.render) {\n // For custom render, we need to replace the content\n const contentElement = toast.element.querySelector('.editora-toast-content');\n if (contentElement) {\n const customElement = toast.options.render();\n contentElement.innerHTML = '';\n contentElement.appendChild(customElement);\n }\n } else {\n messageElement.textContent = updates.message || '';\n }\n }\n\n // Update progress bar\n if (updates.progress !== undefined) {\n let progressElement = toast.element.querySelector('.editora-toast-progress');\n if (updates.progress) {\n if (!progressElement) {\n // Create progress element if it doesn't exist\n progressElement = document.createElement('div');\n progressElement.className = 'editora-toast-progress';\n const contentElement = toast.element.querySelector('.editora-toast-content');\n if (contentElement) {\n contentElement.appendChild(progressElement);\n }\n }\n\n const bar = progressElement.querySelector('.editora-toast-progress-bar') as HTMLElement;\n if (bar) {\n bar.style.width = `${Math.min(100, Math.max(0, updates.progress.value))}%`;\n }\n\n if (updates.progress.showPercentage) {\n let percentage = progressElement.querySelector('.editora-toast-progress-text');\n if (!percentage) {\n percentage = document.createElement('span');\n percentage.className = 'editora-toast-progress-text';\n progressElement.insertBefore(percentage, progressElement.firstChild);\n }\n percentage.textContent = `${Math.round(updates.progress.value)}%`;\n } else {\n const percentage = progressElement.querySelector('.editora-toast-progress-text');\n if (percentage) {\n percentage.remove();\n }\n }\n } else if (progressElement) {\n // Remove progress element if progress is disabled\n progressElement.remove();\n }\n }\n\n // Update actions\n if (updates.actions !== undefined) {\n let actionsElement = toast.element.querySelector('.editora-toast-actions');\n if (updates.actions && updates.actions.length > 0) {\n if (!actionsElement) {\n actionsElement = document.createElement('div');\n actionsElement.className = 'editora-toast-actions';\n toast.element.appendChild(actionsElement);\n } else {\n actionsElement.innerHTML = '';\n }\n\n if (actionsElement) {\n updates.actions.forEach(action => {\n const button = document.createElement('button');\n button.className = `editora-toast-action ${action.primary ? 'primary' : ''}`;\n button.textContent = action.label;\n button.onclick = (e) => {\n e.stopPropagation();\n action.onClick();\n };\n actionsElement!.appendChild(button);\n });\n }\n } else if (actionsElement) {\n actionsElement.remove();\n }\n }\n\n // Call onUpdate callback\n toast.options.onUpdate?.(updates);\n }\n\n // Pause/resume auto-dismiss\n private pauseToast(toast: ToastInstance): void {\n if (toast.timeoutId) {\n clearTimeout(toast.timeoutId);\n toast.timeoutId = undefined;\n }\n }\n\n private resumeToast(toast: ToastInstance): void {\n if (!toast.options.persistent && toast.options.duration !== 0) {\n const duration = toast.options.duration || this.config.duration;\n toast.timeoutId = window.setTimeout(() => {\n this.hideToast(toast);\n }, duration);\n }\n }\n\n // Swipe dismiss with directional control\n private addSwipeDismiss(element: HTMLElement, toast: ToastInstance): void {\n let startX = 0;\n let startY = 0;\n let isDragging = false;\n const swipeDirection = toast.options.swipeDirection || this.config.swipeDirection || 'any';\n const minSwipeDistance = 40; // Reduced from 50 to make vertical swipes easier\n let originalTransform = '';\n let hasMoved = false;\n\n const handleStart = (e: TouchEvent | MouseEvent) => {\n isDragging = true;\n hasMoved = false;\n startX = 'touches' in e ? e.touches[0].clientX : e.clientX;\n startY = 'touches' in e ? e.touches[0].clientY : e.clientY;\n originalTransform = element.style.transform || '';\n element.style.transition = 'none'; // Disable transitions during drag\n element.style.cursor = 'grabbing';\n e.preventDefault();\n };\n\n const handleMove = (e: TouchEvent | MouseEvent) => {\n if (!isDragging) return;\n\n const currentX = 'touches' in e ? e.touches[0].clientX : e.clientX;\n const currentY = 'touches' in e ? e.touches[0].clientY : e.clientY;\n const deltaX = currentX - startX;\n const deltaY = currentY - startY;\n\n // Only apply visual feedback if we've moved more than a small threshold\n const moveThreshold = 5;\n if (Math.abs(deltaX) > moveThreshold || Math.abs(deltaY) > moveThreshold) {\n hasMoved = true;\n }\n\n if (hasMoved) {\n // Add visual feedback by slightly moving the element\n // Allow more movement for vertical swipes to make them feel more responsive\n const maxMove = Math.abs(deltaY) > Math.abs(deltaX) ? 25 : 20; // More movement for vertical\n const moveX = Math.min(Math.max(deltaX * 0.2, -maxMove), maxMove);\n const moveY = Math.min(Math.max(deltaY * 0.2, -maxMove), maxMove);\n element.style.transform = `${originalTransform} translate(${moveX}px, ${moveY}px)`;\n }\n\n // More aggressive prevention of default behavior for vertical swipes\n if (Math.abs(deltaY) > Math.abs(deltaX) || swipeDirection === 'vertical' || swipeDirection === 'up' || swipeDirection === 'down') {\n e.preventDefault();\n }\n };\n\n const handleEnd = (e: TouchEvent | MouseEvent) => {\n if (!isDragging) return;\n\n // Reset styles\n element.style.transform = originalTransform;\n element.style.transition = '';\n element.style.cursor = '';\n\n if (!hasMoved) {\n isDragging = false;\n return;\n }\n\n const endX = 'changedTouches' in e ? e.changedTouches[0].clientX : e.clientX;\n const endY = 'changedTouches' in e ? e.changedTouches[0].clientY : e.clientY;\n const deltaX = endX - startX;\n const deltaY = endY - startY;\n\n // Check if swipe meets direction and distance requirements\n let shouldDismiss = false;\n const isVerticalSwipe = swipeDirection === 'vertical' || swipeDirection === 'up' || swipeDirection === 'down';\n const effectiveMinDistance = isVerticalSwipe ? 35 : minSwipeDistance; // Easier vertical swipes\n\n switch (swipeDirection) {\n case 'any':\n shouldDismiss = Math.abs(deltaX) > minSwipeDistance || Math.abs(deltaY) > minSwipeDistance;\n break;\n case 'horizontal':\n shouldDismiss = Math.abs(deltaX) > minSwipeDistance;\n break;\n case 'vertical':\n shouldDismiss = Math.abs(deltaY) > effectiveMinDistance;\n break;\n case 'left':\n shouldDismiss = deltaX < -minSwipeDistance;\n break;\n case 'right':\n shouldDismiss = deltaX > minSwipeDistance;\n break;\n case 'up':\n shouldDismiss = deltaY < -effectiveMinDistance;\n break;\n case 'down':\n shouldDismiss = deltaY > effectiveMinDistance;\n break;\n }\n\n // Debug logging for vertical swipes\n if (isVerticalSwipe) {\n console.log(`Vertical swipe attempt: direction=${swipeDirection}, deltaY=${deltaY}, effectiveMinDistance=${effectiveMinDistance}, shouldDismiss=${shouldDismiss}`);\n }\n\n if (shouldDismiss) {\n toast.dismiss();\n }\n\n isDragging = false;\n };\n\n // Prevent default drag behavior\n element.addEventListener('dragstart', (e) => e.preventDefault());\n\n // Touch events\n element.addEventListener('touchstart', handleStart, { passive: false });\n element.addEventListener('touchmove', handleMove, { passive: false });\n element.addEventListener('touchend', handleEnd, { passive: false });\n\n // Mouse events\n element.addEventListener('mousedown', handleStart);\n element.addEventListener('mousemove', handleMove);\n element.addEventListener('mouseup', handleEnd);\n element.addEventListener('mouseleave', handleEnd); // Handle mouse leaving element\n }\n\n // Drag dismiss (simplified)\n private addDragDismiss(element: HTMLElement, toast: ToastInstance): void {\n // Similar to swipe but with mouse only\n this.addSwipeDismiss(element, toast);\n }\n\n // Accessibility\n private announceToast(toast: ToastInstance): void {\n const announcement = document.createElement('div');\n announcement.setAttribute('aria-live', 'assertive');\n announcement.setAttribute('aria-atomic', 'true');\n announcement.style.position = 'absolute';\n announcement.style.left = '-10000px';\n announcement.style.width = '1px';\n announcement.style.height = '1px';\n announcement.style.overflow = 'hidden';\n\n announcement.textContent = `${toast.options.level || 'info'}: ${toast.options.message}`;\n\n document.body.appendChild(announcement);\n\n setTimeout(() => {\n document.body.removeChild(announcement);\n }, 1000);\n }\n\n // Security: Basic HTML sanitization\n private sanitizeHTML(html: string): string {\n const temp = document.createElement('div');\n temp.textContent = html;\n return temp.innerHTML;\n }\n\n // Inject CSS\n private injectCSS(): void {\n if (this.cssInjected || typeof document === 'undefined') return;\n\n // Try to find existing CSS\n const existing = Array.from(document.styleSheets).find(s =>\n (s.ownerNode as any)?.href?.includes('toast.css') ||\n (s.ownerNode as any)?.textContent?.includes('editora-toast')\n );\n\n if (!existing) {\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = '/packages/editora-toast/dist/toast.css';\n document.head.appendChild(link);\n }\n\n this.cssInjected = true;\n }\n\n // Cleanup\n destroy(): void {\n this.containers.forEach(container => {\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n });\n this.containers.clear();\n }\n}","// ToastLifecycle - Manages toast lifecycle events and hooks\nimport { ToastInstance, ToastPlugin } from './types';\n\ntype HookCallback = (toast: ToastInstance, ...args: any[]) => void | Promise<void>;\n\nexport class ToastLifecycle {\n private plugins: ToastPlugin[] = [];\n private hooks = {\n beforeShow: [] as HookCallback[],\n afterShow: [] as HookCallback[],\n beforeHide: [] as HookCallback[],\n afterHide: [] as HookCallback[],\n beforeUpdate: [] as HookCallback[],\n afterUpdate: [] as HookCallback[]\n };\n\n // Plugin management\n use(plugin: ToastPlugin): void {\n if (this.plugins.find(p => p.name === plugin.name)) {\n console.warn(`Plugin \"${plugin.name}\" is already installed`);\n return;\n }\n\n this.plugins.push(plugin);\n plugin.install(this as any);\n }\n\n remove(pluginName: string): boolean {\n const index = this.plugins.findIndex(p => p.name === pluginName);\n if (index === -1) return false;\n\n const plugin = this.plugins[index];\n if (plugin.uninstall) {\n plugin.uninstall(this as any);\n }\n\n this.plugins.splice(index, 1);\n return true;\n }\n\n getPlugins(): ToastPlugin[] {\n return [...this.plugins];\n }\n\n // Hook registration\n on(event: keyof typeof this.hooks, callback: HookCallback): void {\n if (this.hooks[event]) {\n this.hooks[event].push(callback);\n }\n }\n\n off(event: keyof typeof this.hooks, callback: HookCallback): void {\n if (this.hooks[event]) {\n const index = this.hooks[event].indexOf(callback);\n if (index !== -1) {\n this.hooks[event].splice(index, 1);\n }\n }\n }\n\n // Hook execution\n async trigger(event: keyof typeof this.hooks, toast: ToastInstance, ...args: any[]): Promise<void> {\n const callbacks = this.hooks[event];\n if (!callbacks || callbacks.length === 0) return;\n\n for (const callback of callbacks) {\n try {\n await callback(toast, ...args);\n } catch (error) {\n console.error(`Error in ${event} hook:`, error);\n }\n }\n }\n\n // Convenience methods for common lifecycle events\n async beforeShow(toast: ToastInstance): Promise<void> {\n await this.trigger('beforeShow', toast);\n }\n\n async afterShow(toast: ToastInstance): Promise<void> {\n await this.trigger('afterShow', toast);\n }\n\n async beforeHide(toast: ToastInstance): Promise<void> {\n await this.trigger('beforeHide', toast);\n }\n\n async afterHide(toast: ToastInstance): Promise<void> {\n await this.trigger('afterHide', toast);\n }\n\n async beforeUpdate(toast: ToastInstance, updates: any): Promise<void> {\n await this.trigger('beforeUpdate', toast, updates);\n }\n\n async afterUpdate(toast: ToastInstance, updates: any): Promise<void> {\n await this.trigger('afterUpdate', toast, updates);\n }\n\n // Editor integration hooks (for RTE)\n onEditorEvent(event: string, callback: HookCallback): void {\n // Special hooks for editor integration\n const eventKey = `editor:${event}` as keyof typeof this.hooks;\n if (!this.hooks[eventKey]) {\n (this.hooks as any)[eventKey] = [];\n }\n (this.hooks as any)[eventKey].push(callback);\n }\n\n triggerEditorEvent(event: string, toast: ToastInstance, ...args: any[]): void {\n const eventKey = `editor:${event}` as keyof typeof this.hooks;\n this.trigger(eventKey, toast, ...args);\n }\n\n // Promise lifecycle helpers\n async handlePromise<T>(\n promise: Promise<T>,\n onLoading: () => void,\n onSuccess: (data: T) => void,\n onError: (error: any) => void\n ): Promise<T> {\n onLoading();\n\n try {\n const result = await promise;\n onSuccess(result);\n return result;\n } catch (error) {\n onError(error);\n throw error;\n }\n }\n\n // Batch operations\n async batchShow(toasts: ToastInstance[]): Promise<void> {\n const promises = toasts.map(toast => this.beforeShow(toast));\n await Promise.all(promises);\n\n // All toasts are shown simultaneously\n const showPromises = toasts.map(toast => this.afterShow(toast));\n await Promise.all(showPromises);\n }\n\n async batchHide(toasts: ToastInstance[]): Promise<void> {\n const promises = toasts.map(toast => this.beforeHide(toast));\n await Promise.all(promises);\n\n // All toasts are hidden simultaneously\n const hidePromises = toasts.map(toast => this.afterHide(toast));\n await Promise.all(hidePromises);\n }\n\n // Cleanup\n destroy(): void {\n // Uninstall all plugins\n this.plugins.forEach(plugin => {\n if (plugin.uninstall) {\n plugin.uninstall(this as any);\n }\n });\n this.plugins = [];\n\n // Clear all hooks\n Object.keys(this.hooks).forEach(key => {\n this.hooks[key as keyof typeof this.hooks] = [];\n });\n }\n}","// ToastManager - Main orchestrator for the toast notification system\nimport { ToastInstance, ToastOptions, ToastConfig, ToastManager as IToastManager, ToastPromiseOptions, ToastPlugin } from './types';\nimport { ToastStore } from './ToastStore';\nimport { ToastQueue } from './ToastQueue';\nimport { ToastRenderer } from './ToastRenderer';\nimport { ToastLifecycle } from './ToastLifecycle';\n\nconst DEFAULT_CONFIG: ToastConfig = {\n position: 'bottom-right',\n duration: 4000,\n maxVisible: 5,\n queueStrategy: 'fifo',\n theme: 'system',\n pauseOnHover: true,\n pauseOnFocus: false,\n pauseOnWindowBlur: false, // Don't pause by default\n swipeDismiss: false,\n swipeDirection: 'any', // Allow any direction by default\n dragDismiss: false,\n rtl: false, // LTR by default\n enableAccessibility: true,\n animation: { type: 'css' } // Default to CSS animations\n};\n\nexport class ToastManager implements IToastManager {\n private store: ToastStore;\n private queue: ToastQueue;\n private renderer: ToastRenderer;\n private lifecycle: ToastLifecycle;\n private config: ToastConfig;\n private idCounter = 0;\n private pausedToasts = new Set<string>();\n private windowFocusHandler?: () => void;\n private windowBlurHandler?: () => void;\n\n constructor(config: Partial<ToastConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n\n this.store = new ToastStore(this.config);\n this.queue = new ToastQueue(this.config);\n this.renderer = new ToastRenderer(this.config);\n this.lifecycle = new ToastLifecycle();\n\n // Setup window focus/blur handling if enabled\n this.setupWindowFocusHandling();\n }\n\n // Core API\n show(options: ToastOptions): ToastInstance {\n const id = options.id || `toast-${++this.idCounter}`;\n const toast: ToastInstance = {\n id,\n options: { ...this.config, ...options },\n createdAt: Date.now(),\n dismiss: () => this.dismiss(id),\n update: (updates) => this.update(id, updates)\n };\n\n // Lifecycle: beforeShow\n this.lifecycle.beforeShow(toast).then(async () => {\n // Add to store\n this.store.addToast(toast);\n\n // Add to queue (which handles visibility)\n this.queue.enqueue(toast);\n\n // Show the toast\n await this.renderer.showToast(toast);\n\n // Lifecycle: afterShow\n this.lifecycle.afterShow(toast);\n });\n\n return toast;\n }\n\n update(id: string, options: Partial<ToastOptions>): boolean {\n const toast = this.store.getToast(id);\n if (!toast) return false;\n\n // Lifecycle: beforeUpdate\n this.lifecycle.beforeUpdate(toast, options).then(async () => {\n // Update in store\n this.store.updateToast(id, { options: { ...toast.options, ...options } });\n\n // Update rendering\n await this.renderer.updateToast(toast, options);\n\n // Lifecycle: afterUpdate\n this.lifecycle.afterUpdate(toast, options);\n });\n\n return true;\n }\n\n dismiss(id: string): boolean {\n const toast = this.store.getToast(id);\n if (!toast) return false;\n\n // Lifecycle: beforeHide\n this.lifecycle.beforeHide(toast).then(async () => {\n // Remove from queue\n this.queue.dequeue(id);\n\n // Hide the toast\n await this.renderer.hideToast(toast);\n\n // Remove from store\n this.store.removeToast(id);\n\n // Lifecycle: afterHide\n this.lifecycle.afterHide(toast);\n });\n\n return true;\n }\n\n clear(): void {\n const toasts = this.store.getAllToasts();\n this.lifecycle.batchHide(toasts).then(() => {\n this.queue.clear();\n this.store.clear();\n });\n }\n\n // Promise API\n async promise<T>(promise: Promise<T>, options: ToastPromiseOptions<T>): Promise<T> {\n const loadingToast = this.show(this.normalizeOptions(options.loading, 'loading'));\n\n try {\n const result = await promise;\n\n // Update to success\n const successOptions = this.normalizeOptions(\n typeof options.success === 'function' ? options.success(result) : options.success,\n 'success'\n );\n this.update(loadingToast.id, successOptions);\n\n options.onSuccess?.(result);\n return result;\n\n } catch (error) {\n // Update to error\n const errorOptions = this.normalizeOptions(\n typeof options.error === 'function' ? options.error(error) : options.error,\n 'error'\n );\n this.update(loadingToast.id, errorOptions);\n\n options.onError?.(error);\n throw error;\n }\n }\n\n // Group API\n group(groupId: string, options: ToastOptions): ToastInstance {\n return this.show({ ...options, group: groupId });\n }\n\n // Plugin API\n use(plugin: ToastPlugin): void {\n this.lifecycle.use(plugin);\n }\n\n // Configuration\n configure(config: Partial<ToastConfig>): void {\n this.config = { ...this.config, ...config };\n this.store.updateConfig(config);\n this.queue.updateConfig(config);\n // Renderer will use updated config for new toasts\n }\n\n getConfig(): ToastConfig {\n return { ...this.config };\n }\n\n // State queries\n getToasts(): ToastInstance[] {\n return this.store.getAllToasts();\n }\n\n getGroups() {\n return this.store.getAllGroups();\n }\n\n // Convenience methods for backward compatibility\n info(message: string, duration?: number): ToastInstance {\n return this.show({ message, level: 'info', duration });\n }\n\n success(message: string, duration?: number): ToastInstance {\n return this.show({ message, level: 'success', duration });\n }\n\n error(message: string, duration?: number): ToastInstance {\n return this.show({ message, level: 'error', duration });\n }\n\n warning(message: string, duration?: number): ToastInstance {\n return this.show({ message, level: 'warning', duration });\n }\n\n loading(message: string, duration?: number): ToastInstance {\n return this.show({ message, level: 'loading', duration });\n }\n\n // Utility methods\n private normalizeOptions(input: string | ToastOptions, defaultLevel: ToastOptions['level']): ToastOptions {\n if (typeof input === 'string') {\n return { message: input, level: defaultLevel };\n }\n return { ...input, level: input.level || defaultLevel };\n }\n\n // Editor integration (for RTE)\n onEditorEvent(event: string, callback: (toast: ToastInstance, ...args: any[]) => void): void {\n this.lifecycle.onEditorEvent(event, callback);\n }\n\n triggerEditorEvent(event: string, toast: ToastInstance, ...args: any[]): void {\n this.lifecycle.triggerEditorEvent(event, toast, ...args);\n }\n\n // Window focus/blur handling\n private setupWindowFocusHandling(): void {\n if (typeof window === 'undefined' || !this.config.pauseOnWindowBlur) return;\n\n this.windowBlurHandler = () => this.pauseAllToasts();\n this.windowFocusHandler = () => this.resumeAllToasts();\n\n window.addEventListener('blur', this.windowBlurHandler);\n window.addEventListener('focus', this.windowFocusHandler);\n\n // Also handle visibility change for better cross-browser support\n document.addEventListener('visibilitychange', () => {\n if (document.hidden) {\n this.pauseAllToasts();\n } else {\n this.resumeAllToasts();\n }\n });\n }\n\n private pauseAllToasts(): void {\n const toasts = this.store.getAllToasts();\n toasts.forEach(toast => {\n if (toast.timeoutId && !this.pausedToasts.has(toast.id)) {\n clearTimeout(toast.timeoutId);\n toast.timeoutId = undefined;\n this.pausedToasts.add(toast.id);\n }\n });\n }\n\n private resumeAllToasts(): void {\n const toasts = this.store.getAllToasts();\n toasts.forEach(toast => {\n if (this.pausedToasts.has(toast.id) && !toast.options.persistent && toast.options.duration !== 0) {\n const remainingTime = toast.options.duration || this.config.duration;\n toast.timeoutId = window.setTimeout(() => {\n this.dismiss(toast.id);\n }, remainingTime);\n this.pausedToasts.delete(toast.id);\n }\n });\n }\n\n // Cleanup\n destroy(): void {\n // Remove window event listeners\n if (this.windowBlurHandler && typeof window !== 'undefined') {\n window.removeEventListener('blur', this.windowBlurHandler);\n }\n if (this.windowFocusHandler && typeof window !== 'undefined') {\n window.removeEventListener('focus', this.windowFocusHandler);\n }\n\n this.clear();\n this.renderer.destroy();\n this.lifecycle.destroy();\n }\n}","// Advanced Toast Notification System\n// Backward compatible with the original API\n\nimport { ToastManager } from './core/ToastManager';\nimport { ToastOptions, ToastInstance, ToastConfig, ToastPlugin, ToastPromiseOptions } from './core/types';\n\n// Legacy types for backward compatibility\nexport type ToastLevel = 'info' | 'success' | 'error';\n\n// Create the global toast manager instance\nconst manager = new ToastManager();\n\n// Legacy API - maintains exact same interface\nexport interface ToastOptionsLegacy {\n message: string;\n duration?: number;\n level?: ToastLevel;\n}\n\nfunction showLegacy(options: ToastOptionsLegacy) {\n if (typeof document === 'undefined') return { dismiss: () => {} };\n return manager.show(options);\n}\n\n// Legacy exports\nexport const toast = {\n info: (msg: string, duration?: number) => showLegacy({ message: msg, level: 'info', duration }),\n success: (msg: string, duration?: number) => showLegacy({ message: msg, level: 'success', duration }),\n error: (msg: string, duration?: number) => showLegacy({ message: msg, level: 'error', duration })\n};\n\nexport default toast;\n\n// Advanced API exports\nexport { ToastManager } from './core/ToastManager';\nexport type {\n ToastLevel as ToastLevelAdvanced,\n ToastPosition,\n ToastTheme,\n ToastAction,\n ToastProgress,\n ToastContent,\n ToastOptions as ToastOptionsAdvanced,\n ToastInstance,\n ToastConfig,\n ToastPlugin,\n ToastPromiseOptions,\n // New animation types\n SpringConfig,\n AnimationType,\n AnimationConfig,\n SpringAnimation,\n BounceAnimation,\n SlideAnimation,\n ZoomAnimation,\n FlipAnimation,\n FadeAnimation,\n ElasticAnimation,\n RotateAnimation,\n CustomAnimation\n} from './core/types';\n\n// Advanced toast instance with enhanced features\nexport const toastAdvanced = {\n // Core methods\n show: (options: ToastOptions) => manager.show(options),\n update: (id: string, options: Partial<ToastOptions>) => manager.update(id, options),\n dismiss: (id: string) => manager.dismiss(id),\n clear: () => manager.clear(),\n\n // Convenience methods\n info: (message: string, options?: Partial<ToastOptions>) =>\n manager.show({ message, level: 'info', ...options }),\n success: (message: string, options?: Partial<ToastOptions>) =>\n manager.show({ message, level: 'success', ...options }),\n error: (message: string, options?: Partial<ToastOptions>) =>\n manager.show({ message, level: 'error', ...options }),\n warning: (message: string, options?: Partial<ToastOptions>) =>\n manager.show({ message, level: 'warning', ...options }),\n loading: (message: string, options?: Partial<ToastOptions>) =>\n manager.show({ message, level: 'loading', ...options }),\n\n // Advanced features\n promise: <T>(promise: Promise<T>, options: ToastPromiseOptions<T>) =>\n manager.promise(promise, options),\n group: (id: string, options: ToastOptions) => manager.group(id, options),\n configure: (config: Partial<ToastConfig>) => manager.configure(config),\n use: (plugin: ToastPlugin) => manager.use(plugin),\n\n // State queries\n getToasts: () => manager.getToasts(),\n getGroups: () => manager.getGroups(),\n getConfig: () => manager.getConfig(),\n\n // Editor integration\n onEditorEvent: (event: string, callback: (toast: ToastInstance, ...args: any[]) => void) => manager.onEditorEvent(event, callback),\n triggerEditorEvent: (event: string, toast: ToastInstance, ...args: any[]) => manager.triggerEditorEvent(event, toast, ...args),\n\n // Cleanup\n destroy: () => manager.destroy()\n};\n\n// Re-export for convenience\nexport { toastAdvanced as toastPro };\n\n// Browser global exports for direct script usage\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n (window as any).toast = toast;\n (window as any).toastAdvanced = toastAdvanced;\n (window as any).toastPro = toastAdvanced;\n (window as any).ToastManager = ToastManager;\n\n // Dispatch event to notify that toast library is ready\n window.dispatchEvent(new CustomEvent('toastReady', {\n detail: { toast, toastAdvanced, toastPro: toastAdvanced, ToastManager }\n }));\n}\n"],"names":["ToastStore","config","toast","id","position","updates","groupId","group","t","container","pos","ToastQueue","a","b","removed","queueIndex","visibleIndex","maxVisible","newToast","duplicate","index","allToasts","lowestPriority","lowest","current","SpringAnimation","_a","_b","_c","_d","element","properties","onUpdate","onComplete","animConfig","animationId","isComplete","currentValues","acc","key","velocities","animate","allComplete","target","velocity","force","dampingForce","acceleration","cssValues","unit","AnimationManager","animation","resolve","initialTranslateY","isBottom","direction","intensity","duration","bounceScale","initialOffset","distance","easing","initialTransform","finalTransform","scale","origin","axis","perspective","initialRotation","finalRotation","elasticScale","degrees","rotation","animationManager","ToastRenderer","styles","options","theme","content","icon","message","customElement","progress","bar","percentage","actions","action","button","e","close","messageElement","contentElement","progressElement","actionsElement","startX","startY","isDragging","swipeDirection","minSwipeDistance","originalTransform","hasMoved","handleStart","handleMove","currentX","currentY","deltaX","deltaY","moveThreshold","maxMove","moveX","moveY","handleEnd","endX","endY","shouldDismiss","isVerticalSwipe","effectiveMinDistance","announcement","html","temp","link","ToastLifecycle","plugin","p","pluginName","event","callback","args","callbacks","error","eventKey","promise","onLoading","onSuccess","onError","result","toasts","promises","showPromises","hidePromises","DEFAULT_CONFIG","ToastManager","loadingToast","successOptions","errorOptions","input","defaultLevel","remainingTime","manager","showLegacy","msg","toastAdvanced"],"mappings":"4GAGO,MAAMA,CAAW,CAMtB,YAAYC,EAAqB,CALzB,KAAA,WAAa,IACb,KAAA,WAAa,IACb,KAAA,eAAiB,IAIlB,KAAA,OAAS,CAAE,GAAGA,EACrB,CAGA,SAASC,EAA4B,CACnC,KAAK,OAAO,IAAIA,EAAM,GAAIA,CAAK,EAC/B,KAAK,YAAYA,CAAK,CACxB,CAEA,YAAYC,EAAqB,CAC/B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