svg-scroll-draw 2.10.0 → 2.10.2
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 -10
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.mjs +2 -2
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.mjs +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +55 -29
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.mjs +2 -2
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.mjs +1 -1
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.mjs +2 -2
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +2 -2
- 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.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +2 -2
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +2 -2
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +2 -2
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +8 -8
- package/dist/timeline/index.mjs +8 -8
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +2 -2
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +3 -3
- package/package.json +255 -68
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${E?`left:${
|
|
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(r),window.addEventListener("scroll",c,{passive:true}),c(),{el:r,destroy(){window.removeEventListener("scroll",c),r.remove();}}}var ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,ft=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ct(e,n,s){if(!Pe)return;let r=(e.match(ft)??[]).join("").toUpperCase(),c=(n.match(ft)??[]).join("").toUpperCase(),f=(e.match(ct)??[]).length,y=(n.match(ct)??[]).length;if(r!==c){de(`morphTo: command sequence differs (${r||"\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!==y&&de(`morphTo: coordinate count differs (${f} \u2192 ${y}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,s);}function He(e,n,s){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),c=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,f=>{let y=parseFloat(f),w=r[c++]??y;return String(+(y+(w-y)*s).toFixed(4))})}function mt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...r}=n,c=s?{...at[s],...r}:r,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:y="path, polyline, line, polygon, rect, circle",speed:w=1,fade:E=false,easing:v="linear",trigger:$={},stagger:B=0,direction:g="forward",once:ee=false,debug:pt=false,axis:te="y",scrollContainer:Ce,autoReverse:Ee=false,delay:he=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ye=false,threshold:We=0,rootMargin:qe="0px",repeat:ie=0,repeatDelay:Oe=0,morphTo:R,clip:Ie,autoplay:dt=false,duration:ht=1e3,native:yt=true,onProgress:ge,onStart:Se,onComplete:ce,onEnter:Ge,onLeave:Be,onEnterBack:Ue,onLeaveBack:je}=c,X=Ie===true?"left":typeof Ie=="string"?Ie:false,ae=typeof v=="function"?v:ve[v]??ve.linear,Qe=Ve($.start??"top bottom"),Xe=Ve($.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,I=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(y)),p=[],F=[],U=0,Y=0,A=false,_=false,M=0,fe=false,W=-1,$e=-1,k=false,q=0,j=0,Z,Re=null;function Ye(){Re?.destroy(),Re=null;}let J=new Set,Ze=NaN,K=true,xe=-1,Je=performance.now(),me=NaN;function Fe(){return z?te==="x"?z.scrollLeft:z.scrollTop:te==="x"?window.scrollX:window.scrollY}function Ke(){return z?te==="x"?z.clientWidth:z.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function et(){let t=it(e,z,te),o=ze(t,t.scroll,Ke(),Qe,Xe);U=o.tStart,Y=o.tEnd,pt&&Pe&&(Ye(),Re=Pt(U,Y,te));}function gt(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=De(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}`),I!==null&&P!==null?l.style.fillOpacity=`${I+(P-I)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),R&&l.tagName.toLowerCase()==="path"&&F[x]&&l.setAttribute("d",He(F[x],R,t));});}function Te(){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=g==="reverse"?"0":`${p[o]}`,E?t.style.opacity=g==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),I!==null&&(t.style.fillOpacity=`${I}`),R&&t.tagName.toLowerCase()==="path"&&F[o]&&t.setAttribute("d",F[o]);});}if(S.forEach(t=>{Dt(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?F.push(t.getAttribute("d")??""):F.push(""),R&&(l?Ct(F[F.length-1],R,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),f?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=g==="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}`),R&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",R)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=g==="reverse"?"0":`${o}`,E?t.style.opacity=g==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),I!==null&&(t.style.fillOpacity=`${I}`));}),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 tt=typeof v=="string"?ut(v):null;function bt(){return !(yt===false||!Lt()||!S.length||!tt||X||te!=="y"||z||w!==1||B!==0||ee||Ee||ye!==false||R||oe||ie||he>0||ge||Se||ce||Ge||Be||Ue||je||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function wt(){let t=++kt,o=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,x=`--svg-scroll-draw-${t}`,Q=g==="reverse"?"0":"var(--ssd-len)",G=g==="reverse"?"var(--ssd-len)":"0",V=`stroke-dashoffset:${Q};`,u=`stroke-dashoffset:${G};`;E&&(V+=`opacity:${g==="reverse"?1:0};`,u+=`opacity:${g==="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:${tt};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 h(){if(d>=0)return d;let i=e.getBoundingClientRect(),{tStart:b,tEnd:N}=ze({top:i.top,height:i.height},Fe(),Ke(),Qe,Xe);return ae(ue(Fe(),b,N,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((N,C)=>{N.classList.remove(o),N.style.strokeDashoffset=g==="reverse"?`${p[C]*b}`:`${p[C]*(1-b)}`,E&&(N.style.opacity=g==="reverse"?`${1-b}`:`${b}`);});},getProgress(){return h()},refresh(){S.forEach((i,b)=>{p[b]=pe(i),i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`;});}}}if(bt())return wt();function vt(){let t=Math.max(1,ht),o=0,l=0,x=false;function Q(a){let d=true;if(X){let h=Math.min(1,Math.max(0,a/t)),i=ae(h);q=i,e.style.setProperty("--scroll-draw-progress",String(i)),e.style.clipPath=le(g==="reverse"?1-i:i),ge?.(i),h<1&&(d=false);}else S.forEach((h,i)=>{let b=i*B*t,N=Math.min(1,Math.max(0,(a-b)/t)),C=ae(N);h.style.strokeDashoffset=g==="reverse"?`${p[i]*C}`:`${p[i]*(1-C)}`,E&&(h.style.opacity=g==="reverse"?`${1-C}`:`${C}`),H&&L?h.style.stroke=De(H,L,C):L&&(h.style.stroke=L),O!==null&&D!==null?h.style.strokeWidth=`${O+(D-O)*C}`:D!==null&&(h.style.strokeWidth=`${D}`),I!==null&&P!==null?h.style.fillOpacity=`${I+(P-I)*C}`:P!==null&&(h.style.fillOpacity=`${P}`),R&&h.tagName.toLowerCase()==="path"&&F[i]&&h.setAttribute("d",He(F[i],R,C)),i===0&&(q=C,ge?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),N<1&&(d=false);});if(oe){let h=Math.min(1,Math.max(0,a/t)),i=ae(h);for(let b in oe){let N=parseFloat(b);i>=N&&!J.has(N)&&(J.add(N),oe[b]?.());}}return d}function G(a){if(k)return;let d=a-o;_||(_=true,Se?.());let h=Q(d);if(h&&!A){A=true,Q(t*(1+Math.max(0,S.length-1)*B)),ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{o=performance.now(),_=false,A=false,J.clear(),Te(),M=requestAnimationFrame(G);},Oe));return}h||(M=requestAnimationFrame(G));}function V(){cancelAnimationFrame(M),clearTimeout(Z),o=performance.now(),l=0,k=false,_=false,A=false,j=0,x=true,q=0,J.clear(),Te(),M=requestAnimationFrame(G);}let u=new IntersectionObserver(a=>{a.forEach(d=>{d.isIntersecting&&!(ee&&A)?V():!d.isIntersecting&&!ee&&!A&&(cancelAnimationFrame(M),clearTimeout(Z),x=false);});},{root:z??null,threshold:We,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),he>0?setTimeout(()=>u.observe(e),he):u.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(Z),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(G));},seek(a){let d=Math.min(1,Math.max(0,a));q=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),Q(l);},getProgress(){return q},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if(dt)return vt();et();function Ae(){if(!fe||k)return;let t=performance.now(),o=Fe();if(!K&&ye===false&&o===Ze){M=requestAnimationFrame(Ae);return}K=false,Ze=o;let l=w;if(ye!==false){let u=t-Je,m=u>0?Math.abs(o-(xe<0?o:xe))/u:0;l=w*Math.max(.2,1+m*(typeof ye=="number"?ye:1)*.04);}xe=o,Je=t;let x=Ee?$e===-1||o>=$e?"forward":"reverse":g;$e=o;let Q=Y-U,G=true,V=Q===0?0:(o-U)/Q;if(isNaN(me)||(me<=0&&V>0?Ge?.():me>0&&V<=0&&je?.(),me<1&&V>=1?Be?.():me>=1&&V<1&&Ue?.()),me=V,X){let u=ae(ue(o,U,Y,l));ee&&!Ee&&(W=Math.max(W,u),u=W),q=u,e.style.setProperty("--scroll-draw-progress",String(u));let m=x==="reverse"?1-u:u;e.style.clipPath=le(m),ge?.(u),!_&&ue(o,U,Y,l)>0&&(_=true,Se?.()),u>=1&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{W=-1,_=false,A=false,e.style.clipPath=le(0);},Oe))):u<1&&!ee&&(A=false),M=requestAnimationFrame(Ae);return}if(S.forEach((u,m)=>{let T=m*B*Q,a=ae(ue(o,U+T,Y+T,l));ee&&!Ee&&(W=Math.max(W,a),a=W),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=De(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}`),I!==null&&P!==null?u.style.fillOpacity=`${I+(P-I)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),R&&u.tagName.toLowerCase()==="path"&&F[m]&&u.setAttribute("d",He(F[m],R,a)),m===0&&(ge?.(a),e.style.setProperty("--scroll-draw-progress",String(a))),a<1&&(G=false);}),oe){let u=ae(ue(o,U,Y,l));for(let m in oe){let T=parseFloat(m);u>=T&&!J.has(T)&&(J.add(T),oe[m]?.());}}!_&&ue(o,U,Y,l)>0&&(_=true,Se?.()),G&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{W=-1,_=false,A=false,J.clear(),Te(),K=true;},Oe))):!G&&!ee&&(A=false),M=requestAnimationFrame(Ae);}let Ne=false;function Me(){Ne||(Ne=true,M=requestAnimationFrame(function(){Ae();}));}function ke(){Ne=false,cancelAnimationFrame(M);}let _e=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(K=true,Me()):ke();});},{root:z??null,threshold:We,rootMargin:qe});function rt(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),et(),K=true;}let Le;function be(){clearTimeout(Le),Le=setTimeout(rt,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)),he>0?setTimeout(()=>_e.observe(e),he):_e.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(Z),ke(),_e.disconnect(),we?.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(Le),Ye();},replay(){W=-1,$e=-1,xe=-1,_=false,A=false,j=0,k=false,q=0,J.clear(),clearTimeout(Z),Te(),K=true,fe&&Me();},pause(){k=true,ke();},resume(){k&&(k=false,K=true,fe&&Me());},seek(t){let o=Math.min(1,Math.max(0,t));q=o,W=o,k=true,ke(),gt(o,g),K=true;},getProgress(){return q},refresh(){clearTimeout(Le),rt(),fe&&!k&&Me();}}}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null;}connectedCallback(){let r={},c=this.getAttribute("speed"),f=this.getAttribute("easing"),y=this.getAttribute("stagger"),w=this.getAttribute("direction"),E=this.getAttribute("selector");c&&(r.speed=parseFloat(c)),f&&(r.easing=f),y&&(r.stagger=parseFloat(y)),w&&(r.direction=w),E&&(r.selector=E),this.hasAttribute("fade")&&(r.fade=this.getAttribute("fade")!=="false"),this.instance=mt(this,r);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
|
1
|
+
'use strict';function Mt({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 U=(v-w[$])/(w[$+1]-w[$]);if($===0)return U*(2-U);let h=1-Math.pow(n,$);return h+(1-h)*(2*U-1)*(2*U-1)}return 1}}function kt({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 ve={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mt(),elastic:kt()};function ze(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 ot(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 it(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 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 Lt(e,r,s){return Math.min(s,Math.max(r,e))}function ue(e,r,s,n){return s===r?0:Lt((e-r)/(s-r)*n,0,1)}function lt(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 He(e,r,s,n,c){let f=ot(e.top,e.height,r,n.element)-it(n.viewport,s),g=ot(e.top,e.height,r,c.element)-it(c.viewport,s);return {tStart:f,tEnd:g}}function at(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 De(e,r,s){let n=at(e),c=at(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 ut={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 Pe=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){Pe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Dt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Pt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ct=33;function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Rt(e){let r=[];for(let s=0;s<ct;s++){let n=s/(ct-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function ft(e){switch(e){case "linear":return "linear";case "ease-in":return Dt;case "ease-out":return Pt;case "ease-in-out":return Ct()?Rt(ve["ease-in-out"]):null;default:return null}}var mt=Symbol.for("svg-scroll-draw.registry");function pt(){let e=globalThis;return e[mt]||(e[mt]=new Map)}function dt(e,r){pt().set(e,r);}function yt(e){pt().delete(e);}var It=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function _t(e){let r=e.getAttribute("stroke"),s=e.getAttribute("fill");!r||r==="none"?de("Element has no stroke \u2014 path will not be visible.",e):s&&s!=="none"&&s!=="transparent"&&de("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Ft(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
|
+
<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 gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,ht=/[MmLlHhVvCcSsQqTtAaZz]/g;function Nt(e,r,s){if(!Pe)return;let n=(e.match(ht)??[]).join("").toUpperCase(),c=(r.match(ht)??[]).join("").toUpperCase(),f=(e.match(gt)??[]).length,g=(r.match(gt)??[]).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 bt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...n}=r,c=s?{...ut[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:wt=false,axis:te="y",scrollContainer:Ce,autoReverse:Ee=false,delay:ye=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ge=false,threshold:qe=0,rootMargin:Ge="0px",repeat:ie=0,repeatDelay:Re=0,morphTo:O,clip:Ie,autoplay:vt=false,duration:Et=1e3,native:St=true,onProgress:he,onStart:Se,onComplete:ce,onEnter:Be,onLeave:Ue,onEnterBack:je,onLeaveBack:Qe}=c,Y=Ie===true?"left":typeof Ie=="string"?Ie: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,R=Array.isArray(ne)?ne[0]:null,D=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,I=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,q=-1,$e=-1,k=false,G=0,Q=0,K,Oe=null;function Ke(){Oe?.destroy(),Oe=null;}let Z=new Set,Ze=NaN,J=true,xe=-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())),wt&&Pe&&(Ke(),Oe=Ft(W,j,te));}function Fe(t,o=tt){dt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let l=t.destroy;return t.destroy=()=>{l.call(t),yt(e);},t}function $t(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=De(H,L,t):L&&(l.style.stroke=L),R!==null&&D!==null?l.style.strokeWidth=`${R+(D-R)*t}`:D!==null&&(l.style.strokeWidth=`${D}`),I!==null&&P!==null?l.style.fillOpacity=`${I+(P-I)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),O&&l.tagName.toLowerCase()==="path"&&_[x]&&l.setAttribute("d",We(_[x],O,t));});}function Te(){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),R!==null&&(t.style.strokeWidth=`${R}`),I!==null&&(t.style.fillOpacity=`${I}`),O&&t.tagName.toLowerCase()==="path"&&_[o]&&t.setAttribute("d",_[o]);});}if(S.forEach(t=>{_t(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),O&&(l?Nt(_[_.length-1],O,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}`),O&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",O)):(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),R!==null&&(t.style.strokeWidth=`${R}`),I!==null&&(t.style.fillOpacity=`${I}`));}),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"?ft(v):null;function xt(){return !(St===false||!Ot()||!S.length||!nt||Y||te!=="y"||z||w!==1||U!==0||ee||Ee||ge!==false||O||oe||ie||ye>0||he||Se||ce||Be||Ue||je||Qe||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let t=++It,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(xt())return Fe(Tt());function At(){let t=Math.max(1,Et),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);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*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=De(H,L,C):L&&(y.style.stroke=L),R!==null&&D!==null?y.style.strokeWidth=`${R+(D-R)*C}`:D!==null&&(y.style.strokeWidth=`${D}`),I!==null&&P!==null?y.style.fillOpacity=`${I+(P-I)*C}`:P!==null&&(y.style.fillOpacity=`${P}`),O&&y.tagName.toLowerCase()==="path"&&_[i]&&y.setAttribute("d",We(_[i],O,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 B(a){if(k)return;let d=a-o;N||(N=true,Se?.());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(),Te(),M=requestAnimationFrame(B);},Re));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,G=0,Z.clear(),Te(),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:qe,rootMargin:Ge}),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));G=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),X(l);},getProgress(){return G},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if(vt)return Fe(At());rt();function Ae(){if(!fe||k)return;let t=performance.now(),o=_e();if(!J&&ge===false&&o===Ze){M=requestAnimationFrame(Ae);return}J=false,Ze=o;let l=w;if(ge!==false){let u=t-Je,m=u>0?Math.abs(o-(xe<0?o:xe))/u:0;l=w*Math.max(.2,1+m*(typeof ge=="number"?ge:1)*.04);}xe=o,Je=t;let x=Ee?$e===-1||o>=$e?"forward":"reverse":h;$e=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&&!Ee&&(q=Math.max(q,u),u=q),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,j,l)>0&&(N=true,Se?.()),u>=1&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{q=-1,N=false,A=false,e.style.clipPath=le(0);},Re))):u<1&&!ee&&(A=false),M=requestAnimationFrame(Ae);return}if(S.forEach((u,m)=>{let T=m*U*X,a=ae(ue(o,W+T,j+T,l));ee&&!Ee&&(q=Math.max(q,a),a=q),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=De(H,L,a):L&&(u.style.stroke=L),R!==null&&D!==null?u.style.strokeWidth=`${R+(D-R)*a}`:D!==null&&(u.style.strokeWidth=`${D}`),I!==null&&P!==null?u.style.fillOpacity=`${I+(P-I)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),O&&u.tagName.toLowerCase()==="path"&&_[m]&&u.setAttribute("d",We(_[m],O,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,Se?.()),B&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{q=-1,N=false,A=false,Z.clear(),Te(),J=true;},Re))):!B&&!ee&&(A=false),M=requestAnimationFrame(Ae);}let Ne=false;function Me(){Ne||(Ne=true,M=requestAnimationFrame(function(){Ae();}));}function ke(){Ne=false,cancelAnimationFrame(M);}let Ve=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(J=true,Me()):ke();});},{root:z??null,threshold:qe,rootMargin:Ge});function st(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),rt(),J=true;}let Le;function be(){clearTimeout(Le),Le=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),ke(),Ve.disconnect(),we?.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(Le),Ke();},replay(){q=-1,$e=-1,xe=-1,N=false,A=false,Q=0,k=false,G=0,Z.clear(),clearTimeout(K),Te(),J=true,fe&&Me();},pause(){k=true,ke();},resume(){k&&(k=false,J=true,fe&&Me());},seek(t){let o=Math.min(1,Math.max(0,t));G=o,q=o,k=true,ke(),$t(o,h),J=true;},getProgress(){return G},refresh(){clearTimeout(Le),st(),fe&&!k&&Me();}},()=>({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=bt(this,n);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function
|
|
2
|
-
<div style="position:absolute;${E?`left:${
|
|
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(r),window.addEventListener("scroll",c,{passive:true}),c(),{el:r,destroy(){window.removeEventListener("scroll",c),r.remove();}}}var ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,ft=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ct(e,n,s){if(!Pe)return;let r=(e.match(ft)??[]).join("").toUpperCase(),c=(n.match(ft)??[]).join("").toUpperCase(),f=(e.match(ct)??[]).length,y=(n.match(ct)??[]).length;if(r!==c){de(`morphTo: command sequence differs (${r||"\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!==y&&de(`morphTo: coordinate count differs (${f} \u2192 ${y}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,s);}function He(e,n,s){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),c=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,f=>{let y=parseFloat(f),w=r[c++]??y;return String(+(y+(w-y)*s).toFixed(4))})}function mt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...r}=n,c=s?{...at[s],...r}:r,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:y="path, polyline, line, polygon, rect, circle",speed:w=1,fade:E=false,easing:v="linear",trigger:$={},stagger:B=0,direction:g="forward",once:ee=false,debug:pt=false,axis:te="y",scrollContainer:Ce,autoReverse:Ee=false,delay:he=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ye=false,threshold:We=0,rootMargin:qe="0px",repeat:ie=0,repeatDelay:Oe=0,morphTo:R,clip:Ie,autoplay:dt=false,duration:ht=1e3,native:yt=true,onProgress:ge,onStart:Se,onComplete:ce,onEnter:Ge,onLeave:Be,onEnterBack:Ue,onLeaveBack:je}=c,X=Ie===true?"left":typeof Ie=="string"?Ie:false,ae=typeof v=="function"?v:ve[v]??ve.linear,Qe=Ve($.start??"top bottom"),Xe=Ve($.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,I=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(y)),p=[],F=[],U=0,Y=0,A=false,_=false,M=0,fe=false,W=-1,$e=-1,k=false,q=0,j=0,Z,Re=null;function Ye(){Re?.destroy(),Re=null;}let J=new Set,Ze=NaN,K=true,xe=-1,Je=performance.now(),me=NaN;function Fe(){return z?te==="x"?z.scrollLeft:z.scrollTop:te==="x"?window.scrollX:window.scrollY}function Ke(){return z?te==="x"?z.clientWidth:z.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function et(){let t=it(e,z,te),o=ze(t,t.scroll,Ke(),Qe,Xe);U=o.tStart,Y=o.tEnd,pt&&Pe&&(Ye(),Re=Pt(U,Y,te));}function gt(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=De(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}`),I!==null&&P!==null?l.style.fillOpacity=`${I+(P-I)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),R&&l.tagName.toLowerCase()==="path"&&F[x]&&l.setAttribute("d",He(F[x],R,t));});}function Te(){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=g==="reverse"?"0":`${p[o]}`,E?t.style.opacity=g==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),I!==null&&(t.style.fillOpacity=`${I}`),R&&t.tagName.toLowerCase()==="path"&&F[o]&&t.setAttribute("d",F[o]);});}if(S.forEach(t=>{Dt(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?F.push(t.getAttribute("d")??""):F.push(""),R&&(l?Ct(F[F.length-1],R,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),f?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=g==="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}`),R&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",R)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=g==="reverse"?"0":`${o}`,E?t.style.opacity=g==="reverse"?"1":"0":t.style.opacity="",H&&(t.style.stroke=H),O!==null&&(t.style.strokeWidth=`${O}`),I!==null&&(t.style.fillOpacity=`${I}`));}),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 tt=typeof v=="string"?ut(v):null;function bt(){return !(yt===false||!Lt()||!S.length||!tt||X||te!=="y"||z||w!==1||B!==0||ee||Ee||ye!==false||R||oe||ie||he>0||ge||Se||ce||Ge||Be||Ue||je||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function wt(){let t=++kt,o=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,x=`--svg-scroll-draw-${t}`,Q=g==="reverse"?"0":"var(--ssd-len)",G=g==="reverse"?"var(--ssd-len)":"0",V=`stroke-dashoffset:${Q};`,u=`stroke-dashoffset:${G};`;E&&(V+=`opacity:${g==="reverse"?1:0};`,u+=`opacity:${g==="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:${tt};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 h(){if(d>=0)return d;let i=e.getBoundingClientRect(),{tStart:b,tEnd:N}=ze({top:i.top,height:i.height},Fe(),Ke(),Qe,Xe);return ae(ue(Fe(),b,N,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((N,C)=>{N.classList.remove(o),N.style.strokeDashoffset=g==="reverse"?`${p[C]*b}`:`${p[C]*(1-b)}`,E&&(N.style.opacity=g==="reverse"?`${1-b}`:`${b}`);});},getProgress(){return h()},refresh(){S.forEach((i,b)=>{p[b]=pe(i),i.style.setProperty("--ssd-len",String(p[b])),i.style.strokeDasharray=`${p[b]}`;});}}}if(bt())return wt();function vt(){let t=Math.max(1,ht),o=0,l=0,x=false;function Q(a){let d=true;if(X){let h=Math.min(1,Math.max(0,a/t)),i=ae(h);q=i,e.style.setProperty("--scroll-draw-progress",String(i)),e.style.clipPath=le(g==="reverse"?1-i:i),ge?.(i),h<1&&(d=false);}else S.forEach((h,i)=>{let b=i*B*t,N=Math.min(1,Math.max(0,(a-b)/t)),C=ae(N);h.style.strokeDashoffset=g==="reverse"?`${p[i]*C}`:`${p[i]*(1-C)}`,E&&(h.style.opacity=g==="reverse"?`${1-C}`:`${C}`),H&&L?h.style.stroke=De(H,L,C):L&&(h.style.stroke=L),O!==null&&D!==null?h.style.strokeWidth=`${O+(D-O)*C}`:D!==null&&(h.style.strokeWidth=`${D}`),I!==null&&P!==null?h.style.fillOpacity=`${I+(P-I)*C}`:P!==null&&(h.style.fillOpacity=`${P}`),R&&h.tagName.toLowerCase()==="path"&&F[i]&&h.setAttribute("d",He(F[i],R,C)),i===0&&(q=C,ge?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),N<1&&(d=false);});if(oe){let h=Math.min(1,Math.max(0,a/t)),i=ae(h);for(let b in oe){let N=parseFloat(b);i>=N&&!J.has(N)&&(J.add(N),oe[b]?.());}}return d}function G(a){if(k)return;let d=a-o;_||(_=true,Se?.());let h=Q(d);if(h&&!A){A=true,Q(t*(1+Math.max(0,S.length-1)*B)),ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{o=performance.now(),_=false,A=false,J.clear(),Te(),M=requestAnimationFrame(G);},Oe));return}h||(M=requestAnimationFrame(G));}function V(){cancelAnimationFrame(M),clearTimeout(Z),o=performance.now(),l=0,k=false,_=false,A=false,j=0,x=true,q=0,J.clear(),Te(),M=requestAnimationFrame(G);}let u=new IntersectionObserver(a=>{a.forEach(d=>{d.isIntersecting&&!(ee&&A)?V():!d.isIntersecting&&!ee&&!A&&(cancelAnimationFrame(M),clearTimeout(Z),x=false);});},{root:z??null,threshold:We,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),he>0?setTimeout(()=>u.observe(e),he):u.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(Z),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(G));},seek(a){let d=Math.min(1,Math.max(0,a));q=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),Q(l);},getProgress(){return q},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if(dt)return vt();et();function Ae(){if(!fe||k)return;let t=performance.now(),o=Fe();if(!K&&ye===false&&o===Ze){M=requestAnimationFrame(Ae);return}K=false,Ze=o;let l=w;if(ye!==false){let u=t-Je,m=u>0?Math.abs(o-(xe<0?o:xe))/u:0;l=w*Math.max(.2,1+m*(typeof ye=="number"?ye:1)*.04);}xe=o,Je=t;let x=Ee?$e===-1||o>=$e?"forward":"reverse":g;$e=o;let Q=Y-U,G=true,V=Q===0?0:(o-U)/Q;if(isNaN(me)||(me<=0&&V>0?Ge?.():me>0&&V<=0&&je?.(),me<1&&V>=1?Be?.():me>=1&&V<1&&Ue?.()),me=V,X){let u=ae(ue(o,U,Y,l));ee&&!Ee&&(W=Math.max(W,u),u=W),q=u,e.style.setProperty("--scroll-draw-progress",String(u));let m=x==="reverse"?1-u:u;e.style.clipPath=le(m),ge?.(u),!_&&ue(o,U,Y,l)>0&&(_=true,Se?.()),u>=1&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{W=-1,_=false,A=false,e.style.clipPath=le(0);},Oe))):u<1&&!ee&&(A=false),M=requestAnimationFrame(Ae);return}if(S.forEach((u,m)=>{let T=m*B*Q,a=ae(ue(o,U+T,Y+T,l));ee&&!Ee&&(W=Math.max(W,a),a=W),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=De(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}`),I!==null&&P!==null?u.style.fillOpacity=`${I+(P-I)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),R&&u.tagName.toLowerCase()==="path"&&F[m]&&u.setAttribute("d",He(F[m],R,a)),m===0&&(ge?.(a),e.style.setProperty("--scroll-draw-progress",String(a))),a<1&&(G=false);}),oe){let u=ae(ue(o,U,Y,l));for(let m in oe){let T=parseFloat(m);u>=T&&!J.has(T)&&(J.add(T),oe[m]?.());}}!_&&ue(o,U,Y,l)>0&&(_=true,Se?.()),G&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,Z=setTimeout(()=>{W=-1,_=false,A=false,J.clear(),Te(),K=true;},Oe))):!G&&!ee&&(A=false),M=requestAnimationFrame(Ae);}let Ne=false;function Me(){Ne||(Ne=true,M=requestAnimationFrame(function(){Ae();}));}function ke(){Ne=false,cancelAnimationFrame(M);}let _e=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(K=true,Me()):ke();});},{root:z??null,threshold:We,rootMargin:qe});function rt(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),et(),K=true;}let Le;function be(){clearTimeout(Le),Le=setTimeout(rt,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)),he>0?setTimeout(()=>_e.observe(e),he):_e.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(Z),ke(),_e.disconnect(),we?.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(Le),Ye();},replay(){W=-1,$e=-1,xe=-1,_=false,A=false,j=0,k=false,q=0,J.clear(),clearTimeout(Z),Te(),K=true,fe&&Me();},pause(){k=true,ke();},resume(){k&&(k=false,K=true,fe&&Me());},seek(t){let o=Math.min(1,Math.max(0,t));q=o,W=o,k=true,ke(),gt(o,g),K=true;},getProgress(){return q},refresh(){clearTimeout(Le),rt(),fe&&!k&&Me();}}}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null;}connectedCallback(){let r={},c=this.getAttribute("speed"),f=this.getAttribute("easing"),y=this.getAttribute("stagger"),w=this.getAttribute("direction"),E=this.getAttribute("selector");c&&(r.speed=parseFloat(c)),f&&(r.easing=f),y&&(r.stagger=parseFloat(y)),w&&(r.direction=w),E&&(r.selector=E),this.hasAttribute("fade")&&(r.fade=this.getAttribute("fade")!=="false"),this.instance=mt(this,r);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
|
1
|
+
function Mt({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 U=(v-w[$])/(w[$+1]-w[$]);if($===0)return U*(2-U);let h=1-Math.pow(n,$);return h+(1-h)*(2*U-1)*(2*U-1)}return 1}}function kt({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 ve={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mt(),elastic:kt()};function ze(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 ot(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 it(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 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 Lt(e,r,s){return Math.min(s,Math.max(r,e))}function ue(e,r,s,n){return s===r?0:Lt((e-r)/(s-r)*n,0,1)}function lt(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 He(e,r,s,n,c){let f=ot(e.top,e.height,r,n.element)-it(n.viewport,s),g=ot(e.top,e.height,r,c.element)-it(c.viewport,s);return {tStart:f,tEnd:g}}function at(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 De(e,r,s){let n=at(e),c=at(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 ut={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 Pe=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){Pe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Dt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Pt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ct=33;function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Rt(e){let r=[];for(let s=0;s<ct;s++){let n=s/(ct-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function ft(e){switch(e){case "linear":return "linear";case "ease-in":return Dt;case "ease-out":return Pt;case "ease-in-out":return Ct()?Rt(ve["ease-in-out"]):null;default:return null}}var mt=Symbol.for("svg-scroll-draw.registry");function pt(){let e=globalThis;return e[mt]||(e[mt]=new Map)}function dt(e,r){pt().set(e,r);}function yt(e){pt().delete(e);}var It=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function _t(e){let r=e.getAttribute("stroke"),s=e.getAttribute("fill");!r||r==="none"?de("Element has no stroke \u2014 path will not be visible.",e):s&&s!=="none"&&s!=="transparent"&&de("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Ft(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
|
+
<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 gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,ht=/[MmLlHhVvCcSsQqTtAaZz]/g;function Nt(e,r,s){if(!Pe)return;let n=(e.match(ht)??[]).join("").toUpperCase(),c=(r.match(ht)??[]).join("").toUpperCase(),f=(e.match(gt)??[]).length,g=(r.match(gt)??[]).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 bt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:s,...n}=r,c=s?{...ut[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:wt=false,axis:te="y",scrollContainer:Ce,autoReverse:Ee=false,delay:ye=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ge=false,threshold:qe=0,rootMargin:Ge="0px",repeat:ie=0,repeatDelay:Re=0,morphTo:O,clip:Ie,autoplay:vt=false,duration:Et=1e3,native:St=true,onProgress:he,onStart:Se,onComplete:ce,onEnter:Be,onLeave:Ue,onEnterBack:je,onLeaveBack:Qe}=c,Y=Ie===true?"left":typeof Ie=="string"?Ie: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,R=Array.isArray(ne)?ne[0]:null,D=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,I=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,q=-1,$e=-1,k=false,G=0,Q=0,K,Oe=null;function Ke(){Oe?.destroy(),Oe=null;}let Z=new Set,Ze=NaN,J=true,xe=-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())),wt&&Pe&&(Ke(),Oe=Ft(W,j,te));}function Fe(t,o=tt){dt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let l=t.destroy;return t.destroy=()=>{l.call(t),yt(e);},t}function $t(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=De(H,L,t):L&&(l.style.stroke=L),R!==null&&D!==null?l.style.strokeWidth=`${R+(D-R)*t}`:D!==null&&(l.style.strokeWidth=`${D}`),I!==null&&P!==null?l.style.fillOpacity=`${I+(P-I)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),O&&l.tagName.toLowerCase()==="path"&&_[x]&&l.setAttribute("d",We(_[x],O,t));});}function Te(){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),R!==null&&(t.style.strokeWidth=`${R}`),I!==null&&(t.style.fillOpacity=`${I}`),O&&t.tagName.toLowerCase()==="path"&&_[o]&&t.setAttribute("d",_[o]);});}if(S.forEach(t=>{_t(t);let o=pe(t);p.push(o);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),O&&(l?Nt(_[_.length-1],O,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}`),O&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",O)):(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),R!==null&&(t.style.strokeWidth=`${R}`),I!==null&&(t.style.fillOpacity=`${I}`));}),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"?ft(v):null;function xt(){return !(St===false||!Ot()||!S.length||!nt||Y||te!=="y"||z||w!==1||U!==0||ee||Ee||ge!==false||O||oe||ie||ye>0||he||Se||ce||Be||Ue||je||Qe||re!=null||ne!=null||se!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let t=++It,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(xt())return Fe(Tt());function At(){let t=Math.max(1,Et),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);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*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=De(H,L,C):L&&(y.style.stroke=L),R!==null&&D!==null?y.style.strokeWidth=`${R+(D-R)*C}`:D!==null&&(y.style.strokeWidth=`${D}`),I!==null&&P!==null?y.style.fillOpacity=`${I+(P-I)*C}`:P!==null&&(y.style.fillOpacity=`${P}`),O&&y.tagName.toLowerCase()==="path"&&_[i]&&y.setAttribute("d",We(_[i],O,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 B(a){if(k)return;let d=a-o;N||(N=true,Se?.());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(),Te(),M=requestAnimationFrame(B);},Re));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,G=0,Z.clear(),Te(),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:qe,rootMargin:Ge}),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));G=d,k=true,l=d*t,o=performance.now()-l,cancelAnimationFrame(M),X(l);},getProgress(){return G},refresh(){clearTimeout(m),S.forEach((a,d)=>{p[d]=pe(a),a.style.strokeDasharray=`${p[d]}`;});}}}if(vt)return Fe(At());rt();function Ae(){if(!fe||k)return;let t=performance.now(),o=_e();if(!J&&ge===false&&o===Ze){M=requestAnimationFrame(Ae);return}J=false,Ze=o;let l=w;if(ge!==false){let u=t-Je,m=u>0?Math.abs(o-(xe<0?o:xe))/u:0;l=w*Math.max(.2,1+m*(typeof ge=="number"?ge:1)*.04);}xe=o,Je=t;let x=Ee?$e===-1||o>=$e?"forward":"reverse":h;$e=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&&!Ee&&(q=Math.max(q,u),u=q),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,j,l)>0&&(N=true,Se?.()),u>=1&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{q=-1,N=false,A=false,e.style.clipPath=le(0);},Re))):u<1&&!ee&&(A=false),M=requestAnimationFrame(Ae);return}if(S.forEach((u,m)=>{let T=m*U*X,a=ae(ue(o,W+T,j+T,l));ee&&!Ee&&(q=Math.max(q,a),a=q),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=De(H,L,a):L&&(u.style.stroke=L),R!==null&&D!==null?u.style.strokeWidth=`${R+(D-R)*a}`:D!==null&&(u.style.strokeWidth=`${D}`),I!==null&&P!==null?u.style.fillOpacity=`${I+(P-I)*a}`:P!==null&&(u.style.fillOpacity=`${P}`),O&&u.tagName.toLowerCase()==="path"&&_[m]&&u.setAttribute("d",We(_[m],O,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,Se?.()),B&&!A?(A=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{q=-1,N=false,A=false,Z.clear(),Te(),J=true;},Re))):!B&&!ee&&(A=false),M=requestAnimationFrame(Ae);}let Ne=false;function Me(){Ne||(Ne=true,M=requestAnimationFrame(function(){Ae();}));}function ke(){Ne=false,cancelAnimationFrame(M);}let Ve=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(J=true,Me()):ke();});},{root:z??null,threshold:qe,rootMargin:Ge});function st(){S.forEach((t,o)=>{p[o]=pe(t),t.style.strokeDasharray=`${p[o]}`;}),rt(),J=true;}let Le;function be(){clearTimeout(Le),Le=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),ke(),Ve.disconnect(),we?.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(Le),Ke();},replay(){q=-1,$e=-1,xe=-1,N=false,A=false,Q=0,k=false,G=0,Z.clear(),clearTimeout(K),Te(),J=true,fe&&Me();},pause(){k=true,ke();},resume(){k&&(k=false,J=true,fe&&Me());},seek(t){let o=Math.min(1,Math.max(0,t));G=o,q=o,k=true,ke(),$t(o,h),J=true;},getProgress(){return G},refresh(){clearTimeout(Le),st(),fe&&!k&&Me();}},()=>({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=bt(this,n);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}customElements.define("scroll-draw",e);}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svg-scroll-draw",
|
|
3
|
-
"version": "2.10.
|
|
4
|
-
"description": "Scroll-driven animation for the web
|
|
3
|
+
"version": "2.10.2",
|
|
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",
|
|
7
7
|
"scroll",
|
|
@@ -39,7 +39,24 @@
|
|
|
39
39
|
"bounce-easing",
|
|
40
40
|
"elastic-easing",
|
|
41
41
|
"spring-easing",
|
|
42
|
-
"physics-easing"
|
|
42
|
+
"physics-easing",
|
|
43
|
+
"scroll-reveal",
|
|
44
|
+
"reveal-on-scroll",
|
|
45
|
+
"parallax",
|
|
46
|
+
"scroll-pin",
|
|
47
|
+
"sticky",
|
|
48
|
+
"scroll-snap",
|
|
49
|
+
"split-text",
|
|
50
|
+
"text-animation",
|
|
51
|
+
"scroll-video",
|
|
52
|
+
"counter",
|
|
53
|
+
"gsap-alternative",
|
|
54
|
+
"scrolltrigger-alternative",
|
|
55
|
+
"aos-alternative",
|
|
56
|
+
"animation-timeline",
|
|
57
|
+
"view-timeline",
|
|
58
|
+
"scroll-timeline",
|
|
59
|
+
"typescript"
|
|
43
60
|
],
|
|
44
61
|
"homepage": "https://svg-scroll-draw.vercel.app",
|
|
45
62
|
"repository": {
|
|
@@ -56,11 +73,75 @@
|
|
|
56
73
|
},
|
|
57
74
|
"license": "MIT",
|
|
58
75
|
"bin": {
|
|
59
|
-
"svg-scroll-draw": "
|
|
76
|
+
"svg-scroll-draw": "dist/cli/init.js"
|
|
60
77
|
},
|
|
61
78
|
"main": "./dist/index.cjs",
|
|
62
79
|
"module": "./dist/index.mjs",
|
|
63
80
|
"types": "./dist/index.d.ts",
|
|
81
|
+
"typesVersions": {
|
|
82
|
+
"*": {
|
|
83
|
+
"react": [
|
|
84
|
+
"./dist/react/index.d.ts"
|
|
85
|
+
],
|
|
86
|
+
"vue": [
|
|
87
|
+
"./dist/vue/index.d.ts"
|
|
88
|
+
],
|
|
89
|
+
"svelte": [
|
|
90
|
+
"./dist/svelte/index.d.ts"
|
|
91
|
+
],
|
|
92
|
+
"solid": [
|
|
93
|
+
"./dist/solid/index.d.ts"
|
|
94
|
+
],
|
|
95
|
+
"angular": [
|
|
96
|
+
"./dist/angular/index.d.ts"
|
|
97
|
+
],
|
|
98
|
+
"astro": [
|
|
99
|
+
"./dist/astro/index.d.ts"
|
|
100
|
+
],
|
|
101
|
+
"nuxt": [
|
|
102
|
+
"./dist/nuxt/index.d.ts"
|
|
103
|
+
],
|
|
104
|
+
"group": [
|
|
105
|
+
"./dist/group/index.d.ts"
|
|
106
|
+
],
|
|
107
|
+
"cinematic": [
|
|
108
|
+
"./dist/cinematic/index.d.ts"
|
|
109
|
+
],
|
|
110
|
+
"timeline": [
|
|
111
|
+
"./dist/timeline/index.d.ts"
|
|
112
|
+
],
|
|
113
|
+
"web-component": [
|
|
114
|
+
"./dist/web-component/index.d.ts"
|
|
115
|
+
],
|
|
116
|
+
"video": [
|
|
117
|
+
"./dist/video/index.d.ts"
|
|
118
|
+
],
|
|
119
|
+
"text": [
|
|
120
|
+
"./dist/text/index.d.ts"
|
|
121
|
+
],
|
|
122
|
+
"devtools": [
|
|
123
|
+
"./dist/devtools/index.d.ts"
|
|
124
|
+
],
|
|
125
|
+
"pin": [
|
|
126
|
+
"./dist/pin/index.d.ts"
|
|
127
|
+
],
|
|
128
|
+
"snap": [
|
|
129
|
+
"./dist/snap/index.d.ts"
|
|
130
|
+
],
|
|
131
|
+
"lenis": [
|
|
132
|
+
"./dist/lenis/index.d.ts"
|
|
133
|
+
],
|
|
134
|
+
"reveal": [
|
|
135
|
+
"./dist/reveal/index.d.ts"
|
|
136
|
+
],
|
|
137
|
+
"progress": [
|
|
138
|
+
"./dist/progress/index.d.ts"
|
|
139
|
+
],
|
|
140
|
+
"horizontal": [
|
|
141
|
+
"./dist/horizontal/index.d.ts"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
64
145
|
"files": [
|
|
65
146
|
"dist",
|
|
66
147
|
"README.md",
|
|
@@ -68,110 +149,216 @@
|
|
|
68
149
|
],
|
|
69
150
|
"exports": {
|
|
70
151
|
".": {
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
152
|
+
"import": {
|
|
153
|
+
"types": "./dist/index.d.mts",
|
|
154
|
+
"default": "./dist/index.mjs"
|
|
155
|
+
},
|
|
156
|
+
"require": {
|
|
157
|
+
"types": "./dist/index.d.ts",
|
|
158
|
+
"default": "./dist/index.cjs"
|
|
159
|
+
}
|
|
74
160
|
},
|
|
75
161
|
"./react": {
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
162
|
+
"import": {
|
|
163
|
+
"types": "./dist/react/index.d.mts",
|
|
164
|
+
"default": "./dist/react/index.mjs"
|
|
165
|
+
},
|
|
166
|
+
"require": {
|
|
167
|
+
"types": "./dist/react/index.d.ts",
|
|
168
|
+
"default": "./dist/react/index.cjs"
|
|
169
|
+
}
|
|
79
170
|
},
|
|
80
171
|
"./vue": {
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
172
|
+
"import": {
|
|
173
|
+
"types": "./dist/vue/index.d.mts",
|
|
174
|
+
"default": "./dist/vue/index.mjs"
|
|
175
|
+
},
|
|
176
|
+
"require": {
|
|
177
|
+
"types": "./dist/vue/index.d.ts",
|
|
178
|
+
"default": "./dist/vue/index.cjs"
|
|
179
|
+
}
|
|
84
180
|
},
|
|
85
181
|
"./svelte": {
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
182
|
+
"import": {
|
|
183
|
+
"types": "./dist/svelte/index.d.mts",
|
|
184
|
+
"default": "./dist/svelte/index.mjs"
|
|
185
|
+
},
|
|
186
|
+
"require": {
|
|
187
|
+
"types": "./dist/svelte/index.d.ts",
|
|
188
|
+
"default": "./dist/svelte/index.cjs"
|
|
189
|
+
}
|
|
89
190
|
},
|
|
90
191
|
"./solid": {
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
192
|
+
"import": {
|
|
193
|
+
"types": "./dist/solid/index.d.mts",
|
|
194
|
+
"default": "./dist/solid/index.mjs"
|
|
195
|
+
},
|
|
196
|
+
"require": {
|
|
197
|
+
"types": "./dist/solid/index.d.ts",
|
|
198
|
+
"default": "./dist/solid/index.cjs"
|
|
199
|
+
}
|
|
94
200
|
},
|
|
95
201
|
"./angular": {
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
202
|
+
"import": {
|
|
203
|
+
"types": "./dist/angular/index.d.mts",
|
|
204
|
+
"default": "./dist/angular/index.mjs"
|
|
205
|
+
},
|
|
206
|
+
"require": {
|
|
207
|
+
"types": "./dist/angular/index.d.ts",
|
|
208
|
+
"default": "./dist/angular/index.cjs"
|
|
209
|
+
}
|
|
99
210
|
},
|
|
100
211
|
"./astro": {
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
212
|
+
"import": {
|
|
213
|
+
"types": "./dist/astro/index.d.mts",
|
|
214
|
+
"default": "./dist/astro/index.mjs"
|
|
215
|
+
},
|
|
216
|
+
"require": {
|
|
217
|
+
"types": "./dist/astro/index.d.ts",
|
|
218
|
+
"default": "./dist/astro/index.cjs"
|
|
219
|
+
}
|
|
104
220
|
},
|
|
105
221
|
"./nuxt": {
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
222
|
+
"import": {
|
|
223
|
+
"types": "./dist/nuxt/index.d.mts",
|
|
224
|
+
"default": "./dist/nuxt/index.mjs"
|
|
225
|
+
},
|
|
226
|
+
"require": {
|
|
227
|
+
"types": "./dist/nuxt/index.d.ts",
|
|
228
|
+
"default": "./dist/nuxt/index.cjs"
|
|
229
|
+
}
|
|
109
230
|
},
|
|
110
231
|
"./group": {
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
232
|
+
"import": {
|
|
233
|
+
"types": "./dist/group/index.d.mts",
|
|
234
|
+
"default": "./dist/group/index.mjs"
|
|
235
|
+
},
|
|
236
|
+
"require": {
|
|
237
|
+
"types": "./dist/group/index.d.ts",
|
|
238
|
+
"default": "./dist/group/index.cjs"
|
|
239
|
+
}
|
|
114
240
|
},
|
|
115
241
|
"./cinematic": {
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
242
|
+
"import": {
|
|
243
|
+
"types": "./dist/cinematic/index.d.mts",
|
|
244
|
+
"default": "./dist/cinematic/index.mjs"
|
|
245
|
+
},
|
|
246
|
+
"require": {
|
|
247
|
+
"types": "./dist/cinematic/index.d.ts",
|
|
248
|
+
"default": "./dist/cinematic/index.cjs"
|
|
249
|
+
}
|
|
119
250
|
},
|
|
120
251
|
"./timeline": {
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
252
|
+
"import": {
|
|
253
|
+
"types": "./dist/timeline/index.d.mts",
|
|
254
|
+
"default": "./dist/timeline/index.mjs"
|
|
255
|
+
},
|
|
256
|
+
"require": {
|
|
257
|
+
"types": "./dist/timeline/index.d.ts",
|
|
258
|
+
"default": "./dist/timeline/index.cjs"
|
|
259
|
+
}
|
|
124
260
|
},
|
|
125
261
|
"./web-component": {
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
262
|
+
"import": {
|
|
263
|
+
"types": "./dist/web-component/index.d.mts",
|
|
264
|
+
"default": "./dist/web-component/index.mjs"
|
|
265
|
+
},
|
|
266
|
+
"require": {
|
|
267
|
+
"types": "./dist/web-component/index.d.ts",
|
|
268
|
+
"default": "./dist/web-component/index.cjs"
|
|
269
|
+
}
|
|
129
270
|
},
|
|
130
271
|
"./video": {
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
272
|
+
"import": {
|
|
273
|
+
"types": "./dist/video/index.d.mts",
|
|
274
|
+
"default": "./dist/video/index.mjs"
|
|
275
|
+
},
|
|
276
|
+
"require": {
|
|
277
|
+
"types": "./dist/video/index.d.ts",
|
|
278
|
+
"default": "./dist/video/index.cjs"
|
|
279
|
+
}
|
|
134
280
|
},
|
|
135
281
|
"./text": {
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
282
|
+
"import": {
|
|
283
|
+
"types": "./dist/text/index.d.mts",
|
|
284
|
+
"default": "./dist/text/index.mjs"
|
|
285
|
+
},
|
|
286
|
+
"require": {
|
|
287
|
+
"types": "./dist/text/index.d.ts",
|
|
288
|
+
"default": "./dist/text/index.cjs"
|
|
289
|
+
}
|
|
139
290
|
},
|
|
140
291
|
"./devtools": {
|
|
141
|
-
"
|
|
142
|
-
|
|
143
|
-
|
|
292
|
+
"import": {
|
|
293
|
+
"types": "./dist/devtools/index.d.mts",
|
|
294
|
+
"default": "./dist/devtools/index.mjs"
|
|
295
|
+
},
|
|
296
|
+
"require": {
|
|
297
|
+
"types": "./dist/devtools/index.d.ts",
|
|
298
|
+
"default": "./dist/devtools/index.cjs"
|
|
299
|
+
}
|
|
144
300
|
},
|
|
145
301
|
"./pin": {
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
302
|
+
"import": {
|
|
303
|
+
"types": "./dist/pin/index.d.mts",
|
|
304
|
+
"default": "./dist/pin/index.mjs"
|
|
305
|
+
},
|
|
306
|
+
"require": {
|
|
307
|
+
"types": "./dist/pin/index.d.ts",
|
|
308
|
+
"default": "./dist/pin/index.cjs"
|
|
309
|
+
}
|
|
149
310
|
},
|
|
150
311
|
"./snap": {
|
|
151
|
-
"
|
|
152
|
-
|
|
153
|
-
|
|
312
|
+
"import": {
|
|
313
|
+
"types": "./dist/snap/index.d.mts",
|
|
314
|
+
"default": "./dist/snap/index.mjs"
|
|
315
|
+
},
|
|
316
|
+
"require": {
|
|
317
|
+
"types": "./dist/snap/index.d.ts",
|
|
318
|
+
"default": "./dist/snap/index.cjs"
|
|
319
|
+
}
|
|
154
320
|
},
|
|
155
321
|
"./lenis": {
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
322
|
+
"import": {
|
|
323
|
+
"types": "./dist/lenis/index.d.mts",
|
|
324
|
+
"default": "./dist/lenis/index.mjs"
|
|
325
|
+
},
|
|
326
|
+
"require": {
|
|
327
|
+
"types": "./dist/lenis/index.d.ts",
|
|
328
|
+
"default": "./dist/lenis/index.cjs"
|
|
329
|
+
}
|
|
159
330
|
},
|
|
160
331
|
"./reveal": {
|
|
161
|
-
"
|
|
162
|
-
|
|
163
|
-
|
|
332
|
+
"import": {
|
|
333
|
+
"types": "./dist/reveal/index.d.mts",
|
|
334
|
+
"default": "./dist/reveal/index.mjs"
|
|
335
|
+
},
|
|
336
|
+
"require": {
|
|
337
|
+
"types": "./dist/reveal/index.d.ts",
|
|
338
|
+
"default": "./dist/reveal/index.cjs"
|
|
339
|
+
}
|
|
164
340
|
},
|
|
165
341
|
"./progress": {
|
|
166
|
-
"
|
|
167
|
-
|
|
168
|
-
|
|
342
|
+
"import": {
|
|
343
|
+
"types": "./dist/progress/index.d.mts",
|
|
344
|
+
"default": "./dist/progress/index.mjs"
|
|
345
|
+
},
|
|
346
|
+
"require": {
|
|
347
|
+
"types": "./dist/progress/index.d.ts",
|
|
348
|
+
"default": "./dist/progress/index.cjs"
|
|
349
|
+
}
|
|
169
350
|
},
|
|
170
351
|
"./horizontal": {
|
|
171
|
-
"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
352
|
+
"import": {
|
|
353
|
+
"types": "./dist/horizontal/index.d.mts",
|
|
354
|
+
"default": "./dist/horizontal/index.mjs"
|
|
355
|
+
},
|
|
356
|
+
"require": {
|
|
357
|
+
"types": "./dist/horizontal/index.d.ts",
|
|
358
|
+
"default": "./dist/horizontal/index.cjs"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"./package.json": "./package.json"
|
|
175
362
|
},
|
|
176
363
|
"scripts": {
|
|
177
364
|
"build": "tsup",
|