@mkbabb/keyframes.js 4.4.0 → 5.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.
Files changed (39) hide show
  1. package/README.md +36 -221
  2. package/dist/animation-BGyzfzBq.js +947 -0
  3. package/dist/compile-CcSUwM8R.js +276 -0
  4. package/dist/{waapi-D9MHMm_9.js → delegation-DWwr4IXr.js} +116 -32
  5. package/dist/{draw-svg-DYRDxBlL.js → draw-svg-GURj9nin.js} +17 -13
  6. package/dist/easing-registry-DHV2-5gA.js +27 -0
  7. package/dist/easing-registry-y1p9McFy.js +2 -0
  8. package/dist/engine/index.d.ts +2873 -0
  9. package/dist/engine/index.js +17 -0
  10. package/dist/engine-DEVgCTUy.js +156 -0
  11. package/dist/engine-DrBtsKaf.js +4 -0
  12. package/dist/{format-BUgCTjmr.js → format-C-Gi9r7L.js} +4 -4
  13. package/dist/{scroll-grammar-B4kPvGh5.js → grammar-BLucehC4.js} +1 -1
  14. package/dist/group-vJcsHKN9.js +360 -0
  15. package/dist/{ingest-CNM5xkQT.js → ingest-S5hUe20K.js} +62 -56
  16. package/dist/keyframes.d.ts +585 -989
  17. package/dist/keyframes.js +188 -129
  18. package/dist/morph-svg-BToeumw5.js +89 -0
  19. package/dist/{motion-path-J-RSNmRQ.js → motion-path-pQVbamWT.js} +16 -12
  20. package/dist/parse-flatten-DRMHFytp.js +2 -0
  21. package/dist/parse-flatten-ZZUSEQEL.js +63 -0
  22. package/dist/{animations-5nf2kBkv.js → presets-BG2Fczzq.js} +124 -73
  23. package/dist/{scheduler-7eIr_q1g.js → scheduler-CUtVnuoU.js} +1 -1
  24. package/dist/{scroll-scene-CXEgM49Q.js → scroll-CxpYFO4u.js} +50 -46
  25. package/dist/sequence-C_DCiOIQ.js +708 -0
  26. package/dist/validate-DDeGnvSt.js +39 -0
  27. package/package.json +45 -6
  28. package/dist/animate-CuUJt2Tb.js +0 -26
  29. package/dist/compile-DgNRG6Lo.js +0 -251
  30. package/dist/decay-BvNmFk51.js +0 -25
  31. package/dist/engine-CNHvTgpw.js +0 -1122
  32. package/dist/errors-W8zkvPw4.js +0 -21
  33. package/dist/morph-svg-DRjl9Hfz.js +0 -62
  34. package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
  35. package/dist/sequence-CF5hazqz.js +0 -198
  36. package/dist/springTimingFunction-CDHZ00JQ.js +0 -63
  37. package/dist/timeline-B7SV3T_E.js +0 -442
  38. package/dist/utils-D7nuAND5.js +0 -97
  39. package/dist/validate-8r6Yo-uc.js +0 -35
package/README.md CHANGED
@@ -6,9 +6,11 @@ CSS keyframe animations for anything in JavaScript. Specify your keyframes in st
6
6
 
7
7
  ## Quick Start
8
8
 
9
- Create a `CSSKeyframesAnimation`, feed it CSS `@keyframes`, add targets, play:
9
+ Create a `CSSKeyframesAnimation`, feed it CSS `@keyframes`, add targets, play. The engine class is a static, synchronous import from the `@mkbabb/keyframes.js/engine` subpath (it carries the CSS parser + `@mkbabb/value.js`; the light `.` barrel stays value.js-free):
10
+
11
+ ```ts run
12
+ import { CSSKeyframesAnimation } from "@mkbabb/keyframes.js/engine";
10
13
 
11
- ```ts
12
14
  const anim = new CSSKeyframesAnimation({
13
15
  duration: 2000,
14
16
  iterationCount: Infinity,
@@ -18,17 +20,10 @@ const anim = new CSSKeyframesAnimation({
18
20
 
19
21
  anim.fromString(`
20
22
  @keyframes mijn-keyframes {
21
- from {
22
- transform: translateX(-100%) translateY(-100%) rotate(0turn);
23
- background-color: #C462D8;
24
- }
25
- 100% {
26
- transform: translateX(50%) translateY(75%) rotate(1turn);
27
- background-color: #E85252;
28
- }
23
+ from { transform: translateX(-100%); background-color: #C462D8; }
24
+ to { transform: translateX(50%); background-color: #E85252; }
29
25
  }
30
26
  `);
31
-
32
27
  anim.setTargets(document.getElementById("myElement"));
33
28
  anim.play();
34
29
  ```
@@ -37,46 +32,6 @@ This animates the element's style properties as specified in the keyframes. The
37
32
 
38
33
  The [demo apps](demo/) exercise this pattern end-to-end — [try them live](https://keyframes.babb.dev/).
39
34
 
40
- ## Table of Contents
41
-
42
- - [Installation](#installation)
43
- - [Project Structure](#project-structure)
44
- - [Animation](#animation)
45
- - [AnimationOptions](#animationoptions)
46
- - [Transform Function](#the-transform-function)
47
- - [Timing Function](#the-timing-function)
48
- - [TemplateAnimationFrame](#templateanimationframe)
49
- - [The dynamic engine — loadAnimationEngine()](#the-dynamic-engine--loadanimationengine)
50
- - [animate](#animate)
51
- - [MotionPath](#motionpath)
52
- - [DrawSVG](#drawsvg)
53
- - [CSSKeyframesAnimation](#csskeyframesanimation)
54
- - [Parsing CSS Keyframes](#parsing-css-keyframes)
55
- - [Units](#units)
56
- - [AnimationGroup](#animationgroup)
57
- - [Presets](#presets)
58
- - [The round-trip — ingest, drive, compile](#the-round-trip--ingest-drive-compile)
59
- - [Ingest — read the live web's CSS](#ingest--read-the-live-webs-css)
60
- - [Scroll-as-CSS — the animation-timeline grammar](#scroll-as-css--the-animation-timeline-grammar)
61
- - [Compile — the parser run backward](#compile--the-parser-run-backward)
62
- - [Web Animations API](#web-animations-api)
63
- - [Baseline, tree-shaking & reduced motion](#baseline-tree-shaking--reduced-motion)
64
- - [Beyond CSS](#beyond-css)
65
- - [NumericAnimation](#numericanimation)
66
- - [SmoothProgress](#smoothprogress)
67
- - [ElementMorph](#elementmorph)
68
- - [Timeline](#timeline)
69
- - [SpringProgress](#springprogress)
70
- - [springLinearStops & springTimingFunction](#springlinearstops--springtimingfunction)
71
- - [RAFPlayback](#rafplayback)
72
- - [stagger](#stagger)
73
- - [flip / flipShared](#flip--flipshared)
74
- - [drag / Draggable](#drag--draggable)
75
- - [decay / decayRest](#decay--decayrest)
76
- - [Sequence](#sequence)
77
- - [Ecosystem & agents](#ecosystem--agents)
78
- - [Build & Development](#build--development)
79
-
80
35
  ## Installation
81
36
 
82
37
  ```bash
@@ -88,52 +43,19 @@ Works both in and out of the browser. Anything that touches the DOM (`getCompute
88
43
  ## Project Structure
89
44
 
90
45
  ```
91
- src/
92
- ├── animation/ # THE library — engine + every primitive (see src/animation/CLAUDE.md)
93
- │ ├── index.ts # Package barrel: the LIGHT static surface + loadAnimationEngine()
94
- │ ├── engine.ts # HEAVY: Animation, CSSKeyframesAnimation, AnimationGroup
95
- │ ├── group.ts # AnimationGroup — multi-animation compositor
96
- │ ├── frame-compiler.ts # Keyframe → frame compilation
97
- │ ├── animate.ts # animate() — the single-call front door (HEAVY)
98
- │ ├── motion-path.ts # MotionPath — offset-distance over an offset-path (HEAVY)
99
- │ ├── draw-svg.ts # DrawSVG — stroke-dashoffset line drawing (HEAVY)
100
- │ ├── animations.ts # 30+ presets (HEAVY — `presets` on loadAnimationEngine())
101
- │ ├── numeric.ts # NumericAnimation — zero-alloc keyframe interpolation
102
- │ ├── smooth.ts # SmoothProgress — exponential smoothing
103
- │ ├── spring.ts # SpringProgress — analytic spring solver
104
- │ ├── springLinearStops.ts # spring → CSS linear() stop string
105
- │ ├── springTimingFunction.ts # spring → typed Easing (.fn + .css twin)
106
- │ ├── morph.ts # ElementMorph — rect-to-rect transform interpolation
107
- │ ├── timeline.ts # Timeline, ScrollTimeline, ManualTimeline (+ native bridge)
108
- │ ├── playback.ts # RAFPlayback — THE managed rAF driver
109
- │ ├── stagger.ts # stagger — per-index delay distributions
110
- │ ├── flip.ts # flip / flipShared — FLIP over ElementMorph
111
- │ ├── drag.ts # drag / Draggable — spring-backed pointer drag
112
- │ ├── decay.ts # decay / decayRest — frictional glide closed form
113
- │ ├── sequence.ts # Sequence — master-playhead orchestrator
114
- │ ├── easing.ts # toEasing / resolveEasing — the easing boundary
115
- │ ├── adapter.ts / waapi.ts / format.ts / constants.ts / utils.ts / internal/
116
- └── env.d.ts
117
-
118
- demo/ # Vue 3 demo apps (see demo/CLAUDE.md)
119
- ├── @/ # Shared editor shell, composables, UI, styles
120
- ├── app/ # Multi-scene demo SPA — the deployed demo
121
- ├── cube/ # 3D cube + AnimationGroup + matrix editor
122
- ├── square/ # Custom transform function
123
- ├── amiga/ # 3D animated sphere (Three.js)
124
- ├── easing/ # Easing editor
125
- ├── motion-path/ # MotionPath scene
126
- ├── sequence/ # Sequence orchestration scene
127
- ├── spring/ # Spring physics scene
128
- └── playground/ # Asset playground
129
-
130
- test/ # Vitest suites (jsdom)
131
- bench/ # Vitest benchmarks
46
+ src/animation/ # THE library — engine + every primitive (see src/animation/CLAUDE.md)
47
+ demo/ # Vue 3 demo apps (see demo/CLAUDE.md)
48
+ test/ # Vitest suites (jsdom)
49
+ bench/ # Vitest benchmarks
50
+ scripts/ # CI gates (proof:* scripts) + code generators
51
+ docs/ # Migration guide, published surface manifest, architecture notes
132
52
  ```
133
53
 
54
+ For the authoritative per-file inventory, see [`src/animation/CLAUDE.md`](src/animation/CLAUDE.md).
55
+
134
56
  ## Animation
135
57
 
136
- The `Animation` object drives `CSSKeyframesAnimation` and `AnimationGroup`. It's composed of:
58
+ The `KeyframesAnimation` object drives `CSSKeyframesAnimation` and `AnimationGroup`. It's composed of:
137
59
 
138
60
  - **options** (`AnimationOptions`)
139
61
  - **transform function**: interpolates between keyframes
@@ -170,7 +92,7 @@ Every value is parsed as a CSS value unit (`1px`, `1em`, `1deg`, etc.). To inter
170
92
  type TimingFunction = (t: number) => number;
171
93
  ```
172
94
 
173
- Takes `t` in `[0, 1]`, returns `[0, 1]`. All CSS timing functions are implemented in [`easing.ts`](src/easing.ts).
95
+ Takes `t` in `[0, 1]`, returns `[0, 1]`. All CSS timing functions are implemented in `easing.ts`.
174
96
 
175
97
  #### Step functions
176
98
 
@@ -185,13 +107,7 @@ Implemented as `steppedEase(t, steps, jumpTerm)`:
185
107
 
186
108
  `cubicBezier(t, x1, y1, x2, y2)` implements the cubic case. The general case uses de Casteljau's algorithm iteratively.
187
109
 
188
- Both are in [`math.ts`](src/math.ts). For Bezier visualizations, see [this Desmos graph](https://www.desmos.com/calculator/tvivnkflzv) or the `timing-functions` demo.
189
-
190
- `CSSCubicBezier` is the higher-order convenience: takes control points, returns a `t → value` function. CSS's named easings are built from it:
191
-
192
- ```ts
193
- const easeInBounce = (t: number) => CSSCubicBezier(0.09, 0.91, 0.5, 1.5)(t);
194
- ```
110
+ For Bezier visualizations, see [this Desmos graph](https://www.desmos.com/calculator/tvivnkflzv).
195
111
 
196
112
  ### `TemplateAnimationFrame`
197
113
 
@@ -203,33 +119,11 @@ A template keyframe prior to resolution. Composed of:
203
119
  - `transform`: per-keyframe transform function (optional)
204
120
  - `timingFunction`: per-keyframe timing function (optional)
205
121
 
206
- Once a transform or timing function is specified, it propagates to all subsequent keyframes.
207
-
208
- #### Reification
209
-
210
- Template keyframes are reified into concrete keyframes by:
211
-
212
- 1. **Parsing start times**: CSS time formats (`1s`, `100ms`), raw numbers, or percentages (`50%`). All normalized to a percentage of total duration.
213
- 2. **Resolving functions**: null transforms and timing functions fall back to the `AnimationOptions` defaults.
214
- 3. **Sorting** by start percentage.
215
- 4. **Resolving variables** across keyframes—every keyframe ends up with the same variable set.
216
- 5. **Computing durations** from sorted start/stop times.
217
-
218
- #### Variable resolution
219
-
220
- Keyframes needn't declare the same variables. The resolver walks backward from each keyframe, seeking the most recent definition of each variable. If none exists, the default value (typically `0`) is used.
221
-
222
- ```ts
223
- const kf1 = { start: "0s", vars: { x: 0, y: 0 } };
224
- const kf2 = { start: "500ms", vars: { x: 1 } };
225
- const kf3 = { start: "100%", vars: { x: 0, y: 1 } };
226
- ```
227
-
228
- `kf2` gets `y: 0` from `kf1`. This lets you specify keyframes loosely.
122
+ Once a transform or timing function is specified, it propagates to all subsequent keyframes. Keyframes needn't declare the same variables — the resolver walks backward from each keyframe to fill gaps.
229
123
 
230
124
  ### The dynamic engine — `loadAnimationEngine()`
231
125
 
232
- The package splits along a static/dynamic boundary (see [tree-shaking](#baseline-tree-shaking--reduced-motion)). The classes above — `Animation`, `CSSKeyframesAnimation`, `AnimationGroup` — are the **heavy** tier: they carry the CSS parser and `@mkbabb/value.js`, and their runtime constructors are reached **only** through `loadAnimationEngine()`, one awaited dynamic import:
126
+ The package splits along a static/dynamic boundary (see [tree-shaking](#baseline-tree-shaking--reduced-motion)). The classes above — `KeyframesAnimation`, `CSSKeyframesAnimation`, `AnimationGroup` — are the **heavy** tier: they carry the CSS parser and `@mkbabb/value.js`, and their runtime constructors are reached **only** through `loadAnimationEngine()`, one awaited dynamic import:
233
127
 
234
128
  ```ts run
235
129
  import { loadAnimationEngine } from "@mkbabb/keyframes.js";
@@ -243,25 +137,7 @@ anim.setTargets(element);
243
137
  await anim.play();
244
138
  ```
245
139
 
246
- The engine surface (`AnimationEngine`): `Animation`, `CSSKeyframesAnimation`, `AnimationGroup`, `getAnimationId`, `getTimingFunction`, `resolveKeyframes`, `animate`, `MotionPath`/`fromMotionPath`, `DrawSVG`/`fromDrawSVG`, `MorphSVG`/`fromMorphSVG`, `presets`, and the option constants `DIRECTIONS`, `FILL_MODES`, `defaultOptions`, `defaultLayerConfig`. The **type** surface stays on the static barrel — `import type { Animation } from "@mkbabb/keyframes.js"` costs no runtime edge.
247
-
248
- ### `animate`
249
-
250
- The single-call front door: construct + target + play in one call, dispatched on the **shape** of the input. The returned `CSSKeyframesAnimation` is the control handle — `.pause()` / `.play()` / `.stop()` / `await handle.finished`.
251
-
252
- ```ts run
253
- const { animate } = await loadAnimationEngine();
254
-
255
- const fade = animate(box, { "0%": { opacity: 0 }, "100%": { opacity: 1 } }, { duration: 200 });
256
- await fade.finished;
257
-
258
- // Dispatch on the input's shape:
259
- animate(box, `from { opacity: 0 } to { opacity: 1 }`, { autoPlay: false }); // CSS string → fromString
260
- animate(box, [{ opacity: 0 }, { opacity: 1 }], { autoPlay: false }); // vars array → fromVars
261
- animate(box, { path: "path('M 0 0 H 100')" }, { autoPlay: false }); // MotionPath spec → fromMotionPath
262
- ```
263
-
264
- Options: every [`AnimationOptions`](#animationoptions) key, plus `transform` (a custom renderer forwarded to the `from*` factory) and `autoPlay` (default `true`; `false` returns a constructed, targeted, not-yet-playing handle).
140
+ The engine surface (`AnimationEngine`): `KeyframesAnimation`, `CSSKeyframesAnimation`, `AnimationGroup`, `getAnimationId`, `getTimingFunction`, `resolveKeyframes`, `MotionPath`/`fromMotionPath`, `DrawSVG`/`fromDrawSVG`, `MorphSVG`/`fromMorphSVG`, `presets`, and the option constants `DIRECTIONS`, `FILL_MODES`, `defaultOptions`, `defaultLayerConfig`. The **type** surface stays on the static barrel — `import type { KeyframesAnimation } from "@mkbabb/keyframes.js"` costs no runtime edge.
265
141
 
266
142
  ### `MotionPath`
267
143
 
@@ -304,7 +180,7 @@ Options: `from`/`to` (`"0%"`–`"100%"` strings or `0`–`1` numbers; default dr
304
180
 
305
181
  Path-shape morphing — interpolate one SVG path `d` into another. value.js's `PathGeometry` owns the geometry (arc-length sampling via `getTotalLength()`/`getPointAtLength()`); keyframes samples both paths at `samples` uniform points and lerps the matched point sets, so the engine's native numeric interpolation *is* the morph (a true blend — the midpoint is distinct from both endpoints, not a cross-fade).
306
182
 
307
- ```ts
183
+ ```ts run
308
184
  const { fromMorphSVG, MorphSVG } = await loadAnimationEngine();
309
185
 
310
186
  // Morph a triangle into a square over 600ms:
@@ -319,7 +195,7 @@ Options: `samples` (point count per path; default `64`), plus every `AnimationOp
319
195
 
320
196
  ## `CSSKeyframesAnimation`
321
197
 
322
- An abstraction over `Animation` that parses CSS `@keyframes` into `TemplateAnimationFrame` objects, then adds them to a base `Animation`.
198
+ An abstraction over `KeyframesAnimation` that parses CSS `@keyframes` into `TemplateAnimationFrame` objects, then adds them to a base `KeyframesAnimation`.
323
199
 
324
200
  Three ways to create keyframes:
325
201
 
@@ -338,7 +214,7 @@ The default transform applies interpolated values to `element.style` for each ta
338
214
 
339
215
  ### Parsing CSS keyframes
340
216
 
341
- [`keyframes.ts`](src/parsing/keyframes.ts) covers most of the CSS spec:
217
+ `keyframes.ts` covers most of the CSS spec:
342
218
 
343
219
  - `from`, `to`, and percentages
344
220
  - Time units (`s`, `ms`)
@@ -354,23 +230,7 @@ The parser uses [`@mkbabb/parse-that`](https://github.com/mkbabb/parse-that) and
354
230
 
355
231
  ### Units
356
232
 
357
- Thorough unit parsing and resolution, covering:
358
-
359
- - **length**, **angle**, **time**, **resolution**, **percentage**, **color**
360
-
361
- See [`units/`](src/units/) and [`parsing/units.ts`](src/parsing/units.ts).
362
-
363
- A `unit` value takes one of three forms:
364
-
365
- - `ValueUnit`: a value with a string unit and an array of supertypes
366
- - `FunctionValue`: a function name with an array of `ValueUnit`s
367
- - `ValueArray`: an array of `ValueUnit`s
368
-
369
- Each defines `toString()`, `valueOf()`, and `lerp(t, other, target?)`. Any `ValueUnit` variant can interpolate with any other—values are aligned to the shorter array, then interpolated element-wise.
370
-
371
- Units of the same supertype interpolate freely. Supertypes also encode whether a unit is relative or absolute (`px` is absolute; `em` is relative), used to resolve to a common base before interpolation.
372
-
373
- Interpolation dispatch: numeric values use `lerp`; colors use perceptual interpolation (`oklab` by default, configurable); computed units (`vh`, `vw`, `calc`, `var`) resolve against the live DOM at interpolation time.
233
+ Unit parsing and resolution (length, angle, time, percentage, color, and container-query units) are handled by [`@mkbabb/value.js`](https://github.com/mkbabb/value.js). `ValueUnit`, `FunctionValue`, and `ValueArray` are the three token shapes; all define `toString()`, `valueOf()`, and `lerp()`.
374
234
 
375
235
  ## `AnimationGroup`
376
236
 
@@ -396,7 +256,7 @@ The group manages its own `requestAnimationFrame` loop and marks child animation
396
256
 
397
257
  ## Presets
398
258
 
399
- 30+ ready-to-use animations in [`animations.ts`](src/animation/animations.ts). All return `CSSKeyframesAnimation` instances and accept optional `InputAnimationOptions`. Each builds a value.js-bearing `CSSKeyframesAnimation`, so the presets ride the heavy dynamic boundary (the `presets` namespace on `loadAnimationEngine()`) rather than the value.js-free static barrel:
259
+ 30+ ready-to-use animations in `src/animation/presets/`. All return `CSSKeyframesAnimation` instances and accept optional `InputAnimationOptions`. Each builds a value.js-bearing `CSSKeyframesAnimation`, so the presets ride the heavy dynamic boundary (the `presets` namespace on `loadAnimationEngine()`) rather than the value.js-free static barrel:
400
260
 
401
261
  ```ts
402
262
  import { loadAnimationEngine } from "@mkbabb/keyframes.js";
@@ -405,10 +265,6 @@ const { presets } = await loadAnimationEngine();
405
265
  const anim = presets.fadeIn({ duration: 500 });
406
266
  anim.setTargets(element);
407
267
  anim.play();
408
-
409
- // …or the single-call front door (auto-target + auto-play):
410
- const { animate } = await loadAnimationEngine();
411
- animate(element, presets.fadeIn());
412
268
  ```
413
269
 
414
270
  **Fade**: `fadeIn`, `fadeOut` · **Attention**: `pulse`, `heartbeat`, `glow`, `shake`, `bounce` · **Entrance/Exit**: `flip`, `rotateIn`, `slideIn`, `slideInLeft/Right`, `slideOutLeft/Right`, `blurIn/Out/InOut`, `jumpUp/Down`, `warpLeft/Right` · **Effects**: `hover`, `typewriter`, `typingCursor`, `rainbowText`, `progressBar`, `skeletonLoading`, `spinner`, `parallaxScroll`, `gradientBackground`, `rotateScale`, `accordionExpand`, `notificationBounce`, `textFocusBlur`
@@ -538,12 +394,12 @@ keyframes.js targets a modern-web Baseline and documents the tier of every platf
538
394
  | WAAPI `linear()` springs | Newly available | Feature-detected; the rAF spring path is the default fallback |
539
395
  | `Element.animate()` (WAAPI) | Widely available | Opt-out via `useWAAPI: false` |
540
396
 
541
- **Tree-shaking — the value.js boundary.** The package is `"sideEffects": false` and splits along a static/dynamic boundary. The light physics/interpolation engines — `SpringProgress`, `SmoothProgress`, `NumericAnimation`, `ElementMorph`, the `Timeline` family, `RAFPlayback`, and the spring-stop helpers — carry **zero** static import edge to `@mkbabb/value.js`. A consumer that imports only these never pulls value.js (or the heavy CSS-keyframe parser) into its graph; the heavy engine (`Animation`, `CSSKeyframesAnimation`, `AnimationGroup`) is reached only through `loadAnimationEngine()`'s dynamic `import()`. This boundary is **gated in CI** by `proof:boundary`, which builds a spring-only entry and fails the build if any light module reintroduces a static value.js edge.
397
+ **Tree-shaking — the value.js boundary.** The package is `"sideEffects": false` and splits along a static/dynamic boundary. The light physics/interpolation engines — `SpringProgress`, `SmoothProgress`, `NumericAnimation`, `ElementMorph`, the `Timeline` family, `RAFPlayback`, and the spring-stop helpers — carry **zero** static import edge to `@mkbabb/value.js`. A consumer that imports only these never pulls value.js (or the heavy CSS-keyframe parser) into its graph; the heavy engine (`KeyframesAnimation`, `CSSKeyframesAnimation`, `AnimationGroup`) is reached only through `loadAnimationEngine()`'s dynamic `import()`. This boundary is **gated in CI** by `proof:boundary`, which builds a spring-only entry and fails the build if any light module reintroduces a static value.js edge.
542
398
 
543
399
  **Reduced motion.** Both the light and heavy engines honor `prefers-reduced-motion: reduce`. Opt in per surface:
544
400
 
545
401
  - **Light interpolators** (`NumericAnimation`, `SmoothProgress`, `SpringProgress`, `ElementMorph`) — pass `respectReducedMotion: true`. `RAFPlayback` owns the shared snap-to-final gate, so the managed `.play()` path skips the rAF loop and lands on the final value in a single paint.
546
- - **Heavy engine** (`Animation` / `CSSKeyframesAnimation`) — pass `respectReducedMotion: true`; `play()` snaps to the final frame (a single paint, `animationstart` → `animationend`) instead of running the rAF/WAAPI loop.
402
+ - **Heavy engine** (`KeyframesAnimation` / `CSSKeyframesAnimation`) — pass `respectReducedMotion: true`; `play()` snaps to the final frame (a single paint, `animationstart` → `animationend`) instead of running the rAF/WAAPI loop.
547
403
  - **`AnimationGroup`** — set `group.respectReducedMotion = true`; `play()` composites every child's final frame once rather than driving the draw loop.
548
404
 
549
405
  Off-DOM (SSR / Node) the check is a no-op and animations proceed normally.
@@ -630,7 +486,7 @@ Abstract progress driver. Pipeline: `sample() → clamp → easing → boundary
630
486
 
631
487
  ```ts run
632
488
  const easing = await resolveEasing("easeOutCubic");
633
- const timeline = new ScrollTimeline({
489
+ const timeline = new KeyframesScrollTimeline({
634
490
  threshold: 0.35,
635
491
  easing,
636
492
  boundaryEpsilon: 0.005,
@@ -651,7 +507,7 @@ manual.tick(); // => 0.25
651
507
  Options: `easing` (callable or `Easing`), `smoothing` (`SmoothProgressOptions` or `false`), `boundaryEpsilon` (snap eased values within this distance of 0/1 to the boundary — prevents scroll-endpoint oscillation, default 0.005).
652
508
 
653
509
  Subclasses:
654
- - **`ScrollTimeline`** — scroll position → progress. `threshold` sets viewport fraction for full progress (default 0.35). Injectable `getScrollY`/`getViewportHeight`.
510
+ - **`KeyframesScrollTimeline`** — scroll position → progress. `threshold` sets viewport fraction for full progress (default 0.35). Injectable `getScrollY`/`getViewportHeight`.
655
511
  - **`ManualTimeline`** — externally set value → progress. Smoothing off by default.
656
512
 
657
513
  Where the platform ships native scroll-driven timelines, `createNativeTimeline({ kind: "scroll" | "view", … })` feature-detects and returns a native `AnimationTimeline` (or `null`) as an additive fast lane — the JS sampler stays the general fallback.
@@ -693,7 +549,7 @@ const stops = springLinearStops({ response: 0.5, dampingFraction: 0.45 });
693
549
  stops.startsWith("linear(0, "); // => true
694
550
  stops.endsWith(", 1)"); // => true
695
551
 
696
- // JS: a typed Easing — feed it to NumericAnimation / ElementMorph / Animation
552
+ // JS: a typed Easing — feed it to NumericAnimation / ElementMorph / KeyframesAnimation
697
553
  const spring = springTimingFunction({ response: 0.5, dampingFraction: 0.45 });
698
554
  spring.fn(0); // => 0
699
555
  spring.fn(1); // => 1
@@ -751,44 +607,6 @@ eased(3, 4); // => 300
751
607
 
752
608
  Options: `each` (per-step ms, default 100), `from` (`"first"` | `"last"` | `"center"` | `"edges"` | an index; default `"first"`), `ease` (callable or `Easing`; string names throw). Feed the delays to `AnimationGroup` per-child `delay`, `setTimeout`, or `animation-delay` — the generator is just arithmetic.
753
609
 
754
- #### Recipe — structural stagger, the CSS way
755
-
756
- The genre's text-reveal tools (GSAP SplitText) split text into per-letter DOM nodes. **Don't split text into letters**: letter-splitting produces non-functional accessibility markup across screen-reader/browser pairs (a 2026-documented hazard — `aria-label` is not honored on generic wrapper spans). keyframes.js takes the structural position: *we don't split your DOM; we stagger and spring over structure you own* — a visual-only reveal that never changes reading or tab order.
757
-
758
- - Reveal at **word or line** granularity, over markup you author: `aria-label` on a true container, `aria-hidden` fragments inside (or a visually-hidden duplicate) — the mitigations that actually work.
759
- - Drive the reveal with the shipped `stagger` + `SpringProgress` — the library performs no DOM mutation.
760
- - Perceptual color across the reveal is free — the engine's default `oklab` interpolation already applies.
761
-
762
- ```ts run
763
- // Markup you own:
764
- // <h1 aria-label="Spring forward">
765
- // <span aria-hidden="true">Spring</span> <span aria-hidden="true">forward</span>
766
- // </h1>
767
- const words = Array.from(heading.querySelectorAll<HTMLElement>("[aria-hidden]"));
768
- const delay = stagger(words.length, { each: 60 });
769
-
770
- words.forEach((word, i) => {
771
- setTimeout(() => {
772
- const spring = new SpringProgress({ response: 0.4, dampingFraction: 0.6 });
773
- spring.target = 1;
774
- spring.play((v) => {
775
- word.style.opacity = String(Math.min(1, v));
776
- word.style.transform = `translateY(${(1 - v) * 0.5}em)`;
777
- });
778
- }, delay(i, words.length));
779
- });
780
- ```
781
-
782
- Where `sibling-index()` is available, the same distribution emits as zero-runtime CSS — the progressive-enhancement path, not the default: `sibling-index()` is **not yet Baseline** (expected mid–late 2026), cannot appear inside `@keyframes`, and cannot carry the spring curve (pair it with a [`springLinearStops`](#springlinearstops--springtimingfunction) `linear()` timing function for that).
783
-
784
- ```css
785
- /* CSS-only structural stagger — progressive enhancement */
786
- h1 > span {
787
- animation: word-in 600ms both;
788
- animation-delay: calc(sibling-index() * 60ms);
789
- }
790
- ```
791
-
792
610
  ### `flip` / `flipShared`
793
611
 
794
612
  FLIP (First-Last-Invert-Play) layout animation over [`ElementMorph`](#elementmorph). `flip` animates a layout change on one element: measure (First) → `mutate()` (Last) → invert + play, with the two layout reads batched (no read/write thrash). `flipShared` animates element `a` onto element `b`'s rect — the shared-element / `layoutId` idiom.
@@ -878,13 +696,10 @@ Positions: a number (absolute ms), `"+=n"` / `"-=n"` (relative to the insertion
878
696
 
879
697
  ## Ecosystem & agents
880
698
 
881
- - **[`@mkbabb/keyframes-vue`](packages/keyframes-vue/)** — a thin Vue 3 adapter over this library. Two on-brand primitives: the declarative `<Keyframes :css>` component (the author's CSS `@keyframes` → a scalar-progress slot — the component no other engine can write, because no other engine parses author CSS as its source format) and the `useKfAnimation` composable kernel. `@mkbabb/keyframes.js` and `vue` are **peers** — the core library never carries Vue.
882
-
883
- ```sh
884
- npm i @mkbabb/keyframes-vue @mkbabb/keyframes.js vue
885
- ```
886
-
887
- - **[`llms.txt`](./llms.txt)** — the agent surface: a machine-readable index of every capability, **generated** from the CI-verified published surface (`docs/published-surface.md`) so it cannot drift from the shipped API. Point an LLM/agent at it for a grounded map of the primitives, the static/dynamic boundary, and the round-trip. `llms-full.txt` carries the expanded form.
699
+ - **`llms.txt`** — the agent surface: a machine-readable index of every capability, generated
700
+ from the CI-verified published surface (`docs/published-surface.md`) by running
701
+ `node scripts/gen-agent-surface.mjs`. The artifact is not tracked in git (generated at CI time);
702
+ `llms-full.txt` carries the expanded form.
888
703
 
889
704
  ## Build & Development
890
705
 
@@ -915,8 +730,8 @@ It pulls `node:24-slim` (kf's CI Node), mounts the repo at `/workspace`, install
915
730
 
916
731
  ## Contributing
917
732
 
918
- See [CONTRIBUTING.md](./CONTRIBUTING.md). The README shape follows the perimeter-level
919
- [canonical README shape](https://github.com/mkbabb/glass-ui/blob/master/docs/precepts/canonical-readme-shape.md).
733
+ Open a PR against `master`. Run `npm run proof:all` before pushing — the gate roster is the
734
+ acceptance bar.
920
735
 
921
736
  ## License
922
737