@ssgoi/core 4.0.0 → 4.2.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 +6 -0
- package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -1
- package/dist/animator/integrator/inertia-integrator.d.ts +15 -0
- package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -1
- package/dist/animator/integrator/provider.d.ts.map +1 -1
- package/dist/animator/integrator/spring-integrator.d.ts +6 -0
- package/dist/animator/integrator/spring-integrator.d.ts.map +1 -1
- package/dist/animator/multi-animator.d.ts +16 -11
- package/dist/animator/multi-animator.d.ts.map +1 -1
- package/dist/animator/runner/css-runner.d.ts.map +1 -1
- package/dist/animator/single-animator.d.ts +6 -4
- package/dist/animator/single-animator.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +603 -518
- package/dist/provider-Cs5iBqRD.cjs +1 -0
- package/dist/provider-Cu4NSF1Q.js +167 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +4 -1
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +42 -0
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -0
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/transition/transition-strategy.d.ts +6 -6
- package/dist/transition/transition-strategy.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +84 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +39 -46
- 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/depth.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +15 -15
- package/dist/view-transitions/index.js +673 -688
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/sheet.d.ts.map +1 -1
- package/dist/view-transitions/swap.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/provider-B6Xnh0BA.cjs +0 -1
- package/dist/provider-CMBovM_W.js +0 -134
- package/dist/ssgoi-transition/types.d.ts +0 -8
- package/dist/ssgoi-transition/types.d.ts.map +0 -1
|
@@ -6,6 +6,10 @@ import { SpringIntegratorConfig } from './spring-integrator';
|
|
|
6
6
|
export interface FollowerSpringConfig {
|
|
7
7
|
stiffness: number;
|
|
8
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;
|
|
9
13
|
}
|
|
10
14
|
export interface DoubleSpringIntegratorConfig extends SpringIntegratorConfig {
|
|
11
15
|
/**
|
|
@@ -18,6 +22,8 @@ export interface DoubleSpringIntegratorConfig extends SpringIntegratorConfig {
|
|
|
18
22
|
export declare class DoubleSpringIntegrator implements Integrator {
|
|
19
23
|
private readonly leader;
|
|
20
24
|
private readonly follower;
|
|
25
|
+
private readonly restDelta;
|
|
26
|
+
private readonly restSpeed;
|
|
21
27
|
constructor(config: DoubleSpringIntegratorConfig);
|
|
22
28
|
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
23
29
|
isSettled(state: IntegratorState, target: number): boolean;
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -7,11 +7,26 @@ export interface InertiaIntegratorConfig {
|
|
|
7
7
|
resistance: number;
|
|
8
8
|
/** Resistance type: 'linear' (proportional to v) or 'quadratic' (proportional to v²) */
|
|
9
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;
|
|
10
20
|
}
|
|
11
21
|
export declare class InertiaIntegrator implements Integrator {
|
|
12
22
|
private readonly acceleration;
|
|
13
23
|
private readonly resistance;
|
|
14
24
|
private readonly resistanceType;
|
|
25
|
+
private readonly min;
|
|
26
|
+
private readonly max;
|
|
27
|
+
private readonly bounceStiffness;
|
|
28
|
+
private readonly bounceDamping;
|
|
29
|
+
private readonly restDelta;
|
|
15
30
|
constructor(config: InertiaIntegratorConfig);
|
|
16
31
|
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
17
32
|
isSettled(state: IntegratorState, target: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inertia-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/integrator/inertia-integrator.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -2,10 +2,16 @@ import { Integrator, IntegratorState } from './types';
|
|
|
2
2
|
export interface SpringIntegratorConfig {
|
|
3
3
|
stiffness: number;
|
|
4
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;
|
|
5
9
|
}
|
|
6
10
|
export declare class SpringIntegrator implements Integrator {
|
|
7
11
|
private readonly omega;
|
|
8
12
|
private readonly zeta;
|
|
13
|
+
private readonly restDelta;
|
|
14
|
+
private readonly restSpeed;
|
|
9
15
|
constructor(config: SpringIntegratorConfig);
|
|
10
16
|
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
11
17
|
isSettled(state: IntegratorState, target: number): boolean;
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { Animator } from './types';
|
|
2
|
-
import {
|
|
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
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 Animator {
|
|
|
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 Animator {
|
|
|
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,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EACV,
|
|
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 +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,
|
|
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"}
|
|
@@ -30,7 +30,13 @@ export declare class SingleAnimator extends Animator {
|
|
|
30
30
|
private isAnimating;
|
|
31
31
|
private currentValue;
|
|
32
32
|
private currentVelocity;
|
|
33
|
+
private updateFn;
|
|
33
34
|
constructor(options: AnimatorOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Sync element state to current progress value
|
|
37
|
+
* Uses the update callback if provided
|
|
38
|
+
*/
|
|
39
|
+
syncState(): void;
|
|
34
40
|
/**
|
|
35
41
|
* Create Integrator from physics options
|
|
36
42
|
* Priority: integrator factory > inertia/spring config > default spring
|
|
@@ -48,9 +54,5 @@ export declare class SingleAnimator extends Animator {
|
|
|
48
54
|
setValue(value: number): void;
|
|
49
55
|
setVelocity(velocity: number): void;
|
|
50
56
|
updateOptions(newOptions: Partial<AnimatorOptions>): void;
|
|
51
|
-
static fromState(state: {
|
|
52
|
-
position: number;
|
|
53
|
-
velocity: number;
|
|
54
|
-
}, options: AnimatorOptions): SingleAnimator;
|
|
55
57
|
}
|
|
56
58
|
//# sourceMappingURL=single-animator.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";var st=Object.defineProperty;var at=(e,n,t)=>n in e?st(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var m=(e,n,t)=>at(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./types.cjs"),z=require("./provider-Cs5iBqRD.cjs");class ct{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 n=Date.now();let i=n-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=n;const r=n-this.startTime,o=r-this.nextTime;if(o>0){const c=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(a=>{a(c,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(n){return this.listeners.add(n),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(n)}}unsubscribe(n){this.listeners.delete(n),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(n,t){this.lagThreshold=n,this.adjustedLag=Math.min(t,n)}fps(n){this.gap=1e3/n,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const N=new ct;function lt(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:c,onStart:a}=e;let s={position:t,velocity:r},u=!0,h=0,p=!1;const w=S=>{if(u){if(p||(p=!0,a==null||a()),s=n.step(s,i,S),n.isSettled(s,i)){if(h+=Math.min(S,.033),h>=z.SETTLE_THRESHOLD){s={position:i,velocity:0},u=!1,o(s.position),N.unsubscribe(w),c();return}}else h=0;o(s.position)}};return N.subscribe(w),{stop:()=>{u&&(u=!1,N.unsubscribe(w))},getPosition:()=>s.position,getVelocity:()=>s.velocity,isRunning:()=>u}}const F=1e3/60;function ut(e,n,t,i=0){let o={position:n,velocity:i},c=0;const a=[];for(let s=0;s<600;s++){const u=s*F;if(a.push({time:u,position:o.position,velocity:o.velocity}),o=e.step(o,t,F/1e3),e.isSettled(o,t)){if(c+=F/1e3,c>=z.SETTLE_THRESHOLD){a.push({time:(s+1)*F,position:t,velocity:0});break}}else c=0}return a}function G(e,n){if(e.length===0)return{position:0,velocity:0};const t=e[0],i=e[e.length-1];if(n<=0)return{position:t.position,velocity:t.velocity};if(n>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=e.length-1;for(;r<o-1;){const u=Math.floor((r+o)/2);e[u].time<=n?r=u:o=u}const c=e[r],a=e[o],s=(n-c.time)/(a.time-c.time);return{position:c.position+(a.position-c.position)*s,velocity:c.velocity+(a.velocity-c.velocity)*s}}function ft(e,n){return e.map(t=>n(t.position))}function mt(e){const{integrator:n,element:t,from:i,to:r,velocity:o=0,style:c,onComplete:a,onStart:s}=e,u=ut(n,i,r,o);if(u.length===0)return s==null||s(),a(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=ft(u,c),p=u[u.length-1],w=p.time,S=h[0];if(S)for(const y of Object.keys(S))t.style[y]="";const d=t.animate(h,{duration:w,fill:"forwards",easing:"linear",composite:"replace"});let l=!0;const A=performance.now();return s==null||s(),d.onfinish=()=>{l&&(l=!1,a())},{stop:()=>{l&&(l=!1,d.cancel())},getPosition:()=>{if(!l)return p.position;const y=performance.now()-A;return G(u,y).position},getVelocity:()=>{if(!l)return 0;const y=performance.now()-A;return G(u,y).velocity},isRunning:()=>l}}class dt{static from(n){const{tick:t,css:i}=n;if(t&&i)throw new Error("Cannot use both 'tick' and 'css' options together");return i?r=>mt({...r,element:i.element,style:i.style}):t?r=>lt({...r,onUpdate:t}):null}}class J{}const ht={stiffness:300,damping:30};class $ extends J{constructor(t){super();m(this,"options");m(this,"runner");m(this,"controls",null);m(this,"isAnimating",!1);m(this,"currentValue");m(this,"currentVelocity",0);m(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=i=>{var r;return(r=t.tick)==null?void 0:r.call(t,i)};else if(t.css){const{element:i,style:r}=t.css;this.updateFn=o=>{const c=r(o);for(const[a,s]of Object.entries(c))i.style[a]=typeof s=="number"?String(s):s}}else this.updateFn=()=>{};this.runner=dt.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?z.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new z.SpringIntegrator(ht)}runAnimation(t){var i,r;if(this.isAnimating=!0,!this.runner){(r=(i=this.options).onStart)==null||r.call(i),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 D extends J{constructor(t){super();m(this,"config");m(this,"animators",new Map);m(this,"itemOrder",[]);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");m(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,i)=>{const r=this.generateId(),o=new $({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(i===0||t.normalizedOffset===0)&&(o.setValue(this.initialState.position),o.setVelocity(this.initialState.velocity),o.syncState()),this.animators.set(r,{id:r,item:t,animator:o,started:!1}),this.itemOrder.push(r)})}getAnimatorProgress(t){const i=t.animator.getCurrentState(),r=Math.abs(i.to-i.from);return r===0?1:Math.abs(i.position-i.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,c,a,s,u;const i=this.animators.get(t);!i||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=i.item).onComplete)==null||o.call(r),(a=(c=this.config).onProgress)==null||a.call(c,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(u=(s=this.config).onEnd)==null||u.call(s)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let i=0;i<t.length;i++){const r=t[i],o=this.animators.get(r);if(!o||o.started)continue;if(i===0){this.startAnimator(r);continue}const c=t[i-1],a=this.animators.get(c);if(!a||!a.started)continue;const s=this.getAnimatorProgress(a),u=o.item.normalizedOffset;s>=u&&this.startAnimator(r)}}startAnimator(t){const i=this.animators.get(t);!i||i.started||(i.started=!0,this.direction==="forward"?i.animator.forward():i.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var i;const t=this.itemOrder[0];return t?((i=this.animators.get(t))==null?void 0:i.animator)??null:null}forward(){var t,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}backward(){var t,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const i=t.animator.getCurrentState();if(i.position===i.to){const o=new $({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});o.setValue(this.to),o.setVelocity(0),o.syncState(),o.forward(),t.animator=o}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const i=this.getFirstAnimator();i==null||i.setValue(t)}setVelocity(t){const i=this.getFirstAnimator();i==null||i.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,i){return new D({...i,state:t})}}const W=Symbol.for("TRANSITION_STRATEGY"),Q=e=>({runIn:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.out)return{config:await n.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return n.in?{config:await n.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.in)return{config:await n.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return n.out?{config:await n.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),Z=()=>({runIn:async e=>e.in?{config:await e.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async e=>e.out?{config:await e.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),j="data-ssgoi-scope",X="data-ssgoi-scope-ready";function gt(){return e=>{if(e)return e.setAttribute(j,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(X,"true")})}),()=>{}}}function tt(e){return e.hasAttribute(X)}function et(e){return e.closest(`[${j}]`)}const pt=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n),i=t.overflow+t.overflowY+t.overflowX;if(i.includes("auto")||i.includes("scroll")||n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.parentElement}return document.documentElement},wt=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function K(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function yt(e,n){var S;let t=null,i=null,r=null,o=null;const c={get currentAnimation(){return t}},a=((S=n==null?void 0:n.strategy)==null?void 0:S.call(n,c))||Q(c),s=async d=>{var k;i&&(i.remove(),i=null);const l=e(),A=l.in&&l.in(d),y=!(n!=null&&n.strategy)&&l.out?l.out(d):void 0;if(!A)return;const V={in:C.normalizeToMultiAnimation(A),out:y?C.normalizeToMultiAnimation(y):void 0},g=await a.runIn(V);if(!g.config){t&&(t.direction="in");return}const f=g.config;(k=f.prepare)==null||k.call(f);const v=C.normalizeSchedule({...f,onEnd:()=>{var R;t=null,(R=f.onEnd)==null||R.call(f)}},d);f.wait&&await f.wait();const T=D.fromState(g.state,{config:v,from:g.from,to:g.to});t={controller:T,direction:"in"},await K(),g.direction==="forward"?T.forward():T.backward()},u=async d=>{var R;i=d;const l=e(),A=!(n!=null&&n.strategy)&&l.in?l.in(d):void 0,y=l.out&&l.out(d);if(!y)return;const V={in:A?C.normalizeToMultiAnimation(A):void 0,out:C.normalizeToMultiAnimation(y)},g=await a.runOut(V);if(!g.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const f=g.config;k(),(R=f.prepare)==null||R.call(f);const v=C.normalizeSchedule({...f,onEnd:()=>{var P,I;(P=f.onEnd)==null||P.call(f),i&&(i.remove(),i=null),t=null,(I=n==null?void 0:n.onCleanupEnd)==null||I.call(n)}},d);f.wait&&await f.wait();const T=D.fromState(g.state,{config:v,from:g.from,to:g.to});t={controller:T,direction:"out"},await K(),g.direction==="forward"?T.forward():T.backward();function k(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let h=null,p=!1;const w=d=>()=>{if(p)return;p=!0;const l=d.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&u(l)}):u(l)};return d=>{if(d)return requestAnimationFrame(()=>{r=d.parentElement,o=d.nextElementSibling}),p=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{h=et(d),!(h&&!tt(h))&&s(d)}):s(d),w(d)}}const b=new Map;let E=null,U=!1;function it(e){if(e instanceof HTMLElement&&b.has(e)){const t=b.get(e);b.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&it(i)}}function St(){U||typeof document>"u"||(U=!0,E=new MutationObserver(e=>{for(const n of e){const t=n.removedNodes;for(let i=0;i<t.length;i++){const r=t[i];r&&it(r)}}}),document.body?E.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{E==null||E.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function nt(e,n){St(),b.set(e,n)}function vt(e){return b.has(e)}function At(){return b.size}function Ct(e){const n=b.get(e);return n?(b.delete(e),n(),!0):!1}function Tt(){b.clear(),E==null||E.disconnect(),E=null,U=!1}const x=new Map,H=new Map,Y=new Map;function Et(e,n,t){x.set(e,n);let i=H.get(e);if(i)return i;const r=n;return i=yt(()=>{const o=x.get(e);return o||(console.warn(`Transition "${String(e)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{x.get(e)===r&&bt(e)}}),H.set(e,i),i}function bt(e){x.delete(e),H.delete(e),Y.delete(e)}function kt(e,n="manual"){const t=Et(e.key,{in:e.in,out:e.out},{strategy:e[W],scope:e.scope});if(n==="manual")return t;let i=Y.get(e.key);return i||(i=r=>{if(r){const o=t(r);o&&nt(r,o)}},Y.set(e.key,i),i)}function Rt(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function Pt(e){let n=!1,t=0,i=0,r=!1;const o=50,c=d=>{if(!e)return;const l=d.touches[0];l&&(r=l.clientX<o,r&&(t=l.clientX,i=l.clientY))},a=d=>{if(!e||!r)return;const l=d.touches[0];if(!l)return;const A=l.clientX-t,y=l.clientY-i;A>window.outerWidth/2-5&&Math.abs(A)>Math.abs(y)?n=!0:n=!1},s=()=>{e&&(r=!1,t=0,i=0)},u=()=>n,h=()=>{typeof window>"u"||e&&(window.addEventListener("touchstart",c,{passive:!0}),window.addEventListener("touchmove",a,{passive:!0}),window.addEventListener("touchend",s,{passive:!0}))},p=()=>{typeof window>"u"||(window.removeEventListener("touchstart",c),window.removeEventListener("touchmove",a),window.removeEventListener("touchend",s))};let w=0;return{initialize:h,cleanup:p,isSwipePending:u,resetSwipeDetection:()=>{w++,w>1&&(w=0,n=!1)}}}function Vt(){let e=null,n=null;const t=new Map;let i=null;const r=()=>{e&&i&&t.set(i,{x:e.scrollLeft,y:e.scrollTop})};return{initializeContext:(h,p)=>{n=h,e||(e=pt(h),(e===document.documentElement?window:e).addEventListener("scroll",r,{passive:!0})),i=p},calculateScrollOffset:(h,p)=>{const w=h&&t.has(h)?t.get(h):{x:0,y:0},S=p&&t.has(p)?t.get(p):{x:0,y:0};return{x:-S.x+w.x,y:-S.y+w.y}},getScrollContainer:()=>e,getPositionedParentElement:()=>n?wt(n):document.body,getScrollPosition:h=>h&&t.has(h)?t.get(h):{x:0,y:0}}}function O(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-2);return e===t||e.startsWith(t+"/")}return e===n}function B(e,n,t){for(const i of t)if(O(e,i.from)&&O(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||O(e,i.from))&&(i.to==="*"||O(n,i.to)))return i.transition;return null}function rt(){let e=null;function n(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const t={from:e.from,to:e.to};e.outResolve(t),e.inResolve(t),e=null}}return{trigger(t,i){e||(e={}),i==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(i=>{e||(e={}),t==="out"?e.outResolve=i:e.inResolve=i,n()})}}}function ot(){let e=null;function n(){var i,r;e&&((i=e.outResolve)==null||i.call(e,null),(r=e.inResolve)==null||r.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const i={from:e.from,to:e.to};e.outResolve(i),e.inResolve(i),e=null}}return{trigger(i,r){e&&(r==="out"&&e.from&&e.from!==i||r==="in"&&e.to&&e.to!==i)&&n(),e||(e={}),r==="out"?e.from=i:e.to=i},get(i){return new Promise(r=>{e||(e={}),i==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function It(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(g,f)=>({from:g,to:f}),skipOnIosSwipe:o=!0}=e,{outFirst:c=!0,createNavigationDetector:a}=n||{},s=(a==null?void 0:a())??(c?rt():ot()),u=Rt(t),{initializeContext:h,calculateScrollOffset:p,getScrollContainer:w,getPositionedParentElement:S,getScrollPosition:d}=Vt(),l=Pt(o);l.initialize();const A=async(g,f)=>{if(l.isSwipePending())return l.resetSwipeDetection(),()=>({});s.trigger(g,f);const v=await s.get(f);if(!v)return()=>({});const{from:T,to:k}=r(v.from,v.to),P=B(T,k,u)||i;if(!P)return()=>({});const I=p(v.from,v.to);if(f==="out"){const L={scrollOffset:I,scroll:d(v.from),get scrollingElement(){return w()||document.documentElement},get positionedParent(){return S()}};return M=>P.out(M,L)}else{const L={scrollOffset:I,get scroll(){return d(v.to)},get scrollingElement(){return w()||document.documentElement},get positionedParent(){return S()}};return async M=>{const _=await Promise.resolve(P.in(M,L)),q=_.onStart;return _.onStart=()=>{M.style.visibility="visible",q==null||q()},_}}},y=g=>({key:g,in:async f=>(h(f,g),(await A(g,"in"))(f)),out:async f=>(await A(g,"out"))(f),[W]:Z}),V=(g,f)=>{const{from:v,to:T}=r(g,f);return!!(B(v,T,u)||i)};return a?{getTransition:y,hasMatchingTransition:V}:y}exports.isCssAnimation=C.isCssAnimation;exports.isMultiAnimation=C.isMultiAnimation;exports.isSingleAnimation=C.isSingleAnimation;exports.isTickAnimation=C.isTickAnimation;exports.normalizeSchedule=C.normalizeSchedule;exports.normalizeToMultiAnimation=C.normalizeToMultiAnimation;exports.SCOPE_ATTR=j;exports.SCOPE_READY_ATTR=X;exports.TRANSITION_STRATEGY=W;exports.createAnyOrderDetector=ot;exports.createDefaultStrategy=Q;exports.createOutFirstDetector=rt;exports.createPageTransitionStrategy=Z;exports.createSggoiTransitionContext=It;exports.createTransitionScope=gt;exports.findScope=et;exports.getWatchedCount=At;exports.isScopeReady=tt;exports.isWatched=vt;exports.resetObserver=Tt;exports.transition=kt;exports.triggerUnmount=Ct;exports.watchUnmount=nt;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * from './transition/transition';
|
|
|
3
3
|
export * from './transition/transition-scope';
|
|
4
4
|
export * from './transition/unmount-observer';
|
|
5
5
|
export * from './ssgoi-transition/create-ssgoi-transition-context';
|
|
6
|
+
export * from './ssgoi-transition/navigation-detector-strategy';
|
|
6
7
|
export * from './transition/transition-strategy';
|
|
7
8
|
//# 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,iDAAiD,CAAC;AAChE,cAAc,kCAAkC,CAAC"}
|