@motionone/dom
Advanced tools
Comparing version 10.6.2 to 10.7.0
@@ -17,3 +17,8 @@ 'use strict'; | ||
function getDevToolsRecord() { | ||
return window.__MOTION_DEV_TOOLS_RECORD; | ||
} | ||
function animateStyle(element, key, keyframesDefinition, options = {}) { | ||
const record = getDevToolsRecord(); | ||
const isRecording = options.record !== false && record; | ||
let animation$1; | ||
@@ -42,3 +47,4 @@ let { duration = utils.defaults.duration, delay = utils.defaults.delay, endDelay = utils.defaults.endDelay, repeat = utils.defaults.repeat, easing: easing$1 = utils.defaults.easing, direction, offset, allowWebkitAcceleration = false, } = options; | ||
*/ | ||
stopAnimation.stopAnimation(motionValue.animation, !(utils.isEasingGenerator(easing$1) && motionValue.generator)); | ||
stopAnimation.stopAnimation(motionValue.animation, !(utils.isEasingGenerator(easing$1) && motionValue.generator) && | ||
options.record !== false); | ||
/** | ||
@@ -91,3 +97,4 @@ * Batchable factory function containing all DOM reads. | ||
*/ | ||
if (!featureDetection.supports.partialKeyframes() && keyframes$1.length === 1) { | ||
const needsToReadInitialKeyframe = !featureDetection.supports.partialKeyframes() && keyframes$1.length === 1; | ||
if (isRecording || needsToReadInitialKeyframe) { | ||
keyframes$1.unshift(readInitialValue()); | ||
@@ -165,2 +172,11 @@ } | ||
} | ||
if (isRecording) { | ||
record(element, key, keyframes$1, { | ||
duration, | ||
delay, | ||
easing: easing$1, | ||
repeat, | ||
offset, | ||
}, "motion-one"); | ||
} | ||
motionValue.setAnimation(animation$1); | ||
@@ -167,0 +183,0 @@ return animation$1; |
@@ -13,3 +13,8 @@ import { getAnimationData, getMotionValue } from './data.es.js'; | ||
function getDevToolsRecord() { | ||
return window.__MOTION_DEV_TOOLS_RECORD; | ||
} | ||
function animateStyle(element, key, keyframesDefinition, options = {}) { | ||
const record = getDevToolsRecord(); | ||
const isRecording = options.record !== false && record; | ||
let animation; | ||
@@ -38,3 +43,4 @@ let { duration = defaults.duration, delay = defaults.delay, endDelay = defaults.endDelay, repeat = defaults.repeat, easing = defaults.easing, direction, offset, allowWebkitAcceleration = false, } = options; | ||
*/ | ||
stopAnimation(motionValue.animation, !(isEasingGenerator(easing) && motionValue.generator)); | ||
stopAnimation(motionValue.animation, !(isEasingGenerator(easing) && motionValue.generator) && | ||
options.record !== false); | ||
/** | ||
@@ -87,3 +93,4 @@ * Batchable factory function containing all DOM reads. | ||
*/ | ||
if (!supports.partialKeyframes() && keyframes.length === 1) { | ||
const needsToReadInitialKeyframe = !supports.partialKeyframes() && keyframes.length === 1; | ||
if (isRecording || needsToReadInitialKeyframe) { | ||
keyframes.unshift(readInitialValue()); | ||
@@ -161,2 +168,11 @@ } | ||
} | ||
if (isRecording) { | ||
record(element, key, keyframes, { | ||
duration, | ||
delay, | ||
easing, | ||
repeat, | ||
offset, | ||
}, "motion-one"); | ||
} | ||
motionValue.setAnimation(animation); | ||
@@ -163,0 +179,0 @@ return animation; |
@@ -1,1 +0,1 @@ | ||
class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function i(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}const a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},n=t=>"number"==typeof t,s=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!n(t[0]),o=(t,e,i)=>-i*t+i*e+t,l=()=>{},c=t=>t,h=(t,e,i)=>e-t==0?1:(i-t)/(e-t);function u(t,e){const i=t[t.length-1];for(let a=1;a<=e;a++){const n=h(0,e,a);t.push(o(i,1,n))}}const f=t=>1e3*t,m=["","X","Y","Z"],d={x:"translateX",y:"translateY",z:"translateZ"},p={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},y={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:p,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:p},g=new Map,v=t=>`--motion-${t}`,S=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{m.forEach((e=>{S.push(t+e),g.set(v(t+e),y[t])}))}));const T=(t,e)=>S.indexOf(t)-S.indexOf(e),w=new Set(S),A=t=>w.has(t),x=t=>t.sort(T).reduce(k,"").trim(),k=(t,e)=>`${t} ${e}(var(${v(e)}))`,b=t=>t.startsWith("--"),M=new Set;const D=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function P(t,e,i,a){if(t===e&&i===a)return c;const n=e=>function(t,e,i,a,n){let s,r,o=0;do{r=e+(i-e)/2,s=D(r,a,n)-t,s>0?i=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:D(n(t),e,a)}const O=(t,e="end")=>i=>{const a=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,n="end"===e?Math.floor(a):Math.ceil(a);return s=0,r=1,o=n/t,Math.min(Math.max(o,s),r);var s,r,o},R={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)},V=/\((.*?)\)/;function $(t){if("function"==typeof t)return t;if(Array.isArray(t))return P(...t);if(R[t])return R[t];if(t.startsWith("steps")){const e=V.exec(t);if(e){const t=e[1].split(",");return O(parseFloat(t[0]),t[1].trim())}}return c}function j(t,e=function(t){const e=[0];return u(e,t-1),e}(t.length),i=c){const a=t.length,n=a-e.length;return n>0&&u(e,n),n=>{let s=0;for(;s<a-2&&!(n<e[s+1]);s++);let l=(c=h(e[s],e[s+1],n),Math.min(1,Math.max(c,0)));var c;const u=function(t,e){return r(t)?t[((t,e,i)=>{const a=e-t;return((i-t)%a+a)%a+t})(0,t.length,e)]:t}(i,s);return l=u(l),o(t[s],t[s+1],l)}}class U{constructor(t,e=[0,1],{easing:i=a.easing,duration:n=a.duration,delay:o=a.delay,endDelay:l=a.endDelay,repeat:c=a.repeat,offset:h,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),s(i)){const t=i.createAnimation(e,(()=>"0"),!0);i=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(n=t.duration)}const f=n*(c+1),m=j(e,h,r(i)?i.map($):$(i));this.tick=e=>{var i;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 s=a/n;let r=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&r--;const h=r%2;("reverse"===u||"alternate"===u&&h||"alternate-reverse"===u&&!h)&&(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===(i=this.resolve)||void 0===i||i.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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)&&n(t[0]))(t)?F(t):t,F=([t,e,i,a])=>`cubic-bezier(${t}, ${e}, ${i}, ${a})`,C=t=>document.createElement("div").animate(t,{duration:.001}),E={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{C({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(C({opacity:[0,1]}).finished)},W={},z={};for(const t in E)z[t]=()=>(void 0===W[t]&&(W[t]=E[t]()),W[t]);function I(t){return d[t]&&(t=d[t]),A(t)?v(t):t}const B=(t,e)=>{e=I(e);let i=b(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!i&&0!==i){const t=g.get(e);t&&(i=t.initialValue)}return i},K=(t,e,i)=>{e=I(e),b(e)?t.style.setProperty(e,i):t.style[e]=i};function X(e,o,c,h={}){let u,{duration:m=a.duration,delay:p=a.delay,endDelay:y=a.endDelay,repeat:v=a.repeat,easing:S=a.easing,direction:T,offset:w,allowWebkitAcceleration:k=!1}=h;const D=i(e);let P=z.waapi();const O=A(o);O&&((t,e)=>{d[e]&&(e=d[e]);const{transforms:a}=i(t);var n,s;s=e,-1===(n=a).indexOf(s)&&n.push(s),t.style.transform=x(a)})(e,o);const R=I(o),V=function(e,i){return e.has(i)||e.set(i,new t),e.get(i)}(D.values,R),$=g.get(R);return function(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}(V.animation,!(s(S)&&V.generator)),()=>{const t=()=>{var t,i;return null!==(i=null!==(t=B(e,R))&&void 0!==t?t:null==$?void 0:$.initialValue)&&void 0!==i?i:0};let i=function(t,e){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:e());return t}((t=>Array.isArray(t)?t:[t])(c),t);if(s(S)){const e=S.createAnimation(i,t,O,R,V);S=e.easing,void 0!==e.keyframes&&(i=e.keyframes),void 0!==e.duration&&(m=e.duration)}if(b(R)&&(z.cssRegisterProperty()?function(t){if(!M.has(t)){M.add(t);try{const{syntax:e,initialValue:i}=g.has(t)?g.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:i})}catch(t){}}}(R):P=!1),P){$&&(i=i.map((t=>n(t)?$.toDefaultUnit(t):t))),z.partialKeyframes()||1!==i.length||i.unshift(t());const a={delay:f(p),duration:f(m),endDelay:f(y),easing:r(S)?void 0:q(S),direction:T,iterations:v+1,fill:"both"};u=e.animate({[R]:i,offset:w,easing:r(S)?S.map(q):void 0},a),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const s=i[i.length-1];u.finished.then((()=>{K(e,R,s),u.cancel()})).catch(l),k||(u.playbackRate=1.000001)}else if(O&&i.every(n)){1===i.length&&i.unshift(parseFloat(t()));u=new U((t=>{$&&(t=$.toDefaultUnit(t)),K(e,R,t)}),i,Object.assign(Object.assign({},h),{duration:m,easing:S}))}else{const t=i[i.length-1];K(e,R,$&&n(t)?$.toDefaultUnit(t):t)}return V.setAnimation(u),u}}export{X as animateStyle}; | ||
class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function i(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}const a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},n=t=>"number"==typeof t,s=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!n(t[0]),o=(t,e,i)=>-i*t+i*e+t,l=()=>{},c=t=>t,h=(t,e,i)=>e-t==0?1:(i-t)/(e-t);function u(t,e){const i=t[t.length-1];for(let a=1;a<=e;a++){const n=h(0,e,a);t.push(o(i,1,n))}}const f=t=>1e3*t,m=["","X","Y","Z"],d={x:"translateX",y:"translateY",z:"translateZ"},p={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},y={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:p,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:p},g=new Map,v=t=>`--motion-${t}`,T=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{m.forEach((e=>{T.push(t+e),g.set(v(t+e),y[t])}))}));const w=(t,e)=>T.indexOf(t)-T.indexOf(e),S=new Set(T),A=t=>S.has(t),x=t=>t.sort(w).reduce(k,"").trim(),k=(t,e)=>`${t} ${e}(var(${v(e)}))`,M=t=>t.startsWith("--"),b=new Set;const D=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function O(t,e,i,a){if(t===e&&i===a)return c;const n=e=>function(t,e,i,a,n){let s,r,o=0;do{r=e+(i-e)/2,s=D(r,a,n)-t,s>0?i=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:D(n(t),e,a)}const P=(t,e="end")=>i=>{const a=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,n="end"===e?Math.floor(a):Math.ceil(a);return s=0,r=1,o=n/t,Math.min(Math.max(o,s),r);var s,r,o},R={ease:O(.25,.1,.25,1),"ease-in":O(.42,0,1,1),"ease-in-out":O(.42,0,.58,1),"ease-out":O(0,0,.58,1)},V=/\((.*?)\)/;function $(t){if("function"==typeof t)return t;if(Array.isArray(t))return O(...t);if(R[t])return R[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 c}function j(t,e=function(t){const e=[0];return u(e,t-1),e}(t.length),i=c){const a=t.length,n=a-e.length;return n>0&&u(e,n),n=>{let s=0;for(;s<a-2&&!(n<e[s+1]);s++);let l=(c=h(e[s],e[s+1],n),Math.min(1,Math.max(c,0)));var c;const u=function(t,e){return r(t)?t[((t,e,i)=>{const a=e-t;return((i-t)%a+a)%a+t})(0,t.length,e)]:t}(i,s);return l=u(l),o(t[s],t[s+1],l)}}class E{constructor(t,e=[0,1],{easing:i=a.easing,duration:n=a.duration,delay:o=a.delay,endDelay:l=a.endDelay,repeat:c=a.repeat,offset:h,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),s(i)){const t=i.createAnimation(e,(()=>"0"),!0);i=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(n=t.duration)}const f=n*(c+1),m=j(e,h,r(i)?i.map($):$(i));this.tick=e=>{var i;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 s=a/n;let r=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&r--;const h=r%2;("reverse"===u||"alternate"===u&&h||"alternate-reverse"===u&&!h)&&(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===(i=this.resolve)||void 0===i||i.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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)&&n(t[0]))(t)?q(t):t,q=([t,e,i,a])=>`cubic-bezier(${t}, ${e}, ${i}, ${a})`,C=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{C({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(C({opacity:[0,1]}).finished)},_={},I={};for(const t in F)I[t]=()=>(void 0===_[t]&&(_[t]=F[t]()),_[t]);function W(t){return d[t]&&(t=d[t]),A(t)?v(t):t}const z=(t,e)=>{e=W(e);let i=M(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!i&&0!==i){const t=g.get(e);t&&(i=t.initialValue)}return i},B=(t,e,i)=>{e=W(e),M(e)?t.style.setProperty(e,i):t.style[e]=i};function K(e,o,c,h={}){const u=window.__MOTION_DEV_TOOLS_RECORD,m=!1!==h.record&&u;let p,{duration:y=a.duration,delay:v=a.delay,endDelay:T=a.endDelay,repeat:w=a.repeat,easing:S=a.easing,direction:k,offset:D,allowWebkitAcceleration:O=!1}=h;const P=i(e);let R=I.waapi();const V=A(o);V&&((t,e)=>{d[e]&&(e=d[e]);const{transforms:a}=i(t);var n,s;s=e,-1===(n=a).indexOf(s)&&n.push(s),t.style.transform=x(a)})(e,o);const $=W(o),j=function(e,i){return e.has(i)||e.set(i,new t),e.get(i)}(P.values,$),q=g.get($);return function(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}(j.animation,!(s(S)&&j.generator)&&!1!==h.record),()=>{const t=()=>{var t,i;return null!==(i=null!==(t=z(e,$))&&void 0!==t?t:null==q?void 0:q.initialValue)&&void 0!==i?i:0};let i=function(t,e){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:e());return t}((t=>Array.isArray(t)?t:[t])(c),t);if(s(S)){const e=S.createAnimation(i,t,V,$,j);S=e.easing,void 0!==e.keyframes&&(i=e.keyframes),void 0!==e.duration&&(y=e.duration)}if(M($)&&(I.cssRegisterProperty()?function(t){if(!b.has(t)){b.add(t);try{const{syntax:e,initialValue:i}=g.has(t)?g.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:i})}catch(t){}}}($):R=!1),R){q&&(i=i.map((t=>n(t)?q.toDefaultUnit(t):t)));const a=!I.partialKeyframes()&&1===i.length;(m||a)&&i.unshift(t());const s={delay:f(v),duration:f(y),endDelay:f(T),easing:r(S)?void 0:U(S),direction:k,iterations:w+1,fill:"both"};p=e.animate({[$]:i,offset:D,easing:r(S)?S.map(U):void 0},s),p.finished||(p.finished=new Promise(((t,e)=>{p.onfinish=t,p.oncancel=e})));const o=i[i.length-1];p.finished.then((()=>{B(e,$,o),p.cancel()})).catch(l),O||(p.playbackRate=1.000001)}else if(V&&i.every(n)){1===i.length&&i.unshift(parseFloat(t()));p=new E((t=>{q&&(t=q.toDefaultUnit(t)),B(e,$,t)}),i,Object.assign(Object.assign({},h),{duration:y,easing:S}))}else{const t=i[i.length-1];B(e,$,q&&n(t)?q.toDefaultUnit(t):t)}return m&&u(e,o,i,{duration:y,delay:v,easing:S,repeat:w,offset:D},"motion-one"),j.setAnimation(p),p}}export{K as animateStyle}; |
@@ -1,1 +0,1 @@ | ||
class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}const i={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,s=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!a(t[0]),o=(t,e,n)=>-n*t+n*e+t,l=()=>{},c=t=>t,u=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function h(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=u(0,e,i);t.push(o(n,1,a))}}const f=t=>1e3*t,m=["","X","Y","Z"],d={x:"translateX",y:"translateY",z:"translateZ"},p={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},y={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:p,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:p},g=new Map,v=t=>`--motion-${t}`,T=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{m.forEach((e=>{T.push(t+e),g.set(v(t+e),y[t])}))}));const w=(t,e)=>T.indexOf(t)-T.indexOf(e),S=new Set(T),A=t=>S.has(t),b=t=>t.sort(w).reduce(x,"").trim(),x=(t,e)=>`${t} ${e}(var(${v(e)}))`,k=t=>t.startsWith("--"),M=new Set;const D=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function O(t,e,n,i){if(t===e&&n===i)return c;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=D(r,i,a)-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(a(t),e,i)}const P=(t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=a/t,Math.min(Math.max(o,s),r);var s,r,o},j={ease:O(.25,.1,.25,1),"ease-in":O(.42,0,1,1),"ease-in-out":O(.42,0,.58,1),"ease-out":O(0,0,.58,1)},R=/\((.*?)\)/;function V(t){if("function"==typeof t)return t;if(Array.isArray(t))return O(...t);if(j[t])return j[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 c}function $(t,e=function(t){const e=[0];return h(e,t-1),e}(t.length),n=c){const i=t.length,a=i-e.length;return a>0&&h(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let l=(c=u(e[s],e[s+1],a),Math.min(1,Math.max(c,0)));var c;const h=function(t,e){return r(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}(n,s);return l=h(l),o(t[s],t[s+1],l)}}class q{constructor(t,e=[0,1],{easing:n=i.easing,duration:a=i.duration,delay:o=i.delay,endDelay:l=i.endDelay,repeat:c=i.repeat,offset:u,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),s(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}const f=a*(c+1),m=$(e,u,r(n)?n.map(V):V(n));this.tick=e=>{var n;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 s=i/a;let r=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&r--;const u=r%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(c=1-c);const d=m(i>=f?1:Math.min(c,1));t(d);"finished"===this.playState||i>=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(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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 E=t=>(t=>Array.isArray(t)&&a(t[0]))(t)?U(t):t,U=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${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)},W={},z={};for(const t in C)z[t]=()=>(void 0===W[t]&&(W[t]=C[t]()),W[t]);function B(t){return d[t]&&(t=d[t]),A(t)?v(t):t}const I=(t,e)=>{e=B(e);let n=k(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=g.get(e);t&&(n=t.initialValue)}return n},K=(t,e,n)=>{e=B(e),k(e)?t.style.setProperty(e,n):t.style[e]=n};function X(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function Y(e,o,c,u={}){let h,{duration:m=i.duration,delay:p=i.delay,endDelay:y=i.endDelay,repeat:v=i.repeat,easing:T=i.easing,direction:w,offset:S,allowWebkitAcceleration:x=!1}=u;const D=n(e);let O=z.waapi();const P=A(o);P&&((t,e)=>{d[e]&&(e=d[e]);const{transforms:i}=n(t);var a,s;s=e,-1===(a=i).indexOf(s)&&a.push(s),t.style.transform=b(i)})(e,o);const j=B(o),R=function(e,n){return e.has(n)||e.set(n,new t),e.get(n)}(D.values,j),V=g.get(j);return X(R.animation,!(s(T)&&R.generator)),()=>{const t=()=>{var t,n;return null!==(n=null!==(t=I(e,j))&&void 0!==t?t:null==V?void 0:V.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])(c),t);if(s(T)){const e=T.createAnimation(n,t,P,j,R);T=e.easing,void 0!==e.keyframes&&(n=e.keyframes),void 0!==e.duration&&(m=e.duration)}if(k(j)&&(z.cssRegisterProperty()?function(t){if(!M.has(t)){M.add(t);try{const{syntax:e,initialValue:n}=g.has(t)?g.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(j):O=!1),O){V&&(n=n.map((t=>a(t)?V.toDefaultUnit(t):t))),z.partialKeyframes()||1!==n.length||n.unshift(t());const i={delay:f(p),duration:f(m),endDelay:f(y),easing:r(T)?void 0:E(T),direction:w,iterations:v+1,fill:"both"};h=e.animate({[j]:n,offset:S,easing:r(T)?T.map(E):void 0},i),h.finished||(h.finished=new Promise(((t,e)=>{h.onfinish=t,h.oncancel=e})));const s=n[n.length-1];h.finished.then((()=>{K(e,j,s),h.cancel()})).catch(l),x||(h.playbackRate=1.000001)}else if(P&&n.every(a)){1===n.length&&n.unshift(parseFloat(t()));h=new q((t=>{V&&(t=V.toDefaultUnit(t)),K(e,j,t)}),n,Object.assign(Object.assign({},u),{duration:m,easing:T}))}else{const t=n[n.length-1];K(e,j,V&&a(t)?V.toDefaultUnit(t):t)}return R.setAnimation(h),h}}const Z=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const G=t=>t(),H=t=>t.animations[0],J={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let a=(null===(n=H(t))||void 0===n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":return null===(i=H(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(L)).catch(l)),t.finished;case"stop":return()=>t.animations.forEach((t=>X(t)));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 i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},L=t=>t.finished;function N(t,e,n){return"function"==typeof t?t(e,n):t}function Q(t,e,n={}){const a=(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 i=0;i<a;i++){const r=t[i];for(const t in e){const o=Z(n,t);o.delay=N(o.delay,i,a);const l=Y(r,t,e[t],o);s.push(l)}}return((t,e=i.duration)=>new Proxy({animations:t.map(G).filter(Boolean),duration:e},J))(s,n.duration)}export{Q as animate}; | ||
class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}const i={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,s=t=>"object"==typeof t&&Boolean(t.createAnimation),r=t=>Array.isArray(t)&&!a(t[0]),o=(t,e,n)=>-n*t+n*e+t,l=()=>{},c=t=>t,u=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function h(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=u(0,e,i);t.push(o(n,1,a))}}const f=t=>1e3*t,d=["","X","Y","Z"],m={x:"translateX",y:"translateY",z:"translateZ"},p={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},y={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:p,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:p},g=new Map,v=t=>`--motion-${t}`,T=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{d.forEach((e=>{T.push(t+e),g.set(v(t+e),y[t])}))}));const w=(t,e)=>T.indexOf(t)-T.indexOf(e),S=new Set(T),A=t=>S.has(t),b=t=>t.sort(w).reduce(x,"").trim(),x=(t,e)=>`${t} ${e}(var(${v(e)}))`,k=t=>t.startsWith("--"),O=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,i){if(t===e&&n===i)return c;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=M(r,i,a)-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(a(t),e,i)}const P=(t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=a/t,Math.min(Math.max(o,s),r);var s,r,o},R={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 E(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(R[t])return R[t];if(t.startsWith("steps")){const e=j.exec(t);if(e){const t=e[1].split(",");return P(parseFloat(t[0]),t[1].trim())}}return c}function V(t,e=function(t){const e=[0];return h(e,t-1),e}(t.length),n=c){const i=t.length,a=i-e.length;return a>0&&h(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let l=(c=u(e[s],e[s+1],a),Math.min(1,Math.max(c,0)));var c;const h=function(t,e){return r(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}(n,s);return l=h(l),o(t[s],t[s+1],l)}}class ${constructor(t,e=[0,1],{easing:n=i.easing,duration:a=i.duration,delay:o=i.delay,endDelay:l=i.endDelay,repeat:c=i.repeat,offset:u,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),s(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}const f=a*(c+1),d=V(e,u,r(n)?n.map(E):E(n));this.tick=e=>{var n;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 s=i/a;let r=Math.floor(s),c=s%1;!c&&s>=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(i>=f?1:Math.min(c,1));t(m);"finished"===this.playState||i>=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(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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)?U(t):t,U=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,C=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{C({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(C({opacity:[0,1]}).finished)},_={},I={};for(const t in F)I[t]=()=>(void 0===_[t]&&(_[t]=F[t]()),_[t]);function W(t){return m[t]&&(t=m[t]),A(t)?v(t):t}const z=(t,e)=>{e=W(e);let n=k(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=g.get(e);t&&(n=t.initialValue)}return n},B=(t,e,n)=>{e=W(e),k(e)?t.style.setProperty(e,n):t.style[e]=n};function K(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function X(e,o,c,u={}){const h=window.__MOTION_DEV_TOOLS_RECORD,d=!1!==u.record&&h;let p,{duration:y=i.duration,delay:v=i.delay,endDelay:T=i.endDelay,repeat:w=i.repeat,easing:S=i.easing,direction:x,offset:M,allowWebkitAcceleration:D=!1}=u;const P=n(e);let R=I.waapi();const j=A(o);j&&((t,e)=>{m[e]&&(e=m[e]);const{transforms:i}=n(t);var a,s;s=e,-1===(a=i).indexOf(s)&&a.push(s),t.style.transform=b(i)})(e,o);const E=W(o),V=function(e,n){return e.has(n)||e.set(n,new t),e.get(n)}(P.values,E),U=g.get(E);return K(V.animation,!(s(S)&&V.generator)&&!1!==u.record),()=>{const t=()=>{var t,n;return null!==(n=null!==(t=z(e,E))&&void 0!==t?t:null==U?void 0:U.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])(c),t);if(s(S)){const e=S.createAnimation(n,t,j,E,V);S=e.easing,void 0!==e.keyframes&&(n=e.keyframes),void 0!==e.duration&&(y=e.duration)}if(k(E)&&(I.cssRegisterProperty()?function(t){if(!O.has(t)){O.add(t);try{const{syntax:e,initialValue:n}=g.has(t)?g.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(E):R=!1),R){U&&(n=n.map((t=>a(t)?U.toDefaultUnit(t):t)));const i=!I.partialKeyframes()&&1===n.length;(d||i)&&n.unshift(t());const s={delay:f(v),duration:f(y),endDelay:f(T),easing:r(S)?void 0:q(S),direction:x,iterations:w+1,fill:"both"};p=e.animate({[E]:n,offset:M,easing:r(S)?S.map(q):void 0},s),p.finished||(p.finished=new Promise(((t,e)=>{p.onfinish=t,p.oncancel=e})));const o=n[n.length-1];p.finished.then((()=>{B(e,E,o),p.cancel()})).catch(l),D||(p.playbackRate=1.000001)}else if(j&&n.every(a)){1===n.length&&n.unshift(parseFloat(t()));p=new $((t=>{U&&(t=U.toDefaultUnit(t)),B(e,E,t)}),n,Object.assign(Object.assign({},u),{duration:y,easing:S}))}else{const t=n[n.length-1];B(e,E,U&&a(t)?U.toDefaultUnit(t):t)}return d&&h(e,o,n,{duration:y,delay:v,easing:S,repeat:w,offset:M},"motion-one"),V.setAnimation(p),p}}const Y=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const Z=t=>t(),L=t=>t.animations[0],N={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let a=(null===(n=L(t))||void 0===n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":return null===(i=L(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(G)).catch(l)),t.finished;case"stop":return()=>t.animations.forEach((t=>K(t)));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 i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},G=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){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 i=0;i<a;i++){const r=t[i];for(const t in e){const o=Y(n,t);o.delay=H(o.delay,i,a);const l=X(r,t,e[t],o);s.push(l)}}return((t,e=i.duration)=>new Proxy({animations:t.map(Z).filter(Boolean),duration:e},N))(s,n.duration)}export{J 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"},i=t=>"number"==typeof t,a=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!i(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 i=1;i<=e;i++){const a=c(0,e,i);t.push(r(n,1,a))}}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,i){if(t===e&&n===i)return l;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=d(r,i,a)-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(a(t),e,i)}const p=(t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=a/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 i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}function w(t,e=h(t.length),n=l){const i=t.length,a=i-e.length;return a>0&&u(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let o=(l=c(e[s],e[s+1],a),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:i=n.easing,duration:r=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),a(i)){const t=i.createAnimation(e,(()=>"0"),!0);i=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(r=t.duration)}const f=r*(c+1),d=w(e,u,s(i)?i.map(v):v(i));this.tick=e=>{var n;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 a=i/r;let s=Math.floor(a),c=a%1;!c&&a>=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(i>=f?1:Math.min(c,1));t(m);"finished"===this.playState||i>=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(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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 x(t,e,n){return"function"==typeof t?t(e,n):t}class S{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const T=new WeakMap;function A(t){return T.has(t)||T.set(t,{transforms:[],values:new Map}),T.get(t)}const k=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},j={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},P={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:j,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:j},D=new Map,E=t=>`--motion-${t}`,R=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{R.push(t+e),D.set(E(t+e),P[t])}))}));const V=(t,e)=>R.indexOf(t)-R.indexOf(e),$=new Set(R),q=t=>$.has(t),F=t=>t.sort(V).reduce(U,"").trim(),U=(t,e)=>`${t} ${e}(var(${E(e)}))`,W=t=>t.startsWith("--"),B=new Set;const C=t=>(t=>Array.isArray(t)&&i(t[0]))(t)?I(t):t,I=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,z=t=>document.createElement("div").animate(t,{duration:.001}),K={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)},N={},X={};for(const t in K)X[t]=()=>(void 0===N[t]&&(N[t]=K[t]()),N[t]);const Y=t=>Array.isArray(t)?t:[t];function Z(t){return M[t]&&(t=M[t]),q(t)?E(t):t}const _=(t,e)=>{e=Z(e);let n=W(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=D.get(e);t&&(n=t.initialValue)}return n},G=(t,e,n)=>{e=Z(e),W(e)?t.style.setProperty(e,n):t.style[e]=n};function H(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function J(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=A(t);let w=X.waapi();const x=q(e);x&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=A(t);var i,a;a=e,-1===(i=n).indexOf(a)&&i.push(a),t.style.transform=F(n)})(t,e);const T=Z(e),k=function(t,e){return t.has(e)||t.set(e,new S),t.get(e)}(b.values,T),j=D.get(T);return H(k.animation,!(a(p)&&k.generator)),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=_(t,T))&&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}(Y(r),e);if(a(p)){const t=p.createAnimation(n,e,x,T,k);p=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(u=t.duration)}if(W(T)&&(X.cssRegisterProperty()?function(t){if(!B.has(t)){B.add(t);try{const{syntax:e,initialValue:n}=D.has(t)?D.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(T):w=!1),w){j&&(n=n.map((t=>i(t)?j.toDefaultUnit(t):t))),X.partialKeyframes()||1!==n.length||n.unshift(e());const a={delay:f(h),duration:f(u),endDelay:f(d),easing:s(p)?void 0:C(p),direction:y,iterations:m+1,fill:"both"};c=t.animate({[T]:n,offset:g,easing:s(p)?p.map(C):void 0},a),c.finished||(c.finished=new Promise(((t,e)=>{c.onfinish=t,c.oncancel=e})));const r=n[n.length-1];c.finished.then((()=>{G(t,T,r),c.cancel()})).catch(o),v||(c.playbackRate=1.000001)}else if(x&&n.every(i)){1===n.length&&n.unshift(parseFloat(e()));c=new O((e=>{j&&(e=j.toDefaultUnit(e)),G(t,T,e)}),n,Object.assign(Object.assign({},l),{duration:u,easing:p}))}else{const e=n[n.length-1];G(t,T,j&&i(e)?j.toDefaultUnit(e):e)}return k.setAnimation(c),c}}const L=t=>t(),Q=t=>t.animations[0],tt={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let a=(null===(n=Q(t))||void 0===n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":return null===(i=Q(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(et)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach((t=>H(t)));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 i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},et=t=>t.finished,nt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function it(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,a){var s;return i(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(s=a.get(e))&&void 0!==s?s:t}function st(t,n,i,a,s,o){!function(t,n,i){for(let a=0;a<t.length;a++){const s=t[a];s.at>n&&s.at<i&&(e(t,s),a--)}}(t,s,o);for(let e=0;e<n.length;e++)t.push({value:n[e],at:r(s,o,a[e]),easing:b(i,e)})}function rt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ot(t,e={}){var i;const a=lt(t,e),s=a.map((t=>J(...t))).filter(Boolean);return((t,e=n.duration)=>new Proxy({animations:t.map(L).filter(Boolean),duration:e},tt))(s,null===(i=a[0])||void 0===i?void 0:i[3].duration)}function lt(e,i={}){var{defaultOptions:s={}}=i,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(n[i[a]]=t[i[a]])}return n}(i,["defaultOptions"]);const o=[],l=new Map,f={},d=new Map;let m=0,p=0,y=0;for(let i=0;i<e.length;i++){const[r,o,c={}]=e[i];void 0!==c.at&&(p=at(p,c.at,m,d));let g=0;const v=it(r,f),b=v.length;for(let e=0;e<b;e++){const i=ct(v[e],l);for(const r in o){const l=ut(r,i);let f=Y(o[r]);const d=nt(c,r);let{duration:m=s.duration||n.duration,easing:v=s.easing||n.easing}=d;if(a(v)){const e=q(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=x(c.delay,e,b)||0,O=p+w,S=O+m;let{offset:T=h(f.length)}=d;1===T.length&&0===T[0]&&(T[1]=1);const A=length-f.length;A>0&&u(T,A),1===f.length&&f.unshift(null),st(l,f,v,T,O,S),g=Math.max(w+m,g),y=Math.max(S,y)}}m=p,p+=g}return l.forEach(((t,e)=>{for(const i in t){const a=t[i];a.sort(rt);const l=[],u=[],h=[];for(let t=0;t<a.length;t++){const{at:e,value:i,easing:s}=a[t];l.push(i),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,i,l,Object.assign(Object.assign(Object.assign({},s),{duration:y,easing:h,offset:u}),r)])}})),o}function ct(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ut(t,e){return e[t]||(e[t]=[]),e[t]}export{lt as createAnimationsFromTimeline,ot 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"},i=t=>"number"==typeof t,a=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!i(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 i=1;i<=e;i++){const a=c(0,e,i);t.push(r(n,1,a))}}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,i){if(t===e&&n===i)return l;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=d(r,i,a)-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(a(t),e,i)}const p=(t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(i):Math.ceil(i);return s=0,r=1,o=a/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 w(t,e){return s(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}function O(t,e=h(t.length),n=l){const i=t.length,a=i-e.length;return a>0&&u(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let o=(l=c(e[s],e[s+1],a),Math.min(1,Math.max(l,0)));var l;return o=w(n,s)(o),r(t[s],t[s+1],o)}}class b{constructor(t,e=[0,1],{easing:i=n.easing,duration:r=n.duration,delay:o=n.delay,endDelay:l=n.endDelay,repeat:c=n.repeat,offset:u,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),a(i)){const t=i.createAnimation(e,(()=>"0"),!0);i=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(r=t.duration)}const f=r*(c+1),d=O(e,u,s(i)?i.map(v):v(i));this.tick=e=>{var n;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 a=i/r;let s=Math.floor(a),c=a%1;!c&&a>=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(i>=f?1:Math.min(c,1));t(m);"finished"===this.playState||i>=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(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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}class T{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const x=new WeakMap;function A(t){return x.has(t)||x.set(t,{transforms:[],values:new Map}),x.get(t)}const k=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},j={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},D={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:j,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:j},P=new Map,E=t=>`--motion-${t}`,R=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{R.push(t+e),P.set(E(t+e),D[t])}))}));const V=(t,e)=>R.indexOf(t)-R.indexOf(e),$=new Set(R),q=t=>$.has(t),F=t=>t.sort(V).reduce(U,"").trim(),U=(t,e)=>`${t} ${e}(var(${E(e)}))`,W=t=>t.startsWith("--"),_=new Set;const C=t=>(t=>Array.isArray(t)&&i(t[0]))(t)?I(t):t,I=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,B=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{B({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(B({opacity:[0,1]}).finished)},N={},K={};for(const t in z)K[t]=()=>(void 0===N[t]&&(N[t]=z[t]()),N[t]);const X=t=>Array.isArray(t)?t:[t];function Y(t){return M[t]&&(t=M[t]),q(t)?E(t):t}const Z=(t,e)=>{e=Y(e);let n=W(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=P.get(e);t&&(n=t.initialValue)}return n},L=(t,e,n)=>{e=Y(e),W(e)?t.style.setProperty(e,n):t.style[e]=n};function G(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function H(t,e,r,l={}){const c=window.__MOTION_DEV_TOOLS_RECORD,u=!1!==l.record&&c;let h,{duration:d=n.duration,delay:m=n.delay,endDelay:p=n.endDelay,repeat:y=n.repeat,easing:g=n.easing,direction:v,offset:w,allowWebkitAcceleration:O=!1}=l;const S=A(t);let x=K.waapi();const k=q(e);k&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=A(t);var i,a;a=e,-1===(i=n).indexOf(a)&&i.push(a),t.style.transform=F(n)})(t,e);const j=Y(e),D=function(t,e){return t.has(e)||t.set(e,new T),t.get(e)}(S.values,j),E=P.get(j);return G(D.animation,!(a(g)&&D.generator)&&!1!==l.record),()=>{const n=()=>{var e,n;return null!==(n=null!==(e=Z(t,j))&&void 0!==e?e:null==E?void 0:E.initialValue)&&void 0!==n?n:0};let S=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(X(r),n);if(a(g)){const t=g.createAnimation(S,n,k,j,D);g=t.easing,void 0!==t.keyframes&&(S=t.keyframes),void 0!==t.duration&&(d=t.duration)}if(W(j)&&(K.cssRegisterProperty()?function(t){if(!_.has(t)){_.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){}}}(j):x=!1),x){E&&(S=S.map((t=>i(t)?E.toDefaultUnit(t):t)));const e=!K.partialKeyframes()&&1===S.length;(u||e)&&S.unshift(n());const a={delay:f(m),duration:f(d),endDelay:f(p),easing:s(g)?void 0:C(g),direction:v,iterations:y+1,fill:"both"};h=t.animate({[j]:S,offset:w,easing:s(g)?g.map(C):void 0},a),h.finished||(h.finished=new Promise(((t,e)=>{h.onfinish=t,h.oncancel=e})));const r=S[S.length-1];h.finished.then((()=>{L(t,j,r),h.cancel()})).catch(o),O||(h.playbackRate=1.000001)}else if(k&&S.every(i)){1===S.length&&S.unshift(parseFloat(n()));h=new b((e=>{E&&(e=E.toDefaultUnit(e)),L(t,j,e)}),S,Object.assign(Object.assign({},l),{duration:d,easing:g}))}else{const e=S[S.length-1];L(t,j,E&&i(e)?E.toDefaultUnit(e):e)}return u&&c(t,e,S,{duration:d,delay:m,easing:g,repeat:y,offset:w},"motion-one"),D.setAnimation(h),h}}const J=t=>t(),Q=t=>t.animations[0],tt={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let a=(null===(n=Q(t))||void 0===n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":return null===(i=Q(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(et)).catch(o)),t.finished;case"stop":return()=>t.animations.forEach((t=>G(t)));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 i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},et=t=>t.finished,nt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function it(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,a){var s;return i(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(s=a.get(e))&&void 0!==s?s:t}function st(t,n,i,a,s,o){!function(t,n,i){for(let a=0;a<t.length;a++){const s=t[a];s.at>n&&s.at<i&&(e(t,s),a--)}}(t,s,o);for(let e=0;e<n.length;e++)t.push({value:n[e],at:r(s,o,a[e]),easing:w(i,e)})}function rt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ot(t,e={}){var i;const a=lt(t,e),s=a.map((t=>H(...t))).filter(Boolean);return((t,e=n.duration)=>new Proxy({animations:t.map(J).filter(Boolean),duration:e},tt))(s,null===(i=a[0])||void 0===i?void 0:i[3].duration)}function lt(e,i={}){var{defaultOptions:s={}}=i,r=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(n[i[a]]=t[i[a]])}return n}(i,["defaultOptions"]);const o=[],l=new Map,f={},d=new Map;let m=0,p=0,y=0;for(let i=0;i<e.length;i++){const[r,o,c={}]=e[i];void 0!==c.at&&(p=at(p,c.at,m,d));let g=0;const v=it(r,f),w=v.length;for(let e=0;e<w;e++){const i=ct(v[e],l);for(const r in o){const l=ut(r,i);let f=X(o[r]);const d=nt(c,r);let{duration:m=s.duration||n.duration,easing:v=s.easing||n.easing}=d;if(a(v)){const e=q(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 O=S(c.delay,e,w)||0,b=p+O,T=b+m;let{offset:x=h(f.length)}=d;1===x.length&&0===x[0]&&(x[1]=1);const A=length-f.length;A>0&&u(x,A),1===f.length&&f.unshift(null),st(l,f,v,x,b,T),g=Math.max(O+m,g),y=Math.max(T,y)}}m=p,p+=g}return l.forEach(((t,e)=>{for(const i in t){const a=t[i];a.sort(rt);const l=[],u=[],h=[];for(let t=0;t<a.length;t++){const{at:e,value:i,easing:s}=a[t];l.push(i),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,i,l,Object.assign(Object.assign(Object.assign({},s),{duration:y,easing:h,offset:u}),r)])}})),o}function ct(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ut(t,e){return e[t]||(e[t]=[]),e[t]}export{lt as createAnimationsFromTimeline,ot 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:()=>L});class n{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const a=new WeakMap;function i(t){return a.has(t)||a.set(t,{transforms:[],values:new Map}),a.get(t)}const s=()=>{},r=t=>t,o=["","X","Y","Z"],l={x:"translateX",y:"translateY",z:"translateZ"},c={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},u={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:c,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:c},h=new Map,f=t=>`--motion-${t}`,m=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{o.forEach((e=>{m.push(t+e),h.set(f(t+e),u[t])}))}));const d=(t,e)=>m.indexOf(t)-m.indexOf(e),p=new Set(m),y=t=>p.has(t),g=(t,e)=>`${t} ${e}(var(${f(e)}))`,v=t=>t.startsWith("--"),w=new Set,T={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},b=t=>"number"==typeof t,S=t=>"object"==typeof t&&Boolean(t.createAnimation),A=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 s,r,o=0;do{r=e+(n-e)/2,s=x(r,a,i)-t,s>0?n=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(i,0,1,t,n),e,a)}const M={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(M[t])return M[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 P=(t,e,n)=>-n*t+n*e+t,D=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function R(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=D(0,e,a);t.push(P(n,1,i))}}class V{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"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),S(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}const u=a*(o+1),h=function(t,e=function(t){const e=[0];return R(e,t-1),e}(t.length),n=r){const a=t.length,i=a-e.length;return i>0&&R(e,i),i=>{let s=0;for(;s<a-2&&!(i<e[s+1]);s++);let r=(o=D(e[s],e[s+1],i),Math.min(1,Math.max(o,0)));var o;const l=function(t,e){return A(t)?t[((t,e,n)=>{const a=e-0;return((n-0)%a+a)%a+0})(0,t.length,e)]:t}(n,s);return r=l(r),P(t[s],t[s+1],r)}}(e,l,A(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 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(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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)?q(t):t,q=([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 l[t]&&(t=l[t]),y(t)?f(t):t}const B=(t,e,n)=>{e=z(e),v(e)?t.style.setProperty(e,n):t.style[e]=n};function I(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function K(t,e,a,r={}){let o,{duration:c=T.duration,delay:u=T.delay,endDelay:f=T.endDelay,repeat:m=T.repeat,easing:p=T.easing,direction:x,offset:k,allowWebkitAcceleration:M=!1}=r;const O=i(t);let j=W.waapi();const P=y(e);P&&((t,e)=>{l[e]&&(e=l[e]);const{transforms:n}=i(t);var a,s;s=e,-1===(a=n).indexOf(s)&&a.push(s),t.style.transform=(t=>t.sort(d).reduce(g,"").trim())(n)})(t,e);const D=z(e),R=function(t,e){return t.has(e)||t.set(e,new n),t.get(e)}(O.values,D),q=h.get(D);return I(R.animation,!(S(p)&&R.generator)),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=((t,e)=>{e=z(e);let n=v(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=h.get(e);t&&(n=t.initialValue)}return n})(t,D))&&void 0!==e?e:null==q?void 0:q.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])(a),e);if(S(p)){const t=p.createAnimation(n,e,P,D,R);p=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(c=t.duration)}if(v(D)&&(W.cssRegisterProperty()?function(t){if(!w.has(t)){w.add(t);try{const{syntax:e,initialValue:n}=h.has(t)?h.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(D):j=!1),j){q&&(n=n.map((t=>b(t)?q.toDefaultUnit(t):t))),W.partialKeyframes()||1!==n.length||n.unshift(e());const a={delay:$(u),duration:$(c),endDelay:$(f),easing:A(p)?void 0:E(p),direction:x,iterations:m+1,fill:"both"};o=t.animate({[D]:n,offset:k,easing:A(p)?p.map(E):void 0},a),o.finished||(o.finished=new Promise(((t,e)=>{o.onfinish=t,o.oncancel=e})));const i=n[n.length-1];o.finished.then((()=>{B(t,D,i),o.cancel()})).catch(s),M||(o.playbackRate=1.000001)}else if(P&&n.every(b))1===n.length&&n.unshift(parseFloat(e())),o=new V((e=>{q&&(e=q.toDefaultUnit(e)),B(t,D,e)}),n,Object.assign(Object.assign({},r),{duration:c,easing:p}));else{const e=n[n.length-1];B(t,D,q&&b(e)?q.toDefaultUnit(e):e)}return R.setAnimation(o),o}}const X=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t),Y=t=>t(),Z=t=>t.animations[0],G={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(H)).catch(s)),t.finished;case"stop":return()=>t.animations.forEach((t=>I(t)));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 J(t,e,n){return"function"==typeof t?t(e,n):t}function L(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 s=0;s<a;s++){const r=t[s];for(const t in e){const o=X(n,t);o.delay=J(o.delay,s,a);const l=K(r,t,e[t],o);i.push(l)}}return((t,e=T.duration)=>new Proxy({animations:t.map(Y).filter(Boolean),duration:e},G))(i,n.duration)}var N=e.j;export{N 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:()=>G});class n{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const a=new WeakMap;function i(t){return a.has(t)||a.set(t,{transforms:[],values:new Map}),a.get(t)}const s=()=>{},r=t=>t,o=["","X","Y","Z"],l={x:"translateX",y:"translateY",z:"translateZ"},c={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},u={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:c,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:c},h=new Map,f=t=>`--motion-${t}`,d=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{o.forEach((e=>{d.push(t+e),h.set(f(t+e),u[t])}))}));const m=(t,e)=>d.indexOf(t)-d.indexOf(e),p=new Set(d),y=t=>p.has(t),g=(t,e)=>`${t} ${e}(var(${f(e)}))`,v=t=>t.startsWith("--"),w=new Set,T={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},b=t=>"number"==typeof t,S=t=>"object"==typeof t&&Boolean(t.createAnimation),A=t=>Array.isArray(t)&&!b(t[0]),O=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function x(t,e,n,a){if(t===e&&n===a)return r;return i=>0===i||1===i?i:O(function(t,e,n,a,i){let s,r,o=0;do{r=e+(n-e)/2,s=O(r,a,i)-t,s>0?n=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(i,0,1,t,n),e,a)}const k={ease:x(.25,.1,.25,1),"ease-in":x(.42,0,1,1),"ease-in-out":x(.42,0,.58,1),"ease-out":x(0,0,.58,1)},M=/\((.*?)\)/;function j(t){if("function"==typeof t)return t;if(Array.isArray(t))return x(...t);if(k[t])return k[t];if(t.startsWith("steps")){const e=M.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 D=(t,e,n)=>-n*t+n*e+t,P=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function R(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=P(0,e,a);t.push(D(n,1,i))}}class E{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"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),S(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}const u=a*(o+1),h=function(t,e=function(t){const e=[0];return R(e,t-1),e}(t.length),n=r){const a=t.length,i=a-e.length;return i>0&&R(e,i),i=>{let s=0;for(;s<a-2&&!(i<e[s+1]);s++);let r=(o=P(e[s],e[s+1],i),Math.min(1,Math.max(o,0)));var o;const l=function(t,e){return A(t)?t[((t,e,n)=>{const a=e-0;return((n-0)%a+a)%a+0})(0,t.length,e)]:t}(n,s);return r=l(r),D(t[s],t[s+1],r)}}(e,l,A(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&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}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)&&b(t[0]))(t)?q(t):t,q=([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={},_={};for(const t in C)_[t]=()=>(void 0===F[t]&&(F[t]=C[t]()),F[t]);function I(t){return l[t]&&(t=l[t]),y(t)?f(t):t}const W=(t,e,n)=>{e=I(e),v(e)?t.style.setProperty(e,n):t.style[e]=n};function z(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function B(t,e,a,r={}){const o=window.__MOTION_DEV_TOOLS_RECORD,c=!1!==r.record&&o;let u,{duration:f=T.duration,delay:d=T.delay,endDelay:p=T.endDelay,repeat:O=T.repeat,easing:x=T.easing,direction:k,offset:M,allowWebkitAcceleration:j=!1}=r;const D=i(t);let P=_.waapi();const R=y(e);R&&((t,e)=>{l[e]&&(e=l[e]);const{transforms:n}=i(t);var a,s;s=e,-1===(a=n).indexOf(s)&&a.push(s),t.style.transform=(t=>t.sort(m).reduce(g,"").trim())(n)})(t,e);const q=I(e),U=function(t,e){return t.has(e)||t.set(e,new n),t.get(e)}(D.values,q),C=h.get(q);return z(U.animation,!(S(x)&&U.generator)&&!1!==r.record),()=>{const n=()=>{var e,n;return null!==(n=null!==(e=((t,e)=>{e=I(e);let n=v(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=h.get(e);t&&(n=t.initialValue)}return n})(t,q))&&void 0!==e?e:null==C?void 0:C.initialValue)&&void 0!==n?n:0};let i=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])(a),n);if(S(x)){const t=x.createAnimation(i,n,R,q,U);x=t.easing,void 0!==t.keyframes&&(i=t.keyframes),void 0!==t.duration&&(f=t.duration)}if(v(q)&&(_.cssRegisterProperty()?function(t){if(!w.has(t)){w.add(t);try{const{syntax:e,initialValue:n}=h.has(t)?h.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(q):P=!1),P){C&&(i=i.map((t=>b(t)?C.toDefaultUnit(t):t)));const e=!_.partialKeyframes()&&1===i.length;(c||e)&&i.unshift(n());const a={delay:V(d),duration:V(f),endDelay:V(p),easing:A(x)?void 0:$(x),direction:k,iterations:O+1,fill:"both"};u=t.animate({[q]:i,offset:M,easing:A(x)?x.map($):void 0},a),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const r=i[i.length-1];u.finished.then((()=>{W(t,q,r),u.cancel()})).catch(s),j||(u.playbackRate=1.000001)}else if(R&&i.every(b))1===i.length&&i.unshift(parseFloat(n())),u=new E((e=>{C&&(e=C.toDefaultUnit(e)),W(t,q,e)}),i,Object.assign(Object.assign({},r),{duration:f,easing:x}));else{const e=i[i.length-1];W(t,q,C&&b(e)?C.toDefaultUnit(e):e)}return c&&o(t,e,i,{duration:f,delay:d,easing:x,repeat:O,offset:M},"motion-one"),U.setAnimation(u),u}}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 i=(null===(n=Y(t))||void 0===n?void 0:n[e])||0;return i?i/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(L)).catch(s)),t.finished;case"stop":return()=>t.animations.forEach((t=>z(t)));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}},L=t=>t.finished;function N(t,e,n){return"function"==typeof t?t(e,n):t}function G(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 s=0;s<a;s++){const r=t[s];for(const t in e){const o=K(n,t);o.delay=N(o.delay,s,a);const l=B(r,t,e[t],o);i.push(l)}}return((t,e=T.duration)=>new Proxy({animations:t.map(X).filter(Boolean),duration:e},Z))(i,n.duration)}var H=e.j;export{H as animate}; |
@@ -13,3 +13,8 @@ import { getAnimationData, getMotionValue } from "./data"; | ||
import { stopAnimation } from "./utils/stop-animation"; | ||
function getDevToolsRecord() { | ||
return window.__MOTION_DEV_TOOLS_RECORD; | ||
} | ||
export function animateStyle(element, key, keyframesDefinition, options = {}) { | ||
const record = getDevToolsRecord(); | ||
const isRecording = options.record !== false && record; | ||
let animation; | ||
@@ -38,3 +43,4 @@ let { duration = defaults.duration, delay = defaults.delay, endDelay = defaults.endDelay, repeat = defaults.repeat, easing = defaults.easing, direction, offset, allowWebkitAcceleration = false, } = options; | ||
*/ | ||
stopAnimation(motionValue.animation, !(isEasingGenerator(easing) && motionValue.generator)); | ||
stopAnimation(motionValue.animation, !(isEasingGenerator(easing) && motionValue.generator) && | ||
options.record !== false); | ||
/** | ||
@@ -87,3 +93,4 @@ * Batchable factory function containing all DOM reads. | ||
*/ | ||
if (!supports.partialKeyframes() && keyframes.length === 1) { | ||
const needsToReadInitialKeyframe = !supports.partialKeyframes() && keyframes.length === 1; | ||
if (isRecording || needsToReadInitialKeyframe) { | ||
keyframes.unshift(readInitialValue()); | ||
@@ -161,2 +168,11 @@ } | ||
} | ||
if (isRecording) { | ||
record(element, key, keyframes, { | ||
duration, | ||
delay, | ||
easing, | ||
repeat, | ||
offset, | ||
}, "motion-one"); | ||
} | ||
motionValue.setAnimation(animation); | ||
@@ -163,0 +179,0 @@ return animation; |
{ | ||
"name": "@motionone/dom", | ||
"version": "10.6.2", | ||
"version": "10.7.0", | ||
"description": "A tiny, performant animation library for the DOM", | ||
@@ -14,11 +14,10 @@ "license": "MIT", | ||
"test": "jest --coverage --config jest.config.js", | ||
"dev": "rollup -c -w", | ||
"dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --c --watch --no-watch.clearScreen\"", | ||
"measure": "bundlesize" | ||
}, | ||
"dependencies": { | ||
"@motionone/animation": "^10.6.2", | ||
"@motionone/easing": "^10.6.2", | ||
"@motionone/generators": "^10.6.2", | ||
"@motionone/types": "^10.6.2", | ||
"@motionone/utils": "^10.6.2", | ||
"@motionone/animation": "^10.7.0", | ||
"@motionone/generators": "^10.7.0", | ||
"@motionone/types": "^10.7.0", | ||
"@motionone/utils": "^10.7.0", | ||
"hey-listen": "^1.0.8", | ||
@@ -34,11 +33,11 @@ "tslib": "^2.3.1" | ||
"path": "./dist/size-animate.js", | ||
"maxSize": "3.5 kB" | ||
"maxSize": "3.6 kB" | ||
}, | ||
{ | ||
"path": "./dist/size-animate-style.js", | ||
"maxSize": "3.1 kB" | ||
"maxSize": "3.2 kB" | ||
}, | ||
{ | ||
"path": "./dist/size-timeline.js", | ||
"maxSize": "4.4 kB" | ||
"maxSize": "4.5 kB" | ||
}, | ||
@@ -51,6 +50,6 @@ { | ||
"path": "./dist/size-webpack-animate.js", | ||
"maxSize": "3.5 kB" | ||
"maxSize": "3.6 kB" | ||
} | ||
], | ||
"gitHead": "b776bc7edd104b5545d2204713f7fb94eba50b21" | ||
"gitHead": "d1842ead7b1320c511a4558527a6dec65b4f5d6e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
271549
6
4223
- Removed@motionone/easing@^10.6.2
Updated@motionone/animation@^10.7.0
Updated@motionone/types@^10.7.0
Updated@motionone/utils@^10.7.0