@dcl/playground-assets 7.0.6-4138167187.commit-c9d306a → 7.0.6-4177592674.commit-39cdc99
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 +132 -8
- package/dist/beta.d.ts +132 -8
- package/dist/index.bundled.d.ts +132 -8
- package/dist/index.js +434 -642
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground/snippets/ui-backgrounds.tsx +5 -26
- package/dist/playground/snippets/ui.tsx +4 -21
- package/dist/playground-assets.d.ts +132 -8
- package/etc/playground-assets.api.json +1096 -33
- package/etc/playground-assets.api.md +76 -7
- package/package.json +3 -3
package/dist/alpha.d.ts
CHANGED
|
@@ -1043,6 +1043,14 @@ export declare interface ComponentDefinition<T> {
|
|
|
1043
1043
|
* @param entity - Entity to delete the component from
|
|
1044
1044
|
*/
|
|
1045
1045
|
deleteFrom(entity: Entity): T | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* @public
|
|
1048
|
+
* Marks the entity as deleted and signals it cannot be used ever again. It must
|
|
1049
|
+
* clear the component internal state, produces a synchronization message to remove
|
|
1050
|
+
* the component from the entity.
|
|
1051
|
+
* @param entity - Entity to delete the component from
|
|
1052
|
+
*/
|
|
1053
|
+
entityDeleted(entity: Entity, markAsDirty: boolean): void;
|
|
1046
1054
|
/**
|
|
1047
1055
|
* Get the mutable component of the entity, throw an error if the entity doesn't have the component.
|
|
1048
1056
|
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
@@ -1055,7 +1063,20 @@ export declare interface ComponentDefinition<T> {
|
|
|
1055
1063
|
* @param entity - Entity to get the component from
|
|
1056
1064
|
*/
|
|
1057
1065
|
getMutableOrNull(entity: Entity): T | null;
|
|
1058
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* This function receives a CRDT update and returns a touple with a "conflict
|
|
1068
|
+
* resoluton" message, in case of the sender being updated or null in case of noop/accepted
|
|
1069
|
+
* change. The second element of the touple is the modified/changed/deleted value.
|
|
1070
|
+
* @public
|
|
1071
|
+
*/
|
|
1072
|
+
updateFromCrdt(body: CrdtMessageBody): [null | PutComponentMessageBody | DeleteComponentMessageBody, T | null];
|
|
1073
|
+
/**
|
|
1074
|
+
* This function returns an iterable with all the CRDT updates that need to be
|
|
1075
|
+
* broadcasted to other actors in the system. After returning, this function
|
|
1076
|
+
* clears the internal dirty state. Updates are produced only once.
|
|
1077
|
+
* @public
|
|
1078
|
+
*/
|
|
1079
|
+
getCrdtUpdates(): Iterable<CrdtMessageBody>;
|
|
1059
1080
|
}
|
|
1060
1081
|
|
|
1061
1082
|
export declare type ComponentGetter<T extends ComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
@@ -1067,11 +1088,33 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1067
1088
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1068
1089
|
};
|
|
1069
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* @public
|
|
1093
|
+
*/
|
|
1094
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1100
|
+
|
|
1070
1101
|
/**
|
|
1071
1102
|
* @public
|
|
1072
1103
|
*/
|
|
1073
1104
|
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody;
|
|
1074
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* Min length = 8 bytes
|
|
1108
|
+
* All message length including
|
|
1109
|
+
* @param length - uint32 the length of all message (including the header)
|
|
1110
|
+
* @param type - define the function which handles the data
|
|
1111
|
+
* @public
|
|
1112
|
+
*/
|
|
1113
|
+
export declare type CrdtMessageHeader = {
|
|
1114
|
+
length: uint32;
|
|
1115
|
+
type: uint32;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1075
1118
|
/**
|
|
1076
1119
|
* @public
|
|
1077
1120
|
*/
|
|
@@ -1088,6 +1131,10 @@ export declare function createEthereumProvider(): {
|
|
|
1088
1131
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
1089
1132
|
};
|
|
1090
1133
|
|
|
1134
|
+
export declare function createGetCrdtMessages(componentId: number, timestamps: Map<Entity, number>, dirtyIterator: Set<Entity>, schema: Pick<ISchema<any>, 'serialize'>, data: Map<Entity, unknown>): () => Generator<PutComponentMessageBody | DeleteComponentMessageBody, void, unknown>;
|
|
1135
|
+
|
|
1136
|
+
export declare function createUpdateFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (msg: CrdtMessageBody) => [null | PutComponentMessageBody | DeleteComponentMessageBody, any];
|
|
1137
|
+
|
|
1091
1138
|
/**
|
|
1092
1139
|
* Transform parenting: cyclic dependency checker
|
|
1093
1140
|
* It checks only in modified Transforms
|
|
@@ -1133,6 +1180,11 @@ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
|
|
|
1133
1180
|
*/
|
|
1134
1181
|
export declare const DEG2RAD: number;
|
|
1135
1182
|
|
|
1183
|
+
/**
|
|
1184
|
+
* @public
|
|
1185
|
+
*/
|
|
1186
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1187
|
+
|
|
1136
1188
|
/**
|
|
1137
1189
|
* @param entity - Uint32 number of the entity
|
|
1138
1190
|
* @param componentId - Uint32 number of id
|
|
@@ -1146,6 +1198,11 @@ export declare type DeleteComponentMessageBody = {
|
|
|
1146
1198
|
timestamp: number;
|
|
1147
1199
|
};
|
|
1148
1200
|
|
|
1201
|
+
/**
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1205
|
+
|
|
1149
1206
|
/**
|
|
1150
1207
|
* @param entity - uint32 number of the entity
|
|
1151
1208
|
* @public
|
|
@@ -1703,6 +1760,8 @@ export declare type IncludeUndefined<T> = {
|
|
|
1703
1760
|
[P in keyof T]: undefined extends T[P] ? P : never;
|
|
1704
1761
|
}[keyof T];
|
|
1705
1762
|
|
|
1763
|
+
export declare function incrementTimestamp(entity: Entity, timestamps: Map<Entity, number>): number;
|
|
1764
|
+
|
|
1706
1765
|
/**
|
|
1707
1766
|
* @public
|
|
1708
1767
|
* Input component
|
|
@@ -3708,6 +3767,20 @@ export declare interface Position {
|
|
|
3708
3767
|
left: PositionUnit;
|
|
3709
3768
|
}
|
|
3710
3769
|
|
|
3770
|
+
/**
|
|
3771
|
+
* The values are in clockwise order, beginning at the top: top, right, bottom, then left
|
|
3772
|
+
|
|
3773
|
+
* When one value is specified, it applies the same margin to all four sides.
|
|
3774
|
+
*
|
|
3775
|
+
* When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
|
|
3776
|
+
*
|
|
3777
|
+
* When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
|
|
3778
|
+
*
|
|
3779
|
+
When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
|
|
3780
|
+
* @public
|
|
3781
|
+
*/
|
|
3782
|
+
export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
|
|
3783
|
+
|
|
3711
3784
|
/**
|
|
3712
3785
|
* @public
|
|
3713
3786
|
* The position property specifies the type of positioning method used for an element
|
|
@@ -3715,11 +3788,60 @@ export declare interface Position {
|
|
|
3715
3788
|
export declare type PositionType = 'absolute' | 'relative';
|
|
3716
3789
|
|
|
3717
3790
|
/**
|
|
3718
|
-
*
|
|
3719
|
-
*
|
|
3791
|
+
* unit value specified. i.e. 1 || '100%' || '1px'
|
|
3792
|
+
* @public
|
|
3793
|
+
*/
|
|
3794
|
+
export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
|
|
3795
|
+
|
|
3796
|
+
export declare enum ProcessMessageResultType {
|
|
3797
|
+
/**
|
|
3798
|
+
* Typical message and new state set.
|
|
3799
|
+
* @state CHANGE
|
|
3800
|
+
* @reason Incoming message has a timestamp greater
|
|
3801
|
+
*/
|
|
3802
|
+
StateUpdatedTimestamp = 1,
|
|
3803
|
+
/**
|
|
3804
|
+
* Typical message when it is considered old.
|
|
3805
|
+
* @state it does NOT CHANGE.
|
|
3806
|
+
* @reason incoming message has a timestamp lower.
|
|
3807
|
+
*/
|
|
3808
|
+
StateOutdatedTimestamp = 2,
|
|
3809
|
+
/**
|
|
3810
|
+
* Weird message, same timestamp and data.
|
|
3811
|
+
* @state it does NOT CHANGE.
|
|
3812
|
+
* @reason consistent state between peers.
|
|
3813
|
+
*/
|
|
3814
|
+
NoChanges = 3,
|
|
3815
|
+
/**
|
|
3816
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3817
|
+
* @state it does NOT CHANGE.
|
|
3818
|
+
* @reason incoming message has a LOWER data.
|
|
3819
|
+
*/
|
|
3820
|
+
StateOutdatedData = 4,
|
|
3821
|
+
/**
|
|
3822
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3823
|
+
* @state CHANGE.
|
|
3824
|
+
* @reason incoming message has a GREATER data.
|
|
3825
|
+
*/
|
|
3826
|
+
StateUpdatedData = 5,
|
|
3827
|
+
/**
|
|
3828
|
+
* Entity was previously deleted.
|
|
3829
|
+
* @state it does NOT CHANGE.
|
|
3830
|
+
* @reason The message is considered old.
|
|
3831
|
+
*/
|
|
3832
|
+
EntityWasDeleted = 6,
|
|
3833
|
+
/**
|
|
3834
|
+
* Entity should be deleted.
|
|
3835
|
+
* @state CHANGE.
|
|
3836
|
+
* @reason the state is storing old entities
|
|
3837
|
+
*/
|
|
3838
|
+
EntityDeleted = 7
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
/**
|
|
3720
3842
|
* @public
|
|
3721
3843
|
*/
|
|
3722
|
-
export declare type
|
|
3844
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3723
3845
|
|
|
3724
3846
|
/**
|
|
3725
3847
|
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
@@ -4616,7 +4738,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
|
|
|
4616
4738
|
* @public
|
|
4617
4739
|
* @category Component
|
|
4618
4740
|
*/
|
|
4619
|
-
export declare function UiEntity(props: EntityPropTypes
|
|
4741
|
+
export declare function UiEntity(props: EntityPropTypes & {
|
|
4742
|
+
uiText?: UiLabelProps;
|
|
4743
|
+
}): ReactEcs.JSX.Element;
|
|
4620
4744
|
|
|
4621
4745
|
/**
|
|
4622
4746
|
* @public
|
|
@@ -4699,11 +4823,11 @@ export declare interface UiTransformProps {
|
|
|
4699
4823
|
/** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
|
4700
4824
|
flexDirection?: FlexDirectionType;
|
|
4701
4825
|
/** The position property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
|
4702
|
-
position?: Partial<Position
|
|
4826
|
+
position?: Partial<Position> | PositionShorthand;
|
|
4703
4827
|
/** The padding shorthand property sets the padding area on all four sides of an element at once. */
|
|
4704
|
-
padding?: Partial<Position
|
|
4828
|
+
padding?: Partial<Position> | PositionShorthand;
|
|
4705
4829
|
/** The margin shorthand property sets the margin area on all four sides of an element. */
|
|
4706
|
-
margin?: Partial<Position
|
|
4830
|
+
margin?: Partial<Position> | PositionShorthand;
|
|
4707
4831
|
/** The width property specifies the width of an element. */
|
|
4708
4832
|
width?: PositionUnit;
|
|
4709
4833
|
/** The height property specifies the height of an element. */
|
package/dist/beta.d.ts
CHANGED
|
@@ -1043,6 +1043,14 @@ export declare interface ComponentDefinition<T> {
|
|
|
1043
1043
|
* @param entity - Entity to delete the component from
|
|
1044
1044
|
*/
|
|
1045
1045
|
deleteFrom(entity: Entity): T | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* @public
|
|
1048
|
+
* Marks the entity as deleted and signals it cannot be used ever again. It must
|
|
1049
|
+
* clear the component internal state, produces a synchronization message to remove
|
|
1050
|
+
* the component from the entity.
|
|
1051
|
+
* @param entity - Entity to delete the component from
|
|
1052
|
+
*/
|
|
1053
|
+
entityDeleted(entity: Entity, markAsDirty: boolean): void;
|
|
1046
1054
|
/**
|
|
1047
1055
|
* Get the mutable component of the entity, throw an error if the entity doesn't have the component.
|
|
1048
1056
|
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
@@ -1055,7 +1063,20 @@ export declare interface ComponentDefinition<T> {
|
|
|
1055
1063
|
* @param entity - Entity to get the component from
|
|
1056
1064
|
*/
|
|
1057
1065
|
getMutableOrNull(entity: Entity): T | null;
|
|
1058
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* This function receives a CRDT update and returns a touple with a "conflict
|
|
1068
|
+
* resoluton" message, in case of the sender being updated or null in case of noop/accepted
|
|
1069
|
+
* change. The second element of the touple is the modified/changed/deleted value.
|
|
1070
|
+
* @public
|
|
1071
|
+
*/
|
|
1072
|
+
updateFromCrdt(body: CrdtMessageBody): [null | PutComponentMessageBody | DeleteComponentMessageBody, T | null];
|
|
1073
|
+
/**
|
|
1074
|
+
* This function returns an iterable with all the CRDT updates that need to be
|
|
1075
|
+
* broadcasted to other actors in the system. After returning, this function
|
|
1076
|
+
* clears the internal dirty state. Updates are produced only once.
|
|
1077
|
+
* @public
|
|
1078
|
+
*/
|
|
1079
|
+
getCrdtUpdates(): Iterable<CrdtMessageBody>;
|
|
1059
1080
|
}
|
|
1060
1081
|
|
|
1061
1082
|
export declare type ComponentGetter<T extends ComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
@@ -1067,11 +1088,33 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1067
1088
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1068
1089
|
};
|
|
1069
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* @public
|
|
1093
|
+
*/
|
|
1094
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1100
|
+
|
|
1070
1101
|
/**
|
|
1071
1102
|
* @public
|
|
1072
1103
|
*/
|
|
1073
1104
|
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody;
|
|
1074
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* Min length = 8 bytes
|
|
1108
|
+
* All message length including
|
|
1109
|
+
* @param length - uint32 the length of all message (including the header)
|
|
1110
|
+
* @param type - define the function which handles the data
|
|
1111
|
+
* @public
|
|
1112
|
+
*/
|
|
1113
|
+
export declare type CrdtMessageHeader = {
|
|
1114
|
+
length: uint32;
|
|
1115
|
+
type: uint32;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1075
1118
|
/**
|
|
1076
1119
|
* @public
|
|
1077
1120
|
*/
|
|
@@ -1088,6 +1131,10 @@ export declare function createEthereumProvider(): {
|
|
|
1088
1131
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
1089
1132
|
};
|
|
1090
1133
|
|
|
1134
|
+
export declare function createGetCrdtMessages(componentId: number, timestamps: Map<Entity, number>, dirtyIterator: Set<Entity>, schema: Pick<ISchema<any>, 'serialize'>, data: Map<Entity, unknown>): () => Generator<PutComponentMessageBody | DeleteComponentMessageBody, void, unknown>;
|
|
1135
|
+
|
|
1136
|
+
export declare function createUpdateFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (msg: CrdtMessageBody) => [null | PutComponentMessageBody | DeleteComponentMessageBody, any];
|
|
1137
|
+
|
|
1091
1138
|
/**
|
|
1092
1139
|
* Transform parenting: cyclic dependency checker
|
|
1093
1140
|
* It checks only in modified Transforms
|
|
@@ -1133,6 +1180,11 @@ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
|
|
|
1133
1180
|
*/
|
|
1134
1181
|
export declare const DEG2RAD: number;
|
|
1135
1182
|
|
|
1183
|
+
/**
|
|
1184
|
+
* @public
|
|
1185
|
+
*/
|
|
1186
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1187
|
+
|
|
1136
1188
|
/**
|
|
1137
1189
|
* @param entity - Uint32 number of the entity
|
|
1138
1190
|
* @param componentId - Uint32 number of id
|
|
@@ -1146,6 +1198,11 @@ export declare type DeleteComponentMessageBody = {
|
|
|
1146
1198
|
timestamp: number;
|
|
1147
1199
|
};
|
|
1148
1200
|
|
|
1201
|
+
/**
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1205
|
+
|
|
1149
1206
|
/**
|
|
1150
1207
|
* @param entity - uint32 number of the entity
|
|
1151
1208
|
* @public
|
|
@@ -1699,6 +1756,8 @@ export declare type IncludeUndefined<T> = {
|
|
|
1699
1756
|
[P in keyof T]: undefined extends T[P] ? P : never;
|
|
1700
1757
|
}[keyof T];
|
|
1701
1758
|
|
|
1759
|
+
export declare function incrementTimestamp(entity: Entity, timestamps: Map<Entity, number>): number;
|
|
1760
|
+
|
|
1702
1761
|
/**
|
|
1703
1762
|
* @public
|
|
1704
1763
|
* Input component
|
|
@@ -3704,6 +3763,20 @@ export declare interface Position {
|
|
|
3704
3763
|
left: PositionUnit;
|
|
3705
3764
|
}
|
|
3706
3765
|
|
|
3766
|
+
/**
|
|
3767
|
+
* The values are in clockwise order, beginning at the top: top, right, bottom, then left
|
|
3768
|
+
|
|
3769
|
+
* When one value is specified, it applies the same margin to all four sides.
|
|
3770
|
+
*
|
|
3771
|
+
* When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
|
|
3772
|
+
*
|
|
3773
|
+
* When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
|
|
3774
|
+
*
|
|
3775
|
+
When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
|
|
3776
|
+
* @public
|
|
3777
|
+
*/
|
|
3778
|
+
export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
|
|
3779
|
+
|
|
3707
3780
|
/**
|
|
3708
3781
|
* @public
|
|
3709
3782
|
* The position property specifies the type of positioning method used for an element
|
|
@@ -3711,11 +3784,60 @@ export declare interface Position {
|
|
|
3711
3784
|
export declare type PositionType = 'absolute' | 'relative';
|
|
3712
3785
|
|
|
3713
3786
|
/**
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
3787
|
+
* unit value specified. i.e. 1 || '100%' || '1px'
|
|
3788
|
+
* @public
|
|
3789
|
+
*/
|
|
3790
|
+
export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
|
|
3791
|
+
|
|
3792
|
+
export declare enum ProcessMessageResultType {
|
|
3793
|
+
/**
|
|
3794
|
+
* Typical message and new state set.
|
|
3795
|
+
* @state CHANGE
|
|
3796
|
+
* @reason Incoming message has a timestamp greater
|
|
3797
|
+
*/
|
|
3798
|
+
StateUpdatedTimestamp = 1,
|
|
3799
|
+
/**
|
|
3800
|
+
* Typical message when it is considered old.
|
|
3801
|
+
* @state it does NOT CHANGE.
|
|
3802
|
+
* @reason incoming message has a timestamp lower.
|
|
3803
|
+
*/
|
|
3804
|
+
StateOutdatedTimestamp = 2,
|
|
3805
|
+
/**
|
|
3806
|
+
* Weird message, same timestamp and data.
|
|
3807
|
+
* @state it does NOT CHANGE.
|
|
3808
|
+
* @reason consistent state between peers.
|
|
3809
|
+
*/
|
|
3810
|
+
NoChanges = 3,
|
|
3811
|
+
/**
|
|
3812
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3813
|
+
* @state it does NOT CHANGE.
|
|
3814
|
+
* @reason incoming message has a LOWER data.
|
|
3815
|
+
*/
|
|
3816
|
+
StateOutdatedData = 4,
|
|
3817
|
+
/**
|
|
3818
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3819
|
+
* @state CHANGE.
|
|
3820
|
+
* @reason incoming message has a GREATER data.
|
|
3821
|
+
*/
|
|
3822
|
+
StateUpdatedData = 5,
|
|
3823
|
+
/**
|
|
3824
|
+
* Entity was previously deleted.
|
|
3825
|
+
* @state it does NOT CHANGE.
|
|
3826
|
+
* @reason The message is considered old.
|
|
3827
|
+
*/
|
|
3828
|
+
EntityWasDeleted = 6,
|
|
3829
|
+
/**
|
|
3830
|
+
* Entity should be deleted.
|
|
3831
|
+
* @state CHANGE.
|
|
3832
|
+
* @reason the state is storing old entities
|
|
3833
|
+
*/
|
|
3834
|
+
EntityDeleted = 7
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
/**
|
|
3716
3838
|
* @public
|
|
3717
3839
|
*/
|
|
3718
|
-
export declare type
|
|
3840
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3719
3841
|
|
|
3720
3842
|
/**
|
|
3721
3843
|
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
@@ -4612,7 +4734,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
|
|
|
4612
4734
|
* @public
|
|
4613
4735
|
* @category Component
|
|
4614
4736
|
*/
|
|
4615
|
-
export declare function UiEntity(props: EntityPropTypes
|
|
4737
|
+
export declare function UiEntity(props: EntityPropTypes & {
|
|
4738
|
+
uiText?: UiLabelProps;
|
|
4739
|
+
}): ReactEcs.JSX.Element;
|
|
4616
4740
|
|
|
4617
4741
|
/**
|
|
4618
4742
|
* @public
|
|
@@ -4695,11 +4819,11 @@ export declare interface UiTransformProps {
|
|
|
4695
4819
|
/** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
|
4696
4820
|
flexDirection?: FlexDirectionType;
|
|
4697
4821
|
/** The position property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
|
4698
|
-
position?: Partial<Position
|
|
4822
|
+
position?: Partial<Position> | PositionShorthand;
|
|
4699
4823
|
/** The padding shorthand property sets the padding area on all four sides of an element at once. */
|
|
4700
|
-
padding?: Partial<Position
|
|
4824
|
+
padding?: Partial<Position> | PositionShorthand;
|
|
4701
4825
|
/** The margin shorthand property sets the margin area on all four sides of an element. */
|
|
4702
|
-
margin?: Partial<Position
|
|
4826
|
+
margin?: Partial<Position> | PositionShorthand;
|
|
4703
4827
|
/** The width property specifies the width of an element. */
|
|
4704
4828
|
width?: PositionUnit;
|
|
4705
4829
|
/** The height property specifies the height of an element. */
|
package/dist/index.bundled.d.ts
CHANGED
|
@@ -1043,6 +1043,14 @@ export declare interface ComponentDefinition<T> {
|
|
|
1043
1043
|
* @param entity - Entity to delete the component from
|
|
1044
1044
|
*/
|
|
1045
1045
|
deleteFrom(entity: Entity): T | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* @public
|
|
1048
|
+
* Marks the entity as deleted and signals it cannot be used ever again. It must
|
|
1049
|
+
* clear the component internal state, produces a synchronization message to remove
|
|
1050
|
+
* the component from the entity.
|
|
1051
|
+
* @param entity - Entity to delete the component from
|
|
1052
|
+
*/
|
|
1053
|
+
entityDeleted(entity: Entity, markAsDirty: boolean): void;
|
|
1046
1054
|
/**
|
|
1047
1055
|
* Get the mutable component of the entity, throw an error if the entity doesn't have the component.
|
|
1048
1056
|
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
@@ -1055,7 +1063,20 @@ export declare interface ComponentDefinition<T> {
|
|
|
1055
1063
|
* @param entity - Entity to get the component from
|
|
1056
1064
|
*/
|
|
1057
1065
|
getMutableOrNull(entity: Entity): T | null;
|
|
1058
|
-
|
|
1066
|
+
/**
|
|
1067
|
+
* This function receives a CRDT update and returns a touple with a "conflict
|
|
1068
|
+
* resoluton" message, in case of the sender being updated or null in case of noop/accepted
|
|
1069
|
+
* change. The second element of the touple is the modified/changed/deleted value.
|
|
1070
|
+
* @public
|
|
1071
|
+
*/
|
|
1072
|
+
updateFromCrdt(body: CrdtMessageBody): [null | PutComponentMessageBody | DeleteComponentMessageBody, T | null];
|
|
1073
|
+
/**
|
|
1074
|
+
* This function returns an iterable with all the CRDT updates that need to be
|
|
1075
|
+
* broadcasted to other actors in the system. After returning, this function
|
|
1076
|
+
* clears the internal dirty state. Updates are produced only once.
|
|
1077
|
+
* @public
|
|
1078
|
+
*/
|
|
1079
|
+
getCrdtUpdates(): Iterable<CrdtMessageBody>;
|
|
1059
1080
|
}
|
|
1060
1081
|
|
|
1061
1082
|
export declare type ComponentGetter<T extends ComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
@@ -1067,11 +1088,33 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1067
1088
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1068
1089
|
};
|
|
1069
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* @public
|
|
1093
|
+
*/
|
|
1094
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1100
|
+
|
|
1070
1101
|
/**
|
|
1071
1102
|
* @public
|
|
1072
1103
|
*/
|
|
1073
1104
|
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody;
|
|
1074
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* Min length = 8 bytes
|
|
1108
|
+
* All message length including
|
|
1109
|
+
* @param length - uint32 the length of all message (including the header)
|
|
1110
|
+
* @param type - define the function which handles the data
|
|
1111
|
+
* @public
|
|
1112
|
+
*/
|
|
1113
|
+
export declare type CrdtMessageHeader = {
|
|
1114
|
+
length: uint32;
|
|
1115
|
+
type: uint32;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1075
1118
|
/**
|
|
1076
1119
|
* @public
|
|
1077
1120
|
*/
|
|
@@ -1088,6 +1131,10 @@ export declare function createEthereumProvider(): {
|
|
|
1088
1131
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
1089
1132
|
};
|
|
1090
1133
|
|
|
1134
|
+
export declare function createGetCrdtMessages(componentId: number, timestamps: Map<Entity, number>, dirtyIterator: Set<Entity>, schema: Pick<ISchema<any>, 'serialize'>, data: Map<Entity, unknown>): () => Generator<PutComponentMessageBody | DeleteComponentMessageBody, void, unknown>;
|
|
1135
|
+
|
|
1136
|
+
export declare function createUpdateFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (msg: CrdtMessageBody) => [null | PutComponentMessageBody | DeleteComponentMessageBody, any];
|
|
1137
|
+
|
|
1091
1138
|
/**
|
|
1092
1139
|
* Transform parenting: cyclic dependency checker
|
|
1093
1140
|
* It checks only in modified Transforms
|
|
@@ -1133,6 +1180,11 @@ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
|
|
|
1133
1180
|
*/
|
|
1134
1181
|
export declare const DEG2RAD: number;
|
|
1135
1182
|
|
|
1183
|
+
/**
|
|
1184
|
+
* @public
|
|
1185
|
+
*/
|
|
1186
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1187
|
+
|
|
1136
1188
|
/**
|
|
1137
1189
|
* @param entity - Uint32 number of the entity
|
|
1138
1190
|
* @param componentId - Uint32 number of id
|
|
@@ -1146,6 +1198,11 @@ export declare type DeleteComponentMessageBody = {
|
|
|
1146
1198
|
timestamp: number;
|
|
1147
1199
|
};
|
|
1148
1200
|
|
|
1201
|
+
/**
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1205
|
+
|
|
1149
1206
|
/**
|
|
1150
1207
|
* @param entity - uint32 number of the entity
|
|
1151
1208
|
* @public
|
|
@@ -1699,6 +1756,8 @@ export declare type IncludeUndefined<T> = {
|
|
|
1699
1756
|
[P in keyof T]: undefined extends T[P] ? P : never;
|
|
1700
1757
|
}[keyof T];
|
|
1701
1758
|
|
|
1759
|
+
export declare function incrementTimestamp(entity: Entity, timestamps: Map<Entity, number>): number;
|
|
1760
|
+
|
|
1702
1761
|
/**
|
|
1703
1762
|
* @public
|
|
1704
1763
|
* Input component
|
|
@@ -3704,6 +3763,20 @@ export declare interface Position {
|
|
|
3704
3763
|
left: PositionUnit;
|
|
3705
3764
|
}
|
|
3706
3765
|
|
|
3766
|
+
/**
|
|
3767
|
+
* The values are in clockwise order, beginning at the top: top, right, bottom, then left
|
|
3768
|
+
|
|
3769
|
+
* When one value is specified, it applies the same margin to all four sides.
|
|
3770
|
+
*
|
|
3771
|
+
* When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
|
|
3772
|
+
*
|
|
3773
|
+
* When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
|
|
3774
|
+
*
|
|
3775
|
+
When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
|
|
3776
|
+
* @public
|
|
3777
|
+
*/
|
|
3778
|
+
export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
|
|
3779
|
+
|
|
3707
3780
|
/**
|
|
3708
3781
|
* @public
|
|
3709
3782
|
* The position property specifies the type of positioning method used for an element
|
|
@@ -3711,11 +3784,60 @@ export declare interface Position {
|
|
|
3711
3784
|
export declare type PositionType = 'absolute' | 'relative';
|
|
3712
3785
|
|
|
3713
3786
|
/**
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
3787
|
+
* unit value specified. i.e. 1 || '100%' || '1px'
|
|
3788
|
+
* @public
|
|
3789
|
+
*/
|
|
3790
|
+
export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
|
|
3791
|
+
|
|
3792
|
+
export declare enum ProcessMessageResultType {
|
|
3793
|
+
/**
|
|
3794
|
+
* Typical message and new state set.
|
|
3795
|
+
* @state CHANGE
|
|
3796
|
+
* @reason Incoming message has a timestamp greater
|
|
3797
|
+
*/
|
|
3798
|
+
StateUpdatedTimestamp = 1,
|
|
3799
|
+
/**
|
|
3800
|
+
* Typical message when it is considered old.
|
|
3801
|
+
* @state it does NOT CHANGE.
|
|
3802
|
+
* @reason incoming message has a timestamp lower.
|
|
3803
|
+
*/
|
|
3804
|
+
StateOutdatedTimestamp = 2,
|
|
3805
|
+
/**
|
|
3806
|
+
* Weird message, same timestamp and data.
|
|
3807
|
+
* @state it does NOT CHANGE.
|
|
3808
|
+
* @reason consistent state between peers.
|
|
3809
|
+
*/
|
|
3810
|
+
NoChanges = 3,
|
|
3811
|
+
/**
|
|
3812
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3813
|
+
* @state it does NOT CHANGE.
|
|
3814
|
+
* @reason incoming message has a LOWER data.
|
|
3815
|
+
*/
|
|
3816
|
+
StateOutdatedData = 4,
|
|
3817
|
+
/**
|
|
3818
|
+
* Less but typical message, same timestamp, resolution by data.
|
|
3819
|
+
* @state CHANGE.
|
|
3820
|
+
* @reason incoming message has a GREATER data.
|
|
3821
|
+
*/
|
|
3822
|
+
StateUpdatedData = 5,
|
|
3823
|
+
/**
|
|
3824
|
+
* Entity was previously deleted.
|
|
3825
|
+
* @state it does NOT CHANGE.
|
|
3826
|
+
* @reason The message is considered old.
|
|
3827
|
+
*/
|
|
3828
|
+
EntityWasDeleted = 6,
|
|
3829
|
+
/**
|
|
3830
|
+
* Entity should be deleted.
|
|
3831
|
+
* @state CHANGE.
|
|
3832
|
+
* @reason the state is storing old entities
|
|
3833
|
+
*/
|
|
3834
|
+
EntityDeleted = 7
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
/**
|
|
3716
3838
|
* @public
|
|
3717
3839
|
*/
|
|
3718
|
-
export declare type
|
|
3840
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3719
3841
|
|
|
3720
3842
|
/**
|
|
3721
3843
|
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
@@ -4612,7 +4734,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
|
|
|
4612
4734
|
* @public
|
|
4613
4735
|
* @category Component
|
|
4614
4736
|
*/
|
|
4615
|
-
export declare function UiEntity(props: EntityPropTypes
|
|
4737
|
+
export declare function UiEntity(props: EntityPropTypes & {
|
|
4738
|
+
uiText?: UiLabelProps;
|
|
4739
|
+
}): ReactEcs.JSX.Element;
|
|
4616
4740
|
|
|
4617
4741
|
/**
|
|
4618
4742
|
* @public
|
|
@@ -4695,11 +4819,11 @@ export declare interface UiTransformProps {
|
|
|
4695
4819
|
/** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
|
4696
4820
|
flexDirection?: FlexDirectionType;
|
|
4697
4821
|
/** The position property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
|
4698
|
-
position?: Partial<Position
|
|
4822
|
+
position?: Partial<Position> | PositionShorthand;
|
|
4699
4823
|
/** The padding shorthand property sets the padding area on all four sides of an element at once. */
|
|
4700
|
-
padding?: Partial<Position
|
|
4824
|
+
padding?: Partial<Position> | PositionShorthand;
|
|
4701
4825
|
/** The margin shorthand property sets the margin area on all four sides of an element. */
|
|
4702
|
-
margin?: Partial<Position
|
|
4826
|
+
margin?: Partial<Position> | PositionShorthand;
|
|
4703
4827
|
/** The width property specifies the width of an element. */
|
|
4704
4828
|
width?: PositionUnit;
|
|
4705
4829
|
/** The height property specifies the height of an element. */
|