@relu-interactives/spatial-ecs 0.4.5 → 0.5.1

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 (47) hide show
  1. package/dist/{System-ln4Q7Eot.d.cts → System-V_mv07le.d.cts} +2 -2
  2. package/dist/{System-ln4Q7Eot.d.ts → System-V_mv07le.d.ts} +2 -2
  3. package/dist/{XRHandPose-CxPv-LBo.d.cts → XRHandPose-CQTLGxFC.d.cts} +218 -2
  4. package/dist/{XRHandPose-BImIa4ZS.d.ts → XRHandPose-CU3vNFuS.d.ts} +218 -2
  5. package/dist/{chunk-4AK4I3QF.js → chunk-BUEKOSR5.js} +102 -3
  6. package/dist/chunk-BUEKOSR5.js.map +1 -0
  7. package/dist/{chunk-QIIWFP3V.js → chunk-Q52ADLF7.js} +1255 -18
  8. package/dist/chunk-Q52ADLF7.js.map +1 -0
  9. package/dist/{chunk-SGADE55G.js → chunk-RXBLOO5B.js} +249 -90
  10. package/dist/chunk-RXBLOO5B.js.map +1 -0
  11. package/dist/{chunk-4DWZK4X4.js → chunk-WJD2VKEH.js} +3 -3
  12. package/dist/chunk-WJD2VKEH.js.map +1 -0
  13. package/dist/components/index.cjs +99 -0
  14. package/dist/components/index.cjs.map +1 -1
  15. package/dist/components/index.d.cts +3 -3
  16. package/dist/components/index.d.ts +3 -3
  17. package/dist/components/index.js +1 -1
  18. package/dist/docs/guide/spatial-ui.md +165 -0
  19. package/dist/factories/index.cjs +372 -114
  20. package/dist/factories/index.cjs.map +1 -1
  21. package/dist/factories/index.d.cts +13 -3
  22. package/dist/factories/index.d.ts +13 -3
  23. package/dist/factories/index.js +3 -3
  24. package/dist/{index-CuGqxuk-.d.ts → index-C3ik3sA1.d.ts} +16 -3
  25. package/dist/{index-BphKHaV-.d.ts → index-D2Jt_JzH.d.ts} +156 -3
  26. package/dist/{index-CH7qMsQT.d.cts → index-DaG03vyN.d.cts} +156 -3
  27. package/dist/{index-CQsHUez3.d.cts → index-Dlr-7-4m.d.cts} +16 -3
  28. package/dist/index.cjs +1864 -360
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +42 -9
  31. package/dist/index.d.ts +42 -9
  32. package/dist/index.js +10 -8
  33. package/dist/index.js.map +1 -1
  34. package/dist/systems/index.cjs +1346 -13
  35. package/dist/systems/index.cjs.map +1 -1
  36. package/dist/systems/index.d.cts +2 -2
  37. package/dist/systems/index.d.ts +2 -2
  38. package/dist/systems/index.js +3 -3
  39. package/dist/types.d.cts +1 -1
  40. package/dist/types.d.ts +1 -1
  41. package/dist/worldSnapshotUtils.d.cts +1 -1
  42. package/dist/worldSnapshotUtils.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk-4AK4I3QF.js.map +0 -1
  45. package/dist/chunk-4DWZK4X4.js.map +0 -1
  46. package/dist/chunk-QIIWFP3V.js.map +0 -1
  47. package/dist/chunk-SGADE55G.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { createTransform, applyTransform, resolveDracoDecoderPath, loadSharedGltf, cloneModelScene } from './chunk-4DWZK4X4.js';
2
- import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, MeshGeometryComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, ScriptObjectComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, InstancedMeshComponent, InstanceSlotComponent, VideoComponent, XRRigComponent, VRTeleportAreaComponent, XRHandPoseComponent, XRAnchorComponent, XRInteractableComponent, XRInteractorComponent, XRInteractorSideComponent, DEFAULT_INSTANCE_TRANSFORM } from './chunk-4AK4I3QF.js';
1
+ import { createTransform, applyTransform, resolveDracoDecoderPath, loadSharedGltf, cloneModelScene } from './chunk-WJD2VKEH.js';
2
+ import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, MeshGeometryComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, ScriptObjectComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, InstancedMeshComponent, InstanceSlotComponent, VideoComponent, XRRigComponent, VRTeleportAreaComponent, XRHandPoseComponent, XRAnchorComponent, XRInteractableComponent, XRInteractorComponent, XRInteractorSideComponent, UIButtonComponent, UIPanelComponent, UISliderComponent, UITextComponent, UIToggleComponent, DEFAULT_INSTANCE_TRANSFORM } from './chunk-BUEKOSR5.js';
3
3
  import { __name } from './chunk-OY7ZODZP.js';
4
- import * as THREE25 from 'three';
4
+ import * as THREE30 from 'three';
5
5
  import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
6
6
  import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
7
7
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
@@ -22,11 +22,11 @@ function normalizeDistanceModel(distanceModel) {
22
22
  }
23
23
  __name(normalizeDistanceModel, "normalizeDistanceModel");
24
24
  function createConfiguredAudio(listener, options) {
25
- const sound = options.positional ? new THREE25.PositionalAudio(listener) : new THREE25.Audio(listener);
25
+ const sound = options.positional ? new THREE30.PositionalAudio(listener) : new THREE30.Audio(listener);
26
26
  sound.setLoop(options.loop);
27
27
  sound.setVolume(options.volume);
28
28
  sound.setPlaybackRate(options.pitch);
29
- if (sound instanceof THREE25.PositionalAudio) {
29
+ if (sound instanceof THREE30.PositionalAudio) {
30
30
  sound.setRefDistance(options.refDistance);
31
31
  sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
32
32
  sound.setRolloffFactor(options.rolloffFactor);
@@ -36,16 +36,16 @@ function createConfiguredAudio(listener, options) {
36
36
  __name(createConfiguredAudio, "createConfiguredAudio");
37
37
  function createAudioEditorHelper() {
38
38
  if (typeof document === "undefined") {
39
- const geometry = new THREE25.EdgesGeometry(
40
- new THREE25.OctahedronGeometry(0.22, 0)
39
+ const geometry = new THREE30.EdgesGeometry(
40
+ new THREE30.OctahedronGeometry(0.22, 0)
41
41
  );
42
- const material2 = new THREE25.LineBasicMaterial({
42
+ const material2 = new THREE30.LineBasicMaterial({
43
43
  color: "#8bc8ff",
44
44
  transparent: true,
45
45
  opacity: 0.95,
46
46
  depthTest: false
47
47
  });
48
- const fallback = new THREE25.LineSegments(geometry, material2);
48
+ const fallback = new THREE30.LineSegments(geometry, material2);
49
49
  fallback.renderOrder = 10;
50
50
  fallback.userData.ecsHelper = true;
51
51
  fallback.visible = false;
@@ -57,7 +57,7 @@ function createAudioEditorHelper() {
57
57
  canvas.height = size;
58
58
  const ctx = canvas.getContext("2d");
59
59
  if (!ctx) {
60
- return new THREE25.Object3D();
60
+ return new THREE30.Object3D();
61
61
  }
62
62
  ctx.clearRect(0, 0, size, size);
63
63
  ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
@@ -88,14 +88,14 @@ function createAudioEditorHelper() {
88
88
  ctx.beginPath();
89
89
  ctx.arc(56, 48, 16, -0.8, 0.8);
90
90
  ctx.stroke();
91
- const texture = new THREE25.CanvasTexture(canvas);
91
+ const texture = new THREE30.CanvasTexture(canvas);
92
92
  texture.needsUpdate = true;
93
- const material = new THREE25.SpriteMaterial({
93
+ const material = new THREE30.SpriteMaterial({
94
94
  map: texture,
95
95
  transparent: true,
96
96
  depthTest: false
97
97
  });
98
- const helper = new THREE25.Sprite(material);
98
+ const helper = new THREE30.Sprite(material);
99
99
  helper.scale.set(0.68, 0.68, 0.68);
100
100
  helper.renderOrder = 10;
101
101
  helper.userData.ecsHelper = true;
@@ -122,7 +122,7 @@ function createAudioComponent(world, entityId, path = "", options = {}, context)
122
122
  __name(createAudioComponent, "createAudioComponent");
123
123
  function createCameraComponent(world, entityId, payload = {}) {
124
124
  const object = world.getComponent(entityId, Object3DRef)?.object;
125
- const objectCamera = object instanceof THREE25.Camera ? object : void 0;
125
+ const objectCamera = object instanceof THREE30.Camera ? object : void 0;
126
126
  const component = new CameraComponent({
127
127
  ...payload,
128
128
  camera: payload.camera ?? objectCamera
@@ -446,6 +446,46 @@ function createXRInteractorSideComponent(world, entityId, ...args) {
446
446
  }
447
447
  __name(createXRInteractorSideComponent, "createXRInteractorSideComponent");
448
448
 
449
+ // core/factories/components/UIButtonComponentFactory.ts
450
+ function createUIButtonComponent(world, entityId, ...args) {
451
+ const component = new UIButtonComponent(...args);
452
+ world.addComponent(entityId, component);
453
+ return component;
454
+ }
455
+ __name(createUIButtonComponent, "createUIButtonComponent");
456
+
457
+ // core/factories/components/UIPanelComponentFactory.ts
458
+ function createUIPanelComponent(world, entityId, ...args) {
459
+ const component = new UIPanelComponent(...args);
460
+ world.addComponent(entityId, component);
461
+ return component;
462
+ }
463
+ __name(createUIPanelComponent, "createUIPanelComponent");
464
+
465
+ // core/factories/components/UISliderComponentFactory.ts
466
+ function createUISliderComponent(world, entityId, ...args) {
467
+ const component = new UISliderComponent(...args);
468
+ world.addComponent(entityId, component);
469
+ return component;
470
+ }
471
+ __name(createUISliderComponent, "createUISliderComponent");
472
+
473
+ // core/factories/components/UITextComponentFactory.ts
474
+ function createUITextComponent(world, entityId, ...args) {
475
+ const component = new UITextComponent(...args);
476
+ world.addComponent(entityId, component);
477
+ return component;
478
+ }
479
+ __name(createUITextComponent, "createUITextComponent");
480
+
481
+ // core/factories/components/UIToggleComponentFactory.ts
482
+ function createUIToggleComponent(world, entityId, ...args) {
483
+ const component = new UIToggleComponent(...args);
484
+ world.addComponent(entityId, component);
485
+ return component;
486
+ }
487
+ __name(createUIToggleComponent, "createUIToggleComponent");
488
+
449
489
  // core/factories/registerDefaultComponentFactories.ts
450
490
  function registerDefaultComponentFactories(objectManagementSystem) {
451
491
  objectManagementSystem.registerComponentFactory("animation", createAnimationComponent);
@@ -459,6 +499,11 @@ function registerDefaultComponentFactories(objectManagementSystem) {
459
499
  objectManagementSystem.registerComponentFactory("vrTeleportArea", createVRTeleportAreaComponent);
460
500
  objectManagementSystem.registerComponentFactory("xrHandPose", createXRHandPoseComponent);
461
501
  objectManagementSystem.registerComponentFactory("xrAnchor", createXRAnchorComponent);
502
+ objectManagementSystem.registerComponentFactory("uiPanel", createUIPanelComponent);
503
+ objectManagementSystem.registerComponentFactory("uiText", createUITextComponent);
504
+ objectManagementSystem.registerComponentFactory("uiButton", createUIButtonComponent);
505
+ objectManagementSystem.registerComponentFactory("uiToggle", createUIToggleComponent);
506
+ objectManagementSystem.registerComponentFactory("uiSlider", createUISliderComponent);
462
507
  objectManagementSystem.registerComponentFactory("xrInteractable", createXRInteractableComponent);
463
508
  objectManagementSystem.registerComponentFactory("xrInteractor", createXRInteractorComponent);
464
509
  objectManagementSystem.registerComponentFactory("xrInteractorSide", createXRInteractorSideComponent);
@@ -521,10 +566,10 @@ __name(createBaseEntity, "createBaseEntity");
521
566
  // core/factories/objects/AudioFactory.ts
522
567
  function getOrCreateListener(camera) {
523
568
  const existing = camera.userData.ecsAudioListener;
524
- if (existing instanceof THREE25.AudioListener) {
569
+ if (existing instanceof THREE30.AudioListener) {
525
570
  return existing;
526
571
  }
527
- const listener = new THREE25.AudioListener();
572
+ const listener = new THREE30.AudioListener();
528
573
  camera.add(listener);
529
574
  camera.userData.ecsAudioListener = listener;
530
575
  return listener;
@@ -537,7 +582,7 @@ function createAudio({
537
582
  payload,
538
583
  isEditor
539
584
  }) {
540
- const anchor = new THREE25.Object3D();
585
+ const anchor = new THREE30.Object3D();
541
586
  const entityId = createBaseEntity(world, anchor, {
542
587
  label: payload.name ?? "Audio",
543
588
  entityType: "audio",
@@ -559,7 +604,7 @@ function createAudio({
559
604
  return entityId;
560
605
  }
561
606
  if (!isEditor) {
562
- const loader = new THREE25.AudioLoader();
607
+ const loader = new THREE30.AudioLoader();
563
608
  loader.load(
564
609
  audio.path,
565
610
  (buffer) => {
@@ -634,7 +679,7 @@ function applyCameraSettings(camera, options) {
634
679
  const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR;
635
680
  const far = typeof options.far === "number" ? options.far : DEFAULT_FAR;
636
681
  const projection = options.projection;
637
- if (camera instanceof THREE25.PerspectiveCamera) {
682
+ if (camera instanceof THREE30.PerspectiveCamera) {
638
683
  if (!projection || projection === "perspective") {
639
684
  camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV;
640
685
  }
@@ -644,7 +689,7 @@ function applyCameraSettings(camera, options) {
644
689
  camera.updateProjectionMatrix();
645
690
  return;
646
691
  }
647
- if (camera instanceof THREE25.OrthographicCamera) {
692
+ if (camera instanceof THREE30.OrthographicCamera) {
648
693
  camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
649
694
  camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
650
695
  camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
@@ -665,7 +710,7 @@ function createCameraObject(options) {
665
710
  const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
666
711
  const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
667
712
  const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
668
- const camera = new THREE25.OrthographicCamera(
713
+ const camera = new THREE30.OrthographicCamera(
669
714
  left,
670
715
  right,
671
716
  top,
@@ -677,7 +722,7 @@ function createCameraObject(options) {
677
722
  camera.updateProjectionMatrix();
678
723
  return camera;
679
724
  }
680
- return new THREE25.PerspectiveCamera(
725
+ return new THREE30.PerspectiveCamera(
681
726
  options.fov ?? DEFAULT_FOV,
682
727
  readViewportAspect(),
683
728
  near,
@@ -695,7 +740,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
695
740
  transformInput: payload.transform
696
741
  });
697
742
  const objectRef = world.getComponent(entityId, Object3DRef);
698
- if (objectRef?.object instanceof THREE25.Camera) {
743
+ if (objectRef?.object instanceof THREE30.Camera) {
699
744
  objectRef.object.userData.entityId = entityId;
700
745
  }
701
746
  const componentOptions = {
@@ -727,9 +772,9 @@ function createCapsule({
727
772
  scene,
728
773
  payload
729
774
  }) {
730
- const geometry = new THREE25.CapsuleGeometry(0.5, 1, 4, 8);
731
- const material = new THREE25.MeshStandardMaterial({ color: "#ffffff" });
732
- const mesh = new THREE25.Mesh(geometry, material);
775
+ const geometry = new THREE30.CapsuleGeometry(0.5, 1, 4, 8);
776
+ const material = new THREE30.MeshStandardMaterial({ color: "#ffffff" });
777
+ const mesh = new THREE30.Mesh(geometry, material);
733
778
  const entityId = createBaseEntity(world, mesh, {
734
779
  label: payload.name ?? "Capsule",
735
780
  entityType: "capsule",
@@ -749,9 +794,9 @@ function createCapsule({
749
794
  }
750
795
  __name(createCapsule, "createCapsule");
751
796
  function createCube({ world, scene, payload }) {
752
- const geometry = new THREE25.BoxGeometry(1, 1, 1);
753
- const material = new THREE25.MeshStandardMaterial({ color: "#ffffff" });
754
- const mesh = new THREE25.Mesh(geometry, material);
797
+ const geometry = new THREE30.BoxGeometry(1, 1, 1);
798
+ const material = new THREE30.MeshStandardMaterial({ color: "#ffffff" });
799
+ const mesh = new THREE30.Mesh(geometry, material);
755
800
  const entityId = createBaseEntity(world, mesh, {
756
801
  label: payload.name ?? "Cube",
757
802
  entityType: "cube",
@@ -776,9 +821,9 @@ function createCylinder({
776
821
  scene,
777
822
  payload
778
823
  }) {
779
- const geometry = new THREE25.CylinderGeometry(0.5, 0.5, 1, 20);
780
- const material = new THREE25.MeshStandardMaterial({ color: "#ffffff" });
781
- const mesh = new THREE25.Mesh(geometry, material);
824
+ const geometry = new THREE30.CylinderGeometry(0.5, 0.5, 1, 20);
825
+ const material = new THREE30.MeshStandardMaterial({ color: "#ffffff" });
826
+ const mesh = new THREE30.Mesh(geometry, material);
782
827
  const entityId = createBaseEntity(world, mesh, {
783
828
  label: payload.name ?? "Cylinder",
784
829
  entityType: "cylinder",
@@ -798,7 +843,7 @@ function createCylinder({
798
843
  }
799
844
  __name(createCylinder, "createCylinder");
800
845
  function createEmpty({ world, scene, payload, isEditor }) {
801
- const object = new THREE25.Group();
846
+ const object = new THREE30.Group();
802
847
  const entityId = createBaseEntity(world, object, {
803
848
  label: payload.name ?? "Empty",
804
849
  entityType: "empty",
@@ -809,7 +854,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
809
854
  }
810
855
  __name(createEmpty, "createEmpty");
811
856
  function createImage({ world, scene, payload }) {
812
- const anchor = new THREE25.Object3D();
857
+ const anchor = new THREE30.Object3D();
813
858
  const imagePath = payload.path ?? "";
814
859
  const entityId = createBaseEntity(world, anchor, {
815
860
  label: payload.name ?? "Image",
@@ -822,7 +867,7 @@ function createImage({ world, scene, payload }) {
822
867
  if (!imagePath) {
823
868
  return entityId;
824
869
  }
825
- const loader = new THREE25.TextureLoader();
870
+ const loader = new THREE30.TextureLoader();
826
871
  loader.load(
827
872
  imagePath,
828
873
  (texture) => {
@@ -830,13 +875,13 @@ function createImage({ world, scene, payload }) {
830
875
  texture.dispose();
831
876
  return;
832
877
  }
833
- const material = new THREE25.MeshBasicMaterial({
878
+ const material = new THREE30.MeshBasicMaterial({
834
879
  map: texture,
835
880
  transparent: true,
836
- side: THREE25.DoubleSide
881
+ side: THREE30.DoubleSide
837
882
  });
838
- const geometry = new THREE25.PlaneGeometry(1, 1);
839
- const plane = new THREE25.Mesh(geometry, material);
883
+ const geometry = new THREE30.PlaneGeometry(1, 1);
884
+ const plane = new THREE30.Mesh(geometry, material);
840
885
  plane.userData.entityId = entityId;
841
886
  const textureImage = texture.image;
842
887
  const width = textureImage?.width ?? 1;
@@ -882,7 +927,7 @@ function createImageTarget({
882
927
  payload,
883
928
  isEditor
884
929
  }) {
885
- const anchor = new THREE25.Object3D();
930
+ const anchor = new THREE30.Object3D();
886
931
  const imagePath = payload.path ?? "";
887
932
  const entityId = createBaseEntity(world, anchor, {
888
933
  label: payload.name ?? "Image Target",
@@ -899,7 +944,7 @@ function createImageTarget({
899
944
  if (!isEditor || !imagePath) {
900
945
  return entityId;
901
946
  }
902
- const loader = new THREE25.TextureLoader();
947
+ const loader = new THREE30.TextureLoader();
903
948
  loader.load(
904
949
  imagePath,
905
950
  (texture) => {
@@ -907,13 +952,13 @@ function createImageTarget({
907
952
  texture.dispose();
908
953
  return;
909
954
  }
910
- const material = new THREE25.MeshBasicMaterial({
955
+ const material = new THREE30.MeshBasicMaterial({
911
956
  map: texture,
912
957
  transparent: true,
913
- side: THREE25.DoubleSide
958
+ side: THREE30.DoubleSide
914
959
  });
915
- const geometry = new THREE25.PlaneGeometry(1, 1);
916
- const plane = new THREE25.Mesh(geometry, material);
960
+ const geometry = new THREE30.PlaneGeometry(1, 1);
961
+ const plane = new THREE30.Mesh(geometry, material);
917
962
  plane.userData.entityId = entityId;
918
963
  const textureImage = texture.image;
919
964
  const width = textureImage?.width ?? 1;
@@ -964,7 +1009,7 @@ function createInstancedMesh({
964
1009
  scene,
965
1010
  payload
966
1011
  }) {
967
- const anchor = new THREE25.Object3D();
1012
+ const anchor = new THREE30.Object3D();
968
1013
  const opts = payload.options ?? {};
969
1014
  const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
970
1015
  const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
@@ -1035,7 +1080,7 @@ function createAmbientLight({
1035
1080
  scene,
1036
1081
  payload
1037
1082
  }) {
1038
- const light = new THREE25.AmbientLight("#ffffff", 0.6);
1083
+ const light = new THREE30.AmbientLight("#ffffff", 0.6);
1039
1084
  const entityId = createBaseEntity(world, light, {
1040
1085
  label: payload.name ?? "Ambient Light",
1041
1086
  entityType: "ambientLight",
@@ -1052,7 +1097,7 @@ function createAreaLight({
1052
1097
  payload,
1053
1098
  isEditor
1054
1099
  }) {
1055
- const light = new THREE25.RectAreaLight("#ffffff", 5, 4, 4);
1100
+ const light = new THREE30.RectAreaLight("#ffffff", 5, 4, 4);
1056
1101
  light.lookAt(0, 0, 0);
1057
1102
  const entityId = createBaseEntity(world, light, {
1058
1103
  label: payload.name ?? "Area Light",
@@ -1081,7 +1126,7 @@ function createDirectionalLight({
1081
1126
  payload,
1082
1127
  isEditor
1083
1128
  }) {
1084
- const light = new THREE25.DirectionalLight("#ffffff", 1.5);
1129
+ const light = new THREE30.DirectionalLight("#ffffff", 1.5);
1085
1130
  light.castShadow = true;
1086
1131
  const entityId = createBaseEntity(world, light, {
1087
1132
  label: payload.name ?? "Directional Light",
@@ -1092,7 +1137,7 @@ function createDirectionalLight({
1092
1137
  });
1093
1138
  createLightComponent(world, entityId, light);
1094
1139
  if (isEditor) {
1095
- const helper = new THREE25.DirectionalLightHelper(light, 1.8, "#38bdf8");
1140
+ const helper = new THREE30.DirectionalLightHelper(light, 1.8, "#38bdf8");
1096
1141
  helper.onBeforeRender = () => {
1097
1142
  helper.update();
1098
1143
  };
@@ -1110,7 +1155,7 @@ function createPointLight({
1110
1155
  payload,
1111
1156
  isEditor
1112
1157
  }) {
1113
- const light = new THREE25.PointLight("#ffffff", 1, 10);
1158
+ const light = new THREE30.PointLight("#ffffff", 1, 10);
1114
1159
  const entityId = createBaseEntity(world, light, {
1115
1160
  label: payload.name ?? "Point Light",
1116
1161
  entityType: "pointLight",
@@ -1120,7 +1165,7 @@ function createPointLight({
1120
1165
  });
1121
1166
  createLightComponent(world, entityId, light);
1122
1167
  if (isEditor) {
1123
- const helper = new THREE25.PointLightHelper(light, 0.35, "#fbbf24");
1168
+ const helper = new THREE30.PointLightHelper(light, 0.35, "#fbbf24");
1124
1169
  helper.onBeforeRender = () => {
1125
1170
  helper.update();
1126
1171
  };
@@ -1138,7 +1183,7 @@ function createSpotLight({
1138
1183
  payload,
1139
1184
  isEditor
1140
1185
  }) {
1141
- const light = new THREE25.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
1186
+ const light = new THREE30.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
1142
1187
  const entityId = createBaseEntity(world, light, {
1143
1188
  label: payload.name ?? "Spot Light",
1144
1189
  entityType: "spotLight",
@@ -1148,7 +1193,7 @@ function createSpotLight({
1148
1193
  });
1149
1194
  createLightComponent(world, entityId, light);
1150
1195
  if (isEditor) {
1151
- const helper = new THREE25.SpotLightHelper(light, "#f59e0b");
1196
+ const helper = new THREE30.SpotLightHelper(light, "#f59e0b");
1152
1197
  helper.onBeforeRender = () => {
1153
1198
  helper.update();
1154
1199
  };
@@ -1183,7 +1228,7 @@ function createModel({
1183
1228
  payload,
1184
1229
  isEditor
1185
1230
  }) {
1186
- const anchor = new THREE25.Object3D();
1231
+ const anchor = new THREE30.Object3D();
1187
1232
  const modelPath = payload.path ?? "";
1188
1233
  const entityId = createBaseEntity(world, anchor, {
1189
1234
  label: payload.name ?? "Model",
@@ -1249,12 +1294,12 @@ function createModel({
1249
1294
  }
1250
1295
  __name(createModel, "createModel");
1251
1296
  function createPlane({ world, scene, payload }) {
1252
- const geometry = new THREE25.PlaneGeometry(100, 100);
1253
- const material = new THREE25.MeshStandardMaterial({
1297
+ const geometry = new THREE30.PlaneGeometry(100, 100);
1298
+ const material = new THREE30.MeshStandardMaterial({
1254
1299
  color: "#ffffff",
1255
- side: THREE25.DoubleSide
1300
+ side: THREE30.DoubleSide
1256
1301
  });
1257
- const mesh = new THREE25.Mesh(geometry, material);
1302
+ const mesh = new THREE30.Mesh(geometry, material);
1258
1303
  const entityId = createBaseEntity(
1259
1304
  world,
1260
1305
  mesh,
@@ -1290,7 +1335,7 @@ function createScriptObject({
1290
1335
  scene,
1291
1336
  payload
1292
1337
  }) {
1293
- const object = new THREE25.Group();
1338
+ const object = new THREE30.Group();
1294
1339
  const entityId = createBaseEntity(world, object, {
1295
1340
  label: payload.name ?? "Script Object",
1296
1341
  entityType: "scriptObject",
@@ -1315,15 +1360,15 @@ function createTeleportArea({
1315
1360
  const options = payload.options ?? {};
1316
1361
  const width = typeof options.width === "number" ? options.width : 10;
1317
1362
  const depth = typeof options.depth === "number" ? options.depth : 10;
1318
- const geometry = new THREE25.PlaneGeometry(width, depth);
1319
- const material = new THREE25.MeshBasicMaterial({
1363
+ const geometry = new THREE30.PlaneGeometry(width, depth);
1364
+ const material = new THREE30.MeshBasicMaterial({
1320
1365
  color: "#4da3ff",
1321
1366
  transparent: true,
1322
1367
  opacity: 0.18,
1323
- side: THREE25.DoubleSide,
1368
+ side: THREE30.DoubleSide,
1324
1369
  depthWrite: false
1325
1370
  });
1326
- const object = new THREE25.Mesh(geometry, material);
1371
+ const object = new THREE30.Mesh(geometry, material);
1327
1372
  const entityId = createBaseEntity(world, object, {
1328
1373
  label: payload.name ?? "Teleport Area",
1329
1374
  entityType: "teleportArea",
@@ -1351,7 +1396,7 @@ function createXRInteractor({
1351
1396
  scene,
1352
1397
  payload
1353
1398
  }) {
1354
- const root = new THREE25.Group();
1399
+ const root = new THREE30.Group();
1355
1400
  const options = payload.options ?? {};
1356
1401
  const entityId = createBaseEntity(world, root, {
1357
1402
  label: payload.name ?? "XR Interactor",
@@ -1364,7 +1409,7 @@ function createXRInteractor({
1364
1409
  return entityId;
1365
1410
  }
1366
1411
  for (const side of ["left", "right"]) {
1367
- const slot = new THREE25.Group();
1412
+ const slot = new THREE30.Group();
1368
1413
  const label = side === "left" ? "Left Interactor" : "Right Interactor";
1369
1414
  const slotEntityId = createBaseEntity(world, slot, {
1370
1415
  label,
@@ -1377,12 +1422,121 @@ function createXRInteractor({
1377
1422
  return entityId;
1378
1423
  }
1379
1424
  __name(createXRInteractor, "createXRInteractor");
1425
+ function createUIButton({
1426
+ world,
1427
+ scene,
1428
+ payload
1429
+ }) {
1430
+ const object = new THREE30.Group();
1431
+ const entityId = createBaseEntity(world, object, {
1432
+ label: payload.name ?? "UI Button",
1433
+ entityType: "uiButton",
1434
+ transformInput: payload.transform
1435
+ });
1436
+ const options = payload.options ?? {};
1437
+ world.addComponent(entityId, new UIButtonComponent(options));
1438
+ world.addComponent(
1439
+ entityId,
1440
+ new XRInteractableComponent({
1441
+ grabbable: false,
1442
+ pointable: true,
1443
+ hoverBehavior: "color"
1444
+ })
1445
+ );
1446
+ scene.add(object);
1447
+ return entityId;
1448
+ }
1449
+ __name(createUIButton, "createUIButton");
1450
+ function createUIPanel({
1451
+ world,
1452
+ scene,
1453
+ payload
1454
+ }) {
1455
+ const object = new THREE30.Group();
1456
+ const entityId = createBaseEntity(world, object, {
1457
+ label: payload.name ?? "UI Panel",
1458
+ entityType: "uiPanel",
1459
+ transformInput: payload.transform
1460
+ });
1461
+ const options = payload.options ?? {};
1462
+ world.addComponent(entityId, new UIPanelComponent(options));
1463
+ scene.add(object);
1464
+ return entityId;
1465
+ }
1466
+ __name(createUIPanel, "createUIPanel");
1467
+ function createUISlider({
1468
+ world,
1469
+ scene,
1470
+ payload
1471
+ }) {
1472
+ const object = new THREE30.Group();
1473
+ const entityId = createBaseEntity(world, object, {
1474
+ label: payload.name ?? "UI Slider",
1475
+ entityType: "uiSlider",
1476
+ transformInput: payload.transform
1477
+ });
1478
+ const options = payload.options ?? {};
1479
+ world.addComponent(entityId, new UISliderComponent(options));
1480
+ world.addComponent(
1481
+ entityId,
1482
+ new XRInteractableComponent({
1483
+ grabbable: false,
1484
+ pointable: true,
1485
+ hoverBehavior: "none"
1486
+ })
1487
+ );
1488
+ scene.add(object);
1489
+ return entityId;
1490
+ }
1491
+ __name(createUISlider, "createUISlider");
1492
+ function createUIText({
1493
+ world,
1494
+ scene,
1495
+ payload
1496
+ }) {
1497
+ const object = new THREE30.Group();
1498
+ const entityId = createBaseEntity(world, object, {
1499
+ label: payload.name ?? "UI Text",
1500
+ entityType: "uiText",
1501
+ transformInput: payload.transform
1502
+ });
1503
+ const options = payload.options ?? {};
1504
+ world.addComponent(entityId, new UITextComponent(options));
1505
+ scene.add(object);
1506
+ return entityId;
1507
+ }
1508
+ __name(createUIText, "createUIText");
1509
+ function createUIToggle({
1510
+ world,
1511
+ scene,
1512
+ payload
1513
+ }) {
1514
+ const object = new THREE30.Group();
1515
+ const entityId = createBaseEntity(world, object, {
1516
+ label: payload.name ?? "UI Toggle",
1517
+ entityType: "uiToggle",
1518
+ transformInput: payload.transform
1519
+ });
1520
+ const options = payload.options ?? {};
1521
+ world.addComponent(entityId, new UIToggleComponent(options));
1522
+ world.addComponent(
1523
+ entityId,
1524
+ new XRInteractableComponent({
1525
+ grabbable: false,
1526
+ pointable: true,
1527
+ hoverBehavior: "color"
1528
+ })
1529
+ );
1530
+ scene.add(object);
1531
+ return entityId;
1532
+ }
1533
+ __name(createUIToggle, "createUIToggle");
1380
1534
  function createXRRig({
1381
1535
  world,
1382
1536
  scene,
1383
1537
  payload
1384
1538
  }) {
1385
- const object = new THREE25.Group();
1539
+ const object = new THREE30.Group();
1386
1540
  const entityId = createBaseEntity(world, object, {
1387
1541
  label: payload.name ?? "XR Rig",
1388
1542
  entityType: "xrRig",
@@ -1395,7 +1549,7 @@ function createXRRig({
1395
1549
  }
1396
1550
  __name(createXRRig, "createXRRig");
1397
1551
  function createSprite({ world, scene, payload }) {
1398
- const anchor = new THREE25.Object3D();
1552
+ const anchor = new THREE30.Object3D();
1399
1553
  const imagePath = payload.path ?? "";
1400
1554
  const entityId = createBaseEntity(world, anchor, {
1401
1555
  label: payload.name ?? "Sprite",
@@ -1407,7 +1561,7 @@ function createSprite({ world, scene, payload }) {
1407
1561
  if (!imagePath) {
1408
1562
  return entityId;
1409
1563
  }
1410
- const loader = new THREE25.TextureLoader();
1564
+ const loader = new THREE30.TextureLoader();
1411
1565
  loader.load(
1412
1566
  imagePath,
1413
1567
  (texture) => {
@@ -1415,11 +1569,11 @@ function createSprite({ world, scene, payload }) {
1415
1569
  texture.dispose();
1416
1570
  return;
1417
1571
  }
1418
- const material = new THREE25.SpriteMaterial({
1572
+ const material = new THREE30.SpriteMaterial({
1419
1573
  map: texture,
1420
1574
  transparent: true
1421
1575
  });
1422
- const sprite = new THREE25.Sprite(material);
1576
+ const sprite = new THREE30.Sprite(material);
1423
1577
  sprite.userData.entityId = entityId;
1424
1578
  const textureImage = texture.image;
1425
1579
  spriteComponent.width = textureImage?.width ?? 1;
@@ -1437,9 +1591,9 @@ function createSprite({ world, scene, payload }) {
1437
1591
  }
1438
1592
  __name(createSprite, "createSprite");
1439
1593
  function createSphere({ world, scene, payload }) {
1440
- const geometry = new THREE25.SphereGeometry(0.5, 24, 24);
1441
- const material = new THREE25.MeshStandardMaterial({ color: "#ffffff" });
1442
- const mesh = new THREE25.Mesh(geometry, material);
1594
+ const geometry = new THREE30.SphereGeometry(0.5, 24, 24);
1595
+ const material = new THREE30.MeshStandardMaterial({ color: "#ffffff" });
1596
+ const mesh = new THREE30.Mesh(geometry, material);
1443
1597
  const entityId = createBaseEntity(world, mesh, {
1444
1598
  label: payload.name ?? "Sphere",
1445
1599
  entityType: "sphere",
@@ -1459,10 +1613,10 @@ function createSphere({ world, scene, payload }) {
1459
1613
  __name(createSphere, "createSphere");
1460
1614
  function getOrCreateListener2(camera) {
1461
1615
  const existing = camera.userData.ecsAudioListener;
1462
- if (existing instanceof THREE25.AudioListener) {
1616
+ if (existing instanceof THREE30.AudioListener) {
1463
1617
  return existing;
1464
1618
  }
1465
- const listener = new THREE25.AudioListener();
1619
+ const listener = new THREE30.AudioListener();
1466
1620
  camera.add(listener);
1467
1621
  camera.userData.ecsAudioListener = listener;
1468
1622
  return listener;
@@ -1512,10 +1666,10 @@ function normalizeOptions(input) {
1512
1666
  }
1513
1667
  __name(normalizeOptions, "normalizeOptions");
1514
1668
  function createChromaMaterial(texture, options) {
1515
- return new THREE25.ShaderMaterial({
1669
+ return new THREE30.ShaderMaterial({
1516
1670
  uniforms: {
1517
1671
  tex: { value: texture },
1518
- keyColor: { value: new THREE25.Color(options.backgroundColor) },
1672
+ keyColor: { value: new THREE30.Color(options.backgroundColor) },
1519
1673
  similarity: { value: options.similarity },
1520
1674
  smoothness: { value: options.smoothness },
1521
1675
  spill: { value: options.spill }
@@ -1547,22 +1701,22 @@ function createChromaMaterial(texture, options) {
1547
1701
  }
1548
1702
  `,
1549
1703
  transparent: true,
1550
- side: THREE25.DoubleSide
1704
+ side: THREE30.DoubleSide
1551
1705
  });
1552
1706
  }
1553
1707
  __name(createChromaMaterial, "createChromaMaterial");
1554
1708
  function createStandardMaterial(texture) {
1555
- return new THREE25.MeshBasicMaterial({
1709
+ return new THREE30.MeshBasicMaterial({
1556
1710
  map: texture,
1557
1711
  transparent: true,
1558
- side: THREE25.DoubleSide
1712
+ side: THREE30.DoubleSide
1559
1713
  });
1560
1714
  }
1561
1715
  __name(createStandardMaterial, "createStandardMaterial");
1562
1716
  function createVideoMesh(entityId, texture, options) {
1563
- const geometry = new THREE25.PlaneGeometry(1, 1);
1717
+ const geometry = new THREE30.PlaneGeometry(1, 1);
1564
1718
  const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
1565
- const mesh = new THREE25.Mesh(geometry, material);
1719
+ const mesh = new THREE30.Mesh(geometry, material);
1566
1720
  mesh.userData.entityId = entityId;
1567
1721
  mesh.scale.set(options.width, options.height, 1);
1568
1722
  return { mesh, material };
@@ -1597,7 +1751,7 @@ function createVideo({
1597
1751
  payload,
1598
1752
  isEditor
1599
1753
  }) {
1600
- const anchor = new THREE25.Object3D();
1754
+ const anchor = new THREE30.Object3D();
1601
1755
  const path = payload.path ?? "";
1602
1756
  const options = normalizeOptions(payload.options);
1603
1757
  const entityId = createBaseEntity(world, anchor, {
@@ -1612,8 +1766,8 @@ function createVideo({
1612
1766
  return entityId;
1613
1767
  }
1614
1768
  const video = createVideoElement(path, options);
1615
- const texture = new THREE25.VideoTexture(video);
1616
- texture.colorSpace = THREE25.SRGBColorSpace;
1769
+ const texture = new THREE30.VideoTexture(video);
1770
+ texture.colorSpace = THREE30.SRGBColorSpace;
1617
1771
  texture.needsUpdate = true;
1618
1772
  const { mesh, material } = createVideoMesh(entityId, texture, options);
1619
1773
  anchor.add(mesh);
@@ -1629,7 +1783,7 @@ function createVideo({
1629
1783
  });
1630
1784
  if (!isEditor && options.positional) {
1631
1785
  const listener = getOrCreateListener2(camera);
1632
- const audioNode = new THREE25.PositionalAudio(listener);
1786
+ const audioNode = new THREE30.PositionalAudio(listener);
1633
1787
  audioNode.setVolume(options.volume);
1634
1788
  audioNode.setRefDistance(options.refDistance);
1635
1789
  audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
@@ -1672,10 +1826,15 @@ function registerDefaultFactories(objectManagementSystem) {
1672
1826
  objectManagementSystem.register("xrRig", createXRRig);
1673
1827
  objectManagementSystem.register("xrInteractor", createXRInteractor);
1674
1828
  objectManagementSystem.register("teleportArea", createTeleportArea);
1829
+ objectManagementSystem.register("uiPanel", createUIPanel);
1830
+ objectManagementSystem.register("uiText", createUIText);
1831
+ objectManagementSystem.register("uiButton", createUIButton);
1832
+ objectManagementSystem.register("uiToggle", createUIToggle);
1833
+ objectManagementSystem.register("uiSlider", createUISlider);
1675
1834
  registerDefaultComponentFactories(objectManagementSystem);
1676
1835
  }
1677
1836
  __name(registerDefaultFactories, "registerDefaultFactories");
1678
1837
 
1679
- export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRAnchorComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories };
1680
- //# sourceMappingURL=chunk-SGADE55G.js.map
1681
- //# sourceMappingURL=chunk-SGADE55G.js.map
1838
+ export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createUIButtonComponent, createUIPanelComponent, createUISliderComponent, createUITextComponent, createUIToggleComponent, createVRTeleportAreaComponent, createVideoComponent, createXRAnchorComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories };
1839
+ //# sourceMappingURL=chunk-RXBLOO5B.js.map
1840
+ //# sourceMappingURL=chunk-RXBLOO5B.js.map