@needle-tools/engine 4.14.0 → 4.15.0-next.f391a30

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 (198) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{gltf-progressive-BttGBXw6.umd.cjs → gltf-progressive-CMwJPwEt.umd.cjs} +1 -1
  4. package/dist/{gltf-progressive-Bm_6aEi4.js → gltf-progressive-CTlvpS3A.js} +1 -1
  5. package/dist/{gltf-progressive-T5WKTux5.min.js → gltf-progressive-DYL3SLVb.min.js} +1 -1
  6. package/dist/materialx-4jJLLe9Q.js +4174 -0
  7. package/dist/materialx-Bt9FHwco.min.js +158 -0
  8. package/dist/materialx-NDD0y4JY.umd.cjs +158 -0
  9. package/dist/{needle-engine.bundle-COL2Bar3.umd.cjs → needle-engine.bundle-C1BFRZDF.umd.cjs} +150 -140
  10. package/dist/{needle-engine.bundle-Z_gAD7Kg.js → needle-engine.bundle-DB4kLWO_.js} +6651 -6400
  11. package/dist/{needle-engine.bundle-NolzHLqO.min.js → needle-engine.bundle-DsTdfmeb.min.js} +151 -141
  12. package/dist/needle-engine.d.ts +345 -88
  13. package/dist/needle-engine.js +322 -322
  14. package/dist/needle-engine.min.js +1 -1
  15. package/dist/needle-engine.umd.cjs +1 -1
  16. package/dist/{postprocessing-06AXuvdv.min.js → postprocessing-BN-f4viE.min.js} +1 -1
  17. package/dist/{postprocessing-CPDcA21P.umd.cjs → postprocessing-DYmYOVm4.umd.cjs} +1 -1
  18. package/dist/{postprocessing-CI2x8Cln.js → postprocessing-De9ZpJrk.js} +1 -1
  19. package/dist/{three-examples-BMmNgNCN.umd.cjs → three-examples-BHqRVpO_.umd.cjs} +12 -12
  20. package/dist/{three-examples-CMYCd5nH.js → three-examples-C0ZCCA_K.js} +182 -192
  21. package/dist/{three-examples-CQl1fFZp.min.js → three-examples-DmTY8tGr.min.js} +14 -14
  22. package/lib/engine/api.d.ts +0 -2
  23. package/lib/engine/api.js +0 -2
  24. package/lib/engine/api.js.map +1 -1
  25. package/lib/engine/debug/debug.js +1 -1
  26. package/lib/engine/debug/debug.js.map +1 -1
  27. package/lib/engine/debug/debug_spatial_console.js +1 -1
  28. package/lib/engine/debug/debug_spatial_console.js.map +1 -1
  29. package/lib/engine/engine_accessibility.d.ts +77 -0
  30. package/lib/engine/engine_accessibility.js +162 -0
  31. package/lib/engine/engine_accessibility.js.map +1 -0
  32. package/lib/engine/engine_context.d.ts +2 -0
  33. package/lib/engine/engine_context.js +8 -1
  34. package/lib/engine/engine_context.js.map +1 -1
  35. package/lib/engine/engine_create_objects.js +1 -1
  36. package/lib/engine/engine_create_objects.js.map +1 -1
  37. package/lib/engine/engine_gizmos.js +1 -1
  38. package/lib/engine/engine_gizmos.js.map +1 -1
  39. package/lib/engine/engine_license.js +7 -2
  40. package/lib/engine/engine_license.js.map +1 -1
  41. package/lib/engine/engine_materialpropertyblock.d.ts +90 -4
  42. package/lib/engine/engine_materialpropertyblock.js +97 -7
  43. package/lib/engine/engine_materialpropertyblock.js.map +1 -1
  44. package/lib/engine/engine_math.d.ts +34 -1
  45. package/lib/engine/engine_math.js +34 -1
  46. package/lib/engine/engine_math.js.map +1 -1
  47. package/lib/engine/engine_networking.js +1 -1
  48. package/lib/engine/engine_networking.js.map +1 -1
  49. package/lib/engine/engine_types.d.ts +2 -0
  50. package/lib/engine/engine_types.js +2 -0
  51. package/lib/engine/engine_types.js.map +1 -1
  52. package/lib/engine/engine_utils.js +2 -2
  53. package/lib/engine/engine_utils.js.map +1 -1
  54. package/lib/engine/export/gltf/EXT_mesh_gpu_instancing_exporter.js.map +1 -0
  55. package/lib/engine/export/gltf/index.js +1 -1
  56. package/lib/engine/export/gltf/index.js.map +1 -1
  57. package/lib/engine/webcomponents/icons.js +3 -0
  58. package/lib/engine/webcomponents/icons.js.map +1 -1
  59. package/lib/engine/webcomponents/logo-element.d.ts +7 -3
  60. package/lib/engine/webcomponents/logo-element.js +21 -1
  61. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  62. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  63. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  64. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +10 -7
  65. package/lib/engine/webcomponents/needle menu/needle-menu.js +14 -4
  66. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  67. package/lib/engine/webcomponents/needle-button.d.ts +37 -11
  68. package/lib/engine/webcomponents/needle-button.js +42 -11
  69. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  70. package/lib/engine/webcomponents/needle-engine.ar-overlay.js +10 -1
  71. package/lib/engine/webcomponents/needle-engine.ar-overlay.js.map +1 -1
  72. package/lib/engine/webcomponents/needle-engine.d.ts +13 -2
  73. package/lib/engine/webcomponents/needle-engine.js +23 -3
  74. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  75. package/lib/engine-components/Component.d.ts +1 -2
  76. package/lib/engine-components/Component.js +1 -3
  77. package/lib/engine-components/Component.js.map +1 -1
  78. package/lib/engine-components/DragControls.d.ts +1 -0
  79. package/lib/engine-components/DragControls.js +21 -0
  80. package/lib/engine-components/DragControls.js.map +1 -1
  81. package/lib/engine-components/NeedleMenu.d.ts +2 -0
  82. package/lib/engine-components/NeedleMenu.js +2 -0
  83. package/lib/engine-components/NeedleMenu.js.map +1 -1
  84. package/lib/engine-components/Networking.d.ts +28 -3
  85. package/lib/engine-components/Networking.js +28 -3
  86. package/lib/engine-components/Networking.js.map +1 -1
  87. package/lib/engine-components/ReflectionProbe.d.ts +25 -2
  88. package/lib/engine-components/ReflectionProbe.js +46 -2
  89. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  90. package/lib/engine-components/Skybox.js +4 -2
  91. package/lib/engine-components/Skybox.js.map +1 -1
  92. package/lib/engine-components/export/gltf/GltfExport.js +1 -1
  93. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  94. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +2 -2
  95. package/lib/engine-components/export/usdz/USDZExporter.js +1 -1
  96. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  97. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +15 -0
  98. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +77 -0
  99. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  100. package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +2 -2
  101. package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js.map +1 -1
  102. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  103. package/lib/engine-components/ui/Button.d.ts +1 -0
  104. package/lib/engine-components/ui/Button.js +11 -0
  105. package/lib/engine-components/ui/Button.js.map +1 -1
  106. package/lib/engine-components/ui/Text.d.ts +1 -0
  107. package/lib/engine-components/ui/Text.js +11 -0
  108. package/lib/engine-components/ui/Text.js.map +1 -1
  109. package/package.json +18 -14
  110. package/plugins/common/buildinfo.js +46 -10
  111. package/plugins/common/files.js +2 -1
  112. package/plugins/common/license.js +144 -69
  113. package/plugins/common/logger.js +172 -11
  114. package/plugins/common/needle-engine-skill.md +175 -0
  115. package/plugins/common/worker.js +5 -4
  116. package/plugins/types/userconfig.d.ts +40 -2
  117. package/plugins/vite/ai.js +71 -0
  118. package/plugins/vite/alias.js +6 -5
  119. package/plugins/vite/asap.js +6 -5
  120. package/plugins/vite/build-pipeline.js +224 -41
  121. package/plugins/vite/buildinfo.js +66 -6
  122. package/plugins/vite/copyfiles.js +41 -12
  123. package/plugins/vite/custom-element-data.js +26 -16
  124. package/plugins/vite/defines.js +8 -5
  125. package/plugins/vite/dependencies.js +16 -10
  126. package/plugins/vite/dependency-watcher.js +35 -7
  127. package/plugins/vite/drop-client.js +7 -5
  128. package/plugins/vite/drop.js +16 -14
  129. package/plugins/vite/editor-connection.js +18 -16
  130. package/plugins/vite/imports-logger.js +12 -2
  131. package/plugins/vite/index.js +8 -3
  132. package/plugins/vite/local-files-analysis.js +789 -0
  133. package/plugins/vite/local-files-core.js +992 -0
  134. package/plugins/vite/local-files-internals.js +28 -0
  135. package/plugins/vite/local-files-types.d.ts +111 -0
  136. package/plugins/vite/local-files-utils.js +359 -0
  137. package/plugins/vite/local-files.js +2 -441
  138. package/plugins/vite/logger.client.js +45 -35
  139. package/plugins/vite/logger.js +6 -3
  140. package/plugins/vite/logging.js +129 -0
  141. package/plugins/vite/meta.js +18 -4
  142. package/plugins/vite/needle-app.js +4 -3
  143. package/plugins/vite/peer.js +2 -1
  144. package/plugins/vite/pwa.js +33 -17
  145. package/plugins/vite/reload.js +24 -2
  146. package/src/engine/api.ts +0 -3
  147. package/src/engine/debug/debug.ts +1 -1
  148. package/src/engine/debug/debug_spatial_console.ts +5 -1
  149. package/src/engine/engine_accessibility.ts +198 -0
  150. package/src/engine/engine_context.ts +10 -1
  151. package/src/engine/engine_create_objects.ts +1 -1
  152. package/src/engine/engine_gizmos.ts +9 -5
  153. package/src/engine/engine_license.ts +7 -2
  154. package/src/engine/engine_materialpropertyblock.ts +102 -11
  155. package/src/engine/engine_math.ts +34 -1
  156. package/src/engine/engine_networking.ts +1 -1
  157. package/src/engine/engine_types.ts +5 -0
  158. package/src/engine/engine_utils.ts +2 -2
  159. package/src/engine/export/gltf/index.ts +1 -1
  160. package/src/engine/webcomponents/icons.ts +3 -0
  161. package/src/engine/webcomponents/logo-element.ts +24 -4
  162. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +6 -2
  163. package/src/engine/webcomponents/needle menu/needle-menu.ts +23 -11
  164. package/src/engine/webcomponents/needle-button.ts +44 -13
  165. package/src/engine/webcomponents/needle-engine.ar-overlay.ts +13 -2
  166. package/src/engine/webcomponents/needle-engine.ts +31 -8
  167. package/src/engine-components/Component.ts +2 -5
  168. package/src/engine-components/DragControls.ts +29 -4
  169. package/src/engine-components/NeedleMenu.ts +5 -3
  170. package/src/engine-components/Networking.ts +29 -4
  171. package/src/engine-components/ReflectionProbe.ts +52 -9
  172. package/src/engine-components/Skybox.ts +4 -2
  173. package/src/engine-components/export/gltf/GltfExport.ts +1 -1
  174. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
  175. package/src/engine-components/export/usdz/USDZExporter.ts +1 -1
  176. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +108 -32
  177. package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +2 -2
  178. package/src/engine-components/ui/Button.ts +12 -0
  179. package/src/engine-components/ui/Text.ts +13 -0
  180. package/dist/materialx-CJyQZtjt.min.js +0 -90
  181. package/dist/materialx-DMs1E08Z.js +0 -4636
  182. package/dist/materialx-DaKKOoVk.umd.cjs +0 -90
  183. package/lib/engine/engine_test_utils.d.ts +0 -39
  184. package/lib/engine/engine_test_utils.js +0 -84
  185. package/lib/engine/engine_test_utils.js.map +0 -1
  186. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js.map +0 -1
  187. package/src/engine/engine_test_utils.ts +0 -109
  188. package/src/include/draco/draco_decoder.js +0 -34
  189. package/src/include/draco/draco_decoder.wasm +0 -0
  190. package/src/include/draco/draco_wasm_wrapper.js +0 -117
  191. package/src/include/ktx2/basis_transcoder.js +0 -19
  192. package/src/include/ktx2/basis_transcoder.wasm +0 -0
  193. package/src/include/needle/arial-msdf.json +0 -1472
  194. package/src/include/needle/arial.png +0 -0
  195. package/src/include/needle/poweredbyneedle.webp +0 -0
  196. /package/lib/{include/three → engine/export/gltf}/EXT_mesh_gpu_instancing_exporter.d.ts +0 -0
  197. /package/lib/{include/three → engine/export/gltf}/EXT_mesh_gpu_instancing_exporter.js +0 -0
  198. /package/src/{include/three → engine/export/gltf}/EXT_mesh_gpu_instancing_exporter.js +0 -0
@@ -111,7 +111,7 @@ import { XRControllerModelFactory } from 'three/examples/jsm/webxr/XRControllerM
111
111
  import { XRHandMeshModel } from 'three/examples/jsm/webxr/XRHandMeshModel.js';
112
112
  import { XRHandSpace } from 'three';
113
113
 
114
- declare const $componentName: unique symbol;
114
+ export declare const $componentName: unique symbol;
115
115
 
116
116
  export declare const $physicsKey: unique symbol;
117
117
 
@@ -120,6 +120,81 @@ export declare class __Ignore {
120
120
 
121
121
  export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
122
122
 
123
+ /** Data describing the accessible semantics for a 3D object or component. */
124
+ declare type AccessibilityData = {
125
+ /** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
126
+ role: string;
127
+ /** Human-readable label announced by screen readers. */
128
+ label: string;
129
+ /** When `true`, the element is hidden from the accessibility tree. */
130
+ hidden?: boolean;
131
+ /** When `true`, indicates the element's content is being updated. */
132
+ busy?: boolean;
133
+ };
134
+
135
+ /**
136
+ * Manages an accessible, screen-reader-friendly overlay for a Needle Engine {@link Context}.
137
+ *
138
+ * The manager maintains a visually-hidden DOM tree that mirrors relevant 3D scene objects
139
+ * with appropriate ARIA roles and labels. It also provides a live region so that hover
140
+ * events in the 3D scene can be announced to assistive technology without stealing focus.
141
+ *
142
+ * ## Automatic integration
143
+ * Several built-in components register accessible elements automatically:
144
+ * - {@link DragControls} — announces draggable objects and drag state
145
+ * - {@link Button} — exposes UI buttons to the accessibility tree
146
+ * - {@link Text} — exposes UI text content to screen readers
147
+ * - {@link ChangeTransformOnClick} — announces clickable transform actions
148
+ * - {@link ChangeMaterialOnClick} — announces clickable material changes
149
+ * - {@link EmphasizeOnClick} — announces clickable emphasis effects
150
+ * - {@link PlayAudioOnClick} — announces clickable audio playback
151
+ * - {@link PlayAnimationOnClick} — announces clickable animation triggers
152
+ *
153
+ * ## What this unlocks
154
+ * - Hovering over buttons and interactive objects with the cursor announces them to screen readers via an ARIA live region — no focus steal required
155
+ * - Screen readers can discover and navigate interactive 3D objects in the scene
156
+ * - Drag operations update the accessibility state (busy, label changes) in real time
157
+ * - Custom components can participate by calling {@link updateElement}, {@link focus}, and {@link hover}
158
+ *
159
+ * Access the manager via `this.context.accessibility` from any component.
160
+ */
161
+ declare class AccessibilityManager {
162
+ private readonly context;
163
+ private static readonly _managers;
164
+ /** Returns the {@link AccessibilityManager} associated with the given context or component. */
165
+ static get(obj: Context | IComponent): AccessibilityManager | undefined;
166
+ constructor(context: Context);
167
+ private _enabled;
168
+ /** Enables or disables the accessibility overlay. When disabled, the overlay DOM is removed. */
169
+ set enabled(value: boolean);
170
+ /** Removes all tracked accessibility elements, keeping only the live region. */
171
+ clear(): void;
172
+ /** Removes the overlay from the DOM and unregisters this manager from the context. */
173
+ dispose(): void;
174
+ private readonly root;
175
+ private readonly liveRegion;
176
+ private readonly treeElements;
177
+ /**
178
+ * Creates or updates the accessible DOM element for a 3D object or component.
179
+ * @param obj - The scene object or component to represent.
180
+ * @param data - Partial accessibility data (role, label, hidden, busy) to apply.
181
+ */
182
+ updateElement<T extends Object3D | IComponent>(obj: T, data: Partial<AccessibilityData>): void;
183
+ /** Moves keyboard focus to the accessible element representing the given object. */
184
+ focus<T extends Object3D | IComponent>(obj: T): void;
185
+ /** Removes keyboard focus from the accessible element representing the given object. */
186
+ unfocus<T extends Object3D | IComponent>(obj: T): void;
187
+ /**
188
+ * Announces a hover event to screen readers via the ARIA live region.
189
+ * @param obj - The hovered object (used to look up its label if `text` is not provided).
190
+ * @param text - Optional text to announce. Falls back to the element's `aria-label`.
191
+ */
192
+ hover<T extends Object3D | IComponent>(obj: T, text?: string): void;
193
+ /** Removes the accessible DOM element for the given object and stops tracking it. */
194
+ removeElement(obj: Object3D | IComponent): void;
195
+ private set liveRegionMode(value);
196
+ }
197
+
123
198
  export declare class ActionBuilder {
124
199
  static sequence(...params: IBehaviorElement[]): GroupActionModel;
125
200
  static parallel(...params: IBehaviorElement[]): GroupActionModel;
@@ -2267,6 +2342,7 @@ export declare class Button extends Component implements IPointerEventHandler {
2267
2342
  awake(): void;
2268
2343
  start(): void;
2269
2344
  onEnable(): void;
2345
+ onDisable(): void;
2270
2346
  onDestroy(): void;
2271
2347
  private _requestedAnimatorTrigger?;
2272
2348
  private setAnimatorTriggerAtEndOfFrame;
@@ -2843,6 +2919,9 @@ export declare class ChangeMaterialOnClick extends Component implements IPointer
2843
2919
  */
2844
2920
  fadeDuration: number;
2845
2921
  start(): void;
2922
+ onEnable(): void;
2923
+ onDisable(): void;
2924
+ onDestroy(): void;
2846
2925
  onPointerEnter(_args: PointerEventData): void;
2847
2926
  onPointerExit(_: PointerEventData): void;
2848
2927
  onPointerClick(args: PointerEventData): void;
@@ -2887,6 +2966,9 @@ export declare class ChangeTransformOnClick extends Component implements IPointe
2887
2966
  private targetPos;
2888
2967
  private targetRot;
2889
2968
  private targetScale;
2969
+ onEnable(): void;
2970
+ onDisable(): void;
2971
+ onDestroy(): void;
2890
2972
  onPointerEnter(): void;
2891
2973
  onPointerExit(): void;
2892
2974
  onPointerClick(args: PointerEventData): void;
@@ -3421,21 +3503,6 @@ export declare const colorSerializer: ColorSerializer;
3421
3503
  */
3422
3504
  export declare function compareAssociation<T extends Material>(obj1: T, obj2: T): boolean;
3423
3505
 
3424
- declare type ComparisonSceneOptions = {
3425
- /**
3426
- * An array of model urls to load
3427
- */
3428
- files: string[];
3429
- /**
3430
- * Optional dom element to attach the orbit controls to. By default this should be the WebGLRenderer.domElement
3431
- */
3432
- domElement?: HTMLElement;
3433
- /**
3434
- * Can be a .hdr or .exr file url
3435
- */
3436
- environment?: string;
3437
- };
3438
-
3439
3506
  /**
3440
3507
  * Needle Engine component's are the main building blocks of the Needle Engine.
3441
3508
  * Derive from {@link Behaviour} to implement your own using the provided lifecycle methods.
@@ -4292,6 +4359,7 @@ export declare class Context implements IContext {
4292
4359
  readonly lodsManager: LODsManager;
4293
4360
  /** Access the needle menu to add or remove buttons to the menu element */
4294
4361
  readonly menu: NeedleMenu_2;
4362
+ readonly accessibility: AccessibilityManager;
4295
4363
  /**
4296
4364
  * Checks if the context is fully created and ready
4297
4365
  * @returns true if the context is fully created and ready
@@ -5282,6 +5350,7 @@ export declare class DragControls extends Component implements IPointerEventHand
5282
5350
  /* Excluded from this release type: start */
5283
5351
  /* Excluded from this release type: onEnable */
5284
5352
  /* Excluded from this release type: onDisable */
5353
+ onDestroy(): void;
5285
5354
  /**
5286
5355
  * Checks if editing is allowed for the current networking connection.
5287
5356
  * @param _obj Optional object to check edit permissions for
@@ -5673,6 +5742,9 @@ export declare class EmphasizeOnClick extends Component implements UsdzBehaviour
5673
5742
  duration: number;
5674
5743
  /** The type of motion to use for the emphasis effect (e.g. `"bounce"`, `"jiggle"`). */
5675
5744
  motionType: EmphasizeActionMotionType;
5745
+ onEnable(): void;
5746
+ onDisable(): void;
5747
+ onDestroy(): void;
5676
5748
  beforeCreateDocument(): void;
5677
5749
  createBehaviours(ext: any, model: any, _context: any): void;
5678
5750
  afterCreateDocument(_ext: any, _context: any): void;
@@ -7776,6 +7848,7 @@ export declare type ICollisionContext = {
7776
7848
 
7777
7849
  export declare interface IComponent extends IHasGuid {
7778
7850
  get isComponent(): boolean;
7851
+ get [$componentName](): string | undefined;
7779
7852
  /** the object this component is attached to */
7780
7853
  gameObject: IGameObject;
7781
7854
  enabled: boolean;
@@ -10093,13 +10166,22 @@ export declare class MaskableGraphic extends Graphic {
10093
10166
  * This is useful for rendering multiple objects with the same base material but different properties
10094
10167
  * (e.g., different colors, textures, or shader parameters).
10095
10168
  *
10169
+ * ## How Property Blocks Work
10170
+ *
10171
+ * **Important**: Overrides are registered on the **Object3D**, not on the material.
10172
+ * This means:
10173
+ * - If you change the object's material, the overrides will still be applied to the new material
10174
+ * - Multiple objects can share the same material but have different property overrides
10175
+ * - If you don't want overrides applied after changing a material, you must remove them using {@link removeOveride}, {@link clearAllOverrides}, or {@link dispose}
10176
+ *
10096
10177
  * The property block system works by:
10097
10178
  * - Temporarily applying overrides in onBeforeRender
10098
10179
  * - Restoring original values in onAfterRender
10099
10180
  * - Managing shader defines and program cache keys for correct shader compilation
10100
10181
  * - Supporting texture coordinate transforms per object
10101
10182
  *
10102
- * Common use cases:
10183
+ * ## Common Use Cases
10184
+ *
10103
10185
  * - **Lightmaps**: Apply unique lightmap textures to individual objects sharing the same material
10104
10186
  * - **Reflection Probes**: Apply different environment maps per object for localized reflections
10105
10187
  * - **See-through effects**: Temporarily override transparency/transmission properties for X-ray effects
@@ -10137,6 +10219,26 @@ export declare class MaskableGraphic extends Graphic {
10137
10219
  * block.setDefine("USE_CUSTOM_FEATURE", 1);
10138
10220
  * ```
10139
10221
  *
10222
+ * @example Material swapping behavior
10223
+ * ```typescript
10224
+ * const mesh = new Mesh(geometry, materialA);
10225
+ * const block = MaterialPropertyBlock.get(mesh);
10226
+ * block.setOverride("color", new Color(1, 0, 0));
10227
+ *
10228
+ * // The color override is red for materialA
10229
+ *
10230
+ * // Swap the material - overrides persist and apply to the new material!
10231
+ * mesh.material = materialB;
10232
+ * // The color override is now red for materialB too
10233
+ *
10234
+ * // If you don't want overrides on the new material, remove them:
10235
+ * block.clearAllOverrides(); // Remove all overrides
10236
+ * // or
10237
+ * block.removeOveride("color"); // Remove specific override
10238
+ * // or
10239
+ * block.dispose(); // Remove the entire property block
10240
+ * ```
10241
+ *
10140
10242
  * @example Lightmap usage
10141
10243
  * ```typescript
10142
10244
  * const block = MaterialPropertyBlock.get(mesh);
@@ -10244,12 +10346,69 @@ export declare class MaterialPropertyBlock<T extends Material = Material> {
10244
10346
  getOverride<K extends NonFunctionPropertyNames<T>>(name: K): PropertyBlockOverride<T[K] & MaterialPropertyType> | undefined;
10245
10347
  getOverride<V extends MaterialPropertyType = MaterialPropertyType>(name: string): PropertyBlockOverride<V> | undefined;
10246
10348
  /**
10247
- * Removes a specific property override
10248
- * @param name The property name to clear
10349
+ * Removes a specific property override.
10350
+ * After removal, the material will use its original property value for this property.
10351
+ *
10352
+ * @param name The property name to remove the override for
10353
+ *
10354
+ * @example
10355
+ * ```typescript
10356
+ * const block = MaterialPropertyBlock.get(mesh);
10357
+ *
10358
+ * // Set some overrides
10359
+ * block.setOverride("color", new Color(1, 0, 0));
10360
+ * block.setOverride("roughness", 0.5);
10361
+ * block.setOverride("lightMap", lightmapTexture);
10362
+ *
10363
+ * // Remove a specific override - the material will now use its original color
10364
+ * block.removeOveride("color");
10365
+ *
10366
+ * // Other overrides (roughness, lightMap) remain active
10367
+ * ```
10249
10368
  */
10250
10369
  removeOveride<K extends NonFunctionPropertyNames<T>>(name: K | ({} & string)): void;
10251
10370
  /**
10252
- * Removes all property overrides from this block
10371
+ * Removes all property overrides from this block.
10372
+ * After calling this, the material will use its original values for all properties.
10373
+ *
10374
+ * **Note**: This does NOT remove shader defines. Use {@link clearDefine} or {@link dispose} for that.
10375
+ *
10376
+ * @example Remove all overrides but keep the property block
10377
+ * ```typescript
10378
+ * const block = MaterialPropertyBlock.get(mesh);
10379
+ *
10380
+ * // Set multiple overrides
10381
+ * block.setOverride("color", new Color(1, 0, 0));
10382
+ * block.setOverride("roughness", 0.5);
10383
+ * block.setOverride("lightMap", lightmapTexture);
10384
+ *
10385
+ * // Later, remove all overrides at once
10386
+ * block.clearAllOverrides();
10387
+ *
10388
+ * // The material now uses its original values
10389
+ * // The property block still exists and can be reused with new overrides
10390
+ * ```
10391
+ *
10392
+ * @example Temporarily disable all overrides
10393
+ * ```typescript
10394
+ * const block = MaterialPropertyBlock.get(mesh);
10395
+ *
10396
+ * // Save current overrides if you want to restore them later
10397
+ * const savedOverrides = [...block.overrides];
10398
+ *
10399
+ * // Clear all overrides temporarily
10400
+ * block.clearAllOverrides();
10401
+ *
10402
+ * // Do some rendering without overrides...
10403
+ *
10404
+ * // Restore overrides
10405
+ * savedOverrides.forEach(override => {
10406
+ * block.setOverride(override.name, override.value, override.textureTransform);
10407
+ * });
10408
+ * ```
10409
+ *
10410
+ * @see {@link removeOveride} - To remove a single override
10411
+ * @see {@link dispose} - To completely remove the property block and clean up resources
10253
10412
  */
10254
10413
  clearAllOverrides(): void;
10255
10414
  /**
@@ -10650,32 +10809,58 @@ export declare namespace NEEDLE_ENGINE_MODULES {
10650
10809
  export { NEEDLE_progressive }
10651
10810
 
10652
10811
  /**
10653
- * A <needle-button> can be used to simply add VR, AR or Quicklook buttons to your website without having to write any code.
10654
- * @example
10812
+ * [&lt;needle-button&gt;](https://engine.needle.tools/docs/api/NeedleButtonElement) is a web component for easily adding AR, VR, Quicklook, or QR code buttons to your website without writing JavaScript code.
10813
+ *
10814
+ * The button automatically handles session management and displays appropriate UI based on device capabilities.
10815
+ * It comes with default styling (glassmorphism design) but can be fully customized with CSS.
10816
+ *
10817
+ * **Supported button types:**
10818
+ * - `ar` - WebXR AR session button
10819
+ * - `vr` - WebXR VR session button
10820
+ * - `quicklook` - Apple AR Quick Look button (iOS only)
10821
+ * - `qrcode` - QR code sharing button
10822
+ *
10823
+ * @example Basic AR/VR buttons
10655
10824
  * ```html
10825
+ * <needle-engine src="scene.glb"></needle-engine>
10656
10826
  * <needle-button ar></needle-button>
10657
10827
  * <needle-button vr></needle-button>
10658
10828
  * <needle-button quicklook></needle-button>
10659
10829
  * ```
10660
10830
  *
10661
- * @example custom label
10831
+ * @example Custom button labels
10662
10832
  * ```html
10663
- * <needle-button ar>Start AR</needle-button>
10664
- * <needle-button vr>Start VR</needle-button>
10833
+ * <needle-button ar>Start AR Experience</needle-button>
10834
+ * <needle-button vr>Enter VR Mode</needle-button>
10665
10835
  * <needle-button quicklook>View in AR</needle-button>
10666
10836
  * ```
10667
10837
  *
10668
- * @example custom styling
10838
+ * @example Custom styling
10669
10839
  * ```html
10670
- * <!-- You can either style the element directly or use a CSS stylesheet -->
10671
10840
  * <style>
10672
- * needle-button {
10673
- * background-color: red;
10674
- * color: white;
10675
- * }
10841
+ * needle-button {
10842
+ * background-color: #ff6b6b;
10843
+ * color: white;
10844
+ * border-radius: 8px;
10845
+ * padding: 1rem 2rem;
10846
+ * }
10847
+ * needle-button:hover {
10848
+ * background-color: #ff5252;
10849
+ * }
10676
10850
  * </style>
10677
10851
  * <needle-button ar>Start AR</needle-button>
10678
10852
  * ```
10853
+ *
10854
+ * @example Unstyled button (for complete custom styling)
10855
+ * ```html
10856
+ * <needle-button ar unstyled>
10857
+ * <span class="my-icon">🥽</span>
10858
+ * Launch AR
10859
+ * </needle-button>
10860
+ * ```
10861
+ *
10862
+ * @see {@link NeedleEngineWebComponent} for the main &lt;needle-engine&gt; element
10863
+ * @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
10679
10864
  */
10680
10865
  export declare class NeedleButtonElement extends HTMLElement {
10681
10866
  #private;
@@ -10752,10 +10937,18 @@ export declare namespace NeedleEngineModelLoader {
10752
10937
  * The context is accessible from the `<needle-engine>` element: `document.querySelector("needle-engine").context`.
10753
10938
  * See {@link https://engine.needle.tools/docs/reference/needle-engine-attributes}
10754
10939
  *
10755
- * @example
10940
+ * @example Basic usage
10941
+ * ```html
10756
10942
  * <needle-engine src="https://example.com/scene.glb"></needle-engine>
10757
- * @example
10943
+ * ```
10944
+ *
10945
+ * @example With camera controls disabled
10946
+ * ```html
10758
10947
  * <needle-engine src="https://example.com/scene.glb" camera-controls="false"></needle-engine>
10948
+ * ```
10949
+ *
10950
+ * @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via &lt;needle-button&gt;
10951
+ * @see {@link NeedleMenu} for the built-in menu configuration component
10759
10952
  */
10760
10953
  export declare class NeedleEngineWebComponent extends HTMLElement implements INeedleEngineComponent {
10761
10954
  static get observedAttributes(): string[];
@@ -10794,7 +10987,10 @@ export declare class NeedleEngineWebComponent extends HTMLElement implements INe
10794
10987
  private _previousSrc;
10795
10988
  /** @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 */
10796
10989
  private _didFullyLoad;
10990
+ private _didInitialize;
10797
10991
  constructor();
10992
+ private ensureInitialized;
10993
+ private initializeDom;
10798
10994
  /* Excluded from this release type: connectedCallback */
10799
10995
  /* Excluded from this release type: disconnectedCallback */
10800
10996
  connectedMoveCallback(): void;
@@ -11082,6 +11278,8 @@ declare class NeedleGamepadButton {
11082
11278
  * @category User Interface
11083
11279
  * @group Components
11084
11280
  * @see {@link Context.menu} for programmatic menu control
11281
+ * @see {@link NeedleButtonElement} for standalone &lt;needle-button&gt; web component
11282
+ * @see {@link NeedleEngineWebComponent} for the main &lt;needle-engine&gt; element
11085
11283
  * @see {@link Voip} adds a microphone button to the menu
11086
11284
  * @see {@link ScreenCapture} adds a screen sharing button
11087
11285
  **/
@@ -12303,10 +12501,34 @@ export declare class NetworkedStreams extends EventDispatcher<any> {
12303
12501
  }
12304
12502
 
12305
12503
  /**
12306
- * Provides configuration to the built-in networking system.
12307
- * This component supplies websocket URLs for establishing connections.
12308
- * It implements the {@link INetworkingWebsocketUrlProvider} interface.
12504
+ * Provides websocket URL configuration for the built-in networking system.
12505
+ * Add this component to override the default networking backend URL used by {@link NetworkConnection} (`this.context.connection`).
12506
+ *
12507
+ * The component registers itself as a URL provider on `awake()`. When the networking system connects,
12508
+ * it queries this provider for the websocket URL to use instead of the default Needle networking backend.
12509
+ *
12510
+ * **URL resolution order:**
12511
+ * 1. If `urlParameterName` is set and the corresponding URL parameter exists in the browser URL, that value is used
12512
+ * 2. If running on a local network and `localhost` is set, the `localhost` URL is used
12513
+ * 3. Otherwise, the `url` field is used
12514
+ *
12515
+ * Without this component, the default backend URL `wss://networking-2.needle.tools/socket` is used.
12309
12516
  *
12517
+ * **Note:** This component only configures the websocket URL. To actually join a networked room,
12518
+ * use a `SyncedRoom` component or call `this.context.connection.joinRoom("room-name")` directly.
12519
+ *
12520
+ * @example Overriding the URL via browser parameter
12521
+ * ```ts
12522
+ * // With urlParameterName="server", visiting:
12523
+ * // https://myapp.com/?server=wss://my-server.com/socket
12524
+ * // will connect to that server instead
12525
+ * ```
12526
+ *
12527
+ * @see {@link NetworkConnection} for the main networking API (`this.context.connection`)
12528
+ * @see {@link SyncedRoom} for automatic room joining
12529
+ * @see {@link OwnershipModel} for networked object ownership
12530
+ * @see {@link RoomEvents} for room lifecycle events
12531
+ * @link https://engine.needle.tools/docs/how-to-guides/networking/
12310
12532
  * @summary Networking configuration
12311
12533
  * @category Networking
12312
12534
  * @group Components
@@ -12315,6 +12537,7 @@ export declare class Networking extends Component implements INetworkingWebsocke
12315
12537
  /**
12316
12538
  * The websocket URL to connect to for networking functionality.
12317
12539
  * Can be a complete URL or a relative path that will be resolved against the current origin.
12540
+ * @default null
12318
12541
  */
12319
12542
  url: string | null;
12320
12543
  /**
@@ -12688,7 +12911,40 @@ export declare function onClear(cb: LifecycleMethod, opts?: LifecycleMethodOptio
12688
12911
  export declare function onDestroy(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
12689
12912
 
12690
12913
  /**
12691
- * OneEuroFilter is a simple low-pass filter for noisy signals. It uses a one-euro filter to smooth the signal.
12914
+ * [OneEuroFilter](https://engine.needle.tools/docs/api/OneEuroFilter) is a low-pass filter designed to reduce jitter in noisy signals while maintaining low latency.
12915
+ * It's particularly useful for smoothing tracking data from XR controllers, hand tracking, or other input devices where the signal contains noise but responsiveness is important.
12916
+ *
12917
+ * The filter automatically adapts its smoothing strength based on the signal's velocity:
12918
+ * - When the signal moves slowly, it applies strong smoothing to reduce jitter
12919
+ * - When the signal moves quickly, it reduces smoothing to maintain responsiveness
12920
+ *
12921
+ * Based on the research paper: [1€ Filter: A Simple Speed-based Low-pass Filter for Noisy Input](http://cristal.univ-lille.fr/~casiez/1euro/)
12922
+ *
12923
+ * @example Basic usage with timestamp
12924
+ * ```ts
12925
+ * const filter = new OneEuroFilter(120, 1.0, 0.0);
12926
+ *
12927
+ * // In your update loop:
12928
+ * const smoothedValue = filter.filter(noisyValue, this.context.time.time);
12929
+ * ```
12930
+ *
12931
+ * @example Without timestamps (using frequency estimate)
12932
+ * ```ts
12933
+ * // Assuming 60 FPS update rate
12934
+ * const filter = new OneEuroFilter(60, 1.0, 0.5);
12935
+ *
12936
+ * // Call without timestamp - uses the frequency estimate
12937
+ * const smoothedValue = filter.filter(noisyValue);
12938
+ * ```
12939
+ *
12940
+ * @example Smoothing 3D positions
12941
+ * ```ts
12942
+ * const posFilter = new OneEuroFilterXYZ(90, 0.5, 0.0);
12943
+ *
12944
+ * posFilter.filter(trackedPosition, smoothedPosition, this.context.time.time);
12945
+ * ```
12946
+ *
12947
+ * @see {@link OneEuroFilterXYZ} for filtering 3D vectors
12692
12948
  */
12693
12949
  export declare class OneEuroFilter {
12694
12950
  /**
@@ -14199,6 +14455,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
14199
14455
  trigger: "tap" | "start";
14200
14456
  animation?: Animation_2;
14201
14457
  private get target();
14458
+ onEnable(): void;
14459
+ onDisable(): void;
14460
+ onDestroy(): void;
14202
14461
  onPointerEnter(): void;
14203
14462
  onPointerExit(): void;
14204
14463
  onPointerClick(args: PointerEventData): void;
@@ -14245,6 +14504,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
14245
14504
  toggleOnClick: boolean;
14246
14505
  trigger: "tap" | "start";
14247
14506
  ensureAudioSource(): void;
14507
+ onEnable(): void;
14508
+ onDisable(): void;
14509
+ onDestroy(): void;
14248
14510
  onPointerEnter(): void;
14249
14511
  onPointerExit(): void;
14250
14512
  onPointerClick(args: PointerEventData): void;
@@ -15356,11 +15618,19 @@ export declare class OrbitControls extends Component implements ICameraControlle
15356
15618
  */
15357
15619
  export declare class ReflectionProbe extends Component {
15358
15620
  private static _probes;
15621
+ /**
15622
+ * Checks if the given material is currently using a reflection probe. This is determined by checking for an override on the material's "envMap" property, which is set by the Renderer component when applying a reflection probe.
15623
+ */
15359
15624
  static isUsingReflectionProbe(material: Material): boolean;
15360
15625
  /**
15361
15626
  * Event invoked when a reflection probe is enabled. Used internally by Renderer components to update probes when they become active. Not recommended to call this directly in most cases.
15627
+ * @see {@link onDisabled} for the corresponding disable event.
15362
15628
  */
15363
15629
  static readonly onEnabled: EventList<ReflectionProbe>;
15630
+ /**
15631
+ * Event invoked when a reflection probe is disabled. Used internally by Renderer components to update probes when they become inactive. Not recommended to call this directly in most cases.
15632
+ * @see {@link onEnabled} for the corresponding enable event.
15633
+ */
15364
15634
  static readonly onDisabled: EventList<ReflectionProbe>;
15365
15635
  /**
15366
15636
  * Gets the active reflection probe for the given object and context. If `isAnchor` is true, it will only return a probe if the object is the anchor of that probe. Otherwise, it checks if the object is within the probe's influence area.
@@ -15375,8 +15645,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
15375
15645
  */
15376
15646
  static get(object: Object3D | null | undefined, context: Context, isAnchor: boolean, anchor?: Object3D): ReflectionProbe | null;
15377
15647
  private _texture;
15378
- set texture(tex: Texture);
15379
- get texture(): Texture;
15648
+ private _textureUrlInFlight?;
15649
+ /**
15650
+ * The cubemap or HDR texture used for reflections. Can be assigned directly or via a URL string. When assigning via URL, the texture will be loaded asynchronously and applied once ready.
15651
+ */
15652
+ set texture(tex: Texture | null);
15653
+ get texture(): Texture | null;
15380
15654
  intensity: number;
15381
15655
  /**
15382
15656
  * Defines the center and size of the reflection probe's influence area.
@@ -15393,12 +15667,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
15393
15667
  private _boxHelper?;
15394
15668
  private isInBox;
15395
15669
  constructor();
15396
- awake(): void;
15397
- onEnable(): void;
15398
- onDisable(): void;
15399
- start(): void;
15400
- onDestroy(): void;
15670
+ /* Excluded from this release type: awake */
15671
+ /* Excluded from this release type: onEnable */
15672
+ /* Excluded from this release type: onDisable */
15673
+ /* Excluded from this release type: start */
15674
+ /* Excluded from this release type: onDestroy */
15675
+ /**
15676
+ * Applies this reflection probe to the given object by setting material property overrides for "envMap", "envMapRotation", and "envMapIntensity". This is typically called by the Renderer component when determining which reflection probe to use for a given object.
15677
+ */
15401
15678
  apply(object: Object3D): void;
15679
+ /**
15680
+ * Removes the reflection probe overrides from the given object. This is typically called by the Renderer component when an object is no longer influenced by this probe or when the probe is disabled.
15681
+ */
15402
15682
  unapply(obj: Object3D): void;
15403
15683
  }
15404
15684
 
@@ -19406,30 +19686,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
19406
19686
 
19407
19687
  /* Excluded from this release type: TestRunner */
19408
19688
 
19409
- /**
19410
- * A collection of utility methods for quickly spinning up test environments
19411
- */
19412
- export declare class TestSceneUtils {
19413
- /**
19414
- * Use this method to quickly setup a scene to compare multiple models.
19415
- * @example
19416
- * ```ts
19417
- * const files = [
19418
- * "https://threejs.org/examples/models/gltf/RobotExpressive/RobotExpressive.glb",
19419
- * "https://threejs.org/examples/models/gltf/Lantern/glTF-Binary/Lantern.glb",
19420
- * ];
19421
- * const { scene, camera } = await TestUtils.createComparisonScene({ files });
19422
- * // this could now be assigned to the Needle Engine Context
19423
- * context.scene = scene;
19424
- * context.mainCamera = camera;
19425
- * ```
19426
- */
19427
- static createComparisonScene(opts: ComparisonSceneOptions): Promise<{
19428
- scene: Scene;
19429
- camera: PerspectiveCamera;
19430
- }>;
19431
- }
19432
-
19433
19689
  /* Excluded from this release type: TestSimulateUserData */
19434
19690
 
19435
19691
  /**
@@ -19488,6 +19744,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
19488
19744
  private getTextOpts;
19489
19745
  onEnable(): void;
19490
19746
  onDisable(): void;
19747
+ onDestroy(): void;
19491
19748
  private getAlignment;
19492
19749
  private feedText;
19493
19750
  private _didHandleTextRenderOnTop;
@@ -22679,12 +22936,6 @@ export declare namespace MaterialX {
22679
22936
  }): Promise<import("three").Material | null>;
22680
22937
  }
22681
22938
 
22682
- declare global {
22683
- interface HTMLElementTagNameMap {
22684
- "needle-button": NeedleButtonElement;
22685
- }
22686
- }
22687
-
22688
22939
  /**
22689
22940
  * @internal
22690
22941
  */
@@ -22734,20 +22985,10 @@ export declare namespace InternalAttributeUtils {
22734
22985
  }): false | string | null;
22735
22986
  }
22736
22987
 
22737
-
22738
- /**
22739
- * @category Splines
22740
- * @see {@link SplineContainer} for the main spline component that defines the path and knots
22741
- */
22742
- export declare namespace SplineUtils {
22743
- /**
22744
- * Creates a SplineContainer from an array of points.
22745
- * @param positions The positions of the knots.
22746
- * @param closed Whether the spline is closed (the last knot connects to the first).
22747
- * @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
22748
- * @return The created SplineContainer component - add it to an Object3D to use it.
22749
- */
22750
- function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
22988
+ declare global {
22989
+ interface HTMLElementTagNameMap {
22990
+ "needle-button": NeedleButtonElement;
22991
+ }
22751
22992
  }
22752
22993
 
22753
22994
 
@@ -22890,6 +23131,22 @@ declare module 'three' {
22890
23131
  }
22891
23132
  }
22892
23133
 
23134
+
23135
+ /**
23136
+ * @category Splines
23137
+ * @see {@link SplineContainer} for the main spline component that defines the path and knots
23138
+ */
23139
+ export declare namespace SplineUtils {
23140
+ /**
23141
+ * Creates a SplineContainer from an array of points.
23142
+ * @param positions The positions of the knots.
23143
+ * @param closed Whether the spline is closed (the last knot connects to the first).
23144
+ * @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
23145
+ * @return The created SplineContainer component - add it to an Object3D to use it.
23146
+ */
23147
+ function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
23148
+ }
23149
+
22893
23150
  declare global {
22894
23151
  interface HTMLElementTagNameMap {
22895
23152
  "needle-logo-element": NeedleLogoElement;