motion-plus-vue 1.5.0-beta.1 → 1.5.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 +1 -1
- package/dist/components/Carousel/Carousel.d.ts +5 -2
- package/dist/components/Carousel/CarouselView.d.ts +2 -2
- package/dist/components/Cursor/Cursor.d.ts +2 -2
- package/dist/components/Ticker/context.d.ts +174 -174
- package/dist/components/Typewriter/Typewriter.d.ts +1 -1
- package/dist/es/components/Ticker/Ticker.vue.mjs +1 -1
- package/dist/es/utils/flatten-slots.mjs +1 -1
- package/dist/size.animate-number.js +1 -0
- package/dist/size.carousel.js +1 -0
- package/dist/size.cursor.js +1 -0
- package/dist/size.ticker.js +1 -0
- package/dist/size.typewriter.js +1 -0
- package/package.json +29 -6
- package/dist/components/Ticker/DefaultTickerItem.d.ts +0 -14
- package/dist/components/Ticker/Ticker.d.ts +0 -106
- package/dist/components/Ticker/use-item-offset.d.ts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -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 i=t?yt():s.noop;return a(()=>{i()})},{immediate:!0,flush:"post"})}function Ce(o){return t=>{t.pointerType==="mouse"&&o(t)}}function Oe(o){return Ce(t=>{t.button===0&&o(t)})}let oe,he;function ht(){oe=s.motionValue(0),he=s.motionValue(0);let o=0,t=0;function n(){oe.set(o),he.set(t)}typeof window<"u"&&window.addEventListener("pointermove",Ce(a=>{o=a.clientX,t=a.clientY,s.frame.update(n)}))}function Se(){return oe||ht(),{x:oe,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 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 Ct(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 pe=null,D={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function St(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 bt(){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})}),i=Ce(({target:l})=>{if(!l)return;const[p,y]=Ct(l);let m=!1;const u={target:y,zone:St(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),k=d?parseInt(d):null;k!==D.fontSize&&(u.fontSize=k,m=!0)}else D.fontSize&&(u.fontSize=null,m=!0);m&&t(u)});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:l=>(o.size||r(),o.add(l),()=>{o.delete(l),o.size||c()})}}function Bt(){return pe||(pe=bt()),pe}function be(){const o=e.ref({...D});return e.watch(o,()=>Bt().onChange(t=>{o.value=t}),{immediate:!0,flush:"post"}),o}let me=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 me||(me=Tt()),me}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,Re=31,_e=4,$t=20;function ne(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 l=i&&t.targetBoundingBox;if(n&&!l)return ne("auto","auto",a);const{padding:p,morph:y}=r;switch(o){case"pointer":if(i&&y&&t.targetBoundingBox){const{width:m,height:u}=t.targetBoundingBox;return{width:`${m+p*2}px`,height:`${u+p*2}px`}}return ne(Re,Re,a);case"text":return c&&t.fontSize?{width:`${_e}px`,height:`${t.fontSize}px`}:ne(_e,$t,a);default:return ne(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 i=()=>{a.value=!0,n(),r()},r=s.pipe(o.on("change",i),t.on("change",i));return()=>r()},{immediate:!0}),a}function Nt(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=Nt(o,a,i);return e.watch(()=>n==null?void 0:n.value,(c,l)=>{c?(!l&&!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 Rt=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),i=s.useReducedMotion();vt(()=>!i.value&&!t.follow);const r=Se(),c=xt(r,n),l=s.useSpring(c.x,t.spring||void 0),p=s.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=be(),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)),k=e.useSlots(),x=e.computed(()=>{var P,M;const h=(M=(P=k.default)==null?void 0:P.call(k))==null?void 0:M.filter(C=>C.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:M,matchTextSize:C,magnetic:z,...S}=t;return S}return(h,L)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(g)?(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):h.transition||e.unref(zt)},{default:e.withCtx(()=>{var P,M;return[e.createVNode(e.unref(s.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,...(M=h.variants)==null?void 0:M.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(s.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=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 l=()=>{i.set(t*(o.get()-c))};return l(),o.on("change",l)}else s.animate(r,0)},{immediate:!0,flush:"post"}),s.useTransform(()=>s.mix(a.get(),i.get(),r.get()))}function _t(o,t=.1){const n=be(),a=Se(),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,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 G(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(()=>G(t.axis,n.direction).sign),i=s.useTransform(()=>{if(!t.reproject)return 0;const{offset:u,bounds:f,listSize:d,safeMargin:k}=t,{start:x,end:g}=f;if(!x&&!g||!d)return 0;const w=u.get();if(w*a.value+g<=-n.inset-k)return d*a.value;if(k>0){const v=n.visibleLength-k-n.inset;if(w*a.value+f.start>=v)return-d*a.value}return 0}),r=s.useTransform(()=>{const u=t.offset.get(),f=i.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"?i:0,y:t.axis==="y"?i:0},...c.value}}),{bounds:p,itemIndex:y,cloneIndex:m}=e.toRefs(t);return Ft({offset:r,bounds:p,projection:i,itemIndex:y,cloneIndex:m,props:l}),(u,f)=>u.size==="manual"?e.renderSlot(u.$slots,"default",{key:0}):(e.openBlock(),e.createBlock(e.unref(s.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,i){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",k=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 B=w[v];B.focus(),await e.nextTick(),n.set(-B[k]),c[d]=0},L=B=>{if(B.key==="Tab"){B.preventDefault(),C();const $=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(s.isHTMLElement);$.sort(Yt);const A=$[B.shiftKey?0:$.length-1],Y=B.shiftKey?$.length-1:0;if(c.contains(A)){$[Y].focus();return}else{const q=$.indexOf(w[v]),ae=B.shiftKey?-1:1;for(let W=q;W<$.length&&W>=0;W+=ae){const X=$[W];if(!c.contains(X)){X.focus();return}}}return}else B.key===x?v--:B.key===g&&v++;v=s.wrap(0,w.length,v),h()},P=()=>{r||(i(!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(s.isHTMLElement),v=0,h(),window.addEventListener("focus",M,f),window.addEventListener("blur",M,f),c.addEventListener("keydown",L,u))},M=B=>{(!B.target||!(B.target instanceof HTMLElement)||!c.contains(B.target))&&C()},C=()=>{r&&(r=!1,i(!1),a.value.set(n.get()),window.removeEventListener("focus",M),window.removeEventListener("blur",M),c.removeEventListener("keydown",L))},z=B=>{const{target:$}=B;s.isHTMLElement($)&&(r||P())},S=()=>{y||(y=!0,c.addEventListener("focus",z,f),window.addEventListener("pointermove",V,u))},V=()=>{y&&(y=!1,c.removeEventListener("focus",z,!0),window.removeEventListener("pointermove",V,u))},j=B=>{const A=B.target.closest('[aria-hidden="true"]');A&&A.removeAttribute("aria-hidden")};window.addEventListener("keydown",S,u),c.addEventListener("pointerdown",j,u),p(()=>{m.abort(),C()})},{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===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:l}=t[c];if(r=c,l+i>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[s.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 i=o+t;return ke(o,n,a,i)}function Ie(o,t,n,a,i){if(t.length===0)return 0;const c=t[t.length-1].end+n,l=a??o-(i??0);let y=Je(o,t,c),m=o,u=!1;for(;!u;){const{start:f,end:d}=t[s.wrap(0,t.length,y)],k=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):((i&&k>i||m===o&&l>=w)&&(m=w),u=!0)}return m}function Qt(o,t,n,a){const i=o-t;return Ie(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(()=>G(t.axis,n.direction).sign),r=e.ref(!1),c=s.useMotionValue(1),l=s.useMotionValue(0),p=e.computed(()=>t.offset??l),y=s.useTransform(()=>n.direction==="rtl"?s.wrap(n.totalItemLength+t.gap+n.inset,n.inset,p.value.get()):s.wrap(-n.totalItemLength-t.gap-n.inset,-n.inset,p.value.get())),m=s.useMotionValue(0),u=e.computed(()=>r.value?m:t.loop?y:p.value),f=s.useDomRef(),d=s.useDomRef(),k=s.useInView(f,{margin:"100px"}),x=s.usePageInView(),g=e.computed(()=>k.value&&x.value),w=s.useReducedMotion(),v=e.useSlots(),h=e.computed(()=>{var I;return Ze((I=v.default)==null?void 0:I.call(v))});function L(){if(!f.value||!d.value)return;const I=window.getComputedStyle(f.value).direction,{measureItem:E,lengthProp:b,viewportLengthProp:T,getCumulativeInset:N}=G(t.axis,I),{safeMargin:O,overflow:_,loop:K}=t,U=S.value==="x"?"paddingLeft":"paddingTop",ie=S.value==="x"?"paddingRight":"paddingBottom",se=f.value,Z=d.value.querySelectorAll(".ticker-item");if(!Z.length)return;let Pe=!1;const J=[];for(let Q=0;Q<Z.length;Q++){const fe=E(Z[Q],se);J.push(fe);const de=n.itemPositions[Q];(!de||fe.start!==de.start||fe.end!==de.end)&&(Pe=!0)}const le=Math.min(se[b],window[T]);let ue=t.overflow?window[T]:le;O>0&&(ue+=O*2);const ce=Ue(J),Ee=window.getComputedStyle(se),Me=parseInt(Ee[U]??0),ot=parseInt(Ee[ie]??0),ze=_?N(Z[0]):Me,at=K===!1?Math.max(0,ce-le+Me+ot):null;(ue!==n.visibleLength||ce!==n.totalItemLength||ze!==n.inset||n.itemPositions.length!==J.length||Pe)&&(n.direction=I,n.visibleLength=ue,n.itemPositions=J,n.totalItemLength=ce,n.inset=ze,n.containerLength=le,n.maxInset=at,n.isMeasured=!0)}e.watch([h,g,()=>t.overflow],(I,E,b)=>{if(!g.value||!f.value)return;L();const T=t.overflow?s.resize(L):void 0,N=s.resize(f.value,L);b(()=>{T==null||T(),N()})},{immediate:!0,flush:"post"});const P=e.computed(()=>n.totalItemLength>0);s.useAnimationFrame((I,E)=>{if(P.value&&g.value&&p.value===l&&!w.value){const b=E/1e3*(t.velocity*i.value*c.get());p.value.set(p.value.get()-b)}});const M=e.computed(()=>!P.value||!n.visibleLength?0:Zt(n.visibleLength,n.itemPositions,t.gap)),C=e.computed(()=>n.totalItemLength===0?0:(n.totalItemLength+t.gap)*(M.value+1)),z=e.computed(()=>{if(!t.loop)return[];const I=[];for(let E=0;E<M.value;E++){const b=[];h.value.forEach((N,O)=>{let _;const K=n.itemPositions[O],U=(n.totalItemLength+t.gap)*(E+1),ie=K?{start:K.start+U,end:K.end+U}:He;b.push(e.createVNode(xe,{key:`clone-${E}-${O}`,offset:u.value,axis:t.axis,listSize:C.value,itemIndex:O,cloneIndex:O,bounds:ie,alignItems:a.value,size:t.itemSize,safeMargin:t.safeMargin,numItems:h.value.length},We(_=we([N]))?_:{default:()=>[_]}))});const T=`ticker-group-${E}`;I.push(e.createVNode(s.LayoutGroup,{key:T,id:T},We(b)?b:{default:()=>[b]}))}return I}),S=e.toRef(t,"axis");Xt(f,S,m,p,I=>{r.value=I});const V={display:"flex",position:"relative"},j={display:"flex",position:"relative",willChange:"transform",listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start"};function B(I){return n.maxInset!==null?s.clamp(-n.maxInset,0,I):I}jt({state:n,gap:e.computed(()=>t.gap),clampOffset:B,renderedOffset:u});const $=e.computed(()=>t.axis==="x"?t==null?void 0:t._dragX:t==null?void 0:t._dragY);let A=null;const Y=e.computed(()=>n.maxInset!==null?S.value==="x"?i.value>0?{left:n.maxInset*-1,right:0}:{right:n.maxInset,left:0}:{top:n.maxInset*-1,bottom:0}:{});function q(){A&&(A.stop(),A=null)}const ae=e.computed(()=>!t.onDragEnd&&t.drag&&$?()=>{$.value.jump(p.value.get()),q()}:t.onPointerDown),W=e.computed(()=>!t.onDragEnd&&t.drag&&$?(I,{velocity:E})=>{const b=p.value.get();q(),s.frame.postRender(()=>{let T=b+E[S.value]*(t.snap?.3:.8);if(t.snap)if(E[S.value]<0)T=-ke(-b,n.itemPositions,t.gap,-T);else if(E[S.value]>0)T=-Ie(-b,n.itemPositions,t.gap,-T,n.containerLength);else{const O=-ke(-b,n.itemPositions,t.gap,-b),_=-Ie(-b,n.itemPositions,t.gap,-b,n.containerLength);T=Math.abs(b-O)<Math.abs(b-_)?O:_}const N=t.loop?{}:i.value>0?{max:0,min:Y.value[S.value==="x"?"left":"top"]}:{min:0,max:Y.value.right};A=s.animate($,B(T*i.value)*i.value,t.snap?t.pageTransition:{type:"inertia",velocity:E[S.value],modifyTarget:()=>T,bounceDamping:40,bounceStiffness:400,...N})})}:t.onDragEnd),X=s.useMotionValue(t.loop?0:1),re=s.useMotionValue(0),tt=e.computed(()=>G(S.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,${re.get()}) 100%)`),nt=e.computed(()=>t.fade?{maskImage:Le,WebkitMaskImage:Le}:{}),F={start:!0,end:!1};return e.watch(u,(I,E,b)=>{const T=O=>{if(n.maxInset===null)return;const _=n.maxInset*-1;O*=i.value,O<0?F.start&&(s.animate(X,0,t.fadeTransition),F.start=!1):F.start||(s.animate(X,1,t.fadeTransition),F.start=!0),O>_?F.end&&(s.animate(re,0,t.fadeTransition),F.end=!1):F.end||(s.animate(re,1,t.fadeTransition),F.end=!0)};let N=()=>{};I&&(N=I.on("change",T)),b(N)},{immediate:!0}),(I,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(s.Motion),e.mergeProps(I.$attrs,{ref_key:"containerRef",ref:f,as:I.as,style:{overflowX:!I.overflow&&S.value==="x"?"clip":void 0,overflowY:!I.overflow&&S.value==="y"?"clip":void 0,...V,...t.style,...nt.value},drag:I.drag,_dragX:I._dragX,_dragY:I._dragY,"drag-constraints":Y.value,"drag-momentum":I.dragMomentum,onPointerenter:E[0]||(E[0]=()=>{e.unref(s.animate)(e.unref(c),I.hoverFactor)}),onPointerleave:E[1]||(E[1]=()=>{e.unref(s.animate)(e.unref(c),1)}),onPointerdown:ae.value,onDragEnd:W.value}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).ul,{ref_key:"listRef",ref:d,role:"group",style:e.normalizeStyle({...j,flexDirection:S.value==="x"?"row":"column",gap:`${I.gap}px`,x:S.value==="x"?u.value:0,y:S.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,(b,T)=>(e.openBlock(),e.createBlock(xe,{key:`original-${T}`,axis:S.value,offset:u.value,"list-size":C.value,"item-index":T,bounds:n.itemPositions[T]??e.unref(He),"align-items":a.value,size:I.itemSize,reproject:I.loop,"safe-margin":I.safeMargin,"num-items":h.value.length},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(we)([b]),(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(z.value,b=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b),{key:b.key}))),128))]),_:1},8,["style"])]),_:1},16,["as","style","drag","_dragX","_dragY","drag-constraints","drag-momentum","onPointerdown","onDragEnd"]),e.renderSlot(I.$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(x=>typeof x.children=="string"?x.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 l=null;const p=e.computed(()=>typeof t.speed=="number"?t.speed:tn[t.speed]);function y(){c.value&&(l=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 u(){m==null||m(),m=null}function f(){if(!t.play){y(),u();return}l==null||l.cancel();const d=a(),k=()=>{var w;const g=ge.getNextText(r.get(),d,t.replace,t.backspace);r.set(g),g!==d?x():(y(),(w=t.onComplete)==null||w.call(t))},x=()=>{m=s.delayInMs(k,ge.getTypewriterDelay(d,r.get(),p.value,t.variance,t.backspaceFactor))};m||x()}return e.watchEffect(d=>{f(),d(u)}),e.onMounted(()=>{f()}),(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: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 i=-o,r=a===null?Math.floor(i/n):0,c=r*n;for(let l=t.length-1;l>=0;l--){const p=t[l]+c,y=s.wrap(0,t.length,l-1),u=(l===0?r-1:r)*n,f=t[y]+u,d=(p-f)/2,k=s.wrap(0,t.length,l+1),g=(l===t.length-1?r+1:r)*n,w=t[k]+g,v=(w-p)/2;if(i<w-v&&i>=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:{}},setup(o){const t=o;let n=!0;const{state:a,gap:i,clampOffset:r}=Be(),c=e.computed(()=>a.totalItemLength+i.value),l=e.computed(()=>et(a.itemPositions,a.containerLength,a.maxInset)),p=e.computed(()=>l.value.insets.length),y=e.computed(()=>G(t.axis,a.direction).sign);function m(C){const z=ln(C*y.value,l.value.insets,c.value,a.maxInset),S=t.loop?!0:C*-y.value<a.maxInset,V=t.loop?!0:C*-y.value>0;return{current:z,isNextActive:S,isPrevActive:V}}const u=e.ref(m(t.targetOffset.get()));function f(){const C=m(t.targetOffset.get());(C.current!==u.value.current||C.isNextActive!==u.value.isNextActive||C.isPrevActive!==u.value.isPrevActive)&&(u.value=C)}e.watch([()=>a.containerLength,()=>a.totalItemLength],f,{immediate:!0,flush:"post"}),s.useMotionValueEvent(t.targetOffset,"change",C=>{t.offset.set(C),f()});let d=null;function k(){d&&(d.stop(),d=null)}e.onMounted(()=>{t.offset.attach((C,z)=>{k(),n?z(C):d=new s.JSAnimation({keyframes:[t.offset.get(),C],velocity:s.clamp(-2e3,2e3,t.offset.getVelocity()),...t.transition,onUpdate:z,onComplete:()=>{d=null}}),n=!0},k)});function x(C){const z=r(C);t.targetOffset.stop(),n=!1,t.targetOffset.set(z*y.value)}function g(C,z){const S=-C(-t.targetOffset.get()*y.value,l.value.visibleLength,a.itemPositions,i.value),V=r(S);V*y.value===t.targetOffset.get()?s.animate(t.tugOffset,0,{velocity:z*y.value*400,...sn}):x(V)}const w=()=>g(Jt,-1),v=()=>g(Qt,1);function h(C){const S=(t.loop?Math.floor(-t.targetOffset.get()*y.value/c.value):0)*-c.value;x(-l.value.insets[C]+S)}const{axis:L,snap:P,offset:M}=e.toRefs(t);return e.watch([L,P,M,y,()=>t.tickerRef],(C,z,S)=>{t.tickerRef&&S(ge.wheel(t.tickerRef,{axis:L.value,onSwipe:P.value?V=>{V*y.value===1?w():v()}:void 0,onWheel:V=>{const j=M.value.get()+V,B=y.value>0?r(j):s.clamp(0,a.maxInset,j);t.targetOffset.jump(a.maxInset?B:j)}}))},{immediate:!0,flush:"post"}),an({paginationState:u,totalPages:p,nextPage:w,prevPage:v,gotoPage:h,targetOffset:t.targetOffset}),(C,z)=>e.renderSlot(C.$slots,"default")}}),cn=e.defineComponent({name:"Carousel",inheritAttrs:!1,__name:"Carousel",props:{snap:{type:[String,Boolean],default:"page"},transition:{default:()=>({...rn})},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(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(i),"target-offset":e.unref(n),transition:l.transition,snap:l.snap,axis:l.axis},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"after")]),_:3},8,["ticker-ref","loop","offset","tug-offset","target-offset","transition","snap","axis"])]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16,["offset","loop","axis","drag","_drag-x","_drag-y","snap","page-transition"]))}});exports.AnimateNumber=gt;exports.Carousel=cn;exports.Cursor=Rt;exports.Ticker=Qe;exports.TickerItem=xe;exports.Typewriter=nn;exports.useCarousel=on;exports.useCursorIsInView=Ke;exports.useCursorState=be;exports.useMagneticPull=_t;exports.usePointerPosition=Se;exports.useTicker=Be;exports.useTickerItem=At;
|
|
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 Ce(o){return t=>{t.pointerType==="mouse"&&o(t)}}function Oe(o){return Ce(t=>{t.button===0&&o(t)})}let oe,he;function ht(){oe=s.motionValue(0),he=s.motionValue(0);let o=0,t=0;function n(){oe.set(o),he.set(t)}typeof window<"u"&&window.addEventListener("pointermove",Ce(a=>{o=a.clientX,t=a.clientY,s.frame.update(n)}))}function Se(){return oe||ht(),{x:oe,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 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 Ct(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 pe=null,D={type:"default",isPressed:!1,fontSize:null,targetBoundingBox:null,target:null,zone:null};function St(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 bt(){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})}),i=Ce(({target:l})=>{if(!l)return;const[p,y]=Ct(l);let m=!1;const u={target:y,zone:St(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),k=d?parseInt(d):null;k!==D.fontSize&&(u.fontSize=k,m=!0)}else D.fontSize&&(u.fontSize=null,m=!0);m&&t(u)});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:l=>(o.size||r(),o.add(l),()=>{o.delete(l),o.size||c()})}}function Bt(){return pe||(pe=bt()),pe}function be(){const o=e.ref({...D});return e.watch(o,()=>Bt().onChange(t=>{o.value=t}),{immediate:!0,flush:"post"}),o}let me=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 me||(me=Tt()),me}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,Re=31,_e=4,$t=20;function ne(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 l=i&&t.targetBoundingBox;if(n&&!l)return ne("auto","auto",a);const{padding:p,morph:y}=r;switch(o){case"pointer":if(i&&y&&t.targetBoundingBox){const{width:m,height:u}=t.targetBoundingBox;return{width:`${m+p*2}px`,height:`${u+p*2}px`}}return ne(Re,Re,a);case"text":return c&&t.fontSize?{width:`${_e}px`,height:`${t.fontSize}px`}:ne(_e,$t,a);default:return ne(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 i=()=>{a.value=!0,n(),r()},r=s.pipe(o.on("change",i),t.on("change",i));return()=>r()},{immediate:!0}),a}function Nt(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=Nt(o,a,i);return e.watch(()=>n==null?void 0:n.value,(c,l)=>{c?(!l&&!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 Rt=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),i=s.useReducedMotion();vt(()=>!i.value&&!t.follow);const r=Se(),c=xt(r,n),l=s.useSpring(c.x,t.spring||void 0),p=s.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=be(),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)),k=e.useSlots(),x=e.computed(()=>{var P,M;const h=(M=(P=k.default)==null?void 0:P.call(k))==null?void 0:M.filter(C=>C.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:M,matchTextSize:C,magnetic:z,...S}=t;return S}return(h,L)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(g)?(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):h.transition||e.unref(zt)},{default:e.withCtx(()=>{var P,M;return[e.createVNode(e.unref(s.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,...(M=h.variants)==null?void 0:M.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(s.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=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 l=()=>{i.set(t*(o.get()-c))};return l(),o.on("change",l)}else s.animate(r,0)},{immediate:!0,flush:"post"}),s.useTransform(()=>s.mix(a.get(),i.get(),r.get()))}function _t(o,t=.1){const n=be(),a=Se(),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,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 G(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(()=>G(t.axis,n.direction).sign),i=s.useTransform(()=>{if(!t.reproject)return 0;const{offset:u,bounds:f,listSize:d,safeMargin:k}=t,{start:x,end:g}=f;if(!x&&!g||!d)return 0;const w=u.get();if(w*a.value+g<=-n.inset-k)return d*a.value;if(k>0){const v=n.visibleLength-k-n.inset;if(w*a.value+f.start>=v)return-d*a.value}return 0}),r=s.useTransform(()=>{const u=t.offset.get(),f=i.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"?i:0,y:t.axis==="y"?i:0},...c.value}}),{bounds:p,itemIndex:y,cloneIndex:m}=e.toRefs(t);return Ft({offset:r,bounds:p,projection:i,itemIndex:y,cloneIndex:m,props:l}),(u,f)=>u.size==="manual"?e.renderSlot(u.$slots,"default",{key:0}):(e.openBlock(),e.createBlock(e.unref(s.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,i){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",k=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 B=w[v];B.focus(),await e.nextTick(),n.set(-B[k]),c[d]=0},L=B=>{if(B.key==="Tab"){B.preventDefault(),C();const $=Array.from(document.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]')).filter(s.isHTMLElement);$.sort(Yt);const A=$[B.shiftKey?0:$.length-1],Y=B.shiftKey?$.length-1:0;if(c.contains(A)){$[Y].focus();return}else{const q=$.indexOf(w[v]),ae=B.shiftKey?-1:1;for(let W=q;W<$.length&&W>=0;W+=ae){const X=$[W];if(!c.contains(X)){X.focus();return}}}return}else B.key===x?v--:B.key===g&&v++;v=s.wrap(0,w.length,v),h()},P=()=>{r||(i(!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(s.isHTMLElement),v=0,h(),window.addEventListener("focus",M,f),window.addEventListener("blur",M,f),c.addEventListener("keydown",L,u))},M=B=>{(!B.target||!(B.target instanceof HTMLElement)||!c.contains(B.target))&&C()},C=()=>{r&&(r=!1,i(!1),a.value.set(n.get()),window.removeEventListener("focus",M),window.removeEventListener("blur",M),c.removeEventListener("keydown",L))},z=B=>{const{target:$}=B;s.isHTMLElement($)&&(r||P())},S=()=>{y||(y=!0,c.addEventListener("focus",z,f),window.addEventListener("pointermove",V,u))},V=()=>{y&&(y=!1,c.removeEventListener("focus",z,!0),window.removeEventListener("pointermove",V,u))},j=B=>{const A=B.target.closest('[aria-hidden="true"]');A&&A.removeAttribute("aria-hidden")};window.addEventListener("keydown",S,u),c.addEventListener("pointerdown",j,u),p(()=>{m.abort(),C()})},{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:l}=t[c];if(r=c,l+i>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[s.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 i=o+t;return ke(o,n,a,i)}function Ie(o,t,n,a,i){if(t.length===0)return 0;const c=t[t.length-1].end+n,l=a??o-(i??0);let y=Je(o,t,c),m=o,u=!1;for(;!u;){const{start:f,end:d}=t[s.wrap(0,t.length,y)],k=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):((i&&k>i||m===o&&l>=w)&&(m=w),u=!0)}return m}function Qt(o,t,n,a){const i=o-t;return Ie(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(()=>G(t.axis,n.direction).sign),r=e.ref(!1),c=s.useMotionValue(1),l=s.useMotionValue(0),p=e.computed(()=>t.offset??l),y=s.useTransform(()=>n.direction==="rtl"?s.wrap(n.totalItemLength+t.gap+n.inset,n.inset,p.value.get()):s.wrap(-n.totalItemLength-t.gap-n.inset,-n.inset,p.value.get())),m=s.useMotionValue(0),u=e.computed(()=>r.value?m:t.loop?y:p.value),f=s.useDomRef(),d=s.useDomRef(),k=s.useInView(f,{margin:"100px"}),x=s.usePageInView(),g=e.computed(()=>k.value&&x.value),w=s.useReducedMotion(),v=e.useSlots(),h=e.computed(()=>{var I;return Ze((I=v.default)==null?void 0:I.call(v))});function L(){if(!f.value||!d.value)return;const I=window.getComputedStyle(f.value).direction,{measureItem:E,lengthProp:b,viewportLengthProp:T,getCumulativeInset:N}=G(t.axis,I),{safeMargin:O,overflow:_,loop:K}=t,U=S.value==="x"?"paddingLeft":"paddingTop",ie=S.value==="x"?"paddingRight":"paddingBottom",se=f.value,Z=d.value.querySelectorAll(".ticker-item");if(!Z.length)return;let Pe=!1;const J=[];for(let Q=0;Q<Z.length;Q++){const fe=E(Z[Q],se);J.push(fe);const de=n.itemPositions[Q];(!de||fe.start!==de.start||fe.end!==de.end)&&(Pe=!0)}const le=Math.min(se[b],window[T]);let ue=t.overflow?window[T]:le;O>0&&(ue+=O*2);const ce=Ue(J),Ee=window.getComputedStyle(se),Me=parseInt(Ee[U]??0),ot=parseInt(Ee[ie]??0),ze=_?N(Z[0]):Me,at=K===!1?Math.max(0,ce-le+Me+ot):null;(ue!==n.visibleLength||ce!==n.totalItemLength||ze!==n.inset||n.itemPositions.length!==J.length||Pe)&&(n.direction=I,n.visibleLength=ue,n.itemPositions=J,n.totalItemLength=ce,n.inset=ze,n.containerLength=le,n.maxInset=at,n.isMeasured=!0)}e.watch([h,g,()=>t.overflow],(I,E,b)=>{if(!g.value||!f.value)return;L();const T=t.overflow?s.resize(L):void 0,N=s.resize(f.value,L);b(()=>{T==null||T(),N()})},{immediate:!0,flush:"post"});const P=e.computed(()=>n.totalItemLength>0);s.useAnimationFrame((I,E)=>{if(P.value&&g.value&&p.value===l&&!w.value){const b=E/1e3*(t.velocity*i.value*c.get());p.value.set(p.value.get()-b)}});const M=e.computed(()=>!P.value||!n.visibleLength?0:Zt(n.visibleLength,n.itemPositions,t.gap)),C=e.computed(()=>n.totalItemLength===0?0:(n.totalItemLength+t.gap)*(M.value+1)),z=e.computed(()=>{if(!t.loop)return[];const I=[];for(let E=0;E<M.value;E++){const b=[];h.value.forEach((N,O)=>{let _;const K=n.itemPositions[O],U=(n.totalItemLength+t.gap)*(E+1),ie=K?{start:K.start+U,end:K.end+U}:He;b.push(e.createVNode(xe,{key:`clone-${E}-${O}`,offset:u.value,axis:t.axis,listSize:C.value,itemIndex:O,cloneIndex:O,bounds:ie,alignItems:a.value,size:t.itemSize,safeMargin:t.safeMargin,numItems:h.value.length},We(_=we([N]))?_:{default:()=>[_]}))});const T=`ticker-group-${E}`;I.push(e.createVNode(s.LayoutGroup,{key:T,id:T},We(b)?b:{default:()=>[b]}))}return I}),S=e.toRef(t,"axis");Xt(f,S,m,p,I=>{r.value=I});const V={display:"flex",position:"relative"},j={display:"flex",position:"relative",willChange:"transform",listStyleType:"none",padding:0,margin:0,justifyContent:"flex-start"};function B(I){return n.maxInset!==null?s.clamp(-n.maxInset,0,I):I}jt({state:n,gap:e.computed(()=>t.gap),clampOffset:B,renderedOffset:u});const $=e.computed(()=>t.axis==="x"?t==null?void 0:t._dragX:t==null?void 0:t._dragY);let A=null;const Y=e.computed(()=>n.maxInset!==null?S.value==="x"?i.value>0?{left:n.maxInset*-1,right:0}:{right:n.maxInset,left:0}:{top:n.maxInset*-1,bottom:0}:{});function q(){A&&(A.stop(),A=null)}const ae=e.computed(()=>!t.onDragEnd&&t.drag&&$?()=>{$.value.jump(p.value.get()),q()}:t.onPointerDown),W=e.computed(()=>!t.onDragEnd&&t.drag&&$.value?(I,{velocity:E})=>{const b=p.value.get();q(),s.frame.postRender(()=>{let T=b+E[S.value]*(t.snap?.3:.8);if(t.snap)if(E[S.value]<0)T=-ke(-b,n.itemPositions,t.gap,-T);else if(E[S.value]>0)T=-Ie(-b,n.itemPositions,t.gap,-T,n.containerLength);else{const O=-ke(-b,n.itemPositions,t.gap,-b),_=-Ie(-b,n.itemPositions,t.gap,-b,n.containerLength);T=Math.abs(b-O)<Math.abs(b-_)?O:_}const N=t.loop?{}:i.value>0?{max:0,min:Y.value[S.value==="x"?"left":"top"]}:{min:0,max:Y.value.right};A=s.animate($,B(T*i.value)*i.value,t.snap?t.pageTransition:{type:"inertia",velocity:E[S.value],modifyTarget:()=>T,bounceDamping:40,bounceStiffness:400,...N})})}:t.onDragEnd),X=s.useMotionValue(t.loop?0:1),re=s.useMotionValue(0),tt=e.computed(()=>G(S.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,${re.get()}) 100%)`),nt=e.computed(()=>t.fade?{maskImage:Le,WebkitMaskImage:Le}:{}),F={start:!0,end:!1};return e.watch(u,(I,E,b)=>{const T=O=>{if(n.maxInset===null)return;const _=n.maxInset*-1;O*=i.value,O<0?F.start&&(s.animate(X,0,t.fadeTransition),F.start=!1):F.start||(s.animate(X,1,t.fadeTransition),F.start=!0),O>_?F.end&&(s.animate(re,0,t.fadeTransition),F.end=!1):F.end||(s.animate(re,1,t.fadeTransition),F.end=!0)};let N=()=>{};I&&(N=I.on("change",T)),b(N)},{immediate:!0}),(I,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(s.Motion),e.mergeProps(I.$attrs,{ref_key:"containerRef",ref:f,as:I.as,style:{overflowX:!I.overflow&&S.value==="x"?"clip":void 0,overflowY:!I.overflow&&S.value==="y"?"clip":void 0,...V,...t.style,...nt.value},drag:I.drag,_dragX:I._dragX,_dragY:I._dragY,"drag-constraints":Y.value,"drag-momentum":I.dragMomentum,onPointerenter:E[0]||(E[0]=()=>{e.unref(s.animate)(e.unref(c),I.hoverFactor)}),onPointerleave:E[1]||(E[1]=()=>{e.unref(s.animate)(e.unref(c),1)}),onPointerdown:ae.value,onDragEnd:W.value}),{default:e.withCtx(()=>[e.createVNode(e.unref(s.motion).ul,{ref_key:"listRef",ref:d,role:"group",style:e.normalizeStyle({...j,flexDirection:S.value==="x"?"row":"column",gap:`${I.gap}px`,x:S.value==="x"?u.value:0,y:S.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,(b,T)=>(e.openBlock(),e.createBlock(xe,{key:`original-${T}`,axis:S.value,offset:u.value,"list-size":C.value,"item-index":T,bounds:n.itemPositions[T]??e.unref(He),"align-items":a.value,size:I.itemSize,reproject:I.loop,"safe-margin":I.safeMargin,"num-items":h.value.length},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(we)([b]),(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(z.value,b=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b),{key:b.key}))),128))]),_:1},8,["style"])]),_:1},16,["as","style","drag","_dragX","_dragY","drag-constraints","drag-momentum","onPointerdown","onDragEnd"]),e.renderSlot(I.$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(x=>typeof x.children=="string"?x.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 l=null;const p=e.computed(()=>typeof t.speed=="number"?t.speed:tn[t.speed]);function y(){c.value&&(l=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 u(){m==null||m(),m=null}function f(){if(!t.play){y(),u();return}l==null||l.cancel();const d=a(),k=()=>{var w;const g=ge.getNextText(r.get(),d,t.replace,t.backspace);r.set(g),g!==d?x():(y(),(w=t.onComplete)==null||w.call(t))},x=()=>{m=s.delayInMs(k,ge.getTypewriterDelay(d,r.get(),p.value,t.variance,t.backspaceFactor))};m||x()}return e.watchEffect(d=>{f(),d(u)}),e.onMounted(()=>{f()}),(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: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 i=-o,r=a===null?Math.floor(i/n):0,c=r*n;for(let l=t.length-1;l>=0;l--){const p=t[l]+c,y=s.wrap(0,t.length,l-1),u=(l===0?r-1:r)*n,f=t[y]+u,d=(p-f)/2,k=s.wrap(0,t.length,l+1),g=(l===t.length-1?r+1:r)*n,w=t[k]+g,v=(w-p)/2;if(i<w-v&&i>=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:{}},setup(o){const t=o;let n=!0;const{state:a,gap:i,clampOffset:r}=Be(),c=e.computed(()=>a.totalItemLength+i.value),l=e.computed(()=>et(a.itemPositions,a.containerLength,a.maxInset)),p=e.computed(()=>l.value.insets.length),y=e.computed(()=>G(t.axis,a.direction).sign);function m(C){const z=ln(C*y.value,l.value.insets,c.value,a.maxInset),S=t.loop?!0:C*-y.value<a.maxInset,V=t.loop?!0:C*-y.value>0;return{current:z,isNextActive:S,isPrevActive:V}}const u=e.ref(m(t.targetOffset.get()));function f(){const C=m(t.targetOffset.get());(C.current!==u.value.current||C.isNextActive!==u.value.isNextActive||C.isPrevActive!==u.value.isPrevActive)&&(u.value=C)}e.watch([()=>a.containerLength,()=>a.totalItemLength],f,{immediate:!0,flush:"post"}),s.useMotionValueEvent(t.targetOffset,"change",C=>{t.offset.set(C),f()});let d=null;function k(){d&&(d.stop(),d=null)}e.onMounted(()=>{t.offset.attach((C,z)=>{k(),n?z(C):d=new s.JSAnimation({keyframes:[t.offset.get(),C],velocity:s.clamp(-2e3,2e3,t.offset.getVelocity()),...t.transition,onUpdate:z,onComplete:()=>{d=null}}),n=!0},k)});function x(C){const z=r(C);t.targetOffset.stop(),n=!1,t.targetOffset.set(z*y.value)}function g(C,z){const S=-C(-t.targetOffset.get()*y.value,l.value.visibleLength,a.itemPositions,i.value),V=r(S);V*y.value===t.targetOffset.get()?s.animate(t.tugOffset,0,{velocity:z*y.value*400,...sn}):x(V)}const w=()=>g(Jt,-1),v=()=>g(Qt,1);function h(C){const S=(t.loop?Math.floor(-t.targetOffset.get()*y.value/c.value):0)*-c.value;x(-l.value.insets[C]+S)}const{axis:L,snap:P,offset:M}=e.toRefs(t);return e.watch([L,P,M,y,()=>t.tickerRef],(C,z,S)=>{t.tickerRef&&S(ge.wheel(t.tickerRef,{axis:L.value,onSwipe:P.value?V=>{V*y.value===1?w():v()}:void 0,onWheel:V=>{const j=M.value.get()+V,B=y.value>0?r(j):s.clamp(0,a.maxInset,j);t.targetOffset.jump(a.maxInset?B:j)}}))},{immediate:!0,flush:"post"}),an({paginationState:u,totalPages:p,nextPage:w,prevPage:v,gotoPage:h,targetOffset:t.targetOffset}),(C,z)=>e.renderSlot(C.$slots,"default")}}),cn=e.defineComponent({name:"Carousel",inheritAttrs:!1,__name:"Carousel",props:{snap:{type:[String,Boolean],default:"page"},transition:{default:()=>({...rn})},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(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(i),"target-offset":e.unref(n),transition:l.transition,snap:l.snap,axis:l.axis},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"after")]),_:3},8,["ticker-ref","loop","offset","tug-offset","target-offset","transition","snap","axis"])]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},16,["offset","loop","axis","drag","_drag-x","_drag-y","snap","page-transition"]))}});exports.AnimateNumber=gt;exports.Carousel=cn;exports.Cursor=Rt;exports.Ticker=Qe;exports.TickerItem=xe;exports.Typewriter=nn;exports.useCarousel=on;exports.useCursorIsInView=Ke;exports.useCursorState=be;exports.useMagneticPull=_t;exports.usePointerPosition=Se;exports.useTicker=Be;exports.useTickerItem=At;
|
|
@@ -16,10 +16,13 @@ export interface CarouselProps extends Omit<TickerProps, 'velocity' | 'offset' |
|
|
|
16
16
|
}
|
|
17
17
|
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselProps> & Readonly<{}>, {
|
|
18
18
|
transition: Transition;
|
|
19
|
-
axis: "x" | "y";
|
|
20
19
|
loop: boolean;
|
|
21
20
|
snap: "page" | "loose" | false;
|
|
22
|
-
|
|
21
|
+
axis: "x" | "y";
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
23
|
+
default?: ((props: {}) => any) | undefined;
|
|
24
|
+
after?: ((props: {}) => any) | undefined;
|
|
25
|
+
}>;
|
|
23
26
|
export default _default;
|
|
24
27
|
type __VLS_WithSlots<T, S> = T & {
|
|
25
28
|
new (): {
|
|
@@ -16,12 +16,12 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
16
16
|
default?: (props: typeof __VLS_1) => any;
|
|
17
17
|
}>;
|
|
18
18
|
declare const __VLS_self: import('vue').DefineComponent<CarouselViewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselViewProps> & Readonly<{}>, {
|
|
19
|
-
axis: Axis;
|
|
20
19
|
snap: "page" | "loose" | false;
|
|
20
|
+
axis: Axis;
|
|
21
21
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const __VLS_component: import('vue').DefineComponent<CarouselViewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselViewProps> & Readonly<{}>, {
|
|
23
|
-
axis: Axis;
|
|
24
23
|
snap: "page" | "loose" | false;
|
|
24
|
+
axis: Axis;
|
|
25
25
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
27
27
|
export default _default;
|
|
@@ -50,20 +50,20 @@ declare const __VLS_self: import('vue').DefineComponent<CursorProps, {
|
|
|
50
50
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CursorProps> & Readonly<{}>, {
|
|
51
51
|
offset: Point;
|
|
52
52
|
center: Point;
|
|
53
|
+
show: boolean;
|
|
53
54
|
spring: false | SpringOptions;
|
|
54
55
|
matchTextSize: boolean;
|
|
55
56
|
follow: boolean;
|
|
56
57
|
magnetic: boolean | Partial<MagneticOptions>;
|
|
57
|
-
show: boolean;
|
|
58
58
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
59
59
|
declare const __VLS_component: import('vue').DefineComponent<CursorProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CursorProps> & Readonly<{}>, {
|
|
60
60
|
offset: Point;
|
|
61
61
|
center: Point;
|
|
62
|
+
show: boolean;
|
|
62
63
|
spring: false | SpringOptions;
|
|
63
64
|
matchTextSize: boolean;
|
|
64
65
|
follow: boolean;
|
|
65
66
|
magnetic: boolean | Partial<MagneticOptions>;
|
|
66
|
-
show: boolean;
|
|
67
67
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
68
68
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
69
69
|
export default _default;
|