@needle-tools/engine 5.1.0-next.1780579670.dramatic-pierogi.b8fa941 → 5.1.0

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 (122) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/components.needle.json +1 -1
  3. package/dist/gltf-progressive-BGQ-cjly.umd.cjs +10 -0
  4. package/dist/gltf-progressive-BvQHrERj.min.js +10 -0
  5. package/dist/{gltf-progressive-CH7aqHHr.js → gltf-progressive-CtYnVfLc.js} +420 -351
  6. package/dist/{materialx-B85WjP7E.min.js → materialx-B5gKeM65.min.js} +1 -1
  7. package/dist/{materialx-B47Bz-xs.umd.cjs → materialx-CFRcCYWy.umd.cjs} +1 -1
  8. package/dist/{materialx-jkHmVPez.js → materialx-DqGmteNO.js} +1 -1
  9. package/dist/{needle-engine.bundle-WQeWxmZD.js → needle-engine.bundle-5oIL49YP.js} +6826 -6685
  10. package/dist/{needle-engine.bundle-BSPk6RkD.min.js → needle-engine.bundle-DAAfj8Cs.min.js} +161 -149
  11. package/dist/{needle-engine.bundle-DCPHDPAd.umd.cjs → needle-engine.bundle-DvOrfXws.umd.cjs} +159 -147
  12. package/dist/needle-engine.d.ts +106 -44
  13. package/dist/needle-engine.js +610 -608
  14. package/dist/needle-engine.min.js +1 -1
  15. package/dist/needle-engine.umd.cjs +1 -1
  16. package/dist/three.js +3 -0
  17. package/dist/three.min.js +22 -22
  18. package/dist/three.umd.cjs +24 -24
  19. package/dist/{vendor-BQ2Vuntm.min.js → vendor-2--bD1c9.min.js} +19 -19
  20. package/dist/{vendor-BslSKZPo.js → vendor-BNtcIZkv.js} +1141 -1138
  21. package/dist/{vendor-1UvpPPSB.umd.cjs → vendor-vbe9sv1t.umd.cjs} +20 -20
  22. package/lib/engine/api.d.ts +1 -1
  23. package/lib/engine/api.js +1 -1
  24. package/lib/engine/api.js.map +1 -1
  25. package/lib/engine/engine_context.js +16 -3
  26. package/lib/engine/engine_context.js.map +1 -1
  27. package/lib/engine/engine_init.js +2 -2
  28. package/lib/engine/engine_init.js.map +1 -1
  29. package/lib/engine/engine_license.d.ts +7 -7
  30. package/lib/engine/engine_license.js +72 -72
  31. package/lib/engine/engine_license.js.map +1 -1
  32. package/lib/engine/engine_networking_blob.js +3 -3
  33. package/lib/engine/engine_networking_blob.js.map +1 -1
  34. package/lib/engine/engine_utils_qrcode.js +2 -2
  35. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  36. package/lib/engine/postprocessing/postprocessing.d.ts +2 -1
  37. package/lib/engine/postprocessing/postprocessing.js +3 -2
  38. package/lib/engine/postprocessing/postprocessing.js.map +1 -1
  39. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  40. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +2 -2
  41. package/lib/engine/webcomponents/needle menu/needle-menu.js +9 -9
  42. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  43. package/lib/engine/webcomponents/needle-engine.js +2 -2
  44. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  45. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  46. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  47. package/lib/engine/xr/NeedleXRSession.d.ts +24 -0
  48. package/lib/engine/xr/NeedleXRSession.js +52 -7
  49. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  50. package/lib/engine/xr/TempXRContext.js +2 -2
  51. package/lib/engine/xr/TempXRContext.js.map +1 -1
  52. package/lib/engine/xr/init.js +2 -3
  53. package/lib/engine/xr/init.js.map +1 -1
  54. package/lib/engine-components/Component.js +14 -1
  55. package/lib/engine-components/Component.js.map +1 -1
  56. package/lib/engine-components/ContactShadows.d.ts +7 -2
  57. package/lib/engine-components/ContactShadows.js +65 -45
  58. package/lib/engine-components/ContactShadows.js.map +1 -1
  59. package/lib/engine-components/GroundProjection.d.ts +6 -0
  60. package/lib/engine-components/GroundProjection.js +69 -7
  61. package/lib/engine-components/GroundProjection.js.map +1 -1
  62. package/lib/engine-components/NeedleMenu.d.ts +1 -1
  63. package/lib/engine-components/NeedleMenu.js +5 -2
  64. package/lib/engine-components/NeedleMenu.js.map +1 -1
  65. package/lib/engine-components/SceneSwitcher.d.ts +2 -0
  66. package/lib/engine-components/SceneSwitcher.js +26 -14
  67. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  68. package/lib/engine-components/SeeThrough.d.ts +39 -0
  69. package/lib/engine-components/SeeThrough.js +69 -1
  70. package/lib/engine-components/SeeThrough.js.map +1 -1
  71. package/lib/engine-components/Skybox.js +9 -0
  72. package/lib/engine-components/Skybox.js.map +1 -1
  73. package/lib/engine-components/api.d.ts +1 -0
  74. package/lib/engine-components/api.js +1 -0
  75. package/lib/engine-components/api.js.map +1 -1
  76. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  77. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  78. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +9 -5
  79. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  80. package/lib/engine-components/particlesystem/ParticleSystem.js +4 -0
  81. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  82. package/lib/engine-components/postprocessing/Volume.d.ts +1 -9
  83. package/lib/engine-components/postprocessing/Volume.js +2 -14
  84. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  85. package/lib/engine-components/webxr/WebXRImageTracking.js +3 -0
  86. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  87. package/package.json +4 -4
  88. package/plugins/common/license.js +4 -4
  89. package/plugins/types/userconfig.d.ts +10 -0
  90. package/plugins/vite/build-pipeline.d.ts +19 -0
  91. package/plugins/vite/build-pipeline.js +67 -5
  92. package/plugins/vite/license.js +4 -4
  93. package/src/engine/api.ts +1 -1
  94. package/src/engine/engine_context.ts +15 -2
  95. package/src/engine/engine_gameobject.ts +1 -1
  96. package/src/engine/engine_init.ts +2 -2
  97. package/src/engine/engine_license.ts +69 -69
  98. package/src/engine/engine_networking_blob.ts +3 -3
  99. package/src/engine/engine_utils_qrcode.ts +2 -2
  100. package/src/engine/postprocessing/postprocessing.ts +3 -2
  101. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  102. package/src/engine/webcomponents/needle menu/needle-menu.ts +10 -10
  103. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  104. package/src/engine/webcomponents/needle-engine.ts +2 -2
  105. package/src/engine/xr/NeedleXRSession.ts +53 -7
  106. package/src/engine/xr/TempXRContext.ts +2 -2
  107. package/src/engine/xr/init.ts +2 -3
  108. package/src/engine-components/Component.ts +13 -1
  109. package/src/engine-components/ContactShadows.ts +75 -49
  110. package/src/engine-components/GroundProjection.ts +71 -7
  111. package/src/engine-components/NeedleMenu.ts +6 -3
  112. package/src/engine-components/SceneSwitcher.ts +23 -13
  113. package/src/engine-components/SeeThrough.ts +75 -1
  114. package/src/engine-components/Skybox.ts +8 -0
  115. package/src/engine-components/api.ts +1 -0
  116. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  117. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +12 -5
  118. package/src/engine-components/particlesystem/ParticleSystem.ts +4 -0
  119. package/src/engine-components/postprocessing/Volume.ts +2 -13
  120. package/src/engine-components/webxr/WebXRImageTracking.ts +1 -0
  121. package/dist/gltf-progressive-9tlS5iCx.umd.cjs +0 -10
  122. package/dist/gltf-progressive-CVg80COO.min.js +0 -10
package/CHANGELOG.md CHANGED
@@ -4,6 +4,125 @@ 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] - 2026-06-23
8
+
9
+ ### ⭐ Highlights
10
+
11
+ #### **Scene Bindings — Fully Typed Scenes**
12
+ Your glTF and GLB scenes now come with auto-generated TypeScript types. Access nodes, components, and properties with full autocomplete and type checking via `ctx.sceneData` or the new `needle` shorthand — no configuration required. Types regenerate automatically whenever your scene files change, and it works with local files, remote URLs, and Needle Cloud assets alike.
13
+ ```ts
14
+ const cam = ctx.sceneData.MyScene.MainCamera.$object; // THREE.PerspectiveCamera
15
+ const orbit = ctx.sceneData.MyScene.MainCamera.$components.OrbitControls; // typed!
16
+ orbit.autoRotate = true;
17
+ ```
18
+
19
+ #### **First-Class Framework Support**
20
+ Needle Engine now feels at home in any modern web stack. SSR support lets you import the engine in SvelteKit, Next.js, and Nuxt without crashes, JSX type declarations bring full autocomplete to React, Preact, SolidJS, and friends, and the new `needle` shorthand gives you instant access to the current context from anywhere — components, button handlers, or plain JavaScript.
21
+ ```ts
22
+ import { needle } from "@needle-tools/engine";
23
+ needle.scene.traverse(obj => { ... }); // access the three.js scene
24
+ needle.renderer; // access the WebGLRenderer
25
+ ```
26
+
27
+ #### **Embed Anywhere with `<needle-app>`**
28
+ Drop a published Needle Engine app into any web page with a single element — no build setup, custom code, or framework required. It handles cross-origin loading for you and works inside iframes.
29
+ ```html
30
+ <needle-app src="https://your-app.needle.run"></needle-app>
31
+ ```
32
+
33
+ #### **Animation & Timelines from Code** *(preview)*
34
+ A new set of builder APIs lets you create animations, animator controllers, and timelines entirely in code, with typed keyframes and inline track definitions. Great for procedural content, runtime-generated sequences, and tooling.
35
+ ```ts
36
+ const timeline = TimelineBuilder.create("MyTimeline")
37
+ .animationTrack("Walk", animator).clip(walkClip, { duration: 2 })
38
+ .activationTrack("FX", vfxObject).activate({ start: 1, duration: 0.5 })
39
+ .build();
40
+ director.playableAsset = timeline;
41
+ ```
42
+
43
+ #### **DragControls — A Big Upgrade**
44
+ `DragControls` received a major overhaul with a new constraint system: keep-scale, two-touch scaling with min/max limits, refined hit regions, and a dedicated screen-space drag mode for AR. Single-touch dragging is now more predictable, and reliability is improved across snapping, side views, and multi-input scenarios.
45
+
46
+ #### **MaterialX — Faster & Richer**
47
+ The bundled MaterialX runtime jumps to **1.7.0** with faster environment lighting (new radiance sampling modes and PMREM support), better Three.js integration, and overall performance improvements.
48
+
49
+ #### **Cleaner Component Lifecycles**
50
+ A new `autoCleanup` API and a typed `Context.events` bus make it easy to write components that tidy up after themselves. Many subscription APIs — input, networking, and XR events — now return an unsubscribe function that pairs perfectly with `autoCleanup`.
51
+ ```ts
52
+ onEnable() {
53
+ this.autoCleanup(this.context.input.addEventListener("pointerdown", evt => { ... }));
54
+ this.autoCleanup(this.context.connection.beginListen("my-event", data => { ... }));
55
+ }
56
+ ```
57
+
58
+ **Added**
59
+ - **Scene Bindings** — auto-generated, fully typed access to your scenes via `ctx.sceneData` / `needle.sceneData`
60
+ - **SSR support** for SvelteKit, Next.js, and Nuxt, plus **JSX type declarations** for React, Preact, SolidJS and more
61
+ - **`needle` shorthand** for quick access to the current engine context from anywhere
62
+ - **`<needle-app>`** — embed a published Needle Engine app in any web page ([docs](<https://engine.needle.tools/docs/how-to-guides/deployment/embedding>))
63
+ - **`Context.events`** — a typed event bus for decoupled component communication:
64
+ ```ts
65
+ context.events.on("scene-content-changed", e => console.log(e.object));
66
+ context.events.emit<{ pts: number }>("scored", { pts: 10 });
67
+ ```
68
+ - **`autoCleanup`** on `Behaviour` — register disposables and cleanup tied to the component lifecycle
69
+ - **Builder APIs** *(preview)* — `TimelineBuilder`, `AnimatorControllerBuilder`, and `AnimationBuilder` for defining timelines, controllers, and animations in code with typed keyframes and inline tracks
70
+ - `DragControls`: new constraint system with `keepScale`, two-touch scale limits, refined hit regions, a screen-space AR drag mode, and `EventList` support
71
+ - `Skybox`: new `background-rotation` / `environment-rotation` attributes and `background-image-loaded` / `environment-image-loaded` events
72
+ - `WebXRImageTracking`: per-frame `imageTracked` event with typed access to the tracked object, plus `resetImage` / `resetAllImages` to re-arm markers without restarting XR:
73
+ ```ts
74
+ imageTracking.imageTracked.addEventListener(evt => console.log(evt.object, evt.image));
75
+ ```
76
+ - `AudioClip` type with standalone playback control, `AudioSource` spatial blend and `.opus` support
77
+ - `context.lights` array and `context.mainLight` getter for quick access to scene lighting
78
+ - `NeedleXRSession.appClipUrl` — launch a custom-branded Needle AppClip experience on iOS AR (provide your registered `appclip.needle.tools/x/…` URL or experience id) for your own App Clip card title and image
79
+ - Physics raycast `includeTriggers` option
80
+ - Unsubscribe functions returned from `Input`, `Networking`, and XR event subscriptions
81
+ - `needlePlugins()` can now be called without arguments — the Vite command is resolved automatically:
82
+ ```js
83
+ export default defineConfig({ plugins: [sveltekit(), needlePlugins()] });
84
+ ```
85
+
86
+ **Changed**
87
+ - `OrbitControls` now uses `lookAtTarget` / `lockLookAtTarget`, with smoother focus and camera transitions
88
+ - Postprocessing moved to core (`context.postprocessing`); tonemapping-only setups skip the extra pass
89
+ - Timeline track classes renamed for consistency (e.g. `AnimationTrackHandler` → `TimelineAnimationTrack`)
90
+ - `GroundProjectionEnv.applyOnAwake` now defaults to `true`, matching Unity and Blender
91
+
92
+ **Fixed & Improved**
93
+ - Major `DragControls` reliability improvements across snap points, AR drag, side views, and multi-input handover
94
+ - More reliable camera handling (fallback camera, `fitCamera`, scene clearing)
95
+ - More efficient `Skybox` attribute handling and load deduplication
96
+ - Smoother, more reliable progressive LOD loading and disposal, including texture-only LODs that update correctly with camera distance
97
+ - `AudioSource` on iOS now survives a device lock / audio-session interruption and resumes automatically
98
+ - `SceneSwitcher`: `?scene=` honored for in-scene object references, with prefab preview support
99
+ - `VoIP` improvements including better iOS mic handling and shared `AudioContext`
100
+ - Faster initial loading via improved dependency chunking
101
+ - Updated MaterialX runtime to **1.7.0** with faster environment lighting and PMREM support
102
+ - General reliability and stability improvements throughout the engine and Vite plugin
103
+
104
+ ## [5.1.0-beta.1] - 2026-06-09
105
+
106
+ **Fixed**
107
+ - Progressive loading: texture LODs no longer get stuck for meshes that only have texture LODs (no mesh LODs); screen coverage is computed unconditionally again so texture LODs update with camera distance
108
+
109
+ ## [5.1.0-alpha.9] - 2026-06-04
110
+
111
+ **Added**
112
+ - `<needle-app>` — embed a published Needle Engine app in any web page (with custom code etc) ([docs](<https://engine.needle.tools/docs/how-to-guides/deployment/embedding>))
113
+
114
+ **Changed**
115
+ - `<needle-app>`: improved cross-origin handling and `src` parsing
116
+ - `ScrollFollow`: now works inside an iframe (uses the top window)
117
+
118
+ **Fixed**
119
+ - iOS audio: `AudioSource` playback now survives a device lock / audio-session interruption and resumes automatically on unlock
120
+ - `SceneSwitcher`: `?scene=` is now honored for scenes referenced as in-scene `Object3D`s; scene preview loading supports prefabs and correct parenting under the SceneSwitcher
121
+ - `DragControls`: widened the two-pointer scale clamp range and now reads world scale from the matrix columns
122
+ - `EventList`: corrected the arguments passed to overridden methods
123
+ - `serializeObject`: fixed `Color` / `Euler` / object-reference serialization, and `OneEuroFilter.reset()`
124
+ - Prevented a `TypeError` when a scene-data error proxy is coerced to a string
125
+
7
126
  ## [5.1.0-alpha.7] - 2026-05-29
8
127
 
9
128
  **Highlights:**