@ssgoi/core 5.2.2 → 6.0.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/animation/animation.d.ts +50 -0
- package/dist/animation/animation.d.ts.map +1 -0
- package/dist/animation/host-animation.d.ts +43 -0
- package/dist/animation/host-animation.d.ts.map +1 -0
- package/dist/animation/index.d.ts +6 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/integrator/double-spring-integrator.d.ts.map +1 -0
- package/dist/{animator → animation}/integrator/index.d.ts +1 -0
- package/dist/animation/integrator/index.d.ts.map +1 -0
- package/dist/animation/integrator/inertia-integrator.d.ts.map +1 -0
- package/dist/animation/integrator/linear-integrator.d.ts +23 -0
- package/dist/animation/integrator/linear-integrator.d.ts.map +1 -0
- package/dist/{animator → animation}/integrator/provider.d.ts +1 -1
- package/dist/animation/integrator/provider.d.ts.map +1 -0
- package/dist/animation/integrator/spring-integrator.d.ts.map +1 -0
- package/dist/animation/integrator/types.d.ts.map +1 -0
- package/dist/animation/multi-animation.d.ts +39 -0
- package/dist/animation/multi-animation.d.ts.map +1 -0
- package/dist/animation/web-animation.d.ts +63 -0
- package/dist/animation/web-animation.d.ts.map +1 -0
- package/dist/index.cjs +35 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1271 -1192
- package/dist/internal.cjs +1 -0
- package/dist/internal.d.ts +4 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +504 -0
- package/dist/multi-animation-B_Hl1HEU.cjs +1 -0
- package/dist/multi-animation-CST6aZ8y.js +276 -0
- package/dist/ssgoi-transition/create-context-manager.d.ts +1 -1
- package/dist/ssgoi-transition/create-context-manager.d.ts.map +1 -1
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +18 -31
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/find-matching-transition.d.ts +4 -4
- package/dist/ssgoi-transition/find-matching-transition.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +5 -15
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +2 -2
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +1 -1
- package/dist/ssgoi-transition/unmount-observer.d.ts +17 -0
- package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -0
- package/dist/transitions/blind/index.d.ts +6 -0
- package/dist/transitions/blind/index.d.ts.map +1 -0
- package/dist/transitions/blind/transition.d.ts +16 -0
- package/dist/transitions/blind/transition.d.ts.map +1 -0
- package/dist/transitions/drill/index.d.ts +9 -0
- package/dist/transitions/drill/index.d.ts.map +1 -0
- package/dist/transitions/drill/provider/crossfade.d.ts +3 -0
- package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -0
- package/dist/transitions/drill/provider/index.d.ts +3 -0
- package/dist/transitions/drill/provider/index.d.ts.map +1 -0
- package/dist/transitions/drill/provider/parallax.d.ts +3 -0
- package/dist/transitions/drill/provider/parallax.d.ts.map +1 -0
- package/dist/transitions/drill/transition.d.ts +5 -0
- package/dist/transitions/drill/transition.d.ts.map +1 -0
- package/dist/transitions/drill/types.d.ts +23 -0
- package/dist/transitions/drill/types.d.ts.map +1 -0
- package/dist/transitions/fade/index.d.ts +6 -0
- package/dist/transitions/fade/index.d.ts.map +1 -0
- package/dist/transitions/fade/transition.d.ts +6 -0
- package/dist/transitions/fade/transition.d.ts.map +1 -0
- package/dist/transitions/film/index.d.ts +6 -0
- package/dist/transitions/film/index.d.ts.map +1 -0
- package/dist/transitions/film/transition.d.ts +27 -0
- package/dist/transitions/film/transition.d.ts.map +1 -0
- package/dist/transitions/hero/index.d.ts +6 -0
- package/dist/transitions/hero/index.d.ts.map +1 -0
- package/dist/transitions/hero/transition.d.ts +7 -0
- package/dist/transitions/hero/transition.d.ts.map +1 -0
- package/dist/transitions/index.d.ts +10 -12
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/jaemin/index.d.ts +6 -0
- package/dist/transitions/jaemin/index.d.ts.map +1 -0
- package/dist/transitions/jaemin/transition.d.ts +18 -0
- package/dist/transitions/jaemin/transition.d.ts.map +1 -0
- package/dist/transitions/rotate/index.d.ts +6 -0
- package/dist/transitions/rotate/index.d.ts.map +1 -0
- package/dist/transitions/rotate/transition.d.ts +6 -0
- package/dist/transitions/rotate/transition.d.ts.map +1 -0
- package/dist/transitions/scroll/index.d.ts +15 -0
- package/dist/transitions/scroll/index.d.ts.map +1 -0
- package/dist/transitions/scroll/transition.d.ts +7 -0
- package/dist/transitions/scroll/transition.d.ts.map +1 -0
- package/dist/transitions/sheet/index.d.ts +9 -0
- package/dist/transitions/sheet/index.d.ts.map +1 -0
- package/dist/transitions/sheet/provider/background-scale.d.ts +3 -0
- package/dist/transitions/sheet/provider/background-scale.d.ts.map +1 -0
- package/dist/transitions/sheet/provider/index.d.ts +3 -0
- package/dist/transitions/sheet/provider/index.d.ts.map +1 -0
- package/dist/transitions/sheet/provider/static.d.ts +3 -0
- package/dist/transitions/sheet/provider/static.d.ts.map +1 -0
- package/dist/transitions/sheet/transition.d.ts +5 -0
- package/dist/transitions/sheet/transition.d.ts.map +1 -0
- package/dist/transitions/sheet/types.d.ts +19 -0
- package/dist/transitions/sheet/types.d.ts.map +1 -0
- package/dist/transitions/slide/index.d.ts +6 -0
- package/dist/transitions/slide/index.d.ts.map +1 -0
- package/dist/transitions/slide/transition.d.ts +7 -0
- package/dist/transitions/slide/transition.d.ts.map +1 -0
- package/dist/transitions/strip/index.d.ts +6 -0
- package/dist/transitions/strip/index.d.ts.map +1 -0
- package/dist/transitions/strip/transition.d.ts +6 -0
- package/dist/transitions/strip/transition.d.ts.map +1 -0
- package/dist/transitions/utils.d.ts +11 -7
- package/dist/transitions/utils.d.ts.map +1 -1
- package/dist/transitions/zoom/index.d.ts +8 -0
- package/dist/transitions/zoom/index.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/expand.d.ts +5 -0
- package/dist/transitions/zoom/provider/expand.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/index.d.ts +3 -0
- package/dist/transitions/zoom/provider/index.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/static.d.ts +5 -0
- package/dist/transitions/zoom/provider/static.d.ts.map +1 -0
- package/dist/transitions/zoom/transition.d.ts +5 -0
- package/dist/transitions/zoom/transition.d.ts.map +1 -0
- package/dist/transitions/zoom/types.d.ts +34 -0
- package/dist/transitions/zoom/types.d.ts.map +1 -0
- package/dist/transitions/zoom/zoom-element.d.ts +4 -0
- package/dist/transitions/zoom/zoom-element.d.ts.map +1 -0
- package/dist/types/index.d.ts +175 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +2 -504
- package/dist/types.js +3 -77
- package/dist/utils/get-viewport-rect.d.ts +17 -0
- package/dist/utils/get-viewport-rect.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/prepare-outgoing.d.ts +2 -2
- package/dist/utils/prepare-outgoing.d.ts.map +1 -1
- package/dist/utils/promise-all.d.ts +18 -0
- package/dist/utils/promise-all.d.ts.map +1 -0
- package/package.json +7 -19
- package/dist/animator/integrator/double-spring-integrator.d.ts.map +0 -1
- package/dist/animator/integrator/index.d.ts.map +0 -1
- package/dist/animator/integrator/inertia-integrator.d.ts.map +0 -1
- package/dist/animator/integrator/provider.d.ts.map +0 -1
- package/dist/animator/integrator/spring-integrator.d.ts.map +0 -1
- package/dist/animator/integrator/types.d.ts.map +0 -1
- package/dist/animator/multi-animator.d.ts +0 -101
- package/dist/animator/multi-animator.d.ts.map +0 -1
- package/dist/animator/runner/css-runner.d.ts +0 -17
- package/dist/animator/runner/css-runner.d.ts.map +0 -1
- package/dist/animator/runner/keyframes-runner.d.ts +0 -14
- package/dist/animator/runner/keyframes-runner.d.ts.map +0 -1
- package/dist/animator/runner/provider.d.ts +0 -44
- package/dist/animator/runner/provider.d.ts.map +0 -1
- package/dist/animator/runner/tick-runner.d.ts +0 -16
- package/dist/animator/runner/tick-runner.d.ts.map +0 -1
- package/dist/animator/runner/ticker.d.ts +0 -38
- package/dist/animator/runner/ticker.d.ts.map +0 -1
- package/dist/animator/runner/types.d.ts +0 -34
- package/dist/animator/runner/types.d.ts.map +0 -1
- package/dist/animator/single-animator.d.ts +0 -65
- package/dist/animator/single-animator.d.ts.map +0 -1
- package/dist/animator/types.d.ts +0 -57
- package/dist/animator/types.d.ts.map +0 -1
- package/dist/presets/index.cjs +0 -1
- package/dist/presets/index.d.ts +0 -22
- package/dist/presets/index.d.ts.map +0 -1
- package/dist/presets/index.js +0 -50
- package/dist/provider-B2B8CK6H.js +0 -142
- package/dist/provider-BKaONTeg.cjs +0 -1
- package/dist/spring-integrator-95Mh7mdw.cjs +0 -1
- package/dist/spring-integrator-BM4a-82c.js +0 -33
- package/dist/transition/create-transition-callback.d.ts +0 -8
- package/dist/transition/create-transition-callback.d.ts.map +0 -1
- package/dist/transition/transition-scope.d.ts +0 -36
- package/dist/transition/transition-scope.d.ts.map +0 -1
- package/dist/transition/transition-strategy.d.ts +0 -75
- package/dist/transition/transition-strategy.d.ts.map +0 -1
- package/dist/transition/transition.d.ts +0 -51
- package/dist/transition/transition.d.ts.map +0 -1
- package/dist/transition/unmount-observer.d.ts +0 -43
- package/dist/transition/unmount-observer.d.ts.map +0 -1
- package/dist/transitions/blur.d.ts +0 -12
- package/dist/transitions/blur.d.ts.map +0 -1
- package/dist/transitions/bounce.d.ts +0 -13
- package/dist/transitions/bounce.d.ts.map +0 -1
- package/dist/transitions/fade.d.ts +0 -10
- package/dist/transitions/fade.d.ts.map +0 -1
- package/dist/transitions/fly.d.ts +0 -11
- package/dist/transitions/fly.d.ts.map +0 -1
- package/dist/transitions/index.cjs +0 -1
- package/dist/transitions/index.js +0 -285
- package/dist/transitions/mask.d.ts +0 -12
- package/dist/transitions/mask.d.ts.map +0 -1
- package/dist/transitions/none.d.ts +0 -8
- package/dist/transitions/none.d.ts.map +0 -1
- package/dist/transitions/rotate.d.ts +0 -15
- package/dist/transitions/rotate.d.ts.map +0 -1
- package/dist/transitions/scale.d.ts +0 -11
- package/dist/transitions/scale.d.ts.map +0 -1
- package/dist/transitions/slide.d.ts +0 -13
- package/dist/transitions/slide.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/view-transitions/blind.d.ts +0 -11
- package/dist/view-transitions/blind.d.ts.map +0 -1
- package/dist/view-transitions/curtain-reveal.d.ts +0 -18
- package/dist/view-transitions/curtain-reveal.d.ts.map +0 -1
- package/dist/view-transitions/depth.d.ts +0 -21
- package/dist/view-transitions/depth.d.ts.map +0 -1
- package/dist/view-transitions/drill.d.ts +0 -9
- package/dist/view-transitions/drill.d.ts.map +0 -1
- package/dist/view-transitions/fade.d.ts +0 -8
- package/dist/view-transitions/fade.d.ts.map +0 -1
- package/dist/view-transitions/film.d.ts +0 -10
- package/dist/view-transitions/film.d.ts.map +0 -1
- package/dist/view-transitions/hero.d.ts +0 -9
- package/dist/view-transitions/hero.d.ts.map +0 -1
- package/dist/view-transitions/index.cjs +0 -35
- package/dist/view-transitions/index.d.ts +0 -18
- package/dist/view-transitions/index.d.ts.map +0 -1
- package/dist/view-transitions/index.js +0 -1614
- package/dist/view-transitions/instagram.d.ts +0 -8
- package/dist/view-transitions/instagram.d.ts.map +0 -1
- package/dist/view-transitions/jaemin.d.ts +0 -21
- package/dist/view-transitions/jaemin.d.ts.map +0 -1
- package/dist/view-transitions/pinterest.d.ts +0 -8
- package/dist/view-transitions/pinterest.d.ts.map +0 -1
- package/dist/view-transitions/rotate.d.ts +0 -6
- package/dist/view-transitions/rotate.d.ts.map +0 -1
- package/dist/view-transitions/scroll.d.ts +0 -8
- package/dist/view-transitions/scroll.d.ts.map +0 -1
- package/dist/view-transitions/sheet.d.ts +0 -21
- package/dist/view-transitions/sheet.d.ts.map +0 -1
- package/dist/view-transitions/slide.d.ts +0 -8
- package/dist/view-transitions/slide.d.ts.map +0 -1
- package/dist/view-transitions/snap.d.ts +0 -16
- package/dist/view-transitions/snap.d.ts.map +0 -1
- package/dist/view-transitions/strip.d.ts +0 -7
- package/dist/view-transitions/strip.d.ts.map +0 -1
- package/dist/view-transitions/swap.d.ts +0 -15
- package/dist/view-transitions/swap.d.ts.map +0 -1
- /package/dist/{animator → animation}/integrator/double-spring-integrator.d.ts +0 -0
- /package/dist/{animator → animation}/integrator/inertia-integrator.d.ts +0 -0
- /package/dist/{animator → animation}/integrator/spring-integrator.d.ts +0 -0
- /package/dist/{animator → animation}/integrator/types.d.ts +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Pose, Timeline } from '../types/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for animations.
|
|
4
|
+
*
|
|
5
|
+
* Motion-matching contract:
|
|
6
|
+
* - `getPose()` — snapshot of current values per element
|
|
7
|
+
* - `getTimeline()` — full simulation data per element
|
|
8
|
+
* - `matchInto(poses)` — receive external poses and adjust simulation so a
|
|
9
|
+
* handoff from a different (now-discarded) animation feels continuous
|
|
10
|
+
*
|
|
11
|
+
* Concrete implementations: `WebAnimation` (single element, WAAPI-driven),
|
|
12
|
+
* `MultiAnimation` (composite of other Animations).
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class Animation {
|
|
15
|
+
/** Run forward: lowerBound → upperBound */
|
|
16
|
+
abstract play(): void;
|
|
17
|
+
/** Run backward: current → lowerBound */
|
|
18
|
+
abstract reverse(): void;
|
|
19
|
+
/** Halt the animation in place — last frame stays applied, no settle/cleanup. */
|
|
20
|
+
abstract pause(): void;
|
|
21
|
+
/** Jump immediately to the final state and fire `onComplete`. */
|
|
22
|
+
abstract complete(): void;
|
|
23
|
+
/** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
|
|
24
|
+
private _playbackRate;
|
|
25
|
+
get playbackRate(): number;
|
|
26
|
+
set playbackRate(rate: number);
|
|
27
|
+
/** Sample current pose for every element this animation drives */
|
|
28
|
+
abstract getPose(): Pose[];
|
|
29
|
+
/** Full simulation timeline for every element this animation drives */
|
|
30
|
+
abstract getTimeline(): Timeline[];
|
|
31
|
+
/**
|
|
32
|
+
* Adopt poses from a prior animation. Implementations should look up each
|
|
33
|
+
* pose by `id`/`element` and seed their next simulation from that value and
|
|
34
|
+
* velocity. Unknown poses are ignored.
|
|
35
|
+
*/
|
|
36
|
+
abstract matchInto(poses: Pose[]): void;
|
|
37
|
+
/** Fired every frame with the most recent value. Optional. */
|
|
38
|
+
onUpdate?: (poses: Pose[]) => void;
|
|
39
|
+
/** Fired once when the animation settles. */
|
|
40
|
+
onComplete?: () => void;
|
|
41
|
+
/** Simulation tick is actively running (false while paused or settled). */
|
|
42
|
+
abstract get isAnimating(): boolean;
|
|
43
|
+
/** Halted via `pause()` and not yet resumed. */
|
|
44
|
+
abstract get isPaused(): boolean;
|
|
45
|
+
/** Settled — `onComplete` has fired and no further frames will play. */
|
|
46
|
+
abstract get isComplete(): boolean;
|
|
47
|
+
/** Direction of the active or most-recent run (true = backwards). */
|
|
48
|
+
abstract get isReversing(): boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,8BAAsB,SAAS;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,IAAI,IAAI;IACrB,yCAAyC;IACzC,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,IAAI,IAAI;IACtB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB,6EAA6E;IAC7E,OAAO,CAAC,aAAa,CAAK;IAC1B,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAE5B;IAED,kEAAkE;IAClE,QAAQ,CAAC,OAAO,IAAI,IAAI,EAAE;IAE1B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,IAAI,QAAQ,EAAE;IAElC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAEvC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACnC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB,2EAA2E;IAC3E,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAC;IACpC,gDAAgD;IAChD,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC;IACjC,wEAAwE;IACxE,QAAQ,KAAK,UAAU,IAAI,OAAO,CAAC;IACnC,qEAAqE;IACrE,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAC;CACrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Pose, Timeline } from '../types/index.ts';
|
|
2
|
+
import { Animation } from './animation';
|
|
3
|
+
/**
|
|
4
|
+
* Long-lived container that owns the playback state of a `<Ssgoi>` context
|
|
5
|
+
* across many transitions. Each new transition's Animation is handed in via
|
|
6
|
+
* `attach()`, which:
|
|
7
|
+
*
|
|
8
|
+
* 1. Samples the live pose of the prior child and feeds it to the new one
|
|
9
|
+
* via `matchInto` so motion is continuous.
|
|
10
|
+
* 2. Completes the prior child so its `onComplete` cleanups fire.
|
|
11
|
+
* 3. Carries over the host's playbackRate and play/pause/reverse state.
|
|
12
|
+
* 4. Hooks the child's `onComplete` / `onUpdate` to drive the host's own
|
|
13
|
+
* listeners (used by dev tools).
|
|
14
|
+
*
|
|
15
|
+
* The host is also a valid `Animation` itself — its lifecycle methods delegate
|
|
16
|
+
* to the active child while preserving state when no child is attached.
|
|
17
|
+
*/
|
|
18
|
+
export declare class HostAnimation extends Animation {
|
|
19
|
+
private child;
|
|
20
|
+
private _state;
|
|
21
|
+
private _settled;
|
|
22
|
+
private listeners;
|
|
23
|
+
attach(next: Animation): void;
|
|
24
|
+
play(): void;
|
|
25
|
+
reverse(): void;
|
|
26
|
+
pause(): void;
|
|
27
|
+
complete(): void;
|
|
28
|
+
get isAnimating(): boolean;
|
|
29
|
+
get isPaused(): boolean;
|
|
30
|
+
get isComplete(): boolean;
|
|
31
|
+
get isReversing(): boolean;
|
|
32
|
+
get playbackRate(): number;
|
|
33
|
+
set playbackRate(rate: number);
|
|
34
|
+
getPose(): Pose[];
|
|
35
|
+
getTimeline(): Timeline[];
|
|
36
|
+
matchInto(poses: Pose[]): void;
|
|
37
|
+
/** Currently attached child, or null when nothing is playing. */
|
|
38
|
+
get activeChild(): Animation | null;
|
|
39
|
+
/** Subscribe to host state changes. Returns an unsubscribe fn. */
|
|
40
|
+
subscribe(fn: () => void): () => void;
|
|
41
|
+
private notify;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=host-animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/host-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAyB;IAE1C,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IA4C7B,IAAI,IAAI,IAAI;IAOZ,OAAO,IAAI,IAAI;IAOf,KAAK,IAAI,IAAI;IAMb,QAAQ,IAAI,IAAI;IAKhB,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAI5B;IAED,OAAO,IAAI,IAAI,EAAE;IAGjB,WAAW,IAAI,QAAQ,EAAE;IAGzB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAI9B,iEAAiE;IACjE,IAAI,WAAW,IAAI,SAAS,GAAG,IAAI,CAElC;IAED,kEAAkE;IAClE,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAOrC,OAAO,CAAC,MAAM;CAGf"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Animation } from './animation';
|
|
2
|
+
export { WebAnimation, type WebAnimationOptions } from './web-animation';
|
|
3
|
+
export { MultiAnimation, type MultiAnimationOptions, type MultiAnimationMode, } from './multi-animation';
|
|
4
|
+
export { HostAnimation } from './host-animation';
|
|
5
|
+
export { type Integrator, type IntegratorState, SpringIntegrator, DoubleSpringIntegrator, InertiaIntegrator, IntegratorProvider, type SpringIntegratorConfig, type DoubleSpringIntegratorConfig, type InertiaIntegratorConfig, type PhysicsConfig, } from './integrator';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/animation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"double-spring-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/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"}
|
|
@@ -10,4 +10,5 @@ export { SpringIntegrator, type SpringIntegratorConfig, } from './spring-integra
|
|
|
10
10
|
export { DoubleSpringIntegrator, type DoubleSpringIntegratorConfig, type FollowerSpringConfig, } from './double-spring-integrator';
|
|
11
11
|
export { InertiaIntegrator, type InertiaIntegratorConfig, type ResistanceType, } from './inertia-integrator';
|
|
12
12
|
export { IntegratorProvider, type PhysicsConfig } from './provider';
|
|
13
|
+
export { LinearIntegrator, type LinearIntegratorConfig, } from './linear-integrator';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/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;AACpE,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inertia-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/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,23 @@
|
|
|
1
|
+
import { Integrator, IntegratorState } from './types';
|
|
2
|
+
export interface LinearIntegratorConfig {
|
|
3
|
+
/** Wall-clock duration, in seconds, the integrator should take to traverse
|
|
4
|
+
* its full range. The simulation steps at FRAME_TIME (1/60s) and accumulates
|
|
5
|
+
* position linearly until it crosses the target. */
|
|
6
|
+
durationSec: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Constant-velocity integrator.
|
|
10
|
+
*
|
|
11
|
+
* Useful when the curve isn't physical — e.g. a pre-baked multi-spring
|
|
12
|
+
* timeline is being replayed through `WebAnimation`'s style function. The
|
|
13
|
+
* style function gets `t ∈ [0,1]` evolving linearly over `durationSec`, then
|
|
14
|
+
* looks up the baked frame data. The visible curve still comes from the bake;
|
|
15
|
+
* the integrator is just driving the clock.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LinearIntegrator implements Integrator {
|
|
18
|
+
private durationSec;
|
|
19
|
+
constructor(config: LinearIntegratorConfig);
|
|
20
|
+
step(state: IntegratorState, target: number, dt: number): IntegratorState;
|
|
21
|
+
isSettled(state: IntegratorState, target: number): boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=linear-integrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/integrator/linear-integrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG3D,MAAM,WAAW,sBAAsB;IACrC;;wDAEoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,sBAAsB;IAI1C,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,eAAe;IAgBzE,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAG3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/integrator/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC1D,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 @@
|
|
|
1
|
+
{"version":3,"file":"spring-integrator.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/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 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/animation/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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Pose, Timeline } from '../types/index.ts';
|
|
2
|
+
import { Animation } from './animation';
|
|
3
|
+
export type MultiAnimationMode = "parallel" | "sequence";
|
|
4
|
+
export interface MultiAnimationOptions {
|
|
5
|
+
mode?: MultiAnimationMode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Composite that drives several child Animations.
|
|
9
|
+
*
|
|
10
|
+
* - `parallel`: all children play together
|
|
11
|
+
* - `sequence`: each child waits for the previous to settle, then plays
|
|
12
|
+
*
|
|
13
|
+
* Pose/Timeline reads fan out to every child for diagnostic / inspection use.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MultiAnimation extends Animation {
|
|
16
|
+
private children;
|
|
17
|
+
private mode;
|
|
18
|
+
private pendingComplete;
|
|
19
|
+
private running;
|
|
20
|
+
constructor(children: Animation[], opts?: MultiAnimationOptions);
|
|
21
|
+
play(): void;
|
|
22
|
+
reverse(): void;
|
|
23
|
+
pause(): void;
|
|
24
|
+
complete(): void;
|
|
25
|
+
getPose(): Pose[];
|
|
26
|
+
getTimeline(): Timeline[];
|
|
27
|
+
matchInto(_poses: Pose[]): void;
|
|
28
|
+
get isAnimating(): boolean;
|
|
29
|
+
get isPaused(): boolean;
|
|
30
|
+
get isComplete(): boolean;
|
|
31
|
+
get isReversing(): boolean;
|
|
32
|
+
get playbackRate(): number;
|
|
33
|
+
set playbackRate(rate: number);
|
|
34
|
+
private startParallel;
|
|
35
|
+
private startSequence;
|
|
36
|
+
private handleChildComplete;
|
|
37
|
+
private handleFinished;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=multi-animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/multi-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAC3C,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,QAAQ,EAAE,SAAS,EAAE,EAAE,IAAI,GAAE,qBAA0B;IAMnE,IAAI,IAAI,IAAI;IAUZ,OAAO,IAAI,IAAI;IAUf,KAAK,IAAI,IAAI;IAKb,QAAQ,IAAI,IAAI;IAMhB,OAAO,IAAI,IAAI,EAAE;IAIjB,WAAW,IAAI,QAAQ,EAAE;IAIzB,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI;IAO/B,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAKtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAG5B;IAID,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Pose, StyleObject, Timeline } from '../types/index.ts';
|
|
2
|
+
import { Integrator } from './integrator';
|
|
3
|
+
import { Animation } from './animation';
|
|
4
|
+
export interface WebAnimationOptions {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
integrator: Integrator;
|
|
7
|
+
style: (t: number, u: number) => StyleObject;
|
|
8
|
+
/** Default 0 — the value `t` takes at the start of `play()`. */
|
|
9
|
+
lowerBound?: number;
|
|
10
|
+
/** Default 1 — the value `t` takes at the end of `play()`. */
|
|
11
|
+
upperBound?: number;
|
|
12
|
+
onUpdate?: (poses: Pose[]) => void;
|
|
13
|
+
onComplete?: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Single-element animation driven by an Integrator simulation, played through
|
|
17
|
+
* the Web Animation API.
|
|
18
|
+
*
|
|
19
|
+
* Lifecycle:
|
|
20
|
+
* 1. `play()` / `reverse()` calls `simulate()` from the current (position,
|
|
21
|
+
* velocity) toward the target bound, producing a frame list.
|
|
22
|
+
* 2. Frames are converted to WAAPI keyframes; `element.animate(...)` runs them.
|
|
23
|
+
* 3. While playing, `getPose()` interpolates the live position from frames
|
|
24
|
+
* using `performance.now() - startTime`.
|
|
25
|
+
*
|
|
26
|
+
* Identity for motion matching is the DOM element itself — when a previous
|
|
27
|
+
* animation's pose is handed in via `matchInto`, we look up by element.
|
|
28
|
+
*/
|
|
29
|
+
export declare class WebAnimation extends Animation {
|
|
30
|
+
private element;
|
|
31
|
+
private integrator;
|
|
32
|
+
private styleFn;
|
|
33
|
+
private lowerBound;
|
|
34
|
+
private upperBound;
|
|
35
|
+
private currentValue;
|
|
36
|
+
private currentVelocity;
|
|
37
|
+
private frames;
|
|
38
|
+
private waapi;
|
|
39
|
+
private startTime;
|
|
40
|
+
private running;
|
|
41
|
+
private paused;
|
|
42
|
+
private settled;
|
|
43
|
+
private reversing;
|
|
44
|
+
constructor(opts: WebAnimationOptions);
|
|
45
|
+
play(): void;
|
|
46
|
+
reverse(): void;
|
|
47
|
+
pause(): void;
|
|
48
|
+
complete(): void;
|
|
49
|
+
get isAnimating(): boolean;
|
|
50
|
+
get isPaused(): boolean;
|
|
51
|
+
get isComplete(): boolean;
|
|
52
|
+
get isReversing(): boolean;
|
|
53
|
+
get playbackRate(): number;
|
|
54
|
+
set playbackRate(rate: number);
|
|
55
|
+
getPose(): Pose[];
|
|
56
|
+
getTimeline(): Timeline[];
|
|
57
|
+
matchInto(poses: Pose[]): void;
|
|
58
|
+
private runToward;
|
|
59
|
+
private clearWaapi;
|
|
60
|
+
private captureLiveState;
|
|
61
|
+
private applyStyleAt;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=web-animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AACzE,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,WAAW,CAAC;IAC7C,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAQD;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,mBAAmB;IAYrC,IAAI,IAAI,IAAI;IAaZ,OAAO,IAAI,IAAI;IAQf,KAAK,IAAI,IAAI;IAUb,QAAQ,IAAI,IAAI;IAWhB,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAG5B;IAED,OAAO,IAAI,IAAI,EAAE;IAcjB,WAAW,IAAI,QAAQ,EAAE;IAczB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAS9B,OAAO,CAAC,SAAS;IA6DjB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,YAAY;CAQrB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,35 @@
|
|
|
1
|
-
"use strict";var lt=Object.defineProperty;var ut=(e,i,t)=>i in e?lt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var d=(e,i,t)=>ut(e,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./types.cjs"),W=require("./spring-integrator-95Mh7mdw.cjs"),ft=require("./provider-BKaONTeg.cjs");class mt{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 n=i-this.lastUpdate;n>this.lagThreshold||n<0?(this.startTime+=n-this.adjustedLag,n=this.adjustedLag):n>this.maxDeltaTime&&(n=this.maxDeltaTime),this.lastUpdate=i;const r=i-this.startTime,o=r-this.nextTime;if(o>0){const s=n/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(m=>{m(s,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 mt;function dt(e){const{integrator:i,from:t,to:n,velocity:r=0,onUpdate:o,onComplete:s,onStart:m}=e;let l={position:t,velocity:r},u=!0,h=0,v=!1;const A=S=>{if(u){if(v||(v=!0,m==null||m()),l=i.step(l,n,S),i.isSettled(l,n)){if(h+=Math.min(S,.033),h>=W.SETTLE_THRESHOLD){l={position:n,velocity:0},u=!1,o(l.position),D.unsubscribe(A),s();return}}else h=0;o(l.position)}};return D.subscribe(A),{stop:()=>{u&&(u=!1,D.unsubscribe(A))},getPosition:()=>l.position,getVelocity:()=>l.velocity,isRunning:()=>u}}const L=1e3/60;function ht(e,i,t,n=0){let o={position:i,velocity:n},s=0;const m=[];for(let l=0;l<600;l++){const u=l*L;if(m.push({time:u,position:o.position,velocity:o.velocity}),o=e.step(o,t,L/1e3),e.isSettled(o,t)){if(s+=L/1e3,s>=W.SETTLE_THRESHOLD){m.push({time:(l+1)*L,position:t,velocity:0});break}}else s=0}return m}function Y(e,i){if(e.length===0)return{position:0,velocity:0};const t=e[0],n=e[e.length-1];if(i<=0)return{position:t.position,velocity:t.velocity};if(i>=n.time)return{position:n.position,velocity:n.velocity};let r=0,o=e.length-1;for(;r<o-1;){const u=Math.floor((r+o)/2);e[u].time<=i?r=u:o=u}const s=e[r],m=e[o],l=(i-s.time)/(m.time-s.time);return{position:s.position+(m.position-s.position)*l,velocity:s.velocity+(m.velocity-s.velocity)*l}}function gt(e,i){return e.map(t=>i(t.position))}function yt(e){const{integrator:i,element:t,from:n,to:r,velocity:o=0,style:s,onComplete:m,onStart:l}=e,u=ht(i,n,r,o);if(u.length===0)return l==null||l(),m(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=gt(u,s),v=u[u.length-1],A=v.time,S=h[0];if(S)for(const C of Object.keys(S))t.style[C]="";const y=t.animate(h,{duration:A,fill:"forwards",easing:"linear",composite:"replace"});let p=!0;const R=performance.now();return l==null||l(),y.onfinish=()=>{p&&(p=!1,m())},{stop:()=>{p&&(p=!1,y.cancel())},getPosition:()=>{if(!p)return v.position;const C=performance.now()-R;return Y(u,C).position},getVelocity:()=>{if(!p)return 0;const C=performance.now()-R;return Y(u,C).velocity},isRunning:()=>p}}function wt(e){const{element:i,frames:t,duration:n,easing:r="linear",from:o,to:s,onComplete:m,onStart:l}=e,u=t[0];if(u)for(const S of Object.keys(u))S==="offset"||S==="easing"||S==="composite"||(i.style[S]="");const h=i.animate(t,{duration:n,fill:"forwards",easing:r,composite:"replace"});let v=!0;const A=performance.now();return l==null||l(),h.onfinish=()=>{v&&(v=!1,m())},{stop:()=>{v&&(v=!1,h.cancel())},getPosition:()=>{if(!v)return s;const S=performance.now()-A,y=Math.min(Math.max(S/n,0),1);return o+(s-o)*y},getVelocity:()=>0,isRunning:()=>v}}function pt(e){const{to:i,onStart:t,onComplete:n}=e;return t==null||t(),n(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1}}class vt{static from(i){const{tick:t,css:n,keyframes:r}=i;if((t?1:0)+(n?1:0)+(r?1:0)>1)throw new Error("Cannot use more than one of 'tick', 'css', 'keyframes' together");return r?s=>wt({element:r.element,frames:r.frames,duration:r.duration,easing:r.easing,from:s.from,to:s.to,onComplete:s.onComplete,onStart:s.onStart}):n?s=>{if(!s.integrator)throw new Error("css mode requires an integrator");return yt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,element:n.element,style:n.style})}:t?s=>{if(!s.integrator)throw new Error("tick mode requires an integrator");return dt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,onUpdate:t})}:pt}}class tt{}const St={stiffness:300,damping:30};class j extends tt{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");d(this,"isKeyframesMode");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,this.isKeyframesMode=!!t.keyframes,t.tick)this.updateFn=n=>{var r;return(r=t.tick)==null?void 0:r.call(t,n)};else if(t.css){const{element:n,style:r}=t.css;this.updateFn=o=>{const s=r(o);for(const[m,l]of Object.entries(s))n.style[m]=typeof l=="number"?String(l):l}}else this.updateFn=()=>{};this.runner=vt.from({tick:t.tick,css:t.css,keyframes:t.keyframes})}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?ft.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new W.SpringIntegrator(St)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator:this.isKeyframesMode?void 0: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 tt{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,n)=>{const r=this.generateId(),o=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,keyframes:t.keyframes,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(n===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 n=t.animator.getCurrentState(),r=Math.abs(n.to-n.from);return r===0?1:Math.abs(n.position-n.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,s,m,l,u;const n=this.animators.get(t);!n||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=n.item).onComplete)==null||o.call(r),(m=(s=this.config).onProgress)==null||m.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(u=(l=this.config).onEnd)==null||u.call(l)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let n=0;n<t.length;n++){const r=t[n],o=this.animators.get(r);if(!o||o.started)continue;if(n===0){this.startAnimator(r);continue}const s=t[n-1],m=this.animators.get(s);if(!m||!m.started)continue;const l=this.getAnimatorProgress(m),u=o.item.normalizedOffset;l>=u&&this.startAnimator(r)}}startAnimator(t){const n=this.animators.get(t);!n||n.started||(n.started=!0,this.direction==="forward"?n.animator.forward():n.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var n;const t=this.itemOrder[0];return t?((n=this.animators.get(t))==null?void 0:n.animator)??null:null}forward(){var t,n;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.call(t),this.startScheduler()}backward(){var t,n;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const n=t.animator.getCurrentState();if(n.position===n.to){const o=new j({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,keyframes:t.item.keyframes,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 n=this.getFirstAnimator();n==null||n.setValue(t)}setVelocity(t){const n=this.getFirstAnimator();n==null||n.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,n){return new z({...n,state:t})}}const U=Symbol.for("TRANSITION_STRATEGY"),et=e=>({runIn:async i=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.out)return{config:await i.out,state:{position:r,velocity:o},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}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.in)return{config:await i.in,state:{position:r,velocity:o},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"}}}),nt=()=>({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"}}),H="data-ssgoi-scope",K="data-ssgoi-scope-ready";function At(){return e=>{if(e)return e.setAttribute(H,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(K,"true")})}),()=>{}}}function it(e){return e.hasAttribute(K)}function rt(e){return e.closest(`[${H}]`)}const B=new Set(["auto","scroll","overlay"]),Tt=e=>{let i=e.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i);if(B.has(t.overflowY)||B.has(t.overflowX))return i;i=i.parentElement}return document.documentElement},Et=e=>{let i=e.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 G(e){return new Promise(i=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})})})}function Ct(e,i){var S;let t=null,n=null,r=null,o=null;const s={get currentAnimation(){return t}},m=((S=i==null?void 0:i.strategy)==null?void 0:S.call(i,s))||et(s),l=async y=>{var g,E;n&&(n.remove(),n=null);const p=e(),R=p.in&&p.in(y),C=!(i!=null&&i.strategy)&&p.out?p.out(y):void 0;if(!R)return;const w={in:k.normalizeToMultiAnimation(R),out:C?k.normalizeToMultiAnimation(C):void 0},f=await m.runIn(w);if(!f.config){t&&(t.direction="in");return}const a=f.config;(g=a.prepare)==null||g.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var b;t=null,(b=a.onEnd)==null||b.call(a)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"in"},(E=a.onReady)==null||E.call(a),await G(),f.direction==="forward"?c.forward():c.backward()},u=async y=>{var E,b;n=y;const p=e(),R=!(i!=null&&i.strategy)&&p.in?p.in(y):void 0,C=p.out&&p.out(y);if(!C)return;const w={in:R?k.normalizeToMultiAnimation(R):void 0,out:k.normalizeToMultiAnimation(C)},f=await m.runOut(w);if(!f.config){t&&(t.direction="out"),n&&(n.remove(),n=null);return}const a=f.config;g(),(E=a.prepare)==null||E.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var M,V;(M=a.onEnd)==null||M.call(a),n&&(n.remove(),n=null),t=null,(V=i==null?void 0:i.onCleanupEnd)==null||V.call(i)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"out"},(b=a.onReady)==null||b.call(a),await G(),f.direction==="forward"?c.forward():c.backward();function g(){!r||!n||(o&&r.contains(o)?r.insertBefore(n,o):r.appendChild(n))}};let h=null,v=!1;const A=y=>()=>{if(v)return;v=!0;const p=y.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&u(p)}):u(p)};return y=>{if(y)return requestAnimationFrame(()=>{r=y.parentElement,o=y.nextElementSibling}),v=!1,(i==null?void 0:i.scope)==="local"?queueMicrotask(()=>{h=rt(y),!(h&&!it(h))&&l(y)}):l(y),A(y)}}const I=new Map;let P=null,q=!1;function ot(e){if(e instanceof HTMLElement&&I.has(e)){const t=I.get(e);I.delete(e),queueMicrotask(()=>{t()})}const i=e.childNodes;for(let t=0;t<i.length;t++){const n=i[t];n&&ot(n)}}function bt(){q||typeof document>"u"||(q=!0,P=new MutationObserver(e=>{for(const i of e){const t=i.removedNodes;for(let n=0;n<t.length;n++){const r=t[n];r&&ot(r)}}}),document.body?P.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{P==null||P.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function st(e,i){bt(),I.set(e,i)}function Rt(e){return I.has(e)}function kt(){return I.size}function Mt(e){const i=I.get(e);return i?(I.delete(e),i(),!0):!1}function Pt(){I.clear(),P==null||P.disconnect(),P=null,q=!1}const O=new Map,N=new Map,X=new Map;function It(e,i,t){O.set(e,i);let n=N.get(e);if(n)return n;const r=i;return n=Ct(()=>{const o=O.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:()=>{O.get(e)===r&&Vt(e)}}),N.set(e,n),n}function Vt(e){O.delete(e),N.delete(e),X.delete(e)}function Ft(e,i="manual"){const t=It(e.key,{in:e.in,out:e.out},{strategy:e[U],scope:e.scope});if(i==="manual")return t;let n=X.get(e.key);return n||(n=r=>{if(r){const o=t(r);o&&st(r,o)}},X.set(e.key,n),n)}function xt(e){const i=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...i]}function F(e,i){if(i==="*")return!0;if(i.endsWith("/*")){const t=i.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===i}function Lt(e,i,t){for(const n of t)if(F(e,n.from)&&F(i,n.to))return n.transition;for(const n of t)if((n.from==="*"||F(e,n.from))&&(n.to==="*"||F(i,n.to)))return n.transition;return null}const Ot=768,zt=10,_t=10;function Dt(e={}){const{preserveScroll:i=c=>c}=e,t=typeof i=="function"?i:()=>i;let n=null,r=!1,o=!1;const s=()=>{const c=(n==null?void 0:n.clientWidth)??0,g=c>0?c:typeof window<"u"?window.innerWidth:0;return g>0&&g<Ot},m=()=>(o||(r=s(),o=!0),r),l=c=>{const g=t(m());return g===!1?!1:g===!0?!0:!g.exclude.some(E=>F(c,E))};let u=null;const h=new Map;let v=null,A=!1,S=0;const y=()=>{n&&v&&!A&&h.set(v,{x:n.scrollLeft,y:n.scrollTop})},p=c=>{if(!n)return;const g=l(c)&&h.has(c)?h.get(c):{x:0,y:0};let E=0;const b=()=>{if(!n)return;n.scrollTo({top:g.y,left:g.x}),!(Math.abs(n.scrollTop-g.y)<1&&Math.abs(n.scrollLeft-g.x)<1)&&E<zt&&(E++,requestAnimationFrame(b))};requestAnimationFrame(b)};return{initializeContext:(c,g)=>{A=!0;const E=++S;u=c,n||(n=Tt(c),r=s(),o=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=s()}).observe(n),(n===document.documentElement?window:n).addEventListener("scroll",y,{passive:!0})),v=g,p(g);let b=0;const M=()=>{E===S&&(b++,b>=_t?A=!1:requestAnimationFrame(M))};requestAnimationFrame(M)},calculateScrollOffset:(c,g)=>{const E=c&&h.has(c)?h.get(c):{x:0,y:0},b=g&&l(g)&&h.has(g)?h.get(g):{x:0,y:0};return{x:-b.x+E.x,y:-b.y+E.y}},evictScrollPosition:c=>{h.delete(c)},shouldPreserve:l,getScrollContainer:()=>n,getPositionedParentElement:()=>u?Et(u):document.body,getScrollPosition:c=>c&&h.has(c)?h.get(c):{x:0,y:0}}}const $=30,Z=8,J=1.2,Q=30,qt=600;function Nt(){let e=null,i=!1,t=!1,n=null,r=null,o=!1;const s=(w,f)=>{for(let a=0;a<w.length;a++){const T=w.item(a);if(T&&T.identifier===f)return T}return null},m=()=>{n!==null&&(clearTimeout(n),n=null)},l=()=>{r!==null&&(clearTimeout(r),r=null)},u=()=>{i=!0,t=!0,m(),l(),n=setTimeout(()=>{i=!1,t=!1,n=null},qt)},h=w=>{if(w.touches.length!==1){e=null;return}const f=w.touches.item(0);if(!f){e=null;return}const a=window.innerWidth,T=f.clientX<=$,c=f.clientX>=a-$;if(!T&&!c){e=null;return}e={identifier:f.identifier,startX:f.clientX,startY:f.clientY,fromLeftEdge:T,moved:!1}},v=w=>{if(!e)return;if(w.touches.length!==1){e=null;return}const f=s(w.touches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=f.clientY-e.startY,c=Math.abs(a),g=Math.abs(T);if(g>Z&&g>c*J){e=null;return}const E=e.fromLeftEdge?a>0:a<0;c>Z&&c>g*J&&E&&(e.moved=!0)},A=w=>{if(!e)return;const f=s(w.changedTouches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=e.fromLeftEdge?a>0:a<0;if(e.moved&&T&&Math.abs(a)>=Q){u(),e=null;return}e.moved&&Math.abs(a)>=Q&&u(),e=null},S=()=>{e&&(e.moved&&u(),e=null)};return{initialize:()=>{if(typeof window>"u"||o)return;o=!0;const w={passive:!0,capture:!0};window.addEventListener("touchstart",h,w),window.addEventListener("touchmove",v,w),window.addEventListener("touchend",A,w),window.addEventListener("touchcancel",S,w)},destroy:()=>{if(typeof window>"u"||!o)return;o=!1;const w={capture:!0};window.removeEventListener("touchstart",h,w),window.removeEventListener("touchmove",v,w),window.removeEventListener("touchend",A,w),window.removeEventListener("touchcancel",S,w),m(),l(),e=null,i=!1,t=!1},isSwipeBack:()=>{const w=i||t;return w&&m(),w},onPageEnter:()=>{i=!1,m(),l(),r=setTimeout(()=>{t=!1,r=null},0)}}}function at(){let e=null;function i(){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,n){e||(e={}),n==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(n=>{e||(e={}),t==="out"?e.outResolve=n:e.inResolve=n,i()})}}}function ct(){let e=null;function i(){var n,r;e&&((n=e.outResolve)==null||n.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)){if(e.from===e.to){i();return}const n={from:e.from,to:e.to};e.outResolve(n),e.inResolve(n),e=null}}return{trigger(n,r){e&&(r==="out"&&e.from&&e.from!==n||r==="in"&&e.to&&e.to!==n)&&i(),e||(e={}),r==="out"?e.from=n:e.to=n},get(n){return new Promise(r=>{e||(e={}),n==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function Xt(e,i){const{transitions:t=[],defaultTransition:n,middleware:r=(f,a)=>({from:f,to:a}),preserveScroll:o=f=>f}=e,{outFirst:s=!0}=i||{},m=s?at():ct(),l=xt(t),u=Nt();u.initialize();const{initializeContext:h,calculateScrollOffset:v,evictScrollPosition:A,shouldPreserve:S,getScrollContainer:y,getPositionedParentElement:p,getScrollPosition:R}=Dt({preserveScroll:o}),C=async(f,a)=>{const T=u.isSwipeBack();m.trigger(f,a);const c=await m.get(a);if(a==="in"&&u.onPageEnter(),!c)return()=>({});if(T)return a==="out"&&c.from&&!S(c.from)&&A(c.from),()=>({});const{from:g,to:E}=r(c.from,c.to),M=Lt(g,E,l)||n;if(!M)return()=>({});const V=v(c.from,c.to);if(a==="out"){const x={scrollOffset:V,scroll:R(c.from),get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return c.from&&!S(c.from)&&A(c.from),_=>M.out(_,x)}else{const x={scrollOffset:V,get scroll(){return R(c.to)},get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return _=>M.in(_,x)}};return f=>({key:f,in:async a=>(h(a,f),(await C(f,"in"))(a)),out:async a=>(await C(f,"out"))(a),[U]:nt})}exports.isCssAnimation=k.isCssAnimation;exports.isKeyframesAnimation=k.isKeyframesAnimation;exports.isMultiAnimation=k.isMultiAnimation;exports.isSingleAnimation=k.isSingleAnimation;exports.isTickAnimation=k.isTickAnimation;exports.normalizeSchedule=k.normalizeSchedule;exports.normalizeToMultiAnimation=k.normalizeToMultiAnimation;exports.SCOPE_ATTR=H;exports.SCOPE_READY_ATTR=K;exports.TRANSITION_STRATEGY=U;exports.createAnyOrderDetector=ct;exports.createDefaultStrategy=et;exports.createOutFirstDetector=at;exports.createPageTransitionStrategy=nt;exports.createSggoiTransitionContext=Xt;exports.createTransitionScope=At;exports.findScope=rt;exports.getWatchedCount=kt;exports.isScopeReady=it;exports.isWatched=Rt;exports.resetObserver=Pt;exports.transition=Ft;exports.triggerUnmount=Mt;exports.watchUnmount=st;
|
|
1
|
+
"use strict";var pt=Object.defineProperty;var dt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var S=(e,t,n)=>dt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./multi-animation-B_Hl1HEU.cjs");function C(e,t){const n=[];for(let s=0;s<e.length;s++)for(let i=s+1;i<e.length;i++){const a=e[s],o=e[i];!a||!o||n.push({from:a,to:o,transition:t(),symmetric:!0})}return n}function tt(e,t){return[{from:e.exit,to:e.enter,transition:t("enter")},{from:e.enter,to:e.exit,transition:t("exit")}]}function et(e,t,n){const s=[];for(let i=0;i<e.length;i++)for(let a=i+1;a<e.length;a++){const o=e[i],l=e[a];!o||!l||s.push({from:o,to:l,transition:n(t.forward)},{from:l,to:o,transition:n(t.backward)})}return s}class L{constructor(t){S(this,"omega");S(this,"zeta");S(this,"restDelta");S(this,"restSpeed");const{stiffness:n,damping:s}=t,i=1;this.omega=Math.sqrt(n/i),this.zeta=s/(2*Math.sqrt(n*i)),this.restDelta=t.restDelta??m.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??m.VELOCITY_THRESHOLD}step(t,n,s){const i=Math.min(s,.033),{omega:a,zeta:o}=this,{position:l,velocity:c}=t,r=-2*i*o*a*c,p=i*a*a*(n-l),d=c+r+p;return{position:l+i*d,velocity:d}}isSettled(t,n){const s=Math.abs(n-t.position),i=Math.abs(t.velocity);return s<this.restDelta&&i<this.restSpeed}}class ft{constructor(t){S(this,"leader");S(this,"follower");S(this,"restDelta");S(this,"restSpeed");this.restDelta=t.restDelta??m.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??m.VELOCITY_THRESHOLD,this.leader=new L({stiffness:t.stiffness,damping:t.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let n,s,i,a;typeof t.follower=="number"?(n=t.stiffness*t.follower,s=t.damping):t.follower?(n=t.follower.stiffness,s=t.follower.damping,i=t.follower.restDelta,a=t.follower.restSpeed):(n=t.stiffness,s=t.damping),this.follower=new L({stiffness:n,damping:s,restDelta:i??this.restDelta,restSpeed:a??this.restSpeed})}step(t,n,s){const a=t._leader??{position:t.position,velocity:t.velocity},o=this.leader.step(a,n,s),l=this.follower.step(t,o.position,s);return{position:l.position,velocity:l.velocity,_leader:o}}isSettled(t,n){const s=t,i=Math.abs(n-t.position)<this.restDelta&&Math.abs(t.velocity)<this.restSpeed;return s._leader?Math.abs(n-s._leader.position)<this.restDelta&&Math.abs(s._leader.velocity)<this.restSpeed&&i:i}}const ht=.01,mt=500,ut=10;class yt{constructor(t){S(this,"acceleration");S(this,"resistance");S(this,"resistanceType");S(this,"min");S(this,"max");S(this,"bounceStiffness");S(this,"bounceDamping");S(this,"restDelta");this.acceleration=t.acceleration,this.resistance=t.resistance,this.resistanceType=t.resistanceType??"quadratic",this.min=t.min,this.max=t.max,this.bounceStiffness=t.bounceStiffness??mt,this.bounceDamping=t.bounceDamping??ut,this.restDelta=t.restDelta??ht}step(t,n,s){const i=Math.min(s,.033),{acceleration:a,resistance:o,resistanceType:l,min:c,max:r}=this,{position:p,velocity:d}=t,h=c!==void 0&&p<c,y=r!==void 0&&p>r;let f;if(h||y){const w=p-(h?c:r),x=-this.bounceStiffness*w,A=-this.bounceDamping*d;f=x+A}else{const $=n>p?1:-1;let w;l==="linear"?w=o*d:w=o*d*Math.abs(d),f=$*a-w}const u=d+f*i;let g=p+u*i;if(!h&&!y){const $=n>p?1:-1;($>0&&g>n||$<0&&g<n)&&(g=n)}return{position:g,velocity:g===n?0:u}}isSettled(t,n){return Math.abs(n-t.position)<this.restDelta}}class b{static from(t){if(t.spring&&t.inertia)throw new Error("Cannot use both 'spring' and 'inertia' together. Choose one physics type.");if(t.inertia)return new yt({acceleration:t.inertia.acceleration,resistance:t.inertia.resistance,resistanceType:t.inertia.resistanceType,min:t.inertia.min,max:t.inertia.max,bounceStiffness:t.inertia.bounceStiffness,bounceDamping:t.inertia.bounceDamping,restDelta:t.inertia.restDelta});const n=t.spring??{stiffness:300,damping:30};if(n.doubleSpring){const s=n.doubleSpring;let i;return typeof s=="number"?i=s:typeof s=="object"&&(i={stiffness:s.stiffness,damping:s.damping}),new ft({stiffness:n.stiffness,damping:n.damping,follower:i,restDelta:n.restDelta,restSpeed:n.restSpeed})}return new L({stiffness:n.stiffness,damping:n.damping,restDelta:n.restDelta,restSpeed:n.restSpeed})}static fromSpring(t){return b.from({spring:t})}}class gt{constructor(t){S(this,"durationSec");this.durationSec=Math.max(1/60,t.durationSec)}step(t,n,s){const i=n-t.position;if(i===0)return t;const a=Math.sign(i),o=Math.abs(i)/this.durationSec,l=a*o*s,c=t.position+l;return(a>0?c>=n:c<=n)?{position:n,velocity:0}:{position:c,velocity:a*o}}isSettled(t,n){return Math.abs(t.position-n)<m.POSITION_THRESHOLD}}const bt={spring:{stiffness:200,damping:22}},wt=10,St="horizontal",$t="#000000";function X(e,t,n,s,i,a){window.getComputedStyle(e).position==="static"&&(e.style.position="relative");const l=document.createElement("div");l.style.cssText=`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
z-index: 9999;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
`;const c=[];for(let r=0;r<t;r++){const p=document.createElement("div");if(n==="horizontal"){const d=100/t;p.style.cssText=`
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: ${d*r}%;
|
|
13
|
+
left: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: calc(${d}% + 1px);
|
|
16
|
+
background: ${s};
|
|
17
|
+
transform: scaleX(${i==="hidden"?0:1});
|
|
18
|
+
transform-origin: ${a} center;
|
|
19
|
+
will-change: transform;
|
|
20
|
+
`}else{const d=100/t;p.style.cssText=`
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: ${d*r}%;
|
|
24
|
+
width: calc(${d}% + 1px);
|
|
25
|
+
height: 100%;
|
|
26
|
+
background: ${s};
|
|
27
|
+
transform: scaleY(${i==="hidden"?0:1});
|
|
28
|
+
transform-origin: ${a==="left"?"top":"bottom"} center;
|
|
29
|
+
will-change: transform;
|
|
30
|
+
`}c.push(p),l.appendChild(p)}return e.appendChild(l),{container:l,blinds:c}}const xt=(e={})=>{const t=e.blindCount??wt,n=e.direction??St,s=e.blindColor??$t,i=e.physics??bt;return{prepare:async({from:a,to:o})=>{const l=await a,c=await o;l.style.zIndex="1000";const r=X(l,t,n,s,"hidden","left");c.style.position="relative",c.style.zIndex="0";const p=X(c,t,n,s,"closed","right");return{fromBlinds:r.blinds,fromContainer:r.container,toBlinds:p.blinds,toContainer:p.container}},animation:({fromBlinds:a,fromContainer:o,toBlinds:l,toContainer:c})=>{const r=a.map(y=>new m.WebAnimation({element:y,integrator:b.from(i),style:f=>({transform:n==="horizontal"?`scaleX(${f})`:`scaleY(${f})`})})),p=l.map((y,f)=>new m.WebAnimation({element:y,integrator:b.from(i),style:(u,g)=>({transform:n==="horizontal"?`scaleX(${g})`:`scaleY(${g})`}),onComplete:f===l.length-1?()=>{c.remove(),o.remove()}:void 0})),d=new m.MultiAnimation(r,{mode:"parallel"}),h=new m.MultiAnimation(p,{mode:"parallel"});return new m.MultiAnimation([d,h],{mode:"sequence"})}}};function At({paths:e}){return C(e,()=>xt())}const Ct={spring:{stiffness:200,damping:20,doubleSpring:.7}},D=.5;function Et(e){const t=e==="enter"?-100:100,n=e==="enter"?100:-100;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`translate3d(${t*s}%, 0, 0)`,opacity:`${D+(1-D)*(1-s)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${n}%, 0, 0)`,opacity:`${D}`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`,opacity:`${D+(1-D)*s}`})}}}function Pt(){return{physics:Ct,build:Et}}const Dt={spring:{stiffness:170,damping:22}};function Ot(e){const t=e==="enter"?-20:100,n=e==="enter"?100:-20;return{out:{willChange:"transform",startStyle:{},animate:s=>({transform:`translate3d(${t*s}%, 0, 0)`})},in:{willChange:"transform",startStyle:{transform:`translate3d(${n}%, 0, 0)`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`})}}}function Tt(){return{physics:Dt,build:Ot}}const It={parallax:Tt(),crossfade:Pt()},_t="parallax";function B(e,t){e.style.willChange=t.willChange,e.style.backfaceVisibility="hidden",e.style.contain="layout paint";for(const[n,s]of Object.entries(t.startStyle))e.style[n]=s}const Lt=(e={})=>{const t=e.direction??"enter",n=It[e.type??_t],s=n.physics,i=n.build(t);return{prepare:({from:a,to:o})=>(a.then(l=>{B(l,i.out),l.style.pointerEvents="none",l.style.zIndex=t==="enter"?"-1":"100"}),o.then(l=>{B(l,i.in)}),{}),animation:({from:a,to:o})=>{const l=new m.WebAnimation({element:a,integrator:b.from(s),style:r=>i.out.animate(r)}),c=new m.WebAnimation({element:o,integrator:b.from(s),style:r=>i.in.animate(r),onComplete:()=>{o.style.willChange="auto",o.style.backfaceVisibility="",o.style.contain="",o.style.transform="",o.style.opacity=""}});return new m.MultiAnimation([l,c],{mode:"parallel"})}}};function kt({type:e,...t}){return tt(t,n=>Lt({direction:n,type:e}))}const vt={spring:{stiffness:180,damping:20,doubleSpring:!0}},Mt={spring:{stiffness:170,damping:20,doubleSpring:!0}},Yt=(e={})=>{const t=e.physics??Mt,n=e.physics??vt;return{prepare:({to:s})=>(s.then(i=>{i.style.opacity="0",i.style.willChange="opacity"}),{}),animation:({from:s,to:i})=>{const a=new m.WebAnimation({element:s,integrator:b.from(n),style:(l,c)=>({opacity:c}),onComplete:()=>{s.style.willChange="auto"}}),o=new m.WebAnimation({element:i,integrator:b.from(t),style:l=>({opacity:l}),onComplete:()=>{i.style.willChange="auto",i.style.opacity=""}});return new m.MultiAnimation([a,o],{mode:"sequence"})}}};function Ft({paths:e}){return C(e,()=>Yt())}function P(e,t){function n(a){let o=0,l=0;const c=a.offsetWidth,r=a.offsetHeight;let p=a;for(;p;)o+=p.offsetTop,l+=p.offsetLeft,p=p.offsetParent;return o-=window.scrollY,l-=window.scrollX,{top:o,left:l,width:c,height:r}}const s=n(e),i=n(t);return new DOMRect(i.left-s.left,i.top-s.top,i.width,i.height)}function O(e,t){const{scrollingElement:n,positionedParent:s}=e,i=n!==s&&n.contains(s)?P(n,s).top:0;return{top:e[t].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-i}}const Y={scaleDown:{stiffness:20,damping:7},translate:{stiffness:15,damping:7},scaleUp:{stiffness:20,damping:7}},E={scaleDown:0,translate:.2,scaleUp:.8},Ht=.8,Wt="white",N=1e3/60,zt=600;function Ut(e){const{items:t,from:n,to:s,recordFrame:i}=e,a=N/1e3,o=Math.abs(s-n),l=t.map(r=>({item:r,integrator:new L({stiffness:r.spring.stiffness,damping:r.spring.damping}),state:{position:n,velocity:0},started:!1,settled:!1,settleTime:0}));for(let r=0;r<l.length;r++)(r===0||l[r].item.offset===0)&&(l[r].started=!0);i(0);let c=0;for(let r=1;r<=zt;r++){const p=r*N;c=p;for(const d of l)!d.started||d.settled||(d.state=d.integrator.step(d.state,s,a),d.integrator.isSettled(d.state,s)?(d.settleTime+=a,d.settleTime>=m.SETTLE_THRESHOLD&&(d.state={position:s,velocity:0},d.settled=!0)):d.settleTime=0,d.item.tick(d.state.position));for(let d=1;d<l.length;d++){const h=l[d];if(h.started)continue;const y=l[d-1];if(!y.started)continue;(o===0?1:Math.abs(y.state.position-n)/o)>=h.item.offset&&(h.started=!0)}if(i(p),l.every(d=>d.settled))return p}return c}function F(e,t){return e!=null&&e.spring?{stiffness:e.spring.stiffness,damping:e.spring.damping}:t}function Z(e){const{rect:t,scale:n,direction:s,override:i}=e,a=s==="out"?{scale:1,translateY:-t.top}:{scale:n,translateY:-t.top+t.height},o=F(i,Y.scaleDown),l=F(i,Y.translate),c=F(i,Y.scaleUp),r=s==="out"?1:0,p=s==="out"?0:1,d=s==="out"?[{spring:o,offset:E.scaleDown,tick:f=>{const u=1-f;a.scale=1-(1-n)*u}},{spring:l,offset:E.translate,tick:f=>{const u=1-f;a.translateY=-t.top-t.height*u}},{spring:c,offset:E.scaleUp,tick:f=>{const u=1-f;a.scale=n+(1-n)*u}}]:[{spring:o,offset:E.scaleDown,tick:f=>{a.scale=1-(1-n)*f}},{spring:l,offset:E.translate,tick:f=>{a.translateY=-t.top+t.height*(1-f)}},{spring:c,offset:E.scaleUp,tick:f=>{a.scale=n+(1-n)*f}}],h=[],y=Ut({items:d,from:r,to:p,recordFrame:f=>h.push({time:f,scale:a.scale,translateY:a.translateY})});return{snapshots:h,totalDuration:y}}function Vt(e,t){if(e.length===0)return{time:0,scale:1,translateY:0};if(e.length===1||t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),s=Math.floor(n),i=Math.ceil(n);if(s===i)return e[s];const a=e[s],o=e[i],l=n-s;return{time:a.time+(o.time-a.time)*l,scale:a.scale+(o.scale-a.scale)*l,translateY:a.translateY+(o.translateY-a.translateY)*l}}const Xt=[[1,1],[-1,1],[1,-1],[-1,-1]];function Bt(e,t){const i=(a,o,l)=>{const c=document.createElement("div");Object.assign(c.style,{position:"fixed",pointerEvents:"none",zIndex:"9999",width:"15px",height:"15px",...a});const r=document.createElement("div");Object.assign(r.style,{position:"absolute",width:"15px",height:"1px",backgroundColor:e,[l]:"0",[o]:"0"});const p=document.createElement("div");return Object.assign(p.style,{position:"absolute",width:"1px",height:"15px",backgroundColor:e,[l]:"0",[o]:"0"}),c.appendChild(r),c.appendChild(p),c};return{topLeft:i({top:`${t.top-1}px`,left:`${t.left-1}px`},"left","top"),topRight:i({top:`${t.top-1}px`,left:`${t.left+t.width-15+1}px`},"right","top"),bottomLeft:i({top:`${t.top+t.height-15+1}px`,left:`${t.left-1}px`},"left","bottom"),bottomRight:i({top:`${t.top+t.height-15+1}px`,left:`${t.left+t.width-15+1}px`},"right","bottom")}}function q(e,t){const n=t.left+t.width/2,s=t.top+t.height/2;e.style.transformOrigin=`${n}px ${s}px`}function j(e,t){e.style.clipPath=`polygon(
|
|
31
|
+
${t.left}px ${t.top}px,
|
|
32
|
+
${t.left+t.width}px ${t.top}px,
|
|
33
|
+
${t.left+t.width}px ${t.top+t.height}px,
|
|
34
|
+
${t.left}px ${t.top+t.height}px
|
|
35
|
+
)`}function H(e,t,n,s,i){const a=n/1e3;return new m.WebAnimation({element:e,integrator:new gt({durationSec:a}),lowerBound:0,upperBound:1,style:o=>s(Vt(t,o)),onComplete:i})}const Nt=(e={})=>{var i;const t=((i=e.border)==null?void 0:i.color)??Wt,n=Ht,s=e.physics;return{prepare:({from:a,to:o,context:l})=>{const c=O(l,"from"),r=O(l,"to"),p=P(document.body,l.positionedParent),d=Bt(t,{...c,top:p.top});for(const h of["topLeft","topRight","bottomLeft","bottomRight"])l.positionedParent.appendChild(d[h]);return a.then(h=>{q(h,c),j(h,c),h.style.transform=`translateY(${-c.top}px)`}),o.then(h=>{q(h,r),j(h,r),h.style.transform=`translateY(${-r.top+r.height}px) scale(${n})`}),{borders:d,fromRect:c,toRect:r}},animation:({from:a,to:o,context:l,borders:c,fromRect:r,toRect:p})=>{const d=Z({rect:r,scale:n,direction:"out",override:s}),h=Z({rect:p,scale:n,direction:"in",override:s}),y=H(a,d.snapshots,d.totalDuration,w=>({transform:`translateY(${w.translateY}px) scale(${w.scale})`}),()=>{a.style.clipPath="",a.style.transformOrigin=""}),f=H(o,h.snapshots,h.totalDuration,w=>({transform:`translateY(${w.translateY}px) scale(${w.scale})`}),()=>{o.style.clipPath="",o.style.transformOrigin="",o.style.transform=""}),u=Xt.map(([w,x],A)=>{const k=["topLeft","topRight","bottomLeft","bottomRight"][A];return H(c[k],d.snapshots,d.totalDuration,T=>{const v=(r.width-r.width*T.scale)/2*.7*w,M=(r.height-r.height*T.scale)/2*.7*x;return{transform:`translate(${v}px, ${M}px)`}})}),g=new m.MultiAnimation([y,f,...u],{mode:"parallel"}),$=g.onComplete;return g.onComplete=()=>{$==null||$();const w=l.positionedParent;for(const x of["topLeft","topRight","bottomLeft","bottomRight"]){const A=c[x];A.parentElement===w&&w.removeChild(A)}},g}}};function Zt({paths:e}){return C(e,()=>Nt())}const qt={spring:{stiffness:300,damping:30}};function jt(e,t){return e.querySelector(`[data-hero-key="${t}"]`)}const Gt=(e={})=>{const t=e.physics??qt,n=e.maxDistance??700;return{prepare:({from:s})=>(s.then(i=>{i.style.opacity="0"}),{}),animation:({from:s,to:i,context:a})=>{const o=s,l=i,c=Array.from(l.querySelectorAll("[data-hero-key]")),r=[];for(const f of c){const u=f.getAttribute("data-hero-key");if(!u)continue;const g=jt(o,u);g&&r.push({key:u,fromEl:g,toEl:f})}if(r.length===0)return new m.MultiAnimation([],{mode:"parallel"});const p=[],d=[];for(const{fromEl:f,toEl:u}of r){const g=P(o,f),$=P(l,u),w=g.left-$.left-a.scrollOffset.x,x=g.top-$.top-a.scrollOffset.y,A=g.width/$.width,k=g.height/$.height;if(Math.abs(x)>n)continue;const T=u.style.transform,v=u.style.position,M=u.style.transformOrigin,it=u.style.zIndex,ot=u.style.willChange;u.style.position="relative",u.style.transformOrigin="top left",u.style.zIndex="1000",u.style.willChange="transform",p.push(new m.WebAnimation({element:u,integrator:b.from(t),style:(V,I)=>{const rt=I*w,at=I*x,lt=V+I*A,ct=V+I*k;return{transform:`translate(${rt}px, ${at}px) scale(${lt}, ${ct})`}}})),d.push(()=>{u.style.transform=T,u.style.position=v,u.style.transformOrigin=M,u.style.zIndex=it,u.style.willChange=ot})}const h=new m.MultiAnimation(p,{mode:"parallel"}),y=h.onComplete;return h.onComplete=()=>{for(const f of d)f();y==null||y()},h}}};function Kt({paths:e}){return C(e,()=>Gt())}const Jt={spring:{stiffness:50,damping:30}},Qt={spring:{stiffness:80,damping:25}},Rt=(e={})=>{const t=e.physics??Jt,n=e.initialRotation??45,s=e.initialScale??.01,i=e.rotationTriggerPoint??.8;return{prepare:({from:a,to:o,context:l})=>(a.then(c=>{c.style.opacity="1"}),o.then(c=>{const r=O(l,"to"),p=Math.min(r.width,r.height)*.4;c.style.setProperty("--max-border-radius",`${p}px`),c.style.setProperty("--border-radius-scale","1"),c.style.willChange="transform",c.style.backfaceVisibility="hidden";const d=r.left+r.width/2,h=r.top+r.height/2;c.style.transformOrigin=`${d}px ${h}px`,c.style.position="fixed",c.style.top=`${r.top}px`,c.style.left=`${r.left}px`,c.style.width=`${r.width}px`,c.style.height=`${r.height}px`,c.style.zIndex="1000",c.style.overflow="hidden",c.style.transform=`rotate(${n}deg) scale(${s}) translateZ(0)`,c.style.borderRadius="calc(var(--max-border-radius) * var(--border-radius-scale))",c.style.opacity="1"}),{}),animation:({from:a,to:o})=>{const l=new m.WebAnimation({element:a,integrator:b.from(Qt),style:(r,p)=>({opacity:p})}),c=new m.WebAnimation({element:o,integrator:b.from(t),style:r=>{let p;if(r<=.05)p=s;else if(r<=i){const f=(r-.05)/(i-.05),u=Math.pow(f,9);p=s+(.8-s)*u}else{const f=(r-i)/(1-i);p=.8+.2*(1-Math.pow(1-f,3))}const d=.7;let h;if(r<=d)h=n;else{const f=(r-d)/(1-d),u=1-Math.pow(1-f,2);h=n*(1-u)}let y;if(r<=d)y=1;else{const f=(r-d)/(1-d);y=1-Math.pow(f,.5)}return{transform:`rotate(${h.toFixed(2)}deg) scale(${p.toFixed(4)}) translateZ(0)`,"--border-radius-scale":y.toFixed(4)}},onComplete:()=>{o.style.willChange="",o.style.backfaceVisibility="",o.style.removeProperty("--max-border-radius"),o.style.removeProperty("--border-radius-scale"),o.style.transform="",o.style.transformOrigin="",o.style.position="",o.style.zIndex="",o.style.top="",o.style.left="",o.style.width="",o.style.height="",o.style.overflow="",o.style.borderRadius=""}});return new m.MultiAnimation([l,c],{mode:"parallel"})}}};function te({paths:e}){return C(e,()=>Rt())}const ee={spring:{stiffness:100,damping:30}},ne=(e={})=>{const t=e.physics??ee;return{prepare:({from:n,to:s})=>(n.then(i=>{i.style.transformOrigin="center center",i.style.willChange="transform, opacity"}),s.then(i=>{i.style.opacity="0",i.style.transform="rotate(-180deg)",i.style.transformOrigin="center center",i.style.willChange="transform, opacity"}),{}),animation:({from:n,to:s})=>{const i=new m.WebAnimation({element:n,integrator:b.from(t),style:o=>({transform:`rotate(${o*180}deg)`,opacity:o<.5?1:0})}),a=new m.WebAnimation({element:s,integrator:b.from(t),style:(o,l)=>({transform:`rotate(${-l*180}deg)`,opacity:o>.5?1:0}),onComplete:()=>{s.style.willChange="auto",s.style.transform="",s.style.transformOrigin="",s.style.opacity=""}});return new m.MultiAnimation([i,a],{mode:"parallel"})}}};function se({paths:e}){return C(e,()=>ne())}const ie={spring:{stiffness:20,damping:8,doubleSpring:1,restDelta:.001,restSpeed:.001}},G=(e={})=>{const t=e.direction??"up",n=e.physics??ie,s=t==="up";return{prepare:({from:i,to:a})=>(i.then(o=>{o.style.zIndex=s?"-1":"1",o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.pointerEvents="none"}),a.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint"}),{}),animation:({from:i,to:a})=>{const o=i.offsetHeight,l=a.offsetHeight,c=window.innerHeight,r=Math.max(Math.min(o,l),c),p=new m.WebAnimation({element:i,integrator:b.from(n),style:h=>({transform:`translate3d(0, ${s?-r*h:r*h}px, 0)`})}),d=new m.WebAnimation({element:a,integrator:b.from(n),style:(h,y)=>({transform:`translate3d(0, ${s?y*r:y*-r}px, 0)`}),onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.transform=""}});return new m.MultiAnimation([p,d],{mode:"parallel"})}}};function oe({paths:e,type:t="directional",direction:n="up"}){return t==="non-directional"?C(e,()=>G({direction:n})):et(e,{forward:"up",backward:"down"},s=>G({direction:s}))}const re={spring:{stiffness:200,damping:24}},ae={inertia:{acceleration:25,resistance:1.2}},W=.2;function le(){return{enterPhysics:re,exitPhysics:ae,background:{willChange:"transform, opacity",enterStyle:(e,t)=>({transform:`scale(${1-W*e})`,opacity:t}),exitStyle:e=>({transform:`scale(${1-W+W*e})`,opacity:e})}}}const ce={spring:{stiffness:200,damping:24}},pe={inertia:{acceleration:25,resistance:1.2}};function de(){return{enterPhysics:ce,exitPhysics:pe,background:{willChange:"",enterStyle:()=>({}),exitStyle:()=>({})}}}const fe={static:de(),"background-scale":le()},he="static",me="transform",ue=(e={})=>{const t=e.direction??"enter",n=fe[e.type??he],s=t==="enter"?n.enterPhysics:n.exitPhysics,i=n.background,a=i.willChange!=="";return{prepare:({from:o,to:l})=>{const c=t==="enter"?l:o,r=t==="enter"?o:l;return c.then(p=>{p.style.willChange=me,p.style.backfaceVisibility="hidden",p.style.contain="layout paint",t==="exit"&&(p.style.pointerEvents="none",p.style.zIndex="100")}),r.then(p=>{a&&(p.style.willChange=i.willChange,p.style.backfaceVisibility="hidden",p.style.contain="layout paint"),t==="enter"&&(p.style.pointerEvents="none",p.style.zIndex="-1")}),{}},animation:({from:o,to:l,context:c})=>{const r=t==="enter"?l:o,p=t==="enter"?o:l,d=O(c,t==="enter"?"to":"from");r.style.clipPath=`inset(${d.top}px 0 calc(100% - ${d.top+d.height}px) 0)`;const h=t==="enter"?(x,A)=>({transform:`translate3d(0, ${A*d.height}px, 0)`}):x=>({transform:`translate3d(0, ${x*d.height}px, 0)`}),y=new m.WebAnimation({element:r,integrator:b.from(s),style:h,onComplete:()=>{r.style.willChange="auto",r.style.backfaceVisibility="",r.style.contain="",r.style.clipPath="",r.style.transform=""}});if(!a)return new m.MultiAnimation([y],{mode:"parallel"});const f=O(c,t==="enter"?"from":"to"),u=f.left+f.width/2,g=f.top+f.height/2;p.style.clipPath=`inset(${f.top}px 0 calc(100% - ${f.top+f.height}px) 0)`,p.style.transformOrigin=`${u}px ${g}px`;const $=t==="enter"?(x,A)=>i.enterStyle(x,A):x=>i.exitStyle(x),w=new m.WebAnimation({element:p,integrator:b.from(s),style:$,onComplete:t==="exit"?()=>{p.style.willChange="auto",p.style.backfaceVisibility="",p.style.contain="",p.style.clipPath="",p.style.transformOrigin=""}:void 0});return new m.MultiAnimation([y,w],{mode:"parallel"})}}};function ye({type:e,...t}){return tt(t,n=>ue({direction:n,type:e}))}const ge={spring:{stiffness:170,damping:22,doubleSpring:.8}},be=(e={})=>{const t=e.direction??"left",n=e.physics??ge,s=t==="left";return{prepare:({from:i,to:a})=>(i.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.pointerEvents="none"}),a.then(o=>{const l=s?100:-100;o.style.transform=`translate3d(${l}%, 0, 0)`,o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint"}),{}),animation:({from:i,to:a})=>{const o=new m.WebAnimation({element:i,integrator:b.from(n),style:c=>({transform:`translate3d(${s?-100*c:100*c}%, 0, 0)`})}),l=new m.WebAnimation({element:a,integrator:b.from(n),style:(c,r)=>({transform:`translate3d(${s?r*100:r*-100}%, 0, 0)`}),onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.transform=""}});return new m.MultiAnimation([o,l],{mode:"parallel"})}}};function we({paths:e}){return et(e,{forward:"left",backward:"right"},t=>be({direction:t}))}const Se={spring:{stiffness:17,damping:6}},z=20,_=800,$e=(e={})=>{const t=e.physics??Se;return{prepare:({from:n,to:s})=>(n.then(i=>{i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint",i.style.pointerEvents="none",i.style.transform=`perspective(${_}px) rotateY(0deg) translate3d(0%, 0, 0)`}),s.then(i=>{i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint",i.style.transform=`perspective(${_}px) rotateY(${z}deg) translate3d(-100%, 0, 0)`}),{}),animation:({from:n,to:s})=>{const i=new m.WebAnimation({element:n,integrator:b.from(t),style:o=>{const l=-o*z,c=o*100;return{transform:`perspective(${_}px) rotateY(${l}deg) translate3d(${c}%, 0, 0)`}}}),a=new m.WebAnimation({element:s,integrator:b.from(t),style:(o,l)=>{const c=l*z,r=-l*100;return{transform:`perspective(${_}px) rotateY(${c}deg) translate3d(${r}%, 0, 0)`}},onComplete:()=>{s.style.transform="",s.style.willChange="auto",s.style.backfaceVisibility="",s.style.contain=""}});return new m.MultiAnimation([i,a],{mode:"sequence"})}}};function xe({paths:e}){return C(e,()=>$e())}function nt({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s}){const i=t.left-e.left+(t.width-e.width)/2-s.x,a=t.top-e.top+(t.height-e.height)/2-s.y,o=t.width/e.width,l=t.height/e.height,c=Math.max(o,l),r=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,d=(n.height-(e.top+e.height))/n.height*100,h=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const f=1-y;return{clipPath:`inset(${r*f}% ${p*f}% ${d*f}% ${h*f}%)`,transform:`translate(${i*f}px, ${a*f}px) scale(${1+(c-1)*f})`}}}}function st({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s}){const i=t.left-e.left+(t.width-e.width)/2+s.x,a=t.top-e.top+(t.height-e.height)/2+s.y,o=t.width/e.width,l=t.height/e.height,c=Math.min(o,l),r=e.top/n.height*100,p=(n.width-(e.left+e.width))/n.width*100,d=(n.height-(e.top+e.height))/n.height*100,h=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:y=>{const f=1-y;return{clipPath:`inset(${r*f}% ${p*f}% ${d*f}% ${h*f}%)`,transform:`translate(${i*f-s.x}px, ${a*f}px) scale(${1+(c-1)*f})`}}}}const Ae={spring:{stiffness:340,damping:30,doubleSpring:1}};function Ce({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2+n.x,i=e.top-t.top+(e.height-t.height)/2+n.y,a=e.width/t.width,o=e.height/t.height,l=Math.max(a,o);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:c=>{const r=1-c;return{transform:`translate(${s*r-n.x}px, ${i*r}px) scale(${1+(l-1)*r})`,opacity:`${1-r}`}}}}function Ee({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2-n.x,i=e.top-t.top+(e.height-t.height)/2-n.y,a=e.width/t.width,o=e.height/t.height,l=Math.max(a,o);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:c=>{const r=1-c;return{transform:`translate(${s*r}px, ${i*r}px) scale(${1+(l-1)*r})`,opacity:`${c}`}}}}function Pe(){return{physics:Ae,in:nt,out:st,backgroundIn:Ee,backgroundOut:Ce}}const De={spring:{stiffness:420,damping:34}};function K(){return{transformOrigin:"",animate:()=>({})}}function Oe(){return{physics:De,in:nt,out:st,backgroundIn:()=>K(),backgroundOut:()=>K()}}const Te={expand:Pe(),static:Oe()},U="data-zoom-enter-key",J="data-zoom-exit-key";function Q(e){const t=e.querySelectorAll(`[${U}]`);return t.length!==1?null:t[0]}function R(e,t){const n=e.querySelectorAll(`[${J}]`);for(const s of n)if(s.getAttribute(J)===t)return s;return null}function Ie(e,t){const n=Q(e),s=Q(t);if(!n&&s){const i=s.getAttribute(U);if(!i)return null;const a=R(e,i);return a?{mode:"enter",enterEl:s,exitEl:a}:null}if(n&&!s){const i=n.getAttribute(U);if(!i)return null;const a=R(t,i);return a?{mode:"exit",enterEl:n,exitEl:a}:null}return null}function _e(e,t,n,s){return{enterRect:P(e.mode==="enter"?n:t,e.enterEl),exitRect:P(e.mode==="enter"?t:n,e.exitEl),pageRect:e.mode==="enter"?n.getBoundingClientRect():t.getBoundingClientRect(),scrollOffset:s}}const Le=e=>{const t=Te[e.type],n=t.physics;return{prepare:({from:s})=>(s.then(i=>{i.style.willChange="transform, clip-path, opacity",i.style.backfaceVisibility="hidden",i.style.contain="layout paint"}),{}),animation:({from:s,to:i,context:a})=>{const o=Ie(s,i);if(!o)return new m.MultiAnimation([],{mode:"parallel"});const l=_e(o,s,i,a.scrollOffset),c=o.mode==="enter"?t.in(l):t.backgroundIn(l),r=o.mode==="enter"?t.backgroundOut(l):t.out(l);c&&(i.style.transformOrigin=c.transformOrigin),r&&(s.style.transformOrigin=r.transformOrigin);const p=o.mode==="enter"?i:s,d=p.style.zIndex;p.style.zIndex="9999";const h=new m.WebAnimation({element:s,integrator:b.from(n),style:(f,u)=>r.animate(u)}),y=new m.WebAnimation({element:i,integrator:b.from(n),style:f=>c.animate(f),onComplete:()=>{i.style.willChange="auto",i.style.backfaceVisibility="",i.style.transformOrigin="",i.style.contain="",p.style.zIndex=d}});return new m.MultiAnimation([h,y],{mode:"parallel"})}}};function ke({paths:e,type:t}){return C(e,()=>Le({type:t}))}exports.Animation=m.Animation;exports.MultiAnimation=m.MultiAnimation;exports.WebAnimation=m.WebAnimation;exports.blind=At;exports.drill=kt;exports.fade=Ft;exports.film=Zt;exports.hero=Kt;exports.jaemin=te;exports.rotate=se;exports.scroll=oe;exports.sheet=ye;exports.slide=we;exports.strip=xe;exports.zoom=ke;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './ssgoi-transition/create-ssgoi-transition-context';
|
|
6
|
-
export * from './ssgoi-transition/navigation-detector-strategy';
|
|
7
|
-
export * from './transition/transition-strategy';
|
|
1
|
+
export * from './transitions';
|
|
2
|
+
export { Animation, WebAnimation, MultiAnimation } from './animation';
|
|
3
|
+
export type { WebAnimationOptions, MultiAnimationOptions, MultiAnimationMode, } from './animation';
|
|
4
|
+
export type { SsgoiConfig, SsgoiPathTransition, SsgoiPathTransitionInput, TransitionConfig, PrepareArgs, AnimationFactoryArgs, CreateElement, SsgoiTransitionContext, Pose, Timeline, TimelineFrame, StyleObject, PhysicsOptions, SpringConfig, InertiaConfig, } from './types/index.ts';
|
|
8
5
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,QAAQ,CAAC"}
|