@ssgoi/core 6.7.0-beta.1 → 7.0.0-beta.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 +29 -9
- package/dist/animation/animation.d.ts +2 -2
- package/dist/animation/frame-scheduler.d.ts +36 -0
- package/dist/animation/frame-scheduler.d.ts.map +1 -0
- package/dist/animation/multi-animation.d.ts +3 -2
- package/dist/animation/multi-animation.d.ts.map +1 -1
- package/dist/animation/web-animation.d.ts +16 -4
- package/dist/animation/web-animation.d.ts.map +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1282 -1125
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +502 -422
- package/dist/multi-animation-6124HEke.cjs +1 -0
- package/dist/multi-animation-ZFZBDBGr.js +439 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-direction.d.ts +13 -0
- package/dist/ssgoi-transition/navigation-direction.d.ts.map +1 -0
- package/dist/ssgoi-transition/path-pattern.d.ts +15 -0
- package/dist/ssgoi-transition/path-pattern.d.ts.map +1 -0
- package/dist/ssgoi-transition/resolve-transition-rule.d.ts +16 -0
- package/dist/ssgoi-transition/resolve-transition-rule.d.ts.map +1 -0
- package/dist/transitions/axis/index.d.ts +5 -7
- package/dist/transitions/axis/index.d.ts.map +1 -1
- package/dist/transitions/axis/types.d.ts +0 -1
- package/dist/transitions/axis/types.d.ts.map +1 -1
- package/dist/transitions/blind/index.d.ts +2 -3
- package/dist/transitions/blind/index.d.ts.map +1 -1
- package/dist/transitions/drill/index.d.ts +6 -7
- package/dist/transitions/drill/index.d.ts.map +1 -1
- package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -1
- package/dist/transitions/drill/provider/parallax.d.ts.map +1 -1
- package/dist/transitions/drill/transition.d.ts.map +1 -1
- package/dist/transitions/drill/types.d.ts +0 -1
- package/dist/transitions/drill/types.d.ts.map +1 -1
- package/dist/transitions/fade/index.d.ts +3 -5
- package/dist/transitions/fade/index.d.ts.map +1 -1
- package/dist/transitions/film/index.d.ts +3 -5
- package/dist/transitions/film/index.d.ts.map +1 -1
- package/dist/transitions/hero/fit.d.ts +5 -0
- package/dist/transitions/hero/fit.d.ts.map +1 -0
- package/dist/transitions/hero/index.d.ts +3 -5
- package/dist/transitions/hero/index.d.ts.map +1 -1
- package/dist/transitions/hero/transition.d.ts +12 -1
- package/dist/transitions/hero/transition.d.ts.map +1 -1
- package/dist/transitions/hero/types.d.ts +2 -1
- package/dist/transitions/hero/types.d.ts.map +1 -1
- package/dist/transitions/jaemin/index.d.ts +3 -5
- package/dist/transitions/jaemin/index.d.ts.map +1 -1
- package/dist/transitions/media-geometry.d.ts +55 -0
- package/dist/transitions/media-geometry.d.ts.map +1 -0
- package/dist/transitions/rotate/index.d.ts +3 -5
- package/dist/transitions/rotate/index.d.ts.map +1 -1
- package/dist/transitions/scroll/index.d.ts +4 -5
- package/dist/transitions/scroll/index.d.ts.map +1 -1
- package/dist/transitions/scroll/transition.d.ts +1 -1
- package/dist/transitions/scroll/transition.d.ts.map +1 -1
- package/dist/transitions/sheet/index.d.ts +6 -7
- package/dist/transitions/sheet/index.d.ts.map +1 -1
- package/dist/transitions/sheet/provider/static.d.ts.map +1 -1
- package/dist/transitions/sheet/transition.d.ts.map +1 -1
- package/dist/transitions/sheet/types.d.ts +0 -1
- package/dist/transitions/sheet/types.d.ts.map +1 -1
- package/dist/transitions/slide/index.d.ts +3 -5
- package/dist/transitions/slide/index.d.ts.map +1 -1
- package/dist/transitions/slide/transition.d.ts +0 -1
- package/dist/transitions/slide/transition.d.ts.map +1 -1
- package/dist/transitions/strip/index.d.ts +3 -5
- package/dist/transitions/strip/index.d.ts.map +1 -1
- package/dist/transitions/utils.d.ts +3 -21
- package/dist/transitions/utils.d.ts.map +1 -1
- package/dist/transitions/zoom/index.d.ts +3 -4
- package/dist/transitions/zoom/index.d.ts.map +1 -1
- package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
- package/dist/transitions/zoom/transition.d.ts +6 -1
- package/dist/transitions/zoom/transition.d.ts.map +1 -1
- package/dist/transitions/zoom/types.d.ts +5 -0
- package/dist/transitions/zoom/types.d.ts.map +1 -1
- package/dist/transitions/zoom/zoom-element.d.ts +2 -2
- package/dist/transitions/zoom/zoom-element.d.ts.map +1 -1
- package/dist/types/index.d.ts +56 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/wait-paint.d.ts +8 -7
- package/dist/utils/wait-paint.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/multi-animation-1FueEz2Q.js +0 -367
- package/dist/multi-animation-qtH1IKNG.cjs +0 -1
- package/dist/ssgoi-transition/find-matching-transition.d.ts +0 -30
- package/dist/ssgoi-transition/find-matching-transition.d.ts.map +0 -1
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +0 -7
- package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ZoomAnimationConfig, ZoomAnimationInput } from './types';
|
|
2
|
-
export declare function createZoomIn(
|
|
3
|
-
export declare function createZoomOut(
|
|
2
|
+
export declare function createZoomIn(input: ZoomAnimationInput): ZoomAnimationConfig;
|
|
3
|
+
export declare function createZoomOut(input: ZoomAnimationInput): ZoomAnimationConfig;
|
|
4
4
|
//# sourceMappingURL=zoom-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoom-element.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/zoom/zoom-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"zoom-element.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/zoom/zoom-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAiGvE,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAgC3E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAgC5E"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export type ScrollPosition = {
|
|
|
54
54
|
x: number;
|
|
55
55
|
y: number;
|
|
56
56
|
};
|
|
57
|
+
export type NavigationDirection = "forward" | "backward";
|
|
57
58
|
/**
|
|
58
59
|
* Context provided by the dispatcher to a transition.
|
|
59
60
|
*
|
|
@@ -61,6 +62,11 @@ export type ScrollPosition = {
|
|
|
61
62
|
* — `from.scroll` is the outgoing page's scroll, `to.scroll` the incoming page.
|
|
62
63
|
*/
|
|
63
64
|
export type SsgoiTransitionContext = {
|
|
65
|
+
/**
|
|
66
|
+
* Semantic navigation direction resolved from the route rule. Transitions
|
|
67
|
+
* map this to their own visual vocabulary (enter/exit, left/right, up/down).
|
|
68
|
+
*/
|
|
69
|
+
readonly direction: NavigationDirection;
|
|
64
70
|
scrollOffset: ScrollOffset;
|
|
65
71
|
from: {
|
|
66
72
|
scroll: ScrollPosition;
|
|
@@ -126,13 +132,53 @@ export type TransitionConfig<TExtras extends object = object> = {
|
|
|
126
132
|
* extras as opaque here.
|
|
127
133
|
*/
|
|
128
134
|
export type AnyTransitionConfig = TransitionConfig<any>;
|
|
129
|
-
export type
|
|
130
|
-
|
|
131
|
-
to: string;
|
|
135
|
+
export type PathPatterns = string | readonly string[];
|
|
136
|
+
type SsgoiTransitionRuleBase = {
|
|
132
137
|
transition: AnyTransitionConfig;
|
|
133
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Higher values win before path specificity. Defaults to 0.
|
|
140
|
+
* Useful for an exceptional effect declared below a broad fallback.
|
|
141
|
+
*/
|
|
142
|
+
priority?: number;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* A route-family rule. Entering the family is forward, leaving it is
|
|
146
|
+
* backward, and navigation within it uses semantic history/pop detection.
|
|
147
|
+
*/
|
|
148
|
+
export type SsgoiOnTransitionRule = SsgoiTransitionRuleBase & {
|
|
149
|
+
on: PathPatterns;
|
|
150
|
+
except?: PathPatterns;
|
|
151
|
+
from?: never;
|
|
152
|
+
to?: never;
|
|
153
|
+
ordered?: never;
|
|
154
|
+
bidirectional?: never;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* A precise relationship between two route families. The normal from → to
|
|
158
|
+
* orientation is forward; the reverse is backward when bidirectional
|
|
159
|
+
* (the default).
|
|
160
|
+
*/
|
|
161
|
+
export type SsgoiPairTransitionRule = SsgoiTransitionRuleBase & {
|
|
162
|
+
from: PathPatterns;
|
|
163
|
+
to: PathPatterns;
|
|
164
|
+
bidirectional?: boolean;
|
|
165
|
+
on?: never;
|
|
166
|
+
except?: never;
|
|
167
|
+
ordered?: never;
|
|
134
168
|
};
|
|
135
|
-
|
|
169
|
+
/**
|
|
170
|
+
* An ordered set of routes. Both endpoints must match the set; increasing
|
|
171
|
+
* index is forward and decreasing index is backward.
|
|
172
|
+
*/
|
|
173
|
+
export type SsgoiOrderedTransitionRule = SsgoiTransitionRuleBase & {
|
|
174
|
+
ordered: readonly string[];
|
|
175
|
+
on?: never;
|
|
176
|
+
except?: never;
|
|
177
|
+
from?: never;
|
|
178
|
+
to?: never;
|
|
179
|
+
bidirectional?: never;
|
|
180
|
+
};
|
|
181
|
+
export type SsgoiTransitionRule = SsgoiOnTransitionRule | SsgoiPairTransitionRule | SsgoiOrderedTransitionRule;
|
|
136
182
|
export type PreserveScrollValue = boolean | {
|
|
137
183
|
exclude: string[];
|
|
138
184
|
key?: string;
|
|
@@ -155,12 +201,12 @@ export type TransitionsResolverArgs = {
|
|
|
155
201
|
* path-transition list. Lets a config branch on viewport (e.g. drawer on
|
|
156
202
|
* mobile, fade on desktop) without an outer wrapper.
|
|
157
203
|
*/
|
|
158
|
-
export type SsgoiTransitionsFn = (args: TransitionsResolverArgs) => readonly
|
|
204
|
+
export type SsgoiTransitionsFn = (args: TransitionsResolverArgs) => readonly SsgoiTransitionRule[];
|
|
159
205
|
/**
|
|
160
|
-
* `transitions` accepts either
|
|
161
|
-
*
|
|
206
|
+
* `transitions` accepts either a flat rule list or a function of device
|
|
207
|
+
* context. Both normalize to the functional form internally.
|
|
162
208
|
*/
|
|
163
|
-
export type SsgoiTransitionsOption = readonly
|
|
209
|
+
export type SsgoiTransitionsOption = readonly SsgoiTransitionRule[] | SsgoiTransitionsFn;
|
|
164
210
|
export type SsgoiConfig = {
|
|
165
211
|
transitions?: SsgoiTransitionsOption;
|
|
166
212
|
middleware?: (from: string, to: string) => {
|
|
@@ -190,4 +236,5 @@ export type SsgoiContext = {
|
|
|
190
236
|
*/
|
|
191
237
|
refFor: (path: string) => (element: HTMLElement | null) => void;
|
|
192
238
|
};
|
|
239
|
+
export {};
|
|
193
240
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMxD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAM1D,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,0BAA0B,CAAC;IAC7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E,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,IAAI,EAAE,uBAAuB,KAC1B,SAAS,mBAAmB,EAAE,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,SAAS,mBAAmB,EAAE,GAC9B,kBAAkB,CAAC;AAEvB,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,CAAC;AASF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAEvD;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACjE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Waits
|
|
2
|
+
* Waits across two animation frame callbacks.
|
|
3
3
|
*
|
|
4
|
-
* This
|
|
5
|
-
*
|
|
4
|
+
* This gives style changes made before the first callback a rendering
|
|
5
|
+
* opportunity before code resumes in the second callback. Since rAF callbacks
|
|
6
|
+
* run before paint and the web platform has no post-presentation callback, this
|
|
7
|
+
* is a scheduling barrier rather than proof that pixels reached the screen.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* available (e.g., a proposed `element.waitForPaint()` or similar).
|
|
9
|
+
* In the future, this could be replaced with a native presentation API if one
|
|
10
|
+
* becomes available.
|
|
10
11
|
*
|
|
11
12
|
* @param _element - The element to wait for (reserved for future API usage)
|
|
12
|
-
* @returns A promise that resolves
|
|
13
|
+
* @returns A promise that resolves from the second animation frame callback
|
|
13
14
|
*/
|
|
14
15
|
export declare function waitPaint(_element?: Element): Promise<void>;
|
|
15
16
|
//# sourceMappingURL=wait-paint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-paint.d.ts","sourceRoot":"","sources":["../../src/lib/utils/wait-paint.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wait-paint.d.ts","sourceRoot":"","sources":["../../src/lib/utils/wait-paint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -32,18 +32,6 @@
|
|
|
32
32
|
"!dist/**/*.test.*",
|
|
33
33
|
"!dist/**/*.spec.*"
|
|
34
34
|
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"dev": "vite",
|
|
37
|
-
"watch": "vite build --watch",
|
|
38
|
-
"build": "tsc && vite build",
|
|
39
|
-
"preview": "vite preview",
|
|
40
|
-
"prepare": "pnpm run build",
|
|
41
|
-
"lint": "eslint .",
|
|
42
|
-
"test": "vitest",
|
|
43
|
-
"test:ui": "vitest --ui",
|
|
44
|
-
"test:run": "vitest run",
|
|
45
|
-
"test:coverage": "vitest run --coverage"
|
|
46
|
-
},
|
|
47
35
|
"keywords": [
|
|
48
36
|
"page-transition",
|
|
49
37
|
"page-transitions",
|
|
@@ -88,5 +76,16 @@
|
|
|
88
76
|
"vite": "^6.0.7",
|
|
89
77
|
"vite-plugin-dts": "^4.5.0",
|
|
90
78
|
"vitest": "^3.2.4"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"dev": "vite",
|
|
82
|
+
"watch": "vite build --watch",
|
|
83
|
+
"build": "tsc && vite build",
|
|
84
|
+
"preview": "vite preview",
|
|
85
|
+
"lint": "eslint .",
|
|
86
|
+
"test": "vitest",
|
|
87
|
+
"test:ui": "vitest --ui",
|
|
88
|
+
"test:run": "vitest run",
|
|
89
|
+
"test:coverage": "vitest run --coverage"
|
|
91
90
|
}
|
|
92
|
-
}
|
|
91
|
+
}
|
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
var g = Object.defineProperty;
|
|
2
|
-
var y = (n, r, t) => r in n ? g(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
-
var s = (n, r, t) => y(n, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
class m {
|
|
5
|
-
constructor() {
|
|
6
|
-
/** Current playback rate (1 = realtime, 0 = paused, negative = backwards) */
|
|
7
|
-
s(this, "_playbackRate", 1);
|
|
8
|
-
/** Fired every frame with the most recent value. Optional. */
|
|
9
|
-
s(this, "onUpdate");
|
|
10
|
-
/** Fired once when the animation settles. */
|
|
11
|
-
s(this, "onComplete");
|
|
12
|
-
}
|
|
13
|
-
get playbackRate() {
|
|
14
|
-
return this._playbackRate;
|
|
15
|
-
}
|
|
16
|
-
set playbackRate(r) {
|
|
17
|
-
this._playbackRate = r;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const b = 0.01, C = 0.01, v = 0.05;
|
|
21
|
-
function w(n) {
|
|
22
|
-
return new Promise((r) => {
|
|
23
|
-
requestAnimationFrame(() => {
|
|
24
|
-
requestAnimationFrame(() => {
|
|
25
|
-
r();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
const p = 1e3 / 60;
|
|
31
|
-
class k extends m {
|
|
32
|
-
constructor(t) {
|
|
33
|
-
super();
|
|
34
|
-
s(this, "element");
|
|
35
|
-
s(this, "integrator");
|
|
36
|
-
s(this, "styleFn");
|
|
37
|
-
s(this, "lowerBound");
|
|
38
|
-
s(this, "upperBound");
|
|
39
|
-
s(this, "currentValue");
|
|
40
|
-
s(this, "currentVelocity", 0);
|
|
41
|
-
s(this, "frames", []);
|
|
42
|
-
s(this, "waapi", null);
|
|
43
|
-
s(this, "runId", 0);
|
|
44
|
-
s(this, "waitingForStart", !1);
|
|
45
|
-
s(this, "startReady", !1);
|
|
46
|
-
s(this, "pendingFirstFrame");
|
|
47
|
-
s(this, "running", !1);
|
|
48
|
-
s(this, "paused", !1);
|
|
49
|
-
s(this, "settled", !1);
|
|
50
|
-
s(this, "reversing", !1);
|
|
51
|
-
this.element = t.element, this.integrator = t.integrator, this.styleFn = t.style, this.lowerBound = t.lowerBound ?? 0, this.upperBound = t.upperBound ?? 1, this.currentValue = this.lowerBound, this.onUpdate = t.onUpdate, this.onComplete = t.onComplete;
|
|
52
|
-
}
|
|
53
|
-
play() {
|
|
54
|
-
if (this.reversing = !1, this.paused && this.waapi) {
|
|
55
|
-
if (this.paused = !1, this.running = !0, this.waitingForStart) {
|
|
56
|
-
this.startReady && this.playPreparedWaapi(this.waapi);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.waapi.play();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.runToward(this.upperBound);
|
|
63
|
-
}
|
|
64
|
-
reverse() {
|
|
65
|
-
this.reversing = !0, this.runToward(this.lowerBound);
|
|
66
|
-
}
|
|
67
|
-
pause() {
|
|
68
|
-
var t;
|
|
69
|
-
this.running && (this.captureLiveState(), (t = this.waapi) == null || t.pause(), this.running = !1, this.paused = !0);
|
|
70
|
-
}
|
|
71
|
-
complete() {
|
|
72
|
-
var t;
|
|
73
|
-
this.clearWaapi(), this.running = !1, this.paused = !1, this.currentValue = this.upperBound, this.currentVelocity = 0, this.applyStyleAt(this.currentValue), this.settled = !0, (t = this.onComplete) == null || t.call(this);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Drop the WAAPI forwards-fill after the run has settled, letting inline
|
|
77
|
-
* styles govern the resting visual. Call only from `onComplete` (the run is
|
|
78
|
-
* already finished) — otherwise it cancels mid-flight. Unlike `complete()`,
|
|
79
|
-
* it writes no final frame, so a caller can reset the element to its natural
|
|
80
|
-
* state without the lingering fill clobbering it.
|
|
81
|
-
*/
|
|
82
|
-
releaseFill() {
|
|
83
|
-
this.clearWaapi();
|
|
84
|
-
}
|
|
85
|
-
get isAnimating() {
|
|
86
|
-
return this.running;
|
|
87
|
-
}
|
|
88
|
-
get isPaused() {
|
|
89
|
-
return this.paused;
|
|
90
|
-
}
|
|
91
|
-
get isComplete() {
|
|
92
|
-
return this.settled;
|
|
93
|
-
}
|
|
94
|
-
get isReversing() {
|
|
95
|
-
return this.reversing;
|
|
96
|
-
}
|
|
97
|
-
get progress() {
|
|
98
|
-
this.running && this.captureLiveState();
|
|
99
|
-
const t = this.upperBound - this.lowerBound;
|
|
100
|
-
if (t === 0) return 0;
|
|
101
|
-
const e = (this.currentValue - this.lowerBound) / t;
|
|
102
|
-
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
103
|
-
}
|
|
104
|
-
findTimeForProgress(t) {
|
|
105
|
-
if (this.frames.length < 2) return null;
|
|
106
|
-
const e = this.upperBound - this.lowerBound;
|
|
107
|
-
if (e === 0) return 0;
|
|
108
|
-
for (const i of this.frames)
|
|
109
|
-
if ((i.position - this.lowerBound) / e >= t) return i.time;
|
|
110
|
-
return this.frames[this.frames.length - 1].time;
|
|
111
|
-
}
|
|
112
|
-
get playbackRate() {
|
|
113
|
-
return super.playbackRate;
|
|
114
|
-
}
|
|
115
|
-
set playbackRate(t) {
|
|
116
|
-
super.playbackRate = t, this.waapi && (this.waapi.playbackRate = t);
|
|
117
|
-
}
|
|
118
|
-
getPose() {
|
|
119
|
-
return this.running && this.captureLiveState(), [
|
|
120
|
-
{
|
|
121
|
-
element: this.element,
|
|
122
|
-
value: this.currentValue,
|
|
123
|
-
velocity: this.currentVelocity
|
|
124
|
-
}
|
|
125
|
-
];
|
|
126
|
-
}
|
|
127
|
-
getTimeline() {
|
|
128
|
-
const t = this.frames.map((e) => {
|
|
129
|
-
const i = e.position, a = this.lowerBound + this.upperBound - i;
|
|
130
|
-
return {
|
|
131
|
-
time: e.time,
|
|
132
|
-
value: e.position,
|
|
133
|
-
velocity: e.velocity,
|
|
134
|
-
style: this.styleFn(i, a)
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
return [{ element: this.element, frames: t }];
|
|
138
|
-
}
|
|
139
|
-
matchInto(t) {
|
|
140
|
-
const e = t.find((i) => i.element === this.element);
|
|
141
|
-
e && (this.currentValue = e.value, this.currentVelocity = e.velocity);
|
|
142
|
-
}
|
|
143
|
-
/* ───────────────────────────────────────────────────────── private */
|
|
144
|
-
runToward(t) {
|
|
145
|
-
var u;
|
|
146
|
-
if (this.running && this.captureLiveState(), this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.frames = F(
|
|
147
|
-
this.integrator,
|
|
148
|
-
this.currentValue,
|
|
149
|
-
t,
|
|
150
|
-
this.currentVelocity
|
|
151
|
-
), this.frames.length === 0) {
|
|
152
|
-
this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, (u = this.onComplete) == null || u.call(this);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const e = this.frames.map((c) => {
|
|
156
|
-
const d = c.position, f = this.lowerBound + this.upperBound - d;
|
|
157
|
-
return this.styleFn(d, f);
|
|
158
|
-
}), i = e[0], a = this.frames[this.frames.length - 1], l = a.time, o = ++this.runId, h = this.element.animate(e, {
|
|
159
|
-
duration: l,
|
|
160
|
-
fill: "both",
|
|
161
|
-
easing: "linear",
|
|
162
|
-
composite: "replace"
|
|
163
|
-
});
|
|
164
|
-
h.playbackRate = this.playbackRate, h.pause(), h.currentTime = 0, this.waapi = h, this.waitingForStart = !0, this.startReady = !1, this.pendingFirstFrame = i, this.running = !0, h.onfinish = () => {
|
|
165
|
-
var c;
|
|
166
|
-
!this.running || this.waapi !== h || (this.running = !1, this.settled = !0, this.currentValue = a.position, this.currentVelocity = 0, (c = this.onComplete) == null || c.call(this));
|
|
167
|
-
}, this.startWhenReady(h, o);
|
|
168
|
-
}
|
|
169
|
-
clearWaapi() {
|
|
170
|
-
var t;
|
|
171
|
-
this.runId++, (t = this.waapi) == null || t.cancel(), this.waapi = null, this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0;
|
|
172
|
-
}
|
|
173
|
-
captureLiveState() {
|
|
174
|
-
if (this.frames.length === 0) return;
|
|
175
|
-
const t = S(this.waapi);
|
|
176
|
-
if (t === null) return;
|
|
177
|
-
const { position: e, velocity: i } = R(this.frames, t);
|
|
178
|
-
this.currentValue = e, this.currentVelocity = i;
|
|
179
|
-
}
|
|
180
|
-
async startWhenReady(t, e) {
|
|
181
|
-
try {
|
|
182
|
-
await t.ready, typeof requestAnimationFrame < "u" && await w(this.element);
|
|
183
|
-
} catch {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
this.runId !== e || this.waapi !== t || (this.startReady = !0, !(!this.running || this.paused) && this.playPreparedWaapi(t));
|
|
187
|
-
}
|
|
188
|
-
playPreparedWaapi(t) {
|
|
189
|
-
if (!(this.waapi !== t || !this.waitingForStart || !this.startReady)) {
|
|
190
|
-
if (this.pendingFirstFrame)
|
|
191
|
-
for (const e of Object.keys(this.pendingFirstFrame))
|
|
192
|
-
this.element.style[e] = "";
|
|
193
|
-
this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0, t.play();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
applyStyleAt(t) {
|
|
197
|
-
const e = this.lowerBound + this.upperBound - t, i = this.styleFn(t, e);
|
|
198
|
-
for (const [a, l] of Object.entries(i))
|
|
199
|
-
this.element.style[a] = typeof l == "number" ? String(l) : l;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function F(n, r, t, e) {
|
|
203
|
-
if (r === t && e === 0) return [];
|
|
204
|
-
const i = 600;
|
|
205
|
-
let a = { position: r, velocity: e }, l = 0;
|
|
206
|
-
const o = [];
|
|
207
|
-
for (let h = 0; h < i; h++) {
|
|
208
|
-
const u = h * p;
|
|
209
|
-
if (o.push({ time: u, position: a.position, velocity: a.velocity }), a = n.step(a, t, p / 1e3), n.isSettled(a, t)) {
|
|
210
|
-
if (l += p / 1e3, l >= v) {
|
|
211
|
-
o.push({
|
|
212
|
-
time: (h + 1) * p,
|
|
213
|
-
position: t,
|
|
214
|
-
velocity: 0
|
|
215
|
-
});
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
} else
|
|
219
|
-
l = 0;
|
|
220
|
-
}
|
|
221
|
-
return o;
|
|
222
|
-
}
|
|
223
|
-
function R(n, r) {
|
|
224
|
-
if (n.length === 0) return { position: 0, velocity: 0 };
|
|
225
|
-
const t = n[0], e = n[n.length - 1];
|
|
226
|
-
if (r <= 0)
|
|
227
|
-
return { position: t.position, velocity: t.velocity };
|
|
228
|
-
if (r >= e.time)
|
|
229
|
-
return { position: e.position, velocity: e.velocity };
|
|
230
|
-
let i = 0, a = n.length - 1;
|
|
231
|
-
for (; i < a - 1; ) {
|
|
232
|
-
const u = i + a >> 1;
|
|
233
|
-
n[u].time <= r ? i = u : a = u;
|
|
234
|
-
}
|
|
235
|
-
const l = n[i], o = n[a], h = (r - l.time) / (o.time - l.time);
|
|
236
|
-
return {
|
|
237
|
-
position: l.position + (o.position - l.position) * h,
|
|
238
|
-
velocity: l.velocity + (o.velocity - l.velocity) * h
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function S(n) {
|
|
242
|
-
const r = n == null ? void 0 : n.currentTime;
|
|
243
|
-
return typeof r == "number" ? r : null;
|
|
244
|
-
}
|
|
245
|
-
class A extends m {
|
|
246
|
-
constructor(t, e = {}) {
|
|
247
|
-
super();
|
|
248
|
-
s(this, "children");
|
|
249
|
-
s(this, "startAt");
|
|
250
|
-
s(this, "pendingComplete", 0);
|
|
251
|
-
s(this, "running", !1);
|
|
252
|
-
s(this, "pendingStartTimers", []);
|
|
253
|
-
this.children = t, (e.mode ?? "parallel") === "sequence" ? this.startAt = t.map((i, a) => a === 0 ? 0 : 1) : this.startAt = e.startAt ?? [];
|
|
254
|
-
}
|
|
255
|
-
play() {
|
|
256
|
-
this.startRun("play");
|
|
257
|
-
}
|
|
258
|
-
reverse() {
|
|
259
|
-
this.startRun("reverse");
|
|
260
|
-
}
|
|
261
|
-
pause() {
|
|
262
|
-
this.running = !1, this.clearPendingStartTimers();
|
|
263
|
-
for (const t of this.children) t.pause();
|
|
264
|
-
}
|
|
265
|
-
complete() {
|
|
266
|
-
var t;
|
|
267
|
-
this.running = !1, this.clearPendingStartTimers();
|
|
268
|
-
for (const e of this.children) e.complete();
|
|
269
|
-
(t = this.onComplete) == null || t.call(this);
|
|
270
|
-
}
|
|
271
|
-
get progress() {
|
|
272
|
-
if (this.children.length === 0) return 0;
|
|
273
|
-
let t = 0;
|
|
274
|
-
for (const e of this.children) t += e.progress;
|
|
275
|
-
return t / this.children.length;
|
|
276
|
-
}
|
|
277
|
-
getPose() {
|
|
278
|
-
return this.children.flatMap((t) => t.getPose());
|
|
279
|
-
}
|
|
280
|
-
getTimeline() {
|
|
281
|
-
return this.children.flatMap((t) => t.getTimeline());
|
|
282
|
-
}
|
|
283
|
-
matchInto(t) {
|
|
284
|
-
}
|
|
285
|
-
get isAnimating() {
|
|
286
|
-
return this.children.some((t) => t.isAnimating);
|
|
287
|
-
}
|
|
288
|
-
get isPaused() {
|
|
289
|
-
return this.children.some((t) => t.isPaused) && this.children.every((t) => t.isPaused || t.isComplete);
|
|
290
|
-
}
|
|
291
|
-
get isComplete() {
|
|
292
|
-
return this.children.every((t) => t.isComplete);
|
|
293
|
-
}
|
|
294
|
-
get isReversing() {
|
|
295
|
-
return this.children.some((t) => t.isReversing);
|
|
296
|
-
}
|
|
297
|
-
get playbackRate() {
|
|
298
|
-
return super.playbackRate;
|
|
299
|
-
}
|
|
300
|
-
set playbackRate(t) {
|
|
301
|
-
super.playbackRate = t;
|
|
302
|
-
for (const e of this.children) e.playbackRate = t;
|
|
303
|
-
}
|
|
304
|
-
/* ───────────────────────────────────────────────────────── private */
|
|
305
|
-
startRun(t) {
|
|
306
|
-
if (this.running && this.pause(), this.running = !0, this.pendingComplete = this.children.length, this.pendingComplete === 0) {
|
|
307
|
-
this.handleFinished();
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
for (const e of this.children) {
|
|
311
|
-
const i = e.onComplete;
|
|
312
|
-
e.onComplete = () => {
|
|
313
|
-
i == null || i(), this.handleChildComplete();
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
this.scheduleStart(0, t);
|
|
317
|
-
}
|
|
318
|
-
// Chained start: play child `index`, then schedule the next one based on
|
|
319
|
-
// *this* child's freshly computed timeline. Doing this lazily (rather than
|
|
320
|
-
// up-front for the whole chain) is what makes it correct for >2 children —
|
|
321
|
-
// child[i+1]'s trigger ms is only knowable after child[i].play() has run
|
|
322
|
-
// `simulate()`. Single setTimeout per gap, no polling.
|
|
323
|
-
scheduleStart(t, e) {
|
|
324
|
-
if (!this.running || t >= this.children.length) return;
|
|
325
|
-
this.children[t][e]();
|
|
326
|
-
const i = t + 1;
|
|
327
|
-
if (i >= this.children.length) return;
|
|
328
|
-
const a = this.startAt[i];
|
|
329
|
-
if (a === void 0 || a <= 0) {
|
|
330
|
-
this.scheduleStart(i, e);
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
const l = this.children[t].findTimeForProgress(a);
|
|
334
|
-
if (l === null || l <= 0) {
|
|
335
|
-
this.scheduleStart(i, e);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
const o = Math.abs(this.playbackRate) || 1, h = l / o, u = setTimeout(() => {
|
|
339
|
-
this.pendingStartTimers = this.pendingStartTimers.filter(
|
|
340
|
-
(c) => c !== u
|
|
341
|
-
), this.running && this.scheduleStart(i, e);
|
|
342
|
-
}, h);
|
|
343
|
-
this.pendingStartTimers.push(u);
|
|
344
|
-
}
|
|
345
|
-
clearPendingStartTimers() {
|
|
346
|
-
for (const t of this.pendingStartTimers) clearTimeout(t);
|
|
347
|
-
this.pendingStartTimers = [];
|
|
348
|
-
}
|
|
349
|
-
handleChildComplete() {
|
|
350
|
-
this.pendingComplete--, this.pendingComplete <= 0 && this.handleFinished();
|
|
351
|
-
}
|
|
352
|
-
handleFinished() {
|
|
353
|
-
var t;
|
|
354
|
-
this.running = !1, this.clearPendingStartTimers(), (t = this.onComplete) == null || t.call(this);
|
|
355
|
-
}
|
|
356
|
-
findTimeForProgress(t) {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
export {
|
|
361
|
-
m as A,
|
|
362
|
-
A as M,
|
|
363
|
-
b as P,
|
|
364
|
-
v as S,
|
|
365
|
-
C as V,
|
|
366
|
-
k as W
|
|
367
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var S=(n,r,t)=>r in n?y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[r]=t;var s=(n,r,t)=>S(n,typeof r!="symbol"?r+"":r,t);class d{constructor(){s(this,"_playbackRate",1);s(this,"onUpdate");s(this,"onComplete")}get playbackRate(){return this._playbackRate}set playbackRate(r){this._playbackRate=r}}const v=.01,R=.01,f=.05;function T(n){return new Promise(r=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})})}const p=1e3/60;class w extends d{constructor(t){super();s(this,"element");s(this,"integrator");s(this,"styleFn");s(this,"lowerBound");s(this,"upperBound");s(this,"currentValue");s(this,"currentVelocity",0);s(this,"frames",[]);s(this,"waapi",null);s(this,"runId",0);s(this,"waitingForStart",!1);s(this,"startReady",!1);s(this,"pendingFirstFrame");s(this,"running",!1);s(this,"paused",!1);s(this,"settled",!1);s(this,"reversing",!1);this.element=t.element,this.integrator=t.integrator,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete}play(){if(this.reversing=!1,this.paused&&this.waapi){if(this.paused=!1,this.running=!0,this.waitingForStart){this.startReady&&this.playPreparedWaapi(this.waapi);return}this.waapi.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),this.running=!1,this.paused=!0)}complete(){var t;this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,(t=this.onComplete)==null||t.call(this)}releaseFill(){this.clearWaapi()}get isAnimating(){return this.running}get isPaused(){return this.paused}get isComplete(){return this.settled}get isReversing(){return this.reversing}get progress(){this.running&&this.captureLiveState();const t=this.upperBound-this.lowerBound;if(t===0)return 0;const e=(this.currentValue-this.lowerBound)/t;return e<0?0:e>1?1:e}findTimeForProgress(t){if(this.frames.length<2)return null;const e=this.upperBound-this.lowerBound;if(e===0)return 0;for(const i of this.frames)if((i.position-this.lowerBound)/e>=t)return i.time;return this.frames[this.frames.length-1].time}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.waapi&&(this.waapi.playbackRate=t)}getPose(){return this.running&&this.captureLiveState(),[{element:this.element,value:this.currentValue,velocity:this.currentVelocity}]}getTimeline(){const t=this.frames.map(e=>{const i=e.position,a=this.lowerBound+this.upperBound-i;return{time:e.time,value:e.position,velocity:e.velocity,style:this.styleFn(i,a)}});return[{element:this.element,frames:t}]}matchInto(t){const e=t.find(i=>i.element===this.element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity)}runToward(t){var u;if(this.running&&this.captureLiveState(),this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.frames=F(this.integrator,this.currentValue,t,this.currentVelocity),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,(u=this.onComplete)==null||u.call(this);return}const e=this.frames.map(c=>{const m=c.position,g=this.lowerBound+this.upperBound-m;return this.styleFn(m,g)}),i=e[0],a=this.frames[this.frames.length-1],l=a.time,o=++this.runId,h=this.element.animate(e,{duration:l,fill:"both",easing:"linear",composite:"replace"});h.playbackRate=this.playbackRate,h.pause(),h.currentTime=0,this.waapi=h,this.waitingForStart=!0,this.startReady=!1,this.pendingFirstFrame=i,this.running=!0,h.onfinish=()=>{var c;!this.running||this.waapi!==h||(this.running=!1,this.settled=!0,this.currentValue=a.position,this.currentVelocity=0,(c=this.onComplete)==null||c.call(this))},this.startWhenReady(h,o)}clearWaapi(){var t;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null,this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0}captureLiveState(){if(this.frames.length===0)return;const t=A(this.waapi);if(t===null)return;const{position:e,velocity:i}=b(this.frames,t);this.currentValue=e,this.currentVelocity=i}async startWhenReady(t,e){try{await t.ready,typeof requestAnimationFrame<"u"&&await T(this.element)}catch{return}this.runId!==e||this.waapi!==t||(this.startReady=!0,!(!this.running||this.paused)&&this.playPreparedWaapi(t))}playPreparedWaapi(t){if(!(this.waapi!==t||!this.waitingForStart||!this.startReady)){if(this.pendingFirstFrame)for(const e of Object.keys(this.pendingFirstFrame))this.element.style[e]="";this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0,t.play()}}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[a,l]of Object.entries(i))this.element.style[a]=typeof l=="number"?String(l):l}}function F(n,r,t,e){if(r===t&&e===0)return[];const i=600;let a={position:r,velocity:e},l=0;const o=[];for(let h=0;h<i;h++){const u=h*p;if(o.push({time:u,position:a.position,velocity:a.velocity}),a=n.step(a,t,p/1e3),n.isSettled(a,t)){if(l+=p/1e3,l>=f){o.push({time:(h+1)*p,position:t,velocity:0});break}}else l=0}return o}function b(n,r){if(n.length===0)return{position:0,velocity:0};const t=n[0],e=n[n.length-1];if(r<=0)return{position:t.position,velocity:t.velocity};if(r>=e.time)return{position:e.position,velocity:e.velocity};let i=0,a=n.length-1;for(;i<a-1;){const u=i+a>>1;n[u].time<=r?i=u:a=u}const l=n[i],o=n[a],h=(r-l.time)/(o.time-l.time);return{position:l.position+(o.position-l.position)*h,velocity:l.velocity+(o.velocity-l.velocity)*h}}function A(n){const r=n==null?void 0:n.currentTime;return typeof r=="number"?r:null}class C extends d{constructor(t,e={}){super();s(this,"children");s(this,"startAt");s(this,"pendingComplete",0);s(this,"running",!1);s(this,"pendingStartTimers",[]);this.children=t,(e.mode??"parallel")==="sequence"?this.startAt=t.map((i,a)=>a===0?0:1):this.startAt=e.startAt??[]}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.running=!1,this.clearPendingStartTimers();for(const t of this.children)t.pause()}complete(){var t;this.running=!1,this.clearPendingStartTimers();for(const e of this.children)e.complete();(t=this.onComplete)==null||t.call(this)}get progress(){if(this.children.length===0)return 0;let t=0;for(const e of this.children)t+=e.progress;return t/this.children.length}getPose(){return this.children.flatMap(t=>t.getPose())}getTimeline(){return this.children.flatMap(t=>t.getTimeline())}matchInto(t){}get isAnimating(){return this.children.some(t=>t.isAnimating)}get isPaused(){return this.children.some(t=>t.isPaused)&&this.children.every(t=>t.isPaused||t.isComplete)}get isComplete(){return this.children.every(t=>t.isComplete)}get isReversing(){return this.children.some(t=>t.isReversing)}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t;for(const e of this.children)e.playbackRate=t}startRun(t){if(this.running&&this.pause(),this.running=!0,this.pendingComplete=this.children.length,this.pendingComplete===0){this.handleFinished();return}for(const e of this.children){const i=e.onComplete;e.onComplete=()=>{i==null||i(),this.handleChildComplete()}}this.scheduleStart(0,t)}scheduleStart(t,e){if(!this.running||t>=this.children.length)return;this.children[t][e]();const i=t+1;if(i>=this.children.length)return;const a=this.startAt[i];if(a===void 0||a<=0){this.scheduleStart(i,e);return}const l=this.children[t].findTimeForProgress(a);if(l===null||l<=0){this.scheduleStart(i,e);return}const o=Math.abs(this.playbackRate)||1,h=l/o,u=setTimeout(()=>{this.pendingStartTimers=this.pendingStartTimers.filter(c=>c!==u),this.running&&this.scheduleStart(i,e)},h);this.pendingStartTimers.push(u)}clearPendingStartTimers(){for(const t of this.pendingStartTimers)clearTimeout(t);this.pendingStartTimers=[]}handleChildComplete(){this.pendingComplete--,this.pendingComplete<=0&&this.handleFinished()}handleFinished(){var t;this.running=!1,this.clearPendingStartTimers(),(t=this.onComplete)==null||t.call(this)}findTimeForProgress(t){return null}}exports.Animation=d;exports.MultiAnimation=C;exports.POSITION_THRESHOLD=v;exports.SETTLE_THRESHOLD=f;exports.VELOCITY_THRESHOLD=R;exports.WebAnimation=w;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TransitionConfig } from '../types/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Matches a path against a pattern
|
|
4
|
-
* Supports exact matches, wildcard patterns, and common route segment params
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* matchPath('/products', '/products') // true
|
|
8
|
-
* matchPath('/products/123', '/products/*') // true
|
|
9
|
-
* matchPath('/products', '/products/**') // true
|
|
10
|
-
* matchPath('/products/123/reviews', '/products/**') // true
|
|
11
|
-
* matchPath('/products/123', '/products/:id') // true
|
|
12
|
-
* matchPath('/products/123', '/products/[id]') // true
|
|
13
|
-
* matchPath('/products/123', '/products/{id}') // true
|
|
14
|
-
* matchPath('/products/123', '/products') // false
|
|
15
|
-
* matchPath('/anything', '*') // true
|
|
16
|
-
*/
|
|
17
|
-
export declare function matchPath(path: string, pattern: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Finds a matching transition configuration for the given from and to paths
|
|
20
|
-
*
|
|
21
|
-
* Chooses the most specific matching config. Exact paths outrank wildcard
|
|
22
|
-
* paths, deeper static wildcard prefixes outrank broader fallbacks, and equal
|
|
23
|
-
* specificity preserves the original config order.
|
|
24
|
-
*/
|
|
25
|
-
export declare function findMatchingTransition(from: string, to: string, transitions: Array<{
|
|
26
|
-
from: string;
|
|
27
|
-
to: string;
|
|
28
|
-
transition: TransitionConfig;
|
|
29
|
-
}>): TransitionConfig | null;
|
|
30
|
-
//# sourceMappingURL=find-matching-transition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-matching-transition.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/find-matching-transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AA6H/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC,GACD,gBAAgB,GAAG,IAAI,CAsBzB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SsgoiPathTransition } from '../types/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Processes symmetric transitions to create bidirectional navigation
|
|
4
|
-
* For each symmetric transition, creates a reverse transition automatically
|
|
5
|
-
*/
|
|
6
|
-
export declare function processSymmetricTransitions(transitions: readonly SsgoiPathTransition[]): Omit<SsgoiPathTransition, "symmetric">[];
|
|
7
|
-
//# sourceMappingURL=process-symmetric-transitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process-symmetric-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/process-symmetric-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAElD;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,SAAS,mBAAmB,EAAE,GAC1C,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAAE,CAU1C"}
|