framer-motion 12.4.11 → 12.4.13

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.
@@ -0,0 +1 @@
1
+ const e=e=>e;let t=e;const n=(e,t,n)=>{const r=t-e;return 0===r?1:(n-e)/r},r=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(()=>void 0!==window.ScrollTimeline);const s=["read","resolveKeyframes","update","preRender","render","postRender"],o={value:null,addProjectionMetrics:null};const{schedule:i,cancel:a,state:c,steps:u}=function(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,c=s.reduce((e,n)=>(e[n]=function(e,t){let n=new Set,r=new Set,s=!1,i=!1;const a=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1},u=0;function l(t){a.has(t)&&(f.schedule(t),e()),u++,t(c)}const f={schedule:(e,t=!1,o=!1)=>{const i=o&&s?n:r;return t&&a.add(e),i.has(e)||i.add(e),e},cancel:e=>{r.delete(e),a.delete(e)},process:e=>{c=e,s?i=!0:(s=!0,[n,r]=[r,n],n.forEach(l),t&&o.value&&o.value.frameloop[t].push(u),u=0,n.clear(),s=!1,i&&(i=!1,f.process(e)))}};return f}(a,t?n:void 0),e),{}),{read:u,resolveKeyframes:l,update:f,preRender:d,render:h,postRender:g}=c,p=()=>{const s=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(s-i.timestamp,40),1),i.timestamp=s,i.isProcessing=!0,u.process(i),l.process(i),f.process(i),d.process(i),h.process(i),g.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(p))};return{schedule:s.reduce((t,s)=>{const o=c[s];return t[s]=(t,s=!1,a=!1)=>(n||(n=!0,r=!0,i.isProcessing||e(p)),o.schedule(t,s,a)),t},{}),cancel:e=>{for(let t=0;t<s.length;t++)c[s[t]].cancel(e)},state:i,steps:c}}("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:e,!0);function l(e,t){let n;const r=()=>{const{currentTime:r}=t,s=(null===r?0:r.value)/100;n!==s&&e(s),n=s};return i.update(r,!0),()=>a(r)}const f=new WeakMap;let d;function h({target:e,contentRect:t,borderBoxSize:n}){var r;null===(r=f.get(e))||void 0===r||r.forEach(r=>{r({target:e,contentSize:t,get size(){return function(e,t){if(t){const{inlineSize:e,blockSize:n}=t[0];return{width:e,height:n}}return e instanceof SVGElement&&"getBBox"in e?e.getBBox():{width:e.offsetWidth,height:e.offsetHeight}}(e,n)}})})}function g(e){e.forEach(h)}function p(e,t){d||"undefined"!=typeof ResizeObserver&&(d=new ResizeObserver(g));const n=function(e,t,n){var r;if(e instanceof EventTarget)return[e];if("string"==typeof e){let s=document;t&&(s=t.current);const o=null!==(r=null==n?void 0:n[e])&&void 0!==r?r:s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}(e);return n.forEach(e=>{let n=f.get(e);n||(n=new Set,f.set(e,n)),n.add(t),null==d||d.observe(e)}),()=>{n.forEach(e=>{const n=f.get(e);null==n||n.delete(t),(null==n?void 0:n.size)||null==d||d.unobserve(e)})}}const m=new Set;let v;function y(e){return m.add(e),v||(v=()=>{const e={width:window.innerWidth,height:window.innerHeight},t={target:window,size:e,contentSize:e};m.forEach(e=>e(t))},window.addEventListener("resize",v)),()=>{m.delete(e),!m.size&&v&&(v=void 0)}}const b={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function w(e,t,r,s){const o=r[t],{length:i,position:a}=b[t],c=o.current,u=r.time;o.current=e["scroll"+a],o.scrollLength=e["scroll"+i]-e["client"+i],o.offset.length=0,o.offset[0]=0,o.offset[1]=o.scrollLength,o.progress=n(0,o.scrollLength,o.current);const l=s-u;var f,d;o.velocity=l>50?0:(f=o.current-c,(d=l)?f*(1e3/d):0)}const x=(e,t,n)=>n>t?t:n<e?e:n,E=(e,t,n)=>e+(t-e)*n;function W(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}const L={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},S={...L,transform:e=>x(0,1,e)},M=e=>Math.round(1e5*e)/1e5,z=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const A=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,B=(e,t)=>n=>Boolean("string"==typeof n&&A.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),O=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[s,o,i,a]=r.match(z);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:void 0!==a?parseFloat(a):1}},T={...L,transform:e=>Math.round((e=>x(0,255,e))(e))},H={test:B("rgb","red"),parse:O("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+T.transform(e)+", "+T.transform(t)+", "+T.transform(n)+", "+M(S.transform(r))+")"};const F={test:B("#"),parse:function(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}},transform:H.transform},P=(e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}))("%"),R={test:B("hsl","hue"),parse:O("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+P.transform(M(t))+", "+P.transform(M(n))+", "+M(S.transform(r))+")"};function N(e,t){return n=>n>0?t:e}const k=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},$=[F,H,R];function q(e){const t=(n=e,$.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let r=t.parse(e);return t===R&&(r=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let s=0,o=0,i=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;s=W(a,r,e+1/3),o=W(a,r,e),i=W(a,r,e-1/3)}else s=o=i=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*i),alpha:r}}(r)),r}const I=(e,t)=>{const n=q(e),r=q(t);if(!n||!r)return N(e,t);const s={...n};return e=>(s.red=k(n.red,r.red,e),s.green=k(n.green,r.green,e),s.blue=k(n.blue,r.blue,e),s.alpha=E(n.alpha,r.alpha,e),H.transform(s))},j=(e,t)=>n=>t(e(n)),G=(...e)=>e.reduce(j),C=e=>H.test(e)||F.test(e)||R.test(e),K=e=>H.test(e)?H.parse(e):R.test(e)?R.parse(e):F.parse(e),V=e=>"string"==typeof e?e:e.hasOwnProperty("red")?H.transform(e):R.transform(e),D=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const J=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Q(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const i=t.replace(J,e=>(C(e)?(r.color.push(o),s.push("color"),n.push(K(e))):e.startsWith("var(")?(r.var.push(o),s.push("var"),n.push(e)):(r.number.push(o),s.push("number"),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:i,indexes:r,types:s}}function U(e){return Q(e).values}function X(e){const{split:t,types:n}=Q(e),r=t.length;return e=>{let s="";for(let o=0;o<r;o++)if(s+=t[o],void 0!==e[o]){const t=n[o];s+="number"===t?M(e[o]):"color"===t?V(e[o]):e[o]}return s}}const Y=e=>"number"==typeof e?0:e;const Z={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null===(t=e.match(z))||void 0===t?void 0:t.length)||0)+((null===(n=e.match(D))||void 0===n?void 0:n.length)||0)>0},parse:U,createTransformer:X,getAnimatableNone:function(e){const t=U(e);return X(e)(t.map(Y))}},_=(e=>t=>"string"==typeof t&&t.startsWith(e))("var(--"),ee=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,te=new Set(["none","hidden"]);function ne(e,t){return n=>E(e,t,n)}function re(e){return"number"==typeof e?ne:"string"==typeof e?_(t=e)&&ee.test(t.split("/*")[0].trim())?N:C(e)?I:ie:Array.isArray(e)?se:"object"==typeof e?C(e)?I:oe:N;var t}function se(e,t){const n=[...e],r=n.length,s=e.map((e,n)=>re(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=s[t](e);return n}}function oe(e,t){const n={...e,...t},r={};for(const s in n)void 0!==e[s]&&void 0!==t[s]&&(r[s]=re(e[s])(e[s],t[s]));return e=>{for(const t in r)n[t]=r[t](e);return n}}const ie=(e,t)=>{const n=Z.createTransformer(t),r=Q(e),s=Q(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?te.has(e)&&!s.values.length||te.has(t)&&!r.values.length?function(e,t){return te.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):G(se(function(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const i=t.types[o],a=e.indexes[i][s[i]],c=null!==(n=e.values[a])&&void 0!==n?n:0;r[o]=c,s[i]++}return r}(r,s),s.values),n):N(e,t)};function ae(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return E(e,t,n);return re(e)(e,t)}function ce(r,s,{clamp:o=!0,ease:i,mixer:a}={}){const c=r.length;if(t(c===s.length),1===c)return()=>s[0];if(2===c&&s[0]===s[1])return()=>s[1];const u=r[0]===r[1];r[0]>r[c-1]&&(r=[...r].reverse(),s=[...s].reverse());const l=function(t,n,r){const s=[],o=r||ae,i=t.length-1;for(let r=0;r<i;r++){let i=o(t[r],t[r+1]);if(n){const t=Array.isArray(n)?n[r]||e:n;i=G(t,i)}s.push(i)}return s}(s,i,a),f=l.length,d=e=>{if(u&&e<r[0])return s[0];let t=0;if(f>1)for(;t<r.length-2&&!(e<r[t+1]);t++);const o=n(r[t],r[t+1],e);return l[t](o)};return o?e=>d(x(r[0],r[c-1],e)):d}function ue(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let s=1;s<=t;s++){const o=n(0,t,s);e.push(E(r,1,o))}}(t,e.length-1),t}const le={start:0,center:.5,end:1};function fe(e,t,n=0){let r=0;if(e in le&&(e=le[e]),"string"==typeof e){const t=parseFloat(e);e.endsWith("px")?r=t:e.endsWith("%")?e=t/100:e.endsWith("vw")?r=t/100*document.documentElement.clientWidth:e.endsWith("vh")?r=t/100*document.documentElement.clientHeight:e=t}return"number"==typeof e&&(r=t*e),n+r}const de=[0,0];function he(e,t,n,r){let s=Array.isArray(e)?e:de,o=0,i=0;return"number"==typeof e?s=[e,e]:"string"==typeof e&&(s=(e=e.trim()).includes(" ")?e.split(" "):[e,le[e]?e:"0"]),o=fe(s[0],n,r),i=fe(s[1],t),o-i}const ge={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},pe={x:0,y:0};function me(e,t,n){const{offset:r=ge.All}=n,{target:s=e,axis:o="y"}=n,i="y"===o?"height":"width",a=s!==e?function(e,t){const n={x:0,y:0};let r=e;for(;r&&r!==t;)if(r instanceof HTMLElement)n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if("svg"===r.tagName){const e=r.getBoundingClientRect();r=r.parentElement;const t=r.getBoundingClientRect();n.x+=e.left-t.left,n.y+=e.top-t.top}else{if(!(r instanceof SVGGraphicsElement))break;{const{x:e,y:t}=r.getBBox();n.x+=e,n.y+=t;let s=null,o=r.parentNode;for(;!s;)"svg"===o.tagName&&(s=o),o=r.parentNode;r=s}}return n}(s,e):pe,c=s===e?{width:e.scrollWidth,height:e.scrollHeight}:function(e){return"getBBox"in e&&"svg"!==e.tagName?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}(s),u={width:e.clientWidth,height:e.clientHeight};t[o].offset.length=0;let l=!t[o].interpolate;const f=r.length;for(let e=0;e<f;e++){const n=he(r[e],u[i],c[i],a[o]);l||n===t[o].interpolatorOffsets[e]||(l=!0),t[o].offset[e]=n}l&&(t[o].interpolate=ce(t[o].offset,ue(r),{clamp:!1}),t[o].interpolatorOffsets=[...t[o].offset]),t[o].progress=x(0,1,t[o].interpolate(t[o].current))}function ve(e,t,n,r={}){return{measure:()=>function(e,t=e,n){if(n.x.targetOffset=0,n.y.targetOffset=0,t!==e){let r=t;for(;r&&r!==e;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=t===e?t.scrollWidth:t.clientWidth,n.y.targetLength=t===e?t.scrollHeight:t.clientHeight,n.x.containerLength=e.clientWidth,n.y.containerLength=e.clientHeight}(e,r.target,n),update:t=>{!function(e,t,n){w(e,"x",t,n),w(e,"y",t,n),t.time=n}(e,n,t),(r.offset||r.target)&&me(e,n,r)},notify:()=>t(n)}}const ye=new WeakMap,be=new WeakMap,we=new WeakMap,xe=e=>e===document.documentElement?window:e;function Ee(e,{container:t=document.documentElement,...n}={}){let r=we.get(t);r||(r=new Set,we.set(t,r));const s=ve(t,e,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},n);if(r.add(s),!ye.has(t)){const e=()=>{for(const e of r)e.measure()},n=()=>{for(const e of r)e.update(c.timestamp)},s=()=>{for(const e of r)e.notify()},a=()=>{i.read(e,!1,!0),i.read(n,!1,!0),i.update(s,!1,!0)};ye.set(t,a);const l=xe(t);window.addEventListener("resize",a,{passive:!0}),t!==document.documentElement&&be.set(t,(u=a,"function"==typeof(o=t)?y(o):p(o,u))),l.addEventListener("scroll",a,{passive:!0})}var o,u;const l=ye.get(t);return i.read(l,!1,!0),()=>{var e;a(l);const n=we.get(t);if(!n)return;if(n.delete(s),n.size)return;const r=ye.get(t);ye.delete(t),r&&(xe(t).removeEventListener("scroll",r),null===(e=be.get(t))||void 0===e||e(),window.removeEventListener("resize",r))}}const We=new Map;function Le({source:e,container:t=document.documentElement,axis:n="y"}={}){e&&(t=e),We.has(t)||We.set(t,{});const s=We.get(t);return s[n]||(s[n]=r()?new ScrollTimeline({source:t,axis:n}):function({source:e,container:t,axis:n="y"}){e&&(t=e);const r={value:0},s=Ee(e=>{r.value=100*e[n].progress},{container:t,axis:n});return{currentTime:r,cancel:s}}({source:t,axis:n})),s[n]}function Se(e){return e&&(e.target||e.offset)}function Me(t,{axis:n="y",...r}={}){const s={axis:n,...r};return"function"==typeof t?function(e,t){return function(e){return 2===e.length}(e)||Se(t)?Ee(n=>{e(n[t.axis].progress,n)},t):l(e,Le(t))}(t,s):function(t,n){if(t.flatten(),Se(n))return t.pause(),Ee(e=>{t.time=t.duration*e[n.axis].progress},n);{const r=Le(n);return t.attachTimeline?t.attachTimeline(r,e=>(e.pause(),l(t=>{e.time=e.duration*t},r))):e}}(t,s)}export{Me as scroll};
@@ -0,0 +1 @@
1
+ const t=t=>t;let e=t;function i(t){let e;return()=>(void 0===e&&(e=t()),e)}const n=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n},a=t=>1e3*t,s=t=>t/1e3,o=i(()=>void 0!==window.ScrollTimeline);class r extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=e}attachTimeline(t,e){const i=this.animations.map(i=>o()&&i.attachTimeline?i.attachTimeline(t):"function"==typeof e?e(i):void 0);return()=>{i.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}const l={linearEasing:void 0};function u(t,e){const n=i(t);return()=>{var t;return null!==(t=l[e])&&void 0!==t?t:n()}}const h=u(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),m=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,c={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:m([0,.65,.55,1]),circOut:m([.55,0,1,.45]),backIn:m([.31,.01,.66,-.59]),backOut:m([.33,1.53,.69,.99])};function d(t,e){return t?"function"==typeof t&&h()?((t,e,i=10)=>{let a="";const s=Math.max(Math.round(e/i),2);for(let e=0;e<s;e++)a+=t(n(0,s-1,e))+", ";return`linear(${a.substring(0,a.length-2)})`})(t,e):(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?m(t):Array.isArray(t)?t.map(t=>d(t,e)||c.easeOut):c[t]:void 0}const p=(t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}))("px"),f={borderWidth:p,borderTopWidth:p,borderRightWidth:p,borderBottomWidth:p,borderLeftWidth:p,borderRadius:p,radius:p,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,width:p,maxWidth:p,height:p,maxHeight:p,top:p,right:p,bottom:p,left:p,padding:p,paddingTop:p,paddingRight:p,paddingBottom:p,paddingLeft:p,margin:p,marginTop:p,marginRight:p,marginBottom:p,marginLeft:p,backgroundPositionX:p,backgroundPositionY:p},y=t=>null!==t;function g(t,e,i){t.style.setProperty(e,i)}function v(t,e,i){t.style[e]=i}const A=i(()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0}),b=i(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),T=new WeakMap;function P(t){const e=T.get(t)||new Map;return T.set(t,e),T.get(t)}class w extends class{constructor(t){this.animation=t}get duration(){var t,e,i;const n=(null===(e=null===(t=this.animation)||void 0===t?void 0:t.effect)||void 0===e?void 0:e.getComputedTiming().duration)||(null===(i=this.options)||void 0===i?void 0:i.duration)||300;return s(Number(n))}get time(){var t;return this.animation?s((null===(t=this.animation)||void 0===t?void 0:t.currentTime)||0):0}set time(t){this.animation&&(this.animation.currentTime=a(t))}get speed(){return this.animation?this.animation.playbackRate:1}set speed(t){this.animation&&(this.animation.playbackRate=t)}get state(){return this.animation?this.animation.playState:"finished"}get startTime(){return this.animation?this.animation.startTime:null}get finished(){return this.animation?this.animation.finished:Promise.resolve()}play(){this.animation&&this.animation.play()}pause(){this.animation&&this.animation.pause()}stop(){this.animation&&"idle"!==this.state&&"finished"!==this.state&&(this.animation.commitStyles&&this.animation.commitStyles(),this.cancel())}flatten(){var t,e;this.animation&&(null===(t=this.options)||void 0===t?void 0:t.allowFlatten)&&(null===(e=this.animation.effect)||void 0===e||e.updateTiming({easing:"linear"}))}attachTimeline(e){return this.animation&&function(t,e){t.timeline=e,t.onfinish=null}(this.animation,e),t}complete(){this.animation&&this.animation.finish()}cancel(){try{this.animation&&this.animation.cancel()}catch(t){}}}{constructor(t,i,n,o){const r=i.startsWith("--");e("string"!=typeof o.type);const l=P(t).get(i);l&&l.stop();if(Array.isArray(n)||(n=[n]),function(t,e,i){for(let n=0;n<e.length;n++)null===e[n]&&(e[n]=0===n?i():e[n-1]),"number"==typeof e[n]&&f[t]&&(e[n]=f[t].transform(e[n]));!A()&&e.length<2&&e.unshift(i())}(i,n,()=>i.startsWith("--")?t.style.getPropertyValue(i):window.getComputedStyle(t)[i]),"function"==typeof o.type){const t=function(t,e=100,i){const n=i({...t,keyframes:[0,e]}),a=Math.min(function(t){let e=0,i=t.next(e);for(;!i.done&&e<2e4;)e+=50,i=t.next(e);return e>=2e4?1/0:e}(n),2e4);return{type:"keyframes",ease:t=>n.next(a*t).value/e,duration:s(a)}}(o,100,o.type);o.ease=h()?t.ease:"easeOut",o.duration=a(t.duration),o.type="keyframes"}else o.ease=o.ease||"easeOut";const u=()=>{this.setValue(t,i,function(t,{repeat:e,repeatType:i="loop"},n){const a=t.filter(y),s=e&&"loop"!==i&&e%2==1?0:a.length-1;return s&&void 0!==n?n:a[s]}(n,o)),this.cancel(),this.resolveFinishedPromise()},m=()=>{this.setValue=r?g:v,this.options=o,this.updateFinishedPromise(),this.removeAnimation=()=>{const e=T.get(t);e&&e.delete(i)}};b()?(super(function(t,e,i,{delay:n=0,duration:a=300,repeat:s=0,repeatType:o="loop",ease:r="easeInOut",times:l}={}){const u={[e]:i};l&&(u.offset=l);const h=d(r,a);return Array.isArray(h)&&(u.easing=h),t.animate(u,{delay:n,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:"reverse"===o?"alternate":"normal"})}(t,i,n,o)),m(),!1===o.autoplay&&this.animation.pause(),this.animation.onfinish=u,P(t).set(i,this)):(super(),m(),u())}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}play(){"finished"===this.state&&this.updateFinishedPromise(),super.play()}cancel(){this.removeAnimation(),super.cancel()}}function R(t,e,i,n){const s=function(t,e,i){var n;if(t instanceof EventTarget)return[t];if("string"==typeof t){let a=document;e&&(a=e.current);const s=null!==(n=null==i?void 0:i[t])&&void 0!==n?n:a.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}(t,n),o=s.length,r=[];for(let t=0;t<o;t++){const n=s[t],h={...i};"function"==typeof h.delay&&(h.delay=h.delay(t,o));for(const t in e){const i=e[t],s={...(l=h,u=t,l?l[u]||l.default||l:void 0)};s.duration=s.duration?a(s.duration):s.duration,s.delay=a(s.delay||0),s.allowFlatten=!h.type&&!h.ease,r.push(new w(n,t,i,s))}}var l,u;return r}const x=t=>function(e,i,n){return new r(R(e,i,n,t))},k=x();export{k as animateMini,x as createScopedWaapiAnimate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "12.4.11",
3
+ "version": "12.4.13",
4
4
  "description": "A simple and powerful JavaScript animation library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.mjs",
@@ -84,7 +84,7 @@
84
84
  "test-server": "jest --config jest.config.ssr.json",
85
85
  "prettier": "prettier ./src/* --write",
86
86
  "watch": "concurrently -c blue,red -n tsc --noEmitOnError ,rollup --kill-others \"tsc --noEmitOnError --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
87
- "prepack": "yarn build",
87
+ "prepack": "yarn build && yarn measure",
88
88
  "postpublish": "git push --tags",
89
89
  "measure": "rollup -c ./rollup.size.config.mjs"
90
90
  },
@@ -94,6 +94,7 @@
94
94
  "tslib": "^2.4.0"
95
95
  },
96
96
  "devDependencies": {
97
+ "@thednp/dommatrix": "^2.0.11",
97
98
  "@types/three": "0.137.0",
98
99
  "three": "0.137.0"
99
100
  },
@@ -116,32 +117,32 @@
116
117
  "bundlesize": [
117
118
  {
118
119
  "path": "./dist/size-rollup-motion.js",
119
- "maxSize": "34.8 kB"
120
+ "maxSize": "35.1 kB"
120
121
  },
121
122
  {
122
123
  "path": "./dist/size-rollup-m.js",
123
- "maxSize": "5.9 kB"
124
+ "maxSize": "6 kB"
124
125
  },
125
126
  {
126
127
  "path": "./dist/size-rollup-dom-animation.js",
127
- "maxSize": "17.55 kB"
128
+ "maxSize": "17.9 kB"
128
129
  },
129
130
  {
130
131
  "path": "./dist/size-rollup-dom-max.js",
131
- "maxSize": "29.65 kB"
132
+ "maxSize": "29.8 kB"
132
133
  },
133
134
  {
134
135
  "path": "./dist/size-rollup-animate.js",
135
- "maxSize": "18.45 kB"
136
+ "maxSize": "18.7 kB"
136
137
  },
137
138
  {
138
139
  "path": "./dist/size-rollup-scroll.js",
139
- "maxSize": "5.2 kB"
140
+ "maxSize": "5.3 kB"
140
141
  },
141
142
  {
142
143
  "path": "./dist/size-rollup-waapi-animate.js",
143
144
  "maxSize": "2.7 kB"
144
145
  }
145
146
  ],
146
- "gitHead": "9316ca820205fedca95a4db2fc0c9f81df77d80c"
147
+ "gitHead": "ac0bc2f6003a20face739983390102b033d291df"
147
148
  }