@dcl/playground-assets 7.1.2-4419392799.commit-7961b54 → 7.1.2-4426178080.commit-9504360

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/alpha.d.ts CHANGED
@@ -1085,6 +1085,39 @@ export declare type Color4Type = {
1085
1085
  */
1086
1086
  export declare type ComponentDefinition<T> = LastWriteWinElementSetComponentDefinition<T> | GrowOnlyValueSetComponentDefinition<T>;
1087
1087
 
1088
+ /** public */
1089
+ export declare const componentDefinitionByName: {
1090
+ "core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
1091
+ "core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
1092
+ "core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
1093
+ "core::AvatarAttach": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarAttach>>;
1094
+ "core::AvatarModifierArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>>;
1095
+ "core::AvatarShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarShape>>;
1096
+ "core::Billboard": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBBillboard>>;
1097
+ "core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
1098
+ "core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
1099
+ "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
1100
+ "core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
1101
+ "core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
1102
+ "core::MeshRenderer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshRenderer>>;
1103
+ "core::NftShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBNftShape>>;
1104
+ "core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
1105
+ "core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
1106
+ "core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
1107
+ "core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
1108
+ "core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
1109
+ "core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
1110
+ "core::UiBackground": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiBackground>>;
1111
+ "core::UiDropdown": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdown>>;
1112
+ "core::UiDropdownResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>>;
1113
+ "core::UiInput": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInput>>;
1114
+ "core::UiInputResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
1115
+ "core::UiText": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
1116
+ "core::UiTransform": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
1117
+ "core::VideoPlayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
1118
+ "core::VisibilityComponent": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
1119
+ };
1120
+
1088
1121
  /**
1089
1122
  * Component types are used to pick the wire protocol and the conflict resolution algorithm
1090
1123
  * @public
@@ -1094,6 +1127,33 @@ export declare const enum ComponentType {
1094
1127
  GrowOnlyValueSet = 1
1095
1128
  }
1096
1129
 
1130
+ /**
1131
+ * @public
1132
+ * @deprecated composite is not being supported so far, please do not use this feature
1133
+ */
1134
+ export declare type Composite = {
1135
+ id: string;
1136
+ components: {
1137
+ name: string;
1138
+ schema?: JsonSchemaExtended;
1139
+ data: Map<Entity, unknown>;
1140
+ }[];
1141
+ };
1142
+
1143
+ /**
1144
+ * @public
1145
+ * @deprecated composite is not being supported so far, please do not use this feature
1146
+ */
1147
+ export declare function compositeFromJson(jsonComposite: any): Composite;
1148
+
1149
+ /**
1150
+ * @public
1151
+ * @deprecated composite is not being supported so far, please do not use this feature
1152
+ */
1153
+ export declare type CompositeProvider = {
1154
+ getCompositeOrNull: (id: string) => Composite | null;
1155
+ };
1156
+
1097
1157
  /**
1098
1158
  * A conflict resolution message is the response to an outdated or invalid state
1099
1159
  * in the CRDT.
@@ -1935,6 +1995,18 @@ export declare type InputEventResult = {
1935
1995
  */
1936
1996
  export declare const inputSystem: IInputSystem;
1937
1997
 
1998
+ /**
1999
+ * Instance a composite and returns its root entity
2000
+ * @param compositeData state serialized by the CRDT protocol
2001
+ * @param getNextAvailableEntity function that gives unused entities
2002
+ * @param rootEntity (optional) suggested mapped rootEntity for the composite
2003
+ *
2004
+ * @public
2005
+ * @deprecated composite is not being supported so far, please do not use this feature
2006
+ *
2007
+ */
2008
+ export declare function instanceComposite(engine: IEngine, compositeData: Composite, getNextAvailableEntity: () => Entity | null, compositeProvider: CompositeProvider, rootEntity?: Entity, alreadyRequestedId?: Set<string>): Entity;
2009
+
1938
2010
  /**
1939
2011
  * @public
1940
2012
  */
@@ -4658,6 +4730,12 @@ export declare namespace Schemas {
4658
4730
  const Map: <T extends Spec>(spec: T, defaultValue?: Partial<MapResult<T>> | undefined) => ISchema<MapResult<T>>;
4659
4731
  /** @public */
4660
4732
  const Optional: <T>(spec: ISchema<T>) => ISchema<T | undefined>;
4733
+ /**
4734
+ * @public Create an ISchema object from the json-schema
4735
+ * @param jsonSchema
4736
+ * @returns a ISchema or fail for unsupported json-schema
4737
+ */
4738
+ const fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
4661
4739
  }
4662
4740
 
4663
4741
  /**
package/dist/beta.d.ts CHANGED
@@ -1085,6 +1085,39 @@ export declare type Color4Type = {
1085
1085
  */
1086
1086
  export declare type ComponentDefinition<T> = LastWriteWinElementSetComponentDefinition<T> | GrowOnlyValueSetComponentDefinition<T>;
1087
1087
 
1088
+ /** public */
1089
+ export declare const componentDefinitionByName: {
1090
+ "core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
1091
+ "core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
1092
+ "core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
1093
+ "core::AvatarAttach": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarAttach>>;
1094
+ "core::AvatarModifierArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>>;
1095
+ "core::AvatarShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarShape>>;
1096
+ "core::Billboard": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBBillboard>>;
1097
+ "core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
1098
+ "core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
1099
+ "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
1100
+ "core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
1101
+ "core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
1102
+ "core::MeshRenderer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshRenderer>>;
1103
+ "core::NftShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBNftShape>>;
1104
+ "core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
1105
+ "core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
1106
+ "core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
1107
+ "core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
1108
+ "core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
1109
+ "core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
1110
+ "core::UiBackground": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiBackground>>;
1111
+ "core::UiDropdown": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdown>>;
1112
+ "core::UiDropdownResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>>;
1113
+ "core::UiInput": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInput>>;
1114
+ "core::UiInputResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
1115
+ "core::UiText": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
1116
+ "core::UiTransform": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
1117
+ "core::VideoPlayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
1118
+ "core::VisibilityComponent": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
1119
+ };
1120
+
1088
1121
  /**
1089
1122
  * Component types are used to pick the wire protocol and the conflict resolution algorithm
1090
1123
  * @public
@@ -1094,6 +1127,33 @@ export declare const enum ComponentType {
1094
1127
  GrowOnlyValueSet = 1
1095
1128
  }
1096
1129
 
1130
+ /**
1131
+ * @public
1132
+ * @deprecated composite is not being supported so far, please do not use this feature
1133
+ */
1134
+ export declare type Composite = {
1135
+ id: string;
1136
+ components: {
1137
+ name: string;
1138
+ schema?: JsonSchemaExtended;
1139
+ data: Map<Entity, unknown>;
1140
+ }[];
1141
+ };
1142
+
1143
+ /**
1144
+ * @public
1145
+ * @deprecated composite is not being supported so far, please do not use this feature
1146
+ */
1147
+ export declare function compositeFromJson(jsonComposite: any): Composite;
1148
+
1149
+ /**
1150
+ * @public
1151
+ * @deprecated composite is not being supported so far, please do not use this feature
1152
+ */
1153
+ export declare type CompositeProvider = {
1154
+ getCompositeOrNull: (id: string) => Composite | null;
1155
+ };
1156
+
1097
1157
  /**
1098
1158
  * A conflict resolution message is the response to an outdated or invalid state
1099
1159
  * in the CRDT.
@@ -1931,6 +1991,18 @@ export declare type InputEventResult = {
1931
1991
  */
1932
1992
  export declare const inputSystem: IInputSystem;
1933
1993
 
1994
+ /**
1995
+ * Instance a composite and returns its root entity
1996
+ * @param compositeData state serialized by the CRDT protocol
1997
+ * @param getNextAvailableEntity function that gives unused entities
1998
+ * @param rootEntity (optional) suggested mapped rootEntity for the composite
1999
+ *
2000
+ * @public
2001
+ * @deprecated composite is not being supported so far, please do not use this feature
2002
+ *
2003
+ */
2004
+ export declare function instanceComposite(engine: IEngine, compositeData: Composite, getNextAvailableEntity: () => Entity | null, compositeProvider: CompositeProvider, rootEntity?: Entity, alreadyRequestedId?: Set<string>): Entity;
2005
+
1934
2006
  /**
1935
2007
  * @public
1936
2008
  */
@@ -4654,6 +4726,12 @@ export declare namespace Schemas {
4654
4726
  const Map: <T extends Spec>(spec: T, defaultValue?: Partial<MapResult<T>> | undefined) => ISchema<MapResult<T>>;
4655
4727
  /** @public */
4656
4728
  const Optional: <T>(spec: ISchema<T>) => ISchema<T | undefined>;
4729
+ /**
4730
+ * @public Create an ISchema object from the json-schema
4731
+ * @param jsonSchema
4732
+ * @returns a ISchema or fail for unsupported json-schema
4733
+ */
4734
+ const fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
4657
4735
  }
4658
4736
 
4659
4737
  /**
@@ -1085,6 +1085,39 @@ export declare type Color4Type = {
1085
1085
  */
1086
1086
  export declare type ComponentDefinition<T> = LastWriteWinElementSetComponentDefinition<T> | GrowOnlyValueSetComponentDefinition<T>;
1087
1087
 
1088
+ /** public */
1089
+ export declare const componentDefinitionByName: {
1090
+ "core::Animator": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAnimator>>;
1091
+ "core::AudioSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioSource>>;
1092
+ "core::AudioStream": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAudioStream>>;
1093
+ "core::AvatarAttach": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarAttach>>;
1094
+ "core::AvatarModifierArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>>;
1095
+ "core::AvatarShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBAvatarShape>>;
1096
+ "core::Billboard": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBBillboard>>;
1097
+ "core::CameraMode": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraMode>>;
1098
+ "core::CameraModeArea": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBCameraModeArea>>;
1099
+ "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
1100
+ "core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
1101
+ "core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
1102
+ "core::MeshRenderer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshRenderer>>;
1103
+ "core::NftShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBNftShape>>;
1104
+ "core::PointerEvents": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerEvents>>;
1105
+ "core::PointerEventsResult": GSetComponentGetter<GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>>;
1106
+ "core::PointerLock": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBPointerLock>>;
1107
+ "core::Raycast": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycast>>;
1108
+ "core::RaycastResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBRaycastResult>>;
1109
+ "core::TextShape": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBTextShape>>;
1110
+ "core::UiBackground": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiBackground>>;
1111
+ "core::UiDropdown": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdown>>;
1112
+ "core::UiDropdownResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>>;
1113
+ "core::UiInput": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInput>>;
1114
+ "core::UiInputResult": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiInputResult>>;
1115
+ "core::UiText": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiText>>;
1116
+ "core::UiTransform": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBUiTransform>>;
1117
+ "core::VideoPlayer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVideoPlayer>>;
1118
+ "core::VisibilityComponent": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>>;
1119
+ };
1120
+
1088
1121
  /**
1089
1122
  * Component types are used to pick the wire protocol and the conflict resolution algorithm
1090
1123
  * @public
@@ -1094,6 +1127,33 @@ export declare const enum ComponentType {
1094
1127
  GrowOnlyValueSet = 1
1095
1128
  }
1096
1129
 
1130
+ /**
1131
+ * @public
1132
+ * @deprecated composite is not being supported so far, please do not use this feature
1133
+ */
1134
+ export declare type Composite = {
1135
+ id: string;
1136
+ components: {
1137
+ name: string;
1138
+ schema?: JsonSchemaExtended;
1139
+ data: Map<Entity, unknown>;
1140
+ }[];
1141
+ };
1142
+
1143
+ /**
1144
+ * @public
1145
+ * @deprecated composite is not being supported so far, please do not use this feature
1146
+ */
1147
+ export declare function compositeFromJson(jsonComposite: any): Composite;
1148
+
1149
+ /**
1150
+ * @public
1151
+ * @deprecated composite is not being supported so far, please do not use this feature
1152
+ */
1153
+ export declare type CompositeProvider = {
1154
+ getCompositeOrNull: (id: string) => Composite | null;
1155
+ };
1156
+
1097
1157
  /**
1098
1158
  * A conflict resolution message is the response to an outdated or invalid state
1099
1159
  * in the CRDT.
@@ -1931,6 +1991,18 @@ export declare type InputEventResult = {
1931
1991
  */
1932
1992
  export declare const inputSystem: IInputSystem;
1933
1993
 
1994
+ /**
1995
+ * Instance a composite and returns its root entity
1996
+ * @param compositeData state serialized by the CRDT protocol
1997
+ * @param getNextAvailableEntity function that gives unused entities
1998
+ * @param rootEntity (optional) suggested mapped rootEntity for the composite
1999
+ *
2000
+ * @public
2001
+ * @deprecated composite is not being supported so far, please do not use this feature
2002
+ *
2003
+ */
2004
+ export declare function instanceComposite(engine: IEngine, compositeData: Composite, getNextAvailableEntity: () => Entity | null, compositeProvider: CompositeProvider, rootEntity?: Entity, alreadyRequestedId?: Set<string>): Entity;
2005
+
1934
2006
  /**
1935
2007
  * @public
1936
2008
  */
@@ -4654,6 +4726,12 @@ export declare namespace Schemas {
4654
4726
  const Map: <T extends Spec>(spec: T, defaultValue?: Partial<MapResult<T>> | undefined) => ISchema<MapResult<T>>;
4655
4727
  /** @public */
4656
4728
  const Optional: <T>(spec: ISchema<T>) => ISchema<T | undefined>;
4729
+ /**
4730
+ * @public Create an ISchema object from the json-schema
4731
+ * @param jsonSchema
4732
+ * @returns a ISchema or fail for unsupported json-schema
4733
+ */
4734
+ const fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
4657
4735
  }
4658
4736
 
4659
4737
  /**
package/dist/index.js CHANGED
@@ -12939,6 +12939,38 @@
12939
12939
  /** @public */ const UiTransform$1 = engine => engine.defineComponentFromSchema("core::UiTransform", UiTransformSchema);
12940
12940
  /** @public */ const VideoPlayer$1 = engine => engine.defineComponentFromSchema("core::VideoPlayer", VideoPlayerSchema);
12941
12941
  /** @public */ const VisibilityComponent$1 = engine => engine.defineComponentFromSchema("core::VisibilityComponent", VisibilityComponentSchema);
12942
+ /** public */
12943
+ const componentDefinitionByName = {
12944
+ "core::Animator": Animator$2,
12945
+ "core::AudioSource": AudioSource$1,
12946
+ "core::AudioStream": AudioStream$1,
12947
+ "core::AvatarAttach": AvatarAttach$1,
12948
+ "core::AvatarModifierArea": AvatarModifierArea$1,
12949
+ "core::AvatarShape": AvatarShape$1,
12950
+ "core::Billboard": Billboard$1,
12951
+ "core::CameraMode": CameraMode$1,
12952
+ "core::CameraModeArea": CameraModeArea$1,
12953
+ "core::GltfContainer": GltfContainer$1,
12954
+ "core::Material": Material$2,
12955
+ "core::MeshCollider": MeshCollider$2,
12956
+ "core::MeshRenderer": MeshRenderer$2,
12957
+ "core::NftShape": NftShape$1,
12958
+ "core::PointerEvents": PointerEvents$1,
12959
+ "core::PointerEventsResult": PointerEventsResult$1,
12960
+ "core::PointerLock": PointerLock$1,
12961
+ "core::Raycast": Raycast$1,
12962
+ "core::RaycastResult": RaycastResult$1,
12963
+ "core::TextShape": TextShape$1,
12964
+ "core::UiBackground": UiBackground$1,
12965
+ "core::UiDropdown": UiDropdown$1,
12966
+ "core::UiDropdownResult": UiDropdownResult$1,
12967
+ "core::UiInput": UiInput$1,
12968
+ "core::UiInputResult": UiInputResult$1,
12969
+ "core::UiText": UiText$1,
12970
+ "core::UiTransform": UiTransform$1,
12971
+ "core::VideoPlayer": VideoPlayer$1,
12972
+ "core::VisibilityComponent": VisibilityComponent$1,
12973
+ };
12942
12974
 
12943
12975
  function defineAnimatorComponent(engine) {
12944
12976
  const theComponent = Animator$2(engine);
@@ -13322,7 +13354,8 @@
13322
13354
  get YGOverflow () { return exports.YGOverflow; },
13323
13355
  get YGPositionType () { return exports.YGPositionType; },
13324
13356
  get YGUnit () { return exports.YGUnit; },
13325
- get YGWrap () { return exports.YGWrap; }
13357
+ get YGWrap () { return exports.YGWrap; },
13358
+ componentDefinitionByName: componentDefinitionByName
13326
13359
  });
13327
13360
 
13328
13361
  /**
@@ -13931,6 +13964,57 @@
13931
13964
  };
13932
13965
  };
13933
13966
 
13967
+ const primitiveSchemas = {
13968
+ [Bool.jsonSchema.serializationType]: Bool,
13969
+ [EcsString.jsonSchema.serializationType]: EcsString,
13970
+ [Float32.jsonSchema.serializationType]: Float32,
13971
+ [Float64.jsonSchema.serializationType]: Float64,
13972
+ [Int8.jsonSchema.serializationType]: Int8,
13973
+ [Int16.jsonSchema.serializationType]: Int16,
13974
+ [Int32.jsonSchema.serializationType]: Int32,
13975
+ [Int64.jsonSchema.serializationType]: Int64,
13976
+ [Vector3Schema.jsonSchema.serializationType]: Vector3Schema,
13977
+ [QuaternionSchema.jsonSchema.serializationType]: QuaternionSchema,
13978
+ [Color3Schema.jsonSchema.serializationType]: Color3Schema,
13979
+ [Color4Schema.jsonSchema.serializationType]: Color4Schema,
13980
+ [EntitySchema.jsonSchema.serializationType]: EntitySchema
13981
+ };
13982
+ /**
13983
+ * Create an ISchema object from the json-schema
13984
+ * @param jsonSchema
13985
+ * @returns a ISchema or fail for unsupported json-schema
13986
+ */
13987
+ function jsonSchemaToSchema(jsonSchema) {
13988
+ if (primitiveSchemas[jsonSchema.serializationType]) {
13989
+ return primitiveSchemas[jsonSchema.serializationType];
13990
+ }
13991
+ if (jsonSchema.serializationType === 'map') {
13992
+ const mapJsonSchema = jsonSchema;
13993
+ const spec = {};
13994
+ for (const key in mapJsonSchema.properties) {
13995
+ spec[key] = jsonSchemaToSchema(mapJsonSchema.properties[key]);
13996
+ }
13997
+ return IMap(spec);
13998
+ }
13999
+ if (jsonSchema.serializationType === 'optional') {
14000
+ const withItemsJsonSchema = jsonSchema;
14001
+ return IOptional(jsonSchemaToSchema(withItemsJsonSchema.optionalJsonSchema));
14002
+ }
14003
+ if (jsonSchema.serializationType === 'array') {
14004
+ const withItemsJsonSchema = jsonSchema;
14005
+ return IArray(jsonSchemaToSchema(withItemsJsonSchema.items));
14006
+ }
14007
+ if (jsonSchema.serializationType === 'enum-int') {
14008
+ const enumJsonSchema = jsonSchema;
14009
+ return IntEnum(enumJsonSchema.enumObject, enumJsonSchema.default);
14010
+ }
14011
+ if (jsonSchema.serializationType === 'enum-string') {
14012
+ const enumJsonSchema = jsonSchema;
14013
+ return StringEnum(enumJsonSchema.enumObject, enumJsonSchema.default);
14014
+ }
14015
+ throw new Error(`${jsonSchema.serializationType} is not supported as reverse schema generation.`);
14016
+ }
14017
+
13934
14018
  /**
13935
14019
  * @public
13936
14020
  */
@@ -13974,6 +14058,12 @@
13974
14058
  Schemas.Map = IMap;
13975
14059
  /** @public */
13976
14060
  Schemas.Optional = IOptional;
14061
+ /**
14062
+ * @public Create an ISchema object from the json-schema
14063
+ * @param jsonSchema
14064
+ * @returns a ISchema or fail for unsupported json-schema
14065
+ */
14066
+ Schemas.fromJson = jsonSchemaToSchema;
13977
14067
  })(exports.Schemas || (exports.Schemas = {}));
13978
14068
 
13979
14069
  /**
@@ -15756,16 +15846,16 @@
15756
15846
  componentsDefinition.set(componentId, newComponent);
15757
15847
  return newComponent;
15758
15848
  }
15759
- function getComponent(value) {
15760
- const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15849
+ function getComponent(componentIdOrName) {
15850
+ const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
15761
15851
  const component = componentsDefinition.get(componentId);
15762
15852
  if (!component) {
15763
15853
  throw new Error(`Component ${componentId} not found. You need to declare the components at the beginnig of the engine declaration`);
15764
15854
  }
15765
15855
  return component;
15766
15856
  }
15767
- function getComponentOrNull(value) {
15768
- const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15857
+ function getComponentOrNull(componentIdOrName) {
15858
+ const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
15769
15859
  return (componentsDefinition.get(componentId) ??
15770
15860
  /* istanbul ignore next */
15771
15861
  null);
@@ -15796,7 +15886,10 @@
15796
15886
  function componentsIter() {
15797
15887
  return componentsDefinition.values();
15798
15888
  }
15799
- function removeComponentDefinition(componentId) {
15889
+ function removeComponentDefinition(componentIdOrName) {
15890
+ if (sealed)
15891
+ throw new Error('Engine is already sealed. No components can be removed at this stage');
15892
+ const componentId = typeof componentIdOrName === 'number' ? componentIdOrName : componentNumberFromName(componentIdOrName);
15800
15893
  componentsDefinition.delete(componentId);
15801
15894
  }
15802
15895
  const Transform = Transform$1({ defineComponentFromSchema });
@@ -16184,6 +16277,176 @@
16184
16277
  Font[Font["F_MONOSPACE"] = 2] = "F_MONOSPACE";
16185
16278
  })(exports.Font || (exports.Font = {}));
16186
16279
 
16280
+ /**
16281
+ * @public
16282
+ * @deprecated composite is not being supported so far, please do not use this feature
16283
+ */
16284
+ function compositeFromJson(jsonComposite) {
16285
+ if (!jsonComposite)
16286
+ throw new Error('Composite is not well defined');
16287
+ if (!jsonComposite.id || typeof jsonComposite.id !== 'string')
16288
+ throw new Error("Composite doesn't have a valid `id` field");
16289
+ const compositeId = jsonComposite.id;
16290
+ // TODO: Should be there a .version to identify the schema version?
16291
+ if (!Array.isArray(jsonComposite.components))
16292
+ throw new Error(`Composite '${compositeId}' fields 'components' is not an array`);
16293
+ const composite = {
16294
+ id: compositeId,
16295
+ components: []
16296
+ };
16297
+ for (const component of jsonComposite.components) {
16298
+ if (!component.name || typeof component.name !== 'string')
16299
+ throw new Error(`Composite '${compositeId}': The component doesn't have a valid name`);
16300
+ const componentName = component.name;
16301
+ const componentData = new Map();
16302
+ if (typeof component.data !== 'object' || Array.isArray(component.data))
16303
+ throw new Error(`Composite '${compositeId}': Invalid data in component '${component.name}'`);
16304
+ for (const [entityStr, data] of Object.entries(component.data)) {
16305
+ const entity = parseInt(entityStr);
16306
+ componentData.set(entity, data);
16307
+ }
16308
+ composite.components.push({
16309
+ name: componentName,
16310
+ data: componentData,
16311
+ schema: component.schema
16312
+ });
16313
+ }
16314
+ return composite;
16315
+ }
16316
+
16317
+ /**
16318
+ * @public
16319
+ * @deprecated composite is not being supported so far, please do not use this feature
16320
+ */
16321
+ function getCompositeRootComponent(engine) {
16322
+ const component = engine.getComponentOrNull('composite::root');
16323
+ if (component) {
16324
+ return component;
16325
+ }
16326
+ return engine.defineComponent('composite::root', {
16327
+ id: exports.Schemas.String,
16328
+ entities: exports.Schemas.Array(exports.Schemas.Map({
16329
+ src: exports.Schemas.Entity,
16330
+ dest: exports.Schemas.Entity
16331
+ }))
16332
+ });
16333
+ }
16334
+
16335
+ /**
16336
+ * Return the entity mapping or fail if there is no more
16337
+ */
16338
+ function getEntityMapping(compositeEntity, mappedEntities, getNextAvailableEntity) {
16339
+ const existingEntity = mappedEntities.get(compositeEntity);
16340
+ if (existingEntity) {
16341
+ return existingEntity;
16342
+ }
16343
+ // This function in runtime can be just `engine.addEntity()`
16344
+ const newEntity = getNextAvailableEntity();
16345
+ if (newEntity === null) {
16346
+ throw new Error('There is no more entities to allocate');
16347
+ }
16348
+ mappedEntities.set(compositeEntity, newEntity);
16349
+ return newEntity;
16350
+ }
16351
+ /**
16352
+ * Instance a composite and returns its root entity
16353
+ * @param compositeData state serialized by the CRDT protocol
16354
+ * @param getNextAvailableEntity function that gives unused entities
16355
+ * @param rootEntity (optional) suggested mapped rootEntity for the composite
16356
+ *
16357
+ * @public
16358
+ * @deprecated composite is not being supported so far, please do not use this feature
16359
+ *
16360
+ */
16361
+
16362
+ function instanceComposite(engine, compositeData, getNextAvailableEntity, compositeProvider, rootEntity, alreadyRequestedId = new Set()) {
16363
+ const TransformComponentNumber = componentNumberFromName('core::Transform');
16364
+ const CompositeRootComponent = getCompositeRootComponent(engine);
16365
+ // Key => EntityNumber from the composite
16366
+ // Value => EntityNumber in current engine
16367
+ const mappedEntities = new Map();
16368
+ const getCompositeEntity = (compositeEntity) => getEntityMapping(compositeEntity, mappedEntities, getNextAvailableEntity);
16369
+ // ## 1 ##
16370
+ // First entity that I want to map, the root entity from the composite to the target entity in the engine
16371
+ // If there is no `rootEntity` passed, we assign one from `getNextAvailableEntity`
16372
+ const compositeRootEntity = rootEntity ?? getCompositeEntity(0);
16373
+ if (rootEntity) {
16374
+ mappedEntities.set(0, rootEntity);
16375
+ }
16376
+ // ## 2 ##
16377
+ // If there are more composite inside this one, we instance first.
16378
+ // => This is not only a copy, we need to instance. Otherwise, we'd be missing that branches
16379
+ // => TODO: in the future, the instanciation is first, then the overides (to parameterize Composite, e.g. house with different wall colors)
16380
+ const childrenComposite = compositeData.components.find((item) => item.name === CompositeRootComponent.componentName);
16381
+ if (childrenComposite) {
16382
+ for (const [entity, childComposite] of childrenComposite.data) {
16383
+ const compositeRoot = childComposite;
16384
+ const composite = compositeProvider.getCompositeOrNull(compositeRoot.id);
16385
+ if (composite) {
16386
+ if (alreadyRequestedId.has(compositeRoot.id) || compositeRoot.id === compositeData.id) {
16387
+ throw new Error(`Composite ${compositeRoot.id} has a recursive instanciation while try to instance ${compositeData.id}. Previous instances: ${alreadyRequestedId.toString()}`);
16388
+ }
16389
+ instanceComposite(engine, composite, getNextAvailableEntity, compositeProvider, entity, new Set(alreadyRequestedId).add(compositeData.id));
16390
+ }
16391
+ }
16392
+ }
16393
+ // ## 3 ##
16394
+ // Then, we copy the all rest of the components (skipping the Composite ones)
16395
+ for (const component of compositeData.components) {
16396
+ // We already instanced the composite
16397
+ if (component.name === CompositeRootComponent.componentName)
16398
+ continue;
16399
+ // ## 3a ##
16400
+ // We find the component definition
16401
+ let componentDefinition;
16402
+ const existingComponentDefinition = engine.getComponentOrNull(component.name);
16403
+ if (!existingComponentDefinition) {
16404
+ if (component.schema) {
16405
+ componentDefinition = engine.defineComponentFromSchema(component.name, exports.Schemas.fromJson(component.schema));
16406
+ }
16407
+ else if (component.name.startsWith('core::')) {
16408
+ if (component.name in componentDefinitionByName) {
16409
+ componentDefinition = componentDefinitionByName[component.name](engine);
16410
+ }
16411
+ else {
16412
+ throw new Error(`The core component ${component.name} was not found.`);
16413
+ }
16414
+ }
16415
+ else {
16416
+ throw new Error(`${component.name} is not defined and there is no schema to define it.`);
16417
+ }
16418
+ }
16419
+ else {
16420
+ componentDefinition = existingComponentDefinition;
16421
+ }
16422
+ // ## 3b ##
16423
+ // Iterating over all the entities with this component and create the replica
16424
+ for (const [entity, compositeComponentValue] of component.data) {
16425
+ const targetEntity = getCompositeEntity(entity);
16426
+ const componentValue = componentDefinition.create(targetEntity, compositeComponentValue);
16427
+ // ## 3c ##
16428
+ // All entities referenced in the composite probably has a different resolved EntityNumber
16429
+ // We'll know with the mappedEntityes
16430
+ if (componentDefinition.componentId === TransformComponentNumber) {
16431
+ const transform = componentValue;
16432
+ if (transform.parent) {
16433
+ transform.parent = getCompositeEntity(transform.parent);
16434
+ }
16435
+ // TODO: is it going to be necessary to remap assets? e.g. src param from AudioSource and GltfContainer
16436
+ }
16437
+ }
16438
+ }
16439
+ const composite = CompositeRootComponent.getMutableOrNull(compositeRootEntity) || CompositeRootComponent.create(compositeRootEntity);
16440
+ for (const [entitySource, targetEntity] of mappedEntities) {
16441
+ composite.entities.push({
16442
+ src: entitySource,
16443
+ dest: targetEntity
16444
+ });
16445
+ }
16446
+ composite.id = compositeData.id;
16447
+ return compositeRootEntity;
16448
+ }
16449
+
16187
16450
  // The order of the following imports matters. Please do not auto-sort
16188
16451
  // export components for global engine
16189
16452
  const Transform = Transform$1(engine);
@@ -42937,7 +43200,9 @@
42937
43200
  exports.VideoPlayer = VideoPlayer;
42938
43201
  exports.VideoTexture = VideoTexture;
42939
43202
  exports.VisibilityComponent = VisibilityComponent;
43203
+ exports.componentDefinitionByName = componentDefinitionByName;
42940
43204
  exports.components = index;
43205
+ exports.compositeFromJson = compositeFromJson;
42941
43206
  exports.createEthereumProvider = createEthereumProvider;
42942
43207
  exports.createInputSystem = createInputSystem;
42943
43208
  exports.createPointerEventSystem = createPointerEventSystem;
@@ -42948,6 +43213,7 @@
42948
43213
  exports.engine = engine;
42949
43214
  exports.executeTask = executeTask;
42950
43215
  exports.inputSystem = inputSystem;
43216
+ exports.instanceComposite = instanceComposite;
42951
43217
  exports.isListener = isListener;
42952
43218
  exports.onCommsMessage = onCommsMessage;
42953
43219
  exports.onEnterScene = onEnterScene;