svg-scroll-draw 2.15.3 → 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 -240
- package/dist/angular/index.d.ts +7 -240
- 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 -148
- package/dist/astro/index.d.ts +4 -148
- 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 -207
- package/dist/group/index.d.ts +4 -207
- 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 -294
- package/dist/index.d.ts +8 -294
- package/dist/index.mjs +1 -4
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.d.mts +7 -507
- package/dist/nuxt/index.d.ts +7 -507
- 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 -212
- package/dist/react/index.d.ts +5 -212
- package/dist/react/index.mjs +1 -3
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +1 -5
- package/dist/reveal/index.d.ts +1 -5
- 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 -240
- package/dist/solid/index.d.ts +6 -240
- package/dist/solid/index.mjs +1 -3
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.d.mts +6 -240
- package/dist/svelte/index.d.ts +6 -240
- 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 -213
- package/dist/vue/index.d.ts +6 -213
- 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/aos/react/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
3
|
-
`)}var a={...T},d=[],f=!1,m=0,w,p=null,s=null,E=!1,_=()=>typeof window<"u"&&typeof document<"u";function C(e){if(!(e instanceof HTMLElement))return e.getBoundingClientRect().top+window.scrollY;let t=0,n=e;for(;n;)t+=n.offsetTop-(n.tagName!=="BODY"?n.scrollTop:0),n=n.offsetParent;return t}var N=e=>e instanceof HTMLElement?e.offsetHeight:e.getBoundingClientRect().height;function c(e,t){return e.getAttribute(`data-aos-${t}`)}function $(e,t,n){let o=c(e,t);return o==="true"?!0:o==="false"?!1:n}function D(e,t){let n=c(e,"offset");return n&&!isNaN(Number(n))?parseInt(n,10):n||t?0:a.offset}function j(e){let t=window.innerHeight,n=c(e,"anchor-placement"),o=D(e,n),u=c(e,"anchor"),A=u?document.querySelector(u):null;u&&!A&&S(`aos: data-aos-anchor="${u}" matches nothing; using the element itself`);let x=A||e,l=N(x),i=C(x)-t;switch(n||a.anchorPlacement){case"center-bottom":i+=l/2;break;case"bottom-bottom":i+=l;break;case"top-center":i+=t/2;break;case"center-center":i+=t/2+l/2;break;case"bottom-center":i+=t/2+l;break;case"top-top":i+=t;break;case"bottom-top":i+=t+l;break;case"center-top":i+=t+l/2;break;default:break}return i+o}function U(e){return C(e)+N(e)-D(e,null)}function K(e){let t=c(e,"duration")??String(a.duration),n=c(e,"delay")??String(a.delay),o=c(e,"easing")??a.easing;e.style.setProperty("--aos-duration",`${parseFloat(t)||0}ms`),e.style.setProperty("--aos-delay",`${parseFloat(n)||0}ms`),e.style.setProperty("--aos-easing",W[o]??o)}function R(){d=Array.from(document.querySelectorAll("[data-aos]")).map(e=>{let t=d.find(n=>n.node===e);return{node:e,in:0,out:0,once:$(e,"once",a.once),mirror:$(e,"mirror",a.mirror),animated:t?t.animated:e.classList.contains(a.animatedClassName),classes:a.useClassNames?(e.getAttribute("data-aos")||"").split(" ").filter(Boolean):[],id:c(e,"id")}});for(let e of d)K(e.node),e.node.classList.add(a.initClassName)}function k(){for(let e of d)e.in=j(e.node),e.out=U(e.node)}function H(e,t){document.dispatchEvent(new CustomEvent(`aos:${e}`,{detail:t.node})),t.id&&document.dispatchEvent(new CustomEvent(`aos:${e}:${t.id}`,{detail:t.node}))}function M(e){e.animated||(e.animated=!0,e.node.classList.add(a.animatedClassName,...e.classes),H("in",e))}function z(e){e.animated&&(e.animated=!1,e.node.classList.remove(a.animatedClassName,...e.classes),H("out",e))}function L(){m=0;let e=window.scrollY;for(let t of d){if(E){M(t);continue}t.mirror&&!t.once&&e>t.out?z(t):e>t.in?M(t):t.once||z(t)}}var I=()=>{m||(m=requestAnimationFrame(L))};function b(){clearTimeout(w),w=setTimeout(v,50)}var q=()=>v();function P(){let e=a.disable;if(typeof e=="function")return e();if(e===!0)return!0;let t=window.innerWidth;return e==="phone"?t<768:e==="tablet"?t>=768&&t<1024:e==="mobile"?t<1024:!1}function Q(){document.querySelectorAll("[data-aos]").forEach(e=>{for(let t of["data-aos","data-aos-easing","data-aos-duration","data-aos-delay"])e.removeAttribute(t)})}function J(){if(document.getElementById(h))return;let e=document.createElement("style");e.id=h,e.textContent=Z(a.animatedClassName),document.head.appendChild(e)}function g(){if(!f){if(f=!0,s=null,R(),E)for(let e of d)e.node.setAttribute("data-aos-instant","");k(),L(),window.addEventListener("scroll",I,{passive:!0}),window.addEventListener("resize",b),window.addEventListener("orientationchange",b),window.addEventListener("load",q),!a.disableMutationObserver&&typeof MutationObserver<"u"&&(p=new MutationObserver(e=>{e.some(n=>[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].some(o=>o instanceof Element&&(o.hasAttribute("data-aos")||o.querySelector("[data-aos]"))))&&F()}),p.observe(document.documentElement,{childList:!0,subtree:!0}))}}function ee(e={}){if(!_())return[];if((f||s)&&V(),a={...T,...e},P())return Q(),[];E=O(),J();let t=document.readyState!=="loading";if(a.startEvent==="DOMContentLoaded"&&t)g();else if(a.startEvent==="load"&&document.readyState==="complete")g();else{let n=a.startEvent==="load"?window:document,o=()=>g();n.addEventListener(a.startEvent,o,{once:!0}),s={target:n,type:a.startEvent,fn:o}}return Array.from(document.querySelectorAll("[data-aos]"))}function v(){f&&(k(),L())}function F(){if(f){if(P()){Q();return}R(),v()}}function V(){if(_()){s&&s.target.removeEventListener(s.type,s.fn),s=null,cancelAnimationFrame(m),m=0,clearTimeout(w),window.removeEventListener("scroll",I),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),window.removeEventListener("load",q),p?.disconnect(),p=null;for(let e of d)e.node.removeAttribute("data-aos-instant");d=[],f=!1,document.getElementById(h)?.remove()}}var te={init:ee,refresh:v,refreshHard:F,destroy:V},y=te;function ne(e={},t){let n=B(e);n.current=e,Y(()=>(y.init(n.current),()=>y.destroy()),[]);let o=B(!0);Y(()=>{if(o.current){o.current=!1;return}y.refreshHard()},[t])}function ue({refreshKey:e,...t}){return ne(t,e),null}export{ue as AOSInit,ne as useAOS};
|
|
2
|
+
import {e}from'../../chunk-WQZKXAXK.mjs';import'../../chunk-AJ22VSHC.mjs';import'../../chunk-LFSU6LR3.mjs';import {useRef,useEffect}from'react';function i(r={},n){let e$1=useRef(r);e$1.current=r,useEffect(()=>(e.init(e$1.current),()=>e.destroy()),[]);let o=useRef(true);useEffect(()=>{if(o.current){o.current=false;return}e.refreshHard();},[n]);}function O({refreshKey:r,...n}){return i(n,r),null}export{O as AOSInit,i as useAOS};
|
package/dist/astro/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Vt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let v=Math.pow(l,d);c.push(v),s+=v;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<r;v++)if(d<=u[v+1]){let _=(d-u[v])/(u[v+1]-u[v]);if(v===0)return _*(2-_);let T=1-Math.pow(t,v);return T+(1-T)*(2*_-1)*(2*_-1)}return 1}}function qt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ue={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:Vt(),elastic:qt()};function yt(e,n,r){return Math.min(r,Math.max(n,e))}function ve(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 ht(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 bt(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 Z(e,n,r,t){return r===n?0:yt((e-n)/(r-n)*t,0,1)}function Le(e,n,r,t,l){let s=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),c=ht(e.top,e.height,n,l.element)-bt(l.viewport,r);return {tStart:s,tEnd:c}}function Ze(e,n,r){let t=e.getBoundingClientRect(),l=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:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function ze(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 wt(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 Ve(e,n,r){let t=wt(e),l=wt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var vt={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 K(e,...n){Be&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Gt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function jt(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 Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Bt;case "ease-in-out":return Gt()?jt(ue["ease-in-out"]):null;default:return null}}var Et=Symbol.for("svg-scroll-draw.registry");function Tt(){let e=globalThis;return e[Et]||(e[Et]=new Map)}function ke(e,n){Tt().set(e,n);}function Ie(e){Tt().delete(e);}var Ut=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function xt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var At=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Xt(e){if(!Be)return;let n=xt(e,"stroke");if(!n||n==="none"){K("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!At.has(r)&&!At.has(xt(e,"fill"))&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Jt(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 l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var At=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Mt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Qt(e,n,r){if(!Be)return;let t=(e.match(Mt)??[]).join("").toUpperCase(),l=(n.match(Mt)??[]).join("").toUpperCase(),s=(e.match(At)??[]).length,c=(n.match(At)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...wt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:S={},stagger:_=0,direction:x="forward",once:ne=false,debug:ke=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:T,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:F=false,threshold:B=0,rootMargin:C="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:ve=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:v,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Pe}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=Se(S.start??"top bottom"),He=Se(S.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(T)?T[0]:null,Y=Array.isArray(T)?T[1]:typeof T=="string"?T:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let k=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,O=false,R=false,N=0,xe=false,ae=-1,U=-1,V=false,le=0,Ce=0,Re,tt=null;function lt(){tt?.destroy(),tt=null;}let Fe=new Set,ct=NaN,Ne=true,je=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),ke&&Be&&(lt(),tt=Jt(f,ie,j));}function nt(o,a=ft){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function Ft(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}k.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=Ve(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}k.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=x==="reverse"?"0":`${E[a]}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(k.forEach(o=>{Xt(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Qt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?"0":`${a}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Nt(){return !(Ee===false||!Yt()||!k.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||F!==false||D||A||M||ee>0||g||v||y||$||ye||he||Pe||T!=null||W!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ht(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=x==="reverse"?"0":"var(--ssd-len)",$e=x==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${x==="reverse"?1:0};`,w+=`opacity:${x==="reverse"?0:1};`);let P=document.createElement("style");P.setAttribute("data-svg-scroll-draw",""),P.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(P),e.classList.add(b);function Q(p,q){p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}k.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:q,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),q,we,u))}return {destroy(){e.classList.remove(b),k.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),P.remove();},replay(){h=false,I=-1,k.forEach(Q);},pause(){h=true,k.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,k.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let q=Math.min(1,Math.max(0,p));I=q,h=true,k.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=x==="reverse"?`${E[ce]*q}`:`${E[ce]*(1-q)}`,m&&(we.style.opacity=x==="reverse"?`${1-q}`:`${q}`);});},getProgress(){return H()},refresh(){k.forEach((p,q)=>{E[q]=ze(p),p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`;});}}}if(Nt())return nt(Ht());function _t(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(x==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else k.forEach((H,p)=>{let q=p*_*o,we=Math.min(1,Math.max(0,(h-q)/o)),ce=be(we);H.style.strokeDashoffset=x==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=x==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=Ve(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let q in A){let we=parseFloat(q);p>=we&&!Fe.has(we)&&(Fe.add(we),A[q]?.());}}return I}function $e(h){if(V)return;let I=h-a;R||(R=true,v?.());let H=De(I);if(H&&!O){O=true,De(o*(1+Math.max(0,k.length-1)*_)),y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{a=performance.now(),R=false,O=false,Fe.clear(),Ue(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,V=false,R=false,O=false,Ce=0,J=true,le=0,Fe.clear(),Ue(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&O)?Te():!I.isIntersecting&&!ne&&!O&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:fe??null,threshold:B,rootMargin:C}),P;function Q(){clearTimeout(P),P=setTimeout(()=>{k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(P);},replay(){Ce=0,Te();},pause(){V||!J||(V=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){V&&(V=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,V=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(P),k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return nt(_t());pt();function Ye(){if(!xe||V)return;let o=performance.now(),a=rt();if(!Ne&&F===false&&a===ct){N=requestAnimationFrame(Ye);return}Ne=false,ct=a;let b=u;if(F!==false){let w=o-ut,P=w>0?Math.abs(a-(je<0?a:je))/w:0;b=u*Math.max(.2,1+P*(typeof F=="number"?F:1)*.04);}je=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":x;U=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Te>0?$?.():_e>0&&Te<=0&&Pe?.(),_e<1&&Te>=1?ye?.():_e>=1&&Te<1&&he?.()),_e=Te,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let P=J==="reverse"?1-w:w;e.style.clipPath=Me(P),g?.(w),!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),w>=1&&!O?(O=true,y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{ae=-1,R=false,O=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(O=false),N=requestAnimationFrame(Ye);return}if(k.forEach((w,P)=>{let Q=P*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[P]*h}`:`${E[P]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=Ve(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[P]&&w.setAttribute("d",it(i[P],D,h)),P===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let P in A){let Q=parseFloat(P);w>=Q&&!Fe.has(Q)&&(Fe.add(Q),A[P]?.());}}!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),$e&&!O?(O=true,y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{ae=-1,R=false,O=false,Fe.clear(),Ue(),Ne=true;},me))):!$e&&!ne&&(O=false),N=requestAnimationFrame(Ye);}let ot=false;function Xe(){ot||(ot=true,N=requestAnimationFrame(function(){Ye();}));}function Je(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{xe=a.isIntersecting,xe&&!V?(Ne=true,Xe()):Je();});},{root:fe??null,threshold:B,rootMargin:C});function gt(){k.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(gt,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)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Je(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),lt();},replay(){ae=-1,U=-1,je=-1,R=false,O=false,Ce=0,V=false,le=0,Fe.clear(),clearTimeout(Re),Ue(),Ne=true,xe&&Xe();},pause(){V=true,Je();},resume(){V&&(V=false,Ne=true,xe&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,V=true,Je(),Ft(a,x),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Qe),gt(),xe&&!V&&Xe();}},()=>({tStart:f,tEnd:ie}))}function Zt(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 l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Kt(e,n,r){let t=$t(e),l=$t(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Lt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Zt(t))return Ve(t,l,r);if(t.includes("("))return Kt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Pt="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ct(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:S=true,velocityScale:_=false,respectReducedMotion:x=true,triggerElement:ne,onProgress:ke,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:T}=n,W=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=Se(l.start??"top bottom"),F=Se(l.end??"bottom top"),B=ne??e,C=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:er(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),Pt])de.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:ve,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!S||!nr()||!ge||m!=="y"||C||B!==e||u||c!==1||ke||j||oe||se||ee||T||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!tr.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++rr}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(i);let R=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},R(),N(),A,F)};Oe(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:xe});let ae={destroy(){e.classList.remove(i),O.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let V=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Lt(le.from,le.to,V));},getProgress(){let{tStart:U,tEnd:V}=xe();return L(Z(R(),U,V,c))}};return ae}if(Ee())return g();let v=0,y=0,$=0,ye=false,he=false,Pe=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Ze(B,C,m),f=Le(i,i.scroll,Y(),A,F);v=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty(Pt,String(i));for(let f of M)e.style.setProperty(f.prop,Lt(f.from,f.to,i));ke?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&T?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,xe=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+xe*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let O=y===v?0:(f-v)/(y-v);re(O);let R=L(Z(f,v,y,ie));u&&(Pe=Math.max(Pe,R),R=Pe),te=R,z(R),R>=1&&!be?(be=true,j?.()):R<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===v&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(pe(),v,y,c));u&&i>0&&(Pe=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:C??null}),k;function E(){clearTimeout(k),k=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),Oe(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:v,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(k),ve(),Ie(e);},replay(){Pe=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Pe=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:_}=n,x=S!==void 0?g=>g.toFixed(S):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],ke=Se(m.start??"top 80%"),j=Se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=x(s),_?.(),at;let se=0,ee=0,T=0,W=false,L=false,A=-1,F=0,B=false,C=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),v=Le({top:g.top,height:g.height},C(),M(),ke,j);se=v.tStart,ee=v.tEnd;}function D(g){t.textContent=x(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(C(),se,ee,1));d&&(A=Math.max(A,g),g=A),F=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),T=requestAnimationFrame(de);}me();{let g=ne(Z(C(),se,ee,1));d&&g>0&&(A=g),F=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(v=>{W=v.isIntersecting,W&&!L?T=requestAnimationFrame(de):cancelAnimationFrame(T);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),ve.observe(t),Oe(t,{type:"counter",getProgress:()=>F,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(T),ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,F=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(T);},resume(){L&&(L=false,W&&(T=requestAnimationFrame(de)));},seek(g){let v=Math.min(1,Math.max(0,g));F=v,A=v,L=true,cancelAnimationFrame(T),D(v);},getProgress(){return F}}}function kt(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 or(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 Ot(e){let n=kt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function sr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ir(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 It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return It;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),It;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=Se(m.start??"top 85%"),ke=Se(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=or(t):l==="lines"?oe=Ot(t):oe=kt(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=ir($,u);ye&&(y.style.transform=ye);}function T(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=x(sr(y,ye,se,s));ee($,he);});}if(_)return T(1),S?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let W=0,L=0,A=0,F=false,B=false,C=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,ke);W=$.tStart,L=$.tEnd;}function ge(){if(!F||B)return;let y=Z(D(),W,L,1);d&&(C=Math.max(C,y),y=C),M=y,T(y),y>=1&&!me?(me=true,S?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}ve();let Ee=new IntersectionObserver(y=>{y.forEach($=>{F=$.isIntersecting,F&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function v(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=Ot(t),T(y);}ve();},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),Ee.observe(t),Oe(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){C=-1,me=false,M=0,B=false,T(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,F&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,C=$,B=true,cancelAnimationFrame(A),T($);},getProgress(){return M}}}function ar(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Ge(){return typeof document>"u"?null:document}function lr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function cr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Ct(n,r)}):[]}function ur(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Dt(n,r)}):[]}function mr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return Rt(n,r)}):[]}function Gr(e=Ge()){return {draw:lr(e),animate:cr(e),counter:ur(e),text:mr(e)}}exports.initAll=Gr;exports.initScrollAnimate=cr;exports.initScrollCounter=ur;exports.initScrollDraw=lr;exports.initScrollText=mr;exports.scrollDraw=ar;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,$t=/[MmLlHhVvCcSsQqTtAaZz]/g;function Qt(e,n,r){if(!Be)return;let t=(e.match($t)??[]).join("").toUpperCase(),l=(n.match($t)??[]).join("").toUpperCase(),s=(e.match(Mt)??[]).length,c=(n.match(Mt)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:_=0,direction:T="forward",once:ne=false,debug:Oe=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:x,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:R=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:Se=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:S,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Ce}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=ve(v.start??"top bottom"),He=ve(v.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(x)?x[0]:null,Y=Array.isArray(x)?x[1]:typeof x=="string"?x:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let O=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,k=false,F=false,N=0,Te=false,ae=-1,U=-1,V=false,le=0,Pe=0,Fe,tt=null;function lt(){tt?.destroy(),tt=null;}let Re=new Set,ct=NaN,Ne=true,je=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),Oe&&Be&&(lt(),tt=Jt(f,ie,j));}function nt(o,a=ft){ke(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function Nt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}O.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=Ve(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}O.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${E[a]}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(O.forEach(o=>{Xt(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Qt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?"0":`${a}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Ht(){return !(Ee===false||!Yt()||!O.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||R!==false||D||A||M||ee>0||g||S||y||$||ye||he||Ce||x!=null||W!=null||L!=null||(v.start??"top bottom").trim()!=="top bottom"||(v.end??"bottom top").trim()!=="bottom top")}function _t(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=T==="reverse"?"0":"var(--ssd-len)",$e=T==="reverse"?"var(--ssd-len)":"0",xe=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(xe+=`opacity:${T==="reverse"?1:0};`,w+=`opacity:${T==="reverse"?0:1};`);let C=document.createElement("style");C.setAttribute("data-svg-scroll-draw",""),C.textContent=`@keyframes ${a}{from{${xe}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(b);function Q(p,q){p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}O.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:q,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),q,we,u))}return {destroy(){e.classList.remove(b),O.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),C.remove();},replay(){h=false,I=-1,O.forEach(Q);},pause(){h=true,O.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,O.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let q=Math.min(1,Math.max(0,p));I=q,h=true,O.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=T==="reverse"?`${E[ce]*q}`:`${E[ce]*(1-q)}`,m&&(we.style.opacity=T==="reverse"?`${1-q}`:`${q}`);});},getProgress(){return H()},refresh(){O.forEach((p,q)=>{E[q]=ze(p),p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`;});}}}if(Ht())return nt(_t());function zt(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(T==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else O.forEach((H,p)=>{let q=p*_*o,we=Math.min(1,Math.max(0,(h-q)/o)),ce=be(we);H.style.strokeDashoffset=T==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=T==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=Ve(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let q in A){let we=parseFloat(q);p>=we&&!Re.has(we)&&(Re.add(we),A[q]?.());}}return I}function $e(h){if(V)return;let I=h-a;F||(F=true,S?.());let H=De(I);if(H&&!k){k=true,De(o*(1+Math.max(0,O.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{a=performance.now(),F=false,k=false,Re.clear(),Ue(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function xe(){cancelAnimationFrame(N),clearTimeout(Fe),a=performance.now(),b=0,V=false,F=false,k=false,Pe=0,J=true,le=0,Re.clear(),Ue(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&k)?xe():!I.isIntersecting&&!ne&&!k&&(cancelAnimationFrame(N),clearTimeout(Fe),J=false);});},{root:fe??null,threshold:B,rootMargin:P}),C;function Q(){clearTimeout(C),C=setTimeout(()=>{O.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Fe),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(C);},replay(){Pe=0,xe();},pause(){V||!J||(V=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){V&&(V=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,V=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(C),O.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(Se)return nt(zt());pt();function Ye(){if(!Te||V)return;let o=performance.now(),a=rt();if(!Ne&&R===false&&a===ct){N=requestAnimationFrame(Ye);return}Ne=false,ct=a;let b=u;if(R!==false){let w=o-ut,C=w>0?Math.abs(a-(je<0?a:je))/w:0;b=u*Math.max(.2,1+C*(typeof R=="number"?R:1)*.04);}je=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":T;U=a;let De=ie-f,$e=true,xe=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&xe>0?$?.():_e>0&&xe<=0&&Ce?.(),_e<1&&xe>=1?ye?.():_e>=1&&xe<1&&he?.()),_e=xe,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let C=J==="reverse"?1-w:w;e.style.clipPath=Me(C),g?.(w),!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),w>=1&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{ae=-1,F=false,k=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(k=false),N=requestAnimationFrame(Ye);return}if(O.forEach((w,C)=>{let Q=C*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[C]*h}`:`${E[C]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=Ve(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[C]&&w.setAttribute("d",it(i[C],D,h)),C===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let C in A){let Q=parseFloat(C);w>=Q&&!Re.has(Q)&&(Re.add(Q),A[C]?.());}}!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),$e&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{ae=-1,F=false,k=false,Re.clear(),Ue(),Ne=true;},me))):!$e&&!ne&&(k=false),N=requestAnimationFrame(Ye);}let ot=false;function Xe(){ot||(ot=true,N=requestAnimationFrame(function(){Ye();}));}function Je(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Te=a.isIntersecting,Te&&!V?(Ne=true,Xe()):Je();});},{root:fe??null,threshold:B,rootMargin:P});function gt(){O.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(gt,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)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Fe),Je(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),lt();},replay(){ae=-1,U=-1,je=-1,F=false,k=false,Pe=0,V=false,le=0,Re.clear(),clearTimeout(Fe),Ue(),Ne=true,Te&&Xe();},pause(){V=true,Je();},resume(){V&&(V=false,Ne=true,Te&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,V=true,Je(),Nt(a,T),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Qe),gt(),Te&&!V&&Xe();}},()=>({tStart:f,tEnd:ie}))}function Zt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Kt(e,n,r){let t=Lt(e),l=Lt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Ct(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Zt(t))return Ve(t,l,r);if(t.includes("("))return Kt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Pt="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:_=false,respectReducedMotion:T=true,triggerElement:ne,onProgress:Oe,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:x}=n,W=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=ve(l.start??"top bottom"),R=ve(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:er(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),Pt])de.set(i,e.style.getPropertyValue(i));function Se(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:Se,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!v||!nr()||!ge||m!=="y"||P||B!==e||u||c!==1||Oe||j||oe||se||ee||x||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!tr.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++rr}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(i);let F=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,Te=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},F(),N(),A,R)};ke(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:Te});let ae={destroy(){e.classList.remove(i),k.remove(),e.style.animationPlayState="",Se(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let V=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Ct(le.from,le.to,V));},getProgress(){let{tStart:U,tEnd:V}=Te();return L(Z(F(),U,V,c))}};return ae}if(Ee())return g();let S=0,y=0,$=0,ye=false,he=false,Ce=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Ze(B,P,m),f=Le(i,i.scroll,Y(),A,R);S=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty(Pt,String(i));for(let f of M)e.style.setProperty(f.prop,Ct(f.from,f.to,i));Oe?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&x?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,Te=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+Te*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let k=y===S?0:(f-S)/(y-S);re(k);let F=L(Z(f,S,y,ie));u&&(Ce=Math.max(Ce,F),F=Ce),te=F,z(F),F>=1&&!be?(be=true,j?.()):F<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===S&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(pe(),S,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:P??null}),O;function E(){clearTimeout(O),O=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),ke(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:S,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(O),Se(),Ie(e);},replay(){Ce=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:v,onComplete:_}=n,T=v!==void 0?g=>g.toFixed(v):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],Oe=ve(m.start??"top 80%"),j=ve(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=T(s),_?.(),at;let se=0,ee=0,x=0,W=false,L=false,A=-1,R=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),S=Le({top:g.top,height:g.height},P(),M(),Oe,j);se=S.tStart,ee=S.tEnd;}function D(g){t.textContent=T(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),R=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),x=requestAnimationFrame(de);}me();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),R=g,D(g);}let Se=new IntersectionObserver(g=>{g.forEach(S=>{W=S.isIntersecting,W&&!L?x=requestAnimationFrame(de):cancelAnimationFrame(x);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),Se.observe(t),ke(t,{type:"counter",getProgress:()=>R,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(x),Se.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,R=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(x);},resume(){L&&(L=false,W&&(x=requestAnimationFrame(de)));},seek(g){let S=Math.min(1,Math.max(0,g));R=S,A=S,L=true,cancelAnimationFrame(x),D(S);},getProgress(){return R}}}function Ft(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 or(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 It(e){let n=Ft(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let v=m.nextElementSibling;u.appendChild(m),d<c.length-1&&v&&v.style.whiteSpace==="pre"&&u.appendChild(v);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function sr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ir(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 Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Ot;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:v}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,T=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=ve(m.start??"top 85%"),Oe=ve(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=or(t):l==="lines"?oe=It(t):oe=Ft(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=ir($,u);ye&&(y.style.transform=ye);}function x(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=T(sr(y,ye,se,s));ee($,he);});}if(_)return x(1),v?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let W=0,L=0,A=0,R=false,B=false,P=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function Se(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,Oe);W=$.tStart,L=$.tEnd;}function ge(){if(!R||B)return;let y=Z(D(),W,L,1);d&&(P=Math.max(P,y),y=P),M=y,x(y),y>=1&&!me?(me=true,v?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}Se();let Ee=new IntersectionObserver(y=>{y.forEach($=>{R=$.isIntersecting,R&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function S(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=It(t),x(y);}Se();},150);}return window.addEventListener("resize",S),window.addEventListener("orientationchange",S),Ee.observe(t),ke(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("orientationchange",S),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,me=false,M=0,B=false,x(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,R&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,P=$,B=true,cancelAnimationFrame(A),x($);},getProgress(){return M}}}function ar(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Ge(){return typeof document>"u"?null:document}function lr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function cr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Dt(n,r)}):[]}function ur(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),kt(n,r)}):[]}function mr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return Rt(n,r)}):[]}function an(e=Ge()){return {draw:lr(e),animate:cr(e),counter:ur(e),text:mr(e)}}exports.initAll=an;exports.initScrollAnimate=cr;exports.initScrollCounter=ur;exports.initScrollDraw=lr;exports.initScrollText=mr;exports.scrollDraw=ar;
|
package/dist/astro/index.d.mts
CHANGED
|
@@ -1,150 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
start?: string;
|
|
5
|
-
end?: string;
|
|
6
|
-
}
|
|
7
|
-
interface ScrollDrawOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Apply a named preset as the base configuration. User-supplied options
|
|
10
|
-
* always override the preset. Available presets:
|
|
11
|
-
* - `'sketch'` — staggered ease-in draw, pencil feel
|
|
12
|
-
* - `'reveal'` — fade + ease-out, draws once on viewport entry
|
|
13
|
-
* - `'typewriter'` — fast linear draw with stagger
|
|
14
|
-
* - `'cinematic'` — slow ease-in-out with fade, dramatic entrance
|
|
15
|
-
* - `'spring'` — spring easing, bouncy organic feel
|
|
16
|
-
*/
|
|
17
|
-
preset?: PresetName;
|
|
18
|
-
selector?: string;
|
|
19
|
-
speed?: number;
|
|
20
|
-
fade?: boolean;
|
|
21
|
-
easing?: EasingName | ((t: number) => number);
|
|
22
|
-
trigger?: TriggerConfig;
|
|
23
|
-
stagger?: number;
|
|
24
|
-
direction?: 'forward' | 'reverse';
|
|
25
|
-
once?: boolean;
|
|
26
|
-
debug?: boolean;
|
|
27
|
-
/** Scroll axis to track. 'y' (default) for vertical, 'x' for horizontal. */
|
|
28
|
-
axis?: 'x' | 'y';
|
|
29
|
-
/** CSS selector or Element for a custom scroll container (default: window). */
|
|
30
|
-
scrollContainer?: string | Element;
|
|
31
|
-
/** Automatically reverse the animation when the user scrolls back up. */
|
|
32
|
-
autoReverse?: boolean;
|
|
33
|
-
/** Delay in milliseconds before the engine starts observing. */
|
|
34
|
-
delay?: number;
|
|
35
|
-
/** Animate stroke color. Single string = static override. Tuple = interpolate from → to. */
|
|
36
|
-
strokeColor?: string | [string, string];
|
|
37
|
-
/** Animate stroke width. Single number = static override. Tuple = interpolate from → to. */
|
|
38
|
-
strokeWidth?: number | [number, number];
|
|
39
|
-
/** 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. */
|
|
40
|
-
fillOpacity?: number | [number, number];
|
|
41
|
-
/**
|
|
42
|
-
* Reveal the container using CSS clip-path instead of stroke-dashoffset.
|
|
43
|
-
* Works on any content — SVG, images, text, divs.
|
|
44
|
-
*
|
|
45
|
-
* Pass a direction string to control which edge the reveal starts from,
|
|
46
|
-
* or `true` as shorthand for `'left'`.
|
|
47
|
-
*
|
|
48
|
-
* Values: `'left' | 'right' | 'top' | 'bottom' | 'center'`
|
|
49
|
-
*/
|
|
50
|
-
clip?: boolean | 'left' | 'right' | 'top' | 'bottom' | 'center';
|
|
51
|
-
/** Fire callbacks at specific progress thresholds (0–1). Resets on replay(). */
|
|
52
|
-
waypoints?: Record<number, () => void>;
|
|
53
|
-
/** Scale animation speed by scroll velocity — faster scrolling = faster draw. Pass a number to control sensitivity (default 1). */
|
|
54
|
-
velocityScale?: boolean | number;
|
|
55
|
-
/** IntersectionObserver threshold (0–1). Default 0. */
|
|
56
|
-
threshold?: number;
|
|
57
|
-
/** IntersectionObserver rootMargin. Default "0px". */
|
|
58
|
-
rootMargin?: string;
|
|
59
|
-
/** Repeat the animation N times after completion. Use 'infinite' to loop forever. */
|
|
60
|
-
repeat?: number | 'infinite';
|
|
61
|
-
/** Milliseconds to wait between repeats. Default 0. */
|
|
62
|
-
repeatDelay?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Target path `d` attribute to morph toward as the animation progresses.
|
|
65
|
-
* Paths must have compatible command structures (same number of numeric tokens).
|
|
66
|
-
*
|
|
67
|
-
* Only applies to `<path>` elements — silently no-ops on `<rect>`, `<circle>`,
|
|
68
|
-
* `<line>`, and other SVG shape elements.
|
|
69
|
-
*/
|
|
70
|
-
morphTo?: string;
|
|
71
|
-
onProgress?: (alpha: number) => void;
|
|
72
|
-
onStart?: () => void;
|
|
73
|
-
onComplete?: () => void;
|
|
74
|
-
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
75
|
-
onEnter?: () => void;
|
|
76
|
-
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
77
|
-
onLeave?: () => void;
|
|
78
|
-
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
79
|
-
onEnterBack?: () => void;
|
|
80
|
-
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
81
|
-
onLeaveBack?: () => void;
|
|
82
|
-
/**
|
|
83
|
-
* Trigger the animation when the element enters the viewport instead of
|
|
84
|
-
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
85
|
-
* replaying each time the element re-enters the viewport (use `once: true`
|
|
86
|
-
* to play only the first time).
|
|
87
|
-
*
|
|
88
|
-
* All visual options work in autoplay mode — `easing`, `stagger`, `fade`,
|
|
89
|
-
* `strokeColor`, `strokeWidth`, `fillOpacity`, `clip`, `morphTo`, `waypoints`,
|
|
90
|
-
* `repeat`, `repeatDelay`, `onStart`, `onComplete`, `onProgress`, etc.
|
|
91
|
-
*
|
|
92
|
-
* The full instance API (`pause`, `resume`, `seek`, `replay`, `getProgress`)
|
|
93
|
-
* also works — `seek(0.5)` pauses at 50% of the duration.
|
|
94
|
-
*/
|
|
95
|
-
autoplay?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Duration of the autoplay animation in milliseconds. Only used when
|
|
98
|
-
* `autoplay: true`. Default `1000`.
|
|
99
|
-
*/
|
|
100
|
-
duration?: number;
|
|
101
|
-
/**
|
|
102
|
-
* Use the browser's native CSS scroll-driven animation
|
|
103
|
-
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
104
|
-
* the browser supports it. The browser drives the draw from the scroll
|
|
105
|
-
* position — zero per-frame JavaScript, zero scroll/resize listeners. (It
|
|
106
|
-
* still repaints on the main thread: browsers don't composite
|
|
107
|
-
* `stroke-dashoffset`.)
|
|
108
|
-
*
|
|
109
|
-
* Falls back to the JS engine automatically when unsupported or when the
|
|
110
|
-
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|
|
111
|
-
* velocity scaling, custom triggers, `once`, custom easing functions, etc.).
|
|
112
|
-
*
|
|
113
|
-
* - `undefined` / `true` (default): use native when eligible.
|
|
114
|
-
* - `false`: always use the JS engine.
|
|
115
|
-
*/
|
|
116
|
-
native?: boolean;
|
|
117
|
-
}
|
|
118
|
-
interface ScrollDrawInstance {
|
|
119
|
-
destroy: () => void;
|
|
120
|
-
/** Reset and replay the animation from the beginning. */
|
|
121
|
-
replay: () => void;
|
|
122
|
-
/** Pause the animation at the current progress. */
|
|
123
|
-
pause: () => void;
|
|
124
|
-
/** Resume a paused animation. */
|
|
125
|
-
resume: () => void;
|
|
126
|
-
/** Jump to a specific progress value (0–1) and pause. */
|
|
127
|
-
seek: (progress: number) => void;
|
|
128
|
-
/** Returns current draw progress (0–1). */
|
|
129
|
-
getProgress: () => number;
|
|
130
|
-
/**
|
|
131
|
-
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
132
|
-
*
|
|
133
|
-
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
134
|
-
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
135
|
-
* change that leaves the document height alone, such as a tab switching, a
|
|
136
|
-
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
137
|
-
* after one of those.
|
|
138
|
-
*
|
|
139
|
-
* Optional on this shared type because several instances here are fan-outs over
|
|
140
|
-
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
141
|
-
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
142
|
-
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
143
|
-
*/
|
|
144
|
-
refresh?: () => void;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-DHU1zNEw.mjs';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-DHU1zNEw.mjs';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-CNlq4Z_L.mjs';
|
|
148
4
|
|
|
149
5
|
/**
|
|
150
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
|
@@ -232,4 +88,4 @@ declare function initAll(root?: Element | Document | null): {
|
|
|
232
88
|
text: ScrollDrawInstance[];
|
|
233
89
|
};
|
|
234
90
|
|
|
235
|
-
export {
|
|
91
|
+
export { ScrollDrawInstance, initAll, initScrollAnimate, initScrollCounter, initScrollDraw, initScrollText };
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -1,150 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
start?: string;
|
|
5
|
-
end?: string;
|
|
6
|
-
}
|
|
7
|
-
interface ScrollDrawOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Apply a named preset as the base configuration. User-supplied options
|
|
10
|
-
* always override the preset. Available presets:
|
|
11
|
-
* - `'sketch'` — staggered ease-in draw, pencil feel
|
|
12
|
-
* - `'reveal'` — fade + ease-out, draws once on viewport entry
|
|
13
|
-
* - `'typewriter'` — fast linear draw with stagger
|
|
14
|
-
* - `'cinematic'` — slow ease-in-out with fade, dramatic entrance
|
|
15
|
-
* - `'spring'` — spring easing, bouncy organic feel
|
|
16
|
-
*/
|
|
17
|
-
preset?: PresetName;
|
|
18
|
-
selector?: string;
|
|
19
|
-
speed?: number;
|
|
20
|
-
fade?: boolean;
|
|
21
|
-
easing?: EasingName | ((t: number) => number);
|
|
22
|
-
trigger?: TriggerConfig;
|
|
23
|
-
stagger?: number;
|
|
24
|
-
direction?: 'forward' | 'reverse';
|
|
25
|
-
once?: boolean;
|
|
26
|
-
debug?: boolean;
|
|
27
|
-
/** Scroll axis to track. 'y' (default) for vertical, 'x' for horizontal. */
|
|
28
|
-
axis?: 'x' | 'y';
|
|
29
|
-
/** CSS selector or Element for a custom scroll container (default: window). */
|
|
30
|
-
scrollContainer?: string | Element;
|
|
31
|
-
/** Automatically reverse the animation when the user scrolls back up. */
|
|
32
|
-
autoReverse?: boolean;
|
|
33
|
-
/** Delay in milliseconds before the engine starts observing. */
|
|
34
|
-
delay?: number;
|
|
35
|
-
/** Animate stroke color. Single string = static override. Tuple = interpolate from → to. */
|
|
36
|
-
strokeColor?: string | [string, string];
|
|
37
|
-
/** Animate stroke width. Single number = static override. Tuple = interpolate from → to. */
|
|
38
|
-
strokeWidth?: number | [number, number];
|
|
39
|
-
/** 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. */
|
|
40
|
-
fillOpacity?: number | [number, number];
|
|
41
|
-
/**
|
|
42
|
-
* Reveal the container using CSS clip-path instead of stroke-dashoffset.
|
|
43
|
-
* Works on any content — SVG, images, text, divs.
|
|
44
|
-
*
|
|
45
|
-
* Pass a direction string to control which edge the reveal starts from,
|
|
46
|
-
* or `true` as shorthand for `'left'`.
|
|
47
|
-
*
|
|
48
|
-
* Values: `'left' | 'right' | 'top' | 'bottom' | 'center'`
|
|
49
|
-
*/
|
|
50
|
-
clip?: boolean | 'left' | 'right' | 'top' | 'bottom' | 'center';
|
|
51
|
-
/** Fire callbacks at specific progress thresholds (0–1). Resets on replay(). */
|
|
52
|
-
waypoints?: Record<number, () => void>;
|
|
53
|
-
/** Scale animation speed by scroll velocity — faster scrolling = faster draw. Pass a number to control sensitivity (default 1). */
|
|
54
|
-
velocityScale?: boolean | number;
|
|
55
|
-
/** IntersectionObserver threshold (0–1). Default 0. */
|
|
56
|
-
threshold?: number;
|
|
57
|
-
/** IntersectionObserver rootMargin. Default "0px". */
|
|
58
|
-
rootMargin?: string;
|
|
59
|
-
/** Repeat the animation N times after completion. Use 'infinite' to loop forever. */
|
|
60
|
-
repeat?: number | 'infinite';
|
|
61
|
-
/** Milliseconds to wait between repeats. Default 0. */
|
|
62
|
-
repeatDelay?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Target path `d` attribute to morph toward as the animation progresses.
|
|
65
|
-
* Paths must have compatible command structures (same number of numeric tokens).
|
|
66
|
-
*
|
|
67
|
-
* Only applies to `<path>` elements — silently no-ops on `<rect>`, `<circle>`,
|
|
68
|
-
* `<line>`, and other SVG shape elements.
|
|
69
|
-
*/
|
|
70
|
-
morphTo?: string;
|
|
71
|
-
onProgress?: (alpha: number) => void;
|
|
72
|
-
onStart?: () => void;
|
|
73
|
-
onComplete?: () => void;
|
|
74
|
-
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
75
|
-
onEnter?: () => void;
|
|
76
|
-
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
77
|
-
onLeave?: () => void;
|
|
78
|
-
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
79
|
-
onEnterBack?: () => void;
|
|
80
|
-
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
81
|
-
onLeaveBack?: () => void;
|
|
82
|
-
/**
|
|
83
|
-
* Trigger the animation when the element enters the viewport instead of
|
|
84
|
-
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
85
|
-
* replaying each time the element re-enters the viewport (use `once: true`
|
|
86
|
-
* to play only the first time).
|
|
87
|
-
*
|
|
88
|
-
* All visual options work in autoplay mode — `easing`, `stagger`, `fade`,
|
|
89
|
-
* `strokeColor`, `strokeWidth`, `fillOpacity`, `clip`, `morphTo`, `waypoints`,
|
|
90
|
-
* `repeat`, `repeatDelay`, `onStart`, `onComplete`, `onProgress`, etc.
|
|
91
|
-
*
|
|
92
|
-
* The full instance API (`pause`, `resume`, `seek`, `replay`, `getProgress`)
|
|
93
|
-
* also works — `seek(0.5)` pauses at 50% of the duration.
|
|
94
|
-
*/
|
|
95
|
-
autoplay?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Duration of the autoplay animation in milliseconds. Only used when
|
|
98
|
-
* `autoplay: true`. Default `1000`.
|
|
99
|
-
*/
|
|
100
|
-
duration?: number;
|
|
101
|
-
/**
|
|
102
|
-
* Use the browser's native CSS scroll-driven animation
|
|
103
|
-
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
104
|
-
* the browser supports it. The browser drives the draw from the scroll
|
|
105
|
-
* position — zero per-frame JavaScript, zero scroll/resize listeners. (It
|
|
106
|
-
* still repaints on the main thread: browsers don't composite
|
|
107
|
-
* `stroke-dashoffset`.)
|
|
108
|
-
*
|
|
109
|
-
* Falls back to the JS engine automatically when unsupported or when the
|
|
110
|
-
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|
|
111
|
-
* velocity scaling, custom triggers, `once`, custom easing functions, etc.).
|
|
112
|
-
*
|
|
113
|
-
* - `undefined` / `true` (default): use native when eligible.
|
|
114
|
-
* - `false`: always use the JS engine.
|
|
115
|
-
*/
|
|
116
|
-
native?: boolean;
|
|
117
|
-
}
|
|
118
|
-
interface ScrollDrawInstance {
|
|
119
|
-
destroy: () => void;
|
|
120
|
-
/** Reset and replay the animation from the beginning. */
|
|
121
|
-
replay: () => void;
|
|
122
|
-
/** Pause the animation at the current progress. */
|
|
123
|
-
pause: () => void;
|
|
124
|
-
/** Resume a paused animation. */
|
|
125
|
-
resume: () => void;
|
|
126
|
-
/** Jump to a specific progress value (0–1) and pause. */
|
|
127
|
-
seek: (progress: number) => void;
|
|
128
|
-
/** Returns current draw progress (0–1). */
|
|
129
|
-
getProgress: () => number;
|
|
130
|
-
/**
|
|
131
|
-
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
132
|
-
*
|
|
133
|
-
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
134
|
-
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
135
|
-
* change that leaves the document height alone, such as a tab switching, a
|
|
136
|
-
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
137
|
-
* after one of those.
|
|
138
|
-
*
|
|
139
|
-
* Optional on this shared type because several instances here are fan-outs over
|
|
140
|
-
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
141
|
-
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
142
|
-
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
143
|
-
*/
|
|
144
|
-
refresh?: () => void;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-DHU1zNEw.js';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-DHU1zNEw.js';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-BlJfbTDv.js';
|
|
148
4
|
|
|
149
5
|
/**
|
|
150
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
|
@@ -232,4 +88,4 @@ declare function initAll(root?: Element | Document | null): {
|
|
|
232
88
|
text: ScrollDrawInstance[];
|
|
233
89
|
};
|
|
234
90
|
|
|
235
|
-
export {
|
|
91
|
+
export { ScrollDrawInstance, initAll, initScrollAnimate, initScrollCounter, initScrollDraw, initScrollText };
|