use-scroll-animate 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -0
- package/README_zh.md +2 -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/docs/images/showcase-detail.png +0 -0
- package/docs/images/showcase-grid.png +0 -0
- package/docs/images/showcase-mobile.png +0 -0
- 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/element.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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).ScrollAnimateElement={})}(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 n=t[e.trim()];n&&(Object.entries(n.from).forEach(([e,t])=>{"transform"===e&&r.from[e]?r.from[e]=`${r.from[e]} ${t}`:r.from[e]=t}),Object.entries(n.to).forEach(([e,t])=>{"transform"===e&&r.to[e]?r.to[e]=`${r.to[e]} ${t}`:r.to[e]=t}))}),r}return e}const n={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 o(e){return"string"==typeof e?n[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(e){if(void 0===e||""===e.trim())return;const t=parseFloat(e);return Number.isFinite(t)?t:void 0}function p(e){if(void 0===e||""===e.trim())return;const t=e.trim();return/^-?(\d+\.?\d*|\.\d+)$/.test(t)?parseFloat(t):t}const u=["entry 0%","entry 100%"];function m(e){const t=e.trim();return t?t.startsWith("--")?t:`--${t}`:"--sa-progress"}function g(e){const t={},r=e("animation");r&&(t.animation=r.includes(",")?r.split(",").map(e=>e.trim()):r.trim()),t.duration=d(e("duration")),t.delay=d(e("delay"));const n=e("easing");if(n){const e=n.trim();if(e.startsWith("["))try{t.easing=JSON.parse(e)}catch{}else t.easing=e}const o=e("threshold");o&&(t.threshold=o.includes(",")?o.split(",").map(parseFloat).filter(Number.isFinite):d(o));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=d(e("offset")),t.stagger=d(e("stagger"));const c=e("progress-var");void 0!==c&&(t.progressVar=m(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 u=e("exit");if(void 0!==u){const e=u.trim();t.exit=""===e||"true"===e||"false"!==e&&(e.includes(",")?e.split(",").map(e=>e.trim()):e)}const g=e("progress");g&&(t.progressMode="scroll"===g.trim()?"scroll":"ratio");const h=e("parallax-x"),y=e("parallax-y"),v=e("parallax-rotate"),b=e("parallax-scale");return(h||y||v||b)&&(t.parallax={x:p(h),y:p(y),rotate:d(v),scale:d(b),speed:d(e("parallax-speed"))??1}),Object.keys(t).forEach(e=>void 0===t[e]&&delete t[e]),t}function h(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 n=e.exit??!1,o=e.repeat??(!!n||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:o,once:e.once??(!o&&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?m(e.progressVar):"",engine:r,viewRange:e.viewRange??u,exit:n}}function y(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 v(e){return!!e&&Object.keys(e).some(t=>void 0!==e[t])}function b(e,t){if(!i())return 0;const r=e.getBoundingClientRect();let n=0,o=window.innerHeight||document.documentElement.clientHeight||0;if(t){const e=t.getBoundingClientRect();n=e.top,o=e.height}const a=o+r.height;if(a<=0)return 0;const s=(n+o-r.top)/a;return s<0?0:s>1?1:s}const x=new WeakMap,E=new WeakMap,w=new WeakMap;function S(e){const t=E.get(e);t&&(E.delete(e),t.cancel());const r=x.get(e);r&&(x.delete(e),r.onfinish=null,r.cancel());const n=w.get(e);void 0!==n&&(clearTimeout(n),w.delete(e))}function C(e,t){const r=e.style;r&&Object.keys(t).forEach(e=>{r[e]=String(t[e])})}const M=/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)/gi;let k,$;function A(e,t){if("function"!=typeof t)return{keyframes:[e.from,e.to],easing:o(t)};const r=function(e){const t=[];for(let r=0;r<=30;r++){const n=e(r/30);t.push(Number.isFinite(n)?+n.toFixed(4):r/30)}return t}(t);if(void 0===k&&(k="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timing-function","linear(0, 1)")),k)return{keyframes:[e.from,e.to],easing:`linear(${r.join(", ")})`};const n=Object.keys(e.from).filter(t=>t in e.to);return{keyframes:r.map((t,r)=>{const o={offset:r/30};return n.forEach(r=>{o[r]=function(e,t,r){if("number"==typeof e&&"number"==typeof t)return e+(t-e)*r;const n=String(e),o=String(t),a=[],s=[],i=n.replace(M,(e,t,r)=>(a.push([parseFloat(t),r]),"#"));if(i!==o.replace(M,(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],[n,o]=s[c++];t!==o&&0!==e&&0!==n&&t&&o&&(l=!1);const i=t||o;return`${+(e+(n-e)*r).toFixed(4)}${i}`});return l?f:r<.5?e:t}(e.from[r],e.to[r],t)}),o}),easing:"linear"}}function X(e,t){if(S(e),t.useClassNames)e.classList.remove(t.hiddenClass),e.classList.add(t.visibleClass);else{const t=e.style;t&&(t.opacity="")}}function O(e){return!!e.disabled||!!i()&&(void 0===l&&(l="function"==typeof window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)"):null),!!l&&l.matches)}function L(e,t,n,o=0,a){const{duration:s,delay:i,stagger:c,onStart:l,onComplete:f}=t,d=Math.max(0,i+o*c);if(S(e),O(n))return X(e,n),l(e),void f(e);if(n.useClassNames)return d>0&&(e.style.animationDelay=`${d}ms`),e.classList.remove(n.hiddenClass),e.classList.add(n.visibleClass),l(e),a?.add(e),void w.set(e,setTimeout(()=>{w.delete(e),a?.delete(e),f(e)},s+d));const p=r(t.animation);if(!("opacity"in p.to)){const t=e.style;t&&"0"===t.opacity&&(t.opacity="")}if("function"!=typeof e.animate)return C(e,p.to),l(e),void f(e);const u=A(p,t.easing),m={duration:s,delay:d,easing:u.easing,fill:"both"};let g;try{g=e.animate(u.keyframes,m)}catch{g=e.animate(u.keyframes,{...m,easing:"ease"})}x.set(e,g),l(e),g.onfinish=()=>{if(x.get(e)===g){x.delete(e);try{g.commitStyles()}catch{C(e,p.to)}g.cancel()}f(e)}}function Y(e,t){if(S(e),t.useClassNames)e.classList.add(t.hiddenClass),e.classList.remove(t.visibleClass);else{const t=e.style;t&&(t.opacity="0")}}function j(){if(!$){$=[];for(let e=0;e<=100;e++)$.push(e/100)}return $}const P={passive:!0};function T(e={}){let t={...a,...e};const n=new Map;let o=new WeakSet;const l=new Set;let d=0,p=null;const u=new Set,m=new Set,M=new Set,k=new Map;function $(e,t,r){let n=k.get(e);n||k.set(e,n=new Map);let o=n.get(t);return o||n.set(t,o=r()),o}function T(e,r){const o=n.get(e);o&&(o.observer.unobserve(e),o.progressObserver?.unobserve(e),n.delete(e),I(e),"css"!==o.engine?r&&!o.animated&&X(e,t):r&&(M.delete(e),X(e,t)))}function F(){n.forEach((e,t)=>{!1===t.isConnected&&T(t,!1)})}function N(e,r,n){const o=r.options;if(o.onProgress(e,n),o.progressVar){const t=e.style;t&&t.setProperty(o.progressVar,String(+n.toFixed(4)))}v(o.parallax)&&!O(t)&&function(e,t,r){const{x:n=0,y:o=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="";n&&(f+=` translateX(${l(n)})`),o&&(f+=` translateY(${l(o)})`),a&&(f+=` rotate(${a*c}deg)`),1!==s&&(f+=` scale(${1+(s-1)*c})`),e.style.transform=f.trim()}(e,n,o.parallax)}function R(){d=0,l.forEach(e=>{const r=n.get(e);r&&N(e,r,b(e,t.root))})}const V=()=>d||(d=requestAnimationFrame(R));function z(e){if(e===!!p)return;const r=e?"addEventListener":"removeEventListener",n=p||t.root||window;n[r]("scroll",V,P),window[r]("resize",V,P),p=e?n:null,!e&&d&&(cancelAnimationFrame(d),d=0)}function I(e){l.delete(e)&&!l.size&&z(!1)}function W(e){e.forEach(e=>{const r=e.target,o=n.get(r);o&&(e.isIntersecting?(l.add(r),z(!0)):I(r),N(r,o,b(r,t.root)))})}function D(e){const a=new Map;e.forEach(e=>{const s=e.target,i=n.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)}L(s,c,t,e,m),i.animated=!0,c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(o.add(s),T(s,!1)))}else c.onLeave(s),c.repeat&&i.animated&&(O(t)||(c.exit?function(e,t,n){if(n.useClassNames||"function"!=typeof e.animate)return void Y(e,n);S(e);const o=r(!0===t.exit?t.animation:t.exit),a=A({from:o.to,to:o.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"})}x.set(e,i)}(s,c,t):Y(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&&(o.add(s),T(s,!1)))):(c.onLeave(s),c.repeat&&(i.animated=!1));else T(s,!1)})}function q(e){e.forEach(e=>{const t=n.get(e.target);t&&N(e.target,t,e.intersectionRatio)})}function H(e){const r=function(e,t){if(!t)return e;const r=(e||"0px").trim().split(/\s+/),n=r[0],o=r[1]??n,a=r[2]??n,s=r[3]??o,i=/^(-?\d*\.?\d+)(px)?$/.exec(a);return`${n} ${o} ${(i?parseFloat(i[1]):0)-t}px ${s}`}(e.rootMargin,e.offset),n=e.threshold,o=t.root;return $(o,`m|${r}|${String(n)}`,()=>new IntersectionObserver(D,{threshold:n,rootMargin:r,root:o}))}function U(e,r,n){var o;r.observer=H(r.options),n&&r.observer.observe(e),r.progressObserver=v((o=r.options).parallax)||o.onProgress!==s||o.progressVar?function(e){const r=t.root;return"scroll"===e.progressMode?$(r,`s|${e.rootMargin}`,()=>new IntersectionObserver(W,{threshold:0,rootMargin:e.rootMargin,root:r})):$(r,`p|${e.rootMargin}`,()=>new IntersectionObserver(q,{threshold:j(),rootMargin:e.rootMargin,root:r}))}(r.options):void 0,r.progressObserver?.observe(e)}function B(e){return"js"!==e.engine&&!t.useClassNames&&!O(t)&&(void 0===f&&(f=i()&&"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timeline: view()")&&"function"==typeof globalThis.ViewTimeline),f)}function J(e,a){if(n.has(e)||o.has(e))return;if(!c())return void X(e,t);const s={element:e,options:a,animated:!1,engine:"js"};B(a)&&(S(e),function(e,t,n){if("function"!=typeof e.animate)return null;const o=r(t.animation),a=A(o,t.easing);let s;try{const r=new globalThis.ViewTimeline({subject:e,axis:"block"}),n={fill:"both",easing:a.easing,timeline:r,rangeStart:t.viewRange[0],rangeEnd:t.viewRange[1]};try{s=e.animate(a.keyframes,n)}catch{s=e.animate(a.keyframes,{...n,easing:"linear"})}}catch{return null}if(x.set(e,s),t.exit){const n=r(!0===t.exit?t.animation:t.exit),o=A({from:n.to,to:n.from},t.easing);try{const t=new globalThis.ViewTimeline({subject:e,axis:"block"}),r={fill:"forwards",easing:o.easing,timeline:t,rangeStart:"exit 0%",rangeEnd:"exit 100%"};E.set(e,e.animate(o.keyframes,r))}catch{}}const i=t.repeat||!t.once;return s.onfinish=()=>{if(!i&&x.get(e)===s){x.delete(e);try{s.commitStyles()}catch{C(e,o.to)}s.cancel(),n?.()}t.onComplete(e)},s}(e,a,()=>M.delete(e))&&(s.engine="css",M.add(e))),"js"!==s.engine||O(t)||Y(e,t),n.set(e,s),U(e,s,!0)}function G(e){n.has(e)||J(e,function(e,t){return h(g(t=>{const r=e.getAttribute(`data-sa-${t}`);return null===r?void 0:r}),t)}(e,t))}const K={observe(e,r={}){F();const n=h(r,t);y(e).forEach(e=>J(e,n))},unobserve(e){y(e).forEach(e=>{o.delete(e),T(e,!0)})},init(e){const t=e??(i()?document:null);t&&(F(),t.querySelectorAll("[data-sa]").forEach(G))},watch(e){const t=e??(i()?document:null);if(!t||"undefined"==typeof MutationObserver)return s;K.init(t);const r=e=>{e.hasAttribute("data-sa")&&G(e),e.querySelectorAll("[data-sa]").forEach(G)},n=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&&F()});return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sa"]}),u.add(n),()=>{n.disconnect(),u.delete(n)}},destroy(){u.forEach(e=>e.disconnect()),u.clear(),m.forEach(e=>{const t=w.get(e);void 0!==t&&(clearTimeout(t),w.delete(e))}),m.clear(),n.forEach((e,r)=>{e.animated||"css"===e.engine||X(r,t)}),M.forEach(e=>{x.has(e)&&X(e,t)}),M.clear(),k.forEach(e=>e.forEach(e=>e.disconnect())),k.clear(),n.clear(),l.clear(),z(!1),o=new WeakSet},refresh(){k.forEach(e=>e.forEach(e=>e.disconnect())),k.clear(),l.clear(),z(!1),F(),c()&&n.forEach((e,t)=>{U(t,e,!(e.animated&&e.options.once&&!e.options.repeat))})},animate(e,r={}){const n=h(r,t);y(e).forEach(e=>L(e,n,t,0,m))},getObservedElements:()=>Array.from(n.values()),configure(e){t={...t,...e}}};return K}const F=["animation","duration","delay","easing","threshold","root-margin","offset","once","repeat","stagger","engine","view-range","progress","progress-var","exit","parallax-x","parallax-y","parallax-rotate","parallax-scale","parallax-speed"];let N=null;function R(e="scroll-animate",t){if("undefined"==typeof customElements||"undefined"==typeof HTMLElement)return;const r=customElements.get(e);if(r)return r;const n=()=>t||N||(N=T());class o extends HTMLElement{constructor(){super(...arguments),this.observing=!1}static get observedAttributes(){return F}emit(e,t){this.dispatchEvent(new CustomEvent(`sa:${e}`,{detail:t}))}get options(){return{...g(e=>{const t=this.getAttribute(e);return null===t?void 0:t}),onEnter:()=>this.emit("enter"),onLeave:()=>this.emit("leave"),onStart:()=>this.emit("start"),onComplete:()=>this.emit("complete"),...this.hasAttribute("progress")||this.hasAttribute("progress-var")?{onProgress:(e,t)=>this.emit("progress",{progress:t})}:{}}}connectedCallback(){this.style.display||"function"!=typeof getComputedStyle||"inline"!==(getComputedStyle(this).display||"inline")||(this.style.display="block"),n().observe(this,this.options),this.observing=!0}disconnectedCallback(){n().unobserve(this),this.observing=!1}attributeChangedCallback(){if(!this.observing)return;const e=n(),t=e.getObservedElements().find(e=>e.element===this);t&&!t.animated&&(e.unobserve(this),e.observe(this,this.options))}}return customElements.define(e,o),o}R(),e.defineScrollAnimate=R});
|
|
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).ScrollAnimateElement={})}(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 n(e){if("string"==typeof e)return t[e.trim()]??t["fade-in-up"];if(Array.isArray(e)){const n={from:{},to:{}};return e.forEach(e=>{const r=t[e.trim()];r&&(Object.entries(r.from).forEach(([e,t])=>{"transform"===e&&n.from[e]?n.from[e]=`${n.from[e]} ${t}`:n.from[e]=t}),Object.entries(r.to).forEach(([e,t])=>{"transform"===e&&n.to[e]?n.to[e]=`${n.to[e]} ${t}`:n.to[e]=t}))}),n}return e}const r={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 o(e){return"string"==typeof e?r[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(e){if(void 0===e||""===e.trim())return;const t=parseFloat(e);return Number.isFinite(t)?t:void 0}function p(e){if(void 0===e||""===e.trim())return;const t=e.trim();return/^-?(\d+\.?\d*|\.\d+)$/.test(t)?parseFloat(t):t}const u=["entry 0%","entry 100%"];function m(e){const t=e.trim();return t?t.startsWith("--")?t:`--${t}`:"--sa-progress"}function g(e){const t={},n=e("animation");n&&(t.animation=n.includes(",")?n.split(",").map(e=>e.trim()):n.trim()),t.duration=d(e("duration")),t.delay=d(e("delay"));const r=e("easing");if(r){const e=r.trim();if(e.startsWith("["))try{t.easing=JSON.parse(e)}catch{}else t.easing=e}const o=e("threshold");o&&(t.threshold=o.includes(",")?o.split(",").map(parseFloat).filter(Number.isFinite):d(o));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=d(e("offset")),t.stagger=d(e("stagger"));const c=e("progress-var");void 0!==c&&(t.progressVar=m(c));const l=e("engine")?.trim();"auto"!==l&&"js"!==l&&"css"!==l||(t.engine=l);const f=e("view-range");if(f){const[e,n]=f.split(",").map(e=>e.trim());e&&n&&(t.viewRange=[e,n])}const u=e("exit");if(void 0!==u){const e=u.trim();t.exit=""===e||"true"===e||"false"!==e&&(e.includes(",")?e.split(",").map(e=>e.trim()):e)}const g=e("progress");g&&(t.progressMode="scroll"===g.trim()?"scroll":"ratio");const h=e("parallax-x"),y=e("parallax-y"),v=e("parallax-rotate"),b=e("parallax-scale");return(h||y||v||b)&&(t.parallax={x:p(h),y:p(y),rotate:d(v),scale:d(b),speed:d(e("parallax-speed"))??1}),Object.keys(t).forEach(e=>void 0===t[e]&&delete t[e]),t}function h(e,t){let n=e.engine??t.defaultEngine;"auto"===n&&(void 0!==e.duration||void 0!==e.delay||void 0!==e.offset||(e.stagger??0)>0)&&(n="js");const r=e.exit??!1,o=e.repeat??(!!r||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:o,once:e.once??(!o&&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?m(e.progressVar):"",engine:n,viewRange:e.viewRange??u,exit:r}}function y(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 v(e){return!!e&&Object.keys(e).some(t=>void 0!==e[t])}function b(e,t){if(!i())return 0;const n=e.getBoundingClientRect();let r=0,o=window.innerHeight||document.documentElement.clientHeight||0;if(t){const e=t.getBoundingClientRect();r=e.top,o=e.height}const a=o+n.height;if(a<=0)return 0;const s=(r+o-n.top)/a;return s<0?0:s>1?1:s}const x=new WeakMap,E=new WeakMap,w=new WeakMap;function S(e){const t=E.get(e);t&&(E.delete(e),t.cancel());const n=x.get(e);n&&(x.delete(e),n.onfinish=null,n.cancel());const r=w.get(e);void 0!==r&&(clearTimeout(r),w.delete(e))}function C(e,t){const n=e.style;n&&Object.keys(t).forEach(e=>{n[e]=String(t[e])})}const M=/(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)/gi;let k,$;function A(e,t){if("function"!=typeof t)return{keyframes:[e.from,e.to],easing:o(t)};const n=function(e){const t=[];for(let n=0;n<=30;n++){const r=e(n/30);t.push(Number.isFinite(r)?+r.toFixed(4):n/30)}return t}(t);if(void 0===k&&(k="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timing-function","linear(0, 1)")),k)return{keyframes:[e.from,e.to],easing:`linear(${n.join(", ")})`};const r=Object.keys(e.from).filter(t=>t in e.to);return{keyframes:n.map((t,n)=>{const o={offset:n/30};return r.forEach(n=>{o[n]=function(e,t,n){if("number"==typeof e&&"number"==typeof t)return e+(t-e)*n;const r=String(e),o=String(t),a=[],s=[],i=r.replace(M,(e,t,n)=>(a.push([parseFloat(t),n]),"#"));if(i!==o.replace(M,(e,t,n)=>(s.push([parseFloat(t),n]),"#"))||a.length!==s.length)return n<.5?e:t;let c=0,l=!0;const f=i.replace(/#/g,()=>{const[e,t]=a[c],[r,o]=s[c++];t!==o&&0!==e&&0!==r&&t&&o&&(l=!1);const i=t||o;return`${+(e+(r-e)*n).toFixed(4)}${i}`});return l?f:n<.5?e:t}(e.from[n],e.to[n],t)}),o}),easing:"linear"}}function X(e,t){if(S(e),t.useClassNames)e.classList.remove(t.hiddenClass),e.classList.add(t.visibleClass);else{const t=e.style;t&&(t.opacity="")}}function O(e){return!!e.disabled||!!i()&&(void 0===l&&(l="function"==typeof window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)"):null),!!l&&l.matches)}function L(e,t,r,o=0,a){const{duration:s,delay:i,stagger:c,onStart:l,onComplete:f}=t,d=Math.max(0,i+o*c);if(S(e),O(r))return X(e,r),l(e),void f(e);if(r.useClassNames)return d>0&&(e.style.animationDelay=`${d}ms`),e.classList.remove(r.hiddenClass),e.classList.add(r.visibleClass),l(e),a?.add(e),void w.set(e,setTimeout(()=>{w.delete(e),a?.delete(e),f(e)},s+d));const p=n(t.animation);if(!("opacity"in p.to)){const t=e.style;t&&"0"===t.opacity&&(t.opacity="")}if("function"!=typeof e.animate)return C(e,p.to),l(e),void f(e);const u=A(p,t.easing),m={duration:s,delay:d,easing:u.easing,fill:"both"};let g;try{g=e.animate(u.keyframes,m)}catch{g=e.animate(u.keyframes,{...m,easing:"ease"})}x.set(e,g),l(e),g.onfinish=()=>{if(x.get(e)===g){x.delete(e);try{g.commitStyles()}catch{C(e,p.to)}g.cancel()}f(e)}}function Y(e,t){if(S(e),t.useClassNames)e.classList.add(t.hiddenClass),e.classList.remove(t.visibleClass);else{const t=e.style;t&&(t.opacity="0")}}function j(){if(!$){$=[];for(let e=0;e<=100;e++)$.push(e/100)}return $}const P={passive:!0};function T(e={}){let t={...a,...e};const r=new Map;let o=new WeakSet;const l=new Set;let d=0,p=null;const u=new Set,m=new Set,M=new Set,k=new Map;function $(e,t,n){let r=k.get(e);r||k.set(e,r=new Map);let o=r.get(t);return o||r.set(t,o=n()),o}function T(e,n){const o=r.get(e);o&&(o.observer.unobserve(e),o.progressObserver?.unobserve(e),r.delete(e),I(e),"css"!==o.engine?n&&!o.animated&&X(e,t):n?(M.delete(e),X(e,t)):!1===e.isConnected&&M.delete(e))}function F(){r.forEach((e,t)=>{!1===t.isConnected&&T(t,!1)})}function N(e,n,r){const o=n.options;if(o.onProgress(e,r),o.progressVar){const t=e.style;t&&t.setProperty(o.progressVar,String(+r.toFixed(4)))}v(o.parallax)&&!O(t)&&function(e,t,n){const{x:r=0,y:o=0,rotate:a=0,scale:s=1,speed:i=1}=n,c=2*(t-.5)*i,l=e=>"number"==typeof e?e*c+"px":`calc(${e} * ${c})`;let f="";r&&(f+=` translateX(${l(r)})`),o&&(f+=` translateY(${l(o)})`),a&&(f+=` rotate(${a*c}deg)`),1!==s&&(f+=` scale(${1+(s-1)*c})`),e.style.transform=f.trim()}(e,r,o.parallax)}function R(){d=0,l.forEach(e=>{const n=r.get(e);n&&N(e,n,b(e,t.root))})}const V=()=>d||(d=requestAnimationFrame(R));function z(e){if(e===!!p)return;const n=e?"addEventListener":"removeEventListener",r=p||t.root||window;r[n]("scroll",V,P),window[n]("resize",V,P),p=e?r:null,!e&&d&&(cancelAnimationFrame(d),d=0)}function I(e){l.delete(e)&&!l.size&&z(!1)}function W(e){e.forEach(e=>{const n=e.target,o=r.get(n);o&&(e.isIntersecting?(l.add(n),z(!0)):I(n),N(n,o,b(n,t.root)))})}function D(e){const a=new Map;e.forEach(e=>{const s=e.target,i=r.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)}L(s,c,t,e,m),i.animated=!0,c.once&&!c.repeat&&(i.observer.unobserve(s),t.autoUnregister&&!i.progressObserver&&(o.add(s),T(s,!1)))}else c.onLeave(s),c.repeat&&i.animated&&(O(t)||(c.exit?function(e,t,r){if(r.useClassNames||"function"!=typeof e.animate)return void Y(e,r);S(e);const o=n(!0===t.exit?t.animation:t.exit),a=A({from:o.to,to:o.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"})}x.set(e,i)}(s,c,t):Y(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&&(o.add(s),T(s,!1)))):(c.onLeave(s),c.repeat&&(i.animated=!1));else T(s,!1)})}function q(e){e.forEach(e=>{const t=r.get(e.target);t&&N(e.target,t,e.intersectionRatio)})}function H(e){const n=function(e,t){if(!t)return e;const n=(e||"0px").trim().split(/\s+/),r=n[0],o=n[1]??r,a=n[2]??r,s=n[3]??o,i=/^(-?\d*\.?\d+)(px)?$/.exec(a);return`${r} ${o} ${(i?parseFloat(i[1]):0)-t}px ${s}`}(e.rootMargin,e.offset),r=e.threshold,o=t.root;return $(o,`m|${n}|${String(r)}`,()=>new IntersectionObserver(D,{threshold:r,rootMargin:n,root:o}))}function U(e,n,r){var o;n.observer=H(n.options),r&&n.observer.observe(e),n.progressObserver=v((o=n.options).parallax)||o.onProgress!==s||o.progressVar?function(e){const n=t.root;return"scroll"===e.progressMode?$(n,`s|${e.rootMargin}`,()=>new IntersectionObserver(W,{threshold:0,rootMargin:e.rootMargin,root:n})):$(n,`p|${e.rootMargin}`,()=>new IntersectionObserver(q,{threshold:j(),rootMargin:e.rootMargin,root:n}))}(n.options):void 0,n.progressObserver?.observe(e)}function B(e){return"js"!==e.engine&&!t.useClassNames&&!O(t)&&(void 0===f&&(f=i()&&"undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("animation-timeline: view()")&&"function"==typeof globalThis.ViewTimeline),f)}function J(e,a){if(r.has(e)||o.has(e))return;if(!c())return void X(e,t);const s={element:e,options:a,animated:!1,engine:"js"};B(a)&&(S(e),function(e,t,r){if("function"!=typeof e.animate)return null;const o=n(t.animation),a=A(o,t.easing);let s;try{const n=new globalThis.ViewTimeline({subject:e,axis:"block"}),r={fill:"both",easing:a.easing,timeline:n,rangeStart:t.viewRange[0],rangeEnd:t.viewRange[1]};try{s=e.animate(a.keyframes,r)}catch{s=e.animate(a.keyframes,{...r,easing:"linear"})}}catch{return null}if(x.set(e,s),t.exit){const r=n(!0===t.exit?t.animation:t.exit),o=A({from:r.to,to:r.from},t.easing);try{const t=new globalThis.ViewTimeline({subject:e,axis:"block"}),n={fill:"forwards",easing:o.easing,timeline:t,rangeStart:"exit 0%",rangeEnd:"exit 100%"};E.set(e,e.animate(o.keyframes,n))}catch{}}const i=t.repeat||!t.once;return s.onfinish=()=>{if(!i&&x.get(e)===s){x.delete(e);try{s.commitStyles()}catch{C(e,o.to)}s.cancel(),r?.()}t.onComplete(e)},s}(e,a,()=>M.delete(e))&&(s.engine="css",M.add(e))),"js"!==s.engine||O(t)||Y(e,t),r.set(e,s),U(e,s,!0)}function G(e){r.has(e)||J(e,function(e,t){return h(g(t=>{const n=e.getAttribute(`data-sa-${t}`);return null===n?void 0:n}),t)}(e,t))}const K={observe(e,n={}){F();const r=h(n,t);y(e).forEach(e=>J(e,r))},unobserve(e){y(e).forEach(e=>{o.delete(e),T(e,!0)})},init(e){const t=e??(i()?document:null);t&&(F(),t.querySelectorAll("[data-sa]").forEach(G))},watch(e){const t=e??(i()?document:null);if(!t||"undefined"==typeof MutationObserver)return s;K.init(t);const n=e=>{e.hasAttribute("data-sa")&&G(e),e.querySelectorAll("[data-sa]").forEach(G)},r=new MutationObserver(e=>{let t=!1;e.forEach(e=>{if("attributes"===e.type){const t=e.target;return void(!1!==t.isConnected&&n(t))}e.addedNodes.forEach(e=>{e instanceof Element&&!1!==e.isConnected&&n(e)}),e.removedNodes.length&&(t=!0)}),t&&F()});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-sa"]}),u.add(r),()=>{r.disconnect(),u.delete(r)}},destroy(){u.forEach(e=>e.disconnect()),u.clear(),m.forEach(e=>{const t=w.get(e);void 0!==t&&(clearTimeout(t),w.delete(e))}),m.clear(),r.forEach((e,n)=>{e.animated||"css"===e.engine||X(n,t)}),M.forEach(e=>{x.has(e)&&X(e,t)}),M.clear(),k.forEach(e=>e.forEach(e=>e.disconnect())),k.clear(),r.clear(),l.clear(),z(!1),o=new WeakSet},refresh(){k.forEach(e=>e.forEach(e=>e.disconnect())),k.clear(),l.clear(),z(!1),F(),c()&&r.forEach((e,t)=>{U(t,e,!(e.animated&&e.options.once&&!e.options.repeat))})},animate(e,n={}){const r=h(n,t);y(e).forEach(e=>L(e,r,t,0,m))},getObservedElements:()=>Array.from(r.values()),configure(e){t={...t,...e}}};return K}const F=["animation","duration","delay","easing","threshold","root-margin","offset","once","repeat","stagger","engine","view-range","progress","progress-var","exit","parallax-x","parallax-y","parallax-rotate","parallax-scale","parallax-speed"];let N=null;function R(e="scroll-animate",t){if("undefined"==typeof customElements||"undefined"==typeof HTMLElement)return;const n=customElements.get(e);if(n)return n;const r=()=>t||N||(N=T());class o extends HTMLElement{constructor(){super(...arguments),this.observing=!1}static get observedAttributes(){return F}emit(e,t){this.dispatchEvent(new CustomEvent(`sa:${e}`,{detail:t}))}get options(){return{...g(e=>{const t=this.getAttribute(e);return null===t?void 0:t}),onEnter:()=>this.emit("enter"),onLeave:()=>this.emit("leave"),onStart:()=>this.emit("start"),onComplete:()=>this.emit("complete"),...this.hasAttribute("progress")||this.hasAttribute("progress-var")?{onProgress:(e,t)=>this.emit("progress",{progress:t})}:{}}}connectedCallback(){this.style.display||"function"!=typeof getComputedStyle||"inline"!==(getComputedStyle(this).display||"inline")||(this.style.display="block"),r().observe(this,this.options),this.observing=!0}disconnectedCallback(){r().unobserve(this),this.observing=!1}attributeChangedCallback(){if(!this.observing)return;const e=r(),t=e.getObservedElements().find(e=>e.element===this);t&&!t.animated&&(e.unobserve(this),e.observe(this,this.options))}}return customElements.define(e,o),o}R(),e.defineScrollAnimate=R});
|
|
2
2
|
//# sourceMappingURL=element.umd.js.map
|
package/dist/element.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/element.ts","../src/element-auto.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 - `<scroll-animate>` Web Component\n *\n * ```html\n * <script type=\"module\">\n * import { defineScrollAnimate } from 'use-scroll-animate/element';\n * defineScrollAnimate(); // registers <scroll-animate>\n * </script>\n * <scroll-animate animation=\"fade-in-up\" duration=\"800\">…</scroll-animate>\n * ```\n *\n * Attributes mirror the `data-sa-*` attributes without the prefix\n * (`animation`, `duration`, `delay`, `easing`, `threshold`, `root-margin`,\n * `offset`, `once`, `repeat`, `engine`, `view-range`, `progress`,\n * `progress-var`, `exit`, `parallax-*`). The element dispatches `sa:enter`,\n * `sa:leave`, `sa:start`, `sa:complete` and `sa:progress` (`detail.progress`)\n * events. It renders as `display: block` unless styled otherwise.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, readOptions } from './core';\n\nconst ATTRIBUTES = [\n 'animation', 'duration', 'delay', 'easing', 'threshold', 'root-margin', 'offset', 'once', 'repeat',\n 'stagger', 'engine', 'view-range', 'progress', 'progress-var', 'exit',\n 'parallax-x', 'parallax-y', 'parallax-rotate', 'parallax-scale', 'parallax-speed',\n];\n\nlet shared: ScrollAnimateInstance | null = null;\n\n/**\n * Register the custom element (default tag `scroll-animate`) and return its\n * class. Safe to call more than once and on the server (returns `undefined`\n * without `customElements`).\n */\nexport function defineScrollAnimate(\n tagName = 'scroll-animate',\n instance?: ScrollAnimateInstance\n): CustomElementConstructor | undefined {\n if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined') return undefined;\n const existing = customElements.get(tagName);\n if (existing) return existing;\n const getInstance = () => instance || shared || (shared = createScrollAnimate());\n\n class ScrollAnimateElement extends HTMLElement {\n static get observedAttributes(): string[] {\n return ATTRIBUTES;\n }\n\n private observing = false;\n\n private emit(type: string, detail?: unknown): void {\n this.dispatchEvent(new CustomEvent(`sa:${type}`, { detail }));\n }\n\n /** Options parsed from the element's attributes (plus event callbacks). */\n get options(): AnimateOptions {\n const opts = readOptions((name) => {\n const v = this.getAttribute(name);\n return v === null ? undefined : v;\n });\n return {\n ...opts,\n onEnter: () => this.emit('enter'),\n onLeave: () => this.emit('leave'),\n onStart: () => this.emit('start'),\n onComplete: () => this.emit('complete'),\n ...(this.hasAttribute('progress') || this.hasAttribute('progress-var')\n ? { onProgress: (_el: Element, progress: number) => this.emit('progress', { progress }) }\n : {}),\n };\n }\n\n connectedCallback(): void {\n if (!this.style.display && typeof getComputedStyle === 'function' && (getComputedStyle(this).display || 'inline') === 'inline') {\n this.style.display = 'block';\n }\n getInstance().observe(this, this.options);\n this.observing = true;\n }\n\n disconnectedCallback(): void {\n getInstance().unobserve(this);\n this.observing = false;\n }\n\n attributeChangedCallback(): void {\n if (!this.observing) return;\n const sa = getInstance();\n const record = sa.getObservedElements().find((r) => r.element === this);\n // Already animated: keep it as it is (avoids re-hiding visible content).\n if (record && !record.animated) {\n sa.unobserve(this);\n sa.observe(this, this.options);\n }\n }\n }\n\n customElements.define(tagName, ScrollAnimateElement);\n return ScrollAnimateElement;\n}\n","// UMD/CDN build: registers <scroll-animate> as soon as the script loads.\nimport { defineScrollAnimate } from './element';\n\ndefineScrollAnimate();\nexport { defineScrollAnimate };\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","num","value","undefined","n","parseFloat","Number","isFinite","lengthValue","v","test","DEFAULT_VIEW_RANGE","normalizeVar","startsWith","readOptions","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","mergeOptions","config","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","el","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","CSS","supports","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","motionDisabled","matchMedia","matches","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","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","wantsNative","globalThis","ViewTimeline","observeElement","has","element","onFrozen","timeline","subject","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","getAttribute","parseDataAttributes","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","ATTRIBUTES","shared","defineScrollAnimate","tagName","customElements","HTMLElement","existing","getInstance","ScrollAnimateElement","constructor","this","observing","observedAttributes","emit","detail","dispatchEvent","CustomEvent","_el","connectedCallback","display","getComputedStyle","disconnectedCallback","attributeChangedCallback","sa","find","define"],"mappings":"2PAYO,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,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,WAAY,CACVH,KAAM,CAAEC,QAAS,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,SAAU,CACRH,KAAM,CAAEC,QAAS,EAAGE,UAAW,mBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,kBAE/B,SAAU,CACRH,KAAM,CAAEC,QAAS,EAAGE,UAAW,mBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,kBAE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,WAAY,CAAEvO,cAC1E,GAER,CAEA,iBAAA4O,GACOR,KAAK9K,MAAMuL,SAAuC,mBAArBC,kBAAoF,YAAhDA,iBAAiBV,MAAMS,SAAW,YACtGT,KAAK9K,MAAMuL,QAAU,SAEvBZ,IAAcpD,QAAQuD,KAAMA,KAAKtF,SACjCsF,KAAKC,WAAY,CACnB,CAEA,oBAAAU,GACEd,IAAc1F,UAAU6F,MACxBA,KAAKC,WAAY,CACnB,CAEA,wBAAAW,GACE,IAAKZ,KAAKC,UAAW,OACrB,MAAMY,EAAKhB,IACL5F,EAAS4G,EAAG1B,sBAAsB2B,KAAM3M,GAAMA,EAAE6I,UAAYgD,MAE9D/F,IAAWA,EAAOK,WACpBuG,EAAG1G,UAAU6F,MACba,EAAGpE,QAAQuD,KAAMA,KAAKtF,SAE1B,EAIF,OADAgF,eAAeqB,OAAOtB,EAASK,GACxBA,CACT,CCjGAN"}
|
|
1
|
+
{"version":3,"file":"element.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/element.ts","../src/element-auto.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 - `<scroll-animate>` Web Component\n *\n * ```html\n * <script type=\"module\">\n * import { defineScrollAnimate } from 'use-scroll-animate/element';\n * defineScrollAnimate(); // registers <scroll-animate>\n * </script>\n * <scroll-animate animation=\"fade-in-up\" duration=\"800\">…</scroll-animate>\n * ```\n *\n * Attributes mirror the `data-sa-*` attributes without the prefix\n * (`animation`, `duration`, `delay`, `easing`, `threshold`, `root-margin`,\n * `offset`, `once`, `repeat`, `engine`, `view-range`, `progress`,\n * `progress-var`, `exit`, `parallax-*`). The element dispatches `sa:enter`,\n * `sa:leave`, `sa:start`, `sa:complete` and `sa:progress` (`detail.progress`)\n * events. It renders as `display: block` unless styled otherwise.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, readOptions } from './core';\n\nconst ATTRIBUTES = [\n 'animation', 'duration', 'delay', 'easing', 'threshold', 'root-margin', 'offset', 'once', 'repeat',\n 'stagger', 'engine', 'view-range', 'progress', 'progress-var', 'exit',\n 'parallax-x', 'parallax-y', 'parallax-rotate', 'parallax-scale', 'parallax-speed',\n];\n\nlet shared: ScrollAnimateInstance | null = null;\n\n/**\n * Register the custom element (default tag `scroll-animate`) and return its\n * class. Safe to call more than once and on the server (returns `undefined`\n * without `customElements`).\n */\nexport function defineScrollAnimate(\n tagName = 'scroll-animate',\n instance?: ScrollAnimateInstance\n): CustomElementConstructor | undefined {\n if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined') return undefined;\n const existing = customElements.get(tagName);\n if (existing) return existing;\n const getInstance = () => instance || shared || (shared = createScrollAnimate());\n\n class ScrollAnimateElement extends HTMLElement {\n static get observedAttributes(): string[] {\n return ATTRIBUTES;\n }\n\n private observing = false;\n\n private emit(type: string, detail?: unknown): void {\n this.dispatchEvent(new CustomEvent(`sa:${type}`, { detail }));\n }\n\n /** Options parsed from the element's attributes (plus event callbacks). */\n get options(): AnimateOptions {\n const opts = readOptions((name) => {\n const v = this.getAttribute(name);\n return v === null ? undefined : v;\n });\n return {\n ...opts,\n onEnter: () => this.emit('enter'),\n onLeave: () => this.emit('leave'),\n onStart: () => this.emit('start'),\n onComplete: () => this.emit('complete'),\n ...(this.hasAttribute('progress') || this.hasAttribute('progress-var')\n ? { onProgress: (_el: Element, progress: number) => this.emit('progress', { progress }) }\n : {}),\n };\n }\n\n connectedCallback(): void {\n if (!this.style.display && typeof getComputedStyle === 'function' && (getComputedStyle(this).display || 'inline') === 'inline') {\n this.style.display = 'block';\n }\n getInstance().observe(this, this.options);\n this.observing = true;\n }\n\n disconnectedCallback(): void {\n getInstance().unobserve(this);\n this.observing = false;\n }\n\n attributeChangedCallback(): void {\n if (!this.observing) return;\n const sa = getInstance();\n const record = sa.getObservedElements().find((r) => r.element === this);\n // Already animated: keep it as it is (avoids re-hiding visible content).\n if (record && !record.animated) {\n sa.unobserve(this);\n sa.observe(this, this.options);\n }\n }\n }\n\n customElements.define(tagName, ScrollAnimateElement);\n return ScrollAnimateElement;\n}\n","// UMD/CDN build: registers <scroll-animate> as soon as the script loads.\nimport { defineScrollAnimate } from './element';\n\ndefineScrollAnimate();\nexport { defineScrollAnimate };\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","num","value","undefined","n","parseFloat","Number","isFinite","lengthValue","v","test","DEFAULT_VIEW_RANGE","normalizeVar","startsWith","readOptions","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","mergeOptions","config","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","el","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","CSS","supports","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","motionDisabled","matchMedia","matches","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","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","wantsNative","globalThis","ViewTimeline","observeElement","has","element","onFrozen","timeline","subject","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","getAttribute","parseDataAttributes","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","ATTRIBUTES","shared","defineScrollAnimate","tagName","customElements","HTMLElement","existing","getInstance","ScrollAnimateElement","constructor","this","observing","observedAttributes","emit","detail","dispatchEvent","CustomEvent","_el","connectedCallback","display","getComputedStyle","disconnectedCallback","attributeChangedCallback","sa","find","define"],"mappings":"2PAYO,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,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,WAAY,CACVH,KAAM,CAAEC,QAAS,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,SAAU,CACRH,KAAM,CAAEC,QAAS,EAAGE,UAAW,mBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,kBAE/B,SAAU,CACRH,KAAM,CAAEC,QAAS,EAAGE,UAAW,mBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,kBAE/B,WAAY,CACVH,KAAM,CAAEG,UAAW,oBACnBD,GAAI,CAAEC,UAAW,oBAEnB,aAAc,CACZH,KAAM,CAAEG,UAAW,qBACnB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AMuL,SAAuC,mBAArBC,kBAAoF,YAAhDA,iBAAiBV,MAAMS,SAAW,YACtGT,KAAK9K,MAAMuL,QAAU,SAEvBZ,IAAcpD,QAAQuD,KAAMA,KAAKtF,SACjCsF,KAAKC,WAAY,CACnB,CAEA,oBAAAU,GACEd,IAAc1F,UAAU6F,MACxBA,KAAKC,WAAY,CACnB,CAEA,wBAAAW,GACE,IAAKZ,KAAKC,UAAW,OACrB,MAAMY,EAAKhB,IACL5F,EAAS4G,EAAG1B,sBAAsB2B,KAAM3M,GAAMA,EAAE6I,UAAYgD,MAE9D/F,IAAWA,EAAOK,WACpBuG,EAAG1G,UAAU6F,MACba,EAAGpE,QAAQuD,KAAMA,KAAKtF,SAE1B,EAIF,OADAgF,eAAeqB,OAAOtB,EAASK,GACxBA,CACT,CCjGAN"}
|
package/dist/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var core = require('./chunks/core-
|
|
6
|
-
var stagger = require('./chunks/stagger-
|
|
5
|
+
var core = require('./chunks/core-B_J4rXbC.cjs');
|
|
6
|
+
var stagger = require('./chunks/stagger-DHw0ExuR.cjs');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* use-scroll-animate - Sequence / timeline helper
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as hasDOM, s as supportsObserver, r as resolveTargets, p as prepareElement, a as stopAnimation, c as createScrollAnimate, g as getScrollProgress, b as prefersReducedMotion } from './chunks/core-
|
|
2
|
-
export { E as EASING_MAP, P as PRESETS, d as resolveEasing, e as resolvePreset, f as supportsScrollTimeline } from './chunks/core-
|
|
3
|
-
export { s as staggerChildren } from './chunks/stagger-
|
|
1
|
+
import { h as hasDOM, s as supportsObserver, r as resolveTargets, p as prepareElement, a as stopAnimation, c as createScrollAnimate, g as getScrollProgress, b as prefersReducedMotion } from './chunks/core-BP-a1iNc.js';
|
|
2
|
+
export { E as EASING_MAP, P as PRESETS, d as resolveEasing, e as resolvePreset, f as supportsScrollTimeline } from './chunks/core-BP-a1iNc.js';
|
|
3
|
+
export { s as staggerChildren } from './chunks/stagger-DTv_WiUQ.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* use-scroll-animate - Sequence / timeline helper
|