@needle-tools/engine 5.1.0-alpha.1 → 5.1.0-canary.30cc545
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.
- package/components.needle.json +1 -1
- package/dist/{gltf-progressive-DJBMx-zB.umd.cjs → gltf-progressive-BmblPzFj.umd.cjs} +4 -4
- package/dist/{gltf-progressive-BryRjllq.min.js → gltf-progressive-CN_mbb66.min.js} +2 -2
- package/dist/{gltf-progressive-Cl167Vjx.js → gltf-progressive-DUlhxdv4.js} +5 -2
- package/dist/{needle-engine.bundle-DzVx9Z8D.umd.cjs → needle-engine.bundle-BMlLSACE.umd.cjs} +159 -159
- package/dist/{needle-engine.bundle-CiYtOO2O.min.js → needle-engine.bundle-BXPPQRer.min.js} +157 -157
- package/dist/{needle-engine.bundle-BGyKqxBH.js → needle-engine.bundle-d_9mSxN4.js} +6730 -6585
- package/dist/needle-engine.d.ts +91 -12
- package/dist/needle-engine.js +172 -170
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-B_9sKVU7.min.js → postprocessing-B571qGWR.min.js} +34 -34
- package/dist/{postprocessing-WDc9WwI3.js → postprocessing-CfrLAbLX.js} +0 -1
- package/dist/{postprocessing-B2wb6pzI.umd.cjs → postprocessing-CiGkAeM9.umd.cjs} +17 -17
- package/dist/{vendor-CAcsI0eU.js → vendor-BFrMaK9q.js} +8983 -9136
- package/dist/vendor-CJmyOrCq.min.js +1116 -0
- package/dist/vendor-DkMW3WY4.umd.cjs +1116 -0
- package/lib/engine/api.d.ts +12 -0
- package/lib/engine/api.js +2 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug_environment.js +1 -1
- package/lib/engine/debug/debug_environment.js.map +1 -1
- package/lib/engine/engine_application.js +8 -6
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_constants.js +6 -0
- package/lib/engine/engine_constants.js.map +1 -1
- package/lib/engine/engine_context.d.ts +25 -0
- package/lib/engine/engine_context.js +27 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.js +1 -1
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_input.d.ts +3 -2
- package/lib/engine/engine_input.js +3 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_license.js +11 -9
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking_blob.d.ts +1 -1
- package/lib/engine/engine_networking_blob.js +5 -11
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +0 -1
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_pmrem.js +2 -2
- package/lib/engine/engine_pmrem.js.map +1 -1
- package/lib/engine/engine_scenedata.d.ts +36 -0
- package/lib/engine/engine_scenedata.js +111 -0
- package/lib/engine/engine_scenedata.js.map +1 -0
- package/lib/engine/engine_ssr.d.ts +16 -0
- package/lib/engine/engine_ssr.js +38 -0
- package/lib/engine/engine_ssr.js.map +1 -0
- package/lib/engine/engine_three_utils.d.ts +14 -7
- package/lib/engine/engine_three_utils.js +14 -7
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_utils.js +2 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_hash.d.ts +9 -0
- package/lib/engine/engine_utils_hash.js +112 -0
- package/lib/engine/engine_utils_hash.js.map +1 -0
- package/lib/engine/webcomponents/logo-element.d.ts +2 -1
- package/lib/engine/webcomponents/logo-element.js +2 -1
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +2 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +2 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +2 -1
- package/lib/engine/webcomponents/needle-button.js +2 -1
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +2 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -1
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +1 -1
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/RigidBody.js +3 -3
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +2 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +1 -2
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +5 -6
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +0 -1
- package/lib/engine-components/web/ScrollFollow.js +3 -2
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/package.json +6 -5
- package/plugins/dts-generator/dts.codegen.js +129 -0
- package/plugins/dts-generator/dts.scan.js +71 -0
- package/plugins/dts-generator/dts.writer.js +59 -0
- package/plugins/dts-generator/glb.discovery.js +162 -0
- package/plugins/dts-generator/glb.extractor.js +175 -0
- package/plugins/dts-generator/glb.reader.js +114 -0
- package/plugins/dts-generator/index.js +36 -0
- package/plugins/dts-generator/manifest.types.js +174 -0
- package/plugins/types/index.d.ts +2 -1
- package/plugins/types/needle-bindings.d.ts +19 -0
- package/plugins/types/userconfig.d.ts +9 -2
- package/plugins/vite/dts-generator.d.ts +7 -0
- package/plugins/vite/dts-generator.js +157 -0
- package/plugins/vite/index.d.ts +1 -0
- package/plugins/vite/index.js +4 -0
- package/plugins/vite/logging.js +2 -2
- package/plugins/vite/reload.js +2 -1
- package/src/engine/api.ts +15 -1
- package/src/engine/debug/debug_environment.ts +1 -1
- package/src/engine/engine_application.ts +8 -6
- package/src/engine/engine_constants.ts +11 -6
- package/src/engine/engine_context.ts +29 -0
- package/src/engine/engine_context_registry.ts +1 -1
- package/src/engine/engine_input.ts +3 -2
- package/src/engine/engine_license.ts +11 -9
- package/src/engine/engine_networking_blob.ts +5 -11
- package/src/engine/engine_physics_rapier.ts +0 -3
- package/src/engine/engine_pmrem.ts +3 -3
- package/src/engine/engine_scenedata.ts +110 -0
- package/src/engine/engine_ssr.ts +45 -0
- package/src/engine/engine_three_utils.ts +15 -7
- package/src/engine/engine_utils.ts +1 -0
- package/src/engine/engine_utils_hash.ts +65 -0
- package/src/engine/webcomponents/logo-element.ts +2 -1
- package/src/engine/webcomponents/needle menu/needle-menu.ts +2 -1
- package/src/engine/webcomponents/needle-button.ts +2 -1
- package/src/engine/webcomponents/needle-engine.ts +2 -1
- package/src/engine/xr/NeedleXRSession.ts +1 -1
- package/src/engine-components/RigidBody.ts +3 -3
- package/src/engine-components/SceneSwitcher.ts +1 -0
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +1 -2
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +4 -8
- package/src/engine-components/web/ScrollFollow.ts +2 -2
- package/src/vite-env.d.ts +16 -0
- package/dist/vendor-CEM38hLE.umd.cjs +0 -1116
- package/dist/vendor-HRlxIBga.min.js +0 -1116
package/dist/needle-engine.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ import { RawShaderMaterial } from 'three';
|
|
|
84
84
|
import { Ray } from 'three';
|
|
85
85
|
import { Raycaster } from 'three';
|
|
86
86
|
import { Scene } from 'three';
|
|
87
|
+
import { SceneData } from '../../plugins/types/needle-bindings.d.ts';
|
|
87
88
|
import { ShaderMaterial } from 'three';
|
|
88
89
|
import { ShapeJSON } from 'three.quarks';
|
|
89
90
|
import { SkinnedMesh } from 'three';
|
|
@@ -2192,7 +2193,7 @@ export declare namespace BlobStorage {
|
|
|
2192
2193
|
/**
|
|
2193
2194
|
* Generates an md5 hash from a given buffer
|
|
2194
2195
|
* @param buffer The buffer to hash
|
|
2195
|
-
* @returns The md5 hash
|
|
2196
|
+
* @returns The md5 hash as a hex string
|
|
2196
2197
|
*/
|
|
2197
2198
|
export function hashMD5(buffer: ArrayBuffer): string;
|
|
2198
2199
|
export function hashMD5_Base64(buffer: ArrayBuffer): string;
|
|
@@ -4458,6 +4459,30 @@ export declare class Context implements IContext {
|
|
|
4458
4459
|
* The main camera of the scene - this camera is used for rendering
|
|
4459
4460
|
* Use `setCurrentCamera` for updating the main camera.
|
|
4460
4461
|
*/
|
|
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.
|
|
4466
|
+
*
|
|
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)`.
|
|
4470
|
+
*
|
|
4471
|
+
* @example
|
|
4472
|
+
* // Toggle auto-rotate on the orbit camera
|
|
4473
|
+
* ctx.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
4474
|
+
*
|
|
4475
|
+
* @example
|
|
4476
|
+
* // Change the background color
|
|
4477
|
+
* 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
|
+
*/
|
|
4485
|
+
get sceneData(): SceneData;
|
|
4461
4486
|
get mainCamera(): Camera_2;
|
|
4462
4487
|
/** Set the main camera of the scene. If set to null the camera of the {@link mainCameraComponent} will be used - this camera is used for rendering */
|
|
4463
4488
|
set mainCamera(cam: Camera_2 | null);
|
|
@@ -7130,6 +7155,23 @@ export declare function getPeerOptions(): PeerJSOption | undefined;
|
|
|
7130
7155
|
|
|
7131
7156
|
export declare function getResourceUserCount(object: object): number | undefined;
|
|
7132
7157
|
|
|
7158
|
+
/**
|
|
7159
|
+
* Returns a lazily-resolved proxy typed as {@link SceneData}.
|
|
7160
|
+
* The proxy is cached per context — each context gets exactly one instance.
|
|
7161
|
+
*
|
|
7162
|
+
* Accessing a property traverses the scene graph on demand:
|
|
7163
|
+
* - First level → find Object3D by node name
|
|
7164
|
+
* - Second level → getComponent by component name (via TypeStore)
|
|
7165
|
+
* - Third level → read/write a field on the real component instance
|
|
7166
|
+
*
|
|
7167
|
+
* If a node or component is not found, property accesses log a warning
|
|
7168
|
+
* instead of throwing, so chained access never crashes.
|
|
7169
|
+
*
|
|
7170
|
+
* @example
|
|
7171
|
+
* ctx.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
7172
|
+
*/
|
|
7173
|
+
export declare function getSceneData(ctx: IContext): SceneData;
|
|
7174
|
+
|
|
7133
7175
|
export declare function getTempColor(color?: Color): Color;
|
|
7134
7176
|
|
|
7135
7177
|
/**
|
|
@@ -7460,13 +7502,20 @@ export declare class GraphicRaycaster extends ObjectRaycaster {
|
|
|
7460
7502
|
* Utility class to perform various graphics operations like copying textures to canvas
|
|
7461
7503
|
*/
|
|
7462
7504
|
export declare class Graphics {
|
|
7463
|
-
private static
|
|
7464
|
-
private static
|
|
7465
|
-
private static
|
|
7466
|
-
private static
|
|
7467
|
-
private static
|
|
7468
|
-
private static
|
|
7469
|
-
private static
|
|
7505
|
+
private static _planeGeometry;
|
|
7506
|
+
private static _renderer;
|
|
7507
|
+
private static _perspectiveCam;
|
|
7508
|
+
private static _orthographicCam;
|
|
7509
|
+
private static _scene;
|
|
7510
|
+
private static _blitMaterial;
|
|
7511
|
+
private static _mesh;
|
|
7512
|
+
private static get planeGeometry();
|
|
7513
|
+
private static get renderer();
|
|
7514
|
+
private static get perspectiveCam();
|
|
7515
|
+
private static get orthographicCam();
|
|
7516
|
+
private static get scene();
|
|
7517
|
+
private static get blitMaterial();
|
|
7518
|
+
private static get mesh();
|
|
7470
7519
|
/**
|
|
7471
7520
|
* Copy a texture to a new texture
|
|
7472
7521
|
* @param texture the texture to copy
|
|
@@ -7930,6 +7979,9 @@ export declare class HoverAnimation extends Component {
|
|
|
7930
7979
|
private playHover;
|
|
7931
7980
|
}
|
|
7932
7981
|
|
|
7982
|
+
/** SSR-safe base class for web components. */
|
|
7983
|
+
declare const HTMLElementBase: typeof HTMLElement;
|
|
7984
|
+
|
|
7933
7985
|
export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
|
|
7934
7986
|
isAnimationComponent: boolean;
|
|
7935
7987
|
addClip?(clip: AnimationClip): any;
|
|
@@ -9699,6 +9751,9 @@ declare const enum KeyboardEnumType {
|
|
|
9699
9751
|
KeyPressed = "keypress"
|
|
9700
9752
|
}
|
|
9701
9753
|
|
|
9754
|
+
/** SSR-safe base class for keyboard events. */
|
|
9755
|
+
declare const KeyboardEventBase: typeof KeyboardEvent;
|
|
9756
|
+
|
|
9702
9757
|
declare type KeyboardEventListener = (evt: NEKeyboardEvent) => void;
|
|
9703
9758
|
|
|
9704
9759
|
declare type KeyboardEventNames = EnumToPrimitiveUnion<KeyboardEnumType>;
|
|
@@ -10972,6 +11027,25 @@ export declare type MouseButtonName = "left" | "right" | "middle";
|
|
|
10972
11027
|
|
|
10973
11028
|
/* Excluded from this release type: nameofFactory */
|
|
10974
11029
|
|
|
11030
|
+
/**
|
|
11031
|
+
* Global proxy for the primary Needle Engine context.
|
|
11032
|
+
* Resolves lazily on property access via `ContextRegistry.Current` —
|
|
11033
|
+
* safe to import at module level, including in SSR environments
|
|
11034
|
+
* (returns a silent error proxy when no context is active).
|
|
11035
|
+
*
|
|
11036
|
+
* Use this outside of Needle component lifecycle (e.g. in Svelte/React/Vue
|
|
11037
|
+
* components, button handlers, or vanilla JS) instead of threading `ctx` around.
|
|
11038
|
+
*
|
|
11039
|
+
* For multiple `<needle-engine>` elements on the same page, use `ctx` directly.
|
|
11040
|
+
*
|
|
11041
|
+
* @example
|
|
11042
|
+
* import { needle } from "@needle-tools/engine";
|
|
11043
|
+
* button.onclick = () => {
|
|
11044
|
+
* needle.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
11045
|
+
* };
|
|
11046
|
+
*/
|
|
11047
|
+
export declare const needle: IContext;
|
|
11048
|
+
|
|
10975
11049
|
declare class NEEDLE_components implements GLTFLoaderPlugin {
|
|
10976
11050
|
get name(): string;
|
|
10977
11051
|
exportContext: {
|
|
@@ -11105,7 +11179,7 @@ export { NEEDLE_progressive }
|
|
|
11105
11179
|
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
11106
11180
|
* @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
|
|
11107
11181
|
*/
|
|
11108
|
-
export declare class NeedleButtonElement extends
|
|
11182
|
+
export declare class NeedleButtonElement extends HTMLElementBase {
|
|
11109
11183
|
#private;
|
|
11110
11184
|
static observedAttributes: string[];
|
|
11111
11185
|
constructor();
|
|
@@ -11245,7 +11319,7 @@ export declare namespace NeedleEngineModelLoader {
|
|
|
11245
11319
|
* @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via <needle-button>
|
|
11246
11320
|
* @see {@link NeedleMenu} for the built-in menu configuration component
|
|
11247
11321
|
*/
|
|
11248
|
-
export declare class NeedleEngineWebComponent extends
|
|
11322
|
+
export declare class NeedleEngineWebComponent extends HTMLElementBase implements INeedleEngineComponent {
|
|
11249
11323
|
static get observedAttributes(): string[];
|
|
11250
11324
|
get loadingProgress01(): number;
|
|
11251
11325
|
get loadingFinished(): boolean;
|
|
@@ -12218,7 +12292,7 @@ export declare class NeedleXRUtils {
|
|
|
12218
12292
|
}): void;
|
|
12219
12293
|
}
|
|
12220
12294
|
|
|
12221
|
-
export declare class NEKeyboardEvent extends
|
|
12295
|
+
export declare class NEKeyboardEvent extends KeyboardEventBase {
|
|
12222
12296
|
source?: Event;
|
|
12223
12297
|
constructor(type: InputEvents, source: Event, init: KeyboardEventInit);
|
|
12224
12298
|
stopImmediatePropagation(): void;
|
|
@@ -12242,7 +12316,7 @@ export declare class NEKeyboardEvent extends KeyboardEvent {
|
|
|
12242
12316
|
* @see {@link Input} for the input management system
|
|
12243
12317
|
* @see {@link PointerType} for available pointer types
|
|
12244
12318
|
*/
|
|
12245
|
-
export declare class NEPointerEvent extends
|
|
12319
|
+
export declare class NEPointerEvent extends PointerEventBase {
|
|
12246
12320
|
/**
|
|
12247
12321
|
* Spatial input data
|
|
12248
12322
|
*/
|
|
@@ -15074,6 +15148,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15074
15148
|
PointerMove = "pointermove"
|
|
15075
15149
|
}
|
|
15076
15150
|
|
|
15151
|
+
/** SSR-safe base class for pointer events. */
|
|
15152
|
+
declare const PointerEventBase: typeof PointerEvent;
|
|
15153
|
+
|
|
15077
15154
|
/** [PointerEventData](https://engine.needle.tools/docs/api/PointerEventData) This pointer event data object is passed to all event receivers that are currently active
|
|
15078
15155
|
* It contains hit information if an object was hovered or clicked
|
|
15079
15156
|
* If the event is received in onPointerDown or onPointerMove, you can call `setPointerCapture` to receive onPointerMove events even when the pointer has left the object until you call `releasePointerCapture` or when the pointerUp event happens
|
|
@@ -16961,6 +17038,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16961
17038
|
*/
|
|
16962
17039
|
declare type ScaleClipType = "linear" | "spring";
|
|
16963
17040
|
|
|
17041
|
+
export { SceneData }
|
|
17042
|
+
|
|
16964
17043
|
export declare class SceneLightSettings extends Component {
|
|
16965
17044
|
ambientMode: AmbientMode;
|
|
16966
17045
|
ambientLight?: Color;
|