@codexo/exojs 0.4.0 → 0.6.1

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 (138) hide show
  1. package/CHANGELOG.md +464 -163
  2. package/README.md +156 -141
  3. package/dist/esm/audio/AudioAnalyser.d.ts +0 -1
  4. package/dist/esm/audio/AudioAnalyser.js +0 -2
  5. package/dist/esm/audio/AudioAnalyser.js.map +1 -1
  6. package/dist/esm/core/Application.d.ts +4 -4
  7. package/dist/esm/core/Application.js +19 -19
  8. package/dist/esm/core/Application.js.map +1 -1
  9. package/dist/esm/core/Scene.d.ts +59 -24
  10. package/dist/esm/core/Scene.js +60 -18
  11. package/dist/esm/core/Scene.js.map +1 -1
  12. package/dist/esm/core/SceneManager.js +15 -9
  13. package/dist/esm/core/SceneManager.js.map +1 -1
  14. package/dist/esm/core/SceneNode.d.ts +45 -5
  15. package/dist/esm/core/SceneNode.js +136 -7
  16. package/dist/esm/core/SceneNode.js.map +1 -1
  17. package/dist/esm/index.js +3 -4
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/math/index.d.ts +0 -1
  20. package/dist/esm/rendering/CallbackRenderPass.d.ts +3 -3
  21. package/dist/esm/rendering/CallbackRenderPass.js +2 -2
  22. package/dist/esm/rendering/CallbackRenderPass.js.map +1 -1
  23. package/dist/esm/rendering/Container.d.ts +10 -11
  24. package/dist/esm/rendering/Container.js +5 -5
  25. package/dist/esm/rendering/Container.js.map +1 -1
  26. package/dist/esm/rendering/Drawable.d.ts +2 -2
  27. package/dist/esm/rendering/Drawable.js +5 -5
  28. package/dist/esm/rendering/Drawable.js.map +1 -1
  29. package/dist/esm/rendering/{SceneRenderRuntime.d.ts → RenderBackend.d.ts} +21 -3
  30. package/dist/esm/rendering/RenderNode.d.ts +41 -5
  31. package/dist/esm/rendering/RenderNode.js +89 -24
  32. package/dist/esm/rendering/RenderNode.js.map +1 -1
  33. package/dist/esm/rendering/RenderPass.d.ts +2 -2
  34. package/dist/esm/rendering/RenderTargetPass.d.ts +3 -3
  35. package/dist/esm/rendering/RenderTargetPass.js +9 -9
  36. package/dist/esm/rendering/RenderTargetPass.js.map +1 -1
  37. package/dist/esm/rendering/Renderer.d.ts +3 -3
  38. package/dist/esm/rendering/RendererRegistry.d.ts +13 -7
  39. package/dist/esm/rendering/RendererRegistry.js +18 -10
  40. package/dist/esm/rendering/RendererRegistry.js.map +1 -1
  41. package/dist/esm/rendering/filters/BlurFilter.d.ts +2 -2
  42. package/dist/esm/rendering/filters/BlurFilter.js +5 -5
  43. package/dist/esm/rendering/filters/BlurFilter.js.map +1 -1
  44. package/dist/esm/rendering/filters/ColorFilter.d.ts +2 -2
  45. package/dist/esm/rendering/filters/ColorFilter.js +3 -3
  46. package/dist/esm/rendering/filters/ColorFilter.js.map +1 -1
  47. package/dist/esm/rendering/filters/Filter.d.ts +2 -2
  48. package/dist/esm/rendering/index.d.ts +6 -6
  49. package/dist/esm/rendering/primitives/Graphics.d.ts +3 -3
  50. package/dist/esm/rendering/primitives/Graphics.js.map +1 -1
  51. package/dist/esm/rendering/shader/Shader.d.ts +3 -3
  52. package/dist/esm/rendering/shader/Shader.js +10 -10
  53. package/dist/esm/rendering/text/Text.d.ts +2 -2
  54. package/dist/esm/rendering/text/Text.js +2 -2
  55. package/dist/esm/rendering/text/Text.js.map +1 -1
  56. package/dist/esm/rendering/texture/Sampler.d.ts +0 -3
  57. package/dist/esm/rendering/texture/Sampler.js +5 -7
  58. package/dist/esm/rendering/texture/Sampler.js.map +1 -1
  59. package/dist/esm/rendering/types.d.ts +4 -0
  60. package/dist/esm/rendering/types.js +4 -0
  61. package/dist/esm/rendering/types.js.map +1 -1
  62. package/dist/esm/rendering/video/Video.d.ts +2 -2
  63. package/dist/esm/rendering/video/Video.js +2 -2
  64. package/dist/esm/rendering/video/Video.js.map +1 -1
  65. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.d.ts +2 -2
  66. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js +35 -11
  67. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js.map +1 -1
  68. package/dist/esm/rendering/webgl2/AbstractWebGl2Renderer.d.ts +13 -13
  69. package/dist/esm/rendering/webgl2/AbstractWebGl2Renderer.js +20 -20
  70. package/dist/esm/rendering/webgl2/AbstractWebGl2Renderer.js.map +1 -1
  71. package/dist/esm/rendering/webgl2/{WebGl2RenderManager.d.ts → WebGl2Backend.d.ts} +15 -12
  72. package/dist/esm/rendering/webgl2/{WebGl2RenderManager.js → WebGl2Backend.js} +60 -38
  73. package/dist/esm/rendering/webgl2/WebGl2Backend.js.map +1 -0
  74. package/dist/esm/rendering/webgl2/WebGl2MaskCompositor.d.ts +31 -0
  75. package/dist/esm/rendering/webgl2/WebGl2MaskCompositor.js +186 -0
  76. package/dist/esm/rendering/webgl2/WebGl2MaskCompositor.js.map +1 -0
  77. package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.d.ts +38 -7
  78. package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.js +281 -90
  79. package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.js.map +1 -1
  80. package/dist/esm/rendering/webgl2/WebGl2PrimitiveRenderer.d.ts +2 -2
  81. package/dist/esm/rendering/webgl2/WebGl2PrimitiveRenderer.js +15 -10
  82. package/dist/esm/rendering/webgl2/WebGl2PrimitiveRenderer.js.map +1 -1
  83. package/dist/esm/rendering/webgl2/WebGl2ShaderMappings.js +12 -0
  84. package/dist/esm/rendering/webgl2/WebGl2ShaderMappings.js.map +1 -1
  85. package/dist/esm/rendering/webgl2/WebGl2ShaderProgram.d.ts +2 -0
  86. package/dist/esm/rendering/webgl2/{WebGl2ShaderRuntime.js → WebGl2ShaderProgram.js} +58 -18
  87. package/dist/esm/rendering/webgl2/WebGl2ShaderProgram.js.map +1 -0
  88. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.d.ts +26 -7
  89. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.js +260 -62
  90. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.js.map +1 -1
  91. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.d.ts +24 -1
  92. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.js +6 -2
  93. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.js.map +1 -1
  94. package/dist/esm/rendering/webgl2/glsl/mask-compose.frag.js +4 -0
  95. package/dist/esm/rendering/webgl2/glsl/mask-compose.frag.js.map +1 -0
  96. package/dist/esm/rendering/webgl2/glsl/mask-compose.vert.js +4 -0
  97. package/dist/esm/rendering/webgl2/glsl/mask-compose.vert.js.map +1 -0
  98. package/dist/esm/rendering/webgl2/glsl/particle.vert.js +1 -1
  99. package/dist/esm/rendering/webgl2/glsl/sprite.frag.js +1 -1
  100. package/dist/esm/rendering/webgl2/glsl/sprite.vert.js +1 -1
  101. package/dist/esm/rendering/webgpu/AbstractWebGpuRenderer.d.ts +9 -9
  102. package/dist/esm/rendering/webgpu/AbstractWebGpuRenderer.js +18 -18
  103. package/dist/esm/rendering/webgpu/AbstractWebGpuRenderer.js.map +1 -1
  104. package/dist/esm/rendering/webgpu/{WebGpuRenderManager.d.ts → WebGpuBackend.d.ts} +17 -14
  105. package/dist/esm/rendering/webgpu/{WebGpuRenderManager.js → WebGpuBackend.js} +74 -40
  106. package/dist/esm/rendering/webgpu/WebGpuBackend.js.map +1 -0
  107. package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.d.ts +37 -0
  108. package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.js +279 -0
  109. package/dist/esm/rendering/webgpu/WebGpuMaskCompositor.js.map +1 -0
  110. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.d.ts +2 -3
  111. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js +65 -82
  112. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js.map +1 -1
  113. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.d.ts +2 -3
  114. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.js +24 -25
  115. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.js.map +1 -1
  116. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts +28 -13
  117. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js +410 -382
  118. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js.map +1 -1
  119. package/dist/esm/resources/Loader.js +5 -3
  120. package/dist/esm/resources/Loader.js.map +1 -1
  121. package/dist/exo.esm.js +2500 -1399
  122. package/dist/exo.esm.js.map +1 -1
  123. package/package.json +20 -11
  124. package/dist/esm/math/Transformable.d.ts +0 -47
  125. package/dist/esm/math/Transformable.js +0 -140
  126. package/dist/esm/math/Transformable.js.map +0 -1
  127. package/dist/esm/rendering/webgl2/WebGl2RenderManager.js.map +0 -1
  128. package/dist/esm/rendering/webgl2/WebGl2RendererRuntime.d.ts +0 -15
  129. package/dist/esm/rendering/webgl2/WebGl2ShaderRuntime.d.ts +0 -2
  130. package/dist/esm/rendering/webgl2/WebGl2ShaderRuntime.js.map +0 -1
  131. package/dist/esm/rendering/webgpu/WebGpuRenderManager.js.map +0 -1
  132. package/dist/esm/rendering/webgpu/WebGpuRendererRuntime.d.ts +0 -8
  133. package/dist/exo.esm.min.js +0 -2
  134. package/dist/exo.esm.min.js.map +0 -1
  135. package/dist/exo.global.js +0 -17328
  136. package/dist/exo.global.js.map +0 -1
  137. package/dist/exo.global.min.js +0 -2
  138. package/dist/exo.global.min.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,163 +1,464 @@
1
- # Changelog
2
-
3
- All notable changes to ExoJS are documented in this file.
4
-
5
- The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## [0.4.0] - 2026-04-26
8
-
9
- Pre-1.0 versioning reset. The active development line moves from `2.1.2` to `0.4.0` to honestly reflect that the public API is not yet stable. No runtime behavior change relative to the previous head — this release marks a versioning policy shift, not a code rewrite.
10
-
11
- ### Notes
12
-
13
- - The `2.x` releases (`2.0.0`, `2.1.0`, `2.1.1`, `2.1.2`) remain published on npm as a historical line and will be deprecated with a pointer to the `0.x` line.
14
- - New work happens on the `0.x` line. Expect breaking changes between `0.x` minors as the scene graph, renderer, and resource boundaries continue to evolve.
15
- - `1.0.0` will mark the first stable public API contract. Until then, treat any minor version as potentially breaking and pin exact versions in downstream experiments.
16
- - Past CHANGELOG entries for `2.x` are preserved below as the historical record of work that landed in those releases.
17
-
18
- ## [2.1.2] - 2026-04-19
19
-
20
- Patch release with one runtime fix, a toolchain modernization pass, and a legacy-artifact cleanup. No public API removals or renames.
21
-
22
- ### Fixed
23
-
24
- - **`Signal.dispatch` skipped sibling `once()` handlers.** `once()` wrappers self-remove mid-iteration, which compacts the underlying bindings array; the `for..of` iterator then advanced past the binding that shifted into the just-visited slot. `dispatch` now iterates a snapshot of bindings, so handler-driven mutation is safe. Visible symptom: the Audio Visualisation example received a set-up `Music` but an un-set-up `AudioAnalyser`, so frequency buffers stayed at zero.
25
-
26
- ### Changed
27
-
28
- - Removed the legacy bundled declaration file `dist/exo.d.ts` (emitted via `tsc --outFile` + `module: amd`, both deprecated in TypeScript 6). Modern consumers resolve types through `exports["."].types`, which points at the per-file tree in `dist/esm/`; `dist/exo.d.ts` was never part of the `exports` map. This also removes the `ignoreDeprecations: "6.0"` escape hatch from the build.
29
- - Build upgraded to TypeScript 6, ESLint 10, Jest 30. Internal imports now use the `@/*` path alias (mapped to `src/*`) and `baseUrl` is no longer required.
30
-
31
- ## [2.1.1] - 2026-04-19
32
-
33
- Patch release fixing a cluster of WebGPU and scene-graph bugs discovered after 2.1.0 shipped. No public API removals or renames; one backward-compatible addition on `Container.addChild`.
34
-
35
- ### Fixed
36
-
37
- - **WebGPU adapter ordering.** `WebGpuRenderManager` now requests the GPU adapter before acquiring the canvas WebGPU context. A null adapter previously locked the canvas into WebGPU mode, preventing `Application`'s automatic WebGL2 fallback from obtaining a context on the same element.
38
- - **WebGL2 shader program binding.** `WebGl2ShaderRuntime.sync()` now binds the program before writing uniforms. The previous draw pipeline never called `bindShader(shader)` with a non-null shader, so every `uniform*` write targeted the wrong or null program and `drawElements` reported "no valid shader program in use". Exposed by the WebGPU adapter fallback above.
39
- - **WGSL multi-texture sprite shader** uses `textureSampleGrad` with explicit screen-space derivatives. `textureSample`'s uniformity requirement prevented the 8-slot dispatch from compiling on any sprite batch spanning more than one texture slot.
40
- - **Sprite index buffer** allocation and lifecycle. Buffer size was 4× larger than intended (`indexData.byteLength * BYTES_PER_ELEMENT` instead of `indexData.byteLength`), and `_ensureBatchCapacity` ran inside the draw loop and could destroy a buffer the render pass had already bound. Capacity is now grown once up front.
41
- - **Sprite multi-batch rendering.** When a flush contained multiple batches (blend-mode change, texture-slot overflow, or pipeline switch), each batch's `queue.writeBuffer(vertexBuffer, offset: 0, ...)` serialised before the single submit, leaving only the last batch's vertex data in the buffer. All batch vertex data is now packed into one CPU buffer at distinct sprite offsets and uploaded once; `drawIndexed` uses `firstIndex` to target each range.
42
- - **Particle and primitive multi-drawcall rendering.** Same multi-write-to-offset-0 pattern, plus mid-loop `_ensureCapacity` destroying buffers still referenced by the pass. Particle renderer now submits one command buffer per system. Primitive renderer was rewritten: CPU bakes `view * globalTransform` into `vec4` clip-space positions per vertex, pipeline has no bind-group, one render pass per flush with packed vertex/index buffers.
43
- - **Primitive combine order.** `_combinedTransform.copy(view).combine(global)` produced `global * view` (`Matrix.combine` applies the argument on the left, confirmed by `SceneNode.getGlobalTransform` which chains `local.combine(parent.global)` to yield `parent.global * local`). Swapped to `copy(global).combine(view)` = `view * global`.
44
- - **WebGPU mipmap generation.** The full-screen downsample triangle's UVs are no longer Y-flipped relative to framebuffer orientation. Every odd mip level was being rendered upside-down, producing a visible sprite flip whenever the view zoomed far enough for the LOD selector to cross an odd/even boundary.
45
-
46
- ### Added
47
-
48
- - `Container.addChild` accepts multiple children via rest args (`addChild(...children)`). The previous single-argument signature silently dropped the tail of `addChild(a, b, c, d)`; callers only saw `a` in the scene graph. Single-child usage stays backward compatible.
49
- - Doc comment on `ParticleOptions.position` clarifying it is in the owning `ParticleSystem`'s local coordinate space. The shader applies the system's global transform on top, so passing world coordinates double-translates the emitter.
50
-
51
- ## [2.1.0] - 2026-04-18
52
-
53
- Product-readiness release. Additive across assets, game-feel, visuals, performance, optional physics, and WebGPU parity. No public contracts were removed or renamed since v2.0.0.
54
-
55
- ### Highlights
56
-
57
- - Typed asset manifests and bundle loading workflow.
58
- - `AnimatedSprite` with named clips, loop control, and frame signals.
59
- - Scene stacking with participation policies, input routing, and fade transitions.
60
- - View/camera polish: follow with lerp, bounds clamp, zoom, shake.
61
- - Audio sprites and sound pooling.
62
- - Visual capability wave: filter pipeline, masking, render passes, cache-as-bitmap, multi-texture batching on the WebGPU backend.
63
- - Automatic off-screen culling with observable render stats.
64
- - Optional Rapier physics integration behind an optional peer dependency.
65
- - WebGPU parity improvements and clearer initialization failure semantics.
66
- - Docs and examples overhaul; release verification hardening.
67
-
68
- ### Assets / workflow
69
-
70
- - `defineAssetManifest`, `AssetEntry`, and `loadBundle` with progress callbacks.
71
- - `BundleLoadError` surfaces per-entry failures with the responsible loader token.
72
- - Strict manifest validation runs at definition time.
73
- - `CacheStore` + `IndexedDbStore` remain the persistence path; strategy classes (`CacheFirstStrategy`, `NetworkOnlyStrategy`) are exposed for custom pipelines.
74
-
75
- ### Game-feel
76
-
77
- - `AnimatedSprite`: `defineClip`, `setClips`, `play`, `stop`, `loop` override, `onComplete` and `onFrame` signals.
78
- - `SceneManager` is now a real stack: `pushScene`, `popScene`, `setScene` with resolved `SceneParticipationPolicy` covering stack mode and input mode.
79
- - `SceneInputEvent` routing honours stack participation so overlay/modal scenes can intercept input cleanly.
80
- - Fade transitions integrated into scene switching.
81
- - `View` camera: `follow` with lerp, `setBoundsConstraint`, `zoom`/`setZoom`, `shake` with decay and configurable frequency.
82
- - `Sound`: `setPoolSize`, `playPooled`, `stopPooled`, `defineSprite`, `setSprites` for audio-sprite playback.
83
-
84
- ### Rendering / visuals
85
-
86
- - Filter pipeline: abstract `Filter` base with `BlurFilter` and `ColorFilter` implementations; per-node filter chains wired through the render runtime.
87
- - Masking support in both render managers and on `RenderNode`.
88
- - Render-pass composition: `RenderTargetPass`, `CallbackRenderPass`, `RenderTarget`, and the existing `RenderTexture` for off-screen work.
89
- - `RenderNode.cacheAsBitmap` flattens expensive subtrees to a cached texture with invalidation.
90
- - `Container.sortableChildren` + `SceneNode.zIndex` provide depth-sorted rendering with a stable fallback on insertion order.
91
- - Multi-texture batching on the WebGPU sprite renderer (`textureSlots`, `maxBatchTextures`). See caveat below.
92
- - WebGPU sprite, particle, and primitive renderers reached functional parity with the WebGL2 equivalents.
93
- - Context-loss handling preserved.
94
-
95
- ### Performance
96
-
97
- - Automatic off-screen culling: `Drawable` checks `inView(view)` each frame and counts skipped nodes.
98
- - `RenderStats` exposes `submittedNodes`, `culledNodes`, `drawCalls`, `batches`, `renderPasses`, and `frameTimeMs` for observability.
99
- - Hot-path cleanup across the renderers.
100
- - `npm run perf:benchmark` runs the rendering benchmark harness under `test/perf/`.
101
-
102
- ### Physics
103
-
104
- - Optional Rapier integration via `createRapierPhysicsWorld({ gravityY })`.
105
- - `@dimforge/rapier2d-compat` is declared as an optional `peerDependency`; apps that do not import the physics entry point incur zero runtime cost.
106
- - Collision groups/masks encoded into Rapier's 16/16 packed format; `PhysicsCollisionFilter` lets you declare membership and what each body collides with.
107
- - Triggers vs. solid colliders distinguished via `trigger` on the descriptor; `onTriggerEnter` / `onTriggerExit` signals on the body.
108
- - Transform sync helpers and a `createDebugGraphics`/`updateDebugGraphics` path for debug draw through the existing `Graphics` primitive.
109
-
110
- ### WebGPU
111
-
112
- - Sprite, particle, and primitive renderers now cover the WebGL2 feature surface used by the scene runtime.
113
- - Explicit `backend: { type: 'webgpu' }` errors out if WebGPU is unavailable or initialization fails — failures are not silently swallowed.
114
- - `backend: { type: 'auto' }` prefers WebGPU when `navigator.gpu` is present and falls back to WebGL2 only when the WebGPU init path throws.
115
- - Initialization error paths are now observable through the thrown error rather than partially constructed state.
116
-
117
- ### Docs / examples
118
-
119
- - README rewritten to match the shipped surface.
120
- - New docs hub under `docs/` with sections for getting-started, core-concepts, assets, scenes, rendering, audio, physics, performance, and examples.
121
- - New class-focused API pages: `Application`, `Renderer`, `Graphics`, `AnimatedSprite`, `AssetManifests`, `Audio`, `View`, `VisualEffects`, `PhysicsRapier`, `Performance`, `GameFeel`.
122
- - `examples/` folder contains focused source snippets (`01-quickstart.ts` … `08-physics-rapier.ts`) that are typechecked against the public API via `tsconfig.examples.json`.
123
-
124
- ### Tooling / release quality
125
-
126
- - `npm run typecheck:examples` typechecks the in-repo examples against `src/` to prevent example drift.
127
- - `npm run verify:exports` validates the package entry graph (`scripts/verify-exports.mjs`).
128
- - `npm run verify:package` runs build → example typecheck → export verification → `npm pack --dry-run`.
129
- - `npm run verify:release` is the smallest release gate: typecheck → lint → tests → verify:package.
130
- - CI runs lint, typecheck, tests, bundle build, declaration build, example typecheck, export verification, and pack dry-run on every PR to `master`.
131
-
132
- ### Behaviour changes worth knowing
133
-
134
- These are minor-level behaviour changes, not source-breaks; flagged here for transparency:
135
-
136
- - **Automatic culling**: nodes whose `inView(view)` check is false are no longer submitted and are counted in `RenderStats.culledNodes`. Apps that were already relying on correct bounds see no observable change. If a custom drawable under-reports its bounds, it may now be skipped when it was previously drawn off-screen.
137
- - **Scene input routing**: with the new stack, input dispatch honours the resolved `SceneInputMode` of each stack entry. Apps that only use `setScene(...)` with no `pushScene` keep single-scene v2.0.0 behaviour.
138
- - **Explicit WebGPU failures**: `backend: { type: 'webgpu' }` now throws rather than silently picking WebGL2. Apps that want the old "try WebGPU, otherwise WebGL2" behaviour should use `backend: { type: 'auto' }`.
139
-
140
- ### Known limitations / honest caveats
141
-
142
- - **WebGL2 is still single-texture batched.** Multi-texture batching is implemented only in the WebGPU sprite renderer. WebGL2 sprite-heavy scenes will still flush on texture changes.
143
- - **WebGPU is improved, not "production WebGPU".** Treat the WebGPU backend as functional parity with WebGL2 for the features this library ships, not as a general-purpose WebGPU renderer.
144
- - **Rapier is optional.** If you never import the physics entry point, Rapier is not installed or loaded. It is not bundled with the library.
145
- - **Tilemaps are not in scope.** There is no built-in tilemap renderer; engines targeting Tiled-centric games should continue to reach for dedicated tooling.
146
- - **Bitmap fonts are not shipped.** `Text` renders via Canvas with stroke support; `BitmapText` is not included.
147
- - **No tween library.** Animation curves and tween orchestration are left to consumer code or external libraries.
148
- - **Audio remains Web Audio decoded/streaming with pooling and sprites.** Spatial audio (`PannerNode`), effects (`ConvolverNode`, `BiquadFilterNode`, `DynamicsCompressorNode`), and fade helpers are not part of this release.
149
- - **Particles are still CPU-simulated.** The WebGPU particle renderer is a rendering path, not a GPU compute simulator.
150
- - **Graphics: no gradients, patterns, caps/joins, or dashing.** Basic fills and strokes only.
151
- - **Input gaps unchanged from 2.0.0**: no haptics/vibration, no rebinding capture, no gesture library, fixed gamepad dead zones.
152
-
153
- ### Upgrading from 2.0.0
154
-
155
- No code changes are required for typical applications. Review the behaviour-change notes above if your code:
156
-
157
- - requests `backend: { type: 'webgpu' }` explicitly and was relying on silent fallback,
158
- - implements a custom `Drawable` with inexact bounds,
159
- - pushed multiple scenes via manual orchestration outside `SceneManager`.
160
-
161
- ## [2.0.0] - previous major
162
-
163
- Baseline for the modernized architecture wave (renderer runtime, scene runtime, class-token loader v2, math and rendering contract renames).
1
+ # Changelog
2
+
3
+ All notable changes to ExoJS are documented in this file.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.6.1] - 2026-05-02
8
+
9
+ Playground-only release. Library code is unchanged from 0.6.0; the
10
+ npm tarball ships byte-for-byte the same `dist/` output. The version
11
+ bump exists so the published changelog and the playground's release
12
+ catalog stay in sync.
13
+
14
+ ### Changed
15
+
16
+ - **Playground version selector now reads GitHub Releases at runtime.**
17
+ The dropdown was previously fed by a committed `versions.json` plus
18
+ per-version snapshot directories under
19
+ `examples/public/examples/versions/<id>/` and
20
+ `examples/public/vendor/exojs/<id>/`. Both are gone. The dropdown
21
+ now fetches from the GitHub Releases API
22
+ (`api.github.com/repos/Exoridus/ExoJS/releases`); the special
23
+ "current" entry continues to load locally-vendored sources for the
24
+ build-time HEAD. Example sources for any released version load
25
+ from `raw.githubusercontent.com/Exoridus/ExoJS/v<id>/...` and the
26
+ library bundle loads from `cdn.jsdelivr.net/npm/@codexo/exojs@<id>`.
27
+ Versions appear in the dropdown automatically once a tag is
28
+ published no bookkeeping commit is needed any more.
29
+
30
+ ### Removed
31
+
32
+ - **Versioned-snapshot scaffolding in the playground.** The
33
+ `examples/public/examples/versions/` snapshot tree, the
34
+ per-version `examples/public/vendor/exojs/<id>/` mirrors, and
35
+ `examples/public/examples/versions.json` are all gone, along with
36
+ the `phase2-bundle.smoke.test.mjs` smoke test that policed their
37
+ byte-identical layout. The `versions.json` shape test in
38
+ `phase1-bundle.smoke.test.mjs` is also gone. `sync-exo-vendor.ts`
39
+ no longer mirrors the flat vendor into a versioned subdirectory.
40
+
41
+ ## [0.6.0] - 2026-05-02
42
+
43
+ A large pre-1.0 cleanup release. Two intentional API breaks (Backend
44
+ rename, Scene class-only), a full GPU-instancing pass across sprite
45
+ and particle renderers on both backends, and a slimmer npm package
46
+ shape. All on a single 0.x minor since the project is still pre-1.0
47
+ and breaks freely between minors.
48
+
49
+ ### Breaking
50
+
51
+ - **`Runtime` types renamed to `Backend`; render-manager classes
52
+ collapse into the same name.** `SceneRenderRuntime` →
53
+ `RenderBackend`. The split `WebGl2RendererRuntime` /
54
+ `WebGpuRendererRuntime` interfaces are gone — the concrete classes
55
+ are the public type. `WebGl2RenderManager` → `WebGl2Backend`,
56
+ `WebGpuRenderManager` → `WebGpuBackend`. `Application.renderManager`
57
+ `Application.backend`. Internal field/parameter names follow
58
+ (`runtime` `backend`, `_runtime` `_backend`, `getRuntime()`
59
+ `getBackend()`). `WebGl2ShaderRuntime` `WebGl2ShaderProgram` (the
60
+ type stores a `WebGLProgram` plus its bound state the new name
61
+ reflects that). `WebGl2RenderBufferRuntime` and
62
+ `WebGl2VertexArrayObjectRuntime` keep their names they describe
63
+ per-resource lifecycle, not the render backend.
64
+ - **`Scene` is class-only; the plain-object definition constructor is
65
+ gone.** `new Scene({ update() { ... } })` no longer works. Subclass
66
+ to define a scene `class GameScene extends Scene { override
67
+ update(...) { ... } }` for named scenes, `new class extends Scene
68
+ { ... }` for one-offs. The `SceneData` interface and
69
+ `SceneInstance<T>` type alias are removed (they only existed to
70
+ type the spread-into-`this` constructor). Internal Scene fields
71
+ move from ECMAScript `#`-private to TS `protected _app/_root/
72
+ _stackMode/_inputMode` subclasses can now reach internal state
73
+ directly when they need to.
74
+ - **npm package shape simplified.** Dropped: `dist/exo.global.js` /
75
+ `dist/exo.global.min.js` (legacy IIFE for `<script>` use) and
76
+ `dist/exo.esm.min.js` (consumers minify on their side). What ships
77
+ now: `dist/esm/` (per-module ESM tree, the canonical entry) and
78
+ `dist/exo.esm.js` (single-file ESM bundle for direct module
79
+ loading). `package.json#main`, `module`, `browser`, `exports` are
80
+ unchanged in semantics only the auxiliary artifacts go away.
81
+
82
+ ### Performance
83
+
84
+ - **WebGL2 sprite renderer is now fully GPU-instanced.** Quad
85
+ corners derive from `gl_VertexID` in the vertex shader; per-instance
86
+ attributes carry `localBounds`, `transformAB`/`transformCD` (the 2D
87
+ affine), `uvBounds`, packed RGBA8 tint, and packed slot/flags (56
88
+ bytes per instance). The CPU per-frame cost is one bounded
89
+ `writeBuffer` per batch; no per-vertex stream is uploaded.
90
+ `drawArraysInstanced` over `TRIANGLE_STRIP` replaces the per-vertex
91
+ `drawElements` path.
92
+ - **WebGPU sprite renderer matches the same instanced layout.** Uses
93
+ `drawIndexed` over a static `[0,1,2,0,2,3]` index buffer with
94
+ `triangle-list` topology (the index buffer keeps mock-frame
95
+ bookkeeping deterministic — the on-screen result is the same as a
96
+ triangle-strip).
97
+ - **Particle renderers fully instanced on both backends, with system
98
+ data hoisted out of per-instance.** `localBounds`, `uvBounds`, and
99
+ `systemTransform` are now uniforms (one upload per system per
100
+ frame). Per-instance shrinks from 56 to 24 bytes (translation,
101
+ scale, rotation, packed RGBA8 color). `WebGl2ParticleRenderer` no
102
+ longer extends `AbstractWebGl2BatchedRenderer` — particles don't
103
+ share batch infrastructure with sprites anymore.
104
+
105
+ ### Removed
106
+
107
+ - `docs/` directory and the README's "Next Steps" link block. The
108
+ prose docs were drifting out of sync with the code; the in-repo
109
+ examples (`examples/README.md`) remain the supported reference.
110
+ - `SceneRenderRuntime`, `WebGl2RendererRuntime`, `WebGpuRendererRuntime`
111
+ interfaces (collapsed into the renamed classes — see Breaking).
112
+ - `SceneData` interface, `SceneInstance<T>` type alias (no longer
113
+ needed without the Scene definition-spread constructor).
114
+ - `WebGl2RenderManager`, `WebGpuRenderManager` class names (renamed
115
+ to `*Backend` see Breaking).
116
+ - `Sampler._premultiplyAlpha`, `Sampler._generateMipMap`,
117
+ `Sampler._flipY` (write-only texture pixel-store path consumes
118
+ these directly from `SamplerOptions`, the GL sampler object only
119
+ cares about scale and wrap modes).
120
+ - `AudioAnalyser._audioContext` (write-only never read after
121
+ setup).
122
+ - `WebGpuRenderManager._blendMode` (write-only renderers consult
123
+ `sprite.blendMode` directly; `setBlendMode` keeps its
124
+ not-yet-implemented blend-mode validation).
125
+ - `@rollup/plugin-terser` devDependency (no minified bundle output
126
+ any more).
127
+
128
+ ### Migration
129
+
130
+ ```ts
131
+ // Before (0.5.x)
132
+ class GameScene extends Scene {
133
+ override draw(runtime: SceneRenderRuntime): void {
134
+ this.root.render(runtime);
135
+ }
136
+ }
137
+
138
+ const triangleRenderer = new CustomRenderer(app.renderManager);
139
+
140
+ if (app.renderManager instanceof WebGpuRenderManager) { /* ... */ }
141
+
142
+ // Plain-object scene
143
+ app.start(new Scene({ update() { /* ... */ } }));
144
+ ```
145
+
146
+ ```ts
147
+ // After (0.6.0)
148
+ class GameScene extends Scene {
149
+ override draw(backend: RenderBackend): void {
150
+ this.root.render(backend);
151
+ }
152
+ }
153
+
154
+ const triangleRenderer = new CustomRenderer(app.backend);
155
+
156
+ if (app.backend instanceof WebGpuBackend) { /* ... */ }
157
+
158
+ // Anonymous-subclass scene (or named subclass)
159
+ app.start(new class extends Scene { override update() { /* ... */ } });
160
+ ```
161
+
162
+ ## [0.5.1] - 2026-04-28
163
+
164
+ Rendering-pipeline performance pass. No public API changes; all
165
+ optimisations are internal to the renderer subsystem.
166
+
167
+ ### Changed
168
+
169
+ - **WebGL2 sprite batching is now multi-texture.** A single batch can
170
+ bind up to eight textures (units 0..7); each vertex carries a uint
171
+ texture-slot attribute and the fragment shader's per-slot if-chain
172
+ selects the right sampler. Previously every texture change forced a
173
+ flush, capping multi-atlas scenes at roughly one batch per texture.
174
+ The vertex stride grows from 16 to 20 bytes (the new u32 slot at
175
+ offset 16 is the only addition); position, packed UV, and packed
176
+ RGBA8 tint are unchanged. Batches still flush on buffer-full,
177
+ blend-mode change, and now slot exhaustion (more than eight
178
+ textures in one batch).
179
+ - **WebGPU sprite vertex layout compacted from 28 to 24 bytes.** The
180
+ per-vertex `premultiplyAlpha` flag and `textureSlot` index
181
+ previously took one u32 attribute each; they are now packed into a
182
+ single u32 with the slot in bits 0..7 and the flag in bit 8. The
183
+ WGSL vertex shader unpacks via bit ops. 16 bytes saved per sprite.
184
+ - **Async-compile path now syncs the shader between buffer setup and
185
+ attribute lookup.** The 0.5.0+slice-C deferral of attribute /
186
+ uniform extraction from `initialize()` to first `sync()` broke
187
+ connect-time `getAttribute()` callers under a real WebGL2 context
188
+ (jest mocks didn't exercise that code path). Fixed in
189
+ `AbstractWebGl2BatchedRenderer`, `WebGl2PrimitiveRenderer`, and
190
+ `WebGl2MaskCompositor`. The driver still gets a parallel-compile
191
+ window between `shader.connect()` and `shader.sync()` thanks to
192
+ KHR_parallel_shader_compile; the eventual blocking status query is
193
+ a no-op when compile already finished.
194
+
195
+ ### Added
196
+
197
+ - **`WebGl2SpriteRenderer.prewarmPipelines` equivalent for WebGPU.**
198
+ `WebGpuSpriteRenderer.prewarmPipelines(formats)` calls
199
+ `createRenderPipelineAsync` for every BlendMode × format combo in
200
+ parallel during render-manager init. The first draw of every common
201
+ blend mode no longer blocks on synchronous pipeline creation.
202
+ Renderers without a `prewarmPipelines` method continue to create
203
+ pipelines lazily on first use; the pre-warm fallback gracefully
204
+ no-ops when `createRenderPipelineAsync` isn't available (older
205
+ browsers, headless test mocks).
206
+ - **`KHR_parallel_shader_compile` opt-in for WebGL2 shader compile.**
207
+ When the extension is present (Chrome / Edge / Firefox by default,
208
+ Safari since 17) the GL driver may compile shaders on a worker
209
+ thread; status queries are deferred to the first `sync()` call so
210
+ the main thread doesn't block on compile.
211
+ - **`ShaderPrimitives.UnsignedInt`, `UnsignedIntVec2..4`** with their
212
+ byte-size and array-constructor mappings, so `getActiveAttrib` /
213
+ `getActiveUniform` on a `uint` shader slot resolves correctly. The
214
+ enum gains four members; the runtime export inventory is unchanged.
215
+ - **`WebGl2VertexArrayObject.addAttribute(..., integer)`** parameter
216
+ routes integer-typed shader inputs (`uint`, `uvec`) to
217
+ `vertexAttribIPointer` rather than `vertexAttribPointer`, so the
218
+ shader receives the raw integer value instead of a coerced float.
219
+ - **`RendererRegistry.renderers()`** iterator exposes the registered
220
+ renderers so backend managers can dispatch optional lifecycle hooks
221
+ (such as the WebGPU pipeline pre-warm above) without per-renderer
222
+ private-field reach-ins.
223
+
224
+ ### Performance notes
225
+
226
+ - Sprite-heavy scenes with multiple atlases see a draw-call reduction
227
+ proportional to atlas count (up to 8×) on WebGL2.
228
+ - WebGPU sprite vertex bandwidth is reduced 14% (16 bytes per sprite).
229
+ - First-frame stutter from JIT shader / pipeline compilation is
230
+ largely eliminated when KHR_parallel_shader_compile (WebGL2) or
231
+ `createRenderPipelineAsync` (WebGPU) is supported.
232
+
233
+ ## [0.5.0] - 2026-04-28
234
+
235
+ Three focused breaking changes targeted at the first pre-1.0 minor: a hierarchy-semantics boundary slice (per `.workspace/reviews/opus-pre-1.0-architecture-review/09-b1-implementation-rfc.md`), a unified mask API with full multi-source support (per `.workspace/reviews/opus-pre-1.0-architecture-review/10-mask-api-decision.md`), and a Scene API simplification that collapses the static factory into the constructor. No aliases.
236
+
237
+ ### Removed
238
+
239
+ - **`Transformable` class and `TransformableFlags` enum.** Inlined into `SceneNode`. `SceneNode` now owns its transform fields and accessors (`position`, `x`, `y`, `rotation`, `scale`, `origin`, `setPosition`, `setRotation`, `setScale`, `setOrigin`, `move`, `rotate`, `getTransform`, `updateTransform`, `flags`) directly. The public surface shrinks by two symbols. `Flags<T>` (the generic class) remains public.
240
+ - **`SceneNode.render(runtime)` no-op.** Render belongs to `RenderNode` and below; bare `SceneNode` no longer pretends to participate in the render pass.
241
+ - **`Scene.create(definition)` static factory.** Replaced by a typed constructor overload — see Changed below.
242
+
243
+ ### Changed
244
+
245
+ - **`RenderNode.render(runtime)` is now `abstract`.** All concrete subclasses (`Drawable`, `Container`, `Graphics`, `Sprite`, `AnimatedSprite`, `Text`, `Video`, `ParticleSystem`, `DrawableShape`) already implement it. The abstract declaration removes the SceneNode-render lie.
246
+ - **`RenderNode.mask` is now the unified visual masking API**, accepting any `MaskSource = Rectangle | Texture | RenderTexture | RenderNode | null`. The behavior depends on the source:
247
+ - `Rectangle` — fast axis-aligned scissor clip (O(1) GPU state). The most common case for UI panels and viewport regions.
248
+ - `Texture` / `RenderTexture` — uses the texture's alpha channel as the mask, stretched to fit the masked node's local bounds. The texture has no transform of its own; for transform/scale/rotation control over the mask source, use a `Sprite(texture)` instead.
249
+ - `RenderNode` (`Sprite`, `Graphics`, `Container`, etc.) — the node's full visual output (with its own transform, filters, cacheAsBitmap) is rendered into an intermediate render texture and used as the alpha mask. Bare `SceneNode` instances are rejected at compile time because they are structural-only.
250
+ - `null` — no mask.
251
+
252
+ Setting `node.mask = node` (self-mask) throws at runtime.
253
+ - **`SceneRenderRuntime` mask primitives renamed** to match the new vocabulary:
254
+ - `pushMask(maskBounds)` / `popMask()` → `pushScissorRect(bounds)` / `popScissorRect()` (lower-level scissor primitive used internally by the `Rectangle` mask path).
255
+ - New `composeWithAlphaMask(content, mask, x, y, width, height, blendMode)` — used internally by the Texture/RenderTexture/RenderNode mask paths.
256
+ - Backend implementations: `WebGl2MaskCompositor` (new) and `WebGpuMaskCompositor` (new) implement the alpha-compose pipeline. Each owns its own shader/pipeline, lazily initialized on first use, disconnected on manager destroy. Pipelines are cached per (target format, blend mode) on the WebGPU side.
257
+ - **`Container._children` narrowed to `Array<RenderNode>`.** `addChild`, `addChildAt`, `removeChild`, `swapChildren`, `getChildIndex`, `setChildIndex`, `getChildAt`, and `Scene.addChild`/`removeChild` now require `RenderNode` instances. Bare `SceneNode` instances cannot be added to a container at compile time. (Previous behavior added them as no-op render nodes; observable behavior was unchanged for any code that already added Drawable/Container/Graphics/Sprite/etc.)
258
+ - **`Scene` is now generic and constructable with an optional typed `SceneData` definition.** `class Scene<T extends SceneData = SceneData>` — `new Scene()` produces an empty scene; `new Scene({ update() { ... }, draw() { ... } })` accepts a typed definition object whose method bodies see `this` as `Scene<T> & T` via `ThisType<>`. `class extends Scene` is unchanged and remains the recommended path for stateful scenes — TypeScript only infers properties declared inside the definition object, so `this._foo = ...` assignments inside method bodies are still invisible to the type system without pre-declaration. The existing `SceneInstance<T>` type alias keeps its meaning (`Scene<T> & T`) and is still re-exported from the package root.
259
+
260
+ ### Added
261
+
262
+ - **`MaskSource` type alias** is exported from the package root: `Rectangle | Texture | RenderTexture | RenderNode | null`. This is the public type for `RenderNode.mask`.
263
+ - **Root export runtime snapshot gate** (`test/core/root-index-snapshot.test.ts`). Captures every runtime-visible export name from `src/index.ts` and compares against a committed Jest snapshot. CI fails on any unintentional addition or removal.
264
+ - **Root export type-level inventory** (`test/core/root-index-type-inventory.test.ts`). Enumerates all exported symbols — including interfaces and type aliases erased at runtime — with their kind annotations.
265
+ - **RenderNode/SceneNode contract tests** (`test/rendering/render-node.test.ts`). Pin down the `SceneNode` is structural-only / `RenderNode.render` is abstract / `Container.addChild` rejects non-`RenderNode` contracts.
266
+ - **MaskSource union tests** (`test/rendering/mask-source.test.ts`). 12 tests covering: Rectangle scissor routing, nested rectangles, zero-size and null masks; Texture / RenderTexture / Sprite / Graphics / Container as alpha-mask sources; bare `SceneNode` rejected at compile time; self-mask rejected at runtime; mask reassignment to null.
267
+
268
+ ### Migration
269
+
270
+ | Before (0.4.x) | After |
271
+ |---|---|
272
+ | `import { Transformable } from '@codexo/exojs'`; `class X extends Transformable` | `import { SceneNode } from '@codexo/exojs'`; `class X extends SceneNode` |
273
+ | `import { TransformableFlags } from '@codexo/exojs'` | Internal flag enum is no longer public; use SceneNode's high-level transform accessors instead. |
274
+ | `node.mask = anyShapeNode` *(silently clipped to bounding rect)* | `node.mask = anyShapeNode` *(now a real shape mask via alpha compositing — except bare SceneNode which is rejected at compile time)* |
275
+ | Want fast axis-aligned clipping? | `node.mask = new Rectangle(x, y, w, h)` |
276
+ | Want to clip with a texture's alpha channel? | `node.mask = texture` or `node.mask = renderTexture` |
277
+ | Want a transformed/positioned alpha mask? | `node.mask = new Sprite(texture)` (Sprite's transform/position/scale apply to the mask source) |
278
+ | `runtime.pushMask(rect)` / `runtime.popMask()` | `runtime.pushScissorRect(rect)` / `runtime.popScissorRect()` (renamed; behavior unchanged) |
279
+ | `class Group extends SceneNode { override render() {...} }` | `class Group extends RenderNode { override render() {...} }` |
280
+ | `class CustomContainer extends Container { override addChild(child: SceneNode) {...} }` | `class CustomContainer extends Container { override addChild(child: RenderNode) {...} }` |
281
+ | `Scene.create({ update() {...} })` | `new Scene({ update() {...} })` (drop-in replacement; same `this` typing via `ThisType<Scene & T>`) |
282
+ | `Scene.create({})` | `new Scene()` |
283
+
284
+ No deprecated aliases are provided. The migration is mechanical and the project is pre-1.0 with explicit "may break between minors" policy.
285
+
286
+ ### Modernized
287
+
288
+ Quality-of-life cleanups using ES2022+ features. No public-API impact, but flagged here for transparency:
289
+
290
+ - **`Scene` uses ECMAScript `#` private fields** (`#app`, `#root`, `#stackMode`, `#inputMode`) instead of TypeScript `private _xxx`. True runtime privacy — fields are unreachable from outside the class even via bracket notation. The rest of the codebase still uses `private _xxx`; full sweep is queued for a future release pending test refactor (existing tests reach into private state via `obj['_field']`, which `#` fields block).
291
+ - **`Loader.ts` uses `Object.hasOwn(obj, key)`** instead of `Object.prototype.hasOwnProperty.call(obj, key)`. Same semantics, less ceremony.
292
+ - **`SceneManager` uses `array.at(-1)`** for stack-tail access instead of `arr[arr.length - 1]`. Three sites: the active-scene getter, `popScene`, and `_unloadCoveredScenes`.
293
+ - **`Loader.ts` uses `Error.cause`** for the wrapped error in `factory.create()` failures. `cause` carries the full original error (with stack trace) so DevTools, Sentry, etc. surface the underlying cause automatically. The wrapper message still contains the inner message for backward compatibility with consumers that string-match the error message.
294
+
295
+ ### Performance notes
296
+
297
+ - `mask = Rectangle` is O(1) GPU scissor — free at scale.
298
+ - `mask = Texture` / `mask = RenderTexture` adds one intermediate render texture acquire and one composite pass per masked render.
299
+ - `mask = RenderNode` adds a second intermediate render texture acquire (to bake the mask node's visual output) plus the composite pass — so two extra passes per masked render. Use sparingly for high-frequency draws; consider `cacheAsBitmap` on the masked content.
300
+
301
+ ### Notes
302
+
303
+ - The single dominant import model is intentional: `import { Application, Sprite } from '@codexo/exojs'` and `import * as Exo from '@codexo/exojs'` align with the IIFE/global bundle (`Exo.Application`, `Exo.Sprite`). Subpath exports are deferred until a stable API boundary warrants them.
304
+ - `SceneNode` is now a concrete structural class — transform, hierarchy, collision, culling. `RenderNode` (abstract) is the render-capable base. Every render-participating class extends `RenderNode`; bare `SceneNode` instances are valid as user-defined data nodes but cannot be added to containers.
305
+
306
+ ## [0.4.0] - 2026-04-26
307
+
308
+ Pre-1.0 versioning reset. The active development line moves from `2.1.2` to `0.4.0` to honestly reflect that the public API is not yet stable. No runtime behavior change relative to the previous head — this release marks a versioning policy shift, not a code rewrite.
309
+
310
+ ### Notes
311
+
312
+ - The `2.x` releases (`2.0.0`, `2.1.0`, `2.1.1`, `2.1.2`) remain published on npm as a historical line and will be deprecated with a pointer to the `0.x` line.
313
+ - New work happens on the `0.x` line. Expect breaking changes between `0.x` minors as the scene graph, renderer, and resource boundaries continue to evolve.
314
+ - `1.0.0` will mark the first stable public API contract. Until then, treat any minor version as potentially breaking and pin exact versions in downstream experiments.
315
+ - Current package identity for the reset line is `@codexo/exojs`. Historical `2.x` release notes may reference the legacy package/import name, old example layout, old scripts, or the former `master` branch target.
316
+ - The `2.1.0` View camera note below used the old working name `setBoundsConstraint`; the current API is `setBounds(...)` / `clearBounds()`.
317
+ - Past CHANGELOG entries for `2.x` are otherwise preserved below as the historical record of work that landed in those releases.
318
+
319
+ ## [2.1.2] - 2026-04-19
320
+
321
+ Patch release with one runtime fix, a toolchain modernization pass, and a legacy-artifact cleanup. No public API removals or renames.
322
+
323
+ ### Fixed
324
+
325
+ - **`Signal.dispatch` skipped sibling `once()` handlers.** `once()` wrappers self-remove mid-iteration, which compacts the underlying bindings array; the `for..of` iterator then advanced past the binding that shifted into the just-visited slot. `dispatch` now iterates a snapshot of bindings, so handler-driven mutation is safe. Visible symptom: the Audio Visualisation example received a set-up `Music` but an un-set-up `AudioAnalyser`, so frequency buffers stayed at zero.
326
+
327
+ ### Changed
328
+
329
+ - Removed the legacy bundled declaration file `dist/exo.d.ts` (emitted via `tsc --outFile` + `module: amd`, both deprecated in TypeScript 6). Modern consumers resolve types through `exports["."].types`, which points at the per-file tree in `dist/esm/`; `dist/exo.d.ts` was never part of the `exports` map. This also removes the `ignoreDeprecations: "6.0"` escape hatch from the build.
330
+ - Build upgraded to TypeScript 6, ESLint 10, Jest 30. Internal imports now use the `@/*` path alias (mapped to `src/*`) and `baseUrl` is no longer required.
331
+
332
+ ## [2.1.1] - 2026-04-19
333
+
334
+ Patch release fixing a cluster of WebGPU and scene-graph bugs discovered after 2.1.0 shipped. No public API removals or renames; one backward-compatible addition on `Container.addChild`.
335
+
336
+ ### Fixed
337
+
338
+ - **WebGPU adapter ordering.** `WebGpuRenderManager` now requests the GPU adapter before acquiring the canvas WebGPU context. A null adapter previously locked the canvas into WebGPU mode, preventing `Application`'s automatic WebGL2 fallback from obtaining a context on the same element.
339
+ - **WebGL2 shader program binding.** `WebGl2ShaderRuntime.sync()` now binds the program before writing uniforms. The previous draw pipeline never called `bindShader(shader)` with a non-null shader, so every `uniform*` write targeted the wrong or null program and `drawElements` reported "no valid shader program in use". Exposed by the WebGPU adapter fallback above.
340
+ - **WGSL multi-texture sprite shader** uses `textureSampleGrad` with explicit screen-space derivatives. `textureSample`'s uniformity requirement prevented the 8-slot dispatch from compiling on any sprite batch spanning more than one texture slot.
341
+ - **Sprite index buffer** allocation and lifecycle. Buffer size was 4× larger than intended (`indexData.byteLength * BYTES_PER_ELEMENT` instead of `indexData.byteLength`), and `_ensureBatchCapacity` ran inside the draw loop and could destroy a buffer the render pass had already bound. Capacity is now grown once up front.
342
+ - **Sprite multi-batch rendering.** When a flush contained multiple batches (blend-mode change, texture-slot overflow, or pipeline switch), each batch's `queue.writeBuffer(vertexBuffer, offset: 0, ...)` serialised before the single submit, leaving only the last batch's vertex data in the buffer. All batch vertex data is now packed into one CPU buffer at distinct sprite offsets and uploaded once; `drawIndexed` uses `firstIndex` to target each range.
343
+ - **Particle and primitive multi-drawcall rendering.** Same multi-write-to-offset-0 pattern, plus mid-loop `_ensureCapacity` destroying buffers still referenced by the pass. Particle renderer now submits one command buffer per system. Primitive renderer was rewritten: CPU bakes `view * globalTransform` into `vec4` clip-space positions per vertex, pipeline has no bind-group, one render pass per flush with packed vertex/index buffers.
344
+ - **Primitive combine order.** `_combinedTransform.copy(view).combine(global)` produced `global * view` (`Matrix.combine` applies the argument on the left, confirmed by `SceneNode.getGlobalTransform` which chains `local.combine(parent.global)` to yield `parent.global * local`). Swapped to `copy(global).combine(view)` = `view * global`.
345
+ - **WebGPU mipmap generation.** The full-screen downsample triangle's UVs are no longer Y-flipped relative to framebuffer orientation. Every odd mip level was being rendered upside-down, producing a visible sprite flip whenever the view zoomed far enough for the LOD selector to cross an odd/even boundary.
346
+
347
+ ### Added
348
+
349
+ - `Container.addChild` accepts multiple children via rest args (`addChild(...children)`). The previous single-argument signature silently dropped the tail of `addChild(a, b, c, d)`; callers only saw `a` in the scene graph. Single-child usage stays backward compatible.
350
+ - Doc comment on `ParticleOptions.position` clarifying it is in the owning `ParticleSystem`'s local coordinate space. The shader applies the system's global transform on top, so passing world coordinates double-translates the emitter.
351
+
352
+ ## [2.1.0] - 2026-04-18
353
+
354
+ Product-readiness release. Additive across assets, game-feel, visuals, performance, optional physics, and WebGPU parity. No public contracts were removed or renamed since v2.0.0.
355
+
356
+ ### Highlights
357
+
358
+ - Typed asset manifests and bundle loading workflow.
359
+ - `AnimatedSprite` with named clips, loop control, and frame signals.
360
+ - Scene stacking with participation policies, input routing, and fade transitions.
361
+ - View/camera polish: follow with lerp, bounds clamp, zoom, shake.
362
+ - Audio sprites and sound pooling.
363
+ - Visual capability wave: filter pipeline, masking, render passes, cache-as-bitmap, multi-texture batching on the WebGPU backend.
364
+ - Automatic off-screen culling with observable render stats.
365
+ - Optional Rapier physics integration behind an optional peer dependency.
366
+ - WebGPU parity improvements and clearer initialization failure semantics.
367
+ - Docs and examples overhaul; release verification hardening.
368
+
369
+ ### Assets / workflow
370
+
371
+ - `defineAssetManifest`, `AssetEntry`, and `loadBundle` with progress callbacks.
372
+ - `BundleLoadError` surfaces per-entry failures with the responsible loader token.
373
+ - Strict manifest validation runs at definition time.
374
+ - `CacheStore` + `IndexedDbStore` remain the persistence path; strategy classes (`CacheFirstStrategy`, `NetworkOnlyStrategy`) are exposed for custom pipelines.
375
+
376
+ ### Game-feel
377
+
378
+ - `AnimatedSprite`: `defineClip`, `setClips`, `play`, `stop`, `loop` override, `onComplete` and `onFrame` signals.
379
+ - `SceneManager` is now a real stack: `pushScene`, `popScene`, `setScene` with resolved `SceneParticipationPolicy` covering stack mode and input mode.
380
+ - `SceneInputEvent` routing honours stack participation so overlay/modal scenes can intercept input cleanly.
381
+ - Fade transitions integrated into scene switching.
382
+ - `View` camera: `follow` with lerp, `setBoundsConstraint`, `zoom`/`setZoom`, `shake` with decay and configurable frequency.
383
+ - `Sound`: `setPoolSize`, `playPooled`, `stopPooled`, `defineSprite`, `setSprites` for audio-sprite playback.
384
+
385
+ ### Rendering / visuals
386
+
387
+ - Filter pipeline: abstract `Filter` base with `BlurFilter` and `ColorFilter` implementations; per-node filter chains wired through the render runtime.
388
+ - Masking support in both render managers and on `RenderNode`.
389
+ - Render-pass composition: `RenderTargetPass`, `CallbackRenderPass`, `RenderTarget`, and the existing `RenderTexture` for off-screen work.
390
+ - `RenderNode.cacheAsBitmap` flattens expensive subtrees to a cached texture with invalidation.
391
+ - `Container.sortableChildren` + `SceneNode.zIndex` provide depth-sorted rendering with a stable fallback on insertion order.
392
+ - Multi-texture batching on the WebGPU sprite renderer (`textureSlots`, `maxBatchTextures`). See caveat below.
393
+ - WebGPU sprite, particle, and primitive renderers reached functional parity with the WebGL2 equivalents.
394
+ - Context-loss handling preserved.
395
+
396
+ ### Performance
397
+
398
+ - Automatic off-screen culling: `Drawable` checks `inView(view)` each frame and counts skipped nodes.
399
+ - `RenderStats` exposes `submittedNodes`, `culledNodes`, `drawCalls`, `batches`, `renderPasses`, and `frameTimeMs` for observability.
400
+ - Hot-path cleanup across the renderers.
401
+ - `npm run perf:benchmark` runs the rendering benchmark harness under `test/perf/`.
402
+
403
+ ### Physics
404
+
405
+ - Optional Rapier integration via `createRapierPhysicsWorld({ gravityY })`.
406
+ - `@dimforge/rapier2d-compat` is declared as an optional `peerDependency`; apps that do not import the physics entry point incur zero runtime cost.
407
+ - Collision groups/masks encoded into Rapier's 16/16 packed format; `PhysicsCollisionFilter` lets you declare membership and what each body collides with.
408
+ - Triggers vs. solid colliders distinguished via `trigger` on the descriptor; `onTriggerEnter` / `onTriggerExit` signals on the body.
409
+ - Transform sync helpers and a `createDebugGraphics`/`updateDebugGraphics` path for debug draw through the existing `Graphics` primitive.
410
+
411
+ ### WebGPU
412
+
413
+ - Sprite, particle, and primitive renderers now cover the WebGL2 feature surface used by the scene runtime.
414
+ - Explicit `backend: { type: 'webgpu' }` errors out if WebGPU is unavailable or initialization fails — failures are not silently swallowed.
415
+ - `backend: { type: 'auto' }` prefers WebGPU when `navigator.gpu` is present and falls back to WebGL2 only when the WebGPU init path throws.
416
+ - Initialization error paths are now observable through the thrown error rather than partially constructed state.
417
+
418
+ ### Docs / examples
419
+
420
+ - README rewritten to match the shipped surface.
421
+ - New docs hub under `docs/` with sections for getting-started, core-concepts, assets, scenes, rendering, audio, physics, performance, and examples.
422
+ - New class-focused API pages: `Application`, `Renderer`, `Graphics`, `AnimatedSprite`, `AssetManifests`, `Audio`, `View`, `VisualEffects`, `PhysicsRapier`, `Performance`, `GameFeel`.
423
+ - `examples/` folder contains focused source snippets (`01-quickstart.ts` … `08-physics-rapier.ts`) that are typechecked against the public API via `tsconfig.examples.json`.
424
+
425
+ ### Tooling / release quality
426
+
427
+ - `npm run typecheck:examples` typechecks the in-repo examples against `src/` to prevent example drift.
428
+ - `npm run verify:exports` validates the package entry graph (`scripts/verify-exports.mjs`).
429
+ - `npm run verify:package` runs build → example typecheck → export verification → `npm pack --dry-run`.
430
+ - `npm run verify:release` is the smallest release gate: typecheck → lint → tests → verify:package.
431
+ - CI runs lint, typecheck, tests, bundle build, declaration build, example typecheck, export verification, and pack dry-run on every PR to `master`.
432
+
433
+ ### Behaviour changes worth knowing
434
+
435
+ These are minor-level behaviour changes, not source-breaks; flagged here for transparency:
436
+
437
+ - **Automatic culling**: nodes whose `inView(view)` check is false are no longer submitted and are counted in `RenderStats.culledNodes`. Apps that were already relying on correct bounds see no observable change. If a custom drawable under-reports its bounds, it may now be skipped when it was previously drawn off-screen.
438
+ - **Scene input routing**: with the new stack, input dispatch honours the resolved `SceneInputMode` of each stack entry. Apps that only use `setScene(...)` with no `pushScene` keep single-scene v2.0.0 behaviour.
439
+ - **Explicit WebGPU failures**: `backend: { type: 'webgpu' }` now throws rather than silently picking WebGL2. Apps that want the old "try WebGPU, otherwise WebGL2" behaviour should use `backend: { type: 'auto' }`.
440
+
441
+ ### Known limitations / honest caveats
442
+
443
+ - **WebGL2 is still single-texture batched.** Multi-texture batching is implemented only in the WebGPU sprite renderer. WebGL2 sprite-heavy scenes will still flush on texture changes.
444
+ - **WebGPU is improved, not "production WebGPU".** Treat the WebGPU backend as functional parity with WebGL2 for the features this library ships, not as a general-purpose WebGPU renderer.
445
+ - **Rapier is optional.** If you never import the physics entry point, Rapier is not installed or loaded. It is not bundled with the library.
446
+ - **Tilemaps are not in scope.** There is no built-in tilemap renderer; engines targeting Tiled-centric games should continue to reach for dedicated tooling.
447
+ - **Bitmap fonts are not shipped.** `Text` renders via Canvas with stroke support; `BitmapText` is not included.
448
+ - **No tween library.** Animation curves and tween orchestration are left to consumer code or external libraries.
449
+ - **Audio remains Web Audio decoded/streaming with pooling and sprites.** Spatial audio (`PannerNode`), effects (`ConvolverNode`, `BiquadFilterNode`, `DynamicsCompressorNode`), and fade helpers are not part of this release.
450
+ - **Particles are still CPU-simulated.** The WebGPU particle renderer is a rendering path, not a GPU compute simulator.
451
+ - **Graphics: no gradients, patterns, caps/joins, or dashing.** Basic fills and strokes only.
452
+ - **Input gaps unchanged from 2.0.0**: no haptics/vibration, no rebinding capture, no gesture library, fixed gamepad dead zones.
453
+
454
+ ### Upgrading from 2.0.0
455
+
456
+ No code changes are required for typical applications. Review the behaviour-change notes above if your code:
457
+
458
+ - requests `backend: { type: 'webgpu' }` explicitly and was relying on silent fallback,
459
+ - implements a custom `Drawable` with inexact bounds,
460
+ - pushed multiple scenes via manual orchestration outside `SceneManager`.
461
+
462
+ ## [2.0.0] - previous major
463
+
464
+ Baseline for the modernized architecture wave (renderer runtime, scene runtime, class-token loader v2, math and rendering contract renames).