svg-scroll-draw 2.10.1 → 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.
@@ -1,3 +1,3 @@
1
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
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.instance=bt(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 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.1",
4
- "description": "Scroll-driven animation for the web \u2014 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",
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",
@@ -73,11 +73,75 @@
73
73
  },
74
74
  "license": "MIT",
75
75
  "bin": {
76
- "svg-scroll-draw": "./dist/cli/init.js"
76
+ "svg-scroll-draw": "dist/cli/init.js"
77
77
  },
78
78
  "main": "./dist/index.cjs",
79
79
  "module": "./dist/index.mjs",
80
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
+ },
81
145
  "files": [
82
146
  "dist",
83
147
  "README.md",
@@ -85,110 +149,216 @@
85
149
  ],
86
150
  "exports": {
87
151
  ".": {
88
- "types": "./dist/index.d.ts",
89
- "import": "./dist/index.mjs",
90
- "require": "./dist/index.cjs"
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
+ }
91
160
  },
92
161
  "./react": {
93
- "types": "./dist/react/index.d.ts",
94
- "import": "./dist/react/index.mjs",
95
- "require": "./dist/react/index.cjs"
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
+ }
96
170
  },
97
171
  "./vue": {
98
- "types": "./dist/vue/index.d.ts",
99
- "import": "./dist/vue/index.mjs",
100
- "require": "./dist/vue/index.cjs"
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
+ }
101
180
  },
102
181
  "./svelte": {
103
- "types": "./dist/svelte/index.d.ts",
104
- "import": "./dist/svelte/index.mjs",
105
- "require": "./dist/svelte/index.cjs"
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
+ }
106
190
  },
107
191
  "./solid": {
108
- "types": "./dist/solid/index.d.ts",
109
- "import": "./dist/solid/index.mjs",
110
- "require": "./dist/solid/index.cjs"
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
+ }
111
200
  },
112
201
  "./angular": {
113
- "types": "./dist/angular/index.d.ts",
114
- "import": "./dist/angular/index.mjs",
115
- "require": "./dist/angular/index.cjs"
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
+ }
116
210
  },
117
211
  "./astro": {
118
- "types": "./dist/astro/index.d.ts",
119
- "import": "./dist/astro/index.mjs",
120
- "require": "./dist/astro/index.cjs"
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
+ }
121
220
  },
122
221
  "./nuxt": {
123
- "types": "./dist/nuxt/index.d.ts",
124
- "import": "./dist/nuxt/index.mjs",
125
- "require": "./dist/nuxt/index.cjs"
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
+ }
126
230
  },
127
231
  "./group": {
128
- "types": "./dist/group/index.d.ts",
129
- "import": "./dist/group/index.mjs",
130
- "require": "./dist/group/index.cjs"
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
+ }
131
240
  },
132
241
  "./cinematic": {
133
- "types": "./dist/cinematic/index.d.ts",
134
- "import": "./dist/cinematic/index.mjs",
135
- "require": "./dist/cinematic/index.cjs"
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
+ }
136
250
  },
137
251
  "./timeline": {
138
- "types": "./dist/timeline/index.d.ts",
139
- "import": "./dist/timeline/index.mjs",
140
- "require": "./dist/timeline/index.cjs"
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
+ }
141
260
  },
142
261
  "./web-component": {
143
- "types": "./dist/web-component/index.d.ts",
144
- "import": "./dist/web-component/index.mjs",
145
- "require": "./dist/web-component/index.cjs"
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
+ }
146
270
  },
147
271
  "./video": {
148
- "types": "./dist/video/index.d.ts",
149
- "import": "./dist/video/index.mjs",
150
- "require": "./dist/video/index.cjs"
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
+ }
151
280
  },
152
281
  "./text": {
153
- "types": "./dist/text/index.d.ts",
154
- "import": "./dist/text/index.mjs",
155
- "require": "./dist/text/index.cjs"
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
+ }
156
290
  },
157
291
  "./devtools": {
158
- "types": "./dist/devtools/index.d.ts",
159
- "import": "./dist/devtools/index.mjs",
160
- "require": "./dist/devtools/index.cjs"
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
+ }
161
300
  },
162
301
  "./pin": {
163
- "types": "./dist/pin/index.d.ts",
164
- "import": "./dist/pin/index.mjs",
165
- "require": "./dist/pin/index.cjs"
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
+ }
166
310
  },
167
311
  "./snap": {
168
- "types": "./dist/snap/index.d.ts",
169
- "import": "./dist/snap/index.mjs",
170
- "require": "./dist/snap/index.cjs"
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
+ }
171
320
  },
172
321
  "./lenis": {
173
- "types": "./dist/lenis/index.d.ts",
174
- "import": "./dist/lenis/index.mjs",
175
- "require": "./dist/lenis/index.cjs"
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
+ }
176
330
  },
177
331
  "./reveal": {
178
- "types": "./dist/reveal/index.d.ts",
179
- "import": "./dist/reveal/index.mjs",
180
- "require": "./dist/reveal/index.cjs"
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
+ }
181
340
  },
182
341
  "./progress": {
183
- "types": "./dist/progress/index.d.ts",
184
- "import": "./dist/progress/index.mjs",
185
- "require": "./dist/progress/index.cjs"
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
+ }
186
350
  },
187
351
  "./horizontal": {
188
- "types": "./dist/horizontal/index.d.ts",
189
- "import": "./dist/horizontal/index.mjs",
190
- "require": "./dist/horizontal/index.cjs"
191
- }
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"
192
362
  },
193
363
  "scripts": {
194
364
  "build": "tsup",