@needle-tools/engine 4.11.5-next.d9019e4 → 4.11.5-next.dedc70b

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 (367) hide show
  1. package/components.needle.json +1 -1
  2. package/custom-elements.json +436 -0
  3. package/dist/{needle-engine.bundle-GILPT50v.min.js → needle-engine.bundle-CJlEyOBM.min.js} +4 -4
  4. package/dist/{needle-engine.bundle-DbRanrPL.umd.cjs → needle-engine.bundle-DgiVW9bH.umd.cjs} +6 -6
  5. package/dist/{needle-engine.bundle-D4DKOVeW.js → needle-engine.bundle-F4gDjlNg.js} +60 -14
  6. package/dist/needle-engine.d.ts +18154 -1
  7. package/dist/needle-engine.js +2 -2
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/lib/engine/api.d.ts +0 -1
  11. package/lib/engine/api.js +0 -1
  12. package/lib/engine/api.js.map +1 -1
  13. package/lib/engine/engine_texture.d.ts +1 -1
  14. package/lib/engine/engine_tonemapping.d.ts +1 -1
  15. package/lib/engine/webcomponents/logo-element.d.ts +11 -0
  16. package/lib/engine/webcomponents/logo-element.js +6 -0
  17. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  18. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +24 -3
  19. package/lib/engine/webcomponents/needle menu/needle-menu.js +18 -3
  20. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  21. package/lib/engine/webcomponents/needle-button.d.ts +5 -0
  22. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  23. package/lib/engine/webcomponents/needle-engine.d.ts +209 -8
  24. package/lib/engine/webcomponents/needle-engine.js +91 -13
  25. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  26. package/lib/engine-components/AlignmentConstraint.d.ts +9 -0
  27. package/lib/engine-components/AlignmentConstraint.js +9 -0
  28. package/lib/engine-components/AlignmentConstraint.js.map +1 -1
  29. package/lib/engine-components/Animator.d.ts +1 -0
  30. package/lib/engine-components/Animator.js.map +1 -1
  31. package/lib/engine-components/AudioListener.d.ts +2 -0
  32. package/lib/engine-components/AudioListener.js +2 -0
  33. package/lib/engine-components/AudioListener.js.map +1 -1
  34. package/lib/engine-components/AudioSource.d.ts +1 -0
  35. package/lib/engine-components/AudioSource.js +1 -0
  36. package/lib/engine-components/AudioSource.js.map +1 -1
  37. package/lib/engine-components/AxesHelper.d.ts +2 -0
  38. package/lib/engine-components/AxesHelper.js +2 -0
  39. package/lib/engine-components/AxesHelper.js.map +1 -1
  40. package/lib/engine-components/Camera.d.ts +1 -0
  41. package/lib/engine-components/Camera.js +1 -0
  42. package/lib/engine-components/Camera.js.map +1 -1
  43. package/lib/engine-components/CharacterController.d.ts +4 -1
  44. package/lib/engine-components/CharacterController.js +4 -1
  45. package/lib/engine-components/CharacterController.js.map +1 -1
  46. package/lib/engine-components/DeleteBox.d.ts +2 -0
  47. package/lib/engine-components/DeleteBox.js +2 -0
  48. package/lib/engine-components/DeleteBox.js.map +1 -1
  49. package/lib/engine-components/DeviceFlag.d.ts +4 -0
  50. package/lib/engine-components/DeviceFlag.js +4 -0
  51. package/lib/engine-components/DeviceFlag.js.map +1 -1
  52. package/lib/engine-components/DragControls.d.ts +1 -0
  53. package/lib/engine-components/DragControls.js +1 -0
  54. package/lib/engine-components/DragControls.js.map +1 -1
  55. package/lib/engine-components/DropListener.d.ts +1 -0
  56. package/lib/engine-components/DropListener.js +1 -0
  57. package/lib/engine-components/DropListener.js.map +1 -1
  58. package/lib/engine-components/Duplicatable.d.ts +1 -0
  59. package/lib/engine-components/Duplicatable.js +1 -0
  60. package/lib/engine-components/Duplicatable.js.map +1 -1
  61. package/lib/engine-components/EventTrigger.d.ts +2 -0
  62. package/lib/engine-components/EventTrigger.js +2 -0
  63. package/lib/engine-components/EventTrigger.js.map +1 -1
  64. package/lib/engine-components/GridHelper.d.ts +2 -0
  65. package/lib/engine-components/GridHelper.js +2 -0
  66. package/lib/engine-components/GridHelper.js.map +1 -1
  67. package/lib/engine-components/GroundProjection.d.ts +1 -0
  68. package/lib/engine-components/GroundProjection.js +1 -0
  69. package/lib/engine-components/GroundProjection.js.map +1 -1
  70. package/lib/engine-components/LODGroup.d.ts +2 -0
  71. package/lib/engine-components/LODGroup.js +2 -0
  72. package/lib/engine-components/LODGroup.js.map +1 -1
  73. package/lib/engine-components/Light.d.ts +1 -0
  74. package/lib/engine-components/Light.js +1 -0
  75. package/lib/engine-components/Light.js.map +1 -1
  76. package/lib/engine-components/LookAtConstraint.d.ts +1 -0
  77. package/lib/engine-components/LookAtConstraint.js +1 -0
  78. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  79. package/lib/engine-components/NeedleMenu.d.ts +1 -0
  80. package/lib/engine-components/NeedleMenu.js +1 -0
  81. package/lib/engine-components/NeedleMenu.js.map +1 -1
  82. package/lib/engine-components/NestedGltf.d.ts +1 -0
  83. package/lib/engine-components/NestedGltf.js +1 -0
  84. package/lib/engine-components/NestedGltf.js.map +1 -1
  85. package/lib/engine-components/Networking.d.ts +1 -0
  86. package/lib/engine-components/Networking.js +1 -0
  87. package/lib/engine-components/Networking.js.map +1 -1
  88. package/lib/engine-components/OffsetConstraint.d.ts +7 -0
  89. package/lib/engine-components/OffsetConstraint.js +7 -0
  90. package/lib/engine-components/OffsetConstraint.js.map +1 -1
  91. package/lib/engine-components/OrbitControls.d.ts +1 -0
  92. package/lib/engine-components/OrbitControls.js +1 -0
  93. package/lib/engine-components/OrbitControls.js.map +1 -1
  94. package/lib/engine-components/PlayerColor.d.ts +2 -0
  95. package/lib/engine-components/PlayerColor.js +2 -0
  96. package/lib/engine-components/PlayerColor.js.map +1 -1
  97. package/lib/engine-components/ReflectionProbe.d.ts +1 -0
  98. package/lib/engine-components/ReflectionProbe.js +1 -0
  99. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  100. package/lib/engine-components/RigidBody.d.ts +1 -0
  101. package/lib/engine-components/RigidBody.js +1 -0
  102. package/lib/engine-components/RigidBody.js.map +1 -1
  103. package/lib/engine-components/SceneSwitcher.d.ts +1 -0
  104. package/lib/engine-components/SceneSwitcher.js +1 -0
  105. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  106. package/lib/engine-components/ScreenCapture.d.ts +1 -0
  107. package/lib/engine-components/ScreenCapture.js +1 -0
  108. package/lib/engine-components/ScreenCapture.js.map +1 -1
  109. package/lib/engine-components/SeeThrough.d.ts +1 -0
  110. package/lib/engine-components/SeeThrough.js +1 -0
  111. package/lib/engine-components/SeeThrough.js.map +1 -1
  112. package/lib/engine-components/ShadowCatcher.d.ts +2 -0
  113. package/lib/engine-components/ShadowCatcher.js +2 -0
  114. package/lib/engine-components/ShadowCatcher.js.map +1 -1
  115. package/lib/engine-components/Skybox.d.ts +1 -0
  116. package/lib/engine-components/Skybox.js +1 -0
  117. package/lib/engine-components/Skybox.js.map +1 -1
  118. package/lib/engine-components/SmoothFollow.d.ts +1 -0
  119. package/lib/engine-components/SmoothFollow.js +1 -0
  120. package/lib/engine-components/SmoothFollow.js.map +1 -1
  121. package/lib/engine-components/SpatialTrigger.d.ts +1 -0
  122. package/lib/engine-components/SpatialTrigger.js +1 -0
  123. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  124. package/lib/engine-components/SpectatorCamera.d.ts +1 -0
  125. package/lib/engine-components/SpectatorCamera.js +1 -0
  126. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  127. package/lib/engine-components/SpriteRenderer.d.ts +1 -0
  128. package/lib/engine-components/SpriteRenderer.js +1 -0
  129. package/lib/engine-components/SpriteRenderer.js.map +1 -1
  130. package/lib/engine-components/SyncedCamera.d.ts +2 -0
  131. package/lib/engine-components/SyncedCamera.js +2 -0
  132. package/lib/engine-components/SyncedCamera.js.map +1 -1
  133. package/lib/engine-components/SyncedRoom.d.ts +1 -0
  134. package/lib/engine-components/SyncedRoom.js +1 -0
  135. package/lib/engine-components/SyncedRoom.js.map +1 -1
  136. package/lib/engine-components/SyncedTransform.d.ts +2 -0
  137. package/lib/engine-components/SyncedTransform.js +2 -0
  138. package/lib/engine-components/SyncedTransform.js.map +1 -1
  139. package/lib/engine-components/TransformGizmo.d.ts +2 -0
  140. package/lib/engine-components/TransformGizmo.js +2 -0
  141. package/lib/engine-components/TransformGizmo.js.map +1 -1
  142. package/lib/engine-components/VideoPlayer.d.ts +1 -0
  143. package/lib/engine-components/VideoPlayer.js +1 -0
  144. package/lib/engine-components/VideoPlayer.js.map +1 -1
  145. package/lib/engine-components/Voip.d.ts +1 -0
  146. package/lib/engine-components/Voip.js +1 -0
  147. package/lib/engine-components/Voip.js.map +1 -1
  148. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +18 -0
  149. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +18 -0
  150. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  151. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +1 -0
  152. package/lib/engine-components/particlesystem/ParticleSystem.js +1 -0
  153. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  154. package/lib/engine-components/physics/Attractor.d.ts +3 -0
  155. package/lib/engine-components/physics/Attractor.js +3 -0
  156. package/lib/engine-components/physics/Attractor.js.map +1 -1
  157. package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -0
  158. package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -0
  159. package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
  160. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +4 -0
  161. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +4 -0
  162. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
  163. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +3 -0
  164. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +3 -0
  165. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
  166. package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +4 -0
  167. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +4 -0
  168. package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
  169. package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
  170. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
  171. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
  172. package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +3 -0
  173. package/lib/engine-components/postprocessing/Effects/Pixelation.js +3 -0
  174. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  175. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +4 -0
  176. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +4 -0
  177. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
  178. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +4 -0
  179. package/lib/engine-components/postprocessing/Effects/Sharpening.js +4 -0
  180. package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
  181. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +4 -0
  182. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +4 -0
  183. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
  184. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +4 -0
  185. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +4 -0
  186. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  187. package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +4 -0
  188. package/lib/engine-components/postprocessing/Effects/Vignette.js +4 -0
  189. package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
  190. package/lib/engine-components/postprocessing/Volume.d.ts +1 -0
  191. package/lib/engine-components/postprocessing/Volume.js +1 -0
  192. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  193. package/lib/engine-components/splines/Spline.d.ts +1 -0
  194. package/lib/engine-components/splines/Spline.js +1 -0
  195. package/lib/engine-components/splines/Spline.js.map +1 -1
  196. package/lib/engine-components/splines/SplineWalker.d.ts +1 -0
  197. package/lib/engine-components/splines/SplineWalker.js +1 -0
  198. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  199. package/lib/engine-components/timeline/PlayableDirector.d.ts +1 -0
  200. package/lib/engine-components/timeline/PlayableDirector.js +1 -0
  201. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  202. package/lib/engine-components/timeline/SignalAsset.d.ts +1 -0
  203. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  204. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  205. package/lib/engine-components/ui/Button.d.ts +4 -0
  206. package/lib/engine-components/ui/Button.js +4 -0
  207. package/lib/engine-components/ui/Button.js.map +1 -1
  208. package/lib/engine-components/ui/Canvas.d.ts +5 -0
  209. package/lib/engine-components/ui/Canvas.js +5 -0
  210. package/lib/engine-components/ui/Canvas.js.map +1 -1
  211. package/lib/engine-components/ui/CanvasGroup.d.ts +4 -0
  212. package/lib/engine-components/ui/CanvasGroup.js +4 -0
  213. package/lib/engine-components/ui/CanvasGroup.js.map +1 -1
  214. package/lib/engine-components/ui/EventSystem.d.ts +2 -0
  215. package/lib/engine-components/ui/EventSystem.js +2 -0
  216. package/lib/engine-components/ui/EventSystem.js.map +1 -1
  217. package/lib/engine-components/ui/Image.d.ts +4 -0
  218. package/lib/engine-components/ui/Image.js +4 -0
  219. package/lib/engine-components/ui/Image.js.map +1 -1
  220. package/lib/engine-components/ui/InputField.d.ts +4 -0
  221. package/lib/engine-components/ui/InputField.js +4 -0
  222. package/lib/engine-components/ui/InputField.js.map +1 -1
  223. package/lib/engine-components/ui/Outline.d.ts +7 -0
  224. package/lib/engine-components/ui/Outline.js +7 -0
  225. package/lib/engine-components/ui/Outline.js.map +1 -1
  226. package/lib/engine-components/ui/Text.d.ts +1 -0
  227. package/lib/engine-components/ui/Text.js +1 -0
  228. package/lib/engine-components/ui/Text.js.map +1 -1
  229. package/lib/engine-components/utils/LookAt.d.ts +1 -0
  230. package/lib/engine-components/utils/LookAt.js +1 -0
  231. package/lib/engine-components/utils/LookAt.js.map +1 -1
  232. package/lib/engine-components/web/Clickthrough.d.ts +1 -1
  233. package/lib/engine-components/web/Clickthrough.js +1 -1
  234. package/lib/engine-components/web/CursorFollow.d.ts +1 -0
  235. package/lib/engine-components/web/CursorFollow.js +1 -0
  236. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  237. package/lib/engine-components/web/HoverAnimation.d.ts +1 -0
  238. package/lib/engine-components/web/HoverAnimation.js +1 -0
  239. package/lib/engine-components/web/HoverAnimation.js.map +1 -1
  240. package/lib/engine-components/web/ScrollFollow.d.ts +2 -0
  241. package/lib/engine-components/web/ScrollFollow.js +2 -0
  242. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  243. package/lib/engine-components/web/ViewBox.d.ts +1 -0
  244. package/lib/engine-components/web/ViewBox.js +1 -0
  245. package/lib/engine-components/web/ViewBox.js.map +1 -1
  246. package/lib/engine-components/webxr/Avatar.d.ts +5 -0
  247. package/lib/engine-components/webxr/Avatar.js +5 -0
  248. package/lib/engine-components/webxr/Avatar.js.map +1 -1
  249. package/lib/engine-components/webxr/WebARCameraBackground.d.ts +1 -0
  250. package/lib/engine-components/webxr/WebARCameraBackground.js +1 -0
  251. package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
  252. package/lib/engine-components/webxr/WebARSessionRoot.d.ts +1 -0
  253. package/lib/engine-components/webxr/WebARSessionRoot.js +1 -0
  254. package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
  255. package/lib/engine-components/webxr/WebXR.d.ts +1 -1
  256. package/lib/engine-components/webxr/WebXR.js +1 -1
  257. package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +1 -0
  258. package/lib/engine-components/webxr/controllers/XRControllerFollow.js +1 -0
  259. package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
  260. package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +4 -0
  261. package/lib/engine-components/webxr/controllers/XRControllerModel.js +4 -0
  262. package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
  263. package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +1 -0
  264. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +1 -0
  265. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  266. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +2 -0
  267. package/lib/engine-components-experimental/networking/PlayerSync.js +2 -0
  268. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  269. package/package.json +19 -12
  270. package/plugins/types/needleConfig.d.ts +1 -1
  271. package/plugins/types/next.d.ts +1 -1
  272. package/plugins/types/userconfig.d.ts +4 -1
  273. package/plugins/vite/custom-element-data.js +80 -0
  274. package/plugins/vite/index.js +4 -0
  275. package/src/engine/api.ts +0 -1
  276. package/src/engine/engine_texture.ts +1 -1
  277. package/src/engine/engine_tonemapping.ts +1 -1
  278. package/src/engine/webcomponents/logo-element.ts +12 -0
  279. package/src/engine/webcomponents/needle menu/needle-menu.ts +24 -3
  280. package/src/engine/webcomponents/needle-button.ts +6 -0
  281. package/src/engine/webcomponents/needle-engine.ts +317 -22
  282. package/src/engine-components/AlignmentConstraint.ts +9 -0
  283. package/src/engine-components/Animator.ts +1 -0
  284. package/src/engine-components/AudioListener.ts +2 -0
  285. package/src/engine-components/AudioSource.ts +1 -0
  286. package/src/engine-components/AxesHelper.ts +2 -0
  287. package/src/engine-components/Camera.ts +1 -0
  288. package/src/engine-components/CharacterController.ts +4 -1
  289. package/src/engine-components/DeleteBox.ts +2 -0
  290. package/src/engine-components/DeviceFlag.ts +4 -0
  291. package/src/engine-components/DragControls.ts +1 -0
  292. package/src/engine-components/DropListener.ts +1 -0
  293. package/src/engine-components/Duplicatable.ts +1 -0
  294. package/src/engine-components/EventTrigger.ts +2 -0
  295. package/src/engine-components/GridHelper.ts +2 -0
  296. package/src/engine-components/GroundProjection.ts +1 -0
  297. package/src/engine-components/LODGroup.ts +2 -0
  298. package/src/engine-components/Light.ts +1 -0
  299. package/src/engine-components/LookAtConstraint.ts +1 -0
  300. package/src/engine-components/NeedleMenu.ts +1 -0
  301. package/src/engine-components/NestedGltf.ts +1 -0
  302. package/src/engine-components/Networking.ts +1 -0
  303. package/src/engine-components/OffsetConstraint.ts +7 -0
  304. package/src/engine-components/OrbitControls.ts +1 -0
  305. package/src/engine-components/PlayerColor.ts +2 -0
  306. package/src/engine-components/ReflectionProbe.ts +1 -0
  307. package/src/engine-components/RigidBody.ts +1 -0
  308. package/src/engine-components/SceneSwitcher.ts +1 -0
  309. package/src/engine-components/ScreenCapture.ts +1 -0
  310. package/src/engine-components/SeeThrough.ts +1 -0
  311. package/src/engine-components/ShadowCatcher.ts +2 -0
  312. package/src/engine-components/Skybox.ts +1 -0
  313. package/src/engine-components/SmoothFollow.ts +1 -0
  314. package/src/engine-components/SpatialTrigger.ts +1 -0
  315. package/src/engine-components/SpectatorCamera.ts +1 -0
  316. package/src/engine-components/SpriteRenderer.ts +1 -0
  317. package/src/engine-components/SyncedCamera.ts +2 -0
  318. package/src/engine-components/SyncedRoom.ts +1 -0
  319. package/src/engine-components/SyncedTransform.ts +2 -0
  320. package/src/engine-components/TransformGizmo.ts +2 -0
  321. package/src/engine-components/VideoPlayer.ts +1 -0
  322. package/src/engine-components/Voip.ts +1 -0
  323. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +18 -0
  324. package/src/engine-components/particlesystem/ParticleSystem.ts +1 -0
  325. package/src/engine-components/physics/Attractor.ts +3 -0
  326. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -0
  327. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +4 -0
  328. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +3 -0
  329. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +4 -0
  330. package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
  331. package/src/engine-components/postprocessing/Effects/Pixelation.ts +3 -0
  332. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +4 -0
  333. package/src/engine-components/postprocessing/Effects/Sharpening.ts +4 -0
  334. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +4 -0
  335. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +4 -0
  336. package/src/engine-components/postprocessing/Effects/Vignette.ts +4 -0
  337. package/src/engine-components/postprocessing/Volume.ts +1 -0
  338. package/src/engine-components/splines/Spline.ts +1 -0
  339. package/src/engine-components/splines/SplineWalker.ts +1 -0
  340. package/src/engine-components/timeline/PlayableDirector.ts +1 -0
  341. package/src/engine-components/timeline/SignalAsset.ts +1 -0
  342. package/src/engine-components/ui/Button.ts +4 -0
  343. package/src/engine-components/ui/Canvas.ts +5 -0
  344. package/src/engine-components/ui/CanvasGroup.ts +4 -0
  345. package/src/engine-components/ui/EventSystem.ts +2 -0
  346. package/src/engine-components/ui/Image.ts +4 -0
  347. package/src/engine-components/ui/InputField.ts +4 -0
  348. package/src/engine-components/ui/Outline.ts +7 -0
  349. package/src/engine-components/ui/Text.ts +1 -0
  350. package/src/engine-components/utils/LookAt.ts +1 -0
  351. package/src/engine-components/web/Clickthrough.ts +1 -1
  352. package/src/engine-components/web/CursorFollow.ts +1 -0
  353. package/src/engine-components/web/HoverAnimation.ts +1 -0
  354. package/src/engine-components/web/ScrollFollow.ts +2 -0
  355. package/src/engine-components/web/ViewBox.ts +1 -0
  356. package/src/engine-components/webxr/Avatar.ts +5 -0
  357. package/src/engine-components/webxr/WebARCameraBackground.ts +1 -0
  358. package/src/engine-components/webxr/WebARSessionRoot.ts +1 -0
  359. package/src/engine-components/webxr/WebXR.ts +1 -1
  360. package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -0
  361. package/src/engine-components/webxr/controllers/XRControllerModel.ts +4 -0
  362. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +1 -0
  363. package/src/engine-components-experimental/networking/PlayerSync.ts +2 -0
  364. package/lib/engine/webcomponents/needle-engine.attributes.d.ts +0 -70
  365. package/lib/engine/webcomponents/needle-engine.attributes.js +0 -2
  366. package/lib/engine/webcomponents/needle-engine.attributes.js.map +0 -1
  367. package/src/engine/webcomponents/needle-engine.attributes.ts +0 -85
@@ -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);
@@ -300,6 +334,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
300
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
301
335
  }
302
336
 
337
+ // #region attributeChanged
303
338
  /**
304
339
  * @internal
305
340
  */
@@ -321,7 +356,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
321
356
  case "loadfinished":
322
357
  if (typeof newValue === "string" && newValue.length > 0) {
323
358
  if (debug) console.log(name + " attribute changed", newValue);
324
- this.registerEventFromAttribute(name, newValue);
359
+ this.registerEventFromAttribute("loadfinished", newValue);
325
360
  }
326
361
  break;
327
362
  case "dracoDecoderPath":
@@ -445,7 +480,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
445
480
  if (allowOverridingDefaultLoading) {
446
481
  // Handle the <needle-engine hide-loading-overlay> attribute
447
482
  const hideOverlay = this.getAttribute("hide-loading-overlay");
448
- if (hideOverlay !== null && hideOverlay !== undefined && hideOverlay !== "0") {
483
+ if (hideOverlay !== null && hideOverlay !== undefined && (hideOverlay as any) !== "0") {
449
484
  useDefaultLoading = false;
450
485
  }
451
486
  }
@@ -559,6 +594,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
559
594
  }));
560
595
  }
561
596
 
597
+ // #region applyAttributes
562
598
  private applyAttributes() {
563
599
  // set tonemapping if configured
564
600
  if (this._context?.renderer) {
@@ -672,7 +708,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
672
708
  if (attributeValue)
673
709
  this.registerEventFromAttribute("loadstart", attributeValue);
674
710
  }
675
- private registerEventFromAttribute(eventName: string, code: string) {
711
+ private registerEventFromAttribute(eventName: 'loadfinished' | 'loadstart', code: string) {
676
712
  const prev = this._previouslyRegisteredMap.get(eventName);
677
713
  if (prev) {
678
714
  this._previouslyRegisteredMap.delete(eventName);
@@ -685,6 +721,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
685
721
  // const fn = new Function(newValue);
686
722
  if (typeof fn === "function") {
687
723
  this._previouslyRegisteredMap.set(eventName, fn);
724
+ // @ts-ignore // not sure how to type this properly
688
725
  this.addEventListener(eventName, evt => fn?.call(globalThis, this._context, evt));
689
726
  }
690
727
  }
@@ -832,15 +869,273 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
832
869
  setKtx2TranscoderPath(customKtx2DecoderPath);
833
870
  }
834
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
+ setAttribute(name: 'transparent', value: 'true' | 'false'): void;
925
+ setAttribute(name: 'contact-shadows', value: 'true' | 'false'): void;
926
+ /** Tonemapping mode. */
927
+ setAttribute(name: 'tone-mapping', value: TonemappingAttributeOptions): void;
928
+ /** Exposure multiplier for tonemapping. */
929
+ setAttribute(name: 'tone-mapping-exposure', value: string): void;
930
+
931
+ /** Defines a CSS selector or HTMLElement used to define the camera focus rectangle. */
932
+ setAttribute(name: 'focus-rect', value: string | HTMLElement): void;
933
+ setAttribute(name: 'clickthrough', value: 'true' | 'false'): void;
934
+ /** Automatically fits the model into the camera view on load. */
935
+ setAttribute(name: 'auto-fit', value: 'true' | 'false'): void;
936
+ /** Automatically rotates the model until a user interacts with the scene. */
937
+ setAttribute(name: 'auto-rotate', value: 'true' | 'false'): void;
938
+ /** Play animations automatically on scene load */
939
+ setAttribute(name: "autoplay", value: 'true' | 'false'): void;
940
+ /** @private Used for switching the scene in SceneSwitcher */
941
+ setAttribute(name: 'scene', value: string): void;
942
+
943
+ // setAttribute(name: 'loadstart', value: string): void;
944
+
945
+ /** @private Experimental.*/
946
+ setAttribute(name: 'loading-blur', value: 'true' | 'false'): void;
947
+ /** @private */
948
+ setAttribute(name: 'alias', value: string): void;
949
+ /** @private */
950
+ setAttribute(name: 'hide-loading-overlay', value: 'true' | 'false'): void;
951
+ /** @private */
952
+ setAttribute(name: 'no-telemetry', value: 'true' | 'false'): void;
953
+
954
+ /** Generic typed setter for known Needle Engine attributes */
955
+ // Comment out to see errors inside NE for undocumented attributes
956
+ // setAttribute<T extends keyof NeedleEngineAttributes>(qualifiedName: T, value: NeedleEngineAttributes[T]): void;
957
+
958
+ setAttribute(qualifiedName: ({} & string), value: string): void;
959
+
960
+ // The ones we're using internally:
961
+ /*
962
+ setAttribute(name: "tabindex", value: string): void;
963
+ */
964
+ setAttribute(qualifiedName: string, value: string): void {
965
+ super.setAttribute(qualifiedName, value);
966
+ }
967
+
968
+ // #region getAttribute
969
+
970
+ // MainAttributes
971
+ /** Change which model gets loaded. This will trigger a reload of the scene.
972
+ * @example src="path/to/scene.glb"
973
+ * @example src="[./path/scene1.glb, myOtherScene.gltf]"
974
+ * */
975
+ getAttribute(name: 'src'): string | null;
976
+ /** Optional. String attached to the context for caching/identification. */
977
+ getAttribute(name: 'hash'): string | null;
978
+ /** Set to automatically add {@link OrbitControls} to the loaded scene */
979
+ getAttribute(name: 'camera-controls'): "true" | "false" | "none" | null;
980
+ /** Override the default draco decoder path location. */
981
+ getAttribute(name: 'dracoDecoderPath'): string | null;
982
+ /** Override the default draco library type. */
983
+ getAttribute(name: 'dracoDecoderType'): "wasm" | "js" | null;
984
+ /** Override the default KTX2 transcoder/decoder path */
985
+ getAttribute(name: 'ktx2DecoderPath'): string | null;
986
+ /** Prevent Needle Engine context from being disposed when the element is removed from the DOM */
987
+ getAttribute(name: 'keep-alive'): string | null;
988
+
989
+ /** @private Public key used for licensing and feature gating. */
990
+ getAttribute(name: 'public-key'): string | null;
991
+ /** @private Engine version string — usually set by the build/runtime. */
992
+ getAttribute(name: 'version'): string | null;
993
+
994
+ // LoadingAttributes
995
+ // ...
996
+
997
+ // SkyboxAttributes
998
+ /** URL to .exr, .hdr, .png, .jpg to be used as skybox */
999
+ getAttribute(name: 'background-image'): string | null;
1000
+ /** @private Rotation of the background image in degrees. */
1001
+ getAttribute(name: 'background-rotation'): string | null;
1002
+ /** URL to .exr, .hdr, .png, .jpg to be used for lighting */
1003
+ getAttribute(name: 'environment-image'): string | null;
1004
+ /** Intensity multiplier for environment lighting. */
1005
+ getAttribute(name: 'environment-intensity'): string | null;
1006
+ /** Blurs the background image. Strength between 0 (sharp) and 1 (fully blurred). */
1007
+ getAttribute(name: 'background-blurriness'): string | null;
1008
+ /** Intensity multiplier for the background image. */
1009
+ getAttribute(name: 'background-intensity'): string | null;
1010
+ /**
1011
+ * CSS background color value to be used if no skybox or background image is provided.
1012
+ * @example "background-color='#ff0000'" will set the background color to red.
1013
+ */
1014
+ getAttribute(name: 'background-color'): string | null;
1015
+
1016
+ // RenderingAttributes
1017
+ getAttribute(name: 'transparent'): string | null;
1018
+ getAttribute(name: 'contact-shadows' | 'contactshadows'): string | null;
1019
+ /** Tonemapping mode. */
1020
+ getAttribute(name: 'tone-mapping'): TonemappingAttributeOptions | null;
1021
+ /** @deprecated Use 'tone-mapping' instead. */
1022
+ getAttribute(name: 'tonemapping'): TonemappingAttributeOptions | null;
1023
+ /** Exposure multiplier for tonemapping. */
1024
+ getAttribute(name: 'tone-mapping-exposure'): string | null;
1025
+
1026
+ /** Defines a CSS selector or HTMLElement used to define the camera focus rectangle. */
1027
+ getAttribute(name: 'focus-rect'): string | null;
1028
+ getAttribute(name: 'clickthrough'): string | null;
1029
+ /** Automatically fits the model into the camera view on load. */
1030
+ getAttribute(name: 'auto-fit' | 'autofit'): string | null;
1031
+ /** Automatically rotates the model until a user interacts with the scene. */
1032
+ getAttribute(name: 'auto-rotate'): string | null;
1033
+ /** Play animations automatically on scene load */
1034
+ getAttribute(name: "autoplay"): string | null;
1035
+ /** @private Used for switching the scene in SceneSwitcher */
1036
+ getAttribute(name: 'scene'): string | null;
1037
+ // getAttribute(name: 'loadstart'): string | null;
1038
+
1039
+ /** @private Experimental.*/
1040
+ getAttribute(name: 'loading-blur'): string | null;
1041
+ /** @private */
1042
+ getAttribute(name: 'alias'): string | null;
1043
+ /** @private */
1044
+ getAttribute(name: 'hide-loading-overlay'): string | null;
1045
+ /** @private */
1046
+ getAttribute(name: 'no-telemetry'): string | null;
1047
+
1048
+ // Comment these out to get development errors for undocumented NE attributes
1049
+ /** Typed getter for known NeedleEngine attribute names; returns the typed shape declared in NeedleEngineAttributes or null. */
1050
+ // getAttribute<T extends keyof NeedleEngineAttributes>(qualifiedName: T): NeedleEngineAttributes[T] | null;
1051
+ getAttribute(qualifiedName: ({} & string)): string | null;
1052
+
1053
+ // The ones we're using interally:
1054
+ /*
1055
+ getAttribute(name: "autostart"): string | null;
1056
+ getAttribute(name: "tabindex"): string | null;
1057
+ */
1058
+
1059
+ getAttribute(qualifiedName: string): string | null {
1060
+ return super.getAttribute(qualifiedName);
1061
+ }
1062
+
1063
+ // #region addEventListener
1064
+
1065
+ /**
1066
+ * Emitted when loading begins for the scene. The event is cancelable — calling `preventDefault()`
1067
+ * will stop the default loading UI behavior, so apps can implement custom loading flows.
1068
+ */
1069
+ addEventListener(type: 'loadstart', listener: (ev: CustomEvent<{ context: Context; alias: string | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1070
+ /** Emitted repeatedly while loading resources. Use the event detail to show progress. */
1071
+ addEventListener(type: 'progress', listener: (ev: CustomEvent<{ context: Context; name: string; progress: ProgressEvent<EventTarget>; index: number; count: number; totalProgress01: number }>) => void, options?: boolean | AddEventListenerOptions): void;
1072
+ /** Emitted when scene loading has finished. */
1073
+ addEventListener(type: 'loadfinished', listener: (ev: CustomEvent<{ context: Context; src: string | null; loadedFiles: LoadedModel[] }>) => void, options?: boolean | AddEventListenerOptions): void;
1074
+ /** Emitted when an XR session ends. */
1075
+ addEventListener(type: 'xr-session-ended', listener: (ev: CustomEvent<{ session: XRSession | null; context: Context; sessionMode: XRSessionMode | undefined }>) => void, options?: boolean | AddEventListenerOptions): void;
1076
+ /** Emitted when entering an AR session. */
1077
+ addEventListener(type: 'enter-ar', listener: (ev: CustomEvent<{ session: XRSession; context: Context; htmlContainer: HTMLElement | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1078
+ /** Emitted when exiting an AR session. */
1079
+ addEventListener(type: 'exit-ar', listener: (ev: CustomEvent<{ session: XRSession; context: Context; htmlContainer: HTMLElement | null }>) => void, options?: boolean | AddEventListenerOptions): void;
1080
+ /** Emitted when entering a VR session. */
1081
+ addEventListener(type: 'enter-vr', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1082
+ /** Emitted when exiting a VR session. */
1083
+ addEventListener(type: 'exit-vr', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1084
+ /** Emitted when the engine has rendered its first frame and is ready. */
1085
+ addEventListener(type: 'ready', listener: (ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
1086
+ /** Emitted when an XR session is started. You can do additional setup here. */
1087
+ addEventListener(type: 'xr-session-started', listener: (ev: CustomEvent<{ session: XRSession; context: Context }>) => void, options?: boolean | AddEventListenerOptions): void;
1088
+
1089
+ // Sadly not enough to make types work (see comment below)
1090
+ addEventListener<K extends keyof HTMLElementEventMap>(type: ({} & K), listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
1091
+ // These are from the super type. Not sure how we can remove intellisense for the "regular" events while still making the types work...
1092
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1093
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1094
+ // This would be better but doesn't completely solve it
1095
+ // addEventListener(type: ({} & string), listener: any, options?: boolean | AddEventListenerOptions): void;
1096
+
1097
+ // The ones we're using interally:
1098
+ /*
1099
+ addEventListener(type: "error", listener: (ev: ErrorEvent) => void, options?: boolean | AddEventListenerOptions): void;
1100
+ addEventListener(type: "wheel", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1101
+ addEventListener(type: "keydown", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1102
+ addEventListener(type: "drop", listener: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): void;
1103
+ addEventListener(type: "dragover", listener: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): void;
1104
+ */
1105
+ addEventListener(type: string, listener: any, options?: boolean | AddEventListenerOptions): void
1106
+ {
1107
+ return super.addEventListener(type, listener as EventListenerOrEventListenerObject, options);
1108
+ }
835
1109
  }
836
1110
 
837
1111
  if (typeof window !== "undefined" && !window.customElements.get(htmlTagName))
838
1112
  window.customElements.define(htmlTagName, NeedleEngineWebComponent);
839
1113
 
1114
+ /** Quick testing for the types as declared above */
1115
+ /*
1116
+ const elem = document.querySelector("needle-engine")!;
1117
+ elem.setAttribute("src", "model.glb");
1118
+ elem.addEventListener("loadfinished", (ev) => {
1119
+ const context = ev.detail.context;
1120
+ });
1121
+ elem.setAttribute("dracoDecoderType", "wasm");
1122
+ elem.addEventListener("enter-ar", (ev) => {
1123
+ const session = ev.detail.session;
1124
+ });
1125
+
1126
+ elem.addEventListener("mousedown", (ev) => {
1127
+ console.log("regular mousedown event", ev);
1128
+ });
840
1129
 
1130
+ const onDragOverEvent = (e: DragEvent) => {
841
1131
 
1132
+ };
842
1133
 
1134
+ elem.addEventListener("dragover", onDragOverEvent);
1135
+ */
1136
+ /* END Type testing */
843
1137
 
1138
+ // #region Utility functions
844
1139
 
845
1140
  function getDisplayName(str: string) {
846
1141
  if (str.startsWith("blob:")) {
@@ -960,4 +1255,4 @@ function handleLoadingBlur(needleEngineElement: NeedleEngineWebComponent) {
960
1255
  }
961
1256
  }
962
1257
  }, { once: true });
963
- }
1258
+ }
@@ -4,6 +4,15 @@ import { serializable } from "../engine/engine_serialization_decorator.js";
4
4
  import * as utils from "./../engine/engine_three_utils.js";
5
5
  import { Behaviour, GameObject } from "./Component.js";
6
6
 
7
+ /**
8
+ * Aligns this GameObject between two other GameObjects, scaling it to fit the distance.
9
+ * You can use this to create dynamic beams or connectors between objects.
10
+ *
11
+ * @summary Aligns and scales the object between two target GameObjects
12
+ * @category Utility
13
+ * @group Components
14
+
15
+ **/
7
16
  export class AlignmentConstraint extends Behaviour {
8
17
 
9
18
  @serializable(GameObject)
@@ -14,6 +14,7 @@ const debug = getParam("debuganimator");
14
14
  /**
15
15
  * Represents an event emitted by an animation mixer
16
16
  * @category Animation and Sequencing
17
+ * @group Components
17
18
  */
18
19
  export declare class MixerEvent {
19
20
  /** The type of event that occurred */
@@ -8,6 +8,8 @@ import { Behaviour, GameObject } from "./Component.js";
8
8
  * AudioListener represents a listener that can hear audio sources in the scene.
9
9
  * This component creates and manages a Three.js {@link three#AudioListener}, automatically connecting it
10
10
  * to the main camera or a Camera in the parent hierarchy.
11
+ *
12
+ * @summary Audio listener for 3D audio capture
11
13
  * @category Multimedia
12
14
  * @group Components
13
15
  */
@@ -52,6 +52,7 @@ export enum AudioRolloffMode {
52
52
  * is muted, the volume is set to 0. When unmuted, the volume
53
53
  * returns to its previous value.
54
54
  *
55
+ * @summary 3D audio source with spatial positioning and playback controls
55
56
  * @category Multimedia
56
57
  * @group Components
57
58
  */
@@ -7,6 +7,8 @@ import { Behaviour } from "./Component.js";
7
7
  /**
8
8
  * Component that visualizes the axes of an object in the scene.
9
9
  * Renders colored lines representing the X (red), Y (green) and Z (blue) axes.
10
+ *
11
+ * @summary Visualizes object axes in the scene
10
12
  * @category Helpers
11
13
  * @group Components
12
14
  */
@@ -36,6 +36,7 @@ const debugscreenpointtoray = getParam("debugscreenpointtoray");
36
36
  * Supports both perspective and orthographic cameras with various rendering options.
37
37
  * Internally, this component uses {@link PerspectiveCamera} and {@link OrthographicCamera} three.js objects.
38
38
  *
39
+ * @summary Camera rendering scenes from a specific viewpoint
39
40
  * @category Camera
40
41
  * @group Components
41
42
  */
@@ -14,7 +14,10 @@ import { Rigidbody } from "./RigidBody.js";
14
14
  const debug = getParam("debugcharactercontroller");
15
15
 
16
16
  /**
17
- * @category Camera
17
+ * CharacterController adds a capsule collider and rigidbody to the object, constrains rotation, and provides movement and grounded state.
18
+ * It is designed for typical character movement in 3D environments.
19
+ * @summary Character Movement Controller
20
+ * @category Character
18
21
  * @group Components
19
22
  */
20
23
  export class CharacterController extends Behaviour {
@@ -11,6 +11,8 @@ import { UsageMarker } from "./Interactable.js";
11
11
  const debug = getParam("debugdeletable");
12
12
  /**
13
13
  * A box-shaped area that can be used to delete objects that get into it. Useful for sandbox-style builders or physics simulations.
14
+ *
15
+ * @summary Box area that deletes objects entering it
14
16
  * @category Interactivity
15
17
  * @group Components
16
18
  */
@@ -11,6 +11,10 @@ export enum DeviceType {
11
11
  }
12
12
 
13
13
  /**
14
+ * Enables or disables the GameObject based on the device type (mobile or desktop).
15
+ * You can use this to show or hide objects depending on whether the user is on a mobile device or a desktop.
16
+ *
17
+ * @summary Show or hide GameObject based on device type
14
18
  * @category Utilities
15
19
  * @group Components
16
20
  */
@@ -46,6 +46,7 @@ export enum DragMode {
46
46
  * DragControls allows you to drag objects around in the scene. It can be used to move objects in 2D (screen space) or 3D (world space).
47
47
  * Debug mode can be enabled with the URL parameter `?debugdrag`, which shows visual helpers and logs drag operations.
48
48
  *
49
+ * @summary Enables dragging of objects in 2D or 3D space
49
50
  * @category Interactivity
50
51
  * @group Components
51
52
  */
@@ -139,6 +139,7 @@ const blobKeyName = "blob";
139
139
  * });
140
140
  * ```
141
141
  *
142
+ * @summary Component to handle drag and drop of files into the scene
142
143
  * @category Asset Management
143
144
  * @group Components
144
145
  */
@@ -14,6 +14,7 @@ import { ObjectRaycaster } from "./ui/Raycaster.js";
14
14
  /**
15
15
  * The Duplicatable component is used to duplicate a assigned {@link GameObject} when a pointer event occurs on the object.
16
16
  *
17
+ * @summary Duplicates a GameObject on pointer events
17
18
  * @category Interactivity
18
19
  * @group Components
19
20
  */
@@ -14,6 +14,8 @@ class TriggerEvent {
14
14
  /**
15
15
  * The EventTrigger component is used to trigger events when certain pointer events occur on the GameObject.
16
16
  * It implements the {@link IPointerEventHandler} interface and can be used to expose events to the user in the editor without writing code.
17
+ *
18
+ * @summary Triggers events on pointer interactions
17
19
  * @category Interactivity
18
20
  * @group Components
19
21
  */
@@ -6,6 +6,8 @@ import { Behaviour } from "./Component.js";
6
6
 
7
7
  /**
8
8
  * GridHelper is a component that allows to display a grid in the scene.
9
+ *
10
+ * @example Display a grid in the scene
9
11
  * @category Helpers
10
12
  * @group Components
11
13
  */
@@ -14,6 +14,7 @@ const debug = getParam("debuggroundprojection");
14
14
  *
15
15
  * - Example https://engine.needle.tools/samples/ground-projection
16
16
  *
17
+ * @summary Projects the environment map onto the ground
17
18
  * @category Rendering
18
19
  * @group Components
19
20
  */
@@ -40,6 +40,8 @@ declare class LODSetting {
40
40
 
41
41
  /**
42
42
  * LODGroup allows to create a group of LOD levels for an object.
43
+ *
44
+ * @summary Level of Detail (LOD) Group Component
43
45
  * @category Rendering
44
46
  * @group Components
45
47
  */