@mkbabb/keyframes.js 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,10 @@ import { BezierPresetName } from '@mkbabb/value.js/easing';
5
5
  import { CSSAnimationOptions } from '@mkbabb/value.js/css';
6
6
  import { CSSPropertyDescriptor } from '@mkbabb/value.js/css';
7
7
  import { CSSTimelineOptions } from '@mkbabb/value.js/css';
8
+ import { CssTimeUnit } from '@mkbabb/value.js/css';
8
9
  import { CssValue } from '@mkbabb/value.js/value';
9
10
  import { CustomFunctionDescriptor } from '@mkbabb/value.js/css';
11
+ import { EasingFunction } from '@mkbabb/value.js/easing';
10
12
  import { HueInterpolationMethod } from '@mkbabb/value.js/color';
11
13
  import { KeyframeSelector } from '@mkbabb/value.js/css';
12
14
  import { ParseIssue } from '@mkbabb/value.js/css';
@@ -126,6 +128,16 @@ export declare interface AnimationEngine {
126
128
  formatCSSKeyframeString: typeof formatCSSKeyframeString;
127
129
  transformTargetsStyle: typeof transformTargetsStyle;
128
130
  yieldToMain: typeof yieldToMain;
131
+ /** The CSS-ident normalizer — ONE derivation for every emitted name. */
132
+ cssIdent: typeof cssIdent;
133
+ /** ms → the CSS time literal the emitters write. */
134
+ reverseCSSTime: typeof reverseCSSTime;
135
+ /** A parsed timing function → its CSS literal. */
136
+ serializeTimingFunction: typeof serializeTimingFunction;
137
+ /** SYNCHRONOUS name→fn easing resolution (KF-ET-32). */
138
+ resolveTimingFunction: typeof resolveTimingFunction;
139
+ /** The registry roster behind it — `[name, fn]`, stable, not injective. */
140
+ timingFunctionEntries: typeof timingFunctionEntries;
129
141
  }
130
142
 
131
143
  /** Consumer-observable data for one compiled keyframe segment. */
@@ -169,8 +181,17 @@ export declare class AnimationGroup<V extends Vars> {
169
181
  paused: boolean;
170
182
  started: boolean;
171
183
  done: boolean;
172
- /** When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
173
- * every child to its final frame in one composite, no rAF loop. Default false. */
184
+ /**
185
+ * When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
186
+ * every child to its final frame in one composite, no rAF loop.
187
+ *
188
+ * **Default `true`** — X.KF.W5 ruling KF-W5R4(3) (COHESION §0j.C): the PRM
189
+ * default is INVERTED to honouring the preference, one honest default in one
190
+ * engine. Until that ruling the group defaulted `false` while its sibling
191
+ * organ `startViewTransition` defaulted `true`, so two organs of one engine
192
+ * disagreed and the honest default *"existed in-house and was used nowhere"*
193
+ * (KF-KC-27). Set `false` for the explicit opt-out.
194
+ */
174
195
  respectReducedMotion: boolean;
175
196
  /** Children-per-slice before `advanceTo()` yields to the main thread; larger
176
197
  * groups batch with a `scheduler.yield()` between slices (INP relief). */
@@ -179,7 +200,36 @@ export declare class AnimationGroup<V extends Vars> {
179
200
  * genuine-ownership replacement for the excised `KeyframesAnimation.group()`
180
201
  * service locator; each input is a bare animation or `{ animation, layer }`). */
181
202
  static of<V extends Vars>(first: KeyframesAnimation<V> | AnimationGroupInput<V>, ...rest: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]): AnimationGroup<V>;
182
- singleTarget: boolean;
203
+ /** The pre-ruling field default, unchanged; `_singleTargetDeclared` is set
204
+ * once a caller ASSIGNS the property (the supported opt-out). */
205
+ private _singleTarget;
206
+ private _singleTargetDeclared;
207
+ /**
208
+ * True when every child animates the SAME first target, so the group can
209
+ * composite one shared element per frame (the SoA blend + the group-WAAPI
210
+ * fast lane both gate on it).
211
+ *
212
+ * **Assigning it DECLARES it** — X.KF.W5 ruling KF-W5R4(4) (COHESION §0j.C):
213
+ * `singleTarget` gains a SUPPORTED opt-out. Before it, `group.singleTarget =
214
+ * false` was a raw poke the post-mount recompute in {@link setTargets}
215
+ * silently reverted (LP-1's rider; the demo's `CopyButton`/`SquareScene`
216
+ * pokes are the live witnesses), so the group disagreed with its own caller
217
+ * and the KF-CB-15 target-less derivation (`undefined === undefined → true`)
218
+ * could not be opted out of at all. Every recompute honours a declaration;
219
+ * {@link deriveSingleTarget} gives the derived mode back.
220
+ */
221
+ get singleTarget(): boolean;
222
+ set singleTarget(value: boolean);
223
+ /**
224
+ * Drop a {@link singleTarget} declaration and return to derivation — the
225
+ * inverse of the supported opt-out, so a declaration is reversible without
226
+ * reconstructing the group. Re-derives immediately from the current entries.
227
+ */
228
+ deriveSingleTarget(): this;
229
+ /** The ONE derivation of `singleTarget` — shared by the constructor and the
230
+ * `setTargets` recompute so they can never drift apart, and a NO-OP while a
231
+ * caller's declaration stands (KF-W5R4(4)). */
232
+ private _deriveSingleTarget;
183
233
  /**
184
234
  * T.A6 — true when the group's composite `transform` is a CUSTOM (non-DOM)
185
235
  * consumer that expects the nested PLAIN authored-shape projection (the
@@ -206,6 +256,8 @@ export declare class AnimationGroup<V extends Vars> {
206
256
  /** Pre-bound frame callback — allocated once to avoid a per-loop closure.
207
257
  * INTERNAL (S.B5) — read by `./lifecycle`'s `play`/`resume` loop start. */
208
258
  _boundFrame: (t: number) => boolean | Promise<boolean>;
259
+ /** The `onRender` observers (KFA-31). */
260
+ private readonly _renders;
209
261
  /** Cached entries sorted by layer zIndex (see `getEntries`). */
210
262
  private _entries;
211
263
  private _entriesDirty;
@@ -218,7 +270,7 @@ export declare class AnimationGroup<V extends Vars> {
218
270
  constructor(...inputs: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]);
219
271
  /** The animation entries sorted by layer zIndex, dirty-flag cached — rebuilt
220
272
  * only on a mutation. INTERNAL (R.W2): read by the colocated `./compositor`/
221
- * `./entries`/`./scheduler`/`./springs` helpers + all hot-path iteration. */
273
+ * `./entries`/`./yield-batch`/`./springs` helpers + all hot-path iteration. */
222
274
  getEntries(): AnimationGroupEntry<V>[];
223
275
  /** Mark entries cache stale. Called at all mutation boundaries.
224
276
  * INTERNAL (R.W2) — also called by `./layer-api`. */
@@ -238,17 +290,26 @@ export declare class AnimationGroup<V extends Vars> {
238
290
  * (0 for a never-ticked group), never a fabricated wall-clock.
239
291
  */
240
292
  render(t?: number): void;
293
+ /** Observe every frame the group paints (each draw-loop tick, `render()`,
294
+ * `reset()`) with its clock; returns the unsubscribe. A paused group
295
+ * notifies nothing. See `./render-observers` (KFA-31 · KFA-85). */
296
+ onRender(listener: (t: number) => void): () => void;
241
297
  /** Set a child's current time without touching its siblings (updates
242
298
  * `pausedTime` for a jump-free resume). Chainable; `render()` to reflect it. */
243
299
  setChildTime(nameOrAnim: string | KeyframesAnimation<V>, t: number): this;
300
+ /** KFA-69 — the group-level seek: seat EVERY child at the group's one
301
+ * master elapsed time (ms since its start), each at its own phase of it
302
+ * (modulo its duration, within its iteration count), so phase-locked
303
+ * children stay locked under a scrub. Chainable; `render()` to reflect it.
304
+ * Body in `./seek`. */
305
+ seek(elapsed: number): this;
306
+ /** The master elapsed time a child's current position sits at (its delay +
307
+ * its completed iterations + its `t`) — the read `seek` inverts. */
308
+ elapsedOf(nameOrAnim: string | KeyframesAnimation<V>): number;
244
309
  /** Advance all child animations to absolute clock `t`. SYNC on the steady path
245
310
  * (J.W6 S1): all-synchronous children advance with no per-frame microtask hop;
246
311
  * a thenable only on an async child or the over-`YIELD_BATCH` yield path. */
247
312
  advanceTo(t: number): this | Promise<this>;
248
- /** One frame of the group's draw loop: tick all children, then render. */
249
- private _frame;
250
- /** The post-advance render half of `_frame` — composite, or settle on done. */
251
- private _renderFrame;
252
313
  /** The completion front-door (G.W13) — `await group.finished` resolves once
253
314
  * the in-flight composite play settles. Exposes the ONE held `_playingPromise`
254
315
  * (a settled/never-played group resolves immediately). */
@@ -419,7 +480,16 @@ declare type AnimationOptionErrorCode = "EMPTY_PARSE" | "UNKNOWN_TIMING_FN" | "N
419
480
 
420
481
  export declare type AnimationOptions = {
421
482
  duration: number;
483
+ /**
484
+ * The `<time>` unit the author wrote for `duration` (UIA-KF-177): set from
485
+ * value.js's `CSSAnimationOptions.durationUnit` at ingest, so every emit
486
+ * writes the number back in it. Absent for a programmatic number, which
487
+ * emits in its shortest exact spelling.
488
+ */
489
+ durationUnit?: CssTimeUnit;
422
490
  delay: number;
491
+ /** The `<time>` unit the author wrote for `delay` (UIA-KF-177); see `durationUnit`. */
492
+ delayUnit?: CssTimeUnit;
423
493
  iterationCount: number;
424
494
  direction: (typeof DIRECTIONS)[number];
425
495
  fillMode: (typeof FILL_MODES)[number];
@@ -700,15 +770,45 @@ export declare function createScrollScene(spec?: ScrollSceneOptions | CSSTimelin
700
770
  */
701
771
  export declare function createTriggerScene(spec?: AnimationTriggerValue | CSSTimelineOptions): TriggerScene;
702
772
 
773
+ /**
774
+ * A CSS `<easing-function>` written as TEXT — the second legitimate spelling of
775
+ * an easing at the option surface, beside a registry {@link TimingFunctionNames}
776
+ * name (X.KF.W4 KF-CB-29, COHESION §0m.1 candidate (ii)).
777
+ *
778
+ * This type exists because the arm it replaces — a bare `| string` on
779
+ * `InputAnimationOptions["timingFunction"]` — made `tsc` green on EVERY string,
780
+ * so the name union beside it was decorative at the only surface a consumer
781
+ * actually writes through. That arm is the mechanism by which a renamed easing
782
+ * shipped with a green typecheck over a name that had ceased to exist. Deleting
783
+ * it outright is the WRONG cure and the tree says so by measurement: at
784
+ * `3e81f500` a bare deletion reddens **14 library diagnostics** — 13 in the
785
+ * SHIPPED preset catalogue (`presets/catalog.ts`, every one a `cubic-bezier()`
786
+ * or `steps()` literal the library authors itself) and one at
787
+ * `engine/css/metadata.ts:63`. Those literals are not sloppiness; they are the
788
+ * grammar. So the arm is NARROWED to that grammar rather than removed.
789
+ *
790
+ * The members are CSS Easing L1/L2's own: the seven keywords, and the three
791
+ * functional forms. The functional arms are deliberately `${string}`-bodied — a
792
+ * template literal type cannot validate a numeric argument list, and pretending
793
+ * otherwise would trade one false claim for another. What it DOES buy is total:
794
+ * a string that is neither a registry name nor shaped like a CSS easing function
795
+ * no longer typechecks, which is the whole of KF-CB-29.
796
+ *
797
+ * `compile/emit/css-text.ts`'s `serializeTimingFunction` returns this type, so
798
+ * the library's own serializer output flows back into the option surface
799
+ * without widening it.
800
+ */
801
+ declare type CssEasingLiteral = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | `cubic-bezier(${string})` | `steps(${string})` | `linear(${string})`;
802
+
803
+ /**
804
+ * Normalize a child name to a CSS-safe ident (the `@keyframes`/class name). A
805
+ * bare numeric id (`getAnimationId` falls back to `String(id)`) gets an `a`
806
+ * prefix so the `@keyframes` name is a valid CSS identifier; collisions are
807
+ * de-duped by the walker via a `-2`/`-3` suffix.
808
+ */
809
+ export declare function cssIdent(name: string): string;
810
+
703
811
  export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnimation<V> {
704
- /**
705
- * Q.WD1-bind S2 (DM-22) — the timeline a scroll-range named selector resolves
706
- * its phase against. Stored by {@link bindTimeline} for the no-timeline guard's
707
- * check; `undefined` until a timeline is bound. A scroll-context operation
708
- * specific to CSS keyframes with named selectors (the base `Animation` class is
709
- * value.js-/scroll-agnostic), so the field + method live here.
710
- */
711
- private _boundTimeline?;
712
812
  constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
713
813
  /**
714
814
  * Q.WD1-bind S2 (DM-22) — the attach-time deferred-resolution seam. A
@@ -725,6 +825,15 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
725
825
  *
726
826
  * Idempotent + safe to call before `fromString`: with no named frames the walk
727
827
  * is a no-op; calling it after a NaN-producing `parse()` purges the NaN frames.
828
+ *
829
+ * `timeline` is the BINDING the caller declares, and the resolution below does
830
+ * not read it: `namedSelectorToFraction` maps a phase NAME to a fraction, which
831
+ * is timeline-independent. It was formerly stashed on a private
832
+ * `_boundTimeline` field described as feeding "the no-timeline guard's check" —
833
+ * a consumer that does not exist (the guard is `engine/interpolate.ts` and
834
+ * reads the frames' own resolved state, never the field). The field and that
835
+ * prose are deleted together at X.KF.W4 K3 / R-9's else-branch; the parameter
836
+ * stays because it is this method's public contract.
728
837
  */
729
838
  bindTimeline(timeline: Timeline): this;
730
839
  /**
@@ -733,6 +842,16 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
733
842
  * unflattened); genuine omission resolves to the instance's ONE
734
843
  * default DOM-style renderer, which keeps WAAPI eligibility a
735
844
  * reference comparison (`usesDefaultRenderer`).
845
+ *
846
+ * That reference comparison is per-INSTANCE, so it only survives a seam
847
+ * that respects instance ownership. `engine/compile-bridge.ts`'s
848
+ * `adoptCompiled` is the one seam that moves compiled frames between
849
+ * animations, and it upholds this contract there (X.KF.W5 C-1 /
850
+ * G-RENDERER): the renderer stays the RECEIVER's unless the source
851
+ * declared one of its own. Before that, adopting a throwaway compiled
852
+ * with no transform — the editor's own recompile — replaced a consumer's
853
+ * renderer with a foreign instance's default, and every frame then
854
+ * answered `usesDefaultRenderer` FALSE for a renderer nobody supplied.
736
855
  */
737
856
  private resolveTransform;
738
857
  fromVars(vars: V[], transform?: TransformFunction<V>): this;
@@ -1329,13 +1448,31 @@ declare type FlatAuthoredValues = Record<string, AuthoredValue | undefined>;
1329
1448
  /**
1330
1449
  * Animate a layout change on `element`: measure (First), run `mutate` (Last),
1331
1450
  * measure again, then invert + play the transform between them via
1332
- * {@link ElementMorph}. Returns the play promise.
1451
+ * {@link ElementMorph}. Returns a {@link FlipHandle} — the play promise with a
1452
+ * `cancel()`.
1453
+ *
1454
+ * Interruptible: called on an element whose previous flip is still playing,
1455
+ * First is the element's CURRENT interpolated rect (the live visual box), the
1456
+ * previous play is halted (its handle settles), and the new play glides on
1457
+ * from that frame toward the new Last — no snap, no queue.
1333
1458
  *
1334
1459
  * @param element — the element whose layout `mutate` changes.
1335
1460
  * @param mutate — a synchronous DOM mutation (class toggle, reparent, …).
1336
1461
  * @param options — `{ duration, timingFunction, transformOrigin }`.
1337
1462
  */
1338
- export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): Promise<void>;
1463
+ export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): FlipHandle;
1464
+
1465
+ /**
1466
+ * The handle `flip` / `flipShared` return: the play promise (it resolves when
1467
+ * the play completes, or as soon as it is cancelled or re-targeted), extended
1468
+ * with `cancel()`. `cancel()` halts the play at its current frame — the
1469
+ * element keeps that frame's inline transform, so a following `flip` on it
1470
+ * glides on from exactly there.
1471
+ */
1472
+ export declare type FlipHandle = Promise<void> & {
1473
+ /** Halt the play at its current frame and settle the promise. */
1474
+ cancel(): void;
1475
+ };
1339
1476
 
1340
1477
  export declare interface FlipOptions {
1341
1478
  /** Playback duration in milliseconds. Defaults to `300`. */
@@ -1355,18 +1492,42 @@ declare const flipPreset: PresetFactory;
1355
1492
  * Shared-element FLIP: animate element `a` onto the rect of element `b`
1356
1493
  * (Motion's `layoutId` / GSAP Flip shared-element style). Unlike `flip`, `a`
1357
1494
  * does NOT move in the DOM — it stays at its own rect (First) and the morph
1358
- * carries it FORWARD onto `b`'s rect (Last). So this is a plain forward
1359
- * {@link ElementMorph} play (identity at t=0 → full delta at t=1), not the
1360
- * inversion `flip` runs.
1495
+ * carries it FORWARD onto `b`'s rect (Last): identity at t=0 → full delta at
1496
+ * t=1. Returns a {@link FlipHandle}.
1361
1497
  *
1362
- * The two reads are batched — one forced layout each, before any write.
1498
+ * Interruptible like `flip`: re-targeting `a` (onto a new `b`) mid-flight
1499
+ * starts from `a`'s current interpolated rect and halts the previous play.
1500
+ *
1501
+ * The reads are batched — one forced layout each, before any play write.
1363
1502
  *
1364
1503
  * @param a — the element to animate.
1365
1504
  * @param b — the element whose rect `a` morphs onto.
1366
1505
  * @param options — `{ duration, timingFunction, transformOrigin }`.
1367
1506
  */
1368
- export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): Promise<void>;
1507
+ export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): FlipHandle;
1369
1508
 
1509
+ /**
1510
+ * The editor card's presentation trim: given ONE per-stop string from
1511
+ * {@link CSSKeyframesToStrings} (`"0%\n{\n opacity: 0;\n}\n"`), return the
1512
+ * declarations alone, un-indented — the `<pre>` the card renders.
1513
+ *
1514
+ * X.KF.W2 (G-W2-3) — RE-IMPLEMENTED, not deleted. The symbol is published on
1515
+ * four barrels (`emit/format/index.ts`, `emit/index.ts`, `compile/index.ts`,
1516
+ * `public.ts`), declared on the lazy engine surface (`load-engine.ts`), and held
1517
+ * live by the demo (`KeyframeCardList.vue` binds this function by reference), so
1518
+ * the export, the signature and every one of those sites stand. What died is the
1519
+ * BODY: four anonymous regexes (`/^[^{]*{/`, `/^ /gm`, `/}\s*$/`, `/^ /`) that
1520
+ * re-read kf's own emission as if it were unknown text.
1521
+ *
1522
+ * This stays a pure string trim and adds NO grammar edge — deliberately. It is
1523
+ * FORMATTING, not parsing: the card's own comment declares it "a value.js-free
1524
+ * pure-string trim" and routing a presentation helper through the CSS grammar
1525
+ * would falsify that at a call site this wave does not own. The cut points are
1526
+ * therefore named as positions and the indent is stripped per line, which is
1527
+ * what the regexes meant; measured byte-identical to the old body across the
1528
+ * card shapes and the degenerate ones (no brace, empty, trailing text, an inner
1529
+ * `{` inside a `url()`).
1530
+ */
1370
1531
  export declare function formatCSSKeyframeString(keyframe: string): string;
1371
1532
 
1372
1533
  /**
@@ -1554,13 +1715,25 @@ export declare interface IngestResult<V extends Vars = Vars> {
1554
1715
  diagnostics: Diagnostic[];
1555
1716
  }
1556
1717
 
1718
+ /**
1719
+ * The AUTHORED option bag — every field already optional, because the type IS a
1720
+ * `Partial<…>`. **Never write `Partial<InputAnimationOptions>`**: it is a
1721
+ * tautology (X.KF.W5 B-20 ≡ KF-CB-35). The wrapper spread from the library's own
1722
+ * signatures into consumer code, where a reader reasonably concluded the bare
1723
+ * type must be required-by-default; the library's four in-bounds signatures drop
1724
+ * it at source so there is nothing left to copy.
1725
+ */
1557
1726
  export declare type InputAnimationOptions = Partial<{
1558
1727
  duration: number | string;
1728
+ /** The authored unit of `duration`; it pairs with the number it rides with. */
1729
+ durationUnit: CssTimeUnit;
1559
1730
  delay: number | string;
1731
+ /** The authored unit of `delay`; it pairs with the number it rides with. */
1732
+ delayUnit: CssTimeUnit;
1560
1733
  iterationCount: number | string | "infinite" | undefined;
1561
1734
  direction: (typeof DIRECTIONS)[number];
1562
1735
  fillMode: (typeof FILL_MODES)[number];
1563
- timingFunction: TimingFunction | Easing | TimingFunctionNames | string | undefined;
1736
+ timingFunction: TimingFunction | Easing | TimingFunctionNames | CssEasingLiteral | undefined;
1564
1737
  /** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
1565
1738
  useWAAPI: boolean;
1566
1739
  /** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
@@ -1650,7 +1823,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1650
1823
  /** The consumer's EXPLICIT constructor options (NOT merged with defaults) —
1651
1824
  * retained so `fromString` can layer a parsed style-rule `animation`
1652
1825
  * shorthand UNDER them (constructor-explicit wins, F.W8). */
1653
- protected _ctorOptions: Partial<InputAnimationOptions>;
1826
+ protected _ctorOptions: InputAnimationOptions;
1654
1827
  /** The compile-stable union of this animation's interpolated keys. */
1655
1828
  get flatKeys(): readonly string[];
1656
1829
  /**
@@ -1668,11 +1841,21 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1668
1841
  * access (the old `PlaybackHost` re-publication + cast are excised).
1669
1842
  */
1670
1843
  dispatchAnimationEvent(type: string): void;
1671
- constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
1844
+ constructor(options?: InputAnimationOptions, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
1672
1845
  get templateFrames(): TemplateAnimationFrame<V>[];
1673
1846
  set templateFrames(value: TemplateAnimationFrame<V>[]);
1674
1847
  get parsedVars(): ParsedVarMap[];
1675
1848
  get frames(): AnimationFrame<V>[];
1849
+ private _compiled;
1850
+ /**
1851
+ * True once `parse()` has compiled the CURRENT template set; false again the
1852
+ * moment that set changes. X.KF.W5 B-13 (KF-TFP-27, G-OPTSET): `frames`
1853
+ * yields `[]` both BEFORE a parse and for an animation with no segments, and
1854
+ * those are not the same fact — so a per-frame write could silently no-op
1855
+ * while REPORTING SUCCESS, on a precondition the caller *"neither asserts
1856
+ * nor can observe"*. It can observe it here.
1857
+ */
1858
+ get compiled(): boolean;
1676
1859
  get frameId(): number;
1677
1860
  /** Append a template frame (delegated to the compiler). Chainable. */
1678
1861
  addFrame<K extends V>(start: number | string | KeyframeSelector, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): KeyframesAnimation<K>;
@@ -1697,7 +1880,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1697
1880
  setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
1698
1881
  setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
1699
1882
  setComposite(composite: InputAnimationOptions["composite"]): this;
1700
- setOptions(options: Partial<InputAnimationOptions>): this;
1883
+ setOptions(options: InputAnimationOptions): this;
1701
1884
  reverse(): this;
1702
1885
  fillForwards(): void;
1703
1886
  fillBackwards(): void;
@@ -1793,6 +1976,20 @@ export declare interface KeyframesScrollTimelineOptions extends TimelineOptions
1793
1976
  */
1794
1977
  declare type LayerTransitionSpring = Partial<Omit<SpringProgressOptions, "initial" | "initialVelocity">>;
1795
1978
 
1979
+ /**
1980
+ * KF-3 — serialize evenly spaced curve samples to a CSS `linear()` easing:
1981
+ * `samples[i]` becomes the stop `value (i / (n - 1) · 100)%`, values and
1982
+ * percentages quantized to 5 decimals. Positions are explicit and strictly
1983
+ * monotone, so the string is always grammar-valid, and overshoot values outside
1984
+ * `[0, 1]` ride through (CSS `linear()` permits them). The ONE `linear()`
1985
+ * densify serializer: {@link springTimingLUT}'s table and the compile tier's
1986
+ * universal `TimingFunction` CSS twin both emit through it.
1987
+ *
1988
+ * @example
1989
+ * linearFromSamples(springTimingLUT({ response: 0.5, dampingFraction: 0.45 }));
1990
+ */
1991
+ export declare function linearFromSamples(samples: ArrayLike<number>): string;
1992
+
1796
1993
  /**
1797
1994
  * Resolve the heavy CSS-keyframe engine and its companion front doors.
1798
1995
  *
@@ -2265,6 +2462,15 @@ declare class PlaybackState {
2265
2462
  readonly _boundFrame: (t: number) => boolean | Promise<boolean>;
2266
2463
  readonly _interpOut: Record<string, unknown>;
2267
2464
  startTime: number | undefined;
2465
+ /** KFA-181 — the NEXT iteration's start on the absolute clock, carried
2466
+ * across a non-final wrap (`previous start + duration`) so the overshoot
2467
+ * past the boundary is kept, never re-based at the next frame's clock.
2468
+ * Any external `startTime` write (the class setter) clears it. */
2469
+ carriedStartTime: number | undefined;
2470
+ /** KFA-70 — the rAF clock of the tick that took a FRESH anchor, until the
2471
+ * next rAF tick re-anchors the play to the first presented frame
2472
+ * (`presentAnchor`). Any external `startTime` write clears it. */
2473
+ anchorTick: number | undefined;
2268
2474
  pausedTime: number;
2269
2475
  t: number;
2270
2476
  iteration: number;
@@ -2412,6 +2618,18 @@ export declare class RAFPlayback {
2412
2618
  * restart's freshly-repopulated `_rafId`. On `false` (or a stale
2413
2619
  * generation that finishes) the loop cleans up. `play`/`drive`/`loop`
2414
2620
  * are the three thin entry shapes over this one core.
2621
+ *
2622
+ * A FRAME MAY FAIL, AND FAILING IS NOT WEDGING (X.KF.W5 C-2 / G-RAF).
2623
+ * `step` had no failure path at all: a synchronous throw skipped
2624
+ * `reschedule` outright and a rejected async result met a `.then` with no
2625
+ * rejection arm, so in both shapes `_cleanup` never ran, `_rafId` stayed
2626
+ * populated, `running` stayed TRUE for the lifetime of the driver, and a
2627
+ * pending `play()` promise never settled — every consumer guarding on
2628
+ * `!playback.running` was then a permanent no-op. A failed frame now winds
2629
+ * the loop down through the SAME generation-guarded path a finished one
2630
+ * takes, and then RE-RAISES the failure unchanged: loud (the host's
2631
+ * uncaught-error channel sees the original error, nothing is absorbed) and
2632
+ * recoverable (the next `play`/`drive`/`loop` re-arms).
2415
2633
  */
2416
2634
  private _run;
2417
2635
  /**
@@ -2474,8 +2692,14 @@ export { RangePhase }
2474
2692
  * takes a SCALE, not just a boolean — WCAG 2.3.3-aligned ("shorten the
2475
2693
  * travel, keep the meaning"):
2476
2694
  *
2477
- * - `false` / `undefined` — do not honor reduced motion (the conservative
2478
- * default; the animation runs at full amplitude regardless of the OS query).
2695
+ * - `false` / `undefined` — do not honor reduced motion: the animation runs at
2696
+ * full amplitude regardless of the OS query. This is the policy VALUE's
2697
+ * meaning, NOT the engine's default — X.KF.W5 ruling KF-W5R4(3) (COHESION
2698
+ * §0j.C) INVERTED the orchestrator defaults to `respectReducedMotion: true`
2699
+ * (`AnimationGroup`, `Sequence`, `startViewTransition`), so honouring the
2700
+ * preference is what a caller gets by omission and `false` is the explicit
2701
+ * opt-out. A surface that still seeds `false` by default is named in the
2702
+ * wave record's residual list, not described as "conservative" here.
2479
2703
  * - `true` — the classic binary snap: under an active `prefers-reduced-motion:
2480
2704
  * reduce` the surface jumps to its terminal state (amplitude scale `0`).
2481
2705
  * - a `number` ∈ [0, 1] — the INTENSITY: under an active query the surface
@@ -2615,7 +2839,7 @@ export declare interface ResolvedRange {
2615
2839
  * `"ease-out-cubic"`, … — or a CSS `cubic-bezier()` literal) to a typed
2616
2840
  * {@link Easing}.
2617
2841
  *
2618
- * The lookup rides the dynamic boundary: `import("./compile/easing/easing-registry")`
2842
+ * The lookup rides the dynamic boundary: `import("./compile/easing/registry")`
2619
2843
  * loads ONLY the value.js-bearing timing-function registry (R.W1 narrow — not the
2620
2844
  * full engine chunk; lib-support F7) when a named easing is actually used, so a
2621
2845
  * light-only consumer that never calls this stays value.js-free.
@@ -2700,6 +2924,22 @@ export declare const resolveLiveKeyframes: <V extends Vars = Vars>(source?: Docu
2700
2924
  */
2701
2925
  export declare function resolveRange(range: AnimationRangeValue | undefined): ResolvedRange;
2702
2926
 
2927
+ /** Resolve a callable, canonical Value name, or CSS timing-function literal. */
2928
+ export declare const resolveTimingFunction: (timingFunction: TimingFunction | string) => TimingFunction;
2929
+
2930
+ /**
2931
+ * ms → a CSS time literal, in the unit the author wrote (UIA-KF-177).
2932
+ *
2933
+ * value.js 4.1.0's `CSSAnimationOptions` carries the authored `<time>` unit
2934
+ * beside the number (`durationUnit` / `delayUnit`), and kf's options keep it
2935
+ * from ingest, so an authored `500ms` emits `500ms` and an authored `0.05s`
2936
+ * emits `0.05s`. A time with no authored unit (a programmatic number, an
2937
+ * external stagger offset) has no spelling to keep, so it takes the shortest
2938
+ * exact literal, seconds on a tie (the CSSOM's canonical unit;
2939
+ * X.KF.W13X.r4lib). Every spelling parses back to the same milliseconds.
2940
+ */
2941
+ export declare const reverseCSSTime: (milliseconds: number, unit?: CssTimeUnit) => string;
2942
+
2703
2943
  declare const rotateIn: PresetFactory;
2704
2944
 
2705
2945
  declare const rotateScale: PresetFactory;
@@ -3045,7 +3285,9 @@ export declare class Sequence<V extends Vars = Vars> implements SequencePlayCont
3045
3285
  pause(): this;
3046
3286
  /** Resume a paused sequence — restart the rAF loop with the origin
3047
3287
  * re-anchored so the first resumed frame's master clock equals the retained
3048
- * `_time` (no forward jump). No-op when not paused. Body in `./lifecycle`. */
3288
+ * `_time` (no forward jump). A seeked-only sequence (no play in flight)
3289
+ * begins a play from its playhead (KFA-17); a live unpaused play is left
3290
+ * alone. Body in `./lifecycle`. */
3049
3291
  resume(): this;
3050
3292
  /** Set the scalar playback rate — slow-mo (`< 1`), real-time (`1`),
3051
3293
  * fast-forward (`> 1`), or backward (`< 0`, the {@link reverse} form); the
@@ -3152,8 +3394,9 @@ export declare interface SequenceOptions {
3152
3394
  /**
3153
3395
  * When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
3154
3396
  * every child to its rest frame in a single paint (delegated to each
3155
- * child's own reduced-motion contract via a terminal `seek`). Default
3156
- * false. SSR-safe off-DOM.
3397
+ * child's own reduced-motion contract via a terminal `seek`). **Default
3398
+ * `true`** — X.KF.W5 ruling KF-W5R4(3) (COHESION §0j.C), the engine-wide PRM
3399
+ * default inversion; `false` is the explicit opt-out. SSR-safe off-DOM.
3157
3400
  */
3158
3401
  respectReducedMotion?: boolean;
3159
3402
  }
@@ -3222,6 +3465,8 @@ export declare function serializeScrollOptions(opts: CSSTimelineOptions): {
3222
3465
  "animation-trigger"?: string;
3223
3466
  };
3224
3467
 
3468
+ export declare const serializeTimingFunction: (value: NonNullable<CSSAnimationOptions["timingFunction"]>) => CssEasingLiteral;
3469
+
3225
3470
  declare const shake: PresetFactory;
3226
3471
 
3227
3472
  declare const skeletonLoading: PresetFactory;
@@ -3289,12 +3534,6 @@ export declare class SmoothProgress {
3289
3534
  * Pairs with `.play()`. Does not touch current/target/settled state.
3290
3535
  */
3291
3536
  stop(): void;
3292
- /**
3293
- * Arm the shared driver: it steps `tickDt(dt)` once per frame until
3294
- * `settled` flips true, emitting `onFrame` per step. Idempotent —
3295
- * the driver no-ops while already running.
3296
- */
3297
- private _startLoop;
3298
3537
  }
3299
3538
 
3300
3539
  export declare interface SmoothProgressOptions {
@@ -3358,12 +3597,20 @@ export declare interface SplitTextOptions {
3358
3597
  a11y?: boolean;
3359
3598
  /**
3360
3599
  * The container role applied under `a11y` **only when the element has no
3361
- * role of its own** — a plain `<div>`/`<span>` maps to `role="generic"`,
3362
- * which PROHIBITS an author name, so a bare `aria-label` would not compute.
3600
+ * role of its own — explicit OR implicit** — a plain `<div>`/`<span>` maps
3601
+ * to `role="generic"` and a `<p>` to `role="paragraph"`, both of which
3602
+ * PROHIBIT an author name, so a bare `aria-label` would not compute.
3363
3603
  * Defaults to `"img"` (the canonical "graphical composite whose text
3364
- * alternative is …" role). Pass a naming-capable role to override.
3604
+ * alternative is …" role). Pass a naming-capable role to override, or
3605
+ * `null` to opt out of the role write entirely (the caller owns the role).
3606
+ *
3607
+ * An element whose IMPLICIT role already accepts a name — `<h1>`…`<h6>`,
3608
+ * `<button>`, `<a href>`, the landmarks — keeps it: stamping `role="img"`
3609
+ * over an `<h1>` deletes that heading from the document's heading
3610
+ * hierarchy, which is a bigger a11y loss than the one this option exists
3611
+ * to prevent (X.KF.W5 B-1/G-ROLE).
3365
3612
  */
3366
- role?: string;
3613
+ role?: string | null;
3367
3614
  /** Locale for `Intl.Segmenter` (word/grapheme boundaries). */
3368
3615
  locale?: string;
3369
3616
  /** Options for the ready {@link StaggerFn} built over the cohort. */
@@ -3599,7 +3846,12 @@ export declare class SpringProgress {
3599
3846
  /**
3600
3847
  * Set the target. The closed-form solution is re-seated from the
3601
3848
  * current `(value, velocity)` so the trajectory is continuous.
3602
- * Idempotent if the target is unchanged.
3849
+ * Idempotent if the target is unchanged AND the spring carries no live
3850
+ * velocity. An equal target with nonzero velocity (e.g. right after
3851
+ * `reset(x, v)`, which seats `target = x` and stops the managed loop)
3852
+ * still re-seats — the trajectory is identical (the closed form re-seats
3853
+ * from the current `(x, v)`), and the re-seat re-arms the managed loop so
3854
+ * the spring runs to rest and commits (K-1).
3603
3855
  */
3604
3856
  set target(value: number);
3605
3857
  private reseatTarget;
@@ -3633,6 +3885,15 @@ export declare class SpringProgress {
3633
3885
  * overdamped: x(t) = A e^(r₁ t) + B e^(r₂ t)
3634
3886
  */
3635
3887
  private evaluateAt;
3888
+ /**
3889
+ * The rest the spring travels toward: `origin + s·(target − origin)`.
3890
+ * R-K1-a — at full amplitude (s = 1) that expression is NOT `target` in
3891
+ * floating point for every origin (origin −0.0069, target 1 →
3892
+ * 0.9999999999999999), so a settled spring would rest a float short and a
3893
+ * consumer's `value >= target` never fires. At s = 1 the rest IS the
3894
+ * target, exactly; every other s is the scaled form, unchanged.
3895
+ */
3896
+ private scaledTarget;
3636
3897
  private checkSettled;
3637
3898
  /** Immediately set value = target, zero velocity. */
3638
3899
  snap(): void;
@@ -3806,6 +4067,22 @@ export declare interface SpringTimingFunctionOptions {
3806
4067
  maxDuration?: number;
3807
4068
  }
3808
4069
 
4070
+ /**
4071
+ * KF-3 (atlas A2(b)) — the sampled look-up-table form of
4072
+ * {@link springTimingFunction}: `sampleCount + 1` spring positions at the evenly
4073
+ * spaced normalized times `t = i / sampleCount`, with `lut[0] = 0` and
4074
+ * `lut[sampleCount] = 1` exactly. Built for per-frame and many-mark consumers
4075
+ * (an ECharts series, a canvas of marks, a CSS `linear()` via
4076
+ * {@link linearFromSamples}) that want the samples themselves rather than a
4077
+ * callable. This IS the table `springTimingFunction` interpolates — one sampler,
4078
+ * one solver — so `springTimingFunction(opts).fn(i / n) === lut[i]`.
4079
+ *
4080
+ * @example
4081
+ * const lut = springTimingLUT({ response: 0.5, dampingFraction: 0.45, sampleCount: 120 });
4082
+ * const css = linearFromSamples(lut); // "linear(0 0%, … , 1 100%)"
4083
+ */
4084
+ export declare function springTimingLUT(opts: SpringTimingFunctionOptions): Float64Array;
4085
+
3809
4086
  declare const springWobble: PresetFactory;
3810
4087
 
3811
4088
  /**
@@ -3934,8 +4211,10 @@ declare const textFocusBlur: PresetFactory;
3934
4211
  * `"unit"` (a word or grapheme — an animatable fragment) or `"space"` (inter-unit
3935
4212
  * whitespace — kept as a live text node so the browser can still wrap the run at
3936
4213
  * real break opportunities; the per-glyph inline-blocks otherwise defeat
3937
- * `text-wrap: balance`, the AnimatedText X-5 lesson). Punctuation rides as its
3938
- * own `"unit"` under word granularity (`isWordLike === false` but non-blank).
4214
+ * `text-wrap: balance`, the AnimatedText X-5 lesson). Under word granularity
4215
+ * punctuation rides WITH the word it abuts (KF-1): `Intl.Segmenter` emits `,`
4216
+ * `.` `!` `"` as their own non-word-like segments, and splitting on those made
4217
+ * "Hello," two fragments, so the comma could stagger in late or wrap alone.
3939
4218
  */
3940
4219
  /** One ordered piece of the source text. */
3941
4220
  export declare interface TextSegment {
@@ -4027,7 +4306,41 @@ export declare interface TimelineOptions {
4027
4306
 
4028
4307
  export declare type TimingFunction = (t: number) => number;
4029
4308
 
4030
- export declare type TimingFunctionNames = BezierPresetName | "steps" | "ease-in-bounce" | "easeOutCubic" | "easeInOutSine" | "easeInOutCubic" | "easeInOutQuad" | "easeInOutExpo" | "easeInOutCirc" | "easeOutExpo" | "smoothStep3" | "easeInBounce";
4309
+ /**
4310
+ * The registry roster with each name's curve, evaluated at module top level —
4311
+ * THE BOOT FENCE (G-KF3-6): a `bezierPresets` key value stops accepting is a kf
4312
+ * boot `throw` here, and a key it adds silently widens this public roster.
4313
+ *
4314
+ * The references are value.js's memoised ones, so they are stable but NOT
4315
+ * injective: the 40 names resolve onto **31** distinct references, because nine
4316
+ * hyphen/camel twin pairs (`ease-out-cubic` ≡ `easeOutCubic`, `smooth-step-3` ≡
4317
+ * `smoothStep3`, …) share one value.js function. A reference therefore
4318
+ * identifies the CURVE and never the name that produced it — which is why
4319
+ * `easing-serialize.ts`'s reverse lookup can tell a registry curve from a
4320
+ * closure but cannot recover WHICH name was written, and why G-KFW4-5 proves
4321
+ * identity by sampled value-identity on the 33-point grid rather than by name
4322
+ * equality (COHESION §0j.C KF-SS3). `test/compile/easing-identity.test.ts`
4323
+ * asserts all three facts.
4324
+ */
4325
+ export declare const timingFunctionEntries: readonly (readonly [
4326
+ string,
4327
+ EasingFunction
4328
+ ])[];
4329
+
4330
+ /**
4331
+ * The registry's easing NAMES — exactly the roster
4332
+ * `compile/easing/registry.ts` builds at module evaluation (value.js's
4333
+ * `bezierPresets` keys + `"ease-in-bounce"` + the camel `DIRECT_NAMES`), and
4334
+ * nothing else.
4335
+ *
4336
+ * `"steps"` is NOT a member (X.KF.W4 KF-CB-24): bare `steps` carries no count
4337
+ * and no jump term, so it fails the CSS Easing L1 parse and is absent from
4338
+ * `registryNames` — `resolveTimingFunction("steps")` THROWS on it. The
4339
+ * parametric `steps(4, jump-end)` is a CSS LITERAL, resolved through the parser
4340
+ * branch, never a name. `test/compile/timing-function-names.test.ts`
4341
+ * (G-KFW4-13) asserts this union and the runtime roster are the same set.
4342
+ */
4343
+ export declare type TimingFunctionNames = BezierPresetName | "ease-in-bounce" | "easeOutCubic" | "easeInOutSine" | "easeInOutCubic" | "easeInOutQuad" | "easeInOutExpo" | "easeInOutCirc" | "easeOutExpo" | "smoothStep3" | "easeInBounce";
4031
4344
 
4032
4345
  /**
4033
4346
  * Normalize a callable or typed easing to {@link Easing}. Synchronous and