@mkbabb/keyframes.js 5.0.0 → 5.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.
Files changed (46) hide show
  1. package/README.md +112 -217
  2. package/dist/backward-color-BtbRcnna.js +108 -0
  3. package/dist/compile-BHCTPerD.js +30 -0
  4. package/dist/{waapi-D0ssxKy1.js → delegation-BQYCrP2p.js} +117 -99
  5. package/dist/{draw-svg-Dat9mHgi.js → draw-svg-CK9Qrly8.js} +18 -26
  6. package/dist/easing-registry-DHV2-5gA.js +27 -0
  7. package/dist/easing-registry-y1p9McFy.js +2 -0
  8. package/dist/easing-serialize-D4LZCB6i.js +21 -0
  9. package/dist/engine/index.d.ts +3139 -0
  10. package/dist/engine/index.js +16 -0
  11. package/dist/engine-CPK_udUQ.js +1172 -0
  12. package/dist/engine-DlpimZtM.js +3 -0
  13. package/dist/entry-D82NKUhP.js +148 -0
  14. package/dist/format-BdIvdLzG.js +114 -0
  15. package/dist/group-HM7N4uOE.js +390 -0
  16. package/dist/handle-D4xrf_ya.js +21 -0
  17. package/dist/{ingest-CU-kdYcM.js → ingest-_g6tfk2e.js} +62 -56
  18. package/dist/keyframes.d.ts +1156 -1099
  19. package/dist/keyframes.js +412 -132
  20. package/dist/morph-svg-KUrH9KnK.js +79 -0
  21. package/dist/motion-path-wM5tPfrY.js +26 -0
  22. package/dist/parse-flatten-DRMHFytp.js +2 -0
  23. package/dist/parse-flatten-ZZUSEQEL.js +63 -0
  24. package/dist/presets-DeDJYL4G.js +275 -0
  25. package/dist/{scheduler-7eIr_q1g.js → scheduler-CfGIC3GX.js} +1 -1
  26. package/dist/scroll-BEyCx0b_.js +287 -0
  27. package/dist/sequence-s0bL7Uul.js +736 -0
  28. package/dist/{validate-B1pE-Y_T.js → validate-xFZ_Ld1k.js} +17 -13
  29. package/dist/view-transition-BPJQxUTC.js +305 -0
  30. package/package.json +123 -84
  31. package/dist/animate-CTWr6K7j.js +0 -26
  32. package/dist/animations-CZxf0rep.js +0 -224
  33. package/dist/compile-YRJRdpKF.js +0 -251
  34. package/dist/decay-BvNmFk51.js +0 -25
  35. package/dist/engine-DQcb7CLW.js +0 -1349
  36. package/dist/errors-W8zkvPw4.js +0 -21
  37. package/dist/format-BUgCTjmr.js +0 -123
  38. package/dist/morph-svg-83uyYxoW.js +0 -84
  39. package/dist/motion-path-C0OHqcA3.js +0 -31
  40. package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
  41. package/dist/scroll-grammar-B4kPvGh5.js +0 -23
  42. package/dist/scroll-scene-DQxhxn9I.js +0 -176
  43. package/dist/sequence-cBr7thU8.js +0 -198
  44. package/dist/springTimingFunction-D26gPkAy.js +0 -63
  45. package/dist/timeline-vY3eD3Ax.js +0 -430
  46. package/dist/utils-BPRImVl5.js +0 -100
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 `KeyframesAnimation` object (formerly `Animation`, renamed in 5.0.0 — see `docs/MIGRATION-5.0.0.md`) 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`): `KeyframesAnimation`, `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 { KeyframesAnimation } 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
 
@@ -317,6 +193,31 @@ const dAtMid = morph.sampleD(0.5); // the interpolated `d` at t = 0.5
317
193
 
318
194
  Options: `samples` (point count per path; default `64`), plus every `AnimationOptions` key. Both inputs must be non-degenerate path `d` strings (non-zero arc length, ≥ 2 samples) — a degenerate input refuses with a typed `AnimationOptionError`. `MorphSVG.sampleD(t)` reassembles the morphed `d` at any `t`; the per-point coordinates also surface as `--morph-{i}-x`/`--morph-{i}-y` custom properties for direct CSS binding.
319
195
 
196
+ ### The emerging-CSS resolver
197
+
198
+ kf's parser accepts CSS the platform can't animate yet. The `resolve/` zone lowers `if(supports(...))` / `if(media(...))` / `if(style(--custom-prop))` and `@function` calls to concrete values **in JS, at parse/bind time** — so a `@keyframes` block authored against tomorrow's conditional grammar plays correctly **today, in every browser kf runs in**, even though the native CSS features themselves are Chromium-only (`if()` shipped Chrome 137; `@function`, Chrome 139 — neither ships in Firefox or Safari). `env()` sits outside this: it's ordinary CSS the platform has resolved for years, so there's no cross-browser gap for kf to bridge there.
199
+
200
+ This is a **resolve-once, not react-forever** lowering, not a live binding. The element-independent forms (`if(supports)`, `if(media)`, `@function`) resolve once when the keyframes parse; the element-aware forms (`if(style(--p))`, `sibling-index()`, `sibling-count()`) resolve once per `setTargets()`. None of them re-evaluate on a later media-query flip or custom-property write — rebuild the animation to re-resolve.
201
+
202
+ ```ts run
203
+ const { resolveKeyframes } = await loadAnimationEngine();
204
+
205
+ // Author against a condition the browser can't natively evaluate in if() yet —
206
+ // kf resolves it in JS and bakes the concrete branch into the parsed frame.
207
+ // Off-DOM (no CSS.supports), the SSR-safe default deterministically picks `else`:
208
+ const { keyframes } = resolveKeyframes(`
209
+ @keyframes x {
210
+ 0% { color: if(supports(color: lch(0 0 0)): red; else: blue) }
211
+ 100% { color: green }
212
+ }
213
+ `);
214
+ String(keyframes.get("0%")?.color); // => "rgb(0 0 255)"
215
+ ```
216
+
217
+ **What it refuses.** A condition that resolves to nothing is a CSS *guaranteed-invalid value* — `if()` with no matching branch and no `else`, or an over-deep/self-referential `@function` chain (cycle-guarded at depth 32) — **drops the declaration** (the prior/initial value wins), never an empty or malformed string. A `@function` call whose argument can't be coerced to the parameter's declared syntax drops the whole call too, surfaced as a named `CUSTOM_FN_ARG_DROP` diagnostic on `resolveKeyframes`'s `diagnostics` channel — never a silent `NaN`.
218
+
219
+ Gated by `npm run proof:emerging-css-resolve` (the `if(supports)`/`if(media)` pass, the element-aware `if(style)`/`sibling-index()`/`sibling-count()` pass, and `@function` call-inlining) — all jsdom-clean, behavior-level; no browser required, because the resolution is kf's JS, not a platform feature.
220
+
320
221
  ## `CSSKeyframesAnimation`
321
222
 
322
223
  An abstraction over `KeyframesAnimation` that parses CSS `@keyframes` into `TemplateAnimationFrame` objects, then adds them to a base `KeyframesAnimation`.
@@ -338,7 +239,7 @@ The default transform applies interpolated values to `element.style` for each ta
338
239
 
339
240
  ### Parsing CSS keyframes
340
241
 
341
- [`keyframes.ts`](src/parsing/keyframes.ts) covers most of the CSS spec:
242
+ `keyframes.ts` covers most of the CSS spec:
342
243
 
343
244
  - `from`, `to`, and percentages
344
245
  - Time units (`s`, `ms`)
@@ -354,23 +255,7 @@ The parser uses [`@mkbabb/parse-that`](https://github.com/mkbabb/parse-that) and
354
255
 
355
256
  ### Units
356
257
 
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.
258
+ 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
259
 
375
260
  ## `AnimationGroup`
376
261
 
@@ -396,7 +281,7 @@ The group manages its own `requestAnimationFrame` loop and marks child animation
396
281
 
397
282
  ## Presets
398
283
 
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:
284
+ 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
285
 
401
286
  ```ts
402
287
  import { loadAnimationEngine } from "@mkbabb/keyframes.js";
@@ -405,10 +290,6 @@ const { presets } = await loadAnimationEngine();
405
290
  const anim = presets.fadeIn({ duration: 500 });
406
291
  anim.setTargets(element);
407
292
  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
293
  ```
413
294
 
414
295
  **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`
@@ -419,7 +300,7 @@ keyframes.js's authoring object **is** parsed CSS `@keyframes`. That one fact op
419
300
 
420
301
  1. **Ingest** — read the live web's CSS (`@keyframes` in a stylesheet, or a *running* CSS animation) straight into a kf `CSSKeyframesAnimation`.
421
302
  2. **Drive** — run it through the engine: physics-shaped springs, perceptual `oklab` color, scroll-driven progress, weighted blending.
422
- 3. **Compile** — emit the result **back** to zero-runtime CSS — `compileToCSS` is the parser run *backward* over the same data model (`format.ts` is `keyframes.ts` in reverse).
303
+ 3. **Compile** — emit the result **back** to zero-runtime CSS. Three sibling emitters run the SAME parser *backward* over the same data model (`format.ts` is `keyframes.ts` in reverse): [`compileToCSS`](#compile--the-parser-run-backward) (plain `@keyframes`), [`compileToViewTransition`](#compiletoviewtransition) (the `::view-transition-*` pseudo tree), and [`compileToEntry`](#compiletoentry) (`@starting-style`/`allow-discrete` entry-exit).
423
304
 
424
305
  This is the moat. GSAP, Motion, and anime author in a bespoke tween model — for them "export to CSS" is a lossy re-derivation nobody ships, and "import the page's CSS" has no meaning. Because kf's internal model is *already* CSS, the forward and backward halves are inverses over one structure: a `var()`, a `matrix3d()`, a `cqw` round-trips **verbatim**. The whole round-trip rides the heavy engine, reached through one `await loadAnimationEngine()`.
425
306
 
@@ -485,7 +366,7 @@ pinCSS({ top: 24 }); // => "position: sticky; top: 24px;"
485
366
 
486
367
  ### Compile — the parser run backward
487
368
 
488
- `compileToCSS` walks an orchestration graph — an [`AnimationGroup`](#animationgroup), a [`Sequence`](#sequence), or a bare child list (e.g. a [`stagger`](#stagger)-delayed cohort) — and emits a **pure, zero-runtime CSS** artifact: one `@keyframes` block + an `animation` shorthand per child, `replace`/`add` layering as `animation-composition`, springs as `linear()`, materialized stagger delays, and computed units (`vh`/`cqw`/`calc()`/`var()`) verbatim. A human pastes the result and ships with **zero kf bytes on the page**.
369
+ `compileToCSS` walks an orchestration graph — an [`AnimationGroup`](#animationgroup), a [`Sequence`](#sequence), or a bare child list (e.g. a [`stagger`](#stagger)-delayed cohort) — and emits a **pure, zero-runtime CSS** artifact: one `@keyframes` block + an `animation` shorthand per child, `replace`/`add` layering as `animation-composition`, springs as `linear()`, materialized stagger delays, and computed units (`vh`/`cqw`/`calc()`/`var()`) verbatim. A human pastes the result and ships with **zero kf bytes on the page**. Two siblings emit from the same substrate for two other target surfaces — [`compileToViewTransition`](#compiletoviewtransition) (the `::view-transition-*` pseudo tree) and [`compileToEntry`](#compiletoentry) (`@starting-style`/`allow-discrete` entry-exit) — both taught under [Beyond CSS](#beyond-css).
489
370
 
490
371
  ```ts
491
372
  const { CSSKeyframesAnimation, compileToCSS } = await loadAnimationEngine();
@@ -527,6 +408,8 @@ When `useWAAPI` is `true` (default), eligible animations run on the compositor t
527
408
 
528
409
  A spring timing function (`springTimingFunction`) carries its CSS `linear()` equivalent, so a WAAPI-delegated spring animation runs the true overshoot/settle curve on the compositor instead of a flattened `linear` ramp — the JS easing and the compositor curve are one solver.
529
410
 
411
+ A spring keyframed across **multiple** declared stops is compositor-eligible too: rather than restart the curve at each stop (WAAPI's one-easing-per-segment model would), kf **densifies** the composite curve into extra keyframe stops fed a single bare `linear` effect easing, so the compositor's piecewise-linear fill still tracks the true multi-segment curve. Gated by `proof:waapi-adaptive-densify`.
412
+
530
413
  ## Baseline, tree-shaking & reduced motion
531
414
 
532
415
  keyframes.js targets a modern-web Baseline and documents the tier of every platform facility it leans on:
@@ -537,13 +420,14 @@ keyframes.js targets a modern-web Baseline and documents the tier of every platf
537
420
  | `scheduler.yield()` | Newly available | Feature-detected; falls back to a `MessageChannel` macrotask (≤20 LOC) |
538
421
  | WAAPI `linear()` springs | Newly available | Feature-detected; the rAF spring path is the default fallback |
539
422
  | `Element.animate()` (WAAPI) | Widely available | Opt-out via `useWAAPI: false` |
423
+ | CSS `if()` / `@function` | Limited availability (Chromium) | kf resolves both in JS at parse/bind time — see [The emerging-CSS resolver](#the-emerging-css-resolver) |
540
424
 
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.
425
+ **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 from SOURCE and fails the build if any light module reintroduces a static value.js edge. `proof:consume-bundle` re-proves the same claim from the CONSUMER side — it bundles the PUBLISHED `dist/keyframes.js` (value.js/parse-that kept non-external, so any leak must surface) exactly as a downstream app's bundler would, and fails if that eager graph carries a single value.js/parse-that module or a statically-inlined engine class. (Deliberately no prose kB figure here: `proof:consume-bundle` floors the LIGHT edge's *composition* — zero value.js, zero engine — not a byte count, so a specific kB number would be a claim neither gate actually verifies; re-run `npm run proof:consume-bundle` against a fresh build for the current graph, not a number frozen in prose.)
542
426
 
543
427
  **Reduced motion.** Both the light and heavy engines honor `prefers-reduced-motion: reduce`. Opt in per surface:
544
428
 
545
429
  - **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.
430
+ - **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
431
  - **`AnimationGroup`** — set `group.respectReducedMotion = true`; `play()` composites every child's final frame once rather than driving the draw loop.
548
432
 
549
433
  Off-DOM (SSR / Node) the check is a no-op and animations proceed normally.
@@ -751,44 +635,6 @@ eased(3, 4); // => 300
751
635
 
752
636
  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
637
 
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
638
  ### `flip` / `flipShared`
793
639
 
794
640
  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.
@@ -876,15 +722,64 @@ Positions: a number (absolute ms), `"+=n"` / `"-=n"` (relative to the insertion
876
722
  | `SequenceEffect` / proposed `EffectTiming` `align: sequence` | `Sequence` auto-append |
877
723
  | `EffectTiming` `align: start` | `Sequence` `at: 0` |
878
724
 
879
- ## Ecosystem & agents
725
+ ### `viewTransition`
880
726
 
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.
727
+ The LIGHT View-Transitions dispatch: mutate the DOM behind a native View Transition where the platform ships one, and fall back to a `flipShared` shared-element morph (or a bare immediate mutation) everywhere else — behind ONE normalized handle whose `backend` is queryable and whose promises never reject. Feature-detects `startViewTransition` (and its typed-`update` object overload); PRM routes through the ONE `withReducedMotion` gate (mutate directly, settle).
882
728
 
883
- ```sh
884
- npm i @mkbabb/keyframes-vue @mkbabb/keyframes.js vue
885
- ```
729
+ ```ts run
730
+ // Off-platform (no `document.startViewTransition`, no shared pairs) it degrades
731
+ // to a bare immediate mutation — backend queryable SYNCHRONOUSLY at dispatch:
732
+ const vt = viewTransition(() => box.classList.add("open"), { types: ["forward"] });
733
+ vt.backend; // => "immediate"
734
+ await vt.finished; // never rejects — a skipped/aborted transition settles cleanly
735
+ ```
736
+
737
+ Options: `types` (typed same-doc VT), `shared` (`[from, to]` `flipShared` fallback pairs — `backend: "flip"`), `duration`/`timingFunction` (the fallback play), `fallback` (`"flip"` | `"none"` | a custom async runner), `respectReducedMotion` (default `true` — PRM snaps to `"immediate"`). The `backend` is `"view-transition"` (native), `"flip"` (the `flipShared` fallback), or `"immediate"` (bare mutate). Its zero-runtime CSS twin is [`compileToViewTransition`](#compiletoviewtransition).
738
+
739
+ ### `compileToViewTransition`
740
+
741
+ The round-trip engine pointed at native View Transitions: compile a **name-keyed role spec** to a PURE, ZERO-RUNTIME CSS artifact over the `::view-transition-*` pseudo tree (HEAVY — reached via `loadAnimationEngine()`). Each name's `old`/`new` get a full kf `@keyframes` block + `animation` shorthand (springs → `linear()`); `::view-transition-group(name)` gets a **timing-only** override (duration + timing-function, never `animation-name` — the UA's rect-morph keyframes ARE the free zero-runtime FLIP), so the group stays temporally coherent with the tracks. Non-round-trippable shapes REFUSE with a named reason (the CC-3 four ∪ `vt-scroll-grammar` / `vt-element-scoped-computed` / `vt-snapshot-inapplicable` / `vt-name-collision`).
742
+
743
+ ```ts run
744
+ const { CSSKeyframesAnimation, compileToViewTransition } = await loadAnimationEngine();
745
+
746
+ const out = new CSSKeyframesAnimation({ duration: 300 });
747
+ out.fromString(`@keyframes o { from { opacity: 1 } to { opacity: 0; transform: scale(0.9) } }`);
748
+ const enter = new CSSKeyframesAnimation({ duration: 300 });
749
+ enter.fromString(`@keyframes n { from { opacity: 0; transform: scale(1.05) } to { opacity: 1 } }`);
750
+
751
+ const vt = await compileToViewTransition({ hero: { old: out, new: enter } }, { types: ["forward"] });
752
+ vt.names; // => ["hero"]
753
+ vt.css.includes("::view-transition-group(hero)"); // => true
754
+ vt.css.includes("animation-name"); // => false // the group override is timing-only
755
+ ```
756
+
757
+ Options: `types` (wraps rules in `:active-view-transition-type(...)`), `crossDocument` (prepend `@view-transition { navigation: auto }`), `reducedMotion` (append the PRM `animation: none` block, default `true`), plus every `CompileOptions` key. The consumer assigns `view-transition-name: <name>` to its elements from the returned `names`.
758
+
759
+ ### `compileToEntry`
760
+
761
+ Modern entry/exit compilation: compile a selector-keyed `{ enter?, exit? }` spec to zero-runtime **`@starting-style` + `transition-behavior: allow-discrete`** CSS — the two-endpoint entrance/exit grammar the platform shipped (Chromium 117+/Safari 26). HEAVY (reached via `loadAnimationEngine()`). It is a **declared-endpoint projection** (each animation is a 2-stop transition endpoint pair), emitting the three-rule grammar: a base/closed rule (exit's last frame + `display: none` + the exit transition list), an open rule (enter's last frame + `display` + the entry list), and `@starting-style { <open> { enter's first frame } }`. Asymmetric entry/exit duration+easing ride the two lists; `display`/`overlay <dur> allow-discrete` ride BOTH (`overlay` is inert-but-harmless off the top layer); spring `linear()`s ride verbatim; **color endpoints canonicalize to `oklab()`** so the transition interpolates in kf's default perceptual space natively — NO densify, ZERO intermediate stops (the `@keyframes` `perceptual-oklab` refusal INVERTED to a feature). Non-two-endpoint shapes REFUSE (3 inherited + 6 entry-specific: `entry-multi-keyframe` / `entry-iteration` / `entry-composition` / `entry-scroll-grammar` / `entry-color-space` / `entry-easing-twin`).
762
+
763
+ ```ts run
764
+ const { CSSKeyframesAnimation, compileToEntry } = await loadAnimationEngine();
765
+
766
+ const enter = new CSSKeyframesAnimation({ duration: 350 });
767
+ enter.fromString(`@keyframes en { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }`);
768
+
769
+ const dialog = await compileToEntry({ ".dialog": { enter } }, { openSelector: "[open]" });
770
+ dialog.eligible; // => true
771
+ dialog.css.includes("@starting-style"); // => true
772
+ dialog.css.includes("display 350ms allow-discrete"); // => true
773
+ ```
774
+
775
+ 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`), `printWidth`. 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.
776
+
777
+ ## Ecosystem & agents
886
778
 
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.
779
+ - **`llms.txt`** — the agent surface: a machine-readable index of every capability, generated
780
+ from the CI-verified published surface (`docs/published-surface.md`) by running
781
+ `node scripts/gen-agent-surface.mjs`. The artifact is not tracked in git (generated at CI time);
782
+ `llms-full.txt` carries the expanded form.
888
783
 
889
784
  ## Build & Development
890
785
 
@@ -915,8 +810,8 @@ It pulls `node:24-slim` (kf's CI Node), mounts the repo at `/workspace`, install
915
810
 
916
811
  ## Contributing
917
812
 
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).
813
+ Open a PR against `master`. Run `npm run proof:all` before pushing — the gate roster is the
814
+ acceptance bar.
920
815
 
921
816
  ## License
922
817
 
@@ -0,0 +1,108 @@
1
+ import { COLOR_SPACE_RANGES as e, color2 as t, deltaEOK as n, normalizeColorUnit as r, sampleColorRamp as i, scale as a } from "@mkbabb/value.js";
2
+ //#region src/animation/compile/backward/backward-color.ts
3
+ var o = e.oklab.a.number.min, s = e.oklab.a.number.max, c = e.oklab.b.number.min, l = e.oklab.b.number.max, u = (e) => Math.round(e * 1e4) / 1e4, d = (e) => typeof e == "object" && !!e && e.unit === "color", f = (e) => r(e).value, p = (e) => {
4
+ let n = t(e, "oklab");
5
+ return [
6
+ n.l,
7
+ a(n.a, 0, 1, o, s),
8
+ a(n.b, 0, 1, c, l)
9
+ ];
10
+ }, m = (e) => {
11
+ let [t, n, r] = p(e);
12
+ return `oklab(${u(t)} ${u(n)} ${u(r)})`;
13
+ }, h = (e) => m(f(e)), g = (e, t) => {
14
+ let [r, i, a] = p(e), [o, s, c] = p(t);
15
+ return n(r, i, a, o, s, c);
16
+ }, _ = (e, n, r) => t({
17
+ colorSpace: "oklab",
18
+ l: e,
19
+ a: a(n, o, s, 0, 1),
20
+ b: a(r, c, l, 0, 1),
21
+ alpha: 1
22
+ }, "oklab"), v = (e, t) => {
23
+ let [n, r, i] = p(e), [a, o, s] = p(t);
24
+ return _((n + a) / 2, (r + o) / 2, (i + s) / 2);
25
+ }, y = (e) => {
26
+ let t = /([\d.]+)\s*%/.exec(e.toString());
27
+ return t ? parseFloat(t[1]) : 0;
28
+ }, b = (e, t, n) => {
29
+ let r = (e.parsedVars[t] ?? {})[n];
30
+ if (Array.isArray(r)) return r.find((e) => d(e));
31
+ };
32
+ function x(e, t, n, r, a) {
33
+ let o = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), s = [], c = 0;
34
+ for (let o = 0; o + 1 < e.templateFrames.length; o++) {
35
+ let l = b(e, o, t), d = b(e, o + 1, t);
36
+ if (!l || !d) continue;
37
+ let p = y(e.templateFrames[o].start), h = y(e.templateFrames[o + 1].start);
38
+ if (l.toString() === d.toString()) {
39
+ s.push({
40
+ pct: p,
41
+ css: l.toString()
42
+ });
43
+ continue;
44
+ }
45
+ let _ = f(l), x = f(d), S = i(_, x, n, {
46
+ space: r,
47
+ ...a
48
+ });
49
+ for (let e = 0; e < S.length; e++) {
50
+ let t = e / (S.length - 1), n = p + (h - p) * t;
51
+ s.push({
52
+ pct: u(n),
53
+ css: m(S[e])
54
+ });
55
+ }
56
+ let C = i(_, x, 1024, {
57
+ space: r,
58
+ ...a
59
+ });
60
+ for (let e = 0; e + 1 < S.length; e++) {
61
+ let t = (e + .5) / (S.length - 1), n = C[Math.round(t * 1023)], r = v(S[e], S[e + 1]);
62
+ c = Math.max(c, g(r, n));
63
+ }
64
+ }
65
+ let l = e.templateFrames.length - 1, d = b(e, l, t);
66
+ if (d) {
67
+ let t = y(e.templateFrames[l].start);
68
+ s[s.length - 1]?.pct !== t && s.push({
69
+ pct: t,
70
+ css: d.toString()
71
+ });
72
+ }
73
+ return {
74
+ cssProp: o,
75
+ stops: s,
76
+ worstDelta: c
77
+ };
78
+ }
79
+ function S(e, t, n) {
80
+ let r = [], i = /* @__PURE__ */ new Set();
81
+ for (let t = 0; t + 1 < e.templateFrames.length; t++) {
82
+ let n = e.parsedVars[t] ?? {};
83
+ for (let [a, o] of Object.entries(n)) {
84
+ if (i.has(a) || !Array.isArray(o) || !o.some((e) => d(e))) continue;
85
+ let n = b(e, t, a), s = b(e, t + 1, a);
86
+ n && s && n.toString() !== s.toString() && (r.push(a), i.add(a));
87
+ }
88
+ }
89
+ if (r.length === 0) return null;
90
+ let a = Math.max(3, t), o = e.options.colorSpace === "oklch" ? "oklch" : "oklab", s = e.options.hueMethod ? { hueMethod: e.options.hueMethod } : {}, c = 0, l = /* @__PURE__ */ new Map();
91
+ for (let t of r) {
92
+ let n = x(e, t, a, o, s);
93
+ c = Math.max(c, n.worstDelta);
94
+ for (let { pct: e, css: t } of n.stops) {
95
+ let r = l.get(e);
96
+ r || (r = [], l.set(e, r)), r.push(`${n.cssProp}: ${t};`);
97
+ }
98
+ }
99
+ return c > n ? {
100
+ refused: !0,
101
+ delta: c
102
+ } : {
103
+ byPct: l,
104
+ keys: r
105
+ };
106
+ }
107
+ //#endregion
108
+ export { u as i, S as n, d as r, h as t };
@@ -0,0 +1,30 @@
1
+ import { n as e } from "./presets-DeDJYL4G.js";
2
+ import { c as t, l as n, s as r, u as i } from "./engine-CPK_udUQ.js";
3
+ import { n as a, r as o, t as s } from "./parse-flatten-ZZUSEQEL.js";
4
+ import { t as c } from "./easing-registry-DHV2-5gA.js";
5
+ import { a as l, r as u, t as d } from "./view-transition-BPJQxUTC.js";
6
+ import { t as f } from "./easing-serialize-D4LZCB6i.js";
7
+ import { i as p, n as m, t as h } from "./format-BdIvdLzG.js";
8
+ import { t as g } from "./entry-D82NKUhP.js";
9
+ //#region src/animation/compile/index.ts
10
+ var _ = /* @__PURE__ */ e({
11
+ CSSKeyframesToString: () => h,
12
+ CSSKeyframesToStrings: () => m,
13
+ DEFAULT_DELTA_E_EPSILON: () => u,
14
+ DEFAULT_DENSIFY_STOPS: () => 16,
15
+ FrameCompiler: () => r,
16
+ NAMED_SELECTOR_SUPERTYPE: () => n,
17
+ compileToCSS: () => l,
18
+ compileToEntry: () => g,
19
+ compileToViewTransition: () => d,
20
+ createInterpVarValue: () => s,
21
+ formatCSSKeyframeString: () => p,
22
+ getTimingFunction: () => c,
23
+ namedSelectorToFraction: () => i,
24
+ parseAndFlattenObject: () => a,
25
+ resolveEasingOption: () => t,
26
+ serializeEasing: () => f,
27
+ transformTargetsStyle: () => o
28
+ });
29
+ //#endregion
30
+ export { _ as t };