@ssgoi/core 3.2.2 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/animator/spring-core.d.ts +23 -4
- package/dist/animator/spring-core.d.ts.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.js +227 -213
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition.d.ts +1 -2
- package/dist/transition/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +2 -18
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +2 -18
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +2 -18
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +2 -18
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +188 -172
- package/dist/transitions/mask.d.ts +2 -18
- package/dist/transitions/mask.d.ts.map +1 -1
- package/dist/transitions/none.d.ts +2 -18
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +2 -18
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +2 -18
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +2 -18
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts +15 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/with-resolvers.d.ts +7 -0
- package/dist/utils/with-resolvers.d.ts.map +1 -0
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +11 -11
- package/dist/view-transitions/index.d.ts +1 -0
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +479 -425
- package/dist/view-transitions/instagram.d.ts.map +1 -1
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/rotate.d.ts +3 -0
- package/dist/view-transitions/rotate.d.ts.map +1 -0
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils/parse-caller-location.d.ts +0 -6
- package/dist/utils/parse-caller-location.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -106,14 +106,14 @@ Animate specific elements during mount/unmount:
|
|
|
106
106
|
|
|
107
107
|
```tsx
|
|
108
108
|
import { transition } from '@ssgoi/react';
|
|
109
|
-
import {
|
|
109
|
+
import { fade, slide } from '@ssgoi/react/transitions';
|
|
110
110
|
|
|
111
111
|
function Card() {
|
|
112
112
|
return (
|
|
113
113
|
<div ref={transition({
|
|
114
114
|
key: 'card',
|
|
115
|
-
in:
|
|
116
|
-
out:
|
|
115
|
+
in: fade(),
|
|
116
|
+
out: slide({ direction: 'up' })
|
|
117
117
|
})}>
|
|
118
118
|
<h2>Animated Card</h2>
|
|
119
119
|
</div>
|
|
@@ -131,12 +131,13 @@ function Card() {
|
|
|
131
131
|
- `pinterest` - Pinterest-style expand effect
|
|
132
132
|
|
|
133
133
|
### Element Transitions
|
|
134
|
-
- `
|
|
135
|
-
- `
|
|
136
|
-
- `
|
|
137
|
-
- `
|
|
138
|
-
- `
|
|
139
|
-
- `
|
|
134
|
+
- `fade` - Fade in/out
|
|
135
|
+
- `scale` - Scale in/out
|
|
136
|
+
- `slide` - Slide (direction: up/down/left/right)
|
|
137
|
+
- `rotate` - Rotate
|
|
138
|
+
- `bounce` - Bounce
|
|
139
|
+
- `blur` - Blur
|
|
140
|
+
- `fly` - Fly (custom x, y position)
|
|
140
141
|
|
|
141
142
|
## Framework Examples
|
|
142
143
|
|
|
@@ -9,6 +9,20 @@
|
|
|
9
9
|
export interface SpringConfig {
|
|
10
10
|
stiffness: number;
|
|
11
11
|
damping: number;
|
|
12
|
+
/**
|
|
13
|
+
* Enable double spring for ease-in-out effect (Chained/Lagged Spring)
|
|
14
|
+
*
|
|
15
|
+
* - true: same stiffness for both springs
|
|
16
|
+
* - number (0-1): follower stiffness ratio (smaller = stronger ease-in)
|
|
17
|
+
* - 1.0: same as true
|
|
18
|
+
* - 0.5: follower has half stiffness → stronger ease-in
|
|
19
|
+
* - 0.3: even stronger ease-in
|
|
20
|
+
*
|
|
21
|
+
* Creates a two-spring system:
|
|
22
|
+
* - Leader spring: tracks the target directly
|
|
23
|
+
* - Follower spring: tracks the leader's position (this is the output)
|
|
24
|
+
*/
|
|
25
|
+
doubleSpring?: boolean | number;
|
|
12
26
|
}
|
|
13
27
|
export interface SpringState {
|
|
14
28
|
position: number;
|
|
@@ -17,6 +31,11 @@ export interface SpringState {
|
|
|
17
31
|
export interface SpringConstants {
|
|
18
32
|
omega: number;
|
|
19
33
|
zeta: number;
|
|
34
|
+
/** @internal - Follower constants for double spring */
|
|
35
|
+
follower?: {
|
|
36
|
+
omega: number;
|
|
37
|
+
zeta: number;
|
|
38
|
+
};
|
|
20
39
|
}
|
|
21
40
|
/**
|
|
22
41
|
* Pre-compute spring constants (performance optimization)
|
|
@@ -28,13 +47,12 @@ export declare function computeSpringConstants(config: SpringConfig): SpringCons
|
|
|
28
47
|
/**
|
|
29
48
|
* Calculate one spring step (Semi-implicit Euler)
|
|
30
49
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* - x += h*v
|
|
50
|
+
* Automatically handles double spring if constants.follower exists.
|
|
51
|
+
* For double spring, output position/velocity is from the follower.
|
|
34
52
|
*
|
|
35
53
|
* @param state Current state (position, velocity)
|
|
36
54
|
* @param target Target position
|
|
37
|
-
* @param constants Pre-computed spring constants (omega, zeta)
|
|
55
|
+
* @param constants Pre-computed spring constants (omega, zeta, optionally follower)
|
|
38
56
|
* @param dt Delta time (seconds)
|
|
39
57
|
* @returns New state
|
|
40
58
|
*/
|
|
@@ -44,6 +62,7 @@ export declare const VELOCITY_THRESHOLD = 0.01;
|
|
|
44
62
|
export declare const SETTLE_THRESHOLD = 0.05;
|
|
45
63
|
/**
|
|
46
64
|
* Check if spring has converged to target
|
|
65
|
+
* For double spring, checks both leader and follower
|
|
47
66
|
*/
|
|
48
67
|
export declare function isSettled(state: SpringState, target: number): boolean;
|
|
49
68
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring-core.d.ts","sourceRoot":"","sources":["../../src/lib/animator/spring-core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"spring-core.d.ts","sourceRoot":"","sources":["../../src/lib/animator/spring-core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAoB5E;AAoBD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,eAAe,EAC1B,EAAE,EAAE,MAAM,GACT,WAAW,CAwDb;AAGD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAkBrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,eAAe,SAAI,GAClB;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAmCxC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";var ct=Object.defineProperty;var at=(i,e,t)=>e in i?ct(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var m=(i,e,t)=>at(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./types.cjs"),lt=require("./jaemin-BG8HRXG1.cjs");class ut{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"maxDeltaTime",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(this,"tick",()=>{const e=Date.now();let n=e-this.lastUpdate;n>this.lagThreshold||n<0?(this.startTime+=n-this.adjustedLag,n=this.adjustedLag):n>this.maxDeltaTime&&(n=this.maxDeltaTime),this.lastUpdate=e;const r=e-this.startTime,s=r-this.nextTime;if(s>0){const c=n/1e3;this.elapsed=r/1e3,this.nextTime+=s+(s>=this.gap?4:this.gap-s),this.listeners.forEach(o=>{o(c,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 D=new ut;function $(i){const e=i.stiffness,t=i.damping,n=1,r=Math.sqrt(e/n),s=t/(2*Math.sqrt(e*n));return{omega:r,zeta:s}}function K(i,e,t,n){const{omega:r,zeta:s}=t,{position:c,velocity:o}=i,a=Math.min(n,.033),u=-2*a*s*r*o,f=a*r*r*(e-c),g=o+u+f;return{position:c+a*g,velocity:g}}const ft=.01,dt=.01,G=.05;function B(i,e){const t=Math.abs(e-i.position),n=Math.abs(i.velocity);return t<ft&&n<dt}function mt(i){const{from:e,to:t,spring:n,velocity:r=0,onUpdate:s,onComplete:c,onStart:o}=i;let a={position:e,velocity:r},u=!0,f=0,g=!1;const y=$(n),S=l=>{if(u){if(g||(g=!0,o==null||o()),a=K(a,t,y,l),B(a,t)){if(f+=Math.min(l,.033),f>=G){a={position:t,velocity:0},u=!1,s(a.position),D.unsubscribe(S),c();return}}else f=0;s(a.position)}};return D.subscribe(S),{stop:()=>{u&&(u=!1,D.unsubscribe(S))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>u}}const V=1e3/60;function gt(i,e,t,n=0){const r=$(t),s=600;let c={position:i,velocity:n},o=0;const a=[];for(let u=0;u<s;u++){const f=u*V;if(a.push({time:f,position:c.position,velocity:c.velocity}),c=K(c,e,r,V/1e3),B(c,e)){if(o+=V/1e3,o>=G){a.push({time:(u+1)*V,position:e,velocity:0});break}}else o=0}return a}function W(i,e){if(i.length===0)return{position:0,velocity:0};const t=i[0],n=i[i.length-1];if(e<=0)return{position:t.position,velocity:t.velocity};if(e>=n.time)return{position:n.position,velocity:n.velocity};let r=0,s=i.length-1;for(;r<s-1;){const u=Math.floor((r+s)/2);i[u].time<=e?r=u:s=u}const c=i[r],o=i[s],a=(e-c.time)/(o.time-c.time);return{position:c.position+(o.position-c.position)*a,velocity:c.velocity+(o.velocity-c.velocity)*a}}function ht(i,e){return i.map(t=>e(t.position))}function pt(i){const{element:e,from:t,to:n,spring:r,velocity:s=0,style:c,onComplete:o,onStart:a}=i,u=gt(t,n,r,s);if(u.length===0)return a==null||a(),o(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1};const f=ht(u,c),g=u[u.length-1],y=g.time,S=e.animate(f,{duration:y,fill:"forwards",easing:"linear"});let l=!0;const d=performance.now();return a==null||a(),S.onfinish=()=>{l&&(l=!1,o())},{stop:()=>{l&&(l=!1,S.cancel())},getPosition:()=>{if(!l)return g.position;const T=performance.now()-d;return W(u,T).position},getVelocity:()=>{if(!l)return 0;const T=performance.now()-d;return W(u,T).velocity},isRunning:()=>l}}function wt(i){const{from:e,to:t,spring:n,velocity:r,onComplete:s,onStart:c,tick:o,css:a}=i;if(o&&a)throw new Error("Cannot use both 'tick' and 'css' options together");return!o&&!a?(c==null||c(),s(),{stop:()=>{},getPosition:()=>t,getVelocity:()=>0,isRunning:()=>!1}):a?pt({element:a.element,from:e,to:t,spring:n,velocity:r,style:a.style,onComplete:s,onStart:c}):mt({from:e,to:t,spring:n,velocity:r,onUpdate:o,onComplete:s,onStart:c})}class J{}class F extends J{constructor(t){super();m(this,"options");m(this,"controls",null);m(this,"isAnimating",!1);m(this,"currentValue");m(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=wt({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,n){const r=new F(n);return r.setValue(t.position),r.setVelocity(t.velocity),r}}class z extends J{constructor(t){super();m(this,"config");m(this,"animators",new Map);m(this,"springOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"rafId",null);m(this,"from");m(this,"to");this.config=t.config,this.from=t.from,this.to=t.to,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const n=this.generateId(),r=new F({from:this.from,to:this.to,spring:t.spring,tick:t.tick,css:t.css,onComplete:()=>this.onAnimatorComplete(n),onStart:t.onStart});this.animators.set(n,{id:n,item:t,animator:r,started:!1}),this.springOrder.push(n)})}getAnimatorProgress(t){const n=t.animator.getCurrentState(),r=Math.abs(n.to-n.from);return r===0?1:Math.abs(n.position-n.from)/r}getOrderedIds(){return this.direction==="forward"?this.springOrder:[...this.springOrder].reverse()}onAnimatorComplete(t){var r,s,c,o,a,u;const n=this.animators.get(t);!n||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(s=(r=n.item).onComplete)==null||s.call(r),(o=(c=this.config).onProgress)==null||o.call(c,this.completedCount,this.config.springs.length),this.completedCount===this.config.springs.length&&(this.stopScheduler(),(u=(a=this.config).onEnd)==null||u.call(a)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let n=0;n<t.length;n++){const r=t[n],s=this.animators.get(r);if(!s||s.started)continue;if(n===0){this.startAnimator(r);continue}const c=t[n-1],o=this.animators.get(c);if(!o||!o.started)continue;const a=this.getAnimatorProgress(o),u=s.item.normalizedOffset;a>=u&&this.startAnimator(r)}}startAnimator(t){const n=this.animators.get(t);!n||n.started||(n.started=!0,this.direction==="forward"?n.animator.forward():n.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 n;const t=this.springOrder[0];return t?((n=this.animators.get(t))==null?void 0:n.animator)??null:null}forward(){var t,n;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.call(t),this.startScheduler()}backward(){var t,n;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.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 n=t.animator.getCurrentState();if(n.position===n.to){const s=F.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,spring:t.item.spring,tick:t.item.tick,css:t.item.css,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 n=this.getFirstAnimator();n==null||n.setValue(t)}setVelocity(t){const n=this.getFirstAnimator();n==null||n.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,n){const r=new z(n);return r.setValue(t.position),r.setVelocity(t.velocity),r}}const H=Symbol.for("TRANSITION_STRATEGY"),Q=i=>({runIn:async e=>{const{currentAnimation:t}=i;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),s=t.controller.getVelocity();if(t.controller.stop(),e.out)return{config:await e.out,state:{position:r,velocity:s},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}=i;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),s=t.controller.getVelocity();if(t.controller.stop(),e.in)return{config:await e.in,state:{position:r,velocity:s},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"}}}),Z=()=>({runIn:async i=>i.in?{config:await i.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 i=>i.out?{config:await i.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),Y="data-ssgoi-scope",U="data-ssgoi-scope-ready";function yt(){return i=>{if(i)return i.setAttribute(Y,""),queueMicrotask(()=>{queueMicrotask(()=>{i.setAttribute(U,"true")})}),()=>{}}}function tt(i){return i.hasAttribute(U)}function et(i){return i.closest(`[${Y}]`)}function St(i,e){var S;let t=null,n=null,r=null,s=null;const c={get currentAnimation(){return t}},o=((S=e==null?void 0:e.strategy)==null?void 0:S.call(e,c))||Q(c),a=async l=>{var E;n&&(n.remove(),n=null);const d=i(),T=d.in&&d.in(l),k=!(e!=null&&e.strategy)&&d.out?d.out(l):void 0;if(!T)return;const P={in:A.normalizeToMultiSpring(T),out:k?A.normalizeToMultiSpring(k):void 0},v=await o.runIn(P);if(!v.config){t&&(t.direction="in");return}const p=v.config;(E=p.prepare)==null||E.call(p,l),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var C;t=null,(C=p.onEnd)==null||C.call(p)}},l),h=z.fromState(v.state,{config:w,from:v.from,to:v.to});t={controller:h,direction:"in"},v.direction==="forward"?h.forward():h.backward()},u=async l=>{var C;n=l;const d=i(),T=!(e!=null&&e.strategy)&&d.in?d.in(l):void 0,k=d.out&&d.out(l);if(!k)return;const P={in:T?A.normalizeToMultiSpring(T):void 0,out:A.normalizeToMultiSpring(k)},v=await o.runOut(P);if(!v.config){t&&(t.direction="out"),n&&(n.remove(),n=null);return}const p=v.config;(C=p.prepare)==null||C.call(p,l),E(),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var M,I;(M=p.onEnd)==null||M.call(p),n&&(n.remove(),n=null),t=null,(I=e==null?void 0:e.onCleanupEnd)==null||I.call(e)}},l),h=z.fromState(v.state,{config:w,from:v.from,to:v.to});t={controller:h,direction:"out"},v.direction==="forward"?h.forward():h.backward();function E(){!r||!n||(s&&r.contains(s)?r.insertBefore(n,s):r.appendChild(n))}};let f=null,g=!1;const y=l=>()=>{if(g)return;g=!0;const d=l.cloneNode(!0);f?queueMicrotask(()=>{document.contains(f)&&u(d)}):u(d)};return l=>{if(l)return r=l.parentElement,s=l.nextElementSibling,g=!1,(e==null?void 0:e.scope)==="local"?queueMicrotask(()=>{f=et(l),!(f&&!tt(f))&&a(l)}):a(l),y(l)}}const vt=3,Ct=i=>{if(!i)return null;const e=i.split(`
|
|
2
|
-
`).map(t=>t.trim());for(let t=vt;t<Math.min(e.length,6);t++){const n=e[t],r=n==null?void 0:n.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const s=r[1]??"",c=r[2]??"0",o=r[3]??"0";return{file:s.split(/[\\/]/).pop()||s,line:c,column:o}}return null},R=new Map;let b=null,_=!1;function nt(i){if(i instanceof HTMLElement&&R.has(i)){const t=R.get(i);R.delete(i),queueMicrotask(()=>{t()})}const e=i.childNodes;for(let t=0;t<e.length;t++){const n=e[t];n&&nt(n)}}function Tt(){_||typeof document>"u"||(_=!0,b=new MutationObserver(i=>{for(const e of i){const t=e.removedNodes;for(let n=0;n<t.length;n++){const r=t[n];r&&nt(r)}}}),document.body?b.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{b==null||b.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function it(i,e){Tt(),R.set(i,e)}function At(i){return R.has(i)}function Et(){return R.size}function bt(i){const e=R.get(i);return e?(R.delete(i),e(),!0):!1}function Rt(){R.clear(),b==null||b.disconnect(),b=null,_=!1}const x=new Map,N=new Map,q=new Map;function kt(i,e,t){x.set(i,e);let n=N.get(i);if(n)return n;const r=e;return n=St(()=>{const s=x.get(i);return s||(console.warn(`Transition "${String(i)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{x.get(i)===r&&ot(i)}}),N.set(i,n),n}function ot(i){x.delete(i),N.delete(i),q.delete(i)}function rt(){const i=Ct(new Error().stack);return i?`auto_${i.file}_${i.line}_${i.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const j=globalThis.FinalizationRegistry,X=j?new j(i=>{try{ot(i)}catch{}}):void 0;function Mt(i,e="manual"){const t=i.key??rt();if(i.ref&&X)try{X.register(i.ref,t)}catch{}const n=kt(t,{in:i.in,out:i.out},{strategy:i[H],scope:i.scope});if(e==="manual")return n;let r=q.get(t);return r||(r=s=>{if(s){const c=n(s);c&&it(s,c)}},q.set(t,r),r)}function Pt(i){const e=i.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...i,...e]}function It(i){let e=!1,t=0,n=0,r=!1;const s=50,c=l=>{if(!i)return;const d=l.touches[0];d&&(r=d.clientX<s,r&&(t=d.clientX,n=d.clientY))},o=l=>{if(!i||!r)return;const d=l.touches[0];if(!d)return;const T=d.clientX-t,k=d.clientY-n;T>window.outerWidth/2-5&&Math.abs(T)>Math.abs(k)?e=!0:e=!1},a=()=>{i&&(r=!1,t=0,n=0)},u=()=>e,f=()=>{typeof window>"u"||i&&(window.addEventListener("touchstart",c,{passive:!0}),window.addEventListener("touchmove",o,{passive:!0}),window.addEventListener("touchend",a,{passive:!0}))},g=()=>{typeof window>"u"||(window.removeEventListener("touchstart",c),window.removeEventListener("touchmove",o),window.removeEventListener("touchend",a))};let y=0;return{initialize:f,cleanup:g,isSwipePending:u,resetSwipeDetection:()=>{y++,y>1&&(y=0,e=!1)}}}const Vt=i=>{let e=i.parentElement;for(;e&&e!==document.body;){const t=window.getComputedStyle(e),n=t.overflow+t.overflowY+t.overflowX;if(n.includes("auto")||n.includes("scroll")||e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.parentElement}return document.documentElement},Ot=i=>{let e=i.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 xt(){let i=null,e=null;const t=new Map;let n=null;const r=()=>{i&&n&&t.set(n,{x:i.scrollLeft,y:i.scrollTop})};return{initializeContext:(f,g)=>{e=f,i||(i=Vt(f),(i===document.documentElement?window:i).addEventListener("scroll",r,{passive:!0})),n=g},calculateScrollOffset:(f,g)=>{const y=f&&t.has(f)?t.get(f):{x:0,y:0},S=g&&t.has(g)?t.get(g):{x:0,y:0};return{x:-S.x+y.x,y:-S.y+y.y}},getScrollContainer:()=>i,getPositionedParentElement:()=>e?Ot(e):document.body,getScrollPosition:f=>f&&t.has(f)?t.get(f):{x:0,y:0}}}function O(i,e){if(e==="*")return!0;if(e.endsWith("/*")){const t=e.slice(0,-2);return i===t||i.startsWith(t+"/")}return i===e}function Ft(i,e,t){for(const n of t)if(O(i,n.from)&&O(e,n.to))return n.transition;for(const n of t)if((n.from==="*"||O(i,n.from))&&(n.to==="*"||O(e,n.to)))return n.transition;return null}function zt(i,e){const{transitions:t=[],defaultTransition:n,middleware:r=(w,h)=>({from:w,to:h}),skipOnIosSwipe:s=!0}=i,{outFirst:c=!0}=e||{};let o=null;const a=Pt(t),{initializeContext:u,calculateScrollOffset:f,getScrollContainer:g,getPositionedParentElement:y,getScrollPosition:S}=xt(),l=It(s);l.initialize();function d(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:w,to:h}=r(o.from,o.to),C=Ft(w,h,a)||n,M=f(o.from,o.to),I={scrollOffset:M,scroll:S(o.from),get scrollingElement(){return g()||document.documentElement},get positionedParent(){return y()}},st={scrollOffset:M,get scroll(){return o?S(o.to):{x:0,y:0}},get scrollingElement(){return g()||document.documentElement},get positionedParent(){return y()}};C&&(C.out&&o.outResolve&&o.outResolve(L=>C.out(L,I)),C.in&&o.inResolve&&o.inResolve(L=>C.in(L,st))),o=null}}function T(){o&&(o.inResolve&&o.inResolve(()=>({})),o.outResolve&&o.outResolve(()=>({})),o=null)}const v=c?async(w,h)=>l.isSwipePending()?(l.resetSwipeDetection(),()=>({})):h==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),h==="out"?(o.from=w,new Promise(E=>{o.outResolve=E,d()})):(o.to=w,new Promise(E=>{o.inResolve=E,d()}))):async(w,h)=>l.isSwipePending()?(l.resetSwipeDetection(),()=>({})):(o&&(h==="out"&&o.from&&o.from!==w||h==="in"&&o.to&&o.to!==w)&&T(),o||(o={}),h==="out"?(o.from=w,new Promise(C=>{o.outResolve=C,d()})):(o.to=w,new Promise(C=>{o.inResolve=C,d()})));return w=>({key:w,in:async h=>(u(h,w),(await v(w,"in"))(h)),out:async h=>(await v(w,"out"))(h),[H]:Z})}exports.isCssAnimation=A.isCssAnimation;exports.isMultiSpring=A.isMultiSpring;exports.isSingleSpring=A.isSingleSpring;exports.isTickAnimation=A.isTickAnimation;exports.normalizeMultiSpringSchedule=A.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=A.normalizeToMultiSpring;exports.validateAnimationMode=A.validateAnimationMode;exports.validateSpringItem=A.validateSpringItem;exports.jaeminInternal=lt.jaeminInternal;exports.SCOPE_ATTR=Y;exports.SCOPE_READY_ATTR=U;exports.TRANSITION_STRATEGY=H;exports.createDefaultStrategy=Q;exports.createPageTransitionStrategy=Z;exports.createSggoiTransitionContext=zt;exports.createTransitionScope=yt;exports.findScope=et;exports.generateAutoKey=rt;exports.getWatchedCount=Et;exports.isScopeReady=tt;exports.isWatched=At;exports.resetObserver=Rt;exports.transition=Mt;exports.triggerUnmount=bt;exports.watchUnmount=it;
|
|
1
|
+
"use strict";var st=Object.defineProperty;var ct=(n,e,t)=>e in n?st(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var m=(n,e,t)=>ct(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./types.cjs"),at=require("./jaemin-BG8HRXG1.cjs");class lt{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"maxDeltaTime",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(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,s=r-this.nextTime;if(s>0){const a=i/1e3;this.elapsed=r/1e3,this.nextTime+=s+(s>=this.gap?4:this.gap-s),this.listeners.forEach(o=>{o(a,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 D=new lt;function $(n){const e=n.stiffness,t=n.damping,i=1,r=Math.sqrt(e/i),s=t/(2*Math.sqrt(e*i)),a={omega:r,zeta:s};if(n.doubleSpring){const o=typeof n.doubleSpring=="number"?n.doubleSpring:1,c=e*o,u=Math.sqrt(c/i),f=t/(2*Math.sqrt(c*i));a.follower={omega:u,zeta:f}}return a}function _(n,e,t,i,r,s){const a=-2*s*r*i*e,o=s*i*i*(t-n),c=e+a+o;return{position:n+s*c,velocity:c}}function B(n,e,t,i){const r=Math.min(i,.033);if(t.follower){const u=n._leader??{position:n.position,velocity:n.velocity},f=_(u.position,u.velocity,e,t.omega,t.zeta,r),g=_(n.position,n.velocity,f.position,t.follower.omega,t.follower.zeta,r);return{position:g.position,velocity:g.velocity,_leader:f}}const{omega:s,zeta:a}=t,o=_(n.position,n.velocity,e,s,a,r);return{position:o.position,velocity:o.velocity}}const j=.01,X=.01,K=.05;function Z(n,e){const t=Math.abs(e-n.position),i=Math.abs(n.velocity),r=t<j&&i<X,s=n;if(s._leader){const a=Math.abs(e-s._leader.position),o=Math.abs(s._leader.velocity);return a<j&&o<X&&r}return r}function ut(n){const{from:e,to:t,spring:i,velocity:r=0,onUpdate:s,onComplete:a,onStart:o}=n;let c={position:e,velocity:r},u=!0,f=0,g=!1;const S=$(i),y=l=>{if(u){if(g||(g=!0,o==null||o()),c=B(c,t,S,l),Z(c,t)){if(f+=Math.min(l,.033),f>=K){c={position:t,velocity:0},u=!1,s(c.position),D.unsubscribe(y),a();return}}else f=0;s(c.position)}};return D.subscribe(y),{stop:()=>{u&&(u=!1,D.unsubscribe(y))},getPosition:()=>c.position,getVelocity:()=>c.velocity,isRunning:()=>u}}const I=1e3/60;function ft(n,e,t,i=0){const r=$(t),s=600;let a={position:n,velocity:i},o=0;const c=[];for(let u=0;u<s;u++){const f=u*I;if(c.push({time:f,position:a.position,velocity:a.velocity}),a=B(a,e,r,I/1e3),Z(a,e)){if(o+=I/1e3,o>=K){c.push({time:(u+1)*I,position:e,velocity:0});break}}else o=0}return c}function G(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,s=n.length-1;for(;r<s-1;){const u=Math.floor((r+s)/2);n[u].time<=e?r=u:s=u}const a=n[r],o=n[s],c=(e-a.time)/(o.time-a.time);return{position:a.position+(o.position-a.position)*c,velocity:a.velocity+(o.velocity-a.velocity)*c}}function dt(n,e){return n.map(t=>e(t.position))}function mt(n){const{element:e,from:t,to:i,spring:r,velocity:s=0,style:a,onComplete:o,onStart:c}=n,u=ft(t,i,r,s);if(u.length===0)return c==null||c(),o(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1};const f=dt(u,a),g=u[u.length-1],S=g.time,y=e.animate(f,{duration:S,fill:"forwards",easing:"linear"});let l=!0;const d=performance.now();return c==null||c(),y.onfinish=()=>{l&&(l=!1,o())},{stop:()=>{l&&(l=!1,y.cancel())},getPosition:()=>{if(!l)return g.position;const T=performance.now()-d;return G(u,T).position},getVelocity:()=>{if(!l)return 0;const T=performance.now()-d;return G(u,T).velocity},isRunning:()=>l}}function gt(n){const{from:e,to:t,spring:i,velocity:r,onComplete:s,onStart:a,tick:o,css:c}=n;if(o&&c)throw new Error("Cannot use both 'tick' and 'css' options together");return!o&&!c?(a==null||a(),s(),{stop:()=>{},getPosition:()=>t,getVelocity:()=>0,isRunning:()=>!1}):c?mt({element:c.element,from:e,to:t,spring:i,velocity:r,style:c.style,onComplete:s,onStart:a}):ut({from:e,to:t,spring:i,velocity:r,onUpdate:o,onComplete:s,onStart:a})}class J{}class F extends J{constructor(t){super();m(this,"options");m(this,"controls",null);m(this,"isAnimating",!1);m(this,"currentValue");m(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=gt({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 F(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}class z extends J{constructor(t){super();m(this,"config");m(this,"animators",new Map);m(this,"springOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"rafId",null);m(this,"from");m(this,"to");this.config=t.config,this.from=t.from,this.to=t.to,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const i=this.generateId(),r=new F({from:this.from,to:this.to,spring:t.spring,tick:t.tick,css:t.css,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,s,a,o,c,u;const i=this.animators.get(t);!i||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(s=(r=i.item).onComplete)==null||s.call(r),(o=(a=this.config).onProgress)==null||o.call(a,this.completedCount,this.config.springs.length),this.completedCount===this.config.springs.length&&(this.stopScheduler(),(u=(c=this.config).onEnd)==null||u.call(c)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let i=0;i<t.length;i++){const r=t[i],s=this.animators.get(r);if(!s||s.started)continue;if(i===0){this.startAnimator(r);continue}const a=t[i-1],o=this.animators.get(a);if(!o||!o.started)continue;const c=this.getAnimatorProgress(o),u=s.item.normalizedOffset;c>=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.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 s=F.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,spring:t.item.spring,tick:t.item.tick,css:t.item.css,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 z(i);return r.setValue(t.position),r.setVelocity(t.velocity),r}}const Y=Symbol.for("TRANSITION_STRATEGY"),Q=n=>({runIn:async e=>{const{currentAnimation:t}=n;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),s=t.controller.getVelocity();if(t.controller.stop(),e.out)return{config:await e.out,state:{position:r,velocity:s},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(),s=t.controller.getVelocity();if(t.controller.stop(),e.in)return{config:await e.in,state:{position:r,velocity:s},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"}}}),tt=()=>({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"}}),U="data-ssgoi-scope",W="data-ssgoi-scope-ready";function ht(){return n=>{if(n)return n.setAttribute(U,""),queueMicrotask(()=>{queueMicrotask(()=>{n.setAttribute(W,"true")})}),()=>{}}}function et(n){return n.hasAttribute(W)}function it(n){return n.closest(`[${U}]`)}function pt(n,e){var y;let t=null,i=null,r=null,s=null;const a={get currentAnimation(){return t}},o=((y=e==null?void 0:e.strategy)==null?void 0:y.call(e,a))||Q(a),c=async l=>{var E;i&&(i.remove(),i=null);const d=n(),T=d.in&&d.in(l),k=!(e!=null&&e.strategy)&&d.out?d.out(l):void 0;if(!T)return;const P={in:A.normalizeToMultiSpring(T),out:k?A.normalizeToMultiSpring(k):void 0},v=await o.runIn(P);if(!v.config){t&&(t.direction="in");return}const p=v.config;(E=p.prepare)==null||E.call(p,l),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var C;t=null,(C=p.onEnd)==null||C.call(p)}},l),h=z.fromState(v.state,{config:w,from:v.from,to:v.to});t={controller:h,direction:"in"},v.direction==="forward"?h.forward():h.backward()},u=async l=>{var C;i=l;const d=n(),T=!(e!=null&&e.strategy)&&d.in?d.in(l):void 0,k=d.out&&d.out(l);if(!k)return;const P={in:T?A.normalizeToMultiSpring(T):void 0,out:A.normalizeToMultiSpring(k)},v=await o.runOut(P);if(!v.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const p=v.config;(C=p.prepare)==null||C.call(p,l),E(),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var R,V;(R=p.onEnd)==null||R.call(p),i&&(i.remove(),i=null),t=null,(V=e==null?void 0:e.onCleanupEnd)==null||V.call(e)}},l),h=z.fromState(v.state,{config:w,from:v.from,to:v.to});t={controller:h,direction:"out"},v.direction==="forward"?h.forward():h.backward();function E(){!r||!i||(s&&r.contains(s)?r.insertBefore(i,s):r.appendChild(i))}};let f=null,g=!1;const S=l=>()=>{if(g)return;g=!0;const d=l.cloneNode(!0);f?queueMicrotask(()=>{document.contains(f)&&u(d)}):u(d)};return l=>{if(l)return requestAnimationFrame(()=>{r=l.parentElement,s=l.nextElementSibling}),g=!1,(e==null?void 0:e.scope)==="local"?queueMicrotask(()=>{f=it(l),!(f&&!et(f))&&c(l)}):c(l),S(l)}}const M=new Map;let b=null,q=!1;function nt(n){if(n instanceof HTMLElement&&M.has(n)){const t=M.get(n);M.delete(n),queueMicrotask(()=>{t()})}const e=n.childNodes;for(let t=0;t<e.length;t++){const i=e[t];i&&nt(i)}}function wt(){q||typeof document>"u"||(q=!0,b=new MutationObserver(n=>{for(const e of n){const t=e.removedNodes;for(let i=0;i<t.length;i++){const r=t[i];r&&nt(r)}}}),document.body?b.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{b==null||b.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function ot(n,e){wt(),M.set(n,e)}function St(n){return M.has(n)}function yt(){return M.size}function vt(n){const e=M.get(n);return e?(M.delete(n),e(),!0):!1}function Ct(){M.clear(),b==null||b.disconnect(),b=null,q=!1}const x=new Map,N=new Map,H=new Map;function Tt(n,e,t){x.set(n,e);let i=N.get(n);if(i)return i;const r=e;return i=pt(()=>{const s=x.get(n);return s||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{x.get(n)===r&&At(n)}}),N.set(n,i),i}function At(n){x.delete(n),N.delete(n),H.delete(n)}function Et(n,e="manual"){const t=Tt(n.key,{in:n.in,out:n.out},{strategy:n[Y],scope:n.scope});if(e==="manual")return t;let i=H.get(n.key);return i||(i=r=>{if(r){const s=t(r);s&&ot(r,s)}},H.set(n.key,i),i)}function bt(n){const e=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...e]}function Mt(n){let e=!1,t=0,i=0,r=!1;const s=50,a=l=>{if(!n)return;const d=l.touches[0];d&&(r=d.clientX<s,r&&(t=d.clientX,i=d.clientY))},o=l=>{if(!n||!r)return;const d=l.touches[0];if(!d)return;const T=d.clientX-t,k=d.clientY-i;T>window.outerWidth/2-5&&Math.abs(T)>Math.abs(k)?e=!0:e=!1},c=()=>{n&&(r=!1,t=0,i=0)},u=()=>e,f=()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",a,{passive:!0}),window.addEventListener("touchmove",o,{passive:!0}),window.addEventListener("touchend",c,{passive:!0}))},g=()=>{typeof window>"u"||(window.removeEventListener("touchstart",a),window.removeEventListener("touchmove",o),window.removeEventListener("touchend",c))};let S=0;return{initialize:f,cleanup:g,isSwipePending:u,resetSwipeDetection:()=>{S++,S>1&&(S=0,e=!1)}}}const kt=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},Rt=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 Pt(){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,g)=>{e=f,n||(n=kt(f),(n===document.documentElement?window:n).addEventListener("scroll",r,{passive:!0})),i=g},calculateScrollOffset:(f,g)=>{const S=f&&t.has(f)?t.get(f):{x:0,y:0},y=g&&t.has(g)?t.get(g):{x:0,y:0};return{x:-y.x+S.x,y:-y.y+S.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>e?Rt(e):document.body,getScrollPosition:f=>f&&t.has(f)?t.get(f):{x:0,y:0}}}function O(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 Vt(n,e,t){for(const i of t)if(O(n,i.from)&&O(e,i.to))return i.transition;for(const i of t)if((i.from==="*"||O(n,i.from))&&(i.to==="*"||O(e,i.to)))return i.transition;return null}function It(n,e){const{transitions:t=[],defaultTransition:i,middleware:r=(w,h)=>({from:w,to:h}),skipOnIosSwipe:s=!0}=n,{outFirst:a=!0}=e||{};let o=null;const c=bt(t),{initializeContext:u,calculateScrollOffset:f,getScrollContainer:g,getPositionedParentElement:S,getScrollPosition:y}=Pt(),l=Mt(s);l.initialize();function d(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:w,to:h}=r(o.from,o.to),C=Vt(w,h,c)||i,R=f(o.from,o.to),V={scrollOffset:R,scroll:y(o.from),get scrollingElement(){return g()||document.documentElement},get positionedParent(){return S()}},rt={scrollOffset:R,get scroll(){return o?y(o.to):{x:0,y:0}},get scrollingElement(){return g()||document.documentElement},get positionedParent(){return S()}};C&&(C.out&&o.outResolve&&o.outResolve(L=>C.out(L,V)),C.in&&o.inResolve&&o.inResolve(L=>C.in(L,rt))),o=null}}function T(){o&&(o.inResolve&&o.inResolve(()=>({})),o.outResolve&&o.outResolve(()=>({})),o=null)}const v=a?async(w,h)=>l.isSwipePending()?(l.resetSwipeDetection(),()=>({})):h==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),h==="out"?(o.from=w,new Promise(E=>{o.outResolve=E,d()})):(o.to=w,new Promise(E=>{o.inResolve=E,d()}))):async(w,h)=>l.isSwipePending()?(l.resetSwipeDetection(),()=>({})):(o&&(h==="out"&&o.from&&o.from!==w||h==="in"&&o.to&&o.to!==w)&&T(),o||(o={}),h==="out"?(o.from=w,new Promise(C=>{o.outResolve=C,d()})):(o.to=w,new Promise(C=>{o.inResolve=C,d()})));return w=>({key:w,in:async h=>(u(h,w),(await v(w,"in"))(h)),out:async h=>(await v(w,"out"))(h),[Y]:tt})}exports.isCssAnimation=A.isCssAnimation;exports.isMultiSpring=A.isMultiSpring;exports.isSingleSpring=A.isSingleSpring;exports.isTickAnimation=A.isTickAnimation;exports.normalizeMultiSpringSchedule=A.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=A.normalizeToMultiSpring;exports.validateAnimationMode=A.validateAnimationMode;exports.validateSpringItem=A.validateSpringItem;exports.jaeminInternal=at.jaeminInternal;exports.SCOPE_ATTR=U;exports.SCOPE_READY_ATTR=W;exports.TRANSITION_STRATEGY=Y;exports.createDefaultStrategy=Q;exports.createPageTransitionStrategy=tt;exports.createSggoiTransitionContext=It;exports.createTransitionScope=ht;exports.findScope=it;exports.getWatchedCount=yt;exports.isScopeReady=et;exports.isWatched=St;exports.resetObserver=Ct;exports.transition=Et;exports.triggerUnmount=vt;exports.watchUnmount=ot;
|