@dcl/ecs 7.0.6-3713220614.commit-d02ef9f → 7.0.6-3741197705.commit-bb37667

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.
@@ -1,9 +1,9 @@
1
- import { ComponentDefinition, Entity, IEngine, ISchema } from '../../engine';
1
+ import { ComponentDefinition, Entity, IEngine } from '../../engine';
2
2
  import { PBAnimationState, PBAnimator } from '../generated/pb/decentraland/sdk/components/animator.gen';
3
3
  /**
4
4
  * @public
5
5
  */
6
- export declare type AnimatorComponentDefinition = ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
6
+ export declare type AnimatorComponentDefinition = ComponentDefinition<PBAnimator>;
7
7
  /**
8
8
  * @public
9
9
  */
@@ -1,10 +1,10 @@
1
- import { ComponentDefinition, Entity, IEngine, ISchema } from '../../engine';
1
+ import { ComponentDefinition, Entity, IEngine } from '../../engine';
2
2
  import { PBMaterial, PBMaterial_PbrMaterial, PBMaterial_UnlitMaterial } from '../generated/index.gen';
3
3
  import { AvatarTexture, Texture, TextureUnion } from '../generated/types.gen';
4
4
  /**
5
5
  * @public
6
6
  */
7
- export declare type MaterialComponentDefinition = ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
7
+ export declare type MaterialComponentDefinition = ComponentDefinition<PBMaterial>;
8
8
  /**
9
9
  * @public
10
10
  */
@@ -1,9 +1,9 @@
1
- import { ComponentDefinition, Entity, IEngine, ISchema } from '../../engine';
1
+ import { ComponentDefinition, Entity, IEngine } from '../../engine';
2
2
  import { ColliderLayer, PBMeshCollider } from '../generated/index.gen';
3
3
  /**
4
4
  * @public
5
5
  */
6
- export declare type MeshColliderComponentDefinition = ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
6
+ export declare type MeshColliderComponentDefinition = ComponentDefinition<PBMeshCollider>;
7
7
  /**
8
8
  * @public
9
9
  */
@@ -1,9 +1,9 @@
1
- import { ComponentDefinition, Entity, IEngine, ISchema } from '../../engine';
1
+ import { ComponentDefinition, Entity, IEngine } from '../../engine';
2
2
  import { PBMeshRenderer } from '../generated/index.gen';
3
3
  /**
4
4
  * @public
5
5
  */
6
- export declare type MeshRendererComponentDefinition = ComponentDefinition<ISchema<PBMeshRenderer>, PBMeshRenderer>;
6
+ export declare type MeshRendererComponentDefinition = ComponentDefinition<PBMeshRenderer>;
7
7
  /**
8
8
  * @public
9
9
  */
@@ -1,42 +1,42 @@
1
1
  import { ComponentDefinition } from '../../engine/component';
2
2
  export * from './index.gen';
3
- import { AudioSourceSchema } from './index.gen';
4
- import { AudioStreamSchema } from './index.gen';
5
- import { AvatarAttachSchema } from './index.gen';
6
- import { AvatarModifierAreaSchema } from './index.gen';
7
- import { AvatarShapeSchema } from './index.gen';
8
- import { BillboardSchema } from './index.gen';
9
- import { CameraModeSchema } from './index.gen';
10
- import { CameraModeAreaSchema } from './index.gen';
11
- import { GltfContainerSchema } from './index.gen';
12
- import { NftShapeSchema } from './index.gen';
13
- import { PointerEventsResultSchema } from './index.gen';
14
- import { PointerHoverFeedbackSchema } from './index.gen';
15
- import { PointerLockSchema } from './index.gen';
16
- import { RaycastSchema } from './index.gen';
17
- import { RaycastResultSchema } from './index.gen';
18
- import { TextShapeSchema } from './index.gen';
19
- import { UiBackgroundSchema } from './index.gen';
20
- import { UiTextSchema } from './index.gen';
21
- import { UiTransformSchema } from './index.gen';
22
- import { VisibilityComponentSchema } from './index.gen';
23
- /** @public */ export declare const AudioSource: ComponentDefinition<typeof AudioSourceSchema>;
24
- /** @public */ export declare const AudioStream: ComponentDefinition<typeof AudioStreamSchema>;
25
- /** @public */ export declare const AvatarAttach: ComponentDefinition<typeof AvatarAttachSchema>;
26
- /** @public */ export declare const AvatarModifierArea: ComponentDefinition<typeof AvatarModifierAreaSchema>;
27
- /** @public */ export declare const AvatarShape: ComponentDefinition<typeof AvatarShapeSchema>;
28
- /** @public */ export declare const Billboard: ComponentDefinition<typeof BillboardSchema>;
29
- /** @public */ export declare const CameraMode: ComponentDefinition<typeof CameraModeSchema>;
30
- /** @public */ export declare const CameraModeArea: ComponentDefinition<typeof CameraModeAreaSchema>;
31
- /** @public */ export declare const GltfContainer: ComponentDefinition<typeof GltfContainerSchema>;
32
- /** @public */ export declare const NftShape: ComponentDefinition<typeof NftShapeSchema>;
33
- /** @public */ export declare const PointerEventsResult: ComponentDefinition<typeof PointerEventsResultSchema>;
34
- /** @public */ export declare const PointerHoverFeedback: ComponentDefinition<typeof PointerHoverFeedbackSchema>;
35
- /** @public */ export declare const PointerLock: ComponentDefinition<typeof PointerLockSchema>;
36
- /** @public */ export declare const Raycast: ComponentDefinition<typeof RaycastSchema>;
37
- /** @public */ export declare const RaycastResult: ComponentDefinition<typeof RaycastResultSchema>;
38
- /** @public */ export declare const TextShape: ComponentDefinition<typeof TextShapeSchema>;
39
- /** @public */ export declare const UiBackground: ComponentDefinition<typeof UiBackgroundSchema>;
40
- /** @public */ export declare const UiText: ComponentDefinition<typeof UiTextSchema>;
41
- /** @public */ export declare const UiTransform: ComponentDefinition<typeof UiTransformSchema>;
42
- /** @public */ export declare const VisibilityComponent: ComponentDefinition<typeof VisibilityComponentSchema>;
3
+ import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
4
+ import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
5
+ import { PBAvatarAttach } from './pb/decentraland/sdk/components/avatar_attach.gen';
6
+ import { PBAvatarModifierArea } from './pb/decentraland/sdk/components/avatar_modifier_area.gen';
7
+ import { PBAvatarShape } from './pb/decentraland/sdk/components/avatar_shape.gen';
8
+ import { PBBillboard } from './pb/decentraland/sdk/components/billboard.gen';
9
+ import { PBCameraMode } from './pb/decentraland/sdk/components/camera_mode.gen';
10
+ import { PBCameraModeArea } from './pb/decentraland/sdk/components/camera_mode_area.gen';
11
+ import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
12
+ import { PBNftShape } from './pb/decentraland/sdk/components/nft_shape.gen';
13
+ import { PBPointerEventsResult } from './pb/decentraland/sdk/components/pointer_events_result.gen';
14
+ import { PBPointerHoverFeedback } from './pb/decentraland/sdk/components/pointer_hover_feedback.gen';
15
+ import { PBPointerLock } from './pb/decentraland/sdk/components/pointer_lock.gen';
16
+ import { PBRaycast } from './pb/decentraland/sdk/components/raycast.gen';
17
+ import { PBRaycastResult } from './pb/decentraland/sdk/components/raycast_result.gen';
18
+ import { PBTextShape } from './pb/decentraland/sdk/components/text_shape.gen';
19
+ import { PBUiBackground } from './pb/decentraland/sdk/components/ui_background.gen';
20
+ import { PBUiText } from './pb/decentraland/sdk/components/ui_text.gen';
21
+ import { PBUiTransform } from './pb/decentraland/sdk/components/ui_transform.gen';
22
+ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
23
+ /** @public */ export declare const AudioSource: ComponentDefinition<PBAudioSource>;
24
+ /** @public */ export declare const AudioStream: ComponentDefinition<PBAudioStream>;
25
+ /** @public */ export declare const AvatarAttach: ComponentDefinition<PBAvatarAttach>;
26
+ /** @public */ export declare const AvatarModifierArea: ComponentDefinition<PBAvatarModifierArea>;
27
+ /** @public */ export declare const AvatarShape: ComponentDefinition<PBAvatarShape>;
28
+ /** @public */ export declare const Billboard: ComponentDefinition<PBBillboard>;
29
+ /** @public */ export declare const CameraMode: ComponentDefinition<PBCameraMode>;
30
+ /** @public */ export declare const CameraModeArea: ComponentDefinition<PBCameraModeArea>;
31
+ /** @public */ export declare const GltfContainer: ComponentDefinition<PBGltfContainer>;
32
+ /** @public */ export declare const NftShape: ComponentDefinition<PBNftShape>;
33
+ /** @public */ export declare const PointerEventsResult: ComponentDefinition<PBPointerEventsResult>;
34
+ /** @public */ export declare const PointerHoverFeedback: ComponentDefinition<PBPointerHoverFeedback>;
35
+ /** @public */ export declare const PointerLock: ComponentDefinition<PBPointerLock>;
36
+ /** @public */ export declare const Raycast: ComponentDefinition<PBRaycast>;
37
+ /** @public */ export declare const RaycastResult: ComponentDefinition<PBRaycastResult>;
38
+ /** @public */ export declare const TextShape: ComponentDefinition<PBTextShape>;
39
+ /** @public */ export declare const UiBackground: ComponentDefinition<PBUiBackground>;
40
+ /** @public */ export declare const UiText: ComponentDefinition<PBUiText>;
41
+ /** @public */ export declare const UiTransform: ComponentDefinition<PBUiTransform>;
42
+ /** @public */ export declare const VisibilityComponent: ComponentDefinition<PBVisibilityComponent>;
@@ -1,53 +1,29 @@
1
1
  import type { IEngine } from '../../engine/types';
2
2
  import { ComponentDefinition } from '../../engine/component';
3
- import { AnimatorSchema } from './Animator.gen';
4
- export { AnimatorSchema };
5
- import { AudioSourceSchema } from './AudioSource.gen';
6
- export { AudioSourceSchema };
7
- import { AudioStreamSchema } from './AudioStream.gen';
8
- export { AudioStreamSchema };
9
- import { AvatarAttachSchema } from './AvatarAttach.gen';
10
- export { AvatarAttachSchema };
11
- import { AvatarModifierAreaSchema } from './AvatarModifierArea.gen';
12
- export { AvatarModifierAreaSchema };
13
- import { AvatarShapeSchema } from './AvatarShape.gen';
14
- export { AvatarShapeSchema };
15
- import { BillboardSchema } from './Billboard.gen';
16
- export { BillboardSchema };
17
- import { CameraModeSchema } from './CameraMode.gen';
18
- export { CameraModeSchema };
19
- import { CameraModeAreaSchema } from './CameraModeArea.gen';
20
- export { CameraModeAreaSchema };
21
- import { GltfContainerSchema } from './GltfContainer.gen';
22
- export { GltfContainerSchema };
23
- import { MaterialSchema } from './Material.gen';
24
- export { MaterialSchema };
25
- import { MeshColliderSchema } from './MeshCollider.gen';
26
- export { MeshColliderSchema };
27
- import { MeshRendererSchema } from './MeshRenderer.gen';
28
- export { MeshRendererSchema };
29
- import { NftShapeSchema } from './NftShape.gen';
30
- export { NftShapeSchema };
31
- import { PointerEventsResultSchema } from './PointerEventsResult.gen';
32
- export { PointerEventsResultSchema };
33
- import { PointerHoverFeedbackSchema } from './PointerHoverFeedback.gen';
34
- export { PointerHoverFeedbackSchema };
35
- import { PointerLockSchema } from './PointerLock.gen';
36
- export { PointerLockSchema };
37
- import { RaycastSchema } from './Raycast.gen';
38
- export { RaycastSchema };
39
- import { RaycastResultSchema } from './RaycastResult.gen';
40
- export { RaycastResultSchema };
41
- import { TextShapeSchema } from './TextShape.gen';
42
- export { TextShapeSchema };
43
- import { UiBackgroundSchema } from './UiBackground.gen';
44
- export { UiBackgroundSchema };
45
- import { UiTextSchema } from './UiText.gen';
46
- export { UiTextSchema };
47
- import { UiTransformSchema } from './UiTransform.gen';
48
- export { UiTransformSchema };
49
- import { VisibilityComponentSchema } from './VisibilityComponent.gen';
50
- export { VisibilityComponentSchema };
3
+ import { PBAnimator } from './pb/decentraland/sdk/components/animator.gen';
4
+ import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
5
+ import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
6
+ import { PBAvatarAttach } from './pb/decentraland/sdk/components/avatar_attach.gen';
7
+ import { PBAvatarModifierArea } from './pb/decentraland/sdk/components/avatar_modifier_area.gen';
8
+ import { PBAvatarShape } from './pb/decentraland/sdk/components/avatar_shape.gen';
9
+ import { PBBillboard } from './pb/decentraland/sdk/components/billboard.gen';
10
+ import { PBCameraMode } from './pb/decentraland/sdk/components/camera_mode.gen';
11
+ import { PBCameraModeArea } from './pb/decentraland/sdk/components/camera_mode_area.gen';
12
+ import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
13
+ import { PBMaterial } from './pb/decentraland/sdk/components/material.gen';
14
+ import { PBMeshCollider } from './pb/decentraland/sdk/components/mesh_collider.gen';
15
+ import { PBMeshRenderer } from './pb/decentraland/sdk/components/mesh_renderer.gen';
16
+ import { PBNftShape } from './pb/decentraland/sdk/components/nft_shape.gen';
17
+ import { PBPointerEventsResult } from './pb/decentraland/sdk/components/pointer_events_result.gen';
18
+ import { PBPointerHoverFeedback } from './pb/decentraland/sdk/components/pointer_hover_feedback.gen';
19
+ import { PBPointerLock } from './pb/decentraland/sdk/components/pointer_lock.gen';
20
+ import { PBRaycast } from './pb/decentraland/sdk/components/raycast.gen';
21
+ import { PBRaycastResult } from './pb/decentraland/sdk/components/raycast_result.gen';
22
+ import { PBTextShape } from './pb/decentraland/sdk/components/text_shape.gen';
23
+ import { PBUiBackground } from './pb/decentraland/sdk/components/ui_background.gen';
24
+ import { PBUiText } from './pb/decentraland/sdk/components/ui_text.gen';
25
+ import { PBUiTransform } from './pb/decentraland/sdk/components/ui_transform.gen';
26
+ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
51
27
  export * from './pb/decentraland/sdk/components/animator.gen';
52
28
  export * from './pb/decentraland/sdk/components/audio_source.gen';
53
29
  export * from './pb/decentraland/sdk/components/audio_stream.gen';
@@ -73,27 +49,27 @@ export * from './pb/decentraland/sdk/components/ui_text.gen';
73
49
  export * from './pb/decentraland/sdk/components/ui_transform.gen';
74
50
  export * from './pb/decentraland/sdk/components/visibility_component.gen';
75
51
  export declare type ComponentGetter<T extends ComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
76
- /** @public */ export declare const Animator: ComponentGetter<ComponentDefinition<typeof AnimatorSchema>>;
77
- /** @public */ export declare const AudioSource: ComponentGetter<ComponentDefinition<typeof AudioSourceSchema>>;
78
- /** @public */ export declare const AudioStream: ComponentGetter<ComponentDefinition<typeof AudioStreamSchema>>;
79
- /** @public */ export declare const AvatarAttach: ComponentGetter<ComponentDefinition<typeof AvatarAttachSchema>>;
80
- /** @public */ export declare const AvatarModifierArea: ComponentGetter<ComponentDefinition<typeof AvatarModifierAreaSchema>>;
81
- /** @public */ export declare const AvatarShape: ComponentGetter<ComponentDefinition<typeof AvatarShapeSchema>>;
82
- /** @public */ export declare const Billboard: ComponentGetter<ComponentDefinition<typeof BillboardSchema>>;
83
- /** @public */ export declare const CameraMode: ComponentGetter<ComponentDefinition<typeof CameraModeSchema>>;
84
- /** @public */ export declare const CameraModeArea: ComponentGetter<ComponentDefinition<typeof CameraModeAreaSchema>>;
85
- /** @public */ export declare const GltfContainer: ComponentGetter<ComponentDefinition<typeof GltfContainerSchema>>;
86
- /** @public */ export declare const Material: ComponentGetter<ComponentDefinition<typeof MaterialSchema>>;
87
- /** @public */ export declare const MeshCollider: ComponentGetter<ComponentDefinition<typeof MeshColliderSchema>>;
88
- /** @public */ export declare const MeshRenderer: ComponentGetter<ComponentDefinition<typeof MeshRendererSchema>>;
89
- /** @public */ export declare const NftShape: ComponentGetter<ComponentDefinition<typeof NftShapeSchema>>;
90
- /** @public */ export declare const PointerEventsResult: ComponentGetter<ComponentDefinition<typeof PointerEventsResultSchema>>;
91
- /** @public */ export declare const PointerHoverFeedback: ComponentGetter<ComponentDefinition<typeof PointerHoverFeedbackSchema>>;
92
- /** @public */ export declare const PointerLock: ComponentGetter<ComponentDefinition<typeof PointerLockSchema>>;
93
- /** @public */ export declare const Raycast: ComponentGetter<ComponentDefinition<typeof RaycastSchema>>;
94
- /** @public */ export declare const RaycastResult: ComponentGetter<ComponentDefinition<typeof RaycastResultSchema>>;
95
- /** @public */ export declare const TextShape: ComponentGetter<ComponentDefinition<typeof TextShapeSchema>>;
96
- /** @public */ export declare const UiBackground: ComponentGetter<ComponentDefinition<typeof UiBackgroundSchema>>;
97
- /** @public */ export declare const UiText: ComponentGetter<ComponentDefinition<typeof UiTextSchema>>;
98
- /** @public */ export declare const UiTransform: ComponentGetter<ComponentDefinition<typeof UiTransformSchema>>;
99
- /** @public */ export declare const VisibilityComponent: ComponentGetter<ComponentDefinition<typeof VisibilityComponentSchema>>;
52
+ /** @public */ export declare const Animator: ComponentGetter<ComponentDefinition<PBAnimator>>;
53
+ /** @public */ export declare const AudioSource: ComponentGetter<ComponentDefinition<PBAudioSource>>;
54
+ /** @public */ export declare const AudioStream: ComponentGetter<ComponentDefinition<PBAudioStream>>;
55
+ /** @public */ export declare const AvatarAttach: ComponentGetter<ComponentDefinition<PBAvatarAttach>>;
56
+ /** @public */ export declare const AvatarModifierArea: ComponentGetter<ComponentDefinition<PBAvatarModifierArea>>;
57
+ /** @public */ export declare const AvatarShape: ComponentGetter<ComponentDefinition<PBAvatarShape>>;
58
+ /** @public */ export declare const Billboard: ComponentGetter<ComponentDefinition<PBBillboard>>;
59
+ /** @public */ export declare const CameraMode: ComponentGetter<ComponentDefinition<PBCameraMode>>;
60
+ /** @public */ export declare const CameraModeArea: ComponentGetter<ComponentDefinition<PBCameraModeArea>>;
61
+ /** @public */ export declare const GltfContainer: ComponentGetter<ComponentDefinition<PBGltfContainer>>;
62
+ /** @public */ export declare const Material: ComponentGetter<ComponentDefinition<PBMaterial>>;
63
+ /** @public */ export declare const MeshCollider: ComponentGetter<ComponentDefinition<PBMeshCollider>>;
64
+ /** @public */ export declare const MeshRenderer: ComponentGetter<ComponentDefinition<PBMeshRenderer>>;
65
+ /** @public */ export declare const NftShape: ComponentGetter<ComponentDefinition<PBNftShape>>;
66
+ /** @public */ export declare const PointerEventsResult: ComponentGetter<ComponentDefinition<PBPointerEventsResult>>;
67
+ /** @public */ export declare const PointerHoverFeedback: ComponentGetter<ComponentDefinition<PBPointerHoverFeedback>>;
68
+ /** @public */ export declare const PointerLock: ComponentGetter<ComponentDefinition<PBPointerLock>>;
69
+ /** @public */ export declare const Raycast: ComponentGetter<ComponentDefinition<PBRaycast>>;
70
+ /** @public */ export declare const RaycastResult: ComponentGetter<ComponentDefinition<PBRaycastResult>>;
71
+ /** @public */ export declare const TextShape: ComponentGetter<ComponentDefinition<PBTextShape>>;
72
+ /** @public */ export declare const UiBackground: ComponentGetter<ComponentDefinition<PBUiBackground>>;
73
+ /** @public */ export declare const UiText: ComponentGetter<ComponentDefinition<PBUiText>>;
74
+ /** @public */ export declare const UiTransform: ComponentGetter<ComponentDefinition<PBUiTransform>>;
75
+ /** @public */ export declare const VisibilityComponent: ComponentGetter<ComponentDefinition<PBVisibilityComponent>>;
@@ -1,51 +1,27 @@
1
1
  import { AnimatorSchema } from './Animator.gen';
2
- export { AnimatorSchema };
3
2
  import { AudioSourceSchema } from './AudioSource.gen';
4
- export { AudioSourceSchema };
5
3
  import { AudioStreamSchema } from './AudioStream.gen';
6
- export { AudioStreamSchema };
7
4
  import { AvatarAttachSchema } from './AvatarAttach.gen';
8
- export { AvatarAttachSchema };
9
5
  import { AvatarModifierAreaSchema } from './AvatarModifierArea.gen';
10
- export { AvatarModifierAreaSchema };
11
6
  import { AvatarShapeSchema } from './AvatarShape.gen';
12
- export { AvatarShapeSchema };
13
7
  import { BillboardSchema } from './Billboard.gen';
14
- export { BillboardSchema };
15
8
  import { CameraModeSchema } from './CameraMode.gen';
16
- export { CameraModeSchema };
17
9
  import { CameraModeAreaSchema } from './CameraModeArea.gen';
18
- export { CameraModeAreaSchema };
19
10
  import { GltfContainerSchema } from './GltfContainer.gen';
20
- export { GltfContainerSchema };
21
11
  import { MaterialSchema } from './Material.gen';
22
- export { MaterialSchema };
23
12
  import { MeshColliderSchema } from './MeshCollider.gen';
24
- export { MeshColliderSchema };
25
13
  import { MeshRendererSchema } from './MeshRenderer.gen';
26
- export { MeshRendererSchema };
27
14
  import { NftShapeSchema } from './NftShape.gen';
28
- export { NftShapeSchema };
29
15
  import { PointerEventsResultSchema } from './PointerEventsResult.gen';
30
- export { PointerEventsResultSchema };
31
16
  import { PointerHoverFeedbackSchema } from './PointerHoverFeedback.gen';
32
- export { PointerHoverFeedbackSchema };
33
17
  import { PointerLockSchema } from './PointerLock.gen';
34
- export { PointerLockSchema };
35
18
  import { RaycastSchema } from './Raycast.gen';
36
- export { RaycastSchema };
37
19
  import { RaycastResultSchema } from './RaycastResult.gen';
38
- export { RaycastResultSchema };
39
20
  import { TextShapeSchema } from './TextShape.gen';
40
- export { TextShapeSchema };
41
21
  import { UiBackgroundSchema } from './UiBackground.gen';
42
- export { UiBackgroundSchema };
43
22
  import { UiTextSchema } from './UiText.gen';
44
- export { UiTextSchema };
45
23
  import { UiTransformSchema } from './UiTransform.gen';
46
- export { UiTransformSchema };
47
24
  import { VisibilityComponentSchema } from './VisibilityComponent.gen';
48
- export { VisibilityComponentSchema };
49
25
  export * from './pb/decentraland/sdk/components/animator.gen';
50
26
  export * from './pb/decentraland/sdk/components/audio_source.gen';
51
27
  export * from './pb/decentraland/sdk/components/audio_stream.gen';
@@ -1,14 +1,14 @@
1
1
  import { ISchema } from '../engine';
2
- import { ComponentGetter } from './generated/index.gen';
3
- export * from './generated/index.gen';
4
- import { TransformComponent } from './legacy/Transform';
2
+ import { ComponentDefinition } from '../engine/component';
5
3
  import { AnimatorComponentDefinitionExtended } from './extended/Animator';
4
+ import { MaterialComponentDefinitionExtended } from './extended/Material';
6
5
  import { MeshColliderComponentDefinitionExtended } from './extended/MeshCollider';
7
6
  import { MeshRendererComponentDefinitionExtended } from './extended/MeshRenderer';
8
- import { MaterialComponentDefinitionExtended } from './extended/Material';
9
- import { ComponentDefinition } from '../engine/component';
7
+ import { ComponentGetter } from './generated/index.gen';
8
+ import { TransformComponentExtended } from './legacy/Transform';
9
+ export * from './generated/index.gen';
10
10
  export { ISchema, ComponentDefinition };
11
- export declare const Transform: ComponentGetter<TransformComponent>;
11
+ export declare const Transform: ComponentGetter<TransformComponentExtended>;
12
12
  export declare const Material: ComponentGetter<MaterialComponentDefinitionExtended>;
13
13
  export declare const Animator: ComponentGetter<AnimatorComponentDefinitionExtended>;
14
14
  export declare const MeshRenderer: ComponentGetter<MeshRendererComponentDefinitionExtended>;
@@ -1,9 +1,9 @@
1
- export * from './generated/index.gen';
2
- import { defineTransformComponent } from './legacy/Transform';
3
1
  import { defineAnimatorComponent } from './extended/Animator';
2
+ import { defineMaterialComponent } from './extended/Material';
4
3
  import { defineMeshColliderComponent } from './extended/MeshCollider';
5
4
  import { defineMeshRendererComponent } from './extended/MeshRenderer';
6
- import { defineMaterialComponent } from './extended/Material';
5
+ import { defineTransformComponent } from './legacy/Transform';
6
+ export * from './generated/index.gen';
7
7
  /*#__PURE__*/
8
8
  export const Transform = (engine) => defineTransformComponent(engine);
9
9
  /*#__PURE__*/
@@ -1,7 +1,16 @@
1
- import type { ISchema } from '../../schemas/ISchema';
2
- import { Entity } from '../../engine/entity';
3
1
  import { ComponentDefinition, IEngine } from '../../engine';
4
- export declare type TransformComponent = ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
2
+ import { Entity } from '../../engine/entity';
3
+ /**
4
+ * @public
5
+ */
6
+ export declare type TransformComponent = ComponentDefinition<TransformType>;
7
+ /**
8
+ * @public
9
+ */
10
+ export interface TransformComponentExtended extends TransformComponent {
11
+ create(entity: Entity, val?: TransformTypeWithOptionals): TransformType;
12
+ createOrReplace(entity: Entity, val?: TransformTypeWithOptionals): TransformType;
13
+ }
5
14
  /**
6
15
  * @public
7
16
  */
@@ -24,4 +33,8 @@ export declare type TransformType = {
24
33
  };
25
34
  parent?: Entity;
26
35
  };
27
- export declare function defineTransformComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
36
+ /**
37
+ * @public
38
+ */
39
+ export declare type TransformTypeWithOptionals = Partial<TransformType>;
40
+ export declare function defineTransformComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TransformComponentExtended;
@@ -48,8 +48,25 @@ export const TransformSchema = {
48
48
  scale: { x: 1, y: 1, z: 1 },
49
49
  rotation: { x: 0, y: 0, z: 0, w: 1 }
50
50
  };
51
+ },
52
+ extend(value) {
53
+ return {
54
+ position: { x: 0, y: 0, z: 0 },
55
+ scale: { x: 1, y: 1, z: 1 },
56
+ rotation: { x: 0, y: 0, z: 0, w: 1 },
57
+ ...value
58
+ };
51
59
  }
52
60
  };
53
61
  export function defineTransformComponent(engine) {
54
- return engine.defineComponentFromSchema(TransformSchema, COMPONENT_ID);
62
+ const transformDef = engine.defineComponentFromSchema(TransformSchema, COMPONENT_ID);
63
+ return {
64
+ ...transformDef,
65
+ create(entity, val) {
66
+ return transformDef.create(entity, val);
67
+ },
68
+ createOrReplace(entity, val) {
69
+ return transformDef.createOrReplace(entity, val);
70
+ }
71
+ };
55
72
  }
@@ -2,3 +2,4 @@ export type { AnimatorComponentDefinition, AnimatorComponentDefinitionExtended }
2
2
  export type { MeshRendererComponentDefinition, MeshRendererComponentDefinitionExtended } from './extended/MeshRenderer';
3
3
  export type { MeshColliderComponentDefinition, MeshColliderComponentDefinitionExtended } from './extended/MeshCollider';
4
4
  export type { TextureHelper, MaterialComponentDefinition, MaterialComponentDefinitionExtended } from './extended/Material';
5
+ export type { TransformComponentExtended, TransformTypeWithOptionals } from './legacy/Transform';
@@ -5,20 +5,12 @@ import { DeepReadonly } from './readonly';
5
5
  /**
6
6
  * @public
7
7
  */
8
- export declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['deserialize']> : never;
9
- /**
10
- * @public
11
- */
12
- export declare type ComponentType<T extends ISchema> = EcsResult<T>;
13
- /**
14
- * @public
15
- */
16
- export declare type ComponentDefinition<T extends ISchema<ConstructorType>, ConstructorType = any> = {
8
+ export declare type ComponentDefinition<T> = {
17
9
  _id: number;
18
10
  /**
19
11
  * Return the default value of the current component
20
12
  */
21
- default(): DeepReadonly<ComponentType<T>>;
13
+ default(): DeepReadonly<T>;
22
14
  /**
23
15
  * Get if the entity has this component
24
16
  * @param entity - entity to test
@@ -29,45 +21,45 @@ export declare type ComponentDefinition<T extends ISchema<ConstructorType>, Cons
29
21
  * @param entity - Entity that will be used to get the component
30
22
  * @returns
31
23
  */
32
- get(entity: Entity): DeepReadonly<ComponentType<T>>;
24
+ get(entity: Entity): DeepReadonly<T>;
33
25
  /**
34
26
  * Get the readonly component of the entity (to mutate it, use getMutable instead), or null if the entity doesn't have the component.
35
27
  * @param entity - Entity that will be used to try to get the component
36
28
  */
37
- getOrNull(entity: Entity): DeepReadonly<ComponentType<T>> | null;
29
+ getOrNull(entity: Entity): DeepReadonly<T> | null;
38
30
  /**
39
31
  * Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
40
32
  * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
41
33
  * @param entity - Entity that will be used to create the component
42
34
  * @param val - The initial value
43
35
  */
44
- create(entity: Entity, val?: ConstructorType): ComponentType<T>;
36
+ create(entity: Entity, val?: T): T;
45
37
  /**
46
38
  * Add the current component to an entity or replace the content if the entity already has the component
47
39
  * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
48
40
  * @param entity - Entity that will be used to create or replace the component
49
41
  * @param val - The initial or new value
50
42
  */
51
- createOrReplace(entity: Entity, val?: ConstructorType): ComponentType<T>;
43
+ createOrReplace(entity: Entity, val?: T): T;
52
44
  /**
53
45
  * @public
54
46
  * Delete the current component to an entity, return null if the entity doesn't have the current component.
55
47
  * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
56
48
  * @param entity - Entity to delete the component from
57
49
  */
58
- deleteFrom(entity: Entity): ComponentType<T> | null;
50
+ deleteFrom(entity: Entity): T | null;
59
51
  /**
60
52
  * Get the mutable component of the entity, throw an error if the entity doesn't have the component.
61
53
  * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
62
54
  * @param entity - Entity to get the component from
63
55
  */
64
- getMutable(entity: Entity): ComponentType<T>;
56
+ getMutable(entity: Entity): T;
65
57
  /**
66
58
  * Get the mutable component of the entity, return null if the entity doesn't have the component.
67
59
  * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
68
60
  * @param entity - Entity to get the component from
69
61
  */
70
- getMutableOrNull(entity: Entity): ComponentType<T> | null;
62
+ getMutableOrNull(entity: Entity): T | null;
71
63
  writeToByteBuffer(entity: Entity, buffer: ByteBuffer): void;
72
64
  };
73
- export declare function defineComponent<T extends ISchema, ConstructorType = ComponentType<T>>(componentId: number, spec: T, constructorDefault?: ConstructorType): ComponentDefinition<T, ConstructorType>;
65
+ export declare function defineComponent<T>(componentId: number, spec: ISchema<T>): ComponentDefinition<T>;
@@ -1,34 +1,14 @@
1
1
  import { createByteBuffer } from '../serialization/ByteBuffer';
2
2
  import { deepReadonly } from './readonly';
3
- export function defineComponent(componentId, spec, constructorDefault
3
+ export function defineComponent(componentId, spec
4
4
  // meta: { syncFlags }
5
5
  ) {
6
6
  const data = new Map();
7
7
  const dirtyIterator = new Set();
8
- const defaultBuffer = createByteBuffer();
9
- if (constructorDefault) {
10
- spec.serialize(constructorDefault, defaultBuffer);
11
- }
12
- function getDefaultValue() {
13
- if (constructorDefault) {
14
- return spec.deserialize(createByteBuffer({
15
- writing: {
16
- buffer: defaultBuffer.buffer(),
17
- currentOffset: defaultBuffer.currentWriteOffset()
18
- }
19
- }));
20
- }
21
- else {
22
- return spec.create();
23
- }
24
- }
25
- function prefillValue(value) {
26
- return { ...getDefaultValue(), ...value };
27
- }
28
8
  return {
29
9
  _id: componentId,
30
10
  default() {
31
- return getDefaultValue();
11
+ return spec.create();
32
12
  },
33
13
  isDirty(entity) {
34
14
  return dirtyIterator.has(entity);
@@ -63,13 +43,21 @@ export function defineComponent(componentId, spec, constructorDefault
63
43
  if (component) {
64
44
  throw new Error(`[create] Component ${componentId} for ${entity} already exists`);
65
45
  }
66
- const usedValue = value === undefined ? getDefaultValue() : prefillValue(value);
46
+ const usedValue = value === undefined
47
+ ? spec.create()
48
+ : spec.extend
49
+ ? spec.extend(value)
50
+ : value;
67
51
  data.set(entity, usedValue);
68
52
  dirtyIterator.add(entity);
69
53
  return usedValue;
70
54
  },
71
55
  createOrReplace(entity, value) {
72
- const usedValue = value === undefined ? getDefaultValue() : prefillValue(value);
56
+ const usedValue = value === undefined
57
+ ? spec.create()
58
+ : spec.extend
59
+ ? spec.extend(value)
60
+ : value;
73
61
  data.set(entity, usedValue);
74
62
  dirtyIterator.add(entity);
75
63
  return usedValue;
@@ -1,11 +1,12 @@
1
1
  import { ByteBuffer } from '../serialization/ByteBuffer';
2
- import { ComponentDefinition, ComponentType } from './component';
2
+ import { ComponentDefinition } from './component';
3
3
  import { Entity } from './entity';
4
+ import { SystemItem } from './systems';
4
5
  import type { IEngine } from './types';
5
6
  export * from './input';
6
7
  export * from './readonly';
7
8
  export * from './types';
8
- export { ComponentType, Entity, ByteBuffer, ComponentDefinition };
9
+ export { Entity, ByteBuffer, ComponentDefinition, SystemItem };
9
10
  /**
10
11
  * @public
11
12
  */
@@ -1,11 +1,11 @@
1
1
  import * as components from '../components';
2
+ import { checkNotThenable } from '../runtime/invariant';
2
3
  import { Schemas } from '../schemas';
3
4
  import { crdtSceneSystem } from '../systems/crdt';
4
5
  import { defineComponent as defComponent } from './component';
5
6
  import { EntityContainer } from './entity';
6
7
  import { SystemContainer, SYSTEMS_REGULAR_PRIORITY } from './systems';
7
8
  export * from './input';
8
- import { checkNotThenable } from '../runtime/invariant';
9
9
  export * from './readonly';
10
10
  export * from './types';
11
11
  function preEngine() {
@@ -41,18 +41,35 @@ function preEngine() {
41
41
  componentsDefinition.set(componentId, component);
42
42
  return component;
43
43
  }
44
- function defineComponentFromSchema(spec, componentId, constructorDefault) {
44
+ function defineComponentFromSchema(spec, componentId) {
45
45
  const prev = componentsDefinition.get(componentId);
46
46
  if (prev) {
47
47
  // TODO: assert spec === prev.spec
48
48
  return prev;
49
49
  }
50
- const newComponent = defComponent(componentId, spec, constructorDefault);
50
+ const newComponent = defComponent(componentId, spec);
51
51
  componentsDefinition.set(componentId, newComponent);
52
52
  return newComponent;
53
53
  }
54
- function defineComponent(spec, componentId, constructorDefault) {
55
- return defineComponentFromSchema(Schemas.Map(spec), componentId, constructorDefault);
54
+ function defineComponent(mapSpec, componentId, constructorDefault) {
55
+ const prev = componentsDefinition.get(componentId);
56
+ if (prev) {
57
+ // TODO: assert spec === prev.spec
58
+ return prev;
59
+ }
60
+ const schemaSpec = Schemas.Map(mapSpec, constructorDefault);
61
+ const def = defComponent(componentId, schemaSpec);
62
+ const newComponent = {
63
+ ...def,
64
+ create(entity, val) {
65
+ return def.create(entity, val);
66
+ },
67
+ createOrReplace(entity, val) {
68
+ return def.createOrReplace(entity, val);
69
+ }
70
+ };
71
+ componentsDefinition.set(componentId, newComponent);
72
+ return newComponent;
56
73
  }
57
74
  function getComponent(componentId) {
58
75
  const component = componentsDefinition.get(componentId);
@@ -20,8 +20,8 @@ export declare type ReadonlyPrimitive = number | string | number[] | string[] |
20
20
  /**
21
21
  * @public
22
22
  */
23
- export declare type ReadonlyComponentSchema<T extends [ComponentDefinition<any, any>, ...ComponentDefinition<any, any>[]]> = {
24
- [K in keyof T]: T[K] extends ComponentDefinition<any, any> ? ReturnType<T[K]['get']> : never;
23
+ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition<unknown>, ...ComponentDefinition<unknown>[]]> = {
24
+ [K in keyof T]: T[K] extends ComponentDefinition<unknown> ? ReturnType<T[K]['get']> : never;
25
25
  };
26
26
  /**
27
27
  * @public
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export declare type SystemFn = (dt: number) => void;
5
5
  export declare const SYSTEMS_REGULAR_PRIORITY = 100000;
6
- declare type System = {
6
+ export declare type SystemItem = {
7
7
  fn: SystemFn;
8
8
  priority: number;
9
9
  name?: string;
@@ -11,6 +11,5 @@ declare type System = {
11
11
  export declare function SystemContainer(): {
12
12
  add: (fn: SystemFn, priority: number, name?: string) => void;
13
13
  remove: (selector: string | SystemFn) => boolean;
14
- getSystems(): System[];
14
+ getSystems(): SystemItem[];
15
15
  };
16
- export {};
@@ -1,10 +1,10 @@
1
1
  import type { ISchema } from '../schemas/ISchema';
2
- import { Result, Spec } from '../schemas/Map';
2
+ import { MapResult, Spec } from '../schemas/Map';
3
3
  import { Transport } from '../systems/crdt/types';
4
4
  import { ComponentDefinition } from './component';
5
5
  import { Entity } from './entity';
6
- import { SystemFn } from './systems';
7
6
  import { ReadonlyComponentSchema } from './readonly';
7
+ import { SystemFn } from './systems';
8
8
  export { ISchema } from '../schemas/ISchema';
9
9
  /**
10
10
  * @public
@@ -16,6 +16,22 @@ export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
16
16
  export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...ComponentDefinition<any>[]]> = {
17
17
  [K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
18
18
  };
19
+ export interface MapComponentDefinition<T> extends ComponentDefinition<T> {
20
+ /**
21
+ * Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
22
+ * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
23
+ * @param entity - Entity that will be used to create the component
24
+ * @param val - The initial value
25
+ */
26
+ create(entity: Entity, val?: Partial<T>): T;
27
+ /**
28
+ * Add the current component to an entity or replace the content if the entity already has the component
29
+ * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
30
+ * @param entity - Entity that will be used to create or replace the component
31
+ * @param val - The initial or new value
32
+ */
33
+ createOrReplace(entity: Entity, val?: Partial<T>): T;
34
+ }
19
35
  /**
20
36
  * @public
21
37
  */
@@ -71,7 +87,7 @@ export declare type IEngine = {
71
87
  * @param component - The component definition
72
88
  * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
73
89
  */
74
- registerCustomComponent<T extends ISchema, V>(component: ComponentDefinition<T, V>, componentId: number): ComponentDefinition<T, V>;
90
+ registerCustomComponent<T>(component: ComponentDefinition<T>, componentId: number): ComponentDefinition<T>;
75
91
  /**
76
92
  * Define a component and add it to the engine.
77
93
  * @param spec - An object with schema fields
@@ -88,7 +104,7 @@ export declare type IEngine = {
88
104
  *
89
105
  * ```
90
106
  */
91
- defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType): ComponentDefinition<ISchema<Result<T>>, Partial<Result<T>>>;
107
+ defineComponent<T extends Spec>(spec: T, componentId: number, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
92
108
  /**
93
109
  * Define a component and add it to the engine.
94
110
  * @param spec - An object with schema fields
@@ -100,7 +116,7 @@ export declare type IEngine = {
100
116
  * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
101
117
  * ```
102
118
  */
103
- defineComponentFromSchema<T extends ISchema<ConstructorType>, ConstructorType>(spec: T, componentId: number, constructorDefault?: ConstructorType): ComponentDefinition<T, ConstructorType>;
119
+ defineComponentFromSchema<T>(spec: ISchema<T>, componentId: number): ComponentDefinition<T>;
104
120
  /**
105
121
  * Get the component definition from the component id.
106
122
  * @param componentId - component number used to identify the component descriptor
@@ -110,7 +126,7 @@ export declare type IEngine = {
110
126
  * const StateComponent = engine.getComponent(StateComponentId)
111
127
  * ```
112
128
  */
113
- getComponent<T extends ISchema>(componentId: number): ComponentDefinition<T>;
129
+ getComponent<T>(componentId: number): ComponentDefinition<T>;
114
130
  /**
115
131
  * Get the component definition from the component id.
116
132
  * @param componentId - component number used to identify the component descriptor
@@ -120,7 +136,7 @@ export declare type IEngine = {
120
136
  * const StateComponent = engine.getComponent(StateComponentId)
121
137
  * ```
122
138
  */
123
- getComponentOrNull<T extends ISchema>(componentId: number): ComponentDefinition<T> | null;
139
+ getComponentOrNull<T>(componentId: number): ComponentDefinition<T> | null;
124
140
  /**
125
141
  * Get a iterator of entities that has all the component requested.
126
142
  * @param components - a list of component definitions
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export * from './systems/events';
7
7
  export * from './systems/async-task';
8
8
  export * from './engine/entity';
9
9
  export * from './components/types';
10
- export declare const Transform: import("./runtime/types").TransformComponent;
10
+ export declare const Transform: import("./components/types").TransformComponentExtended;
11
11
  export declare const Animator: import("./components/types").AnimatorComponentDefinitionExtended;
12
12
  export declare const Material: import("./components/types").MaterialComponentDefinitionExtended;
13
13
  export declare const MeshRenderer: import("./components/types").MeshRendererComponentDefinitionExtended;
@@ -1,22 +1,22 @@
1
- export type { SystemFn } from '../engine/systems';
2
- export type { Result, Spec } from '../schemas/Map';
3
- export type { TransportMessage, ReceiveMessage, Transport } from '../systems/crdt/types';
4
- export type { WireMessage } from '../serialization/wireMessage';
5
- export { TransformType, TransformComponent } from '../components/legacy/Transform';
6
- export * from '../engine/component';
7
- export * from '../schemas/typing';
8
- export { BillboardMode } from '../components/generated/pb/decentraland/sdk/components/billboard.gen';
1
+ export * from '../components/generated/pb/decentraland/common/texture.gen';
2
+ export * from '../components/generated/pb/decentraland/sdk/components/animator.gen';
3
+ export * from '../components/generated/pb/decentraland/sdk/components/avatar_attach.gen';
9
4
  export { AvatarModifierType } from '../components/generated/pb/decentraland/sdk/components/avatar_modifier_area.gen';
5
+ export { BillboardMode } from '../components/generated/pb/decentraland/sdk/components/billboard.gen';
10
6
  export { CameraType } from '../components/generated/pb/decentraland/sdk/components/common/camera_type.gen';
11
7
  export { Font, TextAlignMode } from '../components/generated/pb/decentraland/sdk/components/common/texts.gen';
12
- export { RaycastQueryType } from '../components/generated/pb/decentraland/sdk/components/raycast.gen';
13
- export * from '../components/generated/pb/decentraland/sdk/components/ui_transform.gen';
14
- export * from '../components/generated/pb/decentraland/sdk/components/avatar_attach.gen';
15
8
  export * from '../components/generated/pb/decentraland/sdk/components/material.gen';
16
- export * from '../components/generated/pb/decentraland/sdk/components/pointer_hover_feedback.gen';
17
- export * from '../components/generated/pb/decentraland/sdk/components/pointer_events_result.gen';
18
- export * from '../components/generated/pb/decentraland/common/texture.gen';
19
- export * from '../components/generated/pb/decentraland/sdk/components/raycast_result.gen';
20
- export * from '../components/generated/pb/decentraland/sdk/components/animator.gen';
21
9
  export * from '../components/generated/pb/decentraland/sdk/components/mesh_collider.gen';
22
10
  export * from '../components/generated/pb/decentraland/sdk/components/mesh_renderer.gen';
11
+ export * from '../components/generated/pb/decentraland/sdk/components/pointer_events_result.gen';
12
+ export * from '../components/generated/pb/decentraland/sdk/components/pointer_hover_feedback.gen';
13
+ export { RaycastQueryType } from '../components/generated/pb/decentraland/sdk/components/raycast.gen';
14
+ export * from '../components/generated/pb/decentraland/sdk/components/raycast_result.gen';
15
+ export * from '../components/generated/pb/decentraland/sdk/components/ui_transform.gen';
16
+ export { TransformComponent, TransformType } from '../components/legacy/Transform';
17
+ export * from '../engine/component';
18
+ export type { SystemFn } from '../engine/systems';
19
+ export type { MapResult, Spec } from '../schemas/Map';
20
+ export * from '../schemas/typing';
21
+ export type { WireMessage } from '../serialization/wireMessage';
22
+ export type { ReceiveMessage, Transport, TransportMessage } from '../systems/crdt/types';
@@ -1,19 +1,19 @@
1
- export * from '../engine/component';
2
- export * from '../schemas/typing';
1
+ export * from '../components/generated/pb/decentraland/common/texture.gen';
2
+ export * from '../components/generated/pb/decentraland/sdk/components/animator.gen';
3
+ export * from '../components/generated/pb/decentraland/sdk/components/avatar_attach.gen';
4
+ export { AvatarModifierType } from '../components/generated/pb/decentraland/sdk/components/avatar_modifier_area.gen';
3
5
  // ColliderLayer is not used in the .pb definition because the field value is a number
4
6
  // and it can have multiple values of this enum. It needs to be exposed here.
5
7
  export { BillboardMode } from '../components/generated/pb/decentraland/sdk/components/billboard.gen';
6
- export { AvatarModifierType } from '../components/generated/pb/decentraland/sdk/components/avatar_modifier_area.gen';
7
8
  export { CameraType } from '../components/generated/pb/decentraland/sdk/components/common/camera_type.gen';
8
9
  export { Font, TextAlignMode } from '../components/generated/pb/decentraland/sdk/components/common/texts.gen';
9
- export { RaycastQueryType } from '../components/generated/pb/decentraland/sdk/components/raycast.gen';
10
- export * from '../components/generated/pb/decentraland/sdk/components/ui_transform.gen';
11
- export * from '../components/generated/pb/decentraland/sdk/components/avatar_attach.gen';
12
10
  export * from '../components/generated/pb/decentraland/sdk/components/material.gen';
13
- export * from '../components/generated/pb/decentraland/sdk/components/pointer_hover_feedback.gen';
14
- export * from '../components/generated/pb/decentraland/sdk/components/pointer_events_result.gen';
15
- export * from '../components/generated/pb/decentraland/common/texture.gen';
16
- export * from '../components/generated/pb/decentraland/sdk/components/raycast_result.gen';
17
- export * from '../components/generated/pb/decentraland/sdk/components/animator.gen';
18
11
  export * from '../components/generated/pb/decentraland/sdk/components/mesh_collider.gen';
19
12
  export * from '../components/generated/pb/decentraland/sdk/components/mesh_renderer.gen';
13
+ export * from '../components/generated/pb/decentraland/sdk/components/pointer_events_result.gen';
14
+ export * from '../components/generated/pb/decentraland/sdk/components/pointer_hover_feedback.gen';
15
+ export { RaycastQueryType } from '../components/generated/pb/decentraland/sdk/components/raycast.gen';
16
+ export * from '../components/generated/pb/decentraland/sdk/components/raycast_result.gen';
17
+ export * from '../components/generated/pb/decentraland/sdk/components/ui_transform.gen';
18
+ export * from '../engine/component';
19
+ export * from '../schemas/typing';
@@ -6,4 +6,5 @@ export declare type ISchema<T = any> = {
6
6
  serialize(value: T, builder: ByteBuffer): void;
7
7
  deserialize(reader: ByteBuffer): T;
8
8
  create(): T;
9
+ extend?: (base?: T) => T;
9
10
  };
@@ -9,11 +9,17 @@ export interface Spec {
9
9
  /**
10
10
  * @public
11
11
  */
12
- export declare type Result<T extends Spec> = ToOptional<{
13
- [K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
12
+ export declare type MapResult<T extends Spec> = ToOptional<{
13
+ [K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? MapResult<T[K]> : never;
14
14
  }>;
15
- export declare type MapSchemaType<T extends Spec> = ISchema<Result<T>>;
16
15
  /**
17
16
  * @public
18
17
  */
19
- export declare function IMap<T extends Spec>(spec: T): ISchema<Result<T>>;
18
+ export declare type MapResultWithOptional<T extends Spec> = ToOptional<{
19
+ [K in keyof T]?: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? MapResult<T[K]> : never;
20
+ }>;
21
+ export declare type MapSchemaType<T extends Spec> = ISchema<MapResult<T>>;
22
+ /**
23
+ * @public
24
+ */
25
+ export declare function IMap<T extends Spec>(spec: T, defaultValue?: Partial<MapResult<T>>): ISchema<MapResult<T>>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @public
3
3
  */
4
- export function IMap(spec) {
4
+ export function IMap(spec, defaultValue) {
5
5
  return {
6
6
  serialize(value, builder) {
7
7
  for (const key in spec) {
@@ -22,7 +22,15 @@ export function IMap(spec) {
22
22
  ;
23
23
  newValue[key] = spec[key].create();
24
24
  }
25
- return newValue;
25
+ return { ...newValue, ...defaultValue };
26
+ },
27
+ extend: (base) => {
28
+ const newValue = {};
29
+ for (const key in spec) {
30
+ ;
31
+ newValue[key] = spec[key].create();
32
+ }
33
+ return { ...newValue, ...defaultValue, ...base };
26
34
  }
27
35
  };
28
36
  }
@@ -26,6 +26,6 @@ export declare namespace ComponentOperation {
26
26
  * Call this function for an optimal writing data passing the ByteBuffer
27
27
  * already allocated
28
28
  */
29
- function write(type: WireMessage.Enum, entity: Entity, timestamp: number, componentDefinition: ComponentDefinition<any, any>, buf: ByteBuffer): void;
29
+ function write(type: WireMessage.Enum, entity: Entity, timestamp: number, componentDefinition: ComponentDefinition<unknown>, buf: ByteBuffer): void;
30
30
  function read(buf: ByteBuffer): (WireMessage.Header & (IPutComponent | IDeleteComponent)) | null;
31
31
  }
@@ -11,7 +11,7 @@
11
11
  * available to process the message
12
12
  *
13
13
  */
14
- import { ComponentDefinition, Entity, ISchema } from '../engine';
14
+ import { ComponentDefinition, Entity } from '../engine';
15
15
  import { ByteBuffer } from './ByteBuffer';
16
16
  export declare namespace WireMessage {
17
17
  type Uint32 = number;
@@ -36,6 +36,6 @@ export declare namespace WireMessage {
36
36
  */
37
37
  function validate(buf: ByteBuffer): boolean;
38
38
  function readHeader(buf: ByteBuffer): Header | null;
39
- function getType(component: ComponentDefinition<ISchema<unknown>, unknown>, entity: Entity): Enum;
39
+ function getType(component: ComponentDefinition<unknown>, entity: Entity): Enum;
40
40
  }
41
41
  export default WireMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
- "version": "7.0.6-3713220614.commit-d02ef9f",
3
+ "version": "7.0.6-3741197705.commit-bb37667",
4
4
  "description": "Decentraland ECS",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "ts-proto": "^1.112.0"
28
28
  },
29
29
  "dependencies": {
30
- "@dcl/crdt": "7.0.6-3713220614.commit-d02ef9f",
30
+ "@dcl/crdt": "7.0.6-3741197705.commit-bb37667",
31
31
  "@dcl/js-runtime": "file:../js-runtime",
32
32
  "@dcl/protocol": "^1.0.0-3603890942.commit-44633cf"
33
33
  },
@@ -35,5 +35,5 @@
35
35
  "dist",
36
36
  "etc"
37
37
  ],
38
- "commit": "d02ef9fa9c36da3f26f7b1313e57cb4ccce5c539"
38
+ "commit": "bb376675027050591f82fce195c1797a5b77ed3a"
39
39
  }