svg-scroll-draw 2.15.2 → 2.16.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/README.md +19 -16
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.d.mts +7 -238
- package/dist/angular/index.d.ts +7 -238
- package/dist/angular/index.mjs +1 -3
- package/dist/aos/index.cjs +2 -2
- package/dist/aos/index.mjs +1 -2
- package/dist/aos/react/index.cjs +2 -2
- package/dist/aos/react/index.d.mts +1 -33
- package/dist/aos/react/index.d.ts +1 -33
- package/dist/aos/react/index.mjs +1 -2
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +4 -146
- package/dist/astro/index.d.ts +4 -146
- package/dist/astro/index.mjs +1 -3
- package/dist/cdn/aos.global.js +2 -2
- package/dist/cdn/scrollreveal.global.js +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +51 -39
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/cdn/vivus.global.js +1 -1
- package/dist/chunk-4DOJSIEQ.mjs +1 -0
- package/dist/chunk-4MH5SQTH.mjs +1 -0
- package/dist/chunk-4T5R3ZTL.mjs +2 -0
- package/dist/chunk-5PJEKEEP.mjs +1 -0
- package/dist/chunk-AJ22VSHC.mjs +1 -0
- package/dist/chunk-BCV4RAIX.mjs +1 -0
- package/dist/chunk-DM6EDKWH.mjs +1 -0
- package/dist/chunk-E4M2PB7B.mjs +1 -0
- package/dist/chunk-JC5BD4RB.mjs +1 -0
- package/dist/chunk-KBFWDHF4.mjs +1 -0
- package/dist/chunk-KGAJQP2N.mjs +2 -0
- package/dist/chunk-LFSU6LR3.mjs +1 -0
- package/dist/chunk-OJFWQ6CU.mjs +1 -0
- package/dist/chunk-OMI46IXL.mjs +2 -0
- package/dist/chunk-OWMO2S3V.mjs +1 -0
- package/dist/chunk-PEFR3ZB7.mjs +1 -0
- package/dist/chunk-QJ4H2HW3.mjs +1 -0
- package/dist/chunk-SNCRC6BA.mjs +1 -0
- package/dist/chunk-WDIHLRZZ.mjs +3 -0
- package/dist/chunk-WQZKXAXK.mjs +2 -0
- package/dist/chunk-YWKPTYSG.mjs +1 -0
- package/dist/chunk-YZV4Z3EQ.mjs +1 -0
- package/dist/cinematic/index.cjs +1 -1
- package/dist/cinematic/index.mjs +1 -2
- package/dist/devtools/index.mjs +1 -1
- package/dist/engine-6AXEX8CL.d.ts +57 -0
- package/dist/engine-Ci08nM91.d.mts +57 -0
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.d.mts +4 -205
- package/dist/group/index.d.ts +4 -205
- package/dist/group/index.mjs +1 -3
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +1 -33
- package/dist/horizontal/index.d.ts +1 -33
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index-BDGQEK6X.d.mts +15 -0
- package/dist/index-BVuNgQSd.d.ts +14 -0
- package/dist/index-CGR7pSOR.d.mts +14 -0
- package/dist/index-DxjUOIbK.d.ts +15 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +8 -292
- package/dist/index.d.ts +8 -292
- package/dist/index.mjs +1 -4
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.d.mts +7 -505
- package/dist/nuxt/index.d.ts +7 -505
- package/dist/nuxt/index.mjs +1 -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 +1 -33
- package/dist/progress/index.d.ts +1 -33
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +5 -210
- package/dist/react/index.d.ts +5 -210
- package/dist/react/index.mjs +1 -3
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +10 -8
- package/dist/reveal/index.d.ts +10 -8
- package/dist/reveal/index.mjs +1 -1
- package/dist/scroll-draw-BlJfbTDv.d.ts +5 -0
- package/dist/scroll-draw-CNlq4Z_L.d.mts +5 -0
- package/dist/scrollreveal/index.cjs +2 -2
- package/dist/scrollreveal/index.mjs +1 -2
- package/dist/scrollreveal/react/index.cjs +2 -2
- package/dist/scrollreveal/react/index.d.mts +1 -36
- package/dist/scrollreveal/react/index.d.ts +1 -36
- package/dist/scrollreveal/react/index.mjs +1 -2
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +1 -1
- package/dist/snap/index.d.ts +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.d.mts +6 -238
- package/dist/solid/index.d.ts +6 -238
- package/dist/solid/index.mjs +1 -3
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.d.mts +6 -238
- package/dist/svelte/index.d.ts +6 -238
- package/dist/svelte/index.mjs +1 -3
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +1 -33
- package/dist/text/index.d.ts +1 -33
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +7 -7
- package/dist/timeline/index.d.mts +1 -29
- package/dist/timeline/index.d.ts +1 -29
- package/dist/timeline/index.mjs +11 -11
- package/dist/types-DHU1zNEw.d.mts +147 -0
- package/dist/types-DHU1zNEw.d.ts +147 -0
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +1 -33
- package/dist/video/index.d.ts +1 -33
- package/dist/video/index.mjs +1 -1
- package/dist/vivus/index.cjs +2 -2
- package/dist/vivus/index.mjs +1 -2
- package/dist/vivus/react/index.cjs +2 -1
- package/dist/vivus/react/index.d.mts +1 -99
- package/dist/vivus/react/index.d.ts +1 -99
- package/dist/vivus/react/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +6 -211
- package/dist/vue/index.d.ts +6 -211
- package/dist/vue/index.mjs +1 -3
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +1 -3
- package/package.json +1 -1
package/dist/pin/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import {a as a$1}from'../chunk-4DOJSIEQ.mjs';import {a,b as b$1}from'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var O={destroy:()=>{},refresh:()=>{},getProgress:()=>0};function W(d,h={}){if(typeof window>"u")return O;let x=typeof d=="string"?document.querySelector(d):d;if(!x)return b("scrollPin: element not found:",d),O;let e=x,{top:c=0,scrollContainer:a$2,onEnter:C,onLeave:k,onEnterBack:H,onLeaveBack:I,onProgress:$}=h,q=typeof a$2=="string"?document.querySelector(a$2):a$2??null,o={position:e.style.position,top:e.style.top,bottom:e.style.bottom,left:e.style.left,width:e.style.width,boxSizing:e.style.boxSizing},t=document.createElement("div");t.setAttribute("data-ssd-pin-wrapper",""),t.style.cssText="position:relative;",e.parentNode?.insertBefore(t,e),t.appendChild(e);let E=0,m=0,u=0,y="before",b$2=0,P=0,g=false;function p(){E=t.offsetWidth,m=e.offsetHeight,u=h.pinDistance??window.innerHeight,t.style.height=`${m+u}px`;}function v(n){if(y===n)return;let i=y;if(y=n,n==="before")e.style.position=o.position,e.style.top=o.top,e.style.bottom=o.bottom,e.style.left=o.left,e.style.width=o.width,e.style.boxSizing=o.boxSizing,i==="pinned"&&I?.();else if(n==="pinned"){let w=t.getBoundingClientRect();e.style.position="fixed",e.style.top=`${c}px`,e.style.bottom="",e.style.left=`${w.left}px`,e.style.width=`${E}px`,e.style.boxSizing="border-box",i==="before"?C?.():i==="after"&&H?.();}else e.style.position="absolute",e.style.top="",e.style.bottom="0",e.style.left="0",e.style.width="100%",e.style.boxSizing="border-box",i==="pinned"&&k?.();}function A(){g=false;let n=t.getBoundingClientRect(),i=n.top,w=n.bottom,z=a$1((c-i)/u,0,1);b$2=z,$?.(z),i>c?v("before"):w-m<=c?v("after"):v("pinned");}function r(){g||(g=true,P=requestAnimationFrame(()=>A()));}let S=q??window;S.addEventListener("scroll",r,{passive:true});let s;function f(){clearTimeout(s),s=setTimeout(()=>{p(),r();},150);}window.addEventListener("resize",f),window.addEventListener("orientationchange",f);let l=null;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(()=>{clearTimeout(s),s=setTimeout(()=>{p(),r();},100);}),l.observe(t),l.observe(document.documentElement),l.observe(e)),p(),r(),a(t,{type:"pin",getProgress:()=>b$2,getTrigger:()=>({tStart:0,tEnd:1})}),{destroy(){cancelAnimationFrame(P),clearTimeout(s),S.removeEventListener("scroll",r),window.removeEventListener("resize",f),window.removeEventListener("orientationchange",f),l?.disconnect(),e.style.position=o.position,e.style.top=o.top,e.style.bottom=o.bottom,e.style.left=o.left,e.style.width=o.width,e.style.boxSizing=o.boxSizing,t.parentNode?.insertBefore(e,t),t.remove(),b$1(t);},refresh(){p(),r();},getProgress(){return b$2}}}export{W as scrollPin};
|
package/dist/progress/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Y({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),m=Math.sqrt(n),s=0,p=[];for(let o=0;o<t;o++){let u=Math.pow(m,o);p.push(u),s+=u;}let c=[0],w=0;for(let o=0;o<t;o++)w+=p[o]/s,c.push(w);return o=>{if(o<=0)return 0;if(o>=1)return 1;for(let u=0;u<t;u++)if(o<=c[u+1]){let f=(o-c[u])/(c[u+1]-c[u]);if(u===0)return f*(2-f);let d=1-Math.pow(n,u);return d+(1-d)*(2*f-1)*(2*f-1)}return 1}}function j({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),m=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-m)*(2*Math.PI)/n)+1}var T={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:Y(),elastic:j()};function D(e,r,t){return Math.min(t,Math.max(r,e))}function R(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function F(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function V(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 I(e,r,t,n){return t===r?0:D((e-r)/(t-r)*n,0,1)}function C(e,r,t,n,m){let s=F(e.top,e.height,r,n.element)-V(n.viewport,t),p=F(e.top,e.height,r,m.element)-V(m.viewport,t);return {tStart:s,tEnd:p}}function O(e,r,t){let n=e.getBoundingClientRect(),m=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:m,scroll:0}:{top:t==="x"?n.left:n.top,height:m,scroll:t==="x"?window.scrollX:window.scrollY}}var q=Symbol.for("svg-scroll-draw.registry");function N(){let e=globalThis;return e[q]||(e[q]=new Map)}function W(e,r){N().set(e,r);}function z(e){N().delete(e);}var J=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,...r){J&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var G={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ae(e,r={}){if(typeof window>"u")return G;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return B("scrollProgress: element not found:",e),G;let n=t,{variable:m="--scroll-progress",easedVariable:s="--scroll-progress-eased",trigger:p={},easing:c="linear",speed:w=1,axis:o="y",scrollContainer:u,onProgress:f}=r,d=typeof c=="function"?c:T[c]??T.linear,k=R(p.start??"top bottom"),$=R(p.end??"bottom top"),l=typeof u=="string"?document.querySelector(u):u??null,h=0,x=0,g=0,E=false,b=false,y=0,A=()=>l?o==="x"?l.scrollLeft:l.scrollTop:o==="x"?window.scrollX:window.scrollY,X=()=>l?o==="x"?l.clientWidth:l.clientHeight:o==="x"?window.innerWidth:window.innerHeight;function M(){let i=O(n,l,o),a=C(i,i.scroll,X(),k,$);h=a.tStart,x=a.tEnd;}function _(i,a){n.style.setProperty(m,String(i)),s!=null&&n.style.setProperty(s,String(a)),f?.(i,a);}function S(){if(!E||b)return;let i=I(A(),h,x,w),a=d(i);y=i,_(i,a),g=requestAnimationFrame(S);}M();{let i=I(A(),h,x,w),a=d(i);y=i,_(i,a);}let L=new IntersectionObserver(i=>{i.forEach(a=>{E=a.isIntersecting,E&&!b?g=requestAnimationFrame(S):cancelAnimationFrame(g);});},{root:l??null}),P;function v(){clearTimeout(P),P=setTimeout(M,150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),L.observe(t),W(t,{type:"animate",getProgress:()=>y,getTrigger:()=>({tStart:h,tEnd:x})}),{destroy(){cancelAnimationFrame(g),L.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(P),n.style.removeProperty(m),s!=null&&n.style.removeProperty(s),z(t);},replay(){M();},pause(){b=true,cancelAnimationFrame(g);},resume(){b&&(b=false,E&&(g=requestAnimationFrame(S)));},seek(i){let a=Math.min(1,Math.max(0,i)),K=d(a);y=a,b=true,cancelAnimationFrame(g),_(a,K);},getProgress(){return y}}}exports.scrollProgress=ae;
|
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface TriggerConfig {
|
|
3
|
-
start?: string;
|
|
4
|
-
end?: string;
|
|
5
|
-
}
|
|
6
|
-
interface ScrollDrawInstance {
|
|
7
|
-
destroy: () => void;
|
|
8
|
-
/** Reset and replay the animation from the beginning. */
|
|
9
|
-
replay: () => void;
|
|
10
|
-
/** Pause the animation at the current progress. */
|
|
11
|
-
pause: () => void;
|
|
12
|
-
/** Resume a paused animation. */
|
|
13
|
-
resume: () => void;
|
|
14
|
-
/** Jump to a specific progress value (0–1) and pause. */
|
|
15
|
-
seek: (progress: number) => void;
|
|
16
|
-
/** Returns current draw progress (0–1). */
|
|
17
|
-
getProgress: () => number;
|
|
18
|
-
/**
|
|
19
|
-
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
20
|
-
*
|
|
21
|
-
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
22
|
-
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
23
|
-
* change that leaves the document height alone, such as a tab switching, a
|
|
24
|
-
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
25
|
-
* after one of those.
|
|
26
|
-
*
|
|
27
|
-
* Optional on this shared type because several instances here are fan-outs over
|
|
28
|
-
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
29
|
-
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
30
|
-
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
31
|
-
*/
|
|
32
|
-
refresh?: () => void;
|
|
33
|
-
}
|
|
1
|
+
import { T as TriggerConfig, E as EasingName, S as ScrollDrawInstance } from '../types-DHU1zNEw.mjs';
|
|
34
2
|
|
|
35
3
|
interface ScrollProgressOptions {
|
|
36
4
|
/**
|
package/dist/progress/index.d.ts
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface TriggerConfig {
|
|
3
|
-
start?: string;
|
|
4
|
-
end?: string;
|
|
5
|
-
}
|
|
6
|
-
interface ScrollDrawInstance {
|
|
7
|
-
destroy: () => void;
|
|
8
|
-
/** Reset and replay the animation from the beginning. */
|
|
9
|
-
replay: () => void;
|
|
10
|
-
/** Pause the animation at the current progress. */
|
|
11
|
-
pause: () => void;
|
|
12
|
-
/** Resume a paused animation. */
|
|
13
|
-
resume: () => void;
|
|
14
|
-
/** Jump to a specific progress value (0–1) and pause. */
|
|
15
|
-
seek: (progress: number) => void;
|
|
16
|
-
/** Returns current draw progress (0–1). */
|
|
17
|
-
getProgress: () => number;
|
|
18
|
-
/**
|
|
19
|
-
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
20
|
-
*
|
|
21
|
-
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
22
|
-
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
23
|
-
* change that leaves the document height alone, such as a tab switching, a
|
|
24
|
-
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
25
|
-
* after one of those.
|
|
26
|
-
*
|
|
27
|
-
* Optional on this shared type because several instances here are fan-outs over
|
|
28
|
-
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
29
|
-
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
30
|
-
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
31
|
-
*/
|
|
32
|
-
refresh?: () => void;
|
|
33
|
-
}
|
|
1
|
+
import { T as TriggerConfig, E as EasingName, S as ScrollDrawInstance } from '../types-DHU1zNEw.js';
|
|
34
2
|
|
|
35
3
|
interface ScrollProgressOptions {
|
|
36
4
|
/**
|
package/dist/progress/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import {a as a$2}from'../chunk-YWKPTYSG.mjs';import {a,b as b$1,c}from'../chunk-PEFR3ZB7.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1,b as b$2}from'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var R={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function B(c$1,D={}){if(typeof window>"u")return R;let s=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!s)return b("scrollProgress: element not found:",c$1),R;let i=s,{variable:x="--scroll-progress",easedVariable:m="--scroll-progress-eased",trigger:F={},easing:f="linear",speed:A=1,axis:l="y",scrollContainer:w,onProgress:H}=D,y=typeof f=="function"?f:d[f]??d.linear,M=a(F.start??"top bottom"),V=a(F.end??"bottom top"),t=typeof w=="string"?document.querySelector(w):w??null,u=0,g=0,n=0,d$1=false,o=false,a$3=0,I=()=>t?l==="x"?t.scrollLeft:t.scrollTop:l==="x"?window.scrollX:window.scrollY,k=()=>t?l==="x"?t.clientWidth:t.clientHeight:l==="x"?window.innerWidth:window.innerHeight;function b$3(){let e=a$2(i,t,l),r=c(e,e.scroll,k(),M,V);u=r.tStart,g=r.tEnd;}function v(e,r){i.style.setProperty(x,String(e)),m!=null&&i.style.setProperty(m,String(r)),H?.(e,r);}function E(){if(!d$1||o)return;let e=b$1(I(),u,g,A),r=y(e);a$3=e,v(e,r),n=requestAnimationFrame(E);}b$3();{let e=b$1(I(),u,g,A),r=y(e);a$3=e,v(e,r);}let C=new IntersectionObserver(e=>{e.forEach(r=>{d$1=r.isIntersecting,d$1&&!o?n=requestAnimationFrame(E):cancelAnimationFrame(n);});},{root:t??null}),P;function p(){clearTimeout(P),P=setTimeout(b$3,150);}return window.addEventListener("resize",p),window.addEventListener("orientationchange",p),C.observe(s),a$1(s,{type:"animate",getProgress:()=>a$3,getTrigger:()=>({tStart:u,tEnd:g})}),{destroy(){cancelAnimationFrame(n),C.disconnect(),window.removeEventListener("resize",p),window.removeEventListener("orientationchange",p),clearTimeout(P),i.style.removeProperty(x),m!=null&&i.style.removeProperty(m),b$2(s);},replay(){b$3();},pause(){o=true,cancelAnimationFrame(n);},resume(){o&&(o=false,d$1&&(n=requestAnimationFrame(E)));},seek(e){let r=Math.min(1,Math.max(0,e)),W=y(r);a$3=r,o=true,cancelAnimationFrame(n),v(r,W);},getProgress(){return a$3}}}export{B as scrollProgress};
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var gr=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var gr__default=/*#__PURE__*/_interopDefault(gr);function
|
|
1
|
+
'use strict';var gr=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var gr__default=/*#__PURE__*/_interopDefault(gr);function Ut({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,a=[];for(let p=0;p<r;p++){let S=Math.pow(i,p);a.push(S),o+=S;}let u=[0],m=0;for(let p=0;p<r;p++)m+=a[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let S=0;S<r;S++)if(p<=u[S+1]){let R=(p-u[S])/(u[S+1]-u[S]);if(S===0)return R*(2-R);let M=1-Math.pow(t,S);return M+(1-M)*(2*R-1)*(2*R-1)}return 1}}function jt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var Z={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:Ut(),elastic:jt()};function ht(e,n,r){return Math.min(r,Math.max(n,e))}function se(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function bt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function wt(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 J(e,n,r,t){return r===n?0:ht((e-n)/(r-n)*t,0,1)}function we(e,n,r,t,i){let o=bt(e.top,e.height,n,t.element)-wt(t.viewport,r),a=bt(e.top,e.height,n,i.element)-wt(i.viewport,r);return {tStart:o,tEnd:a}}function Ke(e,n,r){let t=e.getBoundingClientRect(),i=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:i,scroll:0}:{top:r==="x"?t.left:t.top,height:i,scroll:r==="x"?window.scrollX:window.scrollY}}function Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function vt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function _e(e,n,r){let t=vt(e),i=vt(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var Et={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 Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ve(e,...n){Be&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Xt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Yt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Zt(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Xt;case "ease-out":return Yt;case "ease-in-out":return Qt()?Zt(Z["ease-in-out"]):null;default:return null}}var Tt=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[Tt]||(e[Tt]=new Map)}function Pe(e,n){xt().set(e,n);}function Ce(e){xt().delete(e);}var Jt=0;function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function At(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Mt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function er(e){if(!Be)return;let n=At(e,"stroke");if(!n||n==="none"){ve("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Mt.has(r)&&!Mt.has(At(e,"fill"))&&ve("Element has a fill \u2014 it may obscure the stroke animation.",e);}function tr(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function i(){let o=r==="x"?window.scrollX:window.scrollY,a=e-o,u=n-o,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}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",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),i=(n.match(Pt)??[]).join("").toUpperCase(),o=(e.match(Mt)??[]).length,a=(n.match(Mt)??[]).length;if(t!==i){ve(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==a&&ve(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[i++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...vt[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:E={},stagger:R=0,direction:M="forward",once:re=false,debug:Se=false,axis:H="y",scrollContainer:W,autoReverse:D=false,delay:z=0,strokeColor:P,strokeWidth:L,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:w="0px",repeat:g=0,repeatDelay:j=0,morphTo:O,clip:B,autoplay:X=false,duration:ie=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:I,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,xe=typeof p=="function"?p:Z[p]??Z.linear,$e=se(E.start??"top bottom"),He=se(E.end??"bottom top"),Ee=typeof W=="string"?document.querySelector(W):W??null,Te=Array.isArray(P)?P[0]:null,ce=Array.isArray(P)?P[1]:typeof P=="string"?P:null,ue=Array.isArray(L)?L[0]:null,K=Array.isArray(L)?L[1]:typeof L=="number"?L:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function Re(s){let c=s*100;switch(ne){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(a)),N=[],l=[],f=0,ge=0,_=false,U=false,Y=0,Me=false,ye=-1,ae=-1,ee=false,he=0,Ie=0,Ne,rt=null;function ct(){rt?.destroy(),rt=null;}let De=new Set,ut=NaN,Fe=true,je=-1,mt=performance.now(),ze=NaN;function nt(){return Ee?H==="x"?Ee.scrollLeft:Ee.scrollTop:H==="x"?window.scrollX:window.scrollY}function ft(){return Ee?H==="x"?Ee.clientWidth:Ee.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,Ee,H);return we(s,s.scroll,ft(),$e,He)}function dt(){(({tStart:f,tEnd:ge}=pt())),Se&&Be&&(ct(),rt=tr(f,ge,H));}function ot(s,c=pt){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let S=s.destroy;return s.destroy=()=>{S.call(s),Ce(e);},s}function _t(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let S=c==="reverse"?1-s:s;e.style.clipPath=Re(S);return}G.forEach((S,me)=>{S.style.strokeDashoffset=c==="reverse"?`${N[me]*s}`:`${N[me]*(1-s)}`,m&&(S.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&ce?S.style.stroke=_e(Te,ce,s):ce&&(S.style.stroke=ce),ue!==null&&K!==null?S.style.strokeWidth=`${ue+(K-ue)*s}`:K!==null&&(S.style.strokeWidth=`${K}`),de!==null&&oe!==null?S.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(S.style.fillOpacity=`${oe}`),O&&S.tagName.toLowerCase()==="path"&&l[me]&&S.setAttribute("d",at(l[me],O,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=Re(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${N[c]}`,s.style.strokeDashoffset=M==="reverse"?"0":`${N[c]}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),O&&s.tagName.toLowerCase()==="path"&&l[c]&&s.setAttribute("d",l[c]);});}if(G.forEach(s=>{er(s);let c=Ve(s);N.push(c);let S=s.tagName.toLowerCase()==="path";S?l.push(s.getAttribute("d")??""):l.push(""),O&&(S?rr(l[l.length-1],O,s):ve(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),K!==null&&(s.style.strokeWidth=`${K}`),oe!==null&&(s.style.fillOpacity=`${oe}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?"0":`${c}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=Re(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof p=="string"?et(p):null;function qt(){return !(le===false||!Kt()||!G.length||!gt||ne||H!=="y"||Ee||u!==1||R!==0||re||D||C!==false||O||b||g||z>0||d||$||y||I||A||V||pe||P!=null||L!=null||x!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Wt(){let s=++Jt,c=`svg-scroll-draw-${s}`,S=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Oe=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Pe=`stroke-dashoffset:${Oe};`,T=`stroke-dashoffset:${ke};`;m&&(Pe+=`opacity:${M==="reverse"?1:0};`,T+=`opacity:${M==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Pe}}to{${T}}}.${S}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(S);function fe(h,te){h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function Q(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:Ae}=we({top:h.top,height:h.height},nt(),ft(),$e,He);return xe(J(nt(),te,Ae,u))}return {destroy(){e.classList.remove(S),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),F.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((Ae,be)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=M==="reverse"?`${N[be]*te}`:`${N[be]*(1-te)}`,m&&(Ae.style.opacity=M==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return Q()},refresh(){G.forEach((h,te)=>{N[te]=Ve(h),h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`;});}}}if(qt())return ot(Wt());function Bt(){let s=Math.max(1,ie),c=0,S=0,me=false;function Oe(v){let q=true;if(ne){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);he=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Re(M==="reverse"?1-h:h),d?.(h),Q<1&&(q=false);}else G.forEach((Q,h)=>{let te=h*R*s,Ae=Math.min(1,Math.max(0,(v-te)/s)),be=xe(Ae);Q.style.strokeDashoffset=M==="reverse"?`${N[h]*be}`:`${N[h]*(1-be)}`,m&&(Q.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Te&&ce?Q.style.stroke=_e(Te,ce,be):ce&&(Q.style.stroke=ce),ue!==null&&K!==null?Q.style.strokeWidth=`${ue+(K-ue)*be}`:K!==null&&(Q.style.strokeWidth=`${K}`),de!==null&&oe!==null?Q.style.fillOpacity=`${de+(oe-de)*be}`:oe!==null&&(Q.style.fillOpacity=`${oe}`),O&&Q.tagName.toLowerCase()==="path"&&l[h]&&Q.setAttribute("d",at(l[h],O,be)),h===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ae<1&&(q=false);});if(b){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);for(let te in b){let Ae=parseFloat(te);h>=Ae&&!De.has(Ae)&&(De.add(Ae),b[te]?.());}}return q}function ke(v){if(ee)return;let q=v-c;U||(U=true,$?.());let Q=Oe(q);if(Q&&!_){_=true,Oe(s*(1+Math.max(0,G.length-1)*R)),y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{c=performance.now(),U=false,_=false,De.clear(),Xe(),Y=requestAnimationFrame(ke);},j));return}Q||(Y=requestAnimationFrame(ke));}function Pe(){cancelAnimationFrame(Y),clearTimeout(Ne),c=performance.now(),S=0,ee=false,U=false,_=false,Ie=0,me=true,he=0,De.clear(),Xe(),Y=requestAnimationFrame(ke);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Pe():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Ne),me=false);});},{root:Ee??null,threshold:k,rootMargin:w}),F;function fe(){clearTimeout(F),F=setTimeout(()=>{G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(F);},replay(){Ie=0,Pe();},pause(){ee||!me||(ee=true,S=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-S,Y=requestAnimationFrame(ke));},seek(v){let q=Math.min(1,Math.max(0,v));he=q,ee=true,S=q*s,c=performance.now()-S,cancelAnimationFrame(Y),Oe(S);},getProgress(){return he},refresh(){clearTimeout(F),G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});}}}if(X)return ot(Bt());dt();function Ye(){if(!Me||ee)return;let s=performance.now(),c=nt();if(!Fe&&C===false&&c===ut){Y=requestAnimationFrame(Ye);return}Fe=false,ut=c;let S=u;if(C!==false){let T=s-mt,F=T>0?Math.abs(c-(je<0?c:je))/T:0;S=u*Math.max(.2,1+F*(typeof C=="number"?C:1)*.04);}je=c,mt=s;let me=D?ae===-1||c>=ae?"forward":"reverse":M;ae=c;let Oe=ge-f,ke=true,Pe=Oe===0?0:(c-f)/Oe;if(isNaN(ze)||(ze<=0&&Pe>0?I?.():ze>0&&Pe<=0&&pe?.(),ze<1&&Pe>=1?A?.():ze>=1&&Pe<1&&V?.()),ze=Pe,ne){let T=xe(J(c,f,ge,S));re&&!D&&(ye=Math.max(ye,T),T=ye),he=T,e.style.setProperty("--scroll-draw-progress",String(T));let F=me==="reverse"?1-T:T;e.style.clipPath=Re(F),d?.(T),!U&&J(c,f,ge,S)>0&&(U=true,$?.()),T>=1&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,e.style.clipPath=Re(0);},j))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ye);return}if(G.forEach((T,F)=>{let fe=F*R*Oe,v=xe(J(c,f+fe,ge+fe,S));re&&!D&&(ye=Math.max(ye,v),v=ye),he=v,T.style.strokeDashoffset=me==="reverse"?`${N[F]*v}`:`${N[F]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Te&&ce?T.style.stroke=_e(Te,ce,v):ce&&(T.style.stroke=ce),ue!==null&&K!==null?T.style.strokeWidth=`${ue+(K-ue)*v}`:K!==null&&(T.style.strokeWidth=`${K}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),O&&T.tagName.toLowerCase()==="path"&&l[F]&&T.setAttribute("d",at(l[F],O,v)),F===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(ke=false);}),b){let T=xe(J(c,f,ge,S));for(let F in b){let fe=parseFloat(F);T>=fe&&!De.has(fe)&&(De.add(fe),b[F]?.());}}!U&&J(c,f,ge,S)>0&&(U=true,$?.()),ke&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,De.clear(),Xe(),Fe=true;},j))):!ke&&!re&&(_=false),Y=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,Y=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(Y);}let it=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!ee?(Fe=true,Qe()):Ze();});},{root:Ee??null,threshold:k,rootMargin:w});function yt(){G.forEach((s,c)=>{N[c]=Ve(s),s.style.strokeDasharray=`${N[c]}`;}),dt(),Fe=true;}let Je;function qe(){clearTimeout(Je),Je=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),z>0?setTimeout(()=>it.observe(e),z):it.observe(e),ot({destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),Ze(),it.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Je),ct();},replay(){ye=-1,ae=-1,je=-1,U=false,_=false,Ie=0,ee=false,he=0,De.clear(),clearTimeout(Ne),Xe(),Fe=true,Me&&Qe();},pause(){ee=true,Ze();},resume(){ee&&(ee=false,Fe=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));he=c,ye=c,ee=true,Ze(),_t(c,M),Fe=true;},getProgress(){return he},refresh(){clearTimeout(Je),yt(),Me&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}function nr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function or(e,n,r){let t=Ct(e),i=Ct(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,a)=>{let u=i[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function $t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(nr(t))return _e(t,i,r);if(t.includes("("))return or(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:i}function sr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ir=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ar=0,Rt="--scroll-draw-progress";function lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function kt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:E=true,velocityScale:R=false,respectReducedMotion:M=true,triggerElement:re,onProgress:Se,onComplete:H,onEnter:W,onLeave:D,onEnterBack:z,onLeaveBack:P}=n,L=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Z[o]??Z["ease-out"],b=se(i.start??"top bottom"),C=se(i.end??"bottom top"),k=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([l,f])=>({prop:sr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function j(){let l=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function O(){for(let l of g)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...g.map(f=>f.prop),Rt])B.set(l,e.style.getPropertyValue(l));function X(){for(let[l,f]of B)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(L)return O(),H?.(),{...r,destroy:X,getProgress:()=>1};j();let ie=typeof o=="string"?et(o):null;function le(){if(!E||!lr()||!ie||m!=="y"||w||k!==e||u||a!==1||Se||H||W||D||z||P||R!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let l of g)if(!ir.has(l.prop))return false;return true}function d(){let l=`ssd-a-${++ar}`,f=g.map(ae=>`${ae.prop}:${ae.from}`).join(";"),ge=g.map(ae=>`${ae.prop}:${ae.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${l}{from{${f}}to{${ge}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(l);let U=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let ae=e.getBoundingClientRect();return we({top:ae.top,height:ae.height},U(),Y(),b,C)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(l),_.remove(),e.style.animationPlayState="",X(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let ee=Math.min(1,Math.max(0,ae));e.classList.remove(l);for(let he of g)e.style.setProperty(he.prop,$t(he.from,he.to,ee));},getProgress(){let{tStart:ae,tEnd:ee}=Me();return x(J(U(),ae,ee,a))}};return ye}if(le())return d();let $=0,y=0,I=0,A=false,V=false,pe=-1,ne=0,xe=false,$e=NaN,He=-1,Ee=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let l=Ke(k,w,m),f=we(l,l.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function K(l){e.style.setProperty(Rt,String(l));for(let f of g)e.style.setProperty(f.prop,$t(f.from,f.to,l));Se?.(l);}function de(l){if(isNaN($e)){$e=l;return}$e<=0&&l>0?W?.():$e>0&&l<=0&&P?.(),$e<1&&l>=1?D?.():$e>=1&&l<1&&z?.(),$e=l;}function oe(){if(!A||V)return;let l=performance.now(),f=Te(),ge=a;if(R!==false){let Y=l-Ee,Me=Y>0?Math.abs(f-(He<0?f:He))/Y:0;ge=a*Math.max(.2,1+Me*(typeof R=="number"?R:1)*.04);}He=f,Ee=l;let _=y===$?0:(f-$)/(y-$);de(_);let U=x(J(f,$,y,ge));u&&(pe=Math.max(pe,U),U=pe),ne=U,K(U),U>=1&&!xe?(xe=true,H?.()):U<1&&!u&&(xe=false),I=requestAnimationFrame(oe);}ue(),y===$&&ve("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 l=x(J(Te(),$,y,a));u&&l>0&&(pe=l),ne=l,K(l);}let Re=new IntersectionObserver(l=>{l.forEach(f=>{A=f.isIntersecting,A&&!V?I=requestAnimationFrame(oe):cancelAnimationFrame(I);});},{root:w??null}),G;function N(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Re.observe(e),Le(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(I),Re.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(G),X(),Ce(e);},replay(){pe=-1,xe=false,ne=0,V=false,K(0);},pause(){V=true,cancelAnimationFrame(I);},resume(){V&&(V=false,A&&(I=requestAnimationFrame(oe)));},seek(l){let f=Math.min(1,Math.max(0,l));ne=f,pe=f,V=true,cancelAnimationFrame(I),K(f);},getProgress(){return ne}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollCounter: element not found:",e),lt;let t=r,{from:i=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:p=true,decimals:E,onComplete:R}=n,M=E!==void 0?d=>d.toFixed(E):a??(d=>String(Math.round(d))),re=typeof u=="function"?u:Z[u]??Z["ease-out"],Se=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(o),R?.(),lt;let D=0,z=0,P=0,L=false,x=false,b=-1,C=0,k=false,w=()=>window.scrollY,g=()=>window.innerHeight;function j(){let d=t.getBoundingClientRect(),$=we({top:d.top,height:d.height},w(),g(),Se,H);D=$.tStart,z=$.tEnd;}function O(d){t.textContent=M(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!L||x)return;let d=re(J(w(),D,z,1));p&&(b=Math.max(b,d),d=b),C=d,O(d),d>=1&&!k?(k=true,R?.()):d<1&&!p&&(k=false),P=requestAnimationFrame(B);}j();{let d=re(J(w(),D,z,1));p&&d>0&&(b=d),C=d,O(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{L=$.isIntersecting,L&&!x?P=requestAnimationFrame(B):cancelAnimationFrame(P);});}),ie;function le(){clearTimeout(ie),ie=setTimeout(j,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Le(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:D,tEnd:z})}),{destroy(){cancelAnimationFrame(P),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ie),Ce(t);},replay(){b=-1,k=false,C=0,x=false,O(0);},pause(){x=true,cancelAnimationFrame(P);},resume(){x&&(x=false,L&&(P=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(P),O($);},getProgress(){return C}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ve("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:i={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:p,onComplete:E,onProgress:R}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Z[o]??Z.linear,Se=se(i.start??"top top"),H=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,D=n.to,z=0,P=0,L=0,x=false,b=false,C=-1,k=0,w=false,g=false,j=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=we({top:V,height:pe},j(),O(),Se,H);z=ne.tStart,P=ne.tEnd;}let X=NaN;function ie(A){if(!g)return;let V=D??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),R?.(A);}function le(){if(!x||b||!g||M)return;let A=re(J(j(),z,P,1));a&&(C=Math.max(C,A),A=C),k=A,ie(A),A>=1&&!w?(w=true,E?.()):A<1&&!a&&(w=false),L=requestAnimationFrame(le);}function d(){if(g=true,D===void 0&&(D=t.duration),M){ie(1),p?.();return}B(),p?.(),x&&!b&&(L=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?L=requestAnimationFrame(le):cancelAnimationFrame(L);});}),y;function I(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),$.observe(t),Le(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:z,tEnd:P})}),{destroy(){cancelAnimationFrame(L),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(y),Ce(t);},replay(){C=-1,w=false,k=0,b=false,X=NaN,ie(0);},pause(){b=true,cancelAnimationFrame(L);},resume(){b&&(b=false,x&&g&&(L=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));k=V,C=V,b=true,cancelAnimationFrame(L),X=NaN,ie(V);},getProgress(){return k}}}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ht(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],i=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of i){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,p)=>{let E=m.nextElementSibling;u.appendChild(m),p<a.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ur(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,a=o+(1-i);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function mr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollText: element not found:",e),Ft;let t=r,{split:i="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:E}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof a=="function"?a:Z[a]??Z["ease-out"],re=se(m.start??"top 85%"),Se=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=cr(t):i==="lines"?W=Dt(t):W=Ht(t);let D=W.length;function z(y,I){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*I));let A=mr(I,u);A&&(y.style.transform=A);}function P(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((I,A)=>{let V=M(ur(y,A,D,o));z(I,V);});}if(R)return P(1),E?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let L=0,x=0,b=0,C=false,k=false,w=-1,g=0,j=false,O=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),I=we({top:y.top,height:y.height},O(),B(),re,Se);L=I.tStart,x=I.tEnd;}function ie(){if(!C||k)return;let y=J(O(),L,x,1);p&&(w=Math.max(w,y),y=w),g=y,P(y),y>=1&&!j?(j=true,E?.()):y<1&&!p&&(j=false),b=requestAnimationFrame(ie);}X();let le=new IntersectionObserver(y=>{y.forEach(I=>{C=I.isIntersecting,C&&!k?b=requestAnimationFrame(ie):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=Dt(t),P(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Le(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:L,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,j=false,g=0,k=false,P(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(ie)));},seek(y){let I=Math.min(1,Math.max(0,y));g=I,w=I,k=true,cancelAnimationFrame(b),P(I);},getProgress(){return g}}}function dr(e,n={}){let[r,t]=gr.useState(0),i=gr.useRef(n);i.current=n;let o=gr.useRef(-1);return gr.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:p,trigger:E={}}=i.current,R=typeof p=="string"?document.querySelector(p):p??null,M=se(E.start??"top bottom"),re=se(E.end??"bottom top"),Se=0,H=0,W=false,D=0;function z(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function P(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function L(){let w=u.getBoundingClientRect(),g=z(),j=m==="x"?w.left:w.top,O=m==="x"?w.width:w.height,B=we({top:j,height:O},g,P(),M,re);Se=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:j=false}=i.current,O=typeof g=="function"?g:Z[g]??Z.linear,B=J(z(),Se,H,w),X=O(B);j&&(o.current=Math.max(o.current,X),X=o.current),t(X),D=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?D=requestAnimationFrame(x):cancelAnimationFrame(D);});},{root:R??null,threshold:0});L(),b.observe(u);let C;function k(){clearTimeout(C),C=setTimeout(L,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(D),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function en({children:e,className:n,style:r,...t}){let i=gr.useRef(null);return gr.useEffect(()=>{if(!i.current)return;let o=Lt(i.current,t);return ()=>o.destroy()},[]),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function tn({children:e,className:n,style:r,...t}){let i=gr.useRef(null);return gr.useEffect(()=>{if(!i.current)return;let o=kt(i.current,t);return ()=>o.destroy()},[]),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function rn({className:e,style:n,...r}){let t=gr.useRef(null);return gr.useEffect(()=>{if(!t.current)return;let i=It(t.current,r);return ()=>i.destroy()},[]),jsxRuntime.jsx("span",{ref:t,className:e,style:n})}function nn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let a=gr.useRef(null);return gr.useEffect(()=>{if(!a.current)return;let u=Nt(a.current,o);return ()=>u.destroy()},[]),jsxRuntime.jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function on({children:e,as:n="p",className:r,style:t,...i}){let o=gr.useRef(null);return gr.useEffect(()=>{if(!o.current)return;let a=zt(o.current,i);return ()=>a.destroy()},[]),gr__default.default.createElement(n,{ref:o,className:r,style:t},e)}exports.ScrollAnimate=tn;exports.ScrollCounter=rn;exports.ScrollDraw=en;exports.ScrollText=on;exports.ScrollVideo=nn;exports.useScrollDrawProgress=dr;
|
|
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",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),i=(n.match(Pt)??[]).join("").toUpperCase(),o=(e.match(Lt)??[]).length,a=(n.match(Lt)??[]).length;if(t!==i){ve(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==a&&ve(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[i++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Ct(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...Et[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:S={},stagger:R=0,direction:M="forward",once:re=false,debug:Ee=false,axis:H="y",scrollContainer:W,autoReverse:O=false,delay:z=0,strokeColor:L,strokeWidth:P,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:w="0px",repeat:g=0,repeatDelay:j=0,morphTo:N,clip:B,autoplay:X=false,duration:ie=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:I,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,xe=typeof p=="function"?p:Z[p]??Z.linear,$e=se(S.start??"top bottom"),He=se(S.end??"bottom top"),Se=typeof W=="string"?document.querySelector(W):W??null,Te=Array.isArray(L)?L[0]:null,ce=Array.isArray(L)?L[1]:typeof L=="string"?L:null,ue=Array.isArray(P)?P[0]:null,K=Array.isArray(P)?P[1]:typeof P=="number"?P:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function Re(s){let c=s*100;switch(ne){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(a)),F=[],l=[],f=0,ge=0,_=false,U=false,Y=0,Me=false,ye=-1,ae=-1,ee=false,he=0,Ie=0,Fe,rt=null;function ct(){rt?.destroy(),rt=null;}let Oe=new Set,ut=NaN,De=true,je=-1,mt=performance.now(),ze=NaN;function nt(){return Se?H==="x"?Se.scrollLeft:Se.scrollTop:H==="x"?window.scrollX:window.scrollY}function ft(){return Se?H==="x"?Se.clientWidth:Se.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,Se,H);return we(s,s.scroll,ft(),$e,He)}function dt(){(({tStart:f,tEnd:ge}=pt())),Ee&&Be&&(ct(),rt=tr(f,ge,H));}function ot(s,c=pt){Pe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let E=s.destroy;return s.destroy=()=>{E.call(s),Ce(e);},s}function qt(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let E=c==="reverse"?1-s:s;e.style.clipPath=Re(E);return}G.forEach((E,me)=>{E.style.strokeDashoffset=c==="reverse"?`${F[me]*s}`:`${F[me]*(1-s)}`,m&&(E.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&ce?E.style.stroke=_e(Te,ce,s):ce&&(E.style.stroke=ce),ue!==null&&K!==null?E.style.strokeWidth=`${ue+(K-ue)*s}`:K!==null&&(E.style.strokeWidth=`${K}`),de!==null&&oe!==null?E.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(E.style.fillOpacity=`${oe}`),N&&E.tagName.toLowerCase()==="path"&&l[me]&&E.setAttribute("d",at(l[me],N,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=Re(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${F[c]}`,s.style.strokeDashoffset=M==="reverse"?"0":`${F[c]}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),N&&s.tagName.toLowerCase()==="path"&&l[c]&&s.setAttribute("d",l[c]);});}if(G.forEach(s=>{er(s);let c=Ve(s);F.push(c);let E=s.tagName.toLowerCase()==="path";E?l.push(s.getAttribute("d")??""):l.push(""),N&&(E?rr(l[l.length-1],N,s):ve(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),K!==null&&(s.style.strokeWidth=`${K}`),oe!==null&&(s.style.fillOpacity=`${oe}`),N&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",N)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?"0":`${c}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=Re(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof p=="string"?et(p):null;function Wt(){return !(le===false||!Kt()||!G.length||!gt||ne||H!=="y"||Se||u!==1||R!==0||re||O||C!==false||N||b||g||z>0||d||$||y||I||A||V||pe||L!=null||P!=null||x!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Bt(){let s=++Jt,c=`svg-scroll-draw-${s}`,E=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Ne=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Le=`stroke-dashoffset:${Ne};`,T=`stroke-dashoffset:${ke};`;m&&(Le+=`opacity:${M==="reverse"?1:0};`,T+=`opacity:${M==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${Le}}to{${T}}}.${E}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(E);function fe(h,te){h.style.setProperty("--ssd-len",String(F[te])),h.style.strokeDasharray=`${F[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function Q(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:Ae}=we({top:h.top,height:h.height},nt(),ft(),$e,He);return xe(J(nt(),te,Ae,u))}return {destroy(){e.classList.remove(E),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((Ae,be)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=M==="reverse"?`${F[be]*te}`:`${F[be]*(1-te)}`,m&&(Ae.style.opacity=M==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return Q()},refresh(){G.forEach((h,te)=>{F[te]=Ve(h),h.style.setProperty("--ssd-len",String(F[te])),h.style.strokeDasharray=`${F[te]}`;});}}}if(Wt())return ot(Bt());function Gt(){let s=Math.max(1,ie),c=0,E=0,me=false;function Ne(v){let q=true;if(ne){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);he=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Re(M==="reverse"?1-h:h),d?.(h),Q<1&&(q=false);}else G.forEach((Q,h)=>{let te=h*R*s,Ae=Math.min(1,Math.max(0,(v-te)/s)),be=xe(Ae);Q.style.strokeDashoffset=M==="reverse"?`${F[h]*be}`:`${F[h]*(1-be)}`,m&&(Q.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Te&&ce?Q.style.stroke=_e(Te,ce,be):ce&&(Q.style.stroke=ce),ue!==null&&K!==null?Q.style.strokeWidth=`${ue+(K-ue)*be}`:K!==null&&(Q.style.strokeWidth=`${K}`),de!==null&&oe!==null?Q.style.fillOpacity=`${de+(oe-de)*be}`:oe!==null&&(Q.style.fillOpacity=`${oe}`),N&&Q.tagName.toLowerCase()==="path"&&l[h]&&Q.setAttribute("d",at(l[h],N,be)),h===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ae<1&&(q=false);});if(b){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);for(let te in b){let Ae=parseFloat(te);h>=Ae&&!Oe.has(Ae)&&(Oe.add(Ae),b[te]?.());}}return q}function ke(v){if(ee)return;let q=v-c;U||(U=true,$?.());let Q=Ne(q);if(Q&&!_){_=true,Ne(s*(1+Math.max(0,G.length-1)*R)),y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Fe=setTimeout(()=>{c=performance.now(),U=false,_=false,Oe.clear(),Xe(),Y=requestAnimationFrame(ke);},j));return}Q||(Y=requestAnimationFrame(ke));}function Le(){cancelAnimationFrame(Y),clearTimeout(Fe),c=performance.now(),E=0,ee=false,U=false,_=false,Ie=0,me=true,he=0,Oe.clear(),Xe(),Y=requestAnimationFrame(ke);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Le():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Fe),me=false);});},{root:Se??null,threshold:k,rootMargin:w}),D;function fe(){clearTimeout(D),D=setTimeout(()=>{G.forEach((v,q)=>{F[q]=Ve(v),v.style.strokeDasharray=`${F[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Fe),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(D);},replay(){Ie=0,Le();},pause(){ee||!me||(ee=true,E=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-E,Y=requestAnimationFrame(ke));},seek(v){let q=Math.min(1,Math.max(0,v));he=q,ee=true,E=q*s,c=performance.now()-E,cancelAnimationFrame(Y),Ne(E);},getProgress(){return he},refresh(){clearTimeout(D),G.forEach((v,q)=>{F[q]=Ve(v),v.style.strokeDasharray=`${F[q]}`;});}}}if(X)return ot(Gt());dt();function Ye(){if(!Me||ee)return;let s=performance.now(),c=nt();if(!De&&C===false&&c===ut){Y=requestAnimationFrame(Ye);return}De=false,ut=c;let E=u;if(C!==false){let T=s-mt,D=T>0?Math.abs(c-(je<0?c:je))/T:0;E=u*Math.max(.2,1+D*(typeof C=="number"?C:1)*.04);}je=c,mt=s;let me=O?ae===-1||c>=ae?"forward":"reverse":M;ae=c;let Ne=ge-f,ke=true,Le=Ne===0?0:(c-f)/Ne;if(isNaN(ze)||(ze<=0&&Le>0?I?.():ze>0&&Le<=0&&pe?.(),ze<1&&Le>=1?A?.():ze>=1&&Le<1&&V?.()),ze=Le,ne){let T=xe(J(c,f,ge,E));re&&!O&&(ye=Math.max(ye,T),T=ye),he=T,e.style.setProperty("--scroll-draw-progress",String(T));let D=me==="reverse"?1-T:T;e.style.clipPath=Re(D),d?.(T),!U&&J(c,f,ge,E)>0&&(U=true,$?.()),T>=1&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Fe=setTimeout(()=>{ye=-1,U=false,_=false,e.style.clipPath=Re(0);},j))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ye);return}if(G.forEach((T,D)=>{let fe=D*R*Ne,v=xe(J(c,f+fe,ge+fe,E));re&&!O&&(ye=Math.max(ye,v),v=ye),he=v,T.style.strokeDashoffset=me==="reverse"?`${F[D]*v}`:`${F[D]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Te&&ce?T.style.stroke=_e(Te,ce,v):ce&&(T.style.stroke=ce),ue!==null&&K!==null?T.style.strokeWidth=`${ue+(K-ue)*v}`:K!==null&&(T.style.strokeWidth=`${K}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),N&&T.tagName.toLowerCase()==="path"&&l[D]&&T.setAttribute("d",at(l[D],N,v)),D===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(ke=false);}),b){let T=xe(J(c,f,ge,E));for(let D in b){let fe=parseFloat(D);T>=fe&&!Oe.has(fe)&&(Oe.add(fe),b[D]?.());}}!U&&J(c,f,ge,E)>0&&(U=true,$?.()),ke&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Fe=setTimeout(()=>{ye=-1,U=false,_=false,Oe.clear(),Xe(),De=true;},j))):!ke&&!re&&(_=false),Y=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,Y=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(Y);}let it=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!ee?(De=true,Qe()):Ze();});},{root:Se??null,threshold:k,rootMargin:w});function yt(){G.forEach((s,c)=>{F[c]=Ve(s),s.style.strokeDasharray=`${F[c]}`;}),dt(),De=true;}let Je;function qe(){clearTimeout(Je),Je=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),z>0?setTimeout(()=>it.observe(e),z):it.observe(e),ot({destroy(){cancelAnimationFrame(Y),clearTimeout(Fe),Ze(),it.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Je),ct();},replay(){ye=-1,ae=-1,je=-1,U=false,_=false,Ie=0,ee=false,he=0,Oe.clear(),clearTimeout(Fe),Xe(),De=true,Me&&Qe();},pause(){ee=true,Ze();},resume(){ee&&(ee=false,De=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));he=c,ye=c,ee=true,Ze(),qt(c,M),De=true;},getProgress(){return he},refresh(){clearTimeout(Je),yt(),Me&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}function nr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function $t(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function or(e,n,r){let t=$t(e),i=$t(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,a)=>{let u=i[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function Rt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(nr(t))return _e(t,i,r);if(t.includes("("))return or(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:i}function sr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ir=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ar=0,kt="--scroll-draw-progress";function lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function It(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:S=true,velocityScale:R=false,respectReducedMotion:M=true,triggerElement:re,onProgress:Ee,onComplete:H,onEnter:W,onLeave:O,onEnterBack:z,onLeaveBack:L}=n,P=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Z[o]??Z["ease-out"],b=se(i.start??"top bottom"),C=se(i.end??"bottom top"),k=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([l,f])=>({prop:sr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function j(){let l=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function N(){for(let l of g)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...g.map(f=>f.prop),kt])B.set(l,e.style.getPropertyValue(l));function X(){for(let[l,f]of B)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(P)return N(),H?.(),{...r,destroy:X,getProgress:()=>1};j();let ie=typeof o=="string"?et(o):null;function le(){if(!S||!lr()||!ie||m!=="y"||w||k!==e||u||a!==1||Ee||H||W||O||z||L||R!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let l of g)if(!ir.has(l.prop))return false;return true}function d(){let l=`ssd-a-${++ar}`,f=g.map(ae=>`${ae.prop}:${ae.from}`).join(";"),ge=g.map(ae=>`${ae.prop}:${ae.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${l}{from{${f}}to{${ge}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(l);let U=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let ae=e.getBoundingClientRect();return we({top:ae.top,height:ae.height},U(),Y(),b,C)};Pe(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(l),_.remove(),e.style.animationPlayState="",X(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let ee=Math.min(1,Math.max(0,ae));e.classList.remove(l);for(let he of g)e.style.setProperty(he.prop,Rt(he.from,he.to,ee));},getProgress(){let{tStart:ae,tEnd:ee}=Me();return x(J(U(),ae,ee,a))}};return ye}if(le())return d();let $=0,y=0,I=0,A=false,V=false,pe=-1,ne=0,xe=false,$e=NaN,He=-1,Se=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let l=Ke(k,w,m),f=we(l,l.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function K(l){e.style.setProperty(kt,String(l));for(let f of g)e.style.setProperty(f.prop,Rt(f.from,f.to,l));Ee?.(l);}function de(l){if(isNaN($e)){$e=l;return}$e<=0&&l>0?W?.():$e>0&&l<=0&&L?.(),$e<1&&l>=1?O?.():$e>=1&&l<1&&z?.(),$e=l;}function oe(){if(!A||V)return;let l=performance.now(),f=Te(),ge=a;if(R!==false){let Y=l-Se,Me=Y>0?Math.abs(f-(He<0?f:He))/Y:0;ge=a*Math.max(.2,1+Me*(typeof R=="number"?R:1)*.04);}He=f,Se=l;let _=y===$?0:(f-$)/(y-$);de(_);let U=x(J(f,$,y,ge));u&&(pe=Math.max(pe,U),U=pe),ne=U,K(U),U>=1&&!xe?(xe=true,H?.()):U<1&&!u&&(xe=false),I=requestAnimationFrame(oe);}ue(),y===$&&ve("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 l=x(J(Te(),$,y,a));u&&l>0&&(pe=l),ne=l,K(l);}let Re=new IntersectionObserver(l=>{l.forEach(f=>{A=f.isIntersecting,A&&!V?I=requestAnimationFrame(oe):cancelAnimationFrame(I);});},{root:w??null}),G;function F(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),Re.observe(e),Pe(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(I),Re.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(G),X(),Ce(e);},replay(){pe=-1,xe=false,ne=0,V=false,K(0);},pause(){V=true,cancelAnimationFrame(I);},resume(){V&&(V=false,A&&(I=requestAnimationFrame(oe)));},seek(l){let f=Math.min(1,Math.max(0,l));ne=f,pe=f,V=true,cancelAnimationFrame(I),K(f);},getProgress(){return ne}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollCounter: element not found:",e),lt;let t=r,{from:i=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:p=true,decimals:S,onComplete:R}=n,M=S!==void 0?d=>d.toFixed(S):a??(d=>String(Math.round(d))),re=typeof u=="function"?u:Z[u]??Z["ease-out"],Ee=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(o),R?.(),lt;let O=0,z=0,L=0,P=false,x=false,b=-1,C=0,k=false,w=()=>window.scrollY,g=()=>window.innerHeight;function j(){let d=t.getBoundingClientRect(),$=we({top:d.top,height:d.height},w(),g(),Ee,H);O=$.tStart,z=$.tEnd;}function N(d){t.textContent=M(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!P||x)return;let d=re(J(w(),O,z,1));p&&(b=Math.max(b,d),d=b),C=d,N(d),d>=1&&!k?(k=true,R?.()):d<1&&!p&&(k=false),L=requestAnimationFrame(B);}j();{let d=re(J(w(),O,z,1));p&&d>0&&(b=d),C=d,N(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{P=$.isIntersecting,P&&!x?L=requestAnimationFrame(B):cancelAnimationFrame(L);});}),ie;function le(){clearTimeout(ie),ie=setTimeout(j,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:O,tEnd:z})}),{destroy(){cancelAnimationFrame(L),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ie),Ce(t);},replay(){b=-1,k=false,C=0,x=false,N(0);},pause(){x=true,cancelAnimationFrame(L);},resume(){x&&(x=false,P&&(L=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(L),N($);},getProgress(){return C}}}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ot(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ve("scrollVideo: <video> element not found:",e),Ft;let t=r,{trigger:i={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:p,onComplete:S,onProgress:R}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Z[o]??Z.linear,Ee=se(i.start??"top top"),H=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,O=n.to,z=0,L=0,P=0,x=false,b=false,C=-1,k=0,w=false,g=false,j=()=>u==="x"?window.scrollX:window.scrollY,N=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=we({top:V,height:pe},j(),N(),Ee,H);z=ne.tStart,L=ne.tEnd;}let X=NaN;function ie(A){if(!g)return;let V=O??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),R?.(A);}function le(){if(!x||b||!g||M)return;let A=re(J(j(),z,L,1));a&&(C=Math.max(C,A),A=C),k=A,ie(A),A>=1&&!w?(w=true,S?.()):A<1&&!a&&(w=false),P=requestAnimationFrame(le);}function d(){if(g=true,O===void 0&&(O=t.duration),M){ie(1),p?.();return}B(),p?.(),x&&!b&&(P=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?P=requestAnimationFrame(le):cancelAnimationFrame(P);});}),y;function I(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),$.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:z,tEnd:L})}),{destroy(){cancelAnimationFrame(P),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(y),Ce(t);},replay(){C=-1,w=false,k=0,b=false,X=NaN,ie(0);},pause(){b=true,cancelAnimationFrame(P);},resume(){b&&(b=false,x&&g&&(P=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));k=V,C=V,b=true,cancelAnimationFrame(P),X=NaN,ie(V);},getProgress(){return k}}}function zt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=zt(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],i=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of i){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,p)=>{let S=m.nextElementSibling;u.appendChild(m),p<a.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ur(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,a=o+(1-i);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function mr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Vt(e,n={}){if(typeof window>"u")return Ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollText: element not found:",e),Ht;let t=r,{split:i="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:S}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof a=="function"?a:Z[a]??Z["ease-out"],re=se(m.start??"top 85%"),Ee=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=cr(t):i==="lines"?W=Dt(t):W=zt(t);let O=W.length;function z(y,I){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*I));let A=mr(I,u);A&&(y.style.transform=A);}function L(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((I,A)=>{let V=M(ur(y,A,O,o));z(I,V);});}if(R)return L(1),S?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};L(0);let P=0,x=0,b=0,C=false,k=false,w=-1,g=0,j=false,N=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),I=we({top:y.top,height:y.height},N(),B(),re,Ee);P=I.tStart,x=I.tEnd;}function ie(){if(!C||k)return;let y=J(N(),P,x,1);p&&(w=Math.max(w,y),y=w),g=y,L(y),y>=1&&!j?(j=true,S?.()):y<1&&!p&&(j=false),b=requestAnimationFrame(ie);}X();let le=new IntersectionObserver(y=>{y.forEach(I=>{C=I.isIntersecting,C&&!k?b=requestAnimationFrame(ie):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=Dt(t),L(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Pe(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:P,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,j=false,g=0,k=false,L(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(ie)));},seek(y){let I=Math.min(1,Math.max(0,y));g=I,w=I,k=true,cancelAnimationFrame(b),L(I);},getProgress(){return g}}}function dr(e,n={}){let[r,t]=gr.useState(0),i=gr.useRef(n);i.current=n;let o=gr.useRef(-1);return gr.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:p,trigger:S={}}=i.current,R=typeof p=="string"?document.querySelector(p):p??null,M=se(S.start??"top bottom"),re=se(S.end??"bottom top"),Ee=0,H=0,W=false,O=0;function z(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function L(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function P(){let w=u.getBoundingClientRect(),g=z(),j=m==="x"?w.left:w.top,N=m==="x"?w.width:w.height,B=we({top:j,height:N},g,L(),M,re);Ee=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:j=false}=i.current,N=typeof g=="function"?g:Z[g]??Z.linear,B=J(z(),Ee,H,w),X=N(B);j&&(o.current=Math.max(o.current,X),X=o.current),t(X),O=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?O=requestAnimationFrame(x):cancelAnimationFrame(O);});},{root:R??null,threshold:0});P(),b.observe(u);let C;function k(){clearTimeout(C),C=setTimeout(P,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(O),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function bn({children:e,className:n,style:r,...t}){let i=gr.useRef(null);return gr.useEffect(()=>{if(!i.current)return;let o=Ct(i.current,t);return ()=>o.destroy()},[]),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function wn({children:e,className:n,style:r,...t}){let i=gr.useRef(null);return gr.useEffect(()=>{if(!i.current)return;let o=It(i.current,t);return ()=>o.destroy()},[]),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function vn({className:e,style:n,...r}){let t=gr.useRef(null);return gr.useEffect(()=>{if(!t.current)return;let i=Nt(t.current,r);return ()=>i.destroy()},[]),jsxRuntime.jsx("span",{ref:t,className:e,style:n})}function En({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let a=gr.useRef(null);return gr.useEffect(()=>{if(!a.current)return;let u=Ot(a.current,o);return ()=>u.destroy()},[]),jsxRuntime.jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function Sn({children:e,as:n="p",className:r,style:t,...i}){let o=gr.useRef(null);return gr.useEffect(()=>{if(!o.current)return;let a=Vt(o.current,i);return ()=>a.destroy()},[]),gr__default.default.createElement(n,{ref:o,className:r,style:t},e)}exports.ScrollAnimate=wn;exports.ScrollCounter=vn;exports.ScrollDraw=bn;exports.ScrollText=Sn;exports.ScrollVideo=En;exports.useScrollDrawProgress=dr;
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,215 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { RefObject } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end?: string;
|
|
9
|
-
}
|
|
10
|
-
interface ScrollDrawOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Apply a named preset as the base configuration. User-supplied options
|
|
13
|
-
* always override the preset. Available presets:
|
|
14
|
-
* - `'sketch'` — staggered ease-in draw, pencil feel
|
|
15
|
-
* - `'reveal'` — fade + ease-out, draws once on viewport entry
|
|
16
|
-
* - `'typewriter'` — fast linear draw with stagger
|
|
17
|
-
* - `'cinematic'` — slow ease-in-out with fade, dramatic entrance
|
|
18
|
-
* - `'spring'` — spring easing, bouncy organic feel
|
|
19
|
-
*/
|
|
20
|
-
preset?: PresetName;
|
|
21
|
-
selector?: string;
|
|
22
|
-
speed?: number;
|
|
23
|
-
fade?: boolean;
|
|
24
|
-
easing?: EasingName | ((t: number) => number);
|
|
25
|
-
trigger?: TriggerConfig;
|
|
26
|
-
stagger?: number;
|
|
27
|
-
direction?: 'forward' | 'reverse';
|
|
28
|
-
once?: boolean;
|
|
29
|
-
debug?: boolean;
|
|
30
|
-
/** Scroll axis to track. 'y' (default) for vertical, 'x' for horizontal. */
|
|
31
|
-
axis?: 'x' | 'y';
|
|
32
|
-
/** CSS selector or Element for a custom scroll container (default: window). */
|
|
33
|
-
scrollContainer?: string | Element;
|
|
34
|
-
/** Automatically reverse the animation when the user scrolls back up. */
|
|
35
|
-
autoReverse?: boolean;
|
|
36
|
-
/** Delay in milliseconds before the engine starts observing. */
|
|
37
|
-
delay?: number;
|
|
38
|
-
/** Animate stroke color. Single string = static override. Tuple = interpolate from → to. */
|
|
39
|
-
strokeColor?: string | [string, string];
|
|
40
|
-
/** Animate stroke width. Single number = static override. Tuple = interpolate from → to. */
|
|
41
|
-
strokeWidth?: number | [number, number];
|
|
42
|
-
/** Animate fill opacity. Single number = static override. Tuple [from, to] = interpolate as the path draws. Use [0, 1] to flood fill in sync with the stroke draw. */
|
|
43
|
-
fillOpacity?: number | [number, number];
|
|
44
|
-
/**
|
|
45
|
-
* Reveal the container using CSS clip-path instead of stroke-dashoffset.
|
|
46
|
-
* Works on any content — SVG, images, text, divs.
|
|
47
|
-
*
|
|
48
|
-
* Pass a direction string to control which edge the reveal starts from,
|
|
49
|
-
* or `true` as shorthand for `'left'`.
|
|
50
|
-
*
|
|
51
|
-
* Values: `'left' | 'right' | 'top' | 'bottom' | 'center'`
|
|
52
|
-
*/
|
|
53
|
-
clip?: boolean | 'left' | 'right' | 'top' | 'bottom' | 'center';
|
|
54
|
-
/** Fire callbacks at specific progress thresholds (0–1). Resets on replay(). */
|
|
55
|
-
waypoints?: Record<number, () => void>;
|
|
56
|
-
/** Scale animation speed by scroll velocity — faster scrolling = faster draw. Pass a number to control sensitivity (default 1). */
|
|
57
|
-
velocityScale?: boolean | number;
|
|
58
|
-
/** IntersectionObserver threshold (0–1). Default 0. */
|
|
59
|
-
threshold?: number;
|
|
60
|
-
/** IntersectionObserver rootMargin. Default "0px". */
|
|
61
|
-
rootMargin?: string;
|
|
62
|
-
/** Repeat the animation N times after completion. Use 'infinite' to loop forever. */
|
|
63
|
-
repeat?: number | 'infinite';
|
|
64
|
-
/** Milliseconds to wait between repeats. Default 0. */
|
|
65
|
-
repeatDelay?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Target path `d` attribute to morph toward as the animation progresses.
|
|
68
|
-
* Paths must have compatible command structures (same number of numeric tokens).
|
|
69
|
-
*
|
|
70
|
-
* Only applies to `<path>` elements — silently no-ops on `<rect>`, `<circle>`,
|
|
71
|
-
* `<line>`, and other SVG shape elements.
|
|
72
|
-
*/
|
|
73
|
-
morphTo?: string;
|
|
74
|
-
onProgress?: (alpha: number) => void;
|
|
75
|
-
onStart?: () => void;
|
|
76
|
-
onComplete?: () => void;
|
|
77
|
-
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
78
|
-
onEnter?: () => void;
|
|
79
|
-
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
80
|
-
onLeave?: () => void;
|
|
81
|
-
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
82
|
-
onEnterBack?: () => void;
|
|
83
|
-
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
84
|
-
onLeaveBack?: () => void;
|
|
85
|
-
/**
|
|
86
|
-
* Trigger the animation when the element enters the viewport instead of
|
|
87
|
-
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
88
|
-
* replaying each time the element re-enters the viewport (use `once: true`
|
|
89
|
-
* to play only the first time).
|
|
90
|
-
*
|
|
91
|
-
* All visual options work in autoplay mode — `easing`, `stagger`, `fade`,
|
|
92
|
-
* `strokeColor`, `strokeWidth`, `fillOpacity`, `clip`, `morphTo`, `waypoints`,
|
|
93
|
-
* `repeat`, `repeatDelay`, `onStart`, `onComplete`, `onProgress`, etc.
|
|
94
|
-
*
|
|
95
|
-
* The full instance API (`pause`, `resume`, `seek`, `replay`, `getProgress`)
|
|
96
|
-
* also works — `seek(0.5)` pauses at 50% of the duration.
|
|
97
|
-
*/
|
|
98
|
-
autoplay?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Duration of the autoplay animation in milliseconds. Only used when
|
|
101
|
-
* `autoplay: true`. Default `1000`.
|
|
102
|
-
*/
|
|
103
|
-
duration?: number;
|
|
104
|
-
/**
|
|
105
|
-
* Use the browser's native CSS scroll-driven animation
|
|
106
|
-
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
107
|
-
* the browser supports it. This runs the draw entirely on the compositor —
|
|
108
|
-
* zero per-frame JavaScript, zero scroll/resize listeners.
|
|
109
|
-
*
|
|
110
|
-
* Falls back to the JS engine automatically when unsupported or when the
|
|
111
|
-
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|
|
112
|
-
* velocity scaling, custom triggers, `once`, custom easing functions, etc.).
|
|
113
|
-
*
|
|
114
|
-
* - `undefined` / `true` (default): use native when eligible.
|
|
115
|
-
* - `false`: always use the JS engine.
|
|
116
|
-
*/
|
|
117
|
-
native?: boolean;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
interface ScrollAnimateOptions {
|
|
121
|
-
props: Record<string, string | number | [string | number, string | number]>;
|
|
122
|
-
trigger?: TriggerConfig;
|
|
123
|
-
easing?: EasingName | ((t: number) => number);
|
|
124
|
-
speed?: number;
|
|
125
|
-
once?: boolean;
|
|
126
|
-
axis?: 'x' | 'y';
|
|
127
|
-
scrollContainer?: string | Element;
|
|
128
|
-
native?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Scale animation speed by scroll velocity — faster scrolling = faster animation.
|
|
131
|
-
* Pass `true` for default sensitivity (1) or a number to control it.
|
|
132
|
-
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
133
|
-
*/
|
|
134
|
-
velocityScale?: boolean | number;
|
|
135
|
-
/**
|
|
136
|
-
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
137
|
-
* animating. Default: `true`.
|
|
138
|
-
*
|
|
139
|
-
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
140
|
-
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
141
|
-
* their input, so it is direct manipulation rather than something that plays at
|
|
142
|
-
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
143
|
-
* would leave every panel but the last unreachable inside the sticky
|
|
144
|
-
* `overflow: hidden` container.
|
|
145
|
-
*/
|
|
146
|
-
respectReducedMotion?: boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Element whose geometry defines the trigger window, when that is not the
|
|
149
|
-
* element being animated. Defaults to the animated element.
|
|
150
|
-
*
|
|
151
|
-
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
152
|
-
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
153
|
-
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
154
|
-
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
155
|
-
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
156
|
-
*
|
|
157
|
-
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
158
|
-
* always measures the element the animation is attached to, so it cannot express
|
|
159
|
-
* a separate subject.
|
|
160
|
-
*/
|
|
161
|
-
triggerElement?: Element;
|
|
162
|
-
onProgress?: (alpha: number) => void;
|
|
163
|
-
onComplete?: () => void;
|
|
164
|
-
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
165
|
-
onEnter?: () => void;
|
|
166
|
-
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
167
|
-
onLeave?: () => void;
|
|
168
|
-
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
169
|
-
onEnterBack?: () => void;
|
|
170
|
-
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
171
|
-
onLeaveBack?: () => void;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
interface ScrollCounterOptions {
|
|
175
|
-
from?: number;
|
|
176
|
-
to: number;
|
|
177
|
-
format?: (value: number) => string;
|
|
178
|
-
easing?: EasingName | ((t: number) => number);
|
|
179
|
-
trigger?: TriggerConfig;
|
|
180
|
-
once?: boolean;
|
|
181
|
-
decimals?: number;
|
|
182
|
-
onComplete?: () => void;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
interface ScrollVideoOptions {
|
|
186
|
-
trigger?: TriggerConfig;
|
|
187
|
-
from?: number;
|
|
188
|
-
to?: number;
|
|
189
|
-
easing?: EasingName | ((t: number) => number);
|
|
190
|
-
once?: boolean;
|
|
191
|
-
axis?: 'x' | 'y';
|
|
192
|
-
preload?: 'auto' | 'metadata';
|
|
193
|
-
onReady?: () => void;
|
|
194
|
-
onComplete?: () => void;
|
|
195
|
-
onProgress?: (alpha: number) => void;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
interface ScrollTextOptions {
|
|
199
|
-
split?: 'chars' | 'words' | 'lines';
|
|
200
|
-
stagger?: number;
|
|
201
|
-
easing?: EasingName | ((t: number) => number);
|
|
202
|
-
from?: {
|
|
203
|
-
opacity?: number;
|
|
204
|
-
y?: number;
|
|
205
|
-
x?: number;
|
|
206
|
-
rotate?: number;
|
|
207
|
-
scale?: number;
|
|
208
|
-
};
|
|
209
|
-
trigger?: TriggerConfig;
|
|
210
|
-
once?: boolean;
|
|
211
|
-
onComplete?: () => void;
|
|
212
|
-
}
|
|
3
|
+
import { E as EasingName, T as TriggerConfig, a as ScrollDrawOptions } from '../types-DHU1zNEw.mjs';
|
|
4
|
+
import { S as ScrollAnimateOptions } from '../engine-Ci08nM91.mjs';
|
|
5
|
+
import { S as ScrollCounterOptions } from '../index-BDGQEK6X.mjs';
|
|
6
|
+
import { ScrollVideoOptions } from '../video/index.mjs';
|
|
7
|
+
import { ScrollTextOptions } from '../text/index.mjs';
|
|
213
8
|
|
|
214
9
|
interface UseScrollDrawProgressOptions {
|
|
215
10
|
/** Same speed multiplier as ScrollDraw. Values > 1 complete faster. Default 1. */
|