@needle-tools/engine 4.14.0-next.b2e3b1a → 4.15.0-next.cecd8e7

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 (92) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-Bhgt3W8p.min.js → needle-engine.bundle-CuAiLb-d.min.js} +134 -126
  4. package/dist/{needle-engine.bundle-BC1QDiuv.umd.cjs → needle-engine.bundle-JQGIFVRm.umd.cjs} +128 -120
  5. package/dist/{needle-engine.bundle-CeQXs7Hh.js → needle-engine.bundle-VZVrVbc3.js} +3521 -3315
  6. package/dist/needle-engine.d.ts +450 -107
  7. package/dist/needle-engine.js +570 -569
  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 +202 -17
  11. package/lib/engine/api.js +270 -17
  12. package/lib/engine/api.js.map +1 -1
  13. package/lib/engine/engine_accessibility.d.ts +77 -0
  14. package/lib/engine/engine_accessibility.js +162 -0
  15. package/lib/engine/engine_accessibility.js.map +1 -0
  16. package/lib/engine/engine_components.d.ts +1 -1
  17. package/lib/engine/engine_components.js +3 -7
  18. package/lib/engine/engine_components.js.map +1 -1
  19. package/lib/engine/engine_context.d.ts +2 -12
  20. package/lib/engine/engine_context.js +7 -29
  21. package/lib/engine/engine_context.js.map +1 -1
  22. package/lib/engine/engine_gltf_builtin_components.js +1 -16
  23. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  24. package/lib/engine/engine_materialpropertyblock.d.ts +90 -4
  25. package/lib/engine/engine_materialpropertyblock.js +97 -7
  26. package/lib/engine/engine_materialpropertyblock.js.map +1 -1
  27. package/lib/engine/engine_math.d.ts +34 -1
  28. package/lib/engine/engine_math.js +34 -1
  29. package/lib/engine/engine_math.js.map +1 -1
  30. package/lib/engine/engine_networking.js +1 -1
  31. package/lib/engine/engine_networking.js.map +1 -1
  32. package/lib/engine/engine_types.d.ts +2 -0
  33. package/lib/engine/engine_types.js +2 -0
  34. package/lib/engine/engine_types.js.map +1 -1
  35. package/lib/engine/webcomponents/icons.js +3 -0
  36. package/lib/engine/webcomponents/icons.js.map +1 -1
  37. package/lib/engine/webcomponents/logo-element.d.ts +1 -0
  38. package/lib/engine/webcomponents/logo-element.js +3 -1
  39. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  40. package/lib/engine/webcomponents/needle-button.d.ts +37 -11
  41. package/lib/engine/webcomponents/needle-button.js +42 -11
  42. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  43. package/lib/engine/webcomponents/needle-engine.d.ts +10 -2
  44. package/lib/engine/webcomponents/needle-engine.js +13 -3
  45. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  46. package/lib/engine-components/Component.d.ts +1 -2
  47. package/lib/engine-components/Component.js +1 -2
  48. package/lib/engine-components/Component.js.map +1 -1
  49. package/lib/engine-components/DragControls.d.ts +1 -0
  50. package/lib/engine-components/DragControls.js +21 -0
  51. package/lib/engine-components/DragControls.js.map +1 -1
  52. package/lib/engine-components/NeedleMenu.d.ts +2 -0
  53. package/lib/engine-components/NeedleMenu.js +2 -0
  54. package/lib/engine-components/NeedleMenu.js.map +1 -1
  55. package/lib/engine-components/Networking.d.ts +28 -3
  56. package/lib/engine-components/Networking.js +28 -3
  57. package/lib/engine-components/Networking.js.map +1 -1
  58. package/lib/engine-components/ReflectionProbe.d.ts +1 -0
  59. package/lib/engine-components/ReflectionProbe.js +20 -2
  60. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  61. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +107 -13
  62. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +167 -30
  63. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  64. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  65. package/lib/engine-components/ui/Button.d.ts +1 -0
  66. package/lib/engine-components/ui/Button.js +11 -0
  67. package/lib/engine-components/ui/Button.js.map +1 -1
  68. package/lib/engine-components/ui/Text.d.ts +1 -0
  69. package/lib/engine-components/ui/Text.js +11 -0
  70. package/lib/engine-components/ui/Text.js.map +1 -1
  71. package/package.json +1 -1
  72. package/src/engine/api.ts +370 -18
  73. package/src/engine/engine_accessibility.ts +198 -0
  74. package/src/engine/engine_components.ts +3 -7
  75. package/src/engine/engine_context.ts +11 -28
  76. package/src/engine/engine_gltf_builtin_components.ts +1 -17
  77. package/src/engine/engine_materialpropertyblock.ts +102 -11
  78. package/src/engine/engine_math.ts +34 -1
  79. package/src/engine/engine_networking.ts +1 -1
  80. package/src/engine/engine_types.ts +5 -0
  81. package/src/engine/webcomponents/icons.ts +3 -0
  82. package/src/engine/webcomponents/logo-element.ts +4 -1
  83. package/src/engine/webcomponents/needle-button.ts +44 -13
  84. package/src/engine/webcomponents/needle-engine.ts +18 -7
  85. package/src/engine-components/Component.ts +1 -3
  86. package/src/engine-components/DragControls.ts +29 -4
  87. package/src/engine-components/NeedleMenu.ts +5 -3
  88. package/src/engine-components/Networking.ts +29 -4
  89. package/src/engine-components/ReflectionProbe.ts +21 -2
  90. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +198 -65
  91. package/src/engine-components/ui/Button.ts +12 -0
  92. package/src/engine-components/ui/Text.ts +13 -0
@@ -9,8 +9,8 @@ import type { Voip } from './Voip.js';
9
9
  /**
10
10
  * [NeedleMenu](https://engine.needle.tools/docs/api/NeedleMenu) provides configuration for the built-in UI menu.
11
11
  * The menu renders as HTML overlay in browser mode and automatically
12
- * switches to a 3D spatial menu in VR/AR.
13
- *
12
+ * switches to a 3D spatial menu in VR/AR.
13
+ *
14
14
  * ![](https://cloud.needle.tools/-/media/YKleg1oPy_I8Hv8sg_k40Q.png)
15
15
  *
16
16
  * **Features:**
@@ -18,7 +18,7 @@ import type { Voip } from './Voip.js';
18
18
  * - Audio mute/unmute button
19
19
  * - QR code sharing (desktop only)
20
20
  * - Spatial menu in XR (appears when looking up)
21
- * - Custom positioning (top/bottom)
21
+ * - Custom positioning (top/bottom)
22
22
  *
23
23
  * **Programmatic access:**
24
24
  * Access the menu API via `this.context.menu` to add custom buttons,
@@ -36,6 +36,8 @@ import type { Voip } from './Voip.js';
36
36
  * @category User Interface
37
37
  * @group Components
38
38
  * @see {@link Context.menu} for programmatic menu control
39
+ * @see {@link NeedleButtonElement} for standalone <needle-button> web component
40
+ * @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
39
41
  * @see {@link Voip} adds a microphone button to the menu
40
42
  * @see {@link ScreenCapture} adds a screen sharing button
41
43
  **/
@@ -7,10 +7,34 @@ import { Behaviour } from "./Component.js";
7
7
  const debug = getParam("debugnet");
8
8
 
9
9
  /**
10
- * Provides configuration to the built-in networking system.
11
- * This component supplies websocket URLs for establishing connections.
12
- * It implements the {@link INetworkingWebsocketUrlProvider} interface.
13
- *
10
+ * Provides websocket URL configuration for the built-in networking system.
11
+ * Add this component to override the default networking backend URL used by {@link NetworkConnection} (`this.context.connection`).
12
+ *
13
+ * The component registers itself as a URL provider on `awake()`. When the networking system connects,
14
+ * it queries this provider for the websocket URL to use instead of the default Needle networking backend.
15
+ *
16
+ * **URL resolution order:**
17
+ * 1. If `urlParameterName` is set and the corresponding URL parameter exists in the browser URL, that value is used
18
+ * 2. If running on a local network and `localhost` is set, the `localhost` URL is used
19
+ * 3. Otherwise, the `url` field is used
20
+ *
21
+ * Without this component, the default backend URL `wss://networking-2.needle.tools/socket` is used.
22
+ *
23
+ * **Note:** This component only configures the websocket URL. To actually join a networked room,
24
+ * use a `SyncedRoom` component or call `this.context.connection.joinRoom("room-name")` directly.
25
+ *
26
+ * @example Overriding the URL via browser parameter
27
+ * ```ts
28
+ * // With urlParameterName="server", visiting:
29
+ * // https://myapp.com/?server=wss://my-server.com/socket
30
+ * // will connect to that server instead
31
+ * ```
32
+ *
33
+ * @see {@link NetworkConnection} for the main networking API (`this.context.connection`)
34
+ * @see {@link SyncedRoom} for automatic room joining
35
+ * @see {@link OwnershipModel} for networked object ownership
36
+ * @see {@link RoomEvents} for room lifecycle events
37
+ * @link https://engine.needle.tools/docs/how-to-guides/networking/
14
38
  * @summary Networking configuration
15
39
  * @category Networking
16
40
  * @group Components
@@ -20,6 +44,7 @@ export class Networking extends Behaviour implements INetworkingWebsocketUrlProv
20
44
  /**
21
45
  * The websocket URL to connect to for networking functionality.
22
46
  * Can be a complete URL or a relative path that will be resolved against the current origin.
47
+ * @default null
23
48
  */
24
49
  @serializable()
25
50
  url: string | null = null;
@@ -2,10 +2,11 @@ import { Color, CubeReflectionMapping, CubeTexture, EquirectangularReflectionMap
2
2
 
3
3
  import { isDevEnvironment, showBalloonWarning } from "../engine/debug/index.js";
4
4
  import { MaterialPropertyBlock } from "../engine/engine_materialpropertyblock.js";
5
+ import { loadPMREM } from "../engine/engine_pmrem.js";
5
6
  import { serializable } from "../engine/engine_serialization.js";
6
7
  import { Context } from "../engine/engine_setup.js";
7
8
  import type { IRenderer } from "../engine/engine_types.js";
8
- import { getParam } from "../engine/engine_utils.js";
9
+ import { getParam, resolveUrl } from "../engine/engine_utils.js";
9
10
  import { BoxHelperComponent } from "./BoxHelperComponent.js";
10
11
  import { Behaviour } from "./Component.js";
11
12
  import { EventList } from "./EventList.js";
@@ -90,10 +91,28 @@ export class ReflectionProbe extends Behaviour {
90
91
  }
91
92
 
92
93
  private _texture!: Texture;
94
+ private _textureUrlInFlight?: string;
93
95
 
94
- @serializable(Texture)
96
+ @serializable([Texture, String])
95
97
  set texture(tex: Texture) {
96
98
  if (this._texture === tex) return;
99
+
100
+ if (typeof tex === "string") {
101
+ if(debug) console.debug(`[ReflectionProbe] Loading reflection probe texture from URL: ${tex}`);
102
+ this._textureUrlInFlight = tex;
103
+ const textureUrl = resolveUrl(this.sourceId, tex);
104
+ loadPMREM(textureUrl, this.context.renderer).then(loaded => {
105
+ if (this._textureUrlInFlight === tex && loaded) {
106
+ this._textureUrlInFlight = undefined;
107
+ if (debug) console.debug(`[ReflectionProbe] Successfully loaded reflection probe texture: ${tex}`);
108
+ this.texture = loaded;
109
+ }
110
+ });
111
+ return;
112
+ }
113
+
114
+ this._textureUrlInFlight = undefined;
115
+
97
116
  this._texture = tex;
98
117
 
99
118
  if (debug) console.debug("[ReflectionProbe] Set reflection probe texture " + (tex?.name || "(removed)"));