@relu-interactives/spatial-ecs 0.2.20 → 0.2.22
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/dist/{System-BjwOBx81.d.cts → System-CYWZ_Zx5.d.cts} +9 -4
- package/dist/{System-BjwOBx81.d.ts → System-CYWZ_Zx5.d.ts} +9 -4
- package/dist/{Video-B8yVI1tF.d.cts → Video-C1IOat7L.d.ts} +38 -9
- package/dist/{Video-B9z5AtIf.d.ts → Video-ppAXaKt0.d.cts} +38 -9
- package/dist/{chunk-HUHN6IFD.js → chunk-52CHDPRQ.js} +118 -92
- package/dist/chunk-52CHDPRQ.js.map +1 -0
- package/dist/{chunk-67MFQDHX.js → chunk-GZ2NKSMV.js} +609 -90
- package/dist/chunk-GZ2NKSMV.js.map +1 -0
- package/dist/{chunk-Z6OMYEXU.js → chunk-JHCPRVBC.js} +34 -5
- package/dist/chunk-JHCPRVBC.js.map +1 -0
- package/dist/{chunk-DY4ETMP2.js → chunk-WKGCC7YL.js} +3 -3
- package/dist/{chunk-DY4ETMP2.js.map → chunk-WKGCC7YL.js.map} +1 -1
- package/dist/components/index.cjs +31 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/authoring-a-behaviour.md +3 -40
- package/dist/docs/guide/authoring-a-script-object.md +102 -0
- package/dist/docs/guide/behaviour-lifecycle.md +4 -4
- package/dist/docs/guide/prefabs.md +24 -5
- package/dist/docs/guide/spawning/script-object.md +36 -0
- package/dist/docs/guide/systems/_sidebar.json +4 -0
- package/dist/docs/guide/systems/script-behaviour-system.md +1 -17
- package/dist/docs/guide/systems/script-object-system.md +44 -0
- package/dist/factories/index.cjs +164 -117
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +5 -3
- package/dist/factories/index.d.ts +5 -3
- package/dist/factories/index.js +3 -3
- package/dist/{index-LHLKpJhZ.d.cts → index-Cu2Pt7wN.d.cts} +33 -14
- package/dist/{index-BBI2YdCu.d.ts → index-DdiWu1b6.d.ts} +33 -14
- package/dist/index.cjs +1132 -302
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +219 -32
- package/dist/index.d.ts +219 -32
- package/dist/index.js +254 -11
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs +429 -43
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +44 -3
- package/dist/systems/index.d.ts +44 -3
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-67MFQDHX.js.map +0 -1
- package/dist/chunk-HUHN6IFD.js.map +0 -1
- package/dist/chunk-Z6OMYEXU.js.map +0 -1
|
@@ -333,7 +333,7 @@ type EntityId = number;
|
|
|
333
333
|
* maps to an object factory in `core/factories/objects/*` that creates the
|
|
334
334
|
* baseline component set.
|
|
335
335
|
*/
|
|
336
|
-
type EcsEntityKind = "cube" | "sphere" | "plane" | "capsule" | "cylinder" | "empty" | "model" | "image" | "imageTarget" | "sprite" | "audio" | "camera" | "video" | "ambientLight" | "directionalLight" | "pointLight" | "spotLight" | "areaLight" | "instancedMesh" | "instanceSlot";
|
|
336
|
+
type EcsEntityKind = "cube" | "sphere" | "plane" | "capsule" | "cylinder" | "empty" | "model" | "image" | "imageTarget" | "sprite" | "audio" | "camera" | "video" | "ambientLight" | "directionalLight" | "pointLight" | "spotLight" | "areaLight" | "instancedMesh" | "instanceSlot" | "scriptObject";
|
|
337
337
|
/** {@link EcsEntityKind} extended with editor-only utility entities (gizmos, helpers). */
|
|
338
338
|
type EcsEntityEditorKind = EcsEntityKind | "editorUtility";
|
|
339
339
|
/** Callback invoked when the selected entity changes. `null` indicates a deselection. */
|
|
@@ -377,7 +377,7 @@ type EntityInput = {
|
|
|
377
377
|
type: "entity";
|
|
378
378
|
value: EntityId | null;
|
|
379
379
|
};
|
|
380
|
-
type ComponentKind = "Animation" | "Audio" | "Camera" | "Environment" | "EntityType" | "Image" | "ImageTarget" | "ImageTargetAnchor" | "InstancedMesh" | "InstanceSlot" | "Light" | "Material" | "Mesh" | "MeshGeometry" | "Model" | "Name" | "Object3DRef" | "ParentId" | "Physics" | "Postprocessing" | "Script" | "Selectable" | "SelectionTransformState" | "Sprite" | "Transform" | "Video";
|
|
380
|
+
type ComponentKind = "Animation" | "Audio" | "Camera" | "Environment" | "EntityType" | "Image" | "ImageTarget" | "ImageTargetAnchor" | "InstancedMesh" | "InstanceSlot" | "Light" | "Material" | "Mesh" | "MeshGeometry" | "Model" | "Name" | "Object3DRef" | "ParentId" | "Physics" | "Postprocessing" | "Script" | "ScriptObject" | "Selectable" | "SelectionTransformState" | "Sprite" | "Transform" | "Video";
|
|
381
381
|
/**
|
|
382
382
|
* Inspector field that lets the user drag an entity and optionally pick a
|
|
383
383
|
* component from it.
|
|
@@ -476,6 +476,7 @@ declare function cloneHistoryValue<T>(value: T, seen?: WeakMap<object, unknown>)
|
|
|
476
476
|
* - `ParentId.value`
|
|
477
477
|
* - `ScriptComponent.entries[].data` EntityInput (`{type:"entity", value}`)
|
|
478
478
|
* and ComponentInput (`{type:"component", value:{entityId, …}}`)
|
|
479
|
+
* - `ScriptObjectComponent.data` EntityInput/ComponentInput (same shapes)
|
|
479
480
|
* - `InstancedMeshComponent.instanceEntityIds[]`
|
|
480
481
|
* - `InstanceSlotComponent.groupEntityId`
|
|
481
482
|
*
|
|
@@ -523,6 +524,10 @@ declare function remapSnapshotEntityIds(snapshot: SubtreeSnapshot, idMap: Map<nu
|
|
|
523
524
|
};
|
|
524
525
|
|
|
525
526
|
declare const PREFAB_FILE_VERSION = 1;
|
|
527
|
+
/** Written for files containing NESTED instances (parse accepts either). */
|
|
528
|
+
declare const PREFAB_FILE_VERSION_NESTED = 2;
|
|
529
|
+
/** File version to write for a given snapshot: 2 iff it nests instances. */
|
|
530
|
+
declare function prefabFileVersionFor(snapshot: SubtreeSnapshot): number;
|
|
526
531
|
/**
|
|
527
532
|
* Envelope of a `.prefab` asset file (and, later, `.scene` assets — same
|
|
528
533
|
* shape with `type: "scene"`). `snapshot` is the same columnar world-snapshot
|
|
@@ -607,7 +612,7 @@ type CreateContext = {
|
|
|
607
612
|
isEditor?: boolean;
|
|
608
613
|
};
|
|
609
614
|
type EntityFactory = (context: CreateContext) => EntityId;
|
|
610
|
-
type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh";
|
|
615
|
+
type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh";
|
|
611
616
|
type ComponentFactory = (world: World, entityId: EntityId, ...args: any[]) => unknown;
|
|
612
617
|
declare class ObjectManagementSystem implements EcsSystem {
|
|
613
618
|
private readonly scene;
|
|
@@ -1114,4 +1119,4 @@ interface EcsSystem {
|
|
|
1114
1119
|
dispose?(world: World): void;
|
|
1115
1120
|
}
|
|
1116
1121
|
|
|
1117
|
-
export {
|
|
1122
|
+
export { type ToggleInput as $, type AssetInput as A, type EcsComponentFactoryKind as B, Component as C, DEFAULT_ENVIRONMENT_STATE as D, Environment as E, type EcsEntityEditorKind as F, type EntityInput as G, type FloatInput as H, InputSystem as I, type IntersectionResult as J, type KeyboardKey as K, KeyboardKeys as L, type MouseButton as M, PREFAB_FILE_VERSION as N, ObjectManagementSystem as O, ParentId as P, PREFAB_FILE_VERSION_NESTED as Q, type PrefabAsset as R, type SpawnPrefabSource as S, TransformComponent as T, type RemapSnapshotOptions as U, type Vec3$1 as V, type WorldEntityView$1 as W, RenderSystem as X, type SelectionListener as Y, type SliderInput as Z, type TextInput as _, DEFAULT_POSTPROCESSING_STATE as a, TransformSyncSystem as a0, type Vec3 as a1, type Vector2Input as a2, type Vector3Input as a3, clearPrefabCache as a4, despawnPrefab as a5, loadPrefab as a6, parsePrefabAsset as a7, prefabFileVersionFor as a8, remapSnapshotEntityIds as a9, setPrefabAssetUrlResolver as aa, spawnPrefab as ab, type AnyComponent as ac, DEBUG_CHANGE_IGNORED_SYSTEMS as ad, type WorldHistorySnapshot as ae, cloneHistoryValue as af, normalizeDebugValue as ag, type EnvironmentFogState as b, type EnvironmentFogType as c, type EnvironmentGradientEffect as d, type EnvironmentSkyboxState as e, type EnvironmentSkyboxType as f, type EnvironmentState as g, Postprocessing as h, type PostprocessingState as i, type TransformData as j, type EcsSystem as k, World as l, type SpawnPrefabOptions as m, type ComponentClass as n, type ParentLookup as o, type EcsEntityKind as p, type SubtreeSnapshot as q, type EntityId as r, type ExternalRefWarning as s, type CheckboxInput as t, type ColorInput as u, type ComponentFactory as v, type ComponentInput as w, type ComponentKind as x, type DropdownInput as y, type DropdownOption as z };
|
|
@@ -333,7 +333,7 @@ type EntityId = number;
|
|
|
333
333
|
* maps to an object factory in `core/factories/objects/*` that creates the
|
|
334
334
|
* baseline component set.
|
|
335
335
|
*/
|
|
336
|
-
type EcsEntityKind = "cube" | "sphere" | "plane" | "capsule" | "cylinder" | "empty" | "model" | "image" | "imageTarget" | "sprite" | "audio" | "camera" | "video" | "ambientLight" | "directionalLight" | "pointLight" | "spotLight" | "areaLight" | "instancedMesh" | "instanceSlot";
|
|
336
|
+
type EcsEntityKind = "cube" | "sphere" | "plane" | "capsule" | "cylinder" | "empty" | "model" | "image" | "imageTarget" | "sprite" | "audio" | "camera" | "video" | "ambientLight" | "directionalLight" | "pointLight" | "spotLight" | "areaLight" | "instancedMesh" | "instanceSlot" | "scriptObject";
|
|
337
337
|
/** {@link EcsEntityKind} extended with editor-only utility entities (gizmos, helpers). */
|
|
338
338
|
type EcsEntityEditorKind = EcsEntityKind | "editorUtility";
|
|
339
339
|
/** Callback invoked when the selected entity changes. `null` indicates a deselection. */
|
|
@@ -377,7 +377,7 @@ type EntityInput = {
|
|
|
377
377
|
type: "entity";
|
|
378
378
|
value: EntityId | null;
|
|
379
379
|
};
|
|
380
|
-
type ComponentKind = "Animation" | "Audio" | "Camera" | "Environment" | "EntityType" | "Image" | "ImageTarget" | "ImageTargetAnchor" | "InstancedMesh" | "InstanceSlot" | "Light" | "Material" | "Mesh" | "MeshGeometry" | "Model" | "Name" | "Object3DRef" | "ParentId" | "Physics" | "Postprocessing" | "Script" | "Selectable" | "SelectionTransformState" | "Sprite" | "Transform" | "Video";
|
|
380
|
+
type ComponentKind = "Animation" | "Audio" | "Camera" | "Environment" | "EntityType" | "Image" | "ImageTarget" | "ImageTargetAnchor" | "InstancedMesh" | "InstanceSlot" | "Light" | "Material" | "Mesh" | "MeshGeometry" | "Model" | "Name" | "Object3DRef" | "ParentId" | "Physics" | "Postprocessing" | "Script" | "ScriptObject" | "Selectable" | "SelectionTransformState" | "Sprite" | "Transform" | "Video";
|
|
381
381
|
/**
|
|
382
382
|
* Inspector field that lets the user drag an entity and optionally pick a
|
|
383
383
|
* component from it.
|
|
@@ -476,6 +476,7 @@ declare function cloneHistoryValue<T>(value: T, seen?: WeakMap<object, unknown>)
|
|
|
476
476
|
* - `ParentId.value`
|
|
477
477
|
* - `ScriptComponent.entries[].data` EntityInput (`{type:"entity", value}`)
|
|
478
478
|
* and ComponentInput (`{type:"component", value:{entityId, …}}`)
|
|
479
|
+
* - `ScriptObjectComponent.data` EntityInput/ComponentInput (same shapes)
|
|
479
480
|
* - `InstancedMeshComponent.instanceEntityIds[]`
|
|
480
481
|
* - `InstanceSlotComponent.groupEntityId`
|
|
481
482
|
*
|
|
@@ -523,6 +524,10 @@ declare function remapSnapshotEntityIds(snapshot: SubtreeSnapshot, idMap: Map<nu
|
|
|
523
524
|
};
|
|
524
525
|
|
|
525
526
|
declare const PREFAB_FILE_VERSION = 1;
|
|
527
|
+
/** Written for files containing NESTED instances (parse accepts either). */
|
|
528
|
+
declare const PREFAB_FILE_VERSION_NESTED = 2;
|
|
529
|
+
/** File version to write for a given snapshot: 2 iff it nests instances. */
|
|
530
|
+
declare function prefabFileVersionFor(snapshot: SubtreeSnapshot): number;
|
|
526
531
|
/**
|
|
527
532
|
* Envelope of a `.prefab` asset file (and, later, `.scene` assets — same
|
|
528
533
|
* shape with `type: "scene"`). `snapshot` is the same columnar world-snapshot
|
|
@@ -607,7 +612,7 @@ type CreateContext = {
|
|
|
607
612
|
isEditor?: boolean;
|
|
608
613
|
};
|
|
609
614
|
type EntityFactory = (context: CreateContext) => EntityId;
|
|
610
|
-
type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh";
|
|
615
|
+
type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "scriptObject" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video" | "instancedMesh";
|
|
611
616
|
type ComponentFactory = (world: World, entityId: EntityId, ...args: any[]) => unknown;
|
|
612
617
|
declare class ObjectManagementSystem implements EcsSystem {
|
|
613
618
|
private readonly scene;
|
|
@@ -1114,4 +1119,4 @@ interface EcsSystem {
|
|
|
1114
1119
|
dispose?(world: World): void;
|
|
1115
1120
|
}
|
|
1116
1121
|
|
|
1117
|
-
export {
|
|
1122
|
+
export { type ToggleInput as $, type AssetInput as A, type EcsComponentFactoryKind as B, Component as C, DEFAULT_ENVIRONMENT_STATE as D, Environment as E, type EcsEntityEditorKind as F, type EntityInput as G, type FloatInput as H, InputSystem as I, type IntersectionResult as J, type KeyboardKey as K, KeyboardKeys as L, type MouseButton as M, PREFAB_FILE_VERSION as N, ObjectManagementSystem as O, ParentId as P, PREFAB_FILE_VERSION_NESTED as Q, type PrefabAsset as R, type SpawnPrefabSource as S, TransformComponent as T, type RemapSnapshotOptions as U, type Vec3$1 as V, type WorldEntityView$1 as W, RenderSystem as X, type SelectionListener as Y, type SliderInput as Z, type TextInput as _, DEFAULT_POSTPROCESSING_STATE as a, TransformSyncSystem as a0, type Vec3 as a1, type Vector2Input as a2, type Vector3Input as a3, clearPrefabCache as a4, despawnPrefab as a5, loadPrefab as a6, parsePrefabAsset as a7, prefabFileVersionFor as a8, remapSnapshotEntityIds as a9, setPrefabAssetUrlResolver as aa, spawnPrefab as ab, type AnyComponent as ac, DEBUG_CHANGE_IGNORED_SYSTEMS as ad, type WorldHistorySnapshot as ae, cloneHistoryValue as af, normalizeDebugValue as ag, type EnvironmentFogState as b, type EnvironmentFogType as c, type EnvironmentGradientEffect as d, type EnvironmentSkyboxState as e, type EnvironmentSkyboxType as f, type EnvironmentState as g, Postprocessing as h, type PostprocessingState as i, type TransformData as j, type EcsSystem as k, World as l, type SpawnPrefabOptions as m, type ComponentClass as n, type ParentLookup as o, type EcsEntityKind as p, type SubtreeSnapshot as q, type EntityId as r, type ExternalRefWarning as s, type CheckboxInput as t, type ColorInput as u, type ComponentFactory as v, type ComponentInput as w, type ComponentKind as x, type DropdownInput as y, type DropdownOption as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind,
|
|
2
|
+
import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-CYWZ_Zx5.js';
|
|
3
3
|
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
4
4
|
|
|
5
5
|
interface StateMachine {
|
|
@@ -939,13 +939,6 @@ type ScriptEntry = {
|
|
|
939
939
|
scriptUrl: string;
|
|
940
940
|
/** When `false`, the script is skipped each frame. */
|
|
941
941
|
enabled: boolean;
|
|
942
|
-
/**
|
|
943
|
-
* When `true`, the script is executed inside the editor (not just at preview/runtime).
|
|
944
|
-
* Enables direct Three.js scene access via `this.world.getScene()` / `getCamera()` /
|
|
945
|
-
* `getRenderer()` for logic the editor's object palette cannot produce (custom shaders,
|
|
946
|
-
* procedural geometry, grass, etc.). Defaults to `false`.
|
|
947
|
-
*/
|
|
948
|
-
executeInEditor?: boolean;
|
|
949
942
|
/** Inspector-bound payload exposed to the script as `this.data`. */
|
|
950
943
|
data: Record<string, unknown>;
|
|
951
944
|
/** Last load/runtime status reported by `ScriptBehaviourSystem`. */
|
|
@@ -974,6 +967,42 @@ declare class ScriptComponent extends Component {
|
|
|
974
967
|
constructor(entries?: ScriptEntry[]);
|
|
975
968
|
}
|
|
976
969
|
|
|
970
|
+
type ScriptObjectRuntimeState = "idle" | "loading" | "ready" | "error";
|
|
971
|
+
type ScriptObjectComponentInput = Partial<{
|
|
972
|
+
/** Compiled script URL (e.g. `localasset://.../scripts/foo.js`). */
|
|
973
|
+
scriptUrl: string | null;
|
|
974
|
+
/** Class name exported by the script module. */
|
|
975
|
+
className: string | null;
|
|
976
|
+
/** When `false`, the script object is not built/ticked. */
|
|
977
|
+
enabled: boolean;
|
|
978
|
+
/** Inspector-bound payload exposed to the script as `this.data`. */
|
|
979
|
+
data: Record<string, unknown>;
|
|
980
|
+
/** Last load/build status reported by `ScriptObjectSystem`. */
|
|
981
|
+
runtimeState: ScriptObjectRuntimeState;
|
|
982
|
+
/** Optional human-readable status message (e.g. compile/build error). */
|
|
983
|
+
runtimeMessage: string;
|
|
984
|
+
}>;
|
|
985
|
+
/**
|
|
986
|
+
* Component for a **script object** — a single {@link ScriptObject} whose
|
|
987
|
+
* THREE.js visual is built by user code and runs in the editor AND at runtime.
|
|
988
|
+
* Unlike {@link ScriptComponent} this holds ONE script (not an entries array).
|
|
989
|
+
* The live instance ref is non-enumerable so it never leaks into save data or
|
|
990
|
+
* undo history.
|
|
991
|
+
*
|
|
992
|
+
* @category Components
|
|
993
|
+
*/
|
|
994
|
+
declare class ScriptObjectComponent extends Component {
|
|
995
|
+
scriptUrl: string | null;
|
|
996
|
+
className: string | null;
|
|
997
|
+
enabled: boolean;
|
|
998
|
+
data: Record<string, unknown>;
|
|
999
|
+
runtimeState: ScriptObjectRuntimeState;
|
|
1000
|
+
runtimeMessage?: string;
|
|
1001
|
+
/** Live ScriptObject instance. Non-enumerable — never enters snapshots/history. */
|
|
1002
|
+
instance: unknown | null;
|
|
1003
|
+
constructor(input?: ScriptObjectComponentInput);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
977
1006
|
/**
|
|
978
1007
|
* Toggles whether the editor selection system can pick this entity. When
|
|
979
1008
|
* `enabled` is `false`, the entity is excluded from raycast hit tests.
|
|
@@ -1127,4 +1156,4 @@ declare class VideoComponent extends Component {
|
|
|
1127
1156
|
stop(): void;
|
|
1128
1157
|
}
|
|
1129
1158
|
|
|
1130
|
-
export {
|
|
1159
|
+
export { SpriteComponent as $, AnimationComponent as A, MeshGeometryComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type MeshGeometryParameters as F, type MeshGeometryParametersByKind as G, ModelComponent as H, ImageComponent as I, type PhysicsState as J, type PlaneMeshParameters as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type RadiusMeshParameters as Q, type RadiusHeightMeshParameters as R, type RigidbodyState as S, type RigidbodyType as T, ScriptComponent as U, type ScriptEntry as V, ScriptObjectComponent as W, type ScriptObjectComponentInput as X, type ScriptObjectRuntimeState as Y, Selectable as Z, SelectionTransformState as _, type AnimationComponentOptions as a, type TextureFilteringValue as a0, type TransformModeValue as a1, type TransformSpaceValue as a2, VideoComponent as a3, defaultMaterialValue as a4, normalizePhysicsState as a5, type AnimationStateCallbacks as a6, AnimationStateMachine as a7, AnimationStateManager as a8, type StateMachine as a9, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_RIGIDBODY_STATE as m, EntityType as n, ImageTarget as o, ImageTargetAnchor as p, type ImageTargetAnchorOptions as q, type ImageTargetReference as r, InstanceSlotComponent as s, type InstanceTransform as t, InstancedMeshComponent as u, type InstancedMeshKind as v, type LightValueState as w, type MaterialTypeValue as x, type MaterialValueState as y, MeshComponent as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind,
|
|
2
|
+
import { C as Component, p as EcsEntityKind, F as EcsEntityEditorKind, r as EntityId } from './System-CYWZ_Zx5.cjs';
|
|
3
3
|
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
4
4
|
|
|
5
5
|
interface StateMachine {
|
|
@@ -939,13 +939,6 @@ type ScriptEntry = {
|
|
|
939
939
|
scriptUrl: string;
|
|
940
940
|
/** When `false`, the script is skipped each frame. */
|
|
941
941
|
enabled: boolean;
|
|
942
|
-
/**
|
|
943
|
-
* When `true`, the script is executed inside the editor (not just at preview/runtime).
|
|
944
|
-
* Enables direct Three.js scene access via `this.world.getScene()` / `getCamera()` /
|
|
945
|
-
* `getRenderer()` for logic the editor's object palette cannot produce (custom shaders,
|
|
946
|
-
* procedural geometry, grass, etc.). Defaults to `false`.
|
|
947
|
-
*/
|
|
948
|
-
executeInEditor?: boolean;
|
|
949
942
|
/** Inspector-bound payload exposed to the script as `this.data`. */
|
|
950
943
|
data: Record<string, unknown>;
|
|
951
944
|
/** Last load/runtime status reported by `ScriptBehaviourSystem`. */
|
|
@@ -974,6 +967,42 @@ declare class ScriptComponent extends Component {
|
|
|
974
967
|
constructor(entries?: ScriptEntry[]);
|
|
975
968
|
}
|
|
976
969
|
|
|
970
|
+
type ScriptObjectRuntimeState = "idle" | "loading" | "ready" | "error";
|
|
971
|
+
type ScriptObjectComponentInput = Partial<{
|
|
972
|
+
/** Compiled script URL (e.g. `localasset://.../scripts/foo.js`). */
|
|
973
|
+
scriptUrl: string | null;
|
|
974
|
+
/** Class name exported by the script module. */
|
|
975
|
+
className: string | null;
|
|
976
|
+
/** When `false`, the script object is not built/ticked. */
|
|
977
|
+
enabled: boolean;
|
|
978
|
+
/** Inspector-bound payload exposed to the script as `this.data`. */
|
|
979
|
+
data: Record<string, unknown>;
|
|
980
|
+
/** Last load/build status reported by `ScriptObjectSystem`. */
|
|
981
|
+
runtimeState: ScriptObjectRuntimeState;
|
|
982
|
+
/** Optional human-readable status message (e.g. compile/build error). */
|
|
983
|
+
runtimeMessage: string;
|
|
984
|
+
}>;
|
|
985
|
+
/**
|
|
986
|
+
* Component for a **script object** — a single {@link ScriptObject} whose
|
|
987
|
+
* THREE.js visual is built by user code and runs in the editor AND at runtime.
|
|
988
|
+
* Unlike {@link ScriptComponent} this holds ONE script (not an entries array).
|
|
989
|
+
* The live instance ref is non-enumerable so it never leaks into save data or
|
|
990
|
+
* undo history.
|
|
991
|
+
*
|
|
992
|
+
* @category Components
|
|
993
|
+
*/
|
|
994
|
+
declare class ScriptObjectComponent extends Component {
|
|
995
|
+
scriptUrl: string | null;
|
|
996
|
+
className: string | null;
|
|
997
|
+
enabled: boolean;
|
|
998
|
+
data: Record<string, unknown>;
|
|
999
|
+
runtimeState: ScriptObjectRuntimeState;
|
|
1000
|
+
runtimeMessage?: string;
|
|
1001
|
+
/** Live ScriptObject instance. Non-enumerable — never enters snapshots/history. */
|
|
1002
|
+
instance: unknown | null;
|
|
1003
|
+
constructor(input?: ScriptObjectComponentInput);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
977
1006
|
/**
|
|
978
1007
|
* Toggles whether the editor selection system can pick this entity. When
|
|
979
1008
|
* `enabled` is `false`, the entity is excluded from raycast hit tests.
|
|
@@ -1127,4 +1156,4 @@ declare class VideoComponent extends Component {
|
|
|
1127
1156
|
stop(): void;
|
|
1128
1157
|
}
|
|
1129
1158
|
|
|
1130
|
-
export {
|
|
1159
|
+
export { SpriteComponent as $, AnimationComponent as A, MeshGeometryComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type MeshGeometryParameters as F, type MeshGeometryParametersByKind as G, ModelComponent as H, ImageComponent as I, type PhysicsState as J, type PlaneMeshParameters as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type RadiusMeshParameters as Q, type RadiusHeightMeshParameters as R, type RigidbodyState as S, type RigidbodyType as T, ScriptComponent as U, type ScriptEntry as V, ScriptObjectComponent as W, type ScriptObjectComponentInput as X, type ScriptObjectRuntimeState as Y, Selectable as Z, SelectionTransformState as _, type AnimationComponentOptions as a, type TextureFilteringValue as a0, type TransformModeValue as a1, type TransformSpaceValue as a2, VideoComponent as a3, defaultMaterialValue as a4, normalizePhysicsState as a5, type AnimationStateCallbacks as a6, AnimationStateMachine as a7, AnimationStateManager as a8, type StateMachine as a9, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_RIGIDBODY_STATE as m, EntityType as n, ImageTarget as o, ImageTargetAnchor as p, type ImageTargetAnchorOptions as q, type ImageTargetReference as r, InstanceSlotComponent as s, type InstanceTransform as t, InstancedMeshComponent as u, type InstancedMeshKind as v, type LightValueState as w, type MaterialTypeValue as x, type MaterialValueState as y, MeshComponent as z };
|