@ssgoi/core 3.1.1 → 3.1.2
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 +2 -2
- package/dist/index.js +43 -38
- package/dist/transition/transition.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var J=Object.defineProperty;var Q=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./types.cjs"),Z=require("./jaemin-BG8HRXG1.cjs");class tt{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 e=Date.now();let i=e-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=e;const r=e-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(c=>{c(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(e){return this.listeners.add(e),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(e)}}unsubscribe(e){this.listeners.delete(e),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(e,t){this.lagThreshold=e,this.adjustedLag=Math.min(t,e)}fps(e){this.gap=1e3/e,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const I=new tt;function N(n){const e=n.stiffness,t=n.damping,i=1,r=Math.sqrt(e/i),o=t/(2*Math.sqrt(e*i));return{omega:r,zeta:o}}function Y(n,e,t,i){const{omega:r,zeta:o}=t,{position:s,velocity:c}=n,a=Math.min(i,.033),l=-2*a*o*r*c,f=a*r*r*(e-s),w=c+l+f;return{position:s+a*w,velocity:w}}const et=.01,it=.01,H=.05;function j(n,e){const t=Math.abs(e-n.position),i=Math.abs(n.velocity);return t<et&&i<it}function nt(n){const{from:e,to:t,spring:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:c}=n;let a={position:e,velocity:r},l=!0,f=0,w=!1;const u=N(i),h=p=>{if(l){if(w||(w=!0,c==null||c()),a=Y(a,t,u,p),j(a,t)){if(f+=Math.min(p,.033),f>=H){a={position:t,velocity:0},l=!1,o(a.position),I.unsubscribe(h),s();return}}else f=0;o(a.position)}};return I.subscribe(h),{stop:()=>{l&&(l=!1,I.unsubscribe(h))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>l}}const b=1e3/60;function ot(n,e,t,i=0){const r=N(t),o=600;let s={position:n,velocity:i},c=0;const a=[];for(let l=0;l<o;l++){const f=l*b;if(a.push({time:f,position:s.position,velocity:s.velocity}),s=Y(s,e,r,b/1e3),j(s,e)){if(c+=b/1e3,c>=H){a.push({time:(l+1)*b,position:e,velocity:0});break}}else c=0}return a}function D(n,e){if(n.length===0)return{position:0,velocity:0};const t=n[0],i=n[n.length-1];if(e<=0)return{position:t.position,velocity:t.velocity};if(e>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=n.length-1;for(;r<o-1;){const l=Math.floor((r+o)/2);n[l].time<=e?r=l:o=l}const s=n[r],c=n[o],a=(e-s.time)/(c.time-s.time);return{position:s.position+(c.position-s.position)*a,velocity:s.velocity+(c.velocity-s.velocity)*a}}function rt(n,e){return n.map(t=>e(t.position))}function st(n){const{element:e,from:t,to:i,spring:r,velocity:o=0,style:s,onComplete:c,onStart:a}=n,l=ot(t,i,r,o);if(l.length===0)return a==null||a(),c(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1};const f=rt(l,s),w=l[l.length-1],u=w.time,h=e.animate(f,{duration:u,fill:"forwards",easing:"linear"});let p=!0;const S=performance.now();return a==null||a(),h.onfinish=()=>{p&&(p=!1,c())},{stop:()=>{p&&(p=!1,h.cancel())},getPosition:()=>{if(!p)return w.position;const y=performance.now()-S;return D(l,y).position},getVelocity:()=>{if(!p)return 0;const y=performance.now()-S;return D(l,y).velocity},isRunning:()=>p}}function at(n){const{from:e,to:t,spring:i,velocity:r,onComplete:o,onStart:s,tick:c,css:a}=n;if(c&&a)throw new Error("Cannot use both 'tick' and 'css' options together");return!c&&!a?(s==null||s(),o(),{stop:()=>{},getPosition:()=>t,getVelocity:()=>0,isRunning:()=>!1}):a?st({element:a.element,from:e,to:t,spring:i,velocity:r,style:a.style,onComplete:o,onStart:s}):nt({from:e,to:t,spring:i,velocity:r,onUpdate:c,onComplete:o,onStart:s})}class X{}class M extends X{constructor(t){super();d(this,"options");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);if(t.tick&&t.css)throw new Error("Cannot use both 'tick' and 'css' options together");this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:300,damping:30},tick:t.tick,css:t.css,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from}runAnimation(t){this.isAnimating=!0,this.controls=at({from:this.currentValue,to:t,spring:this.options.spring,velocity:this.currentVelocity,tick:this.options.tick,css:this.options.css,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}}static fromState(t,i){const r=new M(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}class V extends X{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"springOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"element");d(this,"from");d(this,"to");this.config=t.config,this.from=t.from,this.to=t.to,this.element=t.element,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const i=this.generateId(),r=new M({from:this.from,to:this.to,spring:t.spring,tick:t.tick,css:t.css&&this.element?{element:this.element,style:t.css}:void 0,onComplete:()=>this.onAnimatorComplete(i),onStart:t.onStart});this.animators.set(i,{id:i,item:t,animator:r,started:!1}),this.springOrder.push(i)})}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.springOrder:[...this.springOrder].reverse()}onAnimatorComplete(t){var r,o,s,c,a,l;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),(c=(s=this.config).onProgress)==null||c.call(s,this.completedCount,this.config.springs.length),this.completedCount===this.config.springs.length&&(this.stopScheduler(),(l=(a=this.config).onEnd)==null||l.call(a)))}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],c=this.animators.get(s);if(!c||!c.started)continue;const a=this.getAnimatorProgress(c),l=o.item.normalizedOffset;a>=l&&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.springOrder[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=t.item.css&&this.element?{element:this.element,style:t.item.css}:void 0,s=M.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,spring:t.item.spring,tick:t.item.tick,css:o,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});s.forward(),t.animator=s}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){const r=new V(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}const x=Symbol.for("TRANSITION_STRATEGY"),$=n=>({runIn:async e=>{const{currentAnimation:t}=n;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),e.out)return{config:await e.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return 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=>{const{currentAnimation:t}=n;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),e.in)return{config:await e.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return 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"}}}),K=()=>({runIn:async n=>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=>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"}}),F="data-ssgoi-scope",z="data-ssgoi-scope-ready";function ct(){return n=>{if(n)return n.setAttribute(F,""),queueMicrotask(()=>{queueMicrotask(()=>{n.setAttribute(z,"true")})}),()=>{}}}function W(n){return n.hasAttribute(z)}function U(n){return n.closest(`[${F}]`)}function lt(n,e){var w;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},c=((w=e==null?void 0:e.strategy)==null?void 0:w.call(e,s))||$(s),a=async u=>{var E;i&&(i.remove(),i=null);const h=n(),p=h.in&&h.in(u),S=!(e!=null&&e.strategy)&&h.out?h.out(u):void 0;if(!p)return;const y={in:v.normalizeToMultiSpring(p),out:S?v.normalizeToMultiSpring(S):void 0},m=await c.runIn(y);if(!m.config){t&&(t.direction="in");return}const g=m.config;(E=g.prepare)==null||E.call(g,u),g.wait&&await g.wait();const A=v.normalizeMultiSpringSchedule({...g,onEnd:()=>{var T;t=null,(T=g.onEnd)==null||T.call(g)}}),C=V.fromState(m.state,{config:A,from:m.from,to:m.to,element:u});t={controller:C,direction:"in"},m.direction==="forward"?C.forward():C.backward()},l=async u=>{var T;i=u;const h=n(),p=!(e!=null&&e.strategy)&&h.in?h.in(u):void 0,S=h.out&&h.out(u);if(!S)return;const y={in:p?v.normalizeToMultiSpring(p):void 0,out:v.normalizeToMultiSpring(S)},m=await c.runOut(y);if(!m.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const g=m.config;(T=g.prepare)==null||T.call(g,u),E(),g.wait&&await g.wait();const A=v.normalizeMultiSpringSchedule({...g,onEnd:()=>{var R,_;(R=g.onEnd)==null||R.call(g),i&&(i.remove(),i=null),t=null,(_=e==null?void 0:e.onCleanupEnd)==null||_.call(e)}}),C=V.fromState(m.state,{config:A,from:m.from,to:m.to,element:u});t={controller:C,direction:"out"},m.direction==="forward"?C.forward():C.backward();function E(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let f=null;return u=>{if(u)return r=u.parentElement,o=u.nextElementSibling,(e==null?void 0:e.scope)==="local"?queueMicrotask(()=>{f=U(u),!(f&&!W(f))&&a(u)}):a(u),()=>{const h=u.isConnected?u.cloneNode(!0):u;f?queueMicrotask(()=>{document.contains(f)&&l(h)}):l(h)}}}const ut=3,ft=n=>{if(!n)return null;const e=n.split(`
|
|
2
|
-
`).map(t=>t.trim());for(let t=ut;t<Math.min(e.length,6);t++){const i=e[t],r=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const o=r[1]??"",s=r[2]??"0",c=r[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:s,column:c}}return null},
|
|
1
|
+
"use strict";var J=Object.defineProperty;var Q=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./types.cjs"),Z=require("./jaemin-BG8HRXG1.cjs");class tt{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 e=Date.now();let i=e-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=e;const r=e-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(c=>{c(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(e){return this.listeners.add(e),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(e)}}unsubscribe(e){this.listeners.delete(e),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(e,t){this.lagThreshold=e,this.adjustedLag=Math.min(t,e)}fps(e){this.gap=1e3/e,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const P=new tt;function N(n){const e=n.stiffness,t=n.damping,i=1,r=Math.sqrt(e/i),o=t/(2*Math.sqrt(e*i));return{omega:r,zeta:o}}function Y(n,e,t,i){const{omega:r,zeta:o}=t,{position:s,velocity:c}=n,a=Math.min(i,.033),l=-2*a*o*r*c,f=a*r*r*(e-s),w=c+l+f;return{position:s+a*w,velocity:w}}const et=.01,it=.01,H=.05;function j(n,e){const t=Math.abs(e-n.position),i=Math.abs(n.velocity);return t<et&&i<it}function nt(n){const{from:e,to:t,spring:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:c}=n;let a={position:e,velocity:r},l=!0,f=0,w=!1;const u=N(i),h=p=>{if(l){if(w||(w=!0,c==null||c()),a=Y(a,t,u,p),j(a,t)){if(f+=Math.min(p,.033),f>=H){a={position:t,velocity:0},l=!1,o(a.position),P.unsubscribe(h),s();return}}else f=0;o(a.position)}};return P.subscribe(h),{stop:()=>{l&&(l=!1,P.unsubscribe(h))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>l}}const b=1e3/60;function ot(n,e,t,i=0){const r=N(t),o=600;let s={position:n,velocity:i},c=0;const a=[];for(let l=0;l<o;l++){const f=l*b;if(a.push({time:f,position:s.position,velocity:s.velocity}),s=Y(s,e,r,b/1e3),j(s,e)){if(c+=b/1e3,c>=H){a.push({time:(l+1)*b,position:e,velocity:0});break}}else c=0}return a}function D(n,e){if(n.length===0)return{position:0,velocity:0};const t=n[0],i=n[n.length-1];if(e<=0)return{position:t.position,velocity:t.velocity};if(e>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=n.length-1;for(;r<o-1;){const l=Math.floor((r+o)/2);n[l].time<=e?r=l:o=l}const s=n[r],c=n[o],a=(e-s.time)/(c.time-s.time);return{position:s.position+(c.position-s.position)*a,velocity:s.velocity+(c.velocity-s.velocity)*a}}function rt(n,e){return n.map(t=>e(t.position))}function st(n){const{element:e,from:t,to:i,spring:r,velocity:o=0,style:s,onComplete:c,onStart:a}=n,l=ot(t,i,r,o);if(l.length===0)return a==null||a(),c(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1};const f=rt(l,s),w=l[l.length-1],u=w.time,h=e.animate(f,{duration:u,fill:"forwards",easing:"linear"});let p=!0;const S=performance.now();return a==null||a(),h.onfinish=()=>{p&&(p=!1,c())},{stop:()=>{p&&(p=!1,h.cancel())},getPosition:()=>{if(!p)return w.position;const y=performance.now()-S;return D(l,y).position},getVelocity:()=>{if(!p)return 0;const y=performance.now()-S;return D(l,y).velocity},isRunning:()=>p}}function at(n){const{from:e,to:t,spring:i,velocity:r,onComplete:o,onStart:s,tick:c,css:a}=n;if(c&&a)throw new Error("Cannot use both 'tick' and 'css' options together");return!c&&!a?(s==null||s(),o(),{stop:()=>{},getPosition:()=>t,getVelocity:()=>0,isRunning:()=>!1}):a?st({element:a.element,from:e,to:t,spring:i,velocity:r,style:a.style,onComplete:o,onStart:s}):nt({from:e,to:t,spring:i,velocity:r,onUpdate:c,onComplete:o,onStart:s})}class X{}class V extends X{constructor(t){super();d(this,"options");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);if(t.tick&&t.css)throw new Error("Cannot use both 'tick' and 'css' options together");this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:300,damping:30},tick:t.tick,css:t.css,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from}runAnimation(t){this.isAnimating=!0,this.controls=at({from:this.currentValue,to:t,spring:this.options.spring,velocity:this.currentVelocity,tick:this.options.tick,css:this.options.css,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}}static fromState(t,i){const r=new V(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}class I extends X{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"springOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"element");d(this,"from");d(this,"to");this.config=t.config,this.from=t.from,this.to=t.to,this.element=t.element,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const i=this.generateId(),r=new V({from:this.from,to:this.to,spring:t.spring,tick:t.tick,css:t.css&&this.element?{element:this.element,style:t.css}:void 0,onComplete:()=>this.onAnimatorComplete(i),onStart:t.onStart});this.animators.set(i,{id:i,item:t,animator:r,started:!1}),this.springOrder.push(i)})}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.springOrder:[...this.springOrder].reverse()}onAnimatorComplete(t){var r,o,s,c,a,l;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),(c=(s=this.config).onProgress)==null||c.call(s,this.completedCount,this.config.springs.length),this.completedCount===this.config.springs.length&&(this.stopScheduler(),(l=(a=this.config).onEnd)==null||l.call(a)))}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],c=this.animators.get(s);if(!c||!c.started)continue;const a=this.getAnimatorProgress(c),l=o.item.normalizedOffset;a>=l&&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.springOrder[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=t.item.css&&this.element?{element:this.element,style:t.item.css}:void 0,s=V.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,spring:t.item.spring,tick:t.item.tick,css:o,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});s.forward(),t.animator=s}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){const r=new I(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}const x=Symbol.for("TRANSITION_STRATEGY"),$=n=>({runIn:async e=>{const{currentAnimation:t}=n;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),e.out)return{config:await e.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return 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=>{const{currentAnimation:t}=n;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),e.in)return{config:await e.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return 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"}}}),K=()=>({runIn:async n=>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=>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"}}),F="data-ssgoi-scope",z="data-ssgoi-scope-ready";function ct(){return n=>{if(n)return n.setAttribute(F,""),queueMicrotask(()=>{queueMicrotask(()=>{n.setAttribute(z,"true")})}),()=>{}}}function W(n){return n.hasAttribute(z)}function U(n){return n.closest(`[${F}]`)}function lt(n,e){var w;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},c=((w=e==null?void 0:e.strategy)==null?void 0:w.call(e,s))||$(s),a=async u=>{var E;i&&(i.remove(),i=null);const h=n(),p=h.in&&h.in(u),S=!(e!=null&&e.strategy)&&h.out?h.out(u):void 0;if(!p)return;const y={in:v.normalizeToMultiSpring(p),out:S?v.normalizeToMultiSpring(S):void 0},m=await c.runIn(y);if(!m.config){t&&(t.direction="in");return}const g=m.config;(E=g.prepare)==null||E.call(g,u),g.wait&&await g.wait();const A=v.normalizeMultiSpringSchedule({...g,onEnd:()=>{var T;t=null,(T=g.onEnd)==null||T.call(g)}}),C=I.fromState(m.state,{config:A,from:m.from,to:m.to,element:u});t={controller:C,direction:"in"},m.direction==="forward"?C.forward():C.backward()},l=async u=>{var T;i=u;const h=n(),p=!(e!=null&&e.strategy)&&h.in?h.in(u):void 0,S=h.out&&h.out(u);if(!S)return;const y={in:p?v.normalizeToMultiSpring(p):void 0,out:v.normalizeToMultiSpring(S)},m=await c.runOut(y);if(!m.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const g=m.config;(T=g.prepare)==null||T.call(g,u),E(),g.wait&&await g.wait();const A=v.normalizeMultiSpringSchedule({...g,onEnd:()=>{var R,_;(R=g.onEnd)==null||R.call(g),i&&(i.remove(),i=null),t=null,(_=e==null?void 0:e.onCleanupEnd)==null||_.call(e)}}),C=I.fromState(m.state,{config:A,from:m.from,to:m.to,element:u});t={controller:C,direction:"out"},m.direction==="forward"?C.forward():C.backward();function E(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let f=null;return u=>{if(u)return r=u.parentElement,o=u.nextElementSibling,(e==null?void 0:e.scope)==="local"?queueMicrotask(()=>{f=U(u),!(f&&!W(f))&&a(u)}):a(u),()=>{const h=u.isConnected?u.cloneNode(!0):u;f?queueMicrotask(()=>{document.contains(f)&&l(h)}):l(h)}}}const ut=3,ft=n=>{if(!n)return null;const e=n.split(`
|
|
2
|
+
`).map(t=>t.trim());for(let t=ut;t<Math.min(e.length,6);t++){const i=e[t],r=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const o=r[1]??"",s=r[2]??"0",c=r[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:s,column:c}}return null},M=new Map,O=new Map;function dt(n,e,t){M.set(n,e);let i=O.get(n);if(i)return i;const r=e;return i=lt(()=>{const o=M.get(n);return o||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{M.get(n)===r&&G(n)}}),O.set(n,i),i}function G(n){M.delete(n),O.delete(n)}function B(){const n=ft(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const L=globalThis.FinalizationRegistry,q=L?new L(n=>{try{G(n)}catch{}}):void 0;function mt(n){const e=n.key??B();if(n.ref&&q)try{q.register(n.ref,e)}catch{}return dt(e,{in:n.in,out:n.out},{strategy:n[x],scope:n.scope})}function ht(n){const e=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...e]}function gt(n){let e=!1,t=0,i=0,r=!1;const o=50,s=p=>{if(!n)return;const S=p.touches[0];S&&(r=S.clientX<o,r&&(t=S.clientX,i=S.clientY))},c=p=>{if(!n||!r)return;const S=p.touches[0];if(!S)return;const y=S.clientX-t,m=S.clientY-i;y>window.outerWidth/2-5&&Math.abs(y)>Math.abs(m)?e=!0:e=!1},a=()=>{n&&(r=!1,t=0,i=0)},l=()=>e,f=()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",s,{passive:!0}),window.addEventListener("touchmove",c,{passive:!0}),window.addEventListener("touchend",a,{passive:!0}))},w=()=>{typeof window>"u"||(window.removeEventListener("touchstart",s),window.removeEventListener("touchmove",c),window.removeEventListener("touchend",a))};let u=0;return{initialize:f,cleanup:w,isSwipePending:l,resetSwipeDetection:()=>{u++,u>1&&(u=0,e=!1)}}}const pt=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e),i=t.overflow+t.overflowY+t.overflowX;if(i.includes("auto")||i.includes("scroll")||e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.parentElement}return document.documentElement},wt=n=>{let e=n.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return e;e=e.parentElement}return document.body};function yt(){let n=null,e=null;const t=new Map;let i=null;const r=()=>{n&&i&&t.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(f,w)=>{e=f,n||(n=pt(f),(n===document.documentElement?window:n).addEventListener("scroll",r,{passive:!0})),i=w},calculateScrollOffset:(f,w)=>{const u=f&&t.has(f)?t.get(f):{x:0,y:0},h=w&&t.has(w)?t.get(w):{x:0,y:0};return{x:-h.x+u.x,y:-h.y+u.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>e?wt(e):document.body,getScrollPosition:f=>f&&t.has(f)?t.get(f):{x:0,y:0}}}function k(n,e){if(e==="*")return!0;if(e.endsWith("/*")){const t=e.slice(0,-2);return n===t||n.startsWith(t+"/")}return n===e}function St(n,e,t){for(const i of t)if(k(n,i.from)&&k(e,i.to))return i.transition;for(const i of t)if((i.from==="*"||k(n,i.from))&&(i.to==="*"||k(e,i.to)))return i.transition;return null}function vt(n){const{transitions:e=[],defaultTransition:t,middleware:i=(y,m)=>({from:y,to:m}),skipOnIosSwipe:r=!0}=n;let o=null;const s=ht(e),{initializeContext:c,calculateScrollOffset:a,getScrollContainer:l,getPositionedParentElement:f,getScrollPosition:w}=yt(),u=gt(r);u.initialize();function h(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:y,to:m}=i(o.from,o.to),A=St(y,m,s)||t,C=a(o.from,o.to),E={scrollOffset:C,scroll:w(o.from),get scrollingElement(){return l()||document.documentElement},get positionedParent(){return f()}},T={scrollOffset:C,get scroll(){return o?w(o.to):{x:0,y:0}},get scrollingElement(){return l()||document.documentElement},get positionedParent(){return f()}};A&&(A.out&&o.outResolve&&o.outResolve(R=>A.out(R,E)),A.in&&o.inResolve&&o.inResolve(R=>A.in(R,T))),o=null}}const p=async(y,m)=>u.isSwipePending()?(u.resetSwipeDetection(),()=>({})):m==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),m==="out"?(o.from=y,new Promise(g=>{o.outResolve=g,h()})):(o.to=y,new Promise(g=>{o.inResolve=g,h()})));return y=>({key:y,in:async m=>(c(m,y),(await p(y,"in"))(m)),out:async m=>(await p(y,"out"))(m),[x]:K})}exports.isCssAnimation=v.isCssAnimation;exports.isMultiSpring=v.isMultiSpring;exports.isSingleSpring=v.isSingleSpring;exports.isTickAnimation=v.isTickAnimation;exports.normalizeMultiSpringSchedule=v.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=v.normalizeToMultiSpring;exports.validateAnimationMode=v.validateAnimationMode;exports.validateSpringItem=v.validateSpringItem;exports.jaeminInternal=Z.jaeminInternal;exports.SCOPE_ATTR=F;exports.SCOPE_READY_ATTR=z;exports.TRANSITION_STRATEGY=x;exports.createDefaultStrategy=$;exports.createPageTransitionStrategy=K;exports.createSggoiTransitionContext=vt;exports.createTransitionScope=ct;exports.findScope=U;exports.generateAutoKey=B;exports.isScopeReady=W;exports.transition=mt;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var K = Object.defineProperty;
|
|
2
2
|
var U = (n, e, t) => e in n ? K(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var d = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { normalizeToMultiSpring as
|
|
5
|
-
import { isCssAnimation as
|
|
4
|
+
import { normalizeToMultiSpring as V, normalizeMultiSpringSchedule as F } from "./types.js";
|
|
5
|
+
import { isCssAnimation as Vt, isMultiSpring as bt, isSingleSpring as kt, isTickAnimation as Rt, validateAnimationMode as It, validateSpringItem as Pt } from "./types.js";
|
|
6
6
|
import { j as Mt } from "./jaemin-BWkrXq0V.js";
|
|
7
7
|
class G {
|
|
8
8
|
constructor() {
|
|
@@ -68,7 +68,7 @@ class G {
|
|
|
68
68
|
return this.elapsed;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const x = new G();
|
|
72
72
|
function z(n) {
|
|
73
73
|
const e = n.stiffness, t = n.damping, i = 1, r = Math.sqrt(e / i), o = t / (2 * Math.sqrt(e * i));
|
|
74
74
|
return { omega: r, zeta: o };
|
|
@@ -100,7 +100,7 @@ function Q(n) {
|
|
|
100
100
|
if (l) {
|
|
101
101
|
if (w || (w = !0, a == null || a()), c = q(c, t, u, p), N(c, t)) {
|
|
102
102
|
if (f += Math.min(p, 0.033), f >= H) {
|
|
103
|
-
c = { position: t, velocity: 0 }, l = !1, o(c.position),
|
|
103
|
+
c = { position: t, velocity: 0 }, l = !1, o(c.position), x.unsubscribe(h), s();
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
} else
|
|
@@ -108,30 +108,30 @@ function Q(n) {
|
|
|
108
108
|
o(c.position);
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
return
|
|
111
|
+
return x.subscribe(h), {
|
|
112
112
|
stop: () => {
|
|
113
|
-
l && (l = !1,
|
|
113
|
+
l && (l = !1, x.unsubscribe(h));
|
|
114
114
|
},
|
|
115
115
|
getPosition: () => c.position,
|
|
116
116
|
getVelocity: () => c.velocity,
|
|
117
117
|
isRunning: () => l
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const b = 1e3 / 60;
|
|
121
121
|
function Z(n, e, t, i = 0) {
|
|
122
122
|
const r = z(t), o = 600;
|
|
123
123
|
let s = { position: n, velocity: i }, a = 0;
|
|
124
124
|
const c = [];
|
|
125
125
|
for (let l = 0; l < o; l++) {
|
|
126
|
-
const f = l *
|
|
126
|
+
const f = l * b;
|
|
127
127
|
if (c.push({
|
|
128
128
|
time: f,
|
|
129
129
|
position: s.position,
|
|
130
130
|
velocity: s.velocity
|
|
131
|
-
}), s = q(s, e, r,
|
|
132
|
-
if (a +=
|
|
131
|
+
}), s = q(s, e, r, b / 1e3), N(s, e)) {
|
|
132
|
+
if (a += b / 1e3, a >= H) {
|
|
133
133
|
c.push({
|
|
134
|
-
time: (l + 1) *
|
|
134
|
+
time: (l + 1) * b,
|
|
135
135
|
position: e,
|
|
136
136
|
velocity: 0
|
|
137
137
|
});
|
|
@@ -243,7 +243,7 @@ function it(n) {
|
|
|
243
243
|
}
|
|
244
244
|
class Y {
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class I extends Y {
|
|
247
247
|
constructor(t) {
|
|
248
248
|
super();
|
|
249
249
|
d(this, "options");
|
|
@@ -320,11 +320,11 @@ class R extends Y {
|
|
|
320
320
|
this.options = { ...this.options, ...t };
|
|
321
321
|
}
|
|
322
322
|
static fromState(t, i) {
|
|
323
|
-
const r = new
|
|
323
|
+
const r = new I(i);
|
|
324
324
|
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
class
|
|
327
|
+
class P extends Y {
|
|
328
328
|
constructor(t) {
|
|
329
329
|
super();
|
|
330
330
|
d(this, "config");
|
|
@@ -345,7 +345,7 @@ class I extends Y {
|
|
|
345
345
|
}
|
|
346
346
|
initializeAnimators() {
|
|
347
347
|
this.config.springs.forEach((t) => {
|
|
348
|
-
const i = this.generateId(), r = new
|
|
348
|
+
const i = this.generateId(), r = new I({
|
|
349
349
|
from: this.from,
|
|
350
350
|
to: this.to,
|
|
351
351
|
spring: t.spring,
|
|
@@ -447,7 +447,7 @@ class I extends Y {
|
|
|
447
447
|
return;
|
|
448
448
|
const i = t.animator.getCurrentState();
|
|
449
449
|
if (i.position === i.to) {
|
|
450
|
-
const o = t.item.css && this.element ? { element: this.element, style: t.item.css } : void 0, s =
|
|
450
|
+
const o = t.item.css && this.element ? { element: this.element, style: t.item.css } : void 0, s = I.fromState(
|
|
451
451
|
{ position: this.to, velocity: 0 },
|
|
452
452
|
{
|
|
453
453
|
from: this.to,
|
|
@@ -517,7 +517,7 @@ class I extends Y {
|
|
|
517
517
|
* Uses first animator's state for initialization
|
|
518
518
|
*/
|
|
519
519
|
static fromState(t, i) {
|
|
520
|
-
const r = new
|
|
520
|
+
const r = new P(i);
|
|
521
521
|
return r.setValue(t.position), r.setVelocity(t.velocity), r;
|
|
522
522
|
}
|
|
523
523
|
}
|
|
@@ -657,8 +657,8 @@ function ct(n, e) {
|
|
|
657
657
|
if (!p)
|
|
658
658
|
return;
|
|
659
659
|
const y = {
|
|
660
|
-
in:
|
|
661
|
-
out: v ?
|
|
660
|
+
in: V(p),
|
|
661
|
+
out: v ? V(v) : void 0
|
|
662
662
|
}, m = await a.runIn(y);
|
|
663
663
|
if (!m.config) {
|
|
664
664
|
t && (t.direction = "in");
|
|
@@ -672,7 +672,7 @@ function ct(n, e) {
|
|
|
672
672
|
var A;
|
|
673
673
|
t = null, (A = g.onEnd) == null || A.call(g);
|
|
674
674
|
}
|
|
675
|
-
}), S =
|
|
675
|
+
}), S = P.fromState(m.state, {
|
|
676
676
|
config: C,
|
|
677
677
|
from: m.from,
|
|
678
678
|
to: m.to,
|
|
@@ -686,8 +686,8 @@ function ct(n, e) {
|
|
|
686
686
|
if (!v)
|
|
687
687
|
return;
|
|
688
688
|
const y = {
|
|
689
|
-
in: p ?
|
|
690
|
-
out:
|
|
689
|
+
in: p ? V(p) : void 0,
|
|
690
|
+
out: V(v)
|
|
691
691
|
}, m = await a.runOut(y);
|
|
692
692
|
if (!m.config) {
|
|
693
693
|
t && (t.direction = "out"), i && (i.remove(), i = null);
|
|
@@ -701,7 +701,7 @@ function ct(n, e) {
|
|
|
701
701
|
var T, O;
|
|
702
702
|
(T = g.onEnd) == null || T.call(g), i && (i.remove(), i = null), t = null, (O = e == null ? void 0 : e.onCleanupEnd) == null || O.call(e);
|
|
703
703
|
}
|
|
704
|
-
}), S =
|
|
704
|
+
}), S = P.fromState(m.state, {
|
|
705
705
|
config: C,
|
|
706
706
|
from: m.from,
|
|
707
707
|
to: m.to,
|
|
@@ -737,24 +737,29 @@ const at = 3, lt = (n) => {
|
|
|
737
737
|
return { file: o.split(/[\\/]/).pop() || o, line: s, column: a };
|
|
738
738
|
}
|
|
739
739
|
return null;
|
|
740
|
-
},
|
|
740
|
+
}, R = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
|
|
741
741
|
function ut(n, e, t) {
|
|
742
|
-
|
|
742
|
+
R.set(n, e);
|
|
743
743
|
let i = M.get(n);
|
|
744
|
-
|
|
744
|
+
if (i)
|
|
745
|
+
return i;
|
|
746
|
+
const r = e;
|
|
747
|
+
return i = ct(
|
|
745
748
|
() => {
|
|
746
|
-
const
|
|
747
|
-
return
|
|
749
|
+
const o = R.get(n);
|
|
750
|
+
return o || (console.warn(`Transition "${String(n)}" not found`), {});
|
|
748
751
|
},
|
|
749
752
|
{
|
|
750
753
|
strategy: t == null ? void 0 : t.strategy,
|
|
751
754
|
scope: t == null ? void 0 : t.scope,
|
|
752
|
-
onCleanupEnd: () =>
|
|
755
|
+
onCleanupEnd: () => {
|
|
756
|
+
R.get(n) === r && W(n);
|
|
757
|
+
}
|
|
753
758
|
}
|
|
754
|
-
), M.set(n, i), i
|
|
759
|
+
), M.set(n, i), i;
|
|
755
760
|
}
|
|
756
761
|
function W(n) {
|
|
757
|
-
|
|
762
|
+
R.delete(n), M.delete(n);
|
|
758
763
|
}
|
|
759
764
|
function ft() {
|
|
760
765
|
const n = lt(new Error().stack);
|
|
@@ -872,7 +877,7 @@ function pt() {
|
|
|
872
877
|
getScrollPosition: (f) => f && t.has(f) ? t.get(f) : { x: 0, y: 0 }
|
|
873
878
|
};
|
|
874
879
|
}
|
|
875
|
-
function
|
|
880
|
+
function k(n, e) {
|
|
876
881
|
if (e === "*")
|
|
877
882
|
return !0;
|
|
878
883
|
if (e.endsWith("/*")) {
|
|
@@ -883,10 +888,10 @@ function b(n, e) {
|
|
|
883
888
|
}
|
|
884
889
|
function wt(n, e, t) {
|
|
885
890
|
for (const i of t)
|
|
886
|
-
if (
|
|
891
|
+
if (k(n, i.from) && k(e, i.to))
|
|
887
892
|
return i.transition;
|
|
888
893
|
for (const i of t)
|
|
889
|
-
if ((i.from === "*" ||
|
|
894
|
+
if ((i.from === "*" || k(n, i.from)) && (i.to === "*" || k(e, i.to)))
|
|
890
895
|
return i.transition;
|
|
891
896
|
return null;
|
|
892
897
|
}
|
|
@@ -971,14 +976,14 @@ export {
|
|
|
971
976
|
St as createTransitionScope,
|
|
972
977
|
st as findScope,
|
|
973
978
|
ft as generateAutoKey,
|
|
974
|
-
|
|
975
|
-
|
|
979
|
+
Vt as isCssAnimation,
|
|
980
|
+
bt as isMultiSpring,
|
|
976
981
|
rt as isScopeReady,
|
|
977
|
-
|
|
982
|
+
kt as isSingleSpring,
|
|
978
983
|
Rt as isTickAnimation,
|
|
979
984
|
Mt as jaeminInternal,
|
|
980
985
|
F as normalizeMultiSpringSchedule,
|
|
981
|
-
|
|
986
|
+
V as normalizeToMultiSpring,
|
|
982
987
|
Ct as transition,
|
|
983
988
|
It as validateAnimationMode,
|
|
984
989
|
Pt as validateSpringItem
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../src/lib/transition/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../src/lib/transition/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAyE9C,wBAAgB,eAAe,IAAI,aAAa,CAU/C;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG;IACtC,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,kBAAkB,CAAC;CAC1E,GACA,kBAAkB,CAsBpB"}
|