A polish release setting the stage for next week’s unveil. It adds a Color type, opt‑in replay for existing query matches, stricter typing, and consistent vector access semantics — all while keeping performance crisp and coverage at 100%.
Added
- Color type:
Types.Color(RGBA), stored asFloat32Array[4], defaulting to[1, 1, 1, 1]. Initialization clamps channels to[0, 1]and warns when clamping occurs (under checks). - Query subscription replay:
Query.subscribe(event, callback, replayExisting?)can now replay existing matches when subscribing to'qualify'.
Changed
- Systems:
World.registerSystemnow accepts partialconfigData(you can provide only the keys you care about). - Typing/lint: Tightened internal typings and banned explicit
anyinsrc/; enabledcurlyrule to require braces for control statements.
Fixed
- Vector access correctness:
Entity.getValue/setValuenow throw for vector‑like fields (Types.Vec2,Types.Vec3,Types.Vec4, andTypes.Color). Previously, these calls could lead to partial or incorrect reads/writes (e.g., only touching the first lane). UsegetVectorView(component, key)to read/write packed vector data.
Documentation
- Query docs updated with the new
subscribesignature and behavior. - Added a focused page on replaying existing subscriptions.
- Getting Started note updated to include
Types.Colorin vector access guidance. - Entity docs now call out vector‑view requirements explicitly.
Tests
- Maintained 100% coverage. Added tests for Color initialization (clamping + defaults), vector access enforcement, and
replayExistingsubscribe behavior.
Migration
-
Replace any direct
getValue/setValueusage on vector fields withgetVectorView:// Before // const v = e.getValue(Position, 'value'); // now throws // e.setValue(Position, 'value', [x, y, z]); // now throws // After const v = e.getVectorView(Position, 'value'); v[0] += dx; v[1] += dy; v[2] += dz;
-
If you want to initialize subscribers with entities that already match a query, pass
trueas the third arg:query.subscribe('qualify', onQualify, true);