svg-scroll-draw 2.9.0 → 2.10.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 +42 -0
- package/dist/angular/index.d.ts +42 -0
- package/dist/angular/index.mjs +3 -3
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.d.mts +20 -5
- package/dist/astro/index.d.ts +20 -5
- package/dist/astro/index.mjs +3 -3
- package/dist/cdn/svg-scroll-draw.dev.global.js +1878 -0
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.mjs +2 -2
- package/dist/cli/init.js +104 -101
- 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 +42 -0
- package/dist/group/index.d.ts +42 -0
- package/dist/group/index.mjs +3 -3
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +48 -1
- package/dist/horizontal/index.d.ts +48 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.mjs +4 -4
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +27 -0
- package/dist/nuxt/index.d.ts +27 -0
- package/dist/nuxt/index.mjs +3 -3
- package/dist/pin/index.cjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +15 -0
- package/dist/progress/index.d.ts +15 -0
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +27 -0
- package/dist/react/index.d.ts +27 -0
- package/dist/react/index.mjs +3 -3
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +8 -0
- package/dist/snap/index.d.ts +8 -0
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +42 -0
- package/dist/solid/index.d.ts +42 -0
- package/dist/solid/index.mjs +3 -3
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +42 -0
- package/dist/svelte/index.d.ts +42 -0
- package/dist/svelte/index.mjs +3 -3
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +15 -0
- package/dist/text/index.d.ts +15 -0
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +8 -8
- package/dist/timeline/index.d.mts +31 -0
- package/dist/timeline/index.d.ts +31 -0
- package/dist/timeline/index.mjs +8 -8
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +15 -0
- package/dist/video/index.d.ts +15 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +27 -0
- package/dist/vue/index.d.ts +27 -0
- package/dist/vue/index.mjs +3 -3
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +3 -3
- package/package.json +22 -5
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function Ee({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(r),s=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(u,c);m.push(p),s+=p;}let l=[0],a=0;for(let c=0;c<t;c++)a+=m[c]/s,l.push(a);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let d=(c-l[p])/(l[p+1]-l[p]);if(p===0)return d*(2-d);let v=1-Math.pow(r,p);return v+(1-v)*(2*d-1)*(2*d-1)}return 1}}function xe({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),u=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-u)*(2*Math.PI)/r)+1}var j={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:Ee(),elastic:xe()};function G(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function te(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function ne(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 Se(e,n,t){return Math.min(t,Math.max(n,e))}function B(e,n,t,r){return t===n?0:Se((e-n)/(t-n)*r,0,1)}function U(e,n,t,r,u){let s=te(e.top,e.height,n,r.element)-ne(r.viewport,t),m=te(e.top,e.height,n,u.element)-ne(u.viewport,t);return {tStart:s,tEnd:m}}function re(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function oe(e,n,t){let r=re(e),u=re(n);return !r||!u?e:`rgb(${Math.round(r[0]+(u[0]-r[0])*t)},${Math.round(r[1]+(u[1]-r[1])*t)},${Math.round(r[2]+(u[2]-r[2])*t)})`}var se=new Map;function ie(e,n){se.set(e,n);}function ae(e){se.delete(e);}function Me(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ue(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let u=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let a=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(a?parseFloat(a[1]):0),s.push(a?a[2]:"");}n.push({fn:r[1],nums:u,units:s});}return n}function Pe(e,n,t){let r=ue(e),u=ue(n);return r.length===0||r.length!==u.length?t<1?e:n:r.map((s,m)=>{let l=u[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?t<1?`${s.fn}(${s.nums.map((a,c)=>`${a}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((a,c)=>`${a}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((a,c)=>`${a+(l.nums[c]-a)*t}${s.units[c]}`).join(", ")})`}).join(" ")}function ce(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),u=String(n);if(Me(r))return oe(r,u,t);if(r.includes("("))return Pe(r,u,t);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),a=parseFloat(m[1]);return `${l+(a-l)*t}${s[2]||m[2]}`}return t<1?r:u}function $e(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var le={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Ae=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Te=0;function Le(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function me(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:u={},easing:s="ease-out",speed:m=1,once:l=false,axis:a="y",scrollContainer:c,native:p=true,velocityScale:d=false,onProgress:v,onComplete:R,onEnter:F,onLeave:P,onEnterBack:$,onLeaveBack:I}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,H=typeof s=="function"?s:j[s]??j["ease-out"],Z=G(u.start??"top bottom"),J=G(u.end??"bottom top"),f=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(r).map(([o,i])=>({prop:$e(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function fe(){let o=window.getComputedStyle(e);for(let i of w)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function ge(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}if(k)return ge(),R?.(),t;fe();function de(){if(!p||!Le()||typeof s!="string"||!(s in le)||a!=="y"||f||l||m!==1||v||R||F||P||$||I||d!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Ae.has(o.prop))return false;return true}function be(){let o=`ssd-a-${++Te}`,i=w.map(g=>`${g.prop}:${g.from}`).join(";"),y=w.map(g=>`${g.prop}:${g.to}`).join(";"),h=document.createElement("style");h.setAttribute("data-ssd-animate",""),h.textContent=`@keyframes ${o}{from{${i}}to{${y}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${le[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(h),e.classList.add(o);let b=()=>a==="x"?window.scrollX:window.scrollY,D=()=>a==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),h.remove();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(g){let N=Math.min(1,Math.max(0,g));e.classList.remove(o);for(let C of w)e.style.setProperty(C.prop,ce(C.from,C.to,N));},getProgress(){let g=e.getBoundingClientRect(),N=b(),C=D(),{tStart:ve,tEnd:we}=U({top:g.top,height:g.height},N,C,Z,J);return H(B(N,ve,we,m))}}}if(de())return be();let E=0,A=0,x=0,O=false,S=false,T=-1,L=0,V=false,M=NaN,Y=-1,K=0,q=()=>f?a==="x"?f.scrollLeft:f.scrollTop:a==="x"?window.scrollX:window.scrollY,he=()=>f?a==="x"?f.clientWidth:f.clientHeight:a==="x"?window.innerWidth:window.innerHeight;function Q(){let o=e.getBoundingClientRect(),i,y;if(f){let b=f.getBoundingClientRect();i=a==="x"?o.left-b.left+f.scrollLeft:o.top-b.top+f.scrollTop,y=a==="x"?o.width:o.height;}else i=a==="x"?o.left:o.top,y=a==="x"?o.width:o.height;let h=U({top:i,height:y},q(),he(),Z,J);E=h.tStart,A=h.tEnd;}function X(o){e.style.setProperty("--scroll-draw-progress",String(o));for(let i of w)e.style.setProperty(i.prop,ce(i.from,i.to,o));v?.(o);}function ye(o){if(isNaN(M)){M=o;return}M<=0&&o>0?F?.():M>0&&o<=0&&I?.(),M<1&&o>=1?P?.():M>=1&&o<1&&$?.(),M=o;}function z(){if(!O||S)return;let o=performance.now(),i=q(),y=m;if(d!==false){let D=o-K,g=D>0?Math.abs(i-(Y<0?i:Y))/D:0;y=m*Math.max(.2,1+g*(typeof d=="number"?d:1)*.04);}Y=i,K=o;let h=A===E?0:(i-E)/(A-E);ye(h);let b=H(B(i,E,A,y));l&&(T=Math.max(T,b),b=T),L=b,X(b),b>=1&&!V?(V=true,R?.()):b<1&&!l&&(V=false),x=requestAnimationFrame(z);}Q();{let o=H(B(q(),E,A,m));l&&o>0&&(T=o),L=o,X(o);}let ee=new IntersectionObserver(o=>{o.forEach(i=>{O=i.isIntersecting,O&&!S?x=requestAnimationFrame(z):cancelAnimationFrame(x);});},{root:f??null}),W;function _(){clearTimeout(W),W=setTimeout(Q,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),ee.observe(e),ie(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:E,tEnd:A})}),{destroy(){cancelAnimationFrame(x),ee.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(W),ae(e);},replay(){T=-1,V=false,L=0,S=false,X(0);},pause(){S=true,cancelAnimationFrame(x);},resume(){S&&(S=false,O&&(x=requestAnimationFrame(z)));},seek(o){let i=Math.min(1,Math.max(0,o));L=i,T=i,S=true,cancelAnimationFrame(x),X(i);},getProgress(){return L}}}var Re={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ie(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function Ne(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var pe={destroy:()=>{}};function De(e,n={}){if(typeof window>"u")return pe;let t=Ne(e);if(!t.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollReveal: no elements found:",e),pe;let{preset:r="fadeUp",from:u,stagger:s=.08,easing:m="ease-out",once:l=true,trigger:a,onEnter:c,onLeave:p}=n,d={...Re[r],...u},v=Ie(d),R=Math.min(s*4,4),F=t.map((P,$)=>{let I=Math.max(50,88-$*R),k=Math.max(20,I-35);return me(P,{props:v,easing:m,once:l,native:false,trigger:a??{start:`top ${I}%`,end:`top ${k}%`},onEnter:$===0?c:void 0,onLeave:$===t.length-1?p:void 0})});return {destroy(){F.forEach(P=>P.destroy());}}}export{De as scrollReveal};
|
|
1
|
+
function Ie({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/r)+1}var _={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:Ie(),elastic:_e()};function U(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function ae(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function ue(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 Ce(e,n,t){return Math.min(t,Math.max(n,e))}function k(e,n,t,r){return t===n?0:Ce((e-n)/(t-n)*r,0,1)}function le(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Q(e,n,t,r,a){let i=ae(e.top,e.height,n,r.element)-ue(r.viewport,t),m=ae(e.top,e.height,n,a.element)-ue(a.viewport,t);return {tStart:i,tEnd:m}}function ce(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function me(e,n,t){let r=ce(e),a=ce(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Fe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",pe=33;function Oe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<pe;t++){let r=t/(pe-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function fe(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return Fe;case "ease-in-out":return Oe()?Ve(_["ease-in-out"]):null;default:return null}}var ge=new Map;function de(e,n){ge.set(e,n);}function be(e){ge.delete(e);}var De=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function B(e,...n){De&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function He(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function he(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function Xe(e,n,t){let r=he(e),a=he(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function ye(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(He(r))return me(r,a,t);if(r.includes("("))return Xe(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function ke(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ze=0,we="--scroll-draw-progress";function We(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ee(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:z,onProgress:C,onComplete:w,onEnter:P,onLeave:A,onEnterBack:N,onLeaveBack:Z}=n,ve=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:_[i]??_["ease-out"],J=U(a.start??"top bottom"),K=U(a.end??"bottom top"),ee=z??e,d=typeof c=="string"?document.querySelector(c):c??null,b=Object.entries(r).map(([o,s])=>({prop:ke(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function xe(){let o=window.getComputedStyle(e);for(let s of b)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Me(){for(let o of b)e.style.setProperty(o.prop,String(o.to));}let te=new Map;for(let o of [...b.map(s=>s.prop),we])te.set(o,e.style.getPropertyValue(o));function Y(){for(let[o,s]of te)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(ve)return Me(),w?.(),{...t,destroy:Y,getProgress:()=>1};xe();let ne=typeof i=="string"?fe(i):null;function Pe(){if(!p||!We()||!ne||u!=="y"||d||ee!==e||l||m!==1||C||w||P||A||N||Z||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of b)if(!Be.has(o.prop))return false;return true}function Te(){let o=`ssd-a-${++ze}`,s=b.map(f=>`${f.prop}:${f.from}`).join(";"),H=b.map(f=>`${f.prop}:${f.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${o}{from{${s}}to{${H}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ne};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(o);let y=()=>u==="x"?window.scrollX:window.scrollY,X=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),R.remove(),e.style.animationPlayState="",Y();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let $=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let I of b)e.style.setProperty(I.prop,ye(I.from,I.to,$));},getProgress(){let f=e.getBoundingClientRect(),$=y(),I=X(),{tStart:Ae,tEnd:$e}=Q({top:f.top,height:f.height},$,I,J,K);return W(k($,Ae,$e,m))}}}if(Pe())return Te();let h=0,E=0,S=0,F=false,v=false,T=-1,L=0,O=false,x=NaN,G=-1,re=0,oe=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Le=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function se(){let o=le(ee,d,u),s=Q(o,o.scroll,Le(),J,K);h=s.tStart,E=s.tEnd;}function V(o){e.style.setProperty(we,String(o));for(let s of b)e.style.setProperty(s.prop,ye(s.from,s.to,o));C?.(o);}function Re(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&Z?.(),x<1&&o>=1?A?.():x>=1&&o<1&&N?.(),x=o;}function j(){if(!F||v)return;let o=performance.now(),s=oe(),H=m;if(g!==false){let X=o-re,f=X>0?Math.abs(s-(G<0?s:G))/X:0;H=m*Math.max(.2,1+f*(typeof g=="number"?g:1)*.04);}G=s,re=o;let R=E===h?0:(s-h)/(E-h);Re(R);let y=W(k(s,h,E,H));l&&(T=Math.max(T,y),y=T),L=y,V(y),y>=1&&!O?(O=true,w?.()):y<1&&!l&&(O=false),S=requestAnimationFrame(j);}se(),E===h&&B("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=W(k(oe(),h,E,m));l&&o>0&&(T=o),L=o,V(o);}let ie=new IntersectionObserver(o=>{o.forEach(s=>{F=s.isIntersecting,F&&!v?S=requestAnimationFrame(j):cancelAnimationFrame(S);});},{root:d??null}),q;function D(){clearTimeout(q),q=setTimeout(se,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),ie.observe(e),de(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),ie.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(q),Y(),be(e);},replay(){T=-1,O=false,L=0,v=false,V(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,F&&(S=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,T=s,v=true,cancelAnimationFrame(S),V(s);},getProgress(){return L}}}var Ye={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ge(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function je(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Se={destroy:()=>{}};function it(e,n={}){if(typeof window>"u")return Se;let t=je(e);if(!t.length)return B("scrollReveal: no elements found:",e),Se;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ye[r],...a},M=Ge(g),z=Math.min(i*4,4),C=t.map((w,P)=>{let A=Math.max(50,88-P*z),N=Math.max(20,A-35);return Ee(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${N}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){C.forEach(w=>w.destroy());}}}export{it as scrollReveal};
|
package/dist/snap/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function q({bounces:e=3,decay:
|
|
1
|
+
'use strict';function q({bounces:e=3,decay:o=.5}={}){let t=Math.max(1,Math.round(e)),c=Math.max(.01,Math.min(.99,o)),m=Math.sqrt(c),a=0,M=[];for(let n=0;n<t;n++){let i=Math.pow(m,n);M.push(i),a+=i;}let d=[0],g=0;for(let n=0;n<t;n++)g+=M[n]/a,d.push(g);return n=>{if(n<=0)return 0;if(n>=1)return 1;for(let i=0;i<t;i++)if(n<=d[i+1]){let h=(n-d[i])/(d[i+1]-d[i]);if(i===0)return h*(2-h);let v=1-Math.pow(c,i);return v+(1-v)*(2*h-1)*(2*h-1)}return 1}}function B({amplitude:e=1,period:o=.4}={}){let t=Math.max(1,e),c=Math.max(.1,o),m=t<=1?c/4:c/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-m)*(2*Math.PI)/c)+1}var E={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:q(),elastic:B()};function I(e,o,t){return Math.min(t,Math.max(o,e))}var P=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...o){P&&console.warn(`[svg-scroll-draw] ${e}`,...o);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let o=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof o.addEventListener=="function")return o.addEventListener("change",t),()=>o.removeEventListener("change",t);let c=o;return c.addListener?.(t),()=>c.removeListener?.(t)}var Q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function W(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function J(e,o={}){if(typeof window>"u")return Q;let t=W(e);if(!t.length)return V("scrollSnap: no sections found"),Q;let{direction:c="vertical",duration:m=600,easing:a="ease-in-out",threshold:M=.3,scrollContainer:d,onSnap:g,respectReducedMotion:n=true}=o,i=n&&D(),h=n?O(u=>{i=u;}):()=>{},v=typeof a=="function"?a:E[a]??E["ease-in-out"],f=c==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,s=0,p=false,L=0;function T(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(u){l?f?l.scrollLeft=u:l.scrollTop=u:window.scrollTo(f?{left:u}:{top:u});}function R(){return t.map(u=>{let r=u.getBoundingClientRect();if(l){let b=l.getBoundingClientRect();return f?r.left-b.left+l.scrollLeft:r.top-b.top+l.scrollTop}return f?r.left+window.scrollX:r.top+window.scrollY})}function S(u){let r=I(u,0,t.length-1);p&&(cancelAnimationFrame(L),p=false),p=true;let b=R(),w=T(),y=b[r];if(Math.abs(w-y)<1){p=false,s=r,g?.(r);return}if(i){_(y),p=false,s=r,g?.(r);return}let $=performance.now();function N(G){let F=I((G-$)/m,0,1);_(w+(y-w)*v(F)),F<1?L=requestAnimationFrame(N):(p=false,s=r,g?.(r));}L=requestAnimationFrame(N);}let x;function A(){p||(clearTimeout(x),x=setTimeout(()=>{let u=T(),r=R();if(Math.abs(u-r[s])<1)return;let b=f?t[s].offsetWidth:t[s].offsetHeight,w=u-r[s];w>b*M&&s<t.length-1?S(s+1):w<-(b*M)&&s>0?S(s-1):S(s);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),{destroy(){cancelAnimationFrame(L),clearTimeout(x),C.removeEventListener("scroll",A),h();},snapTo:S,getCurrentIndex(){return s}}}exports.scrollSnap=J;
|
package/dist/snap/index.d.mts
CHANGED
|
@@ -16,6 +16,14 @@ interface ScrollSnapOptions {
|
|
|
16
16
|
scrollContainer?: string | Element;
|
|
17
17
|
/** Fires after each snap with the target section index. */
|
|
18
18
|
onSnap?: (index: number) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Honour `prefers-reduced-motion: reduce` by jumping straight to the target
|
|
21
|
+
* section instead of animating the scroll. Default: `true`.
|
|
22
|
+
*
|
|
23
|
+
* Snapping still happens — only the animated scroll is dropped. Set to `false`
|
|
24
|
+
* only if you have a specific reason to override the user's stated preference.
|
|
25
|
+
*/
|
|
26
|
+
respectReducedMotion?: boolean;
|
|
19
27
|
}
|
|
20
28
|
interface ScrollSnapInstance {
|
|
21
29
|
/** Remove snap behaviour and all listeners. */
|
package/dist/snap/index.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ interface ScrollSnapOptions {
|
|
|
16
16
|
scrollContainer?: string | Element;
|
|
17
17
|
/** Fires after each snap with the target section index. */
|
|
18
18
|
onSnap?: (index: number) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Honour `prefers-reduced-motion: reduce` by jumping straight to the target
|
|
21
|
+
* section instead of animating the scroll. Default: `true`.
|
|
22
|
+
*
|
|
23
|
+
* Snapping still happens — only the animated scroll is dropped. Set to `false`
|
|
24
|
+
* only if you have a specific reason to override the user's stated preference.
|
|
25
|
+
*/
|
|
26
|
+
respectReducedMotion?: boolean;
|
|
19
27
|
}
|
|
20
28
|
interface ScrollSnapInstance {
|
|
21
29
|
/** Remove snap behaviour and all listeners. */
|
package/dist/snap/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function q({bounces:e=3,decay:
|
|
1
|
+
function q({bounces:e=3,decay:o=.5}={}){let t=Math.max(1,Math.round(e)),c=Math.max(.01,Math.min(.99,o)),m=Math.sqrt(c),a=0,M=[];for(let n=0;n<t;n++){let i=Math.pow(m,n);M.push(i),a+=i;}let d=[0],g=0;for(let n=0;n<t;n++)g+=M[n]/a,d.push(g);return n=>{if(n<=0)return 0;if(n>=1)return 1;for(let i=0;i<t;i++)if(n<=d[i+1]){let h=(n-d[i])/(d[i+1]-d[i]);if(i===0)return h*(2-h);let v=1-Math.pow(c,i);return v+(1-v)*(2*h-1)*(2*h-1)}return 1}}function B({amplitude:e=1,period:o=.4}={}){let t=Math.max(1,e),c=Math.max(.1,o),m=t<=1?c/4:c/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-m)*(2*Math.PI)/c)+1}var E={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:q(),elastic:B()};function I(e,o,t){return Math.min(t,Math.max(o,e))}var P=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...o){P&&console.warn(`[svg-scroll-draw] ${e}`,...o);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let o=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof o.addEventListener=="function")return o.addEventListener("change",t),()=>o.removeEventListener("change",t);let c=o;return c.addListener?.(t),()=>c.removeListener?.(t)}var Q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function W(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function J(e,o={}){if(typeof window>"u")return Q;let t=W(e);if(!t.length)return V("scrollSnap: no sections found"),Q;let{direction:c="vertical",duration:m=600,easing:a="ease-in-out",threshold:M=.3,scrollContainer:d,onSnap:g,respectReducedMotion:n=true}=o,i=n&&D(),h=n?O(u=>{i=u;}):()=>{},v=typeof a=="function"?a:E[a]??E["ease-in-out"],f=c==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,s=0,p=false,L=0;function T(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(u){l?f?l.scrollLeft=u:l.scrollTop=u:window.scrollTo(f?{left:u}:{top:u});}function R(){return t.map(u=>{let r=u.getBoundingClientRect();if(l){let b=l.getBoundingClientRect();return f?r.left-b.left+l.scrollLeft:r.top-b.top+l.scrollTop}return f?r.left+window.scrollX:r.top+window.scrollY})}function S(u){let r=I(u,0,t.length-1);p&&(cancelAnimationFrame(L),p=false),p=true;let b=R(),w=T(),y=b[r];if(Math.abs(w-y)<1){p=false,s=r,g?.(r);return}if(i){_(y),p=false,s=r,g?.(r);return}let $=performance.now();function N(G){let F=I((G-$)/m,0,1);_(w+(y-w)*v(F)),F<1?L=requestAnimationFrame(N):(p=false,s=r,g?.(r));}L=requestAnimationFrame(N);}let x;function A(){p||(clearTimeout(x),x=setTimeout(()=>{let u=T(),r=R();if(Math.abs(u-r[s])<1)return;let b=f?t[s].offsetWidth:t[s].offsetHeight,w=u-r[s];w>b*M&&s<t.length-1?S(s+1):w<-(b*M)&&s>0?S(s-1):S(s);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),{destroy(){cancelAnimationFrame(L),clearTimeout(x),C.removeEventListener("scroll",A),h();},snapTo:S,getCurrentIndex(){return s}}}export{J as scrollSnap};
|
package/dist/solid/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var solidJs=require('solid-js');function
|
|
2
|
-
<div style="position:absolute;${
|
|
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 Ue(e,r,n){let t=(r.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)*n).toFixed(4))})}function Ze(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...lt[n],...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:h="linear",trigger:P={},stagger:R=0,direction:E="forward",once:j=false,debug:he=false,axis:V="y",scrollContainer:ee,autoReverse:U=false,delay:Z=0,strokeColor:S,strokeWidth:A,fillOpacity:L,waypoints:g,velocityScale:T=false,threshold:O=0,rootMargin:G="0px",repeat:I=0,repeatDelay:se=0,morphTo:$,clip:_,autoplay:B=false,duration:X=1e3,native:z=true,onProgress:p,onStart:x,onComplete:b,onEnter:y,onLeave:q,onEnterBack:xe,onLeaveBack:Me}=u,be=_===true?"left":typeof _=="string"?_:false,we=typeof h=="function"?h:ae[h]??ae.linear,Ie=le(P.start??"top bottom"),Re=le(P.end??"bottom top"),te=typeof ee=="string"?document.querySelector(ee):ee??null,pe=Array.isArray(S)?S[0]:null,J=Array.isArray(S)?S[1]:typeof S=="string"?S:null,K=Array.isArray(A)?A[0]:null,i=Array.isArray(A)?A[1]:typeof A=="number"?A:null,d=Array.isArray(L)?L[0]:null,k=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function ne(o){let a=o*100;switch(be){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 C=be?[]:Array.from(e.querySelectorAll(m)),N=[],D=[],ie=0,ce=0,re=false,de=false,oe=0,Ve=false,ve=-1,ze=-1,ue=false,Oe=0,Ae=0,Le,Xe=null,$e=new Set,qe=-1,nt=performance.now(),De=NaN;function Ne(){return te?V==="x"?te.scrollLeft:te.scrollTop:V==="x"?window.scrollX:window.scrollY}function rt(){return te?V==="x"?te.clientWidth:te.clientHeight:V==="x"?window.innerWidth:window.innerHeight}function ot(){let o=e.getBoundingClientRect(),a,v,Y;if(te){let me=te.getBoundingClientRect();a=V==="x"?o.left-me.left+te.scrollLeft:o.top-me.top+te.scrollTop,v=V==="x"?o.width:o.height,Y=Ne();}else a=V==="x"?o.left:o.top,v=V==="x"?o.width:o.height,Y=Ne();let fe=ye({top:a,height:v},Y,rt(),Ie,Re);ie=fe.tStart,ce=fe.tEnd,he&&process.env.NODE_ENV!=="production"&&(Xe?.remove(),Xe=Ct(ie,ce,V));}function wt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),be){let v=a==="reverse"?1-o:o;e.style.clipPath=ne(v);return}C.forEach((v,Y)=>{v.style.strokeDashoffset=a==="reverse"?`${N[Y]*o}`:`${N[Y]*(1-o)}`,c&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&J?v.style.stroke=He(pe,J,o):J&&(v.style.stroke=J),K!==null&&i!==null?v.style.strokeWidth=`${K+(i-K)*o}`:i!==null&&(v.style.strokeWidth=`${i}`),d!==null&&k!==null?v.style.fillOpacity=`${d+(k-d)*o}`:k!==null&&(v.style.fillOpacity=`${k}`),$&&v.tagName.toLowerCase()==="path"&&D[Y]&&v.setAttribute("d",Ue(D[Y],$,o));});}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),be){e.style.clipPath=ne(0);return}C.forEach((o,a)=>{o.style.strokeDasharray=`${N[a]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${N[a]}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`),$&&o.tagName.toLowerCase()==="path"&&D[a]&&o.setAttribute("d",D[a]);});}if(C.forEach(o=>{$t(o);let a=Ge(o);N.push(a),o.tagName.toLowerCase()==="path"?D.push(o.getAttribute("d")??""):D.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),J&&(o.style.stroke=J),i!==null&&(o.style.strokeWidth=`${i}`),k!==null&&(o.style.fillOpacity=`${k}`),$&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",$)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?"0":`${a}`,c?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`));}),be){if(s)return e.style.clipPath=ne(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0);}else if(s)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function vt(){return !(z===false||!Lt()||!C.length||typeof h!="string"||!(h in ut)||be||V!=="y"||te||l!==1||R!==0||j||U||T!==false||$||g||I||Z>0||p||x||b||y||q||xe||Me||S!=null||A!=null||L!=null||(P.start??"top bottom").trim()!=="top bottom"||(P.end??"bottom top").trim()!=="bottom top")}function Et(){let o=`svg-scroll-draw-${++At}`,a=E==="reverse"?"0":"var(--ssd-len)",v=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${a};`,fe=`stroke-dashoffset:${v};`;c&&(Y+=`opacity:${E==="reverse"?1:0};`,fe+=`opacity:${E==="reverse"?0:1};`);let me=document.createElement("style");me.setAttribute("data-svg-scroll-draw",""),me.textContent=`@keyframes ${o}{from{${Y}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ut[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(me);function ge(f,M){f.style.setProperty("--ssd-len",String(N[M])),f.style.strokeDasharray=`${N[M]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}C.forEach(ge);let w=false,F=-1;function H(){if(F>=0)return F;let f=e.getBoundingClientRect(),{tStart:M,tEnd:W}=ye({top:f.top,height:f.height},Ne(),rt(),Ie,Re);return we(Q(Ne(),M,W,l))}return {destroy(){C.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),me.remove();},replay(){w=false,F=-1,C.forEach(ge);},pause(){w=true,C.forEach(f=>{f.style.animationPlayState="paused";});},resume(){w&&(w=false,C.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let M=Math.min(1,Math.max(0,f));F=M,w=true,C.forEach((W,ke)=>{W.classList.remove(o),W.style.strokeDashoffset=E==="reverse"?`${N[ke]*M}`:`${N[ke]*(1-M)}`,c&&(W.style.opacity=E==="reverse"?`${1-M}`:`${M}`);});},getProgress(){return H()}}}if(vt())return Et();function St(){let o=Math.max(1,X),a=0,v=0;function Y(H){let f=true;if(be){let M=Math.min(1,Math.max(0,H/o)),W=we(M);Oe=W,e.style.setProperty("--scroll-draw-progress",String(W)),e.style.clipPath=ne(E==="reverse"?1-W:W),p?.(W),M<1&&(f=false);}else C.forEach((M,W)=>{let ke=W*R*o,Fe=Math.min(1,Math.max(0,(H-ke)/o)),Ee=we(Fe);M.style.strokeDashoffset=E==="reverse"?`${N[W]*Ee}`:`${N[W]*(1-Ee)}`,c&&(M.style.opacity=E==="reverse"?`${1-Ee}`:`${Ee}`),pe&&J?M.style.stroke=He(pe,J,Ee):J&&(M.style.stroke=J),K!==null&&i!==null?M.style.strokeWidth=`${K+(i-K)*Ee}`:i!==null&&(M.style.strokeWidth=`${i}`),d!==null&&k!==null?M.style.fillOpacity=`${d+(k-d)*Ee}`:k!==null&&(M.style.fillOpacity=`${k}`),$&&M.tagName.toLowerCase()==="path"&&D[W]&&M.setAttribute("d",Ue(D[W],$,Ee)),W===0&&(p?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Fe<1&&(f=false);});if(g){let M=Math.min(1,Math.max(0,H/o)),W=we(M);for(let ke in g){let Fe=parseFloat(ke);W>=Fe&&!$e.has(Fe)&&($e.add(Fe),g[ke]?.());}}return f}function fe(H){if(ue)return;let f=H-a;de||(de=true,x?.());let M=Y(f);if(M&&!re){re=true,Y(o*(1+Math.max(0,C.length-1)*R)),b?.(),Ae<(I==="infinite"?1/0:I??0)&&(Ae++,Le=setTimeout(()=>{a=performance.now(),de=false,re=false,$e.clear(),We(),oe=requestAnimationFrame(fe);},se));return}M||(oe=requestAnimationFrame(fe));}function me(){cancelAnimationFrame(oe),clearTimeout(Le),a=performance.now(),v=0,ue=false,de=false,re=false,Ae=0,$e.clear(),We(),oe=requestAnimationFrame(fe);}let ge=new IntersectionObserver(H=>{H.forEach(f=>{f.isIntersecting&&!(j&&re)?me():!f.isIntersecting&&!j&&!re&&(cancelAnimationFrame(oe),clearTimeout(Le),a=null);});},{root:te??null,threshold:O,rootMargin:G}),w;function F(){clearTimeout(w),w=setTimeout(()=>{C.forEach((H,f)=>{N[f]=Ge(H),H.style.strokeDasharray=`${N[f]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),Z>0?setTimeout(()=>ge.observe(e),Z):ge.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),ge.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(w);},replay(){Ae=0,me();},pause(){ue||(ue=true,v=performance.now()-a,cancelAnimationFrame(oe));},resume(){ue&&(ue=false,a=performance.now()-v,oe=requestAnimationFrame(fe));},seek(H){let f=Math.min(1,Math.max(0,H));Oe=f,ue=true,v=f*o,a=performance.now()-v,cancelAnimationFrame(oe),Y(v);},getProgress(){return Oe}}}if(B)return St();ot();function _e(){if(!Ve||ue)return;let o=performance.now(),a=Ne(),v=l;if(T!==false){let w=o-nt,F=w>0?Math.abs(a-(qe<0?a:qe))/w:0;v=l*Math.max(.2,1+F*(typeof T=="number"?T:1)*.04);}qe=a,nt=o;let Y=U?ze===-1||a>=ze?"forward":"reverse":E;ze=a;let fe=ce-ie,me=true,ge=fe===0?0:(a-ie)/fe;if(isNaN(De)||(De<=0&&ge>0?y?.():De>0&&ge<=0&&Me?.(),De<1&&ge>=1?q?.():De>=1&&ge<1&&xe?.()),De=ge,be){let w=we(Q(a,ie,ce,v));j&&!U&&(ve=Math.max(ve,w),w=ve),Oe=w,e.style.setProperty("--scroll-draw-progress",String(w));let F=Y==="reverse"?1-w:w;e.style.clipPath=ne(F),p?.(w),!de&&Q(a,ie,ce,v)>0&&(de=true,x?.()),w>=1&&!re?(re=true,b?.(),Ae<(I==="infinite"?1/0:I??0)&&(Ae++,Le=setTimeout(()=>{ve=-1,de=false,re=false,e.style.clipPath=ne(0);},se))):w<1&&!j&&(re=false),oe=requestAnimationFrame(_e);return}if(C.forEach((w,F)=>{let H=F*R*fe,f=we(Q(a,ie+H,ce+H,v));j&&!U&&(ve=Math.max(ve,f),f=ve),Oe=f,w.style.strokeDashoffset=Y==="reverse"?`${N[F]*f}`:`${N[F]*(1-f)}`,c&&(w.style.opacity=Y==="reverse"?`${1-f}`:`${f}`),pe&&J?w.style.stroke=He(pe,J,f):J&&(w.style.stroke=J),K!==null&&i!==null?w.style.strokeWidth=`${K+(i-K)*f}`:i!==null&&(w.style.strokeWidth=`${i}`),d!==null&&k!==null?w.style.fillOpacity=`${d+(k-d)*f}`:k!==null&&(w.style.fillOpacity=`${k}`),$&&w.tagName.toLowerCase()==="path"&&D[F]&&w.setAttribute("d",Ue(D[F],$,f)),F===0&&(p?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(me=false);}),g){let w=we(Q(a,ie,ce,v));for(let F in g){let H=parseFloat(F);w>=H&&!$e.has(H)&&($e.add(H),g[F]?.());}}!de&&Q(a,ie,ce,v)>0&&(de=true,x?.()),me&&!re?(re=true,b?.(),Ae<(I==="infinite"?1/0:I??0)&&(Ae++,Le=setTimeout(()=>{ve=-1,de=false,re=false,$e.clear(),We();},se))):!me&&!j&&(re=false),oe=requestAnimationFrame(_e);}let Ye=new IntersectionObserver(o=>{o.forEach(a=>{Ve=a.isIntersecting,Ve&&!ue?oe=requestAnimationFrame(_e):cancelAnimationFrame(oe);});},{root:te??null,threshold:O,rootMargin:G}),je;function Be(){clearTimeout(je),je=setTimeout(()=>{C.forEach((o,a)=>{N[a]=Ge(o),o.style.strokeDasharray=`${N[a]}`;}),ot();},150);}return window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be),Z>0?setTimeout(()=>Ye.observe(e),Z):Ye.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),Ye.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(je),Xe?.remove();},replay(){ve=-1,ze=-1,qe=-1,de=false,re=false,Ae=0,ue=false,$e.clear(),clearTimeout(Le),We();},pause(){ue=true,cancelAnimationFrame(oe);},resume(){ue&&(ue=false,Ve&&(oe=requestAnimationFrame(_e)));},seek(o){let a=Math.min(1,Math.max(0,o));Oe=a,ve=a,ue=true,cancelAnimationFrame(oe),wt(a,E);},getProgress(){return Oe}}}var ft=new Map;function Ce(e,r){ft.set(e,r);}function Pe(e){ft.delete(e);}function Pt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function mt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.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]:"");}r.push({fn:t[1],nums:u,units:s});}return r}function It(e,r,n){let t=mt(e),u=mt(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((s,m)=>{let l=u[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<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)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function pt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Pt(t))return He(t,u,n);if(t.includes("("))return It(t,u,n);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)*n}${s[2]||m[2]}`}return n<1?t:u}function Ot(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var dt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Dt=0;function Ft(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Je(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:s="ease-out",speed:m=1,once:l=false,axis:c="y",scrollContainer:h,native:P=true,velocityScale:R=false,onProgress:E,onComplete:j,onEnter:he,onLeave:V,onEnterBack:ee,onLeaveBack:U}=r,Z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof s=="function"?s:ae[s]??ae["ease-out"],A=le(u.start??"top bottom"),L=le(u.end??"bottom top"),g=typeof h=="string"?document.querySelector(h):h??null,T=Object.entries(t).map(([i,d])=>({prop:Ot(i),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function O(){let i=window.getComputedStyle(e);for(let d of T)d.from===""&&(d.from=i.getPropertyValue(d.prop).trim()||"0");}function G(){for(let i of T)e.style.setProperty(i.prop,String(i.to));}if(Z)return G(),j?.(),n;O();function I(){if(!P||!Ft()||typeof s!="string"||!(s in dt)||c!=="y"||g||l||m!==1||E||j||he||V||ee||U||R!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of T)if(!kt.has(i.prop))return false;return true}function se(){let i=`ssd-a-${++Dt}`,d=T.map(D=>`${D.prop}:${D.from}`).join(";"),k=T.map(D=>`${D.prop}:${D.to}`).join(";"),ne=document.createElement("style");ne.setAttribute("data-ssd-animate",""),ne.textContent=`@keyframes ${i}{from{${d}}to{${k}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${dt[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ne),e.classList.add(i);let C=()=>c==="x"?window.scrollX:window.scrollY,N=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),ne.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(D){let ie=Math.min(1,Math.max(0,D));e.classList.remove(i);for(let ce of T)e.style.setProperty(ce.prop,pt(ce.from,ce.to,ie));},getProgress(){let D=e.getBoundingClientRect(),ie=C(),ce=N(),{tStart:re,tEnd:de}=ye({top:D.top,height:D.height},ie,ce,A,L);return S(Q(ie,re,de,m))}}}if(I())return se();let $=0,_=0,B=0,X=false,z=false,p=-1,x=0,b=false,y=NaN,q=-1,xe=0,Me=()=>g?c==="x"?g.scrollLeft:g.scrollTop:c==="x"?window.scrollX:window.scrollY,be=()=>g?c==="x"?g.clientWidth:g.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function we(){let i=e.getBoundingClientRect(),d,k;if(g){let C=g.getBoundingClientRect();d=c==="x"?i.left-C.left+g.scrollLeft:i.top-C.top+g.scrollTop,k=c==="x"?i.width:i.height;}else d=c==="x"?i.left:i.top,k=c==="x"?i.width:i.height;let ne=ye({top:d,height:k},Me(),be(),A,L);$=ne.tStart,_=ne.tEnd;}function Ie(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let d of T)e.style.setProperty(d.prop,pt(d.from,d.to,i));E?.(i);}function Re(i){if(isNaN(y)){y=i;return}y<=0&&i>0?he?.():y>0&&i<=0&&U?.(),y<1&&i>=1?V?.():y>=1&&i<1&&ee?.(),y=i;}function te(){if(!X||z)return;let i=performance.now(),d=Me(),k=m;if(R!==false){let N=i-xe,D=N>0?Math.abs(d-(q<0?d:q))/N:0;k=m*Math.max(.2,1+D*(typeof R=="number"?R:1)*.04);}q=d,xe=i;let ne=_===$?0:(d-$)/(_-$);Re(ne);let C=S(Q(d,$,_,k));l&&(p=Math.max(p,C),C=p),x=C,Ie(C),C>=1&&!b?(b=true,j?.()):C<1&&!l&&(b=false),B=requestAnimationFrame(te);}we();{let i=S(Q(Me(),$,_,m));l&&i>0&&(p=i),x=i,Ie(i);}let pe=new IntersectionObserver(i=>{i.forEach(d=>{X=d.isIntersecting,X&&!z?B=requestAnimationFrame(te):cancelAnimationFrame(B);});},{root:g??null}),J;function K(){clearTimeout(J),J=setTimeout(we,150);}return window.addEventListener("resize",K),window.addEventListener("orientationchange",K),pe.observe(e),Ce(e,{type:"animate",getProgress:()=>x,getTrigger:()=>({tStart:$,tEnd:_})}),{destroy(){cancelAnimationFrame(B),pe.disconnect(),window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),clearTimeout(J),Pe(e);},replay(){p=-1,b=false,x=0,z=false,Ie(0);},pause(){z=true,cancelAnimationFrame(B);},resume(){z&&(z=false,X&&(B=requestAnimationFrame(te)));},seek(i){let d=Math.min(1,Math.max(0,i));x=d,p=d,z=true,cancelAnimationFrame(B),Ie(d);},getProgress(){return x}}}var Ke={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Qe(e,r){if(typeof window>"u")return Ke;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),Ke;let t=n,{from:u=0,to:s,format:m,easing:l="ease-out",trigger:c={},once:h=true,decimals:P,onComplete:R}=r,E=P!==void 0?p=>p.toFixed(P):m??(p=>String(Math.round(p))),j=typeof l=="function"?l:ae[l]??ae["ease-out"],he=le(c.start??"top 80%"),V=le(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(s),R?.(),Ke;t.textContent=E(u);let U=0,Z=0,S=0,A=false,L=false,g=-1,T=0,O=false,G=()=>window.scrollY,I=()=>window.innerHeight;function se(){let p=t.getBoundingClientRect(),x=ye({top:p.top,height:p.height},G(),I(),he,V);U=x.tStart,Z=x.tEnd;}function $(p){t.textContent=E(u+(s-u)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function _(){if(!A||L)return;let p=j(Q(G(),U,Z,1));h&&(g=Math.max(g,p),p=g),T=p,$(p),p>=1&&!O?(O=true,R?.()):p<1&&!h&&(O=false),S=requestAnimationFrame(_);}se();{let p=j(Q(G(),U,Z,1));h&&p>0&&(g=p),T=p,$(p);}let B=new IntersectionObserver(p=>{p.forEach(x=>{A=x.isIntersecting,A&&!L?S=requestAnimationFrame(_):cancelAnimationFrame(S);});}),X;function z(){clearTimeout(X),X=setTimeout(se,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),B.observe(t),Ce(t,{type:"counter",getProgress:()=>T,getTrigger:()=>({tStart:U,tEnd:Z})}),{destroy(){cancelAnimationFrame(S),B.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(X),Pe(t);},replay(){g=-1,O=false,T=0,L=false,$(0);},pause(){L=true,cancelAnimationFrame(S);},resume(){L&&(L=false,A&&(S=requestAnimationFrame(_)));},seek(p){let x=Math.min(1,Math.max(0,p));T=x,g=x,L=true,cancelAnimationFrame(S),$(x);},getProgress(){return T}}}var gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function et(e,r={}){if(typeof window>"u")return gt;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),gt;let t=n,{trigger:u={},easing:s="linear",once:m=false,axis:l="y",preload:c="auto",onReady:h,onComplete:P,onProgress:R}=r,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=typeof s=="function"?s:ae[s]??ae.linear,he=le(u.start??"top top"),V=le(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=r.from??0,U=r.to,Z=0,S=0,A=0,L=false,g=false,T=-1,O=0,G=false,I=false,se=()=>l==="x"?window.scrollX:window.scrollY,$=()=>l==="x"?window.innerWidth:window.innerHeight;function _(){let y=t.getBoundingClientRect(),q=l==="x"?y.left:y.top,xe=l==="x"?y.width:y.height,Me=ye({top:q,height:xe},se(),$(),he,V);Z=Me.tStart,S=Me.tEnd;}function B(y){if(!I)return;let q=U??t.duration??0;t.currentTime=ee+(q-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),R?.(y);}function X(){if(!L||g||!I)return;let y=j(Q(se(),Z,S,1));m&&(T=Math.max(T,y),y=T),O=y,B(y),y>=1&&!G?(G=true,P?.()):y<1&&!m&&(G=false),A=requestAnimationFrame(X);}function z(){if(I=true,U===void 0&&(U=t.duration),E){B(1),h?.();return}_(),h?.(),L&&!g&&(A=requestAnimationFrame(X));}t.readyState>=1?z():t.addEventListener("loadedmetadata",z,{once:true}),I||_();let p=new IntersectionObserver(y=>{y.forEach(q=>{L=q.isIntersecting,L&&!g&&I?A=requestAnimationFrame(X):cancelAnimationFrame(A);});}),x;function b(){clearTimeout(x),x=setTimeout(_,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),p.observe(t),Ce(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:Z,tEnd:S})}),{destroy(){cancelAnimationFrame(A),p.disconnect(),t.removeEventListener("loadedmetadata",z),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(x),Pe(t);},replay(){T=-1,G=false,O=0,g=false,B(0);},pause(){g=true,cancelAnimationFrame(A);},resume(){g&&(g=false,L&&I&&(A=requestAnimationFrame(X)));},seek(y){let q=Math.min(1,Math.max(0,y));O=q,T=q,g=true,cancelAnimationFrame(A),B(q);},getProgress(){return O}}}function bt(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 Ht(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 yt(e){let r=bt(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=[],u=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of u){let m=n.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 Nt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,s=r*t,m=s+(1-u);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 ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tt(e,r={}){if(typeof window>"u")return ht;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),ht;let t=n,{split:u="words",stagger:s=.04,easing:m="ease-out",from:l={opacity:0,y:24},trigger:c={},once:h=true,onComplete:P}=r,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ae[m]??ae["ease-out"],j=le(c.start??"top 85%"),he=le(c.end??"top 40%"),V=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Ht(t):u==="lines"?ee=yt(t):ee=bt(t);let U=ee.length;function Z(b,y){l?.opacity!==void 0&&(b.style.opacity=String(l.opacity+(1-l.opacity)*y));let q=Rt(y,l);q&&(b.style.transform=q);}function S(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach((y,q)=>{let xe=E(Nt(b,q,U,s));Z(y,xe);});}if(R)return S(1),P?.(),{destroy(){t.innerHTML=V,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};S(0);let A=0,L=0,g=0,T=false,O=false,G=-1,I=0,se=false,$=()=>window.scrollY,_=()=>window.innerHeight;function B(){let b=t.getBoundingClientRect(),y=ye({top:b.top,height:b.height},$(),_(),j,he);A=y.tStart,L=y.tEnd;}function X(){if(!T||O)return;let b=Q($(),A,L,1);h&&(G=Math.max(G,b),b=G),I=b,S(b),b>=1&&!se?(se=true,P?.()):b<1&&!h&&(se=false),g=requestAnimationFrame(X);}B();let z=new IntersectionObserver(b=>{b.forEach(y=>{T=y.isIntersecting,T&&!O?g=requestAnimationFrame(X):cancelAnimationFrame(g);});}),p;function x(){clearTimeout(p),p=setTimeout(()=>{if(u==="lines"){let b=I;t.innerHTML=V,t.setAttribute("aria-label",t.textContent??""),ee=yt(t),S(b);}B();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),z.observe(t),Ce(t,{type:"text",getProgress:()=>I,getTrigger:()=>({tStart:A,tEnd:L})}),{destroy(){cancelAnimationFrame(g),z.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(p),t.innerHTML=V,t.removeAttribute("aria-label"),Pe(t);},replay(){G=-1,se=false,I=0,O=false,S(0);},pause(){O=true,cancelAnimationFrame(g);},resume(){O&&(O=false,T&&(g=requestAnimationFrame(X)));},seek(b){let y=Math.min(1,Math.max(0,b));I=y,G=y,O=true,cancelAnimationFrame(g),S(y);},getProgress(){return I}}}function un(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=Ze(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function fn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=Ze(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function mn(e){let r,n;return solidJs.onMount(()=>{r&&(n=Je(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function pn(e){let r,n;return solidJs.onMount(()=>{r&&(n=Je(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function dn(e){let r,n;return solidJs.onMount(()=>{r&&(n=Qe(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function gn(e){let r,n;return solidJs.onMount(()=>{r&&(n=Qe(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function yn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=et(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function hn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=et(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function bn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=tt(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function wn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=tt(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}exports.createScrollAnimate=pn;exports.createScrollCounter=gn;exports.createScrollDraw=fn;exports.createScrollText=wn;exports.createScrollVideo=hn;exports.useScrollAnimate=mn;exports.useScrollCounter=dn;exports.useScrollDraw=un;exports.useScrollText=bn;exports.useScrollVideo=yn;
|
|
1
|
+
'use strict';var solidJs=require('solid-js');function Nt({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,c=[];for(let d=0;d<n;d++){let x=Math.pow(l,d);c.push(x),s+=x;}let u=[0],m=0;for(let d=0;d<n;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<n;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function Vt({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 ee={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:Nt(),elastic:Vt()};function pe(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 wt(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 vt(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 qe(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 zt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:zt((e-r)/(n-r)*t,0,1)}function Je(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function xe(e,r,n,t,l){let s=wt(e.top,e.height,r,t.element)-vt(t.viewport,n),c=wt(e.top,e.height,r,l.element)-vt(l.viewport,n);return {tStart:s,tEnd:c}}function Et(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 We(e,r,n){let t=Et(e),l=Et(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 St={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}};var Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...r){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var _t="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",qt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Tt=33;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Bt(e){let r=[];for(let n=0;n<Tt;n++){let t=n/(Tt-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return _t;case "ease-out":return qt;case "ease-in-out":return Wt()?Bt(ee["ease-in-out"]):null;default:return null}}var Gt=0;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ut(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Xt(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,c=e-s,u=r-s,m=n==="x";t.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}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;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}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(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Mt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Yt(e,r,n){if(!Ke)return;let t=(e.match(Mt)??[]).join("").toUpperCase(),l=(r.match(Mt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(r.match(xt)??[]).length;if(t!==l){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}s!==c&&ye(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function st(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 c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function it(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...St[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Ae=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:M,strokeWidth:$,fillOpacity:A,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:S=0,repeatDelay:ne=0,morphTo:k,clip:re,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:H,onEnterBack:de,onLeaveBack:ve}=l,me=re===true?"left":typeof re=="string"?re:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),ze=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(M)?M[0]:null,se=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(A)?A[0]:null,Y=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function $e(o){let a=o*100;switch(me){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 V=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,F=false,z=false,_=0,j=false,ae=-1,Ce=-1,K=false,Se=0,ke=0,He,tt=null;function ft(){tt?.destroy(),tt=null;}let Fe=new Set,pt=NaN,Re=true,je=-1,dt=performance.now(),_e=NaN;function nt(){return he?W==="x"?he.scrollLeft:he.scrollTop:W==="x"?window.scrollX:window.scrollY}function gt(){return he?W==="x"?he.clientWidth:he.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function yt(){let o=Je(e,he,W),a=xe(o,o.scroll,gt(),Le,ze);f=a.tStart,we=a.tEnd,Ae&&Ke&&(ft(),tt=Xt(f,we,W));}function Dt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=$e(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=We(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),k&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",st(i[le],k,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),k&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Ut(o);let a=qe(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),k&&(v?Yt(i[i.length-1],k,o):ye(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){if(s)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof d=="string"?et(d):null;function Ht(){return !(ue===false||!jt()||!V.length||!ht||me||W!=="y"||he||u!==1||N!==0||te||X||I!==false||k||w||S||B>0||y||T||g||p||H||de||ve||M!=null||$!=null||A!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,De=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,E=`stroke-dashoffset:${Pe};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,E+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Me}}to{${E}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,R=-1;function q(){if(R>=0)return R;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},nt(),gt(),Le,ze);return Ee(Q(nt(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){b=false,R=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));R=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=qe(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(Ht())return Ft();function Rt(){let o=Math.max(1,J),a=0,v=0,le=false;function De(b){let R=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);Se=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(L==="reverse"?1-h:h),y?.(h),q<1&&(R=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Ee(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=We(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),k&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",st(i[h],k,ge)),h===0&&(Se=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(R=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!Fe.has(Te)&&(Fe.add(Te),w[U]?.());}}return R}function Pe(b){if(K)return;let R=b-a;z||(z=true,T?.());let q=De(R);if(q&&!F){F=true,De(o*(1+Math.max(0,V.length-1)*N)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{a=performance.now(),z=false,F=false,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);},ne));return}q||(_=requestAnimationFrame(Pe));}function Me(){cancelAnimationFrame(_),clearTimeout(He),a=performance.now(),v=0,K=false,z=false,F=false,ke=0,le=true,Se=0,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);}let E=new IntersectionObserver(b=>{b.forEach(R=>{R.isIntersecting&&!(te&&F)?Me():!R.isIntersecting&&!te&&!F&&(cancelAnimationFrame(_),clearTimeout(He),le=false);});},{root:he??null,threshold:O,rootMargin:C}),D;function ce(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>E.observe(e),B):E.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),E.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(D);},replay(){ke=0,Me();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let R=Math.min(1,Math.max(0,b));Se=R,K=true,v=R*o,a=performance.now()-v,cancelAnimationFrame(_),De(v);},getProgress(){return Se},refresh(){clearTimeout(D),V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});}}}if(oe)return Rt();yt();function Xe(){if(!j||K)return;let o=performance.now(),a=nt();if(!Re&&I===false&&a===pt){_=requestAnimationFrame(Xe);return}Re=false,pt=a;let v=u;if(I!==false){let E=o-dt,D=E>0?Math.abs(a-(je<0?a:je))/E:0;v=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}je=a,dt=o;let le=X?Ce===-1||a>=Ce?"forward":"reverse":L;Ce=a;let De=we-f,Pe=true,Me=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Me>0?p?.():_e>0&&Me<=0&&ve?.(),_e<1&&Me>=1?H?.():_e>=1&&Me<1&&de?.()),_e=Me,me){let E=Ee(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,E),E=ae),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let D=le==="reverse"?1-E:E;e.style.clipPath=$e(D),y?.(E),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),E>=1&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,e.style.clipPath=$e(0);},ne))):E<1&&!te&&(F=false),_=requestAnimationFrame(Xe);return}if(V.forEach((E,D)=>{let ce=D*N*De,b=Ee(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Se=b,E.style.strokeDashoffset=le==="reverse"?`${P[D]*b}`:`${P[D]*(1-b)}`,m&&(E.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?E.style.stroke=We(be,se,b):se&&(E.style.stroke=se),ie!==null&&G!==null?E.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(E.style.strokeWidth=`${G}`),fe!==null&&Y!==null?E.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(E.style.fillOpacity=`${Y}`),k&&E.tagName.toLowerCase()==="path"&&i[D]&&E.setAttribute("d",st(i[D],k,b)),D===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let E=Ee(Q(a,f,we,v));for(let D in w){let ce=parseFloat(D);E>=ce&&!Fe.has(ce)&&(Fe.add(ce),w[D]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,Fe.clear(),Ue(),Re=true;},ne))):!Pe&&!te&&(F=false),_=requestAnimationFrame(Xe);}let rt=false;function Ye(){rt||(rt=true,_=requestAnimationFrame(function(){Xe();}));}function Qe(){rt=false,cancelAnimationFrame(_);}let ot=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Re=true,Ye()):Qe();});},{root:he??null,threshold:O,rootMargin:C});function bt(){V.forEach((o,a)=>{P[a]=qe(o),o.style.strokeDasharray=`${P[a]}`;}),yt(),Re=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(bt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),B>0?setTimeout(()=>ot.observe(e),B):ot.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),Qe(),ot.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ft();},replay(){ae=-1,Ce=-1,je=-1,z=false,F=false,ke=0,K=false,Se=0,Fe.clear(),clearTimeout(He),Ue(),Re=true,j&&Ye();},pause(){K=true,Qe();},resume(){K&&(K=false,Re=true,j&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));Se=a,ae=a,K=true,Qe(),Dt(a,L),Re=true;},getProgress(){return Se},refresh(){clearTimeout(Ze),bt(),j&&!K&&Ye();}}}var At=new Map;function Ne(e,r){At.set(e,r);}function Ve(e){At.delete(e);}function Qt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function Zt(e,r,n){let t=Lt(e),l=Lt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function $t(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Qt(t))return We(t,l,n);if(t.includes("("))return Zt(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${s[2]||c[2]}`}return n<1?t:l}function Jt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),en=0,Ct="--scroll-draw-progress";function tn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function at(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:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Ae,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:M}=r,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),I=pe(l.end??"bottom top"),O=te??e,C=typeof d=="string"?document.querySelector(d):d??null,S=Object.entries(t).map(([i,f])=>({prop:Jt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ne(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function k(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let re=new Map;for(let i of [...S.map(f=>f.prop),Ct])re.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of re)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return k(),W?.(),{...n,destroy:oe,getProgress:()=>1};ne();let J=typeof s=="string"?et(s):null;function ue(){if(!x||!tn()||!J||m!=="y"||C||O!==e||u||c!==1||Ae||W||Z||X||B||M||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!Kt.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++en}`,f=S.map(j=>`${j.prop}:${j.from}`).join(";"),we=S.map(j=>`${j.prop}:${j.to}`).join(";"),F=document.createElement("style");F.setAttribute("data-ssd-animate",""),F.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),F.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Ce of S)e.style.setProperty(Ce.prop,$t(Ce.from,Ce.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),Ce=_(),{tStart:K,tEnd:Se}=xe({top:j.top,height:j.height},ae,Ce,w,I);return A(Q(ae,K,Se,c))}}}if(ue())return y();let T=0,g=0,p=0,H=false,de=false,ve=-1,me=0,Ee=false,Le=NaN,ze=-1,he=0,be=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Je(O,C,m),f=xe(i,i.scroll,se(),w,I);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Ct,String(i));for(let f of S)e.style.setProperty(f.prop,$t(f.from,f.to,i));Ae?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&M?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!H||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(ze<0?f:ze))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}ze=f,he=i;let F=g===T?0:(f-T)/(g-T);fe(F);let z=A(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Ee?(Ee=true,W?.()):z<1&&!u&&(Ee=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{H=f.isIntersecting,H&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:C??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),$e.observe(e),Ne(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),Ve(e);},replay(){ve=-1,Ee=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,H&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ct(e,r){if(typeof window>"u")return lt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollCounter: element not found:",e),lt;let t=n,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Ae=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),lt;let X=0,B=0,M=0,$=false,A=false,w=-1,I=0,O=false,C=()=>window.scrollY,S=()=>window.innerHeight;function ne(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},C(),S(),Ae,W);X=T.tStart,B=T.tEnd;}function k(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function re(){if(!$||A)return;let y=te(Q(C(),X,B,1));d&&(w=Math.max(w,y),y=w),I=y,k(y),y>=1&&!O?(O=true,N?.()):y<1&&!d&&(O=false),M=requestAnimationFrame(re);}ne();{let y=te(Q(C(),X,B,1));d&&y>0&&(w=y),I=y,k(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{$=T.isIntersecting,$&&!A?M=requestAnimationFrame(re):cancelAnimationFrame(M);});}),J;function ue(){clearTimeout(J),J=setTimeout(ne,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Ne(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(M),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),Ve(t);},replay(){w=-1,O=false,I=0,A=false,k(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,$&&(M=requestAnimationFrame(re)));},seek(y){let T=Math.min(1,Math.max(0,y));I=T,w=T,A=true,cancelAnimationFrame(M),k(T);},getProgress(){return I}}}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r={}){if(typeof window>"u")return Pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),Pt;let t=n,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Ae=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,B=0,M=0,$=0,A=false,w=false,I=-1,O=0,C=false,S=false,ne=()=>u==="x"?window.scrollX:window.scrollY,k=()=>u==="x"?window.innerWidth:window.innerHeight;function re(){let p=t.getBoundingClientRect(),H=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:H,height:de},ne(),k(),Ae,W);B=ve.tStart,M=ve.tEnd;}function oe(p){if(!S)return;let H=X??t.duration??0;t.currentTime=Z+(H-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!A||w||!S)return;let p=te(Q(ne(),B,M,1));c&&(I=Math.max(I,p),p=I),O=p,oe(p),p>=1&&!C?(C=true,x?.()):p<1&&!c&&(C=false),$=requestAnimationFrame(J);}function ue(){if(S=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}re(),d?.(),A&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),S||re();let y=new IntersectionObserver(p=>{p.forEach(H=>{A=H.isIntersecting,A&&!w&&S?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(re,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ne(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:B,tEnd:M})}),{destroy(){cancelAnimationFrame($),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),Ve(t);},replay(){I=-1,C=false,O=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,A&&S&&($=requestAnimationFrame(J)));},seek(p){let H=Math.min(1,Math.max(0,p));O=H,I=H,w=true,cancelAnimationFrame($),oe(H);},getProgress(){return O}}}function kt(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 nn(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 It(e){let r=kt(e),n=new Map;for(let s of r){let c=s.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(s);}let t=[],l=Array.from(n.keys()).sort((s,c)=>s-c);for(let s of l){let c=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function rn(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function on(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 Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r={}){if(typeof window>"u")return Ot;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollText: element not found:",e),Ot;let t=n,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Ae=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=nn(t):l==="lines"?Z=It(t):Z=kt(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let H=on(p,u);H&&(g.style.transform=H);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,H)=>{let de=L(rn(g,H,X,s));B(p,de);});}if(N)return M(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,A=0,w=0,I=false,O=false,C=-1,S=0,ne=false,k=()=>window.scrollY,re=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},k(),re(),te,Ae);$=p.tStart,A=p.tEnd;}function J(){if(!I||O)return;let g=Q(k(),$,A,1);d&&(C=Math.max(C,g),g=C),S=g,M(g),g>=1&&!ne?(ne=true,x?.()):g<1&&!d&&(ne=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{I=p.isIntersecting,I&&!O?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=It(t),M(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Ne(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=W,t.removeAttribute("aria-label"),Ve(t);},replay(){C=-1,ne=false,S=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));S=p,C=p,O=true,cancelAnimationFrame(w),M(p);},getProgress(){return S}}}function zn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=it(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function _n(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=it(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function qn(e){let r,n;return solidJs.onMount(()=>{r&&(n=at(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Wn(e){let r,n;return solidJs.onMount(()=>{r&&(n=at(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Bn(e){let r,n;return solidJs.onMount(()=>{r&&(n=ct(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Gn(e){let r,n;return solidJs.onMount(()=>{r&&(n=ct(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function jn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=ut(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Un(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=ut(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Xn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=mt(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Yn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=mt(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}exports.createScrollAnimate=Wn;exports.createScrollCounter=Gn;exports.createScrollDraw=_n;exports.createScrollText=Yn;exports.createScrollVideo=Un;exports.useScrollAnimate=qn;exports.useScrollCounter=Bn;exports.useScrollDraw=zn;exports.useScrollText=Xn;exports.useScrollVideo=jn;
|
package/dist/solid/index.d.mts
CHANGED
|
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
|
|
|
125
125
|
seek: (progress: number) => void;
|
|
126
126
|
/** Returns current draw progress (0–1). */
|
|
127
127
|
getProgress: () => number;
|
|
128
|
+
/**
|
|
129
|
+
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
130
|
+
*
|
|
131
|
+
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
132
|
+
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
133
|
+
* change that leaves the document height alone, such as a tab switching, a
|
|
134
|
+
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
135
|
+
* after one of those.
|
|
136
|
+
*
|
|
137
|
+
* Optional on this shared type because several instances here are fan-outs over
|
|
138
|
+
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
139
|
+
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
140
|
+
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
141
|
+
*/
|
|
142
|
+
refresh?: () => void;
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
interface ScrollAnimateOptions {
|
|
@@ -142,6 +157,33 @@ interface ScrollAnimateOptions {
|
|
|
142
157
|
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
143
158
|
*/
|
|
144
159
|
velocityScale?: boolean | number;
|
|
160
|
+
/**
|
|
161
|
+
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
162
|
+
* animating. Default: `true`.
|
|
163
|
+
*
|
|
164
|
+
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
165
|
+
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
166
|
+
* their input, so it is direct manipulation rather than something that plays at
|
|
167
|
+
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
168
|
+
* would leave every panel but the last unreachable inside the sticky
|
|
169
|
+
* `overflow: hidden` container.
|
|
170
|
+
*/
|
|
171
|
+
respectReducedMotion?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Element whose geometry defines the trigger window, when that is not the
|
|
174
|
+
* element being animated. Defaults to the animated element.
|
|
175
|
+
*
|
|
176
|
+
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
177
|
+
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
178
|
+
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
179
|
+
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
180
|
+
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
181
|
+
*
|
|
182
|
+
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
183
|
+
* always measures the element the animation is attached to, so it cannot express
|
|
184
|
+
* a separate subject.
|
|
185
|
+
*/
|
|
186
|
+
triggerElement?: Element;
|
|
145
187
|
onProgress?: (alpha: number) => void;
|
|
146
188
|
onComplete?: () => void;
|
|
147
189
|
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
|
|
|
125
125
|
seek: (progress: number) => void;
|
|
126
126
|
/** Returns current draw progress (0–1). */
|
|
127
127
|
getProgress: () => number;
|
|
128
|
+
/**
|
|
129
|
+
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
130
|
+
*
|
|
131
|
+
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
132
|
+
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
133
|
+
* change that leaves the document height alone, such as a tab switching, a
|
|
134
|
+
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
135
|
+
* after one of those.
|
|
136
|
+
*
|
|
137
|
+
* Optional on this shared type because several instances here are fan-outs over
|
|
138
|
+
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
139
|
+
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
140
|
+
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
141
|
+
*/
|
|
142
|
+
refresh?: () => void;
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
interface ScrollAnimateOptions {
|
|
@@ -142,6 +157,33 @@ interface ScrollAnimateOptions {
|
|
|
142
157
|
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
143
158
|
*/
|
|
144
159
|
velocityScale?: boolean | number;
|
|
160
|
+
/**
|
|
161
|
+
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
162
|
+
* animating. Default: `true`.
|
|
163
|
+
*
|
|
164
|
+
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
165
|
+
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
166
|
+
* their input, so it is direct manipulation rather than something that plays at
|
|
167
|
+
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
168
|
+
* would leave every panel but the last unreachable inside the sticky
|
|
169
|
+
* `overflow: hidden` container.
|
|
170
|
+
*/
|
|
171
|
+
respectReducedMotion?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Element whose geometry defines the trigger window, when that is not the
|
|
174
|
+
* element being animated. Defaults to the animated element.
|
|
175
|
+
*
|
|
176
|
+
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
177
|
+
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
178
|
+
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
179
|
+
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
180
|
+
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
181
|
+
*
|
|
182
|
+
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
183
|
+
* always measures the element the animation is attached to, so it cannot express
|
|
184
|
+
* a separate subject.
|
|
185
|
+
*/
|
|
186
|
+
triggerElement?: Element;
|
|
145
187
|
onProgress?: (alpha: number) => void;
|
|
146
188
|
onComplete?: () => void;
|
|
147
189
|
/** Fires when scroll enters the trigger zone (scrolling forward). */
|