@needle-tools/engine 5.1.0-canary.0d9f44e → 5.1.0-canary.244f23e

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 (73) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-D5zzggEG.min.js → needle-engine.bundle-CJmix0Oo.min.js} +141 -141
  4. package/dist/{needle-engine.bundle-B35n_IHX.js → needle-engine.bundle-CcPGKcD_.js} +7638 -7673
  5. package/dist/{needle-engine.bundle-CDj15wRB.umd.cjs → needle-engine.bundle-rcR8UYgV.umd.cjs} +141 -141
  6. package/dist/needle-engine.d.ts +35 -62
  7. package/dist/needle-engine.js +188 -186
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/dist/three-examples.js +3778 -4289
  11. package/dist/three-examples.min.js +14 -301
  12. package/dist/three-examples.umd.cjs +14 -301
  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_context.d.ts +16 -19
  20. package/lib/engine/engine_context.js +12 -15
  21. package/lib/engine/engine_context.js.map +1 -1
  22. package/lib/engine/engine_gameobject.js +2 -2
  23. package/lib/engine/engine_gameobject.js.map +1 -1
  24. package/lib/engine/engine_init.js +10 -0
  25. package/lib/engine/engine_init.js.map +1 -1
  26. package/lib/engine/engine_scenedata.d.ts +5 -7
  27. package/lib/engine/engine_scenedata.js +14 -11
  28. package/lib/engine/engine_scenedata.js.map +1 -1
  29. package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
  30. package/lib/engine/engine_serialization_builtin_serializer.js +28 -41
  31. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  32. package/lib/engine/webcomponents/jsx.d.ts +51 -0
  33. package/lib/engine/webcomponents/logo-element.d.ts +0 -8
  34. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  35. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +0 -8
  36. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  37. package/lib/engine/webcomponents/needle-button.d.ts +0 -13
  38. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  39. package/lib/engine/webcomponents/needle-engine.d.ts +0 -5
  40. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  41. package/lib/engine-components/AnimatorController.d.ts +2 -0
  42. package/lib/engine-components/AnimatorController.js +4 -1
  43. package/lib/engine-components/AnimatorController.js.map +1 -1
  44. package/lib/engine-components/Light.d.ts +0 -19
  45. package/lib/engine-components/Light.js +4 -96
  46. package/lib/engine-components/Light.js.map +1 -1
  47. package/lib/engine-components/ReflectionProbe.js +2 -0
  48. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  49. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
  50. package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
  51. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  52. package/lib/needle-engine.d.ts +1 -0
  53. package/lib/needle-engine.js +1 -0
  54. package/lib/needle-engine.js.map +1 -1
  55. package/package.json +1 -1
  56. package/plugins/vite/reload.js +18 -17
  57. package/src/engine/debug/debug_spatial_console.ts +10 -7
  58. package/src/engine/engine_addressables.ts +6 -3
  59. package/src/engine/engine_context.ts +18 -20
  60. package/src/engine/engine_gameobject.ts +2 -2
  61. package/src/engine/engine_init.ts +10 -0
  62. package/src/engine/engine_scenedata.ts +13 -10
  63. package/src/engine/engine_serialization_builtin_serializer.ts +32 -43
  64. package/src/engine/webcomponents/jsx.d.ts +51 -0
  65. package/src/engine/webcomponents/logo-element.ts +1 -8
  66. package/src/engine/webcomponents/needle menu/needle-menu.ts +1 -8
  67. package/src/engine/webcomponents/needle-button.ts +1 -13
  68. package/src/engine/webcomponents/needle-engine.ts +1 -6
  69. package/src/engine-components/AnimatorController.ts +4 -1
  70. package/src/engine-components/Light.ts +4 -95
  71. package/src/engine-components/ReflectionProbe.ts +2 -0
  72. package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
  73. package/src/needle-engine.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,31 @@ 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.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 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
+ ```ts
10
+ // fully typed, with autocomplete for every node and component
11
+ const cam = ctx.sceneData.MyScene.MainCamera.$object; // THREE.PerspectiveCamera
12
+ const orbit = ctx.sceneData.MyScene.MainCamera.$components.OrbitControls; // typed!
13
+ ```
14
+ - **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
+ - **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
16
+ - **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.
17
+ ```ts
18
+ import { needle } from "@needle-tools/engine";
19
+ needle.scene.traverse(obj => { ... }); // access the three.js scene
20
+ needle.renderer; // access the WebGLRenderer
21
+ needle.sceneData.MyScene.Camera.$components.OrbitControls.autoRotate = true;
22
+ ```
23
+ - **NEW**: `context.lights` array and `context.mainLight` getter for easy access to all scene lights and the primary directional light
24
+ - 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:
25
+ ```js
26
+ export default defineConfig({ plugins: [sveltekit(), needlePlugins()] });
27
+ ```
28
+ - Fix: BloomEffect and Sharpening were pulling in the entire `postprocessing` library even in projects that don't use postprocessing, increasing bundle size unnecessarily
29
+ - Fix: SceneSwitcher now shows the object name in the URL when referencing scene objects (instead of just an index)
30
+ - Improved: Vite plugin reliability (fewer unnecessary reloads, cleaner log output)
31
+
7
32
  ## [5.1.0-alpha.1] - 2026-04-10
8
33
  - Add: `AnimatorControllerBuilder` for building animator controllers from code (experimental)
9
34
  - Add: XR global events now return an unsubscribe function + `onBeforeXRSessionRequest` event
@@ -36,6 +61,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
36
61
  - Fix: HTML mobile icon not rendering
37
62
  - Fix: UI `Text` component absolute font URL handling
38
63
 
64
+ ## [5.0.4] - 2026-04-20
65
+ - Fix: VideoPlayer not working when tree-shaking is enabled due to URL serializer being removed
66
+ - Fix: ReflectionProbe not cleaning up `envMapRotation` and `envMapIntensity` overrides when removing envMap
67
+
68
+ ## [5.0.3] - 2026-04-08
69
+ - Add: PMREM / FastHDR support for GroundProjection with shader-based blurriness, blending, and alpha controls
70
+ - Fix: MaterialPropertyBlock multi-material change from opaque to transparent
71
+ - Improved: OrbitControls JSDoc for `targetBounds`
72
+
39
73
  ## [5.0.2] - 2026-04-03
40
74
  - Updated `@needle-tools/materialx` to 1.6.0:
41
75
  - UV coordinate convention handling (glTF ↔ OpenGL) — fixes UV-dependent effects like displacement and procedural noise in the browser