@needle-tools/engine 4.11.5 → 4.12.0-next.ca2cebd

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 (477) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components.needle.json +1 -1
  3. package/custom-elements.json +420 -0
  4. package/dist/generateMeshBVH.worker-mO20N_b8.js +21 -0
  5. package/dist/{gltf-progressive-GwdQV1Qx.umd.cjs → gltf-progressive-DWcmTMCh.umd.cjs} +1 -1
  6. package/dist/{gltf-progressive-CftVUJy3.min.js → gltf-progressive-DZrY8VT6.min.js} +2 -2
  7. package/dist/{gltf-progressive-BvlZQAkt.js → gltf-progressive-DgYz5BYa.js} +19 -19
  8. package/dist/loader.worker-Dip-PthR.js +23 -0
  9. package/dist/{needle-engine.bundle-DYdft7n9.min.js → needle-engine.bundle-4A5NjznD.min.js} +130 -135
  10. package/dist/{needle-engine.bundle-DMqWdPzL.umd.cjs → needle-engine.bundle-BJg4_HhU.umd.cjs} +138 -143
  11. package/dist/{needle-engine.bundle-DSm5itjo.js → needle-engine.bundle-CFkbGdL5.js} +4368 -4241
  12. package/dist/needle-engine.d.ts +18198 -1
  13. package/dist/needle-engine.js +336 -335
  14. package/dist/needle-engine.min.js +1 -1
  15. package/dist/needle-engine.umd.cjs +1 -1
  16. package/dist/{postprocessing-CJC0Npcd.js → postprocessing-BTW9pD_s.js} +1822 -1723
  17. package/dist/{postprocessing-DrM4PWU3.umd.cjs → postprocessing-CMgoN5t5.umd.cjs} +229 -158
  18. package/dist/{postprocessing-l7zsdO_Q.min.js → postprocessing-DYDtB188.min.js} +227 -156
  19. package/dist/rapier-B3oL1ap-.js +5217 -0
  20. package/dist/rapier-DJ-luMxr.min.js +1 -0
  21. package/dist/rapier-DQltNJbN.umd.cjs +1 -0
  22. package/dist/{three-BDW9I486.min.js → three-B7CT31Bt.min.js} +1 -5
  23. package/dist/{three-MHVqtJYj.js → three-DfMvBzXi.js} +0 -5
  24. package/dist/{three-examples-CgwGHSgz.umd.cjs → three-examples-CsW4_6LI.umd.cjs} +2 -7
  25. package/dist/{three-examples-fvEPSC8L.min.js → three-examples-D1P7eEhn.min.js} +2 -7
  26. package/dist/{three-examples-C5Ht-QFN.js → three-examples-D1SK93ek.js} +1 -7
  27. package/dist/{three-mesh-ui-BjWTTk1R.js → three-mesh-ui-C_uSB5dD.js} +1 -1
  28. package/dist/{three-mesh-ui-Bm32sS2a.umd.cjs → three-mesh-ui-DpATDXwU.umd.cjs} +1 -1
  29. package/dist/{three-mesh-ui-CLdkp21K.min.js → three-mesh-ui-LQ44s0AL.min.js} +1 -1
  30. package/dist/{three-iFaDq9U3.umd.cjs → three-qj71I7J3.umd.cjs} +2 -6
  31. package/dist/{vendor-CsyK1CFs.min.js → vendor-BKGa4GE0.min.js} +34 -39
  32. package/dist/{vendor-petGQl0N.js → vendor-D0zoswDa.js} +1626 -1605
  33. package/dist/{vendor-6kAXU6fm.umd.cjs → vendor-UCpFAwt1.umd.cjs} +30 -35
  34. package/lib/engine/api.d.ts +0 -1
  35. package/lib/engine/api.js +0 -1
  36. package/lib/engine/api.js.map +1 -1
  37. package/lib/engine/debug/debug_spector.d.ts +16 -0
  38. package/lib/engine/debug/debug_spector.js +28 -0
  39. package/lib/engine/debug/debug_spector.js.map +1 -0
  40. package/lib/engine/engine_application.d.ts +7 -0
  41. package/lib/engine/engine_application.js +8 -1
  42. package/lib/engine/engine_application.js.map +1 -1
  43. package/lib/engine/engine_context.js +4 -1
  44. package/lib/engine/engine_context.js.map +1 -1
  45. package/lib/engine/engine_license.js +1 -1
  46. package/lib/engine/engine_license.js.map +1 -1
  47. package/lib/engine/engine_physics.js +6 -2
  48. package/lib/engine/engine_physics.js.map +1 -1
  49. package/lib/engine/engine_physics_rapier.d.ts +11 -2
  50. package/lib/engine/engine_physics_rapier.js +9 -0
  51. package/lib/engine/engine_physics_rapier.js.map +1 -1
  52. package/lib/engine/engine_texture.d.ts +1 -1
  53. package/lib/engine/engine_tonemapping.d.ts +1 -1
  54. package/lib/engine/engine_types.d.ts +16 -0
  55. package/lib/engine/engine_typestore.d.ts +1 -0
  56. package/lib/engine/engine_typestore.js +5 -6
  57. package/lib/engine/engine_typestore.js.map +1 -1
  58. package/lib/engine/webcomponents/logo-element.d.ts +11 -0
  59. package/lib/engine/webcomponents/logo-element.js +6 -0
  60. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  61. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +24 -3
  62. package/lib/engine/webcomponents/needle menu/needle-menu.js +18 -3
  63. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  64. package/lib/engine/webcomponents/needle-button.d.ts +5 -0
  65. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  66. package/lib/engine/webcomponents/needle-engine.d.ts +220 -8
  67. package/lib/engine/webcomponents/needle-engine.js +94 -13
  68. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  69. package/lib/engine/xr/NeedleXRSession.js +2 -1
  70. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  71. package/lib/engine-components/AlignmentConstraint.d.ts +8 -0
  72. package/lib/engine-components/AlignmentConstraint.js +8 -0
  73. package/lib/engine-components/AlignmentConstraint.js.map +1 -1
  74. package/lib/engine-components/Animation.d.ts +2 -0
  75. package/lib/engine-components/Animation.js +2 -0
  76. package/lib/engine-components/Animation.js.map +1 -1
  77. package/lib/engine-components/Animator.d.ts +2 -0
  78. package/lib/engine-components/Animator.js +1 -0
  79. package/lib/engine-components/Animator.js.map +1 -1
  80. package/lib/engine-components/AudioListener.d.ts +2 -0
  81. package/lib/engine-components/AudioListener.js +2 -0
  82. package/lib/engine-components/AudioListener.js.map +1 -1
  83. package/lib/engine-components/AudioSource.d.ts +1 -0
  84. package/lib/engine-components/AudioSource.js +1 -0
  85. package/lib/engine-components/AudioSource.js.map +1 -1
  86. package/lib/engine-components/AxesHelper.d.ts +2 -0
  87. package/lib/engine-components/AxesHelper.js +2 -0
  88. package/lib/engine-components/AxesHelper.js.map +1 -1
  89. package/lib/engine-components/BasicIKConstraint.d.ts +8 -0
  90. package/lib/engine-components/BasicIKConstraint.js +8 -0
  91. package/lib/engine-components/BasicIKConstraint.js.map +1 -1
  92. package/lib/engine-components/BoxHelperComponent.d.ts +1 -0
  93. package/lib/engine-components/BoxHelperComponent.js +1 -0
  94. package/lib/engine-components/BoxHelperComponent.js.map +1 -1
  95. package/lib/engine-components/Camera.d.ts +1 -0
  96. package/lib/engine-components/Camera.js +1 -0
  97. package/lib/engine-components/Camera.js.map +1 -1
  98. package/lib/engine-components/CharacterController.d.ts +4 -1
  99. package/lib/engine-components/CharacterController.js +4 -1
  100. package/lib/engine-components/CharacterController.js.map +1 -1
  101. package/lib/engine-components/Collider.d.ts +1 -1
  102. package/lib/engine-components/Collider.js +1 -1
  103. package/lib/engine-components/Component.d.ts +5 -0
  104. package/lib/engine-components/Component.js +7 -0
  105. package/lib/engine-components/Component.js.map +1 -1
  106. package/lib/engine-components/ContactShadows.d.ts +1 -1
  107. package/lib/engine-components/ContactShadows.js +1 -1
  108. package/lib/engine-components/DeleteBox.d.ts +2 -0
  109. package/lib/engine-components/DeleteBox.js +2 -0
  110. package/lib/engine-components/DeleteBox.js.map +1 -1
  111. package/lib/engine-components/DeviceFlag.d.ts +4 -0
  112. package/lib/engine-components/DeviceFlag.js +4 -0
  113. package/lib/engine-components/DeviceFlag.js.map +1 -1
  114. package/lib/engine-components/DragControls.d.ts +1 -0
  115. package/lib/engine-components/DragControls.js +1 -0
  116. package/lib/engine-components/DragControls.js.map +1 -1
  117. package/lib/engine-components/DropListener.d.ts +1 -0
  118. package/lib/engine-components/DropListener.js +1 -0
  119. package/lib/engine-components/DropListener.js.map +1 -1
  120. package/lib/engine-components/Duplicatable.d.ts +1 -0
  121. package/lib/engine-components/Duplicatable.js +1 -0
  122. package/lib/engine-components/Duplicatable.js.map +1 -1
  123. package/lib/engine-components/EventTrigger.d.ts +2 -0
  124. package/lib/engine-components/EventTrigger.js +2 -0
  125. package/lib/engine-components/EventTrigger.js.map +1 -1
  126. package/lib/engine-components/Gizmos.d.ts +2 -0
  127. package/lib/engine-components/Gizmos.js +2 -0
  128. package/lib/engine-components/Gizmos.js.map +1 -1
  129. package/lib/engine-components/GridHelper.d.ts +2 -0
  130. package/lib/engine-components/GridHelper.js +2 -0
  131. package/lib/engine-components/GridHelper.js.map +1 -1
  132. package/lib/engine-components/GroundProjection.d.ts +1 -0
  133. package/lib/engine-components/GroundProjection.js +1 -0
  134. package/lib/engine-components/GroundProjection.js.map +1 -1
  135. package/lib/engine-components/Joints.d.ts +6 -0
  136. package/lib/engine-components/Joints.js +6 -0
  137. package/lib/engine-components/Joints.js.map +1 -1
  138. package/lib/engine-components/LODGroup.d.ts +2 -0
  139. package/lib/engine-components/LODGroup.js +2 -0
  140. package/lib/engine-components/LODGroup.js.map +1 -1
  141. package/lib/engine-components/Light.d.ts +1 -0
  142. package/lib/engine-components/Light.js +1 -0
  143. package/lib/engine-components/Light.js.map +1 -1
  144. package/lib/engine-components/LookAtConstraint.d.ts +1 -0
  145. package/lib/engine-components/LookAtConstraint.js +1 -0
  146. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  147. package/lib/engine-components/NeedleMenu.d.ts +1 -0
  148. package/lib/engine-components/NeedleMenu.js +1 -0
  149. package/lib/engine-components/NeedleMenu.js.map +1 -1
  150. package/lib/engine-components/NestedGltf.d.ts +1 -0
  151. package/lib/engine-components/NestedGltf.js +1 -0
  152. package/lib/engine-components/NestedGltf.js.map +1 -1
  153. package/lib/engine-components/Networking.d.ts +1 -0
  154. package/lib/engine-components/Networking.js +1 -0
  155. package/lib/engine-components/Networking.js.map +1 -1
  156. package/lib/engine-components/OffsetConstraint.d.ts +7 -0
  157. package/lib/engine-components/OffsetConstraint.js +7 -0
  158. package/lib/engine-components/OffsetConstraint.js.map +1 -1
  159. package/lib/engine-components/OrbitControls.d.ts +1 -0
  160. package/lib/engine-components/OrbitControls.js +1 -0
  161. package/lib/engine-components/OrbitControls.js.map +1 -1
  162. package/lib/engine-components/PlayerColor.d.ts +2 -0
  163. package/lib/engine-components/PlayerColor.js +2 -0
  164. package/lib/engine-components/PlayerColor.js.map +1 -1
  165. package/lib/engine-components/ReflectionProbe.d.ts +1 -0
  166. package/lib/engine-components/ReflectionProbe.js +1 -0
  167. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  168. package/lib/engine-components/RendererInstancing.d.ts +5 -3
  169. package/lib/engine-components/RendererInstancing.js +64 -31
  170. package/lib/engine-components/RendererInstancing.js.map +1 -1
  171. package/lib/engine-components/RigidBody.d.ts +1 -0
  172. package/lib/engine-components/RigidBody.js +1 -0
  173. package/lib/engine-components/RigidBody.js.map +1 -1
  174. package/lib/engine-components/SceneSwitcher.d.ts +1 -0
  175. package/lib/engine-components/SceneSwitcher.js +1 -0
  176. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  177. package/lib/engine-components/ScreenCapture.d.ts +1 -0
  178. package/lib/engine-components/ScreenCapture.js +1 -0
  179. package/lib/engine-components/ScreenCapture.js.map +1 -1
  180. package/lib/engine-components/SeeThrough.d.ts +1 -0
  181. package/lib/engine-components/SeeThrough.js +1 -0
  182. package/lib/engine-components/SeeThrough.js.map +1 -1
  183. package/lib/engine-components/ShadowCatcher.d.ts +2 -0
  184. package/lib/engine-components/ShadowCatcher.js +2 -0
  185. package/lib/engine-components/ShadowCatcher.js.map +1 -1
  186. package/lib/engine-components/Skybox.d.ts +16 -5
  187. package/lib/engine-components/Skybox.js +38 -25
  188. package/lib/engine-components/Skybox.js.map +1 -1
  189. package/lib/engine-components/SmoothFollow.d.ts +1 -0
  190. package/lib/engine-components/SmoothFollow.js +1 -0
  191. package/lib/engine-components/SmoothFollow.js.map +1 -1
  192. package/lib/engine-components/SpatialTrigger.d.ts +1 -0
  193. package/lib/engine-components/SpatialTrigger.js +1 -0
  194. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  195. package/lib/engine-components/SpectatorCamera.d.ts +1 -0
  196. package/lib/engine-components/SpectatorCamera.js +1 -0
  197. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  198. package/lib/engine-components/SpriteRenderer.d.ts +1 -0
  199. package/lib/engine-components/SpriteRenderer.js +1 -0
  200. package/lib/engine-components/SpriteRenderer.js.map +1 -1
  201. package/lib/engine-components/SyncedCamera.d.ts +2 -0
  202. package/lib/engine-components/SyncedCamera.js +2 -0
  203. package/lib/engine-components/SyncedCamera.js.map +1 -1
  204. package/lib/engine-components/SyncedRoom.d.ts +1 -0
  205. package/lib/engine-components/SyncedRoom.js +1 -0
  206. package/lib/engine-components/SyncedRoom.js.map +1 -1
  207. package/lib/engine-components/SyncedTransform.d.ts +2 -0
  208. package/lib/engine-components/SyncedTransform.js +2 -0
  209. package/lib/engine-components/SyncedTransform.js.map +1 -1
  210. package/lib/engine-components/TransformGizmo.d.ts +2 -0
  211. package/lib/engine-components/TransformGizmo.js +2 -0
  212. package/lib/engine-components/TransformGizmo.js.map +1 -1
  213. package/lib/engine-components/VideoPlayer.d.ts +1 -0
  214. package/lib/engine-components/VideoPlayer.js +1 -0
  215. package/lib/engine-components/VideoPlayer.js.map +1 -1
  216. package/lib/engine-components/Voip.d.ts +1 -0
  217. package/lib/engine-components/Voip.js +1 -0
  218. package/lib/engine-components/Voip.js.map +1 -1
  219. package/lib/engine-components/export/gltf/GltfExport.d.ts +5 -0
  220. package/lib/engine-components/export/gltf/GltfExport.js +5 -0
  221. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  222. package/lib/engine-components/export/usdz/USDZExporter.d.ts +25 -3
  223. package/lib/engine-components/export/usdz/USDZExporter.js +37 -2
  224. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  225. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +18 -0
  226. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +18 -0
  227. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  228. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +1 -0
  229. package/lib/engine-components/particlesystem/ParticleSystem.js +1 -0
  230. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  231. package/lib/engine-components/physics/Attractor.d.ts +3 -0
  232. package/lib/engine-components/physics/Attractor.js +3 -0
  233. package/lib/engine-components/physics/Attractor.js.map +1 -1
  234. package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -0
  235. package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -0
  236. package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
  237. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +4 -0
  238. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +4 -0
  239. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
  240. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +3 -0
  241. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +3 -0
  242. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
  243. package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +4 -0
  244. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +4 -0
  245. package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
  246. package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
  247. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
  248. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
  249. package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +3 -0
  250. package/lib/engine-components/postprocessing/Effects/Pixelation.js +3 -0
  251. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  252. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +4 -0
  253. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +4 -0
  254. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
  255. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +4 -0
  256. package/lib/engine-components/postprocessing/Effects/Sharpening.js +4 -0
  257. package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
  258. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +4 -0
  259. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +4 -0
  260. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
  261. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +4 -0
  262. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +4 -0
  263. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  264. package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +4 -0
  265. package/lib/engine-components/postprocessing/Effects/Vignette.js +4 -0
  266. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
  267. package/lib/engine-components/postprocessing/Volume.d.ts +1 -0
  268. package/lib/engine-components/postprocessing/Volume.js +1 -0
  269. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  270. package/lib/engine-components/splines/Spline.d.ts +1 -0
  271. package/lib/engine-components/splines/Spline.js +1 -0
  272. package/lib/engine-components/splines/Spline.js.map +1 -1
  273. package/lib/engine-components/splines/SplineWalker.d.ts +1 -0
  274. package/lib/engine-components/splines/SplineWalker.js +1 -0
  275. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  276. package/lib/engine-components/timeline/PlayableDirector.d.ts +1 -0
  277. package/lib/engine-components/timeline/PlayableDirector.js +1 -0
  278. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  279. package/lib/engine-components/timeline/SignalAsset.d.ts +1 -0
  280. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  281. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  282. package/lib/engine-components/ui/Button.d.ts +4 -0
  283. package/lib/engine-components/ui/Button.js +4 -0
  284. package/lib/engine-components/ui/Button.js.map +1 -1
  285. package/lib/engine-components/ui/Canvas.d.ts +5 -0
  286. package/lib/engine-components/ui/Canvas.js +5 -0
  287. package/lib/engine-components/ui/Canvas.js.map +1 -1
  288. package/lib/engine-components/ui/CanvasGroup.d.ts +4 -0
  289. package/lib/engine-components/ui/CanvasGroup.js +4 -0
  290. package/lib/engine-components/ui/CanvasGroup.js.map +1 -1
  291. package/lib/engine-components/ui/EventSystem.d.ts +2 -0
  292. package/lib/engine-components/ui/EventSystem.js +2 -0
  293. package/lib/engine-components/ui/EventSystem.js.map +1 -1
  294. package/lib/engine-components/ui/Image.d.ts +4 -0
  295. package/lib/engine-components/ui/Image.js +4 -0
  296. package/lib/engine-components/ui/Image.js.map +1 -1
  297. package/lib/engine-components/ui/InputField.d.ts +4 -0
  298. package/lib/engine-components/ui/InputField.js +4 -0
  299. package/lib/engine-components/ui/InputField.js.map +1 -1
  300. package/lib/engine-components/ui/Outline.d.ts +7 -0
  301. package/lib/engine-components/ui/Outline.js +7 -0
  302. package/lib/engine-components/ui/Outline.js.map +1 -1
  303. package/lib/engine-components/ui/SpatialHtml.d.ts +7 -0
  304. package/lib/engine-components/ui/SpatialHtml.js +7 -0
  305. package/lib/engine-components/ui/SpatialHtml.js.map +1 -1
  306. package/lib/engine-components/ui/Text.d.ts +3 -0
  307. package/lib/engine-components/ui/Text.js +3 -0
  308. package/lib/engine-components/ui/Text.js.map +1 -1
  309. package/lib/engine-components/utils/LookAt.d.ts +1 -0
  310. package/lib/engine-components/utils/LookAt.js +1 -0
  311. package/lib/engine-components/utils/LookAt.js.map +1 -1
  312. package/lib/engine-components/web/Clickthrough.d.ts +1 -1
  313. package/lib/engine-components/web/Clickthrough.js +1 -1
  314. package/lib/engine-components/web/CursorFollow.d.ts +2 -0
  315. package/lib/engine-components/web/CursorFollow.js +3 -0
  316. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  317. package/lib/engine-components/web/HoverAnimation.d.ts +1 -0
  318. package/lib/engine-components/web/HoverAnimation.js +1 -0
  319. package/lib/engine-components/web/HoverAnimation.js.map +1 -1
  320. package/lib/engine-components/web/ScrollFollow.d.ts +2 -0
  321. package/lib/engine-components/web/ScrollFollow.js +2 -0
  322. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  323. package/lib/engine-components/web/ViewBox.d.ts +1 -0
  324. package/lib/engine-components/web/ViewBox.js +1 -0
  325. package/lib/engine-components/web/ViewBox.js.map +1 -1
  326. package/lib/engine-components/webxr/Avatar.d.ts +5 -0
  327. package/lib/engine-components/webxr/Avatar.js +5 -0
  328. package/lib/engine-components/webxr/Avatar.js.map +1 -1
  329. package/lib/engine-components/webxr/WebARCameraBackground.d.ts +1 -0
  330. package/lib/engine-components/webxr/WebARCameraBackground.js +1 -0
  331. package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
  332. package/lib/engine-components/webxr/WebARSessionRoot.d.ts +1 -0
  333. package/lib/engine-components/webxr/WebARSessionRoot.js +1 -0
  334. package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
  335. package/lib/engine-components/webxr/WebXR.d.ts +1 -1
  336. package/lib/engine-components/webxr/WebXR.js +5 -1
  337. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  338. package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +1 -0
  339. package/lib/engine-components/webxr/controllers/XRControllerFollow.js +1 -0
  340. package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
  341. package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +4 -0
  342. package/lib/engine-components/webxr/controllers/XRControllerModel.js +4 -0
  343. package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
  344. package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +1 -0
  345. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +1 -0
  346. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  347. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +2 -0
  348. package/lib/engine-components-experimental/networking/PlayerSync.js +2 -0
  349. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  350. package/lib/needle-engine.js +2 -1
  351. package/lib/needle-engine.js.map +1 -1
  352. package/package.json +20 -13
  353. package/plugins/types/needleConfig.d.ts +1 -1
  354. package/plugins/types/next.d.ts +1 -1
  355. package/plugins/types/userconfig.d.ts +4 -1
  356. package/plugins/vite/custom-element-data.js +80 -0
  357. package/plugins/vite/index.js +4 -0
  358. package/src/engine/api.ts +0 -1
  359. package/src/engine/debug/debug_spector.ts +43 -0
  360. package/src/engine/engine_application.ts +16 -1
  361. package/src/engine/engine_context.ts +5 -1
  362. package/src/engine/engine_license.ts +1 -1
  363. package/src/engine/engine_physics.ts +6 -2
  364. package/src/engine/engine_physics_rapier.ts +11 -2
  365. package/src/engine/engine_texture.ts +1 -1
  366. package/src/engine/engine_tonemapping.ts +1 -1
  367. package/src/engine/engine_types.ts +17 -0
  368. package/src/engine/engine_typestore.ts +5 -6
  369. package/src/engine/webcomponents/logo-element.ts +12 -0
  370. package/src/engine/webcomponents/needle menu/needle-menu.ts +24 -3
  371. package/src/engine/webcomponents/needle-button.ts +6 -0
  372. package/src/engine/webcomponents/needle-engine.ts +331 -22
  373. package/src/engine/xr/NeedleXRSession.ts +3 -1
  374. package/src/engine-components/AlignmentConstraint.ts +8 -0
  375. package/src/engine-components/Animation.ts +2 -0
  376. package/src/engine-components/Animator.ts +2 -0
  377. package/src/engine-components/AudioListener.ts +2 -0
  378. package/src/engine-components/AudioSource.ts +1 -0
  379. package/src/engine-components/AxesHelper.ts +2 -0
  380. package/src/engine-components/BasicIKConstraint.ts +8 -0
  381. package/src/engine-components/BoxHelperComponent.ts +1 -0
  382. package/src/engine-components/Camera.ts +1 -0
  383. package/src/engine-components/CharacterController.ts +4 -1
  384. package/src/engine-components/Collider.ts +1 -1
  385. package/src/engine-components/Component.ts +9 -1
  386. package/src/engine-components/ContactShadows.ts +1 -1
  387. package/src/engine-components/DeleteBox.ts +2 -0
  388. package/src/engine-components/DeviceFlag.ts +4 -0
  389. package/src/engine-components/DragControls.ts +1 -0
  390. package/src/engine-components/DropListener.ts +1 -0
  391. package/src/engine-components/Duplicatable.ts +1 -0
  392. package/src/engine-components/EventTrigger.ts +2 -0
  393. package/src/engine-components/Gizmos.ts +2 -0
  394. package/src/engine-components/GridHelper.ts +2 -0
  395. package/src/engine-components/GroundProjection.ts +1 -0
  396. package/src/engine-components/Joints.ts +6 -0
  397. package/src/engine-components/LODGroup.ts +2 -0
  398. package/src/engine-components/Light.ts +1 -0
  399. package/src/engine-components/LookAtConstraint.ts +1 -0
  400. package/src/engine-components/NeedleMenu.ts +1 -0
  401. package/src/engine-components/NestedGltf.ts +1 -0
  402. package/src/engine-components/Networking.ts +1 -0
  403. package/src/engine-components/OffsetConstraint.ts +7 -0
  404. package/src/engine-components/OrbitControls.ts +1 -0
  405. package/src/engine-components/PlayerColor.ts +2 -0
  406. package/src/engine-components/ReflectionProbe.ts +1 -0
  407. package/src/engine-components/RendererInstancing.ts +69 -33
  408. package/src/engine-components/RigidBody.ts +1 -0
  409. package/src/engine-components/SceneSwitcher.ts +1 -0
  410. package/src/engine-components/ScreenCapture.ts +1 -0
  411. package/src/engine-components/SeeThrough.ts +1 -0
  412. package/src/engine-components/ShadowCatcher.ts +2 -0
  413. package/src/engine-components/Skybox.ts +48 -36
  414. package/src/engine-components/SmoothFollow.ts +1 -0
  415. package/src/engine-components/SpatialTrigger.ts +1 -0
  416. package/src/engine-components/SpectatorCamera.ts +1 -0
  417. package/src/engine-components/SpriteRenderer.ts +1 -0
  418. package/src/engine-components/SyncedCamera.ts +2 -0
  419. package/src/engine-components/SyncedRoom.ts +1 -0
  420. package/src/engine-components/SyncedTransform.ts +2 -0
  421. package/src/engine-components/TransformGizmo.ts +2 -0
  422. package/src/engine-components/VideoPlayer.ts +1 -0
  423. package/src/engine-components/Voip.ts +1 -0
  424. package/src/engine-components/export/gltf/GltfExport.ts +5 -0
  425. package/src/engine-components/export/usdz/USDZExporter.ts +53 -5
  426. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +18 -0
  427. package/src/engine-components/particlesystem/ParticleSystem.ts +1 -0
  428. package/src/engine-components/physics/Attractor.ts +3 -0
  429. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -0
  430. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +4 -0
  431. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +3 -0
  432. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +4 -0
  433. package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
  434. package/src/engine-components/postprocessing/Effects/Pixelation.ts +3 -0
  435. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +4 -0
  436. package/src/engine-components/postprocessing/Effects/Sharpening.ts +4 -0
  437. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +4 -0
  438. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +4 -0
  439. package/src/engine-components/postprocessing/Effects/Vignette.ts +4 -0
  440. package/src/engine-components/postprocessing/Volume.ts +1 -0
  441. package/src/engine-components/splines/Spline.ts +1 -0
  442. package/src/engine-components/splines/SplineWalker.ts +1 -0
  443. package/src/engine-components/timeline/PlayableDirector.ts +1 -0
  444. package/src/engine-components/timeline/SignalAsset.ts +1 -0
  445. package/src/engine-components/ui/Button.ts +4 -0
  446. package/src/engine-components/ui/Canvas.ts +5 -0
  447. package/src/engine-components/ui/CanvasGroup.ts +4 -0
  448. package/src/engine-components/ui/EventSystem.ts +2 -0
  449. package/src/engine-components/ui/Image.ts +4 -0
  450. package/src/engine-components/ui/InputField.ts +4 -0
  451. package/src/engine-components/ui/Outline.ts +7 -0
  452. package/src/engine-components/ui/SpatialHtml.ts +7 -0
  453. package/src/engine-components/ui/Text.ts +3 -0
  454. package/src/engine-components/utils/LookAt.ts +1 -0
  455. package/src/engine-components/web/Clickthrough.ts +1 -1
  456. package/src/engine-components/web/CursorFollow.ts +4 -0
  457. package/src/engine-components/web/HoverAnimation.ts +1 -0
  458. package/src/engine-components/web/ScrollFollow.ts +2 -0
  459. package/src/engine-components/web/ViewBox.ts +1 -0
  460. package/src/engine-components/webxr/Avatar.ts +5 -0
  461. package/src/engine-components/webxr/WebARCameraBackground.ts +1 -0
  462. package/src/engine-components/webxr/WebARSessionRoot.ts +1 -0
  463. package/src/engine-components/webxr/WebXR.ts +5 -1
  464. package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -0
  465. package/src/engine-components/webxr/controllers/XRControllerModel.ts +4 -0
  466. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +1 -0
  467. package/src/engine-components-experimental/networking/PlayerSync.ts +2 -0
  468. package/src/needle-engine.ts +4 -2
  469. package/dist/generateMeshBVH.worker-B9bjdr6J.js +0 -25
  470. package/dist/loader.worker-CiTwpNPW.js +0 -27
  471. package/dist/rapier-BqdcSmKY.umd.cjs +0 -1
  472. package/dist/rapier-Cg3w3nFI.min.js +0 -1
  473. package/dist/rapier-sU12SWAs.js +0 -5217
  474. package/lib/engine/webcomponents/needle-engine.attributes.d.ts +0 -70
  475. package/lib/engine/webcomponents/needle-engine.attributes.js +0 -2
  476. package/lib/engine/webcomponents/needle-engine.attributes.js.map +0 -1
  477. package/src/engine/webcomponents/needle-engine.attributes.ts +0 -85
@@ -566,6 +566,23 @@ export interface IPhysicsEngine {
566
566
  */
567
567
  boxOverlap(point: Vector3, size: Vector3, rotation: Vector4Like | null): Array<ShapeOverlapResult>;
568
568
 
569
+ /**
570
+ * Creates a collider in the physics world.
571
+ *
572
+ * @param collider - The collider component.
573
+ * @param desc - The collider description.
574
+ * @returns The created collider.
575
+ *
576
+ * @throws Will throw an error if the physics world is not initialized. Make sure to call `initialize()` before creating colliders.
577
+ *
578
+ * @example
579
+ * ```typescript
580
+ * const boxColliderDesc = NEEDLE_ENGINE_MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.cuboid(1, 1, 1);
581
+ * const collider = physicsEngine.createCollider(myBoxColliderComponent, boxColliderDesc);
582
+ * ```
583
+ */
584
+ createCollider(collider: ICollider, desc: any): any;
585
+
569
586
  // Collider methods
570
587
  /**
571
588
  * Adds a sphere collider to the physics world
@@ -7,6 +7,7 @@ declare type Type = new (...args: any[]) => any;
7
7
  class _TypeStore {
8
8
 
9
9
  private _types: Map<string, Type> = new Map();
10
+ private _reverseTypes: Map<Type, string> = new Map();
10
11
 
11
12
  constructor() {
12
13
  if (debug) console.warn("TypeStore: Created", this);
@@ -18,8 +19,10 @@ class _TypeStore {
18
19
  public add(key: string, type: Type) {
19
20
  if (debug) console.warn("ADD TYPE", key);
20
21
  const existing = this._types.get(key);
21
- if (!existing)
22
+ if (!existing) {
22
23
  this._types.set(key, type);
24
+ this._reverseTypes.set(type, key);
25
+ }
23
26
  else {
24
27
  if (debug) {
25
28
  if (existing !== type) {
@@ -40,11 +43,7 @@ class _TypeStore {
40
43
  * @returns the key/name for the given type if registered
41
44
  */
42
45
  public getKey(type: Type): string | null {
43
- for (const [key, value] of this._types) {
44
- if (value === type)
45
- return key;
46
- }
47
- return null;
46
+ return this._reverseTypes.get(type) || null;
48
47
  }
49
48
  }
50
49
 
@@ -2,6 +2,16 @@ import { madeWithNeedleSVG, needleLogoOnlySVG, needleLogoSVG } from "../assets/i
2
2
 
3
3
  const elementName = "needle-logo-element";
4
4
 
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ "needle-logo-element": NeedleLogoElement;
8
+ }
9
+ }
10
+
11
+ /**
12
+ * Needle logo web component used in the hosting UI (small, compact logo or full)
13
+ * @element needle-logo-element
14
+ */
5
15
  export class NeedleLogoElement extends HTMLElement {
6
16
 
7
17
  static get elementName() { return elementName; }
@@ -83,10 +93,12 @@ export class NeedleLogoElement extends HTMLElement {
83
93
  private readonly wrapper: HTMLDivElement;
84
94
  private readonly logoElement: HTMLImageElement;
85
95
 
96
+ /** Show or hide the logo element (used by the menu) */
86
97
  setLogoVisible(val: boolean) {
87
98
  this.logoElement.style.display = val ? "block" : "none";
88
99
  }
89
100
 
101
+ /** Switch the logo between full and compact versions */
90
102
  setType(type: "full" | "compact") {
91
103
  if (type === "full") {
92
104
  this.logoElement.src = needleLogoSVG;
@@ -9,6 +9,12 @@ import { getIconElement } from "../icons.js";
9
9
  import { NeedleLogoElement } from "../logo-element.js";
10
10
  import { NeedleSpatialMenu } from "./needle-menu-spatial.js";
11
11
 
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "needle-logo-element": NeedleLogoElement;
15
+ }
16
+ }
17
+
12
18
  const elementName = "needle-menu";
13
19
  const debug = getParam("debugmenu");
14
20
  const debugNonCommercial = getParam("debugnoncommercial");
@@ -264,6 +270,16 @@ export class NeedleMenu {
264
270
 
265
271
  }
266
272
 
273
+ /**
274
+ * `<needle-menu>` web component — lightweight menu used by Needle Engine.
275
+ *
276
+ * This element is intended as an internal UI primitive for hosting application
277
+ * menus and buttons. Use the higher-level `NeedleMenu` API from the engine
278
+ * code to manipulate it programmatically. Public DOM-facing methods are
279
+ * documented (appendChild / append / prepend / setPosition / setVisible).
280
+ *
281
+ * @element needle-menu
282
+ */
267
283
  export class NeedleMenuElement extends HTMLElement {
268
284
 
269
285
  static create() {
@@ -851,6 +867,7 @@ export class NeedleMenuElement extends HTMLElement {
851
867
  }
852
868
  }
853
869
 
870
+ /** @private user preference for logo visibility */
854
871
  private _userRequestedLogoVisible?: boolean = undefined;
855
872
  showNeedleLogo(visible: boolean) {
856
873
  this._userRequestedLogoVisible = visible;
@@ -891,6 +908,7 @@ export class NeedleMenuElement extends HTMLElement {
891
908
  this.root.classList.add(position);
892
909
  }
893
910
 
911
+ /** @private user preference for menu visibility */
894
912
  private _userRequestedMenuVisible?: boolean = undefined;
895
913
  setVisible(visible: boolean) {
896
914
  this._userRequestedMenuVisible = visible;
@@ -905,14 +923,17 @@ export class NeedleMenuElement extends HTMLElement {
905
923
  }
906
924
 
907
925
  // private _root: ShadowRoot | null = null;
926
+ /** @private root container element inside shadow DOM */
908
927
  private readonly root: HTMLDivElement;
909
- /** wraps the whole content */
928
+ /** @private wraps the whole content (internal layout) */
910
929
  private readonly wrapper: HTMLDivElement;
911
- /** contains the buttons and dynamic elements */
930
+ /** @private contains the buttons and dynamic elements */
912
931
  private readonly options: HTMLDivElement;
913
- /** contains the needle-logo html element */
932
+ /** @private contains the needle-logo html element */
914
933
  private readonly logoContainer: HTMLDivElement;
934
+ /** @private compact menu button element */
915
935
  private readonly compactMenuButton: HTMLButtonElement;
936
+ /** @private foldout container used in compact mode */
916
937
  private readonly foldout: HTMLDivElement;
917
938
 
918
939
  append(...nodes: (string | Node)[]): void {
@@ -2,6 +2,12 @@ import { isDevEnvironment } from "../debug/index.js";
2
2
  import { iconFontUrl, loadFont } from "./fonts.js";
3
3
  import { WebXRButtonFactory } from "./WebXRButtons.js";
4
4
 
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ "needle-button": NeedleButtonElement;
8
+ }
9
+ }
10
+
5
11
  const htmlTagName = "needle-button";
6
12
  const isDev = isDevEnvironment();
7
13
 
@@ -9,13 +9,21 @@ import { NeedleLoader } from "../engine_loaders.js";
9
9
  import { Context, ContextCreateArgs } from "../engine_setup.js";
10
10
  import { nameToThreeTonemapping } from "../engine_tonemapping.js";
11
11
  import { type INeedleEngineComponent, type LoadedModel } from "../engine_types.js";
12
+ import type { addAttributeChangeCallback } from "../engine_utils.js";
12
13
  import { getParam } from "../engine_utils.js";
13
14
  import { RGBAColor } from "../js-extensions/RGBAColor.js";
14
15
  import { ensureFonts } from "./fonts.js";
15
16
  import { arContainerClassName, AROverlayHandler } from "./needle-engine.ar-overlay.js";
16
- import { NeedleEngineAttributes, TonemappingAttributeOptions } from "./needle-engine.attributes.js";
17
+ import type { registerObservableAttribute} from "./needle-engine.extras.js";
17
18
  import { calculateProgress01, EngineLoadingView, type ILoadingViewHandler } from "./needle-engine.loading.js";
18
19
 
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ "needle-engine": NeedleEngineWebComponent;
23
+ }
24
+ }
25
+
26
+
19
27
  // registering loader here too to make sure it's imported when using engine via vanilla js
20
28
  registerLoader(NeedleLoader);
21
29
 
@@ -28,44 +36,69 @@ const knownClasses = [arContainerClassName, vrContainerClassName, desktopContain
28
36
  const arSessionActiveClassName = "ar-session-active";
29
37
  const desktopSessionActiveClassName = "desktop-session-active";
30
38
 
39
+ type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
40
+
41
+ // #region Observables
42
+
43
+ /** Keep in sync with the overloads and docs here:
44
+ * - {@link NeedleEngineWebComponent.setAttribute}
45
+ * - {@link NeedleEngineWebComponent.getAttribute}
46
+ * - {@link NeedleEngineWebComponent.addEventListener}
47
+ * - Docs in {@link [custom-elements.json](../../../custom-elements.json)}
48
+ * - {@link NeedleEngineWebComponent.attributeChangedCallback}
49
+ *
50
+ * Effectively, attributes used with these methods are also observable:
51
+ * - {@link registerObservableAttribute} or
52
+ * - {@link addAttributeChangeCallback}
53
+ * */
31
54
  const observedAttributes = [
32
- "public-key",
33
- "version",
34
-
35
- "hash",
55
+ // MainAttributes
36
56
  "src",
57
+ "hash",
37
58
  "camera-controls",
38
- "loadstart",
39
- "progress",
40
- "loadfinished",
41
-
42
59
  "dracoDecoderPath",
43
60
  "dracoDecoderType",
44
61
  "ktx2DecoderPath",
45
62
 
63
+ // keep-alive: effectively observed because read when needed
64
+
65
+ // private
66
+ "public-key",
67
+ "version",
68
+
69
+ // RenderingAttributes
46
70
  "tone-mapping",
47
71
  "tone-mapping-exposure",
48
72
  "background-blurriness",
49
73
  "background-color",
50
74
  "environment-intensity",
75
+ // background-image: registered in Skybox.ts
76
+ // environment-image: registered in Skybox.ts
51
77
 
78
+ // scene: registered in SceneSwitcher.ts
79
+ // clickthrough: registered in Clickthrough.ts
52
80
  "focus-rect",
81
+
82
+ // Events
83
+ "loadstart",
84
+ "progress",
85
+ "loadfinished",
53
86
  ]
54
87
 
55
88
  // https://developers.google.com/web/fundamentals/web-components/customelements
56
89
 
57
90
  /**
58
- * <needle-engine> web component. See {@link NeedleEngineAttributes} attributes for supported attributes
59
- * The needle engine web component creates and manages a needle engine context which is responsible for rendering a 3D scene using threejs.
60
- * The needle engine context is created when the src attribute is set and disposed when the needle engine is removed from the document (you can prevent this by setting the keep-alive attribute to true).
61
- * The needle engine context is accessible via the context property on the needle engine element (e.g. document.querySelector("needle-engine").context).
91
+ * The `<needle-engine>` web component. See {@link NeedleEngineAttributes} attributes for supported attributes
92
+ * The web component creates and manages a Needle Engine context, which is responsible for rendering a 3D scene using threejs.
93
+ * The context is created when the `src` attribute is set, and disposed when the element is removed from the DOM. You can prevent cleanup by setting the `keep-alive` attribute to `true`.
94
+ * The context is accessible from the `<needle-engine>` element: `document.querySelector("needle-engine").context`.
62
95
  * See {@link https://engine.needle.tools/docs/reference/needle-engine-attributes}
63
96
  *
64
97
  * @example
65
98
  * <needle-engine src="https://example.com/scene.glb"></needle-engine>
66
99
  * @example
67
100
  * <needle-engine src="https://example.com/scene.glb" camera-controls="false"></needle-engine>
68
- */
101
+ */
69
102
  export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngineComponent {
70
103
 
71
104
  static get observedAttributes() {
@@ -90,7 +123,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
90
123
  * @returns {boolean | null} if the attribute is not set it returns null
91
124
  */
92
125
  get cameraControls(): boolean | null {
93
- const attr = this.getAttribute("camera-controls") as NeedleEngineAttributes["camera-controls"] | ({} & string)
126
+ const attr = this.getAttribute("camera-controls") as string;
94
127
  if (attr == null) return null;
95
128
  if (attr === null || attr === "False" || attr === "false" || attr === "0" || attr === "none") return false;
96
129
  return true;
@@ -100,7 +133,6 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
100
133
  else this.setAttribute("camera-controls", value ? "true" : "false");
101
134
  }
102
135
 
103
-
104
136
  /**
105
137
  * Get the current context for this web component instance. The context is created when the src attribute is set and the loading has finished.
106
138
  * The context is disposed when the needle engine is removed from the document (you can prevent this by setting the keep-alive attribute to true).
@@ -133,7 +165,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
133
165
  private _loadingProgress01: number = 0;
134
166
  private _loadingView?: ILoadingViewHandler;
135
167
  private _previousSrc: string | null | string[] = null;
136
- /** set to true after <needle-engine> did load completely at least once. Set to false when <needle-engine> is removed from the document */
168
+ /** @private set to true after <needle-engine> did load completely at least once. Set to false when < to false when <needle-engine> is removed from the document removed from the document */
137
169
  private _didFullyLoad: boolean = false;
138
170
 
139
171
  constructor() {
@@ -146,6 +178,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
146
178
 
147
179
  this.attachShadow({ mode: 'open' });
148
180
  const template = document.createElement('template');
181
+ // #region CSS
149
182
  template.innerHTML = `<style>
150
183
  @import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap');
151
184
 
@@ -224,6 +257,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
224
257
  <slot class="overlay-content"></slot>
225
258
  </div>
226
259
  `;
260
+ // #endregion
227
261
 
228
262
  if (this.shadowRoot)
229
263
  this.shadowRoot.appendChild(template.content.cloneNode(true));
@@ -252,7 +286,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
252
286
  this.onSetupDesktop();
253
287
 
254
288
  if (!this.getAttribute("src")) {
255
- const global = globalThis["needle:codegen_files"] as unknown as string;
289
+ const global = (globalThis as any)["needle:codegen_files"] as unknown as string;
256
290
  if (debug) console.log("src is null, trying to load from globalThis[\"needle:codegen_files\"]", global);
257
291
  if (global) {
258
292
  if (debug) console.log("globalThis[\"needle:codegen_files\"]", global);
@@ -296,6 +330,11 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
296
330
  }
297
331
  }
298
332
 
333
+ connectedMoveCallback() {
334
+ // we dont want needle-engine to cleanup JUST because the element is moved in the DOM. See https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks
335
+ }
336
+
337
+ // #region attributeChanged
299
338
  /**
300
339
  * @internal
301
340
  */
@@ -317,7 +356,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
317
356
  case "loadfinished":
318
357
  if (typeof newValue === "string" && newValue.length > 0) {
319
358
  if (debug) console.log(name + " attribute changed", newValue);
320
- this.registerEventFromAttribute(name, newValue);
359
+ this.registerEventFromAttribute("loadfinished", newValue);
321
360
  }
322
361
  break;
323
362
  case "dracoDecoderPath":
@@ -441,7 +480,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
441
480
  if (allowOverridingDefaultLoading) {
442
481
  // Handle the <needle-engine hide-loading-overlay> attribute
443
482
  const hideOverlay = this.getAttribute("hide-loading-overlay");
444
- if (hideOverlay !== null && hideOverlay !== undefined && hideOverlay !== "0") {
483
+ if (hideOverlay !== null && hideOverlay !== undefined && (hideOverlay as any) !== "0") {
445
484
  useDefaultLoading = false;
446
485
  }
447
486
  }
@@ -555,6 +594,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
555
594
  }));
556
595
  }
557
596
 
597
+ // #region applyAttributes
558
598
  private applyAttributes() {
559
599
  // set tonemapping if configured
560
600
  if (this._context?.renderer) {
@@ -668,7 +708,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
668
708
  if (attributeValue)
669
709
  this.registerEventFromAttribute("loadstart", attributeValue);
670
710
  }
671
- private registerEventFromAttribute(eventName: string, code: string) {
711
+ private registerEventFromAttribute(eventName: 'loadfinished' | 'loadstart', code: string) {
672
712
  const prev = this._previouslyRegisteredMap.get(eventName);
673
713
  if (prev) {
674
714
  this._previouslyRegisteredMap.delete(eventName);
@@ -681,6 +721,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
681
721
  // const fn = new Function(newValue);
682
722
  if (typeof fn === "function") {
683
723
  this._previouslyRegisteredMap.set(eventName, fn);
724
+ // @ts-ignore // not sure how to type this properly
684
725
  this.addEventListener(eventName, evt => fn?.call(globalThis, this._context, evt));
685
726
  }
686
727
  }
@@ -828,15 +869,283 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
828
869
  setKtx2TranscoderPath(customKtx2DecoderPath);
829
870
  }
830
871
  }
872
+
873
+ // #region setAttribute
874
+
875
+ // MainAttributes
876
+ /** Change which model gets loaded. This will trigger a reload of the scene.
877
+ * @example src="path/to/scene.glb"
878
+ * @example src="[./path/scene1.glb, myOtherScene.gltf]"
879
+ * */
880
+ setAttribute(name: 'src', value: string): void;
881
+ /** Optional. String attached to the context for caching/identification. */
882
+ setAttribute(name: 'hash', value: string): void;
883
+ /** Set to automatically add {@link OrbitControls} to the loaded scene */
884
+ setAttribute(name: 'camera-controls', value: string): void;
885
+ /** Override the default draco decoder path location. */
886
+ setAttribute(name: 'dracoDecoderPath', value: string): void;
887
+ /** Override the default draco library type. */
888
+ setAttribute(name: 'dracoDecoderType', value: 'wasm' | 'js'): void;
889
+ /** Override the default KTX2 transcoder/decoder path */
890
+ setAttribute(name: 'ktx2DecoderPath', value: string): void;
891
+ /** Prevent Needle Engine context from being disposed when the element is removed from the DOM */
892
+ setAttribute(name: 'keep-alive', value: 'true' | 'false'): void;
893
+
894
+ /** @private Public key used for licensing and feature gating. */
895
+ setAttribute(name: 'public-key', value: string): void;
896
+ /** @private Engine version string — usually set by the build/runtime. */
897
+ setAttribute(name: 'version', value: string): void;
898
+
899
+ // LoadingAttributes
900
+ // ...
901
+
902
+ // SkyboxAttributes
903
+ /** URL to .exr, .hdr, .png, .jpg to be used as skybox */
904
+ setAttribute(name: 'background-image', value: string): void;
905
+ /** @private Rotation of the background image in degrees. */
906
+ setAttribute(name: 'background-rotation', value: string | number): void;
907
+ /** @deprecated Use 'environment-image' instead. */
908
+ setAttribute(name: 'skybox-image', value: string): void;
909
+ /** URL to .exr, .hdr, .png, .jpg to be used for lighting */
910
+ setAttribute(name: 'environment-image', value: string): void;
911
+ /** Intensity multiplier for environment lighting. */
912
+ setAttribute(name: 'environment-intensity', value: string): void;
913
+ /** Blurs the background image. Strength between 0 (sharp) and 1 (fully blurred). */
914
+ setAttribute(name: 'background-blurriness', value: string): void;
915
+ /** Intensity multiplier for the background image. */
916
+ setAttribute(name: 'background-intensity', value: string): void;
917
+ /**
918
+ * CSS background color value to be used if no skybox or background image is provided.
919
+ * @example "background-color='#ff0000'" will set the background color to red.
920
+ */
921
+ setAttribute(name: 'background-color', value: string): void;
922
+
923
+ // RenderingAttributes
924
+ /** Enable/disable renderer canvas transparency. */
925
+ setAttribute(name: 'transparent', value: 'true' | 'false'): void;
926
+ /** Enable/disable contact shadows in the rendered scene */
927
+ setAttribute(name: 'contact-shadows', value: 'true' | 'false'): void;
928
+ /** Tonemapping mode. */
929
+ setAttribute(name: 'tone-mapping', value: TonemappingAttributeOptions): void;
930
+ /** Exposure multiplier for tonemapping. */
931
+ setAttribute(name: 'tone-mapping-exposure', value: string): void;
932
+
933
+ /** Defines a CSS selector or HTMLElement where the camera should be focused on. Content will be fit into this element. */
934
+ setAttribute(name: 'focus-rect', value: string | HTMLElement): void;
935
+ /** Allow pointer events to pass through transparent parts of the content to the underlying DOM elements. */
936
+ setAttribute(name: 'clickthrough', value: 'true' | 'false'): void;
937
+ /** Automatically fits the model into the camera view on load. */
938
+ setAttribute(name: 'auto-fit', value: 'true' | 'false'): void;
939
+ /** Automatically rotates the model until a user interacts with the scene. */
940
+ setAttribute(name: 'auto-rotate', value: 'true' | 'false'): void;
941
+ /** Play animations automatically on scene load */
942
+ setAttribute(name: "autoplay", value: 'true' | 'false'): void;
943
+ /** @private Used for switching the scene in SceneSwitcher */
944
+ setAttribute(name: 'scene', value: string): void;
945
+
946
+ // setAttribute(name: 'loadstart', value: string): void;
947
+
948
+ /** @private Experimental.*/
949
+ setAttribute(name: 'loading-blur', value: 'true' | 'false'): void;
950
+ /** @private */
951
+ setAttribute(name: 'alias', value: string): void;
952
+ /** @private */
953
+ setAttribute(name: 'hide-loading-overlay', value: 'true' | 'false'): void;
954
+ /** @private */
955
+ setAttribute(name: 'no-telemetry', value: 'true' | 'false'): void;
956
+
957
+ /** Generic typed setter for known Needle Engine attributes */
958
+ // Comment out to see errors inside NE for undocumented attributes
959
+ // setAttribute<T extends keyof NeedleEngineAttributes>(qualifiedName: T, value: NeedleEngineAttributes[T]): void;
960
+
961
+ setAttribute(qualifiedName: ({} & string), value: string): void;
962
+
963
+ // The ones we're using internally:
964
+ /*
965
+ setAttribute(name: "tabindex", value: string): void;
966
+ */
967
+ setAttribute(qualifiedName: string, value: string): void {
968
+ super.setAttribute(qualifiedName, value);
969
+ }
970
+
971
+ // #region getAttribute
972
+
973
+ // MainAttributes
974
+ /** Change which model gets loaded. This will trigger a reload of the scene.
975
+ * @example src="path/to/scene.glb"
976
+ * @example src="[./path/scene1.glb, myOtherScene.gltf]"
977
+ * */
978
+ getAttribute(name: 'src'): string | null;
979
+ /** Optional. String attached to the context for caching/identification. */
980
+ getAttribute(name: 'hash'): string | null;
981
+ /** Set to automatically add {@link OrbitControls} to the loaded scene */
982
+ getAttribute(name: 'camera-controls'): "true" | "false" | "none" | null;
983
+ /** Override the default draco decoder path location. */
984
+ getAttribute(name: 'dracoDecoderPath'): string | null;
985
+ /** Override the default draco library type. */
986
+ getAttribute(name: 'dracoDecoderType'): "wasm" | "js" | null;
987
+ /** Override the default KTX2 transcoder/decoder path */
988
+ getAttribute(name: 'ktx2DecoderPath'): string | null;
989
+ /** Prevent Needle Engine context from being disposed when the element is removed from the DOM */
990
+ getAttribute(name: 'keep-alive'): string | null;
991
+
992
+ /** @private Public key used for licensing and feature gating. */
993
+ getAttribute(name: 'public-key'): string | null;
994
+ /** @private Engine version string — usually set by the build/runtime. */
995
+ getAttribute(name: 'version'): string | null;
996
+
997
+ // LoadingAttributes
998
+ // ...
999
+
1000
+ // SkyboxAttributes
1001
+ /** URL to .exr, .hdr, .png, .jpg to be used as skybox */
1002
+ getAttribute(name: 'background-image'): string | null;
1003
+ /** @private Rotation of the background image in degrees. */
1004
+ getAttribute(name: 'background-rotation'): string | null;
1005
+ /** URL to .exr, .hdr, .png, .jpg to be used for lighting */
1006
+ getAttribute(name: 'environment-image'): string | null;
1007
+ /** Intensity multiplier for environment lighting. */
1008
+ getAttribute(name: 'environment-intensity'): string | null;
1009
+ /** Blurs the background image. Strength between 0 (sharp) and 1 (fully blurred). */
1010
+ getAttribute(name: 'background-blurriness'): string | null;
1011
+ /** Intensity multiplier for the background image. */
1012
+ getAttribute(name: 'background-intensity'): string | null;
1013
+ /**
1014
+ * CSS background color value to be used if no skybox or background image is provided.
1015
+ * @example "background-color='#ff0000'" will set the background color to red.
1016
+ */
1017
+ getAttribute(name: 'background-color'): string | null;
1018
+
1019
+ // RenderingAttributes
1020
+ /** Enable/disable renderer canvas transparency. */
1021
+ getAttribute(name: 'transparent'): string | null;
1022
+ /** Enable/disable contact shadows in the rendered scene */
1023
+ getAttribute(name: 'contact-shadows'): string | null;
1024
+ /** @deprecated Use 'contact-shadows' instead. */
1025
+ getAttribute(name: 'contactshadows'): string | null;
1026
+ /** Tonemapping mode. */
1027
+ getAttribute(name: 'tone-mapping'): TonemappingAttributeOptions | null;
1028
+ /** @deprecated Use 'tone-mapping' instead. */
1029
+ getAttribute(name: 'tonemapping'): TonemappingAttributeOptions | null;
1030
+ /** Exposure multiplier for tonemapping. */
1031
+ getAttribute(name: 'tone-mapping-exposure'): string | null;
1032
+
1033
+ /** Defines a CSS selector or HTMLElement where the camera should be focused on. Content will be fit into this element. */
1034
+ getAttribute(name: 'focus-rect'): string | null;
1035
+ /** Allow pointer events to pass through transparent parts of the content to the underlying DOM elements. */
1036
+ getAttribute(name: 'clickthrough'): string | null;
1037
+ /** Automatically fits the model into the camera view on load. */
1038
+ getAttribute(name: 'auto-fit'): string | null;
1039
+ /** @deprecated Use 'auto-fit' instead. */
1040
+ getAttribute(name: 'autofit'): string | null;
1041
+ /** Automatically rotates the model until a user interacts with the scene. */
1042
+ getAttribute(name: 'auto-rotate'): string | null;
1043
+ /** Play animations automatically on scene load */
1044
+ getAttribute(name: "autoplay"): string | null;
1045
+ /** @private Used for switching the scene in SceneSwitcher */
1046
+ getAttribute(name: 'scene'): string | null;
1047
+ // getAttribute(name: 'loadstart'): string | null;
1048
+
1049
+ /** @private Experimental.*/
1050
+ getAttribute(name: 'loading-blur'): string | null;
1051
+ /** @private */
1052
+ getAttribute(name: 'alias'): string | null;
1053
+ /** @private */
1054
+ getAttribute(name: 'hide-loading-overlay'): string | null;
1055
+ /** @private */
1056
+ getAttribute(name: 'no-telemetry'): string | null;
1057
+
1058
+ // Comment these out to get development errors for undocumented NE attributes
1059
+ /** Typed getter for known NeedleEngine attribute names; returns the typed shape declared in NeedleEngineAttributes or null. */
1060
+ // getAttribute<T extends keyof NeedleEngineAttributes>(qualifiedName: T): NeedleEngineAttributes[T] | null;
1061
+ getAttribute(qualifiedName: ({} & string)): string | null;
1062
+
1063
+ // The ones we're using interally:
1064
+ /*
1065
+ getAttribute(name: "autostart"): string | null;
1066
+ getAttribute(name: "tabindex"): string | null;
1067
+ */
1068
+
1069
+ getAttribute(qualifiedName: string): string | null {
1070
+ return super.getAttribute(qualifiedName);
1071
+ }
1072
+
1073
+ // #region addEventListener
1074
+
1075
+ /**
1076
+ * Emitted when loading begins for the scene. The event is cancelable — calling `preventDefault()`
1077
+ * will stop the default loading UI behavior, so apps can implement custom loading flows.
1078
+ */
1079
+ addEventListener(type: 'loadstart', listener: (ev: CustomEvent<{ context: Context; alias: string | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1080
+ /** Emitted repeatedly while loading resources. Use the event detail to show progress. */
1081
+ addEventListener(type: 'progress', listener: (ev: CustomEvent<{ context: Context; name: string; progress: ProgressEvent<EventTarget>; index: number; count: number; totalProgress01: number }>) => void, options?: boolean | AddEventListenerOptions): void;
1082
+ /** Emitted when scene loading has finished. */
1083
+ addEventListener(type: 'loadfinished', listener: (ev: CustomEvent<{ context: Context; src: string | null; loadedFiles: LoadedModel[] }>) => void, options?: boolean | AddEventListenerOptions): void;
1084
+ /** Emitted when an XR session ends. */
1085
+ addEventListener(type: 'xr-session-ended', listener: (ev: CustomEvent<{ session: XRSession | null; context: Context; sessionMode: XRSessionMode | undefined }>) => void, options?: boolean | AddEventListenerOptions): void;
1086
+ /** Emitted when entering an AR session. */
1087
+ addEventListener(type: 'enter-ar', listener: (ev: CustomEvent<{ session: XRSession; context: Context; htmlContainer: HTMLElement | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1088
+ /** Emitted when exiting an AR session. */
1089
+ addEventListener(type: 'exit-ar', listener: (ev: CustomEvent<{ session: XRSession; context: Context; htmlContainer: HTMLElement | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1090
+ /** Emitted when entering a VR session. */
1091
+ addEventListener(type: 'enter-vr', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1092
+ /** Emitted when exiting a VR session. */
1093
+ addEventListener(type: 'exit-vr', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1094
+ /** Emitted when the engine has rendered its first frame and is ready. */
1095
+ addEventListener(type: 'ready', listener: (ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
1096
+ /** Emitted when an XR session is started. You can do additional setup here. */
1097
+ addEventListener(type: 'xr-session-started', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1098
+
1099
+ // Sadly not enough to make types work (see comment below)
1100
+ addEventListener<K extends keyof HTMLElementEventMap>(type: ({} & K), listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
1101
+ // These are from the super type. Not sure how we can remove intellisense for the "regular" events while still making the types work...
1102
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1103
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1104
+ // This would be better but doesn't completely solve it
1105
+ // addEventListener(type: ({} & string), listener: any, options?: boolean | AddEventListenerOptions): void;
1106
+
1107
+ // The ones we're using interally:
1108
+ /*
1109
+ addEventListener(type: "error", listener: (ev: ErrorEvent) => void, options?: boolean | AddEventListenerOptions): void;
1110
+ addEventListener(type: "wheel", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1111
+ addEventListener(type: "keydown", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1112
+ addEventListener(type: "drop", listener: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): void;
1113
+ addEventListener(type: "dragover", listener: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): void;
1114
+ */
1115
+ addEventListener(type: string, listener: any, options?: boolean | AddEventListenerOptions): void
1116
+ {
1117
+ return super.addEventListener(type, listener as EventListenerOrEventListenerObject, options);
1118
+ }
831
1119
  }
832
1120
 
833
1121
  if (typeof window !== "undefined" && !window.customElements.get(htmlTagName))
834
1122
  window.customElements.define(htmlTagName, NeedleEngineWebComponent);
835
1123
 
1124
+ /** Quick testing for the types as declared above */
1125
+ /*
1126
+ const elem = document.querySelector("needle-engine")!;
1127
+ elem.setAttribute("src", "model.glb");
1128
+ elem.addEventListener("loadfinished", (ev) => {
1129
+ const context = ev.detail.context;
1130
+ });
1131
+ elem.setAttribute("dracoDecoderType", "wasm");
1132
+ elem.addEventListener("enter-ar", (ev) => {
1133
+ const session = ev.detail.session;
1134
+ });
836
1135
 
1136
+ elem.addEventListener("mousedown", (ev) => {
1137
+ console.log("regular mousedown event", ev);
1138
+ });
837
1139
 
1140
+ const onDragOverEvent = (e: DragEvent) => {
838
1141
 
1142
+ };
839
1143
 
1144
+ elem.addEventListener("dragover", onDragOverEvent);
1145
+ */
1146
+ /* END Type testing */
1147
+
1148
+ // #region Utility functions
840
1149
 
841
1150
  function getDisplayName(str: string) {
842
1151
  if (str.startsWith("blob:")) {
@@ -956,4 +1265,4 @@ function handleLoadingBlur(needleEngineElement: NeedleEngineWebComponent) {
956
1265
  }
957
1266
  }
958
1267
  }, { once: true });
959
- }
1268
+ }