@ssgoi/core 3.5.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animator/integrator/double-spring-integrator.d.ts +31 -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 +34 -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 +19 -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 +18 -13
- 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} +22 -12
- 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.js +552 -569
- package/dist/provider-Cs5iBqRD.cjs +1 -0
- package/dist/provider-Cu4NSF1Q.js +167 -0
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition-strategy.d.ts +8 -8
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +4 -4
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +4 -4
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +4 -4
- package/dist/transitions/fade.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 +141 -191
- package/dist/transitions/rotate.d.ts +4 -4
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +4 -4
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +4 -4
- 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 +124 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +41 -48
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/wait-paint.d.ts +15 -0
- package/dist/utils/wait-paint.d.ts.map +1 -0
- 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 +2 -2
- package/dist/view-transitions/depth.d.ts.map +1 -1
- 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 +19 -19
- 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 +874 -869
- 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 -2
- 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 +2 -2
- package/dist/view-transitions/sheet.d.ts.map +1 -1
- 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 +2 -2
- package/dist/view-transitions/swap.d.ts.map +1 -1
- 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/animator/{ticker.d.ts → runner/ticker.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
/** Position threshold for settling detection @default 0.01 */
|
|
10
|
+
restDelta?: number;
|
|
11
|
+
/** Velocity threshold for settling detection @default 0.01 */
|
|
12
|
+
restSpeed?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DoubleSpringIntegratorConfig extends SpringIntegratorConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Follower spring configuration
|
|
17
|
+
* - number (0-1): stiffness ratio (smaller = stronger ease-in)
|
|
18
|
+
* - { stiffness, damping }: custom follower spring config
|
|
19
|
+
*/
|
|
20
|
+
follower?: number | FollowerSpringConfig;
|
|
21
|
+
}
|
|
22
|
+
export declare class DoubleSpringIntegrator implements Integrator {
|
|
23
|
+
private readonly leader;
|
|
24
|
+
private readonly follower;
|
|
25
|
+
private readonly restDelta;
|
|
26
|
+
private readonly restSpeed;
|
|
27
|
+
constructor(config: DoubleSpringIntegratorConfig);
|
|
28
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
29
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
30
|
+
}
|
|
31
|
+
//# 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;IAChB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;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;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,EAAE,4BAA4B;IAyChD,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,34 @@
|
|
|
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
|
+
/** Minimum boundary value */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** Maximum boundary value */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Spring stiffness for boundary bounce @default 500 */
|
|
15
|
+
bounceStiffness?: number;
|
|
16
|
+
/** Spring damping for boundary bounce @default 10 */
|
|
17
|
+
bounceDamping?: number;
|
|
18
|
+
/** Position threshold for settling detection @default 0.01 */
|
|
19
|
+
restDelta?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class InertiaIntegrator implements Integrator {
|
|
22
|
+
private readonly acceleration;
|
|
23
|
+
private readonly resistance;
|
|
24
|
+
private readonly resistanceType;
|
|
25
|
+
private readonly min;
|
|
26
|
+
private readonly max;
|
|
27
|
+
private readonly bounceStiffness;
|
|
28
|
+
private readonly bounceDamping;
|
|
29
|
+
private readonly restDelta;
|
|
30
|
+
constructor(config: InertiaIntegratorConfig);
|
|
31
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
32
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
33
|
+
}
|
|
34
|
+
//# 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;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAM3D,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;IAChC,6BAA6B;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;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;IAChD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,EAAE,uBAAuB;IAW3C,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe;IA8DzE,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;IAoE9C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU;CAGpD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Integrator, IntegratorState } from './types';
|
|
2
|
+
export interface SpringIntegratorConfig {
|
|
3
|
+
stiffness: number;
|
|
4
|
+
damping: number;
|
|
5
|
+
/** Position threshold for settling detection @default 0.01 */
|
|
6
|
+
restDelta?: number;
|
|
7
|
+
/** Velocity threshold for settling detection @default 0.01 */
|
|
8
|
+
restSpeed?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class SpringIntegrator implements Integrator {
|
|
11
|
+
private readonly omega;
|
|
12
|
+
private readonly zeta;
|
|
13
|
+
private readonly restDelta;
|
|
14
|
+
private readonly restSpeed;
|
|
15
|
+
constructor(config: SpringIntegratorConfig);
|
|
16
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
17
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# 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;AAM3D,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,EAAE,sBAAsB;IAU1C,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,27 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Animator } from './types';
|
|
2
|
+
import { NormalizedMultiAnimationConfig, AnimationState } from '../types';
|
|
3
3
|
export interface MultiAnimatorOptions {
|
|
4
|
-
config:
|
|
4
|
+
config: NormalizedMultiAnimationConfig;
|
|
5
5
|
from: number;
|
|
6
6
|
to: number;
|
|
7
|
+
state?: {
|
|
8
|
+
position: number;
|
|
9
|
+
velocity: number;
|
|
10
|
+
};
|
|
7
11
|
}
|
|
8
12
|
/**
|
|
9
|
-
* MultiAnimator - Coordinates multiple
|
|
13
|
+
* MultiAnimator - Coordinates multiple animations
|
|
10
14
|
*
|
|
11
15
|
* Extends Animation base class to provide unified interface.
|
|
12
|
-
* Manages the lifecycle and timing of multiple
|
|
16
|
+
* Manages the lifecycle and timing of multiple animations.
|
|
13
17
|
*
|
|
14
18
|
* All scheduling is progress-based using normalizedOffset (0-1):
|
|
15
|
-
* - offset 0: Start immediately with previous
|
|
16
|
-
* - offset 1: Start after previous
|
|
17
|
-
* - offset 0-1: Start when previous
|
|
19
|
+
* - offset 0: Start immediately with previous animation
|
|
20
|
+
* - offset 1: Start after previous animation completes
|
|
21
|
+
* - offset 0-1: Start when previous animation reaches this progress
|
|
18
22
|
*
|
|
19
|
-
* Config must be pre-normalized using
|
|
23
|
+
* Config must be pre-normalized using normalizeSchedule()
|
|
20
24
|
*/
|
|
21
|
-
export declare class MultiAnimator extends
|
|
25
|
+
export declare class MultiAnimator extends Animator {
|
|
22
26
|
private config;
|
|
23
27
|
private animators;
|
|
24
|
-
private
|
|
28
|
+
private itemOrder;
|
|
25
29
|
private completedCount;
|
|
26
30
|
private completedAnimators;
|
|
27
31
|
private direction;
|
|
@@ -29,7 +33,8 @@ export declare class MultiAnimator extends Animation {
|
|
|
29
33
|
private rafId;
|
|
30
34
|
private from;
|
|
31
35
|
private to;
|
|
32
|
-
|
|
36
|
+
private initialState;
|
|
37
|
+
private constructor();
|
|
33
38
|
private generateId;
|
|
34
39
|
private initializeAnimators;
|
|
35
40
|
/**
|
|
@@ -91,6 +96,6 @@ export declare class MultiAnimator extends Animation {
|
|
|
91
96
|
static fromState(state: {
|
|
92
97
|
position: number;
|
|
93
98
|
velocity: number;
|
|
94
|
-
}, options: MultiAnimatorOptions): MultiAnimator;
|
|
99
|
+
}, options: Omit<MultiAnimatorOptions, "state">): MultiAnimator;
|
|
95
100
|
}
|
|
96
101
|
//# sourceMappingURL=multi-animator.d.ts.map
|
|
@@ -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,8BAA8B,EAE9B,cAAc,EACf,MAAM,UAAU,CAAC;AAYlB,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,8BAA8B,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAChD;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,SAAS,CAAgB;IACjC,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;IACnB,OAAO,CAAC,YAAY,CAAyC;IAE7D,OAAO;IAYP,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,mBAAmB;IAkC3B;;;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,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAC3C,aAAa;CAGjB"}
|
|
@@ -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,CAuF5E"}
|
|
@@ -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,33 @@ 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;
|
|
33
|
+
private updateFn;
|
|
30
34
|
constructor(options: AnimatorOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Sync element state to current progress value
|
|
37
|
+
* Uses the update callback if provided
|
|
38
|
+
*/
|
|
39
|
+
syncState(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Create Integrator from physics options
|
|
42
|
+
* Priority: integrator factory > inertia/spring config > default spring
|
|
43
|
+
*/
|
|
44
|
+
private createIntegrator;
|
|
31
45
|
private runAnimation;
|
|
32
46
|
forward(): void;
|
|
33
47
|
backward(): void;
|
|
@@ -40,9 +54,5 @@ export declare class Animator extends Animation {
|
|
|
40
54
|
setValue(value: number): void;
|
|
41
55
|
setVelocity(velocity: number): void;
|
|
42
56
|
updateOptions(newOptions: Partial<AnimatorOptions>): void;
|
|
43
|
-
static fromState(state: {
|
|
44
|
-
position: number;
|
|
45
|
-
velocity: number;
|
|
46
|
-
}, options: AnimatorOptions): Animator;
|
|
47
57
|
}
|
|
48
|
-
//# sourceMappingURL=
|
|
58
|
+
//# 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;IACpC,OAAO,CAAC,QAAQ,CAA6B;gBAEjC,OAAO,EAAE,eAAe;IAmCpC;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB;;;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;CAG1D"}
|
|
@@ -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");class at{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 at;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 X=.01,j=.01,K=.05;function Z(n,e){const t=Math.abs(e-n.position),i=Math.abs(n.velocity),r=t<X&&i<j,s=n;if(s._leader){const a=Math.abs(e-s._leader.position),o=Math.abs(s._leader.velocity);return a<X&&o<j&&r}return r}function lt(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 ut(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 ft(n,e){return n.map(t=>e(t.position))}function dt(n){const{element:e,from:t,to:i,spring:r,velocity:s=0,style:a,onComplete:o,onStart:c}=n,u=ut(t,i,r,s);if(u.length===0)return c==null||c(),o(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1};const f=ft(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 mt(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?dt({element:c.element,from:e,to:t,spring:i,velocity:r,style:c.style,onComplete:s,onStart:a}):lt({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=mt({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 gt(){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 ht(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 pt(){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){pt(),M.set(n,e)}function wt(n){return M.has(n)}function St(){return M.size}function yt(n){const e=M.get(n);return e?(M.delete(n),e(),!0):!1}function vt(){M.clear(),b==null||b.disconnect(),b=null,q=!1}const x=new Map,N=new Map,H=new Map;function Ct(n,e,t){x.set(n,e);let i=N.get(n);if(i)return i;const r=e;return i=ht(()=>{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&&Tt(n)}}),N.set(n,i),i}function Tt(n){x.delete(n),N.delete(n),H.delete(n)}function At(n,e="manual"){const t=Ct(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 Et(n){const e=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...e]}function bt(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 Mt=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},kt=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 Rt(){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=Mt(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?kt(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 Pt(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 Vt(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=Et(t),{initializeContext:u,calculateScrollOffset:f,getScrollContainer:g,getPositionedParentElement:S,getScrollPosition:y}=Rt(),l=bt(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=Pt(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.SCOPE_ATTR=U;exports.SCOPE_READY_ATTR=W;exports.TRANSITION_STRATEGY=Y;exports.createDefaultStrategy=Q;exports.createPageTransitionStrategy=tt;exports.createSggoiTransitionContext=Vt;exports.createTransitionScope=gt;exports.findScope=it;exports.getWatchedCount=St;exports.isScopeReady=et;exports.isWatched=wt;exports.resetObserver=vt;exports.transition=At;exports.triggerUnmount=yt;exports.watchUnmount=ot;
|
|
1
|
+
"use strict";var et=Object.defineProperty;var it=(n,i,t)=>i in n?et(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var d=(n,i,t)=>it(n,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./types.cjs"),x=require("./provider-Cs5iBqRD.cjs");class nt{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 c=e/1e3;this.elapsed=o/1e3,this.nextTime+=s+(s>=this.gap?4:this.gap-s),this.listeners.forEach(r=>{r(c,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 D=new nt;function rt(n){const{integrator:i,from:t,to:e,velocity:o=0,onUpdate:s,onComplete:c,onStart:r}=n;let a={position:t,velocity:o},u=!0,m=0,g=!1;const y=v=>{if(u){if(g||(g=!0,r==null||r()),a=i.step(a,e,v),i.isSettled(a,e)){if(m+=Math.min(v,.033),m>=x.SETTLE_THRESHOLD){a={position:e,velocity:0},u=!1,s(a.position),D.unsubscribe(y),c();return}}else m=0;s(a.position)}};return D.subscribe(y),{stop:()=>{u&&(u=!1,D.unsubscribe(y))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>u}}const M=1e3/60;function ot(n,i,t,e=0){let s={position:i,velocity:e},c=0;const r=[];for(let a=0;a<600;a++){const u=a*M;if(r.push({time:u,position:s.position,velocity:s.velocity}),s=n.step(s,t,M/1e3),n.isSettled(s,t)){if(c+=M/1e3,c>=x.SETTLE_THRESHOLD){r.push({time:(a+1)*M,position:t,velocity:0});break}}else c=0}return r}function W(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 c=n[o],r=n[s],a=(i-c.time)/(r.time-c.time);return{position:c.position+(r.position-c.position)*a,velocity:c.velocity+(r.velocity-c.velocity)*a}}function st(n,i){return n.map(t=>i(t.position))}function at(n){const{integrator:i,element:t,from:e,to:o,velocity:s=0,style:c,onComplete:r,onStart:a}=n,u=ot(i,e,o,s);if(u.length===0)return a==null||a(),r(),{stop:()=>{},getPosition:()=>o,getVelocity:()=>0,isRunning:()=>!1};const m=st(u,c),g=u[u.length-1],y=g.time,v=m[0];if(v)for(const C of Object.keys(v))t.style[C]="";const f=t.animate(m,{duration:y,fill:"forwards",easing:"linear",composite:"replace"});let l=!0;const T=performance.now();return a==null||a(),f.onfinish=()=>{l&&(l=!1,r())},{stop:()=>{l&&(l=!1,f.cancel())},getPosition:()=>{if(!l)return g.position;const C=performance.now()-T;return W(u,C).position},getVelocity:()=>{if(!l)return 0;const C=performance.now()-T;return W(u,C).velocity},isRunning:()=>l}}class ct{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=>at({...o,element:e.element,style:e.style}):t?o=>rt({...o,onUpdate:t}):null}}class G{}const lt={stiffness:300,damping:30};class j extends G{constructor(t){super();d(this,"options");d(this,"runner");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);d(this,"updateFn");if(this.options={from:t.from??0,to:t.to??1,physics:t.physics,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,t.tick)this.updateFn=e=>{var o;return(o=t.tick)==null?void 0:o.call(t,e)};else if(t.css){const{element:e,style:o}=t.css;this.updateFn=s=>{const c=o(s);for(const[r,a]of Object.entries(c))e.style[r]=typeof a=="number"?String(a):a}}else this.updateFn=()=>{};this.runner=ct.from({tick:t.tick,css:t.css})}syncState(){var t;(t=this.updateFn)==null||t.call(this,this.currentValue)}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?x.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new x.SpringIntegrator(lt)}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}}}class z extends G{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"itemOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"from");d(this,"to");d(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,e)=>{const o=this.generateId(),s=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,onComplete:()=>this.onAnimatorComplete(o),onStart:t.onStart});(e===0||t.normalizedOffset===0)&&(s.setValue(this.initialState.position),s.setVelocity(this.initialState.velocity),s.syncState()),this.animators.set(o,{id:o,item:t,animator:s,started:!1}),this.itemOrder.push(o)})}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.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var o,s,c,r,a,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=(c=this.config).onProgress)==null||r.call(c,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(u=(a=this.config).onEnd)==null||u.call(a)))}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 c=t[e-1],r=this.animators.get(c);if(!r||!r.started)continue;const a=this.getAnimatorProgress(r),u=s.item.normalizedOffset;a>=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.itemOrder[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=new j({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.setValue(this.to),s.setVelocity(0),s.syncState(),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){return new z({...e,state:t})}}const U=Symbol.for("TRANSITION_STRATEGY"),$=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"}}}),K=()=>({runIn:async n=>n.in?{config:await n.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async n=>n.out?{config:await n.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),H="data-ssgoi-scope",Y="data-ssgoi-scope-ready";function ut(){return n=>{if(n)return n.setAttribute(H,""),queueMicrotask(()=>{queueMicrotask(()=>{n.setAttribute(Y,"true")})}),()=>{}}}function B(n){return n.hasAttribute(Y)}function J(n){return n.closest(`[${H}]`)}const ft=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},dt=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 X(n){return new Promise(i=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})})})}function mt(n,i){var v;let t=null,e=null,o=null,s=null;const c={get currentAnimation(){return t}},r=((v=i==null?void 0:i.strategy)==null?void 0:v.call(i,c))||$(c),a=async f=>{var E;e&&(e.remove(),e=null);const l=n(),T=l.in&&l.in(f),C=!(i!=null&&i.strategy)&&l.out?l.out(f):void 0;if(!T)return;const V={in:b.normalizeToMultiAnimation(T),out:C?b.normalizeToMultiAnimation(C):void 0},S=await r.runIn(V);if(!S.config){t&&(t.direction="in");return}const p=S.config;(E=p.prepare)==null||E.call(p);const w=b.normalizeSchedule({...p,onEnd:()=>{var A;t=null,(A=p.onEnd)==null||A.call(p)}},f);p.wait&&await p.wait();const h=z.fromState(S.state,{config:w,from:S.from,to:S.to});t={controller:h,direction:"in"},await X(),S.direction==="forward"?h.forward():h.backward()},u=async f=>{var A;e=f;const l=n(),T=!(i!=null&&i.strategy)&&l.in?l.in(f):void 0,C=l.out&&l.out(f);if(!C)return;const V={in:T?b.normalizeToMultiAnimation(T):void 0,out:b.normalizeToMultiAnimation(C)},S=await r.runOut(V);if(!S.config){t&&(t.direction="out"),e&&(e.remove(),e=null);return}const p=S.config;E(),(A=p.prepare)==null||A.call(p);const w=b.normalizeSchedule({...p,onEnd:()=>{var P,I;(P=p.onEnd)==null||P.call(p),e&&(e.remove(),e=null),t=null,(I=i==null?void 0:i.onCleanupEnd)==null||I.call(i)}},f);p.wait&&await p.wait();const h=z.fromState(S.state,{config:w,from:S.from,to:S.to});t={controller:h,direction:"out"},await X(),S.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 y=f=>()=>{if(g)return;g=!0;const l=f.cloneNode(!0);m?queueMicrotask(()=>{document.contains(m)&&u(l)}):u(l)};return f=>{if(f)return requestAnimationFrame(()=>{o=f.parentElement,s=f.nextElementSibling}),g=!1,(i==null?void 0:i.scope)==="local"?queueMicrotask(()=>{m=J(f),!(m&&!B(m))&&a(f)}):a(f),y(f)}}const R=new Map;let k=null,_=!1;function Q(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&&Q(e)}}function ht(){_||typeof document>"u"||(_=!0,k=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&&Q(o)}}}),document.body?k.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{k==null||k.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function Z(n,i){ht(),R.set(n,i)}function gt(n){return R.has(n)}function pt(){return R.size}function wt(n){const i=R.get(n);return i?(R.delete(n),i(),!0):!1}function yt(){R.clear(),k==null||k.disconnect(),k=null,_=!1}const F=new Map,q=new Map,N=new Map;function St(n,i,t){F.set(n,i);let e=q.get(n);if(e)return e;const o=i;return e=mt(()=>{const s=F.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:()=>{F.get(n)===o&&vt(n)}}),q.set(n,e),e}function vt(n){F.delete(n),q.delete(n),N.delete(n)}function At(n,i="manual"){const t=St(n.key,{in:n.in,out:n.out},{strategy:n[U],scope:n.scope});if(i==="manual")return t;let e=N.get(n.key);return e||(e=o=>{if(o){const s=t(o);s&&Z(o,s)}},N.set(n.key,e),e)}function Ct(n){const i=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...i]}function Tt(n){let i=!1,t=0,e=0,o=!1;const s=50,c=f=>{if(!n)return;const l=f.touches[0];l&&(o=l.clientX<s,o&&(t=l.clientX,e=l.clientY))},r=f=>{if(!n||!o)return;const l=f.touches[0];if(!l)return;const T=l.clientX-t,C=l.clientY-e;T>window.outerWidth/2-5&&Math.abs(T)>Math.abs(C)?i=!0:i=!1},a=()=>{n&&(o=!1,t=0,e=0)},u=()=>i,m=()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",c,{passive:!0}),window.addEventListener("touchmove",r,{passive:!0}),window.addEventListener("touchend",a,{passive:!0}))},g=()=>{typeof window>"u"||(window.removeEventListener("touchstart",c),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",a))};let y=0;return{initialize:m,cleanup:g,isSwipePending:u,resetSwipeDetection:()=>{y++,y>1&&(y=0,i=!1)}}}function Et(){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=ft(m),(n===document.documentElement?window:n).addEventListener("scroll",o,{passive:!0})),e=g},calculateScrollOffset:(m,g)=>{const y=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+y.x,y:-v.y+y.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>i?dt(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 bt(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 kt(n,i){const{transitions:t=[],defaultTransition:e,middleware:o=(w,h)=>({from:w,to:h}),skipOnIosSwipe:s=!0}=n,{outFirst:c=!0}=i||{};let r=null;const a=Ct(t),{initializeContext:u,calculateScrollOffset:m,getScrollContainer:g,getPositionedParentElement:y,getScrollPosition:v}=Et(),f=Tt(s);f.initialize();function l(){if(r!=null&&r.from&&(r!=null&&r.to)){const{from:w,to:h}=o(r.from,r.to),A=bt(w,h,a)||e,P=m(r.from,r.to),I={scrollOffset:P,scroll:v(r.from),get scrollingElement(){return g()||document.documentElement},get positionedParent(){return y()}},tt={scrollOffset:P,get scroll(){return r?v(r.to):{x:0,y:0}},get scrollingElement(){return g()||document.documentElement},get positionedParent(){return y()}};A&&(A.out&&r.outResolve&&r.outResolve(L=>A.out(L,I)),A.in&&r.inResolve&&r.inResolve(L=>A.in(L,tt))),r=null}}function T(){r&&(r.inResolve&&r.inResolve(()=>({})),r.outResolve&&r.outResolve(()=>({})),r=null)}const S=c?async(w,h)=>f.isSwipePending()?(f.resetSwipeDetection(),()=>({})):h==="in"&&(!r||!r.from)?()=>({}):(r||(r={}),h==="out"?(r.from=w,new Promise(E=>{r.outResolve=E,l()})):(r.to=w,new Promise(E=>{r.inResolve=E,l()}))):async(w,h)=>f.isSwipePending()?(f.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(A=>{r.outResolve=A,l()})):(r.to=w,new Promise(A=>{r.inResolve=A,l()})));return w=>({key:w,in:async h=>(u(h,w),(await S(w,"in"))(h)),out:async h=>(await S(w,"out"))(h),[U]:K})}exports.isCssAnimation=b.isCssAnimation;exports.isMultiAnimation=b.isMultiAnimation;exports.isSingleAnimation=b.isSingleAnimation;exports.isTickAnimation=b.isTickAnimation;exports.normalizeSchedule=b.normalizeSchedule;exports.normalizeToMultiAnimation=b.normalizeToMultiAnimation;exports.SCOPE_ATTR=H;exports.SCOPE_READY_ATTR=Y;exports.TRANSITION_STRATEGY=U;exports.createDefaultStrategy=$;exports.createPageTransitionStrategy=K;exports.createSggoiTransitionContext=kt;exports.createTransitionScope=ut;exports.findScope=J;exports.getWatchedCount=pt;exports.isScopeReady=B;exports.isWatched=gt;exports.resetObserver=yt;exports.transition=At;exports.triggerUnmount=wt;exports.watchUnmount=Z;
|