@ssgoi/core 3.4.0 → 3.5.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/animator/integrator/double-spring-integrator.d.ts +25 -0
- package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -0
- package/dist/animator/integrator/index.d.ts +13 -0
- package/dist/animator/integrator/index.d.ts.map +1 -0
- package/dist/animator/integrator/inertia-integrator.d.ts +19 -0
- package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -0
- package/dist/animator/integrator/provider.d.ts +22 -0
- package/dist/animator/integrator/provider.d.ts.map +1 -0
- package/dist/animator/integrator/spring-integrator.d.ts +13 -0
- package/dist/animator/integrator/spring-integrator.d.ts.map +1 -0
- package/dist/animator/integrator/types.d.ts +34 -0
- package/dist/animator/integrator/types.d.ts.map +1 -0
- package/dist/animator/multi-animator.d.ts +2 -2
- package/dist/animator/multi-animator.d.ts.map +1 -1
- package/dist/animator/{animate → runner}/css-runner.d.ts +2 -2
- package/dist/animator/runner/css-runner.d.ts.map +1 -0
- package/dist/animator/runner/provider.d.ts +35 -0
- package/dist/animator/runner/provider.d.ts.map +1 -0
- package/dist/animator/{animate → runner}/tick-runner.d.ts +2 -2
- package/dist/animator/runner/tick-runner.d.ts.map +1 -0
- package/dist/animator/runner/ticker.d.ts.map +1 -0
- package/dist/animator/{animate → runner}/types.d.ts +6 -3
- package/dist/animator/runner/types.d.ts.map +1 -0
- package/dist/animator/{index.d.ts → single-animator.d.ts} +17 -9
- package/dist/animator/single-animator.d.ts.map +1 -0
- package/dist/animator/{animation.d.ts → types.d.ts} +2 -2
- package/dist/animator/types.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +480 -535
- package/dist/provider-B6Xnh0BA.cjs +1 -0
- package/dist/provider-CMBovM_W.js +134 -0
- package/dist/transition/transition-strategy.d.ts +2 -2
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +4 -7
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +4 -7
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +4 -7
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +2 -5
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.d.ts +5 -0
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/index.js +153 -194
- package/dist/transitions/mask.d.ts +2 -5
- package/dist/transitions/mask.d.ts.map +1 -1
- package/dist/transitions/none.d.ts +2 -5
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +4 -7
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +4 -7
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +4 -7
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/transitions/utils.d.ts +8 -0
- package/dist/transitions/utils.d.ts.map +1 -0
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +59 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -6
- package/dist/view-transitions/blind.d.ts +2 -3
- package/dist/view-transitions/blind.d.ts.map +1 -1
- package/dist/view-transitions/curtain-reveal.d.ts +2 -3
- package/dist/view-transitions/curtain-reveal.d.ts.map +1 -1
- package/dist/view-transitions/depth.d.ts +19 -0
- package/dist/view-transitions/depth.d.ts.map +1 -0
- package/dist/view-transitions/drill.d.ts +2 -2
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts +2 -3
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/film.d.ts +2 -1
- package/dist/view-transitions/film.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts +2 -2
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +11 -11
- package/dist/view-transitions/index.d.ts +6 -2
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +1079 -681
- package/dist/view-transitions/instagram.d.ts +2 -2
- package/dist/view-transitions/instagram.d.ts.map +1 -1
- package/dist/view-transitions/jaemin.d.ts +2 -6
- package/dist/view-transitions/jaemin.d.ts.map +1 -1
- package/dist/view-transitions/pinterest.d.ts +2 -2
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/rotate.d.ts +5 -2
- package/dist/view-transitions/rotate.d.ts.map +1 -1
- package/dist/view-transitions/scroll.d.ts +2 -2
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/sheet.d.ts +19 -0
- package/dist/view-transitions/sheet.d.ts.map +1 -0
- package/dist/view-transitions/slide.d.ts +2 -2
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/dist/view-transitions/snap.d.ts +14 -0
- package/dist/view-transitions/snap.d.ts.map +1 -0
- package/dist/view-transitions/strip.d.ts +6 -2
- package/dist/view-transitions/strip.d.ts.map +1 -1
- package/dist/view-transitions/swap.d.ts +13 -0
- package/dist/view-transitions/swap.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/animator/animate/css-runner.d.ts.map +0 -1
- package/dist/animator/animate/index.d.ts +0 -42
- package/dist/animator/animate/index.d.ts.map +0 -1
- package/dist/animator/animate/tick-runner.d.ts.map +0 -1
- package/dist/animator/animate/types.d.ts.map +0 -1
- package/dist/animator/animation.d.ts.map +0 -1
- package/dist/animator/index.d.ts.map +0 -1
- package/dist/animator/spring-core.d.ts +0 -82
- package/dist/animator/spring-core.d.ts.map +0 -1
- package/dist/animator/ticker.d.ts.map +0 -1
- package/dist/jaemin-BG8HRXG1.cjs +0 -1
- package/dist/jaemin-BWkrXq0V.js +0 -131
- /package/dist/animator/{ticker.d.ts → runner/ticker.d.ts} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Integrator, IntegratorState } from './types';
|
|
2
|
+
import { SpringIntegratorConfig } from './spring-integrator';
|
|
3
|
+
/**
|
|
4
|
+
* Follower spring configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface FollowerSpringConfig {
|
|
7
|
+
stiffness: number;
|
|
8
|
+
damping: number;
|
|
9
|
+
}
|
|
10
|
+
export interface DoubleSpringIntegratorConfig extends SpringIntegratorConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Follower spring configuration
|
|
13
|
+
* - number (0-1): stiffness ratio (smaller = stronger ease-in)
|
|
14
|
+
* - { stiffness, damping }: custom follower spring config
|
|
15
|
+
*/
|
|
16
|
+
follower?: number | FollowerSpringConfig;
|
|
17
|
+
}
|
|
18
|
+
export declare class DoubleSpringIntegrator implements Integrator {
|
|
19
|
+
private readonly leader;
|
|
20
|
+
private readonly follower;
|
|
21
|
+
constructor(config: DoubleSpringIntegratorConfig);
|
|
22
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
23
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=double-spring-integrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"double-spring-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/double-spring-integrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAC1C;AAOD,qBAAa,sBAAuB,YAAW,UAAU;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;gBAEhC,MAAM,EAAE,4BAA4B;IA8BhD,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe;IA6BzE,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAmB3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrator Module
|
|
3
|
+
*
|
|
4
|
+
* Provides numerical integration implementations for animation physics.
|
|
5
|
+
* Uses strategy pattern - all integrators implement the same interface.
|
|
6
|
+
*/
|
|
7
|
+
export type { Integrator, IntegratorState } from './types';
|
|
8
|
+
export { POSITION_THRESHOLD, VELOCITY_THRESHOLD, SETTLE_THRESHOLD, } from './types';
|
|
9
|
+
export { SpringIntegrator, type SpringIntegratorConfig, } from './spring-integrator';
|
|
10
|
+
export { DoubleSpringIntegrator, type DoubleSpringIntegratorConfig, type FollowerSpringConfig, } from './double-spring-integrator';
|
|
11
|
+
export { InertiaIntegrator, type InertiaIntegratorConfig, type ResistanceType, } from './inertia-integrator';
|
|
12
|
+
export { IntegratorProvider, type PhysicsConfig } from './provider';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Integrator, IntegratorState } from './types';
|
|
2
|
+
export type ResistanceType = "linear" | "quadratic";
|
|
3
|
+
export interface InertiaIntegratorConfig {
|
|
4
|
+
/** Acceleration force (higher = faster acceleration) */
|
|
5
|
+
acceleration: number;
|
|
6
|
+
/** Resistance coefficient (higher = more resistance, lower terminal velocity) */
|
|
7
|
+
resistance: number;
|
|
8
|
+
/** Resistance type: 'linear' (proportional to v) or 'quadratic' (proportional to v²) */
|
|
9
|
+
resistanceType?: ResistanceType;
|
|
10
|
+
}
|
|
11
|
+
export declare class InertiaIntegrator implements Integrator {
|
|
12
|
+
private readonly acceleration;
|
|
13
|
+
private readonly resistance;
|
|
14
|
+
private readonly resistanceType;
|
|
15
|
+
constructor(config: InertiaIntegratorConfig);
|
|
16
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
17
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=inertia-integrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inertia-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/inertia-integrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI3D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACtC,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,qBAAa,iBAAkB,YAAW,UAAU;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAEpC,MAAM,EAAE,uBAAuB;IAM3C,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe;IAwCzE,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAK3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SpringConfig, InertiaConfig } from '../../types';
|
|
2
|
+
import { Integrator } from './types';
|
|
3
|
+
export interface PhysicsConfig {
|
|
4
|
+
spring?: SpringConfig;
|
|
5
|
+
inertia?: InertiaConfig;
|
|
6
|
+
}
|
|
7
|
+
export declare class IntegratorProvider {
|
|
8
|
+
/**
|
|
9
|
+
* Create an Integrator from physics config
|
|
10
|
+
*
|
|
11
|
+
* @param config Physics configuration (spring or inertia)
|
|
12
|
+
* @returns Appropriate Integrator instance
|
|
13
|
+
* @throws Error if both spring and inertia are provided
|
|
14
|
+
*/
|
|
15
|
+
static from(config: PhysicsConfig): Integrator;
|
|
16
|
+
/**
|
|
17
|
+
* Create an Integrator from SpringConfig (legacy support)
|
|
18
|
+
* @deprecated Use from({ spring: config }) instead
|
|
19
|
+
*/
|
|
20
|
+
static fromSpring(config: SpringConfig): Integrator;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAK1C,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,qBAAa,kBAAkB;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU;IAmD9C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU;CAGpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Integrator, IntegratorState } from './types';
|
|
2
|
+
export interface SpringIntegratorConfig {
|
|
3
|
+
stiffness: number;
|
|
4
|
+
damping: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class SpringIntegrator implements Integrator {
|
|
7
|
+
private readonly omega;
|
|
8
|
+
private readonly zeta;
|
|
9
|
+
constructor(config: SpringIntegratorConfig);
|
|
10
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
11
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=spring-integrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spring-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/spring-integrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG3D,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,MAAM,EAAE,sBAAsB;IAQ1C,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe;IAmBzE,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAM3D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrator Interface
|
|
3
|
+
*
|
|
4
|
+
* Common interface for numerical integration of motion equations.
|
|
5
|
+
* Each implementation can use different physics (spring, friction, etc.)
|
|
6
|
+
* but must conform to this interface.
|
|
7
|
+
*/
|
|
8
|
+
export interface IntegratorState {
|
|
9
|
+
position: number;
|
|
10
|
+
velocity: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Integrator {
|
|
13
|
+
/**
|
|
14
|
+
* Perform one integration step
|
|
15
|
+
*
|
|
16
|
+
* @param state Current state (position, velocity)
|
|
17
|
+
* @param target Target position
|
|
18
|
+
* @param dt Delta time in seconds
|
|
19
|
+
* @returns New state after integration
|
|
20
|
+
*/
|
|
21
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
22
|
+
/**
|
|
23
|
+
* Check if the state has settled (converged to target)
|
|
24
|
+
*
|
|
25
|
+
* @param state Current state
|
|
26
|
+
* @param target Target position
|
|
27
|
+
* @returns true if settled
|
|
28
|
+
*/
|
|
29
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const POSITION_THRESHOLD = 0.01;
|
|
32
|
+
export declare const VELOCITY_THRESHOLD = 0.01;
|
|
33
|
+
export declare const SETTLE_THRESHOLD = 0.05;
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe,CAAC;IAE1E;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5D;AAGD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Animator } from './types';
|
|
2
2
|
import { NormalizedMultiSpringConfig, AnimationState } from '../types';
|
|
3
3
|
export interface MultiAnimatorOptions {
|
|
4
4
|
config: NormalizedMultiSpringConfig;
|
|
@@ -18,7 +18,7 @@ export interface MultiAnimatorOptions {
|
|
|
18
18
|
*
|
|
19
19
|
* Config must be pre-normalized using normalizeMultiSpringSchedule()
|
|
20
20
|
*/
|
|
21
|
-
export declare class MultiAnimator extends
|
|
21
|
+
export declare class MultiAnimator extends Animator {
|
|
22
22
|
private config;
|
|
23
23
|
private animators;
|
|
24
24
|
private springOrder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-animator.d.ts","sourceRoot":"","sources":["../../src/lib/animator/multi-animator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"multi-animator.d.ts","sourceRoot":"","sources":["../../src/lib/animator/multi-animator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EACV,2BAA2B,EAE3B,cAAc,EACf,MAAM,UAAU,CAAC;AAYlB,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,2BAA2B,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,EAAE,CAAS;gBAEP,OAAO,EAAE,oBAAoB;IAQzC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,IAAI,IAAI;IAYf,QAAQ,IAAI,IAAI;IAYhB,OAAO,CAAC,iBAAiB;IAMzB,IAAI,IAAI,IAAI;IAQZ,OAAO,IAAI,IAAI;IAiCf,eAAe,IAAI,cAAc;IAgBjC;;OAEG;IACH,eAAe,IAAI,MAAM;IAKzB;;OAEG;IACH,WAAW,IAAI,MAAM;IAKrB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKnC;;OAEG;IACH,cAAc,IAAI,OAAO;IASzB;;;OAGG;IACH,MAAM,CAAC,SAAS,CACd,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAC7C,OAAO,EAAE,oBAAoB,GAC5B,aAAa;CAMjB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Integrator } from '../integrator';
|
|
2
2
|
import { AnimationControls, StyleObject } from './types';
|
|
3
3
|
export interface CssRunnerOptions {
|
|
4
|
+
integrator: Integrator;
|
|
4
5
|
element: HTMLElement;
|
|
5
6
|
from: number;
|
|
6
7
|
to: number;
|
|
7
|
-
spring: SpringConfig;
|
|
8
8
|
velocity?: number;
|
|
9
9
|
style: (progress: number) => StyleObject;
|
|
10
10
|
onComplete: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/runner/css-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AA2HD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,iBAAiB,CA6E5E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AnimationControls, StyleObject } from './types';
|
|
2
|
+
import { Integrator } from '../integrator';
|
|
3
|
+
export type RunnerOptions = {
|
|
4
|
+
tick?: (value: number) => void;
|
|
5
|
+
css?: {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
style: (progress: number) => StyleObject;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Common options passed to bound runner
|
|
12
|
+
*/
|
|
13
|
+
export interface BoundRunnerOptions {
|
|
14
|
+
integrator: Integrator;
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
velocity?: number;
|
|
18
|
+
onComplete: () => void;
|
|
19
|
+
onStart?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Bound runner - mode-specific options already applied
|
|
23
|
+
*/
|
|
24
|
+
export type BoundRunner = (options: BoundRunnerOptions) => AnimationControls;
|
|
25
|
+
export declare class RunnerProvider {
|
|
26
|
+
/**
|
|
27
|
+
* Get bound runner based on animation mode
|
|
28
|
+
*
|
|
29
|
+
* @param options Animation mode options (tick or css)
|
|
30
|
+
* @returns Bound runner function or null if no animation mode specified
|
|
31
|
+
* @throws Error if both tick and css are provided
|
|
32
|
+
*/
|
|
33
|
+
static from(options: RunnerOptions): BoundRunner | null;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/runner/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,WAAW,CAAC;QACrB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,iBAAiB,CAAC;AAE7E,qBAAa,cAAc;IACzB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,GAAG,IAAI;CA0BxD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Integrator } from '../integrator';
|
|
2
2
|
import { AnimationControls } from './types';
|
|
3
3
|
export interface TickRunnerOptions {
|
|
4
|
+
integrator: Integrator;
|
|
4
5
|
from: number;
|
|
5
6
|
to: number;
|
|
6
|
-
spring: SpringConfig;
|
|
7
7
|
velocity?: number;
|
|
8
8
|
onUpdate: (value: number) => void;
|
|
9
9
|
onComplete: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tick-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/runner/tick-runner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,GACzB,iBAAiB,CA4DnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticker.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/runner/ticker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAEnE,cAAM,MAAM;IACV,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,SAAS,CAAS;IAG1B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,OAAO,CAAK;IAGpB,OAAO,CAAC,YAAY,CAAO;IAC3B,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,YAAY,CAAM;IAG1B,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,IAAI,CAyCV;IAEF,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI;IAe/C,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAW3C;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAK1D;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKtB,gBAAgB,IAAI,MAAM;IAI1B,UAAU,IAAI,MAAM;CAGrB;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Integrator } from '../integrator';
|
|
2
2
|
/**
|
|
3
3
|
* CSS style object type
|
|
4
4
|
*/
|
|
@@ -13,12 +13,15 @@ export interface AnimationControls {
|
|
|
13
13
|
isRunning: () => boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Animation Options -
|
|
16
|
+
* Animation Options - Low-level runner options
|
|
17
|
+
*
|
|
18
|
+
* Receives pre-created Integrator instance.
|
|
19
|
+
* Use SingleAnimator for higher-level API with spring config.
|
|
17
20
|
*/
|
|
18
21
|
export interface AnimationOptions {
|
|
22
|
+
integrator: Integrator;
|
|
19
23
|
from: number;
|
|
20
24
|
to: number;
|
|
21
|
-
spring: SpringConfig;
|
|
22
25
|
velocity?: number;
|
|
23
26
|
onComplete: () => void;
|
|
24
27
|
onStart?: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/runner/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAGrB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,WAAW,CAAC;QACrB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;KAC1C,CAAC;CACH"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StyleObject } from './
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { StyleObject } from './runner/types';
|
|
2
|
+
import { AnimationState, PhysicsOptions } from '../types';
|
|
3
|
+
import { Animator } from './types';
|
|
4
4
|
export type { StyleObject };
|
|
5
5
|
export interface AnimatorOptions {
|
|
6
6
|
from?: number;
|
|
7
7
|
to?: number;
|
|
8
|
-
|
|
8
|
+
physics?: PhysicsOptions;
|
|
9
9
|
tick?: (progress: number) => void;
|
|
10
10
|
css?: {
|
|
11
11
|
element: HTMLElement;
|
|
@@ -15,19 +15,27 @@ export interface AnimatorOptions {
|
|
|
15
15
|
onStart?: () => void;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* SingleAnimator - Spring-based Animation Controller for single spring
|
|
19
|
+
*
|
|
20
|
+
* High-level API that accepts spring config or integrator factory.
|
|
21
|
+
* Internally creates Integrator and selects appropriate runner.
|
|
19
22
|
*
|
|
20
|
-
* Internally selects appropriate runner based on tick or css option
|
|
21
23
|
* - tick: RAF-based real-time animation
|
|
22
24
|
* - css: Web Animation API based (GPU accelerated, velocity tracking via simulation data)
|
|
23
25
|
*/
|
|
24
|
-
export declare class
|
|
26
|
+
export declare class SingleAnimator extends Animator {
|
|
25
27
|
private options;
|
|
28
|
+
private runner;
|
|
26
29
|
private controls;
|
|
27
30
|
private isAnimating;
|
|
28
31
|
private currentValue;
|
|
29
32
|
private currentVelocity;
|
|
30
33
|
constructor(options: AnimatorOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Create Integrator from physics options
|
|
36
|
+
* Priority: integrator factory > inertia/spring config > default spring
|
|
37
|
+
*/
|
|
38
|
+
private createIntegrator;
|
|
31
39
|
private runAnimation;
|
|
32
40
|
forward(): void;
|
|
33
41
|
backward(): void;
|
|
@@ -43,6 +51,6 @@ export declare class Animator extends Animation {
|
|
|
43
51
|
static fromState(state: {
|
|
44
52
|
position: number;
|
|
45
53
|
velocity: number;
|
|
46
|
-
}, options: AnimatorOptions):
|
|
54
|
+
}, options: AnimatorOptions): SingleAnimator;
|
|
47
55
|
}
|
|
48
|
-
//# sourceMappingURL=
|
|
56
|
+
//# sourceMappingURL=single-animator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-animator.d.ts","sourceRoot":"","sources":["../../src/lib/animator/single-animator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,YAAY,EAAE,WAAW,EAAE,CAAC;AAK5B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,WAAW,CAAC;QACrB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;KAC1C,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAO,CAAC,OAAO,CAMb;IACF,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAa;gBAExB,OAAO,EAAE,eAAe;IAmBpC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,YAAY;IA6BpB,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,OAAO,IAAI,IAAI;IAWf,IAAI,IAAI,IAAI;IAWZ,WAAW,IAAI,MAAM;IAIrB,eAAe,IAAI,MAAM;IAIzB,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI,cAAc;IASjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAIzD,MAAM,CAAC,SAAS,CACd,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAC7C,OAAO,EAAE,eAAe,GACvB,cAAc;CAMlB"}
|
|
@@ -5,7 +5,7 @@ import { AnimationState } from '../types';
|
|
|
5
5
|
* Provides common interface for both single and multi-spring animations.
|
|
6
6
|
* Subclasses implement the actual animation logic.
|
|
7
7
|
*/
|
|
8
|
-
export declare abstract class
|
|
8
|
+
export declare abstract class Animator {
|
|
9
9
|
/**
|
|
10
10
|
* Start animation moving forward (from → to)
|
|
11
11
|
* For IN transitions: 0 → 1
|
|
@@ -54,4 +54,4 @@ export declare abstract class Animation {
|
|
|
54
54
|
*/
|
|
55
55
|
abstract getIsAnimating(): boolean;
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/animator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,8BAAsB,QAAQ;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB;;OAEG;IACH,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;OAEG;IACH,QAAQ,CAAC,eAAe,IAAI,cAAc;IAE1C;;;OAGG;IACH,QAAQ,CAAC,eAAe,IAAI,MAAM;IAElC;;;OAGG;IACH,QAAQ,CAAC,WAAW,IAAI,MAAM;IAE9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAEtC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAE5C;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,OAAO;CACnC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";var tt=Object.defineProperty;var et=(n,i,t)=>i in n?tt(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var d=(n,i,t)=>et(n,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./types.cjs"),F=require("./provider-B6Xnh0BA.cjs");class it{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 i=Date.now();let e=i-this.lastUpdate;e>this.lagThreshold||e<0?(this.startTime+=e-this.adjustedLag,e=this.adjustedLag):e>this.maxDeltaTime&&(e=this.maxDeltaTime),this.lastUpdate=i;const o=i-this.startTime,s=o-this.nextTime;if(s>0){const l=e/1e3;this.elapsed=o/1e3,this.nextTime+=s+(s>=this.gap?4:this.gap-s),this.listeners.forEach(r=>{r(l,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(i){return this.listeners.add(i),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(i)}}unsubscribe(i){this.listeners.delete(i),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(i,t){this.lagThreshold=i,this.adjustedLag=Math.min(t,i)}fps(i){this.gap=1e3/i,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const _=new it;function nt(n){const{integrator:i,from:t,to:e,velocity:o=0,onUpdate:s,onComplete:l,onStart:r}=n;let c={position:t,velocity:o},u=!0,m=0,g=!1;const S=v=>{if(u){if(g||(g=!0,r==null||r()),c=i.step(c,e,v),i.isSettled(c,e)){if(m+=Math.min(v,.033),m>=F.SETTLE_THRESHOLD){c={position:e,velocity:0},u=!1,s(c.position),_.unsubscribe(S),l();return}}else m=0;s(c.position)}};return _.subscribe(S),{stop:()=>{u&&(u=!1,_.unsubscribe(S))},getPosition:()=>c.position,getVelocity:()=>c.velocity,isRunning:()=>u}}const V=1e3/60;function rt(n,i,t,e=0){let s={position:i,velocity:e},l=0;const r=[];for(let c=0;c<600;c++){const u=c*V;if(r.push({time:u,position:s.position,velocity:s.velocity}),s=n.step(s,t,V/1e3),n.isSettled(s,t)){if(l+=V/1e3,l>=F.SETTLE_THRESHOLD){r.push({time:(c+1)*V,position:t,velocity:0});break}}else l=0}return r}function X(n,i){if(n.length===0)return{position:0,velocity:0};const t=n[0],e=n[n.length-1];if(i<=0)return{position:t.position,velocity:t.velocity};if(i>=e.time)return{position:e.position,velocity:e.velocity};let o=0,s=n.length-1;for(;o<s-1;){const u=Math.floor((o+s)/2);n[u].time<=i?o=u:s=u}const l=n[o],r=n[s],c=(i-l.time)/(r.time-l.time);return{position:l.position+(r.position-l.position)*c,velocity:l.velocity+(r.velocity-l.velocity)*c}}function ot(n,i){return n.map(t=>i(t.position))}function st(n){const{integrator:i,element:t,from:e,to:o,velocity:s=0,style:l,onComplete:r,onStart:c}=n,u=rt(i,e,o,s);if(u.length===0)return c==null||c(),r(),{stop:()=>{},getPosition:()=>o,getVelocity:()=>0,isRunning:()=>!1};const m=ot(u,l),g=u[u.length-1],S=g.time,v=t.animate(m,{duration:S,fill:"forwards",easing:"linear"});let a=!0;const f=performance.now();return c==null||c(),v.onfinish=()=>{a&&(a=!1,r())},{stop:()=>{a&&(a=!1,v.cancel())},getPosition:()=>{if(!a)return g.position;const T=performance.now()-f;return X(u,T).position},getVelocity:()=>{if(!a)return 0;const T=performance.now()-f;return X(u,T).velocity},isRunning:()=>a}}class at{static from(i){const{tick:t,css:e}=i;if(t&&e)throw new Error("Cannot use both 'tick' and 'css' options together");return e?o=>st({...o,element:e.element,style:e.style}):t?o=>nt({...o,onUpdate:t}):null}}class j{}const ct={stiffness:300,damping:30};class z 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);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.runner=at.from({tick:t.tick,css:t.css})}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?F.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new F.SpringIntegrator(ct)}runAnimation(t){var e,o;if(this.isAnimating=!0,!this.runner){(o=(e=this.options).onStart)==null||o.call(e),this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.options.onComplete();return}this.controls=this.runner({integrator: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}}static fromState(t,e){const o=new z(e);return o.setValue(t.position),o.setVelocity(t.velocity),o}}class L extends j{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,"from");d(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 e=this.generateId(),o=new z({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:o,started:!1}),this.springOrder.push(e)})}getAnimatorProgress(t){const e=t.animator.getCurrentState(),o=Math.abs(e.to-e.from);return o===0?1:Math.abs(e.position-e.from)/o}getOrderedIds(){return this.direction==="forward"?this.springOrder:[...this.springOrder].reverse()}onAnimatorComplete(t){var o,s,l,r,c,u;const e=this.animators.get(t);!e||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(s=(o=e.item).onComplete)==null||s.call(o),(r=(l=this.config).onProgress)==null||r.call(l,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 e=0;e<t.length;e++){const o=t[e],s=this.animators.get(o);if(!s||s.started)continue;if(e===0){this.startAnimator(o);continue}const l=t[e-1],r=this.animators.get(l);if(!r||!r.started)continue;const c=this.getAnimatorProgress(r),u=s.item.normalizedOffset;c>=u&&this.startAnimator(o)}}startAnimator(t){const e=this.animators.get(t);!e||e.started||(e.started=!0,this.direction==="forward"?e.animator.forward():e.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 e;const t=this.springOrder[0];return t?((e=this.animators.get(t))==null?void 0:e.animator)??null:null}forward(){var t,e;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(e=(t=this.config).onStart)==null||e.call(t),this.startScheduler()}backward(){var t,e;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(e=(t=this.config).onStart)==null||e.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 e=t.animator.getCurrentState();if(e.position===e.to){const s=z.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,physics:t.item.physics,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 e=this.getFirstAnimator();e==null||e.setValue(t)}setVelocity(t){const e=this.getFirstAnimator();e==null||e.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,e){const o=new L(e);return o.setValue(t.position),o.setVelocity(t.velocity),o}}const H=Symbol.for("TRANSITION_STRATEGY"),G=n=>({runIn:async i=>{const{currentAnimation:t}=n;if(t&&t.direction==="out"){const o=t.controller.getCurrentValue(),s=t.controller.getVelocity();if(t.controller.stop(),i.out)return{config:await i.out,state:{position:o,velocity:s},from:1,to:0,direction:"backward"}}return 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=>{const{currentAnimation:t}=n;if(t&&t.direction==="in"){const o=t.controller.getCurrentValue(),s=t.controller.getVelocity();if(t.controller.stop(),i.in)return{config:await i.in,state:{position:o,velocity:s},from:0,to:1,direction:"backward"}}return 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"}}}),$=()=>({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"}}),Y="data-ssgoi-scope",W="data-ssgoi-scope-ready";function lt(){return n=>{if(n)return n.setAttribute(Y,""),queueMicrotask(()=>{queueMicrotask(()=>{n.setAttribute(W,"true")})}),()=>{}}}function B(n){return n.hasAttribute(W)}function K(n){return n.closest(`[${Y}]`)}function ut(n,i){var v;let t=null,e=null,o=null,s=null;const l={get currentAnimation(){return t}},r=((v=i==null?void 0:i.strategy)==null?void 0:v.call(i,l))||G(l),c=async a=>{var E;e&&(e.remove(),e=null);const f=n(),T=f.in&&f.in(a),M=!(i!=null&&i.strategy)&&f.out?f.out(a):void 0;if(!T)return;const P={in:A.normalizeToMultiSpring(T),out:M?A.normalizeToMultiSpring(M):void 0},y=await r.runIn(P);if(!y.config){t&&(t.direction="in");return}const p=y.config;(E=p.prepare)==null||E.call(p,a),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var C;t=null,(C=p.onEnd)==null||C.call(p)}},a),h=L.fromState(y.state,{config:w,from:y.from,to:y.to});t={controller:h,direction:"in"},y.direction==="forward"?h.forward():h.backward()},u=async a=>{var C;e=a;const f=n(),T=!(i!=null&&i.strategy)&&f.in?f.in(a):void 0,M=f.out&&f.out(a);if(!M)return;const P={in:T?A.normalizeToMultiSpring(T):void 0,out:A.normalizeToMultiSpring(M)},y=await r.runOut(P);if(!y.config){t&&(t.direction="out"),e&&(e.remove(),e=null);return}const p=y.config;(C=p.prepare)==null||C.call(p,a),E(),p.wait&&await p.wait();const w=A.normalizeMultiSpringSchedule({...p,onEnd:()=>{var k,I;(k=p.onEnd)==null||k.call(p),e&&(e.remove(),e=null),t=null,(I=i==null?void 0:i.onCleanupEnd)==null||I.call(i)}},a),h=L.fromState(y.state,{config:w,from:y.from,to:y.to});t={controller:h,direction:"out"},y.direction==="forward"?h.forward():h.backward();function E(){!o||!e||(s&&o.contains(s)?o.insertBefore(e,s):o.appendChild(e))}};let m=null,g=!1;const S=a=>()=>{if(g)return;g=!0;const f=a.cloneNode(!0);m?queueMicrotask(()=>{document.contains(m)&&u(f)}):u(f)};return a=>{if(a)return requestAnimationFrame(()=>{o=a.parentElement,s=a.nextElementSibling}),g=!1,(i==null?void 0:i.scope)==="local"?queueMicrotask(()=>{m=K(a),!(m&&!B(m))&&c(a)}):c(a),S(a)}}const R=new Map;let b=null,N=!1;function J(n){if(n instanceof HTMLElement&&R.has(n)){const t=R.get(n);R.delete(n),queueMicrotask(()=>{t()})}const i=n.childNodes;for(let t=0;t<i.length;t++){const e=i[t];e&&J(e)}}function ft(){N||typeof document>"u"||(N=!0,b=new MutationObserver(n=>{for(const i of n){const t=i.removedNodes;for(let e=0;e<t.length;e++){const o=t[e];o&&J(o)}}}),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 Q(n,i){ft(),R.set(n,i)}function dt(n){return R.has(n)}function mt(){return R.size}function ht(n){const i=R.get(n);return i?(R.delete(n),i(),!0):!1}function gt(){R.clear(),b==null||b.disconnect(),b=null,N=!1}const x=new Map,q=new Map,U=new Map;function pt(n,i,t){x.set(n,i);let e=q.get(n);if(e)return e;const o=i;return e=ut(()=>{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)===o&&wt(n)}}),q.set(n,e),e}function wt(n){x.delete(n),q.delete(n),U.delete(n)}function St(n,i="manual"){const t=pt(n.key,{in:n.in,out:n.out},{strategy:n[H],scope:n.scope});if(i==="manual")return t;let e=U.get(n.key);return e||(e=o=>{if(o){const s=t(o);s&&Q(o,s)}},U.set(n.key,e),e)}function yt(n){const i=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...i]}function vt(n){let i=!1,t=0,e=0,o=!1;const s=50,l=a=>{if(!n)return;const f=a.touches[0];f&&(o=f.clientX<s,o&&(t=f.clientX,e=f.clientY))},r=a=>{if(!n||!o)return;const f=a.touches[0];if(!f)return;const T=f.clientX-t,M=f.clientY-e;T>window.outerWidth/2-5&&Math.abs(T)>Math.abs(M)?i=!0:i=!1},c=()=>{n&&(o=!1,t=0,e=0)},u=()=>i,m=()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",l,{passive:!0}),window.addEventListener("touchmove",r,{passive:!0}),window.addEventListener("touchend",c,{passive:!0}))},g=()=>{typeof window>"u"||(window.removeEventListener("touchstart",l),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",c))};let S=0;return{initialize:m,cleanup:g,isSwipePending:u,resetSwipeDetection:()=>{S++,S>1&&(S=0,i=!1)}}}const Ct=n=>{let i=n.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i),e=t.overflow+t.overflowY+t.overflowX;if(e.includes("auto")||e.includes("scroll")||i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.parentElement}return document.documentElement},Tt=n=>{let i=n.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return i;i=i.parentElement}return document.body};function At(){let n=null,i=null;const t=new Map;let e=null;const o=()=>{n&&e&&t.set(e,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(m,g)=>{i=m,n||(n=Ct(m),(n===document.documentElement?window:n).addEventListener("scroll",o,{passive:!0})),e=g},calculateScrollOffset:(m,g)=>{const S=m&&t.has(m)?t.get(m):{x:0,y:0},v=g&&t.has(g)?t.get(g):{x:0,y:0};return{x:-v.x+S.x,y:-v.y+S.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>i?Tt(i):document.body,getScrollPosition:m=>m&&t.has(m)?t.get(m):{x:0,y:0}}}function O(n,i){if(i==="*")return!0;if(i.endsWith("/*")){const t=i.slice(0,-2);return n===t||n.startsWith(t+"/")}return n===i}function Et(n,i,t){for(const e of t)if(O(n,e.from)&&O(i,e.to))return e.transition;for(const e of t)if((e.from==="*"||O(n,e.from))&&(e.to==="*"||O(i,e.to)))return e.transition;return null}function bt(n,i){const{transitions:t=[],defaultTransition:e,middleware:o=(w,h)=>({from:w,to:h}),skipOnIosSwipe:s=!0}=n,{outFirst:l=!0}=i||{};let r=null;const c=yt(t),{initializeContext:u,calculateScrollOffset:m,getScrollContainer:g,getPositionedParentElement:S,getScrollPosition:v}=At(),a=vt(s);a.initialize();function f(){if(r!=null&&r.from&&(r!=null&&r.to)){const{from:w,to:h}=o(r.from,r.to),C=Et(w,h,c)||e,k=m(r.from,r.to),I={scrollOffset:k,scroll:v(r.from),get scrollingElement(){return g()||document.documentElement},get positionedParent(){return S()}},Z={scrollOffset:k,get scroll(){return r?v(r.to):{x:0,y:0}},get scrollingElement(){return g()||document.documentElement},get positionedParent(){return S()}};C&&(C.out&&r.outResolve&&r.outResolve(D=>C.out(D,I)),C.in&&r.inResolve&&r.inResolve(D=>C.in(D,Z))),r=null}}function T(){r&&(r.inResolve&&r.inResolve(()=>({})),r.outResolve&&r.outResolve(()=>({})),r=null)}const y=l?async(w,h)=>a.isSwipePending()?(a.resetSwipeDetection(),()=>({})):h==="in"&&(!r||!r.from)?()=>({}):(r||(r={}),h==="out"?(r.from=w,new Promise(E=>{r.outResolve=E,f()})):(r.to=w,new Promise(E=>{r.inResolve=E,f()}))):async(w,h)=>a.isSwipePending()?(a.resetSwipeDetection(),()=>({})):(r&&(h==="out"&&r.from&&r.from!==w||h==="in"&&r.to&&r.to!==w)&&T(),r||(r={}),h==="out"?(r.from=w,new Promise(C=>{r.outResolve=C,f()})):(r.to=w,new Promise(C=>{r.inResolve=C,f()})));return w=>({key:w,in:async h=>(u(h,w),(await y(w,"in"))(h)),out:async h=>(await y(w,"out"))(h),[H]:$})}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.SCOPE_ATTR=Y;exports.SCOPE_READY_ATTR=W;exports.TRANSITION_STRATEGY=H;exports.createDefaultStrategy=G;exports.createPageTransitionStrategy=$;exports.createSggoiTransitionContext=bt;exports.createTransitionScope=lt;exports.findScope=K;exports.getWatchedCount=mt;exports.isScopeReady=B;exports.isWatched=dt;exports.resetObserver=gt;exports.transition=St;exports.triggerUnmount=ht;exports.watchUnmount=Q;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export * from './transition/transition-scope';
|
|
|
4
4
|
export * from './transition/unmount-observer';
|
|
5
5
|
export * from './ssgoi-transition/create-ssgoi-transition-context';
|
|
6
6
|
export * from './transition/transition-strategy';
|
|
7
|
-
export { jaeminInternal } from './view-transitions/jaemin';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oDAAoD,CAAC;AACnE,cAAc,kCAAkC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oDAAoD,CAAC;AACnE,cAAc,kCAAkC,CAAC"}
|