@zerodevx/svelte-toast
Advanced tools
Comparing version 0.7.0-rc.1 to 0.7.0
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(){}const n=t=>t;function o(t,e){for(const n in e)t[n]=e[n];return t}function r(t){return t()}function s(){return Object.create(null)}function i(t){t.forEach(r)}function a(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t,n,o){t.$$.on_destroy.push(function(t,...n){if(null==t)return e;const o=t.subscribe(...n);return o.unsubscribe?()=>o.unsubscribe():o}(n,o))}function l(t){return null==t?"":t}const f="undefined"!=typeof window;let d=f?()=>window.performance.now():()=>Date.now(),p=f?t=>requestAnimationFrame(t):e;const h=new Set;function g(t){h.forEach((e=>{e.c(t)||(h.delete(e),e.f())})),0!==h.size&&p(g)}function m(t){let e;return 0===h.size&&p(g),{promise:new Promise((n=>{h.add(e={c:t,f:n})})),abort(){h.delete(e)}}}function $(t,e){t.appendChild(e)}function b(t,e,n){const o=y(t);if(!o.getElementById(e)){const t=_("style");t.id=e,t.textContent=n,w(o,t)}}function y(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function v(t){const e=_("style");return w(y(t),e),e.sheet}function w(t,e){$(t.head||t,e)}function x(t,e,n){t.insertBefore(e,n||null)}function j(t){t.parentNode.removeChild(t)}function _(t){return document.createElement(t)}function k(t){return document.createTextNode(t)}function B(){return k(" ")}function C(){return k("")}function E(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function M(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function S(t,e,n){t.classList[n?"add":"remove"](e)}class A{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=_(e.nodeName),this.t=e,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)x(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(j)}}const R=new Map;let O,P=0;function T(t,e,n,o,r,s,i,a=0){const c=16.666/o;let u="{\n";for(let t=0;t<=1;t+=c){const o=e+(n-e)*s(t);u+=100*t+`%{${i(o,1-o)}}\n`}const l=u+`100% {${i(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(l)}_${a}`,d=y(t),{stylesheet:p,rules:h}=R.get(d)||function(t,e){const n={stylesheet:v(e),rules:{}};return R.set(t,n),n}(d,t);h[f]||(h[f]=!0,p.insertRule(`@keyframes ${f} ${l}`,p.cssRules.length));const g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${o}ms linear ${r}ms 1 both`,P+=1,f}function z(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),r=n.length-o.length;r&&(t.style.animation=o.join(", "),P-=r,P||p((()=>{P||(R.forEach((t=>{const{stylesheet:e}=t;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.rules={}})),R.clear())})))}function N(t,e){const n=t.getBoundingClientRect();if(e.left!==n.left||e.top!==n.top){const o=getComputedStyle(t),r="none"===o.transform?"":o.transform;t.style.transform=`${r} translate(${e.left-n.left}px, ${e.top-n.top}px)`}}function L(t){O=t}function D(t){(function(){if(!O)throw new Error("Function called outside component initialization");return O})().$$.on_destroy.push(t)}const I=[],q=[],H=[],F=[],W=Promise.resolve();let G=!1;function J(t){H.push(t)}const K=new Set;let Q,U=0;function V(){const t=O;do{for(;U<I.length;){const t=I[U];U++,L(t),X(t.$$)}for(L(null),I.length=0,U=0;q.length;)q.pop()();for(let t=0;t<H.length;t+=1){const e=H[t];K.has(e)||(K.add(e),e())}H.length=0}while(I.length);for(;F.length;)F.pop()();G=!1,K.clear(),L(t)}function X(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(J)}}function Y(){return Q||(Q=Promise.resolve(),Q.then((()=>{Q=null}))),Q}function Z(t,e,n){t.dispatchEvent(function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(`${e?"intro":"outro"}${n}`))}const tt=new Set;let et;function nt(){et={r:0,c:[],p:et}}function ot(){et.r||i(et.c),et=et.p}function rt(t,e){t&&t.i&&(tt.delete(t),t.i(e))}function st(t,e,n,o){if(t&&t.o){if(tt.has(t))return;tt.add(t),et.c.push((()=>{tt.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const it={duration:0};function at(t,e){t.f(),function(t,e){st(t,1,1,(()=>{e.delete(t.key)}))}(t,e)}function ct(t){t&&t.c()}function ut(t,e,n,o){const{fragment:s,on_mount:c,on_destroy:u,after_update:l}=t.$$;s&&s.m(e,n),o||J((()=>{const e=c.map(r).filter(a);u?u.push(...e):i(e),t.$$.on_mount=[]})),l.forEach(J)}function lt(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function ft(t,e){-1===t.$$.dirty[0]&&(I.push(t),G||(G=!0,W.then(V)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function dt(t,n,o,r,a,c,u,l=[-1]){const f=O;L(t);const d=t.$$={fragment:null,ctx:null,props:c,update:e,not_equal:a,bound:s(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(f?f.$$.context:[])),callbacks:s(),dirty:l,skip_bound:!1,root:n.target||f.$$.root};u&&u(d.root);let p=!1;if(d.ctx=o?o(t,n.props||{},((e,n,...o)=>{const r=o.length?o[0]:n;return d.ctx&&a(d.ctx[e],d.ctx[e]=r)&&(!d.skip_bound&&d.bound[e]&&d.bound[e](r),p&&ft(t,e)),n})):[],d.update(),p=!0,i(d.before_update),d.fragment=!!r&&r(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(j)}else d.fragment&&d.fragment.c();n.intro&&rt(t.$$.fragment),ut(t,n.target,n.anchor,n.customElement),V()}L(f)}class pt{$destroy(){lt(this,1),this.$destroy=e}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function ht(t){const e=t-1;return e*e*e+1}function gt(t,{delay:e=0,duration:o=400,easing:r=n}={}){const s=+getComputedStyle(t).opacity;return{delay:e,duration:o,easing:r,css:t=>"opacity: "+t*s}}function mt(t,{delay:e=0,duration:n=400,easing:o=ht,x:r=0,y:s=0,opacity:i=0}={}){const a=getComputedStyle(t),c=+a.opacity,u="none"===a.transform?"":a.transform,l=c*(1-i);return{delay:e,duration:n,easing:o,css:(t,e)=>`\n\t\t\ttransform: ${u} translate(${(1-t)*r}px, ${(1-t)*s}px);\n\t\t\topacity: ${c-l*e}`}}function $t(t,{from:e,to:n},o={}){const r=getComputedStyle(t),s="none"===r.transform?"":r.transform,[i,c]=r.transformOrigin.split(" ").map(parseFloat),u=e.left+e.width*i/n.width-(n.left+i),l=e.top+e.height*c/n.height-(n.top+c),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=ht}=o;return{delay:f,duration:a(d)?d(Math.sqrt(u*u+l*l)):d,easing:p,css:(t,o)=>{const r=o*u,i=o*l,a=t+o*e.width/n.width,c=t+o*e.height/n.height;return`transform: ${s} translate(${r}px, ${i}px) scale(${a}, ${c});`}}}const bt=[];function yt(t,n=e){let o;const r=new Set;function s(e){if(c(t,e)&&(t=e,o)){const e=!bt.length;for(const e of r)e[1](),bt.push(e,t);if(e){for(let t=0;t<bt.length;t+=2)bt[t][0](bt[t+1]);bt.length=0}}}return{set:s,update:function(e){s(e(t))},subscribe:function(i,a=e){const c=[i,a];return r.add(c),1===r.size&&(o=n(s)||e),i(t),()=>{r.delete(c),0===r.size&&(o(),o=null)}}}}const vt={duration:4e3,initial:1,next:0,pausable:!1,dismissable:!0,reversed:!1,intro:{x:256}},wt=(()=>{const{subscribe:t,update:e}=yt([]);let n=0;const o={},r=t=>t instanceof Object;return{subscribe:t,push:(t,s={})=>{const i={target:"default",...r(t)?t:{...s,msg:t}},a=o[i.target]||{},c={...vt,...a,...i,theme:{...a.theme,...i.theme},classes:[...a.classes||[],...i.classes||[]],id:++n};return e((t=>c.reversed?[...t,c]:[c,...t])),n},pop:t=>{e((e=>{if(!e.length||0===t)return[];if(r(t))return e.filter((e=>t(e)));const n=t||Math.max(...e.map((t=>t.id)));return e.filter((t=>t.id!==n))}))},set:(t,n={})=>{const o=r(t)?{...t}:{...n,id:t};e((t=>{const e=t.findIndex((t=>t.id===o.id));return e>-1&&(t[e]={...t[e],...o}),t}))},_init:(t="default",e={})=>(o[t]=e,o)}})();function xt(t){return"[object Date]"===Object.prototype.toString.call(t)}function jt(t,e){if(t===e||t!=t)return()=>t;const n=typeof t;if(n!==typeof e||Array.isArray(t)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(t)){const n=e.map(((e,n)=>jt(t[n],e)));return t=>n.map((e=>e(t)))}if("object"===n){if(!t||!e)throw new Error("Object cannot be null");if(xt(t)&&xt(e)){t=t.getTime();const n=(e=e.getTime())-t;return e=>new Date(t+e*n)}const n=Object.keys(e),o={};return n.forEach((n=>{o[n]=jt(t[n],e[n])})),t=>{const e={};return n.forEach((n=>{e[n]=o[n](t)})),e}}if("number"===n){const n=e-t;return e=>t+e*n}throw new Error(`Cannot interpolate ${n} values`)}function _t(t){b(t,"svelte-j9nwjb","._toastItem.svelte-j9nwjb{width:var(--toastWidth, 16rem);height:var(--toastHeight, auto);min-height:var(--toastMinHeight, 3.5rem);margin:var(--toastMargin, 0 0 0.5rem 0);padding:var(--toastPadding, 0);background:var(--toastBackground, rgba(66, 66, 66, 0.9));color:var(--toastColor, #fff);box-shadow:var(--toastBoxShadow, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06));border:var(--toastBorder, none);border-radius:var(--toastBorderRadius, 0.125rem);position:relative;display:flex;flex-direction:row;align-items:center;overflow:hidden;will-change:transform, opacity;-webkit-tap-highlight-color:transparent}._toastMsg.svelte-j9nwjb{padding:var(--toastMsgPadding, 0.75rem 0.5rem);flex:1 1 0%}.pe.svelte-j9nwjb,._toastMsg.svelte-j9nwjb a{pointer-events:auto}._toastBtn.svelte-j9nwjb{width:2rem;height:100%;font:1rem sans-serif;display:flex;align-items:center;justify-content:center;cursor:pointer;outline:none}._toastBar.svelte-j9nwjb{top:var(--toastBarTop, auto);right:var(--toastBarRight, auto);bottom:var(--toastBarBottom, 0);left:var(--toastBarLeft, 0);height:var(--toastBarHeight, 6px);width:var(--toastBarWidth, 100%);position:absolute;display:block;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;pointer-events:none}._toastBar.svelte-j9nwjb::-webkit-progress-bar{background:transparent}._toastBar.svelte-j9nwjb::-webkit-progress-value{background:var(--toastProgressBackground, var(--toastBarBackground, rgba(33, 150, 243, 0.75)))}._toastBar.svelte-j9nwjb::-moz-progress-bar{background:var(--toastProgressBackground, var(--toastBarBackground, rgba(33, 150, 243, 0.75)))}")}function kt(t){let n,o,r=t[0].msg+"";return{c(){n=new A,o=C(),n.a=o},m(t,e){n.m(r,t,e),x(t,o,e)},p(t,e){1&e&&r!==(r=t[0].msg+"")&&n.p(r)},i:e,o:e,d(t){t&&j(o),t&&n.d()}}}function Bt(t){let e,n,r;const s=[t[6]()];var i=t[0].component.src;function a(t){let e={};for(let t=0;t<s.length;t+=1)e=o(e,s[t]);return{props:e}}return i&&(e=new i(a())),{c(){e&&ct(e.$$.fragment),n=C()},m(t,o){e&&ut(e,t,o),x(t,n,o),r=!0},p(t,o){const r=64&o?function(t,e){const n={},o={},r={$$scope:1};let s=t.length;for(;s--;){const i=t[s],a=e[s];if(a){for(const t in i)t in a||(o[t]=1);for(const t in a)r[t]||(n[t]=a[t],r[t]=1);t[s]=a}else for(const t in i)r[t]=1}for(const t in o)t in n||(n[t]=void 0);return n}(s,[(c=t[6](),"object"==typeof c&&null!==c?c:{})]):{};var c;if(i!==(i=t[0].component.src)){if(e){nt();const t=e;st(t.$$.fragment,1,0,(()=>{lt(t,1)})),ot()}i?(e=new i(a()),ct(e.$$.fragment),rt(e.$$.fragment,1),ut(e,n.parentNode,n)):e=null}else i&&e.$set(r)},i(t){r||(e&&rt(e.$$.fragment,t),r=!0)},o(t){e&&st(e.$$.fragment,t),r=!1},d(t){t&&j(n),e&<(e,t)}}}function Ct(t){let n,o,r;return{c(){n=_("div"),n.textContent="✕",M(n,"class","_toastBtn pe svelte-j9nwjb"),M(n,"role","button"),M(n,"tabindex","-1")},m(e,s){x(e,n,s),o||(r=E(n,"click",t[3]),o=!0)},p:e,d(t){t&&j(n),o=!1,r()}}}function Et(t){let e,n,o,r,s,a,c,u,l,f;const d=[Bt,kt],p=[];function h(t,e){return t[0].component?0:1}o=h(t),r=p[o]=d[o](t);let g=t[0].dismissable&&Ct(t);return{c(){e=_("div"),n=_("div"),r.c(),s=B(),g&&g.c(),a=B(),c=_("progress"),M(n,"role","status"),M(n,"class","_toastMsg svelte-j9nwjb"),S(n,"pe",t[0].component),M(c,"class","_toastBar svelte-j9nwjb"),c.value=t[1],M(e,"class","_toastItem svelte-j9nwjb"),S(e,"pe",t[0].pausable)},m(r,i){x(r,e,i),$(e,n),p[o].m(n,null),$(e,s),g&&g.m(e,null),$(e,a),$(e,c),u=!0,l||(f=[E(e,"mouseenter",t[4]),E(e,"mouseleave",t[5])],l=!0)},p(t,[s]){let i=o;o=h(t),o===i?p[o].p(t,s):(nt(),st(p[i],1,1,(()=>{p[i]=null})),ot(),r=p[o],r?r.p(t,s):(r=p[o]=d[o](t),r.c()),rt(r,1),r.m(n,null)),1&s&&S(n,"pe",t[0].component),t[0].dismissable?g?g.p(t,s):(g=Ct(t),g.c(),g.m(e,a)):g&&(g.d(1),g=null),(!u||2&s)&&(c.value=t[1]),1&s&&S(e,"pe",t[0].pausable)},i(t){u||(rt(r),u=!0)},o(t){st(r),u=!1},d(t){t&&j(e),p[o].d(),g&&g.d(),l=!1,i(f)}}}function Mt(t,e,r){let s,{item:i}=e;const a=function(t,e={}){const r=yt(t);let s,i=t;function a(a,c){if(null==t)return r.set(t=a),Promise.resolve();i=a;let u=s,l=!1,{delay:f=0,duration:p=400,easing:h=n,interpolate:g=jt}=o(o({},e),c);if(0===p)return u&&(u.abort(),u=null),r.set(t=i),Promise.resolve();const $=d()+f;let b;return s=m((e=>{if(e<$)return!0;l||(b=g(t,a),"function"==typeof p&&(p=p(t,a)),l=!0),u&&(u.abort(),u=null);const n=e-$;return n>p?(r.set(t=a),!1):(r.set(t=b(h(n/p))),!0)})),s.promise}return{set:a,update:(e,n)=>a(e(i,t),n),subscribe:r.subscribe}}(i.initial,{duration:i.duration,easing:n});u(t,a,(t=>r(1,s=t)));const c=()=>wt.pop(i.id),l=()=>{1!==s&&0!==s||c()};let f=i.initial,p=f,h=!1;return D((()=>{"function"==typeof i.onpop&&i.onpop(i.id)})),t.$$set=t=>{"item"in t&&r(0,i=t.item)},t.$$.update=()=>{1&t.$$.dirty&&void 0!==i.progress&&r(0,i.next=i.progress,i),131&t.$$.dirty&&f!==i.next&&(r(7,f=i.next),p=s,h=!1,a.set(f).then(l))},[i,s,a,c,()=>{i.pausable&&!h&&s!==f&&(a.set(s,{duration:0}),h=!0)},()=>{if(h){const t=i.duration,e=t-t*((s-p)/(f-p));a.set(f,{duration:e}).then(l),h=!1}},()=>{const{props:t={},sendIdTo:e}=i.component;return e&&(t[e]=i.id),t},f]}class St extends pt{constructor(t){super(),dt(this,t,Mt,Et,c,{item:0},_t)}}function At(t){b(t,"svelte-7xr3c1","._toastContainer.svelte-7xr3c1{top:var(--toastContainerTop, 1.5rem);right:var(--toastContainerRight, 2rem);bottom:var(--toastContainerBottom, auto);left:var(--toastContainerLeft, auto);position:fixed;margin:0;padding:0;list-style-type:none;pointer-events:none;z-index:9999}")}function Rt(t,e,n){const o=t.slice();return o[5]=e[n],o}function Ot(t,o){let r,s,c,u,f,p,h,g,b,y=e;return s=new St({props:{item:o[5]}}),{key:t,first:null,c(){r=_("li"),ct(s.$$.fragment),c=B(),M(r,"class",u=l(o[5].classes.join(" "))+" svelte-7xr3c1"),M(r,"style",f=o[1](o[5].theme)),this.first=r},m(t,e){x(t,r,e),ut(s,r,null),$(r,c),b=!0},p(t,e){o=t;const n={};1&e&&(n.item=o[5]),s.$set(n),(!b||1&e&&u!==(u=l(o[5].classes.join(" "))+" svelte-7xr3c1"))&&M(r,"class",u),(!b||1&e&&f!==(f=o[1](o[5].theme)))&&M(r,"style",f)},r(){g=r.getBoundingClientRect()},f(){!function(t){const e=getComputedStyle(t);if("absolute"!==e.position&&"fixed"!==e.position){const{width:n,height:o}=e,r=t.getBoundingClientRect();t.style.position="absolute",t.style.width=n,t.style.height=o,N(t,r)}}(r),y(),N(r,g)},a(){y(),y=function(t,o,r,s){if(!o)return e;const i=t.getBoundingClientRect();if(o.left===i.left&&o.right===i.right&&o.top===i.top&&o.bottom===i.bottom)return e;const{delay:a=0,duration:c=300,easing:u=n,start:l=d()+a,end:f=l+c,tick:p=e,css:h}=r(t,{from:o,to:i},s);let g,$=!0,b=!1;function y(){h&&z(t,g),$=!1}return m((t=>{if(!b&&t>=l&&(b=!0),b&&t>=f&&(p(1,0),y()),!$)return!1;if(b){const e=0+1*u((t-l)/c);p(e,1-e)}return!0})),h&&(g=T(t,0,1,c,a,u,h)),a||(b=!0),p(0,1),y}(r,g,$t,{duration:200})},i(t){b||(rt(s.$$.fragment,t),J((()=>{h&&h.end(1),p=function(t,o,r){let s,i,c=o(t,r),u=!1,l=0;function f(){s&&z(t,s)}function p(){const{delay:o=0,duration:r=300,easing:a=n,tick:p=e,css:h}=c||it;h&&(s=T(t,0,1,r,o,a,h,l++)),p(0,1);const g=d()+o,$=g+r;i&&i.abort(),u=!0,J((()=>Z(t,!0,"start"))),i=m((e=>{if(u){if(e>=$)return p(1,0),Z(t,!0,"end"),f(),u=!1;if(e>=g){const t=a((e-g)/r);p(t,1-t)}}return u}))}let h=!1;return{start(){h||(h=!0,z(t),a(c)?(c=c(),Y().then(p)):p())},invalidate(){h=!1},end(){u&&(f(),u=!1)}}}(r,mt,o[5].intro),p.start()})),b=!0)},o(t){st(s.$$.fragment,t),p&&p.invalidate(),h=function(t,o,r){let s,c=o(t,r),u=!0;const l=et;function f(){const{delay:o=0,duration:r=300,easing:a=n,tick:f=e,css:p}=c||it;p&&(s=T(t,1,0,r,o,a,p));const h=d()+o,g=h+r;J((()=>Z(t,!1,"start"))),m((e=>{if(u){if(e>=g)return f(0,1),Z(t,!1,"end"),--l.r||i(l.c),!1;if(e>=h){const t=a((e-h)/r);f(1-t,t)}}return u}))}return l.r+=1,a(c)?Y().then((()=>{c=c(),f()})):f(),{end(e){e&&c.tick&&c.tick(1,0),u&&(s&&z(t,s),u=!1)}}}(r,gt,{}),b=!1},d(t){t&&j(r),lt(s),t&&h&&h.end()}}}function Pt(t){let e,n,o=[],r=new Map,s=t[0];const i=t=>t[5].id;for(let e=0;e<s.length;e+=1){let n=Rt(t,s,e),a=i(n);r.set(a,o[e]=Ot(a,n))}return{c(){e=_("ul");for(let t=0;t<o.length;t+=1)o[t].c();M(e,"class","_toastContainer svelte-7xr3c1")},m(t,r){x(t,e,r);for(let t=0;t<o.length;t+=1)o[t].m(e,null);n=!0},p(t,[n]){if(3&n){s=t[0],nt();for(let t=0;t<o.length;t+=1)o[t].r();o=function(t,e,n,o,r,s,i,a,c,u,l,f){let d=t.length,p=s.length,h=d;const g={};for(;h--;)g[t[h].key]=h;const m=[],$=new Map,b=new Map;for(h=p;h--;){const t=f(r,s,h),a=n(t);let c=i.get(a);c?o&&c.p(t,e):(c=u(a,t),c.c()),$.set(a,m[h]=c),a in g&&b.set(a,Math.abs(h-g[a]))}const y=new Set,v=new Set;function w(t){rt(t,1),t.m(a,l),i.set(t.key,t),l=t.first,p--}for(;d&&p;){const e=m[p-1],n=t[d-1],o=e.key,r=n.key;e===n?(l=e.first,d--,p--):$.has(r)?!i.has(o)||y.has(o)?w(e):v.has(r)?d--:b.get(o)>b.get(r)?(v.add(o),w(e)):(y.add(r),d--):(c(n,i),d--)}for(;d--;){const e=t[d];$.has(e.key)||c(e,i)}for(;p;)w(m[p-1]);return m}(o,n,i,1,t,s,r,e,at,Ot,null,Rt);for(let t=0;t<o.length;t+=1)o[t].a();ot()}},i(t){if(!n){for(let t=0;t<s.length;t+=1)rt(o[t]);n=!0}},o(t){for(let t=0;t<o.length;t+=1)st(o[t]);n=!1},d(t){t&&j(e);for(let t=0;t<o.length;t+=1)o[t].d()}}}function Tt(t,e,n){let o;u(t,wt,(t=>n(4,o=t)));let r,{options:s={}}=e,{target:i="default"}=e;return t.$$set=t=>{"options"in t&&n(2,s=t.options),"target"in t&&n(3,i=t.target)},t.$$.update=()=>{12&t.$$.dirty&&wt._init(i,s),24&t.$$.dirty&&n(0,r=o.filter((t=>t.target===i)))},[r,t=>Object.keys(t).reduce(((e,n)=>`${e}${n}:${t[n]};`),""),s,i,o]}t.SvelteToast=class extends pt{constructor(t){super(),dt(this,t,Tt,Pt,c,{options:2,target:3},At)}},t.toast=wt,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(){}const n=t=>t;function o(t,e){for(const n in e)t[n]=e[n];return t}function r(t){return t()}function s(){return Object.create(null)}function i(t){t.forEach(r)}function a(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t,n,o){t.$$.on_destroy.push(function(t,...n){if(null==t)return e;const o=t.subscribe(...n);return o.unsubscribe?()=>o.unsubscribe():o}(n,o))}function l(t){return null==t?"":t}const f="undefined"!=typeof window;let d=f?()=>window.performance.now():()=>Date.now(),p=f?t=>requestAnimationFrame(t):e;const h=new Set;function g(t){h.forEach((e=>{e.c(t)||(h.delete(e),e.f())})),0!==h.size&&p(g)}function m(t){let e;return 0===h.size&&p(g),{promise:new Promise((n=>{h.add(e={c:t,f:n})})),abort(){h.delete(e)}}}function $(t,e){t.appendChild(e)}function y(t,e,n){const o=b(t);if(!o.getElementById(e)){const t=k("style");t.id=e,t.textContent=n,x(o,t)}}function b(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function v(t){const e=k("style");return x(b(t),e),e.sheet}function x(t,e){$(t.head||t,e)}function w(t,e,n){t.insertBefore(e,n||null)}function _(t){t.parentNode.removeChild(t)}function k(t){return document.createElement(t)}function B(t){return document.createTextNode(t)}function C(){return B(" ")}function E(){return B("")}function j(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function M(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function S(t,e,n){t.classList[n?"add":"remove"](e)}class A{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=k(e.nodeName),this.t=e,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)w(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(_)}}const R=new Map;let O,P=0;function T(t,e,n,o,r,s,i,a=0){const c=16.666/o;let u="{\n";for(let t=0;t<=1;t+=c){const o=e+(n-e)*s(t);u+=100*t+`%{${i(o,1-o)}}\n`}const l=u+`100% {${i(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(l)}_${a}`,d=b(t),{stylesheet:p,rules:h}=R.get(d)||function(t,e){const n={stylesheet:v(e),rules:{}};return R.set(t,n),n}(d,t);h[f]||(h[f]=!0,p.insertRule(`@keyframes ${f} ${l}`,p.cssRules.length));const g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${o}ms linear ${r}ms 1 both`,P+=1,f}function z(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),r=n.length-o.length;r&&(t.style.animation=o.join(", "),P-=r,P||p((()=>{P||(R.forEach((t=>{const{stylesheet:e}=t;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.rules={}})),R.clear())})))}function N(t,e){const n=t.getBoundingClientRect();if(e.left!==n.left||e.top!==n.top){const o=getComputedStyle(t),r="none"===o.transform?"":o.transform;t.style.transform=`${r} translate(${e.left-n.left}px, ${e.top-n.top}px)`}}function L(t){O=t}function D(t){(function(){if(!O)throw new Error("Function called outside component initialization");return O})().$$.on_destroy.push(t)}const I=[],q=[],H=[],F=[],W=Promise.resolve();let G=!1;function J(t){H.push(t)}const K=new Set;let Q,U=0;function V(){const t=O;do{for(;U<I.length;){const t=I[U];U++,L(t),X(t.$$)}for(L(null),I.length=0,U=0;q.length;)q.pop()();for(let t=0;t<H.length;t+=1){const e=H[t];K.has(e)||(K.add(e),e())}H.length=0}while(I.length);for(;F.length;)F.pop()();G=!1,K.clear(),L(t)}function X(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(J)}}function Y(){return Q||(Q=Promise.resolve(),Q.then((()=>{Q=null}))),Q}function Z(t,e,n){t.dispatchEvent(function(t,e,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,!1,e),o}(`${e?"intro":"outro"}${n}`))}const tt=new Set;let et;function nt(){et={r:0,c:[],p:et}}function ot(){et.r||i(et.c),et=et.p}function rt(t,e){t&&t.i&&(tt.delete(t),t.i(e))}function st(t,e,n,o){if(t&&t.o){if(tt.has(t))return;tt.add(t),et.c.push((()=>{tt.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const it={duration:0};function at(t,e){t.f(),function(t,e){st(t,1,1,(()=>{e.delete(t.key)}))}(t,e)}function ct(t){t&&t.c()}function ut(t,e,n,o){const{fragment:s,on_mount:c,on_destroy:u,after_update:l}=t.$$;s&&s.m(e,n),o||J((()=>{const e=c.map(r).filter(a);u?u.push(...e):i(e),t.$$.on_mount=[]})),l.forEach(J)}function lt(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function ft(t,e){-1===t.$$.dirty[0]&&(I.push(t),G||(G=!0,W.then(V)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function dt(t,n,o,r,a,c,u,l=[-1]){const f=O;L(t);const d=t.$$={fragment:null,ctx:null,props:c,update:e,not_equal:a,bound:s(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(f?f.$$.context:[])),callbacks:s(),dirty:l,skip_bound:!1,root:n.target||f.$$.root};u&&u(d.root);let p=!1;if(d.ctx=o?o(t,n.props||{},((e,n,...o)=>{const r=o.length?o[0]:n;return d.ctx&&a(d.ctx[e],d.ctx[e]=r)&&(!d.skip_bound&&d.bound[e]&&d.bound[e](r),p&&ft(t,e)),n})):[],d.update(),p=!0,i(d.before_update),d.fragment=!!r&&r(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(_)}else d.fragment&&d.fragment.c();n.intro&&rt(t.$$.fragment),ut(t,n.target,n.anchor,n.customElement),V()}L(f)}class pt{$destroy(){lt(this,1),this.$destroy=e}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function ht(t){const e=t-1;return e*e*e+1}function gt(t,{delay:e=0,duration:o=400,easing:r=n}={}){const s=+getComputedStyle(t).opacity;return{delay:e,duration:o,easing:r,css:t=>"opacity: "+t*s}}function mt(t,{delay:e=0,duration:n=400,easing:o=ht,x:r=0,y:s=0,opacity:i=0}={}){const a=getComputedStyle(t),c=+a.opacity,u="none"===a.transform?"":a.transform,l=c*(1-i);return{delay:e,duration:n,easing:o,css:(t,e)=>`\n\t\t\ttransform: ${u} translate(${(1-t)*r}px, ${(1-t)*s}px);\n\t\t\topacity: ${c-l*e}`}}function $t(t,{from:e,to:n},o={}){const r=getComputedStyle(t),s="none"===r.transform?"":r.transform,[i,c]=r.transformOrigin.split(" ").map(parseFloat),u=e.left+e.width*i/n.width-(n.left+i),l=e.top+e.height*c/n.height-(n.top+c),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=ht}=o;return{delay:f,duration:a(d)?d(Math.sqrt(u*u+l*l)):d,easing:p,css:(t,o)=>{const r=o*u,i=o*l,a=t+o*e.width/n.width,c=t+o*e.height/n.height;return`transform: ${s} translate(${r}px, ${i}px) scale(${a}, ${c});`}}}const yt=[];function bt(t,n=e){let o;const r=new Set;function s(e){if(c(t,e)&&(t=e,o)){const e=!yt.length;for(const e of r)e[1](),yt.push(e,t);if(e){for(let t=0;t<yt.length;t+=2)yt[t][0](yt[t+1]);yt.length=0}}}return{set:s,update:function(e){s(e(t))},subscribe:function(i,a=e){const c=[i,a];return r.add(c),1===r.size&&(o=n(s)||e),i(t),()=>{r.delete(c),0===r.size&&(o(),o=null)}}}}const vt={duration:4e3,initial:1,next:0,pausable:!1,dismissable:!0,reversed:!1,intro:{x:256}},xt=(()=>{const{subscribe:t,update:e}=bt([]);let n=0;const o={},r=t=>t instanceof Object;return{subscribe:t,push:(t,s={})=>{const i={target:"default",...r(t)?t:{...s,msg:t}},a=o[i.target]||{},c={...vt,...a,...i,theme:{...a.theme,...i.theme},classes:[...a.classes||[],...i.classes||[]],id:++n};return e((t=>c.reversed?[...t,c]:[c,...t])),n},pop:t=>{e((e=>{if(!e.length||0===t)return[];if(r(t))return e.filter((e=>t(e)));const n=t||Math.max(...e.map((t=>t.id)));return e.filter((t=>t.id!==n))}))},set:(t,n={})=>{const o=r(t)?{...t}:{...n,id:t};e((t=>{const e=t.findIndex((t=>t.id===o.id));return e>-1&&(t[e]={...t[e],...o}),t}))},_init:(t="default",e={})=>(o[t]=e,o)}})();function wt(t){return"[object Date]"===Object.prototype.toString.call(t)}function _t(t,e){if(t===e||t!=t)return()=>t;const n=typeof t;if(n!==typeof e||Array.isArray(t)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(t)){const n=e.map(((e,n)=>_t(t[n],e)));return t=>n.map((e=>e(t)))}if("object"===n){if(!t||!e)throw new Error("Object cannot be null");if(wt(t)&&wt(e)){t=t.getTime();const n=(e=e.getTime())-t;return e=>new Date(t+e*n)}const n=Object.keys(e),o={};return n.forEach((n=>{o[n]=_t(t[n],e[n])})),t=>{const e={};return n.forEach((n=>{e[n]=o[n](t)})),e}}if("number"===n){const n=e-t;return e=>t+e*n}throw new Error(`Cannot interpolate ${n} values`)}function kt(t){y(t,"svelte-5er0t9","._toastItem.svelte-5er0t9{width:var(--toastWidth, 16rem);height:var(--toastHeight, auto);min-height:var(--toastMinHeight, 3.5rem);margin:var(--toastMargin, 0 0 0.5rem 0);padding:var(--toastPadding, 0);background:var(--toastBackground, rgba(66, 66, 66, 0.9));color:var(--toastColor, #fff);box-shadow:var(\n --toastBoxShadow,\n 0 4px 6px -1px rgba(0, 0, 0, 0.1),\n 0 2px 4px -1px rgba(0, 0, 0, 0.06)\n );border:var(--toastBorder, none);border-radius:var(--toastBorderRadius, 0.125rem);position:relative;display:flex;flex-direction:row;align-items:center;overflow:hidden;will-change:transform, opacity;-webkit-tap-highlight-color:transparent}._toastMsg.svelte-5er0t9{padding:var(--toastMsgPadding, 0.75rem 0.5rem);flex:1 1 0%}.pe.svelte-5er0t9,._toastMsg.svelte-5er0t9 a{pointer-events:auto}._toastBtn.svelte-5er0t9{width:2rem;height:100%;font:1rem sans-serif;display:flex;align-items:center;justify-content:center;cursor:pointer;outline:none}._toastBar.svelte-5er0t9{top:var(--toastBarTop, auto);right:var(--toastBarRight, auto);bottom:var(--toastBarBottom, 0);left:var(--toastBarLeft, 0);height:var(--toastBarHeight, 6px);width:var(--toastBarWidth, 100%);position:absolute;display:block;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;pointer-events:none}._toastBar.svelte-5er0t9::-webkit-progress-bar{background:transparent}._toastBar.svelte-5er0t9::-webkit-progress-value{background:var(--toastProgressBackground, var(--toastBarBackground, rgba(33, 150, 243, 0.75)))}._toastBar.svelte-5er0t9::-moz-progress-bar{background:var(--toastProgressBackground, var(--toastBarBackground, rgba(33, 150, 243, 0.75)))}")}function Bt(t){let n,o,r=t[0].msg+"";return{c(){n=new A,o=E(),n.a=o},m(t,e){n.m(r,t,e),w(t,o,e)},p(t,e){1&e&&r!==(r=t[0].msg+"")&&n.p(r)},i:e,o:e,d(t){t&&_(o),t&&n.d()}}}function Ct(t){let e,n,r;const s=[t[6]()];var i=t[0].component.src;function a(t){let e={};for(let t=0;t<s.length;t+=1)e=o(e,s[t]);return{props:e}}return i&&(e=new i(a())),{c(){e&&ct(e.$$.fragment),n=E()},m(t,o){e&&ut(e,t,o),w(t,n,o),r=!0},p(t,o){const r=64&o?function(t,e){const n={},o={},r={$$scope:1};let s=t.length;for(;s--;){const i=t[s],a=e[s];if(a){for(const t in i)t in a||(o[t]=1);for(const t in a)r[t]||(n[t]=a[t],r[t]=1);t[s]=a}else for(const t in i)r[t]=1}for(const t in o)t in n||(n[t]=void 0);return n}(s,[(c=t[6](),"object"==typeof c&&null!==c?c:{})]):{};var c;if(i!==(i=t[0].component.src)){if(e){nt();const t=e;st(t.$$.fragment,1,0,(()=>{lt(t,1)})),ot()}i?(e=new i(a()),ct(e.$$.fragment),rt(e.$$.fragment,1),ut(e,n.parentNode,n)):e=null}else i&&e.$set(r)},i(t){r||(e&&rt(e.$$.fragment,t),r=!0)},o(t){e&&st(e.$$.fragment,t),r=!1},d(t){t&&_(n),e&<(e,t)}}}function Et(t){let n,o,r;return{c(){n=k("div"),n.textContent="✕",M(n,"class","_toastBtn pe svelte-5er0t9"),M(n,"role","button"),M(n,"tabindex","-1")},m(e,s){w(e,n,s),o||(r=j(n,"click",t[3]),o=!0)},p:e,d(t){t&&_(n),o=!1,r()}}}function jt(t){let e,n,o,r,s,a,c,u,l,f;const d=[Ct,Bt],p=[];function h(t,e){return t[0].component?0:1}o=h(t),r=p[o]=d[o](t);let g=t[0].dismissable&&Et(t);return{c(){e=k("div"),n=k("div"),r.c(),s=C(),g&&g.c(),a=C(),c=k("progress"),M(n,"role","status"),M(n,"class","_toastMsg svelte-5er0t9"),S(n,"pe",t[0].component),M(c,"class","_toastBar svelte-5er0t9"),c.value=t[1],M(e,"class","_toastItem svelte-5er0t9"),S(e,"pe",t[0].pausable)},m(r,i){w(r,e,i),$(e,n),p[o].m(n,null),$(e,s),g&&g.m(e,null),$(e,a),$(e,c),u=!0,l||(f=[j(e,"mouseenter",t[4]),j(e,"mouseleave",t[5])],l=!0)},p(t,[s]){let i=o;o=h(t),o===i?p[o].p(t,s):(nt(),st(p[i],1,1,(()=>{p[i]=null})),ot(),r=p[o],r?r.p(t,s):(r=p[o]=d[o](t),r.c()),rt(r,1),r.m(n,null)),1&s&&S(n,"pe",t[0].component),t[0].dismissable?g?g.p(t,s):(g=Et(t),g.c(),g.m(e,a)):g&&(g.d(1),g=null),(!u||2&s)&&(c.value=t[1]),1&s&&S(e,"pe",t[0].pausable)},i(t){u||(rt(r),u=!0)},o(t){st(r),u=!1},d(t){t&&_(e),p[o].d(),g&&g.d(),l=!1,i(f)}}}function Mt(t,e,r){let s,{item:i}=e;const a=function(t,e={}){const r=bt(t);let s,i=t;function a(a,c){if(null==t)return r.set(t=a),Promise.resolve();i=a;let u=s,l=!1,{delay:f=0,duration:p=400,easing:h=n,interpolate:g=_t}=o(o({},e),c);if(0===p)return u&&(u.abort(),u=null),r.set(t=i),Promise.resolve();const $=d()+f;let y;return s=m((e=>{if(e<$)return!0;l||(y=g(t,a),"function"==typeof p&&(p=p(t,a)),l=!0),u&&(u.abort(),u=null);const n=e-$;return n>p?(r.set(t=a),!1):(r.set(t=y(h(n/p))),!0)})),s.promise}return{set:a,update:(e,n)=>a(e(i,t),n),subscribe:r.subscribe}}(i.initial,{duration:i.duration,easing:n});u(t,a,(t=>r(1,s=t)));const c=()=>xt.pop(i.id),l=()=>{1!==s&&0!==s||c()};let f=i.initial,p=f,h=!1;return D((()=>{"function"==typeof i.onpop&&i.onpop(i.id)})),t.$$set=t=>{"item"in t&&r(0,i=t.item)},t.$$.update=()=>{1&t.$$.dirty&&void 0!==i.progress&&r(0,i.next=i.progress,i),131&t.$$.dirty&&f!==i.next&&(r(7,f=i.next),p=s,h=!1,a.set(f).then(l))},[i,s,a,c,()=>{i.pausable&&!h&&s!==f&&(a.set(s,{duration:0}),h=!0)},()=>{if(h){const t=i.duration,e=t-t*((s-p)/(f-p));a.set(f,{duration:e}).then(l),h=!1}},()=>{const{props:t={},sendIdTo:e}=i.component;return e&&(t[e]=i.id),t},f]}class St extends pt{constructor(t){super(),dt(this,t,Mt,jt,c,{item:0},kt)}}function At(t){y(t,"svelte-7xr3c1","._toastContainer.svelte-7xr3c1{top:var(--toastContainerTop, 1.5rem);right:var(--toastContainerRight, 2rem);bottom:var(--toastContainerBottom, auto);left:var(--toastContainerLeft, auto);position:fixed;margin:0;padding:0;list-style-type:none;pointer-events:none;z-index:9999}")}function Rt(t,e,n){const o=t.slice();return o[5]=e[n],o}function Ot(t,o){let r,s,c,u,f,p,h,g,y,b=e;return s=new St({props:{item:o[5]}}),{key:t,first:null,c(){r=k("li"),ct(s.$$.fragment),c=C(),M(r,"class",u=l(o[5].classes.join(" "))+" svelte-7xr3c1"),M(r,"style",f=o[1](o[5].theme)),this.first=r},m(t,e){w(t,r,e),ut(s,r,null),$(r,c),y=!0},p(t,e){o=t;const n={};1&e&&(n.item=o[5]),s.$set(n),(!y||1&e&&u!==(u=l(o[5].classes.join(" "))+" svelte-7xr3c1"))&&M(r,"class",u),(!y||1&e&&f!==(f=o[1](o[5].theme)))&&M(r,"style",f)},r(){g=r.getBoundingClientRect()},f(){!function(t){const e=getComputedStyle(t);if("absolute"!==e.position&&"fixed"!==e.position){const{width:n,height:o}=e,r=t.getBoundingClientRect();t.style.position="absolute",t.style.width=n,t.style.height=o,N(t,r)}}(r),b(),N(r,g)},a(){b(),b=function(t,o,r,s){if(!o)return e;const i=t.getBoundingClientRect();if(o.left===i.left&&o.right===i.right&&o.top===i.top&&o.bottom===i.bottom)return e;const{delay:a=0,duration:c=300,easing:u=n,start:l=d()+a,end:f=l+c,tick:p=e,css:h}=r(t,{from:o,to:i},s);let g,$=!0,y=!1;function b(){h&&z(t,g),$=!1}return m((t=>{if(!y&&t>=l&&(y=!0),y&&t>=f&&(p(1,0),b()),!$)return!1;if(y){const e=0+1*u((t-l)/c);p(e,1-e)}return!0})),h&&(g=T(t,0,1,c,a,u,h)),a||(y=!0),p(0,1),b}(r,g,$t,{duration:200})},i(t){y||(rt(s.$$.fragment,t),J((()=>{h&&h.end(1),p=function(t,o,r){let s,i,c=o(t,r),u=!1,l=0;function f(){s&&z(t,s)}function p(){const{delay:o=0,duration:r=300,easing:a=n,tick:p=e,css:h}=c||it;h&&(s=T(t,0,1,r,o,a,h,l++)),p(0,1);const g=d()+o,$=g+r;i&&i.abort(),u=!0,J((()=>Z(t,!0,"start"))),i=m((e=>{if(u){if(e>=$)return p(1,0),Z(t,!0,"end"),f(),u=!1;if(e>=g){const t=a((e-g)/r);p(t,1-t)}}return u}))}let h=!1;return{start(){h||(h=!0,z(t),a(c)?(c=c(),Y().then(p)):p())},invalidate(){h=!1},end(){u&&(f(),u=!1)}}}(r,mt,o[5].intro),p.start()})),y=!0)},o(t){st(s.$$.fragment,t),p&&p.invalidate(),h=function(t,o,r){let s,c=o(t,r),u=!0;const l=et;function f(){const{delay:o=0,duration:r=300,easing:a=n,tick:f=e,css:p}=c||it;p&&(s=T(t,1,0,r,o,a,p));const h=d()+o,g=h+r;J((()=>Z(t,!1,"start"))),m((e=>{if(u){if(e>=g)return f(0,1),Z(t,!1,"end"),--l.r||i(l.c),!1;if(e>=h){const t=a((e-h)/r);f(1-t,t)}}return u}))}return l.r+=1,a(c)?Y().then((()=>{c=c(),f()})):f(),{end(e){e&&c.tick&&c.tick(1,0),u&&(s&&z(t,s),u=!1)}}}(r,gt,{}),y=!1},d(t){t&&_(r),lt(s),t&&h&&h.end()}}}function Pt(t){let e,n,o=[],r=new Map,s=t[0];const i=t=>t[5].id;for(let e=0;e<s.length;e+=1){let n=Rt(t,s,e),a=i(n);r.set(a,o[e]=Ot(a,n))}return{c(){e=k("ul");for(let t=0;t<o.length;t+=1)o[t].c();M(e,"class","_toastContainer svelte-7xr3c1")},m(t,r){w(t,e,r);for(let t=0;t<o.length;t+=1)o[t].m(e,null);n=!0},p(t,[n]){if(3&n){s=t[0],nt();for(let t=0;t<o.length;t+=1)o[t].r();o=function(t,e,n,o,r,s,i,a,c,u,l,f){let d=t.length,p=s.length,h=d;const g={};for(;h--;)g[t[h].key]=h;const m=[],$=new Map,y=new Map;for(h=p;h--;){const t=f(r,s,h),a=n(t);let c=i.get(a);c?o&&c.p(t,e):(c=u(a,t),c.c()),$.set(a,m[h]=c),a in g&&y.set(a,Math.abs(h-g[a]))}const b=new Set,v=new Set;function x(t){rt(t,1),t.m(a,l),i.set(t.key,t),l=t.first,p--}for(;d&&p;){const e=m[p-1],n=t[d-1],o=e.key,r=n.key;e===n?(l=e.first,d--,p--):$.has(r)?!i.has(o)||b.has(o)?x(e):v.has(r)?d--:y.get(o)>y.get(r)?(v.add(o),x(e)):(b.add(r),d--):(c(n,i),d--)}for(;d--;){const e=t[d];$.has(e.key)||c(e,i)}for(;p;)x(m[p-1]);return m}(o,n,i,1,t,s,r,e,at,Ot,null,Rt);for(let t=0;t<o.length;t+=1)o[t].a();ot()}},i(t){if(!n){for(let t=0;t<s.length;t+=1)rt(o[t]);n=!0}},o(t){for(let t=0;t<o.length;t+=1)st(o[t]);n=!1},d(t){t&&_(e);for(let t=0;t<o.length;t+=1)o[t].d()}}}function Tt(t,e,n){let o;u(t,xt,(t=>n(4,o=t)));let r,{options:s={}}=e,{target:i="default"}=e;return t.$$set=t=>{"options"in t&&n(2,s=t.options),"target"in t&&n(3,i=t.target)},t.$$.update=()=>{12&t.$$.dirty&&xt._init(i,s),24&t.$$.dirty&&n(0,r=o.filter((t=>t.target===i)))},[r,t=>Object.keys(t).reduce(((e,n)=>`${e}${n}:${t[n]};`),""),s,i,o]}t.SvelteToast=class extends pt{constructor(t){super(),dt(this,t,Tt,Pt,c,{options:2,target:3},At)}},t.toast=xt,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@zerodevx/svelte-toast", | ||
"version": "0.7.0-rc.1", | ||
"version": "0.7.0", | ||
"description": "Simple elegant toast notifications", | ||
@@ -11,3 +11,3 @@ "author": "Jason Lee <jason@zerodevx.com>", | ||
"scripts": { | ||
"start": "sirv docs --no-clear --port 5001", | ||
"start": "sirv docs --no-clear --port 3000", | ||
"watch:tailwind": "tailwindcss -i docs/tailwind.css -c docs/tailwind.config.js -o docs/build/global.css -w", | ||
@@ -18,6 +18,7 @@ "watch:docs": "rollup -c -w", | ||
"format": "prettier --write .", | ||
"size": "gzip-size dist/index.js --include-original", | ||
"build:docs": "rollup -c", | ||
"build:dist": "rollup -c rollup.dist.config.js", | ||
"build:tailwind": "NODE_ENV=production tailwindcss -i docs/tailwind.css -c docs/tailwind.config.js -o docs/build/global.css -m", | ||
"build": "run-s format lint build:*", | ||
"build": "run-s format lint build:* size", | ||
"cy:open": "cypress open", | ||
@@ -31,17 +32,18 @@ "cy:run": "cypress run", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@typescript-eslint/eslint-plugin": "^5.10.0", | ||
"@typescript-eslint/parser": "^5.10.0", | ||
"@typescript-eslint/eslint-plugin": "^5.12.0", | ||
"@typescript-eslint/parser": "^5.12.0", | ||
"autoprefixer": "^10.4.2", | ||
"camelcase": "^6.3.0", | ||
"cypress": "^9.3.1", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"cypress": "^9.5.0", | ||
"eslint": "^8.9.0", | ||
"eslint-config-prettier": "^8.4.0", | ||
"eslint-plugin-html": "^6.2.0", | ||
"eslint-plugin-svelte3": "^3.4.0", | ||
"gzip-size-cli": "^5.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.5", | ||
"postcss": "^8.4.6", | ||
"prettier": "^2.5.1", | ||
"prettier-plugin-svelte": "^2.6.0", | ||
"prismjs": "^1.26.0", | ||
"rollup": "^2.66.0", | ||
"prismjs": "^1.27.0", | ||
"rollup": "^2.67.3", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
@@ -51,4 +53,4 @@ "rollup-plugin-svelte": "^7.1.0", | ||
"sirv-cli": "^2.0.2", | ||
"svelte": "^3.46.2", | ||
"tailwindcss": "^3.0.15", | ||
"svelte": "^3.46.4", | ||
"tailwindcss": "^3.0.23", | ||
"typescript": "^4.5.5" | ||
@@ -61,7 +63,4 @@ }, | ||
"license": "ISC", | ||
"repository": "github:zerodevx/svelte-toast", | ||
"homepage": "https://zerodevx.github.io/svelte-toast/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zerodevx/svelte-toast.git" | ||
}, | ||
"keywords": [ | ||
@@ -68,0 +67,0 @@ "svelte", |
@@ -14,6 +14,7 @@ [![npm (scoped)](https://img.shields.io/npm/v/@zerodevx/svelte-toast/latest)](https://www.npmjs.com/package/@zerodevx/svelte-toast) | ||
[little](https://github.com/zerodevx/svelte-toast/blob/master/src/ToastItem.svelte) | ||
[lines](https://github.com/zerodevx/svelte-toast/blob/master/src/store.js) | ||
[lines](https://github.com/zerodevx/svelte-toast/blob/master/src/stores.js) | ||
[of](https://github.com/zerodevx/svelte-toast/blob/master/src/index.js) | ||
[code](https://github.com/zerodevx/svelte-toast/blob/master/src/index.d.ts). Compiled (into UMD), it's only **18kb** | ||
minified (**7kb** gzipped) and can be used in Vanilla JS, or as a Svelte component. | ||
[code](https://github.com/zerodevx/svelte-toast/blob/master/src/index.d.ts). Compiled (into UMD), | ||
it's only **18kb** minified (**7kb** gzipped) and can be used in Vanilla JS, or as a Svelte | ||
component. | ||
@@ -151,3 +152,7 @@ Because a demo helps better than a thousand API docs: https://zerodevx.github.io/svelte-toast/ | ||
color: var(--toastColor, #fff); | ||
box-shadow: var(--toastBoxShadow, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)); | ||
box-shadow: var( | ||
--toastBoxShadow, | ||
0 4px 6px -1px rgba(0, 0, 0, 0.1), | ||
0 2px 4px -1px rgba(0, 0, 0, 0.06) | ||
); | ||
border: var(--toastBorder, none); | ||
@@ -185,3 +190,4 @@ border-radius: var(--toastBorderRadius, 0.125rem); | ||
To apply CSS overrides to a particular Toast Item (on a per-toast basis), emit the toast with options: | ||
To apply CSS overrides to a particular Toast Item (on a per-toast basis), emit the toast with | ||
options: | ||
@@ -202,4 +208,5 @@ ```js | ||
For convenient composing, the recommended way is to create your own common toast actions by stubbing them out. For | ||
example: | ||
For convenient composing, you can either push toasts with | ||
[user-defined classes](#styling-with-user-defined-classes) (from `v0.7`), or create your own common | ||
toast actions by stubbing them out. For example: | ||
@@ -245,4 +252,4 @@ `my-theme.js` | ||
In a Svelte app, the easiest way to apply custom font styles is to wrap the toast container then apply styles on the | ||
wrapper: | ||
In a Svelte app, the easiest way to apply custom font styles is to wrap the toast container then | ||
apply styles on the wrapper: | ||
@@ -347,4 +354,4 @@ ```html | ||
Progress bar tweens can now be paused when the mouse cursor (on desktop) is hovered over the toast item. This behaviour | ||
is **disabled** by default. To enable, set option `pausable: true`. | ||
Progress bar tweens can now be paused when the mouse cursor (on desktop) is hovered over the toast | ||
item. This behaviour is **disabled** by default. To enable, set option `pausable: true`. | ||
@@ -357,4 +364,4 @@ ```js | ||
To support complex UIs or workflows, a Svelte component can be pushed instead of a standard message if you're using this | ||
in a Svelte project. To do so, push options with `component` defined: | ||
To support complex UIs or workflows, a Svelte component can be pushed instead of a standard message | ||
if you're using this in a Svelte project. To do so, push options with `component` defined: | ||
@@ -378,3 +385,4 @@ ```js | ||
A callback function can be run when a toast is closed. To do so, pass the function to the `onpop` toast option: | ||
A callback function can be run when a toast is closed. To do so, pass the function to the `onpop` | ||
toast option: | ||
@@ -390,2 +398,25 @@ ```js | ||
### New from `v0.7` | ||
#### Styling with User-Defined Classes | ||
Custom class names can now be passed into each toast item. Very useful for composing toast actions, | ||
or implementing CSS-only dark modes. | ||
```html | ||
<script> | ||
toast.push('Foo', { classes: ['info'] }) // background green | ||
toast.push('Bar', { classes: ['warn'] }) // background red | ||
</script> | ||
<SvelteToast options={{ classes: ['log'] }} /> | ||
<style> | ||
:global(.log.info) { | ||
--toastBackground: green; | ||
} | ||
:global(.log.warn) { | ||
--toastBackground: red; | ||
} | ||
</style> | ||
``` | ||
## Toast Options | ||
@@ -420,3 +451,4 @@ | ||
Standard Github [contribution workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962) applies. | ||
Standard Github [contribution workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962) | ||
applies. | ||
@@ -423,0 +455,0 @@ ### Tests |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
59712
460
25
1