@mkbabb/keyframes.js 3.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,17 +8,96 @@ import { timingFunctions } from '@mkbabb/value.js';
8
8
  import { ValueArray } from '@mkbabb/value.js';
9
9
  import { ValueUnit } from '@mkbabb/value.js';
10
10
 
11
+ declare const accordionExpand: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
12
+
13
+ /**
14
+ * Construct, target, and play an animation in one call. Returns the
15
+ * `CSSKeyframesAnimation` as the control handle — `await animate(...)` is NOT
16
+ * the pattern (it would await the *construction*, which is synchronous); await
17
+ * the returned handle's play promise via the `.play()` it already kicked off,
18
+ * or pass `autoPlay: false` and drive it yourself.
19
+ *
20
+ * @param target one or more DOM elements (or a single element) to animate.
21
+ * @param input a CSS string, a keyframe map, a vars array, or a MotionPath
22
+ * spec (`{ path }`) — dispatched on its shape.
23
+ * @param options animation options + optional `transform` / `autoPlay`.
24
+ *
25
+ * @example
26
+ * // CSS string → fromString
27
+ * animate(box, `from { opacity: 0 } to { opacity: 1 }`, { duration: 400 });
28
+ * // keyframe map → fromKeyframes
29
+ * animate(box, { "0%": { opacity: 0 }, "100%": { opacity: 1 } });
30
+ * // vars array → fromVars
31
+ * animate(box, [{ opacity: 0 }, { opacity: 1 }], { duration: 400 });
32
+ * // MotionPath spec → fromMotionPath (F.W12 §S2)
33
+ * animate(box, { path: "path('M 0 0 Q 100 -100 200 0')", rotate: "auto" }, { duration: 2000 });
34
+ */
35
+ declare function animate<V extends Vars = any>(target: HTMLElement | HTMLElement[], input: AnimateInput<V>, options?: AnimateOptions): CSSKeyframesAnimation<V>;
36
+
37
+ /**
38
+ * The declarative input to {@link animate} — one of the four `from*` shapes:
39
+ *
40
+ * • `string` — a CSS `@keyframes` (or bare keyframe-block) source.
41
+ * • `KeyframeMap` — `{ "0%": {...}, "100%": {...} }` or the `Map` form.
42
+ * • `V[]` — an ordered vars array (the simplest `[from, to]`
43
+ * pair, or more stops), distributed evenly 0→100%.
44
+ * • `MotionPathInput` — `{ path, from?, to?, rotate? }` — an `offset-distance`
45
+ * sweep over an author `offset-path` (F.W12 §S2).
46
+ */
47
+ export declare type AnimateInput<V extends Vars> = string | KeyframeMap<V> | V[] | MotionPathInput;
48
+
49
+ /**
50
+ * Options accepted by {@link animate}. The animation-options surface, plus an
51
+ * optional custom `transform` renderer (forwarded to the chosen `from*`
52
+ * factory) and `autoPlay` (default true — set false to construct + target
53
+ * without starting, when the caller wants to drive the returned handle).
54
+ */
55
+ export declare interface AnimateOptions extends Partial<InputAnimationOptions> {
56
+ /** Custom renderer forwarded to the `from*` factory. */
57
+ transform?: TransformFunction<any>;
58
+ /**
59
+ * Auto-start the animation after construction + targeting. Default true.
60
+ * `false` returns a constructed, targeted, NOT-yet-playing handle.
61
+ */
62
+ autoPlay?: boolean;
63
+ }
64
+
11
65
  declare class Animation_2<V extends Vars = any> {
12
66
  id: number;
13
67
  name: string | undefined;
14
68
  superKey: string | undefined;
15
69
  targets: HTMLElement[];
16
70
  options: AnimationOptions;
17
- templateFrames: TemplateAnimationFrame<V>[];
18
- parsedVars: ParsedVarMap[];
19
- frameId: number;
20
- frames: AnimationFrame<V>[];
21
- handleId: number | any;
71
+ /**
72
+ * The frame-compilation half — template frames → sampled `frames[]`.
73
+ * `Animation` composes one and delegates `addFrame`/`parse` + the frame
74
+ * accessors (`templateFrames`/`parsedVars`/`frames`/`frameId`) to it.
75
+ * Assigned in the constructor once `options` exists (the compiler holds a
76
+ * live reference to that options object).
77
+ *
78
+ * READ-ONLY surface (G.W19): the backing `_compiler` is written ONLY by the
79
+ * constructor and {@link adoptCompiled}. An external `animation.compiler = …`
80
+ * write was the one cross-boundary reach-in vector that could desync the
81
+ * live-options reference (`this.options !== this.compiler.options`); making
82
+ * `compiler` a get-only accessor makes that reach-in a COMPILE error, not a
83
+ * convention. Adopt a compiled state via `adoptCompiled(source)`.
84
+ */
85
+ private _compiler;
86
+ get compiler(): FrameCompiler<V>;
87
+ /**
88
+ * THE rAF owner for this animation — the standalone rAF play loop and
89
+ * the WAAPI shadow tick both ride it, so `stop()` halts either
90
+ * uniformly and no raw rAF handle leaks onto the instance.
91
+ */
92
+ readonly playback: RAFPlayback;
93
+ /**
94
+ * The live WAAPI compositor animations during a `_playWAAPI` delegation
95
+ * (one per target), populated by `playWAAPI` and cleared on teardown.
96
+ * The lifecycle methods (`stop`/`reset`) cancel these so a stopped
97
+ * compositor animation never keeps painting and the awaited play
98
+ * promise never hangs. Empty on the rAF path.
99
+ */
100
+ _waAnimations: globalThis.Animation[];
22
101
  startTime: number | undefined;
23
102
  pausedTime: number;
24
103
  t: number;
@@ -29,7 +108,7 @@ declare class Animation_2<V extends Vars = any> {
29
108
  paused: boolean;
30
109
  /**
31
110
  * True when an `AnimationGroup` is driving this animation's
32
- * `tick()` and `interpFrames()` from its own rAF loop. Set by
111
+ * `advanceTo()` and `interpFrames()` from its own rAF loop. Set by
33
112
  * the group at construction; standalone `.play()` / `.draw()`
34
113
  * throw when this is true rather than racing the group.
35
114
  */
@@ -44,31 +123,99 @@ declare class Animation_2<V extends Vars = any> {
44
123
  private resolvePromise;
45
124
  private _playingPromise;
46
125
  /**
47
- * Pre-bound draw callback — allocated once to avoid creating a new
48
- * closure on every requestAnimationFrame reschedule.
126
+ * Pre-bound frame callback — allocated once to avoid creating a new
127
+ * closure on every playback loop start.
128
+ */
129
+ private _boundFrame;
130
+ /**
131
+ * The ONE output buffer for the standalone play loop's `interpFrames`
132
+ * calls — reused every frame so steady-state playback allocates no
133
+ * per-frame result object (the primitive-level analogue of the group's
134
+ * hoisted `_grouped` buffer, gated by `proof:standalone-zero-alloc`).
135
+ * The play path (`_frame`) never returns this object to a consumer, so
136
+ * reuse is safe; `at()` (a query whose result the caller keeps) still
137
+ * allocates a fresh object.
138
+ */
139
+ private _interpOut;
140
+ /**
141
+ * The compile-stable union of every frame's `flatVars` keys — the maximal
142
+ * key-set any `interpFrames` call can write. Fixed at `parse` (the keys
143
+ * never change across frames; a color-space renormalize re-derives the same
144
+ * carriers under the same keys). It is what `clearBuffer` null-fills to keep
145
+ * a reused buffer stale-free WITHOUT `delete` (F.W4 S1 — the V8 dictionary-
146
+ * mode trap the delete-loop fell into). Exposed (read-only) as `flatKeys`
147
+ * so the `AnimationGroup` can size its own composite buffer the same way.
148
+ */
149
+ private _stableKeys;
150
+ /**
151
+ * The consumer's EXPLICIT constructor options (NOT merged with defaults) —
152
+ * retained so `fromString` can layer a parsed style-rule `animation`
153
+ * shorthand UNDER them (constructor-explicit wins over parsed-from-CSS, F.W8).
154
+ */
155
+ protected _ctorOptions: Partial<InputAnimationOptions>;
156
+ /** The compile-stable union of this animation's interpolated keys. */
157
+ get flatKeys(): readonly string[];
158
+ /**
159
+ * The instance's ONE default DOM-style renderer, allocated once.
160
+ * "Did the consumer supply a custom transform?" is a reference
161
+ * comparison against this single value ({@link usesDefaultRenderer}) —
162
+ * typed and bind-proof, unlike a Symbol tag on a closure, which
163
+ * `Function.prototype.bind` silently drops.
49
164
  */
50
- private _boundDraw;
165
+ protected readonly _defaultTransform: TransformFunction<V>;
166
+ /** True when `fn` is this instance's default DOM-style renderer. */
167
+ usesDefaultRenderer(fn: TransformFunction<V> | undefined): boolean;
51
168
  private dispatchAnimationEvent;
52
169
  constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
53
- convertFrameStart(frame: TemplateAnimationFrame<V>): TemplateAnimationFrame<V>;
54
- addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: TimingFunction | TimingFunctionNames): Animation_2<K>;
55
- createFrame(startIx: number, endIx: number): AnimationFrame<V>;
170
+ get templateFrames(): TemplateAnimationFrame<V>[];
171
+ set templateFrames(value: TemplateAnimationFrame<V>[]);
172
+ get parsedVars(): ParsedVarMap[];
173
+ get frames(): AnimationFrame<V>[];
174
+ get frameId(): number;
175
+ /** Append a template frame (delegated to the compiler). Chainable. */
176
+ addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"]): Animation_2<K>;
177
+ /** Compile the template frames into the sampled `frames[]`. Chainable. */
178
+ parse(): this;
56
179
  /**
57
- * Build an index mapping each variable name to the frame indices where
58
- * it appears. Used by reconcileVars() for O(1) "next occurrence" lookups
59
- * instead of O(N) findIndex scans per variable.
180
+ * Adopt another animation's ALREADY-COMPILED state as ONE atomic motion
181
+ * (G.W19) — the first-class verb for the "single-compile, then transplant"
182
+ * pattern (E.W8 S0): a throwaway animation is built + compiled ONCE off the
183
+ * new keyframes, and the live animation adopts that compiled state without a
184
+ * second compile.
185
+ *
186
+ * The transplant moves the `{ compiler, options, unflatten }` triad together
187
+ * and re-binds the live-options reference BY CONSTRUCTION — `this.options` is
188
+ * read OFF the adopted compiler, so `this.options === this.compiler.options`
189
+ * holds without relying on the caller's assignment order. This is the
190
+ * invariant the demo formerly held by a comment + three ordered field writes;
191
+ * here it is the method's contract, enforced by `proof:adopt-compiled`. A
192
+ * `compiler` adopted WITHOUT re-binding `options` would leave the setters
193
+ * mutating one object while the compiler reads another — the exact desync
194
+ * the `6e29236` live-options lock guards against.
195
+ *
196
+ * Recomputes `_stableKeys` so `flatKeys` (the buffer-sizing contract)
197
+ * reflects the adopted compiled frames, not the pre-adopt key-set. Chainable.
198
+ *
199
+ * @param source an animation whose `compiler` is already compiled.
60
200
  */
61
- private buildVarIndex;
201
+ adoptCompiled(source: Animation_2<V>): this;
62
202
  /**
63
- * Reconcile interpolation variables across non-adjacent keyframes.
64
- * For each variable at frame `ix`, find the next frame that also
65
- * defines that variable and create an interpolation segment between them.
203
+ * Recompute `_stableKeys` — the union of every compiled frame's `flatVars`
204
+ * keys — after a (re)compile. The maximal key-set the `clearBuffer`
205
+ * null-fill resets, so a reused interpolation buffer stays in V8
206
+ * fast-properties mode without ever calling `delete` (F.W4 S1).
207
+ */
208
+ private computeStableKeys;
209
+ /**
210
+ * Option setters — the fail-explicit contract.
66
211
  *
67
- * Uses a pre-built variable index (from buildVarIndex) to avoid
68
- * O(frames²) findIndex scans.
212
+ * Genuine omission (`undefined`/`null`) means "use the default" and is
213
+ * always accepted; present-but-malformed input THROWS a typed
214
+ * `AnimationOptionError` naming the option and the offending value.
215
+ * This is the same posture the layer API chose ("silent no-ops were
216
+ * hiding consumer bugs") applied to the whole options surface — no
217
+ * silent fallback, no silently-preserved previous value.
69
218
  */
70
- reconcileVars(ix: number, varIndex: Map<string, number[]>): void;
71
- parse(): this;
72
219
  setTimingFunction(timingFunction: InputAnimationOptions["timingFunction"]): this;
73
220
  setIterationCount(iterationCount: InputAnimationOptions["iterationCount"]): this;
74
221
  setDuration(duration: InputAnimationOptions["duration"]): this;
@@ -83,6 +230,17 @@ declare class Animation_2<V extends Vars = any> {
83
230
  reverse(): this;
84
231
  fillForwards(): void;
85
232
  fillBackwards(): void;
233
+ /**
234
+ * Where the playhead rests after a completed play — derived ONCE from
235
+ * `fillMode` (forwards/both → final; none/backwards → initial). This is
236
+ * the explicit rest-position contract: completion paints the rest frame
237
+ * per this derivation, and the reduced-motion snap is "rest = final,
238
+ * paint it, settle" — the same path a `fillMode: forwards` completion
239
+ * takes, not a separate code path.
240
+ */
241
+ get restPosition(): "initial" | "final";
242
+ /** Paint the rest frame per the fill contract. */
243
+ paintRest(): void;
86
244
  /**
87
245
  * Stateless progress query. Maps [0,1] from first keyframe to last,
88
246
  * regardless of playback direction. `apply=true` invokes transform callbacks.
@@ -104,37 +262,128 @@ declare class Animation_2<V extends Vars = any> {
104
262
  * zero-allocation steady-state playback.
105
263
  * @returns Merged flat vars from all active frames
106
264
  */
107
- interpFrames(t: number, transformFrames?: boolean, out?: Record<string, ValueUnit[]>): Record<string, ValueUnit<any, string>[]>;
265
+ interpFrames(t: number, transformFrames?: boolean, out?: Record<string, ValueUnit[]>): Record<string, ValueUnit[]>;
266
+ /**
267
+ * Clear a reused interpolation buffer to a stale-free state WITHOUT
268
+ * `delete` — the V8-correct stable-key null-fill (F.W4 S1). The key-set is
269
+ * compile-stable (`_stableKeys` is the union of every frame's `flatVars`
270
+ * keys, fixed at `parse`), so null-filling it keeps the buffer in
271
+ * fast-properties mode AND zero-alloc. Inactive keys read back `undefined`;
272
+ * every consumer of a reused buffer (the group blend, the unused play-loop
273
+ * `_interpOut`) skips them — only the standalone return path (which never
274
+ * reuses a buffer) must be `undefined`-free, and it takes the alias / fresh
275
+ * merge above.
276
+ */
277
+ private clearBuffer;
278
+ /**
279
+ * Interpolate ONE active frame at time `t` in place (lerp + optional
280
+ * transform). Lifted off the `interpFrames` hot loop so playback allocates
281
+ * no per-frame closure. A zero-width frame (`start === stop`, a degenerate
282
+ * keyframe pair) snaps to the endpoint instead of dividing by zero in
283
+ * `scale` (E-RT-5). The merge into the result buffer is done by the caller
284
+ * (F.W4 S3 — so the single-frame path can alias `flatVars` with no copy).
285
+ */
286
+ private processFrame;
108
287
  onStart(): Promise<void>;
109
288
  onEnd(): Promise<void>;
110
- tick(t: number): Promise<number>;
111
- draw(t: number): Promise<void>;
112
- /** Internal rAF-based play loop. */
289
+ /**
290
+ * Advance the playhead to absolute clock `t` (a rAF timestamp, NOT a
291
+ * delta). Lazily runs `onStart` on the first call, reconciles the
292
+ * pause/resume clock, and ends the iteration once `t` reaches the
293
+ * duration. This is the DRIVER-layer advance — the one meaning of the
294
+ * absolute-clock step, distinct from the `tickDt(dt)` stepper surface
295
+ * the rest of the engine canonicalized to.
296
+ */
297
+ advanceTo(t: number): Promise<number>;
298
+ /**
299
+ * One frame of the standalone rAF play path, driven by the shared
300
+ * `RAFPlayback.loop`. Returns whether the loop should continue.
301
+ */
302
+ private _frame;
303
+ private _resolvePlay;
304
+ /** Internal rAF-based play loop — loop ownership rides `this.playback`. */
113
305
  private _playRAF;
114
306
  /**
115
307
  * Play via the Web Animations API. WAAPI handles visuals on the
116
- * compositor thread; a shadow rAF loop in `playWAAPI` drives
117
- * `tick()` so events, iteration count, pause/resume, and other
118
- * lifecycle state stay coherent with the rAF path.
308
+ * compositor thread; a shadow loop in `playWAAPI` (riding
309
+ * `this.playback`) drives `advanceTo()` so events, iteration count,
310
+ * pause/resume, and other lifecycle state stay coherent with the
311
+ * rAF path.
119
312
  *
120
313
  * No silent fallback — eligibility is decided once in `play()`
121
314
  * before this is invoked, and runtime errors propagate.
122
315
  */
123
316
  private _playWAAPI;
124
317
  /**
125
- * `prefers-reduced-motion` snap: jump to the final frame in a single
126
- * paint — no rAF/WAAPI loop. The lifecycle stays observable
127
- * (`animationstart` → fill final → `animationend`) so consumers' event
128
- * wiring is identical to a completed normal play.
318
+ * Cancel the live WAAPI compositor animations (if any). Cancelling
319
+ * rejects each `wa.finished`, which `playWAAPI` catches as a halt — so
320
+ * this both stops the compositor paint AND unblocks the awaited play
321
+ * promise. No-op on the rAF path.
322
+ */
323
+ private _cancelWAAPI;
324
+ /**
325
+ * `prefers-reduced-motion` snap: rest = final, paint it, settle — the
326
+ * SAME terminal path a `fillMode: forwards` completion takes, with the
327
+ * motion elided. The lifecycle stays observable (`animationstart` →
328
+ * final paint → `animationend`) so consumers' event wiring is identical
329
+ * to a completed normal play.
129
330
  */
130
331
  private _playReducedMotion;
332
+ /**
333
+ * Mid-flight reduced-motion snap (D-LIB-3). A running rAF loop detected a
334
+ * live flip to `reduce`; converge to the rest frame and resolve the
335
+ * in-flight `play()` exactly as a forwards completion would. Distinct from
336
+ * `_playReducedMotion` (the up-front gate) only in that `animationstart`
337
+ * already fired — so here we paint final, mark done, end, settle, and
338
+ * release the awaiter. The WAAPI lane snaps via the same path: the up-front
339
+ * gate already routes reduced-motion away from WAAPI, and a live flip on a
340
+ * WAAPI animation cancels the compositor handles before settling.
341
+ */
342
+ private _snapToReducedMotion;
343
+ /**
344
+ * The completion front-door (G.W13) — `await anim.finished` resolves once
345
+ * the in-flight play settles. It exposes the ONE held `_playingPromise`
346
+ * `play()` already constructs (the re-entrant guard returns it; the
347
+ * `finally`-clear nulls it on settle) — NOT a second completion lifecycle.
348
+ * Two reads mid-play return the SAME promise. A settled (or never-played)
349
+ * animation reads `null` and resolves immediately: "not running" = "nothing
350
+ * to await" — the honest semantics for a getter that reports current
351
+ * settledness, not a pre-armed future run.
352
+ */
353
+ get finished(): Promise<void>;
131
354
  play(): Promise<void>;
132
- pause(draw?: boolean): this;
355
+ /**
356
+ * Pause playback — idempotent. Pausing an already-paused (or
357
+ * not-yet-started) animation is a no-op, never a resume: a method named
358
+ * `pause` pauses. Use {@link resume} for the explicit resume.
359
+ */
360
+ pause(): this;
133
361
  resume(): this;
362
+ /** The explicit flip: pauses if playing, resumes if paused. */
363
+ toggle(): this;
364
+ /**
365
+ * Halt playback where it stands: cancel the loop AND the WAAPI
366
+ * compositor animations, settle state, and resolve any pending `play()`
367
+ * promise. Never paints — `reset()` is the explicit rewind.
368
+ */
134
369
  stop(): void;
135
370
  playing(): boolean;
136
371
  /** Returns the effective time accounting for direction reversal. */
137
372
  get effectiveT(): number;
373
+ /**
374
+ * Pure state teardown — flags, clocks, iteration. NEVER paints. This is
375
+ * the terminal half of the rest-position contract: completion paints
376
+ * the rest frame (via `onEnd` → `paintRest`) and then settles; the
377
+ * reduced-motion snap paints final and then settles. Settling is
378
+ * orthogonal to where the pixels rest.
379
+ */
380
+ settle(): this;
381
+ /**
382
+ * Explicit rewind: paint the INITIAL frame, then settle. This is the
383
+ * user-facing "return to start" — rest position `initial`, painted
384
+ * deliberately — distinct from `settle()`, which tears down state and
385
+ * leaves the pixels where they rest.
386
+ */
138
387
  reset(): this;
139
388
  setTargets(...targets: HTMLElement[]): this;
140
389
  group(...animations: Animation_2<V>[]): AnimationGroup<V>;
@@ -156,6 +405,21 @@ export declare interface AnimationEngine {
156
405
  getAnimationId: (animation: Animation_2 | string) => string;
157
406
  getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
158
407
  resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
408
+ /** The single-call front door — dispatch + auto-target + auto-play. */
409
+ animate: typeof animate;
410
+ /** CSS-native MotionPath (F.W12) — offset-distance over an author offset-path. */
411
+ MotionPath: typeof MotionPath;
412
+ fromMotionPath: typeof fromMotionPath;
413
+ /** CSS-native DrawSVG (G.W13) — stroke-dashoffset sweep over the path length. */
414
+ DrawSVG: typeof DrawSVG;
415
+ fromDrawSVG: typeof fromDrawSVG;
416
+ /**
417
+ * The preset library (`fadeIn`, `bounce`, `shake`, …) — heavy (each returns
418
+ * a `CSSKeyframesAnimation`), so it rides the dynamic boundary as a namespace
419
+ * instead of the light static barrel: `const { presets } = await
420
+ * loadAnimationEngine(); presets.fadeIn({ duration: 500 })` (F.W11).
421
+ */
422
+ presets: typeof AnimationPresets;
159
423
  DIRECTIONS: readonly AnimationOptions["direction"][];
160
424
  FILL_MODES: readonly AnimationOptions["fillMode"][];
161
425
  defaultOptions: AnimationOptions;
@@ -185,7 +449,7 @@ export declare interface AnimationFrame<V extends Vars> {
185
449
  */
186
450
  allInterpVars: Array<InterpolatedVar<V>>;
187
451
  transform: TransformFunction<V>;
188
- timingFunction: TimingFunction;
452
+ timingFunction: Easing;
189
453
  }
190
454
 
191
455
  export declare class AnimationGroup<V extends Vars> {
@@ -202,7 +466,7 @@ export declare class AnimationGroup<V extends Vars> {
202
466
  */
203
467
  respectReducedMotion: boolean;
204
468
  /**
205
- * Children-per-slice before `tick()` yields to the main thread. Groups at
469
+ * Children-per-slice before `advanceTo()` yields to the main thread. Groups at
206
470
  * or under this size tick in one slice (fast path); larger groups tick in
207
471
  * batches with a `scheduler.yield()` between them so a big per-frame
208
472
  * composite doesn't run as one long task (INP relief).
@@ -210,19 +474,38 @@ export declare class AnimationGroup<V extends Vars> {
210
474
  static readonly YIELD_BATCH = 32;
211
475
  singleTarget: boolean;
212
476
  lastTickTime: number;
213
- handleId: number | any;
477
+ /** THE rAF owner for the group's draw loop. */
478
+ readonly playback: RAFPlayback;
214
479
  resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
480
+ private _playingPromise;
215
481
  /**
216
- * Pre-bound draw callback — allocated once in constructor to avoid
217
- * creating a new closure on every requestAnimationFrame reschedule.
482
+ * Pre-bound frame callback — allocated once in constructor to avoid
483
+ * creating a new closure on every playback loop start.
218
484
  */
219
- private _boundDraw;
485
+ private _boundFrame;
220
486
  /**
221
487
  * Cached entries array, sorted by layer zIndex. Rebuilt on demand
222
488
  * via dirty flag to avoid Object.values() allocation on every frame.
223
489
  */
224
490
  private _entries;
225
491
  private _entriesDirty;
492
+ /**
493
+ * Long-lived composite buffer, cleared in place at the top of
494
+ * `transformFramesGrouped` (the same zero-alloc idiom `interpFrames`'s
495
+ * `out` buffer already uses). With it the compositor honours the class's
496
+ * own zero-alloc discipline — no fresh `groupedValues` object, and no
497
+ * per-layer `filteredValues` object, allocated per frame.
498
+ */
499
+ private _grouped;
500
+ /**
501
+ * The compile-stable union of every child's contributed (whitelist-filtered)
502
+ * keys — what `_grouped` is null-filled to each frame so the composite is
503
+ * cleared WITHOUT `delete` (F.W4 S2: the delete-loop trapped `_grouped` in
504
+ * V8 dictionary mode). Recomputed only when the entry set / a layer
505
+ * whitelist changes (via `invalidateEntries`); stable across frames.
506
+ */
507
+ private _groupedKeys;
508
+ private _groupedKeysDirty;
226
509
  constructor(...inputs: (Animation_2<V> | AnimationGroupInput<V>)[]);
227
510
  /**
228
511
  * Returns the animation entries sorted by layer zIndex.
@@ -233,6 +516,16 @@ export declare class AnimationGroup<V extends Vars> {
233
516
  private getEntries;
234
517
  /** Mark entries cache stale. Called at all mutation boundaries. */
235
518
  private invalidateEntries;
519
+ /**
520
+ * Recompute `_groupedKeys` — the union of each child's contributed keys
521
+ * (whitelist-filtered when the layer carries one). The maximal key-set the
522
+ * `transformFramesGrouped` null-fill clears, so the composite buffer stays
523
+ * in V8 fast-properties mode without `delete` (F.W4 S2). Children are parsed
524
+ * (their `flatKeys` populated) before the first composite — the group only
525
+ * blends during play, after child setup — and any later structural change
526
+ * re-dirties through `invalidateEntries`.
527
+ */
528
+ private computeGroupedKeys;
236
529
  setSuperKey(superKey: string): this;
237
530
  setTargets(...targets: HTMLElement[]): this;
238
531
  onStart(): this;
@@ -268,53 +561,91 @@ export declare class AnimationGroup<V extends Vars> {
268
561
  */
269
562
  setChildTime(nameOrAnim: string | Animation_2<V>, t: number): this;
270
563
  /**
271
- * Advance all child animations to timestamp `t`.
272
- * Awaits all child tick() promises so deferred state updates
564
+ * Advance all child animations to absolute clock `t`.
565
+ * Awaits all child advanceTo() promises so deferred state updates
273
566
  * (startTime, this.t) resolve before interpFrames reads them.
274
567
  */
275
- tick(t: number): Promise<this>;
276
- /** Advance one slice of children to timestamp `t`, awaiting their ticks together. */
277
- private _tickSlice;
568
+ advanceTo(t: number): Promise<this>;
569
+ /** Advance one slice of children to absolute clock `t`, awaiting them together. */
570
+ private _advanceSlice;
278
571
  /**
279
- * Main animation frame callback. Ticks all children, then renders
572
+ * One frame of the group's draw loop, driven by the shared
573
+ * `RAFPlayback.loop`. Ticks all children, then renders
280
574
  * (single-target: grouped blending; multi-target: per-child).
281
- * Reschedules itself via rAF until done.
575
+ * Returns whether the loop should continue.
282
576
  */
283
- draw(t: number): Promise<void>;
577
+ private _frame;
578
+ private _resolvePlay;
284
579
  /**
285
580
  * Start the animation group. Returns a promise that resolves
286
581
  * when all child animations complete (or on explicit stop/reset).
582
+ * Re-entrant: a `play()` while one is in flight returns the same
583
+ * promise rather than leaking a second draw loop.
287
584
  *
288
585
  * Under `respectReducedMotion` + an active `prefers-reduced-motion`
289
586
  * query, snaps every child to its final frame in a single composite —
290
587
  * no rAF draw loop — then settles exactly as a completed play would.
291
588
  */
292
- play(): Promise<unknown>;
293
589
  /**
294
- * `prefers-reduced-motion` snap for the group: advance every child to its
295
- * final frame, composite a single paint, then settle child + group state
296
- * for replay — no rAF loop, no motion. The final frame STAYS on the
297
- * target(s): reduced motion shows the END state, matching
590
+ * The completion front-door (G.W13) — `await group.finished` resolves once
591
+ * the in-flight composite play settles. Exposes the ONE held
592
+ * `_playingPromise` `play()` constructs (the re-entrant guard returns it;
593
+ * the `finally`-clear nulls it on settle) — NOT a second completion
594
+ * lifecycle. A settled (or never-played) group resolves immediately.
595
+ */
596
+ get finished(): Promise<void>;
597
+ play(): Promise<void>;
598
+ /**
599
+ * `prefers-reduced-motion` snap for the group: rest = final, paint it,
600
+ * settle — the SAME terminal path a completed play takes, with the
601
+ * motion elided. Every child advances to its final frame, one composite
602
+ * paints, and `settle()` (pure teardown, never a repaint) readies the
603
+ * group for replay. The final frame stays on the target(s), matching
298
604
  * `Animation._playReducedMotion`.
299
- *
300
- * Deliberately does NOT route through `reset()` — `reset()` repaints every
301
- * child to frame 0 (`interpFrames(0, true)`, the fillBackwards
302
- * cube-cutoff workaround), which would clobber the snapped final frame and
303
- * leave, e.g., a `fadeIn` group invisible. The child `Animation.reset()`
304
- * clears state flags only and does not repaint, so it is safe here.
305
605
  */
306
606
  private _playReducedMotion;
307
607
  /**
308
- * Toggle pause state. Calling pause() when playing pauses; calling
309
- * pause() when paused resumes. (Toggle semantics preserved for
310
- * backward compatibility with demo's toggleAnimationGroup.)
608
+ * Pause the group — idempotent. Pausing an already-paused (or
609
+ * not-yet-started) group is a no-op, NOT a resume. Mirrors
610
+ * `Animation.pause`: a method named `pause` pauses, never secretly
611
+ * resumes. Use {@link toggle} for the explicit flip, {@link resume}
612
+ * for the explicit resume.
311
613
  *
312
- * On pause: explicitly cancels the rAF loop and renders a final
313
- * frame snapshot so the visual matches the exact pause moment.
314
- * On resume: re-registers the rAF loop.
614
+ * Cancels the rAF loop immediately (don't wait for the frame callback to
615
+ * self-terminate) and renders a final-frame snapshot so the visual
616
+ * matches the exact pause moment.
315
617
  */
316
618
  pause(): this;
619
+ /**
620
+ * Resume the group — idempotent. Resuming a running (or not-yet-started)
621
+ * group is a no-op. Unpauses every child DIRECTLY (not via
622
+ * `child.resume()`, which would start each child's own rAF loop) — the
623
+ * group's draw loop owns the ticking — and re-registers that loop.
624
+ */
625
+ resume(): this;
626
+ /** The explicit flip: pauses if playing, resumes if paused. */
627
+ toggle(): this;
628
+ /**
629
+ * Pure state teardown — never paints. The group analogue of
630
+ * `Animation.settle()`: releases every child (`managed = false`,
631
+ * `child.settle()`) and clears the group's own playback flags.
632
+ * Completion and the reduced-motion snap both end here, leaving the
633
+ * rest frame (per each child's fill contract) on the target(s).
634
+ */
635
+ settle(): this;
636
+ /**
637
+ * Explicit rewind: paint every started child back to its INITIAL
638
+ * frame, then settle. This is the user-facing "return to start" —
639
+ * rest position `initial` painted deliberately, not a completion side
640
+ * effect. (Completion does NOT come here; it settles where the fill
641
+ * contract rested the pixels.)
642
+ */
317
643
  reset(): this;
644
+ /**
645
+ * Halt the draw loop, rewind to the initial frame (the transport-stop
646
+ * semantic the demo's controls expect), and resolve any pending
647
+ * `play()` promise.
648
+ */
318
649
  stop(): this;
319
650
  playing(): boolean;
320
651
  forcePause(): void;
@@ -352,7 +683,12 @@ export declare interface AnimationLayerConfig {
352
683
  zIndex: number;
353
684
  /** 0–1 for 'weighted' blend mode. Default: 1 */
354
685
  weight: number;
355
- /** Default: 'replace' (backward compat) */
686
+ /**
687
+ * Default: 'replace'. Defaulting on a genuinely-omitted blend mode is
688
+ * the sanctioned contract (the fail-explicit seam throws only on
689
+ * malformed PRESENT input, never on omission) — an unspecified layer
690
+ * blends by replacement, the least-surprising composite.
691
+ */
356
692
  blendMode: BlendMode;
357
693
  /** Layer toggle. Default: true */
358
694
  enabled: boolean;
@@ -360,13 +696,33 @@ export declare interface AnimationLayerConfig {
360
696
  properties?: Set<string>;
361
697
  }
362
698
 
699
+ /**
700
+ * Typed option-validation errors — the fail-explicit seam.
701
+ *
702
+ * The engine's option setters and the light engines' easing inputs THROW on
703
+ * malformed input rather than silently defaulting or no-oping — the posture
704
+ * the layer API already chose ("silent no-ops were hiding consumer bugs",
705
+ * `group.ts` setLayerConfig). Defaulting happens only for genuine
706
+ * `undefined`: an omitted option means "use the default"; a
707
+ * present-but-malformed option is a consumer bug and surfaces as one of
708
+ * these.
709
+ *
710
+ * Value.js-free: light modules import these without touching the boundary.
711
+ */
712
+ /** Thrown when an animation option receives malformed (non-undefined) input. */
713
+ export declare class AnimationOptionError extends Error {
714
+ readonly option: string;
715
+ readonly value: unknown;
716
+ constructor(option: string, value: unknown, reason: string);
717
+ }
718
+
363
719
  export declare type AnimationOptions = {
364
720
  duration: number;
365
721
  delay: number;
366
722
  iterationCount: number;
367
723
  direction: (typeof DIRECTIONS)[number];
368
724
  fillMode: (typeof FILL_MODES)[number];
369
- timingFunction: TimingFunction;
725
+ timingFunction: Easing;
370
726
  useWAAPI: boolean;
371
727
  /**
372
728
  * When true, honor `prefers-reduced-motion: reduce` by snapping the
@@ -379,10 +735,106 @@ export declare type AnimationOptions = {
379
735
  hueMethod?: HueInterpolationMethod;
380
736
  };
381
737
 
738
+ declare namespace AnimationPresets {
739
+ export {
740
+ fadeIn,
741
+ fadeOut,
742
+ pulse,
743
+ shake,
744
+ bounce,
745
+ flip_2 as flip,
746
+ rotateIn,
747
+ slideIn,
748
+ heartbeat,
749
+ glow,
750
+ typewriter,
751
+ rainbowText,
752
+ warpLeft,
753
+ warpRight,
754
+ blurIn,
755
+ blurOut,
756
+ blurInOut,
757
+ progressBar,
758
+ skeletonLoading,
759
+ textFocusBlur,
760
+ gradientBackground,
761
+ rotateScale,
762
+ typingCursor,
763
+ accordionExpand,
764
+ notificationBounce,
765
+ spinner,
766
+ parallaxScroll,
767
+ slideInLeftKeyframes,
768
+ slideInLeft,
769
+ slideOutLeft,
770
+ slideInRightKeyframes,
771
+ slideInRight,
772
+ slideOutRight,
773
+ hover,
774
+ jumpUp,
775
+ jumpDown,
776
+ springScaleIn,
777
+ springSlideIn,
778
+ springPop,
779
+ springWobble,
780
+ enterPresets,
781
+ exitPresets,
782
+ attentionPresets,
783
+ loopPresets,
784
+ presetTaxonomy
785
+ }
786
+ }
787
+
788
+ /** Attention animations — a one-shot nudge to draw the eye. */
789
+ declare const attentionPresets: {
790
+ readonly pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
791
+ readonly shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
792
+ readonly bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
793
+ readonly flip: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
794
+ readonly notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
795
+ readonly springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
796
+ readonly springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
797
+ };
798
+
382
799
  export declare type BlendMode = "replace" | "add" | "weighted";
383
800
 
801
+ declare const blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
802
+
803
+ declare const blurInOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
804
+
805
+ declare const blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
806
+
807
+ declare const bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
808
+
809
+ /**
810
+ * Feature-detect (`"ScrollTimeline" in window` / `"ViewTimeline" in window`)
811
+ * and construct a NATIVE `AnimationTimeline` for the additive WAAPI scroll
812
+ * bridge (D-LIB-2 / F-5). Returns `null` where the platform lacks the API
813
+ * (Firefox today, SSR, jsdom) — the caller then keeps the JS {@link Timeline}
814
+ * sampler, which is the proven fallback AND the only general driver over
815
+ * non-DOM targets.
816
+ *
817
+ * CRITICAL — the ARCH-kill HOLDS: this does NOT replace the JS sampler. Native
818
+ * scroll-driven is Chromium-only / not-Baseline, and the JS `Timeline` is a
819
+ * strictly more general caller-polled sampler (it also applies `SmoothProgress`
820
+ * smoothing + boundary snap the native `animation-range` path has none of). The
821
+ * bridge is a pure additive fast lane where supported + eligible. No polyfill.
822
+ *
823
+ * Light: a runtime `in`-detect over the `window` globals — zero static
824
+ * value.js / engine edge, so importing this keeps `timeline.ts` light.
825
+ */
826
+ export declare function createNativeTimeline(spec: NativeTimelineSpec): AnimationTimeline | null;
827
+
384
828
  export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V> {
385
829
  constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
830
+ /**
831
+ * One transform-resolution seam for the three `from*` entry points:
832
+ * a supplied transform is the consumer's renderer (vars arrive
833
+ * unflattened); genuine omission resolves to the instance's ONE
834
+ * default DOM-style renderer, which keeps WAAPI eligibility a
835
+ * reference comparison (`usesDefaultRenderer`).
836
+ */
837
+ private resolveTransform;
386
838
  fromVars(vars: V[], transform?: TransformFunction<V>): this;
387
839
  fromKeyframes(keyframes: Map<string, Partial<V>> | Record<string, Partial<V>>, transform?: TransformFunction<V>): this;
388
840
  /**
@@ -394,11 +846,299 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V
394
846
  */
395
847
  propertyRegistry: Map<string, PropertyDescriptor_2>;
396
848
  fromString(keyframes: string, transform?: TransformFunction<V>): this;
849
+ /**
850
+ * Register every parsed `@property` descriptor with the UA via
851
+ * `CSS.registerProperty` (D-LIB-1) — one guarded pass at the end of
852
+ * `fromString`. Feature-detected (`CSS.registerProperty` may be absent:
853
+ * SSR, jsdom, older engines) so it no-ops to today's behaviour where
854
+ * unsupported. A duplicate-name re-registration throws a benign
855
+ * `InvalidModificationError` (the global registry is process-wide and
856
+ * idempotent for a given name) — swallowed per-descriptor so one already-
857
+ * registered name never aborts the rest of the pass.
858
+ *
859
+ * Baseline 2024-07-09 (newly available — feature-detect mandatory).
860
+ */
861
+ private registerProperties;
397
862
  transform(vars: V): void;
398
863
  }
399
864
 
865
+ /**
866
+ * The closed-form frictional glide. Given a release `velocity` `v0`, an
867
+ * `initial` position `x0`, and a `friction` `k`, returns a pure sampler
868
+ * `(t) => { value, velocity }` evaluating
869
+ *
870
+ * x(t) = x0 + (v0 / k)·(1 − e^(−k·t))
871
+ * v(t) = v0·e^(−k·t)
872
+ *
873
+ * at any elapsed time `t` in SECONDS — the spring's native clock. `t ≤ 0`
874
+ * yields the seed state `(x0, v0)`. Allocation-free per call (one closure
875
+ * captured once); the returned function does no further allocation.
876
+ *
877
+ * @throws if `friction <= 0` — a non-positive coefficient has no finite
878
+ * resting point and is a programmer error, surfaced explicitly.
879
+ */
880
+ export declare function decay(options: DecayOptions): (t: number) => DecaySample;
881
+
882
+ /**
883
+ * Frictional decay (inertial glide) — the one-line closed-form sibling of
884
+ * the spring solver, for the fling/flick case where there is no target to
885
+ * settle to, only an initial velocity bleeding off under friction.
886
+ *
887
+ * The model is a first-order velocity-proportional drag, `v'(t) = −k·v(t)`,
888
+ * whose closed-form position is
889
+ *
890
+ * x(t) = x0 + (v0 / k)·(1 − e^(−k·t))
891
+ *
892
+ * with velocity `v(t) = v0·e^(−k·t)`. As `t → ∞` the glide asymptotes to a
893
+ * finite resting point `x0 + v0/k` (the projected endpoint a release would
894
+ * coast to). Larger `k` → more friction → shorter glide.
895
+ *
896
+ * LIGHT module: zero static `@mkbabb/value.js` edge. Pure math — no rAF, no
897
+ * DOM, no allocation in the hot path. A richer canonical closed form is the
898
+ * value.js hand-off VJ-1; `decay` ships keyframes-local today and collapses
899
+ * to a thin caller once value.js publishes the canonical surface.
900
+ */
901
+ /** Inputs to the {@link decay} frictional-glide closed form. */
902
+ export declare interface DecayOptions {
903
+ /** Starting position. Default 0. */
904
+ initial?: number;
905
+ /** Release velocity (units/s) — the flick speed handed off at release. */
906
+ velocity: number;
907
+ /**
908
+ * Friction coefficient (1/s). Strictly positive — larger means more
909
+ * drag and a shorter glide. Default 5.
910
+ */
911
+ friction?: number;
912
+ }
913
+
914
+ /**
915
+ * The asymptotic resting point of a glide — the position a release of
916
+ * `velocity` from `initial` under `friction` coasts to as `t → ∞`
917
+ * (`x0 + v0/k`). The projected endpoint, useful for snap-to-target /
918
+ * paginated-fling decisions without running the loop.
919
+ *
920
+ * @throws if `friction <= 0` (see {@link decay}).
921
+ */
922
+ export declare function decayRest(options: DecayOptions): number;
923
+
924
+ /** A sampled point on a decay glide: position + velocity at time `t`. */
925
+ export declare interface DecaySample {
926
+ /** Position `x(t) = x0 + v0/k·(1 − e^(−k·t))`. */
927
+ value: number;
928
+ /** Velocity `v(t) = v0·e^(−k·t)`. */
929
+ velocity: number;
930
+ }
931
+
400
932
  declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
401
933
 
934
+ /**
935
+ * Functional sugar over {@link Draggable}: construct, `attach(element)`,
936
+ * and return the instance — the one-call front door for the common case.
937
+ * The returned `Draggable` exposes `.spring` (for `.play()` / fling-loop
938
+ * ownership), `.subscribe()`, `.value`/`.velocity`/`.settled`, and
939
+ * `.detach()`/`.dispose()`.
940
+ */
941
+ export declare function drag(element: HTMLElement, options?: DragOptions): Draggable;
942
+
943
+ /**
944
+ * The single scalar axis a {@link Draggable} tracks. A 2-D drag composes
945
+ * two `Draggable`s (one per axis) — the engine stays one-dimensional, the
946
+ * caller owns the composition (KISS).
947
+ */
948
+ export declare type DragAxis = "x" | "y";
949
+
950
+ /**
951
+ * A one-axis draggable: pointer-capture follow + release-velocity fling
952
+ * over a `SpringProgress`. The hard physics (a continuous analytic
953
+ * trajectory seeded from the release velocity) is the spring's; this class
954
+ * is the pointer-event plumbing that feeds it.
955
+ *
956
+ * Lifecycle: `attach(element)` binds `pointerdown`; a down captures the
957
+ * pointer and binds `pointermove`/`pointerup` for the gesture's duration;
958
+ * `up` re-seats the spring from `(value, releaseVelocity)` and lets it
959
+ * fling. `detach()` removes every listener and releases capture. The
960
+ * underlying spring is reachable via `.spring` for `.play()` /
961
+ * `.subscribe()` / fling-loop ownership.
962
+ */
963
+ export declare class Draggable {
964
+ /** The spring the drag follows + flings — the physics core. */
965
+ readonly spring: SpringProgress;
966
+ private readonly axis;
967
+ private readonly transform;
968
+ private readonly velocityWindow;
969
+ private element;
970
+ private capturedPointerId;
971
+ /** Rolling pointer samples for release-velocity estimation. */
972
+ private samples;
973
+ private subscribers;
974
+ private springUnsub;
975
+ private readonly onPointerDown;
976
+ private readonly onPointerMove;
977
+ private readonly onPointerUp;
978
+ constructor(options?: DragOptions);
979
+ /** True while a pointer gesture is in progress (down, not yet up). */
980
+ get dragging(): boolean;
981
+ /** Current spring position. */
982
+ get value(): number;
983
+ /** Current spring velocity (units/s). */
984
+ get velocity(): number;
985
+ /** True once the post-release fling has settled. */
986
+ get settled(): boolean;
987
+ /**
988
+ * Bind the drag to `element`. Adds the `pointerdown` listener; the
989
+ * per-gesture `pointermove`/`pointerup` listeners are added on down and
990
+ * removed on up. Idempotent re-attach detaches the previous element
991
+ * first. Returns a detach handle (calling it is equivalent to
992
+ * {@link detach}).
993
+ */
994
+ attach(element: HTMLElement): () => void;
995
+ /**
996
+ * Remove every listener, release any active pointer capture, and end an
997
+ * in-flight gesture. Leaves the spring's current state intact (a fling
998
+ * already in progress continues unless the caller stops it).
999
+ */
1000
+ detach(): void;
1001
+ /**
1002
+ * Subscribe to `(value, velocity)` emissions — both the live drag-
1003
+ * follow and the post-release fling. Returns an unsubscribe handle.
1004
+ * Lazily bridges to the spring's own subscription so the spring stays
1005
+ * the single source of truth.
1006
+ */
1007
+ subscribe(fn: DragSubscriber): () => void;
1008
+ private emit;
1009
+ /**
1010
+ * Tear down: detach listeners + dispose the spring. After `dispose()`
1011
+ * the draggable is inert.
1012
+ */
1013
+ dispose(): void;
1014
+ private coordOf;
1015
+ private handleDown;
1016
+ private handleMove;
1017
+ private handleUp;
1018
+ /**
1019
+ * End the current gesture: release capture + remove the per-gesture
1020
+ * listeners. Idempotent — safe when no gesture is active.
1021
+ */
1022
+ private endGesture;
1023
+ private pushSample;
1024
+ /**
1025
+ * Release velocity = average pointer velocity over the sample window,
1026
+ * in units PER SECOND (the spring's clock). Estimated as `Δvalue / Δt`
1027
+ * across the oldest and newest retained samples — robust to a single
1028
+ * jittery last frame, unlike a two-point last-pair difference. Returns
1029
+ * 0 when there is insufficient motion (a tap, or a held release).
1030
+ */
1031
+ private estimateVelocity;
1032
+ }
1033
+
1034
+ export declare interface DragOptions {
1035
+ /**
1036
+ * Which pointer axis drives the spring target — `clientX` (`"x"`) or
1037
+ * `clientY` (`"y"`). Default `"x"`.
1038
+ */
1039
+ axis?: DragAxis;
1040
+ /**
1041
+ * Map a raw pointer coordinate (px, in client space) to the spring's
1042
+ * value domain. Default identity (track pointer pixels directly). Use
1043
+ * e.g. `(px) => px - originPx` to track an offset, or a scale factor
1044
+ * for a normalized [0, 1] domain.
1045
+ */
1046
+ transform?: (clientCoord: number) => number;
1047
+ /**
1048
+ * The spring the drag drives. Supplies the physics — the fling on
1049
+ * release re-seats THIS spring from `(currentValue, releaseVelocity)`.
1050
+ * Defaults to a fresh `SpringProgress` with the engine defaults.
1051
+ */
1052
+ spring?: SpringProgress;
1053
+ /**
1054
+ * Options for the default spring (ignored when `spring` is supplied).
1055
+ */
1056
+ springOptions?: Partial<SpringProgressOptions>;
1057
+ /**
1058
+ * Velocity-sampling window in milliseconds. The release velocity is the
1059
+ * average pointer velocity over the last `velocityWindow` ms of moves —
1060
+ * a short window tracks flicks, a longer one smooths jitter. Default
1061
+ * 100ms.
1062
+ */
1063
+ velocityWindow?: number;
1064
+ }
1065
+
1066
+ /**
1067
+ * Drag / fling adapter — the INPUT layer over the already-SOTA spring
1068
+ * velocity core. It captures the pointer, tracks the drag as a live
1069
+ * `SpringProgress` target on every `pointermove`, samples the pointer
1070
+ * velocity over a short window, and on release hands that velocity to the
1071
+ * spring's re-seat (`SpringProgress` re-seats the closed-form solution from
1072
+ * `(x, v)` so the fling trajectory is continuous with the gesture).
1073
+ *
1074
+ * LIGHT module: zero static `@mkbabb/value.js` edge. The physics is
1075
+ * keyframes-local (the spring solver); this file is pure input plumbing.
1076
+ *
1077
+ * Framework-free by design — plain `addEventListener` + Pointer Capture
1078
+ * with explicit teardown. This is library code, not a Vue demo: a consumer
1079
+ * wires the returned `value`/`velocity`/`settled` reads (or `subscribe`)
1080
+ * into their own render layer. SSR-safe: construction does not touch the
1081
+ * DOM until `attach()`.
1082
+ */
1083
+ /** A drag emission: the spring's current position + velocity. */
1084
+ export declare type DragSubscriber = (value: number, velocity: number) => void;
1085
+
1086
+ /**
1087
+ * `DrawSVG` — the class form of {@link fromDrawSVG}, for callers who prefer a
1088
+ * named primitive alongside `CSSKeyframesAnimation` / `MotionPath`. Construction
1089
+ * is the factory: `new DrawSVG(target).animation` is the control handle. The
1090
+ * factory is the canonical entry; this is a thin ergonomic wrapper.
1091
+ */
1092
+ declare class DrawSVG<V extends Record<string, any> = any> {
1093
+ /** The underlying stroke-dashoffset animation — the control handle. */
1094
+ readonly animation: CSSKeyframesAnimation<V>;
1095
+ constructor(target: SVGDrawTarget, options?: DrawSVGOptions);
1096
+ /** Start (or re-enter) the line-drawing play loop. */
1097
+ play(): Promise<void>;
1098
+ /** Pause the play loop, retaining the playhead. */
1099
+ pause(): this;
1100
+ /** Halt and rewind the play loop. */
1101
+ stop(): this;
1102
+ /** Resolve once the draw completes — the {@link Animation.finished} front-door. */
1103
+ get finished(): Promise<void>;
1104
+ }
1105
+
1106
+ export declare interface DrawSVGOptions extends Partial<InputAnimationOptions> {
1107
+ /**
1108
+ * Start of the draw sweep — a percent STRING (`"0%"` → `"100%"`) or a 0..1
1109
+ * NUMBER fraction (`0` → `1`), the two unambiguous forms. Default `"0%"` —
1110
+ * the stroke starts undrawn (full `stroke-dashoffset`) and draws IN; `"100%"`
1111
+ * → `"0%"` (or `1` → `0`) erases it. A number outside `[0, 1]` throws (a
1112
+ * percent must be a string — no silent `50`-means-5000% footgun).
1113
+ */
1114
+ from?: string | number;
1115
+ /** End of the draw sweep — same `"100%"`/`1` two-form contract. Default `"100%"`. */
1116
+ to?: string | number;
1117
+ /**
1118
+ * Auto-start the play loop after construction + targeting. Default true.
1119
+ * `false` returns a constructed, targeted, NOT-yet-playing handle so the
1120
+ * caller can drive the returned animation (`.play()` / `.pause()` / `.stop()`).
1121
+ */
1122
+ autoPlay?: boolean;
1123
+ }
1124
+
1125
+ /**
1126
+ * The typed easing value — a callable curve plus, when one exists, the CSS
1127
+ * easing string that reproduces it (e.g. a spring's `linear()` stops).
1128
+ *
1129
+ * Replaces the former Symbol-on-a-closure side channel: the "this closure
1130
+ * has a CSS twin" fact now flows through the type system, so wrapping or
1131
+ * binding the callable can no longer silently drop it. `waapi.ts` reads
1132
+ * `.css` to run the true curve on the compositor; everything else reads
1133
+ * `.fn`.
1134
+ */
1135
+ export declare interface Easing {
1136
+ /** The callable curve — the hot-path interpolation function. */
1137
+ fn: TimingFunction;
1138
+ /** CSS easing string that faithfully reproduces `fn`, when one exists. */
1139
+ css?: string;
1140
+ }
1141
+
402
1142
  /**
403
1143
  * Interpolate position and scale between two elements or rects.
404
1144
  *
@@ -415,14 +1155,6 @@ export declare class ElementMorph {
415
1155
  constructor(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect, options?: ElementMorphOptions);
416
1156
  /** Re-measure source and destination, rebuilding the internal animation. */
417
1157
  measure(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect): this;
418
- /**
419
- * Resolve a pending string easing *name* through the dynamic engine
420
- * boundary. No-op for callable / omitted easing. Stateless `.at()` /
421
- * `.toCSSTransform()` consumers that pass a name can `await .ready()`
422
- * first to interpolate with the resolved easing; `.play()` awaits it
423
- * automatically before the first frame.
424
- */
425
- ready(): Promise<void>;
426
1158
  /** Get raw transform values at the given progress [0, 1]. */
427
1159
  at(progress: number): MorphValues;
428
1160
  /** Get a CSS transform string at the given progress [0, 1]. */
@@ -442,19 +1174,227 @@ export declare class ElementMorph {
442
1174
 
443
1175
  export declare interface ElementMorphOptions {
444
1176
  /**
445
- * Easing as a callable `TimingFunction`, OR a string easing *name*
446
- * from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`, …).
447
- * `ElementMorph` composes `NumericAnimation`, so a callable keeps the
448
- * path value.js-free while a string name resolves LAZILY through the
449
- * dynamic engine boundary on the first `.play()` (or `await .ready()`).
1177
+ * Easing as a callable `TimingFunction` or a typed `Easing` —
1178
+ * synchronous and value.js-free (`ElementMorph` composes
1179
+ * `NumericAnimation`, which enforces the same contract). Resolve a
1180
+ * string name first via `await resolveEasing(name)`.
1181
+ */
1182
+ timingFunction?: TimingFunction | Easing;
1183
+ /** Playback duration in milliseconds. Required for `.play()`. */
1184
+ duration?: number;
1185
+ transformOrigin?: string;
1186
+ }
1187
+
1188
+ /** Entrance animations — bring an element INTO view. */
1189
+ declare const enterPresets: {
1190
+ readonly fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1191
+ readonly slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1192
+ readonly slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1193
+ readonly slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1194
+ readonly rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1195
+ readonly blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1196
+ readonly springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1197
+ readonly springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1198
+ readonly jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1199
+ };
1200
+
1201
+ /** Exit animations — take an element OUT of view. */
1202
+ declare const exitPresets: {
1203
+ readonly fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1204
+ readonly slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1205
+ readonly slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1206
+ readonly blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1207
+ readonly warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1208
+ readonly warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1209
+ readonly jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1210
+ };
1211
+
1212
+ declare const fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1213
+
1214
+ declare const fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1215
+
1216
+ declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
1217
+
1218
+ /**
1219
+ * Animate a layout change on `element`: measure (First), run `mutate` (Last),
1220
+ * measure again, then invert + play the transform between them via
1221
+ * {@link ElementMorph}. Returns the play promise.
1222
+ *
1223
+ * @param element — the element whose layout `mutate` changes.
1224
+ * @param mutate — a synchronous DOM mutation (class toggle, reparent, …).
1225
+ * @param options — `{ duration, timingFunction, transformOrigin }`.
1226
+ */
1227
+ export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): Promise<void>;
1228
+
1229
+ declare const flip_2: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1230
+
1231
+ export declare interface FlipOptions {
1232
+ /** Playback duration in milliseconds. Defaults to `300`. */
1233
+ duration?: number;
1234
+ /**
1235
+ * Easing for the play phase — a callable {@link TimingFunction} or typed
1236
+ * {@link Easing} (e.g. `springTimingFunction(...)` for a springy FLIP).
1237
+ * A string name is rejected; resolve it via `await resolveEasing(name)`.
1238
+ */
1239
+ timingFunction?: TimingFunction | Easing;
1240
+ transformOrigin?: string;
1241
+ }
1242
+
1243
+ /**
1244
+ * Shared-element FLIP: animate element `a` onto the rect of element `b`
1245
+ * (Motion's `layoutId` / GSAP Flip shared-element style). Unlike `flip`, `a`
1246
+ * does NOT move in the DOM — it stays at its own rect (First) and the morph
1247
+ * carries it FORWARD onto `b`'s rect (Last). So this is a plain forward
1248
+ * {@link ElementMorph} play (identity at t=0 → full delta at t=1), not the
1249
+ * inversion `flip` runs.
1250
+ *
1251
+ * The two reads are batched — one forced layout each, before any write.
1252
+ *
1253
+ * @param a — the element to animate.
1254
+ * @param b — the element whose rect `a` morphs onto.
1255
+ * @param options — `{ duration, timingFunction, transformOrigin }`.
1256
+ */
1257
+ export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): Promise<void>;
1258
+
1259
+ declare class FrameCompiler<V extends Vars = any> {
1260
+ private readonly _options;
1261
+ templateFrames: TemplateAnimationFrame<V>[];
1262
+ parsedVars: ParsedVarMap[];
1263
+ frames: AnimationFrame<V>[];
1264
+ /**
1265
+ * Next TEMPLATE frame id — a monotonic handle assigned in `addFrame`
1266
+ * (stable across re-parse, since `parse` does not re-add templates).
1267
+ * Compiled-frame ids are content-derived from `(startIx, stopIx)`
1268
+ * (see `createFrame`), NOT this counter, so `parse()` is idempotent.
1269
+ */
1270
+ frameId: number;
1271
+ /**
1272
+ * The compile inputs live on the owning `Animation`'s `options` object.
1273
+ * The compiler holds a REFERENCE to it (the setters mutate it in place,
1274
+ * never replace it), so the NEXT compile always reads the current
1275
+ * `duration`/`easing`/`colorSpace` without re-linking. For values baked
1276
+ * into already-compiled frames, the setter triggers a targeted re-derive:
1277
+ * `setDuration` rescales `frame.time` in place; `setColorSpace`/
1278
+ * `setHueMethod` call {@link renormalizeColors} (the color resolution is
1279
+ * the only baked state that depends on them). No setter silently no-ops a
1280
+ * change to compiled state.
1281
+ */
1282
+ constructor(_options: AnimationOptions);
1283
+ /**
1284
+ * The live options object the compiler reads (a REFERENCE to the owning
1285
+ * `Animation`'s `options` — the setters mutate it in place). Read-only:
1286
+ * the compiler never replaces it. Exposed so `Animation.adoptCompiled`
1287
+ * can re-bind `Animation.options` to the adopted compiler's options object
1288
+ * BY CONSTRUCTION (`this.options === this.compiler.options`, the live-options
1289
+ * invariant — G.W19 / the `6e29236` lock), without poking a private field.
1290
+ */
1291
+ get options(): AnimationOptions;
1292
+ convertFrameStart(frame: TemplateAnimationFrame<V>): TemplateAnimationFrame<V>;
1293
+ addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"]): void;
1294
+ createFrame(startIx: number, endIx: number): AnimationFrame<V>;
1295
+ /**
1296
+ * Build an index mapping each variable name to the frame indices where
1297
+ * it appears. Used by reconcileVars() for O(1) "next occurrence" lookups
1298
+ * instead of O(N) findIndex scans per variable.
1299
+ */
1300
+ private buildVarIndex;
1301
+ /**
1302
+ * Reconcile interpolation variables across non-adjacent keyframes.
1303
+ * For each variable at frame `ix`, find the next frame that also
1304
+ * defines that variable and create an interpolation segment between them.
1305
+ *
1306
+ * Uses a pre-built variable index (from buildVarIndex) to avoid
1307
+ * O(frames²) findIndex scans.
1308
+ */
1309
+ reconcileVars(ix: number, varIndex: Map<string, number[]>): void;
1310
+ /**
1311
+ * Compile `templateFrames` into the sampled `frames[]`. `targets` is the
1312
+ * one DOM input — each parsed var is bound to it so computed-unit
1313
+ * resolution can read the live box. Pure otherwise.
1314
+ */
1315
+ parse(targets: HTMLElement[]): void;
1316
+ /**
1317
+ * Derive a frame's `flatVars`/`vars`/`allInterpVars` from its
1318
+ * `interpVars` — the pre-flattened forms the hot path
1319
+ * (`interpFrames`) iterates without re-walking. Called once per frame
1320
+ * at the tail of `parse`, and again by `renormalizeColors` after a
1321
+ * color-space change re-derives the interp carriers in place.
1322
+ */
1323
+ private finalizeFrameVars;
1324
+ /**
1325
+ * Re-derive the color-resolved interpolation carriers in place after a
1326
+ * `colorSpace`/`hueMethod` change on already-compiled frames. Only the
1327
+ * per-`InterpolatedVar` color resolution depends on the color space —
1328
+ * the flatten/sort/reconcile structure does not — so this re-runs
1329
+ * `createInterpVarValue` over the existing `frames`/`parsedVars` and
1330
+ * rebuilds the hot-path arrays, with NO re-flatten and NO re-sort. The
1331
+ * new carriers derive from the already-target-bound `parsedVars`, the
1332
+ * same provenance `parse` gives them, so DOM binding is preserved.
1333
+ *
1334
+ * The owning `Animation`'s `setColorSpace`/`setHueMethod` call this when
1335
+ * frames already exist; before `parse`, the option is simply read by the
1336
+ * next compile.
450
1337
  */
451
- timingFunction?: TimingFunction | TimingFunctionNames;
452
- /** Playback duration in milliseconds. Required for `.play()`. */
453
- duration?: number;
454
- transformOrigin?: string;
1338
+ renormalizeColors(): void;
455
1339
  }
456
1340
 
457
- declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
1341
+ /**
1342
+ * Build a CSS-native SVG line-drawing animation: read the target's path length
1343
+ * ONCE, set `stroke-dasharray` to that length (one solid full-length dash), and
1344
+ * sweep `stroke-dashoffset` from → to (default `0% → 100%` ⇒ offset `L → 0`,
1345
+ * the line draws in). Returns the constructed {@link CSSKeyframesAnimation} as
1346
+ * the control handle (the `animate()` contract — `.play()` / `.pause()` /
1347
+ * `.stop()` / `.finished`), consistent with the `from*` factory family.
1348
+ *
1349
+ * The returned animation passes the EXISTING WAAPI eligibility gate
1350
+ * (`isWAAPIEligible`) for an SVG DOM target with a uniform CSS-twin easing, and
1351
+ * delegates compositor-thread via `playWAAPI` — no new eligibility predicate.
1352
+ *
1353
+ * The line length `L` is read a SINGLE time at construction (the
1354
+ * `motion-path.ts` "browser owns the geometry" pattern). A path mutated mid-draw
1355
+ * is a re-construct, not a per-frame re-measure — a per-frame `getTotalLength`
1356
+ * would be a layout round-trip the Mandate's measure-first forbids.
1357
+ *
1358
+ * @param target an SVG geometry element exposing `getTotalLength()`.
1359
+ * @param options `{ from?, to?, ...animationOptions }`.
1360
+ *
1361
+ * @example
1362
+ * // Draw a path stroke in over 2s:
1363
+ * fromDrawSVG(pathEl, { duration: 2000 });
1364
+ */
1365
+ declare function fromDrawSVG<V extends Record<string, any> = any>(target: SVGDrawTarget, options?: DrawSVGOptions): CSSKeyframesAnimation<V>;
1366
+
1367
+ /**
1368
+ * Build a CSS-native path-motion animation: set the author `offset-path` (and
1369
+ * optional `offset-rotate`) on the target(s), and sweep `offset-distance` from
1370
+ * → to. Returns the constructed {@link CSSKeyframesAnimation} as the control
1371
+ * handle (the `animate()` contract — `.play()` / `.pause()` / `.stop()` / the
1372
+ * awaitable play promise), consistent with the `from*` factory family.
1373
+ *
1374
+ * The returned animation passes the EXISTING WAAPI eligibility gate
1375
+ * (`isWAAPIEligible`) for a DOM target with a uniform CSS-twin easing, and
1376
+ * delegates compositor-thread via `playWAAPI` — no new eligibility predicate.
1377
+ *
1378
+ * @param target one or more DOM elements (or a single element) to move.
1379
+ * @param options `{ path, from?, to?, rotate?, ...animationOptions }`.
1380
+ *
1381
+ * @example
1382
+ * // Move a box along a quadratic path, facing along it, over 2s:
1383
+ * fromMotionPath(box, {
1384
+ * path: "path('M 0 0 Q 100 -100 200 0')",
1385
+ * rotate: "auto",
1386
+ * duration: 2000,
1387
+ * });
1388
+ */
1389
+ declare function fromMotionPath<V extends Record<string, any> = any>(target: HTMLElement | HTMLElement[], options: MotionPathOptions): CSSKeyframesAnimation<V>;
1390
+
1391
+ declare const glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1392
+
1393
+ declare const gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1394
+
1395
+ declare const heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1396
+
1397
+ declare const hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
458
1398
 
459
1399
  export declare type InputAnimationOptions = Partial<{
460
1400
  duration: number | string;
@@ -462,7 +1402,7 @@ export declare type InputAnimationOptions = Partial<{
462
1402
  iterationCount: number | string | "infinite" | undefined;
463
1403
  direction: (typeof DIRECTIONS)[number];
464
1404
  fillMode: (typeof FILL_MODES)[number];
465
- timingFunction: TimingFunction | TimingFunctionNames | undefined;
1405
+ timingFunction: TimingFunction | Easing | TimingFunctionNames | string | undefined;
466
1406
  /** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
467
1407
  useWAAPI: boolean;
468
1408
  /** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
@@ -473,6 +1413,13 @@ export declare type InputAnimationOptions = Partial<{
473
1413
 
474
1414
  export { InterpolatedVar }
475
1415
 
1416
+ declare const jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1417
+
1418
+ declare const jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1419
+
1420
+ /** A keyframe map: percent/keyword stops → partial var frames. */
1421
+ export declare type KeyframeMap<V extends Vars> = Map<string, Partial<V>> | Record<string, Partial<V>>;
1422
+
476
1423
  /**
477
1424
  * Load the heavy CSS-keyframe parsing engine — `Animation`,
478
1425
  * `CSSKeyframesAnimation`, `AnimationGroup`, `getTimingFunction`,
@@ -493,6 +1440,19 @@ export { InterpolatedVar }
493
1440
  */
494
1441
  export declare const loadAnimationEngine: () => Promise<AnimationEngine>;
495
1442
 
1443
+ /** Looping animations — run continuously (`iterationCount: Infinity`). */
1444
+ declare const loopPresets: {
1445
+ readonly heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1446
+ readonly glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1447
+ readonly spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1448
+ readonly rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1449
+ readonly skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1450
+ readonly gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1451
+ readonly parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1452
+ readonly hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1453
+ readonly typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1454
+ };
1455
+
496
1456
  export declare class ManualTimeline extends Timeline {
497
1457
  private value;
498
1458
  constructor(options?: TimelineOptions);
@@ -516,6 +1476,82 @@ declare interface MorphValues {
516
1476
  scaleY: number;
517
1477
  }
518
1478
 
1479
+ /**
1480
+ * `MotionPath` — the class form of {@link fromMotionPath}, for callers who
1481
+ * prefer a named primitive alongside `CSSKeyframesAnimation`. Construction is
1482
+ * the factory: `new MotionPath(target, { path }).animation` is the control
1483
+ * handle. The factory is the canonical entry; this is a thin ergonomic wrapper.
1484
+ */
1485
+ declare class MotionPath<V extends Record<string, any> = any> {
1486
+ /** The underlying offset-distance animation — the control handle. */
1487
+ readonly animation: CSSKeyframesAnimation<V>;
1488
+ constructor(target: HTMLElement | HTMLElement[], options: MotionPathOptions);
1489
+ /** Start (or re-enter) the path-motion play loop. */
1490
+ play(): Promise<void>;
1491
+ /** Pause the play loop, retaining the playhead. */
1492
+ pause(): this;
1493
+ /** Halt and rewind the play loop. */
1494
+ stop(): this;
1495
+ }
1496
+
1497
+ /**
1498
+ * A MotionPath spec — the `{ path, ... }` shape that routes to
1499
+ * {@link fromMotionPath} (F.W12 §S2). It carries the author `offset-path`
1500
+ * (`path`) plus the optional `from`/`to`/`rotate` MotionPath knobs; the
1501
+ * animation-options + `autoPlay` ride {@link AnimateOptions} on the third
1502
+ * argument, exactly as every other `animate()` shape. The discriminating field
1503
+ * is `path` — a `string` no keyframe map / vars array carries.
1504
+ */
1505
+ declare type MotionPathInput = Pick<MotionPathOptions, "path" | "from" | "to" | "rotate">;
1506
+
1507
+ export declare interface MotionPathOptions extends Partial<InputAnimationOptions> {
1508
+ /**
1509
+ * The author `offset-path` (required) — set on the target so the browser
1510
+ * resolves position from `offset-distance`. See {@link OffsetPath}.
1511
+ */
1512
+ path: OffsetPath;
1513
+ /**
1514
+ * Start of the `offset-distance` sweep. Default `"0%"` (the path origin).
1515
+ * Any `<length-percentage>` the property accepts; `%` is path-relative.
1516
+ */
1517
+ from?: string;
1518
+ /** End of the sweep. Default `"100%"` (the path end). */
1519
+ to?: string;
1520
+ /**
1521
+ * Optional `offset-rotate` set on the target for tangent-following — e.g.
1522
+ * `"auto"` (the element rotates to face along the path) or `"auto 90deg"`.
1523
+ * A STATIC author value (not animated); omitted leaves the CSS default.
1524
+ */
1525
+ rotate?: string;
1526
+ /**
1527
+ * Auto-start the play loop after construction + targeting. Default true.
1528
+ * `false` returns a constructed, targeted, NOT-yet-playing handle so the
1529
+ * caller can drive the returned animation (`.play()` / `.pause()` / `.stop()`).
1530
+ */
1531
+ autoPlay?: boolean;
1532
+ }
1533
+
1534
+ /**
1535
+ * Spec for the ADDITIVE native scroll-driven bridge (D-LIB-2 / F-5).
1536
+ *
1537
+ * A `kind: "scroll"` request maps to the platform `ScrollTimeline` (scroll
1538
+ * progress over a `source` scroller); `kind: "view"` maps to `ViewTimeline`
1539
+ * (a `subject`'s view progress through its scrollport). `axis` defaults to the
1540
+ * platform default (`block`). value.js-free — these are DOM globals.
1541
+ */
1542
+ export declare type NativeTimelineSpec = {
1543
+ kind: "scroll";
1544
+ source?: Element | null;
1545
+ axis?: ScrollAxis;
1546
+ } | {
1547
+ kind: "view";
1548
+ subject: Element;
1549
+ axis?: ScrollAxis;
1550
+ inset?: string;
1551
+ };
1552
+
1553
+ declare const notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1554
+
519
1555
  /**
520
1556
  * Zero-allocation numeric keyframe interpolator.
521
1557
  *
@@ -535,24 +1571,11 @@ export declare class NumericAnimation<T extends Record<string, number>> {
535
1571
  private result;
536
1572
  private _duration;
537
1573
  private _respectReducedMotion;
538
- private _easing;
1574
+ private _easingFn;
539
1575
  private _playback;
540
1576
  constructor(keyframes: T[], options?: NumericAnimationOptions);
541
1577
  private buildSegments;
542
1578
  private buildSegment;
543
- /**
544
- * Resolve a pending string easing *name* through the dynamic engine
545
- * boundary. A no-op (resolved promise) when easing was supplied as a
546
- * callable or omitted. Memoized via the shared `EasingResolvable` — the
547
- * `await import("./engine")` and `getTimingFunction` lookup run at most
548
- * once per instance.
549
- *
550
- * Resolution is already kicked off eagerly at construction; `.play()`
551
- * awaits this before the first frame, and stateless `.at()` consumers
552
- * that pass a name can `await animation.ready()` first to interpolate
553
- * with the resolved easing rather than the identity fallback.
554
- */
555
- ready(): Promise<void>;
556
1579
  /**
557
1580
  * Map [0, 1] progress to interpolated values. Zero allocation —
558
1581
  * returns the same pre-allocated result object on every call.
@@ -580,24 +1603,19 @@ export declare class NumericAnimation<T extends Record<string, number>> {
580
1603
 
581
1604
  export declare interface NumericAnimationOptions {
582
1605
  /**
583
- * Easing as a callable `TimingFunction`, OR a string easing *name*
584
- * from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`,
585
- * `"linear"`, …).
1606
+ * Easing as a callable `TimingFunction` or a typed `Easing` — both
1607
+ * synchronous and value.js-free, so this engine never touches the
1608
+ * dynamic boundary.
586
1609
  *
587
- * A **callable** is used directly and keeps this engine value.js-free —
588
- * no dynamic import, nothing pulled into the static graph.
1610
+ * A string easing *name* is NOT accepted here (fail-explicit: it
1611
+ * throws). Resolve a name once, up front, through the async factory:
589
1612
  *
590
- * A **string name** is resolved through the dynamic engine boundary via
591
- * the shared `EasingResolvable` contract: resolution is kicked off
592
- * EAGERLY at construction (an `await import("./engine")` looks the name
593
- * up via `getTimingFunction`), so the value.js-bearing easing registry
594
- * loads only when a named easing is actually used and the named curve
595
- * lands by the first frame. Until it lands, `.at()` interpolates with the
596
- * identity fallback and emits a one-time dev-only warning; `await
597
- * .ready()` first to interpolate with the named curve from the very first
598
- * synchronous `.at()`.
599
- */
600
- timingFunction?: TimingFunction | TimingFunctionNames | undefined;
1613
+ * ```ts
1614
+ * const easing = await resolveEasing("easeOutCubic");
1615
+ * new NumericAnimation(frames, { timingFunction: easing });
1616
+ * ```
1617
+ */
1618
+ timingFunction?: TimingFunction | Easing | undefined;
601
1619
  /** Playback duration in milliseconds. Required for `.play()`. */
602
1620
  duration?: number | undefined;
603
1621
  /** Explicit positions as percentages [0-100]. Auto-distributes if omitted. */
@@ -606,7 +1624,7 @@ export declare interface NumericAnimationOptions {
606
1624
  * When true, honor `prefers-reduced-motion: reduce` by snapping to the
607
1625
  * final keyframe values immediately rather than interpolating over
608
1626
  * `duration`. The play promise resolves on the next microtask. Default
609
- * false (back-compat — consumers opt in).
1627
+ * false (conservative default — opt in to the reduced-motion snap).
610
1628
  *
611
1629
  * The check uses `matchMedia` if available; on SSR / Node the option
612
1630
  * is a no-op (animations proceed normally).
@@ -617,23 +1635,122 @@ export declare interface NumericAnimationOptions {
617
1635
  /** Callback invoked each frame during `.play()` with the interpolated values. */
618
1636
  export declare type NumericFrameCallback<T extends Record<string, number>> = (values: T) => void;
619
1637
 
1638
+ /**
1639
+ * The author's path geometry — the `offset-path` value set on the target. Any
1640
+ * valid CSS `offset-path`: a `path()` data string, a `ray()`, a `url(#id)`
1641
+ * SVG-path reference, or a basic shape. The browser resolves it to positions;
1642
+ * keyframes never parses it.
1643
+ */
1644
+ export declare type OffsetPath = string;
1645
+
1646
+ declare const parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1647
+
620
1648
  declare type ParsedVarMap = Record<string, ValueArray>;
621
1649
 
622
1650
  /**
623
- * Shared rAF playback lifecycle for stateless interpolators
624
- * (`NumericAnimation`, `ElementMorph`). Owns the rAF handle, start
625
- * timestamp, resolve callback, AND the `prefers-reduced-motion` gate so the
626
- * interpolator classes don't each reimplement the same loop or the same
627
- * reduced-motion snap.
1651
+ * The full preset taxonomy, grouped by intent. Each leaf is one of the
1652
+ * existing exported factory functions — the taxonomy is a discovery index over
1653
+ * the library, not a second copy of it.
1654
+ */
1655
+ declare const presetTaxonomy: {
1656
+ readonly enter: {
1657
+ readonly fadeIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1658
+ readonly slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1659
+ readonly slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1660
+ readonly slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1661
+ readonly rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1662
+ readonly blurIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1663
+ readonly springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1664
+ readonly springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1665
+ readonly jumpUp: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1666
+ };
1667
+ readonly exit: {
1668
+ readonly fadeOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1669
+ readonly slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1670
+ readonly slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1671
+ readonly blurOut: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1672
+ readonly warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1673
+ readonly warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1674
+ readonly jumpDown: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1675
+ };
1676
+ readonly attention: {
1677
+ readonly pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1678
+ readonly shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1679
+ readonly bounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1680
+ readonly flip: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1681
+ readonly notificationBounce: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1682
+ readonly springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1683
+ readonly springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1684
+ };
1685
+ readonly loop: {
1686
+ readonly heartbeat: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1687
+ readonly glow: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1688
+ readonly spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1689
+ readonly rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1690
+ readonly skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1691
+ readonly gradientBackground: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1692
+ readonly parallaxScroll: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1693
+ readonly hover: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1694
+ readonly typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1695
+ };
1696
+ };
1697
+
1698
+ declare const progressBar: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1699
+
1700
+ declare const pulse: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1701
+
1702
+ /**
1703
+ * THE managed rAF driver. Owns the rAF handle, start timestamp, dt clock,
1704
+ * and resolve callback for every loop in the engine. ONE generation-guarded
1705
+ * frame-scheduler core ({@link _run}) backs three thin entry shapes:
1706
+ *
1707
+ * - {@link play} — duration-based progress loop (`NumericAnimation`,
1708
+ * `ElementMorph`), with the light reduced-motion snap gate built in.
1709
+ * - {@link drive} — settle-based dt loop over a {@link Tickable}
1710
+ * (`SmoothProgress`, `SpringProgress`): steps until the stepper settles,
1711
+ * auto-stopping; idempotent so target re-seats can re-arm it.
1712
+ * - {@link loop} — self-rescheduling frame loop over an async callback
1713
+ * (`Animation`, `AnimationGroup`, the WAAPI shadow tick): the callback
1714
+ * returns `true` to continue; rescheduling waits for the (possibly
1715
+ * async) callback to complete, so a slow frame never double-schedules.
628
1716
  *
629
- * Not used by the full `Animation` class — that engine has a richer
630
- * lifecycle (iteration, direction, fill modes, events) that doesn't
631
- * factor into this primitive; it carries its own reduced-motion snap.
1717
+ * Because all three ride one core, none can diverge — the generation guard
1718
+ * that makes `loop` safe against a `stop()` + restart mid-frame protects
1719
+ * `drive` and `play` identically.
1720
+ *
1721
+ * The formerly hand-rolled copies of this lifecycle — `SmoothProgress` /
1722
+ * `SpringProgress` `_startLoop`/`_stopLoop` byte-siblings, the
1723
+ * `AnimationGroup` draw loop, `Animation._playRAF`, and the WAAPI shadow
1724
+ * loop — all delegate here. No other module owns a rAF handle.
632
1725
  */
633
1726
  export declare class RAFPlayback {
634
1727
  private _rafId;
635
1728
  private _startTime;
1729
+ private _lastFrameT;
636
1730
  private _resolve;
1731
+ /**
1732
+ * Monotonic generation counter, bumped on every `play`/`drive`/`loop`/
1733
+ * `stop`. A loop's async frame captures its generation and reschedules
1734
+ * ONLY when it still matches — so a `stop()` + restart while an async
1735
+ * frame is mid-flight cannot let the stale callback re-arm a second rAF
1736
+ * chain (the generation-unaware `_rafId !== null` guard could, because
1737
+ * the restart repopulated `_rafId`).
1738
+ */
1739
+ private _gen;
1740
+ /** True while this driver owns a scheduled rAF callback. */
1741
+ get running(): boolean;
1742
+ /**
1743
+ * THE generation-guarded frame-scheduler core. `step(now)` does one
1744
+ * frame's work and returns `true` to continue, `false` to finish; it
1745
+ * may be async (the next frame waits for it). Every frame captures the
1746
+ * generation taken at start, and reschedules ONLY when it still matches
1747
+ * — so a `stop()` + restart mid-frame (even while an async `step` is in
1748
+ * flight) cannot let a stale chain re-arm a second rAF on top of the
1749
+ * restart's freshly-repopulated `_rafId`. On `false` (or a stale
1750
+ * generation that finishes) the loop cleans up. `play`/`drive`/`loop`
1751
+ * are the three thin entry shapes over this one core.
1752
+ */
1753
+ private _run;
637
1754
  /**
638
1755
  * Drive `onTick(progress)` once per frame for `duration` ms.
639
1756
  * `progress` is clamped to [0, 1]; the loop terminates after the
@@ -646,13 +1763,28 @@ export declare class RAFPlayback {
646
1763
  * resolves on the next microtask.
647
1764
  */
648
1765
  play(duration: number, onTick: (progress: number) => void, options?: RAFPlaybackOptions): Promise<void>;
649
- /** Cancel a running playback. The play promise resolves immediately. */
1766
+ /**
1767
+ * Drive a {@link Tickable}'s dt-stepper once per frame until it
1768
+ * settles, invoking `onFrame` after each step. Idempotent — a call
1769
+ * while the loop is already running is a no-op, so consumers re-arm
1770
+ * freely on every target re-seat. The loop auto-stops on settle.
1771
+ */
1772
+ drive(tickable: Tickable, onFrame?: () => void): void;
1773
+ /**
1774
+ * Self-rescheduling frame loop over an async callback. `cb(now)`
1775
+ * returns `true` to continue; the next frame is scheduled only after
1776
+ * the callback (and any awaited work inside it) completes. `stop()`
1777
+ * between frames halts the loop — the in-flight callback finishes,
1778
+ * no further frame is scheduled.
1779
+ */
1780
+ loop(cb: (now: number) => boolean | Promise<boolean>): void;
1781
+ /** Cancel a running playback. A pending play promise resolves immediately. */
650
1782
  stop(): void;
651
1783
  private _cleanup;
652
1784
  }
653
1785
 
654
1786
  /** Per-playback options for {@link RAFPlayback.play}. */
655
- declare interface RAFPlaybackOptions {
1787
+ export declare interface RAFPlaybackOptions {
656
1788
  /**
657
1789
  * Honor `prefers-reduced-motion: reduce` by snapping to the final frame
658
1790
  * (`onTick(1)`) in a single paint instead of running the rAF loop. The
@@ -668,6 +1800,8 @@ declare interface RAFPlaybackOptions {
668
1800
  respectReducedMotion?: boolean | undefined;
669
1801
  }
670
1802
 
1803
+ declare const rainbowText: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1804
+
671
1805
  /**
672
1806
  * Result of normalising a CSS keyframes input down to the shape the
673
1807
  * `CSSKeyframesAnimation.fromString` flow expects: a `Map<percent →
@@ -680,6 +1814,13 @@ export declare interface ResolvedKeyframes {
680
1814
  keyframes: Map<string, Record<string, unknown>>;
681
1815
  /** per-keyframe `animation-timing-function`, keyed by percent string */
682
1816
  timingFunctions: Map<string, string>;
1817
+ /**
1818
+ * per-keyframe `animation-composition` (`replace` | `add` | `accumulate`),
1819
+ * keyed by percent string — value.js lifts it onto `rule.composition`; the
1820
+ * adapter used to drop it. Captured (F.W8); honoring it (→ WAAPI
1821
+ * `composite` / rAF accumulate) is BOOKed, not half-wired.
1822
+ */
1823
+ composition: Map<string, string>;
683
1824
  /** `@property --foo { ... }` registry */
684
1825
  properties: Map<string, PropertyDescriptor_2>;
685
1826
  /**
@@ -690,6 +1831,30 @@ export declare interface ResolvedKeyframes {
690
1831
  options: ReturnType<typeof extractAnimationOptions>;
691
1832
  }
692
1833
 
1834
+ /**
1835
+ * Resolve a string easing name (a value.js registry entry — `"easeOutCubic"`,
1836
+ * `"ease-out-cubic"`, … — or a CSS `cubic-bezier()` literal) to a typed
1837
+ * {@link Easing}.
1838
+ *
1839
+ * The lookup rides the dynamic engine boundary: `import("./engine")` loads
1840
+ * the value.js-bearing easing registry only when a named easing is actually
1841
+ * used, so a light-only consumer that never calls this stays value.js-free.
1842
+ *
1843
+ * Fail-explicit: an unresolvable name throws {@link UnknownEasingError};
1844
+ * an engine chunk-load failure rethrows with the failing easing named —
1845
+ * never an unhandled rejection, never a silent identity fallback.
1846
+ *
1847
+ * ```ts
1848
+ * const easing = await resolveEasing("easeOutCubic");
1849
+ * const anim = new NumericAnimation(frames, { timingFunction: easing });
1850
+ * ```
1851
+ */
1852
+ export declare function resolveEasing(name: string): Promise<Easing>;
1853
+
1854
+ declare const rotateIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1855
+
1856
+ declare const rotateScale: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
1857
+
693
1858
  declare class ScrollTimeline_2 extends Timeline {
694
1859
  private threshold;
695
1860
  private getScrollY;
@@ -709,6 +1874,276 @@ declare interface ScrollTimelineOptions_2 extends TimelineOptions {
709
1874
  }
710
1875
  export { ScrollTimelineOptions_2 as ScrollTimelineOptions }
711
1876
 
1877
+ /**
1878
+ * The master-playhead orchestrator. Positions child animations along one clock
1879
+ * and drives them via `Animation.advanceTo`. See the module docstring for the
1880
+ * booked name + subsumption decision.
1881
+ */
1882
+ export declare class Sequence<V extends Vars = any> {
1883
+ /** Resolved segments, in insertion order. */
1884
+ readonly entries: SequenceEntry<V>[];
1885
+ /** Named positions on the master clock, registered via {@link label}. */
1886
+ private readonly labels;
1887
+ /**
1888
+ * The running insertion cursor (ms) — the end of the last-inserted
1889
+ * segment. Relative `"+="`/`"-="` positions and auto-append (`at` omitted)
1890
+ * measure from here, matching GSAP's append-by-default timeline.
1891
+ */
1892
+ private cursor;
1893
+ /** Master clock (ms) of the current playhead. */
1894
+ private _time;
1895
+ private readonly respectReducedMotion;
1896
+ /** THE rAF owner for the sequence's play loop. */
1897
+ readonly playback: RAFPlayback;
1898
+ private _boundFrame;
1899
+ private _resolvePlay;
1900
+ private _playOrigin;
1901
+ private _playingPromise;
1902
+ /**
1903
+ * The scalar playback rate — the single field that drives `timeScale`
1904
+ * and `reverse`. `_rate = 1` is real-time forward (the existing
1905
+ * single-play default); `n` is `timeScale(n)` (slow-mo `< 1` /
1906
+ * fast-forward `> 1`); a negative `_rate` walks the master clock
1907
+ * backward (`reverse`). It scales the master clock in {@link _frame}:
1908
+ * `masterClock = (clock − _playOrigin) * _rate`.
1909
+ */
1910
+ private _rate;
1911
+ /**
1912
+ * How many master-clock cycles `play()` runs before settling. `1` is the
1913
+ * existing single-play; `Infinity` never settles (the loop case);
1914
+ * `n` runs `n` cycles. The master clock folds modulo `duration`
1915
+ * (see {@link _fold}).
1916
+ */
1917
+ private _repeatCount;
1918
+ /**
1919
+ * When true, odd cycles reflect the folded phase (`duration − phase`) —
1920
+ * the GSAP `yoyo` ping-pong. Default off (every cycle runs forward).
1921
+ */
1922
+ private _yoyoOn;
1923
+ /** Whether `pause()` has halted the loop with the playhead retained. */
1924
+ private _paused;
1925
+ /**
1926
+ * The loop's last rAF timestamp — the re-anchor reference. The
1927
+ * `RAFPlayback`/`AnimationGroup` managed-pause records the loop's LAST rAF
1928
+ * timestamp (not `performance.now()`) so resume adjusts the origin against
1929
+ * the SAME clock the loop reads, with no forward jump. `Sequence` records
1930
+ * it here per frame (the driver does not expose it) for that one re-anchor.
1931
+ */
1932
+ private _lastClock;
1933
+ constructor(options?: SequenceOptions);
1934
+ /** The full span of the sequence (ms): the latest segment end. */
1935
+ get duration(): number;
1936
+ /** The current master-clock position (ms). */
1937
+ get time(): number;
1938
+ /**
1939
+ * The normalized playhead position in `[0, 1]` — the GSAP
1940
+ * `Timeline.progress()` idiom. Pure division over the existing scrub:
1941
+ * the getter is `_time / duration`; the setter scrubs to `p * duration`
1942
+ * via {@link seek}.
1943
+ */
1944
+ get progress(): number;
1945
+ set progress(p: number);
1946
+ /** The scalar playback rate (`timeScale` / sign of `reverse`). */
1947
+ get rate(): number;
1948
+ /** Register a named position on the master clock. Chainable. */
1949
+ label(name: string, at?: SequencePosition): this;
1950
+ /**
1951
+ * Append a child animation at `at` (absolute ms, a label, a `"+="`/`"-="`
1952
+ * relative token, or — omitted — the running cursor, i.e. after the
1953
+ * previous segment). Advances the insertion cursor to this segment's end.
1954
+ * Chainable.
1955
+ */
1956
+ add(animation: Animation_2<V>, at?: SequencePosition): this;
1957
+ /**
1958
+ * Resolve a {@link SequencePosition} to an absolute ms offset.
1959
+ *
1960
+ * - omitted → the running cursor (auto-append after the previous segment).
1961
+ * - `number` → itself.
1962
+ * - `"+=n"` / `"-=n"` → cursor ± n.
1963
+ * - any other string → the registered label (throws if unknown — labels
1964
+ * are an explicit contract, a typo is a bug, not a silent 0).
1965
+ */
1966
+ private resolvePosition;
1967
+ /**
1968
+ * Map the master playhead to each child's LOCAL clock and paint it. This is
1969
+ * the synchronous scrub form: for every segment, the local clock is
1970
+ * `clamp(masterClock − at, 0, duration)`, applied via `interpFrames(local,
1971
+ * true)`. Segments not yet reached rest at their initial frame; segments
1972
+ * past their end rest at their final frame — the timeline-scrub contract.
1973
+ * Chainable.
1974
+ */
1975
+ seek(masterClock: number): this;
1976
+ /**
1977
+ * THE master-playhead → child-clock map, applied as a pure synchronous
1978
+ * scrub. For every segment the local clock is `clamp(masterClock − at, 0,
1979
+ * duration)`, painted via `interpFrames(local, true)`. This is the ONE map
1980
+ * both `seek` (the public scrub) and `_frame` (the rAF play loop) drive —
1981
+ * so play is pixel-identical to seek BY CONSTRUCTION, forward AND reverse
1982
+ * (the C⁰-continuity the F.W9 parity gate locks). It carries no `onEnd`/
1983
+ * `startTime` machinery, so re-entering a finished segment under a negative
1984
+ * `rate` paints the same final-frame value `seek` would — there is no
1985
+ * forward-monotone re-anchor window to break (F.W9 §S3 MEASURE-FIRST).
1986
+ */
1987
+ private _applyAt;
1988
+ /**
1989
+ * Fold a raw, repeat-extended master clock down to an effective phase in
1990
+ * `[0, duration]` per the `repeat`/`yoyo` transport. With `repeat(1)` +
1991
+ * `yoyo(false)` (the defaults) this is the identity on `[0, duration]`
1992
+ * (the existing single-play). For `repeat`, the phase is `raw mod
1993
+ * duration`; for `yoyo`, odd cycles reflect (`duration − phase`) so the
1994
+ * playhead ping-pongs. The terminal clock of the LAST cycle resolves to
1995
+ * the rest phase (`duration` forward, `0` reflected) rather than wrapping
1996
+ * to `0` — so a settled `repeat`/`yoyo` run lands on its true end frame.
1997
+ */
1998
+ private _fold;
1999
+ /**
2000
+ * Set targets on every child segment. Convenience for the common case
2001
+ * where one target receives the whole sequence; per-segment targets can be
2002
+ * set on each `animation` directly before `.add`. Chainable.
2003
+ */
2004
+ setTargets(...targets: HTMLElement[]): this;
2005
+ /**
2006
+ * Drive the sequence over real time via `RAFPlayback`. Each child is driven
2007
+ * through the published `Animation.advanceTo(absoluteClock)` map: its
2008
+ * `startTime` is seeded to its resolved `at`, so `advanceTo(masterClock)`
2009
+ * yields the child's local clock as `masterClock − at` exactly. Resolves
2010
+ * when the master playhead passes the sequence `duration`.
2011
+ *
2012
+ * Re-entrant: a `play()` while one is in flight returns the same promise.
2013
+ * Under `respectReducedMotion` + an active query, snaps to the rest frame
2014
+ * in one paint (a terminal `seek(duration)`), no draw loop.
2015
+ */
2016
+ /**
2017
+ * The completion front-door (G.W13) — `await sequence.finished` resolves
2018
+ * once the in-flight transport settles. Exposes the ONE held
2019
+ * `_playingPromise` `play()` constructs (the re-entrant guard returns it;
2020
+ * the `finally`-clear nulls it on settle) — NOT a second completion
2021
+ * lifecycle. A settled (or never-played, or reduced-motion-snapped)
2022
+ * sequence resolves immediately.
2023
+ */
2024
+ get finished(): Promise<void>;
2025
+ play(): Promise<void>;
2026
+ private _frame;
2027
+ /**
2028
+ * True for the byte-stable default transport — forward real-time, single
2029
+ * cycle, no yoyo. The event-dispatch path runs ONLY here, so an existing
2030
+ * caller's `play()` fires the same `animationstart`/`animationend` it
2031
+ * always did; any transport modifier opts into the scrub-paint authority.
2032
+ */
2033
+ private _isForwardMonotone;
2034
+ /**
2035
+ * The terminal rest phase of a `repeat`/`yoyo` run — where the playhead
2036
+ * lands when the final cycle closes. A forward run rests at `duration`;
2037
+ * an odd-cycle yoyo run that closes reflected rests at `0`. Mirrors the
2038
+ * boundary `_fold` resolves at the terminal clock.
2039
+ */
2040
+ private _restPhase;
2041
+ /**
2042
+ * Re-anchor `_playOrigin` against the loop's last rAF timestamp so the
2043
+ * master clock is CONTINUOUS across a transport edit — the
2044
+ * `RAFPlayback`/`AnimationGroup` managed-pause re-anchor (no forward jump).
2045
+ * The invariant restored: `(clock − _playOrigin) * rate === _time` at the
2046
+ * edit instant. Solving for the origin: `_playOrigin = clock − _time /
2047
+ * rate`. With `rate = 0` the playhead is frozen, so the origin collapses
2048
+ * to the bare timestamp (the next non-zero rate re-anchors again).
2049
+ */
2050
+ private _reanchor;
2051
+ /** Release every child back to standalone ownership and clear play flags. */
2052
+ private _settle;
2053
+ /** Halt the play loop where it stands and resolve any pending `play()`. */
2054
+ stop(): this;
2055
+ /**
2056
+ * Halt the play loop where it stands WITHOUT releasing the playhead — the
2057
+ * managed-pause contract. The rAF loop stops; `_time` and the play promise
2058
+ * are RETAINED (children stay `managed`, unlike `stop()`/`_settle`), so a
2059
+ * later {@link resume} continues from exactly here. No-op when not playing
2060
+ * or already paused. Chainable.
2061
+ */
2062
+ pause(): this;
2063
+ /**
2064
+ * Resume a paused sequence — restart the rAF loop with the origin
2065
+ * re-anchored so the FIRST resumed frame's master clock equals the
2066
+ * retained `_time` (the no-forward-jump re-anchor, the same `RAFPlayback`/
2067
+ * `AnimationGroup` managed-pause contract — `src/animation/CLAUDE.md`
2068
+ * §Managed-child lifecycle). No-op when not paused. Chainable.
2069
+ */
2070
+ resume(): this;
2071
+ /**
2072
+ * Set the scalar playback rate — slow-mo (`< 1`), real-time (`1`),
2073
+ * fast-forward (`> 1`), or backward (`< 0`, the {@link reverse} form). The
2074
+ * master clock is re-anchored so the playhead is CONTINUOUS at the
2075
+ * rate-change instant (no jump) — the same re-anchor as {@link resume}.
2076
+ * Takes effect immediately whether or not the sequence is playing.
2077
+ * Chainable.
2078
+ */
2079
+ timeScale(n: number): this;
2080
+ /**
2081
+ * Flip the playback direction — the playhead walks backward from where it
2082
+ * stands (a negative rate) or forward again, preserving `|rate|`. C⁰-
2083
+ * continuous: the re-anchor keeps the playhead exactly where it is at the
2084
+ * flip instant (locked by the F.W9 seek↔play parity gate). Chainable.
2085
+ */
2086
+ reverse(): this;
2087
+ /**
2088
+ * Set how many cycles `play()` runs before settling — `1` is single-play,
2089
+ * `n` runs `n` cycles, `Infinity` loops forever (until `stop()`). The
2090
+ * master clock folds modulo `duration` per cycle. Chainable.
2091
+ */
2092
+ repeat(count: number): this;
2093
+ /**
2094
+ * Toggle yoyo (ping-pong) — when on, odd cycles run reflected
2095
+ * (`duration − phase`) so the playhead bounces back and forth across the
2096
+ * `repeat` cycles. Chainable.
2097
+ */
2098
+ yoyo(on?: boolean): this;
2099
+ }
2100
+
2101
+ /** A resolved sequence segment: a child animation anchored at an absolute ms offset. */
2102
+ export declare interface SequenceEntry<V extends Vars> {
2103
+ animation: Animation_2<V>;
2104
+ /** Absolute offset (ms) of this segment's local t=0 on the master clock. */
2105
+ at: number;
2106
+ }
2107
+
2108
+ export declare interface SequenceOptions {
2109
+ /**
2110
+ * When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
2111
+ * every child to its rest frame in a single paint (delegated to each
2112
+ * child's own reduced-motion contract via a terminal `seek`). Default
2113
+ * false. SSR-safe off-DOM.
2114
+ */
2115
+ respectReducedMotion?: boolean;
2116
+ }
2117
+
2118
+ /**
2119
+ * A position on the master clock for a sequence entry.
2120
+ *
2121
+ * - `number` — an absolute offset in milliseconds from the sequence origin.
2122
+ * - `` `+=${n}` `` / `` `-=${n}` `` — relative to the running insertion cursor
2123
+ * (the end of the previously-inserted segment): `"+=200"` starts 200ms after
2124
+ * the cursor, `"-=200"` overlaps the previous segment by 200ms.
2125
+ * - any other string — a label registered via {@link Sequence.label}.
2126
+ */
2127
+ export declare type SequencePosition = number | `+=${number}` | `-=${number}` | string;
2128
+
2129
+ declare const shake: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2130
+
2131
+ declare const skeletonLoading: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2132
+
2133
+ declare const slideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2134
+
2135
+ declare const slideInLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2136
+
2137
+ declare const slideInLeftKeyframes = "\n0% {\n transform: translateX(-100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n";
2138
+
2139
+ declare const slideInRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2140
+
2141
+ declare const slideInRightKeyframes = "\n0% {\n transform: translateX(100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n";
2142
+
2143
+ declare const slideOutLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2144
+
2145
+ declare const slideOutRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2146
+
712
2147
  /** Per-frame callback for `.play()` mode. Receives the smoothed current value. */
713
2148
  declare type SmoothFrameCallback = (value: number) => void;
714
2149
 
@@ -717,17 +2152,26 @@ export declare class SmoothProgress {
717
2152
  private targetValue;
718
2153
  private currentValue;
719
2154
  private isSettled;
720
- private _rafId;
721
- private _lastFrameT;
2155
+ private _playback;
722
2156
  private _onFrame;
723
2157
  constructor(options?: Partial<SmoothProgressOptions>);
724
2158
  get target(): number;
725
2159
  get current(): number;
726
2160
  get settled(): boolean;
727
2161
  setTarget(target: number): void;
728
- /** Advance one step using fixed damping. Returns current value. */
729
- tick(): number;
730
- /** Frame-rate independent tick. dt is in milliseconds. */
2162
+ /**
2163
+ * Reduced-motion snap: jump to target, settle, emit once, and stop the
2164
+ * managed loop — symmetric with `SpringProgress._snapSettled`. A
2165
+ * reduced-motion snap leaves no scheduled `drive` frame on either
2166
+ * stepper; the two `_snapSettled` bodies are now contract-equivalent
2167
+ * (value-set + settle + emit + stop), differing only in the spring's
2168
+ * velocity/origin fields.
2169
+ */
2170
+ private _snapSettled;
2171
+ /**
2172
+ * THE canonical step: advance by `dt` milliseconds, frame-rate
2173
+ * independent. Returns the new current value.
2174
+ */
731
2175
  tickDt(dt: number): number;
732
2176
  /** Immediately set current = target. */
733
2177
  snap(): void;
@@ -751,8 +2195,12 @@ export declare class SmoothProgress {
751
2195
  * Pairs with `.play()`. Does not touch current/target/settled state.
752
2196
  */
753
2197
  stop(): void;
2198
+ /**
2199
+ * Arm the shared driver: it steps `tickDt(dt)` once per frame until
2200
+ * `settled` flips true, emitting `onFrame` per step. Idempotent —
2201
+ * the driver no-ops while already running.
2202
+ */
754
2203
  private _startLoop;
755
- private _stopLoop;
756
2204
  }
757
2205
 
758
2206
  export declare interface SmoothProgressOptions {
@@ -774,7 +2222,8 @@ export declare interface SmoothProgressOptions {
774
2222
  * When true, honor `prefers-reduced-motion: reduce` by snapping to
775
2223
  * target immediately rather than damping. `setTarget` short-circuits
776
2224
  * the smooth-toward path; `play()` invokes `onFrame` once with the
777
- * target value. Default false (back-compat — consumers opt in).
2225
+ * target value. Default false (conservative default — opt in to the
2226
+ * reduced-motion snap).
778
2227
  *
779
2228
  * The check uses `matchMedia` if available; on SSR / Node the option
780
2229
  * is a no-op (animations proceed normally).
@@ -782,6 +2231,42 @@ export declare interface SmoothProgressOptions {
782
2231
  respectReducedMotion: boolean;
783
2232
  }
784
2233
 
2234
+ declare const spinner: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2235
+
2236
+ /**
2237
+ * The modern, time-based spring surface — the idiom Motion now leads its
2238
+ * docs with, treating `(response, dampingFraction)` as the advanced
2239
+ * fallback. A pure parameter translation: `response = visualDuration` and
2240
+ * `dampingFraction = 1 − bounce` (clamped). The solver, the `linear()`
2241
+ * sampler, and the live re-seat are unchanged — this is a construction-time
2242
+ * alternate surface, zero hot-path cost.
2243
+ *
2244
+ * Exactly one of `visualDuration` / `duration` selects the perceptual
2245
+ * settle time (the period mapped onto `response`); `bounce` ∈ [−1, 1]
2246
+ * selects overshoot (`0` ≈ critically damped, `> 0` rings, `< 0`
2247
+ * overdamped). The remaining {@link SpringProgressOptions} keys
2248
+ * (`initial`, `initialVelocity`, thresholds, `respectReducedMotion`)
2249
+ * carry through unchanged.
2250
+ */
2251
+ declare interface SpringDurationOptions extends Partial<Pick<SpringProgressOptions, "initial" | "initialVelocity" | "settleThreshold" | "velocitySettleThreshold" | "respectReducedMotion">> {
2252
+ /**
2253
+ * The perceptual settle duration in seconds — mapped directly onto
2254
+ * `response`. The designer-facing name for the same quantity.
2255
+ */
2256
+ visualDuration?: number;
2257
+ /**
2258
+ * Alias of {@link visualDuration} (the Motion `duration` key). When
2259
+ * both are supplied, `visualDuration` wins. Default 0.5.
2260
+ */
2261
+ duration?: number;
2262
+ /**
2263
+ * Overshoot, in [−1, 1]. `0` maps to critically damped (no ring),
2264
+ * `> 0` rings (underdamped), `< 0` is overdamped (sluggish). Mapped
2265
+ * `dampingFraction = 1 − bounce`. Default 0.
2266
+ */
2267
+ bounce?: number;
2268
+ }
2269
+
785
2270
  /** Per-frame callback for `.play()` mode. */
786
2271
  export declare type SpringFrameCallback = (value: number, velocity: number) => void;
787
2272
 
@@ -830,6 +2315,9 @@ export declare interface SpringLinearStopsOptions {
830
2315
  maxDuration?: number;
831
2316
  }
832
2317
 
2318
+ /** Spring-eased attention "pop" — the bouncy spring drives the scale pulse. */
2319
+ declare const springPop: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2320
+
833
2321
  /**
834
2322
  * Live-target spring tracker. Sibling of `SmoothProgress` for animations
835
2323
  * where the target may change mid-flight (gesture follows, drag, live
@@ -864,10 +2352,22 @@ export declare class SpringProgress {
864
2352
  private omegaD;
865
2353
  private subscribers;
866
2354
  private disposed;
867
- private _rafId;
868
- private _lastFrameT;
2355
+ private _playback;
869
2356
  private _onFrame;
870
2357
  constructor(options?: Partial<SpringProgressOptions>);
2358
+ /**
2359
+ * Construct a spring from the modern time-based surface
2360
+ * `{ visualDuration | duration, bounce }` (the idiom Motion leads its
2361
+ * docs with). Pure parameter translation to `(response,
2362
+ * dampingFraction)` — `response = visualDuration`, `dampingFraction =
2363
+ * 1 − bounce` (clamped) — normalized once here, then handed to the
2364
+ * standard constructor. The solver, the `linear()` sampler, and the
2365
+ * live re-seat are identical to the `(response, dampingFraction)`
2366
+ * path: `fromDuration({ visualDuration: d, bounce: b })` is trajectory-
2367
+ * identical to `new SpringProgress({ response: d, dampingFraction: 1 −
2368
+ * b })`.
2369
+ */
2370
+ static fromDuration(options?: SpringDurationOptions): SpringProgress;
871
2371
  get target(): number;
872
2372
  get value(): number;
873
2373
  get velocity(): number;
@@ -879,12 +2379,18 @@ export declare class SpringProgress {
879
2379
  */
880
2380
  set target(value: number);
881
2381
  private reseatTarget;
2382
+ /** Reduced-motion snap: jump to target at zero velocity, settle, emit once. */
2383
+ private _snapSettled;
882
2384
  /**
883
- * Advance by `dt` seconds. Uses the analytic closed-form solution
884
- * accumulated from the last target re-seat (so per-frame error is
885
- * O(machine epsilon), not O(dt²) like Euler).
2385
+ * THE canonical step: advance by `dt` MILLISECONDS — the {@link Tickable}
2386
+ * surface the shared `RAFPlayback.drive` loop steps, and the one unit
2387
+ * every stepper's public step takes. Returns the new value.
2388
+ *
2389
+ * The spring math is in seconds; this converts and delegates to the
2390
+ * private analytic stepper {@link _stepSeconds}.
886
2391
  */
887
- tick(dt: number): number;
2392
+ tickDt(dt: number): number;
2393
+ /* Excluded from this release type: _stepSeconds */
888
2394
  /**
889
2395
  * Evaluate the solver at elapsed time `t` (seconds) from the most
890
2396
  * recent target re-seat. Equivalent to `tick(t - elapsed)` but
@@ -927,8 +2433,12 @@ export declare class SpringProgress {
927
2433
  play(onFrame?: SpringFrameCallback): void;
928
2434
  /** Cancel the managed rAF loop and detach the per-frame callback. */
929
2435
  stop(): void;
2436
+ /**
2437
+ * Arm the shared driver: it steps `tickDt(dt)` once per frame until
2438
+ * `settled` flips true, emitting `onFrame` per step. Idempotent —
2439
+ * the driver no-ops while already running.
2440
+ */
930
2441
  private _startLoop;
931
- private _stopLoop;
932
2442
  }
933
2443
 
934
2444
  /**
@@ -975,24 +2485,34 @@ export declare interface SpringProgressOptions {
975
2485
  respectReducedMotion: boolean;
976
2486
  }
977
2487
 
2488
+ /**
2489
+ * Spring-eased scale-in entrance — the canonical iOS "pop" with overshoot.
2490
+ * Uses the bouncy spring (ζ 0.5) so the element settles past 1 before resting.
2491
+ */
2492
+ declare const springScaleIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2493
+
2494
+ /** Spring-eased slide-up entrance — the snappy spring (ζ 0.78). */
2495
+ declare const springSlideIn: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2496
+
978
2497
  /** Subscriber callback. Receives current position + velocity each emission. */
979
2498
  export declare type SpringSubscriber = (value: number, velocity: number) => void;
980
2499
 
981
2500
  /**
982
- * Sample a `SpringProgress(target=1, initial=0)` solver and return a
983
- * pure `TimingFunction` — `(t: number) => number` over t∈[0,1] — that
984
- * `ElementMorph`, `NumericAnimation`, and `Animation.addFrame` accept
985
- * directly (anywhere a `TimingFunction` is taken).
2501
+ * Sample a `SpringProgress(target=1, initial=0)` solver and return a typed
2502
+ * {@link Easing}: `.fn` is the callable curve — `(t: number) => number`
2503
+ * over t∈[0,1] — that `ElementMorph`, `NumericAnimation`, and
2504
+ * `Animation.addFrame` accept directly, and `.css` is the CSS `linear()`
2505
+ * string that reproduces it (same solver, same preset), so a WAAPI
2506
+ * delegation runs the true overshoot/settle on the compositor.
986
2507
  *
987
2508
  * This is the JS-easing sibling of `springLinearStops`: same solver,
988
2509
  * same `(response, dampingFraction)` surface, same default
989
2510
  * `maxDuration = response * 4`. Where `springLinearStops` emits a CSS
990
- * `linear()` string for stylesheets/tokens, this returns a closure for
991
- * code paths that drive interpolation directly and cannot consume a
992
- * `linear()` string.
2511
+ * `linear()` string for stylesheets/tokens, this returns the typed pair
2512
+ * for code paths that drive interpolation directly.
993
2513
  *
994
- * The returned curve satisfies `f(0) = 0` and `f(1) = 1` exactly.
995
- * Interior values may exceed 1 for ζ < 1 (overshoot) — e.g. the bouncy
2514
+ * The curve satisfies `fn(0) = 0` and `fn(1) = 1` exactly. Interior
2515
+ * values may exceed 1 for ζ < 1 (overshoot) — e.g. the bouncy
996
2516
  * `response 0.5 / ζ 0.45` preset peaks at ≈ 1.205 mid-curve — which is
997
2517
  * the whole point: feeding this into `ElementMorph` produces the
998
2518
  * canonical iOS spring overshoot without hand-rolling stops or a
@@ -1002,7 +2522,7 @@ export declare type SpringSubscriber = (value: number, velocity: number) => void
1002
2522
  * const spring = springTimingFunction({ response: 0.5, dampingFraction: 0.45 });
1003
2523
  * const morph = new ElementMorph(from, to, { timingFunction: spring });
1004
2524
  */
1005
- export declare function springTimingFunction(opts: SpringTimingFunctionOptions): TimingFunction;
2525
+ export declare function springTimingFunction(opts: SpringTimingFunctionOptions): Easing;
1006
2526
 
1007
2527
  /**
1008
2528
  * Options for sampling a spring response curve into a callable
@@ -1036,49 +2556,119 @@ export declare interface SpringTimingFunctionOptions {
1036
2556
  maxDuration?: number;
1037
2557
  }
1038
2558
 
2559
+ /** Spring-eased wobble — gentle spring (ζ 0.95) for a soft attention nudge. */
2560
+ declare const springWobble: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2561
+
2562
+ /**
2563
+ * Build a per-index delay generator. Pure construction-time — the returned
2564
+ * function does only arithmetic, so it costs nothing on the hot path.
2565
+ *
2566
+ * @param countOrItems — the run length, or an array whose `.length` is used.
2567
+ * @param options — `{ each, from, ease }`; see {@link StaggerOptions}.
2568
+ */
2569
+ export declare function stagger(countOrItems: number | ArrayLike<unknown>, options?: StaggerOptions): StaggerFn;
2570
+
2571
+ /**
2572
+ * A per-index delay function: `(i, total) => delayMs`. Carries a
2573
+ * `.delays(total)` helper that materializes the whole distribution as an
2574
+ * array — convenient when the count is known up front.
2575
+ */
2576
+ export declare interface StaggerFn {
2577
+ (index: number, total: number): number;
2578
+ /** Materialize the delays for a run of `total` indices. */
2579
+ delays(total: number): number[];
2580
+ }
2581
+
2582
+ export declare interface StaggerOptions {
2583
+ /**
2584
+ * Per-step delay in milliseconds — the increment between adjacent indices
2585
+ * for a linear `from: "first"` ramp, and the unit the whole distribution
2586
+ * scales by. Defaults to `100`.
2587
+ */
2588
+ each?: number;
2589
+ /** The origin of the distribution. Defaults to `"first"`. */
2590
+ from?: StaggerOrigin;
2591
+ /**
2592
+ * Reshapes the (normalized) distance-from-origin distribution before it is
2593
+ * scaled by `each` — a callable {@link TimingFunction} or a typed
2594
+ * {@link Easing}, value.js-free. A string easing NAME is rejected; resolve
2595
+ * it up front via `await resolveEasing(name)`. Defaults to the identity
2596
+ * (a linear distribution).
2597
+ */
2598
+ ease?: TimingFunction | Easing;
2599
+ }
2600
+
2601
+ /**
2602
+ * Where the stagger originates — the index whose delay is zero, from which
2603
+ * the per-step delay grows outward:
2604
+ *
2605
+ * - `"first"` — index 0 (the default); a monotone ramp `0, each, 2·each, …`.
2606
+ * - `"last"` — the final index; the ramp reversed.
2607
+ * - `"center"`— the midpoint; symmetric, growing toward both ends.
2608
+ * - `"edges"` — both ends at zero; symmetric, growing toward the center.
2609
+ * - a numeric index — an explicit origin; symmetric distance from it.
2610
+ */
2611
+ export declare type StaggerOrigin = "first" | "last" | "center" | "edges" | number;
2612
+
2613
+ /**
2614
+ * The minimal geometry contract DrawSVG needs: any SVG element that exposes
2615
+ * `getTotalLength()` (`SVGGeometryElement` — `<path>`, `<line>`, `<circle>`,
2616
+ * `<ellipse>`, `<rect>`, `<polygon>`, `<polyline>`). Narrower than `SVGElement`
2617
+ * so a non-geometry SVG node is a type error at the call site, not a runtime
2618
+ * surprise.
2619
+ */
2620
+ export declare type SVGDrawTarget = SVGElement & {
2621
+ getTotalLength(): number;
2622
+ };
2623
+
1039
2624
  export declare interface TemplateAnimationFrame<V extends Vars> {
1040
2625
  id: number;
1041
2626
  start: ValueUnit;
1042
2627
  vars: V;
1043
2628
  transform?: TransformFunction<V>;
1044
- timingFunction?: TimingFunction;
2629
+ timingFunction?: Easing;
2630
+ }
2631
+
2632
+ declare const textFocusBlur: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2633
+
2634
+ /**
2635
+ * A dt-driven stepper the {@link RAFPlayback.drive} loop can own:
2636
+ * `SmoothProgress` and `SpringProgress` implement it directly. The driver
2637
+ * steps `tickDt(dt)` once per frame until `settled` flips true.
2638
+ */
2639
+ export declare interface Tickable {
2640
+ /** Advance the stepper by `dt` milliseconds; returns the new value. */
2641
+ tickDt(dt: number): number;
2642
+ /** True when the stepper has converged — the driver stops the loop. */
2643
+ readonly settled: boolean;
1045
2644
  }
1046
2645
 
1047
2646
  export declare abstract class Timeline {
1048
2647
  private smoother;
1049
- private _easing;
2648
+ private _easingFn;
1050
2649
  private currentProgress;
1051
2650
  private boundaryEpsilon;
1052
2651
  constructor(options?: TimelineOptions);
1053
- /**
1054
- * Resolve a pending string easing *name* through the dynamic engine
1055
- * boundary. No-op (resolved promise) for callable / omitted easing.
1056
- * Resolution is already kicked off eagerly at construction; `await
1057
- * timeline.ready()` before the first `tick()` to apply the eased value
1058
- * immediately rather than letting it land asynchronously.
1059
- */
1060
- ready(): Promise<void>;
1061
2652
  /** Subclass returns raw [0,1] progress from its source. */
1062
2653
  protected abstract sample(): number;
1063
2654
  /**
1064
2655
  * Shared progress pipeline: sample → clamp → easing → boundary snap.
1065
2656
  * Returns the processed raw value. Does NOT advance the smoother —
1066
- * the caller (tick or tickDt) drives the smoother with the appropriate
1067
- * time-step method.
2657
+ * `_advance` drives it.
1068
2658
  */
1069
2659
  private applyPipeline;
1070
2660
  /**
1071
- * Finalize progress after the smoother has been advanced (or bypassed).
1072
- * Snaps the smoother at boundaries [0, 1] for instant convergence.
2661
+ * Shared advance step: pipeline → ONE `setTarget` → ONE branch. At a
2662
+ * boundary ([0,1]) the smoother snaps for instant convergence; in the
2663
+ * interior it steps `tickDt(dt)` (the canonical ms step). Returns the
2664
+ * resulting progress.
1073
2665
  */
1074
- private finalizeProgress;
2666
+ private _advance;
1075
2667
  /**
1076
- * Shared advance step. When `dt` is undefined, drives the
1077
- * smoother in frame-rate-dependent mode (`tick()`); when given,
1078
- * uses the frame-rate-independent variant (`tickDt(dt)`).
2668
+ * Advance one frame at a nominal 60fps step. Applies
2669
+ * easing → boundary snap → smoothing. Use {@link tickDt} when you own
2670
+ * a real frame clock.
1079
2671
  */
1080
- private _advance;
1081
- /** Advance one frame. Applies easing → boundary snap → smoothing. */
1082
2672
  tick(): number;
1083
2673
  /** Frame-rate independent variant. `dt` in milliseconds. */
1084
2674
  tickDt(dt: number): number;
@@ -1093,20 +2683,19 @@ export declare abstract class Timeline {
1093
2683
 
1094
2684
  export declare interface TimelineOptions {
1095
2685
  /**
1096
- * Easing as a callable `TimingFunction`, OR a string easing *name*
1097
- * from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`, …).
2686
+ * Easing as a callable `TimingFunction` or a typed `Easing` — both
2687
+ * synchronous and value.js-free, so the `Timeline` family never touches
2688
+ * the dynamic boundary.
1098
2689
  *
1099
- * A **callable** is applied directly and keeps `Timeline` value.js-free.
2690
+ * A string easing *name* is NOT accepted here (fail-explicit: it
2691
+ * throws). Resolve a name once, up front, through the async factory:
1100
2692
  *
1101
- * A **string name** is resolved through the dynamic engine boundary via
1102
- * the shared `EasingResolvable` contract: the constructor kicks off an
1103
- * eager `await import(...)` and the resolved easing is applied once it
1104
- * lands (subsequent `tick()`s use it). Until then `tick()` runs with the
1105
- * identity easing and emits a one-time dev-only warning. Consumers that
1106
- * need the eased value on the very first `tick()` can
1107
- * `await timeline.ready()` first.
1108
- */
1109
- easing?: TimingFunction | TimingFunctionNames | undefined;
2693
+ * ```ts
2694
+ * const easing = await resolveEasing("ease-out-cubic");
2695
+ * new ScrollTimeline({ easing });
2696
+ * ```
2697
+ */
2698
+ easing?: TimingFunction | Easing | undefined;
1110
2699
  /** SmoothProgress config. `false` disables smoothing. Default: enabled. */
1111
2700
  smoothing?: Partial<SmoothProgressOptions> | false | undefined;
1112
2701
  /**
@@ -1123,10 +2712,30 @@ export declare type TimingFunction = (t: number) => number;
1123
2712
 
1124
2713
  export declare type TimingFunctionNames = keyof typeof timingFunctions;
1125
2714
 
2715
+ /**
2716
+ * Normalize a callable or typed easing to {@link Easing}. Synchronous and
2717
+ * value.js-free — the light-engine input normalizer.
2718
+ */
2719
+ export declare const toEasing: (input: TimingFunction | Easing) => Easing;
2720
+
1126
2721
  export declare type TransformFunction<V extends Vars> = (v: V, t: number) => void;
1127
2722
 
2723
+ declare const typewriter: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2724
+
2725
+ declare const typingCursor: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2726
+
2727
+ /** Thrown when a string easing name cannot be resolved through the registry. */
2728
+ export declare class UnknownEasingError extends Error {
2729
+ readonly easingName: string;
2730
+ constructor(easingName: string);
2731
+ }
2732
+
1128
2733
  export declare type Vars<T = any> = {
1129
2734
  [arg: string]: number | string | T;
1130
2735
  };
1131
2736
 
2737
+ declare const warpLeft: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2738
+
2739
+ declare const warpRight: (options?: InputAnimationOptions) => CSSKeyframesAnimation< Vars>;
2740
+
1132
2741
  export { }