svg-scroll-draw 2.6.0 → 2.7.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/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +16 -0
- package/dist/angular/index.d.ts +16 -0
- package/dist/angular/index.mjs +3 -3
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.d.mts +8 -0
- package/dist/astro/index.d.ts +8 -0
- package/dist/astro/index.mjs +3 -3
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +16 -0
- package/dist/group/index.d.ts +16 -0
- package/dist/group/index.mjs +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +4 -4
- package/dist/lenis/index.cjs +1 -0
- package/dist/lenis/index.d.mts +51 -0
- package/dist/lenis/index.d.ts +51 -0
- package/dist/lenis/index.mjs +1 -0
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +16 -0
- package/dist/nuxt/index.d.ts +16 -0
- package/dist/nuxt/index.mjs +3 -3
- package/dist/pin/index.cjs +1 -0
- package/dist/pin/index.d.mts +29 -0
- package/dist/pin/index.d.ts +29 -0
- package/dist/pin/index.mjs +1 -0
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +16 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.mjs +3 -3
- package/dist/snap/index.cjs +1 -0
- package/dist/snap/index.d.mts +30 -0
- package/dist/snap/index.d.ts +30 -0
- package/dist/snap/index.mjs +1 -0
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +16 -0
- package/dist/solid/index.d.ts +16 -0
- package/dist/solid/index.mjs +3 -3
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +16 -0
- package/dist/svelte/index.d.ts +16 -0
- package/dist/svelte/index.mjs +3 -3
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +16 -0
- package/dist/vue/index.d.ts +16 -0
- package/dist/vue/index.mjs +2 -2
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +3 -3
- package/package.json +16 -1
package/dist/svelte/index.d.mts
CHANGED
|
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
|
|
|
71
71
|
onProgress?: (alpha: number) => void;
|
|
72
72
|
onStart?: () => void;
|
|
73
73
|
onComplete?: () => void;
|
|
74
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
75
|
+
onEnter?: () => void;
|
|
76
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
77
|
+
onLeave?: () => void;
|
|
78
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
79
|
+
onEnterBack?: () => void;
|
|
80
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
81
|
+
onLeaveBack?: () => void;
|
|
74
82
|
/**
|
|
75
83
|
* Trigger the animation when the element enters the viewport instead of
|
|
76
84
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -130,6 +138,14 @@ interface ScrollAnimateOptions {
|
|
|
130
138
|
native?: boolean;
|
|
131
139
|
onProgress?: (alpha: number) => void;
|
|
132
140
|
onComplete?: () => void;
|
|
141
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
142
|
+
onEnter?: () => void;
|
|
143
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
144
|
+
onLeave?: () => void;
|
|
145
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
146
|
+
onEnterBack?: () => void;
|
|
147
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
148
|
+
onLeaveBack?: () => void;
|
|
133
149
|
}
|
|
134
150
|
|
|
135
151
|
interface ScrollCounterOptions {
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
|
|
|
71
71
|
onProgress?: (alpha: number) => void;
|
|
72
72
|
onStart?: () => void;
|
|
73
73
|
onComplete?: () => void;
|
|
74
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
75
|
+
onEnter?: () => void;
|
|
76
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
77
|
+
onLeave?: () => void;
|
|
78
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
79
|
+
onEnterBack?: () => void;
|
|
80
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
81
|
+
onLeaveBack?: () => void;
|
|
74
82
|
/**
|
|
75
83
|
* Trigger the animation when the element enters the viewport instead of
|
|
76
84
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -130,6 +138,14 @@ interface ScrollAnimateOptions {
|
|
|
130
138
|
native?: boolean;
|
|
131
139
|
onProgress?: (alpha: number) => void;
|
|
132
140
|
onComplete?: () => void;
|
|
141
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
142
|
+
onEnter?: () => void;
|
|
143
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
144
|
+
onLeave?: () => void;
|
|
145
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
146
|
+
onEnterBack?: () => void;
|
|
147
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
148
|
+
onLeaveBack?: () => void;
|
|
133
149
|
}
|
|
134
150
|
|
|
135
151
|
interface ScrollCounterOptions {
|
package/dist/svelte/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function
|
|
2
|
-
<div style="position:absolute;${c?`left:${
|
|
3
|
-
<div style="position:absolute;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Ye(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),l=t[u++]??m;return String(+(m+(l-m)*r).toFixed(4))})}function ze(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...tt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:d="linear",trigger:O={},stagger:B=0,direction:E="forward",once:re=false,debug:de=false,axis:q="y",scrollContainer:K,autoReverse:T=false,delay:H=0,strokeColor:A,strokeWidth:$,fillOpacity:L,waypoints:w,velocityScale:C=false,threshold:D=0,rootMargin:F="0px",repeat:M=0,repeatDelay:z=0,morphTo:P,clip:_,autoplay:Q=false,duration:j=1e3,native:se=true,onProgress:p,onStart:I,onComplete:y}=u,f=_===true?"left":typeof _=="string"?_:false,k=typeof d=="function"?d:ae[d]??ae.linear,ge=le(O.start??"top bottom"),a=le(O.end??"bottom top"),g=typeof K=="string"?document.querySelector(K):K??null,ne=Array.isArray(A)?A[0]:null,V=Array.isArray(A)?A[1]:typeof A=="string"?A:null,U=Array.isArray($)?$[0]:null,oe=Array.isArray($)?$[1]:typeof $=="number"?$:null,N=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function me(o){let i=o*100;switch(f){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let ee=f?[]:Array.from(e.querySelectorAll(m)),X=[],he=[],Ee=0,Se=0,ie=false,ye=false,te=0,Oe=false,we=-1,De=-1,ce=false,$e=0,ve=0,xe,Be=null,Te=new Set,ke=-1,Ue=performance.now();function Ie(){return g?q==="x"?g.scrollLeft:g.scrollTop:q==="x"?window.scrollX:window.scrollY}function Ze(){return g?q==="x"?g.clientWidth:g.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function Je(){let o=e.getBoundingClientRect(),i,v,Y;if(g){let ue=g.getBoundingClientRect();i=q==="x"?o.left-ue.left+g.scrollLeft:o.top-ue.top+g.scrollTop,v=q==="x"?o.width:o.height,Y=Ie();}else i=q==="x"?o.left:o.top,v=q==="x"?o.width:o.height,Y=Ie();let fe=pe({top:i,height:v},Y,Ze(),ge,a);Ee=fe.tStart,Se=fe.tEnd,de&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=St(Ee,Se,q));}function ft(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),f){let v=i==="reverse"?1-o:o;e.style.clipPath=me(v);return}ee.forEach((v,Y)=>{v.style.strokeDashoffset=i==="reverse"?`${X[Y]*o}`:`${X[Y]*(1-o)}`,c&&(v.style.opacity=i==="reverse"?`${1-o}`:`${o}`),ne&&V?v.style.stroke=Pe(ne,V,o):V&&(v.style.stroke=V),U!==null&&oe!==null?v.style.strokeWidth=`${U+(oe-U)*o}`:oe!==null&&(v.style.strokeWidth=`${oe}`),N!==null&&G!==null?v.style.fillOpacity=`${N+(G-N)*o}`:G!==null&&(v.style.fillOpacity=`${G}`),P&&v.tagName.toLowerCase()==="path"&&he[Y]&&v.setAttribute("d",Ye(he[Y],P,o));});}function Fe(){if(e.style.setProperty("--scroll-draw-progress","0"),f){e.style.clipPath=me(0);return}ee.forEach((o,i)=>{o.style.strokeDasharray=`${X[i]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${X[i]}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ne&&(o.style.stroke=ne),U!==null&&(o.style.strokeWidth=`${U}`),N!==null&&(o.style.fillOpacity=`${N}`),P&&o.tagName.toLowerCase()==="path"&&he[i]&&o.setAttribute("d",he[i]);});}if(ee.forEach(o=>{Et(o);let i=Re(o);X.push(i),o.tagName.toLowerCase()==="path"?he.push(o.getAttribute("d")??""):he.push(""),s?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=E==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),V&&(o.style.stroke=V),oe!==null&&(o.style.strokeWidth=`${oe}`),G!==null&&(o.style.fillOpacity=`${G}`),P&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",P)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=E==="reverse"?"0":`${i}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ne&&(o.style.stroke=ne),U!==null&&(o.style.strokeWidth=`${U}`),N!==null&&(o.style.fillOpacity=`${N}`));}),f){if(s)return e.style.clipPath=me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function pt(){return !(se===false||!vt()||!ee.length||typeof d!="string"||!(d in nt)||f||q!=="y"||g||l!==1||B!==0||re||T||C!==false||P||w||M||H>0||p||I||y||A!=null||$!=null||L!=null||(O.start??"top bottom").trim()!=="top bottom"||(O.end??"bottom top").trim()!=="bottom top")}function dt(){let o=`svg-scroll-draw-${++bt}`,i=E==="reverse"?"0":"var(--ssd-len)",v=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${i};`,fe=`stroke-dashoffset:${v};`;c&&(Y+=`opacity:${E==="reverse"?1:0};`,fe+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${o}{from{${Y}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${nt[d]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function b(h,x){h.style.setProperty("--ssd-len",String(X[x])),h.style.strokeDasharray=`${X[x]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(o);}ee.forEach(b);let R=false,Z=-1;function S(){if(Z>=0)return Z;let h=e.getBoundingClientRect(),{tStart:x,tEnd:W}=pe({top:h.top,height:h.height},Ie(),Ze(),ge,a);return k(J(Ie(),x,W,l))}return {destroy(){ee.forEach(h=>{h.classList.remove(o),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),ue.remove();},replay(){R=false,Z=-1,ee.forEach(b);},pause(){R=true,ee.forEach(h=>{h.style.animationPlayState="paused";});},resume(){R&&(R=false,ee.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let x=Math.min(1,Math.max(0,h));Z=x,R=true,ee.forEach((W,Le)=>{W.classList.remove(o),W.style.strokeDashoffset=E==="reverse"?`${X[Le]*x}`:`${X[Le]*(1-x)}`,c&&(W.style.opacity=E==="reverse"?`${1-x}`:`${x}`);});},getProgress(){return S()}}}if(pt())return dt();function gt(){let o=Math.max(1,j),i=0,v=0;function Y(S){let h=true;if(f){let x=Math.min(1,Math.max(0,S/o)),W=k(x);$e=W,e.style.setProperty("--scroll-draw-progress",String(W)),e.style.clipPath=me(E==="reverse"?1-W:W),p?.(W),x<1&&(h=false);}else ee.forEach((x,W)=>{let Le=W*B*o,Ce=Math.min(1,Math.max(0,(S-Le)/o)),be=k(Ce);x.style.strokeDashoffset=E==="reverse"?`${X[W]*be}`:`${X[W]*(1-be)}`,c&&(x.style.opacity=E==="reverse"?`${1-be}`:`${be}`),ne&&V?x.style.stroke=Pe(ne,V,be):V&&(x.style.stroke=V),U!==null&&oe!==null?x.style.strokeWidth=`${U+(oe-U)*be}`:oe!==null&&(x.style.strokeWidth=`${oe}`),N!==null&&G!==null?x.style.fillOpacity=`${N+(G-N)*be}`:G!==null&&(x.style.fillOpacity=`${G}`),P&&x.tagName.toLowerCase()==="path"&&he[W]&&x.setAttribute("d",Ye(he[W],P,be)),W===0&&(p?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ce<1&&(h=false);});if(w){let x=Math.min(1,Math.max(0,S/o)),W=k(x);for(let Le in w){let Ce=parseFloat(Le);W>=Ce&&!Te.has(Ce)&&(Te.add(Ce),w[Le]?.());}}return h}function fe(S){if(ce)return;let h=S-i;ye||(ye=true,I?.());let x=Y(h);if(x&&!ie){ie=true,Y(o*(1+Math.max(0,ee.length-1)*B)),y?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{i=performance.now(),ye=false,ie=false,Te.clear(),Fe(),te=requestAnimationFrame(fe);},z));return}x||(te=requestAnimationFrame(fe));}function ue(){cancelAnimationFrame(te),clearTimeout(xe),i=performance.now(),v=0,ce=false,ye=false,ie=false,ve=0,Te.clear(),Fe(),te=requestAnimationFrame(fe);}let b=new IntersectionObserver(S=>{S.forEach(h=>{h.isIntersecting&&!(re&&ie)?ue():!h.isIntersecting&&!re&&!ie&&(cancelAnimationFrame(te),clearTimeout(xe),i=null);});},{root:g??null,threshold:D,rootMargin:F}),R;function Z(){clearTimeout(R),R=setTimeout(()=>{ee.forEach((S,h)=>{X[h]=Re(S),S.style.strokeDasharray=`${X[h]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),H>0?setTimeout(()=>b.observe(e),H):b.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),b.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(R);},replay(){ve=0,ue();},pause(){ce||(ce=true,v=performance.now()-i,cancelAnimationFrame(te));},resume(){ce&&(ce=false,i=performance.now()-v,te=requestAnimationFrame(fe));},seek(S){let h=Math.min(1,Math.max(0,S));$e=h,ce=true,v=h*o,i=performance.now()-v,cancelAnimationFrame(te),Y(v);},getProgress(){return $e}}}if(Q)return gt();Je();function He(){if(!Oe||ce)return;let o=performance.now(),i=Ie(),v=l;if(C!==false){let b=o-Ue,R=b>0?Math.abs(i-(ke<0?i:ke))/b:0;v=l*Math.max(.2,1+R*(typeof C=="number"?C:1)*.04);}ke=i,Ue=o;let Y=T?De===-1||i>=De?"forward":"reverse":E;De=i;let fe=Se-Ee,ue=true;if(f){let b=k(J(i,Ee,Se,v));re&&!T&&(we=Math.max(we,b),b=we),$e=b,e.style.setProperty("--scroll-draw-progress",String(b));let R=Y==="reverse"?1-b:b;e.style.clipPath=me(R),p?.(b),!ye&&J(i,Ee,Se,v)>0&&(ye=true,I?.()),b>=1&&!ie?(ie=true,y?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{we=-1,ye=false,ie=false,e.style.clipPath=me(0);},z))):b<1&&!re&&(ie=false),te=requestAnimationFrame(He);return}if(ee.forEach((b,R)=>{let Z=R*B*fe,S=k(J(i,Ee+Z,Se+Z,v));re&&!T&&(we=Math.max(we,S),S=we),$e=S,b.style.strokeDashoffset=Y==="reverse"?`${X[R]*S}`:`${X[R]*(1-S)}`,c&&(b.style.opacity=Y==="reverse"?`${1-S}`:`${S}`),ne&&V?b.style.stroke=Pe(ne,V,S):V&&(b.style.stroke=V),U!==null&&oe!==null?b.style.strokeWidth=`${U+(oe-U)*S}`:oe!==null&&(b.style.strokeWidth=`${oe}`),N!==null&&G!==null?b.style.fillOpacity=`${N+(G-N)*S}`:G!==null&&(b.style.fillOpacity=`${G}`),P&&b.tagName.toLowerCase()==="path"&&he[R]&&b.setAttribute("d",Ye(he[R],P,S)),R===0&&(p?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&(ue=false);}),w){let b=k(J(i,Ee,Se,v));for(let R in w){let Z=parseFloat(R);b>=Z&&!Te.has(Z)&&(Te.add(Z),w[R]?.());}}!ye&&J(i,Ee,Se,v)>0&&(ye=true,I?.()),ue&&!ie?(ie=true,y?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{we=-1,ye=false,ie=false,Te.clear(),Fe();},z))):!ue&&!re&&(ie=false),te=requestAnimationFrame(He);}let Ge=new IntersectionObserver(o=>{o.forEach(i=>{Oe=i.isIntersecting,Oe&&!ce?te=requestAnimationFrame(He):cancelAnimationFrame(te);});},{root:g??null,threshold:D,rootMargin:F}),Xe;function Ne(){clearTimeout(Xe),Xe=setTimeout(()=>{ee.forEach((o,i)=>{X[i]=Re(o),o.style.strokeDasharray=`${X[i]}`;}),Je();},150);}return window.addEventListener("resize",Ne),window.addEventListener("orientationchange",Ne),H>0?setTimeout(()=>Ge.observe(e),H):Ge.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),Ge.disconnect(),window.removeEventListener("resize",Ne),window.removeEventListener("orientationchange",Ne),clearTimeout(Xe),Be?.remove();},replay(){we=-1,De=-1,ke=-1,ye=false,ie=false,ve=0,ce=false,Te.clear(),clearTimeout(xe),Fe();},pause(){ce=true,cancelAnimationFrame(te);},resume(){ce&&(ce=false,Oe&&(te=requestAnimationFrame(He)));},seek(o){let i=Math.min(1,Math.max(0,o));$e=i,we=i,ce=true,cancelAnimationFrame(te),ft(i,E);},getProgress(){return $e}}}var ot=new Map;function Ae(e,n){ot.set(e,n);}function Me(e){ot.delete(e);}function xt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function st(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],s=[],m=t[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:s});}return n}function Tt(e,n,r){let t=st(e),u=st(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((s,m)=>{let l=u[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((c,d)=>`${c}${s.units[d]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,d)=>`${c}${l.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,d)=>`${c+(l.nums[d]-c)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function it(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if(xt(t))return Pe(t,u,r);if(t.includes("("))return Tt(t,u,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),c=parseFloat(m[1]);return `${l+(c-l)*r}${s[2]||m[2]}`}return r<1?t:u}function At(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var at={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Mt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),$t=0;function Lt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ve(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:s="ease-out",speed:m=1,once:l=false,axis:c="y",scrollContainer:d,native:O=true,onProgress:B,onComplete:E}=n,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=typeof s=="function"?s:ae[s]??ae["ease-out"],q=le(u.start??"top bottom"),K=le(u.end??"bottom top"),T=typeof d=="string"?document.querySelector(d):d??null,H=Object.entries(t).map(([a,g])=>({prop:At(a),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function A(){let a=window.getComputedStyle(e);for(let g of H)g.from===""&&(g.from=a.getPropertyValue(g.prop).trim()||"0");}function $(){for(let a of H)e.style.setProperty(a.prop,String(a.to));}if(re)return $(),E?.(),r;A();function L(){if(!O||!Lt()||typeof s!="string"||!(s in at)||c!=="y"||T||l||m!==1||B||E||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let a of H)if(!Mt.has(a.prop))return false;return true}function w(){let a=`ssd-a-${++$t}`,g=H.map(N=>`${N.prop}:${N.from}`).join(";"),ne=H.map(N=>`${N.prop}:${N.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${a}{from{${g}}to{${ne}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${at[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(a);let U=()=>c==="x"?window.scrollX:window.scrollY,oe=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),V.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(N){let G=Math.min(1,Math.max(0,N));e.classList.remove(a);for(let me of H)e.style.setProperty(me.prop,it(me.from,me.to,G));},getProgress(){let N=e.getBoundingClientRect(),G=U(),me=oe(),{tStart:ee,tEnd:X}=pe({top:N.top,height:N.height},G,me,q,K);return de(J(G,ee,X,m))}}}if(L())return w();let C=0,D=0,F=0,M=false,z=false,P=-1,_=0,Q=false,j=()=>T?c==="x"?T.scrollLeft:T.scrollTop:c==="x"?window.scrollX:window.scrollY,se=()=>T?c==="x"?T.clientWidth:T.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function p(){let a=e.getBoundingClientRect(),g,ne;if(T){let U=T.getBoundingClientRect();g=c==="x"?a.left-U.left+T.scrollLeft:a.top-U.top+T.scrollTop,ne=c==="x"?a.width:a.height;}else g=c==="x"?a.left:a.top,ne=c==="x"?a.width:a.height;let V=pe({top:g,height:ne},j(),se(),q,K);C=V.tStart,D=V.tEnd;}function I(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let g of H)e.style.setProperty(g.prop,it(g.from,g.to,a));B?.(a);}function y(){if(!M||z)return;let a=de(J(j(),C,D,m));l&&(P=Math.max(P,a),a=P),_=a,I(a),a>=1&&!Q?(Q=true,E?.()):a<1&&!l&&(Q=false),F=requestAnimationFrame(y);}p();{let a=de(J(j(),C,D,m));l&&a>0&&(P=a),_=a,I(a);}let f=new IntersectionObserver(a=>{a.forEach(g=>{M=g.isIntersecting,M&&!z?F=requestAnimationFrame(y):cancelAnimationFrame(F);});},{root:T??null}),k;function ge(){clearTimeout(k),k=setTimeout(p,150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),f.observe(e),Ae(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:C,tEnd:D})}),{destroy(){cancelAnimationFrame(F),f.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(k),Me(e);},replay(){P=-1,Q=false,_=0,z=false,I(0);},pause(){z=true,cancelAnimationFrame(F);},resume(){z&&(z=false,M&&(F=requestAnimationFrame(y)));},seek(a){let g=Math.min(1,Math.max(0,a));_=g,P=g,z=true,cancelAnimationFrame(F),I(g);},getProgress(){return _}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function qe(e,n){if(typeof window>"u")return je;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),je;let t=r,{from:u=0,to:s,format:m,easing:l="ease-out",trigger:c={},once:d=true,decimals:O,onComplete:B}=n,E=O!==void 0?p=>p.toFixed(O):m??(p=>String(Math.round(p))),re=typeof l=="function"?l:ae[l]??ae["ease-out"],de=le(c.start??"top 80%"),q=le(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(s),B?.(),je;t.textContent=E(u);let T=0,H=0,A=0,$=false,L=false,w=-1,C=0,D=false,F=()=>window.scrollY,M=()=>window.innerHeight;function z(){let p=t.getBoundingClientRect(),I=pe({top:p.top,height:p.height},F(),M(),de,q);T=I.tStart,H=I.tEnd;}function P(p){t.textContent=E(u+(s-u)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function _(){if(!$||L)return;let p=re(J(F(),T,H,1));d&&(w=Math.max(w,p),p=w),C=p,P(p),p>=1&&!D?(D=true,B?.()):p<1&&!d&&(D=false),A=requestAnimationFrame(_);}z();{let p=re(J(F(),T,H,1));d&&p>0&&(w=p),C=p,P(p);}let Q=new IntersectionObserver(p=>{p.forEach(I=>{$=I.isIntersecting,$&&!L?A=requestAnimationFrame(_):cancelAnimationFrame(A);});}),j;function se(){clearTimeout(j),j=setTimeout(z,150);}return window.addEventListener("resize",se),window.addEventListener("orientationchange",se),Q.observe(t),Ae(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:T,tEnd:H})}),{destroy(){cancelAnimationFrame(A),Q.disconnect(),window.removeEventListener("resize",se),window.removeEventListener("orientationchange",se),clearTimeout(j),Me(t);},replay(){w=-1,D=false,C=0,L=false,P(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,$&&(A=requestAnimationFrame(_)));},seek(p){let I=Math.min(1,Math.max(0,p));C=I,w=I,L=true,cancelAnimationFrame(A),P(I);},getProgress(){return C}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function We(e,n={}){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),lt;let t=r,{trigger:u={},easing:s="linear",once:m=false,axis:l="y",preload:c="auto",onReady:d,onComplete:O,onProgress:B}=n,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof s=="function"?s:ae[s]??ae.linear,de=le(u.start??"top top"),q=le(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let K=n.from??0,T=n.to,H=0,A=0,$=0,L=false,w=false,C=-1,D=0,F=false,M=false,z=()=>l==="x"?window.scrollX:window.scrollY,P=()=>l==="x"?window.innerWidth:window.innerHeight;function _(){let f=t.getBoundingClientRect(),k=l==="x"?f.left:f.top,ge=l==="x"?f.width:f.height,a=pe({top:k,height:ge},z(),P(),de,q);H=a.tStart,A=a.tEnd;}function Q(f){if(!M)return;let k=T??t.duration??0;t.currentTime=K+(k-K)*f,t.style.setProperty("--scroll-draw-progress",String(f)),B?.(f);}function j(){if(!L||w||!M)return;let f=re(J(z(),H,A,1));m&&(C=Math.max(C,f),f=C),D=f,Q(f),f>=1&&!F?(F=true,O?.()):f<1&&!m&&(F=false),$=requestAnimationFrame(j);}function se(){if(M=true,T===void 0&&(T=t.duration),E){Q(1),d?.();return}_(),d?.(),L&&!w&&($=requestAnimationFrame(j));}t.readyState>=1?se():t.addEventListener("loadedmetadata",se,{once:true}),M||_();let p=new IntersectionObserver(f=>{f.forEach(k=>{L=k.isIntersecting,L&&!w&&M?$=requestAnimationFrame(j):cancelAnimationFrame($);});}),I;function y(){clearTimeout(I),I=setTimeout(_,150);}return window.addEventListener("resize",y),window.addEventListener("orientationchange",y),p.observe(t),Ae(t,{type:"video",getProgress:()=>D,getTrigger:()=>({tStart:H,tEnd:A})}),{destroy(){cancelAnimationFrame($),p.disconnect(),t.removeEventListener("loadedmetadata",se),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),clearTimeout(I),Me(t);},replay(){C=-1,F=false,D=0,w=false,Q(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,L&&M&&($=requestAnimationFrame(j)));},seek(f){let k=Math.min(1,Math.max(0,f));D=k,C=k,w=true,cancelAnimationFrame($),Q(k);},getProgress(){return D}}}function mt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Ct(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function ct(e){let n=mt(e),r=new Map;for(let s of n){let m=s.offsetTop;r.has(m)||r.set(m,[]),r.get(m).push(s);}let t=[],u=Array.from(r.keys()).sort((s,m)=>s-m);for(let s of u){let m=r.get(s),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of m)l.appendChild(c);t.push(l);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Pt(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,s=n*t,m=s+(1-u);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function It(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function _e(e,n={}){if(typeof window>"u")return ut;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ut;let t=r,{split:u="words",stagger:s=.04,easing:m="ease-out",from:l={opacity:0,y:24},trigger:c={},once:d=true,onComplete:O}=n,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ae[m]??ae["ease-out"],re=le(c.start??"top 85%"),de=le(c.end??"top 40%"),q=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let K;u==="chars"?K=Ct(t):u==="lines"?K=ct(t):K=mt(t);let T=K.length;function H(y,f){l?.opacity!==void 0&&(y.style.opacity=String(l.opacity+(1-l.opacity)*f));let k=It(f,l);k&&(y.style.transform=k);}function A(y){t.style.setProperty("--scroll-draw-progress",String(y)),K.forEach((f,k)=>{let ge=E(Pt(y,k,T,s));H(f,ge);});}if(B)return A(1),O?.(),{destroy(){t.innerHTML=q,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,L=0,w=0,C=false,D=false,F=-1,M=0,z=false,P=()=>window.scrollY,_=()=>window.innerHeight;function Q(){let y=t.getBoundingClientRect(),f=pe({top:y.top,height:y.height},P(),_(),re,de);$=f.tStart,L=f.tEnd;}function j(){if(!C||D)return;let y=J(P(),$,L,1);d&&(F=Math.max(F,y),y=F),M=y,A(y),y>=1&&!z?(z=true,O?.()):y<1&&!d&&(z=false),w=requestAnimationFrame(j);}Q();let se=new IntersectionObserver(y=>{y.forEach(f=>{C=f.isIntersecting,C&&!D?w=requestAnimationFrame(j):cancelAnimationFrame(w);});}),p;function I(){clearTimeout(p),p=setTimeout(()=>{if(u==="lines"){let y=M;t.innerHTML=q,t.setAttribute("aria-label",t.textContent??""),K=ct(t),A(y);}Q();},150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),se.observe(t),Ae(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:$,tEnd:L})}),{destroy(){cancelAnimationFrame(w),se.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(p),t.innerHTML=q,t.removeAttribute("aria-label"),Me(t);},replay(){F=-1,z=false,M=0,D=false,A(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,C&&(w=requestAnimationFrame(j)));},seek(y){let f=Math.min(1,Math.max(0,y));M=f,F=f,D=true,cancelAnimationFrame(w),A(f);},getProgress(){return M}}}function tr(e,n={}){let r=ze(e,n);return {update(t){r.destroy(),r=ze(e,t);},destroy(){r.destroy();}}}function rr(e={}){let n=null;function r(t){return n=ze(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function nr(e,n){let r=Ve(e,n);return {update(t){r.destroy(),r=Ve(e,t);},destroy(){r.destroy();}}}function or(e){let n=null;function r(t){return n=Ve(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function sr(e,n){let r=qe(e,n);return {update(t){r.destroy(),r=qe(e,t);},destroy(){r.destroy();}}}function ir(e){let n=null;function r(t){return n=qe(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function ar(e,n={}){let r=We(e,n);return {update(t){r.destroy(),r=We(e,t);},destroy(){r.destroy();}}}function lr(e={}){let n=null;function r(t){return n=We(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function cr(e,n={}){let r=_e(e,n);return {update(t){r.destroy(),r=_e(e,t);},destroy(){r.destroy();}}}function ur(e={}){let n=null;function r(t){return n=_e(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}export{or as createScrollAnimate,ir as createScrollCounter,rr as createScrollDraw,ur as createScrollText,lr as createScrollVideo,nr as scrollAnimate,sr as scrollCounterAction,tr as scrollDraw,cr as scrollTextAction,ar as scrollVideoAction};
|
|
1
|
+
function Et({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(t),s=0,f=[];for(let h=0;h<r;h++){let $=Math.pow(u,h);f.push($),s+=$;}let l=[0],c=0;for(let h=0;h<r;h++)c+=f[h]/s,l.push(c);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let $=0;$<r;$++)if(h<=l[$+1]){let B=(h-l[$])/(l[$+1]-l[$]);if($===0)return B*(2-B);let S=1-Math.pow(t,$);return S+(1-S)*(2*B-1)*(2*B-1)}return 1}}function St({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),u=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-u)*(2*Math.PI)/t)+1}var ie={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Et(),elastic:St()};function ae(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function nt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function ot(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function _e(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function xt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:xt((e-n)/(r-n)*t,0,1)}function pe(e,n,r,t,u){let s=nt(e.top,e.height,n,t.element)-ot(t.viewport,r),f=nt(e.top,e.height,n,u.element)-ot(u.viewport,r);return {tStart:s,tEnd:f}}function st(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function De(e,n,r){let t=st(e),u=st(n);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*r)},${Math.round(t[1]+(u[1]-t[1])*r)},${Math.round(t[2]+(u[2]-t[2])*r)})`}var it={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};function at(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Tt=0;function At(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Mt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?at("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&at("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Lt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function u(){let s=r==="x"?window.scrollX:window.scrollY,f=e-s,l=n-s,c=r==="x";t.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Ke(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let f=parseFloat(s),l=t[u++]??f;return String(+(f+(l-f)*r).toFixed(4))})}function Be(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...it[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:h="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:he=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:P=false,threshold:I=0,rootMargin:G="0px",repeat:C=0,repeatDelay:F=0,morphTo:M,clip:z,autoplay:re=false,duration:N=1e3,native:W=true,onProgress:d,onStart:L,onComplete:g,onEnter:y,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof h=="function"?h:ie[h]??ie.linear,Fe=ae($.start??"top bottom"),Ie=ae($.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,Y=Array.isArray(A)?A[0]:null,H=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,oe=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(o){let a=o*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),O=[],me=[],ge=0,Te=0,se=false,ye=false,ne=0,He=false,ve=-1,Re=-1,le=false,Ce=0,xe=0,Ae,Ue=null,Me=new Set,ze=-1,et=performance.now(),Oe=NaN;function Ne(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function tt(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function rt(){let o=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?o.left-ue.left+U.scrollLeft:o.top-ue.top+U.scrollTop,E=R==="x"?o.width:o.height,j=Ne();}else a=R==="x"?o.left:o.top,E=R==="x"?o.width:o.height,j=Ne();let ce=pe({top:a,height:E},j,tt(),Fe,Ie);ge=ce.tStart,Te=ce.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=Lt(ge,Te,R));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),we){let E=a==="reverse"?1-o:o;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${O[j]*o}`:`${O[j]*(1-o)}`,c&&(E.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&p?E.style.stroke=De(i,p,o):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*o}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&oe!==null?E.style.fillOpacity=`${Z+(oe-Z)*o}`:oe!==null&&(E.style.fillOpacity=`${oe}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ke(me[j],M,o));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${O[a]}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&me[a]&&o.setAttribute("d",me[a]);});}if(_.forEach(o=>{Mt(o);let a=_e(o);O.push(a),o.tagName.toLowerCase()==="path"?me.push(o.getAttribute("d")??""):me.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),p&&(o.style.stroke=p),H!==null&&(o.style.strokeWidth=`${H}`),oe!==null&&(o.style.fillOpacity=`${oe}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),we){if(s)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(W===false||!At()||!_.length||typeof h!="string"||!(h in lt)||we||R!=="y"||U||l!==1||B!==0||Q||te||P!==false||M||b||C||q>0||d||L||g||y||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Tt}`,a=S==="reverse"?"0":"var(--ssd-len)",E=S==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${E};`;c&&(j+=`opacity:${S==="reverse"?1:0};`,ce+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${o}{from{${j}}to{${ce}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${lt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function fe(m,T){m.style.setProperty("--ssd-len",String(O[T])),m.style.strokeDasharray=`${O[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(o);}_.forEach(fe);let v=false,k=-1;function D(){if(k>=0)return k;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},Ne(),tt(),Fe,Ie);return de(K(Ne(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(o),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,k=-1,_.forEach(fe);},pause(){v=true,_.forEach(m=>{m.style.animationPlayState="paused";});},resume(){v&&(v=false,_.forEach(m=>{m.style.animationPlayState="running";}));},seek(m){let T=Math.min(1,Math.max(0,m));k=T,v=true,_.forEach((V,Pe)=>{V.classList.remove(o),V.style.strokeDashoffset=S==="reverse"?`${O[Pe]*T}`:`${O[Pe]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return D()}}}if(bt())return wt();function vt(){let o=Math.max(1,N),a=0,E=0;function j(D){let m=true;if(we){let T=Math.min(1,Math.max(0,D/o)),V=de(T);Ce=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(S==="reverse"?1-V:V),d?.(V),T<1&&(m=false);}else _.forEach((T,V)=>{let Pe=V*B*o,ke=Math.min(1,Math.max(0,(D-Pe)/o)),Ee=de(ke);T.style.strokeDashoffset=S==="reverse"?`${O[V]*Ee}`:`${O[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=De(i,p,Ee):p&&(T.style.stroke=p),Y!==null&&H!==null?T.style.strokeWidth=`${Y+(H-Y)*Ee}`:H!==null&&(T.style.strokeWidth=`${H}`),Z!==null&&oe!==null?T.style.fillOpacity=`${Z+(oe-Z)*Ee}`:oe!==null&&(T.style.fillOpacity=`${oe}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ke(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),ke<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,D/o)),V=de(T);for(let Pe in b){let ke=parseFloat(Pe);V>=ke&&!Me.has(ke)&&(Me.add(ke),b[Pe]?.());}}return m}function ce(D){if(le)return;let m=D-a;ye||(ye=true,L?.());let T=j(m);if(T&&!se){se=true,j(o*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),ye=false,se=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},F));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,ye=false,se=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(D=>{D.forEach(m=>{m.isIntersecting&&!(Q&&se)?ue():!m.isIntersecting&&!Q&&!se&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:I,rootMargin:G}),v;function k(){clearTimeout(v),v=setTimeout(()=>{_.forEach((D,m)=>{O[m]=_e(D),D.style.strokeDasharray=`${O[m]}`;});},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,E=performance.now()-a,cancelAnimationFrame(ne));},resume(){le&&(le=false,a=performance.now()-E,ne=requestAnimationFrame(ce));},seek(D){let m=Math.min(1,Math.max(0,D));Ce=m,le=true,E=m*o,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Ce}}}if(re)return vt();rt();function qe(){if(!He||le)return;let o=performance.now(),a=Ne(),E=l;if(P!==false){let v=o-et,k=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+k*(typeof P=="number"?P:1)*.04);}ze=a,et=o;let j=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ce=Te-ge,ue=true,fe=ce===0?0:(a-ge)/ce;if(isNaN(Oe)||(Oe<=0&&fe>0?y?.():Oe>0&&fe<=0&&be?.(),Oe<1&&fe>=1?X?.():Oe>=1&&fe<1&&Se?.()),Oe=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Ce=v,e.style.setProperty("--scroll-draw-progress",String(v));let k=j==="reverse"?1-v:v;e.style.clipPath=J(k),d?.(v),!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),v>=1&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,e.style.clipPath=J(0);},F))):v<1&&!Q&&(se=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,k)=>{let D=k*B*ce,m=de(K(a,ge+D,Te+D,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Ce=m,v.style.strokeDashoffset=j==="reverse"?`${O[k]*m}`:`${O[k]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=De(i,p,m):p&&(v.style.stroke=p),Y!==null&&H!==null?v.style.strokeWidth=`${Y+(H-Y)*m}`:H!==null&&(v.style.strokeWidth=`${H}`),Z!==null&&oe!==null?v.style.fillOpacity=`${Z+(oe-Z)*m}`:oe!==null&&(v.style.fillOpacity=`${oe}`),M&&v.tagName.toLowerCase()==="path"&&me[k]&&v.setAttribute("d",Ke(me[k],M,m)),k===0&&(d?.(m),e.style.setProperty("--scroll-draw-progress",String(m))),m<1&&(ue=false);}),b){let v=de(K(a,ge,Te,E));for(let k in b){let D=parseFloat(k);v>=D&&!Me.has(D)&&(Me.add(D),b[k]?.());}}!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),ue&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,Me.clear(),Ve();},F))):!ue&&!Q&&(se=false),ne=requestAnimationFrame(qe);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:I,rootMargin:G}),Je;function We(){clearTimeout(Je),Je=setTimeout(()=>{_.forEach((o,a)=>{O[a]=_e(o),o.style.strokeDasharray=`${O[a]}`;}),rt();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ze.observe(e),q):Ze.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ze.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,Re=-1,ze=-1,ye=false,se=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,ve=a,le=true,cancelAnimationFrame(ne),ht(a,S);},getProgress(){return Ce}}}var ct=new Map;function Le(e,n){ct.set(e,n);}function $e(e){ct.delete(e);}function $t(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ut(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],s=[],f=t[2].trim();if(f)for(let l of f.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:s});}return n}function Ct(e,n,r){let t=ut(e),u=ut(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((s,f)=>{let l=u[f];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((c,h)=>`${c}${s.units[h]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,h)=>`${c}${l.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,h)=>`${c+(l.nums[h]-c)*r}${s.units[h]}`).join(", ")})`}).join(" ")}function mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if($t(t))return De(t,u,r);if(t.includes("("))return Ct(t,u,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&f){let l=parseFloat(s[1]),c=parseFloat(f[1]);return `${l+(c-l)*r}${s[2]||f[2]}`}return r<1?t:u}function Pt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ft={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},It=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ot=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ge(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:s="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:h,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:he,onEnterBack:R,onLeaveBack:ee}=n,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof s=="function"?s:ie[s]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof h=="string"?document.querySelector(h):h??null,b=Object.entries(t).map(([i,p])=>({prop:Pt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function P(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function I(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return I(),S?.(),r;P();function G(){if(!$||!kt()||typeof s!="string"||!(s in ft)||c!=="y"||w||l||f!==1||B||S||Q||he||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!It.has(i.prop))return false;return true}function C(){let i=`ssd-a-${++Ot}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),Y=b.map(J=>`${J.prop}:${J.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${p}}to{${Y}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ft[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let Z=()=>c==="x"?window.scrollX:window.scrollY,oe=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),H.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let _=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let O of b)e.style.setProperty(O.prop,mt(O.from,O.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),O=oe(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,O,x,A);return q(K(_,me,ge,f))}}}if(G())return C();let F=0,M=0,z=0,re=false,N=false,W=-1,d=0,L=false,g=NaN,y=()=>w?c==="x"?w.scrollLeft:w.scrollTop:c==="x"?window.scrollX:window.scrollY,X=()=>w?c==="x"?w.clientWidth:w.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Se(){let i=e.getBoundingClientRect(),p,Y;if(w){let Z=w.getBoundingClientRect();p=c==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,Y=c==="x"?i.width:i.height;}else p=c==="x"?i.left:i.top,Y=c==="x"?i.width:i.height;let H=pe({top:p,height:Y},y(),X(),x,A);F=H.tStart,M=H.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,mt(p.from,p.to,i));B?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?he?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||N)return;let i=M===F?0:(y()-F)/(M-F);we(i);let p=q(K(y(),F,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!L?(L=true,S?.()):p<1&&!l&&(L=false),z=requestAnimationFrame(de);}Se();{let i=q(K(y(),F,M,f));l&&i>0&&(W=i),d=i,be(i);}let Fe=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!N?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),Ie;function U(){clearTimeout(Ie),Ie=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Fe.observe(e),Le(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:F,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Fe.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Ie),$e(e);},replay(){W=-1,L=false,d=0,N=false,be(0);},pause(){N=true,cancelAnimationFrame(z);},resume(){N&&(N=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,N=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var Qe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Xe(e,n){if(typeof window>"u")return Qe;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Qe;let t=r,{from:u=0,to:s,format:f,easing:l="ease-out",trigger:c={},once:h=true,decimals:$,onComplete:B}=n,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],he=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),B?.(),Qe;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,P=0,I=false,G=()=>window.scrollY,C=()=>window.innerHeight;function F(){let d=t.getBoundingClientRect(),L=pe({top:d.top,height:d.height},G(),C(),he,R);te=L.tStart,q=L.tEnd;}function M(d){t.textContent=S(u+(s-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));h&&(b=Math.max(b,d),d=b),P=d,M(d),d>=1&&!I?(I=true,B?.()):d<1&&!h&&(I=false),x=requestAnimationFrame(z);}F();{let d=Q(K(G(),te,q,1));h&&d>0&&(b=d),P=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(L=>{A=L.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),N;function W(){clearTimeout(N),N=setTimeout(F,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Le(t,{type:"counter",getProgress:()=>P,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(N),$e(t);},replay(){b=-1,I=false,P=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let L=Math.min(1,Math.max(0,d));P=L,b=L,w=true,cancelAnimationFrame(x),M(L);},getProgress(){return P}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ye(e,n={}){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),pt;let t=r,{trigger:u={},easing:s="linear",once:f=false,axis:l="y",preload:c="auto",onReady:h,onComplete:$,onProgress:B}=n,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof s=="function"?s:ie[s]??ie.linear,he=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=n.from??0,te=n.to,q=0,x=0,A=0,w=false,b=false,P=-1,I=0,G=false,C=false,F=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let y=t.getBoundingClientRect(),X=l==="x"?y.left:y.top,Se=l==="x"?y.width:y.height,be=pe({top:X,height:Se},F(),M(),he,R);q=be.tStart,x=be.tEnd;}function re(y){if(!C)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),B?.(y);}function N(){if(!w||b||!C)return;let y=Q(K(F(),q,x,1));f&&(P=Math.max(P,y),y=P),I=y,re(y),y>=1&&!G?(G=true,$?.()):y<1&&!f&&(G=false),A=requestAnimationFrame(N);}function W(){if(C=true,te===void 0&&(te=t.duration),S){re(1),h?.();return}z(),h?.(),w&&!b&&(A=requestAnimationFrame(N));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),C||z();let d=new IntersectionObserver(y=>{y.forEach(X=>{w=X.isIntersecting,w&&!b&&C?A=requestAnimationFrame(N):cancelAnimationFrame(A);});}),L;function g(){clearTimeout(L),L=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Le(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(L),$e(t);},replay(){P=-1,G=false,I=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&C&&(A=requestAnimationFrame(N)));},seek(y){let X=Math.min(1,Math.max(0,y));I=X,P=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return I}}}function yt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Dt(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function dt(e){let n=yt(e),r=new Map;for(let s of n){let f=s.offsetTop;r.has(f)||r.set(f,[]),r.get(f).push(s);}let t=[],u=Array.from(r.keys()).sort((s,f)=>s-f);for(let s of u){let f=r.get(s),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of f)l.appendChild(c);t.push(l);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Ft(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,s=n*t,f=s+(1-u);return f<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(f-s)))}function Nt(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function je(e,n={}){if(typeof window>"u")return gt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),gt;let t=r,{split:u="words",stagger:s=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:h=true,onComplete:$}=n,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),he=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Dt(t):u==="lines"?ee=dt(t):ee=yt(t);let te=ee.length;function q(g,y){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*y));let X=Nt(y,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((y,X)=>{let Se=S(Ft(g,X,te,s));q(y,Se);});}if(B)return x(1),$?.(),{destroy(){t.innerHTML=R,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,P=false,I=false,G=-1,C=0,F=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),y=pe({top:g.top,height:g.height},M(),z(),Q,he);A=y.tStart,w=y.tEnd;}function N(){if(!P||I)return;let g=K(M(),A,w,1);h&&(G=Math.max(G,g),g=G),C=g,x(g),g>=1&&!F?(F=true,$?.()):g<1&&!h&&(F=false),b=requestAnimationFrame(N);}re();let W=new IntersectionObserver(g=>{g.forEach(y=>{P=y.isIntersecting,P&&!I?b=requestAnimationFrame(N):cancelAnimationFrame(b);});}),d;function L(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=C;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=dt(t),x(g);}re();},150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),W.observe(t),Le(t,{type:"text",getProgress:()=>C,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,F=false,C=0,I=false,x(0);},pause(){I=true,cancelAnimationFrame(b);},resume(){I&&(I=false,P&&(b=requestAnimationFrame(N)));},seek(g){let y=Math.min(1,Math.max(0,g));C=y,G=y,I=true,cancelAnimationFrame(b),x(y);},getProgress(){return C}}}function ir(e,n={}){let r=Be(e,n);return {update(t){r.destroy(),r=Be(e,t);},destroy(){r.destroy();}}}function ar(e={}){let n=null;function r(t){return n=Be(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function lr(e,n){let r=Ge(e,n);return {update(t){r.destroy(),r=Ge(e,t);},destroy(){r.destroy();}}}function cr(e){let n=null;function r(t){return n=Ge(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function ur(e,n){let r=Xe(e,n);return {update(t){r.destroy(),r=Xe(e,t);},destroy(){r.destroy();}}}function mr(e){let n=null;function r(t){return n=Xe(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function fr(e,n={}){let r=Ye(e,n);return {update(t){r.destroy(),r=Ye(e,t);},destroy(){r.destroy();}}}function pr(e={}){let n=null;function r(t){return n=Ye(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function dr(e,n={}){let r=je(e,n);return {update(t){r.destroy(),r=je(e,t);},destroy(){r.destroy();}}}function gr(e={}){let n=null;function r(t){return n=je(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}export{cr as createScrollAnimate,mr as createScrollCounter,ar as createScrollDraw,gr as createScrollText,pr as createScrollVideo,lr as scrollAnimate,ur as scrollCounterAction,ir as scrollDraw,dr as scrollTextAction,fr as scrollVideoAction};
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
1
|
+
'use strict';var vue=require('vue');function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),s=0,m=[];for(let h=0;h<n;h++){let L=Math.pow(l,h);m.push(L),s+=L;}let c=[0],u=0;for(let h=0;h<n;h++)u+=m[h]/s,c.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let L=0;L<n;L++)if(h<=c[L+1]){let _=(h-c[L])/(c[L+1]-c[L]);if(L===0)return _*(2-_);let E=1-Math.pow(t,L);return E+(1-E)*(2*_-1)*(2*_-1)}return 1}}function Ct({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ie={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mt(),elastic:Ct()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function lt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function ct(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Ye(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Lt(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:Lt((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,l){let s=lt(e.top,e.height,r,t.element)-ct(t.viewport,n),m=lt(e.top,e.height,r,l.element)-ct(l.viewport,n);return {tStart:s,tEnd:m}}function ut(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Re(e,r,n){let t=ut(e),l=ut(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var ft={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};function mt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var pt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},$t=0;function Pt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ot(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?mt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&mt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kt(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=n==="x"?window.scrollX:window.scrollY,m=e-s,c=r-s,u=n==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),t}function Xe(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Ye(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...it[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:d="linear",trigger:F={},stagger:B=0,direction:S="forward",once:ne=false,debug:de=false,axis:q="y",scrollContainer:K,autoReverse:T=false,delay:R=0,strokeColor:A,strokeWidth:C,fillOpacity:$,waypoints:b,velocityScale:L=false,threshold:k=0,rootMargin:D="0px",repeat:M=0,repeatDelay:z=0,morphTo:P,clip:_,autoplay:Q=false,duration:Y=1e3,native:se=true,onProgress:p,onStart:O,onComplete:y}=l,f=_===true?"left":typeof _=="string"?_:false,I=typeof d=="function"?d:ae[d]??ae.linear,ge=le(F.start??"top bottom"),a=le(F.end??"bottom top"),g=typeof K=="string"?document.querySelector(K):K??null,re=Array.isArray(A)?A[0]:null,V=Array.isArray(A)?A[1]:typeof A=="string"?A:null,U=Array.isArray(C)?C[0]:null,oe=Array.isArray(C)?C[1]:typeof C=="number"?C:null,N=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null;function me(o){let i=o*100;switch(f){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let ee=f?[]:Array.from(e.querySelectorAll(m)),j=[],he=[],Te=0,Ae=0,ie=false,ye=false,te=0,Ne=false,be=-1,He=-1,ce=false,Pe=0,xe=0,Me,Be=null,Ce=new Set,ze=-1,et=performance.now();function Ie(){return g?q==="x"?g.scrollLeft:g.scrollTop:q==="x"?window.scrollX:window.scrollY}function tt(){return g?q==="x"?g.clientWidth:g.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function nt(){let o=e.getBoundingClientRect(),i,v,X;if(g){let ue=g.getBoundingClientRect();i=q==="x"?o.left-ue.left+g.scrollLeft:o.top-ue.top+g.scrollTop,v=q==="x"?o.width:o.height,X=Ie();}else i=q==="x"?o.left:o.top,v=q==="x"?o.width:o.height,X=Ie();let fe=pe({top:i,height:v},X,tt(),ge,a);Te=fe.tStart,Ae=fe.tEnd,de&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=Ct(Te,Ae,q));}function ht(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),f){let v=i==="reverse"?1-o:o;e.style.clipPath=me(v);return}ee.forEach((v,X)=>{v.style.strokeDashoffset=i==="reverse"?`${j[X]*o}`:`${j[X]*(1-o)}`,u&&(v.style.opacity=i==="reverse"?`${1-o}`:`${o}`),re&&V?v.style.stroke=ke(re,V,o):V&&(v.style.stroke=V),U!==null&&oe!==null?v.style.strokeWidth=`${U+(oe-U)*o}`:oe!==null&&(v.style.strokeWidth=`${oe}`),N!==null&&G!==null?v.style.fillOpacity=`${N+(G-N)*o}`:G!==null&&(v.style.fillOpacity=`${G}`),P&&v.tagName.toLowerCase()==="path"&&he[X]&&v.setAttribute("d",Xe(he[X],P,o));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),f){e.style.clipPath=me(0);return}ee.forEach((o,i)=>{o.style.strokeDasharray=`${j[i]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${j[i]}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",re&&(o.style.stroke=re),U!==null&&(o.style.strokeWidth=`${U}`),N!==null&&(o.style.fillOpacity=`${N}`),P&&o.tagName.toLowerCase()==="path"&&he[i]&&o.setAttribute("d",he[i]);});}if(ee.forEach(o=>{Mt(o);let i=_e(o);j.push(i),o.tagName.toLowerCase()==="path"?he.push(o.getAttribute("d")??""):he.push(""),s?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=S==="reverse"?`${i}`:"0",u&&(o.style.opacity="1"),V&&(o.style.stroke=V),oe!==null&&(o.style.strokeWidth=`${oe}`),G!==null&&(o.style.fillOpacity=`${G}`),P&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",P)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=S==="reverse"?"0":`${i}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",re&&(o.style.stroke=re),U!==null&&(o.style.strokeWidth=`${U}`),N!==null&&(o.style.fillOpacity=`${N}`));}),f){if(s)return e.style.clipPath=me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(se===false||!At()||!ee.length||typeof d!="string"||!(d in lt)||f||q!=="y"||g||c!==1||B!==0||ne||T||L!==false||P||b||M||R>0||p||O||y||A!=null||C!=null||$!=null||(F.start??"top bottom").trim()!=="top bottom"||(F.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Tt}`,i=S==="reverse"?"0":"var(--ssd-len)",v=S==="reverse"?"var(--ssd-len)":"0",X=`stroke-dashoffset:${i};`,fe=`stroke-dashoffset:${v};`;u&&(X+=`opacity:${S==="reverse"?1:0};`,fe+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${o}{from{${X}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${lt[d]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function w(h,x){h.style.setProperty("--ssd-len",String(j[x])),h.style.strokeDasharray=`${j[x]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(o);}ee.forEach(w);let H=false,Z=-1;function E(){if(Z>=0)return Z;let h=e.getBoundingClientRect(),{tStart:x,tEnd:W}=pe({top:h.top,height:h.height},Ie(),tt(),ge,a);return I(J(Ie(),x,W,c))}return {destroy(){ee.forEach(h=>{h.classList.remove(o),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),ue.remove();},replay(){H=false,Z=-1,ee.forEach(w);},pause(){H=true,ee.forEach(h=>{h.style.animationPlayState="paused";});},resume(){H&&(H=false,ee.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let x=Math.min(1,Math.max(0,h));Z=x,H=true,ee.forEach((W,Oe)=>{W.classList.remove(o),W.style.strokeDashoffset=S==="reverse"?`${j[Oe]*x}`:`${j[Oe]*(1-x)}`,u&&(W.style.opacity=S==="reverse"?`${1-x}`:`${x}`);});},getProgress(){return E()}}}if(bt())return wt();function vt(){let o=Math.max(1,Y),i=0,v=0;function X(E){let h=true;if(f){let x=Math.min(1,Math.max(0,E/o)),W=I(x);Pe=W,e.style.setProperty("--scroll-draw-progress",String(W)),e.style.clipPath=me(S==="reverse"?1-W:W),p?.(W),x<1&&(h=false);}else ee.forEach((x,W)=>{let Oe=W*B*o,Fe=Math.min(1,Math.max(0,(E-Oe)/o)),we=I(Fe);x.style.strokeDashoffset=S==="reverse"?`${j[W]*we}`:`${j[W]*(1-we)}`,u&&(x.style.opacity=S==="reverse"?`${1-we}`:`${we}`),re&&V?x.style.stroke=ke(re,V,we):V&&(x.style.stroke=V),U!==null&&oe!==null?x.style.strokeWidth=`${U+(oe-U)*we}`:oe!==null&&(x.style.strokeWidth=`${oe}`),N!==null&&G!==null?x.style.fillOpacity=`${N+(G-N)*we}`:G!==null&&(x.style.fillOpacity=`${G}`),P&&x.tagName.toLowerCase()==="path"&&he[W]&&x.setAttribute("d",Xe(he[W],P,we)),W===0&&(p?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),Fe<1&&(h=false);});if(b){let x=Math.min(1,Math.max(0,E/o)),W=I(x);for(let Oe in b){let Fe=parseFloat(Oe);W>=Fe&&!Ce.has(Fe)&&(Ce.add(Fe),b[Oe]?.());}}return h}function fe(E){if(ce)return;let h=E-i;ye||(ye=true,O?.());let x=X(h);if(x&&!ie){ie=true,X(o*(1+Math.max(0,ee.length-1)*B)),y?.(),xe<(M==="infinite"?1/0:M??0)&&(xe++,Me=setTimeout(()=>{i=performance.now(),ye=false,ie=false,Ce.clear(),Ve(),te=requestAnimationFrame(fe);},z));return}x||(te=requestAnimationFrame(fe));}function ue(){cancelAnimationFrame(te),clearTimeout(Me),i=performance.now(),v=0,ce=false,ye=false,ie=false,xe=0,Ce.clear(),Ve(),te=requestAnimationFrame(fe);}let w=new IntersectionObserver(E=>{E.forEach(h=>{h.isIntersecting&&!(ne&&ie)?ue():!h.isIntersecting&&!ne&&!ie&&(cancelAnimationFrame(te),clearTimeout(Me),i=null);});},{root:g??null,threshold:k,rootMargin:D}),H;function Z(){clearTimeout(H),H=setTimeout(()=>{ee.forEach((E,h)=>{j[h]=_e(E),E.style.strokeDasharray=`${j[h]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),R>0?setTimeout(()=>w.observe(e),R):w.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(Me),w.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(H);},replay(){xe=0,ue();},pause(){ce||(ce=true,v=performance.now()-i,cancelAnimationFrame(te));},resume(){ce&&(ce=false,i=performance.now()-v,te=requestAnimationFrame(fe));},seek(E){let h=Math.min(1,Math.max(0,E));Pe=h,ce=true,v=h*o,i=performance.now()-v,cancelAnimationFrame(te),X(v);},getProgress(){return Pe}}}if(Q)return vt();nt();function qe(){if(!Ne||ce)return;let o=performance.now(),i=Ie(),v=c;if(L!==false){let w=o-et,H=w>0?Math.abs(i-(ze<0?i:ze))/w:0;v=c*Math.max(.2,1+H*(typeof L=="number"?L:1)*.04);}ze=i,et=o;let X=T?He===-1||i>=He?"forward":"reverse":S;He=i;let fe=Ae-Te,ue=true;if(f){let w=I(J(i,Te,Ae,v));ne&&!T&&(be=Math.max(be,w),w=be),Pe=w,e.style.setProperty("--scroll-draw-progress",String(w));let H=X==="reverse"?1-w:w;e.style.clipPath=me(H),p?.(w),!ye&&J(i,Te,Ae,v)>0&&(ye=true,O?.()),w>=1&&!ie?(ie=true,y?.(),xe<(M==="infinite"?1/0:M??0)&&(xe++,Me=setTimeout(()=>{be=-1,ye=false,ie=false,e.style.clipPath=me(0);},z))):w<1&&!ne&&(ie=false),te=requestAnimationFrame(qe);return}if(ee.forEach((w,H)=>{let Z=H*B*fe,E=I(J(i,Te+Z,Ae+Z,v));ne&&!T&&(be=Math.max(be,E),E=be),Pe=E,w.style.strokeDashoffset=X==="reverse"?`${j[H]*E}`:`${j[H]*(1-E)}`,u&&(w.style.opacity=X==="reverse"?`${1-E}`:`${E}`),re&&V?w.style.stroke=ke(re,V,E):V&&(w.style.stroke=V),U!==null&&oe!==null?w.style.strokeWidth=`${U+(oe-U)*E}`:oe!==null&&(w.style.strokeWidth=`${oe}`),N!==null&&G!==null?w.style.fillOpacity=`${N+(G-N)*E}`:G!==null&&(w.style.fillOpacity=`${G}`),P&&w.tagName.toLowerCase()==="path"&&he[H]&&w.setAttribute("d",Xe(he[H],P,E)),H===0&&(p?.(E),e.style.setProperty("--scroll-draw-progress",String(E))),E<1&&(ue=false);}),b){let w=I(J(i,Te,Ae,v));for(let H in b){let Z=parseFloat(H);w>=Z&&!Ce.has(Z)&&(Ce.add(Z),b[H]?.());}}!ye&&J(i,Te,Ae,v)>0&&(ye=true,O?.()),ue&&!ie?(ie=true,y?.(),xe<(M==="infinite"?1/0:M??0)&&(xe++,Me=setTimeout(()=>{be=-1,ye=false,ie=false,Ce.clear(),Ve();},z))):!ue&&!ne&&(ie=false),te=requestAnimationFrame(qe);}let Ge=new IntersectionObserver(o=>{o.forEach(i=>{Ne=i.isIntersecting,Ne&&!ce?te=requestAnimationFrame(qe):cancelAnimationFrame(te);});},{root:g??null,threshold:k,rootMargin:D}),je;function We(){clearTimeout(je),je=setTimeout(()=>{ee.forEach((o,i)=>{j[i]=_e(o),o.style.strokeDasharray=`${j[i]}`;}),nt();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),R>0?setTimeout(()=>Ge.observe(e),R):Ge.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(Me),Ge.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(je),Be?.remove();},replay(){be=-1,He=-1,ze=-1,ye=false,ie=false,xe=0,ce=false,Ce.clear(),clearTimeout(Me),Ve();},pause(){ce=true,cancelAnimationFrame(te);},resume(){ce&&(ce=false,Ne&&(te=requestAnimationFrame(qe)));},seek(o){let i=Math.min(1,Math.max(0,o));Pe=i,be=i,ce=true,cancelAnimationFrame(te),ht(i,S);},getProgress(){return Pe}}}var ct=new Map;function $e(e,r){ct.set(e,r);}function Le(e){ct.delete(e);}function $t(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ut(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function Lt(e,r,n){let t=ut(e),l=ut(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,d)=>`${u}${s.units[d]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,d)=>`${u}${c.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,d)=>`${u+(c.nums[d]-u)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function mt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if($t(t))return ke(t,l,n);if(t.includes("("))return Lt(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Pt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ft={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Ot=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ft=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ue(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:d,native:F=true,onProgress:B,onComplete:S}=r,ne=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=typeof s=="function"?s:ae[s]??ae["ease-out"],q=le(l.start??"top bottom"),K=le(l.end??"bottom top"),T=typeof d=="string"?document.querySelector(d):d??null,R=Object.entries(t).map(([a,g])=>({prop:Pt(a),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function A(){let a=window.getComputedStyle(e);for(let g of R)g.from===""&&(g.from=a.getPropertyValue(g.prop).trim()||"0");}function C(){for(let a of R)e.style.setProperty(a.prop,String(a.to));}if(ne)return C(),S?.(),n;A();function $(){if(!F||!kt()||typeof s!="string"||!(s in ft)||u!=="y"||T||c||m!==1||B||S||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let a of R)if(!Ot.has(a.prop))return false;return true}function b(){let a=`ssd-a-${++Ft}`,g=R.map(N=>`${N.prop}:${N.from}`).join(";"),re=R.map(N=>`${N.prop}:${N.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${a}{from{${g}}to{${re}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ft[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(a);let U=()=>u==="x"?window.scrollX:window.scrollY,oe=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),V.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(N){let G=Math.min(1,Math.max(0,N));e.classList.remove(a);for(let me of R)e.style.setProperty(me.prop,mt(me.from,me.to,G));},getProgress(){let N=e.getBoundingClientRect(),G=U(),me=oe(),{tStart:ee,tEnd:j}=pe({top:N.top,height:N.height},G,me,q,K);return de(J(G,ee,j,m))}}}if($())return b();let L=0,k=0,D=0,M=false,z=false,P=-1,_=0,Q=false,Y=()=>T?u==="x"?T.scrollLeft:T.scrollTop:u==="x"?window.scrollX:window.scrollY,se=()=>T?u==="x"?T.clientWidth:T.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function p(){let a=e.getBoundingClientRect(),g,re;if(T){let U=T.getBoundingClientRect();g=u==="x"?a.left-U.left+T.scrollLeft:a.top-U.top+T.scrollTop,re=u==="x"?a.width:a.height;}else g=u==="x"?a.left:a.top,re=u==="x"?a.width:a.height;let V=pe({top:g,height:re},Y(),se(),q,K);L=V.tStart,k=V.tEnd;}function O(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let g of R)e.style.setProperty(g.prop,mt(g.from,g.to,a));B?.(a);}function y(){if(!M||z)return;let a=de(J(Y(),L,k,m));c&&(P=Math.max(P,a),a=P),_=a,O(a),a>=1&&!Q?(Q=true,S?.()):a<1&&!c&&(Q=false),D=requestAnimationFrame(y);}p();{let a=de(J(Y(),L,k,m));c&&a>0&&(P=a),_=a,O(a);}let f=new IntersectionObserver(a=>{a.forEach(g=>{M=g.isIntersecting,M&&!z?D=requestAnimationFrame(y):cancelAnimationFrame(D);});},{root:T??null}),I;function ge(){clearTimeout(I),I=setTimeout(p,150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),f.observe(e),$e(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:L,tEnd:k})}),{destroy(){cancelAnimationFrame(D),f.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(I),Le(e);},replay(){P=-1,Q=false,_=0,z=false,O(0);},pause(){z=true,cancelAnimationFrame(D);},resume(){z&&(z=false,M&&(D=requestAnimationFrame(y)));},seek(a){let g=Math.min(1,Math.max(0,a));_=g,P=g,z=true,cancelAnimationFrame(D),O(g);},getProgress(){return _}}}var Ze={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Je(e,r){if(typeof window>"u")return Ze;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Ze;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:d=true,decimals:F,onComplete:B}=r,S=F!==void 0?p=>p.toFixed(F):m??(p=>String(Math.round(p))),ne=typeof c=="function"?c:ae[c]??ae["ease-out"],de=le(u.start??"top 80%"),q=le(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),B?.(),Ze;t.textContent=S(l);let T=0,R=0,A=0,C=false,$=false,b=-1,L=0,k=false,D=()=>window.scrollY,M=()=>window.innerHeight;function z(){let p=t.getBoundingClientRect(),O=pe({top:p.top,height:p.height},D(),M(),de,q);T=O.tStart,R=O.tEnd;}function P(p){t.textContent=S(l+(s-l)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function _(){if(!C||$)return;let p=ne(J(D(),T,R,1));d&&(b=Math.max(b,p),p=b),L=p,P(p),p>=1&&!k?(k=true,B?.()):p<1&&!d&&(k=false),A=requestAnimationFrame(_);}z();{let p=ne(J(D(),T,R,1));d&&p>0&&(b=p),L=p,P(p);}let Q=new IntersectionObserver(p=>{p.forEach(O=>{C=O.isIntersecting,C&&!$?A=requestAnimationFrame(_):cancelAnimationFrame(A);});}),Y;function se(){clearTimeout(Y),Y=setTimeout(z,150);}return window.addEventListener("resize",se),window.addEventListener("orientationchange",se),Q.observe(t),$e(t,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:T,tEnd:R})}),{destroy(){cancelAnimationFrame(A),Q.disconnect(),window.removeEventListener("resize",se),window.removeEventListener("orientationchange",se),clearTimeout(Y),Le(t);},replay(){b=-1,k=false,L=0,$=false,P(0);},pause(){$=true,cancelAnimationFrame(A);},resume(){$&&($=false,C&&(A=requestAnimationFrame(_)));},seek(p){let O=Math.min(1,Math.max(0,p));L=O,b=O,$=true,cancelAnimationFrame(A),P(O);},getProgress(){return L}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ke(e,r={}){if(typeof window>"u")return pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),pt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:d,onComplete:F,onProgress:B}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:ae[s]??ae.linear,de=le(l.start??"top top"),q=le(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let K=r.from??0,T=r.to,R=0,A=0,C=0,$=false,b=false,L=-1,k=0,D=false,M=false,z=()=>c==="x"?window.scrollX:window.scrollY,P=()=>c==="x"?window.innerWidth:window.innerHeight;function _(){let f=t.getBoundingClientRect(),I=c==="x"?f.left:f.top,ge=c==="x"?f.width:f.height,a=pe({top:I,height:ge},z(),P(),de,q);R=a.tStart,A=a.tEnd;}function Q(f){if(!M)return;let I=T??t.duration??0;t.currentTime=K+(I-K)*f,t.style.setProperty("--scroll-draw-progress",String(f)),B?.(f);}function Y(){if(!$||b||!M)return;let f=ne(J(z(),R,A,1));m&&(L=Math.max(L,f),f=L),k=f,Q(f),f>=1&&!D?(D=true,F?.()):f<1&&!m&&(D=false),C=requestAnimationFrame(Y);}function se(){if(M=true,T===void 0&&(T=t.duration),S){Q(1),d?.();return}_(),d?.(),$&&!b&&(C=requestAnimationFrame(Y));}t.readyState>=1?se():t.addEventListener("loadedmetadata",se,{once:true}),M||_();let p=new IntersectionObserver(f=>{f.forEach(I=>{$=I.isIntersecting,$&&!b&&M?C=requestAnimationFrame(Y):cancelAnimationFrame(C);});}),O;function y(){clearTimeout(O),O=setTimeout(_,150);}return window.addEventListener("resize",y),window.addEventListener("orientationchange",y),p.observe(t),$e(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:R,tEnd:A})}),{destroy(){cancelAnimationFrame(C),p.disconnect(),t.removeEventListener("loadedmetadata",se),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),clearTimeout(O),Le(t);},replay(){L=-1,D=false,k=0,b=false,Q(0);},pause(){b=true,cancelAnimationFrame(C);},resume(){b&&(b=false,$&&M&&(C=requestAnimationFrame(Y)));},seek(f){let I=Math.min(1,Math.max(0,f));k=I,L=I,b=true,cancelAnimationFrame(C),Q(I);},getProgress(){return k}}}function yt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function It(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function dt(e){let r=yt(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Dt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function Rt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Qe(e,r={}){if(typeof window>"u")return gt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),gt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:d=true,onComplete:F}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof m=="function"?m:ae[m]??ae["ease-out"],ne=le(u.start??"top 85%"),de=le(u.end??"top 40%"),q=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let K;l==="chars"?K=It(t):l==="lines"?K=dt(t):K=yt(t);let T=K.length;function R(y,f){c?.opacity!==void 0&&(y.style.opacity=String(c.opacity+(1-c.opacity)*f));let I=Rt(f,c);I&&(y.style.transform=I);}function A(y){t.style.setProperty("--scroll-draw-progress",String(y)),K.forEach((f,I)=>{let ge=S(Dt(y,I,T,s));R(f,ge);});}if(B)return A(1),F?.(),{destroy(){t.innerHTML=q,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let C=0,$=0,b=0,L=false,k=false,D=-1,M=0,z=false,P=()=>window.scrollY,_=()=>window.innerHeight;function Q(){let y=t.getBoundingClientRect(),f=pe({top:y.top,height:y.height},P(),_(),ne,de);C=f.tStart,$=f.tEnd;}function Y(){if(!L||k)return;let y=J(P(),C,$,1);d&&(D=Math.max(D,y),y=D),M=y,A(y),y>=1&&!z?(z=true,F?.()):y<1&&!d&&(z=false),b=requestAnimationFrame(Y);}Q();let se=new IntersectionObserver(y=>{y.forEach(f=>{L=f.isIntersecting,L&&!k?b=requestAnimationFrame(Y):cancelAnimationFrame(b);});}),p;function O(){clearTimeout(p),p=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=q,t.setAttribute("aria-label",t.textContent??""),K=dt(t),A(y);}Q();},150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),se.observe(t),$e(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:C,tEnd:$})}),{destroy(){cancelAnimationFrame(b),se.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(p),t.innerHTML=q,t.removeAttribute("aria-label"),Le(t);},replay(){D=-1,z=false,M=0,k=false,A(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,L&&(b=requestAnimationFrame(Y)));},seek(y){let f=Math.min(1,Math.max(0,y));M=f,D=f,k=true,cancelAnimationFrame(b),A(f);},getProgress(){return M}}}function ln(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Ye(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var cn=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Ye(n.value,t);vue.onUnmounted(()=>l.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function un(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Ue(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var mn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=Ue(n.value,e.options);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function fn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Je(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var pn=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=Je(r.value,n);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("span",{ref:r})}});function dn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Ke(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var gn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Ke(r.value,e.options??{});vue.onUnmounted(()=>n.destroy());}),()=>vue.h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function yn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var hn=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=Qe(n.value,e.options??{});vue.onUnmounted(()=>t.destroy());}),()=>vue.h(e.tag,{ref:n},r.default?.())}});exports.ScrollAnimate=mn;exports.ScrollCounter=pn;exports.ScrollDraw=cn;exports.ScrollText=hn;exports.ScrollVideo=gn;exports.useScrollAnimate=un;exports.useScrollCounter=fn;exports.useScrollDraw=ln;exports.useScrollText=yn;exports.useScrollVideo=dn;
|
|
3
|
+
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),t}function Ke(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...ft[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:h="linear",trigger:L={},stagger:_=0,direction:E="forward",once:Q=false,debug:he=false,axis:H="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:P=false,threshold:O=0,rootMargin:G="0px",repeat:$=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:ne=false,duration:D=1e3,native:B=true,onProgress:d,onStart:C,onComplete:g,onEnter:y,onLeave:j,onEnterBack:Ae,onLeaveBack:be}=l,we=z===true?"left":typeof z=="string"?z:false,de=typeof h=="function"?h:ie[h]??ie.linear,He=ae(L.start??"top bottom"),Ie=ae(L.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,X=Array.isArray(A)?A[0]:null,R=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,oe=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(o){let a=o*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let W=we?[]:Array.from(e.querySelectorAll(m)),k=[],fe=[],ge=0,Ce=0,se=false,ye=false,re=0,Be=false,ve=-1,We=-1,le=false,ke=0,Me=0,Le,Ue=null,$e=new Set,_e=-1,st=performance.now(),Ne=NaN;function ze(){return U?H==="x"?U.scrollLeft:U.scrollTop:H==="x"?window.scrollX:window.scrollY}function it(){return U?H==="x"?U.clientWidth:U.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),a,S,Y;if(U){let ue=U.getBoundingClientRect();a=H==="x"?o.left-ue.left+U.scrollLeft:o.top-ue.top+U.scrollTop,S=H==="x"?o.width:o.height,Y=ze();}else a=H==="x"?o.left:o.top,S=H==="x"?o.width:o.height,Y=ze();let ce=pe({top:a,height:S},Y,it(),He,Ie);ge=ce.tStart,Ce=ce.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=kt(ge,Ce,H));}function Et(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),we){let S=a==="reverse"?1-o:o;e.style.clipPath=J(S);return}W.forEach((S,Y)=>{S.style.strokeDashoffset=a==="reverse"?`${k[Y]*o}`:`${k[Y]*(1-o)}`,u&&(S.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&p?S.style.stroke=Re(i,p,o):p&&(S.style.stroke=p),X!==null&&R!==null?S.style.strokeWidth=`${X+(R-X)*o}`:R!==null&&(S.style.strokeWidth=`${R}`),Z!==null&&oe!==null?S.style.fillOpacity=`${Z+(oe-Z)*o}`:oe!==null&&(S.style.fillOpacity=`${oe}`),M&&S.tagName.toLowerCase()==="path"&&fe[Y]&&S.setAttribute("d",Ke(fe[Y],M,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}W.forEach((o,a)=>{o.style.strokeDasharray=`${k[a]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${k[a]}`,u?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),X!==null&&(o.style.strokeWidth=`${X}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&fe[a]&&o.setAttribute("d",fe[a]);});}if(W.forEach(o=>{Ot(o);let a=Ye(o);k.push(a),o.tagName.toLowerCase()==="path"?fe.push(o.getAttribute("d")??""):fe.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),p&&(o.style.stroke=p),R!==null&&(o.style.strokeWidth=`${R}`),oe!==null&&(o.style.fillOpacity=`${oe}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?"0":`${a}`,u?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),X!==null&&(o.style.strokeWidth=`${X}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),we){if(s)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(B===false||!Pt()||!W.length||typeof h!="string"||!(h in pt)||we||H!=="y"||U||c!==1||_!==0||Q||te||P!==false||M||b||$||q>0||d||C||g||y||j||Ae||be||x!=null||A!=null||w!=null||(L.start??"top bottom").trim()!=="top bottom"||(L.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++$t}`,a=E==="reverse"?"0":"var(--ssd-len)",S=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${S};`;u&&(Y+=`opacity:${E==="reverse"?1:0};`,ce+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${o}{from{${Y}}to{${ce}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function me(f,T){f.style.setProperty("--ssd-len",String(k[T])),f.style.strokeDasharray=`${k[T]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}W.forEach(me);let v=false,F=-1;function I(){if(F>=0)return F;let f=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:f.top,height:f.height},ze(),it(),He,Ie);return de(K(ze(),T,V,c))}return {destroy(){W.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),ue.remove();},replay(){v=false,F=-1,W.forEach(me);},pause(){v=true,W.forEach(f=>{f.style.animationPlayState="paused";});},resume(){v&&(v=false,W.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let T=Math.min(1,Math.max(0,f));F=T,v=true,W.forEach((V,Fe)=>{V.classList.remove(o),V.style.strokeDashoffset=E==="reverse"?`${k[Fe]*T}`:`${k[Fe]*(1-T)}`,u&&(V.style.opacity=E==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return I()}}}if(xt())return Tt();function At(){let o=Math.max(1,D),a=0,S=0;function Y(I){let f=true;if(we){let T=Math.min(1,Math.max(0,I/o)),V=de(T);ke=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(E==="reverse"?1-V:V),d?.(V),T<1&&(f=false);}else W.forEach((T,V)=>{let Fe=V*_*o,De=Math.min(1,Math.max(0,(I-Fe)/o)),Se=de(De);T.style.strokeDashoffset=E==="reverse"?`${k[V]*Se}`:`${k[V]*(1-Se)}`,u&&(T.style.opacity=E==="reverse"?`${1-Se}`:`${Se}`),i&&p?T.style.stroke=Re(i,p,Se):p&&(T.style.stroke=p),X!==null&&R!==null?T.style.strokeWidth=`${X+(R-X)*Se}`:R!==null&&(T.style.strokeWidth=`${R}`),Z!==null&&oe!==null?T.style.fillOpacity=`${Z+(oe-Z)*Se}`:oe!==null&&(T.style.fillOpacity=`${oe}`),M&&T.tagName.toLowerCase()==="path"&&fe[V]&&T.setAttribute("d",Ke(fe[V],M,Se)),V===0&&(d?.(Se),e.style.setProperty("--scroll-draw-progress",String(Se))),De<1&&(f=false);});if(b){let T=Math.min(1,Math.max(0,I/o)),V=de(T);for(let Fe in b){let De=parseFloat(Fe);V>=De&&!$e.has(De)&&($e.add(De),b[Fe]?.());}}return f}function ce(I){if(le)return;let f=I-a;ye||(ye=true,C?.());let T=Y(f);if(T&&!se){se=true,Y(o*(1+Math.max(0,W.length-1)*_)),g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{a=performance.now(),ye=false,se=false,$e.clear(),Ge(),re=requestAnimationFrame(ce);},N));return}T||(re=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(re),clearTimeout(Le),a=performance.now(),S=0,le=false,ye=false,se=false,Me=0,$e.clear(),Ge(),re=requestAnimationFrame(ce);}let me=new IntersectionObserver(I=>{I.forEach(f=>{f.isIntersecting&&!(Q&&se)?ue():!f.isIntersecting&&!Q&&!se&&(cancelAnimationFrame(re),clearTimeout(Le),a=null);});},{root:U??null,threshold:O,rootMargin:G}),v;function F(){clearTimeout(v),v=setTimeout(()=>{W.forEach((I,f)=>{k[f]=Ye(I),I.style.strokeDasharray=`${k[f]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),q>0?setTimeout(()=>me.observe(e),q):me.observe(e),{destroy(){cancelAnimationFrame(re),clearTimeout(Le),me.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(v);},replay(){Me=0,ue();},pause(){le||(le=true,S=performance.now()-a,cancelAnimationFrame(re));},resume(){le&&(le=false,a=performance.now()-S,re=requestAnimationFrame(ce));},seek(I){let f=Math.min(1,Math.max(0,I));ke=f,le=true,S=f*o,a=performance.now()-S,cancelAnimationFrame(re),Y(S);},getProgress(){return ke}}}if(ne)return At();at();function je(){if(!Be||le)return;let o=performance.now(),a=ze(),S=c;if(P!==false){let v=o-st,F=v>0?Math.abs(a-(_e<0?a:_e))/v:0;S=c*Math.max(.2,1+F*(typeof P=="number"?P:1)*.04);}_e=a,st=o;let Y=te?We===-1||a>=We?"forward":"reverse":E;We=a;let ce=Ce-ge,ue=true,me=ce===0?0:(a-ge)/ce;if(isNaN(Ne)||(Ne<=0&&me>0?y?.():Ne>0&&me<=0&&be?.(),Ne<1&&me>=1?j?.():Ne>=1&&me<1&&Ae?.()),Ne=me,we){let v=de(K(a,ge,Ce,S));Q&&!te&&(ve=Math.max(ve,v),v=ve),ke=v,e.style.setProperty("--scroll-draw-progress",String(v));let F=Y==="reverse"?1-v:v;e.style.clipPath=J(F),d?.(v),!ye&&K(a,ge,Ce,S)>0&&(ye=true,C?.()),v>=1&&!se?(se=true,g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{ve=-1,ye=false,se=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(se=false),re=requestAnimationFrame(je);return}if(W.forEach((v,F)=>{let I=F*_*ce,f=de(K(a,ge+I,Ce+I,S));Q&&!te&&(ve=Math.max(ve,f),f=ve),ke=f,v.style.strokeDashoffset=Y==="reverse"?`${k[F]*f}`:`${k[F]*(1-f)}`,u&&(v.style.opacity=Y==="reverse"?`${1-f}`:`${f}`),i&&p?v.style.stroke=Re(i,p,f):p&&(v.style.stroke=p),X!==null&&R!==null?v.style.strokeWidth=`${X+(R-X)*f}`:R!==null&&(v.style.strokeWidth=`${R}`),Z!==null&&oe!==null?v.style.fillOpacity=`${Z+(oe-Z)*f}`:oe!==null&&(v.style.fillOpacity=`${oe}`),M&&v.tagName.toLowerCase()==="path"&&fe[F]&&v.setAttribute("d",Ke(fe[F],M,f)),F===0&&(d?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(ue=false);}),b){let v=de(K(a,ge,Ce,S));for(let F in b){let I=parseFloat(F);v>=I&&!$e.has(I)&&($e.add(I),b[F]?.());}}!ye&&K(a,ge,Ce,S)>0&&(ye=true,C?.()),ue&&!se?(se=true,g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{ve=-1,ye=false,se=false,$e.clear(),Ge();},N))):!ue&&!Q&&(se=false),re=requestAnimationFrame(je);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{Be=a.isIntersecting,Be&&!le?re=requestAnimationFrame(je):cancelAnimationFrame(re);});},{root:U??null,threshold:O,rootMargin:G}),Je;function Xe(){clearTimeout(Je),Je=setTimeout(()=>{W.forEach((o,a)=>{k[a]=Ye(o),o.style.strokeDasharray=`${k[a]}`;}),at();},150);}return window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe),q>0?setTimeout(()=>Ze.observe(e),q):Ze.observe(e),{destroy(){cancelAnimationFrame(re),clearTimeout(Le),Ze.disconnect(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,We=-1,_e=-1,ye=false,se=false,Me=0,le=false,$e.clear(),clearTimeout(Le),Ge();},pause(){le=true,cancelAnimationFrame(re);},resume(){le&&(le=false,Be&&(re=requestAnimationFrame(je)));},seek(o){let a=Math.min(1,Math.max(0,o));ke=a,ve=a,le=true,cancelAnimationFrame(re),Et(a,E);},getProgress(){return ke}}}var dt=new Map;function Pe(e,r){dt.set(e,r);}function Oe(e){dt.delete(e);}function Ft(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function It(e,r,n){let t=gt(e),l=gt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,h)=>`${u}${s.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,h)=>`${u+(c.nums[h]-u)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function yt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Ft(t))return Re(t,l,n);if(t.includes("("))return It(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ht={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Rt=0;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:h,native:L=true,onProgress:_,onComplete:E,onEnter:Q,onLeave:he,onEnterBack:H,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof s=="function"?s:ie[s]??ie["ease-out"],x=ae(l.start??"top bottom"),A=ae(l.end??"bottom top"),w=typeof h=="string"?document.querySelector(h):h??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function P(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function O(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return O(),E?.(),n;P();function G(){if(!L||!Ht()||typeof s!="string"||!(s in ht)||u!=="y"||w||c||m!==1||_||E||Q||he||H||ee||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function $(){let i=`ssd-a-${++Rt}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),X=b.map(J=>`${J.prop}:${J.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${p}}to{${X}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let Z=()=>u==="x"?window.scrollX:window.scrollY,oe=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let W=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let k of b)e.style.setProperty(k.prop,yt(k.from,k.to,W));},getProgress(){let J=e.getBoundingClientRect(),W=Z(),k=oe(),{tStart:fe,tEnd:ge}=pe({top:J.top,height:J.height},W,k,x,A);return q(K(W,fe,ge,m))}}}if(G())return $();let N=0,M=0,z=0,ne=false,D=false,B=-1,d=0,C=false,g=NaN,y=()=>w?u==="x"?w.scrollLeft:w.scrollTop:u==="x"?window.scrollX:window.scrollY,j=()=>w?u==="x"?w.clientWidth:w.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function Ae(){let i=e.getBoundingClientRect(),p,X;if(w){let Z=w.getBoundingClientRect();p=u==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,X=u==="x"?i.width:i.height;}else p=u==="x"?i.left:i.top,X=u==="x"?i.width:i.height;let R=pe({top:p,height:X},y(),j(),x,A);N=R.tStart,M=R.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,yt(p.from,p.to,i));_?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?he?.():g>=1&&i<1&&H?.(),g=i;}function de(){if(!ne||D)return;let i=M===N?0:(y()-N)/(M-N);we(i);let p=q(K(y(),N,M,m));c&&(B=Math.max(B,p),p=B),d=p,be(p),p>=1&&!C?(C=true,E?.()):p<1&&!c&&(C=false),z=requestAnimationFrame(de);}Ae();{let i=q(K(y(),N,M,m));c&&i>0&&(B=i),d=i,be(i);}let He=new IntersectionObserver(i=>{i.forEach(p=>{ne=p.isIntersecting,ne&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),Ie;function U(){clearTimeout(Ie),Ie=setTimeout(Ae,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),He.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),He.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Ie),Oe(e);},replay(){B=-1,C=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,ne&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,B=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,r){if(typeof window>"u")return tt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),tt;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:h=true,decimals:L,onComplete:_}=r,E=L!==void 0?d=>d.toFixed(L):m??(d=>String(Math.round(d))),Q=typeof c=="function"?c:ie[c]??ie["ease-out"],he=ae(u.start??"top 80%"),H=ae(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(s),_?.(),tt;t.textContent=E(l);let te=0,q=0,x=0,A=false,w=false,b=-1,P=0,O=false,G=()=>window.scrollY,$=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),C=pe({top:d.top,height:d.height},G(),$(),he,H);te=C.tStart,q=C.tEnd;}function M(d){t.textContent=E(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));h&&(b=Math.max(b,d),d=b),P=d,M(d),d>=1&&!O?(O=true,_?.()):d<1&&!h&&(O=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));h&&d>0&&(b=d),P=d,M(d);}let ne=new IntersectionObserver(d=>{d.forEach(C=>{A=C.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function B(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",B),window.addEventListener("orientationchange",B),ne.observe(t),Pe(t,{type:"counter",getProgress:()=>P,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),ne.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B),clearTimeout(D),Oe(t);},replay(){b=-1,O=false,P=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let C=Math.min(1,Math.max(0,d));P=C,b=C,w=true,cancelAnimationFrame(x),M(C);},getProgress(){return P}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,r={}){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),bt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:h,onComplete:L,onProgress:_}=r,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof s=="function"?s:ie[s]??ie.linear,he=ae(l.start??"top top"),H=ae(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,P=-1,O=0,G=false,$=false,N=()=>c==="x"?window.scrollX:window.scrollY,M=()=>c==="x"?window.innerWidth:window.innerHeight;function z(){let y=t.getBoundingClientRect(),j=c==="x"?y.left:y.top,Ae=c==="x"?y.width:y.height,be=pe({top:j,height:Ae},N(),M(),he,H);q=be.tStart,x=be.tEnd;}function ne(y){if(!$)return;let j=te??t.duration??0;t.currentTime=ee+(j-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),_?.(y);}function D(){if(!w||b||!$)return;let y=Q(K(N(),q,x,1));m&&(P=Math.max(P,y),y=P),O=y,ne(y),y>=1&&!G?(G=true,L?.()):y<1&&!m&&(G=false),A=requestAnimationFrame(D);}function B(){if($=true,te===void 0&&(te=t.duration),E){ne(1),h?.();return}z(),h?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?B():t.addEventListener("loadedmetadata",B,{once:true}),$||z();let d=new IntersectionObserver(y=>{y.forEach(j=>{w=j.isIntersecting,w&&!b&&$?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),C;function g(){clearTimeout(C),C=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",B),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(C),Oe(t);},replay(){P=-1,G=false,O=0,b=false,ne(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&$&&(A=requestAnimationFrame(D)));},seek(y){let j=Math.min(1,Math.max(0,y));O=j,P=j,b=true,cancelAnimationFrame(A),ne(j);},getProgress(){return O}}}function St(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function wt(e){let r=St(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r={}){if(typeof window>"u")return vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),vt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:h=true,onComplete:L}=r,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ie[m]??ie["ease-out"],Q=ae(u.start??"top 85%"),he=ae(u.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;l==="chars"?ee=zt(t):l==="lines"?ee=wt(t):ee=St(t);let te=ee.length;function q(g,y){c?.opacity!==void 0&&(g.style.opacity=String(c.opacity+(1-c.opacity)*y));let j=qt(y,c);j&&(g.style.transform=j);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((y,j)=>{let Ae=E(Vt(g,j,te,s));q(y,Ae);});}if(_)return x(1),L?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,P=false,O=false,G=-1,$=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function ne(){let g=t.getBoundingClientRect(),y=pe({top:g.top,height:g.height},M(),z(),Q,he);A=y.tStart,w=y.tEnd;}function D(){if(!P||O)return;let g=K(M(),A,w,1);h&&(G=Math.max(G,g),g=G),$=g,x(g),g>=1&&!N?(N=true,L?.()):g<1&&!h&&(N=false),b=requestAnimationFrame(D);}ne();let B=new IntersectionObserver(g=>{g.forEach(y=>{P=y.isIntersecting,P&&!O?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function C(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=$;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),ee=wt(t),x(g);}ne();},150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),B.observe(t),Pe(t,{type:"text",getProgress:()=>$,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),B.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Oe(t);},replay(){G=-1,N=false,$=0,O=false,x(0);},pause(){O=true,cancelAnimationFrame(b);},resume(){O&&(O=false,P&&(b=requestAnimationFrame(D)));},seek(g){let y=Math.min(1,Math.max(0,g));$=y,G=y,O=true,cancelAnimationFrame(b),x(y);},getProgress(){return $}}}function pn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var dn=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Qe(n.value,t);vue.onUnmounted(()=>l.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function gn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=et(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var yn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=et(n.value,e.options);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function hn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=nt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var bn=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=nt(r.value,n);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("span",{ref:r})}});function wn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=rt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var vn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=rt(r.value,e.options??{});vue.onUnmounted(()=>n.destroy());}),()=>vue.h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Sn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=ot(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var En=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=ot(n.value,e.options??{});vue.onUnmounted(()=>t.destroy());}),()=>vue.h(e.tag,{ref:n},r.default?.())}});exports.ScrollAnimate=yn;exports.ScrollCounter=bn;exports.ScrollDraw=dn;exports.ScrollText=En;exports.ScrollVideo=vn;exports.useScrollAnimate=gn;exports.useScrollCounter=hn;exports.useScrollDraw=pn;exports.useScrollText=Sn;exports.useScrollVideo=wn;
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -73,6 +73,14 @@ interface ScrollDrawOptions {
|
|
|
73
73
|
onProgress?: (alpha: number) => void;
|
|
74
74
|
onStart?: () => void;
|
|
75
75
|
onComplete?: () => void;
|
|
76
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
77
|
+
onEnter?: () => void;
|
|
78
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
79
|
+
onLeave?: () => void;
|
|
80
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
81
|
+
onEnterBack?: () => void;
|
|
82
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
83
|
+
onLeaveBack?: () => void;
|
|
76
84
|
/**
|
|
77
85
|
* Trigger the animation when the element enters the viewport instead of
|
|
78
86
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -119,6 +127,14 @@ interface ScrollAnimateOptions {
|
|
|
119
127
|
native?: boolean;
|
|
120
128
|
onProgress?: (alpha: number) => void;
|
|
121
129
|
onComplete?: () => void;
|
|
130
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
131
|
+
onEnter?: () => void;
|
|
132
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
133
|
+
onLeave?: () => void;
|
|
134
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
135
|
+
onEnterBack?: () => void;
|
|
136
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
137
|
+
onLeaveBack?: () => void;
|
|
122
138
|
}
|
|
123
139
|
|
|
124
140
|
interface ScrollCounterOptions {
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ interface ScrollDrawOptions {
|
|
|
73
73
|
onProgress?: (alpha: number) => void;
|
|
74
74
|
onStart?: () => void;
|
|
75
75
|
onComplete?: () => void;
|
|
76
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
77
|
+
onEnter?: () => void;
|
|
78
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
79
|
+
onLeave?: () => void;
|
|
80
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
81
|
+
onEnterBack?: () => void;
|
|
82
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
83
|
+
onLeaveBack?: () => void;
|
|
76
84
|
/**
|
|
77
85
|
* Trigger the animation when the element enters the viewport instead of
|
|
78
86
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -119,6 +127,14 @@ interface ScrollAnimateOptions {
|
|
|
119
127
|
native?: boolean;
|
|
120
128
|
onProgress?: (alpha: number) => void;
|
|
121
129
|
onComplete?: () => void;
|
|
130
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
131
|
+
onEnter?: () => void;
|
|
132
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
133
|
+
onLeave?: () => void;
|
|
134
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
135
|
+
onEnterBack?: () => void;
|
|
136
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
137
|
+
onLeaveBack?: () => void;
|
|
122
138
|
}
|
|
123
139
|
|
|
124
140
|
interface ScrollCounterOptions {
|