@vueuse/motion
Advanced tools
Comparing version 1.1.8 to 1.1.9
/*! | ||
* @vueuse/motion v1.1.7 | ||
* @vueuse/motion v1.1.9 | ||
* (c) 2021 | ||
@@ -976,3 +976,3 @@ * @license MIT | ||
_motionValues[key].destroy(); | ||
delete _motionValues[key]; | ||
vueDemi.del(_motionValues, key); | ||
}; | ||
@@ -1016,3 +1016,3 @@ if (isArray(keys)) { | ||
// Set instance motion value | ||
motionValues.value[key] = _motionValue; | ||
vueDemi.set(motionValues, key, _motionValue); | ||
// Set local motion value | ||
@@ -1026,3 +1026,3 @@ motionValue = _motionValue; | ||
motionValue.destroy(); | ||
delete motionValues.value[key]; | ||
vueDemi.del(motionValues, key); | ||
}; | ||
@@ -1667,3 +1667,3 @@ // Create animation | ||
if (binding.value) | ||
motionState[binding.value] = motionInstance; | ||
vueDemi.set(motionState, binding.value, motionInstance); | ||
}; | ||
@@ -1673,4 +1673,3 @@ const unregister = (el, binding, node) => { | ||
if (binding.value && motionState[binding.value]) | ||
// Delete the reference from motion state | ||
delete motionState[binding.value]; | ||
vueDemi.del(motionState, binding.value); | ||
}; | ||
@@ -1677,0 +1676,0 @@ return { |
/*! | ||
* @vueuse/motion v1.1.7 | ||
* @vueuse/motion v1.1.9 | ||
* (c) 2021 | ||
* @license MIT | ||
*/ | ||
import { ref, set, computed, watch, nextTick, reactive } from 'vue-demi'; | ||
import { ref, set, del, computed, watch, nextTick, reactive } from 'vue-demi'; | ||
import { isObject, useEventListener, useIntersectionObserver, noop, isNumber } from '@vueuse/core'; | ||
@@ -972,3 +972,3 @@ import { velocityPerSecond, inertia, animate, cubicBezier, linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut } from 'popmotion'; | ||
_motionValues[key].destroy(); | ||
delete _motionValues[key]; | ||
del(_motionValues, key); | ||
}; | ||
@@ -1012,3 +1012,3 @@ if (isArray(keys)) { | ||
// Set instance motion value | ||
motionValues.value[key] = _motionValue; | ||
set(motionValues, key, _motionValue); | ||
// Set local motion value | ||
@@ -1022,3 +1022,3 @@ motionValue = _motionValue; | ||
motionValue.destroy(); | ||
delete motionValues.value[key]; | ||
del(motionValues, key); | ||
}; | ||
@@ -1663,3 +1663,3 @@ // Create animation | ||
if (binding.value) | ||
motionState[binding.value] = motionInstance; | ||
set(motionState, binding.value, motionInstance); | ||
}; | ||
@@ -1669,4 +1669,3 @@ const unregister = (el, binding, node) => { | ||
if (binding.value && motionState[binding.value]) | ||
// Delete the reference from motion state | ||
delete motionState[binding.value]; | ||
del(motionState, binding.value); | ||
}; | ||
@@ -1673,0 +1672,0 @@ return { |
/*! | ||
* @vueuse/motion v1.1.7 | ||
* @vueuse/motion v1.1.9 | ||
* (c) 2021 | ||
* @license MIT | ||
*/ | ||
import { ref, set, computed, watch, nextTick, reactive } from 'vue-demi'; | ||
import { ref, set, del, computed, watch, nextTick, reactive } from 'vue-demi'; | ||
import { isObject, useEventListener, useIntersectionObserver, noop, isNumber } from '@vueuse/core'; | ||
@@ -972,3 +972,3 @@ import { velocityPerSecond, inertia, animate, cubicBezier, linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut } from 'popmotion'; | ||
_motionValues[key].destroy(); | ||
delete _motionValues[key]; | ||
del(_motionValues, key); | ||
}; | ||
@@ -1012,3 +1012,3 @@ if (isArray(keys)) { | ||
// Set instance motion value | ||
motionValues.value[key] = _motionValue; | ||
set(motionValues, key, _motionValue); | ||
// Set local motion value | ||
@@ -1022,3 +1022,3 @@ motionValue = _motionValue; | ||
motionValue.destroy(); | ||
delete motionValues.value[key]; | ||
del(motionValues, key); | ||
}; | ||
@@ -1663,3 +1663,3 @@ // Create animation | ||
if (binding.value) | ||
motionState[binding.value] = motionInstance; | ||
set(motionState, binding.value, motionInstance); | ||
}; | ||
@@ -1669,4 +1669,3 @@ const unregister = (el, binding, node) => { | ||
if (binding.value && motionState[binding.value]) | ||
// Delete the reference from motion state | ||
delete motionState[binding.value]; | ||
del(motionState, binding.value); | ||
}; | ||
@@ -1673,0 +1672,0 @@ return { |
/*! | ||
* @vueuse/motion v1.1.7 | ||
* @vueuse/motion v1.1.9 | ||
* (c) 2021 | ||
* @license MIT | ||
*/ | ||
var VueuseMotion=function(t,e,r,i){"use strict";const n={};var a=1/60*1e3,o="undefined"!=typeof performance?function(){return performance.now()}:function(){return Date.now()},s="undefined"!=typeof window?function(t){return window.requestAnimationFrame(t)}:function(t){return setTimeout((function(){return t(o())}),a)};var u=!0,l=!1,c=!1,p={delta:0,timestamp:0},d=["read","update","preRender","render","postRender"],f=d.reduce((function(t,e){return t[e]=function(t){var e=[],r=[],i=0,n=!1,a=new WeakSet,o={schedule:function(t,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var u=s&&n,l=u?e:r;return o&&a.add(t),-1===l.indexOf(t)&&(l.push(t),u&&n&&(i=e.length)),t},cancel:function(t){var e=r.indexOf(t);-1!==e&&r.splice(e,1),a.delete(t)},process:function(s){var u;if(n=!0,e=(u=[r,e])[0],(r=u[1]).length=0,i=e.length)for(var l=0;l<i;l++){var c=e[l];c(s),a.has(c)&&(o.schedule(c),t())}n=!1}};return o}((function(){return l=!0})),t}),{}),v=d.reduce((function(t,e){var r=f[e];return t[e]=function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=!1),l||m(),r.schedule(t,e,i)},t}),{}),h=function(t){return f[t].process(p)},y=function(t){l=!1,p.delta=u?a:Math.max(Math.min(t-p.timestamp,40),1),p.timestamp=t,c=!0,d.forEach(h),c=!1,l&&(u=!1,s(y))},m=function(){l=!0,u=!0,c||s(y)};class b{constructor(){this.subscriptions=new Set}add(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}notify(t,e,r){if(this.subscriptions.size)for(const i of this.subscriptions)i(t,e,r)}clear(){this.subscriptions.clear()}}const g=t=>!isNaN(parseFloat(t));class w{constructor(t){this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new b,this.renderSubscribers=new b,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t,this.prev!==this.current&&this.updateSubscribers.notify(this.current),e&&this.renderSubscribers.notify(this.current);const{delta:r,timestamp:i}=p;this.lastUpdated!==i&&(this.timeDelta=r,this.lastUpdated=i,v.postRender(this.scheduleVelocityCheck))},this.scheduleVelocityCheck=()=>v.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current)},this.current=t,this.canTrackVelocity=g(this.current)}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){void 0!==this.current||this.canTrackVelocity||(this.canTrackVelocity=g(t)),e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?i.velocityPerSecond(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise((e=>{const{stop:r}=t(e);this.stopAnimation=r})).then((()=>this.clearAnimation()))}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}} | ||
var VueuseMotion=function(t,e,r,i){"use strict";const n={};var a=1/60*1e3,s="undefined"!=typeof performance?function(){return performance.now()}:function(){return Date.now()},o="undefined"!=typeof window?function(t){return window.requestAnimationFrame(t)}:function(t){return setTimeout((function(){return t(s())}),a)};var u=!0,l=!1,c=!1,p={delta:0,timestamp:0},d=["read","update","preRender","render","postRender"],f=d.reduce((function(t,e){return t[e]=function(t){var e=[],r=[],i=0,n=!1,a=new WeakSet,s={schedule:function(t,s,o){void 0===s&&(s=!1),void 0===o&&(o=!1);var u=o&&n,l=u?e:r;return s&&a.add(t),-1===l.indexOf(t)&&(l.push(t),u&&n&&(i=e.length)),t},cancel:function(t){var e=r.indexOf(t);-1!==e&&r.splice(e,1),a.delete(t)},process:function(o){var u;if(n=!0,e=(u=[r,e])[0],(r=u[1]).length=0,i=e.length)for(var l=0;l<i;l++){var c=e[l];c(o),a.has(c)&&(s.schedule(c),t())}n=!1}};return s}((function(){return l=!0})),t}),{}),v=d.reduce((function(t,e){var r=f[e];return t[e]=function(t,e,i){return void 0===e&&(e=!1),void 0===i&&(i=!1),l||m(),r.schedule(t,e,i)},t}),{}),h=function(t){return f[t].process(p)},y=function(t){l=!1,p.delta=u?a:Math.max(Math.min(t-p.timestamp,40),1),p.timestamp=t,c=!0,d.forEach(h),c=!1,l&&(u=!1,o(y))},m=function(){l=!0,u=!0,c||o(y)};class b{constructor(){this.subscriptions=new Set}add(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}notify(t,e,r){if(this.subscriptions.size)for(const i of this.subscriptions)i(t,e,r)}clear(){this.subscriptions.clear()}}const g=t=>!isNaN(parseFloat(t));class w{constructor(t){this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new b,this.renderSubscribers=new b,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t,this.prev!==this.current&&this.updateSubscribers.notify(this.current),e&&this.renderSubscribers.notify(this.current);const{delta:r,timestamp:i}=p;this.lastUpdated!==i&&(this.timeDelta=r,this.lastUpdated=i,v.postRender(this.scheduleVelocityCheck))},this.scheduleVelocityCheck=()=>v.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current)},this.current=t,this.canTrackVelocity=g(this.current)}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){void 0!==this.current||this.canTrackVelocity||(this.canTrackVelocity=g(t)),e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?i.velocityPerSecond(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise((e=>{const{stop:r}=t(e);this.stopAnimation=r})).then((()=>this.clearAnimation()))}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}} | ||
/*! ***************************************************************************** | ||
@@ -21,2 +21,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var O=function(){return(O=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},k=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},x=function(t){return t%1?Number(t.toFixed(5)):t},V=/(-)?([\d]*\.?[\d])+/g,A=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,L=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function T(t){return"string"==typeof t}var R={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},C=O(O({},R),{transform:k(0,1)}),j=O(O({},R),{default:1}),E=function(t){return{test:function(e){return T(e)&&e.endsWith(t)&&1===e.split(" ").length},parse:parseFloat,transform:function(e){return""+e+t}}},I=E("deg"),S=E("%"),M=E("px"),P=O(O({},S),{parse:function(t){return S.parse(t)/100},transform:function(t){return S.transform(100*t)}}),z=function(t,e){return function(r){return T(r)&&L.test(r)&&r.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(r,e)}},B=function(t,e,r){return function(i){var n;if(!T(i))return i;var a=i.match(V),o=a[1],s=a[2],u=a[3];return(n={})[t]=parseFloat(a[0]),n[e]=parseFloat(o),n[r]=parseFloat(s),n.alpha=void 0!==u?parseFloat(u):1,n}},N={test:z("hsl","hue"),parse:B("hue","saturation","lightness"),transform:function(t){var e=t.saturation,r=t.lightness,i=t.alpha,n=void 0===i?1:i;return"hsla("+Math.round(t.hue)+", "+S.transform(x(e))+", "+S.transform(x(r))+", "+x(C.transform(n))+")"}},F=k(0,255),W=O(O({},R),{transform:function(t){return Math.round(F(t))}}),U={test:z("rgb","red"),parse:B("red","green","blue"),transform:function(t){var e=t.green,r=t.blue,i=t.alpha,n=void 0===i?1:i;return"rgba("+W.transform(t.red)+", "+W.transform(e)+", "+W.transform(r)+", "+x(C.transform(n))+")"}};var Z={test:z("#"),parse:function(t){var e="",r="",i="",n="";return t.length>5?(e=t.substr(1,2),r=t.substr(3,2),i=t.substr(5,2),n=t.substr(7,2)):(e=t.substr(1,1),r=t.substr(2,1),i=t.substr(3,1),n=t.substr(4,1),e+=e,r+=r,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}},transform:U.transform},D={test:function(t){return U.test(t)||Z.test(t)||N.test(t)},parse:function(t){return U.test(t)?U.parse(t):N.test(t)?N.parse(t):Z.parse(t)},transform:function(t){return T(t)?t:t.hasOwnProperty("red")?U.transform(t):N.transform(t)}},X="${c}",Y="${n}";function $(t){var e=[],r=0,i=t.match(A);i&&(r=i.length,t=t.replace(A,X),e.push.apply(e,i.map(D.parse)));var n=t.match(V);return n&&(t=t.replace(V,Y),e.push.apply(e,n.map(R.parse))),{values:e,numColors:r,tokenised:t}}function _(t){return $(t).values}function H(t){var e=$(t),r=e.numColors,i=e.tokenised,n=e.values.length;return function(t){for(var e=i,a=0;a<n;a++)e=e.replace(a<r?X:Y,a<r?D.transform(t[a]):x(t[a]));return e}}var q=function(t){return"number"==typeof t?0:t};var G={test:function(t){var e,r,i,n;return isNaN(t)&&T(t)&&(null!==(r=null===(e=t.match(V))||void 0===e?void 0:e.length)&&void 0!==r?r:0)+(null!==(n=null===(i=t.match(A))||void 0===i?void 0:i.length)&&void 0!==n?n:0)>0},parse:_,createTransformer:H,getAnimatableNone:function(t){var e=_(t);return H(t)(e.map(q))}},J=new Set(["brightness","contrast","saturate","opacity"]);function K(t){var e=t.slice(0,-1).split("("),r=e[0],i=e[1];if("drop-shadow"===r)return t;var n=(i.match(V)||[])[0];if(!n)return t;var a=i.replace(n,""),o=J.has(r)?1:0;return n!==i&&(o*=100),r+"("+o+a+")"}var Q=/([a-z-]*)\(.*?\)/g,tt=O(O({},G),{getAnimatableNone:function(t){var e=t.match(Q);return e?e.map(K).join(" "):t}});const et=()=>({type:"spring",stiffness:500,damping:25,restDelta:.5,restSpeed:10}),rt=t=>({type:"spring",stiffness:550,damping:0===t?100:30,restDelta:.01,restSpeed:10}),it=()=>({type:"keyframes",ease:"linear",duration:300}),nt=t=>({type:"keyframes",duration:800,values:t}),at={default:rt,x:et,y:et,z:et,rotate:et,rotateX:et,rotateY:et,rotateZ:et,scaleX:rt,scaleY:rt,scale:rt,backgroundColor:it,color:it,opacity:it},ot=(t,e)=>{let r;return r=Array.isArray(e)?nt:at[t]||at.default,{to:e,...r(e)}},st={...R,transform:Math.round},ut={color:D,backgroundColor:D,outlineColor:D,fill:D,stroke:D,borderColor:D,borderTopColor:D,borderRightColor:D,borderBottomColor:D,borderLeftColor:D,borderWidth:M,borderTopWidth:M,borderRightWidth:M,borderBottomWidth:M,borderLeftWidth:M,borderRadius:M,radius:M,borderTopLeftRadius:M,borderTopRightRadius:M,borderBottomRightRadius:M,borderBottomLeftRadius:M,width:M,maxWidth:M,height:M,maxHeight:M,size:M,top:M,right:M,bottom:M,left:M,padding:M,paddingTop:M,paddingRight:M,paddingBottom:M,paddingLeft:M,margin:M,marginTop:M,marginRight:M,marginBottom:M,marginLeft:M,rotate:I,rotateX:I,rotateY:I,rotateZ:I,scale:j,scaleX:j,scaleY:j,scaleZ:j,skew:I,skewX:I,skewY:I,distance:M,translateX:M,translateY:M,translateZ:M,x:M,y:M,z:M,perspective:M,transformPerspective:M,opacity:C,originX:P,originY:P,originZ:M,zIndex:st,filter:tt,WebkitFilter:tt,fillOpacity:C,strokeOpacity:C,numOctaves:st},lt=t=>ut[t],ct=(t,e)=>e&&"number"==typeof t&&e.transform?e.transform(t):t;const pt={linear:i.linear,easeIn:i.easeIn,easeInOut:i.easeInOut,easeOut:i.easeOut,circIn:i.circIn,circInOut:i.circInOut,circOut:i.circOut,backIn:i.backIn,backInOut:i.backInOut,backOut:i.backOut,anticipate:i.anticipate,bounceIn:i.bounceIn,bounceInOut:i.bounceInOut,bounceOut:i.bounceOut},dt=t=>{if(Array.isArray(t)){const[e,r,n,a]=t;return i.cubicBezier(e,r,n,a)}return"string"==typeof t?pt[t]:t},ft=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!G.test(e)||e.startsWith("url(")));function vt({ease:t,times:e,delay:r,...i}){const n={...i};return e&&(n.offset=e),t&&(n.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(dt):dt(t)),r&&(n.elapsed=-r),n}function ht(t,e,r){return Array.isArray(e.to)&&(t.duration||(t.duration=800)),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({delay:t,repeat:e,repeatType:r,repeatDelay:i,from:n,...a}){return!!Object.keys(a).length}(t)||(t={...t,...ot(r,e.to)}),{...e,...vt(t)}}function yt(t,e,r,n,a){const o=function(t,e){return t[e]||t.default||t}(n,t);let s=o.from??e.get();const u=ft(t,r);"none"===s&&u&&"string"==typeof r&&(s=function(t,e){let r=lt(t);return r!==tt&&(r=G),r.getAnimatableNone?r.getAnimatableNone(e):void 0}(t,r));return ft(t,s)&&u&&!1!==o.type?function(u){const l={from:s,to:r,velocity:e.getVelocity(),onUpdate:t=>e.set(t)};return"inertia"===o.type||"decay"===o.type?i.inertia({...l,...o}):i.animate({...ht(o,l,t),onUpdate:t=>{l.onUpdate(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{n.onComplete&&n.onComplete(),a&&a(),u&&u()}})}:function(t){return e.set(r),n.onComplete&&n.onComplete(),a&&a(),t&&t(),{stop:()=>{}}}}const{isArray:mt}=Array;function bt(){const t=e.ref({});return{motionValues:t,stop:e=>{const{value:r}=t;if(e){const t=t=>{r[t].stop(),r[t].destroy(),delete r[t]};mt(e)?e.forEach((e=>{r[e]&&t(e)})):r[e]&&t(e)}else Object.values(r).forEach((t=>{t.stop(),t.destroy()})),t.value={}},push:(r,i,n,a={},o)=>{let s=t.value[r];if(!s){const i=new w(n[r]);i.onChange((t=>{e.set(n,r,t)})),t.value[r]=i,s=i}const u=yt(r,s,i,a,(()=>{o&&o(),s.destroy(),delete t.value[r]}));s.start(u)}}}function gt(t,i={},{push:n,stop:a}=bt()){const o=e.ref(i),s=t=>{if(!o||!o.value||!o.value[t])throw new Error(`The variant ${t} does not exist.`);return o.value[t]},u=e=>{let i=r.isObject(e)?e:s(e);const{transition:a}=i,o=[];for(const r in e){if("transition"===r)continue;const i=e[r];o.push(new Promise((e=>{n(r,i,t,a||ot(r,i),e)})))}return Promise.all(o)};return{apply:u,set:i=>{a();let n=r.isObject(i)?i:s(i);for(const r in n){if("transition"===r)continue;e.set(t,r,i[r])}},stopTransitions:a,leave:async t=>{let e;o&&o.value&&(o.value.leave&&(e=o.value.leave),!o.value.leave&&o.value.initial&&(e=o.value.initial)),e?(await u(e),t()):t()}}}const wt="undefined"!=typeof window;function Ot({target:t,state:i,variants:n,apply:a}){const o=e.ref(!1),s=e.ref(!1),u=e.ref(!1),l=e.computed((()=>{let t=[];return n.value.hovered&&(t=[...t,...Object.keys(n.value.hovered)]),n.value.tapped&&(t=[...t,...Object.keys(n.value.tapped)]),n.value.focused&&(t=[...t,...Object.keys(n.value.focused)]),t})),c=e.computed((()=>{const t={};Object.assign(t,i.value),o.value&&n.value.hovered&&Object.assign(t,n.value.hovered),s.value&&n.value.tapped&&Object.assign(t,n.value.tapped),u.value&&n.value.focused&&Object.assign(t,n.value.focused);for(const e in t)l.value.includes(e)||delete t[e];return t}));n.value.hovered&&(r.useEventListener(t.value,"mouseenter",(()=>{o.value=!0})),r.useEventListener(t.value,"mouseleave",(()=>{o.value=!1,s.value=!1})),r.useEventListener(t.value,"mouseout",(()=>{o.value=!1,s.value=!1}))),n.value.tapped&&(wt&&null===window.onmousedown&&(r.useEventListener(t.value,"mousedown",(()=>{s.value=!0})),r.useEventListener(t.value,"mouseup",(()=>{s.value=!1}))),wt&&null===window.onpointerdown&&(r.useEventListener(t.value,"pointerdown",(()=>{s.value=!0})),r.useEventListener(t.value,"pointerup",(()=>{s.value=!1}))),wt&&null===window.ontouchstart&&(r.useEventListener(t.value,"touchstart",(()=>{s.value=!0})),r.useEventListener(t.value,"touchend",(()=>{s.value=!1})))),n.value.focused&&(r.useEventListener(t.value,"focus",(()=>{u.value=!0})),r.useEventListener(t.value,"blur",(()=>{u.value=!1}))),e.watch(c,(t=>{a(t)}))}function kt(t,i={syncVariants:!0,lifeCycleHooks:!0,visibilityHooks:!0,eventListeners:!0}){i.lifeCycleHooks&&function({target:t,variants:r,variant:i}){e.watch(t,(()=>{r.value&&r.value.enter&&(r.value.initial&&(i.value="initial"),e.nextTick((()=>i.value="enter")))}),{immediate:!0,flush:"pre"})}(t),i.syncVariants&&function({state:t,apply:r}){e.watch(t,(t=>{t&&r(t)}),{immediate:!0})}(t),i.visibilityHooks&&function({target:t,variants:i,variant:n}){let a=r.noop;const o=e.watch(t,(e=>{e&&(a=r.useIntersectionObserver(t,(([{isIntersecting:t}])=>{i.value&&i.value.visible&&(n.value=t?"visible":"initial")})).stop)}),{immediate:!0})}(t),i.eventListeners&&Ot(t)}function xt(t={}){const r=e.reactive({...t}),i=e.computed((()=>{const t={};for(const[e,i]of Object.entries(r)){const r=lt(e),n=ct(i,r);t[e]=n}return t}));return{state:r,style:i}}function Vt(t){const r=e.ref(t);let i;const{state:n,style:a}=xt(),o=e.watch(r,(t=>{if(t){for(const r of Object.keys(ut))null!=t.style[r]&&""!==t.style[r]&&e.set(n,r,t.style[r]);if(i)for(const r in i)e.set(t.style,r,i[r])}})),s=e.watch(a,(t=>{r.value&&r.value.style?Object.assign(r.value.style,t):i=t}),{immediate:!0});return{style:n,stop:()=>{o(),s()}}}const At={x:"translateX",y:"translateY",z:"translateZ"};function Lt(t={},r=!0){const i=e.reactive({...t}),n=e.ref("");return e.watch(i,(()=>{let t="",e=!1;for(const[r,n]of Object.entries(i)){const i=lt(r),a=ct(n,i);t+=`${At[r]||r}(${a}) `,"z"!==r&&"translateZ"!==r||(e=!0)}!e&&r?t+="translateZ(0)":t=t.trim(),n.value=t}),{immediate:!0,deep:!0}),{state:i,transform:n}}function Tt(t){const r=e.ref(t);let i;const{state:n,transform:a}=Lt(),o=e.watch(r,(t=>{t&&i&&(t.style.transform=i)})),s=e.watch(a,(t=>{r.value&&r.value.style?r.value.style.transform=t:i=t}),{immediate:!0});return{transform:n,stop:()=>{o(),s()}}}const Rt=["","X","Y","Z"],Ct=["transformPerspective","x","y","z"];["perspective","translate","scale","rotate","skew"].forEach((t=>{Rt.forEach((e=>{Ct.push(t+e)}))}));const jt=new Set(Ct);function Et(t){return jt.has(t)}function It(t){const r=e.ref(t),{style:i}=Vt(r),{transform:n}=Tt(r),a=e.reactive({});return e.watch(a,(t=>{for(const r in t){const a=Et(r)?n:i;a[r]&&a[r]===t[r]||e.set(a,r,t[r])}}),{immediate:!0,deep:!0}),{motionProperties:a,style:i,transform:n}}function St(t={}){const r=e.ref(t),i=e.ref();return{state:e.computed((()=>{if(i.value)return r.value[i.value]})),variant:i}}function Mt(t,r={},i){const n=e.ref(r),a=e.ref(t),{motionProperties:o}=It(a),{variant:s,state:u}=St(n),l={target:a,variant:s,variants:n,state:u,motionProperties:o,...gt(o,n)};return kt(l,i),l}const Pt=["initial","enter","leave","visible","hovered","tapped","focused","delay"],zt=t=>{const i=(i,a,o)=>{const s=e.ref(t||{});((t,e)=>{const i=t.props?t.props:t.data&&t.data.attrs?t.data.attrs:{};i&&(i.variants&&r.isObject(i.variants)&&(e.value={...e.value,...i.variants}),Pt.forEach((t=>{if("delay"!==t)i&&i[t]&&r.isObject(i[t])&&(e.value[t]=i[t]);else if(i&&i[t]&&r.isNumber(i[t])){const r=i[t];e&&e.value&&(e.value.enter&&(e.value.enter.transition||(e.value.enter.transition={}),e.value.enter.transition={...e.value.enter.transition,delay:r}),e.value.visible&&(e.value.visible.transition||(e.value.visible.transition={}),e.value.visible.transition={...e.value.visible.transition,delay:r}))}})))})(o,s);const u=Mt(i,s);a.value&&(n[a.value]=u)},a=(t,e,r)=>{e.value&&n[e.value]&&delete n[e.value]};return{created:i,unmounted:a,bind:i,unbind:a}},Bt={initial:{opacity:0},enter:{opacity:1}},Nt={initial:{opacity:0},visible:{opacity:1}},Ft={initial:{scale:0,opacity:0},enter:{scale:1,opacity:1}},Wt={initial:{scale:0,opacity:0},visible:{scale:1,opacity:1}},Ut={initial:{x:-100,rotate:90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Zt={initial:{x:-100,rotate:90,opacity:0},visible:{x:0,rotate:0,opacity:1}},Dt={initial:{x:100,rotate:-90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Xt={initial:{x:100,rotate:-90,opacity:0},visible:{x:0,rotate:0,opacity:1}},Yt={initial:{y:-100,rotate:-90,opacity:0},enter:{y:0,rotate:0,opacity:1}},$t={initial:{y:-100,rotate:-90,opacity:0},visible:{y:0,rotate:0,opacity:1}},_t={initial:{y:100,rotate:90,opacity:0},enter:{y:0,rotate:0,opacity:1}},Ht={initial:{y:100,rotate:90,opacity:0},visible:{y:0,rotate:0,opacity:1}},qt={initial:{x:-100,opacity:0},enter:{x:0,opacity:1}},Gt={initial:{x:-100,opacity:0},visible:{x:0,opacity:1}},Jt={initial:{x:100,opacity:0},enter:{x:0,opacity:1}},Kt={initial:{x:100,opacity:0},visible:{x:0,opacity:1}},Qt={initial:{y:-100,opacity:0},enter:{y:0,opacity:1}},te={initial:{y:-100,opacity:0},visible:{y:0,opacity:1}},ee={initial:{y:100,opacity:0},enter:{y:0,opacity:1}},re={initial:{y:100,opacity:0},visible:{y:0,opacity:1}};var ie=Object.freeze({__proto__:null,fade:Bt,fadeVisible:Nt,pop:Ft,popVisible:Wt,rollBottom:_t,rollLeft:Ut,rollRight:Dt,rollTop:Yt,rollVisibleBottom:Ht,rollVisibleLeft:Zt,rollVisibleRight:Xt,rollVisibleTop:$t,slideBottom:ee,slideLeft:qt,slideRight:Jt,slideTop:Qt,slideVisibleBottom:re,slideVisibleLeft:Gt,slideVisibleRight:Kt,slideVisibleTop:te});function ne(t){const e="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;",r=new RegExp(e.split("").join("|"),"g");return t.toString().replace(/[A-Z]/g,(t=>"-"+t)).toLowerCase().replace(/\s+/g,"-").replace(r,(t=>"aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------".charAt(e.indexOf(t)))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}const ae={install(t,e){if(t.directive("motion",zt()),!e||e&&!e.excludePresets)for(const e in ie){const r=ie[e];t.directive(`motion-${ne(e)}`,zt(r))}if(e&&e.directives)for(const r in e.directives){const i=e.directives[r];0,t.directive(`motion-${r}`,zt(i))}}};return t.MotionDirective=zt,t.MotionPlugin=ae,t.fade=Bt,t.fadeVisible=Nt,t.pop=Ft,t.popVisible=Wt,t.reactiveStyle=xt,t.reactiveTransform=Lt,t.rollBottom=_t,t.rollLeft=Ut,t.rollRight=Dt,t.rollTop=Yt,t.rollVisibleBottom=Ht,t.rollVisibleLeft=Zt,t.rollVisibleRight=Xt,t.rollVisibleTop=$t,t.slideBottom=ee,t.slideLeft=qt,t.slideRight=Jt,t.slideTop=Qt,t.slideVisibleBottom=re,t.slideVisibleLeft=Gt,t.slideVisibleRight=Kt,t.slideVisibleTop=te,t.slugify=ne,t.useElementStyle=Vt,t.useElementTransform=Tt,t.useMotion=Mt,t.useMotionControls=gt,t.useMotionProperties=It,t.useMotionTransitions=bt,t.useMotionVariants=St,t.useMotions=function(){return n},Object.defineProperty(t,"__esModule",{value:!0}),t}({},VueDemi,VueUse,popmotion); | ||
var O=function(){return(O=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},k=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},x=function(t){return t%1?Number(t.toFixed(5)):t},V=/(-)?([\d]*\.?[\d])+/g,A=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,L=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function T(t){return"string"==typeof t}var R={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},C=O(O({},R),{transform:k(0,1)}),j=O(O({},R),{default:1}),E=function(t){return{test:function(e){return T(e)&&e.endsWith(t)&&1===e.split(" ").length},parse:parseFloat,transform:function(e){return""+e+t}}},I=E("deg"),S=E("%"),M=E("px"),P=O(O({},S),{parse:function(t){return S.parse(t)/100},transform:function(t){return S.transform(100*t)}}),z=function(t,e){return function(r){return T(r)&&L.test(r)&&r.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(r,e)}},B=function(t,e,r){return function(i){var n;if(!T(i))return i;var a=i.match(V),s=a[1],o=a[2],u=a[3];return(n={})[t]=parseFloat(a[0]),n[e]=parseFloat(s),n[r]=parseFloat(o),n.alpha=void 0!==u?parseFloat(u):1,n}},N={test:z("hsl","hue"),parse:B("hue","saturation","lightness"),transform:function(t){var e=t.saturation,r=t.lightness,i=t.alpha,n=void 0===i?1:i;return"hsla("+Math.round(t.hue)+", "+S.transform(x(e))+", "+S.transform(x(r))+", "+x(C.transform(n))+")"}},F=k(0,255),W=O(O({},R),{transform:function(t){return Math.round(F(t))}}),U={test:z("rgb","red"),parse:B("red","green","blue"),transform:function(t){var e=t.green,r=t.blue,i=t.alpha,n=void 0===i?1:i;return"rgba("+W.transform(t.red)+", "+W.transform(e)+", "+W.transform(r)+", "+x(C.transform(n))+")"}};var Z={test:z("#"),parse:function(t){var e="",r="",i="",n="";return t.length>5?(e=t.substr(1,2),r=t.substr(3,2),i=t.substr(5,2),n=t.substr(7,2)):(e=t.substr(1,1),r=t.substr(2,1),i=t.substr(3,1),n=t.substr(4,1),e+=e,r+=r,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}},transform:U.transform},D={test:function(t){return U.test(t)||Z.test(t)||N.test(t)},parse:function(t){return U.test(t)?U.parse(t):N.test(t)?N.parse(t):Z.parse(t)},transform:function(t){return T(t)?t:t.hasOwnProperty("red")?U.transform(t):N.transform(t)}},X="${c}",Y="${n}";function $(t){var e=[],r=0,i=t.match(A);i&&(r=i.length,t=t.replace(A,X),e.push.apply(e,i.map(D.parse)));var n=t.match(V);return n&&(t=t.replace(V,Y),e.push.apply(e,n.map(R.parse))),{values:e,numColors:r,tokenised:t}}function _(t){return $(t).values}function H(t){var e=$(t),r=e.numColors,i=e.tokenised,n=e.values.length;return function(t){for(var e=i,a=0;a<n;a++)e=e.replace(a<r?X:Y,a<r?D.transform(t[a]):x(t[a]));return e}}var q=function(t){return"number"==typeof t?0:t};var G={test:function(t){var e,r,i,n;return isNaN(t)&&T(t)&&(null!==(r=null===(e=t.match(V))||void 0===e?void 0:e.length)&&void 0!==r?r:0)+(null!==(n=null===(i=t.match(A))||void 0===i?void 0:i.length)&&void 0!==n?n:0)>0},parse:_,createTransformer:H,getAnimatableNone:function(t){var e=_(t);return H(t)(e.map(q))}},J=new Set(["brightness","contrast","saturate","opacity"]);function K(t){var e=t.slice(0,-1).split("("),r=e[0],i=e[1];if("drop-shadow"===r)return t;var n=(i.match(V)||[])[0];if(!n)return t;var a=i.replace(n,""),s=J.has(r)?1:0;return n!==i&&(s*=100),r+"("+s+a+")"}var Q=/([a-z-]*)\(.*?\)/g,tt=O(O({},G),{getAnimatableNone:function(t){var e=t.match(Q);return e?e.map(K).join(" "):t}});const et=()=>({type:"spring",stiffness:500,damping:25,restDelta:.5,restSpeed:10}),rt=t=>({type:"spring",stiffness:550,damping:0===t?100:30,restDelta:.01,restSpeed:10}),it=()=>({type:"keyframes",ease:"linear",duration:300}),nt=t=>({type:"keyframes",duration:800,values:t}),at={default:rt,x:et,y:et,z:et,rotate:et,rotateX:et,rotateY:et,rotateZ:et,scaleX:rt,scaleY:rt,scale:rt,backgroundColor:it,color:it,opacity:it},st=(t,e)=>{let r;return r=Array.isArray(e)?nt:at[t]||at.default,{to:e,...r(e)}},ot={...R,transform:Math.round},ut={color:D,backgroundColor:D,outlineColor:D,fill:D,stroke:D,borderColor:D,borderTopColor:D,borderRightColor:D,borderBottomColor:D,borderLeftColor:D,borderWidth:M,borderTopWidth:M,borderRightWidth:M,borderBottomWidth:M,borderLeftWidth:M,borderRadius:M,radius:M,borderTopLeftRadius:M,borderTopRightRadius:M,borderBottomRightRadius:M,borderBottomLeftRadius:M,width:M,maxWidth:M,height:M,maxHeight:M,size:M,top:M,right:M,bottom:M,left:M,padding:M,paddingTop:M,paddingRight:M,paddingBottom:M,paddingLeft:M,margin:M,marginTop:M,marginRight:M,marginBottom:M,marginLeft:M,rotate:I,rotateX:I,rotateY:I,rotateZ:I,scale:j,scaleX:j,scaleY:j,scaleZ:j,skew:I,skewX:I,skewY:I,distance:M,translateX:M,translateY:M,translateZ:M,x:M,y:M,z:M,perspective:M,transformPerspective:M,opacity:C,originX:P,originY:P,originZ:M,zIndex:ot,filter:tt,WebkitFilter:tt,fillOpacity:C,strokeOpacity:C,numOctaves:ot},lt=t=>ut[t],ct=(t,e)=>e&&"number"==typeof t&&e.transform?e.transform(t):t;const pt={linear:i.linear,easeIn:i.easeIn,easeInOut:i.easeInOut,easeOut:i.easeOut,circIn:i.circIn,circInOut:i.circInOut,circOut:i.circOut,backIn:i.backIn,backInOut:i.backInOut,backOut:i.backOut,anticipate:i.anticipate,bounceIn:i.bounceIn,bounceInOut:i.bounceInOut,bounceOut:i.bounceOut},dt=t=>{if(Array.isArray(t)){const[e,r,n,a]=t;return i.cubicBezier(e,r,n,a)}return"string"==typeof t?pt[t]:t},ft=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!G.test(e)||e.startsWith("url(")));function vt({ease:t,times:e,delay:r,...i}){const n={...i};return e&&(n.offset=e),t&&(n.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(dt):dt(t)),r&&(n.elapsed=-r),n}function ht(t,e,r){return Array.isArray(e.to)&&(t.duration||(t.duration=800)),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({delay:t,repeat:e,repeatType:r,repeatDelay:i,from:n,...a}){return!!Object.keys(a).length}(t)||(t={...t,...st(r,e.to)}),{...e,...vt(t)}}function yt(t,e,r,n,a){const s=function(t,e){return t[e]||t.default||t}(n,t);let o=s.from??e.get();const u=ft(t,r);"none"===o&&u&&"string"==typeof r&&(o=function(t,e){let r=lt(t);return r!==tt&&(r=G),r.getAnimatableNone?r.getAnimatableNone(e):void 0}(t,r));return ft(t,o)&&u&&!1!==s.type?function(u){const l={from:o,to:r,velocity:e.getVelocity(),onUpdate:t=>e.set(t)};return"inertia"===s.type||"decay"===s.type?i.inertia({...l,...s}):i.animate({...ht(s,l,t),onUpdate:t=>{l.onUpdate(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{n.onComplete&&n.onComplete(),a&&a(),u&&u()}})}:function(t){return e.set(r),n.onComplete&&n.onComplete(),a&&a(),t&&t(),{stop:()=>{}}}}const{isArray:mt}=Array;function bt(){const t=e.ref({});return{motionValues:t,stop:r=>{const{value:i}=t;if(r){const t=t=>{i[t].stop(),i[t].destroy(),e.del(i,t)};mt(r)?r.forEach((e=>{i[e]&&t(e)})):i[r]&&t(r)}else Object.values(i).forEach((t=>{t.stop(),t.destroy()})),t.value={}},push:(r,i,n,a={},s)=>{let o=t.value[r];if(!o){const i=new w(n[r]);i.onChange((t=>{e.set(n,r,t)})),e.set(t,r,i),o=i}const u=yt(r,o,i,a,(()=>{s&&s(),o.destroy(),e.del(t,r)}));o.start(u)}}}function gt(t,i={},{push:n,stop:a}=bt()){const s=e.ref(i),o=t=>{if(!s||!s.value||!s.value[t])throw new Error(`The variant ${t} does not exist.`);return s.value[t]},u=e=>{let i=r.isObject(e)?e:o(e);const{transition:a}=i,s=[];for(const r in e){if("transition"===r)continue;const i=e[r];s.push(new Promise((e=>{n(r,i,t,a||st(r,i),e)})))}return Promise.all(s)};return{apply:u,set:i=>{a();let n=r.isObject(i)?i:o(i);for(const r in n){if("transition"===r)continue;e.set(t,r,i[r])}},stopTransitions:a,leave:async t=>{let e;s&&s.value&&(s.value.leave&&(e=s.value.leave),!s.value.leave&&s.value.initial&&(e=s.value.initial)),e?(await u(e),t()):t()}}}const wt="undefined"!=typeof window;function Ot({target:t,state:i,variants:n,apply:a}){const s=e.ref(!1),o=e.ref(!1),u=e.ref(!1),l=e.computed((()=>{let t=[];return n.value.hovered&&(t=[...t,...Object.keys(n.value.hovered)]),n.value.tapped&&(t=[...t,...Object.keys(n.value.tapped)]),n.value.focused&&(t=[...t,...Object.keys(n.value.focused)]),t})),c=e.computed((()=>{const t={};Object.assign(t,i.value),s.value&&n.value.hovered&&Object.assign(t,n.value.hovered),o.value&&n.value.tapped&&Object.assign(t,n.value.tapped),u.value&&n.value.focused&&Object.assign(t,n.value.focused);for(const e in t)l.value.includes(e)||delete t[e];return t}));n.value.hovered&&(r.useEventListener(t.value,"mouseenter",(()=>{s.value=!0})),r.useEventListener(t.value,"mouseleave",(()=>{s.value=!1,o.value=!1})),r.useEventListener(t.value,"mouseout",(()=>{s.value=!1,o.value=!1}))),n.value.tapped&&(wt&&null===window.onmousedown&&(r.useEventListener(t.value,"mousedown",(()=>{o.value=!0})),r.useEventListener(t.value,"mouseup",(()=>{o.value=!1}))),wt&&null===window.onpointerdown&&(r.useEventListener(t.value,"pointerdown",(()=>{o.value=!0})),r.useEventListener(t.value,"pointerup",(()=>{o.value=!1}))),wt&&null===window.ontouchstart&&(r.useEventListener(t.value,"touchstart",(()=>{o.value=!0})),r.useEventListener(t.value,"touchend",(()=>{o.value=!1})))),n.value.focused&&(r.useEventListener(t.value,"focus",(()=>{u.value=!0})),r.useEventListener(t.value,"blur",(()=>{u.value=!1}))),e.watch(c,(t=>{a(t)}))}function kt(t,i={syncVariants:!0,lifeCycleHooks:!0,visibilityHooks:!0,eventListeners:!0}){i.lifeCycleHooks&&function({target:t,variants:r,variant:i}){e.watch(t,(()=>{r.value&&r.value.enter&&(r.value.initial&&(i.value="initial"),e.nextTick((()=>i.value="enter")))}),{immediate:!0,flush:"pre"})}(t),i.syncVariants&&function({state:t,apply:r}){e.watch(t,(t=>{t&&r(t)}),{immediate:!0})}(t),i.visibilityHooks&&function({target:t,variants:i,variant:n}){let a=r.noop;const s=e.watch(t,(e=>{e&&(a=r.useIntersectionObserver(t,(([{isIntersecting:t}])=>{i.value&&i.value.visible&&(n.value=t?"visible":"initial")})).stop)}),{immediate:!0})}(t),i.eventListeners&&Ot(t)}function xt(t={}){const r=e.reactive({...t}),i=e.computed((()=>{const t={};for(const[e,i]of Object.entries(r)){const r=lt(e),n=ct(i,r);t[e]=n}return t}));return{state:r,style:i}}function Vt(t){const r=e.ref(t);let i;const{state:n,style:a}=xt(),s=e.watch(r,(t=>{if(t){for(const r of Object.keys(ut))null!=t.style[r]&&""!==t.style[r]&&e.set(n,r,t.style[r]);if(i)for(const r in i)e.set(t.style,r,i[r])}})),o=e.watch(a,(t=>{r.value&&r.value.style?Object.assign(r.value.style,t):i=t}),{immediate:!0});return{style:n,stop:()=>{s(),o()}}}const At={x:"translateX",y:"translateY",z:"translateZ"};function Lt(t={},r=!0){const i=e.reactive({...t}),n=e.ref("");return e.watch(i,(()=>{let t="",e=!1;for(const[r,n]of Object.entries(i)){const i=lt(r),a=ct(n,i);t+=`${At[r]||r}(${a}) `,"z"!==r&&"translateZ"!==r||(e=!0)}!e&&r?t+="translateZ(0)":t=t.trim(),n.value=t}),{immediate:!0,deep:!0}),{state:i,transform:n}}function Tt(t){const r=e.ref(t);let i;const{state:n,transform:a}=Lt(),s=e.watch(r,(t=>{t&&i&&(t.style.transform=i)})),o=e.watch(a,(t=>{r.value&&r.value.style?r.value.style.transform=t:i=t}),{immediate:!0});return{transform:n,stop:()=>{s(),o()}}}const Rt=["","X","Y","Z"],Ct=["transformPerspective","x","y","z"];["perspective","translate","scale","rotate","skew"].forEach((t=>{Rt.forEach((e=>{Ct.push(t+e)}))}));const jt=new Set(Ct);function Et(t){return jt.has(t)}function It(t){const r=e.ref(t),{style:i}=Vt(r),{transform:n}=Tt(r),a=e.reactive({});return e.watch(a,(t=>{for(const r in t){const a=Et(r)?n:i;a[r]&&a[r]===t[r]||e.set(a,r,t[r])}}),{immediate:!0,deep:!0}),{motionProperties:a,style:i,transform:n}}function St(t={}){const r=e.ref(t),i=e.ref();return{state:e.computed((()=>{if(i.value)return r.value[i.value]})),variant:i}}function Mt(t,r={},i){const n=e.ref(r),a=e.ref(t),{motionProperties:s}=It(a),{variant:o,state:u}=St(n),l={target:a,variant:o,variants:n,state:u,motionProperties:s,...gt(s,n)};return kt(l,i),l}const Pt=["initial","enter","leave","visible","hovered","tapped","focused","delay"],zt=t=>{const i=(i,a,s)=>{const o=e.ref(t||{});((t,e)=>{const i=t.props?t.props:t.data&&t.data.attrs?t.data.attrs:{};i&&(i.variants&&r.isObject(i.variants)&&(e.value={...e.value,...i.variants}),Pt.forEach((t=>{if("delay"!==t)i&&i[t]&&r.isObject(i[t])&&(e.value[t]=i[t]);else if(i&&i[t]&&r.isNumber(i[t])){const r=i[t];e&&e.value&&(e.value.enter&&(e.value.enter.transition||(e.value.enter.transition={}),e.value.enter.transition={...e.value.enter.transition,delay:r}),e.value.visible&&(e.value.visible.transition||(e.value.visible.transition={}),e.value.visible.transition={...e.value.visible.transition,delay:r}))}})))})(s,o);const u=Mt(i,o);a.value&&e.set(n,a.value,u)},a=(t,r,i)=>{r.value&&n[r.value]&&e.del(n,r.value)};return{created:i,unmounted:a,bind:i,unbind:a}},Bt={initial:{opacity:0},enter:{opacity:1}},Nt={initial:{opacity:0},visible:{opacity:1}},Ft={initial:{scale:0,opacity:0},enter:{scale:1,opacity:1}},Wt={initial:{scale:0,opacity:0},visible:{scale:1,opacity:1}},Ut={initial:{x:-100,rotate:90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Zt={initial:{x:-100,rotate:90,opacity:0},visible:{x:0,rotate:0,opacity:1}},Dt={initial:{x:100,rotate:-90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Xt={initial:{x:100,rotate:-90,opacity:0},visible:{x:0,rotate:0,opacity:1}},Yt={initial:{y:-100,rotate:-90,opacity:0},enter:{y:0,rotate:0,opacity:1}},$t={initial:{y:-100,rotate:-90,opacity:0},visible:{y:0,rotate:0,opacity:1}},_t={initial:{y:100,rotate:90,opacity:0},enter:{y:0,rotate:0,opacity:1}},Ht={initial:{y:100,rotate:90,opacity:0},visible:{y:0,rotate:0,opacity:1}},qt={initial:{x:-100,opacity:0},enter:{x:0,opacity:1}},Gt={initial:{x:-100,opacity:0},visible:{x:0,opacity:1}},Jt={initial:{x:100,opacity:0},enter:{x:0,opacity:1}},Kt={initial:{x:100,opacity:0},visible:{x:0,opacity:1}},Qt={initial:{y:-100,opacity:0},enter:{y:0,opacity:1}},te={initial:{y:-100,opacity:0},visible:{y:0,opacity:1}},ee={initial:{y:100,opacity:0},enter:{y:0,opacity:1}},re={initial:{y:100,opacity:0},visible:{y:0,opacity:1}};var ie=Object.freeze({__proto__:null,fade:Bt,fadeVisible:Nt,pop:Ft,popVisible:Wt,rollBottom:_t,rollLeft:Ut,rollRight:Dt,rollTop:Yt,rollVisibleBottom:Ht,rollVisibleLeft:Zt,rollVisibleRight:Xt,rollVisibleTop:$t,slideBottom:ee,slideLeft:qt,slideRight:Jt,slideTop:Qt,slideVisibleBottom:re,slideVisibleLeft:Gt,slideVisibleRight:Kt,slideVisibleTop:te});function ne(t){const e="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;",r=new RegExp(e.split("").join("|"),"g");return t.toString().replace(/[A-Z]/g,(t=>"-"+t)).toLowerCase().replace(/\s+/g,"-").replace(r,(t=>"aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------".charAt(e.indexOf(t)))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}const ae={install(t,e){if(t.directive("motion",zt()),!e||e&&!e.excludePresets)for(const e in ie){const r=ie[e];t.directive(`motion-${ne(e)}`,zt(r))}if(e&&e.directives)for(const r in e.directives){const i=e.directives[r];0,t.directive(`motion-${r}`,zt(i))}}};return t.MotionDirective=zt,t.MotionPlugin=ae,t.fade=Bt,t.fadeVisible=Nt,t.pop=Ft,t.popVisible=Wt,t.reactiveStyle=xt,t.reactiveTransform=Lt,t.rollBottom=_t,t.rollLeft=Ut,t.rollRight=Dt,t.rollTop=Yt,t.rollVisibleBottom=Ht,t.rollVisibleLeft=Zt,t.rollVisibleRight=Xt,t.rollVisibleTop=$t,t.slideBottom=ee,t.slideLeft=qt,t.slideRight=Jt,t.slideTop=Qt,t.slideVisibleBottom=re,t.slideVisibleLeft=Gt,t.slideVisibleRight=Kt,t.slideVisibleTop=te,t.slugify=ne,t.useElementStyle=Vt,t.useElementTransform=Tt,t.useMotion=Mt,t.useMotionControls=gt,t.useMotionProperties=It,t.useMotionTransitions=bt,t.useMotionVariants=St,t.useMotions=function(){return n},Object.defineProperty(t,"__esModule",{value:!0}),t}({},VueDemi,VueUse,popmotion); |
{ | ||
"name": "@vueuse/motion", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "🤹 Vue Composables putting your components in motion", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/vueuse/motion", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
576098
13063