@needle-tools/engine 5.1.0-canary.30cc545 → 5.1.0-canary.40da791

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 (341) hide show
  1. package/.needle/generated/needle-bindings.gen.d.ts +5 -0
  2. package/CHANGELOG.md +91 -0
  3. package/SKILL.md +4 -1
  4. package/components.needle.json +1 -1
  5. package/dist/{needle-engine.bundle-d_9mSxN4.js → needle-engine.bundle-Cu2B9CsR.js} +16112 -15269
  6. package/dist/needle-engine.bundle-ZoVUaB89.umd.cjs +1733 -0
  7. package/dist/needle-engine.bundle-hBWUJPxm.min.js +1733 -0
  8. package/dist/needle-engine.d.ts +1527 -384
  9. package/dist/needle-engine.js +573 -569
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/dist/three.js +1 -0
  13. package/dist/three.min.js +21 -21
  14. package/dist/three.umd.cjs +16 -16
  15. package/lib/engine/api.d.ts +8 -1
  16. package/lib/engine/api.js +6 -0
  17. package/lib/engine/api.js.map +1 -1
  18. package/lib/engine/codegen/register_types.js +10 -18
  19. package/lib/engine/codegen/register_types.js.map +1 -1
  20. package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
  21. package/lib/engine/debug/debug_spatial_console.js +10 -7
  22. package/lib/engine/debug/debug_spatial_console.js.map +1 -1
  23. package/lib/engine/engine_addressables.d.ts +2 -0
  24. package/lib/engine/engine_addressables.js +6 -3
  25. package/lib/engine/engine_addressables.js.map +1 -1
  26. package/lib/engine/engine_audio.d.ts +68 -0
  27. package/lib/engine/engine_audio.js +172 -0
  28. package/lib/engine/engine_audio.js.map +1 -1
  29. package/lib/engine/engine_camera.fit.js +16 -4
  30. package/lib/engine/engine_camera.fit.js.map +1 -1
  31. package/lib/engine/engine_components.js +1 -1
  32. package/lib/engine/engine_components.js.map +1 -1
  33. package/lib/engine/engine_context.d.ts +41 -27
  34. package/lib/engine/engine_context.js +57 -30
  35. package/lib/engine/engine_context.js.map +1 -1
  36. package/lib/engine/engine_context_eventbus.d.ts +47 -0
  37. package/lib/engine/engine_context_eventbus.js +47 -0
  38. package/lib/engine/engine_context_eventbus.js.map +1 -0
  39. package/lib/engine/engine_disposable.d.ts +172 -0
  40. package/lib/engine/engine_disposable.js +136 -0
  41. package/lib/engine/engine_disposable.js.map +1 -0
  42. package/lib/engine/engine_gameobject.d.ts +1 -10
  43. package/lib/engine/engine_gameobject.js +22 -120
  44. package/lib/engine/engine_gameobject.js.map +1 -1
  45. package/lib/engine/engine_gltf_builtin_components.js +7 -69
  46. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  47. package/lib/engine/engine_init.js +16 -1
  48. package/lib/engine/engine_init.js.map +1 -1
  49. package/lib/engine/engine_input.d.ts +24 -5
  50. package/lib/engine/engine_input.js +3 -2
  51. package/lib/engine/engine_input.js.map +1 -1
  52. package/lib/engine/engine_instantiate_resolve.d.ts +42 -0
  53. package/lib/engine/engine_instantiate_resolve.js +372 -0
  54. package/lib/engine/engine_instantiate_resolve.js.map +1 -0
  55. package/lib/engine/engine_license.d.ts +2 -0
  56. package/lib/engine/engine_license.js +14 -6
  57. package/lib/engine/engine_license.js.map +1 -1
  58. package/lib/engine/engine_lifecycle_functions_internal.js +5 -0
  59. package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
  60. package/lib/engine/engine_mainloop_utils.js +7 -4
  61. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  62. package/lib/engine/engine_networking.d.ts +51 -37
  63. package/lib/engine/engine_networking.js +132 -82
  64. package/lib/engine/engine_networking.js.map +1 -1
  65. package/lib/engine/engine_networking.transport.websocket.d.ts +15 -0
  66. package/lib/engine/engine_networking.transport.websocket.js +38 -0
  67. package/lib/engine/engine_networking.transport.websocket.js.map +1 -0
  68. package/lib/engine/engine_networking_blob.js +1 -1
  69. package/lib/engine/engine_networking_blob.js.map +1 -1
  70. package/lib/engine/engine_networking_instantiate.js +2 -2
  71. package/lib/engine/engine_networking_instantiate.js.map +1 -1
  72. package/lib/engine/engine_networking_types.d.ts +39 -1
  73. package/lib/engine/engine_networking_types.js +7 -0
  74. package/lib/engine/engine_networking_types.js.map +1 -1
  75. package/lib/engine/engine_physics_rapier.d.ts +21 -3
  76. package/lib/engine/engine_physics_rapier.js +94 -25
  77. package/lib/engine/engine_physics_rapier.js.map +1 -1
  78. package/lib/engine/engine_scenedata.d.ts +13 -17
  79. package/lib/engine/engine_scenedata.js +58 -31
  80. package/lib/engine/engine_scenedata.js.map +1 -1
  81. package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
  82. package/lib/engine/engine_serialization_builtin_serializer.js +56 -46
  83. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  84. package/lib/engine/engine_serialization_core.d.ts +1 -0
  85. package/lib/engine/engine_serialization_core.js +7 -0
  86. package/lib/engine/engine_serialization_core.js.map +1 -1
  87. package/lib/engine/engine_ssr.d.ts +2 -0
  88. package/lib/engine/engine_ssr.js +2 -0
  89. package/lib/engine/engine_ssr.js.map +1 -1
  90. package/lib/engine/engine_types.d.ts +31 -11
  91. package/lib/engine/engine_types.js +1 -1
  92. package/lib/engine/engine_types.js.map +1 -1
  93. package/lib/engine/engine_util_decorator.js +7 -2
  94. package/lib/engine/engine_util_decorator.js.map +1 -1
  95. package/lib/engine/engine_utils.d.ts +1 -1
  96. package/lib/engine/engine_utils.js +19 -5
  97. package/lib/engine/engine_utils.js.map +1 -1
  98. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  99. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
  100. package/lib/engine/webcomponents/jsx.d.ts +51 -0
  101. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  102. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +3 -4
  103. package/lib/engine/webcomponents/needle menu/needle-menu.js +1 -1
  104. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  105. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  106. package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
  107. package/lib/engine/webcomponents/needle-engine.js +1 -1
  108. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  109. package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
  110. package/lib/engine/xr/NeedleXRSession.js +50 -14
  111. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  112. package/lib/engine/xr/events.d.ts +1 -1
  113. package/lib/engine/xr/events.js.map +1 -1
  114. package/lib/engine-components/Animation.js +17 -16
  115. package/lib/engine-components/Animation.js.map +1 -1
  116. package/lib/engine-components/AnimationBuilder.d.ts +158 -0
  117. package/lib/engine-components/AnimationBuilder.js +305 -0
  118. package/lib/engine-components/AnimationBuilder.js.map +1 -0
  119. package/lib/engine-components/Animator.d.ts +6 -0
  120. package/lib/engine-components/Animator.js +23 -13
  121. package/lib/engine-components/Animator.js.map +1 -1
  122. package/lib/engine-components/AnimatorController.builder.d.ts +191 -0
  123. package/lib/engine-components/AnimatorController.builder.js +263 -0
  124. package/lib/engine-components/AnimatorController.builder.js.map +1 -0
  125. package/lib/engine-components/AnimatorController.d.ts +4 -119
  126. package/lib/engine-components/AnimatorController.js +37 -233
  127. package/lib/engine-components/AnimatorController.js.map +1 -1
  128. package/lib/engine-components/AudioSource.d.ts +19 -3
  129. package/lib/engine-components/AudioSource.js +121 -68
  130. package/lib/engine-components/AudioSource.js.map +1 -1
  131. package/lib/engine-components/Collider.d.ts +18 -9
  132. package/lib/engine-components/Collider.js +61 -14
  133. package/lib/engine-components/Collider.js.map +1 -1
  134. package/lib/engine-components/Component.d.ts +72 -9
  135. package/lib/engine-components/Component.js +114 -10
  136. package/lib/engine-components/Component.js.map +1 -1
  137. package/lib/engine-components/ContactShadows.d.ts +1 -0
  138. package/lib/engine-components/ContactShadows.js +14 -1
  139. package/lib/engine-components/ContactShadows.js.map +1 -1
  140. package/lib/engine-components/DragControls.d.ts +7 -0
  141. package/lib/engine-components/DragControls.js +19 -7
  142. package/lib/engine-components/DragControls.js.map +1 -1
  143. package/lib/engine-components/DropListener.js +3 -0
  144. package/lib/engine-components/DropListener.js.map +1 -1
  145. package/lib/engine-components/EventList.d.ts +31 -9
  146. package/lib/engine-components/EventList.js +37 -76
  147. package/lib/engine-components/EventList.js.map +1 -1
  148. package/lib/engine-components/Joints.d.ts +4 -2
  149. package/lib/engine-components/Joints.js +19 -3
  150. package/lib/engine-components/Joints.js.map +1 -1
  151. package/lib/engine-components/Light.d.ts +6 -8
  152. package/lib/engine-components/Light.js +48 -27
  153. package/lib/engine-components/Light.js.map +1 -1
  154. package/lib/engine-components/Networking.d.ts +1 -1
  155. package/lib/engine-components/Networking.js +1 -1
  156. package/lib/engine-components/OrbitControls.d.ts +0 -2
  157. package/lib/engine-components/OrbitControls.js +30 -12
  158. package/lib/engine-components/OrbitControls.js.map +1 -1
  159. package/lib/engine-components/ReflectionProbe.js +2 -0
  160. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  161. package/lib/engine-components/RigidBody.d.ts +12 -4
  162. package/lib/engine-components/RigidBody.js +18 -4
  163. package/lib/engine-components/RigidBody.js.map +1 -1
  164. package/lib/engine-components/SceneSwitcher.js +3 -0
  165. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  166. package/lib/engine-components/SeeThrough.js +2 -2
  167. package/lib/engine-components/SeeThrough.js.map +1 -1
  168. package/lib/engine-components/api.d.ts +2 -1
  169. package/lib/engine-components/api.js +2 -1
  170. package/lib/engine-components/api.js.map +1 -1
  171. package/lib/engine-components/codegen/components.d.ts +7 -13
  172. package/lib/engine-components/codegen/components.js +7 -13
  173. package/lib/engine-components/codegen/components.js.map +1 -1
  174. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  175. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
  176. package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
  177. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  178. package/lib/engine-components/timeline/PlayableDirector.d.ts +21 -11
  179. package/lib/engine-components/timeline/PlayableDirector.js +75 -67
  180. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  181. package/lib/engine-components/timeline/SignalAsset.d.ts +3 -1
  182. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  183. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  184. package/lib/engine-components/timeline/TimelineBuilder.d.ts +413 -0
  185. package/lib/engine-components/timeline/TimelineBuilder.js +506 -0
  186. package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -0
  187. package/lib/engine-components/timeline/TimelineModels.d.ts +2 -1
  188. package/lib/engine-components/timeline/TimelineModels.js +3 -0
  189. package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
  190. package/lib/engine-components/timeline/TimelineTracks.d.ts +37 -6
  191. package/lib/engine-components/timeline/TimelineTracks.js +92 -26
  192. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  193. package/lib/engine-components/timeline/index.d.ts +2 -1
  194. package/lib/engine-components/timeline/index.js +2 -0
  195. package/lib/engine-components/timeline/index.js.map +1 -1
  196. package/lib/engine-components/ui/Canvas.d.ts +1 -1
  197. package/lib/engine-components/ui/Canvas.js +2 -8
  198. package/lib/engine-components/ui/Canvas.js.map +1 -1
  199. package/lib/engine-components/ui/Text.d.ts +1 -0
  200. package/lib/engine-components/ui/Text.js +10 -7
  201. package/lib/engine-components/ui/Text.js.map +1 -1
  202. package/lib/engine-components/web/CursorFollow.d.ts +0 -1
  203. package/lib/engine-components/web/CursorFollow.js +21 -13
  204. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  205. package/lib/engine-components/webxr/WebXRImageTracking.js +4 -0
  206. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  207. package/lib/needle-engine.d.ts +2 -0
  208. package/lib/needle-engine.js +2 -0
  209. package/lib/needle-engine.js.map +1 -1
  210. package/package.json +3 -83
  211. package/plugins/common/license.js +5 -2
  212. package/plugins/common/worker.js +9 -4
  213. package/plugins/dts-generator/dts.codegen.js +255 -50
  214. package/plugins/dts-generator/dts.scan.js +37 -9
  215. package/plugins/dts-generator/dts.writer.js +1 -1
  216. package/plugins/dts-generator/glb.discovery.js +140 -23
  217. package/plugins/dts-generator/glb.extractor.js +48 -8
  218. package/plugins/dts-generator/glb.reader.js +80 -27
  219. package/plugins/dts-generator/index.js +1 -1
  220. package/plugins/types/needle-bindings.d.ts +25 -14
  221. package/plugins/types/userconfig.d.ts +12 -0
  222. package/plugins/vite/asap.js +18 -9
  223. package/plugins/vite/dependencies.js +29 -10
  224. package/plugins/vite/dependency-watcher.d.ts +2 -2
  225. package/plugins/vite/dependency-watcher.js +5 -6
  226. package/plugins/vite/drop.d.ts +2 -2
  227. package/plugins/vite/drop.js +3 -4
  228. package/plugins/vite/dts-generator.d.ts +2 -2
  229. package/plugins/vite/dts-generator.js +43 -9
  230. package/plugins/vite/editor-connection.js +3 -3
  231. package/plugins/vite/index.d.ts +9 -3
  232. package/plugins/vite/index.js +23 -10
  233. package/plugins/vite/license.js +19 -1
  234. package/plugins/vite/local-files-core.js +3 -3
  235. package/plugins/vite/local-files-utils.d.ts +3 -1
  236. package/plugins/vite/local-files-utils.js +29 -5
  237. package/plugins/vite/meta.js +4 -2
  238. package/plugins/vite/poster.d.ts +2 -2
  239. package/plugins/vite/poster.js +3 -5
  240. package/plugins/vite/reload.d.ts +2 -2
  241. package/plugins/vite/reload.js +23 -23
  242. package/plugins/vite/server.js +2 -1
  243. package/src/engine/api.ts +11 -1
  244. package/src/engine/codegen/register_types.ts +10 -18
  245. package/src/engine/debug/debug_spatial_console.ts +10 -7
  246. package/src/engine/engine_addressables.ts +6 -3
  247. package/src/engine/engine_audio.ts +184 -0
  248. package/src/engine/engine_camera.fit.ts +15 -4
  249. package/src/engine/engine_components.ts +1 -1
  250. package/src/engine/engine_context.ts +67 -37
  251. package/src/engine/engine_context_eventbus.ts +73 -0
  252. package/src/engine/engine_disposable.ts +214 -0
  253. package/src/engine/engine_gameobject.ts +54 -159
  254. package/src/engine/engine_gltf_builtin_components.ts +7 -76
  255. package/src/engine/engine_init.ts +15 -1
  256. package/src/engine/engine_input.ts +28 -7
  257. package/src/engine/engine_instantiate_resolve.ts +407 -0
  258. package/src/engine/engine_license.ts +12 -10
  259. package/src/engine/engine_lifecycle_functions_internal.ts +7 -0
  260. package/src/engine/engine_mainloop_utils.ts +7 -4
  261. package/src/engine/engine_networking.transport.websocket.ts +45 -0
  262. package/src/engine/engine_networking.ts +161 -137
  263. package/src/engine/engine_networking_blob.ts +1 -1
  264. package/src/engine/engine_networking_instantiate.ts +2 -2
  265. package/src/engine/engine_networking_types.ts +41 -1
  266. package/src/engine/engine_physics_rapier.ts +102 -33
  267. package/src/engine/engine_scenedata.ts +56 -30
  268. package/src/engine/engine_serialization_builtin_serializer.ts +64 -52
  269. package/src/engine/engine_serialization_core.ts +9 -0
  270. package/src/engine/engine_ssr.ts +3 -0
  271. package/src/engine/engine_types.ts +48 -27
  272. package/src/engine/engine_util_decorator.ts +7 -2
  273. package/src/engine/engine_utils.ts +16 -5
  274. package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  275. package/src/engine/webcomponents/jsx.d.ts +51 -0
  276. package/src/engine/webcomponents/logo-element.ts +1 -0
  277. package/src/engine/webcomponents/needle menu/needle-menu.ts +3 -2
  278. package/src/engine/webcomponents/needle-button.ts +1 -0
  279. package/src/engine/webcomponents/needle-engine.ts +11 -4
  280. package/src/engine/xr/NeedleXRSession.ts +48 -13
  281. package/src/engine/xr/events.ts +1 -1
  282. package/src/engine-components/Animation.ts +19 -16
  283. package/src/engine-components/AnimationBuilder.ts +472 -0
  284. package/src/engine-components/Animator.ts +24 -12
  285. package/src/engine-components/AnimatorController.builder.ts +387 -0
  286. package/src/engine-components/AnimatorController.ts +24 -292
  287. package/src/engine-components/AudioSource.ts +130 -79
  288. package/src/engine-components/Collider.ts +66 -18
  289. package/src/engine-components/Component.ts +118 -20
  290. package/src/engine-components/ContactShadows.ts +15 -1
  291. package/src/engine-components/DragControls.ts +18 -11
  292. package/src/engine-components/DropListener.ts +3 -0
  293. package/src/engine-components/EventList.ts +45 -83
  294. package/src/engine-components/Joints.ts +20 -4
  295. package/src/engine-components/Light.ts +49 -27
  296. package/src/engine-components/Networking.ts +1 -1
  297. package/src/engine-components/OrbitControls.ts +34 -14
  298. package/src/engine-components/ReflectionProbe.ts +2 -0
  299. package/src/engine-components/RigidBody.ts +18 -4
  300. package/src/engine-components/SceneSwitcher.ts +3 -0
  301. package/src/engine-components/SeeThrough.ts +2 -2
  302. package/src/engine-components/api.ts +2 -1
  303. package/src/engine-components/codegen/components.ts +7 -13
  304. package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
  305. package/src/engine-components/timeline/PlayableDirector.ts +83 -81
  306. package/src/engine-components/timeline/SignalAsset.ts +4 -1
  307. package/src/engine-components/timeline/TimelineBuilder.ts +824 -0
  308. package/src/engine-components/timeline/TimelineModels.ts +5 -1
  309. package/src/engine-components/timeline/TimelineTracks.ts +96 -27
  310. package/src/engine-components/timeline/index.ts +2 -1
  311. package/src/engine-components/ui/Canvas.ts +2 -8
  312. package/src/engine-components/ui/Text.ts +12 -8
  313. package/src/engine-components/web/CursorFollow.ts +21 -14
  314. package/src/engine-components/webxr/WebXRImageTracking.ts +2 -0
  315. package/src/needle-engine.ts +3 -0
  316. package/dist/needle-engine.bundle-BMlLSACE.umd.cjs +0 -1732
  317. package/dist/needle-engine.bundle-BXPPQRer.min.js +0 -1732
  318. package/lib/engine-components/AvatarLoader.d.ts +0 -80
  319. package/lib/engine-components/AvatarLoader.js +0 -232
  320. package/lib/engine-components/AvatarLoader.js.map +0 -1
  321. package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +0 -11
  322. package/lib/engine-components/avatar/AvatarBlink_Simple.js +0 -77
  323. package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +0 -1
  324. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +0 -14
  325. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +0 -69
  326. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +0 -1
  327. package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +0 -29
  328. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +0 -122
  329. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +0 -1
  330. package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +0 -15
  331. package/lib/engine-components/avatar/Avatar_MouthShapes.js +0 -80
  332. package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +0 -1
  333. package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +0 -9
  334. package/lib/engine-components/avatar/Avatar_MustacheShake.js +0 -30
  335. package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +0 -1
  336. package/src/engine-components/AvatarLoader.ts +0 -264
  337. package/src/engine-components/avatar/AvatarBlink_Simple.ts +0 -70
  338. package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +0 -64
  339. package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +0 -140
  340. package/src/engine-components/avatar/Avatar_MouthShapes.ts +0 -84
  341. package/src/engine-components/avatar/Avatar_MustacheShake.ts +0 -32
@@ -40,11 +40,13 @@ import { GLTFLoader } from '../../../node_modules/@types/three/examples/jsm/load
40
40
  import { GLTFLoaderPlugin } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
41
41
  import { GLTFParser } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
42
42
  import { Group } from 'three';
43
+ import { ImpulseJoint } from '@dimforge/rapier3d-compat';
43
44
  import { InstancedMesh } from 'three';
44
45
  import { Intersection } from 'three';
45
46
  import { IParticleSystem as IParticleSystem_2 } from 'three.quarks';
46
47
  import { KeyframeTrack } from 'three';
47
48
  import { Layers } from 'three';
49
+ import { Light as Light_2 } from 'three';
48
50
  import { LightProbe } from 'three';
49
51
  import { Line2 } from '../../../../node_modules/@types/three/examples/jsm/lines/Line2.js';
50
52
  import { Loader } from 'three';
@@ -254,6 +256,31 @@ export declare class ActionModel implements IBehaviorElement {
254
256
  writeTo(document: USDDocument, writer: USDWriter): void;
255
257
  }
256
258
 
259
+ /**
260
+ * Options for an activation clip in the timeline builder
261
+ */
262
+ export declare type ActivationClipOptions = {
263
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
264
+ start?: number;
265
+ /** Duration of the clip in seconds (required) */
266
+ duration: number;
267
+ /** Ease-in duration in seconds (default: 0) */
268
+ easeIn?: number;
269
+ /** Ease-out duration in seconds (default: 0) */
270
+ easeOut?: number;
271
+ };
272
+
273
+ /**
274
+ * Builder for activation tracks. Provides `.clip()` for defining activation windows.
275
+ * @category Animation and Sequencing
276
+ */
277
+ export declare interface ActivationTrackBuilder extends TimelineBuilderBase {
278
+ /** Adds an activation clip that shows/hides the bound object */
279
+ clip(options: ActivationClipOptions): ActivationTrackBuilder;
280
+ /** Mutes this track so it is skipped during playback */
281
+ muted(muted?: boolean): ActivationTrackBuilder;
282
+ }
283
+
257
284
  export declare const activeInHierarchyFieldName = "needle_isActiveInHierarchy";
258
285
 
259
286
  /**
@@ -487,6 +514,62 @@ declare class Animation_2 extends Component implements IAnimationComponent {
487
514
  }
488
515
  export { Animation_2 as Animation }
489
516
 
517
+ /**
518
+ * A fluent builder for creating `AnimationClip` instances from code.
519
+ *
520
+ * Use {@link AnimationBuilder.create} to start a new builder, chain `.track()` calls
521
+ * to add animation tracks, and call `.build()` to produce the clip.
522
+ *
523
+ * @example Single track
524
+ * ```ts
525
+ * const clip = AnimationBuilder.create()
526
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
527
+ * .build();
528
+ * ```
529
+ *
530
+ * @example Multiple tracks
531
+ * ```ts
532
+ * const clip = AnimationBuilder.create("DoorOpen")
533
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
534
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
535
+ * .build(room);
536
+ * ```
537
+ *
538
+ * @category Animation and Sequencing
539
+ * @group Utilities
540
+ */
541
+ export declare class AnimationBuilder {
542
+ private _name?;
543
+ private _tracks;
544
+ /** Creates a new AnimationBuilder instance */
545
+ static create(name?: string): AnimationBuilder;
546
+ constructor(name?: string);
547
+ /** Adds an animation track for an Object3D's position or scale */
548
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_2<Vec3Value>, options?: TrackOptions): this;
549
+ /** Adds an animation track for an Object3D's quaternion */
550
+ track(target: Object3D, property: "quaternion", keyframes: KF_2<QuatValue>, options?: TrackOptions): this;
551
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
552
+ track(target: Object3D, property: "rotation", keyframes: KF_2<EulerValue>, options?: TrackOptions): this;
553
+ /** Adds an animation track for an Object3D's visibility */
554
+ track(target: Object3D, property: "visible", keyframes: KF_2<boolean>, options?: TrackOptions): this;
555
+ /** Adds an animation track for a material's numeric property */
556
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_2<number>, options?: TrackOptions): this;
557
+ /** Adds an animation track for a material's color property */
558
+ track(target: Material, property: "color" | "emissive", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
559
+ /** Adds an animation track for a light's numeric property */
560
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_2<number>, options?: TrackOptions): this;
561
+ /** Adds an animation track for a light's color */
562
+ track(target: Light_2, property: "color", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
563
+ /** Adds an animation track for a camera's numeric property */
564
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_2<number>, options?: TrackOptions): this;
565
+ /**
566
+ * Builds and returns the `AnimationClip`.
567
+ * @param root - Optional root Object3D for resolving track paths.
568
+ * When provided, tracks targeting a different object use `target.name` for named resolution.
569
+ */
570
+ build(root?: Object3D): AnimationClip;
571
+ }
572
+
490
573
  /**
491
574
  * @category Animation and Sequencing
492
575
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -500,6 +583,34 @@ export declare type AnimationClipModel = {
500
583
  rotation?: Quat | Quaternion;
501
584
  };
502
585
 
586
+ /**
587
+ * Options for an animation clip in the timeline builder
588
+ */
589
+ export declare type AnimationClipOptions = {
590
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
591
+ start?: number;
592
+ /** Duration of the clip in seconds. Defaults to the animation clip duration. */
593
+ duration?: number;
594
+ /** Playback speed multiplier (default: 1) */
595
+ speed?: number;
596
+ /** Whether the animation should loop within the clip (default: false) */
597
+ loop?: boolean;
598
+ /** Ease-in duration in seconds (default: 0) */
599
+ easeIn?: number;
600
+ /** Ease-out duration in seconds (default: 0) */
601
+ easeOut?: number;
602
+ /** Offset into the source animation clip in seconds (default: 0) */
603
+ clipIn?: number;
604
+ /** Whether to remove the start offset of the animation (default: false) */
605
+ removeStartOffset?: boolean;
606
+ /** Pre-extrapolation mode (default: None) */
607
+ preExtrapolation?: ClipExtrapolation;
608
+ /** Post-extrapolation mode (default: None) */
609
+ postExtrapolation?: ClipExtrapolation;
610
+ /** Play the clip in reverse */
611
+ reversed?: boolean;
612
+ };
613
+
503
614
  /**
504
615
  * AnimationCurve is a representation of a curve that can be used to animate values over time.
505
616
  *
@@ -577,6 +688,19 @@ export declare class AnimationExtension implements IUSDExporterExtension {
577
688
 
578
689
  declare type AnimationIdentifier = AnimationClip | number | string | undefined;
579
690
 
691
+ /** User-friendly interpolation mode names */
692
+ export declare type AnimationInterpolation = "linear" | "smooth" | "step";
693
+
694
+ /** A single keyframe: a time and a value */
695
+ export declare type AnimationKeyframe<V> = {
696
+ /** Time in seconds */
697
+ time: number;
698
+ /** The value at this time */
699
+ value: V;
700
+ /** Interpolation mode for this track (default: `"linear"`). Note: Three.js applies one mode per track; the first keyframe's mode is used. */
701
+ interpolation?: AnimationInterpolation;
702
+ };
703
+
580
704
  /**
581
705
  * Registry for animation related data. Use {@link registerAnimationMixer} to register an animation mixer instance.
582
706
  * Can be accessed from {@link Context.animations} and is used internally e.g. when exporting GLTF files.
@@ -597,43 +721,39 @@ declare class AnimationsRegistry {
597
721
  unregisterAnimationMixer(mixer: AnimationMixer | null | undefined): void;
598
722
  }
599
723
 
600
- export declare class AnimationTrackHandler extends TrackHandler {
601
- /* Excluded from this release type: models */
602
- /* Excluded from this release type: trackOffset */
603
- /** The object that is being animated. */
604
- target?: Object3D;
605
- /** The AnimationMixer, should be shared with the animator if an animator is bound */
606
- mixer?: AnimationMixer;
607
- clips: Array<AnimationClip>;
608
- actions: Array<AnimationAction>;
609
- /**
610
- * You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
611
- * @default 1
612
- */
613
- weight: number;
614
- /** holds data/info about clips differences */
615
- private _actionOffsets;
616
- private _didBind;
617
- private _animator;
618
- onDisable(): void;
619
- onDestroy(): void;
620
- onStateChanged(): void;
621
- createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
622
- bind(): void;
623
- private ensureTrackOffsets;
624
- private _useclipOffsets;
625
- private _totalOffsetPosition;
626
- private _totalOffsetRotation;
627
- private _totalOffsetPosition2;
628
- private _totalOffsetRotation2;
629
- private _summedPos;
630
- private _tempPos;
631
- private _summedRot;
632
- private _tempRot;
633
- private _clipRotQuat;
634
- evaluate(time: number): void;
635
- private createRotationInterpolant;
636
- private createPositionInterpolant;
724
+ /**
725
+ * Builder for animation tracks.
726
+ * Provides `.clip()` for pre-built AnimationClips and `.track()` for inline animation definition.
727
+ *
728
+ * @category Animation and Sequencing
729
+ */
730
+ export declare interface AnimationTrackBuilder extends TimelineBuilderBase {
731
+ /** Adds a pre-built AnimationClip */
732
+ clip(asset: AnimationClip, options?: AnimationClipOptions): AnimationTrackBuilder;
733
+ /** Adds a clip from a single {@link TrackDescriptor} */
734
+ clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): AnimationTrackBuilder;
735
+ /** Adds a clip from multiple {@link TrackDescriptor}s */
736
+ clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): AnimationTrackBuilder;
737
+ /** Adds an animation track for an Object3D's position or scale */
738
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): AnimationTrackBuilder;
739
+ /** Adds an animation track for an Object3D's quaternion */
740
+ track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): AnimationTrackBuilder;
741
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
742
+ track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): AnimationTrackBuilder;
743
+ /** Adds an animation track for an Object3D's visibility */
744
+ track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): AnimationTrackBuilder;
745
+ /** Adds an animation track for a material's numeric property */
746
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
747
+ /** Adds an animation track for a material's color property */
748
+ track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
749
+ /** Adds an animation track for a light's numeric property */
750
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
751
+ /** Adds an animation track for a light's color */
752
+ track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
753
+ /** Adds an animation track for a camera's numeric property */
754
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
755
+ /** Mutes this track so it is skipped during playback */
756
+ muted(muted?: boolean): AnimationTrackBuilder;
637
757
  }
638
758
 
639
759
  declare class AnimationTriggers {
@@ -726,6 +846,12 @@ export declare class Animator extends Component implements IAnimationComponent {
726
846
  * Identifies this component as an animation component in the engine
727
847
  */
728
848
  get isAnimationComponent(): boolean;
849
+ /**
850
+ * The current animator mixer, used for low-level control of animations. Owned by the AnimatorController
851
+ * @returns The current AnimationMixer, or null if no controller is assigned
852
+ * @see AnimatorController.mixer
853
+ */
854
+ get mixer(): AnimationMixer | null;
729
855
  /**
730
856
  * When enabled, animation will affect the root transform position and rotation
731
857
  */
@@ -1102,13 +1228,6 @@ export declare class AnimatorController {
1102
1228
  * @param animator - The animator to bind this controller to
1103
1229
  */
1104
1230
  bind(animator: Animator): void;
1105
- /**
1106
- * Creates a deep copy of this controller.
1107
- * Clones the model data but does not copy runtime state.
1108
- *
1109
- * @returns A new AnimatorController instance with the same configuration
1110
- */
1111
- clone(): AnimatorController | null;
1112
1231
  /**
1113
1232
  * Updates the controller's state machine and animations.
1114
1233
  * Called each frame by the animator component.
@@ -1151,11 +1270,15 @@ export declare class AnimatorController {
1151
1270
  /**
1152
1271
  * A fluent builder for creating {@link AnimatorController} instances from code.
1153
1272
  *
1154
- * Use {@link AnimatorController.build} to create a new builder.
1273
+ * Use {@link AnimatorControllerBuilder.create} or {@link AnimatorController.build} to create a new builder.
1155
1274
  *
1156
- * @example
1275
+ * The builder tracks state names and parameter types through the fluent chain,
1276
+ * providing autocomplete for state names in `.transition()` and type-aware
1277
+ * `.condition()` calls (e.g., trigger parameters don't require a mode argument).
1278
+ *
1279
+ * @example With pre-built AnimationClips
1157
1280
  * ```ts
1158
- * const controller = AnimatorController.build("CharacterController")
1281
+ * const controller = AnimatorControllerBuilder.create("CharacterController")
1159
1282
  * .floatParameter("Speed", 0)
1160
1283
  * .triggerParameter("Jump")
1161
1284
  * .state("Idle", { clip: idleClip, loop: true })
@@ -1166,36 +1289,70 @@ export declare class AnimatorController {
1166
1289
  * .transition("Walk", "Idle", { duration: 0.25 })
1167
1290
  * .condition("Speed", "less", 0.1)
1168
1291
  * .transition("*", "Jump", { duration: 0.1 })
1169
- * .condition("Jump", "if")
1292
+ * .condition("Jump")
1170
1293
  * .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
1171
1294
  * .build();
1172
1295
  * ```
1173
1296
  *
1297
+ * @example With inline tracks (no pre-built clips needed)
1298
+ * ```ts
1299
+ * const controller = AnimatorControllerBuilder.create("Door")
1300
+ * .boolParameter("Open", false)
1301
+ * .state("Closed", { loop: true })
1302
+ * .track(door, "position", { from: [0, 0, 0], to: [0, 0, 0], duration: 1 })
1303
+ * .state("Open", { loop: true })
1304
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
1305
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
1306
+ * .transition("Closed", "Open", { duration: 0.25 })
1307
+ * .condition("Open", "if")
1308
+ * .transition("Open", "Closed", { duration: 0.25 })
1309
+ * .condition("Open", "ifNot")
1310
+ * .build(room);
1311
+ * ```
1312
+ *
1313
+ * @typeParam TStates - Union of state names added via `.state()`. Used for autocomplete and validation in `.transition()` and `.defaultState()`.
1314
+ * @typeParam TParams - Record mapping parameter names to their types (`"trigger"`, `"bool"`, `"float"`, `"int"`). Used for type-aware `.condition()` overloads.
1315
+ *
1174
1316
  * @category Animation and Sequencing
1175
1317
  * @group Utilities
1176
1318
  */
1177
- export declare class AnimatorControllerBuilder {
1319
+ export declare class AnimatorControllerBuilder<TStates extends string = never, TParams extends Record<string, "trigger" | "bool" | "float" | "int"> = {}> {
1178
1320
  private _name;
1179
1321
  private _parameters;
1180
1322
  private _states;
1181
1323
  private _anyStateTransitions;
1182
1324
  private _defaultStateName;
1183
1325
  private _lastTransition;
1326
+ private _lastState;
1327
+ /**
1328
+ * Creates a new AnimatorControllerBuilder instance.
1329
+ * @param name - Optional name for the controller
1330
+ */
1331
+ static create(name?: string): AnimatorControllerBuilder;
1184
1332
  constructor(name?: string);
1185
1333
  /** Adds a float parameter */
1186
- floatParameter(name: string, defaultValue?: number): this;
1334
+ floatParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "float">>;
1187
1335
  /** Adds an integer parameter */
1188
- intParameter(name: string, defaultValue?: number): this;
1336
+ intParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "int">>;
1189
1337
  /** Adds a boolean parameter */
1190
- boolParameter(name: string, defaultValue?: boolean): this;
1338
+ boolParameter<N extends string>(name: N, defaultValue?: boolean): AnimatorControllerBuilder<TStates, TParams & Record<N, "bool">>;
1191
1339
  /** Adds a trigger parameter */
1192
- triggerParameter(name: string): this;
1340
+ triggerParameter<N extends string>(name: N): AnimatorControllerBuilder<TStates, TParams & Record<N, "trigger">>;
1193
1341
  /**
1194
1342
  * Adds a state to the controller. The first state added becomes the default state.
1343
+ *
1344
+ * When `options.clip` is provided, the state uses that clip directly.
1345
+ * When omitted, chain `.track()` calls to define animation tracks inline:
1346
+ * ```ts
1347
+ * .state("Open", { loop: true })
1348
+ * .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
1349
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
1350
+ * ```
1351
+ *
1195
1352
  * @param name - Unique name for the state
1196
- * @param options - State configuration including clip, loop, speed
1353
+ * @param options - State configuration including clip, loop, speed. When omitted, use `.track()` to add animation data.
1197
1354
  */
1198
- state(name: string, options: StateOptions): this;
1355
+ state<N extends string>(name: N, options?: StateOptions): AnimatorControllerBuilder<TStates | N, TParams>;
1199
1356
  /**
1200
1357
  * Adds a transition between two states.
1201
1358
  * Use `"*"` as the source to create a transition from any state.
@@ -1204,26 +1361,52 @@ export declare class AnimatorControllerBuilder {
1204
1361
  * @param to - Destination state name
1205
1362
  * @param options - Transition configuration
1206
1363
  */
1207
- transition(from: string, to: string, options?: TransitionOptions): this;
1364
+ transition(from: TStates | "*", to: TStates, options?: TransitionOptions): AnimatorControllerBuilder<TStates, TParams>;
1208
1365
  /**
1209
1366
  * Adds a condition to the most recently added transition.
1210
1367
  * Multiple conditions on the same transition are AND-ed together.
1368
+ *
1369
+ * The required arguments depend on the parameter type:
1370
+ * - **Trigger**: `.condition("Jump")` — mode defaults to `"if"`, no threshold needed
1371
+ * - **Bool**: `.condition("Open", "if")` or `.condition("Open", "ifNot")`
1372
+ * - **Float/Int**: `.condition("Speed", "greater", 0.1)`
1373
+ *
1211
1374
  * @param parameter - Name of the parameter to evaluate
1212
- * @param mode - Condition mode: `"if"`, `"ifNot"`, `"greater"`, `"less"`, `"equals"`, `"notEqual"`
1213
- * @param threshold - Comparison threshold for numeric conditions (default: 0)
1214
1375
  */
1215
- condition(parameter: string, mode: ConditionMode, threshold?: number): this;
1376
+ condition(parameter: ParamNamesOfType<TParams, "trigger">, mode?: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
1377
+ condition(parameter: ParamNamesOfType<TParams, "bool">, mode: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
1378
+ condition(parameter: ParamNamesOfType<TParams, "float" | "int">, mode: "greater" | "less" | "equals" | "notEqual", threshold?: number): AnimatorControllerBuilder<TStates, TParams>;
1379
+ /** Adds an animation track for an Object3D's position or scale to the current state */
1380
+ track(target: Object3D, property: "position" | "scale", keyframes: KF<Vec3Value>, options?: TrackOptions): this;
1381
+ /** Adds an animation track for an Object3D's quaternion to the current state */
1382
+ track(target: Object3D, property: "quaternion", keyframes: KF<QuatValue>, options?: TrackOptions): this;
1383
+ /** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) to the current state */
1384
+ track(target: Object3D, property: "rotation", keyframes: KF<EulerValue>, options?: TrackOptions): this;
1385
+ /** Adds an animation track for an Object3D's visibility to the current state */
1386
+ track(target: Object3D, property: "visible", keyframes: KF<boolean>, options?: TrackOptions): this;
1387
+ /** Adds an animation track for a material's numeric property to the current state */
1388
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF<number>, options?: TrackOptions): this;
1389
+ /** Adds an animation track for a material's color property to the current state */
1390
+ track(target: Material, property: "color" | "emissive", keyframes: KF<ColorValue>, options?: TrackOptions): this;
1391
+ /** Adds an animation track for a light's numeric property to the current state */
1392
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF<number>, options?: TrackOptions): this;
1393
+ /** Adds an animation track for a light's color to the current state */
1394
+ track(target: Light_2, property: "color", keyframes: KF<ColorValue>, options?: TrackOptions): this;
1395
+ /** Adds an animation track for a camera's numeric property to the current state */
1396
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF<number>, options?: TrackOptions): this;
1216
1397
  /**
1217
1398
  * Sets which state is the default/entry state.
1218
1399
  * If not called, the first added state is used.
1219
1400
  * @param name - Name of the state
1220
1401
  */
1221
- defaultState(name: string): this;
1402
+ defaultState(name: TStates): AnimatorControllerBuilder<TStates, TParams>;
1222
1403
  /**
1223
1404
  * Builds and returns the {@link AnimatorController}.
1224
1405
  * Resolves all state name references to indices.
1406
+ * @param root - Optional root Object3D for resolving {@link TrackDescriptor} track paths.
1407
+ * When provided, tracks targeting a different object use `target.name` for named resolution.
1225
1408
  */
1226
- build(): AnimatorController;
1409
+ build(root?: Object3D): AnimatorController;
1227
1410
  }
1228
1411
 
1229
1412
  export declare type AnimatorControllerModel = {
@@ -1472,6 +1655,75 @@ export declare class Attractor extends Component {
1472
1655
 
1473
1656
  declare type AttributeChangeCallback = (value: string | null) => void;
1474
1657
 
1658
+ /**
1659
+ * Represents an audio clip that can be loaded and played independently.
1660
+ * The AudioClip class encapsulates the URL of the audio resource and provides
1661
+ * methods for playback control (play, pause, stop) and querying duration.
1662
+ */
1663
+ export declare class AudioClip {
1664
+ readonly url: string;
1665
+ /**
1666
+ * Creates a new AudioClip instance with the specified URL.
1667
+ * @param url The URL of the audio resource to load. This can be a path to an audio file or a MediaStream URL.
1668
+ */
1669
+ constructor(url: string);
1670
+ /** Whether the clip is currently playing.
1671
+ * @returns `true` if the clip is actively playing audio.
1672
+ */
1673
+ get isPlaying(): boolean;
1674
+ /**
1675
+ * The total duration of the audio clip in seconds.
1676
+ * Loads the audio metadata if not already available.
1677
+ * @returns A promise that resolves with the duration in seconds.
1678
+ */
1679
+ getDuration(): Promise<number>;
1680
+ /**
1681
+ * Plays the audio clip from the current position.
1682
+ * @returns A promise that resolves when playback finishes, or rejects on error.
1683
+ * If the clip is looping, the promise will never resolve on its own – call {@link stop} or {@link pause} to end playback.
1684
+ */
1685
+ play(): Promise<void>;
1686
+ /**
1687
+ * Pauses playback at the current position.
1688
+ * Call {@link play} to resume.
1689
+ */
1690
+ pause(): void;
1691
+ /**
1692
+ * Stops playback and resets the position to the beginning.
1693
+ */
1694
+ stop(): void;
1695
+ /** Whether the clip should loop when reaching the end. */
1696
+ get loop(): boolean;
1697
+ set loop(value: boolean);
1698
+ /** Playback volume from 0 (silent) to 1 (full). */
1699
+ get volume(): number;
1700
+ set volume(value: number);
1701
+ /** Current playback position in seconds. */
1702
+ get currentTime(): number;
1703
+ set currentTime(value: number);
1704
+ /** Normalized playback progress from 0 to 1.
1705
+ * @returns The current playback position as a value between 0 and 1, or 0 if the duration is unknown.
1706
+ */
1707
+ get progress(): number;
1708
+ /**
1709
+ * Seeks to a normalized position (0–1) in the clip.
1710
+ * @param position A value between 0 (start) and 1 (end).
1711
+ */
1712
+ seek(position: number): void;
1713
+ /** The underlying HTMLAudioElement, or `undefined` if not yet created.
1714
+ * Use this to connect the element to the Web Audio API via `createMediaElementSource()`.
1715
+ * @returns The HTMLAudioElement if the clip has been loaded or played, otherwise `undefined`.
1716
+ */
1717
+ get audioElement(): HTMLAudioElement | undefined;
1718
+ private _audioElement?;
1719
+ private _duration?;
1720
+ private _loadPromise?;
1721
+ private _loop;
1722
+ private _volume;
1723
+ /** Lazily creates and loads the shared HTMLAudioElement. */
1724
+ private ensureAudioElement;
1725
+ }
1726
+
1475
1727
  /**
1476
1728
  * @category Animation and Sequencing
1477
1729
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -1486,6 +1738,26 @@ declare type AudioClipModel_2 = Models.ClipModel & {
1486
1738
  _didTriggerPlay: boolean;
1487
1739
  };
1488
1740
 
1741
+ /**
1742
+ * Options for an audio clip in the timeline builder
1743
+ */
1744
+ export declare type AudioClipOptions = {
1745
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
1746
+ start?: number;
1747
+ /** Duration of the clip in seconds (required for audio since we can't infer it) */
1748
+ duration: number;
1749
+ /** Playback speed multiplier (default: 1) */
1750
+ speed?: number;
1751
+ /** Volume multiplier for this clip (default: 1) */
1752
+ volume?: number;
1753
+ /** Whether the audio should loop within the clip (default: false) */
1754
+ loop?: boolean;
1755
+ /** Ease-in duration in seconds (default: 0) */
1756
+ easeIn?: number;
1757
+ /** Ease-out duration in seconds (default: 0) */
1758
+ easeOut?: number;
1759
+ };
1760
+
1489
1761
  export declare class AudioExtension implements IUSDExporterExtension {
1490
1762
  static getName(clip: string): string;
1491
1763
  get extensionName(): string;
@@ -1627,9 +1899,10 @@ export declare class AudioSource extends Component {
1627
1899
  */
1628
1900
  get isPlaying(): boolean;
1629
1901
  /**
1630
- * The total duration of the current audio clip in seconds.
1902
+ * The total duration of the currently loaded audio clip in seconds.
1631
1903
  *
1632
1904
  * @returns Duration in seconds or undefined if no clip is loaded
1905
+ * @remarks For MediaStream clips, duration is not directly available and will return undefined. If the audio clip has not started loading or is still loading, duration may also be undefined until the audio buffer is ready.
1633
1906
  */
1634
1907
  get duration(): number | undefined;
1635
1908
  /**
@@ -1654,7 +1927,8 @@ export declare class AudioSource extends Component {
1654
1927
  /**
1655
1928
  * Controls how the audio is positioned in space.
1656
1929
  * Values range from 0 (2D, non-positional) to 1 (fully 3D positioned).
1657
- * Note: 2D playback is not fully supported in the current implementation.
1930
+ * Internally uses a dual-path audio graph to crossfade between a spatialized (PannerNode)
1931
+ * and a non-spatialized (direct) signal path.
1658
1932
  */
1659
1933
  get spatialBlend(): number;
1660
1934
  set spatialBlend(val: number);
@@ -1702,7 +1976,11 @@ export declare class AudioSource extends Component {
1702
1976
  private audioLoader;
1703
1977
  private shouldPlay;
1704
1978
  private _lastClipStartedLoading;
1979
+ private _loadedClip;
1705
1980
  private _audioElement;
1981
+ private _entryNode;
1982
+ private _spatialGain;
1983
+ private _bypassGain;
1706
1984
  /**
1707
1985
  * Returns the underlying {@link PositionalAudio} object, creating it if necessary.
1708
1986
  * The audio source needs a user interaction to be initialized due to browser autoplay policies.
@@ -1730,6 +2008,15 @@ export declare class AudioSource extends Component {
1730
2008
  private onApplicationMuteChanged;
1731
2009
  private createAudio;
1732
2010
  private __onAllowAudioCallback;
2011
+ /**
2012
+ * Sets up the dual-path audio graph for spatial blend crossfading.
2013
+ * Creates two parallel signal paths from source to output:
2014
+ * - 3D path: entry → panner → spatialGain → gain (spatialized)
2015
+ * - 2D path: entry → bypassGain → gain (non-spatialized)
2016
+ */
2017
+ private setupSpatialBlendNodes;
2018
+ /** Updates the spatial/bypass gain values based on the current spatialBlend. */
2019
+ private updateSpatialBlendGains;
1733
2020
  private applySpatialDistanceSettings;
1734
2021
  private onNewClip;
1735
2022
  /**
@@ -1737,8 +2024,9 @@ export declare class AudioSource extends Component {
1737
2024
  * If no argument is provided, plays the currently assigned clip.
1738
2025
  *
1739
2026
  * @param clip - Optional audio clip or {@link MediaStream} to play
2027
+ * @returns A promise that resolves when playback starts successfully, or rejects on error
1740
2028
  */
1741
- play(clip?: string | MediaStream | undefined): void;
2029
+ play(clip?: string | MediaStream | undefined): Promise<boolean>;
1742
2030
  /**
1743
2031
  * Pauses audio playback while maintaining the current position.
1744
2032
  * Use play() to resume from the paused position.
@@ -1755,30 +2043,15 @@ export declare class AudioSource extends Component {
1755
2043
  /* Excluded from this release type: update */
1756
2044
  }
1757
2045
 
1758
- export declare class AudioTrackHandler extends TrackHandler {
1759
- models: Array<AudioClipModel_2>;
1760
- listener: AudioListener_3;
1761
- audio: Array<Audio_2>;
1762
- audioContextTimeOffset: Array<number>;
1763
- lastTime: number;
1764
- audioSource?: AudioSource;
1765
- private _audioLoader;
1766
- private getAudioFilePath;
1767
- onAllowAudioChanged(allow: boolean): void;
1768
- addModel(model: Models.ClipModel): void;
1769
- onDisable(): void;
1770
- onDestroy(): void;
1771
- onMuteChanged(): void;
1772
- stop(): void;
1773
- private _playableDirectorResumed;
1774
- onPauseChanged(): void;
1775
- evaluate(time: number): void;
1776
- /** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
1777
- loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
1778
- private isInTimeRange;
1779
- private static _audioBuffers;
1780
- static dispose(): void;
1781
- private handleAudioLoading;
2046
+ /**
2047
+ * Builder for audio tracks. Provides `.clip()` for adding audio clips by URL.
2048
+ * @category Animation and Sequencing
2049
+ */
2050
+ export declare interface AudioTrackBuilder extends TimelineBuilderBase {
2051
+ /** Adds an audio clip by URL */
2052
+ clip(url: string, options: AudioClipOptions): AudioTrackBuilder;
2053
+ /** Mutes this track so it is skipped during playback */
2054
+ muted(muted?: boolean): AudioTrackBuilder;
1782
2055
  }
1783
2056
 
1784
2057
  /* Excluded from this release type: AuralMode */
@@ -1811,69 +2084,6 @@ export declare class Avatar extends Component {
1811
2084
  private loadAvatarObjects;
1812
2085
  }
1813
2086
 
1814
- /* Excluded from this release type: Avatar_Brain_LookAt */
1815
-
1816
- /* Excluded from this release type: Avatar_MouthShapes */
1817
-
1818
- /* Excluded from this release type: Avatar_MustacheShake */
1819
-
1820
- /* Excluded from this release type: Avatar_POI */
1821
-
1822
- /* Excluded from this release type: AvatarBlink_Simple */
1823
-
1824
- /* Excluded from this release type: AvatarEyeLook_Rotation */
1825
-
1826
- /**
1827
- * Handles loading and instantiating avatar models from various sources.
1828
- * Provides functionality to find and extract important parts of an avatar (head, hands).
1829
- *
1830
- * Debug mode can be enabled with the URL parameter `?debugavatar`,
1831
- * which will log detailed information about avatar loading and configuration.
1832
- */
1833
- export declare class AvatarLoader {
1834
- private readonly avatarRegistryUrl;
1835
- /**
1836
- * Retrieves or creates a new avatar instance from an ID or existing Object3D.
1837
- * @param context The application context
1838
- * @param avatarId Either a string ID to load an avatar or an existing Object3D to use as avatar
1839
- * @returns Promise resolving to an AvatarModel if successful, or null if failed
1840
- */
1841
- getOrCreateNewAvatarInstance(context: Context, avatarId: string | Object3D): Promise<AvatarModel | null>;
1842
- /**
1843
- * Loads an avatar model from a file or registry using the provided ID.
1844
- * @param context The engine context
1845
- * @param avatarId The ID of the avatar to load
1846
- * @returns Promise resolving to the loaded avatar's Object3D, or null if failed
1847
- */
1848
- private loadAvatar;
1849
- /**
1850
- * Caches an avatar model for reuse.
1851
- * @param _id The ID to associate with the model
1852
- * @param _model The avatar model to cache
1853
- */
1854
- private cacheModel;
1855
- /**
1856
- * Analyzes an Object3D to find avatar parts (head, hands) based on naming conventions.
1857
- * @param obj The Object3D to search for avatar parts
1858
- * @returns A structured AvatarModel with references to found parts
1859
- */
1860
- private findAvatar;
1861
- /**
1862
- * Recursively searches for an avatar part by name within an Object3D hierarchy.
1863
- * @param obj The Object3D to search within
1864
- * @param searchString Array of strings that should all be present in the object name
1865
- * @returns The found Object3D part or null if not found
1866
- */
1867
- private findAvatarPart;
1868
- /**
1869
- * Handles HTTP response errors from avatar loading operations.
1870
- * @param response The fetch API response to check
1871
- * @returns The response if it was ok
1872
- * @throws Error with status text if response was not ok
1873
- */
1874
- private handleCustomAvatarErrors;
1875
- }
1876
-
1877
2087
  /**
1878
2088
  * Marks a GameObject as being controlled or owned by a player in networked XR sessions.
1879
2089
  * This is used internally by the networking system to identify player-controlled objects.
@@ -1934,35 +2144,6 @@ declare type AvatarMarkerEventArgs = {
1934
2144
  gameObject: Object3D;
1935
2145
  };
1936
2146
 
1937
- /**
1938
- * Represents an avatar model with head and hands references.
1939
- * Used for representing characters in 3D space.
1940
- */
1941
- export declare class AvatarModel {
1942
- /** The root object of the avatar model */
1943
- root: Object3D;
1944
- /** The head object of the avatar model */
1945
- head: Object3D;
1946
- /** The left hand object of the avatar model, if available */
1947
- leftHand: Object3D | null;
1948
- /** The right hand object of the avatar model, if available */
1949
- rigthHand: Object3D | null;
1950
- /**
1951
- * Checks if the avatar model has a valid configuration.
1952
- * An avatar is considered valid if it has a head.
1953
- * @returns Whether the avatar has a valid setup
1954
- */
1955
- get isValid(): boolean;
1956
- /**
1957
- * Creates a new avatar model.
1958
- * @param root The root object of the avatar
1959
- * @param head The head object of the avatar
1960
- * @param leftHand The left hand object of the avatar
1961
- * @param rigthHand The right hand object of the avatar
1962
- */
1963
- constructor(root: Object3D, head: Object3D, leftHand: Object3D | null, rigthHand: Object3D | null);
1964
- }
1965
-
1966
2147
  export declare enum Axes {
1967
2148
  None = 0,
1968
2149
  X = 2,
@@ -2326,7 +2507,6 @@ export declare class BoxCollider extends Collider implements IBoxCollider {
2326
2507
  center: Vector3;
2327
2508
  /* Excluded from this release type: onEnable */
2328
2509
  /* Excluded from this release type: onDisable */
2329
- /* Excluded from this release type: onValidate */
2330
2510
  /**
2331
2511
  * Automatically fits the collider to the geometry of the object.
2332
2512
  * Sets the size and center based on the object's bounding box.
@@ -2600,6 +2780,7 @@ declare class CallHandle extends EventDispatcher<any> {
2600
2780
  * CallInfo represents a single callback method that can be invoked by the {@link EventList}.
2601
2781
  */
2602
2782
  export declare class CallInfo {
2783
+ $serializedTypes: Record<string, any>;
2603
2784
  /**
2604
2785
  * When the CallInfo is enabled it will be invoked when the EventList is invoked
2605
2786
  */
@@ -2946,7 +3127,7 @@ export declare class Canvas extends UIRootComponent implements ICanvas {
2946
3127
  private _receivers;
2947
3128
  registerEventReceiver(receiver: ICanvasEventReceiver): void;
2948
3129
  unregisterEventReceiver(receiver: ICanvasEventReceiver): void;
2949
- onEnterXR(args: NeedleXREventArgs): Promise<void>;
3130
+ onEnterXR(args: NeedleXREventArgs): void;
2950
3131
  onLeaveXR(args: NeedleXREventArgs): void;
2951
3132
  onBeforeRenderRoutine: () => void;
2952
3133
  onAfterRenderRoutine: () => void;
@@ -3522,6 +3703,22 @@ export declare abstract class Collider extends Component implements ICollider {
3522
3703
  * The layers that this collider will interact with. Used for filtering collision detection.
3523
3704
  */
3524
3705
  filter?: number[];
3706
+ /**
3707
+ * The density of the collider, used for automatic mass calculation when the attached {@link Rigidbody} has `autoMass` enabled.
3708
+ * Rapier computes mass from density using the real-world formula: `mass = density × volume`.
3709
+ * The volume is derived from the collider shape (sphere, box, capsule, or convex hull).
3710
+ *
3711
+ * Reference values (relative to water = 1.0):
3712
+ * - Wood: 0.5–0.9
3713
+ * - Water: 1.0 (engine default)
3714
+ * - Rubber: 1.2
3715
+ * - Steel: 7.8
3716
+ *
3717
+ * @default undefined — uses the physics engine default of 1.0
3718
+ */
3719
+ density?: number;
3720
+ /* Excluded from this release type: _propertiesDirty */
3721
+ /* Excluded from this release type: onValidate */
3525
3722
  /* Excluded from this release type: awake */
3526
3723
  /* Excluded from this release type: start */
3527
3724
  /* Excluded from this release type: onEnable */
@@ -3623,7 +3820,10 @@ declare class ColorSerializer extends TypeSerializer {
3623
3820
  onSerialize(data: any): any | void;
3624
3821
  }
3625
3822
 
3626
- export declare const colorSerializer: ColorSerializer;
3823
+ export declare let colorSerializer: ColorSerializer;
3824
+
3825
+ /** A Color value, either as a Three.js Color or as an `[r, g, b]` tuple (0–1) */
3826
+ declare type ColorValue = Color | [number, number, number];
3627
3827
 
3628
3828
  /**
3629
3829
  * Utility method to check if two materials were created from the same glTF material
@@ -3644,7 +3844,7 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
3644
3844
  * **Input event methods:**
3645
3845
  * {@link onPointerDown}, {@link onPointerUp}, {@link onPointerEnter}, {@link onPointerExit} and {@link onPointerMove}.
3646
3846
  *
3647
- * @example
3847
+ * @example Basic component
3648
3848
  * ```typescript
3649
3849
  * import { Behaviour } from "@needle-tools/engine";
3650
3850
  * export class MyComponent extends Behaviour {
@@ -3657,6 +3857,25 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
3657
3857
  * }
3658
3858
  * ```
3659
3859
  *
3860
+ * @example Automatic cleanup with autoCleanup
3861
+ * ```typescript
3862
+ * import { Behaviour, serializable, EventList } from "@needle-tools/engine";
3863
+ * export class ScoreTracker extends Behaviour {
3864
+ * @serializable(EventList)
3865
+ * onScoreChanged?: EventList<number>;
3866
+ *
3867
+ * start() {
3868
+ * // Registered during start → survives enable/disable, cleaned up on destroy
3869
+ * this.autoCleanup(this.onScoreChanged?.on(score => console.log("Score:", score)));
3870
+ * }
3871
+ *
3872
+ * onEnable() {
3873
+ * // Registered during onEnable → cleaned up on disable
3874
+ * this.autoCleanup(() => this.cleanupResources());
3875
+ * }
3876
+ * }
3877
+ * ```
3878
+ *
3660
3879
  * @group Components
3661
3880
  */
3662
3881
  declare abstract class Component implements IComponent, EventTarget, Partial<INeedleXRSessionEventReceiver>, Partial<IPointerEventHandler> {
@@ -3707,6 +3926,50 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
3707
3926
  * @returns True if the component is enabled and all parent GameObjects are active
3708
3927
  */
3709
3928
  get activeAndEnabled(): boolean;
3929
+ private __disableCleanups?;
3930
+ private __destroyCleanups?;
3931
+ /**
3932
+ * @experimental
3933
+ * Register a resource for automatic cleanup tied to this component's lifecycle.
3934
+ * Accepts {@link IDisposable} objects, cleanup functions, or event unsubscribe functions.
3935
+ * `null` and `undefined` are safe no-ops (convenient for conditional subscriptions).
3936
+ *
3937
+ * **Lifecycle-aware:** The cleanup store is chosen automatically based on when `autoCleanup` is called:
3938
+ * - Called during {@link onEnable} → cleaned up on {@link onDisable} (and re-registered on re-enable)
3939
+ * - Called during {@link awake} or {@link start} → cleaned up on {@link onDestroy} (survives enable/disable cycles)
3940
+ * - Called at any other time (e.g. from update) → cleaned up on {@link onDisable}
3941
+ *
3942
+ * @param disposable An {@link IDisposable}, a cleanup/unsubscribe function, or `null`/`undefined`
3943
+ *
3944
+ * @example EventList subscriptions
3945
+ * ```ts
3946
+ * import { Behaviour, serializable, EventList } from "@needle-tools/engine";
3947
+ *
3948
+ * export class MyComponent extends Behaviour {
3949
+ * @serializable(EventList)
3950
+ * onScoreChanged?: EventList<number>;
3951
+ *
3952
+ * onEnable() {
3953
+ * this.autoCleanup(this.onScoreChanged?.on(score => {
3954
+ * console.log("Score:", score);
3955
+ * }));
3956
+ * }
3957
+ * }
3958
+ * ```
3959
+ *
3960
+ * @example Lifetime subscriptions in awake
3961
+ * ```ts
3962
+ * import { Behaviour } from "@needle-tools/engine";
3963
+ *
3964
+ * export class Persistent extends Behaviour {
3965
+ * awake() {
3966
+ * // Registered during awake → survives enable/disable, cleaned up on destroy
3967
+ * this.autoCleanup(() => this.save());
3968
+ * }
3969
+ * }
3970
+ * ```
3971
+ */
3972
+ protected autoCleanup(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
3710
3973
  private get __isActive();
3711
3974
  private get __isActiveInHierarchy();
3712
3975
  private set __isActiveInHierarchy(value);
@@ -3725,11 +3988,6 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
3725
3988
  * For example, URL to the glTF file this component was loaded from
3726
3989
  */
3727
3990
  sourceId?: SourceIdentifier;
3728
- /**
3729
- * Called when this component needs to remap guids after an instantiate operation.
3730
- * @param guidsMap Mapping from old guids to newly generated guids
3731
- */
3732
- resolveGuids?(guidsMap: GuidsMap): void;
3733
3991
  /**
3734
3992
  * Called once when the component becomes active for the first time.
3735
3993
  * This is the first lifecycle callback to be invoked
@@ -3942,6 +4200,10 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
3942
4200
  destroy(): void;
3943
4201
  /* Excluded from this release type: __didAwake */
3944
4202
  /* Excluded from this release type: __didStart */
4203
+ /** True while start() has finished executing (used by autoCleanup to distinguish start from update) */
4204
+ private __didCompleteStart;
4205
+ /** True while onEnable() is executing (used by autoCleanup to route to disable store) */
4206
+ private __inEnableOrDisableCallback;
3945
4207
  /* Excluded from this release type: __didEnable */
3946
4208
  /* Excluded from this release type: __isEnabled */
3947
4209
  /* Excluded from this release type: __destroyed */
@@ -4097,7 +4359,7 @@ declare class ComponentSerializer extends TypeSerializer {
4097
4359
  findObjectForGuid(guid: string, root: Object3D): any;
4098
4360
  }
4099
4361
 
4100
- export declare const componentSerializer: ComponentSerializer;
4362
+ export declare let componentSerializer: ComponentSerializer;
4101
4363
 
4102
4364
  declare type ComponentType = "button" | "thumbstick" | "squeeze" | "touchpad";
4103
4365
 
@@ -4231,6 +4493,7 @@ export declare class ContactShadows extends Component {
4231
4493
  set needsUpdate(val: boolean);
4232
4494
  get needsUpdate(): boolean;
4233
4495
  private _needsUpdate;
4496
+ private _needsFit;
4234
4497
  /** All shadow objects are parented to this object.
4235
4498
  * The gameObject itself should not be transformed because we want the ContactShadows object e.g. also have a GroundProjectedEnv component
4236
4499
  * in which case ContactShadows scale would affect the projection
@@ -4460,13 +4723,14 @@ export declare class Context implements IContext {
4460
4723
  * Use `setCurrentCamera` for updating the main camera.
4461
4724
  */
4462
4725
  /**
4463
- * Typed proxy providing direct access to scene components by node and component name.
4464
- * Types are auto-generated from your GLB assets by the `needle:dts-generator` Vite plugin
4465
- * and written to `src/generated/needle-bindings.d.ts` on every dev-server start and GLB change.
4726
+ * Access your scene's full hierarchy, objects, and components directly by name with full autocomplete.
4727
+ * Types are generated automatically from your GLB files when the dev server starts.
4466
4728
  *
4467
- * Each property access traverses the live scene graph on demand — no caching, always fresh.
4468
- * This is a convenience shorthand for `getComponent` lookups; the same result can be
4469
- * achieved manually via `scene.getObjectByName(name)` + `getComponent(node, Type)`.
4729
+ * You can store references to objects or components for later use.
4730
+ * Note that the scene hierarchy can change at runtime (e.g. when objects are added, removed, or re-parented),
4731
+ * in which case stored references may become stale.
4732
+ *
4733
+ * @experimental This API may change in future versions.
4470
4734
  *
4471
4735
  * @example
4472
4736
  * // Toggle auto-rotate on the orbit camera
@@ -4475,12 +4739,6 @@ export declare class Context implements IContext {
4475
4739
  * @example
4476
4740
  * // Change the background color
4477
4741
  * ctx.sceneData.Camera.Camera.backgroundColor = new RGBAColor(1, 0, 0, 1);
4478
- *
4479
- * @example
4480
- * // Equivalent manual approach (without sceneData)
4481
- * const node = ctx.scene.getObjectByName("Camera");
4482
- * const orbit = getComponent(node, OrbitControls);
4483
- * if (orbit) orbit.autoRotate = true;
4484
4742
  */
4485
4743
  get sceneData(): SceneData;
4486
4744
  get mainCamera(): Camera_2;
@@ -4489,30 +4747,48 @@ export declare class Context implements IContext {
4489
4747
  private _mainCamera;
4490
4748
  private _fallbackCamera;
4491
4749
  /** access application state (e.g. if all audio should be muted) */
4492
- application: Application;
4750
+ get application(): Application;
4751
+ private _application;
4493
4752
  /** access animation mixer used by components in the scene */
4494
- animations: AnimationsRegistry;
4753
+ get animations(): AnimationsRegistry;
4754
+ private _animations;
4495
4755
  /** access timings (current frame number, deltaTime, timeScale, ...) */
4496
- time: Time;
4756
+ get time(): Time;
4757
+ private _time;
4497
4758
  /** access input data (e.g. click or touch events) */
4498
- input: Input;
4759
+ get input(): Input;
4760
+ private _input;
4499
4761
  /** access physics related methods (e.g. raycasting). To access the phyiscs engine use `context.physics.engine` */
4500
- physics: Physics;
4762
+ get physics(): Physics;
4763
+ private _physics;
4501
4764
  /** access postprocessing effects stack. Add/remove effects and configure adaptive performance settings */
4502
- postprocessing: PostProcessing;
4765
+ get postprocessing(): PostProcessing;
4766
+ private _postprocessing;
4503
4767
  /** access networking methods (use it to send or listen to messages or join a networking backend) */
4504
- connection: NetworkConnection;
4768
+ get connection(): NetworkConnection;
4769
+ private _connection;
4770
+ /** context-level event bus for decoupled component communication
4771
+ * @see {@link ContextEventMap} for known event types
4772
+ */
4773
+ get events(): EventBus;
4774
+ private _events;
4505
4775
  /** @deprecated AssetDatabase is deprecated */
4506
4776
  assets: AssetDatabase;
4507
- /** The main light in the scene */
4508
- mainLight: ILight | null;
4777
+ /** All registered lights in the scene, maintained by the Light component.
4778
+ * @see mainLight for accessing the main directional light in the scene
4779
+ */
4780
+ readonly lights: ILight[];
4781
+ /** The brightest registered directional light, or null if none are registered
4782
+ * @see lights
4783
+ */
4784
+ get mainLight(): ILight | null;
4509
4785
  /** @deprecated Use sceneLighting */
4510
- get rendererData(): RendererData;
4786
+ private get rendererData();
4511
4787
  /** Access the scene lighting manager to control lighting settings in the context */
4512
- sceneLighting: RendererData;
4513
- addressables: Addressables;
4514
- lightmaps: ILightDataRegistry;
4515
- players: PlayerViewManager;
4788
+ readonly sceneLighting: RendererData;
4789
+ readonly addressables: Addressables;
4790
+ readonly lightmaps: ILightDataRegistry;
4791
+ readonly players: PlayerViewManager;
4516
4792
  /** Access the LODs manager to control LOD behavior in the context */
4517
4793
  readonly lodsManager: LODsManager;
4518
4794
  /** Access the needle menu to add or remove buttons to the menu element */
@@ -4754,6 +5030,18 @@ export declare type ContextEventArgs = {
4754
5030
  files?: LoadedModel[];
4755
5031
  };
4756
5032
 
5033
+ /** Typed event map for {@link Context.events}.
5034
+ * Known events get full autocomplete; custom events can be typed at the call site via generic parameter.
5035
+ */
5036
+ export declare interface ContextEventMap {
5037
+ "scene-content-changed": {
5038
+ /** The component that triggered the change (e.g. SceneSwitcher, DropListener) */
5039
+ readonly source: IComponent;
5040
+ /** The root object that was added/loaded */
5041
+ readonly object: Object3D;
5042
+ };
5043
+ }
5044
+
4757
5045
  /** Use to register to various Needle Engine context events and to get access to all current instances
4758
5046
  * e.g. when being created in the DOM
4759
5047
  * @example
@@ -4805,6 +5093,20 @@ export declare type ControlClipModel = {
4805
5093
  updateDirector: boolean;
4806
5094
  };
4807
5095
 
5096
+ /**
5097
+ * Options for a control clip in the timeline builder
5098
+ */
5099
+ export declare type ControlClipOptions = {
5100
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
5101
+ start?: number;
5102
+ /** Duration of the clip in seconds (required) */
5103
+ duration: number;
5104
+ /** Whether to control the activation of the source object (default: true) */
5105
+ controlActivation?: boolean;
5106
+ /** Whether to update a nested PlayableDirector on the source object (default: true) */
5107
+ updateDirector?: boolean;
5108
+ };
5109
+
4808
5110
  /** true when selectstart was ever received.
4809
5111
  * On VisionOS 1.1 we always have select events (as per the spec), so this is always true
4810
5112
  */
@@ -4815,12 +5117,15 @@ declare type ControllerAxes = "xr-standard-thumbstick" | "xr-standard-touchpad";
4815
5117
  */
4816
5118
  export declare type ControllerChangedEvt = (args: NeedleXRControllerEventArgs) => void;
4817
5119
 
4818
- export declare class ControlTrackHandler extends TrackHandler {
4819
- models: Array<Models.ClipModel>;
4820
- timelines: Array<PlayableDirector | null>;
4821
- resolveSourceObjects(_context: Context): void;
4822
- private _previousActiveModel;
4823
- evaluate(time: number): void;
5120
+ /**
5121
+ * Builder for control tracks. Provides `.clip()` for controlling nested objects/timelines.
5122
+ * @category Animation and Sequencing
5123
+ */
5124
+ export declare interface ControlTrackBuilder extends TimelineBuilderBase {
5125
+ /** Adds a control clip for a source object */
5126
+ clip(sourceObject: Object3D, options: ControlClipOptions): ControlTrackBuilder;
5127
+ /** Mutes this track so it is skipped during playback */
5128
+ muted(muted?: boolean): ControlTrackBuilder;
4824
5129
  }
4825
5130
 
4826
5131
  /**@obsolete use Graphics.copyTexture */
@@ -5008,7 +5313,6 @@ export declare class CursorFollow extends Component {
5008
5313
  * - Cursor that follows terrain or mesh surfaces
5009
5314
  *
5010
5315
  * **Important notes:**
5011
- * - Requires objects in the scene to have colliders for raycasting to work
5012
5316
  * - Works best with {@link keepDistance} set to `false` to allow depth changes
5013
5317
  * - Can be combined with {@link damping} for smooth surface following
5014
5318
  * - The raycast uses the physics system's raycast functionality
@@ -5135,7 +5439,7 @@ export declare function decompressGpuTexture(texture: any, maxTextureSize?: numb
5135
5439
  * return true;
5136
5440
  * });
5137
5441
  * */
5138
- export declare function deepClone(obj: any, predicate?: deepClonePredicate): any;
5442
+ export declare function deepClone(obj: any, predicate?: deepClonePredicate, _visited?: WeakSet<object>): any;
5139
5443
 
5140
5444
  declare type deepClonePredicate = (owner: any, propertyName: string, current: any) => boolean;
5141
5445
 
@@ -5363,7 +5667,7 @@ export declare namespace DeviceUtilities {
5363
5667
  * Controls how the {@link PlayableDirector} behaves when playback reaches the end.
5364
5668
  * @see {@link PlayableDirector.extrapolationMode}
5365
5669
  */
5366
- declare enum DirectorWrapMode {
5670
+ export declare enum DirectorWrapMode {
5367
5671
  /** Hold the last frame when playback reaches the end of the timeline. */
5368
5672
  Hold = 0,
5369
5673
  /** Loop back to the start and continue playing indefinitely. */
@@ -5372,6 +5676,101 @@ declare enum DirectorWrapMode {
5372
5676
  None = 2
5373
5677
  }
5374
5678
 
5679
+ /**
5680
+ * A store for managing disposable resources (event subscriptions, listeners, callbacks)
5681
+ * that should be cleaned up together.
5682
+ *
5683
+ * DisposableStore collects disposables and disposes them all at once when
5684
+ * {@link dispose} is called. After disposal, the store can be reused — new items
5685
+ * can be added and a subsequent {@link dispose} call will clean those up.
5686
+ *
5687
+ * This is the same pattern used internally by VSCode for lifecycle-bound resource management.
5688
+ *
5689
+ * @example Basic usage
5690
+ * ```ts
5691
+ * import { DisposableStore, on } from "@needle-tools/engine";
5692
+ *
5693
+ * const store = new DisposableStore();
5694
+ *
5695
+ * // Register a DOM event listener (typed!)
5696
+ * store.add(on(window, "resize", (ev) => console.log(ev)));
5697
+ *
5698
+ * // Register the return value of EventList.on()
5699
+ * store.add(myEventList.on(data => console.log(data)));
5700
+ *
5701
+ * // Register a raw cleanup function
5702
+ * store.add(() => someSDK.off("event", handler));
5703
+ *
5704
+ * // Later: dispose everything at once
5705
+ * store.dispose();
5706
+ * ```
5707
+ *
5708
+ * @example Use with Needle Engine components
5709
+ * ```ts
5710
+ * import { Behaviour, serializable, EventList, on } from "@needle-tools/engine";
5711
+ *
5712
+ * export class MyComponent extends Behaviour {
5713
+ * @serializable(EventList)
5714
+ * onClick?: EventList;
5715
+ *
5716
+ * onEnable() {
5717
+ * // DOM events — fully typed
5718
+ * this.autoCleanup(on(window, "resize", (ev) => this.onResize(ev)));
5719
+ *
5720
+ * // EventList — .on() returns a function, autoCleanup accepts it
5721
+ * this.autoCleanup(this.onClick?.on(() => console.log("clicked!")));
5722
+ * }
5723
+ * // No onDisable needed — cleaned up automatically!
5724
+ * }
5725
+ * ```
5726
+ *
5727
+ * @category Utilities
5728
+ * @group Lifecycle
5729
+ */
5730
+ export declare class DisposableStore implements IDisposable {
5731
+ private _disposables;
5732
+ /** The number of registered disposables */
5733
+ get size(): number;
5734
+ /**
5735
+ * Register a disposable resource. Accepts:
5736
+ * - An {@link IDisposable} object (has a `dispose()` method) — e.g. from {@link on}
5737
+ * - A cleanup function (e.g. return value of `EventList.on()`)
5738
+ * - `null` or `undefined` (safe no-op for conditional subscriptions)
5739
+ *
5740
+ * When {@link dispose} is called, all registered resources are cleaned up.
5741
+ *
5742
+ * @param disposable The resource to register for disposal
5743
+ *
5744
+ * @example
5745
+ * ```ts
5746
+ * const store = new DisposableStore();
5747
+ *
5748
+ * // IDisposable object from on()
5749
+ * store.add(on(window, "resize", handler));
5750
+ *
5751
+ * // Function returned by EventList.on()
5752
+ * store.add(myEvent.on(handler));
5753
+ *
5754
+ * // Raw cleanup function
5755
+ * store.add(() => connection.close());
5756
+ *
5757
+ * // Conditional — safe with undefined
5758
+ * store.add(this.maybeEvent?.on(handler));
5759
+ * ```
5760
+ */
5761
+ add(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
5762
+ /**
5763
+ * Dispose all registered resources. Each registered disposable is cleaned up,
5764
+ * then the internal list is cleared. The store can be reused after disposal.
5765
+ *
5766
+ * Called automatically by the engine when a component's `onDisable` lifecycle fires.
5767
+ */
5768
+ dispose(): void;
5769
+ }
5770
+
5771
+ /** A function that performs cleanup when called */
5772
+ export declare type DisposeFn = () => void;
5773
+
5375
5774
  /** Recursive disposes all referenced resources by this object. Does not traverse children */
5376
5775
  export declare function disposeObjectResources(obj: object | null | undefined): void;
5377
5776
 
@@ -5479,6 +5878,12 @@ export declare class DragControls extends Component implements IPointerEventHand
5479
5878
  * providing visual feedback about the object's position relative to surfaces below it.
5480
5879
  */
5481
5880
  showGizmo: boolean;
5881
+ /** Invoked once when a drag begins (after the minimum drag distance threshold is met). */
5882
+ dragStarted: EventList;
5883
+ /** Invoked every frame while the object is being dragged. */
5884
+ dragUpdated: EventList;
5885
+ /** Invoked once when the last pointer is released and the drag ends. */
5886
+ dragEnded: EventList;
5482
5887
  /**
5483
5888
  * Returns the object currently being dragged by this DragControls component, if any.
5484
5889
  * @returns The object being dragged or null if no object is currently dragged
@@ -5919,17 +6324,43 @@ export declare class EnvironmentScene extends Scene {
5919
6324
  createAreaLightMaterial(intensity: number): MeshBasicMaterial;
5920
6325
  }
5921
6326
 
5922
- export declare const euler: EulerSerializer;
6327
+ /** An Euler value, either as a Three.js Euler or as a `[x, y, z]` tuple (radians) */
6328
+ declare type EulerValue = Euler | [number, number, number];
5923
6329
 
5924
- declare class EulerSerializer extends TypeSerializer {
5925
- constructor();
5926
- onDeserialize(data: any, _context: SerializationContext): Euler | undefined;
5927
- onSerialize(data: any, _context: SerializationContext): {
5928
- x: any;
5929
- y: any;
5930
- z: any;
5931
- order: any;
5932
- };
6330
+ /** Typed event bus. Known {@link ContextEventMap} events get full autocomplete.
6331
+ * Custom events can be typed at the call site via generic parameter.
6332
+ * @example Known events
6333
+ * ```ts
6334
+ * context.events.on("scene-content-changed", e => e.object);
6335
+ * ```
6336
+ * @example Custom events — type at call site
6337
+ * ```ts
6338
+ * context.events.emit<{ pts: number }>("scored", { pts: 10 });
6339
+ * context.events.on<{ pts: number }>("scored", e => e.pts);
6340
+ * ```
6341
+ * @example Once
6342
+ * ```ts
6343
+ * context.events.on("scene-content-changed", e => { ... }, { once: true });
6344
+ * ```
6345
+ */
6346
+ export declare class EventBus {
6347
+ private _listeners;
6348
+ /** Emit a known {@link ContextEventMap} event */
6349
+ emit<K extends keyof ContextEventMap & string>(type: K, detail?: ContextEventMap[K]): void;
6350
+ /** Emit a custom event with user-provided type */
6351
+ emit<T>(type: string, detail?: T): void;
6352
+ /** Subscribe to a known {@link ContextEventMap} event. Returns an unsubscribe function. */
6353
+ on<K extends keyof ContextEventMap & string>(type: K, callback: (args: ContextEventMap[K]) => void, options?: EventBusListenerOptions): () => void;
6354
+ /** Subscribe to a custom event with user-provided type. Returns an unsubscribe function. */
6355
+ on<T>(type: string, callback: (args: T) => void, options?: EventBusListenerOptions): () => void;
6356
+ /** Remove all listeners. Called when the context is cleared or destroyed. */
6357
+ clear(): void;
6358
+ }
6359
+
6360
+ /** Options for {@link EventBus.on}. */
6361
+ export declare interface EventBusListenerOptions {
6362
+ /** If true the listener is automatically removed after the first invocation. */
6363
+ once?: boolean;
5933
6364
  }
5934
6365
 
5935
6366
  /**
@@ -5978,13 +6409,9 @@ declare class EulerSerializer extends TypeSerializer {
5978
6409
  * @see {@link Button} for UI button events
5979
6410
  */
5980
6411
  export declare class EventList<TArgs extends any = any> implements IEventList {
6412
+ $serializedTypes: Record<string, any>;
5981
6413
  /** checked during instantiate to create a new instance */
5982
6414
  readonly isEventList = true;
5983
- /* Excluded from this release type: __internalOnInstantiate */
5984
- private target?;
5985
- private key?;
5986
- /** set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked */
5987
- setEventTarget(key: string, target: object): void;
5988
6415
  /** How many callback methods are subscribed to this event */
5989
6416
  get listenerCount(): number;
5990
6417
  /** If the event is currently being invoked */
@@ -6017,13 +6444,41 @@ export declare class EventList<TArgs extends any = any> implements IEventList {
6017
6444
  invoke(...args: Array<TArgs>): boolean;
6018
6445
  /** Add a new event listener to this event
6019
6446
  * @returns a function to remove the event listener
6447
+ * @see {@link removeEventListener} for more details and return value information
6448
+ * @see {@link off} for an alias with better readability when unsubscribing from events
6449
+ * @example
6450
+ * ```ts
6451
+ * const off = myEvent.addEventListener(args => console.log("Clicked!", args));
6452
+ * // later
6453
+ * off();
6454
+ * ```
6020
6455
  */
6021
6456
  addEventListener(callback: (args: TArgs) => void): Function;
6457
+ /**
6458
+ * Alias for addEventListener for better readability when subscribing to events. You can use it like this:
6459
+ * ```ts
6460
+ * myEvent.on(args => console.log("Clicked!", args));
6461
+ * ```
6462
+ * @returns a function to remove the event listener
6463
+ * @see {@link addEventListener} for more details and return value information
6464
+ */
6465
+ on(callback: (args: TArgs) => void): Function;
6022
6466
  /**
6023
6467
  * Remove an event listener from this event.
6024
6468
  * @returns true if the event listener was found and removed, false otherwise
6025
6469
  */
6026
6470
  removeEventListener(fn: Function | null | undefined): boolean;
6471
+ /**
6472
+ * Alias for removeEventListener for better readability when unsubscribing from events. You can use it like this:
6473
+ * ```ts
6474
+ * const off = myEvent.on(args => console.log("Clicked!", args));
6475
+ * // later
6476
+ * off();
6477
+ * ```
6478
+ *
6479
+ * @see {@link removeEventListener} for more details and return value information
6480
+ */
6481
+ off(callback: Function | null | undefined): boolean;
6027
6482
  /**
6028
6483
  * Remove all event listeners from this event. Use with caution! This will remove all listeners!
6029
6484
  */
@@ -6054,6 +6509,7 @@ declare type EventListenerOptions_2 = {
6054
6509
  signal?: AbortSignal;
6055
6510
  };
6056
6511
 
6512
+ /** @deprecated No longer automatically dispatched. Use `eventList.on()` directly instead. */
6057
6513
  export declare class EventListEvent<TArgs extends any> extends Event {
6058
6514
  args?: TArgs;
6059
6515
  }
@@ -6064,7 +6520,7 @@ declare class EventListSerializer extends TypeSerializer {
6064
6520
  onDeserialize(data: EventListData, context: SerializationContext): EventList<any> | undefined | null;
6065
6521
  }
6066
6522
 
6067
- export declare const eventListSerializer: EventListSerializer;
6523
+ export declare let eventListSerializer: EventListSerializer;
6068
6524
 
6069
6525
  /**
6070
6526
  * [EventSystem](https://engine.needle.tools/docs/api/EventSystem) is responsible for managing and dispatching input events to UI components within the scene.
@@ -6507,7 +6963,7 @@ declare type FitParameters = {
6507
6963
  * @see {@link HingeJoint} for rotating connections
6508
6964
  */
6509
6965
  export declare class FixedJoint extends Joint {
6510
- protected createJoint(self: Rigidbody, other: Rigidbody): void;
6966
+ protected createJoint(self: Rigidbody, other: Rigidbody): any;
6511
6967
  }
6512
6968
 
6513
6969
  declare type FocusRect = DOMRect | Element | {
@@ -7159,16 +7615,13 @@ export declare function getResourceUserCount(object: object): number | undefined
7159
7615
  * Returns a lazily-resolved proxy typed as {@link SceneData}.
7160
7616
  * The proxy is cached per context — each context gets exactly one instance.
7161
7617
  *
7162
- * Accessing a property traverses the scene graph on demand:
7163
- * - First level → find Object3D by node name
7164
- * - Second level getComponent by component name (via TypeStore)
7165
- * - Third level read/write a field on the real component instance
7166
- *
7167
- * If a node or component is not found, property accesses log a warning
7168
- * instead of throwing, so chained access never crashes.
7618
+ * Shape mirrors the generated `needle-bindings.gen.d.ts`:
7619
+ * ctx.sceneData.MyGlb.Camera.$components.OrbitControls.autoRotate = true;
7620
+ * ctx.sceneData.MyGlb.Camera.$object //THREE.Camera
7621
+ * ctx.sceneData.MyGlb.UI.Button.$components.Button //Needle Button component
7169
7622
  *
7170
- * @example
7171
- * ctx.sceneData.Camera.OrbitControls.autoRotate = true;
7623
+ * GLB name is ignored at runtime (scene is already loaded).
7624
+ * Node lookup starts at the scene root.
7172
7625
  */
7173
7626
  export declare function getSceneData(ctx: IContext): SceneData;
7174
7627
 
@@ -7761,7 +8214,7 @@ export declare class HingeJoint extends Joint {
7761
8214
  anchor?: Vector3;
7762
8215
  /** Axis of rotation for the hinge (e.g., Vector3(0,1,0) for vertical axis) */
7763
8216
  axis?: Vector3;
7764
- protected createJoint(self: Rigidbody, other: Rigidbody): void;
8217
+ protected createJoint(self: Rigidbody, other: Rigidbody): any;
7765
8218
  }
7766
8219
 
7767
8220
  declare type HitPointObject = Object3D & {
@@ -7984,7 +8437,7 @@ declare const HTMLElementBase: typeof HTMLElement;
7984
8437
 
7985
8438
  export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
7986
8439
  isAnimationComponent: boolean;
7987
- addClip?(clip: AnimationClip): any;
8440
+ addClip?(clip: AnimationClip): void;
7988
8441
  };
7989
8442
 
7990
8443
  /* Excluded from this release type: IApplyPrototypeExtension */
@@ -8058,6 +8511,12 @@ export declare interface ICollider extends IComponent {
8058
8511
  * Default: undefined
8059
8512
  */
8060
8513
  filter?: number[];
8514
+ /** The density of the collider used for automatic mass calculation.
8515
+ * When the attached Rigidbody has `autoMass` enabled, the mass is computed as `density × volume`.
8516
+ * Note: Make sure to call updateProperties after having changed this property
8517
+ * Default: undefined (uses physics engine default of 1.0)
8518
+ */
8519
+ density?: number;
8061
8520
  }
8062
8521
 
8063
8522
  export declare type ICollisionContext = {
@@ -8084,7 +8543,6 @@ export declare interface IComponent extends IHasGuid {
8084
8543
  /* Excluded from this release type: __internalEnable */
8085
8544
  /* Excluded from this release type: __internalDisable */
8086
8545
  /* Excluded from this release type: __internalDestroy */
8087
- /* Excluded from this release type: resolveGuids */
8088
8546
  /** experimental, called when the script is registered for the first time, this is called even if the component is not enabled. */
8089
8547
  registering?(): any;
8090
8548
  awake(): any;
@@ -8121,6 +8579,24 @@ export declare interface IConnectionData {
8121
8579
 
8122
8580
  export declare type IContext = Context;
8123
8581
 
8582
+ /**
8583
+ * Interface for objects that hold resources and can be disposed.
8584
+ * Implement this interface on any object that needs deterministic cleanup.
8585
+ *
8586
+ * @example
8587
+ * ```ts
8588
+ * class MyResource implements IDisposable {
8589
+ * dispose() { /* release resources *\/ }
8590
+ * }
8591
+ * ```
8592
+ *
8593
+ * @category Utilities
8594
+ * @group Lifecycle
8595
+ */
8596
+ export declare interface IDisposable {
8597
+ dispose(): void;
8598
+ }
8599
+
8124
8600
  /** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
8125
8601
  declare interface IEditorModification {
8126
8602
  /**
@@ -8140,7 +8616,6 @@ export declare interface IEffectProvider {
8140
8616
 
8141
8617
  export declare interface IEventList {
8142
8618
  readonly isEventList: true;
8143
- __internalOnInstantiate(map: InstantiateContext): IEventList;
8144
8619
  }
8145
8620
 
8146
8621
  export declare interface IGameObject extends Object3D {
@@ -8241,6 +8716,8 @@ declare interface ILayoutGroup extends IComponent {
8241
8716
  export declare interface ILight extends IComponent {
8242
8717
  intensity: number;
8243
8718
  color: Color;
8719
+ /** The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"` */
8720
+ readonly type: "directional" | "point" | "spot";
8244
8721
  }
8245
8722
 
8246
8723
  declare interface ILightDataRegistry {
@@ -8431,13 +8908,45 @@ export declare interface INeedleXRSessionEventReceiver extends Pick<IComponent,
8431
8908
  export declare interface INetworkConnection {
8432
8909
  get isConnected(): boolean;
8433
8910
  get isInRoom(): boolean;
8434
- send(key: string, data: IModel | object | boolean | null | string | number, queue: SendQueue): unknown;
8911
+ send(key: string, data?: IModel | object | boolean | string | number, queue?: SendQueue): unknown;
8435
8912
  }
8436
8913
 
8437
8914
  export declare interface INetworkingWebsocketUrlProvider {
8438
8915
  getWebsocketUrl(): string | null;
8439
8916
  }
8440
8917
 
8918
+ /**
8919
+ * @experimental
8920
+ * Interface for a network transport layer used by {@link NetworkConnection}.
8921
+ * The default implementation wraps a websocket via `websocket-ts`.
8922
+ * Custom implementations can be injected into {@link NetworkConnection.connect}
8923
+ * for testing or alternative transports.
8924
+ *
8925
+ * **Lifecycle:** After creating a transport and passing it to `connect()`,
8926
+ * `NetworkConnection` sets the four event callbacks (`onOpen`, `onClose`,
8927
+ * `onError`, `onMessage`) and then calls {@link start}. The transport
8928
+ * should call `onOpen` when the connection is ready.
8929
+ */
8930
+ export declare interface INetworkTransport {
8931
+ /** Start the connection. Called by NetworkConnection after event callbacks are set.
8932
+ * May return a promise if setup is async (e.g. dynamic imports). */
8933
+ start(): void | Promise<void>;
8934
+ /** Send data (string for JSON messages, Uint8Array for binary) */
8935
+ send(data: string | Uint8Array): void;
8936
+ /** Close the transport */
8937
+ close(): void | Promise<void>;
8938
+ /** The URL this transport is connected to, if applicable */
8939
+ readonly url: string | undefined;
8940
+ /** Called when the transport connection opens */
8941
+ onOpen: (() => void) | null;
8942
+ /** Called when the transport connection closes */
8943
+ onClose: (() => void) | null;
8944
+ /** Called when an error occurs */
8945
+ onError: ((err: any) => void) | null;
8946
+ /** Called when a message is received. Data is either a string (JSON) or Blob (binary). */
8947
+ onMessage: ((data: string | Blob) => void) | null;
8948
+ }
8949
+
8441
8950
  export declare class InheritVelocityModule {
8442
8951
  enabled: boolean;
8443
8952
  curve: MinMaxCurve;
@@ -8457,10 +8966,20 @@ export declare class InheritVelocityModule {
8457
8966
  applyCurrent(vel: Vector3 | Vector3_2, t01: number, lerpFactor: number): void;
8458
8967
  }
8459
8968
 
8969
+ /* Excluded from this release type: initAddressableSerializers */
8970
+
8971
+ /** Register all builtin serializers and prototype patches.
8972
+ * Must be called from {@link initEngine} so the registrations survive tree-shaking
8973
+ * when the package declares `sideEffects: false`.
8974
+ */
8975
+ export declare function initBuiltinSerializers(): void;
8976
+
8460
8977
  /** Register the Rapier physics backend. Called from {@link initEngine}
8461
8978
  * to ensure it runs regardless of tree-shaking. */
8462
8979
  export declare function initPhysics(): void;
8463
8980
 
8981
+ /* Excluded from this release type: initVolumeParameterSerializer */
8982
+
8464
8983
  /**
8465
8984
  * Handles all input events including mouse, touch, keyboard, and XR controllers.
8466
8985
  * Access via `this.context.input` from any component.
@@ -8514,14 +9033,33 @@ export declare class Input implements IInput {
8514
9033
  */
8515
9034
  private readonly _eventListeners;
8516
9035
  /** Adds an event listener for the specified event type. The callback will be called when the event is triggered.
9036
+ *
9037
+ * Returns an unsubscribe function — call it to remove the listener.
9038
+ * Pass it to {@link Behaviour.autoCleanup} for automatic lifecycle management.
9039
+ *
8517
9040
  * @param type The event type to listen for
8518
9041
  * @param callback The callback to call when the event is triggered
8519
9042
  * @param options The options for adding the event listener.
8520
- * @example Basic usage
9043
+ * @returns A function that removes the event listener when called.
9044
+ *
9045
+ * @example With autoCleanup (recommended)
8521
9046
  * ```ts
8522
- * input.addEventListener("pointerdown", (evt) => {
9047
+ * export class MyComponent extends Behaviour {
9048
+ * onEnable() {
9049
+ * this.autoCleanup(this.context.input.addEventListener("pointerdown", (evt) => {
9050
+ * console.log("Pointer down", evt.pointerId, evt.pointerType);
9051
+ * }));
9052
+ * }
9053
+ * // Listener is automatically removed on disable — no manual cleanup needed!
9054
+ * }
9055
+ * ```
9056
+ * @example Manual unsubscribe
9057
+ * ```ts
9058
+ * const off = input.addEventListener("pointerdown", (evt) => {
8523
9059
  * console.log("Pointer down", evt.pointerId, evt.pointerType);
8524
9060
  * });
9061
+ * // later
9062
+ * off();
8525
9063
  * ```
8526
9064
  * @example Adding a listener that is called after all other listeners
8527
9065
  * By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
@@ -8537,8 +9075,8 @@ export declare class Input implements IInput {
8537
9075
  * }, { once: true });
8538
9076
  * ```
8539
9077
  */
8540
- addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): any;
8541
- addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): any;
9078
+ addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): () => void;
9079
+ addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): () => void;
8542
9080
  /** Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
8543
9081
  * @param type The event type to remove the listener from
8544
9082
  * @param callback The callback to remove
@@ -8984,7 +9522,7 @@ export declare function instantiate(instance: AssetReference, opts?: IInstantiat
8984
9522
  export declare function instantiate(instance: IGameObject | Object3D, opts?: IInstantiateOptions | null): IGameObject;
8985
9523
 
8986
9524
  /**
8987
- * Provides access to the instantiated object and its clone
9525
+ * Provides access to the instantiated object map (used by EventList etc.)
8988
9526
  */
8989
9527
  export declare type InstantiateContext = Readonly<InstantiateReferenceMap>;
8990
9528
 
@@ -9024,7 +9562,8 @@ export declare class InstantiateOptions implements IInstantiateOptions {
9024
9562
  cloneAssign(other: InstantiateOptions | IInstantiateOptions): void;
9025
9563
  }
9026
9564
 
9027
- declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
9565
+ /** Maps uuid/guid { original, clone } for Object3D and Component instances */
9566
+ export declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
9028
9567
 
9029
9568
  /**
9030
9569
  * An empty component that can be used to mark an object as interactable.
@@ -9095,8 +9634,10 @@ export declare interface IPhysicsEngine {
9095
9634
  postStep(): any;
9096
9635
  /** Indicates whether the physics engine is currently updating */
9097
9636
  get isUpdating(): boolean;
9098
- /** Clears all cached data (e.g., mesh data when creating scaled mesh colliders) */
9099
- clearCaches(): any;
9637
+ /** Tears down the physics world and frees all resources. The world will be re-created on next use. */
9638
+ dispose(): void;
9639
+ /** @deprecated Use {@link dispose} instead. */
9640
+ clearCaches(): void;
9100
9641
  /** Enables or disables the physics engine */
9101
9642
  enabled: boolean;
9102
9643
  /** Returns the underlying physics world object */
@@ -9143,6 +9684,11 @@ export declare interface IPhysicsEngine {
9143
9684
  * @returns False to ignore this collider, true to include it
9144
9685
  */
9145
9686
  filterPredicate?: (collider: ICollider) => boolean;
9687
+ /** When true, trigger/sensor colliders will be included in the raycast results.
9688
+ * By default trigger colliders are skipped.
9689
+ * @default false
9690
+ */
9691
+ includeTriggers?: boolean;
9146
9692
  }): RaycastResult;
9147
9693
  /**
9148
9694
  * Performs a raycast that also returns the normal vector at the hit point
@@ -9170,6 +9716,11 @@ export declare interface IPhysicsEngine {
9170
9716
  * @returns False to ignore this collider, true to include it
9171
9717
  */
9172
9718
  filterPredicate?: (collider: ICollider) => boolean;
9719
+ /** When true, trigger/sensor colliders will be included in the raycast results.
9720
+ * By default trigger colliders are skipped.
9721
+ * @default false
9722
+ */
9723
+ includeTriggers?: boolean;
9173
9724
  }): RaycastResult;
9174
9725
  /**
9175
9726
  * Finds all colliders within a sphere
@@ -9326,8 +9877,9 @@ export declare interface IPhysicsEngine {
9326
9877
  * @returns The underlying physics body or null if not found
9327
9878
  */
9328
9879
  getBody(obj: ICollider | IRigidbody): null | any;
9329
- addFixedJoint(body1: IRigidbody, body2: IRigidbody): any;
9330
- addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): any;
9880
+ addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<any> | any;
9881
+ addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): Promise<any> | any;
9882
+ removeJoint(joint: any): void;
9331
9883
  /** Enable to render collider shapes */
9332
9884
  debugRenderColliders: boolean;
9333
9885
  /** Enable to visualize raycasts in the scene with gizmos */
@@ -9548,6 +10100,18 @@ export declare function isDestroyed(go: Object3D): boolean;
9548
10100
  /** True when the application runs on a local url */
9549
10101
  export declare function isDevEnvironment(): boolean;
9550
10102
 
10103
+ /**
10104
+ * Type guard to check if an object implements {@link IDisposable}.
10105
+ *
10106
+ * @example
10107
+ * ```ts
10108
+ * if (isDisposable(obj)) {
10109
+ * obj.dispose(); // safe to call
10110
+ * }
10111
+ * ```
10112
+ */
10113
+ export declare function isDisposable(value: unknown): value is IDisposable;
10114
+
9551
10115
  export declare function isDisposed(obj: object): boolean;
9552
10116
 
9553
10117
  export declare interface ISerializable {
@@ -9582,6 +10146,10 @@ export declare function isHotReloadEnabled(): boolean;
9582
10146
  /**@returns true if the element is an needle engine icon element */
9583
10147
  export declare function isIconElement(element: Node): boolean;
9584
10148
 
10149
+ export declare interface ISignalReceiver {
10150
+ readonly isSignalReceiver: true;
10151
+ }
10152
+
9585
10153
  /** @deprecated use {@link DeviceUtilities.isiOS} instead */
9586
10154
  export declare function isiOS(): boolean;
9587
10155
 
@@ -9616,6 +10184,8 @@ export declare function isResourceTrackingEnabled(): boolean;
9616
10184
  /** @deprecated use {@link DeviceUtilities.isSafari} instead */
9617
10185
  export declare function isSafari(): boolean;
9618
10186
 
10187
+ export declare function isTrackModel(obj: unknown): obj is TrackModel;
10188
+
9619
10189
  export declare function isUsingInstancing(instance: Object3D): boolean;
9620
10190
 
9621
10191
  export declare interface ITime {
@@ -9740,7 +10310,9 @@ declare abstract class Joint extends Component {
9740
10310
  connectedBody?: Rigidbody;
9741
10311
  get rigidBody(): Rigidbody | null;
9742
10312
  private _rigidBody;
10313
+ private _jointHandle;
9743
10314
  onEnable(): void;
10315
+ onDisable(): void;
9744
10316
  private create;
9745
10317
  protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
9746
10318
  }
@@ -9782,6 +10354,15 @@ declare class Keyframe_2 {
9782
10354
  }
9783
10355
  export { Keyframe_2 as Keyframe }
9784
10356
 
10357
+ /** Keyframe array or tween shorthand */
10358
+ declare type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
10359
+
10360
+ /** Keyframe array or tween shorthand */
10361
+ declare type KF_2<V> = AnimationKeyframe<V>[] | Tween<V>;
10362
+
10363
+ /** Keyframe array or tween shorthand */
10364
+ declare type KF_3<V> = AnimationKeyframe<V>[] | Tween<V>;
10365
+
9785
10366
  declare type LabelHandle = {
9786
10367
  setText(str: string): any;
9787
10368
  };
@@ -9878,10 +10459,13 @@ declare type LifecycleMethodOptions = {
9878
10459
  */
9879
10460
  export declare class Light extends Component implements ILight {
9880
10461
  /**
9881
- * The type of light (spot, directional, point, etc.)
9882
- * Can not be changed at runtime.
10462
+ * The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"`.
10463
+ * Implements {@link ILight.type}. Can not be changed at runtime.
9883
10464
  */
9884
- private type;
10465
+ get type(): ILight["type"];
10466
+ /** Numeric LightType serialized from Unity/Blender — converts to string on write */
10467
+ set type(value: LightType | ILight["type"]);
10468
+ private _type;
9885
10469
  /**
9886
10470
  * The maximum distance the light affects.
9887
10471
  * Only applicable for spot and point lights.
@@ -9987,11 +10571,6 @@ export declare class Light extends Component implements ILight {
9987
10571
  * and applies all settings like shadows, intensity, and color.
9988
10572
  */
9989
10573
  createLight(): void;
9990
- /**
9991
- * Coroutine that updates the main light reference in the context
9992
- * if this directional light should be the main light
9993
- */
9994
- updateMainLightRoutine(): Generator<undefined, void, unknown>;
9995
10574
  /**
9996
10575
  * Controls whether the renderer's shadow map type can be changed when soft shadows are used
9997
10576
  */
@@ -10040,6 +10619,25 @@ declare enum LightShadows {
10040
10619
  Soft = 2
10041
10620
  }
10042
10621
 
10622
+ /**
10623
+ * Defines the type of light in a scene.
10624
+ * @see {@link Light} for configuring light properties and behavior
10625
+ */
10626
+ declare enum LightType {
10627
+ /** Spot light that emits light in a cone shape */
10628
+ Spot = 0,
10629
+ /** Directional light that emits parallel light rays in a specific direction */
10630
+ Directional = 1,
10631
+ /** Point light that emits light in all directions from a single point */
10632
+ Point = 2,
10633
+ /** Area light */
10634
+ Area = 3,
10635
+ /** Rectangle shaped area light that only affects baked lightmaps and light probes */
10636
+ Rectangle = 3,
10637
+ /** Disc shaped area light that only affects baked lightmaps and light probes */
10638
+ Disc = 4
10639
+ }
10640
+
10043
10641
  export declare class LimitVelocityOverLifetimeModule {
10044
10642
  enabled: boolean;
10045
10643
  dampen: number;
@@ -10433,13 +11031,15 @@ export declare function markAsInstancedRendered(go: Object3D, instanced: boolean
10433
11031
  time: number;
10434
11032
  }
10435
11033
 
10436
- export declare class MarkerTrackHandler extends TrackHandler {
10437
- models: Array<Models.MarkerModel & Record<string, any>>;
10438
- needsSorting: boolean;
10439
- foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
10440
- onEnable(): void;
10441
- evaluate(_time: number): void;
10442
- private sort;
11034
+ /**
11035
+ * Builder for marker tracks. Provides `.marker()` for adding markers.
11036
+ * @category Animation and Sequencing
11037
+ */
11038
+ export declare interface MarkerTrackBuilder extends TimelineBuilderBase {
11039
+ /** Adds a marker referencing a signal asset by guid */
11040
+ marker(time: number, asset: string, options?: SignalMarkerOptions): MarkerTrackBuilder;
11041
+ /** Mutes this track so it is skipped during playback */
11042
+ muted(muted?: boolean): MarkerTrackBuilder;
10443
11043
  }
10444
11044
 
10445
11045
  export declare enum MarkerType {
@@ -10985,6 +11585,7 @@ export declare type Model = (GLTF | FBX | OBJ | CustomModel);
10985
11585
 
10986
11586
  declare namespace Models {
10987
11587
  export {
11588
+ isTrackModel,
10988
11589
  TimelineAssetModel,
10989
11590
  TrackType,
10990
11591
  ClipExtrapolation,
@@ -11028,15 +11629,13 @@ export declare type MouseButtonName = "left" | "right" | "middle";
11028
11629
  /* Excluded from this release type: nameofFactory */
11029
11630
 
11030
11631
  /**
11031
- * Global proxy for the primary Needle Engine context.
11032
- * Resolves lazily on property access via `ContextRegistry.Current` —
11033
- * safe to import at module level, including in SSR environments
11034
- * (returns a silent error proxy when no context is active).
11632
+ * Quick access to the current Needle Engine context from anywhere — no need to pass `ctx` around.
11633
+ * Use it in React/Svelte/Vue components, button handlers, or plain JavaScript.
11035
11634
  *
11036
- * Use this outside of Needle component lifecycle (e.g. in Svelte/React/Vue
11037
- * components, button handlers, or vanilla JS) instead of threading `ctx` around.
11635
+ * Safe to import at module level, including in SSR environments.
11636
+ * For pages with multiple `<needle-engine>` elements, use `ctx` directly instead.
11038
11637
  *
11039
- * For multiple `<needle-engine>` elements on the same page, use `ctx` directly.
11638
+ * @experimental This API may change in future releases.
11040
11639
  *
11041
11640
  * @example
11042
11641
  * import { needle } from "@needle-tools/engine";
@@ -11194,11 +11793,17 @@ export declare interface NeedleEngineAttributes {
11194
11793
  'hash': string;
11195
11794
  /** Set to automatically add OrbitControls to the loaded scene. */
11196
11795
  'camera-controls': string;
11197
- /** Override the default draco decoder path location. */
11796
+ /** Override the default Draco decoder/decompressor path. Can be a URL or a local path to a directory containing the Draco decoder files.
11797
+ * @default "https://www.gstatic.com/draco/versioned/decoders/1.5.7/"
11798
+ * @example <needle-engine dracoDecoderPath="./decoders/draco/"></needle-engine>
11799
+ */
11198
11800
  'dracoDecoderPath': string;
11199
- /** Override the default draco library type. */
11801
+ /** Override the default Draco decoder type. */
11200
11802
  'dracoDecoderType': 'wasm' | 'js';
11201
- /** Override the default KTX2 transcoder/decoder path. */
11803
+ /** Override the default KTX2 transcoder/decoder path. Can be a URL or a local path to a directory containing the KTX2 transcoder files.
11804
+ * @default "https://cdn.needle.tools/static/three/0.179.1/basis2/"
11805
+ * @example <needle-engine ktx2DecoderPath="./decoders/ktx2/"></needle-engine>
11806
+ */
11202
11807
  'ktx2DecoderPath': string;
11203
11808
  /** Prevent context from being disposed when element is removed from DOM. */
11204
11809
  'keep-alive': 'true' | 'false';
@@ -12152,8 +12757,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
12152
12757
  get referenceSpace(): XRSpace | null;
12153
12758
  /** @returns the XRFrame `viewerpose` using the xr `referenceSpace` */
12154
12759
  get viewerPose(): XRViewerPose | undefined;
12155
- /** @returns `true` if any image is currently being tracked */
12156
- /** returns true if images are currently being tracked */
12760
+ /** @returns `true` if any image is currently being tracked or emulated */
12157
12761
  get isTrackingImages(): boolean;
12158
12762
  /** The currently active XR rig */
12159
12763
  get rig(): IXRRig | null;
@@ -12199,6 +12803,8 @@ export declare class NeedleXRSession implements INeedleXRSession {
12199
12803
  private readonly _xr_update_scripts;
12200
12804
  /** scripts that are in the scene but inactive (e.g. disabled parent gameObject) */
12201
12805
  private readonly _inactive_scripts;
12806
+ /** tracks scripts that have received onEnterXR — prevents spurious onLeaveXR calls */
12807
+ private readonly _scripts_in_xr;
12202
12808
  private readonly _controllerAdded;
12203
12809
  private readonly _controllerRemoved;
12204
12810
  private readonly _originalCameraWorldPosition?;
@@ -12586,7 +13192,7 @@ export declare class NetworkConnection implements INetworkConnection {
12586
13192
  /** Use to leave a room that you are currently connected to (use `leaveRoom()` to disconnect from the currently active room but you can also specify a room name) */
12587
13193
  leaveRoom(room?: string | null): boolean;
12588
13194
  /** Send a message to the networking backend - it will be broadcasted to all connected users (except yourself) in the same room by default */
12589
- send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType) | null, queue?: SendQueue): void;
13195
+ send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType), queue?: SendQueue): void;
12590
13196
  /**
12591
13197
  * Deletes the network state for a specific object on the server.
12592
13198
  * This removes the object's state from the room, preventing it from being sent to newly joining users.
@@ -12608,61 +13214,69 @@ export declare class NetworkConnection implements INetworkConnection {
12608
13214
  private _defaultMessagesBufferArray;
12609
13215
  sendBufferedMessagesNow(): void;
12610
13216
  /** Use to start listening to networking events.
12611
- * To unsubscribe from events use the `{@link stopListen}` method.
13217
+ * Returns an unsubscribe function that removes the listener when called.
13218
+ * The returned function can also be passed to {@link stopListen} or {@link Component.autoCleanup} for automatic lifecycle management.
12612
13219
  *
12613
- * @example Custom event example
13220
+ * @example With autoCleanup (recommended)
12614
13221
  * ```ts
12615
- * // Listen to a custom event sent by the server
12616
- * this.context.connection.beginListen<MyDataType>("my-custom-event", (data) => {
12617
- * console.log("Received custom event:", data);
12618
- * });
13222
+ * export class MyComponent extends Behaviour {
13223
+ * onEnable() {
13224
+ * this.autoCleanup(this.context.connection.beginListen("joined-room", () => {
13225
+ * console.log("I joined a networked room");
13226
+ * }));
13227
+ * }
13228
+ * // Automatically unsubscribed on disable — no manual cleanup needed!
13229
+ * }
13230
+ * ```
13231
+ *
13232
+ * @example Manual unsubscribe
13233
+ * ```ts
13234
+ * const unsub = this.context.connection.beginListen("joined-room", () => { });
13235
+ * // Later:
13236
+ * unsub(); // removes the listener
12619
13237
  * ```
12620
13238
  *
12621
- * @example Listening to room events
13239
+ * @example With stopListen (legacy pattern, still supported)
12622
13240
  * ```ts
12623
- * // Make sure to unsubscribe from events when the component is disabled
12624
13241
  * export class MyComponent extends Behaviour {
12625
13242
  * onEnable() {
12626
- * this.connection.beginListen("joined-room", this.onJoinedRoom)
13243
+ * this.context.connection.beginListen("joined-room", this.onJoinedRoom);
12627
13244
  * }
12628
13245
  * onDisable() {
12629
- * this.connection.stopListen("joined-room", this.onJoinedRoom)
13246
+ * this.context.connection.stopListen("joined-room", this.onJoinedRoom);
12630
13247
  * }
12631
13248
  * onJoinedRoom = () => {
12632
- * console.log("I joined a networked room")
13249
+ * console.log("I joined a networked room");
12633
13250
  * }
12634
13251
  * }
12635
13252
  * ```
12636
13253
  * @link https://engine.needle.tools/docs/networking.html
12637
13254
  *
12638
13255
  */
12639
- beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void): K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void;
13256
+ beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void): DisposeFn;
12640
13257
  /**@deprecated please use stopListen instead (2.65.2-pre) */
12641
13258
  stopListening<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | null): void;
12642
- /** Use to stop listening to networking events
13259
+ /** Use to stop listening to networking events.
13260
+ * Accepts either the original callback or the unsubscribe function returned by {@link beginListen}.
12643
13261
  * To subscribe to events use the `{@link beginListen}` method.
12644
- * See the example below for typical usage:
12645
13262
  *
12646
- * ### Component Example
13263
+ * @example
12647
13264
  * ```ts
12648
- * // Make sure to unsubscribe from events when the component is disabled
12649
- * export class MyComponent extends Behaviour {
12650
- * onEnable() {
12651
- * this.connection.beginListen("joined-room", this.onJoinedRoom)
12652
- * }
12653
- * onDisable() {
12654
- * this.connection.stopListen("joined-room", this.onJoinedRoom)
12655
- * }
12656
- * onJoinedRoom = () => {
12657
- * console.log("I joined a networked room")
12658
- * }
12659
- * }
13265
+ * // Both patterns work:
13266
+ * this.context.connection.stopListen("joined-room", this.onJoinedRoom); // original callback
13267
+ * this.context.connection.stopListen("joined-room", unsub); // unsubscribe fn from beginListen
12660
13268
  * ```
12661
13269
  */
12662
- stopListen<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | null): void;
12663
- /** Use to start listening to networking binary events */
12664
- beginListenBinary(identifier: string, callback: BinaryCallback): BinaryCallback;
12665
- /** Use to stop listening to networking binary events */
13270
+ private static _didLogStopListenHint;
13271
+ stopListen<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | Function | null): void;
13272
+ /** Use to start listening to networking binary events.
13273
+ * Returns an unsubscribe function that removes the listener when called.
13274
+ * The returned function can also be passed to {@link stopListenBinary} or {@link Component.autoCleanup}.
13275
+ */
13276
+ beginListenBinary(identifier: string, callback: BinaryCallback): DisposeFn;
13277
+ /** Use to stop listening to networking binary events.
13278
+ * Accepts either the original callback or the unsubscribe function returned by {@link beginListenBinary}.
13279
+ */
12666
13280
  stopListenBinary(identifier: string, callback: any): void;
12667
13281
  private netWebSocketUrlProvider?;
12668
13282
  /** Use to override the networking server backend url.
@@ -12671,16 +13285,19 @@ export declare class NetworkConnection implements INetworkConnection {
12671
13285
  registerProvider(prov: INetworkingWebsocketUrlProvider): void;
12672
13286
  /** Used to connect to the networking server
12673
13287
  * @param url Optional url to connect to. If not provided, it will use the url from the registered `INetworkingWebsocketUrlProvider` or the default backend networking url. If you want to change the url after connecting, you need to disconnect first and then connect again with the new url.
13288
+ * @param transport Optional custom transport to use instead of the default websocket. Useful for testing or alternative transports.
12674
13289
  */
12675
- connect(url?: string): Promise<boolean>;
13290
+ connect(url?: string, transport?: INetworkTransport): Promise<boolean>;
12676
13291
  /** Disconnect from the networking backend + reset internal state */
12677
13292
  disconnect(): void;
13293
+ /** Full teardown: disconnect, clear all listeners, and release all resources.
13294
+ * Called when the owning Context is destroyed. After dispose(), this instance should not be reused. */
13295
+ dispose(): void;
12678
13296
  private _listeners;
12679
13297
  private _listenersBinary;
12680
13298
  private connected;
12681
- private channelId;
12682
13299
  private _connectionId;
12683
- private _ws;
13300
+ private _transport;
12684
13301
  private _waitingForSocket;
12685
13302
  private _isInRoom;
12686
13303
  private _currentRoomName;
@@ -12690,6 +13307,8 @@ export declare class NetworkConnection implements INetworkConnection {
12690
13307
  private _state;
12691
13308
  private _currentDelay;
12692
13309
  private _connectingToWebsocketPromise;
13310
+ /** Wire up a transport's event callbacks and start it */
13311
+ private connectTransport;
12693
13312
  private connectWebsocket;
12694
13313
  private onMessage;
12695
13314
  private handleIncomingBinaryMessage;
@@ -12818,7 +13437,7 @@ export declare interface NetworkEventMap {
12818
13437
  * @see {@link RoomEvents} for room lifecycle events
12819
13438
  * @see {@link isLocalNetwork} for local network detection
12820
13439
  * @link https://engine.needle.tools/docs/how-to-guides/networking/
12821
- * @summary Networking configuration
13440
+ * @summary Configures the websocket server URL for multiplayer networking
12822
13441
  * @category Networking
12823
13442
  * @group Components
12824
13443
  */
@@ -12955,7 +13574,7 @@ export declare type OBJ = {
12955
13574
  scenes: Object3D[];
12956
13575
  };
12957
13576
 
12958
- declare type ObjectCloneReference = {
13577
+ export declare type ObjectCloneReference = {
12959
13578
  readonly original: object;
12960
13579
  readonly clone: object;
12961
13580
  };
@@ -13039,7 +13658,7 @@ declare class ObjectSerializer extends TypeSerializer {
13039
13658
  onDeserialize(data: ObjectData | string | null, context: SerializationContext): Object3D<Object3DEventMap> | Component | null | undefined;
13040
13659
  }
13041
13660
 
13042
- export declare const objectSerializer: ObjectSerializer;
13661
+ export declare let objectSerializer: ObjectSerializer;
13043
13662
 
13044
13663
  declare type ObjectToNodeMap = {
13045
13664
  [uuid: string]: number;
@@ -13162,6 +13781,61 @@ export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void):
13162
13781
  */
13163
13782
  export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
13164
13783
 
13784
+ /**
13785
+ * @experimental
13786
+ * Subscribe to a DOM event on any {@link EventTarget} (window, document, HTML elements, etc.)
13787
+ * and return an {@link IDisposable} that removes the listener when disposed.
13788
+ *
13789
+ * Provides full TypeScript event type inference — the callback parameter
13790
+ * is automatically typed based on the event name (e.g. `"resize"` → `UIEvent`,
13791
+ * `"click"` → `MouseEvent`).
13792
+ *
13793
+ * Use with {@link DisposableStore.add} for automatic lifecycle cleanup in components.
13794
+ *
13795
+ * @param target The EventTarget to listen on (window, document, an element, etc.)
13796
+ * @param type The event name (e.g. `"resize"`, `"click"`, `"keydown"`)
13797
+ * @param listener The event handler callback
13798
+ * @param options Optional addEventListener options (passive, capture, once, signal)
13799
+ * @returns An {@link IDisposable} that removes the event listener when disposed
13800
+ *
13801
+ * @example Standalone usage
13802
+ * ```ts
13803
+ * import { on } from "@needle-tools/engine";
13804
+ *
13805
+ * const sub = on(window, "resize", (ev) => {
13806
+ * // ev is typed as UIEvent
13807
+ * console.log("resized", ev.target);
13808
+ * });
13809
+ *
13810
+ * // Later: clean up
13811
+ * sub.dispose();
13812
+ * ```
13813
+ *
13814
+ * @example With autoCleanup in a component
13815
+ * ```ts
13816
+ * import { Behaviour, on } from "@needle-tools/engine";
13817
+ *
13818
+ * export class MyComponent extends Behaviour {
13819
+ * onEnable() {
13820
+ * this.autoCleanup(on(window, "resize", (ev) => { /* UIEvent *\/ }));
13821
+ * this.autoCleanup(on(document, "keydown", (ev) => { /* KeyboardEvent *\/ }));
13822
+ * this.autoCleanup(on(this.context.domElement, "click", (ev) => { /* MouseEvent *\/ }));
13823
+ * }
13824
+ * // All listeners removed automatically on disable!
13825
+ * }
13826
+ * ```
13827
+ *
13828
+ * @category Utilities
13829
+ * @group Lifecycle
13830
+ */
13831
+ export declare function on<K extends keyof WindowEventMap>(target: Window, type: K, listener: (ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13832
+
13833
+ export declare function on<K extends keyof DocumentEventMap>(target: Document, type: K, listener: (ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13834
+
13835
+ export declare function on<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13836
+
13837
+ export declare function on(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): IDisposable;
13838
+
13165
13839
  /**
13166
13840
  * Register a callback in the engine onAfterRender event
13167
13841
  * This is called every frame after the main camera has rendered
@@ -13802,8 +14476,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
13802
14476
  * @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
13803
14477
  */
13804
14478
  fitCamera(options?: OrbitFitCameraOptions): any;
13805
- /** @deprecated Use fitCamera(options) */
13806
- fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">): any;
13807
14479
  private _haveAttachedKeyboardEvents;
13808
14480
  }
13809
14481
 
@@ -14004,6 +14676,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
14004
14676
  value: number | boolean | string;
14005
14677
  };
14006
14678
 
14679
+ /** Extracts parameter names of a given type from the builder's tracked parameter map */
14680
+ declare type ParamNamesOfType<TParams, PType extends string> = {
14681
+ [K in keyof TParams & string]: TParams[K] extends PType ? K : never;
14682
+ }[keyof TParams & string];
14683
+
14007
14684
  declare type ParseNumber<T> = T extends `${infer U extends number}` ? U : never;
14008
14685
 
14009
14686
  /** Load a gltf file from a url. This is the core method used by Needle Engine to load gltf files. All known extensions are registered here.
@@ -14635,13 +15312,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
14635
15312
  * The timeline asset containing tracks, clips, and markers that this director will play.
14636
15313
  * Assign a timeline asset exported from Unity or Blender to enable playback.
14637
15314
  */
14638
- playableAsset?: Models.TimelineAssetModel;
15315
+ get playableAsset(): Models.TimelineAssetModel | undefined;
15316
+ set playableAsset(value: Models.TimelineAssetModel | undefined);
15317
+ private _playableAsset?;
14639
15318
  /**
14640
15319
  * When true, the timeline starts playing automatically when the component awakens.
14641
15320
  * Set to false to control playback manually via `play()`.
14642
15321
  * @default false
14643
15322
  */
14644
- playOnAwake?: boolean;
15323
+ playOnAwake: boolean;
14645
15324
  /**
14646
15325
  * Determines how the timeline behaves when it reaches the end of its duration.
14647
15326
  * @default DirectorWrapMode.Loop
@@ -14719,15 +15398,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
14719
15398
  /** Iterates over all tracks of the timeline
14720
15399
  * @returns all tracks of the timeline
14721
15400
  */
14722
- forEachTrack(): Generator<Tracks.TrackHandler, void, unknown>;
15401
+ forEachTrack(): Generator<Tracks.TimelineTrackHandler, void, unknown>;
14723
15402
  /**
14724
15403
  * @returns all animation tracks of the timeline
14725
15404
  */
14726
- get animationTracks(): Tracks.AnimationTrackHandler[];
15405
+ get animationTracks(): Tracks.TimelineAnimationTrack[];
14727
15406
  /**
14728
15407
  * @returns all audio tracks of the timeline
14729
15408
  */
14730
- get audioTracks(): Tracks.AudioTrackHandler[];
15409
+ get audioTracks(): Tracks.TimelineAudioTrack[];
14731
15410
  /**
14732
15411
  * @returns all signal tracks of the timeline
14733
15412
  */
@@ -14735,7 +15414,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
14735
15414
  /**
14736
15415
  * @returns all marker tracks of the timeline
14737
15416
  */
14738
- get markerTracks(): Tracks.MarkerTrackHandler[];
15417
+ get markerTracks(): Tracks.TimelineMarkerTrack[];
15418
+ /**
15419
+ * @returns all activation tracks of the timeline
15420
+ */
15421
+ get activationTracks(): Tracks.TimelineActivationTrack[];
15422
+ /**
15423
+ * @returns all tracks of the timeline
15424
+ */
15425
+ get tracks(): ReadonlyArray<Tracks.TimelineTrackHandler>;
14739
15426
  /**
14740
15427
  * Iterates over all markers of the timeline, optionally filtering by type
14741
15428
  *
@@ -14749,13 +15436,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
14749
15436
  *
14750
15437
  */
14751
15438
  foreachMarker<T extends Record<string, any>>(type?: string | null): Generator<(T & Models.MarkerModel)>;
14752
- private _guidsMap?;
14753
- /* Excluded from this release type: resolveGuids */
15439
+ private _needsGraphRebuild;
14754
15440
  private _isPlaying;
14755
15441
  private _internalUpdateRoutine;
14756
15442
  private _isPaused;
14757
15443
  /** internal, true during the time stop() is being processed */
14758
15444
  private _isStopping;
15445
+ /* Excluded from this release type: _isUserEvaluation */
14759
15446
  private _time;
14760
15447
  private _duration;
14761
15448
  private _weight;
@@ -14764,6 +15451,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
14764
15451
  private readonly _signalTracks;
14765
15452
  private readonly _markerTracks;
14766
15453
  private readonly _controlTracks;
15454
+ private readonly _activationTracks;
14767
15455
  private readonly _customTracks;
14768
15456
  private readonly _tracksArray;
14769
15457
  private get _allTracks();
@@ -15755,6 +16443,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
15755
16443
  w: number;
15756
16444
  };
15757
16445
 
16446
+ /** A Quaternion value, either as a Three.js Quaternion or as a `[x, y, z, w]` tuple */
16447
+ declare type QuatValue = Quaternion | [number, number, number, number];
16448
+
15758
16449
  /** Generates a random number
15759
16450
  * @deprecated use Mathf.random(min, max)
15760
16451
  */
@@ -15880,6 +16571,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
15880
16571
  * @default undefined
15881
16572
  */
15882
16573
  useIgnoreRaycastLayer?: boolean;
16574
+ /** When true, trigger/sensor colliders will be included in the raycast results.
16575
+ * By default trigger colliders are skipped.
16576
+ * @default false
16577
+ */
16578
+ includeTriggers?: boolean;
15883
16579
  }): null | {
15884
16580
  point: Vector3;
15885
16581
  collider: ICollider;
@@ -15897,6 +16593,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
15897
16593
  * @default undefined
15898
16594
  */
15899
16595
  useIgnoreRaycastLayer?: boolean;
16596
+ /** When true, trigger/sensor colliders will be included in the raycast results.
16597
+ * By default trigger colliders are skipped.
16598
+ * @default false
16599
+ */
16600
+ includeTriggers?: boolean;
15900
16601
  }): null | {
15901
16602
  point: Vector3;
15902
16603
  normal: Vector3;
@@ -15942,6 +16643,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
15942
16643
  private _gravity;
15943
16644
  get gravity(): Vec3;
15944
16645
  set gravity(value: Vec3);
16646
+ /** Tears down the physics world and frees all WASM resources.
16647
+ * After calling this, the world will be re-created on next use. */
16648
+ dispose(): void;
16649
+ /** @deprecated Use {@link dispose} instead. */
15945
16650
  clearCaches(): void;
15946
16651
  addBoxCollider(collider: ICollider, size: Vector3): Promise<void>;
15947
16652
  addSphereCollider(collider: ICollider): Promise<void>;
@@ -15988,7 +16693,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
15988
16693
  private getRigidbodyRelativeMatrix;
15989
16694
  private static centerConnectionPos;
15990
16695
  private static centerConnectionRot;
15991
- addFixedJoint(body1: IRigidbody, body2: IRigidbody): void;
16696
+ private _jointTempMatrix;
16697
+ addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<ImpulseJoint | null>;
15992
16698
  /** The joint prevents any relative movement between two rigid-bodies, except for relative rotations along one axis. This is typically used to simulate wheels, fans, etc. They are characterized by one local anchor as well as one local axis on each rigid-body. */
15993
16699
  addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: {
15994
16700
  x: number;
@@ -15998,8 +16704,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
15998
16704
  x: number;
15999
16705
  y: number;
16000
16706
  z: number;
16001
- }): void;
16707
+ }): Promise<ImpulseJoint | null>;
16708
+ removeJoint(joint: ImpulseJoint): void;
16709
+ /** Compute the relative transform from body1's local space to body2's local space (W2⁻¹ * W1), ignoring scale. */
16002
16710
  private calculateJointRelativeMatrices;
16711
+ private normalizeMatrixColumns;
16003
16712
  }
16004
16713
 
16005
16714
  /**
@@ -16802,10 +17511,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
16802
17511
  */
16803
17512
  export declare class Rigidbody extends Component implements IRigidbody {
16804
17513
  get isRigidbody(): boolean;
16805
- /** When true the mass will be automatically calculated by the attached colliders */
17514
+ /** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
17515
+ * Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
17516
+ * Disable to set mass explicitly via the `mass` property.
17517
+ */
16806
17518
  autoMass: boolean;
16807
- /** By default the mass will be automatically calculated (see `autoMass`) by the physics engine using the collider sizes
16808
- * To set the mass manually you can either set the `mass` value or set `autoMass` to `false`
17519
+ /** The mass of the rigidbody in kg (when `autoMass` is disabled).
17520
+ * When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
17521
+ * Setting this property automatically disables `autoMass`.
17522
+ *
17523
+ * **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
17524
+ * naturally with collider size, while explicit mass stays fixed regardless of shape changes.
16809
17525
  */
16810
17526
  set mass(value: number);
16811
17527
  get mass(): number;
@@ -16888,7 +17604,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
16888
17604
  onEnable(): void;
16889
17605
  onDisable(): void;
16890
17606
  onDestroy(): void;
16891
- onValidate(): void;
17607
+ onValidate(property?: string): void;
17608
+ private static _didWarnAutoMass;
16892
17609
  beforePhysics(): Generator<undefined, void, unknown>;
16893
17610
  /** Teleport the rigidbody to a new position in the world.
16894
17611
  * Will reset forces before setting the object world position
@@ -18108,10 +18825,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
18108
18825
 
18109
18826
  export declare function sendDestroyed(guid: string, con: INetworkConnection, opts?: SyncDestroyOptions): void;
18110
18827
 
18828
+ /** Controls when a network message is actually sent to the server.
18829
+ * @see {@link NetworkConnection.send}
18830
+ */
18111
18831
  export declare enum SendQueue {
18832
+ /** Hold the message until the transport connection opens, then send it. Use for messages that must arrive as soon as the socket is ready (e.g. join-room). */
18112
18833
  OnConnection = 0,
18834
+ /** Hold the message until the client has joined a room, then send it. Use for messages that require room context. */
18113
18835
  OnRoomJoin = 1,
18836
+ /** Buffer the message and send it on the next `sendBufferedMessagesNow()` call (typically once per frame). This is the default for `send()`. */
18114
18837
  Queued = 2,
18838
+ /** Send the message to the server immediately without buffering. */
18115
18839
  Immediate = 3
18116
18840
  }
18117
18841
 
@@ -18544,6 +19268,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
18544
19268
  asset: string;
18545
19269
  }
18546
19270
 
19271
+ /**
19272
+ * Options for a signal marker in the timeline builder
19273
+ */
19274
+ export declare type SignalMarkerOptions = {
19275
+ /** Whether the signal should fire if the playback starts past its time (default: false) */
19276
+ retroActive?: boolean;
19277
+ /** Whether the signal should only fire once (default: false) */
19278
+ emitOnce?: boolean;
19279
+ };
19280
+
18547
19281
  /** SignalReceiver is a component that listens for signals and invokes a reaction when a signal is received.
18548
19282
  * Signals can be added to a signal track on a {@link PlayableDirector}
18549
19283
  *
@@ -18551,7 +19285,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
18551
19285
  * @category Animation and Sequencing
18552
19286
  * @group Components
18553
19287
  */
18554
- export declare class SignalReceiver extends Component {
19288
+ export declare class SignalReceiver extends Component implements ISignalReceiver {
19289
+ readonly isSignalReceiver = true;
18555
19290
  private static receivers;
18556
19291
  static invoke(guid: string): void;
18557
19292
  events?: SignalReceiverEvent[];
@@ -18570,10 +19305,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
18570
19305
  reaction: EventList<void>;
18571
19306
  }
18572
19307
 
18573
- export declare class SignalTrackHandler extends TrackHandler {
19308
+ /**
19309
+ * Builder for signal tracks. Provides `.signal()` for callback-based signals and `.marker()` for asset-based markers.
19310
+ * @category Animation and Sequencing
19311
+ */
19312
+ export declare interface SignalTrackBuilder extends TimelineBuilderBase {
19313
+ /** Adds a signal with a callback that fires at the given time */
19314
+ signal(time: number, callback: Function, options?: SignalMarkerOptions): SignalTrackBuilder;
19315
+ /** Adds a signal marker referencing a signal asset by guid */
19316
+ marker(time: number, asset: string, options?: SignalMarkerOptions): SignalTrackBuilder;
19317
+ /** Mutes this track so it is skipped during playback */
19318
+ muted(muted?: boolean): SignalTrackBuilder;
19319
+ }
19320
+
19321
+ export declare class SignalTrackHandler extends TimelineTrackHandler {
18574
19322
  models: Models.SignalMarkerModel[];
18575
19323
  didTrigger: boolean[];
18576
19324
  receivers: Array<SignalReceiver | null>;
19325
+ private _lastTime;
19326
+ onEnable(): void;
19327
+ onMuteChanged(): void;
18577
19328
  evaluate(time: number): void;
18578
19329
  }
18579
19330
 
@@ -19073,10 +19824,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
19073
19824
  * Removes scale change monitoring when the collider is disabled.
19074
19825
  */
19075
19826
  onDisable(): void;
19076
- /**
19077
- * Updates collider properties when validated in the editor or inspector.
19078
- */
19079
- onValidate(): void;
19080
19827
  }
19081
19828
 
19082
19829
  export declare class SphereIntersection implements Intersection {
@@ -19829,8 +20576,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
19829
20576
  * Configuration for an animation state in the builder
19830
20577
  */
19831
20578
  export declare type StateOptions = {
19832
- /** The animation clip for this state */
19833
- clip: AnimationClip;
20579
+ /**
20580
+ * The animation clip for this state. Accepts:
20581
+ * - A pre-built `AnimationClip`
20582
+ * - A single {@link TrackDescriptor} from {@link track}
20583
+ * - An array of {@link TrackDescriptor}s (multiple tracks combined into one clip)
20584
+ *
20585
+ * When omitted, use {@link AnimatorControllerBuilder.track .track()} to define animation tracks inline.
20586
+ */
20587
+ clip?: AnimationClip | TrackDescriptor | TrackDescriptor[];
19834
20588
  /** Whether the animation should loop (default: false) */
19835
20589
  loop?: boolean;
19836
20590
  /** Base speed multiplier (default: 1) */
@@ -20396,6 +21150,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20396
21150
  set font(val: string | null);
20397
21151
  get font(): string | null;
20398
21152
  private _font;
21153
+ private _assignedAtRuntime;
20399
21154
  /**
20400
21155
  * Whether to support basic rich text tags in the `text` property. Supported tags include `<b>`, `<i>`, and `<color=hex>`. For example: `Hello <b>World</b>` or `Score: <color=#ff0000>100</color>`
20401
21156
  * @default false
@@ -20651,6 +21406,57 @@ export declare class OrbitControls extends Component implements ICameraControlle
20651
21406
  /* Excluded from this release type: update */
20652
21407
  }
20653
21408
 
21409
+ /**
21410
+ * Handles activation (visibility) of bound objects for a timeline activation track.
21411
+ *
21412
+ * Each clip on the track defines a time range during which the bound objects should be active (visible).
21413
+ * @see TimelineTrackHandler for details on how tracks and clips work in general, and how to mutate them at runtime.
21414
+ * @see PlayableDirector for how to control timeline playback and time.
21415
+ * @see TimelineBuilder for how to create and configure timelines and tracks in the editor.
21416
+ */
21417
+ export declare class TimelineActivationTrack extends TimelineTrackHandler {
21418
+ evaluate(time: number): void;
21419
+ }
21420
+
21421
+ export declare class TimelineAnimationTrack extends TimelineTrackHandler {
21422
+ /* Excluded from this release type: models */
21423
+ /* Excluded from this release type: trackOffset */
21424
+ /** The object that is being animated. */
21425
+ target?: Object3D;
21426
+ /** The AnimationMixer, should be shared with the animator if an animator is bound */
21427
+ mixer?: AnimationMixer;
21428
+ clips: Array<AnimationClip>;
21429
+ actions: Array<AnimationAction>;
21430
+ /**
21431
+ * You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
21432
+ * @default 1
21433
+ */
21434
+ weight: number;
21435
+ /** holds data/info about clips differences */
21436
+ private _actionOffsets;
21437
+ private _didBind;
21438
+ private _animator;
21439
+ onDisable(): void;
21440
+ onDestroy(): void;
21441
+ onStateChanged(): void;
21442
+ createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
21443
+ bind(): void;
21444
+ private ensureTrackOffsets;
21445
+ private _useclipOffsets;
21446
+ private _totalOffsetPosition;
21447
+ private _totalOffsetRotation;
21448
+ private _totalOffsetPosition2;
21449
+ private _totalOffsetRotation2;
21450
+ private _summedPos;
21451
+ private _tempPos;
21452
+ private _summedRot;
21453
+ private _tempRot;
21454
+ private _clipRotQuat;
21455
+ evaluate(time: number): void;
21456
+ private createRotationInterpolant;
21457
+ private createPositionInterpolant;
21458
+ }
21459
+
20654
21460
  /**
20655
21461
  * @category Animation and Sequencing
20656
21462
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -20660,6 +21466,325 @@ export declare class OrbitControls extends Component implements ICameraControlle
20660
21466
  tracks: TrackModel[];
20661
21467
  };
20662
21468
 
21469
+ /**
21470
+ * Handles audio playback for a timeline audio track.
21471
+ *
21472
+ * **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
21473
+ * You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
21474
+ * at any time — changes take effect on the next frame without rebuilding the timeline.
21475
+ *
21476
+ * **Audio stopping:** Audio clips are automatically stopped when:
21477
+ * - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
21478
+ * - The track is muted (via `muted = true`)
21479
+ * - The director is stopped (`director.stop()`)
21480
+ * - The director is paused (`director.pause()`)
21481
+ * - The director is disabled or destroyed
21482
+ */
21483
+ export declare class TimelineAudioTrack extends TimelineTrackHandler {
21484
+ models: Array<AudioClipModel_2>;
21485
+ listener: AudioListener_3;
21486
+ audio: Array<Audio_2>;
21487
+ audioContextTimeOffset: Array<number>;
21488
+ lastTime: number;
21489
+ audioSource?: AudioSource;
21490
+ /** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
21491
+ get volume(): number;
21492
+ set volume(val: number);
21493
+ private _audioLoader;
21494
+ private getAudioFilePath;
21495
+ onAllowAudioChanged(allow: boolean): void;
21496
+ addModel(model: Models.ClipModel): void;
21497
+ onDisable(): void;
21498
+ onDestroy(): void;
21499
+ onMuteChanged(): void;
21500
+ stop(): void;
21501
+ private _playableDirectorResumed;
21502
+ onPauseChanged(): void;
21503
+ evaluate(time: number): void;
21504
+ /** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
21505
+ loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
21506
+ private isInTimeRange;
21507
+ private static _audioBuffers;
21508
+ static dispose(): void;
21509
+ private handleAudioLoading;
21510
+ }
21511
+
21512
+ /**
21513
+ * A fluent builder for creating timeline assets ({@link TimelineAssetModel}) from code.
21514
+ *
21515
+ * Use {@link TimelineBuilder.create} to start building a timeline.
21516
+ *
21517
+ * @example Using build() for timelines without signal callbacks
21518
+ * ```ts
21519
+ * const timeline = TimelineBuilder.create("MySequence")
21520
+ * .animationTrack("Character", animator)
21521
+ * .clip(walkClip, { duration: 2, easeIn: 0.3 })
21522
+ * .clip(runClip, { duration: 3, easeIn: 0.5, easeOut: 0.5 })
21523
+ * .activationTrack("FX", particleObject)
21524
+ * .clip({ start: 1, duration: 2 })
21525
+ * .audioTrack("Music", audioSource)
21526
+ * .clip("music.mp3", { start: 0, duration: 5, volume: 0.8 })
21527
+ * .build();
21528
+ *
21529
+ * director.playableAsset = timeline;
21530
+ * director.play();
21531
+ * ```
21532
+ *
21533
+ * @example With inline tracks (no pre-built clips needed)
21534
+ * ```ts
21535
+ * TimelineBuilder.create("DoorSequence")
21536
+ * .animationTrack("Door", door)
21537
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
21538
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
21539
+ * .signalTrack("Events")
21540
+ * .signal(0.5, () => playSound("creak"))
21541
+ * .install(director);
21542
+ *
21543
+ * director.play();
21544
+ * ```
21545
+ *
21546
+ * @example Using install() with signal callbacks
21547
+ * ```ts
21548
+ * TimelineBuilder.create("WithSignals")
21549
+ * .animationTrack("Character", animator)
21550
+ * .clip(walkClip, { duration: 2 })
21551
+ * .signalTrack("Events")
21552
+ * .signal(1.0, () => console.log("1 second!"))
21553
+ * .signal(2.0, () => spawnParticles())
21554
+ * .install(director);
21555
+ *
21556
+ * director.play();
21557
+ * ```
21558
+ *
21559
+ * @category Animation and Sequencing
21560
+ * @group Utilities
21561
+ */
21562
+ export declare class TimelineBuilder {
21563
+ private _name;
21564
+ private _tracks;
21565
+ private _currentTrack;
21566
+ private _pendingSignals;
21567
+ private _idProvider;
21568
+ private constructor();
21569
+ /**
21570
+ * Creates a new TimelineBuilder instance.
21571
+ * @param name - Name for the timeline asset
21572
+ * @param seed - Optional numeric seed for deterministic guid generation. Defaults to `Date.now()`.
21573
+ */
21574
+ static create(name?: string, seed?: number): TimelineBuilderBase;
21575
+ /**
21576
+ * Adds an animation track. Chain `.clip()` calls to add pre-built clips,
21577
+ * or chain `.track()` calls to define animation data inline:
21578
+ *
21579
+ * @example With pre-built AnimationClip
21580
+ * ```ts
21581
+ * .animationTrack("Character", animator)
21582
+ * .clip(walkClip, { duration: 2, easeIn: 0.3 })
21583
+ * .clip(runClip, { duration: 3 })
21584
+ * ```
21585
+ *
21586
+ * @example With inline tracks
21587
+ * ```ts
21588
+ * .animationTrack("Door", door)
21589
+ * .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
21590
+ * .track(light, "intensity", { from: 0, to: 5, duration: 1 })
21591
+ * ```
21592
+ *
21593
+ * @param name - Display name for the track
21594
+ * @param binding - The Animator or Object3D to animate
21595
+ */
21596
+ animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
21597
+ /**
21598
+ * Adds an audio track. Subsequent `.clip()` calls add audio clips to this track.
21599
+ * @param name - Display name for the track
21600
+ * @param binding - The AudioSource to play audio on (optional)
21601
+ * @param volume - Track volume multiplier (default: 1)
21602
+ */
21603
+ audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
21604
+ /**
21605
+ * Adds an activation track. Subsequent `.clip()` calls define when the bound object is active.
21606
+ * @param name - Display name for the track
21607
+ * @param binding - The Object3D to show/hide
21608
+ */
21609
+ activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
21610
+ /**
21611
+ * Adds a control track. Subsequent `.clip()` calls control nested timelines or objects.
21612
+ * @param name - Display name for the track
21613
+ */
21614
+ controlTrack(name: string): ControlTrackBuilder;
21615
+ /**
21616
+ * Adds a signal track. Use `.signal()` or `.marker()` to add signal markers.
21617
+ * @param name - Display name for the track
21618
+ * @param binding - The SignalReceiver component (optional — if using `.signal()` with callbacks, one is created automatically by {@link install})
21619
+ */
21620
+ signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
21621
+ /**
21622
+ * Adds a marker track. Use `.marker()` to add markers.
21623
+ * @param name - Display name for the track
21624
+ */
21625
+ markerTrack(name: string): MarkerTrackBuilder;
21626
+ /**
21627
+ * Adds a clip to the current track. The clip type must match the track type.
21628
+ *
21629
+ * - On an **animation track**: pass an `AnimationClip`, a {@link TrackDescriptor}, or a `TrackDescriptor[]` — and optional {@link AnimationClipOptions}
21630
+ * - On an **audio track**: pass a clip URL (string) and {@link AudioClipOptions}
21631
+ * - On an **activation track**: pass {@link ActivationClipOptions}
21632
+ * - On a **control track**: pass an Object3D and {@link ControlClipOptions}
21633
+ */
21634
+ clip(asset: AnimationClip, options?: AnimationClipOptions): this;
21635
+ clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): this;
21636
+ clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): this;
21637
+ clip(url: string, options: AudioClipOptions): this;
21638
+ clip(options: ActivationClipOptions): this;
21639
+ clip(sourceObject: Object3D, options: ControlClipOptions): this;
21640
+ /**
21641
+ * Adds a signal marker to the current signal or marker track.
21642
+ * @param time - Time in seconds when the signal fires
21643
+ * @param asset - The signal asset identifier (guid string)
21644
+ * @param options - Optional marker configuration
21645
+ */
21646
+ marker(time: number, asset: string, options?: SignalMarkerOptions): this;
21647
+ /**
21648
+ * Adds a signal with a callback to the current signal track.
21649
+ * This is a convenience method that automatically generates a signal asset guid,
21650
+ * adds the marker, and registers the callback so that {@link install} can wire up
21651
+ * the `SignalReceiver` on the director's GameObject.
21652
+ *
21653
+ * @param time - Time in seconds when the signal fires
21654
+ * @param callback - The function to invoke when the signal fires
21655
+ * @param options - Optional marker configuration
21656
+ *
21657
+ * @example
21658
+ * ```ts
21659
+ * const timeline = TimelineBuilder.create("Sequence")
21660
+ * .signalTrack("Events")
21661
+ * .signal(1.0, () => console.log("1 second reached!"))
21662
+ * .signal(3.5, () => console.log("halfway!"), { emitOnce: true })
21663
+ * .install(director);
21664
+ * ```
21665
+ */
21666
+ signal(time: number, callback: Function, options?: SignalMarkerOptions): this;
21667
+ /**
21668
+ * Mutes the current track so it is skipped during playback.
21669
+ */
21670
+ muted(muted?: boolean): this;
21671
+ /** Adds an animation track descriptor for an Object3D's position or scale to the current animation track */
21672
+ track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): this;
21673
+ /** Adds an animation track descriptor for an Object3D's quaternion to the current animation track */
21674
+ track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): this;
21675
+ /** Adds an animation track descriptor for an Object3D's rotation (Euler, converted to quaternion) to the current animation track */
21676
+ track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): this;
21677
+ /** Adds an animation track descriptor for an Object3D's visibility to the current animation track */
21678
+ track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): this;
21679
+ /** Adds an animation track descriptor for a material's numeric property to the current animation track */
21680
+ track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): this;
21681
+ /** Adds an animation track descriptor for a material's color property to the current animation track */
21682
+ track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
21683
+ /** Adds an animation track descriptor for a light's numeric property to the current animation track */
21684
+ track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): this;
21685
+ /** Adds an animation track descriptor for a light's color to the current animation track */
21686
+ track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
21687
+ /** Adds an animation track descriptor for a camera's numeric property to the current animation track */
21688
+ track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): this;
21689
+ /**
21690
+ * Builds and returns the {@link TimelineAssetModel}.
21691
+ * Assign the result to `PlayableDirector.playableAsset` to play it.
21692
+ *
21693
+ * If you used `.signal()` with callbacks, use {@link install} instead — it calls `build()`
21694
+ * internally and also wires up the SignalReceiver on the director's GameObject.
21695
+ */
21696
+ build(): TimelineAssetModel;
21697
+ /**
21698
+ * Builds the timeline asset, assigns it to the director, and wires up any
21699
+ * `.signal()` callbacks by creating/configuring a {@link SignalReceiver} on the
21700
+ * director's GameObject.
21701
+ *
21702
+ * @param director - The PlayableDirector to install the timeline on
21703
+ * @returns The built TimelineAssetModel (also assigned to `director.playableAsset`)
21704
+ *
21705
+ * @example
21706
+ * ```ts
21707
+ * TimelineBuilder.create("MyTimeline")
21708
+ * .animationTrack("Anim", animator)
21709
+ * .clip(walkClip, { duration: 2 })
21710
+ * .signalTrack("Events")
21711
+ * .signal(1.0, () => console.log("signal fired!"))
21712
+ * .install(director);
21713
+ *
21714
+ * director.play();
21715
+ * ```
21716
+ */
21717
+ install(director: PlayableDirector): TimelineAssetModel;
21718
+ private pushTrack;
21719
+ /** Commits any pending `.track()` descriptors on the current animation track into a clip */
21720
+ private commitInlineTracks;
21721
+ }
21722
+
21723
+ /**
21724
+ * Shared methods available on all track builders and the TimelineBuilder entry point.
21725
+ * Provides track creation, build, and install methods.
21726
+ *
21727
+ * @category Animation and Sequencing
21728
+ */
21729
+ export declare interface TimelineBuilderBase {
21730
+ /** Adds an animation track. Chain `.clip()` or `.track()` to add content. */
21731
+ animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
21732
+ /** Adds an audio track. Chain `.clip()` to add audio clips. */
21733
+ audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
21734
+ /** Adds an activation track. Chain `.clip()` to define activation windows. */
21735
+ activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
21736
+ /** Adds a control track. Chain `.clip()` to control nested objects/timelines. */
21737
+ controlTrack(name: string): ControlTrackBuilder;
21738
+ /** Adds a signal track. Chain `.signal()` or `.marker()` to add events. */
21739
+ signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
21740
+ /** Adds a marker track. Chain `.marker()` to add markers. */
21741
+ markerTrack(name: string): MarkerTrackBuilder;
21742
+ /** Builds and returns the {@link TimelineAssetModel}. */
21743
+ build(): TimelineAssetModel;
21744
+ /** Builds the timeline, assigns it to the director, and wires up signal callbacks. */
21745
+ install(director: PlayableDirector): TimelineAssetModel;
21746
+ }
21747
+
21748
+ export declare class TimelineControlTrack extends TimelineTrackHandler {
21749
+ models: Array<Models.ClipModel>;
21750
+ timelines: Array<PlayableDirector | null>;
21751
+ resolveSourceObjects(_context: Context): void;
21752
+ private _previousActiveModel;
21753
+ evaluate(time: number): void;
21754
+ }
21755
+
21756
+ export declare class TimelineMarkerTrack extends TimelineTrackHandler {
21757
+ models: Array<Models.MarkerModel & Record<string, any>>;
21758
+ needsSorting: boolean;
21759
+ foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
21760
+ onEnable(): void;
21761
+ evaluate(_time: number): void;
21762
+ private sort;
21763
+ }
21764
+
21765
+ /**
21766
+ * A TrackHandler is responsible for evaluating a specific type of timeline track.
21767
+ * A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
21768
+ */
21769
+ export declare abstract class TimelineTrackHandler {
21770
+ director: PlayableDirector;
21771
+ track: Models.TrackModel;
21772
+ get muted(): boolean;
21773
+ set muted(val: boolean);
21774
+ forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
21775
+ onEnable?(): any;
21776
+ onDisable?(): any;
21777
+ onDestroy?(): any;
21778
+ abstract evaluate(time: number): any;
21779
+ onMuteChanged?(): any;
21780
+ onPauseChanged?(): any;
21781
+ /** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
21782
+ onStateChanged?(isPlaying: boolean): any;
21783
+ getClipTime(time: number, model: Models.ClipModel): number;
21784
+ getClipTimeNormalized(time: number, model: Models.ClipModel): number;
21785
+ evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
21786
+ }
21787
+
20663
21788
  declare type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
20664
21789
 
20665
21790
  /**
@@ -20688,27 +21813,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
20688
21813
  export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
20689
21814
 
20690
21815
  /**
20691
- * A TrackHandler is responsible for evaluating a specific type of timeline track.
20692
- * A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
21816
+ * An opaque descriptor for a single animation track.
21817
+ * Created by {@link track} and resolved into a Three.js KeyframeTrack
21818
+ * when passed to {@link createAnimation}, or inline to
21819
+ * {@link AnimatorControllerBuilder.state} / {@link TimelineBuilder.clip}.
21820
+ *
21821
+ * @category Animation and Sequencing
20693
21822
  */
20694
- export declare abstract class TrackHandler {
20695
- director: PlayableDirector;
20696
- track: Models.TrackModel;
20697
- get muted(): boolean;
20698
- set muted(val: boolean);
20699
- forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
20700
- onEnable?(): any;
20701
- onDisable?(): any;
20702
- onDestroy?(): any;
20703
- abstract evaluate(time: number): any;
20704
- onMuteChanged?(): any;
20705
- onPauseChanged?(): any;
20706
- /** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
20707
- onStateChanged?(isPlaying: boolean): any;
20708
- getClipTime(time: number, model: Models.ClipModel): number;
20709
- getClipTimeNormalized(time: number, model: Models.ClipModel): number;
20710
- evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
20711
- }
21823
+ declare type TrackDescriptor = {
21824
+ readonly __isTrackDescriptor: true;
21825
+ /* Excluded from this release type: _target */
21826
+ /* Excluded from this release type: _property */
21827
+ /* Excluded from this release type: _keyframes */
21828
+ /* Excluded from this release type: _root */
21829
+ };
20712
21830
 
20713
21831
  /**
20714
21832
  * @category Animation and Sequencing
@@ -20734,14 +21852,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
20734
21852
  rotation: Quat | Quaternion;
20735
21853
  };
20736
21854
 
21855
+ /** Options for a single track */
21856
+ declare type TrackOptions = {
21857
+ /**
21858
+ * Root object for resolving the track path.
21859
+ * - If `root === target` → self-targeting (`.property`)
21860
+ * - If `root !== target` → named targeting (`"targetName.property"` using `target.name`)
21861
+ * - If omitted → self-targeting by default
21862
+ */
21863
+ root?: Object3D;
21864
+ };
21865
+
20737
21866
  declare namespace Tracks {
20738
21867
  export {
20739
- TrackHandler,
20740
- AnimationTrackHandler,
20741
- AudioTrackHandler,
20742
- MarkerTrackHandler,
21868
+ TimelineTrackHandler,
21869
+ TimelineAnimationTrack,
21870
+ TimelineAudioTrack,
21871
+ TimelineMarkerTrack,
20743
21872
  SignalTrackHandler,
20744
- ControlTrackHandler
21873
+ TimelineActivationTrack,
21874
+ TimelineControlTrack
20745
21875
  }
20746
21876
  }
20747
21877
 
@@ -20947,10 +22077,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
20947
22077
  export declare type TransitionOptions = {
20948
22078
  /** Duration of the crossfade in seconds (default: 0) */
20949
22079
  duration?: number;
20950
- /** Normalized exit time 0-1 (default: 1). Only used when hasExitTime is true */
22080
+ /** Normalized exit time 0-1. When set, the transition waits until the source animation reaches this point before transitioning. */
20951
22081
  exitTime?: number;
20952
- /** Whether the transition waits for exitTime before transitioning (default: false) */
20953
- hasExitTime?: boolean;
20954
22082
  /** Normalized offset into the destination state's animation (default: 0) */
20955
22083
  offset?: number;
20956
22084
  /** Whether duration is in seconds (true) or normalized (false) (default: false) */
@@ -21020,6 +22148,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
21020
22148
 
21021
22149
  export declare function tryGetGuid(obj: any): string | undefined | null;
21022
22150
 
22151
+ /** Shorthand for a simple two-keyframe animation (start → end) */
22152
+ export declare type Tween<V> = {
22153
+ /** Start value (at time 0) */
22154
+ from: V;
22155
+ /** End value (at time = duration) */
22156
+ to: V;
22157
+ /** Duration in seconds (default: 1) */
22158
+ duration?: number;
22159
+ /** Interpolation mode (default: `"linear"`) */
22160
+ interpolation?: AnimationInterpolation;
22161
+ };
22162
+
21023
22163
  declare type Type = new (...args: any[]) => any;
21024
22164
 
21025
22165
  declare type TypeResolver<T> = (data: any) => Constructor<T> | null;
@@ -21543,6 +22683,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
21543
22683
  z: number;
21544
22684
  };
21545
22685
 
22686
+ /** A Vector3 value, either as a Three.js Vector3 or as a `[x, y, z]` tuple */
22687
+ declare type Vec3Value = Vector3 | [number, number, number];
22688
+
21546
22689
  export declare type Vec4 = {
21547
22690
  x: number;
21548
22691
  y: number;
@@ -22464,7 +23607,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
22464
23607
  private onApplyPose;
22465
23608
  }
22466
23609
 
22467
- declare type WebsocketSendType = IModel | object | boolean | null | string | number;
23610
+ declare type WebsocketSendType = IModel | object | boolean | string | number;
22468
23611
 
22469
23612
  /**
22470
23613
  * Use the [WebXR](https://engine.needle.tools/docs/api/WebXR) component to enable VR and AR on **iOS and Android** in your scene. VisionOS support is also provided via QuickLook USDZ export.