@motionone/dom
Advanced tools
Comparing version 10.6.0-rc.1 to 10.6.0-rc.3
@@ -1,1 +0,1 @@ | ||
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}const a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},i=t=>"number"==typeof t,n=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!i(t[0]),r=(t,e,a)=>-a*t+a*e+t,o=()=>{},l=t=>t,c=(t,e,a)=>e-t==0?1:(a-t)/(e-t);function h(t,e){const a=t[t.length-1];for(let i=1;i<=e;i++){const n=c(0,e,i);t.push(r(a,1,n))}}const u=t=>1e3*t,f=["","X","Y","Z"],p={x:"translateX",y:"translateY",z:"translateZ"},m={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},d={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:m,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:m},y=new Map,g=t=>`--motion-${t}`,v=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{f.forEach((e=>{v.push(t+e),y.set(g(t+e),d[t])}))}));const S=(t,e)=>v.indexOf(t)-v.indexOf(e),T=new Set(v),w=t=>T.has(t),x=t=>t.sort(S).reduce(b,"").trim(),b=(t,e)=>`${t} ${e}(var(${g(e)}))`,k=t=>t.startsWith("--"),M=new Set;const A=(t,e,a)=>(((1-3*a+3*e)*t+(3*a-6*e))*t+3*e)*t;function D(t,e,a,i){if(t===e&&a===i)return l;const n=e=>function(t,e,a,i,n){let s,r,o=0;do{r=e+(a-e)/2,s=A(r,i,n)-t,s>0?a=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,a);return t=>0===t||1===t?t:A(n(t),e,i)}const P=(t,e="end")=>a=>{const i=(a="end"===e?Math.min(a,.999):Math.max(a,.001))*t,n="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=n/t,Math.min(Math.max(o,s),r);var s,r,o},O={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},V=/\((.*?)\)/;function $(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(O[t])return O[t];if(t.startsWith("steps")){const e=V.exec(t);if(e){const t=e[1].split(",");return P(parseFloat(t[0]),t[1].trim())}}return l}function j(t,e=function(t){const e=[0];return h(e,t-1),e}(t.length),a=l){const i=t.length,n=i-e.length;return n>0&&h(e,n),n=>{let o=0;for(;o<i-2&&!(n<e[o+1]);o++);let l=(h=c(e[o],e[o+1],n),Math.min(1,Math.max(h,0)));var h;const u=function(t,e){return s(t)?t[((t,e,a)=>{const i=e-t;return((a-t)%i+i)%i+t})(0,t.length,e)]:t}(a,o);return l=u(l),r(t[o],t[o+1],l)}}class U{constructor(t,e=[0,1],{easing:i=a.easing,duration:r=a.duration,delay:o=a.delay,endDelay:l=a.endDelay,repeat:c=a.repeat,offset:h,direction:u="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=r*(c+1);n(i)&&(i="ease");const p=j(e,h,s(i)?i.map($):$(i));this.tick=e=>{var a;this.pauseTime&&(e=this.pauseTime);let i=(e-this.startTime)*this.rate;this.t=i,i/=1e3,i=Math.max(i-o,0),"finished"===this.playState&&(i=f);const n=i/r;let s=Math.floor(n),c=n%1;!c&&n>=1&&(c=1),1===c&&s--;const h=s%2;("reverse"===u||"alternate"===u&&h||"alternate-reverse"===u&&!h)&&(c=1-c);const m=p(i>=f?1:Math.min(c,1));t(m);"finished"===this.playState||i>=f+l?(this.playState="finished",null===(a=this.resolve)||void 0===a||a.call(this,m)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const R=t=>(t=>Array.isArray(t)&&i(t[0]))(t)?C(t):t,C=([t,e,a,i])=>`cubic-bezier(${t}, ${e}, ${a}, ${i})`,E=t=>document.createElement("div").animate(t,{duration:.001}),F={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{E({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(E({opacity:[0,1]}).finished)},W={},z={};for(const t in F)z[t]=()=>(void 0===W[t]&&(W[t]=F[t]()),W[t]);function q(t){return p[t]&&(t=p[t]),w(t)?g(t):t}const B=(t,e)=>{e=q(e);let a=k(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!a&&0!==a){const t=y.get(e);t&&(a=t.initialValue)}return a},G=(t,e,a)=>{e=q(e),k(e)?t.style.setProperty(e,a):t.style[e]=a};function K(t,r,l,c={}){let h,{duration:f=a.duration,delay:m=a.delay,endDelay:d=a.endDelay,repeat:g=a.repeat,easing:v=a.easing,direction:S,offset:T,allowWebkitAcceleration:b=!1}=c;const A=e(t);let D=z.waapi();const P=w(r);P&&((t,a)=>{p[a]&&(a=p[a]);const{transforms:i}=e(t);var n,s;s=a,-1===(n=i).indexOf(s)&&n.push(s),t.style.transform=x(i)})(t,r);const O=q(r),V=y.get(O);return function(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}(A.animations[O]),()=>{const e=()=>{var e,a;return null!==(a=null!==(e=B(t,O))&&void 0!==e?e:null==V?void 0:V.initialValue)&&void 0!==a?a:0};let a=function(t,e){for(let a=0;a<t.length;a++)null===t[a]&&(t[a]=a?t[a-1]:e());return t}((t=>Array.isArray(t)?t:[t])(l),e);if(n(v)){const t=v.createAnimation(a,e,P,O,A);v=t.easing,void 0!==t.keyframes&&(a=t.keyframes),void 0!==t.duration&&(f=t.duration)}if(k(O)&&(z.cssRegisterProperty()?function(t){if(!M.has(t)){M.add(t);try{const{syntax:e,initialValue:a}=y.has(t)?y.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:a})}catch(t){}}}(O):D=!1),D){V&&(a=a.map((t=>i(t)?V.toDefaultUnit(t):t))),z.partialKeyframes()||1!==a.length||a.unshift(e());const n={delay:u(m),duration:u(f),endDelay:u(d),easing:s(v)?void 0:R(v),direction:S,iterations:g+1,fill:"both"};h=t.animate({[O]:a,offset:T,easing:s(v)?v.map(R):void 0},n),h.finished||(h.finished=new Promise(((t,e)=>{h.onfinish=t,h.oncancel=e})));const r=a[a.length-1];h.finished.then((()=>{G(t,O,r),h.cancel()})).catch(o),b||(h.playbackRate=1.000001)}else if(P&&a.every(i)){1===a.length&&a.unshift(parseFloat(e()));h=new U((e=>{V&&(e=V.toDefaultUnit(e)),G(t,O,e)}),a,Object.assign(Object.assign({},c),{duration:f,easing:v}))}else{const e=a[a.length-1];G(t,O,V&&i(e)?V.toDefaultUnit(e):e)}return A.animations[O]=h,null==h||h.finished.then((()=>{A.animations[O]=void 0,A.generators[O]=void 0,A.prevGeneratorState[O]=void 0})).catch(o),h}}export{K as animateStyle}; | ||
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}const a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},i=t=>"number"==typeof t,n=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!i(t[0]),r=(t,e,a)=>-a*t+a*e+t,o=()=>{},l=t=>t,c=(t,e,a)=>e-t==0?1:(a-t)/(e-t);function h(t,e){const a=t[t.length-1];for(let i=1;i<=e;i++){const n=c(0,e,i);t.push(r(a,1,n))}}const u=t=>1e3*t,f=["","X","Y","Z"],m={x:"translateX",y:"translateY",z:"translateZ"},p={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},d={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:p,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:p},y=new Map,g=t=>`--motion-${t}`,v=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{f.forEach((e=>{v.push(t+e),y.set(g(t+e),d[t])}))}));const S=(t,e)=>v.indexOf(t)-v.indexOf(e),T=new Set(v),w=t=>T.has(t),x=t=>t.sort(S).reduce(b,"").trim(),b=(t,e)=>`${t} ${e}(var(${g(e)}))`,k=t=>t.startsWith("--"),A=new Set;const M=(t,e,a)=>(((1-3*a+3*e)*t+(3*a-6*e))*t+3*e)*t;function D(t,e,a,i){if(t===e&&a===i)return l;const n=e=>function(t,e,a,i,n){let s,r,o=0;do{r=e+(a-e)/2,s=M(r,i,n)-t,s>0?a=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,a);return t=>0===t||1===t?t:M(n(t),e,i)}const P=(t,e="end")=>a=>{const i=(a="end"===e?Math.min(a,.999):Math.max(a,.001))*t,n="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=n/t,Math.min(Math.max(o,s),r);var s,r,o},O={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},R=/\((.*?)\)/;function V(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(O[t])return O[t];if(t.startsWith("steps")){const e=R.exec(t);if(e){const t=e[1].split(",");return P(parseFloat(t[0]),t[1].trim())}}return l}function $(t,e=function(t){const e=[0];return h(e,t-1),e}(t.length),a=l){const i=t.length,n=i-e.length;return n>0&&h(e,n),n=>{let o=0;for(;o<i-2&&!(n<e[o+1]);o++);let l=(h=c(e[o],e[o+1],n),Math.min(1,Math.max(h,0)));var h;const u=function(t,e){return s(t)?t[((t,e,a)=>{const i=e-t;return((a-t)%i+i)%i+t})(0,t.length,e)]:t}(a,o);return l=u(l),r(t[o],t[o+1],l)}}class j{constructor(t,e=[0,1],{easing:i=a.easing,duration:r=a.duration,delay:o=a.delay,endDelay:l=a.endDelay,repeat:c=a.repeat,offset:h,direction:u="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=r*(c+1);n(i)&&(i="ease");const m=$(e,h,s(i)?i.map(V):V(i));this.tick=e=>{var a;this.pauseTime&&(e=this.pauseTime);let i=(e-this.startTime)*this.rate;console.log(e,this.startTime,i),this.t=i,i/=1e3,i=Math.max(i-o,0),"finished"===this.playState&&(i=f);const n=i/r;let s=Math.floor(n),c=n%1;!c&&n>=1&&(c=1),1===c&&s--;const h=s%2;("reverse"===u||"alternate"===u&&h||"alternate-reverse"===u&&!h)&&(c=1-c);const p=m(i>=f?1:Math.min(c,1));t(p);"finished"===this.playState||i>=f+l?(this.playState="finished",null===(a=this.resolve)||void 0===a||a.call(this,p)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",console.log("cancelling with timestamp ",this.cancelTimestamp),this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1),void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const U=t=>(t=>Array.isArray(t)&&i(t[0]))(t)?q(t):t,q=([t,e,a,i])=>`cubic-bezier(${t}, ${e}, ${a}, ${i})`,F=t=>document.createElement("div").animate(t,{duration:.001}),C={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{F({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(F({opacity:[0,1]}).finished)},E={},W={};for(const t in C)W[t]=()=>(void 0===E[t]&&(E[t]=C[t]()),E[t]);function z(t){return m[t]&&(t=m[t]),w(t)?g(t):t}const I=(t,e)=>{e=z(e);let a=k(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!a&&0!==a){const t=y.get(e);t&&(a=t.initialValue)}return a},B=(t,e,a)=>{e=z(e),k(e)?t.style.setProperty(e,a):t.style[e]=a};function G(t,r,l,c={}){let h,{duration:f=a.duration,delay:p=a.delay,endDelay:d=a.endDelay,repeat:g=a.repeat,easing:v=a.easing,direction:S,offset:T,allowWebkitAcceleration:b=!1}=c;const M=e(t);let D=W.waapi();const P=w(r);P&&((t,a)=>{m[a]&&(a=m[a]);const{transforms:i}=e(t);var n,s;s=a,-1===(n=i).indexOf(s)&&n.push(s),t.style.transform=x(i)})(t,r);const O=z(r),R=y.get(O);return function(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}(M.animations[O]),()=>{const e=()=>{var e,a;return null!==(a=null!==(e=I(t,O))&&void 0!==e?e:null==R?void 0:R.initialValue)&&void 0!==a?a:0};let a=function(t,e){for(let a=0;a<t.length;a++)null===t[a]&&(t[a]=a?t[a-1]:e());return t}((t=>Array.isArray(t)?t:[t])(l),e);if(n(v)){const t=v.createAnimation(a,e,P,O,M);v=t.easing,void 0!==t.keyframes&&(a=t.keyframes),void 0!==t.duration&&(f=t.duration)}if(k(O)&&(W.cssRegisterProperty()?function(t){if(!A.has(t)){A.add(t);try{const{syntax:e,initialValue:a}=y.has(t)?y.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:a})}catch(t){}}}(O):D=!1),D){R&&(a=a.map((t=>i(t)?R.toDefaultUnit(t):t))),W.partialKeyframes()||1!==a.length||a.unshift(e());const n={delay:u(p),duration:u(f),endDelay:u(d),easing:s(v)?void 0:U(v),direction:S,iterations:g+1,fill:"both"};h=t.animate({[O]:a,offset:T,easing:s(v)?v.map(U):void 0},n),h.finished||(h.finished=new Promise(((t,e)=>{h.onfinish=t,h.oncancel=e})));const r=a[a.length-1];h.finished.then((()=>{B(t,O,r),h.cancel()})).catch(o),b||(h.playbackRate=1.000001)}else if(P&&a.every(i)){1===a.length&&a.unshift(parseFloat(e()));h=new j((e=>{R&&(e=R.toDefaultUnit(e)),B(t,O,e)}),a,Object.assign(Object.assign({},c),{duration:f,easing:v}))}else{const e=a[a.length-1];B(t,O,R&&i(e)?R.toDefaultUnit(e):e)}return M.animations[O]=h,null==h||h.finished.then((()=>{M.animations[O]=void 0,M.generators[O]=void 0,M.prevGeneratorState[O]=void 0})).catch(o),h}}export{G as animateStyle}; |
@@ -1,1 +0,1 @@ | ||
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}const n={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,i=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!a(t[0]),s=(t,e,n)=>-n*t+n*e+t,o=()=>{},l=t=>t,c=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function u(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=c(0,e,a);t.push(s(n,1,i))}}const h=t=>1e3*t,f=["","X","Y","Z"],d={x:"translateX",y:"translateY",z:"translateZ"},m={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},p={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:m,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:m},y=new Map,g=t=>`--motion-${t}`,v=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{f.forEach((e=>{v.push(t+e),y.set(g(t+e),p[t])}))}));const S=(t,e)=>v.indexOf(t)-v.indexOf(e),T=new Set(v),w=t=>T.has(t),b=t=>t.sort(S).reduce(x,"").trim(),x=(t,e)=>`${t} ${e}(var(${g(e)}))`,k=t=>t.startsWith("--"),A=new Set;const M=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function D(t,e,n,a){if(t===e&&n===a)return l;const i=e=>function(t,e,n,a,i){let r,s,o=0;do{s=e+(n-e)/2,r=M(s,a,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:M(i(t),e,a)}const O=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(a):Math.ceil(a);return r=0,s=1,o=i/t,Math.min(Math.max(o,r),s);var r,s,o},P={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},j=/\((.*?)\)/;function V(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(P[t])return P[t];if(t.startsWith("steps")){const e=j.exec(t);if(e){const t=e[1].split(",");return O(parseFloat(t[0]),t[1].trim())}}return l}function $(t,e=function(t){const e=[0];return u(e,t-1),e}(t.length),n=l){const a=t.length,i=a-e.length;return i>0&&u(e,i),i=>{let o=0;for(;o<a-2&&!(i<e[o+1]);o++);let l=(u=c(e[o],e[o+1],i),Math.min(1,Math.max(u,0)));var u;const h=function(t,e){return r(t)?t[((t,e,n)=>{const a=e-t;return((n-t)%a+a)%a+t})(0,t.length,e)]:t}(n,o);return l=h(l),s(t[o],t[o+1],l)}}class E{constructor(t,e=[0,1],{easing:a=n.easing,duration:s=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=s*(c+1);i(a)&&(a="ease");const d=$(e,u,r(a)?a.map(V):V(a));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let a=(e-this.startTime)*this.rate;this.t=a,a/=1e3,a=Math.max(a-o,0),"finished"===this.playState&&(a=f);const i=a/s;let r=Math.floor(i),c=i%1;!c&&i>=1&&(c=1),1===c&&r--;const u=r%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(c=1-c);const m=d(a>=f?1:Math.min(c,1));t(m);"finished"===this.playState||a>=f+l?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,m)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const R=t=>(t=>Array.isArray(t)&&a(t[0]))(t)?U(t):t,U=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,q=t=>document.createElement("div").animate(t,{duration:.001}),C={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{q({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(q({opacity:[0,1]}).finished)},F={},W={};for(const t in C)W[t]=()=>(void 0===F[t]&&(F[t]=C[t]()),F[t]);function z(t){return d[t]&&(t=d[t]),w(t)?g(t):t}const B=(t,e)=>{e=z(e);let n=k(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=y.get(e);t&&(n=t.initialValue)}return n},G=(t,e,n)=>{e=z(e),k(e)?t.style.setProperty(e,n):t.style[e]=n};function K(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function X(t,s,l,c={}){let u,{duration:f=n.duration,delay:m=n.delay,endDelay:p=n.endDelay,repeat:g=n.repeat,easing:v=n.easing,direction:S,offset:T,allowWebkitAcceleration:x=!1}=c;const M=e(t);let D=W.waapi();const O=w(s);O&&((t,n)=>{d[n]&&(n=d[n]);const{transforms:a}=e(t);var i,r;r=n,-1===(i=a).indexOf(r)&&i.push(r),t.style.transform=b(a)})(t,s);const P=z(s),j=y.get(P);return K(M.animations[P]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=B(t,P))&&void 0!==e?e:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}((t=>Array.isArray(t)?t:[t])(l),e);if(i(v)){const t=v.createAnimation(n,e,O,P,M);v=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(f=t.duration)}if(k(P)&&(W.cssRegisterProperty()?function(t){if(!A.has(t)){A.add(t);try{const{syntax:e,initialValue:n}=y.has(t)?y.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):D=!1),D){j&&(n=n.map((t=>a(t)?j.toDefaultUnit(t):t))),W.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:h(m),duration:h(f),endDelay:h(p),easing:r(v)?void 0:R(v),direction:S,iterations:g+1,fill:"both"};u=t.animate({[P]:n,offset:T,easing:r(v)?v.map(R):void 0},i),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const s=n[n.length-1];u.finished.then((()=>{G(t,P,s),u.cancel()})).catch(o),x||(u.playbackRate=1.000001)}else if(O&&n.every(a)){1===n.length&&n.unshift(parseFloat(e()));u=new E((e=>{j&&(e=j.toDefaultUnit(e)),G(t,P,e)}),n,Object.assign(Object.assign({},c),{duration:f,easing:v}))}else{const e=n[n.length-1];G(t,P,j&&a(e)?j.toDefaultUnit(e):e)}return M.animations[P]=u,null==u||u.finished.then((()=>{M.animations[P]=void 0,M.generators[P]=void 0,M.prevGeneratorState[P]=void 0})).catch(o),u}}const Y=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const Z=t=>t(),H=t=>t.animations[0],I={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let i=(null===(n=H(t))||void 0===n?void 0:n[e])||0;return i?i/1e3:0;case"playbackRate":return null===(a=H(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(J)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach(K);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=h(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},J=t=>t.finished;function L(t,e,n){return"function"==typeof t?t(e,n):t}function N(t,e,a={}){const i=(t=function(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length,r=[];for(let n=0;n<i;n++){const s=t[n];for(const t in e){const o=Y(a,t);o.delay=L(o.delay,n,i);const l=X(s,t,e[t],o);r.push(l)}}return((t,e=n.duration)=>new Proxy({animations:t.map(Z).filter(Boolean),duration:e},I))(r,a.duration)}export{N as animate}; | ||
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}const n={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,i=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!a(t[0]),r=(t,e,n)=>-n*t+n*e+t,o=()=>{},l=t=>t,c=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function u(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=c(0,e,a);t.push(r(n,1,i))}}const h=t=>1e3*t,f=["","X","Y","Z"],m={x:"translateX",y:"translateY",z:"translateZ"},d={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},p={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:d,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:d},y=new Map,g=t=>`--motion-${t}`,v=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{f.forEach((e=>{v.push(t+e),y.set(g(t+e),p[t])}))}));const S=(t,e)=>v.indexOf(t)-v.indexOf(e),T=new Set(v),w=t=>T.has(t),b=t=>t.sort(S).reduce(x,"").trim(),x=(t,e)=>`${t} ${e}(var(${g(e)}))`,A=t=>t.startsWith("--"),k=new Set;const M=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function D(t,e,n,a){if(t===e&&n===a)return l;const i=e=>function(t,e,n,a,i){let s,r,o=0;do{r=e+(n-e)/2,s=M(r,a,i)-t,s>0?n=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:M(i(t),e,a)}const O=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(a):Math.ceil(a);return s=0,r=1,o=i/t,Math.min(Math.max(o,s),r);var s,r,o},P={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},j=/\((.*?)\)/;function R(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(P[t])return P[t];if(t.startsWith("steps")){const e=j.exec(t);if(e){const t=e[1].split(",");return O(parseFloat(t[0]),t[1].trim())}}return l}function V(t,e=function(t){const e=[0];return u(e,t-1),e}(t.length),n=l){const a=t.length,i=a-e.length;return i>0&&u(e,i),i=>{let o=0;for(;o<a-2&&!(i<e[o+1]);o++);let l=(u=c(e[o],e[o+1],i),Math.min(1,Math.max(u,0)));var u;const h=function(t,e){return s(t)?t[((t,e,n)=>{const a=e-t;return((n-t)%a+a)%a+t})(0,t.length,e)]:t}(n,o);return l=h(l),r(t[o],t[o+1],l)}}class ${constructor(t,e=[0,1],{easing:a=n.easing,duration:r=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=r*(c+1);i(a)&&(a="ease");const m=V(e,u,s(a)?a.map(R):R(a));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let a=(e-this.startTime)*this.rate;console.log(e,this.startTime,a),this.t=a,a/=1e3,a=Math.max(a-o,0),"finished"===this.playState&&(a=f);const i=a/r;let s=Math.floor(i),c=i%1;!c&&i>=1&&(c=1),1===c&&s--;const u=s%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(c=1-c);const d=m(a>=f?1:Math.min(c,1));t(d);"finished"===this.playState||a>=f+l?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",console.log("cancelling with timestamp ",this.cancelTimestamp),this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1),void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const q=t=>(t=>Array.isArray(t)&&a(t[0]))(t)?E(t):t,E=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,U=t=>document.createElement("div").animate(t,{duration:.001}),F={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{U({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(U({opacity:[0,1]}).finished)},C={},W={};for(const t in F)W[t]=()=>(void 0===C[t]&&(C[t]=F[t]()),C[t]);function z(t){return m[t]&&(t=m[t]),w(t)?g(t):t}const B=(t,e)=>{e=z(e);let n=A(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=y.get(e);t&&(n=t.initialValue)}return n},I=(t,e,n)=>{e=z(e),A(e)?t.style.setProperty(e,n):t.style[e]=n};function G(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function K(t,r,l,c={}){let u,{duration:f=n.duration,delay:d=n.delay,endDelay:p=n.endDelay,repeat:g=n.repeat,easing:v=n.easing,direction:S,offset:T,allowWebkitAcceleration:x=!1}=c;const M=e(t);let D=W.waapi();const O=w(r);O&&((t,n)=>{m[n]&&(n=m[n]);const{transforms:a}=e(t);var i,s;s=n,-1===(i=a).indexOf(s)&&i.push(s),t.style.transform=b(a)})(t,r);const P=z(r),j=y.get(P);return G(M.animations[P]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=B(t,P))&&void 0!==e?e:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}((t=>Array.isArray(t)?t:[t])(l),e);if(i(v)){const t=v.createAnimation(n,e,O,P,M);v=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(f=t.duration)}if(A(P)&&(W.cssRegisterProperty()?function(t){if(!k.has(t)){k.add(t);try{const{syntax:e,initialValue:n}=y.has(t)?y.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):D=!1),D){j&&(n=n.map((t=>a(t)?j.toDefaultUnit(t):t))),W.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:h(d),duration:h(f),endDelay:h(p),easing:s(v)?void 0:q(v),direction:S,iterations:g+1,fill:"both"};u=t.animate({[P]:n,offset:T,easing:s(v)?v.map(q):void 0},i),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const r=n[n.length-1];u.finished.then((()=>{I(t,P,r),u.cancel()})).catch(o),x||(u.playbackRate=1.000001)}else if(O&&n.every(a)){1===n.length&&n.unshift(parseFloat(e()));u=new $((e=>{j&&(e=j.toDefaultUnit(e)),I(t,P,e)}),n,Object.assign(Object.assign({},c),{duration:f,easing:v}))}else{const e=n[n.length-1];I(t,P,j&&a(e)?j.toDefaultUnit(e):e)}return M.animations[P]=u,null==u||u.finished.then((()=>{M.animations[P]=void 0,M.generators[P]=void 0,M.prevGeneratorState[P]=void 0})).catch(o),u}}const X=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const Y=t=>t(),Z=t=>t.animations[0],H={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let i=(null===(n=Z(t))||void 0===n?void 0:n[e])||0;return i?i/1e3:0;case"playbackRate":return null===(a=Z(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(J)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach(G);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=h(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},J=t=>t.finished;function L(t,e,n){return"function"==typeof t?t(e,n):t}function N(t,e,a={}){const i=(t=function(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length,s=[];for(let n=0;n<i;n++){const r=t[n];for(const t in e){const o=X(a,t);o.delay=L(o.delay,n,i);const l=K(r,t,e[t],o);s.push(l)}}return((t,e=n.duration)=>new Proxy({animations:t.map(Y).filter(Boolean),duration:e},H))(s,a.duration)}export{N as animate}; |
@@ -1,1 +0,1 @@ | ||
var t=function(){};function e(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}"production"!==process.env.NODE_ENV&&(t=function(t,e){if(!t)throw new Error(e)});const n={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,i=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!a(t[0]),s=(t,e,n)=>-n*t+n*e+t,o=()=>{},l=t=>t,c=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function u(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=c(0,e,a);t.push(s(n,1,i))}}function h(t){const e=[0];return u(e,t-1),e}const f=t=>1e3*t,d=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function p(t,e,n,a){if(t===e&&n===a)return l;const i=e=>function(t,e,n,a,i){let r,s,o=0;do{s=e+(n-e)/2,r=d(s,a,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:d(i(t),e,a)}const m=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(a):Math.ceil(a);return r=0,s=1,o=i/t,Math.min(Math.max(o,r),s);var r,s,o},y={ease:p(.25,.1,.25,1),"ease-in":p(.42,0,1,1),"ease-in-out":p(.42,0,.58,1),"ease-out":p(0,0,.58,1)},g=/\((.*?)\)/;function v(t){if("function"==typeof t)return t;if(Array.isArray(t))return p(...t);if(y[t])return y[t];if(t.startsWith("steps")){const e=g.exec(t);if(e){const t=e[1].split(",");return m(parseFloat(t[0]),t[1].trim())}}return l}function b(t,e){return r(t)?t[((t,e,n)=>{const a=e-t;return((n-t)%a+a)%a+t})(0,t.length,e)]:t}function w(t,e=h(t.length),n=l){const a=t.length,i=a-e.length;return i>0&&u(e,i),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let o=(l=c(e[r],e[r+1],i),Math.min(1,Math.max(l,0)));var l;return o=b(n,r)(o),s(t[r],t[r+1],o)}}class O{constructor(t,e=[0,1],{easing:a=n.easing,duration:s=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=s*(c+1);i(a)&&(a="ease");const d=w(e,u,r(a)?a.map(v):v(a));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let a=(e-this.startTime)*this.rate;this.t=a,a/=1e3,a=Math.max(a-o,0),"finished"===this.playState&&(a=f);const i=a/s;let r=Math.floor(i),c=i%1;!c&&i>=1&&(c=1),1===c&&r--;const u=r%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(c=1-c);const p=d(a>=f?1:Math.min(c,1));t(p);"finished"===this.playState||a>=f+l?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,p)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}function S(t,e,n){return"function"==typeof t?t(e,n):t}const x=new WeakMap;function T(t){return x.has(t)||x.set(t,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),x.get(t)}const k=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},j={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},A={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:j,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:j},P=new Map,D=t=>`--motion-${t}`,E=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{E.push(t+e),P.set(D(t+e),A[t])}))}));const V=(t,e)=>E.indexOf(t)-E.indexOf(e),$=new Set(E),R=t=>$.has(t),U=t=>t.sort(V).reduce(W,"").trim(),W=(t,e)=>`${t} ${e}(var(${D(e)}))`,F=t=>t.startsWith("--"),q=new Set;const B=t=>(t=>Array.isArray(t)&&a(t[0]))(t)?C(t):t,C=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,z=t=>document.createElement("div").animate(t,{duration:.001}),G={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{z({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(z({opacity:[0,1]}).finished)},K={},N={};for(const t in G)N[t]=()=>(void 0===K[t]&&(K[t]=G[t]()),K[t]);const X=t=>Array.isArray(t)?t:[t];function Y(t){return M[t]&&(t=M[t]),R(t)?D(t):t}const Z=(t,e)=>{e=Y(e);let n=F(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=P.get(e);t&&(n=t.initialValue)}return n},I=(t,e,n)=>{e=Y(e),F(e)?t.style.setProperty(e,n):t.style[e]=n};function _(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function H(t,e,s,l={}){let c,{duration:u=n.duration,delay:h=n.delay,endDelay:d=n.endDelay,repeat:p=n.repeat,easing:m=n.easing,direction:y,offset:g,allowWebkitAcceleration:v=!1}=l;const b=T(t);let w=N.waapi();const S=R(e);S&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=T(t);var a,i;i=e,-1===(a=n).indexOf(i)&&a.push(i),t.style.transform=U(n)})(t,e);const x=Y(e),k=P.get(x);return _(b.animations[x]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=Z(t,x))&&void 0!==e?e:null==k?void 0:k.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(X(s),e);if(i(m)){const t=m.createAnimation(n,e,S,x,b);m=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(u=t.duration)}if(F(x)&&(N.cssRegisterProperty()?function(t){if(!q.has(t)){q.add(t);try{const{syntax:e,initialValue:n}=P.has(t)?P.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(x):w=!1),w){k&&(n=n.map((t=>a(t)?k.toDefaultUnit(t):t))),N.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:f(h),duration:f(u),endDelay:f(d),easing:r(m)?void 0:B(m),direction:y,iterations:p+1,fill:"both"};c=t.animate({[x]:n,offset:g,easing:r(m)?m.map(B):void 0},i),c.finished||(c.finished=new Promise(((t,e)=>{c.onfinish=t,c.oncancel=e})));const s=n[n.length-1];c.finished.then((()=>{I(t,x,s),c.cancel()})).catch(o),v||(c.playbackRate=1.000001)}else if(S&&n.every(a)){1===n.length&&n.unshift(parseFloat(e()));c=new O((e=>{k&&(e=k.toDefaultUnit(e)),I(t,x,e)}),n,Object.assign(Object.assign({},l),{duration:u,easing:m}))}else{const e=n[n.length-1];I(t,x,k&&a(e)?k.toDefaultUnit(e):e)}return b.animations[x]=c,null==c||c.finished.then((()=>{b.animations[x]=void 0,b.generators[x]=void 0,b.prevGeneratorState[x]=void 0})).catch(o),c}}const J=t=>t(),L=t=>t.animations[0],Q={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let i=(null===(n=L(t))||void 0===n?void 0:n[e])||0;return i?i/1e3:0;case"playbackRate":return null===(a=L(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(tt)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach(_);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=f(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},tt=t=>t.finished,et=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function nt(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}function at(t,e,n,i){var r;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function it(t,n,a,i,r,o){!function(t,n,a){for(let i=0;i<t.length;i++){const r=t[i];r.at>n&&r.at<a&&(e(t,r),i--)}}(t,r,o);for(let e=0;e<n.length;e++)t.push({value:n[e],at:s(r,o,i[e]),easing:b(a,e)})}function rt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function st(t,e={}){var a;const i=ot(t,e),r=i.map((t=>H(...t))).filter(Boolean);return((t,e=n.duration)=>new Proxy({animations:t.map(J).filter(Boolean),duration:e},Q))(r,null===(a=i[0])||void 0===a?void 0:a[3].duration)}function ot(e,a={}){var{defaultOptions:r={}}=a,s=function(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(t);i<a.length;i++)e.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(n[a[i]]=t[a[i]])}return n}(a,["defaultOptions"]);const o=[],l=new Map,f={},d=new Map;let p=0,m=0,y=0;for(let a=0;a<e.length;a++){const[s,o,c={}]=e[a];void 0!==c.at&&(m=at(m,c.at,p,d));let g=0;const v=nt(s,f),b=v.length;for(let e=0;e<b;e++){const a=lt(v[e],l);for(const s in o){const l=ct(s,a);let f=X(o[s]);const d=et(c,s);let{duration:p=r.duration||n.duration,easing:v=r.easing||n.easing}=d;if(i(v)){const e=R(s);t(2===f.length||!e,"spring must be provided 2 keyframes within timeline");const n=v.createAnimation(f,(()=>"0"),e);v=n.easing,void 0!==n.keyframes&&(f=n.keyframes),void 0!==n.duration&&(p=n.duration)}const w=S(c.delay,e,b)||0,O=m+w,x=O+p;let{offset:T=h(f.length)}=d;1===T.length&&0===T[0]&&(T[1]=1);const k=length-f.length;k>0&&u(T,k),1===f.length&&f.unshift(null),it(l,f,v,T,O,x),g=Math.max(w+p,g),y=Math.max(x,y)}}p=m,m+=g}return l.forEach(((t,e)=>{for(const a in t){const i=t[a];i.sort(rt);const l=[],u=[],h=[];for(let t=0;t<i.length;t++){const{at:e,value:a,easing:r}=i[t];l.push(a),u.push(c(0,y,e)),h.push(r||n.easing)}0!==u[0]&&(u.unshift(0),l.unshift(l[0]),h.unshift("linear")),1!==u[u.length-1]&&(u.push(1),l.push(null)),o.push([e,a,l,Object.assign(Object.assign(Object.assign({},r),{duration:y,easing:h,offset:u}),s)])}})),o}function lt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ct(t,e){return e[t]||(e[t]=[]),e[t]}export{ot as createAnimationsFromTimeline,st as timeline}; | ||
var t=function(){};function e(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}"production"!==process.env.NODE_ENV&&(t=function(t,e){if(!t)throw new Error(e)});const n={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,i=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!a(t[0]),r=(t,e,n)=>-n*t+n*e+t,o=()=>{},l=t=>t,c=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function u(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=c(0,e,a);t.push(r(n,1,i))}}function h(t){const e=[0];return u(e,t-1),e}const f=t=>1e3*t,d=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function m(t,e,n,a){if(t===e&&n===a)return l;const i=e=>function(t,e,n,a,i){let s,r,o=0;do{r=e+(n-e)/2,s=d(r,a,i)-t,s>0?n=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:d(i(t),e,a)}const p=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(a):Math.ceil(a);return s=0,r=1,o=i/t,Math.min(Math.max(o,s),r);var s,r,o},y={ease:m(.25,.1,.25,1),"ease-in":m(.42,0,1,1),"ease-in-out":m(.42,0,.58,1),"ease-out":m(0,0,.58,1)},g=/\((.*?)\)/;function v(t){if("function"==typeof t)return t;if(Array.isArray(t))return m(...t);if(y[t])return y[t];if(t.startsWith("steps")){const e=g.exec(t);if(e){const t=e[1].split(",");return p(parseFloat(t[0]),t[1].trim())}}return l}function b(t,e){return s(t)?t[((t,e,n)=>{const a=e-t;return((n-t)%a+a)%a+t})(0,t.length,e)]:t}function w(t,e=h(t.length),n=l){const a=t.length,i=a-e.length;return i>0&&u(e,i),i=>{let s=0;for(;s<a-2&&!(i<e[s+1]);s++);let o=(l=c(e[s],e[s+1],i),Math.min(1,Math.max(l,0)));var l;return o=b(n,s)(o),r(t[s],t[s+1],o)}}class O{constructor(t,e=[0,1],{easing:a=n.easing,duration:r=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const f=r*(c+1);i(a)&&(a="ease");const d=w(e,u,s(a)?a.map(v):v(a));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let a=(e-this.startTime)*this.rate;console.log(e,this.startTime,a),this.t=a,a/=1e3,a=Math.max(a-o,0),"finished"===this.playState&&(a=f);const i=a/r;let s=Math.floor(i),c=i%1;!c&&i>=1&&(c=1),1===c&&s--;const u=s%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(c=1-c);const m=d(a>=f?1:Math.min(c,1));t(m);"finished"===this.playState||a>=f+l?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,m)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",console.log("cancelling with timestamp ",this.cancelTimestamp),this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1),void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}function S(t,e,n){return"function"==typeof t?t(e,n):t}const x=new WeakMap;function T(t){return x.has(t)||x.set(t,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),x.get(t)}const k=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},A={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},j={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:A,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:A},P=new Map,D=t=>`--motion-${t}`,E=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{E.push(t+e),P.set(D(t+e),j[t])}))}));const R=(t,e)=>E.indexOf(t)-E.indexOf(e),V=new Set(E),$=t=>V.has(t),q=t=>t.sort(R).reduce(F,"").trim(),F=(t,e)=>`${t} ${e}(var(${D(e)}))`,U=t=>t.startsWith("--"),W=new Set;const B=t=>(t=>Array.isArray(t)&&a(t[0]))(t)?C(t):t,C=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,I=t=>document.createElement("div").animate(t,{duration:.001}),z={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{I({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(I({opacity:[0,1]}).finished)},G={},K={};for(const t in z)K[t]=()=>(void 0===G[t]&&(G[t]=z[t]()),G[t]);const N=t=>Array.isArray(t)?t:[t];function X(t){return M[t]&&(t=M[t]),$(t)?D(t):t}const Y=(t,e)=>{e=X(e);let n=U(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=P.get(e);t&&(n=t.initialValue)}return n},Z=(t,e,n)=>{e=X(e),U(e)?t.style.setProperty(e,n):t.style[e]=n};function _(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function H(t,e,r,l={}){let c,{duration:u=n.duration,delay:h=n.delay,endDelay:d=n.endDelay,repeat:m=n.repeat,easing:p=n.easing,direction:y,offset:g,allowWebkitAcceleration:v=!1}=l;const b=T(t);let w=K.waapi();const S=$(e);S&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=T(t);var a,i;i=e,-1===(a=n).indexOf(i)&&a.push(i),t.style.transform=q(n)})(t,e);const x=X(e),k=P.get(x);return _(b.animations[x]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=Y(t,x))&&void 0!==e?e:null==k?void 0:k.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(N(r),e);if(i(p)){const t=p.createAnimation(n,e,S,x,b);p=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(u=t.duration)}if(U(x)&&(K.cssRegisterProperty()?function(t){if(!W.has(t)){W.add(t);try{const{syntax:e,initialValue:n}=P.has(t)?P.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(x):w=!1),w){k&&(n=n.map((t=>a(t)?k.toDefaultUnit(t):t))),K.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:f(h),duration:f(u),endDelay:f(d),easing:s(p)?void 0:B(p),direction:y,iterations:m+1,fill:"both"};c=t.animate({[x]:n,offset:g,easing:s(p)?p.map(B):void 0},i),c.finished||(c.finished=new Promise(((t,e)=>{c.onfinish=t,c.oncancel=e})));const r=n[n.length-1];c.finished.then((()=>{Z(t,x,r),c.cancel()})).catch(o),v||(c.playbackRate=1.000001)}else if(S&&n.every(a)){1===n.length&&n.unshift(parseFloat(e()));c=new O((e=>{k&&(e=k.toDefaultUnit(e)),Z(t,x,e)}),n,Object.assign(Object.assign({},l),{duration:u,easing:p}))}else{const e=n[n.length-1];Z(t,x,k&&a(e)?k.toDefaultUnit(e):e)}return b.animations[x]=c,null==c||c.finished.then((()=>{b.animations[x]=void 0,b.generators[x]=void 0,b.prevGeneratorState[x]=void 0})).catch(o),c}}const J=t=>t(),L=t=>t.animations[0],Q={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let i=(null===(n=L(t))||void 0===n?void 0:n[e])||0;return i?i/1e3:0;case"playbackRate":return null===(a=L(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(tt)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach(_);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=f(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},tt=t=>t.finished,et=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function nt(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}function at(t,e,n,i){var s;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(s=i.get(e))&&void 0!==s?s:t}function it(t,n,a,i,s,o){!function(t,n,a){for(let i=0;i<t.length;i++){const s=t[i];s.at>n&&s.at<a&&(e(t,s),i--)}}(t,s,o);for(let e=0;e<n.length;e++)t.push({value:n[e],at:r(s,o,i[e]),easing:b(a,e)})}function st(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function rt(t,e={}){var a;const i=ot(t,e),s=i.map((t=>H(...t))).filter(Boolean);return((t,e=n.duration)=>new Proxy({animations:t.map(J).filter(Boolean),duration:e},Q))(s,null===(a=i[0])||void 0===a?void 0:a[3].duration)}function ot(e,a={}){var{defaultOptions:s={}}=a,r=function(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(t);i<a.length;i++)e.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(n[a[i]]=t[a[i]])}return n}(a,["defaultOptions"]);const o=[],l=new Map,f={},d=new Map;let m=0,p=0,y=0;for(let a=0;a<e.length;a++){const[r,o,c={}]=e[a];void 0!==c.at&&(p=at(p,c.at,m,d));let g=0;const v=nt(r,f),b=v.length;for(let e=0;e<b;e++){const a=lt(v[e],l);for(const r in o){const l=ct(r,a);let f=N(o[r]);const d=et(c,r);let{duration:m=s.duration||n.duration,easing:v=s.easing||n.easing}=d;if(i(v)){const e=$(r);t(2===f.length||!e,"spring must be provided 2 keyframes within timeline");const n=v.createAnimation(f,(()=>"0"),e);v=n.easing,void 0!==n.keyframes&&(f=n.keyframes),void 0!==n.duration&&(m=n.duration)}const w=S(c.delay,e,b)||0,O=p+w,x=O+m;let{offset:T=h(f.length)}=d;1===T.length&&0===T[0]&&(T[1]=1);const k=length-f.length;k>0&&u(T,k),1===f.length&&f.unshift(null),it(l,f,v,T,O,x),g=Math.max(w+m,g),y=Math.max(x,y)}}m=p,p+=g}return l.forEach(((t,e)=>{for(const a in t){const i=t[a];i.sort(st);const l=[],u=[],h=[];for(let t=0;t<i.length;t++){const{at:e,value:a,easing:s}=i[t];l.push(a),u.push(c(0,y,e)),h.push(s||n.easing)}0!==u[0]&&(u.unshift(0),l.unshift(l[0]),h.unshift("linear")),1!==u[u.length-1]&&(u.push(1),l.push(null)),o.push([e,a,l,Object.assign(Object.assign(Object.assign({},s),{duration:y,easing:h,offset:u}),r)])}})),o}function lt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ct(t,e){return e[t]||(e[t]=[]),e[t]}export{ot as createAnimationsFromTimeline,rt as timeline}; |
@@ -1,1 +0,1 @@ | ||
var t={d:(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{j:()=>J});const n=new WeakMap;function a(t){return n.has(t)||n.set(t,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),n.get(t)}const i=()=>{},r=t=>t,s=["","X","Y","Z"],o={x:"translateX",y:"translateY",z:"translateZ"},l={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},c={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:l,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:l},u=new Map,h=t=>`--motion-${t}`,f=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{s.forEach((e=>{f.push(t+e),u.set(h(t+e),c[t])}))}));const d=(t,e)=>f.indexOf(t)-f.indexOf(e),m=new Set(f),p=t=>m.has(t),y=(t,e)=>`${t} ${e}(var(${h(e)}))`,g=t=>t.startsWith("--"),v=new Set,S={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},b=t=>"number"==typeof t,w=t=>"object"==typeof t&&Boolean(t.createAnimation),T=t=>Array.isArray(t)&&!b(t[0]),x=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function k(t,e,n,a){if(t===e&&n===a)return r;return i=>0===i||1===i?i:x(function(t,e,n,a,i){let r,s,o=0;do{s=e+(n-e)/2,r=x(s,a,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(i,0,1,t,n),e,a)}const A={ease:k(.25,.1,.25,1),"ease-in":k(.42,0,1,1),"ease-in-out":k(.42,0,.58,1),"ease-out":k(0,0,.58,1)},O=/\((.*?)\)/;function j(t){if("function"==typeof t)return t;if(Array.isArray(t))return k(...t);if(A[t])return A[t];if(t.startsWith("steps")){const e=O.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t;return i=("end"===e?Math.floor(a):Math.ceil(a))/t,Math.min(Math.max(i,0),1);var i})(parseFloat(t[0]),t[1].trim())}}return r}const M=(t,e,n)=>-n*t+n*e+t,P=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function D(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=P(0,e,a);t.push(M(n,1,i))}}class V{constructor(t,e=[0,1],{easing:n=S.easing,duration:a=S.duration,delay:i=S.delay,endDelay:s=S.endDelay,repeat:o=S.repeat,offset:l,direction:c="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const u=a*(o+1);w(n)&&(n="ease");const h=function(t,e=function(t){const e=[0];return D(e,t-1),e}(t.length),n=r){const a=t.length,i=a-e.length;return i>0&&D(e,i),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let s=(o=P(e[r],e[r+1],i),Math.min(1,Math.max(o,0)));var o;const l=function(t,e){return T(t)?t[((t,e,n)=>{const a=e-0;return((n-0)%a+a)%a+0})(0,t.length,e)]:t}(n,r);return s=l(s),M(t[r],t[r+1],s)}}(e,l,T(n)?n.map(j):j(n));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let r=(e-this.startTime)*this.rate;this.t=r,r/=1e3,r=Math.max(r-i,0),"finished"===this.playState&&(r=u);const o=r/a;let l=Math.floor(o),f=o%1;!f&&o>=1&&(f=1),1===f&&l--;const d=l%2;("reverse"===c||"alternate"===c&&d||"alternate-reverse"===c&&!d)&&(f=1-f);const m=h(r>=u?1:Math.min(f,1));t(m),"finished"===this.playState||r>=u+s?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,m)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const $=t=>1e3*t,E=t=>(t=>Array.isArray(t)&&b(t[0]))(t)?R(t):t,R=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,U=t=>document.createElement("div").animate(t,{duration:.001}),C={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{U({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(U({opacity:[0,1]}).finished)},F={},W={};for(const t in C)W[t]=()=>(void 0===F[t]&&(F[t]=C[t]()),F[t]);function q(t){return o[t]&&(t=o[t]),p(t)?h(t):t}const z=(t,e,n)=>{e=q(e),g(e)?t.style.setProperty(e,n):t.style[e]=n};function B(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function G(t,e,n,r={}){let s,{duration:l=S.duration,delay:c=S.delay,endDelay:h=S.endDelay,repeat:f=S.repeat,easing:m=S.easing,direction:x,offset:k,allowWebkitAcceleration:A=!1}=r;const O=a(t);let j=W.waapi();const M=p(e);M&&((t,e)=>{o[e]&&(e=o[e]);const{transforms:n}=a(t);var i,r;r=e,-1===(i=n).indexOf(r)&&i.push(r),t.style.transform=(t=>t.sort(d).reduce(y,"").trim())(n)})(t,e);const P=q(e),D=u.get(P);return B(O.animations[P]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=((t,e)=>{e=q(e);let n=g(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=u.get(e);t&&(n=t.initialValue)}return n})(t,P))&&void 0!==e?e:null==D?void 0:D.initialValue)&&void 0!==n?n:0};let a=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}((t=>Array.isArray(t)?t:[t])(n),e);if(w(m)){const t=m.createAnimation(a,e,M,P,O);m=t.easing,void 0!==t.keyframes&&(a=t.keyframes),void 0!==t.duration&&(l=t.duration)}if(g(P)&&(W.cssRegisterProperty()?function(t){if(!v.has(t)){v.add(t);try{const{syntax:e,initialValue:n}=u.has(t)?u.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):j=!1),j){D&&(a=a.map((t=>b(t)?D.toDefaultUnit(t):t))),W.partialKeyframes()||1!==a.length||a.unshift(e());const n={delay:$(c),duration:$(l),endDelay:$(h),easing:T(m)?void 0:E(m),direction:x,iterations:f+1,fill:"both"};s=t.animate({[P]:a,offset:k,easing:T(m)?m.map(E):void 0},n),s.finished||(s.finished=new Promise(((t,e)=>{s.onfinish=t,s.oncancel=e})));const r=a[a.length-1];s.finished.then((()=>{z(t,P,r),s.cancel()})).catch(i),A||(s.playbackRate=1.000001)}else if(M&&a.every(b))1===a.length&&a.unshift(parseFloat(e())),s=new V((e=>{D&&(e=D.toDefaultUnit(e)),z(t,P,e)}),a,Object.assign(Object.assign({},r),{duration:l,easing:m}));else{const e=a[a.length-1];z(t,P,D&&b(e)?D.toDefaultUnit(e):e)}return O.animations[P]=s,null==s||s.finished.then((()=>{O.animations[P]=void 0,O.generators[P]=void 0,O.prevGeneratorState[P]=void 0})).catch(i),s}}const K=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t),X=t=>t(),Y=t=>t.animations[0],Z={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(n=Y(t))||void 0===n?void 0:n[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=Y(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(H)).catch(i)),t.finished;case"stop":return()=>t.animations.forEach(B);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=$(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},H=t=>t.finished;function I(t,e,n){return"function"==typeof t?t(e,n):t}function J(t,e,n={}){const a=(t=function(t,e){return"string"==typeof t?t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length,i=[];for(let r=0;r<a;r++){const s=t[r];for(const t in e){const o=K(n,t);o.delay=I(o.delay,r,a);const l=G(s,t,e[t],o);i.push(l)}}return((t,e=S.duration)=>new Proxy({animations:t.map(X).filter(Boolean),duration:e},Z))(i,n.duration)}var L=e.j;export{L as animate}; | ||
var t={d:(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{j:()=>J});const n=new WeakMap;function a(t){return n.has(t)||n.set(t,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),n.get(t)}const i=()=>{},r=t=>t,s=["","X","Y","Z"],o={x:"translateX",y:"translateY",z:"translateZ"},l={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},c={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:l,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:l},u=new Map,h=t=>`--motion-${t}`,f=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{s.forEach((e=>{f.push(t+e),u.set(h(t+e),c[t])}))}));const m=(t,e)=>f.indexOf(t)-f.indexOf(e),d=new Set(f),p=t=>d.has(t),y=(t,e)=>`${t} ${e}(var(${h(e)}))`,g=t=>t.startsWith("--"),v=new Set,T={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},w=t=>"number"==typeof t,S=t=>"object"==typeof t&&Boolean(t.createAnimation),b=t=>Array.isArray(t)&&!w(t[0]),x=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function k(t,e,n,a){if(t===e&&n===a)return r;return i=>0===i||1===i?i:x(function(t,e,n,a,i){let r,s,o=0;do{s=e+(n-e)/2,r=x(s,a,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(i,0,1,t,n),e,a)}const A={ease:k(.25,.1,.25,1),"ease-in":k(.42,0,1,1),"ease-in-out":k(.42,0,.58,1),"ease-out":k(0,0,.58,1)},O=/\((.*?)\)/;function j(t){if("function"==typeof t)return t;if(Array.isArray(t))return k(...t);if(A[t])return A[t];if(t.startsWith("steps")){const e=O.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t;return i=("end"===e?Math.floor(a):Math.ceil(a))/t,Math.min(Math.max(i,0),1);var i})(parseFloat(t[0]),t[1].trim())}}return r}const M=(t,e,n)=>-n*t+n*e+t,P=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function D(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=P(0,e,a);t.push(M(n,1,i))}}class R{constructor(t,e=[0,1],{easing:n=T.easing,duration:a=T.duration,delay:i=T.delay,endDelay:s=T.endDelay,repeat:o=T.repeat,offset:l,direction:c="normal"}={}){this.startTime=0,this.rate=1,this.t=0,this.cancelTimestamp=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const u=a*(o+1);S(n)&&(n="ease");const h=function(t,e=function(t){const e=[0];return D(e,t-1),e}(t.length),n=r){const a=t.length,i=a-e.length;return i>0&&D(e,i),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let s=(o=P(e[r],e[r+1],i),Math.min(1,Math.max(o,0)));var o;const l=function(t,e){return b(t)?t[((t,e,n)=>{const a=e-0;return((n-0)%a+a)%a+0})(0,t.length,e)]:t}(n,r);return s=l(s),M(t[r],t[r+1],s)}}(e,l,b(n)?n.map(j):j(n));this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let r=(e-this.startTime)*this.rate;console.log(e,this.startTime,r),this.t=r,r/=1e3,r=Math.max(r-i,0),"finished"===this.playState&&(r=u);const o=r/a;let l=Math.floor(o),f=o%1;!f&&o>=1&&(f=1),1===f&&l--;const m=l%2;("reverse"===c||"alternate"===c&&m||"alternate-reverse"===c&&!m)&&(f=1-f);const d=h(r>=u?1:Math.min(f,1));t(d),"finished"===this.playState||r>=u+s?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){var t;this.playState="idle",console.log("cancelling with timestamp ",this.cancelTimestamp),this.tick(this.cancelTimestamp),null===(t=this.reject)||void 0===t||t.call(this,!1),void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId)}reverse(){this.rate*=-1}commitStyles(){this.cancelTimestamp=performance.now()}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const V=t=>1e3*t,$=t=>(t=>Array.isArray(t)&&w(t[0]))(t)?E(t):t,E=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,q=t=>document.createElement("div").animate(t,{duration:.001}),U={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{q({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(q({opacity:[0,1]}).finished)},F={},C={};for(const t in U)C[t]=()=>(void 0===F[t]&&(F[t]=U[t]()),F[t]);function W(t){return o[t]&&(t=o[t]),p(t)?h(t):t}const z=(t,e,n)=>{e=W(e),g(e)?t.style.setProperty(e,n):t.style[e]=n};function B(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function I(t,e,n,r={}){let s,{duration:l=T.duration,delay:c=T.delay,endDelay:h=T.endDelay,repeat:f=T.repeat,easing:d=T.easing,direction:x,offset:k,allowWebkitAcceleration:A=!1}=r;const O=a(t);let j=C.waapi();const M=p(e);M&&((t,e)=>{o[e]&&(e=o[e]);const{transforms:n}=a(t);var i,r;r=e,-1===(i=n).indexOf(r)&&i.push(r),t.style.transform=(t=>t.sort(m).reduce(y,"").trim())(n)})(t,e);const P=W(e),D=u.get(P);return B(O.animations[P]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=((t,e)=>{e=W(e);let n=g(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=u.get(e);t&&(n=t.initialValue)}return n})(t,P))&&void 0!==e?e:null==D?void 0:D.initialValue)&&void 0!==n?n:0};let a=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}((t=>Array.isArray(t)?t:[t])(n),e);if(S(d)){const t=d.createAnimation(a,e,M,P,O);d=t.easing,void 0!==t.keyframes&&(a=t.keyframes),void 0!==t.duration&&(l=t.duration)}if(g(P)&&(C.cssRegisterProperty()?function(t){if(!v.has(t)){v.add(t);try{const{syntax:e,initialValue:n}=u.has(t)?u.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):j=!1),j){D&&(a=a.map((t=>w(t)?D.toDefaultUnit(t):t))),C.partialKeyframes()||1!==a.length||a.unshift(e());const n={delay:V(c),duration:V(l),endDelay:V(h),easing:b(d)?void 0:$(d),direction:x,iterations:f+1,fill:"both"};s=t.animate({[P]:a,offset:k,easing:b(d)?d.map($):void 0},n),s.finished||(s.finished=new Promise(((t,e)=>{s.onfinish=t,s.oncancel=e})));const r=a[a.length-1];s.finished.then((()=>{z(t,P,r),s.cancel()})).catch(i),A||(s.playbackRate=1.000001)}else if(M&&a.every(w))1===a.length&&a.unshift(parseFloat(e())),s=new R((e=>{D&&(e=D.toDefaultUnit(e)),z(t,P,e)}),a,Object.assign(Object.assign({},r),{duration:l,easing:d}));else{const e=a[a.length-1];z(t,P,D&&w(e)?D.toDefaultUnit(e):e)}return O.animations[P]=s,null==s||s.finished.then((()=>{O.animations[P]=void 0,O.generators[P]=void 0,O.prevGeneratorState[P]=void 0})).catch(i),s}}const G=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t),K=t=>t(),X=t=>t.animations[0],Y={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(n=X(t))||void 0===n?void 0:n[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=X(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(Z)).catch(i)),t.finished;case"stop":return()=>t.animations.forEach(B);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=V(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},Z=t=>t.finished;function H(t,e,n){return"function"==typeof t?t(e,n):t}function J(t,e,n={}){const a=(t=function(t,e){return"string"==typeof t?t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length,i=[];for(let r=0;r<a;r++){const s=t[r];for(const t in e){const o=G(n,t);o.delay=H(o.delay,r,a);const l=I(s,t,e[t],o);i.push(l)}}return((t,e=T.duration)=>new Proxy({animations:t.map(K).filter(Boolean),duration:e},Y))(i,n.duration)}var L=e.j;export{L as animate}; |
{ | ||
"name": "@motionone/dom", | ||
"version": "10.6.0-rc.1", | ||
"version": "10.6.0-rc.3", | ||
"description": "A tiny, performant animation library for the DOM", | ||
@@ -18,7 +18,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@motionone/animation": "^10.6.0-rc.1", | ||
"@motionone/easing": "^10.6.0-rc.1", | ||
"@motionone/generators": "^10.6.0-rc.1", | ||
"@motionone/types": "^10.6.0-rc.1", | ||
"@motionone/utils": "^10.6.0-rc.1", | ||
"@motionone/animation": "^10.6.0-rc.3", | ||
"@motionone/easing": "^10.6.0-rc.3", | ||
"@motionone/generators": "^10.6.0-rc.3", | ||
"@motionone/types": "^10.6.0-rc.3", | ||
"@motionone/utils": "^10.6.0-rc.3", | ||
"hey-listen": "^1.0.8", | ||
@@ -38,3 +38,3 @@ "tslib": "^2.3.1" | ||
"path": "./dist/size-animate-style.js", | ||
"maxSize": "2.9 kB" | ||
"maxSize": "3 kB" | ||
}, | ||
@@ -51,6 +51,6 @@ { | ||
"path": "./dist/size-webpack-animate.js", | ||
"maxSize": "3.4 kB" | ||
"maxSize": "3.45 kB" | ||
} | ||
], | ||
"gitHead": "9c905aa4610011855bfd7827758f9c43f4929c0c" | ||
"gitHead": "c9135fae71260b5057ea6875eb103451894f3385" | ||
} |
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
262738
4117