@dcl/playground-assets 7.0.6-4153633895.commit-4aad233 → 7.0.6-4180146485.commit-9a7dde9
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 +244 -149
- package/dist/beta.d.ts +244 -149
- package/dist/index.bundled.d.ts +244 -149
- package/dist/index.js +411 -199
- 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 +3 -3
- package/dist/playground/snippets/ui-backgrounds.tsx +5 -26
- package/dist/playground/snippets/ui.tsx +4 -21
- package/dist/playground-assets.d.ts +244 -149
- package/etc/playground-assets.api.json +2105 -1647
- package/etc/playground-assets.api.md +132 -92
- package/package.json +3 -3
package/dist/alpha.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const Animator: AnimatorComponentDefinitionExtended;
|
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export declare interface AnimatorComponentDefinitionExtended extends
|
|
11
|
+
export declare interface AnimatorComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBAnimator> {
|
|
12
12
|
/**
|
|
13
13
|
* @public
|
|
14
14
|
*
|
|
@@ -48,11 +48,33 @@ export declare interface AnimatorComponentDefinitionExtended extends ComponentDe
|
|
|
48
48
|
stopAllAnimations(entity: Entity, resetCursor?: boolean): boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare type AppendValueMessage = CrdtMessageHeader & AppendValueMessageBody;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
58
|
+
*
|
|
59
|
+
* @param entity - Uint32 number of the entity
|
|
60
|
+
* @param componentId - Uint32 number of id
|
|
61
|
+
* @param timestamp - Uint32 timestamp
|
|
62
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare type AppendValueMessageBody = {
|
|
66
|
+
type: CrdtMessageType.APPEND_VALUE;
|
|
67
|
+
entityId: Entity;
|
|
68
|
+
componentId: number;
|
|
69
|
+
timestamp: number;
|
|
70
|
+
data: Uint8Array;
|
|
71
|
+
};
|
|
72
|
+
|
|
51
73
|
/** @public */
|
|
52
|
-
export declare const AudioSource:
|
|
74
|
+
export declare const AudioSource: LastWriteWinElementSetComponentDefinition<PBAudioSource>;
|
|
53
75
|
|
|
54
76
|
/** @public */
|
|
55
|
-
export declare const AudioStream:
|
|
77
|
+
export declare const AudioStream: LastWriteWinElementSetComponentDefinition<PBAudioStream>;
|
|
56
78
|
|
|
57
79
|
/**
|
|
58
80
|
* @public
|
|
@@ -65,10 +87,10 @@ export declare const enum AvatarAnchorPointType {
|
|
|
65
87
|
}
|
|
66
88
|
|
|
67
89
|
/** @public */
|
|
68
|
-
export declare const AvatarAttach:
|
|
90
|
+
export declare const AvatarAttach: LastWriteWinElementSetComponentDefinition<PBAvatarAttach>;
|
|
69
91
|
|
|
70
92
|
/** @public */
|
|
71
|
-
export declare const AvatarModifierArea:
|
|
93
|
+
export declare const AvatarModifierArea: LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>;
|
|
72
94
|
|
|
73
95
|
/**
|
|
74
96
|
* @public
|
|
@@ -79,7 +101,7 @@ export declare const enum AvatarModifierType {
|
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
/** @public */
|
|
82
|
-
export declare const AvatarShape:
|
|
104
|
+
export declare const AvatarShape: LastWriteWinElementSetComponentDefinition<PBAvatarShape>;
|
|
83
105
|
|
|
84
106
|
/**
|
|
85
107
|
* @public
|
|
@@ -116,8 +138,52 @@ export declare const enum BackgroundTextureMode {
|
|
|
116
138
|
STRETCH = 2
|
|
117
139
|
}
|
|
118
140
|
|
|
141
|
+
/**
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export declare interface BaseComponent<T> {
|
|
145
|
+
readonly componentId: number;
|
|
146
|
+
readonly componentName: string;
|
|
147
|
+
readonly componentType: ComponentType;
|
|
148
|
+
readonly schema: ISchema<T>;
|
|
149
|
+
/**
|
|
150
|
+
* This function receives a CRDT update and returns a touple with a "conflict
|
|
151
|
+
* resoluton" message, in case of the sender being updated or null in case of noop/accepted
|
|
152
|
+
* change. The second element of the touple is the modified/changed/deleted value.
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
updateFromCrdt(body: CrdtMessageBody): [null | ConflictResolutionMessage, T | undefined];
|
|
156
|
+
/**
|
|
157
|
+
* This function returns an iterable with all the CRDT updates that need to be
|
|
158
|
+
* broadcasted to other actors in the system. After returning, this function
|
|
159
|
+
* clears the internal dirty state. Updates are produced only once.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
getCrdtUpdates(): Iterable<CrdtMessageBody>;
|
|
163
|
+
/**
|
|
164
|
+
* @public
|
|
165
|
+
* Marks the entity as deleted and signals it cannot be used ever again. It must
|
|
166
|
+
* clear the component internal state, produces a synchronization message to remove
|
|
167
|
+
* the component from the entity.
|
|
168
|
+
* @param entity - Entity ID that was deleted.
|
|
169
|
+
*/
|
|
170
|
+
entityDeleted(entity: Entity, markAsDirty: boolean): void;
|
|
171
|
+
/**
|
|
172
|
+
* Get if the entity has this component
|
|
173
|
+
* @param entity - entity to test
|
|
174
|
+
*/
|
|
175
|
+
has(entity: Entity): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Get the readonly component of the entity (to mutate it, use getMutable instead),
|
|
178
|
+
* throws an error if the entity doesn't have the component.
|
|
179
|
+
* @param entity - Entity that will be used to get the component
|
|
180
|
+
* @returns
|
|
181
|
+
*/
|
|
182
|
+
get(entity: Entity): any;
|
|
183
|
+
}
|
|
184
|
+
|
|
119
185
|
/** @public */
|
|
120
|
-
export declare const Billboard:
|
|
186
|
+
export declare const Billboard: LastWriteWinElementSetComponentDefinition<PBBillboard>;
|
|
121
187
|
|
|
122
188
|
/**
|
|
123
189
|
* @public
|
|
@@ -267,10 +333,10 @@ export declare interface ByteBuffer {
|
|
|
267
333
|
export declare type Callback = () => void;
|
|
268
334
|
|
|
269
335
|
/** @public */
|
|
270
|
-
export declare const CameraMode:
|
|
336
|
+
export declare const CameraMode: LastWriteWinElementSetComponentDefinition<PBCameraMode>;
|
|
271
337
|
|
|
272
338
|
/** @public */
|
|
273
|
-
export declare const CameraModeArea:
|
|
339
|
+
export declare const CameraModeArea: LastWriteWinElementSetComponentDefinition<PBCameraModeArea>;
|
|
274
340
|
|
|
275
341
|
/**
|
|
276
342
|
* @public
|
|
@@ -999,94 +1065,23 @@ export declare type Color4Type = {
|
|
|
999
1065
|
/**
|
|
1000
1066
|
* @public
|
|
1001
1067
|
*/
|
|
1002
|
-
export declare
|
|
1003
|
-
readonly componentId: number;
|
|
1004
|
-
readonly componentName: string;
|
|
1005
|
-
/**
|
|
1006
|
-
* Return the default value of the current component
|
|
1007
|
-
*/
|
|
1008
|
-
default(): DeepReadonly<T>;
|
|
1009
|
-
/**
|
|
1010
|
-
* Get if the entity has this component
|
|
1011
|
-
* @param entity - entity to test
|
|
1012
|
-
*/
|
|
1013
|
-
has(entity: Entity): boolean;
|
|
1014
|
-
/**
|
|
1015
|
-
* Get the readonly component of the entity (to mutate it, use getMutable instead), throw an error if the entity doesn't have the component.
|
|
1016
|
-
* @param entity - Entity that will be used to get the component
|
|
1017
|
-
* @returns
|
|
1018
|
-
*/
|
|
1019
|
-
get(entity: Entity): DeepReadonly<T>;
|
|
1020
|
-
/**
|
|
1021
|
-
* Get the readonly component of the entity (to mutate it, use getMutable instead), or null if the entity doesn't have the component.
|
|
1022
|
-
* @param entity - Entity that will be used to try to get the component
|
|
1023
|
-
*/
|
|
1024
|
-
getOrNull(entity: Entity): DeepReadonly<T> | null;
|
|
1025
|
-
/**
|
|
1026
|
-
* Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
|
|
1027
|
-
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1028
|
-
* @param entity - Entity that will be used to create the component
|
|
1029
|
-
* @param val - The initial value
|
|
1030
|
-
*/
|
|
1031
|
-
create(entity: Entity, val?: T): T;
|
|
1032
|
-
/**
|
|
1033
|
-
* Add the current component to an entity or replace the content if the entity already has the component
|
|
1034
|
-
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1035
|
-
* @param entity - Entity that will be used to create or replace the component
|
|
1036
|
-
* @param val - The initial or new value
|
|
1037
|
-
*/
|
|
1038
|
-
createOrReplace(entity: Entity, val?: T): T;
|
|
1039
|
-
/**
|
|
1040
|
-
* @public
|
|
1041
|
-
* Delete the current component to an entity, return null if the entity doesn't have the current component.
|
|
1042
|
-
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1043
|
-
* @param entity - Entity to delete the component from
|
|
1044
|
-
*/
|
|
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;
|
|
1054
|
-
/**
|
|
1055
|
-
* Get the mutable component of the entity, throw an error if the entity doesn't have the component.
|
|
1056
|
-
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1057
|
-
* @param entity - Entity to get the component from
|
|
1058
|
-
*/
|
|
1059
|
-
getMutable(entity: Entity): T;
|
|
1060
|
-
/**
|
|
1061
|
-
* Get the mutable component of the entity, return null if the entity doesn't have the component.
|
|
1062
|
-
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1063
|
-
* @param entity - Entity to get the component from
|
|
1064
|
-
*/
|
|
1065
|
-
getMutableOrNull(entity: Entity): T | null;
|
|
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>;
|
|
1080
|
-
}
|
|
1068
|
+
export declare type ComponentDefinition<T> = LastWriteWinElementSetComponentDefinition<T> | GrowOnlyValueSetComponentDefinition<T>;
|
|
1081
1069
|
|
|
1082
|
-
|
|
1070
|
+
/**
|
|
1071
|
+
* Component types are used to pick the wire protocol and the conflict resolution algorithm
|
|
1072
|
+
* @public
|
|
1073
|
+
*/
|
|
1074
|
+
export declare const enum ComponentType {
|
|
1075
|
+
LastWriteWinElementSet = 0,
|
|
1076
|
+
GrowOnlyValueSet = 1
|
|
1077
|
+
}
|
|
1083
1078
|
|
|
1084
1079
|
/**
|
|
1080
|
+
* A conflict resolution message is the response to an outdated or invalid state
|
|
1081
|
+
* in the CRDT.
|
|
1085
1082
|
* @public
|
|
1086
1083
|
*/
|
|
1087
|
-
export declare type
|
|
1088
|
-
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1089
|
-
};
|
|
1084
|
+
export declare type ConflictResolutionMessage = PutComponentMessageBody | DeleteComponentMessageBody;
|
|
1090
1085
|
|
|
1091
1086
|
/**
|
|
1092
1087
|
* @public
|
|
@@ -1096,12 +1091,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
|
1096
1091
|
/**
|
|
1097
1092
|
* @public
|
|
1098
1093
|
*/
|
|
1099
|
-
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1094
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage | AppendValueMessage;
|
|
1100
1095
|
|
|
1101
1096
|
/**
|
|
1102
1097
|
* @public
|
|
1103
1098
|
*/
|
|
1104
|
-
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody;
|
|
1099
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody;
|
|
1105
1100
|
|
|
1106
1101
|
/**
|
|
1107
1102
|
* Min length = 8 bytes
|
|
@@ -1123,7 +1118,8 @@ export declare enum CrdtMessageType {
|
|
|
1123
1118
|
PUT_COMPONENT = 1,
|
|
1124
1119
|
DELETE_COMPONENT = 2,
|
|
1125
1120
|
DELETE_ENTITY = 3,
|
|
1126
|
-
|
|
1121
|
+
APPEND_VALUE = 4,
|
|
1122
|
+
MAX_MESSAGE_TYPE = 5
|
|
1127
1123
|
}
|
|
1128
1124
|
|
|
1129
1125
|
export declare function createEthereumProvider(): {
|
|
@@ -1131,10 +1127,6 @@ export declare function createEthereumProvider(): {
|
|
|
1131
1127
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
1132
1128
|
};
|
|
1133
1129
|
|
|
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
|
-
|
|
1138
1130
|
/**
|
|
1139
1131
|
* Transform parenting: cyclic dependency checker
|
|
1140
1132
|
* It checks only in modified Transforms
|
|
@@ -1155,12 +1147,12 @@ export declare function cyclicParentingChecker(engine: IEngine): () => void;
|
|
|
1155
1147
|
/**
|
|
1156
1148
|
* @public
|
|
1157
1149
|
*/
|
|
1158
|
-
export declare type DeepReadonly<T> = T extends ReadonlyPrimitive ? T : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends Set<infer M> ? DeepReadonlySet<M> : DeepReadonlyObject<T>;
|
|
1150
|
+
export declare type DeepReadonly<T> = T extends ReadonlyPrimitive ? T : T extends Array<infer K> ? ReadonlyArray<DeepReadonly<K>> : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends Set<infer M> ? DeepReadonlySet<M> : DeepReadonlyObject<T>;
|
|
1159
1151
|
|
|
1160
1152
|
/**
|
|
1161
1153
|
* @public
|
|
1162
1154
|
*/
|
|
1163
|
-
export declare type DeepReadonlyMap<K, V> = ReadonlyMap<
|
|
1155
|
+
export declare type DeepReadonlyMap<K, V> = ReadonlyMap<K, DeepReadonly<V>>;
|
|
1164
1156
|
|
|
1165
1157
|
/**
|
|
1166
1158
|
* @public
|
|
@@ -1349,7 +1341,7 @@ export declare const Epsilon = 0.000001;
|
|
|
1349
1341
|
/**
|
|
1350
1342
|
* @public
|
|
1351
1343
|
*/
|
|
1352
|
-
export declare type EventSystemCallback = (event:
|
|
1344
|
+
export declare type EventSystemCallback = (event: PBPointerEventsResult) => void;
|
|
1353
1345
|
|
|
1354
1346
|
/**
|
|
1355
1347
|
* @public
|
|
@@ -1418,7 +1410,30 @@ export declare type GlobalInputEventResult = InputEventResult & {
|
|
|
1418
1410
|
};
|
|
1419
1411
|
|
|
1420
1412
|
/** @public */
|
|
1421
|
-
export declare const GltfContainer:
|
|
1413
|
+
export declare const GltfContainer: LastWriteWinElementSetComponentDefinition<PBGltfContainer>;
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* @public
|
|
1417
|
+
*/
|
|
1418
|
+
export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComponent<T> {
|
|
1419
|
+
readonly componentType: ComponentType.GrowOnlyValueSet;
|
|
1420
|
+
/**
|
|
1421
|
+
* Appends an element to the set.
|
|
1422
|
+
* @param entity - Entity that will host the value
|
|
1423
|
+
* @param val - The final value. The Set will freeze the value, it won't be editable from
|
|
1424
|
+
* the script.
|
|
1425
|
+
*/
|
|
1426
|
+
addValue(entity: Entity, val: DeepReadonly<T>): DeepReadonlySet<T>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Get the readonly component of the entity (to mutate it, use getMutable instead),
|
|
1429
|
+
* throws an error if the entity doesn't have the component.
|
|
1430
|
+
* @param entity - Entity that will be used to get the component
|
|
1431
|
+
* @returns
|
|
1432
|
+
*/
|
|
1433
|
+
get(entity: Entity): DeepReadonlySet<T>;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
1422
1437
|
|
|
1423
1438
|
/**
|
|
1424
1439
|
* @public
|
|
@@ -1513,7 +1528,21 @@ export declare interface IEngine {
|
|
|
1513
1528
|
* const StateComponent = engine.defineComponentFromSchema("my-lib::VisibleComponent", Schemas.Bool)
|
|
1514
1529
|
* ```
|
|
1515
1530
|
*/
|
|
1516
|
-
defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>):
|
|
1531
|
+
defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>): LastWriteWinElementSetComponentDefinition<T>;
|
|
1532
|
+
/**
|
|
1533
|
+
* @public
|
|
1534
|
+
* Defines a value set component.
|
|
1535
|
+
* @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
|
|
1536
|
+
* @param spec - An object with schema fields
|
|
1537
|
+
* @returns The component definition
|
|
1538
|
+
*
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```ts
|
|
1541
|
+
* const StateComponentId = 10023
|
|
1542
|
+
* const StateComponent = engine.defineValueSetComponentFromSchema("my-lib::VisibleComponent", Schemas.Int)
|
|
1543
|
+
* ```
|
|
1544
|
+
*/
|
|
1545
|
+
defineValueSetComponentFromSchema<T>(componentName: string, spec: ISchema<T>, options: ValueSetOptions<T>): GrowOnlyValueSetComponentDefinition<T>;
|
|
1517
1546
|
/**
|
|
1518
1547
|
* @public
|
|
1519
1548
|
* Get the component definition from the component id.
|
|
@@ -1733,7 +1762,7 @@ export declare type IInputSystem = {
|
|
|
1733
1762
|
* @param entity - the entity to query, ignore for global
|
|
1734
1763
|
* @returns boolean
|
|
1735
1764
|
*/
|
|
1736
|
-
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity
|
|
1765
|
+
isTriggered: (inputAction: InputAction, pointerEventType: PointerEventType, entity: Entity) => boolean;
|
|
1737
1766
|
/**
|
|
1738
1767
|
* @public
|
|
1739
1768
|
* Check if an input action is currently being pressed.
|
|
@@ -1749,7 +1778,7 @@ export declare type IInputSystem = {
|
|
|
1749
1778
|
* @param entity - the entity to query, ignore for global
|
|
1750
1779
|
* @returns the input command info or undefined if there is no command in the last tick-update
|
|
1751
1780
|
*/
|
|
1752
|
-
getInputCommand: (inputAction: InputAction, pointerEventType: PointerEventType, entity
|
|
1781
|
+
getInputCommand: (inputAction: InputAction, pointerEventType: PointerEventType, entity: Entity) => PBPointerEventsResult | null;
|
|
1753
1782
|
};
|
|
1754
1783
|
|
|
1755
1784
|
/**
|
|
@@ -1760,8 +1789,6 @@ export declare type IncludeUndefined<T> = {
|
|
|
1760
1789
|
[P in keyof T]: undefined extends T[P] ? P : never;
|
|
1761
1790
|
}[keyof T];
|
|
1762
1791
|
|
|
1763
|
-
export declare function incrementTimestamp(entity: Entity, timestamps: Map<Entity, number>): number;
|
|
1764
|
-
|
|
1765
1792
|
/**
|
|
1766
1793
|
* @public
|
|
1767
1794
|
* Input component
|
|
@@ -1829,10 +1856,10 @@ export declare const inputSystem: IInputSystem;
|
|
|
1829
1856
|
* @public
|
|
1830
1857
|
*/
|
|
1831
1858
|
export declare interface ISchema<T = any> {
|
|
1832
|
-
serialize(value: T
|
|
1859
|
+
serialize(value: DeepReadonly<T>, builder: ByteBuffer): void;
|
|
1833
1860
|
deserialize(reader: ByteBuffer): T;
|
|
1834
1861
|
create(): T;
|
|
1835
|
-
extend?: (base
|
|
1862
|
+
extend?: (base: Partial<DeepReadonly<T>> | undefined) => T;
|
|
1836
1863
|
}
|
|
1837
1864
|
|
|
1838
1865
|
/**
|
|
@@ -1871,6 +1898,58 @@ export declare type Key = number | string;
|
|
|
1871
1898
|
*/
|
|
1872
1899
|
export declare function Label(props: EntityPropTypes & UiLabelProps): ReactEcs.JSX.Element;
|
|
1873
1900
|
|
|
1901
|
+
/**
|
|
1902
|
+
* @public
|
|
1903
|
+
*/
|
|
1904
|
+
export declare interface LastWriteWinElementSetComponentDefinition<T> extends BaseComponent<T> {
|
|
1905
|
+
readonly componentType: ComponentType.LastWriteWinElementSet;
|
|
1906
|
+
/**
|
|
1907
|
+
* Get the readonly component of the entity (to mutate it, use getMutable instead),
|
|
1908
|
+
* throws an error if the entity doesn't have the component.
|
|
1909
|
+
* @param entity - Entity that will be used to get the component
|
|
1910
|
+
* @returns
|
|
1911
|
+
*/
|
|
1912
|
+
get(entity: Entity): DeepReadonly<T>;
|
|
1913
|
+
/**
|
|
1914
|
+
* Get the readonly component of the entity (to mutate it, use getMutable instead), or null if the entity doesn't have the component.
|
|
1915
|
+
* @param entity - Entity that will be used to try to get the component
|
|
1916
|
+
*/
|
|
1917
|
+
getOrNull(entity: Entity): DeepReadonly<T> | null;
|
|
1918
|
+
/**
|
|
1919
|
+
* Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
|
|
1920
|
+
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1921
|
+
* @param entity - Entity that will be used to create the component
|
|
1922
|
+
* @param val - The initial value
|
|
1923
|
+
*/
|
|
1924
|
+
create(entity: Entity, val?: T): T;
|
|
1925
|
+
/**
|
|
1926
|
+
* Add the current component to an entity or replace the content if the entity already has the component
|
|
1927
|
+
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1928
|
+
* @param entity - Entity that will be used to create or replace the component
|
|
1929
|
+
* @param val - The initial or new value
|
|
1930
|
+
*/
|
|
1931
|
+
createOrReplace(entity: Entity, val?: T): T;
|
|
1932
|
+
/**
|
|
1933
|
+
* @public
|
|
1934
|
+
* Delete the current component to an entity, return null if the entity doesn't have the current component.
|
|
1935
|
+
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1936
|
+
* @param entity - Entity to delete the component from
|
|
1937
|
+
*/
|
|
1938
|
+
deleteFrom(entity: Entity): T | null;
|
|
1939
|
+
/**
|
|
1940
|
+
* Get the mutable component of the entity, throw an error if the entity doesn't have the component.
|
|
1941
|
+
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1942
|
+
* @param entity - Entity to get the component from
|
|
1943
|
+
*/
|
|
1944
|
+
getMutable(entity: Entity): T;
|
|
1945
|
+
/**
|
|
1946
|
+
* Get the mutable component of the entity, return null if the entity doesn't have the component.
|
|
1947
|
+
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
1948
|
+
* @param entity - Entity to get the component from
|
|
1949
|
+
*/
|
|
1950
|
+
getMutableOrNull(entity: Entity): T | null;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1874
1953
|
/**
|
|
1875
1954
|
* User key event Listeners
|
|
1876
1955
|
* @public
|
|
@@ -1882,11 +1961,13 @@ export declare type Listeners = {
|
|
|
1882
1961
|
onMouseUp?: Callback;
|
|
1883
1962
|
};
|
|
1884
1963
|
|
|
1964
|
+
export declare type LwwComponentGetter<T extends LastWriteWinElementSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineComponentFromSchema'>) => T;
|
|
1965
|
+
|
|
1885
1966
|
/**
|
|
1886
1967
|
* @public
|
|
1887
1968
|
* Overrides component definition to support partial default values
|
|
1888
1969
|
*/
|
|
1889
|
-
export declare interface MapComponentDefinition<T> extends
|
|
1970
|
+
export declare interface MapComponentDefinition<T> extends LastWriteWinElementSetComponentDefinition<T> {
|
|
1890
1971
|
/**
|
|
1891
1972
|
* Add the current component to an entity, throw an error if the component already exists (use `createOrReplace` instead).
|
|
1892
1973
|
* - Internal comment: This method adds the <entity,component> to the list to be reviewed next frame
|
|
@@ -1915,7 +1996,7 @@ export declare const Material: MaterialComponentDefinitionExtended;
|
|
|
1915
1996
|
/**
|
|
1916
1997
|
* @public
|
|
1917
1998
|
*/
|
|
1918
|
-
export declare interface MaterialComponentDefinitionExtended extends
|
|
1999
|
+
export declare interface MaterialComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBMaterial> {
|
|
1919
2000
|
/**
|
|
1920
2001
|
* Texture helpers with constructor
|
|
1921
2002
|
*/
|
|
@@ -2681,7 +2762,7 @@ export declare const MeshCollider: MeshColliderComponentDefinitionExtended;
|
|
|
2681
2762
|
/**
|
|
2682
2763
|
* @public
|
|
2683
2764
|
*/
|
|
2684
|
-
export declare interface MeshColliderComponentDefinitionExtended extends
|
|
2765
|
+
export declare interface MeshColliderComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBMeshCollider> {
|
|
2685
2766
|
/**
|
|
2686
2767
|
* @public
|
|
2687
2768
|
* Set a box in the MeshCollider component
|
|
@@ -2719,7 +2800,7 @@ export declare const MeshRenderer: MeshRendererComponentDefinitionExtended;
|
|
|
2719
2800
|
/**
|
|
2720
2801
|
* @public
|
|
2721
2802
|
*/
|
|
2722
|
-
export declare interface MeshRendererComponentDefinitionExtended extends
|
|
2803
|
+
export declare interface MeshRendererComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBMeshRenderer> {
|
|
2723
2804
|
/**
|
|
2724
2805
|
* @public
|
|
2725
2806
|
* Set a box in the MeshRenderer component
|
|
@@ -2789,7 +2870,7 @@ export declare const enum NftFrameType {
|
|
|
2789
2870
|
}
|
|
2790
2871
|
|
|
2791
2872
|
/** @public */
|
|
2792
|
-
export declare const NftShape:
|
|
2873
|
+
export declare const NftShape: LastWriteWinElementSetComponentDefinition<PBNftShape>;
|
|
2793
2874
|
|
|
2794
2875
|
export declare class Observable<T> {
|
|
2795
2876
|
private _observers;
|
|
@@ -2833,7 +2914,7 @@ export declare class ObserverEventState {
|
|
|
2833
2914
|
/**
|
|
2834
2915
|
* @public
|
|
2835
2916
|
*/
|
|
2836
|
-
export declare type OnChangeFunction = (entity: Entity, operation: CrdtMessageType, component?: ComponentDefinition<any
|
|
2917
|
+
export declare type OnChangeFunction = (entity: Entity, operation: CrdtMessageType, component?: ComponentDefinition<any>, componentValue?: any) => void;
|
|
2837
2918
|
|
|
2838
2919
|
export declare const onCommsMessage: Observable<{
|
|
2839
2920
|
sender: string;
|
|
@@ -3271,20 +3352,11 @@ export declare interface PBPointerEvents_Info {
|
|
|
3271
3352
|
showFeedback?: boolean | undefined;
|
|
3272
3353
|
}
|
|
3273
3354
|
|
|
3274
|
-
/**
|
|
3355
|
+
/** renderer append a new object of this in each command, there can be many commands per frames */
|
|
3275
3356
|
/**
|
|
3276
3357
|
* @public
|
|
3277
3358
|
*/
|
|
3278
3359
|
export declare interface PBPointerEventsResult {
|
|
3279
|
-
/** a list of the last N pointer commands (from the engine) */
|
|
3280
|
-
commands: PBPointerEventsResult_PointerCommand[];
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
/** this message represents a pointer event, used both for UP and DOWN actions */
|
|
3284
|
-
/**
|
|
3285
|
-
* @public
|
|
3286
|
-
*/
|
|
3287
|
-
export declare interface PBPointerEventsResult_PointerCommand {
|
|
3288
3360
|
/** identifier of the input */
|
|
3289
3361
|
button: InputAction;
|
|
3290
3362
|
hit: RaycastHit | undefined;
|
|
@@ -3698,10 +3770,10 @@ export declare namespace Plane {
|
|
|
3698
3770
|
}
|
|
3699
3771
|
|
|
3700
3772
|
/** @public */
|
|
3701
|
-
export declare const PointerEvents:
|
|
3773
|
+
export declare const PointerEvents: LastWriteWinElementSetComponentDefinition<PBPointerEvents>;
|
|
3702
3774
|
|
|
3703
3775
|
/** @public */
|
|
3704
|
-
export declare const PointerEventsResult:
|
|
3776
|
+
export declare const PointerEventsResult: GrowOnlyValueSetComponentDefinition<PBPointerEventsResult>;
|
|
3705
3777
|
|
|
3706
3778
|
/**
|
|
3707
3779
|
* @public
|
|
@@ -3754,7 +3826,7 @@ export declare const enum PointerEventType {
|
|
|
3754
3826
|
}
|
|
3755
3827
|
|
|
3756
3828
|
/** @public */
|
|
3757
|
-
export declare const PointerLock:
|
|
3829
|
+
export declare const PointerLock: LastWriteWinElementSetComponentDefinition<PBPointerLock>;
|
|
3758
3830
|
|
|
3759
3831
|
/**
|
|
3760
3832
|
* Type used for defining the position of the element. i.e. margin, padding
|
|
@@ -3767,6 +3839,20 @@ export declare interface Position {
|
|
|
3767
3839
|
left: PositionUnit;
|
|
3768
3840
|
}
|
|
3769
3841
|
|
|
3842
|
+
/**
|
|
3843
|
+
* The values are in clockwise order, beginning at the top: top, right, bottom, then left
|
|
3844
|
+
|
|
3845
|
+
* When one value is specified, it applies the same margin to all four sides.
|
|
3846
|
+
*
|
|
3847
|
+
* When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
|
|
3848
|
+
*
|
|
3849
|
+
* When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
|
|
3850
|
+
*
|
|
3851
|
+
When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
|
|
3852
|
+
* @public
|
|
3853
|
+
*/
|
|
3854
|
+
export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
|
|
3855
|
+
|
|
3770
3856
|
/**
|
|
3771
3857
|
* @public
|
|
3772
3858
|
* The position property specifies the type of positioning method used for an element
|
|
@@ -3774,11 +3860,10 @@ export declare interface Position {
|
|
|
3774
3860
|
export declare type PositionType = 'absolute' | 'relative';
|
|
3775
3861
|
|
|
3776
3862
|
/**
|
|
3777
|
-
*
|
|
3778
|
-
* i.e. width="100", width="100%", width="100px"
|
|
3863
|
+
* unit value specified. i.e. 1 || '100%' || '1px'
|
|
3779
3864
|
* @public
|
|
3780
3865
|
*/
|
|
3781
|
-
export declare type PositionUnit = `${number}px` | `${number}%` | number
|
|
3866
|
+
export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
|
|
3782
3867
|
|
|
3783
3868
|
export declare enum ProcessMessageResultType {
|
|
3784
3869
|
/**
|
|
@@ -4111,7 +4196,7 @@ export declare type QuaternionType = {
|
|
|
4111
4196
|
export declare const RAD2DEG: number;
|
|
4112
4197
|
|
|
4113
4198
|
/** @public */
|
|
4114
|
-
export declare const Raycast:
|
|
4199
|
+
export declare const Raycast: LastWriteWinElementSetComponentDefinition<PBRaycast>;
|
|
4115
4200
|
|
|
4116
4201
|
/** Position will be relative to the scene */
|
|
4117
4202
|
/**
|
|
@@ -4142,7 +4227,7 @@ export declare type RaycastResponsePayload<T> = {
|
|
|
4142
4227
|
};
|
|
4143
4228
|
|
|
4144
4229
|
/** @public */
|
|
4145
|
-
export declare const RaycastResult:
|
|
4230
|
+
export declare const RaycastResult: LastWriteWinElementSetComponentDefinition<PBRaycastResult>;
|
|
4146
4231
|
|
|
4147
4232
|
/**
|
|
4148
4233
|
* @public
|
|
@@ -4491,7 +4576,7 @@ export declare const enum TextAlignMode {
|
|
|
4491
4576
|
export declare type TextAlignType = 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4492
4577
|
|
|
4493
4578
|
/** @public */
|
|
4494
|
-
export declare const TextShape:
|
|
4579
|
+
export declare const TextShape: LastWriteWinElementSetComponentDefinition<PBTextShape>;
|
|
4495
4580
|
|
|
4496
4581
|
/**
|
|
4497
4582
|
* @public
|
|
@@ -4605,7 +4690,7 @@ export declare const Transform: TransformComponentExtended;
|
|
|
4605
4690
|
/**
|
|
4606
4691
|
* @public
|
|
4607
4692
|
*/
|
|
4608
|
-
export declare type TransformComponent =
|
|
4693
|
+
export declare type TransformComponent = LastWriteWinElementSetComponentDefinition<TransformType>;
|
|
4609
4694
|
|
|
4610
4695
|
/**
|
|
4611
4696
|
* @public
|
|
@@ -4668,7 +4753,7 @@ export declare interface UiAvatarTexture {
|
|
|
4668
4753
|
}
|
|
4669
4754
|
|
|
4670
4755
|
/** @public */
|
|
4671
|
-
export declare const UiBackground:
|
|
4756
|
+
export declare const UiBackground: LastWriteWinElementSetComponentDefinition<PBUiBackground>;
|
|
4672
4757
|
|
|
4673
4758
|
/**
|
|
4674
4759
|
* @public
|
|
@@ -4706,7 +4791,7 @@ export declare interface UiButtonProps extends UiLabelProps, EntityPropTypes {
|
|
|
4706
4791
|
export declare type UiComponent = () => ReactEcs.JSX.Element;
|
|
4707
4792
|
|
|
4708
4793
|
/** @public */
|
|
4709
|
-
export declare const UiDropdown:
|
|
4794
|
+
export declare const UiDropdown: LastWriteWinElementSetComponentDefinition<PBUiDropdown>;
|
|
4710
4795
|
|
|
4711
4796
|
/**
|
|
4712
4797
|
* @public
|
|
@@ -4719,13 +4804,15 @@ export declare interface UiDropdownProps extends EntityPropTypes, Omit<Partial<P
|
|
|
4719
4804
|
}
|
|
4720
4805
|
|
|
4721
4806
|
/** @public */
|
|
4722
|
-
export declare const UiDropdownResult:
|
|
4807
|
+
export declare const UiDropdownResult: LastWriteWinElementSetComponentDefinition<PBUiDropdownResult>;
|
|
4723
4808
|
|
|
4724
4809
|
/**
|
|
4725
4810
|
* @public
|
|
4726
4811
|
* @category Component
|
|
4727
4812
|
*/
|
|
4728
|
-
export declare function UiEntity(props: EntityPropTypes
|
|
4813
|
+
export declare function UiEntity(props: EntityPropTypes & {
|
|
4814
|
+
uiText?: UiLabelProps;
|
|
4815
|
+
}): ReactEcs.JSX.Element;
|
|
4729
4816
|
|
|
4730
4817
|
/**
|
|
4731
4818
|
* @public
|
|
@@ -4733,7 +4820,7 @@ export declare function UiEntity(props: EntityPropTypes): ReactEcs.JSX.Element;
|
|
|
4733
4820
|
export declare type UiFontType = 'sans-serif' | 'serif' | 'monospace';
|
|
4734
4821
|
|
|
4735
4822
|
/** @public */
|
|
4736
|
-
export declare const UiInput:
|
|
4823
|
+
export declare const UiInput: LastWriteWinElementSetComponentDefinition<PBUiInput>;
|
|
4737
4824
|
|
|
4738
4825
|
/**
|
|
4739
4826
|
* @public
|
|
@@ -4746,7 +4833,7 @@ export declare interface UiInputProps extends Omit<PBUiInput, 'font' | 'textAlig
|
|
|
4746
4833
|
}
|
|
4747
4834
|
|
|
4748
4835
|
/** @public */
|
|
4749
|
-
export declare const UiInputResult:
|
|
4836
|
+
export declare const UiInputResult: LastWriteWinElementSetComponentDefinition<PBUiInputResult>;
|
|
4750
4837
|
|
|
4751
4838
|
/**
|
|
4752
4839
|
* Label component props
|
|
@@ -4771,7 +4858,7 @@ export declare interface UiLabelProps {
|
|
|
4771
4858
|
export declare type uint32 = number;
|
|
4772
4859
|
|
|
4773
4860
|
/** @public */
|
|
4774
|
-
export declare const UiText:
|
|
4861
|
+
export declare const UiText: LastWriteWinElementSetComponentDefinition<PBUiText>;
|
|
4775
4862
|
|
|
4776
4863
|
/**
|
|
4777
4864
|
* Texture
|
|
@@ -4784,7 +4871,7 @@ export declare type UiTexture = {
|
|
|
4784
4871
|
};
|
|
4785
4872
|
|
|
4786
4873
|
/** @public */
|
|
4787
|
-
export declare const UiTransform:
|
|
4874
|
+
export declare const UiTransform: LastWriteWinElementSetComponentDefinition<PBUiTransform>;
|
|
4788
4875
|
|
|
4789
4876
|
/**
|
|
4790
4877
|
* Layout props to position things in the canvas
|
|
@@ -4808,11 +4895,11 @@ export declare interface UiTransformProps {
|
|
|
4808
4895
|
/** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
|
4809
4896
|
flexDirection?: FlexDirectionType;
|
|
4810
4897
|
/** 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. */
|
|
4811
|
-
position?: Partial<Position
|
|
4898
|
+
position?: Partial<Position> | PositionShorthand;
|
|
4812
4899
|
/** The padding shorthand property sets the padding area on all four sides of an element at once. */
|
|
4813
|
-
padding?: Partial<Position
|
|
4900
|
+
padding?: Partial<Position> | PositionShorthand;
|
|
4814
4901
|
/** The margin shorthand property sets the margin area on all four sides of an element. */
|
|
4815
|
-
margin?: Partial<Position
|
|
4902
|
+
margin?: Partial<Position> | PositionShorthand;
|
|
4816
4903
|
/** The width property specifies the width of an element. */
|
|
4817
4904
|
width?: PositionUnit;
|
|
4818
4905
|
/** The height property specifies the height of an element. */
|
|
@@ -4842,6 +4929,14 @@ export declare interface UiTransformProps {
|
|
|
4842
4929
|
*/
|
|
4843
4930
|
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
4844
4931
|
|
|
4932
|
+
/**
|
|
4933
|
+
* @public
|
|
4934
|
+
*/
|
|
4935
|
+
export declare type ValueSetOptions<T> = {
|
|
4936
|
+
timestampFunction: (value: DeepReadonly<T>) => number;
|
|
4937
|
+
maxElements: number;
|
|
4938
|
+
};
|
|
4939
|
+
|
|
4845
4940
|
/**
|
|
4846
4941
|
* @public
|
|
4847
4942
|
* Vector3 is a type and a namespace.
|
|
@@ -5446,7 +5541,7 @@ export declare type Vector3Type = {
|
|
|
5446
5541
|
};
|
|
5447
5542
|
|
|
5448
5543
|
/** @public */
|
|
5449
|
-
export declare const VideoPlayer:
|
|
5544
|
+
export declare const VideoPlayer: LastWriteWinElementSetComponentDefinition<PBVideoPlayer>;
|
|
5450
5545
|
|
|
5451
5546
|
/**
|
|
5452
5547
|
* @public
|
|
@@ -5460,7 +5555,7 @@ export declare interface VideoTexture {
|
|
|
5460
5555
|
}
|
|
5461
5556
|
|
|
5462
5557
|
/** @public */
|
|
5463
|
-
export declare const VisibilityComponent:
|
|
5558
|
+
export declare const VisibilityComponent: LastWriteWinElementSetComponentDefinition<PBVisibilityComponent>;
|
|
5464
5559
|
|
|
5465
5560
|
/**
|
|
5466
5561
|
* @public
|