use-scroll-animate 2.0.0 → 2.0.1
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/CHANGELOG.md +11 -0
- package/dist/chunks/{core-FUEi4ncH.js → core-BP-a1iNc.js} +6 -1
- package/dist/chunks/core-BP-a1iNc.js.map +1 -0
- package/dist/chunks/{core-CH41ekIo.cjs → core-B_J4rXbC.cjs} +6 -1
- package/dist/chunks/core-B_J4rXbC.cjs.map +1 -0
- package/dist/chunks/{stagger-XD-0-FQz.cjs → stagger-DHw0ExuR.cjs} +2 -2
- package/dist/chunks/{stagger-XD-0-FQz.cjs.map → stagger-DHw0ExuR.cjs.map} +1 -1
- package/dist/chunks/{stagger-DabrnrcE.js → stagger-DTv_WiUQ.js} +2 -2
- package/dist/chunks/{stagger-DabrnrcE.js.map → stagger-DTv_WiUQ.js.map} +1 -1
- package/dist/element.cjs +1 -1
- package/dist/element.js +1 -1
- package/dist/element.umd.js +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +3 -3
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +2 -2
- package/dist/solid.cjs +2 -2
- package/dist/solid.js +2 -2
- package/dist/svelte.cjs +2 -2
- package/dist/svelte.js +2 -2
- package/dist/vue.cjs +2 -2
- package/dist/vue.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/core-CH41ekIo.cjs.map +0 -1
- package/dist/chunks/core-FUEi4ncH.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ScrollAnimate={})}(this,function(e){"use strict";const t={"fade-in":{from:{opacity:0},to:{opacity:1}},"fade-in-up":{from:{opacity:0,transform:"translateY(40px)"},to:{opacity:1,transform:"translateY(0px)"}},"fade-in-down":{from:{opacity:0,transform:"translateY(-40px)"},to:{opacity:1,transform:"translateY(0px)"}},"fade-in-left":{from:{opacity:0,transform:"translateX(-40px)"},to:{opacity:1,transform:"translateX(0px)"}},"fade-in-right":{from:{opacity:0,transform:"translateX(40px)"},to:{opacity:1,transform:"translateX(0px)"}},"zoom-in":{from:{opacity:0,transform:"scale(0.8)"},to:{opacity:1,transform:"scale(1)"}},"zoom-out":{from:{opacity:0,transform:"scale(1.2)"},to:{opacity:1,transform:"scale(1)"}},"flip-x":{from:{opacity:0,transform:"rotateX(-90deg)"},to:{opacity:1,transform:"rotateX(0deg)"}},"flip-y":{from:{opacity:0,transform:"rotateY(-90deg)"},to:{opacity:1,transform:"rotateY(0deg)"}},"slide-up":{from:{transform:"translateY(100%)"},to:{transform:"translateY(0px)"}},"slide-down":{from:{transform:"translateY(-100%)"},to:{transform:"translateY(0px)"}},"slide-left":{from:{transform:"translateX(-100%)"},to:{transform:"translateX(0px)"}},"slide-right":{from:{transform:"translateX(100%)"},to:{transform:"translateX(0px)"}},bounce:{from:{opacity:0,transform:"translateY(-60px)"},to:{opacity:1,transform:"translateY(0px)"}},"rotate-in":{from:{opacity:0,transform:"rotate(-180deg) scale(0.5)"},to:{opacity:1,transform:"rotate(0deg) scale(1)"}},"blur-in":{from:{opacity:0,filter:"blur(12px)"},to:{opacity:1,filter:"blur(0px)"}},"skew-in":{from:{opacity:0,transform:"skewX(20deg) translateX(30px)"},to:{opacity:1,transform:"skewX(0deg) translateX(0px)"}},"scale-x":{from:{transform:"scaleX(0)"},to:{transform:"scaleX(1)"}},"scale-y":{from:{transform:"scaleY(0)"},to:{transform:"scaleY(1)"}},shimmer:{from:{opacity:.5,filter:"brightness(1)"},to:{opacity:1,filter:"brightness(1.5)"}},pulse:{from:{transform:"scale(1)"},to:{transform:"scale(1.05)"}},swing:{from:{transform:"rotate(-10deg)"},to:{transform:"rotate(10deg)"}},"scale-up":{from:{opacity:0,transform:"scale(0.5)"},to:{opacity:1,transform:"scale(1)"}},"blur-in-up":{from:{opacity:0,filter:"blur(12px)",transform:"translateY(40px)"},to:{opacity:1,filter:"blur(0px)",transform:"translateY(0px)"}},"flip-up":{from:{opacity:0,transform:"perspective(800px) rotateX(60deg)"},to:{opacity:1,transform:"perspective(800px) rotateX(0deg)"}},"flip-down":{from:{opacity:0,transform:"perspective(800px) rotateX(-60deg)"},to:{opacity:1,transform:"perspective(800px) rotateX(0deg)"}},"rotate-left":{from:{opacity:0,transform:"rotate(-15deg) translateX(-40px)"},to:{opacity:1,transform:"rotate(0deg) translateX(0px)"}},"rotate-right":{from:{opacity:0,transform:"rotate(15deg) translateX(40px)"},to:{opacity:1,transform:"rotate(0deg) translateX(0px)"}},"clip-up":{from:{clipPath:"inset(100% 0% 0% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-down":{from:{clipPath:"inset(0% 0% 100% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-left":{from:{clipPath:"inset(0% 0% 0% 100%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-right":{from:{clipPath:"inset(0% 100% 0% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-circle":{from:{clipPath:"circle(0% at 50% 50%)"},to:{clipPath:"circle(75% at 50% 50%)"}}};function r(e){if("string"==typeof e)return t[e.trim()]??t["fade-in-up"];if(Array.isArray(e)){const r={from:{},to:{}};return e.forEach(e=>{const o=t[e.trim()];o&&(Object.entries(o.from).forEach(([e,t])=>{"transform"===e&&r.from[e]?r.from[e]=`${r.from[e]} ${t}`:r.from[e]=t}),Object.entries(o.to).forEach(([e,t])=>{"transform"===e&&r.to[e]?r.to[e]=`${r.to[e]} ${t}`:r.to[e]=t}))}),r}return e}const o={linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)","soft-spring":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","heavy-bounce":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"};function n(e){return"string"==typeof e?o[e]??e:Array.isArray(e)?`cubic-bezier(${e.join(", ")})`:"function"==typeof e?"linear":"ease"}const a={defaultAnimation:"fade-in-up",defaultDuration:600,defaultDelay:0,defaultEasing:"ease",defaultThreshold:.1,defaultRootMargin:"0px",defaultRepeat:!1,defaultOnce:!0,defaultOffset:0,hiddenClass:"sa-hidden",visibleClass:"sa-visible",useClassNames:!1,disabled:!1,root:null,autoUnregister:!0,defaultEngine:"auto"},s=()=>{},i=()=>"undefined"!=typeof window&&"undefined"!=typeof document,c=()=>i()&&"undefined"!=typeof IntersectionObserver;let l,f;function d(){return!!i()&&(void 0===l&&(l="function"==typeof window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)"):null),!!l&&l.matches)}function u(){return void 0===f&&(f=i()&&"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timeline: view()")&&"function"==typeof globalThis.ViewTimeline),f}function p(e){if(void 0===e||""===e.trim())return;const t=parseFloat(e);return Number.isFinite(t)?t:void 0}function m(e){if(void 0===e||""===e.trim())return;const t=e.trim();return/^-?(\d+\.?\d*|\.\d+)$/.test(t)?parseFloat(t):t}const g=["entry 0%","entry 100%"];function h(e){const t=e.trim();return t?t.startsWith("--")?t:`--${t}`:"--sa-progress"}function y(e,t){return v(function(e){const t={},r=e("animation");r&&(t.animation=r.includes(",")?r.split(",").map(e=>e.trim()):r.trim()),t.duration=p(e("duration")),t.delay=p(e("delay"));const o=e("easing");if(o){const e=o.trim();if(e.startsWith("["))try{t.easing=JSON.parse(e)}catch{}else t.easing=e}const n=e("threshold");n&&(t.threshold=n.includes(",")?n.split(",").map(parseFloat).filter(Number.isFinite):p(n));const a=e("root-margin");a&&(t.rootMargin=a);const s=e("repeat");void 0!==s&&(t.repeat="false"!==s);const i=e("once");void 0!==i&&(t.once="false"!==i),t.offset=p(e("offset")),t.stagger=p(e("stagger"));const c=e("progress-var");void 0!==c&&(t.progressVar=h(c));const l=e("engine")?.trim();"auto"!==l&&"js"!==l&&"css"!==l||(t.engine=l);const f=e("view-range");if(f){const[e,r]=f.split(",").map(e=>e.trim());e&&r&&(t.viewRange=[e,r])}const d=e("exit");if(void 0!==d){const e=d.trim();t.exit=""===e||"true"===e||"false"!==e&&(e.includes(",")?e.split(",").map(e=>e.trim()):e)}const u=e("progress");u&&(t.progressMode="scroll"===u.trim()?"scroll":"ratio");const g=e("parallax-x"),y=e("parallax-y"),v=e("parallax-rotate"),b=e("parallax-scale");return(g||y||v||b)&&(t.parallax={x:m(g),y:m(y),rotate:p(v),scale:p(b),speed:p(e("parallax-speed"))??1}),Object.keys(t).forEach(e=>void 0===t[e]&&delete t[e]),t}(t=>{const r=e.getAttribute(`data-sa-${t}`);return null===r?void 0:r}),t)}function v(e,t){let r=e.engine??t.defaultEngine;"auto"===r&&(void 0!==e.duration||void 0!==e.delay||void 0!==e.offset||(e.stagger??0)>0)&&(r="js");const o=e.exit??!1,n=e.repeat??(!!o||t.defaultRepeat),a=e.threshold??t.defaultThreshold;return{animation:e.animation??t.defaultAnimation,duration:e.duration??t.defaultDuration,delay:e.delay??t.defaultDelay,easing:e.easing??t.defaultEasing,threshold:Array.isArray(a)&&0===a.length?t.defaultThreshold:a,rootMargin:e.rootMargin??t.defaultRootMargin,repeat:n,once:e.once??(!n&&t.defaultOnce),offset:e.offset??t.defaultOffset,stagger:e.stagger??0,parallax:e.parallax??{},onStart:e.onStart??s,onComplete:e.onComplete??s,onEnter:e.onEnter??s,onLeave:e.onLeave??s,onProgress:e.onProgress??s,progressMode:e.progressMode??"ratio",progressVar:e.progressVar?h(e.progressVar):"",engine:r,viewRange:e.viewRange??g,exit:o}}function b(e){return e&&i()?"string"==typeof e?Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:Array.isArray(e)||e instanceof NodeList?Array.from(e).filter(e=>e instanceof Element):[]:[]}function x(e){return!!e&&Object.keys(e).some(t=>void 0!==e[t])}function E(e,t){if(!i())return 0;const r=e.getBoundingClientRect();let o=0,n=window.innerHeight||document.documentElement.clientHeight||0;if(t){const e=t.getBoundingClientRect();o=e.top,n=e.height}const a=n+r.height;if(a<=0)return 0;const s=(o+n-r.top)/a;return s<0?0:s>1?1:s}const w=new WeakMap,S=new WeakMap,M=new WeakMap;function C(e){const t=S.get(e);t&&(S.delete(e),t.cancel());const r=w.get(e);r&&(w.delete(e),r.onfinish=null,r.cancel());const o=M.get(e);void 0!==o&&(clearTimeout(o),M.delete(e))}function $(e,t){const r=e.style;r&&Object.keys(t).forEach(e=>{r[e]=String(t[e])})}const O=/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)/gi;let A,P;function X(e,t){if("function"!=typeof t)return{keyframes:[e.from,e.to],easing:n(t)};const r=function(e){const t=[];for(let r=0;r<=30;r++){const o=e(r/30);t.push(Number.isFinite(o)?+o.toFixed(4):r/30)}return t}(t);if(void 0===A&&(A="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timing-function","linear(0, 1)")),A)return{keyframes:[e.from,e.to],easing:`linear(${r.join(", ")})`};const o=Object.keys(e.from).filter(t=>t in e.to);return{keyframes:r.map((t,r)=>{const n={offset:r/30};return o.forEach(r=>{n[r]=function(e,t,r){if("number"==typeof e&&"number"==typeof t)return e+(t-e)*r;const o=String(e),n=String(t),a=[],s=[],i=o.replace(O,(e,t,r)=>(a.push([parseFloat(t),r]),"#"));if(i!==n.replace(O,(e,t,r)=>(s.push([parseFloat(t),r]),"#"))||a.length!==s.length)return r<.5?e:t;let c=0,l=!0;const f=i.replace(/#/g,()=>{const[e,t]=a[c],[o,n]=s[c++];t!==n&&0!==e&&0!==o&&t&&n&&(l=!1);const i=t||n;return`${+(e+(o-e)*r).toFixed(4)}${i}`});return l?f:r<.5?e:t}(e.from[r],e.to[r],t)}),n}),easing:"linear"}}function k(e,t){if(C(e),t.useClassNames)e.classList.remove(t.hiddenClass),e.classList.add(t.visibleClass);else{const t=e.style;t&&(t.opacity="")}}function F(e,t={}){k(e,{...a,...t})}function N(e){return!!e.disabled||d()}function j(e,t,o,n=0,a){const{duration:s,delay:i,stagger:c,onStart:l,onComplete:f}=t,d=Math.max(0,i+n*c);if(C(e),N(o))return k(e,o),l(e),void f(e);if(o.useClassNames)return d>0&&(e.style.animationDelay=`${d}ms`),e.classList.remove(o.hiddenClass),e.classList.add(o.visibleClass),l(e),a?.add(e),void M.set(e,setTimeout(()=>{M.delete(e),a?.delete(e),f(e)},s+d));const u=r(t.animation);if(!("opacity"in u.to)){const t=e.style;t&&"0"===t.opacity&&(t.opacity="")}if("function"!=typeof e.animate)return $(e,u.to),l(e),void f(e);const p=X(u,t.easing),m={duration:s,delay:d,easing:p.easing,fill:"both"};let g;try{g=e.animate(p.keyframes,m)}catch{g=e.animate(p.keyframes,{...m,easing:"ease"})}w.set(e,g),l(e),g.onfinish=()=>{if(w.get(e)===g){w.delete(e);try{g.commitStyles()}catch{$(e,u.to)}g.cancel()}f(e)}}function L(e,t){if(C(e),t.useClassNames)e.classList.add(t.hiddenClass),e.classList.remove(t.visibleClass);else{const t=e.style;t&&(t.opacity="0")}}function Y(e,t={}){const r={...a,...t};N(r)||L(e,r)}function T(){if(!P){P=[];for(let e=0;e<=100;e++)P.push(e/100)}return P}const I={passive:!0};function R(e={}){let t={...a,...e};const o=new Map;let n=new WeakSet;const l=new Set;let f=0,d=null;const p=new Set,m=new Set,g=new Set,h=new Map;function O(e,t,r){let o=h.get(e);o||h.set(e,o=new Map);let n=o.get(t);return n||o.set(t,n=r()),n}function A(e,r){const n=o.get(e);n&&(n.observer.unobserve(e),n.progressObserver?.unobserve(e),o.delete(e),z(e),"css"!==n.engine?r&&!n.animated&&k(e,t):r&&(g.delete(e),k(e,t)))}function P(){o.forEach((e,t)=>{!1===t.isConnected&&A(t,!1)})}function F(e,r,o){const n=r.options;if(n.onProgress(e,o),n.progressVar){const t=e.style;t&&t.setProperty(n.progressVar,String(+o.toFixed(4)))}x(n.parallax)&&!N(t)&&function(e,t,r){const{x:o=0,y:n=0,rotate:a=0,scale:s=1,speed:i=1}=r,c=2*(t-.5)*i,l=e=>"number"==typeof e?e*c+"px":`calc(${e} * ${c})`;let f="";o&&(f+=` translateX(${l(o)})`),n&&(f+=` translateY(${l(n)})`),a&&(f+=` rotate(${a*c}deg)`),1!==s&&(f+=` scale(${1+(s-1)*c})`),e.style.transform=f.trim()}(e,o,n.parallax)}function Y(){f=0,l.forEach(e=>{const r=o.get(e);r&&F(e,r,E(e,t.root))})}const R=()=>f||(f=requestAnimationFrame(Y));function V(e){if(e===!!d)return;const r=e?"addEventListener":"removeEventListener",o=d||t.root||window;o[r]("scroll",R,I),window[r]("resize",R,I),d=e?o:null,!e&&f&&(cancelAnimationFrame(f),f=0)}function z(e){l.delete(e)&&!l.size&&V(!1)}function W(e){e.forEach(e=>{const r=e.target,n=o.get(r);n&&(e.isIntersecting?(l.add(r),V(!0)):z(r),F(r,n,E(r,t.root)))})}function q(e){const a=new Map;e.forEach(e=>{const s=e.target,i=o.get(s);if(!i)return;const c=i.options;if(!1!==s.isConnected)if("css"!==i.engine)if(e.isIntersecting){if(c.onEnter(s),i.animated&&!c.repeat)return;let e=0;if(c.stagger>0){const t=s.parentElement;e=a.get(t)??0,a.set(t,e+1)}j(s,c,t,e,m),i.animated=!0,c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(n.add(s),A(s,!1)))}else c.onLeave(s),c.repeat&&i.animated&&(N(t)||(c.exit?function(e,t,o){if(o.useClassNames||"function"!=typeof e.animate)return void L(e,o);C(e);const n=r(!0===t.exit?t.animation:t.exit),a=X({from:n.to,to:n.from},t.easing),s={duration:t.duration,easing:a.easing,fill:"forwards"};let i;try{i=e.animate(a.keyframes,s)}catch{i=e.animate(a.keyframes,{...s,easing:"ease"})}w.set(e,i)}(s,c,t):L(s,t)),i.animated=!1);else e.isIntersecting?(c.onEnter(s),i.animated||(i.animated=!0,c.onStart(s)),c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(n.add(s),A(s,!1)))):(c.onLeave(s),c.repeat&&(i.animated=!1));else A(s,!1)})}function D(e){e.forEach(e=>{const t=o.get(e.target);t&&F(e.target,t,e.intersectionRatio)})}function U(e){const r=function(e,t){if(!t)return e;const r=(e||"0px").trim().split(/\s+/),o=r[0],n=r[1]??o,a=r[2]??o,s=r[3]??n,i=/^(-?\d*\.?\d+)(px)?$/.exec(a);return`${o} ${n} ${(i?parseFloat(i[1]):0)-t}px ${s}`}(e.rootMargin,e.offset),o=e.threshold,n=t.root;return O(n,`m|${r}|${String(o)}`,()=>new IntersectionObserver(q,{threshold:o,rootMargin:r,root:n}))}function _(e,r,o){var n;r.observer=U(r.options),o&&r.observer.observe(e),r.progressObserver=x((n=r.options).parallax)||n.onProgress!==s||n.progressVar?function(e){const r=t.root;return"scroll"===e.progressMode?O(r,`s|${e.rootMargin}`,()=>new IntersectionObserver(W,{threshold:0,rootMargin:e.rootMargin,root:r})):O(r,`p|${e.rootMargin}`,()=>new IntersectionObserver(D,{threshold:T(),rootMargin:e.rootMargin,root:r}))}(r.options):void 0,r.progressObserver?.observe(e)}function B(e,a){if(o.has(e)||n.has(e))return;if(!c())return void k(e,t);const s={element:e,options:a,animated:!1,engine:"js"};(function(e){return"js"!==e.engine&&!t.useClassNames&&!N(t)&&u()})(a)&&(C(e),function(e,t,o){if("function"!=typeof e.animate)return null;const n=r(t.animation),a=X(n,t.easing);let s;try{const r=new globalThis.ViewTimeline({subject:e,axis:"block"}),o={fill:"both",easing:a.easing,timeline:r,rangeStart:t.viewRange[0],rangeEnd:t.viewRange[1]};try{s=e.animate(a.keyframes,o)}catch{s=e.animate(a.keyframes,{...o,easing:"linear"})}}catch{return null}if(w.set(e,s),t.exit){const o=r(!0===t.exit?t.animation:t.exit),n=X({from:o.to,to:o.from},t.easing);try{const t=new globalThis.ViewTimeline({subject:e,axis:"block"}),r={fill:"forwards",easing:n.easing,timeline:t,rangeStart:"exit 0%",rangeEnd:"exit 100%"};S.set(e,e.animate(n.keyframes,r))}catch{}}const i=t.repeat||!t.once;return s.onfinish=()=>{if(!i&&w.get(e)===s){w.delete(e);try{s.commitStyles()}catch{$(e,n.to)}s.cancel(),o?.()}t.onComplete(e)},s}(e,a,()=>g.delete(e))&&(s.engine="css",g.add(e))),"js"!==s.engine||N(t)||L(e,t),o.set(e,s),_(e,s,!0)}function H(e){o.has(e)||B(e,y(e,t))}const G={observe(e,r={}){P();const o=v(r,t);b(e).forEach(e=>B(e,o))},unobserve(e){b(e).forEach(e=>{n.delete(e),A(e,!0)})},init(e){const t=e??(i()?document:null);t&&(P(),t.querySelectorAll("[data-sa]").forEach(H))},watch(e){const t=e??(i()?document:null);if(!t||"undefined"==typeof MutationObserver)return s;G.init(t);const r=e=>{e.hasAttribute("data-sa")&&H(e),e.querySelectorAll("[data-sa]").forEach(H)},o=new MutationObserver(e=>{let t=!1;e.forEach(e=>{if("attributes"===e.type){const t=e.target;return void(!1!==t.isConnected&&r(t))}e.addedNodes.forEach(e=>{e instanceof Element&&!1!==e.isConnected&&r(e)}),e.removedNodes.length&&(t=!0)}),t&&P()});return o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sa"]}),p.add(o),()=>{o.disconnect(),p.delete(o)}},destroy(){p.forEach(e=>e.disconnect()),p.clear(),m.forEach(e=>{const t=M.get(e);void 0!==t&&(clearTimeout(t),M.delete(e))}),m.clear(),o.forEach((e,r)=>{e.animated||"css"===e.engine||k(r,t)}),g.forEach(e=>{w.has(e)&&k(e,t)}),g.clear(),h.forEach(e=>e.forEach(e=>e.disconnect())),h.clear(),o.clear(),l.clear(),V(!1),n=new WeakSet},refresh(){h.forEach(e=>e.forEach(e=>e.disconnect())),h.clear(),l.clear(),V(!1),P(),c()&&o.forEach((e,t)=>{_(t,e,!(e.animated&&e.options.once&&!e.options.repeat))})},animate(e,r={}){const o=v(r,t);b(e).forEach(e=>j(e,o,t,0,m))},getObservedElements:()=>Array.from(o.values()),configure(e){t={...t,...e}}};return G}let V=null;let z=null;function W(e,t){const r=[];let o=0;return e.forEach(e=>{const{target:n,gap:a=0,at:s,...i}=e,c={...t,...i},l=c.duration??600,f=Math.max(0,s??o+a)+(c.delay??0);let d=Math.max(o,f);b(n).forEach((e,t)=>{const o=f+t*(c.stagger??0);r.push({el:e,opts:{...c,duration:l,delay:o,stagger:0},end:o+l}),d=Math.max(d,o+l)}),o=d}),r}const q={passive:!0};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ScrollAnimate={})}(this,function(e){"use strict";const t={"fade-in":{from:{opacity:0},to:{opacity:1}},"fade-in-up":{from:{opacity:0,transform:"translateY(40px)"},to:{opacity:1,transform:"translateY(0px)"}},"fade-in-down":{from:{opacity:0,transform:"translateY(-40px)"},to:{opacity:1,transform:"translateY(0px)"}},"fade-in-left":{from:{opacity:0,transform:"translateX(-40px)"},to:{opacity:1,transform:"translateX(0px)"}},"fade-in-right":{from:{opacity:0,transform:"translateX(40px)"},to:{opacity:1,transform:"translateX(0px)"}},"zoom-in":{from:{opacity:0,transform:"scale(0.8)"},to:{opacity:1,transform:"scale(1)"}},"zoom-out":{from:{opacity:0,transform:"scale(1.2)"},to:{opacity:1,transform:"scale(1)"}},"flip-x":{from:{opacity:0,transform:"rotateX(-90deg)"},to:{opacity:1,transform:"rotateX(0deg)"}},"flip-y":{from:{opacity:0,transform:"rotateY(-90deg)"},to:{opacity:1,transform:"rotateY(0deg)"}},"slide-up":{from:{transform:"translateY(100%)"},to:{transform:"translateY(0px)"}},"slide-down":{from:{transform:"translateY(-100%)"},to:{transform:"translateY(0px)"}},"slide-left":{from:{transform:"translateX(-100%)"},to:{transform:"translateX(0px)"}},"slide-right":{from:{transform:"translateX(100%)"},to:{transform:"translateX(0px)"}},bounce:{from:{opacity:0,transform:"translateY(-60px)"},to:{opacity:1,transform:"translateY(0px)"}},"rotate-in":{from:{opacity:0,transform:"rotate(-180deg) scale(0.5)"},to:{opacity:1,transform:"rotate(0deg) scale(1)"}},"blur-in":{from:{opacity:0,filter:"blur(12px)"},to:{opacity:1,filter:"blur(0px)"}},"skew-in":{from:{opacity:0,transform:"skewX(20deg) translateX(30px)"},to:{opacity:1,transform:"skewX(0deg) translateX(0px)"}},"scale-x":{from:{transform:"scaleX(0)"},to:{transform:"scaleX(1)"}},"scale-y":{from:{transform:"scaleY(0)"},to:{transform:"scaleY(1)"}},shimmer:{from:{opacity:.5,filter:"brightness(1)"},to:{opacity:1,filter:"brightness(1.5)"}},pulse:{from:{transform:"scale(1)"},to:{transform:"scale(1.05)"}},swing:{from:{transform:"rotate(-10deg)"},to:{transform:"rotate(10deg)"}},"scale-up":{from:{opacity:0,transform:"scale(0.5)"},to:{opacity:1,transform:"scale(1)"}},"blur-in-up":{from:{opacity:0,filter:"blur(12px)",transform:"translateY(40px)"},to:{opacity:1,filter:"blur(0px)",transform:"translateY(0px)"}},"flip-up":{from:{opacity:0,transform:"perspective(800px) rotateX(60deg)"},to:{opacity:1,transform:"perspective(800px) rotateX(0deg)"}},"flip-down":{from:{opacity:0,transform:"perspective(800px) rotateX(-60deg)"},to:{opacity:1,transform:"perspective(800px) rotateX(0deg)"}},"rotate-left":{from:{opacity:0,transform:"rotate(-15deg) translateX(-40px)"},to:{opacity:1,transform:"rotate(0deg) translateX(0px)"}},"rotate-right":{from:{opacity:0,transform:"rotate(15deg) translateX(40px)"},to:{opacity:1,transform:"rotate(0deg) translateX(0px)"}},"clip-up":{from:{clipPath:"inset(100% 0% 0% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-down":{from:{clipPath:"inset(0% 0% 100% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-left":{from:{clipPath:"inset(0% 0% 0% 100%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-right":{from:{clipPath:"inset(0% 100% 0% 0%)"},to:{clipPath:"inset(0% 0% 0% 0%)"}},"clip-circle":{from:{clipPath:"circle(0% at 50% 50%)"},to:{clipPath:"circle(75% at 50% 50%)"}}};function r(e){if("string"==typeof e)return t[e.trim()]??t["fade-in-up"];if(Array.isArray(e)){const r={from:{},to:{}};return e.forEach(e=>{const o=t[e.trim()];o&&(Object.entries(o.from).forEach(([e,t])=>{"transform"===e&&r.from[e]?r.from[e]=`${r.from[e]} ${t}`:r.from[e]=t}),Object.entries(o.to).forEach(([e,t])=>{"transform"===e&&r.to[e]?r.to[e]=`${r.to[e]} ${t}`:r.to[e]=t}))}),r}return e}const o={linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)","soft-spring":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","heavy-bounce":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"};function n(e){return"string"==typeof e?o[e]??e:Array.isArray(e)?`cubic-bezier(${e.join(", ")})`:"function"==typeof e?"linear":"ease"}const a={defaultAnimation:"fade-in-up",defaultDuration:600,defaultDelay:0,defaultEasing:"ease",defaultThreshold:.1,defaultRootMargin:"0px",defaultRepeat:!1,defaultOnce:!0,defaultOffset:0,hiddenClass:"sa-hidden",visibleClass:"sa-visible",useClassNames:!1,disabled:!1,root:null,autoUnregister:!0,defaultEngine:"auto"},s=()=>{},i=()=>"undefined"!=typeof window&&"undefined"!=typeof document,c=()=>i()&&"undefined"!=typeof IntersectionObserver;let l,f;function d(){return!!i()&&(void 0===l&&(l="function"==typeof window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)"):null),!!l&&l.matches)}function u(){return void 0===f&&(f=i()&&"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timeline: view()")&&"function"==typeof globalThis.ViewTimeline),f}function p(e){if(void 0===e||""===e.trim())return;const t=parseFloat(e);return Number.isFinite(t)?t:void 0}function m(e){if(void 0===e||""===e.trim())return;const t=e.trim();return/^-?(\d+\.?\d*|\.\d+)$/.test(t)?parseFloat(t):t}const g=["entry 0%","entry 100%"];function h(e){const t=e.trim();return t?t.startsWith("--")?t:`--${t}`:"--sa-progress"}function y(e,t){return v(function(e){const t={},r=e("animation");r&&(t.animation=r.includes(",")?r.split(",").map(e=>e.trim()):r.trim()),t.duration=p(e("duration")),t.delay=p(e("delay"));const o=e("easing");if(o){const e=o.trim();if(e.startsWith("["))try{t.easing=JSON.parse(e)}catch{}else t.easing=e}const n=e("threshold");n&&(t.threshold=n.includes(",")?n.split(",").map(parseFloat).filter(Number.isFinite):p(n));const a=e("root-margin");a&&(t.rootMargin=a);const s=e("repeat");void 0!==s&&(t.repeat="false"!==s);const i=e("once");void 0!==i&&(t.once="false"!==i),t.offset=p(e("offset")),t.stagger=p(e("stagger"));const c=e("progress-var");void 0!==c&&(t.progressVar=h(c));const l=e("engine")?.trim();"auto"!==l&&"js"!==l&&"css"!==l||(t.engine=l);const f=e("view-range");if(f){const[e,r]=f.split(",").map(e=>e.trim());e&&r&&(t.viewRange=[e,r])}const d=e("exit");if(void 0!==d){const e=d.trim();t.exit=""===e||"true"===e||"false"!==e&&(e.includes(",")?e.split(",").map(e=>e.trim()):e)}const u=e("progress");u&&(t.progressMode="scroll"===u.trim()?"scroll":"ratio");const g=e("parallax-x"),y=e("parallax-y"),v=e("parallax-rotate"),b=e("parallax-scale");return(g||y||v||b)&&(t.parallax={x:m(g),y:m(y),rotate:p(v),scale:p(b),speed:p(e("parallax-speed"))??1}),Object.keys(t).forEach(e=>void 0===t[e]&&delete t[e]),t}(t=>{const r=e.getAttribute(`data-sa-${t}`);return null===r?void 0:r}),t)}function v(e,t){let r=e.engine??t.defaultEngine;"auto"===r&&(void 0!==e.duration||void 0!==e.delay||void 0!==e.offset||(e.stagger??0)>0)&&(r="js");const o=e.exit??!1,n=e.repeat??(!!o||t.defaultRepeat),a=e.threshold??t.defaultThreshold;return{animation:e.animation??t.defaultAnimation,duration:e.duration??t.defaultDuration,delay:e.delay??t.defaultDelay,easing:e.easing??t.defaultEasing,threshold:Array.isArray(a)&&0===a.length?t.defaultThreshold:a,rootMargin:e.rootMargin??t.defaultRootMargin,repeat:n,once:e.once??(!n&&t.defaultOnce),offset:e.offset??t.defaultOffset,stagger:e.stagger??0,parallax:e.parallax??{},onStart:e.onStart??s,onComplete:e.onComplete??s,onEnter:e.onEnter??s,onLeave:e.onLeave??s,onProgress:e.onProgress??s,progressMode:e.progressMode??"ratio",progressVar:e.progressVar?h(e.progressVar):"",engine:r,viewRange:e.viewRange??g,exit:o}}function b(e){return e&&i()?"string"==typeof e?Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:Array.isArray(e)||e instanceof NodeList?Array.from(e).filter(e=>e instanceof Element):[]:[]}function x(e){return!!e&&Object.keys(e).some(t=>void 0!==e[t])}function E(e,t){if(!i())return 0;const r=e.getBoundingClientRect();let o=0,n=window.innerHeight||document.documentElement.clientHeight||0;if(t){const e=t.getBoundingClientRect();o=e.top,n=e.height}const a=n+r.height;if(a<=0)return 0;const s=(o+n-r.top)/a;return s<0?0:s>1?1:s}const w=new WeakMap,S=new WeakMap,M=new WeakMap;function C(e){const t=S.get(e);t&&(S.delete(e),t.cancel());const r=w.get(e);r&&(w.delete(e),r.onfinish=null,r.cancel());const o=M.get(e);void 0!==o&&(clearTimeout(o),M.delete(e))}function $(e,t){const r=e.style;r&&Object.keys(t).forEach(e=>{r[e]=String(t[e])})}const O=/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)/gi;let A,P;function X(e,t){if("function"!=typeof t)return{keyframes:[e.from,e.to],easing:n(t)};const r=function(e){const t=[];for(let r=0;r<=30;r++){const o=e(r/30);t.push(Number.isFinite(o)?+o.toFixed(4):r/30)}return t}(t);if(void 0===A&&(A="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timing-function","linear(0, 1)")),A)return{keyframes:[e.from,e.to],easing:`linear(${r.join(", ")})`};const o=Object.keys(e.from).filter(t=>t in e.to);return{keyframes:r.map((t,r)=>{const n={offset:r/30};return o.forEach(r=>{n[r]=function(e,t,r){if("number"==typeof e&&"number"==typeof t)return e+(t-e)*r;const o=String(e),n=String(t),a=[],s=[],i=o.replace(O,(e,t,r)=>(a.push([parseFloat(t),r]),"#"));if(i!==n.replace(O,(e,t,r)=>(s.push([parseFloat(t),r]),"#"))||a.length!==s.length)return r<.5?e:t;let c=0,l=!0;const f=i.replace(/#/g,()=>{const[e,t]=a[c],[o,n]=s[c++];t!==n&&0!==e&&0!==o&&t&&n&&(l=!1);const i=t||n;return`${+(e+(o-e)*r).toFixed(4)}${i}`});return l?f:r<.5?e:t}(e.from[r],e.to[r],t)}),n}),easing:"linear"}}function k(e,t){if(C(e),t.useClassNames)e.classList.remove(t.hiddenClass),e.classList.add(t.visibleClass);else{const t=e.style;t&&(t.opacity="")}}function F(e,t={}){k(e,{...a,...t})}function N(e){return!!e.disabled||d()}function j(e,t,o,n=0,a){const{duration:s,delay:i,stagger:c,onStart:l,onComplete:f}=t,d=Math.max(0,i+n*c);if(C(e),N(o))return k(e,o),l(e),void f(e);if(o.useClassNames)return d>0&&(e.style.animationDelay=`${d}ms`),e.classList.remove(o.hiddenClass),e.classList.add(o.visibleClass),l(e),a?.add(e),void M.set(e,setTimeout(()=>{M.delete(e),a?.delete(e),f(e)},s+d));const u=r(t.animation);if(!("opacity"in u.to)){const t=e.style;t&&"0"===t.opacity&&(t.opacity="")}if("function"!=typeof e.animate)return $(e,u.to),l(e),void f(e);const p=X(u,t.easing),m={duration:s,delay:d,easing:p.easing,fill:"both"};let g;try{g=e.animate(p.keyframes,m)}catch{g=e.animate(p.keyframes,{...m,easing:"ease"})}w.set(e,g),l(e),g.onfinish=()=>{if(w.get(e)===g){w.delete(e);try{g.commitStyles()}catch{$(e,u.to)}g.cancel()}f(e)}}function L(e,t){if(C(e),t.useClassNames)e.classList.add(t.hiddenClass),e.classList.remove(t.visibleClass);else{const t=e.style;t&&(t.opacity="0")}}function Y(e,t={}){const r={...a,...t};N(r)||L(e,r)}function T(){if(!P){P=[];for(let e=0;e<=100;e++)P.push(e/100)}return P}const I={passive:!0};function R(e={}){let t={...a,...e};const o=new Map;let n=new WeakSet;const l=new Set;let f=0,d=null;const p=new Set,m=new Set,g=new Set,h=new Map;function O(e,t,r){let o=h.get(e);o||h.set(e,o=new Map);let n=o.get(t);return n||o.set(t,n=r()),n}function A(e,r){const n=o.get(e);n&&(n.observer.unobserve(e),n.progressObserver?.unobserve(e),o.delete(e),z(e),"css"!==n.engine?r&&!n.animated&&k(e,t):r?(g.delete(e),k(e,t)):!1===e.isConnected&&g.delete(e))}function P(){o.forEach((e,t)=>{!1===t.isConnected&&A(t,!1)})}function F(e,r,o){const n=r.options;if(n.onProgress(e,o),n.progressVar){const t=e.style;t&&t.setProperty(n.progressVar,String(+o.toFixed(4)))}x(n.parallax)&&!N(t)&&function(e,t,r){const{x:o=0,y:n=0,rotate:a=0,scale:s=1,speed:i=1}=r,c=2*(t-.5)*i,l=e=>"number"==typeof e?e*c+"px":`calc(${e} * ${c})`;let f="";o&&(f+=` translateX(${l(o)})`),n&&(f+=` translateY(${l(n)})`),a&&(f+=` rotate(${a*c}deg)`),1!==s&&(f+=` scale(${1+(s-1)*c})`),e.style.transform=f.trim()}(e,o,n.parallax)}function Y(){f=0,l.forEach(e=>{const r=o.get(e);r&&F(e,r,E(e,t.root))})}const R=()=>f||(f=requestAnimationFrame(Y));function V(e){if(e===!!d)return;const r=e?"addEventListener":"removeEventListener",o=d||t.root||window;o[r]("scroll",R,I),window[r]("resize",R,I),d=e?o:null,!e&&f&&(cancelAnimationFrame(f),f=0)}function z(e){l.delete(e)&&!l.size&&V(!1)}function W(e){e.forEach(e=>{const r=e.target,n=o.get(r);n&&(e.isIntersecting?(l.add(r),V(!0)):z(r),F(r,n,E(r,t.root)))})}function q(e){const a=new Map;e.forEach(e=>{const s=e.target,i=o.get(s);if(!i)return;const c=i.options;if(!1!==s.isConnected)if("css"!==i.engine)if(e.isIntersecting){if(c.onEnter(s),i.animated&&!c.repeat)return;let e=0;if(c.stagger>0){const t=s.parentElement;e=a.get(t)??0,a.set(t,e+1)}j(s,c,t,e,m),i.animated=!0,c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(n.add(s),A(s,!1)))}else c.onLeave(s),c.repeat&&i.animated&&(N(t)||(c.exit?function(e,t,o){if(o.useClassNames||"function"!=typeof e.animate)return void L(e,o);C(e);const n=r(!0===t.exit?t.animation:t.exit),a=X({from:n.to,to:n.from},t.easing),s={duration:t.duration,easing:a.easing,fill:"forwards"};let i;try{i=e.animate(a.keyframes,s)}catch{i=e.animate(a.keyframes,{...s,easing:"ease"})}w.set(e,i)}(s,c,t):L(s,t)),i.animated=!1);else e.isIntersecting?(c.onEnter(s),i.animated||(i.animated=!0,c.onStart(s)),c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(n.add(s),A(s,!1)))):(c.onLeave(s),c.repeat&&(i.animated=!1));else A(s,!1)})}function D(e){e.forEach(e=>{const t=o.get(e.target);t&&F(e.target,t,e.intersectionRatio)})}function U(e){const r=function(e,t){if(!t)return e;const r=(e||"0px").trim().split(/\s+/),o=r[0],n=r[1]??o,a=r[2]??o,s=r[3]??n,i=/^(-?\d*\.?\d+)(px)?$/.exec(a);return`${o} ${n} ${(i?parseFloat(i[1]):0)-t}px ${s}`}(e.rootMargin,e.offset),o=e.threshold,n=t.root;return O(n,`m|${r}|${String(o)}`,()=>new IntersectionObserver(q,{threshold:o,rootMargin:r,root:n}))}function _(e,r,o){var n;r.observer=U(r.options),o&&r.observer.observe(e),r.progressObserver=x((n=r.options).parallax)||n.onProgress!==s||n.progressVar?function(e){const r=t.root;return"scroll"===e.progressMode?O(r,`s|${e.rootMargin}`,()=>new IntersectionObserver(W,{threshold:0,rootMargin:e.rootMargin,root:r})):O(r,`p|${e.rootMargin}`,()=>new IntersectionObserver(D,{threshold:T(),rootMargin:e.rootMargin,root:r}))}(r.options):void 0,r.progressObserver?.observe(e)}function B(e,a){if(o.has(e)||n.has(e))return;if(!c())return void k(e,t);const s={element:e,options:a,animated:!1,engine:"js"};(function(e){return"js"!==e.engine&&!t.useClassNames&&!N(t)&&u()})(a)&&(C(e),function(e,t,o){if("function"!=typeof e.animate)return null;const n=r(t.animation),a=X(n,t.easing);let s;try{const r=new globalThis.ViewTimeline({subject:e,axis:"block"}),o={fill:"both",easing:a.easing,timeline:r,rangeStart:t.viewRange[0],rangeEnd:t.viewRange[1]};try{s=e.animate(a.keyframes,o)}catch{s=e.animate(a.keyframes,{...o,easing:"linear"})}}catch{return null}if(w.set(e,s),t.exit){const o=r(!0===t.exit?t.animation:t.exit),n=X({from:o.to,to:o.from},t.easing);try{const t=new globalThis.ViewTimeline({subject:e,axis:"block"}),r={fill:"forwards",easing:n.easing,timeline:t,rangeStart:"exit 0%",rangeEnd:"exit 100%"};S.set(e,e.animate(n.keyframes,r))}catch{}}const i=t.repeat||!t.once;return s.onfinish=()=>{if(!i&&w.get(e)===s){w.delete(e);try{s.commitStyles()}catch{$(e,n.to)}s.cancel(),o?.()}t.onComplete(e)},s}(e,a,()=>g.delete(e))&&(s.engine="css",g.add(e))),"js"!==s.engine||N(t)||L(e,t),o.set(e,s),_(e,s,!0)}function H(e){o.has(e)||B(e,y(e,t))}const G={observe(e,r={}){P();const o=v(r,t);b(e).forEach(e=>B(e,o))},unobserve(e){b(e).forEach(e=>{n.delete(e),A(e,!0)})},init(e){const t=e??(i()?document:null);t&&(P(),t.querySelectorAll("[data-sa]").forEach(H))},watch(e){const t=e??(i()?document:null);if(!t||"undefined"==typeof MutationObserver)return s;G.init(t);const r=e=>{e.hasAttribute("data-sa")&&H(e),e.querySelectorAll("[data-sa]").forEach(H)},o=new MutationObserver(e=>{let t=!1;e.forEach(e=>{if("attributes"===e.type){const t=e.target;return void(!1!==t.isConnected&&r(t))}e.addedNodes.forEach(e=>{e instanceof Element&&!1!==e.isConnected&&r(e)}),e.removedNodes.length&&(t=!0)}),t&&P()});return o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sa"]}),p.add(o),()=>{o.disconnect(),p.delete(o)}},destroy(){p.forEach(e=>e.disconnect()),p.clear(),m.forEach(e=>{const t=M.get(e);void 0!==t&&(clearTimeout(t),M.delete(e))}),m.clear(),o.forEach((e,r)=>{e.animated||"css"===e.engine||k(r,t)}),g.forEach(e=>{w.has(e)&&k(e,t)}),g.clear(),h.forEach(e=>e.forEach(e=>e.disconnect())),h.clear(),o.clear(),l.clear(),V(!1),n=new WeakSet},refresh(){h.forEach(e=>e.forEach(e=>e.disconnect())),h.clear(),l.clear(),V(!1),P(),c()&&o.forEach((e,t)=>{_(t,e,!(e.animated&&e.options.once&&!e.options.repeat))})},animate(e,r={}){const o=v(r,t);b(e).forEach(e=>j(e,o,t,0,m))},getObservedElements:()=>Array.from(o.values()),configure(e){t={...t,...e}}};return G}let V=null;let z=null;function W(e,t){const r=[];let o=0;return e.forEach(e=>{const{target:n,gap:a=0,at:s,...i}=e,c={...t,...i},l=c.duration??600,f=Math.max(0,s??o+a)+(c.delay??0);let d=Math.max(o,f);b(n).forEach((e,t)=>{const o=f+t*(c.stagger??0);r.push({el:e,opts:{...c,duration:l,delay:o,stagger:0},end:o+l}),d=Math.max(d,o+l)}),o=d}),r}const q={passive:!0};
|
|
2
2
|
/**
|
|
3
3
|
* use-scroll-animate
|
|
4
4
|
*
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/stagger.ts","../src/sequence.ts","../src/parallax.ts","../src/index.ts"],"sourcesContent":["/**\n * use-scroll-animate - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CustomAnimation, EasingType } from './types';\n\ntype KeyframeMap = {\n from: Record<string, string | number>;\n to: Record<string, string | number>;\n};\n\nexport const PRESETS: Record<AnimationPreset, KeyframeMap> = {\n 'fade-in': {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n 'fade-in-up': {\n from: { opacity: 0, transform: 'translateY(40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-down': {\n from: { opacity: 0, transform: 'translateY(-40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-left': {\n from: { opacity: 0, transform: 'translateX(-40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'fade-in-right': {\n from: { opacity: 0, transform: 'translateX(40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'zoom-in': {\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'zoom-out': {\n from: { opacity: 0, transform: 'scale(1.2)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'flip-x': {\n from: { opacity: 0, transform: 'rotateX(-90deg)' },\n to: { opacity: 1, transform: 'rotateX(0deg)' },\n },\n 'flip-y': {\n from: { opacity: 0, transform: 'rotateY(-90deg)' },\n to: { opacity: 1, transform: 'rotateY(0deg)' },\n },\n 'slide-up': {\n from: { transform: 'translateY(100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-down': {\n from: { transform: 'translateY(-100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-left': {\n from: { transform: 'translateX(-100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'slide-right': {\n from: { transform: 'translateX(100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'bounce': {\n from: { opacity: 0, transform: 'translateY(-60px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'rotate-in': {\n from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },\n to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },\n },\n 'blur-in': {\n from: { opacity: 0, filter: 'blur(12px)' },\n to: { opacity: 1, filter: 'blur(0px)' },\n },\n 'skew-in': {\n from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },\n to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },\n },\n 'scale-x': {\n from: { transform: 'scaleX(0)' },\n to: { transform: 'scaleX(1)' },\n },\n 'scale-y': {\n from: { transform: 'scaleY(0)' },\n to: { transform: 'scaleY(1)' },\n },\n 'shimmer': {\n from: { opacity: 0.5, filter: 'brightness(1)' },\n to: { opacity: 1, filter: 'brightness(1.5)' },\n },\n 'pulse': {\n from: { transform: 'scale(1)' },\n to: { transform: 'scale(1.05)' },\n },\n 'swing': {\n from: { transform: 'rotate(-10deg)' },\n to: { transform: 'rotate(10deg)' },\n },\n 'scale-up': {\n from: { opacity: 0, transform: 'scale(0.5)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'blur-in-up': {\n from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },\n to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },\n },\n 'flip-up': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'flip-down': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'rotate-left': {\n from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n 'rotate-right': {\n from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n // clip-path reveals: content is uncovered without moving or fading\n 'clip-up': {\n from: { clipPath: 'inset(100% 0% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-down': {\n from: { clipPath: 'inset(0% 0% 100% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-left': {\n from: { clipPath: 'inset(0% 0% 0% 100%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-right': {\n from: { clipPath: 'inset(0% 100% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-circle': {\n from: { clipPath: 'circle(0% at 50% 50%)' },\n to: { clipPath: 'circle(75% at 50% 50%)' },\n },\n};\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return PRESETS[animation.trim() as AnimationPreset] ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = PRESETS[name.trim() as AnimationPreset];\n if (preset) {\n Object.entries(preset.from).forEach(([key, val]) => {\n if (key === 'transform' && combined.from[key]) {\n combined.from[key] = `${combined.from[key]} ${val}`;\n } else {\n combined.from[key] = val;\n }\n });\n Object.entries(preset.to).forEach(([key, val]) => {\n if (key === 'transform' && combined.to[key]) {\n combined.to[key] = `${combined.to[key]} ${val}`;\n } else {\n combined.to[key] = val;\n }\n });\n }\n });\n return combined;\n }\n \n return animation;\n}\n\n/** Easing to CSS cubic-bezier mapping */\nexport const EASING_MAP: Record<string, string> = {\n linear: 'linear',\n ease: 'ease',\n 'ease-in': 'ease-in',\n 'ease-out': 'ease-out',\n 'ease-in-out': 'ease-in-out',\n spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',\n 'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n 'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n};\n\nexport function resolveEasing(easing: EasingType): string {\n if (typeof easing === 'string') {\n return EASING_MAP[easing] ?? easing;\n }\n if (Array.isArray(easing)) {\n return `cubic-bezier(${easing.join(', ')})`;\n }\n if (typeof easing === 'function') {\n // Functions cannot be expressed as a CSS easing string; the core samples\n // them into a `linear()` easing (or keyframes on older browsers).\n return 'linear';\n }\n return 'ease';\n}\n","/**\n * use-scroll-animate - Core Implementation\n * Uses IntersectionObserver + Web Animations API for zero-dependency,\n * high-performance scroll-triggered animations.\n */\n\nimport type {\n AnimateOptions,\n AnimatedElement,\n ScrollAnimateConfig,\n ScrollAnimateInstance,\n ParallaxOptions,\n} from './types';\nimport { resolvePreset, resolveEasing } from './presets';\n\ntype KeyframeMap = ReturnType<typeof resolvePreset>;\ntype Target = string | Element | NodeList | Element[];\ntype Root = Element | Document | null;\n\nconst DEFAULT_CONFIG: Required<ScrollAnimateConfig> = {\n defaultAnimation: 'fade-in-up',\n defaultDuration: 600,\n defaultDelay: 0,\n defaultEasing: 'ease',\n defaultThreshold: 0.1,\n defaultRootMargin: '0px',\n defaultRepeat: false,\n defaultOnce: true,\n defaultOffset: 0,\n hiddenClass: 'sa-hidden',\n visibleClass: 'sa-visible',\n useClassNames: false,\n disabled: false,\n root: null,\n autoUnregister: true,\n defaultEngine: 'auto',\n};\n\nconst noop = () => undefined;\n\n/* ------------------------------------------------------------------ */\n/* Environment helpers (all SSR-safe: never touch globals at import) */\n/* ------------------------------------------------------------------ */\n\nconst hasDOM = (): boolean => typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @internal */\nexport const supportsObserver = (): boolean => hasDOM() && typeof IntersectionObserver !== 'undefined';\n\nlet reducedMotionQuery: MediaQueryList | null | undefined;\n\n/** @internal Whether the user asked the OS/browser to reduce motion. */\nexport function prefersReducedMotion(): boolean {\n if (!hasDOM()) return false;\n if (reducedMotionQuery === undefined) {\n reducedMotionQuery =\n typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;\n }\n return !!reducedMotionQuery && reducedMotionQuery.matches;\n}\n\nlet scrollTimelineSupported: boolean | undefined;\n\n/**\n * Whether the browser can run presets on a native scroll-driven timeline:\n * `CSS.supports('animation-timeline: view()')` plus the `ViewTimeline`\n * constructor used to attach it from JavaScript. Cached. SSR-safe.\n */\nexport function supportsScrollTimeline(): boolean {\n if (scrollTimelineSupported === undefined) {\n scrollTimelineSupported =\n hasDOM() &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timeline: view()') &&\n typeof (globalThis as any).ViewTimeline === 'function';\n }\n return scrollTimelineSupported;\n}\n\n/** @internal Reset the cached feature checks (tests). */\nexport function resetFeatureCache(): void {\n scrollTimelineSupported = undefined;\n linearSupported = undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* Option parsing */\n/* ------------------------------------------------------------------ */\n\nfunction num(value: string | undefined): number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const n = parseFloat(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Numeric strings (\"100\") become numbers (px); strings with units stay as-is. */\nfunction lengthValue(value: string | undefined): string | number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const v = value.trim();\n return /^-?(\\d+\\.?\\d*|\\.\\d+)$/.test(v) ? parseFloat(v) : v;\n}\n\nconst DEFAULT_PROGRESS_VAR = '--sa-progress';\nconst DEFAULT_VIEW_RANGE: [string, string] = ['entry 0%', 'entry 100%'];\n\n/** `''` (bare attribute) -> default name; `sa-progress` -> `--sa-progress`. */\nfunction normalizeVar(name: string): string {\n const v = name.trim();\n if (!v) return DEFAULT_PROGRESS_VAR;\n return v.startsWith('--') ? v : `--${v}`;\n}\n\n/**\n * @internal Read options from string attributes. `get(name)` returns the raw\n * value of the attribute `name` (kebab-case, e.g. `root-margin`), `''` for a\n * bare attribute and `undefined` when absent. Shared by `data-sa-*` and the\n * `<scroll-animate>` element.\n */\nexport function readOptions(get: (name: string) => string | undefined): AnimateOptions {\n const opts: AnimateOptions = {};\n\n const anim = get('animation');\n if (anim) {\n opts.animation = (anim.includes(',') ? anim.split(',').map((s) => s.trim()) : anim.trim()) as any;\n }\n opts.duration = num(get('duration'));\n opts.delay = num(get('delay'));\n const easing = get('easing');\n if (easing) {\n const e = easing.trim();\n if (e.startsWith('[')) {\n try {\n opts.easing = JSON.parse(e);\n } catch {\n // Malformed JSON: fall back to the default easing instead of throwing\n }\n } else {\n opts.easing = e;\n }\n }\n const t = get('threshold');\n if (t) {\n opts.threshold = t.includes(',') ? t.split(',').map(parseFloat).filter(Number.isFinite) : num(t);\n }\n const rootMargin = get('root-margin');\n if (rootMargin) opts.rootMargin = rootMargin;\n const repeat = get('repeat');\n if (repeat !== undefined) opts.repeat = repeat !== 'false';\n const once = get('once');\n if (once !== undefined) opts.once = once !== 'false';\n opts.offset = num(get('offset'));\n opts.stagger = num(get('stagger'));\n const progressVar = get('progress-var');\n if (progressVar !== undefined) opts.progressVar = normalizeVar(progressVar);\n const engine = get('engine')?.trim();\n if (engine === 'auto' || engine === 'js' || engine === 'css') opts.engine = engine;\n const range = get('view-range');\n if (range) {\n const [start, end] = range.split(',').map((s) => s.trim());\n if (start && end) opts.viewRange = [start, end];\n }\n const exit = get('exit');\n if (exit !== undefined) {\n const e = exit.trim();\n opts.exit = e === '' || e === 'true' ? true : e === 'false' ? false : ((e.includes(',') ? e.split(',').map((s) => s.trim()) : e) as any);\n }\n const progress = get('progress');\n if (progress) opts.progressMode = progress.trim() === 'scroll' ? 'scroll' : 'ratio';\n\n const px = get('parallax-x');\n const py = get('parallax-y');\n const pr = get('parallax-rotate');\n const ps = get('parallax-scale');\n if (px || py || pr || ps) {\n opts.parallax = {\n x: lengthValue(px),\n y: lengthValue(py),\n rotate: num(pr),\n scale: num(ps),\n speed: num(get('parallax-speed')) ?? 1,\n };\n }\n\n // Drop keys that were not set, so they don't override defaults when spread.\n (Object.keys(opts) as Array<keyof AnimateOptions>).forEach((k) => opts[k] === undefined && delete opts[k]);\n return opts;\n}\n\nfunction parseDataAttributes(el: Element, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n return mergeOptions(\n readOptions((name) => {\n const v = el.getAttribute(`data-sa-${name}`);\n return v === null ? undefined : v;\n }),\n config\n );\n}\n\nfunction mergeOptions(opts: AnimateOptions, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n let engine = opts.engine ?? config.defaultEngine;\n // 'auto' keeps time-based semantics when the element asks for them explicitly.\n if (engine === 'auto' && (opts.duration !== undefined || opts.delay !== undefined || opts.offset !== undefined || (opts.stagger ?? 0) > 0)) {\n engine = 'js';\n }\n const exit = opts.exit ?? false;\n const repeat = opts.repeat ?? (exit ? true : config.defaultRepeat);\n const threshold = opts.threshold ?? config.defaultThreshold;\n return {\n animation: opts.animation ?? config.defaultAnimation,\n duration: opts.duration ?? config.defaultDuration,\n delay: opts.delay ?? config.defaultDelay,\n easing: opts.easing ?? config.defaultEasing,\n threshold: Array.isArray(threshold) && threshold.length === 0 ? config.defaultThreshold : threshold,\n rootMargin: opts.rootMargin ?? config.defaultRootMargin,\n repeat,\n once: opts.once ?? (repeat ? false : config.defaultOnce),\n offset: opts.offset ?? config.defaultOffset,\n stagger: opts.stagger ?? 0,\n parallax: opts.parallax ?? {},\n onStart: opts.onStart ?? noop,\n onComplete: opts.onComplete ?? noop,\n onEnter: opts.onEnter ?? noop,\n onLeave: opts.onLeave ?? noop,\n onProgress: opts.onProgress ?? noop,\n progressMode: opts.progressMode ?? 'ratio',\n progressVar: opts.progressVar ? normalizeVar(opts.progressVar) : '',\n engine,\n viewRange: opts.viewRange ?? DEFAULT_VIEW_RANGE,\n exit,\n };\n}\n\nfunction resolveTargets(target: Target | null | undefined): Element[] {\n if (!target || !hasDOM()) return [];\n if (typeof target === 'string') return Array.from(document.querySelectorAll(target));\n if (target instanceof Element) return [target];\n if (Array.isArray(target) || target instanceof NodeList) {\n return (Array.from(target as ArrayLike<Node>) as Element[]).filter((el) => el instanceof Element);\n }\n return [];\n}\n\n/**\n * Apply `offset` to the bottom edge of a rootMargin, preserving the other\n * three sides. `offset: 100` means \"trigger 100px later\" (bottom -100px).\n * @internal\n */\nexport function applyOffset(rootMargin: string, offset: number): string {\n if (!offset) return rootMargin;\n const parts = (rootMargin || '0px').trim().split(/\\s+/);\n const top = parts[0];\n const right = parts[1] ?? top;\n const bottom = parts[2] ?? top;\n const left = parts[3] ?? right;\n const m = /^(-?\\d*\\.?\\d+)(px)?$/.exec(bottom);\n const base = m ? parseFloat(m[1]) : 0; // non-px bottoms (e.g. %) cannot be combined; offset wins\n return `${top} ${right} ${base - offset}px ${left}`;\n}\n\nfunction hasParallax(p: ParallaxOptions | undefined): boolean {\n return !!p && Object.keys(p).some((k) => (p as Record<string, unknown>)[k] !== undefined);\n}\n\nfunction needsProgress(opts: Required<AnimateOptions>): boolean {\n return hasParallax(opts.parallax) || opts.onProgress !== noop || !!opts.progressVar;\n}\n\n/**\n * True scroll progress of `el` through the viewport (or `root`): 0 when its top\n * edge reaches the bottom of the viewport, 1 when its bottom edge passes the top.\n * Works for elements taller than the viewport. Returns 0 without a DOM.\n */\nexport function getScrollProgress(el: Element, root?: Element | null): number {\n if (!hasDOM()) return 0;\n const rect = el.getBoundingClientRect();\n let top = 0;\n let height = window.innerHeight || document.documentElement.clientHeight || 0;\n if (root) {\n const r = root.getBoundingClientRect();\n top = r.top;\n height = r.height;\n }\n const total = height + rect.height;\n if (total <= 0) return 0;\n const p = (top + height - rect.top) / total;\n return p < 0 ? 0 : p > 1 ? 1 : p;\n}\n\n/* ------------------------------------------------------------------ */\n/* Animation */\n/* ------------------------------------------------------------------ */\n\n/** The animation currently running on an element, so it can be cancelled/replaced. */\nconst running = new WeakMap<Element, Animation>();\n/** Native engine: the scroll-linked exit animation, next to the entrance in `running`. */\nconst exits = new WeakMap<Element, Animation>();\nconst timers = new WeakMap<Element, ReturnType<typeof setTimeout>>();\n\nfunction cancelRunning(el: Element): void {\n const exitAnim = exits.get(el);\n if (exitAnim) {\n exits.delete(el);\n exitAnim.cancel();\n }\n const anim = running.get(el);\n if (anim) {\n running.delete(el);\n anim.onfinish = null;\n anim.cancel();\n }\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n}\n\nfunction setStyles(el: Element, styles: Record<string, string | number>): void {\n const style = (el as HTMLElement).style;\n if (!style) return;\n Object.keys(styles).forEach((prop) => {\n (style as any)[prop] = String(styles[prop]);\n });\n}\n\nconst NUM_UNIT = /(-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)/gi;\n\n/**\n * Interpolate two CSS values at `t`. Numbers interpolate directly; strings\n * interpolate when they share the same structure (e.g. `translateY(40px)` ->\n * `translateY(0px)`, or `scale(0.8)` -> `scale(1)`). Otherwise snaps at 0.5.\n * @internal\n */\nexport function interpolateValue(from: string | number, to: string | number, t: number): string | number {\n if (typeof from === 'number' && typeof to === 'number') return from + (to - from) * t;\n const a = String(from);\n const b = String(to);\n const ta: Array<[number, string]> = [];\n const tb: Array<[number, string]> = [];\n const skA = a.replace(NUM_UNIT, (_, n, u) => (ta.push([parseFloat(n), u]), '#'));\n const skB = b.replace(NUM_UNIT, (_, n, u) => (tb.push([parseFloat(n), u]), '#'));\n if (skA !== skB || ta.length !== tb.length) return t < 0.5 ? from : to;\n let i = 0;\n let ok = true;\n const out = skA.replace(/#/g, () => {\n const [na, ua] = ta[i];\n const [nb, ub] = tb[i++];\n if (ua !== ub && na !== 0 && nb !== 0 && ua && ub) ok = false;\n const unit = ua || ub;\n return `${+(na + (nb - na) * t).toFixed(4)}${unit}`;\n });\n return ok ? out : t < 0.5 ? from : to;\n}\n\nconst EASING_SAMPLES = 30;\nlet linearSupported: boolean | undefined;\n\nfunction supportsLinearEasing(): boolean {\n if (linearSupported === undefined) {\n linearSupported =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timing-function', 'linear(0, 1)');\n }\n return linearSupported;\n}\n\nfunction sampleEasing(fn: (t: number) => number): number[] {\n const values: number[] = [];\n for (let i = 0; i <= EASING_SAMPLES; i++) {\n const v = fn(i / EASING_SAMPLES);\n values.push(Number.isFinite(v) ? +v.toFixed(4) : i / EASING_SAMPLES);\n }\n return values;\n}\n\nfunction buildAnimation(\n preset: KeyframeMap,\n easing: Required<AnimateOptions>['easing']\n): { keyframes: Keyframe[]; easing: string } {\n if (typeof easing !== 'function') {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: resolveEasing(easing) };\n }\n const samples = sampleEasing(easing);\n // Modern browsers: an exact, property-agnostic `linear()` easing curve.\n if (supportsLinearEasing()) {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: `linear(${samples.join(', ')})` };\n }\n // Fallback: approximate the curve with interpolated keyframes.\n const props = Object.keys(preset.from).filter((p) => p in preset.to);\n const keyframes = samples.map((eased, i) => {\n const frame: Keyframe = { offset: i / EASING_SAMPLES };\n props.forEach((prop) => {\n frame[prop] = interpolateValue(preset.from[prop], preset.to[prop], eased);\n });\n return frame;\n });\n return { keyframes, easing: 'linear' };\n}\n\n/** Make an element visible without animating (reduced motion / disabled / no WAAPI). */\nfunction reveal(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '';\n }\n}\n\n/** @internal Cancel a running/pending animation and make the element visible. */\nexport function stopAnimation(el: Element, config: ScrollAnimateConfig = {}): void {\n reveal(el, { ...DEFAULT_CONFIG, ...config });\n}\n\n/** @internal Resolve a selector / Element / NodeList / Element[] to elements (SSR-safe). */\nexport { resolveTargets, hasDOM };\n\n/** @internal Whether animations should be skipped entirely. */\nexport function motionDisabled(config: Pick<ScrollAnimateConfig, 'disabled'>): boolean {\n return !!config.disabled || prefersReducedMotion();\n}\n\nfunction runAnimation(\n el: Element,\n opts: Required<AnimateOptions>,\n config: Required<ScrollAnimateConfig>,\n staggerIndex = 0,\n pending?: Set<Element>\n): void {\n const { duration, delay, stagger, onStart, onComplete } = opts;\n const totalDelay = Math.max(0, delay + staggerIndex * stagger);\n cancelRunning(el);\n\n if (motionDisabled(config)) {\n reveal(el, config);\n onStart(el);\n onComplete(el);\n return;\n }\n\n if (config.useClassNames) {\n if (totalDelay > 0) (el as HTMLElement).style.animationDelay = `${totalDelay}ms`;\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n onStart(el);\n pending?.add(el);\n timers.set(\n el,\n setTimeout(() => {\n timers.delete(el);\n pending?.delete(el);\n onComplete(el);\n }, duration + totalDelay)\n );\n return;\n }\n\n const preset = resolvePreset(opts.animation);\n // Presets that don't animate opacity (slide-*, clip-*, scale-x, ...) would\n // otherwise stay at the `opacity: 0` applied while waiting to enter.\n if (!('opacity' in preset.to)) {\n const style = (el as HTMLElement).style;\n if (style && style.opacity === '0') style.opacity = '';\n }\n\n if (typeof el.animate !== 'function') {\n setStyles(el, preset.to);\n onStart(el);\n onComplete(el);\n return;\n }\n\n const built = buildAnimation(preset, opts.easing);\n const timing: KeyframeAnimationOptions = { duration, delay: totalDelay, easing: built.easing, fill: 'both' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n // Invalid user easing string (WAAPI throws a TypeError): fall back to 'ease'\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n running.set(el, anim);\n onStart(el);\n anim.onfinish = () => {\n if (running.get(el) === anim) {\n running.delete(el);\n // Persist the end state inline and drop the filling animation. This frees\n // the Animation object and lets later inline styles (parallax, user code)\n // take effect instead of being masked by `fill: forwards`.\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n }\n onComplete(el);\n };\n}\n\n/**\n * Native engine: attach the preset to a `ViewTimeline` of the element, so the\n * browser drives it from scroll position. Returns `null` when that fails\n * (caller falls back to the JS engine).\n */\nfunction startNative(el: Element, opts: Required<AnimateOptions>, onFrozen?: () => void): Animation | null {\n if (typeof el.animate !== 'function') return null;\n const preset = resolvePreset(opts.animation);\n const built = buildAnimation(preset, opts.easing);\n let anim: Animation;\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = {\n fill: 'both',\n easing: built.easing,\n timeline,\n rangeStart: opts.viewRange[0],\n rangeEnd: opts.viewRange[1],\n } as KeyframeAnimationOptions;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'linear' });\n }\n } catch {\n return null;\n }\n running.set(el, anim);\n if (opts.exit) {\n // Reverse keyframes over the `exit` range; `fill: 'forwards'` so it has\n // no effect before the element starts leaving.\n const leave = resolvePreset(opts.exit === true ? opts.animation : opts.exit);\n const out = buildAnimation({ from: leave.to, to: leave.from }, opts.easing);\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = { fill: 'forwards', easing: out.easing, timeline, rangeStart: 'exit 0%', rangeEnd: 'exit 100%' };\n exits.set(el, el.animate(out.keyframes, timing as KeyframeAnimationOptions));\n } catch {\n // Exit is cosmetic: ignore if unsupported.\n }\n }\n const keep = opts.repeat || !opts.once;\n anim.onfinish = () => {\n // `once`: freeze the end state, so scrolling back up does not reverse it.\n if (!keep && running.get(el) === anim) {\n running.delete(el);\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n onFrozen?.();\n }\n opts.onComplete(el);\n };\n return anim;\n}\n\nfunction applyParallax(el: Element, progress: number, parallax: ParallaxOptions): void {\n const { x = 0, y = 0, rotate = 0, scale = 1, speed = 1 } = parallax;\n const p = (progress - 0.5) * 2 * speed;\n const axis = (v: string | number) => (typeof v === 'number' ? `${v * p}px` : `calc(${v} * ${p})`);\n\n let transform = '';\n if (x) transform += ` translateX(${axis(x)})`;\n if (y) transform += ` translateY(${axis(y)})`;\n if (rotate) transform += ` rotate(${rotate * p}deg)`;\n if (scale !== 1) transform += ` scale(${1 + (scale - 1) * p})`;\n\n (el as HTMLElement).style.transform = transform.trim();\n}\n\n/** Play the exit animation (entrance or `exit` preset, reversed), ending hidden. */\nfunction runExit(el: Element, opts: Required<AnimateOptions>, config: Required<ScrollAnimateConfig>): void {\n if (config.useClassNames || typeof el.animate !== 'function') {\n hideElement(el, config);\n return;\n }\n cancelRunning(el);\n const preset = resolvePreset(opts.exit === true ? opts.animation : (opts.exit as Exclude<typeof opts.exit, boolean>));\n const built = buildAnimation({ from: preset.to, to: preset.from }, opts.easing);\n const timing: KeyframeAnimationOptions = { duration: opts.duration, easing: built.easing, fill: 'forwards' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n // Kept (filling) until the next entrance cancels it.\n running.set(el, anim);\n}\n\nfunction hideElement(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.add(config.hiddenClass);\n el.classList.remove(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '0';\n }\n}\n\n/** @internal Hide an element before its entrance animation, unless motion is off. */\nexport function prepareElement(el: Element, config: ScrollAnimateConfig = {}): void {\n const full = { ...DEFAULT_CONFIG, ...config };\n if (!motionDisabled(full)) hideElement(el, full);\n}\n\nlet progressThresholds: number[] | undefined;\nfunction getProgressThresholds(): number[] {\n if (!progressThresholds) {\n progressThresholds = [];\n for (let i = 0; i <= 100; i++) progressThresholds.push(i / 100);\n }\n return progressThresholds;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/* ------------------------------------------------------------------ */\n/* Instance */\n/* ------------------------------------------------------------------ */\n\nexport function createScrollAnimate(userConfig: ScrollAnimateConfig = {}): ScrollAnimateInstance {\n let config: Required<ScrollAnimateConfig> = { ...DEFAULT_CONFIG, ...userConfig };\n const registry = new Map<Element, AnimatedElement>();\n // `once` elements that finished and were dropped from the registry (autoUnregister).\n let finished = new WeakSet<Element>();\n // Elements in `progressMode: 'scroll'` that are currently inside the viewport.\n const scrolling = new Set<Element>();\n let frame = 0;\n let listening: EventTarget | null = null;\n // Active watch() MutationObservers, disconnected by destroy().\n const watchers = new Set<MutationObserver>();\n // Elements with a pending class-name completion timer started by this instance.\n const pending = new Set<Element>();\n // Elements whose entrance runs on a native scroll-driven timeline.\n const natives = new Set<Element>();\n\n // Observers are shared between elements with the same root/threshold/rootMargin,\n // instead of one (or two) IntersectionObservers per element.\n const pools = new Map<Root, Map<string, IntersectionObserver>>();\n\n function pooled(root: Root, key: string, create: () => IntersectionObserver): IntersectionObserver {\n let pool = pools.get(root);\n if (!pool) pools.set(root, (pool = new Map()));\n let io = pool.get(key);\n if (!io) pool.set(key, (io = create()));\n return io;\n }\n\n function teardown(el: Element, restore: boolean): void {\n const record = registry.get(el);\n if (!record) return;\n record.observer.unobserve(el);\n record.progressObserver?.unobserve(el);\n registry.delete(el);\n untrack(el);\n if (record.engine === 'css') {\n // A scroll-linked animation would keep following the scroll: stop it and\n // show the element (unless it finished and is just being released).\n if (restore) {\n natives.delete(el);\n reveal(el, config);\n }\n return;\n }\n // An element that never animated would otherwise stay invisible forever.\n if (restore && !record.animated) reveal(el, config);\n }\n\n function pruneDetached(): void {\n registry.forEach((record, el) => {\n if (el.isConnected === false) teardown(el, false);\n });\n }\n\n function emitProgress(el: Element, record: AnimatedElement, progress: number): void {\n const opts = record.options;\n opts.onProgress(el, progress);\n if (opts.progressVar) {\n const style = (el as HTMLElement).style;\n if (style) style.setProperty(opts.progressVar, String(+progress.toFixed(4)));\n }\n if (hasParallax(opts.parallax) && !motionDisabled(config)) applyParallax(el, progress, opts.parallax);\n }\n\n function update(): void {\n frame = 0;\n scrolling.forEach((el) => {\n const record = registry.get(el);\n if (record) emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n // rAF-throttled; IntersectionObserver-capable browsers all have rAF.\n const schedule = () => frame || (frame = requestAnimationFrame(update));\n\n function listen(on: boolean): void {\n if (on === !!listening) return;\n const method = on ? 'addEventListener' : 'removeEventListener';\n const target: EventTarget = listening || (config.root as EventTarget | null) || window;\n target[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n listening = on ? target : null;\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n }\n\n function untrack(el: Element): void {\n if (scrolling.delete(el) && !scrolling.size) listen(false);\n }\n\n function onScrollIntersect(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n if (entry.isIntersecting) {\n scrolling.add(el);\n listen(true);\n } else {\n untrack(el);\n }\n // Emit right away so the edges (0 / 1) are reported even on fast scrolls.\n emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n function onIntersect(entries: IntersectionObserverEntry[]): void {\n const staggerCounts = new Map<Element | null, number>();\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n const opts = record.options;\n\n if (el.isConnected === false) {\n teardown(el, false);\n return;\n }\n\n if (record.engine === 'css') {\n // The browser drives the animation; only lifecycle bookkeeping here.\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (!record.animated) {\n record.animated = true;\n opts.onStart(el);\n }\n if (opts.once && !opts.repeat) {\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat) record.animated = false;\n }\n return;\n }\n\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (record.animated && !opts.repeat) return;\n\n // Stagger relative to siblings revealed in the same batch, so elements\n // scrolled into view later don't inherit an ever-growing delay.\n let staggerIndex = 0;\n if (opts.stagger > 0) {\n const parent = el.parentElement;\n staggerIndex = staggerCounts.get(parent) ?? 0;\n staggerCounts.set(parent, staggerIndex + 1);\n }\n\n runAnimation(el, opts, config, staggerIndex, pending);\n record.animated = true;\n\n if (opts.once && !opts.repeat) {\n // Keep the progress observer: parallax/onProgress must keep working.\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n // Nothing left to watch: free the record (the running animation\n // keeps its own reference until it finishes).\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat && record.animated) {\n if (!motionDisabled(config)) {\n if (opts.exit) runExit(el, opts, config);\n else hideElement(el, config);\n }\n record.animated = false;\n }\n }\n });\n }\n\n function onProgress(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const record = registry.get(entry.target);\n if (!record) return;\n emitProgress(entry.target, record, entry.intersectionRatio);\n });\n }\n\n function getObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const rootMargin = applyOffset(opts.rootMargin, opts.offset);\n const threshold = opts.threshold;\n const root = config.root;\n return pooled(root, `m|${rootMargin}|${String(threshold)}`, () =>\n new IntersectionObserver(onIntersect, { threshold, rootMargin, root: root as Element | null })\n );\n }\n\n function getProgressObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const root = config.root;\n if (opts.progressMode === 'scroll') {\n // Only used to know when to start/stop measuring; progress itself comes\n // from a single shared, rAF-throttled passive scroll listener.\n return pooled(root, `s|${opts.rootMargin}`, () =>\n new IntersectionObserver(onScrollIntersect, { threshold: 0, rootMargin: opts.rootMargin, root: root as Element | null })\n );\n }\n return pooled(root, `p|${opts.rootMargin}`, () =>\n new IntersectionObserver(onProgress, {\n threshold: getProgressThresholds(),\n rootMargin: opts.rootMargin,\n root: root as Element | null,\n })\n );\n }\n\n function attach(el: Element, record: AnimatedElement, observeMain: boolean): void {\n record.observer = getObserver(record.options);\n if (observeMain) record.observer.observe(el);\n record.progressObserver = needsProgress(record.options) ? getProgressObserver(record.options) : undefined;\n record.progressObserver?.observe(el);\n }\n\n function wantsNative(opts: Required<AnimateOptions>): boolean {\n return opts.engine !== 'js' && !config.useClassNames && !motionDisabled(config) && supportsScrollTimeline();\n }\n\n function observeElement(el: Element, opts: Required<AnimateOptions>): void {\n if (registry.has(el) || finished.has(el)) return;\n\n if (!supportsObserver()) {\n // No IntersectionObserver (very old browser): never leave content hidden.\n reveal(el, config);\n return;\n }\n\n const record = { element: el, options: opts, animated: false, engine: 'js' } as AnimatedElement;\n if (wantsNative(opts)) {\n cancelRunning(el);\n if (startNative(el, opts, () => natives.delete(el))) {\n record.engine = 'css';\n natives.add(el);\n }\n }\n if (record.engine === 'js' && !motionDisabled(config)) hideElement(el, config);\n\n registry.set(el, record);\n attach(el, record, true);\n }\n\n function observeDataElement(el: Element): void {\n if (!registry.has(el)) observeElement(el, parseDataAttributes(el, config));\n }\n\n const instance: ScrollAnimateInstance = {\n observe(target, options = {}) {\n pruneDetached();\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => observeElement(el, opts));\n },\n\n unobserve(target) {\n resolveTargets(target).forEach((el) => {\n finished.delete(el);\n teardown(el, true);\n });\n },\n\n init(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope) return;\n pruneDetached();\n scope.querySelectorAll('[data-sa]').forEach(observeDataElement);\n },\n\n watch(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope || typeof MutationObserver === 'undefined') return noop;\n instance.init(scope);\n const observeTree = (node: Element) => {\n if (node.hasAttribute('data-sa')) observeDataElement(node);\n node.querySelectorAll('[data-sa]').forEach(observeDataElement);\n };\n const mo = new MutationObserver((records) => {\n let removed = false;\n records.forEach((record) => {\n if (record.type === 'attributes') {\n const target = record.target as Element;\n if (target.isConnected !== false) observeTree(target);\n return;\n }\n record.addedNodes.forEach((node) => {\n if (node instanceof Element && node.isConnected !== false) observeTree(node);\n });\n if (record.removedNodes.length) removed = true;\n });\n // Free elements that left the DOM (they can't animate any more).\n if (removed) pruneDetached();\n });\n mo.observe(scope, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-sa'] });\n watchers.add(mo);\n return () => {\n mo.disconnect();\n watchers.delete(mo);\n };\n },\n\n destroy() {\n watchers.forEach((mo) => mo.disconnect());\n watchers.clear();\n // Class-name mode: drop completion timers so onComplete never fires after destroy().\n pending.forEach((el) => {\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n });\n pending.clear();\n registry.forEach((record, el) => {\n if (!record.animated && record.engine !== 'css') reveal(el, config);\n });\n // Native scroll-linked animations still running: stop them, show content.\n natives.forEach((el) => {\n if (running.has(el)) reveal(el, config);\n });\n natives.clear();\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n registry.clear();\n scrolling.clear();\n listen(false);\n finished = new WeakSet();\n },\n\n refresh() {\n // Rebuild observers (e.g. after configure({ root })) without re-hiding or\n // replaying elements that have already animated.\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n scrolling.clear();\n listen(false);\n pruneDetached();\n if (!supportsObserver()) return;\n registry.forEach((record, el) => {\n const done = record.animated && record.options.once && !record.options.repeat;\n attach(el, record, !done);\n });\n },\n\n animate(target, options = {}) {\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => runAnimation(el, opts, config, 0, pending));\n },\n\n getObservedElements() {\n return Array.from(registry.values());\n },\n\n configure(newConfig) {\n config = { ...config, ...newConfig };\n },\n };\n\n return instance;\n}\n","/**\n * use-scroll-animate - Staggered children\n * Reveal a container's children one after another when the container scrolls\n * into view, optionally also animating children that are added later.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, stopAnimation, supportsObserver } from './core';\n\nexport interface StaggerOptions extends AnimateOptions {\n /** Delay between consecutive children in ms (default: 80) */\n stagger?: number;\n /**\n * Watch the container with a MutationObserver and animate children added\n * later (e.g. infinite lists). Children added after the container was\n * revealed animate when they scroll into view, staggered per batch.\n * (default: false)\n */\n observeChildren?: boolean;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\n/**\n * Animate the children of `container` with a stagger once it enters the\n * viewport. Returns a cleanup function. SSR-safe (no-op without a DOM).\n *\n * @example\n * const stop = staggerChildren(document.querySelector('ul'), { stagger: 60, observeChildren: true });\n */\nexport function staggerChildren(\n container: Element | null | undefined,\n options: StaggerOptions = {},\n instance?: ScrollAnimateInstance\n): () => void {\n if (!container || !hasDOM() || !supportsObserver()) return () => undefined; // leave content visible\n const sa = instance || fallback || (fallback = createScrollAnimate());\n const { stagger = 80, delay = 0, threshold = 0.1, rootMargin = '0px', observeChildren = false, ...rest } = options;\n\n let items = Array.from(container.children);\n let revealed = false;\n const late: Element[] = [];\n items.forEach((child) => prepareElement(child));\n\n const io = new IntersectionObserver(\n (entries) => {\n if (revealed || !entries.some((entry) => entry.isIntersecting)) return;\n revealed = true;\n io.disconnect();\n items.forEach((child, i) => {\n if (child.parentNode === container) sa.animate(child, { ...rest, delay: delay + i * stagger });\n });\n items = [];\n },\n { threshold, rootMargin }\n );\n io.observe(container);\n\n let mo: MutationObserver | undefined;\n if (observeChildren && typeof MutationObserver !== 'undefined') {\n mo = new MutationObserver((records) => {\n records.forEach((record) => {\n record.addedNodes.forEach((node) => {\n if (!(node instanceof Element) || node.parentNode !== container) return;\n if (!revealed) {\n prepareElement(node);\n items.push(node);\n } else {\n // The core engine staggers siblings relative to the batch that\n // enters the viewport together.\n late.push(node);\n sa.observe(node, { ...rest, delay, stagger, threshold, rootMargin });\n }\n });\n record.removedNodes.forEach((node) => {\n if (!(node instanceof Element)) return;\n items = items.filter((el) => el !== node);\n const i = late.indexOf(node);\n if (i >= 0) {\n late.splice(i, 1);\n sa.unobserve(node);\n }\n });\n });\n });\n mo.observe(container, { childList: true });\n }\n\n return () => {\n io.disconnect();\n mo?.disconnect();\n // Stopped before the container was revealed: never leave the children hidden.\n if (!revealed) {\n revealed = true;\n items.forEach((child) => stopAnimation(child));\n items = [];\n }\n late.forEach((el) => sa.unobserve(el));\n late.length = 0;\n };\n}\n","/**\n * use-scroll-animate - Sequence / timeline helper\n * Chain animations on several targets, one after another (or overlapping).\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, resolveTargets, stopAnimation, supportsObserver } from './core';\n\nexport interface SequenceStep extends AnimateOptions {\n /** Selector, Element, NodeList or Element[] to animate in this step */\n target: string | Element | NodeList | Element[];\n /** Pause (ms) after the previous step ends before this one starts. Negative values overlap. (default: 0) */\n gap?: number;\n /** Absolute start time (ms) on the timeline; overrides `gap` */\n at?: number;\n}\n\nexport interface SequenceOptions extends AnimateOptions {\n /** Play automatically (once) when this element/selector enters the viewport */\n trigger?: string | Element;\n /** Instance whose global config (easing, classes, `disabled`) is used */\n instance?: ScrollAnimateInstance;\n}\n\nexport interface SequenceController {\n /** Play (or replay) the timeline. Resolves when every step has completed, or on `cancel()`. */\n play(): Promise<void>;\n /** Stop the trigger and running animations; elements are left visible. */\n cancel(): void;\n /** Total duration of the timeline in ms (computed for the current DOM). */\n duration(): number;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\ntype Planned = { el: Element; opts: AnimateOptions; end: number };\n\nfunction plan(steps: SequenceStep[], defaults: AnimateOptions): Planned[] {\n const out: Planned[] = [];\n let cursor = 0;\n steps.forEach((step) => {\n const { target, gap = 0, at, ...stepOpts } = step;\n const opts = { ...defaults, ...stepOpts };\n const duration = opts.duration ?? 600;\n const start = Math.max(0, at ?? cursor + gap) + (opts.delay ?? 0);\n let end = Math.max(cursor, start);\n resolveTargets(target).forEach((el, i) => {\n const delay = start + i * (opts.stagger ?? 0);\n out.push({ el, opts: { ...opts, duration, delay, stagger: 0 }, end: delay + duration });\n end = Math.max(end, delay + duration);\n });\n cursor = end;\n });\n return out;\n}\n\n/**\n * Build a timeline of animations.\n *\n * @example\n * sequence([\n * { target: '.title', animation: 'fade-in-up' },\n * { target: '.subtitle', animation: 'blur-in', gap: -300 }, // overlap by 300ms\n * { target: '.card', animation: 'scale-up', stagger: 80 },\n * ], { trigger: '.hero' });\n */\nexport function sequence(steps: SequenceStep[], options: SequenceOptions = {}): SequenceController {\n const { trigger, instance, ...defaults } = options;\n const sa = () => instance || fallback || (fallback = createScrollAnimate());\n let io: IntersectionObserver | undefined;\n let active: Planned[] = [];\n let settle: (() => void) | undefined;\n // Targets hidden while waiting for `trigger`; revealed if cancelled before it fires.\n let prepared: Element[] = [];\n\n const controller: SequenceController = {\n play() {\n controller.cancel();\n if (!hasDOM()) return Promise.resolve();\n active = plan(steps, defaults);\n return new Promise<void>((resolve) => {\n let left = active.length;\n settle = () => {\n settle = undefined;\n resolve();\n };\n if (!left) return settle();\n const run = active;\n run.forEach(({ el, opts }) => {\n const done = opts.onComplete;\n sa().animate(el, {\n ...opts,\n onComplete: (node) => {\n done?.(node);\n if (run === active && --left === 0) settle?.();\n },\n });\n });\n });\n },\n\n cancel() {\n io?.disconnect();\n io = undefined;\n prepared.forEach((el) => stopAnimation(el));\n prepared = [];\n active.forEach(({ el }) => stopAnimation(el));\n active = [];\n settle?.();\n },\n\n duration() {\n return plan(steps, defaults).reduce((max, p) => Math.max(max, p.end), 0);\n },\n };\n\n if (trigger && hasDOM() && supportsObserver()) {\n const el = resolveTargets(trigger)[0];\n if (el) {\n prepared = plan(steps, defaults).map(({ el: target }) => target);\n prepared.forEach((target) => prepareElement(target));\n io = new IntersectionObserver(\n (entries) => {\n if (!entries.some((e) => e.isIntersecting)) return;\n io?.disconnect();\n io = undefined;\n prepared = []; // play() takes over from here\n controller.play();\n },\n { threshold: defaults.threshold ?? 0.1, rootMargin: defaults.rootMargin ?? '0px' }\n );\n io.observe(el);\n }\n }\n\n return controller;\n}\n","/**\n * use-scroll-animate - parallax() helper\n *\n * Moves elements at a different speed than the page while they cross the\n * viewport. Built on the same scroll progress as `progressVar` (0 when the\n * element's top enters at the bottom, 1 when its bottom leaves at the top):\n * the progress is written to a CSS custom property (default `--sa-parallax`)\n * and the offset is applied with the individual `translate` property, so it\n * composes with entrance animations and other `transform`s.\n */\n\nimport { getScrollProgress, hasDOM, prefersReducedMotion, resolveTargets, supportsObserver } from './core';\n\nexport interface ParallaxHelperOptions {\n /**\n * Total distance the element shifts while it crosses the viewport, as a\n * fraction of the viewport size (`0.2` = 20vh on the y axis). Positive values\n * lag behind the scroll (background-like), negative values move ahead of it\n * (foreground-like). (default: `0.2`)\n */\n speed?: number;\n /** `'y'` (default) or `'x'` (horizontal drift, in `vw`) */\n axis?: 'x' | 'y';\n /** CSS custom property receiving the progress (default: `'--sa-parallax'`) */\n progressVar?: string;\n /** Scroll container (default: the viewport) */\n root?: Element | null;\n /**\n * Under `prefers-reduced-motion: reduce` no offset is applied (the progress\n * variable is still written). Set to `false` to move anyway. (default: `true`)\n */\n respectReducedMotion?: boolean;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/**\n * Apply a scroll parallax to `target` (selector, Element, NodeList or array).\n * Returns a function that stops it and removes the inline styles it set.\n * SSR-safe (no-op without a DOM / IntersectionObserver).\n *\n * @example\n * const stop = parallax('.hero-bg', { speed: 0.3 });\n * parallax('.badge', { speed: -0.15, axis: 'x' });\n */\nexport function parallax(\n target: string | Element | NodeList | Element[],\n options: ParallaxHelperOptions = {}\n): () => void {\n const els = resolveTargets(target);\n if (!els.length || !hasDOM() || !supportsObserver()) return () => undefined;\n const { speed = 0.2, axis = 'y', root = null, respectReducedMotion = true } = options;\n const name = options.progressVar ? (options.progressVar.startsWith('--') ? options.progressVar : `--${options.progressVar}`) : '--sa-parallax';\n const unit = axis === 'x' ? 'vw' : 'vh';\n const visible = new Set<Element>();\n let frame = 0;\n let listening = false;\n const scroller: EventTarget = root || window;\n\n const apply = (el: Element) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n const p = getScrollProgress(el, root);\n style.setProperty(name, String(+p.toFixed(4)));\n if (respectReducedMotion && prefersReducedMotion()) {\n style.removeProperty('translate');\n return;\n }\n const offset = `${+((p - 0.5) * speed * 100).toFixed(3)}${unit}`;\n style.setProperty('translate', axis === 'x' ? `${offset} 0px` : `0px ${offset}`);\n };\n\n const update = () => {\n frame = 0;\n visible.forEach(apply);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n const listen = (on: boolean) => {\n if (on === listening) return;\n listening = on;\n const method = on ? 'addEventListener' : 'removeEventListener';\n scroller[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n };\n\n const io = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) visible.add(entry.target);\n else visible.delete(entry.target);\n apply(entry.target); // report the edges even on fast scrolls\n });\n listen(visible.size > 0);\n },\n { threshold: 0, root }\n );\n els.forEach((el) => {\n apply(el); // no jump before the first observer callback\n io.observe(el);\n });\n\n return () => {\n io.disconnect();\n listen(false);\n visible.clear();\n els.forEach((el) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n style.removeProperty('translate');\n style.removeProperty(name);\n });\n };\n}\n","/**\n * use-scroll-animate\n *\n * A lightweight, dependency-free scroll animation library for modern web\n * applications. Built with TypeScript, powered by IntersectionObserver and\n * the Web Animations API (or the native scroll-driven timeline). Safe to\n * import during SSR. Framework integrations live in the subpath entries:\n * `use-scroll-animate/react`, `/vue`, `/svelte`, `/solid`, `/element`.\n *\n * @license MIT\n * @see https://github.com/HarrisonCN/use-scroll-animate\n */\n\nexport { createScrollAnimate, getScrollProgress, supportsScrollTimeline } from './core';\nexport { staggerChildren } from './stagger';\nexport { sequence } from './sequence';\nexport { parallax } from './parallax';\nexport { PRESETS, resolvePreset, resolveEasing, EASING_MAP } from './presets';\nexport type {\n AnimationPreset,\n EasingType,\n AnimationKeyframe,\n CustomAnimation,\n ParallaxOptions,\n ProgressMode,\n ScrollEngine,\n AnimateOptions,\n ScrollAnimateConfig,\n AnimatedElement,\n ScrollAnimateInstance,\n} from './types';\nexport type { StaggerOptions } from './stagger';\nexport type { ParallaxHelperOptions } from './parallax';\nexport type { SequenceStep, SequenceOptions, SequenceController } from './sequence';\n\n// Default export: a ready-to-use singleton instance\nimport { createScrollAnimate } from './core';\n\n/**\n * Default singleton instance of ScrollAnimate.\n * Ready to use out of the box with sensible defaults.\n *\n * @example\n * ```js\n * import ScrollAnimate from 'use-scroll-animate';\n *\n * // Auto-initialize all elements with data-sa attribute\n * ScrollAnimate.init();\n *\n * // Or manually observe elements\n * ScrollAnimate.observe('.my-element', { animation: 'fade-in-up' });\n * ```\n */\nconst ScrollAnimate = /* @__PURE__ */ createScrollAnimate();\nexport default ScrollAnimate;\n"],"names":["PRESETS","from","opacity","to","transform","bounce","filter","shimmer","pulse","swing","clipPath","resolvePreset","animation","trim","Array","isArray","combined","forEach","name","preset","Object","entries","key","val","EASING_MAP","linear","ease","spring","resolveEasing","easing","join","DEFAULT_CONFIG","defaultAnimation","defaultDuration","defaultDelay","defaultEasing","defaultThreshold","defaultRootMargin","defaultRepeat","defaultOnce","defaultOffset","hiddenClass","visibleClass","useClassNames","disabled","root","autoUnregister","defaultEngine","noop","hasDOM","window","document","supportsObserver","IntersectionObserver","reducedMotionQuery","scrollTimelineSupported","prefersReducedMotion","undefined","matchMedia","matches","supportsScrollTimeline","CSS","supports","globalThis","ViewTimeline","num","value","n","parseFloat","Number","isFinite","lengthValue","v","test","DEFAULT_VIEW_RANGE","normalizeVar","startsWith","parseDataAttributes","el","config","mergeOptions","get","opts","anim","includes","split","map","s","duration","delay","e","JSON","parse","t","threshold","rootMargin","repeat","once","offset","stagger","progressVar","engine","range","start","end","viewRange","exit","progress","progressMode","px","py","pr","ps","parallax","x","y","rotate","scale","speed","keys","k","readOptions","getAttribute","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","hasParallax","p","some","getScrollProgress","rect","getBoundingClientRect","top","height","innerHeight","documentElement","clientHeight","r","total","running","WeakMap","exits","timers","cancelRunning","exitAnim","delete","cancel","onfinish","timer","clearTimeout","setStyles","styles","style","prop","String","NUM_UNIT","linearSupported","progressThresholds","buildAnimation","keyframes","samples","fn","values","i","push","toFixed","sampleEasing","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","stopAnimation","motionDisabled","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","prepareElement","full","getProgressThresholds","PASSIVE","passive","createScrollAnimate","userConfig","registry","Map","finished","WeakSet","scrolling","Set","listening","watchers","natives","pools","pooled","create","pool","io","teardown","restore","record","observer","unobserve","progressObserver","untrack","animated","pruneDetached","isConnected","emitProgress","options","setProperty","axis","applyParallax","update","schedule","requestAnimationFrame","listen","on","method","cancelAnimationFrame","size","onScrollIntersect","entry","isIntersecting","onIntersect","staggerCounts","parent","parentElement","runExit","intersectionRatio","getObserver","parts","right","bottom","left","m","exec","applyOffset","attach","observeMain","observe","getProgressObserver","observeElement","has","element","wantsNative","onFrozen","timeline","subject","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","instance","init","rootElement","scope","watch","MutationObserver","observeTree","node","hasAttribute","mo","records","removed","type","addedNodes","removedNodes","childList","subtree","attributes","attributeFilter","disconnect","destroy","clear","refresh","getObservedElements","configure","newConfig","fallback","plan","steps","defaults","cursor","step","gap","at","stepOpts","ScrollAnimate","els","respectReducedMotion","visible","scroller","apply","removeProperty","trigger","settle","active","prepared","controller","play","Promise","resolve","run","done","reduce","container","sa","observeChildren","rest","items","children","revealed","late","child","parentNode","indexOf","splice"],"mappings":"oPAYO,MAAMA,EAAgD,CAC3D,UAAW,CACTC,KAAM,CAAEC,QAAS,GACjBC,GAAI,CAAED,QAAS,IAEjB,aAAc,CACZD,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,gBAAiB,CACfH,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,UAAW,CACTH,KAAM,CAAEC,QAAS,EAA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E,aACHsC,EAAM7U,QAAQ,CAACiV,EAAOvL,KAChBuL,EAAMC,aAAeT,GAAWC,EAAG1I,QAAQiJ,EAAO,IAAKL,EAAMpQ,MAAOA,EAAQkF,EAAIxE,MAEtF2P,EAAQ,KAEV,CAAEhQ,YAAWC,eAIf,IAAI+M,EA8BJ,OAhCAnE,EAAG2C,QAAQoE,GAGPE,GAA+C,oBAArBlD,mBAC5BI,EAAK,IAAIJ,iBAAkBK,IACzBA,EAAQ9R,QAAS6N,IACfA,EAAOoE,WAAWjS,QAAS2R,IACnBA,aAAgBxK,SAAYwK,EAAKuD,aAAeT,IACjDM,GAMHC,EAAKrL,KAAKgI,GACV+C,EAAGrE,QAAQsB,EAAM,IAAKiD,EAAMpQ,QAAOU,UAASL,YAAWC,iBANvDwH,EAAeqF,GACfkD,EAAMlL,KAAKgI,OAQf9D,EAAOqE,aAAalS,QAAS2R,IAC3B,KAAMA,aAAgBxK,SAAU,OAChC0N,EAAQA,EAAMxV,OAAQwE,GAAOA,IAAO8N,GACpC,MAAMjI,EAAIsL,EAAKG,QAAQxD,GACnBjI,GAAK,IACPsL,EAAKI,OAAO1L,EAAG,GACfgL,EAAG3G,UAAU4D,UAKrBE,EAAGxB,QAAQoE,EAAW,CAAEtC,WAAW,KAG9B,KACLzE,EAAG6E,aACHV,GAAIU,aAECwC,IACHA,GAAW,EACXF,EAAM7U,QAASiV,GAAU5J,EAAc4J,IACvCJ,EAAQ,IAEVG,EAAKhV,QAAS6D,GAAO6Q,EAAG3G,UAAUlK,IAClCmR,EAAKtO,OAAS,EAElB"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/stagger.ts","../src/sequence.ts","../src/parallax.ts","../src/index.ts"],"sourcesContent":["/**\n * use-scroll-animate - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CustomAnimation, EasingType } from './types';\n\ntype KeyframeMap = {\n from: Record<string, string | number>;\n to: Record<string, string | number>;\n};\n\nexport const PRESETS: Record<AnimationPreset, KeyframeMap> = {\n 'fade-in': {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n 'fade-in-up': {\n from: { opacity: 0, transform: 'translateY(40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-down': {\n from: { opacity: 0, transform: 'translateY(-40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-left': {\n from: { opacity: 0, transform: 'translateX(-40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'fade-in-right': {\n from: { opacity: 0, transform: 'translateX(40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'zoom-in': {\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'zoom-out': {\n from: { opacity: 0, transform: 'scale(1.2)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'flip-x': {\n from: { opacity: 0, transform: 'rotateX(-90deg)' },\n to: { opacity: 1, transform: 'rotateX(0deg)' },\n },\n 'flip-y': {\n from: { opacity: 0, transform: 'rotateY(-90deg)' },\n to: { opacity: 1, transform: 'rotateY(0deg)' },\n },\n 'slide-up': {\n from: { transform: 'translateY(100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-down': {\n from: { transform: 'translateY(-100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-left': {\n from: { transform: 'translateX(-100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'slide-right': {\n from: { transform: 'translateX(100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'bounce': {\n from: { opacity: 0, transform: 'translateY(-60px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'rotate-in': {\n from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },\n to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },\n },\n 'blur-in': {\n from: { opacity: 0, filter: 'blur(12px)' },\n to: { opacity: 1, filter: 'blur(0px)' },\n },\n 'skew-in': {\n from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },\n to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },\n },\n 'scale-x': {\n from: { transform: 'scaleX(0)' },\n to: { transform: 'scaleX(1)' },\n },\n 'scale-y': {\n from: { transform: 'scaleY(0)' },\n to: { transform: 'scaleY(1)' },\n },\n 'shimmer': {\n from: { opacity: 0.5, filter: 'brightness(1)' },\n to: { opacity: 1, filter: 'brightness(1.5)' },\n },\n 'pulse': {\n from: { transform: 'scale(1)' },\n to: { transform: 'scale(1.05)' },\n },\n 'swing': {\n from: { transform: 'rotate(-10deg)' },\n to: { transform: 'rotate(10deg)' },\n },\n 'scale-up': {\n from: { opacity: 0, transform: 'scale(0.5)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'blur-in-up': {\n from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },\n to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },\n },\n 'flip-up': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'flip-down': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'rotate-left': {\n from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n 'rotate-right': {\n from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n // clip-path reveals: content is uncovered without moving or fading\n 'clip-up': {\n from: { clipPath: 'inset(100% 0% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-down': {\n from: { clipPath: 'inset(0% 0% 100% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-left': {\n from: { clipPath: 'inset(0% 0% 0% 100%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-right': {\n from: { clipPath: 'inset(0% 100% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-circle': {\n from: { clipPath: 'circle(0% at 50% 50%)' },\n to: { clipPath: 'circle(75% at 50% 50%)' },\n },\n};\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return PRESETS[animation.trim() as AnimationPreset] ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = PRESETS[name.trim() as AnimationPreset];\n if (preset) {\n Object.entries(preset.from).forEach(([key, val]) => {\n if (key === 'transform' && combined.from[key]) {\n combined.from[key] = `${combined.from[key]} ${val}`;\n } else {\n combined.from[key] = val;\n }\n });\n Object.entries(preset.to).forEach(([key, val]) => {\n if (key === 'transform' && combined.to[key]) {\n combined.to[key] = `${combined.to[key]} ${val}`;\n } else {\n combined.to[key] = val;\n }\n });\n }\n });\n return combined;\n }\n \n return animation;\n}\n\n/** Easing to CSS cubic-bezier mapping */\nexport const EASING_MAP: Record<string, string> = {\n linear: 'linear',\n ease: 'ease',\n 'ease-in': 'ease-in',\n 'ease-out': 'ease-out',\n 'ease-in-out': 'ease-in-out',\n spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',\n 'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n 'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n};\n\nexport function resolveEasing(easing: EasingType): string {\n if (typeof easing === 'string') {\n return EASING_MAP[easing] ?? easing;\n }\n if (Array.isArray(easing)) {\n return `cubic-bezier(${easing.join(', ')})`;\n }\n if (typeof easing === 'function') {\n // Functions cannot be expressed as a CSS easing string; the core samples\n // them into a `linear()` easing (or keyframes on older browsers).\n return 'linear';\n }\n return 'ease';\n}\n","/**\n * use-scroll-animate - Core Implementation\n * Uses IntersectionObserver + Web Animations API for zero-dependency,\n * high-performance scroll-triggered animations.\n */\n\nimport type {\n AnimateOptions,\n AnimatedElement,\n ScrollAnimateConfig,\n ScrollAnimateInstance,\n ParallaxOptions,\n} from './types';\nimport { resolvePreset, resolveEasing } from './presets';\n\ntype KeyframeMap = ReturnType<typeof resolvePreset>;\ntype Target = string | Element | NodeList | Element[];\ntype Root = Element | Document | null;\n\nconst DEFAULT_CONFIG: Required<ScrollAnimateConfig> = {\n defaultAnimation: 'fade-in-up',\n defaultDuration: 600,\n defaultDelay: 0,\n defaultEasing: 'ease',\n defaultThreshold: 0.1,\n defaultRootMargin: '0px',\n defaultRepeat: false,\n defaultOnce: true,\n defaultOffset: 0,\n hiddenClass: 'sa-hidden',\n visibleClass: 'sa-visible',\n useClassNames: false,\n disabled: false,\n root: null,\n autoUnregister: true,\n defaultEngine: 'auto',\n};\n\nconst noop = () => undefined;\n\n/* ------------------------------------------------------------------ */\n/* Environment helpers (all SSR-safe: never touch globals at import) */\n/* ------------------------------------------------------------------ */\n\nconst hasDOM = (): boolean => typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @internal */\nexport const supportsObserver = (): boolean => hasDOM() && typeof IntersectionObserver !== 'undefined';\n\nlet reducedMotionQuery: MediaQueryList | null | undefined;\n\n/** @internal Whether the user asked the OS/browser to reduce motion. */\nexport function prefersReducedMotion(): boolean {\n if (!hasDOM()) return false;\n if (reducedMotionQuery === undefined) {\n reducedMotionQuery =\n typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;\n }\n return !!reducedMotionQuery && reducedMotionQuery.matches;\n}\n\nlet scrollTimelineSupported: boolean | undefined;\n\n/**\n * Whether the browser can run presets on a native scroll-driven timeline:\n * `CSS.supports('animation-timeline: view()')` plus the `ViewTimeline`\n * constructor used to attach it from JavaScript. Cached. SSR-safe.\n */\nexport function supportsScrollTimeline(): boolean {\n if (scrollTimelineSupported === undefined) {\n scrollTimelineSupported =\n hasDOM() &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timeline: view()') &&\n typeof (globalThis as any).ViewTimeline === 'function';\n }\n return scrollTimelineSupported;\n}\n\n/** @internal Reset the cached feature checks (tests). */\nexport function resetFeatureCache(): void {\n scrollTimelineSupported = undefined;\n linearSupported = undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* Option parsing */\n/* ------------------------------------------------------------------ */\n\nfunction num(value: string | undefined): number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const n = parseFloat(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Numeric strings (\"100\") become numbers (px); strings with units stay as-is. */\nfunction lengthValue(value: string | undefined): string | number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const v = value.trim();\n return /^-?(\\d+\\.?\\d*|\\.\\d+)$/.test(v) ? parseFloat(v) : v;\n}\n\nconst DEFAULT_PROGRESS_VAR = '--sa-progress';\nconst DEFAULT_VIEW_RANGE: [string, string] = ['entry 0%', 'entry 100%'];\n\n/** `''` (bare attribute) -> default name; `sa-progress` -> `--sa-progress`. */\nfunction normalizeVar(name: string): string {\n const v = name.trim();\n if (!v) return DEFAULT_PROGRESS_VAR;\n return v.startsWith('--') ? v : `--${v}`;\n}\n\n/**\n * @internal Read options from string attributes. `get(name)` returns the raw\n * value of the attribute `name` (kebab-case, e.g. `root-margin`), `''` for a\n * bare attribute and `undefined` when absent. Shared by `data-sa-*` and the\n * `<scroll-animate>` element.\n */\nexport function readOptions(get: (name: string) => string | undefined): AnimateOptions {\n const opts: AnimateOptions = {};\n\n const anim = get('animation');\n if (anim) {\n opts.animation = (anim.includes(',') ? anim.split(',').map((s) => s.trim()) : anim.trim()) as any;\n }\n opts.duration = num(get('duration'));\n opts.delay = num(get('delay'));\n const easing = get('easing');\n if (easing) {\n const e = easing.trim();\n if (e.startsWith('[')) {\n try {\n opts.easing = JSON.parse(e);\n } catch {\n // Malformed JSON: fall back to the default easing instead of throwing\n }\n } else {\n opts.easing = e;\n }\n }\n const t = get('threshold');\n if (t) {\n opts.threshold = t.includes(',') ? t.split(',').map(parseFloat).filter(Number.isFinite) : num(t);\n }\n const rootMargin = get('root-margin');\n if (rootMargin) opts.rootMargin = rootMargin;\n const repeat = get('repeat');\n if (repeat !== undefined) opts.repeat = repeat !== 'false';\n const once = get('once');\n if (once !== undefined) opts.once = once !== 'false';\n opts.offset = num(get('offset'));\n opts.stagger = num(get('stagger'));\n const progressVar = get('progress-var');\n if (progressVar !== undefined) opts.progressVar = normalizeVar(progressVar);\n const engine = get('engine')?.trim();\n if (engine === 'auto' || engine === 'js' || engine === 'css') opts.engine = engine;\n const range = get('view-range');\n if (range) {\n const [start, end] = range.split(',').map((s) => s.trim());\n if (start && end) opts.viewRange = [start, end];\n }\n const exit = get('exit');\n if (exit !== undefined) {\n const e = exit.trim();\n opts.exit = e === '' || e === 'true' ? true : e === 'false' ? false : ((e.includes(',') ? e.split(',').map((s) => s.trim()) : e) as any);\n }\n const progress = get('progress');\n if (progress) opts.progressMode = progress.trim() === 'scroll' ? 'scroll' : 'ratio';\n\n const px = get('parallax-x');\n const py = get('parallax-y');\n const pr = get('parallax-rotate');\n const ps = get('parallax-scale');\n if (px || py || pr || ps) {\n opts.parallax = {\n x: lengthValue(px),\n y: lengthValue(py),\n rotate: num(pr),\n scale: num(ps),\n speed: num(get('parallax-speed')) ?? 1,\n };\n }\n\n // Drop keys that were not set, so they don't override defaults when spread.\n (Object.keys(opts) as Array<keyof AnimateOptions>).forEach((k) => opts[k] === undefined && delete opts[k]);\n return opts;\n}\n\nfunction parseDataAttributes(el: Element, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n return mergeOptions(\n readOptions((name) => {\n const v = el.getAttribute(`data-sa-${name}`);\n return v === null ? undefined : v;\n }),\n config\n );\n}\n\nfunction mergeOptions(opts: AnimateOptions, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n let engine = opts.engine ?? config.defaultEngine;\n // 'auto' keeps time-based semantics when the element asks for them explicitly.\n if (engine === 'auto' && (opts.duration !== undefined || opts.delay !== undefined || opts.offset !== undefined || (opts.stagger ?? 0) > 0)) {\n engine = 'js';\n }\n const exit = opts.exit ?? false;\n const repeat = opts.repeat ?? (exit ? true : config.defaultRepeat);\n const threshold = opts.threshold ?? config.defaultThreshold;\n return {\n animation: opts.animation ?? config.defaultAnimation,\n duration: opts.duration ?? config.defaultDuration,\n delay: opts.delay ?? config.defaultDelay,\n easing: opts.easing ?? config.defaultEasing,\n threshold: Array.isArray(threshold) && threshold.length === 0 ? config.defaultThreshold : threshold,\n rootMargin: opts.rootMargin ?? config.defaultRootMargin,\n repeat,\n once: opts.once ?? (repeat ? false : config.defaultOnce),\n offset: opts.offset ?? config.defaultOffset,\n stagger: opts.stagger ?? 0,\n parallax: opts.parallax ?? {},\n onStart: opts.onStart ?? noop,\n onComplete: opts.onComplete ?? noop,\n onEnter: opts.onEnter ?? noop,\n onLeave: opts.onLeave ?? noop,\n onProgress: opts.onProgress ?? noop,\n progressMode: opts.progressMode ?? 'ratio',\n progressVar: opts.progressVar ? normalizeVar(opts.progressVar) : '',\n engine,\n viewRange: opts.viewRange ?? DEFAULT_VIEW_RANGE,\n exit,\n };\n}\n\nfunction resolveTargets(target: Target | null | undefined): Element[] {\n if (!target || !hasDOM()) return [];\n if (typeof target === 'string') return Array.from(document.querySelectorAll(target));\n if (target instanceof Element) return [target];\n if (Array.isArray(target) || target instanceof NodeList) {\n return (Array.from(target as ArrayLike<Node>) as Element[]).filter((el) => el instanceof Element);\n }\n return [];\n}\n\n/**\n * Apply `offset` to the bottom edge of a rootMargin, preserving the other\n * three sides. `offset: 100` means \"trigger 100px later\" (bottom -100px).\n * @internal\n */\nexport function applyOffset(rootMargin: string, offset: number): string {\n if (!offset) return rootMargin;\n const parts = (rootMargin || '0px').trim().split(/\\s+/);\n const top = parts[0];\n const right = parts[1] ?? top;\n const bottom = parts[2] ?? top;\n const left = parts[3] ?? right;\n const m = /^(-?\\d*\\.?\\d+)(px)?$/.exec(bottom);\n const base = m ? parseFloat(m[1]) : 0; // non-px bottoms (e.g. %) cannot be combined; offset wins\n return `${top} ${right} ${base - offset}px ${left}`;\n}\n\nfunction hasParallax(p: ParallaxOptions | undefined): boolean {\n return !!p && Object.keys(p).some((k) => (p as Record<string, unknown>)[k] !== undefined);\n}\n\nfunction needsProgress(opts: Required<AnimateOptions>): boolean {\n return hasParallax(opts.parallax) || opts.onProgress !== noop || !!opts.progressVar;\n}\n\n/**\n * True scroll progress of `el` through the viewport (or `root`): 0 when its top\n * edge reaches the bottom of the viewport, 1 when its bottom edge passes the top.\n * Works for elements taller than the viewport. Returns 0 without a DOM.\n */\nexport function getScrollProgress(el: Element, root?: Element | null): number {\n if (!hasDOM()) return 0;\n const rect = el.getBoundingClientRect();\n let top = 0;\n let height = window.innerHeight || document.documentElement.clientHeight || 0;\n if (root) {\n const r = root.getBoundingClientRect();\n top = r.top;\n height = r.height;\n }\n const total = height + rect.height;\n if (total <= 0) return 0;\n const p = (top + height - rect.top) / total;\n return p < 0 ? 0 : p > 1 ? 1 : p;\n}\n\n/* ------------------------------------------------------------------ */\n/* Animation */\n/* ------------------------------------------------------------------ */\n\n/** The animation currently running on an element, so it can be cancelled/replaced. */\nconst running = new WeakMap<Element, Animation>();\n/** Native engine: the scroll-linked exit animation, next to the entrance in `running`. */\nconst exits = new WeakMap<Element, Animation>();\nconst timers = new WeakMap<Element, ReturnType<typeof setTimeout>>();\n\nfunction cancelRunning(el: Element): void {\n const exitAnim = exits.get(el);\n if (exitAnim) {\n exits.delete(el);\n exitAnim.cancel();\n }\n const anim = running.get(el);\n if (anim) {\n running.delete(el);\n anim.onfinish = null;\n anim.cancel();\n }\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n}\n\nfunction setStyles(el: Element, styles: Record<string, string | number>): void {\n const style = (el as HTMLElement).style;\n if (!style) return;\n Object.keys(styles).forEach((prop) => {\n (style as any)[prop] = String(styles[prop]);\n });\n}\n\nconst NUM_UNIT = /(-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)/gi;\n\n/**\n * Interpolate two CSS values at `t`. Numbers interpolate directly; strings\n * interpolate when they share the same structure (e.g. `translateY(40px)` ->\n * `translateY(0px)`, or `scale(0.8)` -> `scale(1)`). Otherwise snaps at 0.5.\n * @internal\n */\nexport function interpolateValue(from: string | number, to: string | number, t: number): string | number {\n if (typeof from === 'number' && typeof to === 'number') return from + (to - from) * t;\n const a = String(from);\n const b = String(to);\n const ta: Array<[number, string]> = [];\n const tb: Array<[number, string]> = [];\n const skA = a.replace(NUM_UNIT, (_, n, u) => (ta.push([parseFloat(n), u]), '#'));\n const skB = b.replace(NUM_UNIT, (_, n, u) => (tb.push([parseFloat(n), u]), '#'));\n if (skA !== skB || ta.length !== tb.length) return t < 0.5 ? from : to;\n let i = 0;\n let ok = true;\n const out = skA.replace(/#/g, () => {\n const [na, ua] = ta[i];\n const [nb, ub] = tb[i++];\n if (ua !== ub && na !== 0 && nb !== 0 && ua && ub) ok = false;\n const unit = ua || ub;\n return `${+(na + (nb - na) * t).toFixed(4)}${unit}`;\n });\n return ok ? out : t < 0.5 ? from : to;\n}\n\nconst EASING_SAMPLES = 30;\nlet linearSupported: boolean | undefined;\n\nfunction supportsLinearEasing(): boolean {\n if (linearSupported === undefined) {\n linearSupported =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timing-function', 'linear(0, 1)');\n }\n return linearSupported;\n}\n\nfunction sampleEasing(fn: (t: number) => number): number[] {\n const values: number[] = [];\n for (let i = 0; i <= EASING_SAMPLES; i++) {\n const v = fn(i / EASING_SAMPLES);\n values.push(Number.isFinite(v) ? +v.toFixed(4) : i / EASING_SAMPLES);\n }\n return values;\n}\n\nfunction buildAnimation(\n preset: KeyframeMap,\n easing: Required<AnimateOptions>['easing']\n): { keyframes: Keyframe[]; easing: string } {\n if (typeof easing !== 'function') {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: resolveEasing(easing) };\n }\n const samples = sampleEasing(easing);\n // Modern browsers: an exact, property-agnostic `linear()` easing curve.\n if (supportsLinearEasing()) {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: `linear(${samples.join(', ')})` };\n }\n // Fallback: approximate the curve with interpolated keyframes.\n const props = Object.keys(preset.from).filter((p) => p in preset.to);\n const keyframes = samples.map((eased, i) => {\n const frame: Keyframe = { offset: i / EASING_SAMPLES };\n props.forEach((prop) => {\n frame[prop] = interpolateValue(preset.from[prop], preset.to[prop], eased);\n });\n return frame;\n });\n return { keyframes, easing: 'linear' };\n}\n\n/** Make an element visible without animating (reduced motion / disabled / no WAAPI). */\nfunction reveal(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '';\n }\n}\n\n/** @internal Cancel a running/pending animation and make the element visible. */\nexport function stopAnimation(el: Element, config: ScrollAnimateConfig = {}): void {\n reveal(el, { ...DEFAULT_CONFIG, ...config });\n}\n\n/** @internal Resolve a selector / Element / NodeList / Element[] to elements (SSR-safe). */\nexport { resolveTargets, hasDOM };\n\n/** @internal Whether animations should be skipped entirely. */\nexport function motionDisabled(config: Pick<ScrollAnimateConfig, 'disabled'>): boolean {\n return !!config.disabled || prefersReducedMotion();\n}\n\nfunction runAnimation(\n el: Element,\n opts: Required<AnimateOptions>,\n config: Required<ScrollAnimateConfig>,\n staggerIndex = 0,\n pending?: Set<Element>\n): void {\n const { duration, delay, stagger, onStart, onComplete } = opts;\n const totalDelay = Math.max(0, delay + staggerIndex * stagger);\n cancelRunning(el);\n\n if (motionDisabled(config)) {\n reveal(el, config);\n onStart(el);\n onComplete(el);\n return;\n }\n\n if (config.useClassNames) {\n if (totalDelay > 0) (el as HTMLElement).style.animationDelay = `${totalDelay}ms`;\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n onStart(el);\n pending?.add(el);\n timers.set(\n el,\n setTimeout(() => {\n timers.delete(el);\n pending?.delete(el);\n onComplete(el);\n }, duration + totalDelay)\n );\n return;\n }\n\n const preset = resolvePreset(opts.animation);\n // Presets that don't animate opacity (slide-*, clip-*, scale-x, ...) would\n // otherwise stay at the `opacity: 0` applied while waiting to enter.\n if (!('opacity' in preset.to)) {\n const style = (el as HTMLElement).style;\n if (style && style.opacity === '0') style.opacity = '';\n }\n\n if (typeof el.animate !== 'function') {\n setStyles(el, preset.to);\n onStart(el);\n onComplete(el);\n return;\n }\n\n const built = buildAnimation(preset, opts.easing);\n const timing: KeyframeAnimationOptions = { duration, delay: totalDelay, easing: built.easing, fill: 'both' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n // Invalid user easing string (WAAPI throws a TypeError): fall back to 'ease'\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n running.set(el, anim);\n onStart(el);\n anim.onfinish = () => {\n if (running.get(el) === anim) {\n running.delete(el);\n // Persist the end state inline and drop the filling animation. This frees\n // the Animation object and lets later inline styles (parallax, user code)\n // take effect instead of being masked by `fill: forwards`.\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n }\n onComplete(el);\n };\n}\n\n/**\n * Native engine: attach the preset to a `ViewTimeline` of the element, so the\n * browser drives it from scroll position. Returns `null` when that fails\n * (caller falls back to the JS engine).\n */\nfunction startNative(el: Element, opts: Required<AnimateOptions>, onFrozen?: () => void): Animation | null {\n if (typeof el.animate !== 'function') return null;\n const preset = resolvePreset(opts.animation);\n const built = buildAnimation(preset, opts.easing);\n let anim: Animation;\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = {\n fill: 'both',\n easing: built.easing,\n timeline,\n rangeStart: opts.viewRange[0],\n rangeEnd: opts.viewRange[1],\n } as KeyframeAnimationOptions;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'linear' });\n }\n } catch {\n return null;\n }\n running.set(el, anim);\n if (opts.exit) {\n // Reverse keyframes over the `exit` range; `fill: 'forwards'` so it has\n // no effect before the element starts leaving.\n const leave = resolvePreset(opts.exit === true ? opts.animation : opts.exit);\n const out = buildAnimation({ from: leave.to, to: leave.from }, opts.easing);\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = { fill: 'forwards', easing: out.easing, timeline, rangeStart: 'exit 0%', rangeEnd: 'exit 100%' };\n exits.set(el, el.animate(out.keyframes, timing as KeyframeAnimationOptions));\n } catch {\n // Exit is cosmetic: ignore if unsupported.\n }\n }\n const keep = opts.repeat || !opts.once;\n anim.onfinish = () => {\n // `once`: freeze the end state, so scrolling back up does not reverse it.\n if (!keep && running.get(el) === anim) {\n running.delete(el);\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n onFrozen?.();\n }\n opts.onComplete(el);\n };\n return anim;\n}\n\nfunction applyParallax(el: Element, progress: number, parallax: ParallaxOptions): void {\n const { x = 0, y = 0, rotate = 0, scale = 1, speed = 1 } = parallax;\n const p = (progress - 0.5) * 2 * speed;\n const axis = (v: string | number) => (typeof v === 'number' ? `${v * p}px` : `calc(${v} * ${p})`);\n\n let transform = '';\n if (x) transform += ` translateX(${axis(x)})`;\n if (y) transform += ` translateY(${axis(y)})`;\n if (rotate) transform += ` rotate(${rotate * p}deg)`;\n if (scale !== 1) transform += ` scale(${1 + (scale - 1) * p})`;\n\n (el as HTMLElement).style.transform = transform.trim();\n}\n\n/** Play the exit animation (entrance or `exit` preset, reversed), ending hidden. */\nfunction runExit(el: Element, opts: Required<AnimateOptions>, config: Required<ScrollAnimateConfig>): void {\n if (config.useClassNames || typeof el.animate !== 'function') {\n hideElement(el, config);\n return;\n }\n cancelRunning(el);\n const preset = resolvePreset(opts.exit === true ? opts.animation : (opts.exit as Exclude<typeof opts.exit, boolean>));\n const built = buildAnimation({ from: preset.to, to: preset.from }, opts.easing);\n const timing: KeyframeAnimationOptions = { duration: opts.duration, easing: built.easing, fill: 'forwards' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n // Kept (filling) until the next entrance cancels it.\n running.set(el, anim);\n}\n\nfunction hideElement(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.add(config.hiddenClass);\n el.classList.remove(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '0';\n }\n}\n\n/** @internal Hide an element before its entrance animation, unless motion is off. */\nexport function prepareElement(el: Element, config: ScrollAnimateConfig = {}): void {\n const full = { ...DEFAULT_CONFIG, ...config };\n if (!motionDisabled(full)) hideElement(el, full);\n}\n\nlet progressThresholds: number[] | undefined;\nfunction getProgressThresholds(): number[] {\n if (!progressThresholds) {\n progressThresholds = [];\n for (let i = 0; i <= 100; i++) progressThresholds.push(i / 100);\n }\n return progressThresholds;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/* ------------------------------------------------------------------ */\n/* Instance */\n/* ------------------------------------------------------------------ */\n\nexport function createScrollAnimate(userConfig: ScrollAnimateConfig = {}): ScrollAnimateInstance {\n let config: Required<ScrollAnimateConfig> = { ...DEFAULT_CONFIG, ...userConfig };\n const registry = new Map<Element, AnimatedElement>();\n // `once` elements that finished and were dropped from the registry (autoUnregister).\n let finished = new WeakSet<Element>();\n // Elements in `progressMode: 'scroll'` that are currently inside the viewport.\n const scrolling = new Set<Element>();\n let frame = 0;\n let listening: EventTarget | null = null;\n // Active watch() MutationObservers, disconnected by destroy().\n const watchers = new Set<MutationObserver>();\n // Elements with a pending class-name completion timer started by this instance.\n const pending = new Set<Element>();\n // Elements whose entrance runs on a native scroll-driven timeline.\n const natives = new Set<Element>();\n\n // Observers are shared between elements with the same root/threshold/rootMargin,\n // instead of one (or two) IntersectionObservers per element.\n const pools = new Map<Root, Map<string, IntersectionObserver>>();\n\n function pooled(root: Root, key: string, create: () => IntersectionObserver): IntersectionObserver {\n let pool = pools.get(root);\n if (!pool) pools.set(root, (pool = new Map()));\n let io = pool.get(key);\n if (!io) pool.set(key, (io = create()));\n return io;\n }\n\n function teardown(el: Element, restore: boolean): void {\n const record = registry.get(el);\n if (!record) return;\n record.observer.unobserve(el);\n record.progressObserver?.unobserve(el);\n registry.delete(el);\n untrack(el);\n if (record.engine === 'css') {\n // A scroll-linked animation would keep following the scroll: stop it and\n // show the element (unless it finished and is just being released).\n if (restore) {\n natives.delete(el);\n reveal(el, config);\n } else if (el.isConnected === false) {\n // Left the DOM: drop it too, or the instance keeps it alive (and\n // destroy() touches it) for its whole lifetime.\n natives.delete(el);\n }\n return;\n }\n // An element that never animated would otherwise stay invisible forever.\n if (restore && !record.animated) reveal(el, config);\n }\n\n function pruneDetached(): void {\n registry.forEach((record, el) => {\n if (el.isConnected === false) teardown(el, false);\n });\n }\n\n function emitProgress(el: Element, record: AnimatedElement, progress: number): void {\n const opts = record.options;\n opts.onProgress(el, progress);\n if (opts.progressVar) {\n const style = (el as HTMLElement).style;\n if (style) style.setProperty(opts.progressVar, String(+progress.toFixed(4)));\n }\n if (hasParallax(opts.parallax) && !motionDisabled(config)) applyParallax(el, progress, opts.parallax);\n }\n\n function update(): void {\n frame = 0;\n scrolling.forEach((el) => {\n const record = registry.get(el);\n if (record) emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n // rAF-throttled; IntersectionObserver-capable browsers all have rAF.\n const schedule = () => frame || (frame = requestAnimationFrame(update));\n\n function listen(on: boolean): void {\n if (on === !!listening) return;\n const method = on ? 'addEventListener' : 'removeEventListener';\n const target: EventTarget = listening || (config.root as EventTarget | null) || window;\n target[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n listening = on ? target : null;\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n }\n\n function untrack(el: Element): void {\n if (scrolling.delete(el) && !scrolling.size) listen(false);\n }\n\n function onScrollIntersect(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n if (entry.isIntersecting) {\n scrolling.add(el);\n listen(true);\n } else {\n untrack(el);\n }\n // Emit right away so the edges (0 / 1) are reported even on fast scrolls.\n emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n function onIntersect(entries: IntersectionObserverEntry[]): void {\n const staggerCounts = new Map<Element | null, number>();\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n const opts = record.options;\n\n if (el.isConnected === false) {\n teardown(el, false);\n return;\n }\n\n if (record.engine === 'css') {\n // The browser drives the animation; only lifecycle bookkeeping here.\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (!record.animated) {\n record.animated = true;\n opts.onStart(el);\n }\n if (opts.once && !opts.repeat) {\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat) record.animated = false;\n }\n return;\n }\n\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (record.animated && !opts.repeat) return;\n\n // Stagger relative to siblings revealed in the same batch, so elements\n // scrolled into view later don't inherit an ever-growing delay.\n let staggerIndex = 0;\n if (opts.stagger > 0) {\n const parent = el.parentElement;\n staggerIndex = staggerCounts.get(parent) ?? 0;\n staggerCounts.set(parent, staggerIndex + 1);\n }\n\n runAnimation(el, opts, config, staggerIndex, pending);\n record.animated = true;\n\n if (opts.once && !opts.repeat) {\n // Keep the progress observer: parallax/onProgress must keep working.\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n // Nothing left to watch: free the record (the running animation\n // keeps its own reference until it finishes).\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat && record.animated) {\n if (!motionDisabled(config)) {\n if (opts.exit) runExit(el, opts, config);\n else hideElement(el, config);\n }\n record.animated = false;\n }\n }\n });\n }\n\n function onProgress(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const record = registry.get(entry.target);\n if (!record) return;\n emitProgress(entry.target, record, entry.intersectionRatio);\n });\n }\n\n function getObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const rootMargin = applyOffset(opts.rootMargin, opts.offset);\n const threshold = opts.threshold;\n const root = config.root;\n return pooled(root, `m|${rootMargin}|${String(threshold)}`, () =>\n new IntersectionObserver(onIntersect, { threshold, rootMargin, root: root as Element | null })\n );\n }\n\n function getProgressObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const root = config.root;\n if (opts.progressMode === 'scroll') {\n // Only used to know when to start/stop measuring; progress itself comes\n // from a single shared, rAF-throttled passive scroll listener.\n return pooled(root, `s|${opts.rootMargin}`, () =>\n new IntersectionObserver(onScrollIntersect, { threshold: 0, rootMargin: opts.rootMargin, root: root as Element | null })\n );\n }\n return pooled(root, `p|${opts.rootMargin}`, () =>\n new IntersectionObserver(onProgress, {\n threshold: getProgressThresholds(),\n rootMargin: opts.rootMargin,\n root: root as Element | null,\n })\n );\n }\n\n function attach(el: Element, record: AnimatedElement, observeMain: boolean): void {\n record.observer = getObserver(record.options);\n if (observeMain) record.observer.observe(el);\n record.progressObserver = needsProgress(record.options) ? getProgressObserver(record.options) : undefined;\n record.progressObserver?.observe(el);\n }\n\n function wantsNative(opts: Required<AnimateOptions>): boolean {\n return opts.engine !== 'js' && !config.useClassNames && !motionDisabled(config) && supportsScrollTimeline();\n }\n\n function observeElement(el: Element, opts: Required<AnimateOptions>): void {\n if (registry.has(el) || finished.has(el)) return;\n\n if (!supportsObserver()) {\n // No IntersectionObserver (very old browser): never leave content hidden.\n reveal(el, config);\n return;\n }\n\n const record = { element: el, options: opts, animated: false, engine: 'js' } as AnimatedElement;\n if (wantsNative(opts)) {\n cancelRunning(el);\n if (startNative(el, opts, () => natives.delete(el))) {\n record.engine = 'css';\n natives.add(el);\n }\n }\n if (record.engine === 'js' && !motionDisabled(config)) hideElement(el, config);\n\n registry.set(el, record);\n attach(el, record, true);\n }\n\n function observeDataElement(el: Element): void {\n if (!registry.has(el)) observeElement(el, parseDataAttributes(el, config));\n }\n\n const instance: ScrollAnimateInstance = {\n observe(target, options = {}) {\n pruneDetached();\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => observeElement(el, opts));\n },\n\n unobserve(target) {\n resolveTargets(target).forEach((el) => {\n finished.delete(el);\n teardown(el, true);\n });\n },\n\n init(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope) return;\n pruneDetached();\n scope.querySelectorAll('[data-sa]').forEach(observeDataElement);\n },\n\n watch(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope || typeof MutationObserver === 'undefined') return noop;\n instance.init(scope);\n const observeTree = (node: Element) => {\n if (node.hasAttribute('data-sa')) observeDataElement(node);\n node.querySelectorAll('[data-sa]').forEach(observeDataElement);\n };\n const mo = new MutationObserver((records) => {\n let removed = false;\n records.forEach((record) => {\n if (record.type === 'attributes') {\n const target = record.target as Element;\n if (target.isConnected !== false) observeTree(target);\n return;\n }\n record.addedNodes.forEach((node) => {\n if (node instanceof Element && node.isConnected !== false) observeTree(node);\n });\n if (record.removedNodes.length) removed = true;\n });\n // Free elements that left the DOM (they can't animate any more).\n if (removed) pruneDetached();\n });\n mo.observe(scope, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-sa'] });\n watchers.add(mo);\n return () => {\n mo.disconnect();\n watchers.delete(mo);\n };\n },\n\n destroy() {\n watchers.forEach((mo) => mo.disconnect());\n watchers.clear();\n // Class-name mode: drop completion timers so onComplete never fires after destroy().\n pending.forEach((el) => {\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n });\n pending.clear();\n registry.forEach((record, el) => {\n if (!record.animated && record.engine !== 'css') reveal(el, config);\n });\n // Native scroll-linked animations still running: stop them, show content.\n natives.forEach((el) => {\n if (running.has(el)) reveal(el, config);\n });\n natives.clear();\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n registry.clear();\n scrolling.clear();\n listen(false);\n finished = new WeakSet();\n },\n\n refresh() {\n // Rebuild observers (e.g. after configure({ root })) without re-hiding or\n // replaying elements that have already animated.\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n scrolling.clear();\n listen(false);\n pruneDetached();\n if (!supportsObserver()) return;\n registry.forEach((record, el) => {\n const done = record.animated && record.options.once && !record.options.repeat;\n attach(el, record, !done);\n });\n },\n\n animate(target, options = {}) {\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => runAnimation(el, opts, config, 0, pending));\n },\n\n getObservedElements() {\n return Array.from(registry.values());\n },\n\n configure(newConfig) {\n config = { ...config, ...newConfig };\n },\n };\n\n return instance;\n}\n","/**\n * use-scroll-animate - Staggered children\n * Reveal a container's children one after another when the container scrolls\n * into view, optionally also animating children that are added later.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, stopAnimation, supportsObserver } from './core';\n\nexport interface StaggerOptions extends AnimateOptions {\n /** Delay between consecutive children in ms (default: 80) */\n stagger?: number;\n /**\n * Watch the container with a MutationObserver and animate children added\n * later (e.g. infinite lists). Children added after the container was\n * revealed animate when they scroll into view, staggered per batch.\n * (default: false)\n */\n observeChildren?: boolean;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\n/**\n * Animate the children of `container` with a stagger once it enters the\n * viewport. Returns a cleanup function. SSR-safe (no-op without a DOM).\n *\n * @example\n * const stop = staggerChildren(document.querySelector('ul'), { stagger: 60, observeChildren: true });\n */\nexport function staggerChildren(\n container: Element | null | undefined,\n options: StaggerOptions = {},\n instance?: ScrollAnimateInstance\n): () => void {\n if (!container || !hasDOM() || !supportsObserver()) return () => undefined; // leave content visible\n const sa = instance || fallback || (fallback = createScrollAnimate());\n const { stagger = 80, delay = 0, threshold = 0.1, rootMargin = '0px', observeChildren = false, ...rest } = options;\n\n let items = Array.from(container.children);\n let revealed = false;\n const late: Element[] = [];\n items.forEach((child) => prepareElement(child));\n\n const io = new IntersectionObserver(\n (entries) => {\n if (revealed || !entries.some((entry) => entry.isIntersecting)) return;\n revealed = true;\n io.disconnect();\n items.forEach((child, i) => {\n if (child.parentNode === container) sa.animate(child, { ...rest, delay: delay + i * stagger });\n });\n items = [];\n },\n { threshold, rootMargin }\n );\n io.observe(container);\n\n let mo: MutationObserver | undefined;\n if (observeChildren && typeof MutationObserver !== 'undefined') {\n mo = new MutationObserver((records) => {\n records.forEach((record) => {\n record.addedNodes.forEach((node) => {\n if (!(node instanceof Element) || node.parentNode !== container) return;\n if (!revealed) {\n prepareElement(node);\n items.push(node);\n } else {\n // The core engine staggers siblings relative to the batch that\n // enters the viewport together.\n late.push(node);\n sa.observe(node, { ...rest, delay, stagger, threshold, rootMargin });\n }\n });\n record.removedNodes.forEach((node) => {\n if (!(node instanceof Element)) return;\n items = items.filter((el) => el !== node);\n const i = late.indexOf(node);\n if (i >= 0) {\n late.splice(i, 1);\n sa.unobserve(node);\n }\n });\n });\n });\n mo.observe(container, { childList: true });\n }\n\n return () => {\n io.disconnect();\n mo?.disconnect();\n // Stopped before the container was revealed: never leave the children hidden.\n if (!revealed) {\n revealed = true;\n items.forEach((child) => stopAnimation(child));\n items = [];\n }\n late.forEach((el) => sa.unobserve(el));\n late.length = 0;\n };\n}\n","/**\n * use-scroll-animate - Sequence / timeline helper\n * Chain animations on several targets, one after another (or overlapping).\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, resolveTargets, stopAnimation, supportsObserver } from './core';\n\nexport interface SequenceStep extends AnimateOptions {\n /** Selector, Element, NodeList or Element[] to animate in this step */\n target: string | Element | NodeList | Element[];\n /** Pause (ms) after the previous step ends before this one starts. Negative values overlap. (default: 0) */\n gap?: number;\n /** Absolute start time (ms) on the timeline; overrides `gap` */\n at?: number;\n}\n\nexport interface SequenceOptions extends AnimateOptions {\n /** Play automatically (once) when this element/selector enters the viewport */\n trigger?: string | Element;\n /** Instance whose global config (easing, classes, `disabled`) is used */\n instance?: ScrollAnimateInstance;\n}\n\nexport interface SequenceController {\n /** Play (or replay) the timeline. Resolves when every step has completed, or on `cancel()`. */\n play(): Promise<void>;\n /** Stop the trigger and running animations; elements are left visible. */\n cancel(): void;\n /** Total duration of the timeline in ms (computed for the current DOM). */\n duration(): number;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\ntype Planned = { el: Element; opts: AnimateOptions; end: number };\n\nfunction plan(steps: SequenceStep[], defaults: AnimateOptions): Planned[] {\n const out: Planned[] = [];\n let cursor = 0;\n steps.forEach((step) => {\n const { target, gap = 0, at, ...stepOpts } = step;\n const opts = { ...defaults, ...stepOpts };\n const duration = opts.duration ?? 600;\n const start = Math.max(0, at ?? cursor + gap) + (opts.delay ?? 0);\n let end = Math.max(cursor, start);\n resolveTargets(target).forEach((el, i) => {\n const delay = start + i * (opts.stagger ?? 0);\n out.push({ el, opts: { ...opts, duration, delay, stagger: 0 }, end: delay + duration });\n end = Math.max(end, delay + duration);\n });\n cursor = end;\n });\n return out;\n}\n\n/**\n * Build a timeline of animations.\n *\n * @example\n * sequence([\n * { target: '.title', animation: 'fade-in-up' },\n * { target: '.subtitle', animation: 'blur-in', gap: -300 }, // overlap by 300ms\n * { target: '.card', animation: 'scale-up', stagger: 80 },\n * ], { trigger: '.hero' });\n */\nexport function sequence(steps: SequenceStep[], options: SequenceOptions = {}): SequenceController {\n const { trigger, instance, ...defaults } = options;\n const sa = () => instance || fallback || (fallback = createScrollAnimate());\n let io: IntersectionObserver | undefined;\n let active: Planned[] = [];\n let settle: (() => void) | undefined;\n // Targets hidden while waiting for `trigger`; revealed if cancelled before it fires.\n let prepared: Element[] = [];\n\n const controller: SequenceController = {\n play() {\n controller.cancel();\n if (!hasDOM()) return Promise.resolve();\n active = plan(steps, defaults);\n return new Promise<void>((resolve) => {\n let left = active.length;\n settle = () => {\n settle = undefined;\n resolve();\n };\n if (!left) return settle();\n const run = active;\n run.forEach(({ el, opts }) => {\n const done = opts.onComplete;\n sa().animate(el, {\n ...opts,\n onComplete: (node) => {\n done?.(node);\n if (run === active && --left === 0) settle?.();\n },\n });\n });\n });\n },\n\n cancel() {\n io?.disconnect();\n io = undefined;\n prepared.forEach((el) => stopAnimation(el));\n prepared = [];\n active.forEach(({ el }) => stopAnimation(el));\n active = [];\n settle?.();\n },\n\n duration() {\n return plan(steps, defaults).reduce((max, p) => Math.max(max, p.end), 0);\n },\n };\n\n if (trigger && hasDOM() && supportsObserver()) {\n const el = resolveTargets(trigger)[0];\n if (el) {\n prepared = plan(steps, defaults).map(({ el: target }) => target);\n prepared.forEach((target) => prepareElement(target));\n io = new IntersectionObserver(\n (entries) => {\n if (!entries.some((e) => e.isIntersecting)) return;\n io?.disconnect();\n io = undefined;\n prepared = []; // play() takes over from here\n controller.play();\n },\n { threshold: defaults.threshold ?? 0.1, rootMargin: defaults.rootMargin ?? '0px' }\n );\n io.observe(el);\n }\n }\n\n return controller;\n}\n","/**\n * use-scroll-animate - parallax() helper\n *\n * Moves elements at a different speed than the page while they cross the\n * viewport. Built on the same scroll progress as `progressVar` (0 when the\n * element's top enters at the bottom, 1 when its bottom leaves at the top):\n * the progress is written to a CSS custom property (default `--sa-parallax`)\n * and the offset is applied with the individual `translate` property, so it\n * composes with entrance animations and other `transform`s.\n */\n\nimport { getScrollProgress, hasDOM, prefersReducedMotion, resolveTargets, supportsObserver } from './core';\n\nexport interface ParallaxHelperOptions {\n /**\n * Total distance the element shifts while it crosses the viewport, as a\n * fraction of the viewport size (`0.2` = 20vh on the y axis). Positive values\n * lag behind the scroll (background-like), negative values move ahead of it\n * (foreground-like). (default: `0.2`)\n */\n speed?: number;\n /** `'y'` (default) or `'x'` (horizontal drift, in `vw`) */\n axis?: 'x' | 'y';\n /** CSS custom property receiving the progress (default: `'--sa-parallax'`) */\n progressVar?: string;\n /** Scroll container (default: the viewport) */\n root?: Element | null;\n /**\n * Under `prefers-reduced-motion: reduce` no offset is applied (the progress\n * variable is still written). Set to `false` to move anyway. (default: `true`)\n */\n respectReducedMotion?: boolean;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/**\n * Apply a scroll parallax to `target` (selector, Element, NodeList or array).\n * Returns a function that stops it and removes the inline styles it set.\n * SSR-safe (no-op without a DOM / IntersectionObserver).\n *\n * @example\n * const stop = parallax('.hero-bg', { speed: 0.3 });\n * parallax('.badge', { speed: -0.15, axis: 'x' });\n */\nexport function parallax(\n target: string | Element | NodeList | Element[],\n options: ParallaxHelperOptions = {}\n): () => void {\n const els = resolveTargets(target);\n if (!els.length || !hasDOM() || !supportsObserver()) return () => undefined;\n const { speed = 0.2, axis = 'y', root = null, respectReducedMotion = true } = options;\n const name = options.progressVar ? (options.progressVar.startsWith('--') ? options.progressVar : `--${options.progressVar}`) : '--sa-parallax';\n const unit = axis === 'x' ? 'vw' : 'vh';\n const visible = new Set<Element>();\n let frame = 0;\n let listening = false;\n const scroller: EventTarget = root || window;\n\n const apply = (el: Element) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n const p = getScrollProgress(el, root);\n style.setProperty(name, String(+p.toFixed(4)));\n if (respectReducedMotion && prefersReducedMotion()) {\n style.removeProperty('translate');\n return;\n }\n const offset = `${+((p - 0.5) * speed * 100).toFixed(3)}${unit}`;\n style.setProperty('translate', axis === 'x' ? `${offset} 0px` : `0px ${offset}`);\n };\n\n const update = () => {\n frame = 0;\n visible.forEach(apply);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n const listen = (on: boolean) => {\n if (on === listening) return;\n listening = on;\n const method = on ? 'addEventListener' : 'removeEventListener';\n scroller[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n };\n\n const io = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) visible.add(entry.target);\n else visible.delete(entry.target);\n apply(entry.target); // report the edges even on fast scrolls\n });\n listen(visible.size > 0);\n },\n { threshold: 0, root }\n );\n els.forEach((el) => {\n apply(el); // no jump before the first observer callback\n io.observe(el);\n });\n\n return () => {\n io.disconnect();\n listen(false);\n visible.clear();\n els.forEach((el) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n style.removeProperty('translate');\n style.removeProperty(name);\n });\n };\n}\n","/**\n * use-scroll-animate\n *\n * A lightweight, dependency-free scroll animation library for modern web\n * applications. Built with TypeScript, powered by IntersectionObserver and\n * the Web Animations API (or the native scroll-driven timeline). Safe to\n * import during SSR. Framework integrations live in the subpath entries:\n * `use-scroll-animate/react`, `/vue`, `/svelte`, `/solid`, `/element`.\n *\n * @license MIT\n * @see https://github.com/HarrisonCN/use-scroll-animate\n */\n\nexport { createScrollAnimate, getScrollProgress, supportsScrollTimeline } from './core';\nexport { staggerChildren } from './stagger';\nexport { sequence } from './sequence';\nexport { parallax } from './parallax';\nexport { PRESETS, resolvePreset, resolveEasing, EASING_MAP } from './presets';\nexport type {\n AnimationPreset,\n EasingType,\n AnimationKeyframe,\n CustomAnimation,\n ParallaxOptions,\n ProgressMode,\n ScrollEngine,\n AnimateOptions,\n ScrollAnimateConfig,\n AnimatedElement,\n ScrollAnimateInstance,\n} from './types';\nexport type { StaggerOptions } from './stagger';\nexport type { ParallaxHelperOptions } from './parallax';\nexport type { SequenceStep, SequenceOptions, SequenceController } from './sequence';\n\n// Default export: a ready-to-use singleton instance\nimport { createScrollAnimate } from './core';\n\n/**\n * Default singleton instance of ScrollAnimate.\n * Ready to use out of the box with sensible defaults.\n *\n * @example\n * ```js\n * import ScrollAnimate from 'use-scroll-animate';\n *\n * // Auto-initialize all elements with data-sa attribute\n * ScrollAnimate.init();\n *\n * // Or manually observe elements\n * ScrollAnimate.observe('.my-element', { animation: 'fade-in-up' });\n * ```\n */\nconst ScrollAnimate = /* @__PURE__ */ createScrollAnimate();\nexport default ScrollAnimate;\n"],"names":["PRESETS","from","opacity","to","transform","bounce","filter","shimmer","pulse","swing","clipPath","resolvePreset","animation","trim","Array","isArray","combined","forEach","name","preset","Object","entries","key","val","EASING_MAP","linear","ease","spring","resolveEasing","easing","join","DEFAULT_CONFIG","defaultAnimation","defaultDuration","defaultDelay","defaultEasing","defaultThreshold","defaultRootMargin","defaultRepeat","defaultOnce","defaultOffset","hiddenClass","visibleClass","useClassNames","disabled","root","autoUnregister","defaultEngine","noop","hasDOM","window","document","supportsObserver","IntersectionObserver","reducedMotionQuery","scrollTimelineSupported","prefersReducedMotion","undefined","matchMedia","matches","supportsScrollTimeline","CSS","supports","globalThis","ViewTimeline","num","value","n","parseFloat","Number","isFinite","lengthValue","v","test","DEFAULT_VIEW_RANGE","normalizeVar","startsWith","parseDataAttributes","el","config","mergeOptions","get","opts","anim","includes","split","map","s","duration","delay","e","JSON","parse","t","threshold","rootMargin","repeat","once","offset","stagger","progressVar","engine","range","start","end","viewRange","exit","progress","progressMode","px","py","pr","ps","parallax","x","y","rotate","scale","speed","keys","k","readOptions","getAttribute","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","hasParallax","p","some","getScrollProgress","rect","getBoundingClientRect","top","height","innerHeight","documentElement","clientHeight","r","total","running","WeakMap","exits","timers","cancelRunning","exitAnim","delete","cancel","onfinish","timer","clearTimeout","setStyles","styles","style","prop","String","NUM_UNIT","linearSupported","progressThresholds","buildAnimation","keyframes","samples","fn","values","i","push","toFixed","sampleEasing","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","stopAnimation","motionDisabled","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","prepareElement","full","getProgressThresholds","PASSIVE","passive","createScrollAnimate","userConfig","registry","Map","finished","WeakSet","scrolling","Set","listening","watchers","natives","pools","pooled","create","pool","io","teardown","restore","record","observer","unobserve","progressObserver","untrack","animated","isConnected","pruneDetached","emitProgress","options","setProperty","axis","applyParallax","update","schedule","requestAnimationFrame","listen","on","method","cancelAnimationFrame","size","onScrollIntersect","entry","isIntersecting","onIntersect","staggerCounts","parent","parentElement","runExit","intersectionRatio","getObserver","parts","right","bottom","left","m","exec","applyOffset","attach","observeMain","observe","getProgressObserver","observeElement","has","element","wantsNative","onFrozen","timeline","subject","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","instance","init","rootElement","scope","watch","MutationObserver","observeTree","node","hasAttribute","mo","records","removed","type","addedNodes","removedNodes","childList","subtree","attributes","attributeFilter","disconnect","destroy","clear","refresh","getObservedElements","configure","newConfig","fallback","plan","steps","defaults","cursor","step","gap","at","stepOpts","ScrollAnimate","els","respectReducedMotion","visible","scroller","apply","removeProperty","trigger","settle","active","prepared","controller","play","Promise","resolve","run","done","reduce","container","sa","observeChildren","rest","items","children","revealed","late","child","parentNode","indexOf","splice"],"mappings":"oPAYO,MAAMA,EAAgD,CAC3D,UAAW,CACTC,KAAM,CAAEC,QAAS,GACjBC,GAAI,CAAED,QAAS,IAEjB,aAAc,CACZD,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,gBAAiB,CACfH,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,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|
+
var core = require('./chunks/core-B_J4rXbC.cjs');
|
|
4
|
+
var stagger = require('./chunks/stagger-DHw0ExuR.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* use-scroll-animate - React Integration
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
2
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
1
|
+
import { c as createScrollAnimate } from './chunks/core-BP-a1iNc.js';
|
|
2
|
+
import { s as staggerChildren } from './chunks/stagger-DTv_WiUQ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* use-scroll-animate - React Integration
|
package/dist/solid.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
|
-
var core = require('./chunks/core-
|
|
5
|
-
var stagger = require('./chunks/stagger-
|
|
4
|
+
var core = require('./chunks/core-B_J4rXbC.cjs');
|
|
5
|
+
var stagger = require('./chunks/stagger-DHw0ExuR.cjs');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* use-scroll-animate - Solid integration
|
package/dist/solid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onMount, onCleanup } from 'solid-js';
|
|
2
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
3
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
2
|
+
import { c as createScrollAnimate } from './chunks/core-BP-a1iNc.js';
|
|
3
|
+
import { s as staggerChildren } from './chunks/stagger-DTv_WiUQ.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* use-scroll-animate - Solid integration
|
package/dist/svelte.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var core = require('./chunks/core-
|
|
4
|
-
var stagger = require('./chunks/stagger-
|
|
3
|
+
var core = require('./chunks/core-B_J4rXbC.cjs');
|
|
4
|
+
var stagger = require('./chunks/stagger-DHw0ExuR.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* use-scroll-animate - Svelte integration
|