motion-plus-vue 1.2.1 → 1.3.0

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"),a=require("motion-v");function ke(o,{locales:t,format:n},r,i){const l=new Intl.NumberFormat(t,n).formatToParts(Number(o));r&&l.unshift({type:"prefix",value:r}),i&&l.push({type:"suffix",value:i});const d=[],g=[],w=[],h=[],u={},m=c=>`${c}:${u[c]=(u[c]??-1)+1}`;let y="",k=!1,x=!1,f=0;for(const c of l){y+=c.value;const p=c.type==="minusSign"||c.type==="plusSign"?"sign":c.type;switch(p){case"integer":k=!0,g.push(...c.value.split("").map(C=>({type:p,value:parseInt(C)})));break;case"group":g.push({type:p,value:c.value});break;case"decimal":x=!0,w.push({type:p,value:c.value,key:m(p),originalIndex:f++});break;case"fraction":w.push(...c.value.split("").map(C=>({type:p,value:parseInt(C),key:m(p),originalIndex:f++})));break;default:(k||x?h:d).push({type:p,value:c.value,key:m(p),originalIndex:f++})}}const v=[];for(let c=g.length-1;c>=0;c--){const p=m(g[c].type);v.unshift({...g[c],key:p,originalIndex:c})}return{pre:d,integer:v,fraction:w,post:h,formatted:y}}const[Se,Be]=a.createContext("SectionContext");function ye(){const o={current:!0};return e.onMounted(()=>{o.current=!1}),o}function U(o){const{width:t,fontSize:n}=getComputedStyle(o);return`${parseFloat(t)/parseFloat(n)}em`}const E="var(--mask-height, 0.15em)",Y="var(--mask-width, 0.5em)",N=`calc(${Y} / var(--invert-x, 1))`,O="#000 0, transparent 71%",Ce=`linear-gradient(to right, transparent 0, #000 ${N}, #000 calc(100% - ${N}), transparent),linear-gradient(to bottom, transparent 0, #000 ${E}, #000 calc(100% - ${E}), transparent 100%),radial-gradient(at bottom right, ${O}),radial-gradient(at bottom left, ${O}), radial-gradient(at top left, ${O}), radial-gradient(at top right, ${O})`,ze=`100% calc(100% - ${E} * 2),calc(100% - ${N} * 2) 100%,${N} ${E},${N} ${E},${N} ${E},${N} ${E}`;a.addScaleCorrector({"--invert-x":{correct:(o,{treeScale:t,projectionDelta:n})=>n.x.scale*t.x}});const ie={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function ve(o){const t=e.ref();function n(i){t.value=i==null?void 0:i.$el}e.watch(()=>o.isPresent,i=>{var s;t.value&&((s=a.mountedStates.get(t.value))==null||s.setActive("exit",!i))});function r(i){var s;i.detail.isExit&&!o.isPresent&&((s=o.onRemove)==null||s.call(o,o.partKey,i.target))}return{root:t,getRoot:n,handleComplete:r}}const be=e.defineComponent({__name:"NumberSymbol",props:{partKey:{},type:{},value:{},isPresent:{type:Boolean},onRemove:{type:Function},style:{},layoutDependency:{},preInitial:{type:Boolean}},setup(o){const t=o,{justify:n}=Se(),{getRoot:r,handleComplete:i}=ve(t);return(s,l)=>(e.openBlock(),e.createBlock(e.unref(a.motion).span,{ref:e.unref(r),layout:"position","layout-dependency":s.layoutDependency,"data-state":s.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(n),padding:`calc(${e.unref(E)}/2) 0`,position:"relative",pointerEvents:s.isPresent?void 0:"none"}),"aria-hidden":!s.isPresent,onMotioncomplete:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref(a.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(n),initial:s.preInitial},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(a.motion).span,{key:s.value,layout:e.unref(n)==="right"?"position":!1,"layout-dependency":s.layoutDependency,initial:{opacity:0,left:e.unref(n)==="right"&&s.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(s.value),1)]),_:1},8,["layout","layout-dependency","initial"]))]),_:1},8,["anchor-x","initial"])]),_:1},8,["layout-dependency","data-state","style","aria-hidden","onMotioncomplete"]))}}),Pe=new WeakMap,Ie=e.defineComponent({__name:"NumberDigit",props:{value:{},initialValue:{default:void 0},isPresent:{type:Boolean},partKey:{},onRemove:{},style:{},layoutDependency:{}},setup(o){const t=o,n=t.initialValue??t.value,r=ye(),i=a.useMotionConfig(),s=e.ref(),l=e.ref(Array(10).fill(null)),d=e.ref(),{getRoot:g,handleComplete:w,root:h}=ve(t);let u=n;const m=e.ref(n);e.watch([()=>t.value,()=>t.isPresent],([f,v])=>{if(!v)return m.value=0;if(r.current)return e.nextTick(()=>{m.value=f});m.value=f},{immediate:!0});function y(f){var C;if(!s.value||f===u)return;const v=s.value.getBoundingClientRect(),c=(C=h.value)==null?void 0:C.getBoundingClientRect(),p=v.height*(f-u)+(v.top-(c?c.top||0:v.top));a.animate(s.value,{y:[p,0]},i.value.transition)}function k(f){if(r.current&&n===f||!l.value[f])return;const v=U(l.value[f]);h.value&&(Pe.set(h.value,v),h.value.style.width=v),d.value=v}e.watch(m,f=>{k(f)},{immediate:!0,flush:"sync"}),e.watch(m,async(f,v,c)=>{await e.nextTick(),y(f),c(()=>{u=f})},{immediate:!0,flush:"sync"});function x(f){return()=>e.createVNode("span",{key:f,style:{display:"inline-block",padding:`calc(${E}/2) 0`},ref:v=>{l.value[f]=v}},[f])}return(f,v)=>(e.openBlock(),e.createBlock(e.unref(a.motion).span,{ref:e.unref(g),layout:"position","layout-dependency":f.layoutDependency,"data-state":f.isPresent?void 0:"exiting","data-key":f.partKey,style:e.normalizeStyle({display:"inline-flex",justifyContent:"center",width:d.value,pointerEvents:f.isPresent?void 0:"none"}),"aria-hidden":!f.isPresent,onMotioncomplete:e.unref(w)},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"scope",ref:s,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"}},[m.value!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({...e.unref(ie),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,c=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(c-1)),{key:c-1}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(m.value)))),m.value!==9?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref(ie),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(9-m.value,c=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(m.value+c)),{key:m.value+c}))),128))],4)):e.createCommentVNode("",!0)],512)]),_:1},8,["layout-dependency","data-state","data-key","style","aria-hidden","onMotioncomplete"]))}}),_=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{},layoutDependency:{}},setup(o){var h;const t=o,n=e.ref(),r=a.useDomRef(),i=e.ref(),s=ye(),l=e.ref(t.parts);let d=t.name==="pre"&&!((h=t.parts)!=null&&h.length)?void 0:!1;e.watch(()=>t.parts,u=>{const m=new Map(u.map(x=>[x.key,{...x,isPresent:!0}])),y=l.value.filter(x=>!m.get(x.key)).map(x=>({...x,isPresent:!1})),k=u.sort((x,f)=>x.originalIndex-f.originalIndex);l.value=y.concat(k)},{flush:"pre"}),e.watch(()=>{var u;return(u=t.parts)==null?void 0:u.map(m=>m.value).join("")},async(u,m)=>{if(await e.nextTick(),d=!1,!i.value)return;if(s.current){r.value&&(r.value.style.width=U(i.value));return}const y=Array.from(i.value.children).map(x=>{if(x instanceof HTMLElement&&x.dataset.state==="exiting"){const f=x.nextSibling;return x.remove(),()=>{i.value&&i.value.insertBefore(x,f)}}}),k=U(i.value);n.value=k;for(let x=y.length-1;x>=0;x--){const f=y[x];f&&f()}},{flush:"post"});const g=e.toRef(t,"justify");Be({justify:g});function w(u,m){var y;l.value=l.value.filter(k=>k.key!==u),(y=m==null?void 0:m.parentElement)==null||y.removeChild(m)}return(u,m)=>(e.openBlock(),e.createBlock(e.unref(a.motion).span,{ref:e.unref(r),class:e.normalizeClass(`number-section-${u.name}`),style:e.normalizeStyle({...u.style,display:"inline-flex",justifyContent:g.value,width:n.value}),layout:"position","layout-dependency":u.layoutDependency},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:i,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[m[0]||(m[0]=e.createTextVNode(" ​ ")),e.createVNode(e.unref(a.AnimatePresence),{mode:u.mode,"anchor-x":g.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,y=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y.key},[y.type==="integer"||y.type==="fraction"?(e.openBlock(),e.createBlock(Ie,{key:y.key,"part-key":y.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:y.value,"is-present":y.isPresent??!0,"initial-value":e.unref(s).current?void 0:0,"layout-dependency":u.layoutDependency,onRemove:w},null,8,["part-key","value","is-present","initial-value","layout-dependency"])):(e.openBlock(),e.createBlock(be,{key:y.type==="literal"?`${y.key}:${y.value}`:y.key,type:y.type,"part-key":y.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:y.value,"is-present":y.isPresent??!0,"pre-initial":e.unref(d),"layout-dependency":u.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"]))}}),Ee=e.defineComponent({__name:"Mask",props:{layoutDependency:{}},setup(o){return(t,n)=>(e.openBlock(),e.createBlock(e.unref(a.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(Y)})`,padding:`calc(${e.unref(E)}/2) ${e.unref(Y)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(Ce),webkitMaskSize:e.unref(ze),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"]))}}),Te=e.defineComponent({name:"AnimateNumber",inheritAttrs:!1,__name:"AnimateNumber",props:{locales:{},format:{},transition:{},suffix:{},prefix:{},value:{},style:{},layoutDependency:{}},setup(o){const t={opacity:{duration:1,ease:a.easeOut},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},n=o,r=e.computed(()=>{const g=n.value;return ke(g,{locales:n.locales,format:n.format},n.prefix,n.suffix)}),i=a.useMotionConfig(),s=e.computed(()=>n.transition??i.value.transition??t);function l(){const{format:g,prefix:w,suffix:h,locales:u,value:m,layoutDependency:y,...k}=n;return k}const d=e.computed(()=>{if(n.layoutDependency!==void 0)return{layoutDependency:n.layoutDependency,value:n.value}});return(g,w)=>(e.openBlock(),e.createBlock(e.unref(a.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.MotionConfig),{transition:s.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.motion).div,e.mergeProps({...g.$attrs,...l()},{layout:"","layout-dependency":d.value,style:{lineHeight:"1",...g.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(a.motion).div,{layout:"","layout-dependency":d.value,"aria-label":r.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(_,{"layout-dependency":d.value,style:e.normalizeStyle({padding:`calc(${e.unref(E)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:r.value.pre,name:"pre"},null,8,["layout-dependency","style","parts"]),e.createVNode(Ee,{"layout-dependency":d.value},{default:e.withCtx(()=>[e.createVNode(_,{"layout-dependency":d.value,justify:"right",parts:r.value.integer,name:"integer",mode:"popLayout"},null,8,["layout-dependency","parts"]),e.createVNode(_,{"layout-dependency":d.value,layout:"position",parts:r.value.fraction,name:"fraction",mode:"popLayout"},null,8,["layout-dependency","parts"])]),_:1},8,["layout-dependency"]),e.createVNode(_,{"layout-dependency":d.value,style:e.normalizeStyle({padding:`calc(${e.unref(E)}/2) 0`}),"aria-hidden":!0,layout:"position",mode:"popLayout",parts:r.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}))}}),$e=Te;function Le(){const o=document.createElement("style");return o.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("motion-v");function Be(n,{locales:t,format:o},i,l){const s=new Intl.NumberFormat(t,o).formatToParts(Number(n));i&&s.unshift({type:"prefix",value:i}),l&&s.push({type:"suffix",value:l});const c=[],v=[],h=[],x=[],u={},f=m=>`${m}:${u[m]=(u[m]??-1)+1}`;let p="",B=!1,w=!1,y=0;for(const m of s){p+=m.value;const d=m.type==="minusSign"||m.type==="plusSign"?"sign":m.type;switch(d){case"integer":B=!0,v.push(...m.value.split("").map(b=>({type:d,value:parseInt(b)})));break;case"group":v.push({type:d,value:m.value});break;case"decimal":w=!0,h.push({type:d,value:m.value,key:f(d),originalIndex:y++});break;case"fraction":h.push(...m.value.split("").map(b=>({type:d,value:parseInt(b),key:f(d),originalIndex:y++})));break;default:(B||w?x:c).push({type:d,value:m.value,key:f(d),originalIndex:y++})}}const k=[];for(let m=v.length-1;m>=0;m--){const d=f(v[m].type);k.unshift({...v[m],key:d,originalIndex:m})}return{pre:c,integer:k,fraction:h,post:x,formatted:p}}const[Ce,be]=r.createContext("SectionContext");function ve(){const n={current:!0};return e.onMounted(()=>{n.current=!1}),n}function G(n){const{width:t,fontSize:o}=getComputedStyle(n);return`${parseFloat(t)/parseFloat(o)}em`}const T="var(--mask-height, 0.15em)",U="var(--mask-width, 0.5em)",O=`calc(${U} / var(--invert-x, 1))`,j="#000 0, transparent 71%",Se=`linear-gradient(to right, transparent 0, #000 ${O}, #000 calc(100% - ${O}), transparent),linear-gradient(to bottom, transparent 0, #000 ${T}, #000 calc(100% - ${T}), transparent 100%),radial-gradient(at bottom right, ${j}),radial-gradient(at bottom left, ${j}), radial-gradient(at top left, ${j}), radial-gradient(at top right, ${j})`,Ie=`100% calc(100% - ${T} * 2),calc(100% - ${O} * 2) 100%,${O} ${T},${O} ${T},${O} ${T},${O} ${T}`;r.addScaleCorrector({"--invert-x":{correct:(n,{treeScale:t,projectionDelta:o})=>o.x.scale*t.x}});const ae={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function ge(n){const t=e.ref();function o(l){t.value=l==null?void 0:l.$el}e.watch(()=>n.isPresent,l=>{var a;t.value&&((a=r.mountedStates.get(t.value))==null||a.setActive("exit",!l))});function i(l){var a;l.detail.isExit&&!n.isPresent&&((a=n.onRemove)==null||a.call(n,n.partKey,l.target))}return{root:t,getRoot:o,handleComplete:i}}const Le=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}=Ce(),{getRoot:i,handleComplete:l}=ge(t);return(a,s)=>(e.openBlock(),e.createBlock(e.unref(r.motion).span,{ref:e.unref(i),layout:"position","layout-dependency":a.layoutDependency,"data-state":a.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(o),padding:`calc(${e.unref(T)}/2) 0`,position:"relative",pointerEvents:a.isPresent?void 0:"none"}),"aria-hidden":!a.isPresent,onMotioncomplete:e.unref(l)},{default:e.withCtx(()=>[e.createVNode(e.unref(r.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(o),initial:a.preInitial},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(r.motion).span,{key:a.value,layout:e.unref(o)==="right"?"position":!1,"layout-dependency":a.layoutDependency,initial:{opacity:0,left:e.unref(o)==="right"&&a.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(a.value),1)]),_:1},8,["layout","layout-dependency","initial"]))]),_:1},8,["anchor-x","initial"])]),_:1},8,["layout-dependency","data-state","style","aria-hidden","onMotioncomplete"]))}}),ze=new WeakMap,Ee=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=ve(),l=r.useMotionConfig(),a=e.ref(),s=e.ref(Array(10).fill(null)),c=e.ref(),{getRoot:v,handleComplete:h,root:x}=ge(t);let u=o;const f=e.ref(o);e.watch([()=>t.value,()=>t.isPresent],([y,k])=>{if(!k)return f.value=0;if(i.current)return e.nextTick(()=>{f.value=y});f.value=y},{immediate:!0});function p(y){var b;if(!a.value||y===u)return;const k=a.value.getBoundingClientRect(),m=(b=x.value)==null?void 0:b.getBoundingClientRect(),d=k.height*(y-u)+(k.top-(m?m.top||0:k.top));r.animate(a.value,{y:[d,0]},l.value.transition)}function B(y){if(i.current&&o===y||!s.value[y])return;const k=G(s.value[y]);x.value&&(ze.set(x.value,k),x.value.style.width=k),c.value=k}e.watch(f,y=>{B(y)},{immediate:!0,flush:"sync"}),e.watch(f,async(y,k,m)=>{await e.nextTick(),p(y),m(()=>{u=y})},{immediate:!0,flush:"sync"});function w(y){return()=>e.createVNode("span",{key:y,style:{display:"inline-block",padding:`calc(${T}/2) 0`},ref:k=>{s.value[y]=k}},[y])}return(y,k)=>(e.openBlock(),e.createBlock(e.unref(r.motion).span,{ref:e.unref(v),layout:"position","layout-dependency":y.layoutDependency,"data-state":y.isPresent?void 0:"exiting","data-key":y.partKey,style:e.normalizeStyle({display:"inline-flex",justifyContent:"center",width:c.value,pointerEvents:y.isPresent?void 0:"none"}),"aria-hidden":!y.isPresent,onMotioncomplete:e.unref(h)},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"scope",ref:a,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(ae),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w(m-1)),{key:m-1}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w(f.value)))),f.value!==9?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref(ae),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(9-f.value,m=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w(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"]))}}),H=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{},layoutDependency:{}},setup(n){var x;const t=n,o=e.ref(),i=r.useDomRef(),l=e.ref(),a=ve(),s=e.ref(t.parts);let c=t.name==="pre"&&!((x=t.parts)!=null&&x.length)?void 0:!1;e.watch(()=>t.parts,u=>{const f=new Map(u.map(w=>[w.key,{...w,isPresent:!0}])),p=s.value.filter(w=>!f.get(w.key)).map(w=>({...w,isPresent:!1})),B=u.sort((w,y)=>w.originalIndex-y.originalIndex);s.value=p.concat(B)},{flush:"pre"}),e.watch(()=>{var u;return(u=t.parts)==null?void 0:u.map(f=>f.value).join("")},async(u,f)=>{if(await e.nextTick(),c=!1,!l.value)return;if(a.current){i.value&&(i.value.style.width=G(l.value));return}const p=Array.from(l.value.children).map(w=>{if(w instanceof HTMLElement&&w.dataset.state==="exiting"){const y=w.nextSibling;return w.remove(),()=>{l.value&&l.value.insertBefore(w,y)}}}),B=G(l.value);o.value=B;for(let w=p.length-1;w>=0;w--){const y=p[w];y&&y()}},{flush:"post"});const v=e.toRef(t,"justify");be({justify:v});function h(u,f){var p;s.value=s.value.filter(B=>B.key!==u),(p=f==null?void 0:f.parentElement)==null||p.removeChild(f)}return(u,f)=>(e.openBlock(),e.createBlock(e.unref(r.motion).span,{ref:e.unref(i),class:e.normalizeClass(`number-section-${u.name}`),style:e.normalizeStyle({...u.style,display:"inline-flex",justifyContent:v.value,width:o.value}),layout:"position","layout-dependency":u.layoutDependency},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:l,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[f[0]||(f[0]=e.createTextVNode(" ​ ")),e.createVNode(e.unref(r.AnimatePresence),{mode:u.mode,"anchor-x":v.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.key},[p.type==="integer"||p.type==="fraction"?(e.openBlock(),e.createBlock(Ee,{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(a).current?void 0:0,"layout-dependency":u.layoutDependency,onRemove:h},null,8,["part-key","value","is-present","initial-value","layout-dependency"])):(e.openBlock(),e.createBlock(Le,{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(c),"layout-dependency":u.layoutDependency,onRemove:h},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"]))}}),Pe=e.defineComponent({__name:"Mask",props:{layoutDependency:{}},setup(n){return(t,o)=>(e.openBlock(),e.createBlock(e.unref(r.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(U)})`,padding:`calc(${e.unref(T)}/2) ${e.unref(U)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(Se),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"]))}}),Te=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:r.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 Be(v,{locales:o.locales,format:o.format},o.prefix,o.suffix)}),l=r.useMotionConfig(),a=e.computed(()=>o.transition??l.value.transition??t);function s(){const{format:v,prefix:h,suffix:x,locales:u,value:f,layoutDependency:p,...B}=o;return B}const c=e.computed(()=>{if(o.layoutDependency!==void 0)return{layoutDependency:o.layoutDependency,value:o.value}});return(v,h)=>(e.openBlock(),e.createBlock(e.unref(r.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(r.MotionConfig),{transition:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(r.motion).div,e.mergeProps({...v.$attrs,...s()},{layout:"","layout-dependency":c.value,style:{lineHeight:"1",...v.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(r.motion).div,{layout:"","layout-dependency":c.value,"aria-label":i.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(H,{"layout-dependency":c.value,style:e.normalizeStyle({padding:`calc(${e.unref(T)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:i.value.pre,name:"pre"},null,8,["layout-dependency","style","parts"]),e.createVNode(Pe,{"layout-dependency":c.value},{default:e.withCtx(()=>[e.createVNode(H,{"layout-dependency":c.value,justify:"right",parts:i.value.integer,name:"integer",mode:"popLayout"},null,8,["layout-dependency","parts"]),e.createVNode(H,{"layout-dependency":c.value,layout:"position",parts:i.value.fraction,name:"fraction",mode:"popLayout"},null,8,["layout-dependency","parts"])]),_:1},8,["layout-dependency"]),e.createVNode(H,{"layout-dependency":c.value,style:e.normalizeStyle({padding:`calc(${e.unref(T)}/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}))}}),$e=Te;function Me(){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(o),()=>{document.head.removeChild(o)}}function Me(o){e.watch(o,(t,n,r)=>{const i=t?Le():a.noop;return r(()=>{i()})},{immediate:!0,flush:"post"})}function Z(o){return t=>{t.pointerType==="mouse"&&o(t)}}function re(o){return Z(t=>{t.button===0&&o(t)})}let j,q;function Ve(){j=a.motionValue(0),q=a.motionValue(0);let o=0,t=0;function n(){j.set(o),q.set(t)}typeof window<"u"&&window.addEventListener("pointermove",Z(r=>{o=r.clientX,t=r.clientY,a.frame.update(n)}))}function J(){return j||Ve(),{x:j,y:q}}function Re(o,t){return{x:a.useTransform(()=>o.x.get()+t.value.x),y:a.useTransform(()=>o.y.get()+t.value.y)}}function Ne(o){return o.closest("[data-cursor]")}function De(o){return o.closest('a, button, input[type="button"]:not(:disabled)')}function Fe(o){return window.getComputedStyle(o).userSelect==="none"?null:o.closest("p, textarea:not(:disabled), input[type='text']:not(:disabled), h1, h2, h3, h4, h5, h6")}function Oe(o){let t=Ne(o);return t?[t.dataset.cursor,t]:(t=De(o),t?["pointer",t]:(t=Fe(o),t?["text",t]:["default",null]))}let W=null,I={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function _e(o){let t=null;if("closest"in o){const n=o.closest("[data-cursor-zone]");n instanceof HTMLElement&&(t=n.dataset.cursorZone||null)}return t}function Ae(){if(typeof window>"u")return{onChange:()=>()=>{}};const o=new Set;function t(d){I={...I,...d},o.forEach(g=>g(I))}const n=re(()=>{I.isPressed||t({isPressed:!0})}),r=re(()=>{I.isPressed&&t({isPressed:!1})}),i=Z(({target:d})=>{if(!d)return;const[g,w]=Oe(d);let h=!1;const u={target:w,zone:_e(d)};g!==I.type&&(u.type=g,h=!0),u.zone!==I.zone&&(I.zone=u.zone,h=!0);const m=g==="pointer"&&w?w.getBoundingClientRect():null;if(m!==I.targetBoundingBox&&(u.targetBoundingBox=m,h=!0),g==="text"){const{fontSize:y}=window.getComputedStyle(d),k=y?parseInt(y):null;k!==I.fontSize&&(u.fontSize=k,h=!0)}else I.fontSize&&(u.fontSize=null,h=!0);h&&t(u)});function s(){typeof window>"u"||(window.addEventListener("pointerover",i),window.addEventListener("pointerdown",n),window.addEventListener("pointerup",r))}function l(){window.removeEventListener("pointerover",i),window.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",r)}return{onChange:d=>(o.size||s(),o.add(d),()=>{o.delete(d),o.size||l()})}}function je(){return W||(W=Ae()),W}function Q(){const o=e.ref({...I});return e.watch(o,()=>je().onChange(t=>{o.value=t}),{immediate:!0,flush:"post"}),o}let X=null;function He(){const o=new Set;function t(){o.forEach(s=>s.show())}function n(){o.forEach(s=>s.hide())}function r(){document.body.addEventListener("mouseenter",t),document.body.addEventListener("mouseleave",n)}function i(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",n)}return{on:s=>typeof window>"u"?a.noop:(o.size||r(),o.add(s),()=>{o.delete(s),o.size===0&&i()})}}function Ke(){return X||(X=He()),X}function ge(o){const t=e.ref(!0);return e.watch(t,()=>Ke().on({show:()=>{t.value||(o(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const ae={x:0,y:0},We={x:.5,y:.5},Xe={duration:0},Ue={stiffness:1e3,damping:100},Ye={duration:.15,ease:[.38,.12,.29,1]},se={magneticOptions:{morph:!0,padding:5,snap:.8}},ue=17,le=31,ce=4,qe=20;function A(o,t,n){const r={width:(n==null?void 0:n.width)??o,height:(n==null?void 0:n.height)??t};return typeof r.width=="number"&&(r.width=`${r.width}px`),typeof r.height=="number"&&(r.height=`${r.height}px`),r}function Ge({type:o,state:t,hasChildren:n,style:r,isMagnetic:i,magneticOptions:s,matchTextSize:l}){const d=i&&t.targetBoundingBox;if(n&&!d)return A("auto","auto",r);const{padding:g,morph:w}=s;switch(o){case"pointer":if(i&&w&&t.targetBoundingBox){const{width:h,height:u}=t.targetBoundingBox;return{width:`${h+g*2}px`,height:`${u+g*2}px`}}return A(le,le,r);case"text":return l&&t.fontSize?{width:`${ce}px`,height:`${t.fontSize}px`}:A(ce,qe,r);default:return A(ue,ue,r)}}function Ze({x:o,y:t},n){const r=e.ref(o.prev!==void 0||t.prev!==void 0);return e.watch(r,()=>{if(r.value)return;const i=()=>{r.value=!0,n(),s()},s=a.pipe(o.on("change",i),t.on("change",i));return()=>s()},{immediate:!0}),r}function Je(o,t,n){return a.useTransform(()=>a.mix(o.value.get(),t.get(),n.get()))}function de(o,t,n){const r=a.useSpring(0,{stiffness:600,damping:50}),i=a.useMotionValue(0),s=Je(o,r,i);return e.watch(()=>n==null?void 0:n.value,(l,d)=>{l?(!d&&!i.isAnimating()?r.jump(l):r.set(l),a.animate(i,t.value||0)):a.animate(i,0)},{immediate:!0,flush:"sync"}),s}function Qe(o,t,n,r){const i=de(e.computed(()=>o.value.x),r,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),s=de(e.computed(()=>o.value.y),r,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return e.computed(()=>t.value?{x:i,y:s}:o.value)}const et=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:o})=>o?ae:We},offset:{default:()=>ae},spring:{type:[Boolean,Object],default:({follow:o})=>o?Ue:!1},matchTextSize:{type:Boolean,default:!0},magnetic:{type:[Boolean,Object],default:!1},transition:{},variants:{},style:{},show:{type:Boolean,default:!0}},setup(o){const t=o,{offset:n,magnetic:r}=e.toRefs(t),i=a.useReducedMotion();Me(()=>!i.value&&!t.follow);const s=J(),l=Re(s,n),d=a.useSpring(l.x,t.spring||void 0),g=a.useSpring(l.y,t.spring||void 0),w=e.computed(()=>typeof t.magnetic=="object"?{...se.magneticOptions,...t.magnetic}:se.magneticOptions);function h(){const p=l.x.on("change",z=>{d.jump(z),p()}),C=l.y.on("change",z=>{g.jump(z),C()})}const u=Q(),m=ge(h),y=Qe(e.computed(()=>t.spring?{x:d,y:g}:s),e.computed(()=>!!r.value),u,e.computed(()=>w.value&&w.value.snap)),k=e.useSlots(),x=e.computed(()=>{var z,T;const p=(T=(z=k.default)==null?void 0:z.call(k))==null?void 0:T.filter($=>$.type!==Symbol.for("v-cmt"));return Ge({type:u.value.type,state:u.value,hasChildren:!!(p!=null&&p.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:w.value,matchTextSize:t.matchTextSize})}),f=Ze(s,h);function v(p){return(C,z)=>`translate(-${p.x*100}%, -${p.y*100}%) ${z}`}function c(){const{follow:p,center:C,offset:z,spring:T,matchTextSize:$,magnetic:D,...B}=t;return B}return(p,C)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(f)?(e.openBlock(),e.createBlock(e.unref(a.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(a.MotionConfig),{transition:e.unref(i)?e.unref(Xe):p.transition||e.unref(Ye)},{default:e.withCtx(()=>{var z,T;return[e.createVNode(e.unref(a.motion).div,e.mergeProps({layout:"","data-motion-cursor":p.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...p.$attrs,...c()},{variants:{pressed:p.follow?{}:{scale:.9},...p.variants,default:{opacity:1,scale:1,...(z=p.variants)==null?void 0:z.default},exit:{opacity:0,scale:0,...(T=p.variants)==null?void 0:T.exit}},animate:["default",e.unref(u).type,e.unref(r)&&e.unref(u).targetBoundingBox?"magnetic":"",!e.unref(m)||!p.show?"exit":e.unref(u).isPressed?"pressed":""],"transform-template":v(p.center),style:{borderRadius:p.follow?0:20,zIndex:p.follow?99998:99999,willChange:"transform",contain:"layout",originX:p.center.x,originY:p.center.y,...p.style,width:x.value.width,height:x.value.height,x:e.unref(y).x,y:e.unref(y).y,top:0,left:0,position:"fixed",pointerEvents:"none"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(a.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default")]),_:3})]),_:3},16,["data-motion-cursor","variants","animate","transform-template","style"])]}),_:3},8,["transition"])]),_:3})):e.createCommentVNode("",!0)]))}});function fe(o,t,n){const r=a.useMotionValue(0),i=a.useMotionValue(0),s=a.useMotionValue(0);return e.watch(()=>n==null?void 0:n.value,l=>{if(typeof l=="number"){a.animate(s,1);const d=()=>{i.set(t*(o.get()-l))};return d(),o.on("change",d)}else a.animate(s,0)},{immediate:!0,flush:"post"}),a.useTransform(()=>a.mix(r.get(),i.get(),s.get()))}function tt(o,t=.1){const n=Q(),r=J(),i=e.computed(()=>n.value.targetBoundingBox&&n.value.target===o.value),s=fe(r.x,t,e.computed(()=>i.value?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),l=fe(r.y,t,e.computed(()=>i.value?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return{x:s,y:l}}const[nt,ot]=a.createContext("TickerItemContext"),pe=e.defineComponent({__name:"TickerItem",props:{offset:{},axis:{},listSize:{},containerPaddingStart:{},bounds:{},itemIndex:{},cloneIndex:{}},setup(o){const t=o,n=a.useMotionValue(0);a.useTransform(()=>{const i=t.offset.get(),{start:s,end:l}=t.bounds;return!s&&!l||!t.listSize?n.set(0):i+l<=-t.containerPaddingStart?n.set(t.listSize):n.set(0)});const r=a.useMotionValue(0);return a.useTransform(()=>{const{offset:i,listSize:s,bounds:l}=t,{start:d,end:g}=l,w=i.get(),h=n.get();return!d&&!g||!s?r.set(0):r.set(w+d+h)}),ot({offset:r}),(i,s)=>(e.openBlock(),e.createBlock(e.unref(a.motion).li,e.mergeProps(i.$attrs,{class:i.cloneIndex===void 0?"ticker-item":"clone-item","aria-hidden":i.cloneIndex!==void 0?!0:void 0,style:{flexShrink:0,flexGrow:0,x:i.axis==="x"?e.unref(n):0,y:i.axis==="y"?e.unref(n):0}}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16,["class","aria-hidden","style"]))}});function he(o,t,n){let r=!1;e.onMounted(()=>{const i=o.value;if(!i)return;const s=t.value==="x"?"scrollLeft":"scrollTop",l=t.value==="x"?"offsetLeft":"offsetTop",d=t.value==="x"?"ArrowLeft":"ArrowUp",g=t.value==="x"?"ArrowRight":"ArrowDown";let w=[],h=0;const u=()=>{const v=w[h];v.focus(),n.set(-v[l]),i[s]=0,a.frame.render(()=>{i[s]=0})},m=v=>{if(v.key==="Tab"){v.preventDefault(),x();const c=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(a.isHTMLElement);c.sort(it);const p=c[v.shiftKey?0:c.length-1],C=v.shiftKey?c.length-1:0;if(i.contains(p)){c[C].focus();return}else{const z=c.indexOf(w[h]),T=v.shiftKey?-1:1;for(let $=z;$<c.length&&$>=0;$+=T){const D=c[$];if(!i.contains(D)){D.focus();return}}}return}else v.key===d?h--:v.key===g&&h++;h=a.wrap(0,w.length,h),u()},y=()=>{r||(r=!0,w=Array.from(i.querySelectorAll('.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex="-1"]), .ticker-item [contenteditable="true"]')).filter(a.isHTMLElement),h=0,u(),window.addEventListener("focus",k,!0),window.addEventListener("blur",k,!0),i.addEventListener("keydown",m))},k=v=>{(!v.target||!(v.target instanceof HTMLElement)||!i.contains(v.target))&&x()},x=()=>{r&&(r=!1,window.removeEventListener("focus",k,!0),window.removeEventListener("blur",k,!0),i.removeEventListener("keydown",m))},f=v=>{const{target:c}=v;a.isHTMLElement(c)&&(r||y())};i.addEventListener("focus",f,!0),e.onUnmounted(()=>{i.removeEventListener("focus",f),x()})})}function it(o,t){return o.tabIndex>=1&&t.tabIndex>=1?o.tabIndex-t.tabIndex:o.tabIndex>=1&&t.tabIndex<=0?-1:t.tabIndex>=1&&o.tabIndex<=0?1:0}const me={start:0,end:0};function rt(o=[]){const t=[];for(const n of o)n.type!==e.Comment&&t.push(n);return t}function G(o){const t=[];for(const n of o)n.type===e.Fragment?t.push(...G(n.children.default())):t.push(n);return t}function at(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const st=e.defineComponent({__name:"Ticker",props:{axis:{default:"x"},style:{},velocity:{default:50},hoverFactor:{default:1},gap:{default:10},align:{default:"center"},offset:{}},setup(o){const t=o,n=e.reactive({listSize:0,containerSize:0,containerPaddingStart:0,containerPaddingEnd:0,itemSizes:[]}),r=e.ref(!1),i=a.useMotionValue(1),s=a.useMotionValue(0),l=e.computed(()=>t.offset??s),d=a.useMotionValue(0);a.useTransform(()=>(d.set(a.wrap(-n.listSize-t.gap-n.containerPaddingStart,-n.containerPaddingStart,l.value.get())),d.get()));const g=a.useMotionValue(0),w=e.computed(()=>r.value?g:d),h=e.computed(()=>t.align==="start"?"flex-start":t.align==="center"?"center":"flex-end"),u=a.useDomRef(),m=a.useDomRef(),y=a.useInView(u,{margin:"100px"}),k=a.useReducedMotion();function x(){if(!u.value||!m.value)return;const{axis:B}=t,S=B==="x"?"offsetWidth":"offsetHeight",b=B==="x"?"offsetLeft":"offsetTop",P=B==="x"?"paddingLeft":"paddingTop",V=B==="x"?"paddingRight":"paddingBottom",L=u.value,F=m.value.querySelectorAll(".ticker-item");if(!F.length)return;let ee=!1;const R=[];for(let M=0;M<F.length;M++){const K=F[M];R.push({start:K[b],end:K[b]+K[S]}),(!n.itemSizes[M]||R[M].start!==n.itemSizes[M].start||R[M].end!==n.itemSizes[M].end)&&(ee=!0)}const te=L[S],ne=R[R.length-1].end-R[0].start,oe=window.getComputedStyle(L),xe=parseInt(oe[P]??0),we=parseInt(oe[V]??0);(ne!==n.listSize||te!==n.containerSize||ee)&&(n.listSize=ne,n.containerSize=te,n.containerPaddingStart=xe,n.containerPaddingEnd=we,n.itemSizes=R)}const f=e.useSlots(),v=e.computed(()=>{var B;return rt((B=f.default)==null?void 0:B.call(f))});e.watch([v,y,u],(B,S,b)=>{if(!y.value||!u.value)return;x();const P=a.resize(u.value,x);b(P)},{immediate:!0,flush:"sync"});const c=e.computed(()=>n.containerSize>0&&n.listSize>0);a.useAnimationFrame((B,S)=>{if(c.value&&y.value&&l.value===s&&!k.value){const b=S/1e3*(t.velocity*i.get());l.value.set(l.value.get()-b)}});const p=e.computed(()=>{let B=0;if(!c.value||!n.containerSize)return 0;let S=0;const b=Math.max(...n.itemSizes.map(P=>P.end-P.start));for(;S<n.containerSize+n.containerPaddingStart;)S=(n.listSize+t.gap)*(B+1)-b,B++;return Math.max(B-1,0)}),C=e.computed(()=>n.listSize===0?0:(n.listSize+t.gap)*(p.value+1)),z=e.computed(()=>{const B=[];for(let S=0;S<p.value;S++)v.value.forEach((b,P)=>{let V;const L=n.itemSizes[P],H=(n.listSize+t.gap)*(S+1),F=L?{start:L.start+H,end:L.end+H}:me;B.push(e.createVNode(pe,{key:`clone-${S}-${P}`,offset:w.value,axis:t.axis,listSize:C.value,cloneIndex:P,bounds:F,containerPaddingStart:n.containerPaddingStart},at(V=G([b]))?V:{default:()=>[V]}))});return B}),T=e.toRef(t,"axis");he(u,T,g);const $={display:"flex",position:"relative",overflow:"hidden"},D=e.computed(()=>({display:"flex",position:"relative",willChange:"transform",listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start",flexDirection:t.axis==="x"?"row":"column",gap:`${t.gap}px`,alignItems:h.value,x:t.axis==="x"?w.value:0,y:t.axis==="y"?w.value:0,opacity:c.value?1:0}));return(B,S)=>(e.openBlock(),e.createBlock(e.unref(a.motion).div,e.mergeProps({...B.$attrs},{ref_key:"containerRef",ref:u,"data-size":n.listSize,style:{...$,...t.style},onFocusCapture:S[0]||(S[0]=()=>{r.value=!0}),onBlurCapture:S[1]||(S[1]=()=>{r.value=!1,l.value.set(e.unref(g).get())}),onPointerenter:S[2]||(S[2]=()=>{e.unref(a.animate)(e.unref(i),B.hoverFactor)}),onPointerleave:S[3]||(S[3]=()=>{e.unref(a.animate)(e.unref(i),1)})}),{default:e.withCtx(()=>[e.createVNode(e.unref(a.motion).ul,{ref_key:"listRef",ref:m,style:e.normalizeStyle(D.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(b,P)=>(e.openBlock(),e.createBlock(pe,{key:`original-${P}`,axis:T.value,offset:w.value,"list-size":C.value,"item-index":P,bounds:n.itemSizes[P]??e.unref(me),"container-padding-start":n.containerPaddingStart},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(G)([b]),(V,L)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V),{key:L}))),128))]),_:2},1032,["axis","offset","list-size","item-index","bounds","container-padding-start"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,b=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b),{key:b.key}))),128))]),_:1},8,["style"])]),_:1},16,["data-size","style"]))}});function ut(){const o=nt(null);return a.invariant(!!o,"useItemOffset must be used within a TickerItem"),o==null?void 0:o.offset}const lt=st;exports.AnimateNumber=$e;exports.Cursor=et;exports.Ticker=lt;exports.useCursorIsInView=ge;exports.useCursorState=Q;exports.useItemOffset=ut;exports.useKeyboardFocus=he;exports.useMagneticPull=tt;exports.usePointerPosition=J;
9
+ `,document.head.appendChild(n),()=>{document.head.removeChild(n)}}function Ve(n){e.watch(n,(t,o,i)=>{const l=t?Me():r.noop;return i(()=>{l()})},{immediate:!0,flush:"post"})}function ee(n){return t=>{t.pointerType==="mouse"&&n(t)}}function se(n){return ee(t=>{t.button===0&&n(t)})}let K,Z;function Ne(){K=r.motionValue(0),Z=r.motionValue(0);let n=0,t=0;function o(){K.set(n),Z.set(t)}typeof window<"u"&&window.addEventListener("pointermove",ee(i=>{n=i.clientX,t=i.clientY,r.frame.update(o)}))}function te(){return K||Ne(),{x:K,y:Z}}function Re(n,t){return{x:r.useTransform(()=>n.x.get()+t.value.x),y:r.useTransform(()=>n.y.get()+t.value.y)}}function De(n){return n.closest("[data-cursor]")}function Oe(n){return n.closest('a, button, input[type="button"]:not(:disabled)')}function Ae(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 Fe(n){let t=De(n);return t?[t.dataset.cursor,t]:(t=Oe(n),t?["pointer",t]:(t=Ae(n),t?["text",t]:["default",null]))}let Y=null,P={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function _e(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 je(){if(typeof window>"u")return{onChange:()=>()=>{}};const n=new Set;function t(c){P={...P,...c},n.forEach(v=>v(P))}const o=se(()=>{P.isPressed||t({isPressed:!0})}),i=se(()=>{P.isPressed&&t({isPressed:!1})}),l=ee(({target:c})=>{if(!c)return;const[v,h]=Fe(c);let x=!1;const u={target:h,zone:_e(c)};v!==P.type&&(u.type=v,x=!0),u.zone!==P.zone&&(P.zone=u.zone,x=!0);const f=v==="pointer"&&h?h.getBoundingClientRect():null;if(f!==P.targetBoundingBox&&(u.targetBoundingBox=f,x=!0),v==="text"){const{fontSize:p}=window.getComputedStyle(c),B=p?parseInt(p):null;B!==P.fontSize&&(u.fontSize=B,x=!0)}else P.fontSize&&(u.fontSize=null,x=!0);x&&t(u)});function a(){typeof window>"u"||(window.addEventListener("pointerover",l),window.addEventListener("pointerdown",o),window.addEventListener("pointerup",i))}function s(){window.removeEventListener("pointerover",l),window.removeEventListener("pointerdown",o),window.removeEventListener("pointerup",i)}return{onChange:c=>(n.size||a(),n.add(c),()=>{n.delete(c),n.size||s()})}}function He(){return Y||(Y=je()),Y}function ne(){const n=e.ref({...P});return e.watch(n,()=>He().onChange(t=>{n.value=t}),{immediate:!0,flush:"post"}),n}let q=null;function We(){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 l(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",o)}return{on:a=>typeof window>"u"?r.noop:(n.size||i(),n.add(a),()=>{n.delete(a),n.size===0&&l()})}}function Ke(){return q||(q=We()),q}function he(n){const t=e.ref(!0);return e.watch(t,()=>Ke().on({show:()=>{t.value||(n(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const le={x:0,y:0},Xe={x:.5,y:.5},Ye={duration:0},qe={stiffness:1e3,damping:100},Ge={duration:.15,ease:[.38,.12,.29,1]},ue={magneticOptions:{morph:!0,padding:5,snap:.8}},ce=17,de=31,fe=4,Ue=20;function W(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 Ze({type:n,state:t,hasChildren:o,style:i,isMagnetic:l,magneticOptions:a,matchTextSize:s}){const c=l&&t.targetBoundingBox;if(o&&!c)return W("auto","auto",i);const{padding:v,morph:h}=a;switch(n){case"pointer":if(l&&h&&t.targetBoundingBox){const{width:x,height:u}=t.targetBoundingBox;return{width:`${x+v*2}px`,height:`${u+v*2}px`}}return W(de,de,i);case"text":return s&&t.fontSize?{width:`${fe}px`,height:`${t.fontSize}px`}:W(fe,Ue,i);default:return W(ce,ce,i)}}function Je({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 l=()=>{i.value=!0,o(),a()},a=r.pipe(n.on("change",l),t.on("change",l));return()=>a()},{immediate:!0}),i}function Qe(n,t,o){return r.useTransform(()=>r.mix(n.value.get(),t.get(),o.get()))}function pe(n,t,o){const i=r.useSpring(0,{stiffness:600,damping:50}),l=r.useMotionValue(0),a=Qe(n,i,l);return e.watch(()=>o==null?void 0:o.value,(s,c)=>{s?(!c&&!l.isAnimating()?i.jump(s):i.set(s),r.animate(l,t.value||0)):r.animate(l,0)},{immediate:!0,flush:"sync"}),a}function et(n,t,o,i){const l=pe(e.computed(()=>n.value.x),i,e.computed(()=>o.value.targetBoundingBox?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),a=pe(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:l,y:a}:n.value)}const tt=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:n})=>n?le:Xe},offset:{default:()=>le},spring:{type:[Boolean,Object],default:({follow:n})=>n?qe:!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),l=r.useReducedMotion();Ve(()=>!l.value&&!t.follow);const a=te(),s=Re(a,o),c=r.useSpring(s.x,t.spring||void 0),v=r.useSpring(s.y,t.spring||void 0),h=e.computed(()=>typeof t.magnetic=="object"?{...ue.magneticOptions,...t.magnetic}:ue.magneticOptions);function x(){const d=s.x.on("change",L=>{c.jump(L),d()}),b=s.y.on("change",L=>{v.jump(L),b()})}const u=ne(),f=he(x),p=et(e.computed(()=>t.spring?{x:c,y:v}:a),e.computed(()=>!!i.value),u,e.computed(()=>h.value&&h.value.snap)),B=e.useSlots(),w=e.computed(()=>{var L,z;const d=(z=(L=B.default)==null?void 0:L.call(B))==null?void 0:z.filter(V=>V.type!==Symbol.for("v-cmt"));return Ze({type:u.value.type,state:u.value,hasChildren:!!(d!=null&&d.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:h.value,matchTextSize:t.matchTextSize})}),y=Je(a,x);function k(d){return(b,L)=>`translate(-${d.x*100}%, -${d.y*100}%) ${L}`}function m(){const{follow:d,center:b,offset:L,spring:z,matchTextSize:V,magnetic:A,...F}=t;return F}return(d,b)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(y)?(e.openBlock(),e.createBlock(e.unref(r.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(r.MotionConfig),{transition:e.unref(l)?e.unref(Ye):d.transition||e.unref(Ge)},{default:e.withCtx(()=>{var L,z;return[e.createVNode(e.unref(r.motion).div,e.mergeProps({layout:"","data-motion-cursor":d.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...d.$attrs,...m()},{variants:{pressed:d.follow?{}:{scale:.9},...d.variants,default:{opacity:1,scale:1,...(L=d.variants)==null?void 0:L.default},exit:{opacity:0,scale:0,...(z=d.variants)==null?void 0:z.exit}},animate:["default",e.unref(u).type,e.unref(i)&&e.unref(u).targetBoundingBox?"magnetic":"",!e.unref(f)||!d.show?"exit":e.unref(u).isPressed?"pressed":""],"transform-template":k(d.center),style:{borderRadius:d.follow?0:20,zIndex:d.follow?99998:99999,willChange:"transform",contain:"layout",originX:d.center.x,originY:d.center.y,...d.style,width:w.value.width,height:w.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(r.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})]),_:3},16,["data-motion-cursor","variants","animate","transform-template","style"])]}),_:3},8,["transition"])]),_:3})):e.createCommentVNode("",!0)]))}});function me(n,t,o){const i=r.useMotionValue(0),l=r.useMotionValue(0),a=r.useMotionValue(0);return e.watch(()=>o==null?void 0:o.value,s=>{if(typeof s=="number"){r.animate(a,1);const c=()=>{l.set(t*(n.get()-s))};return c(),n.on("change",c)}else r.animate(a,0)},{immediate:!0,flush:"post"}),r.useTransform(()=>r.mix(i.get(),l.get(),a.get()))}function nt(n,t=.1){const o=ne(),i=te(),l=e.computed(()=>o.value.targetBoundingBox&&o.value.target===n.value),a=me(i.x,t,e.computed(()=>l.value?o.value.targetBoundingBox.left+o.value.targetBoundingBox.width/2:void 0)),s=me(i.y,t,e.computed(()=>l.value?o.value.targetBoundingBox.top+o.value.targetBoundingBox.height/2:void 0));return{x:a,y:s}}const[ot,it]=r.createContext("TickerItemContext"),J=e.defineComponent({__name:"TickerItem",props:{offset:{},axis:{},listSize:{},inset:{},bounds:{},itemIndex:{},cloneIndex:{},alignItems:{},itemSize:{default:"auto"}},setup(n){const t=n,o=r.useTransform(()=>{const s=t.offset.get(),{start:c,end:v}=t.bounds;return!c&&!v||!t.listSize?0:s+v<=-t.inset?t.listSize:0}),i=r.useTransform(()=>{const{start:s,end:c}=t.bounds,v=t.offset.get(),h=o.get();return!s&&!c||!t.listSize?0:v+s+h}),l=e.computed(()=>t.alignItems==="stretch"?"100%":"fit-content"),a=e.computed(()=>t.cloneIndex!==void 0);return it({offset:i}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(r.motion).li,e.mergeProps(s.$attrs,{class:s.cloneIndex===void 0?"ticker-item":"clone-item","aria-hidden":a.value?!0:void 0,style:{flexGrow:0,flexShrink:0,flexBasis:s.itemSize==="fill"?"100%":void 0,display:s.itemSize==="fill"?"flex":void 0,height:s.axis==="x"?l.value:void 0,width:s.axis==="y"?l.value:void 0,x:s.axis==="x"?e.unref(o):0,y:s.axis==="y"?e.unref(o):0}}),{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},16,["class","aria-hidden","style"]))}});function rt(n,t,o,i,l){let a=!1;e.watch(n,(s,c,v)=>{if(!s)return;let h=!1;const x=new AbortController,u={signal:x.signal},f={...u,capture:!0},p=t.value==="x"?"scrollLeft":"scrollTop",B=t.value==="x"?"offsetLeft":"offsetTop",w=t.value==="x"?"ArrowLeft":"ArrowUp",y=t.value==="x"?"ArrowRight":"ArrowDown";let k=[],m=0;const d=async()=>{const g=k[m];g.focus(),await e.nextTick(),o.set(-g[B]),s[p]=0},b=g=>{if(g.key==="Tab"){g.preventDefault(),V();const C=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(r.isHTMLElement);C.sort(at);const I=C[g.shiftKey?0:C.length-1],E=g.shiftKey?C.length-1:0;if(s.contains(I)){C[E].focus();return}else{const N=C.indexOf(k[m]),$=g.shiftKey?-1:1;for(let M=N;M<C.length&&M>=0;M+=$){const R=C[M];if(!s.contains(R)){R.focus();return}}}return}else g.key===w?m--:g.key===y&&m++;m=r.wrap(0,k.length,m),d()},L=()=>{a||(l(!0),a=!0,k=Array.from(s.querySelectorAll('.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex="-1"]), .ticker-item [contenteditable="true"]')).filter(r.isHTMLElement),m=0,d(),window.addEventListener("focus",z,f),window.addEventListener("blur",z,f),s.addEventListener("keydown",b,u))},z=g=>{(!g.target||!(g.target instanceof HTMLElement)||!s.contains(g.target))&&V()},V=()=>{a&&(a=!1,l(!1),i.value.set(o.get()),window.removeEventListener("focus",z),window.removeEventListener("blur",z),s.removeEventListener("keydown",b))},A=g=>{const{target:C}=g;r.isHTMLElement(C)&&(a||L())},F=()=>{h||(h=!0,s.addEventListener("focus",A,f),window.addEventListener("pointermove",_,u))},_=()=>{h&&(h=!1,s.removeEventListener("focus",A,!0),window.removeEventListener("pointermove",_,u))},S=g=>{const I=g.target.closest('[aria-hidden="true"]');I&&I.removeAttribute("aria-hidden")};window.addEventListener("keydown",F,u),s.addEventListener("pointerdown",S,u),v(()=>{x.abort(),V()})},{flush:"post"})}function at(n,t){return n.tabIndex>=1&&t.tabIndex>=1?n.tabIndex-t.tabIndex:n.tabIndex>=1&&t.tabIndex<=0?-1:t.tabIndex>=1&&n.tabIndex<=0?1:0}const ye={start:0,end:0},st={start:"flex-start",end:"flex-end"};function lt(n){return n.end-n.start}function we(n){return n.length?n[n.length-1].end-n[0].start:0}function ut(n,t,o){const i=we(t),l=Math.max(...t.map(lt));let a=0,s=0;for(;s<n;)s=(i+o)*(a+1)-l,a++;return Math.max(a-1,0)}function ct(n=[]){const t=[];for(const o of n)o.type!==e.Comment&&t.push(o);return t}function Q(n){const t=[];for(const o of n)o.type===e.Fragment?t.push(...Q(o.children.default())):t.push(o);return t}function dt(n,t){let o=0,i=n;for(;i;)o+=t==="x"?i.offsetLeft:i.offsetTop,i=i.offsetParent;return o}function ft(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!e.isVNode(n)}const pt=e.defineComponent({__name:"Ticker",props:{axis:{default:"x"},style:{},velocity:{default:50},hoverFactor:{default:1},gap:{default:10},align:{default:"center"},offset:{},itemSize:{default:"auto"},overflow:{type:Boolean,default:!1}},setup(n){const t=n,o=e.reactive({visibleLength:0,inset:0,totalItemLength:0,itemPositions:[]}),i=e.computed(()=>st[t.align]||t.align),l=e.useSlots(),a=e.computed(()=>{var S;return ct((S=l.default)==null?void 0:S.call(l))}),s=e.ref(!1),c=r.useMotionValue(1),v=r.useMotionValue(0),h=e.computed(()=>t.offset??v),x=r.useTransform(()=>r.wrap(-o.totalItemLength-t.gap-o.inset,-o.inset,h.value.get())),u=r.useMotionValue(0),f=e.computed(()=>s.value?u:x),p=r.useDomRef(),B=r.useDomRef(),w=r.useInView(p,{margin:"100px"}),y=r.usePageInView(),k=e.computed(()=>w.value&&y.value),m=r.useReducedMotion();function d(){if(!p.value||!B.value)return;const S=t.axis==="x"?"innerWidth":"innerHeight",g=t.axis==="x"?"offsetWidth":"offsetHeight",C=t.axis==="x"?"offsetLeft":"offsetTop",I=t.axis==="x"?"paddingLeft":"paddingTop",E=p.value,$=B.value.querySelectorAll(".ticker-item");if(!$.length)return;let M=!1;const R=[];for(let D=0;D<$.length;D++){const X=$[D];R.push({start:X[C],end:X[C]+X[g]}),(!o.itemPositions[D]||R[D].start!==o.itemPositions[D].start||R[D].end!==o.itemPositions[D].end)&&(M=!0)}const oe=t.overflow?window[S]:Math.min(E[g],window[S]),ie=we(R),xe=window.getComputedStyle(E),ke=parseInt(xe[I]??"0"),re=t.overflow?dt($[0],t.axis):ke;(oe!==o.visibleLength||ie!==o.totalItemLength||re!==o.inset||M)&&(o.visibleLength=oe,o.itemPositions=R,o.totalItemLength=ie,o.inset=re)}e.watch([a,k],(S,g,C)=>{if(!k.value||!p.value)return;d();const I=t.overflow?r.resize(d):void 0,E=r.resize(p.value,d);C(()=>{I==null||I(),E()})},{immediate:!0,flush:"post"});const b=e.computed(()=>o.totalItemLength>0);r.useAnimationFrame((S,g)=>{if(b.value&&k.value&&h.value===v&&!m.value){const C=g/1e3*(t.velocity*c.get());h.value.set(h.value.get()-C)}});const L=e.computed(()=>!b.value||!o.visibleLength?0:ut(o.visibleLength,o.itemPositions,t.gap)),z=e.computed(()=>o.totalItemLength===0?0:(o.totalItemLength+t.gap)*(L.value+1)),V=e.computed(()=>{const S=[];for(let g=0;g<L.value;g++)a.value.forEach((C,I)=>{let E;const N=o.itemPositions[I],$=(o.totalItemLength+t.gap)*(g+1),M=N?{start:N.start+$,end:N.end+$}:ye;S.push(e.createVNode(J,{key:`clone-${g}-${I}`,offset:f.value,axis:t.axis,listSize:z.value,cloneIndex:I,bounds:M,inset:o.inset,alignItems:i.value,itemSize:t.itemSize},ft(E=Q([C]))?E:{default:()=>[E]}))});return S}),A=e.toRef(t,"axis");rt(p,A,u,h,S=>{s.value=S});const F={display:"flex",position:"relative"},_=e.computed(()=>({display:"flex",position:"relative",willChange:b.value&&k.value?"transform":void 0,listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start",flexDirection:t.axis==="x"?"row":"column",gap:`${t.gap}px`,alignItems:i.value,x:t.axis==="x"?f.value:0,y:t.axis==="y"?f.value:0,opacity:b.value?1:0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%"}));return(S,g)=>(e.openBlock(),e.createBlock(e.unref(r.motion).div,e.mergeProps(S.$attrs,{ref_key:"containerRef",ref:p,style:{...F,...t.style,overflow:t.overflow?"visible":"hidden"},onPointerenter:g[0]||(g[0]=()=>{e.unref(r.animate)(e.unref(c),S.hoverFactor)}),onPointerleave:g[1]||(g[1]=()=>{e.unref(r.animate)(e.unref(c),1)})}),{default:e.withCtx(()=>[e.createVNode(e.unref(r.motion).ul,{ref_key:"listRef",ref:B,style:e.normalizeStyle(_.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(C,I)=>(e.openBlock(),e.createBlock(J,{key:`original-${I}`,axis:A.value,offset:f.value,"list-size":z.value,"item-index":I,bounds:o.itemPositions[I]??e.unref(ye),inset:o.inset,"align-items":i.value,"item-size":S.itemSize},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Q)([C]),(E,N)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E),{key:N}))),128))]),_:2},1032,["axis","offset","list-size","item-index","bounds","inset","align-items","item-size"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,C=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C),{key:C.key}))),128))]),_:1},8,["style"])]),_:1},16,["style"]))}});function mt(){const n=ot(null);return r.invariant(!!n,"useItemOffset must be used within a TickerItem"),n==null?void 0:n.offset}const yt=pt;exports.AnimateNumber=$e;exports.Cursor=tt;exports.Ticker=yt;exports.TickerItem=J;exports.useCursorIsInView=he;exports.useCursorState=ne;exports.useItemOffset=mt;exports.useMagneticPull=nt;exports.usePointerPosition=te;
@@ -1,19 +1,51 @@
1
1
  import { CSSProperties } from 'vue';
2
2
  import { MotionValue } from 'motion-v';
3
+ import { ItemSize } from './types';
4
+ /**
5
+ * Props for the Ticker component.
6
+ */
3
7
  export interface TickerProps {
8
+ /**
9
+ * The axis along which the ticker scrolls. Defaults to "x".
10
+ */
4
11
  axis?: 'x' | 'y';
5
12
  style?: CSSProperties;
13
+ /**
14
+ * The velocity of the ticker scroll in pixels per second. Defaults to 50.
15
+ */
6
16
  velocity?: number;
17
+ /**
18
+ * Factor by which the velocity is multiplied when the ticker is hovered. Defaults to 1 (no change).
19
+ */
7
20
  hoverFactor?: number;
21
+ /**
22
+ * The gap between ticker items in pixels. Defaults to 10.
23
+ */
8
24
  gap?: number;
9
- align?: 'start' | 'center' | 'end';
25
+ /**
26
+ * Alignment of items within the ticker. Defaults to "center".
27
+ */
28
+ align?: 'start' | 'center' | 'end' | 'stretch';
29
+ /**
30
+ * An optional MotionValue to control the ticker's offset externally.
31
+ */
10
32
  offset?: MotionValue<number>;
33
+ /**
34
+ * The size of the ticker items. Defaults to "auto".
35
+ */
36
+ itemSize?: ItemSize;
37
+ /**
38
+ * Show items that overflow the container.
39
+ */
40
+ overflow?: boolean;
11
41
  }
12
42
  declare const _default: import('vue').DefineComponent<TickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TickerProps> & Readonly<{}>, {
13
43
  gap: number;
44
+ overflow: boolean;
14
45
  velocity: number;
15
46
  axis: "x" | "y";
47
+ itemSize: ItemSize;
16
48
  hoverFactor: number;
17
- align: "start" | "center" | "end";
49
+ align: "start" | "center" | "end" | "stretch";
18
50
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
51
  export default _default;
@@ -1,27 +1,38 @@
1
1
  import { MotionValue, motion } from 'motion-v';
2
- interface Props {
2
+ import { ItemSize } from './types';
3
+ export interface TickerItemProps {
3
4
  offset: MotionValue<number>;
4
5
  axis: 'x' | 'y';
5
6
  listSize: number;
6
- containerPaddingStart: number;
7
+ inset: number;
7
8
  bounds: {
8
9
  start: number;
9
10
  end: number;
10
11
  };
11
12
  itemIndex?: number;
12
13
  cloneIndex?: number;
14
+ alignItems: 'flex-start' | 'center' | 'flex-end' | 'stretch';
15
+ itemSize?: ItemSize;
13
16
  }
14
17
  declare const transform: MotionValue<number>;
18
+ declare const itemWrapperOffAxisSize: import('vue').ComputedRef<"100%" | "fit-content">;
19
+ declare const isClone: import('vue').ComputedRef<boolean>;
15
20
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
16
21
  declare var __VLS_6: {};
17
22
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
18
23
  default?: (props: typeof __VLS_6) => any;
19
24
  }>;
20
- declare const __VLS_self: import('vue').DefineComponent<Props, {
25
+ declare const __VLS_self: import('vue').DefineComponent<TickerItemProps, {
21
26
  motion: typeof motion;
22
27
  transform: typeof transform;
23
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
24
- declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
+ itemWrapperOffAxisSize: typeof itemWrapperOffAxisSize;
29
+ isClone: typeof isClone;
30
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TickerItemProps> & Readonly<{}>, {
31
+ itemSize: ItemSize;
32
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_component: import('vue').DefineComponent<TickerItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TickerItemProps> & Readonly<{}>, {
34
+ itemSize: ItemSize;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
25
36
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
26
37
  export default _default;
27
38
  type __VLS_WithSlots<T, S> = T & {
@@ -2,3 +2,7 @@ export declare const defaultBounds: {
2
2
  start: number;
3
3
  end: number;
4
4
  };
5
+ export declare const alignAlias: {
6
+ readonly start: "flex-start";
7
+ readonly end: "flex-end";
8
+ };
@@ -1,6 +1,9 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { TickerProps } from './Ticker';
3
3
  import { MotionProps } from 'motion-v';
4
+ export { default as TickerItem } from './TickerItem';
5
+ export type { TickerItemProps } from './TickerItem';
6
+ export type { ItemPosition, TickerState, ItemSize } from './types';
4
7
  export { useItemOffset } from './use-item-offset';
5
- export { useKeyboardFocus } from './use-keyboard-focus';
6
8
  export declare const Ticker: DefineComponent<MotionProps<"div"> & TickerProps>;
9
+ export type { TickerProps };
@@ -0,0 +1,11 @@
1
+ export interface ItemPosition {
2
+ start: number;
3
+ end: number;
4
+ }
5
+ export type ItemSize = 'auto' | 'fill';
6
+ export interface TickerState {
7
+ visibleLength: number;
8
+ inset: number;
9
+ totalItemLength: number;
10
+ itemPositions: ItemPosition[];
11
+ }
@@ -0,0 +1,3 @@
1
+ import { MotionValue } from 'motion-v';
2
+ import { Ref } from 'vue';
3
+ export declare function useFocusNavigation(containerRef: Ref<HTMLElement | null>, axis: Ref<'x' | 'y'>, focusOffset: MotionValue<number>, offset: Ref<MotionValue<number>>, setHasFocus: (hasFocus: boolean) => void): void;
@@ -0,0 +1,2 @@
1
+ import { ItemPosition } from '../types';
2
+ export declare function calcNumClones(visibleLength: number, itemPositions: ItemPosition[], gap: number): number;
@@ -0,0 +1,3 @@
1
+ import { ItemPosition } from '../types';
2
+ export declare function calcItemLength(itemPosition: ItemPosition): number;
3
+ export declare function calcTotalItemLength(itemPositions: ItemPosition[]): number;
@@ -0,0 +1 @@
1
+ export declare function getCumulativeOffset(element: HTMLElement, axis: 'x' | 'y'): number;
@@ -1,13 +1,16 @@
1
- import { defineComponent as oe, reactive as se, ref as re, computed as s, useSlots as le, watch as ue, createVNode as H, toRef as ce, createBlock as z, openBlock as p, unref as r, mergeProps as de, withCtx as O, normalizeStyle as fe, createElementBlock as _, Fragment as M, renderList as V, resolveDynamicComponent as K, isVNode as pe } from "vue";
2
- import { useMotionValue as y, useTransform as me, wrap as ge, useDomRef as W, useInView as Se, useReducedMotion as ve, resize as ze, useAnimationFrame as ye, motion as G, animate as J } from "motion-v";
1
+ import { defineComponent as le, reactive as re, computed as l, useSlots as ue, ref as fe, watch as ce, createVNode as W, toRef as me, createBlock as I, openBlock as m, unref as u, mergeProps as de, withCtx as _, normalizeStyle as ve, createElementBlock as O, Fragment as R, renderList as V, resolveDynamicComponent as E, isVNode as ge } from "vue";
2
+ import { useMotionValue as B, useTransform as pe, wrap as he, useDomRef as q, useInView as ye, usePageInView as xe, useReducedMotion as we, resize as G, useAnimationFrame as Ie, motion as J, animate as K } from "motion-v";
3
3
  import Q from "./TickerItem.vue.mjs";
4
- import { useKeyboardFocus as xe } from "./use-keyboard-focus.mjs";
5
- import { defaultBounds as U } from "./const.mjs";
6
- import { flattenSlots as Pe, renderVNode as X } from "../../utils/flatten-slots.mjs";
7
- function he(m) {
8
- return typeof m == "function" || Object.prototype.toString.call(m) === "[object Object]" && !pe(m);
4
+ import { useFocusNavigation as Le } from "./use-focus-navigation.mjs";
5
+ import { alignAlias as Se, defaultBounds as U } from "./const.mjs";
6
+ import { calcNumClones as Pe } from "./utils/calc-num-clones.mjs";
7
+ import { calcTotalItemLength as be } from "./utils/calc-total-item-length.mjs";
8
+ import { flattenSlots as ze, renderVNode as X } from "../../utils/flatten-slots.mjs";
9
+ import { getCumulativeOffset as ke } from "./utils/get-cumulative-offset.mjs";
10
+ function Ce(v) {
11
+ return typeof v == "function" || Object.prototype.toString.call(v) === "[object Object]" && !ge(v);
9
12
  }
10
- const Be = /* @__PURE__ */ oe({
13
+ const Ne = /* @__PURE__ */ le({
11
14
  __name: "Ticker",
12
15
  props: {
13
16
  axis: {
@@ -26,159 +29,155 @@ const Be = /* @__PURE__ */ oe({
26
29
  align: {
27
30
  default: "center"
28
31
  },
29
- offset: {}
32
+ offset: {},
33
+ itemSize: {
34
+ default: "auto"
35
+ },
36
+ overflow: {
37
+ type: Boolean,
38
+ default: !1
39
+ }
30
40
  },
31
- setup(m) {
32
- const i = m, e = se({
33
- listSize: 0,
34
- containerSize: 0,
35
- containerPaddingStart: 0,
36
- containerPaddingEnd: 0,
37
- itemSizes: []
38
- }), x = re(!1), P = y(1), E = y(0), g = s(() => i.offset ?? E), h = y(0);
39
- me(() => (h.set(ge(-e.listSize - i.gap - e.containerPaddingStart, -e.containerPaddingStart, g.value.get())), h.get()));
40
- const k = y(0), v = s(() => x.value ? k : h), Y = s(() => i.align === "start" ? "flex-start" : i.align === "center" ? "center" : "flex-end"), l = W(), w = W(), C = Se(l, {
41
+ setup(v) {
42
+ const e = v, t = re({
43
+ visibleLength: 0,
44
+ inset: 0,
45
+ totalItemLength: 0,
46
+ itemPositions: []
47
+ }), L = l(() => Se[e.align] || e.align), S = ue(), P = l(() => {
48
+ var n;
49
+ return ze((n = S.default) == null ? void 0 : n.call(S));
50
+ }), F = fe(!1), b = B(1), M = B(0), g = l(() => e.offset ?? M), Y = pe(() => he(-t.totalItemLength - e.gap - t.inset, -t.inset, g.value.get())), T = B(0), h = l(() => F.value ? T : Y), f = q(), z = q(), Z = ye(f, {
41
51
  margin: "100px"
42
- }), Z = ve();
43
- function $() {
44
- if (!l.value || !w.value) return;
45
- const {
46
- axis: n
47
- } = i, t = n === "x" ? "offsetWidth" : "offsetHeight", a = n === "x" ? "offsetLeft" : "offsetTop", o = n === "x" ? "paddingLeft" : "paddingTop", d = n === "x" ? "paddingRight" : "paddingBottom", u = l.value, S = w.value.querySelectorAll(".ticker-item");
48
- if (!S.length) return;
49
- let D = !1;
50
- const f = [];
51
- for (let c = 0; c < S.length; c++) {
52
- const F = S[c];
53
- f.push({
54
- start: F[a],
55
- end: F[a] + F[t]
56
- }), (!e.itemSizes[c] || f[c].start !== e.itemSizes[c].start || f[c].end !== e.itemSizes[c].end) && (D = !0);
52
+ }), ee = xe(), y = l(() => Z.value && ee.value), te = we();
53
+ function k() {
54
+ if (!f.value || !z.value) return;
55
+ const n = e.axis === "x" ? "innerWidth" : "innerHeight", o = e.axis === "x" ? "offsetWidth" : "offsetHeight", i = e.axis === "x" ? "offsetLeft" : "offsetTop", s = e.axis === "x" ? "paddingLeft" : "paddingTop", a = f.value, c = z.value.querySelectorAll(".ticker-item");
56
+ if (!c.length) return;
57
+ let w = !1;
58
+ const p = [];
59
+ for (let r = 0; r < c.length; r++) {
60
+ const C = c[r];
61
+ p.push({
62
+ start: C[i],
63
+ end: C[i] + C[o]
64
+ }), (!t.itemPositions[r] || p[r].start !== t.itemPositions[r].start || p[r].end !== t.itemPositions[r].end) && (w = !0);
57
65
  }
58
- const N = u[t], A = f[f.length - 1].end - f[0].start, q = window.getComputedStyle(u), ie = parseInt(q[o] ?? 0), ae = parseInt(q[d] ?? 0);
59
- (A !== e.listSize || N !== e.containerSize || D) && (e.listSize = A, e.containerSize = N, e.containerPaddingStart = ie, e.containerPaddingEnd = ae, e.itemSizes = f);
66
+ const A = e.overflow ? window[n] : Math.min(a[o], window[n]), D = be(p), se = window.getComputedStyle(a), ae = parseInt(se[s] ?? "0"), H = e.overflow ? ke(c[0], e.axis) : ae;
67
+ (A !== t.visibleLength || D !== t.totalItemLength || H !== t.inset || w) && (t.visibleLength = A, t.itemPositions = p, t.totalItemLength = D, t.inset = H);
60
68
  }
61
- const I = le(), R = s(() => {
62
- var n;
63
- return Pe((n = I.default) == null ? void 0 : n.call(I));
64
- });
65
- ue([R, C, l], (n, t, a) => {
66
- if (!C.value || !l.value) return;
67
- $();
68
- const o = ze(l.value, $);
69
- a(o);
69
+ ce([P, y], (n, o, i) => {
70
+ if (!y.value || !f.value) return;
71
+ k();
72
+ const s = e.overflow ? G(k) : void 0, a = G(f.value, k);
73
+ i(() => {
74
+ s == null || s(), a();
75
+ });
70
76
  }, {
71
77
  immediate: !0,
72
- flush: "sync"
78
+ flush: "post"
73
79
  });
74
- const b = s(() => e.containerSize > 0 && e.listSize > 0);
75
- ye((n, t) => {
76
- if (b.value && C.value && g.value === E && !Z.value) {
77
- const a = t / 1e3 * (i.velocity * P.get());
78
- g.value.set(g.value.get() - a);
80
+ const x = l(() => t.totalItemLength > 0);
81
+ Ie((n, o) => {
82
+ if (x.value && y.value && g.value === M && !te.value) {
83
+ const i = o / 1e3 * (e.velocity * b.get());
84
+ g.value.set(g.value.get() - i);
79
85
  }
80
86
  });
81
- const T = s(() => {
82
- let n = 0;
83
- if (!b.value || !e.containerSize) return 0;
84
- let t = 0;
85
- const a = Math.max(...e.itemSizes.map((o) => o.end - o.start));
86
- for (; t < e.containerSize + e.containerPaddingStart; )
87
- t = (e.listSize + i.gap) * (n + 1) - a, n++;
88
- return Math.max(n - 1, 0);
89
- }), j = s(() => e.listSize === 0 ? 0 : (e.listSize + i.gap) * (T.value + 1)), ee = s(() => {
87
+ const $ = l(() => !x.value || !t.visibleLength ? 0 : Pe(t.visibleLength, t.itemPositions, e.gap)), N = l(() => t.totalItemLength === 0 ? 0 : (t.totalItemLength + e.gap) * ($.value + 1)), ne = l(() => {
90
88
  const n = [];
91
- for (let t = 0; t < T.value; t++)
92
- R.value.forEach((a, o) => {
93
- let d;
94
- const u = e.itemSizes[o], B = (e.listSize + i.gap) * (t + 1), S = u ? {
95
- start: u.start + B,
96
- end: u.end + B
89
+ for (let o = 0; o < $.value; o++)
90
+ P.value.forEach((i, s) => {
91
+ let a;
92
+ const d = t.itemPositions[s], c = (t.totalItemLength + e.gap) * (o + 1), w = d ? {
93
+ start: d.start + c,
94
+ end: d.end + c
97
95
  } : U;
98
- n.push(H(Q, {
99
- key: `clone-${t}-${o}`,
100
- offset: v.value,
101
- axis: i.axis,
102
- listSize: j.value,
103
- cloneIndex: o,
104
- bounds: S,
105
- containerPaddingStart: e.containerPaddingStart
106
- }, he(d = X([a])) ? d : {
107
- default: () => [d]
96
+ n.push(W(Q, {
97
+ key: `clone-${o}-${s}`,
98
+ offset: h.value,
99
+ axis: e.axis,
100
+ listSize: N.value,
101
+ cloneIndex: s,
102
+ bounds: w,
103
+ inset: t.inset,
104
+ alignItems: L.value,
105
+ itemSize: e.itemSize
106
+ }, Ce(a = X([i])) ? a : {
107
+ default: () => [a]
108
108
  }));
109
109
  });
110
110
  return n;
111
- }), L = ce(i, "axis");
112
- xe(l, L, k);
113
- const te = {
111
+ }), j = me(e, "axis");
112
+ Le(f, j, T, g, (n) => {
113
+ F.value = n;
114
+ });
115
+ const oe = {
114
116
  display: "flex",
115
- position: "relative",
116
- overflow: "hidden"
117
- }, ne = s(() => ({
117
+ position: "relative"
118
+ }, ie = l(() => ({
118
119
  display: "flex",
119
120
  position: "relative",
120
- willChange: "transform",
121
+ willChange: x.value && y.value ? "transform" : void 0,
121
122
  listStyleType: "none",
122
123
  padding: 0,
123
124
  margin: 0,
124
125
  justifyContent: "flex-start",
125
- flexDirection: i.axis === "x" ? "row" : "column",
126
- gap: `${i.gap}px`,
127
- alignItems: Y.value,
128
- x: i.axis === "x" ? v.value : 0,
129
- y: i.axis === "y" ? v.value : 0,
130
- opacity: b.value ? 1 : 0
126
+ flexDirection: e.axis === "x" ? "row" : "column",
127
+ gap: `${e.gap}px`,
128
+ alignItems: L.value,
129
+ x: e.axis === "x" ? h.value : 0,
130
+ y: e.axis === "y" ? h.value : 0,
131
+ opacity: x.value ? 1 : 0,
132
+ width: "100%",
133
+ height: "100%",
134
+ maxHeight: "100%",
135
+ maxWidth: "100%"
131
136
  }));
132
- return (n, t) => (p(), z(r(G).div, de({
133
- ...n.$attrs
134
- }, {
137
+ return (n, o) => (m(), I(u(J).div, de(n.$attrs, {
135
138
  ref_key: "containerRef",
136
- ref: l,
137
- "data-size": e.listSize,
139
+ ref: f,
138
140
  style: {
139
- ...te,
140
- ...i.style
141
+ ...oe,
142
+ ...e.style,
143
+ overflow: e.overflow ? "visible" : "hidden"
141
144
  },
142
- onFocusCapture: t[0] || (t[0] = () => {
143
- x.value = !0;
144
- }),
145
- onBlurCapture: t[1] || (t[1] = () => {
146
- x.value = !1, g.value.set(r(k).get());
147
- }),
148
- onPointerenter: t[2] || (t[2] = () => {
149
- r(J)(r(P), n.hoverFactor);
145
+ onPointerenter: o[0] || (o[0] = () => {
146
+ u(K)(u(b), n.hoverFactor);
150
147
  }),
151
- onPointerleave: t[3] || (t[3] = () => {
152
- r(J)(r(P), 1);
148
+ onPointerleave: o[1] || (o[1] = () => {
149
+ u(K)(u(b), 1);
153
150
  })
154
151
  }), {
155
- default: O(() => [H(r(G).ul, {
152
+ default: _(() => [W(u(J).ul, {
156
153
  ref_key: "listRef",
157
- ref: w,
158
- style: fe(ne.value)
154
+ ref: z,
155
+ style: ve(ie.value)
159
156
  }, {
160
- default: O(() => [(p(!0), _(M, null, V(R.value, (a, o) => (p(), z(Q, {
161
- key: `original-${o}`,
162
- axis: L.value,
163
- offset: v.value,
164
- "list-size": j.value,
165
- "item-index": o,
166
- bounds: e.itemSizes[o] ?? r(U),
167
- "container-padding-start": e.containerPaddingStart
157
+ default: _(() => [(m(!0), O(R, null, V(P.value, (i, s) => (m(), I(Q, {
158
+ key: `original-${s}`,
159
+ axis: j.value,
160
+ offset: h.value,
161
+ "list-size": N.value,
162
+ "item-index": s,
163
+ bounds: t.itemPositions[s] ?? u(U),
164
+ inset: t.inset,
165
+ "align-items": L.value,
166
+ "item-size": n.itemSize
168
167
  }, {
169
- default: O(() => [(p(!0), _(M, null, V(r(X)([a]), (d, u) => (p(), z(K(d), {
170
- key: u
168
+ default: _(() => [(m(!0), O(R, null, V(u(X)([i]), (a, d) => (m(), I(E(a), {
169
+ key: d
171
170
  }))), 128))]),
172
171
  _: 2
173
- }, 1032, ["axis", "offset", "list-size", "item-index", "bounds", "container-padding-start"]))), 128)), (p(!0), _(M, null, V(ee.value, (a) => (p(), z(K(a), {
174
- key: a.key
172
+ }, 1032, ["axis", "offset", "list-size", "item-index", "bounds", "inset", "align-items", "item-size"]))), 128)), (m(!0), O(R, null, V(ne.value, (i) => (m(), I(E(i), {
173
+ key: i.key
175
174
  }))), 128))]),
176
175
  _: 1
177
176
  }, 8, ["style"])]),
178
177
  _: 1
179
- }, 16, ["data-size", "style"]));
178
+ }, 16, ["style"]));
180
179
  }
181
180
  });
182
181
  export {
183
- Be as default
182
+ Ne as default
184
183
  };
@@ -1,46 +1,52 @@
1
- import { defineComponent as p, createBlock as x, openBlock as S, unref as i, mergeProps as g, withCtx as k, renderSlot as I } from "vue";
2
- import { useMotionValue as a, useTransform as d, motion as h } from "motion-v";
3
- import { provideTickerItemContext as v } from "./context.mjs";
4
- const b = /* @__PURE__ */ p({
1
+ import { defineComponent as c, computed as f, createBlock as p, openBlock as x, unref as n, mergeProps as v, withCtx as S, renderSlot as h } from "vue";
2
+ import { useTransform as l, motion as z } from "motion-v";
3
+ import { provideTickerItemContext as I } from "./context.mjs";
4
+ const C = /* @__PURE__ */ c({
5
5
  __name: "TickerItem",
6
6
  props: {
7
7
  offset: {},
8
8
  axis: {},
9
9
  listSize: {},
10
- containerPaddingStart: {},
10
+ inset: {},
11
11
  bounds: {},
12
12
  itemIndex: {},
13
- cloneIndex: {}
13
+ cloneIndex: {},
14
+ alignItems: {},
15
+ itemSize: { default: "auto" }
14
16
  },
15
- setup(c) {
16
- const t = c, r = a(0);
17
- d(() => {
18
- const e = t.offset.get(), { start: n, end: s } = t.bounds;
19
- return !n && !s || !t.listSize ? r.set(0) : e + s <= -t.containerPaddingStart ? r.set(t.listSize) : r.set(0);
20
- });
21
- const o = a(0);
22
- return d(() => {
23
- const { offset: e, listSize: n, bounds: s } = t, { start: f, end: l } = s, u = e.get(), m = r.get();
24
- return !f && !l || !n ? o.set(0) : o.set(u + f + m);
25
- }), v({
26
- offset: o
27
- }), (e, n) => (S(), x(i(h).li, g(e.$attrs, {
17
+ setup(a) {
18
+ const t = a, o = l(() => {
19
+ const e = t.offset.get(), { start: i, end: s } = t.bounds;
20
+ return !i && !s || !t.listSize ? 0 : e + s <= -t.inset ? t.listSize : 0;
21
+ }), d = l(() => {
22
+ const { start: e, end: i } = t.bounds, s = t.offset.get(), u = o.get();
23
+ return !e && !i || !t.listSize ? 0 : s + e + u;
24
+ }), r = f(
25
+ () => t.alignItems === "stretch" ? "100%" : "fit-content"
26
+ ), m = f(() => t.cloneIndex !== void 0);
27
+ return I({
28
+ offset: d
29
+ }), (e, i) => (x(), p(n(z).li, v(e.$attrs, {
28
30
  class: e.cloneIndex === void 0 ? "ticker-item" : "clone-item",
29
- "aria-hidden": e.cloneIndex !== void 0 ? !0 : void 0,
31
+ "aria-hidden": m.value ? !0 : void 0,
30
32
  style: {
31
- flexShrink: 0,
32
33
  flexGrow: 0,
33
- x: e.axis === "x" ? i(r) : 0,
34
- y: e.axis === "y" ? i(r) : 0
34
+ flexShrink: 0,
35
+ flexBasis: e.itemSize === "fill" ? "100%" : void 0,
36
+ display: e.itemSize === "fill" ? "flex" : void 0,
37
+ height: e.axis === "x" ? r.value : void 0,
38
+ width: e.axis === "y" ? r.value : void 0,
39
+ x: e.axis === "x" ? n(o) : 0,
40
+ y: e.axis === "y" ? n(o) : 0
35
41
  }
36
42
  }), {
37
- default: k(() => [
38
- I(e.$slots, "default")
43
+ default: S(() => [
44
+ h(e.$slots, "default")
39
45
  ]),
40
46
  _: 3
41
47
  }, 16, ["class", "aria-hidden", "style"]));
42
48
  }
43
49
  });
44
50
  export {
45
- b as default
51
+ C as default
46
52
  };
@@ -1,4 +1,8 @@
1
- const t = { start: 0, end: 0 };
1
+ const t = { start: 0, end: 0 }, e = {
2
+ start: "flex-start",
3
+ end: "flex-end"
4
+ };
2
5
  export {
6
+ e as alignAlias,
3
7
  t as defaultBounds
4
8
  };
@@ -0,0 +1,108 @@
1
+ import { isHTMLElement as b, wrap as D } from "motion-v";
2
+ import { watch as N, nextTick as S } from "vue";
3
+ function j(s, r, w, k, v) {
4
+ let a = !1;
5
+ N(s, (t, U, A) => {
6
+ if (!t)
7
+ return;
8
+ let l = !1;
9
+ const x = new AbortController(), i = {
10
+ signal: x.signal
11
+ }, m = {
12
+ ...i,
13
+ capture: !0
14
+ }, T = r.value === "x" ? "scrollLeft" : "scrollTop", I = r.value === "x" ? "offsetLeft" : "offsetTop", F = r.value === "x" ? "ArrowLeft" : "ArrowUp", C = r.value === "x" ? "ArrowRight" : "ArrowDown";
15
+ let c = [], o = 0;
16
+ const E = async () => {
17
+ const e = c[o];
18
+ e.focus(), await S(), w.set(-e[I]), t[T] = 0;
19
+ }, g = (e) => {
20
+ if (e.key === "Tab") {
21
+ e.preventDefault(), p();
22
+ const n = Array.from(
23
+ document.querySelectorAll(
24
+ 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]'
25
+ )
26
+ ).filter(b);
27
+ n.sort(R);
28
+ const u = n[e.shiftKey ? 0 : n.length - 1], M = e.shiftKey ? n.length - 1 : 0;
29
+ if (t.contains(u)) {
30
+ n[M].focus();
31
+ return;
32
+ } else {
33
+ const P = n.indexOf(
34
+ c[o]
35
+ ), q = e.shiftKey ? -1 : 1;
36
+ for (let f = P; f < n.length && f >= 0; f += q) {
37
+ const L = n[f];
38
+ if (!t.contains(L)) {
39
+ L.focus();
40
+ return;
41
+ }
42
+ }
43
+ }
44
+ return;
45
+ } else e.key === F ? o-- : e.key === C && o++;
46
+ o = D(0, c.length, o), E();
47
+ }, K = () => {
48
+ a || (v(!0), a = !0, c = Array.from(
49
+ t.querySelectorAll(
50
+ '.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex="-1"]), .ticker-item [contenteditable="true"]'
51
+ )
52
+ ).filter(b), o = 0, E(), window.addEventListener(
53
+ "focus",
54
+ d,
55
+ m
56
+ ), window.addEventListener(
57
+ "blur",
58
+ d,
59
+ m
60
+ ), t.addEventListener(
61
+ "keydown",
62
+ g,
63
+ i
64
+ ));
65
+ }, d = (e) => {
66
+ (!e.target || !(e.target instanceof HTMLElement) || !t.contains(e.target)) && p();
67
+ }, p = () => {
68
+ a && (a = !1, v(!1), k.value.set(w.get()), window.removeEventListener("focus", d), window.removeEventListener("blur", d), t.removeEventListener("keydown", g));
69
+ }, h = (e) => {
70
+ const { target: n } = e;
71
+ b(n) && (a || K());
72
+ }, O = () => {
73
+ l || (l = !0, t.addEventListener(
74
+ "focus",
75
+ h,
76
+ m
77
+ ), window.addEventListener(
78
+ "pointermove",
79
+ y,
80
+ i
81
+ ));
82
+ }, y = () => {
83
+ l && (l = !1, t.removeEventListener("focus", h, !0), window.removeEventListener(
84
+ "pointermove",
85
+ y,
86
+ i
87
+ ));
88
+ }, H = (e) => {
89
+ const u = e.target.closest('[aria-hidden="true"]');
90
+ u && u.removeAttribute("aria-hidden");
91
+ };
92
+ window.addEventListener("keydown", O, i), t.addEventListener(
93
+ "pointerdown",
94
+ H,
95
+ i
96
+ ), A(() => {
97
+ x.abort(), p();
98
+ });
99
+ }, {
100
+ flush: "post"
101
+ });
102
+ }
103
+ function R(s, r) {
104
+ return s.tabIndex >= 1 && r.tabIndex >= 1 ? s.tabIndex - r.tabIndex : s.tabIndex >= 1 && r.tabIndex <= 0 ? -1 : r.tabIndex >= 1 && s.tabIndex <= 0 ? 1 : 0;
105
+ }
106
+ export {
107
+ j as useFocusNavigation
108
+ };
@@ -0,0 +1,11 @@
1
+ import { calcTotalItemLength as h, calcItemLength as o } from "./calc-total-item-length.mjs";
2
+ function r(l, e, n) {
3
+ const c = h(e), m = Math.max(...e.map(o));
4
+ let t = 0, a = 0;
5
+ for (; a < l; )
6
+ a = (c + n) * (t + 1) - m, t++;
7
+ return Math.max(t - 1, 0);
8
+ }
9
+ export {
10
+ r as calcNumClones
11
+ };
@@ -0,0 +1,10 @@
1
+ function r(n) {
2
+ return n.end - n.start;
3
+ }
4
+ function t(n) {
5
+ return n.length ? n[n.length - 1].end - n[0].start : 0;
6
+ }
7
+ export {
8
+ r as calcItemLength,
9
+ t as calcTotalItemLength
10
+ };
@@ -0,0 +1,9 @@
1
+ function l(f, o) {
2
+ let t = 0, e = f;
3
+ for (; e; )
4
+ t += o === "x" ? e.offsetLeft : e.offsetTop, e = e.offsetParent;
5
+ return t;
6
+ }
7
+ export {
8
+ l as getCumulativeOffset
9
+ };
package/dist/es/index.mjs CHANGED
@@ -1,20 +1,20 @@
1
1
  import { AnimateNumber as o } from "./components/AnimateNumber/index.mjs";
2
- import { Ticker as s } from "./components/Ticker/index.mjs";
3
- import { default as f } from "./components/Cursor/Cursor.vue.mjs";
4
- import { useCursorState as p } from "./components/Cursor/hooks/use-cursor-state/index.mjs";
5
- import { useCursorIsInView as i } from "./components/Cursor/hooks/use-cursor-in-view.mjs";
6
- import { usePointerPosition as n } from "./components/Cursor/hooks/use-pointer-position.mjs";
7
- import { useMagneticPull as l } from "./components/Cursor/magnetic/use-magnetic-pull.mjs";
8
- import { useItemOffset as I } from "./components/Ticker/use-item-offset.mjs";
9
- import { useKeyboardFocus as b } from "./components/Ticker/use-keyboard-focus.mjs";
2
+ import { Ticker as f } from "./components/Ticker/index.mjs";
3
+ import { default as s } from "./components/Cursor/Cursor.vue.mjs";
4
+ import { default as p } from "./components/Ticker/TickerItem.vue.mjs";
5
+ import { useCursorState as i } from "./components/Cursor/hooks/use-cursor-state/index.mjs";
6
+ import { useCursorIsInView as n } from "./components/Cursor/hooks/use-cursor-in-view.mjs";
7
+ import { usePointerPosition as I } from "./components/Cursor/hooks/use-pointer-position.mjs";
8
+ import { useMagneticPull as C } from "./components/Cursor/magnetic/use-magnetic-pull.mjs";
9
+ import { useItemOffset as d } from "./components/Ticker/use-item-offset.mjs";
10
10
  export {
11
11
  o as AnimateNumber,
12
- f as Cursor,
13
- s as Ticker,
14
- i as useCursorIsInView,
15
- p as useCursorState,
16
- I as useItemOffset,
17
- b as useKeyboardFocus,
18
- l as useMagneticPull,
19
- n as usePointerPosition
12
+ s as Cursor,
13
+ f as Ticker,
14
+ p as TickerItem,
15
+ n as useCursorIsInView,
16
+ i as useCursorState,
17
+ d as useItemOffset,
18
+ C as useMagneticPull,
19
+ I as usePointerPosition
20
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-plus-vue",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Motion Plus Vue",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -25,13 +25,9 @@
25
25
  ],
26
26
  "typings": "./dist/index.d.ts",
27
27
  "peerDependencies": {
28
- "motion-v": ">=1.2.0",
28
+ "motion-v": "^1.5.0",
29
29
  "vue": ">=3.0.0"
30
30
  },
31
- "devDependencies": {
32
- "motion-v": "^1.2.0",
33
- "vue": "^3.5.13"
34
- },
35
31
  "size-limit": [
36
32
  {
37
33
  "path": "dist/es/components/AnimateNumber/index.mjs",
@@ -1,3 +0,0 @@
1
- import { MotionValue } from 'motion-v';
2
- import { Ref } from 'vue';
3
- export declare function useKeyboardFocus(containerRef: Ref<HTMLElement | null>, axis: Ref<'x' | 'y'>, focusOffset: MotionValue<number>): void;
@@ -1,68 +0,0 @@
1
- import { isHTMLElement as f, frame as F, wrap as T } from "motion-v";
2
- import { onMounted as A, onUnmounted as K } from "vue";
3
- function D(s, r, w) {
4
- let i = !1;
5
- A(() => {
6
- const t = s.value;
7
- if (!t)
8
- return;
9
- const d = r.value === "x" ? "scrollLeft" : "scrollTop", y = r.value === "x" ? "offsetLeft" : "offsetTop", E = r.value === "x" ? "ArrowLeft" : "ArrowUp", L = r.value === "x" ? "ArrowRight" : "ArrowDown";
10
- let c = [], o = 0;
11
- const m = () => {
12
- const e = c[o];
13
- e.focus(), w.set(-e[y]), t[d] = 0, F.render(() => {
14
- t[d] = 0;
15
- });
16
- }, b = (e) => {
17
- if (e.key === "Tab") {
18
- e.preventDefault(), u();
19
- const n = Array.from(
20
- document.querySelectorAll(
21
- 'a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]'
22
- )
23
- ).filter(f);
24
- n.sort(M);
25
- const g = n[e.shiftKey ? 0 : n.length - 1], h = e.shiftKey ? n.length - 1 : 0;
26
- if (t.contains(g)) {
27
- n[h].focus();
28
- return;
29
- } else {
30
- const v = n.indexOf(
31
- c[o]
32
- ), I = e.shiftKey ? -1 : 1;
33
- for (let l = v; l < n.length && l >= 0; l += I) {
34
- const p = n[l];
35
- if (!t.contains(p)) {
36
- p.focus();
37
- return;
38
- }
39
- }
40
- }
41
- return;
42
- } else e.key === E ? o-- : e.key === L && o++;
43
- o = T(0, c.length, o), m();
44
- }, k = () => {
45
- i || (i = !0, c = Array.from(
46
- t.querySelectorAll(
47
- '.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex="-1"]), .ticker-item [contenteditable="true"]'
48
- )
49
- ).filter(f), o = 0, m(), window.addEventListener("focus", a, !0), window.addEventListener("blur", a, !0), t.addEventListener("keydown", b));
50
- }, a = (e) => {
51
- (!e.target || !(e.target instanceof HTMLElement) || !t.contains(e.target)) && u();
52
- }, u = () => {
53
- i && (i = !1, window.removeEventListener("focus", a, !0), window.removeEventListener("blur", a, !0), t.removeEventListener("keydown", b));
54
- }, x = (e) => {
55
- const { target: n } = e;
56
- f(n) && (i || k());
57
- };
58
- t.addEventListener("focus", x, !0), K(() => {
59
- t.removeEventListener("focus", x), u();
60
- });
61
- });
62
- }
63
- function M(s, r) {
64
- return s.tabIndex >= 1 && r.tabIndex >= 1 ? s.tabIndex - r.tabIndex : s.tabIndex >= 1 && r.tabIndex <= 0 ? -1 : r.tabIndex >= 1 && s.tabIndex <= 0 ? 1 : 0;
65
- }
66
- export {
67
- D as useKeyboardFocus
68
- };