@needle-tools/engine 5.1.0-alpha.2 → 5.1.0-alpha.3

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 (133) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-qZfVf_v-.umd.cjs → needle-engine.bundle-C-ixARur.umd.cjs} +128 -127
  4. package/dist/{needle-engine.bundle-B-5Q2CpC.min.js → needle-engine.bundle-CHmXdnE1.min.js} +138 -137
  5. package/dist/{needle-engine.bundle-dit3f1l5.js → needle-engine.bundle-DF01sSGQ.js} +7815 -7602
  6. package/dist/needle-engine.d.ts +125 -27
  7. package/dist/needle-engine.js +524 -521
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/lib/engine/api.d.ts +2 -0
  11. package/lib/engine/api.js +2 -0
  12. package/lib/engine/api.js.map +1 -1
  13. package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
  14. package/lib/engine/debug/debug_spatial_console.js +10 -7
  15. package/lib/engine/debug/debug_spatial_console.js.map +1 -1
  16. package/lib/engine/engine_addressables.d.ts +2 -0
  17. package/lib/engine/engine_addressables.js +6 -3
  18. package/lib/engine/engine_addressables.js.map +1 -1
  19. package/lib/engine/engine_audio.d.ts +68 -0
  20. package/lib/engine/engine_audio.js +172 -0
  21. package/lib/engine/engine_audio.js.map +1 -1
  22. package/lib/engine/engine_components.js +1 -1
  23. package/lib/engine/engine_components.js.map +1 -1
  24. package/lib/engine/engine_context.d.ts +1 -1
  25. package/lib/engine/engine_context.js +1 -1
  26. package/lib/engine/engine_context.js.map +1 -1
  27. package/lib/engine/engine_gameobject.js +2 -2
  28. package/lib/engine/engine_gameobject.js.map +1 -1
  29. package/lib/engine/engine_init.js +13 -3
  30. package/lib/engine/engine_init.js.map +1 -1
  31. package/lib/engine/engine_input.d.ts +1 -1
  32. package/lib/engine/engine_input.js +1 -1
  33. package/lib/engine/engine_input.js.map +1 -1
  34. package/lib/engine/engine_license.js +1 -1
  35. package/lib/engine/engine_license.js.map +1 -1
  36. package/lib/engine/engine_mainloop_utils.js +5 -2
  37. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  38. package/lib/engine/engine_networking_blob.js +1 -1
  39. package/lib/engine/engine_networking_blob.js.map +1 -1
  40. package/lib/engine/engine_scenedata.d.ts +2 -0
  41. package/lib/engine/engine_scenedata.js +4 -2
  42. package/lib/engine/engine_scenedata.js.map +1 -1
  43. package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
  44. package/lib/engine/engine_serialization_builtin_serializer.js +55 -41
  45. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  46. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  47. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
  48. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +1 -1
  49. package/lib/engine/webcomponents/needle menu/needle-menu.js +1 -1
  50. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  51. package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
  52. package/lib/engine/webcomponents/needle-engine.js +1 -1
  53. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  54. package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
  55. package/lib/engine/xr/NeedleXRSession.js +50 -14
  56. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  57. package/lib/engine/xr/events.d.ts +1 -1
  58. package/lib/engine/xr/events.js.map +1 -1
  59. package/lib/engine-components/Animation.js +17 -16
  60. package/lib/engine-components/Animation.js.map +1 -1
  61. package/lib/engine-components/AnimatorController.d.ts +2 -0
  62. package/lib/engine-components/AnimatorController.js +4 -1
  63. package/lib/engine-components/AnimatorController.js.map +1 -1
  64. package/lib/engine-components/AudioSource.d.ts +19 -3
  65. package/lib/engine-components/AudioSource.js +121 -68
  66. package/lib/engine-components/AudioSource.js.map +1 -1
  67. package/lib/engine-components/DragControls.d.ts +7 -0
  68. package/lib/engine-components/DragControls.js +19 -0
  69. package/lib/engine-components/DragControls.js.map +1 -1
  70. package/lib/engine-components/Networking.d.ts +1 -1
  71. package/lib/engine-components/Networking.js +1 -1
  72. package/lib/engine-components/OrbitControls.js +16 -11
  73. package/lib/engine-components/OrbitControls.js.map +1 -1
  74. package/lib/engine-components/ReflectionProbe.js +2 -0
  75. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  76. package/lib/engine-components/SeeThrough.js +2 -2
  77. package/lib/engine-components/SeeThrough.js.map +1 -1
  78. package/lib/engine-components/api.d.ts +1 -1
  79. package/lib/engine-components/api.js +1 -1
  80. package/lib/engine-components/api.js.map +1 -1
  81. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  82. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
  83. package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
  84. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  85. package/lib/engine-components/ui/Canvas.d.ts +1 -1
  86. package/lib/engine-components/ui/Canvas.js +2 -8
  87. package/lib/engine-components/ui/Canvas.js.map +1 -1
  88. package/lib/engine-components/ui/Text.d.ts +1 -0
  89. package/lib/engine-components/ui/Text.js +10 -7
  90. package/lib/engine-components/ui/Text.js.map +1 -1
  91. package/lib/engine-components/web/CursorFollow.js +21 -12
  92. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  93. package/lib/engine-components/webxr/WebXRImageTracking.js +4 -0
  94. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  95. package/package.json +1 -1
  96. package/plugins/vite/asap.js +17 -8
  97. package/plugins/vite/dependencies.js +29 -0
  98. package/plugins/vite/local-files-core.js +3 -3
  99. package/plugins/vite/local-files-utils.d.ts +3 -1
  100. package/plugins/vite/local-files-utils.js +29 -5
  101. package/src/engine/api.ts +3 -0
  102. package/src/engine/debug/debug_spatial_console.ts +10 -7
  103. package/src/engine/engine_addressables.ts +6 -3
  104. package/src/engine/engine_audio.ts +184 -0
  105. package/src/engine/engine_components.ts +1 -1
  106. package/src/engine/engine_context.ts +2 -2
  107. package/src/engine/engine_gameobject.ts +2 -2
  108. package/src/engine/engine_init.ts +13 -3
  109. package/src/engine/engine_input.ts +1 -1
  110. package/src/engine/engine_license.ts +1 -1
  111. package/src/engine/engine_mainloop_utils.ts +5 -2
  112. package/src/engine/engine_networking_blob.ts +1 -1
  113. package/src/engine/engine_scenedata.ts +5 -3
  114. package/src/engine/engine_serialization_builtin_serializer.ts +63 -46
  115. package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  116. package/src/engine/webcomponents/needle menu/needle-menu.ts +1 -1
  117. package/src/engine/webcomponents/needle-engine.ts +10 -4
  118. package/src/engine/xr/NeedleXRSession.ts +48 -13
  119. package/src/engine/xr/events.ts +1 -1
  120. package/src/engine-components/Animation.ts +19 -16
  121. package/src/engine-components/AnimatorController.ts +4 -1
  122. package/src/engine-components/AudioSource.ts +130 -79
  123. package/src/engine-components/DragControls.ts +18 -2
  124. package/src/engine-components/Networking.ts +1 -1
  125. package/src/engine-components/OrbitControls.ts +18 -9
  126. package/src/engine-components/ReflectionProbe.ts +2 -0
  127. package/src/engine-components/SeeThrough.ts +2 -2
  128. package/src/engine-components/api.ts +1 -1
  129. package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
  130. package/src/engine-components/ui/Canvas.ts +2 -8
  131. package/src/engine-components/ui/Text.ts +12 -8
  132. package/src/engine-components/web/CursorFollow.ts +21 -13
  133. package/src/engine-components/webxr/WebXRImageTracking.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -4,8 +4,26 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [5.1.0-alpha.3] - 2026-04-29
8
+ #### Added
9
+ - `AudioClip` type with standalone playback control — use with `@serializable(AudioClip)` for direct audio clip references
10
+ - `AudioSource` spatial blend support via dual-path audio graph for smooth 2D/3D crossfade
11
+ - UI Text default static font from Needle CDN with absolute font URL support
12
+ - `DragControls` EventList support
13
+
14
+ #### Fixed
15
+ - UI Text font URL resolution when loading GLBs from external hosts (e.g. CDN)
16
+ - `AudioSource` spatial rolloff factor and `play()` reliability
17
+ - `Animation` `play()` with `{ exclusive: false }` not stopping already-running clips
18
+ - XR lifecycle — spurious `onLeaveXR` calls for scripts that never entered XR
19
+ - `OrbitControls` lookBounds lerp and distance-relative gizmo sizes
20
+ - `CursorFollow` self-intersection and snapToSurface raycast direction
21
+ - Vite `makeFilesLocal` and alias plugins now respect `vite.config` `base`
22
+ - `three-mesh-bvh` worker failing to load in local dev server
23
+ - `VideoPlayer` URL serializer tree-shaken out in code-only projects
24
+ - `ReflectionProbe` not cleaning up overrides when removed
7
25
  ## [5.1.0-alpha.2] - 2026-04-13
8
- - **NEW**: Scene Bindings (experimental) — auto-generated TypeScript types from your glTF scenes, providing typed access to nodes, components, and properties via `ctx.sceneData` or `needle.sceneData`. Types are generated automatically by a Vite plugin whenever your scene files change — no configuration needed. Works with both local and remote (Needle Cloud) assets. The API shape (particularly `$components` and `$object` accessors) may evolve based on feedback. Can be disabled with `dts: { enabled: false }` in your Vite plugin config.
26
+ - **NEW**: Scene Bindings (experimental) — auto-generated TypeScript types from your glTF scenes, providing typed access to nodes, components, and properties via `ctx.sceneData` or `needle.sceneData`. Types are generated automatically by a Vite plugin whenever your scene files change — no configuration needed. Works with any glTF/GLB assigned as `src` on `<needle-engine>`, including remote URLs and Needle Cloud assets. The API shape (particularly `$components` and `$object` accessors) may evolve based on feedback. Can be disabled with `dts: { enabled: false }` in your Vite plugin config.
9
27
  ```ts
10
28
  // fully typed, with autocomplete for every node and component
11
29
  const cam = ctx.sceneData.MyScene.MainCamera.$object; // THREE.PerspectiveCamera
@@ -13,6 +31,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
13
31
  ```
14
32
  - **NEW**: SSR support (experimental) — import Needle Engine in Node.js/SSR frameworks (SvelteKit, Next.js, Nuxt) without `ReferenceError` crashes. The engine now provides SSR-safe base classes and skips browser-dependent initialization on the server. Core rendering still happens client-side — SSR support means your app can import and reference engine code server-side without errors.
15
33
  - **NEW**: JSX type declarations for `<needle-engine>` and other web components — first-class support for React, Preact, SolidJS, and other JSX-based frameworks with full autocomplete and type checking
34
+ - **NEW**: `needle` shorthand (experimental) — quick access to the current engine context from anywhere without passing `ctx` around. Works in React/Svelte/Vue components, button handlers, or plain JavaScript. SSR-safe.
35
+ ```ts
36
+ import { needle } from "@needle-tools/engine";
37
+ needle.scene.traverse(obj => { ... }); // access the three.js scene
38
+ needle.renderer; // access the WebGLRenderer
39
+ needle.sceneData.MyScene.Camera.$components.OrbitControls.autoRotate = true;
40
+ ```
16
41
  - **NEW**: `context.lights` array and `context.mainLight` getter for easy access to all scene lights and the primary directional light
17
42
  - Add: `needlePlugins()` can now be called without arguments — the Vite command is resolved automatically. This simplifies setup in frameworks like SvelteKit where `defineConfig` doesn't expose the command:
18
43
  ```js
@@ -54,6 +79,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
54
79
  - Fix: HTML mobile icon not rendering
55
80
  - Fix: UI `Text` component absolute font URL handling
56
81
 
82
+ ## [5.0.4] - 2026-04-20
83
+ - Fix: VideoPlayer not working when tree-shaking is enabled due to URL serializer being removed
84
+ - Fix: ReflectionProbe not cleaning up `envMapRotation` and `envMapIntensity` overrides when removing envMap
85
+
86
+ ## [5.0.3] - 2026-04-08
87
+ - Add: PMREM / FastHDR support for GroundProjection with shader-based blurriness, blending, and alpha controls
88
+ - Fix: MaterialPropertyBlock multi-material change from opaque to transparent
89
+ - Improved: OrbitControls JSDoc for `targetBounds`
90
+
57
91
  ## [5.0.2] - 2026-04-03
58
92
  - Updated `@needle-tools/materialx` to 1.6.0:
59
93
  - UV coordinate convention handling (glTF ↔ OpenGL) — fixes UV-dependent effects like displacement and procedural noise in the browser