motion 10.5.1 → 10.6.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}function n(t,e){-1===t.indexOf(e)&&t.push(e)}function i(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const a=()=>{},s=t=>t,r=["","X","Y","Z"],o={x:"translateX",y:"translateY",z:"translateZ"},c={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},l={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:c,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:s},skew:c},u=new Map,h=t=>`--motion-${t}`,f=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{r.forEach((e=>{f.push(t+e),u.set(h(t+e),l[t])}))}));const d=(t,e)=>f.indexOf(t)-f.indexOf(e),p=new Set(f),v=t=>p.has(t),m=t=>t.sort(d).reduce(g,"").trim(),g=(t,e)=>`${t} ${e}(var(${h(e)}))`,y=t=>t.startsWith("--"),b=new Set;const w=t=>1e3*t,x=t=>"number"==typeof t,M=t=>Array.isArray(t)&&!x(t[0]),O=t=>"object"==typeof t&&Boolean(t.createAnimation),E=t=>(t=>Array.isArray(t)&&x(t[0]))(t)?S(t):t,S=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,T=t=>document.createElement("div").animate(t,{duration:.001}),A={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{T({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(T({opacity:[0,1]}).finished)},j={},k={};for(const t in A)k[t]=()=>(void 0===j[t]&&(j[t]=A[t]()),j[t]);const D={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},P=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function $(t,e,n,i){if(t===e&&n===i)return s;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=P(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:P(a(t),e,i)}const R=(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},V={ease:$(.25,.1,.25,1),"ease-in":$(.42,0,1,1),"ease-in-out":$(.42,0,.58,1),"ease-out":$(0,0,.58,1)},B=/\((.*?)\)/;function C(t){if("function"==typeof t)return t;if(Array.isArray(t))return $(...t);if(V[t])return V[t];if(t.startsWith("steps")){const e=B.exec(t);if(e){const t=e[1].split(",");return R(parseFloat(t[0]),t[1].trim())}}return s}const L=(t,e,n)=>-n*t+n*e+t,U=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function W(t,e){return M(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}function q(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=U(0,e,i);t.push(L(n,1,a))}}function F(t){const e=[0];return q(e,t-1),e}function I(t,e=F(t.length),n=s){const i=t.length,a=i-e.length;return a>0&&q(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let r=(o=U(e[s],e[s+1],a),Math.min(1,Math.max(o,0)));var o;return r=W(n,s)(r),L(t[s],t[s+1],r)}}class z{constructor(t,e=[0,1],{easing:n=D.easing,duration:i=D.duration,delay:a=D.delay,endDelay:s=D.endDelay,repeat:r=D.repeat,offset:o,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 l=i*(r+1);O(n)&&(n="ease");const u=I(e,o,M(n)?n.map(C):C(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-a,0),"finished"===this.playState&&(r=l);const o=r/i;let h=Math.floor(o),f=o%1;!f&&o>=1&&(f=1),1===f&&h--;const d=h%2;("reverse"===c||"alternate"===c&&d||"alternate-reverse"===c&&!d)&&(f=1-f);const p=u(r>=l?1:Math.min(f,1));t(p);"finished"===this.playState||r>=l+s?(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}}const G=t=>Array.isArray(t)?t:[t];function Z(t){return o[t]&&(t=o[t]),v(t)?h(t):t}const K={get:(t,e)=>{e=Z(e);let n=y(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=u.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=Z(e),y(e)?t.style.setProperty(e,n):t.style[e]=n}};function N(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function X(t,i,s,r={}){let c,{duration:l=D.duration,delay:h=D.delay,endDelay:f=D.endDelay,repeat:d=D.repeat,easing:p=D.easing,direction:g,offset:S,allowWebkitAcceleration:T=!1}=r;const A=e(t);let j=k.waapi();const P=v(i);P&&((t,i)=>{o[i]&&(i=o[i]);const{transforms:a}=e(t);n(a,i),t.style.transform=m(a)})(t,i);const $=Z(i),R=u.get($);return N(A.animations[$]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=K.get(t,$))&&void 0!==e?e:null==R?void 0:R.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}(G(s),e);if(O(p)){const t=p.createAnimation(n,e,P,$,A);p=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(l=t.duration)}if(y($)&&(k.cssRegisterProperty()?function(t){if(!b.has(t)){b.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){}}}($):j=!1),j){R&&(n=n.map((t=>x(t)?R.toDefaultUnit(t):t))),k.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:w(h),duration:w(l),endDelay:w(f),easing:M(p)?void 0:E(p),direction:g,iterations:d+1,fill:"both"};c=t.animate({[$]:n,offset:S,easing:M(p)?p.map(E):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((()=>{K.set(t,$,s),c.cancel()})).catch(a),T||(c.playbackRate=1.000001)}else if(P&&n.every(x)){1===n.length&&n.unshift(parseFloat(e()));c=new z((e=>{R&&(e=R.toDefaultUnit(e)),K.set(t,$,e)}),n,Object.assign(Object.assign({},r),{duration:l,easing:p}))}else{const e=n[n.length-1];K.set(t,$,R&&x(e)?R.toDefaultUnit(e):e)}return A.animations[$]=c,null==c||c.finished.then((()=>{A.animations[$]=void 0,A.generators[$]=void 0,A.prevGeneratorState[$]=void 0})).catch(a),c}}const Y=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},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)}const H=t=>t(),J=(t,e)=>new Proxy({animations:t.map(H).filter(Boolean),duration:e},tt),Q=t=>t.animations[0],tt={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let s=(null===(n=Q(t))||void 0===n?void 0:n[e])||0;return s?s/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(a)),t.finished;case"stop":return()=>t.animations.forEach(N);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=w(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;function nt(t=.1,{start:e=0,from:n=0,easing:i}={}){return(a,s)=>{const r=x(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,s),o=Math.abs(r-a);let c=t*o;if(i){const t=s*a;c=C(i)(c/t)*t}return e+c}}function it(t,e,n){return"function"==typeof t?t(e,n):t}function at(t,e,n={}){var i;const a=(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=it(o.delay,i,a);const c=X(r,t,e[t],o);s.push(c)}}return J(s,null!==(i=n.duration)&&void 0!==i?i:D.duration)}function st(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}var rt=function(){};function ot(t,e,n,i){var a;return x(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function ct(t,e,n,a,s,r){!function(t,e,n){for(let a=0;a<t.length;a++){const s=t[a];s.at>e&&s.at<n&&(i(t,s),a--)}}(t,s,r);for(let i=0;i<e.length;i++)t.push({value:e[i],at:L(s,r,a[i]),easing:W(n,i)})}function lt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ut(t,e={}){var n,i;const a=function(t,e={}){var{defaultOptions:n={}}=e,i=st(e,["defaultOptions"]);const a=[],s=new Map,r={},o=new Map;let c=0,l=0,u=0;for(let e=0;e<t.length;e++){const[i,a,h={}]=t[e];void 0!==h.at&&(l=ot(l,h.at,c,o));let f=0;const d=_(i,r),p=d.length;for(let t=0;t<p;t++){const e=ht(d[t],s);for(const i in a){const s=ft(i,e);let r=G(a[i]);const o=Y(h,i);let{duration:c=n.duration||D.duration,easing:d=n.easing||D.easing}=o;if(O(d)){const t=v(i);rt(2===r.length||!t,"spring must be provided 2 keyframes within timeline");const e=d.createAnimation(r,(()=>"0"),t);d=e.easing,void 0!==e.keyframes&&(r=e.keyframes),void 0!==e.duration&&(c=e.duration)}const m=it(h.delay,t,p)||0,g=l+m,y=g+c;let{offset:b=F(r.length)}=o;1===b.length&&0===b[0]&&(b[1]=1);const w=length-r.length;w>0&&q(b,w),1===r.length&&r.unshift(null),ct(s,r,d,b,g,y),f=Math.max(m+c,f),u=Math.max(y,u)}}c=l,l+=f}return s.forEach(((t,e)=>{for(const s in t){const r=t[s];r.sort(lt);const o=[],c=[],l=[];for(let t=0;t<r.length;t++){const{at:e,value:n,easing:i}=r[t];o.push(n),c.push(U(0,u,e)),l.push(i||D.easing)}0!==c[0]&&(c.unshift(0),o.unshift(o[0]),l.unshift("linear")),1!==c[c.length-1]&&(c.push(1),o.push(null)),a.push([e,s,o,Object.assign(Object.assign(Object.assign({},n),{duration:u,easing:l,offset:c}),i)])}})),a}(t,e),s=a.map((t=>X(...t))).filter(Boolean);return J(s,null!==(i=null===(n=a[0])||void 0===n?void 0:n[3].duration)&&void 0!==i?i:D.duration)}function ht(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ft(t,e){return e[t]||(e[t]=[]),e[t]}"production"!==process.env.NODE_ENV&&(rt=function(t,e){if(!t)throw new Error(e)});const dt=({stiffness:t=100,damping:e=10,mass:n=1,from:i=0,to:a=1,velocity:s=0,restSpeed:r=2,restDistance:o=.5}={})=>{const c={done:!1,value:i,target:a,velocity:s=s?s/1e3:0,hasReachedTarget:!1},l=((t=100,e=10,n=1)=>e/(2*Math.sqrt(t*n)))(t,e,n),u=a-i,h=Math.sqrt(t/n)/1e3,f=((t,e)=>t*Math.sqrt(1-e*e))(h,l);let d;return d=l<1?t=>a-Math.exp(-l*h*t)*((l*h*u-s)/f*Math.sin(f*t)+u*Math.cos(f*t)):t=>a-Math.exp(-h*t)*(u+(s+h*u)*t),{next:t=>{c.value=d(t),c.velocity=0===t?s:pt(d,t,c.value);const e=Math.abs(c.velocity)<=r,n=Math.abs(a-c.value)<=o;var l,u,h;return c.done=e&&n,c.hasReachedTarget=(l=i,u=a,h=c.value,l<u&&h>=u||l>u&&h<=u),c}}};function pt(t,e,n){const i=Math.max(e-5,0);return a=n-t(i),(s=5)?a*(1e3/s):0;var a,s}function vt(t){const e=new WeakMap;return(n={})=>{const i=new Map,a=(e=0,a=100,s=0,r=!1)=>{const o=`${e}-${a}-${s}-${r}`;return i.has(o)||i.set(o,t(Object.assign({from:e,to:a,velocity:s,restSpeed:r?.05:2,restDistance:r?.01:.5},n))),i.get(o)},s=t=>(e.has(t)||e.set(t,function(t){let e,n=10,i=t.next(0);const a=[i.value];for(;!i.done&&n<1e4;)i=t.next(n),a.push(i.done?i.target:i.value),void 0===e&&i.hasReachedTarget&&(e=n),n+=10;const s=n-10;return 1===a.length&&a.push(i.value),{keyframes:a,duration:s/1e3,overshootDuration:(null!=e?e:s)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,i,r)=>{let o,c;const l=t.length;if(n&&l<=2&&t.every(mt)){const n=i&&r&&r.prevGeneratorState[i],u=n&&(1===l||2===l&&null===t[0])?n.velocity:0,h=t[l-1],f=1===l?null:t[0],d=null===f?n?n.value:parseFloat(e()):f;c=a(d,h,u,null==i?void 0:i.includes("scale"));const p=s(c);o=Object.assign(Object.assign({},p),{easing:"linear"})}else{c=a(0,100);o={easing:"ease",duration:s(c).overshootDuration}}return c&&r&&i&&(r.generators[i]=c),o}}}}const mt=t=>"string"!=typeof t,gt=vt(dt),yt=vt((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:a,bounceStiffness:s,changeTarget:r,min:o,max:c,restDistance:l=.5,restSpeed:u})=>{i=w(i);const h={value:t,target:t,velocity:e,hasReachedTarget:!1,done:!1},f=t=>void 0===o?c:void 0===c||Math.abs(o-t)<Math.abs(c-t)?o:c;let d=n*e;const p=t+d,v=void 0===r?p:r(p);h.target=v,v!==p&&(d=v-t);const m=t=>-d*Math.exp(-t/i),g=t=>v+m(t),y=t=>{const n=m(t),i=g(t);h.done=Math.abs(n)<=l,h.value=h.done?v:i,h.velocity=0===t?e:pt(g,t,h.value)};let b,x;const M=t=>{var e;(e=h.value,void 0!==o&&e<o||void 0!==c&&e>c)&&(b=t,x=dt({from:h.value,to:f(h.value),velocity:h.velocity,damping:a,stiffness:s,restDistance:l,restSpeed:u}))};return M(0),{next:t=>{let e=!1;return x||void 0!==b||(e=!0,y(t),M(t)),void 0!==b&&t>b?(h.hasReachedTarget=!0,x.next(t-b)):(h.hasReachedTarget=!1,!e&&y(t),h)}}}));function bt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let wt;function xt(){if(!wt)return;const t=wt.sort(Ot).map(Et);t.forEach(St),t.forEach(St),wt=void 0}function Mt(t){wt?n(wt,t):(wt=[t],requestAnimationFrame(xt))}const Ot=(t,e)=>t.getDepth()-e.getDepth(),Et=t=>t.animateUpdates(),St=t=>t.next(),Tt=(t,e)=>new CustomEvent(t,{detail:{target:e}});function At(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function jt(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const kt=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),At(t,e,i))},Dt={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n})=>{let i=!1;if("undefined"!=typeof IntersectionObserver){const a=new IntersectionObserver((([a])=>{!i&&a.isIntersecting?(e(),jt(t,"viewenter",a)):i&&!a.isIntersecting&&(n(),jt(t,"viewleave",a)),i=a.isIntersecting}));return a.observe(t),()=>{a.unobserve(t),a.disconnect()}}return e(),()=>{}}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=kt(t,"hoverstart",e),a=kt(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",a),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",a)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),At(t,"pressend",e),window.removeEventListener("pointerup",i)},a=n=>{e(),At(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",a),()=>{t.removeEventListener("pointerdown",a),window.removeEventListener("pointerup",i)}}}},Pt=["initial","animate",...Object.keys(Dt),"exit"],$t=new WeakMap;function Rt(t={},e){let n,s=e?e.getDepth()+1:0;const r={initial:!0,animate:!0},o={},c={};for(const n of Pt)c[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const l=!1===t.initial?"animate":"initial";let u=st(bt(t[l]||c[l],t.variants)||{},["transition"]);const h=Object.assign({},u);const f=(t,e)=>()=>{r[t]=e,Mt(p)},d=()=>{for(const e in Dt){const i=Dt[e].isActive(t),a=o[e];i&&!a?o[e]=Dt[e].subscribe(n,{enable:f(e,!0),disable:f(e,!1)}):!i&&a&&(a(),delete o[e])}},p={update:e=>{n&&(t=e,d(),Mt(p))},setActive:(t,e)=>{n&&(r[t]=e,Mt(p))},animateUpdates:function*(){var e,i;const s=u;u={};const o={},c={},l={};for(const n of Pt){if(!r[n])continue;const a=bt(t[n]);if(a){o[n]=a;for(const s in a)"transition"!==s&&(u[s]=a[s],l[s]=Y(null!==(i=null!==(e=a.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},s),c[s]=n)}}const f=new Set([...Object.keys(u),...Object.keys(s)]),d=[];f.forEach((t=>{var e,i,a;void 0===u[t]&&(u[t]=h[t]),i=s[t],a=u[t],typeof i==typeof a&&(Array.isArray(i)&&Array.isArray(a)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,a):i===a)||(null!==(e=h[t])&&void 0!==e||(h[t]=K.get(n,t)),d.push(X(n,t,u[t],l[t])))})),yield;const p=d.map((t=>t())).filter(Boolean);if(!p.length)return;const v=u;n.dispatchEvent(Tt("motionstart",v)),Promise.all(p.map((t=>t.finished))).then((()=>{n.dispatchEvent(Tt("motioncomplete",v))})).catch(a)},getDepth:()=>s,getTarget:()=>u,getOptions:()=>t,getContext:()=>c,mount:t=>(rt(Boolean(t),"Animation state must be mounted with valid Element"),n=t,$t.set(n,p),d(),()=>{$t.delete(n),function(t){wt&&i(wt,t)}(p);for(const t in o)o[t]()}),isMounted:()=>Boolean(n)};return p}function Vt(t){const e={},n=[];for(let i in t){const a=t[i];v(i)&&(o[i]&&(i=o[i]),n.push(i),i=h(i));let s=Array.isArray(a)?a[0]:a;const r=u.get(i);r&&(s=x(a)?r.toDefaultUnit(a):a),e[i]=s}return n.length&&(e.transform=m(n)),e}const Bt=t=>`-${t.toLowerCase()}`;function Ct(t={}){const e=Vt(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,Bt),n+=`: ${e[t]}; `;return n}export{at as animate,X as animateStyle,Rt as createMotionState,Ct as createStyleString,Vt as createStyles,e as getAnimationData,Z as getStyleName,yt as glide,$t as mountedStates,gt as spring,nt as stagger,K as style,ut as timeline};
1
+ const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),t.get(e)}function n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},r=t=>"number"==typeof t,i=t=>"object"==typeof t&&Boolean(t.createAnimation),s=t=>Array.isArray(t)&&!r(t[0]),o=(t,e,n)=>-n*t+n*e+t,c=()=>{},l=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 a=1;a<=e;a++){const r=u(0,e,a);t.push(o(n,1,r))}}function f(t){const e=[0];return h(e,t-1),e}const d=t=>1e3*t,p=t=>t/1e3;const m=["","X","Y","Z"],y={x:"translateX",y:"translateY",z:"translateZ"},g={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},v={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:g,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:l},skew:g},b=new Map,M=t=>`--motion-${t}`,w=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{m.forEach((e=>{w.push(t+e),b.set(M(t+e),v[t])}))}));const S=(t,e)=>w.indexOf(t)-w.indexOf(e),O=new Set(w),x=t=>O.has(t),T=t=>t.sort(S).reduce(k,"").trim(),k=(t,e)=>`${t} ${e}(var(${M(e)}))`,j=t=>t.startsWith("--"),D=new Set;const A=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function R(t,e,n,a){if(t===e&&n===a)return l;const r=e=>function(t,e,n,a,r){let i,s,o=0;do{s=e+(n-e)/2,i=A(s,a,r)-t,i>0?n=s:e=s}while(Math.abs(i)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:A(r(t),e,a)}const P=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(a):Math.ceil(a);return i=0,s=1,o=r/t,Math.min(Math.max(o,i),s);var i,s,o},E={ease:R(.25,.1,.25,1),"ease-in":R(.42,0,1,1),"ease-in-out":R(.42,0,.58,1),"ease-out":R(0,0,.58,1)},$=/\((.*?)\)/;function q(t){if("function"==typeof t)return t;if(Array.isArray(t))return R(...t);if(E[t])return E[t];if(t.startsWith("steps")){const e=$.exec(t);if(e){const t=e[1].split(",");return P(parseFloat(t[0]),t[1].trim())}}return l}function V(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 F(t,e=f(t.length),n=l){const a=t.length,r=a-e.length;return r>0&&h(e,r),r=>{let i=0;for(;i<a-2&&!(r<e[i+1]);i++);let s=(c=u(e[i],e[i+1],r),Math.min(1,Math.max(c,0)));var c;return s=V(n,i)(s),o(t[i],t[i+1],s)}}class W{constructor(t,e=[0,1],{easing:n=a.easing,duration:r=a.duration,delay:o=a.delay,endDelay:c=a.endDelay,repeat:l=a.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*(l+1);i(n)&&(n="ease");const d=F(e,u,s(n)?n.map(q):q(n));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/r;let s=Math.floor(i),l=i%1;!l&&i>=1&&(l=1),1===l&&s--;const u=s%2;("reverse"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(l=1-l);const p=d(a>=f?1:Math.min(l,1));t(p);"finished"===this.playState||a>=f+c?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.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",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)&&r(t[0]))(t)?B(t):t,B=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,C=t=>document.createElement("div").animate(t,{duration:.001}),I={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)},z={},G={};for(const t in I)G[t]=()=>(void 0===z[t]&&(z[t]=I[t]()),z[t]);const K=t=>Array.isArray(t)?t:[t];function N(t){return y[t]&&(t=y[t]),x(t)?M(t):t}const X={get:(t,e)=>{e=N(e);let n=j(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=b.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=N(e),j(e)?t.style.setProperty(e,n):t.style[e]=n}};function Y(t){if(t&&"finished"!==t.playState)try{t.commitStyles(),t.cancel()}catch(t){}}function Z(t,n,o,l={}){let u,{duration:h=a.duration,delay:f=a.delay,endDelay:p=a.endDelay,repeat:m=a.repeat,easing:g=a.easing,direction:v,offset:M,allowWebkitAcceleration:w=!1}=l;const S=e(t);let O=G.waapi();const k=x(n);k&&((t,n)=>{y[n]&&(n=y[n]);const{transforms:a}=e(t);var r,i;i=n,-1===(r=a).indexOf(i)&&r.push(i),t.style.transform=T(a)})(t,n);const A=N(n),R=b.get(A);return Y(S.animations[A]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=X.get(t,A))&&void 0!==e?e:null==R?void 0:R.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}(K(o),e);if(i(g)){const t=g.createAnimation(n,e,k,A,S);g=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(h=t.duration)}if(j(A)&&(G.cssRegisterProperty()?function(t){if(!D.has(t)){D.add(t);try{const{syntax:e,initialValue:n}=b.has(t)?b.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(A):O=!1),O){R&&(n=n.map((t=>r(t)?R.toDefaultUnit(t):t))),G.partialKeyframes()||1!==n.length||n.unshift(e());const a={delay:d(f),duration:d(h),endDelay:d(p),easing:s(g)?void 0:U(g),direction:v,iterations:m+1,fill:"both"};u=t.animate({[A]:n,offset:M,easing:s(g)?g.map(U):void 0},a),u.finished||(u.finished=new Promise(((t,e)=>{u.onfinish=t,u.oncancel=e})));const i=n[n.length-1];u.finished.then((()=>{X.set(t,A,i),u.cancel()})).catch(c),w||(u.playbackRate=1.000001)}else if(k&&n.every(r)){1===n.length&&n.unshift(parseFloat(e()));u=new W((e=>{R&&(e=R.toDefaultUnit(e)),X.set(t,A,e)}),n,Object.assign(Object.assign({},l),{duration:h,easing:g}))}else{const e=n[n.length-1];X.set(t,A,R&&r(e)?R.toDefaultUnit(e):e)}return S.animations[A]=u,null==u||u.finished.then((()=>{S.animations[A]=void 0,S.generators[A]=void 0,S.prevGeneratorState[A]=void 0})).catch(c),u}}const _=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function H(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)}const J=t=>t(),L=(t,e=a.duration)=>new Proxy({animations:t.map(J).filter(Boolean),duration:e},tt),Q=t=>t.animations[0],tt={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(n=Q(t))||void 0===n?void 0:n[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=Q(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(et)).catch(c)),t.finished;case"stop":return()=>t.animations.forEach(Y);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=d(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},et=t=>t.finished;function nt(t=.1,{start:e=0,from:n=0,easing:a}={}){return(i,s)=>{const o=r(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,s),c=Math.abs(o-i);let l=t*c;if(a){const t=s*i;l=q(a)(l/t)*t}return e+l}}function at(t,e,n){return"function"==typeof t?t(e,n):t}function rt(t,e,n={}){const a=(t=H(t)).length,r=[];for(let i=0;i<a;i++){const s=t[i];for(const t in e){const o=_(n,t);o.delay=at(o.delay,i,a);const c=Z(s,t,e[t],o);r.push(c)}}return L(r,n.duration)}var it=function(){};function st(t,e,n,a){var i;return r(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(i=a.get(e))&&void 0!==i?i:t}function ot(t,e,a,r,i,s){!function(t,e,a){for(let r=0;r<t.length;r++){const i=t[r];i.at>e&&i.at<a&&(n(t,i),r--)}}(t,i,s);for(let n=0;n<e.length;n++)t.push({value:e[n],at:o(i,s,r[n]),easing:V(a,n)})}function ct(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function lt(t,e={}){var n;const r=function(t,e={}){var{defaultOptions:n={}}=e,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 r=0;for(a=Object.getOwnPropertySymbols(t);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(t,a[r])&&(n[a[r]]=t[a[r]])}return n}(e,["defaultOptions"]);const s=[],o=new Map,c={},l=new Map;let d=0,p=0,m=0;for(let e=0;e<t.length;e++){const[r,s,u={}]=t[e];void 0!==u.at&&(p=st(p,u.at,d,l));let y=0;const g=H(r,c),v=g.length;for(let t=0;t<v;t++){const e=ut(g[t],o);for(const r in s){const o=ht(r,e);let c=K(s[r]);const l=_(u,r);let{duration:d=n.duration||a.duration,easing:g=n.easing||a.easing}=l;if(i(g)){const t=x(r);it(2===c.length||!t,"spring must be provided 2 keyframes within timeline");const e=g.createAnimation(c,(()=>"0"),t);g=e.easing,void 0!==e.keyframes&&(c=e.keyframes),void 0!==e.duration&&(d=e.duration)}const b=at(u.delay,t,v)||0,M=p+b,w=M+d;let{offset:S=f(c.length)}=l;1===S.length&&0===S[0]&&(S[1]=1);const O=length-c.length;O>0&&h(S,O),1===c.length&&c.unshift(null),ot(o,c,g,S,M,w),y=Math.max(b+d,y),m=Math.max(w,m)}}d=p,p+=y}return o.forEach(((t,e)=>{for(const i in t){const o=t[i];o.sort(ct);const c=[],l=[],h=[];for(let t=0;t<o.length;t++){const{at:e,value:n,easing:r}=o[t];c.push(n),l.push(u(0,m,e)),h.push(r||a.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),h.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),s.push([e,i,c,Object.assign(Object.assign(Object.assign({},n),{duration:m,easing:h,offset:l}),r)])}})),s}(t,e),s=r.map((t=>Z(...t))).filter(Boolean);return L(s,null===(n=r[0])||void 0===n?void 0:n[3].duration)}function ut(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ht(t,e){return e[t]||(e[t]=[]),e[t]}"production"!==process.env.NODE_ENV&&(it=function(t,e){if(!t)throw new Error(e)});function ft(t,e,n){const a=Math.max(e-5,0);return r=n-t(a),(i=5)?r*(1e3/i):0;var r,i}const dt=100,pt=10,mt=1;const yt=({stiffness:t=dt,damping:e=pt,mass:n=mt,from:a=0,to:r=1,velocity:i=0,restSpeed:s=2,restDistance:o=.5}={})=>{i=i?p(i):0;const c={done:!1,hasReachedTarget:!1,current:a,target:r,velocity:i},l=((t=dt,e=pt,n=mt)=>e/(2*Math.sqrt(t*n)))(t,e,n),u=r-a,h=Math.sqrt(t/n)/1e3,f=((t,e)=>t*Math.sqrt(1-e*e))(h,l);let d;return d=l<1?t=>r-Math.exp(-l*h*t)*((l*h*u-i)/f*Math.sin(f*t)+u*Math.cos(f*t)):t=>r-Math.exp(-h*t)*(u+(i+h*u)*t),t=>{c.current=d(t),c.velocity=0===t?i:ft(d,t,c.current);const e=Math.abs(c.velocity)<=s,n=Math.abs(r-c.current)<=o;var l,u,h;return c.done=e&&n,c.hasReachedTarget=(l=a,u=r,h=c.current,l<u&&h>=u||l>u&&h<=u),c}};function gt(t){const e=new WeakMap;return(n={})=>{const a=new Map,r=(e=0,r=100,i=0,s=!1)=>{const o=`${e}-${r}-${i}-${s}`;return a.has(o)||a.set(o,t(Object.assign({from:e,to:r,velocity:i,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),a.get(o)},i=t=>(e.has(t)||e.set(t,function(t){let e,n=10,a=t(0);const r=[a.current];for(;!a.done&&n<1e4;)a=t(n),r.push(a.done?a.target:a.current),void 0===e&&a.hasReachedTarget&&(e=n),n+=10;const i=n-10;return 1===r.length&&r.push(a.current),{keyframes:r,duration:i/1e3,overshootDuration:(null!=e?e:i)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,a,s)=>{let o,c;const l=t.length;if(n&&l<=2&&t.every(vt)){const n=a&&s&&s.prevGeneratorState[a],u=n&&(1===l||2===l&&null===t[0])?n.velocity:0,h=t[l-1],f=1===l?null:t[0],d=null===f?n?n.current:parseFloat(e()):f;c=r(d,h,u,null==a?void 0:a.includes("scale"));const p=i(c);o=Object.assign(Object.assign({},p),{easing:"linear"})}else{c=r(0,100);o={easing:"ease",duration:i(c).overshootDuration}}return s&&a&&(s.generators[a]=c),o}}}}const vt=t=>"string"!=typeof t,bt=gt(yt),Mt=gt((({from:t=0,velocity:e=0,power:n=.8,decay:a=.325,bounceDamping:r,bounceStiffness:i,changeTarget:s,min:o,max:c,restDistance:l=.5,restSpeed:u})=>{a=d(a);const h={hasReachedTarget:!1,done:!1,current:t,target:t,velocity:e},f=t=>void 0===o?c:void 0===c||Math.abs(o-t)<Math.abs(c-t)?o:c;let p=n*e;const m=t+p,y=void 0===s?m:s(m);h.target=y,y!==m&&(p=y-t);const g=t=>-p*Math.exp(-t/a),v=t=>y+g(t),b=t=>{const n=g(t),a=v(t);h.done=Math.abs(n)<=l,h.current=h.done?y:a,h.velocity=0===t?e:ft(v,t,h.current)};let M,w;const S=t=>{var e;(e=h.current,void 0!==o&&e<o||void 0!==c&&e>c)&&(M=t,w=yt({from:h.current,to:f(h.current),velocity:h.velocity,damping:r,stiffness:i,restDistance:l,restSpeed:u}))};return S(0),t=>{let e=!1;return w||void 0!==M||(e=!0,b(t),S(t)),void 0!==M&&t>M?(h.hasReachedTarget=!0,w(t-M)):(h.hasReachedTarget=!1,!e&&b(t),h)}}));function wt(t,e){return L([()=>{const n=new W(t,[0,1],e);return n.finished.catch((()=>{})),n}],null==e?void 0:e.duration)}function St(t,e,n){return("function"==typeof t?wt:rt)(t,e,n)}export{St as animate,Mt as glide,bt as spring,nt as stagger,X as style,lt as timeline};
package/lib/animate.js ADDED
@@ -0,0 +1,16 @@
1
+ import { animate as animateDom, wrapAnimationWithControls, } from "@motionone/dom";
2
+ import { Animation } from "@motionone/animation";
3
+ export function animateProgress(target, options) {
4
+ return wrapAnimationWithControls([
5
+ () => {
6
+ const animation = new Animation(target, [0, 1], options);
7
+ animation.finished.catch(() => { });
8
+ return animation;
9
+ },
10
+ ], options === null || options === void 0 ? void 0 : options.duration);
11
+ }
12
+ export function animate(target, keyframesOrOptions, options) {
13
+ const animationFunction = typeof target === "function" ? animateProgress : animateDom;
14
+ return animationFunction(target, keyframesOrOptions, options);
15
+ }
16
+ //# sourceMappingURL=animate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animate.js","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,IAAI,UAAU,EAGrB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAOhD,MAAM,UAAU,eAAe,CAC7B,MAAwB,EACxB,OAA0B;IAE1B,OAAO,yBAAyB,CAC9B;QACE,GAAG,EAAE;YACH,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;YACxD,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAClC,OAAO,SAAS,CAAA;QAClB,CAAC;KACF,EACD,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAClB,CAAA;AACH,CAAC;AAWD,MAAM,UAAU,OAAO,CACrB,MAA2C,EAC3C,kBAAiE,EACjE,OAAuC;IAEvC,MAAM,iBAAiB,GACrB,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAA;IAE7D,OAAO,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAA;AAC/D,CAAC"}
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from "@motionone/dom";
1
+ export { timeline, stagger, spring, glide, style } from "@motionone/dom";
2
+ export { animate } from "./animate";
2
3
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motion",
3
3
  "description": "A tiny, performant animation library for the web",
4
- "version": "10.5.1",
4
+ "version": "10.6.0-rc.4",
5
5
  "license": "MIT",
6
6
  "author": "Matt Perry",
7
7
  "main": "dist/main.cjs.js",
@@ -18,13 +18,15 @@
18
18
  ],
19
19
  "sideEffects": false,
20
20
  "scripts": {
21
- "build": "rm -rf lib dist types && tsc -p . && rollup -c"
21
+ "build": "rm -rf lib dist types && tsc -p . && rollup -c",
22
+ "test": "jest --coverage --config jest.config.js"
22
23
  },
23
24
  "dependencies": {
24
- "@motionone/dom": "^10.5.0",
25
- "@motionone/react": "^10.5.0",
26
- "@motionone/svelte": "^10.5.0",
27
- "@motionone/vue": "^10.5.1"
25
+ "@motionone/animation": "^10.6.0-rc.4",
26
+ "@motionone/dom": "^10.6.0-rc.4",
27
+ "@motionone/react": "^10.6.0-rc.4",
28
+ "@motionone/svelte": "^10.6.0-rc.4",
29
+ "@motionone/vue": "^10.6.0-rc.4"
28
30
  },
29
- "gitHead": "c40fcbf8dc5859c0e4948032762e319f482bd247"
31
+ "gitHead": "e7a396e4a128cae6885d0a1a9abdc04c510d1a56"
30
32
  }
@@ -0,0 +1,6 @@
1
+ import { AcceptedElements, AnimationOptionsWithOverrides, MotionKeyframesDefinition } from "@motionone/dom";
2
+ import { AnimationControls, AnimationOptions, ProgressFunction } from "@motionone/types";
3
+ export declare function animateProgress(target: ProgressFunction, options?: AnimationOptions): AnimationControls;
4
+ export declare function animate(elements: AcceptedElements, keyframes: MotionKeyframesDefinition, options?: AnimationOptionsWithOverrides): AnimationControls;
5
+ export declare function animate(target: ProgressFunction, options?: AnimationOptions): AnimationControls;
6
+ //# sourceMappingURL=animate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,6BAA6B,EAC7B,yBAAyB,EAE1B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAEzB,wBAAgB,eAAe,CAC7B,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,gBAAgB,qBAY3B;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,yBAAyB,EACpC,OAAO,CAAC,EAAE,6BAA6B,GACtC,iBAAiB,CAAA;AACpB,wBAAgB,OAAO,CACrB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,iBAAiB,CAAA"}
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from "@motionone/dom";
1
+ export { timeline, stagger, spring, glide, style } from "@motionone/dom";
2
+ export { animate } from "./animate";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}