svg-scroll-draw 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +11 -9
  2. package/dist/angular/index.cjs +3 -3
  3. package/dist/angular/index.d.mts +1 -1
  4. package/dist/angular/index.d.ts +1 -1
  5. package/dist/angular/index.mjs +1 -1
  6. package/dist/astro/index.cjs +3 -3
  7. package/dist/astro/index.mjs +1 -1
  8. package/dist/cdn/svg-scroll-draw.dev.global.js +83 -29
  9. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  10. package/dist/chunk-2PYLM3E7.mjs +1 -0
  11. package/dist/chunk-DY5JCXVR.mjs +1 -0
  12. package/dist/{chunk-MTEGM4RR.mjs → chunk-GVBO5GRD.mjs} +1 -1
  13. package/dist/chunk-HX4SP5WN.mjs +3 -0
  14. package/dist/chunk-LTCJVVSC.mjs +1 -0
  15. package/dist/chunk-N6PDF6O6.mjs +2 -0
  16. package/dist/{chunk-SMRTRZSD.mjs → chunk-OTDD2ROH.mjs} +1 -1
  17. package/dist/{chunk-MENZ5DS4.mjs → chunk-PKY27MO4.mjs} +1 -1
  18. package/dist/chunk-VDTAYUAR.mjs +1 -0
  19. package/dist/chunk-WXUOF4NM.mjs +1 -0
  20. package/dist/cinematic/index.cjs +2 -2
  21. package/dist/cinematic/index.mjs +1 -1
  22. package/dist/{engine-DQyBzZDl.d.ts → engine-B7UpB4fT.d.ts} +2 -1
  23. package/dist/{engine-P8u6OK4m.d.mts → engine-o1VSQ1lX.d.mts} +2 -1
  24. package/dist/group/index.cjs +3 -3
  25. package/dist/group/index.d.mts +2 -2
  26. package/dist/group/index.d.ts +2 -2
  27. package/dist/group/index.mjs +1 -1
  28. package/dist/horizontal/index.cjs +1 -1
  29. package/dist/horizontal/index.d.mts +2 -1
  30. package/dist/horizontal/index.d.ts +2 -1
  31. package/dist/horizontal/index.mjs +1 -1
  32. package/dist/{index-CMqK0GCT.d.mts → index-BY-CNE8c.d.mts} +1 -1
  33. package/dist/{index-DPqPEnO-.d.ts → index-DqXXiDIk.d.ts} +1 -1
  34. package/dist/index.cjs +4 -4
  35. package/dist/index.d.mts +2 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.mjs +1 -1
  38. package/dist/nuxt/index.cjs +3 -3
  39. package/dist/nuxt/index.d.mts +1 -1
  40. package/dist/nuxt/index.d.ts +1 -1
  41. package/dist/nuxt/index.mjs +1 -1
  42. package/dist/react/index.cjs +3 -3
  43. package/dist/react/index.d.mts +1 -1
  44. package/dist/react/index.d.ts +1 -1
  45. package/dist/react/index.mjs +1 -1
  46. package/dist/reveal/index.cjs +1 -1
  47. package/dist/reveal/index.mjs +1 -1
  48. package/dist/snap/index.mjs +1 -1
  49. package/dist/solid/index.cjs +2 -2
  50. package/dist/solid/index.d.mts +1 -1
  51. package/dist/solid/index.d.ts +1 -1
  52. package/dist/solid/index.mjs +1 -1
  53. package/dist/svelte/index.cjs +3 -3
  54. package/dist/svelte/index.d.mts +1 -1
  55. package/dist/svelte/index.d.ts +1 -1
  56. package/dist/svelte/index.mjs +1 -1
  57. package/dist/text/index.cjs +1 -1
  58. package/dist/text/index.mjs +1 -1
  59. package/dist/timeline/index.mjs +1 -1
  60. package/dist/video/index.cjs +1 -1
  61. package/dist/video/index.mjs +1 -1
  62. package/dist/vue/index.cjs +3 -3
  63. package/dist/vue/index.d.mts +1 -1
  64. package/dist/vue/index.d.ts +1 -1
  65. package/dist/vue/index.mjs +1 -1
  66. package/dist/web-component/index.cjs +3 -3
  67. package/dist/web-component/index.mjs +1 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-426RAN5I.mjs +0 -1
  70. package/dist/chunk-7SBTYJGH.mjs +0 -1
  71. package/dist/chunk-BFX2CSQ3.mjs +0 -1
  72. package/dist/chunk-ENACACPZ.mjs +0 -3
  73. package/dist/chunk-KGAJQP2N.mjs +0 -2
  74. package/dist/chunk-KHQ7OGQK.mjs +0 -1
@@ -1 +0,0 @@
1
- import {b,a as a$3}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a,b as b$2,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$3}from'./chunk-BCV4RAIX.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';function Ae(t){return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")}function ge(t){let u=[],l=/([\w]+)\(([^)]*)\)/g,s;for(;(s=l.exec(t))!==null;){let a=[],o=[],m=s[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let r=i.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(r?parseFloat(r[1]):0),o.push(r?r[2]:"");}u.push({fn:s[1],nums:a,units:o});}return u}function He(t,u,l){let s=ge(t),a=ge(u);return s.length===0||s.length!==a.length?l<1?t:u:s.map((o,m)=>{let i=a[m];return o.fn!==i.fn||o.nums.length!==i.nums.length?l<1?`${o.fn}(${o.nums.map((r,g)=>`${r}${o.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((r,g)=>`${r}${i.units[g]}`).join(", ")})`:`${o.fn}(${o.nums.map((r,g)=>`${r+(i.nums[g]-r)*l}${o.units[g]}`).join(", ")})`}).join(" ")}function de(t,u,l){if(typeof t=="number"&&typeof u=="number")return String(t+(u-t)*l);let s=String(t),a=String(u);if(Ae(s))return a$3(s,a,l);if(s.includes("("))return He(s,a,l);let o=s.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(o&&m){let i=parseFloat(o[1]),r=parseFloat(m[1]);return `${i+(r-i)*l}${o[2]||m[2]}`}return l<1?s:a}function xe(t){return t.replace(/([A-Z])/g,u=>`-${u.toLowerCase()}`)}var Ce=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fe=0,ye="--scroll-draw-progress";function Ne(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function je(t,u){let l={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return l;let{props:s,trigger:a$3={},easing:o="ease-out",speed:m=1,once:i=false,axis:r="y",scrollContainer:g,native:he=true,velocityScale:H=false,respectReducedMotion:ve=true,triggerElement:Ee,onProgress:J,onComplete:R,onEnter:K,onLeave:Q,onEnterBack:ee,onLeaveBack:te}=u,be=ve&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,k=typeof o=="function"?o:d[o]??d["ease-out"],ne=a(a$3.start??"top bottom"),re=a(a$3.end??"bottom top"),x=Ee??t,d$2=typeof g=="string"?document.querySelector(g):g??null,y=Object.entries(s).map(([e,n])=>({prop:xe(e),from:Array.isArray(n)?n[0]:"",to:Array.isArray(n)?n[1]:n}));function we(){let e=window.getComputedStyle(t);for(let n of y)n.from===""&&(n.from=e.getPropertyValue(n.prop).trim()||"0");}function Se(){for(let e of y)t.style.setProperty(e.prop,String(e.to));}let V=new Map;for(let e of [...y.map(n=>n.prop),ye])V.set(e,t.style.getPropertyValue(e));function z(){for(let[e,n]of V)n?t.style.setProperty(e,n):t.style.removeProperty(e);}if(be)return Se(),R?.(),{...l,destroy:z,getProgress:()=>1};we();let oe=typeof o=="string"?b(o):null;function Te(){if(!he||!Ne()||!oe||r!=="y"||d$2||x!==t||i||m!==1||J||R||K||Q||ee||te||H!==false||(a$3.start??"top bottom").trim()!=="top bottom"||(a$3.end??"bottom top").trim()!=="bottom top")return false;for(let e of y)if(!Ce.has(e.prop))return false;return true}function Le(){let e=`ssd-a-${++Fe}`,n=y.map(f=>`${f.prop}:${f.from}`).join(";"),P=y.map(f=>`${f.prop}:${f.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${e}{from{${n}}to{${P}}}.${e}{animation-name:${e};animation-duration:auto;animation-timing-function:${oe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),t.classList.add(e);let c$1=()=>r==="x"?window.scrollX:window.scrollY,p=()=>r==="x"?window.innerWidth:window.innerHeight,M=()=>{let f=t.getBoundingClientRect();return c({top:f.top,height:f.height},c$1(),p(),ne,re)};a$1(t,{type:"animate",getProgress:()=>D.getProgress(),getTrigger:M});let D={refresh(){},destroy(){t.classList.remove(e),v.remove(),t.style.animationPlayState="",z(),b$3(t);},replay(){t.classList.remove(e),t.offsetWidth,t.classList.add(e);},pause(){t.style.animationPlayState="paused";},resume(){t.style.animationPlayState="";},seek(f){let _=Math.min(1,Math.max(0,f));t.classList.remove(e);for(let q of y)t.style.setProperty(q.prop,de(q.from,q.to,_));},getProgress(){let{tStart:f,tEnd:_}=M();return k(b$2(c$1(),f,_,m))}};return D}if(Te())return Le();let h=0,E=0,b$4=0,C=false,w=false,T=-1,L=0,F=false,S=NaN,O=-1,se=0,ie=()=>d$2?r==="x"?d$2.scrollLeft:d$2.scrollTop:r==="x"?window.scrollX:window.scrollY,Pe=()=>d$2?r==="x"?d$2.clientWidth:d$2.clientHeight:r==="x"?window.innerWidth:window.innerHeight,$=x===t?y:[],ae=false;function W(){let e=t.style,n=$.map(p=>e.getPropertyValue(p.prop)),P=e.transition;$.length&&(e.transition="none"),$.forEach(p=>e.setProperty(p.prop,V.get(p.prop)??""));let v=a$2(x,d$2,r);$.forEach((p,M)=>e.setProperty(p.prop,n[M])),$.length&&(t.offsetWidth,e.transition=P);let c$1=c(v,v.scroll,Pe(),ne,re);ae&&Math.abs(c$1.tStart-h)<1&&Math.abs(c$1.tEnd-E)<1||(ae=true,h=c$1.tStart,E=c$1.tEnd);}function N(e){t.style.setProperty(ye,String(e));for(let n of y)t.style.setProperty(n.prop,de(n.from,n.to,e));J?.(e);}function Me(e){if(isNaN(S)){S=e;return}S<=0&&e>0?K?.():S>0&&e<=0&&te?.(),S<1&&e>=1?Q?.():S>=1&&e<1&&ee?.(),S=e;}function B(){if(!C||w)return;let e=performance.now(),n=ie(),P=m;if(H!==false){let p=e-se,M=p>0?Math.abs(n-(O<0?n:O))/p:0;P=m*Math.max(.2,1+M*(typeof H=="number"?H:1)*.04);}O=n,se=e;let v=E===h?0:(n-h)/(E-h);Me(v);let c=k(b$2(n,h,E,P));i&&(T=Math.max(T,c),c=T),L=c,N(c),c>=1&&!F?(F=true,R?.()):c<1&&!i&&(F=false),b$4=requestAnimationFrame(B);}W(),E===h&&b$1("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",t);{let e=k(b$2(ie(),h,E,m));i&&e>0&&(T=e),L=e,N(e);}let le=new IntersectionObserver(e=>{e.forEach(n=>{C=n.isIntersecting,C&&!w?b$4=requestAnimationFrame(B):cancelAnimationFrame(b$4);});},{root:d$2??null}),j;function A(){clearTimeout(j),j=setTimeout(W,150);}window.addEventListener("resize",A),window.addEventListener("orientationchange",A);let $e=d$1([x],A);return le.observe(t),a$1(t,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(b$4),le.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),$e(),clearTimeout(j),z(),b$3(t);},replay(){T=-1,F=false,L=0,w=false,N(0);},pause(){w=true,cancelAnimationFrame(b$4);},resume(){w&&(w=false,C&&(b$4=requestAnimationFrame(B)));},seek(e){let n=Math.min(1,Math.max(0,e));L=n,T=n,w=true,cancelAnimationFrame(b$4),N(n);},getProgress(){return L},refresh(){W();}}}export{je as a};
@@ -1,3 +0,0 @@
1
- import {b as b$1,a as a$5}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a as a$1}from'./chunk-YZV4Z3EQ.mjs';import {a,d as d$1,c,b as b$3}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$4,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var yt={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 Mt=0;function Dt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function ht(r,w){let d="";try{d=getComputedStyle(r).getPropertyValue(w).trim();}catch{}return d||(r.getAttribute(w)??"").trim()}var gt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ct(r){if(!a$3)return;let w=ht(r,"stroke");if(!w||w==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let d=(r.getAttribute("fill")??"").trim();d&&!gt.has(d)&&!gt.has(ht(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function Ot(r,w,d){let b=document.createElement("div");b.setAttribute("data-svg-scroll-draw-debug",""),b.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 W(){let N=d==="x"?window.scrollX:window.scrollY,F=r-N,V=w-N,H=d==="x";b.innerHTML=`
2
- <div style="position:absolute;${H?`left:${F}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${F}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;${H?`left:${V}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${V}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(b),window.addEventListener("scroll",W,{passive:true}),W(),{el:b,destroy(){window.removeEventListener("scroll",W),b.remove();}}}var vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,wt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Nt(r,w,d){if(!a$3)return;let b$1=(r.match(wt)??[]).join("").toUpperCase(),W=(w.match(wt)??[]).join("").toUpperCase(),N=(r.match(vt)??[]).length,F=(w.match(vt)??[]).length;if(b$1!==W){b(`morphTo: command sequence differs (${b$1||"\u2205"} \u2192 ${W||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,d);return}N!==F&&b(`morphTo: coordinate count differs (${N} \u2192 ${F}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,d);}function _e(r,w,d){let b=(w.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),W=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,N=>{let F=parseFloat(N),V=b[W++]??F;return String(+(F+(V-F)*d).toFixed(4))})}function Ut(r,w={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:d$2,...b$4}=w,W=d$2?{...yt[d$2],...b$4}:b$4,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:F="path, polyline, line, polygon, rect, circle",speed:V=1,fade:H=false,easing:pe="linear",trigger:be={},stagger:J=0,direction:y="forward",once:K=false,debug:bt=false,axis:U="y",scrollContainer:Oe,autoReverse:$e=false,delay:de=0,strokeColor:ee,strokeWidth:te,fillOpacity:re,waypoints:se,velocityScale:ye=false,threshold:Ue=0,rootMargin:je="0px",repeat:oe=0,repeatDelay:Ne=0,morphTo:P,clip:Fe,autoplay:$t=false,duration:Et=1e3,native:Tt=true,onProgress:he,onStart:Ee,onComplete:le,onEnter:Xe,onLeave:Ye,onEnterBack:Qe,onLeaveBack:Ze}=W,j=Fe===true?"left":typeof Fe=="string"?Fe:false,ne=typeof pe=="function"?pe:d[pe]??d.linear,Je=a(be.start??"top bottom"),Ke=a(be.end??"bottom top"),R=typeof Oe=="string"?document.querySelector(Oe):Oe??null,q=Array.isArray(ee)?ee[0]:null,$=Array.isArray(ee)?ee[1]:typeof ee=="string"?ee:null,S=Array.isArray(te)?te[0]:null,E=Array.isArray(te)?te[1]:typeof te=="number"?te:null,x=Array.isArray(re)?re[0]:null,T=Array.isArray(re)?re[1]:typeof re=="number"?re:null;function ie(e){let t=e*100;switch(j){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let p=j?[]:Array.from(r.querySelectorAll(F)),l=[],L=[],M=0,D=0,Te=J,et=0,v=false,I=false,A=0,ke=false,X=-1,ge=[],Se=-1,h=false,G=0,_=0,Y,He=null;function tt(){He?.destroy(),He=null;}let Q=new Set,rt=NaN,Z=true,xe=-1,st=performance.now(),fe=NaN;function ve(){return R?U==="x"?R.scrollLeft:R.scrollTop:U==="x"?window.scrollX:window.scrollY}function ot(){return R?U==="x"?R.clientWidth:R.clientHeight:U==="x"?window.innerWidth:window.innerHeight}function nt(){let e=a$2(r,R,U);return c(e,e.scroll,ot(),Je,Ke)}function kt(){let e=D-M,t=p.length-1,o=R??document.documentElement,u=U==="x"?"Width":"Height";if(Te=J,J>0&&t>0&&e>0){let C=o[`scroll${u}`]-o[`client${u}`]-1-M-e/V;C>=0&&(Te=Math.min(J,C/(t*e)));}et=D+t*Te*e;}function it(){(({tStart:M,tEnd:D}=nt())),kt(),bt&&a$3&&(tt(),He=Ot(M,D,U));}function Re(e,t=nt){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let o=e.destroy;return e.destroy=()=>{o.call(e),b$2(r);},e}function St(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),j){let o=t==="reverse"?1-e:e;r.style.clipPath=ie(o);return}p.forEach((o,u)=>{o.style.strokeDashoffset=t==="reverse"?`${l[u]*e}`:`${l[u]*(1-e)}`,H&&(o.style.opacity=t==="reverse"?`${1-e}`:`${e}`),q&&$?o.style.stroke=a$5(q,$,e):$&&(o.style.stroke=$),S!==null&&E!==null?o.style.strokeWidth=`${S+(E-S)*e}`:E!==null&&(o.style.strokeWidth=`${E}`),x!==null&&T!==null?o.style.fillOpacity=`${x+(T-x)*e}`:T!==null&&(o.style.fillOpacity=`${T}`),P&&o.tagName.toLowerCase()==="path"&&L[u]&&o.setAttribute("d",_e(L[u],P,e));});}function Ae(){if(r.style.setProperty("--scroll-draw-progress","0"),j){r.style.clipPath=ie(0);return}p.forEach((e,t)=>{e.style.strokeDasharray=`${l[t]}`,e.style.strokeDashoffset=y==="reverse"?"0":`${l[t]}`,H?e.style.opacity=y==="reverse"?"1":"0":e.style.opacity="",q&&(e.style.stroke=q),S!==null&&(e.style.strokeWidth=`${S}`),x!==null&&(e.style.fillOpacity=`${x}`),P&&e.tagName.toLowerCase()==="path"&&L[t]&&e.setAttribute("d",L[t]);});}if(p.forEach(e=>{Ct(e);let t=a$1(e);l.push(t);let o=e.tagName.toLowerCase()==="path";o?L.push(e.getAttribute("d")??""):L.push(""),P&&(o?Nt(L[L.length-1],P,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),N?(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=y==="reverse"?`${t}`:"0",H&&(e.style.opacity="1"),$&&(e.style.stroke=$),E!==null&&(e.style.strokeWidth=`${E}`),T!==null&&(e.style.fillOpacity=`${T}`),P&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",P)):(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=y==="reverse"?"0":`${t}`,H?e.style.opacity=y==="reverse"?"1":"0":e.style.opacity="",q&&(e.style.stroke=q),S!==null&&(e.style.strokeWidth=`${S}`),x!==null&&(e.style.fillOpacity=`${x}`));}),j){if(N)return r.style.clipPath=ie(1),le?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};r.style.clipPath=ie(0);}else if(N)return le?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let at=typeof pe=="string"?b$1(pe):null;function xt(){return !(Tt===false||!Dt()||!p.length||!at||j||U!=="y"||R||V!==1||J!==0||K||$e||ye!==false||P||se||oe||de>0||he||Ee||le||Xe||Ye||Qe||Ze||ee!=null||te!=null||re!=null||(be.start??"top bottom").trim()!=="top bottom"||(be.end??"bottom top").trim()!=="bottom top")}function At(){let e=++Mt,t=`svg-scroll-draw-${e}`,o=`svg-scroll-draw-host-${e}`,u=`--svg-scroll-draw-${e}`,C=y==="reverse"?"0":"var(--ssd-len)",B=y==="reverse"?"var(--ssd-len)":"0",z=`stroke-dashoffset:${C};`,i=`stroke-dashoffset:${B};`;H&&(z+=`opacity:${y==="reverse"?1:0};`,i+=`opacity:${y==="reverse"?0:1};`);let a=document.createElement("style");a.setAttribute("data-svg-scroll-draw",""),a.textContent=`@keyframes ${t}{from{${z}}to{${i}}}.${o}{view-timeline-name:${u};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${at};animation-fill-mode:both;animation-timeline:${u};animation-range:cover 0% cover 100%;}`,document.head.appendChild(a),r.classList.add(o);function g(s,m){s.style.setProperty("--ssd-len",String(l[m])),s.style.strokeDasharray=`${l[m]}`,s.style.strokeDashoffset="",s.style.opacity="",s.style.animationPlayState="",s.classList.add(t);}p.forEach(g);let n=false,f=-1;function c$1(){if(f>=0)return f;let s=r.getBoundingClientRect(),{tStart:m,tEnd:O}=c({top:s.top,height:s.height},ve(),ot(),Je,Ke);return ne(b$3(ve(),m,O,V))}return {destroy(){r.classList.remove(o),p.forEach(s=>{s.classList.remove(t),s.style.removeProperty("--ssd-len"),s.style.animationPlayState="";}),a.remove();},replay(){n=false,f=-1,p.forEach(g);},pause(){n=true,p.forEach(s=>{s.style.animationPlayState="paused";});},resume(){n&&(n=false,p.forEach(s=>{s.style.animationPlayState="running";}));},seek(s){let m=Math.min(1,Math.max(0,s));f=m,n=true,p.forEach((O,k)=>{O.classList.remove(t),O.style.strokeDashoffset=y==="reverse"?`${l[k]*m}`:`${l[k]*(1-m)}`,H&&(O.style.opacity=y==="reverse"?`${1-m}`:`${m}`);});},getProgress(){return c$1()},refresh(){p.forEach((s,m)=>{l[m]=a$1(s),s.style.setProperty("--ssd-len",String(l[m])),s.style.strokeDasharray=`${l[m]}`;});}}}if(xt())return Re(At());function Pt(){let e=Math.max(1,Et),t=0,o=0,u=false;function C(n){let f=true;if(j){let c=Math.min(1,Math.max(0,n/e)),s=ne(c);G=s,r.style.setProperty("--scroll-draw-progress",String(s)),r.style.clipPath=ie(y==="reverse"?1-s:s),he?.(s),c<1&&(f=false);}else p.forEach((c,s)=>{let m=s*J*e,O=Math.min(1,Math.max(0,(n-m)/e)),k=ne(O);c.style.strokeDashoffset=y==="reverse"?`${l[s]*k}`:`${l[s]*(1-k)}`,H&&(c.style.opacity=y==="reverse"?`${1-k}`:`${k}`),q&&$?c.style.stroke=a$5(q,$,k):$&&(c.style.stroke=$),S!==null&&E!==null?c.style.strokeWidth=`${S+(E-S)*k}`:E!==null&&(c.style.strokeWidth=`${E}`),x!==null&&T!==null?c.style.fillOpacity=`${x+(T-x)*k}`:T!==null&&(c.style.fillOpacity=`${T}`),P&&c.tagName.toLowerCase()==="path"&&L[s]&&c.setAttribute("d",_e(L[s],P,k)),s===0&&(G=k,he?.(k),r.style.setProperty("--scroll-draw-progress",String(k))),O<1&&(f=false);});if(se){let c=Math.min(1,Math.max(0,n/e)),s=ne(c);for(let m in se){let O=parseFloat(m);s>=O&&!Q.has(O)&&(Q.add(O),se[m]?.());}}return f}function B(n){if(h)return;let f=n-t;I||(I=true,Ee?.());let c=C(f);if(c&&!v){v=true,C(e*(1+Math.max(0,p.length-1)*J)),le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{t=performance.now(),I=false,v=false,Q.clear(),Ae(),A=requestAnimationFrame(B);},Ne));return}c||(A=requestAnimationFrame(B));}function z(){cancelAnimationFrame(A),clearTimeout(Y),t=performance.now(),o=0,h=false,I=false,v=false,_=0,u=true,G=0,Q.clear(),Ae(),A=requestAnimationFrame(B);}let i=new IntersectionObserver(n=>{n.forEach(f=>{f.isIntersecting&&!(K&&v)?z():!f.isIntersecting&&!K&&!v&&(cancelAnimationFrame(A),clearTimeout(Y),u=false);});},{root:R??null,threshold:Ue,rootMargin:je}),a;function g(){clearTimeout(a),a=setTimeout(()=>{p.forEach((n,f)=>{l[f]=a$1(n),n.style.strokeDasharray=`${l[f]}`;});},150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),de>0?setTimeout(()=>i.observe(r),de):i.observe(r),{destroy(){cancelAnimationFrame(A),clearTimeout(Y),i.disconnect(),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(a);},replay(){_=0,z();},pause(){h||!u||(h=true,o=performance.now()-t,cancelAnimationFrame(A));},resume(){h&&(h=false,u=true,t=performance.now()-o,A=requestAnimationFrame(B));},seek(n){let f=Math.min(1,Math.max(0,n));G=f,h=true,o=f*e,t=performance.now()-o,cancelAnimationFrame(A),C(o);},getProgress(){return G},refresh(){clearTimeout(a),p.forEach((n,f)=>{l[f]=a$1(n),n.style.strokeDasharray=`${l[f]}`;});}}}if($t)return Re(Pt());it();function lt(){if(h||!ce)return;let e=performance.now(),t=ve();if(!Z&&ye===false&&t===rt){ze(t);return}Z=false,rt=t;let o=V;if(ye!==false){let i=e-st,a=i>0?Math.abs(t-(xe<0?t:xe))/i:0;o=V*Math.max(.2,1+a*(typeof ye=="number"?ye:1)*.04);}xe=t,st=e;let u=$e?Se===-1||t>=Se?"forward":"reverse":y;Se=t;let C=D-M,B=true,z=C===0?0:(t-M)/C;if(isNaN(fe)||(fe<=0&&z>0?Xe?.():fe>0&&z<=0&&Ze?.(),fe<1&&z>=1?Ye?.():fe>=1&&z<1&&Qe?.()),fe=z,j){let i=ne(b$3(t,M,D,o));K&&!$e&&(X=Math.max(X,i),i=X),G=i,r.style.setProperty("--scroll-draw-progress",String(i));let a=u==="reverse"?1-i:i;r.style.clipPath=ie(a),he?.(i),!I&&b$3(t,M,D,o)>0&&(I=true,Ee?.()),i>=1&&!v?(v=true,le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{X=-1,I=false,v=false,r.style.clipPath=ie(0);},Ne))):i<1&&!K&&(v=false),ze(t);return}if(p.forEach((i,a)=>{let g=a*Te*C,n=ne(b$3(t,M+g,D+g,o));K&&!$e&&(n=ge[a]=Math.max(ge[a]??X,n)),i.style.strokeDashoffset=u==="reverse"?`${l[a]*n}`:`${l[a]*(1-n)}`,H&&(i.style.opacity=u==="reverse"?`${1-n}`:`${n}`),q&&$?i.style.stroke=a$5(q,$,n):$&&(i.style.stroke=$),S!==null&&E!==null?i.style.strokeWidth=`${S+(E-S)*n}`:E!==null&&(i.style.strokeWidth=`${E}`),x!==null&&T!==null?i.style.fillOpacity=`${x+(T-x)*n}`:T!==null&&(i.style.fillOpacity=`${T}`),P&&i.tagName.toLowerCase()==="path"&&L[a]&&i.setAttribute("d",_e(L[a],P,n)),a===0&&(G=n,he?.(n),r.style.setProperty("--scroll-draw-progress",String(n))),n<1&&(B=false);}),se){let i=ne(b$3(t,M,D,o));for(let a in se){let g=parseFloat(a);i>=g&&!Q.has(g)&&(Q.add(g),se[a]?.());}}!I&&b$3(t,M,D,o)>0&&(I=true,Ee?.()),B&&!v?(v=true,le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{X=-1,ge=[],I=false,v=false,Q.clear(),Ae(),Z=true;},Ne))):!B&&!K&&(v=false),ze(t);}function Ie(e){return e>=D&&e<et}function ze(e){ke||Ie(e)?A=requestAnimationFrame(lt):ce=false;}function We(){return ke||Ie(ve())}let ce=false;function Pe(){ce||(ce=true,A=requestAnimationFrame(function(){lt();}));}function Le(){ce=false,cancelAnimationFrame(A);}let Ve=new IntersectionObserver(e=>{e.forEach(t=>{ke=t.isIntersecting,ke&&!h?(Z=true,Pe()):ce&&!h&&Ie(ve())||Le();});},{root:R??null,threshold:Ue,rootMargin:je});function ft(){p.forEach((e,t)=>{l[t]=a$1(e),e.style.strokeDasharray=`${l[t]}`;}),it(),Z=true;}let Me;function we(){clearTimeout(Me),Me=setTimeout(ft,150);}window.addEventListener("resize",we),window.addEventListener("orientationchange",we);let Lt=d$1([r],we);return de>0?setTimeout(()=>Ve.observe(r),de):Ve.observe(r),Re({destroy(){cancelAnimationFrame(A),clearTimeout(Y),Le(),Ve.disconnect(),Lt(),window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we),clearTimeout(Me),tt();},replay(){X=-1,ge=[],Se=-1,xe=-1,I=false,v=false,_=0,h=false,G=0,Q.clear(),clearTimeout(Y),Ae(),Z=true,We()&&Pe();},pause(){h=true,Le();},resume(){h&&(h=false,Z=true,We()&&Pe());},seek(e){let t=Math.min(1,Math.max(0,e));G=t,X=t,ge=[],h=true,Le(),St(t,y),Z=true;},getProgress(){return G},refresh(){clearTimeout(Me),ft(),We()&&!h&&Pe();}},()=>({tStart:M,tEnd:D}))}export{yt as a,Ut as b};
@@ -1,2 +0,0 @@
1
- import {d}from'./chunk-DM6EDKWH.mjs';import {a,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C="http://www.w3.org/2000/svg",M="cinematic-photo",y=a=>a<0?0:a>1?1:a;function u(a){let i=parseFloat(a);return Number.isFinite(i)?y(i/100):0}function I(a){return d[a]??d.linear}var P={destroy:()=>{},getProgress:()=>0},H=class{constructor(i){if(typeof document>"u"){this.mount=null;return}this.mount=typeof i.wrapper=="string"?document.querySelector(i.wrapper):i.wrapper,this.mount||b("Cinematic: wrapper not found:",i.wrapper);}loadStory(i){let s=this.mount;if(typeof window>"u"||!s)return P;s.style.position="relative",s.style.height=i.totalHeight,s.style.display="block";let c=document.createElement("div");c.setAttribute("data-cinematic-stage",""),c.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",s.appendChild(c);let p=[];for(let n of i.scenes){if(n.background){let t=document.createElement("img");t.id=M,t.src=n.background,t.alt="",t.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",c.appendChild(t);}let e=n.animations.filter(t=>t.type==="draw");if(e.length){let t=document.createElementNS(C,"svg");t.setAttribute("viewBox",`0 0 ${i.canvas.width} ${i.canvas.height}`),t.setAttribute("preserveAspectRatio","xMidYMid meet"),t.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",c.appendChild(t);for(let o of e){let r=document.createElementNS(C,"path");r.id=o.target.replace(/^#/,""),r.setAttribute("d",o.d),r.setAttribute("fill","none"),r.setAttribute("stroke",o.stroke),r.setAttribute("stroke-width",String(o.strokeWidth)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");let h=o.length||r.getTotalLength?.()||0;r.style.strokeDasharray=String(h),r.style.strokeDashoffset=String(h),t.appendChild(r),p.push({kind:"draw",el:r,start:u(o.start),end:u(o.end),ease:I(o.easing),length:h});}}for(let t of n.animations){if(t.type!=="fade")continue;let o=c.querySelector(t.target)??document.querySelector(t.target);o&&(o.style.opacity=String(t.from),p.push({kind:"fade",el:o,start:u(t.start),end:u(t.end),ease:d["ease-in-out"]??d.linear,from:t.from,to:t.to}));}}let d$1=0,b=()=>{let n=s.offsetHeight-window.innerHeight;return n<=0?s.getBoundingClientRect().top<=0?1:0:y(-s.getBoundingClientRect().top/n)},f=n=>{for(let e of p){let t=e.end-e.start,o=t<=0?n>=e.end?1:0:y((n-e.start)/t),r=e.ease(o);e.kind==="draw"?e.el.style.strokeDashoffset=String(e.length*(1-r)):e.el.style.opacity=String(e.from+(e.to-e.from)*r);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let g=0,m=false,w=false,S=()=>{d$1=b(),f(d$1),m&&(g=requestAnimationFrame(S));},T=()=>{m||(m=true,g=requestAnimationFrame(S));},v=()=>{m=false,cancelAnimationFrame(g);},A=new IntersectionObserver(n=>{for(let e of n)w=e.isIntersecting,w?T():v();},{threshold:0});return A.observe(c),d$1=b(),f(d$1),a(s,{type:"draw",getProgress:()=>d$1,getTrigger:()=>{let n=s.getBoundingClientRect().top+window.scrollY;return {tStart:n,tEnd:n+Math.max(0,s.offsetHeight-window.innerHeight)}}}),{destroy(){v(),A.disconnect(),b$1(s);},getProgress:()=>d$1}}};
2
- export{H as a};
@@ -1 +0,0 @@
1
- import {a,b as b$1,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function X(m,H){if(typeof window>"u")return C;let E=typeof m=="string"?document.querySelector(m):m;if(!E)return b("scrollCounter: element not found:",m),C;let r=E,{from:T=0,to:A,format:_,easing:p="ease-out",trigger:F={},once:g=true,decimals:M,onComplete:x}=H,I=M!==void 0?e=>e.toFixed(M):_??(e=>String(Math.round(e))),P=typeof p=="function"?p:d[p]??d["ease-out"],B=a(F.start??"top 80%"),G=a(F.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r.textContent=I(A),x?.(),C;let a$2=0,c$1=0,z=false,n=0,u=false,o=false,i=-1,s=0,f=false,w=()=>window.scrollY,V=()=>window.innerHeight;function L(){let e=r.getBoundingClientRect(),t=c({top:e.top,height:e.height},w(),V(),B,G);z&&Math.abs(t.tStart-a$2)<1&&Math.abs(t.tEnd-c$1)<1||(z=true,a$2=t.tStart,c$1=t.tEnd);}function d$2(e){r.textContent=I(T+(A-T)*e),r.style.setProperty("--scroll-draw-progress",String(e));}function h(){if(!u||o)return;let e=P(b$1(w(),a$2,c$1,1));g&&(i=Math.max(i,e),e=i),s=e,d$2(e),e>=1&&!f?(f=true,x?.()):e<1&&!g&&(f=false),n=requestAnimationFrame(h);}L();{let e=P(b$1(w(),a$2,c$1,1));g&&e>0&&(i=e),s=e,d$2(e);}let O=new IntersectionObserver(e=>{e.forEach(t=>{u=t.isIntersecting,u&&!o?n=requestAnimationFrame(h):cancelAnimationFrame(n);});}),b$3;function l(){clearTimeout(b$3),b$3=setTimeout(L,150);}window.addEventListener("resize",l),window.addEventListener("orientationchange",l);let Y=d$1([r],l);return O.observe(r),a$1(r,{type:"counter",getProgress:()=>s,getTrigger:()=>({tStart:a$2,tEnd:c$1})}),{destroy(){cancelAnimationFrame(n),O.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),Y(),clearTimeout(b$3),b$2(r);},replay(){i=-1,f=false,s=0,o=false,d$2(0);},pause(){o=true,cancelAnimationFrame(n);},resume(){o&&(o=false,u&&(n=requestAnimationFrame(h)));},seek(e){let t=Math.min(1,Math.max(0,e));s=t,i=t,o=true,cancelAnimationFrame(n),d$2(t);},getProgress(){return s}}}export{X as a};