@ssgoi/core 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var at=Object.defineProperty;var ct=(e,n,t)=>n in e?at(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>ct(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./types.cjs"),X=require("./spring-integrator-95Mh7mdw.cjs"),lt=require("./provider-BKaONTeg.cjs");class ut{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"maxDeltaTime",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const n=Date.now();let i=n-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=n;const r=n-this.startTime,o=r-this.nextTime;if(o>0){const s=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(f=>{f(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(n){return this.listeners.add(n),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(n)}}unsubscribe(n){this.listeners.delete(n),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(n,t){this.lagThreshold=n,this.adjustedLag=Math.min(t,n)}fps(n){this.gap=1e3/n,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const _=new ut;function ft(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:f}=e;let l={position:t,velocity:r},m=!0,h=0,v=!1;const A=S=>{if(m){if(v||(v=!0,f==null||f()),l=n.step(l,i,S),n.isSettled(l,i)){if(h+=Math.min(S,.033),h>=X.SETTLE_THRESHOLD){l={position:i,velocity:0},m=!1,o(l.position),_.unsubscribe(A),s();return}}else h=0;o(l.position)}};return _.subscribe(A),{stop:()=>{m&&(m=!1,_.unsubscribe(A))},getPosition:()=>l.position,getVelocity:()=>l.velocity,isRunning:()=>m}}const L=1e3/60;function mt(e,n,t,i=0){let o={position:n,velocity:i},s=0;const f=[];for(let l=0;l<600;l++){const m=l*L;if(f.push({time:m,position:o.position,velocity:o.velocity}),o=e.step(o,t,L/1e3),e.isSettled(o,t)){if(s+=L/1e3,s>=X.SETTLE_THRESHOLD){f.push({time:(l+1)*L,position:t,velocity:0});break}}else s=0}return f}function Y(e,n){if(e.length===0)return{position:0,velocity:0};const t=e[0],i=e[e.length-1];if(n<=0)return{position:t.position,velocity:t.velocity};if(n>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=e.length-1;for(;r<o-1;){const m=Math.floor((r+o)/2);e[m].time<=n?r=m:o=m}const s=e[r],f=e[o],l=(n-s.time)/(f.time-s.time);return{position:s.position+(f.position-s.position)*l,velocity:s.velocity+(f.velocity-s.velocity)*l}}function dt(e,n){return e.map(t=>n(t.position))}function ht(e){const{integrator:n,element:t,from:i,to:r,velocity:o=0,style:s,onComplete:f,onStart:l}=e,m=mt(n,i,r,o);if(m.length===0)return l==null||l(),f(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=dt(m,s),v=m[m.length-1],A=v.time,S=h[0];if(S)for(const C of Object.keys(S))t.style[C]="";const y=t.animate(h,{duration:A,fill:"forwards",easing:"linear",composite:"replace"});let p=!0;const R=performance.now();return l==null||l(),y.onfinish=()=>{p&&(p=!1,f())},{stop:()=>{p&&(p=!1,y.cancel())},getPosition:()=>{if(!p)return v.position;const C=performance.now()-R;return Y(m,C).position},getVelocity:()=>{if(!p)return 0;const C=performance.now()-R;return Y(m,C).velocity},isRunning:()=>p}}function gt(e){const{element:n,frames:t,duration:i,easing:r="linear",from:o,to:s,onComplete:f,onStart:l}=e,m=t[0];if(m)for(const S of Object.keys(m))S==="offset"||S==="easing"||S==="composite"||(n.style[S]="");const h=n.animate(t,{duration:i,fill:"forwards",easing:r,composite:"replace"});let v=!0;const A=performance.now();return l==null||l(),h.onfinish=()=>{v&&(v=!1,f())},{stop:()=>{v&&(v=!1,h.cancel())},getPosition:()=>{if(!v)return s;const S=performance.now()-A,y=Math.min(Math.max(S/i,0),1);return o+(s-o)*y},getVelocity:()=>0,isRunning:()=>v}}function yt(e){const{to:n,onStart:t,onComplete:i}=e;return t==null||t(),i(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1}}class wt{static from(n){const{tick:t,css:i,keyframes:r}=n;if((t?1:0)+(i?1:0)+(r?1:0)>1)throw new Error("Cannot use more than one of 'tick', 'css', 'keyframes' together");return r?s=>gt({element:r.element,frames:r.frames,duration:r.duration,easing:r.easing,from:s.from,to:s.to,onComplete:s.onComplete,onStart:s.onStart}):i?s=>{if(!s.integrator)throw new Error("css mode requires an integrator");return ht({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,element:i.element,style:i.style})}:t?s=>{if(!s.integrator)throw new Error("tick mode requires an integrator");return ft({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,onUpdate:t})}:yt}}class J{}const pt={stiffness:300,damping:30};class j extends J{constructor(t){super();d(this,"options");d(this,"runner");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);d(this,"updateFn");d(this,"isKeyframesMode");if(this.options={from:t.from??0,to:t.to??1,physics:t.physics,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,this.isKeyframesMode=!!t.keyframes,t.tick)this.updateFn=i=>{var r;return(r=t.tick)==null?void 0:r.call(t,i)};else if(t.css){const{element:i,style:r}=t.css;this.updateFn=o=>{const s=r(o);for(const[f,l]of Object.entries(s))i.style[f]=typeof l=="number"?String(l):l}}else this.updateFn=()=>{};this.runner=wt.from({tick:t.tick,css:t.css,keyframes:t.keyframes})}syncState(){var t;(t=this.updateFn)==null||t.call(this,this.currentValue)}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?lt.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new X.SpringIntegrator(pt)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator:this.isKeyframesMode?void 0:this.createIntegrator(),from:this.currentValue,to:t,velocity:this.currentVelocity,onStart:this.options.onStart,onComplete:()=>{this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.controls=null,this.options.onComplete()}})}forward(){this.stop(),this.runAnimation(this.options.to)}backward(){this.stop(),this.runAnimation(this.options.from)}reverse(){const t=this.options.from;this.options.from=this.options.to,this.options.to=t,this.isAnimating&&(this.stop(),this.runAnimation(this.options.to))}stop(){this.controls&&(this.currentValue=this.controls.getPosition(),this.currentVelocity=this.controls.getVelocity(),this.controls.stop(),this.controls=null),this.isAnimating=!1}getVelocity(){var t;return((t=this.controls)==null?void 0:t.getVelocity())??this.currentVelocity}getCurrentValue(){var t;return((t=this.controls)==null?void 0:t.getPosition())??this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.getCurrentValue(),velocity:this.getVelocity(),from:this.options.from,to:this.options.to}}setValue(t){this.currentValue=t}setVelocity(t){this.currentVelocity=t}updateOptions(t){this.options={...this.options,...t}}}class z extends J{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"itemOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"from");d(this,"to");d(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,i)=>{const r=this.generateId(),o=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,keyframes:t.keyframes,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(i===0||t.normalizedOffset===0)&&(o.setValue(this.initialState.position),o.setVelocity(this.initialState.velocity),o.syncState()),this.animators.set(r,{id:r,item:t,animator:o,started:!1}),this.itemOrder.push(r)})}getAnimatorProgress(t){const i=t.animator.getCurrentState(),r=Math.abs(i.to-i.from);return r===0?1:Math.abs(i.position-i.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,s,f,l,m;const i=this.animators.get(t);!i||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=i.item).onComplete)==null||o.call(r),(f=(s=this.config).onProgress)==null||f.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(m=(l=this.config).onEnd)==null||m.call(l)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let i=0;i<t.length;i++){const r=t[i],o=this.animators.get(r);if(!o||o.started)continue;if(i===0){this.startAnimator(r);continue}const s=t[i-1],f=this.animators.get(s);if(!f||!f.started)continue;const l=this.getAnimatorProgress(f),m=o.item.normalizedOffset;l>=m&&this.startAnimator(r)}}startAnimator(t){const i=this.animators.get(t);!i||i.started||(i.started=!0,this.direction==="forward"?i.animator.forward():i.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var i;const t=this.itemOrder[0];return t?((i=this.animators.get(t))==null?void 0:i.animator)??null:null}forward(){var t,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}backward(){var t,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const i=t.animator.getCurrentState();if(i.position===i.to){const o=new j({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,keyframes:t.item.keyframes,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});o.setValue(this.to),o.setVelocity(0),o.syncState(),o.forward(),t.animator=o}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const i=this.getFirstAnimator();i==null||i.setValue(t)}setVelocity(t){const i=this.getFirstAnimator();i==null||i.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,i){return new z({...i,state:t})}}const H=Symbol.for("TRANSITION_STRATEGY"),Q=e=>({runIn:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.out)return{config:await n.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return n.in?{config:await n.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.in)return{config:await n.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return n.out?{config:await n.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),tt=()=>({runIn:async e=>e.in?{config:await e.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async e=>e.out?{config:await e.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),U="data-ssgoi-scope",K="data-ssgoi-scope-ready";function vt(){return e=>{if(e)return e.setAttribute(U,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(K,"true")})}),()=>{}}}function et(e){return e.hasAttribute(K)}function it(e){return e.closest(`[${U}]`)}const St=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n),i=t.overflow+t.overflowY+t.overflowX;if(i.includes("auto")||i.includes("scroll")||n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.parentElement}return document.documentElement},At=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function B(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function Tt(e,n){var S;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},f=((S=n==null?void 0:n.strategy)==null?void 0:S.call(n,s))||Q(s),l=async y=>{var g,E;i&&(i.remove(),i=null);const p=e(),R=p.in&&p.in(y),C=!(n!=null&&n.strategy)&&p.out?p.out(y):void 0;if(!R)return;const w={in:k.normalizeToMultiAnimation(R),out:C?k.normalizeToMultiAnimation(C):void 0},u=await f.runIn(w);if(!u.config){t&&(t.direction="in");return}const a=u.config;(g=a.prepare)==null||g.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var b;t=null,(b=a.onEnd)==null||b.call(a)}},y);a.wait&&await a.wait();const c=z.fromState(u.state,{config:T,from:u.from,to:u.to});t={controller:c,direction:"in"},(E=a.onReady)==null||E.call(a),await B(),u.direction==="forward"?c.forward():c.backward()},m=async y=>{var E,b;i=y;const p=e(),R=!(n!=null&&n.strategy)&&p.in?p.in(y):void 0,C=p.out&&p.out(y);if(!C)return;const w={in:R?k.normalizeToMultiAnimation(R):void 0,out:k.normalizeToMultiAnimation(C)},u=await f.runOut(w);if(!u.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const a=u.config;g(),(E=a.prepare)==null||E.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var P,V;(P=a.onEnd)==null||P.call(a),i&&(i.remove(),i=null),t=null,(V=n==null?void 0:n.onCleanupEnd)==null||V.call(n)}},y);a.wait&&await a.wait();const c=z.fromState(u.state,{config:T,from:u.from,to:u.to});t={controller:c,direction:"out"},(b=a.onReady)==null||b.call(a),await B(),u.direction==="forward"?c.forward():c.backward();function g(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let h=null,v=!1;const A=y=>()=>{if(v)return;v=!0;const p=y.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&m(p)}):m(p)};return y=>{if(y)return requestAnimationFrame(()=>{r=y.parentElement,o=y.nextElementSibling}),v=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{h=it(y),!(h&&!et(h))&&l(y)}):l(y),A(y)}}const M=new Map;let I=null,q=!1;function nt(e){if(e instanceof HTMLElement&&M.has(e)){const t=M.get(e);M.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&nt(i)}}function Et(){q||typeof document>"u"||(q=!0,I=new MutationObserver(e=>{for(const n of e){const t=n.removedNodes;for(let i=0;i<t.length;i++){const r=t[i];r&&nt(r)}}}),document.body?I.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{I==null||I.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function rt(e,n){Et(),M.set(e,n)}function Ct(e){return M.has(e)}function bt(){return M.size}function Rt(e){const n=M.get(e);return n?(M.delete(e),n(),!0):!1}function kt(){M.clear(),I==null||I.disconnect(),I=null,q=!1}const O=new Map,N=new Map,W=new Map;function Pt(e,n,t){O.set(e,n);let i=N.get(e);if(i)return i;const r=n;return i=Tt(()=>{const o=O.get(e);return o||(console.warn(`Transition "${String(e)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{O.get(e)===r&&It(e)}}),N.set(e,i),i}function It(e){O.delete(e),N.delete(e),W.delete(e)}function Mt(e,n="manual"){const t=Pt(e.key,{in:e.in,out:e.out},{strategy:e[H],scope:e.scope});if(n==="manual")return t;let i=W.get(e.key);return i||(i=r=>{if(r){const o=t(r);o&&rt(r,o)}},W.set(e.key,i),i)}function Vt(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function F(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===n}function Ft(e,n,t){for(const i of t)if(F(e,i.from)&&F(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||F(e,i.from))&&(i.to==="*"||F(n,i.to)))return i.transition;return null}const xt=768,Lt=10,Ot=10;function zt(e={}){const{preserveScroll:n=c=>c}=e,t=typeof n=="function"?n:()=>n;let i=null,r=!1,o=!1;const s=()=>{const c=(i==null?void 0:i.clientWidth)??0,g=c>0?c:typeof window<"u"?window.innerWidth:0;return g>0&&g<xt},f=()=>(o||(r=s(),o=!0),r),l=c=>{const g=t(f());return g===!1?!1:g===!0?!0:!g.exclude.some(E=>F(c,E))};let m=null;const h=new Map;let v=null,A=!1,S=0;const y=()=>{i&&v&&!A&&h.set(v,{x:i.scrollLeft,y:i.scrollTop})},p=c=>{if(!i)return;const g=l(c)&&h.has(c)?h.get(c):{x:0,y:0};let E=0;const b=()=>{if(!i)return;i.scrollTo({top:g.y,left:g.x}),!(Math.abs(i.scrollTop-g.y)<1&&Math.abs(i.scrollLeft-g.x)<1)&&E<Lt&&(E++,requestAnimationFrame(b))};requestAnimationFrame(b)};return{initializeContext:(c,g)=>{A=!0;const E=++S;m=c,i||(i=St(c),r=s(),o=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=s()}).observe(i),(i===document.documentElement?window:i).addEventListener("scroll",y,{passive:!0})),v=g,p(g);let b=0;const P=()=>{E===S&&(b++,b>=Ot?A=!1:requestAnimationFrame(P))};requestAnimationFrame(P)},calculateScrollOffset:(c,g)=>{const E=c&&h.has(c)?h.get(c):{x:0,y:0},b=g&&l(g)&&h.has(g)?h.get(g):{x:0,y:0};return{x:-b.x+E.x,y:-b.y+E.y}},evictScrollPosition:c=>{h.delete(c)},shouldPreserve:l,getScrollContainer:()=>i,getPositionedParentElement:()=>m?At(m):document.body,getScrollPosition:c=>c&&h.has(c)?h.get(c):{x:0,y:0}}}const G=30,$=8,Z=1.2,Dt=30,_t=600;function qt(){let e=null,n=!1,t=!1,i=null,r=null,o=!1;const s=(w,u)=>{for(let a=0;a<w.length;a++){const T=w.item(a);if(T&&T.identifier===u)return T}return null},f=()=>{i!==null&&(clearTimeout(i),i=null)},l=()=>{r!==null&&(clearTimeout(r),r=null)},m=()=>{n=!0,t=!0,f(),l(),i=setTimeout(()=>{n=!1,t=!1,i=null},_t)},h=w=>{if(w.touches.length!==1){e=null;return}const u=w.touches.item(0);if(!u){e=null;return}const a=window.innerWidth,T=u.clientX<=G,c=u.clientX>=a-G;if(!T&&!c){e=null;return}e={identifier:u.identifier,startX:u.clientX,startY:u.clientY,fromLeftEdge:T,moved:!1}},v=w=>{if(!e)return;if(w.touches.length!==1){e=null;return}const u=s(w.touches,e.identifier);if(!u){e=null;return}const a=u.clientX-e.startX,T=u.clientY-e.startY,c=Math.abs(a),g=Math.abs(T);if(g>$&&g>c*Z){e=null;return}const E=e.fromLeftEdge?a>0:a<0;c>$&&c>g*Z&&E&&(e.moved=!0)},A=w=>{if(!e)return;const u=s(w.changedTouches,e.identifier);if(!u){e=null;return}const a=u.clientX-e.startX,T=e.fromLeftEdge?a>0:a<0;e.moved&&T&&Math.abs(a)>=Dt&&m(),e=null},S=()=>{e&&(e.moved&&m(),e=null)};return{initialize:()=>{if(typeof window>"u"||o)return;o=!0;const w={passive:!0,capture:!0};window.addEventListener("touchstart",h,w),window.addEventListener("touchmove",v,w),window.addEventListener("touchend",A,w),window.addEventListener("touchcancel",S,w)},destroy:()=>{if(typeof window>"u"||!o)return;o=!1;const w={capture:!0};window.removeEventListener("touchstart",h,w),window.removeEventListener("touchmove",v,w),window.removeEventListener("touchend",A,w),window.removeEventListener("touchcancel",S,w),f(),l(),e=null,n=!1,t=!1},isSwipeBack:()=>{const w=n||t;return w&&f(),w},onPageEnter:()=>{n=!1,f(),l(),r=setTimeout(()=>{t=!1,r=null},0)}}}function ot(){let e=null;function n(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const t={from:e.from,to:e.to};e.outResolve(t),e.inResolve(t),e=null}}return{trigger(t,i){e||(e={}),i==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(i=>{e||(e={}),t==="out"?e.outResolve=i:e.inResolve=i,n()})}}}function st(){let e=null;function n(){var i,r;e&&((i=e.outResolve)==null||i.call(e,null),(r=e.inResolve)==null||r.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){n();return}const i={from:e.from,to:e.to};e.outResolve(i),e.inResolve(i),e=null}}return{trigger(i,r){e&&(r==="out"&&e.from&&e.from!==i||r==="in"&&e.to&&e.to!==i)&&n(),e||(e={}),r==="out"?e.from=i:e.to=i},get(i){return new Promise(r=>{e||(e={}),i==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function Nt(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(u,a)=>({from:u,to:a}),preserveScroll:o=u=>u}=e,{outFirst:s=!0}=n||{},f=s?ot():st(),l=Vt(t),m=qt();m.initialize();const{initializeContext:h,calculateScrollOffset:v,evictScrollPosition:A,shouldPreserve:S,getScrollContainer:y,getPositionedParentElement:p,getScrollPosition:R}=zt({preserveScroll:o}),C=async(u,a)=>{const T=m.isSwipeBack();f.trigger(u,a);const c=await f.get(a);if(a==="in"&&m.onPageEnter(),!c)return()=>({});if(T)return a==="out"&&c.from&&!S(c.from)&&A(c.from),()=>({});const{from:g,to:E}=r(c.from,c.to),P=Ft(g,E,l)||i;if(!P)return()=>({});const V=v(c.from,c.to);if(a==="out"){const x={scrollOffset:V,scroll:R(c.from),get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return c.from&&!S(c.from)&&A(c.from),D=>P.out(D,x)}else{const x={scrollOffset:V,get scroll(){return R(c.to)},get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return D=>P.in(D,x)}};return u=>({key:u,in:async a=>(h(a,u),(await C(u,"in"))(a)),out:async a=>(await C(u,"out"))(a),[H]:tt})}exports.isCssAnimation=k.isCssAnimation;exports.isKeyframesAnimation=k.isKeyframesAnimation;exports.isMultiAnimation=k.isMultiAnimation;exports.isSingleAnimation=k.isSingleAnimation;exports.isTickAnimation=k.isTickAnimation;exports.normalizeSchedule=k.normalizeSchedule;exports.normalizeToMultiAnimation=k.normalizeToMultiAnimation;exports.SCOPE_ATTR=U;exports.SCOPE_READY_ATTR=K;exports.TRANSITION_STRATEGY=H;exports.createAnyOrderDetector=st;exports.createDefaultStrategy=Q;exports.createOutFirstDetector=ot;exports.createPageTransitionStrategy=tt;exports.createSggoiTransitionContext=Nt;exports.createTransitionScope=vt;exports.findScope=it;exports.getWatchedCount=bt;exports.isScopeReady=et;exports.isWatched=Ct;exports.resetObserver=kt;exports.transition=Mt;exports.triggerUnmount=Rt;exports.watchUnmount=rt;
|
|
1
|
+
"use strict";var ct=Object.defineProperty;var lt=(e,n,t)=>n in e?ct(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>lt(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./types.cjs"),X=require("./spring-integrator-95Mh7mdw.cjs"),ut=require("./provider-BKaONTeg.cjs");class ft{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"maxDeltaTime",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const n=Date.now();let i=n-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=n;const r=n-this.startTime,o=r-this.nextTime;if(o>0){const s=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(m=>{m(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(n){return this.listeners.add(n),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(n)}}unsubscribe(n){this.listeners.delete(n),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(n,t){this.lagThreshold=n,this.adjustedLag=Math.min(t,n)}fps(n){this.gap=1e3/n,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const _=new ft;function mt(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:m}=e;let l={position:t,velocity:r},u=!0,h=0,v=!1;const A=S=>{if(u){if(v||(v=!0,m==null||m()),l=n.step(l,i,S),n.isSettled(l,i)){if(h+=Math.min(S,.033),h>=X.SETTLE_THRESHOLD){l={position:i,velocity:0},u=!1,o(l.position),_.unsubscribe(A),s();return}}else h=0;o(l.position)}};return _.subscribe(A),{stop:()=>{u&&(u=!1,_.unsubscribe(A))},getPosition:()=>l.position,getVelocity:()=>l.velocity,isRunning:()=>u}}const L=1e3/60;function dt(e,n,t,i=0){let o={position:n,velocity:i},s=0;const m=[];for(let l=0;l<600;l++){const u=l*L;if(m.push({time:u,position:o.position,velocity:o.velocity}),o=e.step(o,t,L/1e3),e.isSettled(o,t)){if(s+=L/1e3,s>=X.SETTLE_THRESHOLD){m.push({time:(l+1)*L,position:t,velocity:0});break}}else s=0}return m}function Y(e,n){if(e.length===0)return{position:0,velocity:0};const t=e[0],i=e[e.length-1];if(n<=0)return{position:t.position,velocity:t.velocity};if(n>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=e.length-1;for(;r<o-1;){const u=Math.floor((r+o)/2);e[u].time<=n?r=u:o=u}const s=e[r],m=e[o],l=(n-s.time)/(m.time-s.time);return{position:s.position+(m.position-s.position)*l,velocity:s.velocity+(m.velocity-s.velocity)*l}}function ht(e,n){return e.map(t=>n(t.position))}function gt(e){const{integrator:n,element:t,from:i,to:r,velocity:o=0,style:s,onComplete:m,onStart:l}=e,u=dt(n,i,r,o);if(u.length===0)return l==null||l(),m(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=ht(u,s),v=u[u.length-1],A=v.time,S=h[0];if(S)for(const C of Object.keys(S))t.style[C]="";const y=t.animate(h,{duration:A,fill:"forwards",easing:"linear",composite:"replace"});let p=!0;const R=performance.now();return l==null||l(),y.onfinish=()=>{p&&(p=!1,m())},{stop:()=>{p&&(p=!1,y.cancel())},getPosition:()=>{if(!p)return v.position;const C=performance.now()-R;return Y(u,C).position},getVelocity:()=>{if(!p)return 0;const C=performance.now()-R;return Y(u,C).velocity},isRunning:()=>p}}function yt(e){const{element:n,frames:t,duration:i,easing:r="linear",from:o,to:s,onComplete:m,onStart:l}=e,u=t[0];if(u)for(const S of Object.keys(u))S==="offset"||S==="easing"||S==="composite"||(n.style[S]="");const h=n.animate(t,{duration:i,fill:"forwards",easing:r,composite:"replace"});let v=!0;const A=performance.now();return l==null||l(),h.onfinish=()=>{v&&(v=!1,m())},{stop:()=>{v&&(v=!1,h.cancel())},getPosition:()=>{if(!v)return s;const S=performance.now()-A,y=Math.min(Math.max(S/i,0),1);return o+(s-o)*y},getVelocity:()=>0,isRunning:()=>v}}function wt(e){const{to:n,onStart:t,onComplete:i}=e;return t==null||t(),i(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1}}class pt{static from(n){const{tick:t,css:i,keyframes:r}=n;if((t?1:0)+(i?1:0)+(r?1:0)>1)throw new Error("Cannot use more than one of 'tick', 'css', 'keyframes' together");return r?s=>yt({element:r.element,frames:r.frames,duration:r.duration,easing:r.easing,from:s.from,to:s.to,onComplete:s.onComplete,onStart:s.onStart}):i?s=>{if(!s.integrator)throw new Error("css mode requires an integrator");return gt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,element:i.element,style:i.style})}:t?s=>{if(!s.integrator)throw new Error("tick mode requires an integrator");return mt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,onUpdate:t})}:wt}}class Q{}const vt={stiffness:300,damping:30};class j extends Q{constructor(t){super();d(this,"options");d(this,"runner");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);d(this,"updateFn");d(this,"isKeyframesMode");if(this.options={from:t.from??0,to:t.to??1,physics:t.physics,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,this.isKeyframesMode=!!t.keyframes,t.tick)this.updateFn=i=>{var r;return(r=t.tick)==null?void 0:r.call(t,i)};else if(t.css){const{element:i,style:r}=t.css;this.updateFn=o=>{const s=r(o);for(const[m,l]of Object.entries(s))i.style[m]=typeof l=="number"?String(l):l}}else this.updateFn=()=>{};this.runner=pt.from({tick:t.tick,css:t.css,keyframes:t.keyframes})}syncState(){var t;(t=this.updateFn)==null||t.call(this,this.currentValue)}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?ut.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new X.SpringIntegrator(vt)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator:this.isKeyframesMode?void 0:this.createIntegrator(),from:this.currentValue,to:t,velocity:this.currentVelocity,onStart:this.options.onStart,onComplete:()=>{this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.controls=null,this.options.onComplete()}})}forward(){this.stop(),this.runAnimation(this.options.to)}backward(){this.stop(),this.runAnimation(this.options.from)}reverse(){const t=this.options.from;this.options.from=this.options.to,this.options.to=t,this.isAnimating&&(this.stop(),this.runAnimation(this.options.to))}stop(){this.controls&&(this.currentValue=this.controls.getPosition(),this.currentVelocity=this.controls.getVelocity(),this.controls.stop(),this.controls=null),this.isAnimating=!1}getVelocity(){var t;return((t=this.controls)==null?void 0:t.getVelocity())??this.currentVelocity}getCurrentValue(){var t;return((t=this.controls)==null?void 0:t.getPosition())??this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.getCurrentValue(),velocity:this.getVelocity(),from:this.options.from,to:this.options.to}}setValue(t){this.currentValue=t}setVelocity(t){this.currentVelocity=t}updateOptions(t){this.options={...this.options,...t}}}class z extends Q{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"itemOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"from");d(this,"to");d(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,i)=>{const r=this.generateId(),o=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,keyframes:t.keyframes,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(i===0||t.normalizedOffset===0)&&(o.setValue(this.initialState.position),o.setVelocity(this.initialState.velocity),o.syncState()),this.animators.set(r,{id:r,item:t,animator:o,started:!1}),this.itemOrder.push(r)})}getAnimatorProgress(t){const i=t.animator.getCurrentState(),r=Math.abs(i.to-i.from);return r===0?1:Math.abs(i.position-i.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,s,m,l,u;const i=this.animators.get(t);!i||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=i.item).onComplete)==null||o.call(r),(m=(s=this.config).onProgress)==null||m.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(u=(l=this.config).onEnd)==null||u.call(l)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let i=0;i<t.length;i++){const r=t[i],o=this.animators.get(r);if(!o||o.started)continue;if(i===0){this.startAnimator(r);continue}const s=t[i-1],m=this.animators.get(s);if(!m||!m.started)continue;const l=this.getAnimatorProgress(m),u=o.item.normalizedOffset;l>=u&&this.startAnimator(r)}}startAnimator(t){const i=this.animators.get(t);!i||i.started||(i.started=!0,this.direction==="forward"?i.animator.forward():i.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var i;const t=this.itemOrder[0];return t?((i=this.animators.get(t))==null?void 0:i.animator)??null:null}forward(){var t,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}backward(){var t,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const i=t.animator.getCurrentState();if(i.position===i.to){const o=new j({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,keyframes:t.item.keyframes,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});o.setValue(this.to),o.setVelocity(0),o.syncState(),o.forward(),t.animator=o}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const i=this.getFirstAnimator();i==null||i.setValue(t)}setVelocity(t){const i=this.getFirstAnimator();i==null||i.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,i){return new z({...i,state:t})}}const H=Symbol.for("TRANSITION_STRATEGY"),tt=e=>({runIn:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.out)return{config:await n.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return n.in?{config:await n.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.in)return{config:await n.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return n.out?{config:await n.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),et=()=>({runIn:async e=>e.in?{config:await e.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async e=>e.out?{config:await e.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),U="data-ssgoi-scope",K="data-ssgoi-scope-ready";function St(){return e=>{if(e)return e.setAttribute(U,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(K,"true")})}),()=>{}}}function it(e){return e.hasAttribute(K)}function nt(e){return e.closest(`[${U}]`)}const At=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n),i=t.overflow+t.overflowY+t.overflowX;if(i.includes("auto")||i.includes("scroll")||n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.parentElement}return document.documentElement},Tt=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function B(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function Et(e,n){var S;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},m=((S=n==null?void 0:n.strategy)==null?void 0:S.call(n,s))||tt(s),l=async y=>{var g,E;i&&(i.remove(),i=null);const p=e(),R=p.in&&p.in(y),C=!(n!=null&&n.strategy)&&p.out?p.out(y):void 0;if(!R)return;const w={in:k.normalizeToMultiAnimation(R),out:C?k.normalizeToMultiAnimation(C):void 0},f=await m.runIn(w);if(!f.config){t&&(t.direction="in");return}const a=f.config;(g=a.prepare)==null||g.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var b;t=null,(b=a.onEnd)==null||b.call(a)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"in"},(E=a.onReady)==null||E.call(a),await B(),f.direction==="forward"?c.forward():c.backward()},u=async y=>{var E,b;i=y;const p=e(),R=!(n!=null&&n.strategy)&&p.in?p.in(y):void 0,C=p.out&&p.out(y);if(!C)return;const w={in:R?k.normalizeToMultiAnimation(R):void 0,out:k.normalizeToMultiAnimation(C)},f=await m.runOut(w);if(!f.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const a=f.config;g(),(E=a.prepare)==null||E.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var M,V;(M=a.onEnd)==null||M.call(a),i&&(i.remove(),i=null),t=null,(V=n==null?void 0:n.onCleanupEnd)==null||V.call(n)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"out"},(b=a.onReady)==null||b.call(a),await B(),f.direction==="forward"?c.forward():c.backward();function g(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let h=null,v=!1;const A=y=>()=>{if(v)return;v=!0;const p=y.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&u(p)}):u(p)};return y=>{if(y)return requestAnimationFrame(()=>{r=y.parentElement,o=y.nextElementSibling}),v=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{h=nt(y),!(h&&!it(h))&&l(y)}):l(y),A(y)}}const I=new Map;let P=null,q=!1;function rt(e){if(e instanceof HTMLElement&&I.has(e)){const t=I.get(e);I.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&rt(i)}}function Ct(){q||typeof document>"u"||(q=!0,P=new MutationObserver(e=>{for(const n of e){const t=n.removedNodes;for(let i=0;i<t.length;i++){const r=t[i];r&&rt(r)}}}),document.body?P.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{P==null||P.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function ot(e,n){Ct(),I.set(e,n)}function bt(e){return I.has(e)}function Rt(){return I.size}function kt(e){const n=I.get(e);return n?(I.delete(e),n(),!0):!1}function Mt(){I.clear(),P==null||P.disconnect(),P=null,q=!1}const O=new Map,N=new Map,W=new Map;function Pt(e,n,t){O.set(e,n);let i=N.get(e);if(i)return i;const r=n;return i=Et(()=>{const o=O.get(e);return o||(console.warn(`Transition "${String(e)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{O.get(e)===r&&It(e)}}),N.set(e,i),i}function It(e){O.delete(e),N.delete(e),W.delete(e)}function Vt(e,n="manual"){const t=Pt(e.key,{in:e.in,out:e.out},{strategy:e[H],scope:e.scope});if(n==="manual")return t;let i=W.get(e.key);return i||(i=r=>{if(r){const o=t(r);o&&ot(r,o)}},W.set(e.key,i),i)}function Ft(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function F(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===n}function xt(e,n,t){for(const i of t)if(F(e,i.from)&&F(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||F(e,i.from))&&(i.to==="*"||F(n,i.to)))return i.transition;return null}const Lt=768,Ot=10,zt=10;function Dt(e={}){const{preserveScroll:n=c=>c}=e,t=typeof n=="function"?n:()=>n;let i=null,r=!1,o=!1;const s=()=>{const c=(i==null?void 0:i.clientWidth)??0,g=c>0?c:typeof window<"u"?window.innerWidth:0;return g>0&&g<Lt},m=()=>(o||(r=s(),o=!0),r),l=c=>{const g=t(m());return g===!1?!1:g===!0?!0:!g.exclude.some(E=>F(c,E))};let u=null;const h=new Map;let v=null,A=!1,S=0;const y=()=>{i&&v&&!A&&h.set(v,{x:i.scrollLeft,y:i.scrollTop})},p=c=>{if(!i)return;const g=l(c)&&h.has(c)?h.get(c):{x:0,y:0};let E=0;const b=()=>{if(!i)return;i.scrollTo({top:g.y,left:g.x}),!(Math.abs(i.scrollTop-g.y)<1&&Math.abs(i.scrollLeft-g.x)<1)&&E<Ot&&(E++,requestAnimationFrame(b))};requestAnimationFrame(b)};return{initializeContext:(c,g)=>{A=!0;const E=++S;u=c,i||(i=At(c),r=s(),o=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=s()}).observe(i),(i===document.documentElement?window:i).addEventListener("scroll",y,{passive:!0})),v=g,p(g);let b=0;const M=()=>{E===S&&(b++,b>=zt?A=!1:requestAnimationFrame(M))};requestAnimationFrame(M)},calculateScrollOffset:(c,g)=>{const E=c&&h.has(c)?h.get(c):{x:0,y:0},b=g&&l(g)&&h.has(g)?h.get(g):{x:0,y:0};return{x:-b.x+E.x,y:-b.y+E.y}},evictScrollPosition:c=>{h.delete(c)},shouldPreserve:l,getScrollContainer:()=>i,getPositionedParentElement:()=>u?Tt(u):document.body,getScrollPosition:c=>c&&h.has(c)?h.get(c):{x:0,y:0}}}const G=30,$=8,Z=1.2,J=30,_t=600;function qt(){let e=null,n=!1,t=!1,i=null,r=null,o=!1;const s=(w,f)=>{for(let a=0;a<w.length;a++){const T=w.item(a);if(T&&T.identifier===f)return T}return null},m=()=>{i!==null&&(clearTimeout(i),i=null)},l=()=>{r!==null&&(clearTimeout(r),r=null)},u=()=>{n=!0,t=!0,m(),l(),i=setTimeout(()=>{n=!1,t=!1,i=null},_t)},h=w=>{if(w.touches.length!==1){e=null;return}const f=w.touches.item(0);if(!f){e=null;return}const a=window.innerWidth,T=f.clientX<=G,c=f.clientX>=a-G;if(!T&&!c){e=null;return}e={identifier:f.identifier,startX:f.clientX,startY:f.clientY,fromLeftEdge:T,moved:!1}},v=w=>{if(!e)return;if(w.touches.length!==1){e=null;return}const f=s(w.touches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=f.clientY-e.startY,c=Math.abs(a),g=Math.abs(T);if(g>$&&g>c*Z){e=null;return}const E=e.fromLeftEdge?a>0:a<0;c>$&&c>g*Z&&E&&(e.moved=!0)},A=w=>{if(!e)return;const f=s(w.changedTouches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=e.fromLeftEdge?a>0:a<0;if(e.moved&&T&&Math.abs(a)>=J){u(),e=null;return}e.moved&&Math.abs(a)>=J&&u(),e=null},S=()=>{e&&(e.moved&&u(),e=null)};return{initialize:()=>{if(typeof window>"u"||o)return;o=!0;const w={passive:!0,capture:!0};window.addEventListener("touchstart",h,w),window.addEventListener("touchmove",v,w),window.addEventListener("touchend",A,w),window.addEventListener("touchcancel",S,w)},destroy:()=>{if(typeof window>"u"||!o)return;o=!1;const w={capture:!0};window.removeEventListener("touchstart",h,w),window.removeEventListener("touchmove",v,w),window.removeEventListener("touchend",A,w),window.removeEventListener("touchcancel",S,w),m(),l(),e=null,n=!1,t=!1},isSwipeBack:()=>{const w=n||t;return w&&m(),w},onPageEnter:()=>{n=!1,m(),l(),r=setTimeout(()=>{t=!1,r=null},0)}}}function st(){let e=null;function n(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const t={from:e.from,to:e.to};e.outResolve(t),e.inResolve(t),e=null}}return{trigger(t,i){e||(e={}),i==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(i=>{e||(e={}),t==="out"?e.outResolve=i:e.inResolve=i,n()})}}}function at(){let e=null;function n(){var i,r;e&&((i=e.outResolve)==null||i.call(e,null),(r=e.inResolve)==null||r.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){n();return}const i={from:e.from,to:e.to};e.outResolve(i),e.inResolve(i),e=null}}return{trigger(i,r){e&&(r==="out"&&e.from&&e.from!==i||r==="in"&&e.to&&e.to!==i)&&n(),e||(e={}),r==="out"?e.from=i:e.to=i},get(i){return new Promise(r=>{e||(e={}),i==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function Nt(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(f,a)=>({from:f,to:a}),preserveScroll:o=f=>f}=e,{outFirst:s=!0}=n||{},m=s?st():at(),l=Ft(t),u=qt();u.initialize();const{initializeContext:h,calculateScrollOffset:v,evictScrollPosition:A,shouldPreserve:S,getScrollContainer:y,getPositionedParentElement:p,getScrollPosition:R}=Dt({preserveScroll:o}),C=async(f,a)=>{const T=u.isSwipeBack();m.trigger(f,a);const c=await m.get(a);if(a==="in"&&u.onPageEnter(),!c)return()=>({});if(T)return a==="out"&&c.from&&!S(c.from)&&A(c.from),()=>({});const{from:g,to:E}=r(c.from,c.to),M=xt(g,E,l)||i;if(!M)return()=>({});const V=v(c.from,c.to);if(a==="out"){const x={scrollOffset:V,scroll:R(c.from),get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return c.from&&!S(c.from)&&A(c.from),D=>M.out(D,x)}else{const x={scrollOffset:V,get scroll(){return R(c.to)},get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return D=>M.in(D,x)}};return f=>({key:f,in:async a=>(h(a,f),(await C(f,"in"))(a)),out:async a=>(await C(f,"out"))(a),[H]:et})}exports.isCssAnimation=k.isCssAnimation;exports.isKeyframesAnimation=k.isKeyframesAnimation;exports.isMultiAnimation=k.isMultiAnimation;exports.isSingleAnimation=k.isSingleAnimation;exports.isTickAnimation=k.isTickAnimation;exports.normalizeSchedule=k.normalizeSchedule;exports.normalizeToMultiAnimation=k.normalizeToMultiAnimation;exports.SCOPE_ATTR=U;exports.SCOPE_READY_ATTR=K;exports.TRANSITION_STRATEGY=H;exports.createAnyOrderDetector=at;exports.createDefaultStrategy=tt;exports.createOutFirstDetector=st;exports.createPageTransitionStrategy=et;exports.createSggoiTransitionContext=Nt;exports.createTransitionScope=St;exports.findScope=nt;exports.getWatchedCount=Rt;exports.isScopeReady=it;exports.isWatched=bt;exports.resetObserver=Mt;exports.transition=Vt;exports.triggerUnmount=kt;exports.watchUnmount=ot;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (e, i, t) =>
|
|
1
|
+
var nt = Object.defineProperty;
|
|
2
|
+
var it = (e, i, t) => i in e ? nt(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
|
|
3
|
+
var d = (e, i, t) => it(e, typeof i != "symbol" ? i + "" : i, t);
|
|
4
4
|
import { normalizeToMultiAnimation as F, normalizeSchedule as W } from "./types.js";
|
|
5
5
|
import { isCssAnimation as Gt, isKeyframesAnimation as $t, isMultiAnimation as Zt, isSingleAnimation as Jt, isTickAnimation as Qt } from "./types.js";
|
|
6
|
-
import { S as
|
|
7
|
-
import { I as
|
|
8
|
-
class
|
|
6
|
+
import { S as $, a as rt } from "./spring-integrator-BM4a-82c.js";
|
|
7
|
+
import { I as ot } from "./provider-B2B8CK6H.js";
|
|
8
|
+
class st {
|
|
9
9
|
constructor() {
|
|
10
10
|
d(this, "listeners", /* @__PURE__ */ new Set());
|
|
11
11
|
d(this, "rafId", null);
|
|
@@ -32,8 +32,8 @@ class ot {
|
|
|
32
32
|
const r = i - this.startTime, o = r - this.nextTime;
|
|
33
33
|
if (o > 0) {
|
|
34
34
|
const s = n / 1e3;
|
|
35
|
-
this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((
|
|
36
|
-
|
|
35
|
+
this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((m) => {
|
|
36
|
+
m(s, this.elapsed);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
|
|
@@ -69,8 +69,8 @@ class ot {
|
|
|
69
69
|
return this.elapsed;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const z = new
|
|
73
|
-
function
|
|
72
|
+
const z = new st();
|
|
73
|
+
function at(e) {
|
|
74
74
|
const {
|
|
75
75
|
integrator: i,
|
|
76
76
|
from: t,
|
|
@@ -78,14 +78,14 @@ function st(e) {
|
|
|
78
78
|
velocity: r = 0,
|
|
79
79
|
onUpdate: o,
|
|
80
80
|
onComplete: s,
|
|
81
|
-
onStart:
|
|
81
|
+
onStart: m
|
|
82
82
|
} = e;
|
|
83
|
-
let l = { position: t, velocity: r },
|
|
83
|
+
let l = { position: t, velocity: r }, u = !0, h = 0, v = !1;
|
|
84
84
|
const A = (S) => {
|
|
85
|
-
if (
|
|
86
|
-
if (v || (v = !0,
|
|
87
|
-
if (h += Math.min(S, 0.033), h >=
|
|
88
|
-
l = { position: n, velocity: 0 },
|
|
85
|
+
if (u) {
|
|
86
|
+
if (v || (v = !0, m == null || m()), l = i.step(l, n, S), i.isSettled(l, n)) {
|
|
87
|
+
if (h += Math.min(S, 0.033), h >= $) {
|
|
88
|
+
l = { position: n, velocity: 0 }, u = !1, o(l.position), z.unsubscribe(A), s();
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
} else
|
|
@@ -95,26 +95,26 @@ function st(e) {
|
|
|
95
95
|
};
|
|
96
96
|
return z.subscribe(A), {
|
|
97
97
|
stop: () => {
|
|
98
|
-
|
|
98
|
+
u && (u = !1, z.unsubscribe(A));
|
|
99
99
|
},
|
|
100
100
|
getPosition: () => l.position,
|
|
101
101
|
getVelocity: () => l.velocity,
|
|
102
|
-
isRunning: () =>
|
|
102
|
+
isRunning: () => u
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
const L = 1e3 / 60;
|
|
106
|
-
function
|
|
106
|
+
function ct(e, i, t, n = 0) {
|
|
107
107
|
let o = { position: i, velocity: n }, s = 0;
|
|
108
|
-
const
|
|
108
|
+
const m = [];
|
|
109
109
|
for (let l = 0; l < 600; l++) {
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
time:
|
|
110
|
+
const u = l * L;
|
|
111
|
+
if (m.push({
|
|
112
|
+
time: u,
|
|
113
113
|
position: o.position,
|
|
114
114
|
velocity: o.velocity
|
|
115
115
|
}), o = e.step(o, t, L / 1e3), e.isSettled(o, t)) {
|
|
116
|
-
if (s += L / 1e3, s >=
|
|
117
|
-
|
|
116
|
+
if (s += L / 1e3, s >= $) {
|
|
117
|
+
m.push({
|
|
118
118
|
time: (l + 1) * L,
|
|
119
119
|
position: t,
|
|
120
120
|
velocity: 0
|
|
@@ -124,7 +124,7 @@ function at(e, i, t, n = 0) {
|
|
|
124
124
|
} else
|
|
125
125
|
s = 0;
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return m;
|
|
128
128
|
}
|
|
129
129
|
function H(e, i) {
|
|
130
130
|
if (e.length === 0)
|
|
@@ -136,19 +136,19 @@ function H(e, i) {
|
|
|
136
136
|
return { position: n.position, velocity: n.velocity };
|
|
137
137
|
let r = 0, o = e.length - 1;
|
|
138
138
|
for (; r < o - 1; ) {
|
|
139
|
-
const
|
|
140
|
-
e[
|
|
139
|
+
const u = Math.floor((r + o) / 2);
|
|
140
|
+
e[u].time <= i ? r = u : o = u;
|
|
141
141
|
}
|
|
142
|
-
const s = e[r],
|
|
142
|
+
const s = e[r], m = e[o], l = (i - s.time) / (m.time - s.time);
|
|
143
143
|
return {
|
|
144
|
-
position: s.position + (
|
|
145
|
-
velocity: s.velocity + (
|
|
144
|
+
position: s.position + (m.position - s.position) * l,
|
|
145
|
+
velocity: s.velocity + (m.velocity - s.velocity) * l
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function lt(e, i) {
|
|
149
149
|
return e.map((t) => i(t.position));
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function ut(e) {
|
|
152
152
|
const {
|
|
153
153
|
integrator: i,
|
|
154
154
|
element: t,
|
|
@@ -156,18 +156,18 @@ function lt(e) {
|
|
|
156
156
|
to: r,
|
|
157
157
|
velocity: o = 0,
|
|
158
158
|
style: s,
|
|
159
|
-
onComplete:
|
|
159
|
+
onComplete: m,
|
|
160
160
|
onStart: l
|
|
161
|
-
} = e,
|
|
162
|
-
if (
|
|
163
|
-
return l == null || l(),
|
|
161
|
+
} = e, u = ct(i, n, r, o);
|
|
162
|
+
if (u.length === 0)
|
|
163
|
+
return l == null || l(), m(), {
|
|
164
164
|
stop: () => {
|
|
165
165
|
},
|
|
166
166
|
getPosition: () => r,
|
|
167
167
|
getVelocity: () => 0,
|
|
168
168
|
isRunning: () => !1
|
|
169
169
|
};
|
|
170
|
-
const h =
|
|
170
|
+
const h = lt(u, s), v = u[u.length - 1], A = v.time, S = h[0];
|
|
171
171
|
if (S)
|
|
172
172
|
for (const T of Object.keys(S))
|
|
173
173
|
t.style[T] = "";
|
|
@@ -180,7 +180,7 @@ function lt(e) {
|
|
|
180
180
|
let p = !0;
|
|
181
181
|
const k = performance.now();
|
|
182
182
|
return l == null || l(), y.onfinish = () => {
|
|
183
|
-
p && (p = !1,
|
|
183
|
+
p && (p = !1, m());
|
|
184
184
|
}, {
|
|
185
185
|
stop: () => {
|
|
186
186
|
p && (p = !1, y.cancel());
|
|
@@ -189,18 +189,18 @@ function lt(e) {
|
|
|
189
189
|
if (!p)
|
|
190
190
|
return v.position;
|
|
191
191
|
const T = performance.now() - k;
|
|
192
|
-
return H(
|
|
192
|
+
return H(u, T).position;
|
|
193
193
|
},
|
|
194
194
|
getVelocity: () => {
|
|
195
195
|
if (!p)
|
|
196
196
|
return 0;
|
|
197
197
|
const T = performance.now() - k;
|
|
198
|
-
return H(
|
|
198
|
+
return H(u, T).velocity;
|
|
199
199
|
},
|
|
200
200
|
isRunning: () => p
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function ft(e) {
|
|
204
204
|
const {
|
|
205
205
|
element: i,
|
|
206
206
|
frames: t,
|
|
@@ -208,11 +208,11 @@ function ut(e) {
|
|
|
208
208
|
easing: r = "linear",
|
|
209
209
|
from: o,
|
|
210
210
|
to: s,
|
|
211
|
-
onComplete:
|
|
211
|
+
onComplete: m,
|
|
212
212
|
onStart: l
|
|
213
|
-
} = e,
|
|
214
|
-
if (
|
|
215
|
-
for (const S of Object.keys(
|
|
213
|
+
} = e, u = t[0];
|
|
214
|
+
if (u)
|
|
215
|
+
for (const S of Object.keys(u))
|
|
216
216
|
S === "offset" || S === "easing" || S === "composite" || (i.style[S] = "");
|
|
217
217
|
const h = i.animate(t, {
|
|
218
218
|
duration: n,
|
|
@@ -223,7 +223,7 @@ function ut(e) {
|
|
|
223
223
|
let v = !0;
|
|
224
224
|
const A = performance.now();
|
|
225
225
|
return l == null || l(), h.onfinish = () => {
|
|
226
|
-
v && (v = !1,
|
|
226
|
+
v && (v = !1, m());
|
|
227
227
|
}, {
|
|
228
228
|
stop: () => {
|
|
229
229
|
v && (v = !1, h.cancel());
|
|
@@ -243,7 +243,7 @@ function ut(e) {
|
|
|
243
243
|
isRunning: () => v
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function mt(e) {
|
|
247
247
|
const { to: i, onStart: t, onComplete: n } = e;
|
|
248
248
|
return t == null || t(), n(), {
|
|
249
249
|
stop: () => {
|
|
@@ -253,7 +253,7 @@ function ft(e) {
|
|
|
253
253
|
isRunning: () => !1
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
class
|
|
256
|
+
class dt {
|
|
257
257
|
/**
|
|
258
258
|
* Get bound runner based on animation mode
|
|
259
259
|
*
|
|
@@ -267,7 +267,7 @@ class mt {
|
|
|
267
267
|
throw new Error(
|
|
268
268
|
"Cannot use more than one of 'tick', 'css', 'keyframes' together"
|
|
269
269
|
);
|
|
270
|
-
return r ? (s) =>
|
|
270
|
+
return r ? (s) => ft({
|
|
271
271
|
element: r.element,
|
|
272
272
|
frames: r.frames,
|
|
273
273
|
duration: r.duration,
|
|
@@ -279,7 +279,7 @@ class mt {
|
|
|
279
279
|
}) : n ? (s) => {
|
|
280
280
|
if (!s.integrator)
|
|
281
281
|
throw new Error("css mode requires an integrator");
|
|
282
|
-
return
|
|
282
|
+
return ut({
|
|
283
283
|
integrator: s.integrator,
|
|
284
284
|
from: s.from,
|
|
285
285
|
to: s.to,
|
|
@@ -292,7 +292,7 @@ class mt {
|
|
|
292
292
|
} : t ? (s) => {
|
|
293
293
|
if (!s.integrator)
|
|
294
294
|
throw new Error("tick mode requires an integrator");
|
|
295
|
-
return
|
|
295
|
+
return at({
|
|
296
296
|
integrator: s.integrator,
|
|
297
297
|
from: s.from,
|
|
298
298
|
to: s.to,
|
|
@@ -301,13 +301,13 @@ class mt {
|
|
|
301
301
|
onStart: s.onStart,
|
|
302
302
|
onUpdate: t
|
|
303
303
|
});
|
|
304
|
-
} :
|
|
304
|
+
} : mt;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
class
|
|
307
|
+
class Z {
|
|
308
308
|
}
|
|
309
|
-
const
|
|
310
|
-
class K extends
|
|
309
|
+
const ht = { stiffness: 300, damping: 30 };
|
|
310
|
+
class K extends Z {
|
|
311
311
|
constructor(t) {
|
|
312
312
|
super();
|
|
313
313
|
d(this, "options");
|
|
@@ -334,13 +334,13 @@ class K extends $ {
|
|
|
334
334
|
const { element: n, style: r } = t.css;
|
|
335
335
|
this.updateFn = (o) => {
|
|
336
336
|
const s = r(o);
|
|
337
|
-
for (const [
|
|
338
|
-
n.style[
|
|
337
|
+
for (const [m, l] of Object.entries(s))
|
|
338
|
+
n.style[m] = typeof l == "number" ? String(l) : l;
|
|
339
339
|
};
|
|
340
340
|
} else
|
|
341
341
|
this.updateFn = () => {
|
|
342
342
|
};
|
|
343
|
-
this.runner =
|
|
343
|
+
this.runner = dt.from({
|
|
344
344
|
tick: t.tick,
|
|
345
345
|
css: t.css,
|
|
346
346
|
keyframes: t.keyframes
|
|
@@ -360,10 +360,10 @@ class K extends $ {
|
|
|
360
360
|
*/
|
|
361
361
|
createIntegrator() {
|
|
362
362
|
const t = this.options.physics;
|
|
363
|
-
return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ?
|
|
363
|
+
return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? ot.from({
|
|
364
364
|
spring: t.spring,
|
|
365
365
|
inertia: t.inertia
|
|
366
|
-
}) : new
|
|
366
|
+
}) : new rt(ht);
|
|
367
367
|
}
|
|
368
368
|
runAnimation(t) {
|
|
369
369
|
this.isAnimating = !0, this.controls = this.runner({
|
|
@@ -421,7 +421,7 @@ class K extends $ {
|
|
|
421
421
|
this.options = { ...this.options, ...t };
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
class D extends
|
|
424
|
+
class D extends Z {
|
|
425
425
|
constructor(t) {
|
|
426
426
|
super();
|
|
427
427
|
d(this, "config");
|
|
@@ -480,9 +480,9 @@ class D extends $ {
|
|
|
480
480
|
return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
|
|
481
481
|
}
|
|
482
482
|
onAnimatorComplete(t) {
|
|
483
|
-
var r, o, s,
|
|
483
|
+
var r, o, s, m, l, u;
|
|
484
484
|
const n = this.animators.get(t);
|
|
485
|
-
!n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (
|
|
485
|
+
!n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (m = (s = this.config).onProgress) == null || m.call(s, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (l = this.config).onEnd) == null || u.call(l)));
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* Check and start springs based on previous spring's progress
|
|
@@ -497,10 +497,10 @@ class D extends $ {
|
|
|
497
497
|
this.startAnimator(r);
|
|
498
498
|
continue;
|
|
499
499
|
}
|
|
500
|
-
const s = t[n - 1],
|
|
501
|
-
if (!
|
|
502
|
-
const l = this.getAnimatorProgress(
|
|
503
|
-
l >=
|
|
500
|
+
const s = t[n - 1], m = this.animators.get(s);
|
|
501
|
+
if (!m || !m.started) continue;
|
|
502
|
+
const l = this.getAnimatorProgress(m), u = o.item.normalizedOffset;
|
|
503
|
+
l >= u && this.startAnimator(r);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
startAnimator(t) {
|
|
@@ -619,7 +619,7 @@ class D extends $ {
|
|
|
619
619
|
return new D({ ...n, state: t });
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
const
|
|
622
|
+
const J = Symbol.for("TRANSITION_STRATEGY"), gt = (e) => ({
|
|
623
623
|
runIn: async (i) => {
|
|
624
624
|
const { currentAnimation: t } = e;
|
|
625
625
|
if (t && t.direction === "out") {
|
|
@@ -686,7 +686,7 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
|
|
|
686
686
|
direction: "forward"
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
|
-
}),
|
|
689
|
+
}), yt = () => ({
|
|
690
690
|
runIn: async (e) => e.in ? {
|
|
691
691
|
config: await e.in,
|
|
692
692
|
state: {
|
|
@@ -723,25 +723,25 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
|
|
|
723
723
|
to: 0,
|
|
724
724
|
direction: "forward"
|
|
725
725
|
}
|
|
726
|
-
}),
|
|
726
|
+
}), Q = "data-ssgoi-scope", tt = "data-ssgoi-scope-ready";
|
|
727
727
|
function Nt() {
|
|
728
728
|
return (e) => {
|
|
729
729
|
if (e)
|
|
730
|
-
return e.setAttribute(
|
|
730
|
+
return e.setAttribute(Q, ""), queueMicrotask(() => {
|
|
731
731
|
queueMicrotask(() => {
|
|
732
|
-
e.setAttribute(
|
|
732
|
+
e.setAttribute(tt, "true");
|
|
733
733
|
});
|
|
734
734
|
}), () => {
|
|
735
735
|
};
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
|
-
function yt(e) {
|
|
739
|
-
return e.hasAttribute(Q);
|
|
740
|
-
}
|
|
741
738
|
function wt(e) {
|
|
742
|
-
return e.
|
|
739
|
+
return e.hasAttribute(tt);
|
|
740
|
+
}
|
|
741
|
+
function pt(e) {
|
|
742
|
+
return e.closest(`[${Q}]`);
|
|
743
743
|
}
|
|
744
|
-
const
|
|
744
|
+
const vt = (e) => {
|
|
745
745
|
let i = e.parentElement;
|
|
746
746
|
for (; i && i !== document.body; ) {
|
|
747
747
|
const t = window.getComputedStyle(i), n = t.overflow + t.overflowY + t.overflowX;
|
|
@@ -750,7 +750,7 @@ const pt = (e) => {
|
|
|
750
750
|
i = i.parentElement;
|
|
751
751
|
}
|
|
752
752
|
return document.documentElement;
|
|
753
|
-
},
|
|
753
|
+
}, St = (e) => {
|
|
754
754
|
let i = e.parentElement;
|
|
755
755
|
for (; i && i !== document.body; ) {
|
|
756
756
|
const t = window.getComputedStyle(i).position;
|
|
@@ -769,14 +769,14 @@ function U(e) {
|
|
|
769
769
|
});
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function At(e, i) {
|
|
773
773
|
var S;
|
|
774
774
|
let t = null, n = null, r = null, o = null;
|
|
775
775
|
const s = {
|
|
776
776
|
get currentAnimation() {
|
|
777
777
|
return t;
|
|
778
778
|
}
|
|
779
|
-
},
|
|
779
|
+
}, m = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, s)) || gt(s), l = async (y) => {
|
|
780
780
|
var g, E;
|
|
781
781
|
n && (n.remove(), n = null);
|
|
782
782
|
const p = e(), k = p.in && p.in(y), T = !(i != null && i.strategy) && p.out ? p.out(y) : void 0;
|
|
@@ -785,12 +785,12 @@ function St(e, i) {
|
|
|
785
785
|
const w = {
|
|
786
786
|
in: F(k),
|
|
787
787
|
out: T ? F(T) : void 0
|
|
788
|
-
},
|
|
789
|
-
if (!
|
|
788
|
+
}, f = await m.runIn(w);
|
|
789
|
+
if (!f.config) {
|
|
790
790
|
t && (t.direction = "in");
|
|
791
791
|
return;
|
|
792
792
|
}
|
|
793
|
-
const a =
|
|
793
|
+
const a = f.config;
|
|
794
794
|
(g = a.prepare) == null || g.call(a);
|
|
795
795
|
const C = W(
|
|
796
796
|
{
|
|
@@ -803,13 +803,13 @@ function St(e, i) {
|
|
|
803
803
|
y
|
|
804
804
|
);
|
|
805
805
|
a.wait && await a.wait();
|
|
806
|
-
const c = D.fromState(
|
|
806
|
+
const c = D.fromState(f.state, {
|
|
807
807
|
config: C,
|
|
808
|
-
from:
|
|
809
|
-
to:
|
|
808
|
+
from: f.from,
|
|
809
|
+
to: f.to
|
|
810
810
|
});
|
|
811
|
-
t = { controller: c, direction: "in" }, (E = a.onReady) == null || E.call(a), await U(),
|
|
812
|
-
},
|
|
811
|
+
t = { controller: c, direction: "in" }, (E = a.onReady) == null || E.call(a), await U(), f.direction === "forward" ? c.forward() : c.backward();
|
|
812
|
+
}, u = async (y) => {
|
|
813
813
|
var E, b;
|
|
814
814
|
n = y;
|
|
815
815
|
const p = e(), k = !(i != null && i.strategy) && p.in ? p.in(y) : void 0, T = p.out && p.out(y);
|
|
@@ -818,12 +818,12 @@ function St(e, i) {
|
|
|
818
818
|
const w = {
|
|
819
819
|
in: k ? F(k) : void 0,
|
|
820
820
|
out: F(T)
|
|
821
|
-
},
|
|
822
|
-
if (!
|
|
821
|
+
}, f = await m.runOut(w);
|
|
822
|
+
if (!f.config) {
|
|
823
823
|
t && (t.direction = "out"), n && (n.remove(), n = null);
|
|
824
824
|
return;
|
|
825
825
|
}
|
|
826
|
-
const a =
|
|
826
|
+
const a = f.config;
|
|
827
827
|
g(), (E = a.prepare) == null || E.call(a);
|
|
828
828
|
const C = W(
|
|
829
829
|
{
|
|
@@ -836,12 +836,12 @@ function St(e, i) {
|
|
|
836
836
|
y
|
|
837
837
|
);
|
|
838
838
|
a.wait && await a.wait();
|
|
839
|
-
const c = D.fromState(
|
|
839
|
+
const c = D.fromState(f.state, {
|
|
840
840
|
config: C,
|
|
841
|
-
from:
|
|
842
|
-
to:
|
|
841
|
+
from: f.from,
|
|
842
|
+
to: f.to
|
|
843
843
|
});
|
|
844
|
-
t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await U(),
|
|
844
|
+
t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await U(), f.direction === "forward" ? c.forward() : c.backward();
|
|
845
845
|
function g() {
|
|
846
846
|
!r || !n || (o && r.contains(o) ? r.insertBefore(n, o) : r.appendChild(n));
|
|
847
847
|
}
|
|
@@ -852,21 +852,21 @@ function St(e, i) {
|
|
|
852
852
|
v = !0;
|
|
853
853
|
const p = y.cloneNode(!0);
|
|
854
854
|
h ? queueMicrotask(() => {
|
|
855
|
-
document.contains(h) &&
|
|
856
|
-
}) :
|
|
855
|
+
document.contains(h) && u(p);
|
|
856
|
+
}) : u(p);
|
|
857
857
|
};
|
|
858
858
|
return (y) => {
|
|
859
859
|
if (y)
|
|
860
860
|
return requestAnimationFrame(() => {
|
|
861
861
|
r = y.parentElement, o = y.nextElementSibling;
|
|
862
862
|
}), v = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
|
|
863
|
-
h =
|
|
863
|
+
h = pt(y), !(h && !wt(h)) && l(y);
|
|
864
864
|
}) : l(y), A(y);
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
867
|
const P = /* @__PURE__ */ new Map();
|
|
868
868
|
let I = null, q = !1;
|
|
869
|
-
function
|
|
869
|
+
function et(e) {
|
|
870
870
|
if (e instanceof HTMLElement && P.has(e)) {
|
|
871
871
|
const t = P.get(e);
|
|
872
872
|
P.delete(e), queueMicrotask(() => {
|
|
@@ -876,16 +876,16 @@ function tt(e) {
|
|
|
876
876
|
const i = e.childNodes;
|
|
877
877
|
for (let t = 0; t < i.length; t++) {
|
|
878
878
|
const n = i[t];
|
|
879
|
-
n &&
|
|
879
|
+
n && et(n);
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function Ct() {
|
|
883
883
|
q || typeof document > "u" || (q = !0, I = new MutationObserver((e) => {
|
|
884
884
|
for (const i of e) {
|
|
885
885
|
const t = i.removedNodes;
|
|
886
886
|
for (let n = 0; n < t.length; n++) {
|
|
887
887
|
const r = t[n];
|
|
888
|
-
r &&
|
|
888
|
+
r && et(r);
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
}), document.body ? I.observe(document.body, {
|
|
@@ -902,8 +902,8 @@ function At() {
|
|
|
902
902
|
{ once: !0 }
|
|
903
903
|
));
|
|
904
904
|
}
|
|
905
|
-
function
|
|
906
|
-
|
|
905
|
+
function Et(e, i) {
|
|
906
|
+
Ct(), P.set(e, i);
|
|
907
907
|
}
|
|
908
908
|
function Xt(e) {
|
|
909
909
|
return P.has(e);
|
|
@@ -919,13 +919,13 @@ function Kt() {
|
|
|
919
919
|
P.clear(), I == null || I.disconnect(), I = null, q = !1;
|
|
920
920
|
}
|
|
921
921
|
const O = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
|
|
922
|
-
function
|
|
922
|
+
function Tt(e, i, t) {
|
|
923
923
|
O.set(e, i);
|
|
924
924
|
let n = N.get(e);
|
|
925
925
|
if (n)
|
|
926
926
|
return n;
|
|
927
927
|
const r = i;
|
|
928
|
-
return n =
|
|
928
|
+
return n = At(
|
|
929
929
|
() => {
|
|
930
930
|
const o = O.get(e);
|
|
931
931
|
return o || (console.warn(`Transition "${String(e)}" not found`), {});
|
|
@@ -934,23 +934,23 @@ function Et(e, i, t) {
|
|
|
934
934
|
strategy: t == null ? void 0 : t.strategy,
|
|
935
935
|
scope: t == null ? void 0 : t.scope,
|
|
936
936
|
onCleanupEnd: () => {
|
|
937
|
-
O.get(e) === r &&
|
|
937
|
+
O.get(e) === r && bt(e);
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
940
|
), N.set(e, n), n;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function bt(e) {
|
|
943
943
|
O.delete(e), N.delete(e), X.delete(e);
|
|
944
944
|
}
|
|
945
945
|
function Ut(e, i = "manual") {
|
|
946
|
-
const t =
|
|
946
|
+
const t = Tt(
|
|
947
947
|
e.key,
|
|
948
948
|
{
|
|
949
949
|
in: e.in,
|
|
950
950
|
out: e.out
|
|
951
951
|
},
|
|
952
952
|
{
|
|
953
|
-
strategy: e[
|
|
953
|
+
strategy: e[J],
|
|
954
954
|
scope: e.scope
|
|
955
955
|
}
|
|
956
956
|
);
|
|
@@ -960,11 +960,11 @@ function Ut(e, i = "manual") {
|
|
|
960
960
|
return n || (n = (r) => {
|
|
961
961
|
if (r) {
|
|
962
962
|
const o = t(r);
|
|
963
|
-
o &&
|
|
963
|
+
o && Et(r, o);
|
|
964
964
|
}
|
|
965
965
|
}, X.set(e.key, n), n);
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function kt(e) {
|
|
968
968
|
const i = e.filter((t) => t.symmetric).map((t) => ({
|
|
969
969
|
from: t.to,
|
|
970
970
|
to: t.from,
|
|
@@ -981,7 +981,7 @@ function V(e, i) {
|
|
|
981
981
|
}
|
|
982
982
|
return e === i;
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function Rt(e, i, t) {
|
|
985
985
|
for (const n of t)
|
|
986
986
|
if (V(e, n.from) && V(i, n.to))
|
|
987
987
|
return n.transition;
|
|
@@ -990,18 +990,18 @@ function kt(e, i, t) {
|
|
|
990
990
|
return n.transition;
|
|
991
991
|
return null;
|
|
992
992
|
}
|
|
993
|
-
const
|
|
994
|
-
function
|
|
993
|
+
const It = 768, Pt = 10, Mt = 10;
|
|
994
|
+
function Vt(e = {}) {
|
|
995
995
|
const { preserveScroll: i = (c) => c } = e, t = typeof i == "function" ? i : () => i;
|
|
996
996
|
let n = null, r = !1, o = !1;
|
|
997
997
|
const s = () => {
|
|
998
998
|
const c = (n == null ? void 0 : n.clientWidth) ?? 0, g = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
|
|
999
|
-
return g > 0 && g <
|
|
1000
|
-
},
|
|
1001
|
-
const g = t(
|
|
999
|
+
return g > 0 && g < It;
|
|
1000
|
+
}, m = () => (o || (r = s(), o = !0), r), l = (c) => {
|
|
1001
|
+
const g = t(m());
|
|
1002
1002
|
return g === !1 ? !1 : g === !0 ? !0 : !g.exclude.some((E) => V(c, E));
|
|
1003
1003
|
};
|
|
1004
|
-
let
|
|
1004
|
+
let u = null;
|
|
1005
1005
|
const h = /* @__PURE__ */ new Map();
|
|
1006
1006
|
let v = null, A = !1, S = 0;
|
|
1007
1007
|
const y = () => {
|
|
@@ -1018,7 +1018,7 @@ function Mt(e = {}) {
|
|
|
1018
1018
|
n.scrollTo({
|
|
1019
1019
|
top: g.y,
|
|
1020
1020
|
left: g.x
|
|
1021
|
-
}), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && E <
|
|
1021
|
+
}), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && E < Pt && (E++, requestAnimationFrame(b));
|
|
1022
1022
|
};
|
|
1023
1023
|
requestAnimationFrame(b);
|
|
1024
1024
|
};
|
|
@@ -1026,14 +1026,14 @@ function Mt(e = {}) {
|
|
|
1026
1026
|
initializeContext: (c, g) => {
|
|
1027
1027
|
A = !0;
|
|
1028
1028
|
const E = ++S;
|
|
1029
|
-
|
|
1029
|
+
u = c, n || (n = vt(c), r = s(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
|
|
1030
1030
|
r = s();
|
|
1031
1031
|
}).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", y, {
|
|
1032
1032
|
passive: !0
|
|
1033
1033
|
})), v = g, p(g);
|
|
1034
1034
|
let b = 0;
|
|
1035
1035
|
const R = () => {
|
|
1036
|
-
E === S && (b++, b >=
|
|
1036
|
+
E === S && (b++, b >= Mt ? A = !1 : requestAnimationFrame(R));
|
|
1037
1037
|
};
|
|
1038
1038
|
requestAnimationFrame(R);
|
|
1039
1039
|
},
|
|
@@ -1049,25 +1049,25 @@ function Mt(e = {}) {
|
|
|
1049
1049
|
},
|
|
1050
1050
|
shouldPreserve: l,
|
|
1051
1051
|
getScrollContainer: () => n,
|
|
1052
|
-
getPositionedParentElement: () =>
|
|
1052
|
+
getPositionedParentElement: () => u ? St(u) : document.body,
|
|
1053
1053
|
getScrollPosition: (c) => c && h.has(c) ? h.get(c) : { x: 0, y: 0 }
|
|
1054
1054
|
};
|
|
1055
1055
|
}
|
|
1056
|
-
const j = 30, B = 8, Y = 1.2,
|
|
1056
|
+
const j = 30, B = 8, Y = 1.2, G = 30, xt = 600;
|
|
1057
1057
|
function Ft() {
|
|
1058
1058
|
let e = null, i = !1, t = !1, n = null, r = null, o = !1;
|
|
1059
|
-
const s = (w,
|
|
1059
|
+
const s = (w, f) => {
|
|
1060
1060
|
for (let a = 0; a < w.length; a++) {
|
|
1061
1061
|
const C = w.item(a);
|
|
1062
|
-
if (C && C.identifier ===
|
|
1062
|
+
if (C && C.identifier === f) return C;
|
|
1063
1063
|
}
|
|
1064
1064
|
return null;
|
|
1065
|
-
},
|
|
1065
|
+
}, m = () => {
|
|
1066
1066
|
n !== null && (clearTimeout(n), n = null);
|
|
1067
1067
|
}, l = () => {
|
|
1068
1068
|
r !== null && (clearTimeout(r), r = null);
|
|
1069
|
-
},
|
|
1070
|
-
i = !0, t = !0,
|
|
1069
|
+
}, u = () => {
|
|
1070
|
+
i = !0, t = !0, m(), l(), n = setTimeout(() => {
|
|
1071
1071
|
i = !1, t = !1, n = null;
|
|
1072
1072
|
}, xt);
|
|
1073
1073
|
}, h = (w) => {
|
|
@@ -1075,20 +1075,20 @@ function Ft() {
|
|
|
1075
1075
|
e = null;
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
|
-
const
|
|
1079
|
-
if (!
|
|
1078
|
+
const f = w.touches.item(0);
|
|
1079
|
+
if (!f) {
|
|
1080
1080
|
e = null;
|
|
1081
1081
|
return;
|
|
1082
1082
|
}
|
|
1083
|
-
const a = window.innerWidth, C =
|
|
1083
|
+
const a = window.innerWidth, C = f.clientX <= j, c = f.clientX >= a - j;
|
|
1084
1084
|
if (!C && !c) {
|
|
1085
1085
|
e = null;
|
|
1086
1086
|
return;
|
|
1087
1087
|
}
|
|
1088
1088
|
e = {
|
|
1089
|
-
identifier:
|
|
1090
|
-
startX:
|
|
1091
|
-
startY:
|
|
1089
|
+
identifier: f.identifier,
|
|
1090
|
+
startX: f.clientX,
|
|
1091
|
+
startY: f.clientY,
|
|
1092
1092
|
fromLeftEdge: C,
|
|
1093
1093
|
moved: !1
|
|
1094
1094
|
};
|
|
@@ -1098,12 +1098,12 @@ function Ft() {
|
|
|
1098
1098
|
e = null;
|
|
1099
1099
|
return;
|
|
1100
1100
|
}
|
|
1101
|
-
const
|
|
1102
|
-
if (!
|
|
1101
|
+
const f = s(w.touches, e.identifier);
|
|
1102
|
+
if (!f) {
|
|
1103
1103
|
e = null;
|
|
1104
1104
|
return;
|
|
1105
1105
|
}
|
|
1106
|
-
const a =
|
|
1106
|
+
const a = f.clientX - e.startX, C = f.clientY - e.startY, c = Math.abs(a), g = Math.abs(C);
|
|
1107
1107
|
if (g > B && g > c * Y) {
|
|
1108
1108
|
e = null;
|
|
1109
1109
|
return;
|
|
@@ -1112,15 +1112,19 @@ function Ft() {
|
|
|
1112
1112
|
c > B && c > g * Y && E && (e.moved = !0);
|
|
1113
1113
|
}, A = (w) => {
|
|
1114
1114
|
if (!e) return;
|
|
1115
|
-
const
|
|
1116
|
-
if (!
|
|
1115
|
+
const f = s(w.changedTouches, e.identifier);
|
|
1116
|
+
if (!f) {
|
|
1117
1117
|
e = null;
|
|
1118
1118
|
return;
|
|
1119
1119
|
}
|
|
1120
|
-
const a =
|
|
1121
|
-
e.moved && C && Math.abs(a) >=
|
|
1120
|
+
const a = f.clientX - e.startX, C = e.fromLeftEdge ? a > 0 : a < 0;
|
|
1121
|
+
if (e.moved && C && Math.abs(a) >= G) {
|
|
1122
|
+
u(), e = null;
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
e.moved && Math.abs(a) >= G && u(), e = null;
|
|
1122
1126
|
}, S = () => {
|
|
1123
|
-
e && (e.moved &&
|
|
1127
|
+
e && (e.moved && u(), e = null);
|
|
1124
1128
|
};
|
|
1125
1129
|
return { initialize: () => {
|
|
1126
1130
|
if (typeof window > "u" || o) return;
|
|
@@ -1131,12 +1135,12 @@ function Ft() {
|
|
|
1131
1135
|
if (typeof window > "u" || !o) return;
|
|
1132
1136
|
o = !1;
|
|
1133
1137
|
const w = { capture: !0 };
|
|
1134
|
-
window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", A, w), window.removeEventListener("touchcancel", S, w),
|
|
1138
|
+
window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", A, w), window.removeEventListener("touchcancel", S, w), m(), l(), e = null, i = !1, t = !1;
|
|
1135
1139
|
}, isSwipeBack: () => {
|
|
1136
1140
|
const w = i || t;
|
|
1137
|
-
return w &&
|
|
1141
|
+
return w && m(), w;
|
|
1138
1142
|
}, onPageEnter: () => {
|
|
1139
|
-
i = !1,
|
|
1143
|
+
i = !1, m(), l(), r = setTimeout(() => {
|
|
1140
1144
|
t = !1, r = null;
|
|
1141
1145
|
}, 0);
|
|
1142
1146
|
} };
|
|
@@ -1191,11 +1195,11 @@ function jt(e, i) {
|
|
|
1191
1195
|
const {
|
|
1192
1196
|
transitions: t = [],
|
|
1193
1197
|
defaultTransition: n,
|
|
1194
|
-
middleware: r = (
|
|
1198
|
+
middleware: r = (f, a) => ({ from: f, to: a }),
|
|
1195
1199
|
// Identity function as default
|
|
1196
|
-
preserveScroll: o = (
|
|
1197
|
-
} = e, { outFirst: s = !0 } = i || {},
|
|
1198
|
-
|
|
1200
|
+
preserveScroll: o = (f) => f
|
|
1201
|
+
} = e, { outFirst: s = !0 } = i || {}, m = s ? Lt() : Ot(), l = kt(t), u = Ft();
|
|
1202
|
+
u.initialize();
|
|
1199
1203
|
const {
|
|
1200
1204
|
initializeContext: h,
|
|
1201
1205
|
calculateScrollOffset: v,
|
|
@@ -1204,19 +1208,19 @@ function jt(e, i) {
|
|
|
1204
1208
|
getScrollContainer: y,
|
|
1205
1209
|
getPositionedParentElement: p,
|
|
1206
1210
|
getScrollPosition: k
|
|
1207
|
-
} =
|
|
1211
|
+
} = Vt({
|
|
1208
1212
|
preserveScroll: o
|
|
1209
|
-
}), T = async (
|
|
1210
|
-
const C =
|
|
1211
|
-
|
|
1212
|
-
const c = await
|
|
1213
|
-
if (a === "in" &&
|
|
1213
|
+
}), T = async (f, a) => {
|
|
1214
|
+
const C = u.isSwipeBack();
|
|
1215
|
+
m.trigger(f, a);
|
|
1216
|
+
const c = await m.get(a);
|
|
1217
|
+
if (a === "in" && u.onPageEnter(), !c) return () => ({});
|
|
1214
1218
|
if (C)
|
|
1215
1219
|
return a === "out" && c.from && !S(c.from) && A(c.from), () => ({});
|
|
1216
1220
|
const { from: g, to: E } = r(
|
|
1217
1221
|
c.from,
|
|
1218
1222
|
c.to
|
|
1219
|
-
), R =
|
|
1223
|
+
), R = Rt(
|
|
1220
1224
|
g,
|
|
1221
1225
|
E,
|
|
1222
1226
|
l
|
|
@@ -1251,30 +1255,30 @@ function jt(e, i) {
|
|
|
1251
1255
|
return (_) => R.in(_, x);
|
|
1252
1256
|
}
|
|
1253
1257
|
};
|
|
1254
|
-
return (
|
|
1255
|
-
key:
|
|
1256
|
-
in: async (a) => (h(a,
|
|
1257
|
-
out: async (a) => (await T(
|
|
1258
|
+
return (f) => ({
|
|
1259
|
+
key: f,
|
|
1260
|
+
in: async (a) => (h(a, f), (await T(f, "in"))(a)),
|
|
1261
|
+
out: async (a) => (await T(f, "out"))(a),
|
|
1258
1262
|
// Add page transition strategy for page-level transitions
|
|
1259
|
-
[
|
|
1263
|
+
[J]: yt
|
|
1260
1264
|
});
|
|
1261
1265
|
}
|
|
1262
1266
|
export {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1267
|
+
Q as SCOPE_ATTR,
|
|
1268
|
+
tt as SCOPE_READY_ATTR,
|
|
1269
|
+
J as TRANSITION_STRATEGY,
|
|
1266
1270
|
Ot as createAnyOrderDetector,
|
|
1267
|
-
|
|
1271
|
+
gt as createDefaultStrategy,
|
|
1268
1272
|
Lt as createOutFirstDetector,
|
|
1269
|
-
|
|
1273
|
+
yt as createPageTransitionStrategy,
|
|
1270
1274
|
jt as createSggoiTransitionContext,
|
|
1271
1275
|
Nt as createTransitionScope,
|
|
1272
|
-
|
|
1276
|
+
pt as findScope,
|
|
1273
1277
|
Wt as getWatchedCount,
|
|
1274
1278
|
Gt as isCssAnimation,
|
|
1275
1279
|
$t as isKeyframesAnimation,
|
|
1276
1280
|
Zt as isMultiAnimation,
|
|
1277
|
-
|
|
1281
|
+
wt as isScopeReady,
|
|
1278
1282
|
Jt as isSingleAnimation,
|
|
1279
1283
|
Qt as isTickAnimation,
|
|
1280
1284
|
Xt as isWatched,
|
|
@@ -1283,5 +1287,5 @@ export {
|
|
|
1283
1287
|
Kt as resetObserver,
|
|
1284
1288
|
Ut as transition,
|
|
1285
1289
|
Ht as triggerUnmount,
|
|
1286
|
-
|
|
1290
|
+
Et as watchUnmount
|
|
1287
1291
|
};
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
* → settle as a swipe.
|
|
22
22
|
* touchcancel after horizontal commitment also counts: the browser took the
|
|
23
23
|
* gesture over, which is exactly what edge-swipe-back does on iOS.
|
|
24
|
+
* In some environments (notably iOS WKWebView), the OS commits the gesture
|
|
25
|
+
* and dispatches `touchend` instead of `touchcancel`, with `clientX`
|
|
26
|
+
* reported in the now document-translated coordinate space — `dx` flips
|
|
27
|
+
* sign and fails the in-direction recheck above. When the in-direction
|
|
28
|
+
* check fails but `|dx| ≥ FINAL_DISTANCE` and `moved` was set during
|
|
29
|
+
* touchmove, treat it as the same takeover signal: the magnitude survives
|
|
30
|
+
* translation, while keeping the FINAL_DISTANCE floor rejects weak or
|
|
31
|
+
* cancelled gestures, matching pre-patch behavior in normal browsers.
|
|
24
32
|
*
|
|
25
33
|
* Settling arms an "active" flag. The flag auto-expires after EXPIRE_WINDOW so
|
|
26
34
|
* a successful gesture that wasn't actually a navigation (e.g. user dragged a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-swipe-back-detector.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-swipe-back-detector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"create-swipe-back-detector.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-swipe-back-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAkBH,wBAAgB,uBAAuB;;;;;EAyMtC"}
|