Socket
Socket
Sign inDemoInstall

@motionone/dom

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@motionone/dom - npm Package Compare versions

Comparing version 10.14.2 to 10.14.3

2

dist/size-timeline.js

@@ -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=(t,e,n)=>Math.min(Math.max(n,t),e),i={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,s=t=>Array.isArray(t)&&!a(t[0]);function r(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}const 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))}}function f(t){const e=[0];return h(e,t-1),e}const d=t=>Array.isArray(t)&&a(t[0]),p=t=>"object"==typeof t&&Boolean(t.createAnimation),m=t=>"function"==typeof t,y=t=>"string"==typeof t,g=t=>1e3*t,v=t=>t/1e3,O=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function b(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=O(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:O(a(t),e,i)}const w={ease:b(.25,.1,.25,1),"ease-in":b(.42,0,1,1),"ease-in-out":b(.42,0,.58,1),"ease-out":b(0,0,.58,1)},S=/\((.*?)\)/;function T(t){if(m(t))return t;if(d(t))return b(...t);if(w[t])return w[t];if(t.startsWith("steps")){const e=S.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>i=>{const a=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,s="end"===e?Math.floor(a):Math.ceil(a);return n(0,1,s/t)})(parseFloat(t[0]),t[1].trim())}}return c}class x{constructor(t,e=[0,1],{easing:a,duration:l=i.duration,delay:d=i.delay,endDelay:m=i.endDelay,repeat:y=i.repeat,offset:g,direction:v="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=c,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),a=a||i.easing,p(a)){const t=a.createAnimation(e);a=t.easing,e=t.keyframes||e,l=t.duration||l}this.repeat=y,this.easing=s(a)?c:T(a),this.updateDuration(l);const O=function(t,e=f(t.length),i=c){const a=t.length,s=a-e.length;return s>0&&h(e,s),s=>{let l=0;for(;l<a-2&&!(s<e[l+1]);l++);let c=n(0,1,u(e[l],e[l+1],s));return c=r(i,l)(c),o(t[l],t[l+1],c)}}(e,g,s(a)?a.map(T):c);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-d,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const a=i/this.duration;let s=Math.floor(a),r=a%1;!r&&a>=1&&(r=1),1===r&&s--;const o=s%2;("reverse"===v||"alternate"===v&&o||"alternate-reverse"===v&&!o)&&(r=1-r);const l=i>=this.totalDuration?1:Math.min(r,1),c=O(this.easing(l));t(c);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+m)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,c)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}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(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 A(t,e,n){return m(t)?t(e,n):t}class D{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const M=new WeakMap;function E(t){return M.has(t)||M.set(t,{transforms:[],values:new Map}),M.get(t)}const k=["","X","Y","Z"],j={x:"translateX",y:"translateY",z:"translateZ"},P={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},R={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:P,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:P},V=new Map,$=t=>`--motion-${t}`,q=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{q.push(t+e),V.set($(t+e),R[t])}))}));const F=(t,e)=>q.indexOf(t)-q.indexOf(e),I=new Set(q),U=t=>I.has(t),W=t=>t.sort(F).reduce(_,"").trim(),_=(t,e)=>`${t} ${e}(var(${$(e)}))`,C=t=>t.startsWith("--"),z=new Set;const B=(t,e)=>document.createElement("div").animate(t,e),N={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]},{duration:.001}).finished),linearEasing:()=>{try{B({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},K={},X={};for(const t in N)X[t]=()=>(void 0===K[t]&&(K[t]=N[t]()),K[t]);const Y=(t,e)=>m(t)?X.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(u(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:i.easing:d(t)?Z(t):t,Z=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const L=t=>Array.isArray(t)?t:[t];function G(t){return j[t]&&(t=j[t]),U(t)?$(t):t}const H=(t,e)=>{e=G(e);let n=C(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=V.get(e);t&&(n=t.initialValue)}return n},J=(t,e,n)=>{e=G(e),C(e)?t.style.setProperty(e,n):t.style[e]=n};function Q(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function tt(t,e,n,r={},o){const u=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==r.record&&u;let f,{duration:d=i.duration,delay:v=i.delay,endDelay:O=i.endDelay,repeat:b=i.repeat,easing:w=i.easing,direction:S,offset:T,allowWebkitAcceleration:x=!1}=r;const A=E(t),M=U(e);let k=X.waapi();M&&((t,e)=>{j[e]&&(e=j[e]);const{transforms:n}=E(t);var i,a;a=e,-1===(i=n).indexOf(a)&&i.push(a),t.style.transform=W(n)})(t,e);const P=G(e),R=function(t,e){return t.has(e)||t.set(e,new D),t.get(e)}(A.values,P),$=V.get(P);return Q(R.animation,!(p(w)&&R.generator)&&!1!==r.record),()=>{const i=()=>{var e,n;return null!==(n=null!==(e=H(t,P))&&void 0!==e?e:null==$?void 0:$.initialValue)&&void 0!==n?n:0};let A=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(L(n),i);const D=function(t,e){var n;let i=(null==e?void 0:e.toDefaultUnit)||c;const a=t[t.length-1];if(y(a)){const t=(null===(n=a.match(/(-?[\d.]+)([a-z%]*)/))||void 0===n?void 0:n[2])||"";t&&(i=e=>e+t)}return i}(A,$);if(p(w)){const t=w.createAnimation(A,"opacity"!==e,i,P,R);w=t.easing,A=t.keyframes||A,d=t.duration||d}if(C(P)&&(X.cssRegisterProperty()?function(t){if(!z.has(t)){z.add(t);try{const{syntax:e,initialValue:n}=V.has(t)?V.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):k=!1),M&&!X.linearEasing()&&(m(w)||s(w)&&w.some(m))&&(k=!1),k){$&&(A=A.map((t=>a(t)?$.toDefaultUnit(t):t))),1!==A.length||X.partialKeyframes()&&!h||A.unshift(i());const e={delay:g(v),duration:g(d),endDelay:g(O),easing:s(w)?void 0:Y(w,d),direction:S,iterations:b+1,fill:"both"};f=t.animate({[P]:A,offset:T,easing:s(w)?w.map((t=>Y(t,d))):void 0},e),f.finished||(f.finished=new Promise(((t,e)=>{f.onfinish=t,f.oncancel=e})));const n=A[A.length-1];f.finished.then((()=>{J(t,P,n),f.cancel()})).catch(l),x||(f.playbackRate=1.000001)}else if(o&&M)A=A.map((t=>"string"==typeof t?parseFloat(t):t)),1===A.length&&A.unshift(parseFloat(i())),f=new o((e=>{J(t,P,D?D(e):e)}),A,Object.assign(Object.assign({},r),{duration:d,easing:w}));else{const e=A[A.length-1];J(t,P,$&&a(e)?$.toDefaultUnit(e):e)}return h&&u(t,e,A,{duration:d,delay:v,easing:w,repeat:b,offset:T},"motion-one"),R.setAnimation(f),f}}const et=t=>t(),nt={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return v((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(it)).catch(l)),t.finished;case"stop":return()=>{t.animations.forEach((t=>Q(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=g(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},it=t=>t.finished,at=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function st(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 rt(t,e,n,i){var s;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(s=i.get(e))&&void 0!==s?s:t}function ot(t,n,i,a,s,l){!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,l);for(let e=0;e<n.length;e++)t.push({value:n[e],at:o(s,l,a[e]),easing:r(i,e)})}function lt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ct(t,e={}){var n;const a=ut(t,e),s=a.map((t=>tt(...t,x))).filter(Boolean);return((t,e,n=i.duration)=>new Proxy({animations:t.map(et).filter(Boolean),duration:n,options:e},nt))(s,e,null===(n=a[0])||void 0===n?void 0:n[3].duration)}function ut(e,n={}){var{defaultOptions:a={}}=n,s=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}(n,["defaultOptions"]);const r=[],o=new Map,l={},c=new Map;let d=0,m=0,g=0;for(let n=0;n<e.length;n++){const s=e[n];if(y(s)){c.set(s,m);continue}if(!Array.isArray(s)){c.set(s.name,rt(m,s.at,d,c));continue}const[r,u,v={}]=s;void 0!==v.at&&(m=rt(m,v.at,d,c));let O=0;const b=st(r,l),w=b.length;for(let e=0;e<w;e++){const n=ht(b[e],o);for(const s in u){const r=ft(s,n);let o=L(u[s]);const l=at(v,s);let{duration:c=a.duration||i.duration,easing:d=a.easing||i.easing}=l;if(p(d)){t("opacity"===s||o.length>1,"spring must be provided 2 keyframes within timeline()");const e=d.createAnimation(o,"opacity"!==s,(()=>0),s);d=e.easing,o=e.keyframes||o,c=e.duration||c}const y=A(v.delay,e,w)||0,b=m+y,S=b+c;let{offset:T=f(o.length)}=l;1===T.length&&0===T[0]&&(T[1]=1);const x=length-o.length;x>0&&h(T,x),1===o.length&&o.unshift(null),ot(r,o,d,T,b,S),O=Math.max(y+c,O),g=Math.max(S,g)}}d=m,m+=O}return o.forEach(((t,e)=>{for(const n in t){const o=t[n];o.sort(lt);const l=[],c=[],h=[];for(let t=0;t<o.length;t++){const{at:e,value:n,easing:a}=o[t];l.push(n),c.push(u(0,g,e)),h.push(a||i.easing)}0!==c[0]&&(c.unshift(0),l.unshift(l[0]),h.unshift("linear")),1!==c[c.length-1]&&(c.push(1),l.push(null)),r.push([e,n,l,Object.assign(Object.assign(Object.assign({},a),{duration:g,easing:h,offset:c}),s)])}})),r}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]}export{ut as createAnimationsFromTimeline,ct 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=(t,e,n)=>Math.min(Math.max(n,t),e),i={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,s=t=>Array.isArray(t)&&!a(t[0]);function r(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}const 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))}}function f(t){const e=[0];return h(e,t-1),e}const d=t=>Array.isArray(t)&&a(t[0]),p=t=>"object"==typeof t&&Boolean(t.createAnimation),m=t=>"function"==typeof t,y=t=>"string"==typeof t,g=t=>1e3*t,v=t=>t/1e3,O=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function b(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=O(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:O(a(t),e,i)}const w={ease:b(.25,.1,.25,1),"ease-in":b(.42,0,1,1),"ease-in-out":b(.42,0,.58,1),"ease-out":b(0,0,.58,1)},S=/\((.*?)\)/;function T(t){if(m(t))return t;if(d(t))return b(...t);if(w[t])return w[t];if(t.startsWith("steps")){const e=S.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>i=>{const a=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,s="end"===e?Math.floor(a):Math.ceil(a);return n(0,1,s/t)})(parseFloat(t[0]),t[1].trim())}}return c}class x{constructor(t,e=[0,1],{easing:a,duration:l=i.duration,delay:d=i.delay,endDelay:m=i.endDelay,repeat:y=i.repeat,offset:g,direction:v="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=c,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),a=a||i.easing,p(a)){const t=a.createAnimation(e);a=t.easing,e=t.keyframes||e,l=t.duration||l}this.repeat=y,this.easing=s(a)?c:T(a),this.updateDuration(l);const O=function(t,e=f(t.length),i=c){const a=t.length,s=a-e.length;return s>0&&h(e,s),s=>{let l=0;for(;l<a-2&&!(s<e[l+1]);l++);let c=n(0,1,u(e[l],e[l+1],s));return c=r(i,l)(c),o(t[l],t[l+1],c)}}(e,g,s(a)?a.map(T):c);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-d,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const a=i/this.duration;let s=Math.floor(a),r=a%1;!r&&a>=1&&(r=1),1===r&&s--;const o=s%2;("reverse"===v||"alternate"===v&&o||"alternate-reverse"===v&&!o)&&(r=1-r);const l=i>=this.totalDuration?1:Math.min(r,1),c=O(this.easing(l));t(c);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+m)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,c)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}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(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 A(t,e,n){return m(t)?t(e,n):t}class D{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const M=new WeakMap;function E(t){return M.has(t)||M.set(t,{transforms:[],values:new Map}),M.get(t)}const k=["","X","Y","Z"],j={x:"translateX",y:"translateY",z:"translateZ"},P={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},R={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:P,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:c},skew:P},V=new Map,$=t=>`--motion-${t}`,q=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{k.forEach((e=>{q.push(t+e),V.set($(t+e),R[t])}))}));const F=(t,e)=>q.indexOf(t)-q.indexOf(e),I=new Set(q),U=t=>I.has(t),W=t=>t.sort(F).reduce(_,"").trim(),_=(t,e)=>`${t} ${e}(var(${$(e)}))`,C=t=>t.startsWith("--"),z=new Set;const B=(t,e)=>document.createElement("div").animate(t,e),N={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]},{duration:.001}).finished),linearEasing:()=>{try{B({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},K={},X={};for(const t in N)X[t]=()=>(void 0===K[t]&&(K[t]=N[t]()),K[t]);const Y=(t,e)=>m(t)?X.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(u(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:i.easing:d(t)?Z(t):t,Z=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const L=t=>Array.isArray(t)?t:[t];function G(t){return j[t]&&(t=j[t]),U(t)?$(t):t}const H=(t,e)=>{e=G(e);let n=C(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=V.get(e);t&&(n=t.initialValue)}return n},J=(t,e,n)=>{e=G(e),C(e)?t.style.setProperty(e,n):t.style[e]=n};function Q(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function tt(t,e,n,r={},o){const u=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==r.record&&u;let f,{duration:d=i.duration,delay:v=i.delay,endDelay:O=i.endDelay,repeat:b=i.repeat,easing:w=i.easing,direction:S,offset:T,allowWebkitAcceleration:x=!1}=r;const A=E(t),M=U(e);let k=X.waapi();M&&((t,e)=>{j[e]&&(e=j[e]);const{transforms:n}=E(t);var i,a;a=e,-1===(i=n).indexOf(a)&&i.push(a),t.style.transform=W(n)})(t,e);const P=G(e),R=function(t,e){return t.has(e)||t.set(e,new D),t.get(e)}(A.values,P),$=V.get(P);return Q(R.animation,!(p(w)&&R.generator)&&!1!==r.record),()=>{const i=()=>{var e,n;return null!==(n=null!==(e=H(t,P))&&void 0!==e?e:null==$?void 0:$.initialValue)&&void 0!==n?n:0};let A=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(L(n),i);const D=function(t,e){var n;let i=(null==e?void 0:e.toDefaultUnit)||c;const a=t[t.length-1];if(y(a)){const t=(null===(n=a.match(/(-?[\d.]+)([a-z%]*)/))||void 0===n?void 0:n[2])||"";t&&(i=e=>e+t)}return i}(A,$);if(p(w)){const t=w.createAnimation(A,"opacity"!==e,i,P,R);w=t.easing,A=t.keyframes||A,d=t.duration||d}if(C(P)&&(X.cssRegisterProperty()?function(t){if(!z.has(t)){z.add(t);try{const{syntax:e,initialValue:n}=V.has(t)?V.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(P):k=!1),M&&!X.linearEasing()&&(m(w)||s(w)&&w.some(m))&&(k=!1),k){$&&(A=A.map((t=>a(t)?$.toDefaultUnit(t):t))),1!==A.length||X.partialKeyframes()&&!h||A.unshift(i());const e={delay:g(v),duration:g(d),endDelay:g(O),easing:s(w)?void 0:Y(w,d),direction:S,iterations:b+1,fill:"both"};f=t.animate({[P]:A,offset:T,easing:s(w)?w.map((t=>Y(t,d))):void 0},e),f.finished||(f.finished=new Promise(((t,e)=>{f.onfinish=t,f.oncancel=e})));const n=A[A.length-1];f.finished.then((()=>{J(t,P,n),f.cancel()})).catch(l),x||(f.playbackRate=1.000001)}else if(o&&M)A=A.map((t=>"string"==typeof t?parseFloat(t):t)),1===A.length&&A.unshift(parseFloat(i())),f=new o((e=>{J(t,P,D?D(e):e)}),A,Object.assign(Object.assign({},r),{duration:d,easing:w}));else{const e=A[A.length-1];J(t,P,$&&a(e)?$.toDefaultUnit(e):e)}return h&&u(t,e,A,{duration:d,delay:v,easing:w,repeat:b,offset:T},"motion-one"),R.setAnimation(f),f}}const et=t=>t(),nt={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return v((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(it)).catch(l)),t.finished;case"stop":return()=>{t.animations.forEach((t=>Q(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=g(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},it=t=>t.finished,at=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function st(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 rt(t,e,n,i){var s;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(s=i.get(e))&&void 0!==s?s:t}function ot(t,n,i,a,s,l){!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,l);for(let e=0;e<n.length;e++)t.push({value:n[e],at:o(s,l,a[e]),easing:r(i,e)})}function lt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ct(t,e={}){var n;const a=ut(t,e),s=a.map((t=>tt(...t,x))).filter(Boolean);return((t,e,n=i.duration)=>new Proxy({animations:t.map(et).filter(Boolean),duration:n,options:e},nt))(s,e,null===(n=a[0])||void 0===n?void 0:n[3].duration)}function ut(e,n={}){var{defaultOptions:a={}}=n,s=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}(n,["defaultOptions"]);const r=[],o=new Map,l={},c=new Map;let d=0,m=0,g=0;for(let n=0;n<e.length;n++){const s=e[n];if(y(s)){c.set(s,m);continue}if(!Array.isArray(s)){c.set(s.name,rt(m,s.at,d,c));continue}const[r,u,v={}]=s;void 0!==v.at&&(m=rt(m,v.at,d,c));let O=0;const b=st(r,l),w=b.length;for(let e=0;e<w;e++){const n=ht(b[e],o);for(const s in u){const r=ft(s,n);let o=L(u[s]);const l=at(v,s);let{duration:c=a.duration||i.duration,easing:d=a.easing||i.easing}=l;if(p(d)){t("opacity"===s||o.length>1,"spring must be provided 2 keyframes within timeline()");const e=d.createAnimation(o,"opacity"!==s,(()=>0),s);d=e.easing,o=e.keyframes||o,c=e.duration||c}const y=A(v.delay,e,w)||0,b=m+y,S=b+c;let{offset:T=f(o.length)}=l;1===T.length&&0===T[0]&&(T[1]=1);const x=T.length-o.length;x>0&&h(T,x),1===o.length&&o.unshift(null),ot(r,o,d,T,b,S),O=Math.max(y+c,O),g=Math.max(S,g)}}d=m,m+=O}return o.forEach(((t,e)=>{for(const n in t){const o=t[n];o.sort(lt);const l=[],c=[],h=[];for(let t=0;t<o.length;t++){const{at:e,value:n,easing:a}=o[t];l.push(n),c.push(u(0,g,e)),h.push(a||i.easing)}0!==c[0]&&(c.unshift(0),l.unshift(l[0]),h.unshift("linear")),1!==c[c.length-1]&&(c.push(1),l.push(null)),r.push([e,n,l,Object.assign(Object.assign(Object.assign({},a),{duration:g,easing:h,offset:c}),s)])}})),r}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]}export{ut as createAnimationsFromTimeline,ct as timeline};

@@ -111,3 +111,3 @@ 'use strict';

*/
const remainder = length - valueKeyframes.length;
const remainder = offset.length - valueKeyframes.length;
remainder > 0 && utils.fillOffset(offset, remainder);

@@ -114,0 +114,0 @@ /**

@@ -107,3 +107,3 @@ import { __rest } from 'tslib';

*/
const remainder = length - valueKeyframes.length;
const remainder = offset.length - valueKeyframes.length;
remainder > 0 && fillOffset(offset, remainder);

@@ -110,0 +110,0 @@ /**

@@ -106,3 +106,3 @@ import { __rest } from "tslib";

*/
const remainder = length - valueKeyframes.length;
const remainder = offset.length - valueKeyframes.length;
remainder > 0 && fillOffset(offset, remainder);

@@ -109,0 +109,0 @@ /**

{
"name": "@motionone/dom",
"version": "10.14.2",
"version": "10.14.3",
"description": "A tiny, performant animation library for the DOM",

@@ -59,3 +59,3 @@ "license": "MIT",

],
"gitHead": "1e7de058e678b02fd77aff9f9fb239f84788feb5"
"gitHead": "748704410eefea83faa15e2984d6a7b257b1a8fc"
}

@@ -5,3 +5,3 @@ import type { AnimationOptionsWithOverrides, MotionKeyframesDefinition } from "./types";

import type { Animation } from "@motionone/animation";
export declare function createAnimate(AnimatePolyfill: typeof Animation): (elements: ElementOrSelector, keyframes: MotionKeyframesDefinition, options?: AnimationOptionsWithOverrides) => AnimationControls;
export declare function createAnimate(AnimatePolyfill?: typeof Animation): (elements: ElementOrSelector, keyframes: MotionKeyframesDefinition, options?: AnimationOptionsWithOverrides) => AnimationControls;
//# sourceMappingURL=create-animate.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc