solid-toast
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
"use strict";var t=Object.defineProperty,e=Object.defineProperties,o=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,o,s)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[o]=s,n=(t,e)=>{for(var o in e||(e={}))r.call(e,o)&&a(t,o,e[o]);if(s)for(var o of s(e))i.call(e,o)&&a(t,o,e[o]);return t},l=(t,s)=>e(t,o(s));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=require("solid-js"),p=require("goober"),d=require("solid-js/web");const y=(t,e)=>(t=>"function"==typeof t)(t)?t(e):t;var u=(t=>(t[t.ADD_TOAST=0]="ADD_TOAST",t[t.UPDATE_TOAST=1]="UPDATE_TOAST",t[t.UPSERT_TOAST=2]="UPSERT_TOAST",t[t.DISMISS_TOAST=3]="DISMISS_TOAST",t[t.REMOVE_TOAST=4]="REMOVE_TOAST",t[t.START_PAUSE=5]="START_PAUSE",t[t.END_PAUSE=6]="END_PAUSE",t))(u||{});const[m,f]=c.createSignal({toasts:[],pausedAt:void 0});c.createEffect((()=>{const{pausedAt:t,toasts:e}=m();if(t)return;const o=Date.now(),s=e.map((t=>{if(t.duration===1/0)return;const e=(t.duration||0)+t.pauseDuration-(o-t.createdAt);if(!(e<=0))return setTimeout((()=>{v({type:u.DISMISS_TOAST,toastId:t.id})}),e);t.visible&&v({type:u.DISMISS_TOAST,toastId:t.id})}));c.onCleanup((()=>{s.forEach((t=>t&&clearTimeout(t)))}))}));const g=new Map,S=(t,e)=>{if(g.has(t))return;const o=setTimeout((()=>{g.delete(t),v({type:u.REMOVE_TOAST,toastId:t})}),e);g.set(t,o)},v=t=>{switch(t.type){case u.ADD_TOAST:f((e=>l(n({},e),{toasts:[t.toast,...e.toasts]})));break;case u.DISMISS_TOAST:const{toastId:e}=t,o=m().toasts;if(e){const t=o.find((t=>t.id===e));t&&S(e,t.unmountDelay)}else o.forEach((t=>{S(t.id,t.unmountDelay)}));f((t=>l(n({},t),{toasts:t.toasts.map((t=>t.id===e?l(n({},t),{visible:!1}):t))})));break;case u.REMOVE_TOAST:if(!t.toastId){f((t=>l(n({},t),{toasts:[]})));break}f((e=>l(n({},e),{toasts:e.toasts.filter((e=>e.id!==t.toastId))})));break;case u.UPDATE_TOAST:t.toast.id&&(t=>{const e=g.get(t);g.delete(t),e&&clearTimeout(e)})(t.toast.id),f((e=>l(n({},e),{toasts:e.toasts.map((e=>e.id===t.toast.id?l(n(n({},e),t.toast),{updatedAt:t.silent?void 0:Date.now()}):e))})));break;case u.UPSERT_TOAST:m().toasts.find((e=>e.id===t.toast.id))?v({type:u.UPDATE_TOAST,toast:t.toast}):v({type:u.ADD_TOAST,toast:t.toast});break;case u.START_PAUSE:f((e=>l(n({},e),{pausedAt:t.time})));break;case u.END_PAUSE:const s=t.time-(m().pausedAt||0);f((t=>l(n({},t),{pausedAt:void 0,toasts:t.toasts.map((t=>l(n({},t),{pauseDuration:t.pauseDuration+s})))})))}},h={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},T={id:"",icon:"",unmountDelay:500,duration:3e3,ariaProps:{role:"status","aria-live":"polite"},className:"",style:{},position:"top-right"},b={position:"top-right",toastOptions:T,gutter:8,containerStyle:{},containerClassName:""},P={position:"fixed",zIndex:9999,top:"16px",bottom:"16px",left:"16px",right:"16px","pointer-events":"none"},x=(()=>{let t=0;return()=>String(++t)})(),A=(t,e)=>(t.position||e).includes("top")?1:-1,O={display:"flex","align-items":"center",background:"white",color:"#363636","box-shadow":"0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05)","max-width":"350px","pointer-events":"auto",padding:"8px 10px","border-radius":"4px","line-height":"1.3","will-change":"transform"},_={display:"flex","align-items":"center",flex:"1 1 auto",margin:"4px 10px","white-space":"pre-line"},w={"flex-shrink":0,width:"20px",height:"20px"},k=p.keyframes`from {transform: scale(0) rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`,E=p.keyframes`75%,100%{transform: scale(2.25);opacity:0;}`,D=p.keyframes`to{stroke-dashoffset: 0;}`,C=p.keyframes`0%{transform:translate3d(0,0,0);opacity:1;}100%{transform:translate3d(0,7px,0)scale(1);opacity:1;}`,$=p.keyframes`from{transform: rotate(0deg);}to{transform: rotate(360deg);}`,[I,M]=c.createSignal(b),N=t=>(e,o={})=>{const s=m().toasts.find((t=>t.id===o.id)),r=((t,e="blank",o)=>{var s,r,i;return l(n(n(n({},T),I().toastOptions),o),{type:e,message:t,pauseDuration:0,createdAt:Date.now(),visible:!0,id:o.id||x(),style:n(n(n({},T.style),null==(s=I().toastOptions)?void 0:s.style),o.style),duration:o.duration||(null==(r=I().toastOptions)?void 0:r.duration)||h[e],position:o.position||(null==(i=I().toastOptions)?void 0:i.position)||I().position||T.position})})(e,t,n(l(n({},s),{duration:void 0}),o));return v({type:u.UPSERT_TOAST,toast:r}),r.id},F=(t,e)=>N("blank")(t,e);F.error=N("error"),F.success=N("success"),F.loading=N("loading"),F.custom=N("custom"),F.dismiss=t=>{v({type:u.DISMISS_TOAST,toastId:t})},F.promise=(t,e,o)=>{const s=F.loading(e.loading,n({},o));return t.then((t=>(F.success(y(e.success,t),n({id:s},o)),t))).catch((t=>{F.error(y(e.error,t),n({id:s},o))})),t},F.remove=t=>{v({type:u.REMOVE_TOAST,toastId:t})};const U=d.template("<div></div>",2),R=d.template("<div></div>",2),j=d.template("<div><div></div></div>",4),z=t=>{const e=y(t.toast.message,t.toast),[o,s]=c.createSignal("");return c.createEffect((()=>{var e;t.toast.visible&&!t.toast.updatedAt&&s(`${p.keyframes((e=A(t.toast,t.position),`\n0% {transform: translate3d(0,${-200*e}%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n`))} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`),!t.toast.visible&&s(`${p.keyframes((t=>`\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,${-150*t}%,-1px) scale(.4); opacity:0;}\n`)(A(t.toast,t.position)))} 0.4s forwards cubic-bezier(.06,.71,.55,1)`)})),console.log(t.toast),(()=>{const s=j.cloneNode(!0),r=s.firstChild;return d.insert(s,d.createComponent(c.Switch,{get children(){return[d.createComponent(c.Match,{get when(){return"loading"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(L,{})),t}}),d.createComponent(c.Match,{get when(){return"success"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(G,{})),t}}),d.createComponent(c.Match,{get when(){return"error"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(J,{})),t}})]}}),r),d.style(r,_),d.spread(r,(()=>t.toast.ariaProps),!1,!0),d.insert(r,e),d.effect((t=>d.style(s,l(n({},O),{animation:o()}),t))),s})()},B=d.template("<div></div>",2),V=p.css`z-index: 9999;> * { pointer-events: auto;}`,q=t=>{const e=()=>{const e=t.toast.position||T.position,o=((t,e)=>{const{toasts:o}=m(),s=I().gutter||b.gutter||8,r=o.filter((t=>(t.position||e)===e&&t.height)),i=r.findIndex((e=>e.id===t.id)),a=r.filter(((t,e)=>e<i&&t.visible)).length;return r.slice(0,a).reduce(((t,e)=>t+s+(e.height||0)),0)})(t.toast,e),s=((t,e)=>{const o=t.includes("top"),s=o?{top:0}:{bottom:0},r=t.includes("center")?{"justify-content":"center"}:t.includes("right")?{"justify-content":"flex-end"}:{};return n(n({left:0,right:0,display:"flex",position:"absolute",transition:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(o?1:-1)}px)`},s),r)})(e,o);return s},[o,s]=c.createSignal(e());let r;return c.createEffect(c.on(m,(()=>{const t=e();s(t)}))),c.onMount((()=>{r&&((t,e)=>{const o=t.getBoundingClientRect();o.height!==e.height&&v({type:u.UPDATE_TOAST,toast:{id:e.id,height:o.height},silent:!0})})(r,t.toast)})),(()=>{const e=B.cloneNode(!0);return"function"==typeof r?r(e):r=e,d.insert(e,(()=>{const e=d.memo((()=>"custom"===t.toast.type),!0);return()=>e()?y(t.toast.message,t.toast):d.createComponent(z,{get toast(){return t.toast},get position(){return t.toast.position||T.position}})})()),d.effect((s=>{const r=o(),i=t.toast.visible?V:"";return s._v$=d.style(e,r,s._v$),i!==s._v$2&&d.className(e,s._v$2=i),s}),{_v$:void 0,_v$2:void 0}),e})()},Y=d.template('<svg viewBox="0 0 32 32"><circle fill="#34C759" cx="16" cy="16" r="16"></circle><circle fill="#34C759" cx="16" cy="16" r="12"></circle><path fill="none" stroke="#FCFCFC" stroke-width="4" stroke-linecap="round" stroke-miterlimit="10" d="M9.8,17.2l3.8,3.6c0.1,0.1,0.3,0.1,0.4,0l9.6-9.7"></path></svg>',8),G=()=>{const t=`${k} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,e=`${E} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,o=`${D} 0.2s ease-out forwards`;return(()=>{const s=Y.cloneNode(!0),r=s.firstChild,i=r.nextSibling,a=i.nextSibling;return s.style.setProperty("overflow","visible"),r.style.setProperty("animation",t),r.style.setProperty("transform-origin","50% 50%"),r.style.setProperty("animation-delay","100ms"),r.style.setProperty("opacity","0"),i.style.setProperty("animation",e),i.style.setProperty("transform-origin","50% 50%"),i.style.setProperty("animation-delay","250ms"),a.style.setProperty("animation",o),a.style.setProperty("stroke-dasharray","22"),a.style.setProperty("stroke-dashoffset","22"),a.style.setProperty("animation-delay","250ms"),s})()},H=d.template('<svg viewBox="0 0 32 32"><circle fill="#FF3B30" cx="16" cy="16" r="16"></circle><circle fill="#FF3B30" cx="16" cy="16" r="12"></circle><path fill="none" stroke="#FCFCFC" stroke-width="4" stroke-linecap="round" d="M16,7l0,9"></path><circle fill="#FFFFFF" cx="16" cy="16" r="2.5"></circle></svg>',10),J=()=>{const t=`${k} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,e=`${E} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,o=`${D} 0.1s ease-in forwards`,s=`${C} 0.2s ease-out forwards`;return(()=>{const r=H.cloneNode(!0),i=r.firstChild,a=i.nextSibling,n=a.nextSibling,l=n.nextSibling;return r.style.setProperty("overflow","visible"),i.style.setProperty("animation",t),i.style.setProperty("transform-origin","50% 50%"),i.style.setProperty("animation-delay","100ms"),i.style.setProperty("opacity","0"),a.style.setProperty("animation",e),a.style.setProperty("transform-origin","50% 50%"),a.style.setProperty("animation-delay","320ms"),n.style.setProperty("animation",o),n.style.setProperty("stroke-dasharray","9"),n.style.setProperty("stroke-dashoffset","9"),n.style.setProperty("animation-delay","200ms"),l.style.setProperty("animation",s),l.style.setProperty("animation-delay","320ms"),l.style.setProperty("opacity","0"),r})()},K=d.template('<svg viewBox="0 0 32 32"><path fill="none" stroke="#E5E7EB" stroke-width="4" stroke-miterlimit="10" d="M16,6c3,0,5.7,1.3,7.5,3.4c1.5,1.8,2.5,4,2.5,6.6c0,5.5-4.5,10-10,10S6,21.6,6,16S10.5,6,16,6z"></path><path fill="none" stroke="#4b5563" stroke-width="4" stroke-linecap="round" stroke-miterlimit="10" d="M16,6c3,0,5.7,1.3,7.5,3.4c0.6,0.7,1.1,1.4,1.5,2.2"></path></svg>',6),L=()=>{const t=`${$} 0.75s linear infinite`;return(()=>{const e=K.cloneNode(!0),o=e.firstChild.nextSibling;return e.style.setProperty("overflow","visible"),o.style.setProperty("animation",t),o.style.setProperty("transform-origin","50% 50%"),e})()};exports.ActionType=u,exports.Toaster=t=>(c.createEffect((()=>{(t=>{M((e=>{var o,s,r,i;return{containerClassName:null!=(o=t.containerClassName)?o:e.containerClassName,containerStyle:null!=(s=t.containerStyle)?s:e.containerStyle,gutter:null!=(r=t.gutter)?r:e.gutter,position:null!=(i=t.position)?i:e.position,toastOptions:n({},t.toastOptions)}}))})(t)})),(()=>{const e=U.cloneNode(!0);return d.insert(e,d.createComponent(c.For,{get each(){return m().toasts},children:t=>d.createComponent(q,{toast:t})})),d.effect((o=>{const s=n(n({},P),t.containerStyle),r=t.containerClassName;return o._v$=d.style(e,s,o._v$),r!==o._v$2&&d.className(e,o._v$2=r),o}),{_v$:void 0,_v$2:void 0}),e})()),exports.default=F,exports.resolveValue=y,exports.toast=F; | ||
"use strict";var t=Object.defineProperty,e=Object.defineProperties,o=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,o,s)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[o]=s,n=(t,e)=>{for(var o in e||(e={}))r.call(e,o)&&a(t,o,e[o]);if(s)for(var o of s(e))i.call(e,o)&&a(t,o,e[o]);return t},l=(t,s)=>e(t,o(s));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=require("solid-js"),p=require("goober"),d=require("solid-js/web");const y=(t,e)=>(t=>"function"==typeof t)(t)?t(e):t;var u=(t=>(t[t.ADD_TOAST=0]="ADD_TOAST",t[t.UPDATE_TOAST=1]="UPDATE_TOAST",t[t.UPSERT_TOAST=2]="UPSERT_TOAST",t[t.DISMISS_TOAST=3]="DISMISS_TOAST",t[t.REMOVE_TOAST=4]="REMOVE_TOAST",t[t.START_PAUSE=5]="START_PAUSE",t[t.END_PAUSE=6]="END_PAUSE",t))(u||{});const[m,f]=c.createSignal({toasts:[],pausedAt:void 0});c.createEffect((()=>{const{pausedAt:t,toasts:e}=m();if(t)return;const o=Date.now(),s=e.map((t=>{if(t.duration===1/0)return;const e=(t.duration||0)+t.pauseDuration-(o-t.createdAt);if(!(e<=0))return setTimeout((()=>{v({type:u.DISMISS_TOAST,toastId:t.id})}),e);t.visible&&v({type:u.DISMISS_TOAST,toastId:t.id})}));c.onCleanup((()=>{s.forEach((t=>t&&clearTimeout(t)))}))}));const g=new Map,S=(t,e)=>{if(g.has(t))return;const o=setTimeout((()=>{g.delete(t),v({type:u.REMOVE_TOAST,toastId:t})}),e);g.set(t,o)},v=t=>{switch(t.type){case u.ADD_TOAST:f((e=>l(n({},e),{toasts:[t.toast,...e.toasts]})));break;case u.DISMISS_TOAST:const{toastId:e}=t,o=m().toasts;if(e){const t=o.find((t=>t.id===e));t&&S(e,t.unmountDelay)}else o.forEach((t=>{S(t.id,t.unmountDelay)}));f((t=>l(n({},t),{toasts:t.toasts.map((t=>t.id===e?l(n({},t),{visible:!1}):t))})));break;case u.REMOVE_TOAST:if(!t.toastId){f((t=>l(n({},t),{toasts:[]})));break}f((e=>l(n({},e),{toasts:e.toasts.filter((e=>e.id!==t.toastId))})));break;case u.UPDATE_TOAST:t.toast.id&&(t=>{const e=g.get(t);g.delete(t),e&&clearTimeout(e)})(t.toast.id),f((e=>l(n({},e),{toasts:e.toasts.map((e=>e.id===t.toast.id?l(n(n({},e),t.toast),{updatedAt:t.silent?void 0:Date.now()}):e))})));break;case u.UPSERT_TOAST:m().toasts.find((e=>e.id===t.toast.id))?v({type:u.UPDATE_TOAST,toast:t.toast}):v({type:u.ADD_TOAST,toast:t.toast});break;case u.START_PAUSE:f((e=>l(n({},e),{pausedAt:t.time})));break;case u.END_PAUSE:const s=t.time-(m().pausedAt||0);f((t=>l(n({},t),{pausedAt:void 0,toasts:t.toasts.map((t=>l(n({},t),{pauseDuration:t.pauseDuration+s})))})))}},h={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},T={id:"",icon:"",unmountDelay:500,duration:3e3,ariaProps:{role:"status","aria-live":"polite"},className:"",style:{},position:"top-right"},b={position:"top-right",toastOptions:T,gutter:8,containerStyle:{},containerClassName:""},P={position:"fixed","z-index":9999,top:"16px",bottom:"16px",left:"16px",right:"16px","pointer-events":"none"},x=(()=>{let t=0;return()=>String(++t)})(),A=(t,e)=>(t.position||e).includes("top")?1:-1,O={display:"flex","align-items":"center",background:"white",color:"#363636","box-shadow":"0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05)","max-width":"350px","pointer-events":"auto",padding:"8px 10px","border-radius":"4px","line-height":"1.3","will-change":"transform"},_={display:"flex","align-items":"center",flex:"1 1 auto",margin:"4px 10px","white-space":"pre-line"},w={"flex-shrink":0,width:"20px",height:"20px"},k=p.keyframes`from {transform: scale(0) rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`,E=p.keyframes`75%,100%{transform: scale(2.25);opacity:0;}`,D=p.keyframes`to{stroke-dashoffset: 0;}`,C=p.keyframes`0%{transform:translate3d(0,0,0);opacity:1;}100%{transform:translate3d(0,7px,0)scale(1);opacity:1;}`,$=p.keyframes`from{transform: rotate(0deg);}to{transform: rotate(360deg);}`,[I,M]=c.createSignal(b),N=t=>(e,o={})=>{const s=m().toasts.find((t=>t.id===o.id)),r=((t,e="blank",o)=>{var s,r,i;return l(n(n(n({},T),I().toastOptions),o),{type:e,message:t,pauseDuration:0,createdAt:Date.now(),visible:!0,id:o.id||x(),style:n(n(n({},T.style),null==(s=I().toastOptions)?void 0:s.style),o.style),duration:o.duration||(null==(r=I().toastOptions)?void 0:r.duration)||h[e],position:o.position||(null==(i=I().toastOptions)?void 0:i.position)||I().position||T.position})})(e,t,n(l(n({},s),{duration:void 0}),o));return v({type:u.UPSERT_TOAST,toast:r}),r.id},F=(t,e)=>N("blank")(t,e);F.error=N("error"),F.success=N("success"),F.loading=N("loading"),F.custom=N("custom"),F.dismiss=t=>{v({type:u.DISMISS_TOAST,toastId:t})},F.promise=(t,e,o)=>{const s=F.loading(e.loading,n({},o));return t.then((t=>(F.success(y(e.success,t),n({id:s},o)),t))).catch((t=>{F.error(y(e.error,t),n({id:s},o))})),t},F.remove=t=>{v({type:u.REMOVE_TOAST,toastId:t})};const U=d.template("<div></div>",2),R=d.template("<div></div>",2),j=d.template("<div><div></div></div>",4),z=t=>{const e=y(t.toast.message,t.toast),[o,s]=c.createSignal("");return c.createEffect((()=>{var e;t.toast.visible&&!t.toast.updatedAt&&s(`${p.keyframes((e=A(t.toast,t.position),`\n0% {transform: translate3d(0,${-200*e}%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n`))} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`),!t.toast.visible&&s(`${p.keyframes((t=>`\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,${-150*t}%,-1px) scale(.4); opacity:0;}\n`)(A(t.toast,t.position)))} 0.4s forwards cubic-bezier(.06,.71,.55,1)`)})),console.log(t.toast),(()=>{const s=j.cloneNode(!0),r=s.firstChild;return d.insert(s,d.createComponent(c.Switch,{get children(){return[d.createComponent(c.Match,{get when(){return"loading"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(L,{})),t}}),d.createComponent(c.Match,{get when(){return"success"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(G,{})),t}}),d.createComponent(c.Match,{get when(){return"error"===t.toast.type},get children(){const t=R.cloneNode(!0);return d.style(t,w),d.insert(t,d.createComponent(J,{})),t}})]}}),r),d.style(r,_),d.spread(r,(()=>t.toast.ariaProps),!1,!0),d.insert(r,e),d.effect((t=>d.style(s,l(n({},O),{animation:o()}),t))),s})()},B=d.template("<div></div>",2),V=p.css`z-index: 9999;> * { pointer-events: auto;}`,q=t=>{const e=()=>{const e=t.toast.position||T.position,o=((t,e)=>{const{toasts:o}=m(),s=I().gutter||b.gutter||8,r=o.filter((t=>(t.position||e)===e&&t.height)),i=r.findIndex((e=>e.id===t.id)),a=r.filter(((t,e)=>e<i&&t.visible)).length;return r.slice(0,a).reduce(((t,e)=>t+s+(e.height||0)),0)})(t.toast,e),s=((t,e)=>{const o=t.includes("top"),s=o?{top:0}:{bottom:0},r=t.includes("center")?{"justify-content":"center"}:t.includes("right")?{"justify-content":"flex-end"}:{};return n(n({left:0,right:0,display:"flex",position:"absolute",transition:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(o?1:-1)}px)`},s),r)})(e,o);return s},[o,s]=c.createSignal(e());let r;return c.createEffect(c.on(m,(()=>{const t=e();s(t)}))),c.onMount((()=>{r&&((t,e)=>{const o=t.getBoundingClientRect();o.height!==e.height&&v({type:u.UPDATE_TOAST,toast:{id:e.id,height:o.height},silent:!0})})(r,t.toast)})),(()=>{const e=B.cloneNode(!0);return"function"==typeof r?r(e):r=e,d.insert(e,(()=>{const e=d.memo((()=>"custom"===t.toast.type),!0);return()=>e()?y(t.toast.message,t.toast):d.createComponent(z,{get toast(){return t.toast},get position(){return t.toast.position||T.position}})})()),d.effect((s=>{const r=o(),i=t.toast.visible?V:"";return s._v$=d.style(e,r,s._v$),i!==s._v$2&&d.className(e,s._v$2=i),s}),{_v$:void 0,_v$2:void 0}),e})()},Y=d.template('<svg viewBox="0 0 32 32"><circle fill="#34C759" cx="16" cy="16" r="16"></circle><circle fill="#34C759" cx="16" cy="16" r="12"></circle><path fill="none" stroke="#FCFCFC" stroke-width="4" stroke-linecap="round" stroke-miterlimit="10" d="M9.8,17.2l3.8,3.6c0.1,0.1,0.3,0.1,0.4,0l9.6-9.7"></path></svg>',8),G=()=>{const t=`${k} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,e=`${E} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,o=`${D} 0.2s ease-out forwards`;return(()=>{const s=Y.cloneNode(!0),r=s.firstChild,i=r.nextSibling,a=i.nextSibling;return s.style.setProperty("overflow","visible"),r.style.setProperty("animation",t),r.style.setProperty("transform-origin","50% 50%"),r.style.setProperty("animation-delay","100ms"),r.style.setProperty("opacity","0"),i.style.setProperty("animation",e),i.style.setProperty("transform-origin","50% 50%"),i.style.setProperty("animation-delay","250ms"),a.style.setProperty("animation",o),a.style.setProperty("stroke-dasharray","22"),a.style.setProperty("stroke-dashoffset","22"),a.style.setProperty("animation-delay","250ms"),s})()},H=d.template('<svg viewBox="0 0 32 32"><circle fill="#FF3B30" cx="16" cy="16" r="16"></circle><circle fill="#FF3B30" cx="16" cy="16" r="12"></circle><path fill="none" stroke="#FCFCFC" stroke-width="4" stroke-linecap="round" d="M16,7l0,9"></path><circle fill="#FFFFFF" cx="16" cy="16" r="2.5"></circle></svg>',10),J=()=>{const t=`${k} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,e=`${E} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,o=`${D} 0.1s ease-in forwards`,s=`${C} 0.2s ease-out forwards`;return(()=>{const r=H.cloneNode(!0),i=r.firstChild,a=i.nextSibling,n=a.nextSibling,l=n.nextSibling;return r.style.setProperty("overflow","visible"),i.style.setProperty("animation",t),i.style.setProperty("transform-origin","50% 50%"),i.style.setProperty("animation-delay","100ms"),i.style.setProperty("opacity","0"),a.style.setProperty("animation",e),a.style.setProperty("transform-origin","50% 50%"),a.style.setProperty("animation-delay","320ms"),n.style.setProperty("animation",o),n.style.setProperty("stroke-dasharray","9"),n.style.setProperty("stroke-dashoffset","9"),n.style.setProperty("animation-delay","200ms"),l.style.setProperty("animation",s),l.style.setProperty("animation-delay","320ms"),l.style.setProperty("opacity","0"),r})()},K=d.template('<svg viewBox="0 0 32 32"><path fill="none" stroke="#E5E7EB" stroke-width="4" stroke-miterlimit="10" d="M16,6c3,0,5.7,1.3,7.5,3.4c1.5,1.8,2.5,4,2.5,6.6c0,5.5-4.5,10-10,10S6,21.6,6,16S10.5,6,16,6z"></path><path fill="none" stroke="#4b5563" stroke-width="4" stroke-linecap="round" stroke-miterlimit="10" d="M16,6c3,0,5.7,1.3,7.5,3.4c0.6,0.7,1.1,1.4,1.5,2.2"></path></svg>',6),L=()=>{const t=`${$} 0.75s linear infinite`;return(()=>{const e=K.cloneNode(!0),o=e.firstChild.nextSibling;return e.style.setProperty("overflow","visible"),o.style.setProperty("animation",t),o.style.setProperty("transform-origin","50% 50%"),e})()};exports.ActionType=u,exports.Toaster=t=>(c.createEffect((()=>{(t=>{M((e=>{var o,s,r,i;return{containerClassName:null!=(o=t.containerClassName)?o:e.containerClassName,containerStyle:null!=(s=t.containerStyle)?s:e.containerStyle,gutter:null!=(r=t.gutter)?r:e.gutter,position:null!=(i=t.position)?i:e.position,toastOptions:n({},t.toastOptions)}}))})(t)})),(()=>{const e=U.cloneNode(!0);return d.insert(e,d.createComponent(c.For,{get each(){return m().toasts},children:t=>d.createComponent(q,{toast:t})})),d.effect((o=>{const s=n(n({},P),t.containerStyle),r=t.containerClassName;return o._v$=d.style(e,s,o._v$),r!==o._v$2&&d.className(e,o._v$2=r),o}),{_v$:void 0,_v$2:void 0}),e})()),exports.default=F,exports.resolveValue=y,exports.toast=F; |
@@ -179,3 +179,3 @@ var __defProp = Object.defineProperty; | ||
position: "fixed", | ||
zIndex: 9999, | ||
"z-index": 9999, | ||
top: defaultContainerPadding, | ||
@@ -182,0 +182,0 @@ bottom: defaultContainerPadding, |
{ | ||
"name": "solid-toast", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Customizable Toast Notifications for SolidJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/solid-toast.cjs.js", |
@@ -38,3 +38,3 @@ import { ToasterProps, ToastOptions, ToastTimeouts } from "../types"; | ||
position: 'fixed', | ||
zIndex: 9999, | ||
'z-index': 9999, | ||
top: defaultContainerPadding, | ||
@@ -41,0 +41,0 @@ bottom: defaultContainerPadding, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54808