motion-plus-vue 1.7.0 → 1.8.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 +2 -2
- package/dist/components/AnimateNumber/AnimateNumber.d.ts +2 -0
- package/dist/components/AnimateNumber/NumberSection.d.ts +1 -0
- package/dist/components/AnimateNumber/types.d.ts +1 -0
- package/dist/es/components/AnimateNumber/AnimateNumber.vue.mjs +58 -47
- package/dist/es/components/AnimateNumber/NumberDigit.vue.mjs +78 -59
- package/dist/es/components/AnimateNumber/NumberSection.vue.mjs +19 -17
- package/package.json +10 -2
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"),i=require("motion-v"),Y=require("motion-plus-dom");function rt(o,{locales:t,format:n},a,s){const c=new Intl.NumberFormat(t,n).formatToParts(Number(o));a&&c.unshift({type:"prefix",value:a}),s&&c.push({type:"suffix",value:s});const l=[],p=[],y=[],m=[],u={},f=v=>`${v}:${u[v]=(u[v]??-1)+1}`;let d="",I=!1,x=!1,g=0;for(const v of c){d+=v.value;const h=v.type==="minusSign"||v.type==="plusSign"?"sign":v.type;switch(h){case"integer":I=!0,p.push(...v.value.split("").map(L=>({type:h,value:parseInt(L)})));break;case"group":p.push({type:h,value:v.value});break;case"decimal":x=!0,y.push({type:h,value:v.value,key:f(h),originalIndex:g++});break;case"fraction":y.push(...v.value.split("").map(L=>({type:h,value:parseInt(L),key:f(h),originalIndex:g++})));break;default:(I||x?m:l).push({type:h,value:v.value,key:f(h),originalIndex:g++})}}const w=[];for(let v=p.length-1;v>=0;v--){const h=f(p[v].type);w.unshift({...p[v],key:h,originalIndex:v})}return{pre:l,integer:w,fraction:y,post:m,formatted:d}}const[it,st]=i.createContext("SectionContext");function Xe(){const o={current:!0};return e.onMounted(()=>{o.current=!1}),o}function ye(o){const{width:t,fontSize:n}=getComputedStyle(o);return`${parseFloat(t)/parseFloat(n)}em`}const _="var(--mask-height, 0.15em)",ve="var(--mask-width, 0.5em)",H=`calc(${ve} / var(--invert-x, 1))`,te="#000 0, transparent 71%",lt=`linear-gradient(to right, transparent 0, #000 ${H}, #000 calc(100% - ${H}), transparent),linear-gradient(to bottom, transparent 0, #000 ${_}, #000 calc(100% - ${_}), transparent 100%),radial-gradient(at bottom right, ${te}),radial-gradient(at bottom left, ${te}), radial-gradient(at top left, ${te}), radial-gradient(at top right, ${te})`,ut=`100% calc(100% - ${_} * 2),calc(100% - ${H} * 2) 100%,${H} ${_},${H} ${_},${H} ${_},${H} ${_}`;i.addScaleCorrector({"--invert-x":{correct:(o,{treeScale:t,projectionDelta:n})=>n.x.scale*t.x}});const $e={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function Ye(o){const t=e.ref();function n(s){t.value=s==null?void 0:s.$el}e.watch(()=>o.isPresent,s=>{var r;t.value&&((r=i.mountedStates.get(t.value))==null||r.setActive("exit",!s))});function a(s){var r;s.detail.isExit&&!o.isPresent&&((r=o.onRemove)==null||r.call(o,o.partKey,s.target))}return{root:t,getRoot:n,handleComplete:a}}const ct=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}=it(),{getRoot:a,handleComplete:s}=Ye(t);return(r,c)=>(e.openBlock(),e.createBlock(e.unref(i.motion).span,{ref:e.unref(a),layout:"position","layout-dependency":r.layoutDependency,"data-state":r.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(n),padding:`calc(${e.unref(_)}/2) 0`,position:"relative",pointerEvents:r.isPresent?void 0:"none"}),"aria-hidden":!r.isPresent,onMotioncomplete:e.unref(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(n),initial:r.preInitial},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(i.motion).span,{key:r.value,layout:e.unref(n)==="right"?"position":!1,"layout-dependency":r.layoutDependency,initial:{opacity:0,left:e.unref(n)==="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"]))}}),ft=new WeakMap,dt=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,a=Xe(),s=i.useMotionConfig(),r=e.ref(),c=e.ref(Array(10).fill(null)),l=e.ref(),{getRoot:p,handleComplete:y,root:m}=Ye(t);let u=n;const f=e.ref(n);e.watch([()=>t.value,()=>t.isPresent],([g,w])=>{if(!w)return f.value=0;if(a.current)return e.nextTick(()=>{f.value=g});f.value=g},{immediate:!0});function d(g){var L;if(!r.value||g===u)return;const w=r.value.getBoundingClientRect(),v=(L=m.value)==null?void 0:L.getBoundingClientRect(),h=w.height*(g-u)+(w.top-(v?v.top||0:w.top));i.animate(r.value,{y:[h,0]},s.value.transition)}function I(g){if(a.current&&n===g||!c.value[g])return;const w=ye(c.value[g]);m.value&&(ft.set(m.value,w),m.value.style.width=w),l.value=w}e.watch(f,g=>{I(g)},{immediate:!0,flush:"sync"}),e.watch(f,async(g,w,v)=>{await e.nextTick(),d(g),v(()=>{u=g})},{immediate:!0,flush:"sync"});function x(g){return()=>e.createVNode("span",{key:g,style:{display:"inline-block",padding:`calc(${_}/2) 0`},ref:w=>{c.value[g]=w}},[g])}return(g,w)=>(e.openBlock(),e.createBlock(e.unref(i.motion).span,{ref:e.unref(p),layout:"position","layout-dependency":g.layoutDependency,"data-state":g.isPresent?void 0:"exiting","data-key":g.partKey,style:e.normalizeStyle({display:"inline-flex",justifyContent:"center",width:l.value,pointerEvents:g.isPresent?void 0:"none"}),"aria-hidden":!g.isPresent,onMotioncomplete:e.unref(y)},{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($e),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,v=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(v-1)),{key:v-1}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(f.value)))),f.value!==9?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref($e),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(9-f.value,v=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x(f.value+v)),{key:f.value+v}))),128))],4)):e.createCommentVNode("",!0)],512)]),_:1},8,["layout-dependency","data-state","data-key","style","aria-hidden","onMotioncomplete"]))}}),ne=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{},layoutDependency:{}},setup(o){var m;const t=o,n=e.ref(),a=i.useDomRef(),s=e.ref(),r=Xe(),c=e.ref(t.parts);let l=t.name==="pre"&&!((m=t.parts)!=null&&m.length)?void 0:!1;e.watch(()=>t.parts,u=>{const f=new Map(u.map(x=>[x.key,{...x,isPresent:!0}])),d=c.value.filter(x=>!f.get(x.key)).map(x=>({...x,isPresent:!1})),I=u.sort((x,g)=>x.originalIndex-g.originalIndex);c.value=d.concat(I)},{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(),l=!1,!s.value)return;if(r.current){a.value&&(a.value.style.width=ye(s.value));return}const d=Array.from(s.value.children).map(x=>{if(x instanceof HTMLElement&&x.dataset.state==="exiting"){const g=x.nextSibling;return x.remove(),()=>{s.value&&s.value.insertBefore(x,g)}}}),I=ye(s.value);n.value=I;for(let x=d.length-1;x>=0;x--){const g=d[x];g&&g()}},{flush:"post"});const p=e.toRef(t,"justify");st({justify:p});function y(u,f){var d;c.value=c.value.filter(I=>I.key!==u),(d=f==null?void 0:f.parentElement)==null||d.removeChild(f)}return(u,f)=>(e.openBlock(),e.createBlock(e.unref(i.motion).span,{ref:e.unref(a),class:e.normalizeClass(`number-section-${u.name}`),style:e.normalizeStyle({...u.style,display:"inline-flex",justifyContent:p.value,width:n.value}),layout:"position","layout-dependency":u.layoutDependency},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:s,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[f[0]||(f[0]=e.createTextVNode(" ")),e.createVNode(e.unref(i.AnimatePresence),{mode:u.mode,"anchor-x":p.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[d.type==="integer"||d.type==="fraction"?(e.openBlock(),e.createBlock(dt,{key:d.key,"part-key":d.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:d.value,"is-present":d.isPresent??!0,"initial-value":e.unref(r).current?void 0:0,"layout-dependency":u.layoutDependency,onRemove:y},null,8,["part-key","value","is-present","initial-value","layout-dependency"])):(e.openBlock(),e.createBlock(ct,{key:d.type==="literal"?`${d.key}:${d.value}`:d.key,type:d.type,"part-key":d.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:d.value,"is-present":d.isPresent??!0,"pre-initial":e.unref(l),"layout-dependency":u.layoutDependency,onRemove:y},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"]))}}),pt=e.defineComponent({__name:"Mask",props:{layoutDependency:{}},setup(o){return(t,n)=>(e.openBlock(),e.createBlock(e.unref(i.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(ve)})`,padding:`calc(${e.unref(_)}/2) ${e.unref(ve)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(lt),webkitMaskSize:e.unref(ut),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"]))}}),mt=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:i.easeOut},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},n=o,a=e.computed(()=>{const p=n.value;return rt(p,{locales:n.locales,format:n.format},n.prefix,n.suffix)}),s=i.useMotionConfig(),r=e.computed(()=>n.transition??s.value.transition??t);function c(){const{format:p,prefix:y,suffix:m,locales:u,value:f,layoutDependency:d,...I}=n;return I}const l=e.computed(()=>{if(n.layoutDependency!==void 0)return{layoutDependency:n.layoutDependency,value:n.value}});return(p,y)=>(e.openBlock(),e.createBlock(e.unref(i.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.MotionConfig),{transition:r.value},{default:e.withCtx(()=>[e.createVNode(e.unref(i.motion).div,e.mergeProps({...p.$attrs,...c()},{layout:"","layout-dependency":l.value,style:{lineHeight:"1",...p.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(i.motion).div,{layout:"","layout-dependency":l.value,"aria-label":a.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(ne,{"layout-dependency":l.value,style:e.normalizeStyle({padding:`calc(${e.unref(_)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:a.value.pre,name:"pre"},null,8,["layout-dependency","style","parts"]),e.createVNode(pt,{"layout-dependency":l.value},{default:e.withCtx(()=>[e.createVNode(ne,{"layout-dependency":l.value,justify:"right",parts:a.value.integer,name:"integer",mode:"popLayout"},null,8,["layout-dependency","parts"]),e.createVNode(ne,{"layout-dependency":l.value,layout:"position",parts:a.value.fraction,name:"fraction",mode:"popLayout"},null,8,["layout-dependency","parts"])]),_:1},8,["layout-dependency"]),e.createVNode(ne,{"layout-dependency":l.value,style:e.normalizeStyle({padding:`calc(${e.unref(_)}/2) 0`}),"aria-hidden":!0,layout:"position",mode:"popLayout",parts:a.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}))}}),gt=mt;function yt(){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"),s=require("motion-v"),Y=require("motion-plus-dom");function rt(o,{locales:t,format:n},a,i){const c=new Intl.NumberFormat(t,n).formatToParts(Number(o));a&&c.unshift({type:"prefix",value:a}),i&&c.push({type:"suffix",value:i});const u=[],y=[],g=[],m=[],l={},p=w=>`${w}:${l[w]=(l[w]??-1)+1}`;let d="",k=!1,h=!1,b=0;for(const w of c){d+=w.value;const f=w.type==="minusSign"||w.type==="plusSign"?"sign":w.type;switch(f){case"integer":k=!0,y.push(...w.value.split("").map(x=>({type:f,value:parseInt(x)})));break;case"group":y.push({type:f,value:w.value});break;case"decimal":h=!0,g.push({type:f,value:w.value,key:p(f),originalIndex:b++});break;case"fraction":g.push(...w.value.split("").map(x=>({type:f,value:parseInt(x),key:p(f),originalIndex:b++})));break;default:(k||h?m:u).push({type:f,value:w.value,key:p(f),originalIndex:b++})}}const I=[];for(let w=y.length-1;w>=0;w--){const f=p(y[w].type);I.unshift({...y[w],key:f,originalIndex:w})}return{pre:u,integer:I,fraction:g,post:m,formatted:d}}const[it,st]=s.createContext("SectionContext");function Xe(){const o={current:!0};return e.onMounted(()=>{o.current=!1}),o}function ye(o){const{width:t,fontSize:n}=getComputedStyle(o);return`${parseFloat(t)/parseFloat(n)}em`}const _="var(--mask-height, 0.15em)",ve="var(--mask-width, 0.5em)",H=`calc(${ve} / var(--invert-x, 1))`,te="#000 0, transparent 71%",lt=`linear-gradient(to right, transparent 0, #000 ${H}, #000 calc(100% - ${H}), transparent),linear-gradient(to bottom, transparent 0, #000 ${_}, #000 calc(100% - ${_}), transparent 100%),radial-gradient(at bottom right, ${te}),radial-gradient(at bottom left, ${te}), radial-gradient(at top left, ${te}), radial-gradient(at top right, ${te})`,ut=`100% calc(100% - ${_} * 2),calc(100% - ${H} * 2) 100%,${H} ${_},${H} ${_},${H} ${_},${H} ${_}`;s.addScaleCorrector({"--invert-x":{correct:(o,{treeScale:t,projectionDelta:n})=>n.x.scale*t.x}});const $e={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"};function Ye(o){const t=e.ref();function n(i){t.value=i==null?void 0:i.$el}e.watch(()=>o.isPresent,i=>{var r;t.value&&((r=s.mountedStates.get(t.value))==null||r.setActive("exit",!i))});function a(i){var r;i.detail.isExit&&!o.isPresent&&((r=o.onRemove)==null||r.call(o,o.partKey,i.target))}return{root:t,getRoot:n,handleComplete:a}}const ct=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}=it(),{getRoot:a,handleComplete:i}=Ye(t);return(r,c)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{ref:e.unref(a),layout:"position","layout-dependency":r.layoutDependency,"data-state":r.isPresent?void 0:"exiting",style:e.normalizeStyle({display:"inline-flex",justifyContent:e.unref(n),padding:`calc(${e.unref(_)}/2) 0`,position:"relative",pointerEvents:r.isPresent?void 0:"none"}),"aria-hidden":!r.isPresent,onMotioncomplete:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref(s.AnimatePresence),{mode:"popLayout","anchor-x":e.unref(n),initial:r.preInitial},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(s.motion).span,{key:r.value,layout:e.unref(n)==="right"?"position":!1,"layout-dependency":r.layoutDependency,initial:{opacity:0,left:e.unref(n)==="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"]))}}),ft=new WeakMap,dt=e.defineComponent({__name:"NumberDigit",props:{value:{},initialValue:{default:void 0},isPresent:{type:Boolean},partKey:{},onRemove:{},style:{},layoutDependency:{},trend:{}},setup(o){const t=o;function n(f,x){return(f%x+x)%x}const a=t.initialValue??t.value,i=Xe(),r=s.useMotionConfig(),c=e.ref(),u=e.ref(Array(10).fill(null)),y=e.ref(),{getRoot:g,handleComplete:m,root:l}=Ye(t);let p=a;const d=e.ref(a);e.watch([()=>t.value,()=>t.isPresent],([f,x])=>{if(!x)return d.value=0;if(i.current)return e.nextTick(()=>{d.value=f});d.value=f},{immediate:!0});function k(f){var v;if(!c.value||f===p)return;const x=c.value.getBoundingClientRect(),S=(v=l.value)==null?void 0:v.getBoundingClientRect(),M=t.trend??0;let O=f-p;M>0&&f<p?O=10-p+f:M<0&&f>p&&(O=f-10-p);const R=x.height*O+(x.top-(S?S.top||0:x.top));s.animate(c.value,{y:[R,0]},r.value.transition)}function h(f){if(i.current&&a===f||!u.value[f])return;const x=ye(u.value[f]);l.value&&(ft.set(l.value,x),l.value.style.width=x),y.value=x}e.watch(d,f=>{h(f)},{immediate:!0,flush:"sync"}),e.watch(d,async(f,x,S)=>{await e.nextTick(),k(f),S(()=>{p=f})},{immediate:!0,flush:"sync"});function b(f){return()=>e.createVNode("span",{key:f,style:{display:"inline-block",padding:`calc(${_}/2) 0`},ref:x=>{u.value[f]=x}},[f])}const I=e.computed(()=>{const f=[];for(let x=9;x>=1;x--)f.push(n(d.value-x,10));return f}),w=e.computed(()=>{const f=[];for(let x=1;x<=9;x++)f.push(n(d.value+x,10));return f});return(f,x)=>(e.openBlock(),e.createBlock(e.unref(s.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:y.value,pointerEvents:f.isPresent?void 0:"none"}),"aria-hidden":!f.isPresent,onMotioncomplete:e.unref(m)},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"scope",ref:c,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"}},[I.value.length>0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({...e.unref($e),bottom:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,S=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(S)),{key:S}))),128))],4)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(d.value)))),w.value.length>0?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({...e.unref($e),top:"100%",left:0})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,S=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(S)),{key:S}))),128))],4)):e.createCommentVNode("",!0)],512)]),_:1},8,["layout-dependency","data-state","data-key","style","aria-hidden","onMotioncomplete"]))}}),ne=e.defineComponent({__name:"NumberSection",props:{parts:{},justify:{default:"left"},mode:{},name:{},style:{},layoutDependency:{},trend:{}},setup(o){var m;const t=o,n=e.ref(),a=s.useDomRef(),i=e.ref(),r=Xe(),c=e.ref(t.parts);let u=t.name==="pre"&&!((m=t.parts)!=null&&m.length)?void 0:!1;e.watch(()=>t.parts,l=>{const p=new Map(l.map(h=>[h.key,{...h,isPresent:!0}])),d=c.value.filter(h=>!p.get(h.key)).map(h=>({...h,isPresent:!1})),k=l.sort((h,b)=>h.originalIndex-b.originalIndex);c.value=d.concat(k)},{flush:"pre"}),e.watch(()=>{var l;return(l=t.parts)==null?void 0:l.map(p=>p.value).join("")},async(l,p)=>{if(await e.nextTick(),u=!1,!i.value)return;if(r.current){a.value&&(a.value.style.width=ye(i.value));return}const d=Array.from(i.value.children).map(h=>{if(h instanceof HTMLElement&&h.dataset.state==="exiting"){const b=h.nextSibling;return h.remove(),()=>{i.value&&i.value.insertBefore(h,b)}}}),k=ye(i.value);n.value=k;for(let h=d.length-1;h>=0;h--){const b=d[h];b&&b()}},{flush:"post"});const y=e.toRef(t,"justify");st({justify:y});function g(l,p){var d;c.value=c.value.filter(k=>k.key!==l),(d=p==null?void 0:p.parentElement)==null||d.removeChild(p)}return(l,p)=>(e.openBlock(),e.createBlock(e.unref(s.motion).span,{ref:e.unref(a),class:e.normalizeClass(`number-section-${l.name}`),style:e.normalizeStyle({...l.style,display:"inline-flex",justifyContent:y.value,width:n.value}),layout:"position","layout-dependency":l.layoutDependency},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"measuredRef",ref:i,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"}},[p[0]||(p[0]=e.createTextVNode(" ")),e.createVNode(e.unref(s.AnimatePresence),{mode:l.mode,"anchor-x":y.value,initial:!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[d.type==="integer"||d.type==="fraction"?(e.openBlock(),e.createBlock(dt,{key:d.key,"part-key":d.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:d.value,"is-present":d.isPresent??!0,"initial-value":e.unref(r).current?void 0:0,"layout-dependency":l.layoutDependency,trend:l.trend,onRemove:g},null,8,["part-key","value","is-present","initial-value","layout-dependency","trend"])):(e.openBlock(),e.createBlock(ct,{key:d.type==="literal"?`${d.key}:${d.value}`:d.key,type:d.type,"part-key":d.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:d.value,"is-present":d.isPresent??!0,"pre-initial":e.unref(u),"layout-dependency":l.layoutDependency,onRemove:g},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"]))}}),pt=e.defineComponent({__name:"Mask",props:{layoutDependency:{}},setup(o){return(t,n)=>(e.openBlock(),e.createBlock(e.unref(s.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(ve)})`,padding:`calc(${e.unref(_)}/2) ${e.unref(ve)}`,position:"relative",zIndex:-1,overflow:"clip",webkitMaskImage:e.unref(lt),webkitMaskSize:e.unref(ut),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"]))}}),mt=e.defineComponent({name:"AnimateNumber",inheritAttrs:!1,__name:"AnimateNumber",props:{locales:{},format:{},transition:{},suffix:{},prefix:{},value:{},style:{},layoutDependency:{},trend:{type:[Number,Function]}},setup(o){const t={opacity:{duration:1,ease:s.easeOut},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},n=o,a=e.computed(()=>{const m=n.value;return rt(m,{locales:n.locales,format:n.format},n.prefix,n.suffix)});let i=typeof n.value=="string"?Number.parseFloat(n.value):Number(n.value??0);const r=e.computed(()=>{const m=typeof n.value=="string"?Number.parseFloat(n.value):Number(n.value??0),l=n.trend;let p;return typeof l=="function"?p=l(i,m):l!==void 0?p=l:p=Math.sign(m-i),i=m,p}),c=s.useMotionConfig(),u=e.computed(()=>n.transition??c.value.transition??t);function y(){const{format:m,prefix:l,suffix:p,locales:d,value:k,layoutDependency:h,trend:b,...I}=n;return I}const g=e.computed(()=>{if(n.layoutDependency!==void 0)return{layoutDependency:n.layoutDependency,value:n.value}});return(m,l)=>(e.openBlock(),e.createBlock(e.unref(s.LayoutGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(s.MotionConfig),{transition:u.value},{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).div,e.mergeProps({...m.$attrs,...y()},{layout:"","layout-dependency":g.value,style:{lineHeight:"1",...m.style,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).div,{layout:"","layout-dependency":g.value,"aria-label":a.value.formatted,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1}},{default:e.withCtx(()=>[e.createVNode(ne,{"layout-dependency":g.value,style:e.normalizeStyle({padding:`calc(${e.unref(_)}/2) 0`}),"aria-hidden":!0,justify:"right",mode:"popLayout",parts:a.value.pre,name:"pre",trend:r.value},null,8,["layout-dependency","style","parts","trend"]),e.createVNode(pt,{"layout-dependency":g.value},{default:e.withCtx(()=>[e.createVNode(ne,{"layout-dependency":g.value,justify:"right",parts:a.value.integer,name:"integer",mode:"popLayout",trend:r.value},null,8,["layout-dependency","parts","trend"]),e.createVNode(ne,{"layout-dependency":g.value,layout:"position",parts:a.value.fraction,name:"fraction",mode:"popLayout",trend:r.value},null,8,["layout-dependency","parts","trend"])]),_:1},8,["layout-dependency"]),e.createVNode(ne,{"layout-dependency":g.value,style:e.normalizeStyle({padding:`calc(${e.unref(_)}/2) 0`}),"aria-hidden":!0,layout:"position",mode:"popLayout",parts:a.value.post,name:"post",trend:r.value},null,8,["layout-dependency","style","parts","trend"])]),_:1},8,["layout-dependency","aria-label"])]),_:1},16,["layout-dependency","style"])]),_:1},8,["transition"])]),_:1}))}}),gt=mt;function yt(){const o=document.createElement("style");return o.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 vt(o){e.watch(o,(t,n,a)=>{const s=t?yt():i.noop;return a(()=>{s()})},{immediate:!0,flush:"post"})}function be(o){return t=>{t.pointerType==="mouse"&&o(t)}}function Oe(o){return be(t=>{t.button===0&&o(t)})}let ae,he;function ht(){ae=i.motionValue(0),he=i.motionValue(0);let o=0,t=0;function n(){ae.set(o),he.set(t)}typeof window<"u"&&window.addEventListener("pointermove",be(a=>{o=a.clientX,t=a.clientY,i.frame.update(n)}))}function Ce(){return ae||ht(),{x:ae,y:he}}function xt(o,t){return{x:i.useTransform(()=>o.x.get()+t.value.x),y:i.useTransform(()=>o.y.get()+t.value.y)}}function wt(o){return o.closest("[data-cursor]")}function kt(o){return o.closest('a, button, input[type="button"]:not(:disabled)')}function It(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 bt(o){let t=wt(o);return t?[t.dataset.cursor,t]:(t=kt(o),t?["pointer",t]:(t=It(o),t?["text",t]:["default",null]))}let me=null,D={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function Ct(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 St(){if(typeof window>"u")return{onChange:()=>()=>{}};const o=new Set;function t(l){D={...D,...l},o.forEach(p=>p(D))}const n=Oe(()=>{D.isPressed||t({isPressed:!0})}),a=Oe(()=>{D.isPressed&&t({isPressed:!1})}),s=be(({target:l})=>{if(!l)return;const[p,y]=bt(l);let m=!1;const u={target:y,zone:Ct(l)};p!==D.type&&(u.type=p,m=!0),u.zone!==D.zone&&(D.zone=u.zone,m=!0);const f=p==="pointer"&&y?y.getBoundingClientRect():null;if(f!==D.targetBoundingBox&&(u.targetBoundingBox=f,m=!0),p==="text"){const{fontSize:d}=window.getComputedStyle(l),I=d?parseInt(d):null;I!==D.fontSize&&(u.fontSize=I,m=!0)}else D.fontSize&&(u.fontSize=null,m=!0);m&&t(u)});function r(){typeof window>"u"||(window.addEventListener("pointerover",s),window.addEventListener("pointerdown",n),window.addEventListener("pointerup",a))}function c(){window.removeEventListener("pointerover",s),window.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",a)}return{onChange:l=>(o.size||r(),o.add(l),()=>{o.delete(l),o.size||c()})}}function Bt(){return me||(me=St()),me}function Se(){const o=e.ref({...D});return e.watch(o,()=>Bt().onChange(t=>{o.value=t}),{immediate:!0,flush:"post"}),o}let ge=null;function Tt(){const o=new Set;function t(){o.forEach(r=>r.show())}function n(){o.forEach(r=>r.hide())}function a(){document.body.addEventListener("mouseenter",t),document.body.addEventListener("mouseleave",n)}function s(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",n)}return{on:r=>typeof window>"u"?i.noop:(o.size||a(),o.add(r),()=>{o.delete(r),o.size===0&&s()})}}function Lt(){return ge||(ge=Tt()),ge}function Ke(o){const t=e.ref(!0);return e.watch(t,()=>Lt().on({show:()=>{t.value||(o(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const Ve={x:0,y:0},Pt={x:.5,y:.5},Et={duration:0},Mt={stiffness:1e3,damping:100},zt={duration:.15,ease:[.38,.12,.29,1]},Ne={magneticOptions:{morph:!0,padding:5,snap:.8}},De=17,_e=31,Re=4,$t=20;function oe(o,t,n){const a={width:(n==null?void 0:n.width)??o,height:(n==null?void 0:n.height)??t};return typeof a.width=="number"&&(a.width=`${a.width}px`),typeof a.height=="number"&&(a.height=`${a.height}px`),a}function Ot({type:o,state:t,hasChildren:n,style:a,isMagnetic:s,magneticOptions:r,matchTextSize:c}){const l=s&&t.targetBoundingBox;if(n&&!l)return oe("auto","auto",a);const{padding:p,morph:y}=r;switch(o){case"pointer":if(s&&y&&t.targetBoundingBox){const{width:m,height:u}=t.targetBoundingBox;return{width:`${m+p*2}px`,height:`${u+p*2}px`}}return oe(_e,_e,a);case"text":return c&&t.fontSize?{width:`${Re}px`,height:`${t.fontSize}px`}:oe(Re,$t,a);default:return oe(De,De,a)}}function Vt({x:o,y:t},n){const a=e.ref(o.prev!==void 0||t.prev!==void 0);return e.watch(a,()=>{if(a.value)return;const s=()=>{a.value=!0,n(),r()},r=i.pipe(o.on("change",s),t.on("change",s));return()=>r()},{immediate:!0}),a}function Nt(o,t,n){return i.useTransform(()=>i.mix(o.value.get(),t.get(),n.get()))}function Ae(o,t,n){const a=i.useSpring(0,{stiffness:600,damping:50}),s=i.useMotionValue(0),r=Nt(o,a,s);return e.watch(()=>n==null?void 0:n.value,(c,l)=>{c?(!l&&!s.isAnimating()?a.jump(c):a.set(c),i.animate(s,t.value||0)):i.animate(s,0)},{immediate:!0,flush:"sync"}),r}function Dt(o,t,n,a){const s=Ae(e.computed(()=>o.value.x),a,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),r=Ae(e.computed(()=>o.value.y),a,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return e.computed(()=>t.value?{x:s,y:r}:o.value)}const _t=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:o})=>o?Ve:Pt},offset:{default:()=>Ve},spring:{type:[Boolean,Object],default:({follow:o})=>o?Mt:!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:a}=e.toRefs(t),s=i.useReducedMotion();vt(()=>!s.value&&!t.follow);const r=Ce(),c=xt(r,n),l=i.useSpring(c.x,t.spring||void 0),p=i.useSpring(c.y,t.spring||void 0),y=e.computed(()=>typeof t.magnetic=="object"?{...Ne.magneticOptions,...t.magnetic}:Ne.magneticOptions);function m(){const h=c.x.on("change",P=>{l.jump(P),h()}),L=c.y.on("change",P=>{p.jump(P),L()})}const u=Se(),f=Ke(m),d=Dt(e.computed(()=>t.spring?{x:l,y:p}:r),e.computed(()=>!!a.value),u,e.computed(()=>y.value&&y.value.snap)),I=e.useSlots(),x=e.computed(()=>{var P,z;const h=(z=(P=I.default)==null?void 0:P.call(I))==null?void 0:z.filter(V=>V.type!==Symbol.for("v-cmt"));return Ot({type:u.value.type,state:u.value,hasChildren:!!(h!=null&&h.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:y.value,matchTextSize:t.matchTextSize})}),g=Vt(r,m);function w(h){return(L,P)=>`translate(-${h.x*100}%, -${h.y*100}%) ${P}`}function v(){const{follow:h,center:L,offset:P,spring:z,matchTextSize:V,magnetic:F,...k}=t;return k}return(h,L)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(g)?(e.openBlock(),e.createBlock(e.unref(i.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(i.MotionConfig),{transition:e.unref(s)?e.unref(Et):h.transition||e.unref(zt)},{default:e.withCtx(()=>{var P,z;return[e.createVNode(e.unref(i.motion).div,e.mergeProps({layout:"","data-motion-cursor":h.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...h.$attrs,...v()},{variants:{pressed:h.follow?{}:{scale:.9},...h.variants,default:{opacity:1,scale:1,...(P=h.variants)==null?void 0:P.default},exit:{opacity:0,scale:0,...(z=h.variants)==null?void 0:z.exit}},animate:["default",e.unref(u).type,e.unref(a)&&e.unref(u).targetBoundingBox?"magnetic":"",!e.unref(f)||!h.show?"exit":e.unref(u).isPressed?"pressed":""],"transform-template":w(h.center),style:{borderRadius:h.follow?0:20,zIndex:h.follow?99998:99999,willChange:"transform",contain:"layout",originX:h.center.x,originY:h.center.y,...h.style,width:x.value.width,height:x.value.height,x:e.unref(d).x,y:e.unref(d).y,top:0,left:0,position:"fixed",pointerEvents:"none"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(i.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(h.$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 a=i.useMotionValue(0),s=i.useMotionValue(0),r=i.useMotionValue(0);return e.watch(()=>n==null?void 0:n.value,c=>{if(typeof c=="number"){i.animate(r,1);const l=()=>{s.set(t*(o.get()-c))};return l(),o.on("change",l)}else i.animate(r,0)},{immediate:!0,flush:"post"}),i.useTransform(()=>i.mix(a.get(),s.get(),r.get()))}function Rt(o,t=.1){const n=Se(),a=Ce(),s=e.computed(()=>n.value.targetBoundingBox&&n.value.target===o.value),r=Fe(a.x,t,e.computed(()=>s.value?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),c=Fe(a.y,t,e.computed(()=>s.value?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return{x:r,y:c}}const[At,Ft]=i.createContext("TickerItemContext"),[Be,jt]=i.createContext("TickerInfo");function Ge(o,t,n,a,s){return{sign:1,direction:s,lengthProp:t,viewportLengthProp:n,paddingStartProp:a,measureItem:r=>({start:r[o],end:r[o]+r[t]}),getCumulativeInset:r=>{let c=0,l=r;for(;l;)c+=l[o],l=l.offsetParent;return c}}}const qe=Ge("offsetLeft","offsetWidth","innerWidth","paddingLeft","right"),Ht=Ge("offsetTop","offsetHeight","innerHeight","paddingTop","bottom");function je(o,t){return((t==null?void 0:t.offsetWidth)??window.innerWidth)-(o.offsetLeft+o.offsetWidth)}const Wt={...qe,sign:-1,direction:"left",paddingStartProp:"paddingRight",measureItem:(o,t)=>{const n=o.offsetWidth,a=je(o,t);return{start:a,end:a+n}},getCumulativeInset:o=>{let t=0,n=o;for(;n;)t+=je(n,n.offsetParent),n=n.offsetParent;return t}};function q(o,t){return o==="y"?Ht:t==="ltr"?qe:Wt}const xe=e.defineComponent({__name:"TickerItem",props:{offset:{},axis:{},listSize:{default:0},bounds:{},numItems:{default:0},itemIndex:{},cloneIndex:{},alignItems:{},size:{default:"auto"},safeMargin:{},reproject:{type:Boolean,default:!0}},setup(o){const t=o,{state:n}=Be(),a=e.computed(()=>q(t.axis,n.direction).sign),s=i.useTransform(()=>{if(!t.reproject)return 0;const{offset:u,bounds:f,listSize:d,safeMargin:I}=t,{start:x,end:g}=f;if(!x&&!g||!d)return 0;const w=u.get();if(w*a.value+g<=-n.inset-I)return d*a.value;if(I>0){const v=n.visibleLength-I-n.inset;if(w*a.value+f.start>=v)return-d*a.value}return 0}),r=i.useTransform(()=>{const u=t.offset.get(),f=s.get();return!t.bounds.start&&!t.bounds.end||!t.listSize?0:u*a.value+t.bounds.start+f*a.value}),c=e.computed(()=>t.cloneIndex===void 0?{"aria-hidden":!1,"aria-posinset":t.itemIndex+1,"aria-setsize":t.numItems}:{"aria-hidden":!0}),l=e.computed(()=>{const u=t.size==="fill",f=t.alignItems==="stretch"?"100%":"fit-content";return{class:t.cloneIndex===void 0?"ticker-item":"clone-item",style:{flexGrow:0,flexShrink:0,position:"relative",flexBasis:u?"100%":void 0,display:u?"grid":void 0,gridTemplateColumns:u?"1fr":void 0,gridTemplateRows:u?"1fr":void 0,minWidth:u?0:void 0,minHeight:u?0:void 0,height:t.axis==="x"?f:void 0,width:t.axis==="y"?f:void 0,x:t.axis==="x"?s:0,y:t.axis==="y"?s:0},...c.value}}),{bounds:p,itemIndex:y,cloneIndex:m}=e.toRefs(t);return Ft({offset:r,bounds:p,projection:s,itemIndex:y,cloneIndex:m,props:l}),(u,f)=>u.size==="manual"?e.renderSlot(u.$slots,"default",{key:0}):(e.openBlock(),e.createBlock(e.unref(i.motion).li,e.normalizeProps(e.mergeProps({key:1},l.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3},16))}});function Xt(o,t,n,a,s){let r=!1;e.watch(o,(c,l,p)=>{if(!c)return;let y=!1;const m=new AbortController,u={signal:m.signal},f={...u,capture:!0},d=t.value==="x"?"scrollLeft":"scrollTop",I=t.value==="x"?"offsetLeft":"offsetTop",x=t.value==="x"?"ArrowLeft":"ArrowUp",g=t.value==="x"?"ArrowRight":"ArrowDown";let w=[],v=0;const h=async()=>{const C=w[v];C.focus(),await e.nextTick(),n.set(-C[I]),c[d]=0},L=C=>{if(C.key==="Tab"){C.preventDefault(),V();const B=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(i.isHTMLElement);B.sort(Yt);const R=B[C.shiftKey?0:B.length-1],K=C.shiftKey?B.length-1:0;if(c.contains(R)){B[K].focus();return}else{const U=B.indexOf(w[v]),re=C.shiftKey?-1:1;for(let W=U;W<B.length&&W>=0;W+=re){const X=B[W];if(!c.contains(X)){X.focus();return}}}return}else C.key===x?v--:C.key===g&&v++;v=i.wrap(0,w.length,v),h()},P=()=>{r||(s(!0),r=!0,w=Array.from(c.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(i.isHTMLElement),v=0,h(),window.addEventListener("focus",z,f),window.addEventListener("blur",z,f),c.addEventListener("keydown",L,u))},z=C=>{(!C.target||!(C.target instanceof HTMLElement)||!c.contains(C.target))&&V()},V=()=>{r&&(r=!1,s(!1),a.value.set(n.get()),window.removeEventListener("focus",z),window.removeEventListener("blur",z),c.removeEventListener("keydown",L))},F=C=>{const{target:B}=C;i.isHTMLElement(B)&&(r||P())},k=()=>{y||(y=!0,c.addEventListener("focus",F,f),window.addEventListener("pointermove",M,u))},M=()=>{y&&(y=!1,c.removeEventListener("focus",F,!0),window.removeEventListener("pointermove",M,u))},$=C=>{const R=C.target.closest('[aria-hidden="true"]');R&&R.removeAttribute("aria-hidden")};window.addEventListener("keydown",k,u),c.addEventListener("pointerdown",$,u),p(()=>{m.abort(),V()})},{flush:"post"})}function Yt(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 He={start:0,end:0},Kt={start:"flex-start",end:"flex-end"},Gt={duration:.2,ease:"linear"},qt={type:"spring",stiffness:400,damping:40};function Ut(o){return o.end-o.start}function Ue(o){return o.length?o[o.length-1].end-o[0].start:0}function Zt(o,t,n){const a=Ue(t),s=Math.max(...t.map(Ut));let r=0,c=0;for(;c<o;)c=(a+n)*(r+1)-s,r++;return Math.max(r-1,0)}function Ze(o=[]){var n;const t=[];for(const a of o)if(a.type!==e.Comment)if(a.type===e.Fragment){const s=Array.isArray(a.children)?a.children:(n=a.children)==null?void 0:n.default();t.push(...Ze(s))}else t.push(a);return t}function we(o){var n;const t=[];for(const a of o)if(a.type==="Fragment"||a.type===e.Fragment){const s=Array.isArray(a.children)?a.children:(n=a.children)==null?void 0:n.default();t.push(...we(s))}else t.push(a);return t}function Je(o,t,n){const a=Math.floor(o/n),s=a*n;let r=0;for(let c=0;c<t.length;c++){const{end:l}=t[c];if(r=c,l+s>o)break}return r+a*t.length}function ke(o,t,n,a){var u;if(t.length===0)return 0;const r=t[t.length-1].end+n,c=a??o+(((u=t[0])==null?void 0:u.end)??0);let p=Je(o,t,r)+1,y=0,m=!1;for(;!m;){const{start:f,end:d}=t[i.wrap(0,t.length,p)],x=Math.floor(p/t.length)*r;y=f+x,d+x>c?m=!0:p++}return y}function Jt(o,t,n,a){const s=o+t;return ke(o,n,a,s)}function Ie(o,t,n,a,s){if(t.length===0)return 0;const c=t[t.length-1].end+n,l=a??o-(s??0);let y=Je(o,t,c),m=o,u=!1;for(;!u;){const{start:f,end:d}=t[i.wrap(0,t.length,y)],I=d-f,g=Math.floor(y/t.length)*c,w=f+g;l<=w+n||w>=o?(m=w,y--):l<=w?(m=w,u=!0):((s&&I>s||m===o&&l>=w)&&(m=w),u=!0)}return m}function Qt(o,t,n,a){const s=o-t;return Ie(o,n,a,s,t)}function We(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const en=e.defineComponent({__name:"Ticker",props:{axis:{default:"x"},velocity:{default:50},hoverFactor:{default:1},gap:{default:10},align:{default:"center"},offset:{},itemSize:{default:"auto"},overflow:{type:Boolean,default:!1},loop:{type:Boolean,default:!0},safeMargin:{default:0},fade:{default:0},fadeTransition:{default:()=>Gt},pageTransition:{default:()=>qt},_dragX:{type:[Object,Boolean]},_dragY:{type:[Object,Boolean]},snap:{type:[String,Boolean]},as:{default:"div"},style:{},onDragEnd:{},drag:{type:[Boolean,String]},dragConstraints:{type:[Boolean,Object]},dragMomentum:{type:Boolean}},setup(o){const t=o,n=e.reactive({direction:"ltr",visibleLength:0,inset:0,totalItemLength:0,containerLength:0,itemPositions:[],isMeasured:!1,maxInset:null}),a=e.computed(()=>Kt[t.align]||t.align),s=e.computed(()=>q(t.axis,n.direction).sign),r=e.ref(!1),c=i.useMotionValue(1),l=i.useMotionValue(0),p=e.computed(()=>t.offset??l),y=i.useTransform(()=>n.direction==="rtl"?i.wrap(n.totalItemLength+t.gap+n.inset,n.inset,p.value.get()):i.wrap(-n.totalItemLength-t.gap-n.inset,-n.inset,p.value.get())),m=i.useMotionValue(0),u=e.computed(()=>r.value?m:t.loop?y:p.value),f=i.useDomRef(),d=i.useDomRef(),I=i.useInView(f,{margin:"100px"}),x=i.usePageInView(),g=e.computed(()=>I.value&&x.value),w=i.useReducedMotion(),v=e.useSlots(),h=e.computed(()=>{var b;return Ze((b=v.default)==null?void 0:b.call(v))});function L(){if(!f.value||!d.value)return;const b=window.getComputedStyle(f.value).direction,{measureItem:E,lengthProp:S,viewportLengthProp:T,getCumulativeInset:N}=q(t.axis,b),{safeMargin:O,overflow:A,loop:G}=t,Z=k.value==="x"?"paddingLeft":"paddingTop",se=k.value==="x"?"paddingRight":"paddingBottom",le=f.value,J=d.value.querySelectorAll(".ticker-item");if(!J.length)return;let Pe=!1;const Q=[];for(let ee=0;ee<J.length;ee++){const de=E(J[ee],le);Q.push(de);const pe=n.itemPositions[ee];(!pe||de.start!==pe.start||de.end!==pe.end)&&(Pe=!0)}const ue=Math.min(le[S],window[T]);let ce=t.overflow?window[T]:ue;O>0&&(ce+=O*2);const fe=Ue(Q),Ee=window.getComputedStyle(le),Me=parseInt(Ee[Z]??0),ot=parseInt(Ee[se]??0),ze=A?N(J[0]):Me,at=G===!1?Math.max(0,fe-ue+Me+ot):null;(ce!==n.visibleLength||fe!==n.totalItemLength||ze!==n.inset||n.itemPositions.length!==Q.length||Pe)&&(n.direction=b,n.visibleLength=ce,n.itemPositions=Q,n.totalItemLength=fe,n.inset=ze,n.containerLength=ue,n.maxInset=at,n.isMeasured=!0)}e.watch([h,g,()=>t.overflow],(b,E,S)=>{if(!g.value||!f.value)return;L();const T=t.overflow?i.resize(L):void 0,N=i.resize(f.value,L);S(()=>{T==null||T(),N()})},{immediate:!0,flush:"post"});const P=e.computed(()=>n.totalItemLength>0);i.useAnimationFrame((b,E)=>{if(P.value&&g.value&&p.value===l&&!w.value){const S=E/1e3*(t.velocity*s.value*c.get());p.value.set(p.value.get()-S)}});const z=e.computed(()=>!P.value||!n.visibleLength?0:Zt(n.visibleLength,n.itemPositions,t.gap)),V=e.computed(()=>n.totalItemLength===0?0:(n.totalItemLength+t.gap)*(z.value+1)),F=e.computed(()=>{if(!t.loop)return[];const b=[];for(let E=0;E<z.value;E++){const S=[];h.value.forEach((N,O)=>{let A;const G=n.itemPositions[O],Z=(n.totalItemLength+t.gap)*(E+1),se=G?{start:G.start+Z,end:G.end+Z}:He;S.push(e.createVNode(xe,{key:`clone-${E}-${O}`,offset:u.value,axis:t.axis,listSize:V.value,itemIndex:O,cloneIndex:O,bounds:se,alignItems:a.value,size:t.itemSize,safeMargin:t.safeMargin,numItems:h.value.length},We(A=we([N]))?A:{default:()=>[A]}))});const T=`ticker-group-${E}`;b.push(e.createVNode(i.LayoutGroup,{key:T,id:T},We(S)?S:{default:()=>[S]}))}return b}),k=e.toRef(t,"axis");Xt(f,k,m,p,b=>{r.value=b});const M={display:"flex",position:"relative"},$={display:"flex",position:"relative",willChange:"transform",listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start"};function C(b){return n.maxInset!==null?i.clamp(-n.maxInset,0,b):b}jt({state:n,gap:e.computed(()=>t.gap),clampOffset:C,renderedOffset:u});const B=e.computed(()=>t.axis==="x"?t==null?void 0:t._dragX:t==null?void 0:t._dragY);let R=null;const K=e.computed(()=>n.maxInset!==null?k.value==="x"?s.value>0?{left:n.maxInset*-1,right:0}:{right:n.maxInset,left:0}:{top:n.maxInset*-1,bottom:0}:{});function U(){R&&(R.stop(),R=null)}const re=e.computed(()=>!t.onDragEnd&&t.drag&&B?()=>{B.value.jump(p.value.get()),U()}:t.onPointerDown),W=e.computed(()=>!t.onDragEnd&&t.drag&&B.value?(b,{velocity:E})=>{const S=p.value.get();U(),i.frame.postRender(()=>{let T=S+E[k.value]*(t.snap?.3:.8);if(t.snap)if(E[k.value]<0)T=-ke(-S,n.itemPositions,t.gap,-T);else if(E[k.value]>0)T=-Ie(-S,n.itemPositions,t.gap,-T,n.containerLength);else{const O=-ke(-S,n.itemPositions,t.gap,-S),A=-Ie(-S,n.itemPositions,t.gap,-S,n.containerLength);T=Math.abs(S-O)<Math.abs(S-A)?O:A}const N=t.loop?{}:s.value>0?{max:0,min:K.value[k.value==="x"?"left":"top"]}:{min:0,max:K.value.right};R=i.animate(B.value,C(T*s.value)*s.value,t.snap?t.pageTransition:{type:"inertia",velocity:E[k.value],modifyTarget:()=>T,bounceDamping:40,bounceStiffness:400,...N})})}:t.onDragEnd),X=i.useMotionValue(t.loop?0:1),ie=i.useMotionValue(0),tt=e.computed(()=>q(k.value,n.direction)),Te=e.computed(()=>typeof t.fade=="number"?"px":""),Le=i.useTransform(()=>`linear-gradient(to ${tt.value.direction}, rgba(0,0,0,${X.get()}) 0px, black ${t.fade}${Te.value}, black calc(100% - ${t.fade}${Te.value}), rgba(0,0,0,${ie.get()}) 100%)`),nt=e.computed(()=>t.fade?{maskImage:Le,WebkitMaskImage:Le}:{}),j={start:!0,end:!1};return e.watch(u,(b,E,S)=>{const T=O=>{if(n.maxInset===null)return;const A=n.maxInset*-1;O*=s.value,O<0?j.start&&(i.animate(X,0,t.fadeTransition),j.start=!1):j.start||(i.animate(X,1,t.fadeTransition),j.start=!0),O>A?j.end&&(i.animate(ie,0,t.fadeTransition),j.end=!1):j.end||(i.animate(ie,1,t.fadeTransition),j.end=!0)};let N=()=>{};b&&(N=b.on("change",T)),S(N)},{immediate:!0}),(b,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(i.Motion),e.mergeProps(b.$attrs,{ref_key:"containerRef",ref:f,as:b.as,style:{overflowX:!b.overflow&&k.value==="x"?"clip":void 0,overflowY:!b.overflow&&k.value==="y"?"clip":void 0,...M,...t.style,...nt.value},drag:b.drag,_dragX:b._dragX,_dragY:b._dragY,"drag-constraints":K.value,"drag-momentum":b.dragMomentum,onPointerenter:E[0]||(E[0]=()=>{e.unref(i.animate)(e.unref(c),b.hoverFactor)}),onPointerleave:E[1]||(E[1]=()=>{e.unref(i.animate)(e.unref(c),1)}),onPointerdown:re.value,onDragEnd:W.value}),{default:e.withCtx(()=>[e.createVNode(e.unref(i.motion).ul,{ref_key:"listRef",ref:d,role:"group",style:e.normalizeStyle({...$,flexDirection:k.value==="x"?"row":"column",gap:`${b.gap}px`,x:k.value==="x"?u.value:0,y:k.value==="y"?u.value:0,opacity:P.value?1:0,alignItems:a.value,willChange:P.value&&g.value?"transform":void 0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%"})},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(S,T)=>(e.openBlock(),e.createBlock(xe,{key:`original-${T}`,axis:k.value,offset:u.value,"list-size":V.value,"item-index":T,bounds:n.itemPositions[T]??e.unref(He),"align-items":a.value,size:b.itemSize,reproject:b.loop,"safe-margin":b.safeMargin,"num-items":h.value.length},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(we)([S]),(N,O)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N),{key:O}))),128))]),_:2},1032,["axis","offset","list-size","item-index","bounds","align-items","size","reproject","safe-margin","num-items"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,S=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(S),{key:S.key}))),128))]),_:1},8,["style"])]),_:1},16,["as","style","drag","_dragX","_dragY","drag-constraints","drag-momentum","onPointerdown","onDragEnd"]),e.renderSlot(b.$slots,"after")],64))}}),Qe=en,tn={slow:130,normal:75,fast:30},nn=e.defineComponent({__name:"Typewriter",props:e.mergeDefaults({as:{},speed:{},variance:{},play:{type:Boolean},cursorClassName:{},cursorStyle:{},textClassName:{},textStyle:{},cursorBlinkDuration:{},onComplete:{type:Function},replace:{},backspace:{},backspaceFactor:{}},{as:"span",speed:"normal",variance:"natural",cursorClassName:"motion-typewriter-cursor",play:!0,cursorBlinkDuration:.5,replace:"type",backspace:"character",backspaceFactor:.2}),setup(o){const t=o,n=e.useSlots();function a(){var I;return(((I=n==null?void 0:n.default)==null?void 0:I.call(n))??[]).map(x=>typeof x.children=="string"?x.children:"").join("")}let s=a();const r=i.useMotionValue("");e.watchEffect(()=>{const d=a();t.replace==="all"&&d!==s&&r.set(""),s=d});const c=e.ref();let l=null;const p=e.computed(()=>typeof t.speed=="number"?t.speed:tn[t.speed]);function y(){c.value&&(l=i.animate(c.value,{opacity:[1,1,0,0]},{duration:t.cursorBlinkDuration,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"}))}let m=null;function u(){m==null||m(),m=null}function f(){if(!t.play){y(),u();return}l==null||l.cancel();const d=a(),I=()=>{var w;const g=Y.getNextText(r.get(),d,t.replace,t.backspace);r.set(g),g!==d?x():(y(),(w=t.onComplete)==null||w.call(t))},x=()=>{m=i.delayInMs(I,Y.getTypewriterDelay(d,r.get(),p.value,t.variance,t.backspaceFactor))};m||x()}return e.watchEffect(d=>{f(),d(u)}),e.onMounted(()=>{f()}),(d,I)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),{"aria-label":e.unref(s)},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(t.textClassName),style:e.normalizeStyle(t.textStyle)},[e.createVNode(e.unref(i.RowValue),{value:e.unref(r)},null,8,["value"])],6),e.createElementVNode("span",{ref_key:"cursorRef",ref:c,class:e.normalizeClass(t.cursorClassName),style:e.normalizeStyle({display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...t.cursorStyle})},null,6)]),_:1},8,["aria-label"]))}}),[on,an]=i.createContext("CarouselContext"),rn={type:"spring",stiffness:200,damping:40},sn={type:"spring",stiffness:80,damping:10};function et(o,t,n,a=!0){const s={insets:[],visibleLength:t};if(o.length===0)return s;const r=[o[0].start];for(let c=1;c<o.length;c++){const{start:l,end:p}=o[c];if(r[r.length-1]+t<p)if(n!==null)if(l<=n)r.push(l);else{r.push(n);break}else r.push(l)}if(a&&n!==null&&r.length>1){const c=r[r.length-1],l=[];for(let m=0;m<r.length-1;m++)l.push(r[m+1]-r[m]);const p=l.reduce((m,u)=>m+u,0)/l.length;if(n-c<p*.5){const m=et(o,t*.75,n,!1);if(m.insets.length===r.length)return m}}return{insets:r,visibleLength:t}}function ln(o,t,n,a){const s=-o,r=a===null?Math.floor(s/n):0,c=r*n;for(let l=t.length-1;l>=0;l--){const p=t[l]+c,y=i.wrap(0,t.length,l-1),u=(l===0?r-1:r)*n,f=t[y]+u,d=(p-f)/2,I=i.wrap(0,t.length,l+1),g=(l===t.length-1?r+1:r)*n,w=t[I]+g,v=(w-p)/2;if(s<w-v&&s>=f+d)return l}return 0}const un=e.defineComponent({__name:"CarouselView",props:{offset:{},targetOffset:{},tugOffset:{},loop:{type:Boolean},transition:{},axis:{default:"x"},snap:{type:[String,Boolean],default:"page"},tickerRef:{},page:{}},setup(o){const t=o;let n=!0;const{state:a,gap:s,clampOffset:r}=Be(),c=e.computed(()=>a.totalItemLength+s.value),l=e.computed(()=>et(a.itemPositions,a.containerLength,a.maxInset)),p=e.computed(()=>l.value.insets.length),y=e.computed(()=>q(t.axis,a.direction).sign);function m(k){const M=ln(k*y.value,l.value.insets,c.value,a.maxInset),$=t.loop?!0:k*-y.value<a.maxInset,C=t.loop?!0:k*-y.value>0;return{current:M,isNextActive:$,isPrevActive:C}}const u=e.ref(m(t.targetOffset.get()));function f(){const k=m(t.targetOffset.get());(k.current!==u.value.current||k.isNextActive!==u.value.isNextActive||k.isPrevActive!==u.value.isPrevActive)&&(u.value=k)}e.watch([()=>a.containerLength,()=>a.totalItemLength],f,{immediate:!0,flush:"post"}),i.useMotionValueEvent(t.targetOffset,"change",k=>{t.offset.set(k),f()});let d=null;function I(){d&&(d.stop(),d=null)}e.onMounted(()=>{t.offset.attach((k,M)=>{I(),n?M(k):d=new i.JSAnimation({keyframes:[t.offset.get(),k],velocity:i.clamp(-2e3,2e3,t.offset.getVelocity()),...t.transition,onUpdate:M,onComplete:()=>{d=null}}),n=!0},I)});function x(k){const M=r(k);t.targetOffset.stop(),n=!1,t.targetOffset.set(M*y.value)}function g(k,M){const $=-k(-t.targetOffset.get()*y.value,l.value.visibleLength,a.itemPositions,s.value),C=r($);C*y.value===t.targetOffset.get()?i.animate(t.tugOffset,0,{velocity:M*y.value*400,...sn}):x(C)}const w=()=>g(Jt,-1),v=()=>g(Qt,1);function h(k){const $=(t.loop?Math.floor(-t.targetOffset.get()*y.value/c.value):0)*-c.value;x(-l.value.insets[k]+$)}const{axis:L,snap:P,offset:z}=e.toRefs(t);e.watch([L,P,z,y,()=>t.tickerRef],(k,M,$)=>{t.tickerRef&&$(Y.wheel(t.tickerRef,{axis:L.value,onSwipe:P.value?C=>{C*y.value===1?w():v()}:void 0,onWheel:C=>{const B=z.value.get()+C,R=y.value>0?r(B):i.clamp(0,a.maxInset,B);t.targetOffset.jump(a.maxInset?R:B)}}))},{immediate:!0,flush:"post"});let V=!1,F;return e.watch([()=>a.isMeasured,p,()=>t.page,y,()=>t.targetOffset,()=>t.offset,()=>l.value.insets],([k,M])=>{const $=t.page;if($===void 0||!k||!M)return;const C=i.clamp(0,M-1,$),B=-l.value.insets[C]*y.value;V?F!==$&&(F=$,t.targetOffset.jump(B),t.offset.jump(B)):(V=!0,F=$,t.targetOffset.jump(B),t.offset.jump(B))},{immediate:!0,flush:"post"}),an({paginationState:u,totalPages:p,nextPage:w,prevPage:v,gotoPage:h,targetOffset:t.targetOffset}),(k,M)=>e.renderSlot(k.$slots,"default")}}),cn=e.defineComponent({name:"Carousel",inheritAttrs:!1,__name:"Carousel",props:{snap:{type:[String,Boolean],default:"page"},transition:{default:()=>({...rn})},page:{},axis:{default:"x"},gap:{},align:{},itemSize:{},overflow:{type:Boolean},loop:{type:Boolean,default:!0},safeMargin:{},fade:{},fadeTransition:{},pageTransition:{},_dragX:{type:[Object,Boolean]},_dragY:{type:[Object,Boolean]},as:{},style:{},onDragEnd:{},drag:{type:[Boolean,String]},dragConstraints:{type:[Boolean,Object]},dragMomentum:{type:Boolean}},setup(o){const t=o,n=i.useMotionValue(0),a=i.useMotionValue(0),s=i.useMotionValue(0),r=i.useTransform(()=>s.get()+a.get()),c=i.useDomRef();return(l,p)=>(e.openBlock(),e.createBlock(e.unref(Qe),e.mergeProps({...t,...l.$attrs},{ref_key:"tickerRef",ref:c,role:"region","aria-roledescription":"carousel",offset:e.unref(r),loop:l.loop,axis:l.axis,drag:l.axis,"_drag-x":l.axis==="x"?e.unref(n):!1,"_drag-y":l.axis==="y"?e.unref(n):!1,snap:l.snap,"page-transition":l.transition}),{after:e.withCtx(()=>[e.createVNode(un,{"ticker-ref":e.unref(c),loop:l.loop,offset:e.unref(a),"tug-offset":e.unref(s),"target-offset":e.unref(n),transition:l.transition,snap:l.snap,axis:l.axis,page:l.page},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"after")]),_:3},8,["ticker-ref","loop","offset","tug-offset","target-offset","transition","snap","axis","page"])]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16,["offset","loop","axis","drag","_drag-x","_drag-y","snap","page-transition"]))}}),fn=e.defineComponent({__name:"ScrambleText",props:e.mergeDefaults({text:{},as:{},active:{type:Boolean},delay:{type:[Number,Function]},duration:{type:[Number,Function]},interval:{},chars:{},onComplete:{type:Function}},{as:"span",active:!0,delay:0,duration:1,interval:.05}),setup(o){const t=o,n=i.useMotionValue(t.text);let a=null;function s(){a==null||a.stop(),n.set(t.text),a=Y.scrambleText(n,{delay:t.delay,duration:t.duration,interval:t.interval,chars:t.chars,onComplete:()=>{var r;return(r=t.onComplete)==null?void 0:r.call(t)}}),t.active||a.finish()}return e.watch(()=>[t.active,t.text,t.delay,t.duration,t.interval,t.chars],()=>{s()},{immediate:!0}),e.onUnmounted(()=>{a==null||a.stop()}),(r,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.RowValue),{value:e.unref(n)},null,8,["value"])]),_:1}))}});exports.AnimateNumber=gt;exports.Carousel=cn;exports.Cursor=_t;exports.ScrambleText=fn;exports.Ticker=Qe;exports.TickerItem=xe;exports.Typewriter=nn;exports.useCarousel=on;exports.useCursorIsInView=Ke;exports.useCursorState=Se;exports.useMagneticPull=Rt;exports.usePointerPosition=Ce;exports.useTicker=Be;exports.useTickerItem=At;Object.keys(Y).forEach(o=>{o!=="default"&&!Object.prototype.hasOwnProperty.call(exports,o)&&Object.defineProperty(exports,o,{enumerable:!0,get:()=>Y[o]})});
|
|
9
|
+
`,document.head.appendChild(o),()=>{document.head.removeChild(o)}}function vt(o){e.watch(o,(t,n,a)=>{const i=t?yt():s.noop;return a(()=>{i()})},{immediate:!0,flush:"post"})}function Ie(o){return t=>{t.pointerType==="mouse"&&o(t)}}function Oe(o){return Ie(t=>{t.button===0&&o(t)})}let ae,he;function ht(){ae=s.motionValue(0),he=s.motionValue(0);let o=0,t=0;function n(){ae.set(o),he.set(t)}typeof window<"u"&&window.addEventListener("pointermove",Ie(a=>{o=a.clientX,t=a.clientY,s.frame.update(n)}))}function Ce(){return ae||ht(),{x:ae,y:he}}function xt(o,t){return{x:s.useTransform(()=>o.x.get()+t.value.x),y:s.useTransform(()=>o.y.get()+t.value.y)}}function wt(o){return o.closest("[data-cursor]")}function kt(o){return o.closest('a, button, input[type="button"]:not(:disabled)')}function bt(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 It(o){let t=wt(o);return t?[t.dataset.cursor,t]:(t=kt(o),t?["pointer",t]:(t=bt(o),t?["text",t]:["default",null]))}let me=null,D={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function Ct(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 St(){if(typeof window>"u")return{onChange:()=>()=>{}};const o=new Set;function t(u){D={...D,...u},o.forEach(y=>y(D))}const n=Oe(()=>{D.isPressed||t({isPressed:!0})}),a=Oe(()=>{D.isPressed&&t({isPressed:!1})}),i=Ie(({target:u})=>{if(!u)return;const[y,g]=It(u);let m=!1;const l={target:g,zone:Ct(u)};y!==D.type&&(l.type=y,m=!0),l.zone!==D.zone&&(D.zone=l.zone,m=!0);const p=y==="pointer"&&g?g.getBoundingClientRect():null;if(p!==D.targetBoundingBox&&(l.targetBoundingBox=p,m=!0),y==="text"){const{fontSize:d}=window.getComputedStyle(u),k=d?parseInt(d):null;k!==D.fontSize&&(l.fontSize=k,m=!0)}else D.fontSize&&(l.fontSize=null,m=!0);m&&t(l)});function r(){typeof window>"u"||(window.addEventListener("pointerover",i),window.addEventListener("pointerdown",n),window.addEventListener("pointerup",a))}function c(){window.removeEventListener("pointerover",i),window.removeEventListener("pointerdown",n),window.removeEventListener("pointerup",a)}return{onChange:u=>(o.size||r(),o.add(u),()=>{o.delete(u),o.size||c()})}}function Bt(){return me||(me=St()),me}function Se(){const o=e.ref({...D});return e.watch(o,()=>Bt().onChange(t=>{o.value=t}),{immediate:!0,flush:"post"}),o}let ge=null;function Tt(){const o=new Set;function t(){o.forEach(r=>r.show())}function n(){o.forEach(r=>r.hide())}function a(){document.body.addEventListener("mouseenter",t),document.body.addEventListener("mouseleave",n)}function i(){document.body.removeEventListener("mouseenter",t),document.body.removeEventListener("mouseleave",n)}return{on:r=>typeof window>"u"?s.noop:(o.size||a(),o.add(r),()=>{o.delete(r),o.size===0&&i()})}}function Lt(){return ge||(ge=Tt()),ge}function Ke(o){const t=e.ref(!0);return e.watch(t,()=>Lt().on({show:()=>{t.value||(o(),t.value=!0)},hide:()=>t.value=!1}),{immediate:!0}),t}const Ne={x:0,y:0},Pt={x:.5,y:.5},Et={duration:0},Mt={stiffness:1e3,damping:100},zt={duration:.15,ease:[.38,.12,.29,1]},Ve={magneticOptions:{morph:!0,padding:5,snap:.8}},De=17,_e=31,Re=4,$t=20;function oe(o,t,n){const a={width:(n==null?void 0:n.width)??o,height:(n==null?void 0:n.height)??t};return typeof a.width=="number"&&(a.width=`${a.width}px`),typeof a.height=="number"&&(a.height=`${a.height}px`),a}function Ot({type:o,state:t,hasChildren:n,style:a,isMagnetic:i,magneticOptions:r,matchTextSize:c}){const u=i&&t.targetBoundingBox;if(n&&!u)return oe("auto","auto",a);const{padding:y,morph:g}=r;switch(o){case"pointer":if(i&&g&&t.targetBoundingBox){const{width:m,height:l}=t.targetBoundingBox;return{width:`${m+y*2}px`,height:`${l+y*2}px`}}return oe(_e,_e,a);case"text":return c&&t.fontSize?{width:`${Re}px`,height:`${t.fontSize}px`}:oe(Re,$t,a);default:return oe(De,De,a)}}function Nt({x:o,y:t},n){const a=e.ref(o.prev!==void 0||t.prev!==void 0);return e.watch(a,()=>{if(a.value)return;const i=()=>{a.value=!0,n(),r()},r=s.pipe(o.on("change",i),t.on("change",i));return()=>r()},{immediate:!0}),a}function Vt(o,t,n){return s.useTransform(()=>s.mix(o.value.get(),t.get(),n.get()))}function Ae(o,t,n){const a=s.useSpring(0,{stiffness:600,damping:50}),i=s.useMotionValue(0),r=Vt(o,a,i);return e.watch(()=>n==null?void 0:n.value,(c,u)=>{c?(!u&&!i.isAnimating()?a.jump(c):a.set(c),s.animate(i,t.value||0)):s.animate(i,0)},{immediate:!0,flush:"sync"}),r}function Dt(o,t,n,a){const i=Ae(e.computed(()=>o.value.x),a,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),r=Ae(e.computed(()=>o.value.y),a,e.computed(()=>n.value.targetBoundingBox?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return e.computed(()=>t.value?{x:i,y:r}:o.value)}const _t=e.defineComponent({name:"Cursor",inheritAttrs:!1,__name:"Cursor",props:{follow:{type:Boolean,default:!1},center:{default:({follow:o})=>o?Ne:Pt},offset:{default:()=>Ne},spring:{type:[Boolean,Object],default:({follow:o})=>o?Mt:!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:a}=e.toRefs(t),i=s.useReducedMotion();vt(()=>!i.value&&!t.follow);const r=Ce(),c=xt(r,n),u=s.useSpring(c.x,t.spring||void 0),y=s.useSpring(c.y,t.spring||void 0),g=e.computed(()=>typeof t.magnetic=="object"?{...Ve.magneticOptions,...t.magnetic}:Ve.magneticOptions);function m(){const f=c.x.on("change",S=>{u.jump(S),f()}),x=c.y.on("change",S=>{y.jump(S),x()})}const l=Se(),p=Ke(m),d=Dt(e.computed(()=>t.spring?{x:u,y}:r),e.computed(()=>!!a.value),l,e.computed(()=>g.value&&g.value.snap)),k=e.useSlots(),h=e.computed(()=>{var S,M;const f=(M=(S=k.default)==null?void 0:S.call(k))==null?void 0:M.filter(O=>O.type!==Symbol.for("v-cmt"));return Ot({type:l.value.type,state:l.value,hasChildren:!!(f!=null&&f.length),isMagnetic:!!t.magnetic,style:t.style,magneticOptions:g.value,matchTextSize:t.matchTextSize})}),b=Nt(r,m);function I(f){return(x,S)=>`translate(-${f.x*100}%, -${f.y*100}%) ${S}`}function w(){const{follow:f,center:x,offset:S,spring:M,matchTextSize:O,magnetic:R,...v}=t;return v}return(f,x)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(b)?(e.openBlock(),e.createBlock(e.unref(s.LayoutGroup),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(s.MotionConfig),{transition:e.unref(i)?e.unref(Et):f.transition||e.unref(zt)},{default:e.withCtx(()=>{var S,M;return[e.createVNode(e.unref(s.motion).div,e.mergeProps({layout:"","data-motion-cursor":f.follow?"follow":"pointer","data-framer-portal-id":"motion-cursor",initial:"exit",exit:"exit"},{...f.$attrs,...w()},{variants:{pressed:f.follow?{}:{scale:.9},...f.variants,default:{opacity:1,scale:1,...(S=f.variants)==null?void 0:S.default},exit:{opacity:0,scale:0,...(M=f.variants)==null?void 0:M.exit}},animate:["default",e.unref(l).type,e.unref(a)&&e.unref(l).targetBoundingBox?"magnetic":"",!e.unref(p)||!f.show?"exit":e.unref(l).isPressed?"pressed":""],"transform-template":I(f.center),style:{borderRadius:f.follow?0:20,zIndex:f.follow?99998:99999,willChange:"transform",contain:"layout",originX:f.center.x,originY:f.center.y,...f.style,width:h.value.width,height:h.value.height,x:e.unref(d).x,y:e.unref(d).y,top:0,left:0,position:"fixed",pointerEvents:"none"}}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.AnimatePresence),null,{default:e.withCtx(()=>[e.renderSlot(f.$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 a=s.useMotionValue(0),i=s.useMotionValue(0),r=s.useMotionValue(0);return e.watch(()=>n==null?void 0:n.value,c=>{if(typeof c=="number"){s.animate(r,1);const u=()=>{i.set(t*(o.get()-c))};return u(),o.on("change",u)}else s.animate(r,0)},{immediate:!0,flush:"post"}),s.useTransform(()=>s.mix(a.get(),i.get(),r.get()))}function Rt(o,t=.1){const n=Se(),a=Ce(),i=e.computed(()=>n.value.targetBoundingBox&&n.value.target===o.value),r=Fe(a.x,t,e.computed(()=>i.value?n.value.targetBoundingBox.left+n.value.targetBoundingBox.width/2:void 0)),c=Fe(a.y,t,e.computed(()=>i.value?n.value.targetBoundingBox.top+n.value.targetBoundingBox.height/2:void 0));return{x:r,y:c}}const[At,Ft]=s.createContext("TickerItemContext"),[Be,jt]=s.createContext("TickerInfo");function Ge(o,t,n,a,i){return{sign:1,direction:i,lengthProp:t,viewportLengthProp:n,paddingStartProp:a,measureItem:r=>({start:r[o],end:r[o]+r[t]}),getCumulativeInset:r=>{let c=0,u=r;for(;u;)c+=u[o],u=u.offsetParent;return c}}}const qe=Ge("offsetLeft","offsetWidth","innerWidth","paddingLeft","right"),Ht=Ge("offsetTop","offsetHeight","innerHeight","paddingTop","bottom");function je(o,t){return((t==null?void 0:t.offsetWidth)??window.innerWidth)-(o.offsetLeft+o.offsetWidth)}const Wt={...qe,sign:-1,direction:"left",paddingStartProp:"paddingRight",measureItem:(o,t)=>{const n=o.offsetWidth,a=je(o,t);return{start:a,end:a+n}},getCumulativeInset:o=>{let t=0,n=o;for(;n;)t+=je(n,n.offsetParent),n=n.offsetParent;return t}};function q(o,t){return o==="y"?Ht:t==="ltr"?qe:Wt}const xe=e.defineComponent({__name:"TickerItem",props:{offset:{},axis:{},listSize:{default:0},bounds:{},numItems:{default:0},itemIndex:{},cloneIndex:{},alignItems:{},size:{default:"auto"},safeMargin:{},reproject:{type:Boolean,default:!0}},setup(o){const t=o,{state:n}=Be(),a=e.computed(()=>q(t.axis,n.direction).sign),i=s.useTransform(()=>{if(!t.reproject)return 0;const{offset:l,bounds:p,listSize:d,safeMargin:k}=t,{start:h,end:b}=p;if(!h&&!b||!d)return 0;const I=l.get();if(I*a.value+b<=-n.inset-k)return d*a.value;if(k>0){const w=n.visibleLength-k-n.inset;if(I*a.value+p.start>=w)return-d*a.value}return 0}),r=s.useTransform(()=>{const l=t.offset.get(),p=i.get();return!t.bounds.start&&!t.bounds.end||!t.listSize?0:l*a.value+t.bounds.start+p*a.value}),c=e.computed(()=>t.cloneIndex===void 0?{"aria-hidden":!1,"aria-posinset":t.itemIndex+1,"aria-setsize":t.numItems}:{"aria-hidden":!0}),u=e.computed(()=>{const l=t.size==="fill",p=t.alignItems==="stretch"?"100%":"fit-content";return{class:t.cloneIndex===void 0?"ticker-item":"clone-item",style:{flexGrow:0,flexShrink:0,position:"relative",flexBasis:l?"100%":void 0,display:l?"grid":void 0,gridTemplateColumns:l?"1fr":void 0,gridTemplateRows:l?"1fr":void 0,minWidth:l?0:void 0,minHeight:l?0:void 0,height:t.axis==="x"?p:void 0,width:t.axis==="y"?p:void 0,x:t.axis==="x"?i:0,y:t.axis==="y"?i:0},...c.value}}),{bounds:y,itemIndex:g,cloneIndex:m}=e.toRefs(t);return Ft({offset:r,bounds:y,projection:i,itemIndex:g,cloneIndex:m,props:u}),(l,p)=>l.size==="manual"?e.renderSlot(l.$slots,"default",{key:0}):(e.openBlock(),e.createBlock(e.unref(s.motion).li,e.normalizeProps(e.mergeProps({key:1},u.value)),{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16))}});function Xt(o,t,n,a,i){let r=!1;e.watch(o,(c,u,y)=>{if(!c)return;let g=!1;const m=new AbortController,l={signal:m.signal},p={...l,capture:!0},d=t.value==="x"?"scrollLeft":"scrollTop",k=t.value==="x"?"offsetLeft":"offsetTop",h=t.value==="x"?"ArrowLeft":"ArrowUp",b=t.value==="x"?"ArrowRight":"ArrowDown";let I=[],w=0;const f=async()=>{const B=I[w];B.focus(),await e.nextTick(),n.set(-B[k]),c[d]=0},x=B=>{if(B.key==="Tab"){B.preventDefault(),O();const L=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(s.isHTMLElement);L.sort(Yt);const A=L[B.shiftKey?0:L.length-1],K=B.shiftKey?L.length-1:0;if(c.contains(A)){L[K].focus();return}else{const U=L.indexOf(I[w]),re=B.shiftKey?-1:1;for(let W=U;W<L.length&&W>=0;W+=re){const X=L[W];if(!c.contains(X)){X.focus();return}}}return}else B.key===h?w--:B.key===b&&w++;w=s.wrap(0,I.length,w),f()},S=()=>{r||(i(!0),r=!0,I=Array.from(c.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(s.isHTMLElement),w=0,f(),window.addEventListener("focus",M,p),window.addEventListener("blur",M,p),c.addEventListener("keydown",x,l))},M=B=>{(!B.target||!(B.target instanceof HTMLElement)||!c.contains(B.target))&&O()},O=()=>{r&&(r=!1,i(!1),a.value.set(n.get()),window.removeEventListener("focus",M),window.removeEventListener("blur",M),c.removeEventListener("keydown",x))},R=B=>{const{target:L}=B;s.isHTMLElement(L)&&(r||S())},v=()=>{g||(g=!0,c.addEventListener("focus",R,p),window.addEventListener("pointermove",z,l))},z=()=>{g&&(g=!1,c.removeEventListener("focus",R,!0),window.removeEventListener("pointermove",z,l))},$=B=>{const A=B.target.closest('[aria-hidden="true"]');A&&A.removeAttribute("aria-hidden")};window.addEventListener("keydown",v,l),c.addEventListener("pointerdown",$,l),y(()=>{m.abort(),O()})},{flush:"post"})}function Yt(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 He={start:0,end:0},Kt={start:"flex-start",end:"flex-end"},Gt={duration:.2,ease:"linear"},qt={type:"spring",stiffness:400,damping:40};function Ut(o){return o.end-o.start}function Ue(o){return o.length?o[o.length-1].end-o[0].start:0}function Zt(o,t,n){const a=Ue(t),i=Math.max(...t.map(Ut));let r=0,c=0;for(;c<o;)c=(a+n)*(r+1)-i,r++;return Math.max(r-1,0)}function Ze(o=[]){var n;const t=[];for(const a of o)if(a.type!==e.Comment)if(a.type===e.Fragment){const i=Array.isArray(a.children)?a.children:(n=a.children)==null?void 0:n.default();t.push(...Ze(i))}else t.push(a);return t}function we(o){var n;const t=[];for(const a of o)if(a.type==="Fragment"||a.type===e.Fragment){const i=Array.isArray(a.children)?a.children:(n=a.children)==null?void 0:n.default();t.push(...we(i))}else t.push(a);return t}function Je(o,t,n){const a=Math.floor(o/n),i=a*n;let r=0;for(let c=0;c<t.length;c++){const{end:u}=t[c];if(r=c,u+i>o)break}return r+a*t.length}function ke(o,t,n,a){var l;if(t.length===0)return 0;const r=t[t.length-1].end+n,c=a??o+(((l=t[0])==null?void 0:l.end)??0);let y=Je(o,t,r)+1,g=0,m=!1;for(;!m;){const{start:p,end:d}=t[s.wrap(0,t.length,y)],h=Math.floor(y/t.length)*r;g=p+h,d+h>c?m=!0:y++}return g}function Jt(o,t,n,a){const i=o+t;return ke(o,n,a,i)}function be(o,t,n,a,i){if(t.length===0)return 0;const c=t[t.length-1].end+n,u=a??o-(i??0);let g=Je(o,t,c),m=o,l=!1;for(;!l;){const{start:p,end:d}=t[s.wrap(0,t.length,g)],k=d-p,b=Math.floor(g/t.length)*c,I=p+b;u<=I+n||I>=o?(m=I,g--):u<=I?(m=I,l=!0):((i&&k>i||m===o&&u>=I)&&(m=I),l=!0)}return m}function Qt(o,t,n,a){const i=o-t;return be(o,n,a,i,t)}function We(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const en=e.defineComponent({__name:"Ticker",props:{axis:{default:"x"},velocity:{default:50},hoverFactor:{default:1},gap:{default:10},align:{default:"center"},offset:{},itemSize:{default:"auto"},overflow:{type:Boolean,default:!1},loop:{type:Boolean,default:!0},safeMargin:{default:0},fade:{default:0},fadeTransition:{default:()=>Gt},pageTransition:{default:()=>qt},_dragX:{type:[Object,Boolean]},_dragY:{type:[Object,Boolean]},snap:{type:[String,Boolean]},as:{default:"div"},style:{},onDragEnd:{},drag:{type:[Boolean,String]},dragConstraints:{type:[Boolean,Object]},dragMomentum:{type:Boolean}},setup(o){const t=o,n=e.reactive({direction:"ltr",visibleLength:0,inset:0,totalItemLength:0,containerLength:0,itemPositions:[],isMeasured:!1,maxInset:null}),a=e.computed(()=>Kt[t.align]||t.align),i=e.computed(()=>q(t.axis,n.direction).sign),r=e.ref(!1),c=s.useMotionValue(1),u=s.useMotionValue(0),y=e.computed(()=>t.offset??u),g=s.useTransform(()=>n.direction==="rtl"?s.wrap(n.totalItemLength+t.gap+n.inset,n.inset,y.value.get()):s.wrap(-n.totalItemLength-t.gap-n.inset,-n.inset,y.value.get())),m=s.useMotionValue(0),l=e.computed(()=>r.value?m:t.loop?g:y.value),p=s.useDomRef(),d=s.useDomRef(),k=s.useInView(p,{margin:"100px"}),h=s.usePageInView(),b=e.computed(()=>k.value&&h.value),I=s.useReducedMotion(),w=e.useSlots(),f=e.computed(()=>{var C;return Ze((C=w.default)==null?void 0:C.call(w))});function x(){if(!p.value||!d.value)return;const C=window.getComputedStyle(p.value).direction,{measureItem:E,lengthProp:T,viewportLengthProp:P,getCumulativeInset:V}=q(t.axis,C),{safeMargin:N,overflow:F,loop:G}=t,Z=v.value==="x"?"paddingLeft":"paddingTop",se=v.value==="x"?"paddingRight":"paddingBottom",le=p.value,J=d.value.querySelectorAll(".ticker-item");if(!J.length)return;let Pe=!1;const Q=[];for(let ee=0;ee<J.length;ee++){const de=E(J[ee],le);Q.push(de);const pe=n.itemPositions[ee];(!pe||de.start!==pe.start||de.end!==pe.end)&&(Pe=!0)}const ue=Math.min(le[T],window[P]);let ce=t.overflow?window[P]:ue;N>0&&(ce+=N*2);const fe=Ue(Q),Ee=window.getComputedStyle(le),Me=parseInt(Ee[Z]??0),ot=parseInt(Ee[se]??0),ze=F?V(J[0]):Me,at=G===!1?Math.max(0,fe-ue+Me+ot):null;(ce!==n.visibleLength||fe!==n.totalItemLength||ze!==n.inset||n.itemPositions.length!==Q.length||Pe)&&(n.direction=C,n.visibleLength=ce,n.itemPositions=Q,n.totalItemLength=fe,n.inset=ze,n.containerLength=ue,n.maxInset=at,n.isMeasured=!0)}e.watch([f,b,()=>t.overflow],(C,E,T)=>{if(!b.value||!p.value)return;x();const P=t.overflow?s.resize(x):void 0,V=s.resize(p.value,x);T(()=>{P==null||P(),V()})},{immediate:!0,flush:"post"});const S=e.computed(()=>n.totalItemLength>0);s.useAnimationFrame((C,E)=>{if(S.value&&b.value&&y.value===u&&!I.value){const T=E/1e3*(t.velocity*i.value*c.get());y.value.set(y.value.get()-T)}});const M=e.computed(()=>!S.value||!n.visibleLength?0:Zt(n.visibleLength,n.itemPositions,t.gap)),O=e.computed(()=>n.totalItemLength===0?0:(n.totalItemLength+t.gap)*(M.value+1)),R=e.computed(()=>{if(!t.loop)return[];const C=[];for(let E=0;E<M.value;E++){const T=[];f.value.forEach((V,N)=>{let F;const G=n.itemPositions[N],Z=(n.totalItemLength+t.gap)*(E+1),se=G?{start:G.start+Z,end:G.end+Z}:He;T.push(e.createVNode(xe,{key:`clone-${E}-${N}`,offset:l.value,axis:t.axis,listSize:O.value,itemIndex:N,cloneIndex:N,bounds:se,alignItems:a.value,size:t.itemSize,safeMargin:t.safeMargin,numItems:f.value.length},We(F=we([V]))?F:{default:()=>[F]}))});const P=`ticker-group-${E}`;C.push(e.createVNode(s.LayoutGroup,{key:P,id:P},We(T)?T:{default:()=>[T]}))}return C}),v=e.toRef(t,"axis");Xt(p,v,m,y,C=>{r.value=C});const z={display:"flex",position:"relative"},$={display:"flex",position:"relative",willChange:"transform",listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start"};function B(C){return n.maxInset!==null?s.clamp(-n.maxInset,0,C):C}jt({state:n,gap:e.computed(()=>t.gap),clampOffset:B,renderedOffset:l});const L=e.computed(()=>t.axis==="x"?t==null?void 0:t._dragX:t==null?void 0:t._dragY);let A=null;const K=e.computed(()=>n.maxInset!==null?v.value==="x"?i.value>0?{left:n.maxInset*-1,right:0}:{right:n.maxInset,left:0}:{top:n.maxInset*-1,bottom:0}:{});function U(){A&&(A.stop(),A=null)}const re=e.computed(()=>!t.onDragEnd&&t.drag&&L?()=>{L.value.jump(y.value.get()),U()}:t.onPointerDown),W=e.computed(()=>!t.onDragEnd&&t.drag&&L.value?(C,{velocity:E})=>{const T=y.value.get();U(),s.frame.postRender(()=>{let P=T+E[v.value]*(t.snap?.3:.8);if(t.snap)if(E[v.value]<0)P=-ke(-T,n.itemPositions,t.gap,-P);else if(E[v.value]>0)P=-be(-T,n.itemPositions,t.gap,-P,n.containerLength);else{const N=-ke(-T,n.itemPositions,t.gap,-T),F=-be(-T,n.itemPositions,t.gap,-T,n.containerLength);P=Math.abs(T-N)<Math.abs(T-F)?N:F}const V=t.loop?{}:i.value>0?{max:0,min:K.value[v.value==="x"?"left":"top"]}:{min:0,max:K.value.right};A=s.animate(L.value,B(P*i.value)*i.value,t.snap?t.pageTransition:{type:"inertia",velocity:E[v.value],modifyTarget:()=>P,bounceDamping:40,bounceStiffness:400,...V})})}:t.onDragEnd),X=s.useMotionValue(t.loop?0:1),ie=s.useMotionValue(0),tt=e.computed(()=>q(v.value,n.direction)),Te=e.computed(()=>typeof t.fade=="number"?"px":""),Le=s.useTransform(()=>`linear-gradient(to ${tt.value.direction}, rgba(0,0,0,${X.get()}) 0px, black ${t.fade}${Te.value}, black calc(100% - ${t.fade}${Te.value}), rgba(0,0,0,${ie.get()}) 100%)`),nt=e.computed(()=>t.fade?{maskImage:Le,WebkitMaskImage:Le}:{}),j={start:!0,end:!1};return e.watch(l,(C,E,T)=>{const P=N=>{if(n.maxInset===null)return;const F=n.maxInset*-1;N*=i.value,N<0?j.start&&(s.animate(X,0,t.fadeTransition),j.start=!1):j.start||(s.animate(X,1,t.fadeTransition),j.start=!0),N>F?j.end&&(s.animate(ie,0,t.fadeTransition),j.end=!1):j.end||(s.animate(ie,1,t.fadeTransition),j.end=!0)};let V=()=>{};C&&(V=C.on("change",P)),T(V)},{immediate:!0}),(C,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(s.Motion),e.mergeProps(C.$attrs,{ref_key:"containerRef",ref:p,as:C.as,style:{overflowX:!C.overflow&&v.value==="x"?"clip":void 0,overflowY:!C.overflow&&v.value==="y"?"clip":void 0,...z,...t.style,...nt.value},drag:C.drag,_dragX:C._dragX,_dragY:C._dragY,"drag-constraints":K.value,"drag-momentum":C.dragMomentum,onPointerenter:E[0]||(E[0]=()=>{e.unref(s.animate)(e.unref(c),C.hoverFactor)}),onPointerleave:E[1]||(E[1]=()=>{e.unref(s.animate)(e.unref(c),1)}),onPointerdown:re.value,onDragEnd:W.value}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).ul,{ref_key:"listRef",ref:d,role:"group",style:e.normalizeStyle({...$,flexDirection:v.value==="x"?"row":"column",gap:`${C.gap}px`,x:v.value==="x"?l.value:0,y:v.value==="y"?l.value:0,opacity:S.value?1:0,alignItems:a.value,willChange:S.value&&b.value?"transform":void 0,width:"100%",height:"100%",maxHeight:"100%",maxWidth:"100%"})},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(T,P)=>(e.openBlock(),e.createBlock(xe,{key:`original-${P}`,axis:v.value,offset:l.value,"list-size":O.value,"item-index":P,bounds:n.itemPositions[P]??e.unref(He),"align-items":a.value,size:C.itemSize,reproject:C.loop,"safe-margin":C.safeMargin,"num-items":f.value.length},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(we)([T]),(V,N)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V),{key:N}))),128))]),_:2},1032,["axis","offset","list-size","item-index","bounds","align-items","size","reproject","safe-margin","num-items"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,T=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(T),{key:T.key}))),128))]),_:1},8,["style"])]),_:1},16,["as","style","drag","_dragX","_dragY","drag-constraints","drag-momentum","onPointerdown","onDragEnd"]),e.renderSlot(C.$slots,"after")],64))}}),Qe=en,tn={slow:130,normal:75,fast:30},nn=e.defineComponent({__name:"Typewriter",props:e.mergeDefaults({as:{},speed:{},variance:{},play:{type:Boolean},cursorClassName:{},cursorStyle:{},textClassName:{},textStyle:{},cursorBlinkDuration:{},onComplete:{type:Function},replace:{},backspace:{},backspaceFactor:{}},{as:"span",speed:"normal",variance:"natural",cursorClassName:"motion-typewriter-cursor",play:!0,cursorBlinkDuration:.5,replace:"type",backspace:"character",backspaceFactor:.2}),setup(o){const t=o,n=e.useSlots();function a(){var k;return(((k=n==null?void 0:n.default)==null?void 0:k.call(n))??[]).map(h=>typeof h.children=="string"?h.children:"").join("")}let i=a();const r=s.useMotionValue("");e.watchEffect(()=>{const d=a();t.replace==="all"&&d!==i&&r.set(""),i=d});const c=e.ref();let u=null;const y=e.computed(()=>typeof t.speed=="number"?t.speed:tn[t.speed]);function g(){c.value&&(u=s.animate(c.value,{opacity:[1,1,0,0]},{duration:t.cursorBlinkDuration,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"}))}let m=null;function l(){m==null||m(),m=null}function p(){if(!t.play){g(),l();return}u==null||u.cancel();const d=a(),k=()=>{var I;const b=Y.getNextText(r.get(),d,t.replace,t.backspace);r.set(b),b!==d?h():(g(),(I=t.onComplete)==null||I.call(t))},h=()=>{m=s.delayInMs(k,Y.getTypewriterDelay(d,r.get(),y.value,t.variance,t.backspaceFactor))};m||h()}return e.watchEffect(d=>{p(),d(l)}),e.onMounted(()=>{p()}),(d,k)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),{"aria-label":e.unref(i)},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(t.textClassName),style:e.normalizeStyle(t.textStyle)},[e.createVNode(e.unref(s.RowValue),{value:e.unref(r)},null,8,["value"])],6),e.createElementVNode("span",{ref_key:"cursorRef",ref:c,class:e.normalizeClass(t.cursorClassName),style:e.normalizeStyle({display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...t.cursorStyle})},null,6)]),_:1},8,["aria-label"]))}}),[on,an]=s.createContext("CarouselContext"),rn={type:"spring",stiffness:200,damping:40},sn={type:"spring",stiffness:80,damping:10};function et(o,t,n,a=!0){const i={insets:[],visibleLength:t};if(o.length===0)return i;const r=[o[0].start];for(let c=1;c<o.length;c++){const{start:u,end:y}=o[c];if(r[r.length-1]+t<y)if(n!==null)if(u<=n)r.push(u);else{r.push(n);break}else r.push(u)}if(a&&n!==null&&r.length>1){const c=r[r.length-1],u=[];for(let m=0;m<r.length-1;m++)u.push(r[m+1]-r[m]);const y=u.reduce((m,l)=>m+l,0)/u.length;if(n-c<y*.5){const m=et(o,t*.75,n,!1);if(m.insets.length===r.length)return m}}return{insets:r,visibleLength:t}}function ln(o,t,n,a){const i=-o,r=a===null?Math.floor(i/n):0,c=r*n;for(let u=t.length-1;u>=0;u--){const y=t[u]+c,g=s.wrap(0,t.length,u-1),l=(u===0?r-1:r)*n,p=t[g]+l,d=(y-p)/2,k=s.wrap(0,t.length,u+1),b=(u===t.length-1?r+1:r)*n,I=t[k]+b,w=(I-y)/2;if(i<I-w&&i>=p+d)return u}return 0}const un=e.defineComponent({__name:"CarouselView",props:{offset:{},targetOffset:{},tugOffset:{},loop:{type:Boolean},transition:{},axis:{default:"x"},snap:{type:[String,Boolean],default:"page"},tickerRef:{},page:{}},setup(o){const t=o;let n=!0;const{state:a,gap:i,clampOffset:r}=Be(),c=e.computed(()=>a.totalItemLength+i.value),u=e.computed(()=>et(a.itemPositions,a.containerLength,a.maxInset)),y=e.computed(()=>u.value.insets.length),g=e.computed(()=>q(t.axis,a.direction).sign);function m(v){const z=ln(v*g.value,u.value.insets,c.value,a.maxInset),$=t.loop?!0:v*-g.value<a.maxInset,B=t.loop?!0:v*-g.value>0;return{current:z,isNextActive:$,isPrevActive:B}}const l=e.ref(m(t.targetOffset.get()));function p(){const v=m(t.targetOffset.get());(v.current!==l.value.current||v.isNextActive!==l.value.isNextActive||v.isPrevActive!==l.value.isPrevActive)&&(l.value=v)}e.watch([()=>a.containerLength,()=>a.totalItemLength],p,{immediate:!0,flush:"post"}),s.useMotionValueEvent(t.targetOffset,"change",v=>{t.offset.set(v),p()});let d=null;function k(){d&&(d.stop(),d=null)}e.onMounted(()=>{t.offset.attach((v,z)=>{k(),n?z(v):d=new s.JSAnimation({keyframes:[t.offset.get(),v],velocity:s.clamp(-2e3,2e3,t.offset.getVelocity()),...t.transition,onUpdate:z,onComplete:()=>{d=null}}),n=!0},k)});function h(v){const z=r(v);t.targetOffset.stop(),n=!1,t.targetOffset.set(z*g.value)}function b(v,z){const $=-v(-t.targetOffset.get()*g.value,u.value.visibleLength,a.itemPositions,i.value),B=r($);B*g.value===t.targetOffset.get()?s.animate(t.tugOffset,0,{velocity:z*g.value*400,...sn}):h(B)}const I=()=>b(Jt,-1),w=()=>b(Qt,1);function f(v){const $=(t.loop?Math.floor(-t.targetOffset.get()*g.value/c.value):0)*-c.value;h(-u.value.insets[v]+$)}const{axis:x,snap:S,offset:M}=e.toRefs(t);e.watch([x,S,M,g,()=>t.tickerRef],(v,z,$)=>{t.tickerRef&&$(Y.wheel(t.tickerRef,{axis:x.value,onSwipe:S.value?B=>{B*g.value===1?I():w()}:void 0,onWheel:B=>{const L=M.value.get()+B,A=g.value>0?r(L):s.clamp(0,a.maxInset,L);t.targetOffset.jump(a.maxInset?A:L)}}))},{immediate:!0,flush:"post"});let O=!1,R;return e.watch([()=>a.isMeasured,y,()=>t.page,g,()=>t.targetOffset,()=>t.offset,()=>u.value.insets],([v,z])=>{const $=t.page;if($===void 0||!v||!z)return;const B=s.clamp(0,z-1,$),L=-u.value.insets[B]*g.value;O?R!==$&&(R=$,t.targetOffset.jump(L),t.offset.jump(L)):(O=!0,R=$,t.targetOffset.jump(L),t.offset.jump(L))},{immediate:!0,flush:"post"}),an({paginationState:l,totalPages:y,nextPage:I,prevPage:w,gotoPage:f,targetOffset:t.targetOffset}),(v,z)=>e.renderSlot(v.$slots,"default")}}),cn=e.defineComponent({name:"Carousel",inheritAttrs:!1,__name:"Carousel",props:{snap:{type:[String,Boolean],default:"page"},transition:{default:()=>({...rn})},page:{},axis:{default:"x"},gap:{},align:{},itemSize:{},overflow:{type:Boolean},loop:{type:Boolean,default:!0},safeMargin:{},fade:{},fadeTransition:{},pageTransition:{},_dragX:{type:[Object,Boolean]},_dragY:{type:[Object,Boolean]},as:{},style:{},onDragEnd:{},drag:{type:[Boolean,String]},dragConstraints:{type:[Boolean,Object]},dragMomentum:{type:Boolean}},setup(o){const t=o,n=s.useMotionValue(0),a=s.useMotionValue(0),i=s.useMotionValue(0),r=s.useTransform(()=>i.get()+a.get()),c=s.useDomRef();return(u,y)=>(e.openBlock(),e.createBlock(e.unref(Qe),e.mergeProps({...t,...u.$attrs},{ref_key:"tickerRef",ref:c,role:"region","aria-roledescription":"carousel",offset:e.unref(r),loop:u.loop,axis:u.axis,drag:u.axis,"_drag-x":u.axis==="x"?e.unref(n):!1,"_drag-y":u.axis==="y"?e.unref(n):!1,snap:u.snap,"page-transition":u.transition}),{after:e.withCtx(()=>[e.createVNode(un,{"ticker-ref":e.unref(c),loop:u.loop,offset:e.unref(a),"tug-offset":e.unref(i),"target-offset":e.unref(n),transition:u.transition,snap:u.snap,axis:u.axis,page:u.page},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"after")]),_:3},8,["ticker-ref","loop","offset","tug-offset","target-offset","transition","snap","axis","page"])]),default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3},16,["offset","loop","axis","drag","_drag-x","_drag-y","snap","page-transition"]))}}),fn=e.defineComponent({__name:"ScrambleText",props:e.mergeDefaults({text:{},as:{},active:{type:Boolean},delay:{type:[Number,Function]},duration:{type:[Number,Function]},interval:{},chars:{},onComplete:{type:Function}},{as:"span",active:!0,delay:0,duration:1,interval:.05}),setup(o){const t=o,n=s.useMotionValue(t.text);let a=null;function i(){a==null||a.stop(),n.set(t.text),a=Y.scrambleText(n,{delay:t.delay,duration:t.duration,interval:t.interval,chars:t.chars,onComplete:()=>{var r;return(r=t.onComplete)==null?void 0:r.call(t)}}),t.active||a.finish()}return e.watch(()=>[t.active,t.text,t.delay,t.duration,t.interval,t.chars],()=>{i()},{immediate:!0}),e.onUnmounted(()=>{a==null||a.stop()}),(r,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),null,{default:e.withCtx(()=>[e.createVNode(e.unref(s.RowValue),{value:e.unref(n)},null,8,["value"])]),_:1}))}});exports.AnimateNumber=gt;exports.Carousel=cn;exports.Cursor=_t;exports.ScrambleText=fn;exports.Ticker=Qe;exports.TickerItem=xe;exports.Typewriter=nn;exports.useCarousel=on;exports.useCursorIsInView=Ke;exports.useCursorState=Se;exports.useMagneticPull=Rt;exports.usePointerPosition=Ce;exports.useTicker=Be;exports.useTickerItem=At;Object.keys(Y).forEach(o=>{o!=="default"&&!Object.prototype.hasOwnProperty.call(exports,o)&&Object.defineProperty(exports,o,{enumerable:!0,get:()=>Y[o]})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MotionProps } from 'motion-v';
|
|
2
|
+
import { Trend } from './types';
|
|
2
3
|
export interface AnimateNumberProps {
|
|
3
4
|
locales?: Intl.LocalesArgument;
|
|
4
5
|
format?: Omit<Intl.NumberFormatOptions, 'notation'> & {
|
|
@@ -10,6 +11,7 @@ export interface AnimateNumberProps {
|
|
|
10
11
|
value?: number | bigint | string;
|
|
11
12
|
style?: MotionProps['style'];
|
|
12
13
|
layoutDependency?: MotionProps['layoutDependency'];
|
|
14
|
+
trend?: Trend;
|
|
13
15
|
}
|
|
14
16
|
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
17
|
export default _default;
|
|
@@ -9,6 +9,7 @@ export interface AnimateNumberProps {
|
|
|
9
9
|
name?: string;
|
|
10
10
|
style?: MotionProps['style'];
|
|
11
11
|
layoutDependency?: MotionProps['layoutDependency'];
|
|
12
|
+
trend?: number;
|
|
12
13
|
}
|
|
13
14
|
declare const _default: import('vue').DefineComponent<AnimateNumberProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnimateNumberProps> & Readonly<{}>, {
|
|
14
15
|
justify: Justify;
|
|
@@ -8,6 +8,7 @@ export interface NumberDigitProps {
|
|
|
8
8
|
onRemove?: (partKey: string, target: HTMLElement) => void;
|
|
9
9
|
style?: MotionProps['style'];
|
|
10
10
|
layoutDependency?: MotionProps['layoutDependency'];
|
|
11
|
+
trend?: number;
|
|
11
12
|
}
|
|
12
13
|
export interface AnimateSymbolProps {
|
|
13
14
|
partKey: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { formatToParts as
|
|
3
|
-
import { useMotionConfig as
|
|
4
|
-
import
|
|
5
|
-
import { maskHeight as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as x, computed as d, createBlock as D, openBlock as L, unref as r, withCtx as i, createVNode as n, mergeProps as A, normalizeStyle as c } from "vue";
|
|
2
|
+
import { formatToParts as C } from "./utils/format-parts.mjs";
|
|
3
|
+
import { useMotionConfig as T, easeOut as $, LayoutGroup as F, MotionConfig as k, motion as f } from "motion-v";
|
|
4
|
+
import p from "./NumberSection.vue.mjs";
|
|
5
|
+
import { maskHeight as m } from "./config.mjs";
|
|
6
|
+
import w from "./Mask.vue.mjs";
|
|
7
|
+
const E = /* @__PURE__ */ x({
|
|
8
8
|
name: "AnimateNumber",
|
|
9
9
|
inheritAttrs: !1,
|
|
10
10
|
__name: "AnimateNumber",
|
|
@@ -16,48 +16,55 @@ const P = /* @__PURE__ */ h({
|
|
|
16
16
|
prefix: {},
|
|
17
17
|
value: {},
|
|
18
18
|
style: {},
|
|
19
|
-
layoutDependency: {}
|
|
19
|
+
layoutDependency: {},
|
|
20
|
+
trend: { type: [Number, Function] }
|
|
20
21
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
opacity: { duration: 1, ease:
|
|
22
|
+
setup(v) {
|
|
23
|
+
const g = {
|
|
24
|
+
opacity: { duration: 1, ease: $ },
|
|
24
25
|
layout: { type: "spring", duration: 1, bounce: 0 },
|
|
25
26
|
y: { type: "spring", duration: 1, bounce: 0 }
|
|
26
|
-
}, e =
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
}, e = v, l = d(() => {
|
|
28
|
+
const t = e.value;
|
|
29
|
+
return C(t, { locales: e.locales, format: e.format }, e.prefix, e.suffix);
|
|
30
|
+
});
|
|
31
|
+
let y = typeof e.value == "string" ? Number.parseFloat(e.value) : Number(e.value ?? 0);
|
|
32
|
+
const s = d(() => {
|
|
33
|
+
const t = typeof e.value == "string" ? Number.parseFloat(e.value) : Number(e.value ?? 0), o = e.trend;
|
|
34
|
+
let u;
|
|
35
|
+
return typeof o == "function" ? u = o(y, t) : o !== void 0 ? u = o : u = Math.sign(t - y), y = t, u;
|
|
36
|
+
}), _ = T(), b = d(() => e.transition ?? _.value.transition ?? g);
|
|
37
|
+
function h() {
|
|
38
|
+
const { format: t, prefix: o, suffix: u, locales: I, value: M, layoutDependency: S, trend: V, ...N } = e;
|
|
39
|
+
return N;
|
|
33
40
|
}
|
|
34
|
-
const a =
|
|
41
|
+
const a = d(() => {
|
|
35
42
|
if (e.layoutDependency !== void 0)
|
|
36
43
|
return { layoutDependency: e.layoutDependency, value: e.value };
|
|
37
44
|
});
|
|
38
|
-
return (
|
|
45
|
+
return (t, o) => (L(), D(r(F), null, {
|
|
39
46
|
default: i(() => [
|
|
40
|
-
|
|
47
|
+
n(r(k), { transition: b.value }, {
|
|
41
48
|
default: i(() => [
|
|
42
|
-
|
|
43
|
-
...
|
|
44
|
-
...
|
|
49
|
+
n(r(f).div, A({
|
|
50
|
+
...t.$attrs,
|
|
51
|
+
...h()
|
|
45
52
|
}, {
|
|
46
53
|
layout: "",
|
|
47
54
|
"layout-dependency": a.value,
|
|
48
55
|
style: {
|
|
49
56
|
lineHeight: "1",
|
|
50
|
-
...
|
|
57
|
+
...t.style,
|
|
51
58
|
display: "inline-flex",
|
|
52
59
|
isolation: "isolate",
|
|
53
60
|
whiteSpace: "nowrap"
|
|
54
61
|
}
|
|
55
62
|
}), {
|
|
56
63
|
default: i(() => [
|
|
57
|
-
|
|
64
|
+
n(r(f).div, {
|
|
58
65
|
layout: "",
|
|
59
66
|
"layout-dependency": a.value,
|
|
60
|
-
"aria-label":
|
|
67
|
+
"aria-label": l.value.formatted,
|
|
61
68
|
style: {
|
|
62
69
|
display: "inline-flex",
|
|
63
70
|
direction: "ltr",
|
|
@@ -67,43 +74,47 @@ const P = /* @__PURE__ */ h({
|
|
|
67
74
|
}
|
|
68
75
|
}, {
|
|
69
76
|
default: i(() => [
|
|
70
|
-
|
|
77
|
+
n(p, {
|
|
71
78
|
"layout-dependency": a.value,
|
|
72
|
-
style:
|
|
79
|
+
style: c({ padding: `calc(${r(m)}/2) 0` }),
|
|
73
80
|
"aria-hidden": !0,
|
|
74
81
|
justify: "right",
|
|
75
82
|
mode: "popLayout",
|
|
76
|
-
parts:
|
|
77
|
-
name: "pre"
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
parts: l.value.pre,
|
|
84
|
+
name: "pre",
|
|
85
|
+
trend: s.value
|
|
86
|
+
}, null, 8, ["layout-dependency", "style", "parts", "trend"]),
|
|
87
|
+
n(w, { "layout-dependency": a.value }, {
|
|
80
88
|
default: i(() => [
|
|
81
|
-
|
|
89
|
+
n(p, {
|
|
82
90
|
"layout-dependency": a.value,
|
|
83
91
|
justify: "right",
|
|
84
|
-
parts:
|
|
92
|
+
parts: l.value.integer,
|
|
85
93
|
name: "integer",
|
|
86
|
-
mode: "popLayout"
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
mode: "popLayout",
|
|
95
|
+
trend: s.value
|
|
96
|
+
}, null, 8, ["layout-dependency", "parts", "trend"]),
|
|
97
|
+
n(p, {
|
|
89
98
|
"layout-dependency": a.value,
|
|
90
99
|
layout: "position",
|
|
91
|
-
parts:
|
|
100
|
+
parts: l.value.fraction,
|
|
92
101
|
name: "fraction",
|
|
93
|
-
mode: "popLayout"
|
|
94
|
-
|
|
102
|
+
mode: "popLayout",
|
|
103
|
+
trend: s.value
|
|
104
|
+
}, null, 8, ["layout-dependency", "parts", "trend"])
|
|
95
105
|
]),
|
|
96
106
|
_: 1
|
|
97
107
|
}, 8, ["layout-dependency"]),
|
|
98
|
-
|
|
108
|
+
n(p, {
|
|
99
109
|
"layout-dependency": a.value,
|
|
100
|
-
style:
|
|
110
|
+
style: c({ padding: `calc(${r(m)}/2) 0` }),
|
|
101
111
|
"aria-hidden": !0,
|
|
102
112
|
layout: "position",
|
|
103
113
|
mode: "popLayout",
|
|
104
|
-
parts:
|
|
105
|
-
name: "post"
|
|
106
|
-
|
|
114
|
+
parts: l.value.post,
|
|
115
|
+
name: "post",
|
|
116
|
+
trend: s.value
|
|
117
|
+
}, null, 8, ["layout-dependency", "style", "parts", "trend"])
|
|
107
118
|
]),
|
|
108
119
|
_: 1
|
|
109
120
|
}, 8, ["layout-dependency", "aria-label"])
|
|
@@ -119,5 +130,5 @@ const P = /* @__PURE__ */ h({
|
|
|
119
130
|
}
|
|
120
131
|
});
|
|
121
132
|
export {
|
|
122
|
-
|
|
133
|
+
E as default
|
|
123
134
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useMotionConfig as
|
|
3
|
-
import { useIsInitialRender as
|
|
4
|
-
import { digitFillStyle as
|
|
5
|
-
import { useAnimate as
|
|
6
|
-
import { getWidthInEm as
|
|
7
|
-
import { targetWidths as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as T, ref as c, watch as v, nextTick as x, computed as I, createBlock as d, openBlock as o, unref as l, normalizeStyle as h, withCtx as z, createElementVNode as H, createElementBlock as f, createCommentVNode as N, Fragment as P, renderList as E, resolveDynamicComponent as k, createVNode as L } from "vue";
|
|
2
|
+
import { useMotionConfig as Y, motion as $, animate as q } from "motion-v";
|
|
3
|
+
import { useIsInitialRender as G } from "./hooks/use-is-initial-render.mjs";
|
|
4
|
+
import { digitFillStyle as M, maskHeight as J } from "./config.mjs";
|
|
5
|
+
import { useAnimate as O } from "./use-animate.mjs";
|
|
6
|
+
import { getWidthInEm as Q } from "./utils/get-width-in-ems.mjs";
|
|
7
|
+
import { targetWidths as U } from "./utils/target-widths.mjs";
|
|
8
|
+
const re = /* @__PURE__ */ T({
|
|
9
9
|
__name: "NumberDigit",
|
|
10
10
|
props: {
|
|
11
11
|
value: {},
|
|
@@ -18,83 +18,102 @@ const Z = /* @__PURE__ */ _({
|
|
|
18
18
|
partKey: {},
|
|
19
19
|
onRemove: {},
|
|
20
20
|
style: {},
|
|
21
|
-
layoutDependency: {}
|
|
21
|
+
layoutDependency: {},
|
|
22
|
+
trend: {}
|
|
22
23
|
},
|
|
23
|
-
setup(
|
|
24
|
-
const a =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
setup(W) {
|
|
25
|
+
const a = W;
|
|
26
|
+
function C(e, t) {
|
|
27
|
+
return (e % t + t) % t;
|
|
28
|
+
}
|
|
29
|
+
const p = a.initialValue ?? a.value, b = G(), _ = Y(), s = c(), m = c(Array(10).fill(null)), w = c(), {
|
|
30
|
+
getRoot: j,
|
|
31
|
+
handleComplete: A,
|
|
27
32
|
root: u
|
|
28
|
-
} =
|
|
29
|
-
let
|
|
30
|
-
const
|
|
33
|
+
} = O(a);
|
|
34
|
+
let r = p;
|
|
35
|
+
const i = c(p);
|
|
31
36
|
v([() => a.value, () => a.isPresent], ([e, t]) => {
|
|
32
37
|
if (!t)
|
|
33
|
-
return
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
36
|
-
|
|
38
|
+
return i.value = 0;
|
|
39
|
+
if (b.current)
|
|
40
|
+
return x(() => {
|
|
41
|
+
i.value = e;
|
|
37
42
|
});
|
|
38
|
-
|
|
43
|
+
i.value = e;
|
|
39
44
|
}, {
|
|
40
45
|
immediate: !0
|
|
41
46
|
});
|
|
42
|
-
function
|
|
43
|
-
var
|
|
44
|
-
if (!
|
|
45
|
-
const t =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
function F(e) {
|
|
48
|
+
var V;
|
|
49
|
+
if (!s.value || e === r) return;
|
|
50
|
+
const t = s.value.getBoundingClientRect(), n = (V = u.value) == null ? void 0 : V.getBoundingClientRect(), R = a.trend ?? 0;
|
|
51
|
+
let g = e - r;
|
|
52
|
+
R > 0 && e < r ? g = 10 - r + e : R < 0 && e > r && (g = e - 10 - r);
|
|
53
|
+
const S = t.height * g + (t.top - (n ? n.top || 0 : t.top));
|
|
54
|
+
q(s.value, {
|
|
55
|
+
y: [S, 0]
|
|
56
|
+
}, _.value.transition);
|
|
49
57
|
}
|
|
50
|
-
function
|
|
51
|
-
if (
|
|
52
|
-
const t =
|
|
53
|
-
u.value && (
|
|
58
|
+
function K(e) {
|
|
59
|
+
if (b.current && p === e || !m.value[e]) return;
|
|
60
|
+
const t = Q(m.value[e]);
|
|
61
|
+
u.value && (U.set(u.value, t), u.value.style.width = t), w.value = t;
|
|
54
62
|
}
|
|
55
|
-
v(
|
|
56
|
-
|
|
63
|
+
v(i, (e) => {
|
|
64
|
+
K(e);
|
|
57
65
|
}, {
|
|
58
66
|
immediate: !0,
|
|
59
67
|
flush: "sync"
|
|
60
|
-
}), v(
|
|
61
|
-
await
|
|
62
|
-
|
|
68
|
+
}), v(i, async (e, t, n) => {
|
|
69
|
+
await x(), F(e), n(() => {
|
|
70
|
+
r = e;
|
|
63
71
|
});
|
|
64
72
|
}, {
|
|
65
73
|
immediate: !0,
|
|
66
74
|
flush: "sync"
|
|
67
75
|
});
|
|
68
76
|
function y(e) {
|
|
69
|
-
return () =>
|
|
77
|
+
return () => L("span", {
|
|
70
78
|
key: e,
|
|
71
79
|
style: {
|
|
72
80
|
display: "inline-block",
|
|
73
|
-
padding: `calc(${
|
|
81
|
+
padding: `calc(${J}/2) 0`
|
|
74
82
|
},
|
|
75
83
|
ref: (t) => {
|
|
76
|
-
|
|
84
|
+
m.value[e] = t;
|
|
77
85
|
}
|
|
78
86
|
}, [e]);
|
|
79
87
|
}
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
const D = I(() => {
|
|
89
|
+
const e = [];
|
|
90
|
+
for (let t = 9; t >= 1; t--)
|
|
91
|
+
e.push(C(i.value - t, 10));
|
|
92
|
+
return e;
|
|
93
|
+
}), B = I(() => {
|
|
94
|
+
const e = [];
|
|
95
|
+
for (let t = 1; t <= 9; t++)
|
|
96
|
+
e.push(C(i.value + t, 10));
|
|
97
|
+
return e;
|
|
98
|
+
});
|
|
99
|
+
return (e, t) => (o(), d(l($).span, {
|
|
100
|
+
ref: l(j),
|
|
82
101
|
layout: "position",
|
|
83
102
|
"layout-dependency": e.layoutDependency,
|
|
84
103
|
"data-state": e.isPresent ? void 0 : "exiting",
|
|
85
104
|
"data-key": e.partKey,
|
|
86
|
-
style:
|
|
105
|
+
style: h({
|
|
87
106
|
display: "inline-flex",
|
|
88
107
|
justifyContent: "center",
|
|
89
|
-
width:
|
|
108
|
+
width: w.value,
|
|
90
109
|
pointerEvents: e.isPresent ? void 0 : "none"
|
|
91
110
|
}),
|
|
92
111
|
"aria-hidden": !e.isPresent,
|
|
93
|
-
onMotioncomplete: l(
|
|
112
|
+
onMotioncomplete: l(A)
|
|
94
113
|
}, {
|
|
95
|
-
default:
|
|
114
|
+
default: z(() => [H("span", {
|
|
96
115
|
ref_key: "scope",
|
|
97
|
-
ref:
|
|
116
|
+
ref: s,
|
|
98
117
|
style: {
|
|
99
118
|
display: "inline-flex",
|
|
100
119
|
justifyContent: "center",
|
|
@@ -102,29 +121,29 @@ const Z = /* @__PURE__ */ _({
|
|
|
102
121
|
alignItems: "center",
|
|
103
122
|
position: "relative"
|
|
104
123
|
}
|
|
105
|
-
}, [
|
|
124
|
+
}, [D.value.length > 0 ? (o(), f("span", {
|
|
106
125
|
key: 0,
|
|
107
|
-
style:
|
|
108
|
-
...l(
|
|
126
|
+
style: h({
|
|
127
|
+
...l(M),
|
|
109
128
|
bottom: "100%",
|
|
110
129
|
left: 0
|
|
111
130
|
})
|
|
112
|
-
}, [(o(!0),
|
|
113
|
-
key:
|
|
114
|
-
}))), 128))], 4)) :
|
|
131
|
+
}, [(o(!0), f(P, null, E(D.value, (n) => (o(), d(k(y(n)), {
|
|
132
|
+
key: n
|
|
133
|
+
}))), 128))], 4)) : N("", !0), (o(), d(k(y(i.value)))), B.value.length > 0 ? (o(), f("span", {
|
|
115
134
|
key: 1,
|
|
116
|
-
style:
|
|
117
|
-
...l(
|
|
135
|
+
style: h({
|
|
136
|
+
...l(M),
|
|
118
137
|
top: "100%",
|
|
119
138
|
left: 0
|
|
120
139
|
})
|
|
121
|
-
}, [(o(!0),
|
|
122
|
-
key: n
|
|
123
|
-
}))), 128))], 4)) :
|
|
140
|
+
}, [(o(!0), f(P, null, E(B.value, (n) => (o(), d(k(y(n)), {
|
|
141
|
+
key: n
|
|
142
|
+
}))), 128))], 4)) : N("", !0)], 512)]),
|
|
124
143
|
_: 1
|
|
125
144
|
}, 8, ["layout-dependency", "data-state", "data-key", "style", "aria-hidden", "onMotioncomplete"]));
|
|
126
145
|
}
|
|
127
146
|
});
|
|
128
147
|
export {
|
|
129
|
-
|
|
148
|
+
re as default
|
|
130
149
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as I, ref as
|
|
1
|
+
import { defineComponent as I, ref as d, watch as x, nextTick as D, toRef as E, createBlock as c, openBlock as u, unref as y, normalizeStyle as $, normalizeClass as B, withCtx as R, createElementVNode as N, createTextVNode as S, createVNode as _, createElementBlock as w, Fragment as P, renderList as b } from "vue";
|
|
2
2
|
import { useDomRef as M, motion as T, AnimatePresence as V } from "motion-v";
|
|
3
3
|
import { injectSectionContext as z } from "./context.mjs";
|
|
4
4
|
import { useIsInitialRender as A } from "./hooks/use-is-initial-render.mjs";
|
|
@@ -13,18 +13,19 @@ const Q = /* @__PURE__ */ I({
|
|
|
13
13
|
mode: {},
|
|
14
14
|
name: {},
|
|
15
15
|
style: {},
|
|
16
|
-
layoutDependency: {}
|
|
16
|
+
layoutDependency: {},
|
|
17
|
+
trend: {}
|
|
17
18
|
},
|
|
18
19
|
setup(C) {
|
|
19
|
-
var
|
|
20
|
-
const o = C,
|
|
21
|
-
let k = o.name === "pre" && !((
|
|
22
|
-
|
|
20
|
+
var g;
|
|
21
|
+
const o = C, m = d(), p = M(), a = d(), v = A(), l = d(o.parts);
|
|
22
|
+
let k = o.name === "pre" && !((g = o.parts) != null && g.length) ? void 0 : !1;
|
|
23
|
+
x(() => o.parts, (n) => {
|
|
23
24
|
const i = new Map(n.map((t) => [t.key, { ...t, isPresent: !0 }])), e = l.value.filter((t) => !i.get(t.key)).map(
|
|
24
25
|
(t) => ({ ...t, isPresent: !1 })
|
|
25
26
|
), s = n.sort((t, r) => t.originalIndex - r.originalIndex);
|
|
26
27
|
l.value = e.concat(s);
|
|
27
|
-
}, { flush: "pre" }),
|
|
28
|
+
}, { flush: "pre" }), x(() => {
|
|
28
29
|
var n;
|
|
29
30
|
return (n = o.parts) == null ? void 0 : n.map((i) => i.value).join("");
|
|
30
31
|
}, async (n, i) => {
|
|
@@ -42,7 +43,7 @@ const Q = /* @__PURE__ */ I({
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
}), s = j(a.value);
|
|
45
|
-
|
|
46
|
+
m.value = s;
|
|
46
47
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
47
48
|
const r = e[t];
|
|
48
49
|
r && r();
|
|
@@ -56,20 +57,20 @@ const Q = /* @__PURE__ */ I({
|
|
|
56
57
|
var e;
|
|
57
58
|
l.value = l.value.filter((s) => s.key !== n), (e = i == null ? void 0 : i.parentElement) == null || e.removeChild(i);
|
|
58
59
|
}
|
|
59
|
-
return (n, i) => (u(),
|
|
60
|
+
return (n, i) => (u(), c(y(T).span, {
|
|
60
61
|
ref: y(p),
|
|
61
|
-
class:
|
|
62
|
-
style:
|
|
62
|
+
class: B(`number-section-${n.name}`),
|
|
63
|
+
style: $({
|
|
63
64
|
...n.style,
|
|
64
65
|
display: "inline-flex",
|
|
65
66
|
justifyContent: f.value,
|
|
66
|
-
width:
|
|
67
|
+
width: m.value
|
|
67
68
|
}),
|
|
68
69
|
layout: "position",
|
|
69
70
|
"layout-dependency": n.layoutDependency
|
|
70
71
|
}, {
|
|
71
72
|
default: R(() => [
|
|
72
|
-
|
|
73
|
+
N("span", {
|
|
73
74
|
ref_key: "measuredRef",
|
|
74
75
|
ref: a,
|
|
75
76
|
style: {
|
|
@@ -78,8 +79,8 @@ const Q = /* @__PURE__ */ I({
|
|
|
78
79
|
position: "relative"
|
|
79
80
|
}
|
|
80
81
|
}, [
|
|
81
|
-
i[0] || (i[0] =
|
|
82
|
-
|
|
82
|
+
i[0] || (i[0] = S(" ")),
|
|
83
|
+
_(y(V), {
|
|
83
84
|
mode: n.mode,
|
|
84
85
|
"anchor-x": f.value,
|
|
85
86
|
initial: !1
|
|
@@ -88,7 +89,7 @@ const Q = /* @__PURE__ */ I({
|
|
|
88
89
|
(u(!0), w(P, null, b(l.value, (e) => (u(), w(P, {
|
|
89
90
|
key: e.key
|
|
90
91
|
}, [
|
|
91
|
-
e.type === "integer" || e.type === "fraction" ? (u(),
|
|
92
|
+
e.type === "integer" || e.type === "fraction" ? (u(), c(F, {
|
|
92
93
|
key: e.key,
|
|
93
94
|
"part-key": e.key,
|
|
94
95
|
initial: { opacity: 0 },
|
|
@@ -98,8 +99,9 @@ const Q = /* @__PURE__ */ I({
|
|
|
98
99
|
"is-present": e.isPresent ?? !0,
|
|
99
100
|
"initial-value": y(v).current ? void 0 : 0,
|
|
100
101
|
"layout-dependency": n.layoutDependency,
|
|
102
|
+
trend: n.trend,
|
|
101
103
|
onRemove: h
|
|
102
|
-
}, null, 8, ["part-key", "value", "is-present", "initial-value", "layout-dependency"])) : (u(),
|
|
104
|
+
}, null, 8, ["part-key", "value", "is-present", "initial-value", "layout-dependency", "trend"])) : (u(), c(L, {
|
|
103
105
|
key: e.type === "literal" ? `${e.key}:${e.value}` : e.key,
|
|
104
106
|
type: e.type,
|
|
105
107
|
"part-key": e.key,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-plus-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Motion Plus Vue",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -72,7 +72,15 @@
|
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"path": "dist/size.carousel.js",
|
|
75
|
-
"limit": "6.
|
|
75
|
+
"limit": "6.93 kb",
|
|
76
|
+
"ignore": [
|
|
77
|
+
"vue",
|
|
78
|
+
"motion-v"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "dist/size.scramble-text.js",
|
|
83
|
+
"limit": "1.4 kb",
|
|
76
84
|
"ignore": [
|
|
77
85
|
"vue",
|
|
78
86
|
"motion-v"
|