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