@mkbabb/keyframes.js 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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];
@@ -491,6 +561,8 @@ declare namespace AnimationPresets {
491
561
  slideInRight,
492
562
  slideOutRight,
493
563
  hover,
564
+ garlandSway,
565
+ unfurl,
494
566
  jumpUp,
495
567
  jumpDown,
496
568
  springScaleIn,
@@ -700,15 +772,45 @@ export declare function createScrollScene(spec?: ScrollSceneOptions | CSSTimelin
700
772
  */
701
773
  export declare function createTriggerScene(spec?: AnimationTriggerValue | CSSTimelineOptions): TriggerScene;
702
774
 
775
+ /**
776
+ * A CSS `<easing-function>` written as TEXT — the second legitimate spelling of
777
+ * an easing at the option surface, beside a registry {@link TimingFunctionNames}
778
+ * name (X.KF.W4 KF-CB-29, COHESION §0m.1 candidate (ii)).
779
+ *
780
+ * This type exists because the arm it replaces — a bare `| string` on
781
+ * `InputAnimationOptions["timingFunction"]` — made `tsc` green on EVERY string,
782
+ * so the name union beside it was decorative at the only surface a consumer
783
+ * actually writes through. That arm is the mechanism by which a renamed easing
784
+ * shipped with a green typecheck over a name that had ceased to exist. Deleting
785
+ * it outright is the WRONG cure and the tree says so by measurement: at
786
+ * `3e81f500` a bare deletion reddens **14 library diagnostics** — 13 in the
787
+ * SHIPPED preset catalogue (`presets/catalog.ts`, every one a `cubic-bezier()`
788
+ * or `steps()` literal the library authors itself) and one at
789
+ * `engine/css/metadata.ts:63`. Those literals are not sloppiness; they are the
790
+ * grammar. So the arm is NARROWED to that grammar rather than removed.
791
+ *
792
+ * The members are CSS Easing L1/L2's own: the seven keywords, and the three
793
+ * functional forms. The functional arms are deliberately `${string}`-bodied — a
794
+ * template literal type cannot validate a numeric argument list, and pretending
795
+ * otherwise would trade one false claim for another. What it DOES buy is total:
796
+ * a string that is neither a registry name nor shaped like a CSS easing function
797
+ * no longer typechecks, which is the whole of KF-CB-29.
798
+ *
799
+ * `compile/emit/css-text.ts`'s `serializeTimingFunction` returns this type, so
800
+ * the library's own serializer output flows back into the option surface
801
+ * without widening it.
802
+ */
803
+ declare type CssEasingLiteral = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | `cubic-bezier(${string})` | `steps(${string})` | `linear(${string})`;
804
+
805
+ /**
806
+ * Normalize a child name to a CSS-safe ident (the `@keyframes`/class name). A
807
+ * bare numeric id (`getAnimationId` falls back to `String(id)`) gets an `a`
808
+ * prefix so the `@keyframes` name is a valid CSS identifier; collisions are
809
+ * de-duped by the walker via a `-2`/`-3` suffix.
810
+ */
811
+ export declare function cssIdent(name: string): string;
812
+
703
813
  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
814
  constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
713
815
  /**
714
816
  * Q.WD1-bind S2 (DM-22) — the attach-time deferred-resolution seam. A
@@ -725,6 +827,15 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
725
827
  *
726
828
  * Idempotent + safe to call before `fromString`: with no named frames the walk
727
829
  * is a no-op; calling it after a NaN-producing `parse()` purges the NaN frames.
830
+ *
831
+ * `timeline` is the BINDING the caller declares, and the resolution below does
832
+ * not read it: `namedSelectorToFraction` maps a phase NAME to a fraction, which
833
+ * is timeline-independent. It was formerly stashed on a private
834
+ * `_boundTimeline` field described as feeding "the no-timeline guard's check" —
835
+ * a consumer that does not exist (the guard is `engine/interpolate.ts` and
836
+ * reads the frames' own resolved state, never the field). The field and that
837
+ * prose are deleted together at X.KF.W4 K3 / R-9's else-branch; the parameter
838
+ * stays because it is this method's public contract.
728
839
  */
729
840
  bindTimeline(timeline: Timeline): this;
730
841
  /**
@@ -733,6 +844,16 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
733
844
  * unflattened); genuine omission resolves to the instance's ONE
734
845
  * default DOM-style renderer, which keeps WAAPI eligibility a
735
846
  * reference comparison (`usesDefaultRenderer`).
847
+ *
848
+ * That reference comparison is per-INSTANCE, so it only survives a seam
849
+ * that respects instance ownership. `engine/compile-bridge.ts`'s
850
+ * `adoptCompiled` is the one seam that moves compiled frames between
851
+ * animations, and it upholds this contract there (X.KF.W5 C-1 /
852
+ * G-RENDERER): the renderer stays the RECEIVER's unless the source
853
+ * declared one of its own. Before that, adopting a throwaway compiled
854
+ * with no transform — the editor's own recompile — replaced a consumer's
855
+ * renderer with a foreign instance's default, and every frame then
856
+ * answered `usesDefaultRenderer` FALSE for a renderer nobody supplied.
736
857
  */
737
858
  private resolveTransform;
738
859
  fromVars(vars: V[], transform?: TransformFunction<V>): this;
@@ -1329,13 +1450,31 @@ declare type FlatAuthoredValues = Record<string, AuthoredValue | undefined>;
1329
1450
  /**
1330
1451
  * Animate a layout change on `element`: measure (First), run `mutate` (Last),
1331
1452
  * measure again, then invert + play the transform between them via
1332
- * {@link ElementMorph}. Returns the play promise.
1453
+ * {@link ElementMorph}. Returns a {@link FlipHandle} — the play promise with a
1454
+ * `cancel()`.
1455
+ *
1456
+ * Interruptible: called on an element whose previous flip is still playing,
1457
+ * First is the element's CURRENT interpolated rect (the live visual box), the
1458
+ * previous play is halted (its handle settles), and the new play glides on
1459
+ * from that frame toward the new Last — no snap, no queue.
1333
1460
  *
1334
1461
  * @param element — the element whose layout `mutate` changes.
1335
1462
  * @param mutate — a synchronous DOM mutation (class toggle, reparent, …).
1336
1463
  * @param options — `{ duration, timingFunction, transformOrigin }`.
1337
1464
  */
1338
- export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): Promise<void>;
1465
+ export declare function flip(element: HTMLElement, mutate: () => void, options?: FlipOptions): FlipHandle;
1466
+
1467
+ /**
1468
+ * The handle `flip` / `flipShared` return: the play promise (it resolves when
1469
+ * the play completes, or as soon as it is cancelled or re-targeted), extended
1470
+ * with `cancel()`. `cancel()` halts the play at its current frame — the
1471
+ * element keeps that frame's inline transform, so a following `flip` on it
1472
+ * glides on from exactly there.
1473
+ */
1474
+ export declare type FlipHandle = Promise<void> & {
1475
+ /** Halt the play at its current frame and settle the promise. */
1476
+ cancel(): void;
1477
+ };
1339
1478
 
1340
1479
  export declare interface FlipOptions {
1341
1480
  /** Playback duration in milliseconds. Defaults to `300`. */
@@ -1355,18 +1494,42 @@ declare const flipPreset: PresetFactory;
1355
1494
  * Shared-element FLIP: animate element `a` onto the rect of element `b`
1356
1495
  * (Motion's `layoutId` / GSAP Flip shared-element style). Unlike `flip`, `a`
1357
1496
  * 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.
1497
+ * carries it FORWARD onto `b`'s rect (Last): identity at t=0 → full delta at
1498
+ * t=1. Returns a {@link FlipHandle}.
1499
+ *
1500
+ * Interruptible like `flip`: re-targeting `a` (onto a new `b`) mid-flight
1501
+ * starts from `a`'s current interpolated rect and halts the previous play.
1361
1502
  *
1362
- * The two reads are batched — one forced layout each, before any write.
1503
+ * The reads are batched — one forced layout each, before any play write.
1363
1504
  *
1364
1505
  * @param a — the element to animate.
1365
1506
  * @param b — the element whose rect `a` morphs onto.
1366
1507
  * @param options — `{ duration, timingFunction, transformOrigin }`.
1367
1508
  */
1368
- export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): Promise<void>;
1509
+ export declare function flipShared(a: HTMLElement, b: HTMLElement, options?: FlipOptions): FlipHandle;
1369
1510
 
1511
+ /**
1512
+ * The editor card's presentation trim: given ONE per-stop string from
1513
+ * {@link CSSKeyframesToStrings} (`"0%\n{\n opacity: 0;\n}\n"`), return the
1514
+ * declarations alone, un-indented — the `<pre>` the card renders.
1515
+ *
1516
+ * X.KF.W2 (G-W2-3) — RE-IMPLEMENTED, not deleted. The symbol is published on
1517
+ * four barrels (`emit/format/index.ts`, `emit/index.ts`, `compile/index.ts`,
1518
+ * `public.ts`), declared on the lazy engine surface (`load-engine.ts`), and held
1519
+ * live by the demo (`KeyframeCardList.vue` binds this function by reference), so
1520
+ * the export, the signature and every one of those sites stand. What died is the
1521
+ * BODY: four anonymous regexes (`/^[^{]*{/`, `/^ /gm`, `/}\s*$/`, `/^ /`) that
1522
+ * re-read kf's own emission as if it were unknown text.
1523
+ *
1524
+ * This stays a pure string trim and adds NO grammar edge — deliberately. It is
1525
+ * FORMATTING, not parsing: the card's own comment declares it "a value.js-free
1526
+ * pure-string trim" and routing a presentation helper through the CSS grammar
1527
+ * would falsify that at a call site this wave does not own. The cut points are
1528
+ * therefore named as positions and the indent is stripped per line, which is
1529
+ * what the regexes meant; measured byte-identical to the old body across the
1530
+ * card shapes and the degenerate ones (no brace, empty, trailing text, an inner
1531
+ * `{` inside a `url()`).
1532
+ */
1370
1533
  export declare function formatCSSKeyframeString(keyframe: string): string;
1371
1534
 
1372
1535
  /**
@@ -1486,6 +1649,8 @@ export declare function fromMotionPath<V extends Vars = Vars>(target: HTMLElemen
1486
1649
  */
1487
1650
  export declare const fromStyleSheets: <V extends Vars = Vars>(source?: Document | ShadowRoot | CSSStyleSheet[] | CSSStyleSheet, options?: IngestOptions) => IngestResult<V>;
1488
1651
 
1652
+ declare const garlandSway: PresetFactory;
1653
+
1489
1654
  /**
1490
1655
  * Resolve a stable name for an animation reference: the explicit `name` when
1491
1656
  * set, else the numeric `id` stringified. A bare string passes through (the ONE
@@ -1554,13 +1719,25 @@ export declare interface IngestResult<V extends Vars = Vars> {
1554
1719
  diagnostics: Diagnostic[];
1555
1720
  }
1556
1721
 
1722
+ /**
1723
+ * The AUTHORED option bag — every field already optional, because the type IS a
1724
+ * `Partial<…>`. **Never write `Partial<InputAnimationOptions>`**: it is a
1725
+ * tautology (X.KF.W5 B-20 ≡ KF-CB-35). The wrapper spread from the library's own
1726
+ * signatures into consumer code, where a reader reasonably concluded the bare
1727
+ * type must be required-by-default; the library's four in-bounds signatures drop
1728
+ * it at source so there is nothing left to copy.
1729
+ */
1557
1730
  export declare type InputAnimationOptions = Partial<{
1558
1731
  duration: number | string;
1732
+ /** The authored unit of `duration`; it pairs with the number it rides with. */
1733
+ durationUnit: CssTimeUnit;
1559
1734
  delay: number | string;
1735
+ /** The authored unit of `delay`; it pairs with the number it rides with. */
1736
+ delayUnit: CssTimeUnit;
1560
1737
  iterationCount: number | string | "infinite" | undefined;
1561
1738
  direction: (typeof DIRECTIONS)[number];
1562
1739
  fillMode: (typeof FILL_MODES)[number];
1563
- timingFunction: TimingFunction | Easing | TimingFunctionNames | string | undefined;
1740
+ timingFunction: TimingFunction | Easing | TimingFunctionNames | CssEasingLiteral | undefined;
1564
1741
  /** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
1565
1742
  useWAAPI: boolean;
1566
1743
  /** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
@@ -1650,7 +1827,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1650
1827
  /** The consumer's EXPLICIT constructor options (NOT merged with defaults) —
1651
1828
  * retained so `fromString` can layer a parsed style-rule `animation`
1652
1829
  * shorthand UNDER them (constructor-explicit wins, F.W8). */
1653
- protected _ctorOptions: Partial<InputAnimationOptions>;
1830
+ protected _ctorOptions: InputAnimationOptions;
1654
1831
  /** The compile-stable union of this animation's interpolated keys. */
1655
1832
  get flatKeys(): readonly string[];
1656
1833
  /**
@@ -1668,11 +1845,21 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1668
1845
  * access (the old `PlaybackHost` re-publication + cast are excised).
1669
1846
  */
1670
1847
  dispatchAnimationEvent(type: string): void;
1671
- constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
1848
+ constructor(options?: InputAnimationOptions, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
1672
1849
  get templateFrames(): TemplateAnimationFrame<V>[];
1673
1850
  set templateFrames(value: TemplateAnimationFrame<V>[]);
1674
1851
  get parsedVars(): ParsedVarMap[];
1675
1852
  get frames(): AnimationFrame<V>[];
1853
+ private _compiled;
1854
+ /**
1855
+ * True once `parse()` has compiled the CURRENT template set; false again the
1856
+ * moment that set changes. X.KF.W5 B-13 (KF-TFP-27, G-OPTSET): `frames`
1857
+ * yields `[]` both BEFORE a parse and for an animation with no segments, and
1858
+ * those are not the same fact — so a per-frame write could silently no-op
1859
+ * while REPORTING SUCCESS, on a precondition the caller *"neither asserts
1860
+ * nor can observe"*. It can observe it here.
1861
+ */
1862
+ get compiled(): boolean;
1676
1863
  get frameId(): number;
1677
1864
  /** Append a template frame (delegated to the compiler). Chainable. */
1678
1865
  addFrame<K extends V>(start: number | string | KeyframeSelector, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): KeyframesAnimation<K>;
@@ -1697,7 +1884,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
1697
1884
  setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
1698
1885
  setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
1699
1886
  setComposite(composite: InputAnimationOptions["composite"]): this;
1700
- setOptions(options: Partial<InputAnimationOptions>): this;
1887
+ setOptions(options: InputAnimationOptions): this;
1701
1888
  reverse(): this;
1702
1889
  fillForwards(): void;
1703
1890
  fillBackwards(): void;
@@ -1793,6 +1980,20 @@ export declare interface KeyframesScrollTimelineOptions extends TimelineOptions
1793
1980
  */
1794
1981
  declare type LayerTransitionSpring = Partial<Omit<SpringProgressOptions, "initial" | "initialVelocity">>;
1795
1982
 
1983
+ /**
1984
+ * KF-3 — serialize evenly spaced curve samples to a CSS `linear()` easing:
1985
+ * `samples[i]` becomes the stop `value (i / (n - 1) · 100)%`, values and
1986
+ * percentages quantized to 5 decimals. Positions are explicit and strictly
1987
+ * monotone, so the string is always grammar-valid, and overshoot values outside
1988
+ * `[0, 1]` ride through (CSS `linear()` permits them). The ONE `linear()`
1989
+ * densify serializer: {@link springTimingLUT}'s table and the compile tier's
1990
+ * universal `TimingFunction` CSS twin both emit through it.
1991
+ *
1992
+ * @example
1993
+ * linearFromSamples(springTimingLUT({ response: 0.5, dampingFraction: 0.45 }));
1994
+ */
1995
+ export declare function linearFromSamples(samples: ArrayLike<number>): string;
1996
+
1796
1997
  /**
1797
1998
  * Resolve the heavy CSS-keyframe engine and its companion front doors.
1798
1999
  *
@@ -2265,6 +2466,15 @@ declare class PlaybackState {
2265
2466
  readonly _boundFrame: (t: number) => boolean | Promise<boolean>;
2266
2467
  readonly _interpOut: Record<string, unknown>;
2267
2468
  startTime: number | undefined;
2469
+ /** KFA-181 — the NEXT iteration's start on the absolute clock, carried
2470
+ * across a non-final wrap (`previous start + duration`) so the overshoot
2471
+ * past the boundary is kept, never re-based at the next frame's clock.
2472
+ * Any external `startTime` write (the class setter) clears it. */
2473
+ carriedStartTime: number | undefined;
2474
+ /** KFA-70 — the rAF clock of the tick that took a FRESH anchor, until the
2475
+ * next rAF tick re-anchors the play to the first presented frame
2476
+ * (`presentAnchor`). Any external `startTime` write clears it. */
2477
+ anchorTick: number | undefined;
2268
2478
  pausedTime: number;
2269
2479
  t: number;
2270
2480
  iteration: number;
@@ -2311,6 +2521,8 @@ export declare namespace presets {
2311
2521
  slideInRight,
2312
2522
  slideOutRight,
2313
2523
  hover,
2524
+ garlandSway,
2525
+ unfurl,
2314
2526
  jumpUp,
2315
2527
  jumpDown,
2316
2528
  springScaleIn,
@@ -2412,6 +2624,18 @@ export declare class RAFPlayback {
2412
2624
  * restart's freshly-repopulated `_rafId`. On `false` (or a stale
2413
2625
  * generation that finishes) the loop cleans up. `play`/`drive`/`loop`
2414
2626
  * are the three thin entry shapes over this one core.
2627
+ *
2628
+ * A FRAME MAY FAIL, AND FAILING IS NOT WEDGING (X.KF.W5 C-2 / G-RAF).
2629
+ * `step` had no failure path at all: a synchronous throw skipped
2630
+ * `reschedule` outright and a rejected async result met a `.then` with no
2631
+ * rejection arm, so in both shapes `_cleanup` never ran, `_rafId` stayed
2632
+ * populated, `running` stayed TRUE for the lifetime of the driver, and a
2633
+ * pending `play()` promise never settled — every consumer guarding on
2634
+ * `!playback.running` was then a permanent no-op. A failed frame now winds
2635
+ * the loop down through the SAME generation-guarded path a finished one
2636
+ * takes, and then RE-RAISES the failure unchanged: loud (the host's
2637
+ * uncaught-error channel sees the original error, nothing is absorbed) and
2638
+ * recoverable (the next `play`/`drive`/`loop` re-arms).
2415
2639
  */
2416
2640
  private _run;
2417
2641
  /**
@@ -2474,8 +2698,14 @@ export { RangePhase }
2474
2698
  * takes a SCALE, not just a boolean — WCAG 2.3.3-aligned ("shorten the
2475
2699
  * travel, keep the meaning"):
2476
2700
  *
2477
- * - `false` / `undefined` — do not honor reduced motion (the conservative
2478
- * default; the animation runs at full amplitude regardless of the OS query).
2701
+ * - `false` / `undefined` — do not honor reduced motion: the animation runs at
2702
+ * full amplitude regardless of the OS query. This is the policy VALUE's
2703
+ * meaning, NOT the engine's default — X.KF.W5 ruling KF-W5R4(3) (COHESION
2704
+ * §0j.C) INVERTED the orchestrator defaults to `respectReducedMotion: true`
2705
+ * (`AnimationGroup`, `Sequence`, `startViewTransition`), so honouring the
2706
+ * preference is what a caller gets by omission and `false` is the explicit
2707
+ * opt-out. A surface that still seeds `false` by default is named in the
2708
+ * wave record's residual list, not described as "conservative" here.
2479
2709
  * - `true` — the classic binary snap: under an active `prefers-reduced-motion:
2480
2710
  * reduce` the surface jumps to its terminal state (amplitude scale `0`).
2481
2711
  * - a `number` ∈ [0, 1] — the INTENSITY: under an active query the surface
@@ -2615,7 +2845,7 @@ export declare interface ResolvedRange {
2615
2845
  * `"ease-out-cubic"`, … — or a CSS `cubic-bezier()` literal) to a typed
2616
2846
  * {@link Easing}.
2617
2847
  *
2618
- * The lookup rides the dynamic boundary: `import("./compile/easing/easing-registry")`
2848
+ * The lookup rides the dynamic boundary: `import("./compile/easing/registry")`
2619
2849
  * loads ONLY the value.js-bearing timing-function registry (R.W1 narrow — not the
2620
2850
  * full engine chunk; lib-support F7) when a named easing is actually used, so a
2621
2851
  * light-only consumer that never calls this stays value.js-free.
@@ -2700,6 +2930,22 @@ export declare const resolveLiveKeyframes: <V extends Vars = Vars>(source?: Docu
2700
2930
  */
2701
2931
  export declare function resolveRange(range: AnimationRangeValue | undefined): ResolvedRange;
2702
2932
 
2933
+ /** Resolve a callable, canonical Value name, or CSS timing-function literal. */
2934
+ export declare const resolveTimingFunction: (timingFunction: TimingFunction | string) => TimingFunction;
2935
+
2936
+ /**
2937
+ * ms → a CSS time literal, in the unit the author wrote (UIA-KF-177).
2938
+ *
2939
+ * value.js 4.1.0's `CSSAnimationOptions` carries the authored `<time>` unit
2940
+ * beside the number (`durationUnit` / `delayUnit`), and kf's options keep it
2941
+ * from ingest, so an authored `500ms` emits `500ms` and an authored `0.05s`
2942
+ * emits `0.05s`. A time with no authored unit (a programmatic number, an
2943
+ * external stagger offset) has no spelling to keep, so it takes the shortest
2944
+ * exact literal, seconds on a tie (the CSSOM's canonical unit;
2945
+ * X.KF.W13X.r4lib). Every spelling parses back to the same milliseconds.
2946
+ */
2947
+ export declare const reverseCSSTime: (milliseconds: number, unit?: CssTimeUnit) => string;
2948
+
2703
2949
  declare const rotateIn: PresetFactory;
2704
2950
 
2705
2951
  declare const rotateScale: PresetFactory;
@@ -3045,7 +3291,9 @@ export declare class Sequence<V extends Vars = Vars> implements SequencePlayCont
3045
3291
  pause(): this;
3046
3292
  /** Resume a paused sequence — restart the rAF loop with the origin
3047
3293
  * 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`. */
3294
+ * `_time` (no forward jump). A seeked-only sequence (no play in flight)
3295
+ * begins a play from its playhead (KFA-17); a live unpaused play is left
3296
+ * alone. Body in `./lifecycle`. */
3049
3297
  resume(): this;
3050
3298
  /** Set the scalar playback rate — slow-mo (`< 1`), real-time (`1`),
3051
3299
  * fast-forward (`> 1`), or backward (`< 0`, the {@link reverse} form); the
@@ -3152,8 +3400,9 @@ export declare interface SequenceOptions {
3152
3400
  /**
3153
3401
  * When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
3154
3402
  * 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.
3403
+ * child's own reduced-motion contract via a terminal `seek`). **Default
3404
+ * `true`** — X.KF.W5 ruling KF-W5R4(3) (COHESION §0j.C), the engine-wide PRM
3405
+ * default inversion; `false` is the explicit opt-out. SSR-safe off-DOM.
3157
3406
  */
3158
3407
  respectReducedMotion?: boolean;
3159
3408
  }
@@ -3222,6 +3471,8 @@ export declare function serializeScrollOptions(opts: CSSTimelineOptions): {
3222
3471
  "animation-trigger"?: string;
3223
3472
  };
3224
3473
 
3474
+ export declare const serializeTimingFunction: (value: NonNullable<CSSAnimationOptions["timingFunction"]>) => CssEasingLiteral;
3475
+
3225
3476
  declare const shake: PresetFactory;
3226
3477
 
3227
3478
  declare const skeletonLoading: PresetFactory;
@@ -3289,12 +3540,6 @@ export declare class SmoothProgress {
3289
3540
  * Pairs with `.play()`. Does not touch current/target/settled state.
3290
3541
  */
3291
3542
  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
3543
  }
3299
3544
 
3300
3545
  export declare interface SmoothProgressOptions {
@@ -3358,12 +3603,20 @@ export declare interface SplitTextOptions {
3358
3603
  a11y?: boolean;
3359
3604
  /**
3360
3605
  * 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.
3606
+ * role of its own — explicit OR implicit** — a plain `<div>`/`<span>` maps
3607
+ * to `role="generic"` and a `<p>` to `role="paragraph"`, both of which
3608
+ * PROHIBIT an author name, so a bare `aria-label` would not compute.
3363
3609
  * Defaults to `"img"` (the canonical "graphical composite whose text
3364
- * alternative is …" role). Pass a naming-capable role to override.
3610
+ * alternative is …" role). Pass a naming-capable role to override, or
3611
+ * `null` to opt out of the role write entirely (the caller owns the role).
3612
+ *
3613
+ * An element whose IMPLICIT role already accepts a name — `<h1>`…`<h6>`,
3614
+ * `<button>`, `<a href>`, the landmarks — keeps it: stamping `role="img"`
3615
+ * over an `<h1>` deletes that heading from the document's heading
3616
+ * hierarchy, which is a bigger a11y loss than the one this option exists
3617
+ * to prevent (X.KF.W5 B-1/G-ROLE).
3365
3618
  */
3366
- role?: string;
3619
+ role?: string | null;
3367
3620
  /** Locale for `Intl.Segmenter` (word/grapheme boundaries). */
3368
3621
  locale?: string;
3369
3622
  /** Options for the ready {@link StaggerFn} built over the cohort. */
@@ -3599,7 +3852,12 @@ export declare class SpringProgress {
3599
3852
  /**
3600
3853
  * Set the target. The closed-form solution is re-seated from the
3601
3854
  * current `(value, velocity)` so the trajectory is continuous.
3602
- * Idempotent if the target is unchanged.
3855
+ * Idempotent if the target is unchanged AND the spring carries no live
3856
+ * velocity. An equal target with nonzero velocity (e.g. right after
3857
+ * `reset(x, v)`, which seats `target = x` and stops the managed loop)
3858
+ * still re-seats — the trajectory is identical (the closed form re-seats
3859
+ * from the current `(x, v)`), and the re-seat re-arms the managed loop so
3860
+ * the spring runs to rest and commits (K-1).
3603
3861
  */
3604
3862
  set target(value: number);
3605
3863
  private reseatTarget;
@@ -3633,6 +3891,15 @@ export declare class SpringProgress {
3633
3891
  * overdamped: x(t) = A e^(r₁ t) + B e^(r₂ t)
3634
3892
  */
3635
3893
  private evaluateAt;
3894
+ /**
3895
+ * The rest the spring travels toward: `origin + s·(target − origin)`.
3896
+ * R-K1-a — at full amplitude (s = 1) that expression is NOT `target` in
3897
+ * floating point for every origin (origin −0.0069, target 1 →
3898
+ * 0.9999999999999999), so a settled spring would rest a float short and a
3899
+ * consumer's `value >= target` never fires. At s = 1 the rest IS the
3900
+ * target, exactly; every other s is the scaled form, unchanged.
3901
+ */
3902
+ private scaledTarget;
3636
3903
  private checkSettled;
3637
3904
  /** Immediately set value = target, zero velocity. */
3638
3905
  snap(): void;
@@ -3806,6 +4073,22 @@ export declare interface SpringTimingFunctionOptions {
3806
4073
  maxDuration?: number;
3807
4074
  }
3808
4075
 
4076
+ /**
4077
+ * KF-3 (atlas A2(b)) — the sampled look-up-table form of
4078
+ * {@link springTimingFunction}: `sampleCount + 1` spring positions at the evenly
4079
+ * spaced normalized times `t = i / sampleCount`, with `lut[0] = 0` and
4080
+ * `lut[sampleCount] = 1` exactly. Built for per-frame and many-mark consumers
4081
+ * (an ECharts series, a canvas of marks, a CSS `linear()` via
4082
+ * {@link linearFromSamples}) that want the samples themselves rather than a
4083
+ * callable. This IS the table `springTimingFunction` interpolates — one sampler,
4084
+ * one solver — so `springTimingFunction(opts).fn(i / n) === lut[i]`.
4085
+ *
4086
+ * @example
4087
+ * const lut = springTimingLUT({ response: 0.5, dampingFraction: 0.45, sampleCount: 120 });
4088
+ * const css = linearFromSamples(lut); // "linear(0 0%, … , 1 100%)"
4089
+ */
4090
+ export declare function springTimingLUT(opts: SpringTimingFunctionOptions): Float64Array;
4091
+
3809
4092
  declare const springWobble: PresetFactory;
3810
4093
 
3811
4094
  /**
@@ -3934,8 +4217,10 @@ declare const textFocusBlur: PresetFactory;
3934
4217
  * `"unit"` (a word or grapheme — an animatable fragment) or `"space"` (inter-unit
3935
4218
  * whitespace — kept as a live text node so the browser can still wrap the run at
3936
4219
  * 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).
4220
+ * `text-wrap: balance`, the AnimatedText X-5 lesson). Under word granularity
4221
+ * punctuation rides WITH the word it abuts (KF-1): `Intl.Segmenter` emits `,`
4222
+ * `.` `!` `"` as their own non-word-like segments, and splitting on those made
4223
+ * "Hello," two fragments, so the comma could stagger in late or wrap alone.
3939
4224
  */
3940
4225
  /** One ordered piece of the source text. */
3941
4226
  export declare interface TextSegment {
@@ -4027,7 +4312,41 @@ export declare interface TimelineOptions {
4027
4312
 
4028
4313
  export declare type TimingFunction = (t: number) => number;
4029
4314
 
4030
- export declare type TimingFunctionNames = BezierPresetName | "steps" | "ease-in-bounce" | "easeOutCubic" | "easeInOutSine" | "easeInOutCubic" | "easeInOutQuad" | "easeInOutExpo" | "easeInOutCirc" | "easeOutExpo" | "smoothStep3" | "easeInBounce";
4315
+ /**
4316
+ * The registry roster with each name's curve, evaluated at module top level —
4317
+ * THE BOOT FENCE (G-KF3-6): a `bezierPresets` key value stops accepting is a kf
4318
+ * boot `throw` here, and a key it adds silently widens this public roster.
4319
+ *
4320
+ * The references are value.js's memoised ones, so they are stable but NOT
4321
+ * injective: the 40 names resolve onto **31** distinct references, because nine
4322
+ * hyphen/camel twin pairs (`ease-out-cubic` ≡ `easeOutCubic`, `smooth-step-3` ≡
4323
+ * `smoothStep3`, …) share one value.js function. A reference therefore
4324
+ * identifies the CURVE and never the name that produced it — which is why
4325
+ * `easing-serialize.ts`'s reverse lookup can tell a registry curve from a
4326
+ * closure but cannot recover WHICH name was written, and why G-KFW4-5 proves
4327
+ * identity by sampled value-identity on the 33-point grid rather than by name
4328
+ * equality (COHESION §0j.C KF-SS3). `test/compile/easing-identity.test.ts`
4329
+ * asserts all three facts.
4330
+ */
4331
+ export declare const timingFunctionEntries: readonly (readonly [
4332
+ string,
4333
+ EasingFunction
4334
+ ])[];
4335
+
4336
+ /**
4337
+ * The registry's easing NAMES — exactly the roster
4338
+ * `compile/easing/registry.ts` builds at module evaluation (value.js's
4339
+ * `bezierPresets` keys + `"ease-in-bounce"` + the camel `DIRECT_NAMES`), and
4340
+ * nothing else.
4341
+ *
4342
+ * `"steps"` is NOT a member (X.KF.W4 KF-CB-24): bare `steps` carries no count
4343
+ * and no jump term, so it fails the CSS Easing L1 parse and is absent from
4344
+ * `registryNames` — `resolveTimingFunction("steps")` THROWS on it. The
4345
+ * parametric `steps(4, jump-end)` is a CSS LITERAL, resolved through the parser
4346
+ * branch, never a name. `test/compile/timing-function-names.test.ts`
4347
+ * (G-KFW4-13) asserts this union and the runtime roster are the same set.
4348
+ */
4349
+ export declare type TimingFunctionNames = BezierPresetName | "ease-in-bounce" | "easeOutCubic" | "easeInOutSine" | "easeInOutCubic" | "easeInOutQuad" | "easeInOutExpo" | "easeInOutCirc" | "easeOutExpo" | "smoothStep3" | "easeInBounce";
4031
4350
 
4032
4351
  /**
4033
4352
  * Normalize a callable or typed easing to {@link Easing}. Synchronous and
@@ -4126,6 +4445,8 @@ declare const typewriter: PresetFactory;
4126
4445
 
4127
4446
  declare const typingCursor: PresetFactory;
4128
4447
 
4448
+ declare const unfurl: PresetFactory;
4449
+
4129
4450
  /** Thrown when a string easing name cannot be resolved through the registry. */
4130
4451
  export declare class UnknownEasingError extends Error {
4131
4452
  readonly easingName: string;