motion 10.5.0-alpha.1 → 10.5.0-alpha.5
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.
- package/CHANGELOG.md +109 -0
- package/LICENSE +21 -0
- package/dist/main.cjs.js +0 -0
- package/dist/main.es.js +0 -0
- package/dist/motion.min.js +1 -1
- package/dist/motion.umd.js +1661 -3
- package/dist/react.cjs.js +14 -0
- package/dist/react.es.js +1 -0
- package/dist/size-index.js +1 -1
- package/dist/vue.cjs.js +14 -0
- package/dist/vue.es.js +1 -0
- package/lib/react.js +2 -0
- package/lib/react.js.map +1 -0
- package/lib/vue.js +2 -0
- package/lib/vue.js.map +1 -0
- package/package.json +18 -4
- package/react/package.json +6 -0
- package/types/react.d.ts +2 -0
- package/types/react.d.ts.map +1 -0
- package/types/vue.d.ts +2 -0
- package/types/vue.d.ts.map +1 -0
- package/vue/package.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Motion One adheres to [Semantic Versioning](http://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [10.5.0] [2022-01-01]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Motion One for Vue:** A fully declarative version of Motion One for Vue 3!
|
|
10
|
+
|
|
11
|
+
## [10.4.0] [2021-10-18]
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Spring and glide in timeline:** `timeline` now supports animations with `ease: spring()` and `ease: glide()`.
|
|
16
|
+
|
|
17
|
+
## [10.3.2] [2021-10-18]
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fixing animation interruption for independent transform animations in Safari and Firefox. [Issue (sponsors only)](https://github.com/motiondivision/motionone/issues/27)
|
|
22
|
+
|
|
23
|
+
## [10.3.1] [2021-10-12]
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Fixing a bug in `stagger` and `animate`.
|
|
28
|
+
|
|
29
|
+
## [10.3.0] [2021-10-11]
|
|
30
|
+
|
|
31
|
+
### New
|
|
32
|
+
|
|
33
|
+
- **Glide:** Animate transforms with realistic [glide](https://motion.dev/dom/glide) that can be used to mimic momentum scroll.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Fixing a bug where sometimes velocity wasn't being correctly passed to the next animation.
|
|
38
|
+
|
|
39
|
+
## [10.2.1] [2021-10-06]
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- Ensuring `duration` is always passed correctly to the independent transform polyfill.
|
|
44
|
+
|
|
45
|
+
## [10.2.0] [2021-10-05]
|
|
46
|
+
|
|
47
|
+
### New
|
|
48
|
+
|
|
49
|
+
- **Springs:** Animate transforms with realistic [spring](https://motion.dev/dom/spring) simulations.
|
|
50
|
+
|
|
51
|
+
## [10.1.3] [2021-10-01]
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- **Fill both for timelines:** Extends `fill: "both"` effect from `10.1.2` to `timeline`.
|
|
56
|
+
|
|
57
|
+
## [10.1.2] [2021-10-01]
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- **Fill both:** Previously, if an animation had a delay and an initially-defined first keyframe (`opacity: [0, 1]`) the animation would start from its rendered style to that first keyframe. Now, the initial keyframe gets stretched to the very start of the whole animation by setting `fill: "both"`. [Issue (sponsors only)](https://github.com/motiondivision/motionone/issues/20)
|
|
62
|
+
|
|
63
|
+
## [10.1.1] [2021-09-28]
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- **Scrub to end:** Setting `currentTime` to `duration` was removing the animation effect. This has been fixed by setting `fill: "forwards"` on the WAAPI animation. This won't affect memory consumption as animations are flattened into styles and removed on finish. [Issue (sponsors only)](https://github.com/motiondivision/motionone/issues/21)
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- **Removed Popmotion dependency:** Reduced the number of dependencies by moving Popmotion utilities inside Motion One. Filesize remains unaffected in most environments but will be lower in Skypack and other distributors that don't support tree-shaking.
|
|
72
|
+
|
|
73
|
+
## [10.1.0] [2021-09-27]
|
|
74
|
+
|
|
75
|
+
### New
|
|
76
|
+
|
|
77
|
+
- **Duration:** The duration of timelines is usually automatically calculated from its defined animations. It can now be read from the new read-only `duration` prop on [animation controls](http://motion.dev/dom/controls).
|
|
78
|
+
|
|
79
|
+
### Changed
|
|
80
|
+
|
|
81
|
+
- **Performance:** Before Motion One starts a new animation, it stops the old one. Stopping an animation commits its styles, which can cause a style recalculation. Now, when an animation finishes, we delete the reference to the old animation. Additionally, we check the animation status isn't `"finished"` before committing styles within `stop`. This prevents unnecessary style recalculations.
|
|
82
|
+
|
|
83
|
+
## [10.0.3] [2021-09-25]
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Fixed formatting of changelog for website publication.
|
|
88
|
+
|
|
89
|
+
## [10.0.2] [2021-09-24]
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
|
|
93
|
+
- Generating `finished` promise on-demand.
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
|
|
97
|
+
- Catching promise in `animate` and `timeline` to prevent errors whenever a sub-animation is cancelled.
|
|
98
|
+
|
|
99
|
+
## [10.0.1] [2021-09-22]
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
|
|
103
|
+
- Removed links to repo from Readme.
|
|
104
|
+
|
|
105
|
+
## [10.0.0] [2021-09-12]
|
|
106
|
+
|
|
107
|
+
### New
|
|
108
|
+
|
|
109
|
+
- First publish
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Matt Perry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/main.cjs.js
CHANGED
|
File without changes
|
package/dist/main.es.js
CHANGED
|
File without changes
|
package/dist/motion.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Motion={})}(this,(function(e){"use strict";e.animate=function(e){var t=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(e,[]);console.log(t)},e.test=function(){console.log("test")},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{transforms:[],animations:{},generators:{},prevGeneratorState:{}}),e.get(t)}function i(t,e){-1===t.indexOf(e)&&t.push(e)}function a(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const s=()=>{},r=t=>t,o=["","X","Y","Z"],c={x:"translateX",y:"translateY",z:"translateZ"},l={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},u={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:l,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:l},f=new Map,h=t=>`--motion-${t}`,d=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{o.forEach((e=>{d.push(t+e),f.set(h(t+e),u[t])}))}));const p=(t,e)=>d.indexOf(t)-d.indexOf(e),m=new Set(d),v=t=>m.has(t),g=t=>t.sort(p).reduce(y,"").trim(),y=(t,e)=>`${t} ${e}(var(${h(e)}))`,b=t=>t.startsWith("--"),w=new Set;const x=t=>1e3*t,M=t=>"number"==typeof t,S=t=>Array.isArray(t)&&!M(t[0]),O=t=>"object"==typeof t&&Boolean(t.createAnimation),T=t=>(t=>Array.isArray(t)&&M(t[0]))(t)?A(t):t,A=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,E=t=>document.createElement("div").animate(t,{duration:.001}),j={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{E({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(E({opacity:[0,1]}).finished)},D={},k={};for(const t in j)k[t]=()=>(void 0===D[t]&&(D[t]=j[t]()),D[t]);const P={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},$=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function R(t,e,n,i){if(t===e&&n===i)return r;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=$(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:$(a(t),e,i)}const C=(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},L={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)},V=/\((.*?)\)/;function B(t){if("function"==typeof t)return t;if(Array.isArray(t))return R(...t);if(L[t])return L[t];if(t.startsWith("steps")){const e=V.exec(t);if(e){const t=e[1].split(",");return C(parseFloat(t[0]),t[1].trim())}}return r}const U=(t,e,n)=>-n*t+n*e+t,W=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function q(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 F(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=W(0,e,i);t.push(U(n,1,a))}}function I(t){const e=[0];return F(e,t-1),e}function z(t,e=I(t.length),n=r){const i=t.length,a=i-e.length;return a>0&&F(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let r=(o=W(e[s],e[s+1],a),Math.min(1,Math.max(o,0)));var o;return r=q(n,s)(r),U(t[s],t[s+1],r)}}class G{constructor(t,e=[0,1],{easing:n=P.easing,duration:i=P.duration,delay:a=P.delay,endDelay:s=P.endDelay,repeat:r=P.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=z(e,o,S(n)?n.map(B):B(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 f=Math.floor(o),h=o%1;!h&&o>=1&&(h=1),1===h&&f--;const d=f%2;("reverse"===c||"alternate"===c&&d||"alternate-reverse"===c&&!d)&&(h=1-h);const p=u(r>=l?1:Math.min(h,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 Z=t=>Array.isArray(t)?t:[t];function K(t){return c[t]&&(t=c[t]),v(t)?h(t):t}const X={get:(t,e)=>{e=K(e);let n=b(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=f.get(e);t&&(n=t.initialValue)}return n}};function Y(t){if(t)try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}function _(t,e,a,r={}){let o,{duration:l=P.duration,delay:u=P.delay,endDelay:h=P.endDelay,repeat:d=P.repeat,easing:p=P.easing,direction:m,offset:y,allowWebkitAcceleration:A=!1}=r;const E=n(t);let j=k.waapi(),D=s;const $=v(e);$&&((t,e)=>{c[e]&&(e=c[e]);const{transforms:a}=n(t);i(a,e),t.style.transform=g(a)})(t,e);const R=K(e),C=f.get(R);return Y(E.animations[R]),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=X.get(t,R))&&void 0!==e?e:null==C?void 0:C.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}(Z(a),e);if(O(p)){const t=p.createAnimation(n,e,$,R,E);p=t.easing,void 0!==t.keyframes&&(n=t.keyframes),void 0!==t.duration&&(l=t.duration)}if(b(R)?(D=((t,e)=>n=>t.style.setProperty(e,n))(t,R),k.cssRegisterProperty()?function(t){if(!w.has(t)){w.add(t);try{const{syntax:e,initialValue:n}=f.has(t)?f.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(R):j=!1):D=((t,e)=>n=>t.style[e]=n)(t,R),j){C&&(n=n.map((t=>M(t)?C.toDefaultUnit(t):t))),k.partialKeyframes()||1!==n.length||n.unshift(e());const i={delay:x(u),duration:x(l),endDelay:x(h),easing:S(p)?void 0:T(p),direction:m,iterations:d+1,fill:"both"};o=t.animate({[R]:n,offset:y,easing:S(p)?p.map(T):void 0},i),o.finished||(o.finished=new Promise(((t,e)=>{o.onfinish=t,o.oncancel=e})));const a=n[n.length-1];o.finished.then((()=>{D(a),o.cancel()})).catch(s),A||(o.playbackRate=1.000001)}else if($&&n.every(M)){if(1===n.length&&n.unshift(parseFloat(e())),C){const t=D;D=e=>t(C.toDefaultUnit(e))}o=new G(D,n,Object.assign(Object.assign({},r),{duration:l,easing:p}))}else{const t=n[n.length-1];D(C&&M(t)?C.toDefaultUnit(t):t)}return E.animations[R]=o,null==o||o.finished.then((()=>{E.animations[R]=void 0,E.generators[R]=void 0,E.prevGeneratorState[R]=void 0})).catch(s),o}}const N=(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(),Q=(t,e)=>new Proxy({animations:t.map(J).filter(Boolean),duration:e},et),tt=t=>t.animations[0],et={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let a=(null===(n=tt(t))||void 0===n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":return null===(i=tt(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(nt)).catch(s)),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=x(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},nt=t=>t.finished;function it(t,e,n){return"function"==typeof t?t(e,n):t}function at(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}function st(t,e,n,i){var a;return M(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 rt(t,e,n,i,s,r){!function(t,e,n){for(let i=0;i<t.length;i++){const s=t[i];s.at>e&&s.at<n&&(a(t,s),i--)}}(t,s,r);for(let a=0;a<e.length;a++)t.push({value:e[a],at:U(s,r,i[a]),easing:q(n,a)})}function ot(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ct(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function lt(t,e){return e[t]||(e[t]=[]),e[t]}const ut=({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,f=Math.sqrt(t/n)/1e3,h=((t,e)=>t*Math.sqrt(1-e*e))(f,l);let d;return d=l<1?t=>a-Math.exp(-l*f*t)*((l*f*u-s)/h*Math.sin(h*t)+u*Math.cos(h*t)):t=>a-Math.exp(-f*t)*(u+(s+f*u)*t),{next:t=>{c.value=d(t),c.velocity=0===t?s:ft(d,t,c.value);const e=Math.abs(c.velocity)<=r,n=Math.abs(a-c.value)<=o;var l,u,f;return c.done=e&&n,c.hasReachedTarget=(l=i,u=a,f=c.value,l<u&&f>=u||l>u&&f<=u),c}}};function ft(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 ht(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(dt)){const n=i&&r&&r.prevGeneratorState[i],u=n&&(1===l||2===l&&null===t[0])?n.velocity:0,f=t[l-1],h=1===l?null:t[0],d=null===h?n?n.value:parseFloat(e()):h;c=a(d,f,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 dt=t=>"string"!=typeof t,pt=ht(ut),mt=ht((({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=x(i);const f={value:t,target:t,velocity:e,hasReachedTarget:!1,done:!1},h=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,m=void 0===r?p:r(p);f.target=m,m!==p&&(d=m-t);const v=t=>-d*Math.exp(-t/i),g=t=>m+v(t),y=t=>{const n=v(t),i=g(t);f.done=Math.abs(n)<=l,f.value=f.done?m:i,f.velocity=0===t?e:ft(g,t,f.value)};let b,w;const M=t=>{var e;(e=f.value,void 0!==o&&e<o||void 0!==c&&e>c)&&(b=t,w=ut({from:f.value,to:h(f.value),velocity:f.velocity,damping:a,stiffness:s,restDistance:l,restSpeed:u}))};return M(0),{next:t=>{let e=!1;return w||void 0!==b||(e=!0,y(t),M(t)),void 0!==b&&t>b?(f.hasReachedTarget=!0,w.next(t-b)):(f.hasReachedTarget=!1,!e&&y(t),f)}}}));function vt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let gt;function yt(){if(!gt)return;const t=gt.sort(wt).map(xt);t.forEach(Mt),t.forEach(Mt),gt=void 0}function bt(t){gt?i(gt,t):(gt=[t],requestAnimationFrame(yt))}const wt=(t,e)=>t.getDepth()-e.getDepth(),xt=t=>t.animateUpdates(),Mt=t=>t.next(),St=(t,e)=>new CustomEvent(t,{detail:{target:e}});function Ot(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function Tt(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const At=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),Ot(t,e,i))},Et={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(),Tt(t,"viewenter",a)):i&&!a.isIntersecting&&(n(),Tt(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=At(t,"hoverstart",e),a=At(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(),Ot(t,"pressend",e),window.removeEventListener("pointerup",i)},a=n=>{e(),Ot(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",a),()=>{t.removeEventListener("pointerdown",a),window.removeEventListener("pointerup",i)}}}},jt=["initial","animate",...Object.keys(Et),"exit"],Dt=new WeakMap;function kt(t){const e={},n=[];for(let i in t){const a=t[i];v(i)&&(c[i]&&(i=c[i]),n.push(i),i=h(i));let s=Array.isArray(a)?a[0]:a;const r=f.get(i);r&&(s=M(a)?r.toDefaultUnit(a):a),e[i]=s}return n.length&&(e.transform=g(n)),e}const Pt=t=>`-${t.toLowerCase()}`;t.animate=function(t,e,n={}){var i;const a=(t=H(t)).length,s=[];for(let i=0;i<a;i++){const r=t[i];for(const t in e){const o=N(n,t);o.delay=it(o.delay,i,a);const c=_(r,t,e[t],o);s.push(c)}}return Q(s,null!==(i=n.duration)&&void 0!==i?i:P.duration)},t.animateStyle=_,t.createMotionState=function(t={},e){let n,i=e?e.getDepth()+1:0;const r={initial:!0,animate:!0},o={},c={};for(const n of jt)c[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const l=!1===t.initial?"animate":"initial";let u=at(vt(t[l]||c[l],t.variants)||{},["transition"]);const f=Object.assign({},u),h=(t,e)=>()=>{r[t]=e,bt(p)},d=()=>{for(const e in Et){const i=Et[e].isActive(t),a=o[e];i&&!a?o[e]=Et[e].subscribe(n,{enable:h(e,!0),disable:h(e,!1)}):!i&&a&&(a(),delete o[e])}},p={update:e=>{n&&(t=e,d(),bt(p))},setActive:(t,e)=>n?(r[t]=e,bt(p),new Promise((t=>{setTimeout((()=>t()),100)}))):Promise.resolve(),animateUpdates:function*(){var e,i;const a=u;u={};const o={},c={},l={};for(const n of jt){if(!r[n])continue;const a=vt(t[n]);if(a){o[n]=a;for(const s in a)"transition"!==s&&(u[s]=a[s],l[s]=N(null!==(i=null!==(e=a.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},s),c[s]=n)}}const h=new Set([...Object.keys(u),...Object.keys(a)]),d=[];h.forEach((t=>{var e,i,s;void 0===u[t]&&(u[t]=f[t]),i=a[t],s=u[t],typeof i==typeof s&&(Array.isArray(i)&&Array.isArray(s)?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,s):i===s)||(null!==(e=f[t])&&void 0!==e||(f[t]=X.get(n,t)),d.push(_(n,t,u[t],l[t])))})),yield;const p=d.map((t=>t())).filter(Boolean);if(!p.length)return;const m=u;n.dispatchEvent(St("motionstart",m)),Promise.all(p.map((t=>t.finished))).then((()=>{n.dispatchEvent(St("motioncomplete",m))})).catch(s)},getDepth:()=>i,getTarget:()=>u,getOptions:()=>t,getContext:()=>c,mount:t=>(n=t,Dt.set(n,p),d(),()=>{Dt.delete(n),function(t){gt&&a(gt,t)}(p);for(const t in o)o[t]()}),isMounted:()=>Boolean(n)};return p},t.createStyleString=function(t={}){const e=kt(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,Pt),n+=`: ${e[t]}; `;return n},t.createStyles=kt,t.getAnimationData=n,t.getStyleName=K,t.glide=mt,t.mountedStates=Dt,t.spring=pt,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(a,s)=>{const r=M(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=B(i)(c/t)*t}return e+c}},t.style=X,t.test=function(){console.log("test")},t.timeline=function(t,e={}){var n,i;const a=function(t,e={}){var{defaultOptions:n={}}=e,i=at(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,f={}]=t[e];void 0!==f.at&&(l=st(l,f.at,c,o));let h=0;const d=H(i,r),p=d.length;for(let t=0;t<p;t++){const e=ct(d[t],s);for(const i in a){const s=lt(i,e);let r=Z(a[i]);const o=N(f,i);let{duration:c=n.duration||P.duration,easing:d=n.easing||P.easing}=o;if(O(d)){const t=v(i);r.length;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(f.delay,t,p)||0,g=l+m,y=g+c;let{offset:b=I(r.length)}=o;1===b.length&&0===b[0]&&(b[1]=1);const w=length-r.length;w>0&&F(b,w),1===r.length&&r.unshift(null),rt(s,r,d,b,g,y),h=Math.max(m+c,h),u=Math.max(y,u)}}c=l,l+=h}return s.forEach(((t,e)=>{for(const s in t){const r=t[s];r.sort(ot);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(W(0,u,e)),l.push(i||P.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=>_(...t))).filter(Boolean);return Q(s,null!==(i=null===(n=a[0])||void 0===n?void 0:n[3].duration)&&void 0!==i?i:P.duration)},Object.defineProperty(t,"__esModule",{value:!0})}));
|