@dcl/sdk 7.0.0-2827081203.commit-fe0fe32 → 7.0.0-2875155444.commit-bb5e498

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.
@@ -16,10 +16,11 @@ declare const enum ActionButton {
16
16
  UNRECOGNIZED = -1
17
17
  }
18
18
 
19
- /**
20
- * @public
21
- */
22
- export declare function ArrayType<T>(type: EcsType<T>): EcsType<Array<T>>;
19
+ /** @public */
20
+ export declare const Animator: ComponentDefinition<ISchema<PBAnimator>>;
21
+
22
+ /** @public */
23
+ export declare const AudioSource: ComponentDefinition<ISchema<PBAudioSource>>;
23
24
 
24
25
  declare const enum AvatarAnchorPoint {
25
26
  POSITION = 0,
@@ -29,11 +30,29 @@ declare const enum AvatarAnchorPoint {
29
30
  UNRECOGNIZED = -1
30
31
  }
31
32
 
33
+ /** @public */
34
+ export declare const AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>>;
35
+
36
+ /** @public */
37
+ export declare const AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>>;
38
+
39
+ /** @public */
40
+ export declare const Billboard: ComponentDefinition<ISchema<PBBillboard>>;
41
+
42
+ /** @public */
43
+ export declare const BoxShape: ComponentDefinition<ISchema<PBBoxShape>>;
44
+
32
45
  /**
33
46
  * @public
34
47
  */
35
48
  export declare type ByteBuffer = ReturnType<typeof createByteBuffer>;
36
49
 
50
+ /** @public */
51
+ export declare const CameraMode: ComponentDefinition<ISchema<PBCameraMode>>;
52
+
53
+ /** @public */
54
+ export declare const CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>>;
55
+
37
56
  declare const enum CameraModeValue {
38
57
  FIRST_PERSON = 0,
39
58
  THIRD_PERSON = 1,
@@ -49,7 +68,7 @@ declare interface Color3 {
49
68
  /**
50
69
  * @public
51
70
  */
52
- export declare type ComponentDefinition<T extends EcsType = EcsType<any>> = {
71
+ export declare type ComponentDefinition<T extends ISchema = ISchema<any>> = {
53
72
  _id: number;
54
73
  has(entity: Entity): boolean;
55
74
  getFrom(entity: Entity): DeepReadonly<ComponentType<T>>;
@@ -68,17 +87,80 @@ export declare type ComponentDefinition<T extends EcsType = EcsType<any>> = {
68
87
  isDirty(entity: Entity): boolean;
69
88
  };
70
89
 
90
+ /** @public */
91
+ export declare namespace Components {
92
+ /** @public */
93
+ const Transform: ComponentDefinition<ISchema< {
94
+ position: {
95
+ x: number;
96
+ y: number;
97
+ z: number;
98
+ };
99
+ rotation: {
100
+ x: number;
101
+ y: number;
102
+ z: number;
103
+ w: number;
104
+ };
105
+ scale: {
106
+ x: number;
107
+ y: number;
108
+ /** @public */
109
+ z: number;
110
+ };
111
+ parent?: Entity | undefined;
112
+ }>>;
113
+ /** @public */
114
+ const Animator: ComponentDefinition<ISchema<PBAnimator>>;
115
+ /** @public */
116
+ const AudioSource: ComponentDefinition<ISchema<PBAudioSource>>;
117
+ /** @public */
118
+ const AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>>;
119
+ /** @public */
120
+ const AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>>;
121
+ /** @public */
122
+ const Billboard: ComponentDefinition<ISchema<PBBillboard>>;
123
+ /** @public */
124
+ const BoxShape: ComponentDefinition<ISchema<PBBoxShape>>;
125
+ /** @public */
126
+ const CameraMode: ComponentDefinition<ISchema<PBCameraMode>>;
127
+ /** @public */
128
+ const CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>>;
129
+ /** @public */
130
+ const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>>;
131
+ /** @public */
132
+ const GLTFShape: ComponentDefinition<ISchema<PBGLTFShape>>;
133
+ /** @public */
134
+ const NFTShape: ComponentDefinition<ISchema<PBNFTShape>>;
135
+ /** @public */
136
+ const OnPointerDown: ComponentDefinition<ISchema<PBOnPointerDown>>;
137
+ /** @public */
138
+ const OnPointerDownResult: ComponentDefinition<ISchema<PBOnPointerDownResult>>;
139
+ /** @public */
140
+ const OnPointerUp: ComponentDefinition<ISchema<PBOnPointerUp>>;
141
+ /** @public */
142
+ const OnPointerUpResult: ComponentDefinition<ISchema<PBOnPointerUpResult>>;
143
+ /** @public */
144
+ const PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>>;
145
+ /** @public */
146
+ const PointerLock: ComponentDefinition<ISchema<PBPointerLock>>;
147
+ /** @public */
148
+ const SphereShape: ComponentDefinition<ISchema<PBSphereShape>>;
149
+ /** @public */
150
+ const TextShape: ComponentDefinition<ISchema<PBTextShape>>;
151
+ }
152
+
71
153
  /**
72
154
  * @public
73
155
  */
74
- export declare type ComponentEcsType<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
156
+ export declare type ComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
75
157
  [K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['mutable']> : never;
76
158
  };
77
159
 
78
160
  /**
79
161
  * @public
80
162
  */
81
- export declare type ComponentType<T extends EcsType> = EcsResult<T>;
163
+ export declare type ComponentType<T extends ISchema> = EcsResult<T>;
82
164
 
83
165
  /**
84
166
  * ByteBuffer is a wrapper of DataView which also adds a read and write offset.
@@ -218,6 +300,9 @@ declare interface CreateByteBufferOptions {
218
300
  initialCapacity?: number;
219
301
  }
220
302
 
303
+ /** @public */
304
+ export declare const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>>;
305
+
221
306
  /**
222
307
  * Make each field readonly deeply
223
308
  * @public
@@ -226,27 +311,45 @@ export declare type DeepReadonly<T> = {
226
311
  readonly [P in keyof T]: DeepReadonly<T[P]>;
227
312
  };
228
313
 
229
- declare function defineSdkComponents(engine: Pick<IEngine, 'defineComponent'>): {
230
- Animator: ComponentDefinition<EcsType<PBAnimator>>;
231
- AudioSource: ComponentDefinition<EcsType<PBAudioSource>>;
232
- AvatarAttach: ComponentDefinition<EcsType<PBAvatarAttach>>;
233
- AvatarShape: ComponentDefinition<EcsType<PBAvatarShape>>;
234
- Billboard: ComponentDefinition<EcsType<PBBillboard>>;
235
- BoxShape: ComponentDefinition<EcsType<PBBoxShape>>;
236
- CameraMode: ComponentDefinition<EcsType<PBCameraMode>>;
237
- CameraModeArea: ComponentDefinition<EcsType<PBCameraModeArea>>;
238
- CylinderShape: ComponentDefinition<EcsType<PBCylinderShape>>;
239
- GLTFShape: ComponentDefinition<EcsType<PBGLTFShape>>;
240
- NFTShape: ComponentDefinition<EcsType<PBNFTShape>>;
241
- OnPointerDown: ComponentDefinition<EcsType<PBOnPointerDown>>;
242
- OnPointerDownResult: ComponentDefinition<EcsType<PBOnPointerDownResult>>;
243
- OnPointerUp: ComponentDefinition<EcsType<PBOnPointerUp>>;
244
- OnPointerUpResult: ComponentDefinition<EcsType<PBOnPointerUpResult>>;
245
- PlaneShape: ComponentDefinition<EcsType<PBPlaneShape>>;
246
- PointerLock: ComponentDefinition<EcsType<PBPointerLock>>;
247
- SphereShape: ComponentDefinition<EcsType<PBSphereShape>>;
248
- TextShape: ComponentDefinition<EcsType<PBTextShape>>;
249
- Transform: ComponentDefinition<EcsType<Transform>>;
314
+ declare function defineLibraryComponents({ defineComponent }: Pick<IEngine, 'defineComponent'>): {
315
+ Transform: ComponentDefinition<ISchema< {
316
+ position: {
317
+ x: number;
318
+ y: number;
319
+ z: number;
320
+ };
321
+ rotation: {
322
+ x: number;
323
+ y: number;
324
+ z: number;
325
+ w: number;
326
+ };
327
+ scale: {
328
+ x: number;
329
+ y: number;
330
+ z: number;
331
+ };
332
+ parent?: Entity | undefined;
333
+ }>>;
334
+ Animator: ComponentDefinition<ISchema<PBAnimator>>;
335
+ AudioSource: ComponentDefinition<ISchema<PBAudioSource>>;
336
+ AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>>;
337
+ AvatarShape: ComponentDefinition<ISchema<PBAvatarShape>>;
338
+ Billboard: ComponentDefinition<ISchema<PBBillboard>>;
339
+ BoxShape: ComponentDefinition<ISchema<PBBoxShape>>;
340
+ CameraMode: ComponentDefinition<ISchema<PBCameraMode>>;
341
+ CameraModeArea: ComponentDefinition<ISchema<PBCameraModeArea>>;
342
+ CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>>;
343
+ GLTFShape: ComponentDefinition<ISchema<PBGLTFShape>>;
344
+ NFTShape: ComponentDefinition<ISchema<PBNFTShape>>;
345
+ OnPointerDown: ComponentDefinition<ISchema<PBOnPointerDown>>;
346
+ OnPointerDownResult: ComponentDefinition<ISchema<PBOnPointerDownResult>>;
347
+ OnPointerUp: ComponentDefinition<ISchema<PBOnPointerUp>>;
348
+ OnPointerUpResult: ComponentDefinition<ISchema<PBOnPointerUpResult>>;
349
+ PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>>;
350
+ PointerLock: ComponentDefinition<ISchema<PBPointerLock>>;
351
+ SphereShape: ComponentDefinition<ISchema<PBSphereShape>>;
352
+ TextShape: ComponentDefinition<ISchema<PBTextShape>>;
250
353
  };
251
354
 
252
355
  /**
@@ -261,26 +364,7 @@ export declare type double = number;
261
364
  /**
262
365
  * @public
263
366
  */
264
- export declare const EcsBoolean: EcsType<boolean>;
265
-
266
- /**
267
- * @public
268
- */
269
- declare type EcsResult<T extends EcsType> = T extends EcsType ? ReturnType<T['deserialize']> : never;
270
-
271
- /**
272
- * @public
273
- */
274
- export declare const EcsString: EcsType<string>;
275
-
276
- /**
277
- * @public
278
- */
279
- export declare type EcsType<T = any> = {
280
- serialize(value: T, builder: ByteBuffer): void;
281
- deserialize(reader: ByteBuffer): T;
282
- create(): T;
283
- };
367
+ declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['deserialize']> : never;
284
368
 
285
369
  /**
286
370
  * @public
@@ -302,11 +386,6 @@ export declare type Entity = number & {
302
386
 
303
387
  declare const entitySymbol: unique symbol;
304
388
 
305
- /**
306
- * @public
307
- */
308
- export declare function Enum<T>(type: EcsType<any>): EcsType<T>;
309
-
310
389
  /**
311
390
  * Constant used to define the minimal number value in Babylon.js
312
391
  * @public
@@ -318,26 +397,19 @@ declare type ExcludeUndefined<T> = {
318
397
  [P in keyof T]: undefined extends T[P] ? never : P;
319
398
  }[keyof T];
320
399
 
321
- /**
322
- * @public
323
- */
324
- export declare const FlatString: EcsType<string>;
325
-
326
400
  /** @public */
327
401
  export declare type float = number;
328
402
 
329
- /**
330
- * @public
331
- */
332
- export declare const Float32: EcsType<number>;
403
+ /** @public */
404
+ export declare type FloatArray = number[];
405
+
406
+ /** @public */
407
+ export declare const GLTFShape: ComponentDefinition<ISchema<PBGLTFShape>>;
333
408
 
334
409
  /**
335
410
  * @public
336
411
  */
337
- export declare const Float64: EcsType<number>;
338
-
339
- /** @public */
340
- export declare type FloatArray = number[];
412
+ declare function IArray<T>(type: ISchema<T>): ISchema<Array<T>>;
341
413
 
342
414
  /**
343
415
  * @public
@@ -348,10 +420,10 @@ export declare type IEngine = {
348
420
  removeEntity(entity: Entity): void;
349
421
  addSystem(system: Update, priority?: number, name?: string): void;
350
422
  removeSystem(selector: string | Update): boolean;
351
- defineComponent<T extends EcsType>(componentId: number, spec: T): ComponentDefinition<T>;
352
- mutableGroupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ComponentEcsType<T>]>;
353
- groupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentEcsType<T>>]>;
354
- getComponent<T extends EcsType>(componentId: number): ComponentDefinition<T>;
423
+ defineComponent<T extends ISchema>(componentId: number, spec: T): ComponentDefinition<T>;
424
+ mutableGroupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ComponentSchema<T>]>;
425
+ groupOf<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentSchema<T>>]>;
426
+ getComponent<T extends ISchema>(componentId: number): ComponentDefinition<T>;
355
427
  update(dt: number): void;
356
428
  baseComponents: SdkComponents;
357
429
  };
@@ -363,30 +435,34 @@ export declare type IEngineParams = {
363
435
  transports?: Transport[];
364
436
  };
365
437
 
366
- /** Include property keys from T where the property is assignable to U */
367
- declare type IncludeUndefined<T> = {
368
- [P in keyof T]: undefined extends T[P] ? P : never;
369
- }[keyof T];
370
-
371
438
  /**
372
439
  * @public
373
440
  */
374
- export declare const Int16: EcsType<number>;
441
+ declare function IEnum<T>(type: ISchema<any>): ISchema<T>;
375
442
 
376
443
  /**
377
444
  * @public
378
445
  */
379
- export declare const Int32: EcsType<number>;
446
+ declare function IMap<T extends Spec>(spec: T): ISchema<Result<T>>;
447
+
448
+ /** Include property keys from T where the property is assignable to U */
449
+ declare type IncludeUndefined<T> = {
450
+ [P in keyof T]: undefined extends T[P] ? P : never;
451
+ }[keyof T];
380
452
 
381
453
  /**
382
454
  * @public
383
455
  */
384
- export declare const Int64: EcsType<number>;
456
+ declare function IOptional<T>(spec: ISchema<T>): ISchema<T | undefined>;
385
457
 
386
458
  /**
387
459
  * @public
388
460
  */
389
- export declare const Int8: EcsType<number>;
461
+ declare type ISchema<T = any> = {
462
+ serialize(value: T, builder: ByteBuffer): void;
463
+ deserialize(reader: ByteBuffer): T;
464
+ create(): T;
465
+ };
390
466
 
391
467
  /**
392
468
  * Interface for the size containing width and height
@@ -403,11 +479,6 @@ export declare interface ISize {
403
479
  height: number;
404
480
  }
405
481
 
406
- /**
407
- * @public
408
- */
409
- export declare function MapType<T extends Spec>(spec: T): EcsType<Result<T>>;
410
-
411
482
  /**
412
483
  * Class used to store matrix data (4x4)
413
484
  * @public
@@ -1127,6 +1198,9 @@ declare namespace Matrix {
1127
1198
  function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
1128
1199
  }
1129
1200
 
1201
+ /** @public */
1202
+ export declare const NFTShape: ComponentDefinition<ISchema<PBNFTShape>>;
1203
+
1130
1204
  /** @public */
1131
1205
  export declare type Nullable<T> = T | null;
1132
1206
 
@@ -1138,10 +1212,17 @@ declare type OnlyOptionalUndefinedTypes<T> = {
1138
1212
  [K in IncludeUndefined<T>]?: T[K];
1139
1213
  };
1140
1214
 
1141
- /**
1142
- * @public
1143
- */
1144
- export declare function Optional<T>(spec: EcsType<T>): EcsType<T | undefined>;
1215
+ /** @public */
1216
+ export declare const OnPointerDown: ComponentDefinition<ISchema<PBOnPointerDown>>;
1217
+
1218
+ /** @public */
1219
+ export declare const OnPointerDownResult: ComponentDefinition<ISchema<PBOnPointerDownResult>>;
1220
+
1221
+ /** @public */
1222
+ export declare const OnPointerUp: ComponentDefinition<ISchema<PBOnPointerUp>>;
1223
+
1224
+ /** @public */
1225
+ export declare const OnPointerUpResult: ComponentDefinition<ISchema<PBOnPointerUpResult>>;
1145
1226
 
1146
1227
  /**
1147
1228
  * Defines potential orientation for back face culling
@@ -1480,6 +1561,12 @@ declare namespace Plane {
1480
1561
  function signedDistanceTo(plane: ReadonlyPlane, point: Vector3.ReadonlyVector3): number;
1481
1562
  }
1482
1563
 
1564
+ /** @public */
1565
+ export declare const PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>>;
1566
+
1567
+ /** @public */
1568
+ export declare const PointerLock: ComponentDefinition<ISchema<PBPointerLock>>;
1569
+
1483
1570
  /**
1484
1571
  * @public
1485
1572
  */
@@ -1663,14 +1750,34 @@ declare type ReceiveMessage = {
1663
1750
  /**
1664
1751
  * @public
1665
1752
  */
1666
- export declare type Result<T extends Spec> = ToOptional<{
1667
- [K in keyof T]: T[K] extends EcsType ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
1753
+ declare type Result<T extends Spec> = ToOptional<{
1754
+ [K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? Result<T[K]> : never;
1668
1755
  }>;
1669
1756
 
1670
1757
  /**
1671
1758
  * @public
1672
1759
  */
1673
- export declare type SdkComponents = ReturnType<typeof defineSdkComponents>;
1760
+ export declare namespace Schemas {
1761
+ export type SchemaType = ISchema;
1762
+ const Boolean: ISchema<boolean>;
1763
+ const String: ISchema<string>;
1764
+ const Float: ISchema<number>;
1765
+ const Double: ISchema<number>;
1766
+ const Byte: ISchema<number>;
1767
+ const Short: ISchema<number>;
1768
+ const Int: ISchema<number>;
1769
+ const Int64: ISchema<number>;
1770
+ const Number: ISchema<number>;
1771
+ const Enum: typeof IEnum;
1772
+ const Array: typeof IArray;
1773
+ const Map: typeof IMap;
1774
+ const Optional: typeof IOptional;
1775
+ }
1776
+
1777
+ /**
1778
+ * @public
1779
+ */
1780
+ declare type SdkComponents = ReturnType<typeof defineLibraryComponents>;
1674
1781
 
1675
1782
  /**
1676
1783
  * Defines supported spaces
@@ -1688,10 +1795,16 @@ export declare enum Space {
1688
1795
  /**
1689
1796
  * @public
1690
1797
  */
1691
- export declare interface Spec {
1692
- [key: string]: EcsType;
1798
+ declare interface Spec {
1799
+ [key: string]: ISchema;
1693
1800
  }
1694
1801
 
1802
+ /** @public */
1803
+ export declare const SphereShape: ComponentDefinition<ISchema<PBSphereShape>>;
1804
+
1805
+ /** @public */
1806
+ export declare const TextShape: ComponentDefinition<ISchema<PBTextShape>>;
1807
+
1695
1808
  /**
1696
1809
  * Constant used to convert a value to gamma space
1697
1810
  * @public
@@ -1706,17 +1819,26 @@ export declare const ToLinearSpace = 2.2;
1706
1819
 
1707
1820
  declare type ToOptional<T> = OnlyOptionalUndefinedTypes<T> & OnlyNonUndefinedTypes<T>;
1708
1821
 
1709
- /**
1710
- * @public
1711
- */
1712
- declare type Transform = {
1713
- position: Vector3.MutableVector3;
1714
- rotation: Quaternion.MutableQuaternion;
1715
- scale: Vector3.MutableVector3;
1716
- parent?: Entity;
1822
+ /** @public */
1823
+ export declare const Transform: ComponentDefinition<ISchema< {
1824
+ position: {
1825
+ x: number;
1826
+ y: number;
1827
+ z: number;
1717
1828
  };
1718
-
1719
- declare const Transform: EcsType<Transform>;
1829
+ rotation: {
1830
+ x: number;
1831
+ y: number;
1832
+ z: number;
1833
+ w: number;
1834
+ };
1835
+ scale: {
1836
+ x: number;
1837
+ y: number;
1838
+ z: number;
1839
+ };
1840
+ parent?: Entity | undefined;
1841
+ }>>;
1720
1842
 
1721
1843
  declare type Transport = {
1722
1844
  type: string;