motion-plus-vue 1.1.4 → 1.1.6

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/dist/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("motion-v");function te(n,{locales:t,format:o},i,r){const d=new Intl.NumberFormat(t,o).formatToParts(Number(n));i&&d.unshift({type:"prefix",value:i}),r&&d.push({type:"suffix",value:r});const f=[],h=[],g=[],v=[],u={},l=m=>`${m}:${u[m]=(u[m]??-1)+1}`;let p="",w=!1,P=!1,y=0;for(const m of d){p+=m.value;const c=m.type==="minusSign"||m.type==="plusSign"?"sign":m.type;switch(c){case"integer":w=!0,h.push(...m.value.split("").map(k=>({type:c,value:parseInt(k)})));break;case"group":h.push({type:c,value:m.value});break;case"decimal":P=!0,g.push({type:c,value:m.value,key:l(c),originalIndex:y++});break;case"fraction":g.push(...m.value.split("").map(k=>({type:c,value:parseInt(k),key:l(c),originalIndex:y++})));break;default:(w||P?v:f).push({type:c,value:m.value,key:l(c),originalIndex:y++})}}const x=[];for(let m=h.length-1;m>=0;m--){const c=l(h[m].type);x.unshift({...h[m],key:c,originalIndex:m})}return{pre:f,integer:x,fraction:g,post:v,formatted:p}}const[ne,oe]=s.createContext("SectionContext");function Z(){const n={current:!0};return e.onMounted(()=>{n.current=!1}),n}function L(n){const{width:t,fontSize:o}=getComputedStyle(n);return`${parseFloat(t)/parseFloat(o)}em`}const S="var(--mask-height, 0.15em)",N="var(--mask-width, 0.5em)",b=`calc(${N} / var(--invert-x, 1))`,z="#000 0, transparent 71%",ie=`linear-gradient(to right, transparent 0, #000 ${b}, #000 calc(100% - ${b}), transparent),linear-gradient(to bottom, transparent 0, #000 ${S}, #000 calc(100% - ${S}), transparent 100%),radial-gradient(at bottom right, ${z}),radial-gradient(at bottom left, ${z}), radial-gradient(at top left, ${z}), radial-gradient(at top right, ${z})`,re=`100% calc(100% - ${S} * 2),calc(100% - ${b} * 2) 100%,${b} ${S},${b} ${S},${b} ${S},${b} ${S}`;s.addScaleCorrector({"--invert-x":{correct:(n,{treeScale:t,projectionDelta:o})=>o.x.scale*t.x}});const D={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function q(n){const t=e.ref();function o(r){t.value=r==null?void 0:r.$el}e.watch(()=>n.isPresent,r=>{var a;t.value&&((a=s.mountedStates.get(t.value))==null||a.setActive("exit",!r))});function i(r){var a;r.detail.isExit&&!n.isPresent&&((a=n.onRemove)==null||a.call(n,n.partKey))}return{root:t,getRoot:o,handleComplete:i}}const ae=e.defineComponent({__name:"NumberSymbol",props:{partKey:{},type:{},value:{},isPresent:{type:Boolean},onRemove:{type:Function},style:{}},setup(n){const t=n,{justify:o}=ne(),{getRoot:i,handleComplete:r}=q(t);return(a,d)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{ref:e.unref(i),layout:"position","data-state":a.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(o),padding:`calc(${e.unref(S)}/2) 0`,position:"relative",pointerEvents:a.isPresent?void 0:"none"}),"aria-hidden":!a.isPresent,onMotioncomplete:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(e.unref(s.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(o),initial:!1},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(s.motion).span,{key:a.value,layout:e.unref(o)==="right"?"position":!1,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0],transition:{duration:.3}},style:{display:"inline-block",whiteSpace:"pre"},transition:{duration:.2}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value),1)]),_:1},8,["layout"]))]),_:1},8,["anchor-x"])]),_:1},8,["data-state","style","aria-hidden","onMotioncomplete"]))}}),J=new WeakMap,se=e.defineComponent({__name:"NumberDigit",props:{value:{},initialValue:{default:void 0},isPresent:{type:Boolean},partKey:{},onRemove:{},style:{}},setup(n){const t=n,o=t.initialValue??t.value,i=Z(),r=s.useMotionConfig(),a=e.ref(),d=e.ref(Array(10).fill(null)),f=e.ref(),{getRoot:h,handleComplete:g,root:v}=q(t);let u=o;const l=e.ref(o);e.watch([()=>t.value,()=>t.isPresent],([y,x])=>{if(!x)return l.value=0;if(i.current)return e.nextTick(()=>{l.value=y});l.value=y},{immediate:!0});function p(y){var k;if(!a.value||y===u)return;const x=a.value.getBoundingClientRect(),m=(k=v.value)==null?void 0:k.getBoundingClientRect(),c=x.height*(y-u)+(x.top-(m?m.top||0:x.top));s.animate(a.value,{y:[c,0]},r.value.transition)}function w(y){if(i.current&&o===y||!d.value[y])return;const x=L(d.value[y]);v.value&&J.set(v.value,x),f.value=x}e.watch(l,y=>{w(y)},{immediate:!0,flush:"post"}),e.watch(l,(y,x,m)=>{p(y),m(()=>{u=y})},{immediate:!0,flush:"pre"});function P(y){return()=>e.createVNode("span",{key:y,style:{display:"inline-block",padding:`calc(${S}/2) 0`}},[y])}return(y,x)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{ref:e.unref(h),layout:"position","data-state":y.isPresent?void 0:"exiting","data-key":y.partKey,style:e.normalizeStyle({display:"inline-flex",justifyContent:"center",width:f.value,pointerEvents:y.isPresent?void 0:"none"}),"aria-hidden":!y.isPresent,onMotioncomplete:e.unref(g)},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"scope",ref:a,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"}},[l.value!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({...e.unref(D),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P(m-1)),{key:m-1}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P(l.value)))),l.value!==9?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref(D),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(9-l.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(P(l.value+m)),{key:l.value+m}))),128))],4)):e.createCommentVNode("",!0)],512)]),_:1},8,["data-state","data-key","style","aria-hidden","onMotioncomplete"]))}}),E=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{}},setup(n){const t=n,o=e.ref(),i=s.useDomRef(),r=e.ref(),a=Z();e.watch(()=>t.parts,g=>{const v=new Map(g.map(l=>[l.key,{...l,isPresent:!0}]));f=[...f.filter(l=>!v.get(l.key)).map(l=>({...l,isPresent:!1})),...g].sort((l,p)=>d.value==="right"?l.isPresent===p.isPresent?l.originalIndex-p.originalIndex:l.isPresent?-1:1:d.value==="left"?l.isPresent===p.isPresent?l.originalIndex-p.originalIndex:l.isPresent?1:-1:l.originalIndex-p.originalIndex)},{flush:"pre"}),e.watch(()=>t.parts.map(g=>g.value).join(""),(g,v)=>{if(!r.value)return;if(a.current){i.value&&(i.value.style.width=L(r.value));return}const u=Array.from(r.value.children).map(p=>{if(!(p instanceof HTMLElement))return;if(p.dataset.state==="exiting"){const y=p.nextSibling;return p.remove(),()=>{r.value&&r.value.insertBefore(p,y)}}const w=J.get(p);if(!w)return;const P=p.style.width;return p.style.width=w,()=>{p.style.width=P}});function l(){const p=L(r.value);o.value=p}+g>+(v||0)?s.frame.read(l):l();for(let p=u.length-1;p>=0;p--){const w=u[p];w&&w()}},{immediate:!0,flush:"post"});const d=e.toRef(t,"justify");oe({justify:d});let f=t.parts;function h(g){f=f.filter(v=>v.key!==g)}return(g,v)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{ref:e.unref(i),class:e.normalizeClass(`number-section-${g.name}`),style:e.normalizeStyle({...g.style,display:"inline-flex",justifyContent:d.value,width:o.value}),layout:"position"},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:r,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[v[0]||(v[0]=e.createTextVNode(" ​ ")),e.createVNode(e.unref(s.AnimatePresence),{mode:g.mode,"anchor-x":d.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.key},[u.type==="integer"||u.type==="fraction"?(e.openBlock(),e.createBlock(se,{key:u.key,"part-key":u.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:u.value,"is-present":u.isPresent??!0,"initial-value":e.unref(a).current?void 0:0,onRemove:h},null,8,["part-key","value","is-present","initial-value"])):(e.openBlock(),e.createBlock(ae,{key:u.type==="literal"?`${u.key}:${u.value}`:u.key,type:u.type,"part-key":u.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:u.value,"is-present":u.isPresent??!0,onRemove:h},null,8,["type","part-key","value","is-present"]))],64))),128))]),_:1},8,["mode","anchor-x"])],512)]),_:1},8,["class","style"]))}}),ue=e.defineComponent({__name:"Mask",setup(n){return(t,o)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{layout:"","aria-hidden":!0,style:e.normalizeStyle({display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${e.unref(N)})`,padding:`calc(${e.unref(S)}/2) ${e.unref(N)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(ie),webkitMaskSize:e.unref(re),webkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",webkitMaskRepeat:"no-repeat"})},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["style"]))}}),le=e.defineComponent({name:"AnimateNumber",inheritAttrs:!1,__name:"AnimateNumber",props:{locales:{},format:{},transition:{},suffix:{},prefix:{},value:{},style:{}},setup(n){const t={opacity:{duration:1,ease:s.easeOut},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},o=n,i=e.computed(()=>{const f=o.value;return te(f,{locales:o.locales,format:o.format},o.prefix,o.suffix)}),r=s.useMotionConfig(),a=e.computed(()=>o.transition??r.value.transition??t);function d(){const{format:f,prefix:h,suffix:g,locales:v,value:u,...l}=o;return l}return(f,h)=>(e.openBlock(),e.createBlock(e.unref(s.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(s.MotionConfig),{transition:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).div,e.mergeProps({...f.$attrs,...d()},{layout:"",style:{lineHeight:"1",...f.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).div,{layout:"","aria-label":i.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(E,{style:e.normalizeStyle({padding:`calc(${e.unref(S)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:i.value.pre,name:"pre"},null,8,["style","parts"]),e.createVNode(ue,null,{default:e.withCtx(()=>[e.createVNode(E,{justify:"right",parts:i.value.integer,name:"integer",mode:"popLayout"},null,8,["parts"]),e.createVNode(E,{layout:"position",parts:i.value.fraction,name:"fraction",mode:"popLayout"},null,8,["parts"])]),_:1}),e.createVNode(E,{style:e.normalizeStyle({padding:`calc(${e.unref(S)}/2) 0`}),"aria-hidden":!0,layout:"position",mode:"popLayout",parts:i.value.post,name:"post"},null,8,["style","parts"])]),_:1},8,["aria-label"])]),_:1},16,["style"])]),_:1},8,["transition"])]),_:1}))}}),ce=le;function fe(){const n=document.createElement("style");return n.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("motion-v");function ee(n,{locales:t,format:o},i,a){const y=new Intl.NumberFormat(t,o).formatToParts(Number(n));i&&y.unshift({type:"prefix",value:i}),a&&y.push({type:"suffix",value:a});const d=[],v=[],w=[],h=[],s={},f=m=>`${m}:${s[m]=(s[m]??-1)+1}`;let p="",x=!1,g=!1,c=0;for(const m of y){p+=m.value;const l=m.type==="minusSign"||m.type==="plusSign"?"sign":m.type;switch(l){case"integer":x=!0,v.push(...m.value.split("").map(B=>({type:l,value:parseInt(B)})));break;case"group":v.push({type:l,value:m.value});break;case"decimal":g=!0,w.push({type:l,value:m.value,key:f(l),originalIndex:c++});break;case"fraction":w.push(...m.value.split("").map(B=>({type:l,value:parseInt(B),key:f(l),originalIndex:c++})));break;default:(x||g?h:d).push({type:l,value:m.value,key:f(l),originalIndex:c++})}}const k=[];for(let m=v.length-1;m>=0;m--){const l=f(v[m].type);k.unshift({...v[m],key:l,originalIndex:m})}return{pre:d,integer:k,fraction:w,post:h,formatted:p}}const[te,ne]=u.createContext("SectionContext");function Z(){const n={current:!0};return e.onMounted(()=>{n.current=!1}),n}function L(n){const{width:t,fontSize:o}=getComputedStyle(n);return`${parseFloat(t)/parseFloat(o)}em`}const b="var(--mask-height, 0.15em)",N="var(--mask-width, 0.5em)",$=`calc(${N} / var(--invert-x, 1))`,z="#000 0, transparent 71%",oe=`linear-gradient(to right, transparent 0, #000 ${$}, #000 calc(100% - ${$}), transparent),linear-gradient(to bottom, transparent 0, #000 ${b}, #000 calc(100% - ${b}), transparent 100%),radial-gradient(at bottom right, ${z}),radial-gradient(at bottom left, ${z}), radial-gradient(at top left, ${z}), radial-gradient(at top right, ${z})`,ie=`100% calc(100% - ${b} * 2),calc(100% - ${$} * 2) 100%,${$} ${b},${$} ${b},${$} ${b},${$} ${b}`;u.addScaleCorrector({"--invert-x":{correct:(n,{treeScale:t,projectionDelta:o})=>o.x.scale*t.x}});const O={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function q(n){const t=e.ref();function o(a){t.value=a==null?void 0:a.$el}e.watch(()=>n.isPresent,a=>{var r;t.value&&((r=u.mountedStates.get(t.value))==null||r.setActive("exit",!a))});function i(a){var r;a.detail.isExit&&!n.isPresent&&((r=n.onRemove)==null||r.call(n,n.partKey,a.target))}return{root:t,getRoot:o,handleComplete:i}}const ae=e.defineComponent({__name:"NumberSymbol",props:{partKey:{},type:{},value:{},isPresent:{type:Boolean},onRemove:{type:Function},style:{},layoutDependency:{},preInitial:{type:Boolean}},setup(n){const t=n,{justify:o}=te(),{getRoot:i,handleComplete:a}=q(t);return(r,y)=>(e.openBlock(),e.createBlock(e.unref(u.motion).span,{ref:e.unref(i),layout:"position","layout-dependency":r.layoutDependency,"data-state":r.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(o),padding:`calc(${e.unref(b)}/2) 0`,position:"relative",pointerEvents:r.isPresent?void 0:"none"}),"aria-hidden":!r.isPresent,onMotioncomplete:e.unref(a)},{default:e.withCtx(()=>[e.createVNode(e.unref(u.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(o),initial:r.preInitial},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(u.motion).span,{key:r.value,layout:e.unref(o)==="right"?"position":!1,"layout-dependency":r.layoutDependency,initial:{opacity:0,left:e.unref(o)==="right"&&r.preInitial===void 0?"-100%":void 0},animate:{opacity:[null,1],left:0},exit:{opacity:[null,0],transition:{opacity:{duration:.4}}},style:{display:"inline-block",whiteSpace:"pre",position:"relative"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value),1)]),_:1},8,["layout","layout-dependency","initial"]))]),_:1},8,["anchor-x","initial"])]),_:1},8,["layout-dependency","data-state","style","aria-hidden","onMotioncomplete"]))}}),re=new WeakMap,ue=e.defineComponent({__name:"NumberDigit",props:{value:{},initialValue:{default:void 0},isPresent:{type:Boolean},partKey:{},onRemove:{},style:{},layoutDependency:{}},setup(n){const t=n,o=t.initialValue??t.value,i=Z(),a=u.useMotionConfig(),r=e.ref(),y=e.ref(Array(10).fill(null)),d=e.ref(),{getRoot:v,handleComplete:w,root:h}=q(t);let s=o;const f=e.ref(o);e.watch([()=>t.value,()=>t.isPresent],([c,k])=>{if(!k)return f.value=0;if(i.current)return e.nextTick(()=>{f.value=c});f.value=c},{immediate:!0});function p(c){var B;if(!r.value||c===s)return;const k=r.value.getBoundingClientRect(),m=(B=h.value)==null?void 0:B.getBoundingClientRect(),l=k.height*(c-s)+(k.top-(m?m.top||0:k.top));u.animate(r.value,{y:[l,0]},a.value.transition)}function x(c){if(i.current&&o===c||!y.value[c])return;const k=L(y.value[c]);h.value&&(re.set(h.value,k),h.value.style.width=k),d.value=k}e.watch(f,c=>{x(c)},{immediate:!0,flush:"sync"}),e.watch(f,async(c,k,m)=>{await e.nextTick(),p(c),m(()=>{s=c})},{immediate:!0,flush:"sync"});function g(c){return()=>e.createVNode("span",{key:c,style:{display:"inline-block",padding:`calc(${b}/2) 0`},ref:k=>{y.value[c]=k}},[c])}return(c,k)=>(e.openBlock(),e.createBlock(e.unref(u.motion).span,{ref:e.unref(v),layout:"position","layout-dependency":c.layoutDependency,"data-state":c.isPresent?void 0:"exiting","data-key":c.partKey,style:e.normalizeStyle({display:"inline-flex",justifyContent:"center",width:d.value,pointerEvents:c.isPresent?void 0:"none"}),"aria-hidden":!c.isPresent,onMotioncomplete:e.unref(w)},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"scope",ref:r,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"}},[f.value!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({...e.unref(O),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g(m-1)),{key:m-1}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g(f.value)))),f.value!==9?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref(O),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(9-f.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g(f.value+m)),{key:f.value+m}))),128))],4)):e.createCommentVNode("",!0)],512)]),_:1},8,["layout-dependency","data-state","data-key","style","aria-hidden","onMotioncomplete"]))}}),E=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{},layoutDependency:{}},setup(n){var h;const t=n,o=e.ref(),i=u.useDomRef(),a=e.ref(),r=Z(),y=e.ref(t.parts);let d=t.name==="pre"&&!((h=t.parts)!=null&&h.length)?void 0:!1;e.watch(()=>t.parts,s=>{const f=new Map(s.map(g=>[g.key,{...g,isPresent:!0}])),p=y.value.filter(g=>!f.get(g.key)).map(g=>({...g,isPresent:!1})),x=s.sort((g,c)=>g.originalIndex-c.originalIndex);y.value=p.concat(x)},{flush:"pre"}),e.watch(()=>{var s;return(s=t.parts)==null?void 0:s.map(f=>f.value).join("")},async(s,f)=>{if(await e.nextTick(),d=!1,!a.value)return;if(r.current){i.value&&(i.value.style.width=L(a.value));return}const p=Array.from(a.value.children).map(g=>{if(g instanceof HTMLElement&&g.dataset.state==="exiting"){const c=g.nextSibling;return g.remove(),()=>{a.value&&a.value.insertBefore(g,c)}}}),x=L(a.value);o.value=x;for(let g=p.length-1;g>=0;g--){const c=p[g];c&&c()}},{flush:"post"});const v=e.toRef(t,"justify");ne({justify:v});function w(s,f){var p;y.value=y.value.filter(x=>x.key!==s),(p=f==null?void 0:f.parentElement)==null||p.removeChild(f)}return(s,f)=>(e.openBlock(),e.createBlock(e.unref(u.motion).span,{ref:e.unref(i),class:e.normalizeClass(`number-section-${s.name}`),style:e.normalizeStyle({...s.style,display:"inline-flex",justifyContent:v.value,width:o.value}),layout:"position","layout-dependency":s.layoutDependency},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:a,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[f[0]||(f[0]=e.createTextVNode(" ​ ")),e.createVNode(e.unref(u.AnimatePresence),{mode:s.mode,"anchor-x":v.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.key},[p.type==="integer"||p.type==="fraction"?(e.openBlock(),e.createBlock(ue,{key:p.key,"part-key":p.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:p.value,"is-present":p.isPresent??!0,"initial-value":e.unref(r).current?void 0:0,"layout-dependency":s.layoutDependency,onRemove:w},null,8,["part-key","value","is-present","initial-value","layout-dependency"])):(e.openBlock(),e.createBlock(ae,{key:p.type==="literal"?`${p.key}:${p.value}`:p.key,type:p.type,"part-key":p.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:p.value,"is-present":p.isPresent??!0,"pre-initial":e.unref(d),"layout-dependency":s.layoutDependency,onRemove:w},null,8,["type","part-key","value","is-present","pre-initial","layout-dependency"]))],64))),128))]),_:1},8,["mode","anchor-x"])],512)]),_:1},8,["class","style","layout-dependency"]))}}),se=e.defineComponent({__name:"Mask",props:{layoutDependency:{}},setup(n){return(t,o)=>(e.openBlock(),e.createBlock(e.unref(u.motion).span,{layout:"","layout-dependency":t.layoutDependency,"aria-hidden":!0,style:e.normalizeStyle({display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${e.unref(N)})`,padding:`calc(${e.unref(b)}/2) ${e.unref(N)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(oe),webkitMaskSize:e.unref(ie),webkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",webkitMaskRepeat:"no-repeat"})},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["layout-dependency","style"]))}}),le=e.defineComponent({name:"AnimateNumber",inheritAttrs:!1,__name:"AnimateNumber",props:{locales:{},format:{},transition:{},suffix:{},prefix:{},value:{},style:{},layoutDependency:{}},setup(n){const t={opacity:{duration:1,ease:u.easeOut},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},o=n,i=e.computed(()=>{const v=o.value;return ee(v,{locales:o.locales,format:o.format},o.prefix,o.suffix)}),a=u.useMotionConfig(),r=e.computed(()=>o.transition??a.value.transition??t);function y(){const{format:v,prefix:w,suffix:h,locales:s,value:f,layoutDependency:p,...x}=o;return x}const d=e.computed(()=>{if(o.layoutDependency!==void 0)return{layoutDependency:o.layoutDependency,value:o.value}});return(v,w)=>(e.openBlock(),e.createBlock(e.unref(u.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(u.MotionConfig),{transition:r.value},{default:e.withCtx(()=>[e.createVNode(e.unref(u.motion).div,e.mergeProps({...v.$attrs,...y()},{layout:"","layout-dependency":d.value,style:{lineHeight:"1",...v.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(u.motion).div,{layout:"","layout-dependency":d.value,"aria-label":i.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(E,{"layout-dependency":d.value,style:e.normalizeStyle({padding:`calc(${e.unref(b)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:i.value.pre,name:"pre"},null,8,["layout-dependency","style","parts"]),e.createVNode(se,{"layout-dependency":d.value},{default:e.withCtx(()=>[e.createVNode(E,{"layout-dependency":d.value,justify:"right",parts:i.value.integer,name:"integer",mode:"popLayout"},null,8,["layout-dependency","parts"]),e.createVNode(E,{"layout-dependency":d.value,layout:"position",parts:i.value.fraction,name:"fraction",mode:"popLayout"},null,8,["layout-dependency","parts"])]),_:1},8,["layout-dependency"]),e.createVNode(E,{"layout-dependency":d.value,style:e.normalizeStyle({padding:`calc(${e.unref(b)}/2) 0`}),"aria-hidden":!0,layout:"position",mode:"popLayout",parts:i.value.post,name:"post"},null,8,["layout-dependency","style","parts"])]),_:1},8,["layout-dependency","aria-label"])]),_:1},16,["layout-dependency","style"])]),_:1},8,["transition"])]),_:1}))}}),ce=le;function de(){const n=document.createElement("style");return n.textContent=`
2
2
  * {
3
3
  cursor: none !important;
4
4
  }
@@ -6,4 +6,4 @@
6
6
  [data-motion-cursor="pointer"] {
7
7
  background-color: #333;
8
8
  }
9
- `,document.head.appendChild(n),()=>{document.head.removeChild(n)}}function de(n){e.watch(n,(t,o,i)=>{const r=t?fe():s.noop;return i(()=>{r()})},{immediate:!0,flush:"post"})}function R(n){return t=>{t.pointerType==="mouse"&&n(t)}}function F(n){return R(t=>{t.button===0&&n(t)})}let V,_;function pe(){V=s.motionValue(0),_=s.motionValue(0);let n=0,t=0;function o(){V.set(n),_.set(t)}typeof window<"u"&&window.addEventListener("pointermove",R(i=>{n=i.clientX,t=i.clientY,s.frame.update(o)}))}function j(){return V||pe(),{x:V,y:_}}function me(n,t){return{x:s.useTransform(()=>n.x.get()+t.value.x),y:s.useTransform(()=>n.y.get()+t.value.y)}}function ye(n){return n.closest("[data-cursor]")}function ge(n){return n.closest('a, button, input[type="button"]:not(:disabled)')}function ve(n){return window.getComputedStyle(n).userSelect==="none"?null:n.closest("p, textarea:not(:disabled), input[type='text']:not(:disabled), h1, h2, h3, h4, h5, h6")}function he(n){let t=ye(n);return t?[t.dataset.cursor,t]:(t=ge(n),t?["pointer",t]:(t=ve(n),t?["text",t]:["default",null]))}let M=null,C={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function we(n){let t=null;if("closest"in n){const o=n.closest("[data-cursor-zone]");o instanceof HTMLElement&&(t=o.dataset.cursorZone||null)}return t}function xe(){if(typeof window>"u")return{onChange:()=>()=>{}};const n=new Set;function t(f){C={...C,...f},n.forEach(h=>h(C))}const o=F(()=>{C.isPressed||t({isPressed:!0})}),i=F(()=>{C.isPressed&&t({isPressed:!1})}),r=R(({target:f})=>{if(!f)return;const[h,g]=he(f);let v=!1;const u={target:g,zone:we(f)};h!==C.type&&(u.type=h,v=!0),u.zone!==C.zone&&(C.zone=u.zone,v=!0);const l=h==="pointer"&&g?g.getBoundingClientRect():null;if(l!==C.targetBoundingBox&&(u.targetBoundingBox=l,v=!0),h==="text"){const{fontSize:p}=window.getComputedStyle(f),w=p?parseInt(p):null;w!==C.fontSize&&(u.fontSize=w,v=!0)}else C.fontSize&&(u.fontSize=null,v=!0);v&&t(u)});function a(){typeof window>"u"||(window.addEventListener("pointerover",r),window.addEventListener("pointerdown",o),window.addEventListener("pointerup",i))}function d(){window.removeEventListener("pointerover",r),window.removeEventListener("pointerdown",o),window.removeEventListener("pointerup",i)}return{onChange:f=>(n.size||a(),n.add(f),()=>{n.delete(f),n.size||d()})}}function ke(){return M||(M=xe()),M}function A(){const n=e.ref({...C});return e.watch(n,()=>ke().onChange(t=>{n.value=t}),{immediate:!0,flush:"post"}),n}let T=null;function Be(){const n=new Set;function t(){n.forEach(a=>a.show())}function o(){n.forEach(a=>a.hide())}function i(){document.body.addEventListener("mouseenter",t),document.body.addEventListener("mouseleave",o)}function r(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",o)}return{on:a=>typeof window>"u"?s.noop:(n.size||i(),n.add(a),()=>{n.delete(a),n.size===0&&r()})}}function Ce(){return T||(T=Be()),T}function Q(n){const t=e.ref(!0);return e.watch(t,()=>Ce().on({show:()=>{t.value||(n(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const H={x:0,y:0},Se={x:.5,y:.5},Pe={duration:0},be={stiffness:1e3,damping:100},$e={duration:.15,ease:[.38,.12,.29,1]},W={magneticOptions:{morph:!0,padding:5,snap:.8}},X=17,Y=31,K=4,ze=20;function I(n,t,o){const i={width:(o==null?void 0:o.width)??n,height:(o==null?void 0:o.height)??t};return typeof i.width=="number"&&(i.width=`${i.width}px`),typeof i.height=="number"&&(i.height=`${i.height}px`),i}function Ee({type:n,state:t,hasChildren:o,style:i,isMagnetic:r,magneticOptions:a,matchTextSize:d}){const f=r&&t.targetBoundingBox;if(o&&!f)return I("auto","auto",i);const{padding:h,morph:g}=a;switch(n){case"pointer":if(r&&g&&t.targetBoundingBox){const{width:v,height:u}=t.targetBoundingBox;return{width:`${v+h*2}px`,height:`${u+h*2}px`}}return I(Y,Y,i);case"text":return d&&t.fontSize?{width:`${K}px`,height:`${t.fontSize}px`}:I(K,ze,i);default:return I(X,X,i)}}function Ie({x:n,y:t},o){const i=e.ref(n.prev!==void 0||t.prev!==void 0);return e.watch(i,()=>{if(i.value)return;const r=()=>{i.value=!0,o(),a()},a=s.pipe(n.on("change",r),t.on("change",r));return()=>a()},{immediate:!0}),i}function Ve(n,t,o){return s.useTransform(()=>s.mix(n.value.get(),t.get(),o.get()))}function G(n,t,o){const i=s.useSpring(0,{stiffness:600,damping:50}),r=s.useMotionValue(0),a=Ve(n,i,r);return e.watch(()=>o==null?void 0:o.value,(d,f)=>{d?(!f&&!r.isAnimating()?i.jump(d):i.set(d),s.animate(r,t.value||0)):s.animate(r,0)},{immediate:!0,flush:"sync"}),a}function Me(n,t,o,i){const r=G(e.computed(()=>n.value.x),i,e.computed(()=>o.value.targetBoundingBox?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),a=G(e.computed(()=>n.value.y),i,e.computed(()=>o.value.targetBoundingBox?o.value.targetBoundingBox.top+o.value.targetBoundingBox.height/2:void 0));return e.computed(()=>t?{x:r,y:a}:n.value)}const Te=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:n})=>n?H:Se},offset:{default:()=>H},spring:{type:[Boolean,Object],default:({follow:n})=>n?be:!1},matchTextSize:{type:Boolean,default:!0},magnetic:{type:[Boolean,Object],default:!1},transition:{},variants:{},style:{},show:{type:Boolean,default:!0}},setup(n){const t=n,{offset:o,magnetic:i}=e.toRefs(t),r=s.useReducedMotion();de(()=>!r.value&&!t.follow);const a=j(),d=me(a,o),f=s.useSpring(d.x,t.spring||void 0),h=s.useSpring(d.y,t.spring||void 0),g=e.computed(()=>typeof t.magnetic=="object"?{...W.magneticOptions,...t.magnetic}:W.magneticOptions);function v(){const c=d.x.on("change",B=>{f.jump(B),c()}),k=d.y.on("change",B=>{h.jump(B),k()})}const u=A(),l=Q(v),p=Me(e.computed(()=>t.spring?{x:f,y:h}:a),e.computed(()=>!!i.value),u,e.computed(()=>g.value&&g.value.snap)),w=e.useSlots(),P=e.computed(()=>{var B,$;const c=($=(B=w.default)==null?void 0:B.call(w))==null?void 0:$.filter(O=>O.type!==Symbol.for("v-cmt"));return Ee({type:u.value.type,state:u.value,hasChildren:!!(c!=null&&c.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:g.value,matchTextSize:t.matchTextSize})}),y=Ie(a,v);function x(c){return(k,B)=>`translate(-${c.x*100}%, -${c.y*100}%) ${B}`}function m(){const{follow:c,center:k,offset:B,spring:$,matchTextSize:O,magnetic:Ne,...ee}=t;return ee}return(c,k)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(y)?(e.openBlock(),e.createBlock(e.unref(s.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(s.MotionConfig),{transition:e.unref(r)?e.unref(Pe):c.transition||e.unref($e)},{default:e.withCtx(()=>{var B,$;return[e.createVNode(e.unref(s.motion).div,e.mergeProps({layout:"","data-motion-cursor":c.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...c.$attrs,...m()},{variants:{pressed:c.follow?{}:{scale:.9},...c.variants,default:{opacity:1,scale:1,...(B=c.variants)==null?void 0:B.default},exit:{opacity:0,scale:0,...($=c.variants)==null?void 0:$.exit}},animate:["default",e.unref(u).type,e.unref(i)&&e.unref(u).targetBoundingBox?"magnetic":"",!e.unref(l)||!c.show?"exit":e.unref(u).isPressed?"pressed":""],"transform-template":x(c.center),style:{borderRadius:c.follow?0:20,zIndex:c.follow?99998:99999,willChange:"transform",contain:"layout",originX:c.center.x,originY:c.center.y,...c.style,width:P.value.width,height:P.value.height,x:e.unref(p).x,y:e.unref(p).y,top:0,left:0,position:"fixed",pointerEvents:"none"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3})]),_:3},16,["data-motion-cursor","variants","animate","transform-template","style"])]}),_:3},8,["transition"])]),_:3})):e.createCommentVNode("",!0)]))}});function U(n,t,o){const i=s.useMotionValue(0),r=s.useMotionValue(0),a=s.useMotionValue(0);return e.watch(()=>o==null?void 0:o.value,d=>{if(typeof d=="number"){s.animate(a,1);const f=()=>{r.set(t*(n.get()-d))};return f(),n.on("change",f)}else s.animate(a,0)},{immediate:!0,flush:"post"}),s.useTransform(()=>s.mix(i.get(),r.get(),a.get()))}function Le(n,t=.1){const o=A(),i=j(),r=e.computed(()=>o.value.targetBoundingBox&&o.value.target===n.value),a=U(i.x,t,e.computed(()=>r.value?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),d=U(i.y,t,e.computed(()=>r.value?o.value.targetBoundingBox.top+o.value.targetBoundingBox.height/2:void 0));return{x:a,y:d}}exports.AnimateNumber=ce;exports.Cursor=Te;exports.useCursorIsInView=Q;exports.useCursorState=A;exports.useMagneticPull=Le;exports.usePointerPosition=j;
9
+ `,document.head.appendChild(n),()=>{document.head.removeChild(n)}}function fe(n){e.watch(n,(t,o,i)=>{const a=t?de():u.noop;return i(()=>{a()})},{immediate:!0,flush:"post"})}function R(n){return t=>{t.pointerType==="mouse"&&n(t)}}function F(n){return R(t=>{t.button===0&&n(t)})}let T,D;function pe(){T=u.motionValue(0),D=u.motionValue(0);let n=0,t=0;function o(){T.set(n),D.set(t)}typeof window<"u"&&window.addEventListener("pointermove",R(i=>{n=i.clientX,t=i.clientY,u.frame.update(o)}))}function _(){return T||pe(),{x:T,y:D}}function ye(n,t){return{x:u.useTransform(()=>n.x.get()+t.value.x),y:u.useTransform(()=>n.y.get()+t.value.y)}}function me(n){return n.closest("[data-cursor]")}function ve(n){return n.closest('a, button, input[type="button"]:not(:disabled)')}function ge(n){return window.getComputedStyle(n).userSelect==="none"?null:n.closest("p, textarea:not(:disabled), input[type='text']:not(:disabled), h1, h2, h3, h4, h5, h6")}function he(n){let t=me(n);return t?[t.dataset.cursor,t]:(t=ve(n),t?["pointer",t]:(t=ge(n),t?["text",t]:["default",null]))}let V=null,S={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function we(n){let t=null;if("closest"in n){const o=n.closest("[data-cursor-zone]");o instanceof HTMLElement&&(t=o.dataset.cursorZone||null)}return t}function xe(){if(typeof window>"u")return{onChange:()=>()=>{}};const n=new Set;function t(d){S={...S,...d},n.forEach(v=>v(S))}const o=F(()=>{S.isPressed||t({isPressed:!0})}),i=F(()=>{S.isPressed&&t({isPressed:!1})}),a=R(({target:d})=>{if(!d)return;const[v,w]=he(d);let h=!1;const s={target:w,zone:we(d)};v!==S.type&&(s.type=v,h=!0),s.zone!==S.zone&&(S.zone=s.zone,h=!0);const f=v==="pointer"&&w?w.getBoundingClientRect():null;if(f!==S.targetBoundingBox&&(s.targetBoundingBox=f,h=!0),v==="text"){const{fontSize:p}=window.getComputedStyle(d),x=p?parseInt(p):null;x!==S.fontSize&&(s.fontSize=x,h=!0)}else S.fontSize&&(s.fontSize=null,h=!0);h&&t(s)});function r(){typeof window>"u"||(window.addEventListener("pointerover",a),window.addEventListener("pointerdown",o),window.addEventListener("pointerup",i))}function y(){window.removeEventListener("pointerover",a),window.removeEventListener("pointerdown",o),window.removeEventListener("pointerup",i)}return{onChange:d=>(n.size||r(),n.add(d),()=>{n.delete(d),n.size||y()})}}function ke(){return V||(V=xe()),V}function j(){const n=e.ref({...S});return e.watch(n,()=>ke().onChange(t=>{n.value=t}),{immediate:!0,flush:"post"}),n}let M=null;function Be(){const n=new Set;function t(){n.forEach(r=>r.show())}function o(){n.forEach(r=>r.hide())}function i(){document.body.addEventListener("mouseenter",t),document.body.addEventListener("mouseleave",o)}function a(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",o)}return{on:r=>typeof window>"u"?u.noop:(n.size||i(),n.add(r),()=>{n.delete(r),n.size===0&&a()})}}function Ce(){return M||(M=Be()),M}function J(n){const t=e.ref(!0);return e.watch(t,()=>Ce().on({show:()=>{t.value||(n(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const H={x:0,y:0},Se={x:.5,y:.5},be={duration:0},$e={stiffness:1e3,damping:100},Pe={duration:.15,ease:[.38,.12,.29,1]},W={magneticOptions:{morph:!0,padding:5,snap:.8}},X=17,Y=31,K=4,ze=20;function I(n,t,o){const i={width:(o==null?void 0:o.width)??n,height:(o==null?void 0:o.height)??t};return typeof i.width=="number"&&(i.width=`${i.width}px`),typeof i.height=="number"&&(i.height=`${i.height}px`),i}function Ee({type:n,state:t,hasChildren:o,style:i,isMagnetic:a,magneticOptions:r,matchTextSize:y}){const d=a&&t.targetBoundingBox;if(o&&!d)return I("auto","auto",i);const{padding:v,morph:w}=r;switch(n){case"pointer":if(a&&w&&t.targetBoundingBox){const{width:h,height:s}=t.targetBoundingBox;return{width:`${h+v*2}px`,height:`${s+v*2}px`}}return I(Y,Y,i);case"text":return y&&t.fontSize?{width:`${K}px`,height:`${t.fontSize}px`}:I(K,ze,i);default:return I(X,X,i)}}function Ie({x:n,y:t},o){const i=e.ref(n.prev!==void 0||t.prev!==void 0);return e.watch(i,()=>{if(i.value)return;const a=()=>{i.value=!0,o(),r()},r=u.pipe(n.on("change",a),t.on("change",a));return()=>r()},{immediate:!0}),i}function Te(n,t,o){return u.useTransform(()=>u.mix(n.value.get(),t.get(),o.get()))}function G(n,t,o){const i=u.useSpring(0,{stiffness:600,damping:50}),a=u.useMotionValue(0),r=Te(n,i,a);return e.watch(()=>o==null?void 0:o.value,(y,d)=>{y?(!d&&!a.isAnimating()?i.jump(y):i.set(y),u.animate(a,t.value||0)):u.animate(a,0)},{immediate:!0,flush:"sync"}),r}function Ve(n,t,o,i){const a=G(e.computed(()=>n.value.x),i,e.computed(()=>o.value.targetBoundingBox?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),r=G(e.computed(()=>n.value.y),i,e.computed(()=>o.value.targetBoundingBox?o.value.targetBoundingBox.top+o.value.targetBoundingBox.height/2:void 0));return e.computed(()=>t.value?{x:a,y:r}:n.value)}const Me=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:n})=>n?H:Se},offset:{default:()=>H},spring:{type:[Boolean,Object],default:({follow:n})=>n?$e:!1},matchTextSize:{type:Boolean,default:!0},magnetic:{type:[Boolean,Object],default:!1},transition:{},variants:{},style:{},show:{type:Boolean,default:!0}},setup(n){const t=n,{offset:o,magnetic:i}=e.toRefs(t),a=u.useReducedMotion();fe(()=>!a.value&&!t.follow);const r=_(),y=ye(r,o),d=u.useSpring(y.x,t.spring||void 0),v=u.useSpring(y.y,t.spring||void 0),w=e.computed(()=>typeof t.magnetic=="object"?{...W.magneticOptions,...t.magnetic}:W.magneticOptions);function h(){const l=y.x.on("change",C=>{d.jump(C),l()}),B=y.y.on("change",C=>{v.jump(C),B()})}const s=j(),f=J(h),p=Ve(e.computed(()=>t.spring?{x:d,y:v}:r),e.computed(()=>!!i.value),s,e.computed(()=>w.value&&w.value.snap)),x=e.useSlots(),g=e.computed(()=>{var C,P;const l=(P=(C=x.default)==null?void 0:C.call(x))==null?void 0:P.filter(A=>A.type!==Symbol.for("v-cmt"));return Ee({type:s.value.type,state:s.value,hasChildren:!!(l!=null&&l.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:w.value,matchTextSize:t.matchTextSize})}),c=Ie(r,h);function k(l){return(B,C)=>`translate(-${l.x*100}%, -${l.y*100}%) ${C}`}function m(){const{follow:l,center:B,offset:C,spring:P,matchTextSize:A,magnetic:Ne,...Q}=t;return Q}return(l,B)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(c)?(e.openBlock(),e.createBlock(e.unref(u.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(u.MotionConfig),{transition:e.unref(a)?e.unref(be):l.transition||e.unref(Pe)},{default:e.withCtx(()=>{var C,P;return[e.createVNode(e.unref(u.motion).div,e.mergeProps({layout:"","data-motion-cursor":l.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...l.$attrs,...m()},{variants:{pressed:l.follow?{}:{scale:.9},...l.variants,default:{opacity:1,scale:1,...(C=l.variants)==null?void 0:C.default},exit:{opacity:0,scale:0,...(P=l.variants)==null?void 0:P.exit}},animate:["default",e.unref(s).type,e.unref(i)&&e.unref(s).targetBoundingBox?"magnetic":"",!e.unref(f)||!l.show?"exit":e.unref(s).isPressed?"pressed":""],"transform-template":k(l.center),style:{borderRadius:l.follow?0:20,zIndex:l.follow?99998:99999,willChange:"transform",contain:"layout",originX:l.center.x,originY:l.center.y,...l.style,width:g.value.width,height:g.value.height,x:e.unref(p).x,y:e.unref(p).y,top:0,left:0,position:"fixed",pointerEvents:"none"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(u.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})]),_:3},16,["data-motion-cursor","variants","animate","transform-template","style"])]}),_:3},8,["transition"])]),_:3})):e.createCommentVNode("",!0)]))}});function U(n,t,o){const i=u.useMotionValue(0),a=u.useMotionValue(0),r=u.useMotionValue(0);return e.watch(()=>o==null?void 0:o.value,y=>{if(typeof y=="number"){u.animate(r,1);const d=()=>{a.set(t*(n.get()-y))};return d(),n.on("change",d)}else u.animate(r,0)},{immediate:!0,flush:"post"}),u.useTransform(()=>u.mix(i.get(),a.get(),r.get()))}function Le(n,t=.1){const o=j(),i=_(),a=e.computed(()=>o.value.targetBoundingBox&&o.value.target===n.value),r=U(i.x,t,e.computed(()=>a.value?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),y=U(i.y,t,e.computed(()=>a.value?o.value.targetBoundingBox.top+o.value.targetBoundingBox.height/2:void 0));return{x:r,y}}exports.AnimateNumber=ce;exports.Cursor=Me;exports.useCursorIsInView=J;exports.useCursorState=j;exports.useMagneticPull=Le;exports.usePointerPosition=_;
@@ -1,15 +1,15 @@
1
- import { MotionConfigProps } from './types';
2
1
  import { MotionProps } from 'motion-v';
3
2
  export interface AnimateNumberProps {
4
3
  locales?: Intl.LocalesArgument;
5
4
  format?: Omit<Intl.NumberFormatOptions, 'notation'> & {
6
5
  notation?: Exclude<Intl.NumberFormatOptions['notation'], 'scientific' | 'engineering'>;
7
6
  };
8
- transition?: MotionConfigProps['transition'];
7
+ transition?: MotionProps['transition'];
9
8
  suffix?: string;
10
9
  prefix?: string;
11
10
  value?: number | bigint | string;
12
11
  style?: MotionProps['style'];
12
+ layoutDependency?: MotionProps['layoutDependency'];
13
13
  }
14
14
  declare const _default: import('vue').DefineComponent<AnimateNumberProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnimateNumberProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
15
  export default _default;
@@ -1,18 +1,21 @@
1
- import { motion } from 'motion-v';
1
+ import { MotionProps, motion } from 'motion-v';
2
2
  import { mask, maskHeight, maskSize, maskWidth } from './config';
3
+ type __VLS_Props = {
4
+ layoutDependency?: MotionProps['layoutDependency'];
5
+ };
3
6
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
4
7
  declare var __VLS_6: {};
5
8
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
6
9
  default?: (props: typeof __VLS_6) => any;
7
10
  }>;
8
- declare const __VLS_self: import('vue').DefineComponent<{}, {
11
+ declare const __VLS_self: import('vue').DefineComponent<__VLS_Props, {
9
12
  motion: typeof motion;
10
13
  mask: typeof mask;
11
14
  maskHeight: typeof maskHeight;
12
15
  maskSize: typeof maskSize;
13
16
  maskWidth: typeof maskWidth;
14
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
15
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
17
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
19
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
17
20
  export default _default;
18
21
  type __VLS_WithSlots<T, S> = T & {
@@ -8,6 +8,7 @@ export interface AnimateNumberProps {
8
8
  mode?: AnimatePresenceProps['mode'];
9
9
  name?: string;
10
10
  style?: MotionProps['style'];
11
+ layoutDependency?: MotionProps['layoutDependency'];
11
12
  }
12
13
  declare const _default: import('vue').DefineComponent<AnimateNumberProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnimateNumberProps> & Readonly<{}>, {
13
14
  justify: Justify;
@@ -1,3 +1,6 @@
1
1
  import { AnimateSymbolProps } from './types';
2
- declare const _default: import('vue').DefineComponent<AnimateSymbolProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnimateSymbolProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
2
+ type __VLS_Props = AnimateSymbolProps & {
3
+ preInitial?: boolean;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
6
  export default _default;
@@ -5,16 +5,18 @@ export interface NumberDigitProps {
5
5
  initialValue?: number;
6
6
  isPresent?: boolean;
7
7
  partKey?: string;
8
- onRemove?: (partKey: string) => void;
8
+ onRemove?: (partKey: string, target: HTMLElement) => void;
9
9
  style?: MotionProps['style'];
10
+ layoutDependency?: MotionProps['layoutDependency'];
10
11
  }
11
12
  export interface AnimateSymbolProps {
12
13
  partKey: string;
13
14
  type: string;
14
15
  value: string;
15
16
  isPresent: boolean;
16
- onRemove: (partKey: string) => void;
17
+ onRemove?: (partKey: string, target: HTMLElement) => void;
17
18
  style?: MotionProps['style'];
19
+ layoutDependency?: MotionProps['layoutDependency'];
18
20
  }
19
21
  export type Justify = 'left' | 'right';
20
22
  export type NumberPartType = Exclude<Intl.NumberFormatPartTypes, 'minusSign' | 'plusSign'> | 'sign' | 'prefix' | 'suffix';
@@ -34,6 +36,7 @@ export type SymbolPart = {
34
36
  export type NumberPart = (DigitPart | SymbolPart) & PartSort;
35
37
  export type PartSort = {
36
38
  originalIndex?: number;
39
+ isPresent?: boolean;
37
40
  };
38
41
  export type KeyedPart = {
39
42
  key: string;
@@ -15,13 +15,13 @@ export interface CursorProps extends HTMMotionProps {
15
15
  show?: boolean;
16
16
  }
17
17
  declare const magnetic: import('vue').Ref<boolean | Partial<MagneticOptions>, boolean | Partial<MagneticOptions>>;
18
- declare const shouldReduceMotion: import('vue').Ref<boolean, boolean>;
18
+ declare const shouldReduceMotion: import('@vue/reactivity').Ref<boolean>;
19
19
  declare const state: import('vue').Ref<import('./hooks/use-cursor-state/types').CursorState, import('./hooks/use-cursor-state/types').CursorState>;
20
20
  declare const isInView: import('vue').Ref<boolean, boolean>;
21
21
  declare const pointer: import('vue').ComputedRef<import('./hooks/use-offset').MotionPoint>;
22
22
  declare const size: import('vue').ComputedRef<{
23
- width: number | string | import('motion-v/es').MotionValue<any>;
24
- height: number | string | import('motion-v/es').MotionValue<any>;
23
+ width: number | string | import('motion-v').MotionValue<any>;
24
+ height: number | string | import('motion-v').MotionValue<any>;
25
25
  }>;
26
26
  declare const pointerHasMoved: import('vue').Ref<boolean, boolean>;
27
27
  declare function positionTransform(origin: Point): (_: any, generated: string) => string;
@@ -1,10 +1,10 @@
1
- import { defineComponent as v, computed as l, createBlock as h, openBlock as x, unref as o, withCtx as r, createVNode as t, mergeProps as b, normalizeStyle as s } from "vue";
1
+ import { defineComponent as h, computed as u, createBlock as x, openBlock as b, unref as n, withCtx as i, createVNode as t, mergeProps as D, normalizeStyle as p } from "vue";
2
2
  import { formatToParts as L } from "./utils/format-parts.mjs";
3
- import { useMotionConfig as A, easeOut as C, LayoutGroup as N, MotionConfig as $, motion as u } from "motion-v";
4
- import n from "./NumberSection.vue.mjs";
5
- import { maskHeight as p } from "./config.mjs";
3
+ import { useMotionConfig as A, easeOut as C, LayoutGroup as N, MotionConfig as $, motion as s } from "motion-v";
4
+ import r from "./NumberSection.vue.mjs";
5
+ import { maskHeight as d } from "./config.mjs";
6
6
  import T from "./Mask.vue.mjs";
7
- const O = /* @__PURE__ */ v({
7
+ const P = /* @__PURE__ */ h({
8
8
  name: "AnimateNumber",
9
9
  inheritAttrs: !1,
10
10
  __name: "AnimateNumber",
@@ -15,42 +15,49 @@ const O = /* @__PURE__ */ v({
15
15
  suffix: {},
16
16
  prefix: {},
17
17
  value: {},
18
- style: {}
18
+ style: {},
19
+ layoutDependency: {}
19
20
  },
20
- setup(f) {
21
- const m = {
21
+ setup(y) {
22
+ const c = {
22
23
  opacity: { duration: 1, ease: C },
23
24
  layout: { type: "spring", duration: 1, bounce: 0 },
24
25
  y: { type: "spring", duration: 1, bounce: 0 }
25
- }, e = f, a = l(() => {
26
- const i = e.value;
27
- return L(i, { locales: e.locales, format: e.format }, e.prefix, e.suffix);
28
- }), c = A(), d = l(() => e.transition ?? c.value.transition ?? m);
29
- function y() {
30
- const { format: i, prefix: g, suffix: k, locales: w, value: I, ..._ } = e;
26
+ }, e = y, o = u(() => {
27
+ const l = e.value;
28
+ return L(l, { locales: e.locales, format: e.format }, e.prefix, e.suffix);
29
+ }), f = A(), m = u(() => e.transition ?? f.value.transition ?? c);
30
+ function v() {
31
+ const { format: l, prefix: g, suffix: k, locales: w, value: I, layoutDependency: S, ..._ } = e;
31
32
  return _;
32
33
  }
33
- return (i, g) => (x(), h(o(N), null, {
34
- default: r(() => [
35
- t(o($), { transition: d.value }, {
36
- default: r(() => [
37
- t(o(u).div, b({
38
- ...i.$attrs,
39
- ...y()
34
+ const a = u(() => {
35
+ if (e.layoutDependency !== void 0)
36
+ return { layoutDependency: e.layoutDependency, value: e.value };
37
+ });
38
+ return (l, g) => (b(), x(n(N), null, {
39
+ default: i(() => [
40
+ t(n($), { transition: m.value }, {
41
+ default: i(() => [
42
+ t(n(s).div, D({
43
+ ...l.$attrs,
44
+ ...v()
40
45
  }, {
41
46
  layout: "",
47
+ "layout-dependency": a.value,
42
48
  style: {
43
49
  lineHeight: "1",
44
- ...i.style,
50
+ ...l.style,
45
51
  display: "inline-flex",
46
52
  isolation: "isolate",
47
53
  whiteSpace: "nowrap"
48
54
  }
49
55
  }), {
50
- default: r(() => [
51
- t(o(u).div, {
56
+ default: i(() => [
57
+ t(n(s).div, {
52
58
  layout: "",
53
- "aria-label": a.value.formatted,
59
+ "layout-dependency": a.value,
60
+ "aria-label": o.value.formatted,
54
61
  style: {
55
62
  display: "inline-flex",
56
63
  direction: "ltr",
@@ -59,46 +66,50 @@ const O = /* @__PURE__ */ v({
59
66
  zIndex: -1
60
67
  }
61
68
  }, {
62
- default: r(() => [
63
- t(n, {
64
- style: s({ padding: `calc(${o(p)}/2) 0` }),
69
+ default: i(() => [
70
+ t(r, {
71
+ "layout-dependency": a.value,
72
+ style: p({ padding: `calc(${n(d)}/2) 0` }),
65
73
  "aria-hidden": !0,
66
74
  justify: "right",
67
75
  mode: "popLayout",
68
- parts: a.value.pre,
76
+ parts: o.value.pre,
69
77
  name: "pre"
70
- }, null, 8, ["style", "parts"]),
71
- t(T, null, {
72
- default: r(() => [
73
- t(n, {
78
+ }, null, 8, ["layout-dependency", "style", "parts"]),
79
+ t(T, { "layout-dependency": a.value }, {
80
+ default: i(() => [
81
+ t(r, {
82
+ "layout-dependency": a.value,
74
83
  justify: "right",
75
- parts: a.value.integer,
84
+ parts: o.value.integer,
76
85
  name: "integer",
77
86
  mode: "popLayout"
78
- }, null, 8, ["parts"]),
79
- t(n, {
87
+ }, null, 8, ["layout-dependency", "parts"]),
88
+ t(r, {
89
+ "layout-dependency": a.value,
80
90
  layout: "position",
81
- parts: a.value.fraction,
91
+ parts: o.value.fraction,
82
92
  name: "fraction",
83
93
  mode: "popLayout"
84
- }, null, 8, ["parts"])
94
+ }, null, 8, ["layout-dependency", "parts"])
85
95
  ]),
86
96
  _: 1
87
- }),
88
- t(n, {
89
- style: s({ padding: `calc(${o(p)}/2) 0` }),
97
+ }, 8, ["layout-dependency"]),
98
+ t(r, {
99
+ "layout-dependency": a.value,
100
+ style: p({ padding: `calc(${n(d)}/2) 0` }),
90
101
  "aria-hidden": !0,
91
102
  layout: "position",
92
103
  mode: "popLayout",
93
- parts: a.value.post,
104
+ parts: o.value.post,
94
105
  name: "post"
95
- }, null, 8, ["style", "parts"])
106
+ }, null, 8, ["layout-dependency", "style", "parts"])
96
107
  ]),
97
108
  _: 1
98
- }, 8, ["aria-label"])
109
+ }, 8, ["layout-dependency", "aria-label"])
99
110
  ]),
100
111
  _: 1
101
- }, 16, ["style"])
112
+ }, 16, ["layout-dependency", "style"])
102
113
  ]),
103
114
  _: 1
104
115
  }, 8, ["transition"])
@@ -108,5 +119,5 @@ const O = /* @__PURE__ */ v({
108
119
  }
109
120
  });
110
121
  export {
111
- O as default
122
+ P as default
112
123
  };
@@ -1,33 +1,37 @@
1
- import { defineComponent as i, createBlock as a, openBlock as r, unref as e, normalizeStyle as n, withCtx as l, renderSlot as s } from "vue";
2
- import { motion as m } from "motion-v";
3
- import { maskSize as p, mask as k, maskHeight as c, maskWidth as t } from "./config.mjs";
4
- const b = /* @__PURE__ */ i({
1
+ import { defineComponent as a, createBlock as n, openBlock as i, unref as e, normalizeStyle as r, withCtx as l, renderSlot as p } from "vue";
2
+ import { motion as s } from "motion-v";
3
+ import { maskSize as m, mask as d, maskHeight as c, maskWidth as o } from "./config.mjs";
4
+ const _ = /* @__PURE__ */ a({
5
5
  __name: "Mask",
6
- setup(f) {
7
- return (o, d) => (r(), a(e(m).span, {
6
+ props: {
7
+ layoutDependency: {}
8
+ },
9
+ setup(k) {
10
+ return (t, f) => (i(), n(e(s).span, {
8
11
  layout: "",
12
+ "layout-dependency": t.layoutDependency,
9
13
  "aria-hidden": !0,
10
- style: n({
14
+ style: r({
11
15
  display: "inline-flex",
12
16
  "--invert-x": 1,
13
- margin: `0 calc(-1*${e(t)})`,
14
- padding: `calc(${e(c)}/2) ${e(t)}`,
17
+ margin: `0 calc(-1*${e(o)})`,
18
+ padding: `calc(${e(c)}/2) ${e(o)}`,
15
19
  position: "relative",
16
20
  zIndex: -1,
17
21
  overflow: "clip",
18
- webkitMaskImage: e(k),
19
- webkitMaskSize: e(p),
22
+ webkitMaskImage: e(d),
23
+ webkitMaskSize: e(m),
20
24
  webkitMaskPosition: "center, center, top left, top right, bottom right, bottom left",
21
25
  webkitMaskRepeat: "no-repeat"
22
26
  })
23
27
  }, {
24
28
  default: l(() => [
25
- s(o.$slots, "default")
29
+ p(t.$slots, "default")
26
30
  ]),
27
31
  _: 3
28
- }, 8, ["style"]));
32
+ }, 8, ["layout-dependency", "style"]));
29
33
  }
30
34
  });
31
35
  export {
32
- b as default
36
+ _ as default
33
37
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, ref as u, watch as y, nextTick as W, createBlock as s, openBlock as o, unref as a, normalizeStyle as v, withCtx as j, createElementVNode as A, createElementBlock as m, createCommentVNode as R, Fragment as V, renderList as b, resolveDynamicComponent as g, createVNode as F } from "vue";
1
+ import { defineComponent as _, ref as s, watch as v, nextTick as B, createBlock as c, openBlock as o, unref as l, normalizeStyle as g, withCtx as j, createElementVNode as A, createElementBlock as d, createCommentVNode as R, Fragment as V, renderList as b, resolveDynamicComponent as h, createVNode as F } from "vue";
2
2
  import { useMotionConfig as K, motion as S, animate as T } from "motion-v";
3
3
  import { useIsInitialRender as z } from "./hooks/use-is-initial-render.mjs";
4
- import { digitFillStyle as x, maskHeight as H } from "./config.mjs";
4
+ import { digitFillStyle as D, maskHeight as H } from "./config.mjs";
5
5
  import { useAnimate as L } from "./use-animate.mjs";
6
6
  import { getWidthInEm as Y } from "./utils/get-width-in-ems.mjs";
7
7
  import { targetWidths as $ } from "./utils/target-widths.mjs";
8
- const Z = /* @__PURE__ */ M({
8
+ const Z = /* @__PURE__ */ _({
9
9
  __name: "NumberDigit",
10
10
  props: {
11
11
  value: {},
@@ -17,79 +17,84 @@ const Z = /* @__PURE__ */ M({
17
17
  },
18
18
  partKey: {},
19
19
  onRemove: {},
20
- style: {}
20
+ style: {},
21
+ layoutDependency: {}
21
22
  },
22
- setup(w) {
23
- const r = w, c = r.initialValue ?? r.value, h = z(), I = K(), l = u(), k = u(Array(10).fill(null)), C = u(), {
23
+ setup(x) {
24
+ const a = x, m = a.initialValue ?? a.value, k = z(), I = K(), r = s(), p = s(Array(10).fill(null)), C = s(), {
24
25
  getRoot: N,
25
26
  handleComplete: P,
26
- root: p
27
- } = L(r);
28
- let d = c;
29
- const t = u(c);
30
- y([() => r.value, () => r.isPresent], ([e, n]) => {
31
- if (!n)
32
- return t.value = 0;
33
- if (h.current)
34
- return W(() => {
35
- t.value = e;
27
+ root: u
28
+ } = L(a);
29
+ let f = m;
30
+ const n = s(m);
31
+ v([() => a.value, () => a.isPresent], ([e, t]) => {
32
+ if (!t)
33
+ return n.value = 0;
34
+ if (k.current)
35
+ return B(() => {
36
+ n.value = e;
36
37
  });
37
- t.value = e;
38
+ n.value = e;
38
39
  }, {
39
40
  immediate: !0
40
41
  });
41
- function D(e) {
42
- var B;
43
- if (!l.value || e === d) return;
44
- const n = l.value.getBoundingClientRect(), i = (B = p.value) == null ? void 0 : B.getBoundingClientRect(), _ = n.height * (e - d) + (n.top - (i ? i.top || 0 : n.top));
45
- T(l.value, {
46
- y: [_, 0]
42
+ function E(e) {
43
+ var w;
44
+ if (!r.value || e === f) return;
45
+ const t = r.value.getBoundingClientRect(), i = (w = u.value) == null ? void 0 : w.getBoundingClientRect(), W = t.height * (e - f) + (t.top - (i ? i.top || 0 : t.top));
46
+ T(r.value, {
47
+ y: [W, 0]
47
48
  }, I.value.transition);
48
49
  }
49
- function E(e) {
50
- if (h.current && c === e || !k.value[e]) return;
51
- const n = Y(k.value[e]);
52
- p.value && $.set(p.value, n), C.value = n;
50
+ function M(e) {
51
+ if (k.current && m === e || !p.value[e]) return;
52
+ const t = Y(p.value[e]);
53
+ u.value && ($.set(u.value, t), u.value.style.width = t), C.value = t;
53
54
  }
54
- y(t, (e) => {
55
- E(e);
55
+ v(n, (e) => {
56
+ M(e);
56
57
  }, {
57
58
  immediate: !0,
58
- flush: "post"
59
- }), y(t, (e, n, i) => {
60
- D(e), i(() => {
61
- d = e;
59
+ flush: "sync"
60
+ }), v(n, async (e, t, i) => {
61
+ await B(), E(e), i(() => {
62
+ f = e;
62
63
  });
63
64
  }, {
64
65
  immediate: !0,
65
- flush: "pre"
66
+ flush: "sync"
66
67
  });
67
- function f(e) {
68
+ function y(e) {
68
69
  return () => F("span", {
69
70
  key: e,
70
71
  style: {
71
72
  display: "inline-block",
72
73
  padding: `calc(${H}/2) 0`
74
+ },
75
+ ref: (t) => {
76
+ p.value[e] = t;
73
77
  }
74
78
  }, [e]);
75
79
  }
76
- return (e, n) => (o(), s(a(S).span, {
77
- ref: a(N),
80
+ return (e, t) => (o(), c(l(S).span, {
81
+ ref: l(N),
78
82
  layout: "position",
83
+ "layout-dependency": e.layoutDependency,
79
84
  "data-state": e.isPresent ? void 0 : "exiting",
80
85
  "data-key": e.partKey,
81
- style: v({
86
+ style: g({
82
87
  display: "inline-flex",
83
88
  justifyContent: "center",
84
89
  width: C.value,
85
90
  pointerEvents: e.isPresent ? void 0 : "none"
86
91
  }),
87
92
  "aria-hidden": !e.isPresent,
88
- onMotioncomplete: a(P)
93
+ onMotioncomplete: l(P)
89
94
  }, {
90
95
  default: j(() => [A("span", {
91
96
  ref_key: "scope",
92
- ref: l,
97
+ ref: r,
93
98
  style: {
94
99
  display: "inline-flex",
95
100
  justifyContent: "center",
@@ -97,27 +102,27 @@ const Z = /* @__PURE__ */ M({
97
102
  alignItems: "center",
98
103
  position: "relative"
99
104
  }
100
- }, [t.value !== 0 ? (o(), m("span", {
105
+ }, [n.value !== 0 ? (o(), d("span", {
101
106
  key: 0,
102
- style: v({
103
- ...a(x),
107
+ style: g({
108
+ ...l(D),
104
109
  bottom: "100%",
105
110
  left: 0
106
111
  })
107
- }, [(o(!0), m(V, null, b(t.value, (i) => (o(), s(g(f(i - 1)), {
112
+ }, [(o(!0), d(V, null, b(n.value, (i) => (o(), c(h(y(i - 1)), {
108
113
  key: i - 1
109
- }))), 128))], 4)) : R("", !0), (o(), s(g(f(t.value)))), t.value !== 9 ? (o(), m("span", {
114
+ }))), 128))], 4)) : R("", !0), (o(), c(h(y(n.value)))), n.value !== 9 ? (o(), d("span", {
110
115
  key: 1,
111
- style: v({
112
- ...a(x),
116
+ style: g({
117
+ ...l(D),
113
118
  top: "100%",
114
119
  left: 0
115
120
  })
116
- }, [(o(!0), m(V, null, b(9 - t.value, (i) => (o(), s(g(f(t.value + i)), {
117
- key: t.value + i
121
+ }, [(o(!0), d(V, null, b(9 - n.value, (i) => (o(), c(h(y(n.value + i)), {
122
+ key: n.value + i
118
123
  }))), 128))], 4)) : R("", !0)], 512)]),
119
124
  _: 1
120
- }, 8, ["data-state", "data-key", "style", "aria-hidden", "onMotioncomplete"]));
125
+ }, 8, ["layout-dependency", "data-state", "data-key", "style", "aria-hidden", "onMotioncomplete"]));
121
126
  }
122
127
  });
123
128
  export {
@@ -1,121 +1,117 @@
1
- import { defineComponent as j, ref as k, watch as x, toRef as C, createBlock as p, openBlock as u, unref as f, normalizeStyle as W, normalizeClass as $, withCtx as g, createElementVNode as B, createTextVNode as E, createVNode as N, createElementBlock as h, Fragment as P, renderList as S } from "vue";
2
- import { useDomRef as M, motion as V, AnimatePresence as z, frame as A } from "motion-v";
3
- import { injectSectionContext as L } from "./context.mjs";
4
- import { useIsInitialRender as T } from "./hooks/use-is-initial-render.mjs";
5
- import { getWidthInEm as w } from "./utils/get-width-in-ems.mjs";
6
- import D from "./NumberSymbol.vue.mjs";
1
+ import { defineComponent as I, ref as c, watch as g, nextTick as D, toRef as E, createBlock as m, openBlock as u, unref as y, normalizeStyle as _, normalizeClass as $, withCtx as R, createElementVNode as B, createTextVNode as N, createVNode as S, createElementBlock as w, Fragment as P, renderList as b } from "vue";
2
+ import { useDomRef as M, motion as T, AnimatePresence as V } from "motion-v";
3
+ import { injectSectionContext as z } from "./context.mjs";
4
+ import { useIsInitialRender as A } from "./hooks/use-is-initial-render.mjs";
5
+ import { getWidthInEm as j } from "./utils/get-width-in-ems.mjs";
6
+ import L from "./NumberSymbol.vue.mjs";
7
7
  import F from "./NumberDigit.vue.mjs";
8
- import { targetWidths as H } from "./utils/target-widths.mjs";
9
- const Y = /* @__PURE__ */ j({
8
+ const Q = /* @__PURE__ */ I({
10
9
  __name: "NumberSection",
11
10
  props: {
12
11
  parts: {},
13
12
  justify: { default: "left" },
14
13
  mode: {},
15
14
  name: {},
16
- style: {}
15
+ style: {},
16
+ layoutDependency: {}
17
17
  },
18
- setup(I) {
19
- const m = I, d = k(), y = M(), s = k(), c = T();
20
- x(() => m.parts, (i) => {
21
- const r = new Map(i.map((n) => [n.key, { ...n, isPresent: !0 }]));
22
- a = [...a.filter((n) => !r.get(n.key)).map(
23
- (n) => ({ ...n, isPresent: !1 })
24
- ), ...i].sort((n, e) => o.value === "right" ? n.isPresent === e.isPresent ? n.originalIndex - e.originalIndex : n.isPresent ? -1 : 1 : o.value === "left" ? n.isPresent === e.isPresent ? n.originalIndex - e.originalIndex : n.isPresent ? 1 : -1 : n.originalIndex - e.originalIndex);
25
- }, { flush: "pre" }), x(() => m.parts.map((i) => i.value).join(""), (i, r) => {
26
- if (!s.value)
18
+ setup(C) {
19
+ var x;
20
+ const o = C, d = c(), p = M(), a = c(), v = A(), l = c(o.parts);
21
+ let k = o.name === "pre" && !((x = o.parts) != null && x.length) ? void 0 : !1;
22
+ g(() => o.parts, (n) => {
23
+ const i = new Map(n.map((t) => [t.key, { ...t, isPresent: !0 }])), e = l.value.filter((t) => !i.get(t.key)).map(
24
+ (t) => ({ ...t, isPresent: !1 })
25
+ ), s = n.sort((t, r) => t.originalIndex - r.originalIndex);
26
+ l.value = e.concat(s);
27
+ }, { flush: "pre" }), g(() => {
28
+ var n;
29
+ return (n = o.parts) == null ? void 0 : n.map((i) => i.value).join("");
30
+ }, async (n, i) => {
31
+ if (await D(), k = !1, !a.value)
27
32
  return;
28
- if (c.current) {
29
- y.value && (y.value.style.width = w(s.value));
33
+ if (v.current) {
34
+ p.value && (p.value.style.width = j(a.value));
30
35
  return;
31
36
  }
32
- const t = Array.from(s.value.children).map((e) => {
33
- if (!(e instanceof HTMLElement))
34
- return;
35
- if (e.dataset.state === "exiting") {
36
- const _ = e.nextSibling;
37
- return e.remove(), () => {
38
- s.value && s.value.insertBefore(e, _);
37
+ const e = Array.from(a.value.children).map((t) => {
38
+ if (t instanceof HTMLElement && t.dataset.state === "exiting") {
39
+ const r = t.nextSibling;
40
+ return t.remove(), () => {
41
+ a.value && a.value.insertBefore(t, r);
39
42
  };
40
43
  }
41
- const l = H.get(e);
42
- if (!l)
43
- return;
44
- const R = e.style.width;
45
- return e.style.width = l, () => {
46
- e.style.width = R;
47
- };
48
- });
49
- function n() {
50
- const e = w(s.value);
51
- d.value = e;
44
+ }), s = j(a.value);
45
+ d.value = s;
46
+ for (let t = e.length - 1; t >= 0; t--) {
47
+ const r = e[t];
48
+ r && r();
52
49
  }
53
- +i > +(r || 0) ? A.read(n) : n();
54
- for (let e = t.length - 1; e >= 0; e--) {
55
- const l = t[e];
56
- l && l();
57
- }
58
- }, { immediate: !0, flush: "post" });
59
- const o = C(m, "justify");
60
- L({
61
- justify: o
50
+ }, { flush: "post" });
51
+ const f = E(o, "justify");
52
+ z({
53
+ justify: f
62
54
  });
63
- let a = m.parts;
64
- function v(i) {
65
- a = a.filter((r) => r.key !== i);
55
+ function h(n, i) {
56
+ var e;
57
+ l.value = l.value.filter((s) => s.key !== n), (e = i == null ? void 0 : i.parentElement) == null || e.removeChild(i);
66
58
  }
67
- return (i, r) => (u(), p(f(V).span, {
68
- ref: f(y),
69
- class: $(`number-section-${i.name}`),
70
- style: W({
71
- ...i.style,
59
+ return (n, i) => (u(), m(y(T).span, {
60
+ ref: y(p),
61
+ class: $(`number-section-${n.name}`),
62
+ style: _({
63
+ ...n.style,
72
64
  display: "inline-flex",
73
- justifyContent: o.value,
65
+ justifyContent: f.value,
74
66
  width: d.value
75
67
  }),
76
- layout: "position"
68
+ layout: "position",
69
+ "layout-dependency": n.layoutDependency
77
70
  }, {
78
- default: g(() => [
71
+ default: R(() => [
79
72
  B("span", {
80
73
  ref_key: "measuredRef",
81
- ref: s,
74
+ ref: a,
82
75
  style: {
83
76
  display: "inline-flex",
84
77
  justifyContent: "inherit",
85
78
  position: "relative"
86
79
  }
87
80
  }, [
88
- r[0] || (r[0] = E(" ​ ")),
89
- N(f(z), {
90
- mode: i.mode,
91
- "anchor-x": o.value,
81
+ i[0] || (i[0] = N(" ​ ")),
82
+ S(y(V), {
83
+ mode: n.mode,
84
+ "anchor-x": f.value,
92
85
  initial: !1
93
86
  }, {
94
- default: g(() => [
95
- (u(!0), h(P, null, S(f(a), (t) => (u(), h(P, {
96
- key: t.key
87
+ default: R(() => [
88
+ (u(!0), w(P, null, b(l.value, (e) => (u(), w(P, {
89
+ key: e.key
97
90
  }, [
98
- t.type === "integer" || t.type === "fraction" ? (u(), p(F, {
99
- key: t.key,
100
- "part-key": t.key,
91
+ e.type === "integer" || e.type === "fraction" ? (u(), m(F, {
92
+ key: e.key,
93
+ "part-key": e.key,
101
94
  initial: { opacity: 0 },
102
95
  animate: { opacity: 1 },
103
96
  exit: { opacity: 0 },
104
- value: t.value,
105
- "is-present": t.isPresent ?? !0,
106
- "initial-value": f(c).current ? void 0 : 0,
107
- onRemove: v
108
- }, null, 8, ["part-key", "value", "is-present", "initial-value"])) : (u(), p(D, {
109
- key: t.type === "literal" ? `${t.key}:${t.value}` : t.key,
110
- type: t.type,
111
- "part-key": t.key,
97
+ value: e.value,
98
+ "is-present": e.isPresent ?? !0,
99
+ "initial-value": y(v).current ? void 0 : 0,
100
+ "layout-dependency": n.layoutDependency,
101
+ onRemove: h
102
+ }, null, 8, ["part-key", "value", "is-present", "initial-value", "layout-dependency"])) : (u(), m(L, {
103
+ key: e.type === "literal" ? `${e.key}:${e.value}` : e.key,
104
+ type: e.type,
105
+ "part-key": e.key,
112
106
  initial: { opacity: 0 },
113
107
  animate: { opacity: 1 },
114
108
  exit: { opacity: 0 },
115
- value: t.value,
116
- "is-present": t.isPresent ?? !0,
117
- onRemove: v
118
- }, null, 8, ["type", "part-key", "value", "is-present"]))
109
+ value: e.value,
110
+ "is-present": e.isPresent ?? !0,
111
+ "pre-initial": y(k),
112
+ "layout-dependency": n.layoutDependency,
113
+ onRemove: h
114
+ }, null, 8, ["type", "part-key", "value", "is-present", "pre-initial", "layout-dependency"]))
119
115
  ], 64))), 128))
120
116
  ]),
121
117
  _: 1
@@ -123,9 +119,9 @@ const Y = /* @__PURE__ */ j({
123
119
  ], 512)
124
120
  ]),
125
121
  _: 1
126
- }, 8, ["class", "style"]));
122
+ }, 8, ["class", "style", "layout-dependency"]));
127
123
  }
128
124
  });
129
125
  export {
130
- Y as default
126
+ Q as default
131
127
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as u, createBlock as n, openBlock as a, unref as e, normalizeStyle as d, withCtx as i, createVNode as y, createTextVNode as c, toDisplayString as f } from "vue";
2
- import { motion as r, AnimatePresence as h } from "motion-v";
1
+ import { defineComponent as d, createBlock as i, openBlock as a, unref as e, normalizeStyle as u, withCtx as n, createVNode as c, createTextVNode as m, toDisplayString as f } from "vue";
2
+ import { motion as l, AnimatePresence as h } from "motion-v";
3
3
  import { maskHeight as v } from "./config.mjs";
4
4
  import { useSectionContext as g } from "./context.mjs";
5
5
  import { useAnimate as k } from "./use-animate.mjs";
6
- const B = /* @__PURE__ */ u({
6
+ const I = /* @__PURE__ */ d({
7
7
  __name: "NumberSymbol",
8
8
  props: {
9
9
  partKey: {},
@@ -11,15 +11,18 @@ const B = /* @__PURE__ */ u({
11
11
  value: {},
12
12
  isPresent: { type: Boolean },
13
13
  onRemove: { type: Function },
14
- style: {}
14
+ style: {},
15
+ layoutDependency: {},
16
+ preInitial: { type: Boolean }
15
17
  },
16
- setup(s) {
17
- const l = s, { justify: o } = g(), { getRoot: p, handleComplete: m } = k(l);
18
- return (t, x) => (a(), n(e(r).span, {
19
- ref: e(p),
18
+ setup(p) {
19
+ const r = p, { justify: o } = g(), { getRoot: s, handleComplete: y } = k(r);
20
+ return (t, C) => (a(), i(e(l).span, {
21
+ ref: e(s),
20
22
  layout: "position",
23
+ "layout-dependency": t.layoutDependency,
21
24
  "data-state": t.isPresent ? void 0 : "exiting",
22
- style: d({
25
+ style: u({
23
26
  display: "inline-flex",
24
27
  justifyContent: e(o),
25
28
  padding: `calc(${e(v)}/2) 0`,
@@ -27,47 +30,46 @@ const B = /* @__PURE__ */ u({
27
30
  pointerEvents: t.isPresent ? void 0 : "none"
28
31
  }),
29
32
  "aria-hidden": !t.isPresent,
30
- onMotioncomplete: e(m)
33
+ onMotioncomplete: e(y)
31
34
  }, {
32
- default: i(() => [
33
- y(e(h), {
35
+ default: n(() => [
36
+ c(e(h), {
34
37
  mode: "popLayout",
35
38
  "anchor-x": e(o),
36
- initial: !1
39
+ initial: t.preInitial
37
40
  }, {
38
- default: i(() => [
39
- (a(), n(e(r).span, {
41
+ default: n(() => [
42
+ (a(), i(e(l).span, {
40
43
  key: t.value,
41
44
  layout: e(o) === "right" ? "position" : !1,
42
- initial: { opacity: 0 },
43
- animate: { opacity: [null, 1] },
45
+ "layout-dependency": t.layoutDependency,
46
+ initial: { opacity: 0, left: e(o) === "right" && t.preInitial === void 0 ? "-100%" : void 0 },
47
+ animate: { opacity: [null, 1], left: 0 },
44
48
  exit: {
45
49
  opacity: [null, 0],
46
50
  transition: {
47
- duration: 0.3
51
+ opacity: { duration: 0.4 }
48
52
  }
49
53
  },
50
54
  style: {
51
55
  display: "inline-block",
52
- whiteSpace: "pre"
53
- },
54
- transition: {
55
- duration: 0.2
56
+ whiteSpace: "pre",
57
+ position: "relative"
56
58
  }
57
59
  }, {
58
- default: i(() => [
59
- c(f(t.value), 1)
60
+ default: n(() => [
61
+ m(f(t.value), 1)
60
62
  ]),
61
63
  _: 1
62
- }, 8, ["layout"]))
64
+ }, 8, ["layout", "layout-dependency", "initial"]))
63
65
  ]),
64
66
  _: 1
65
- }, 8, ["anchor-x"])
67
+ }, 8, ["anchor-x", "initial"])
66
68
  ]),
67
69
  _: 1
68
- }, 8, ["data-state", "style", "aria-hidden", "onMotioncomplete"]));
70
+ }, 8, ["layout-dependency", "data-state", "style", "aria-hidden", "onMotioncomplete"]));
69
71
  }
70
72
  });
71
73
  export {
72
- B as default
74
+ I as default
73
75
  };
@@ -2,21 +2,21 @@ import { mountedStates as u } from "motion-v";
2
2
  import { ref as f, watch as m } from "vue";
3
3
  function v(e) {
4
4
  const n = f();
5
- function o(t) {
5
+ function a(t) {
6
6
  n.value = t == null ? void 0 : t.$el;
7
7
  }
8
8
  m(() => e.isPresent, (t) => {
9
9
  var i;
10
10
  n.value && ((i = u.get(n.value)) == null || i.setActive("exit", !t));
11
11
  });
12
- function a(t) {
12
+ function o(t) {
13
13
  var i;
14
- t.detail.isExit && !e.isPresent && ((i = e.onRemove) == null || i.call(e, e.partKey));
14
+ t.detail.isExit && !e.isPresent && ((i = e.onRemove) == null || i.call(e, e.partKey, t.target));
15
15
  }
16
16
  return {
17
17
  root: n,
18
- getRoot: o,
19
- handleComplete: a
18
+ getRoot: a,
19
+ handleComplete: o
20
20
  };
21
21
  }
22
22
  export {
@@ -1,7 +1,7 @@
1
1
  import { computed as u } from "vue";
2
2
  import { useSnappedValue as g } from "../hooks/use-snapped-value.mjs";
3
- function d(e, t, o, n) {
4
- const a = g(
3
+ function v(e, a, o, n) {
4
+ const t = g(
5
5
  u(() => e.value.x),
6
6
  n,
7
7
  u(() => o.value.targetBoundingBox ? o.value.targetBoundingBox.left + o.value.targetBoundingBox.width / 2 : void 0)
@@ -10,8 +10,8 @@ function d(e, t, o, n) {
10
10
  n,
11
11
  u(() => o.value.targetBoundingBox ? o.value.targetBoundingBox.top + o.value.targetBoundingBox.height / 2 : void 0)
12
12
  );
13
- return u(() => t ? { x: a, y: i } : e.value);
13
+ return u(() => a.value ? { x: t, y: i } : e.value);
14
14
  }
15
15
  export {
16
- d as useMagneticTarget
16
+ v as useMagneticTarget
17
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-plus-vue",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Motion Plus Vue",
5
5
  "author": "",
6
6
  "license": "ISC",