svg-scroll-draw 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -15
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +60 -6
- package/dist/angular/index.d.ts +60 -6
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +3 -3
- package/dist/astro/index.d.ts +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +69 -31
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-5SJE7725.mjs +1 -0
- package/dist/{chunk-NX74KN5X.mjs → chunk-5U4JXBHR.mjs} +1 -1
- package/dist/chunk-7LDSB4FT.mjs +1 -0
- package/dist/chunk-ASCOHQQD.mjs +2 -0
- package/dist/chunk-GBFWTY5L.mjs +1 -0
- package/dist/chunk-HAGTU5EX.mjs +1 -0
- package/dist/chunk-HJTHOZK5.mjs +1 -0
- package/dist/chunk-IXR6RML7.mjs +1 -0
- package/dist/chunk-KN2YB54Z.mjs +1 -0
- package/dist/chunk-NJV6S5LD.mjs +1 -0
- package/dist/chunk-UBH4K5YD.mjs +1 -0
- package/dist/chunk-UF3MO5XQ.mjs +1 -0
- package/dist/chunk-XLXVGQ3P.mjs +3 -0
- package/dist/chunk-YOOPMYT6.mjs +1 -0
- package/dist/chunk-Z72TVDHY.mjs +1 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +3 -1
- package/dist/cinematic/index.d.ts +3 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-6VsjEwzb.d.ts → engine-Bi2x8-X-.d.mts} +2 -2
- package/dist/{engine-BLWKCfxC.d.mts → engine-DAlvk6i0.d.ts} +2 -2
- package/dist/frames/index.cjs +1 -1
- package/dist/frames/index.d.mts +2 -2
- package/dist/frames/index.d.ts +2 -2
- package/dist/frames/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +3 -3
- package/dist/group/index.d.ts +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +2 -2
- package/dist/horizontal/index.d.ts +2 -2
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-BN8yKeQ3.d.ts → index-BMMZ8aW7.d.mts} +2 -2
- package/dist/{index-hSQqLVbg.d.ts → index-CEMsUTEG.d.ts} +3 -3
- package/dist/{index-DAiRJgtF.d.mts → index-ClAFxNEp.d.mts} +3 -3
- package/dist/{index-DVjblK_4.d.mts → index-MdQ4ti_z.d.ts} +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/lenis/index.cjs +1 -1
- package/dist/lenis/index.d.mts +15 -16
- package/dist/lenis/index.d.ts +15 -16
- package/dist/lenis/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +4 -3
- package/dist/nuxt/index.d.ts +4 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +2 -2
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +4 -4
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +2 -2
- package/dist/reveal/index.d.ts +2 -2
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-Fzir8hlU.d.mts → scroll-draw-CKZysh22.d.mts} +1 -1
- package/dist/{scroll-draw-BsU_Ohmu.d.ts → scroll-draw-DbY8RUJE.d.ts} +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +2 -2
- package/dist/snap/index.d.ts +2 -2
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +40 -4
- package/dist/solid/index.d.ts +40 -4
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +47 -4
- package/dist/svelte/index.d.ts +47 -4
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +2 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +10 -10
- package/dist/timeline/index.d.mts +2 -2
- package/dist/timeline/index.d.ts +2 -2
- package/dist/timeline/index.mjs +2 -2
- package/dist/{types-9bcJdVcg.d.mts → types-iITMwrru.d.mts} +10 -2
- package/dist/{types-9bcJdVcg.d.ts → types-iITMwrru.d.ts} +10 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +2 -2
- package/dist/video/index.d.ts +2 -2
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +4 -7
- package/dist/vue/index.d.ts +4 -7
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/dist/wrapper-BOHrDnBO.d.mts +8 -0
- package/dist/wrapper-Cm7JTIVl.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-22P4KBPG.mjs +0 -1
- package/dist/chunk-32ZCSGFZ.mjs +0 -1
- package/dist/chunk-7USW2XFB.mjs +0 -1
- package/dist/chunk-7XOFQCQE.mjs +0 -3
- package/dist/chunk-BDXWPUBJ.mjs +0 -2
- package/dist/chunk-BRV2B2YW.mjs +0 -1
- package/dist/chunk-D2BHE4F2.mjs +0 -1
- package/dist/chunk-QZKYGS74.mjs +0 -1
- package/dist/chunk-THPTANES.mjs +0 -1
- package/dist/chunk-U5TKLHGW.mjs +0 -1
- package/dist/chunk-V3Z6G5JE.mjs +0 -1
- package/dist/chunk-WKOT2MND.mjs +0 -1
- package/dist/chunk-XSVTHCLO.mjs +0 -1
package/dist/group/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance, a as ScrollDrawOptions } from '../types-
|
|
2
|
-
import { S as ScrollParallaxOptions } from '../index-
|
|
3
|
-
import { S as ScrollAnimateOptions } from '../engine-
|
|
1
|
+
import { S as ScrollDrawInstance, a as ScrollDrawOptions } from '../types-iITMwrru.js';
|
|
2
|
+
import { S as ScrollParallaxOptions } from '../index-CEMsUTEG.js';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-DAlvk6i0.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animate multiple SVG containers simultaneously with the same options.
|
package/dist/group/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'../chunk-
|
|
1
|
+
import {b as b$1}from'../chunk-UBH4K5YD.mjs';import {a as a$1}from'../chunk-HAGTU5EX.mjs';import {b}from'../chunk-XLXVGQ3P.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';function u(s){return s.map(o=>typeof o=="string"?document.querySelector(o):o).filter(o=>o!==null)}var a={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function y(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function E(s,o={}){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return b(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function d(s,o){if(typeof window>"u")return a;let r=u(s).map(e=>a$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function w(s,o){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return a$1(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function S(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}export{d as scrollAnimateGroup,w as scrollAnimateSequence,y as scrollDrawGroup,E as scrollDrawSequence,S as scrollParallaxGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function Fe({tension:e=2.5,friction:t=2.2}={}){return n=>1-Math.cos(n*Math.PI*e)*Math.pow(1-n,t)}function Ve({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),i=0,a=[];for(let u=0;u<n;u++){let d=Math.pow(o,u);a.push(d),i+=d;}let f=[0],c=0;for(let u=0;u<n;u++)c+=a[u]/i,f.push(c);return u=>{if(u<=0)return 0;if(u>=1)return 1;for(let d=0;d<n;d++)if(u<=f[d+1]){let h=(u-f[d])/(f[d+1]-f[d]);if(d===0)return h*(2-h);let w=1-Math.pow(r,d);return w+(1-w)*(2*h-1)*(2*h-1)}return 1}}function Be({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)+1}var Q={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:Fe(),bounce:Ve(),elastic:Be()};function be(e,t,n){return Math.min(n,Math.max(t,e))}function ie(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}var Ee=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function ye(e,t,n,r){return e+n+t*Ee(r,0)}function he(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Ee(e,1))}function q(e,t,n,r){return n===t?0:be((e-t)/(n-t)*r,0,1)}function se(e,t,n,r,o){let i=ye(e.top,e.height,t,r.element)-he(r.viewport,n),a=ye(e.top,e.height,t,o.element)-he(o.viewport,n);return {tStart:i,tEnd:a}}function ve(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function we(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function Se(e,t,n){let r=we(e),o=we(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var Ge="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Qe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Me=33;function qe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function je(e){let t=[];for(let n=0;n<Me;n++){let r=n/(Me-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function Le(e){switch(e){case "linear":return "linear";case "ease-in":return Ge;case "ease-out":return Qe;case "ease-in-out":return qe()?je(Q["ease-in-out"]):null;default:return null}}var Te=Symbol.for("svg-scroll-draw.registry");function xe(){let e=globalThis;return e[Te]||(e[Te]=new Map)}function ae(e,t){xe().set(e,t);}function ue(e){xe().delete(e);}var Ye=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function j(e,...t){Ye&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Pe(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Re(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=Pe(i=>{if(!i)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let i of Object.keys(n))o[i]=(...a)=>n[i]?.(...a);return o.destroy=()=>{r(),n.destroy();},o}var Y,ee=new Set,te=new WeakMap,U=new Map,$e=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ue(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function ne(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();Y??(Y=new ResizeObserver(o=>{let i=false;for(let{target:a}of o)te.get(a)!==$e(a)&&(i=true),te.set(a,"");i&&ee.forEach(a=>a());})),ee.add(n);let r=Ue(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{te.has(o)||te.set(o,$e(o)),U.set(o,(U.get(o)??0)+1),Y.observe(o);}),()=>{ee.delete(n)&&(r.forEach(o=>{let i=(U.get(o)??1)-1;if(i)return void U.set(o,i);U.delete(o),Y?.unobserve(o);}),ee.size||(Y?.disconnect(),Y=void 0));}}function Ce(e,t,n,r,o){let i,a=NaN,f,c,u=()=>{i=0,r(),!f&&!i&&(a=n())>0&&a<1&&(i=requestAnimationFrame(u));},d=()=>{!i&&!f&&n()!==a&&(i=requestAnimationFrame(u));},h=p=>{f=p,cancelAnimationFrame(i),i=a=NaN,d();},w=()=>{clearTimeout(c),o(),d();},M=()=>{clearTimeout(c),c=setTimeout(w,150);},x=ne(t,M),v=p=>{e[p]("scroll",d,{passive:true}),window[p]("resize",M),window[p]("orientationchange",M);};return v("addEventListener"),d(),{hold:h,remeasure:w,off(){h(true),v("removeEventListener"),x(),clearTimeout(c);}}}function Xe(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ae(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],i=[],a=r[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let c=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}t.push({fn:r[1],nums:o,units:i});}return t}function Ke(e,t,n){let r=Ae(e),o=Ae(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((i,a)=>{let f=o[a];return i.fn!==f.fn||i.nums.length!==f.nums.length?n<1?`${i.fn}(${i.nums.map((c,u)=>`${c}${i.units[u]}`).join(", ")})`:`${f.fn}(${f.nums.map((c,u)=>`${c}${f.units[u]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,u)=>`${c+(f.nums[u]-c)*n}${i.units[u]}`).join(", ")})`}).join(" ")}function Ie(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(Xe(r))return Se(r,o,n);if(r.includes("("))return Ke(r,o,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let f=parseFloat(i[1]),c=parseFloat(a[1]);return `${f+(c-f)*n}${i[2]||a[2]}`}return n<1?r:o}function Ze(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Je=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),et=0,_e="--scroll-draw-progress";function tt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var ke={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function le(e,t){return typeof window>"u"?ke:t.respectReducedMotion===false?He(e,t,false):Re(t,(n,r)=>He(e,n,r))}function He(e,t,n){let{props:r,trigger:o={},easing:i="ease-out",speed:a=1,once:f=false,axis:c="y",scrollContainer:u,native:d=true,velocityScale:h=false,triggerElement:w,onProgress:M,onComplete:x,onEnter:v,onLeave:p,onEnterBack:z,onLeaveBack:P}=t,A=typeof i=="function"?i:Q[i]??Q["ease-out"],H=ie(o.start||"top bottom"),W=ie(o.end||"bottom top"),C=w??e,S=typeof u=="string"?document.querySelector(u):u??null,y=Object.entries(r).map(([s,l])=>({prop:Ze(s),from:Array.isArray(l)?l[0]:"",to:Array.isArray(l)?l[1]:l}));function D(){let s=window.getComputedStyle(e);for(let l of y)l.from===""&&(l.from=s.getPropertyValue(l.prop).trim()||"0");}function X(){for(let s of y)e.style.setProperty(s.prop,String(s.to));}let m=new Map;for(let s of [...y.map(l=>l.prop),_e])m.set(s,e.style.getPropertyValue(s));function b(){for(let[s,l]of m)l?e.style.setProperty(s,l):e.style.removeProperty(s);}if(n)return X(),x?.(),{...ke,destroy:b,getProgress:()=>1};D();let F=()=>S?c==="x"?S.scrollLeft:S.scrollTop:c==="x"?window.scrollX:window.scrollY,ce=()=>S?c==="x"?S.clientWidth:S.clientHeight:c==="x"?window.innerWidth:window.innerHeight,me=typeof i=="string"?Le(i):null;function Oe(){if(!d||!tt()||!me||c!=="y"||S||C!==e||f||a!==1||M||x||v||p||z||P||h!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let s of y)if(!Je.has(s.prop))return false;return true}function ze(){let s=`ssd-a-${++et}`,l=y.map(g=>`${g.prop}:${g.from}`).join(";"),O=y.map(g=>`${g.prop}:${g.to}`).join(";"),$=document.createElement("style");$.setAttribute("data-ssd-animate",""),$.textContent=`@keyframes ${s}{from{${l}}to{${O}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${me};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(s);let T=()=>{let g=e.getBoundingClientRect();return se({top:g.top,height:g.height},F(),ce(),H,W)};ae(e,{type:"animate",getProgress:()=>E.getProgress(),getTrigger:T});let E={refresh(){},destroy(){e.classList.remove(s),$.remove(),e.style.animationPlayState="",b(),ue(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(g){let G=Math.min(1,Math.max(0,g));e.classList.remove(s);for(let J of y)e.style.setProperty(J.prop,Ie(J.from,J.to,G));},getProgress(){let{tStart:g,tEnd:G}=T();return A(q(F(),g,G,a))}};return E}if(Oe())return ze();let L=0,R=0,k=false,re=-1,N=0,I=0,K=false,_=NaN,oe=-1,fe=0,V=C===e?y:[],de=false;function pe(){let s=e.style,l=V.map(E=>s.getPropertyValue(E.prop)),O=s.transition;V.length&&(s.transition="none"),V.forEach(E=>s.setProperty(E.prop,m.get(E.prop)??""));let $=ve(C,S,c);V.forEach((E,g)=>s.setProperty(E.prop,l[g])),V.length&&(e.offsetWidth,s.transition=O);let T=se($,$.scroll,ce(),H,W);de&&Math.abs(T.tStart-L)<1&&Math.abs(T.tEnd-R)<1||(de=true,L=T.tStart,R=T.tEnd);}function Z(s){e.style.setProperty(_e,String(s));for(let l of y)e.style.setProperty(l.prop,Ie(l.from,l.to,s));M?.(s);}function We(s){if(isNaN(_)){_=s;return}_<=0&&s>0&&v?.(),_<1&&s>=1&&p?.(),_>=1&&s<1&&z?.(),_>0&&s<=0&&P?.(),_=s;}function De(){if(k)return;let s=performance.now(),l=F(),O=a;if(h!==false){let g=s-fe,G=g>0?Math.abs(l-(oe<0?l:oe))/g:0;O=a*Math.max(.2,1+G*(typeof h=="number"?h:1)*.04);}oe=l,fe=s;let $=R===L?0:(l-L)/(R-L);We($);let T=q(l,L,R,O),E=f?Math.max(re,A(N=Math.max(N,T))):A(T);I=E,Z(E),E>=1&&!K?(K=true,x?.()):E<1&&!f&&(K=false);}let B=Ce(S??window,[C],()=>q(F(),L,R,Math.min(a,1)),De,pe);pe(),R===L&&j("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),N=q(F(),L,R,a),I=A(N),Z(I),ae(e,{type:"animate",getProgress:()=>I,getTrigger:()=>({tStart:L,tEnd:R})});function ge(){k=true,B.hold(true);}return {destroy(){k=true,B.off(),b(),ue(e);},replay(){re=-1,N=0,K=false,I=0,k=false,Z(0),B.hold(false);},pause:ge,resume(){k&&(k=false,B.hold(false));},seek(s){let l=Math.min(1,Math.max(0,s));I=l,re=l,N=0,ge(),Z(l);},getProgress(){return I},refresh:B.remeasure}}var Ne={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function At(e,t={}){if(typeof window>"u")return Ne;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return j("scrollHorizontal: track element not found:",e),Ne;let r=n,{easing:o="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:a,respectReducedMotion:f=false,onProgress:c}=t,u=typeof a=="string"?document.querySelector(a):a??null;function d(){for(let m=r.parentElement;m;m=m.parentElement)if(window.getComputedStyle(m).position==="sticky")return m;return null}function h(){let m=d();if(m){let b=window.getComputedStyle(m);return m.clientWidth-(parseFloat(b.paddingLeft)||0)-(parseFloat(b.paddingRight)||0)}return u?u.clientWidth:document.documentElement.clientWidth||window.innerWidth}function w(){return t.distance??r.scrollWidth-h()}function M(){if(t.triggerElement!==void 0){let b=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(b)return b;j("scrollHorizontal: triggerElement not found:",t.triggerElement);}let m=d();return m?m.parentElement??m:r}let x=w(),v=M(),p=le(r,A(x,v)),z=H(),P=null;function A(m,b){return {props:{transform:["translateX(0px)",`translateX(${-m}px)`]},trigger:i,easing:o,native:false,respectReducedMotion:f,...b!==r&&{triggerElement:b},...a!==void 0&&{scrollContainer:a},...c!==void 0&&{onProgress:c}}}function H(){let m=v.getBoundingClientRect(),b=u?m.top-u.getBoundingClientRect().top+u.scrollTop:m.top+window.scrollY;return `${w()} ${Math.round(b)} ${Math.round(m.height)}`}function W(){p.destroy();let m=M(),b=m!==v;x=w(),v=m,p=le(r,A(x,v)),z=H(),P!==null&&p.seek(P),b&&X();}let C;function S(){(M()!==v||H()!==z)&&W();}function y(){clearTimeout(C),C=setTimeout(S,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let D=()=>{};function X(){D(),D=ne([r,v],y);}return X(),{destroy(){clearTimeout(C),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),D(),p.destroy();},replay(){P=null,p.replay();},pause(){p.pause(),P=p.getProgress();},resume(){P=null,p.resume();},seek(m){p.seek(m),P=p.getProgress();},getProgress(){return p.getProgress()},refresh(){W();}}}exports.scrollHorizontal=At;
|
|
1
|
+
'use strict';var Qe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function k(e,...n){Qe&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Ge({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function qe({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(r),o=0,s=[];for(let l=0;l<t;l++){let d=Math.pow(i,l);s.push(d),o+=d;}let u=[0],c=0;for(let l=0;l<t;l++)c+=s[l]/o,u.push(c);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let d=0;d<t;d++)if(l<=u[d+1]){let h=(l-u[d])/(u[d+1]-u[d]);if(d===0)return h*(2-h);let w=1-Math.pow(r,d);return w+(1-w)*(2*h-1)*(2*h-1)}return 1}}function je({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),i=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return o=>o<=0?0:o>=1?1:t*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/r)+1}var W={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:Ge(),bounce:qe(),elastic:je()};function Ue(e,n,t,r){let i=(o,s,u)=>((1+3*o-3*s)*u+3*s-6*o)*u*u+3*o*u;return o=>{if(o<=0||o>=1)return +(o>0);let s=o;for(let u=0;u<8;u++)s-=(i(e,t,s)-o)/((3*(1+3*e-3*t)*s+6*t-12*e)*s+3*e);if(!(s>=0&&s<=1&&Math.abs(i(e,t,s)-o)<1e-9))for(let u=0,c=0,l=1;u<30;u++)s=(c+l)/2,i(e,t,s)<o?c=s:l=s;return i(n,r,s)}}function ie(e){let n=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=n?n[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [Ue(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var ye=new Set;function he(e,n="linear"){if(typeof e=="function")return e;if(e==null)return W[n];if({}.hasOwnProperty.call(W,e))return W[e];let t=ie(String(e));return t?t[0]:(!ye.has(e)&&ye.add(e)&&k(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),W[n])}function Ee(e,n,t){return Math.min(t,Math.max(n,e))}function se(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}var Se=(e,n)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:n;function ve(e,n,t,r){return e+t+n*Se(r,0)}function we(e,n){return n*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Se(e,1))}function j(e,n,t,r){return t===n?0:Ee((e-n)/(t-n)*r,0,1)}function ae(e,n,t,r,i){let o=ve(e.top,e.height,n,r.element)-we(r.viewport,t),s=ve(e.top,e.height,n,i.element)-we(i.viewport,t);return {tStart:o,tEnd:s}}function Me(e,n,t){let r=e.getBoundingClientRect(),i=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:r.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,height:i,scroll:0}:{top:t==="x"?r.left:r.top,height:i,scroll:t==="x"?window.scrollX:window.scrollY}}function Le(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function Te(e,n,t){let r=Le(e),i=Le(n);return !r||!i?e:`rgb(${Math.round(r[0]+(i[0]-r[0])*t)},${Math.round(r[1]+(i[1]-r[1])*t)},${Math.round(r[2]+(i[2]-r[2])*t)})`}var Ye="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Xe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",xe=33;function Ke(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Je(e){let n=[];for(let t=0;t<xe;t++){let r=t/(xe-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function Pe(e){switch(e){case "linear":return "linear";case "ease-in":return Ye;case "ease-out":return Xe;case "ease-in-out":return Ke()?Je(W["ease-in-out"]):null;default:return ie(e)?.[1]??null}}var Re=Symbol.for("svg-scroll-draw.registry");function $e(){let e=globalThis;return e[Re]||(e[Re]=new Map)}function ue(e,n){$e().set(e,n);}function le(e){$e().delete(e);}function Ce(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=i=>e(!!i.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function Ae(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=Ce(o=>{if(!o)return;r();let s=(t.getProgress?.()??0)>=1;t.destroy(),t=n(s?{...e,onComplete:void 0}:e,true);}),i={};for(let o of Object.keys(t))i[o]=(...s)=>t[o]?.(...s);return i.destroy=()=>{r(),t.destroy();},i}var U,ee=new Set,te=new WeakMap,Y=new Map,Ie=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function Ze(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function ne(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();U??(U=new ResizeObserver(i=>{let o=false;for(let{target:s}of i)te.get(s)!==Ie(s)&&(o=true),te.set(s,"");o&&ee.forEach(s=>s());})),ee.add(t);let r=Ze(e);return [document.body,document.documentElement].forEach(i=>i&&r.add(i)),r.forEach(i=>{te.has(i)||te.set(i,Ie(i)),Y.set(i,(Y.get(i)??0)+1),U.observe(i);}),()=>{ee.delete(t)&&(r.forEach(i=>{let o=(Y.get(i)??1)-1;if(o)return void Y.set(i,o);Y.delete(i),U?.unobserve(i);}),ee.size||(U?.disconnect(),U=void 0));}}function _e(e,n,t,r,i){let o,s=NaN,u,c,l=()=>{o=0,r(),!u&&!o&&(s=t())>0&&s<1&&(o=requestAnimationFrame(l));},d=()=>{!o&&!u&&t()!==s&&(o=requestAnimationFrame(l));},h=p=>{u=p,cancelAnimationFrame(o),o=s=NaN,d();},w=()=>{clearTimeout(c),i(),d();},M=()=>{clearTimeout(c),c=setTimeout(w,150);},x=ne(n,M),v=p=>{e[p]("scroll",d,{passive:true}),window[p]("resize",M),window[p]("orientationchange",M);};return v("addEventListener"),d(),{hold:h,remeasure:w,off(){h(true),v("removeEventListener"),x(),clearTimeout(c);}}}function et(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ke(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let i=[],o=[],s=r[2].trim();if(s)for(let u of s.split(/[\s,]+/)){let c=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}n.push({fn:r[1],nums:i,units:o});}return n}function tt(e,n,t){let r=ke(e),i=ke(n);return r.length===0||r.length!==i.length?t<1?e:n:r.map((o,s)=>{let u=i[s];return o.fn!==u.fn||o.nums.length!==u.nums.length?t<1?`${o.fn}(${o.nums.map((c,l)=>`${c}${o.units[l]}`).join(", ")})`:`${u.fn}(${u.nums.map((c,l)=>`${c}${u.units[l]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,l)=>`${c+(u.nums[l]-c)*t}${o.units[l]}`).join(", ")})`}).join(" ")}function He(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),i=String(n);if(et(r))return Te(r,i,t);if(r.includes("("))return tt(r,i,t);let o=r.match(/^([-+]?[\d.]+)(.*)$/),s=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&s){let u=parseFloat(o[1]),c=parseFloat(s[1]);return `${u+(c-u)*t}${o[2]||s[2]}`}return t<1?r:i}function nt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var rt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ot=0,Oe="--scroll-draw-progress";function it(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Ne={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ce(e,n){return typeof window>"u"?Ne:n.respectReducedMotion===false?ze(e,n,false):Ae(n,(t,r)=>ze(e,t,r))}function ze(e,n,t){let{props:r,trigger:i={},easing:o="ease-out",speed:s=1,once:u=false,axis:c="y",scrollContainer:l,native:d=true,velocityScale:h=false,triggerElement:w,onProgress:M,onComplete:x,onEnter:v,onLeave:p,onEnterBack:F,onLeaveBack:P}=n,A=he(o,"ease-out"),H=se(i.start||"top bottom"),D=se(i.end||"bottom top"),C=w??e,S=typeof l=="string"?document.querySelector(l):l??null,y=Object.entries(r).map(([a,m])=>({prop:nt(a),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function V(){let a=window.getComputedStyle(e);for(let m of y)m.from===""&&(m.from=a.getPropertyValue(m.prop).trim()||"0");}function X(){for(let a of y)e.style.setProperty(a.prop,String(a.to));}let f=new Map;for(let a of [...y.map(m=>m.prop),Oe])f.set(a,e.style.getPropertyValue(a));function b(){for(let[a,m]of f)m?e.style.setProperty(a,m):e.style.removeProperty(a);}if(t)return X(),x?.(),{...Ne,destroy:b,getProgress:()=>1};V();let B=()=>S?c==="x"?S.scrollLeft:S.scrollTop:c==="x"?window.scrollX:window.scrollY,me=()=>S?c==="x"?S.clientWidth:S.clientHeight:c==="x"?window.innerWidth:window.innerHeight,fe=typeof o=="string"?Pe(o):null;function Fe(){if(!d||!it()||!fe||c!=="y"||S||C!==e||u||s!==1||M||x||v||p||F||P||h!==false||(i.start||"top bottom").trim()!=="top bottom"||(i.end||"bottom top").trim()!=="bottom top")return false;for(let a of y)if(!rt.has(a.prop))return false;return true}function De(){let a=`ssd-a-${++ot}`,m=y.map(g=>`${g.prop}:${g.from}`).join(";"),N=y.map(g=>`${g.prop}:${g.to}`).join(";"),$=document.createElement("style");$.setAttribute("data-ssd-animate",""),$.textContent=`@keyframes ${a}{from{${m}}to{${N}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(a);let T=()=>{let g=e.getBoundingClientRect();return ae({top:g.top,height:g.height},B(),me(),H,D)};ue(e,{type:"animate",getProgress:()=>E.getProgress(),getTrigger:T});let E={refresh(){},destroy(){e.classList.remove(a),$.remove(),e.style.animationPlayState="",b(),le(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(g){let q=Math.min(1,Math.max(0,g));e.classList.remove(a);for(let Z of y)e.style.setProperty(Z.prop,He(Z.from,Z.to,q));},getProgress(){let{tStart:g,tEnd:q}=T();return A(j(B(),g,q,s))}};return E}if(Fe())return De();let L=0,R=0,O=false,re=-1,z=0,I=0,K=false,_=NaN,oe=-1,de=0,Q=C===e?y:[],pe=false;function ge(){let a=e.style,m=Q.map(E=>a.getPropertyValue(E.prop)),N=a.transition;Q.length&&(a.transition="none"),Q.forEach(E=>a.setProperty(E.prop,f.get(E.prop)??""));let $=Me(C,S,c);Q.forEach((E,g)=>a.setProperty(E.prop,m[g])),Q.length&&(e.offsetWidth,a.transition=N);let T=ae($,$.scroll,me(),H,D);pe&&Math.abs(T.tStart-L)<1&&Math.abs(T.tEnd-R)<1||(pe=true,L=T.tStart,R=T.tEnd);}function J(a){e.style.setProperty(Oe,String(a));for(let m of y)e.style.setProperty(m.prop,He(m.from,m.to,a));M?.(a);}function Ve(a){if(isNaN(_)){_=a;return}_<=0&&a>0&&v?.(),_<1&&a>=1&&p?.(),_>=1&&a<1&&F?.(),_>0&&a<=0&&P?.(),_=a;}function Be(){if(O)return;let a=performance.now(),m=B(),N=s;if(h!==false){let g=a-de,q=g>0?Math.abs(m-(oe<0?m:oe))/g:0;N=s*Math.max(.2,1+q*(typeof h=="number"?h:1)*.04);}oe=m,de=a;let $=R===L?0:(m-L)/(R-L);Ve($);let T=j(m,L,R,N),E=u?Math.max(re,A(z=Math.max(z,T))):A(T);I=E,J(E),E>=1&&!K?(K=true,x?.()):E<1&&!u&&(K=false);}let G=_e(S??window,[C],()=>j(B(),L,R,Math.min(s,1)),Be,ge);ge(),R===L&&k("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),z=j(B(),L,R,s),I=A(z),J(I),ue(e,{type:"animate",getProgress:()=>I,getTrigger:()=>({tStart:L,tEnd:R})});function be(){O=true,G.hold(true);}return {destroy(){O=true,G.off(),b(),le(e);},replay(){re=-1,z=0,K=false,I=0,O=false,J(0),G.hold(false);},pause:be,resume(){O&&(O=false,G.hold(false));},seek(a){let m=Math.min(1,Math.max(0,a));I=m,re=m,z=0,be(),J(m);},getProgress(){return I},refresh:G.remeasure}}var We={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function Ot(e,n={}){if(typeof window>"u")return We;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return k("scrollHorizontal: track element not found:",e),We;let r=t,{easing:i="linear",trigger:o={start:"top top",end:"bottom bottom"},scrollContainer:s,respectReducedMotion:u=false,onProgress:c}=n,l=typeof s=="string"?document.querySelector(s):s??null;function d(){for(let f=r.parentElement;f;f=f.parentElement)if(window.getComputedStyle(f).position==="sticky")return f;return null}function h(){let f=d();if(f){let b=window.getComputedStyle(f);return f.clientWidth-(parseFloat(b.paddingLeft)||0)-(parseFloat(b.paddingRight)||0)}return l?l.clientWidth:document.documentElement.clientWidth||window.innerWidth}function w(){return n.distance??r.scrollWidth-h()}function M(){if(n.triggerElement!==void 0){let b=typeof n.triggerElement=="string"?document.querySelector(n.triggerElement):n.triggerElement;if(b)return b;k("scrollHorizontal: triggerElement not found:",n.triggerElement);}let f=d();return f?f.parentElement??f:r}let x=w(),v=M(),p=ce(r,A(x,v)),F=H(),P=null;function A(f,b){return {props:{transform:["translateX(0px)",`translateX(${-f}px)`]},trigger:o,easing:i,native:false,respectReducedMotion:u,...b!==r&&{triggerElement:b},...s!==void 0&&{scrollContainer:s},...c!==void 0&&{onProgress:c}}}function H(){let f=v.getBoundingClientRect(),b=l?f.top-l.getBoundingClientRect().top+l.scrollTop:f.top+window.scrollY;return `${w()} ${Math.round(b)} ${Math.round(f.height)}`}function D(){p.destroy();let f=M(),b=f!==v;x=w(),v=f,p=ce(r,A(x,v)),F=H(),P!==null&&p.seek(P),b&&X();}let C;function S(){(M()!==v||H()!==F)&&D();}function y(){clearTimeout(C),C=setTimeout(S,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let V=()=>{};function X(){V(),V=ne([r,v],y);}return X(),{destroy(){clearTimeout(C),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),V(),p.destroy();},replay(){P=null,p.replay();},pause(){p.pause(),P=p.getProgress();},resume(){P=null,p.resume();},seek(f){p.seek(f),P=p.getProgress();},getProgress(){return p.getProgress()},refresh(){D();}}}exports.scrollHorizontal=Ot;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance, T as TriggerConfig, E as
|
|
1
|
+
import { S as ScrollDrawInstance, T as TriggerConfig, E as Easing } from '../types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollHorizontalOptions {
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ interface ScrollHorizontalOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
trigger?: TriggerConfig;
|
|
19
19
|
/** Easing for the horizontal movement. Default: `'linear'` (scrub feel). */
|
|
20
|
-
easing?:
|
|
20
|
+
easing?: Easing;
|
|
21
21
|
/** Custom scroll container. Default: window. */
|
|
22
22
|
scrollContainer?: string | Element;
|
|
23
23
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance, T as TriggerConfig, E as
|
|
1
|
+
import { S as ScrollDrawInstance, T as TriggerConfig, E as Easing } from '../types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollHorizontalOptions {
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ interface ScrollHorizontalOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
trigger?: TriggerConfig;
|
|
19
19
|
/** Easing for the horizontal movement. Default: `'linear'` (scrub feel). */
|
|
20
|
-
easing?:
|
|
20
|
+
easing?: Easing;
|
|
21
21
|
/** Custom scroll container. Default: window. */
|
|
22
22
|
scrollContainer?: string | Element;
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-HAGTU5EX.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-2PYLM3E7.mjs';import {d}from'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var x={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function $(a$1,r={}){if(typeof window>"u")return x;let h=typeof a$1=="string"?document.querySelector(a$1):a$1;if(!h)return b("scrollHorizontal: track element not found:",a$1),x;let o=h,{easing:C="linear",trigger:P={start:"top top",end:"bottom bottom"},scrollContainer:s,respectReducedMotion:R=false,onProgress:v}=r,u=typeof s=="string"?document.querySelector(s):s??null;function S(){for(let e=o.parentElement;e;e=e.parentElement)if(window.getComputedStyle(e).position==="sticky")return e;return null}function M(){let e=S();if(e){let t=window.getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}return u?u.clientWidth:document.documentElement.clientWidth||window.innerWidth}function d$1(){return r.distance??o.scrollWidth-M()}function g(){if(r.triggerElement!==void 0){let t=typeof r.triggerElement=="string"?document.querySelector(r.triggerElement):r.triggerElement;if(t)return t;b("scrollHorizontal: triggerElement not found:",r.triggerElement);}let e=S();return e?e.parentElement??e:o}let m=d$1(),i=g(),n=a(o,T(m,i)),b$1=f(),l=null;function T(e,t){return {props:{transform:["translateX(0px)",`translateX(${-e}px)`]},trigger:P,easing:C,native:false,respectReducedMotion:R,...t!==o&&{triggerElement:t},...s!==void 0&&{scrollContainer:s},...v!==void 0&&{onProgress:v}}}function f(){let e=i.getBoundingClientRect(),t=u?e.top-u.getBoundingClientRect().top+u.scrollTop:e.top+window.scrollY;return `${d$1()} ${Math.round(t)} ${Math.round(e.height)}`}function z(){n.destroy();let e=g(),t=e!==i;m=d$1(),i=e,n=a(o,T(m,i)),b$1=f(),l!==null&&n.seek(l),t&&H();}let p;function W(){(g()!==i||f()!==b$1)&&z();}function c(){clearTimeout(p),p=setTimeout(W,150);}window.addEventListener("resize",c),window.addEventListener("orientationchange",c);let E=()=>{};function H(){E(),E=d([o,i],c);}return H(),{destroy(){clearTimeout(p),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),E(),n.destroy();},replay(){l=null,n.replay();},pause(){n.pause(),l=n.getProgress();},resume(){l=null,n.resume();},seek(e){n.seek(e),l=n.getProgress();},getProgress(){return n.getProgress()},refresh(){z();}}}export{$ as scrollHorizontal};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing, T as TriggerConfig, S as ScrollDrawInstance } from './types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollCounterOptions {
|
|
4
4
|
from?: number;
|
|
5
5
|
to: number;
|
|
6
6
|
format?: (value: number) => string;
|
|
7
|
-
easing?:
|
|
7
|
+
easing?: Easing;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
9
|
once?: boolean;
|
|
10
10
|
decimals?: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { S as ScrollAnimateOptions } from './engine-
|
|
1
|
+
import { E as Easing, T as TriggerConfig, S as ScrollDrawInstance } from './types-iITMwrru.js';
|
|
2
|
+
import { S as ScrollAnimateOptions } from './engine-DAlvk6i0.js';
|
|
3
3
|
|
|
4
4
|
interface ScrollParallaxOptions {
|
|
5
5
|
speed?: number;
|
|
6
6
|
axis?: 'x' | 'y';
|
|
7
|
-
easing?:
|
|
7
|
+
easing?: Easing;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
9
|
onProgress?: (alpha: number) => void;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { S as ScrollAnimateOptions } from './engine-
|
|
1
|
+
import { E as Easing, T as TriggerConfig, S as ScrollDrawInstance } from './types-iITMwrru.mjs';
|
|
2
|
+
import { S as ScrollAnimateOptions } from './engine-Bi2x8-X-.mjs';
|
|
3
3
|
|
|
4
4
|
interface ScrollParallaxOptions {
|
|
5
5
|
speed?: number;
|
|
6
6
|
axis?: 'x' | 'y';
|
|
7
|
-
easing?:
|
|
7
|
+
easing?: Easing;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
9
|
onProgress?: (alpha: number) => void;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing, T as TriggerConfig, S as ScrollDrawInstance } from './types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollCounterOptions {
|
|
4
4
|
from?: number;
|
|
5
5
|
to: number;
|
|
6
6
|
format?: (value: number) => string;
|
|
7
|
-
easing?:
|
|
7
|
+
easing?: Easing;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
9
|
once?: boolean;
|
|
10
10
|
decimals?: number;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${m?`left:${
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function vr(e,r,t){if(!_e)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,l=(r.match(jt)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==l&&W(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Er(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),u=n[s++]??l;return String(+(l+(u-l)*t).toFixed(4))})}function Qt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ve(r,(t,n)=>Sr(e,t,n))}function Sr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:E=0,direction:y="forward",once:I=false,debug:se=false,axis:f="y",scrollContainer:w,autoReverse:h=false,delay:x=0,strokeColor:b,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=false,threshold:J=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=false,duration:P=1e3,native:H=true,onProgress:Ce,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===true?"left":typeof ee=="string"?ee:false,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof w=="string"?document.querySelector(w):w??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,we=Array.isArray(U)?U[0]:null,ue=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function ve(o){let c=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let a=Z?[]:Array.from(e.querySelectorAll(l)),p=[],_=[],M=0,$=0,O=E,k=0,Le=0,V=false,Ee=false,Se=0,at=-1,Qe=[],Ue=-1,ie=false,fe=0,De=0,Oe,lt=false,ct=null;function bt(){ct?.destroy(),ct=null;}let Ie=new Set,wt=NaN,He=true,Xe=-1,vt=performance.now(),Fe=NaN;function Ze(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function Et(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function St(){let o=Ke(e,F,f);return $e(o,o.scroll,Et(),Ne,We)}function or(){let o=$-M,c=a.length-1,g=F??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)));}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);k=M+Math.min(0,G,re,G+re),Le=M+Math.max(0,G,re,G+re);}function xt(){(({tStart:M,tEnd:$}=St())),or(),se&&_e&&(bt(),ct=wr(M,$,f));}function ut(o,c=St){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e);},o}function Tt(o,c){return I&&!h?Math.max(at,q(Qe[o]=Math.max(Qe[o]??0,c))):q(c)}function sr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=ve(g);return}a.forEach((g,T)=>mt(g,T,o,c));}function mt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),he&&be?o.style.stroke=et(he,be,g):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*g}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*g}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",Er(_[c],B,g));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}a.forEach((o,c)=>{o.style.strokeDasharray=`${p[c]}`,o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",_[c]);});}function ze(o,c){let g=o.getAttribute("d"),T=Je(o);if(B&&_[c]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[c]),T=Math.max(Je(o),G),o.setAttribute("d",g);}p[c]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,c)=>{br(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),ze(o,c);let T=p[c];B&&(g?vr(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`));}),t)return Z&&(e.style.clipPath=ve(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=ve(y==="reverse"?1:0));let Mt=typeof d=="string"?tt(d):null;function ir(){return !(H===false||Ae||se&&_e||!hr()||!a.length||!Mt||Z||f!=="y"||F||u!==1||E!==0||I||h||N!==false||B||z||le||x>0||Ce||X||te||ge||Re||ye||me||b!=null||L!=null||U!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function ar(){let o=++yr,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,C+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${C}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Mt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function K(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c);}a.forEach(K);let Y=false,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=$e({top:S.top,height:S.height},Ze(),Et(),Ne,We);return q(R(Ze(),A,Q,u))}return {destroy(){e.classList.remove(g),a.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){Y=false,ne=-1,a.forEach(K);},pause(){Y=true,a.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,a.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=true,a.forEach((Q,xe)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[xe]*A}`:`${p[xe]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return ae()},refresh(){a.forEach((S,A)=>{ze(S,A),S.style.setProperty("--ssd-len",String(p[A]));});}}}if(ir())return ut(ar());function lr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,a.length-1)*E),g=0,T=0,G=false;function re(ne){let ae=true,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);fe=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=ve(y==="reverse"?1-Q:Q),Ce?.(Q),A<1&&(ae=false);}else {a.forEach((Q,xe)=>{let ur=xe*E*o,kt=Math.min(1,Math.max(0,(ne-ur)/o));mt(Q,xe,q(kt),y),kt<1&&(ae=false);});let A=q(S);fe=A,Ce?.(A),e.style.setProperty("--scroll-draw-progress",String(A));}if(z){let A=q(S);for(let Q in z){let xe=parseFloat(Q);A>=xe&&!Ie.has(xe)&&(Ie.add(xe),z[Q]?.());}}return ae}function j(ne){if(ie)return;let ae=ne-g;Ee||(Ee=true,X?.());let S=re(ae);if(S&&!V){V=true,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=false,V=false,Ie.clear(),ft(),Se=requestAnimationFrame(j);},de));return}S||(Se=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=false,Ee=false,V=false,De=0,G=true,fe=0,Ie.clear(),ft(),Se=requestAnimationFrame(j);}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?C():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=false);});},{root:F??null,threshold:J,rootMargin:Ge}),K;function Y(){clearTimeout(K),K=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Se),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(K);},replay(){De=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-g,cancelAnimationFrame(Se));},resume(){ie&&(ie=false,G=true,g=performance.now()-T,Se=requestAnimationFrame(j));},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=true,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T);},getProgress(){return fe},refresh(){clearTimeout(K),a.forEach(ze);}}}if(Ae)return ut(lr());xt();let At=()=>R(Ze(),k,Le,1);function Pt(){V=true,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{lt=true;},de));}function Lt(){at=-1,Qe=[],Ee=false,V=false,lt=false,Ie.clear(),ft(),He=true;}function cr(){let o=performance.now(),c=Ze();if(lt&&At()%1&&Lt(),!He&&N===false&&c===wt)return;He=false,wt=c;let g=u;if(N!==false){let C=o-vt,D=C>0?Math.abs(c-(Xe<0?c:Xe))/C:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=c,vt=o;let T=h?Ue===-1||c>=Ue?"forward":"reverse":y;Ue=c;let G=$-M,re=true,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&ge?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ye?.(),Fe>0&&j<=0&&me?.()),Fe=j,Z){let C=Tt(0,R(c,M,$,g));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),Ce?.(C),!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),C>=1&&!V?Pt():C<1&&!I&&(V=false);return}if(a.forEach((C,D)=>{let K=D*O*G,Y=Tt(D,R(c,M+K,$+K,g));mt(C,D,Y,T),D===0&&(fe=Y,Ce?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=false);}),z){let C=q(R(c,M,$,g));for(let D in z){let K=parseFloat(D);C>=K&&!Ie.has(K)&&(Ie.add(K),z[D]?.());}}!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),re&&!V?Pt():!re&&!I&&(V=false);}let Be=ke(F??window,[e],At,cr,()=>{let o=p.join();a.forEach(ze),xt(),He=true,p.join()!==o&&qe();}),pt=x>0;function qe(){Be.hold(ie||pt);}let $t;return pt&&($t=setTimeout(()=>{pt=false,qe();},x)),qe(),ut({destroy(){clearTimeout(Oe),clearTimeout($t),Be.off(),bt();},replay(){Lt(),Ue=-1,Xe=-1,De=0,ie=false,fe=0,clearTimeout(Oe),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,He=true,qe());},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,at=c,Qe=[],ie=true,Be.hold(true),sr(c,y),He=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function xr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Qt(n,r):(W("Container not found:",e),t)}function Tr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ut(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],l=n[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function Mr(e,r,t){let n=Ut(e),s=Ut(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,l)=>{let u=s[l];return i.fn!==u.fn||i.nums.length!==u.nums.length?t<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Xt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Tr(n))return et(n,s,t);if(n.includes("("))return Mr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),m=parseFloat(l[1]);return `${u+(m-u)*t}${i[2]||l[2]}`}return t<1?n:s}function Ar(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Pr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Lr=0,Zt="--scroll-draw-progress";function $r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?Jt:r.respectReducedMotion===false?Kt(e,r,false):Ve(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:E=false,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:w,onEnterBack:h,onLeaveBack:x}=r,b=typeof i=="function"?i:oe[i]??oe["ease-out"],L=Te(s.start||"top bottom"),U=Te(s.end||"bottom top"),z=y??e,N=typeof d=="string"?document.querySelector(d):d??null,J=Object.entries(n).map(([a,p])=>({prop:Ar(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ge(){let a=window.getComputedStyle(e);for(let p of J)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0");}function le(){for(let a of J)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...J.map(p=>p.prop),Zt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,p]of de)p?e.style.setProperty(a,p):e.style.removeProperty(a);}if(t)return le(),se?.(),{...Jt,destroy:B,getProgress:()=>1};Ge();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ae=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?tt(i):null;function H(){if(!v||!$r()||!P||m!=="y"||N||z!==e||u||l!==1||I||se||f||w||h||x||E!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of J)if(!Pr.has(a.prop))return false;return true}function Ce(){let a=`ssd-a-${++Lr}`,p=J.map(k=>`${k.prop}:${k.from}`).join(";"),_=J.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${p}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:$});let O={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Le=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let V of J)e.style.setProperty(V.prop,Xt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(R(ee(),k,Le,l))}};return O}if(H())return Ce();let X=0,te=0,ge=false,Re=-1,ye=0,me=0,Z=false,q=NaN,Ne=-1,We=0,F=z===e?J:[],he=false;function be(){let a=e.style,p=F.map(O=>a.getPropertyValue(O.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(O=>a.setProperty(O.prop,de.get(O.prop)??""));let M=Ke(z,N,m);F.forEach((O,k)=>a.setProperty(O.prop,p[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),L,U);he&&Math.abs($.tStart-X)<1&&Math.abs($.tEnd-te)<1||(he=true,X=$.tStart,te=$.tEnd);}function ce(a){e.style.setProperty(Zt,String(a));for(let p of J)e.style.setProperty(p.prop,Xt(p.from,p.to,a));I?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&f?.(),q<1&&a>=1&&w?.(),q>=1&&a<1&&h?.(),q>0&&a<=0&&x?.(),q=a;}function we(){if(ge)return;let a=performance.now(),p=ee(),_=l;if(E!==false){let k=a-We,Le=k>0?Math.abs(p-(Ne<0?p:Ne))/k:0;_=l*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04);}Ne=p,We=a;let M=te===X?0:(p-X)/(te-X);Pe(M);let $=R(p,X,te,_),O=u?Math.max(Re,b(ye=Math.max(ye,$))):b($);me=O,ce(O),O>=1&&!Z?(Z=true,se?.()):O<1&&!u&&(Z=false);}let ue=ke(N??window,[z],()=>R(ee(),X,te,Math.min(l,1)),we,be);be(),te===X&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=R(ee(),X,te,l),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Re=-1,ye=0,Z=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let p=Math.min(1,Math.max(0,a));me=p,Re=p,ye=0,ve(),ce(p);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;return t?gt(t,r):(W("scrollAnimate: element not found:",e),st)}function Cr(e,r={}){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return W("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:l,onProgress:u}=r,m=-n*100,d=t.style,v=!!t.ownerSVGElement,E=d.getPropertyValue("transform-box");v&&d.setProperty("transform-box","fill-box");let y=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:l??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:u});return v?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E);}}:y}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ve(r,(n,s)=>Or(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Or(e,r,t){let{from:n=0,to:s,format:i,easing:l="ease-out",trigger:u={},once:m=true,decimals:d,onComplete:v}=r,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=typeof l=="function"?l:oe[l]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(t)return e.textContent=E(s),v?.(),{...yt,getProgress:()=>1};let f=0,w=0,h=false,x=-1,b=0,L=0,U=false,z=()=>window.scrollY,N=()=>window.innerHeight;function J(){let P=e.getBoundingClientRect(),H=$e({top:P.top,height:P.height},z(),N(),I,se);h&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-w)<1||(h=true,f=H.tStart,w=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P));}let de=()=>R(z(),f,w,1);function B(){let P=de(),H=m?Math.max(x,y(b=Math.max(b,P))):y(P);L=H,le(H),H>=1&&!U?(U=true,v?.()):H<1&&!m&&(U=false);}J();{b=R(z(),f,w,1);let P=y(b);L=P,le(P);}let ee=ke(window,[e],de,B,J);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:w})});let Ae=()=>ee.hold(false);return {destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){x=-1,b=0,U=false,L=0,le(0),Ae();},pause:()=>ee.hold(true),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,b=0,ee.hold(true),le(H);},getProgress(){return L}}}var er="http://www.w3.org/2000/svg",Ir="cinematic-photo",nr=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?nr(r/100):0}function tr(e){return oe[e]??oe.linear}var rr=e=>({destroy(){},getProgress:()=>e}),ht=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||W("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return rr(0);t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let f of r.scenes){if(f.background){let h=document.createElement("img");h.id=Ir,h.src=f.background,h.alt="",h.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(h);}let w=f.animations.filter(h=>h.type==="draw");if(w.length){let h=document.createElementNS(er,"svg");h.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),h.setAttribute("preserveAspectRatio","xMidYMid meet"),h.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(h);for(let x of w){let b=document.createElementNS(er,"path");b.id=x.target.replace(/^#/,""),b.setAttribute("d",x.d),b.setAttribute("fill","none"),b.setAttribute("stroke",x.stroke),b.setAttribute("stroke-width",String(x.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let L=x.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(L),b.style.strokeDashoffset=String(L),h.appendChild(b),s.push({kind:"draw",el:b,start:it(x.start),end:it(x.end),ease:tr(x.easing),length:L});}}for(let h of f.animations){if(h.type!=="fade")continue;let x=n.querySelector(h.target)??document.querySelector(h.target);x&&(x.style.opacity=String(h.from),s.push({kind:"fade",el:x,start:it(h.start),end:it(h.end),ease:tr("ease-in-out"),from:h.from,to:h.to}));}}let i=0,l=null;for(let f=t.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){l=f;break}let u=0,m=0,d=()=>{let f=t.getBoundingClientRect().top;u=l?f-l.getBoundingClientRect().top-l.clientTop+l.scrollTop:f+window.scrollY,m=u+Math.max(0,t.offsetHeight-(l?l.clientHeight:window.innerHeight));},v=()=>{let f=l?l.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(f,u,m,1)},E=f=>{for(let w of s){let h=w.end-w.start,x=h<=0?f>=w.end?1:0:nr((f-w.start)/h),b=w.ease(x);w.kind==="draw"?w.el.style.strokeDashoffset=String(w.length*(1-b)):w.el.style.opacity=String(w.from+(w.to-w.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),rr(1);let y=()=>{i=v(),E(i);};d(),y();let I=ke(l||window,[t],v,y,d);Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(t),i=1,E(1));});return {destroy(){se(),I.off(),pe(t);},getProgress:()=>i}}};
|
|
4
|
-
exports.Cinematic=
|
|
1
|
+
'use strict';var _e=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function R(e,...r){_e&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function It({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ht({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),i=0,a=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);a.push(v),i+=v;}let u=[0],m=0;for(let d=0;d<t;d++)m+=a[d]/i,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<t;v++)if(d<=u[v+1]){let E=(d-u[v])/(u[v+1]-u[v]);if(v===0)return E*(2-E);let y=1-Math.pow(n,v);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function Nt({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(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:It(),bounce:Ht(),elastic:Nt()};function gr(e,r,t,n){let s=(i,a,u)=>((1+3*i-3*a)*u+3*a-6*i)*u*u+3*i*u;return i=>{if(i<=0||i>=1)return +(i>0);let a=i;for(let u=0;u<8;u++)a-=(s(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(s(e,t,a)-i)<1e-9))for(let u=0,m=0,d=1;u<30;u++)a=(m+d)/2,s(e,t,a)<i?m=a:d=a;return s(r,n,a)}}function yt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [gr(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var Rt=new Set;function Le(e,r="linear"){if(typeof e=="function")return e;if(e==null)return Ve[r];if({}.hasOwnProperty.call(Ve,e))return Ve[e];let t=yt(String(e));return t?t[0]:(!Rt.has(e)&&Rt.add(e)&&R(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),Ve[r])}function Ft(e,r,t){return Math.min(t,Math.max(r,e))}function xe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}var zt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function _t(e,r,t,n){return e+t+r*zt(n,0)}function Vt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:zt(e,1))}function H(e,r,t,n){return t===r?0:Ft((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=_t(e.top,e.height,r,n.element)-Vt(n.viewport,t),a=_t(e.top,e.height,r,s.element)-Vt(s.viewport,t);return {tStart:i,tEnd:a}}function et(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function tt(e){let r=parseFloat(e.getAttribute("pathLength")??"");if(r>0)return r;let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function ze(e){return `${e} ${e*2}`}function Gt(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[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 rt(e,r,t){let n=Gt(e),s=Gt(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var ht={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 yr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",hr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function wr(e){let r=[];for(let t=0;t<Wt;t++){let n=t/(Wt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function nt(e){switch(e){case "linear":return "linear";case "ease-in":return yr;case "ease-out":return hr;case "ease-in-out":return br()?wr(Ve["ease-in-out"]):null;default:return yt(e)?.[1]??null}}var Bt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[Bt]||(e[Bt]=new Map)}function Te(e,r){qt().set(e,r);}function fe(e){qt().delete(e);}function ot(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function Ge(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=ot(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...a)=>t[i]?.(...a);return s.destroy=()=>{n(),t.destroy();},s}var Qe,st=new Set,it=new WeakMap,Ue=new Map,jt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function vr(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Yt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Qe??(Qe=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)it.get(a)!==jt(a)&&(i=true),it.set(a,"");i&&st.forEach(a=>a());})),st.add(t);let n=vr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{it.has(s)||it.set(s,jt(s)),Ue.set(s,(Ue.get(s)??0)+1),Qe.observe(s);}),()=>{st.delete(t)&&(n.forEach(s=>{let i=(Ue.get(s)??1)-1;if(i)return void Ue.set(s,i);Ue.delete(s),Qe?.unobserve(s);}),st.size||(Qe?.disconnect(),Qe=void 0));}}function ke(e,r,t,n,s){let i,a=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(d));},v=()=>{!i&&!u&&t()!==a&&(i=requestAnimationFrame(d));},E=w=>{u=w,cancelAnimationFrame(i),i=a=NaN,v();},y=()=>{clearTimeout(m),s(),v();},I=()=>{clearTimeout(m),m=setTimeout(y,150);},oe=Yt(r,I),f=w=>{e[w]("scroll",v,{passive:true}),window[w]("resize",I),window[w]("orientationchange",I);};return f("addEventListener"),v(),{hold:E,remeasure:y,off(){E(true),f("removeEventListener"),oe(),clearTimeout(m);}}}var Er=0;function Sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Ut=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function xr(e){if(!_e)return;let r=Qt(e,"stroke");if(!r||r==="none"){R("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Ut.has(t)&&!Ut.has(Qt(e,"fill"))&&R("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Tr(e,r,t){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 s(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,u=r-i,m=t==="x";n.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mr(e,r,t){if(!_e)return;let n=(e.match(Zt)??[]).join("").toUpperCase(),s=(r.match(Zt)??[]).join("").toUpperCase(),i=(e.match(Xt)??[]).length,a=(r.match(Xt)??[]).length;if(n!==s){R(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==a&&R(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Ar(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*t).toFixed(4))})}function Jt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(r,(t,n)=>Pr(e,t,n))}function Pr(e,r,t){let{preset:n,...s}=r,i=n?{...ht[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:E=0,direction:y="forward",once:I=false,debug:oe=false,axis:f="y",scrollContainer:w,autoReverse:h=false,delay:x=0,strokeColor:b,strokeWidth:L,fillOpacity:U,waypoints:W,velocityScale:N=false,threshold:K=0,rootMargin:We="0px",repeat:ae=0,repeatDelay:pe=0,morphTo:B,clip:ee,autoplay:Me=false,duration:P=1e3,native:F=true,onProgress:Ce,onStart:X,onComplete:te,onEnter:de,onLeave:Ie,onEnterBack:ge,onLeaveBack:ue}=i,Z=ee===true?"left":typeof ee=="string"?ee:false,q=Le(d),He=xe(v.start||"top bottom"),Be=xe(v.end||"bottom top"),_=typeof w=="string"?document.querySelector(w):w??null,ye=Array.isArray(b)?b[0]:null,he=Array.isArray(b)?b[1]:typeof b=="string"?b:null,le=Array.isArray(L)?L[0]:null,Ae=Array.isArray(L)?L[1]:typeof L=="number"?L:null,be=Array.isArray(U)?U[0]:null,ce=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function we(o){let c=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],V=[],M=0,$=0,O=E,k=0,Pe=0,z=false,ve=false,Ee=0,ct=-1,Xe=[],Ze=-1,se=false,me=0,De=0,Oe,ut=false,mt=null;function Et(){mt?.destroy(),mt=null;}let Re=new Set,St=NaN,Ne=true,Je=-1,xt=performance.now(),Fe=NaN;function Ke(){return _?f==="x"?_.scrollLeft:_.scrollTop:f==="x"?window.scrollX:window.scrollY}function Tt(){return _?f==="x"?_.clientWidth:_.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function Mt(){let o=et(e,_,f);return $e(o,o.scroll,Tt(),He,Be)}function lr(){let o=$-M,c=l.length-1,g=_??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)));}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);k=M+Math.min(0,G,re,G+re),Pe=M+Math.max(0,G,re,G+re);}function At(){(({tStart:M,tEnd:$}=Mt())),lr(),oe&&_e&&(Et(),mt=Tr(M,$,f));}function ft(o,c=Mt){Te(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),fe(e);},o}function Pt(o,c){return I&&!h?Math.max(ct,q(Xe[o]=Math.max(Xe[o]??0,c))):q(c)}function cr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=we(g);return}l.forEach((g,T)=>pt(g,T,o,c));}function pt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ye&&he?o.style.stroke=rt(ye,he,g):he&&(o.style.stroke=he),le!==null&&Ae!==null?o.style.strokeWidth=`${le+(Ae-le)*g}`:Ae!==null&&(o.style.strokeWidth=`${Ae}`),be!==null&&ce!==null?o.style.fillOpacity=`${be+(ce-be)*g}`:ce!==null&&(o.style.fillOpacity=`${ce}`),B&&o.tagName.toLowerCase()==="path"&&V[c]&&o.setAttribute("d",Ar(V[c],B,g));}function dt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=we(y==="reverse"?1:0);return}l.forEach((o,c)=>{o.style.strokeDasharray=ze(p[c]),o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",ye&&(o.style.stroke=ye),le!==null&&(o.style.strokeWidth=`${le}`),be!==null&&(o.style.fillOpacity=`${be}`),B&&o.tagName.toLowerCase()==="path"&&V[c]&&o.setAttribute("d",V[c]);});}function qe(o,c){let g=o.getAttribute("d"),T=tt(o);if(B&&V[c]){o.setAttribute("d",B);let G=tt(o);o.setAttribute("d",V[c]),T=Math.max(tt(o),G),o.setAttribute("d",g);}p[c]=T,o.style.strokeDasharray=ze(T);}if(l.forEach((o,c)=>{xr(o);let g=o.tagName.toLowerCase()==="path";g?V.push(o.getAttribute("d")??""):V.push(""),qe(o,c);let T=p[c];B&&(g?Mr(V[V.length-1],B,o):R(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),he&&(o.style.stroke=he),Ae!==null&&(o.style.strokeWidth=`${Ae}`),ce!==null&&(o.style.fillOpacity=`${ce}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",ye&&(o.style.stroke=ye),le!==null&&(o.style.strokeWidth=`${le}`),be!==null&&(o.style.fillOpacity=`${be}`));}),t)return Z&&(e.style.clipPath=we(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=we(y==="reverse"?1:0));let Lt=typeof d=="string"?nt(d):null;function ur(){return !(F===false||Me||oe&&_e||!Sr()||!l.length||!Lt||Z||f!=="y"||_||u!==1||E!==0||I||h||N!==false||B||W||ae||x>0||Ce||X||te||de||Ie||ge||ue||b!=null||L!=null||U!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function mr(){let o=++Er,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,C+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${C}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function J(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=ze(p[A]),S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c);}l.forEach(J);let Y=false,ne=-1;function ie(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=$e({top:S.top,height:S.height},Ke(),Tt(),He,Be);return q(H(Ke(),A,Q,u))}return {destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){Y=false,ne=-1,l.forEach(J);},pause(){Y=true,l.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,l.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=true,l.forEach((Q,Se)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[Se]*A}`:`${p[Se]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return ie()},refresh(){l.forEach((S,A)=>{qe(S,A),S.style.setProperty("--ssd-len",String(p[A]));});}}}if(ur())return ft(mr());function fr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=false;function re(ne){let ie=true,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);me=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=we(y==="reverse"?1-Q:Q),Ce?.(Q),A<1&&(ie=false);}else {l.forEach((Q,Se)=>{let dr=Se*E*o,Ot=Math.min(1,Math.max(0,(ne-dr)/o));pt(Q,Se,q(Ot),y),Ot<1&&(ie=false);});let A=q(S);me=A,Ce?.(A),e.style.setProperty("--scroll-draw-progress",String(A));}if(W){let A=q(S);for(let Q in W){let Se=parseFloat(Q);A>=Se&&!Re.has(Se)&&(Re.add(Se),W[Q]?.());}}return ie}function j(ne){if(se)return;let ie=ne-g;ve||(ve=true,X?.());let S=re(ie);if(S&&!z){z=true,re(c),te?.(),De<(ae==="infinite"?1/0:ae??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),ve=false,z=false,Re.clear(),dt(),Ee=requestAnimationFrame(j);},pe));return}S||(Ee=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Ee),clearTimeout(Oe),g=performance.now(),T=0,se=false,ve=false,z=false,De=0,G=true,me=0,Re.clear(),dt(),Ee=requestAnimationFrame(j);}let D=new IntersectionObserver(ne=>{ne.forEach(ie=>{ie.isIntersecting&&!(I&&z)?C():!ie.isIntersecting&&!I&&!z&&(cancelAnimationFrame(Ee),clearTimeout(Oe),G=false);});},{root:_??null,threshold:K,rootMargin:We}),J;function Y(){clearTimeout(J),J=setTimeout(()=>l.forEach(qe),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(J);},replay(){De=0,C();},pause(){se||!G||(se=true,T=performance.now()-g,cancelAnimationFrame(Ee));},resume(){se&&(se=false,G=true,g=performance.now()-T,Ee=requestAnimationFrame(j));},seek(ne){let ie=Math.min(1,Math.max(0,ne));me=ie,se=true,T=ie*c,g=performance.now()-T,cancelAnimationFrame(Ee),re(T);},getProgress(){return me},refresh(){clearTimeout(J),l.forEach(qe);}}}if(Me)return ft(fr());At();let $t=()=>H(Ke(),k,Pe,1);function kt(){z=true,te?.(),De<(ae==="infinite"?1/0:ae)&&(De++,Oe=setTimeout(()=>{ut=true;},pe));}function Ct(){ct=-1,Xe=[],ve=false,z=false,ut=false,Re.clear(),dt(),Ne=true;}function pr(){let o=performance.now(),c=Ke();if(ut&&$t()%1&&Ct(),!Ne&&N===false&&c===St)return;Ne=false,St=c;let g=u;if(N!==false){let C=o-xt,D=C>0?Math.abs(c-(Je<0?c:Je))/C:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Je=c,xt=o;let T=h?Ze===-1||c>=Ze?"forward":"reverse":y;Ze=c;let G=$-M,re=true,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&de?.(),Fe<1&&j>=1&&Ie?.(),Fe>=1&&j<1&&ge?.(),Fe>0&&j<=0&&ue?.()),Fe=j,Z){let C=Pt(0,H(c,M,$,g));me=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=we(D),Ce?.(C),!ve&&H(c,M,$,g)>0&&(ve=true,X?.()),C>=1&&!z?kt():C<1&&!I&&(z=false);return}if(l.forEach((C,D)=>{let J=D*O*G,Y=Pt(D,H(c,M+J,$+J,g));pt(C,D,Y,T),D===0&&(me=Y,Ce?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=false);}),W){let C=q(H(c,M,$,g));for(let D in W){let J=parseFloat(D);C>=J&&!Re.has(J)&&(Re.add(J),W[D]?.());}}!ve&&H(c,M,$,g)>0&&(ve=true,X?.()),re&&!z?kt():!re&&!I&&(z=false);}let je=ke(_??window,[e],$t,pr,()=>{let o=p.join();l.forEach(qe),At(),Ne=true,p.join()!==o&&Ye();}),gt=x>0;function Ye(){je.hold(se||gt);}let Dt;return gt&&(Dt=setTimeout(()=>{gt=false,Ye();},x)),Ye(),ft({destroy(){clearTimeout(Oe),clearTimeout(Dt),je.off(),Et();},replay(){Ct(),Ze=-1,Je=-1,De=0,se=false,me=0,clearTimeout(Oe),Ye();},pause(){se=true,je.hold(true);},resume(){se&&(se=false,Ne=true,Ye());},seek(o){let c=Math.min(1,Math.max(0,o));me=c,ct=c,Xe=[],se=true,je.hold(true),cr(c,y),Ne=true;},getProgress(){return me},refresh:je.remeasure},()=>({tStart:M,tEnd:$}))}function Lr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Jt(n,r):(R("Container not found:",e),t)}function $r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Kt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function kr(e,r,t){let n=Kt(e),s=Kt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?t<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function er(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if($r(n))return rt(n,s,t);if(n.includes("("))return kr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return `${u+(m-u)*t}${i[2]||a[2]}`}return t<1?n:s}function Cr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Dr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Or=0,tr="--scroll-draw-progress";function Rr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var nr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function bt(e,r){return typeof window>"u"?nr:r.respectReducedMotion===false?rr(e,r,false):Ge(r,(t,n)=>rr(e,t,n))}function rr(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:E=false,triggerElement:y,onProgress:I,onComplete:oe,onEnter:f,onLeave:w,onEnterBack:h,onLeaveBack:x}=r,b=Le(i,"ease-out"),L=xe(s.start||"top bottom"),U=xe(s.end||"bottom top"),W=y??e,N=typeof d=="string"?document.querySelector(d):d??null,K=Object.entries(n).map(([l,p])=>({prop:Cr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function We(){let l=window.getComputedStyle(e);for(let p of K)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function ae(){for(let l of K)e.style.setProperty(l.prop,String(l.to));}let pe=new Map;for(let l of [...K.map(p=>p.prop),tr])pe.set(l,e.style.getPropertyValue(l));function B(){for(let[l,p]of pe)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(t)return ae(),oe?.(),{...nr,destroy:B,getProgress:()=>1};We();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Me=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?nt(i):null;function F(){if(!v||!Rr()||!P||m!=="y"||N||W!==e||u||a!==1||I||oe||f||w||h||x||E!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of K)if(!Dr.has(l.prop))return false;return true}function Ce(){let l=`ssd-a-${++Or}`,p=K.map(k=>`${k.prop}:${k.from}`).join(";"),V=K.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${V}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},ee(),Me(),L,U)};Te(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:$});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),fe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Pe=Math.min(1,Math.max(0,k));e.classList.remove(l);for(let z of K)e.style.setProperty(z.prop,er(z.from,z.to,Pe));},getProgress(){let{tStart:k,tEnd:Pe}=$();return b(H(ee(),k,Pe,a))}};return O}if(F())return Ce();let X=0,te=0,de=false,Ie=-1,ge=0,ue=0,Z=false,q=NaN,He=-1,Be=0,_=W===e?K:[],ye=false;function he(){let l=e.style,p=_.map(O=>l.getPropertyValue(O.prop)),V=l.transition;_.length&&(l.transition="none"),_.forEach(O=>l.setProperty(O.prop,pe.get(O.prop)??""));let M=et(W,N,m);_.forEach((O,k)=>l.setProperty(O.prop,p[k])),_.length&&(e.offsetWidth,l.transition=V);let $=$e(M,M.scroll,Me(),L,U);ye&&Math.abs($.tStart-X)<1&&Math.abs($.tEnd-te)<1||(ye=true,X=$.tStart,te=$.tEnd);}function le(l){e.style.setProperty(tr,String(l));for(let p of K)e.style.setProperty(p.prop,er(p.from,p.to,l));I?.(l);}function Ae(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&f?.(),q<1&&l>=1&&w?.(),q>=1&&l<1&&h?.(),q>0&&l<=0&&x?.(),q=l;}function be(){if(de)return;let l=performance.now(),p=ee(),V=a;if(E!==false){let k=l-Be,Pe=k>0?Math.abs(p-(He<0?p:He))/k:0;V=a*Math.max(.2,1+Pe*(typeof E=="number"?E:1)*.04);}He=p,Be=l;let M=te===X?0:(p-X)/(te-X);Ae(M);let $=H(p,X,te,V),O=u?Math.max(Ie,b(ge=Math.max(ge,$))):b($);ue=O,le(O),O>=1&&!Z?(Z=true,oe?.()):O<1&&!u&&(Z=false);}let ce=ke(N??window,[W],()=>H(ee(),X,te,Math.min(a,1)),be,he);he(),te===X&&R("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ge=H(ee(),X,te,a),ue=b(ge),le(ue),Te(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:X,tEnd:te})});function we(){de=true,ce.hold(true);}return {destroy(){de=true,ce.off(),B(),fe(e);},replay(){Ie=-1,ge=0,Z=false,ue=0,de=false,le(0),ce.hold(false);},pause:we,resume(){de&&(de=false,ce.hold(false));},seek(l){let p=Math.min(1,Math.max(0,l));ue=p,Ie=p,ge=0,we(),le(p);},getProgress(){return ue},refresh:ce.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ir(e,r){if(typeof window>"u")return at;let t=typeof e=="string"?document.querySelector(e):e;return t?bt(t,r):(R("scrollAnimate: element not found:",e),at)}function Hr(e,r={}){if(typeof window>"u")return at;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return R("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=r,m=-n*100,d=t.style,v=!!t.ownerSVGElement,E=d.getPropertyValue("transform-box");v&&d.setProperty("transform-box","fill-box");let y=bt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:u});return v?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E);}}:y}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nr(e,r){if(typeof window>"u")return wt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(r,(n,s)=>Fr(t,n,s)):(R("scrollCounter: element not found:",e),wt)}function Fr(e,r,t){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:m=true,decimals:d,onComplete:v}=r,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=Le(a,"ease-out"),I=xe(u.start||"top 80%"),oe=xe(u.end||"top 20%");if(t)return e.textContent=E(s),v?.(),{...wt,getProgress:()=>1};let f=0,w=0,h=false,x=-1,b=0,L=0,U=false,W=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),F=$e({top:P.top,height:P.height},W(),N(),I,oe);h&&Math.abs(F.tStart-f)<1&&Math.abs(F.tEnd-w)<1||(h=true,f=F.tStart,w=F.tEnd);}let We=e.style.getPropertyValue("--scroll-draw-progress");function ae(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P));}let pe=()=>H(W(),f,w,1);function B(){let P=pe(),F=m?Math.max(x,y(b=Math.max(b,P))):y(P);L=F,ae(F),F>=1&&!U?(U=true,v?.()):F<1&&!m&&(U=false);}K();{b=H(W(),f,w,1);let P=y(b);L=P,ae(P);}let ee=ke(window,[e],pe,B,K);Te(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:w})});let Me=()=>ee.hold(false);return {destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",We),fe(e);},replay(){x=-1,b=0,U=false,L=0,ae(0),Me();},pause:()=>ee.hold(true),resume:Me,seek(P){let F=Math.min(1,Math.max(0,P));L=F,x=F,b=0,ee.hold(true),ae(F);},getProgress(){return L}}}var or="http://www.w3.org/2000/svg",_r="cinematic-photo",ar=e=>e<0?0:e>1?1:e;function lt(e){let r=parseFloat(e);return Number.isFinite(r)?ar(r/100):0}function sr(e){return Le(e)}var ir=e=>({destroy(){},getProgress:()=>e}),vt=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||R("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ir(0);t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let f of r.scenes){if(f.background){let h=document.createElement("img");h.id=_r,h.src=f.background,h.alt="",h.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(h);}let w=f.animations.filter(h=>h.type==="draw");if(w.length){let h=document.createElementNS(or,"svg");h.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),h.setAttribute("preserveAspectRatio","xMidYMid meet"),h.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(h);for(let x of w){let b=document.createElementNS(or,"path");b.id=x.target.replace(/^#/,""),b.setAttribute("d",x.d),b.setAttribute("fill","none"),b.setAttribute("stroke",x.stroke),b.setAttribute("stroke-width",String(x.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let L=x.length||b.getTotalLength?.()||0;b.style.strokeDasharray=ze(L),b.style.strokeDashoffset=String(L),h.appendChild(b),s.push({kind:"draw",el:b,start:lt(x.start),end:lt(x.end),ease:sr(x.easing),length:L});}}for(let h of f.animations){if(h.type!=="fade")continue;let x=n.querySelector(h.target)??document.querySelector(h.target);x&&(x.style.opacity=String(h.from),s.push({kind:"fade",el:x,start:lt(h.start),end:lt(h.end),ease:sr("ease-in-out"),from:h.from,to:h.to}));}}let i=0,a=null;for(let f=t.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){a=f;break}let u=0,m=0,d=()=>{let f=t.getBoundingClientRect().top;u=a?f-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:f+window.scrollY,m=u+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight));},v=()=>{let f=a?a.scrollTop:window.scrollY;return m<=u?f>=u?1:0:H(f,u,m,1)},E=f=>{for(let w of s){let h=w.end-w.start,x=h<=0?f>=w.end?1:0:ar((f-w.start)/h),b=w.ease(x);w.kind==="draw"?w.el.style.strokeDashoffset=String(w.length*(1-b)):w.el.style.opacity=String(w.from+(w.to-w.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),ir(1);let y=()=>{i=v(),E(i);};d(),y();let I=ke(a||window,[t],v,y,d);Te(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let oe=ot(f=>{f&&(oe(),I.off(),fe(t),i=1,E(1));});return {destroy(){oe(),I.off(),fe(t);},getProgress:()=>i}}};
|
|
4
|
+
exports.Cinematic=vt;exports.PRESETS=ht;exports.createBounce=Ht;exports.createElastic=Nt;exports.createSpring=It;exports.scrollAnimate=Ir;exports.scrollCounter=Nr;exports.scrollDraw=Lr;exports.scrollParallax=Hr;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as ScrollDrawOptions } from './types-
|
|
2
|
-
export { P as PresetName, S as ScrollDrawInstance } from './types-
|
|
3
|
-
export { s as scrollDraw } from './scroll-draw-
|
|
4
|
-
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-
|
|
5
|
-
export { S as ScrollCounterOptions, s as scrollCounter } from './index-
|
|
1
|
+
import { a as ScrollDrawOptions } from './types-iITMwrru.mjs';
|
|
2
|
+
export { C as CssEasing, E as Easing, P as PresetName, S as ScrollDrawInstance } from './types-iITMwrru.mjs';
|
|
3
|
+
export { s as scrollDraw } from './scroll-draw-CKZysh22.mjs';
|
|
4
|
+
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-ClAFxNEp.mjs';
|
|
5
|
+
export { S as ScrollCounterOptions, s as scrollCounter } from './index-BMMZ8aW7.mjs';
|
|
6
6
|
export { Cinematic, CinematicInstance, CinematicOptions, DrawAnimation, FadeAnimation, Story, StoryAnimation, StoryEasing, StoryScene } from './cinematic/index.mjs';
|
|
7
|
-
export { S as ScrollAnimateOptions } from './engine-
|
|
7
|
+
export { S as ScrollAnimateOptions } from './engine-Bi2x8-X-.mjs';
|
|
8
8
|
|
|
9
9
|
type PresetName = 'sketch' | 'reveal' | 'typewriter' | 'cinematic' | 'spring';
|
|
10
10
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as ScrollDrawOptions } from './types-
|
|
2
|
-
export { P as PresetName, S as ScrollDrawInstance } from './types-
|
|
3
|
-
export { s as scrollDraw } from './scroll-draw-
|
|
4
|
-
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-
|
|
5
|
-
export { S as ScrollCounterOptions, s as scrollCounter } from './index-
|
|
1
|
+
import { a as ScrollDrawOptions } from './types-iITMwrru.js';
|
|
2
|
+
export { C as CssEasing, E as Easing, P as PresetName, S as ScrollDrawInstance } from './types-iITMwrru.js';
|
|
3
|
+
export { s as scrollDraw } from './scroll-draw-DbY8RUJE.js';
|
|
4
|
+
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-CEMsUTEG.js';
|
|
5
|
+
export { S as ScrollCounterOptions, s as scrollCounter } from './index-MdQ4ti_z.js';
|
|
6
6
|
export { Cinematic, CinematicInstance, CinematicOptions, DrawAnimation, FadeAnimation, Story, StoryAnimation, StoryEasing, StoryScene } from './cinematic/index.js';
|
|
7
|
-
export { S as ScrollAnimateOptions } from './engine-
|
|
7
|
+
export { S as ScrollAnimateOptions } from './engine-DAlvk6i0.js';
|
|
8
8
|
|
|
9
9
|
type PresetName = 'sketch' | 'reveal' | 'typewriter' | 'cinematic' | 'spring';
|
|
10
10
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollAnimate,b as scrollParallax}from'./chunk-
|
|
1
|
+
export{a as scrollAnimate,b as scrollParallax}from'./chunk-UBH4K5YD.mjs';export{a as Cinematic}from'./chunk-ASCOHQQD.mjs';export{a as scrollDraw}from'./chunk-5U4JXBHR.mjs';export{a as scrollCounter}from'./chunk-Z72TVDHY.mjs';import'./chunk-HAGTU5EX.mjs';export{a as PRESETS}from'./chunk-XLXVGQ3P.mjs';import'./chunk-7LDSB4FT.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-YOOPMYT6.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-IXR6RML7.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-EBU6E26L.mjs';import'./chunk-LFSU6LR3.mjs';
|
package/dist/lenis/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var a={destroy:()=>{},getScrollY:()=>0};function d(c){if(typeof window>"u")return a;let r=window.scrollY,n=["scrollY","pageYOffset"],s=n.map(e=>Object.getOwnPropertyDescriptor(window,e)),t=false,l=e=>{r=e.scroll;try{for(let o of n)Object.defineProperty(window,o,{get:()=>r,configurable:!0});t=!0;}catch{}};return c.on("scroll",l),{destroy(){c.off("scroll",l),t&&(t=false,n.forEach((e,o)=>{try{let i=s[o];i?Object.defineProperty(window,e,i):delete window[e];}catch{}}));},getScrollY(){return r}}}exports.createLenisAdapter=d;
|
package/dist/lenis/index.d.mts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lenis smooth-scroll adapter for svg-scroll-draw.
|
|
3
3
|
*
|
|
4
|
-
* Lenis
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `window.
|
|
4
|
+
* Lenis itself does not need it. Every Lenis release so far (the 1.x line;
|
|
5
|
+
* 2.0 exists only as development prereleases) moves the real scroll position
|
|
6
|
+
* on every frame: its `setScroll()` calls `wrapper.scrollTo({ behavior:
|
|
7
|
+
* 'instant' })`, so `window.scrollY` already follows the smooth scroll and
|
|
8
|
+
* every svg-scroll-draw engine reads it with no adapter.
|
|
9
|
+
*
|
|
10
|
+
* The adapter is for a setup that keeps a virtual scroll value and does NOT
|
|
11
|
+
* move the page: any object with Lenis's `on('scroll')` / `off('scroll')`
|
|
12
|
+
* shape. It patches `window.scrollY` / `window.pageYOffset` to that value, and
|
|
13
|
+
* `destroy()` puts the browser's own properties back.
|
|
8
14
|
*
|
|
9
15
|
* Usage:
|
|
10
|
-
* import Lenis from '@studio-freight/lenis'
|
|
11
16
|
* import { createLenisAdapter } from 'svg-scroll-draw/lenis'
|
|
12
17
|
*
|
|
13
|
-
*
|
|
14
|
-
* const adapter = createLenisAdapter(
|
|
15
|
-
*
|
|
16
|
-
* // RAF loop — let Lenis drive the tick
|
|
17
|
-
* function raf(time: number) {
|
|
18
|
-
* lenis.raf(time)
|
|
19
|
-
* requestAnimationFrame(raf)
|
|
20
|
-
* }
|
|
21
|
-
* requestAnimationFrame(raf)
|
|
18
|
+
* // `scroller` emits 'scroll' with { scroll, velocity, direction, progress }
|
|
19
|
+
* const adapter = createLenisAdapter(scroller)
|
|
22
20
|
*
|
|
23
21
|
* // On cleanup:
|
|
24
22
|
* adapter.destroy()
|
|
@@ -34,7 +32,7 @@ interface LenisLike {
|
|
|
34
32
|
off(event: 'scroll', callback: (e: LenisScrollEvent) => void): void;
|
|
35
33
|
}
|
|
36
34
|
interface LenisAdapterInstance {
|
|
37
|
-
/** Restore
|
|
35
|
+
/** Restore the browser's own `window.scrollY` / `pageYOffset` and remove the listener. */
|
|
38
36
|
destroy: () => void;
|
|
39
37
|
/** Returns the current virtual scroll Y value Lenis last reported. */
|
|
40
38
|
getScrollY: () => number;
|
|
@@ -44,7 +42,8 @@ interface LenisAdapterInstance {
|
|
|
44
42
|
* virtual scroll position so all svg-scroll-draw engines stay in sync
|
|
45
43
|
* with smooth scroll.
|
|
46
44
|
*
|
|
47
|
-
*
|
|
45
|
+
* Not needed for Lenis 1.x, which scrolls the page itself; only for a
|
|
46
|
+
* scroller that reports a virtual position without moving the page.
|
|
48
47
|
*/
|
|
49
48
|
declare function createLenisAdapter(lenis: LenisLike): LenisAdapterInstance;
|
|
50
49
|
|
package/dist/lenis/index.d.ts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lenis smooth-scroll adapter for svg-scroll-draw.
|
|
3
3
|
*
|
|
4
|
-
* Lenis
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `window.
|
|
4
|
+
* Lenis itself does not need it. Every Lenis release so far (the 1.x line;
|
|
5
|
+
* 2.0 exists only as development prereleases) moves the real scroll position
|
|
6
|
+
* on every frame: its `setScroll()` calls `wrapper.scrollTo({ behavior:
|
|
7
|
+
* 'instant' })`, so `window.scrollY` already follows the smooth scroll and
|
|
8
|
+
* every svg-scroll-draw engine reads it with no adapter.
|
|
9
|
+
*
|
|
10
|
+
* The adapter is for a setup that keeps a virtual scroll value and does NOT
|
|
11
|
+
* move the page: any object with Lenis's `on('scroll')` / `off('scroll')`
|
|
12
|
+
* shape. It patches `window.scrollY` / `window.pageYOffset` to that value, and
|
|
13
|
+
* `destroy()` puts the browser's own properties back.
|
|
8
14
|
*
|
|
9
15
|
* Usage:
|
|
10
|
-
* import Lenis from '@studio-freight/lenis'
|
|
11
16
|
* import { createLenisAdapter } from 'svg-scroll-draw/lenis'
|
|
12
17
|
*
|
|
13
|
-
*
|
|
14
|
-
* const adapter = createLenisAdapter(
|
|
15
|
-
*
|
|
16
|
-
* // RAF loop — let Lenis drive the tick
|
|
17
|
-
* function raf(time: number) {
|
|
18
|
-
* lenis.raf(time)
|
|
19
|
-
* requestAnimationFrame(raf)
|
|
20
|
-
* }
|
|
21
|
-
* requestAnimationFrame(raf)
|
|
18
|
+
* // `scroller` emits 'scroll' with { scroll, velocity, direction, progress }
|
|
19
|
+
* const adapter = createLenisAdapter(scroller)
|
|
22
20
|
*
|
|
23
21
|
* // On cleanup:
|
|
24
22
|
* adapter.destroy()
|
|
@@ -34,7 +32,7 @@ interface LenisLike {
|
|
|
34
32
|
off(event: 'scroll', callback: (e: LenisScrollEvent) => void): void;
|
|
35
33
|
}
|
|
36
34
|
interface LenisAdapterInstance {
|
|
37
|
-
/** Restore
|
|
35
|
+
/** Restore the browser's own `window.scrollY` / `pageYOffset` and remove the listener. */
|
|
38
36
|
destroy: () => void;
|
|
39
37
|
/** Returns the current virtual scroll Y value Lenis last reported. */
|
|
40
38
|
getScrollY: () => number;
|
|
@@ -44,7 +42,8 @@ interface LenisAdapterInstance {
|
|
|
44
42
|
* virtual scroll position so all svg-scroll-draw engines stay in sync
|
|
45
43
|
* with smooth scroll.
|
|
46
44
|
*
|
|
47
|
-
*
|
|
45
|
+
* Not needed for Lenis 1.x, which scrolls the page itself; only for a
|
|
46
|
+
* scroller that reports a virtual position without moving the page.
|
|
48
47
|
*/
|
|
49
48
|
declare function createLenisAdapter(lenis: LenisLike): LenisAdapterInstance;
|
|
50
49
|
|
package/dist/lenis/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a={destroy:()=>{},getScrollY:()=>0};function d(c){if(typeof window>"u")return a;let r=window.scrollY,n=["scrollY","pageYOffset"],s=n.map(e=>Object.getOwnPropertyDescriptor(window,e)),t=false,l=e=>{r=e.scroll;try{for(let o of n)Object.defineProperty(window,o,{get:()=>r,configurable:!0});t=!0;}catch{}};return c.on("scroll",l),{destroy(){c.off("scroll",l),t&&(t=false,n.forEach((e,o)=>{try{let i=s[o];i?Object.defineProperty(window,e,i):delete window[e];}catch{}}));},getScrollY(){return r}}}export{d as createLenisAdapter};
|