svg-scroll-draw 2.23.4 → 2.23.6
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 +21 -6
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +3 -3
- package/dist/angular/index.d.ts +3 -3
- 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 +190 -265
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/{chunk-DSFD227B.mjs → chunk-22B37AWY.mjs} +1 -1
- package/dist/{chunk-YNNA33A5.mjs → chunk-BSW7W2Y5.mjs} +1 -1
- package/dist/{chunk-XTPAW6XR.mjs → chunk-CZLUBJAI.mjs} +1 -1
- package/dist/chunk-K6VATIJH.mjs +3 -0
- package/dist/chunk-NV6YTPHI.mjs +1 -0
- package/dist/chunk-NYQJPPMP.mjs +1 -0
- package/dist/{chunk-ZNCZYV3Q.mjs → chunk-OSGWGHQJ.mjs} +1 -1
- package/dist/chunk-PAGN26EH.mjs +1 -0
- package/dist/chunk-THPTANES.mjs +1 -0
- package/dist/{chunk-OJFWQ6CU.mjs → chunk-V3Z6G5JE.mjs} +1 -1
- package/dist/chunk-VJ5ZU55P.mjs +1 -0
- package/dist/chunk-XNM3VKEK.mjs +1 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-B7UpB4fT.d.ts → engine-6VsjEwzb.d.ts} +1 -1
- package/dist/{engine-o1VSQ1lX.d.mts → engine-BLWKCfxC.d.mts} +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 +1 -1
- package/dist/horizontal/index.d.ts +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-D3o4vT3e.d.ts → index-BN8yKeQ3.d.ts} +1 -1
- package/dist/{index-BY-CNE8c.d.mts → index-DAiRJgtF.d.mts} +2 -2
- package/dist/{index-CdaBYn3A.d.mts → index-DVjblK_4.d.mts} +1 -1
- package/dist/{index-DqXXiDIk.d.ts → index-hSQqLVbg.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/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +3 -3
- package/dist/nuxt/index.d.ts +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +1 -1
- package/dist/progress/index.d.ts +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +1 -1
- package/dist/reveal/index.d.ts +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-DsBMkwrX.d.ts → scroll-draw-BsU_Ohmu.d.ts} +1 -1
- package/dist/{scroll-draw-Dej-GIRP.d.mts → scroll-draw-Fzir8hlU.d.mts} +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +1 -1
- package/dist/snap/index.d.ts +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +3 -3
- package/dist/solid/index.d.ts +3 -3
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +3 -3
- package/dist/svelte/index.d.ts +3 -3
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +9 -9
- package/dist/timeline/index.d.mts +1 -1
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.mjs +8 -8
- package/dist/{types-MswK0erX.d.mts → types-9bcJdVcg.d.mts} +6 -2
- package/dist/{types-MswK0erX.d.ts → types-9bcJdVcg.d.ts} +6 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +1 -1
- package/dist/video/index.d.ts +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +3 -3
- package/dist/vue/index.d.ts +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +8 -2
- package/dist/chunk-6TWFLRUB.mjs +0 -3
- package/dist/chunk-A4JCC3QQ.mjs +0 -1
- package/dist/chunk-DM6EDKWH.mjs +0 -1
- package/dist/chunk-I73SOXBN.mjs +0 -1
- package/dist/chunk-NLPSVYFP.mjs +0 -1
- package/dist/chunk-OPXWNJBG.mjs +0 -1
- package/dist/chunk-QFSTKVA3.mjs +0 -1
package/dist/group/index.d.mts
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-9bcJdVcg.mjs';
|
|
2
|
+
import { S as ScrollParallaxOptions } from '../index-DAiRJgtF.mjs';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-BLWKCfxC.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animate multiple SVG containers simultaneously with the same options.
|
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-9bcJdVcg.js';
|
|
2
|
+
import { S as ScrollParallaxOptions } from '../index-hSQqLVbg.js';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-6VsjEwzb.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-CZLUBJAI.mjs';import {a as a$1}from'../chunk-VJ5ZU55P.mjs';import {b}from'../chunk-K6VATIJH.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.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 Ge({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),s=0,a=[];for(let c=0;c<n;c++){let p=Math.pow(o,c);a.push(p),s+=p;}let f=[0],m=0;for(let c=0;c<n;c++)m+=a[c]/s,f.push(m);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=f[p+1]){let E=(c-f[p])/(f[p+1]-f[p]);if(p===0)return E*(2-E);let P=1-Math.pow(r,p);return P+(1-P)*(2*E-1)*(2*E-1)}return 1}}function Ue({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 s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var U={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ge(),elastic:Ue()};function Le(e,t,n){return Math.min(n,Math.max(t,e))}function le(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}}function Te(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function xe(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function X(e,t,n,r){return n===t?0:Le((e-t)/(n-t)*r,0,1)}function me(e,t,n,r,o){let s=Te(e.top,e.height,t,r.element)-xe(r.viewport,n),a=Te(e.top,e.height,t,o.element)-xe(o.viewport,n);return {tStart:s,tEnd:a}}function Pe(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 Re(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 $e(e,t,n){let r=Re(e),o=Re(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 Xe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ke="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ce=33;function Ye(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ze(e){let t=[];for(let n=0;n<Ce;n++){let r=n/(Ce-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function Ae(e){switch(e){case "linear":return "linear";case "ease-in":return Xe;case "ease-out":return Ke;case "ease-in-out":return Ye()?Ze(U["ease-in-out"]):null;default:return null}}var Ie=Symbol.for("svg-scroll-draw.registry");function _e(){let e=globalThis;return e[Ie]||(e[Ie]=new Map)}function fe(e,t){_e().set(e,t);}function de(e){_e().delete(e);}var Je=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,...t){Je&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var Y,re=new Set,oe=new WeakMap,Z=new Map,ke=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function et(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 ie(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();Y??(Y=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)oe.get(a)!==ke(a)&&(s=true),oe.set(a,"");s&&re.forEach(a=>a());})),re.add(n);let r=et(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{oe.has(o)||oe.set(o,ke(o)),Z.set(o,(Z.get(o)??0)+1),Y.observe(o);}),()=>{re.delete(n)&&(r.forEach(o=>{let s=(Z.get(o)??1)-1;if(s)return void Z.set(o,s);Z.delete(o),Y?.unobserve(o);}),re.size||(Y?.disconnect(),Y=void 0));}}function Ne(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 Oe(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=Ne(s=>{if(!s)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(n))o[s]=(...a)=>n[s]?.(...a);return o.destroy=()=>{r(),n.destroy();},o}function tt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function He(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],s=[],a=r[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}t.push({fn:r[1],nums:o,units:s});}return t}function nt(e,t,n){let r=He(e),o=He(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((s,a)=>{let f=o[a];return s.fn!==f.fn||s.nums.length!==f.nums.length?n<1?`${s.fn}(${s.nums.map((m,c)=>`${m}${s.units[c]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,c)=>`${m}${f.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,c)=>`${m+(f.nums[c]-m)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function ze(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(tt(r))return $e(r,o,n);if(r.includes("("))return nt(r,o,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let f=parseFloat(s[1]),m=parseFloat(a[1]);return `${f+(m-f)*n}${s[2]||a[2]}`}return n<1?r:o}function rt(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var ot=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),it=0,We="--scroll-draw-progress";function st(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Ve={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pe(e,t){return typeof window>"u"?Ve:t.respectReducedMotion===false?De(e,t,false):Oe(t,(n,r)=>De(e,n,r))}function De(e,t,n){let{props:r,trigger:o={},easing:s="ease-out",speed:a=1,once:f=false,axis:m="y",scrollContainer:c,native:p=true,velocityScale:E=false,triggerElement:P,onProgress:k,onComplete:$,onEnter:v,onLeave:b,onEnterBack:D,onLeaveBack:L}=t,C=typeof s=="function"?s:U[s]??U["ease-out"],N=le(o.start||"top bottom"),V=le(o.end||"bottom top"),R=P??e,w=typeof c=="string"?document.querySelector(c):c??null,y=Object.entries(r).map(([i,u])=>({prop:rt(i),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function F(){let i=window.getComputedStyle(e);for(let u of y)u.from===""&&(u.from=i.getPropertyValue(u.prop).trim()||"0");}function J(){for(let i of y)e.style.setProperty(i.prop,String(i.to));}let l=new Map;for(let i of [...y.map(u=>u.prop),We])l.set(i,e.style.getPropertyValue(i));function g(){for(let[i,u]of l)u?e.style.setProperty(i,u):e.style.removeProperty(i);}if(n)return J(),$?.(),{...Ve,destroy:g,getProgress:()=>1};F();let B=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ge=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight,ye=typeof s=="string"?Ae(s):null;function Be(){if(!p||!st()||!ye||m!=="y"||w||R!==e||f||a!==1||k||$||v||b||D||L||E!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let i of y)if(!ot.has(i.prop))return false;return true}function Qe(){let i=`ssd-a-${++it}`,u=y.map(d=>`${d.prop}:${d.from}`).join(";"),W=y.map(d=>`${d.prop}:${d.to}`).join(";"),x=document.createElement("style");x.setAttribute("data-ssd-animate",""),x.textContent=`@keyframes ${i}{from{${u}}to{${W}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ye};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(x),e.classList.add(i);let M=()=>{let d=e.getBoundingClientRect();return me({top:d.top,height:d.height},B(),ge(),N,V)};fe(e,{type:"animate",getProgress:()=>h.getProgress(),getTrigger:M});let h={refresh(){},destroy(){e.classList.remove(i),x.remove(),e.style.animationPlayState="",g(),de(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let G=Math.min(1,Math.max(0,d));e.classList.remove(i);for(let ne of y)e.style.setProperty(ne.prop,ze(ne.from,ne.to,G));},getProgress(){let{tStart:d,tEnd:G}=M();return C(X(B(),d,G,a))}};return h}if(Be())return Qe();let S=0,T=0,Q=0,O=NaN,A=false,se=-1,H=0,I=0,ee=false,_=NaN,ae=-1,be=0,q=R===e?y:[],he=false;function Ee(){let i=e.style,u=q.map(h=>i.getPropertyValue(h.prop)),W=i.transition;q.length&&(i.transition="none"),q.forEach(h=>i.setProperty(h.prop,l.get(h.prop)??""));let x=Pe(R,w,m);q.forEach((h,d)=>i.setProperty(h.prop,u[d])),q.length&&(e.offsetWidth,i.transition=W);let M=me(x,x.scroll,ge(),N,V);he&&Math.abs(M.tStart-S)<1&&Math.abs(M.tEnd-T)<1||(he=true,S=M.tStart,T=M.tEnd);}function te(i){e.style.setProperty(We,String(i));for(let u of y)e.style.setProperty(u.prop,ze(u.from,u.to,i));k?.(i);}function qe(i){if(isNaN(_)){_=i;return}_<=0&&i>0?v?.():_>0&&i<=0&&L?.(),_<1&&i>=1?b?.():_>=1&&i<1&&D?.(),_=i;}let we=i=>X(i,S,T,Math.min(a,1));function z(){!Q&&!A&&we(B())!==O&&(Q=requestAnimationFrame(ve));}function ve(){if(A)return;let i=performance.now(),u=B(),W=a;if(E!==false){let d=i-be,G=d>0?Math.abs(u-(ae<0?u:ae))/d:0;W=a*Math.max(.2,1+G*(typeof E=="number"?E:1)*.04);}ae=u,be=i;let x=T===S?0:(u-S)/(T-S);qe(x);let M=X(u,S,T,W),h=f?Math.max(se,C(H=Math.max(H,M))):C(M);I=h,te(h),h>=1&&!ee?(ee=true,$?.()):h<1&&!f&&(ee=false),!A&&(O=we(u),Q=O>0&&O<1?requestAnimationFrame(ve):0);}Ee(),T===S&&K("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),H=X(B(),S,T,a),I=C(H),te(I);function Se(){Ee(),z();}let ue;function j(){clearTimeout(ue),ue=setTimeout(Se,150);}let Me=w??window;Me.addEventListener("scroll",z,{passive:true}),window.addEventListener("resize",j),window.addEventListener("orientationchange",j);let je=ie([R],j);z(),fe(e,{type:"animate",getProgress:()=>I,getTrigger:()=>({tStart:S,tEnd:T})});function ce(){A=true,cancelAnimationFrame(Q),Q=0,O=NaN;}return {destroy(){ce(),Me.removeEventListener("scroll",z),window.removeEventListener("resize",j),window.removeEventListener("orientationchange",j),je(),clearTimeout(ue),g(),de(e);},replay(){se=-1,H=0,ee=false,I=0,A=false,te(0),O=0,z();},pause:ce,resume(){A&&(A=false,z());},seek(i){let u=Math.min(1,Math.max(0,i));I=u,se=u,H=0,ce(),te(u);},getProgress(){return I},refresh:Se}}var Fe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function kt(e,t={}){if(typeof window>"u")return Fe;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return K("scrollHorizontal: track element not found:",e),Fe;let r=n,{easing:o="linear",trigger:s={start:"top top",end:"bottom bottom"},scrollContainer:a,respectReducedMotion:f=false,onProgress:m}=t,c=typeof a=="string"?document.querySelector(a):a??null;function p(){for(let l=r.parentElement;l;l=l.parentElement)if(window.getComputedStyle(l).position==="sticky")return l;return null}function E(){let l=p();if(l){let g=window.getComputedStyle(l);return l.clientWidth-(parseFloat(g.paddingLeft)||0)-(parseFloat(g.paddingRight)||0)}return c?c.clientWidth:document.documentElement.clientWidth||window.innerWidth}function P(){return t.distance??r.scrollWidth-E()}function k(){if(t.triggerElement!==void 0){let g=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(g)return g;K("scrollHorizontal: triggerElement not found:",t.triggerElement);}let l=p();return l?l.parentElement??l:r}let $=P(),v=k(),b=pe(r,C($,v)),D=N(),L=null;function C(l,g){return {props:{transform:["translateX(0px)",`translateX(${-l}px)`]},trigger:s,easing:o,native:false,respectReducedMotion:f,...g!==r&&{triggerElement:g},...a!==void 0&&{scrollContainer:a},...m!==void 0&&{onProgress:m}}}function N(){let l=v.getBoundingClientRect(),g=c?l.top-c.getBoundingClientRect().top+c.scrollTop:l.top+window.scrollY;return `${P()} ${Math.round(g)} ${Math.round(l.height)}`}function V(){b.destroy();let l=k(),g=l!==v;$=P(),v=l,b=pe(r,C($,v)),D=N(),L!==null&&b.seek(L),g&&J();}let R;function w(){(k()!==v||N()!==D)&&V();}function y(){clearTimeout(R),R=setTimeout(w,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let F=()=>{};function J(){F(),F=ie([r,v],y);}return J(),{destroy(){clearTimeout(R),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),F(),b.destroy();},replay(){L=null,b.replay();},pause(){b.pause(),L=b.getProgress();},resume(){L=null,b.resume();},seek(l){b.seek(l),L=b.getProgress();},getProgress(){return b.getProgress()},refresh(){V();}}}exports.scrollHorizontal=kt;
|
|
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 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-VJ5ZU55P.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-2PYLM3E7.mjs';import {d}from'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.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 b$1(){for(let e=o.parentElement;e;e=e.parentElement)if(window.getComputedStyle(e).position==="sticky")return e;return null}function M(){let e=b$1();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=b$1();return e?e.parentElement??e:o}let m=d$1(),i=g(),n=a(o,T(m,i)),S=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)),S=f(),l!==null&&n.seek(l),t&&H();}let p;function W(){(g()!==i||f()!==S)&&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,5 +1,5 @@
|
|
|
1
|
-
import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-
|
|
2
|
-
import { S as ScrollAnimateOptions } from './engine-
|
|
1
|
+
import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-9bcJdVcg.mjs';
|
|
2
|
+
import { S as ScrollAnimateOptions } from './engine-BLWKCfxC.mjs';
|
|
3
3
|
|
|
4
4
|
interface ScrollParallaxOptions {
|
|
5
5
|
speed?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-
|
|
2
|
-
import { S as ScrollAnimateOptions } from './engine-
|
|
1
|
+
import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-9bcJdVcg.js';
|
|
2
|
+
import { S as ScrollAnimateOptions } from './engine-6VsjEwzb.js';
|
|
3
3
|
|
|
4
4
|
interface ScrollParallaxOptions {
|
|
5
5
|
speed?: number;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${m?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}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 Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function wr(e,r,t){if(!We)return;let n=(e.match(Ut)??[]).join("").toUpperCase(),s=(r.match(Ut)??[]).join("").toUpperCase(),a=(e.match(Qt)??[]).length,c=(r.match(Qt)??[]).length;if(n!==s){G(`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}a!==c&&G(`morphTo: coordinate count differs (${a} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function vr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let c=parseFloat(a),f=n[s++]??c;return String(+(c+(f-c)*t).toFixed(4))})}function Yt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Be(r,(t,n)=>Er(e,t,n))}function Er(e,r,t){let{preset:n,...s}=r,a=n?{...wt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:f=1,fade:m=false,easing:d="linear",trigger:x={},stagger:A=0,direction:b="forward",once:J=false,debug:fe=false,axis:I="y",scrollContainer:v,autoReverse:T=false,delay:p=0,strokeColor:w,strokeWidth:h,fillOpacity:F,waypoints:O,velocityScale:C=false,threshold:V=0,rootMargin:Ce="0px",repeat:ge=0,repeatDelay:he=0,morphTo:B,clip:oe,autoplay:Se=false,duration:Ne=1e3,native:Fe=true,onProgress:le,onStart:z,onComplete:H,onEnter:E,onLeave:L,onEnterBack:be,onLeaveBack:Ve}=a,q=oe===true?"left":typeof oe=="string"?oe:false,j=typeof d=="function"?d:K[d]??K.linear,He=Pe(x.start||"top bottom"),we=Pe(x.end||"bottom top"),ee=typeof v=="string"?document.querySelector(v):v??null,xe=Array.isArray(w)?w[0]:null,pe=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ve=Array.isArray(h)?h[0]:null,Te=Array.isArray(h)?h[1]:typeof h=="number"?h:null,de=Array.isArray(F)?F[0]:null,ke=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function Me(o){let i=o*100;switch(q){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let P=q?[]:Array.from(e.querySelectorAll(c)),se=[],ce=[],Q=0,_=0,_e=A,Ke=0,R=false,l=false,u=0,ye=false,te=-1,W=[],N=-1,y=false,U=0,ie=0,Ie,ft=null;function Tt(){ft?.destroy(),ft=null;}let De=new Set,Mt=NaN,Oe=true,Je=-1,At=performance.now(),ze=NaN;function je(){return ee?I==="x"?ee.scrollLeft:ee.scrollTop:I==="x"?window.scrollX:window.scrollY}function Lt(){return ee?I==="x"?ee.clientWidth:ee.clientHeight:I==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=nt(e,ee,I);return Re(o,o.scroll,Lt(),He,we)}function rr(){let o=_-Q,i=P.length-1,g=ee??document.documentElement,M=I==="x"?"Width":"Height";if(_e=A,A>0&&i>0&&o>0){let re=g[`scroll${M}`]-g[`client${M}`]-1-Q-o/f;re>=0&&(_e=Math.min(A,re/(i*o)));}Ke=_+i*_e*o;}function $t(){(({tStart:Q,tEnd:_}=Pt())),rr(),fe&&We&&(Tt(),ft=br(Q,_,I));}function pt(o,i=Pt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let g=o.destroy;return o.destroy=()=>{g.call(o),Ee(e);},o}function Ct(o,i){return J&&!T?Math.max(te,j(W[o]=Math.max(W[o]??0,i))):j(i)}function nr(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),q){let g=i==="reverse"?1-o:o;e.style.clipPath=Me(g);return}P.forEach((g,M)=>dt(g,M,o,i));}function dt(o,i,g,M){o.style.strokeDashoffset=M==="reverse"?`${se[i]*g}`:`${se[i]*(1-g)}`,m&&(o.style.opacity=M==="reverse"?`${1-g}`:`${g}`),xe&&pe?o.style.stroke=st(xe,pe,g):pe&&(o.style.stroke=pe),ve!==null&&Te!==null?o.style.strokeWidth=`${ve+(Te-ve)*g}`:Te!==null&&(o.style.strokeWidth=`${Te}`),de!==null&&ke!==null?o.style.fillOpacity=`${de+(ke-de)*g}`:ke!==null&&(o.style.fillOpacity=`${ke}`),B&&o.tagName.toLowerCase()==="path"&&ce[i]&&o.setAttribute("d",vr(ce[i],B,g));}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),q){e.style.clipPath=Me(b==="reverse"?1:0);return}P.forEach((o,i)=>{o.style.strokeDasharray=`${se[i]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${se[i]}`,m?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ve!==null&&(o.style.strokeWidth=`${ve}`),de!==null&&(o.style.fillOpacity=`${de}`),B&&o.tagName.toLowerCase()==="path"&&ce[i]&&o.setAttribute("d",ce[i]);});}function Ue(o,i){let g=o.getAttribute("d"),M=ot(o);if(B&&ce[i]){o.setAttribute("d",B);let re=ot(o);o.setAttribute("d",ce[i]),M=Math.max(ot(o),re),o.setAttribute("d",g);}se[i]=M,o.style.strokeDasharray=`${M}`;}if(P.forEach((o,i)=>{hr(o);let g=o.tagName.toLowerCase()==="path";g?ce.push(o.getAttribute("d")??""):ce.push(""),Ue(o,i);let M=se[i];B&&(g?wr(ce[ce.length-1],B,o):G(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=b==="reverse"?`${M}`:"0",m&&(o.style.opacity="1"),pe&&(o.style.stroke=pe),Te!==null&&(o.style.strokeWidth=`${Te}`),ke!==null&&(o.style.fillOpacity=`${ke}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=b==="reverse"?"0":`${M}`,m?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ve!==null&&(o.style.strokeWidth=`${ve}`),de!==null&&(o.style.fillOpacity=`${de}`));}),t)return q&&(e.style.clipPath=Me(1)),H?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};q&&(e.style.clipPath=Me(b==="reverse"?1:0));let kt=typeof d=="string"?it(d):null;function or(){return !(Fe===false||Se||fe&&We||!yr()||!P.length||!kt||q||I!=="y"||ee||f!==1||A!==0||J||T||C!==false||B||O||ge||p>0||le||z||H||E||L||be||Ve||w!=null||h!=null||F!=null||(x.start||"top bottom").trim()!=="top bottom"||(x.end||"bottom top").trim()!=="bottom top")}function sr(){let o=++gr,i=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,M=`--svg-scroll-draw-${o}`,re=b==="reverse"?"0":"var(--ssd-len)",Ae=b==="reverse"?"var(--ssd-len)":"0",ue=`stroke-dashoffset:${re};`,k=`stroke-dashoffset:${Ae};`;m&&(ue+=`opacity:${b==="reverse"?1:0};`,k+=`opacity:${b==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${i}{from{${ue}}to{${k}}}.${g}{view-timeline-name:${M};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${kt};animation-fill-mode:both;animation-timeline:${M};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function Y(S,$){S.style.setProperty("--ssd-len",String(se[$])),S.style.strokeDasharray=`${se[$]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(i);}P.forEach(Y);let X=false,ae=-1;function me(){if(ae>=0)return ae;let S=e.getBoundingClientRect(),{tStart:$,tEnd:Z}=Re({top:S.top,height:S.height},je(),Lt(),He,we);return j(ne(je(),$,Z,f))}return {destroy(){e.classList.remove(g),P.forEach(S=>{S.classList.remove(i),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){X=false,ae=-1,P.forEach(Y);},pause(){X=true,P.forEach(S=>{S.style.animationPlayState="paused";});},resume(){X&&(X=false,P.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let $=Math.min(1,Math.max(0,S));ae=$,X=true,P.forEach((Z,Le)=>{Z.classList.remove(i),Z.style.strokeDashoffset=b==="reverse"?`${se[Le]*$}`:`${se[Le]*(1-$)}`,m&&(Z.style.opacity=b==="reverse"?`${1-$}`:`${$}`);});},getProgress(){return me()},refresh(){P.forEach((S,$)=>{Ue(S,$),S.style.setProperty("--ssd-len",String(se[$]));});}}}if(or())return pt(sr());function ir(){let o=Math.max(1,Ne),i=q?o:o*(1+Math.max(0,P.length-1)*A),g=0,M=0,re=false;function Ae(ae){let me=true,S=Math.min(1,Math.max(0,ae/i));if(q){let $=Math.min(1,Math.max(0,ae/o)),Z=j($);U=Z,e.style.setProperty("--scroll-draw-progress",String(Z)),e.style.clipPath=Me(b==="reverse"?1-Z:Z),le?.(Z),$<1&&(me=false);}else {P.forEach((Z,Le)=>{let lr=Le*A*o,Ot=Math.min(1,Math.max(0,(ae-lr)/o));dt(Z,Le,j(Ot),b),Ot<1&&(me=false);});let $=j(S);U=$,le?.($),e.style.setProperty("--scroll-draw-progress",String($));}if(O){let $=j(S);for(let Z in O){let Le=parseFloat(Z);$>=Le&&!De.has(Le)&&(De.add(Le),O[Z]?.());}}return me}function ue(ae){if(y)return;let me=ae-g;l||(l=true,z?.());let S=Ae(me);if(S&&!R){R=true,Ae(i),H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{g=performance.now(),l=false,R=false,De.clear(),Qe(),u=requestAnimationFrame(ue);},he));return}S||(u=requestAnimationFrame(ue));}function k(){cancelAnimationFrame(u),clearTimeout(Ie),g=performance.now(),M=0,y=false,l=false,R=false,ie=0,re=true,U=0,De.clear(),Qe(),u=requestAnimationFrame(ue);}let D=new IntersectionObserver(ae=>{ae.forEach(me=>{me.isIntersecting&&!(J&&R)?k():!me.isIntersecting&&!J&&!R&&(cancelAnimationFrame(u),clearTimeout(Ie),re=false);});},{root:ee??null,threshold:V,rootMargin:Ce}),Y;function X(){clearTimeout(Y),Y=setTimeout(()=>P.forEach(Ue),150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),p>0?setTimeout(()=>D.observe(e),p):D.observe(e),{destroy(){cancelAnimationFrame(u),clearTimeout(Ie),D.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(Y);},replay(){ie=0,k();},pause(){y||!re||(y=true,M=performance.now()-g,cancelAnimationFrame(u));},resume(){y&&(y=false,re=true,g=performance.now()-M,u=requestAnimationFrame(ue));},seek(ae){let me=Math.min(1,Math.max(0,ae));U=me,y=true,M=me*i,g=performance.now()-M,cancelAnimationFrame(u),Ae(M);},getProgress(){return U},refresh(){clearTimeout(Y),P.forEach(Ue);}}}if(Se)return pt(ir());$t();function It(){if(y||!qe)return;let o=performance.now(),i=je();if(!Oe&&C===false&&i===Mt){yt(i);return}Oe=false,Mt=i;let g=f;if(C!==false){let k=o-At,D=k>0?Math.abs(i-(Je<0?i:Je))/k:0;g=f*Math.max(.2,1+D*(typeof C=="number"?C:1)*.04);}Je=i,At=o;let M=T?N===-1||i>=N?"forward":"reverse":b;N=i;let re=_-Q,Ae=true,ue=re===0?0:(i-Q)/re;if(isNaN(ze)||(ze<=0&&ue>0?E?.():ze>0&&ue<=0&&Ve?.(),ze<1&&ue>=1?L?.():ze>=1&&ue<1&&be?.()),ze=ue,q){let k=Ct(0,ne(i,Q,_,g));U=k,e.style.setProperty("--scroll-draw-progress",String(k));let D=M==="reverse"?1-k:k;e.style.clipPath=Me(D),le?.(k),!l&&ne(i,Q,_,g)>0&&(l=true,z?.()),k>=1&&!R?(R=true,H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{te=-1,W=[],l=false,R=false,Qe();},he))):k<1&&!J&&(R=false),yt(i);return}if(P.forEach((k,D)=>{let Y=D*_e*re,X=Ct(D,ne(i,Q+Y,_+Y,g));dt(k,D,X,M),D===0&&(U=X,le?.(X),e.style.setProperty("--scroll-draw-progress",String(X))),X<1&&(Ae=false);}),O){let k=j(ne(i,Q,_,g));for(let D in O){let Y=parseFloat(D);k>=Y&&!De.has(Y)&&(De.add(Y),O[D]?.());}}!l&&ne(i,Q,_,g)>0&&(l=true,z?.()),Ae&&!R?(R=true,H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{te=-1,W=[],l=false,R=false,De.clear(),Qe(),Oe=true;},he))):!Ae&&!J&&(R=false),yt(i);}function gt(o){return o>=_&&o<Ke}function yt(o){ye||gt(o)?u=requestAnimationFrame(It):qe=false;}function ht(){return ye||gt(je())}let qe=false;function et(){qe||(qe=true,u=requestAnimationFrame(function(){It();}));}function tt(){qe=false,cancelAnimationFrame(u);}let bt=new IntersectionObserver(o=>{o.forEach(i=>{ye=i.isIntersecting,ye&&!y?(Oe=true,et()):qe&&!y&>(je())||tt();});},{root:ee??null,threshold:V,rootMargin:Ce});function Dt(){P.forEach(Ue),$t(),Oe=true;}let rt;function Ye(){clearTimeout(rt),rt=setTimeout(Dt,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let ar=Ge([e],Ye);return p>0?setTimeout(()=>bt.observe(e),p):bt.observe(e),pt({destroy(){cancelAnimationFrame(u),clearTimeout(Ie),tt(),bt.disconnect(),ar(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(rt),Tt();},replay(){te=-1,W=[],N=-1,Je=-1,l=false,R=false,ie=0,y=false,U=0,De.clear(),clearTimeout(Ie),Qe(),Oe=true,ht()&&et();},pause(){y=true,tt();},resume(){y&&(y=false,Oe=true,ht()&&et());},seek(o){let i=Math.min(1,Math.max(0,o));U=i,te=i,W=[],y=true,tt(),nr(i,b),Oe=true;},getProgress(){return U},refresh(){clearTimeout(rt),Dt(),ht()&&!y&&et();}},()=>({tStart:Q,tEnd:_}))}function Sr(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?Yt(n,r):(G("Container not found:",e),t)}function xr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],a=[],c=n[2].trim();if(c)for(let f of c.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),a.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:a});}return r}function Tr(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((a,c)=>{let f=s[c];return a.fn!==f.fn||a.nums.length!==f.nums.length?t<1?`${a.fn}(${a.nums.map((m,d)=>`${m}${a.units[d]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,d)=>`${m}${f.units[d]}`).join(", ")})`:`${a.fn}(${a.nums.map((m,d)=>`${m+(f.nums[d]-m)*t}${a.units[d]}`).join(", ")})`}).join(" ")}function Zt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(xr(n))return st(n,s,t);if(n.includes("("))return Tr(n,s,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(a&&c){let f=parseFloat(a[1]),m=parseFloat(c[1]);return `${f+(m-f)*t}${a[2]||c[2]}`}return t<1?n:s}function Mr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Lr=0,Kt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var er={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,r){return typeof window>"u"?er:r.respectReducedMotion===false?Jt(e,r,false):Be(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:a="ease-out",speed:c=1,once:f=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:A=false,triggerElement:b,onProgress:J,onComplete:fe,onEnter:I,onLeave:v,onEnterBack:T,onLeaveBack:p}=r,w=typeof a=="function"?a:K[a]??K["ease-out"],h=Pe(s.start||"top bottom"),F=Pe(s.end||"bottom top"),O=b??e,C=typeof d=="string"?document.querySelector(d):d??null,V=Object.entries(n).map(([l,u])=>({prop:Mr(l),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function Ce(){let l=window.getComputedStyle(e);for(let u of V)u.from===""&&(u.from=l.getPropertyValue(u.prop).trim()||"0");}function ge(){for(let l of V)e.style.setProperty(l.prop,String(l.to));}let he=new Map;for(let l of [...V.map(u=>u.prop),Kt])he.set(l,e.style.getPropertyValue(l));function B(){for(let[l,u]of he)u?e.style.setProperty(l,u):e.style.removeProperty(l);}if(t)return ge(),fe?.(),{...er,destroy:B,getProgress:()=>1};Ce();let oe=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,Se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight,Ne=typeof a=="string"?it(a):null;function Fe(){if(!x||!Pr()||!Ne||m!=="y"||C||O!==e||f||c!==1||J||fe||I||v||T||p||A!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of V)if(!Ar.has(l.prop))return false;return true}function le(){let l=`ssd-a-${++Lr}`,u=V.map(y=>`${y.prop}:${y.from}`).join(";"),ye=V.map(y=>`${y.prop}:${y.to}`).join(";"),te=document.createElement("style");te.setAttribute("data-ssd-animate",""),te.textContent=`@keyframes ${l}{from{${u}}to{${ye}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ne};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(te),e.classList.add(l);let W=()=>{let y=e.getBoundingClientRect();return Re({top:y.top,height:y.height},oe(),Se(),h,F)};$e(e,{type:"animate",getProgress:()=>N.getProgress(),getTrigger:W});let N={refresh(){},destroy(){e.classList.remove(l),te.remove(),e.style.animationPlayState="",B(),Ee(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(y){let U=Math.min(1,Math.max(0,y));e.classList.remove(l);for(let ie of V)e.style.setProperty(ie.prop,Zt(ie.from,ie.to,U));},getProgress(){let{tStart:y,tEnd:U}=W();return w(ne(oe(),y,U,c))}};return N}if(Fe())return le();let z=0,H=0,E=0,L=NaN,be=false,Ve=-1,q=0,j=0,He=false,we=NaN,ee=-1,xe=0,pe=O===e?V:[],ve=false;function Te(){let l=e.style,u=pe.map(N=>l.getPropertyValue(N.prop)),ye=l.transition;pe.length&&(l.transition="none"),pe.forEach(N=>l.setProperty(N.prop,he.get(N.prop)??""));let te=nt(O,C,m);pe.forEach((N,y)=>l.setProperty(N.prop,u[y])),pe.length&&(e.offsetWidth,l.transition=ye);let W=Re(te,te.scroll,Se(),h,F);ve&&Math.abs(W.tStart-z)<1&&Math.abs(W.tEnd-H)<1||(ve=true,z=W.tStart,H=W.tEnd);}function de(l){e.style.setProperty(Kt,String(l));for(let u of V)e.style.setProperty(u.prop,Zt(u.from,u.to,l));J?.(l);}function ke(l){if(isNaN(we)){we=l;return}we<=0&&l>0?I?.():we>0&&l<=0&&p?.(),we<1&&l>=1?v?.():we>=1&&l<1&&T?.(),we=l;}let Me=l=>ne(l,z,H,Math.min(c,1));function P(){!E&&!be&&Me(oe())!==L&&(E=requestAnimationFrame(se));}function se(){if(be)return;let l=performance.now(),u=oe(),ye=c;if(A!==false){let y=l-xe,U=y>0?Math.abs(u-(ee<0?u:ee))/y:0;ye=c*Math.max(.2,1+U*(typeof A=="number"?A:1)*.04);}ee=u,xe=l;let te=H===z?0:(u-z)/(H-z);ke(te);let W=ne(u,z,H,ye),N=f?Math.max(Ve,w(q=Math.max(q,W))):w(W);j=N,de(N),N>=1&&!He?(He=true,fe?.()):N<1&&!f&&(He=false),!be&&(L=Me(u),E=L>0&&L<1?requestAnimationFrame(se):0);}Te(),H===z&&G("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),q=ne(oe(),z,H,c),j=w(q),de(j);function ce(){Te(),P();}let Q;function _(){clearTimeout(Q),Q=setTimeout(ce,150);}let _e=C??window;_e.addEventListener("scroll",P,{passive:true}),window.addEventListener("resize",_),window.addEventListener("orientationchange",_);let Ke=Ge([O],_);P(),$e(e,{type:"animate",getProgress:()=>j,getTrigger:()=>({tStart:z,tEnd:H})});function R(){be=true,cancelAnimationFrame(E),E=0,L=NaN;}return {destroy(){R(),_e.removeEventListener("scroll",P),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),Ke(),clearTimeout(Q),B(),Ee(e);},replay(){Ve=-1,q=0,He=false,j=0,be=false,de(0),L=0,P();},pause:R,resume(){be&&(be=false,P());},seek(l){let u=Math.min(1,Math.max(0,l));j=u,Ve=u,q=0,R(),de(u);},getProgress(){return j},refresh:ce}}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function $r(e,r){if(typeof window>"u")return ut;let t=typeof e=="string"?document.querySelector(e):e;return t?vt(t,r):(G("scrollAnimate: element not found:",e),ut)}function Cr(e,r={}){if(typeof window>"u")return ut;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return G("scrollParallax: element not found:",e),ut;let{speed:n=.3,axis:s="y",easing:a="linear",trigger:c,onProgress:f}=r,m=-n*100,d=t.style,x=!!t.ownerSVGElement,A=d.getPropertyValue("transform-box");x&&d.setProperty("transform-box","fill-box");let b=vt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:f});return x?{...b,destroy(){b.destroy(),d.setProperty("transform-box",A);}}:b}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return Et;let t=typeof e=="string"?document.querySelector(e):e;return t?Be(r,(n,s)=>Ir(t,n,s)):(G("scrollCounter: element not found:",e),Et)}function Ir(e,r,t){let{from:n=0,to:s,format:a,easing:c="ease-out",trigger:f={},once:m=true,decimals:d,onComplete:x}=r,A=d!==void 0?E=>E.toFixed(d):a??(E=>String(Math.round(E))),b=typeof c=="function"?c:K[c]??K["ease-out"],J=Pe(f.start||"top 80%"),fe=Pe(f.end||"top 20%");if(t)return e.textContent=A(s),x?.(),{...Et,getProgress:()=>1};let I=0,v=0,T=false,p=0,w=false,h=false,F=-1,O=0,C=0,V=false,Ce=()=>window.scrollY,ge=()=>window.innerHeight;function he(){let E=e.getBoundingClientRect(),L=Re({top:E.top,height:E.height},Ce(),ge(),J,fe);T&&Math.abs(L.tStart-I)<1&&Math.abs(L.tEnd-v)<1||(T=true,I=L.tStart,v=L.tEnd);}let B=e.style.getPropertyValue("--scroll-draw-progress");function oe(E){e.textContent=A(n+(s-n)*E),e.style.setProperty("--scroll-draw-progress",String(E));}function Se(){if(!w||h)return;let E=ne(Ce(),I,v,1),L=m?Math.max(F,b(O=Math.max(O,E))):b(E);C=L,oe(L),L>=1&&!V?(V=true,x?.()):L<1&&!m&&(V=false),p=requestAnimationFrame(Se);}he();{O=ne(Ce(),I,v,1);let E=b(O);C=E,oe(E);}let Ne=new IntersectionObserver(E=>{E.forEach(L=>{w=L.isIntersecting,w&&!h?p=requestAnimationFrame(Se):cancelAnimationFrame(p);});}),Fe;function le(){clearTimeout(Fe),Fe=setTimeout(he,150);}window.addEventListener("resize",le),window.addEventListener("orientationchange",le);let z=Ge([e],le);Ne.observe(e),$e(e,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:I,tEnd:v})});function H(){h&&(h=false,w&&(p=requestAnimationFrame(Se)));}return {destroy(){cancelAnimationFrame(p),Ne.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),z(),clearTimeout(Fe),e.style.setProperty("--scroll-draw-progress",B),Ee(e);},replay(){F=-1,O=0,V=false,C=0,oe(0),H();},pause(){h=true,cancelAnimationFrame(p);},resume:H,seek(E){let L=Math.min(1,Math.max(0,E));C=L,F=L,O=0,h=true,cancelAnimationFrame(p),oe(L);},getProgress(){return C}}}var tr="http://www.w3.org/2000/svg",Dr="cinematic-photo",St=e=>e<0?0:e>1?1:e;function mt(e){let r=parseFloat(e);return Number.isFinite(r)?St(r/100):0}function Or(e){return K[e]??K.linear}var Rr={destroy:()=>{},getProgress:()=>0},xt=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||G("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Rr;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 v of r.scenes){if(v.background){let p=document.createElement("img");p.id=Dr,p.src=v.background,p.alt="",p.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(p);}let T=v.animations.filter(p=>p.type==="draw");if(T.length){let p=document.createElementNS(tr,"svg");p.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),p.setAttribute("preserveAspectRatio","xMidYMid meet"),p.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(p);for(let w of T){let h=document.createElementNS(tr,"path");h.id=w.target.replace(/^#/,""),h.setAttribute("d",w.d),h.setAttribute("fill","none"),h.setAttribute("stroke",w.stroke),h.setAttribute("stroke-width",String(w.strokeWidth)),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round");let F=w.length||h.getTotalLength?.()||0;h.style.strokeDasharray=String(F),h.style.strokeDashoffset=String(F),p.appendChild(h),s.push({kind:"draw",el:h,start:mt(w.start),end:mt(w.end),ease:Or(w.easing),length:F});}}for(let p of v.animations){if(p.type!=="fade")continue;let w=n.querySelector(p.target)??document.querySelector(p.target);w&&(w.style.opacity=String(p.from),s.push({kind:"fade",el:w,start:mt(p.start),end:mt(p.end),ease:K["ease-in-out"]??K.linear,from:p.from,to:p.to}));}}let a=0,c=()=>{let v=t.offsetHeight-window.innerHeight;return v<=0?t.getBoundingClientRect().top<=0?1:0:St(-t.getBoundingClientRect().top/v)},f=v=>{for(let T of s){let p=T.end-T.start,w=p<=0?v>=T.end?1:0:St((v-T.start)/p),h=T.ease(w);T.kind==="draw"?T.el.style.strokeDashoffset=String(T.length*(1-h)):T.el.style.opacity=String(T.from+(T.to-T.from)*h);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let m=0,d=false,x=false,A=()=>{a=c(),f(a),d&&(m=requestAnimationFrame(A));},b=()=>{d||(d=true,m=requestAnimationFrame(A));},J=()=>{d=false,cancelAnimationFrame(m);},fe=new IntersectionObserver(v=>{for(let T of v)x=T.isIntersecting,x?b():J();},{threshold:0});fe.observe(n),a=c(),f(a),$e(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let v=t.getBoundingClientRect().top+window.scrollY;return {tStart:v,tEnd:v+Math.max(0,t.offsetHeight-window.innerHeight)}}});let I=ct(v=>{v&&(I(),J(),fe.disconnect(),Ee(t),a=1,f(1));});return {destroy(){I(),J(),fe.disconnect(),Ee(t);},getProgress:()=>a}}};
|
|
4
|
-
exports.Cinematic=
|
|
1
|
+
'use strict';function Dt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ot({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,c=[];for(let p=0;p<t;p++){let v=Math.pow(s,p);c.push(v),i+=v;}let m=[0],u=0;for(let p=0;p<t;p++)u+=c[p]/i,m.push(u);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let v=0;v<t;v++)if(p<=m[v+1]){let S=(p-m[v])/(m[v+1]-m[v]);if(v===0)return S*(2-S);let h=1-Math.pow(n,v);return h+(1-h)*(2*S-1)*(2*S-1)}return 1}}function It({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 U={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:Dt(),bounce:Ot(),elastic:It()};function Rt(e,r,t){return Math.min(t,Math.max(r,e))}function Te(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 Ft=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function Nt(e,r,t,n){return e+t+r*Ft(n,0)}function Ht(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Ft(e,1))}function X(e,r,t,n){return t===r?0:Rt((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=Nt(e.top,e.height,r,n.element)-Ht(n.viewport,t),c=Nt(e.top,e.height,r,s.element)-Ht(s.viewport,t);return {tStart:i,tEnd:c}}function Ke(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 Je(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 _t(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 et(e,r,t){let n=_t(e),s=_t(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 dt={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 Fe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function W(e,...r){Fe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var cr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",ur="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Vt=33;function mr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function fr(e){let r=[];for(let t=0;t<Vt;t++){let n=t/(Vt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function tt(e){switch(e){case "linear":return "linear";case "ease-in":return cr;case "ease-out":return ur;case "ease-in-out":return mr()?fr(U["ease-in-out"]):null;default:return null}}var Gt=Symbol.for("svg-scroll-draw.registry");function Wt(){let e=globalThis;return e[Gt]||(e[Gt]=new Map)}function Me(e,r){Wt().set(e,r);}function pe(e){Wt().delete(e);}function rt(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 _e(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=rt(i=>{if(!i)return;n();let c=(t.getProgress?.()??0)>=1;t.destroy(),t=r(c?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...c)=>t[i]?.(...c);return s.destroy=()=>{n(),t.destroy();},s}var je,nt=new Set,ot=new WeakMap,Qe=new Map,zt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function pr(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 Bt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();je??(je=new ResizeObserver(s=>{let i=false;for(let{target:c}of s)ot.get(c)!==zt(c)&&(i=true),ot.set(c,"");i&&nt.forEach(c=>c());})),nt.add(t);let n=pr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,zt(s)),Qe.set(s,(Qe.get(s)??0)+1),je.observe(s);}),()=>{nt.delete(t)&&(n.forEach(s=>{let i=(Qe.get(s)??1)-1;if(i)return void Qe.set(s,i);Qe.delete(s),je?.unobserve(s);}),nt.size||(je?.disconnect(),je=void 0));}}function Ve(e,r,t,n,s){let i,c=NaN,m,u,p=()=>{i=0,n(),!m&&!i&&(c=t())>0&&c<1&&(i=requestAnimationFrame(p));},v=()=>{!i&&!m&&t()!==c&&(i=requestAnimationFrame(p));},S=y=>{m=y,cancelAnimationFrame(i),i=c=NaN,v();},h=()=>{clearTimeout(u),s(),v();},O=()=>{clearTimeout(u),u=setTimeout(h,150);},ee=Bt(r,O),A=y=>{e[y]("scroll",v,{passive:true}),window[y]("resize",O),window[y]("orientationchange",O);};return A("addEventListener"),v(),{hold:S,remeasure:h,off(){S(true),A("removeEventListener"),ee(),clearTimeout(u);}}}var dr=0;function gr(){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 jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function yr(e){if(!Fe)return;let r=qt(e,"stroke");if(!r||r==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!jt.has(t)&&!jt.has(qt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e);}function hr(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,c=e-i,m=r-i,u=t==="x";n.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}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;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}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 Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function br(e,r,t){if(!Fe)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,c=(r.match(Qt)??[]).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!==c&&W(`morphTo: coordinate count differs (${i} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wr(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 c=parseFloat(i),m=n[s++]??c;return String(+(c+(m-c)*t).toFixed(4))})}function Ut(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(r,(t,n)=>vr(e,t,n))}function vr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:p="linear",trigger:v={},stagger:S=0,direction:h="forward",once:O=false,debug:ee=false,axis:A="y",scrollContainer:y,autoReverse:x=false,delay:g=0,strokeColor:b,strokeWidth:w,fillOpacity:I,waypoints:z,velocityScale:N=false,threshold:te=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:re,autoplay:Ae=false,duration:L=1e3,native:H=true,onProgress:ke,onStart:Z,onComplete:ne,onEnter:ge,onLeave:Ie,onEnterBack:ye,onLeaveBack:me}=i,K=re===true?"left":typeof re=="string"?re:false,q=typeof p=="function"?p:U[p]??U.linear,Re=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof y=="string"?document.querySelector(y):y??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(w)?w[0]:null,Pe=Array.isArray(w)?w[1]:typeof w=="number"?w:null,we=Array.isArray(I)?I[0]:null,ue=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function ve(o){let l=o*100;switch(K){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let a=K?[]:Array.from(e.querySelectorAll(c)),f=[],_=[],M=0,$=0,R=S,k=0,Le=0,V=false,Se=false,Ee=0,at=-1,Ye=[],Ue=-1,ie=false,fe=0,Ce=0,De,lt=false,ct=null;function wt(){ct?.destroy(),ct=null;}let Oe=new Set,vt=NaN,Ne=true,Xe=-1,St=performance.now(),He=NaN;function Ze(){return F?A==="x"?F.scrollLeft:F.scrollTop:A==="x"?window.scrollX:window.scrollY}function Et(){return F?A==="x"?F.clientWidth:F.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function xt(){let o=Ke(e,F,A);return $e(o,o.scroll,Et(),Re,We)}function rr(){let o=$-M,l=a.length-1,d=F??document.documentElement,T=A==="x"?"Width":"Height";if(R=S,S>0&&l>0&&o>0){let j=d[`scroll${T}`]-d[`client${T}`]-1-M-o/m;j>=0&&(R=Math.min(S,j/(l*o)));}let G=Math.max(0,l)*R*o,oe=o/Math.min(m,1);k=M+Math.min(0,G,oe,G+oe),Le=M+Math.max(0,G,oe,G+oe);}function Tt(){(({tStart:M,tEnd:$}=xt())),rr(),ee&&Fe&&(wt(),ct=hr(M,$,A));}function ut(o,l=xt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let d=o.destroy;return o.destroy=()=>{d.call(o),pe(e);},o}function Mt(o,l){return O&&!x?Math.max(at,q(Ye[o]=Math.max(Ye[o]??0,l))):q(l)}function nr(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let d=l==="reverse"?1-o:o;e.style.clipPath=ve(d);return}a.forEach((d,T)=>mt(d,T,o,l));}function mt(o,l,d,T){o.style.strokeDashoffset=T==="reverse"?`${f[l]*d}`:`${f[l]*(1-d)}`,u&&(o.style.opacity=T==="reverse"?`${1-d}`:`${d}`),he&&be?o.style.stroke=et(he,be,d):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*d}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*d}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",wr(_[l],B,d));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ve(h==="reverse"?1:0);return}a.forEach((o,l)=>{o.style.strokeDasharray=`${f[l]}`,o.style.strokeDashoffset=h==="reverse"?"0":`${f[l]}`,u?o.style.opacity=h==="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"&&_[l]&&o.setAttribute("d",_[l]);});}function ze(o,l){let d=o.getAttribute("d"),T=Je(o);if(B&&_[l]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[l]),T=Math.max(Je(o),G),o.setAttribute("d",d);}f[l]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,l)=>{yr(o);let d=o.tagName.toLowerCase()==="path";d?_.push(o.getAttribute("d")??""):_.push(""),ze(o,l);let T=f[l];B&&(d?br(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=h==="reverse"?`${T}`:"0",u&&(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=h==="reverse"?"0":`${T}`,u?o.style.opacity=h==="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 K&&(e.style.clipPath=ve(1)),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};K&&(e.style.clipPath=ve(h==="reverse"?1:0));let At=typeof p=="string"?tt(p):null;function or(){return !(H===false||Ae||ee&&Fe||!gr()||!a.length||!At||K||A!=="y"||F||m!==1||S!==0||O||x||N!==false||B||z||le||g>0||ke||Z||ne||ge||Ie||ye||me||b!=null||w!=null||I!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function sr(){let o=++dr,l=`svg-scroll-draw-${o}`,d=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=h==="reverse"?"0":"var(--ssd-len)",oe=h==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${oe};`;u&&(j+=`opacity:${h==="reverse"?1:0};`,C+=`opacity:${h==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${l}{from{${j}}to{${C}}}.${d}{view-timeline-name:${T};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(d);function J(E,P){E.style.setProperty("--ssd-len",String(f[P])),E.style.strokeDasharray=`${f[P]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l);}a.forEach(J);let Q=false,se=-1;function ae(){if(se>=0)return se;let E=e.getBoundingClientRect(),{tStart:P,tEnd:Y}=$e({top:E.top,height:E.height},Ze(),Et(),Re,We);return q(X(Ze(),P,Y,m))}return {destroy(){e.classList.remove(d),a.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState="";}),D.remove();},replay(){Q=false,se=-1,a.forEach(J);},pause(){Q=true,a.forEach(E=>{E.style.animationPlayState="paused";});},resume(){Q&&(Q=false,a.forEach(E=>{E.style.animationPlayState="running";}));},seek(E){let P=Math.min(1,Math.max(0,E));se=P,Q=true,a.forEach((Y,xe)=>{Y.classList.remove(l),Y.style.strokeDashoffset=h==="reverse"?`${f[xe]*P}`:`${f[xe]*(1-P)}`,u&&(Y.style.opacity=h==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return ae()},refresh(){a.forEach((E,P)=>{ze(E,P),E.style.setProperty("--ssd-len",String(f[P]));});}}}if(or())return ut(sr());function ir(){let o=Math.max(1,L),l=K?o:o*(1+Math.max(0,a.length-1)*S),d=0,T=0,G=false;function oe(se){let ae=true,E=Math.min(1,Math.max(0,se/l));if(K){let P=Math.min(1,Math.max(0,se/o)),Y=q(P);fe=Y,e.style.setProperty("--scroll-draw-progress",String(Y)),e.style.clipPath=ve(h==="reverse"?1-Y:Y),ke?.(Y),P<1&&(ae=false);}else {a.forEach((Y,xe)=>{let lr=xe*S*o,Ct=Math.min(1,Math.max(0,(se-lr)/o));mt(Y,xe,q(Ct),h),Ct<1&&(ae=false);});let P=q(E);fe=P,ke?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(z){let P=q(E);for(let Y in z){let xe=parseFloat(Y);P>=xe&&!Oe.has(xe)&&(Oe.add(xe),z[Y]?.());}}return ae}function j(se){if(ie)return;let ae=se-d;Se||(Se=true,Z?.());let E=oe(ae);if(E&&!V){V=true,oe(l),ne?.(),Ce<(le==="infinite"?1/0:le??0)&&(Ce++,De=setTimeout(()=>{d=performance.now(),Se=false,V=false,Oe.clear(),ft(),Ee=requestAnimationFrame(j);},de));return}E||(Ee=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Ee),clearTimeout(De),d=performance.now(),T=0,ie=false,Se=false,V=false,Ce=0,G=true,fe=0,Oe.clear(),ft(),Ee=requestAnimationFrame(j);}let D=new IntersectionObserver(se=>{se.forEach(ae=>{ae.isIntersecting&&!(O&&V)?C():!ae.isIntersecting&&!O&&!V&&(cancelAnimationFrame(Ee),clearTimeout(De),G=false);});},{root:F??null,threshold:te,rootMargin:Ge}),J;function Q(){clearTimeout(J),J=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),g>0?setTimeout(()=>D.observe(e),g):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(De),D.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(J);},replay(){Ce=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-d,cancelAnimationFrame(Ee));},resume(){ie&&(ie=false,G=true,d=performance.now()-T,Ee=requestAnimationFrame(j));},seek(se){let ae=Math.min(1,Math.max(0,se));fe=ae,ie=true,T=ae*l,d=performance.now()-T,cancelAnimationFrame(Ee),oe(T);},getProgress(){return fe},refresh(){clearTimeout(J),a.forEach(ze);}}}if(Ae)return ut(ir());Tt();let Pt=()=>X(Ze(),k,Le,1);function Lt(){V=true,ne?.(),Ce<(le==="infinite"?1/0:le)&&(Ce++,De=setTimeout(()=>{lt=true;},de));}function $t(){at=-1,Ye=[],Se=false,V=false,lt=false,Oe.clear(),ft(),Ne=true;}function ar(){let o=performance.now(),l=Ze();if(lt&&Pt()%1&&$t(),!Ne&&N===false&&l===vt)return;Ne=false,vt=l;let d=m;if(N!==false){let C=o-St,D=C>0?Math.abs(l-(Xe<0?l:Xe))/C:0;d=m*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=l,St=o;let T=x?Ue===-1||l>=Ue?"forward":"reverse":h;Ue=l;let G=$-M,oe=true,j=G===0?0:(l-M)/G;if(isNaN(He)||(He<=0&&j>0&&ge?.(),He<1&&j>=1&&Ie?.(),He>=1&&j<1&&ye?.(),He>0&&j<=0&&me?.()),He=j,K){let C=Mt(0,X(l,M,$,d));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),ke?.(C),!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),C>=1&&!V?Lt():C<1&&!O&&(V=false);return}if(a.forEach((C,D)=>{let J=D*R*G,Q=Mt(D,X(l,M+J,$+J,d));mt(C,D,Q,T),D===0&&(fe=Q,ke?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(oe=false);}),z){let C=q(X(l,M,$,d));for(let D in z){let J=parseFloat(D);C>=J&&!Oe.has(J)&&(Oe.add(J),z[D]?.());}}!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),oe&&!V?Lt():!oe&&!O&&(V=false);}let Be=Ve(F??window,[e],Pt,ar,()=>{let o=f.join();a.forEach(ze),Tt(),Ne=true,f.join()!==o&&qe();}),pt=g>0;function qe(){Be.hold(ie||pt);}let kt;return pt&&(kt=setTimeout(()=>{pt=false,qe();},g)),qe(),ut({destroy(){clearTimeout(De),clearTimeout(kt),Be.off(),wt();},replay(){$t(),Ue=-1,Xe=-1,Ce=0,ie=false,fe=0,clearTimeout(De),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,Ne=true,qe());},seek(o){let l=Math.min(1,Math.max(0,o));fe=l,at=l,Ye=[],ie=true,Be.hold(true),nr(l,h),Ne=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function Sr(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?Ut(n,r):(W("Container not found:",e),t)}function Er(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function xr(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,c)=>{let m=s[c];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((u,p)=>`${u}${i.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,p)=>`${u}${m.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,p)=>`${u+(m.nums[p]-u)*t}${i.units[p]}`).join(", ")})`}).join(" ")}function Zt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Er(n))return et(n,s,t);if(n.includes("("))return xr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&c){let m=parseFloat(i[1]),u=parseFloat(c[1]);return `${m+(u-m)*t}${i[2]||c[2]}`}return t<1?n:s}function Tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,Kt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var er={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?er:r.respectReducedMotion===false?Jt(e,r,false):_e(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:c=1,once:m=false,axis:u="y",scrollContainer:p,native:v=true,velocityScale:S=false,triggerElement:h,onProgress:O,onComplete:ee,onEnter:A,onLeave:y,onEnterBack:x,onLeaveBack:g}=r,b=typeof i=="function"?i:U[i]??U["ease-out"],w=Te(s.start||"top bottom"),I=Te(s.end||"bottom top"),z=h??e,N=typeof p=="string"?document.querySelector(p):p??null,te=Object.entries(n).map(([a,f])=>({prop:Tr(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Ge(){let a=window.getComputedStyle(e);for(let f of te)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function le(){for(let a of te)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...te.map(f=>f.prop),Kt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,f]of de)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(t)return le(),ee?.(),{...er,destroy:B,getProgress:()=>1};Ge();let re=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,L=typeof i=="string"?tt(i):null;function H(){if(!v||!Pr()||!L||u!=="y"||N||z!==e||m||c!==1||O||ee||A||y||x||g||S!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of te)if(!Mr.has(a.prop))return false;return true}function ke(){let a=`ssd-a-${++Ar}`,f=te.map(k=>`${k.prop}:${k.from}`).join(";"),_=te.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${f}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${L};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},re(),Ae(),w,I)};Me(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:$});let R={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 te)e.style.setProperty(V.prop,Zt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(X(re(),k,Le,c))}};return R}if(H())return ke();let Z=0,ne=0,ge=false,Ie=-1,ye=0,me=0,K=false,q=NaN,Re=-1,We=0,F=z===e?te:[],he=false;function be(){let a=e.style,f=F.map(R=>a.getPropertyValue(R.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(R=>a.setProperty(R.prop,de.get(R.prop)??""));let M=Ke(z,N,u);F.forEach((R,k)=>a.setProperty(R.prop,f[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),w,I);he&&Math.abs($.tStart-Z)<1&&Math.abs($.tEnd-ne)<1||(he=true,Z=$.tStart,ne=$.tEnd);}function ce(a){e.style.setProperty(Kt,String(a));for(let f of te)e.style.setProperty(f.prop,Zt(f.from,f.to,a));O?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&A?.(),q<1&&a>=1&&y?.(),q>=1&&a<1&&x?.(),q>0&&a<=0&&g?.(),q=a;}function we(){if(ge)return;let a=performance.now(),f=re(),_=c;if(S!==false){let k=a-We,Le=k>0?Math.abs(f-(Re<0?f:Re))/k:0;_=c*Math.max(.2,1+Le*(typeof S=="number"?S:1)*.04);}Re=f,We=a;let M=ne===Z?0:(f-Z)/(ne-Z);Pe(M);let $=X(f,Z,ne,_),R=m?Math.max(Ie,b(ye=Math.max(ye,$))):b($);me=R,ce(R),R>=1&&!K?(K=true,ee?.()):R<1&&!m&&(K=false);}let ue=Ve(N??window,[z],()=>X(re(),Z,ne,Math.min(c,1)),we,be);be(),ne===Z&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=X(re(),Z,ne,c),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:Z,tEnd:ne})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Ie=-1,ye=0,K=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let f=Math.min(1,Math.max(0,a));me=f,Ie=f,ye=0,ve(),ce(f);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lr(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 $r(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:c,onProgress:m}=r,u=-n*100,p=t.style,v=!!t.ownerSVGElement,S=p.getPropertyValue("transform-box");v&&p.setProperty("transform-box","fill-box");let h=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:m});return v?{...h,destroy(){h.destroy(),p.setProperty("transform-box",S);}}:h}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(r,(n,s)=>Cr(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Cr(e,r,t){let{from:n=0,to:s,format:i,easing:c="ease-out",trigger:m={},once:u=true,decimals:p,onComplete:v}=r,S=p!==void 0?L=>L.toFixed(p):i??(L=>String(Math.round(L))),h=typeof c=="function"?c:U[c]??U["ease-out"],O=Te(m.start||"top 80%"),ee=Te(m.end||"top 20%");if(t)return e.textContent=S(s),v?.(),{...yt,getProgress:()=>1};let A=0,y=0,x=false,g=-1,b=0,w=0,I=false,z=()=>window.scrollY,N=()=>window.innerHeight;function te(){let L=e.getBoundingClientRect(),H=$e({top:L.top,height:L.height},z(),N(),O,ee);x&&Math.abs(H.tStart-A)<1&&Math.abs(H.tEnd-y)<1||(x=true,A=H.tStart,y=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(L){e.textContent=S(n+(s-n)*L),e.style.setProperty("--scroll-draw-progress",String(L));}let de=()=>X(z(),A,y,1);function B(){let L=de(),H=u?Math.max(g,h(b=Math.max(b,L))):h(L);w=H,le(H),H>=1&&!I?(I=true,v?.()):H<1&&!u&&(I=false);}te();{b=X(z(),A,y,1);let L=h(b);w=L,le(L);}let re=Ve(window,[e],de,B,te);Me(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:A,tEnd:y})});let Ae=()=>re.hold(false);return {destroy(){re.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){g=-1,b=0,I=false,w=0,le(0),Ae();},pause:()=>re.hold(true),resume:Ae,seek(L){let H=Math.min(1,Math.max(0,L));w=H,g=H,b=0,re.hold(true),le(H);},getProgress(){return w}}}var tr="http://www.w3.org/2000/svg",Dr="cinematic-photo",ht=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?ht(r/100):0}function Or(e){return U[e]??U.linear}var Ir={destroy:()=>{},getProgress:()=>0},bt=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 Ir;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 y of r.scenes){if(y.background){let g=document.createElement("img");g.id=Dr,g.src=y.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let x=y.animations.filter(g=>g.type==="draw");if(x.length){let g=document.createElementNS(tr,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let b of x){let w=document.createElementNS(tr,"path");w.id=b.target.replace(/^#/,""),w.setAttribute("d",b.d),w.setAttribute("fill","none"),w.setAttribute("stroke",b.stroke),w.setAttribute("stroke-width",String(b.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let I=b.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(I),w.style.strokeDashoffset=String(I),g.appendChild(w),s.push({kind:"draw",el:w,start:it(b.start),end:it(b.end),ease:Or(b.easing),length:I});}}for(let g of y.animations){if(g.type!=="fade")continue;let b=n.querySelector(g.target)??document.querySelector(g.target);b&&(b.style.opacity=String(g.from),s.push({kind:"fade",el:b,start:it(g.start),end:it(g.end),ease:U["ease-in-out"]??U.linear,from:g.from,to:g.to}));}}let i=0,c=()=>{let y=t.offsetHeight-window.innerHeight;return y<=0?t.getBoundingClientRect().top<=0?1:0:ht(-t.getBoundingClientRect().top/y)},m=y=>{for(let x of s){let g=x.end-x.start,b=g<=0?y>=x.end?1:0:ht((y-x.start)/g),w=x.ease(b);x.kind==="draw"?x.el.style.strokeDashoffset=String(x.length*(1-w)):x.el.style.opacity=String(x.from+(x.to-x.from)*w);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,p=false,v=false,S=()=>{i=c(),m(i),p&&(u=requestAnimationFrame(S));},h=()=>{p||(p=true,u=requestAnimationFrame(S));},O=()=>{p=false,cancelAnimationFrame(u);},ee=new IntersectionObserver(y=>{for(let x of y)v=x.isIntersecting,v?h():O();},{threshold:0});ee.observe(n),i=c(),m(i),Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>{let y=t.getBoundingClientRect().top+window.scrollY;return {tStart:y,tEnd:y+Math.max(0,t.offsetHeight-window.innerHeight)}}});let A=rt(y=>{y&&(A(),O(),ee.disconnect(),pe(t),i=1,m(1));});return {destroy(){A(),O(),ee.disconnect(),pe(t);},getProgress:()=>i}}};
|
|
4
|
+
exports.Cinematic=bt;exports.PRESETS=dt;exports.createBounce=Ot;exports.createElastic=It;exports.createSpring=Dt;exports.scrollAnimate=Lr;exports.scrollCounter=kr;exports.scrollDraw=Sr;exports.scrollParallax=$r;
|
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-9bcJdVcg.mjs';
|
|
2
|
+
export { P as PresetName, S as ScrollDrawInstance } from './types-9bcJdVcg.mjs';
|
|
3
|
+
export { s as scrollDraw } from './scroll-draw-Fzir8hlU.mjs';
|
|
4
|
+
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-DAiRJgtF.mjs';
|
|
5
|
+
export { S as ScrollCounterOptions, s as scrollCounter } from './index-DVjblK_4.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-BLWKCfxC.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-9bcJdVcg.js';
|
|
2
|
+
export { P as PresetName, S as ScrollDrawInstance } from './types-9bcJdVcg.js';
|
|
3
|
+
export { s as scrollDraw } from './scroll-draw-BsU_Ohmu.js';
|
|
4
|
+
export { S as ScrollParallaxOptions, s as scrollAnimate, a as scrollParallax } from './index-hSQqLVbg.js';
|
|
5
|
+
export { S as ScrollCounterOptions, s as scrollCounter } from './index-BN8yKeQ3.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-6VsjEwzb.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-CZLUBJAI.mjs';export{a as Cinematic}from'./chunk-BSW7W2Y5.mjs';export{a as scrollDraw}from'./chunk-22B37AWY.mjs';export{a as scrollCounter}from'./chunk-PAGN26EH.mjs';import'./chunk-VJ5ZU55P.mjs';export{a as PRESETS}from'./chunk-K6VATIJH.mjs';import'./chunk-V3Z6G5JE.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-THPTANES.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
|