Comparing version 0.2.0 to 0.3.0
@@ -1,1 +0,1 @@ | ||
/*! effekt 0.2.0 | https://github.com/ivodolenc/effekt | MIT License | Ivo Dolenc (c) 2024 */var Effekt=function(m){"use strict";function $(e){return e*1e3}function E(e){return e/1e3}function gt(e,t=2){return t=10**t,Math.round(e*t)/t}function P(e,t,s){return Math.min(Math.max(s,e),t)}function T(e,t,s){return-s*e+s*t+e}function q(e,t,s){const i=e*e;return Math.sqrt(Math.max(0,s*(t*t-i)+i))}function C(e,t,s){const i=t-e;return i===0?1:(s-e)/i}function z(...e){return t=>e.reduce((s,i)=>i(s),t)}const yt=e=>Object.prototype.toString.call(e).slice(8,-1),w=e=>typeof e=="number"&&!isNaN(e),vt=e=>typeof e=="string",D=e=>e===null,W=e=>typeof e>"u",A=e=>yt(e)==="Object",y=e=>Array.isArray(e),Rt=e=>e instanceof Function,Tt=e=>e instanceof Element,wt=e=>e instanceof HTMLElement,St=e=>e instanceof SVGElement,H=e=>!!(e&&(wt(e)||St(e)));function $t(e,t){return s=>T(e,t,s)}function Dt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)i.push(o=>T(e[a],t[a],o)),n[a]=i[a](s);return n}}function L(e,t){return s=>{const i=[],n=[],{round:a}=Math,r=3;for(let o=0;o<r;o++)i.push(h=>q(e[o],t[o],h)),n[o]=a(P(0,255,i[o](s)));return i.push(o=>T(e[r],t[r],o)),n[r]=a(P(0,1,i[r](s))*1e5)/1e5,n}}function Mt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)w(e[a])?i.push(o=>T(e[a],t[a],o)):i.push(o=>L(e[a],t[a])(o)),n[a]=i[a](s);return n}}function bt(e,t={}){return t.type==="color"?L:t.type==="shadow"?Mt:y(e)?Dt:$t}function xt(e,t={}){const{ease:s,type:i}=t,n=[],a=bt(e[0],{type:i});for(let r=0,o=e.length-1;r<o;r++){let h=a(e[r],e[r+1]);if(s){const l=y(s)?s[r]:s;h=z(l,h)}n.push(h)}return n}function R(e,t,s={}){const i=t.length,n=i-1;t[0]>t[n]&&(t=[...t].reverse(),e=[...e].reverse());const a=xt(e,s),r=a.length;return o=>{let h=0;if(r>1)for(;h<i-2&&!(o<t[h+1]);h++);const l=C(t[h],t[h+1],o);return a[h](l)}}function G(e){let t=e.slice(1);t.length===3&&(t=`${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`);const s=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16)/255||1;return[s,i,n,a]}function O(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<.16666666666666666?e+(t-e)*6*s:s<.5?t:s<.6666666666666666?e+(t-e)*(.6666666666666666-s)*6:e}function Q(e,t,s,i){let n,a,r;if(e/=360,t/=100,s/=100,t===0)n=a=r=s;else{const{round:o}=Math,h=s<.5?s*(1+t):s+t-s*t,l=2*s-h;n=o(O(l,h,e+.3333333333333333)*255),a=o(O(l,h,e)*255),r=o(O(l,h,e-.3333333333333333)*255)}return[n,a,r,i]}function kt(e,t){if(w(e))return e;if(e==="first")return 0;const s=t-1;return e==="last"?s:s/2}function Et(e=.1,t={}){const{delay:s=0,from:i=0,ease:n,grid:a,axis:r}=t,{floor:o,sqrt:h,abs:l}=Math;return(c,p)=>{const u=kt(i,p),f=!w(u)&&u==="center";let d=0;if(!a)d=l(u-c);else{const v=f?(a[0]-1)/2:u%a[0],S=f?(a[1]-1)/2:o(u/a[0]),N=c%a[0],k=o(c/a[0]),Z=v-N,B=S-k;let V=h(Z*Z+B*B);r==="x"&&(V=-Z),r==="y"&&(V=-B),d=V}let g=e*d;if(n){const v=p*e;g=n(g/v)*v}return s+g}}function X(e){const t=[];if(e)for(let s=0,i=e.length;s<i;s++){const n=e[s];H(n)&&t.push(n)}return t}function Y(e){if(Tt(e)){if(H(e))return[e]}else if(vt(e)){const t=X(document.querySelectorAll(e));if(t.length)return t}else{const t=X(e);if(t.length)return t}throw new TypeError("Animation target not found.")}function M(e,t,s){const i=t;if(!W(e.style[i]))return e.style[i]=s;throw new TypeError(`Unsupported '${t}' property.`)}function J(e){let t=new Set,s=new Set,i=!1,n=!1;const a=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function o(l){a.has(l)&&(h.schedule(l),e()),l(r)}const h={schedule:(l,c=!1,p=!1)=>{const u=p&&i?t:s;return c&&a.add(l),u.has(l)||u.add(l),l},cancel:l=>{s.delete(l),a.delete(l)},process:l=>{if(r=l,i){n=!0;return}i=!0,[t,s]=[s,t],s.clear(),t.forEach(o),i=!1,n&&(n=!1,h.process(l))}};return h}const x=["read","update","render"],Pt=40;function _(e=requestAnimationFrame,t=!0){let s=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,r=x.reduce((u,f)=>(u[f]=J(a),u),{}),{read:o,update:h,render:l}=r,c=()=>{const u=performance.now();s=!1,n.delta=i?1e3/60:Math.max(Math.min(u-n.timestamp,Pt),1),n.timestamp=u,n.isProcessing=!0,o.process(n),h.process(n),l.process(n),n.isProcessing=!1,s&&t&&(i=!1,e(c))},p=()=>{s=!0,i=!0,n.isProcessing||e(c)};return{schedule:x.reduce((u,f)=>{const d=r[f];return u[f]=(g,v=!1,S=!1)=>(s||p(),d.schedule(g,v,S)),u},{}),cancel:u=>{for(let f=0;f<x.length;f++)r[x[f]].cancel(u)},state:n}}const{schedule:j,cancel:F,state:U}=_();function tt(e,t,s){return e&&!W(t)&&!W(s)?Rt(e)?$(e(t,s)):$(e):0}function Ct(e){return e?e===1/0?1e3:e+1:1}function et(e={}){const{el:t}=e,s=new WeakMap;s.set(t.value,{delta:0,timestamp:0,playState:"idle",promiseState:"pending",time:0,initTime:0,startTime:0,pauseTime:null,totalDuration:600,maxDuration:600,progress:0,totalProgress:1,isReverse:!1,autoplay:e.autoplay??!0,direction:e.direction||"normal",playRate:e.playRate||1,duration:$(e.duration||.6),delay:tt(e.delay,t?.index,t?.total),endDelay:tt(e.endDelay,t?.index,t?.total),repeat:Ct(e.repeat)});const i=s.get(t.value);return i.totalDuration=i.duration*i.repeat,i.maxDuration=i.totalDuration+i.delay+i.endDelay,i}class st{#s={};#r=new WeakMap;#i;#e;#o=!1;#l=!1;#h=0;constructor(t,s={}){const{onRender:i,onComplete:n}=s;this.#r.set(this.#s,t),i&&(this.#i=new WeakMap,this.#i.set(this.#s,i)),n&&(this.#e=new WeakMap,this.#e.set(this.#s,n)),this.#t.autoplay&&this.play()}#c(){this.#o||(j.update(this.#a,!0),this.#n(!0),this.#o=!0)}#u(){this.#o&&(F(this.#a),this.#i&&F(this.#i.get(this.#s)),this.#o=!1)}#n(t=!1){this.#i&&j.render(this.#i.get(this.#s),t)}#a=({timestamp:t,delta:s})=>{this.#t.timestamp=t,this.#t.delta=s;let i=0;D(this.#t.pauseTime)?this.#t.playRate<0?(this.#l||(this.#l=!0,this.#h=t,this.#t.startTime=this.#t.progress===0?t*this.#t.playRate:this.#t.totalDuration-t-this.#t.time),i=t-this.#t.startTime/this.#t.playRate):this.#t.playRate>0&&(this.#l&&(this.#l=!1,this.#t.startTime=this.#t.progress===0?(t-this.#h)*2+this.#t.initTime:this.#h-(this.#t.totalDuration-t-this.#t.time+this.#h)),i=(t-this.#t.startTime)*this.#t.playRate):i=this.#t.pauseTime,this.#t.time=i,i=Math.max(i-this.#t.delay,0),this.#t.playState==="finished"&&D(this.#t.pauseTime)&&(i=this.#t.totalDuration);const n=i/this.#t.duration;let a=Math.floor(n),r=n%1;!r&&n>=1&&(r=1),r===1&&a--;const o=a%2,h=this.#t.repeat%2,l=this.#t.direction;this.#t.playRate<0||l==="reverse"||l==="alternate"&&o||l==="alternate-reverse"&&!o?(this.#t.isReverse=!0,this.#t.totalProgress=0,l==="alternate"&&h?this.#t.totalProgress=1:l==="alternate-reverse"&&!h&&(this.#t.totalProgress=1),r=1-r):this.#t.isReverse=!1,this.#t.progress=i>=this.#t.totalDuration?this.#t.totalProgress:Math.min(r,1),D(this.#t.pauseTime)&&(this.#t.playState==="finished"||i>=this.#t.totalDuration+this.#t.endDelay)&&(this.#t.playState="finished",this.#u(),this.#n(),this.#e?.get(this.#s)?.())};#p(t){t<0&&(this.#t.totalProgress=0),t>0&&(this.#t.totalProgress=1),this.#t.playRate=t}now(){return U.isProcessing?U.timestamp:performance.now()}play(){if(this.#o)return;const t=this.now();D(this.#t.pauseTime)?this.#t.startTime||(this.#t.initTime=t,this.#t.startTime=t):this.#t.startTime=t-this.#t.pauseTime,this.#t.pauseTime=null,this.#t.playState="running",this.#c()}pause(){this.#t.playState="paused",this.#t.pauseTime=this.#t.time}stop(){this.#t.playState="idle",this.#u(),this.#n()}cancel(){this.#t.playState="idle",this.#u(),this.currentTime=0,this.#n()}finish(){this.#t.playState="finished",this.#u(),this.currentTime=E(this.#t.totalDuration),this.#n()}reverse(){this.#t.playRate===0||this.#t.progress===0||this.#t.progress===1||(this.#t.playRate>0?(this.playRate=1,this.playRate=-1):this.#t.playRate<0&&(this.playRate=-1,this.playRate=1))}get#t(){return this.#r.get(this.#s)}get currentTime(){return E(this.#t.time)}set currentTime(t){const s=$(t);this.#t.time=s,!D(this.#t.pauseTime)||!this.#o||this.#t.playRate===0?this.#t.pauseTime=s:this.#t.startTime=this.now()-s/this.#t.playRate}get playRate(){return this.#t.playRate}set playRate(t){if(t!==this.#t.playRate){if(t===0&&this.#o){this.#t.playRate=0,this.pause();return}if(t!==0&&!this.#o){this.#p(t),this.play();return}this.#p(t)}}}const it=(...e)=>new RegExp(e.map(t=>t.source).join("|")),Wt=/\((.*?)\)/,At=/(-?[0-9.]+)/g,Ot=/^\d+$/,nt=/^(#|rgb|hsl)/,jt=/(color|background)/i,Ft=/(px|pt|pc|in|cm|mm|em|rem|%|ex|ch|fr|vw|vh|vmin|vmax|deg|rad|turn)/,at=/^(x|y|z|translate|perspective)/,Ut=/(width|height|margin|padding|inset|top|right|bottom|left)/i,rt=/^(rotate|skew)/,It=/^scale/,Kt=it(at,rt,It),Nt=it(at,Ut),I=/shadow/i,Zt=/(blur|bright|contrast|dropShadow|gray|hue|invert|opacityFilter|saturate|sepia)/i,b=new WeakMap,K=new WeakMap;class Bt{#s=new WeakMap;#r=new WeakMap;#i;#e;constructor(t,s,i){const{type:n,key:a,value:r,units:o,ease:h,offset:l,...c}=s;this.#e=t.value,this.#s.set(this.#e,et({el:t,...c})),this.#r.set(this.#e,{transform:!1,color:!1,other:!1,otherShadow:!1,filter:!1,filterShadow:!1}),n==="transform"&&(this.#a.transform=!0,b.set(this.#e,{}),i&&(a!=="translateZ"&&(b.get(this.#e).translateZ="translateZ(0)"),t.value.style.willChange="transform")),n==="color"&&(this.#a.color=!0),n==="other"&&(this.#a.other=!0,I.test(a)&&(this.#a.otherShadow=!0)),n==="filter"&&(this.#a.filter=!0,I.test(a)&&(this.#a.filterShadow=!0),K.set(this.#e,{}));const p=()=>{this.#a.transform&&(this.#c(s),this.#h("transform",b)),this.#a.color&&this.#o(s),this.#a.other&&this.#l(s,this.#a.otherShadow),this.#a.filter&&(this.#u(s,this.#a.filterShadow),this.#h("filter",K)),this.onRender()},u=()=>{this.#a.transform&&i&&(a!=="translateZ"&&(b.get(this.#e).translateZ=""),t.value.style.willChange="auto"),this.onComplete()};this.#i=new st(this.#n,{onRender:p,onComplete:u})}#o(t){const{key:s,value:i,ease:n,offset:a}=t,r=R(i,a,{ease:n,type:"color"})(this.#n.progress);M(this.#e,s,`rgba(${r})`)}#l(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress;if(s){const c=R(n,o,{ease:r,type:"shadow"})(l);let p="";for(let u=0,f=c.length;u<f;u++){const d=c[u];w(d)?p+=`${d}${h||"px"} `:p+=`rgba(${d})`}M(this.#e,i,p)}else{const c=R(n,o,{ease:r})(l);M(this.#e,i,`${c}${h}`)}}#h(t,s){const i=Object.values(s.get(this.#e)).join(" ");M(this.#e,t,i)}#c(t){const{key:s,value:i,units:n,ease:a,offset:r}=t,[o]=n,h=R(i,r,{ease:a})(this.#n.progress);b.get(this.#e)[s]=`${s}(${h}${o})`}#u(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress,c=K.get(this.#e);if(s){const p=R(n,o,{ease:r,type:"shadow"})(l);let u="";for(let f=0,d=p.length;f<d;f++){const g=p[f];w(g)?u+=`${g}${h||"px"} `:u+=`rgba(${g})`}c[i]=`${i}(${u})`}else{const p=R(n,o,{ease:r})(l);c[i]=`${i}(${p}${h})`}}onRender(){}onComplete(){}play(){this.#i.play()}pause(){this.#i.pause()}stop(){this.#i.stop()}cancel(){this.#i.cancel()}finish(){this.#i.finish()}reverse(){this.#i.reverse()}get#n(){return this.#s.get(this.#e)}get#a(){return this.#r.get(this.#e)}get currentTime(){return this.#i.currentTime}set currentTime(t){this.#i.currentTime=t}get playRate(){return this.#i.playRate}set playRate(t){this.#i.playRate=t}get data(){return this.#n}}const ot=(e=>t=>1-e(1-t))(e=>Math.pow(e,4));function Vt(e,t){const s=e[e.length-1],i=C(0,t,1);return T(s,1,i)}function ht(e,t){return Nt.test(e)?{value:t,unit:"px"}:rt.test(e)?{value:t,unit:"deg"}:{value:t,unit:""}}function lt(e){const t=e.split(At),s=parseFloat(t[1]),i=t[2];return{value:s,unit:i}}function ut(e){const t="";if(e.startsWith("#"))return{value:G(e),unit:t};const s=e.match(Wt)[1].split(",").map(Number);return e.startsWith("rgb")?{value:[s[0],s[1],s[2],s[3]||1],unit:t}:{value:Q(s[0],s[1],s[2],s[3]||1),unit:t}}function qt(e,t){const s=window.getComputedStyle(document.documentElement);return ct(e,s.getPropertyValue(t))}function zt(e){const t=e.split(" "),s=[],i=[];for(let n=0,a=t.length;n<a;n++){const r=t[n],o=nt.test(r)?ut(r):lt(r);s.push(o.value),i.push(o.unit)}return{value:s,unit:i[0]}}function ct(e,t){if(w(t))return ht(e,t);if(t.startsWith("--"))return qt(e,t);if(Ot.test(t))return ht(e,parseFloat(t));if(nt.test(t))return ut(t);if(I.test(e))return zt(t);if(Ft.test(t))return lt(t);throw new TypeError(`Unsupported value '${t}' in '${e}' property.`)}function pt(e,t){if(t.size>1)throw new TypeError(`All units of '${e}' property must be of the same type.`)}function ft(e,t,s){if(y(t)&&t.length<e.length)for(;t.length<e.length;)s.push(ot)}function mt(e,t,s,i,n,a,r){const o=A(t)?t.offset:void 0,h=A(t)?t.value:t,l=s===0?o||0:o||Vt(n.offset,i);n.offset.push(l);const c=ct(e,h);n.value.push(c.value),n.units.add(c.unit),y(a)||r.push(a)}function Ht(e,t,s={}){const i={type:"other",key:e,value:[],offset:[],units:new Set,...s},n=i.ease||ot;if(!e.startsWith("on")){if(Kt.test(e)&&(i.type="transform",e.length===1&&(i.key=`translate${e.toUpperCase()}`)),jt.test(e)&&(i.type="color"),Zt.test(e)&&(i.type="filter",i.key=e.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e.startsWith("opa")&&(i.key="opacity")),y(t)){const a=t.length;if(a<2)return;const r=y(n)?n:[];for(let o=0;o<a;o++){const h=t[o],l=a-i.offset.length;mt(e,h,o,l,i,n,r)}return pt(e,i.units),ft(i.value,n,r),i.ease=r,i}if(A(t)&&!y(t)){const a=t.value.length;if(a<2)return;const r=y(n)?n:[];for(let p=0;p<a;p++){const u=t.value[p],f=a-i.offset.length;mt(e,u,p,f,i,n,r)}pt(e,i.units),ft(i.value,n,r);const{value:o,ease:h,offset:l,...c}=t;return{...i,...c,ease:h||r,offset:l||i.offset,autoplay:i.autoplay,playRate:i.playRate}}}}function Lt(e){const{autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h,force3d:l,...c}=e,p=l??!0,u=Object.keys(c),f=[],d={autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h};for(let g=0,v=u.length;g<v;g++){const S=u[g],N=c[S],k=Ht(S,N,d);k&&f.push(k)}return f.length||f.push(d),{options:f,force3d:p}}function dt(e){return e.reduce((t,s)=>t.data.maxDuration>s.data.maxDuration?t:s)}class Gt{#s;#r=[];constructor(t,s){for(let i=0,n=s.options.length;i<n;i++){const a=new Bt(t,s.options[i],s.force3d);this.#r.push(a)}this.#s=dt(this.#r)}#i(t,s){this.#r.forEach(i=>i[t]=s)}#e(t){this.#r.forEach(s=>s[t]())}onRender(t){this.#s.onRender=t}onComplete(t){this.#s.onComplete=t}play(){this.#e("play")}pause(){this.#e("pause")}stop(){this.#e("stop")}cancel(){this.#e("cancel")}finish(){this.#e("finish")}reverse(){this.#e("reverse")}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#i("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#i("playRate",t)}get data(){return this.#s.data}}class Qt{#s;#r=[];#i;#e;#o;#l;#h;#c;constructor(t,s){this.#i=s.onPlay,this.#e=s.onPause,this.#o=s.onStop,this.#l=s.onReverse;const i=Y(t),n=Lt(s);for(let a=0,r=i.length;a<r;a++){const o=i[a],h=new Gt({value:o,index:a,total:r},n);this.#r.push(h)}this.#s=dt(this.#r),this.#s.onComplete(()=>this.#h?.(this.data)),s.onUpdate&&this.#s.onRender(()=>s.onUpdate?.(this.data,i)),s.onStart?.(this.data),this.finished.then(()=>{this.#s.data.playState="finished",this.#s.data.promiseState="fulfilled",s.onComplete?.(this.data)}).catch(a=>{this.#s.data.playState="idle",this.#s.data.promiseState="rejected",s.onCancel?.(this.data,a)})}#u(t,s){this.#r.forEach(i=>i[t]=s)}#n(t){this.#r.forEach(s=>s[t]())}finished=new Promise((t,s)=>{this.#h=t,this.#c=s});play(){this.#n("play"),this.#i?.(this.data)}pause(){this.#n("pause"),this.#e?.(this.data)}stop(){this.#n("stop"),this.#c?.(!1),this.#o?.(this.data)}cancel(){this.#n("cancel"),this.#c?.(!1)}finish(){this.#n("finish"),this.#h?.(this.data)}reverse(){this.#n("reverse"),this.#l?.(this.data)}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#u("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#u("playRate",t)}get data(){return Object.freeze({...this.#s.data})}}function Xt(e,t){return new Qt(e,t)}return m.Driver=st,m.animate=Xt,m.cancelFrame=F,m.clamp=P,m.createDriverData=et,m.createRenderBatcher=_,m.createRenderStep=J,m.frame=j,m.getElements=Y,m.hexToRgba=G,m.hslaToRgba=Q,m.interpolate=R,m.mix=T,m.mixColor=q,m.msToSec=E,m.pipe=z,m.progress=C,m.round=gt,m.secToMs=$,m.setStyle=M,m.stagger=Et,m.state=U,m}({}); | ||
/*! effekt 0.3.0 | https://github.com/ivodolenc/effekt | MIT License | Ivo Dolenc (c) 2024 */var Effekt=function(c){"use strict";const wt=e=>Object.prototype.toString.call(e).slice(8,-1),R=e=>typeof e=="number"&&!isNaN(e),V=e=>typeof e=="string",w=e=>e===null,k=e=>typeof e>"u",E=e=>wt(e)==="Object",y=e=>Array.isArray(e),z=e=>e instanceof Function,H=e=>e instanceof Element,L=e=>e instanceof HTMLElement,G=e=>e instanceof SVGElement;function D(e){return e*1e3}function x(e){return e/1e3}function St(e,t=2){return t=10**t,Math.round(e*t)/t}function A(e,t,s){return Math.min(Math.max(s,e),t)}function S(e,t,s){return-s*e+s*t+e}function Q(e,t,s){const i=e*e;return Math.sqrt(Math.max(0,s*(t*t-i)+i))}function O(e,t,s){const i=t-e;return i===0?1:(s-e)/i}function X(...e){return t=>e.reduce((s,i)=>i(s),t)}function $t(e,t){return s=>S(e,t,s)}function Dt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)i.push(o=>S(e[a],t[a],o)),n[a]=i[a](s);return n}}function Y(e,t){return s=>{const i=[],n=[],{round:a}=Math,r=3;for(let o=0;o<r;o++)i.push(h=>Q(e[o],t[o],h)),n[o]=a(A(0,255,i[o](s)));return i.push(o=>S(e[r],t[r],o)),n[r]=a(A(0,1,i[r](s))*1e5)/1e5,n}}function bt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)R(e[a])?i.push(o=>S(e[a],t[a],o)):i.push(o=>Y(e[a],t[a])(o)),n[a]=i[a](s);return n}}function Mt(e,t={}){return t.type==="color"?Y:t.type==="shadow"?bt:y(e)?Dt:$t}function kt(e,t={}){const{ease:s,type:i}=t,n=[],a=Mt(e[0],{type:i});for(let r=0,o=e.length-1;r<o;r++){let h=a(e[r],e[r+1]);if(s){const l=y(s)?s[r]:s;h=X(l,h)}n.push(h)}return n}function T(e,t,s={}){const i=t.length,n=i-1;t[0]>t[n]&&(t=[...t].reverse(),e=[...e].reverse());const a=kt(e,s),r=a.length;return o=>{let h=0;if(r>1)for(;h<i-2&&!(o<t[h+1]);h++);const l=O(t[h],t[h+1],o);return a[h](l)}}function J(e){let t=e.slice(1);t.length===3&&(t=`${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`);const s=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16)/255||1;return[s,i,n,a]}function W(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<.16666666666666666?e+(t-e)*6*s:s<.5?t:s<.6666666666666666?e+(t-e)*(.6666666666666666-s)*6:e}function _(e,t,s,i){let n,a,r;if(e/=360,t/=100,s/=100,t===0)n=a=r=s;else{const{round:o}=Math,h=s<.5?s*(1+t):s+t-s*t,l=2*s-h;n=o(W(l,h,e+.3333333333333333)*255),a=o(W(l,h,e)*255),r=o(W(l,h,e-.3333333333333333)*255)}return[n,a,r,i]}function Et(e,t){if(R(e))return e;if(e==="first")return 0;const s=t-1;return e==="last"?s:s/2}function Pt(e=.1,t={}){const{delay:s=0,from:i=0,ease:n,grid:a,axis:r}=t,{floor:o,sqrt:h,abs:l}=Math;return(p,f)=>{const u=Et(i,f),m=!R(u)&&u==="center";let d=0;if(!a)d=l(u-p);else{const v=m?(a[0]-1)/2:u%a[0],$=m?(a[1]-1)/2:o(u/a[0]),K=p%a[0],C=o(p/a[0]),Z=v-K,B=$-C;let q=h(Z*Z+B*B);r==="x"&&(q=-Z),r==="y"&&(q=-B),d=q}let g=e*d;if(n){const v=f*e;g=n(g/v)*v}return s+g}}const tt=e=>!!(e&&(L(e)||G(e)));function et(e){const t=[];if(e)for(let s=0,i=e.length;s<i;s++){const n=e[s];tt(n)&&t.push(n)}return t}function st(e){if(H(e)){if(tt(e))return[e]}else if(V(e)){const t=et(document.querySelectorAll(e));if(t.length)return t}else{const t=et(e);if(t.length)return t}throw new TypeError("Animation target not found.")}function b(e,t,s){const i=t;if(!k(e.style[i]))return e.style[i]=s;throw new TypeError(`Unsupported '${t}' property.`)}function it(e){let t=new Set,s=new Set,i=!1,n=!1;const a=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function o(l){a.has(l)&&(h.schedule(l),e()),l(r)}const h={schedule:(l,p=!1,f=!1)=>{const u=f&&i?t:s;return p&&a.add(l),u.has(l)||u.add(l),l},cancel:l=>{s.delete(l),a.delete(l)},process:l=>{if(r=l,i){n=!0;return}i=!0,[t,s]=[s,t],s.clear(),t.forEach(o),i=!1,n&&(n=!1,h.process(l))}};return h}const P=["read","update","render"],Ct=40;function nt(e=requestAnimationFrame,t=!0){let s=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,r=P.reduce((u,m)=>(u[m]=it(a),u),{}),{read:o,update:h,render:l}=r,p=()=>{const u=performance.now();s=!1,n.delta=i?1e3/60:Math.max(Math.min(u-n.timestamp,Ct),1),n.timestamp=u,n.isProcessing=!0,o.process(n),h.process(n),l.process(n),n.isProcessing=!1,s&&t&&(i=!1,e(p))},f=()=>{s=!0,i=!0,n.isProcessing||e(p)};return{schedule:P.reduce((u,m)=>{const d=r[m];return u[m]=(g,v=!1,$=!1)=>(s||f(),d.schedule(g,v,$)),u},{}),cancel:u=>{for(let m=0;m<P.length;m++)r[P[m]].cancel(u)},state:n}}const{schedule:j,cancel:F,state:U}=nt();function at(e,t,s){return e&&!k(t)&&!k(s)?z(e)?D(e(t,s)):D(e):0}function xt(e){return e?e===1/0?1e3:e+1:1}function rt(e={}){const{el:t}=e,s=new WeakMap;s.set(t.value,{delta:0,timestamp:0,playState:"idle",promiseState:"pending",time:0,initTime:0,startTime:0,pauseTime:null,totalDuration:600,maxDuration:600,progress:0,totalProgress:1,isReverse:!1,autoplay:e.autoplay??!0,direction:e.direction||"normal",playRate:e.playRate||1,duration:D(e.duration||.6),delay:at(e.delay,t?.index,t?.total),endDelay:at(e.endDelay,t?.index,t?.total),repeat:xt(e.repeat)});const i=s.get(t.value);return i.totalDuration=i.duration*i.repeat,i.maxDuration=i.totalDuration+i.delay+i.endDelay,i}class ot{#s={};#r=new WeakMap;#i;#e;#o=!1;#l=!1;#h=0;constructor(t,s={}){const{onRender:i,onComplete:n}=s;this.#r.set(this.#s,t),i&&(this.#i=new WeakMap,this.#i.set(this.#s,i)),n&&(this.#e=new WeakMap,this.#e.set(this.#s,n)),this.#t.autoplay&&this.play()}#c(){this.#o||(j.update(this.#a,!0),this.#n(!0),this.#o=!0)}#u(){this.#o&&(F(this.#a),this.#i&&F(this.#i.get(this.#s)),this.#o=!1)}#n(t=!1){this.#i&&j.render(this.#i.get(this.#s),t)}#a=({timestamp:t,delta:s})=>{this.#t.timestamp=t,this.#t.delta=s;let i=0;w(this.#t.pauseTime)?this.#t.playRate<0?(this.#l||(this.#l=!0,this.#h=t,this.#t.startTime=this.#t.progress===0?t*this.#t.playRate:this.#t.totalDuration-t-this.#t.time),i=t-this.#t.startTime/this.#t.playRate):this.#t.playRate>0&&(this.#l&&(this.#l=!1,this.#t.startTime=this.#t.progress===0?(t-this.#h)*2+this.#t.initTime:this.#h-(this.#t.totalDuration-t-this.#t.time+this.#h)),i=(t-this.#t.startTime)*this.#t.playRate):i=this.#t.pauseTime,this.#t.time=i,i=Math.max(i-this.#t.delay,0),this.#t.playState==="finished"&&w(this.#t.pauseTime)&&(i=this.#t.totalDuration);const n=i/this.#t.duration;let a=Math.floor(n),r=n%1;!r&&n>=1&&(r=1),r===1&&a--;const o=a%2,h=this.#t.repeat%2,l=this.#t.direction;this.#t.playRate<0||l==="reverse"||l==="alternate"&&o||l==="alternate-reverse"&&!o?(this.#t.isReverse=!0,this.#t.totalProgress=0,l==="alternate"&&h?this.#t.totalProgress=1:l==="alternate-reverse"&&!h&&(this.#t.totalProgress=1),r=1-r):this.#t.isReverse=!1,this.#t.progress=i>=this.#t.totalDuration?this.#t.totalProgress:Math.min(r,1),w(this.#t.pauseTime)&&(this.#t.playState==="finished"||i>=this.#t.totalDuration+this.#t.endDelay)&&(this.#t.playState="finished",this.#u(),this.#n(),this.#e?.get(this.#s)?.())};#p(t){t<0&&(this.#t.totalProgress=0),t>0&&(this.#t.totalProgress=1),this.#t.playRate=t}now(){return U.isProcessing?U.timestamp:performance.now()}play(){if(this.#o)return;const t=this.now();w(this.#t.pauseTime)?this.#t.startTime||(this.#t.initTime=t,this.#t.startTime=t):this.#t.startTime=t-this.#t.pauseTime,this.#t.pauseTime=null,this.#t.playState="running",this.#c()}pause(){this.#t.playState="paused",this.#t.pauseTime=this.#t.time}stop(){this.#t.playState="idle",this.#u(),this.#n()}cancel(){this.#t.playState="idle",this.#u(),this.currentTime=0,this.#n()}finish(){this.#t.playState="finished",this.#u(),this.currentTime=x(this.#t.totalDuration),this.#n()}reverse(){this.#t.playRate===0||this.#t.progress===0||this.#t.progress===1||(this.#t.playRate>0?(this.playRate=1,this.playRate=-1):this.#t.playRate<0&&(this.playRate=-1,this.playRate=1))}get#t(){return this.#r.get(this.#s)}get currentTime(){return x(this.#t.time)}set currentTime(t){const s=D(t);this.#t.time=s,!w(this.#t.pauseTime)||!this.#o||this.#t.playRate===0?this.#t.pauseTime=s:this.#t.startTime=this.now()-s/this.#t.playRate}get playRate(){return this.#t.playRate}set playRate(t){if(t!==this.#t.playRate){if(t===0&&this.#o){this.#t.playRate=0,this.pause();return}if(t!==0&&!this.#o){this.#p(t),this.play();return}this.#p(t)}}}const ht=(...e)=>new RegExp(e.map(t=>t.source).join("|")),At=/\((.*?)\)/,Ot=/(-?[0-9.]+)/g,Wt=/^\d+$/,lt=/^(#|rgb|hsl)/,jt=/(color|background)/i,Ft=/(px|pt|pc|in|cm|mm|em|rem|%|ex|ch|fr|vw|vh|vmin|vmax|deg|rad|turn)/,ut=/^(x|y|z|translate|perspective)/,Ut=/(width|height|margin|padding|inset|top|right|bottom|left)/i,ct=/^(rotate|skew)/,It=/^scale/,Nt=ht(ut,ct,It),Kt=ht(ut,Ut),I=/shadow/i,Zt=/(blur|bright|contrast|dropShadow|gray|hue|invert|opacityFilter|saturate|sepia)/i,M=new WeakMap,N=new WeakMap;class Bt{#s=new WeakMap;#r=new WeakMap;#i;#e;constructor(t,s,i){const{type:n,key:a,value:r,units:o,ease:h,offset:l,...p}=s;this.#e=t.value,this.#s.set(this.#e,rt({el:t,...p})),this.#r.set(this.#e,{transform:!1,color:!1,other:!1,otherShadow:!1,filter:!1,filterShadow:!1}),n==="transform"&&(this.#a.transform=!0,M.set(this.#e,{}),i&&(a!=="translateZ"&&(M.get(this.#e).translateZ="translateZ(0)"),t.value.style.willChange="transform")),n==="color"&&(this.#a.color=!0),n==="other"&&(this.#a.other=!0,I.test(a)&&(this.#a.otherShadow=!0)),n==="filter"&&(this.#a.filter=!0,I.test(a)&&(this.#a.filterShadow=!0),N.set(this.#e,{}));const f=()=>{this.#a.transform&&(this.#c(s),this.#h("transform",M)),this.#a.color&&this.#o(s),this.#a.other&&this.#l(s,this.#a.otherShadow),this.#a.filter&&(this.#u(s,this.#a.filterShadow),this.#h("filter",N)),this.onRender()},u=()=>{this.#a.transform&&i&&(a!=="translateZ"&&(M.get(this.#e).translateZ=""),t.value.style.willChange="auto"),this.onComplete()};this.#i=new ot(this.#n,{onRender:f,onComplete:u})}#o(t){const{key:s,value:i,ease:n,offset:a}=t,r=T(i,a,{ease:n,type:"color"})(this.#n.progress);b(this.#e,s,`rgba(${r})`)}#l(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress;if(s){const p=T(n,o,{ease:r,type:"shadow"})(l);let f="";for(let u=0,m=p.length;u<m;u++){const d=p[u];R(d)?f+=`${d}${h||"px"} `:f+=`rgba(${d})`}b(this.#e,i,f)}else{const p=T(n,o,{ease:r})(l);b(this.#e,i,`${p}${h}`)}}#h(t,s){const i=Object.values(s.get(this.#e)).join(" ");b(this.#e,t,i)}#c(t){const{key:s,value:i,units:n,ease:a,offset:r}=t,[o]=n,h=T(i,r,{ease:a})(this.#n.progress);M.get(this.#e)[s]=`${s}(${h}${o})`}#u(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress,p=N.get(this.#e);if(s){const f=T(n,o,{ease:r,type:"shadow"})(l);let u="";for(let m=0,d=f.length;m<d;m++){const g=f[m];R(g)?u+=`${g}${h||"px"} `:u+=`rgba(${g})`}p[i]=`${i}(${u})`}else{const f=T(n,o,{ease:r})(l);p[i]=`${i}(${f}${h})`}}onRender(){}onComplete(){}play(){this.#i.play()}pause(){this.#i.pause()}stop(){this.#i.stop()}cancel(){this.#i.cancel()}finish(){this.#i.finish()}reverse(){this.#i.reverse()}get#n(){return this.#s.get(this.#e)}get#a(){return this.#r.get(this.#e)}get currentTime(){return this.#i.currentTime}set currentTime(t){this.#i.currentTime=t}get playRate(){return this.#i.playRate}set playRate(t){this.#i.playRate=t}get data(){return this.#n}}const pt=(e=>t=>1-e(1-t))(e=>Math.pow(e,4));function qt(e,t){const s=e[e.length-1],i=O(0,t,1);return S(s,1,i)}function ft(e,t){return Kt.test(e)?{value:t,unit:"px"}:ct.test(e)?{value:t,unit:"deg"}:{value:t,unit:""}}function mt(e){const t=e.split(Ot),s=parseFloat(t[1]),i=t[2];return{value:s,unit:i}}function dt(e){const t="";if(e.startsWith("#"))return{value:J(e),unit:t};const s=e.match(At)[1].split(",").map(Number);return e.startsWith("rgb")?{value:[s[0],s[1],s[2],s[3]||1],unit:t}:{value:_(s[0],s[1],s[2],s[3]||1),unit:t}}function Vt(e,t){const s=window.getComputedStyle(document.documentElement);return gt(e,s.getPropertyValue(t))}function zt(e){const t=e.split(" "),s=[],i=[];for(let n=0,a=t.length;n<a;n++){const r=t[n],o=lt.test(r)?dt(r):mt(r);s.push(o.value),i.push(o.unit)}return{value:s,unit:i[0]}}function gt(e,t){if(R(t))return ft(e,t);if(t.startsWith("--"))return Vt(e,t);if(Wt.test(t))return ft(e,parseFloat(t));if(lt.test(t))return dt(t);if(I.test(e))return zt(t);if(Ft.test(t))return mt(t);throw new TypeError(`Unsupported value '${t}' in '${e}' property.`)}function yt(e,t){if(t.size>1)throw new TypeError(`All units of '${e}' property must be of the same type.`)}function vt(e,t,s){if(y(t)&&t.length<e.length)for(;t.length<e.length;)s.push(pt)}function Rt(e,t,s,i,n,a,r){const o=E(t)?t.offset:void 0,h=E(t)?t.value:t,l=s===0?o||0:o||qt(n.offset,i);n.offset.push(l);const p=gt(e,h);n.value.push(p.value),n.units.add(p.unit),y(a)||r.push(a)}function Ht(e,t,s={}){const i={type:"other",key:e,value:[],offset:[],units:new Set,...s},n=i.ease||pt;if(!e.startsWith("on")){if(Nt.test(e)&&(i.type="transform",e.length===1&&(i.key=`translate${e.toUpperCase()}`)),jt.test(e)&&(i.type="color"),Zt.test(e)&&(i.type="filter",i.key=e.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e.startsWith("opa")&&(i.key="opacity")),y(t)){const a=t.length;if(a<2)return;const r=y(n)?n:[];for(let o=0;o<a;o++){const h=t[o],l=a-i.offset.length;Rt(e,h,o,l,i,n,r)}return yt(e,i.units),vt(i.value,n,r),i.ease=r,i}if(E(t)&&!y(t)){const a=t.value.length;if(a<2)return;const r=y(n)?n:[];for(let f=0;f<a;f++){const u=t.value[f],m=a-i.offset.length;Rt(e,u,f,m,i,n,r)}yt(e,i.units),vt(i.value,n,r);const{value:o,ease:h,offset:l,...p}=t;return{...i,...p,ease:h||r,offset:l||i.offset,autoplay:i.autoplay,playRate:i.playRate}}}}function Lt(e){const{autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h,force3d:l,...p}=e,f=l??!0,u=Object.keys(p),m=[],d={autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h};for(let g=0,v=u.length;g<v;g++){const $=u[g],K=p[$],C=Ht($,K,d);C&&m.push(C)}return m.length||m.push(d),{options:m,force3d:f}}function Tt(e){return e.reduce((t,s)=>t.data.maxDuration>s.data.maxDuration?t:s)}class Gt{#s;#r=[];constructor(t,s){for(let i=0,n=s.options.length;i<n;i++){const a=new Bt(t,s.options[i],s.force3d);this.#r.push(a)}this.#s=Tt(this.#r)}#i(t,s){this.#r.forEach(i=>i[t]=s)}#e(t){this.#r.forEach(s=>s[t]())}onRender(t){this.#s.onRender=t}onComplete(t){this.#s.onComplete=t}play(){this.#e("play")}pause(){this.#e("pause")}stop(){this.#e("stop")}cancel(){this.#e("cancel")}finish(){this.#e("finish")}reverse(){this.#e("reverse")}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#i("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#i("playRate",t)}get data(){return this.#s.data}}class Qt{#s;#r=[];#i;#e;#o;#l;#h;#c;constructor(t,s){this.#i=s.onPlay,this.#e=s.onPause,this.#o=s.onStop,this.#l=s.onReverse;const i=st(t),n=Lt(s);for(let a=0,r=i.length;a<r;a++){const o=i[a],h=new Gt({value:o,index:a,total:r},n);this.#r.push(h)}this.#s=Tt(this.#r),this.#s.onComplete(()=>this.#h?.(this.data)),s.onUpdate&&this.#s.onRender(()=>s.onUpdate?.(this.data,i)),s.onStart?.(this.data),this.finished.then(()=>{this.#s.data.playState="finished",this.#s.data.promiseState="fulfilled",s.onComplete?.(this.data)}).catch(a=>{this.#s.data.playState="idle",this.#s.data.promiseState="rejected",s.onCancel?.(this.data,a)})}#u(t,s){this.#r.forEach(i=>i[t]=s)}#n(t){this.#r.forEach(s=>s[t]())}finished=new Promise((t,s)=>{this.#h=t,this.#c=s});play(){this.#n("play"),this.#i?.(this.data)}pause(){this.#n("pause"),this.#e?.(this.data)}stop(){this.#n("stop"),this.#c?.(!1),this.#o?.(this.data)}cancel(){this.#n("cancel"),this.#c?.(!1)}finish(){this.#n("finish"),this.#h?.(this.data)}reverse(){this.#n("reverse"),this.#l?.(this.data)}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#u("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#u("playRate",t)}get data(){return Object.freeze({...this.#s.data})}}function Xt(e,t){return new Qt(e,t)}return c.Driver=ot,c.animate=Xt,c.cancelFrame=F,c.clamp=A,c.createDriverData=rt,c.createRenderBatcher=nt,c.createRenderStep=it,c.frame=j,c.getElements=st,c.hexToRgba=J,c.hslaToRgba=_,c.interpolate=T,c.isArray=y,c.isElement=H,c.isFunction=z,c.isHtmlElement=L,c.isNull=w,c.isNumber=R,c.isObject=E,c.isString=V,c.isSvgElement=G,c.isUndefined=k,c.mix=S,c.mixColor=Q,c.msToSec=x,c.pipe=X,c.progress=O,c.round=St,c.secToMs=D,c.setStyle=b,c.stagger=Pt,c.state=U,c}({}); |
@@ -1,1 +0,1 @@ | ||
/*! effekt 0.2.0 | https://github.com/ivodolenc/effekt | MIT License | Ivo Dolenc (c) 2024 */(function(c,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(c=typeof globalThis<"u"?globalThis:c||self,g(c.Effekt={}))})(this,function(c){"use strict";function g(e){return e*1e3}function E(e){return e/1e3}function yt(e,t=2){return t=10**t,Math.round(e*t)/t}function P(e,t,s){return Math.min(Math.max(s,e),t)}function w(e,t,s){return-s*e+s*t+e}function q(e,t,s){const i=e*e;return Math.sqrt(Math.max(0,s*(t*t-i)+i))}function C(e,t,s){const i=t-e;return i===0?1:(s-e)/i}function z(...e){return t=>e.reduce((s,i)=>i(s),t)}const gt=e=>Object.prototype.toString.call(e).slice(8,-1),S=e=>typeof e=="number"&&!isNaN(e),vt=e=>typeof e=="string",x=e=>e===null,W=e=>typeof e>"u",A=e=>gt(e)==="Object",v=e=>Array.isArray(e),Rt=e=>e instanceof Function,Tt=e=>e instanceof Element,wt=e=>e instanceof HTMLElement,St=e=>e instanceof SVGElement,H=e=>!!(e&&(wt(e)||St(e)));function $t(e,t){return s=>w(e,t,s)}function xt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)i.push(o=>w(e[a],t[a],o)),n[a]=i[a](s);return n}}function L(e,t){return s=>{const i=[],n=[],{round:a}=Math,r=3;for(let o=0;o<r;o++)i.push(h=>q(e[o],t[o],h)),n[o]=a(P(0,255,i[o](s)));return i.push(o=>w(e[r],t[r],o)),n[r]=a(P(0,1,i[r](s))*1e5)/1e5,n}}function Dt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)S(e[a])?i.push(o=>w(e[a],t[a],o)):i.push(o=>L(e[a],t[a])(o)),n[a]=i[a](s);return n}}function bt(e,t={}){return t.type==="color"?L:t.type==="shadow"?Dt:v(e)?xt:$t}function Mt(e,t={}){const{ease:s,type:i}=t,n=[],a=bt(e[0],{type:i});for(let r=0,o=e.length-1;r<o;r++){let h=a(e[r],e[r+1]);if(s){const l=v(s)?s[r]:s;h=z(l,h)}n.push(h)}return n}function T(e,t,s={}){const i=t.length,n=i-1;t[0]>t[n]&&(t=[...t].reverse(),e=[...e].reverse());const a=Mt(e,s),r=a.length;return o=>{let h=0;if(r>1)for(;h<i-2&&!(o<t[h+1]);h++);const l=C(t[h],t[h+1],o);return a[h](l)}}function G(e){let t=e.slice(1);t.length===3&&(t=`${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`);const s=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16)/255||1;return[s,i,n,a]}function O(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function Q(e,t,s,i){let n,a,r;if(e/=360,t/=100,s/=100,t===0)n=a=r=s;else{const{round:o}=Math,h=s<.5?s*(1+t):s+t-s*t,l=2*s-h;n=o(O(l,h,e+1/3)*255),a=o(O(l,h,e)*255),r=o(O(l,h,e-1/3)*255)}return[n,a,r,i]}function kt(e,t){if(S(e))return e;if(e==="first")return 0;const s=t-1;return e==="last"?s:s/2}function Et(e=.1,t={}){const{delay:s=0,from:i=0,ease:n,grid:a,axis:r}=t,{floor:o,sqrt:h,abs:l}=Math;return(p,f)=>{const u=kt(i,f),m=!S(u)&&u==="center";let d=0;if(!a)d=l(u-p);else{const R=m?(a[0]-1)/2:u%a[0],$=m?(a[1]-1)/2:o(u/a[0]),N=p%a[0],k=o(p/a[0]),Z=R-N,B=$-k;let V=h(Z*Z+B*B);r==="x"&&(V=-Z),r==="y"&&(V=-B),d=V}let y=e*d;if(n){const R=f*e;y=n(y/R)*R}return s+y}}function X(e){const t=[];if(e)for(let s=0,i=e.length;s<i;s++){const n=e[s];H(n)&&t.push(n)}return t}function Y(e){if(Tt(e)){if(H(e))return[e]}else if(vt(e)){const t=X(document.querySelectorAll(e));if(t.length)return t}else{const t=X(e);if(t.length)return t}throw new TypeError("Animation target not found.")}function D(e,t,s){const i=t;if(!W(e.style[i]))return e.style[i]=s;throw new TypeError(`Unsupported '${t}' property.`)}function J(e){let t=new Set,s=new Set,i=!1,n=!1;const a=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function o(l){a.has(l)&&(h.schedule(l),e()),l(r)}const h={schedule:(l,p=!1,f=!1)=>{const u=f&&i?t:s;return p&&a.add(l),u.has(l)||u.add(l),l},cancel:l=>{s.delete(l),a.delete(l)},process:l=>{if(r=l,i){n=!0;return}i=!0,[t,s]=[s,t],s.clear(),t.forEach(o),i=!1,n&&(n=!1,h.process(l))}};return h}const M=["read","update","render"],Pt=40;function _(e=requestAnimationFrame,t=!0){let s=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,r=M.reduce((u,m)=>(u[m]=J(a),u),{}),{read:o,update:h,render:l}=r,p=()=>{const u=performance.now();s=!1,n.delta=i?1e3/60:Math.max(Math.min(u-n.timestamp,Pt),1),n.timestamp=u,n.isProcessing=!0,o.process(n),h.process(n),l.process(n),n.isProcessing=!1,s&&t&&(i=!1,e(p))},f=()=>{s=!0,i=!0,n.isProcessing||e(p)};return{schedule:M.reduce((u,m)=>{const d=r[m];return u[m]=(y,R=!1,$=!1)=>(s||f(),d.schedule(y,R,$)),u},{}),cancel:u=>{for(let m=0;m<M.length;m++)r[M[m]].cancel(u)},state:n}}const{schedule:j,cancel:F,state:U}=_();function tt(e,t,s){return e&&!W(t)&&!W(s)?Rt(e)?g(e(t,s)):g(e):0}function Ct(e){return e?e===1/0?1e3:e+1:1}function et(e={}){const{el:t}=e,s=new WeakMap;s.set(t.value,{delta:0,timestamp:0,playState:"idle",promiseState:"pending",time:0,initTime:0,startTime:0,pauseTime:null,totalDuration:600,maxDuration:600,progress:0,totalProgress:1,isReverse:!1,autoplay:e.autoplay??!0,direction:e.direction||"normal",playRate:e.playRate||1,duration:g(e.duration||.6),delay:tt(e.delay,t?.index,t?.total),endDelay:tt(e.endDelay,t?.index,t?.total),repeat:Ct(e.repeat)});const i=s.get(t.value);return i.totalDuration=i.duration*i.repeat,i.maxDuration=i.totalDuration+i.delay+i.endDelay,i}class st{#s={};#r=new WeakMap;#i;#e;#o=!1;#l=!1;#h=0;constructor(t,s={}){const{onRender:i,onComplete:n}=s;this.#r.set(this.#s,t),i&&(this.#i=new WeakMap,this.#i.set(this.#s,i)),n&&(this.#e=new WeakMap,this.#e.set(this.#s,n)),this.#t.autoplay&&this.play()}#c(){this.#o||(j.update(this.#a,!0),this.#n(!0),this.#o=!0)}#u(){this.#o&&(F(this.#a),this.#i&&F(this.#i.get(this.#s)),this.#o=!1)}#n(t=!1){this.#i&&j.render(this.#i.get(this.#s),t)}#a=({timestamp:t,delta:s})=>{this.#t.timestamp=t,this.#t.delta=s;let i=0;x(this.#t.pauseTime)?this.#t.playRate<0?(this.#l||(this.#l=!0,this.#h=t,this.#t.startTime=this.#t.progress===0?t*this.#t.playRate:this.#t.totalDuration-t-this.#t.time),i=t-this.#t.startTime/this.#t.playRate):this.#t.playRate>0&&(this.#l&&(this.#l=!1,this.#t.startTime=this.#t.progress===0?(t-this.#h)*2+this.#t.initTime:this.#h-(this.#t.totalDuration-t-this.#t.time+this.#h)),i=(t-this.#t.startTime)*this.#t.playRate):i=this.#t.pauseTime,this.#t.time=i,i=Math.max(i-this.#t.delay,0),this.#t.playState==="finished"&&x(this.#t.pauseTime)&&(i=this.#t.totalDuration);const n=i/this.#t.duration;let a=Math.floor(n),r=n%1;!r&&n>=1&&(r=1),r===1&&a--;const o=a%2,h=this.#t.repeat%2,l=this.#t.direction;this.#t.playRate<0||l==="reverse"||l==="alternate"&&o||l==="alternate-reverse"&&!o?(this.#t.isReverse=!0,this.#t.totalProgress=0,l==="alternate"&&h?this.#t.totalProgress=1:l==="alternate-reverse"&&!h&&(this.#t.totalProgress=1),r=1-r):this.#t.isReverse=!1,this.#t.progress=i>=this.#t.totalDuration?this.#t.totalProgress:Math.min(r,1),x(this.#t.pauseTime)&&(this.#t.playState==="finished"||i>=this.#t.totalDuration+this.#t.endDelay)&&(this.#t.playState="finished",this.#u(),this.#n(),this.#e?.get(this.#s)?.())};#p(t){t<0&&(this.#t.totalProgress=0),t>0&&(this.#t.totalProgress=1),this.#t.playRate=t}now(){return U.isProcessing?U.timestamp:performance.now()}play(){if(this.#o)return;const t=this.now();x(this.#t.pauseTime)?this.#t.startTime||(this.#t.initTime=t,this.#t.startTime=t):this.#t.startTime=t-this.#t.pauseTime,this.#t.pauseTime=null,this.#t.playState="running",this.#c()}pause(){this.#t.playState="paused",this.#t.pauseTime=this.#t.time}stop(){this.#t.playState="idle",this.#u(),this.#n()}cancel(){this.#t.playState="idle",this.#u(),this.currentTime=0,this.#n()}finish(){this.#t.playState="finished",this.#u(),this.currentTime=E(this.#t.totalDuration),this.#n()}reverse(){this.#t.playRate===0||this.#t.progress===0||this.#t.progress===1||(this.#t.playRate>0?(this.playRate=1,this.playRate=-1):this.#t.playRate<0&&(this.playRate=-1,this.playRate=1))}get#t(){return this.#r.get(this.#s)}get currentTime(){return E(this.#t.time)}set currentTime(t){const s=g(t);this.#t.time=s,!x(this.#t.pauseTime)||!this.#o||this.#t.playRate===0?this.#t.pauseTime=s:this.#t.startTime=this.now()-s/this.#t.playRate}get playRate(){return this.#t.playRate}set playRate(t){if(t!==this.#t.playRate){if(t===0&&this.#o){this.#t.playRate=0,this.pause();return}if(t!==0&&!this.#o){this.#p(t),this.play();return}this.#p(t)}}}const it=(...e)=>new RegExp(e.map(t=>t.source).join("|")),Wt=/\((.*?)\)/,At=/(-?[0-9.]+)/g,Ot=/^\d+$/,nt=/^(#|rgb|hsl)/,jt=/(color|background)/i,Ft=/(px|pt|pc|in|cm|mm|em|rem|%|ex|ch|fr|vw|vh|vmin|vmax|deg|rad|turn)/,at=/^(x|y|z|translate|perspective)/,Ut=/(width|height|margin|padding|inset|top|right|bottom|left)/i,rt=/^(rotate|skew)/,It=/^scale/,Kt=it(at,rt,It),Nt=it(at,Ut),I=/shadow/i,Zt=/(blur|bright|contrast|dropShadow|gray|hue|invert|opacityFilter|saturate|sepia)/i,b=new WeakMap,K=new WeakMap;class Bt{#s=new WeakMap;#r=new WeakMap;#i;#e;constructor(t,s,i){const{type:n,key:a,value:r,units:o,ease:h,offset:l,...p}=s;this.#e=t.value,this.#s.set(this.#e,et({el:t,...p})),this.#r.set(this.#e,{transform:!1,color:!1,other:!1,otherShadow:!1,filter:!1,filterShadow:!1}),n==="transform"&&(this.#a.transform=!0,b.set(this.#e,{}),i&&(a!=="translateZ"&&(b.get(this.#e).translateZ="translateZ(0)"),t.value.style.willChange="transform")),n==="color"&&(this.#a.color=!0),n==="other"&&(this.#a.other=!0,I.test(a)&&(this.#a.otherShadow=!0)),n==="filter"&&(this.#a.filter=!0,I.test(a)&&(this.#a.filterShadow=!0),K.set(this.#e,{}));const f=()=>{this.#a.transform&&(this.#c(s),this.#h("transform",b)),this.#a.color&&this.#o(s),this.#a.other&&this.#l(s,this.#a.otherShadow),this.#a.filter&&(this.#u(s,this.#a.filterShadow),this.#h("filter",K)),this.onRender()},u=()=>{this.#a.transform&&i&&(a!=="translateZ"&&(b.get(this.#e).translateZ=""),t.value.style.willChange="auto"),this.onComplete()};this.#i=new st(this.#n,{onRender:f,onComplete:u})}#o(t){const{key:s,value:i,ease:n,offset:a}=t,r=T(i,a,{ease:n,type:"color"})(this.#n.progress);D(this.#e,s,`rgba(${r})`)}#l(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress;if(s){const p=T(n,o,{ease:r,type:"shadow"})(l);let f="";for(let u=0,m=p.length;u<m;u++){const d=p[u];S(d)?f+=`${d}${h||"px"} `:f+=`rgba(${d})`}D(this.#e,i,f)}else{const p=T(n,o,{ease:r})(l);D(this.#e,i,`${p}${h}`)}}#h(t,s){const i=Object.values(s.get(this.#e)).join(" ");D(this.#e,t,i)}#c(t){const{key:s,value:i,units:n,ease:a,offset:r}=t,[o]=n,h=T(i,r,{ease:a})(this.#n.progress);b.get(this.#e)[s]=`${s}(${h}${o})`}#u(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress,p=K.get(this.#e);if(s){const f=T(n,o,{ease:r,type:"shadow"})(l);let u="";for(let m=0,d=f.length;m<d;m++){const y=f[m];S(y)?u+=`${y}${h||"px"} `:u+=`rgba(${y})`}p[i]=`${i}(${u})`}else{const f=T(n,o,{ease:r})(l);p[i]=`${i}(${f}${h})`}}onRender(){}onComplete(){}play(){this.#i.play()}pause(){this.#i.pause()}stop(){this.#i.stop()}cancel(){this.#i.cancel()}finish(){this.#i.finish()}reverse(){this.#i.reverse()}get#n(){return this.#s.get(this.#e)}get#a(){return this.#r.get(this.#e)}get currentTime(){return this.#i.currentTime}set currentTime(t){this.#i.currentTime=t}get playRate(){return this.#i.playRate}set playRate(t){this.#i.playRate=t}get data(){return this.#n}}const ot=(e=>t=>1-e(1-t))(e=>Math.pow(e,4));function Vt(e,t){const s=e[e.length-1],i=C(0,t,1);return w(s,1,i)}function ht(e,t){return Nt.test(e)?{value:t,unit:"px"}:rt.test(e)?{value:t,unit:"deg"}:{value:t,unit:""}}function lt(e){const t=e.split(At),s=parseFloat(t[1]),i=t[2];return{value:s,unit:i}}function ut(e){const t="";if(e.startsWith("#"))return{value:G(e),unit:t};const s=e.match(Wt)[1].split(",").map(Number);return e.startsWith("rgb")?{value:[s[0],s[1],s[2],s[3]||1],unit:t}:{value:Q(s[0],s[1],s[2],s[3]||1),unit:t}}function qt(e,t){const s=window.getComputedStyle(document.documentElement);return ct(e,s.getPropertyValue(t))}function zt(e){const t=e.split(" "),s=[],i=[];for(let n=0,a=t.length;n<a;n++){const r=t[n],o=nt.test(r)?ut(r):lt(r);s.push(o.value),i.push(o.unit)}return{value:s,unit:i[0]}}function ct(e,t){if(S(t))return ht(e,t);if(t.startsWith("--"))return qt(e,t);if(Ot.test(t))return ht(e,parseFloat(t));if(nt.test(t))return ut(t);if(I.test(e))return zt(t);if(Ft.test(t))return lt(t);throw new TypeError(`Unsupported value '${t}' in '${e}' property.`)}function pt(e,t){if(t.size>1)throw new TypeError(`All units of '${e}' property must be of the same type.`)}function ft(e,t,s){if(v(t)&&t.length<e.length)for(;t.length<e.length;)s.push(ot)}function mt(e,t,s,i,n,a,r){const o=A(t)?t.offset:void 0,h=A(t)?t.value:t,l=s===0?o||0:o||Vt(n.offset,i);n.offset.push(l);const p=ct(e,h);n.value.push(p.value),n.units.add(p.unit),v(a)||r.push(a)}function Ht(e,t,s={}){const i={type:"other",key:e,value:[],offset:[],units:new Set,...s},n=i.ease||ot;if(!e.startsWith("on")){if(Kt.test(e)&&(i.type="transform",e.length===1&&(i.key=`translate${e.toUpperCase()}`)),jt.test(e)&&(i.type="color"),Zt.test(e)&&(i.type="filter",i.key=e.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e.startsWith("opa")&&(i.key="opacity")),v(t)){const a=t.length;if(a<2)return;const r=v(n)?n:[];for(let o=0;o<a;o++){const h=t[o],l=a-i.offset.length;mt(e,h,o,l,i,n,r)}return pt(e,i.units),ft(i.value,n,r),i.ease=r,i}if(A(t)&&!v(t)){const a=t.value.length;if(a<2)return;const r=v(n)?n:[];for(let f=0;f<a;f++){const u=t.value[f],m=a-i.offset.length;mt(e,u,f,m,i,n,r)}pt(e,i.units),ft(i.value,n,r);const{value:o,ease:h,offset:l,...p}=t;return{...i,...p,ease:h||r,offset:l||i.offset,autoplay:i.autoplay,playRate:i.playRate}}}}function Lt(e){const{autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h,force3d:l,...p}=e,f=l??!0,u=Object.keys(p),m=[],d={autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h};for(let y=0,R=u.length;y<R;y++){const $=u[y],N=p[$],k=Ht($,N,d);k&&m.push(k)}return m.length||m.push(d),{options:m,force3d:f}}function dt(e){return e.reduce((t,s)=>t.data.maxDuration>s.data.maxDuration?t:s)}class Gt{#s;#r=[];constructor(t,s){for(let i=0,n=s.options.length;i<n;i++){const a=new Bt(t,s.options[i],s.force3d);this.#r.push(a)}this.#s=dt(this.#r)}#i(t,s){this.#r.forEach(i=>i[t]=s)}#e(t){this.#r.forEach(s=>s[t]())}onRender(t){this.#s.onRender=t}onComplete(t){this.#s.onComplete=t}play(){this.#e("play")}pause(){this.#e("pause")}stop(){this.#e("stop")}cancel(){this.#e("cancel")}finish(){this.#e("finish")}reverse(){this.#e("reverse")}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#i("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#i("playRate",t)}get data(){return this.#s.data}}class Qt{#s;#r=[];#i;#e;#o;#l;#h;#c;constructor(t,s){this.#i=s.onPlay,this.#e=s.onPause,this.#o=s.onStop,this.#l=s.onReverse;const i=Y(t),n=Lt(s);for(let a=0,r=i.length;a<r;a++){const o=i[a],h=new Gt({value:o,index:a,total:r},n);this.#r.push(h)}this.#s=dt(this.#r),this.#s.onComplete(()=>this.#h?.(this.data)),s.onUpdate&&this.#s.onRender(()=>s.onUpdate?.(this.data,i)),s.onStart?.(this.data),this.finished.then(()=>{this.#s.data.playState="finished",this.#s.data.promiseState="fulfilled",s.onComplete?.(this.data)}).catch(a=>{this.#s.data.playState="idle",this.#s.data.promiseState="rejected",s.onCancel?.(this.data,a)})}#u(t,s){this.#r.forEach(i=>i[t]=s)}#n(t){this.#r.forEach(s=>s[t]())}finished=new Promise((t,s)=>{this.#h=t,this.#c=s});play(){this.#n("play"),this.#i?.(this.data)}pause(){this.#n("pause"),this.#e?.(this.data)}stop(){this.#n("stop"),this.#c?.(!1),this.#o?.(this.data)}cancel(){this.#n("cancel"),this.#c?.(!1)}finish(){this.#n("finish"),this.#h?.(this.data)}reverse(){this.#n("reverse"),this.#l?.(this.data)}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#u("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#u("playRate",t)}get data(){return Object.freeze({...this.#s.data})}}function Xt(e,t){return new Qt(e,t)}c.Driver=st,c.animate=Xt,c.cancelFrame=F,c.clamp=P,c.createDriverData=et,c.createRenderBatcher=_,c.createRenderStep=J,c.frame=j,c.getElements=Y,c.hexToRgba=G,c.hslaToRgba=Q,c.interpolate=T,c.mix=w,c.mixColor=q,c.msToSec=E,c.pipe=z,c.progress=C,c.round=yt,c.secToMs=g,c.setStyle=D,c.stagger=Et,c.state=U}); | ||
/*! effekt 0.3.0 | https://github.com/ivodolenc/effekt | MIT License | Ivo Dolenc (c) 2024 */(function(u,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(u=typeof globalThis<"u"?globalThis:u||self,D(u.Effekt={}))})(this,function(u){"use strict";const D=e=>Object.prototype.toString.call(e).slice(8,-1),R=e=>typeof e=="number"&&!isNaN(e),z=e=>typeof e=="string",w=e=>e===null,E=e=>typeof e>"u",x=e=>D(e)==="Object",g=e=>Array.isArray(e),H=e=>e instanceof Function,L=e=>e instanceof Element,G=e=>e instanceof HTMLElement,Q=e=>e instanceof SVGElement;function b(e){return e*1e3}function A(e){return e/1e3}function St(e,t=2){return t=10**t,Math.round(e*t)/t}function O(e,t,s){return Math.min(Math.max(s,e),t)}function S(e,t,s){return-s*e+s*t+e}function X(e,t,s){const i=e*e;return Math.sqrt(Math.max(0,s*(t*t-i)+i))}function W(e,t,s){const i=t-e;return i===0?1:(s-e)/i}function Y(...e){return t=>e.reduce((s,i)=>i(s),t)}function $t(e,t){return s=>S(e,t,s)}function Dt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)i.push(o=>S(e[a],t[a],o)),n[a]=i[a](s);return n}}function J(e,t){return s=>{const i=[],n=[],{round:a}=Math,r=3;for(let o=0;o<r;o++)i.push(h=>X(e[o],t[o],h)),n[o]=a(O(0,255,i[o](s)));return i.push(o=>S(e[r],t[r],o)),n[r]=a(O(0,1,i[r](s))*1e5)/1e5,n}}function bt(e,t){return s=>{const i=[],n=[];for(let a=0,r=e.length;a<r;a++)R(e[a])?i.push(o=>S(e[a],t[a],o)):i.push(o=>J(e[a],t[a])(o)),n[a]=i[a](s);return n}}function Mt(e,t={}){return t.type==="color"?J:t.type==="shadow"?bt:g(e)?Dt:$t}function kt(e,t={}){const{ease:s,type:i}=t,n=[],a=Mt(e[0],{type:i});for(let r=0,o=e.length-1;r<o;r++){let h=a(e[r],e[r+1]);if(s){const l=g(s)?s[r]:s;h=Y(l,h)}n.push(h)}return n}function T(e,t,s={}){const i=t.length,n=i-1;t[0]>t[n]&&(t=[...t].reverse(),e=[...e].reverse());const a=kt(e,s),r=a.length;return o=>{let h=0;if(r>1)for(;h<i-2&&!(o<t[h+1]);h++);const l=W(t[h],t[h+1],o);return a[h](l)}}function _(e){let t=e.slice(1);t.length===3&&(t=`${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`);const s=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16)/255||1;return[s,i,n,a]}function j(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function tt(e,t,s,i){let n,a,r;if(e/=360,t/=100,s/=100,t===0)n=a=r=s;else{const{round:o}=Math,h=s<.5?s*(1+t):s+t-s*t,l=2*s-h;n=o(j(l,h,e+1/3)*255),a=o(j(l,h,e)*255),r=o(j(l,h,e-1/3)*255)}return[n,a,r,i]}function Et(e,t){if(R(e))return e;if(e==="first")return 0;const s=t-1;return e==="last"?s:s/2}function xt(e=.1,t={}){const{delay:s=0,from:i=0,ease:n,grid:a,axis:r}=t,{floor:o,sqrt:h,abs:l}=Math;return(p,f)=>{const c=Et(i,f),m=!R(c)&&c==="center";let d=0;if(!a)d=l(c-p);else{const v=m?(a[0]-1)/2:c%a[0],$=m?(a[1]-1)/2:o(c/a[0]),Z=p%a[0],C=o(p/a[0]),B=v-Z,q=$-C;let V=h(B*B+q*q);r==="x"&&(V=-B),r==="y"&&(V=-q),d=V}let y=e*d;if(n){const v=f*e;y=n(y/v)*v}return s+y}}const et=e=>!!(e&&(G(e)||Q(e)));function st(e){const t=[];if(e)for(let s=0,i=e.length;s<i;s++){const n=e[s];et(n)&&t.push(n)}return t}function it(e){if(L(e)){if(et(e))return[e]}else if(z(e)){const t=st(document.querySelectorAll(e));if(t.length)return t}else{const t=st(e);if(t.length)return t}throw new TypeError("Animation target not found.")}function M(e,t,s){const i=t;if(!E(e.style[i]))return e.style[i]=s;throw new TypeError(`Unsupported '${t}' property.`)}function nt(e){let t=new Set,s=new Set,i=!1,n=!1;const a=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function o(l){a.has(l)&&(h.schedule(l),e()),l(r)}const h={schedule:(l,p=!1,f=!1)=>{const c=f&&i?t:s;return p&&a.add(l),c.has(l)||c.add(l),l},cancel:l=>{s.delete(l),a.delete(l)},process:l=>{if(r=l,i){n=!0;return}i=!0,[t,s]=[s,t],s.clear(),t.forEach(o),i=!1,n&&(n=!1,h.process(l))}};return h}const P=["read","update","render"],Pt=40;function at(e=requestAnimationFrame,t=!0){let s=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,r=P.reduce((c,m)=>(c[m]=nt(a),c),{}),{read:o,update:h,render:l}=r,p=()=>{const c=performance.now();s=!1,n.delta=i?1e3/60:Math.max(Math.min(c-n.timestamp,Pt),1),n.timestamp=c,n.isProcessing=!0,o.process(n),h.process(n),l.process(n),n.isProcessing=!1,s&&t&&(i=!1,e(p))},f=()=>{s=!0,i=!0,n.isProcessing||e(p)};return{schedule:P.reduce((c,m)=>{const d=r[m];return c[m]=(y,v=!1,$=!1)=>(s||f(),d.schedule(y,v,$)),c},{}),cancel:c=>{for(let m=0;m<P.length;m++)r[P[m]].cancel(c)},state:n}}const{schedule:F,cancel:U,state:I}=at();function rt(e,t,s){return e&&!E(t)&&!E(s)?H(e)?b(e(t,s)):b(e):0}function Ct(e){return e?e===1/0?1e3:e+1:1}function ot(e={}){const{el:t}=e,s=new WeakMap;s.set(t.value,{delta:0,timestamp:0,playState:"idle",promiseState:"pending",time:0,initTime:0,startTime:0,pauseTime:null,totalDuration:600,maxDuration:600,progress:0,totalProgress:1,isReverse:!1,autoplay:e.autoplay??!0,direction:e.direction||"normal",playRate:e.playRate||1,duration:b(e.duration||.6),delay:rt(e.delay,t?.index,t?.total),endDelay:rt(e.endDelay,t?.index,t?.total),repeat:Ct(e.repeat)});const i=s.get(t.value);return i.totalDuration=i.duration*i.repeat,i.maxDuration=i.totalDuration+i.delay+i.endDelay,i}class ht{#s={};#r=new WeakMap;#i;#e;#o=!1;#l=!1;#h=0;constructor(t,s={}){const{onRender:i,onComplete:n}=s;this.#r.set(this.#s,t),i&&(this.#i=new WeakMap,this.#i.set(this.#s,i)),n&&(this.#e=new WeakMap,this.#e.set(this.#s,n)),this.#t.autoplay&&this.play()}#c(){this.#o||(F.update(this.#a,!0),this.#n(!0),this.#o=!0)}#u(){this.#o&&(U(this.#a),this.#i&&U(this.#i.get(this.#s)),this.#o=!1)}#n(t=!1){this.#i&&F.render(this.#i.get(this.#s),t)}#a=({timestamp:t,delta:s})=>{this.#t.timestamp=t,this.#t.delta=s;let i=0;w(this.#t.pauseTime)?this.#t.playRate<0?(this.#l||(this.#l=!0,this.#h=t,this.#t.startTime=this.#t.progress===0?t*this.#t.playRate:this.#t.totalDuration-t-this.#t.time),i=t-this.#t.startTime/this.#t.playRate):this.#t.playRate>0&&(this.#l&&(this.#l=!1,this.#t.startTime=this.#t.progress===0?(t-this.#h)*2+this.#t.initTime:this.#h-(this.#t.totalDuration-t-this.#t.time+this.#h)),i=(t-this.#t.startTime)*this.#t.playRate):i=this.#t.pauseTime,this.#t.time=i,i=Math.max(i-this.#t.delay,0),this.#t.playState==="finished"&&w(this.#t.pauseTime)&&(i=this.#t.totalDuration);const n=i/this.#t.duration;let a=Math.floor(n),r=n%1;!r&&n>=1&&(r=1),r===1&&a--;const o=a%2,h=this.#t.repeat%2,l=this.#t.direction;this.#t.playRate<0||l==="reverse"||l==="alternate"&&o||l==="alternate-reverse"&&!o?(this.#t.isReverse=!0,this.#t.totalProgress=0,l==="alternate"&&h?this.#t.totalProgress=1:l==="alternate-reverse"&&!h&&(this.#t.totalProgress=1),r=1-r):this.#t.isReverse=!1,this.#t.progress=i>=this.#t.totalDuration?this.#t.totalProgress:Math.min(r,1),w(this.#t.pauseTime)&&(this.#t.playState==="finished"||i>=this.#t.totalDuration+this.#t.endDelay)&&(this.#t.playState="finished",this.#u(),this.#n(),this.#e?.get(this.#s)?.())};#p(t){t<0&&(this.#t.totalProgress=0),t>0&&(this.#t.totalProgress=1),this.#t.playRate=t}now(){return I.isProcessing?I.timestamp:performance.now()}play(){if(this.#o)return;const t=this.now();w(this.#t.pauseTime)?this.#t.startTime||(this.#t.initTime=t,this.#t.startTime=t):this.#t.startTime=t-this.#t.pauseTime,this.#t.pauseTime=null,this.#t.playState="running",this.#c()}pause(){this.#t.playState="paused",this.#t.pauseTime=this.#t.time}stop(){this.#t.playState="idle",this.#u(),this.#n()}cancel(){this.#t.playState="idle",this.#u(),this.currentTime=0,this.#n()}finish(){this.#t.playState="finished",this.#u(),this.currentTime=A(this.#t.totalDuration),this.#n()}reverse(){this.#t.playRate===0||this.#t.progress===0||this.#t.progress===1||(this.#t.playRate>0?(this.playRate=1,this.playRate=-1):this.#t.playRate<0&&(this.playRate=-1,this.playRate=1))}get#t(){return this.#r.get(this.#s)}get currentTime(){return A(this.#t.time)}set currentTime(t){const s=b(t);this.#t.time=s,!w(this.#t.pauseTime)||!this.#o||this.#t.playRate===0?this.#t.pauseTime=s:this.#t.startTime=this.now()-s/this.#t.playRate}get playRate(){return this.#t.playRate}set playRate(t){if(t!==this.#t.playRate){if(t===0&&this.#o){this.#t.playRate=0,this.pause();return}if(t!==0&&!this.#o){this.#p(t),this.play();return}this.#p(t)}}}const lt=(...e)=>new RegExp(e.map(t=>t.source).join("|")),At=/\((.*?)\)/,Ot=/(-?[0-9.]+)/g,Wt=/^\d+$/,ut=/^(#|rgb|hsl)/,jt=/(color|background)/i,Ft=/(px|pt|pc|in|cm|mm|em|rem|%|ex|ch|fr|vw|vh|vmin|vmax|deg|rad|turn)/,ct=/^(x|y|z|translate|perspective)/,Ut=/(width|height|margin|padding|inset|top|right|bottom|left)/i,pt=/^(rotate|skew)/,It=/^scale/,Nt=lt(ct,pt,It),Kt=lt(ct,Ut),N=/shadow/i,Zt=/(blur|bright|contrast|dropShadow|gray|hue|invert|opacityFilter|saturate|sepia)/i,k=new WeakMap,K=new WeakMap;class Bt{#s=new WeakMap;#r=new WeakMap;#i;#e;constructor(t,s,i){const{type:n,key:a,value:r,units:o,ease:h,offset:l,...p}=s;this.#e=t.value,this.#s.set(this.#e,ot({el:t,...p})),this.#r.set(this.#e,{transform:!1,color:!1,other:!1,otherShadow:!1,filter:!1,filterShadow:!1}),n==="transform"&&(this.#a.transform=!0,k.set(this.#e,{}),i&&(a!=="translateZ"&&(k.get(this.#e).translateZ="translateZ(0)"),t.value.style.willChange="transform")),n==="color"&&(this.#a.color=!0),n==="other"&&(this.#a.other=!0,N.test(a)&&(this.#a.otherShadow=!0)),n==="filter"&&(this.#a.filter=!0,N.test(a)&&(this.#a.filterShadow=!0),K.set(this.#e,{}));const f=()=>{this.#a.transform&&(this.#c(s),this.#h("transform",k)),this.#a.color&&this.#o(s),this.#a.other&&this.#l(s,this.#a.otherShadow),this.#a.filter&&(this.#u(s,this.#a.filterShadow),this.#h("filter",K)),this.onRender()},c=()=>{this.#a.transform&&i&&(a!=="translateZ"&&(k.get(this.#e).translateZ=""),t.value.style.willChange="auto"),this.onComplete()};this.#i=new ht(this.#n,{onRender:f,onComplete:c})}#o(t){const{key:s,value:i,ease:n,offset:a}=t,r=T(i,a,{ease:n,type:"color"})(this.#n.progress);M(this.#e,s,`rgba(${r})`)}#l(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress;if(s){const p=T(n,o,{ease:r,type:"shadow"})(l);let f="";for(let c=0,m=p.length;c<m;c++){const d=p[c];R(d)?f+=`${d}${h||"px"} `:f+=`rgba(${d})`}M(this.#e,i,f)}else{const p=T(n,o,{ease:r})(l);M(this.#e,i,`${p}${h}`)}}#h(t,s){const i=Object.values(s.get(this.#e)).join(" ");M(this.#e,t,i)}#c(t){const{key:s,value:i,units:n,ease:a,offset:r}=t,[o]=n,h=T(i,r,{ease:a})(this.#n.progress);k.get(this.#e)[s]=`${s}(${h}${o})`}#u(t,s){const{key:i,value:n,units:a,ease:r,offset:o}=t,[h]=a,l=this.#n.progress,p=K.get(this.#e);if(s){const f=T(n,o,{ease:r,type:"shadow"})(l);let c="";for(let m=0,d=f.length;m<d;m++){const y=f[m];R(y)?c+=`${y}${h||"px"} `:c+=`rgba(${y})`}p[i]=`${i}(${c})`}else{const f=T(n,o,{ease:r})(l);p[i]=`${i}(${f}${h})`}}onRender(){}onComplete(){}play(){this.#i.play()}pause(){this.#i.pause()}stop(){this.#i.stop()}cancel(){this.#i.cancel()}finish(){this.#i.finish()}reverse(){this.#i.reverse()}get#n(){return this.#s.get(this.#e)}get#a(){return this.#r.get(this.#e)}get currentTime(){return this.#i.currentTime}set currentTime(t){this.#i.currentTime=t}get playRate(){return this.#i.playRate}set playRate(t){this.#i.playRate=t}get data(){return this.#n}}const ft=(e=>t=>1-e(1-t))(e=>Math.pow(e,4));function qt(e,t){const s=e[e.length-1],i=W(0,t,1);return S(s,1,i)}function mt(e,t){return Kt.test(e)?{value:t,unit:"px"}:pt.test(e)?{value:t,unit:"deg"}:{value:t,unit:""}}function dt(e){const t=e.split(Ot),s=parseFloat(t[1]),i=t[2];return{value:s,unit:i}}function yt(e){const t="";if(e.startsWith("#"))return{value:_(e),unit:t};const s=e.match(At)[1].split(",").map(Number);return e.startsWith("rgb")?{value:[s[0],s[1],s[2],s[3]||1],unit:t}:{value:tt(s[0],s[1],s[2],s[3]||1),unit:t}}function Vt(e,t){const s=window.getComputedStyle(document.documentElement);return gt(e,s.getPropertyValue(t))}function zt(e){const t=e.split(" "),s=[],i=[];for(let n=0,a=t.length;n<a;n++){const r=t[n],o=ut.test(r)?yt(r):dt(r);s.push(o.value),i.push(o.unit)}return{value:s,unit:i[0]}}function gt(e,t){if(R(t))return mt(e,t);if(t.startsWith("--"))return Vt(e,t);if(Wt.test(t))return mt(e,parseFloat(t));if(ut.test(t))return yt(t);if(N.test(e))return zt(t);if(Ft.test(t))return dt(t);throw new TypeError(`Unsupported value '${t}' in '${e}' property.`)}function vt(e,t){if(t.size>1)throw new TypeError(`All units of '${e}' property must be of the same type.`)}function Rt(e,t,s){if(g(t)&&t.length<e.length)for(;t.length<e.length;)s.push(ft)}function Tt(e,t,s,i,n,a,r){const o=x(t)?t.offset:void 0,h=x(t)?t.value:t,l=s===0?o||0:o||qt(n.offset,i);n.offset.push(l);const p=gt(e,h);n.value.push(p.value),n.units.add(p.unit),g(a)||r.push(a)}function Ht(e,t,s={}){const i={type:"other",key:e,value:[],offset:[],units:new Set,...s},n=i.ease||ft;if(!e.startsWith("on")){if(Nt.test(e)&&(i.type="transform",e.length===1&&(i.key=`translate${e.toUpperCase()}`)),jt.test(e)&&(i.type="color"),Zt.test(e)&&(i.type="filter",i.key=e.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),e.startsWith("opa")&&(i.key="opacity")),g(t)){const a=t.length;if(a<2)return;const r=g(n)?n:[];for(let o=0;o<a;o++){const h=t[o],l=a-i.offset.length;Tt(e,h,o,l,i,n,r)}return vt(e,i.units),Rt(i.value,n,r),i.ease=r,i}if(x(t)&&!g(t)){const a=t.value.length;if(a<2)return;const r=g(n)?n:[];for(let f=0;f<a;f++){const c=t.value[f],m=a-i.offset.length;Tt(e,c,f,m,i,n,r)}vt(e,i.units),Rt(i.value,n,r);const{value:o,ease:h,offset:l,...p}=t;return{...i,...p,ease:h||r,offset:l||i.offset,autoplay:i.autoplay,playRate:i.playRate}}}}function Lt(e){const{autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h,force3d:l,...p}=e,f=l??!0,c=Object.keys(p),m=[],d={autoplay:t,direction:s,playRate:i,duration:n,delay:a,endDelay:r,repeat:o,ease:h};for(let y=0,v=c.length;y<v;y++){const $=c[y],Z=p[$],C=Ht($,Z,d);C&&m.push(C)}return m.length||m.push(d),{options:m,force3d:f}}function wt(e){return e.reduce((t,s)=>t.data.maxDuration>s.data.maxDuration?t:s)}class Gt{#s;#r=[];constructor(t,s){for(let i=0,n=s.options.length;i<n;i++){const a=new Bt(t,s.options[i],s.force3d);this.#r.push(a)}this.#s=wt(this.#r)}#i(t,s){this.#r.forEach(i=>i[t]=s)}#e(t){this.#r.forEach(s=>s[t]())}onRender(t){this.#s.onRender=t}onComplete(t){this.#s.onComplete=t}play(){this.#e("play")}pause(){this.#e("pause")}stop(){this.#e("stop")}cancel(){this.#e("cancel")}finish(){this.#e("finish")}reverse(){this.#e("reverse")}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#i("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#i("playRate",t)}get data(){return this.#s.data}}class Qt{#s;#r=[];#i;#e;#o;#l;#h;#c;constructor(t,s){this.#i=s.onPlay,this.#e=s.onPause,this.#o=s.onStop,this.#l=s.onReverse;const i=it(t),n=Lt(s);for(let a=0,r=i.length;a<r;a++){const o=i[a],h=new Gt({value:o,index:a,total:r},n);this.#r.push(h)}this.#s=wt(this.#r),this.#s.onComplete(()=>this.#h?.(this.data)),s.onUpdate&&this.#s.onRender(()=>s.onUpdate?.(this.data,i)),s.onStart?.(this.data),this.finished.then(()=>{this.#s.data.playState="finished",this.#s.data.promiseState="fulfilled",s.onComplete?.(this.data)}).catch(a=>{this.#s.data.playState="idle",this.#s.data.promiseState="rejected",s.onCancel?.(this.data,a)})}#u(t,s){this.#r.forEach(i=>i[t]=s)}#n(t){this.#r.forEach(s=>s[t]())}finished=new Promise((t,s)=>{this.#h=t,this.#c=s});play(){this.#n("play"),this.#i?.(this.data)}pause(){this.#n("pause"),this.#e?.(this.data)}stop(){this.#n("stop"),this.#c?.(!1),this.#o?.(this.data)}cancel(){this.#n("cancel"),this.#c?.(!1)}finish(){this.#n("finish"),this.#h?.(this.data)}reverse(){this.#n("reverse"),this.#l?.(this.data)}get currentTime(){return this.#s.currentTime}set currentTime(t){this.#u("currentTime",t)}get playRate(){return this.#s.playRate}set playRate(t){this.#u("playRate",t)}get data(){return Object.freeze({...this.#s.data})}}function Xt(e,t){return new Qt(e,t)}u.Driver=ht,u.animate=Xt,u.cancelFrame=U,u.clamp=O,u.createDriverData=ot,u.createRenderBatcher=at,u.createRenderStep=nt,u.frame=F,u.getElements=it,u.hexToRgba=_,u.hslaToRgba=tt,u.interpolate=T,u.isArray=g,u.isElement=L,u.isFunction=H,u.isHtmlElement=G,u.isNull=w,u.isNumber=R,u.isObject=x,u.isString=z,u.isSvgElement=Q,u.isUndefined=E,u.mix=S,u.mixColor=X,u.msToSec=A,u.pipe=Y,u.progress=W,u.round=St,u.secToMs=b,u.setStyle=M,u.stagger=xt,u.state=I}); |
@@ -1,1 +0,1 @@ | ||
var EffektInteraction=function(a){"use strict";const E=t=>typeof t=="string",h=t=>t instanceof Function,d=t=>t instanceof Element,w=t=>t instanceof HTMLElement,v=t=>t instanceof SVGElement,g=t=>!!(t&&(w(t)||v(t)));function u(t){const n=[];if(t)for(let i=0,o=t.length;i<o;i++){const r=t[i];g(r)&&n.push(r)}return n}function I(t){if(d(t)){if(g(t))return[t]}else if(E(t)){const n=u(document.querySelectorAll(t));if(n.length)return n}else{const n=u(t);if(n.length)return n}throw new TypeError("Animation target not found.")}function S(t,n,{root:i,margin:o,threshold:r}={}){const V=I(t),s=new WeakMap,b=l=>{l.forEach(e=>{const f=s.get(e.target);if(e.isIntersecting!==!!f)if(e.isIntersecting){const m=n(e);h(m)?s.set(e.target,m):c.unobserve(e.target)}else f&&(f(e),s.delete(e.target))})},c=new IntersectionObserver(b,{root:i,rootMargin:o,threshold:r});return V.forEach(l=>c.observe(l)),()=>c.disconnect()}return a.inView=S,a}({}); | ||
var EffektInteraction=function(a){"use strict";const m=t=>typeof t=="string",E=t=>t instanceof Function,d=t=>t instanceof Element,w=t=>t instanceof HTMLElement,v=t=>t instanceof SVGElement,u=t=>!!(t&&(w(t)||v(t)));function g(t){const n=[];if(t)for(let r=0,i=t.length;r<i;r++){const o=t[r];u(o)&&n.push(o)}return n}function I(t){if(d(t)){if(u(t))return[t]}else if(m(t)){const n=g(document.querySelectorAll(t));if(n.length)return n}else{const n=g(t);if(n.length)return n}throw new TypeError("Animation target not found.")}function p(t,n,{root:r,margin:i,threshold:o}={}){const S=I(t),s=new WeakMap,b=f=>{f.forEach(e=>{const l=s.get(e.target);if(e.isIntersecting!==!!l)if(e.isIntersecting){const h=n(e);E(h)?s.set(e.target,h):c.unobserve(e.target)}else l&&(l(e),s.delete(e.target))})},c=new IntersectionObserver(b,{root:r,rootMargin:i,threshold:o});return S.forEach(f=>c.observe(f)),()=>c.disconnect()}return a.inView=p,a}({}); |
@@ -1,1 +0,1 @@ | ||
(function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i.EffektInteraction={}))})(this,function(i){"use strict";const o=t=>typeof t=="string",m=t=>t instanceof Function,E=t=>t instanceof Element,p=t=>t instanceof HTMLElement,w=t=>t instanceof SVGElement,a=t=>!!(t&&(p(t)||w(t)));function d(t){const e=[];if(t)for(let s=0,f=t.length;s<f;s++){const r=t[s];a(r)&&e.push(r)}return e}function y(t){if(E(t)){if(a(t))return[t]}else if(o(t)){const e=d(document.querySelectorAll(t));if(e.length)return e}else{const e=d(t);if(e.length)return e}throw new TypeError("Animation target not found.")}function I(t,e,{root:s,margin:f,threshold:r}={}){const b=y(t),c=new WeakMap,v=u=>{u.forEach(n=>{const g=c.get(n.target);if(n.isIntersecting!==!!g)if(n.isIntersecting){const h=e(n);m(h)?c.set(n.target,h):l.unobserve(n.target)}else g&&(g(n),c.delete(n.target))})},l=new IntersectionObserver(v,{root:s,rootMargin:f,threshold:r});return b.forEach(u=>l.observe(u)),()=>l.disconnect()}i.inView=I}); | ||
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.EffektInteraction={}))})(this,function(o){"use strict";const i=t=>typeof t=="string",m=t=>t instanceof Function,p=t=>t instanceof Element,E=t=>t instanceof HTMLElement,w=t=>t instanceof SVGElement,a=t=>!!(t&&(E(t)||w(t)));function d(t){const n=[];if(t)for(let s=0,f=t.length;s<f;s++){const r=t[s];a(r)&&n.push(r)}return n}function y(t){if(p(t)){if(a(t))return[t]}else if(i(t)){const n=d(document.querySelectorAll(t));if(n.length)return n}else{const n=d(t);if(n.length)return n}throw new TypeError("Animation target not found.")}function I(t,n,{root:s,margin:f,threshold:r}={}){const b=y(t),c=new WeakMap,v=u=>{u.forEach(e=>{const g=c.get(e.target);if(e.isIntersecting!==!!g)if(e.isIntersecting){const h=n(e);m(h)?c.set(e.target,h):l.unobserve(e.target)}else g&&(g(e),c.delete(e.target))})},l=new IntersectionObserver(v,{root:s,rootMargin:f,threshold:r});return b.forEach(u=>l.observe(u)),()=>l.disconnect()}o.inView=I}); |
@@ -31,2 +31,123 @@ type Target = string | Element | null; | ||
/** | ||
* Returns a boolean if the given value is a `number`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isNumber } from 'effekt' | ||
* | ||
* isNumber(33) // => true | ||
* ``` | ||
*/ | ||
declare const isNumber: (v: any) => v is number; | ||
/** | ||
* Returns a boolean if the given value is a `string`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isString } from 'effekt' | ||
* | ||
* isString('effekt') // => true | ||
* ``` | ||
*/ | ||
declare const isString: (v: any) => v is string; | ||
/** | ||
* Returns a boolean if the given value is a `null`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isNull } from 'effekt' | ||
* | ||
* isNull(null) // => true | ||
* ``` | ||
*/ | ||
declare const isNull: (v: any) => v is null; | ||
/** | ||
* Returns a boolean if the given value is a `undefined`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isUndefined } from 'effekt' | ||
* | ||
* isUndefined(undefined) // => true | ||
* ``` | ||
*/ | ||
declare const isUndefined: (v: any) => v is undefined; | ||
/** | ||
* Returns a boolean if the given value is a `object`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isObject } from 'effekt' | ||
* | ||
* isObject({}) // => true | ||
* ``` | ||
*/ | ||
declare const isObject: (v: any) => v is object; | ||
/** | ||
* Returns a boolean if the given value is a `array`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isArray } from 'effekt' | ||
* | ||
* isArray([]) // => true | ||
* ``` | ||
*/ | ||
declare const isArray: (v: any) => v is any[]; | ||
/** | ||
* Returns a boolean if the given value is a `Function`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isFunction } from 'effekt' | ||
* | ||
* isFunction(() => {}) // => true | ||
* ``` | ||
*/ | ||
declare const isFunction: (v: any) => v is (...args: any[]) => unknown; | ||
/** | ||
* Returns a boolean if the given value is a `Element`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isElement } from 'effekt' | ||
* | ||
* isElement(el) // => true | ||
* ``` | ||
*/ | ||
declare const isElement: (v: any) => v is Element; | ||
/** | ||
* Returns a boolean if the given value is a `HTMLElement`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isHtmlElement } from 'effekt' | ||
* | ||
* isHtmlElement(htmlEl) // => true | ||
* ``` | ||
*/ | ||
declare const isHtmlElement: (v: any) => v is HTMLElement; | ||
/** | ||
* Returns a boolean if the given value is a `SVGElement`. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* import { isSvgElement } from 'effekt' | ||
* | ||
* isSvgElement(svgEl) // => true | ||
* ``` | ||
*/ | ||
declare const isSvgElement: (v: any) => v is SVGElement; | ||
/** | ||
* Converts `seconds` to `milliseconds`. | ||
@@ -674,2 +795,2 @@ * | ||
export { type AnimationDirection, type AnimationEffect, type AnimationKeyframes, type AnimationMethods, type AnimationOptions, type AnimationPlayState, type AnimationPromise, type AnimationRunMethods, type AnimationSetProperties, type AnimationTarget, type Batcher, type ControllerMethods, type ControllerProperties, type DelayFunction, Driver, type DriverData, type DriverDataOptions, type DriverOptions, type Easing, type FrameData, type InterpolateOptions, type KeyframeOptions, type KeyframeTypeData, type KeyframesGenerator, type Mix, type Mixer, type MixerType, type ParsedElements, type ParsedValue, type Process, type RGBA, type RenderBatcher, type Schedule, type StaggerOptions, type StaggerOrigin, type Step, type StepId, type Steps, type Target, type Targets, animate, cancelFrame, clamp, createDriverData, createRenderBatcher, createRenderStep, frame, getElements, hexToRgba, hslaToRgba, interpolate, mix, mixColor, msToSec, pipe, progress, round, secToMs, setStyle, stagger, state }; | ||
export { type AnimationDirection, type AnimationEffect, type AnimationKeyframes, type AnimationMethods, type AnimationOptions, type AnimationPlayState, type AnimationPromise, type AnimationRunMethods, type AnimationSetProperties, type AnimationTarget, type Batcher, type ControllerMethods, type ControllerProperties, type DelayFunction, Driver, type DriverData, type DriverDataOptions, type DriverOptions, type Easing, type FrameData, type InterpolateOptions, type KeyframeOptions, type KeyframeTypeData, type KeyframesGenerator, type Mix, type Mixer, type MixerType, type ParsedElements, type ParsedValue, type Process, type RGBA, type RenderBatcher, type Schedule, type StaggerOptions, type StaggerOrigin, type Step, type StepId, type Steps, type Target, type Targets, animate, cancelFrame, clamp, createDriverData, createRenderBatcher, createRenderStep, frame, getElements, hexToRgba, hslaToRgba, interpolate, isArray, isElement, isFunction, isHtmlElement, isNull, isNumber, isObject, isString, isSvgElement, isUndefined, mix, mixColor, msToSec, pipe, progress, round, secToMs, setStyle, stagger, state }; |
{ | ||
"name": "effekt", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Ivo Dolenc", | ||
@@ -41,20 +41,3 @@ "description": "Universal web animation platform.", | ||
], | ||
"scripts": { | ||
"dev": "vite -c .config/vite.config.ts playgrounds/browser", | ||
"dev:node": "vite-node -w playgrounds/node/main.ts", | ||
"test": "vitest -c test/vitest.config.ts", | ||
"test:utils": "vitest -c test/utils/vitest.config.ts", | ||
"test:easing": "vitest -c test/easing/vitest.config.ts", | ||
"build": "hyperbundler", | ||
"build:play": "vite -c .config/vite.config.js build playgrounds/browser", | ||
"preview:play": "vite -c .config/vite.config.js preview playgrounds/browser", | ||
"lint": "eslint -c .config/eslint.config.js .", | ||
"lint:fix": "eslint -c .config/eslint.config.js --fix .", | ||
"format": "prettier --config .config/prettier.config.js --write .", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=20.0.0" | ||
}, | ||
"peerDependencies": { | ||
@@ -73,14 +56,17 @@ "@types/node": ">=20.0.0", | ||
"devDependencies": { | ||
"@hypernym/bundler": "^0.9.2", | ||
"@hypernym/eslint-config": "^3.0.2", | ||
"@hypernym/prettier-config": "^3.0.1", | ||
"@hypernym/tsconfig": "^2.0.0", | ||
"@types/node": "^22.5.0", | ||
"eslint": "^9.9.1", | ||
"jsdom": "^24.1.1", | ||
"prettier": "^3.3.2", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.2", | ||
"@hypernym/bundler": "^0.9.3", | ||
"jsdom": "^25.0.0", | ||
"vitest": "^2.0.5" | ||
}, | ||
"scripts": { | ||
"build": "hyperbundler", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"format": "prettier --write .", | ||
"test": "vitest -c test/vitest.config.ts", | ||
"test:utils": "vitest -c test/utils/vitest.config.ts", | ||
"test:easing": "vitest -c test/easing/vitest.config.ts", | ||
"check": "ncu", | ||
"update": "ncu -u -i" | ||
} | ||
} | ||
} |
@@ -1,9 +0,3 @@ | ||
<p align="center"> | ||
<img alt="Effekt" src=".assets/cover.gif" /> | ||
</p> | ||
<h1 align="center">Effekt</h1> | ||
<h3 align="center">Universal web animation platform.</h3> | ||
<p align="center">An open-source and framework independent JavaScript library designed for modern devs.</p> | ||
@@ -13,3 +7,3 @@ | ||
<sub> | ||
<a href="https://github.com/ivodolenc/effekt">Repository</a> | <a href="https://www.npmjs.com/package/effekt">Package</a> | <a href="https://github.com/ivodolenc/effekt/releases">Releases</a> | <a href="https://github.com/ivodolenc/effekt/discussions">Discussions</a> | <a href="./docs/README.md">Documentation</a> | ||
<a href="https://github.com/ivodolenc/effekt">Repository</a> | <a href="https://www.npmjs.com/package/effekt">Package</a> | <a href="https://github.com/ivodolenc/effekt/releases">Releases</a> | <a href="https://github.com/ivodolenc/effekt/discussions">Discussions</a> | <a href="../../docs/README.md">Documentation</a> | ||
</sub> | ||
@@ -20,3 +14,3 @@ </p> | ||
<pre align="center">npm install effekt</pre> | ||
<pre align="center">pnpm add effekt</pre> | ||
@@ -27,5 +21,5 @@ <br> | ||
> | ||
> **Effekt** is still in development phase and there is a possibility that the [API](./docs/api.md) will change before the first stable release. | ||
> **Effekt** is still in development phase and there is a possibility that the [API](../../docs/api.md) will change before the first stable release. | ||
> | ||
> Any ideas, [suggestions](https://github.com/ivodolenc/effekt/discussions) and code [contributions](.github/CONTRIBUTING.md) are welcome. | ||
> Any ideas, [suggestions](https://github.com/ivodolenc/effekt/discussions) and code [contributions](../../.github/CONTRIBUTING.md) are welcome. | ||
> | ||
@@ -42,3 +36,3 @@ > If you find an issue or bug, please [report](https://github.com/ivodolenc/effekt/issues/new/choose) it so that the project can be improved. | ||
<a title="Hypernym Studio" href="https://github.com/hypernym-studio"> | ||
<img alt="Hypernym Studio" width="244" src=".assets/hypernym-logo.svg"> | ||
<img alt="Hypernym Studio" width="200" src="../../.assets/hypernym-logo.svg"> | ||
</a> | ||
@@ -66,20 +60,8 @@ </p> | ||
Read the [docs](./docs/README.md) to learn more. | ||
Read the [docs](../../docs/README.md) to learn more. | ||
## Community | ||
Feel free to ask questions or share new ideas. | ||
Use the official [discussions](https://github.com/ivodolenc/effekt/discussions) to get involved. | ||
## Contribution | ||
Check out the quick [guide](.github/CONTRIBUTING.md) for more info. | ||
## License | ||
Developed in 🇭🇷 Croatia. | ||
Developed in 🇭🇷 Croatia, © Ivo Dolenc. | ||
Released under the [MIT](LICENSE.txt) license. | ||
© Ivo Dolenc |
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
135229
3
2922
63