solid-toast
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -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","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; | ||
"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((()=>{h({type:u.DISMISS_TOAST,toastId:t.id})}),e);t.visible&&h({type:u.DISMISS_TOAST,toastId:t.id})}));c.onCleanup((()=>{s.forEach((t=>t&&clearTimeout(t)))}))}));const v=new Map,g=(t,e)=>{if(v.has(t))return;const o=setTimeout((()=>{v.delete(t),h({type:u.REMOVE_TOAST,toastId:t})}),e);v.set(t,o)},h=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&&g(e,t.unmountDelay)}else o.forEach((t=>{g(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=v.get(t);v.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))?h({type:u.UPDATE_TOAST,toast:t.toast}):h({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})))})))}},S={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},_={id:"",icon:"",unmountDelay:500,duration:3e3,ariaProps:{role:"status","aria-live":"polite"},className:"",style:{},position:"top-right",iconTheme:{}},T={position:"top-right",toastOptions:_,gutter:8,containerStyle:{},containerClassName:""},b={position:"fixed","z-index":9999,top:"16px",bottom:"16px",left:"16px",right:"16px","pointer-events":"none"},A=(()=>{let t=0;return()=>String(++t)})(),$=(t,e)=>(t.position||e).includes("top")?1:-1,P={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"},x={display:"flex","align-items":"center",flex:"1 1 auto",margin:"4px 10px","white-space":"pre-line"},O={"flex-shrink":0,width:"20px",height:"20px"},w=p.keyframes`from{transform:scale(0)rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`,k=p.keyframes`75%,100%{transform: scale(2.25);opacity:0;}`,E=p.keyframes`to{stroke-dashoffset: 0;}`,D=p.keyframes`0%{transform:translate3d(0,0,0);opacity:1;}100%{transform:translate3d(0,7px,0)scale(1);opacity:1;}`,C=p.keyframes`from{transform: rotate(0deg);}to{transform: rotate(360deg);}`,[M,N]=c.createSignal(T),I=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({},_),M().toastOptions),o),{type:e,message:t,pauseDuration:0,createdAt:Date.now(),visible:!0,id:o.id||A(),style:n(n(n({},_.style),null==(s=M().toastOptions)?void 0:s.style),o.style),duration:o.duration||(null==(r=M().toastOptions)?void 0:r.duration)||S[e],position:o.position||(null==(i=M().toastOptions)?void 0:i.position)||M().position||_.position})})(e,t,n(l(n({},s),{duration:void 0}),o));return h({type:u.UPSERT_TOAST,toast:r}),r.id},F=(t,e)=>I("blank")(t,e);F.error=I("error"),F.success=I("success"),F.loading=I("loading"),F.custom=I("custom"),F.dismiss=t=>{h({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=>{h({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=$(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`)($(t.toast,t.position)))} 0.4s forwards cubic-bezier(.06,.71,.55,1)`)})),(()=>{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 t.toast.icon},get children(){const e=R.cloneNode(!0);return d.style(e,O),d.insert(e,(()=>t.toast.icon)),e}}),d.createComponent(c.Match,{get when(){return"loading"===t.toast.type},get children(){const e=R.cloneNode(!0);return d.style(e,O),d.insert(e,d.createComponent(L,d.mergeProps((()=>t.toast.iconTheme)))),e}}),d.createComponent(c.Match,{get when(){return"success"===t.toast.type},get children(){const e=R.cloneNode(!0);return d.style(e,O),d.insert(e,d.createComponent(G,d.mergeProps((()=>t.toast.iconTheme)))),e}}),d.createComponent(c.Match,{get when(){return"error"===t.toast.type},get children(){const e=R.cloneNode(!0);return d.style(e,O),d.insert(e,d.createComponent(J,d.mergeProps((()=>t.toast.iconTheme)))),e}})]}}),r),d.style(r,x),d.spread(r,(()=>t.toast.ariaProps),!1,!0),d.insert(r,e),d.effect((e=>{const r=t.toast.className,i=n(l(n({},P),{animation:o()}),t.toast.style);return r!==e._v$&&d.className(s,e._v$=r),e._v$2=d.style(s,i,e._v$2),e}),{_v$:void 0,_v$2:void 0}),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||_.position,o=((t,e)=>{const{toasts:o}=m(),s=M().gutter||T.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&&h({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||_.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 cx="16" cy="16" r="16"></circle><circle cx="16" cy="16" r="12"></circle><path fill="none" 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=t=>{const e=`${w} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,o=`${k} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,s=`${E} 0.2s ease-out forwards`;return(()=>{const r=Y.cloneNode(!0),i=r.firstChild,a=i.nextSibling,n=a.nextSibling;return r.style.setProperty("overflow","visible"),i.style.setProperty("animation",e),i.style.setProperty("transform-origin","50% 50%"),i.style.setProperty("animation-delay","100ms"),i.style.setProperty("opacity","0"),a.style.setProperty("animation",o),a.style.setProperty("transform-origin","50% 50%"),a.style.setProperty("animation-delay","250ms"),n.style.setProperty("animation",s),n.style.setProperty("stroke-dasharray","22"),n.style.setProperty("stroke-dashoffset","22"),n.style.setProperty("animation-delay","250ms"),d.effect((e=>{const o=t.primary||"#34C759",s=t.primary||"#34C759",r=t.secondary||"#FCFCFC";return o!==e._v$&&d.setAttribute(i,"fill",e._v$=o),s!==e._v$2&&d.setAttribute(a,"fill",e._v$2=s),r!==e._v$3&&d.setAttribute(n,"stroke",e._v$3=r),e}),{_v$:void 0,_v$2:void 0,_v$3:void 0}),r})()},H=d.template('<svg viewBox="0 0 32 32"><circle cx="16" cy="16" r="16"></circle><circle cx="16" cy="16" r="12"></circle><path fill="none" stroke-width="4" stroke-linecap="round" d="M16,7l0,9"></path><circle cx="16" cy="16" r="2.5"></circle></svg>',10),J=t=>{const e=`${w} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`,o=`${k} 1s cubic-bezier(0, 0, 0.2, 1) forwards`,s=`${E} 0.1s ease-in forwards`,r=`${D} 0.2s ease-out forwards`;return(()=>{const i=H.cloneNode(!0),a=i.firstChild,n=a.nextSibling,l=n.nextSibling,c=l.nextSibling;return i.style.setProperty("overflow","visible"),a.style.setProperty("animation",e),a.style.setProperty("transform-origin","50% 50%"),a.style.setProperty("animation-delay","100ms"),a.style.setProperty("opacity","0"),n.style.setProperty("animation",o),n.style.setProperty("transform-origin","50% 50%"),n.style.setProperty("animation-delay","320ms"),l.style.setProperty("animation",s),l.style.setProperty("stroke-dasharray","9"),l.style.setProperty("stroke-dashoffset","9"),l.style.setProperty("animation-delay","200ms"),c.style.setProperty("animation",r),c.style.setProperty("animation-delay","320ms"),c.style.setProperty("opacity","0"),d.effect((e=>{const o=t.primary||"#FF3B30",s=t.primary||"#FF3B30",r=t.secondary||"#FFFFFF",i=t.secondary||"#FFFFFF";return o!==e._v$&&d.setAttribute(a,"fill",e._v$=o),s!==e._v$2&&d.setAttribute(n,"fill",e._v$2=s),r!==e._v$3&&d.setAttribute(l,"stroke",e._v$3=r),i!==e._v$4&&d.setAttribute(c,"fill",e._v$4=i),e}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),i})()},K=d.template('<svg viewBox="0 0 32 32"><path fill="none" 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-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=t=>{const e=`${C} 0.75s linear infinite`;return(()=>{const o=K.cloneNode(!0),s=o.firstChild,r=s.nextSibling;return o.style.setProperty("overflow","visible"),r.style.setProperty("animation",e),r.style.setProperty("transform-origin","50% 50%"),d.effect((e=>{const o=t.primary||"#E5E7EB",i=t.secondary||"#4b5563";return o!==e._v$&&d.setAttribute(s,"stroke",e._v$=o),i!==e._v$2&&d.setAttribute(r,"stroke",e._v$2=i),e}),{_v$:void 0,_v$2:void 0}),o})()};exports.ActionType=u,exports.Toaster=t=>(c.createEffect((()=>{(t=>{N((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({},b),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; |
@@ -22,3 +22,3 @@ var __defProp = Object.defineProperty; | ||
import { keyframes, css } from "goober"; | ||
import { insert, createComponent, effect, style, className, template, spread, memo } from "solid-js/web"; | ||
import { insert, createComponent, effect, style, className, template, mergeProps, spread, memo, setAttribute } from "solid-js/web"; | ||
const isFunction = (valOrFunction) => typeof valOrFunction === "function"; | ||
@@ -168,3 +168,4 @@ const resolveValue = (valOrFunction, arg) => isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction; | ||
style: {}, | ||
position: "top-right" | ||
position: "top-right", | ||
iconTheme: {} | ||
}; | ||
@@ -274,3 +275,3 @@ const defaultToasterOptions = { | ||
}; | ||
const iconCircle = keyframes`from {transform: scale(0) rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`; | ||
const iconCircle = keyframes`from{transform:scale(0)rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`; | ||
const pingCircle = keyframes`75%,100%{transform: scale(2.25);opacity:0;}`; | ||
@@ -369,5 +370,4 @@ const icon = keyframes`to{stroke-dashoffset: 0;}`; | ||
}); | ||
console.log(props.toast); | ||
return (() => { | ||
const _el$ = _tmpl$2.cloneNode(true), _el$5 = _el$.firstChild; | ||
const _el$ = _tmpl$2.cloneNode(true), _el$6 = _el$.firstChild; | ||
insert(_el$, createComponent(Switch, { | ||
@@ -377,3 +377,3 @@ get children() { | ||
get when() { | ||
return props.toast.type === "loading"; | ||
return props.toast.icon; | ||
}, | ||
@@ -383,3 +383,3 @@ get children() { | ||
style(_el$2, iconContainer); | ||
insert(_el$2, createComponent(Loader, {})); | ||
insert(_el$2, () => props.toast.icon); | ||
return _el$2; | ||
@@ -389,3 +389,3 @@ } | ||
get when() { | ||
return props.toast.type === "success"; | ||
return props.toast.type === "loading"; | ||
}, | ||
@@ -395,3 +395,3 @@ get children() { | ||
style(_el$3, iconContainer); | ||
insert(_el$3, createComponent(Sucess, {})); | ||
insert(_el$3, createComponent(Loader, mergeProps(() => props.toast.iconTheme))); | ||
return _el$3; | ||
@@ -401,3 +401,3 @@ } | ||
get when() { | ||
return props.toast.type === "error"; | ||
return props.toast.type === "success"; | ||
}, | ||
@@ -407,14 +407,32 @@ get children() { | ||
style(_el$4, iconContainer); | ||
insert(_el$4, createComponent(Error2, {})); | ||
insert(_el$4, createComponent(Success, mergeProps(() => props.toast.iconTheme))); | ||
return _el$4; | ||
} | ||
}), createComponent(Match, { | ||
get when() { | ||
return props.toast.type === "error"; | ||
}, | ||
get children() { | ||
const _el$5 = _tmpl$$4.cloneNode(true); | ||
style(_el$5, iconContainer); | ||
insert(_el$5, createComponent(Error2, mergeProps(() => props.toast.iconTheme))); | ||
return _el$5; | ||
} | ||
})]; | ||
} | ||
}), _el$5); | ||
style(_el$5, messageContainer); | ||
spread(_el$5, () => props.toast.ariaProps, false, true); | ||
insert(_el$5, message); | ||
effect((_$p) => style(_el$, __spreadProps(__spreadValues({}, toastBarBase), { | ||
animation: animation() | ||
}), _$p)); | ||
}), _el$6); | ||
style(_el$6, messageContainer); | ||
spread(_el$6, () => props.toast.ariaProps, false, true); | ||
insert(_el$6, message); | ||
effect((_p$) => { | ||
const _v$ = props.toast.className, _v$2 = __spreadValues(__spreadProps(__spreadValues({}, toastBarBase), { | ||
animation: animation() | ||
}), props.toast.style); | ||
_v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$); | ||
_p$._v$2 = style(_el$, _v$2, _p$._v$2); | ||
return _p$; | ||
}, { | ||
_v$: void 0, | ||
_v$2: void 0 | ||
}); | ||
return _el$; | ||
@@ -470,4 +488,4 @@ })(); | ||
}; | ||
const _tmpl$$2 = /* @__PURE__ */ 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); | ||
const Sucess = () => { | ||
const _tmpl$$2 = /* @__PURE__ */ template(`<svg viewBox="0 0 32 32"><circle cx="16" cy="16" r="16"></circle><circle cx="16" cy="16" r="12"></circle><path fill="none" 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); | ||
const Success = (props) => { | ||
const mainCircle = `${iconCircle} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`; | ||
@@ -490,7 +508,18 @@ const secondaryCircle = `${pingCircle} 1s cubic-bezier(0, 0, 0.2, 1) forwards`; | ||
_el$4.style.setProperty("animation-delay", "250ms"); | ||
effect((_p$) => { | ||
const _v$ = props.primary || "#34C759", _v$2 = props.primary || "#34C759", _v$3 = props.secondary || "#FCFCFC"; | ||
_v$ !== _p$._v$ && setAttribute(_el$2, "fill", _p$._v$ = _v$); | ||
_v$2 !== _p$._v$2 && setAttribute(_el$3, "fill", _p$._v$2 = _v$2); | ||
_v$3 !== _p$._v$3 && setAttribute(_el$4, "stroke", _p$._v$3 = _v$3); | ||
return _p$; | ||
}, { | ||
_v$: void 0, | ||
_v$2: void 0, | ||
_v$3: void 0 | ||
}); | ||
return _el$; | ||
})(); | ||
}; | ||
const _tmpl$$1 = /* @__PURE__ */ 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); | ||
const Error2 = () => { | ||
const _tmpl$$1 = /* @__PURE__ */ template(`<svg viewBox="0 0 32 32"><circle cx="16" cy="16" r="16"></circle><circle cx="16" cy="16" r="12"></circle><path fill="none" stroke-width="4" stroke-linecap="round" d="M16,7l0,9"></path><circle cx="16" cy="16" r="2.5"></circle></svg>`, 10); | ||
const Error2 = (props) => { | ||
const mainCircle = `${iconCircle} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards`; | ||
@@ -517,7 +546,20 @@ const secondaryCircle = `${pingCircle} 1s cubic-bezier(0, 0, 0.2, 1) forwards`; | ||
_el$5.style.setProperty("opacity", "0"); | ||
effect((_p$) => { | ||
const _v$ = props.primary || "#FF3B30", _v$2 = props.primary || "#FF3B30", _v$3 = props.secondary || "#FFFFFF", _v$4 = props.secondary || "#FFFFFF"; | ||
_v$ !== _p$._v$ && setAttribute(_el$2, "fill", _p$._v$ = _v$); | ||
_v$2 !== _p$._v$2 && setAttribute(_el$3, "fill", _p$._v$2 = _v$2); | ||
_v$3 !== _p$._v$3 && setAttribute(_el$4, "stroke", _p$._v$3 = _v$3); | ||
_v$4 !== _p$._v$4 && setAttribute(_el$5, "fill", _p$._v$4 = _v$4); | ||
return _p$; | ||
}, { | ||
_v$: void 0, | ||
_v$2: void 0, | ||
_v$3: void 0, | ||
_v$4: void 0 | ||
}); | ||
return _el$; | ||
})(); | ||
}; | ||
const _tmpl$ = /* @__PURE__ */ 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); | ||
const Loader = () => { | ||
const _tmpl$ = /* @__PURE__ */ template(`<svg viewBox="0 0 32 32"><path fill="none" 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-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); | ||
const Loader = (props) => { | ||
const animation = `${rotate} 0.75s linear infinite`; | ||
@@ -529,2 +571,11 @@ return (() => { | ||
_el$3.style.setProperty("transform-origin", "50% 50%"); | ||
effect((_p$) => { | ||
const _v$ = props.primary || "#E5E7EB", _v$2 = props.secondary || "#4b5563"; | ||
_v$ !== _p$._v$ && setAttribute(_el$2, "stroke", _p$._v$ = _v$); | ||
_v$2 !== _p$._v$2 && setAttribute(_el$3, "stroke", _p$._v$2 = _v$2); | ||
return _p$; | ||
}, { | ||
_v$: void 0, | ||
_v$2: void 0 | ||
}); | ||
return _el$; | ||
@@ -531,0 +582,0 @@ })(); |
{ | ||
"name": "solid-toast", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Customizable Toast Notifications for SolidJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/solid-toast.cjs.js", |
172
README.md
@@ -36,3 +36,3 @@ <a href="https://github.com/ardeora/solid-toast"><img alt="Solid Toast header image showing a cute toaster with a toast popping out" src="https://github.com/ardeora/solid-toast/raw/main/assets/header.png"/></a> | ||
Add a Toaster Component to the top level of your component tree. This will be the container element that will display all the toasts. Now you can trigger `toast()` from anywhere! | ||
Add a Toaster to your component tree. This component will render all toasts. Now you can trigger `toast()` from anywhere! | ||
@@ -55,6 +55,174 @@ ```jsx | ||
## Documentation | ||
Coming Soon | ||
### `toast()` Function | ||
Call this function from anywhere to create a toast. | ||
#### Available Options | ||
You can provide `ToastOptions` as the second argument. They will overwrite all options received from the `<Toaster/>` component. | ||
```js | ||
toast('This is a simple toast!', { | ||
duration: 5000, | ||
position: 'top-right', | ||
// Add a delay before the toast is removed | ||
// This can be used to time the toast exit animation | ||
unmountDelay: 500, | ||
// Styling - Supports CSS Objects, classes, and inline styles | ||
// Will be applied to the toast container | ||
style: { | ||
'background-color': '#f00', | ||
}, | ||
className: 'my-custom-class', | ||
// Custom Icon - Supports text as well as JSX Elements | ||
icon: '🍩', | ||
// Set accent colors for default icons that ship with Solid Toast | ||
iconTheme: { | ||
primary: '#fff', | ||
secondary: '#000', | ||
}, | ||
// Aria Props - Supports all ARIA props | ||
aria: { | ||
role: 'status', | ||
'aria-live': 'polite', | ||
}, | ||
}) | ||
``` | ||
#### Creating Toasts | ||
There are several ways of generating toasts | ||
##### Blank | ||
```js | ||
toast('This is a blank toast!') | ||
``` | ||
Blank toasts do not come with a default icon. However, you can set a custom JSX Element/Text (Emoji) icon by placing it in the `icon` option. | ||
##### Success | ||
```js | ||
toast.success('Successfully saved!'); | ||
``` | ||
Creates a notification with an animated checkmark. Color accents can be themed with the `iconTheme` option. | ||
##### Error | ||
```js | ||
toast.error('Something went wrong!'); | ||
``` | ||
Creates a notification with an animated error icon. Color accents can be themed with the `iconTheme` option. | ||
##### Loading | ||
```js | ||
toast.loading('Loading Photos...'); | ||
``` | ||
Shows a toast with a loading indicator icon. The content can later be updated with an error or success icon. See how to update the toast content [here](#updating-toasts). | ||
##### Promise | ||
The `promise()` function can be used to create a toast from a promise. This will automatically show a loading icon and update the toast with the result of the promise. | ||
```jsx | ||
const myPromise = fetchData(); | ||
toast.promise(myPromise, { | ||
loading: 'Loading', | ||
success: <b>Got the data</b>, | ||
error: 'An error occurred 😔', | ||
}); | ||
``` | ||
##### Custom Toast | ||
You also have the ability to completely customize the appearance of your toast. | ||
A custom JSX Element can be passed like so: | ||
```jsx | ||
toast.custom(() => ( | ||
<div> | ||
<h1>Custom Toast</h1> | ||
<p>This is a custom toast!</p> | ||
</div> | ||
)); | ||
``` | ||
###### Advanced Option | ||
You can also hook into the toast life-cycle by adding a parameter to the JSX Function call like so: | ||
```jsx | ||
toast.custom((t) => { | ||
<div> | ||
<h1>Custom Toast</h1> | ||
<p>This is a custom toast!</p> | ||
<p>{t.visible ? 'Showing' : 'I will close in 1 second'}</p> | ||
<button | ||
onClick={() => toast.dismiss(t.id)} | ||
> | ||
Close Toast | ||
</button> | ||
</div> | ||
}, { | ||
unmoutDelay: 1000, | ||
}) | ||
``` | ||
#### Helpful Utilities | ||
##### Dismiss Toasts Programatically | ||
You can manually dismiss a notification with toast.dismiss. Be aware that it triggers the exit animation and does not remove the Toast instantly. Toasts will auto-remove after 1 second by default. You can adjust the dismiss duration with the `unmountDelay` option. | ||
###### Dismiss Single Toast | ||
```js | ||
const toastId = toast.loading('Loading...'); | ||
// ... | ||
toast.dismiss(toastId); | ||
``` | ||
Dismiss all toasts by omitting all arguments. | ||
###### Dismiss All Toasts | ||
```js | ||
toast.dismiss(); | ||
``` | ||
##### Remove Toasts Instantly | ||
Toasts can be removed instantly with toast.remove. This will not trigger the exit animation and remove the toast instantly. | ||
```js | ||
toast.remove(toastId); | ||
// or | ||
toast.remove(); | ||
``` | ||
##### Updating Toasts | ||
Each toast call returns a unique id. Use this `id` in the toast options to update an existing toast. | ||
```js | ||
const toastId = toast.loading('Loading...'); | ||
// ... | ||
toast.success('This worked', { | ||
id: toastId, | ||
}); | ||
``` | ||
### `Toaster` Component | ||
This component will render all toasts. | ||
#### Available Options | ||
```jsx | ||
<Toaster | ||
position="top-center" | ||
// Spacing between each toast in pixels | ||
gutter={8} | ||
containerClassName="" | ||
containerStyle={{}} | ||
toastOptions={{ | ||
// Define default options that each toast will inherit. Will be overwritten by individual toast options | ||
className: '', | ||
duration: 5000, | ||
style: { | ||
background: '#363636', | ||
color: '#fff', | ||
}, | ||
}} | ||
/> | ||
``` | ||
## Acknowledgements | ||
This project is inspired by | ||
- [React Hot Toast](https://github.com/timolins/react-hot-toast) |
@@ -23,3 +23,4 @@ import { ToasterProps, ToastOptions, ToastTimeouts } from "../types"; | ||
style: {}, | ||
position: 'top-right' | ||
position: 'top-right', | ||
iconTheme: {} | ||
} | ||
@@ -26,0 +27,0 @@ |
@@ -29,2 +29,7 @@ import { JSX } from 'solid-js'; | ||
export interface IconTheme { | ||
primary?: string; | ||
secondary?: string; | ||
} | ||
export interface Toast { | ||
@@ -47,2 +52,4 @@ type: ToastType; | ||
iconTheme?: IconTheme; | ||
createdAt: number; | ||
@@ -66,2 +73,3 @@ updatedAt?: number; | ||
| 'unmountDelay' | ||
| 'iconTheme' | ||
> | ||
@@ -95,2 +103,4 @@ >; | ||
position: ToastPosition | ||
} | ||
} | ||
export type IconProps = Partial<IconTheme> |
@@ -40,3 +40,3 @@ import { JSX } from 'solid-js' | ||
export const iconCircle = keyframes`from {transform: scale(0) rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`; | ||
export const iconCircle = keyframes`from{transform:scale(0)rotate(45deg);opacity:0;}to{transform:scale(1)rotate(45deg);opacity:1;}`; | ||
@@ -43,0 +43,0 @@ export const pingCircle = keyframes`75%,100%{transform: scale(2.25);opacity:0;}` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64069
1254
227