@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
package/lib/engine/api.js CHANGED
@@ -1,86 +1,339 @@
1
1
  /**
2
- * Contains core functionality for Needle Engine.
3
- * This includes
4
- * - Context Management
5
- * - Asset Loading
6
- * - Component Lifecycle
7
- * - Time Handling
8
- * - XR support
9
- * - Unified Input Handling
10
- * - Needle Menu
11
- * - Networking
12
- * - Physics, Collisions, Raycasting
13
- * - Math and Filtering Helpers
14
- * - Rendering Utilities
15
- * - Debugging Utilities, Gizmos
16
- * - User agent detection
17
- * - and more.
2
+ * The Engine Core API is the main entry point for Needle Engine functionality.
3
+ * It provides a unified interface for building interactive 3D web experiences
4
+ * with features spanning rendering, physics, networking, XR, and more.
5
+ *
6
+ * ## Quick Start
7
+ * ```typescript
8
+ * import { Context, Behaviour, serializable } from "@needle-tools/engine";
9
+ *
10
+ * class MyComponent extends Behaviour {
11
+ * @serializable()
12
+ * speed: number = 1;
13
+ *
14
+ * update() {
15
+ * this.gameObject.rotateY(this.context.time.deltaTime * this.speed);
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * ## Module Categories
21
+ *
22
+ * ### Context & Application
23
+ * The {@link Context} class is the central hub that manages the scene, renderer, camera,
24
+ * and all engine systems. Access it via `this.context` in any component.
25
+ * - {@link Context} - Main engine context managing scene, renderer, and systems
26
+ * - {@link ContextRegistry} - Registry for multiple engine contexts
27
+ * - {@link Application} - Application-level utilities and state
28
+ *
29
+ * ### Components & GameObjects
30
+ * Needle Engine uses a component-based architecture similar to Unity.
31
+ * Components are attached to three.js Object3D instances (GameObjects).
32
+ * - {@link addComponent}, {@link getComponent}, {@link removeComponent} - Component management
33
+ * - {@link findObjectOfType}, {@link findObjectsOfType} - Scene queries
34
+ * - {@link instantiate}, {@link destroy} - Object lifecycle
35
+ * @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
36
+ *
37
+ * ### Asset Loading
38
+ * Load glTF/GLB files, textures, and other assets at runtime.
39
+ * - {@link loadSync}, {@link parseSync} - Load glTF/GLB assets
40
+ * - {@link AssetDatabase} - Asset reference management
41
+ * - {@link Addressables} - Addressable asset system
42
+ * @see {@link https://engine.needle.tools/docs/addressables.html | Addressables Documentation}
43
+ *
44
+ * ### Input System
45
+ * Unified input handling for mouse, touch, keyboard, and XR controllers.
46
+ * Access via `this.context.input` in components.
47
+ * - {@link Input} - Unified input manager
48
+ * - {@link NEPointerEvent} - Cross-platform pointer events
49
+ * - {@link InputEvents} - Event types for input listeners
50
+ * @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
51
+ *
52
+ * ### Physics & Raycasting
53
+ * Rapier-based physics engine with collision detection and raycasting.
54
+ * - {@link Physics} - Physics world access and raycasting
55
+ * - {@link RaycastOptions} - Configure raycast behavior
56
+ * - {@link Collision}, {@link ContactPoint} - Collision data types
57
+ * @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
58
+ *
59
+ * ### Networking
60
+ * Real-time multiplayer networking with automatic state synchronization.
61
+ * - {@link NetworkConnection} - WebSocket connection management
62
+ * - {@link RoomEvents} - Room join/leave events
63
+ * - {@link syncField} - Decorator for automatic field synchronization
64
+ * - {@link PeerNetworking} - WebRTC peer-to-peer connections
65
+ * @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
66
+ *
67
+ * ### XR (AR/VR)
68
+ * WebXR support for augmented and virtual reality experiences.
69
+ * - {@link NeedleXRSession} - XR session management
70
+ * - {@link NeedleXRController} - XR controller input and tracking
71
+ * - {@link XRRig} - XR camera rig configuration
72
+ * @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
73
+ *
74
+ * ### Time & Animation
75
+ * Frame timing and animation utilities.
76
+ * - {@link Time} - Delta time, frame count, time scale
77
+ * - {@link AnimationUtils} - Animation playback helpers
78
+ * - Coroutines via {@link startCoroutine} for async sequences
79
+ *
80
+ * ### Debugging & Gizmos
81
+ * Visual debugging tools for development.
82
+ * - {@link Gizmos} - Draw debug shapes (lines, spheres, boxes)
83
+ * - {@link showBalloonMessage}, {@link showBalloonWarning} - On-screen messages
84
+ * - {@link isDevEnvironment} - Check if running in development mode
85
+ *
86
+ * ### Utilities
87
+ * Helper functions for common operations.
88
+ * - {@link getParam} - URL parameter parsing
89
+ * - {@link delay} - Promise-based delay
90
+ * - {@link generateQRCode} - QR code generation
91
+ * - Math utilities: {@link Mathf}, vector operations
18
92
  *
19
93
  * @module Engine Core
94
+ * @see {@link https://engine.needle.tools/docs/ | Needle Engine Documentation}
20
95
  */
96
+ // ============================================================================
97
+ // DEBUGGING & DEVELOPMENT
98
+ // Debugging utilities, gizmos, and development tools.
99
+ // ============================================================================
21
100
  export * from "./debug/index.js";
101
+ // ============================================================================
102
+ // ASSET LOADING & MANAGEMENT
103
+ // Systems for loading, managing, and referencing assets at runtime.
104
+ // ============================================================================
105
+ /** Addressable asset system for loading assets by address/label */
22
106
  export * from "./engine_addressables.js";
107
+ /** Animation playback and control utilities */
23
108
  export { AnimationUtils } from "./engine_animation.js";
109
+ /** Application-level state and utilities */
24
110
  export { Application } from "./engine_application.js";
111
+ /** Asset database for managing asset references */
25
112
  export * from "./engine_assetdatabase.js";
113
+ // ============================================================================
114
+ // CAMERA & RENDERING
115
+ // Camera control, rendering utilities, and visual effects.
116
+ // ============================================================================
117
+ /** Camera fitting utilities for framing objects */
26
118
  export * from "./engine_camera.fit.js";
119
+ /** Camera controller management and auto-fit configuration */
27
120
  export { getCameraController, setAutoFitEnabled, setCameraController, useForAutoFit } from "./engine_camera.js";
121
+ // ============================================================================
122
+ // COMPONENTS & GAMEOBJECTS
123
+ // Component-based architecture for building interactive 3D content.
124
+ // Functions for adding, removing, and querying components on objects.
125
+ // ============================================================================
126
+ /**
127
+ * Component management functions: addComponent, getComponent, removeComponent, etc.
128
+ * @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
129
+ */
28
130
  export * from "./engine_components.js";
131
+ /** Internal component lifecycle events and management */
29
132
  export * from "./engine_components_internal.js";
30
- export * from "./engine_components_internal.js";
133
+ /** Engine constants and configuration values */
31
134
  export * from "./engine_constants.js";
135
+ // ============================================================================
136
+ // CONTEXT & LIFECYCLE
137
+ // Core engine context and application lifecycle management.
138
+ // ============================================================================
139
+ /**
140
+ * Main engine context class - the central hub for all engine systems.
141
+ * Provides access to scene, renderer, camera, input, physics, networking, and more.
142
+ * @see {@link https://engine.needle.tools/docs/scripting.html#context | Context Documentation}
143
+ */
32
144
  export * from "./engine_context.js";
145
+ /** Registry for managing multiple engine contexts */
33
146
  export * from "./engine_context_registry.js";
147
+ /**
148
+ * Coroutine system for async sequences in components.
149
+ * Use startCoroutine() for frame-based async operations.
150
+ */
34
151
  export * from "./engine_coroutine.js";
152
+ /** Factory functions for creating primitives and objects */
35
153
  export * from "./engine_create_objects.js";
154
+ /** Feature flags for enabling/disabling engine features */
36
155
  export * from "./engine_feature_flags.js";
156
+ /**
157
+ * GameObject utilities: instantiate, destroy, find, traverse.
158
+ * @see {@link https://engine.needle.tools/docs/scripting.html#finding-objects | Finding Objects}
159
+ */
37
160
  export * from "./engine_gameobject.js";
161
+ /**
162
+ * Visual debugging with Gizmos - draw lines, spheres, boxes for debugging.
163
+ * @see {@link https://engine.needle.tools/docs/debugging.html | Debugging Documentation}
164
+ */
38
165
  export { Gizmos } from "./engine_gizmos.js";
166
+ /** glTF/GLB loader registration and management */
39
167
  export * from "./engine_gltf.js";
168
+ /** Hot reload support for development */
40
169
  export * from "./engine_hot_reload.js";
170
+ // ============================================================================
171
+ // INPUT SYSTEM
172
+ // Unified input handling for mouse, touch, keyboard, and XR controllers.
173
+ // ============================================================================
174
+ /**
175
+ * Unified input system supporting mouse, touch, keyboard, and XR controllers.
176
+ * Access via this.context.input in components.
177
+ * @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
178
+ */
41
179
  export * from "./engine_input.js";
180
+ // ============================================================================
181
+ // INSTANCING & PERFORMANCE
182
+ // GPU instancing and performance optimization utilities.
183
+ // ============================================================================
184
+ /** GPU instancing utilities for rendering many similar objects efficiently */
42
185
  export { InstancingUtil } from "./engine_instancing.js";
186
+ /** License checking utilities */
43
187
  export { hasCommercialLicense, hasIndieLicense, hasProLicense } from "./engine_license.js";
188
+ // ============================================================================
189
+ // LIFECYCLE & LOADING
190
+ // Component lifecycle hooks and asset loading systems.
191
+ // ============================================================================
192
+ /** Lifecycle API for registering global callbacks */
44
193
  export * from "./engine_lifecycle_api.js";
194
+ /** Model loader callbacks for customizing load behavior */
45
195
  export { NeedleEngineModelLoader } from "./engine_loaders.callbacks.js";
196
+ /**
197
+ * Asset loading functions: loadSync, parseSync for glTF/GLB files.
198
+ * @see {@link https://engine.needle.tools/docs/addressables.html | Loading Assets}
199
+ */
46
200
  export { loadAsset, loadSync, parseSync } from "./engine_loaders.js";
201
+ // ============================================================================
202
+ // MATERIALS & RENDERING
203
+ // Material utilities and rendering helpers.
204
+ // ============================================================================
205
+ /** MaterialPropertyBlock for efficient material property overrides per-instance */
47
206
  export { MaterialPropertyBlock } from "./engine_materialpropertyblock.js";
207
+ /** Math utilities: Mathf, interpolation, easing functions */
48
208
  export * from "./engine_math.js";
209
+ /** Engine modules registry */
49
210
  export { MODULES as NEEDLE_ENGINE_MODULES } from "./engine_modules.js";
211
+ // ============================================================================
212
+ // NETWORKING
213
+ // Real-time multiplayer networking with WebSocket and WebRTC support.
214
+ // ============================================================================
215
+ /**
216
+ * Core networking: NetworkConnection, RoomEvents, OwnershipEvent.
217
+ * @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
218
+ */
50
219
  export * from "./engine_networking.js";
220
+ /**
221
+ * @syncField decorator for automatic field synchronization across clients.
222
+ * @see {@link https://engine.needle.tools/docs/networking.html#synced-variables | Synced Variables}
223
+ */
51
224
  export { syncField } from "./engine_networking_auto.js";
225
+ /** Blob/binary data transfer over network */
52
226
  export * from "./engine_networking_blob.js";
227
+ /** File transfer utilities for networking */
53
228
  export * from "./engine_networking_files.js";
229
+ /**
230
+ * Network instantiation for spawning synced objects.
231
+ * @see {@link https://engine.needle.tools/docs/networking.html#spawning-objects | Spawning Objects}
232
+ */
54
233
  export * from "./engine_networking_instantiate.js";
234
+ /** WebRTC peer-to-peer networking for direct client connections */
55
235
  export * from "./engine_networking_peer.js";
236
+ /** Media streaming utilities (audio/video) */
56
237
  export * from "./engine_networking_streams.js";
238
+ /** Networking type definitions and interfaces */
57
239
  export * from "./engine_networking_types.js";
240
+ /** Networking utility functions */
58
241
  export * from "./engine_networking_utils.js";
242
+ // ============================================================================
243
+ // PHYSICS & RAYCASTING
244
+ // Rapier-based physics simulation and raycasting.
245
+ // ============================================================================
246
+ /** Object patching utilities */
59
247
  export * from "./engine_patcher.js";
248
+ /**
249
+ * Physics system: raycasting, collision queries, physics world access.
250
+ * @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
251
+ */
60
252
  export * from "./engine_physics.js";
253
+ /** Physics type definitions: RaycastOptions, Collision, ContactPoint */
61
254
  export * from "./engine_physics.types.js";
255
+ /** Rapier physics engine integration */
62
256
  export * from "./engine_physics_rapier.js";
257
+ // ============================================================================
258
+ // PLAYER & VIEW MANAGEMENT
259
+ // Multi-player view management and scene lighting.
260
+ // ============================================================================
261
+ /** Player view management for multi-user scenarios */
63
262
  export * from "./engine_playerview.js";
263
+ /** PMREM (Prefiltered Mipmapped Radiance Environment Map) loading */
64
264
  export { loadPMREM } from "./engine_pmrem.js";
265
+ /** Scene lighting data and environment configuration */
65
266
  export * from "./engine_scenelighting.js";
267
+ // ============================================================================
268
+ // SERIALIZATION
269
+ // Component serialization for saving/loading and networking.
270
+ // ============================================================================
271
+ /**
272
+ * Serialization utilities for components and objects.
273
+ * @see {@link https://engine.needle.tools/docs/scripting.html#serialization | Serialization Documentation}
274
+ */
66
275
  export * from "./engine_serialization.js";
276
+ // ============================================================================
277
+ // UTILITIES & HELPERS
278
+ // General-purpose utility functions and helpers.
279
+ // ============================================================================
280
+ /** Testing utilities for automated tests */
67
281
  export * from "./engine_test_utils.js";
282
+ /** Texture utilities and processing */
68
283
  export * from "./engine_texture.js";
284
+ /** Three.js helper utilities: getWorldPosition, getTempVector, etc. */
69
285
  export * from "./engine_three_utils.js";
286
+ /**
287
+ * Time class: deltaTime, time, frameCount, timeScale.
288
+ * Access via this.context.time in components.
289
+ */
70
290
  export * from "./engine_time.js";
291
+ /** Time-related utility functions */
71
292
  export * from "./engine_time_utils.js";
293
+ /** Core type definitions and interfaces */
72
294
  export * from "./engine_types.js";
295
+ /** Type registration for component discovery */
73
296
  export { registerType, TypeStore } from "./engine_typestore.js";
297
+ /** Decorator utilities: @prefix, @validate */
74
298
  export { prefix, validate } from "./engine_util_decorator.js";
299
+ /** General utilities: getParam, delay, DeviceUtilities, etc. */
75
300
  export * from "./engine_utils.js";
301
+ /** Formatting utilities for strings and numbers */
76
302
  export * from "./engine_utils_format.js";
303
+ /** QR code generation utility */
77
304
  export { generateQRCode } from "./engine_utils_qrcode.js";
305
+ /** Screenshot capture utilities */
78
306
  export * from "./engine_utils_screenshot.js";
307
+ // ============================================================================
308
+ // EXTENSIONS & INTEGRATIONS
309
+ // glTF extensions and JavaScript object extensions.
310
+ // ============================================================================
311
+ /** Export utilities and formats */
79
312
  export * from "./export/index.js";
313
+ /** glTF extension implementations (NEEDLE_components, etc.) */
80
314
  export * from "./extensions/index.js";
315
+ /** JavaScript object extensions for three.js objects */
81
316
  export * from "./js-extensions/index.js";
317
+ // ============================================================================
318
+ // WEB COMPONENTS
319
+ // Custom HTML elements for embedding Needle Engine.
320
+ // ============================================================================
321
+ /** Web component API utilities */
82
322
  export * from "./webcomponents/api.js";
323
+ /**
324
+ * <needle-engine> web component for embedding 3D scenes.
325
+ * @see {@link https://engine.needle.tools/docs/html.html | HTML Integration}
326
+ */
83
327
  export * from "./webcomponents/needle-engine.js";
328
+ /** Loading screen and progress indicators */
84
329
  export * from "./webcomponents/needle-engine.loading.js";
330
+ // ============================================================================
331
+ // XR (AR/VR)
332
+ // WebXR support for augmented and virtual reality experiences.
333
+ // ============================================================================
334
+ /**
335
+ * XR API: NeedleXRSession, NeedleXRController, XRRig.
336
+ * @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
337
+ */
85
338
  export * from "./xr/api.js";
86
339
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/engine/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,cAAc,2BAA2B,CAAC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AACxD,cAAc,0BAA0B,CAAC;AAGzC,+EAA+E;AAC/E,iBAAiB;AACjB,oDAAoD;AACpD,+EAA+E;AAE/E,kCAAkC;AAClC,cAAc,wBAAwB,CAAA;AAEtC;;;GAGG;AACH,cAAc,kCAAkC,CAAC;AAEjD,6CAA6C;AAC7C,cAAc,0CAA0C,CAAC;AAGzD,+EAA+E;AAC/E,aAAa;AACb,+DAA+D;AAC/D,+EAA+E;AAE/E;;;GAGG;AACH,cAAc,aAAa,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { Object3D } from "three";
2
+ import type { Context } from "./engine_setup";
3
+ import { IComponent } from "./engine_types.js";
4
+ /** Data describing the accessible semantics for a 3D object or component. */
5
+ type AccessibilityData = {
6
+ /** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
7
+ role: string;
8
+ /** Human-readable label announced by screen readers. */
9
+ label: string;
10
+ /** When `true`, the element is hidden from the accessibility tree. */
11
+ hidden?: boolean;
12
+ /** When `true`, indicates the element's content is being updated. */
13
+ busy?: boolean;
14
+ };
15
+ /**
16
+ * Manages an accessible, screen-reader-friendly overlay for a Needle Engine {@link Context}.
17
+ *
18
+ * The manager maintains a visually-hidden DOM tree that mirrors relevant 3D scene objects
19
+ * with appropriate ARIA roles and labels. It also provides a live region so that hover
20
+ * events in the 3D scene can be announced to assistive technology without stealing focus.
21
+ *
22
+ * ## Automatic integration
23
+ * Several built-in components register accessible elements automatically:
24
+ * - {@link DragControls} — announces draggable objects and drag state
25
+ * - {@link Button} — exposes UI buttons to the accessibility tree
26
+ * - {@link Text} — exposes UI text content to screen readers
27
+ * - {@link ChangeTransformOnClick} — announces clickable transform actions
28
+ * - {@link ChangeMaterialOnClick} — announces clickable material changes
29
+ * - {@link EmphasizeOnClick} — announces clickable emphasis effects
30
+ * - {@link PlayAudioOnClick} — announces clickable audio playback
31
+ * - {@link PlayAnimationOnClick} — announces clickable animation triggers
32
+ *
33
+ * ## What this unlocks
34
+ * - Hovering over buttons and interactive objects with the cursor announces them to screen readers via an ARIA live region — no focus steal required
35
+ * - Screen readers can discover and navigate interactive 3D objects in the scene
36
+ * - Drag operations update the accessibility state (busy, label changes) in real time
37
+ * - Custom components can participate by calling {@link updateElement}, {@link focus}, and {@link hover}
38
+ *
39
+ * Access the manager via `this.context.accessibility` from any component.
40
+ */
41
+ export declare class AccessibilityManager {
42
+ private readonly context;
43
+ private static readonly _managers;
44
+ /** Returns the {@link AccessibilityManager} associated with the given context or component. */
45
+ static get(obj: Context | IComponent): AccessibilityManager | undefined;
46
+ constructor(context: Context);
47
+ private _enabled;
48
+ /** Enables or disables the accessibility overlay. When disabled, the overlay DOM is removed. */
49
+ set enabled(value: boolean);
50
+ /** Removes all tracked accessibility elements, keeping only the live region. */
51
+ clear(): void;
52
+ /** Removes the overlay from the DOM and unregisters this manager from the context. */
53
+ dispose(): void;
54
+ private readonly root;
55
+ private readonly liveRegion;
56
+ private readonly treeElements;
57
+ /**
58
+ * Creates or updates the accessible DOM element for a 3D object or component.
59
+ * @param obj - The scene object or component to represent.
60
+ * @param data - Partial accessibility data (role, label, hidden, busy) to apply.
61
+ */
62
+ updateElement<T extends Object3D | IComponent>(obj: T, data: Partial<AccessibilityData>): void;
63
+ /** Moves keyboard focus to the accessible element representing the given object. */
64
+ focus<T extends Object3D | IComponent>(obj: T): void;
65
+ /** Removes keyboard focus from the accessible element representing the given object. */
66
+ unfocus<T extends Object3D | IComponent>(obj: T): void;
67
+ /**
68
+ * Announces a hover event to screen readers via the ARIA live region.
69
+ * @param obj - The hovered object (used to look up its label if `text` is not provided).
70
+ * @param text - Optional text to announce. Falls back to the element's `aria-label`.
71
+ */
72
+ hover<T extends Object3D | IComponent>(obj: T, text?: string): void;
73
+ /** Removes the accessible DOM element for the given object and stops tracking it. */
74
+ removeElement(obj: Object3D | IComponent): void;
75
+ private set liveRegionMode(value);
76
+ }
77
+ export {};
@@ -0,0 +1,162 @@
1
+ import { isComponent } from "./engine_types.js";
2
+ /**
3
+ * Manages an accessible, screen-reader-friendly overlay for a Needle Engine {@link Context}.
4
+ *
5
+ * The manager maintains a visually-hidden DOM tree that mirrors relevant 3D scene objects
6
+ * with appropriate ARIA roles and labels. It also provides a live region so that hover
7
+ * events in the 3D scene can be announced to assistive technology without stealing focus.
8
+ *
9
+ * ## Automatic integration
10
+ * Several built-in components register accessible elements automatically:
11
+ * - {@link DragControls} — announces draggable objects and drag state
12
+ * - {@link Button} — exposes UI buttons to the accessibility tree
13
+ * - {@link Text} — exposes UI text content to screen readers
14
+ * - {@link ChangeTransformOnClick} — announces clickable transform actions
15
+ * - {@link ChangeMaterialOnClick} — announces clickable material changes
16
+ * - {@link EmphasizeOnClick} — announces clickable emphasis effects
17
+ * - {@link PlayAudioOnClick} — announces clickable audio playback
18
+ * - {@link PlayAnimationOnClick} — announces clickable animation triggers
19
+ *
20
+ * ## What this unlocks
21
+ * - Hovering over buttons and interactive objects with the cursor announces them to screen readers via an ARIA live region — no focus steal required
22
+ * - Screen readers can discover and navigate interactive 3D objects in the scene
23
+ * - Drag operations update the accessibility state (busy, label changes) in real time
24
+ * - Custom components can participate by calling {@link updateElement}, {@link focus}, and {@link hover}
25
+ *
26
+ * Access the manager via `this.context.accessibility` from any component.
27
+ */
28
+ export class AccessibilityManager {
29
+ context;
30
+ static _managers = new WeakMap();
31
+ /** Returns the {@link AccessibilityManager} associated with the given context or component. */
32
+ static get(obj) {
33
+ if (isComponent(obj)) {
34
+ return this._managers.get(obj.context);
35
+ }
36
+ else {
37
+ return this._managers.get(obj);
38
+ }
39
+ }
40
+ constructor(context) {
41
+ this.context = context;
42
+ this.root.style.cssText = `
43
+ position: absolute;
44
+ width: 1px; height: 1px;
45
+ padding: 0; margin: -1px;
46
+ overflow: hidden;
47
+ clip: rect(0, 0, 0, 0);
48
+ white-space: nowrap;
49
+ border: 0;
50
+ `;
51
+ this.root.setAttribute("role", "region");
52
+ this.root.setAttribute("aria-label", "3D Needle Engine scene");
53
+ // Live region for announcing hovered 3D elements without stealing focus
54
+ this.liveRegion.setAttribute("aria-live", "polite");
55
+ this.liveRegion.setAttribute("aria-atomic", "true");
56
+ this.liveRegion.setAttribute("role", "status");
57
+ this.root.appendChild(this.liveRegion);
58
+ this.enabled = true;
59
+ }
60
+ _enabled;
61
+ /** Enables or disables the accessibility overlay. When disabled, the overlay DOM is removed. */
62
+ set enabled(value) {
63
+ if (value === this._enabled)
64
+ return;
65
+ this._enabled = value;
66
+ if (!value) {
67
+ this.root.remove();
68
+ }
69
+ else {
70
+ AccessibilityManager._managers.set(this.context, this);
71
+ const target = this.context.domElement.shadowRoot || this.context.domElement;
72
+ target.prepend(this.root);
73
+ }
74
+ }
75
+ /** Removes all tracked accessibility elements, keeping only the live region. */
76
+ clear() {
77
+ this.root.childNodes.forEach(child => child.remove());
78
+ this.root.appendChild(this.liveRegion);
79
+ }
80
+ /** Removes the overlay from the DOM and unregisters this manager from the context. */
81
+ dispose() {
82
+ this.root.remove();
83
+ AccessibilityManager._managers.delete(this.context);
84
+ }
85
+ root = document.createElement("div");
86
+ liveRegion = document.createElement("div");
87
+ treeElements = new WeakMap();
88
+ /**
89
+ * Creates or updates the accessible DOM element for a 3D object or component.
90
+ * @param obj - The scene object or component to represent.
91
+ * @param data - Partial accessibility data (role, label, hidden, busy) to apply.
92
+ */
93
+ updateElement(obj, data) {
94
+ let el = this.treeElements.get(obj);
95
+ if (!el) {
96
+ el = document.createElement("div");
97
+ this.treeElements.set(obj, el);
98
+ this.root.appendChild(el);
99
+ let didSetRole = false;
100
+ if (typeof data === "object") {
101
+ if (data.role) {
102
+ didSetRole = true;
103
+ el.setAttribute("role", data.role);
104
+ }
105
+ if (data.label) {
106
+ el.setAttribute("aria-label", data.label);
107
+ }
108
+ if (data.hidden !== undefined) {
109
+ el.setAttribute("aria-hidden", String(data.hidden));
110
+ }
111
+ if (data.busy !== undefined) {
112
+ el.setAttribute("aria-busy", String(data.busy));
113
+ }
114
+ }
115
+ // if (didSetRole) {
116
+ // const role = el.getAttribute("role");
117
+ // if (role) {
118
+ // el.setAttribute("tabindex", "0");
119
+ // } else {
120
+ // el.removeAttribute("tabindex");
121
+ // }
122
+ // }
123
+ }
124
+ }
125
+ /** Moves keyboard focus to the accessible element representing the given object. */
126
+ focus(obj) {
127
+ const el = this.treeElements.get(obj);
128
+ if (el) {
129
+ // if (!el.hasAttribute("tabindex")) {
130
+ // el.setAttribute("tabindex", "0");
131
+ // }
132
+ el.focus();
133
+ }
134
+ }
135
+ /** Removes keyboard focus from the accessible element representing the given object. */
136
+ unfocus(obj) {
137
+ const el = this.treeElements.get(obj);
138
+ if (el) {
139
+ el.blur();
140
+ }
141
+ }
142
+ /**
143
+ * Announces a hover event to screen readers via the ARIA live region.
144
+ * @param obj - The hovered object (used to look up its label if `text` is not provided).
145
+ * @param text - Optional text to announce. Falls back to the element's `aria-label`.
146
+ */
147
+ hover(obj, text) {
148
+ const el = this.treeElements.get(obj);
149
+ // Update the live region text — screen reader announces this without stealing focus
150
+ this.liveRegion.textContent = text || el?.getAttribute("aria-label") || "";
151
+ }
152
+ /** Removes the accessible DOM element for the given object and stops tracking it. */
153
+ removeElement(obj) {
154
+ const el = this.treeElements.get(obj);
155
+ el?.remove();
156
+ this.treeElements.delete(obj);
157
+ }
158
+ set liveRegionMode(mode) {
159
+ this.liveRegion.setAttribute("aria-live", mode);
160
+ }
161
+ }
162
+ //# sourceMappingURL=engine_accessibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine_accessibility.js","sourceRoot":"","sources":["../../src/engine/engine_accessibility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgB5D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,oBAAoB;IAeR;IAbb,MAAM,CAAU,SAAS,GAA0C,IAAI,OAAO,EAAE,CAAC;IAEzF,+FAA+F;IAC/F,MAAM,CAAC,GAAG,CAAC,GAAyB;QAChC,IAAI,WAAW,CAAC,GAAG,CAAC,EAA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C;IAC/E,CAAC;IAED,qFAAqF;IACrF,aAAa,CAAC,GAA0B;QACpC,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,EAAE,EAAE,MAAM,EAAE,CAAC;QACb,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,IAAY,cAAc,CAAC,IAA4B;QACnD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC"}
@@ -2,7 +2,7 @@ import { Object3D, Scene } from "three";
2
2
  import type { ComponentInit, Constructor, ConstructorConcrete, IComponent } from "./engine_types.js";
3
3
  export declare function removeComponent<T extends IComponent>(go: Object3D, componentInstance: T): T;
4
4
  export declare function getOrAddComponent<T extends IComponent>(go: Object3D, typeName: ConstructorConcrete<T>, init?: ComponentInit<T>): T;
5
- export declare function addNewComponent<T extends IComponent>(obj: Object3D, componentInstance: T, callAwake?: boolean, register?: boolean): T;
5
+ export declare function addNewComponent<T extends IComponent>(obj: Object3D, componentInstance: T, callAwake?: boolean): T;
6
6
  export declare function addComponent<T extends IComponent>(obj: Object3D, componentInstance: T | ConstructorConcrete<T>, init?: ComponentInit<T>, opts?: {
7
7
  callAwake: boolean;
8
8
  }): T;