@mkbabb/keyframes.js 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +112 -217
  2. package/dist/backward-color-BtbRcnna.js +108 -0
  3. package/dist/compile-BHCTPerD.js +30 -0
  4. package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
  5. package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
  6. package/dist/easing-registry-DHV2-5gA.js +27 -0
  7. package/dist/easing-registry-y1p9McFy.js +2 -0
  8. package/dist/easing-serialize-D4LZCB6i.js +21 -0
  9. package/dist/engine/index.d.ts +3139 -0
  10. package/dist/engine/index.js +16 -0
  11. package/dist/engine-CPK_udUQ.js +1172 -0
  12. package/dist/engine-DlpimZtM.js +3 -0
  13. package/dist/entry-D82NKUhP.js +148 -0
  14. package/dist/format-BdIvdLzG.js +114 -0
  15. package/dist/group-HM7N4uOE.js +390 -0
  16. package/dist/handle-D4xrf_ya.js +21 -0
  17. package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
  18. package/dist/keyframes.d.ts +1156 -1099
  19. package/dist/keyframes.js +412 -132
  20. package/dist/morph-svg-KUrH9KnK.js +79 -0
  21. package/dist/motion-path-wM5tPfrY.js +26 -0
  22. package/dist/parse-flatten-DRMHFytp.js +2 -0
  23. package/dist/parse-flatten-ZZUSEQEL.js +63 -0
  24. package/dist/presets-DeDJYL4G.js +275 -0
  25. package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
  26. package/dist/scroll-BEyCx0b_.js +287 -0
  27. package/dist/sequence-s0bL7Uul.js +736 -0
  28. package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
  29. package/dist/view-transition-BPJQxUTC.js +305 -0
  30. package/package.json +123 -84
  31. package/dist/animate-CTWr6K7j.js +0 -26
  32. package/dist/animations-CZxf0rep.js +0 -224
  33. package/dist/compile-YRJRdpKF.js +0 -251
  34. package/dist/decay-BvNmFk51.js +0 -25
  35. package/dist/engine-DQcb7CLW.js +0 -1349
  36. package/dist/errors-W8zkvPw4.js +0 -21
  37. package/dist/format-BUgCTjmr.js +0 -123
  38. package/dist/morph-svg-83uyYxoW.js +0 -84
  39. package/dist/motion-path-C0OHqcA3.js +0 -31
  40. package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
  41. package/dist/scroll-grammar-B4kPvGh5.js +0 -23
  42. package/dist/scroll-scene-DQxhxn9I.js +0 -176
  43. package/dist/sequence-cBr7thU8.js +0 -198
  44. package/dist/springTimingFunction-D26gPkAy.js +0 -63
  45. package/dist/timeline-vY3eD3Ax.js +0 -430
  46. package/dist/utils-BPRImVl5.js +0 -100
@@ -0,0 +1,3139 @@
1
+ import { AnimationRangeValue } from '@mkbabb/value.js';
2
+ import { AnimationTimelineValue } from '@mkbabb/value.js';
3
+ import type { AnimationTriggerValue } from '@mkbabb/value.js';
4
+ import type { ColorSpace } from '@mkbabb/value.js';
5
+ import { CSSTimelineOptions } from '@mkbabb/value.js';
6
+ import { CustomFunctionDescriptor } from '@mkbabb/value.js';
7
+ import { extractAnimationOptions } from '@mkbabb/value.js';
8
+ import type { HueInterpolationMethod } from '@mkbabb/value.js';
9
+ import type { InterpolatedVar } from '@mkbabb/value.js';
10
+ import { ParseDiagnostic } from '@mkbabb/value.js';
11
+ import { PropertyDescriptor as PropertyDescriptor_2 } from '@mkbabb/value.js';
12
+ import { RangeBoundary } from '@mkbabb/value.js';
13
+ import { RangePhase } from '@mkbabb/value.js';
14
+ import { Stylesheet } from '@mkbabb/value.js';
15
+ import type { timingFunctions } from '@mkbabb/value.js';
16
+ import type { TriggerType } from '@mkbabb/value.js';
17
+ import { ValueArray } from '@mkbabb/value.js';
18
+ import { ValueUnit } from '@mkbabb/value.js';
19
+
20
+ declare const accordionExpand: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
21
+
22
+ /**
23
+ * The outcome of an {@link adoptRunning} takeover. `animation` is the kf object
24
+ * now driving the element (seeded at the captured playhead, already playing);
25
+ * `currentTime` is the playhead (ms) the takeover seeded from; `diagnostics`
26
+ * carries any honest refusal (no running animation by that name → a row, never
27
+ * a silent no-op).
28
+ */
29
+ export declare interface AdoptResult<V extends Vars = Vars> {
30
+ /** The kf animation now driving the element (null on a refused adopt). */
31
+ animation: CSSKeyframesAnimation<V> | null;
32
+ /** The captured native `currentTime` (ms) the kf playhead seeded from. */
33
+ currentTime: number;
34
+ /** Honest refusal rows (e.g. no running animation by that name). */
35
+ diagnostics: Diagnostic[];
36
+ }
37
+
38
+ /**
39
+ * K2 — `adoptRunning`: the mid-flight TEMPORAL takeover. Given a live element
40
+ * with a running CSS animation, seamlessly hand control to the kf engine:
41
+ *
42
+ * 1. `el.getAnimations()` → find the running `CSSAnimation` matching
43
+ * `{ animationName }`; read its `currentTime` + `playState`.
44
+ * 2. Reconstruct the kf `CSSKeyframesAnimation` from the CSSOM `@keyframes`
45
+ * RULE (via {@link resolveLiveKeyframes} — the AUTHORED form, preserving
46
+ * `var()`/`cqw`/oklab), NOT from `getAnimations().getKeyframes()` (which has
47
+ * px-resolved `var()`/`cqw` and RGB-baked oklab — the very axes kf preserves).
48
+ * 3. Seed the kf animation at the captured `currentTime` (the continuity seed
49
+ * — NOT seed-at-zero, which flashes the element to its 0% state).
50
+ * 4. Commit the current frame inline (the commit-on-ADOPT), then `cancel()`
51
+ * the native animation, so there is no leaked-precedence flash (the inverse
52
+ * of `playWAAPI`'s commit-on-finish discipline — `waapi.ts`).
53
+ * 5. Hand control to the kf engine (the kf animation plays from `currentTime`).
54
+ *
55
+ * NAMED `adoptRunning` to disambiguate from `engine.ts`'s `adoptCompiled`
56
+ * (compiled-state internal adopt — untouched; HARDENING-5 HAZARD-1).
57
+ *
58
+ * @example
59
+ * const { adoptRunning } = await loadAnimationEngine();
60
+ * // el is mid-flight on `.spin { animation: spin 2s linear infinite }`
61
+ * const { animation } = await adoptRunning(el, { animationName: "spin" });
62
+ * // the kf object now drives `el` from the exact playhead — no visible seam.
63
+ * animation?.pause(); // ...now scrub / spring-ify / re-color it.
64
+ */
65
+ export declare const adoptRunning: <V extends Vars = Vars>(el: Element, options: AdoptRunningOptions) => Promise<AdoptResult<V>>;
66
+
67
+ /** Options for {@link adoptRunning}. */
68
+ export declare interface AdoptRunningOptions extends IngestOptions {
69
+ /**
70
+ * The running CSS animation's name to adopt. REQUIRED — an element may host
71
+ * several CSS animations, and the takeover must name exactly one (the
72
+ * `@keyframes` rule to reconstruct + the `getAnimations()` entry to read the
73
+ * playhead from).
74
+ */
75
+ animationName: string;
76
+ /**
77
+ * Commit the native animation's current computed frame inline before
78
+ * cancelling it (the commit-on-ADOPT, the inverse of `playWAAPI`'s
79
+ * commit-on-finish), so there is no flash between the native paint and the
80
+ * kf paint. Default true; set false only when the caller commits itself.
81
+ */
82
+ commit?: boolean;
83
+ }
84
+
85
+ declare interface AnimationFrame<V extends Vars> {
86
+ id: number;
87
+ start: ValueUnit;
88
+ ixs: {
89
+ start: number;
90
+ stop: number;
91
+ };
92
+ time: {
93
+ start: number;
94
+ stop: number;
95
+ };
96
+ flatVars: V;
97
+ vars: V;
98
+ interpVars: {
99
+ [arg: string]: Array<InterpolatedVar<V>>;
100
+ };
101
+ /**
102
+ * Pre-flattened array of all interpolation variables across all properties.
103
+ * Built once during parse() to avoid Object.values().flat() allocation
104
+ * on every interpFrames() call in the hot path.
105
+ */
106
+ allInterpVars: Array<InterpolatedVar<V>>;
107
+ /**
108
+ * Q.WB3 S2 — the precomputed numeric SoA fold layout (built ONCE at `parse`
109
+ * over the stable `allInterpVars` set). `processFrame` folds the numeric subset
110
+ * through ONE `lerpArray` over the packed `Float64Array` buffers and strides
111
+ * the result back into the numeric leaves' `.value` slots; the boxed residual
112
+ * (color/computed/mixed) keeps the per-element `lerpValue`. Absent (undefined)
113
+ * for a frame with no numeric ivs, or before `parse` runs — `processFrame`
114
+ * falls back to the all-boxed walk. Bit-identical to the boxed path.
115
+ */
116
+ _numericPlan?: NumericFoldPlan<V>;
117
+ /**
118
+ * T.A6 — the nested PLAIN authored-shape projection a custom `transform`
119
+ * consumes (numbers where the author wrote numbers, strings where a unit or
120
+ * color demands one). Built lazily on the first apply — `undefined` for a
121
+ * DOM-style default-renderer frame (which consumes `flatVars` directly) and
122
+ * before the first `interpFrames(..., true)`. Invalidated at
123
+ * `finalizeFrameVars` so a color-space renormalize rebuilds it against the
124
+ * fresh interp carriers.
125
+ */
126
+ plainVars?: V;
127
+ /** T.A6 — the per-leaf refresh-writer plan backing {@link plainVars}. */
128
+ _plainProj?: PlainProjection | undefined;
129
+ transform: TransformFunction<V>;
130
+ timingFunction: Easing;
131
+ /**
132
+ * The compiled per-segment `animation-composition` operator (K.W7). A
133
+ * segment runs from a START stop to a STOP stop; the operator is the STOP
134
+ * stop's declared composition (CSS attaches `animation-composition` to the
135
+ * keyframe being composited TOWARD). `replace` (or omission) is the legacy
136
+ * behaviour — the apply writes the lerped value verbatim. `add` accumulates
137
+ * the lerped numeric leaf onto the captured underlying base (un-clamped,
138
+ * element-wise — the same leaf `group.ts`'s `add` layer runs); `accumulate`
139
+ * is repeat-aware (iteration N stacks onto N−1's end). A non-numeric leaf
140
+ * (color, `<custom-ident>`) `replace`-falls-back AND emits a
141
+ * `COMPOSITION_FALLBACK` diagnostic — never a silent wrong pixel.
142
+ */
143
+ composition?: CompositeOperator;
144
+ }
145
+
146
+ export declare class AnimationGroup<V extends Vars> {
147
+ animations: AnimationGroupObject<V>;
148
+ /** The group's composite transform. Defaults to a real no-op at the FIELD
149
+ * (I.W0 S3) — a childless/pre-`parse()` group composites nothing instead of
150
+ * throwing; the constructor overrides it with the first child's transform. */
151
+ transform: TransformFunction<V>;
152
+ superKey: string | undefined;
153
+ paused: boolean;
154
+ started: boolean;
155
+ done: boolean;
156
+ /** When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
157
+ * every child to its final frame in one composite, no rAF loop. Default false. */
158
+ respectReducedMotion: boolean;
159
+ /** Children-per-slice before `advanceTo()` yields to the main thread; larger
160
+ * groups batch with a `scheduler.yield()` between slices (INP relief). */
161
+ static readonly YIELD_BATCH = 32;
162
+ /** Construct a group from a first animation + rest (S.B4 / a06 F1/F2 — the
163
+ * genuine-ownership replacement for the excised `KeyframesAnimation.group()`
164
+ * service locator; each input is a bare animation or `{ animation, layer }`). */
165
+ static of<V extends Vars>(first: KeyframesAnimation<V> | AnimationGroupInput<V>, ...rest: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]): AnimationGroup<V>;
166
+ singleTarget: boolean;
167
+ /**
168
+ * T.A6 — true when the group's composite `transform` is a CUSTOM (non-DOM)
169
+ * consumer that expects the nested PLAIN authored-shape projection (the
170
+ * "animate any object" seam), inherited from the first child's own
171
+ * `unflatten` flag alongside its transform. False (the default) keeps the
172
+ * DOM-style default renderer's FLAT `_grouped` map, byte-unchanged.
173
+ */
174
+ unflatten: boolean;
175
+ lastTickTime: number;
176
+ /** THE rAF owner for the group's draw loop. */
177
+ readonly playback: RAFPlayback;
178
+ resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
179
+ /** The ONE held play promise the `finished` front-door exposes. INTERNAL
180
+ * (S.B5) — read/written by the transport free functions in `./lifecycle`. */
181
+ _playingPromise: Promise<void> | null;
182
+ /** Pre-bound frame callback — allocated once to avoid a per-loop closure.
183
+ * INTERNAL (S.B5) — read by `./lifecycle`'s `play`/`resume` loop start. */
184
+ _boundFrame: (t: number) => boolean | Promise<boolean>;
185
+ /** Cached entries sorted by layer zIndex (see `getEntries`). */
186
+ private _entries;
187
+ private _entriesDirty;
188
+ /** Long-lived composite buffer, cleared in place each frame (zero-alloc).
189
+ * INTERNAL (R.W2) — read/written by `./compositor`. */
190
+ _grouped: Record<string, unknown>;
191
+ /** The compile-stable union of every child's contributed keys — what `_grouped`
192
+ * is null-filled to each frame so the composite clears WITHOUT `delete` (F.W4
193
+ * S2; fold in `./entries`). INTERNAL (R.W2) — the `./compositor` null-fill. */
194
+ _groupedKeys: string[];
195
+ _groupedKeysDirty: boolean;
196
+ /** P.W2 — the SoA composite layout for the `add`/`weighted` blend arms (the
197
+ * validated 3.7×, bit-identical): one {@link SoALayerPlan} per entry, the FLAT
198
+ * pure-numeric pairs hoisted into a {@link Float64Array} fold (built by
199
+ * `buildSoAPlans` in `./soa`, rebuilt ONLY on a structural change). INTERNAL
200
+ * (R.W2) — read/written by `./compositor`. */
201
+ _soaPlans: SoALayerPlan[] | null;
202
+ /**
203
+ * T.A6 — the group's PLAIN authored-shape projection (built from the
204
+ * composite `_grouped` leaf map when `unflatten` is set), rebuilt lazily on a
205
+ * structural change (the SAME `_groupedKeysDirty` seam that drops the SoA
206
+ * plan). Null until the first composited frame populates `_grouped`. INTERNAL
207
+ * — read/written by `./compositor`. */
208
+ _plainProj: PlainProjection | null;
209
+ /** The long-lived SoA fold scratch — the contiguous numeric accumulate buffer,
210
+ * sized to the WIDEST single-layer pair count once per structural change
211
+ * (reused, zero per-frame alloc). INTERNAL (R.W2) — read by `./compositor`. */
212
+ _compositeBuf: Float64Array | null;
213
+ /** K.W11 PHYS-C — true iff ANY layer carries a `weightSpring`; when false (the
214
+ * universal case) `advanceTo` skips the per-frame spring scan (ZERO new work).
215
+ * INTERNAL (R.W2) — set by `./layer-api`'s `transitionLayer`. */
216
+ _hasLayerSprings: boolean;
217
+ constructor(...inputs: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]);
218
+ /** The animation entries sorted by layer zIndex, dirty-flag cached — rebuilt
219
+ * only on a mutation. INTERNAL (R.W2): read by the colocated `./compositor`/
220
+ * `./entries`/`./scheduler`/`./springs` helpers + all hot-path iteration. */
221
+ getEntries(): AnimationGroupEntry<V>[];
222
+ /** Mark entries cache stale. Called at all mutation boundaries.
223
+ * INTERNAL (R.W2) — also called by `./layer-api`. */
224
+ invalidateEntries(): void;
225
+ setSuperKey(superKey: string): this;
226
+ setTargets(...targets: HTMLElement[]): this;
227
+ /** Composite all values into a single grouped transform (single-target,
228
+ * per-frame). R.W2 — `private` (lib-group F8): the PUBLIC single-frame-paint
229
+ * entry is `render(t?)`; the body lives in `./compositor`. Thin delegate. */
230
+ private transformFramesGrouped;
231
+ /**
232
+ * Render the current composition as a static frame — the public entry for
233
+ * state mutated outside the rAF loop (scrubbing, restore, pause snapshots).
234
+ * R.W2 — the silent `|| performance.now()` fabrication is EXCISED: the
235
+ * composite `t` is non-normative for a pure-CSS transform, so a caller with a
236
+ * clock passes it (`render(now)`); a scrub uses the group's REAL `lastTickTime`
237
+ * (0 for a never-ticked group), never a fabricated wall-clock.
238
+ */
239
+ render(t?: number): void;
240
+ /** Set a child's current time without touching its siblings (updates
241
+ * `pausedTime` for a jump-free resume). Chainable; `render()` to reflect it. */
242
+ setChildTime(nameOrAnim: string | KeyframesAnimation<V>, t: number): this;
243
+ /** Advance all child animations to absolute clock `t`. SYNC on the steady path
244
+ * (J.W6 S1): all-synchronous children advance with no per-frame microtask hop;
245
+ * a thenable only on an async child or the over-`YIELD_BATCH` yield path. */
246
+ advanceTo(t: number): this | Promise<this>;
247
+ /** One frame of the group's draw loop: tick all children, then render. */
248
+ private _frame;
249
+ /** The post-advance render half of `_frame` — composite, or settle on done. */
250
+ private _renderFrame;
251
+ /** The completion front-door (G.W13) — `await group.finished` resolves once
252
+ * the in-flight composite play settles. Exposes the ONE held `_playingPromise`
253
+ * (a settled/never-played group resolves immediately). */
254
+ get finished(): Promise<void>;
255
+ /** Start the group. Resolves when all children complete (or on stop/reset).
256
+ * Re-entrant, and PRM-aware — body in `./lifecycle` (S.B5 / a19 F1). */
257
+ play(): Promise<void>;
258
+ /** Pause the group — idempotent. Cancels the rAF loop + renders a final-frame
259
+ * snapshot so the visual matches the pause moment; records each child's
260
+ * jump-free `pausedTime`. Body in `./lifecycle` (S.B5). */
261
+ pause(): this;
262
+ /** Resume the group — idempotent. Unpauses every child DIRECTLY (the group's
263
+ * draw loop owns the ticking). Body in `./lifecycle` (S.B5). */
264
+ resume(): this;
265
+ /** The explicit flip: pauses if playing, resumes if paused. */
266
+ toggle(): this;
267
+ /** Pure state teardown — never paints. Releases every child (`managed = false`,
268
+ * `child.settle()`) and clears the group flags. Body in `./lifecycle` (S.B5). */
269
+ settle(): this;
270
+ /** Explicit rewind: paint every started child back to its INITIAL frame, then
271
+ * settle — the user-facing "return to start". Body in `./lifecycle` (S.B5). */
272
+ reset(): this;
273
+ /** Halt the draw loop, rewind to the initial frame (the transport-stop
274
+ * semantic the demo's controls expect), and resolve any pending `play()`.
275
+ * Body in `./lifecycle` (S.B5). */
276
+ stop(): this;
277
+ playing(): boolean;
278
+ /** Set layer config for an animation by name or reference. Chainable. */
279
+ setLayerConfig(nameOrAnim: string | KeyframesAnimation<V>, config: Partial<AnimationLayerConfig>): this;
280
+ /** Convenience toggle for enabling/disabling a layer. Chainable. */
281
+ setLayerEnabled(nameOrAnim: string | KeyframesAnimation<V>, enabled: boolean): this;
282
+ /** Read the layer config for an animation by name or reference. */
283
+ getLayerConfig(nameOrAnim: string | KeyframesAnimation<V>): AnimationLayerConfig | undefined;
284
+ /** Spring a layer's blend `weight` to `weight` (K.W11 PHYS-C — body in
285
+ * `./layer-api`; a mid-flight re-target re-seats velocity-continuously). */
286
+ transitionLayer(nameOrAnim: string | KeyframesAnimation<V>, target: {
287
+ weight: number;
288
+ spring?: LayerTransitionSpring;
289
+ }): this;
290
+ /** Crossfade two layers (K.W11 PHYS-C — body in `./layer-api`): two spring
291
+ * `transitionLayer` calls, a→0 and b→1. Chainable. */
292
+ crossfade(a: string | KeyframesAnimation<V>, b: string | KeyframesAnimation<V>, options?: {
293
+ spring?: LayerTransitionSpring;
294
+ }): this;
295
+ /** Advance every spring-driven layer weight by `dt` ms (K.W11 PHYS-C). Called
296
+ * from `advanceTo` ONLY when `_hasLayerSprings` is true. R.W2 (lib-group C2):
297
+ * the integrate BODY moved to `./springs`; this thin delegate updates
298
+ * `_hasLayerSprings` from its "any still active?" return. */
299
+ private advanceLayerSprings;
300
+ }
301
+
302
+ export declare interface AnimationGroupEntry<V extends Vars> {
303
+ animation: KeyframesAnimation<V>;
304
+ values: Record<string, unknown>;
305
+ layer: AnimationLayerConfig;
306
+ }
307
+
308
+ /** Input — a bare Animation or one with a layer config. */
309
+ export declare type AnimationGroupInput<V extends Vars> = KeyframesAnimation<V> | {
310
+ animation: KeyframesAnimation<V>;
311
+ layer?: Partial<AnimationLayerConfig>;
312
+ };
313
+
314
+ export declare interface AnimationGroupObject<V extends Vars> {
315
+ [key: string]: AnimationGroupEntry<V>;
316
+ }
317
+
318
+ /**
319
+ * `internal/animation-id.ts` — the shared animation-identity helper (R.W2c).
320
+ *
321
+ * `getAnimationId` was a static member of `engine/animation.ts`, which made
322
+ * `group/group.ts` + `group/entries.ts` reach BACK into the engine zone at
323
+ * runtime purely to resolve a name — one of the two runtime edges that closed
324
+ * the engine↔group ring. It is pure string logic over the minimal identity
325
+ * shape (`{ name?, id }`) every animation already carries, so it belongs in the
326
+ * value.js-free leaf zone, depending on neither engine nor group.
327
+ *
328
+ * Structural by design: it takes `AnimationIdentity` (NOT `KeyframesAnimation`)
329
+ * so it carries ZERO edge to the engine class. The engine barrel re-exports it
330
+ * for the public `getAnimationId` surface; group/compile read it from here.
331
+ *
332
+ * value.js-free (LIGHT).
333
+ */
334
+ /** The minimal identity shape every animation carries — name (optional) + numeric id. */
335
+ declare interface AnimationIdentity {
336
+ name?: string | undefined;
337
+ id: number;
338
+ }
339
+
340
+ declare interface AnimationLayerConfig {
341
+ /** Higher wins. Default: 0 */
342
+ zIndex: number;
343
+ /** 0–1 for 'weighted' blend mode. Default: 1 */
344
+ weight: number;
345
+ /**
346
+ * Optional spring (or any {@link WeightStepper}) DRIVING this layer's
347
+ * blend `weight` (K.W11 PHYS-C — the spring-driven crossfade). When
348
+ * present the `weighted` blend leaf reads `weightSpring.value` in place of
349
+ * the constant `weight` (one nullish read; the per-frame lerp untouched),
350
+ * so a layer transition follows a PHYSICAL trajectory that can overshoot
351
+ * and settle — the flagship demo moment only kf's weighted-blend substrate
352
+ * can hold. Constructed + advanced by `AnimationGroup.transitionLayer` /
353
+ * `crossfade`; cleared on settle, when the read falls back to the
354
+ * now-updated constant `weight`. Absent on a static-weight layer (the
355
+ * read is `?? layer.weight`), so the constant path is byte-unchanged.
356
+ */
357
+ weightSpring?: WeightStepper;
358
+ /**
359
+ * Default: 'replace'. Defaulting on a genuinely-omitted blend mode is
360
+ * the sanctioned contract (the fail-explicit seam throws only on
361
+ * malformed PRESENT input, never on omission) — an unspecified layer
362
+ * blends by replacement, the least-surprising composite.
363
+ */
364
+ blendMode: BlendMode;
365
+ /** Layer toggle. Default: true */
366
+ enabled: boolean;
367
+ /** Optional property whitelist — only these properties will be output from this layer */
368
+ properties?: Set<string>;
369
+ }
370
+
371
+ declare type AnimationOptions = {
372
+ duration: number;
373
+ delay: number;
374
+ iterationCount: number;
375
+ direction: (typeof DIRECTIONS)[number];
376
+ fillMode: (typeof FILL_MODES)[number];
377
+ timingFunction: Easing;
378
+ useWAAPI: boolean;
379
+ /**
380
+ * When true, honor `prefers-reduced-motion: reduce` by snapping the
381
+ * `Animation`/`AnimationGroup` `play()` path to the final frame in a
382
+ * single paint instead of running the rAF/WAAPI loop. SSR-safe no-op
383
+ * off-DOM. Default false (consumers opt in).
384
+ */
385
+ respectReducedMotion: boolean;
386
+ colorSpace: ColorSpace;
387
+ hueMethod?: HueInterpolationMethod;
388
+ /**
389
+ * The LAYER-level `animation-composition` operator (L.W1 S5, Band A) — the
390
+ * round-trip field for an authored `animation-composition: add` that arrived
391
+ * through a sibling `.class { animation: … }` shorthand/longhand ingest.
392
+ * Distinct from the per-KEYFRAME {@link TemplateAnimationFrame.composition}
393
+ * (the per-stop operator); this is the whole-animation composite the engine
394
+ * carries off `extractAnimationOptions`'s `composition` field. Omission means
395
+ * `replace` (the CSS default — the serializer omits it). value.js 0.13.0's
396
+ * `CSSAnimationOptions.composition` surfaces it; `fromString` reads it here.
397
+ */
398
+ composite?: CompositeOperator;
399
+ /**
400
+ * `animation-iteration-composite` (CSS Animations L2). BOOKED, not
401
+ * implemented: the L2 draft marks this property experimental — there is no
402
+ * stable value.js parse for it and no honoring path in the engine. The field
403
+ * is a typed `never` placeholder (a named tripwire): a future
404
+ * silently-WRONG implementation that tries to assign anything to it reddens
405
+ * the type check, forcing the implementation to land alongside a real
406
+ * `proof:iteration-composite-baseline` gate rather than sliding in unproven.
407
+ */
408
+ iterationComposite?: never;
409
+ };
410
+
411
+ export { AnimationRangeValue }
412
+
413
+ export { AnimationTimelineValue }
414
+
415
+ /** Attention animations — a one-shot nudge to draw the eye. */
416
+ declare const attentionPresets: {
417
+ readonly pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
418
+ readonly shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
419
+ readonly bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
420
+ readonly flip: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
421
+ readonly notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
422
+ readonly springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
423
+ readonly springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
424
+ };
425
+
426
+ declare type BlendMode = "replace" | "add" | "weighted";
427
+
428
+ declare const blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
429
+
430
+ declare const blurInOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
431
+
432
+ declare const blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
433
+
434
+ declare const bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
435
+
436
+ /** The compile result — the artifact + the CC-3 ineligibility report. */
437
+ declare interface CompiledCSS {
438
+ /**
439
+ * The zero-runtime CSS artifact — `@keyframes` blocks + `.class { animation }`
440
+ * rules. Empty string when EVERY child refused (then `refusals` carries the
441
+ * whole story).
442
+ */
443
+ css: string;
444
+ /**
445
+ * True iff EVERY walked child compiled faithfully. False when one or more
446
+ * refused — `refusals` names each, and the JS playback is the only faithful
447
+ * path for those.
448
+ */
449
+ eligible: boolean;
450
+ /** The CC-3 refusals — one per child that could not compile faithfully. */
451
+ refusals: CompileRefusal[];
452
+ }
453
+
454
+ /** The entry compile result — the artifact + the refusal report. */
455
+ export declare interface CompiledEntryCSS {
456
+ /** The zero-runtime CSS: base rule + open rule + `@starting-style` per selector. */
457
+ css: string;
458
+ /** True iff EVERY selector compiled faithfully. */
459
+ eligible: boolean;
460
+ /** One refusal per selector that could not compile as a two-endpoint transition. */
461
+ refusals: EntryRefusal[];
462
+ }
463
+
464
+ /** The VT compile result — the artifact + the widened refusal report + the names. */
465
+ export declare interface CompiledViewTransitionCSS extends Omit<CompiledCSS, "refusals"> {
466
+ /** One refusal per role that could not compile faithfully (CC-3 ∪ the VT four). */
467
+ refusals: VTCompileRefusal[];
468
+ /** The `view-transition-name` set the consumer assigns to its elements. */
469
+ names: string[];
470
+ }
471
+
472
+ /** The input shapes `compileToCSS` accepts. */
473
+ declare type CompileInput<V extends Vars = Vars> = AnimationGroup<V> | Sequence<V> | ReadonlyArray<KeyframesAnimation<V> | {
474
+ animation: KeyframesAnimation<V>;
475
+ }>;
476
+
477
+ /** Options for {@link compileToCSS}. */
478
+ declare interface CompileOptions {
479
+ /**
480
+ * Per-child stagger delays (ms), index-aligned with the walked children —
481
+ * the materialized output of `stagger.delays(total)`. CC-1 emits these as
482
+ * literal per-child `animation-delay`, expressing an eased origin-aware
483
+ * curve `sibling-index()` cannot (the universal literal-delay form;
484
+ * `@supports (sibling-index)` is CC-6 BOOK, not the default).
485
+ */
486
+ staggerDelays?: readonly number[];
487
+ /**
488
+ * CC-2 — the oklab densify stop count (the N intermediate `oklab()` stops
489
+ * baked per color segment, INCLUSIVE of endpoints). Default
490
+ * {@link DEFAULT_DENSIFY_STOPS}. Raise it for a longer color arc; the ΔE
491
+ * proof decides ship-vs-refuse.
492
+ */
493
+ densifyStops?: number;
494
+ /**
495
+ * CC-2 — the ΔE-ε ship-vs-refuse threshold (the perceptual-distance band the
496
+ * densified `oklab()` stops must hold against kf's JS lerp). Default
497
+ * {@link DEFAULT_DELTA_E_EPSILON}. A track whose densify exceeds this REFUSES
498
+ * with the perceptual-oklab reason (a drifting densify is worse than an
499
+ * honest refusal).
500
+ */
501
+ deltaEEpsilon?: number;
502
+ /** Prettier print-width for the emitted artifact. Omit for the default. */
503
+ printWidth?: number;
504
+ }
505
+
506
+ /** A single refusal — the child name + a typed reason + a human message. */
507
+ declare interface CompileRefusal {
508
+ /** The compiled child's class/animation name. */
509
+ name: string;
510
+ reason: CompileRefusalReason;
511
+ /** The verbatim message the demo's ineligibility UI shows (CC-4). */
512
+ message: string;
513
+ }
514
+
515
+ /**
516
+ * The reason a child could not compile faithfully. Generalizes
517
+ * `waapiIneligibleReason` to the CSS-compile domain — the trust surface. Each
518
+ * names the kf axis that exceeds pure CSS (the refusal is marketing for the
519
+ * moat). A refused child's JS playback is the only faithful path.
520
+ */
521
+ declare type CompileRefusalReason = "weighted-blend" | "custom-renderer" | "perceptual-oklab" | "computed-unit-drift";
522
+
523
+ /**
524
+ * THE compiler (CC-1/CC-2/CC-3) — compile an orchestration graph to zero-runtime
525
+ * CSS. Walks the input (`AnimationGroup` / `Sequence` / child list), emits one
526
+ * `@keyframes` + one `animation` shorthand per child (the `replace`/`add`
527
+ * layering as `animation-composition`, springs as `linear()`, stagger delays
528
+ * materialized, computed units verbatim, color tracks densified into perceptual
529
+ * `oklab()` stops under the ΔE-ε proof), and REFUSES with a NAMED reason what
530
+ * cannot compile faithfully (CC-3 — the replay-equality invariant's honest
531
+ * refusal). The result is async because `formatCSS` (Prettier) is.
532
+ *
533
+ * @returns `{ css, eligible, refusals }` — the artifact + the trust surface.
534
+ */
535
+ export declare function compileToCSS<V extends Vars>(input: CompileInput<V>, opts?: CompileOptions): Promise<CompiledCSS>;
536
+
537
+ /**
538
+ * THE ENTRY/EXIT EMITTER (C-22 revised, P2-2) — compile a selector-keyed
539
+ * entry/exit spec to zero-runtime `@starting-style` + `allow-discrete` CSS. Emits
540
+ * per selector: the base/closed rule (exit endpoint + `display:none` + the exit
541
+ * transition list), the open rule (enter endpoint + `display` + the entry list),
542
+ * and the `@starting-style` block (enter's FIRST frame). Asymmetric entry/exit
543
+ * timing rides the two lists; `linear()` springs ride verbatim; color endpoints
544
+ * canonicalize to `oklab()`. REFUSES with a NAMED reason (3 inherited + 6
545
+ * entry-specific) what cannot compile as a two-endpoint transition.
546
+ *
547
+ * @returns `{ css, eligible, refusals }`.
548
+ */
549
+ export declare function compileToEntry<V extends Vars>(spec: Record<string, EntryRoleSpec<V>>, opts?: EntryCompileOptions): Promise<CompiledEntryCSS>;
550
+
551
+ /**
552
+ * THE VIEW-TRANSITIONS EMITTER (SF-1/SF-2/SF-3) — compile a name-keyed role spec
553
+ * to a zero-runtime `::view-transition-*` CSS artifact. Emits per name: the
554
+ * old/new `@keyframes` + shorthand, the MANDATORY timing-only group override, an
555
+ * optional class-cohort rule, wrapped in `:active-view-transition-type(...)` when
556
+ * `types` are given; prepends the cross-doc preamble under `crossDocument`; and
557
+ * appends the PRM `animation: none` degrade by default. REFUSES with a NAMED
558
+ * reason (the CC-3 four ∪ the VT four) what cannot round-trip faithfully.
559
+ *
560
+ * @returns `{ css, eligible, refusals, names }` — the artifact + the trust surface.
561
+ */
562
+ export declare function compileToViewTransition<V extends Vars>(spec: Record<string, VTRoleSpec<V>>, opts?: ViewTransitionCompileOptions): Promise<CompiledViewTransitionCSS>;
563
+
564
+ /**
565
+ * The CSS `animation-composition` operator (K.W7). Distinct from
566
+ * {@link BlendMode} (the GROUP's per-LAYER blend tier — `replace`/`add`/
567
+ * `weighted`): this is the per-KEYFRAME composite operator the author declares
568
+ * on a single animation, matching the CSS grammar exactly (`weighted` is not a
569
+ * CSS composite; `accumulate` is the repeat-aware one CSS adds). The engine
570
+ * routes `add`/`accumulate` onto the SAME un-clamped numeric leaf the group's
571
+ * `add` layer runs (`group.ts`), so the two tiers share one accumulation
572
+ * semantic without sharing a type.
573
+ */
574
+ declare type CompositeOperator = "replace" | "add" | "accumulate";
575
+
576
+ /**
577
+ * Construct a `ScrollScene` from a parsed `CSSTimelineOptions` (the SO-1 parse
578
+ * output) OR a direct `ScrollSceneOptions` spec. The CSS-fed construction is the
579
+ * round-trip's driving half (parse → drive); the spec-fed construction is
580
+ * value.js-INDEPENDENT (it needs no grammar — only the physics primitives).
581
+ *
582
+ * @example
583
+ * // CSS-fed (value.js-gated parse → JS driver):
584
+ * const opts = parseScrollCSS(stylesheet);
585
+ * const scene = createScrollScene({ range: opts.range, scrub: 0.2 });
586
+ * // spec-fed (value.js-independent):
587
+ * const scene = createScrollScene({ range: { start: { offset: "0%" }, end: { offset: "100%" } } });
588
+ */
589
+ export declare function createScrollScene(spec?: ScrollSceneOptions | CSSTimelineOptions): ScrollScene;
590
+
591
+ /**
592
+ * Construct a `TriggerScene` from a parsed `AnimationTriggerValue` OR a full
593
+ * `CSSTimelineOptions` (the {@link parseScrollCSS} output — the `.trigger` field
594
+ * is used). The CSS-fed construction is the round-trip's driving half (parse →
595
+ * behavior); the value-fed construction is value.js-INDEPENDENT.
596
+ *
597
+ * @example
598
+ * // grammar → behavior (the round-trip):
599
+ * const opts = parseScrollCSS(stylesheet); // { …, trigger: { type: "repeat", range } }
600
+ * const scene = createTriggerScene(opts);
601
+ * scene.triggerProgress(0.5); // → "active"
602
+ */
603
+ export declare function createTriggerScene(spec?: AnimationTriggerValue | CSSTimelineOptions): TriggerScene;
604
+
605
+ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnimation<V> {
606
+ /**
607
+ * Q.WD1-bind S2 (DM-22) — the timeline a scroll-range named selector resolves
608
+ * its phase against. Stored by {@link bindTimeline} for the no-timeline guard's
609
+ * check; `undefined` until a timeline is bound. A scroll-context operation
610
+ * specific to CSS keyframes with named selectors (the base `Animation` class is
611
+ * value.js-/scroll-agnostic), so the field + method live here.
612
+ */
613
+ private _boundTimeline?;
614
+ constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
615
+ /**
616
+ * Q.WD1-bind S2 (DM-22) — the attach-time deferred-resolution seam. A
617
+ * scroll-range named keyframe selector (`entry`/`exit`/`cover`/`contain`)
618
+ * ingests OPAQUELY (the L.W1 S4 floor) and is RESOLVABLE only under a timeline;
619
+ * `bindTimeline` is where that resolution happens. It walks `templateFrames`,
620
+ * resolves each named-selector start to a numeric `%` `ValueUnit` via
621
+ * {@link namedSelectorToFraction}, CLEARS the `NAMED_SELECTOR_SUPERTYPE` tag (so
622
+ * the resolved frame is indistinguishable from an author-written `%` at the sort
623
+ * step — no NaN), and re-compiles. The play-time guard
624
+ * (`assertNoUnresolvedNamedSelector`) then finds zero unresolved frames and
625
+ * passes silently — so this MUST land before the guard fires (the gate-enforced
626
+ * sub-wave ordering: the guard over-throws on a bound animation if the resolver
627
+ * is absent).
628
+ *
629
+ * Idempotent + safe to call before `fromString`: with no named frames the walk
630
+ * is a no-op; calling it after a NaN-producing `parse()` purges the NaN frames.
631
+ */
632
+ bindTimeline(timeline: Timeline): this;
633
+ /**
634
+ * One transform-resolution seam for the three `from*` entry points:
635
+ * a supplied transform is the consumer's renderer (vars arrive
636
+ * unflattened); genuine omission resolves to the instance's ONE
637
+ * default DOM-style renderer, which keeps WAAPI eligibility a
638
+ * reference comparison (`usesDefaultRenderer`).
639
+ */
640
+ private resolveTransform;
641
+ fromVars(vars: V[], transform?: TransformFunction<V>): this;
642
+ fromKeyframes(keyframes: Map<string, Partial<V>> | Record<string, Partial<V>>, transform?: TransformFunction<V>): this;
643
+ /**
644
+ * Property registry from `@property` declarations parsed by
645
+ * `fromString`. Empty when the input had no `@property` rules.
646
+ * Consumers can read this to recover the type metadata for
647
+ * custom properties (syntax string, initial value, inheritance
648
+ * flag) without re-parsing the source CSS.
649
+ */
650
+ propertyRegistry: Map<string, PropertyDescriptor_2>;
651
+ /**
652
+ * Parsed scroll-grammar (`animation-timeline` / `animation-range` /
653
+ * `timeline-scope` / `animation-trigger`) recovered from a sibling style rule
654
+ * by `fromString` (L.W2 S1 — CC-6) via `recoverScrollOptions` (the
655
+ * CSS-metadata-recovery seam); `undefined` when the input carried no scroll
656
+ * grammar (the canonical time-clock animation). A read-only metadata field —
657
+ * no hot-path impact, analogous to {@link propertyRegistry}. The compiler
658
+ * (`compileToCSS`) reads it to EMIT the scroll longhands back out, closing the
659
+ * round-trip's EMIT half.
660
+ */
661
+ scrollOptions?: CSSTimelineOptions;
662
+ fromString(keyframes: string, transform?: TransformFunction<V>): this;
663
+ }
664
+
665
+ export declare function CSSKeyframesToString<V extends Vars>(animation: KeyframesAnimation<V>, name?: string, printWidth?: number | undefined): Promise<string>;
666
+
667
+ /**
668
+ * Per-stop card serializer for the editor pane — ONE formatted keyframe
669
+ * string per DECLARED template stop, index-aligned with
670
+ * `animation.templateFrames` (the pairing the card list renders by).
671
+ * Unified onto the declared-template authority (J.W1 S1): each card is
672
+ * {@link declaredKeyframeBody} — the AUTHORED values. The former path mapped
673
+ * `animation.frames` (the interp PAIRS — N−1 segments for N stops, so the
674
+ * last card simply did not exist) and read `frame.flatVars` (DOM-resolved,
675
+ * interp-mutated) — both defects die with the unification.
676
+ */
677
+ export declare const CSSKeyframesToStrings: <V extends Vars>(animation: KeyframesAnimation<V>) => Promise<string[]>;
678
+
679
+ export { CSSTimelineOptions }
680
+
681
+ export declare const defaultLayerConfig: AnimationLayerConfig;
682
+
683
+ export declare const defaultOptions: AnimationOptions;
684
+
685
+ /**
686
+ * A structured parse/honoring diagnostic (K.W7 S4). Extends the value.js
687
+ * `ParseDiagnostic` producer (the CONSUMED shape — `message`/`offset`/`line`/
688
+ * `column`/`expected`/`input`) with a stable kf-side {@link DiagnosticCode} and
689
+ * an optional `property` (the leaf a `COMPOSITION_FALLBACK` names). The
690
+ * value.js half (`message`/`offset`/…) is `Partial` because the engine-internal
691
+ * rows (EMPTY_PARSE, COMPOSITION_FALLBACK) are NOT byte-offset parse failures —
692
+ * they carry a `message` + `code` only; a row sourced from the value.js
693
+ * `OnParseError` producer carries the full positional record. NOT a kf-local
694
+ * re-author of the producer: it CONSUMES `ParseDiagnostic`'s field shape and
695
+ * widens it with the stable code (inv-16 published-only consumption holds).
696
+ */
697
+ declare interface Diagnostic extends Partial<ParseDiagnostic> {
698
+ /** A stable, branch-on-able code — never scrape `message`. */
699
+ code: DiagnosticCode;
700
+ /** The human-readable summary (always present; the producer's or kf's). */
701
+ message: string;
702
+ /** The CSS property a `COMPOSITION_FALLBACK` refuses to composite. */
703
+ property?: string;
704
+ }
705
+
706
+ /**
707
+ * The stable diagnostic `code`s the kf-side sink emits (K.W7 S4). A FLAT,
708
+ * additive enum — NOT a logging framework — so a programmatic consumer branches
709
+ * on the reason without scraping a message string (the J.W1 typed-throw idiom
710
+ * lifted onto the structured field). The engine-internal rows
711
+ * (`EMPTY_PARSE`/`UNKNOWN_TIMING_FN`) were J.W1-landed as typed throws; W7 lifts
712
+ * them onto this field. `COMPOSITION_FALLBACK` is the K.W7 honesty row (the
713
+ * non-numeric composite leaf's refusal). `PARSE_ERROR` carries the value.js
714
+ * `OnParseError` producer's structured diagnostic verbatim. The CORS-skip /
715
+ * WAAPI-reason rows are AUTHORED here but POPULATED by K.W8 (which owns the
716
+ * CSSOM walk that produces them).
717
+ */
718
+ declare type DiagnosticCode = "EMPTY_PARSE" | "UNKNOWN_TIMING_FN" | "COMPOSITION_FALLBACK" | "PARSE_ERROR" | "CORS_SKIP" | "WAAPI_INELIGIBLE" | "ADOPT_REFUSE" | "PROPERTY_REGISTER_REJECTED" | "CUSTOM_FN_ARG_DROP";
719
+
720
+ export declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
721
+
722
+ /**
723
+ * SO-1/SO-2 the DISPATCH (conservative-correct, with a queryable reason). The
724
+ * WAAPI-eligibility seam pointed at the scroll clock:
725
+ *
726
+ * DOM target + WAAPI-eligible + native ScrollTimeline present + NO scrub/snap/
727
+ * velocity → NATIVE (zero main-thread)
728
+ * scrub OR snap OR velocity requested → JS (native has no smoother/snap)
729
+ * non-DOM target / no animation → JS (the universal driver)
730
+ * WAAPI-ineligible (computed unit / color / custom curve) → JS (the ineligible set)
731
+ * native ScrollTimeline ABSENT (Firefox, jsdom, SSR) → JS (createNativeTimeline → null)
732
+ *
733
+ * The JS path NEVER deletes the native lane and the native path NEVER swallows
734
+ * an ineligible animation — the reason string is the honesty surface (the
735
+ * `waapiIneligibleReason` idiom). This ADDS a tier; it deletes no driver.
736
+ */
737
+ export declare function dispatchScrollBackend<V extends Vars>(request: ScrollDispatchRequest<V>): ScrollDispatch;
738
+
739
+ /**
740
+ * `DrawSVG` — the class form of {@link fromDrawSVG}, for callers who prefer a
741
+ * named primitive alongside `CSSKeyframesAnimation` / `MotionPath`. Construction
742
+ * is the factory: `new DrawSVG(target).animation` is the control handle. The
743
+ * factory is the canonical entry; this is a thin ergonomic wrapper.
744
+ */
745
+ export declare class DrawSVG<V extends Vars = Vars> extends SVGAnimationHandle<V> {
746
+ constructor(target: SVGDrawTarget, options?: DrawSVGOptions);
747
+ }
748
+
749
+ export declare interface DrawSVGOptions extends Partial<InputAnimationOptions> {
750
+ /**
751
+ * Start of the draw sweep — a percent STRING (`"0%"` → `"100%"`) or a 0..1
752
+ * NUMBER fraction (`0` → `1`), the two unambiguous forms. Default `"0%"` —
753
+ * the stroke starts undrawn (full `stroke-dashoffset`) and draws IN; `"100%"`
754
+ * → `"0%"` (or `1` → `0`) erases it. A number outside `[0, 1]` throws (a
755
+ * percent must be a string — no silent `50`-means-5000% footgun).
756
+ */
757
+ from?: string | number;
758
+ /** End of the draw sweep — same `"100%"`/`1` two-form contract. Default `"100%"`. */
759
+ to?: string | number;
760
+ /**
761
+ * Auto-start the play loop after construction + targeting. Default true.
762
+ * `false` returns a constructed, targeted, NOT-yet-playing handle so the
763
+ * caller can drive the returned animation (`.play()` / `.pause()` / `.stop()`).
764
+ */
765
+ autoPlay?: boolean;
766
+ }
767
+
768
+ /**
769
+ * The typed easing value — a callable curve plus, when one exists, the CSS
770
+ * easing string that reproduces it (e.g. a spring's `linear()` stops).
771
+ *
772
+ * Replaces the former Symbol-on-a-closure side channel: the "this closure
773
+ * has a CSS twin" fact now flows through the type system, so wrapping or
774
+ * binding the callable can no longer silently drop it. `waapi.ts` reads
775
+ * `.css` to run the true curve on the compositor; everything else reads
776
+ * `.fn`.
777
+ */
778
+ declare interface Easing {
779
+ /** The callable curve — the hot-path interpolation function. */
780
+ fn: TimingFunction;
781
+ /** CSS easing string that faithfully reproduces `fn`, when one exists. */
782
+ css?: string;
783
+ }
784
+
785
+ /** Entrance animations — bring an element INTO view. */
786
+ declare const enterPresets: {
787
+ readonly fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
788
+ readonly slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
789
+ readonly slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
790
+ readonly slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
791
+ readonly rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
792
+ readonly blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
793
+ readonly springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
794
+ readonly springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
795
+ readonly jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
796
+ };
797
+
798
+ /** Options for {@link compileToEntry}. */
799
+ export declare interface EntryCompileOptions {
800
+ /** The open-state selector suffix, concatenated onto the base selector. Default `".open"`. */
801
+ openSelector?: ".open" | "[data-open]" | ":popover-open" | "[open]" | (string & {});
802
+ /** The open `display` value (the base rule is always `display: none`). Default `"block"`. */
803
+ display?: string;
804
+ /**
805
+ * Emit `overlay <dur> allow-discrete` on both lists (default `true`). Emitted
806
+ * UNCONDITIONALLY — it materializes only for top-layer elements (popover/
807
+ * dialog), inert-but-harmless elsewhere, so a caller rarely turns it off.
808
+ */
809
+ overlay?: boolean;
810
+ /** Prettier print-width for the emitted artifact. Omit for the default. */
811
+ printWidth?: number;
812
+ }
813
+
814
+ /** A single entry refusal — the selector + a typed reason + a human message. */
815
+ export declare interface EntryRefusal {
816
+ /** The refused selector (spec key). */
817
+ name: string;
818
+ reason: EntryRefusalReason;
819
+ message: string;
820
+ }
821
+
822
+ /** The refusal taxonomy — 3 inherited + 6 entry-specific (P2-2.3). */
823
+ export declare type EntryRefusalReason = "custom-renderer" | "weighted-blend" | "computed-unit-drift" | "entry-multi-keyframe" | "entry-iteration" | "entry-composition" | "entry-scroll-grammar" | "entry-color-space" | "entry-easing-twin";
824
+
825
+ /** The per-selector entry/exit role. Each animation is 2-stop (a transition endpoint pair). */
826
+ export declare interface EntryRoleSpec<V extends Vars = Vars> {
827
+ /** The ENTER animation: first frame → `@starting-style`, last frame → the open rule. */
828
+ enter?: KeyframesAnimation<V>;
829
+ /** The EXIT animation: last frame → the closed rule. Defaults to `enter` REVERSED. */
830
+ exit?: KeyframesAnimation<V>;
831
+ }
832
+
833
+ /** Exit animations — take an element OUT of view. */
834
+ declare const exitPresets: {
835
+ readonly fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
836
+ readonly slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
837
+ readonly slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
838
+ readonly blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
839
+ readonly warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
840
+ readonly warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
841
+ readonly jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
842
+ };
843
+
844
+ /**
845
+ * `explain(css, opts?)` — the human/LLM-readable companion. Calls
846
+ * {@link validate} and formats the result as a concise, DETERMINISTIC string
847
+ * (field order fixed, no locale-sensitive formatting) so a doctest can assert it
848
+ * byte-for-byte. The shape the demo's ineligibility panel produces, as a
849
+ * first-class library API. An LLM agent can present it verbatim or parse it for a
850
+ * fix suggestion.
851
+ *
852
+ * Format (one block; the `–` bullets enumerate the refusals / WAAPI reason /
853
+ * diagnostics, each on its own line):
854
+ *
855
+ * @keyframes color-drift:
856
+ * parseable: yes
857
+ * compile-eligible: no
858
+ * – perceptual-oklab: color-drift cannot compile: …
859
+ * waapi-eligible: no
860
+ * – color interpolation requires perceptual lerp
861
+ * diagnostics:
862
+ * – COMPOSITION_FALLBACK: …
863
+ */
864
+ export declare function explain(css: string, opts?: ValidateOptions): Promise<string>;
865
+
866
+ declare const fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
867
+
868
+ declare const fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
869
+
870
+ export declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
871
+
872
+ declare const flipPreset: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
873
+
874
+ export declare function formatCSSKeyframeString(keyframe: string): string;
875
+
876
+ declare class FrameCompiler<V extends Vars = Vars> {
877
+ private readonly _options;
878
+ templateFrames: TemplateAnimationFrame<V>[];
879
+ parsedVars: ParsedVarMap[];
880
+ frames: AnimationFrame<V>[];
881
+ /**
882
+ * Next TEMPLATE frame id — a monotonic handle assigned in `addFrame`
883
+ * (stable across re-parse, since `parse` does not re-add templates).
884
+ * Compiled-frame ids are content-derived from `(startIx, stopIx)`
885
+ * (see `createFrame`), NOT this counter, so `parse()` is idempotent.
886
+ */
887
+ frameId: number;
888
+ /**
889
+ * The compile inputs live on the owning `Animation`'s `options` object.
890
+ * The compiler holds a REFERENCE to it (the setters mutate it in place,
891
+ * never replace it), so the NEXT compile always reads the current
892
+ * `duration`/`easing`/`colorSpace` without re-linking. For values baked
893
+ * into already-compiled frames, the setter triggers a targeted re-derive:
894
+ * `setDuration` rescales `frame.time` in place; `setColorSpace`/
895
+ * `setHueMethod` call {@link renormalizeColors} (the color resolution is
896
+ * the only baked state that depends on them). No setter silently no-ops a
897
+ * change to compiled state.
898
+ */
899
+ constructor(_options: AnimationOptions);
900
+ /**
901
+ * The live options object the compiler reads (a REFERENCE to the owning
902
+ * `Animation`'s `options` — the setters mutate it in place). Read-only:
903
+ * the compiler never replaces it. Exposed so `Animation.adoptCompiled`
904
+ * can re-bind `Animation.options` to the adopted compiler's options object
905
+ * BY CONSTRUCTION (`this.options === this.compiler.options`, the live-options
906
+ * invariant — G.W19 / the `6e29236` lock), without poking a private field.
907
+ */
908
+ get options(): AnimationOptions;
909
+ addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): void;
910
+ createFrame(startIx: number, endIx: number): AnimationFrame<V>;
911
+ /**
912
+ * Build an index mapping each variable name to the frame indices where
913
+ * it appears. Used by reconcileVars() for O(1) "next occurrence" lookups
914
+ * instead of O(N) findIndex scans per variable.
915
+ */
916
+ private buildVarIndex;
917
+ /**
918
+ * Reconcile interpolation variables across non-adjacent keyframes.
919
+ * For each variable at frame `ix`, find the next frame that also
920
+ * defines that variable and create an interpolation segment between them.
921
+ *
922
+ * Uses a pre-built variable index (from buildVarIndex) to avoid
923
+ * O(frames²) findIndex scans.
924
+ */
925
+ reconcileVars(ix: number, varIndex: Map<string, number[]>): void;
926
+ /**
927
+ * Compile `templateFrames` into the sampled `frames[]`. `targets` is the
928
+ * one DOM input — each parsed var is bound to it so computed-unit
929
+ * resolution can read the live box. Pure otherwise.
930
+ */
931
+ parse(targets: HTMLElement[]): void;
932
+ /**
933
+ * Derive a frame's `flatVars`/`vars`/`allInterpVars` from its
934
+ * `interpVars` — the pre-flattened forms the hot path
935
+ * (`interpFrames`) iterates without re-walking. Called once per frame
936
+ * at the tail of `parse`, and again by `renormalizeColors` after a
937
+ * color-space change re-derives the interp carriers in place.
938
+ */
939
+ private finalizeFrameVars;
940
+ /**
941
+ * Re-derive the color-resolved interpolation carriers in place after a
942
+ * `colorSpace`/`hueMethod` change on already-compiled frames. Only the
943
+ * per-`InterpolatedVar` color resolution depends on the color space —
944
+ * the flatten/sort/reconcile structure does not — so this re-runs
945
+ * `createInterpVarValue` over the existing `frames`/`parsedVars` and
946
+ * rebuilds the hot-path arrays, with NO re-flatten and NO re-sort. The
947
+ * new carriers derive from the already-target-bound `parsedVars`, the
948
+ * same provenance `parse` gives them, so DOM binding is preserved.
949
+ *
950
+ * The owning `Animation`'s `setColorSpace`/`setHueMethod` call this when
951
+ * frames already exist; before `parse`, the option is simply read by the
952
+ * next compile.
953
+ */
954
+ renormalizeColors(): void;
955
+ }
956
+
957
+ /**
958
+ * Build a CSS-native SVG line-drawing animation: read the target's path length
959
+ * ONCE, set `stroke-dasharray` to that length (one solid full-length dash), and
960
+ * sweep `stroke-dashoffset` from → to (default `0% → 100%` ⇒ offset `L → 0`,
961
+ * the line draws in). Returns the constructed {@link CSSKeyframesAnimation} as
962
+ * the control handle (the control-handle contract — `.play()` / `.pause()` /
963
+ * `.stop()` / `.finished`), consistent with the `from*` factory family.
964
+ *
965
+ * The returned animation passes the EXISTING WAAPI eligibility gate
966
+ * (`isWAAPIEligible`) for an SVG DOM target with a uniform CSS-twin easing, and
967
+ * delegates compositor-thread via `playWAAPI` — no new eligibility predicate.
968
+ *
969
+ * The line length `L` is read a SINGLE time at construction (the
970
+ * `motion-path.ts` "browser owns the geometry" pattern). A path mutated mid-draw
971
+ * is a re-construct, not a per-frame re-measure — a per-frame `getTotalLength`
972
+ * would be a layout round-trip the Mandate's measure-first forbids.
973
+ *
974
+ * @param target an SVG geometry element exposing `getTotalLength()`.
975
+ * @param options `{ from?, to?, ...animationOptions }`.
976
+ *
977
+ * @example
978
+ * // Draw a path stroke in over 2s:
979
+ * fromDrawSVG(pathEl, { duration: 2000 });
980
+ */
981
+ export declare function fromDrawSVG<V extends Vars = Vars>(target: SVGDrawTarget, options?: DrawSVGOptions): CSSKeyframesAnimation<V>;
982
+
983
+ /**
984
+ * K1 — `fromLiveAnimations`: adopt every RUNNING CSS animation on the document
985
+ * (or a single element) by reconstructing each from its source `@keyframes`
986
+ * RULE (via the CSSOM walk — NOT from `getAnimations().getKeyframes()`, the
987
+ * computed form that has lost `var()`/`cqw`/oklab). The `getAnimations()` read
988
+ * provides the SET of live animation names; the reconstruction provides the
989
+ * authored keyframes. The result maps each live animation name → its
990
+ * reconstructed kf object (the recovered, axis-preserving source).
991
+ *
992
+ * Distinct from {@link fromStyleSheets} (which walks EVERY declared `@keyframes`
993
+ * rule, running or not): `fromLiveAnimations` narrows to the names currently
994
+ * RUNNING on the page — the animations a user actually sees in motion.
995
+ */
996
+ export declare const fromLiveAnimations: <V extends Vars = Vars>(target?: Document | Element, options?: IngestOptions) => IngestResult<V>;
997
+
998
+ /**
999
+ * Build an SVG path-shape morph: sample two `d` strings at `samples` uniform
1000
+ * arc-length steps each, pair the point sets, and interpolate the `(x, y)`
1001
+ * pairs from the `from`-polyline (`0%`) to the `to`-polyline (`100%`). Returns
1002
+ * the constructed {@link CSSKeyframesAnimation} as the control handle (the
1003
+ * control-handle contract — `.play()` / `.pause()` / `.stop()` / `.finished`),
1004
+ * consistent with the `from*` factory family.
1005
+ *
1006
+ * value.js's `PathGeometry` owns the geometry (the `d`-parse + arc-length
1007
+ * table, built ONCE per path at construction); the engine's native numeric
1008
+ * `lerp` traverses the per-point coordinate keys. The morphed `d` at any `t` is
1009
+ * reassembled from the interpolated points — read it via the `MorphSVG` class's
1010
+ * {@link MorphSVG.sampleD}.
1011
+ *
1012
+ * Refuses a degenerate input: a zero-length `from` or `to` path throws a typed
1013
+ * {@link AnimationOptionError} rather than faking a silent zero-frame / identity
1014
+ * morph (the honest-or-refuse law — a morph between a zero-length path and
1015
+ * anything is a malformed input, not a morph).
1016
+ *
1017
+ * @param from the source SVG path `d` string.
1018
+ * @param to the target SVG path `d` string (differing geometry).
1019
+ * @param options `{ samples?, target?, orient?, autoPlay?, ...animationOptions }`.
1020
+ *
1021
+ * @example
1022
+ * // Morph a triangle into a square over 1s, RENDERING onto a live <path>:
1023
+ * const path = document.querySelector("path");
1024
+ * const m = fromMorphSVG(
1025
+ * "M 0 0 L 100 0 L 50 100 Z",
1026
+ * "M 0 0 L 100 0 L 100 100 L 0 100 Z",
1027
+ * { duration: 1000, target: path },
1028
+ * );
1029
+ * // each frame the engine writes path.style.d = path("…") + --morph-d so the
1030
+ * // morphing shape paints directly (no author-side reader needed on Chromium/
1031
+ * // Safari; `<path style="d: var(--morph-d)">` is the Firefox-lags fallback).
1032
+ */
1033
+ export declare function fromMorphSVG<V extends Vars = Vars>(from: string, to: string, options?: MorphSVGOptions): CSSKeyframesAnimation<V>;
1034
+
1035
+ /**
1036
+ * Build a CSS-native path-motion animation: set the author `offset-path` (and
1037
+ * optional `offset-rotate`) on the target(s), and sweep `offset-distance` from
1038
+ * → to. Returns the constructed {@link CSSKeyframesAnimation} as the control
1039
+ * handle (the control-handle contract — `.play()` / `.pause()` / `.stop()` / the
1040
+ * awaitable play promise), consistent with the `from*` factory family.
1041
+ *
1042
+ * The returned animation passes the EXISTING WAAPI eligibility gate
1043
+ * (`isWAAPIEligible`) for a DOM target with a uniform CSS-twin easing, and
1044
+ * delegates compositor-thread via `playWAAPI` — no new eligibility predicate.
1045
+ *
1046
+ * @param target one or more DOM elements (or a single element) to move.
1047
+ * @param options `{ path, from?, to?, rotate?, ...animationOptions }`.
1048
+ *
1049
+ * @example
1050
+ * // Move a box along a quadratic path, facing along it, over 2s:
1051
+ * fromMotionPath(box, {
1052
+ * path: "path('M 0 0 Q 100 -100 200 0')",
1053
+ * rotate: "auto",
1054
+ * duration: 2000,
1055
+ * });
1056
+ */
1057
+ export declare function fromMotionPath<V extends Vars = Vars>(target: HTMLElement | HTMLElement[], options: MotionPathOptions): CSSKeyframesAnimation<V>;
1058
+
1059
+ /**
1060
+ * K1 — `fromStyleSheets`: the consumer-facing front door over
1061
+ * {@link resolveLiveKeyframes}. Walk the document's (or the given list's)
1062
+ * stylesheets and return every reconstructed `@keyframes` animation. The honest
1063
+ * `CORS_SKIP`/`PARSE_ERROR` rows ride the returned {@link IngestResult}.
1064
+ *
1065
+ * @example
1066
+ * const { CSSKeyframesAnimation, fromStyleSheets } = await loadAnimationEngine();
1067
+ * const { animations, diagnostics } = fromStyleSheets();
1068
+ * const pulse = animations.get("pulse")?.animation;
1069
+ * pulse?.setTargets(el).play(); // re-drive the page's OWN animation
1070
+ * for (const d of diagnostics) console.warn(d.code, d.message); // honest skips
1071
+ */
1072
+ export declare const fromStyleSheets: <V extends Vars = Vars>(source?: Document | ShadowRoot | CSSStyleSheet[] | CSSStyleSheet, options?: IngestOptions) => IngestResult<V>;
1073
+
1074
+ /**
1075
+ * Resolve a stable name for an animation reference: the explicit `name` when
1076
+ * set, else the numeric `id` stringified. A bare string passes through (the ONE
1077
+ * place a name-or-animation reference collapses to a name).
1078
+ */
1079
+ export declare const getAnimationId: (animation: AnimationIdentity | string) => string;
1080
+
1081
+ /**
1082
+ * Resolve a timing-function input to a callable `TimingFunction`.
1083
+ *
1084
+ * Accepts:
1085
+ * - a `TimingFunction` — returned as-is
1086
+ * - a named entry in `timingFunctions` (`ease-out-cubic`,
1087
+ * `easeOutCubic`, `linear`, etc.) — looked up in the registry
1088
+ * - a CSS `cubic-bezier(x1, y1, x2, y2)` literal string —
1089
+ * parsed to control points and resolved via `CSSCubicBezier`
1090
+ * - a CSS `steps(n[, position])` literal plus the `step-start` /
1091
+ * `step-end` keywords — resolved via `steppedEase`, so the full
1092
+ * CSS Easing Level 1 vocabulary round-trips through `fromString`
1093
+ * - `undefined` or a name/literal the registry can't find —
1094
+ * returns `undefined` so callers can decide (the option setters
1095
+ * throw a typed `AnimationOptionError`, fail-explicit)
1096
+ */
1097
+ export declare const getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
1098
+
1099
+ declare const glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1100
+
1101
+ declare const gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1102
+
1103
+ declare const heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1104
+
1105
+ declare const hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1106
+
1107
+ /**
1108
+ * One ingested animation + the diagnostics its reconstruction produced. The
1109
+ * `name` is the `@keyframes` identifier (the CSSOM `CSSKeyframesRule.name`); the
1110
+ * `animation` is the reconstructed `CSSKeyframesAnimation`, already carrying any
1111
+ * sibling-style-rule `animation-*` options. `diagnostics` carries the honesty
1112
+ * rows for THIS rule (a malformed body → `PARSE_ERROR`, etc.); the walk-level
1113
+ * rows (`CORS_SKIP`) ride {@link IngestResult.diagnostics}.
1114
+ */
1115
+ export declare interface IngestedAnimation<V extends Vars = Vars> {
1116
+ /** The `@keyframes` identifier (CSSOM `CSSKeyframesRule.name`). */
1117
+ name: string;
1118
+ /** The reconstructed kf animation — replay-equal to the source CSS. */
1119
+ animation: CSSKeyframesAnimation<V>;
1120
+ /** Per-rule reconstruction diagnostics (empty on a clean ingest). */
1121
+ diagnostics: Diagnostic[];
1122
+ }
1123
+
1124
+ /** Options shared by the ingest entry points. */
1125
+ export declare interface IngestOptions {
1126
+ /**
1127
+ * Restrict the ingest to a single `@keyframes` name. When set, only the
1128
+ * matching rule is reconstructed (the rest are skipped without a
1129
+ * diagnostic — a name filter is an intentional narrowing, not a failure).
1130
+ */
1131
+ animationName?: string;
1132
+ /**
1133
+ * Animation options applied as the BASE for each reconstructed animation,
1134
+ * BELOW any sibling-style-rule `animation-*` declarations the source CSS
1135
+ * carries (the source's declared options win — the round-trip preserves the
1136
+ * AUTHORED timing). Empty by default.
1137
+ */
1138
+ options?: Partial<InputAnimationOptions>;
1139
+ }
1140
+
1141
+ /**
1142
+ * The result of a CSSOM walk: every `@keyframes` rule reconstructed into a kf
1143
+ * animation, plus the WALK-LEVEL diagnostics (the `CORS_SKIP` rows a
1144
+ * cross-origin sheet produces — the honesty surface S3). A consumer reads
1145
+ * `animations` for the recovered objects and `diagnostics` for the citable
1146
+ * reasons the walk could not complete a step faithfully — NEVER a silent drop.
1147
+ */
1148
+ export declare interface IngestResult<V extends Vars = Vars> {
1149
+ /** Every `@keyframes` rule reconstructed, keyed by its CSS name. */
1150
+ animations: Map<string, IngestedAnimation<V>>;
1151
+ /**
1152
+ * Walk-level diagnostics — the `CORS_SKIP` rows (a cross-origin sheet whose
1153
+ * `cssRules` throws `SecurityError`) and any other reason the walk could not
1154
+ * read a sheet. A typed {@link Diagnostic}[] on the same stable-`code` idiom
1155
+ * as `resolveKeyframes`; empty when every sheet was same-origin + parsed.
1156
+ */
1157
+ diagnostics: Diagnostic[];
1158
+ }
1159
+
1160
+ declare type InputAnimationOptions = Partial<{
1161
+ duration: number | string;
1162
+ delay: number | string;
1163
+ iterationCount: number | string | "infinite" | undefined;
1164
+ direction: (typeof DIRECTIONS)[number];
1165
+ fillMode: (typeof FILL_MODES)[number];
1166
+ timingFunction: TimingFunction | Easing | TimingFunctionNames | string | undefined;
1167
+ /** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
1168
+ useWAAPI: boolean;
1169
+ /** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
1170
+ respectReducedMotion: boolean;
1171
+ colorSpace?: ColorSpace;
1172
+ hueMethod?: HueInterpolationMethod;
1173
+ /** The LAYER-level `animation-composition` operator (L.W1 S5). Omission ⇒ `replace`. */
1174
+ composite?: CompositeOperator;
1175
+ }>;
1176
+
1177
+ declare const jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1178
+
1179
+ declare const jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1180
+
1181
+ /**
1182
+ * The core animation engine — keyframes, timing, interpolation, playback.
1183
+ *
1184
+ * PKG-3 RENAME (L.W8): formerly `Animation`; renamed to `KeyframesAnimation`
1185
+ * because the old name collided with the ambient `globalThis.Animation` (WAAPI),
1186
+ * leaking a suffixed collision alias into the d.ts. The legacy `Animation`
1187
+ * re-export alias was DROPPED in 5.0.0 (Q.WE1 — NO-LEGACY).
1188
+ */
1189
+ export declare class KeyframesAnimation<V extends Vars = Vars> {
1190
+ id: number;
1191
+ name: string | undefined;
1192
+ superKey: string | undefined;
1193
+ targets: HTMLElement[];
1194
+ options: AnimationOptions;
1195
+ /** The frame-compilation half — template frames → sampled `frames[]`. The
1196
+ * class composes one and delegates `addFrame`/`parse` + the frame accessors
1197
+ * to it. READ-ONLY surface (G.W19): the backing `_compiler` is written ONLY
1198
+ * by the constructor + `adoptCompiled` (via `_setCompiler`); an external
1199
+ * `animation.compiler = …` reach-in is a COMPILE error (the live-options
1200
+ * desync lock). */
1201
+ private _compiler;
1202
+ get compiler(): FrameCompiler<V>;
1203
+ /** THE rAF owner for this animation — the standalone play loop and the WAAPI
1204
+ * shadow tick both ride it, so `stop()` halts either uniformly. */
1205
+ readonly playback: RAFPlayback;
1206
+ /** The standalone-play machine's OWN run-state (R.W2 — DI by composition):
1207
+ * the deferred play resolver, the held play promise, the live WAAPI handles,
1208
+ * the bound frame callback, the hoisted zero-alloc interp buffer. The five
1209
+ * fields formerly privacy-inverted onto the class body + re-published through
1210
+ * the excised `PlaybackHost` interface; the `./playback` free functions now
1211
+ * own them via `this._playback` directly (no cast, no re-publication). */
1212
+ readonly _playback: PlaybackState;
1213
+ get startTime(): number | undefined;
1214
+ set startTime(v: number | undefined);
1215
+ get pausedTime(): number;
1216
+ set pausedTime(v: number);
1217
+ get t(): number;
1218
+ set t(v: number);
1219
+ get iteration(): number;
1220
+ set iteration(v: number);
1221
+ get started(): boolean;
1222
+ set started(v: boolean);
1223
+ get done(): boolean;
1224
+ set done(v: boolean);
1225
+ get reversed(): boolean;
1226
+ set reversed(v: boolean);
1227
+ get paused(): boolean;
1228
+ set paused(v: boolean);
1229
+ /** Structured parse/honoring diagnostics (K.W7 S4) — a FLAT additive array
1230
+ * of stable-coded {@link Diagnostic} rows surfaced from `resolveKeyframes` +
1231
+ * the engine's composition-fallback rows; empty on a clean parse. Every
1232
+ * SILENT fallback site is mirrored here (`proof:diagnostics-channel`). */
1233
+ diagnostics: Diagnostic[];
1234
+ /** The captured UNDERLYING base value per composited leaf (K.W7 S1) — the
1235
+ * per-element numeric base `add`/`accumulate` accumulates ONTO; empty for a
1236
+ * pure-`replace` animation. INTERNAL — read by `./interpolate` (R.W2). */
1237
+ _compositionBase: Map<string, number[]>;
1238
+ /** Properties whose non-numeric composite already emitted its
1239
+ * `COMPOSITION_FALLBACK` row (once per property, not per frame). INTERNAL —
1240
+ * read by `./interpolate` (R.W2). */
1241
+ _compositionFallbackSeen: Set<string>;
1242
+ /** True once a non-`replace` operator was seen — the hot path skips ALL
1243
+ * composition work when false. INTERNAL — read by `./interpolate` (R.W2). */
1244
+ _hasComposition: boolean;
1245
+ /** True when an `AnimationGroup` drives this animation's `advanceTo()`/
1246
+ * `interpFrames()` from its own rAF loop. Standalone `.play()` throws when
1247
+ * set rather than racing the group. */
1248
+ managed: boolean;
1249
+ /** If the most recent `play()` fell back from WAAPI to rAF despite
1250
+ * `useWAAPI: true`, this records the reason. Queryable; no console output. */
1251
+ waapiIneligibleReason: string | undefined;
1252
+ unflatten: boolean;
1253
+ /** The compile-stable union of every frame's `flatVars` keys, fixed at
1254
+ * `parse` — what `clearBuffer` null-fills to keep a reused buffer stale-free
1255
+ * WITHOUT `delete` (F.W4 S1, the V8 dictionary-mode trap). Exposed read-only
1256
+ * as `flatKeys` so the group sizes its composite buffer the same way.
1257
+ * INTERNAL — read by `./interpolate` (R.W2). */
1258
+ _stableKeys: string[];
1259
+ /** The consumer's EXPLICIT constructor options (NOT merged with defaults) —
1260
+ * retained so `fromString` can layer a parsed style-rule `animation`
1261
+ * shorthand UNDER them (constructor-explicit wins, F.W8). */
1262
+ protected _ctorOptions: Partial<InputAnimationOptions>;
1263
+ /** The compile-stable union of this animation's interpolated keys. */
1264
+ get flatKeys(): readonly string[];
1265
+ /**
1266
+ * The instance's ONE default DOM-style renderer, allocated once. "Did the
1267
+ * consumer supply a custom transform?" is a reference comparison against this
1268
+ * single value ({@link usesDefaultRenderer}) — typed and bind-proof.
1269
+ */
1270
+ protected readonly _defaultTransform: TransformFunction<V>;
1271
+ /** True when `fn` is this instance's default DOM-style renderer. */
1272
+ usesDefaultRenderer(fn: TransformFunction<V> | undefined): boolean;
1273
+ /**
1274
+ * Fire a lifecycle `AnimationEvent` on each bound target (R.W2 — F-6, body in
1275
+ * `./playback`). INTERNAL: the play machine calls it on the concrete
1276
+ * animation — kept ON the class but NOT `private`, reached by direct field
1277
+ * access (the old `PlaybackHost` re-publication + cast are excised).
1278
+ */
1279
+ dispatchAnimationEvent(type: string): void;
1280
+ constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
1281
+ get templateFrames(): TemplateAnimationFrame<V>[];
1282
+ set templateFrames(value: TemplateAnimationFrame<V>[]);
1283
+ get parsedVars(): ParsedVarMap[];
1284
+ get frames(): AnimationFrame<V>[];
1285
+ get frameId(): number;
1286
+ /** Append a template frame (delegated to the compiler). Chainable. */
1287
+ addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): KeyframesAnimation<K>;
1288
+ /** Compile the template frames into the sampled `frames[]` (R.W2 body in
1289
+ * `./compile-bridge`). Chainable. */
1290
+ parse(): this;
1291
+ /**
1292
+ * Adopt another animation's ALREADY-COMPILED state as ONE atomic motion
1293
+ * (G.W19 — body in `./compile-bridge`): moves the `{ compiler, options,
1294
+ * unflatten }` triad + re-binds the live-options reference BY CONSTRUCTION
1295
+ * (`proof:adopt-compiled`). Chainable.
1296
+ */
1297
+ adoptCompiled(source: KeyframesAnimation<V>): this;
1298
+ /** INTERNAL (R.W2): the sanctioned backing-field write for `_compiler` (used
1299
+ * ONLY by `./compile-bridge`'s `adoptCompiled`). The `compiler` accessor
1300
+ * stays get-only — an external `animation.compiler = …` reach-in is a COMPILE
1301
+ * error (the G.W19 live-options-desync lock). */
1302
+ _setCompiler(compiler: FrameCompiler<V>): void;
1303
+ setTimingFunction(timingFunction: InputAnimationOptions["timingFunction"]): this;
1304
+ setIterationCount(iterationCount: InputAnimationOptions["iterationCount"]): this;
1305
+ setDuration(duration: InputAnimationOptions["duration"]): this;
1306
+ setDelay(delay: InputAnimationOptions["delay"]): this;
1307
+ setDirection(direction: InputAnimationOptions["direction"]): this;
1308
+ setFillMode(fillMode: InputAnimationOptions["fillMode"]): this;
1309
+ setUseWAAPI(useWAAPI: InputAnimationOptions["useWAAPI"]): this;
1310
+ setRespectReducedMotion(respectReducedMotion: InputAnimationOptions["respectReducedMotion"]): this;
1311
+ setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
1312
+ setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
1313
+ setComposite(composite: InputAnimationOptions["composite"]): this;
1314
+ setOptions(options: Partial<InputAnimationOptions>): this;
1315
+ reverse(): this;
1316
+ fillForwards(): void;
1317
+ fillBackwards(): void;
1318
+ /** Where the playhead rests after a completed play (forwards/both → final;
1319
+ * none/backwards → initial) — body in `./interpolate`. */
1320
+ get restPosition(): "initial" | "final";
1321
+ /** Paint the rest frame per the fill contract (body in `./interpolate`). */
1322
+ paintRest(): void;
1323
+ /** The named-selector PLAY-TIME guard (Q.WD1 S3 — body in `./interpolate`).
1324
+ * INTERNAL (R.W2): the play machine + `at()` call it; NOT `private`. */
1325
+ assertNoUnresolvedNamedSelector(): void;
1326
+ /** Stateless progress query — maps [0,1] from first to last keyframe,
1327
+ * direction-agnostic (`apply=true` invokes transforms). Body in
1328
+ * `./interpolate`. */
1329
+ at(progress: number, apply?: boolean): Record<string, ValueUnit[]>;
1330
+ /**
1331
+ * Interpolate all active frames at time `t` — the hot path (once per rAF
1332
+ * frame). R.W2 body in `./interpolate`; this is the thin public sampling
1333
+ * delegate the group, sequence, WAAPI build, and `at()` all drive. Zero-alloc
1334
+ * + fast-properties contract preserved (proof:standalone-zero-alloc /
1335
+ * proof:interp-fastprops).
1336
+ */
1337
+ interpFrames(t: number, transformFrames?: boolean, out?: Record<string, ValueUnit[]>): Record<string, ValueUnit[]>;
1338
+ onStart(): Promise<void> | undefined;
1339
+ onEnd(): void;
1340
+ advanceTo(t: number): number | Promise<number>;
1341
+ /** One frame of the standalone rAF play path (driven by `RAFPlayback.loop`). */
1342
+ private _frame;
1343
+ /** The completion front-door (G.W13) — `await anim.finished` resolves once
1344
+ * the in-flight play settles (a settled/never-played animation resolves
1345
+ * immediately). Reads the ONE held promise off the composed `_playback`. */
1346
+ get finished(): Promise<void>;
1347
+ play(): Promise<void>;
1348
+ pause(): this;
1349
+ resume(): this;
1350
+ /** The explicit flip: pauses if playing, resumes if paused. */
1351
+ toggle(): this;
1352
+ stop(): void;
1353
+ playing(): boolean;
1354
+ get effectiveT(): number;
1355
+ settle(): this;
1356
+ reset(): this;
1357
+ setTargets(...targets: HTMLElement[]): this;
1358
+ }
1359
+
1360
+ /**
1361
+ * Options for `AnimationGroup.transitionLayer` / `crossfade` (K.W11 PHYS-C).
1362
+ * The `spring` half is the {@link SpringProgressOptions} subset that shapes the
1363
+ * weight trajectory (`response`/`dampingFraction`/`bounce`-via-config); the
1364
+ * spring is ALWAYS seeded at the layer's CURRENT weight and targets the new
1365
+ * weight, so `initial`/`initialVelocity` are managed internally and excluded.
1366
+ */
1367
+ declare type LayerTransitionSpring = Partial<Omit<SpringProgressOptions, "initial" | "initialVelocity">>;
1368
+
1369
+ /** Looping animations — run continuously (`iterationCount: Infinity`). */
1370
+ declare const loopPresets: {
1371
+ readonly heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1372
+ readonly glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1373
+ readonly spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1374
+ readonly rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1375
+ readonly skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1376
+ readonly gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1377
+ readonly parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1378
+ readonly hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1379
+ readonly typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1380
+ };
1381
+
1382
+ /** A sampled point on a path polyline. */
1383
+ export declare interface MorphPoint {
1384
+ x: number;
1385
+ y: number;
1386
+ /**
1387
+ * The tangent angle (radians) of the source path at this point — populated
1388
+ * ONLY when the morph is built with `orient: true` (the
1389
+ * `PathGeometry.sampleAtLength` tangent, the `rotate: auto` value). Absent
1390
+ * (`undefined`) on a position-only morph (the default ~130-key floor).
1391
+ */
1392
+ angle?: number;
1393
+ }
1394
+
1395
+ /**
1396
+ * `MorphSVG` — the class form of {@link fromMorphSVG}, for callers who prefer a
1397
+ * named primitive alongside `CSSKeyframesAnimation` / `MotionPath` / `DrawSVG`.
1398
+ * Construction is the factory: `new MorphSVG(from, to).animation` is the control
1399
+ * handle. The factory is the canonical entry; this is a thin ergonomic wrapper
1400
+ * that ALSO exposes {@link sampleD} — the morphed `d` string at a normalized
1401
+ * `t`, reassembled from the interpolated point coordinates.
1402
+ */
1403
+ export declare class MorphSVG<V extends Vars = Vars> extends SVGAnimationHandle<V> {
1404
+ /** The uniform-sample count (point pairs = samples + 1). */
1405
+ readonly samples: number;
1406
+ constructor(from: string, to: string, options?: MorphSVGOptions);
1407
+ /**
1408
+ * The morphed SVG path `d` string at a normalized `t` in `[0, 1]`, built
1409
+ * from the engine's interpolated point coordinates (`0` → the `from`
1410
+ * polyline, `1` → the `to` polyline, `0.5` → the point-wise midpoint). The
1411
+ * value a consumer renders (`<path d>` / a `d:` custom property), distinct
1412
+ * from BOTH endpoint polylines at any interior `t`.
1413
+ */
1414
+ sampleD(t: number): string;
1415
+ }
1416
+
1417
+ export declare interface MorphSVGOptions extends Partial<InputAnimationOptions> {
1418
+ /**
1419
+ * The number of uniform arc-length steps each path is sampled at. The
1420
+ * morph emits `samples + 1` point-pairs (the endpoints inclusive), and the
1421
+ * MATCHED count between the `0%` and `100%` frames is what makes the
1422
+ * polyline channel interpolable. Default `64` — the keystone-validated
1423
+ * resolution. Must be an integer `>= 2` (a 1-sample "morph" is just the two
1424
+ * endpoints with no body); a smaller / non-integer value throws.
1425
+ */
1426
+ samples?: number;
1427
+ /**
1428
+ * Optional target the morph drives. When given, the morph reassembles the
1429
+ * interpolated polyline into a `d` string EACH FRAME and writes it onto the
1430
+ * target's style as BOTH:
1431
+ * • the `d:` CSS property — `target.style.d = path("M … L …")` — which
1432
+ * Chromium and recent Safari render DIRECTLY on a `<path>`/`<svg>`
1433
+ * (no author wiring needed), and
1434
+ * • the `--morph-d` custom property — `var(--morph-d)` — the cross-browser
1435
+ * author channel + the Firefox-lags fallback (`<path style="d:
1436
+ * var(--morph-d)">`, or a JS reader via {@link MorphSVG.sampleD}).
1437
+ *
1438
+ * The render rides the engine's per-frame renderer seam (a custom
1439
+ * `transform` supplied to `fromKeyframes`), NOT the default DOM-style
1440
+ * renderer — so the morph is WAAPI-ineligible by construction and always
1441
+ * runs the rAF path where the renderer fires. The reassembly reuses an
1442
+ * instance-level scratch point-array, so the steady frame mints nothing.
1443
+ *
1444
+ * Default target-less: the returned handle IS the control surface, exactly
1445
+ * like `fromDrawSVG`'s target-less form — {@link MorphSVG.sampleD}(t) reads
1446
+ * the morphed `d` directly without a DOM write.
1447
+ */
1448
+ target?: HTMLElement | SVGElement;
1449
+ /**
1450
+ * Orient-along-path: when `true`, the morph ALSO samples each point's
1451
+ * tangent angle (radians) from `PathGeometry.sampleAtLength` and emits a
1452
+ * per-point `--morph-{i}-angle` channel that interpolates the `from`→`to`
1453
+ * tangent across `t` — the `rotate: auto` value a consumer reads to bank a
1454
+ * glyph along the morphed outline. Default `false` (a position-only morph
1455
+ * stays at the ~130-key floor; orient adds ~65 angle keys ONLY when asked,
1456
+ * pre-empting a "morph is too heavy" perf concern).
1457
+ */
1458
+ orient?: boolean;
1459
+ /**
1460
+ * Auto-start the play loop after construction + targeting. Default true.
1461
+ * `false` returns a constructed, NOT-yet-playing handle so the caller can
1462
+ * drive the returned animation (`.play()` / `.pause()` / `.stop()`).
1463
+ */
1464
+ autoPlay?: boolean;
1465
+ }
1466
+
1467
+ /**
1468
+ * `MotionPath` — the class form of {@link fromMotionPath}, for callers who
1469
+ * prefer a named primitive alongside `CSSKeyframesAnimation`. Construction is
1470
+ * the factory: `new MotionPath(target, { path }).animation` is the control
1471
+ * handle. The factory is the canonical entry; this is a thin ergonomic wrapper.
1472
+ */
1473
+ export declare class MotionPath<V extends Vars = Vars> extends SVGAnimationHandle<V> {
1474
+ constructor(target: HTMLElement | HTMLElement[], options: MotionPathOptions);
1475
+ }
1476
+
1477
+ export declare interface MotionPathOptions extends Partial<InputAnimationOptions> {
1478
+ /**
1479
+ * The author `offset-path` (required) — set on the target so the browser
1480
+ * resolves position from `offset-distance`. See {@link OffsetPath}.
1481
+ */
1482
+ path: OffsetPath;
1483
+ /**
1484
+ * Start of the `offset-distance` sweep. Default `"0%"` (the path origin).
1485
+ * Any `<length-percentage>` the property accepts; `%` is path-relative.
1486
+ */
1487
+ from?: string;
1488
+ /** End of the sweep. Default `"100%"` (the path end). */
1489
+ to?: string;
1490
+ /**
1491
+ * Optional `offset-rotate` set on the target for tangent-following — e.g.
1492
+ * `"auto"` (the element rotates to face along the path) or `"auto 90deg"`.
1493
+ * A STATIC author value (not animated); omitted leaves the CSS default.
1494
+ */
1495
+ rotate?: string;
1496
+ /**
1497
+ * Auto-start the play loop after construction + targeting. Default true.
1498
+ * `false` returns a constructed, targeted, NOT-yet-playing handle so the
1499
+ * caller can drive the returned animation (`.play()` / `.pause()` / `.stop()`).
1500
+ */
1501
+ autoPlay?: boolean;
1502
+ }
1503
+
1504
+ declare type NativeScrollAttachment = {
1505
+ attached: true;
1506
+ animations: globalThis.Animation[];
1507
+ } | {
1508
+ attached: false;
1509
+ reason: string;
1510
+ };
1511
+
1512
+ /**
1513
+ * Spec for the ADDITIVE native scroll-driven bridge (D-LIB-2 / F-5).
1514
+ *
1515
+ * A `kind: "scroll"` request maps to the platform `ScrollTimeline` (scroll
1516
+ * progress over a `source` scroller); `kind: "view"` maps to `ViewTimeline`
1517
+ * (a `subject`'s view progress through its scrollport). `axis` defaults to the
1518
+ * platform default (`block`). value.js-free — these are DOM globals.
1519
+ */
1520
+ declare type NativeTimelineSpec = {
1521
+ kind: "scroll";
1522
+ source?: Element | null;
1523
+ axis?: ScrollTimelineAxis;
1524
+ } | {
1525
+ kind: "view";
1526
+ subject: Element;
1527
+ axis?: ScrollTimelineAxis;
1528
+ inset?: string;
1529
+ };
1530
+
1531
+ declare const notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1532
+
1533
+ /**
1534
+ * Q.WB3 S2 — the precomputed SoA fold layout for ONE compiled frame's NUMERIC
1535
+ * interp subset (the single-animation `processFrame` analog of the compositor's
1536
+ * `SoALayerPlan`). Built ONCE at `parse` over the STABLE iv set (the F.W4
1537
+ * zero-alloc discipline — NO per-frame allocation):
1538
+ * - `numeric` — the numeric ivs (numeric start+stop, NOT computed, NOT color),
1539
+ * in slot order. Each iv's interp-carrier `value` is the `ValueUnit` slot the
1540
+ * strided write-back fills (the SAME slot `lerpValue` writes today).
1541
+ * - `from` / `to` — the packed endpoint `Float64Array`s (`start.value` /
1542
+ * `stop.value`), one slot per `numeric[s]`.
1543
+ * - `out` — the per-frame scratch the `lerpArray` fold writes into (reused
1544
+ * across every frame — zero per-frame alloc).
1545
+ * - `boxed` — the residual ivs (color / computed / mixed) the fold CANNOT cover
1546
+ * — walked by the existing per-element `lerpValue`, UNCHANGED.
1547
+ * The boxed-color tail is the GATED `ColorChannelPlan` consume's frontier (S4,
1548
+ * value.js 1.2.0) — NOT this NOW numeric arm.
1549
+ */
1550
+ declare interface NumericFoldPlan<V extends Vars> {
1551
+ numeric: Array<InterpolatedVar<V>>;
1552
+ from: Float64Array;
1553
+ to: Float64Array;
1554
+ out: Float64Array;
1555
+ boxed: Array<InterpolatedVar<V>>;
1556
+ }
1557
+
1558
+ /**
1559
+ * The author's path geometry — the `offset-path` value set on the target. Any
1560
+ * valid CSS `offset-path`: a `path()` data string, a `ray()`, a `url(#id)`
1561
+ * SVG-path reference, or a basic shape. The browser resolves it to positions;
1562
+ * keyframes never parses it.
1563
+ */
1564
+ export declare type OffsetPath = string;
1565
+
1566
+ declare const parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1567
+
1568
+ declare type ParsedVarMap = Record<string, ValueArray>;
1569
+
1570
+ /**
1571
+ * SO-1 PARSE — extract the full scroll-grammar (`animation-timeline` /
1572
+ * `animation-range` / `timeline-scope` / `animation-trigger`) from a scroll-
1573
+ * driven stylesheet (string OR a pre-parsed `Stylesheet`) into a typed
1574
+ * `CSSTimelineOptions`. Consumes value.js 0.13.0's `extractTimelineOptions` over
1575
+ * the parsed stylesheet — the acyclic-spine consume edge (the grammar lives in
1576
+ * value.js, where the `animation-*` parsing already lives; kf re-derives no
1577
+ * parallel name table).
1578
+ *
1579
+ * @example
1580
+ * parseScrollCSS(`.card {
1581
+ * animation: reveal linear both;
1582
+ * animation-timeline: view();
1583
+ * animation-range: entry 0% cover 40%;
1584
+ * }`)
1585
+ * // → { timeline: { kind: "view" },
1586
+ * // range: { start: { phase: "entry", offset: "0%" },
1587
+ * // end: { phase: "cover", offset: "40%" } } }
1588
+ */
1589
+ export declare function parseScrollCSS(input: string | Stylesheet): CSSTimelineOptions;
1590
+
1591
+ /**
1592
+ * Parse an `animation-range` shorthand (`entry 0% cover 40%`) to its typed
1593
+ * `{ start, end? }` form — a pass-through to value.js's `parseAnimationRange`.
1594
+ */
1595
+ export declare function parseScrollRange(input: string): AnimationRangeValue;
1596
+
1597
+ /**
1598
+ * Parse a single `animation-timeline` value (`scroll(root block)`, `view()`,
1599
+ * `--named`, `auto`, `none`) to its typed form — a thin pass-through to
1600
+ * value.js's `parseAnimationTimeline` (kf consumes the VALUE grammar; it never
1601
+ * re-derives a local parser). Emits the value VERBATIM; resolves no defaults.
1602
+ */
1603
+ export declare function parseScrollTimeline(input: string): AnimationTimelineValue;
1604
+
1605
+ /**
1606
+ * SO-3 the `position:sticky` pin SYNTHESIS — EMIT the pin CSS (kf authors the
1607
+ * platform's pin; the browser pins on the compositor). The pin uses
1608
+ * `position:sticky`, NEVER `transform:translateY` (SO-4 KILLED — cross-thread
1609
+ * jitter). Returns a declaration block string the consumer applies to the
1610
+ * pinned element. `top` defaults to `0` (pin to the scrollport top).
1611
+ *
1612
+ * @example
1613
+ * pinCSS() // → "position: sticky; top: 0px;"
1614
+ * pinCSS({ top: 24 }) // → "position: sticky; top: 24px;"
1615
+ */
1616
+ export declare function pinCSS(opts?: {
1617
+ top?: number;
1618
+ bottom?: number;
1619
+ }): string;
1620
+
1621
+ declare interface PlainLeafWriter {
1622
+ /** The nested parent object the leaf lives on. */
1623
+ obj: Record<string, unknown>;
1624
+ /** The leaf's own (last dot-segment) key on `obj`. */
1625
+ key: string;
1626
+ /** The live `ValueUnit[]` whose `.value`(s) the interp stride mutates in place. */
1627
+ units: ValueUnit[];
1628
+ /**
1629
+ * True iff the leaf is a single unitless numeric unit → write `.value` (a
1630
+ * bare `number`, zero-alloc). False → a units/color/multi-component leaf,
1631
+ * projected to its authored STRING each refresh (the units/color residual).
1632
+ */
1633
+ numeric: boolean;
1634
+ }
1635
+
1636
+ declare interface PlainProjection {
1637
+ /** The nested plain object a custom `transform` consumes (`plainVars`). */
1638
+ root: Record<string, unknown>;
1639
+ /** The per-leaf refresh writers, in flat-key order. */
1640
+ writers: PlainLeafWriter[];
1641
+ }
1642
+
1643
+ /**
1644
+ * `engine/playback-state.ts` — the `PlaybackState` run-state STORE, carved off
1645
+ * `engine/play-lifecycle.ts` at S.B2 on the STATE↔BEHAVIOR cohesion seam (the
1646
+ * play machine's free functions live in `./play-lifecycle`; the state they mutate lives
1647
+ * HERE). A value.js-free leaf struct: it owns the standalone-play machine's OWN
1648
+ * run-state so the state has a SINGLE owner instead of being scattered as
1649
+ * privates the class re-published through a cast (R.W2 dissolved the
1650
+ * `PlaybackHost` privacy-inversion).
1651
+ *
1652
+ * - `resolvePromise` — the standalone-loop deferred resolver (`playRAF`
1653
+ * arms it, `resolvePlay` fires it).
1654
+ * - `_playingPromise` — the held in-flight play promise (`get finished`
1655
+ * exposes it; `play` arms it; the `finally` clears it).
1656
+ * - `_waAnimations` — the live WAAPI compositor animations during a WAAPI
1657
+ * delegation (one per target); cancelled on teardown.
1658
+ * - `_boundFrame` — the frame callback bound ONCE at construction, never
1659
+ * re-bound per loop (the per-loop-closure-free idiom).
1660
+ * - `_interpOut` — the ONE hoisted interp buffer the play loop reuses
1661
+ * every frame (zero-alloc steady state).
1662
+ *
1663
+ * ── S.B2 (C-15) — PlaybackState is the SOLE STORAGE for the run-state FSM.
1664
+ * The eight transition fields (`started`/`done`/`paused`/`reversed`/`iteration`/
1665
+ * `t`/`startTime`/`pausedTime`) fold OFF the `KeyframesAnimation` class body and
1666
+ * live HERE as the single backing store; the class exposes them as accessor
1667
+ * delegates over `this._playback.*` (so the FSM stays a public, externally-written
1668
+ * surface — `group/`, `sequence/`, `ingest/`, `waapi/`, the tests, and the demo's
1669
+ * `contractAnim.t =` writes all keep working through the accessors). The
1670
+ * engine-INTERNAL hot path reads/writes `anim._playback.*` DIRECTLY (one extra
1671
+ * monomorphic load — a shape cost, not an allocation; proof:standalone-zero-alloc
1672
+ * / proof:interp-fastprops stay green). `managed` is deliberately NOT here — it is
1673
+ * loop-OWNERSHIP, not run-state, and never resets in `settle`. The literal
1674
+ * single-WRITER hard fold (a public `seek(ms)` verb + MIGRATION) is a future
1675
+ * BREAKING wave (§8-3), out of S scope.
1676
+ */
1677
+ declare class PlaybackState {
1678
+ resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
1679
+ _playingPromise: Promise<void> | null;
1680
+ _waAnimations: globalThis.Animation[];
1681
+ readonly _boundFrame: (t: number) => boolean | Promise<boolean>;
1682
+ readonly _interpOut: Record<string, unknown>;
1683
+ startTime: number | undefined;
1684
+ pausedTime: number;
1685
+ t: number;
1686
+ iteration: number;
1687
+ started: boolean;
1688
+ done: boolean;
1689
+ reversed: boolean;
1690
+ paused: boolean;
1691
+ constructor(frameCb: (t: number) => boolean | Promise<boolean>);
1692
+ }
1693
+
1694
+ export declare namespace presets {
1695
+ export {
1696
+ fadeIn,
1697
+ fadeOut,
1698
+ pulse,
1699
+ shake,
1700
+ bounce,
1701
+ flipPreset,
1702
+ rotateIn,
1703
+ slideIn,
1704
+ heartbeat,
1705
+ glow,
1706
+ typewriter,
1707
+ rainbowText,
1708
+ warpLeft,
1709
+ warpRight,
1710
+ blurIn,
1711
+ blurOut,
1712
+ blurInOut,
1713
+ progressBar,
1714
+ skeletonLoading,
1715
+ textFocusBlur,
1716
+ gradientBackground,
1717
+ rotateScale,
1718
+ typingCursor,
1719
+ accordionExpand,
1720
+ notificationBounce,
1721
+ spinner,
1722
+ parallaxScroll,
1723
+ slideInLeft,
1724
+ slideOutLeft,
1725
+ slideInRight,
1726
+ slideOutRight,
1727
+ hover,
1728
+ jumpUp,
1729
+ jumpDown,
1730
+ springScaleIn,
1731
+ springSlideIn,
1732
+ springPop,
1733
+ springWobble,
1734
+ enterPresets,
1735
+ exitPresets,
1736
+ attentionPresets,
1737
+ loopPresets,
1738
+ presetTaxonomy
1739
+ }
1740
+ }
1741
+
1742
+ /**
1743
+ * The full preset taxonomy, grouped by intent. Each leaf is one of the
1744
+ * existing exported factory functions — the taxonomy is a discovery index over
1745
+ * the library, not a second copy of it.
1746
+ */
1747
+ declare const presetTaxonomy: {
1748
+ readonly enter: {
1749
+ readonly fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1750
+ readonly slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1751
+ readonly slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1752
+ readonly slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1753
+ readonly rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1754
+ readonly blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1755
+ readonly springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1756
+ readonly springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1757
+ readonly jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1758
+ };
1759
+ readonly exit: {
1760
+ readonly fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1761
+ readonly slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1762
+ readonly slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1763
+ readonly blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1764
+ readonly warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1765
+ readonly warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1766
+ readonly jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1767
+ };
1768
+ readonly attention: {
1769
+ readonly pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1770
+ readonly shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1771
+ readonly bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1772
+ readonly flip: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1773
+ readonly notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1774
+ readonly springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1775
+ readonly springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1776
+ };
1777
+ readonly loop: {
1778
+ readonly heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1779
+ readonly glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1780
+ readonly spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1781
+ readonly rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1782
+ readonly skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1783
+ readonly gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1784
+ readonly parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1785
+ readonly hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1786
+ readonly typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1787
+ };
1788
+ };
1789
+
1790
+ declare const progressBar: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1791
+
1792
+ declare const pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1793
+
1794
+ /**
1795
+ * THE managed rAF driver. Owns the rAF handle, start timestamp, dt clock,
1796
+ * and resolve callback for every loop in the engine. ONE generation-guarded
1797
+ * frame-scheduler core ({@link _run}) backs three thin entry shapes:
1798
+ *
1799
+ * - {@link play} — duration-based progress loop (`NumericAnimation`,
1800
+ * `ElementMorph`), with the light reduced-motion snap gate built in.
1801
+ * - {@link drive} — settle-based dt loop over a {@link Tickable}
1802
+ * (`SmoothProgress`, `SpringProgress`): steps until the stepper settles,
1803
+ * auto-stopping; idempotent so target re-seats can re-arm it.
1804
+ * - {@link loop} — self-rescheduling frame loop over a maybe-async callback
1805
+ * (`Animation`, `AnimationGroup`, the WAAPI shadow tick): the callback
1806
+ * returns `true` to continue; a thenable result defers rescheduling until
1807
+ * it resolves, so a slow async frame never double-schedules, while a
1808
+ * sync frame (the steady `Animation`/group `_frame`, J.W6 S1) reschedules
1809
+ * inline on the sync fast-path.
1810
+ *
1811
+ * Because all three ride one core, none can diverge — the generation guard
1812
+ * that makes `loop` safe against a `stop()` + restart mid-frame protects
1813
+ * `drive` and `play` identically.
1814
+ *
1815
+ * The formerly hand-rolled copies of this lifecycle — `SmoothProgress` /
1816
+ * `SpringProgress` `_startLoop`/`_stopLoop` byte-siblings, the
1817
+ * `AnimationGroup` draw loop, `Animation._playRAF`, and the WAAPI shadow
1818
+ * loop — all delegate here. No other module owns a rAF handle.
1819
+ *
1820
+ * BIND-PROOF BY CONSTRUCTION (I.W1 S1). The public control surface —
1821
+ * `play`/`drive`/`loop`/`stop` — is declared as ARROW CLASS-FIELDS, not
1822
+ * prototype methods, so each captures `this` at construction. A consumer can
1823
+ * `const { stop } = playback`, pass `playback.stop` straight as a callback, or
1824
+ * call `playback.stop()` as a member — ALL THREE are safe, forever, because the
1825
+ * receiver can never be dropped. This closes the entire unbound-method crash
1826
+ * class at the engine seam (the `this._gen++` throw a free-standing `stop()`
1827
+ * used to raise inside a Vue reactive flush — `rootcause-rc-dfa-gen.md`):
1828
+ * binding correctness lives ONCE here, never re-asserted per call site. The
1829
+ * arrow fields move these four methods onto the INSTANCE rather than the
1830
+ * prototype — a per-instance allocation accepted because `RAFPlayback`
1831
+ * instances are FEW and long-lived (one per scene/animation). The private
1832
+ * `_run`/`_cleanup` stay prototype methods: they are only ever reached as
1833
+ * `this._run(…)` internally, never extracted as values, so they need no bind.
1834
+ */
1835
+ declare class RAFPlayback {
1836
+ private _rafId;
1837
+ private _startTime;
1838
+ private _lastFrameT;
1839
+ private _resolve;
1840
+ /**
1841
+ * Monotonic generation counter, bumped on every `play`/`drive`/`loop`/
1842
+ * `stop`. A loop's async frame captures its generation and reschedules
1843
+ * ONLY when it still matches — so a `stop()` + restart while an async
1844
+ * frame is mid-flight cannot let the stale callback re-arm a second rAF
1845
+ * chain (the generation-unaware `_rafId !== null` guard could, because
1846
+ * the restart repopulated `_rafId`).
1847
+ */
1848
+ private _gen;
1849
+ /** True while this driver owns a scheduled rAF callback. */
1850
+ get running(): boolean;
1851
+ /**
1852
+ * THE generation-guarded frame-scheduler core. `step(now)` does one
1853
+ * frame's work and returns `true` to continue, `false` to finish; it
1854
+ * may be async (the next frame waits for it). Every frame captures the
1855
+ * generation taken at start, and reschedules ONLY when it still matches
1856
+ * — so a `stop()` + restart mid-frame (even while an async `step` is in
1857
+ * flight) cannot let a stale chain re-arm a second rAF on top of the
1858
+ * restart's freshly-repopulated `_rafId`. On `false` (or a stale
1859
+ * generation that finishes) the loop cleans up. `play`/`drive`/`loop`
1860
+ * are the three thin entry shapes over this one core.
1861
+ */
1862
+ private _run;
1863
+ /**
1864
+ * Drive `onTick(progress)` once per frame for `duration` ms.
1865
+ * `progress` is clamped to [0, 1]; the loop terminates after the
1866
+ * frame at `progress === 1`. The returned promise resolves when
1867
+ * the animation completes naturally or is interrupted by `stop()`.
1868
+ *
1869
+ * Under `options.respectReducedMotion` + an active
1870
+ * `prefers-reduced-motion: reduce` query, snaps to the final frame —
1871
+ * `onTick(1)` fires once, no rAF loop is spawned, and the promise
1872
+ * resolves on the next microtask.
1873
+ */
1874
+ play: (duration: number, onTick: (progress: number) => void, options?: RAFPlaybackOptions) => Promise<void>;
1875
+ /**
1876
+ * Drive a {@link Tickable}'s dt-stepper once per frame until it
1877
+ * settles, invoking `onFrame` after each step. Idempotent — a call
1878
+ * while the loop is already running is a no-op, so consumers re-arm
1879
+ * freely on every target re-seat. The loop auto-stops on settle.
1880
+ */
1881
+ drive: (tickable: Tickable, onFrame?: () => void) => void;
1882
+ /**
1883
+ * Self-rescheduling frame loop over an async callback. `cb(now)`
1884
+ * returns `true` to continue; the next frame is scheduled only after
1885
+ * the callback (and any awaited work inside it) completes. `stop()`
1886
+ * between frames halts the loop — the in-flight callback finishes,
1887
+ * no further frame is scheduled.
1888
+ */
1889
+ loop: (cb: (now: number) => boolean | Promise<boolean>) => void;
1890
+ /** Cancel a running playback. A pending play promise resolves immediately. */
1891
+ stop: () => void;
1892
+ private _cleanup;
1893
+ }
1894
+
1895
+ /** Per-playback options for {@link RAFPlayback.play}. */
1896
+ declare interface RAFPlaybackOptions {
1897
+ /**
1898
+ * Honor `prefers-reduced-motion: reduce` by snapping to the final frame
1899
+ * (`onTick(1)`) in a single paint instead of running the rAF loop. The
1900
+ * returned promise resolves on the next microtask. Default false.
1901
+ *
1902
+ * This is THE shared reduced-motion gate for the light managed-playback
1903
+ * surface: `NumericAnimation` (and `ElementMorph`, which composes it)
1904
+ * route their `respectReducedMotion` option straight through here, so the
1905
+ * snap lives in one place rather than re-implemented per interpolator.
1906
+ * SSR-safe — off-DOM `prefersReducedMotion()` is false, so playback runs
1907
+ * normally.
1908
+ */
1909
+ respectReducedMotion?: boolean | undefined;
1910
+ }
1911
+
1912
+ declare const rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
1913
+
1914
+ export { RangeBoundary }
1915
+
1916
+ export { RangePhase }
1917
+
1918
+ /**
1919
+ * The reduced-motion policy a surface honors (K.W11 PHYS-E). The ONE gate
1920
+ * takes a SCALE, not just a boolean — WCAG 2.3.3-aligned ("shorten the
1921
+ * travel, keep the meaning"):
1922
+ *
1923
+ * - `false` / `undefined` — do not honor reduced motion (the conservative
1924
+ * default; the animation runs at full amplitude regardless of the OS query).
1925
+ * - `true` — the classic binary snap: under an active `prefers-reduced-motion:
1926
+ * reduce` the surface jumps to its terminal state (amplitude scale `0`).
1927
+ * - a `number` ∈ [0, 1] — the INTENSITY: under an active query the surface
1928
+ * scales its motion AMPLITUDE to this fraction (`0.3` → 30 % of the
1929
+ * displacement-from-rest) while preserving the trajectory shape, settle
1930
+ * time, and the opacity/color track. `1` ≈ full motion, `0` ≡ the binary
1931
+ * snap. The scale comes from the CONSUMER's policy (a settings slider, a
1932
+ * per-animation field) — the OS exposes only a binary signal; kf provides
1933
+ * the MECHANISM, the app provides the policy.
1934
+ */
1935
+ declare type ReducedMotionPolicy = boolean | number | undefined;
1936
+
1937
+ /**
1938
+ * Result of normalising a CSS keyframes input down to the shape the
1939
+ * `CSSKeyframesAnimation.fromString` flow expects: a `Map<percent →
1940
+ * vars>` of ready-to-add frames, plus side data (per-keyframe timing
1941
+ * functions, the `@property` registry, and any animation-shorthand
1942
+ * options that came from a sibling style rule).
1943
+ */
1944
+ export declare interface ResolvedKeyframes {
1945
+ /** percent-string → flat `{prop: value}` snapshot */
1946
+ keyframes: Map<string, Record<string, unknown>>;
1947
+ /** per-keyframe `animation-timing-function`, keyed by percent string */
1948
+ timingFunctions: Map<string, string>;
1949
+ /**
1950
+ * per-keyframe `animation-composition` (`replace` | `add` | `accumulate`),
1951
+ * keyed by percent string — value.js lifts it onto `rule.composition`; the
1952
+ * adapter used to drop it. Captured (F.W8); honoring it (→ WAAPI
1953
+ * `composite` / rAF accumulate) is BOOKed, not half-wired.
1954
+ */
1955
+ composition: Map<string, string>;
1956
+ /** `@property --foo { ... }` registry */
1957
+ properties: Map<string, PropertyDescriptor_2>;
1958
+ /**
1959
+ * `@function --foo(...) { ... }` descriptor registry (P.W13 — the emerging-CSS
1960
+ * resolve seam). Collected via value.js `extractFunctions` exactly as
1961
+ * `properties` is collected via `extractProperties`. Threaded into the
1962
+ * {@link resolveValues} pass's {@link ResolveContext} so the dashed-function
1963
+ * `@function` CALL-inlining lands greenable the moment value.js-P publishes
1964
+ * the call-parse arm; the descriptor is captured NOW (a read-only registry —
1965
+ * the inlining that CONSUMES it is the value.js-P-gated seam in
1966
+ * `resolve-values.ts`).
1967
+ */
1968
+ functions: Map<string, CustomFunctionDescriptor>;
1969
+ /**
1970
+ * Animation options recovered from a top-level style rule's
1971
+ * `animation` shorthand or longhand declarations (if any). Empty
1972
+ * when the input has no matching style rule.
1973
+ */
1974
+ options: ReturnType<typeof extractAnimationOptions>;
1975
+ /**
1976
+ * Structured parse/honoring diagnostics (K.W7 S4) — every SILENT fallback
1977
+ * the resolve path used to swallow, now a citable row. CONSUMES the value.js
1978
+ * 0.12.0 `ParseDiagnostic`/`OnParseError` producer (N2 row 10): a failed
1979
+ * parse surfaced through `OnParseError` lands here as a `PARSE_ERROR` row,
1980
+ * and the kf-side fallbacks (`EMPTY_PARSE`, and the engine's
1981
+ * `COMPOSITION_FALLBACK`) join it. A FLAT additive array with stable
1982
+ * {@link DiagnosticCode}s, NOT a logging framework. Empty on a clean parse.
1983
+ * K.W8 populates the ingest rows (`CORS_SKIP`, `WAAPI_INELIGIBLE`) it owns.
1984
+ */
1985
+ diagnostics: Diagnostic[];
1986
+ /**
1987
+ * The parsed CSS `Stylesheet` AST the resolve walked (L.W2 S1). Surfaced so a
1988
+ * caller can recover scroll-grammar (`animation-timeline`/`animation-range`)
1989
+ * from the SAME parse via `extractTimelineOptions(resolved.stylesheet)` —
1990
+ * `CSSKeyframesAnimation.fromString` threads it onto `scrollOptions` so the
1991
+ * compiler's EMIT half (CC-6) can serialize the scroll longhands back out. A
1992
+ * read-only metadata field; the keyframe/option resolution is unchanged.
1993
+ */
1994
+ stylesheet: Stylesheet;
1995
+ }
1996
+
1997
+ /**
1998
+ * The resolved [start,end] scroll-extent fractions for a parsed
1999
+ * `animation-range`. The driver maps a raw scroll position `p ∈ [0,1]` over the
2000
+ * scene's extent into local progress `(p − start)/(end − start)`, clamped.
2001
+ */
2002
+ export declare interface ResolvedRange {
2003
+ start: number;
2004
+ end: number;
2005
+ }
2006
+
2007
+ /**
2008
+ * The injectable environment a Phase-1 resolution evaluates against. Every field
2009
+ * is OPTIONAL with an SSR-safe default ({@link defaultResolveEnv}); a test injects
2010
+ * a deterministic `supports`/`matchMedia` (jsdom carries neither faithfully) the
2011
+ * way `ScrollTimeline` is handed a `getScrollY`. The Phase-2 element-aware fields
2012
+ * (`customProps`/`siblingIndex`/`siblingCount`) are typed here so the second-pass
2013
+ * call site (post-`setTargets`) threads the SAME context shape — ONE rewriter,
2014
+ * two lifecycle points, not two divergent context types.
2015
+ */
2016
+ declare interface ResolveEnv {
2017
+ /** `CSS.supports(query)` — the `if(supports(...))` evaluator. SSR → `false`. */
2018
+ supports?: (query: string) => boolean;
2019
+ /** `matchMedia(query)` — the `if(media(...))` evaluator. SSR → `{matches:false}`. */
2020
+ matchMedia?: (query: string) => {
2021
+ matches: boolean;
2022
+ };
2023
+ /** Phase 2 — resolved custom-prop reader for `if(style(--p))` (element-aware). */
2024
+ customProps?: (name: string) => string | undefined;
2025
+ /** Phase 2 — 1-based DOM position for `sibling-index()` (element-aware). */
2026
+ siblingIndex?: () => number;
2027
+ /** Phase 2 — sibling total for `sibling-count()` (element-aware). */
2028
+ siblingCount?: () => number;
2029
+ }
2030
+
2031
+ /**
2032
+ * Normalise a CSS string (or pre-parsed Stylesheet) into the shape
2033
+ * `CSSKeyframesAnimation.fromString` consumes. The single entry
2034
+ * point: replaces the legacy `parseCSSKeyframes` /
2035
+ * `parseCSSStyleBlock` / `parseCSSAnimationKeyframes` fork.
2036
+ *
2037
+ * Bare keyframe-stop lists (`from { … } to { … }`) historically work even
2038
+ * though they are not valid top-level CSS. F.W8 decides that on the parsed
2039
+ * AST, not a regex sniff: parse the raw input; if it surfaced ZERO @keyframes
2040
+ * rules and the input is non-empty, re-wrap as `@keyframes anonymous { … }`
2041
+ * and re-parse. A leading `/* @keyframes … *​/` comment no longer defeats the
2042
+ * detection (the PX-1 comment-defeat bug — the regex `/@keyframes\b/` matched
2043
+ * inside a comment and skipped the wrap, yielding a silent empty parse).
2044
+ *
2045
+ * K.W8 SIBLING — `resolveLiveKeyframes` (`./ingest`) is the LIVE-CSSOM analogue
2046
+ * of this STRING normaliser: where `resolveKeyframes` normalises a string of
2047
+ * CSS, `resolveLiveKeyframes` walks `document.styleSheets`, serialises each
2048
+ * `CSSKeyframesRule` via `rule.cssText`, and feeds THAT text into THIS function
2049
+ * — the parser pointed FORWARD at the web the page already ships. It lives in a
2050
+ * separate module (`./ingest`) to avoid an `engine → adapter → ingest → engine`
2051
+ * import cycle; reach it via `loadAnimationEngine()` (the `index.ts` HEAVY edge).
2052
+ */
2053
+ export declare const resolveKeyframes: (input: string | Stylesheet, env?: ResolveEnv) => ResolvedKeyframes;
2054
+
2055
+ /**
2056
+ * K1 — `resolveLiveKeyframes`: the lowest-level CSSOM walk. Accepts a
2057
+ * `Document`, an explicit `CSSStyleSheet[]`, or a single `CSSStyleSheet`, and
2058
+ * reconstructs every `@keyframes` rule it can read. The per-sheet `try/catch` is
2059
+ * the honesty surface (S3): a cross-origin sheet whose `cssRules` getter throws
2060
+ * `SecurityError` becomes a `CORS_SKIP` diagnostic row — never an uncaught throw
2061
+ * and never a silent drop ("ingestion's honest failure mode IS a diagnostic").
2062
+ *
2063
+ * The named sibling of `resolveKeyframes` (`adapter.ts`): where `resolveKeyframes`
2064
+ * normalises a STRING of CSS, `resolveLiveKeyframes` normalises the LIVE CSSOM —
2065
+ * the parser pointed forward at the web the page already ships.
2066
+ */
2067
+ export declare const resolveLiveKeyframes: <V extends Vars = Vars>(source?: Document | ShadowRoot | CSSStyleSheet[] | CSSStyleSheet, options?: IngestOptions) => IngestResult<V>;
2068
+
2069
+ /**
2070
+ * Resolve a parsed `AnimationRangeValue` (or `undefined` → the whole [0,1]
2071
+ * timeline) into [start,end] extent fractions. The driver-side fill of the
2072
+ * division-of-labour law: value.js emits the phases/offsets verbatim, kf turns
2073
+ * them into the TIME mapping.
2074
+ */
2075
+ export declare function resolveRange(range: AnimationRangeValue | undefined): ResolvedRange;
2076
+
2077
+ declare const rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2078
+
2079
+ declare const rotateScale: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2080
+
2081
+ /**
2082
+ * The full SO-1 round-trip in one call: `parse → serialize`. Returns the typed
2083
+ * options AND the re-serialized longhand declarations, so a consumer (or the
2084
+ * `proof:scroll-roundtrip` gate) can assert the replay-equality invariant
2085
+ * (`serialize(parse(s))` canonical-form-equal to `s`).
2086
+ */
2087
+ export declare function roundTripScrollCSS(input: string | Stylesheet): {
2088
+ options: CSSTimelineOptions;
2089
+ declarations: ReturnType<typeof serializeScrollOptions>;
2090
+ };
2091
+
2092
+ /** Which backend a `ScrollScene` dispatched to, and why the JS path was chosen. */
2093
+ export declare type ScrollBackend = "native" | "js";
2094
+
2095
+ /** The dispatch verdict — which backend, and (for JS) the human-readable reason. */
2096
+ export declare type ScrollDispatch = {
2097
+ backend: "native";
2098
+ attachment: NativeScrollAttachment;
2099
+ } | {
2100
+ backend: "js";
2101
+ reason: string;
2102
+ };
2103
+
2104
+ /**
2105
+ * The dispatch request — what the caller wants over the parsed scene. The matrix
2106
+ * reads these + the target shape to choose native vs JS (the conservative-correct
2107
+ * backend choice with a queryable reason).
2108
+ */
2109
+ export declare interface ScrollDispatchRequest<V extends Vars> {
2110
+ /** The animation to drive over the scroll clock. */
2111
+ animation?: KeyframesAnimation<V> | undefined;
2112
+ /** The native timeline spec (`scroll`/`view`) for the eligible fast lane. */
2113
+ nativeSpec?: NativeTimelineSpec | undefined;
2114
+ /** True if scrub smoothing was requested (forces JS — native has no smoother). */
2115
+ scrub?: boolean | undefined;
2116
+ /** True if snap was requested (forces JS — native has no physics snap). */
2117
+ snap?: boolean | undefined;
2118
+ /** True if scroll velocity / non-DOM driving was requested (forces JS). */
2119
+ velocity?: boolean | undefined;
2120
+ }
2121
+
2122
+ /**
2123
+ * The kf `ScrollScene` JS DRIVER (SO-2). Drives an engine's progress from a raw
2124
+ * scroll position through the parsed `animation-range`, composing the SHIPPED
2125
+ * primitives:
2126
+ *
2127
+ * scrub → `SmoothProgress` damping (the smoothing the native lane lacks)
2128
+ * snap → `decayRest` (project the idle rest point) + `SpringProgress` settle
2129
+ * (the PHYS-D snapDecay primitive — composes shipped physics, invents none)
2130
+ * enter/leave → the threshold detector DERIVED from the parsed range
2131
+ *
2132
+ * The caller drives the loop (`scrollProgress(p)` per scroll event); the scene
2133
+ * owns no rAF. `progress` is the smoother-damped local progress the engine reads.
2134
+ *
2135
+ * The driver owns TIME (the live offset resolution); value.js owns VALUES (the
2136
+ * parsed phases/offsets). The native lane is NOT deleted — this is the universal
2137
+ * fallback the dispatch falls back to.
2138
+ */
2139
+ export declare class ScrollScene {
2140
+ private readonly resolvedRange;
2141
+ private readonly snapPoints;
2142
+ private readonly snapSpring;
2143
+ private readonly scrubSeconds;
2144
+ private readonly smoother;
2145
+ private rawScroll;
2146
+ private localProgress;
2147
+ private wasInside;
2148
+ private readonly subscribers;
2149
+ constructor(options?: ScrollSceneOptions);
2150
+ /** The resolved [start,end] scroll-extent fractions for this scene. */
2151
+ get range(): ResolvedRange;
2152
+ /**
2153
+ * Drive the scene from a raw scroll position `p ∈ [0,1]` over the scene's
2154
+ * scroll extent (the caller resolves the live scroller; kf maps it to the
2155
+ * range). Maps `p` to local progress `(p − start)/(end − start)` clamped,
2156
+ * routes it through the scrub smoother (if any), and fires enter/leave at
2157
+ * the range boundaries. Returns the (possibly un-smoothed) local progress.
2158
+ *
2159
+ * The smoother converges over subsequent `.tick(dt)` calls; the immediate
2160
+ * return is the smoother's current value (so the first call seeds the
2161
+ * target). Consumers driving their own rAF call `.tick(dt)` per frame.
2162
+ */
2163
+ scrollProgress(p: number): number;
2164
+ /**
2165
+ * Advance the scrub smoother by `dt` ms (frame-rate independent). A no-op
2166
+ * when no scrub was requested (the progress tracks scroll 1:1). Returns the
2167
+ * current smoothed local progress — the engine-write input the driver tracks.
2168
+ */
2169
+ tick(dt: number): number;
2170
+ /** The current local progress (smoother-damped if scrub was requested). */
2171
+ get progress(): number;
2172
+ /** True if no scrub smoother, or the smoother has settled. */
2173
+ get settled(): boolean;
2174
+ /**
2175
+ * SO-2 `.snap()` — PHYS-D snapDecay. On scroll-idle, project the rest point
2176
+ * the current scroll momentum would coast to (`decayRest`), pick the nearest
2177
+ * configured snap point, and settle to it via `SpringProgress`. Returns the
2178
+ * chosen snap target (local progress), or `null` when no snap points are
2179
+ * configured.
2180
+ *
2181
+ * Composes the SHIPPED `decayRest` (the closed-form projected rest) +
2182
+ * `SpringProgress` (the settle) — it invents no physics (the PHYS-A coupled
2183
+ * form is KILLED). `velocity` is the release scroll velocity (units/s); `0`
2184
+ * snaps from the rest position directly.
2185
+ */
2186
+ snapTo(velocity?: number): number | null;
2187
+ /**
2188
+ * Advance the snap settle by `dt` ms. Returns the spring's current local
2189
+ * progress (and writes it to `progress`), or the unchanged progress when no
2190
+ * snap is active. Drive this per frame after `snapTo()` until `settled`.
2191
+ */
2192
+ tickSnap(dt: number): number;
2193
+ /** Subscribe to an enter/leave threshold crossing. Returns an unsubscribe fn. */
2194
+ on(event: ScrollSceneEvent, cb: ScrollSceneSubscriber): () => void;
2195
+ private fire;
2196
+ }
2197
+
2198
+ /** The set of enter/leave threshold events the range-derived detector fires. */
2199
+ export declare type ScrollSceneEvent = "enter" | "leave";
2200
+
2201
+ export declare interface ScrollSceneOptions {
2202
+ /**
2203
+ * The parsed `CSSTimelineOptions` (from {@link parseScrollCSS}) OR a direct
2204
+ * spec. The `range` drives the [0,1] mapping; the `timeline` informs the
2205
+ * native-vs-JS dispatch (a named/`auto` timeline that the platform can run
2206
+ * natively).
2207
+ */
2208
+ range?: AnimationRangeValue | undefined;
2209
+ timeline?: AnimationTimelineValue | undefined;
2210
+ /**
2211
+ * Scrub smoothing seconds (the damping the native `animation-range` lane
2212
+ * LACKS — a STRICT capability of the JS driver). `0`/omitted ⇒ no smoothing
2213
+ * (the scrub tracks scroll 1:1). A positive value enables `SmoothProgress`
2214
+ * damping. Requesting scrub forces the JS backend (native has no smoother).
2215
+ */
2216
+ scrub?: number | undefined;
2217
+ /**
2218
+ * Snap points (local progress in [0,1]) the scene settles to on scroll-idle
2219
+ * via `decayRest` + `SpringProgress`. Requesting snap forces the JS backend.
2220
+ */
2221
+ snap?: SnapPoints | undefined;
2222
+ /** Spring config for the snap settle (the PHYS-D snapDecay primitive). */
2223
+ snapSpring?: Partial<SpringProgressOptions> | undefined;
2224
+ /** Extra SmoothProgress config for the scrub smoother. */
2225
+ smoothing?: Partial<SmoothProgressOptions> | undefined;
2226
+ }
2227
+
2228
+ /** A `.on(event, cb)` subscriber. Receives the local progress at the crossing. */
2229
+ export declare type ScrollSceneSubscriber = (progress: number) => void;
2230
+
2231
+ /**
2232
+ * orchestration/timeline/native.ts — the platform native-timeline feature-detect
2233
+ * (R.W1; lib-light F-9). Split off the JS sampler family (`./index`) by the
2234
+ * consumer seam: `native.ts` is consumed by `waapi/` (the HEAVY native scroll
2235
+ * bridge) while the JS `Timeline` family is the general caller-polled sampler.
2236
+ * Both stay LIGHT (value.js-free — these are DOM globals + an `in`-detect).
2237
+ */
2238
+ /**
2239
+ * The scroll/view timeline axis — the `block|inline|x|y` keyword set. A LOCAL
2240
+ * structural alias of the DOM lib's ambient `ScrollAxis` global (R.W4b): it is
2241
+ * byte-identical to `lib.dom.d.ts`'s `type ScrollAxis = "block" | "inline" | "x"
2242
+ * | "y"`, but as a NAMED module export it is FOLLOWABLE by the `./engine` subpath
2243
+ * dts roll-up (API Extractor cannot follow a bare ambient-global reference reached
2244
+ * transitively through `ScrollScene` — it throws "Unable to follow symbol for
2245
+ * ScrollAxis"). value.js-free (a string-literal union — these are DOM keywords).
2246
+ */
2247
+ declare type ScrollTimelineAxis = "block" | "inline" | "x" | "y";
2248
+
2249
+ /**
2250
+ * The master-playhead orchestrator. Positions child animations along one clock
2251
+ * and drives them via `Animation.advanceTo`. See the module docstring for the
2252
+ * booked name + subsumption decision.
2253
+ */
2254
+ declare class Sequence<V extends Vars = Vars> implements SequencePlayContext<V> {
2255
+ /** Resolved segments, in insertion order. */
2256
+ readonly entries: SequenceEntry<V>[];
2257
+ /** Named positions on the master clock, registered via {@link label}. */
2258
+ readonly labels: Map<string, number>;
2259
+ /**
2260
+ * The transport-events bus — the per-event subscriber registry + the
2261
+ * crossing detector (segment-lifecycle + label straddle). `on(...)` forwards
2262
+ * to `events.subscribe`; the transport's `fireSequenceCrossings` to
2263
+ * `events.fire`. See `./events` for the channel + detector body.
2264
+ */
2265
+ readonly events: SequenceEventBus<V>;
2266
+ /**
2267
+ * The running insertion cursor (ms) — the end of the last-inserted
2268
+ * segment. Relative `"+="`/`"-="` positions and auto-append (`at` omitted)
2269
+ * measure from here, matching GSAP's append-by-default timeline.
2270
+ */
2271
+ private cursor;
2272
+ /** Master clock (ms) of the current playhead. */
2273
+ _time: number;
2274
+ /* Excluded from this release type: respectReducedMotion */
2275
+ /** THE rAF owner for the sequence's play loop. */
2276
+ readonly playback: RAFPlayback;
2277
+ /* Excluded from this release type: _boundFrame */
2278
+ _resolvePlay: (() => void) | null;
2279
+ _playOrigin: number | undefined;
2280
+ /* Excluded from this release type: _playingPromise */
2281
+ /**
2282
+ * The scalar playback rate — the single field that drives `timeScale`
2283
+ * and `reverse`. `_rate = 1` is real-time forward (the existing
2284
+ * single-play default); `n` is `timeScale(n)` (slow-mo `< 1` /
2285
+ * fast-forward `> 1`); a negative `_rate` walks the master clock
2286
+ * backward (`reverse`). It scales the master clock in {@link _frame}:
2287
+ * `masterClock = (clock − _playOrigin) * _rate`.
2288
+ */
2289
+ _rate: number;
2290
+ /**
2291
+ * How many master-clock cycles `play()` runs before settling. `1` is the
2292
+ * existing single-play; `Infinity` never settles (the loop case);
2293
+ * `n` runs `n` cycles. The master clock folds modulo `duration`
2294
+ * (see {@link _fold}).
2295
+ */
2296
+ _repeatCount: number;
2297
+ /**
2298
+ * When true, odd cycles reflect the folded phase (`duration − phase`) —
2299
+ * the GSAP `yoyo` ping-pong. Default off (every cycle runs forward).
2300
+ */
2301
+ _yoyoOn: boolean;
2302
+ /** Whether `pause()` has halted the loop with the playhead retained. */
2303
+ _paused: boolean;
2304
+ /**
2305
+ * The loop's last rAF timestamp — the re-anchor reference. The
2306
+ * `RAFPlayback`/`AnimationGroup` managed-pause records the loop's LAST rAF
2307
+ * timestamp (not `performance.now()`) so resume adjusts the origin against
2308
+ * the SAME clock the loop reads, with no forward jump. `Sequence` records
2309
+ * it here per frame (the driver does not expose it) for that one re-anchor.
2310
+ */
2311
+ _lastClock: number | undefined;
2312
+ constructor(options?: SequenceOptions);
2313
+ /** The full span of the sequence (ms): the latest segment end. */
2314
+ get duration(): number;
2315
+ /** The current master-clock position (ms). */
2316
+ get time(): number;
2317
+ /**
2318
+ * The normalized playhead position in `[0, 1]` — the GSAP
2319
+ * `Timeline.progress()` idiom. Pure division over the existing scrub:
2320
+ * the getter is `_time / duration`; the setter scrubs to `p * duration`
2321
+ * via {@link seek}.
2322
+ */
2323
+ get progress(): number;
2324
+ set progress(p: number);
2325
+ /** The scalar playback rate (`timeScale` / sign of `reverse`). */
2326
+ get rate(): number;
2327
+ /** Register a named position on the master clock. Chainable. */
2328
+ label(name: string, at?: SequencePosition): this;
2329
+ /**
2330
+ * Subscribe to a segment-lifecycle or label crossing. Returns an
2331
+ * unsubscribe handle — the `ScrollScene.on` idiom (`scroll-scene.ts:506-514`).
2332
+ *
2333
+ * - `"segment:enter"` fires when the playhead enters a segment's
2334
+ * `[at, at + duration)` span (forward across `at`, or backward across the
2335
+ * span end); the callback receives that segment's `animation` reference
2336
+ * and the master-clock position at the crossing.
2337
+ * - `"segment:leave"` fires on the complementary crossing OUT of the span.
2338
+ * - `"label"` fires when the playhead straddles a registered label position
2339
+ * in EITHER direction; the callback receives `(name, masterClock)`.
2340
+ *
2341
+ * Crossings fire on EVERY paint — `seek` (scrub) and the rAF play loop,
2342
+ * forward, reverse, and yoyo. The callback's `masterClock` lets the consumer
2343
+ * infer direction; there is no `once` idiom — unsubscribe in the callback
2344
+ * (via the returned handle) for one-shot behaviour.
2345
+ */
2346
+ on(event: "segment:enter" | "segment:leave", cb: SequenceSegmentSubscriber): () => void;
2347
+ on(event: "label", cb: SequenceLabelSubscriber): () => void;
2348
+ /**
2349
+ * Append a child animation at `at` (absolute ms, a label, a `"+="`/`"-="`
2350
+ * relative token, or — omitted — the running cursor, i.e. after the
2351
+ * previous segment). Advances the insertion cursor to this segment's end.
2352
+ * Chainable.
2353
+ */
2354
+ add(animation: KeyframesAnimation<V>, at?: SequencePosition): this;
2355
+ /**
2356
+ * Map the master playhead to each child's LOCAL clock and paint it. This is
2357
+ * the synchronous scrub form: for every segment, the local clock is
2358
+ * `clamp(masterClock − at, 0, duration)`, applied via `interpFrames(local,
2359
+ * true)`. Segments not yet reached rest at their initial frame; segments
2360
+ * past their end rest at their final frame — the timeline-scrub contract.
2361
+ * Chainable.
2362
+ */
2363
+ seek(masterClock: number): this;
2364
+ /**
2365
+ * Set targets on every child segment. Convenience for the common case
2366
+ * where one target receives the whole sequence; per-segment targets can be
2367
+ * set on each `animation` directly before `.add`. Chainable.
2368
+ */
2369
+ setTargets(...targets: HTMLElement[]): this;
2370
+ /**
2371
+ * The completion front-door (G.W13) — `await sequence.finished` resolves
2372
+ * once the in-flight transport settles. Exposes the ONE held
2373
+ * `_playingPromise` `play()` constructs (the re-entrant guard returns it;
2374
+ * the `finally`-clear nulls it on settle) — NOT a second completion
2375
+ * lifecycle. A settled (or never-played, or reduced-motion-snapped)
2376
+ * sequence resolves immediately.
2377
+ */
2378
+ get finished(): Promise<void>;
2379
+ /** Drive the sequence over real time via `RAFPlayback` — re-entrant, and
2380
+ * PRM-aware. Body in `./lifecycle` (S.B5). */
2381
+ play(): Promise<void>;
2382
+ _frame(clock: number): Promise<boolean>;
2383
+ /** Halt the play loop where it stands and resolve any pending `play()`.
2384
+ * Body in `./lifecycle` (S.B5). */
2385
+ stop(): this;
2386
+ /** Halt the play loop WITHOUT releasing the playhead — the managed-pause
2387
+ * contract (`_time` + the play promise are retained for `resume`). No-op when
2388
+ * not playing or already paused. Body in `./lifecycle` (S.B5). */
2389
+ pause(): this;
2390
+ /** Resume a paused sequence — restart the rAF loop with the origin
2391
+ * re-anchored so the first resumed frame's master clock equals the retained
2392
+ * `_time` (no forward jump). No-op when not paused. Body in `./lifecycle`. */
2393
+ resume(): this;
2394
+ /** Set the scalar playback rate — slow-mo (`< 1`), real-time (`1`),
2395
+ * fast-forward (`> 1`), or backward (`< 0`, the {@link reverse} form); the
2396
+ * master clock is re-anchored so the playhead is C⁰-continuous at the flip.
2397
+ * Body in `./lifecycle` (S.B5). */
2398
+ timeScale(n: number): this;
2399
+ /** Flip the playback direction — the playhead walks backward (negative rate)
2400
+ * or forward again, preserving `|rate|`, C⁰-continuous. Body in `./lifecycle`. */
2401
+ reverse(): this;
2402
+ /** Set how many cycles `play()` runs before settling — `1` single-play, `n`
2403
+ * cycles, `Infinity` loops forever. Body in `./lifecycle` (S.B5). */
2404
+ repeat(count: number): this;
2405
+ /** Toggle yoyo (ping-pong) — odd cycles run reflected across the `repeat`
2406
+ * cycles. Body in `./lifecycle` (S.B5). */
2407
+ yoyo(on?: boolean): this;
2408
+ }
2409
+
2410
+ /**
2411
+ * A resolved sequence segment: a child animation anchored at an absolute ms
2412
+ * offset. The shape {@link SequenceEventBus.fire} reads to test segment
2413
+ * membership.
2414
+ */
2415
+ declare interface SequenceEntry<V extends Vars> {
2416
+ animation: KeyframesAnimation<V>;
2417
+ /** Absolute offset (ms) of this segment's local t=0 on the master clock. */
2418
+ at: number;
2419
+ }
2420
+
2421
+ /**
2422
+ * The transport-crossing events a `Sequence` fires via {@link Sequence.on} —
2423
+ * the segment-lifecycle pair plus the named-label crossing.
2424
+ *
2425
+ * - `"segment:enter"` — the playhead crossed INTO a segment's
2426
+ * `[at, at + duration)` span (forward across `at`, or backward across the
2427
+ * span's end).
2428
+ * - `"segment:leave"` — the complementary crossing OUT of that span.
2429
+ * - `"label"` — the playhead straddled a position registered via
2430
+ * {@link Sequence.label}, in EITHER direction.
2431
+ *
2432
+ * Mirror of `ScrollSceneEvent` (`scroll-scene.ts:190`) — a typed, per-event
2433
+ * subscribe channel.
2434
+ */
2435
+ declare type SequenceEvent = "segment:enter" | "segment:leave" | "label";
2436
+
2437
+ /**
2438
+ * The Sequence transport-events BUS — the per-event subscriber registry + the
2439
+ * crossing DETECTOR, owned beside `Sequence` (`sequence.ts`). `Sequence`
2440
+ * constructs ONE bus and forwards `.on(...)` to {@link subscribe} and every
2441
+ * paint to {@link fire}; the three event fields (`subscribers`,
2442
+ * `_activeSegments`, `_prevPhase`) live here, not on the class.
2443
+ */
2444
+ declare class SequenceEventBus<V extends Vars> {
2445
+ /**
2446
+ * The per-event subscriber sets — the {@link subscribe} channel (three Sets
2447
+ * keyed by {@link SequenceEvent}). Empty by construction; {@link fire}
2448
+ * early-exits while all three stay empty (zero overhead for the common
2449
+ * no-subscriber transport). Mirror of `ScrollScene.subscribers`
2450
+ * (`scroll-scene.ts:360-366`).
2451
+ */
2452
+ private readonly subscribers;
2453
+ /**
2454
+ * The `segment:enter`/`segment:leave` edge memory: the segments whose
2455
+ * `[at, at + duration)` span held the PREVIOUS painted phase. A segment in
2456
+ * the current active set but not here ENTERED; one here but not in the
2457
+ * current set LEFT. Maintained only while a segment subscriber is registered
2458
+ * (the detector early-exits otherwise).
2459
+ */
2460
+ private readonly _activeSegments;
2461
+ /**
2462
+ * The previous painted phase (ms) — the `from` end of every crossing
2463
+ * straddle (`label`, and the directional `segment` edges). `undefined`
2464
+ * before the first paint; updated on EVERY {@link fire} so a subscriber
2465
+ * registered mid-transport straddles from the true prior playhead (not a
2466
+ * stale or zeroed origin).
2467
+ */
2468
+ private _prevPhase;
2469
+ /**
2470
+ * Register a subscriber for `event`; returns an unsubscribe handle — the
2471
+ * `ScrollScene.on` idiom (`scroll-scene.ts:506-514`). The class's overloaded
2472
+ * `on(...)` forwards here.
2473
+ */
2474
+ subscribe(event: SequenceEvent, cb: SequenceSubscriber): () => void;
2475
+ /**
2476
+ * Detect and fire segment-lifecycle + label crossings between the previous
2477
+ * painted phase (`_prevPhase`) and `phase` — the ONE detector both `seek`
2478
+ * (scrub) and `_frame` (the rAF play loop) drive, so play fires the identical
2479
+ * crossings a scrub would. Mirror of `ScrollScene.fire` (`scroll-scene.ts:513`).
2480
+ *
2481
+ * `_prevPhase` is updated on EVERY call (even the early-exit) so a subscriber
2482
+ * registered mid-transport straddles from the true prior playhead. The firing
2483
+ * loops run ONLY while at least one subscriber set is non-empty — the
2484
+ * zero-overhead path for the common no-subscriber transport.
2485
+ */
2486
+ fire(entries: readonly SequenceEntry<V>[], labels: ReadonlyMap<string, number>, phase: number): void;
2487
+ }
2488
+
2489
+ /**
2490
+ * A `label` subscriber. Receives the crossed label's `name` and the
2491
+ * master-clock position (ms) at the crossing.
2492
+ */
2493
+ declare type SequenceLabelSubscriber = (name: string, masterClock: number) => void;
2494
+
2495
+ declare interface SequenceOptions {
2496
+ /**
2497
+ * When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
2498
+ * every child to its rest frame in a single paint (delegated to each
2499
+ * child's own reduced-motion contract via a terminal `seek`). Default
2500
+ * false. SSR-safe off-DOM.
2501
+ */
2502
+ respectReducedMotion?: boolean;
2503
+ }
2504
+
2505
+ /**
2506
+ * The play-machine view the rAF-loop driver reads + writes. `Sequence` IS this
2507
+ * shape (its fields), so the loop body lives here without copying state — the
2508
+ * class's `_frame`/`_settle` are thin delegates that pass `this`. Keeping the
2509
+ * fields on `Sequence` preserves the seek↔play parity test's direct reaches
2510
+ * (`seq._time` / `seq._rate` / `seq._frame(...)`); only the loop BODY moved.
2511
+ */
2512
+ declare interface SequencePlayContext<V extends Vars> {
2513
+ readonly entries: SequenceEntry<V>[];
2514
+ readonly labels: ReadonlyMap<string, number>;
2515
+ readonly events: SequenceEventBus<V>;
2516
+ readonly duration: number;
2517
+ _time: number;
2518
+ _rate: number;
2519
+ _repeatCount: number;
2520
+ _yoyoOn: boolean;
2521
+ _paused: boolean;
2522
+ _playOrigin: number | undefined;
2523
+ _lastClock: number | undefined;
2524
+ _resolvePlay: (() => void) | null;
2525
+ }
2526
+
2527
+ /**
2528
+ * A position on the master clock for a sequence entry.
2529
+ *
2530
+ * - `number` — an absolute offset in milliseconds from the sequence origin.
2531
+ * - `` `+=${n}` `` / `` `-=${n}` `` — relative to the running insertion cursor
2532
+ * (the end of the previously-inserted segment): `"+=200"` starts 200ms after
2533
+ * the cursor, `"-=200"` overlaps the previous segment by 200ms.
2534
+ * - any other string — a label registered via `Sequence.label`.
2535
+ */
2536
+ declare type SequencePosition = number | `+=${number}` | `-=${number}` | string;
2537
+
2538
+ /**
2539
+ * A `segment:enter` / `segment:leave` subscriber. Receives the crossing
2540
+ * segment's own `animation` reference and the master-clock position (ms) at the
2541
+ * crossing. The clock lets the consumer infer direction (a backward crossing
2542
+ * arrives with a smaller `masterClock` than the prior call).
2543
+ */
2544
+ declare type SequenceSegmentSubscriber = (animation: KeyframesAnimation<any>, masterClock: number) => void;
2545
+
2546
+ /** The union over the two subscriber shapes (the {@link Sequence.on} fallthrough). */
2547
+ declare type SequenceSubscriber = SequenceSegmentSubscriber | SequenceLabelSubscriber;
2548
+
2549
+ /**
2550
+ * SO-1 SERIALIZE — round-trip a typed `CSSTimelineOptions` BACK to its CSS
2551
+ * longhand declarations (`{ "animation-timeline"?, "animation-range"?,
2552
+ * "timeline-scope"?, "animation-trigger"? }`). The parser run BACKWARD over the
2553
+ * SAME data model — value.js's `serializeTimelineOptions` (the inverse mirror of
2554
+ * its extractor), NOT a re-derived lossy emitter. Emits only present fields (no
2555
+ * default padding); the keys mirror the CSS longhand names.
2556
+ *
2557
+ * THE REPLAY-EQUALITY ORACLE: `serializeScrollOptions(parseScrollCSS(s))` is
2558
+ * canonical-form-equal to `s`'s scroll declarations — a faithful round-trip, OR
2559
+ * a REFUSAL (a parse that drops a phase reds the gate), never a silent
2560
+ * approximation. See {@link roundTripScrollCSS}.
2561
+ */
2562
+ export declare function serializeScrollOptions(opts: CSSTimelineOptions): {
2563
+ "animation-timeline"?: string;
2564
+ "animation-range"?: string;
2565
+ "timeline-scope"?: string;
2566
+ "animation-trigger"?: string;
2567
+ };
2568
+
2569
+ declare const shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2570
+
2571
+ declare const skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2572
+
2573
+ declare const slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2574
+
2575
+ declare const slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2576
+
2577
+ declare const slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2578
+
2579
+ declare const slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2580
+
2581
+ declare const slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2582
+
2583
+ declare interface SmoothProgressOptions {
2584
+ /** Damping factor (0, 1]. Higher = faster convergence. Default 0.1 */
2585
+ damping: number;
2586
+ /** Snap to target when |target - current| < threshold. Default 0.001 */
2587
+ snapThreshold: number;
2588
+ /**
2589
+ * Minimum change required to update the target. Changes smaller than this
2590
+ * are ignored, filtering high-frequency noise (e.g. sub-pixel scroll jitter).
2591
+ * Default 0 (disabled — every change is accepted).
2592
+ */
2593
+ targetEpsilon: number;
2594
+ /** Starting value. Default 0 */
2595
+ initial: number;
2596
+ /** Clamp current to [0, 1]. Default true */
2597
+ clamp: boolean;
2598
+ /**
2599
+ * When true, honor `prefers-reduced-motion: reduce` by snapping to
2600
+ * target immediately rather than damping. `setTarget` short-circuits
2601
+ * the smooth-toward path; `play()` invokes `onFrame` once with the
2602
+ * target value. Default false (conservative default — opt in to the
2603
+ * reduced-motion snap).
2604
+ *
2605
+ * The check uses `matchMedia` if available; on SSR / Node the option
2606
+ * is a no-op (animations proceed normally).
2607
+ */
2608
+ respectReducedMotion: boolean;
2609
+ }
2610
+
2611
+ /** A `.snap()` snap point — a local progress in [0,1] the scene settles to. */
2612
+ export declare type SnapPoints = readonly number[];
2613
+
2614
+ /**
2615
+ * P.W2 — the precomputed SoA fold layout for ONE `add`/`weighted` blend layer.
2616
+ * `carriers[s]`/`incomings[s]` are the stable `ValueUnit<number>` refs the boxed
2617
+ * inner loop would have touched at slot `s` (the carrier is the leaf a lower
2618
+ * layer parked in `_grouped`; the incoming is this layer's `entry.values` leaf —
2619
+ * both alias `frame.flatVars` units whose `.value` `interpFrames` mutates in
2620
+ * place, so the refs are frame-stable). The per-frame fold seeds the composite
2621
+ * buffer from each carrier, applies the layer's op (`+=` for `add`, `lerp(...,w)`
2622
+ * for `weighted`) against the incoming, and writes back — replacing the
2623
+ * per-frame `for..in` + `Array.isArray` + per-element `isNumericUnit` dispatch
2624
+ * with a contiguous numeric loop. The `entry` is carried for the `weighted`
2625
+ * arm's per-LAYER `w = layer.weightSpring?.value ?? layer.weight` read (K.W11
2626
+ * PHYS-C).
2627
+ */
2628
+ declare interface SoALayerPlan {
2629
+ /**
2630
+ * The layer config — the `weighted` fold re-reads its per-frame `w =
2631
+ * weightSpring?.value ?? weight` LIVE (K.W11 PHYS-C, so a spring still drives
2632
+ * the blend), and the config is generic-independent so the plan holds it
2633
+ * without binding the group's `V`.
2634
+ */
2635
+ layer: AnimationLayerConfig;
2636
+ weighted: boolean;
2637
+ /** The pure-numeric carrier units the fold seeds the composite buffer from + writes back to. */
2638
+ carriers: ValueUnit<number>[];
2639
+ /** The incoming numeric units folded against each carrier (parallel to `carriers`). */
2640
+ incomings: ValueUnit<number>[];
2641
+ /**
2642
+ * The keys this layer touches that the SoA fold does NOT cover — a non-array
2643
+ * carrier (first-touch of a key, or a scalar that a lower layer left
2644
+ * `undefined`), or a leaf with ANY non-numeric / mixed element. These keep
2645
+ * the boxed per-element path (the `Array.isArray` guard + the
2646
+ * `Math.min(existing.length, incoming.length)` element loop), so the
2647
+ * `add`/`weighted` blend stays byte-identical on the non-numeric tail. EMPTY
2648
+ * for the dominant all-numeric transform shape (every leaf a numeric
2649
+ * `ValueUnit[]`), so the whole `for..in` collapses to the SoA fold.
2650
+ *
2651
+ * S.F5a S1 — a precomputed `Set`, built ONCE here at `buildSoAPlans`
2652
+ * (structural-change time). The compositor's boxed residual (`boxedBlendArm`)
2653
+ * takes it DIRECTLY as its `only` membership test — killing the per-frame
2654
+ * `new Set(only)` the boxed arm rebuilt every frame on the mixed-leaf shape
2655
+ * (the allocation is hoisted to plan-build time, `proof:zero-alloc`
2656
+ * mixed-leaf clause).
2657
+ */
2658
+ boxedKeys: Set<string>;
2659
+ }
2660
+
2661
+ declare const spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2662
+
2663
+ /** Spring-eased attention "pop" — the bouncy spring drives the scale pulse. */
2664
+ declare const springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2665
+
2666
+ /**
2667
+ * iOS-style spring physics options. The pair `(response, dampingFraction)`
2668
+ * is the SwiftUI-canonical surface — designer-tunable, normalized so
2669
+ * `dampingFraction = 1` is critically damped (no overshoot), `< 1` rings,
2670
+ * `> 1` is overdamped (sluggish). Internally these map onto a standard
2671
+ * second-order linear ODE
2672
+ *
2673
+ * x'' + 2ζω₀ x' + ω₀² x = ω₀² target
2674
+ *
2675
+ * with `ω₀ = 2π / response` and `ζ = dampingFraction`, unit mass.
2676
+ */
2677
+ declare interface SpringProgressOptions {
2678
+ /**
2679
+ * Angular period of the oscillation in seconds. Roughly the time the
2680
+ * spring takes to swing through one cycle if undamped. Default 0.5.
2681
+ * Smaller values → snappier; larger → looser.
2682
+ */
2683
+ response: number;
2684
+ /**
2685
+ * Damping ratio ζ. `1` critically damped (fastest no-overshoot);
2686
+ * `< 1` underdamped (rings); `> 1` overdamped (sluggish). Default
2687
+ * 0.86 — the iOS "smooth" preset.
2688
+ */
2689
+ dampingFraction: number;
2690
+ /** Starting position. Default 0. */
2691
+ initial: number;
2692
+ /** Starting velocity (units/s). Default 0. */
2693
+ initialVelocity: number;
2694
+ /**
2695
+ * Position settle threshold. When |x - target| AND |v| both drop
2696
+ * below `settleThreshold` and `velocitySettleThreshold` respectively,
2697
+ * the spring snaps to target and stops integrating. Default 1e-3.
2698
+ */
2699
+ settleThreshold: number;
2700
+ /** Velocity settle threshold (units/s). Default 1e-3. */
2701
+ velocitySettleThreshold: number;
2702
+ /**
2703
+ * Honor `prefers-reduced-motion: reduce` (K.W11 PHYS-E — the
2704
+ * intensity-scaled, WCAG 2.3.3-aligned gate):
2705
+ *
2706
+ * - `false` (default) — ignore the preference; the spring runs at full
2707
+ * amplitude.
2708
+ * - `true` — the classic binary snap: under an active query the spring
2709
+ * jumps to target at zero velocity (amplitude scale `0`). SSR-safe.
2710
+ * - a `number` ∈ [0, 1] — the AMPLITUDE INTENSITY: under an active query
2711
+ * the spring keeps its trajectory SHAPE (curve + settle time) but scales
2712
+ * its displacement-from-rest (`originValue − targetValue`) to this
2713
+ * fraction. At `0.3` the peak overshoot is 30 % of the full-intensity
2714
+ * peak; the envelope is preserved by construction (the analytic form
2715
+ * makes the scaling exact and free). `1` ≈ full motion, `0` ≡ the snap.
2716
+ *
2717
+ * The scale is the CONSUMER's policy (a settings slider, a per-animation
2718
+ * field) — the OS exposes only a binary signal; kf provides the mechanism.
2719
+ */
2720
+ respectReducedMotion: ReducedMotionPolicy;
2721
+ }
2722
+
2723
+ /**
2724
+ * Spring-eased scale-in entrance — the canonical iOS "pop" with overshoot.
2725
+ * Uses the bouncy spring (ζ 0.5) so the element settles past 1 before resting.
2726
+ */
2727
+ declare const springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2728
+
2729
+ /** Spring-eased slide-up entrance — the snappy spring (ζ 0.78). */
2730
+ declare const springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2731
+
2732
+ /** Spring-eased wobble — gentle spring (ζ 0.95) for a soft attention nudge. */
2733
+ declare const springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2734
+
2735
+ /**
2736
+ * Feature-detect native `animation-trigger` — Chrome 145+ ships it; nothing else
2737
+ * (yet) does. `CSS.supports` is the FEATURE probe (never a UA sniff — r5 / the
2738
+ * CE-1.0 precedent). Returns `false` where `CSS`/`CSS.supports` is absent (SSR,
2739
+ * jsdom) OR the property/keyword is unknown, so the caller keeps the kf driver.
2740
+ */
2741
+ export declare function supportsNativeTrigger(): boolean;
2742
+
2743
+ declare abstract class SVGAnimationHandle<V extends Vars = Vars> {
2744
+ readonly animation: CSSKeyframesAnimation<V>;
2745
+ /**
2746
+ * The underlying animation — the control handle. Set by the subclass through
2747
+ * `super(fromX(...))` (the `fromX` factory is the canonical construction).
2748
+ */
2749
+ constructor(animation: CSSKeyframesAnimation<V>);
2750
+ /** Start (or re-enter) the play loop. Resolves when the animation completes. */
2751
+ play(): Promise<void>;
2752
+ /** Pause the play loop, retaining the playhead. Chainable. */
2753
+ pause(): this;
2754
+ /** Halt and rewind the play loop. Chainable. */
2755
+ stop(): this;
2756
+ /** Resolve once the animation completes — the {@link Animation.finished}
2757
+ * completion front-door, uniform across every SVG handle. */
2758
+ get finished(): Promise<void>;
2759
+ }
2760
+
2761
+ /**
2762
+ * The minimal geometry contract DrawSVG needs: any SVG element that exposes
2763
+ * `getTotalLength()` (`SVGGeometryElement` — `<path>`, `<line>`, `<circle>`,
2764
+ * `<ellipse>`, `<rect>`, `<polygon>`, `<polyline>`). Narrower than `SVGElement`
2765
+ * so a non-geometry SVG node is a type error at the call site, not a runtime
2766
+ * surprise.
2767
+ */
2768
+ export declare type SVGDrawTarget = SVGElement & {
2769
+ getTotalLength(): number;
2770
+ };
2771
+
2772
+ declare interface TemplateAnimationFrame<V extends Vars> {
2773
+ id: number;
2774
+ start: ValueUnit;
2775
+ vars: V;
2776
+ transform?: TransformFunction<V>;
2777
+ timingFunction?: Easing;
2778
+ /**
2779
+ * The author-declared `animation-composition` operator for this stop
2780
+ * (`replace` | `add` | `accumulate`), captured by the adapter and threaded
2781
+ * here so the engine HONORS it (K.W7 — the fidelity floor). Genuine
2782
+ * omission means `replace` (the default composite). value.js lifts it onto
2783
+ * `rule.composition`; `resolveKeyframes` captures it on
2784
+ * `ResolvedKeyframes.composition`; `fromString` reads that Map into this
2785
+ * field. The compiled {@link AnimationFrame.composition} inherits it.
2786
+ */
2787
+ composition?: CompositeOperator;
2788
+ }
2789
+
2790
+ declare const textFocusBlur: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2791
+
2792
+ /**
2793
+ * A dt-driven stepper the {@link RAFPlayback.drive} loop can own:
2794
+ * `SmoothProgress` and `SpringProgress` implement it directly. The driver
2795
+ * steps `tickDt(dt)` once per frame until `settled` flips true.
2796
+ */
2797
+ declare interface Tickable {
2798
+ /** Advance the stepper by `dt` milliseconds; returns the new value. */
2799
+ tickDt(dt: number): number;
2800
+ /** True when the stepper has converged — the driver stops the loop. */
2801
+ readonly settled: boolean;
2802
+ }
2803
+
2804
+ declare abstract class Timeline {
2805
+ private smoother;
2806
+ private _easingFn;
2807
+ private currentProgress;
2808
+ private boundaryEpsilon;
2809
+ constructor(options?: TimelineOptions);
2810
+ /** Subclass returns raw [0,1] progress from its source. */
2811
+ protected abstract sample(): number;
2812
+ /**
2813
+ * Shared progress pipeline: sample → clamp → easing → boundary snap.
2814
+ * Returns the processed raw value. Does NOT advance the smoother —
2815
+ * `_advance` drives it.
2816
+ */
2817
+ private applyPipeline;
2818
+ /**
2819
+ * Shared advance step: pipeline → ONE `setTarget` → ONE branch. At a
2820
+ * boundary ([0,1]) the smoother snaps for instant convergence; in the
2821
+ * interior it steps `tickDt(dt)` (the canonical ms step). Returns the
2822
+ * resulting progress.
2823
+ */
2824
+ private _advance;
2825
+ /**
2826
+ * Advance one frame at a nominal 60fps step. Applies
2827
+ * easing → boundary snap → smoothing. Use {@link tickDt} when you own
2828
+ * a real frame clock.
2829
+ */
2830
+ tick(): number;
2831
+ /** Frame-rate independent variant. `dt` in milliseconds. */
2832
+ tickDt(dt: number): number;
2833
+ get progress(): number;
2834
+ /** True if no smoother or smoother is settled. */
2835
+ get settled(): boolean;
2836
+ /** Immediately converge smoother to current target. */
2837
+ snap(): void;
2838
+ /** Reset progress to a specific value (default 0). */
2839
+ reset(value?: number): void;
2840
+ }
2841
+
2842
+ declare interface TimelineOptions {
2843
+ /**
2844
+ * Easing as a callable `TimingFunction` or a typed `Easing` — both
2845
+ * synchronous and value.js-free, so the `Timeline` family never touches
2846
+ * the dynamic boundary.
2847
+ *
2848
+ * A string easing *name* is NOT accepted here (fail-explicit: it
2849
+ * throws). Resolve a name once, up front, through the async factory:
2850
+ *
2851
+ * ```ts
2852
+ * const easing = await resolveEasing("ease-out-cubic");
2853
+ * new KeyframesScrollTimeline({ easing });
2854
+ * ```
2855
+ */
2856
+ easing?: TimingFunction | Easing | undefined;
2857
+ /** SmoothProgress config. `false` disables smoothing. Default: enabled. */
2858
+ smoothing?: Partial<SmoothProgressOptions> | false | undefined;
2859
+ /**
2860
+ * Boundary snap zone. When the eased progress is within this distance of
2861
+ * 0 or 1, the smoother snaps instantly instead of lerping. Prevents
2862
+ * oscillation at scroll endpoints where micro-jitter alternates between
2863
+ * boundary and non-boundary values each frame.
2864
+ * Default 0.005.
2865
+ */
2866
+ boundaryEpsilon?: number | undefined;
2867
+ }
2868
+
2869
+ declare type TimingFunction = (t: number) => number;
2870
+
2871
+ declare type TimingFunctionNames = keyof typeof timingFunctions;
2872
+
2873
+ declare type TransformFunction<V extends Vars> = (v: V, t: number) => void;
2874
+
2875
+ /**
2876
+ * Default DOM-style renderer used by `Animation.transform` when no
2877
+ * user-supplied transform is provided. "Is this the default renderer?"
2878
+ * is decided by reference comparison against the Animation instance's
2879
+ * one `_defaultTransform` (`usesDefaultRenderer`) — typed and
2880
+ * bind-proof, not a Symbol tag a wrapper would silently drop.
2881
+ */
2882
+ export declare function transformTargetsStyle<V extends Vars>(vars: V, targets: HTMLElement[], flat?: boolean): void;
2883
+
2884
+ /** The play direction a trigger cycle runs — `alternate` flips it each entry. */
2885
+ export declare type TriggerDirection = "forward" | "backward";
2886
+
2887
+ /**
2888
+ * The kf `TriggerScene` — realizes a parsed `AnimationTriggerValue` as the
2889
+ * idle→active→done lifecycle over a raw scroll position. The caller drives the
2890
+ * loop (`triggerProgress(p)` per scroll event); the scene owns no rAF and no
2891
+ * DOM. The four `<trigger-type>`s differ ONLY in their crossing semantics:
2892
+ *
2893
+ * • `once` — fires once. `idle →enter→ active →exit→ done`; `done` LATCHES
2894
+ * (a re-entry never re-fires). The one-shot reveal.
2895
+ * • `repeat` — re-fires. `idle →enter→ active →exit→ idle` (RESET — the exit
2896
+ * returns to the pre-animation state); each re-entry re-plays
2897
+ * forward, `cycles` incrementing. Never permanently `done`.
2898
+ * • `alternate` — re-fires with a FLIPPED direction. `idle →enter→
2899
+ * active(forward) →exit→ done →enter→ active(backward) → …`;
2900
+ * `direction` alternates each entry (the backward semantics).
2901
+ * • `state` — the play state FOLLOWS presence. `inside ⇒ active`,
2902
+ * `outside ⇒ done` (after the first entry) — the playhead is
2903
+ * HELD across the boundary (pause/resume, NOT reset).
2904
+ *
2905
+ * The `playhead` (0..1) is the animation's own progress the consumer writes to
2906
+ * an engine; it advances with the within-range fraction while `active`. The gate
2907
+ * asserts the STATE sequence (scrub-based, C-10 — never a frame/ms threshold).
2908
+ */
2909
+ export declare class TriggerScene {
2910
+ /** The parsed `<trigger-type>` (CSS initial value is `once`). */
2911
+ readonly type: TriggerType;
2912
+ private readonly triggerRange;
2913
+ private _state;
2914
+ private _direction;
2915
+ private _playhead;
2916
+ private _cycles;
2917
+ private wasInside;
2918
+ private everEntered;
2919
+ constructor(trigger?: AnimationTriggerValue);
2920
+ /** The current lifecycle state. */
2921
+ get state(): TriggerState;
2922
+ /** The current play direction (`alternate` flips it each entry). */
2923
+ get direction(): TriggerDirection;
2924
+ /** The animation's own progress (0..1) — the engine-write the driver tracks. */
2925
+ get playhead(): number;
2926
+ /** How many times the trigger has fired (entered `active` from idle/done). */
2927
+ get cycles(): number;
2928
+ /** The resolved [start,end] scroll-extent fractions of the trigger range. */
2929
+ get range(): ResolvedRange;
2930
+ /**
2931
+ * True when the platform will run this trigger NATIVELY (Chrome 145+). The
2932
+ * dispatch is the caller's: `usesNative` ⇒ author a native `animation-trigger`
2933
+ * declaration; else drive THIS scene. Feature-detected, never UA-sniffed.
2934
+ */
2935
+ get usesNative(): boolean;
2936
+ /**
2937
+ * Drive the trigger from a raw scroll position `p ∈ [0,1]` (the caller
2938
+ * resolves the live scroller; kf maps it over the trigger range). Advances
2939
+ * the idle→active→done state machine per the `<trigger-type>` semantics and
2940
+ * returns the new state.
2941
+ */
2942
+ triggerProgress(p: number): TriggerState;
2943
+ /** Rewind the lifecycle to `idle` (re-arm a `once`/`state` scene). */
2944
+ reset(): void;
2945
+ /** `once` — fire once, then LATCH `done` (a re-entry never re-fires). */
2946
+ private stepOnce;
2947
+ /** `repeat` — RESET to `idle` on exit; each re-entry re-plays forward. */
2948
+ private stepRepeat;
2949
+ /** `alternate` — exit `done`; each re-entry FLIPS the play direction. */
2950
+ private stepAlternate;
2951
+ /** `state` — play state FOLLOWS presence; the playhead is HELD across exits. */
2952
+ private stepState;
2953
+ private directedPlayhead;
2954
+ }
2955
+
2956
+ /**
2957
+ * The three lifecycle states a `<single-animation-trigger>` traverses:
2958
+ * • `idle` — the timeline has not (yet) triggered the animation.
2959
+ * • `active` — the trigger fired; the animation is playing.
2960
+ * • `done` — the trigger cycle completed (latched for `once`; transient for
2961
+ * the re-firing types).
2962
+ * The canonical `once` lifecycle is `idle → active → done`; the other three
2963
+ * types are variations over the SAME vocabulary (§`triggerProgress`).
2964
+ */
2965
+ export declare type TriggerState = "idle" | "active" | "done";
2966
+
2967
+ declare const typewriter: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2968
+
2969
+ declare const typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
2970
+
2971
+ /**
2972
+ * `validate(css, opts?)` — the READ-ONLY projection over the three typed channels
2973
+ * onto one {@link ValidateResult} envelope. Async because `compileToCSS` is (its
2974
+ * Prettier pass).
2975
+ *
2976
+ * The pipeline:
2977
+ * 1. `parseCSSStylesheet(css)` → the AST; `parseable` is true when value.js
2978
+ * surfaced at least one recognized item and the resolve raised no
2979
+ * `PARSE_ERROR` (the spec-faithful reality — a dropped `!important` decl is
2980
+ * not a parse failure).
2981
+ * 2. `CSSKeyframesAnimation.fromString(css)` → the parsed animation +
2982
+ * `anim.diagnostics` (the adapter's silent-fallback channel).
2983
+ * 3. `compileToCSS([anim], opts.compile)` → `{ eligible, refusals }`.
2984
+ * 4. `isWAAPIEligible(anim)` → the compositor-thread verdict.
2985
+ */
2986
+ export declare function validate(css: string, opts?: ValidateOptions): Promise<ValidateResult>;
2987
+
2988
+ /**
2989
+ * Options for {@link validate} / {@link explain}. A thin pass-through to the
2990
+ * underlying channels — NOT a new option surface. `compile` forwards verbatim to
2991
+ * `compileToCSS` (the ΔE-ε / densify-stop knobs the refusal arm reads).
2992
+ */
2993
+ export declare interface ValidateOptions {
2994
+ /**
2995
+ * Forwarded verbatim to `compileToCSS` — the CC-2 densify-stop count + the
2996
+ * ΔE-ε ship-vs-refuse threshold the perceptual-oklab refusal arm reads. Omit
2997
+ * for the compiler defaults.
2998
+ */
2999
+ compile?: CompileOptions;
3000
+ }
3001
+
3002
+ /**
3003
+ * The flat, agent-shaped envelope `validate` returns — the JOIN over the three
3004
+ * typed channels. An LLM agent branches on these fields WITHOUT scraping a
3005
+ * message string. Every constituent type (`CompileRefusal`, `Diagnostic`,
3006
+ * `WAAPIEligibility`) is already exported from the barrel — the ONLY new type is
3007
+ * this envelope.
3008
+ */
3009
+ export declare interface ValidateResult {
3010
+ /**
3011
+ * True iff value.js parsed the CSS without a `PARSE_ERROR` diagnostic — the
3012
+ * block surfaced at least one recognized stylesheet item (a `@keyframes` /
3013
+ * `@property` / style rule). A spec-invalid keyframe `!important` declaration
3014
+ * is SILENTLY dropped at the AST by value.js (the L.W1 S1 reality) — that drop
3015
+ * is NOT a parse failure, so a block carrying it stays `parseable:true`.
3016
+ */
3017
+ parseable: boolean;
3018
+ /**
3019
+ * True iff `compileToCSS` produced an artifact for every child — the compile
3020
+ * surface's own `eligible` flag. False when any child refused (see
3021
+ * {@link refusals}). Separate from {@link waapi}: a block can be compile-
3022
+ * eligible (the CSS round-trips faithfully) yet WAAPI-ineligible (color
3023
+ * interpolation, computed units) and vice versa.
3024
+ */
3025
+ eligible: boolean;
3026
+ /**
3027
+ * The CC-3 refusals — one per child that could not compile faithfully (the
3028
+ * `{ name, reason, message }` trust surface). Empty on a clean compile.
3029
+ */
3030
+ refusals: CompileRefusal[];
3031
+ /**
3032
+ * All parse/honoring diagnostics from `resolveKeyframes` — every SILENT
3033
+ * fallback the adapter used to swallow, now a citable row with a stable
3034
+ * {@link Diagnostic.code}. Empty on a clean parse.
3035
+ */
3036
+ diagnostics: Diagnostic[];
3037
+ /**
3038
+ * The WAAPI eligibility verdict — `{ eligible: true }` or
3039
+ * `{ eligible: false; reason: string }`. Separate from {@link eligible}: the
3040
+ * compositor-thread delegation has its own, narrower bar (no color interp, no
3041
+ * computed units, a uniform CSS-twinned easing).
3042
+ */
3043
+ waapi: WAAPIEligibility;
3044
+ }
3045
+
3046
+ declare type Vars<T = any> = {
3047
+ [arg: string]: number | string | T;
3048
+ };
3049
+
3050
+ /** Options for {@link compileToViewTransition}, extending {@link CompileOptions}. */
3051
+ export declare interface ViewTransitionCompileOptions extends CompileOptions {
3052
+ /** Typed same-doc VT — wraps every rule in `:root:active-view-transition-type(...)`. */
3053
+ types?: readonly string[];
3054
+ /** Prepend the cross-doc `@view-transition { navigation: auto }` preamble (opt-in). */
3055
+ crossDocument?: boolean;
3056
+ /** Append the PRM `animation: none` degrade block (default `true`). */
3057
+ reducedMotion?: boolean;
3058
+ /**
3059
+ * Emit the MANDATORY timing-only group pseudo (default `true`). Turning it
3060
+ * OFF ships the 250ms/ease temporal incoherence p09 observed — exposed only
3061
+ * so the born-RED gate's falsifiability clause can prove the omission REDs.
3062
+ */
3063
+ emitGroup?: boolean;
3064
+ }
3065
+
3066
+ /** A VT refusal — the CC-3 shape widened to the VT reason union. */
3067
+ export declare interface VTCompileRefusal extends Omit<CompileRefusal, "reason"> {
3068
+ reason: VTCompileRefusalReason;
3069
+ }
3070
+
3071
+ /** The four VT refusals atop the inherited CC-3 {@link CompileRefusalReason}. */
3072
+ export declare type VTCompileRefusalReason = CompileRefusalReason | "vt-scroll-grammar" | "vt-element-scoped-computed" | "vt-snapshot-inapplicable" | "vt-name-collision";
3073
+
3074
+ /**
3075
+ * The per-name VT role mapping (SF-1). A group/Sequence has NO old/new axis (the
3076
+ * group-as-primary reading is REJECTED), so the emitter's PRIMARY input is this
3077
+ * name-keyed role spec. `old`/`new` are the same `KeyframesAnimation`s
3078
+ * `compileToCSS` walks; `group` is timing-only by design.
3079
+ */
3080
+ export declare type VTRoleSpec<V extends Vars = Vars> = {
3081
+ /** The outgoing snapshot's animation (`::view-transition-old(name)`). */
3082
+ old?: KeyframesAnimation<V>;
3083
+ /** The incoming snapshot's animation (`::view-transition-new(name)`). */
3084
+ new?: KeyframesAnimation<V>;
3085
+ /**
3086
+ * Timing-only for the group pseudo: duration + easing onto the UA geometry
3087
+ * morph (NEVER `animation-name`). A `KeyframesAnimation` contributes its
3088
+ * `options.duration`/`timingFunction`; a bare `{ duration, timingFunction }`
3089
+ * gives them directly. Omit → derived from `new ?? old` (the coherent default).
3090
+ */
3091
+ group?: Pick<AnimationOptions, "duration" | "timingFunction"> | KeyframesAnimation<V>;
3092
+ /** A `view-transition-class` cohort name — uniform cohorts ride one rule. */
3093
+ class?: string;
3094
+ };
3095
+
3096
+ declare type WAAPIEligibility = {
3097
+ eligible: true;
3098
+ } | {
3099
+ eligible: false;
3100
+ reason: string;
3101
+ };
3102
+
3103
+ declare const warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
3104
+
3105
+ declare const warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation<Vars>;
3106
+
3107
+ /**
3108
+ * The minimal stepper surface a spring-driven blend weight reads (K.W11
3109
+ * PHYS-C). A `SpringProgress` satisfies it structurally (`value` getter +
3110
+ * `tickDt` + `settled`); typing it as this narrow shape — NOT importing
3111
+ * `SpringProgress` — keeps `constants.ts` from gaining a class edge and lets
3112
+ * a consumer drive a layer's weight with ANY analytic stepper (a decay glide,
3113
+ * a custom `Tickable`). The read is one nullish access in the `weighted` blend
3114
+ * leaf; the group's managed loop advances it per frame via `tickDt`.
3115
+ */
3116
+ declare interface WeightStepper {
3117
+ /** The stepper's current scalar — read in place of the constant `weight`. */
3118
+ readonly value: number;
3119
+ /** Advance the stepper by `dt` milliseconds (the group's managed tick). */
3120
+ tickDt(dt: number): number;
3121
+ /** True once the stepper has converged — the group clears it then. */
3122
+ readonly settled: boolean;
3123
+ }
3124
+
3125
+ /**
3126
+ * `yieldToMain()` — break a long main-thread task so the browser can service
3127
+ * input/render between slices (INP relief). Used by `AnimationGroup.advanceTo()`
3128
+ * to keep a large group's per-frame composite from monopolizing the main
3129
+ * thread as one long task.
3130
+ *
3131
+ * Baseline-Newly: prefers the native `scheduler.yield()` (continuation runs
3132
+ * at the FRONT of the task queue, so yielding stays cheap); falls back to a
3133
+ * `MessageChannel` macrotask, then `setTimeout(0)` — a ≤20 LOC progressive
3134
+ * fallback per the Baseline browser policy. SSR-safe: resolves immediately
3135
+ * off-DOM (no event loop to yield to that matters for a headless render).
3136
+ */
3137
+ export declare function yieldToMain(): Promise<void>;
3138
+
3139
+ export { }