@mkbabb/keyframes.js 4.2.0 → 4.4.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 +151 -1
- package/dist/animate-CuUJt2Tb.js +26 -0
- package/dist/{animations-WlZvjmDT.js → animations-5nf2kBkv.js} +3 -3
- package/dist/compile-DgNRG6Lo.js +251 -0
- package/dist/decay-BvNmFk51.js +25 -0
- package/dist/{draw-svg-Dm9f0vTl.js → draw-svg-DYRDxBlL.js} +1 -1
- package/dist/engine-CNHvTgpw.js +1122 -0
- package/dist/errors-W8zkvPw4.js +21 -0
- package/dist/format-BUgCTjmr.js +123 -0
- package/dist/ingest-CNM5xkQT.js +160 -0
- package/dist/keyframes.d.ts +2417 -666
- package/dist/keyframes.js +226 -244
- package/dist/morph-svg-DRjl9Hfz.js +62 -0
- package/dist/{motion-path-DQ73oD2j.js → motion-path-J-RSNmRQ.js} +1 -1
- package/dist/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/scheduler-7eIr_q1g.js +14 -0
- package/dist/scroll-grammar-B4kPvGh5.js +23 -0
- package/dist/scroll-scene-CXEgM49Q.js +176 -0
- package/dist/sequence-CF5hazqz.js +198 -0
- package/dist/springTimingFunction-CDHZ00JQ.js +63 -0
- package/dist/timeline-B7SV3T_E.js +442 -0
- package/dist/utils-D7nuAND5.js +97 -0
- package/dist/validate-8r6Yo-uc.js +35 -0
- package/dist/waapi-D9MHMm_9.js +179 -0
- package/package.json +49 -8
- package/dist/animate-WjeAtXAe.js +0 -21
- package/dist/engine-Gk4Q7ltr.js +0 -1083
- package/dist/springTimingFunction-DMb11kBe.js +0 -178
- package/dist/timeline-CPT7qUV1.js +0 -282
package/dist/keyframes.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { AnimationRangeValue } from '@mkbabb/value.js';
|
|
2
|
+
import { AnimationTimelineValue } from '@mkbabb/value.js';
|
|
1
3
|
import { ColorSpace } from '@mkbabb/value.js';
|
|
4
|
+
import { CSSTimelineOptions } from '@mkbabb/value.js';
|
|
5
|
+
import { CustomFunctionDescriptor } from '@mkbabb/value.js';
|
|
2
6
|
import { extractAnimationOptions } from '@mkbabb/value.js';
|
|
3
7
|
import { HueInterpolationMethod } from '@mkbabb/value.js';
|
|
4
8
|
import { InterpolatedVar } from '@mkbabb/value.js';
|
|
9
|
+
import { ParseDiagnostic } from '@mkbabb/value.js';
|
|
5
10
|
import { PropertyDescriptor as PropertyDescriptor_2 } from '@mkbabb/value.js';
|
|
11
|
+
import { RangeBoundary } from '@mkbabb/value.js';
|
|
12
|
+
import { RangePhase } from '@mkbabb/value.js';
|
|
6
13
|
import { Stylesheet } from '@mkbabb/value.js';
|
|
7
14
|
import { timingFunctions } from '@mkbabb/value.js';
|
|
8
15
|
import { ValueArray } from '@mkbabb/value.js';
|
|
@@ -10,6 +17,69 @@ import { ValueUnit } from '@mkbabb/value.js';
|
|
|
10
17
|
|
|
11
18
|
declare const accordionExpand: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
12
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The outcome of an {@link adoptRunning} takeover. `animation` is the kf object
|
|
22
|
+
* now driving the element (seeded at the captured playhead, already playing);
|
|
23
|
+
* `currentTime` is the playhead (ms) the takeover seeded from; `diagnostics`
|
|
24
|
+
* carries any honest refusal (no running animation by that name → a row, never
|
|
25
|
+
* a silent no-op).
|
|
26
|
+
*/
|
|
27
|
+
export declare interface AdoptResult<V extends Vars = any> {
|
|
28
|
+
/** The kf animation now driving the element (null on a refused adopt). */
|
|
29
|
+
animation: CSSKeyframesAnimation<V> | null;
|
|
30
|
+
/** The captured native `currentTime` (ms) the kf playhead seeded from. */
|
|
31
|
+
currentTime: number;
|
|
32
|
+
/** Honest refusal rows (e.g. no running animation by that name). */
|
|
33
|
+
diagnostics: Diagnostic[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* K2 — `adoptRunning`: the mid-flight TEMPORAL takeover. Given a live element
|
|
38
|
+
* with a running CSS animation, seamlessly hand control to the kf engine:
|
|
39
|
+
*
|
|
40
|
+
* 1. `el.getAnimations()` → find the running `CSSAnimation` matching
|
|
41
|
+
* `{ animationName }`; read its `currentTime` + `playState`.
|
|
42
|
+
* 2. Reconstruct the kf `CSSKeyframesAnimation` from the CSSOM `@keyframes`
|
|
43
|
+
* RULE (via {@link resolveLiveKeyframes} — the AUTHORED form, preserving
|
|
44
|
+
* `var()`/`cqw`/oklab), NOT from `getAnimations().getKeyframes()` (which has
|
|
45
|
+
* px-resolved `var()`/`cqw` and RGB-baked oklab — the very axes kf preserves).
|
|
46
|
+
* 3. Seed the kf animation at the captured `currentTime` (the continuity seed
|
|
47
|
+
* — NOT seed-at-zero, which flashes the element to its 0% state).
|
|
48
|
+
* 4. Commit the current frame inline (the commit-on-ADOPT), then `cancel()`
|
|
49
|
+
* the native animation, so there is no leaked-precedence flash (the inverse
|
|
50
|
+
* of `playWAAPI`'s commit-on-finish discipline — `waapi.ts`).
|
|
51
|
+
* 5. Hand control to the kf engine (the kf animation plays from `currentTime`).
|
|
52
|
+
*
|
|
53
|
+
* NAMED `adoptRunning` to disambiguate from `engine.ts`'s `adoptCompiled`
|
|
54
|
+
* (compiled-state internal adopt — untouched; HARDENING-5 HAZARD-1).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const { adoptRunning } = await loadAnimationEngine();
|
|
58
|
+
* // el is mid-flight on `.spin { animation: spin 2s linear infinite }`
|
|
59
|
+
* const { animation } = await adoptRunning(el, { animationName: "spin" });
|
|
60
|
+
* // the kf object now drives `el` from the exact playhead — no visible seam.
|
|
61
|
+
* animation?.pause(); // ...now scrub / spring-ify / re-color it.
|
|
62
|
+
*/
|
|
63
|
+
declare const adoptRunning: <V extends Vars = any>(el: Element, options: AdoptRunningOptions) => Promise<AdoptResult<V>>;
|
|
64
|
+
|
|
65
|
+
/** Options for {@link adoptRunning}. */
|
|
66
|
+
export declare interface AdoptRunningOptions extends IngestOptions {
|
|
67
|
+
/**
|
|
68
|
+
* The running CSS animation's name to adopt. REQUIRED — an element may host
|
|
69
|
+
* several CSS animations, and the takeover must name exactly one (the
|
|
70
|
+
* `@keyframes` rule to reconstruct + the `getAnimations()` entry to read the
|
|
71
|
+
* playhead from).
|
|
72
|
+
*/
|
|
73
|
+
animationName: string;
|
|
74
|
+
/**
|
|
75
|
+
* Commit the native animation's current computed frame inline before
|
|
76
|
+
* cancelling it (the commit-on-ADOPT, the inverse of `playWAAPI`'s
|
|
77
|
+
* commit-on-finish), so there is no flash between the native paint and the
|
|
78
|
+
* kf paint. Default true; set false only when the caller commits itself.
|
|
79
|
+
*/
|
|
80
|
+
commit?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
13
83
|
/**
|
|
14
84
|
* Construct, target, and play an animation in one call. Returns the
|
|
15
85
|
* `CSSKeyframesAnimation` as the control handle — `await animate(...)` is NOT
|
|
@@ -32,10 +102,10 @@ declare const accordionExpand: (options?: InputAnimationOptions) => CSSKeyframes
|
|
|
32
102
|
* // MotionPath spec → fromMotionPath (F.W12 §S2)
|
|
33
103
|
* animate(box, { path: "path('M 0 0 Q 100 -100 200 0')", rotate: "auto" }, { duration: 2000 });
|
|
34
104
|
*/
|
|
35
|
-
declare function animate<V extends Vars = any>(target: HTMLElement | HTMLElement[], input: AnimateInput<V>, options?: AnimateOptions): CSSKeyframesAnimation<V>;
|
|
105
|
+
declare function animate<V extends Vars = any>(target: HTMLElement | HTMLElement[], input: AnimateInput<V>, options?: AnimateOptions): CSSKeyframesAnimation<V> | AnimationGroup<V> | Sequence<V>;
|
|
36
106
|
|
|
37
107
|
/**
|
|
38
|
-
* The declarative input to {@link animate} — one of the
|
|
108
|
+
* The declarative input to {@link animate} — one of the six dispatch shapes:
|
|
39
109
|
*
|
|
40
110
|
* • `string` — a CSS `@keyframes` (or bare keyframe-block) source.
|
|
41
111
|
* • `KeyframeMap` — `{ "0%": {...}, "100%": {...} }` or the `Map` form.
|
|
@@ -43,8 +113,12 @@ declare function animate<V extends Vars = any>(target: HTMLElement | HTMLElement
|
|
|
43
113
|
* pair, or more stops), distributed evenly 0→100%.
|
|
44
114
|
* • `MotionPathInput` — `{ path, from?, to?, rotate? }` — an `offset-distance`
|
|
45
115
|
* sweep over an author `offset-path` (F.W12 §S2).
|
|
116
|
+
* • `AnimationGroup` — the SPATIAL per-frame blender (L.W8 §S3) — routed to
|
|
117
|
+
* its own `.play()`, NOT wrapped in a new animation.
|
|
118
|
+
* • `Sequence` — the TEMPORAL master-playhead orchestrator (L.W8 §S3)
|
|
119
|
+
* — routed to its own `.play()`.
|
|
46
120
|
*/
|
|
47
|
-
export declare type AnimateInput<V extends Vars> = string | KeyframeMap<V> | V[] | MotionPathInput
|
|
121
|
+
export declare type AnimateInput<V extends Vars> = string | KeyframeMap<V> | V[] | MotionPathInput | AnimationGroup<V> | Sequence<V>;
|
|
48
122
|
|
|
49
123
|
/**
|
|
50
124
|
* Options accepted by {@link animate}. The animation-options surface, plus an
|
|
@@ -62,669 +136,508 @@ export declare interface AnimateOptions extends Partial<InputAnimationOptions> {
|
|
|
62
136
|
autoPlay?: boolean;
|
|
63
137
|
}
|
|
64
138
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
139
|
+
/**
|
|
140
|
+
* The value.js-bearing engine surface, resolved through `loadAnimationEngine()`.
|
|
141
|
+
*
|
|
142
|
+
* Spelled as an explicit interface (rather than `typeof import("./engine")`)
|
|
143
|
+
* because the dts roll-up — API Extractor — cannot resolve a `typeof import()`
|
|
144
|
+
* type node that points at an internal module. The shape stays in lockstep
|
|
145
|
+
* with `./engine`'s runtime exports.
|
|
146
|
+
*/
|
|
147
|
+
export declare interface AnimationEngine {
|
|
71
148
|
/**
|
|
72
|
-
* The
|
|
73
|
-
* `Animation`
|
|
74
|
-
*
|
|
75
|
-
* Assigned in the constructor once `options` exists (the compiler holds a
|
|
76
|
-
* live reference to that options object).
|
|
77
|
-
*
|
|
78
|
-
* READ-ONLY surface (G.W19): the backing `_compiler` is written ONLY by the
|
|
79
|
-
* constructor and {@link adoptCompiled}. An external `animation.compiler = …`
|
|
80
|
-
* write was the one cross-boundary reach-in vector that could desync the
|
|
81
|
-
* live-options reference (`this.options !== this.compiler.options`); making
|
|
82
|
-
* `compiler` a get-only accessor makes that reach-in a COMPILE error, not a
|
|
83
|
-
* convention. Adopt a compiled state via `adoptCompiled(source)`.
|
|
149
|
+
* The core engine constructor (PKG-3, L.W8 §S4) — renamed from `Animation`
|
|
150
|
+
* to clear the `globalThis.Animation` d.ts collision. `Animation` below is
|
|
151
|
+
* the @deprecated backward-compat alias (same runtime constructor).
|
|
84
152
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
153
|
+
KeyframesAnimation: typeof KeyframesAnimation;
|
|
154
|
+
/** @deprecated Use {@link KeyframesAnimation}. Backward-compat alias (PKG-3). */
|
|
155
|
+
Animation: typeof KeyframesAnimation;
|
|
156
|
+
CSSKeyframesAnimation: typeof CSSKeyframesAnimation;
|
|
157
|
+
AnimationGroup: typeof AnimationGroup;
|
|
158
|
+
getAnimationId: (animation: KeyframesAnimation | string) => string;
|
|
159
|
+
getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
|
|
160
|
+
resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
|
|
161
|
+
/** The single-call front door — dispatch + auto-target + auto-play. */
|
|
162
|
+
animate: typeof animate;
|
|
163
|
+
/** CSS-native MotionPath (F.W12) — offset-distance over an author offset-path. */
|
|
164
|
+
MotionPath: typeof MotionPath;
|
|
165
|
+
fromMotionPath: typeof fromMotionPath;
|
|
166
|
+
/** CSS-native DrawSVG (G.W13) — stroke-dashoffset sweep over the path length. */
|
|
167
|
+
DrawSVG: typeof DrawSVG;
|
|
168
|
+
fromDrawSVG: typeof fromDrawSVG;
|
|
87
169
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
170
|
+
* MorphSVG (O.W6, the DM-3 7-tranche chronic terminal) — SVG path-shape
|
|
171
|
+
* morphing over value.js's `PathGeometry`. Samples two `d` strings at
|
|
172
|
+
* `samples` uniform arc-length steps, pairs the points, and interpolates the
|
|
173
|
+
* `(x, y)` pairs across `t`; `MorphSVG.sampleD(t)` reads the morphed `d`.
|
|
91
174
|
*/
|
|
92
|
-
|
|
175
|
+
MorphSVG: typeof MorphSVG;
|
|
176
|
+
fromMorphSVG: typeof fromMorphSVG;
|
|
93
177
|
/**
|
|
94
|
-
* The
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* promise never hangs. Empty on the rAF path.
|
|
178
|
+
* The preset library (`fadeIn`, `bounce`, `shake`, …) — heavy (each returns
|
|
179
|
+
* a `CSSKeyframesAnimation`), so it rides the dynamic boundary as a namespace
|
|
180
|
+
* instead of the light static barrel: `const { presets } = await
|
|
181
|
+
* loadAnimationEngine(); presets.fadeIn({ duration: 500 })` (F.W11).
|
|
99
182
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
183
|
+
presets: typeof AnimationPresets;
|
|
184
|
+
DIRECTIONS: readonly AnimationOptions["direction"][];
|
|
185
|
+
FILL_MODES: readonly AnimationOptions["fillMode"][];
|
|
186
|
+
defaultOptions: AnimationOptions;
|
|
187
|
+
defaultLayerConfig: AnimationLayerConfig;
|
|
188
|
+
/**
|
|
189
|
+
* K.W8 INGEST (FLAGGED ADDITIVE) — the round-trip pointed FORWARD at the
|
|
190
|
+
* live web. `fromStyleSheets`/`fromLiveAnimations`/`resolveLiveKeyframes`
|
|
191
|
+
* walk the CSSOM into kf `CSSKeyframesAnimation` objects (per-sheet CORS
|
|
192
|
+
* `try/catch` → a `CORS_SKIP` diagnostic, never a silent drop); `adoptRunning`
|
|
193
|
+
* takes over a RUNNING CSS animation mid-flight via `getAnimations()`
|
|
194
|
+
* currentTime handoff (the continuity seed, NOT seed-at-zero). HEAVY (the
|
|
195
|
+
* ingest needs the value.js parser) — reached only here, never the LIGHT
|
|
196
|
+
* barrel. Named `adoptRunning` to disambiguate from `engine.adoptCompiled`.
|
|
197
|
+
*/
|
|
198
|
+
fromStyleSheets: typeof fromStyleSheets;
|
|
199
|
+
fromLiveAnimations: typeof fromLiveAnimations;
|
|
200
|
+
resolveLiveKeyframes: typeof resolveLiveKeyframes;
|
|
201
|
+
adoptRunning: typeof adoptRunning;
|
|
202
|
+
/**
|
|
203
|
+
* K.W9 SCROLL-AS-CSS (FLAGGED ADDITIVE) — the scroll-grammar round-trip
|
|
204
|
+
* (`parseScrollCSS` / `serializeScrollOptions` / `roundTripScrollCSS`,
|
|
205
|
+
* consuming value.js 0.13.0's typed `CSSTimelineOptions` extractor +
|
|
206
|
+
* inverse serializer), the `ScrollScene` JS driver (`createScrollScene`),
|
|
207
|
+
* the conservative-correct backend dispatch (`dispatchScrollBackend`), and
|
|
208
|
+
* the `position:sticky` pin synthesis (`pinCSS`). HEAVY (static value.js
|
|
209
|
+
* edge) — reached only here, never the LIGHT barrel.
|
|
210
|
+
*/
|
|
211
|
+
ScrollScene: typeof ScrollScene;
|
|
212
|
+
createScrollScene: typeof createScrollScene;
|
|
213
|
+
parseScrollCSS: typeof parseScrollCSS;
|
|
214
|
+
parseScrollTimeline: typeof parseScrollTimeline;
|
|
215
|
+
parseScrollRange: typeof parseScrollRange;
|
|
216
|
+
serializeScrollOptions: typeof serializeScrollOptions;
|
|
217
|
+
roundTripScrollCSS: typeof roundTripScrollCSS;
|
|
218
|
+
dispatchScrollBackend: typeof dispatchScrollBackend;
|
|
219
|
+
resolveRange: typeof resolveRange;
|
|
220
|
+
pinCSS: typeof pinCSS;
|
|
221
|
+
/**
|
|
222
|
+
* K.W10 COMPILE (FLAGGED ADDITIVE) — the round-trip's BACKWARD half:
|
|
223
|
+
* `compileToCSS(group | sequence | childList)` → a ZERO-RUNTIME CSS artifact
|
|
224
|
+
* (`@keyframes` + `animation-*` longhands + `animation-composition` layering
|
|
225
|
+
* + `linear()` springs + materialized stagger delays + perceptual `oklab()`
|
|
226
|
+
* densify) PLUS the CC-3 ineligibility report (the four named refusals —
|
|
227
|
+
* `weighted` blend / custom renderers / perceptual oklab beyond densify /
|
|
228
|
+
* computed-unit drift). The compiler is the parser run BACKWARD over the SAME
|
|
229
|
+
* data model (`format.ts` is `keyframes.ts` run backward); a human pastes the
|
|
230
|
+
* result and ships with ZERO kf bytes on the page. HEAVY (value.js-bearing) —
|
|
231
|
+
* reached only here, never the LIGHT barrel.
|
|
232
|
+
*/
|
|
233
|
+
compileToCSS: typeof compileToCSS;
|
|
234
|
+
/**
|
|
235
|
+
* L.W6 AGENT-AUTHORING VERB (FLAGGED ADDITIVE) — the round-trip's FORWARD
|
|
236
|
+
* half: the VALIDATION layer over the compile surface, the first question an
|
|
237
|
+
* LLM agent asks before it suggests kf ("will this `@keyframes` block ship
|
|
238
|
+
* faithfully?"). `validate(css, opts?)` is a READ-ONLY projection over three
|
|
239
|
+
* already-typed channels (the adapter `diagnostics`, the compile
|
|
240
|
+
* `{ eligible, refusals }`, the WAAPI `eligibility`) onto ONE agent-shaped
|
|
241
|
+
* `ValidateResult` envelope an LLM branches on WITHOUT scraping a message;
|
|
242
|
+
* `explain(css, opts?)` formats the SAME verdict deterministic human/LLM-
|
|
243
|
+
* readable. NO new engine code — a pure JOIN over the channels L.W1/L.W2 made
|
|
244
|
+
* honest. HEAVY (validate.ts imports the engine + compile + waapi) — reached
|
|
245
|
+
* only here, never the LIGHT barrel.
|
|
246
|
+
*/
|
|
247
|
+
validate: typeof validate;
|
|
248
|
+
explain: typeof explain;
|
|
249
|
+
/**
|
|
250
|
+
* L.W8 S1 ED-3 DOGFOOD INVERSION (FLAGGED ADDITIVE) — the heavy
|
|
251
|
+
* serialization/painting/scheduler helpers over a parsed `Animation`.
|
|
252
|
+
* `CSSKeyframesToString`/`CSSKeyframesToStrings` re-serialize the parsed
|
|
253
|
+
* keyframes back to CSS (the FORWARD half of `fromString`, value.js-bearing);
|
|
254
|
+
* `formatCSSKeyframeString` trims one keyframe body for display;
|
|
255
|
+
* `transformTargetsStyle` paints a `Vars` snapshot onto DOM targets (the
|
|
256
|
+
* same painter the run loop drives); `yieldToMain` is the engine's ONE
|
|
257
|
+
* INP-relief yield ladder. HEAVY (they ride the engine chunk) — reached only
|
|
258
|
+
* here, never the LIGHT barrel.
|
|
259
|
+
*/
|
|
260
|
+
CSSKeyframesToString: typeof CSSKeyframesToString;
|
|
261
|
+
CSSKeyframesToStrings: typeof CSSKeyframesToStrings;
|
|
262
|
+
formatCSSKeyframeString: typeof formatCSSKeyframeString;
|
|
263
|
+
transformTargetsStyle: typeof transformTargetsStyle;
|
|
264
|
+
yieldToMain: typeof yieldToMain;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export declare interface AnimationFrame<V extends Vars> {
|
|
268
|
+
id: number;
|
|
269
|
+
start: ValueUnit;
|
|
270
|
+
ixs: {
|
|
271
|
+
start: number;
|
|
272
|
+
stop: number;
|
|
273
|
+
};
|
|
274
|
+
time: {
|
|
275
|
+
start: number;
|
|
276
|
+
stop: number;
|
|
277
|
+
};
|
|
278
|
+
flatVars: V;
|
|
279
|
+
vars: V;
|
|
280
|
+
interpVars: {
|
|
281
|
+
[arg: string]: Array<InterpolatedVar<V>>;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Pre-flattened array of all interpolation variables across all properties.
|
|
285
|
+
* Built once during parse() to avoid Object.values().flat() allocation
|
|
286
|
+
* on every interpFrames() call in the hot path.
|
|
287
|
+
*/
|
|
288
|
+
allInterpVars: Array<InterpolatedVar<V>>;
|
|
289
|
+
transform: TransformFunction<V>;
|
|
290
|
+
timingFunction: Easing;
|
|
291
|
+
/**
|
|
292
|
+
* The compiled per-segment `animation-composition` operator (K.W7). A
|
|
293
|
+
* segment runs from a START stop to a STOP stop; the operator is the STOP
|
|
294
|
+
* stop's declared composition (CSS attaches `animation-composition` to the
|
|
295
|
+
* keyframe being composited TOWARD). `replace` (or omission) is the legacy
|
|
296
|
+
* behaviour — the apply writes the lerped value verbatim. `add` accumulates
|
|
297
|
+
* the lerped numeric leaf onto the captured underlying base (un-clamped,
|
|
298
|
+
* element-wise — the same leaf `group.ts`'s `add` layer runs); `accumulate`
|
|
299
|
+
* is repeat-aware (iteration N stacks onto N−1's end). A non-numeric leaf
|
|
300
|
+
* (color, `<custom-ident>`) `replace`-falls-back AND emits a
|
|
301
|
+
* `COMPOSITION_FALLBACK` diagnostic — never a silent wrong pixel.
|
|
302
|
+
*/
|
|
303
|
+
composition?: CompositeOperator;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export declare class AnimationGroup<V extends Vars> {
|
|
307
|
+
animations: AnimationGroupObject<V>;
|
|
308
|
+
/**
|
|
309
|
+
* The group's composite transform. Defaults to a real no-op at the FIELD
|
|
310
|
+
* (I.W0 S3) — NOT a lying definite-assignment assertion: a childless or
|
|
311
|
+
* pre-`parse()` group composites nothing via a harmless no-op instead of
|
|
312
|
+
* throwing `this.transform is not a function`. The constructor overrides it
|
|
313
|
+
* with the first child's transform when one exists.
|
|
314
|
+
*/
|
|
315
|
+
transform: TransformFunction<V>;
|
|
316
|
+
superKey: string | undefined;
|
|
317
|
+
paused: boolean;
|
|
105
318
|
started: boolean;
|
|
106
319
|
done: boolean;
|
|
107
|
-
reversed: boolean;
|
|
108
|
-
paused: boolean;
|
|
109
320
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* the
|
|
113
|
-
* throw when this is true rather than racing the group.
|
|
321
|
+
* When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
|
|
322
|
+
* every child to its final frame in a single composite instead of running
|
|
323
|
+
* the rAF draw loop. SSR-safe off-DOM. Default false.
|
|
114
324
|
*/
|
|
115
|
-
|
|
325
|
+
respectReducedMotion: boolean;
|
|
116
326
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
327
|
+
* Children-per-slice before `advanceTo()` yields to the main thread. Groups
|
|
328
|
+
* at or under this size tick in one slice (fast path); larger groups tick in
|
|
329
|
+
* batches with a `scheduler.yield()` between them (INP relief).
|
|
120
330
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
331
|
+
static readonly YIELD_BATCH = 32;
|
|
332
|
+
singleTarget: boolean;
|
|
333
|
+
lastTickTime: number;
|
|
334
|
+
/** THE rAF owner for the group's draw loop. */
|
|
335
|
+
readonly playback: RAFPlayback;
|
|
336
|
+
resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
|
|
124
337
|
private _playingPromise;
|
|
125
|
-
/**
|
|
126
|
-
* Pre-bound frame callback — allocated once to avoid creating a new
|
|
127
|
-
* closure on every playback loop start.
|
|
128
|
-
*/
|
|
338
|
+
/** Pre-bound frame callback — allocated once to avoid a per-loop closure. */
|
|
129
339
|
private _boundFrame;
|
|
340
|
+
/** Cached entries sorted by layer zIndex (see `getEntries`). */
|
|
341
|
+
private _entries;
|
|
342
|
+
private _entriesDirty;
|
|
130
343
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* hoisted `_grouped` buffer, gated by `proof:standalone-zero-alloc`).
|
|
135
|
-
* The play path (`_frame`) never returns this object to a consumer, so
|
|
136
|
-
* reuse is safe; `at()` (a query whose result the caller keeps) still
|
|
137
|
-
* allocates a fresh object.
|
|
344
|
+
* Long-lived composite buffer, cleared in place at the top of
|
|
345
|
+
* `transformFramesGrouped` (the zero-alloc idiom `interpFrames`'s `out` buffer
|
|
346
|
+
* uses) — no fresh object allocated per frame.
|
|
138
347
|
*/
|
|
139
|
-
private
|
|
348
|
+
private _grouped;
|
|
140
349
|
/**
|
|
141
|
-
* The compile-stable union of every
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* mode trap the delete-loop fell into). Exposed (read-only) as `flatKeys`
|
|
147
|
-
* so the `AnimationGroup` can size its own composite buffer the same way.
|
|
350
|
+
* The compile-stable union of every child's contributed (whitelist-filtered)
|
|
351
|
+
* keys — what `_grouped` is null-filled to each frame so the composite clears
|
|
352
|
+
* WITHOUT `delete` (F.W4 S2: the delete-loop trapped `_grouped` in V8
|
|
353
|
+
* dictionary mode). Recomputed only on a structural change; the fold lives in
|
|
354
|
+
* `group-layer-springs`.
|
|
148
355
|
*/
|
|
149
|
-
private
|
|
356
|
+
private _groupedKeys;
|
|
357
|
+
private _groupedKeysDirty;
|
|
150
358
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
359
|
+
* P.W2 — the SoA composite layout for the `add`/`weighted` blend arms (the
|
|
360
|
+
* validated 3.7× — `scripts/group-soa-decision.json`, bit-identical
|
|
361
|
+
* `maxErr=0`). One {@link SoALayerPlan} per `add`/`weighted` entry: the FLAT
|
|
362
|
+
* list of pure-numeric `(carrier, incoming)` `ValueUnit<number>` pairs that
|
|
363
|
+
* blend would touch, hoisted out of the per-frame `for..in` + `Array.isArray`
|
|
364
|
+
* + per-element `isNumericUnit` dispatch into a contiguous {@link Float64Array}
|
|
365
|
+
* fold. Rebuilt ONLY on a structural change (alongside `_groupedKeys`), NEVER
|
|
366
|
+
* per frame. The `replace` default arm is dispatch-free and carries NO plan;
|
|
367
|
+
* the non-numeric (color/computed/string/mixed) tail keeps the boxed
|
|
368
|
+
* per-element path. The probe (`carrier-probe`) proved `interpFrames` MUTATES
|
|
369
|
+
* each leaf `ValueUnit.value` IN PLACE, so the carrier + incoming refs are
|
|
370
|
+
* STABLE across frames — the plan is valid until the entry set / a layer
|
|
371
|
+
* whitelist / a blend mode changes (every such mutation routes through
|
|
372
|
+
* `invalidateEntries`).
|
|
373
|
+
*/
|
|
374
|
+
private _soaPlans;
|
|
375
|
+
/**
|
|
376
|
+
* The long-lived SoA fold scratch — the contiguous numeric accumulate buffer
|
|
377
|
+
* the `add`/`weighted` fold seeds, folds, and writes back through. Sized to
|
|
378
|
+
* the WIDEST single-layer numeric pair count once per structural change
|
|
379
|
+
* (reused across layers AND frames — zero per-frame alloc, the F.W4 zero-alloc
|
|
380
|
+
* discipline). `null` until the first plan with numeric pairs is built.
|
|
381
|
+
*/
|
|
382
|
+
private _compositeBuf;
|
|
383
|
+
/**
|
|
384
|
+
* K.W11 PHYS-C — true iff ANY layer currently carries a `weightSpring`. The
|
|
385
|
+
* fast-path guard: when false (the universal case) `advanceTo` skips the
|
|
386
|
+
* per-frame spring scan entirely, so the constant-weight blend hot path takes
|
|
387
|
+
* ZERO new work. Set true by `transitionLayer`; recomputed false once every
|
|
388
|
+
* driving spring has settled.
|
|
389
|
+
*/
|
|
390
|
+
private _hasLayerSprings;
|
|
391
|
+
constructor(...inputs: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]);
|
|
392
|
+
/**
|
|
393
|
+
* The animation entries sorted by layer zIndex, dirty-flag cached — rebuilt
|
|
394
|
+
* only when the animations object or a layer config is mutated. All hot-path
|
|
395
|
+
* iteration uses this instead of `Object.values()`.
|
|
154
396
|
*/
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
|
|
397
|
+
private getEntries;
|
|
398
|
+
/** Mark entries cache stale. Called at all mutation boundaries. */
|
|
399
|
+
private invalidateEntries;
|
|
400
|
+
setSuperKey(superKey: string): this;
|
|
401
|
+
setTargets(...targets: HTMLElement[]): this;
|
|
402
|
+
onStart(): this;
|
|
403
|
+
onEnd(): this;
|
|
158
404
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
405
|
+
* Composite all animation values into a single grouped transform (per-frame
|
|
406
|
+
* for single-target groups). Applies layer blending (replace / add /
|
|
407
|
+
* weighted) in zIndex order, then calls the group transform with the merged
|
|
408
|
+
* values. Each child's values refresh in place (`interpFrames` clears and
|
|
409
|
+
* rewrites the long-lived buffer), so no stale keys leak and no fresh object
|
|
410
|
+
* is allocated per entry per frame.
|
|
164
411
|
*/
|
|
165
|
-
|
|
166
|
-
/** True when `fn` is this instance's default DOM-style renderer. */
|
|
167
|
-
usesDefaultRenderer(fn: TransformFunction<V> | undefined): boolean;
|
|
168
|
-
private dispatchAnimationEvent;
|
|
169
|
-
constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
|
|
170
|
-
get templateFrames(): TemplateAnimationFrame<V>[];
|
|
171
|
-
set templateFrames(value: TemplateAnimationFrame<V>[]);
|
|
172
|
-
get parsedVars(): ParsedVarMap[];
|
|
173
|
-
get frames(): AnimationFrame<V>[];
|
|
174
|
-
get frameId(): number;
|
|
175
|
-
/** Append a template frame (delegated to the compiler). Chainable. */
|
|
176
|
-
addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"]): Animation_2<K>;
|
|
177
|
-
/** Compile the template frames into the sampled `frames[]`. Chainable. */
|
|
178
|
-
parse(): this;
|
|
412
|
+
transformFramesGrouped(t: number): Record<string, unknown>;
|
|
179
413
|
/**
|
|
180
|
-
*
|
|
181
|
-
* (
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
* the `
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
414
|
+
* The boxed `add`/`weighted` blend arm — the per-element AoS path that the
|
|
415
|
+
* SoA fold (`soaBlendLayer`) supplants for the pure-numeric majority. Kept as
|
|
416
|
+
* THE blend implementation for two roles: (1) the plan-build frame (every key,
|
|
417
|
+
* `only === undefined`) — it establishes the carriers `buildSoAPlans` then
|
|
418
|
+
* captures; (2) the per-frame residual (the plan's `boxedKeys` — non-numeric /
|
|
419
|
+
* mixed / first-touch leaves the fold cannot cover, typically empty). Both
|
|
420
|
+
* arms guard on `Array.isArray(existing) && Array.isArray(incoming)` and loop
|
|
421
|
+
* `Math.min(existing.length, incoming.length)` elements with a per-element
|
|
422
|
+
* `isNumericUnit` guard — the byte-exact G.W17 leaf contract (proof:blend),
|
|
423
|
+
* un-clamped `add` (`+=`), spring-weighted `lerp`. A non-array carrier (or a
|
|
424
|
+
* skipped key) falls through to `groupedValues[key] = incoming`.
|
|
425
|
+
*/
|
|
426
|
+
private boxedBlendArm;
|
|
427
|
+
/**
|
|
428
|
+
* P.W2 — the SoA fold for ONE `add`/`weighted` layer (the validated 3.7×,
|
|
429
|
+
* `scripts/group-soa-decision.json`: weighted 3.66×, add 3.69×, bit-identical
|
|
430
|
+
* `maxErr=0`). Replaces the boxed `for..in` + `Array.isArray` + per-element
|
|
431
|
+
* `isNumericUnit` dispatch with a contiguous {@link Float64Array} fold over the
|
|
432
|
+
* plan's precomputed numeric `(carrier, incoming)` pairs: seed `_compositeBuf`
|
|
433
|
+
* from each carrier, apply the op against the incoming, write back. The carrier
|
|
434
|
+
* units are the SAME `ValueUnit`s a lower layer parked in `_grouped` (the refs
|
|
435
|
+
* are frame-stable — `interpFrames` mutates `.value` in place), so writing the
|
|
436
|
+
* folded result back to `carrier.value` mutates the live composite exactly as
|
|
437
|
+
* the boxed arm did. The `add` accumulate is naturally UN-CLAMPED; the
|
|
438
|
+
* `weighted` lerp reads ONE per-layer `w` (the K.W11 PHYS-C spring weight).
|
|
439
|
+
*/
|
|
440
|
+
private soaBlendLayer;
|
|
441
|
+
/**
|
|
442
|
+
* P.W2 — build the SoA fold layout for every `add`/`weighted` layer (rebuilt
|
|
443
|
+
* ONLY on a structural change, gated by the `_groupedKeys` dirty seam). A
|
|
444
|
+
* NON-destructive carrier-resolution walk in zIndex order mirrors the boxed
|
|
445
|
+
* blend's carrier semantics EXACTLY: `replace` (and the non-array first-touch
|
|
446
|
+
* fall-through) parks a key's leaf as its carrier; `add`/`weighted` over an
|
|
447
|
+
* array carrier blend the numeric elements in place. For each `add`/`weighted`
|
|
448
|
+
* layer, the pure-numeric `(carrier, incoming)` element pairs (carrier IS an
|
|
449
|
+
* array, both elements numeric) are extracted into the flat `carriers`/
|
|
450
|
+
* `incomings` arrays the fold loops; every other key it touches (non-array
|
|
451
|
+
* carrier, or ANY non-numeric / mixed element) is recorded in `boxedKeys` for
|
|
452
|
+
* the boxed residual. `_compositeBuf` is grown to the widest layer's numeric
|
|
453
|
+
* width ONCE (reused across layers and frames — zero per-frame alloc). The
|
|
454
|
+
* walk mutates NOTHING (it reads `.value` only to classify, never writes), so
|
|
455
|
+
* the building frame's already-computed composite is untouched.
|
|
456
|
+
*/
|
|
457
|
+
private buildSoAPlans;
|
|
458
|
+
/**
|
|
459
|
+
* Render the current composition as a static frame at each child's current
|
|
460
|
+
* `t`. Single-target groups go through the blended transform; multi-target
|
|
461
|
+
* groups apply each child's interpolated vars to its own targets. The public
|
|
462
|
+
* entry point for state mutated outside the rAF loop (scrubbing, state
|
|
463
|
+
* restore, pause snapshots) that needs the visual to update immediately.
|
|
200
464
|
*/
|
|
201
|
-
|
|
465
|
+
render(): void;
|
|
202
466
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* fast-properties mode without ever calling `delete` (F.W4 S1).
|
|
467
|
+
* Set a child animation's current time without touching its siblings.
|
|
468
|
+
* Updates `pausedTime` so the child resumes correctly from the scrub
|
|
469
|
+
* position. Chainable; call `render()` afterwards to reflect it visually.
|
|
207
470
|
*/
|
|
208
|
-
|
|
471
|
+
setChildTime(nameOrAnim: string | KeyframesAnimation<V>, t: number): this;
|
|
209
472
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* `AnimationOptionError` naming the option and the offending value.
|
|
215
|
-
* This is the same posture the layer API chose ("silent no-ops were
|
|
216
|
-
* hiding consumer bugs") applied to the whole options surface — no
|
|
217
|
-
* silent fallback, no silently-preserved previous value.
|
|
473
|
+
* Advance all child animations to absolute clock `t`. SYNC on the steady
|
|
474
|
+
* path (J.W6 S1): children that all step synchronously advance the group
|
|
475
|
+
* with no per-frame `Promise.all`/microtask hop; a thenable only on a
|
|
476
|
+
* genuinely-async child or the over-`YIELD_BATCH` yield path.
|
|
218
477
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
setDelay(delay: InputAnimationOptions["delay"]): this;
|
|
223
|
-
setDirection(direction: InputAnimationOptions["direction"]): this;
|
|
224
|
-
setFillMode(fillMode: InputAnimationOptions["fillMode"]): this;
|
|
225
|
-
setUseWAAPI(useWAAPI: InputAnimationOptions["useWAAPI"]): this;
|
|
226
|
-
setRespectReducedMotion(respectReducedMotion: InputAnimationOptions["respectReducedMotion"]): this;
|
|
227
|
-
setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
|
|
228
|
-
setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
|
|
229
|
-
setOptions(options: Partial<InputAnimationOptions>): this;
|
|
230
|
-
reverse(): this;
|
|
231
|
-
fillForwards(): void;
|
|
232
|
-
fillBackwards(): void;
|
|
478
|
+
advanceTo(t: number): this | Promise<this>;
|
|
479
|
+
/** The post-advance tail — `onEnd` once the render marked done. */
|
|
480
|
+
private _endAdvance;
|
|
233
481
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* per this derivation, and the reduced-motion snap is "rest = final,
|
|
238
|
-
* paint it, settle" — the same path a `fillMode: forwards` completion
|
|
239
|
-
* takes, not a separate code path.
|
|
240
|
-
*/
|
|
241
|
-
get restPosition(): "initial" | "final";
|
|
242
|
-
/** Paint the rest frame per the fill contract. */
|
|
243
|
-
paintRest(): void;
|
|
244
|
-
/**
|
|
245
|
-
* Stateless progress query. Maps [0,1] from first keyframe to last,
|
|
246
|
-
* regardless of playback direction. `apply=true` invokes transform callbacks.
|
|
247
|
-
*/
|
|
248
|
-
at(progress: number, apply?: boolean): Record<string, ValueUnit[]>;
|
|
249
|
-
/**
|
|
250
|
-
* Interpolate all active frames at time `t`. This is the hot path —
|
|
251
|
-
* called once per rAF frame during playback.
|
|
252
|
-
*
|
|
253
|
-
* Uses binary search (O(log N)) to find the first matching frame,
|
|
254
|
-
* then scans neighbors to collect all overlapping frames at `t`
|
|
255
|
-
* (multiple properties may share the same time range).
|
|
256
|
-
*
|
|
257
|
-
* @param t - Current animation time in milliseconds
|
|
258
|
-
* @param transformFrames - If true, applies each frame's transform function to targets
|
|
259
|
-
* @param out - Optional output object to write results into. When
|
|
260
|
-
* provided, its keys are cleared first so no stale keys from a
|
|
261
|
-
* previous call leak through. Pass this per-animation to achieve
|
|
262
|
-
* zero-allocation steady-state playback.
|
|
263
|
-
* @returns Merged flat vars from all active frames
|
|
264
|
-
*/
|
|
265
|
-
interpFrames(t: number, transformFrames?: boolean, out?: Record<string, ValueUnit[]>): Record<string, ValueUnit[]>;
|
|
266
|
-
/**
|
|
267
|
-
* Clear a reused interpolation buffer to a stale-free state WITHOUT
|
|
268
|
-
* `delete` — the V8-correct stable-key null-fill (F.W4 S1). The key-set is
|
|
269
|
-
* compile-stable (`_stableKeys` is the union of every frame's `flatVars`
|
|
270
|
-
* keys, fixed at `parse`), so null-filling it keeps the buffer in
|
|
271
|
-
* fast-properties mode AND zero-alloc. Inactive keys read back `undefined`;
|
|
272
|
-
* every consumer of a reused buffer (the group blend, the unused play-loop
|
|
273
|
-
* `_interpOut`) skips them — only the standalone return path (which never
|
|
274
|
-
* reuses a buffer) must be `undefined`-free, and it takes the alias / fresh
|
|
275
|
-
* merge above.
|
|
276
|
-
*/
|
|
277
|
-
private clearBuffer;
|
|
278
|
-
/**
|
|
279
|
-
* Interpolate ONE active frame at time `t` in place (lerp + optional
|
|
280
|
-
* transform). Lifted off the `interpFrames` hot loop so playback allocates
|
|
281
|
-
* no per-frame closure. A zero-width frame (`start === stop`, a degenerate
|
|
282
|
-
* keyframe pair) snaps to the endpoint instead of dividing by zero in
|
|
283
|
-
* `scale` (E-RT-5). The merge into the result buffer is done by the caller
|
|
284
|
-
* (F.W4 S3 — so the single-frame path can alias `flatVars` with no copy).
|
|
285
|
-
*/
|
|
286
|
-
private processFrame;
|
|
287
|
-
/** SYNC unless `delay > 0` — then a thenable resolving after the sleep. */
|
|
288
|
-
onStart(): Promise<void> | undefined;
|
|
289
|
-
onEnd(): void;
|
|
290
|
-
/**
|
|
291
|
-
* Advance the playhead to absolute clock `t` (a rAF timestamp, NOT a
|
|
292
|
-
* delta). Lazily runs `onStart` on the first call, reconciles the
|
|
293
|
-
* pause/resume clock, and ends the iteration once `t` reaches the
|
|
294
|
-
* duration. This is the DRIVER-layer advance — the one meaning of the
|
|
295
|
-
* absolute-clock step, distinct from the `tickDt(dt)` stepper surface
|
|
296
|
-
* the rest of the engine canonicalized to.
|
|
297
|
-
*
|
|
298
|
-
* SYNC on the steady path (J.W6 S1 — the F.W5 held half, landed): every
|
|
299
|
-
* post-start frame returns a plain number (no per-frame promise+microtask
|
|
300
|
-
* hop); a thenable ONLY when the FIRST tick awaits the genuinely-async
|
|
301
|
-
* delay sleep. Ordering locked by proof:event-ordering.
|
|
302
|
-
*/
|
|
303
|
-
advanceTo(t: number): number | Promise<number>;
|
|
304
|
-
/** The post-start advance body — pause clock, local time, iteration end. */
|
|
305
|
-
private _advance;
|
|
306
|
-
/**
|
|
307
|
-
* One frame of the standalone rAF play path, driven by the shared
|
|
308
|
-
* `RAFPlayback.loop`. Returns whether the loop should continue.
|
|
482
|
+
* One frame of the group's draw loop (driven by `RAFPlayback.loop`): ticks
|
|
483
|
+
* all children, then renders (single-target: grouped blending; multi-target:
|
|
484
|
+
* per-child). Returns whether the loop should continue.
|
|
309
485
|
*/
|
|
310
486
|
private _frame;
|
|
311
|
-
/** The post-advance render half of `_frame` —
|
|
487
|
+
/** The post-advance render half of `_frame` — composite, or settle. */
|
|
312
488
|
private _renderFrame;
|
|
313
489
|
private _resolvePlay;
|
|
314
|
-
/** Internal rAF-based play loop — loop ownership rides `this.playback`. */
|
|
315
|
-
private _playRAF;
|
|
316
490
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* `
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* No silent fallback — eligibility is decided once in `play()`
|
|
324
|
-
* before this is invoked, and runtime errors propagate.
|
|
491
|
+
* The completion front-door (G.W13) — `await group.finished` resolves once
|
|
492
|
+
* the in-flight composite play settles. Exposes the ONE held
|
|
493
|
+
* `_playingPromise` `play()` constructs (the re-entrant guard returns it;
|
|
494
|
+
* the `finally`-clear nulls it on settle) — NOT a second completion
|
|
495
|
+
* lifecycle. A settled (or never-played) group resolves immediately.
|
|
325
496
|
*/
|
|
326
|
-
|
|
497
|
+
get finished(): Promise<void>;
|
|
327
498
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
499
|
+
* Start the animation group. Resolves when all children complete (or on
|
|
500
|
+
* explicit stop/reset). Re-entrant: a `play()` while one is in flight
|
|
501
|
+
* returns the same promise rather than leaking a second draw loop. Under
|
|
502
|
+
* `respectReducedMotion` + an active query, snaps every child to its final
|
|
503
|
+
* frame in a single composite (no rAF loop), then settles as a completed
|
|
504
|
+
* play would.
|
|
332
505
|
*/
|
|
333
|
-
|
|
506
|
+
play(): Promise<void>;
|
|
334
507
|
/**
|
|
335
|
-
* `prefers-reduced-motion` snap: rest = final, paint it, settle — the
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* final
|
|
339
|
-
* to a completed normal play.
|
|
508
|
+
* `prefers-reduced-motion` snap: rest = final, paint it, settle — the SAME
|
|
509
|
+
* terminal path a completed play takes, motion elided. Every child advances
|
|
510
|
+
* to its final frame, one composite paints, `settle()` readies the group for
|
|
511
|
+
* replay (final frame stays on the target(s), matching `Animation`'s snap).
|
|
340
512
|
*/
|
|
341
513
|
private _playReducedMotion;
|
|
342
514
|
/**
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
* already fired — so here we paint final, mark done, end, settle, and
|
|
348
|
-
* release the awaiter. The WAAPI lane snaps via the same path: the up-front
|
|
349
|
-
* gate already routes reduced-motion away from WAAPI, and a live flip on a
|
|
350
|
-
* WAAPI animation cancels the compositor handles before settling.
|
|
351
|
-
*/
|
|
352
|
-
private _snapToReducedMotion;
|
|
353
|
-
/**
|
|
354
|
-
* The completion front-door (G.W13) — `await anim.finished` resolves once
|
|
355
|
-
* the in-flight play settles. It exposes the ONE held `_playingPromise`
|
|
356
|
-
* `play()` already constructs (the re-entrant guard returns it; the
|
|
357
|
-
* `finally`-clear nulls it on settle) — NOT a second completion lifecycle.
|
|
358
|
-
* Two reads mid-play return the SAME promise. A settled (or never-played)
|
|
359
|
-
* animation reads `null` and resolves immediately: "not running" = "nothing
|
|
360
|
-
* to await" — the honest semantics for a getter that reports current
|
|
361
|
-
* settledness, not a pre-armed future run.
|
|
515
|
+
* Pause the group — idempotent. Pausing an already-paused (or
|
|
516
|
+
* not-yet-started) group is a no-op, NOT a resume (use {@link toggle} for
|
|
517
|
+
* the explicit flip). Cancels the rAF loop immediately and renders a
|
|
518
|
+
* final-frame snapshot so the visual matches the exact pause moment.
|
|
362
519
|
*/
|
|
363
|
-
|
|
364
|
-
play(): Promise<void>;
|
|
520
|
+
pause(): this;
|
|
365
521
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
522
|
+
* Resume the group — idempotent. Unpauses every child DIRECTLY (not via
|
|
523
|
+
* `child.resume()`, which would start each child's own rAF loop — the
|
|
524
|
+
* group's draw loop owns the ticking) and re-registers that loop.
|
|
369
525
|
*/
|
|
370
|
-
pause(): this;
|
|
371
526
|
resume(): this;
|
|
372
527
|
/** The explicit flip: pauses if playing, resumes if paused. */
|
|
373
528
|
toggle(): this;
|
|
374
529
|
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
|
|
379
|
-
stop(): void;
|
|
380
|
-
playing(): boolean;
|
|
381
|
-
/** Returns the effective time accounting for direction reversal. */
|
|
382
|
-
get effectiveT(): number;
|
|
383
|
-
/**
|
|
384
|
-
* Pure state teardown — flags, clocks, iteration. NEVER paints. This is
|
|
385
|
-
* the terminal half of the rest-position contract: completion paints
|
|
386
|
-
* the rest frame (via `onEnd` → `paintRest`) and then settles; the
|
|
387
|
-
* reduced-motion snap paints final and then settles. Settling is
|
|
388
|
-
* orthogonal to where the pixels rest.
|
|
530
|
+
* Pure state teardown — never paints. Releases every child
|
|
531
|
+
* (`managed = false`, `child.settle()`) and clears the group's playback
|
|
532
|
+
* flags. Completion and the reduced-motion snap both end here, leaving the
|
|
533
|
+
* rest frame on the target(s).
|
|
389
534
|
*/
|
|
390
535
|
settle(): this;
|
|
391
536
|
/**
|
|
392
|
-
* Explicit rewind: paint
|
|
393
|
-
* user-facing "return to start"
|
|
394
|
-
*
|
|
395
|
-
* leaves the pixels where they rest.
|
|
537
|
+
* Explicit rewind: paint every started child back to its INITIAL frame, then
|
|
538
|
+
* settle — the user-facing "return to start". Completion does NOT come here
|
|
539
|
+
* (it settles where the fill contract rested the pixels).
|
|
396
540
|
*/
|
|
397
541
|
reset(): this;
|
|
398
|
-
setTargets(...targets: HTMLElement[]): this;
|
|
399
|
-
group(...animations: Animation_2<V>[]): AnimationGroup<V>;
|
|
400
|
-
}
|
|
401
|
-
export { Animation_2 as Animation }
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* The value.js-bearing engine surface, resolved through `loadAnimationEngine()`.
|
|
405
|
-
*
|
|
406
|
-
* Spelled as an explicit interface (rather than `typeof import("./engine")`)
|
|
407
|
-
* because the dts roll-up — API Extractor — cannot resolve a `typeof import()`
|
|
408
|
-
* type node that points at an internal module. The shape stays in lockstep
|
|
409
|
-
* with `./engine`'s runtime exports.
|
|
410
|
-
*/
|
|
411
|
-
export declare interface AnimationEngine {
|
|
412
|
-
Animation: typeof Animation_2;
|
|
413
|
-
CSSKeyframesAnimation: typeof CSSKeyframesAnimation;
|
|
414
|
-
AnimationGroup: typeof AnimationGroup;
|
|
415
|
-
getAnimationId: (animation: Animation_2 | string) => string;
|
|
416
|
-
getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
|
|
417
|
-
resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
|
|
418
|
-
/** The single-call front door — dispatch + auto-target + auto-play. */
|
|
419
|
-
animate: typeof animate;
|
|
420
|
-
/** CSS-native MotionPath (F.W12) — offset-distance over an author offset-path. */
|
|
421
|
-
MotionPath: typeof MotionPath;
|
|
422
|
-
fromMotionPath: typeof fromMotionPath;
|
|
423
|
-
/** CSS-native DrawSVG (G.W13) — stroke-dashoffset sweep over the path length. */
|
|
424
|
-
DrawSVG: typeof DrawSVG;
|
|
425
|
-
fromDrawSVG: typeof fromDrawSVG;
|
|
426
542
|
/**
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
* instead of the light static barrel: `const { presets } = await
|
|
430
|
-
* loadAnimationEngine(); presets.fadeIn({ duration: 500 })` (F.W11).
|
|
543
|
+
* Halt the draw loop, rewind to the initial frame (the transport-stop
|
|
544
|
+
* semantic the demo's controls expect), and resolve any pending `play()`.
|
|
431
545
|
*/
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
defaultLayerConfig: AnimationLayerConfig;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export declare interface AnimationFrame<V extends Vars> {
|
|
440
|
-
id: number;
|
|
441
|
-
start: ValueUnit;
|
|
442
|
-
ixs: {
|
|
443
|
-
start: number;
|
|
444
|
-
stop: number;
|
|
445
|
-
};
|
|
446
|
-
time: {
|
|
447
|
-
start: number;
|
|
448
|
-
stop: number;
|
|
449
|
-
};
|
|
450
|
-
flatVars: V;
|
|
451
|
-
vars: V;
|
|
452
|
-
interpVars: {
|
|
453
|
-
[arg: string]: Array<InterpolatedVar<V>>;
|
|
454
|
-
};
|
|
546
|
+
stop(): this;
|
|
547
|
+
playing(): boolean;
|
|
548
|
+
forcePause(): void;
|
|
549
|
+
forcePlay(): void;
|
|
455
550
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* on every interpFrames() call in the hot path.
|
|
551
|
+
* Set layer config for an animation by name or reference. Chainable; throws
|
|
552
|
+
* on an unregistered key (silent no-ops were hiding consumer bugs).
|
|
459
553
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
554
|
+
setLayerConfig(nameOrAnim: string | KeyframesAnimation<V>, config: Partial<AnimationLayerConfig>): this;
|
|
555
|
+
/** Convenience toggle for enabling/disabling a layer. Chainable. */
|
|
556
|
+
setLayerEnabled(nameOrAnim: string | KeyframesAnimation<V>, enabled: boolean): this;
|
|
557
|
+
/** Read the layer config for an animation by name or reference. */
|
|
558
|
+
getLayerConfig(nameOrAnim: string | KeyframesAnimation<V>): AnimationLayerConfig | undefined;
|
|
559
|
+
/**
|
|
560
|
+
* Spring a layer's blend `weight` from its CURRENT value to `weight` (K.W11
|
|
561
|
+
* PHYS-C — the spring-driven crossfade). Seeds a `SpringProgress` (via
|
|
562
|
+
* `seedLayerSpring`), parks it on `layer.weightSpring`, and forces
|
|
563
|
+
* `blendMode` to `weighted`. A re-target mid-flight RE-SEATS the in-flight
|
|
564
|
+
* spring from its live `(value, velocity)` (`set target`) — no kink. Full
|
|
565
|
+
* trajectory documentation in `./group-layer-springs`. Chainable.
|
|
566
|
+
*/
|
|
567
|
+
transitionLayer(nameOrAnim: string | KeyframesAnimation<V>, target: {
|
|
568
|
+
weight: number;
|
|
569
|
+
spring?: LayerTransitionSpring;
|
|
570
|
+
}): this;
|
|
571
|
+
/**
|
|
572
|
+
* Physically crossfade between two layers (K.W11 PHYS-C): spring layer `a`
|
|
573
|
+
* down to weight `0` and layer `b` up to weight `1`, each over its own
|
|
574
|
+
* `SpringProgress`. Two `transitionLayer` calls — the flagship demo moment, a
|
|
575
|
+
* crossfade that overshoots and settles. Chainable.
|
|
576
|
+
*/
|
|
577
|
+
crossfade(a: string | KeyframesAnimation<V>, b: string | KeyframesAnimation<V>, options?: {
|
|
578
|
+
spring?: LayerTransitionSpring;
|
|
579
|
+
}): this;
|
|
580
|
+
/**
|
|
581
|
+
* Advance every spring-driven layer weight by the frame delta `dt` ms (K.W11
|
|
582
|
+
* PHYS-C). Called from `advanceTo` ONLY when `_hasLayerSprings` is true, so
|
|
583
|
+
* the constant-weight path pays nothing. On settle the converged value
|
|
584
|
+
* commits to the constant `layer.weight` and the spring is CLEARED — the
|
|
585
|
+
* `weighted` leaf's `?? layer.weight` read then serves the constant.
|
|
586
|
+
*/
|
|
587
|
+
private advanceLayerSprings;
|
|
463
588
|
}
|
|
464
589
|
|
|
465
|
-
export declare
|
|
466
|
-
|
|
590
|
+
export declare interface AnimationGroupEntry<V extends Vars> {
|
|
591
|
+
animation: KeyframesAnimation<V>;
|
|
592
|
+
values: Record<string, unknown>;
|
|
593
|
+
layer: AnimationLayerConfig;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** Input type for AnimationGroup constructor — bare Animation or Animation with layer config. */
|
|
597
|
+
declare type AnimationGroupInput<V extends Vars> = KeyframesAnimation<V> | {
|
|
598
|
+
animation: KeyframesAnimation<V>;
|
|
599
|
+
layer?: Partial<AnimationLayerConfig>;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
declare interface AnimationGroupObject<V extends Vars> {
|
|
603
|
+
[key: string]: AnimationGroupEntry<V>;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export declare interface AnimationLayerConfig {
|
|
607
|
+
/** Higher wins. Default: 0 */
|
|
608
|
+
zIndex: number;
|
|
609
|
+
/** 0–1 for 'weighted' blend mode. Default: 1 */
|
|
610
|
+
weight: number;
|
|
467
611
|
/**
|
|
468
|
-
*
|
|
469
|
-
* (
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
612
|
+
* Optional spring (or any {@link WeightStepper}) DRIVING this layer's
|
|
613
|
+
* blend `weight` (K.W11 PHYS-C — the spring-driven crossfade). When
|
|
614
|
+
* present the `weighted` blend leaf reads `weightSpring.value` in place of
|
|
615
|
+
* the constant `weight` (one nullish read; the per-frame lerp untouched),
|
|
616
|
+
* so a layer transition follows a PHYSICAL trajectory that can overshoot
|
|
617
|
+
* and settle — the flagship demo moment only kf's weighted-blend substrate
|
|
618
|
+
* can hold. Constructed + advanced by `AnimationGroup.transitionLayer` /
|
|
619
|
+
* `crossfade`; cleared on settle, when the read falls back to the
|
|
620
|
+
* now-updated constant `weight`. Absent on a static-weight layer (the
|
|
621
|
+
* read is `?? layer.weight`), so the constant path is byte-unchanged.
|
|
474
622
|
*/
|
|
475
|
-
|
|
476
|
-
superKey: string | undefined;
|
|
477
|
-
paused: boolean;
|
|
478
|
-
started: boolean;
|
|
479
|
-
done: boolean;
|
|
623
|
+
weightSpring?: WeightStepper;
|
|
480
624
|
/**
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
625
|
+
* Default: 'replace'. Defaulting on a genuinely-omitted blend mode is
|
|
626
|
+
* the sanctioned contract (the fail-explicit seam throws only on
|
|
627
|
+
* malformed PRESENT input, never on omission) — an unspecified layer
|
|
628
|
+
* blends by replacement, the least-surprising composite.
|
|
484
629
|
*/
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
readonly playback: RAFPlayback;
|
|
497
|
-
resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
|
|
498
|
-
private _playingPromise;
|
|
499
|
-
/**
|
|
500
|
-
* Pre-bound frame callback — allocated once in constructor to avoid
|
|
501
|
-
* creating a new closure on every playback loop start.
|
|
502
|
-
*/
|
|
503
|
-
private _boundFrame;
|
|
504
|
-
/**
|
|
505
|
-
* Cached entries array, sorted by layer zIndex. Rebuilt on demand
|
|
506
|
-
* via dirty flag to avoid Object.values() allocation on every frame.
|
|
507
|
-
*/
|
|
508
|
-
private _entries;
|
|
509
|
-
private _entriesDirty;
|
|
510
|
-
/**
|
|
511
|
-
* Long-lived composite buffer, cleared in place at the top of
|
|
512
|
-
* `transformFramesGrouped` (the same zero-alloc idiom `interpFrames`'s
|
|
513
|
-
* `out` buffer already uses). With it the compositor honours the class's
|
|
514
|
-
* own zero-alloc discipline — no fresh `groupedValues` object, and no
|
|
515
|
-
* per-layer `filteredValues` object, allocated per frame.
|
|
516
|
-
*/
|
|
517
|
-
private _grouped;
|
|
518
|
-
/**
|
|
519
|
-
* The compile-stable union of every child's contributed (whitelist-filtered)
|
|
520
|
-
* keys — what `_grouped` is null-filled to each frame so the composite is
|
|
521
|
-
* cleared WITHOUT `delete` (F.W4 S2: the delete-loop trapped `_grouped` in
|
|
522
|
-
* V8 dictionary mode). Recomputed only when the entry set / a layer
|
|
523
|
-
* whitelist changes (via `invalidateEntries`); stable across frames.
|
|
524
|
-
*/
|
|
525
|
-
private _groupedKeys;
|
|
526
|
-
private _groupedKeysDirty;
|
|
527
|
-
constructor(...inputs: (Animation_2<V> | AnimationGroupInput<V>)[]);
|
|
528
|
-
/**
|
|
529
|
-
* Returns the animation entries sorted by layer zIndex.
|
|
530
|
-
* Uses dirty-flag caching — only rebuilds when the animations object
|
|
531
|
-
* or layer configs are mutated. All hot-path iteration (tick, draw,
|
|
532
|
-
* transformFramesGrouped) uses this instead of Object.values().
|
|
533
|
-
*/
|
|
534
|
-
private getEntries;
|
|
535
|
-
/** Mark entries cache stale. Called at all mutation boundaries. */
|
|
536
|
-
private invalidateEntries;
|
|
537
|
-
/**
|
|
538
|
-
* Recompute `_groupedKeys` — the union of each child's contributed keys
|
|
539
|
-
* (whitelist-filtered when the layer carries one). The maximal key-set the
|
|
540
|
-
* `transformFramesGrouped` null-fill clears, so the composite buffer stays
|
|
541
|
-
* in V8 fast-properties mode without `delete` (F.W4 S2). Children are parsed
|
|
542
|
-
* (their `flatKeys` populated) before the first composite — the group only
|
|
543
|
-
* blends during play, after child setup — and any later structural change
|
|
544
|
-
* re-dirties through `invalidateEntries`.
|
|
545
|
-
*/
|
|
546
|
-
private computeGroupedKeys;
|
|
547
|
-
setSuperKey(superKey: string): this;
|
|
548
|
-
setTargets(...targets: HTMLElement[]): this;
|
|
549
|
-
onStart(): this;
|
|
550
|
-
onEnd(): this;
|
|
551
|
-
/**
|
|
552
|
-
* Composite all animation values into a single grouped transform.
|
|
553
|
-
* Called per-frame for single-target groups. Applies layer blending
|
|
554
|
-
* (replace / add / weighted) in zIndex order, then calls the group
|
|
555
|
-
* transform function with the merged values.
|
|
556
|
-
*
|
|
557
|
-
* Refreshes every child's values at its current `t` in place —
|
|
558
|
-
* `interpFrames(t, false, entry.values)` clears and rewrites the
|
|
559
|
-
* long-lived buffer, so no stale keys leak across frames and no
|
|
560
|
-
* fresh object is allocated per entry per frame.
|
|
561
|
-
*/
|
|
562
|
-
transformFramesGrouped(t: number): Record<string, unknown>;
|
|
563
|
-
/**
|
|
564
|
-
* Render the current composition as a static frame using each
|
|
565
|
-
* child's current `t`. Single-target groups go through the
|
|
566
|
-
* blended transform; multi-target groups apply each child's
|
|
567
|
-
* interpolated vars directly to its own targets.
|
|
568
|
-
*
|
|
569
|
-
* This is the public entry point for scenarios that mutate a
|
|
570
|
-
* child's state outside the rAF loop (scrubbing, state restore,
|
|
571
|
-
* pause snapshots) and need the visual to update immediately.
|
|
572
|
-
*/
|
|
573
|
-
render(): void;
|
|
574
|
-
/**
|
|
575
|
-
* Set a child animation's current time without touching its
|
|
576
|
-
* siblings. Updates `pausedTime` so the child resumes correctly
|
|
577
|
-
* from the scrub position. Chainable. Call `render()` afterwards
|
|
578
|
-
* to reflect the change visually.
|
|
579
|
-
*/
|
|
580
|
-
setChildTime(nameOrAnim: string | Animation_2<V>, t: number): this;
|
|
581
|
-
/**
|
|
582
|
-
* Advance all child animations to absolute clock `t`. SYNC on the steady
|
|
583
|
-
* path (J.W6 S1): children that all step synchronously advance the group
|
|
584
|
-
* with no per-frame `Promise.all`/microtask hop; a thenable only on a
|
|
585
|
-
* genuinely-async child or the over-`YIELD_BATCH` yield path.
|
|
586
|
-
*/
|
|
587
|
-
advanceTo(t: number): this | Promise<this>;
|
|
588
|
-
/** Batched advance — yield to the main thread between batches. */
|
|
589
|
-
private _advanceBatched;
|
|
590
|
-
/** The post-advance tail — `onEnd` once the render marked done. */
|
|
591
|
-
private _endAdvance;
|
|
592
|
-
/** Advance one slice — `undefined` iff every child stepped sync. */
|
|
593
|
-
private _advanceSlice;
|
|
594
|
-
/**
|
|
595
|
-
* One frame of the group's draw loop, driven by the shared
|
|
596
|
-
* `RAFPlayback.loop`. Ticks all children, then renders
|
|
597
|
-
* (single-target: grouped blending; multi-target: per-child).
|
|
598
|
-
* Returns whether the loop should continue.
|
|
599
|
-
*/
|
|
600
|
-
private _frame;
|
|
601
|
-
/** The post-advance render half of `_frame` — composite, or settle. */
|
|
602
|
-
private _renderFrame;
|
|
603
|
-
private _resolvePlay;
|
|
604
|
-
/**
|
|
605
|
-
* Start the animation group. Returns a promise that resolves
|
|
606
|
-
* when all child animations complete (or on explicit stop/reset).
|
|
607
|
-
* Re-entrant: a `play()` while one is in flight returns the same
|
|
608
|
-
* promise rather than leaking a second draw loop.
|
|
609
|
-
*
|
|
610
|
-
* Under `respectReducedMotion` + an active `prefers-reduced-motion`
|
|
611
|
-
* query, snaps every child to its final frame in a single composite —
|
|
612
|
-
* no rAF draw loop — then settles exactly as a completed play would.
|
|
613
|
-
*/
|
|
614
|
-
/**
|
|
615
|
-
* The completion front-door (G.W13) — `await group.finished` resolves once
|
|
616
|
-
* the in-flight composite play settles. Exposes the ONE held
|
|
617
|
-
* `_playingPromise` `play()` constructs (the re-entrant guard returns it;
|
|
618
|
-
* the `finally`-clear nulls it on settle) — NOT a second completion
|
|
619
|
-
* lifecycle. A settled (or never-played) group resolves immediately.
|
|
620
|
-
*/
|
|
621
|
-
get finished(): Promise<void>;
|
|
622
|
-
play(): Promise<void>;
|
|
623
|
-
/**
|
|
624
|
-
* `prefers-reduced-motion` snap for the group: rest = final, paint it,
|
|
625
|
-
* settle — the SAME terminal path a completed play takes, with the
|
|
626
|
-
* motion elided. Every child advances to its final frame, one composite
|
|
627
|
-
* paints, and `settle()` (pure teardown, never a repaint) readies the
|
|
628
|
-
* group for replay. The final frame stays on the target(s), matching
|
|
629
|
-
* `Animation._playReducedMotion`.
|
|
630
|
-
*/
|
|
631
|
-
private _playReducedMotion;
|
|
632
|
-
/**
|
|
633
|
-
* Pause the group — idempotent. Pausing an already-paused (or
|
|
634
|
-
* not-yet-started) group is a no-op, NOT a resume. Mirrors
|
|
635
|
-
* `Animation.pause`: a method named `pause` pauses, never secretly
|
|
636
|
-
* resumes. Use {@link toggle} for the explicit flip, {@link resume}
|
|
637
|
-
* for the explicit resume.
|
|
638
|
-
*
|
|
639
|
-
* Cancels the rAF loop immediately (don't wait for the frame callback to
|
|
640
|
-
* self-terminate) and renders a final-frame snapshot so the visual
|
|
641
|
-
* matches the exact pause moment.
|
|
642
|
-
*/
|
|
643
|
-
pause(): this;
|
|
644
|
-
/**
|
|
645
|
-
* Resume the group — idempotent. Resuming a running (or not-yet-started)
|
|
646
|
-
* group is a no-op. Unpauses every child DIRECTLY (not via
|
|
647
|
-
* `child.resume()`, which would start each child's own rAF loop) — the
|
|
648
|
-
* group's draw loop owns the ticking — and re-registers that loop.
|
|
649
|
-
*/
|
|
650
|
-
resume(): this;
|
|
651
|
-
/** The explicit flip: pauses if playing, resumes if paused. */
|
|
652
|
-
toggle(): this;
|
|
653
|
-
/**
|
|
654
|
-
* Pure state teardown — never paints. The group analogue of
|
|
655
|
-
* `Animation.settle()`: releases every child (`managed = false`,
|
|
656
|
-
* `child.settle()`) and clears the group's own playback flags.
|
|
657
|
-
* Completion and the reduced-motion snap both end here, leaving the
|
|
658
|
-
* rest frame (per each child's fill contract) on the target(s).
|
|
659
|
-
*/
|
|
660
|
-
settle(): this;
|
|
661
|
-
/**
|
|
662
|
-
* Explicit rewind: paint every started child back to its INITIAL
|
|
663
|
-
* frame, then settle. This is the user-facing "return to start" —
|
|
664
|
-
* rest position `initial` painted deliberately, not a completion side
|
|
665
|
-
* effect. (Completion does NOT come here; it settles where the fill
|
|
666
|
-
* contract rested the pixels.)
|
|
667
|
-
*/
|
|
668
|
-
reset(): this;
|
|
669
|
-
/**
|
|
670
|
-
* Halt the draw loop, rewind to the initial frame (the transport-stop
|
|
671
|
-
* semantic the demo's controls expect), and resolve any pending
|
|
672
|
-
* `play()` promise.
|
|
673
|
-
*/
|
|
674
|
-
stop(): this;
|
|
675
|
-
playing(): boolean;
|
|
676
|
-
forcePause(): void;
|
|
677
|
-
forcePlay(): void;
|
|
678
|
-
/**
|
|
679
|
-
* Set layer config for an animation by name or reference.
|
|
680
|
-
* Chainable. Throws when the key doesn't match a registered
|
|
681
|
-
* animation — silent no-ops were hiding consumer bugs.
|
|
682
|
-
*/
|
|
683
|
-
setLayerConfig(nameOrAnim: string | Animation_2<V>, config: Partial<AnimationLayerConfig>): this;
|
|
684
|
-
/** Convenience toggle for enabling/disabling a layer. Chainable. */
|
|
685
|
-
setLayerEnabled(nameOrAnim: string | Animation_2<V>, enabled: boolean): this;
|
|
686
|
-
/** Read the layer config for an animation. */
|
|
687
|
-
getLayerConfig(nameOrAnim: string | Animation_2<V>): AnimationLayerConfig | undefined;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
export declare interface AnimationGroupEntry<V extends Vars> {
|
|
691
|
-
animation: Animation_2<V>;
|
|
692
|
-
values: Record<string, unknown>;
|
|
693
|
-
layer: AnimationLayerConfig;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
/** Input type for AnimationGroup constructor — bare Animation or Animation with layer config. */
|
|
697
|
-
declare type AnimationGroupInput<V extends Vars> = Animation_2<V> | {
|
|
698
|
-
animation: Animation_2<V>;
|
|
699
|
-
layer?: Partial<AnimationLayerConfig>;
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
declare interface AnimationGroupObject<V extends Vars> {
|
|
703
|
-
[key: string]: AnimationGroupEntry<V>;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
export declare interface AnimationLayerConfig {
|
|
707
|
-
/** Higher wins. Default: 0 */
|
|
708
|
-
zIndex: number;
|
|
709
|
-
/** 0–1 for 'weighted' blend mode. Default: 1 */
|
|
710
|
-
weight: number;
|
|
711
|
-
/**
|
|
712
|
-
* Default: 'replace'. Defaulting on a genuinely-omitted blend mode is
|
|
713
|
-
* the sanctioned contract (the fail-explicit seam throws only on
|
|
714
|
-
* malformed PRESENT input, never on omission) — an unspecified layer
|
|
715
|
-
* blends by replacement, the least-surprising composite.
|
|
716
|
-
*/
|
|
717
|
-
blendMode: BlendMode;
|
|
718
|
-
/** Layer toggle. Default: true */
|
|
719
|
-
enabled: boolean;
|
|
720
|
-
/** Optional property whitelist — only these properties will be output from this layer */
|
|
721
|
-
properties?: Set<string>;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
/** Thrown when an animation option receives malformed (non-undefined) input. */
|
|
725
|
-
export declare class AnimationOptionError extends Error {
|
|
726
|
-
readonly option: string;
|
|
727
|
-
readonly value: unknown;
|
|
630
|
+
blendMode: BlendMode;
|
|
631
|
+
/** Layer toggle. Default: true */
|
|
632
|
+
enabled: boolean;
|
|
633
|
+
/** Optional property whitelist — only these properties will be output from this layer */
|
|
634
|
+
properties?: Set<string>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** Thrown when an animation option receives malformed (non-undefined) input. */
|
|
638
|
+
export declare class AnimationOptionError extends Error {
|
|
639
|
+
readonly option: string;
|
|
640
|
+
readonly value: unknown;
|
|
728
641
|
/**
|
|
729
642
|
* Stable structured reason for programmatic consumers — branch on this,
|
|
730
643
|
* never on the human message. Carried only by the two named rows
|
|
@@ -758,8 +671,16 @@ export declare class AnimationOptionError extends Error {
|
|
|
758
671
|
* compile seam (the H-A2 "......" class, named).
|
|
759
672
|
* - `UNKNOWN_TIMING_FN` — a present-but-unresolvable timing function (not a
|
|
760
673
|
* callable, a registry name, or a cubic-bezier()/steps() literal).
|
|
674
|
+
* - `NAMED_SELECTOR_NO_TIMELINE` — a scroll-range named selector
|
|
675
|
+
* (`entry`/`exit`/`cover`/`contain`) was accepted at ingest (L.W1 S4), but a
|
|
676
|
+
* numeric `%` position was genuinely demanded with NO `ScrollTimeline`/
|
|
677
|
+
* `ManualTimeline` present to map the phase. A named selector is only
|
|
678
|
+
* meaningful in a scroll context; resolving it to a number outside one is a
|
|
679
|
+
* consumer bug, so the deferred resolve refuses with this code rather than
|
|
680
|
+
* inventing a position. (The bare-ingest floor — accept + preserve, no
|
|
681
|
+
* resolution demanded — never throws.)
|
|
761
682
|
*/
|
|
762
|
-
declare type AnimationOptionErrorCode = "EMPTY_PARSE" | "UNKNOWN_TIMING_FN";
|
|
683
|
+
declare type AnimationOptionErrorCode = "EMPTY_PARSE" | "UNKNOWN_TIMING_FN" | "NAMED_SELECTOR_NO_TIMELINE";
|
|
763
684
|
|
|
764
685
|
export declare type AnimationOptions = {
|
|
765
686
|
duration: number;
|
|
@@ -778,6 +699,27 @@ export declare type AnimationOptions = {
|
|
|
778
699
|
respectReducedMotion: boolean;
|
|
779
700
|
colorSpace: ColorSpace;
|
|
780
701
|
hueMethod?: HueInterpolationMethod;
|
|
702
|
+
/**
|
|
703
|
+
* The LAYER-level `animation-composition` operator (L.W1 S5, Band A) — the
|
|
704
|
+
* round-trip field for an authored `animation-composition: add` that arrived
|
|
705
|
+
* through a sibling `.class { animation: … }` shorthand/longhand ingest.
|
|
706
|
+
* Distinct from the per-KEYFRAME {@link TemplateAnimationFrame.composition}
|
|
707
|
+
* (the per-stop operator); this is the whole-animation composite the engine
|
|
708
|
+
* carries off `extractAnimationOptions`'s `composition` field. Omission means
|
|
709
|
+
* `replace` (the CSS default — the serializer omits it). value.js 0.13.0's
|
|
710
|
+
* `CSSAnimationOptions.composition` surfaces it; `fromString` reads it here.
|
|
711
|
+
*/
|
|
712
|
+
composite?: CompositeOperator;
|
|
713
|
+
/**
|
|
714
|
+
* `animation-iteration-composite` (CSS Animations L2). BOOKED, not
|
|
715
|
+
* implemented: the L2 draft marks this property experimental — there is no
|
|
716
|
+
* stable value.js parse for it and no honoring path in the engine. The field
|
|
717
|
+
* is a typed `never` placeholder (a named tripwire): a future
|
|
718
|
+
* silently-WRONG implementation that tries to assign anything to it reddens
|
|
719
|
+
* the type check, forcing the implementation to land alongside a real
|
|
720
|
+
* `proof:iteration-composite-baseline` gate rather than sliding in unproven.
|
|
721
|
+
*/
|
|
722
|
+
iterationComposite?: never;
|
|
781
723
|
};
|
|
782
724
|
|
|
783
725
|
declare namespace AnimationPresets {
|
|
@@ -787,7 +729,7 @@ declare namespace AnimationPresets {
|
|
|
787
729
|
pulse,
|
|
788
730
|
shake,
|
|
789
731
|
bounce,
|
|
790
|
-
|
|
732
|
+
flipPreset,
|
|
791
733
|
rotateIn,
|
|
792
734
|
slideIn,
|
|
793
735
|
heartbeat,
|
|
@@ -830,6 +772,10 @@ declare namespace AnimationPresets {
|
|
|
830
772
|
}
|
|
831
773
|
}
|
|
832
774
|
|
|
775
|
+
export { AnimationRangeValue }
|
|
776
|
+
|
|
777
|
+
export { AnimationTimelineValue }
|
|
778
|
+
|
|
833
779
|
/** Attention animations — a one-shot nudge to draw the eye. */
|
|
834
780
|
declare const attentionPresets: {
|
|
835
781
|
readonly pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -851,6 +797,111 @@ declare const blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimatio
|
|
|
851
797
|
|
|
852
798
|
declare const bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
853
799
|
|
|
800
|
+
/** The compile result — the artifact + the CC-3 ineligibility report. */
|
|
801
|
+
export declare interface CompiledCSS {
|
|
802
|
+
/**
|
|
803
|
+
* The zero-runtime CSS artifact — `@keyframes` blocks + `.class { animation }`
|
|
804
|
+
* rules. Empty string when EVERY child refused (then `refusals` carries the
|
|
805
|
+
* whole story).
|
|
806
|
+
*/
|
|
807
|
+
css: string;
|
|
808
|
+
/**
|
|
809
|
+
* True iff EVERY walked child compiled faithfully. False when one or more
|
|
810
|
+
* refused — `refusals` names each, and the JS playback is the only faithful
|
|
811
|
+
* path for those.
|
|
812
|
+
*/
|
|
813
|
+
eligible: boolean;
|
|
814
|
+
/** The CC-3 refusals — one per child that could not compile faithfully. */
|
|
815
|
+
refusals: CompileRefusal[];
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** The input shapes `compileToCSS` accepts. */
|
|
819
|
+
export declare type CompileInput<V extends Vars = any> = AnimationGroup<V> | Sequence<V> | ReadonlyArray<KeyframesAnimation<V> | {
|
|
820
|
+
animation: KeyframesAnimation<V>;
|
|
821
|
+
}>;
|
|
822
|
+
|
|
823
|
+
/** Options for {@link compileToCSS}. */
|
|
824
|
+
export declare interface CompileOptions {
|
|
825
|
+
/**
|
|
826
|
+
* Per-child stagger delays (ms), index-aligned with the walked children —
|
|
827
|
+
* the materialized output of `stagger.delays(total)`. CC-1 emits these as
|
|
828
|
+
* literal per-child `animation-delay`, expressing an eased origin-aware
|
|
829
|
+
* curve `sibling-index()` cannot (the universal literal-delay form;
|
|
830
|
+
* `@supports (sibling-index)` is CC-6 BOOK, not the default).
|
|
831
|
+
*/
|
|
832
|
+
staggerDelays?: readonly number[];
|
|
833
|
+
/**
|
|
834
|
+
* CC-2 — the oklab densify stop count (the N intermediate `oklab()` stops
|
|
835
|
+
* baked per color segment, INCLUSIVE of endpoints). Default
|
|
836
|
+
* {@link DEFAULT_DENSIFY_STOPS}. Raise it for a longer color arc; the ΔE
|
|
837
|
+
* proof decides ship-vs-refuse.
|
|
838
|
+
*/
|
|
839
|
+
densifyStops?: number;
|
|
840
|
+
/**
|
|
841
|
+
* CC-2 — the ΔE-ε ship-vs-refuse threshold (the perceptual-distance band the
|
|
842
|
+
* densified `oklab()` stops must hold against kf's JS lerp). Default
|
|
843
|
+
* {@link DEFAULT_DELTA_E_EPSILON}. A track whose densify exceeds this REFUSES
|
|
844
|
+
* with the perceptual-oklab reason (a drifting densify is worse than an
|
|
845
|
+
* honest refusal).
|
|
846
|
+
*/
|
|
847
|
+
deltaEEpsilon?: number;
|
|
848
|
+
/** Prettier print-width for the emitted artifact. Omit for the default. */
|
|
849
|
+
printWidth?: number;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/** A single refusal — the child name + a typed reason + a human message. */
|
|
853
|
+
export declare interface CompileRefusal {
|
|
854
|
+
/** The compiled child's class/animation name. */
|
|
855
|
+
name: string;
|
|
856
|
+
reason: CompileRefusalReason;
|
|
857
|
+
/** The verbatim message the demo's ineligibility UI shows (CC-4). */
|
|
858
|
+
message: string;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* The reason a child could not compile faithfully. Generalizes
|
|
863
|
+
* `waapiIneligibleReason` to the CSS-compile domain — the trust surface. Each
|
|
864
|
+
* names the kf axis that exceeds pure CSS (the refusal is marketing for the
|
|
865
|
+
* moat). A refused child's JS playback is the only faithful path.
|
|
866
|
+
*/
|
|
867
|
+
export declare type CompileRefusalReason = "weighted-blend" | "custom-renderer" | "perceptual-oklab" | "computed-unit-drift";
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* The COMPILER surface (L.W7 S3 `loadCompiler()`) — the engine core PLUS the
|
|
871
|
+
* round-trip's BACKWARD half, `compileToCSS`. A consumer compiling an
|
|
872
|
+
* orchestration graph to zero-runtime CSS pays for `engine` + `compile`, not
|
|
873
|
+
* the ingest / motion / draw / preset weight.
|
|
874
|
+
*/
|
|
875
|
+
export declare interface CompilerSurface extends EngineCore {
|
|
876
|
+
compileToCSS: typeof compileToCSS;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* THE compiler (CC-1/CC-2/CC-3) — compile an orchestration graph to zero-runtime
|
|
881
|
+
* CSS. Walks the input (`AnimationGroup` / `Sequence` / child list), emits one
|
|
882
|
+
* `@keyframes` + one `animation` shorthand per child (the `replace`/`add`
|
|
883
|
+
* layering as `animation-composition`, springs as `linear()`, stagger delays
|
|
884
|
+
* materialized, computed units verbatim, color tracks densified into perceptual
|
|
885
|
+
* `oklab()` stops under the ΔE-ε proof), and REFUSES with a NAMED reason what
|
|
886
|
+
* cannot compile faithfully (CC-3 — the replay-equality invariant's honest
|
|
887
|
+
* refusal). The result is async because `formatCSS` (Prettier) is.
|
|
888
|
+
*
|
|
889
|
+
* @returns `{ css, eligible, refusals }` — the artifact + the trust surface.
|
|
890
|
+
*/
|
|
891
|
+
declare function compileToCSS<V extends Vars>(input: CompileInput<V>, opts?: CompileOptions): Promise<CompiledCSS>;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* The CSS `animation-composition` operator (K.W7). Distinct from
|
|
895
|
+
* {@link BlendMode} (the GROUP's per-LAYER blend tier — `replace`/`add`/
|
|
896
|
+
* `weighted`): this is the per-KEYFRAME composite operator the author declares
|
|
897
|
+
* on a single animation, matching the CSS grammar exactly (`weighted` is not a
|
|
898
|
+
* CSS composite; `accumulate` is the repeat-aware one CSS adds). The engine
|
|
899
|
+
* routes `add`/`accumulate` onto the SAME un-clamped numeric leaf the group's
|
|
900
|
+
* `add` layer runs (`group.ts`), so the two tiers share one accumulation
|
|
901
|
+
* semantic without sharing a type.
|
|
902
|
+
*/
|
|
903
|
+
declare type CompositeOperator = "replace" | "add" | "accumulate";
|
|
904
|
+
|
|
854
905
|
/**
|
|
855
906
|
* Feature-detect (`"ScrollTimeline" in window` / `"ViewTimeline" in window`)
|
|
856
907
|
* and construct a NATIVE `AnimationTimeline` for the additive WAAPI scroll
|
|
@@ -870,7 +921,22 @@ declare const bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation
|
|
|
870
921
|
*/
|
|
871
922
|
export declare function createNativeTimeline(spec: NativeTimelineSpec): AnimationTimeline | null;
|
|
872
923
|
|
|
873
|
-
|
|
924
|
+
/**
|
|
925
|
+
* Construct a `ScrollScene` from a parsed `CSSTimelineOptions` (the SO-1 parse
|
|
926
|
+
* output) OR a direct `ScrollSceneOptions` spec. The CSS-fed construction is the
|
|
927
|
+
* round-trip's driving half (parse → drive); the spec-fed construction is
|
|
928
|
+
* value.js-INDEPENDENT (it needs no grammar — only the physics primitives).
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* // CSS-fed (value.js-gated parse → JS driver):
|
|
932
|
+
* const opts = parseScrollCSS(stylesheet);
|
|
933
|
+
* const scene = createScrollScene({ range: opts.range, scrub: 0.2 });
|
|
934
|
+
* // spec-fed (value.js-independent):
|
|
935
|
+
* const scene = createScrollScene({ range: { start: { offset: "0%" }, end: { offset: "100%" } } });
|
|
936
|
+
*/
|
|
937
|
+
declare function createScrollScene(spec?: ScrollSceneOptions | CSSTimelineOptions): ScrollScene;
|
|
938
|
+
|
|
939
|
+
export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnimation<V> {
|
|
874
940
|
constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
|
|
875
941
|
/**
|
|
876
942
|
* One transform-resolution seam for the three `from*` entry points:
|
|
@@ -890,23 +956,37 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V
|
|
|
890
956
|
* flag) without re-parsing the source CSS.
|
|
891
957
|
*/
|
|
892
958
|
propertyRegistry: Map<string, PropertyDescriptor_2>;
|
|
893
|
-
fromString(keyframes: string, transform?: TransformFunction<V>): this;
|
|
894
959
|
/**
|
|
895
|
-
*
|
|
896
|
-
* `
|
|
897
|
-
* `fromString
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
*
|
|
903
|
-
*
|
|
904
|
-
* Baseline 2024-07-09 (newly available — feature-detect mandatory).
|
|
960
|
+
* Parsed scroll-grammar (`animation-timeline` / `animation-range` /
|
|
961
|
+
* `timeline-scope` / `animation-trigger`) recovered from a sibling style rule
|
|
962
|
+
* by `fromString` (L.W2 S1 — CC-6) via `recoverScrollOptions` (the
|
|
963
|
+
* CSS-metadata-recovery seam); `undefined` when the input carried no scroll
|
|
964
|
+
* grammar (the canonical time-clock animation). A read-only metadata field —
|
|
965
|
+
* no hot-path impact, analogous to {@link propertyRegistry}. The compiler
|
|
966
|
+
* (`compileToCSS`) reads it to EMIT the scroll longhands back out, closing the
|
|
967
|
+
* round-trip's EMIT half.
|
|
905
968
|
*/
|
|
906
|
-
|
|
969
|
+
scrollOptions?: CSSTimelineOptions;
|
|
970
|
+
fromString(keyframes: string, transform?: TransformFunction<V>): this;
|
|
907
971
|
transform(vars: V): void;
|
|
908
972
|
}
|
|
909
973
|
|
|
974
|
+
declare function CSSKeyframesToString<V extends Vars>(animation: KeyframesAnimation<V>, name?: string, printWidth?: number | undefined): Promise<string>;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Per-stop card serializer for the editor pane — ONE formatted keyframe
|
|
978
|
+
* string per DECLARED template stop, index-aligned with
|
|
979
|
+
* `animation.templateFrames` (the pairing the card list renders by).
|
|
980
|
+
* Unified onto the declared-template authority (J.W1 S1): each card is
|
|
981
|
+
* {@link declaredKeyframeBody} — the AUTHORED values. The former path mapped
|
|
982
|
+
* `animation.frames` (the interp PAIRS — N−1 segments for N stops, so the
|
|
983
|
+
* last card simply did not exist) and read `frame.flatVars` (DOM-resolved,
|
|
984
|
+
* interp-mutated) — both defects die with the unification.
|
|
985
|
+
*/
|
|
986
|
+
declare const CSSKeyframesToStrings: <V extends Vars>(animation: KeyframesAnimation<V>) => Promise<string[]>;
|
|
987
|
+
|
|
988
|
+
export { CSSTimelineOptions }
|
|
989
|
+
|
|
910
990
|
/**
|
|
911
991
|
* The closed-form frictional glide. Given a release `velocity` `v0`, an
|
|
912
992
|
* `initial` position `x0`, and a `friction` `k`, returns a pure sampler
|
|
@@ -974,8 +1054,60 @@ export declare interface DecaySample {
|
|
|
974
1054
|
velocity: number;
|
|
975
1055
|
}
|
|
976
1056
|
|
|
1057
|
+
/**
|
|
1058
|
+
* A structured parse/honoring diagnostic (K.W7 S4). Extends the value.js
|
|
1059
|
+
* `ParseDiagnostic` producer (the CONSUMED shape — `message`/`offset`/`line`/
|
|
1060
|
+
* `column`/`expected`/`input`) with a stable kf-side {@link DiagnosticCode} and
|
|
1061
|
+
* an optional `property` (the leaf a `COMPOSITION_FALLBACK` names). The
|
|
1062
|
+
* value.js half (`message`/`offset`/…) is `Partial` because the engine-internal
|
|
1063
|
+
* rows (EMPTY_PARSE, COMPOSITION_FALLBACK) are NOT byte-offset parse failures —
|
|
1064
|
+
* they carry a `message` + `code` only; a row sourced from the value.js
|
|
1065
|
+
* `OnParseError` producer carries the full positional record. NOT a kf-local
|
|
1066
|
+
* re-author of the producer: it CONSUMES `ParseDiagnostic`'s field shape and
|
|
1067
|
+
* widens it with the stable code (inv-16 published-only consumption holds).
|
|
1068
|
+
*/
|
|
1069
|
+
declare interface Diagnostic extends Partial<ParseDiagnostic> {
|
|
1070
|
+
/** A stable, branch-on-able code — never scrape `message`. */
|
|
1071
|
+
code: DiagnosticCode;
|
|
1072
|
+
/** The human-readable summary (always present; the producer's or kf's). */
|
|
1073
|
+
message: string;
|
|
1074
|
+
/** The CSS property a `COMPOSITION_FALLBACK` refuses to composite. */
|
|
1075
|
+
property?: string;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* The stable diagnostic `code`s the kf-side sink emits (K.W7 S4). A FLAT,
|
|
1080
|
+
* additive enum — NOT a logging framework — so a programmatic consumer branches
|
|
1081
|
+
* on the reason without scraping a message string (the J.W1 typed-throw idiom
|
|
1082
|
+
* lifted onto the structured field). The engine-internal rows
|
|
1083
|
+
* (`EMPTY_PARSE`/`UNKNOWN_TIMING_FN`) were J.W1-landed as typed throws; W7 lifts
|
|
1084
|
+
* them onto this field. `COMPOSITION_FALLBACK` is the K.W7 honesty row (the
|
|
1085
|
+
* non-numeric composite leaf's refusal). `PARSE_ERROR` carries the value.js
|
|
1086
|
+
* `OnParseError` producer's structured diagnostic verbatim. The CORS-skip /
|
|
1087
|
+
* WAAPI-reason rows are AUTHORED here but POPULATED by K.W8 (which owns the
|
|
1088
|
+
* CSSOM walk that produces them).
|
|
1089
|
+
*/
|
|
1090
|
+
declare type DiagnosticCode = "EMPTY_PARSE" | "UNKNOWN_TIMING_FN" | "COMPOSITION_FALLBACK" | "PARSE_ERROR" | "CORS_SKIP" | "WAAPI_INELIGIBLE" | "ADOPT_REFUSE";
|
|
1091
|
+
|
|
977
1092
|
declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
|
|
978
1093
|
|
|
1094
|
+
/**
|
|
1095
|
+
* SO-1/SO-2 the DISPATCH (conservative-correct, with a queryable reason). The
|
|
1096
|
+
* WAAPI-eligibility seam pointed at the scroll clock:
|
|
1097
|
+
*
|
|
1098
|
+
* DOM target + WAAPI-eligible + native ScrollTimeline present + NO scrub/snap/
|
|
1099
|
+
* velocity → NATIVE (zero main-thread)
|
|
1100
|
+
* scrub OR snap OR velocity requested → JS (native has no smoother/snap)
|
|
1101
|
+
* non-DOM target / no animation → JS (the universal driver)
|
|
1102
|
+
* WAAPI-ineligible (computed unit / color / custom curve) → JS (the ineligible set)
|
|
1103
|
+
* native ScrollTimeline ABSENT (Firefox, jsdom, SSR) → JS (createNativeTimeline → null)
|
|
1104
|
+
*
|
|
1105
|
+
* The JS path NEVER deletes the native lane and the native path NEVER swallows
|
|
1106
|
+
* an ineligible animation — the reason string is the honesty surface (the
|
|
1107
|
+
* `waapiIneligibleReason` idiom). This ADDS a tier; it deletes no driver.
|
|
1108
|
+
*/
|
|
1109
|
+
declare function dispatchScrollBackend<V extends Vars>(request: ScrollDispatchRequest<V>): ScrollDispatch;
|
|
1110
|
+
|
|
979
1111
|
/**
|
|
980
1112
|
* Functional sugar over {@link Draggable}: construct, `attach(element)`,
|
|
981
1113
|
* and return the instance — the one-call front door for the common case.
|
|
@@ -985,6 +1117,69 @@ declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate
|
|
|
985
1117
|
*/
|
|
986
1118
|
export declare function drag(element: HTMLElement, options?: DragOptions): Draggable;
|
|
987
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* Construct a 2-D drag — two one-axis {@link Draggable}s (one per axis), a
|
|
1122
|
+
* shared subscriber that emits `(x, y, vx, vy)` whenever either axis updates,
|
|
1123
|
+
* and a unified `dispose()`. KISS: the 1-D engine stays 1-D; this is additive
|
|
1124
|
+
* sugar that wires the composition the caller would otherwise hand-roll.
|
|
1125
|
+
*
|
|
1126
|
+
* `options.x` / `options.y` are independent {@link DragOptions} — `bounds`,
|
|
1127
|
+
* `rubberBand`, and `snap` pass through PER AXIS (e.g. bound `x` to the
|
|
1128
|
+
* viewport width and `y` to its height separately). The `axis` field of each
|
|
1129
|
+
* is FORCED (`x` → `"x"`, `y` → `"y"`); any author `axis` is ignored.
|
|
1130
|
+
*/
|
|
1131
|
+
export declare function drag2D(element: HTMLElement, options?: {
|
|
1132
|
+
x?: DragOptions;
|
|
1133
|
+
y?: DragOptions;
|
|
1134
|
+
}): Drag2DHandle;
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* The 2-D drag sugar — two one-axis {@link Draggable}s composed behind a
|
|
1138
|
+
* single `(x, y, vx, vy)` surface. Split out of `drag.ts` (the 1-D engine)
|
|
1139
|
+
* as additive sugar: the engine stays one-dimensional (KISS); this module is
|
|
1140
|
+
* the front door that spares every 2-D consumer the two-`Draggable`
|
|
1141
|
+
* boilerplate. LIGHT — it imports only `Draggable` + `DragOptions` from
|
|
1142
|
+
* `./drag`, so it carries zero static `@mkbabb/value.js` edge.
|
|
1143
|
+
*
|
|
1144
|
+
* Re-exported THROUGH `drag.ts` so the barrel `export { drag, Draggable,
|
|
1145
|
+
* drag2D } from "./drag"` keeps resolving unchanged.
|
|
1146
|
+
*/
|
|
1147
|
+
/**
|
|
1148
|
+
* The composite handle a {@link drag2D} returns — two one-axis `Draggable`s
|
|
1149
|
+
* wired behind a single `(x, y, vx, vy)` subscriber and a unified dispose.
|
|
1150
|
+
* Sugar only: the 1-D engine stays 1-D (KISS); this is the front door that
|
|
1151
|
+
* spares every 2-D consumer the two-Draggable boilerplate.
|
|
1152
|
+
*/
|
|
1153
|
+
export declare interface Drag2DHandle {
|
|
1154
|
+
/** The x-axis `Draggable` (tracks `clientX`). */
|
|
1155
|
+
readonly x: Draggable;
|
|
1156
|
+
/** The y-axis `Draggable` (tracks `clientY`). */
|
|
1157
|
+
readonly y: Draggable;
|
|
1158
|
+
/**
|
|
1159
|
+
* Current `(x, y)` position. While an axis is dragging this is the live
|
|
1160
|
+
* pointer-pinned target; otherwise the spring's settled / in-flight value.
|
|
1161
|
+
*/
|
|
1162
|
+
readonly value: {
|
|
1163
|
+
x: number;
|
|
1164
|
+
y: number;
|
|
1165
|
+
};
|
|
1166
|
+
/** Current `(vx, vy)` velocity (units/s). */
|
|
1167
|
+
readonly velocity: {
|
|
1168
|
+
x: number;
|
|
1169
|
+
y: number;
|
|
1170
|
+
};
|
|
1171
|
+
/** True when BOTH axes have settled. */
|
|
1172
|
+
readonly settled: boolean;
|
|
1173
|
+
/**
|
|
1174
|
+
* Subscribe to `(x, y, vx, vy)` emissions — fires whenever EITHER axis
|
|
1175
|
+
* updates (live drag follow + post-release fling). Returns an unsubscribe
|
|
1176
|
+
* handle.
|
|
1177
|
+
*/
|
|
1178
|
+
subscribe(fn: (x: number, y: number, vx: number, vy: number) => void): () => void;
|
|
1179
|
+
/** Remove all listeners and dispose both `Draggable`s. */
|
|
1180
|
+
dispose(): void;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
988
1183
|
/**
|
|
989
1184
|
* The single scalar axis a {@link Draggable} tracks. A 2-D drag composes
|
|
990
1185
|
* two `Draggable`s (one per axis) — the engine stays one-dimensional, the
|
|
@@ -1011,6 +1206,12 @@ export declare class Draggable {
|
|
|
1011
1206
|
private readonly axis;
|
|
1012
1207
|
private readonly transform;
|
|
1013
1208
|
private readonly velocityWindow;
|
|
1209
|
+
/** Hard `[min, max]` value-domain constraint, or `undefined` (free). */
|
|
1210
|
+
private readonly bounds;
|
|
1211
|
+
/** Rubber-band resistance over `bounds` (only consulted when bounds set). */
|
|
1212
|
+
private readonly rubberBand;
|
|
1213
|
+
/** Snap targets in the value domain, or `undefined` (no snap). */
|
|
1214
|
+
private readonly snap;
|
|
1014
1215
|
private element;
|
|
1015
1216
|
private capturedPointerId;
|
|
1016
1217
|
/** Rolling pointer samples for release-velocity estimation. */
|
|
@@ -1059,7 +1260,18 @@ export declare class Draggable {
|
|
|
1059
1260
|
private coordOf;
|
|
1060
1261
|
private handleDown;
|
|
1061
1262
|
private handleMove;
|
|
1263
|
+
/**
|
|
1264
|
+
* Map a raw value-domain coordinate through {@link bounds} +
|
|
1265
|
+
* {@link rubberBand}. With no bounds the coordinate passes through. Below
|
|
1266
|
+
* `min`: `min + (value − min)·rubberBand`. Above `max`: `max +
|
|
1267
|
+
* (value − max)·rubberBand`. In range: the coordinate unchanged. At
|
|
1268
|
+
* `rubberBand = 0` the value is hard-clamped to the limit; at `1` the band
|
|
1269
|
+
* is fully transparent (pass-through).
|
|
1270
|
+
*/
|
|
1271
|
+
private applyBounds;
|
|
1062
1272
|
private handleUp;
|
|
1273
|
+
/** The snap target nearest `value` (ties → the first encountered). */
|
|
1274
|
+
private nearestSnap;
|
|
1063
1275
|
/**
|
|
1064
1276
|
* End the current gesture: release capture + remove the per-gesture
|
|
1065
1277
|
* listeners. Idempotent — safe when no gesture is active.
|
|
@@ -1106,6 +1318,33 @@ export declare interface DragOptions {
|
|
|
1106
1318
|
* 100ms.
|
|
1107
1319
|
*/
|
|
1108
1320
|
velocityWindow?: number;
|
|
1321
|
+
/**
|
|
1322
|
+
* Hard constraint on the value domain `[min, max]`. The drag cannot pull
|
|
1323
|
+
* the spring target beyond these limits (a clamp in value domain, BEFORE
|
|
1324
|
+
* the rubber-band factor). When omitted the drag is unconstrained — the
|
|
1325
|
+
* mapped coordinate goes straight to the spring target as before.
|
|
1326
|
+
*/
|
|
1327
|
+
bounds?: {
|
|
1328
|
+
min: number;
|
|
1329
|
+
max: number;
|
|
1330
|
+
};
|
|
1331
|
+
/**
|
|
1332
|
+
* Rubber-band resistance factor in `[0, 1]`. When the mapped pointer
|
|
1333
|
+
* coordinate exceeds {@link bounds}, the spring target is set to the
|
|
1334
|
+
* boundary + (excess × `rubberBand`) — the pointer coordinate decays
|
|
1335
|
+
* toward the limit rather than being hard-clamped. Default `0.4` (the
|
|
1336
|
+
* Motion / iOS spring-overscroll feel); `0` is a hard clamp, `1` is
|
|
1337
|
+
* pass-through (unconstrained). Has no effect when `bounds` is omitted.
|
|
1338
|
+
*/
|
|
1339
|
+
rubberBand?: number;
|
|
1340
|
+
/**
|
|
1341
|
+
* Snap targets in the value domain. On release, the spring's projected
|
|
1342
|
+
* resting point (via {@link decayRest}) selects the nearest target; the
|
|
1343
|
+
* spring is reseated toward that target rather than decelerating freely.
|
|
1344
|
+
* {@link bounds} (if set) apply AFTER snap selection — a snap target
|
|
1345
|
+
* outside bounds is clamped to the bound. Omitted / empty = no snap.
|
|
1346
|
+
*/
|
|
1347
|
+
snap?: number[];
|
|
1109
1348
|
}
|
|
1110
1349
|
|
|
1111
1350
|
/**
|
|
@@ -1230,6 +1469,31 @@ export declare interface ElementMorphOptions {
|
|
|
1230
1469
|
transformOrigin?: string;
|
|
1231
1470
|
}
|
|
1232
1471
|
|
|
1472
|
+
/**
|
|
1473
|
+
* The engine CORE surface — `Animation` / `CSSKeyframesAnimation` /
|
|
1474
|
+
* `AnimationGroup` + the timing/keyframe helpers + the option constants. This
|
|
1475
|
+
* is `./engine`'s own runtime exports: parse + interpolate WITHOUT the
|
|
1476
|
+
* ingest / compile / motion-path / draw-svg / animate / preset front doors. The
|
|
1477
|
+
* granular `loadEngine()` (L.W7 S3) resolves exactly this — a consumer that
|
|
1478
|
+
* needs only `new CSSKeyframesAnimation(opts).fromString(css)` pays for the
|
|
1479
|
+
* `engine` chunk alone, not the eight-chunk full surface.
|
|
1480
|
+
*/
|
|
1481
|
+
export declare interface EngineCore {
|
|
1482
|
+
/** The core engine constructor (PKG-3, L.W8 §S4 — renamed from `Animation`). */
|
|
1483
|
+
KeyframesAnimation: typeof KeyframesAnimation;
|
|
1484
|
+
/** @deprecated Use {@link KeyframesAnimation}. Backward-compat alias (PKG-3). */
|
|
1485
|
+
Animation: typeof KeyframesAnimation;
|
|
1486
|
+
CSSKeyframesAnimation: typeof CSSKeyframesAnimation;
|
|
1487
|
+
AnimationGroup: typeof AnimationGroup;
|
|
1488
|
+
getAnimationId: (animation: KeyframesAnimation | string) => string;
|
|
1489
|
+
getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
|
|
1490
|
+
resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
|
|
1491
|
+
DIRECTIONS: readonly AnimationOptions["direction"][];
|
|
1492
|
+
FILL_MODES: readonly AnimationOptions["fillMode"][];
|
|
1493
|
+
defaultOptions: AnimationOptions;
|
|
1494
|
+
defaultLayerConfig: AnimationLayerConfig;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1233
1497
|
/** Entrance animations — bring an element INTO view. */
|
|
1234
1498
|
declare const enterPresets: {
|
|
1235
1499
|
readonly fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -1254,6 +1518,28 @@ declare const exitPresets: {
|
|
|
1254
1518
|
readonly jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1255
1519
|
};
|
|
1256
1520
|
|
|
1521
|
+
/**
|
|
1522
|
+
* `explain(css, opts?)` — the human/LLM-readable companion. Calls
|
|
1523
|
+
* {@link validate} and formats the result as a concise, DETERMINISTIC string
|
|
1524
|
+
* (field order fixed, no locale-sensitive formatting) so a doctest can assert it
|
|
1525
|
+
* byte-for-byte. The shape the demo's ineligibility panel produces, as a
|
|
1526
|
+
* first-class library API. An LLM agent can present it verbatim or parse it for a
|
|
1527
|
+
* fix suggestion.
|
|
1528
|
+
*
|
|
1529
|
+
* Format (one block; the `–` bullets enumerate the refusals / WAAPI reason /
|
|
1530
|
+
* diagnostics, each on its own line):
|
|
1531
|
+
*
|
|
1532
|
+
* @keyframes color-drift:
|
|
1533
|
+
* parseable: yes
|
|
1534
|
+
* compile-eligible: no
|
|
1535
|
+
* – perceptual-oklab: color-drift cannot compile: …
|
|
1536
|
+
* waapi-eligible: no
|
|
1537
|
+
* – color interpolation requires perceptual lerp
|
|
1538
|
+
* diagnostics:
|
|
1539
|
+
* – COMPOSITION_FALLBACK: …
|
|
1540
|
+
*/
|
|
1541
|
+
declare function explain(css: string, opts?: ValidateOptions): Promise<string>;
|
|
1542
|
+
|
|
1257
1543
|
declare const fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1258
1544
|
|
|
1259
1545
|
declare const fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -1271,8 +1557,6 @@ declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
|
|
|
1271
1557
|
*/
|
|
1272
1558
|
export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): Promise<void>;
|
|
1273
1559
|
|
|
1274
|
-
declare const flip_2: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1275
|
-
|
|
1276
1560
|
export declare interface FlipOptions {
|
|
1277
1561
|
/** Playback duration in milliseconds. Defaults to `300`. */
|
|
1278
1562
|
duration?: number;
|
|
@@ -1285,6 +1569,22 @@ export declare interface FlipOptions {
|
|
|
1285
1569
|
transformOrigin?: string;
|
|
1286
1570
|
}
|
|
1287
1571
|
|
|
1572
|
+
/**
|
|
1573
|
+
* The card-flip attention preset.
|
|
1574
|
+
*
|
|
1575
|
+
* ── PKG-3 RENAME (L.W8 §S4 · audit W126). Formerly the preset `flip`. Renamed
|
|
1576
|
+
* `flip` → `flipPreset` because the rolled-up `dist/keyframes.d.ts` placed this
|
|
1577
|
+
* preset (reachable as `presets.flip`) and the LIGHT top-level `flip` export
|
|
1578
|
+
* (the FLIP-layout helper in `flip.ts`) under the same name `flip`, so API
|
|
1579
|
+
* Extractor renamed this one with a numeric suffix and re-exported it under the
|
|
1580
|
+
* `flip` name inside the `AnimationPresets` namespace — a numeric-suffixed alias
|
|
1581
|
+
* `proof:pkg3-clean` greps for. Naming the preset `flipPreset` (distinct from the
|
|
1582
|
+
* light `flip`) clears the collision. BREAKING (5.0.0): the access path is now
|
|
1583
|
+
* `presets.flipPreset`; the nested taxonomy key `attentionPresets.flip` is
|
|
1584
|
+
* unchanged (a property name, not a top-level declaration — no collision).
|
|
1585
|
+
*/
|
|
1586
|
+
declare const flipPreset: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1587
|
+
|
|
1288
1588
|
/**
|
|
1289
1589
|
* Shared-element FLIP: animate element `a` onto the rect of element `b`
|
|
1290
1590
|
* (Motion's `layoutId` / GSAP Flip shared-element style). Unlike `flip`, `a`
|
|
@@ -1301,6 +1601,8 @@ export declare interface FlipOptions {
|
|
|
1301
1601
|
*/
|
|
1302
1602
|
export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): Promise<void>;
|
|
1303
1603
|
|
|
1604
|
+
declare function formatCSSKeyframeString(keyframe: string): string;
|
|
1605
|
+
|
|
1304
1606
|
declare class FrameCompiler<V extends Vars = any> {
|
|
1305
1607
|
private readonly _options;
|
|
1306
1608
|
templateFrames: TemplateAnimationFrame<V>[];
|
|
@@ -1334,7 +1636,7 @@ declare class FrameCompiler<V extends Vars = any> {
|
|
|
1334
1636
|
* invariant — G.W19 / the `6e29236` lock), without poking a private field.
|
|
1335
1637
|
*/
|
|
1336
1638
|
get options(): AnimationOptions;
|
|
1337
|
-
addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"]): void;
|
|
1639
|
+
addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): void;
|
|
1338
1640
|
createFrame(startIx: number, endIx: number): AnimationFrame<V>;
|
|
1339
1641
|
/**
|
|
1340
1642
|
* Build an index mapping each variable name to the frame indices where
|
|
@@ -1409,15 +1711,63 @@ declare class FrameCompiler<V extends Vars = any> {
|
|
|
1409
1711
|
declare function fromDrawSVG<V extends Record<string, any> = any>(target: SVGDrawTarget, options?: DrawSVGOptions): CSSKeyframesAnimation<V>;
|
|
1410
1712
|
|
|
1411
1713
|
/**
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1714
|
+
* K1 — `fromLiveAnimations`: adopt every RUNNING CSS animation on the document
|
|
1715
|
+
* (or a single element) by reconstructing each from its source `@keyframes`
|
|
1716
|
+
* RULE (via the CSSOM walk — NOT from `getAnimations().getKeyframes()`, the
|
|
1717
|
+
* computed form that has lost `var()`/`cqw`/oklab). The `getAnimations()` read
|
|
1718
|
+
* provides the SET of live animation names; the reconstruction provides the
|
|
1719
|
+
* authored keyframes. The result maps each live animation name → its
|
|
1720
|
+
* reconstructed kf object (the recovered, axis-preserving source).
|
|
1721
|
+
*
|
|
1722
|
+
* Distinct from {@link fromStyleSheets} (which walks EVERY declared `@keyframes`
|
|
1723
|
+
* rule, running or not): `fromLiveAnimations` narrows to the names currently
|
|
1724
|
+
* RUNNING on the page — the animations a user actually sees in motion.
|
|
1725
|
+
*/
|
|
1726
|
+
declare const fromLiveAnimations: <V extends Vars = any>(target?: Document | Element, options?: IngestOptions) => IngestResult<V>;
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* Build an SVG path-shape morph: sample two `d` strings at `samples` uniform
|
|
1730
|
+
* arc-length steps each, pair the point sets, and interpolate the `(x, y)`
|
|
1731
|
+
* pairs from the `from`-polyline (`0%`) to the `to`-polyline (`100%`). Returns
|
|
1732
|
+
* the constructed {@link CSSKeyframesAnimation} as the control handle (the
|
|
1733
|
+
* `animate()` contract — `.play()` / `.pause()` / `.stop()` / `.finished`),
|
|
1734
|
+
* consistent with the `from*` factory family.
|
|
1735
|
+
*
|
|
1736
|
+
* value.js's `PathGeometry` owns the geometry (the `d`-parse + arc-length
|
|
1737
|
+
* table, built ONCE per path at construction); the engine's native numeric
|
|
1738
|
+
* `lerp` traverses the per-point coordinate keys. The morphed `d` at any `t` is
|
|
1739
|
+
* reassembled from the interpolated points — read it via the `MorphSVG` class's
|
|
1740
|
+
* {@link MorphSVG.sampleD}.
|
|
1741
|
+
*
|
|
1742
|
+
* Refuses a degenerate input: a zero-length `from` or `to` path throws a typed
|
|
1743
|
+
* {@link AnimationOptionError} rather than faking a silent zero-frame / identity
|
|
1744
|
+
* morph (the honest-or-refuse law — a morph between a zero-length path and
|
|
1745
|
+
* anything is a malformed input, not a morph).
|
|
1746
|
+
*
|
|
1747
|
+
* @param from the source SVG path `d` string.
|
|
1748
|
+
* @param to the target SVG path `d` string (differing geometry).
|
|
1749
|
+
* @param options `{ samples?, target?, autoPlay?, ...animationOptions }`.
|
|
1750
|
+
*
|
|
1751
|
+
* @example
|
|
1752
|
+
* // Morph a triangle into a square over 1s:
|
|
1753
|
+
* const m = fromMorphSVG(
|
|
1754
|
+
* "M 0 0 L 100 0 L 50 100 Z",
|
|
1755
|
+
* "M 0 0 L 100 0 L 100 100 L 0 100 Z",
|
|
1756
|
+
* { duration: 1000 },
|
|
1757
|
+
* );
|
|
1758
|
+
*/
|
|
1759
|
+
declare function fromMorphSVG<V extends Record<string, any> = any>(from: string, to: string, options?: MorphSVGOptions): CSSKeyframesAnimation<V>;
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Build a CSS-native path-motion animation: set the author `offset-path` (and
|
|
1763
|
+
* optional `offset-rotate`) on the target(s), and sweep `offset-distance` from
|
|
1764
|
+
* → to. Returns the constructed {@link CSSKeyframesAnimation} as the control
|
|
1765
|
+
* handle (the `animate()` contract — `.play()` / `.pause()` / `.stop()` / the
|
|
1766
|
+
* awaitable play promise), consistent with the `from*` factory family.
|
|
1767
|
+
*
|
|
1768
|
+
* The returned animation passes the EXISTING WAAPI eligibility gate
|
|
1769
|
+
* (`isWAAPIEligible`) for a DOM target with a uniform CSS-twin easing, and
|
|
1770
|
+
* delegates compositor-thread via `playWAAPI` — no new eligibility predicate.
|
|
1421
1771
|
*
|
|
1422
1772
|
* @param target one or more DOM elements (or a single element) to move.
|
|
1423
1773
|
* @param options `{ path, from?, to?, rotate?, ...animationOptions }`.
|
|
@@ -1432,6 +1782,21 @@ declare function fromDrawSVG<V extends Record<string, any> = any>(target: SVGDra
|
|
|
1432
1782
|
*/
|
|
1433
1783
|
declare function fromMotionPath<V extends Record<string, any> = any>(target: HTMLElement | HTMLElement[], options: MotionPathOptions): CSSKeyframesAnimation<V>;
|
|
1434
1784
|
|
|
1785
|
+
/**
|
|
1786
|
+
* K1 — `fromStyleSheets`: the consumer-facing front door over
|
|
1787
|
+
* {@link resolveLiveKeyframes}. Walk the document's (or the given list's)
|
|
1788
|
+
* stylesheets and return every reconstructed `@keyframes` animation. The honest
|
|
1789
|
+
* `CORS_SKIP`/`PARSE_ERROR` rows ride the returned {@link IngestResult}.
|
|
1790
|
+
*
|
|
1791
|
+
* @example
|
|
1792
|
+
* const { CSSKeyframesAnimation, fromStyleSheets } = await loadAnimationEngine();
|
|
1793
|
+
* const { animations, diagnostics } = fromStyleSheets();
|
|
1794
|
+
* const pulse = animations.get("pulse")?.animation;
|
|
1795
|
+
* pulse?.setTargets(el).play(); // re-drive the page's OWN animation
|
|
1796
|
+
* for (const d of diagnostics) console.warn(d.code, d.message); // honest skips
|
|
1797
|
+
*/
|
|
1798
|
+
declare const fromStyleSheets: <V extends Vars = any>(source?: Document | ShadowRoot | CSSStyleSheet[] | CSSStyleSheet, options?: IngestOptions) => IngestResult<V>;
|
|
1799
|
+
|
|
1435
1800
|
declare const glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1436
1801
|
|
|
1437
1802
|
declare const gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -1440,6 +1805,85 @@ declare const heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimat
|
|
|
1440
1805
|
|
|
1441
1806
|
declare const hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1442
1807
|
|
|
1808
|
+
/**
|
|
1809
|
+
* One ingested animation + the diagnostics its reconstruction produced. The
|
|
1810
|
+
* `name` is the `@keyframes` identifier (the CSSOM `CSSKeyframesRule.name`); the
|
|
1811
|
+
* `animation` is the reconstructed `CSSKeyframesAnimation`, already carrying any
|
|
1812
|
+
* sibling-style-rule `animation-*` options. `diagnostics` carries the honesty
|
|
1813
|
+
* rows for THIS rule (a malformed body → `PARSE_ERROR`, etc.); the walk-level
|
|
1814
|
+
* rows (`CORS_SKIP`) ride {@link IngestResult.diagnostics}.
|
|
1815
|
+
*/
|
|
1816
|
+
export declare interface IngestedAnimation<V extends Vars = any> {
|
|
1817
|
+
/** The `@keyframes` identifier (CSSOM `CSSKeyframesRule.name`). */
|
|
1818
|
+
name: string;
|
|
1819
|
+
/** The reconstructed kf animation — replay-equal to the source CSS. */
|
|
1820
|
+
animation: CSSKeyframesAnimation<V>;
|
|
1821
|
+
/** Per-rule reconstruction diagnostics (empty on a clean ingest). */
|
|
1822
|
+
diagnostics: Diagnostic[];
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
/** Options shared by the ingest entry points. */
|
|
1826
|
+
export declare interface IngestOptions {
|
|
1827
|
+
/**
|
|
1828
|
+
* Restrict the ingest to a single `@keyframes` name. When set, only the
|
|
1829
|
+
* matching rule is reconstructed (the rest are skipped without a
|
|
1830
|
+
* diagnostic — a name filter is an intentional narrowing, not a failure).
|
|
1831
|
+
*/
|
|
1832
|
+
animationName?: string;
|
|
1833
|
+
/**
|
|
1834
|
+
* Animation options applied as the BASE for each reconstructed animation,
|
|
1835
|
+
* BELOW any sibling-style-rule `animation-*` declarations the source CSS
|
|
1836
|
+
* carries (the source's declared options win — the round-trip preserves the
|
|
1837
|
+
* AUTHORED timing). Empty by default.
|
|
1838
|
+
*/
|
|
1839
|
+
options?: Partial<InputAnimationOptions>;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* The result of a CSSOM walk: every `@keyframes` rule reconstructed into a kf
|
|
1844
|
+
* animation, plus the WALK-LEVEL diagnostics (the `CORS_SKIP` rows a
|
|
1845
|
+
* cross-origin sheet produces — the honesty surface S3). A consumer reads
|
|
1846
|
+
* `animations` for the recovered objects and `diagnostics` for the citable
|
|
1847
|
+
* reasons the walk could not complete a step faithfully — NEVER a silent drop.
|
|
1848
|
+
*/
|
|
1849
|
+
export declare interface IngestResult<V extends Vars = any> {
|
|
1850
|
+
/** Every `@keyframes` rule reconstructed, keyed by its CSS name. */
|
|
1851
|
+
animations: Map<string, IngestedAnimation<V>>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Walk-level diagnostics — the `CORS_SKIP` rows (a cross-origin sheet whose
|
|
1854
|
+
* `cssRules` throws `SecurityError`) and any other reason the walk could not
|
|
1855
|
+
* read a sheet. A typed {@link Diagnostic}[] on the same stable-`code` idiom
|
|
1856
|
+
* as `resolveKeyframes`; empty when every sheet was same-origin + parsed.
|
|
1857
|
+
*/
|
|
1858
|
+
diagnostics: Diagnostic[];
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* The INGEST surface (L.W7 S3 `loadIngest()`) — the engine core PLUS the
|
|
1863
|
+
* forward-pointed live-web walk (`fromStyleSheets` / `fromLiveAnimations` /
|
|
1864
|
+
* `resolveLiveKeyframes` / `adoptRunning`) and the scroll-grammar round-trip
|
|
1865
|
+
* (`ScrollScene` + `parseScrollCSS` / `serializeScrollOptions` / …). A
|
|
1866
|
+
* consumer ingesting CSSOM / adopting a running animation / driving a scroll
|
|
1867
|
+
* scene pays for `engine` + `ingest` + `scroll-scene`, not the compile /
|
|
1868
|
+
* motion / draw / preset weight.
|
|
1869
|
+
*/
|
|
1870
|
+
export declare interface IngestSurface extends EngineCore {
|
|
1871
|
+
fromStyleSheets: typeof fromStyleSheets;
|
|
1872
|
+
fromLiveAnimations: typeof fromLiveAnimations;
|
|
1873
|
+
resolveLiveKeyframes: typeof resolveLiveKeyframes;
|
|
1874
|
+
adoptRunning: typeof adoptRunning;
|
|
1875
|
+
ScrollScene: typeof ScrollScene;
|
|
1876
|
+
createScrollScene: typeof createScrollScene;
|
|
1877
|
+
parseScrollCSS: typeof parseScrollCSS;
|
|
1878
|
+
parseScrollTimeline: typeof parseScrollTimeline;
|
|
1879
|
+
parseScrollRange: typeof parseScrollRange;
|
|
1880
|
+
serializeScrollOptions: typeof serializeScrollOptions;
|
|
1881
|
+
roundTripScrollCSS: typeof roundTripScrollCSS;
|
|
1882
|
+
dispatchScrollBackend: typeof dispatchScrollBackend;
|
|
1883
|
+
resolveRange: typeof resolveRange;
|
|
1884
|
+
pinCSS: typeof pinCSS;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1443
1887
|
export declare type InputAnimationOptions = Partial<{
|
|
1444
1888
|
duration: number | string;
|
|
1445
1889
|
delay: number | string;
|
|
@@ -1453,6 +1897,8 @@ export declare type InputAnimationOptions = Partial<{
|
|
|
1453
1897
|
respectReducedMotion: boolean;
|
|
1454
1898
|
colorSpace?: ColorSpace;
|
|
1455
1899
|
hueMethod?: HueInterpolationMethod;
|
|
1900
|
+
/** The LAYER-level `animation-composition` operator (L.W1 S5). Omission ⇒ `replace`. */
|
|
1901
|
+
composite?: CompositeOperator;
|
|
1456
1902
|
}>;
|
|
1457
1903
|
|
|
1458
1904
|
export { InterpolatedVar }
|
|
@@ -1465,25 +1911,460 @@ declare const jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation
|
|
|
1465
1911
|
export declare type KeyframeMap<V extends Vars> = Map<string, Partial<V>> | Record<string, Partial<V>>;
|
|
1466
1912
|
|
|
1467
1913
|
/**
|
|
1468
|
-
*
|
|
1469
|
-
* `CSSKeyframesAnimation`, `AnimationGroup`, `getTimingFunction`,
|
|
1470
|
-
* `resolveKeyframes`, and the animation-options constants (`DIRECTIONS`,
|
|
1471
|
-
* `FILL_MODES`, `defaultOptions`, `defaultLayerConfig`).
|
|
1914
|
+
* The core animation engine — keyframes, timing, interpolation, playback.
|
|
1472
1915
|
*
|
|
1473
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
* (
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
|
|
1916
|
+
* ── PKG-3 RENAME (L.W8 §S4 · audit W126). Formerly `Animation`; renamed to
|
|
1917
|
+
* `KeyframesAnimation` because the old name collided with the ambient
|
|
1918
|
+
* `globalThis.Animation` (WAAPI), leaking a numeric-suffixed collision alias
|
|
1919
|
+
* into the d.ts roll-up (packaging-k.md:118-127). The old `Animation` name
|
|
1920
|
+
* survives as a backward-compat RE-EXPORT alias (value + type) below — see the
|
|
1921
|
+
* `@deprecated` `Animation` export for the full rationale. Gated by
|
|
1922
|
+
* `proof:pkg3-clean`. The runtime constructor is `KeyframesAnimation`.
|
|
1923
|
+
*/
|
|
1924
|
+
declare class KeyframesAnimation<V extends Vars = any> {
|
|
1925
|
+
id: number;
|
|
1926
|
+
name: string | undefined;
|
|
1927
|
+
superKey: string | undefined;
|
|
1928
|
+
targets: HTMLElement[];
|
|
1929
|
+
options: AnimationOptions;
|
|
1930
|
+
/**
|
|
1931
|
+
* The frame-compilation half — template frames → sampled `frames[]`.
|
|
1932
|
+
* `Animation` composes one and delegates `addFrame`/`parse` + the frame
|
|
1933
|
+
* accessors (`templateFrames`/`parsedVars`/`frames`/`frameId`) to it.
|
|
1934
|
+
* Assigned in the constructor once `options` exists (the compiler holds a
|
|
1935
|
+
* live reference to that options object).
|
|
1936
|
+
*
|
|
1937
|
+
* READ-ONLY surface (G.W19): the backing `_compiler` is written ONLY by the
|
|
1938
|
+
* constructor and {@link adoptCompiled}. An external `animation.compiler = …`
|
|
1939
|
+
* write was the one cross-boundary reach-in vector that could desync the
|
|
1940
|
+
* live-options reference (`this.options !== this.compiler.options`); making
|
|
1941
|
+
* `compiler` a get-only accessor makes that reach-in a COMPILE error, not a
|
|
1942
|
+
* convention. Adopt a compiled state via `adoptCompiled(source)`.
|
|
1943
|
+
*/
|
|
1944
|
+
private _compiler;
|
|
1945
|
+
get compiler(): FrameCompiler<V>;
|
|
1946
|
+
/**
|
|
1947
|
+
* THE rAF owner for this animation — the standalone rAF play loop and
|
|
1948
|
+
* the WAAPI shadow tick both ride it, so `stop()` halts either
|
|
1949
|
+
* uniformly and no raw rAF handle leaks onto the instance.
|
|
1950
|
+
*/
|
|
1951
|
+
readonly playback: RAFPlayback;
|
|
1952
|
+
/**
|
|
1953
|
+
* The live WAAPI compositor animations during a `_playWAAPI` delegation
|
|
1954
|
+
* (one per target), populated by `playWAAPI` and cleared on teardown.
|
|
1955
|
+
* The lifecycle methods (`stop`/`reset`) cancel these so a stopped
|
|
1956
|
+
* compositor animation never keeps painting and the awaited play
|
|
1957
|
+
* promise never hangs. Empty on the rAF path.
|
|
1958
|
+
*/
|
|
1959
|
+
_waAnimations: globalThis.Animation[];
|
|
1960
|
+
startTime: number | undefined;
|
|
1961
|
+
pausedTime: number;
|
|
1962
|
+
t: number;
|
|
1963
|
+
iteration: number;
|
|
1964
|
+
/**
|
|
1965
|
+
* Structured parse/honoring diagnostics (K.W7 S4) — surfaced from the
|
|
1966
|
+
* adapter's `resolveKeyframes` ({@link CSSKeyframesAnimation.fromString})
|
|
1967
|
+
* and joined by the engine's own composition-fallback rows. A FLAT additive
|
|
1968
|
+
* array of stable-coded {@link Diagnostic} rows; empty on a clean parse with
|
|
1969
|
+
* no fallback. Every SILENT fallback site is mirrored here — the honesty
|
|
1970
|
+
* surface (`proof:diagnostics-channel`). Queryable; no console output.
|
|
1971
|
+
*/
|
|
1972
|
+
diagnostics: Diagnostic[];
|
|
1973
|
+
/**
|
|
1974
|
+
* The captured UNDERLYING base value for each composited leaf (K.W7 S1),
|
|
1975
|
+
* keyed by the flat property key — the per-element numeric base the
|
|
1976
|
+
* `add`/`accumulate` operator accumulates ONTO (snapshotted the first time a
|
|
1977
|
+
* composited leaf is applied). Empty for a pure-`replace` animation (the
|
|
1978
|
+
* zero-overhead path). The capture/accumulate logic lives in
|
|
1979
|
+
* `./engine-composition` ({@link applyComposition}/`captureUnderlyingBase`).
|
|
1980
|
+
*/
|
|
1981
|
+
private _compositionBase;
|
|
1982
|
+
/** Properties whose non-numeric composite already emitted its
|
|
1983
|
+
* `COMPOSITION_FALLBACK` row — so a long playback emits the honesty row
|
|
1984
|
+
* ONCE per property, not once per frame (S3/S4). */
|
|
1985
|
+
private _compositionFallbackSeen;
|
|
1986
|
+
/** True once `fromString`/`addFrame` saw a non-`replace` operator — the hot
|
|
1987
|
+
* path skips ALL composition work when this is false (the predictable
|
|
1988
|
+
* per-animation-constant branch the §gate's clause (f) measures free). */
|
|
1989
|
+
private _hasComposition;
|
|
1990
|
+
started: boolean;
|
|
1991
|
+
done: boolean;
|
|
1992
|
+
reversed: boolean;
|
|
1993
|
+
paused: boolean;
|
|
1994
|
+
/**
|
|
1995
|
+
* True when an `AnimationGroup` is driving this animation's
|
|
1996
|
+
* `advanceTo()` and `interpFrames()` from its own rAF loop. Set by
|
|
1997
|
+
* the group at construction; standalone `.play()` / `.draw()`
|
|
1998
|
+
* throw when this is true rather than racing the group.
|
|
1999
|
+
*/
|
|
2000
|
+
managed: boolean;
|
|
2001
|
+
/**
|
|
2002
|
+
* If the most recent `play()` was rejected by WAAPI eligibility
|
|
2003
|
+
* but `useWAAPI: true` was requested, this records the reason.
|
|
2004
|
+
* Queryable by debug builds — no console output is produced.
|
|
2005
|
+
*/
|
|
2006
|
+
waapiIneligibleReason: string | undefined;
|
|
2007
|
+
unflatten: boolean;
|
|
2008
|
+
private resolvePromise;
|
|
2009
|
+
private _playingPromise;
|
|
2010
|
+
/**
|
|
2011
|
+
* Pre-bound frame callback — allocated once to avoid creating a new
|
|
2012
|
+
* closure on every playback loop start.
|
|
2013
|
+
*/
|
|
2014
|
+
private _boundFrame;
|
|
2015
|
+
/**
|
|
2016
|
+
* The ONE output buffer for the standalone play loop's `interpFrames`
|
|
2017
|
+
* calls — reused every frame so steady-state playback allocates no
|
|
2018
|
+
* per-frame result object (the primitive-level analogue of the group's
|
|
2019
|
+
* hoisted `_grouped` buffer, gated by `proof:standalone-zero-alloc`).
|
|
2020
|
+
* The play path (`_frame`) never returns this object to a consumer, so
|
|
2021
|
+
* reuse is safe; `at()` (a query whose result the caller keeps) still
|
|
2022
|
+
* allocates a fresh object.
|
|
2023
|
+
*/
|
|
2024
|
+
private _interpOut;
|
|
2025
|
+
/**
|
|
2026
|
+
* The compile-stable union of every frame's `flatVars` keys — the maximal
|
|
2027
|
+
* key-set any `interpFrames` call can write. Fixed at `parse` (the keys
|
|
2028
|
+
* never change across frames; a color-space renormalize re-derives the same
|
|
2029
|
+
* carriers under the same keys). It is what `clearBuffer` null-fills to keep
|
|
2030
|
+
* a reused buffer stale-free WITHOUT `delete` (F.W4 S1 — the V8 dictionary-
|
|
2031
|
+
* mode trap the delete-loop fell into). Exposed (read-only) as `flatKeys`
|
|
2032
|
+
* so the `AnimationGroup` can size its own composite buffer the same way.
|
|
2033
|
+
*/
|
|
2034
|
+
private _stableKeys;
|
|
2035
|
+
/**
|
|
2036
|
+
* The consumer's EXPLICIT constructor options (NOT merged with defaults) —
|
|
2037
|
+
* retained so `fromString` can layer a parsed style-rule `animation`
|
|
2038
|
+
* shorthand UNDER them (constructor-explicit wins over parsed-from-CSS, F.W8).
|
|
2039
|
+
*/
|
|
2040
|
+
protected _ctorOptions: Partial<InputAnimationOptions>;
|
|
2041
|
+
/** The compile-stable union of this animation's interpolated keys. */
|
|
2042
|
+
get flatKeys(): readonly string[];
|
|
2043
|
+
/**
|
|
2044
|
+
* The instance's ONE default DOM-style renderer, allocated once.
|
|
2045
|
+
* "Did the consumer supply a custom transform?" is a reference
|
|
2046
|
+
* comparison against this single value ({@link usesDefaultRenderer}) —
|
|
2047
|
+
* typed and bind-proof, unlike a Symbol tag on a closure, which
|
|
2048
|
+
* `Function.prototype.bind` silently drops.
|
|
2049
|
+
*/
|
|
2050
|
+
protected readonly _defaultTransform: TransformFunction<V>;
|
|
2051
|
+
/** True when `fn` is this instance's default DOM-style renderer. */
|
|
2052
|
+
usesDefaultRenderer(fn: TransformFunction<V> | undefined): boolean;
|
|
2053
|
+
private dispatchAnimationEvent;
|
|
2054
|
+
constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
|
|
2055
|
+
get templateFrames(): TemplateAnimationFrame<V>[];
|
|
2056
|
+
set templateFrames(value: TemplateAnimationFrame<V>[]);
|
|
2057
|
+
get parsedVars(): ParsedVarMap[];
|
|
2058
|
+
get frames(): AnimationFrame<V>[];
|
|
2059
|
+
get frameId(): number;
|
|
2060
|
+
/** Append a template frame (delegated to the compiler). Chainable. */
|
|
2061
|
+
addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): KeyframesAnimation<K>;
|
|
2062
|
+
/** Compile the template frames into the sampled `frames[]`. Chainable. */
|
|
2063
|
+
parse(): this;
|
|
2064
|
+
/**
|
|
2065
|
+
* Set `_hasComposition` (K.W7 S1) — true iff ANY compiled frame carries a
|
|
2066
|
+
* non-`replace` `animation-composition` operator (the hot-path branch reads
|
|
2067
|
+
* this ONE per-animation constant; a pure-`replace` animation never pays for
|
|
2068
|
+
* the composition work) — and reset the per-run base/fallback caches so a
|
|
2069
|
+
* re-parse re-snapshots the underlying base. See `./engine-composition`.
|
|
2070
|
+
*/
|
|
2071
|
+
private computeHasComposition;
|
|
2072
|
+
/**
|
|
2073
|
+
* Adopt another animation's ALREADY-COMPILED state as ONE atomic motion
|
|
2074
|
+
* (G.W19) — the first-class verb for the "single-compile, then transplant"
|
|
2075
|
+
* pattern (E.W8 S0): a throwaway animation is built + compiled ONCE off the
|
|
2076
|
+
* new keyframes, and the live animation adopts that compiled state without a
|
|
2077
|
+
* second compile.
|
|
2078
|
+
*
|
|
2079
|
+
* The transplant moves the `{ compiler, options, unflatten }` triad together
|
|
2080
|
+
* and re-binds the live-options reference BY CONSTRUCTION — `this.options` is
|
|
2081
|
+
* read OFF the adopted compiler, so `this.options === this.compiler.options`
|
|
2082
|
+
* holds without relying on the caller's assignment order. This is the
|
|
2083
|
+
* invariant the demo formerly held by a comment + three ordered field writes;
|
|
2084
|
+
* here it is the method's contract, enforced by `proof:adopt-compiled`. A
|
|
2085
|
+
* `compiler` adopted WITHOUT re-binding `options` would leave the setters
|
|
2086
|
+
* mutating one object while the compiler reads another — the exact desync
|
|
2087
|
+
* the `6e29236` live-options lock guards against.
|
|
2088
|
+
*
|
|
2089
|
+
* Recomputes `_stableKeys` so `flatKeys` (the buffer-sizing contract)
|
|
2090
|
+
* reflects the adopted compiled frames, not the pre-adopt key-set. Chainable.
|
|
2091
|
+
*
|
|
2092
|
+
* @param source an animation whose `compiler` is already compiled.
|
|
2093
|
+
*/
|
|
2094
|
+
adoptCompiled(source: KeyframesAnimation<V>): this;
|
|
2095
|
+
/**
|
|
2096
|
+
* Recompute `_stableKeys` — the union of every compiled frame's `flatVars`
|
|
2097
|
+
* keys — after a (re)compile. The maximal key-set the `clearBuffer`
|
|
2098
|
+
* null-fill resets, so a reused interpolation buffer stays in V8
|
|
2099
|
+
* fast-properties mode without ever calling `delete` (F.W4 S1).
|
|
2100
|
+
*/
|
|
2101
|
+
private computeStableKeys;
|
|
2102
|
+
/**
|
|
2103
|
+
* Option setters — the fail-explicit contract.
|
|
2104
|
+
*
|
|
2105
|
+
* Genuine omission (`undefined`/`null`) means "use the default" and is
|
|
2106
|
+
* always accepted; present-but-malformed input THROWS a typed
|
|
2107
|
+
* `AnimationOptionError` naming the option and the offending value.
|
|
2108
|
+
* This is the same posture the layer API chose ("silent no-ops were
|
|
2109
|
+
* hiding consumer bugs") applied to the whole options surface — no
|
|
2110
|
+
* silent fallback, no silently-preserved previous value.
|
|
2111
|
+
*/
|
|
2112
|
+
setTimingFunction(timingFunction: InputAnimationOptions["timingFunction"]): this;
|
|
2113
|
+
setIterationCount(iterationCount: InputAnimationOptions["iterationCount"]): this;
|
|
2114
|
+
setDuration(duration: InputAnimationOptions["duration"]): this;
|
|
2115
|
+
setDelay(delay: InputAnimationOptions["delay"]): this;
|
|
2116
|
+
setDirection(direction: InputAnimationOptions["direction"]): this;
|
|
2117
|
+
setFillMode(fillMode: InputAnimationOptions["fillMode"]): this;
|
|
2118
|
+
setUseWAAPI(useWAAPI: InputAnimationOptions["useWAAPI"]): this;
|
|
2119
|
+
setRespectReducedMotion(respectReducedMotion: InputAnimationOptions["respectReducedMotion"]): this;
|
|
2120
|
+
setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
|
|
2121
|
+
setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
|
|
2122
|
+
/**
|
|
2123
|
+
* Set the LAYER-level `animation-composition` operator (L.W1 S5, Band A).
|
|
2124
|
+
* Genuine omission (`undefined`) leaves the field unset — the serializer
|
|
2125
|
+
* treats it as the CSS default `replace` and omits the longhand. A present
|
|
2126
|
+
* value is stored verbatim (`replace` | `add` | `accumulate`), so a sibling
|
|
2127
|
+
* `.class { animation-composition: add }` ingested by `fromString`
|
|
2128
|
+
* round-trips on re-serialize.
|
|
2129
|
+
*/
|
|
2130
|
+
setComposite(composite: InputAnimationOptions["composite"]): this;
|
|
2131
|
+
setOptions(options: Partial<InputAnimationOptions>): this;
|
|
2132
|
+
reverse(): this;
|
|
2133
|
+
fillForwards(): void;
|
|
2134
|
+
fillBackwards(): void;
|
|
2135
|
+
/**
|
|
2136
|
+
* Where the playhead rests after a completed play — derived ONCE from
|
|
2137
|
+
* `fillMode` (forwards/both → final; none/backwards → initial). This is
|
|
2138
|
+
* the explicit rest-position contract: completion paints the rest frame
|
|
2139
|
+
* per this derivation, and the reduced-motion snap is "rest = final,
|
|
2140
|
+
* paint it, settle" — the same path a `fillMode: forwards` completion
|
|
2141
|
+
* takes, not a separate code path.
|
|
2142
|
+
*/
|
|
2143
|
+
get restPosition(): "initial" | "final";
|
|
2144
|
+
/** Paint the rest frame per the fill contract. */
|
|
2145
|
+
paintRest(): void;
|
|
2146
|
+
/**
|
|
2147
|
+
* Stateless progress query. Maps [0,1] from first keyframe to last,
|
|
2148
|
+
* regardless of playback direction. `apply=true` invokes transform callbacks.
|
|
2149
|
+
*/
|
|
2150
|
+
at(progress: number, apply?: boolean): Record<string, ValueUnit[]>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Interpolate all active frames at time `t`. This is the hot path —
|
|
2153
|
+
* called once per rAF frame during playback.
|
|
2154
|
+
*
|
|
2155
|
+
* Uses binary search (O(log N)) to find the first matching frame,
|
|
2156
|
+
* then scans neighbors to collect all overlapping frames at `t`
|
|
2157
|
+
* (multiple properties may share the same time range).
|
|
2158
|
+
*
|
|
2159
|
+
* @param t - Current animation time in milliseconds
|
|
2160
|
+
* @param transformFrames - If true, applies each frame's transform function to targets
|
|
2161
|
+
* @param out - Optional output object to write results into. When
|
|
2162
|
+
* provided, its keys are cleared first so no stale keys from a
|
|
2163
|
+
* previous call leak through. Pass this per-animation to achieve
|
|
2164
|
+
* zero-allocation steady-state playback.
|
|
2165
|
+
* @returns Merged flat vars from all active frames
|
|
2166
|
+
*/
|
|
2167
|
+
interpFrames(t: number, transformFrames?: boolean, out?: Record<string, ValueUnit[]>): Record<string, ValueUnit[]>;
|
|
2168
|
+
/**
|
|
2169
|
+
* Clear a reused interpolation buffer to a stale-free state WITHOUT
|
|
2170
|
+
* `delete` — the V8-correct stable-key null-fill (F.W4 S1). The key-set is
|
|
2171
|
+
* compile-stable (`_stableKeys` is the union of every frame's `flatVars`
|
|
2172
|
+
* keys, fixed at `parse`), so null-filling it keeps the buffer in
|
|
2173
|
+
* fast-properties mode AND zero-alloc. Inactive keys read back `undefined`;
|
|
2174
|
+
* every consumer of a reused buffer (the group blend, the unused play-loop
|
|
2175
|
+
* `_interpOut`) skips them — only the standalone return path (which never
|
|
2176
|
+
* reuses a buffer) must be `undefined`-free, and it takes the alias / fresh
|
|
2177
|
+
* merge above.
|
|
2178
|
+
*/
|
|
2179
|
+
private clearBuffer;
|
|
2180
|
+
/**
|
|
2181
|
+
* Interpolate ONE active frame at time `t` in place (lerp + optional
|
|
2182
|
+
* transform). Lifted off the `interpFrames` hot loop so playback allocates
|
|
2183
|
+
* no per-frame closure. A zero-width frame (`start === stop`, a degenerate
|
|
2184
|
+
* keyframe pair) snaps to the endpoint instead of dividing by zero in
|
|
2185
|
+
* `scale` (E-RT-5). The merge into the result buffer is done by the caller
|
|
2186
|
+
* (F.W4 S3 — so the single-frame path can alias `flatVars` with no copy).
|
|
2187
|
+
*/
|
|
2188
|
+
private processFrame;
|
|
2189
|
+
/**
|
|
2190
|
+
* Composite ONE frame's lerped numeric leaves onto the captured underlying
|
|
2191
|
+
* base per its `animation-composition` operator (K.W7 S1) — the thin engine
|
|
2192
|
+
* seam threading the live per-run state into the pure `./engine-composition`
|
|
2193
|
+
* honoring (where the un-clamped add, repeat-aware accumulate, captured base,
|
|
2194
|
+
* and non-numeric `replace`-fallback + `COMPOSITION_FALLBACK` row live).
|
|
2195
|
+
*/
|
|
2196
|
+
private applyComposition;
|
|
2197
|
+
/** SYNC unless `delay > 0` — then a thenable resolving after the sleep. */
|
|
2198
|
+
onStart(): Promise<void> | undefined;
|
|
2199
|
+
onEnd(): void;
|
|
2200
|
+
/**
|
|
2201
|
+
* Advance the playhead to absolute clock `t` (a rAF timestamp, NOT a
|
|
2202
|
+
* delta). Lazily runs `onStart` on the first call, reconciles the
|
|
2203
|
+
* pause/resume clock, and ends the iteration once `t` reaches the
|
|
2204
|
+
* duration. This is the DRIVER-layer advance — the one meaning of the
|
|
2205
|
+
* absolute-clock step, distinct from the `tickDt(dt)` stepper surface
|
|
2206
|
+
* the rest of the engine canonicalized to.
|
|
2207
|
+
*
|
|
2208
|
+
* SYNC on the steady path (J.W6 S1 — the F.W5 held half, landed): every
|
|
2209
|
+
* post-start frame returns a plain number (no per-frame promise+microtask
|
|
2210
|
+
* hop); a thenable ONLY when the FIRST tick awaits the genuinely-async
|
|
2211
|
+
* delay sleep. Ordering locked by proof:event-ordering.
|
|
2212
|
+
*/
|
|
2213
|
+
advanceTo(t: number): number | Promise<number>;
|
|
2214
|
+
/** The post-start advance body — pause clock, local time, iteration end. */
|
|
2215
|
+
private _advance;
|
|
2216
|
+
/**
|
|
2217
|
+
* One frame of the standalone rAF play path, driven by the shared
|
|
2218
|
+
* `RAFPlayback.loop`. Returns whether the loop should continue.
|
|
2219
|
+
*/
|
|
2220
|
+
private _frame;
|
|
2221
|
+
/** The post-advance render half of `_frame` — paint, or settle on done. */
|
|
2222
|
+
private _renderFrame;
|
|
2223
|
+
private _resolvePlay;
|
|
2224
|
+
/** Internal rAF-based play loop — loop ownership rides `this.playback`. */
|
|
2225
|
+
private _playRAF;
|
|
2226
|
+
/**
|
|
2227
|
+
* Play via the Web Animations API. WAAPI handles visuals on the
|
|
2228
|
+
* compositor thread; a shadow loop in `playWAAPI` (riding
|
|
2229
|
+
* `this.playback`) drives `advanceTo()` so events, iteration count,
|
|
2230
|
+
* pause/resume, and other lifecycle state stay coherent with the
|
|
2231
|
+
* rAF path.
|
|
2232
|
+
*
|
|
2233
|
+
* No silent fallback — eligibility is decided once in `play()`
|
|
2234
|
+
* before this is invoked, and runtime errors propagate.
|
|
2235
|
+
*/
|
|
2236
|
+
private _playWAAPI;
|
|
2237
|
+
/**
|
|
2238
|
+
* Cancel the live WAAPI compositor animations (if any). Cancelling
|
|
2239
|
+
* rejects each `wa.finished`, which `playWAAPI` catches as a halt — so
|
|
2240
|
+
* this both stops the compositor paint AND unblocks the awaited play
|
|
2241
|
+
* promise. No-op on the rAF path.
|
|
2242
|
+
*/
|
|
2243
|
+
private _cancelWAAPI;
|
|
2244
|
+
/**
|
|
2245
|
+
* `prefers-reduced-motion` snap: rest = final, paint it, settle — the
|
|
2246
|
+
* SAME terminal path a `fillMode: forwards` completion takes, with the
|
|
2247
|
+
* motion elided. The lifecycle stays observable (`animationstart` →
|
|
2248
|
+
* final paint → `animationend`) so consumers' event wiring is identical
|
|
2249
|
+
* to a completed normal play.
|
|
2250
|
+
*/
|
|
2251
|
+
private _playReducedMotion;
|
|
2252
|
+
/**
|
|
2253
|
+
* Mid-flight reduced-motion snap (D-LIB-3). A running rAF loop detected a
|
|
2254
|
+
* live flip to `reduce`; converge to the rest frame and resolve the
|
|
2255
|
+
* in-flight `play()` exactly as a forwards completion would. Distinct from
|
|
2256
|
+
* `_playReducedMotion` (the up-front gate) only in that `animationstart`
|
|
2257
|
+
* already fired — so here we paint final, mark done, end, settle, and
|
|
2258
|
+
* release the awaiter. The WAAPI lane snaps via the same path: the up-front
|
|
2259
|
+
* gate already routes reduced-motion away from WAAPI, and a live flip on a
|
|
2260
|
+
* WAAPI animation cancels the compositor handles before settling.
|
|
2261
|
+
*/
|
|
2262
|
+
private _snapToReducedMotion;
|
|
2263
|
+
/**
|
|
2264
|
+
* The completion front-door (G.W13) — `await anim.finished` resolves once
|
|
2265
|
+
* the in-flight play settles. It exposes the ONE held `_playingPromise`
|
|
2266
|
+
* `play()` already constructs (the re-entrant guard returns it; the
|
|
2267
|
+
* `finally`-clear nulls it on settle) — NOT a second completion lifecycle.
|
|
2268
|
+
* Two reads mid-play return the SAME promise. A settled (or never-played)
|
|
2269
|
+
* animation reads `null` and resolves immediately: "not running" = "nothing
|
|
2270
|
+
* to await" — the honest semantics for a getter that reports current
|
|
2271
|
+
* settledness, not a pre-armed future run.
|
|
2272
|
+
*/
|
|
2273
|
+
get finished(): Promise<void>;
|
|
2274
|
+
play(): Promise<void>;
|
|
2275
|
+
/**
|
|
2276
|
+
* Pause playback — idempotent. Pausing an already-paused (or
|
|
2277
|
+
* not-yet-started) animation is a no-op, never a resume: a method named
|
|
2278
|
+
* `pause` pauses. Use {@link resume} for the explicit resume.
|
|
2279
|
+
*/
|
|
2280
|
+
pause(): this;
|
|
2281
|
+
resume(): this;
|
|
2282
|
+
/** The explicit flip: pauses if playing, resumes if paused. */
|
|
2283
|
+
toggle(): this;
|
|
2284
|
+
/**
|
|
2285
|
+
* Halt playback where it stands: cancel the loop AND the WAAPI
|
|
2286
|
+
* compositor animations, settle state, and resolve any pending `play()`
|
|
2287
|
+
* promise. Never paints — `reset()` is the explicit rewind.
|
|
2288
|
+
*/
|
|
2289
|
+
stop(): void;
|
|
2290
|
+
playing(): boolean;
|
|
2291
|
+
/** Returns the effective time accounting for direction reversal. */
|
|
2292
|
+
get effectiveT(): number;
|
|
2293
|
+
/**
|
|
2294
|
+
* Pure state teardown — flags, clocks, iteration. NEVER paints. This is
|
|
2295
|
+
* the terminal half of the rest-position contract: completion paints
|
|
2296
|
+
* the rest frame (via `onEnd` → `paintRest`) and then settles; the
|
|
2297
|
+
* reduced-motion snap paints final and then settles. Settling is
|
|
2298
|
+
* orthogonal to where the pixels rest.
|
|
2299
|
+
*/
|
|
2300
|
+
settle(): this;
|
|
2301
|
+
/**
|
|
2302
|
+
* Explicit rewind: paint the INITIAL frame, then settle. This is the
|
|
2303
|
+
* user-facing "return to start" — rest position `initial`, painted
|
|
2304
|
+
* deliberately — distinct from `settle()`, which tears down state and
|
|
2305
|
+
* leaves the pixels where they rest.
|
|
2306
|
+
*/
|
|
2307
|
+
reset(): this;
|
|
2308
|
+
setTargets(...targets: HTMLElement[]): this;
|
|
2309
|
+
group(...animations: KeyframesAnimation<V>[]): AnimationGroup<V>;
|
|
2310
|
+
}
|
|
2311
|
+
export { KeyframesAnimation as Animation }
|
|
2312
|
+
export { KeyframesAnimation }
|
|
2313
|
+
|
|
2314
|
+
/**
|
|
2315
|
+
* The JS scroll-progress sampler.
|
|
1481
2316
|
*
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
2317
|
+
* ── PKG-3 RENAME (L.W8 §S4 · audit W126). Formerly `ScrollTimeline`. Renamed
|
|
2318
|
+
* `ScrollTimeline` → `KeyframesScrollTimeline` because the rolled-up d.ts
|
|
2319
|
+
* declaration `ScrollTimeline` collided with the ambient `globalThis.ScrollTimeline`
|
|
2320
|
+
* (the Houdini native scroll timeline): API Extractor renamed the colliding
|
|
2321
|
+
* source class and re-exported it under a numeric-suffixed alias that leaked
|
|
2322
|
+
* into IDE hover text. Naming the class `KeyframesScrollTimeline` (no ambient
|
|
2323
|
+
* collision) clears the rename; gated by `proof:pkg3-clean`. The old
|
|
2324
|
+
* `ScrollTimeline` name survives as a backward-compat RE-EXPORT alias (value +
|
|
2325
|
+
* type) — see the `@deprecated` `ScrollTimeline` export below; because the
|
|
2326
|
+
* canonical name no longer collides, API Extractor emits the alias cleanly
|
|
2327
|
+
* (`KeyframesScrollTimeline` exported under the `ScrollTimeline` name, no
|
|
2328
|
+
* numeric suffix).
|
|
1484
2329
|
*/
|
|
2330
|
+
declare class KeyframesScrollTimeline extends Timeline {
|
|
2331
|
+
private threshold;
|
|
2332
|
+
private getScrollY;
|
|
2333
|
+
private getViewportHeight;
|
|
2334
|
+
constructor(options?: KeyframesScrollTimelineOptions);
|
|
2335
|
+
protected sample(): number;
|
|
2336
|
+
}
|
|
2337
|
+
export { KeyframesScrollTimeline }
|
|
2338
|
+
export { KeyframesScrollTimeline as ScrollTimeline }
|
|
2339
|
+
|
|
2340
|
+
declare interface KeyframesScrollTimelineOptions extends TimelineOptions {
|
|
2341
|
+
/** Viewport fraction for full progress. Default 0.35. */
|
|
2342
|
+
threshold?: number | undefined;
|
|
2343
|
+
/** Custom scroll position supplier. Default: window.scrollY. */
|
|
2344
|
+
getScrollY?: (() => number) | undefined;
|
|
2345
|
+
/** Custom viewport height supplier. Default: window.innerHeight. */
|
|
2346
|
+
getViewportHeight?: (() => number) | undefined;
|
|
2347
|
+
}
|
|
2348
|
+
export { KeyframesScrollTimelineOptions }
|
|
2349
|
+
export { KeyframesScrollTimelineOptions as ScrollTimelineOptions }
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* Options for `AnimationGroup.transitionLayer` / `crossfade` (K.W11 PHYS-C).
|
|
2353
|
+
* The `spring` half is the {@link SpringProgressOptions} subset that shapes the
|
|
2354
|
+
* weight trajectory (`response`/`dampingFraction`/`bounce`-via-config); the
|
|
2355
|
+
* spring is ALWAYS seeded at the layer's CURRENT weight and targets the new
|
|
2356
|
+
* weight, so `initial`/`initialVelocity` are managed internally and excluded.
|
|
2357
|
+
*/
|
|
2358
|
+
declare type LayerTransitionSpring = Partial<Omit<SpringProgressOptions, "initial" | "initialVelocity">>;
|
|
2359
|
+
|
|
1485
2360
|
export declare const loadAnimationEngine: () => Promise<AnimationEngine>;
|
|
1486
2361
|
|
|
2362
|
+
export declare const loadCompiler: () => Promise<CompilerSurface>;
|
|
2363
|
+
|
|
2364
|
+
export declare const loadEngine: () => Promise<EngineCore>;
|
|
2365
|
+
|
|
2366
|
+
export declare const loadIngest: () => Promise<IngestSurface>;
|
|
2367
|
+
|
|
1487
2368
|
/** Looping animations — run continuously (`iterationCount: Infinity`). */
|
|
1488
2369
|
declare const loopPresets: {
|
|
1489
2370
|
readonly heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -1505,6 +2386,12 @@ export declare class ManualTimeline extends Timeline {
|
|
|
1505
2386
|
protected sample(): number;
|
|
1506
2387
|
}
|
|
1507
2388
|
|
|
2389
|
+
/** A sampled point on a path polyline. */
|
|
2390
|
+
export declare interface MorphPoint {
|
|
2391
|
+
x: number;
|
|
2392
|
+
y: number;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
1508
2395
|
export declare interface MorphRect {
|
|
1509
2396
|
x: number;
|
|
1510
2397
|
y: number;
|
|
@@ -1512,6 +2399,66 @@ export declare interface MorphRect {
|
|
|
1512
2399
|
height: number;
|
|
1513
2400
|
}
|
|
1514
2401
|
|
|
2402
|
+
/**
|
|
2403
|
+
* `MorphSVG` — the class form of {@link fromMorphSVG}, for callers who prefer a
|
|
2404
|
+
* named primitive alongside `CSSKeyframesAnimation` / `MotionPath` / `DrawSVG`.
|
|
2405
|
+
* Construction is the factory: `new MorphSVG(from, to).animation` is the control
|
|
2406
|
+
* handle. The factory is the canonical entry; this is a thin ergonomic wrapper
|
|
2407
|
+
* that ALSO exposes {@link sampleD} — the morphed `d` string at a normalized
|
|
2408
|
+
* `t`, reassembled from the interpolated point coordinates.
|
|
2409
|
+
*/
|
|
2410
|
+
declare class MorphSVG<V extends Record<string, any> = any> {
|
|
2411
|
+
/** The underlying coordinate-interpolating animation — the control handle. */
|
|
2412
|
+
readonly animation: CSSKeyframesAnimation<V>;
|
|
2413
|
+
/** The uniform-sample count (point pairs = samples + 1). */
|
|
2414
|
+
readonly samples: number;
|
|
2415
|
+
constructor(from: string, to: string, options?: MorphSVGOptions);
|
|
2416
|
+
/**
|
|
2417
|
+
* The morphed SVG path `d` string at a normalized `t` in `[0, 1]`, built
|
|
2418
|
+
* from the engine's interpolated point coordinates (`0` → the `from`
|
|
2419
|
+
* polyline, `1` → the `to` polyline, `0.5` → the point-wise midpoint). The
|
|
2420
|
+
* value a consumer renders (`<path d>` / a `d:` custom property), distinct
|
|
2421
|
+
* from BOTH endpoint polylines at any interior `t`.
|
|
2422
|
+
*/
|
|
2423
|
+
sampleD(t: number): string;
|
|
2424
|
+
/** Start (or re-enter) the morph play loop. */
|
|
2425
|
+
play(): Promise<void>;
|
|
2426
|
+
/** Pause the play loop, retaining the playhead. */
|
|
2427
|
+
pause(): this;
|
|
2428
|
+
/** Halt and rewind the play loop. */
|
|
2429
|
+
stop(): this;
|
|
2430
|
+
/** Resolve once the morph completes — the {@link Animation.finished} front-door. */
|
|
2431
|
+
get finished(): Promise<void>;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
export declare interface MorphSVGOptions extends Partial<InputAnimationOptions> {
|
|
2435
|
+
/**
|
|
2436
|
+
* The number of uniform arc-length steps each path is sampled at. The
|
|
2437
|
+
* morph emits `samples + 1` point-pairs (the endpoints inclusive), and the
|
|
2438
|
+
* MATCHED count between the `0%` and `100%` frames is what makes the
|
|
2439
|
+
* polyline channel interpolable. Default `64` — the keystone-validated
|
|
2440
|
+
* resolution. Must be an integer `>= 2` (a 1-sample "morph" is just the two
|
|
2441
|
+
* endpoints with no body); a smaller / non-integer value throws.
|
|
2442
|
+
*/
|
|
2443
|
+
samples?: number;
|
|
2444
|
+
/**
|
|
2445
|
+
* Optional target the morph drives. When given, the morph writes the
|
|
2446
|
+
* interpolated polyline `d` (`MorphSVG.sampleD`) onto the target's
|
|
2447
|
+
* `--morph-d` CSS custom property each frame so an author can render it
|
|
2448
|
+
* (e.g. `<path d="" style="d: var(--morph-d)">` or a JS reader). Default
|
|
2449
|
+
* target-less: the returned handle IS the control surface, exactly like
|
|
2450
|
+
* `fromDrawSVG`'s target-less form — `MorphSVG.sampleD(t)` reads the
|
|
2451
|
+
* morphed `d` directly without a DOM write.
|
|
2452
|
+
*/
|
|
2453
|
+
target?: HTMLElement | SVGElement;
|
|
2454
|
+
/**
|
|
2455
|
+
* Auto-start the play loop after construction + targeting. Default true.
|
|
2456
|
+
* `false` returns a constructed, NOT-yet-playing handle so the caller can
|
|
2457
|
+
* drive the returned animation (`.play()` / `.pause()` / `.stop()`).
|
|
2458
|
+
*/
|
|
2459
|
+
autoPlay?: boolean;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
1515
2462
|
declare interface MorphValues {
|
|
1516
2463
|
[key: string]: number;
|
|
1517
2464
|
translateX: number;
|
|
@@ -1575,6 +2522,14 @@ export declare interface MotionPathOptions extends Partial<InputAnimationOptions
|
|
|
1575
2522
|
autoPlay?: boolean;
|
|
1576
2523
|
}
|
|
1577
2524
|
|
|
2525
|
+
declare type NativeScrollAttachment = {
|
|
2526
|
+
attached: true;
|
|
2527
|
+
animations: globalThis.Animation[];
|
|
2528
|
+
} | {
|
|
2529
|
+
attached: false;
|
|
2530
|
+
reason: string;
|
|
2531
|
+
};
|
|
2532
|
+
|
|
1578
2533
|
/**
|
|
1579
2534
|
* Spec for the ADDITIVE native scroll-driven bridge (D-LIB-2 / F-5).
|
|
1580
2535
|
*
|
|
@@ -1687,10 +2642,153 @@ export declare type NumericFrameCallback<T extends Record<string, number>> = (va
|
|
|
1687
2642
|
*/
|
|
1688
2643
|
export declare type OffsetPath = string;
|
|
1689
2644
|
|
|
2645
|
+
/**
|
|
2646
|
+
* A periodic phase clock: a linear phase ramp ∈ [0, 1) advanced by
|
|
2647
|
+
* `frequency × dt` per {@link tick}, plus a pure {@link sample} that maps a raw
|
|
2648
|
+
* time to its waveform value WITHOUT touching the running phase.
|
|
2649
|
+
*
|
|
2650
|
+
* LIGHT (value.js-free) — plain trig/floor math, no CSS parsing, no rAF
|
|
2651
|
+
* ownership. The caller drives the loop (mirrors `SmoothProgress` /
|
|
2652
|
+
* `SpringProgress`): feed `dt` (seconds) from a `RAFPlayback` loop or a
|
|
2653
|
+
* `ScrollTimeline`, read {@link phase} (or {@link value}) per frame.
|
|
2654
|
+
*/
|
|
2655
|
+
export declare class Oscillator {
|
|
2656
|
+
private readonly frequency;
|
|
2657
|
+
private readonly waveform;
|
|
2658
|
+
/** The current phase ∈ [0, 1) — a linear ramp modulo 1 driven by {@link tick}. */
|
|
2659
|
+
phase: number;
|
|
2660
|
+
constructor(opts: OscillatorConfig);
|
|
2661
|
+
/**
|
|
2662
|
+
* Advance the phase by `frequency × dt` and wrap into [0, 1). Returns the
|
|
2663
|
+
* new phase. `dt` is in the caller's units (seconds for a `RAFPlayback`
|
|
2664
|
+
* frame, a normalized scroll delta for a `ScrollTimeline`); the consumer
|
|
2665
|
+
* owns the clock, so a negative `dt` runs the phase backward (and wraps
|
|
2666
|
+
* correctly, never going negative). No rAF — a pure stepper.
|
|
2667
|
+
*/
|
|
2668
|
+
tick(dt: number): number;
|
|
2669
|
+
/**
|
|
2670
|
+
* The waveform value of the CURRENT running phase ∈ [-1, 1]. A pure read
|
|
2671
|
+
* over {@link phase} — does not advance the clock. Pair with {@link tick}:
|
|
2672
|
+
* `osc.tick(dt); const v = osc.value;`.
|
|
2673
|
+
*/
|
|
2674
|
+
get value(): number;
|
|
2675
|
+
/**
|
|
2676
|
+
* Pure stateless sample: `t → waveform(t × frequency)`. Independent of the
|
|
2677
|
+
* running {@link phase} — it never reads or mutates it, so a consumer can
|
|
2678
|
+
* sample an absolute clock (`osc.sample(elapsedSeconds)`) without disturbing
|
|
2679
|
+
* a concurrently-`tick`ed phase. `t` is in the same units as `dt`.
|
|
2680
|
+
*/
|
|
2681
|
+
sample(t: number): number;
|
|
2682
|
+
/** Reset the running phase (default 0). Does not change frequency/waveform. */
|
|
2683
|
+
reset(phase?: number): void;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Construction options for {@link Oscillator}.
|
|
2688
|
+
*
|
|
2689
|
+
* Named `OscillatorConfig` (NOT `OscillatorOptions`, the `…Options` convention
|
|
2690
|
+
* of the sibling steppers) deliberately: the Web Audio API declares a GLOBAL
|
|
2691
|
+
* `interface OscillatorOptions` (`lib.dom.d.ts`), so an `OscillatorOptions`
|
|
2692
|
+
* source type collides with `globalThis.OscillatorOptions` in the API-Extractor
|
|
2693
|
+
* d.ts roll-up — it renames to `OscillatorOptions_2`, which leaks into every IDE
|
|
2694
|
+
* hover (the PKG-3 defect `proof:published-surface` clause (h) gates, the same
|
|
2695
|
+
* `globalThis.Animation`/`ScrollTimeline` collision L.W8 S4 renamed away). The
|
|
2696
|
+
* non-colliding `OscillatorConfig` keeps the surface clean.
|
|
2697
|
+
*/
|
|
2698
|
+
export declare interface OscillatorConfig {
|
|
2699
|
+
/**
|
|
2700
|
+
* Cycles per unit of `dt` — the phase advances `frequency × dt` per
|
|
2701
|
+
* {@link Oscillator.tick}. With `dt` in seconds a `frequency` of `1` is one
|
|
2702
|
+
* full cycle per second (1 Hz). Required; no implicit default rate.
|
|
2703
|
+
*/
|
|
2704
|
+
frequency: number;
|
|
2705
|
+
/**
|
|
2706
|
+
* The periodic shape `phase ∈ [0, 1) → value ∈ [-1, 1]` that
|
|
2707
|
+
* {@link Oscillator.sample} (and a consumer reading {@link Oscillator.phase}
|
|
2708
|
+
* through {@link waveformValue}) applies. Default `"sine"`.
|
|
2709
|
+
*/
|
|
2710
|
+
waveform?: OscillatorWaveform;
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* Oscillator — a LIGHT periodic phase clock (L.W9 S5 · W128 KF-OSCILLATOR).
|
|
2715
|
+
*
|
|
2716
|
+
* A frequency-driven phase ramp ∈ [0, 1) with a pure waveform shaper over it.
|
|
2717
|
+
* The boundary law places "playback/phase = kf", so the primitive belongs here
|
|
2718
|
+
* beside `SmoothProgress` / `SpringProgress` / `RAFPlayback`: it is a periodic
|
|
2719
|
+
* phase clock, NOT a CSS value parser, so it carries ZERO static edge to
|
|
2720
|
+
* `@mkbabb/value.js` (proof:boundary gates it as a value.js-free LIGHT entry).
|
|
2721
|
+
*
|
|
2722
|
+
* The consume signal is glass-ui BB's `W-EASING-PRIMITIVE` wave — its speedtest
|
|
2723
|
+
* idle-breath and the demo's `KF-OSCILLATOR` scene read the phase to drive a
|
|
2724
|
+
* looping motion. glass-ui co-schedules; kf owns the phase math
|
|
2725
|
+
* (`docs/tranches/L/waves/L.W9.md §S5`).
|
|
2726
|
+
*
|
|
2727
|
+
* NO rAF ownership — the caller drives the loop. `tick(dt)` advances the phase
|
|
2728
|
+
* by `frequency × dt` (with `dt` in SECONDS from the caller's `RAFPlayback`
|
|
2729
|
+
* loop or `ScrollTimeline`), mirroring the `SmoothProgress` / `SpringProgress`
|
|
2730
|
+
* stepper discipline (a pure step, the consumer owns the clock). `sample(t)` is
|
|
2731
|
+
* a stateless pure mapping `t → waveform(t × frequency)` — it never touches the
|
|
2732
|
+
* running phase, so the two surfaces are independent on the one primitive.
|
|
2733
|
+
*/
|
|
2734
|
+
/** The four canonical periodic waveforms the phase clock shapes a phase into. */
|
|
2735
|
+
export declare type OscillatorWaveform = "sine" | "triangle" | "square" | "sawtooth";
|
|
2736
|
+
|
|
1690
2737
|
declare const parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1691
2738
|
|
|
1692
2739
|
declare type ParsedVarMap = Record<string, ValueArray>;
|
|
1693
2740
|
|
|
2741
|
+
/**
|
|
2742
|
+
* SO-1 PARSE — extract the full scroll-grammar (`animation-timeline` /
|
|
2743
|
+
* `animation-range` / `timeline-scope` / `animation-trigger`) from a scroll-
|
|
2744
|
+
* driven stylesheet (string OR a pre-parsed `Stylesheet`) into a typed
|
|
2745
|
+
* `CSSTimelineOptions`. Consumes value.js 0.13.0's `extractTimelineOptions` over
|
|
2746
|
+
* the parsed stylesheet — the acyclic-spine consume edge (the grammar lives in
|
|
2747
|
+
* value.js, where the `animation-*` parsing already lives; kf re-derives no
|
|
2748
|
+
* parallel name table).
|
|
2749
|
+
*
|
|
2750
|
+
* @example
|
|
2751
|
+
* parseScrollCSS(`.card {
|
|
2752
|
+
* animation: reveal linear both;
|
|
2753
|
+
* animation-timeline: view();
|
|
2754
|
+
* animation-range: entry 0% cover 40%;
|
|
2755
|
+
* }`)
|
|
2756
|
+
* // → { timeline: { kind: "view" },
|
|
2757
|
+
* // range: { start: { phase: "entry", offset: "0%" },
|
|
2758
|
+
* // end: { phase: "cover", offset: "40%" } } }
|
|
2759
|
+
*/
|
|
2760
|
+
declare function parseScrollCSS(input: string | Stylesheet): CSSTimelineOptions;
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* Parse an `animation-range` shorthand (`entry 0% cover 40%`) to its typed
|
|
2764
|
+
* `{ start, end? }` form — a pass-through to value.js's `parseAnimationRange`.
|
|
2765
|
+
*/
|
|
2766
|
+
declare function parseScrollRange(input: string): AnimationRangeValue;
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* Parse a single `animation-timeline` value (`scroll(root block)`, `view()`,
|
|
2770
|
+
* `--named`, `auto`, `none`) to its typed form — a thin pass-through to
|
|
2771
|
+
* value.js's `parseAnimationTimeline` (kf consumes the VALUE grammar; it never
|
|
2772
|
+
* re-derives a local parser). Emits the value VERBATIM; resolves no defaults.
|
|
2773
|
+
*/
|
|
2774
|
+
declare function parseScrollTimeline(input: string): AnimationTimelineValue;
|
|
2775
|
+
|
|
2776
|
+
/**
|
|
2777
|
+
* SO-3 the `position:sticky` pin SYNTHESIS — EMIT the pin CSS (kf authors the
|
|
2778
|
+
* platform's pin; the browser pins on the compositor). The pin uses
|
|
2779
|
+
* `position:sticky`, NEVER `transform:translateY` (SO-4 KILLED — cross-thread
|
|
2780
|
+
* jitter). Returns a declaration block string the consumer applies to the
|
|
2781
|
+
* pinned element. `top` defaults to `0` (pin to the scrollport top).
|
|
2782
|
+
*
|
|
2783
|
+
* @example
|
|
2784
|
+
* pinCSS() // → "position: sticky; top: 0px;"
|
|
2785
|
+
* pinCSS({ top: 24 }) // → "position: sticky; top: 24px;"
|
|
2786
|
+
*/
|
|
2787
|
+
declare function pinCSS(opts?: {
|
|
2788
|
+
top?: number;
|
|
2789
|
+
bottom?: number;
|
|
2790
|
+
}): string;
|
|
2791
|
+
|
|
1694
2792
|
/**
|
|
1695
2793
|
* The full preset taxonomy, grouped by intent. Each leaf is one of the
|
|
1696
2794
|
* existing exported factory functions — the taxonomy is a discovery index over
|
|
@@ -1739,6 +2837,15 @@ declare const presetTaxonomy: {
|
|
|
1739
2837
|
};
|
|
1740
2838
|
};
|
|
1741
2839
|
|
|
2840
|
+
/**
|
|
2841
|
+
* Measure the instantaneous velocity (units/SECOND) of a position stream from
|
|
2842
|
+
* a two-sample {@link VelocityProbe} (K.W11 PHYS-B2). The forward difference
|
|
2843
|
+
* `(curr − prev) / dt` with `dt` in seconds. A zero / negative `dt` (two
|
|
2844
|
+
* samples at the same frame, or out-of-order) yields `0` — no division blow-up,
|
|
2845
|
+
* a stationary read.
|
|
2846
|
+
*/
|
|
2847
|
+
export declare function probeVelocity(probe: VelocityProbe): number;
|
|
2848
|
+
|
|
1742
2849
|
declare const progressBar: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1743
2850
|
|
|
1744
2851
|
declare const pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -1863,6 +2970,81 @@ export declare interface RAFPlaybackOptions {
|
|
|
1863
2970
|
|
|
1864
2971
|
declare const rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1865
2972
|
|
|
2973
|
+
export { RangeBoundary }
|
|
2974
|
+
|
|
2975
|
+
export { RangePhase }
|
|
2976
|
+
|
|
2977
|
+
/**
|
|
2978
|
+
* The reduced-motion policy a surface honors (K.W11 PHYS-E). The ONE gate
|
|
2979
|
+
* takes a SCALE, not just a boolean — WCAG 2.3.3-aligned ("shorten the
|
|
2980
|
+
* travel, keep the meaning"):
|
|
2981
|
+
*
|
|
2982
|
+
* - `false` / `undefined` — do not honor reduced motion (the conservative
|
|
2983
|
+
* default; the animation runs at full amplitude regardless of the OS query).
|
|
2984
|
+
* - `true` — the classic binary snap: under an active `prefers-reduced-motion:
|
|
2985
|
+
* reduce` the surface jumps to its terminal state (amplitude scale `0`).
|
|
2986
|
+
* - a `number` ∈ [0, 1] — the INTENSITY: under an active query the surface
|
|
2987
|
+
* scales its motion AMPLITUDE to this fraction (`0.3` → 30 % of the
|
|
2988
|
+
* displacement-from-rest) while preserving the trajectory shape, settle
|
|
2989
|
+
* time, and the opacity/color track. `1` ≈ full motion, `0` ≡ the binary
|
|
2990
|
+
* snap. The scale comes from the CONSUMER's policy (a settings slider, a
|
|
2991
|
+
* per-animation field) — the OS exposes only a binary signal; kf provides
|
|
2992
|
+
* the MECHANISM, the app provides the policy.
|
|
2993
|
+
*/
|
|
2994
|
+
export declare type ReducedMotionPolicy = boolean | number | undefined;
|
|
2995
|
+
|
|
2996
|
+
/**
|
|
2997
|
+
* Resolve a {@link ReducedMotionPolicy} to the AMPLITUDE SCALE ∈ [0, 1] a
|
|
2998
|
+
* stepper multiplies its displacement-from-rest by (K.W11 PHYS-E).
|
|
2999
|
+
*
|
|
3000
|
+
* - When reduced motion is NOT honored / NOT active → `1` (full amplitude).
|
|
3001
|
+
* - `respect === true` under an active query → `0` (the binary snap — zero
|
|
3002
|
+
* displacement, the classic behavior).
|
|
3003
|
+
* - `respect` a number under an active query → that number, clamped to
|
|
3004
|
+
* [0, 1] (the intensity).
|
|
3005
|
+
*
|
|
3006
|
+
* Off-DOM / no active query → always `1`, so SSR and a user without the
|
|
3007
|
+
* preference set are byte-unchanged. The analytic spring scales `(originValue
|
|
3008
|
+
* − targetValue)` by this factor at `evaluateAt`, so amplitude scaling is
|
|
3009
|
+
* EXACT and free — the envelope (curve shape + settle time) is preserved by
|
|
3010
|
+
* construction; only the peak displacement shrinks.
|
|
3011
|
+
*/
|
|
3012
|
+
export declare function reducedMotionScale(respect: ReducedMotionPolicy): number;
|
|
3013
|
+
|
|
3014
|
+
/**
|
|
3015
|
+
* Velocity-continuous interruption of a parsed-CSS (or any positional)
|
|
3016
|
+
* animation, re-served as a spring (K.W11 PHYS-B2 — the only-kf seam).
|
|
3017
|
+
*
|
|
3018
|
+
* At interruption the engine path carries a POSITION (`effectiveT` → the
|
|
3019
|
+
* interpolated value) but NO velocity — a keyframe stream has no analytic
|
|
3020
|
+
* derivative. This finite-differences the interp stream over the last frame
|
|
3021
|
+
* (the {@link VelocityProbe}: the two most recent `(value, time)` samples), then
|
|
3022
|
+
* seeds a fresh {@link SpringProgress} at the CURRENT position
|
|
3023
|
+
* (`probe.curr.value`) with that MEASURED velocity, targeting `newTarget`. The
|
|
3024
|
+
* first post-interruption frames therefore continue the prior direction and
|
|
3025
|
+
* speed within ε — no visible kink — instead of restarting from rest.
|
|
3026
|
+
*
|
|
3027
|
+
* The spring's `linear()` twin (`springTimingFunction` / `springLinearStops`)
|
|
3028
|
+
* is the SAME kf-internal emitter the compiler consumes, so the reseated
|
|
3029
|
+
* transition is round-trippable: the velocity-continuous interruption composes
|
|
3030
|
+
* INTO the round-trip rather than forfeiting it.
|
|
3031
|
+
*
|
|
3032
|
+
* Pure construction — no DOM, no rAF until the returned spring is `.play()`ed
|
|
3033
|
+
* or `tickDt`-driven. value.js-free (LIGHT): it composes only `SpringProgress`
|
|
3034
|
+
* and the leaf finite difference.
|
|
3035
|
+
*
|
|
3036
|
+
* @param probe The two most recent `(value, time-ms)` samples of the
|
|
3037
|
+
* interrupted stream (`prev` then `curr`, the interruption
|
|
3038
|
+
* position).
|
|
3039
|
+
* @param newTarget The value the spring transitions toward.
|
|
3040
|
+
* @param options Spring config (`response` / `dampingFraction` / thresholds /
|
|
3041
|
+
* `respectReducedMotion`); `initial` and `initialVelocity` are
|
|
3042
|
+
* IGNORED — they are seeded from the probe.
|
|
3043
|
+
* @returns A `SpringProgress` seeded at `(probe.curr.value, measured velocity)`,
|
|
3044
|
+
* targeting `newTarget`.
|
|
3045
|
+
*/
|
|
3046
|
+
export declare function reseatToSpring(probe: VelocityProbe, newTarget: number, options?: Partial<Omit<SpringProgressOptions, "initial" | "initialVelocity">>): SpringProgress;
|
|
3047
|
+
|
|
1866
3048
|
/**
|
|
1867
3049
|
* Result of normalising a CSS keyframes input down to the shape the
|
|
1868
3050
|
* `CSSKeyframesAnimation.fromString` flow expects: a `Map<percent →
|
|
@@ -1884,12 +3066,53 @@ export declare interface ResolvedKeyframes {
|
|
|
1884
3066
|
composition: Map<string, string>;
|
|
1885
3067
|
/** `@property --foo { ... }` registry */
|
|
1886
3068
|
properties: Map<string, PropertyDescriptor_2>;
|
|
3069
|
+
/**
|
|
3070
|
+
* `@function --foo(...) { ... }` descriptor registry (P.W13 — the emerging-CSS
|
|
3071
|
+
* resolve seam). Collected via value.js `extractFunctions` exactly as
|
|
3072
|
+
* `properties` is collected via `extractProperties`. Threaded into the
|
|
3073
|
+
* {@link resolveValues} pass's {@link ResolveContext} so the dashed-function
|
|
3074
|
+
* `@function` CALL-inlining lands greenable the moment value.js-P publishes
|
|
3075
|
+
* the call-parse arm; the descriptor is captured NOW (a read-only registry —
|
|
3076
|
+
* the inlining that CONSUMES it is the value.js-P-gated seam in
|
|
3077
|
+
* `resolve-values.ts`).
|
|
3078
|
+
*/
|
|
3079
|
+
functions: Map<string, CustomFunctionDescriptor>;
|
|
1887
3080
|
/**
|
|
1888
3081
|
* Animation options recovered from a top-level style rule's
|
|
1889
3082
|
* `animation` shorthand or longhand declarations (if any). Empty
|
|
1890
3083
|
* when the input has no matching style rule.
|
|
1891
3084
|
*/
|
|
1892
3085
|
options: ReturnType<typeof extractAnimationOptions>;
|
|
3086
|
+
/**
|
|
3087
|
+
* Structured parse/honoring diagnostics (K.W7 S4) — every SILENT fallback
|
|
3088
|
+
* the resolve path used to swallow, now a citable row. CONSUMES the value.js
|
|
3089
|
+
* 0.12.0 `ParseDiagnostic`/`OnParseError` producer (N2 row 10): a failed
|
|
3090
|
+
* parse surfaced through `OnParseError` lands here as a `PARSE_ERROR` row,
|
|
3091
|
+
* and the kf-side fallbacks (`EMPTY_PARSE`, and the engine's
|
|
3092
|
+
* `COMPOSITION_FALLBACK`) join it. A FLAT additive array with stable
|
|
3093
|
+
* {@link DiagnosticCode}s, NOT a logging framework. Empty on a clean parse.
|
|
3094
|
+
* K.W8 populates the ingest rows (`CORS_SKIP`, `WAAPI_INELIGIBLE`) it owns.
|
|
3095
|
+
*/
|
|
3096
|
+
diagnostics: Diagnostic[];
|
|
3097
|
+
/**
|
|
3098
|
+
* The parsed CSS `Stylesheet` AST the resolve walked (L.W2 S1). Surfaced so a
|
|
3099
|
+
* caller can recover scroll-grammar (`animation-timeline`/`animation-range`)
|
|
3100
|
+
* from the SAME parse via `extractTimelineOptions(resolved.stylesheet)` —
|
|
3101
|
+
* `CSSKeyframesAnimation.fromString` threads it onto `scrollOptions` so the
|
|
3102
|
+
* compiler's EMIT half (CC-6) can serialize the scroll longhands back out. A
|
|
3103
|
+
* read-only metadata field; the keyframe/option resolution is unchanged.
|
|
3104
|
+
*/
|
|
3105
|
+
stylesheet: Stylesheet;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
/**
|
|
3109
|
+
* The resolved [start,end] scroll-extent fractions for a parsed
|
|
3110
|
+
* `animation-range`. The driver maps a raw scroll position `p ∈ [0,1]` over the
|
|
3111
|
+
* scene's extent into local progress `(p − start)/(end − start)`, clamped.
|
|
3112
|
+
*/
|
|
3113
|
+
export declare interface ResolvedRange {
|
|
3114
|
+
start: number;
|
|
3115
|
+
end: number;
|
|
1893
3116
|
}
|
|
1894
3117
|
|
|
1895
3118
|
/**
|
|
@@ -1912,28 +3135,181 @@ export declare interface ResolvedKeyframes {
|
|
|
1912
3135
|
*/
|
|
1913
3136
|
export declare function resolveEasing(name: string): Promise<Easing>;
|
|
1914
3137
|
|
|
3138
|
+
/**
|
|
3139
|
+
* K1 — `resolveLiveKeyframes`: the lowest-level CSSOM walk. Accepts a
|
|
3140
|
+
* `Document`, an explicit `CSSStyleSheet[]`, or a single `CSSStyleSheet`, and
|
|
3141
|
+
* reconstructs every `@keyframes` rule it can read. The per-sheet `try/catch` is
|
|
3142
|
+
* the honesty surface (S3): a cross-origin sheet whose `cssRules` getter throws
|
|
3143
|
+
* `SecurityError` becomes a `CORS_SKIP` diagnostic row — never an uncaught throw
|
|
3144
|
+
* and never a silent drop ("ingestion's honest failure mode IS a diagnostic").
|
|
3145
|
+
*
|
|
3146
|
+
* The named sibling of `resolveKeyframes` (`adapter.ts`): where `resolveKeyframes`
|
|
3147
|
+
* normalises a STRING of CSS, `resolveLiveKeyframes` normalises the LIVE CSSOM —
|
|
3148
|
+
* the parser pointed forward at the web the page already ships.
|
|
3149
|
+
*/
|
|
3150
|
+
declare const resolveLiveKeyframes: <V extends Vars = any>(source?: Document | ShadowRoot | CSSStyleSheet[] | CSSStyleSheet, options?: IngestOptions) => IngestResult<V>;
|
|
3151
|
+
|
|
3152
|
+
/**
|
|
3153
|
+
* Resolve a parsed `AnimationRangeValue` (or `undefined` → the whole [0,1]
|
|
3154
|
+
* timeline) into [start,end] extent fractions. The driver-side fill of the
|
|
3155
|
+
* division-of-labour law: value.js emits the phases/offsets verbatim, kf turns
|
|
3156
|
+
* them into the TIME mapping.
|
|
3157
|
+
*/
|
|
3158
|
+
declare function resolveRange(range: AnimationRangeValue | undefined): ResolvedRange;
|
|
3159
|
+
|
|
1915
3160
|
declare const rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1916
3161
|
|
|
1917
3162
|
declare const rotateScale: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
1918
3163
|
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
3164
|
+
/**
|
|
3165
|
+
* The full SO-1 round-trip in one call: `parse → serialize`. Returns the typed
|
|
3166
|
+
* options AND the re-serialized longhand declarations, so a consumer (or the
|
|
3167
|
+
* `proof:scroll-roundtrip` gate) can assert the replay-equality invariant
|
|
3168
|
+
* (`serialize(parse(s))` canonical-form-equal to `s`).
|
|
3169
|
+
*/
|
|
3170
|
+
declare function roundTripScrollCSS(input: string | Stylesheet): {
|
|
3171
|
+
options: CSSTimelineOptions;
|
|
3172
|
+
declarations: ReturnType<typeof serializeScrollOptions>;
|
|
3173
|
+
};
|
|
3174
|
+
|
|
3175
|
+
/** Which backend a `ScrollScene` dispatched to, and why the JS path was chosen. */
|
|
3176
|
+
export declare type ScrollBackend = "native" | "js";
|
|
3177
|
+
|
|
3178
|
+
/** The dispatch verdict — which backend, and (for JS) the human-readable reason. */
|
|
3179
|
+
export declare type ScrollDispatch = {
|
|
3180
|
+
backend: "native";
|
|
3181
|
+
attachment: NativeScrollAttachment;
|
|
3182
|
+
} | {
|
|
3183
|
+
backend: "js";
|
|
3184
|
+
reason: string;
|
|
3185
|
+
};
|
|
3186
|
+
|
|
3187
|
+
/**
|
|
3188
|
+
* The dispatch request — what the caller wants over the parsed scene. The matrix
|
|
3189
|
+
* reads these + the target shape to choose native vs JS (the conservative-correct
|
|
3190
|
+
* backend choice with a queryable reason).
|
|
3191
|
+
*/
|
|
3192
|
+
export declare interface ScrollDispatchRequest<V extends Vars> {
|
|
3193
|
+
/** The animation to drive over the scroll clock. */
|
|
3194
|
+
animation?: KeyframesAnimation<V> | undefined;
|
|
3195
|
+
/** The native timeline spec (`scroll`/`view`) for the eligible fast lane. */
|
|
3196
|
+
nativeSpec?: NativeTimelineSpec | undefined;
|
|
3197
|
+
/** True if scrub smoothing was requested (forces JS — native has no smoother). */
|
|
3198
|
+
scrub?: boolean | undefined;
|
|
3199
|
+
/** True if snap was requested (forces JS — native has no physics snap). */
|
|
3200
|
+
snap?: boolean | undefined;
|
|
3201
|
+
/** True if scroll velocity / non-DOM driving was requested (forces JS). */
|
|
3202
|
+
velocity?: boolean | undefined;
|
|
1925
3203
|
}
|
|
1926
|
-
export { ScrollTimeline_2 as ScrollTimeline }
|
|
1927
3204
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
3205
|
+
/**
|
|
3206
|
+
* The kf `ScrollScene` JS DRIVER (SO-2). Drives an engine's progress from a raw
|
|
3207
|
+
* scroll position through the parsed `animation-range`, composing the SHIPPED
|
|
3208
|
+
* primitives:
|
|
3209
|
+
*
|
|
3210
|
+
* scrub → `SmoothProgress` damping (the smoothing the native lane lacks)
|
|
3211
|
+
* snap → `decayRest` (project the idle rest point) + `SpringProgress` settle
|
|
3212
|
+
* (the PHYS-D snapDecay primitive — composes shipped physics, invents none)
|
|
3213
|
+
* enter/leave → the threshold detector DERIVED from the parsed range
|
|
3214
|
+
*
|
|
3215
|
+
* The caller drives the loop (`scrollProgress(p)` per scroll event); the scene
|
|
3216
|
+
* owns no rAF. `progress` is the smoother-damped local progress the engine reads.
|
|
3217
|
+
*
|
|
3218
|
+
* The driver owns TIME (the live offset resolution); value.js owns VALUES (the
|
|
3219
|
+
* parsed phases/offsets). The native lane is NOT deleted — this is the universal
|
|
3220
|
+
* fallback the dispatch falls back to.
|
|
3221
|
+
*/
|
|
3222
|
+
export declare class ScrollScene {
|
|
3223
|
+
private readonly resolvedRange;
|
|
3224
|
+
private readonly snapPoints;
|
|
3225
|
+
private readonly snapSpring;
|
|
3226
|
+
private readonly scrubSeconds;
|
|
3227
|
+
private readonly smoother;
|
|
3228
|
+
private rawScroll;
|
|
3229
|
+
private localProgress;
|
|
3230
|
+
private wasInside;
|
|
3231
|
+
private readonly subscribers;
|
|
3232
|
+
constructor(options?: ScrollSceneOptions);
|
|
3233
|
+
/** The resolved [start,end] scroll-extent fractions for this scene. */
|
|
3234
|
+
get range(): ResolvedRange;
|
|
3235
|
+
/**
|
|
3236
|
+
* Drive the scene from a raw scroll position `p ∈ [0,1]` over the scene's
|
|
3237
|
+
* scroll extent (the caller resolves the live scroller; kf maps it to the
|
|
3238
|
+
* range). Maps `p` to local progress `(p − start)/(end − start)` clamped,
|
|
3239
|
+
* routes it through the scrub smoother (if any), and fires enter/leave at
|
|
3240
|
+
* the range boundaries. Returns the (possibly un-smoothed) local progress.
|
|
3241
|
+
*
|
|
3242
|
+
* The smoother converges over subsequent `.tick(dt)` calls; the immediate
|
|
3243
|
+
* return is the smoother's current value (so the first call seeds the
|
|
3244
|
+
* target). Consumers driving their own rAF call `.tick(dt)` per frame.
|
|
3245
|
+
*/
|
|
3246
|
+
scrollProgress(p: number): number;
|
|
3247
|
+
/**
|
|
3248
|
+
* Advance the scrub smoother by `dt` ms (frame-rate independent). A no-op
|
|
3249
|
+
* when no scrub was requested (the progress tracks scroll 1:1). Returns the
|
|
3250
|
+
* current smoothed local progress — the engine-write input the driver tracks.
|
|
3251
|
+
*/
|
|
3252
|
+
tick(dt: number): number;
|
|
3253
|
+
/** The current local progress (smoother-damped if scrub was requested). */
|
|
3254
|
+
get progress(): number;
|
|
3255
|
+
/** True if no scrub smoother, or the smoother has settled. */
|
|
3256
|
+
get settled(): boolean;
|
|
3257
|
+
/**
|
|
3258
|
+
* SO-2 `.snap()` — PHYS-D snapDecay. On scroll-idle, project the rest point
|
|
3259
|
+
* the current scroll momentum would coast to (`decayRest`), pick the nearest
|
|
3260
|
+
* configured snap point, and settle to it via `SpringProgress`. Returns the
|
|
3261
|
+
* chosen snap target (local progress), or `null` when no snap points are
|
|
3262
|
+
* configured.
|
|
3263
|
+
*
|
|
3264
|
+
* Composes the SHIPPED `decayRest` (the closed-form projected rest) +
|
|
3265
|
+
* `SpringProgress` (the settle) — it invents no physics (the PHYS-A coupled
|
|
3266
|
+
* form is KILLED). `velocity` is the release scroll velocity (units/s); `0`
|
|
3267
|
+
* snaps from the rest position directly.
|
|
3268
|
+
*/
|
|
3269
|
+
snapTo(velocity?: number): number | null;
|
|
3270
|
+
/**
|
|
3271
|
+
* Advance the snap settle by `dt` ms. Returns the spring's current local
|
|
3272
|
+
* progress (and writes it to `progress`), or the unchanged progress when no
|
|
3273
|
+
* snap is active. Drive this per frame after `snapTo()` until `settled`.
|
|
3274
|
+
*/
|
|
3275
|
+
tickSnap(dt: number): number;
|
|
3276
|
+
/** Subscribe to an enter/leave threshold crossing. Returns an unsubscribe fn. */
|
|
3277
|
+
on(event: ScrollSceneEvent, cb: ScrollSceneSubscriber): () => void;
|
|
3278
|
+
private fire;
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
/** The set of enter/leave threshold events the range-derived detector fires. */
|
|
3282
|
+
export declare type ScrollSceneEvent = "enter" | "leave";
|
|
3283
|
+
|
|
3284
|
+
export declare interface ScrollSceneOptions {
|
|
3285
|
+
/**
|
|
3286
|
+
* The parsed `CSSTimelineOptions` (from {@link parseScrollCSS}) OR a direct
|
|
3287
|
+
* spec. The `range` drives the [0,1] mapping; the `timeline` informs the
|
|
3288
|
+
* native-vs-JS dispatch (a named/`auto` timeline that the platform can run
|
|
3289
|
+
* natively).
|
|
3290
|
+
*/
|
|
3291
|
+
range?: AnimationRangeValue | undefined;
|
|
3292
|
+
timeline?: AnimationTimelineValue | undefined;
|
|
3293
|
+
/**
|
|
3294
|
+
* Scrub smoothing seconds (the damping the native `animation-range` lane
|
|
3295
|
+
* LACKS — a STRICT capability of the JS driver). `0`/omitted ⇒ no smoothing
|
|
3296
|
+
* (the scrub tracks scroll 1:1). A positive value enables `SmoothProgress`
|
|
3297
|
+
* damping. Requesting scrub forces the JS backend (native has no smoother).
|
|
3298
|
+
*/
|
|
3299
|
+
scrub?: number | undefined;
|
|
3300
|
+
/**
|
|
3301
|
+
* Snap points (local progress in [0,1]) the scene settles to on scroll-idle
|
|
3302
|
+
* via `decayRest` + `SpringProgress`. Requesting snap forces the JS backend.
|
|
3303
|
+
*/
|
|
3304
|
+
snap?: SnapPoints | undefined;
|
|
3305
|
+
/** Spring config for the snap settle (the PHYS-D snapDecay primitive). */
|
|
3306
|
+
snapSpring?: Partial<SpringProgressOptions> | undefined;
|
|
3307
|
+
/** Extra SmoothProgress config for the scrub smoother. */
|
|
3308
|
+
smoothing?: Partial<SmoothProgressOptions> | undefined;
|
|
1935
3309
|
}
|
|
1936
|
-
|
|
3310
|
+
|
|
3311
|
+
/** A `.on(event, cb)` subscriber. Receives the local progress at the crossing. */
|
|
3312
|
+
export declare type ScrollSceneSubscriber = (progress: number) => void;
|
|
1937
3313
|
|
|
1938
3314
|
/**
|
|
1939
3315
|
* The master-playhead orchestrator. Positions child animations along one clock
|
|
@@ -1945,6 +3321,13 @@ export declare class Sequence<V extends Vars = any> {
|
|
|
1945
3321
|
readonly entries: SequenceEntry<V>[];
|
|
1946
3322
|
/** Named positions on the master clock, registered via {@link label}. */
|
|
1947
3323
|
private readonly labels;
|
|
3324
|
+
/**
|
|
3325
|
+
* The transport-events bus — the per-event subscriber registry + the
|
|
3326
|
+
* crossing detector (segment-lifecycle + label straddle). `on(...)` forwards
|
|
3327
|
+
* to `_events.subscribe`, and `_fireCrossings` to `_events.fire`. See
|
|
3328
|
+
* `./sequence-events` for the channel + detector body.
|
|
3329
|
+
*/
|
|
3330
|
+
private readonly _events;
|
|
1948
3331
|
/**
|
|
1949
3332
|
* The running insertion cursor (ms) — the end of the last-inserted
|
|
1950
3333
|
* segment. Relative `"+="`/`"-="` positions and auto-append (`at` omitted)
|
|
@@ -2008,13 +3391,32 @@ export declare class Sequence<V extends Vars = any> {
|
|
|
2008
3391
|
get rate(): number;
|
|
2009
3392
|
/** Register a named position on the master clock. Chainable. */
|
|
2010
3393
|
label(name: string, at?: SequencePosition): this;
|
|
3394
|
+
/**
|
|
3395
|
+
* Subscribe to a segment-lifecycle or label crossing. Returns an
|
|
3396
|
+
* unsubscribe handle — the `ScrollScene.on` idiom (`scroll-scene.ts:506-514`).
|
|
3397
|
+
*
|
|
3398
|
+
* - `"segment:enter"` fires when the playhead enters a segment's
|
|
3399
|
+
* `[at, at + duration)` span (forward across `at`, or backward across the
|
|
3400
|
+
* span end); the callback receives that segment's `animation` reference
|
|
3401
|
+
* and the master-clock position at the crossing.
|
|
3402
|
+
* - `"segment:leave"` fires on the complementary crossing OUT of the span.
|
|
3403
|
+
* - `"label"` fires when the playhead straddles a registered label position
|
|
3404
|
+
* in EITHER direction; the callback receives `(name, masterClock)`.
|
|
3405
|
+
*
|
|
3406
|
+
* Crossings fire on EVERY paint — `seek` (scrub) and the rAF play loop,
|
|
3407
|
+
* forward, reverse, and yoyo. The callback's `masterClock` lets the consumer
|
|
3408
|
+
* infer direction; there is no `once` idiom — unsubscribe in the callback
|
|
3409
|
+
* (via the returned handle) for one-shot behaviour.
|
|
3410
|
+
*/
|
|
3411
|
+
on(event: "segment:enter" | "segment:leave", cb: SequenceSegmentSubscriber): () => void;
|
|
3412
|
+
on(event: "label", cb: SequenceLabelSubscriber): () => void;
|
|
2011
3413
|
/**
|
|
2012
3414
|
* Append a child animation at `at` (absolute ms, a label, a `"+="`/`"-="`
|
|
2013
3415
|
* relative token, or — omitted — the running cursor, i.e. after the
|
|
2014
3416
|
* previous segment). Advances the insertion cursor to this segment's end.
|
|
2015
3417
|
* Chainable.
|
|
2016
3418
|
*/
|
|
2017
|
-
add(animation:
|
|
3419
|
+
add(animation: KeyframesAnimation<V>, at?: SequencePosition): this;
|
|
2018
3420
|
/**
|
|
2019
3421
|
* Resolve a {@link SequencePosition} to an absolute ms offset.
|
|
2020
3422
|
*
|
|
@@ -2046,6 +3448,17 @@ export declare class Sequence<V extends Vars = any> {
|
|
|
2046
3448
|
* forward-monotone re-anchor window to break (F.W9 §S3 MEASURE-FIRST).
|
|
2047
3449
|
*/
|
|
2048
3450
|
private _applyAt;
|
|
3451
|
+
/**
|
|
3452
|
+
* Detect and fire segment-lifecycle + label crossings between the previous
|
|
3453
|
+
* painted phase and `phase` — the ONE detector both `seek` (scrub) and
|
|
3454
|
+
* `_frame` (the rAF play loop) drive, so play fires the identical crossings a
|
|
3455
|
+
* scrub would. The detector + the per-event subscriber state live on the
|
|
3456
|
+
* `_events` bus (`./sequence-events`); this thin wrapper threads the segments
|
|
3457
|
+
* and labels the bus reads. The bus updates its own `_prevPhase` on EVERY
|
|
3458
|
+
* call (even the early-exit) so a subscriber registered mid-transport
|
|
3459
|
+
* straddles from the true prior playhead.
|
|
3460
|
+
*/
|
|
3461
|
+
private _fireCrossings;
|
|
2049
3462
|
/**
|
|
2050
3463
|
* Fold a raw, repeat-extended master clock down to an effective phase in
|
|
2051
3464
|
* `[0, duration]` per the `repeat`/`yoyo` transport. With `repeat(1)` +
|
|
@@ -2159,13 +3572,39 @@ export declare class Sequence<V extends Vars = any> {
|
|
|
2159
3572
|
yoyo(on?: boolean): this;
|
|
2160
3573
|
}
|
|
2161
3574
|
|
|
2162
|
-
/**
|
|
3575
|
+
/**
|
|
3576
|
+
* A resolved sequence segment: a child animation anchored at an absolute ms
|
|
3577
|
+
* offset. The shape {@link SequenceEventBus.fire} reads to test segment
|
|
3578
|
+
* membership.
|
|
3579
|
+
*/
|
|
2163
3580
|
export declare interface SequenceEntry<V extends Vars> {
|
|
2164
|
-
animation:
|
|
3581
|
+
animation: KeyframesAnimation<V>;
|
|
2165
3582
|
/** Absolute offset (ms) of this segment's local t=0 on the master clock. */
|
|
2166
3583
|
at: number;
|
|
2167
3584
|
}
|
|
2168
3585
|
|
|
3586
|
+
/**
|
|
3587
|
+
* The transport-crossing events a `Sequence` fires via {@link Sequence.on} —
|
|
3588
|
+
* the segment-lifecycle pair plus the named-label crossing.
|
|
3589
|
+
*
|
|
3590
|
+
* - `"segment:enter"` — the playhead crossed INTO a segment's
|
|
3591
|
+
* `[at, at + duration)` span (forward across `at`, or backward across the
|
|
3592
|
+
* span's end).
|
|
3593
|
+
* - `"segment:leave"` — the complementary crossing OUT of that span.
|
|
3594
|
+
* - `"label"` — the playhead straddled a position registered via
|
|
3595
|
+
* {@link Sequence.label}, in EITHER direction.
|
|
3596
|
+
*
|
|
3597
|
+
* Mirror of `ScrollSceneEvent` (`scroll-scene.ts:190`) — a typed, per-event
|
|
3598
|
+
* subscribe channel.
|
|
3599
|
+
*/
|
|
3600
|
+
export declare type SequenceEvent = "segment:enter" | "segment:leave" | "label";
|
|
3601
|
+
|
|
3602
|
+
/**
|
|
3603
|
+
* A `label` subscriber. Receives the crossed label's `name` and the
|
|
3604
|
+
* master-clock position (ms) at the crossing.
|
|
3605
|
+
*/
|
|
3606
|
+
export declare type SequenceLabelSubscriber = (name: string, masterClock: number) => void;
|
|
3607
|
+
|
|
2169
3608
|
export declare interface SequenceOptions {
|
|
2170
3609
|
/**
|
|
2171
3610
|
* When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
|
|
@@ -2187,6 +3626,37 @@ export declare interface SequenceOptions {
|
|
|
2187
3626
|
*/
|
|
2188
3627
|
export declare type SequencePosition = number | `+=${number}` | `-=${number}` | string;
|
|
2189
3628
|
|
|
3629
|
+
/**
|
|
3630
|
+
* A `segment:enter` / `segment:leave` subscriber. Receives the crossing
|
|
3631
|
+
* segment's own `animation` reference and the master-clock position (ms) at the
|
|
3632
|
+
* crossing. The clock lets the consumer infer direction (a backward crossing
|
|
3633
|
+
* arrives with a smaller `masterClock` than the prior call).
|
|
3634
|
+
*/
|
|
3635
|
+
export declare type SequenceSegmentSubscriber = (animation: KeyframesAnimation<any>, masterClock: number) => void;
|
|
3636
|
+
|
|
3637
|
+
/** The union over the two subscriber shapes (the {@link Sequence.on} fallthrough). */
|
|
3638
|
+
export declare type SequenceSubscriber = SequenceSegmentSubscriber | SequenceLabelSubscriber;
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
3641
|
+
* SO-1 SERIALIZE — round-trip a typed `CSSTimelineOptions` BACK to its CSS
|
|
3642
|
+
* longhand declarations (`{ "animation-timeline"?, "animation-range"?,
|
|
3643
|
+
* "timeline-scope"?, "animation-trigger"? }`). The parser run BACKWARD over the
|
|
3644
|
+
* SAME data model — value.js's `serializeTimelineOptions` (the inverse mirror of
|
|
3645
|
+
* its extractor), NOT a re-derived lossy emitter. Emits only present fields (no
|
|
3646
|
+
* default padding); the keys mirror the CSS longhand names.
|
|
3647
|
+
*
|
|
3648
|
+
* THE REPLAY-EQUALITY ORACLE: `serializeScrollOptions(parseScrollCSS(s))` is
|
|
3649
|
+
* canonical-form-equal to `s`'s scroll declarations — a faithful round-trip, OR
|
|
3650
|
+
* a REFUSAL (a parse that drops a phase reds the gate), never a silent
|
|
3651
|
+
* approximation. See {@link roundTripScrollCSS}.
|
|
3652
|
+
*/
|
|
3653
|
+
declare function serializeScrollOptions(opts: CSSTimelineOptions): {
|
|
3654
|
+
"animation-timeline"?: string;
|
|
3655
|
+
"animation-range"?: string;
|
|
3656
|
+
"timeline-scope"?: string;
|
|
3657
|
+
"animation-trigger"?: string;
|
|
3658
|
+
};
|
|
3659
|
+
|
|
2190
3660
|
declare const shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
2191
3661
|
|
|
2192
3662
|
declare const skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -2292,6 +3762,9 @@ export declare interface SmoothProgressOptions {
|
|
|
2292
3762
|
respectReducedMotion: boolean;
|
|
2293
3763
|
}
|
|
2294
3764
|
|
|
3765
|
+
/** A `.snap()` snap point — a local progress in [0,1] the scene settles to. */
|
|
3766
|
+
export declare type SnapPoints = readonly number[];
|
|
3767
|
+
|
|
2295
3768
|
declare const spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
2296
3769
|
|
|
2297
3770
|
/**
|
|
@@ -2408,11 +3881,30 @@ export declare class SpringProgress {
|
|
|
2408
3881
|
/** Cached `(x, v)` at the most recent target re-seat. */
|
|
2409
3882
|
private originValue;
|
|
2410
3883
|
private originVelocity;
|
|
3884
|
+
/**
|
|
3885
|
+
* Amplitude scale ∈ [0, 1] resolved from `respectReducedMotion` at each
|
|
3886
|
+
* target re-seat (K.W11 PHYS-E). `1` is full motion (the default / no
|
|
3887
|
+
* active query); a numeric policy under an active `prefers-reduced-motion`
|
|
3888
|
+
* query yields the intensity. `evaluateAt` solves toward a SCALED target
|
|
3889
|
+
* `origin + s·(target − origin)`, so the spring still starts at the origin
|
|
3890
|
+
* but travels only `s ×` the full distance — the peak overshoot scales while
|
|
3891
|
+
* the envelope (curve + settle time) is preserved by construction. Re-resolved
|
|
3892
|
+
* per re-seat (not per frame) so a live OS toggle is honored at the next
|
|
3893
|
+
* target change, and the per-frame `evaluateAt` stays a field read — zero
|
|
3894
|
+
* extra `matchMedia` cost in the hot path.
|
|
3895
|
+
*/
|
|
3896
|
+
private amplitudeScale;
|
|
2411
3897
|
private omega;
|
|
2412
3898
|
private zeta;
|
|
2413
3899
|
private omegaD;
|
|
2414
3900
|
private subscribers;
|
|
2415
3901
|
private disposed;
|
|
3902
|
+
private vecOrigin;
|
|
3903
|
+
private vecOriginVel;
|
|
3904
|
+
private vecTarget;
|
|
3905
|
+
private vecCurrent;
|
|
3906
|
+
private vecVelocity;
|
|
3907
|
+
private vecElapsed;
|
|
2416
3908
|
private _playback;
|
|
2417
3909
|
private _onFrame;
|
|
2418
3910
|
constructor(options?: Partial<SpringProgressOptions>);
|
|
@@ -2475,6 +3967,51 @@ export declare class SpringProgress {
|
|
|
2475
3967
|
snap(): void;
|
|
2476
3968
|
/** Reset position + velocity to a specified value (default 0). */
|
|
2477
3969
|
reset(value?: number, velocity?: number): void;
|
|
3970
|
+
/**
|
|
3971
|
+
* Re-seat a MULTI-CHANNEL spring vector onto `targets` (one lane per
|
|
3972
|
+
* element), under this spring's `(response, dampingFraction)`. The lanes
|
|
3973
|
+
* ring identically to a scalar `SpringProgress` of the same config — the
|
|
3974
|
+
* solver is the SAME closed form (`evaluateAt`) shared across channels — but
|
|
3975
|
+
* step in ONE `tickVector(dt)` call into one `Float64Array` per tick, the
|
|
3976
|
+
* dispatch/alloc amortization the W122 probe measured at 2.97–3.78× over K
|
|
3977
|
+
* independent scalar instances (ADOPT @ K=8, `proof:spring-vector`).
|
|
3978
|
+
*
|
|
3979
|
+
* First call ARMS the lanes (lazily — a scalar-only spring never allocates
|
|
3980
|
+
* the vector buffers, so the scalar hot path is unchanged). Subsequent calls
|
|
3981
|
+
* re-seat each lane's origin from the lane's CURRENT `(x, v)`, so a mid-flight
|
|
3982
|
+
* target change is continuous per channel — the vector analogue of the scalar
|
|
3983
|
+
* `set target` re-seat. The lane count is fixed by the FIRST `setTargets`
|
|
3984
|
+
* length; a later call with a different length throws (the buffers are
|
|
3985
|
+
* stable references the consumer reads via {@link values}).
|
|
3986
|
+
*
|
|
3987
|
+
* `initialVelocity` (the scalar seed) does NOT carry into the lanes — a fresh
|
|
3988
|
+
* vector starts each lane at rest unless re-seated from prior motion. The
|
|
3989
|
+
* scalar `currentValue` / `target` are untouched; the two modes are
|
|
3990
|
+
* independent surfaces on one solver.
|
|
3991
|
+
*/
|
|
3992
|
+
setTargets(targets: Float64Array): void;
|
|
3993
|
+
/**
|
|
3994
|
+
* The shared output lane buffer — the K channels' current values, written
|
|
3995
|
+
* in place by {@link tickVector}. A STABLE reference (never re-allocated
|
|
3996
|
+
* after the first {@link setTargets}); read it after each tick. Returns an
|
|
3997
|
+
* empty `Float64Array` before the first `setTargets` arms the lanes.
|
|
3998
|
+
*/
|
|
3999
|
+
get values(): Float64Array;
|
|
4000
|
+
/**
|
|
4001
|
+
* The shared output velocity lane buffer — the K channels' current
|
|
4002
|
+
* velocities, written in place by {@link tickVector}. A STABLE reference;
|
|
4003
|
+
* empty before the first {@link setTargets}.
|
|
4004
|
+
*/
|
|
4005
|
+
get velocities(): Float64Array;
|
|
4006
|
+
/**
|
|
4007
|
+
* Advance EVERY lane by `dt` MILLISECONDS — one call, K channels, one buffer
|
|
4008
|
+
* write. The analytic per-channel step is the same closed form `evaluateAt`
|
|
4009
|
+
* uses (the shared `omega`/`zeta`/`omegaD`), with the transcendentals
|
|
4010
|
+
* (`exp`/`cos`/`sin`) hoisted once per tick and reused across lanes — the
|
|
4011
|
+
* amortization the W122 probe measured. No-op (returns the same buffer)
|
|
4012
|
+
* before the first {@link setTargets}, when disposed, or for `dt <= 0`.
|
|
4013
|
+
*/
|
|
4014
|
+
tickVector(dt: number): Float64Array;
|
|
2478
4015
|
/**
|
|
2479
4016
|
* Subscribe to per-tick updates. Returns an unsubscribe handle.
|
|
2480
4017
|
* Called with `(value, velocity)` on every `tick`/`snap`/`reset`/
|
|
@@ -2539,11 +4076,24 @@ export declare interface SpringProgressOptions {
|
|
|
2539
4076
|
/** Velocity settle threshold (units/s). Default 1e-3. */
|
|
2540
4077
|
velocitySettleThreshold: number;
|
|
2541
4078
|
/**
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
4079
|
+
* Honor `prefers-reduced-motion: reduce` (K.W11 PHYS-E — the
|
|
4080
|
+
* intensity-scaled, WCAG 2.3.3-aligned gate):
|
|
4081
|
+
*
|
|
4082
|
+
* - `false` (default) — ignore the preference; the spring runs at full
|
|
4083
|
+
* amplitude.
|
|
4084
|
+
* - `true` — the classic binary snap: under an active query the spring
|
|
4085
|
+
* jumps to target at zero velocity (amplitude scale `0`). SSR-safe.
|
|
4086
|
+
* - a `number` ∈ [0, 1] — the AMPLITUDE INTENSITY: under an active query
|
|
4087
|
+
* the spring keeps its trajectory SHAPE (curve + settle time) but scales
|
|
4088
|
+
* its displacement-from-rest (`originValue − targetValue`) to this
|
|
4089
|
+
* fraction. At `0.3` the peak overshoot is 30 % of the full-intensity
|
|
4090
|
+
* peak; the envelope is preserved by construction (the analytic form
|
|
4091
|
+
* makes the scaling exact and free). `1` ≈ full motion, `0` ≡ the snap.
|
|
4092
|
+
*
|
|
4093
|
+
* The scale is the CONSUMER's policy (a settings slider, a per-animation
|
|
4094
|
+
* field) — the OS exposes only a binary signal; kf provides the mechanism.
|
|
2545
4095
|
*/
|
|
2546
|
-
respectReducedMotion:
|
|
4096
|
+
respectReducedMotion: ReducedMotionPolicy;
|
|
2547
4097
|
}
|
|
2548
4098
|
|
|
2549
4099
|
/**
|
|
@@ -2688,6 +4238,16 @@ export declare interface TemplateAnimationFrame<V extends Vars> {
|
|
|
2688
4238
|
vars: V;
|
|
2689
4239
|
transform?: TransformFunction<V>;
|
|
2690
4240
|
timingFunction?: Easing;
|
|
4241
|
+
/**
|
|
4242
|
+
* The author-declared `animation-composition` operator for this stop
|
|
4243
|
+
* (`replace` | `add` | `accumulate`), captured by the adapter and threaded
|
|
4244
|
+
* here so the engine HONORS it (K.W7 — the fidelity floor). Genuine
|
|
4245
|
+
* omission means `replace` (the default composite). value.js lifts it onto
|
|
4246
|
+
* `rule.composition`; `resolveKeyframes` captures it on
|
|
4247
|
+
* `ResolvedKeyframes.composition`; `fromString` reads that Map into this
|
|
4248
|
+
* field. The compiled {@link AnimationFrame.composition} inherits it.
|
|
4249
|
+
*/
|
|
4250
|
+
composition?: CompositeOperator;
|
|
2691
4251
|
}
|
|
2692
4252
|
|
|
2693
4253
|
declare const textFocusBlur: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -2781,6 +4341,15 @@ export declare const toEasing: (input: TimingFunction | Easing) => Easing;
|
|
|
2781
4341
|
|
|
2782
4342
|
export declare type TransformFunction<V extends Vars> = (v: V, t: number) => void;
|
|
2783
4343
|
|
|
4344
|
+
/**
|
|
4345
|
+
* Default DOM-style renderer used by `Animation.transform` when no
|
|
4346
|
+
* user-supplied transform is provided. "Is this the default renderer?"
|
|
4347
|
+
* is decided by reference comparison against the Animation instance's
|
|
4348
|
+
* one `_defaultTransform` (`usesDefaultRenderer`) — typed and
|
|
4349
|
+
* bind-proof, not a Symbol tag a wrapper would silently drop.
|
|
4350
|
+
*/
|
|
4351
|
+
declare function transformTargetsStyle<V extends Vars>(vars: V, targets: HTMLElement[], flat?: boolean): void;
|
|
4352
|
+
|
|
2784
4353
|
declare const typewriter: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
2785
4354
|
|
|
2786
4355
|
declare const typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
@@ -2791,12 +4360,194 @@ export declare class UnknownEasingError extends Error {
|
|
|
2791
4360
|
constructor(easingName: string);
|
|
2792
4361
|
}
|
|
2793
4362
|
|
|
4363
|
+
/**
|
|
4364
|
+
* `validate(css, opts?)` — the READ-ONLY projection over the three typed channels
|
|
4365
|
+
* onto one {@link ValidateResult} envelope. Async because `compileToCSS` is (its
|
|
4366
|
+
* Prettier pass).
|
|
4367
|
+
*
|
|
4368
|
+
* The pipeline:
|
|
4369
|
+
* 1. `parseCSSStylesheet(css)` → the AST; `parseable` is true when value.js
|
|
4370
|
+
* surfaced at least one recognized item and the resolve raised no
|
|
4371
|
+
* `PARSE_ERROR` (the spec-faithful reality — a dropped `!important` decl is
|
|
4372
|
+
* not a parse failure).
|
|
4373
|
+
* 2. `CSSKeyframesAnimation.fromString(css)` → the parsed animation +
|
|
4374
|
+
* `anim.diagnostics` (the adapter's silent-fallback channel).
|
|
4375
|
+
* 3. `compileToCSS([anim], opts.compile)` → `{ eligible, refusals }`.
|
|
4376
|
+
* 4. `isWAAPIEligible(anim)` → the compositor-thread verdict.
|
|
4377
|
+
*/
|
|
4378
|
+
declare function validate(css: string, opts?: ValidateOptions): Promise<ValidateResult>;
|
|
4379
|
+
|
|
4380
|
+
/**
|
|
4381
|
+
* Options for {@link validate} / {@link explain}. A thin pass-through to the
|
|
4382
|
+
* underlying channels — NOT a new option surface. `compile` forwards verbatim to
|
|
4383
|
+
* `compileToCSS` (the ΔE-ε / densify-stop knobs the refusal arm reads).
|
|
4384
|
+
*/
|
|
4385
|
+
export declare interface ValidateOptions {
|
|
4386
|
+
/**
|
|
4387
|
+
* Forwarded verbatim to `compileToCSS` — the CC-2 densify-stop count + the
|
|
4388
|
+
* ΔE-ε ship-vs-refuse threshold the perceptual-oklab refusal arm reads. Omit
|
|
4389
|
+
* for the compiler defaults.
|
|
4390
|
+
*/
|
|
4391
|
+
compile?: CompileOptions;
|
|
4392
|
+
}
|
|
4393
|
+
|
|
4394
|
+
/**
|
|
4395
|
+
* The flat, agent-shaped envelope `validate` returns — the JOIN over the three
|
|
4396
|
+
* typed channels. An LLM agent branches on these fields WITHOUT scraping a
|
|
4397
|
+
* message string. Every constituent type (`CompileRefusal`, `Diagnostic`,
|
|
4398
|
+
* `WAAPIEligibility`) is already exported from the barrel — the ONLY new type is
|
|
4399
|
+
* this envelope.
|
|
4400
|
+
*/
|
|
4401
|
+
export declare interface ValidateResult {
|
|
4402
|
+
/**
|
|
4403
|
+
* True iff value.js parsed the CSS without a `PARSE_ERROR` diagnostic — the
|
|
4404
|
+
* block surfaced at least one recognized stylesheet item (a `@keyframes` /
|
|
4405
|
+
* `@property` / style rule). A spec-invalid keyframe `!important` declaration
|
|
4406
|
+
* is SILENTLY dropped at the AST by value.js (the L.W1 S1 reality) — that drop
|
|
4407
|
+
* is NOT a parse failure, so a block carrying it stays `parseable:true`.
|
|
4408
|
+
*/
|
|
4409
|
+
parseable: boolean;
|
|
4410
|
+
/**
|
|
4411
|
+
* True iff `compileToCSS` produced an artifact for every child — the compile
|
|
4412
|
+
* surface's own `eligible` flag. False when any child refused (see
|
|
4413
|
+
* {@link refusals}). Separate from {@link waapi}: a block can be compile-
|
|
4414
|
+
* eligible (the CSS round-trips faithfully) yet WAAPI-ineligible (color
|
|
4415
|
+
* interpolation, computed units) and vice versa.
|
|
4416
|
+
*/
|
|
4417
|
+
eligible: boolean;
|
|
4418
|
+
/**
|
|
4419
|
+
* The CC-3 refusals — one per child that could not compile faithfully (the
|
|
4420
|
+
* `{ name, reason, message }` trust surface). Empty on a clean compile.
|
|
4421
|
+
*/
|
|
4422
|
+
refusals: CompileRefusal[];
|
|
4423
|
+
/**
|
|
4424
|
+
* All parse/honoring diagnostics from `resolveKeyframes` — every SILENT
|
|
4425
|
+
* fallback the adapter used to swallow, now a citable row with a stable
|
|
4426
|
+
* {@link Diagnostic.code}. Empty on a clean parse.
|
|
4427
|
+
*/
|
|
4428
|
+
diagnostics: Diagnostic[];
|
|
4429
|
+
/**
|
|
4430
|
+
* The WAAPI eligibility verdict — `{ eligible: true }` or
|
|
4431
|
+
* `{ eligible: false; reason: string }`. Separate from {@link eligible}: the
|
|
4432
|
+
* compositor-thread delegation has its own, narrower bar (no color interp, no
|
|
4433
|
+
* computed units, a uniform CSS-twinned easing).
|
|
4434
|
+
*/
|
|
4435
|
+
waapi: WAAPIEligibility;
|
|
4436
|
+
}
|
|
4437
|
+
|
|
2794
4438
|
export declare type Vars<T = any> = {
|
|
2795
4439
|
[arg: string]: number | string | T;
|
|
2796
4440
|
};
|
|
2797
4441
|
|
|
4442
|
+
/**
|
|
4443
|
+
* A two-sample window over a position stream — the last two `(value, time)`
|
|
4444
|
+
* the engine emitted before an interruption (K.W11 PHYS-B2). `time` is in
|
|
4445
|
+
* MILLISECONDS (the engine's `effectiveT` clock); `value` is the interpolated
|
|
4446
|
+
* scalar of the animated property at that time. The finite difference
|
|
4447
|
+
* `(curr.value − prev.value) / ((curr.time − prev.time) / 1000)` is the
|
|
4448
|
+
* measured velocity in units/SECOND — the one place a numerical derivative is
|
|
4449
|
+
* correct, because a keyframe stream carries NO analytic velocity.
|
|
4450
|
+
*/
|
|
4451
|
+
export declare interface VelocityProbe {
|
|
4452
|
+
/** The earlier sample `(value, time-ms)`. */
|
|
4453
|
+
prev: {
|
|
4454
|
+
value: number;
|
|
4455
|
+
time: number;
|
|
4456
|
+
};
|
|
4457
|
+
/** The later sample `(value, time-ms)` — the interruption position. */
|
|
4458
|
+
curr: {
|
|
4459
|
+
value: number;
|
|
4460
|
+
time: number;
|
|
4461
|
+
};
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
declare type WAAPIEligibility = {
|
|
4465
|
+
eligible: true;
|
|
4466
|
+
} | {
|
|
4467
|
+
eligible: false;
|
|
4468
|
+
reason: string;
|
|
4469
|
+
};
|
|
4470
|
+
|
|
4471
|
+
/**
|
|
4472
|
+
* Fire-and-forget idle-warmer for the heavy engine (L.W7 S1, W121).
|
|
4473
|
+
*
|
|
4474
|
+
* Pre-flights `loadAnimationEngine()`'s dynamic import so the first
|
|
4475
|
+
* `.animate()` / `new CSSKeyframesAnimation()` call on a cold page resolves
|
|
4476
|
+
* against an already-in-flight (or already-resolved) Promise instead of paying
|
|
4477
|
+
* network + parse + compile latency inline. Call it during idle —
|
|
4478
|
+
* `requestIdleCallback`, `visibilitychange`, or `mouseenter` on the app shell:
|
|
4479
|
+
*
|
|
4480
|
+
* ```ts
|
|
4481
|
+
* requestIdleCallback(() => warmEngine());
|
|
4482
|
+
* ```
|
|
4483
|
+
*
|
|
4484
|
+
* Idempotent and value.js-free by construction: it shares the SAME
|
|
4485
|
+
* module-scope `_enginePromise` with `loadAnimationEngine()`, so a
|
|
4486
|
+
* `loadAnimationEngine()` after `warmEngine()` returns the same in-flight
|
|
4487
|
+
* Promise — no double import. It fires a DYNAMIC import only; it names no
|
|
4488
|
+
* static value.js specifier, so `proof:boundary` stays green.
|
|
4489
|
+
*
|
|
4490
|
+
* L.W7 S4 (MEASURE-FIRST — the `scheduler.postTask` adoption is DEFERRED, not
|
|
4491
|
+
* shipped). `scheduler.postTask("background", …)` would be the idiomatic home
|
|
4492
|
+
* for an idle warm, but the `proof:scheduler-posttask` probe only SKIPS in
|
|
4493
|
+
* jsdom (the API is absent there) — it has NOT positively MEASURED that the
|
|
4494
|
+
* `"background"` call does not degrade INP on a real engine. Per the wave's own
|
|
4495
|
+
* measure-first law (and inv ε — no claim without an observed oracle), warmEngine
|
|
4496
|
+
* stays on the PROVEN bare `void loadAnimationEngine()` path. The probe + gate are
|
|
4497
|
+
* ARMED: when a real-browser run (Playwright with `scheduler.postTask`) measures
|
|
4498
|
+
* the background dispatch safe, warmEngine adopts `postTask("background")` then —
|
|
4499
|
+
* a gated future change, not an unmeasured ship today.
|
|
4500
|
+
*/
|
|
4501
|
+
export declare const warmEngine: () => void;
|
|
4502
|
+
|
|
2798
4503
|
declare const warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
2799
4504
|
|
|
2800
4505
|
declare const warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
|
|
2801
4506
|
|
|
4507
|
+
/**
|
|
4508
|
+
* Map a phase ∈ ℝ to its waveform value ∈ [-1, 1]. Pure — the phase is reduced
|
|
4509
|
+
* to its fractional cycle position internally, so a phase outside [0, 1) (e.g. a
|
|
4510
|
+
* raw `t × frequency` from {@link Oscillator.sample}) shapes the same as its
|
|
4511
|
+
* wrapped equivalent. Exported as a value.js-free leaf a consumer can apply to
|
|
4512
|
+
* its own phase without constructing an `Oscillator`.
|
|
4513
|
+
*
|
|
4514
|
+
* - `sine` — `sin(2π·p)`, smooth.
|
|
4515
|
+
* - `triangle` — linear up then down, peaks at `p = 0.25` / `0.75`.
|
|
4516
|
+
* - `square` — `+1` for the first half-cycle, `-1` for the second.
|
|
4517
|
+
* - `sawtooth` — linear ramp `-1 → +1` across the cycle.
|
|
4518
|
+
*/
|
|
4519
|
+
export declare function waveformValue(phase: number, waveform: OscillatorWaveform): number;
|
|
4520
|
+
|
|
4521
|
+
/**
|
|
4522
|
+
* The minimal stepper surface a spring-driven blend weight reads (K.W11
|
|
4523
|
+
* PHYS-C). A `SpringProgress` satisfies it structurally (`value` getter +
|
|
4524
|
+
* `tickDt` + `settled`); typing it as this narrow shape — NOT importing
|
|
4525
|
+
* `SpringProgress` — keeps `constants.ts` from gaining a class edge and lets
|
|
4526
|
+
* a consumer drive a layer's weight with ANY analytic stepper (a decay glide,
|
|
4527
|
+
* a custom `Tickable`). The read is one nullish access in the `weighted` blend
|
|
4528
|
+
* leaf; the group's managed loop advances it per frame via `tickDt`.
|
|
4529
|
+
*/
|
|
4530
|
+
export declare interface WeightStepper {
|
|
4531
|
+
/** The stepper's current scalar — read in place of the constant `weight`. */
|
|
4532
|
+
readonly value: number;
|
|
4533
|
+
/** Advance the stepper by `dt` milliseconds (the group's managed tick). */
|
|
4534
|
+
tickDt(dt: number): number;
|
|
4535
|
+
/** True once the stepper has converged — the group clears it then. */
|
|
4536
|
+
readonly settled: boolean;
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4539
|
+
/**
|
|
4540
|
+
* `yieldToMain()` — break a long main-thread task so the browser can service
|
|
4541
|
+
* input/render between slices (INP relief). Used by `AnimationGroup.advanceTo()`
|
|
4542
|
+
* to keep a large group's per-frame composite from monopolizing the main
|
|
4543
|
+
* thread as one long task.
|
|
4544
|
+
*
|
|
4545
|
+
* Baseline-Newly: prefers the native `scheduler.yield()` (continuation runs
|
|
4546
|
+
* at the FRONT of the task queue, so yielding stays cheap); falls back to a
|
|
4547
|
+
* `MessageChannel` macrotask, then `setTimeout(0)` — a ≤20 LOC progressive
|
|
4548
|
+
* fallback per the Baseline browser policy. SSR-safe: resolves immediately
|
|
4549
|
+
* off-DOM (no event loop to yield to that matters for a headless render).
|
|
4550
|
+
*/
|
|
4551
|
+
declare function yieldToMain(): Promise<void>;
|
|
4552
|
+
|
|
2802
4553
|
export { }
|