@ssgoi/core 5.2.2 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/animation/animation.d.ts +68 -0
- package/dist/animation/animation.d.ts.map +1 -0
- package/dist/animation/host-animation.d.ts +45 -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 +55 -0
- package/dist/animation/multi-animation.d.ts.map +1 -0
- package/dist/animation/web-animation.d.ts +65 -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 +1702 -1186
- 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 +511 -0
- package/dist/multi-animation-CnxqLEka.js +322 -0
- package/dist/multi-animation-Dw2JTJI2.cjs +1 -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/axis/index.d.ts +43 -0
- package/dist/transitions/axis/index.d.ts.map +1 -0
- package/dist/transitions/axis/provider/index.d.ts +8 -0
- package/dist/transitions/axis/provider/index.d.ts.map +1 -0
- package/dist/transitions/axis/provider/x/fluid.d.ts +3 -0
- package/dist/transitions/axis/provider/x/fluid.d.ts.map +1 -0
- package/dist/transitions/axis/provider/x/index.d.ts +3 -0
- package/dist/transitions/axis/provider/x/index.d.ts.map +1 -0
- package/dist/transitions/axis/provider/x/snappy.d.ts +3 -0
- package/dist/transitions/axis/provider/x/snappy.d.ts.map +1 -0
- package/dist/transitions/axis/provider/y.d.ts +3 -0
- package/dist/transitions/axis/provider/y.d.ts.map +1 -0
- package/dist/transitions/axis/provider/z.d.ts +3 -0
- package/dist/transitions/axis/provider/z.d.ts.map +1 -0
- package/dist/transitions/axis/transition.d.ts +5 -0
- package/dist/transitions/axis/transition.d.ts.map +1 -0
- package/dist/transitions/axis/types.d.ts +52 -0
- package/dist/transitions/axis/types.d.ts.map +1 -0
- package/dist/transitions/blind/index.d.ts +15 -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 +40 -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 +33 -0
- package/dist/transitions/drill/types.d.ts.map +1 -0
- package/dist/transitions/fade/index.d.ts +16 -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/fade/types.d.ts +14 -0
- package/dist/transitions/fade/types.d.ts.map +1 -0
- package/dist/transitions/film/index.d.ts +16 -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/film/types.d.ts +16 -0
- package/dist/transitions/film/types.d.ts.map +1 -0
- package/dist/transitions/hero/index.d.ts +17 -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/hero/types.d.ts +12 -0
- package/dist/transitions/hero/types.d.ts.map +1 -0
- package/dist/transitions/index.d.ts +11 -12
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/jaemin/index.d.ts +16 -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/jaemin/types.d.ts +9 -0
- package/dist/transitions/jaemin/types.d.ts.map +1 -0
- package/dist/transitions/rotate/index.d.ts +15 -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/rotate/types.d.ts +9 -0
- package/dist/transitions/rotate/types.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 +41 -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 +29 -0
- package/dist/transitions/sheet/types.d.ts.map +1 -0
- package/dist/transitions/slide/index.d.ts +16 -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/slide/types.d.ts +10 -0
- package/dist/transitions/slide/types.d.ts.map +1 -0
- package/dist/transitions/strip/index.d.ts +16 -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/strip/types.d.ts +9 -0
- package/dist/transitions/strip/types.d.ts.map +1 -0
- package/dist/transitions/utils.d.ts +25 -5
- package/dist/transitions/utils.d.ts.map +1 -1
- package/dist/transitions/zoom/index.d.ts +22 -0
- package/dist/transitions/zoom/index.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/blur.d.ts +14 -0
- package/dist/transitions/zoom/provider/blur.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/expand.d.ts +10 -0
- package/dist/transitions/zoom/provider/expand.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/index.d.ts +12 -0
- package/dist/transitions/zoom/provider/index.d.ts.map +1 -0
- package/dist/transitions/zoom/provider/static.d.ts +10 -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 +109 -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 +174 -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
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ import { fade } from '@ssgoi/react/view-transitions';
|
|
|
38
38
|
|
|
39
39
|
export default function App() {
|
|
40
40
|
return (
|
|
41
|
-
<Ssgoi config={{
|
|
41
|
+
<Ssgoi config={{ transitions: fade({ paths: ['/', '/about'] }) }}>
|
|
42
42
|
<div style={{ position: 'relative' }}>
|
|
43
43
|
{/* Your app */}
|
|
44
44
|
</div>
|
|
@@ -62,7 +62,7 @@ export default function HomePage() {
|
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
**That's it!** Your pages now transition smoothly with a fade effect.
|
|
65
|
+
**That's it!** Your configured pages now transition smoothly with a fade effect.
|
|
66
66
|
|
|
67
67
|
## Advanced Transitions
|
|
68
68
|
|
|
@@ -82,8 +82,7 @@ const config = {
|
|
|
82
82
|
|
|
83
83
|
// Pinterest-style image transitions
|
|
84
84
|
{ from: '/gallery', to: '/photo/*', transition: pinterest() }
|
|
85
|
-
]
|
|
86
|
-
defaultTransition: fade()
|
|
85
|
+
]
|
|
87
86
|
};
|
|
88
87
|
```
|
|
89
88
|
|
|
@@ -153,7 +152,7 @@ export default function RootLayout({ children }) {
|
|
|
153
152
|
<html>
|
|
154
153
|
<body>
|
|
155
154
|
<Ssgoi config={{
|
|
156
|
-
|
|
155
|
+
transitions: scroll({ paths: ['/', '/about'] })
|
|
157
156
|
}}>
|
|
158
157
|
<div style={{ position: 'relative', minHeight: '100vh' }}>
|
|
159
158
|
{children}
|
|
@@ -185,7 +184,7 @@ export default function Page() {
|
|
|
185
184
|
import { fade } from '@ssgoi/svelte/view-transitions';
|
|
186
185
|
</script>
|
|
187
186
|
|
|
188
|
-
<Ssgoi config={{
|
|
187
|
+
<Ssgoi config={{ transitions: fade({ paths: ['/', '/about'] }) }}>
|
|
189
188
|
<div style="position: relative; min-height: 100vh;">
|
|
190
189
|
<slot />
|
|
191
190
|
</div>
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* Current progress, normalized to 0..1 between lowerBound and upperBound.
|
|
51
|
+
* Reads the live simulation value, so it advances frame-by-frame while
|
|
52
|
+
* playing. Useful for external inspection / debugging.
|
|
53
|
+
*
|
|
54
|
+
* NOT used by `MultiAnimation` stagger triggering — that uses the
|
|
55
|
+
* pre-computed timeline via `findTimeForProgress` to avoid per-frame work.
|
|
56
|
+
*/
|
|
57
|
+
abstract get progress(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Find the time (ms, relative to this animation's last play() / reverse())
|
|
60
|
+
* at which progress first crosses `threshold` (0..1). Returns `null` if
|
|
61
|
+
* the animation has no simulation yet (i.e. play hasn't been called).
|
|
62
|
+
*
|
|
63
|
+
* Implementations should read from the pre-computed simulation timeline so
|
|
64
|
+
* this is an O(n) one-shot lookup — never a polling loop.
|
|
65
|
+
*/
|
|
66
|
+
abstract findTimeForProgress(threshold: number): number | null;
|
|
67
|
+
}
|
|
68
|
+
//# 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;IAEpC;;;;;;;OAOG;IACH,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC;IAEhC;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAC/D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 progress(): number;
|
|
33
|
+
findTimeForProgress(threshold: number): number | null;
|
|
34
|
+
get playbackRate(): number;
|
|
35
|
+
set playbackRate(rate: number);
|
|
36
|
+
getPose(): Pose[];
|
|
37
|
+
getTimeline(): Timeline[];
|
|
38
|
+
matchInto(poses: Pose[]): void;
|
|
39
|
+
/** Currently attached child, or null when nothing is playing. */
|
|
40
|
+
get activeChild(): Animation | null;
|
|
41
|
+
/** Subscribe to host state changes. Returns an unsubscribe fn. */
|
|
42
|
+
subscribe(fn: () => void): () => void;
|
|
43
|
+
private notify;
|
|
44
|
+
}
|
|
45
|
+
//# 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,QAAQ,IAAI,MAAM,CAErB;IAED,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrD,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,55 @@
|
|
|
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
|
+
* Per-child start progress (0..1), keyed off the *previous* child. Only
|
|
8
|
+
* meaningful for `parallel` mode. `startAt[i]` = the progress the (i-1)th
|
|
9
|
+
* child must reach before the i-th child plays. `startAt[0]` is ignored
|
|
10
|
+
* (the first child always starts immediately).
|
|
11
|
+
*
|
|
12
|
+
* Omit (or use all zeros) for true simultaneous start — the existing
|
|
13
|
+
* parallel behavior. Use a fractional value (e.g. `[0, 0.4]`) for
|
|
14
|
+
* fade-through / shared-axis style overlap that's robust to spring tuning
|
|
15
|
+
* changes (the trigger moves with the spring, not with wall-clock time).
|
|
16
|
+
*/
|
|
17
|
+
startAt?: number[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Composite that drives several child Animations.
|
|
21
|
+
*
|
|
22
|
+
* - `parallel`: all children play together (optionally staggered via `startAt`)
|
|
23
|
+
* - `sequence`: each child waits for the previous to settle, then plays
|
|
24
|
+
*
|
|
25
|
+
* Pose/Timeline reads fan out to every child for diagnostic / inspection use.
|
|
26
|
+
*/
|
|
27
|
+
export declare class MultiAnimation extends Animation {
|
|
28
|
+
private children;
|
|
29
|
+
private startAt;
|
|
30
|
+
private pendingComplete;
|
|
31
|
+
private running;
|
|
32
|
+
private pendingStartTimers;
|
|
33
|
+
constructor(children: Animation[], opts?: MultiAnimationOptions);
|
|
34
|
+
play(): void;
|
|
35
|
+
reverse(): void;
|
|
36
|
+
pause(): void;
|
|
37
|
+
complete(): void;
|
|
38
|
+
get progress(): number;
|
|
39
|
+
getPose(): Pose[];
|
|
40
|
+
getTimeline(): Timeline[];
|
|
41
|
+
matchInto(_poses: Pose[]): void;
|
|
42
|
+
get isAnimating(): boolean;
|
|
43
|
+
get isPaused(): boolean;
|
|
44
|
+
get isComplete(): boolean;
|
|
45
|
+
get isReversing(): boolean;
|
|
46
|
+
get playbackRate(): number;
|
|
47
|
+
set playbackRate(rate: number);
|
|
48
|
+
private startRun;
|
|
49
|
+
private scheduleStart;
|
|
50
|
+
private clearPendingStartTimers;
|
|
51
|
+
private handleChildComplete;
|
|
52
|
+
private handleFinished;
|
|
53
|
+
findTimeForProgress(_threshold: number): number | null;
|
|
54
|
+
}
|
|
55
|
+
//# 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;IAC1B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAC3C,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAuC;gBAErD,QAAQ,EAAE,SAAS,EAAE,EAAE,IAAI,GAAE,qBAA0B;IAgBnE,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,IAAI;IAIf,KAAK,IAAI,IAAI;IAMb,QAAQ,IAAI,IAAI;IAOhB,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,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,QAAQ;IAuBhB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,cAAc;IAMtB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAOvD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 progress(): number;
|
|
54
|
+
findTimeForProgress(threshold: number): number | null;
|
|
55
|
+
get playbackRate(): number;
|
|
56
|
+
set playbackRate(rate: number);
|
|
57
|
+
getPose(): Pose[];
|
|
58
|
+
getTimeline(): Timeline[];
|
|
59
|
+
matchInto(poses: Pose[]): void;
|
|
60
|
+
private runToward;
|
|
61
|
+
private clearWaapi;
|
|
62
|
+
private captureLiveState;
|
|
63
|
+
private applyStyleAt;
|
|
64
|
+
}
|
|
65
|
+
//# 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,QAAQ,IAAI,MAAM,CAMrB;IAED,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAcrD,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 wt=Object.defineProperty;var St=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $=(e,t,n)=>St(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./multi-animation-Dw2JTJI2.cjs");function C(e,t){const n=[];for(let s=0;s<e.length;s++)for(let o=s+1;o<e.length;o++){const r=e[s],i=e[o];!r||!i||n.push({from:r,to:i,transition:t(),symmetric:!0})}return n}function pt(e,t){return[{from:e.exit,to:e.enter,transition:t("enter")},{from:e.enter,to:e.exit,transition:t("exit")}]}function N(e,t,n){const s=[];for(let o=0;o<e.length;o++)for(let r=o+1;r<e.length;r++){const i=e[o],l=e[r];!i||!l||s.push({from:i,to:l,transition:n(t.forward)},{from:l,to:i,transition:n(t.backward)})}return s}class L{constructor(t){$(this,"omega");$(this,"zeta");$(this,"restDelta");$(this,"restSpeed");const{stiffness:n,damping:s}=t,o=1;this.omega=Math.sqrt(n/o),this.zeta=s/(2*Math.sqrt(n*o)),this.restDelta=t.restDelta??h.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??h.VELOCITY_THRESHOLD}step(t,n,s){const o=Math.min(s,.033),{omega:r,zeta:i}=this,{position:l,velocity:c}=t,a=-2*o*i*r*c,p=o*r*r*(n-l),d=c+a+p;return{position:l+o*d,velocity:d}}isSettled(t,n){const s=Math.abs(n-t.position),o=Math.abs(t.velocity);return s<this.restDelta&&o<this.restSpeed}}class $t{constructor(t){$(this,"leader");$(this,"follower");$(this,"restDelta");$(this,"restSpeed");this.restDelta=t.restDelta??h.POSITION_THRESHOLD,this.restSpeed=t.restSpeed??h.VELOCITY_THRESHOLD,this.leader=new L({stiffness:t.stiffness,damping:t.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let n,s,o,r;typeof t.follower=="number"?(n=t.stiffness*t.follower,s=t.damping):t.follower?(n=t.follower.stiffness,s=t.follower.damping,o=t.follower.restDelta,r=t.follower.restSpeed):(n=t.stiffness,s=t.damping),this.follower=new L({stiffness:n,damping:s,restDelta:o??this.restDelta,restSpeed:r??this.restSpeed})}step(t,n,s){const r=t._leader??{position:t.position,velocity:t.velocity},i=this.leader.step(r,n,s),l=this.follower.step(t,i.position,s);return{position:l.position,velocity:l.velocity,_leader:i}}isSettled(t,n){const s=t,o=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&&o:o}}const xt=.01,Et=500,Ct=10;class At{constructor(t){$(this,"acceleration");$(this,"resistance");$(this,"resistanceType");$(this,"min");$(this,"max");$(this,"bounceStiffness");$(this,"bounceDamping");$(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??Et,this.bounceDamping=t.bounceDamping??Ct,this.restDelta=t.restDelta??xt}step(t,n,s){const o=Math.min(s,.033),{acceleration:r,resistance:i,resistanceType:l,min:c,max:a}=this,{position:p,velocity:d}=t,u=c!==void 0&&p<c,y=a!==void 0&&p>a;let f;if(u||y){const S=p-(u?c:a),x=-this.bounceStiffness*S,E=-this.bounceDamping*d;f=x+E}else{const w=n>p?1:-1;let S;l==="linear"?S=i*d:S=i*d*Math.abs(d),f=w*r-S}const m=d+f*o;let g=p+m*o;if(!u&&!y){const w=n>p?1:-1;(w>0&&g>n||w<0&&g<n)&&(g=n)}return{position:g,velocity:g===n?0:m}}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 At({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 o;return typeof s=="number"?o=s:typeof s=="object"&&(o={stiffness:s.stiffness,damping:s.damping}),new $t({stiffness:n.stiffness,damping:n.damping,follower:o,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 Pt{constructor(t){$(this,"durationSec");this.durationSec=Math.max(1/60,t.durationSec)}step(t,n,s){const o=n-t.position;if(o===0)return t;const r=Math.sign(o),i=Math.abs(o)/this.durationSec,l=r*i*s,c=t.position+l;return(r>0?c>=n:c<=n)?{position:n,velocity:0}:{position:c,velocity:r*i}}isSettled(t,n){return Math.abs(t.position-n)<h.POSITION_THRESHOLD}}const j=8,q={spring:{stiffness:1e3,damping:40,doubleSpring:1.2}};function Tt({direction:e}){const t=e==="forward"?j:-j;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${t}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${t*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function vt(){return{outPhysics:q,inPhysics:q,composition:{mode:"parallel",startAt:[0,0]},build:Tt}}const G=30,Dt={inertia:{acceleration:150,resistance:1.5}},Ot={spring:{stiffness:180,damping:34}};function It({direction:e}){const t=e==="forward"?1:-1,n=-G*t,s=G*t;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`translate3d(${n*o}px, 0, 0)`,opacity:`${1-o}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${s}px, 0, 0)`,opacity:"0"},animate:o=>({transform:`translate3d(${s*(1-o)}px, 0, 0)`,opacity:`${o}`})}}}function _t(){return{outPhysics:Dt,inPhysics:Ot,composition:{mode:"sequence"},build:It}}const kt={snappy:vt(),fluid:_t()},K={spring:{stiffness:2400,damping:65,doubleSpring:.7}},I=8;function Lt({direction:e}){const t=e==="forward"?-I:I,n=e==="forward"?I:-I;return{out:{willChange:"transform, opacity",startStyle:{},animate:s=>({transform:`translate3d(0, ${t*s}px, 0)`,opacity:`${1-s}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${n}px, 0)`,opacity:"0"},animate:s=>({transform:`translate3d(0, ${n*(1-s)}px, 0)`,opacity:`${s}`})}}}function Ft(){return{outPhysics:K,inPhysics:K,composition:{mode:"parallel",startAt:[0,.3]},build:Lt}}const R={spring:{stiffness:280,damping:30}},_=.05;function Yt(){return{out:{willChange:"transform, opacity",startStyle:{},animate:e=>({transform:`scale(${1+e*_})`,opacity:`${1-e}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-_})`,opacity:"0"},animate:e=>({transform:`scale(${1-_+e*_})`,opacity:`${e}`})}}}function Mt(){return{outPhysics:R,inPhysics:R,composition:{mode:"parallel"},build:Yt}}const Ht=Ft(),Wt=Mt(),zt={x:kt,y:{snappy:Ht},z:{snappy:Wt}};function Ut(e,t){const n=zt[e];return n[t]??n.snappy}const Xt="x",Vt="snappy";function J(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}function Bt(e){e.style.willChange="auto",e.style.backfaceVisibility="",e.style.contain="",e.style.transform="",e.style.opacity=""}const Nt=(e={})=>{const t=e.direction??"forward",n=e.type??Xt,s=e.feel??Vt,o=Ut(n,s),r=o.build({direction:t});return{prepare:({from:i,to:l})=>(i.then(c=>{J(c,r.out),c.style.pointerEvents="none"}),l.then(c=>{J(c,r.in)}),{}),animation:({from:i,to:l})=>{const c=new h.WebAnimation({element:i,integrator:b.from(o.outPhysics),style:p=>r.out.animate(p)}),a=new h.WebAnimation({element:l,integrator:b.from(o.inPhysics),style:p=>r.in.animate(p),onComplete:()=>Bt(l)});return new h.MultiAnimation([c,a],o.composition)}}};function Zt(e,t,n){return e!=="x"||t==="snappy"||n==="snappy"?"snappy":"fluid"}function jt(e){const{paths:t}=e,n=e.type??"x",s=e.variant,o=e.feel,r=Zt(n,s,o);return N(t,{forward:"forward",backward:"backward"},i=>Nt({type:n,direction:i,feel:r}))}const qt={spring:{stiffness:200,damping:22}},Gt=10,Kt="horizontal",Rt="#000000";function Q(e,t,n,s,o,r){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 a=0;a<t;a++){const p=document.createElement("div");if(n==="horizontal"){const d=100/t;p.style.cssText=`
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: ${d*a}%;
|
|
13
|
+
left: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: calc(${d}% + 1px);
|
|
16
|
+
background: ${s};
|
|
17
|
+
transform: scaleX(${o==="hidden"?0:1});
|
|
18
|
+
transform-origin: ${r} center;
|
|
19
|
+
will-change: transform;
|
|
20
|
+
`}else{const d=100/t;p.style.cssText=`
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: ${d*a}%;
|
|
24
|
+
width: calc(${d}% + 1px);
|
|
25
|
+
height: 100%;
|
|
26
|
+
background: ${s};
|
|
27
|
+
transform: scaleY(${o==="hidden"?0:1});
|
|
28
|
+
transform-origin: ${r==="left"?"top":"bottom"} center;
|
|
29
|
+
will-change: transform;
|
|
30
|
+
`}c.push(p),l.appendChild(p)}return e.appendChild(l),{container:l,blinds:c}}const Jt=(e={})=>{const t=e.blindCount??Gt,n=e.direction??Kt,s=e.blindColor??Rt,o=e.physics??qt;return{prepare:async({from:r,to:i})=>{const l=await r,c=await i;l.style.zIndex="1000";const a=Q(l,t,n,s,"hidden","left");c.style.position="relative",c.style.zIndex="0";const p=Q(c,t,n,s,"closed","right");return{fromBlinds:a.blinds,fromContainer:a.container,toBlinds:p.blinds,toContainer:p.container}},animation:({fromBlinds:r,fromContainer:i,toBlinds:l,toContainer:c})=>{const a=r.map(y=>new h.WebAnimation({element:y,integrator:b.from(o),style:f=>({transform:n==="horizontal"?`scaleX(${f})`:`scaleY(${f})`})})),p=l.map((y,f)=>new h.WebAnimation({element:y,integrator:b.from(o),style:(m,g)=>({transform:n==="horizontal"?`scaleX(${g})`:`scaleY(${g})`}),onComplete:f===l.length-1?()=>{c.remove(),i.remove()}:void 0})),d=new h.MultiAnimation(a,{mode:"parallel"}),u=new h.MultiAnimation(p,{mode:"parallel"});return new h.MultiAnimation([d,u],{mode:"sequence"})}}};function Qt(e){const{paths:t,type:n="horizontal"}=e;return C(t,()=>Jt({direction:n}))}const te={spring:{stiffness:200,damping:20,doubleSpring:.7}},T=.5;function ee(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:`${T+(1-T)*(1-s)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${n}%, 0, 0)`,opacity:`${T}`},animate:s=>({transform:`translate3d(${n*(1-s)}%, 0, 0)`,opacity:`${T+(1-T)*s}`})}}}function ne(){return{physics:te,build:ee}}const se={spring:{stiffness:170,damping:22}};function oe(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 ie(){return{physics:se,build:oe}}const re={parallax:ie(),crossfade:ne()},ae="parallax";function tt(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 le=(e={})=>{const t=e.direction??"enter",n=re[e.type??ae],s=n.physics,o=n.build(t);return{prepare:({from:r,to:i})=>(r.then(l=>{tt(l,o.out),l.style.pointerEvents="none",l.style.zIndex=t==="enter"?"-1":"100"}),i.then(l=>{tt(l,o.in)}),{}),animation:({from:r,to:i})=>{const l=new h.WebAnimation({element:r,integrator:b.from(s),style:a=>o.out.animate(a)}),c=new h.WebAnimation({element:i,integrator:b.from(s),style:a=>o.in.animate(a),onComplete:()=>{i.style.willChange="auto",i.style.backfaceVisibility="",i.style.contain="",i.style.transform="",i.style.opacity=""}});return new h.MultiAnimation([l,c],{mode:"parallel"})}}};function ce(e){return e==="slide"||e==="crossfade"?"crossfade":"parallax"}function pe(e){const{enter:t,exit:n}=e,s=e.type,o=ce(s);return pt({enter:t,exit:n},r=>le({direction:r,type:o}))}const de={spring:{stiffness:180,damping:20,doubleSpring:!0}},fe={spring:{stiffness:170,damping:20,doubleSpring:!0}},me=(e={})=>{const t=e.physics??fe,n=e.physics??de;return{prepare:({to:s})=>(s.then(o=>{o.style.opacity="0",o.style.willChange="opacity"}),{}),animation:({from:s,to:o})=>{const r=new h.WebAnimation({element:s,integrator:b.from(n),style:(l,c)=>({opacity:c}),onComplete:()=>{s.style.willChange="auto"}}),i=new h.WebAnimation({element:o,integrator:b.from(t),style:l=>({opacity:l}),onComplete:()=>{o.style.willChange="auto",o.style.opacity=""}});return new h.MultiAnimation([r,i],{mode:"sequence"})}}};function ue(e){const{paths:t}=e;return C(t,()=>me())}function P(e,t){function n(r){let i=0,l=0;const c=r.offsetWidth,a=r.offsetHeight;let p=r;for(;p;)i+=p.offsetTop,l+=p.offsetLeft,p=p.offsetParent;return i-=window.scrollY,l-=window.scrollX,{top:i,left:l,width:c,height:a}}const s=n(e),o=n(t);return new DOMRect(o.left-s.left,o.top-s.top,o.width,o.height)}function v(e,t){const{scrollingElement:n,positionedParent:s}=e,o=n!==s&&n.contains(s)?P(n,s).top:0;return{top:e[t].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-o}}const H={scaleDown:{stiffness:20,damping:7},translate:{stiffness:15,damping:7},scaleUp:{stiffness:20,damping:7}},A={scaleDown:0,translate:.2,scaleUp:.8},he=.8,ye="white",et=1e3/60,ge=600;function be(e){const{items:t,from:n,to:s,recordFrame:o}=e,r=et/1e3,i=Math.abs(s-n),l=t.map(a=>({item:a,integrator:new L({stiffness:a.spring.stiffness,damping:a.spring.damping}),state:{position:n,velocity:0},started:!1,settled:!1,settleTime:0}));for(let a=0;a<l.length;a++)(a===0||l[a].item.offset===0)&&(l[a].started=!0);o(0);let c=0;for(let a=1;a<=ge;a++){const p=a*et;c=p;for(const d of l)!d.started||d.settled||(d.state=d.integrator.step(d.state,s,r),d.integrator.isSettled(d.state,s)?(d.settleTime+=r,d.settleTime>=h.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 u=l[d];if(u.started)continue;const y=l[d-1];if(!y.started)continue;(i===0?1:Math.abs(y.state.position-n)/i)>=u.item.offset&&(u.started=!0)}if(o(p),l.every(d=>d.settled))return p}return c}function W(e,t){return e!=null&&e.spring?{stiffness:e.spring.stiffness,damping:e.spring.damping}:t}function nt(e){const{rect:t,scale:n,direction:s,override:o}=e,r=s==="out"?{scale:1,translateY:-t.top}:{scale:n,translateY:-t.top+t.height},i=W(o,H.scaleDown),l=W(o,H.translate),c=W(o,H.scaleUp),a=s==="out"?1:0,p=s==="out"?0:1,d=s==="out"?[{spring:i,offset:A.scaleDown,tick:f=>{const m=1-f;r.scale=1-(1-n)*m}},{spring:l,offset:A.translate,tick:f=>{const m=1-f;r.translateY=-t.top-t.height*m}},{spring:c,offset:A.scaleUp,tick:f=>{const m=1-f;r.scale=n+(1-n)*m}}]:[{spring:i,offset:A.scaleDown,tick:f=>{r.scale=1-(1-n)*f}},{spring:l,offset:A.translate,tick:f=>{r.translateY=-t.top+t.height*(1-f)}},{spring:c,offset:A.scaleUp,tick:f=>{r.scale=n+(1-n)*f}}],u=[],y=be({items:d,from:a,to:p,recordFrame:f=>u.push({time:f,scale:r.scale,translateY:r.translateY})});return{snapshots:u,totalDuration:y}}function we(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),o=Math.ceil(n);if(s===o)return e[s];const r=e[s],i=e[o],l=n-s;return{time:r.time+(i.time-r.time)*l,scale:r.scale+(i.scale-r.scale)*l,translateY:r.translateY+(i.translateY-r.translateY)*l}}const Se=[[1,1],[-1,1],[1,-1],[-1,-1]];function $e(e,t){const o=(r,i,l)=>{const c=document.createElement("div");Object.assign(c.style,{position:"fixed",pointerEvents:"none",zIndex:"9999",width:"15px",height:"15px",...r});const a=document.createElement("div");Object.assign(a.style,{position:"absolute",width:"15px",height:"1px",backgroundColor:e,[l]:"0",[i]:"0"});const p=document.createElement("div");return Object.assign(p.style,{position:"absolute",width:"1px",height:"15px",backgroundColor:e,[l]:"0",[i]:"0"}),c.appendChild(a),c.appendChild(p),c};return{topLeft:o({top:`${t.top-1}px`,left:`${t.left-1}px`},"left","top"),topRight:o({top:`${t.top-1}px`,left:`${t.left+t.width-15+1}px`},"right","top"),bottomLeft:o({top:`${t.top+t.height-15+1}px`,left:`${t.left-1}px`},"left","bottom"),bottomRight:o({top:`${t.top+t.height-15+1}px`,left:`${t.left+t.width-15+1}px`},"right","bottom")}}function st(e,t){const n=t.left+t.width/2,s=t.top+t.height/2;e.style.transformOrigin=`${n}px ${s}px`}function ot(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 z(e,t,n,s,o){const r=n/1e3;return new h.WebAnimation({element:e,integrator:new Pt({durationSec:r}),lowerBound:0,upperBound:1,style:i=>s(we(t,i)),onComplete:o})}const xe=(e={})=>{var o;const t=((o=e.border)==null?void 0:o.color)??ye,n=he,s=e.physics;return{prepare:({from:r,to:i,context:l})=>{const c=v(l,"from"),a=v(l,"to"),p=P(document.body,l.positionedParent),d=$e(t,{...c,top:p.top});for(const u of["topLeft","topRight","bottomLeft","bottomRight"])l.positionedParent.appendChild(d[u]);return r.then(u=>{st(u,c),ot(u,c),u.style.transform=`translateY(${-c.top}px)`}),i.then(u=>{st(u,a),ot(u,a),u.style.transform=`translateY(${-a.top+a.height}px) scale(${n})`}),{borders:d,fromRect:c,toRect:a}},animation:({from:r,to:i,context:l,borders:c,fromRect:a,toRect:p})=>{const d=nt({rect:a,scale:n,direction:"out",override:s}),u=nt({rect:p,scale:n,direction:"in",override:s}),y=z(r,d.snapshots,d.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{r.style.clipPath="",r.style.transformOrigin=""}),f=z(i,u.snapshots,u.totalDuration,S=>({transform:`translateY(${S.translateY}px) scale(${S.scale})`}),()=>{i.style.clipPath="",i.style.transformOrigin="",i.style.transform=""}),m=Se.map(([S,x],E)=>{const F=["topLeft","topRight","bottomLeft","bottomRight"][E];return z(c[F],d.snapshots,d.totalDuration,D=>{const Y=(a.width-a.width*D.scale)/2*.7*S,M=(a.height-a.height*D.scale)/2*.7*x;return{transform:`translate(${Y}px, ${M}px)`}})}),g=new h.MultiAnimation([y,f,...m],{mode:"parallel"}),w=g.onComplete;return g.onComplete=()=>{w==null||w();const S=l.positionedParent;for(const x of["topLeft","topRight","bottomLeft","bottomRight"]){const E=c[x];E.parentElement===S&&S.removeChild(E)}},g}}};function Ee(e){const{paths:t,options:n}=e,s=(n==null?void 0:n.borderColor)!==void 0?{border:{color:n.borderColor}}:void 0;return C(t,()=>xe(s))}const Ce={spring:{stiffness:300,damping:30}};function Ae(e,t){return e.querySelector(`[data-hero-key="${t}"]`)}const Pe=(e={})=>{const t=e.physics??Ce,n=e.maxDistance??700;return{prepare:({from:s})=>(s.then(o=>{o.style.opacity="0"}),{}),animation:({from:s,to:o,context:r})=>{const i=s,l=o,c=Array.from(l.querySelectorAll("[data-hero-key]")),a=[];for(const f of c){const m=f.getAttribute("data-hero-key");if(!m)continue;const g=Ae(i,m);g&&a.push({key:m,fromEl:g,toEl:f})}if(a.length===0)return new h.MultiAnimation([],{mode:"parallel"});const p=[],d=[];for(const{fromEl:f,toEl:m}of a){const g=P(i,f),w=P(l,m),S=g.left-w.left-r.scrollOffset.x,x=g.top-w.top-r.scrollOffset.y,E=g.width/w.width,F=g.height/w.height;if(Math.abs(x)>n)continue;const D=m.style.transform,Y=m.style.position,M=m.style.transformOrigin,mt=m.style.zIndex,ut=m.style.willChange;m.style.position="relative",m.style.transformOrigin="top left",m.style.zIndex="1000",m.style.willChange="transform",p.push(new h.WebAnimation({element:m,integrator:b.from(t),style:(Z,O)=>{const ht=O*S,yt=O*x,gt=Z+O*E,bt=Z+O*F;return{transform:`translate(${ht}px, ${yt}px) scale(${gt}, ${bt})`}}})),d.push(()=>{m.style.transform=D,m.style.position=Y,m.style.transformOrigin=M,m.style.zIndex=mt,m.style.willChange=ut})}const u=new h.MultiAnimation(p,{mode:"parallel"}),y=u.onComplete;return u.onComplete=()=>{for(const f of d)f();y==null||y()},u}}};function Te(e){const{paths:t}=e;return C(t,()=>Pe())}const ve={spring:{stiffness:50,damping:30}},De={spring:{stiffness:80,damping:25}},Oe=(e={})=>{const t=e.physics??ve,n=e.initialRotation??45,s=e.initialScale??.01,o=e.rotationTriggerPoint??.8;return{prepare:({from:r,to:i,context:l})=>(r.then(c=>{c.style.opacity="1"}),i.then(c=>{const a=v(l,"to"),p=Math.min(a.width,a.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=a.left+a.width/2,u=a.top+a.height/2;c.style.transformOrigin=`${d}px ${u}px`,c.style.position="fixed",c.style.top=`${a.top}px`,c.style.left=`${a.left}px`,c.style.width=`${a.width}px`,c.style.height=`${a.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:r,to:i})=>{const l=new h.WebAnimation({element:r,integrator:b.from(De),style:(a,p)=>({opacity:p})}),c=new h.WebAnimation({element:i,integrator:b.from(t),style:a=>{let p;if(a<=.05)p=s;else if(a<=o){const f=(a-.05)/(o-.05),m=Math.pow(f,9);p=s+(.8-s)*m}else{const f=(a-o)/(1-o);p=.8+.2*(1-Math.pow(1-f,3))}const d=.7;let u;if(a<=d)u=n;else{const f=(a-d)/(1-d),m=1-Math.pow(1-f,2);u=n*(1-m)}let y;if(a<=d)y=1;else{const f=(a-d)/(1-d);y=1-Math.pow(f,.5)}return{transform:`rotate(${u.toFixed(2)}deg) scale(${p.toFixed(4)}) translateZ(0)`,"--border-radius-scale":y.toFixed(4)}},onComplete:()=>{i.style.willChange="",i.style.backfaceVisibility="",i.style.removeProperty("--max-border-radius"),i.style.removeProperty("--border-radius-scale"),i.style.transform="",i.style.transformOrigin="",i.style.position="",i.style.zIndex="",i.style.top="",i.style.left="",i.style.width="",i.style.height="",i.style.overflow="",i.style.borderRadius=""}});return new h.MultiAnimation([l,c],{mode:"parallel"})}}};function Ie(e){const{paths:t}=e;return C(t,()=>Oe())}const _e={spring:{stiffness:100,damping:30}},ke=(e={})=>{const t=e.physics??_e;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),s.then(o=>{o.style.opacity="0",o.style.transform="rotate(-180deg)",o.style.transformOrigin="center center",o.style.willChange="transform, opacity"}),{}),animation:({from:n,to:s})=>{const o=new h.WebAnimation({element:n,integrator:b.from(t),style:i=>({transform:`rotate(${i*180}deg)`,opacity:i<.5?1:0})}),r=new h.WebAnimation({element:s,integrator:b.from(t),style:(i,l)=>({transform:`rotate(${-l*180}deg)`,opacity:i>.5?1:0}),onComplete:()=>{s.style.willChange="auto",s.style.transform="",s.style.transformOrigin="",s.style.opacity=""}});return new h.MultiAnimation([o,r],{mode:"parallel"})}}};function Le(e){const{paths:t}=e;return C(t,()=>ke())}const Fe={spring:{stiffness:20,damping:8,doubleSpring:1,restDelta:.001,restSpeed:.001}},it=(e={})=>{const t=e.direction??"up",n=e.physics??Fe,s=t==="up";return{prepare:({from:o,to:r})=>(o.then(i=>{i.style.zIndex=s?"-1":"1",i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint",i.style.pointerEvents="none"}),r.then(i=>{i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint"}),{}),animation:({from:o,to:r})=>{const i=o.offsetHeight,l=r.offsetHeight,c=window.innerHeight,a=Math.max(Math.min(i,l),c),p=new h.WebAnimation({element:o,integrator:b.from(n),style:u=>({transform:`translate3d(0, ${s?-a*u:a*u}px, 0)`})}),d=new h.WebAnimation({element:r,integrator:b.from(n),style:(u,y)=>({transform:`translate3d(0, ${s?y*a:y*-a}px, 0)`}),onComplete:()=>{r.style.willChange="auto",r.style.backfaceVisibility="",r.style.contain="",r.style.transform=""}});return new h.MultiAnimation([p,d],{mode:"parallel"})}}};function Ye(e){const{paths:t,type:n="directional"}=e;return n==="non-directional"?C(t,()=>it({direction:"up"})):N(t,{forward:"up",backward:"down"},s=>it({direction:s}))}const Me={spring:{stiffness:200,damping:24}},He={inertia:{acceleration:25,resistance:1.2}},U=.2;function We(){return{enterPhysics:Me,exitPhysics:He,background:{willChange:"transform, opacity",enterStyle:(e,t)=>({transform:`scale(${1-U*e})`,opacity:t}),exitStyle:e=>({transform:`scale(${1-U+U*e})`,opacity:e})}}}const ze={spring:{stiffness:300,damping:30}},Ue={inertia:{acceleration:70,resistance:1.2}};function Xe(){return{enterPhysics:ze,exitPhysics:Ue,background:{willChange:"",enterStyle:()=>({}),exitStyle:()=>({})}}}const Ve={static:Xe(),"background-scale":We()},Be="static",Ne="transform",Ze=(e={})=>{const t=e.direction??"enter",n=Ve[e.type??Be],s=t==="enter"?n.enterPhysics:n.exitPhysics,o=n.background,r=o.willChange!=="";return{prepare:({from:i,to:l})=>{const c=t==="enter"?l:i,a=t==="enter"?i:l;return c.then(p=>{p.style.willChange=Ne,p.style.backfaceVisibility="hidden",p.style.contain="layout paint",t==="exit"&&(p.style.pointerEvents="none",p.style.zIndex="100")}),a.then(p=>{r&&(p.style.willChange=o.willChange,p.style.backfaceVisibility="hidden",p.style.contain="layout paint"),t==="enter"&&(p.style.pointerEvents="none",p.style.zIndex="-1")}),{}},animation:({from:i,to:l,context:c})=>{const a=t==="enter"?l:i,p=t==="enter"?i:l,d=v(c,t==="enter"?"to":"from");a.style.clipPath=`inset(${d.top}px 0 calc(100% - ${d.top+d.height}px) 0)`;const u=t==="enter"?(x,E)=>({transform:`translate3d(0, ${E*d.height}px, 0)`}):x=>({transform:`translate3d(0, ${x*d.height}px, 0)`}),y=new h.WebAnimation({element:a,integrator:b.from(s),style:u,onComplete:()=>{a.style.willChange="auto",a.style.backfaceVisibility="",a.style.contain="",a.style.clipPath="",a.style.transform=""}});if(!r)return new h.MultiAnimation([y],{mode:"parallel"});const f=v(c,t==="enter"?"from":"to"),m=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=`${m}px ${g}px`;const w=t==="enter"?(x,E)=>o.enterStyle(x,E):x=>o.exitStyle(x),S=new h.WebAnimation({element:p,integrator:b.from(s),style:w,onComplete:t==="exit"?()=>{p.style.willChange="auto",p.style.backfaceVisibility="",p.style.contain="",p.style.clipPath="",p.style.transformOrigin=""}:void 0});return new h.MultiAnimation([y,S],{mode:"parallel"})}}};function je(e){return e==="scale"||e==="background-scale"?"background-scale":"static"}function qe(e){const{enter:t,exit:n}=e,s=e.type,o=je(s);return pt({enter:t,exit:n},r=>Ze({direction:r,type:o}))}const Ge={spring:{stiffness:170,damping:22,doubleSpring:.8}},Ke=(e={})=>{const t=e.direction??"left",n=e.physics??Ge,s=t==="left";return{prepare:({from:o,to:r})=>(o.then(i=>{i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint",i.style.pointerEvents="none"}),r.then(i=>{const l=s?100:-100;i.style.transform=`translate3d(${l}%, 0, 0)`,i.style.willChange="transform",i.style.backfaceVisibility="hidden",i.style.contain="layout paint"}),{}),animation:({from:o,to:r})=>{const i=new h.WebAnimation({element:o,integrator:b.from(n),style:c=>({transform:`translate3d(${s?-100*c:100*c}%, 0, 0)`})}),l=new h.WebAnimation({element:r,integrator:b.from(n),style:(c,a)=>({transform:`translate3d(${s?a*100:a*-100}%, 0, 0)`}),onComplete:()=>{r.style.willChange="auto",r.style.backfaceVisibility="",r.style.contain="",r.style.transform=""}});return new h.MultiAnimation([i,l],{mode:"parallel"})}}};function Re(e){const{paths:t}=e;return N(t,{forward:"left",backward:"right"},n=>Ke({direction:n}))}const Je={spring:{stiffness:17,damping:6}},X=20,k=800,Qe=(e={})=>{const t=e.physics??Je;return{prepare:({from:n,to:s})=>(n.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.pointerEvents="none",o.style.transform=`perspective(${k}px) rotateY(0deg) translate3d(0%, 0, 0)`}),s.then(o=>{o.style.willChange="transform",o.style.backfaceVisibility="hidden",o.style.contain="layout paint",o.style.transform=`perspective(${k}px) rotateY(${X}deg) translate3d(-100%, 0, 0)`}),{}),animation:({from:n,to:s})=>{const o=new h.WebAnimation({element:n,integrator:b.from(t),style:i=>{const l=-i*X,c=i*100;return{transform:`perspective(${k}px) rotateY(${l}deg) translate3d(${c}%, 0, 0)`}}}),r=new h.WebAnimation({element:s,integrator:b.from(t),style:(i,l)=>{const c=l*X,a=-l*100;return{transform:`perspective(${k}px) rotateY(${c}deg) translate3d(${a}%, 0, 0)`}},onComplete:()=>{s.style.transform="",s.style.willChange="auto",s.style.backfaceVisibility="",s.style.contain=""}});return new h.MultiAnimation([o,r],{mode:"sequence"})}}};function tn(e){const{paths:t}=e;return C(t,()=>Qe())}function en({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:r}){const i=t.left-e.left+(t.width-e.width)/2-s.x,l=t.top-e.top+(t.height-e.height)/2-s.y,c=t.width/e.width,a=t.height/e.height,p=e.top/n.height*100,d=(n.width-(e.left+e.width))/n.width*100,u=(n.height-(e.top+e.height))/n.height*100,y=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:f=>{const m=1-f,g=1+(c-1)*m,w=1+(a-1)*m,x=(r*m+o*(1-m))/((g+w)/2);return{clipPath:`inset(${p*m}% ${d*m}% ${u*m}% ${y*m}% round ${x}px)`,transform:`translate(${i*m}px, ${l*m}px) scale(${g}, ${w})`}}}}function nn({enterRect:e,exitRect:t,pageRect:n,scrollOffset:s,enterRadius:o,exitRadius:r}){const i=t.left-e.left+(t.width-e.width)/2+s.x,l=t.top-e.top+(t.height-e.height)/2+s.y,c=t.width/e.width,a=t.height/e.height,p=e.top/n.height*100,d=(n.width-(e.left+e.width))/n.width*100,u=(n.height-(e.top+e.height))/n.height*100,y=e.left/n.width*100;return{transformOrigin:`${e.left+e.width/2}px ${e.top+e.height/2}px`,animate:f=>{const m=1-f,g=1+(c-1)*m,w=1+(a-1)*m,x=(o*(1-m)+r*m)/((g+w)/2);return{clipPath:`inset(${p*m}% ${d*m}% ${u*m}% ${y*m}% round ${x}px)`,transform:`translate(${i*m-s.x}px, ${l*m}px) scale(${g}, ${w})`}}}}const sn={spring:{stiffness:200,damping:24}},dt=.12,on=18;function rn(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-dt*t})`}}}}function an(){return{transformOrigin:"50% 50%",animate:e=>{const t=1-e;return{transform:`scale(${1-dt*t})`}}}}const V={willChange:"backdrop-filter",initialStyle:{position:"absolute",inset:"0",pointerEvents:"none",zIndex:"5000",backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)"},style:(e,t)=>{const n=e==="enter"?t:1-t,s=`blur(${on*n}px)`;return{backdropFilter:s,WebkitBackdropFilter:s}}};class ln{constructor(){$(this,"physics",sn)}contribute(t){const{from:n,to:s,resolved:o,physics:r}=t,i=o.mode==="enter",l=i?n:s,c=i?rn():an();return c&&(l.style.transformOrigin=c.transformOrigin),[new h.WebAnimation({element:l,integrator:b.from(r),style:i?(a,p)=>c.animate(p):a=>c.animate(a)})]}}class cn{prepare(t){const n=t.createElement("zoom-overlay");return Object.assign(n.style,V.initialStyle),n.style.willChange=V.willChange,t.context.positionedParent.appendChild(n),{overlay:n}}contribute(t){const n=t.extras.overlay;return n?[new h.WebAnimation({element:n,integrator:b.from(t.physics),style:s=>V.style(t.resolved.mode,s)})]:[]}}const pn={spring:{stiffness:340,damping:30,doubleSpring:1}};function dn({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2+n.x,o=e.top-t.top+(e.height-t.height)/2+n.y,r=e.width/t.width,i=e.height/t.height,l=Math.max(r,i);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:c=>{const a=1-c;return{transform:`translate(${s*a-n.x}px, ${o*a}px) scale(${1+(l-1)*a})`,opacity:`${1-a}`}}}}function fn({enterRect:e,exitRect:t,scrollOffset:n}){const s=e.left-t.left+(e.width-t.width)/2-n.x,o=e.top-t.top+(e.height-t.height)/2-n.y,r=e.width/t.width,i=e.height/t.height,l=Math.max(r,i);return{transformOrigin:`${t.left+t.width/2}px ${t.top+t.height/2}px`,animate:c=>{const a=1-c;return{transform:`translate(${s*a}px, ${o*a}px) scale(${1+(l-1)*a})`,opacity:`${c}`}}}}class mn{constructor(){$(this,"physics",pn)}contribute(t){const{from:n,to:s,resolved:o,input:r,physics:i}=t,l=o.mode==="enter",c=l?n:s,a=l?dn(r):fn(r);return a&&(c.style.transformOrigin=a.transformOrigin),[new h.WebAnimation({element:c,integrator:b.from(i),style:l?(p,d)=>a.animate(d):p=>a.animate(p)})]}}const un={spring:{stiffness:420,damping:34}};class hn{constructor(){$(this,"physics",un)}contribute(t){return[]}}const yn={expand:()=>new mn,static:()=>new hn,blur:()=>new ln};function gn(e){return yn[e]()}const B="data-zoom-enter-key",rt="data-zoom-exit-key",bn="data-zoom-radius";function at(e){const t=e.getAttribute(bn);if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)&&n>0?n:0}function wn(e,t){const n=[];let s=t;for(;s&&s!==e;){const o=s.parentElement;if(!o)break;for(const r of Array.from(o.children))r!==s&&r instanceof HTMLElement&&n.push(r);s=o}return n}function lt(e){const t=e.querySelectorAll(`[${B}]`);return t.length!==1?null:t[0]}function ct(e,t){const n=e.querySelectorAll(`[${rt}]`);for(const s of n)if(s.getAttribute(rt)===t)return s;return null}function Sn(e,t){const n=lt(e),s=lt(t);if(!n&&s){const o=s.getAttribute(B);if(!o)return null;const r=ct(e,o);return r?{mode:"enter",enterEl:s,exitEl:r}:null}if(n&&!s){const o=n.getAttribute(B);if(!o)return null;const r=ct(t,o);return r?{mode:"exit",enterEl:n,exitEl:r}:null}return null}function $n(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,enterRadius:at(e.enterEl),exitRadius:at(e.exitEl)}}class xn{prepare(t){t.from.then(n=>{n.style.willChange="transform, clip-path, opacity",n.style.backfaceVisibility="hidden",n.style.contain="layout paint"})}contribute(t){const{from:n,to:s,resolved:o,input:r,physics:i,onComplete:l}=t,c=o.mode==="enter",a=c?en(r):nn(r),p=c?s:n,d=c?"t":"u";a&&(p.style.transformOrigin=a.transformOrigin);const u=p.style.zIndex;return p.style.zIndex="9999",l(()=>{p.style.willChange="auto",p.style.backfaceVisibility="",p.style.transformOrigin="",p.style.contain="",p.style.zIndex=u}),[new h.WebAnimation({element:p,integrator:b.from(i),style:d==="t"?y=>a.animate(y):(y,f)=>a.animate(f)})]}}class En{contribute(t){const{resolved:n,physics:s,from:o,to:r,onComplete:i}=t,l=n.mode==="enter"?r:o,c=wn(l,n.enterEl);if(c.length===0)return[];const a=c.map(p=>p.style.opacity);if(n.mode==="enter")for(const p of c)p.style.opacity="0";return i(()=>{for(let p=0;p<c.length;p++){const d=c[p];d&&(d.style.opacity=a[p]??"")}}),c.map(p=>new h.WebAnimation({element:p,integrator:b.from(s),style:(d,u)=>({opacity:n.mode==="enter"?d:u})}))}}class ft{contribute(){return[]}}const Cn={default:()=>new ft,fade:()=>new En};function An(e){return Cn[e]()}class Pn extends ft{}function Tn(e){const t=gn(e.type);return{strategies:[new xn,t,An(e.variant),new Pn,...e.type==="blur"?[new cn]:[]],physics:t.physics}}const vn=e=>{const{strategies:t,physics:n}=Tn(e);return{prepare:s=>{const o={from:s.from,to:s.to,context:{positionedParent:s.context.positionedParent},createElement:s.createElement},r={};for(const i of t){if(!i.prepare)continue;const l=i.prepare(o);l&&Object.assign(r,l)}return r},animation:({from:s,to:o,context:r,...i})=>{const l=Sn(s,o);if(!l)return new h.MultiAnimation([],{mode:"parallel"});const c=$n(l,s,o,r.scrollOffset),a=[],d={from:s,to:o,resolved:l,input:c,physics:n,extras:i,onComplete:f=>{a.push(f)}},u=[];for(const f of t)f.contribute&&u.push(...f.contribute(d));const y=u[0];if(y){const f=y.onComplete;y.onComplete=()=>{f==null||f();for(const m of a)try{m()}catch(g){console.error("[zoom] cleanup error",g)}}}return new h.MultiAnimation(u,{mode:"parallel"})}}};function Dn(e){const t=e.type??"static",n=e.variant??(e.fade?"fade":"default");return{type:t,variant:n}}function On(e){const t=Dn(e);return C(e.paths,()=>vn(t))}exports.Animation=h.Animation;exports.MultiAnimation=h.MultiAnimation;exports.WebAnimation=h.WebAnimation;exports.axis=jt;exports.blind=Qt;exports.drill=pe;exports.fade=ue;exports.film=Ee;exports.hero=Te;exports.jaemin=Ie;exports.rotate=Le;exports.scroll=Ye;exports.sheet=qe;exports.slide=Re;exports.strip=tn;exports.zoom=On;
|
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"}
|