@needle-tools/engine 5.1.0-canary.e9062c0 → 5.1.0-canary.fbdfce3

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 (49) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{needle-engine.bundle-CDKcuALa.js → needle-engine.bundle-BFSj2Fz8.js} +5420 -5413
  3. package/dist/{needle-engine.bundle-w22UkaT_.min.js → needle-engine.bundle-CmxIO5uH.min.js} +135 -135
  4. package/dist/{needle-engine.bundle--q_w7iXI.umd.cjs → needle-engine.bundle-tJIZukCz.umd.cjs} +135 -135
  5. package/dist/needle-engine.d.ts +57 -65
  6. package/dist/needle-engine.js +188 -186
  7. package/dist/needle-engine.min.js +1 -1
  8. package/dist/needle-engine.umd.cjs +1 -1
  9. package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
  10. package/lib/engine/debug/debug_spatial_console.js +10 -7
  11. package/lib/engine/debug/debug_spatial_console.js.map +1 -1
  12. package/lib/engine/engine_addressables.d.ts +2 -0
  13. package/lib/engine/engine_addressables.js +6 -3
  14. package/lib/engine/engine_addressables.js.map +1 -1
  15. package/lib/engine/engine_context.d.ts +16 -19
  16. package/lib/engine/engine_context.js +12 -15
  17. package/lib/engine/engine_context.js.map +1 -1
  18. package/lib/engine/engine_init.js +10 -0
  19. package/lib/engine/engine_init.js.map +1 -1
  20. package/lib/engine/engine_scenedata.d.ts +5 -7
  21. package/lib/engine/engine_scenedata.js +14 -11
  22. package/lib/engine/engine_scenedata.js.map +1 -1
  23. package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
  24. package/lib/engine/engine_serialization_builtin_serializer.js +28 -41
  25. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  26. package/lib/engine/webcomponents/jsx.d.ts +9 -2
  27. package/lib/engine-components/AnimatorController.d.ts +2 -0
  28. package/lib/engine-components/AnimatorController.js +4 -1
  29. package/lib/engine-components/AnimatorController.js.map +1 -1
  30. package/lib/engine-components/Light.js +4 -2
  31. package/lib/engine-components/Light.js.map +1 -1
  32. package/lib/engine-components/ReflectionProbe.js +2 -0
  33. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  34. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
  35. package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
  36. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  37. package/package.json +1 -1
  38. package/plugins/vite/reload.js +18 -17
  39. package/src/engine/debug/debug_spatial_console.ts +10 -7
  40. package/src/engine/engine_addressables.ts +6 -3
  41. package/src/engine/engine_context.ts +18 -20
  42. package/src/engine/engine_init.ts +10 -0
  43. package/src/engine/engine_scenedata.ts +13 -10
  44. package/src/engine/engine_serialization_builtin_serializer.ts +32 -43
  45. package/src/engine/webcomponents/jsx.d.ts +9 -2
  46. package/src/engine-components/AnimatorController.ts +4 -1
  47. package/src/engine-components/Light.ts +3 -2
  48. package/src/engine-components/ReflectionProbe.ts +2 -0
  49. package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
@@ -3623,7 +3623,7 @@ declare class ColorSerializer extends TypeSerializer {
3623
3623
  onSerialize(data: any): any | void;
3624
3624
  }
3625
3625
 
3626
- export declare const colorSerializer: ColorSerializer;
3626
+ export declare let colorSerializer: ColorSerializer;
3627
3627
 
3628
3628
  /**
3629
3629
  * Utility method to check if two materials were created from the same glTF material
@@ -4097,7 +4097,7 @@ declare class ComponentSerializer extends TypeSerializer {
4097
4097
  findObjectForGuid(guid: string, root: Object3D): any;
4098
4098
  }
4099
4099
 
4100
- export declare const componentSerializer: ComponentSerializer;
4100
+ export declare let componentSerializer: ComponentSerializer;
4101
4101
 
4102
4102
  declare type ComponentType = "button" | "thumbstick" | "squeeze" | "touchpad";
4103
4103
 
@@ -4460,13 +4460,14 @@ export declare class Context implements IContext {
4460
4460
  * Use `setCurrentCamera` for updating the main camera.
4461
4461
  */
4462
4462
  /**
4463
- * Typed proxy providing direct access to scene components by node and component name.
4464
- * Types are auto-generated from your GLB assets by the `needle:dts-generator` Vite plugin
4465
- * and written to `src/generated/needle-bindings.d.ts` on every dev-server start and GLB change.
4463
+ * Access your scene's full hierarchy, objects, and components directly by name with full autocomplete.
4464
+ * Types are generated automatically from your GLB files when the dev server starts.
4466
4465
  *
4467
- * Each property access traverses the live scene graph on demand — no caching, always fresh.
4468
- * This is a convenience shorthand for `getComponent` lookups; the same result can be
4469
- * achieved manually via `scene.getObjectByName(name)` + `getComponent(node, Type)`.
4466
+ * You can store references to objects or components for later use.
4467
+ * Note that the scene hierarchy can change at runtime (e.g. when objects are added, removed, or re-parented),
4468
+ * in which case stored references may become stale.
4469
+ *
4470
+ * @experimental This API may change in future versions.
4470
4471
  *
4471
4472
  * @example
4472
4473
  * // Toggle auto-rotate on the orbit camera
@@ -4475,12 +4476,6 @@ export declare class Context implements IContext {
4475
4476
  * @example
4476
4477
  * // Change the background color
4477
4478
  * ctx.sceneData.Camera.Camera.backgroundColor = new RGBAColor(1, 0, 0, 1);
4478
- *
4479
- * @example
4480
- * // Equivalent manual approach (without sceneData)
4481
- * const node = ctx.scene.getObjectByName("Camera");
4482
- * const orbit = getComponent(node, OrbitControls);
4483
- * if (orbit) orbit.autoRotate = true;
4484
4479
  */
4485
4480
  get sceneData(): SceneData;
4486
4481
  get mainCamera(): Camera_2;
@@ -4504,19 +4499,21 @@ export declare class Context implements IContext {
4504
4499
  connection: NetworkConnection;
4505
4500
  /** @deprecated AssetDatabase is deprecated */
4506
4501
  assets: AssetDatabase;
4507
- /** All registered lights in the scene, maintained by the Light component */
4508
- readonly lights: Set<ILight>;
4502
+ /** All registered lights in the scene, maintained by the Light component.
4503
+ * @see mainLight for accessing the main directional light in the scene
4504
+ */
4505
+ readonly lights: ILight[];
4509
4506
  /** The brightest registered directional light, or null if none are registered
4510
4507
  * @see lights
4511
4508
  */
4512
4509
  get mainLight(): ILight | null;
4513
4510
  /** @deprecated Use sceneLighting */
4514
- get rendererData(): RendererData;
4511
+ private get rendererData();
4515
4512
  /** Access the scene lighting manager to control lighting settings in the context */
4516
- sceneLighting: RendererData;
4517
- addressables: Addressables;
4518
- lightmaps: ILightDataRegistry;
4519
- players: PlayerViewManager;
4513
+ readonly sceneLighting: RendererData;
4514
+ readonly addressables: Addressables;
4515
+ readonly lightmaps: ILightDataRegistry;
4516
+ readonly players: PlayerViewManager;
4520
4517
  /** Access the LODs manager to control LOD behavior in the context */
4521
4518
  readonly lodsManager: LODsManager;
4522
4519
  /** Access the needle menu to add or remove buttons to the menu element */
@@ -5923,19 +5920,6 @@ export declare class EnvironmentScene extends Scene {
5923
5920
  createAreaLightMaterial(intensity: number): MeshBasicMaterial;
5924
5921
  }
5925
5922
 
5926
- export declare const euler: EulerSerializer;
5927
-
5928
- declare class EulerSerializer extends TypeSerializer {
5929
- constructor();
5930
- onDeserialize(data: any, _context: SerializationContext): Euler | undefined;
5931
- onSerialize(data: any, _context: SerializationContext): {
5932
- x: any;
5933
- y: any;
5934
- z: any;
5935
- order: any;
5936
- };
5937
- }
5938
-
5939
5923
  /**
5940
5924
  * EventList manages a list of callbacks that can be invoked together.
5941
5925
  * Used for Unity-style events that can be configured in the editor (Unity or Blender).
@@ -6068,7 +6052,7 @@ declare class EventListSerializer extends TypeSerializer {
6068
6052
  onDeserialize(data: EventListData, context: SerializationContext): EventList<any> | undefined | null;
6069
6053
  }
6070
6054
 
6071
- export declare const eventListSerializer: EventListSerializer;
6055
+ export declare let eventListSerializer: EventListSerializer;
6072
6056
 
6073
6057
  /**
6074
6058
  * [EventSystem](https://engine.needle.tools/docs/api/EventSystem) is responsible for managing and dispatching input events to UI components within the scene.
@@ -8460,10 +8444,20 @@ export declare class InheritVelocityModule {
8460
8444
  applyCurrent(vel: Vector3 | Vector3_2, t01: number, lerpFactor: number): void;
8461
8445
  }
8462
8446
 
8447
+ /* Excluded from this release type: initAddressableSerializers */
8448
+
8449
+ /** Register all builtin serializers and prototype patches.
8450
+ * Must be called from {@link initEngine} so the registrations survive tree-shaking
8451
+ * when the package declares `sideEffects: false`.
8452
+ */
8453
+ export declare function initBuiltinSerializers(): void;
8454
+
8463
8455
  /** Register the Rapier physics backend. Called from {@link initEngine}
8464
8456
  * to ensure it runs regardless of tree-shaking. */
8465
8457
  export declare function initPhysics(): void;
8466
8458
 
8459
+ /* Excluded from this release type: initVolumeParameterSerializer */
8460
+
8467
8461
  /**
8468
8462
  * Handles all input events including mouse, touch, keyboard, and XR controllers.
8469
8463
  * Access via `this.context.input` from any component.
@@ -11048,15 +11042,13 @@ export declare type MouseButtonName = "left" | "right" | "middle";
11048
11042
  /* Excluded from this release type: nameofFactory */
11049
11043
 
11050
11044
  /**
11051
- * Global proxy for the primary Needle Engine context.
11052
- * Resolves lazily on property access via `ContextRegistry.Current` —
11053
- * safe to import at module level, including in SSR environments
11054
- * (returns a silent error proxy when no context is active).
11045
+ * Quick access to the current Needle Engine context from anywhere — no need to pass `ctx` around.
11046
+ * Use it in React/Svelte/Vue components, button handlers, or plain JavaScript.
11055
11047
  *
11056
- * Use this outside of Needle component lifecycle (e.g. in Svelte/React/Vue
11057
- * components, button handlers, or vanilla JS) instead of threading `ctx` around.
11048
+ * Safe to import at module level, including in SSR environments.
11049
+ * For pages with multiple `<needle-engine>` elements, use `ctx` directly instead.
11058
11050
  *
11059
- * For multiple `<needle-engine>` elements on the same page, use `ctx` directly.
11051
+ * @experimental This API may change in future releases.
11060
11052
  *
11061
11053
  * @example
11062
11054
  * import { needle } from "@needle-tools/engine";
@@ -13059,7 +13051,7 @@ declare class ObjectSerializer extends TypeSerializer {
13059
13051
  onDeserialize(data: ObjectData | string | null, context: SerializationContext): Object3D<Object3DEventMap> | Component | null | undefined;
13060
13052
  }
13061
13053
 
13062
- export declare const objectSerializer: ObjectSerializer;
13054
+ export declare let objectSerializer: ObjectSerializer;
13063
13055
 
13064
13056
  declare type ObjectToNodeMap = {
13065
13057
  [uuid: string]: number;
@@ -23527,28 +23519,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
23527
23519
  export { }
23528
23520
 
23529
23521
 
23530
- declare module 'three' {
23531
- interface SkinnedMesh {
23532
- staticGenerator?: StaticGeometryGenerator;
23533
- staticGeometry?: BufferGeometry;
23534
- staticGeometryLastUpdate?: number;
23535
- }
23536
- interface Mesh {
23537
- acceleratedRaycast?: any;
23538
- }
23539
- interface SkinnedMesh {
23540
- /** @deprecated use autoUpdateMeshBvhInterval */
23541
- autoUpdateMeshBVH?: boolean;
23542
- /**
23543
- * Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
23544
- * @default undefined (disabled)
23545
- */
23546
- autoUpdateMeshBvhInterval?: number;
23547
- bvhNeedsUpdate?: boolean;
23548
- }
23549
- }
23550
-
23551
-
23552
23522
  declare module 'three' {
23553
23523
  interface Object3D {
23554
23524
  get guid(): string | undefined;
@@ -23694,3 +23664,25 @@ declare module 'three' {
23694
23664
  slerp(end: Vector3, t: number): Vector3;
23695
23665
  }
23696
23666
  }
23667
+
23668
+
23669
+ declare module 'three' {
23670
+ interface SkinnedMesh {
23671
+ staticGenerator?: StaticGeometryGenerator;
23672
+ staticGeometry?: BufferGeometry;
23673
+ staticGeometryLastUpdate?: number;
23674
+ }
23675
+ interface Mesh {
23676
+ acceleratedRaycast?: any;
23677
+ }
23678
+ interface SkinnedMesh {
23679
+ /** @deprecated use autoUpdateMeshBvhInterval */
23680
+ autoUpdateMeshBVH?: boolean;
23681
+ /**
23682
+ * Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
23683
+ * @default undefined (disabled)
23684
+ */
23685
+ autoUpdateMeshBvhInterval?: number;
23686
+ bvhNeedsUpdate?: boolean;
23687
+ }
23688
+ }