vyrn 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import t,{useState as e,useEffect as o,useRef as n,useCallback as r,useMemo as a}from"react";import{createPortal as i}from"react-dom";import{X as s,AlertTriangle as c,Info as l,AlertCircle as u,CheckCircle as d}from"lucide-react";import{motion as p,AnimatePresence as f}from"framer-motion";var g=function(){return g=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},g.apply(this,arguments)};function m(t,e,o){if(o||2===arguments.length)for(var n,r=0,a=e.length;r<a;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var h=t.createContext(void 0),y=function(){var e=t.useContext(h);if(void 0===e)throw new Error("useToastContext must be used within a ToastProvider");return e},v=function(e){var o=e.progress,n=e.type,r=void 0===n?"default":n,a=function(){var t={success:{base:"#10B981",highlight:"#34D399",glow:"rgba(16, 185, 129, 0.4)"},error:{base:"#EF4444",highlight:"#F87171",glow:"rgba(239, 68, 68, 0.4)"},warning:{base:"#F59E0B",highlight:"#FBBF24",glow:"rgba(245, 158, 11, 0.4)"},info:{base:"#3B82F6",highlight:"#60A5FA",glow:"rgba(59, 130, 246, 0.4)"},default:{base:"#6366F1",highlight:"#818CF8",glow:"rgba(99, 102, 241, 0.4)"}};return t[r]||t.default}();return t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",overflow:"hidden",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(8px)"}},t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"100%",background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(2px)"}}),t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,height:"100%",background:"linear-gradient(90deg, \n ".concat(a.base,", \n ").concat(a.highlight,", \n ").concat(a.base,"\n )"),backgroundSize:"200% 100%",boxShadow:"0 0 10px ".concat(a.glow)},initial:{width:"100%",backgroundPosition:"0% 0%"},animate:{width:"".concat(o,"%"),backgroundPosition:["0% 0%","100% 0%"]},transition:{width:{duration:.4,ease:[.4,0,.2,1]},backgroundPosition:{duration:2,repeat:1/0,ease:"linear"}}},t.createElement(p.div,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"linear-gradient(90deg,\n transparent 0%,\n ".concat(a.highlight,"40 50%,\n transparent 100%\n )"),transform:"translateX(-50%)"},animate:{x:["0%","200%"]},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),t.createElement(p.div,{style:{position:"absolute",top:0,right:0,width:"2px",height:"100%",background:a.highlight,filter:"blur(0.5px)"},animate:{opacity:[1,.5,1],scale:[1,1.2,1]},transition:{duration:1,repeat:1/0,ease:"easeInOut"}})),t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,width:"".concat(o,"%"),height:"100%",background:"linear-gradient(90deg,\n transparent,\n ".concat(a.glow,",\n transparent\n )"),filter:"blur(4px)"},animate:{opacity:[.3,.6,.3]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}}))},b=function(n){var r=n.id,a=n.content,i=n.type,m=n.duration,h=void 0===m?3e3:m,b=n.icon,x=n.actions,w=n.input,k=n.onClose,E=n.progress,C=n.customStyles,B=n.className,N=void 0===B?"":B,P=n.isExpanded,T=n.isStacked,S=n.showCloseButton,F=n.showProgressBar,A=y(),z=A.removeToast;A.updateToast;var D=e(""),I=D[0],L=D[1],O=e(E||100),M=O[0],Y=O[1];o((function(){if(void 0===E){var t=setInterval((function(){Y((function(t){var e=t-100/(h/1e3);return e>0?e:0}))}),1e3);return function(){return clearInterval(t)}}}),[h,E]),o((function(){0===M&&z(r)}),[M,r,z]),o((function(){void 0!==E&&Y(E)}),[E]);return t.createElement(p.div,{className:"vyrn-toast ".concat(N," ").concat(T?"vyrn-toast-stacked":""," ").concat(i?"vyrn-toast-".concat(i):""),style:g(g({},C),{height:P?"auto":T?"60px":"auto",overflow:"hidden"}),initial:{opacity:0,y:50,scale:.3},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.5,transition:{duration:.2}},transition:{type:"spring",stiffness:500,damping:30}},t.createElement("div",{className:"vyrn-toast-content"},function(){if(b)return b;switch(i){case"success":return t.createElement(d,{className:"vyrn-toast-icon text-green-500"});case"error":return t.createElement(u,{className:"vyrn-toast-icon text-red-500"});case"info":return t.createElement(l,{className:"vyrn-toast-icon text-blue-500"});case"warning":return t.createElement(c,{className:"vyrn-toast-icon text-yellow-500"});default:return null}}(),t.createElement("div",{className:"vyrn-toast-message"},a)),t.createElement(f,null,P&&t.createElement(p.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3}},x&&t.createElement("div",{className:"vyrn-toast-actions"},x.map((function(e,o){return t.createElement("button",{key:o,onClick:function(t){t.stopPropagation(),e.onClick()},className:"vyrn-toast-action vyrn-toast-action-".concat(e.style||"default"," ").concat(e.className||"")},e.label)}))),w&&t.createElement("form",{onSubmit:function(t){t.preventDefault(),null==w||w.onSubmit(I),L("")},className:"vyrn-toast-input-form"},t.createElement("input",{type:"text",value:I,onChange:function(t){return L(t.target.value)},placeholder:w.placeholder,className:"vyrn-toast-input ".concat(w.className||""),onClick:function(t){return t.stopPropagation()}}),t.createElement("button",{type:"submit",className:"vyrn-toast-input-submit ".concat(w.submitClassName||""),onClick:function(t){return t.stopPropagation()}},"Submit")))),S&&t.createElement("button",{className:"vyrn-toast-close",onClick:function(t){t.stopPropagation(),null==k||k(),z(r)},"aria-label":"Close"},t.createElement(s,{size:18})),F&&t.createElement(v,{progress:M,type:i}))},x=function(o){var r,a=o.toasts,i=o.position,s=o.layout,c=o.className,l=void 0===c?"":c,u=o.showCloseButton,d=void 0===u||u,h=o.swipeDirection,y=void 0===h?"right":h,v=o.showProgressBar,x=void 0===v||v,w=e(!1),k=w[0],E=w[1],C=n(null),B=function(){var t=100;switch(y){case"left":return{x:-100,opacity:0};case"right":default:return{x:t,opacity:0};case"up":return{y:-100,opacity:0};case"down":return{y:t,opacity:0}}},N=function(t){return"normal"===s?i.startsWith("top")?t*(k?80:15):-t*(k?80:15):"stack"===s?k?80*t:3*t:0},P=m([],a,!0).reverse();return t.createElement("div",{className:"vyrn-toast-container ".concat(l),style:(r={position:"fixed",zIndex:9999},i.includes("top")&&(r.top="1rem"),i.includes("bottom")&&(r.bottom="3rem"),i.includes("left")&&(r.left="1rem"),i.includes("right")&&(r.right="1rem"),i.includes("center")&&(r.left="50%",r.transform="translateX(-50%)"),r),ref:C,onMouseEnter:function(){return E(!0)},onMouseLeave:function(){return E(!1)}},t.createElement(f,{mode:"sync"},P.map((function(e,o){var n,r;return t.createElement(p.div,{key:e.id,layout:!0,initial:{opacity:0,y:i.startsWith("top")?-20:20,scale:.9},animate:{opacity:1,y:i.startsWith("top")?N(o):-N(o),scale:k?1.02:1,zIndex:"stack"===s?9999-o:9999,transition:{type:"spring",stiffness:500,damping:30}},exit:B(),drag:"left"===y||"right"===y?"x":"y",dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:.9,onDragEnd:function(t,o){var n;(Math.abs(o.offset.x)>100||Math.abs(o.offset.y)>100)&&(null===(n=e.onClose)||void 0===n||n.call(e))},style:{position:"normal"===s?"relative":"absolute",width:"100%",transformOrigin:i.startsWith("top")?"top":"bottom",marginBottom:"normal"===s?"0.25rem":0}},t.createElement(b,g({},e,{isExpanded:"stack"!==s||k,isStacked:"stack"===s&&!k,showCloseButton:null!==(n=e.showCloseButton)&&void 0!==n?n:d,showProgressBar:null!==(r=e.showProgressBar)&&void 0!==r?r:x})))}))))};!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}(".vyrn-toast-container{bottom:0;display:flex;flex-direction:column;gap:8px;max-width:356px;offset:32px;padding:12px;pointer-events:none;position:fixed;right:0;width:calc(100% - 24px);z-index:9999}.vyrn-toast{background-color:#fff;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;overflow:hidden;pointer-events:auto;position:relative;transition:all .2s ease;width:100%}.vyrn-toast-stacked{cursor:pointer;height:40px;margin-bottom:0;transform-origin:top}.vyrn-toast-content{align-items:center;display:flex;min-height:48px;padding:20px;width:100%}.vyrn-toast-icon{flex-shrink:0;height:16px;margin-right:8px;width:16px}.vyrn-toast-message{color:#000;flex-grow:1;font-size:13px;font-weight:400;line-height:1.5;margin:0;padding:0}.vyrn-toast-actions{display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 12px}.vyrn-toast-action{border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;padding:6px 12px;transition:all .2s ease}.vyrn-toast-action-default{background-color:#f1f3f5;color:#495057}.vyrn-toast-action-primary{background-color:#339af0;color:#fff}.vyrn-toast-action-secondary{background-color:#868e96;color:#fff}.vyrn-toast-action-danger{background-color:#fa5252;color:#fff}.vyrn-toast-input-form{display:flex;padding:0 16px 12px}.vyrn-toast-input{border:1px solid #e9ecef;border-radius:4px;flex-grow:1;font-size:13px;padding:8px 12px}.vyrn-toast-input-submit{background-color:#339af0;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:13px;font-weight:500;margin-left:8px;padding:8px 16px}.vyrn-toast-close{align-items:center;background:none;border:none;color:#868e96;cursor:pointer;display:flex;justify-content:center;padding:0;position:absolute;right:12px;top:50%;transform:translateY(-50%);transition:color .2s ease}.vyrn-toast-close:hover{color:#495057}.vyrn-toast-progress{background-color:rgba(51,154,240,.5);bottom:0;height:2px;left:0;position:absolute}.dark .vyrn-toast{background-color:#222}.dark .vyrn-toast-message{color:#e9ecef}.dark .vyrn-toast-action-default{background-color:#343a40;color:#f1f3f5}.dark .vyrn-toast-input{background-color:#343a40;border-color:#495057;color:#e9ecef}.dark .vyrn-toast-close{color:#adb5bd}.dark .vyrn-toast-close:hover{color:#e9ecef}@keyframes vyrn-toast-enter{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes vyrn-toast-exit{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}.vyrn-toast-enter{animation:vyrn-toast-enter .3s ease-out}.vyrn-toast-exit{animation:vyrn-toast-exit .3s ease-in}@media (max-width:640px){.vyrn-toast-container{bottom:0;left:0;padding:8px;right:0;width:calc(100% - 32px)}.vyrn-toast{border-radius:6px 6px 0 0}}",{insertAt:"top"});var w=function(n){var s=n.children,c=n.defaultPosition,l=void 0===c?"top-right":c,u=n.defaultLayout,d=void 0===u?"normal":u,p=n.maxToasts,f=void 0===p?5:p,y=n.containerClassName,v=void 0===y?"":y,b=n.showCloseButton,w=void 0===b||b,k=n.swipeDirection,E=void 0===k?"right":k,C=n.showProgressBar,B=void 0===C||C,N=e([]),P=N[0],T=N[1],S=e(l),F=S[0],A=S[1],z=e(d),D=z[0],I=z[1],L=r((function(t){var e=Math.random().toString(36).substr(2,9);return T((function(o){return m(m([],o,!0),[g(g({},t),{id:e})],!1).slice(-f)})),t.soundEffect&&new Audio(t.soundEffect).play().catch((function(t){return console.error("Error playing sound:",t)})),e}),[f]),O=r((function(t){T((function(e){return e.filter((function(e){return e.id!==t}))}))}),[]),M=r((function(t,e){T((function(o){return o.map((function(o){return o.id===t?g(g({},o),e):o}))}))}),[]),Y=r((function(){T([])}),[]),W=a((function(){return{addToast:L,removeToast:O,updateToast:M,clearAllToasts:Y,position:F,setPosition:A,layout:D,setLayout:I,showCloseButton:w,swipeDirection:E,showProgressBar:B}}),[L,O,M,Y,F,D,w,E,B]),j=e(!1),X=j[0],q=j[1];return o((function(){q(!0)}),[]),t.createElement(h.Provider,{value:W},s,X&&i(t.createElement(x,{toasts:P,position:F,layout:D,className:v,showCloseButton:w,swipeDirection:E,showProgressBar:B}),document.body))},k=function(){var t=y(),e=t.addToast,o=t.removeToast,n=t.updateToast,a=t.clearAllToasts,i=t.position,s=t.setPosition,c=t.layout,l=t.setLayout,u=r((function(t){return e(t)}),[e]),d=r((function(t,e){n(t,e)}),[n]),p=r((function(t){o(t)}),[o]),f=r((function(){a()}),[a]),m=r((function(t){s(t)}),[s]),h=r((function(t){l(t)}),[l]);return{toast:u,update:d,dismiss:p,clearAll:f,changePosition:m,changeLayout:h,position:i,layout:c,default:function(t,e){return u(g({content:t,type:"default"},e))},info:function(t,e){return u(g({content:t,type:"info"},e))},success:function(t,e){return u(g({content:t,type:"success"},e))},warning:function(t,e){return u(g({content:t,type:"warning"},e))},error:function(t,e){return u(g({content:t,type:"error"},e))},custom:function(t,e){return u(g({content:t,type:"custom"},e))}}},E=function(e){var o=e.children,n=e.position,r=e.layout,a=void 0===r?"normal":r,i=e.maxToasts,s=e.containerClassName,c=e.showCloseButton,l=void 0===c||c,u=e.swipeDirection,d=void 0===u?"right":u,p=e.showProgressBar,f=void 0===p||p;return t.createElement(w,{defaultPosition:n,defaultLayout:a,maxToasts:i,containerClassName:s,showCloseButton:l,swipeDirection:d,showProgressBar:f},o)};export{E as ClientToastProvider,w as ToastProvider,k as useToast};
1
+ import t,{useState as e,useEffect as o,useRef as n,useCallback as r,useMemo as a}from"react";import{createPortal as i}from"react-dom";import{X as s,AlertTriangle as c,Info as l,AlertCircle as u,CheckCircle as d}from"lucide-react";import{motion as p,AnimatePresence as f}from"framer-motion";var g=function(){return g=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},g.apply(this,arguments)};function m(t,e,o){if(o||2===arguments.length)for(var n,r=0,a=e.length;r<a;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var h=t.createContext(void 0),y=function(){var e=t.useContext(h);if(void 0===e)throw new Error("useToastContext must be used within a ToastProvider");return e},v=function(e){var o=e.progress,n=e.type,r=void 0===n?"default":n,a=function(){var t={success:{base:"#10B981",highlight:"#34D399",glow:"rgba(16, 185, 129, 0.4)"},error:{base:"#EF4444",highlight:"#F87171",glow:"rgba(239, 68, 68, 0.4)"},warning:{base:"#F59E0B",highlight:"#FBBF24",glow:"rgba(245, 158, 11, 0.4)"},info:{base:"#3B82F6",highlight:"#60A5FA",glow:"rgba(59, 130, 246, 0.4)"},default:{base:"#6366F1",highlight:"#818CF8",glow:"rgba(99, 102, 241, 0.4)"}};return t[r]||t.default}();return t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",overflow:"hidden",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(8px)"}},t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"100%",background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(2px)"}}),t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,height:"100%",background:"linear-gradient(90deg, \n ".concat(a.base,", \n ").concat(a.highlight,", \n ").concat(a.base,"\n )"),backgroundSize:"200% 100%",boxShadow:"0 0 10px ".concat(a.glow)},initial:{width:"100%",backgroundPosition:"0% 0%"},animate:{width:"".concat(o,"%"),backgroundPosition:["0% 0%","100% 0%"]},transition:{width:{duration:.4,ease:[.4,0,.2,1]},backgroundPosition:{duration:2,repeat:1/0,ease:"linear"}}},t.createElement(p.div,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"linear-gradient(90deg,\n transparent 0%,\n ".concat(a.highlight,"40 50%,\n transparent 100%\n )"),transform:"translateX(-50%)"},animate:{x:["0%","200%"]},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),t.createElement(p.div,{style:{position:"absolute",top:0,right:0,width:"2px",height:"100%",background:a.highlight,filter:"blur(0.5px)"},animate:{opacity:[1,.5,1],scale:[1,1.2,1]},transition:{duration:1,repeat:1/0,ease:"easeInOut"}})),t.createElement(p.div,{style:{position:"absolute",bottom:0,left:0,width:"".concat(o,"%"),height:"100%",background:"linear-gradient(90deg,\n transparent,\n ".concat(a.glow,",\n transparent\n )"),filter:"blur(4px)"},animate:{opacity:[.3,.6,.3]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}}))},b=function(n){var r=n.id,a=n.content,i=n.type,m=n.duration,h=void 0===m?3e3:m,b=n.icon,x=n.actions,w=n.input,k=n.onClose,E=n.progress,C=n.customStyles,B=n.className,N=void 0===B?"":B,P=n.isExpanded,T=n.isStacked,S=n.showCloseButton,F=n.showProgressBar,A=y(),z=A.removeToast;A.updateToast;var D=e(""),I=D[0],L=D[1],O=e(E||100),M=O[0],Y=O[1];o((function(){if(void 0===E){var t=setInterval((function(){Y((function(t){var e=t-100/(h/1e3);return e>0?e:0}))}),1e3);return function(){return clearInterval(t)}}}),[h,E]),o((function(){0===M&&z(r)}),[M,r,z]),o((function(){void 0!==E&&Y(E)}),[E]);return t.createElement(p.div,{className:"vyrn-toast ".concat(N," ").concat(T?"vyrn-toast-stacked":""," ").concat(i?"vyrn-toast-".concat(i):""),style:g(g({},C),{height:P?"auto":T?"60px":"auto",overflow:"hidden"}),initial:{opacity:0,y:50,scale:.3},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.5,transition:{duration:.2}},transition:{type:"spring",stiffness:500,damping:30}},t.createElement("div",{className:"vyrn-toast-content"},function(){if(b)return b;switch(i){case"success":return t.createElement(d,{className:"vyrn-toast-icon text-green-500"});case"error":return t.createElement(u,{className:"vyrn-toast-icon text-red-500"});case"info":return t.createElement(l,{className:"vyrn-toast-icon text-blue-500"});case"warning":return t.createElement(c,{className:"vyrn-toast-icon text-yellow-500"});default:return null}}(),t.createElement("div",{className:"vyrn-toast-message"},a)),t.createElement(f,null,P&&t.createElement(p.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3}},x&&t.createElement("div",{className:"vyrn-toast-actions"},x.map((function(e,o){return t.createElement("button",{key:o,onClick:function(t){t.stopPropagation(),e.onClick()},className:"vyrn-toast-action vyrn-toast-action-".concat(e.style||"default"," ").concat(e.className||"")},e.label)}))),w&&t.createElement("form",{onSubmit:function(t){t.preventDefault(),null==w||w.onSubmit(I),L("")},className:"vyrn-toast-input-form"},t.createElement("input",{type:"text",value:I,onChange:function(t){return L(t.target.value)},placeholder:w.placeholder,className:"vyrn-toast-input ".concat(w.className||""),onClick:function(t){return t.stopPropagation()}}),t.createElement("button",{type:"submit",className:"vyrn-toast-input-submit ".concat(w.submitClassName||""),onClick:function(t){return t.stopPropagation()}},"Submit")))),S&&t.createElement("button",{className:"vyrn-toast-close",onClick:function(t){t.stopPropagation(),null==k||k(),z(r)},"aria-label":"Close"},t.createElement(s,{size:18})),F&&t.createElement(v,{progress:M,type:i}))},x=function(o){var r,a=o.toasts,i=o.position,s=o.layout,c=o.className,l=void 0===c?"":c,u=o.showCloseButton,d=void 0===u||u,h=o.swipeDirection,y=void 0===h?"right":h,v=o.showProgressBar,x=void 0===v||v,w=e(!1),k=w[0],E=w[1],C=n(null),B=function(){var t=100;switch(y){case"left":return{x:-100,opacity:0};case"right":default:return{x:t,opacity:0};case"up":return{y:-100,opacity:0};case"down":return{y:t,opacity:0}}},N=function(t){return"normal"===s?i.startsWith("top")?t*(k?80:15):-t*(k?80:15):"stack"===s?k?80*t:18*t:0},P=m([],a,!0).reverse();return t.createElement("div",{className:"vyrn-toast-container ".concat(l),style:(r={position:"fixed",zIndex:9999},i.includes("top")&&(r.top="1rem"),i.includes("bottom")&&(r.bottom="3.5rem"),i.includes("left")&&(r.left="1rem"),i.includes("right")&&(r.right="1rem"),i.includes("center")&&(r.left="50%",r.transform="translateX(-50%)"),r),ref:C,onMouseEnter:function(){return E(!0)},onMouseLeave:function(){return E(!1)}},t.createElement(f,{mode:"sync"},P.map((function(e,o){var n,r;return t.createElement(p.div,{key:e.id,layout:!0,initial:{opacity:0,y:i.startsWith("top")?-20:20,scale:.9},animate:{opacity:1,y:i.startsWith("top")?N(o):-N(o),scale:k?1.02:1,zIndex:"stack"===s?9999-o:9999,transition:{type:"spring",stiffness:500,damping:30}},exit:B(),drag:"left"===y||"right"===y?"x":"y",dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:.9,onDragEnd:function(t,o){var n;(Math.abs(o.offset.x)>100||Math.abs(o.offset.y)>100)&&(null===(n=e.onClose)||void 0===n||n.call(e))},style:{position:"normal"===s?"relative":"absolute",width:"100%",transformOrigin:i.startsWith("top")?"top":"bottom",marginBottom:"normal"===s?"0.25rem":0}},t.createElement(b,g({},e,{isExpanded:"stack"!==s||k,isStacked:"stack"===s&&!k,showCloseButton:null!==(n=e.showCloseButton)&&void 0!==n?n:d,showProgressBar:null!==(r=e.showProgressBar)&&void 0!==r?r:x})))}))))};!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}(".vyrn-toast-container{bottom:0;display:flex;flex-direction:column;gap:8px;max-width:356px;offset:32px;padding:12px;pointer-events:none;position:fixed;right:0;width:calc(100% - 24px);z-index:9999}.vyrn-toast{background-color:#fff;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;overflow:hidden;pointer-events:auto;position:relative;transition:all .2s ease;width:100%}.vyrn-toast-stacked{cursor:pointer;height:40px;margin-bottom:0;transform-origin:top}.vyrn-toast-content{align-items:center;display:flex;min-height:48px;padding:20px;width:100%}.vyrn-toast-icon{flex-shrink:0;height:16px;margin-right:8px;width:16px}.vyrn-toast-message{color:#000;flex-grow:1;font-size:13px;font-weight:400;line-height:1.5;margin:0;padding:0}.vyrn-toast-actions{display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 12px}.vyrn-toast-action{border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;padding:6px 12px;transition:all .2s ease}.vyrn-toast-action-default{background-color:#f1f3f5;color:#495057}.vyrn-toast-action-primary{background-color:#339af0;color:#fff}.vyrn-toast-action-secondary{background-color:#868e96;color:#fff}.vyrn-toast-action-danger{background-color:#fa5252;color:#fff}.vyrn-toast-input-form{display:flex;padding:0 16px 12px}.vyrn-toast-input{border:1px solid #e9ecef;border-radius:4px;flex-grow:1;font-size:13px;padding:8px 12px}.vyrn-toast-input-submit{background-color:#339af0;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:13px;font-weight:500;margin-left:8px;padding:8px 16px}.vyrn-toast-close{align-items:center;background:none;border:none;color:#868e96;cursor:pointer;display:flex;justify-content:center;padding:0;position:absolute;right:12px;top:50%;transform:translateY(-50%);transition:color .2s ease}.vyrn-toast-close:hover{color:#495057}.vyrn-toast-progress{background-color:rgba(51,154,240,.5);bottom:0;height:2px;left:0;position:absolute}.dark .vyrn-toast{background-color:#222}.dark .vyrn-toast-message{color:#e9ecef}.dark .vyrn-toast-action-default{background-color:#343a40;color:#f1f3f5}.dark .vyrn-toast-input{background-color:#343a40;border-color:#495057;color:#e9ecef}.dark .vyrn-toast-close{color:#adb5bd}.dark .vyrn-toast-close:hover{color:#e9ecef}@keyframes vyrn-toast-enter{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes vyrn-toast-exit{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}.vyrn-toast-enter{animation:vyrn-toast-enter .3s ease-out}.vyrn-toast-exit{animation:vyrn-toast-exit .3s ease-in}@media (max-width:640px){.vyrn-toast-container{bottom:0;left:0;padding:8px;right:0;width:calc(100% - 32px)}.vyrn-toast{border-radius:6px 6px 0 0}}",{insertAt:"top"});var w=function(n){var s=n.children,c=n.defaultPosition,l=void 0===c?"top-right":c,u=n.defaultLayout,d=void 0===u?"normal":u,p=n.maxToasts,f=void 0===p?5:p,y=n.containerClassName,v=void 0===y?"":y,b=n.showCloseButton,w=void 0===b||b,k=n.swipeDirection,E=void 0===k?"right":k,C=n.showProgressBar,B=void 0===C||C,N=e([]),P=N[0],T=N[1],S=e(l),F=S[0],A=S[1],z=e(d),D=z[0],I=z[1],L=r((function(t){var e=Math.random().toString(36).substr(2,9);return T((function(o){return m(m([],o,!0),[g(g({},t),{id:e})],!1).slice(-f)})),t.soundEffect&&new Audio(t.soundEffect).play().catch((function(t){return console.error("Error playing sound:",t)})),e}),[f]),O=r((function(t){T((function(e){return e.filter((function(e){return e.id!==t}))}))}),[]),M=r((function(t,e){T((function(o){return o.map((function(o){return o.id===t?g(g({},o),e):o}))}))}),[]),Y=r((function(){T([])}),[]),W=a((function(){return{addToast:L,removeToast:O,updateToast:M,clearAllToasts:Y,position:F,setPosition:A,layout:D,setLayout:I,showCloseButton:w,swipeDirection:E,showProgressBar:B}}),[L,O,M,Y,F,D,w,E,B]),j=e(!1),X=j[0],q=j[1];return o((function(){q(!0)}),[]),t.createElement(h.Provider,{value:W},s,X&&i(t.createElement(x,{toasts:P,position:F,layout:D,className:v,showCloseButton:w,swipeDirection:E,showProgressBar:B}),document.body))},k=function(){var t=y(),e=t.addToast,o=t.removeToast,n=t.updateToast,a=t.clearAllToasts,i=t.position,s=t.setPosition,c=t.layout,l=t.setLayout,u=r((function(t){return e(t)}),[e]),d=r((function(t,e){n(t,e)}),[n]),p=r((function(t){o(t)}),[o]),f=r((function(){a()}),[a]),m=r((function(t){s(t)}),[s]),h=r((function(t){l(t)}),[l]);return{toast:u,update:d,dismiss:p,clearAll:f,changePosition:m,changeLayout:h,position:i,layout:c,default:function(t,e){return u(g({content:t,type:"default"},e))},info:function(t,e){return u(g({content:t,type:"info"},e))},success:function(t,e){return u(g({content:t,type:"success"},e))},warning:function(t,e){return u(g({content:t,type:"warning"},e))},error:function(t,e){return u(g({content:t,type:"error"},e))},custom:function(t,e){return u(g({content:t,type:"custom"},e))}}},E=function(e){var o=e.children,n=e.position,r=e.layout,a=void 0===r?"normal":r,i=e.maxToasts,s=e.containerClassName,c=e.showCloseButton,l=void 0===c||c,u=e.swipeDirection,d=void 0===u?"right":u,p=e.showProgressBar,f=void 0===p||p;return t.createElement(w,{defaultPosition:n,defaultLayout:a,maxToasts:i,containerClassName:s,showCloseButton:l,swipeDirection:d,showProgressBar:f},o)};export{E as ClientToastProvider,w as ToastProvider,k as useToast};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"8jPAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D"}
1
+ {"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"ikPAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-dom"),o=require("lucide-react"),n=require("framer-motion");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=a(t),i=function(){return i=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var a in e=arguments[o])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},i.apply(this,arguments)};function s(t,e,o){if(o||2===arguments.length)for(var n,a=0,r=e.length;a<r;a++)!n&&a in e||(n||(n=Array.prototype.slice.call(e,0,a)),n[a]=e[a]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=r.default.createContext(void 0),l=function(){var t=r.default.useContext(c);if(void 0===t)throw new Error("useToastContext must be used within a ToastProvider");return t},u=function(t){var e=t.progress,o=t.type,a=void 0===o?"default":o,i=function(){var t={success:{base:"#10B981",highlight:"#34D399",glow:"rgba(16, 185, 129, 0.4)"},error:{base:"#EF4444",highlight:"#F87171",glow:"rgba(239, 68, 68, 0.4)"},warning:{base:"#F59E0B",highlight:"#FBBF24",glow:"rgba(245, 158, 11, 0.4)"},info:{base:"#3B82F6",highlight:"#60A5FA",glow:"rgba(59, 130, 246, 0.4)"},default:{base:"#6366F1",highlight:"#818CF8",glow:"rgba(99, 102, 241, 0.4)"}};return t[a]||t.default}();return r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",overflow:"hidden",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(8px)"}},r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"100%",background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(2px)"}}),r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,height:"100%",background:"linear-gradient(90deg, \n ".concat(i.base,", \n ").concat(i.highlight,", \n ").concat(i.base,"\n )"),backgroundSize:"200% 100%",boxShadow:"0 0 10px ".concat(i.glow)},initial:{width:"100%",backgroundPosition:"0% 0%"},animate:{width:"".concat(e,"%"),backgroundPosition:["0% 0%","100% 0%"]},transition:{width:{duration:.4,ease:[.4,0,.2,1]},backgroundPosition:{duration:2,repeat:1/0,ease:"linear"}}},r.default.createElement(n.motion.div,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"linear-gradient(90deg,\n transparent 0%,\n ".concat(i.highlight,"40 50%,\n transparent 100%\n )"),transform:"translateX(-50%)"},animate:{x:["0%","200%"]},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),r.default.createElement(n.motion.div,{style:{position:"absolute",top:0,right:0,width:"2px",height:"100%",background:i.highlight,filter:"blur(0.5px)"},animate:{opacity:[1,.5,1],scale:[1,1.2,1]},transition:{duration:1,repeat:1/0,ease:"easeInOut"}})),r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,width:"".concat(e,"%"),height:"100%",background:"linear-gradient(90deg,\n transparent,\n ".concat(i.glow,",\n transparent\n )"),filter:"blur(4px)"},animate:{opacity:[.3,.6,.3]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}}))},d=function(e){var a=e.id,s=e.content,c=e.type,d=e.duration,f=void 0===d?3e3:d,p=e.icon,m=e.actions,g=e.input,h=e.onClose,y=e.progress,v=e.customStyles,b=e.className,x=void 0===b?"":b,w=e.isExpanded,k=e.isStacked,E=e.showCloseButton,C=e.showProgressBar,P=l(),B=P.removeToast;P.updateToast;var N=t.useState(""),T=N[0],S=N[1],A=t.useState(y||100),F=A[0],z=A[1];t.useEffect((function(){if(void 0===y){var t=setInterval((function(){z((function(t){var e=t-100/(f/1e3);return e>0?e:0}))}),1e3);return function(){return clearInterval(t)}}}),[f,y]),t.useEffect((function(){0===F&&B(a)}),[F,a,B]),t.useEffect((function(){void 0!==y&&z(y)}),[y]);return r.default.createElement(n.motion.div,{className:"vyrn-toast ".concat(x," ").concat(k?"vyrn-toast-stacked":""," ").concat(c?"vyrn-toast-".concat(c):""),style:i(i({},v),{height:w?"auto":k?"60px":"auto",overflow:"hidden"}),initial:{opacity:0,y:50,scale:.3},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.5,transition:{duration:.2}},transition:{type:"spring",stiffness:500,damping:30}},r.default.createElement("div",{className:"vyrn-toast-content"},function(){if(p)return p;switch(c){case"success":return r.default.createElement(o.CheckCircle,{className:"vyrn-toast-icon text-green-500"});case"error":return r.default.createElement(o.AlertCircle,{className:"vyrn-toast-icon text-red-500"});case"info":return r.default.createElement(o.Info,{className:"vyrn-toast-icon text-blue-500"});case"warning":return r.default.createElement(o.AlertTriangle,{className:"vyrn-toast-icon text-yellow-500"});default:return null}}(),r.default.createElement("div",{className:"vyrn-toast-message"},s)),r.default.createElement(n.AnimatePresence,null,w&&r.default.createElement(n.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3}},m&&r.default.createElement("div",{className:"vyrn-toast-actions"},m.map((function(t,e){return r.default.createElement("button",{key:e,onClick:function(e){e.stopPropagation(),t.onClick()},className:"vyrn-toast-action vyrn-toast-action-".concat(t.style||"default"," ").concat(t.className||"")},t.label)}))),g&&r.default.createElement("form",{onSubmit:function(t){t.preventDefault(),null==g||g.onSubmit(T),S("")},className:"vyrn-toast-input-form"},r.default.createElement("input",{type:"text",value:T,onChange:function(t){return S(t.target.value)},placeholder:g.placeholder,className:"vyrn-toast-input ".concat(g.className||""),onClick:function(t){return t.stopPropagation()}}),r.default.createElement("button",{type:"submit",className:"vyrn-toast-input-submit ".concat(g.submitClassName||""),onClick:function(t){return t.stopPropagation()}},"Submit")))),E&&r.default.createElement("button",{className:"vyrn-toast-close",onClick:function(t){t.stopPropagation(),null==h||h(),B(a)},"aria-label":"Close"},r.default.createElement(o.X,{size:18})),C&&r.default.createElement(u,{progress:F,type:c}))},f=function(e){var o,a=e.toasts,c=e.position,l=e.layout,u=e.className,f=void 0===u?"":u,p=e.showCloseButton,m=void 0===p||p,g=e.swipeDirection,h=void 0===g?"right":g,y=e.showProgressBar,v=void 0===y||y,b=t.useState(!1),x=b[0],w=b[1],k=t.useRef(null),E=function(){var t=100;switch(h){case"left":return{x:-100,opacity:0};case"right":default:return{x:t,opacity:0};case"up":return{y:-100,opacity:0};case"down":return{y:t,opacity:0}}},C=function(t){return"normal"===l?c.startsWith("top")?t*(x?80:15):-t*(x?80:15):"stack"===l?x?80*t:3*t:0},P=s([],a,!0).reverse();return r.default.createElement("div",{className:"vyrn-toast-container ".concat(f),style:(o={position:"fixed",zIndex:9999},c.includes("top")&&(o.top="1rem"),c.includes("bottom")&&(o.bottom="3rem"),c.includes("left")&&(o.left="1rem"),c.includes("right")&&(o.right="1rem"),c.includes("center")&&(o.left="50%",o.transform="translateX(-50%)"),o),ref:k,onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)}},r.default.createElement(n.AnimatePresence,{mode:"sync"},P.map((function(t,e){var o,a;return r.default.createElement(n.motion.div,{key:t.id,layout:!0,initial:{opacity:0,y:c.startsWith("top")?-20:20,scale:.9},animate:{opacity:1,y:c.startsWith("top")?C(e):-C(e),scale:x?1.02:1,zIndex:"stack"===l?9999-e:9999,transition:{type:"spring",stiffness:500,damping:30}},exit:E(),drag:"left"===h||"right"===h?"x":"y",dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:.9,onDragEnd:function(e,o){var n;(Math.abs(o.offset.x)>100||Math.abs(o.offset.y)>100)&&(null===(n=t.onClose)||void 0===n||n.call(t))},style:{position:"normal"===l?"relative":"absolute",width:"100%",transformOrigin:c.startsWith("top")?"top":"bottom",marginBottom:"normal"===l?"0.25rem":0}},r.default.createElement(d,i({},t,{isExpanded:"stack"!==l||x,isStacked:"stack"===l&&!x,showCloseButton:null!==(o=t.showCloseButton)&&void 0!==o?o:m,showProgressBar:null!==(a=t.showProgressBar)&&void 0!==a?a:v})))}))))};!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===o&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}(".vyrn-toast-container{bottom:0;display:flex;flex-direction:column;gap:8px;max-width:356px;offset:32px;padding:12px;pointer-events:none;position:fixed;right:0;width:calc(100% - 24px);z-index:9999}.vyrn-toast{background-color:#fff;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;overflow:hidden;pointer-events:auto;position:relative;transition:all .2s ease;width:100%}.vyrn-toast-stacked{cursor:pointer;height:40px;margin-bottom:0;transform-origin:top}.vyrn-toast-content{align-items:center;display:flex;min-height:48px;padding:20px;width:100%}.vyrn-toast-icon{flex-shrink:0;height:16px;margin-right:8px;width:16px}.vyrn-toast-message{color:#000;flex-grow:1;font-size:13px;font-weight:400;line-height:1.5;margin:0;padding:0}.vyrn-toast-actions{display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 12px}.vyrn-toast-action{border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;padding:6px 12px;transition:all .2s ease}.vyrn-toast-action-default{background-color:#f1f3f5;color:#495057}.vyrn-toast-action-primary{background-color:#339af0;color:#fff}.vyrn-toast-action-secondary{background-color:#868e96;color:#fff}.vyrn-toast-action-danger{background-color:#fa5252;color:#fff}.vyrn-toast-input-form{display:flex;padding:0 16px 12px}.vyrn-toast-input{border:1px solid #e9ecef;border-radius:4px;flex-grow:1;font-size:13px;padding:8px 12px}.vyrn-toast-input-submit{background-color:#339af0;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:13px;font-weight:500;margin-left:8px;padding:8px 16px}.vyrn-toast-close{align-items:center;background:none;border:none;color:#868e96;cursor:pointer;display:flex;justify-content:center;padding:0;position:absolute;right:12px;top:50%;transform:translateY(-50%);transition:color .2s ease}.vyrn-toast-close:hover{color:#495057}.vyrn-toast-progress{background-color:rgba(51,154,240,.5);bottom:0;height:2px;left:0;position:absolute}.dark .vyrn-toast{background-color:#222}.dark .vyrn-toast-message{color:#e9ecef}.dark .vyrn-toast-action-default{background-color:#343a40;color:#f1f3f5}.dark .vyrn-toast-input{background-color:#343a40;border-color:#495057;color:#e9ecef}.dark .vyrn-toast-close{color:#adb5bd}.dark .vyrn-toast-close:hover{color:#e9ecef}@keyframes vyrn-toast-enter{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes vyrn-toast-exit{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}.vyrn-toast-enter{animation:vyrn-toast-enter .3s ease-out}.vyrn-toast-exit{animation:vyrn-toast-exit .3s ease-in}@media (max-width:640px){.vyrn-toast-container{bottom:0;left:0;padding:8px;right:0;width:calc(100% - 32px)}.vyrn-toast{border-radius:6px 6px 0 0}}",{insertAt:"top"});var p=function(o){var n=o.children,a=o.defaultPosition,l=void 0===a?"top-right":a,u=o.defaultLayout,d=void 0===u?"normal":u,p=o.maxToasts,m=void 0===p?5:p,g=o.containerClassName,h=void 0===g?"":g,y=o.showCloseButton,v=void 0===y||y,b=o.swipeDirection,x=void 0===b?"right":b,w=o.showProgressBar,k=void 0===w||w,E=t.useState([]),C=E[0],P=E[1],B=t.useState(l),N=B[0],T=B[1],S=t.useState(d),A=S[0],F=S[1],z=t.useCallback((function(t){var e=Math.random().toString(36).substr(2,9);return P((function(o){return s(s([],o,!0),[i(i({},t),{id:e})],!1).slice(-m)})),t.soundEffect&&new Audio(t.soundEffect).play().catch((function(t){return console.error("Error playing sound:",t)})),e}),[m]),D=t.useCallback((function(t){P((function(e){return e.filter((function(e){return e.id!==t}))}))}),[]),I=t.useCallback((function(t,e){P((function(o){return o.map((function(o){return o.id===t?i(i({},o),e):o}))}))}),[]),M=t.useCallback((function(){P([])}),[]),O=t.useMemo((function(){return{addToast:z,removeToast:D,updateToast:I,clearAllToasts:M,position:N,setPosition:T,layout:A,setLayout:F,showCloseButton:v,swipeDirection:x,showProgressBar:k}}),[z,D,I,M,N,A,v,x,k]),L=t.useState(!1),j=L[0],Y=L[1];return t.useEffect((function(){Y(!0)}),[]),r.default.createElement(c.Provider,{value:O},n,j&&e.createPortal(r.default.createElement(f,{toasts:C,position:N,layout:A,className:h,showCloseButton:v,swipeDirection:x,showProgressBar:k}),document.body))};exports.ClientToastProvider=function(t){var e=t.children,o=t.position,n=t.layout,a=void 0===n?"normal":n,i=t.maxToasts,s=t.containerClassName,c=t.showCloseButton,l=void 0===c||c,u=t.swipeDirection,d=void 0===u?"right":u,f=t.showProgressBar,m=void 0===f||f;return r.default.createElement(p,{defaultPosition:o,defaultLayout:a,maxToasts:i,containerClassName:s,showCloseButton:l,swipeDirection:d,showProgressBar:m},e)},exports.ToastProvider=p,exports.useToast=function(){var e=l(),o=e.addToast,n=e.removeToast,a=e.updateToast,r=e.clearAllToasts,s=e.position,c=e.setPosition,u=e.layout,d=e.setLayout,f=t.useCallback((function(t){return o(t)}),[o]),p=t.useCallback((function(t,e){a(t,e)}),[a]),m=t.useCallback((function(t){n(t)}),[n]),g=t.useCallback((function(){r()}),[r]),h=t.useCallback((function(t){c(t)}),[c]),y=t.useCallback((function(t){d(t)}),[d]);return{toast:f,update:p,dismiss:m,clearAll:g,changePosition:h,changeLayout:y,position:s,layout:u,default:function(t,e){return f(i({content:t,type:"default"},e))},info:function(t,e){return f(i({content:t,type:"info"},e))},success:function(t,e){return f(i({content:t,type:"success"},e))},warning:function(t,e){return f(i({content:t,type:"warning"},e))},error:function(t,e){return f(i({content:t,type:"error"},e))},custom:function(t,e){return f(i({content:t,type:"custom"},e))}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-dom"),o=require("lucide-react"),n=require("framer-motion");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=a(t),i=function(){return i=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var a in e=arguments[o])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},i.apply(this,arguments)};function s(t,e,o){if(o||2===arguments.length)for(var n,a=0,r=e.length;a<r;a++)!n&&a in e||(n||(n=Array.prototype.slice.call(e,0,a)),n[a]=e[a]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=r.default.createContext(void 0),l=function(){var t=r.default.useContext(c);if(void 0===t)throw new Error("useToastContext must be used within a ToastProvider");return t},u=function(t){var e=t.progress,o=t.type,a=void 0===o?"default":o,i=function(){var t={success:{base:"#10B981",highlight:"#34D399",glow:"rgba(16, 185, 129, 0.4)"},error:{base:"#EF4444",highlight:"#F87171",glow:"rgba(239, 68, 68, 0.4)"},warning:{base:"#F59E0B",highlight:"#FBBF24",glow:"rgba(245, 158, 11, 0.4)"},info:{base:"#3B82F6",highlight:"#60A5FA",glow:"rgba(59, 130, 246, 0.4)"},default:{base:"#6366F1",highlight:"#818CF8",glow:"rgba(99, 102, 241, 0.4)"}};return t[a]||t.default}();return r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",overflow:"hidden",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(8px)"}},r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,width:"100%",height:"100%",background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(2px)"}}),r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,height:"100%",background:"linear-gradient(90deg, \n ".concat(i.base,", \n ").concat(i.highlight,", \n ").concat(i.base,"\n )"),backgroundSize:"200% 100%",boxShadow:"0 0 10px ".concat(i.glow)},initial:{width:"100%",backgroundPosition:"0% 0%"},animate:{width:"".concat(e,"%"),backgroundPosition:["0% 0%","100% 0%"]},transition:{width:{duration:.4,ease:[.4,0,.2,1]},backgroundPosition:{duration:2,repeat:1/0,ease:"linear"}}},r.default.createElement(n.motion.div,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"linear-gradient(90deg,\n transparent 0%,\n ".concat(i.highlight,"40 50%,\n transparent 100%\n )"),transform:"translateX(-50%)"},animate:{x:["0%","200%"]},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),r.default.createElement(n.motion.div,{style:{position:"absolute",top:0,right:0,width:"2px",height:"100%",background:i.highlight,filter:"blur(0.5px)"},animate:{opacity:[1,.5,1],scale:[1,1.2,1]},transition:{duration:1,repeat:1/0,ease:"easeInOut"}})),r.default.createElement(n.motion.div,{style:{position:"absolute",bottom:0,left:0,width:"".concat(e,"%"),height:"100%",background:"linear-gradient(90deg,\n transparent,\n ".concat(i.glow,",\n transparent\n )"),filter:"blur(4px)"},animate:{opacity:[.3,.6,.3]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}}))},d=function(e){var a=e.id,s=e.content,c=e.type,d=e.duration,f=void 0===d?3e3:d,p=e.icon,m=e.actions,g=e.input,h=e.onClose,y=e.progress,v=e.customStyles,b=e.className,x=void 0===b?"":b,w=e.isExpanded,k=e.isStacked,E=e.showCloseButton,C=e.showProgressBar,P=l(),B=P.removeToast;P.updateToast;var N=t.useState(""),T=N[0],S=N[1],A=t.useState(y||100),F=A[0],z=A[1];t.useEffect((function(){if(void 0===y){var t=setInterval((function(){z((function(t){var e=t-100/(f/1e3);return e>0?e:0}))}),1e3);return function(){return clearInterval(t)}}}),[f,y]),t.useEffect((function(){0===F&&B(a)}),[F,a,B]),t.useEffect((function(){void 0!==y&&z(y)}),[y]);return r.default.createElement(n.motion.div,{className:"vyrn-toast ".concat(x," ").concat(k?"vyrn-toast-stacked":""," ").concat(c?"vyrn-toast-".concat(c):""),style:i(i({},v),{height:w?"auto":k?"60px":"auto",overflow:"hidden"}),initial:{opacity:0,y:50,scale:.3},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.5,transition:{duration:.2}},transition:{type:"spring",stiffness:500,damping:30}},r.default.createElement("div",{className:"vyrn-toast-content"},function(){if(p)return p;switch(c){case"success":return r.default.createElement(o.CheckCircle,{className:"vyrn-toast-icon text-green-500"});case"error":return r.default.createElement(o.AlertCircle,{className:"vyrn-toast-icon text-red-500"});case"info":return r.default.createElement(o.Info,{className:"vyrn-toast-icon text-blue-500"});case"warning":return r.default.createElement(o.AlertTriangle,{className:"vyrn-toast-icon text-yellow-500"});default:return null}}(),r.default.createElement("div",{className:"vyrn-toast-message"},s)),r.default.createElement(n.AnimatePresence,null,w&&r.default.createElement(n.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3}},m&&r.default.createElement("div",{className:"vyrn-toast-actions"},m.map((function(t,e){return r.default.createElement("button",{key:e,onClick:function(e){e.stopPropagation(),t.onClick()},className:"vyrn-toast-action vyrn-toast-action-".concat(t.style||"default"," ").concat(t.className||"")},t.label)}))),g&&r.default.createElement("form",{onSubmit:function(t){t.preventDefault(),null==g||g.onSubmit(T),S("")},className:"vyrn-toast-input-form"},r.default.createElement("input",{type:"text",value:T,onChange:function(t){return S(t.target.value)},placeholder:g.placeholder,className:"vyrn-toast-input ".concat(g.className||""),onClick:function(t){return t.stopPropagation()}}),r.default.createElement("button",{type:"submit",className:"vyrn-toast-input-submit ".concat(g.submitClassName||""),onClick:function(t){return t.stopPropagation()}},"Submit")))),E&&r.default.createElement("button",{className:"vyrn-toast-close",onClick:function(t){t.stopPropagation(),null==h||h(),B(a)},"aria-label":"Close"},r.default.createElement(o.X,{size:18})),C&&r.default.createElement(u,{progress:F,type:c}))},f=function(e){var o,a=e.toasts,c=e.position,l=e.layout,u=e.className,f=void 0===u?"":u,p=e.showCloseButton,m=void 0===p||p,g=e.swipeDirection,h=void 0===g?"right":g,y=e.showProgressBar,v=void 0===y||y,b=t.useState(!1),x=b[0],w=b[1],k=t.useRef(null),E=function(){var t=100;switch(h){case"left":return{x:-100,opacity:0};case"right":default:return{x:t,opacity:0};case"up":return{y:-100,opacity:0};case"down":return{y:t,opacity:0}}},C=function(t){return"normal"===l?c.startsWith("top")?t*(x?80:15):-t*(x?80:15):"stack"===l?x?80*t:18*t:0},P=s([],a,!0).reverse();return r.default.createElement("div",{className:"vyrn-toast-container ".concat(f),style:(o={position:"fixed",zIndex:9999},c.includes("top")&&(o.top="1rem"),c.includes("bottom")&&(o.bottom="3.5rem"),c.includes("left")&&(o.left="1rem"),c.includes("right")&&(o.right="1rem"),c.includes("center")&&(o.left="50%",o.transform="translateX(-50%)"),o),ref:k,onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)}},r.default.createElement(n.AnimatePresence,{mode:"sync"},P.map((function(t,e){var o,a;return r.default.createElement(n.motion.div,{key:t.id,layout:!0,initial:{opacity:0,y:c.startsWith("top")?-20:20,scale:.9},animate:{opacity:1,y:c.startsWith("top")?C(e):-C(e),scale:x?1.02:1,zIndex:"stack"===l?9999-e:9999,transition:{type:"spring",stiffness:500,damping:30}},exit:E(),drag:"left"===h||"right"===h?"x":"y",dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:.9,onDragEnd:function(e,o){var n;(Math.abs(o.offset.x)>100||Math.abs(o.offset.y)>100)&&(null===(n=t.onClose)||void 0===n||n.call(t))},style:{position:"normal"===l?"relative":"absolute",width:"100%",transformOrigin:c.startsWith("top")?"top":"bottom",marginBottom:"normal"===l?"0.25rem":0}},r.default.createElement(d,i({},t,{isExpanded:"stack"!==l||x,isStacked:"stack"===l&&!x,showCloseButton:null!==(o=t.showCloseButton)&&void 0!==o?o:m,showProgressBar:null!==(a=t.showProgressBar)&&void 0!==a?a:v})))}))))};!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===o&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}(".vyrn-toast-container{bottom:0;display:flex;flex-direction:column;gap:8px;max-width:356px;offset:32px;padding:12px;pointer-events:none;position:fixed;right:0;width:calc(100% - 24px);z-index:9999}.vyrn-toast{background-color:#fff;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;overflow:hidden;pointer-events:auto;position:relative;transition:all .2s ease;width:100%}.vyrn-toast-stacked{cursor:pointer;height:40px;margin-bottom:0;transform-origin:top}.vyrn-toast-content{align-items:center;display:flex;min-height:48px;padding:20px;width:100%}.vyrn-toast-icon{flex-shrink:0;height:16px;margin-right:8px;width:16px}.vyrn-toast-message{color:#000;flex-grow:1;font-size:13px;font-weight:400;line-height:1.5;margin:0;padding:0}.vyrn-toast-actions{display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 12px}.vyrn-toast-action{border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;padding:6px 12px;transition:all .2s ease}.vyrn-toast-action-default{background-color:#f1f3f5;color:#495057}.vyrn-toast-action-primary{background-color:#339af0;color:#fff}.vyrn-toast-action-secondary{background-color:#868e96;color:#fff}.vyrn-toast-action-danger{background-color:#fa5252;color:#fff}.vyrn-toast-input-form{display:flex;padding:0 16px 12px}.vyrn-toast-input{border:1px solid #e9ecef;border-radius:4px;flex-grow:1;font-size:13px;padding:8px 12px}.vyrn-toast-input-submit{background-color:#339af0;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:13px;font-weight:500;margin-left:8px;padding:8px 16px}.vyrn-toast-close{align-items:center;background:none;border:none;color:#868e96;cursor:pointer;display:flex;justify-content:center;padding:0;position:absolute;right:12px;top:50%;transform:translateY(-50%);transition:color .2s ease}.vyrn-toast-close:hover{color:#495057}.vyrn-toast-progress{background-color:rgba(51,154,240,.5);bottom:0;height:2px;left:0;position:absolute}.dark .vyrn-toast{background-color:#222}.dark .vyrn-toast-message{color:#e9ecef}.dark .vyrn-toast-action-default{background-color:#343a40;color:#f1f3f5}.dark .vyrn-toast-input{background-color:#343a40;border-color:#495057;color:#e9ecef}.dark .vyrn-toast-close{color:#adb5bd}.dark .vyrn-toast-close:hover{color:#e9ecef}@keyframes vyrn-toast-enter{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes vyrn-toast-exit{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}.vyrn-toast-enter{animation:vyrn-toast-enter .3s ease-out}.vyrn-toast-exit{animation:vyrn-toast-exit .3s ease-in}@media (max-width:640px){.vyrn-toast-container{bottom:0;left:0;padding:8px;right:0;width:calc(100% - 32px)}.vyrn-toast{border-radius:6px 6px 0 0}}",{insertAt:"top"});var p=function(o){var n=o.children,a=o.defaultPosition,l=void 0===a?"top-right":a,u=o.defaultLayout,d=void 0===u?"normal":u,p=o.maxToasts,m=void 0===p?5:p,g=o.containerClassName,h=void 0===g?"":g,y=o.showCloseButton,v=void 0===y||y,b=o.swipeDirection,x=void 0===b?"right":b,w=o.showProgressBar,k=void 0===w||w,E=t.useState([]),C=E[0],P=E[1],B=t.useState(l),N=B[0],T=B[1],S=t.useState(d),A=S[0],F=S[1],z=t.useCallback((function(t){var e=Math.random().toString(36).substr(2,9);return P((function(o){return s(s([],o,!0),[i(i({},t),{id:e})],!1).slice(-m)})),t.soundEffect&&new Audio(t.soundEffect).play().catch((function(t){return console.error("Error playing sound:",t)})),e}),[m]),D=t.useCallback((function(t){P((function(e){return e.filter((function(e){return e.id!==t}))}))}),[]),I=t.useCallback((function(t,e){P((function(o){return o.map((function(o){return o.id===t?i(i({},o),e):o}))}))}),[]),M=t.useCallback((function(){P([])}),[]),O=t.useMemo((function(){return{addToast:z,removeToast:D,updateToast:I,clearAllToasts:M,position:N,setPosition:T,layout:A,setLayout:F,showCloseButton:v,swipeDirection:x,showProgressBar:k}}),[z,D,I,M,N,A,v,x,k]),L=t.useState(!1),j=L[0],Y=L[1];return t.useEffect((function(){Y(!0)}),[]),r.default.createElement(c.Provider,{value:O},n,j&&e.createPortal(r.default.createElement(f,{toasts:C,position:N,layout:A,className:h,showCloseButton:v,swipeDirection:x,showProgressBar:k}),document.body))};exports.ClientToastProvider=function(t){var e=t.children,o=t.position,n=t.layout,a=void 0===n?"normal":n,i=t.maxToasts,s=t.containerClassName,c=t.showCloseButton,l=void 0===c||c,u=t.swipeDirection,d=void 0===u?"right":u,f=t.showProgressBar,m=void 0===f||f;return r.default.createElement(p,{defaultPosition:o,defaultLayout:a,maxToasts:i,containerClassName:s,showCloseButton:l,swipeDirection:d,showProgressBar:m},e)},exports.ToastProvider=p,exports.useToast=function(){var e=l(),o=e.addToast,n=e.removeToast,a=e.updateToast,r=e.clearAllToasts,s=e.position,c=e.setPosition,u=e.layout,d=e.setLayout,f=t.useCallback((function(t){return o(t)}),[o]),p=t.useCallback((function(t,e){a(t,e)}),[a]),m=t.useCallback((function(t){n(t)}),[n]),g=t.useCallback((function(){r()}),[r]),h=t.useCallback((function(t){c(t)}),[c]),y=t.useCallback((function(t){d(t)}),[d]);return{toast:f,update:p,dismiss:m,clearAll:g,changePosition:h,changeLayout:y,position:s,layout:u,default:function(t,e){return f(i({content:t,type:"default"},e))},info:function(t,e){return f(i({content:t,type:"info"},e))},success:function(t,e){return f(i({content:t,type:"success"},e))},warning:function(t,e){return f(i({content:t,type:"warning"},e))},error:function(t,e){return f(i({content:t,type:"error"},e))},custom:function(t,e){return f(i({content:t,type:"custom"},e))}}};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"s8PAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D"}
1
+ {"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"y8PAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vyrn",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A modern, customizable toast library for React and Next.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",