@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.
- package/README.md +12 -3
- package/dist/engine/index.d.ts +265 -30
- package/dist/engine/index.js +1492 -1398
- package/dist/keyframes.d.ts +360 -47
- package/dist/keyframes.js +180 -146
- package/dist/registry-CPtiwlwX.js +162 -0
- package/dist/{easing-registry-Db7xwtXT.js → registry-Dd7GzvJm.js} +1 -1
- package/dist/{sequence-BvpIpCGp.js → sequence-BUgKKePR.js} +122 -96
- package/package.json +14 -9
- package/dist/easing-registry-B0rLmOtw.js +0 -79
package/README.md
CHANGED
|
@@ -425,7 +425,7 @@ const { css, eligible, refusals } = await compileToCSS([fade]);
|
|
|
425
425
|
|
|
426
426
|
| Refusal reason | What it proves | The faithful path |
|
|
427
427
|
| --------------------- | ----------------------------------------------- | ---------------------------------- |
|
|
428
|
-
| `
|
|
428
|
+
| `weight-blend` | no `animation-composition` twin exists | JS `AnimationGroup` |
|
|
429
429
|
| `custom-renderer` | a closure cannot be CSS | JS playback |
|
|
430
430
|
| `perceptual-oklab` | the oklab densify exceeds the ΔE band | JS playback (true perceptual lerp) |
|
|
431
431
|
| `computed-unit-drift` | the narrow case where verbatim emit would drift | JS playback |
|
|
@@ -695,7 +695,16 @@ await flipShared(a, b, {
|
|
|
695
695
|
});
|
|
696
696
|
```
|
|
697
697
|
|
|
698
|
-
Options: `duration` (default 300), `timingFunction` (callable or `Easing` — `springTimingFunction(…)` makes the FLIP springy), `transformOrigin` (default `"top left"`). Both return the play promise
|
|
698
|
+
Options: `duration` (default 300), `timingFunction` (callable or `Easing` — `springTimingFunction(…)` makes the FLIP springy), `transformOrigin` (default `"top left"`). Both return a `FlipHandle`: the play promise, extended with `cancel()`.
|
|
699
|
+
|
|
700
|
+
**Interruptible.** `handle.cancel()` halts the play at its current frame (the element keeps that frame's transform) and settles the promise. Calling `flip` (or `flipShared`) again on an element whose play is still running is a **re-target**: First is the element's current interpolated rect (its live visual box), the running play is halted and its handle settles, and the new play glides on from that frame — no snap back to the stale First, no waiting out the old duration.
|
|
701
|
+
|
|
702
|
+
```ts
|
|
703
|
+
let resort = flip(list, () => sortBy(list, "date"), { duration: 680 });
|
|
704
|
+
// A second click mid-flight glides on from where the list is right now:
|
|
705
|
+
resort = flip(list, () => sortBy(list, "attendance"), { duration: 680 });
|
|
706
|
+
resort.cancel(); // or stop it where it stands
|
|
707
|
+
```
|
|
699
708
|
|
|
700
709
|
### `drag` / `Draggable`
|
|
701
710
|
|
|
@@ -831,7 +840,7 @@ const dialog = await compileToEntry(
|
|
|
831
840
|
);
|
|
832
841
|
dialog.eligible; // => true
|
|
833
842
|
dialog.css.includes("@starting-style"); // => true
|
|
834
|
-
dialog.css.includes("display
|
|
843
|
+
dialog.css.includes("display 0.35s allow-discrete"); // => true
|
|
835
844
|
```
|
|
836
845
|
|
|
837
846
|
Options: `openSelector` (`".open"` | `"[data-open]"` | `":popover-open"` | `"[open]"`, concatenated onto the base selector), `display` (the open display, default `"block"`), `overlay` (emit `overlay allow-discrete`, default `true`). The `exit` defaults to `enter` reversed. **Born-open elements RUN the entry at first render** (an `@starting-style` platform semantic — an SSR'd open dialog animates in on load; opt out by not matching the open selector at initial render). Where `transition-behavior` is unsupported the artifact **degrades honestly** — snap-entry, correct end state, no broken half-transition.
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -2,18 +2,20 @@ import { AnimationRangeValue } from '@mkbabb/value.js/css';
|
|
|
2
2
|
import { AnimationTimelineValue } from '@mkbabb/value.js/css';
|
|
3
3
|
import type { AnimationTriggerValue } from '@mkbabb/value.js/css';
|
|
4
4
|
import type { BezierPresetName } from '@mkbabb/value.js/easing';
|
|
5
|
-
import { CSSAnimationOptions } from '@mkbabb/value.js/css';
|
|
5
|
+
import type { 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 type { CssTimeUnit } from '@mkbabb/value.js/css';
|
|
8
9
|
import type { CssValue } from '@mkbabb/value.js/value';
|
|
9
|
-
import { CustomFunctionDescriptor } from '@mkbabb/value.js/css';
|
|
10
|
+
import type { CustomFunctionDescriptor } from '@mkbabb/value.js/css';
|
|
11
|
+
import { EasingFunction } from '@mkbabb/value.js/easing';
|
|
10
12
|
import type { HueInterpolationMethod } from '@mkbabb/value.js/color';
|
|
11
13
|
import type { KeyframeSelector } from '@mkbabb/value.js/css';
|
|
12
|
-
import { ParseIssue } from '@mkbabb/value.js/css';
|
|
14
|
+
import type { ParseIssue } from '@mkbabb/value.js/css';
|
|
13
15
|
import { RangeBoundary } from '@mkbabb/value.js/css';
|
|
14
16
|
import { RangePhase } from '@mkbabb/value.js/css';
|
|
15
17
|
import type { SpaceId } from '@mkbabb/value.js/color';
|
|
16
|
-
import { Stylesheet } from '@mkbabb/value.js/css';
|
|
18
|
+
import type { Stylesheet } from '@mkbabb/value.js/css';
|
|
17
19
|
import type { TriggerType } from '@mkbabb/value.js/css';
|
|
18
20
|
|
|
19
21
|
declare const accordionExpand: PresetFactory;
|
|
@@ -122,8 +124,17 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
122
124
|
paused: boolean;
|
|
123
125
|
started: boolean;
|
|
124
126
|
done: boolean;
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
127
|
+
/**
|
|
128
|
+
* When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
|
|
129
|
+
* every child to its final frame in one composite, no rAF loop.
|
|
130
|
+
*
|
|
131
|
+
* **Default `true`** — X.KF.W5 ruling KF-W5R4(3) (COHESION §0j.C): the PRM
|
|
132
|
+
* default is INVERTED to honouring the preference, one honest default in one
|
|
133
|
+
* engine. Until that ruling the group defaulted `false` while its sibling
|
|
134
|
+
* organ `startViewTransition` defaulted `true`, so two organs of one engine
|
|
135
|
+
* disagreed and the honest default *"existed in-house and was used nowhere"*
|
|
136
|
+
* (KF-KC-27). Set `false` for the explicit opt-out.
|
|
137
|
+
*/
|
|
127
138
|
respectReducedMotion: boolean;
|
|
128
139
|
/** Children-per-slice before `advanceTo()` yields to the main thread; larger
|
|
129
140
|
* groups batch with a `scheduler.yield()` between slices (INP relief). */
|
|
@@ -132,7 +143,36 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
132
143
|
* genuine-ownership replacement for the excised `KeyframesAnimation.group()`
|
|
133
144
|
* service locator; each input is a bare animation or `{ animation, layer }`). */
|
|
134
145
|
static of<V extends Vars>(first: KeyframesAnimation<V> | AnimationGroupInput<V>, ...rest: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]): AnimationGroup<V>;
|
|
135
|
-
|
|
146
|
+
/** The pre-ruling field default, unchanged; `_singleTargetDeclared` is set
|
|
147
|
+
* once a caller ASSIGNS the property (the supported opt-out). */
|
|
148
|
+
private _singleTarget;
|
|
149
|
+
private _singleTargetDeclared;
|
|
150
|
+
/**
|
|
151
|
+
* True when every child animates the SAME first target, so the group can
|
|
152
|
+
* composite one shared element per frame (the SoA blend + the group-WAAPI
|
|
153
|
+
* fast lane both gate on it).
|
|
154
|
+
*
|
|
155
|
+
* **Assigning it DECLARES it** — X.KF.W5 ruling KF-W5R4(4) (COHESION §0j.C):
|
|
156
|
+
* `singleTarget` gains a SUPPORTED opt-out. Before it, `group.singleTarget =
|
|
157
|
+
* false` was a raw poke the post-mount recompute in {@link setTargets}
|
|
158
|
+
* silently reverted (LP-1's rider; the demo's `CopyButton`/`SquareScene`
|
|
159
|
+
* pokes are the live witnesses), so the group disagreed with its own caller
|
|
160
|
+
* and the KF-CB-15 target-less derivation (`undefined === undefined → true`)
|
|
161
|
+
* could not be opted out of at all. Every recompute honours a declaration;
|
|
162
|
+
* {@link deriveSingleTarget} gives the derived mode back.
|
|
163
|
+
*/
|
|
164
|
+
get singleTarget(): boolean;
|
|
165
|
+
set singleTarget(value: boolean);
|
|
166
|
+
/**
|
|
167
|
+
* Drop a {@link singleTarget} declaration and return to derivation — the
|
|
168
|
+
* inverse of the supported opt-out, so a declaration is reversible without
|
|
169
|
+
* reconstructing the group. Re-derives immediately from the current entries.
|
|
170
|
+
*/
|
|
171
|
+
deriveSingleTarget(): this;
|
|
172
|
+
/** The ONE derivation of `singleTarget` — shared by the constructor and the
|
|
173
|
+
* `setTargets` recompute so they can never drift apart, and a NO-OP while a
|
|
174
|
+
* caller's declaration stands (KF-W5R4(4)). */
|
|
175
|
+
private _deriveSingleTarget;
|
|
136
176
|
/**
|
|
137
177
|
* T.A6 — true when the group's composite `transform` is a CUSTOM (non-DOM)
|
|
138
178
|
* consumer that expects the nested PLAIN authored-shape projection (the
|
|
@@ -159,6 +199,8 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
159
199
|
/** Pre-bound frame callback — allocated once to avoid a per-loop closure.
|
|
160
200
|
* INTERNAL (S.B5) — read by `./lifecycle`'s `play`/`resume` loop start. */
|
|
161
201
|
_boundFrame: (t: number) => boolean | Promise<boolean>;
|
|
202
|
+
/** The `onRender` observers (KFA-31). */
|
|
203
|
+
private readonly _renders;
|
|
162
204
|
/** Cached entries sorted by layer zIndex (see `getEntries`). */
|
|
163
205
|
private _entries;
|
|
164
206
|
private _entriesDirty;
|
|
@@ -171,7 +213,7 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
171
213
|
constructor(...inputs: (KeyframesAnimation<V> | AnimationGroupInput<V>)[]);
|
|
172
214
|
/** The animation entries sorted by layer zIndex, dirty-flag cached — rebuilt
|
|
173
215
|
* only on a mutation. INTERNAL (R.W2): read by the colocated `./compositor`/
|
|
174
|
-
* `./entries`/`./
|
|
216
|
+
* `./entries`/`./yield-batch`/`./springs` helpers + all hot-path iteration. */
|
|
175
217
|
getEntries(): AnimationGroupEntry<V>[];
|
|
176
218
|
/** Mark entries cache stale. Called at all mutation boundaries.
|
|
177
219
|
* INTERNAL (R.W2) — also called by `./layer-api`. */
|
|
@@ -191,17 +233,26 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
191
233
|
* (0 for a never-ticked group), never a fabricated wall-clock.
|
|
192
234
|
*/
|
|
193
235
|
render(t?: number): void;
|
|
236
|
+
/** Observe every frame the group paints (each draw-loop tick, `render()`,
|
|
237
|
+
* `reset()`) with its clock; returns the unsubscribe. A paused group
|
|
238
|
+
* notifies nothing. See `./render-observers` (KFA-31 · KFA-85). */
|
|
239
|
+
onRender(listener: (t: number) => void): () => void;
|
|
194
240
|
/** Set a child's current time without touching its siblings (updates
|
|
195
241
|
* `pausedTime` for a jump-free resume). Chainable; `render()` to reflect it. */
|
|
196
242
|
setChildTime(nameOrAnim: string | KeyframesAnimation<V>, t: number): this;
|
|
243
|
+
/** KFA-69 — the group-level seek: seat EVERY child at the group's one
|
|
244
|
+
* master elapsed time (ms since its start), each at its own phase of it
|
|
245
|
+
* (modulo its duration, within its iteration count), so phase-locked
|
|
246
|
+
* children stay locked under a scrub. Chainable; `render()` to reflect it.
|
|
247
|
+
* Body in `./seek`. */
|
|
248
|
+
seek(elapsed: number): this;
|
|
249
|
+
/** The master elapsed time a child's current position sits at (its delay +
|
|
250
|
+
* its completed iterations + its `t`) — the read `seek` inverts. */
|
|
251
|
+
elapsedOf(nameOrAnim: string | KeyframesAnimation<V>): number;
|
|
197
252
|
/** Advance all child animations to absolute clock `t`. SYNC on the steady path
|
|
198
253
|
* (J.W6 S1): all-synchronous children advance with no per-frame microtask hop;
|
|
199
254
|
* a thenable only on an async child or the over-`YIELD_BATCH` yield path. */
|
|
200
255
|
advanceTo(t: number): this | Promise<this>;
|
|
201
|
-
/** One frame of the group's draw loop: tick all children, then render. */
|
|
202
|
-
private _frame;
|
|
203
|
-
/** The post-advance render half of `_frame` — composite, or settle on done. */
|
|
204
|
-
private _renderFrame;
|
|
205
256
|
/** The completion front-door (G.W13) — `await group.finished` resolves once
|
|
206
257
|
* the in-flight composite play settles. Exposes the ONE held `_playingPromise`
|
|
207
258
|
* (a settled/never-played group resolves immediately). */
|
|
@@ -324,7 +375,16 @@ declare interface AnimationLayerConfig {
|
|
|
324
375
|
|
|
325
376
|
declare type AnimationOptions = {
|
|
326
377
|
duration: number;
|
|
378
|
+
/**
|
|
379
|
+
* The `<time>` unit the author wrote for `duration` (UIA-KF-177): set from
|
|
380
|
+
* value.js's `CSSAnimationOptions.durationUnit` at ingest, so every emit
|
|
381
|
+
* writes the number back in it. Absent for a programmatic number, which
|
|
382
|
+
* emits in its shortest exact spelling.
|
|
383
|
+
*/
|
|
384
|
+
durationUnit?: CssTimeUnit;
|
|
327
385
|
delay: number;
|
|
386
|
+
/** The `<time>` unit the author wrote for `delay` (UIA-KF-177); see `durationUnit`. */
|
|
387
|
+
delayUnit?: CssTimeUnit;
|
|
328
388
|
iterationCount: number;
|
|
329
389
|
direction: (typeof DIRECTIONS)[number];
|
|
330
390
|
fillMode: (typeof FILL_MODES)[number];
|
|
@@ -539,15 +599,45 @@ export declare function createScrollScene(spec?: ScrollSceneOptions | CSSTimelin
|
|
|
539
599
|
*/
|
|
540
600
|
export declare function createTriggerScene(spec?: AnimationTriggerValue | CSSTimelineOptions): TriggerScene;
|
|
541
601
|
|
|
602
|
+
/**
|
|
603
|
+
* A CSS `<easing-function>` written as TEXT — the second legitimate spelling of
|
|
604
|
+
* an easing at the option surface, beside a registry {@link TimingFunctionNames}
|
|
605
|
+
* name (X.KF.W4 KF-CB-29, COHESION §0m.1 candidate (ii)).
|
|
606
|
+
*
|
|
607
|
+
* This type exists because the arm it replaces — a bare `| string` on
|
|
608
|
+
* `InputAnimationOptions["timingFunction"]` — made `tsc` green on EVERY string,
|
|
609
|
+
* so the name union beside it was decorative at the only surface a consumer
|
|
610
|
+
* actually writes through. That arm is the mechanism by which a renamed easing
|
|
611
|
+
* shipped with a green typecheck over a name that had ceased to exist. Deleting
|
|
612
|
+
* it outright is the WRONG cure and the tree says so by measurement: at
|
|
613
|
+
* `3e81f500` a bare deletion reddens **14 library diagnostics** — 13 in the
|
|
614
|
+
* SHIPPED preset catalogue (`presets/catalog.ts`, every one a `cubic-bezier()`
|
|
615
|
+
* or `steps()` literal the library authors itself) and one at
|
|
616
|
+
* `engine/css/metadata.ts:63`. Those literals are not sloppiness; they are the
|
|
617
|
+
* grammar. So the arm is NARROWED to that grammar rather than removed.
|
|
618
|
+
*
|
|
619
|
+
* The members are CSS Easing L1/L2's own: the seven keywords, and the three
|
|
620
|
+
* functional forms. The functional arms are deliberately `${string}`-bodied — a
|
|
621
|
+
* template literal type cannot validate a numeric argument list, and pretending
|
|
622
|
+
* otherwise would trade one false claim for another. What it DOES buy is total:
|
|
623
|
+
* a string that is neither a registry name nor shaped like a CSS easing function
|
|
624
|
+
* no longer typechecks, which is the whole of KF-CB-29.
|
|
625
|
+
*
|
|
626
|
+
* `compile/emit/css-text.ts`'s `serializeTimingFunction` returns this type, so
|
|
627
|
+
* the library's own serializer output flows back into the option surface
|
|
628
|
+
* without widening it.
|
|
629
|
+
*/
|
|
630
|
+
declare type CssEasingLiteral = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | `cubic-bezier(${string})` | `steps(${string})` | `linear(${string})`;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Normalize a child name to a CSS-safe ident (the `@keyframes`/class name). A
|
|
634
|
+
* bare numeric id (`getAnimationId` falls back to `String(id)`) gets an `a`
|
|
635
|
+
* prefix so the `@keyframes` name is a valid CSS identifier; collisions are
|
|
636
|
+
* de-duped by the walker via a `-2`/`-3` suffix.
|
|
637
|
+
*/
|
|
638
|
+
export declare function cssIdent(name: string): string;
|
|
639
|
+
|
|
542
640
|
export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnimation<V> {
|
|
543
|
-
/**
|
|
544
|
-
* Q.WD1-bind S2 (DM-22) — the timeline a scroll-range named selector resolves
|
|
545
|
-
* its phase against. Stored by {@link bindTimeline} for the no-timeline guard's
|
|
546
|
-
* check; `undefined` until a timeline is bound. A scroll-context operation
|
|
547
|
-
* specific to CSS keyframes with named selectors (the base `Animation` class is
|
|
548
|
-
* value.js-/scroll-agnostic), so the field + method live here.
|
|
549
|
-
*/
|
|
550
|
-
private _boundTimeline?;
|
|
551
641
|
constructor(options?: Partial<InputAnimationOptions>, ...targets: HTMLElement[]);
|
|
552
642
|
/**
|
|
553
643
|
* Q.WD1-bind S2 (DM-22) — the attach-time deferred-resolution seam. A
|
|
@@ -564,6 +654,15 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
|
|
|
564
654
|
*
|
|
565
655
|
* Idempotent + safe to call before `fromString`: with no named frames the walk
|
|
566
656
|
* is a no-op; calling it after a NaN-producing `parse()` purges the NaN frames.
|
|
657
|
+
*
|
|
658
|
+
* `timeline` is the BINDING the caller declares, and the resolution below does
|
|
659
|
+
* not read it: `namedSelectorToFraction` maps a phase NAME to a fraction, which
|
|
660
|
+
* is timeline-independent. It was formerly stashed on a private
|
|
661
|
+
* `_boundTimeline` field described as feeding "the no-timeline guard's check" —
|
|
662
|
+
* a consumer that does not exist (the guard is `engine/interpolate.ts` and
|
|
663
|
+
* reads the frames' own resolved state, never the field). The field and that
|
|
664
|
+
* prose are deleted together at X.KF.W4 K3 / R-9's else-branch; the parameter
|
|
665
|
+
* stays because it is this method's public contract.
|
|
567
666
|
*/
|
|
568
667
|
bindTimeline(timeline: Timeline): this;
|
|
569
668
|
/**
|
|
@@ -572,6 +671,16 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends KeyframesAnim
|
|
|
572
671
|
* unflattened); genuine omission resolves to the instance's ONE
|
|
573
672
|
* default DOM-style renderer, which keeps WAAPI eligibility a
|
|
574
673
|
* reference comparison (`usesDefaultRenderer`).
|
|
674
|
+
*
|
|
675
|
+
* That reference comparison is per-INSTANCE, so it only survives a seam
|
|
676
|
+
* that respects instance ownership. `engine/compile-bridge.ts`'s
|
|
677
|
+
* `adoptCompiled` is the one seam that moves compiled frames between
|
|
678
|
+
* animations, and it upholds this contract there (X.KF.W5 C-1 /
|
|
679
|
+
* G-RENDERER): the renderer stays the RECEIVER's unless the source
|
|
680
|
+
* declared one of its own. Before that, adopting a throwaway compiled
|
|
681
|
+
* with no transform — the editor's own recompile — replaced a consumer's
|
|
682
|
+
* renderer with a foreign instance's default, and every frame then
|
|
683
|
+
* answered `usesDefaultRenderer` FALSE for a renderer nobody supplied.
|
|
575
684
|
*/
|
|
576
685
|
private resolveTransform;
|
|
577
686
|
fromVars(vars: V[], transform?: TransformFunction<V>): this;
|
|
@@ -795,6 +904,28 @@ declare type FlatAuthoredValues = Record<string, AuthoredValue | undefined>;
|
|
|
795
904
|
|
|
796
905
|
declare const flipPreset: PresetFactory;
|
|
797
906
|
|
|
907
|
+
/**
|
|
908
|
+
* The editor card's presentation trim: given ONE per-stop string from
|
|
909
|
+
* {@link CSSKeyframesToStrings} (`"0%\n{\n opacity: 0;\n}\n"`), return the
|
|
910
|
+
* declarations alone, un-indented — the `<pre>` the card renders.
|
|
911
|
+
*
|
|
912
|
+
* X.KF.W2 (G-W2-3) — RE-IMPLEMENTED, not deleted. The symbol is published on
|
|
913
|
+
* four barrels (`emit/format/index.ts`, `emit/index.ts`, `compile/index.ts`,
|
|
914
|
+
* `public.ts`), declared on the lazy engine surface (`load-engine.ts`), and held
|
|
915
|
+
* live by the demo (`KeyframeCardList.vue` binds this function by reference), so
|
|
916
|
+
* the export, the signature and every one of those sites stand. What died is the
|
|
917
|
+
* BODY: four anonymous regexes (`/^[^{]*{/`, `/^ /gm`, `/}\s*$/`, `/^ /`) that
|
|
918
|
+
* re-read kf's own emission as if it were unknown text.
|
|
919
|
+
*
|
|
920
|
+
* This stays a pure string trim and adds NO grammar edge — deliberately. It is
|
|
921
|
+
* FORMATTING, not parsing: the card's own comment declares it "a value.js-free
|
|
922
|
+
* pure-string trim" and routing a presentation helper through the CSS grammar
|
|
923
|
+
* would falsify that at a call site this wave does not own. The cut points are
|
|
924
|
+
* therefore named as positions and the indent is stripped per line, which is
|
|
925
|
+
* what the regexes meant; measured byte-identical to the old body across the
|
|
926
|
+
* card shapes and the degenerate ones (no brace, empty, trailing text, an inner
|
|
927
|
+
* `{` inside a `url()`).
|
|
928
|
+
*/
|
|
798
929
|
export declare function formatCSSKeyframeString(keyframe: string): string;
|
|
799
930
|
|
|
800
931
|
/**
|
|
@@ -982,13 +1113,25 @@ export declare interface IngestResult<V extends Vars = Vars> {
|
|
|
982
1113
|
diagnostics: Diagnostic[];
|
|
983
1114
|
}
|
|
984
1115
|
|
|
1116
|
+
/**
|
|
1117
|
+
* The AUTHORED option bag — every field already optional, because the type IS a
|
|
1118
|
+
* `Partial<…>`. **Never write `Partial<InputAnimationOptions>`**: it is a
|
|
1119
|
+
* tautology (X.KF.W5 B-20 ≡ KF-CB-35). The wrapper spread from the library's own
|
|
1120
|
+
* signatures into consumer code, where a reader reasonably concluded the bare
|
|
1121
|
+
* type must be required-by-default; the library's four in-bounds signatures drop
|
|
1122
|
+
* it at source so there is nothing left to copy.
|
|
1123
|
+
*/
|
|
985
1124
|
declare type InputAnimationOptions = Partial<{
|
|
986
1125
|
duration: number | string;
|
|
1126
|
+
/** The authored unit of `duration`; it pairs with the number it rides with. */
|
|
1127
|
+
durationUnit: CssTimeUnit;
|
|
987
1128
|
delay: number | string;
|
|
1129
|
+
/** The authored unit of `delay`; it pairs with the number it rides with. */
|
|
1130
|
+
delayUnit: CssTimeUnit;
|
|
988
1131
|
iterationCount: number | string | "infinite" | undefined;
|
|
989
1132
|
direction: (typeof DIRECTIONS)[number];
|
|
990
1133
|
fillMode: (typeof FILL_MODES)[number];
|
|
991
|
-
timingFunction: TimingFunction | Easing | TimingFunctionNames |
|
|
1134
|
+
timingFunction: TimingFunction | Easing | TimingFunctionNames | CssEasingLiteral | undefined;
|
|
992
1135
|
/** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
|
|
993
1136
|
useWAAPI: boolean;
|
|
994
1137
|
/** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
|
|
@@ -1078,7 +1221,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
|
|
|
1078
1221
|
/** The consumer's EXPLICIT constructor options (NOT merged with defaults) —
|
|
1079
1222
|
* retained so `fromString` can layer a parsed style-rule `animation`
|
|
1080
1223
|
* shorthand UNDER them (constructor-explicit wins, F.W8). */
|
|
1081
|
-
protected _ctorOptions:
|
|
1224
|
+
protected _ctorOptions: InputAnimationOptions;
|
|
1082
1225
|
/** The compile-stable union of this animation's interpolated keys. */
|
|
1083
1226
|
get flatKeys(): readonly string[];
|
|
1084
1227
|
/**
|
|
@@ -1096,11 +1239,21 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
|
|
|
1096
1239
|
* access (the old `PlaybackHost` re-publication + cast are excised).
|
|
1097
1240
|
*/
|
|
1098
1241
|
dispatchAnimationEvent(type: string): void;
|
|
1099
|
-
constructor(options?:
|
|
1242
|
+
constructor(options?: InputAnimationOptions, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
|
|
1100
1243
|
get templateFrames(): TemplateAnimationFrame<V>[];
|
|
1101
1244
|
set templateFrames(value: TemplateAnimationFrame<V>[]);
|
|
1102
1245
|
get parsedVars(): ParsedVarMap[];
|
|
1103
1246
|
get frames(): AnimationFrame<V>[];
|
|
1247
|
+
private _compiled;
|
|
1248
|
+
/**
|
|
1249
|
+
* True once `parse()` has compiled the CURRENT template set; false again the
|
|
1250
|
+
* moment that set changes. X.KF.W5 B-13 (KF-TFP-27, G-OPTSET): `frames`
|
|
1251
|
+
* yields `[]` both BEFORE a parse and for an animation with no segments, and
|
|
1252
|
+
* those are not the same fact — so a per-frame write could silently no-op
|
|
1253
|
+
* while REPORTING SUCCESS, on a precondition the caller *"neither asserts
|
|
1254
|
+
* nor can observe"*. It can observe it here.
|
|
1255
|
+
*/
|
|
1256
|
+
get compiled(): boolean;
|
|
1104
1257
|
get frameId(): number;
|
|
1105
1258
|
/** Append a template frame (delegated to the compiler). Chainable. */
|
|
1106
1259
|
addFrame<K extends V>(start: number | string | KeyframeSelector, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: InputAnimationOptions["timingFunction"], composition?: CompositeOperator): KeyframesAnimation<K>;
|
|
@@ -1125,7 +1278,7 @@ export declare class KeyframesAnimation<V extends Vars = Vars> {
|
|
|
1125
1278
|
setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
|
|
1126
1279
|
setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
|
|
1127
1280
|
setComposite(composite: InputAnimationOptions["composite"]): this;
|
|
1128
|
-
setOptions(options:
|
|
1281
|
+
setOptions(options: InputAnimationOptions): this;
|
|
1129
1282
|
reverse(): this;
|
|
1130
1283
|
fillForwards(): void;
|
|
1131
1284
|
fillBackwards(): void;
|
|
@@ -1448,6 +1601,15 @@ declare class PlaybackState {
|
|
|
1448
1601
|
readonly _boundFrame: (t: number) => boolean | Promise<boolean>;
|
|
1449
1602
|
readonly _interpOut: Record<string, unknown>;
|
|
1450
1603
|
startTime: number | undefined;
|
|
1604
|
+
/** KFA-181 — the NEXT iteration's start on the absolute clock, carried
|
|
1605
|
+
* across a non-final wrap (`previous start + duration`) so the overshoot
|
|
1606
|
+
* past the boundary is kept, never re-based at the next frame's clock.
|
|
1607
|
+
* Any external `startTime` write (the class setter) clears it. */
|
|
1608
|
+
carriedStartTime: number | undefined;
|
|
1609
|
+
/** KFA-70 — the rAF clock of the tick that took a FRESH anchor, until the
|
|
1610
|
+
* next rAF tick re-anchors the play to the first presented frame
|
|
1611
|
+
* (`presentAnchor`). Any external `startTime` write clears it. */
|
|
1612
|
+
anchorTick: number | undefined;
|
|
1451
1613
|
pausedTime: number;
|
|
1452
1614
|
t: number;
|
|
1453
1615
|
iteration: number;
|
|
@@ -1586,6 +1748,18 @@ declare class RAFPlayback {
|
|
|
1586
1748
|
* restart's freshly-repopulated `_rafId`. On `false` (or a stale
|
|
1587
1749
|
* generation that finishes) the loop cleans up. `play`/`drive`/`loop`
|
|
1588
1750
|
* are the three thin entry shapes over this one core.
|
|
1751
|
+
*
|
|
1752
|
+
* A FRAME MAY FAIL, AND FAILING IS NOT WEDGING (X.KF.W5 C-2 / G-RAF).
|
|
1753
|
+
* `step` had no failure path at all: a synchronous throw skipped
|
|
1754
|
+
* `reschedule` outright and a rejected async result met a `.then` with no
|
|
1755
|
+
* rejection arm, so in both shapes `_cleanup` never ran, `_rafId` stayed
|
|
1756
|
+
* populated, `running` stayed TRUE for the lifetime of the driver, and a
|
|
1757
|
+
* pending `play()` promise never settled — every consumer guarding on
|
|
1758
|
+
* `!playback.running` was then a permanent no-op. A failed frame now winds
|
|
1759
|
+
* the loop down through the SAME generation-guarded path a finished one
|
|
1760
|
+
* takes, and then RE-RAISES the failure unchanged: loud (the host's
|
|
1761
|
+
* uncaught-error channel sees the original error, nothing is absorbed) and
|
|
1762
|
+
* recoverable (the next `play`/`drive`/`loop` re-arms).
|
|
1589
1763
|
*/
|
|
1590
1764
|
private _run;
|
|
1591
1765
|
/**
|
|
@@ -1648,8 +1822,14 @@ export { RangePhase }
|
|
|
1648
1822
|
* takes a SCALE, not just a boolean — WCAG 2.3.3-aligned ("shorten the
|
|
1649
1823
|
* travel, keep the meaning"):
|
|
1650
1824
|
*
|
|
1651
|
-
* - `false` / `undefined` — do not honor reduced motion
|
|
1652
|
-
*
|
|
1825
|
+
* - `false` / `undefined` — do not honor reduced motion: the animation runs at
|
|
1826
|
+
* full amplitude regardless of the OS query. This is the policy VALUE's
|
|
1827
|
+
* meaning, NOT the engine's default — X.KF.W5 ruling KF-W5R4(3) (COHESION
|
|
1828
|
+
* §0j.C) INVERTED the orchestrator defaults to `respectReducedMotion: true`
|
|
1829
|
+
* (`AnimationGroup`, `Sequence`, `startViewTransition`), so honouring the
|
|
1830
|
+
* preference is what a caller gets by omission and `false` is the explicit
|
|
1831
|
+
* opt-out. A surface that still seeds `false` by default is named in the
|
|
1832
|
+
* wave record's residual list, not described as "conservative" here.
|
|
1653
1833
|
* - `true` — the classic binary snap: under an active `prefers-reduced-motion:
|
|
1654
1834
|
* reduce` the surface jumps to its terminal state (amplitude scale `0`).
|
|
1655
1835
|
* - a `number` ∈ [0, 1] — the INTENSITY: under an active query the surface
|
|
@@ -1801,6 +1981,22 @@ export declare const resolveLiveKeyframes: <V extends Vars = Vars>(source?: Docu
|
|
|
1801
1981
|
*/
|
|
1802
1982
|
export declare function resolveRange(range: AnimationRangeValue | undefined): ResolvedRange;
|
|
1803
1983
|
|
|
1984
|
+
/** Resolve a callable, canonical Value name, or CSS timing-function literal. */
|
|
1985
|
+
export declare const resolveTimingFunction: (timingFunction: TimingFunction | string) => TimingFunction;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* ms → a CSS time literal, in the unit the author wrote (UIA-KF-177).
|
|
1989
|
+
*
|
|
1990
|
+
* value.js 4.1.0's `CSSAnimationOptions` carries the authored `<time>` unit
|
|
1991
|
+
* beside the number (`durationUnit` / `delayUnit`), and kf's options keep it
|
|
1992
|
+
* from ingest, so an authored `500ms` emits `500ms` and an authored `0.05s`
|
|
1993
|
+
* emits `0.05s`. A time with no authored unit (a programmatic number, an
|
|
1994
|
+
* external stagger offset) has no spelling to keep, so it takes the shortest
|
|
1995
|
+
* exact literal, seconds on a tie (the CSSOM's canonical unit;
|
|
1996
|
+
* X.KF.W13X.r4lib). Every spelling parses back to the same milliseconds.
|
|
1997
|
+
*/
|
|
1998
|
+
export declare const reverseCSSTime: (milliseconds: number, unit?: CssTimeUnit) => string;
|
|
1999
|
+
|
|
1804
2000
|
declare const rotateIn: PresetFactory;
|
|
1805
2001
|
|
|
1806
2002
|
declare const rotateScale: PresetFactory;
|
|
@@ -2146,7 +2342,9 @@ declare class Sequence<V extends Vars = Vars> implements SequencePlayContext<V>
|
|
|
2146
2342
|
pause(): this;
|
|
2147
2343
|
/** Resume a paused sequence — restart the rAF loop with the origin
|
|
2148
2344
|
* re-anchored so the first resumed frame's master clock equals the retained
|
|
2149
|
-
* `_time` (no forward jump).
|
|
2345
|
+
* `_time` (no forward jump). A seeked-only sequence (no play in flight)
|
|
2346
|
+
* begins a play from its playhead (KFA-17); a live unpaused play is left
|
|
2347
|
+
* alone. Body in `./lifecycle`. */
|
|
2150
2348
|
resume(): this;
|
|
2151
2349
|
/** Set the scalar playback rate — slow-mo (`< 1`), real-time (`1`),
|
|
2152
2350
|
* fast-forward (`> 1`), or backward (`< 0`, the {@link reverse} form); the
|
|
@@ -2253,8 +2451,9 @@ declare interface SequenceOptions {
|
|
|
2253
2451
|
/**
|
|
2254
2452
|
* When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
|
|
2255
2453
|
* every child to its rest frame in a single paint (delegated to each
|
|
2256
|
-
* child's own reduced-motion contract via a terminal `seek`). Default
|
|
2257
|
-
*
|
|
2454
|
+
* child's own reduced-motion contract via a terminal `seek`). **Default
|
|
2455
|
+
* `true`** — X.KF.W5 ruling KF-W5R4(3) (COHESION §0j.C), the engine-wide PRM
|
|
2456
|
+
* default inversion; `false` is the explicit opt-out. SSR-safe off-DOM.
|
|
2258
2457
|
*/
|
|
2259
2458
|
respectReducedMotion?: boolean;
|
|
2260
2459
|
}
|
|
@@ -2323,6 +2522,8 @@ export declare function serializeScrollOptions(opts: CSSTimelineOptions): {
|
|
|
2323
2522
|
"animation-trigger"?: string;
|
|
2324
2523
|
};
|
|
2325
2524
|
|
|
2525
|
+
export declare const serializeTimingFunction: (value: NonNullable<CSSAnimationOptions["timingFunction"]>) => CssEasingLiteral;
|
|
2526
|
+
|
|
2326
2527
|
declare const shake: PresetFactory;
|
|
2327
2528
|
|
|
2328
2529
|
declare const skeletonLoading: PresetFactory;
|
|
@@ -2571,7 +2772,41 @@ declare interface TimelineOptions {
|
|
|
2571
2772
|
|
|
2572
2773
|
declare type TimingFunction = (t: number) => number;
|
|
2573
2774
|
|
|
2574
|
-
|
|
2775
|
+
/**
|
|
2776
|
+
* The registry roster with each name's curve, evaluated at module top level —
|
|
2777
|
+
* THE BOOT FENCE (G-KF3-6): a `bezierPresets` key value stops accepting is a kf
|
|
2778
|
+
* boot `throw` here, and a key it adds silently widens this public roster.
|
|
2779
|
+
*
|
|
2780
|
+
* The references are value.js's memoised ones, so they are stable but NOT
|
|
2781
|
+
* injective: the 40 names resolve onto **31** distinct references, because nine
|
|
2782
|
+
* hyphen/camel twin pairs (`ease-out-cubic` ≡ `easeOutCubic`, `smooth-step-3` ≡
|
|
2783
|
+
* `smoothStep3`, …) share one value.js function. A reference therefore
|
|
2784
|
+
* identifies the CURVE and never the name that produced it — which is why
|
|
2785
|
+
* `easing-serialize.ts`'s reverse lookup can tell a registry curve from a
|
|
2786
|
+
* closure but cannot recover WHICH name was written, and why G-KFW4-5 proves
|
|
2787
|
+
* identity by sampled value-identity on the 33-point grid rather than by name
|
|
2788
|
+
* equality (COHESION §0j.C KF-SS3). `test/compile/easing-identity.test.ts`
|
|
2789
|
+
* asserts all three facts.
|
|
2790
|
+
*/
|
|
2791
|
+
export declare const timingFunctionEntries: readonly (readonly [
|
|
2792
|
+
string,
|
|
2793
|
+
EasingFunction
|
|
2794
|
+
])[];
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* The registry's easing NAMES — exactly the roster
|
|
2798
|
+
* `compile/easing/registry.ts` builds at module evaluation (value.js's
|
|
2799
|
+
* `bezierPresets` keys + `"ease-in-bounce"` + the camel `DIRECT_NAMES`), and
|
|
2800
|
+
* nothing else.
|
|
2801
|
+
*
|
|
2802
|
+
* `"steps"` is NOT a member (X.KF.W4 KF-CB-24): bare `steps` carries no count
|
|
2803
|
+
* and no jump term, so it fails the CSS Easing L1 parse and is absent from
|
|
2804
|
+
* `registryNames` — `resolveTimingFunction("steps")` THROWS on it. The
|
|
2805
|
+
* parametric `steps(4, jump-end)` is a CSS LITERAL, resolved through the parser
|
|
2806
|
+
* branch, never a name. `test/compile/timing-function-names.test.ts`
|
|
2807
|
+
* (G-KFW4-13) asserts this union and the runtime roster are the same set.
|
|
2808
|
+
*/
|
|
2809
|
+
declare type TimingFunctionNames = BezierPresetName | "ease-in-bounce" | "easeOutCubic" | "easeInOutSine" | "easeInOutCubic" | "easeInOutQuad" | "easeInOutExpo" | "easeInOutCirc" | "easeOutExpo" | "smoothStep3" | "easeInBounce";
|
|
2575
2810
|
|
|
2576
2811
|
declare type TransformFunction<V extends Vars> = (v: V, t: number) => void;
|
|
2577
2812
|
|