Production-ready animations, transitions, backgrounds, and scenes for Remotion
remocn-ui core — verification tests (Iteration 1)
Pure / deterministic verification for the ui tier core lib
(registry/remocn-ui/core/). Covers the hand-rolled OKLCH color math and the
timeline fold semantics. No React / Remotion render required.
How to run
The repo uses Bun, which has a built-in test runner — runs TypeScript natively, no test-framework dep.
bun install # color.ts now imports `culori`
bun test registry/remocn-ui/core/__tests__
color.ts was rewritten to wrap the culori package, which is already
declared in package.json (culori + @types/culori). Run bun install
first so it lands in node_modules, or color.test.ts will fail to resolve the
import. The test runner itself needs no third-party dep: these tests import
bun:test, not any external framework. A test script (bun test) is defined
in package.json; run the whole suite with bun run test.
The repo standardizes on
bun:testas the single test framework — one runner, no extra test-framework dependency.
What is covered
color.test.ts— imports the REALcolor.ts(pure, no remotion). Now aculoriwrapper exposing culori's NATIVE shapes/scales:Rgbobjects are{ mode:"rgb", r, g, b, alpha }with channels in 0..1 (NOT 0..255),Oklchobjects are{ mode:"oklch", l, c, h, alpha? }(lowercase l/c/h, achromatic hue normalized to0), andrgbToOklchtakes anRgbOBJECT. Assertions are PROPERTY-BASED and tolerance-based in the 0..1 scale (TOL = 0.01 ≈ 2/255), immune to culori's 8-bit rounding / version drift:mixOklchendpoints (t=0≈a,t=1≈b withinTOL, alpha within 0.01).mixOklchstill returns an inline CSS string;rgbOfparses culori'sformatRgboutput (0..255 ints) back to 0..1 for comparison.- OKLCH midpoint ≠ naive sRGB lerp: black↔[email protected] is neutral (
r≈g≈b) and clears the naive 0..1 sRGB midpoint0.5by a real margin (>0.039, i.e. >10/255), and equals the module's ownoklchToRgb(0.5,0,0)(self-consistent, no magic number). - shortest-arc hue (350↔10 → ~0/360, not ~180), neutral-hold (gray↔gray stays
gray; gray↔chromatic carries the chromatic hue). Hue read via
rgbToOklch({ mode:"rgb", r, g, b }). oklchToRgbanchors: only the gamut corners are checked (oklch(1 0 0)→ whiter≈g≈b≈1,oklch(0 0 0)→blackr≈g≈b≈0); mid-lightness neutrals asserted as properties (neutral + monotonic, thresholds in 0..1), never pinned.- theme-override AC (§6):
oklchToRgb(0.205,0,0)≈parseColor("oklch(0.205 0 0)")withinTOL— value computed from the module itself, immune to culori version drift. rgb/oklchround-trip viargbToOklch(oklchToRgb(...))taking theRgbobject (l/c/h recovered within tol; achromatic hue normalized to0),parseColorformats (hex/rgb/oklch + alpha in 0..1,var()and unparseable → black-sentinel{ mode:"rgb", r:0, g:0, b:0, alpha:1 }no throw, default alpha 1),toCss(culoriformatRgbLEGACY comma syntax with 0..255 int channels:rgb(255, 128, 0)opaque,rgba(10, 20, 30, 0.5)when alpha < 1, plus a re-parse round-trip guard),mixOklchalpha interpolation.
timeline.test.ts—framesFor/revealCountas exact spec mirrors, plus two pure resolver replicas (each factoring out the single impureuseCurrentFrame()line as an injectedrawarg):resolveCurrentState(mirrorsuseCurrentState): speed contract ({at:30}fires at raw frame 15 whenspeed=2), default-state before first step, exact-frame activation, latest-started-wins, same-atties (later array entry wins).resolveStateTransition(mirrorsuseStateTransition): before-any-step →{from:default, to:default, progress:1}; at step boundary →progress=0; mid-window → fractional progress (concrete numeric); past window →progress=1held; per-stepdurationoverridesdefaultDuration;duration:0snaps toprogress=1; chained steps carryfrom=previous-step state; same-atties (later array wins);speed=2scales the playhead (effective frame, not authoredat).
Determinism grep checklist (run manually; must print NOTHING)
The ui tier contract is "pure function of useCurrentFrame()" (plan §6). No
React state, no DOM events, no wall-clock, no randomness anywhere in the tier
source. Verify with:
grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
registry/remocn-ui/button/index.tsx registry/remocn-ui/core/*.ts
Expected: no output (exit code 1). Any match is a determinism violation. (Verified clean on the source as of Iteration 1.)