svg-scroll-draw 2.17.0 → 2.18.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 +3 -2
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +5 -2
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/{chunk-ZZCTLVGT.mjs → chunk-CTVQDBD3.mjs} +1 -1
- package/dist/{chunk-OWMO2S3V.mjs → chunk-DIMNQPW5.mjs} +1 -1
- package/dist/chunk-LINFV2GK.mjs +3 -0
- package/dist/chunk-TIRZOSQ4.mjs +1 -0
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +11 -0
- package/dist/video/index.d.ts +11 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-JC5BD4RB.mjs +0 -1
- package/dist/chunk-WDIHLRZZ.mjs +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Pt({bounces:e=3,decay:r=.5}={}){let s=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),c=Math.sqrt(n),f=0,g=[];for(let v=0;v<s;v++){let $=Math.pow(c,v);g.push($),f+=$;}let w=[0],E=0;for(let v=0;v<s;v++)E+=g[v]/f,w.push(E);return v=>{if(v<=0)return 0;if(v>=1)return 1;for(let $=0;$<s;$++)if(v<=w[$+1]){let B=(v-w[$])/(w[$+1]-w[$]);if($===0)return B*(2-B);let h=1-Math.pow(n,$);return h+(1-h)*(2*B-1)*(2*B-1)}return 1}}function Ct({amplitude:e=1,period:r=.4}={}){let s=Math.max(1,e),n=Math.max(.1,r),c=s<=1?n/4:n/(2*Math.PI)*Math.asin(1/s);return f=>f<=0?0:f>=1?1:s*Math.pow(2,-10*f)*Math.sin((f-c)*(2*Math.PI)/n)+1}var Ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Pt(),elastic:Ct()};function it(e,r,s){return Math.min(s,Math.max(r,e))}function He(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[s="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:s,viewport:n}}function at(e,r,s,n){switch(n){case "top":return e+s;case "center":return e+s+r/2;case "bottom":return e+s+r;default:return e+s}}function lt(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 ue(e,r,s,n){return s===r?0:it((e-r)/(s-r)*n,0,1)}function We(e,r,s,n,c){let f=at(e.top,e.height,r,n.element)-lt(n.viewport,s),g=at(e.top,e.height,r,c.element)-lt(c.viewport,s);return {tStart:f,tEnd:g}}function ut(e,r,s){let n=e.getBoundingClientRect(),c=s==="x"?n.width:n.height;return r?{top:s==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:c,scroll:0}:{top:s==="x"?n.left:n.top,height:c,scroll:s==="x"?window.scrollX:window.scrollY}}function pe(e){let r=e.tagName.toLowerCase();if(r==="rect"){let s=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(s+n)}if(r==="circle"){let s=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*s}return e.getTotalLength()}function ct(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let s=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(s)return [parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function Ce(e,r,s){let n=ct(e),c=ct(r);return !n||!c?e:`rgb(${Math.round(n[0]+(c[0]-n[0])*s)},${Math.round(n[1]+(c[1]-n[1])*s)},${Math.round(n[2]+(c[2]-n[2])*s)})`}var ft={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Se=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function de(e,...r){Se&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Ot="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Rt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",mt=33;function It(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function _t(e){let r=[];for(let s=0;s<mt;s++){let n=s/(mt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function pt(e){switch(e){case "linear":return "linear";case "ease-in":return Ot;case "ease-out":return Rt;case "ease-in-out":return It()?_t(Ee["ease-in-out"]):null;default:return null}}var dt=Symbol.for("svg-scroll-draw.registry");function yt(){let e=globalThis;return e[dt]||(e[dt]=new Map)}function gt(e,r){yt().set(e,r);}function ht(e){yt().delete(e);}var Ft=0;function Nt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function bt(e,r){let s="";try{s=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return s||(e.getAttribute(r)??"").trim()}var wt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Vt(e){if(!Se)return;let r=bt(e,"stroke");if(!r||r==="none"){de("Element has no stroke \u2014 path will not be visible.",e);return}let s=(e.getAttribute("fill")??"").trim();s&&!wt.has(s)&&!wt.has(bt(e,"fill"))&&de("Element has a fill \u2014 it may obscure the stroke animation.",e);}function zt(e,r,s){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.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 c(){let f=s==="x"?window.scrollX:window.scrollY,g=e-f,w=r-f,E=s==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${E?`left:${g}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${g}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;${E?`left:${w}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${w}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(n),window.addEventListener("scroll",c,{passive:true}),c(),{el:n,destroy(){window.removeEventListener("scroll",c),n.remove();}}}var wt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,vt=/[MmLlHhVvCcSsQqTtAaZz]/g;function zt(e,r,s){if(!Ee)return;let n=(e.match(vt)??[]).join("").toUpperCase(),c=(r.match(vt)??[]).join("").toUpperCase(),f=(e.match(wt)??[]).length,g=(r.match(wt)??[]).length;if(n!==c){de(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${c||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,s);return}f!==g&&de(`morphTo: coordinate count differs (${f} \u2192 ${g}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,s);}function We(e,r,s){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),c=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,f=>{let g=parseFloat(f),w=n[c++]??g;return String(+(g+(w-g)*s).toFixed(4))})}function Et(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...n}=r,c=s?{...ct[s],...n}:n,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:g="path, polyline, line, polygon, rect, circle",speed:w=1,fade:E=false,easing:v="linear",trigger:$={},stagger:U=0,direction:h="forward",once:ee=false,debug:St=false,axis:te="y",scrollContainer:Ce,autoReverse:Se=false,delay:ye=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ge=false,threshold:Ge=0,rootMargin:qe="0px",repeat:ie=0,repeatDelay:Oe=0,morphTo:I,clip:Re,autoplay:$t=false,duration:xt=1e3,native:Tt=true,onProgress:he,onStart:$e,onComplete:ce,onEnter:Be,onLeave:Ue,onEnterBack:je,onLeaveBack:Qe}=c,Y=Re===true?"left":typeof Re=="string"?Re:false,ae=typeof v=="function"?v:ve[v]??ve.linear,Xe=ze($.start??"top bottom"),Ye=ze($.end??"bottom top"),z=typeof Ce=="string"?document.querySelector(Ce):Ce??null,H=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,O=Array.isArray(ne)?ne[0]:null,D=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,P=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let o=t*100;switch(Y){case "right":return `inset(0 0 0 ${100-o}%)`;case "top":return `inset(0 0 ${100-o}% 0)`;case "bottom":return `inset(${100-o}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-o}% 0 0)`}}let S=Y?[]:Array.from(e.querySelectorAll(g)),p=[],_=[],W=0,j=0,A=false,N=false,M=0,fe=false,G=-1,xe=-1,k=false,q=0,Q=0,K,Ie=null;function Ke(){Ie?.destroy(),Ie=null;}let Z=new Set,Ze=NaN,J=true,Te=-1,Je=performance.now(),me=NaN;function _e(){return z?te==="x"?z.scrollLeft:z.scrollTop:te==="x"?window.scrollX:window.scrollY}function et(){return z?te==="x"?z.clientWidth:z.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function tt(){let t=lt(e,z,te);return He(t,t.scroll,et(),Xe,Ye)}function rt(){(({tStart:W,tEnd:j}=tt())),St&&Ee&&(Ke(),Ie=Vt(W,j,te));}function Fe(t,o=tt){yt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let l=t.destroy;return t.destroy=()=>{l.call(t),gt(e);},t}function At(t,o){if(e.style.setProperty("--scroll-draw-progress",String(t)),Y){let l=o==="reverse"?1-t:t;e.style.clipPath=le(l);return}S.forEach((l,x)=>{l.style.strokeDashoffset=o==="reverse"?`${p[x]*t}`:`${p[x]*(1-t)}`,E&&(l.style.opacity=o==="reverse"?`${1-t}`:`${t}`),H&&L?l.style.stroke=Pe(H,L,t):L&&(l.style.stroke=L),O!==null&&D!==null?l.style.strokeWidth=`${O+(D-O)*t}`:D!==null&&(l.style.strokeWidth=`${D}`),R!==null&&P!==null?l.style.fillOpacity=`${R+(P-R)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),I&&l.tagName.toLowerCase()==="path"&&_[x]&&l.setAttribute("d",We(_[x],I,t));});}function Ae(){if(e.style.setProperty("--scroll-draw-progress","0"),Y){e.style.clipPath=le(0);return}S.forEach((t,o)=>{t.style.strokeDasharray=`${p[o]}`,t.style.strokeDashoffset=h==="reverse"?"0":`${p[o]}`,E?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`),I&&t.tagName.toLowerCase()==="path"&&_[o]&&t.setAttribute("d",_[o]);});}if(S.forEach(t=>{Nt(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),I&&(l?zt(_[_.length-1],I,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),f?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?`${o}`:"0",E&&(t.style.opacity="1"),L&&(t.style.stroke=L),D!==null&&(t.style.strokeWidth=`${D}`),P!==null&&(t.style.fillOpacity=`${P}`),I&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",I)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?"0":`${o}`,E?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`));}),Y){if(f)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(f)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let nt=typeof v=="string"?mt(v):null;function Mt(){return !(Tt===false||!Ft()||!S.length||!nt||Y||te!=="y"||z||w!==1||U!==0||ee||Se||ge!==false||I||oe||ie||ye>0||he||$e||ce||Be||Ue||je||Qe||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function kt(){let t=++_t,o=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,x=`--svg-scroll-draw-${t}`,X=h==="reverse"?"0":"var(--ssd-len)",B=h==="reverse"?"var(--ssd-len)":"0",V=`stroke-dashoffset:${X};`,u=`stroke-dashoffset:${B};`;E&&(V+=`opacity:${h==="reverse"?1:0};`,u+=`opacity:${h==="reverse"?0:1};`);let m=document.createElement("style");m.setAttribute("data-svg-scroll-draw",""),m.textContent=`@keyframes ${o}{from{${V}}to{${u}}}.${l}{view-timeline-name:${x};view-timeline-axis:block;}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${nt};animation-fill-mode:both;animation-timeline:${x};animation-range:cover 0% cover 100%;}`,document.head.appendChild(m),e.classList.add(l);function T(i,b){i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`,i.style.strokeDashoffset="",i.style.opacity="",i.style.animationPlayState="",i.classList.add(o);}S.forEach(T);let a=false,d=-1;function y(){if(d>=0)return d;let i=e.getBoundingClientRect(),{tStart:b,tEnd:F}=He({top:i.top,height:i.height},_e(),et(),Xe,Ye);return ae(ue(_e(),b,F,w))}return {destroy(){e.classList.remove(l),S.forEach(i=>{i.classList.remove(o),i.style.removeProperty("--ssd-len"),i.style.animationPlayState="";}),m.remove();},replay(){a=false,d=-1,S.forEach(T);},pause(){a=true,S.forEach(i=>{i.style.animationPlayState="paused";});},resume(){a&&(a=false,S.forEach(i=>{i.style.animationPlayState="running";}));},seek(i){let b=Math.min(1,Math.max(0,i));d=b,a=true,S.forEach((F,C)=>{F.classList.remove(o),F.style.strokeDashoffset=h==="reverse"?`${p[C]*b}`:`${p[C]*(1-b)}`,E&&(F.style.opacity=h==="reverse"?`${1-b}`:`${b}`);});},getProgress(){return y()},refresh(){S.forEach((i,b)=>{p[b]=pe(i),i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`;});}}}if(Mt())return Fe(kt());function Lt(){let t=Math.max(1,xt),o=0,l=0,x=false;function X(a){let d=true;if(Y){let y=Math.min(1,Math.max(0,a/t)),i=ae(y);q=i,e.style.setProperty("--scroll-draw-progress",String(i)),e.style.clipPath=le(h==="reverse"?1-i:i),he?.(i),y<1&&(d=false);}else S.forEach((y,i)=>{let b=i*U*t,F=Math.min(1,Math.max(0,(a-b)/t)),C=ae(F);y.style.strokeDashoffset=h==="reverse"?`${p[i]*C}`:`${p[i]*(1-C)}`,E&&(y.style.opacity=h==="reverse"?`${1-C}`:`${C}`),H&&L?y.style.stroke=Pe(H,L,C):L&&(y.style.stroke=L),O!==null&&D!==null?y.style.strokeWidth=`${O+(D-O)*C}`:D!==null&&(y.style.strokeWidth=`${D}`),R!==null&&P!==null?y.style.fillOpacity=`${R+(P-R)*C}`:P!==null&&(y.style.fillOpacity=`${P}`),I&&y.tagName.toLowerCase()==="path"&&_[i]&&y.setAttribute("d",We(_[i],I,C)),i===0&&(q=C,he?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),F<1&&(d=false);});if(oe){let y=Math.min(1,Math.max(0,a/t)),i=ae(y);for(let b in oe){let F=parseFloat(b);i>=F&&!Z.has(F)&&(Z.add(F),oe[b]?.());}}return d}function B(a){if(k)return;let d=a-o;N||(N=true,$e?.());let y=X(d);if(y&&!A){A=true,X(t*(1+Math.max(0,S.length-1)*U)),ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{o=performance.now(),N=false,A=false,Z.clear(),Ae(),M=requestAnimationFrame(B);},Oe));return}y||(M=requestAnimationFrame(B));}function V(){cancelAnimationFrame(M),clearTimeout(K),o=performance.now(),l=0,k=false,N=false,A=false,Q=0,x=true,q=0,Z.clear(),Ae(),M=requestAnimationFrame(B);}let u=new IntersectionObserver(a=>{a.forEach(d=>{d.isIntersecting&&!(ee&&A)?V():!d.isIntersecting&&!ee&&!A&&(cancelAnimationFrame(M),clearTimeout(K),x=false);});},{root:z??null,threshold:Ge,rootMargin:qe}),m;function T(){clearTimeout(m),m=setTimeout(()=>{S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ye>0?setTimeout(()=>u.observe(e),ye):u.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(K),u.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(m);},replay(){Q=0,V();},pause(){k||!x||(k=true,l=performance.now()-o,cancelAnimationFrame(M));},resume(){k&&(k=false,x=true,o=performance.now()-l,M=requestAnimationFrame(B));},seek(a){let d=Math.min(1,Math.max(0,a));q=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),X(l);},getProgress(){return q},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if($t)return Fe(Lt());rt();function Me(){if(!fe||k)return;let t=performance.now(),o=_e();if(!J&&ge===false&&o===Ze){M=requestAnimationFrame(Me);return}J=false,Ze=o;let l=w;if(ge!==false){let u=t-Je,m=u>0?Math.abs(o-(Te<0?o:Te))/u:0;l=w*Math.max(.2,1+m*(typeof ge=="number"?ge:1)*.04);}Te=o,Je=t;let x=Se?xe===-1||o>=xe?"forward":"reverse":h;xe=o;let X=j-W,B=true,V=X===0?0:(o-W)/X;if(isNaN(me)||(me<=0&&V>0?Be?.():me>0&&V<=0&&Qe?.(),me<1&&V>=1?Ue?.():me>=1&&V<1&&je?.()),me=V,Y){let u=ae(ue(o,W,j,l));ee&&!Se&&(G=Math.max(G,u),u=G),q=u,e.style.setProperty("--scroll-draw-progress",String(u));let m=x==="reverse"?1-u:u;e.style.clipPath=le(m),he?.(u),!N&&ue(o,W,j,l)>0&&(N=true,$e?.()),u>=1&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{G=-1,N=false,A=false,e.style.clipPath=le(0);},Oe))):u<1&&!ee&&(A=false),M=requestAnimationFrame(Me);return}if(S.forEach((u,m)=>{let T=m*U*X,a=ae(ue(o,W+T,j+T,l));ee&&!Se&&(G=Math.max(G,a),a=G),q=a,u.style.strokeDashoffset=x==="reverse"?`${p[m]*a}`:`${p[m]*(1-a)}`,E&&(u.style.opacity=x==="reverse"?`${1-a}`:`${a}`),H&&L?u.style.stroke=Pe(H,L,a):L&&(u.style.stroke=L),O!==null&&D!==null?u.style.strokeWidth=`${O+(D-O)*a}`:D!==null&&(u.style.strokeWidth=`${D}`),R!==null&&P!==null?u.style.fillOpacity=`${R+(P-R)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),I&&u.tagName.toLowerCase()==="path"&&_[m]&&u.setAttribute("d",We(_[m],I,a)),m===0&&(he?.(a),e.style.setProperty("--scroll-draw-progress",String(a))),a<1&&(B=false);}),oe){let u=ae(ue(o,W,j,l));for(let m in oe){let T=parseFloat(m);u>=T&&!Z.has(T)&&(Z.add(T),oe[m]?.());}}!N&&ue(o,W,j,l)>0&&(N=true,$e?.()),B&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{G=-1,N=false,A=false,Z.clear(),Ae(),J=true;},Oe))):!B&&!ee&&(A=false),M=requestAnimationFrame(Me);}let Ne=false;function ke(){Ne||(Ne=true,M=requestAnimationFrame(function(){Me();}));}function Le(){Ne=false,cancelAnimationFrame(M);}let Ve=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(J=true,ke()):Le();});},{root:z??null,threshold:Ge,rootMargin:qe});function st(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),rt(),J=true;}let De;function be(){clearTimeout(De),De=setTimeout(st,150);}window.addEventListener("resize",be),window.addEventListener("orientationchange",be);let we;return typeof ResizeObserver<"u"&&(we=new ResizeObserver(()=>be()),we.observe(document.body),we.observe(document.documentElement),we.observe(e)),ye>0?setTimeout(()=>Ve.observe(e),ye):Ve.observe(e),Fe({destroy(){cancelAnimationFrame(M),clearTimeout(K),Le(),Ve.disconnect(),we?.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(De),Ke();},replay(){G=-1,xe=-1,Te=-1,N=false,A=false,Q=0,k=false,q=0,Z.clear(),clearTimeout(K),Ae(),J=true,fe&&ke();},pause(){k=true,Le();},resume(){k&&(k=false,J=true,fe&&ke());},seek(t){let o=Math.min(1,Math.max(0,t));q=o,G=o,k=true,Le(),At(o,h),J=true;},getProgress(){return q},refresh(){clearTimeout(De),st(),fe&&!k&&ke();}},()=>({tStart:W,tEnd:j}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null;}connectedCallback(){let n={},c=this.getAttribute("speed"),f=this.getAttribute("easing"),g=this.getAttribute("stagger"),w=this.getAttribute("direction"),E=this.getAttribute("selector");c&&(n.speed=parseFloat(c)),f&&(n.easing=f),g&&(n.stagger=parseFloat(g)),w&&(n.direction=w),E&&(n.selector=E),this.hasAttribute("fade")&&(n.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(n.once=this.getAttribute("once")!=="false"),this.instance=Et(this,n);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
|
3
|
+
<div style="position:absolute;${E?`left:${w}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${w}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(n),window.addEventListener("scroll",c,{passive:true}),c(),{el:n,destroy(){window.removeEventListener("scroll",c),n.remove();}}}var vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Et=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ht(e,r,s){if(!Se)return;let n=(e.match(Et)??[]).join("").toUpperCase(),c=(r.match(Et)??[]).join("").toUpperCase(),f=(e.match(vt)??[]).length,g=(r.match(vt)??[]).length;if(n!==c){de(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${c||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,s);return}f!==g&&de(`morphTo: coordinate count differs (${f} \u2192 ${g}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,s);}function Ge(e,r,s){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),c=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,f=>{let g=parseFloat(f),w=n[c++]??g;return String(+(g+(w-g)*s).toFixed(4))})}function St(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...n}=r,c=s?{...ft[s],...n}:n,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:g="path, polyline, line, polygon, rect, circle",speed:w=1,fade:E=false,easing:v="linear",trigger:$={},stagger:B=0,direction:h="forward",once:ee=false,debug:$t=false,axis:te="y",scrollContainer:Oe,autoReverse:$e=false,delay:ye=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ge=false,threshold:qe=0,rootMargin:Be="0px",repeat:ie=0,repeatDelay:Re=0,morphTo:I,clip:Ie,autoplay:xt=false,duration:Tt=1e3,native:At=true,onProgress:he,onStart:xe,onComplete:ce,onEnter:Ue,onLeave:je,onEnterBack:Qe,onLeaveBack:Xe}=c,X=Ie===true?"left":typeof Ie=="string"?Ie:false,ae=typeof v=="function"?v:Ee[v]??Ee.linear,Ye=He($.start??"top bottom"),Ke=He($.end??"bottom top"),z=typeof Oe=="string"?document.querySelector(Oe):Oe??null,H=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,O=Array.isArray(ne)?ne[0]:null,D=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,P=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let o=t*100;switch(X){case "right":return `inset(0 0 0 ${100-o}%)`;case "top":return `inset(0 0 ${100-o}% 0)`;case "bottom":return `inset(${100-o}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-o}% 0 0)`}}let S=X?[]:Array.from(e.querySelectorAll(g)),p=[],_=[],W=0,U=0,A=false,N=false,M=0,fe=false,Y=-1,be=[],Te=-1,k=false,G=0,j=0,K,_e=null;function Ze(){_e?.destroy(),_e=null;}let Z=new Set,Je=NaN,J=true,Ae=-1,et=performance.now(),me=NaN;function Fe(){return z?te==="x"?z.scrollLeft:z.scrollTop:te==="x"?window.scrollX:window.scrollY}function tt(){return z?te==="x"?z.clientWidth:z.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function rt(){let t=ut(e,z,te);return We(t,t.scroll,tt(),Ye,Ke)}function nt(){(({tStart:W,tEnd:U}=rt())),$t&&Se&&(Ze(),_e=zt(W,U,te));}function Ne(t,o=rt){gt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let l=t.destroy;return t.destroy=()=>{l.call(t),ht(e);},t}function Mt(t,o){if(e.style.setProperty("--scroll-draw-progress",String(t)),X){let l=o==="reverse"?1-t:t;e.style.clipPath=le(l);return}S.forEach((l,x)=>{l.style.strokeDashoffset=o==="reverse"?`${p[x]*t}`:`${p[x]*(1-t)}`,E&&(l.style.opacity=o==="reverse"?`${1-t}`:`${t}`),H&&L?l.style.stroke=Ce(H,L,t):L&&(l.style.stroke=L),O!==null&&D!==null?l.style.strokeWidth=`${O+(D-O)*t}`:D!==null&&(l.style.strokeWidth=`${D}`),R!==null&&P!==null?l.style.fillOpacity=`${R+(P-R)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),I&&l.tagName.toLowerCase()==="path"&&_[x]&&l.setAttribute("d",Ge(_[x],I,t));});}function Me(){if(e.style.setProperty("--scroll-draw-progress","0"),X){e.style.clipPath=le(0);return}S.forEach((t,o)=>{t.style.strokeDasharray=`${p[o]}`,t.style.strokeDashoffset=h==="reverse"?"0":`${p[o]}`,E?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`),I&&t.tagName.toLowerCase()==="path"&&_[o]&&t.setAttribute("d",_[o]);});}if(S.forEach(t=>{Vt(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),I&&(l?Ht(_[_.length-1],I,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),f?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?`${o}`:"0",E&&(t.style.opacity="1"),L&&(t.style.stroke=L),D!==null&&(t.style.strokeWidth=`${D}`),P!==null&&(t.style.fillOpacity=`${P}`),I&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",I)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?"0":`${o}`,E?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`));}),X){if(f)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(f)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let st=typeof v=="string"?pt(v):null;function kt(){return !(At===false||!Nt()||!S.length||!st||X||te!=="y"||z||w!==1||B!==0||ee||$e||ge!==false||I||oe||ie||ye>0||he||xe||ce||Ue||je||Qe||Xe||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Lt(){let t=++Ft,o=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,x=`--svg-scroll-draw-${t}`,Q=h==="reverse"?"0":"var(--ssd-len)",q=h==="reverse"?"var(--ssd-len)":"0",V=`stroke-dashoffset:${Q};`,u=`stroke-dashoffset:${q};`;E&&(V+=`opacity:${h==="reverse"?1:0};`,u+=`opacity:${h==="reverse"?0:1};`);let m=document.createElement("style");m.setAttribute("data-svg-scroll-draw",""),m.textContent=`@keyframes ${o}{from{${V}}to{${u}}}.${l}{view-timeline-name:${x};view-timeline-axis:block;}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${st};animation-fill-mode:both;animation-timeline:${x};animation-range:cover 0% cover 100%;}`,document.head.appendChild(m),e.classList.add(l);function T(i,b){i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`,i.style.strokeDashoffset="",i.style.opacity="",i.style.animationPlayState="",i.classList.add(o);}S.forEach(T);let a=false,d=-1;function y(){if(d>=0)return d;let i=e.getBoundingClientRect(),{tStart:b,tEnd:F}=We({top:i.top,height:i.height},Fe(),tt(),Ye,Ke);return ae(ue(Fe(),b,F,w))}return {destroy(){e.classList.remove(l),S.forEach(i=>{i.classList.remove(o),i.style.removeProperty("--ssd-len"),i.style.animationPlayState="";}),m.remove();},replay(){a=false,d=-1,S.forEach(T);},pause(){a=true,S.forEach(i=>{i.style.animationPlayState="paused";});},resume(){a&&(a=false,S.forEach(i=>{i.style.animationPlayState="running";}));},seek(i){let b=Math.min(1,Math.max(0,i));d=b,a=true,S.forEach((F,C)=>{F.classList.remove(o),F.style.strokeDashoffset=h==="reverse"?`${p[C]*b}`:`${p[C]*(1-b)}`,E&&(F.style.opacity=h==="reverse"?`${1-b}`:`${b}`);});},getProgress(){return y()},refresh(){S.forEach((i,b)=>{p[b]=pe(i),i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`;});}}}if(kt())return Ne(Lt());function Dt(){let t=Math.max(1,Tt),o=0,l=0,x=false;function Q(a){let d=true;if(X){let y=Math.min(1,Math.max(0,a/t)),i=ae(y);G=i,e.style.setProperty("--scroll-draw-progress",String(i)),e.style.clipPath=le(h==="reverse"?1-i:i),he?.(i),y<1&&(d=false);}else S.forEach((y,i)=>{let b=i*B*t,F=Math.min(1,Math.max(0,(a-b)/t)),C=ae(F);y.style.strokeDashoffset=h==="reverse"?`${p[i]*C}`:`${p[i]*(1-C)}`,E&&(y.style.opacity=h==="reverse"?`${1-C}`:`${C}`),H&&L?y.style.stroke=Ce(H,L,C):L&&(y.style.stroke=L),O!==null&&D!==null?y.style.strokeWidth=`${O+(D-O)*C}`:D!==null&&(y.style.strokeWidth=`${D}`),R!==null&&P!==null?y.style.fillOpacity=`${R+(P-R)*C}`:P!==null&&(y.style.fillOpacity=`${P}`),I&&y.tagName.toLowerCase()==="path"&&_[i]&&y.setAttribute("d",Ge(_[i],I,C)),i===0&&(G=C,he?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),F<1&&(d=false);});if(oe){let y=Math.min(1,Math.max(0,a/t)),i=ae(y);for(let b in oe){let F=parseFloat(b);i>=F&&!Z.has(F)&&(Z.add(F),oe[b]?.());}}return d}function q(a){if(k)return;let d=a-o;N||(N=true,xe?.());let y=Q(d);if(y&&!A){A=true,Q(t*(1+Math.max(0,S.length-1)*B)),ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{o=performance.now(),N=false,A=false,Z.clear(),Me(),M=requestAnimationFrame(q);},Re));return}y||(M=requestAnimationFrame(q));}function V(){cancelAnimationFrame(M),clearTimeout(K),o=performance.now(),l=0,k=false,N=false,A=false,j=0,x=true,G=0,Z.clear(),Me(),M=requestAnimationFrame(q);}let u=new IntersectionObserver(a=>{a.forEach(d=>{d.isIntersecting&&!(ee&&A)?V():!d.isIntersecting&&!ee&&!A&&(cancelAnimationFrame(M),clearTimeout(K),x=false);});},{root:z??null,threshold:qe,rootMargin:Be}),m;function T(){clearTimeout(m),m=setTimeout(()=>{S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ye>0?setTimeout(()=>u.observe(e),ye):u.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(K),u.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(m);},replay(){j=0,V();},pause(){k||!x||(k=true,l=performance.now()-o,cancelAnimationFrame(M));},resume(){k&&(k=false,x=true,o=performance.now()-l,M=requestAnimationFrame(q));},seek(a){let d=Math.min(1,Math.max(0,a));G=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),Q(l);},getProgress(){return G},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if(xt)return Ne(Dt());nt();function ke(){if(!fe||k)return;let t=performance.now(),o=Fe();if(!J&&ge===false&&o===Je){M=requestAnimationFrame(ke);return}J=false,Je=o;let l=w;if(ge!==false){let u=t-et,m=u>0?Math.abs(o-(Ae<0?o:Ae))/u:0;l=w*Math.max(.2,1+m*(typeof ge=="number"?ge:1)*.04);}Ae=o,et=t;let x=$e?Te===-1||o>=Te?"forward":"reverse":h;Te=o;let Q=U-W,q=true,V=Q===0?0:(o-W)/Q;if(isNaN(me)||(me<=0&&V>0?Ue?.():me>0&&V<=0&&Xe?.(),me<1&&V>=1?je?.():me>=1&&V<1&&Qe?.()),me=V,X){let u=ae(ue(o,W,U,l));ee&&!$e&&(Y=Math.max(Y,u),u=Y),G=u,e.style.setProperty("--scroll-draw-progress",String(u));let m=x==="reverse"?1-u:u;e.style.clipPath=le(m),he?.(u),!N&&ue(o,W,U,l)>0&&(N=true,xe?.()),u>=1&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{Y=-1,N=false,A=false,e.style.clipPath=le(0);},Re))):u<1&&!ee&&(A=false),M=requestAnimationFrame(ke);return}if(S.forEach((u,m)=>{let T=m*B*Q,a=ae(ue(o,W+T,U+T,l));ee&&!$e&&(a=be[m]=Math.max(be[m]??Y,a)),G=a,u.style.strokeDashoffset=x==="reverse"?`${p[m]*a}`:`${p[m]*(1-a)}`,E&&(u.style.opacity=x==="reverse"?`${1-a}`:`${a}`),H&&L?u.style.stroke=Ce(H,L,a):L&&(u.style.stroke=L),O!==null&&D!==null?u.style.strokeWidth=`${O+(D-O)*a}`:D!==null&&(u.style.strokeWidth=`${D}`),R!==null&&P!==null?u.style.fillOpacity=`${R+(P-R)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),I&&u.tagName.toLowerCase()==="path"&&_[m]&&u.setAttribute("d",Ge(_[m],I,a)),m===0&&(he?.(a),e.style.setProperty("--scroll-draw-progress",String(a))),a<1&&(q=false);}),oe){let u=ae(ue(o,W,U,l));for(let m in oe){let T=parseFloat(m);u>=T&&!Z.has(T)&&(Z.add(T),oe[m]?.());}}!N&&ue(o,W,U,l)>0&&(N=true,xe?.()),q&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{Y=-1,be=[],N=false,A=false,Z.clear(),Me(),J=true;},Re))):!q&&!ee&&(A=false),M=requestAnimationFrame(ke);}let Ve=false;function Le(){Ve||(Ve=true,M=requestAnimationFrame(function(){ke();}));}function De(){Ve=false,cancelAnimationFrame(M);}let ze=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(J=true,Le()):De();});},{root:z??null,threshold:qe,rootMargin:Be});function ot(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),nt(),J=true;}let Pe;function we(){clearTimeout(Pe),Pe=setTimeout(ot,150);}window.addEventListener("resize",we),window.addEventListener("orientationchange",we);let ve;return typeof ResizeObserver<"u"&&(ve=new ResizeObserver(()=>we()),ve.observe(document.body),ve.observe(document.documentElement),ve.observe(e)),ye>0?setTimeout(()=>ze.observe(e),ye):ze.observe(e),Ne({destroy(){cancelAnimationFrame(M),clearTimeout(K),De(),ze.disconnect(),ve?.disconnect(),window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we),clearTimeout(Pe),Ze();},replay(){Y=-1,be=[],Te=-1,Ae=-1,N=false,A=false,j=0,k=false,G=0,Z.clear(),clearTimeout(K),Me(),J=true,fe&&Le();},pause(){k=true,De();},resume(){k&&(k=false,J=true,fe&&Le());},seek(t){let o=Math.min(1,Math.max(0,t));G=o,Y=o,be=[],k=true,De(),Mt(o,h),J=true;},getProgress(){return G},refresh(){clearTimeout(Pe),ot(),fe&&!k&&Le();}},()=>({tStart:W,tEnd:U}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null;}connectedCallback(){let n={},c=this.getAttribute("speed"),f=this.getAttribute("easing"),g=this.getAttribute("stagger"),w=this.getAttribute("direction"),E=this.getAttribute("selector");c&&(n.speed=parseFloat(c)),f&&(n.easing=f),g&&(n.stagger=parseFloat(g)),w&&(n.direction=w),E&&(n.selector=E),this.hasAttribute("fade")&&(n.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(n.once=this.getAttribute("once")!=="false"),this.instance=St(this,n);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class c extends HTMLElement{constructor(){super(...arguments);this.instance=null;}connectedCallback(){let t={},e=this.getAttribute("speed"),s=this.getAttribute("easing"),i=this.getAttribute("stagger"),n=this.getAttribute("direction"),r=this.getAttribute("selector");e&&(t.speed=parseFloat(e)),s&&(t.easing=s),i&&(t.stagger=parseFloat(i)),n&&(t.direction=n),r&&(t.selector=r),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(t.once=this.getAttribute("once")!=="false"),this.instance=b(this,t);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",c);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svg-scroll-draw",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Scroll-driven animation for the web — draw SVG paths, reveal elements, pin sections, scrub video. Zero dependencies, native CSS fast path, works with React, Vue, Svelte, Solid, Angular, Astro and vanilla JS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svg",
|
package/dist/chunk-JC5BD4RB.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,c,b as b$2}from'./chunk-PEFR3ZB7.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var _={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function $(c$1,v={}){if(typeof window>"u")return _;let y=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!y||y.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",c$1),_;let t=y,{trigger:F={},easing:h="linear",once:P=false,axis:m="y",preload:B="auto",onReady:C,onComplete:G,onProgress:W}=v,z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,X=typeof h=="function"?h:d[h]??d.linear,Y=a(F.start??"top top"),j=a(F.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=B);let I=v.from??0,T=v.to,b$3=0,E=0,o=0,a$2=false,n=false,s=-1,l=0,u=false,i=false,M=()=>m==="x"?window.scrollX:window.scrollY,J=()=>m==="x"?window.innerWidth:window.innerHeight;function A(){let e=t.getBoundingClientRect(),r=m==="x"?e.left:e.top,d=m==="x"?e.width:e.height,R=c({top:r,height:d},M(),J(),Y,j);b$3=R.tStart,E=R.tEnd;}let f=NaN;function p(e){if(!i)return;let r=T??t.duration??0,d=I+(r-I)*e;d!==f&&(f=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),W?.(e);}function g(){if(!a$2||n||!i||z)return;let e=X(b$2(M(),b$3,E,1));P&&(s=Math.max(s,e),e=s),l=e,p(e),e>=1&&!u?(u=true,G?.()):e<1&&!P&&(u=false),o=requestAnimationFrame(g);}function S(){if(i=true,T===void 0&&(T=t.duration),z){p(1),C?.();return}A(),C?.(),a$2&&!n&&(o=requestAnimationFrame(g));}t.readyState>=1?S():t.addEventListener("loadedmetadata",S,{once:true}),i||A();let V=new IntersectionObserver(e=>{e.forEach(r=>{a$2=r.isIntersecting,a$2&&!n&&i?o=requestAnimationFrame(g):cancelAnimationFrame(o);});}),x;function w(){clearTimeout(x),x=setTimeout(A,150);}return window.addEventListener("resize",w),window.addEventListener("orientationchange",w),V.observe(t),a$1(t,{type:"video",getProgress:()=>l,getTrigger:()=>({tStart:b$3,tEnd:E})}),{destroy(){cancelAnimationFrame(o),V.disconnect(),t.removeEventListener("loadedmetadata",S),window.removeEventListener("resize",w),window.removeEventListener("orientationchange",w),clearTimeout(x),b$1(t);},replay(){s=-1,u=false,l=0,n=false,f=NaN,p(0);},pause(){n=true,cancelAnimationFrame(o);},resume(){n&&(n=false,a$2&&i&&(o=requestAnimationFrame(g)));},seek(e){let r=Math.min(1,Math.max(0,e));l=r,s=r,n=true,cancelAnimationFrame(o),f=NaN,p(r);},getProgress(){return l}}}export{$ as a};
|
package/dist/chunk-WDIHLRZZ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {b as b$1,a as a$5}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a as a$1}from'./chunk-YZV4Z3EQ.mjs';import {a,c,b as b$3}from'./chunk-PEFR3ZB7.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$4,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var ft={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var $t=0;function Tt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function ct(r,b){let p="";try{p=getComputedStyle(r).getPropertyValue(b).trim();}catch{}return p||(r.getAttribute(b)??"").trim()}var ut=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function kt(r){if(!a$3)return;let b$1=ct(r,"stroke");if(!b$1||b$1==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let p=(r.getAttribute("fill")??"").trim();p&&!ut.has(p)&&!ut.has(ct(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function St(r,b,p){let E=document.createElement("div");E.setAttribute("data-svg-scroll-draw-debug",""),E.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 R(){let D=p==="x"?window.scrollX:window.scrollY,O=r-D,G=b-D,C=p==="x";E.innerHTML=`
|
|
2
|
-
<div style="position:absolute;${C?`left:${O}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${O}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${C?`left:${G}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${G}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(E),window.addEventListener("scroll",R,{passive:true}),R(),{el:E,destroy(){window.removeEventListener("scroll",R),E.remove();}}}var mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function At(r,b$1,p){if(!a$3)return;let E=(r.match(pt)??[]).join("").toUpperCase(),R=(b$1.match(pt)??[]).join("").toUpperCase(),D=(r.match(mt)??[]).length,O=(b$1.match(mt)??[]).length;if(E!==R){b(`morphTo: command sequence differs (${E||"\u2205"} \u2192 ${R||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,p);return}D!==O&&b(`morphTo: coordinate count differs (${D} \u2192 ${O}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,p);}function Ve(r,b,p){let E=(b.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),R=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,D=>{let O=parseFloat(D),G=E[R++]??O;return String(+(O+(G-O)*p).toFixed(4))})}function Ht(r,b$4={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:p,...E}=b$4,R=p?{...ft[p],...E}:E,D=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:O="path, polyline, line, polygon, rect, circle",speed:G=1,fade:C=false,easing:me="linear",trigger:ve={},stagger:we=0,direction:d$1="forward",once:Z=false,debug:dt=false,axis:J="y",scrollContainer:De,autoReverse:be=false,delay:pe=0,strokeColor:K,strokeWidth:ee,fillOpacity:te,waypoints:re,velocityScale:de=false,threshold:Ge=0,rootMargin:Be="0px",repeat:se=0,repeatDelay:Oe=0,morphTo:P,clip:Ce,autoplay:yt=false,duration:ht=1e3,native:gt=true,onProgress:ye,onStart:Ee,onComplete:ae,onEnter:_e,onLeave:Ue,onEnterBack:je,onLeaveBack:Xe}=R,j=Ce===true?"left":typeof Ce=="string"?Ce:false,oe=typeof me=="function"?me:d[me]??d.linear,Ye=a(ve.start??"top bottom"),Qe=a(ve.end??"bottom top"),H=typeof De=="string"?document.querySelector(De):De??null,I=Array.isArray(K)?K[0]:null,$=Array.isArray(K)?K[1]:typeof K=="string"?K:null,A=Array.isArray(ee)?ee[0]:null,T=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null,x=Array.isArray(te)?te[0]:null,k=Array.isArray(te)?te[1]:typeof te=="number"?te:null;function ne(e){let t=e*100;switch(j){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let m=j?[]:Array.from(r.querySelectorAll(O)),l=[],L=[],z=0,B=0,g=false,F=false,v=0,le=false,W=-1,$e=-1,w=false,q=0,_=0,X,Fe=null;function Ze(){Fe?.destroy(),Fe=null;}let Y=new Set,Je=NaN,Q=true,Te=-1,Ke=performance.now(),fe=NaN;function Ne(){return H?J==="x"?H.scrollLeft:H.scrollTop:J==="x"?window.scrollX:window.scrollY}function et(){return H?J==="x"?H.clientWidth:H.clientHeight:J==="x"?window.innerWidth:window.innerHeight}function tt(){let e=a$2(r,H,J);return c(e,e.scroll,et(),Ye,Qe)}function rt(){(({tStart:z,tEnd:B}=tt())),dt&&a$3&&(Ze(),Fe=St(z,B,J));}function Re(e,t=tt){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let n=e.destroy;return e.destroy=()=>{n.call(e),b$2(r);},e}function vt(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),j){let n=t==="reverse"?1-e:e;r.style.clipPath=ne(n);return}m.forEach((n,y)=>{n.style.strokeDashoffset=t==="reverse"?`${l[y]*e}`:`${l[y]*(1-e)}`,C&&(n.style.opacity=t==="reverse"?`${1-e}`:`${e}`),I&&$?n.style.stroke=a$5(I,$,e):$&&(n.style.stroke=$),A!==null&&T!==null?n.style.strokeWidth=`${A+(T-A)*e}`:T!==null&&(n.style.strokeWidth=`${T}`),x!==null&&k!==null?n.style.fillOpacity=`${x+(k-x)*e}`:k!==null&&(n.style.fillOpacity=`${k}`),P&&n.tagName.toLowerCase()==="path"&&L[y]&&n.setAttribute("d",Ve(L[y],P,e));});}function ke(){if(r.style.setProperty("--scroll-draw-progress","0"),j){r.style.clipPath=ne(0);return}m.forEach((e,t)=>{e.style.strokeDasharray=`${l[t]}`,e.style.strokeDashoffset=d$1==="reverse"?"0":`${l[t]}`,C?e.style.opacity=d$1==="reverse"?"1":"0":e.style.opacity="",I&&(e.style.stroke=I),A!==null&&(e.style.strokeWidth=`${A}`),x!==null&&(e.style.fillOpacity=`${x}`),P&&e.tagName.toLowerCase()==="path"&&L[t]&&e.setAttribute("d",L[t]);});}if(m.forEach(e=>{kt(e);let t=a$1(e);l.push(t);let n=e.tagName.toLowerCase()==="path";n?L.push(e.getAttribute("d")??""):L.push(""),P&&(n?At(L[L.length-1],P,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),D?(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=d$1==="reverse"?`${t}`:"0",C&&(e.style.opacity="1"),$&&(e.style.stroke=$),T!==null&&(e.style.strokeWidth=`${T}`),k!==null&&(e.style.fillOpacity=`${k}`),P&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",P)):(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=d$1==="reverse"?"0":`${t}`,C?e.style.opacity=d$1==="reverse"?"1":"0":e.style.opacity="",I&&(e.style.stroke=I),A!==null&&(e.style.strokeWidth=`${A}`),x!==null&&(e.style.fillOpacity=`${x}`));}),j){if(D)return r.style.clipPath=ne(1),ae?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};r.style.clipPath=ne(0);}else if(D)return ae?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let st=typeof me=="string"?b$1(me):null;function wt(){return !(gt===false||!Tt()||!m.length||!st||j||J!=="y"||H||G!==1||we!==0||Z||be||de!==false||P||re||se||pe>0||ye||Ee||ae||_e||Ue||je||Xe||K!=null||ee!=null||te!=null||(ve.start??"top bottom").trim()!=="top bottom"||(ve.end??"bottom top").trim()!=="bottom top")}function bt(){let e=++$t,t=`svg-scroll-draw-${e}`,n=`svg-scroll-draw-host-${e}`,y=`--svg-scroll-draw-${e}`,U=d$1==="reverse"?"0":"var(--ssd-len)",V=d$1==="reverse"?"var(--ssd-len)":"0",N=`stroke-dashoffset:${U};`,i=`stroke-dashoffset:${V};`;C&&(N+=`opacity:${d$1==="reverse"?1:0};`,i+=`opacity:${d$1==="reverse"?0:1};`);let a=document.createElement("style");a.setAttribute("data-svg-scroll-draw",""),a.textContent=`@keyframes ${t}{from{${N}}to{${i}}}.${n}{view-timeline-name:${y};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${st};animation-fill-mode:both;animation-timeline:${y};animation-range:cover 0% cover 100%;}`,document.head.appendChild(a),r.classList.add(n);function h(s,u){s.style.setProperty("--ssd-len",String(l[u])),s.style.strokeDasharray=`${l[u]}`,s.style.strokeDashoffset="",s.style.opacity="",s.style.animationPlayState="",s.classList.add(t);}m.forEach(h);let o=false,f=-1;function c$1(){if(f>=0)return f;let s=r.getBoundingClientRect(),{tStart:u,tEnd:M}=c({top:s.top,height:s.height},Ne(),et(),Ye,Qe);return oe(b$3(Ne(),u,M,G))}return {destroy(){r.classList.remove(n),m.forEach(s=>{s.classList.remove(t),s.style.removeProperty("--ssd-len"),s.style.animationPlayState="";}),a.remove();},replay(){o=false,f=-1,m.forEach(h);},pause(){o=true,m.forEach(s=>{s.style.animationPlayState="paused";});},resume(){o&&(o=false,m.forEach(s=>{s.style.animationPlayState="running";}));},seek(s){let u=Math.min(1,Math.max(0,s));f=u,o=true,m.forEach((M,S)=>{M.classList.remove(t),M.style.strokeDashoffset=d$1==="reverse"?`${l[S]*u}`:`${l[S]*(1-u)}`,C&&(M.style.opacity=d$1==="reverse"?`${1-u}`:`${u}`);});},getProgress(){return c$1()},refresh(){m.forEach((s,u)=>{l[u]=a$1(s),s.style.setProperty("--ssd-len",String(l[u])),s.style.strokeDasharray=`${l[u]}`;});}}}if(wt())return Re(bt());function Et(){let e=Math.max(1,ht),t=0,n=0,y=false;function U(o){let f=true;if(j){let c=Math.min(1,Math.max(0,o/e)),s=oe(c);q=s,r.style.setProperty("--scroll-draw-progress",String(s)),r.style.clipPath=ne(d$1==="reverse"?1-s:s),ye?.(s),c<1&&(f=false);}else m.forEach((c,s)=>{let u=s*we*e,M=Math.min(1,Math.max(0,(o-u)/e)),S=oe(M);c.style.strokeDashoffset=d$1==="reverse"?`${l[s]*S}`:`${l[s]*(1-S)}`,C&&(c.style.opacity=d$1==="reverse"?`${1-S}`:`${S}`),I&&$?c.style.stroke=a$5(I,$,S):$&&(c.style.stroke=$),A!==null&&T!==null?c.style.strokeWidth=`${A+(T-A)*S}`:T!==null&&(c.style.strokeWidth=`${T}`),x!==null&&k!==null?c.style.fillOpacity=`${x+(k-x)*S}`:k!==null&&(c.style.fillOpacity=`${k}`),P&&c.tagName.toLowerCase()==="path"&&L[s]&&c.setAttribute("d",Ve(L[s],P,S)),s===0&&(q=S,ye?.(S),r.style.setProperty("--scroll-draw-progress",String(S))),M<1&&(f=false);});if(re){let c=Math.min(1,Math.max(0,o/e)),s=oe(c);for(let u in re){let M=parseFloat(u);s>=M&&!Y.has(M)&&(Y.add(M),re[u]?.());}}return f}function V(o){if(w)return;let f=o-t;F||(F=true,Ee?.());let c=U(f);if(c&&!g){g=true,U(e*(1+Math.max(0,m.length-1)*we)),ae?.(),_<(se==="infinite"?1/0:se??0)&&(_++,X=setTimeout(()=>{t=performance.now(),F=false,g=false,Y.clear(),ke(),v=requestAnimationFrame(V);},Oe));return}c||(v=requestAnimationFrame(V));}function N(){cancelAnimationFrame(v),clearTimeout(X),t=performance.now(),n=0,w=false,F=false,g=false,_=0,y=true,q=0,Y.clear(),ke(),v=requestAnimationFrame(V);}let i=new IntersectionObserver(o=>{o.forEach(f=>{f.isIntersecting&&!(Z&&g)?N():!f.isIntersecting&&!Z&&!g&&(cancelAnimationFrame(v),clearTimeout(X),y=false);});},{root:H??null,threshold:Ge,rootMargin:Be}),a;function h(){clearTimeout(a),a=setTimeout(()=>{m.forEach((o,f)=>{l[f]=a$1(o),o.style.strokeDasharray=`${l[f]}`;});},150);}return window.addEventListener("resize",h),window.addEventListener("orientationchange",h),pe>0?setTimeout(()=>i.observe(r),pe):i.observe(r),{destroy(){cancelAnimationFrame(v),clearTimeout(X),i.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),clearTimeout(a);},replay(){_=0,N();},pause(){w||!y||(w=true,n=performance.now()-t,cancelAnimationFrame(v));},resume(){w&&(w=false,y=true,t=performance.now()-n,v=requestAnimationFrame(V));},seek(o){let f=Math.min(1,Math.max(0,o));q=f,w=true,n=f*e,t=performance.now()-n,cancelAnimationFrame(v),U(n);},getProgress(){return q},refresh(){clearTimeout(a),m.forEach((o,f)=>{l[f]=a$1(o),o.style.strokeDasharray=`${l[f]}`;});}}}if(yt)return Re(Et());rt();function Se(){if(!le||w)return;let e=performance.now(),t=Ne();if(!Q&&de===false&&t===Je){v=requestAnimationFrame(Se);return}Q=false,Je=t;let n=G;if(de!==false){let i=e-Ke,a=i>0?Math.abs(t-(Te<0?t:Te))/i:0;n=G*Math.max(.2,1+a*(typeof de=="number"?de:1)*.04);}Te=t,Ke=e;let y=be?$e===-1||t>=$e?"forward":"reverse":d$1;$e=t;let U=B-z,V=true,N=U===0?0:(t-z)/U;if(isNaN(fe)||(fe<=0&&N>0?_e?.():fe>0&&N<=0&&Xe?.(),fe<1&&N>=1?Ue?.():fe>=1&&N<1&&je?.()),fe=N,j){let i=oe(b$3(t,z,B,n));Z&&!be&&(W=Math.max(W,i),i=W),q=i,r.style.setProperty("--scroll-draw-progress",String(i));let a=y==="reverse"?1-i:i;r.style.clipPath=ne(a),ye?.(i),!F&&b$3(t,z,B,n)>0&&(F=true,Ee?.()),i>=1&&!g?(g=true,ae?.(),_<(se==="infinite"?1/0:se??0)&&(_++,X=setTimeout(()=>{W=-1,F=false,g=false,r.style.clipPath=ne(0);},Oe))):i<1&&!Z&&(g=false),v=requestAnimationFrame(Se);return}if(m.forEach((i,a)=>{let h=a*we*U,o=oe(b$3(t,z+h,B+h,n));Z&&!be&&(W=Math.max(W,o),o=W),q=o,i.style.strokeDashoffset=y==="reverse"?`${l[a]*o}`:`${l[a]*(1-o)}`,C&&(i.style.opacity=y==="reverse"?`${1-o}`:`${o}`),I&&$?i.style.stroke=a$5(I,$,o):$&&(i.style.stroke=$),A!==null&&T!==null?i.style.strokeWidth=`${A+(T-A)*o}`:T!==null&&(i.style.strokeWidth=`${T}`),x!==null&&k!==null?i.style.fillOpacity=`${x+(k-x)*o}`:k!==null&&(i.style.fillOpacity=`${k}`),P&&i.tagName.toLowerCase()==="path"&&L[a]&&i.setAttribute("d",Ve(L[a],P,o)),a===0&&(ye?.(o),r.style.setProperty("--scroll-draw-progress",String(o))),o<1&&(V=false);}),re){let i=oe(b$3(t,z,B,n));for(let a in re){let h=parseFloat(a);i>=h&&!Y.has(h)&&(Y.add(h),re[a]?.());}}!F&&b$3(t,z,B,n)>0&&(F=true,Ee?.()),V&&!g?(g=true,ae?.(),_<(se==="infinite"?1/0:se??0)&&(_++,X=setTimeout(()=>{W=-1,F=false,g=false,Y.clear(),ke(),Q=true;},Oe))):!V&&!Z&&(g=false),v=requestAnimationFrame(Se);}let He=false;function Ae(){He||(He=true,v=requestAnimationFrame(function(){Se();}));}function xe(){He=false,cancelAnimationFrame(v);}let Ie=new IntersectionObserver(e=>{e.forEach(t=>{le=t.isIntersecting,le&&!w?(Q=true,Ae()):xe();});},{root:H??null,threshold:Ge,rootMargin:Be});function ot(){m.forEach((e,t)=>{l[t]=a$1(e),e.style.strokeDasharray=`${l[t]}`;}),rt(),Q=true;}let Pe;function he(){clearTimeout(Pe),Pe=setTimeout(ot,150);}window.addEventListener("resize",he),window.addEventListener("orientationchange",he);let ge;return typeof ResizeObserver<"u"&&(ge=new ResizeObserver(()=>he()),ge.observe(document.body),ge.observe(document.documentElement),ge.observe(r)),pe>0?setTimeout(()=>Ie.observe(r),pe):Ie.observe(r),Re({destroy(){cancelAnimationFrame(v),clearTimeout(X),xe(),Ie.disconnect(),ge?.disconnect(),window.removeEventListener("resize",he),window.removeEventListener("orientationchange",he),clearTimeout(Pe),Ze();},replay(){W=-1,$e=-1,Te=-1,F=false,g=false,_=0,w=false,q=0,Y.clear(),clearTimeout(X),ke(),Q=true,le&&Ae();},pause(){w=true,xe();},resume(){w&&(w=false,Q=true,le&&Ae());},seek(e){let t=Math.min(1,Math.max(0,e));q=t,W=t,w=true,xe(),vt(t,d$1),Q=true;},getProgress(){return q},refresh(){clearTimeout(Pe),ot(),le&&!w&&Ae();}},()=>({tStart:z,tEnd:B}))}export{ft as a,Ht as b};
|