@zerodevx/svelte-toast
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -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))}const l="undefined"!=typeof window;let f=l?()=>window.performance.now():()=>Date.now(),d=l?t=>requestAnimationFrame(t):e;const p=new Set;function g(t){p.forEach((e=>{e.c(t)||(p.delete(e),e.f())})),0!==p.size&&d(g)}function h(t){let e;return 0===p.size&&d(g),{promise:new Promise((n=>{p.add(e={c:t,f:n})})),abort(){p.delete(e)}}}function m(t,e){t.appendChild(e)}function $(t,e,n){const o=y(t);if(!o.getElementById(e)){const t=x("style");t.id=e,t.textContent=n,b(o,t)}}function y(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e.host?e:document}function b(t,e){m(t.head||t,e)}function v(t,e,n){t.insertBefore(e,n||null)}function _(t){t.parentNode.removeChild(t)}function x(t){return document.createElement(t)}function w(t){return document.createTextNode(t)}function k(){return w(" ")}function C(){return w("")}function E(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function B(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function M(t,e,n){t.classList[n?"add":"remove"](e)}class j{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=x(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)v(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(_)}}const S=new Set;let A,R=0;function O(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);S.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=function(t){const e=x("style");return b(y(t),e),e}(t).sheet),g=d.__svelte_rules||(d.__svelte_rules={});g[f]||(g[f]=!0,p.insertRule(`@keyframes ${f} ${l}`,p.cssRules.length));const h=t.style.animation||"";return t.style.animation=`${h?`${h}, `:""}${f} ${o}ms linear ${r}ms 1 both`,R+=1,f}function P(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(", "),R-=r,R||d((()=>{R||(S.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),S.clear())})))}function T(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 N(t){A=t}const z=[],I=[],L=[],q=[],D=Promise.resolve();let F=!1;function H(t){L.push(t)}let W=!1;const G=new Set;function J(){if(!W){W=!0;do{for(let t=0;t<z.length;t+=1){const e=z[t];N(e),K(e.$$)}for(N(null),z.length=0;I.length;)I.pop()();for(let t=0;t<L.length;t+=1){const e=L[t];G.has(e)||(G.add(e),e())}L.length=0}while(z.length);for(;q.length;)q.pop()();F=!1,W=!1,G.clear()}}function K(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(H)}}let Q;function U(){return Q||(Q=Promise.resolve(),Q.then((()=>{Q=null}))),Q}function V(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 X=new Set;let Y;function Z(){Y={r:0,c:[],p:Y}}function tt(){Y.r||i(Y.c),Y=Y.p}function et(t,e){t&&t.i&&(X.delete(t),t.i(e))}function nt(t,e,n,o){if(t&&t.o){if(X.has(t))return;X.add(t),Y.c.push((()=>{X.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const ot={duration:0};function rt(t,e){t.f(),function(t,e){nt(t,1,1,(()=>{e.delete(t.key)}))}(t,e)}function st(t){t&&t.c()}function it(t,e,n,o){const{fragment:s,on_mount:c,on_destroy:u,after_update:l}=t.$$;s&&s.m(e,n),o||H((()=>{const e=c.map(r).filter(a);u?u.push(...e):i(e),t.$$.on_mount=[]})),l.forEach(H)}function at(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 ct(t,e){-1===t.$$.dirty[0]&&(z.push(t),F||(F=!0,D.then(J)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ut(t,n,o,r,a,c,u,l=[-1]){const f=A;N(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(f?f.$$.context:n.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&&ct(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&&et(t.$$.fragment),it(t,n.target,n.anchor,n.customElement),J()}N(f)}class lt{$destroy(){at(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 ft(t){const e=t-1;return e*e*e+1}function dt(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 pt(t,{delay:e=0,duration:n=400,easing:o=ft,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 gt(t,e,n={}){const o=getComputedStyle(t),r="none"===o.transform?"":o.transform,s=e.from.width/t.clientWidth,i=e.from.height/t.clientHeight,c=(e.from.left-e.to.left)/s,u=(e.from.top-e.to.top)/i,l=Math.sqrt(c*c+u*u),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=ft}=n;return{delay:f,duration:a(d)?d(l):d,easing:p,css:(t,e)=>`transform: ${r} translate(${e*c}px, ${e*u}px);`}}const ht=[];function mt(t,n=e){let o;const r=new Set;function s(e){if(c(t,e)&&(t=e,o)){const e=!ht.length;for(const e of r)e[1](),ht.push(e,t);if(e){for(let t=0;t<ht.length;t+=2)ht[t][0](ht[t+1]);ht.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 $t={duration:4e3,initial:1,next:0,dismissable:!0,pausable:!1,reversed:!1,intro:{x:256},theme:{}},yt=(()=>{const{subscribe:t,update:e}=mt([]);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={...$t,...a,...i,theme:{...a.theme,...i.theme},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 bt(t){return"[object Date]"===Object.prototype.toString.call(t)}function vt(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)=>vt(t[n],e)));return t=>n.map((e=>e(t)))}if("object"===n){if(!t||!e)throw new Error("Object cannot be null");if(bt(t)&&bt(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]=vt(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){$(t,"svelte-g0aua1","._toastItem.svelte-g0aua1{width:var(--toastWidth,16rem);height:var(--toastHeight,auto);min-height:var(--toastMinHeight,3.5rem);margin:var(--toastMargin,0 0 0.5rem 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-radius:var(--toastBorderRadius,0.125rem);position:relative;display:flex;flex-direction:row;align-items:center;will-change:transform,opacity;-webkit-tap-highlight-color:transparent}._toastMsg.svelte-g0aua1{padding:var(--toastMsgPadding,0.75rem 0.5rem);flex:1 1 0%}.pe.svelte-g0aua1,._toastMsg.svelte-g0aua1 a{pointer-events:auto}._toastBtn.svelte-g0aua1{width:2rem;height:100%;font:1rem sans-serif;display:flex;align-items:center;justify-content:center;cursor:pointer;outline:none}._toastBar.svelte-g0aua1{display:block;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;position:absolute;bottom:0;width:100%;height:6px;background:transparent}._toastBar.svelte-g0aua1::-webkit-progress-bar{background:transparent}._toastBar.svelte-g0aua1::-webkit-progress-value{background:var(--toastProgressBackground,rgba(33,150,243,0.75))}._toastBar.svelte-g0aua1::-moz-progress-bar{background:var(--toastProgressBackground,rgba(33,150,243,0.75))}")}function xt(t){let n,o,r=t[0].msg+"";return{c(){n=new j,o=C(),n.a=o},m(t,e){n.m(r,t,e),v(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 wt(t){let e,n,r;const s=[t[5]()];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&&st(e.$$.fragment),n=C()},m(t,o){e&&it(e,t,o),v(t,n,o),r=!0},p(t,o){const r=32&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[5](),"object"==typeof c&&null!==c?c:{})]):{};var c;if(i!==(i=t[0].component.src)){if(e){Z();const t=e;nt(t.$$.fragment,1,0,(()=>{at(t,1)})),tt()}i?(e=new i(a()),st(e.$$.fragment),et(e.$$.fragment,1),it(e,n.parentNode,n)):e=null}else i&&e.$set(r)},i(t){r||(e&&et(e.$$.fragment,t),r=!0)},o(t){e&&nt(e.$$.fragment,t),r=!1},d(t){t&&_(n),e&&at(e,t)}}}function kt(t){let n,o,r;return{c(){n=x("div"),n.textContent="✕",B(n,"class","_toastBtn pe svelte-g0aua1"),B(n,"role","button"),B(n,"tabindex","-1")},m(e,s){v(e,n,s),o||(r=E(n,"click",t[7]),o=!0)},p:e,d(t){t&&_(n),o=!1,r()}}}function Ct(t){let e,n,o,r,s,a,c,u,l,f;const d=[wt,xt],p=[];function g(t,e){return t[0].component?0:1}o=g(t),r=p[o]=d[o](t);let h=t[0].dismissable&&kt(t);return{c(){e=x("div"),n=x("div"),r.c(),s=k(),h&&h.c(),a=k(),c=x("progress"),B(n,"class","_toastMsg svelte-g0aua1"),M(n,"pe",t[0].component),B(c,"class","_toastBar svelte-g0aua1"),c.value=t[1],B(e,"class","_toastItem svelte-g0aua1"),M(e,"pe",t[0].pausable)},m(r,i){v(r,e,i),m(e,n),p[o].m(n,null),m(e,s),h&&h.m(e,null),m(e,a),m(e,c),u=!0,l||(f=[E(e,"mouseenter",t[3]),E(e,"mouseleave",t[4])],l=!0)},p(t,[s]){let i=o;o=g(t),o===i?p[o].p(t,s):(Z(),nt(p[i],1,1,(()=>{p[i]=null})),tt(),r=p[o],r?r.p(t,s):(r=p[o]=d[o](t),r.c()),et(r,1),r.m(n,null)),1&s&&M(n,"pe",t[0].component),t[0].dismissable?h?h.p(t,s):(h=kt(t),h.c(),h.m(e,a)):h&&(h.d(1),h=null),(!u||2&s)&&(c.value=t[1]),1&s&&M(e,"pe",t[0].pausable)},i(t){u||(et(r),u=!0)},o(t){nt(r),u=!1},d(t){t&&_(e),p[o].d(),h&&h.d(),l=!1,i(f)}}}function Et(t,e,r){let s,{item:i}=e;const a=function(t,e={}){const r=mt(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:d=0,duration:p=400,easing:g=n,interpolate:m=vt}=o(o({},e),c);if(0===p)return u&&(u.abort(),u=null),r.set(t=i),Promise.resolve();const $=f()+d;let y;return s=h((e=>{if(e<$)return!0;l||(y=m(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(g(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=()=>{1!==s&&0!==s||yt.pop(i.id)};let l=i.initial;return 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),65&t.$$.dirty&&l!==i.next&&(a.set(i.next).then(c),r(6,l=i.next))},[i,s,a,()=>{i.pausable&&a.set(s,{duration:0})},()=>{if(i.pausable){const t=(s-i.initial)/(i.next-i.initial),e=i.duration-i.duration*t;a.set(i.next,{duration:e}).then(c)}},()=>{const{props:t={},sendIdTo:e}=i.component;return e&&(t[e]=i.id),t},l,()=>yt.pop(i.id)]}class Bt extends lt{constructor(t){super(),ut(this,t,Et,Ct,c,{item:0},_t)}}function Mt(t){$(t,"svelte-1wt6bln","ul.svelte-1wt6bln{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 jt(t,e,n){const o=t.slice();return o[5]=e[n],o}function St(t,o){let r,s,c,u,l,d,p,g,$=e;return s=new Bt({props:{item:o[5]}}),{key:t,first:null,c(){r=x("li"),st(s.$$.fragment),c=k(),B(r,"style",u=o[1](o[5].theme)),this.first=r},m(t,e){v(t,r,e),it(s,r,null),m(r,c),g=!0},p(t,e){o=t;const n={};1&e&&(n.item=o[5]),s.$set(n),(!g||1&e&&u!==(u=o[1](o[5].theme)))&&B(r,"style",u)},r(){p=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,T(t,r)}}(r),$(),T(r,p)},a(){$(),$=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=f()+a,end:d=l+c,tick:p=e,css:g}=r(t,{from:o,to:i},s);let m,$=!0,y=!1;function b(){g&&P(t,m),$=!1}return h((t=>{if(!y&&t>=l&&(y=!0),y&&t>=d&&(p(1,0),b()),!$)return!1;if(y){const e=0+1*u((t-l)/c);p(e,1-e)}return!0})),g&&(m=O(t,0,1,c,a,u,g)),a||(y=!0),p(0,1),b}(r,p,gt,{duration:200})},i(t){g||(et(s.$$.fragment,t),H((()=>{d&&d.end(1),l=function(t,o,r){let s,i,c=o(t,r),u=!1,l=0;function d(){s&&P(t,s)}function p(){const{delay:o=0,duration:r=300,easing:a=n,tick:p=e,css:g}=c||ot;g&&(s=O(t,0,1,r,o,a,g,l++)),p(0,1);const m=f()+o,$=m+r;i&&i.abort(),u=!0,H((()=>V(t,!0,"start"))),i=h((e=>{if(u){if(e>=$)return p(1,0),V(t,!0,"end"),d(),u=!1;if(e>=m){const t=a((e-m)/r);p(t,1-t)}}return u}))}let g=!1;return{start(){g||(g=!0,P(t),a(c)?(c=c(),U().then(p)):p())},invalidate(){g=!1},end(){u&&(d(),u=!1)}}}(r,pt,o[5].intro),l.start()})),g=!0)},o(t){nt(s.$$.fragment,t),l&&l.invalidate(),d=function(t,o,r){let s,c=o(t,r),u=!0;const l=Y;function d(){const{delay:o=0,duration:r=300,easing:a=n,tick:d=e,css:p}=c||ot;p&&(s=O(t,1,0,r,o,a,p));const g=f()+o,m=g+r;H((()=>V(t,!1,"start"))),h((e=>{if(u){if(e>=m)return d(0,1),V(t,!1,"end"),--l.r||i(l.c),!1;if(e>=g){const t=a((e-g)/r);d(1-t,t)}}return u}))}return l.r+=1,a(c)?U().then((()=>{c=c(),d()})):d(),{end(e){e&&c.tick&&c.tick(1,0),u&&(s&&P(t,s),u=!1)}}}(r,dt,{}),g=!1},d(t){t&&_(r),at(s),t&&d&&d.end()}}}function At(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=jt(t,s,e),a=i(n);r.set(a,o[e]=St(a,n))}return{c(){e=x("ul");for(let t=0;t<o.length;t+=1)o[t].c();B(e,"class","svelte-1wt6bln")},m(t,r){v(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],Z();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,g=d;const h={};for(;g--;)h[t[g].key]=g;const m=[],$=new Map,y=new Map;for(g=p;g--;){const t=f(r,s,g),a=n(t);let c=i.get(a);c?o&&c.p(t,e):(c=u(a,t),c.c()),$.set(a,m[g]=c),a in h&&y.set(a,Math.abs(g-h[a]))}const b=new Set,v=new Set;function _(t){et(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)?_(e):v.has(r)?d--:y.get(o)>y.get(r)?(v.add(o),_(e)):(b.add(r),d--):(c(n,i),d--)}for(;d--;){const e=t[d];$.has(e.key)||c(e,i)}for(;p;)_(m[p-1]);return m}(o,n,i,1,t,s,r,e,rt,St,null,jt);for(let t=0;t<o.length;t+=1)o[t].a();tt()}},i(t){if(!n){for(let t=0;t<s.length;t+=1)et(o[t]);n=!0}},o(t){for(let t=0;t<o.length;t+=1)nt(o[t]);n=!1},d(t){t&&_(e);for(let t=0;t<o.length;t+=1)o[t].d()}}}function Rt(t,e,n){let o;u(t,yt,(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&&yt._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 lt{constructor(t){super(),ut(this,t,Rt,At,c,{options:2,target:3},Mt)}},t.toast=yt,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))}const l="undefined"!=typeof window;let f=l?()=>window.performance.now():()=>Date.now(),d=l?t=>requestAnimationFrame(t):e;const p=new Set;function g(t){p.forEach((e=>{e.c(t)||(p.delete(e),e.f())})),0!==p.size&&d(g)}function h(t){let e;return 0===p.size&&d(g),{promise:new Promise((n=>{p.add(e={c:t,f:n})})),abort(){p.delete(e)}}}function m(t,e){t.appendChild(e)}function $(t,e,n){const o=y(t);if(!o.getElementById(e)){const t=x("style");t.id=e,t.textContent=n,b(o,t)}}function y(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e.host?e:document}function b(t,e){m(t.head||t,e)}function v(t,e,n){t.insertBefore(e,n||null)}function _(t){t.parentNode.removeChild(t)}function x(t){return document.createElement(t)}function w(t){return document.createTextNode(t)}function k(){return w(" ")}function C(){return w("")}function E(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function B(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function j(t,e,n){t.classList[n?"add":"remove"](e)}class M{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=x(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)v(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(_)}}const S=new Set;let A,R=0;function O(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);S.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=function(t){const e=x("style");return b(y(t),e),e}(t).sheet),g=d.__svelte_rules||(d.__svelte_rules={});g[f]||(g[f]=!0,p.insertRule(`@keyframes ${f} ${l}`,p.cssRules.length));const h=t.style.animation||"";return t.style.animation=`${h?`${h}, `:""}${f} ${o}ms linear ${r}ms 1 both`,R+=1,f}function P(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(", "),R-=r,R||d((()=>{R||(S.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),S.clear())})))}function T(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 N(t){A=t}const z=[],I=[],L=[],q=[],D=Promise.resolve();let F=!1;function H(t){L.push(t)}let W=!1;const G=new Set;function J(){if(!W){W=!0;do{for(let t=0;t<z.length;t+=1){const e=z[t];N(e),K(e.$$)}for(N(null),z.length=0;I.length;)I.pop()();for(let t=0;t<L.length;t+=1){const e=L[t];G.has(e)||(G.add(e),e())}L.length=0}while(z.length);for(;q.length;)q.pop()();F=!1,W=!1,G.clear()}}function K(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(H)}}let Q;function U(){return Q||(Q=Promise.resolve(),Q.then((()=>{Q=null}))),Q}function V(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 X=new Set;let Y;function Z(){Y={r:0,c:[],p:Y}}function tt(){Y.r||i(Y.c),Y=Y.p}function et(t,e){t&&t.i&&(X.delete(t),t.i(e))}function nt(t,e,n,o){if(t&&t.o){if(X.has(t))return;X.add(t),Y.c.push((()=>{X.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}const ot={duration:0};function rt(t,e){t.f(),function(t,e){nt(t,1,1,(()=>{e.delete(t.key)}))}(t,e)}function st(t){t&&t.c()}function it(t,e,n,o){const{fragment:s,on_mount:c,on_destroy:u,after_update:l}=t.$$;s&&s.m(e,n),o||H((()=>{const e=c.map(r).filter(a);u?u.push(...e):i(e),t.$$.on_mount=[]})),l.forEach(H)}function at(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 ct(t,e){-1===t.$$.dirty[0]&&(z.push(t),F||(F=!0,D.then(J)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ut(t,n,o,r,a,c,u,l=[-1]){const f=A;N(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(f?f.$$.context:n.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&&ct(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&&et(t.$$.fragment),it(t,n.target,n.anchor,n.customElement),J()}N(f)}class lt{$destroy(){at(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 ft(t){const e=t-1;return e*e*e+1}function dt(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 pt(t,{delay:e=0,duration:n=400,easing:o=ft,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 gt(t,e,n={}){const o=getComputedStyle(t),r="none"===o.transform?"":o.transform,s=e.from.width/t.clientWidth,i=e.from.height/t.clientHeight,c=(e.from.left-e.to.left)/s,u=(e.from.top-e.to.top)/i,l=Math.sqrt(c*c+u*u),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=ft}=n;return{delay:f,duration:a(d)?d(l):d,easing:p,css:(t,e)=>`transform: ${r} translate(${e*c}px, ${e*u}px);`}}const ht=[];function mt(t,n=e){let o;const r=new Set;function s(e){if(c(t,e)&&(t=e,o)){const e=!ht.length;for(const e of r)e[1](),ht.push(e,t);if(e){for(let t=0;t<ht.length;t+=2)ht[t][0](ht[t+1]);ht.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 $t={duration:4e3,initial:1,next:0,pausable:!1,dismissable:!0,reversed:!1,intro:{x:256},theme:{}},yt=(()=>{const{subscribe:t,update:e}=mt([]);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={...$t,...a,...i,theme:{...a.theme,...i.theme},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 bt(t){return"[object Date]"===Object.prototype.toString.call(t)}function vt(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)=>vt(t[n],e)));return t=>n.map((e=>e(t)))}if("object"===n){if(!t||!e)throw new Error("Object cannot be null");if(bt(t)&&bt(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]=vt(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){$(t,"svelte-g0aua1","._toastItem.svelte-g0aua1{width:var(--toastWidth,16rem);height:var(--toastHeight,auto);min-height:var(--toastMinHeight,3.5rem);margin:var(--toastMargin,0 0 0.5rem 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-radius:var(--toastBorderRadius,0.125rem);position:relative;display:flex;flex-direction:row;align-items:center;will-change:transform,opacity;-webkit-tap-highlight-color:transparent}._toastMsg.svelte-g0aua1{padding:var(--toastMsgPadding,0.75rem 0.5rem);flex:1 1 0%}.pe.svelte-g0aua1,._toastMsg.svelte-g0aua1 a{pointer-events:auto}._toastBtn.svelte-g0aua1{width:2rem;height:100%;font:1rem sans-serif;display:flex;align-items:center;justify-content:center;cursor:pointer;outline:none}._toastBar.svelte-g0aua1{display:block;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;position:absolute;bottom:0;width:100%;height:6px;background:transparent}._toastBar.svelte-g0aua1::-webkit-progress-bar{background:transparent}._toastBar.svelte-g0aua1::-webkit-progress-value{background:var(--toastProgressBackground,rgba(33,150,243,0.75))}._toastBar.svelte-g0aua1::-moz-progress-bar{background:var(--toastProgressBackground,rgba(33,150,243,0.75))}")}function xt(t){let n,o,r=t[0].msg+"";return{c(){n=new M,o=C(),n.a=o},m(t,e){n.m(r,t,e),v(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 wt(t){let e,n,r;const s=[t[5]()];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&&st(e.$$.fragment),n=C()},m(t,o){e&&it(e,t,o),v(t,n,o),r=!0},p(t,o){const r=32&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[5](),"object"==typeof c&&null!==c?c:{})]):{};var c;if(i!==(i=t[0].component.src)){if(e){Z();const t=e;nt(t.$$.fragment,1,0,(()=>{at(t,1)})),tt()}i?(e=new i(a()),st(e.$$.fragment),et(e.$$.fragment,1),it(e,n.parentNode,n)):e=null}else i&&e.$set(r)},i(t){r||(e&&et(e.$$.fragment,t),r=!0)},o(t){e&&nt(e.$$.fragment,t),r=!1},d(t){t&&_(n),e&&at(e,t)}}}function kt(t){let n,o,r;return{c(){n=x("div"),n.textContent="✕",B(n,"class","_toastBtn pe svelte-g0aua1"),B(n,"role","button"),B(n,"tabindex","-1")},m(e,s){v(e,n,s),o||(r=E(n,"click",t[7]),o=!0)},p:e,d(t){t&&_(n),o=!1,r()}}}function Ct(t){let e,n,o,r,s,a,c,u,l,f;const d=[wt,xt],p=[];function g(t,e){return t[0].component?0:1}o=g(t),r=p[o]=d[o](t);let h=t[0].dismissable&&kt(t);return{c(){e=x("div"),n=x("div"),r.c(),s=k(),h&&h.c(),a=k(),c=x("progress"),B(n,"class","_toastMsg svelte-g0aua1"),j(n,"pe",t[0].component),B(c,"class","_toastBar svelte-g0aua1"),c.value=t[1],B(e,"class","_toastItem svelte-g0aua1"),j(e,"pe",t[0].pausable)},m(r,i){v(r,e,i),m(e,n),p[o].m(n,null),m(e,s),h&&h.m(e,null),m(e,a),m(e,c),u=!0,l||(f=[E(e,"mouseenter",t[3]),E(e,"mouseleave",t[4])],l=!0)},p(t,[s]){let i=o;o=g(t),o===i?p[o].p(t,s):(Z(),nt(p[i],1,1,(()=>{p[i]=null})),tt(),r=p[o],r?r.p(t,s):(r=p[o]=d[o](t),r.c()),et(r,1),r.m(n,null)),1&s&&j(n,"pe",t[0].component),t[0].dismissable?h?h.p(t,s):(h=kt(t),h.c(),h.m(e,a)):h&&(h.d(1),h=null),(!u||2&s)&&(c.value=t[1]),1&s&&j(e,"pe",t[0].pausable)},i(t){u||(et(r),u=!0)},o(t){nt(r),u=!1},d(t){t&&_(e),p[o].d(),h&&h.d(),l=!1,i(f)}}}function Et(t,e,r){let s,{item:i}=e;const a=function(t,e={}){const r=mt(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:d=0,duration:p=400,easing:g=n,interpolate:m=vt}=o(o({},e),c);if(0===p)return u&&(u.abort(),u=null),r.set(t=i),Promise.resolve();const $=f()+d;let y;return s=h((e=>{if(e<$)return!0;l||(y=m(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(g(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=()=>{1!==s&&0!==s||yt.pop(i.id)};let l=i.initial,d=l,p=!1;return 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),67&t.$$.dirty&&l!==i.next&&(r(6,l=i.next),d=s,p=!1,a.set(l).then(c))},[i,s,a,()=>{i.pausable&&!p&&s!==l&&(a.set(s,{duration:0}),p=!0)},()=>{if(i.pausable&&p){const t=i.duration-i.duration*((s-d)/(l-d));a.set(l,{duration:t}).then(c),p=!1}},()=>{const{props:t={},sendIdTo:e}=i.component;return e&&(t[e]=i.id),t},l,()=>yt.pop(i.id)]}class Bt extends lt{constructor(t){super(),ut(this,t,Et,Ct,c,{item:0},_t)}}function jt(t){$(t,"svelte-1vrb3hj","._toastContainer.svelte-1vrb3hj{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 Mt(t,e,n){const o=t.slice();return o[5]=e[n],o}function St(t,o){let r,s,c,u,l,d,p,g,$=e;return s=new Bt({props:{item:o[5]}}),{key:t,first:null,c(){r=x("li"),st(s.$$.fragment),c=k(),B(r,"style",u=o[1](o[5].theme)),this.first=r},m(t,e){v(t,r,e),it(s,r,null),m(r,c),g=!0},p(t,e){o=t;const n={};1&e&&(n.item=o[5]),s.$set(n),(!g||1&e&&u!==(u=o[1](o[5].theme)))&&B(r,"style",u)},r(){p=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,T(t,r)}}(r),$(),T(r,p)},a(){$(),$=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=f()+a,end:d=l+c,tick:p=e,css:g}=r(t,{from:o,to:i},s);let m,$=!0,y=!1;function b(){g&&P(t,m),$=!1}return h((t=>{if(!y&&t>=l&&(y=!0),y&&t>=d&&(p(1,0),b()),!$)return!1;if(y){const e=0+1*u((t-l)/c);p(e,1-e)}return!0})),g&&(m=O(t,0,1,c,a,u,g)),a||(y=!0),p(0,1),b}(r,p,gt,{duration:200})},i(t){g||(et(s.$$.fragment,t),H((()=>{d&&d.end(1),l=function(t,o,r){let s,i,c=o(t,r),u=!1,l=0;function d(){s&&P(t,s)}function p(){const{delay:o=0,duration:r=300,easing:a=n,tick:p=e,css:g}=c||ot;g&&(s=O(t,0,1,r,o,a,g,l++)),p(0,1);const m=f()+o,$=m+r;i&&i.abort(),u=!0,H((()=>V(t,!0,"start"))),i=h((e=>{if(u){if(e>=$)return p(1,0),V(t,!0,"end"),d(),u=!1;if(e>=m){const t=a((e-m)/r);p(t,1-t)}}return u}))}let g=!1;return{start(){g||(g=!0,P(t),a(c)?(c=c(),U().then(p)):p())},invalidate(){g=!1},end(){u&&(d(),u=!1)}}}(r,pt,o[5].intro),l.start()})),g=!0)},o(t){nt(s.$$.fragment,t),l&&l.invalidate(),d=function(t,o,r){let s,c=o(t,r),u=!0;const l=Y;function d(){const{delay:o=0,duration:r=300,easing:a=n,tick:d=e,css:p}=c||ot;p&&(s=O(t,1,0,r,o,a,p));const g=f()+o,m=g+r;H((()=>V(t,!1,"start"))),h((e=>{if(u){if(e>=m)return d(0,1),V(t,!1,"end"),--l.r||i(l.c),!1;if(e>=g){const t=a((e-g)/r);d(1-t,t)}}return u}))}return l.r+=1,a(c)?U().then((()=>{c=c(),d()})):d(),{end(e){e&&c.tick&&c.tick(1,0),u&&(s&&P(t,s),u=!1)}}}(r,dt,{}),g=!1},d(t){t&&_(r),at(s),t&&d&&d.end()}}}function At(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=Mt(t,s,e),a=i(n);r.set(a,o[e]=St(a,n))}return{c(){e=x("ul");for(let t=0;t<o.length;t+=1)o[t].c();B(e,"class","_toastContainer svelte-1vrb3hj")},m(t,r){v(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],Z();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,g=d;const h={};for(;g--;)h[t[g].key]=g;const m=[],$=new Map,y=new Map;for(g=p;g--;){const t=f(r,s,g),a=n(t);let c=i.get(a);c?o&&c.p(t,e):(c=u(a,t),c.c()),$.set(a,m[g]=c),a in h&&y.set(a,Math.abs(g-h[a]))}const b=new Set,v=new Set;function _(t){et(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)?_(e):v.has(r)?d--:y.get(o)>y.get(r)?(v.add(o),_(e)):(b.add(r),d--):(c(n,i),d--)}for(;d--;){const e=t[d];$.has(e.key)||c(e,i)}for(;p;)_(m[p-1]);return m}(o,n,i,1,t,s,r,e,rt,St,null,Mt);for(let t=0;t<o.length;t+=1)o[t].a();tt()}},i(t){if(!n){for(let t=0;t<s.length;t+=1)et(o[t]);n=!0}},o(t){for(let t=0;t<o.length;t+=1)nt(o[t]);n=!1},d(t){t&&_(e);for(let t=0;t<o.length;t+=1)o[t].d()}}}function Rt(t,e,n){let o;u(t,yt,(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&&yt._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 lt{constructor(t){super(),ut(this,t,Rt,At,c,{options:2,target:3},jt)}},t.toast=yt,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@zerodevx/svelte-toast", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Simple elegant toast notifications", | ||
@@ -48,3 +48,3 @@ "author": "Jason Lee <jason@zerodevx.com>", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"sirv-cli": "^1.0.12", | ||
"sirv-cli": "^1.0.14", | ||
"svelte": "^3.42.1", | ||
@@ -51,0 +51,0 @@ "tailwindcss": "^2.2.7", |
@@ -18,3 +18,3 @@ [![npm (scoped)](https://img.shields.io/npm/v/@zerodevx/svelte-toast)](https://www.npmjs.com/package/@zerodevx/svelte-toast) | ||
Compiled (into UMD), it's only **17kb** minified (**7kb** gzipped) and can be used in Vanilla JS, | ||
as a Svelte component. | ||
or as a Svelte component. | ||
@@ -145,3 +145,3 @@ Because a demo helps better than a thousand API docs: https://zerodevx.github.io/svelte-toast/ | ||
._toastProgressBar { | ||
._toastBar { | ||
background: var(--toastProgressBackground, rgba(33,150,243,0.75)); | ||
@@ -323,4 +323,4 @@ } | ||
Progress bar tweens can now be paused when the mouse cursor (on desktop) is hovered on the toast item. | ||
This behaviour by default is **disabled**. 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`. | ||
@@ -333,5 +333,4 @@ ```js | ||
To allow for complex UI or workflows, a Svelte component can be pushed instead of a standard message. | ||
Obviously, this works only if you're consuming `svelte-toast` as part of a larger Svelte project. | ||
To do so, push options with `component` property defined: | ||
To support complex UI or workflows, a Svelte component can be pushed instead of a standard message if | ||
you're using this package in a Svelte project. To do so, push options with `component` defined: | ||
@@ -343,7 +342,7 @@ ```js | ||
component: { | ||
src: MyCustomSvelteComponent, // set the `src` to the component itself (required) | ||
src: MyCustomSvelteComponent, // set `src` to the component itself (required) | ||
props: { // optionally pass in `props` as key/value pairs | ||
... | ||
}, | ||
sendIdTo: 'toastId' // optionally forward the toast id to `toastId` prop | ||
sendIdTo: 'toastId' // optionally forward toast id to `toastId` prop | ||
}, | ||
@@ -362,4 +361,4 @@ ... // any other toast options | ||
next: 0, // next progress value | ||
pausable: false, // pause progress bar tween on mouse hover | ||
dismissable: true, // allow dismiss with close button | ||
pausable: false, // allow pause on mouse hover | ||
reversed: false, // insert new toast to bottom of stack | ||
@@ -374,4 +373,4 @@ intro: { x: 256 }, // toast intro fly animation settings | ||
```js | ||
const id = toast.push(message, { ...options }) | ||
toast.pop(id) // accepts a filter function too | ||
const id = toast.push(msg, { ...options }) | ||
toast.pop(id || fn || undefined) | ||
toast.set(id, { ...options }) | ||
@@ -378,0 +377,0 @@ ``` |
@@ -14,4 +14,4 @@ // index.d.ts | ||
* next: 0, // next progress value | ||
* pausable: false, // pause progress bar tween on mouse hover | ||
* dismissable: true, // allow dismiss with close button | ||
* pausable: false, // allow pause on mouse hover | ||
* reversed: false, // insert new toast to bottom of stack | ||
@@ -31,4 +31,4 @@ * intro: { x: 256 }, // toast intro fly animation settings | ||
progress?: number | ||
pausable?: boolean | ||
dismissable?: boolean | ||
pausable?: boolean | ||
reversed?: boolean | ||
@@ -35,0 +35,0 @@ intro?: FlyParams |
@@ -7,4 +7,4 @@ import { writable } from 'svelte/store' | ||
next: 0, | ||
pausable: false, | ||
dismissable: true, | ||
pausable: false, | ||
reversed: false, | ||
@@ -11,0 +11,0 @@ intro: { x: 256 }, |
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
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
54480
391