@dcl/sdk 7.0.0-2947735169.commit-65163b3 → 7.0.0-2965783764.commit-18f9e1c

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.
@@ -250,6 +250,8 @@ export declare namespace Components {
250
250
  const TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
251
251
  /** @public */
252
252
  const UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
253
+ /** @public */
254
+ const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
253
255
  }
254
256
 
255
257
  /**
@@ -405,14 +407,36 @@ declare interface CreateByteBufferOptions {
405
407
  /** @public */
406
408
  export declare const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
407
409
 
410
+ /**
411
+ * @public
412
+ */
413
+ 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>;
414
+
408
415
  /**
409
416
  * Make each field readonly deeply
410
417
  * @public
411
418
  */
412
- export declare type DeepReadonly<T> = {
413
- readonly [P in keyof T]: DeepReadonly<T[P]>;
419
+ declare type DeepReadonly_2<T> = {
420
+ readonly [P in keyof T]: DeepReadonly_2<T[P]>;
421
+ };
422
+
423
+ /**
424
+ * @public
425
+ */
426
+ export declare type DeepReadonlyMap<K, V> = ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>;
427
+
428
+ /**
429
+ * @public
430
+ */
431
+ export declare type DeepReadonlyObject<T> = {
432
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
414
433
  };
415
434
 
435
+ /**
436
+ * @public
437
+ */
438
+ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
439
+
416
440
  declare function defineSdkComponents(engine: PreEngine): {
417
441
  Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
418
442
  MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
@@ -438,6 +462,7 @@ declare function defineSdkComponents(engine: PreEngine): {
438
462
  SphereShape: ComponentDefinition<ISchema<PBSphereShape>, PBSphereShape>;
439
463
  TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
440
464
  UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
465
+ VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
441
466
  };
442
467
 
443
468
  /**
@@ -459,10 +484,6 @@ declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['de
459
484
  */
460
485
  export declare function Engine({ transports }?: IEngineParams): IEngine;
461
486
 
462
- /**
463
- * @alpha * This file initialization is an alpha one. This is based on the old-ecs
464
- * init and it'll be changing.
465
- */
466
487
  export declare const engine: IEngine;
467
488
 
468
489
  /**
@@ -567,7 +588,7 @@ export declare type IEngine = {
567
588
  *
568
589
  * ```
569
590
  */
570
- defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: Spec, componentId: number, constructorDefault?: Partial<Result<T>>): ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
591
+ defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: Partial<Result<T>>): ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
571
592
  /**
572
593
  * Define a component and add it to the engine.
573
594
  * @param spec An object with schema fields
@@ -598,11 +619,11 @@ export declare type IEngine = {
598
619
  * Example:
599
620
  * ```ts
600
621
  * for (const [entity, boxShape, transform] of engine.getEntitiesWith(BoxShape, Transform)) {
601
- * // the properties of boxShape and transform are read only
622
+ * // the properties of boxShape and transform are read only
602
623
  * }
603
624
  * ```
604
625
  */
605
- getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentSchema<T>>]>;
626
+ getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
606
627
  baseComponents: SdkComponents;
607
628
  };
608
629
 
@@ -636,7 +657,7 @@ declare function IOptional<T>(spec: ISchema<T>): ISchema<T | undefined>;
636
657
  /**
637
658
  * @public
638
659
  */
639
- declare type ISchema<T = any> = {
660
+ export declare type ISchema<T = any> = {
640
661
  serialize(value: T, builder: ByteBuffer): void;
641
662
  deserialize(reader: ByteBuffer): T;
642
663
  create(): T;
@@ -698,7 +719,7 @@ declare namespace Matrix {
698
719
  _isIdentity3x2Dirty: boolean;
699
720
  _m: Matrix4x4;
700
721
  };
701
- type ReadonlyMatrix = DeepReadonly<MutableMatrix>;
722
+ type ReadonlyMatrix = DeepReadonly_2<MutableMatrix>;
702
723
  /**
703
724
  * Gets the internal data of the matrix
704
725
  */
@@ -1717,6 +1738,11 @@ declare interface PBUiText {
1717
1738
  textColor: Color3 | undefined;
1718
1739
  }
1719
1740
 
1741
+ declare interface PBVisibilityComponent {
1742
+ /** default=true */
1743
+ visible?: boolean | undefined;
1744
+ }
1745
+
1720
1746
  /**
1721
1747
  * Represens a plane by the equation ax + by + cz + d = 0
1722
1748
  * @public
@@ -1732,7 +1758,7 @@ declare namespace Plane {
1732
1758
  */
1733
1759
  d: number;
1734
1760
  };
1735
- type ReadonlyPlane = DeepReadonly<MutablePlane>;
1761
+ type ReadonlyPlane = DeepReadonly_2<MutablePlane>;
1736
1762
  /**
1737
1763
  * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
1738
1764
  * @param a - a component of the plane
@@ -1852,7 +1878,7 @@ declare function preEngine(): {
1852
1878
  removeSystem: (selector: string | Update) => boolean;
1853
1879
  defineComponent: <T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType | undefined) => ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
1854
1880
  defineComponentFromSchema: <T_1 extends ISchema<any>, ConstructorType_1 = EcsResult<T_1>>(spec: T_1, componentId: number, constructorDefault?: ConstructorType_1 | undefined) => ComponentDefinition<T_1, ConstructorType_1>;
1855
- getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...DeepReadonly<ComponentSchema<T_2>>]>;
1881
+ getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...ReadonlyComponentSchema<T_2>]>;
1856
1882
  getComponent: <T_3 extends ISchema<any>>(componentId: number) => ComponentDefinition<T_3, EcsResult<T_3>>;
1857
1883
  removeComponentDefinition: (componentId: number) => void;
1858
1884
  };
@@ -1873,7 +1899,7 @@ export declare namespace Quaternion {
1873
1899
  /**
1874
1900
  * @public
1875
1901
  */
1876
- export type ReadonlyQuaternion = DeepReadonly<MutableQuaternion>;
1902
+ export type ReadonlyQuaternion = DeepReadonly_2<MutableQuaternion>;
1877
1903
  /**
1878
1904
  * Creates a new Quaternion from the given floats
1879
1905
  * @param x - defines the first component (0 by default)
@@ -2027,6 +2053,18 @@ export declare namespace Quaternion {
2027
2053
  */
2028
2054
  export declare const RAD2DEG: number;
2029
2055
 
2056
+ /**
2057
+ * @public
2058
+ */
2059
+ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
2060
+ [K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['get']> : never;
2061
+ };
2062
+
2063
+ /**
2064
+ * @public
2065
+ */
2066
+ export declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
2067
+
2030
2068
  declare type ReceiveMessage = {
2031
2069
  type: WireMessage.Enum;
2032
2070
  entity: Entity;
@@ -2191,7 +2229,7 @@ export declare namespace Vector3 {
2191
2229
  /**
2192
2230
  * @public
2193
2231
  */
2194
- export type ReadonlyVector3 = DeepReadonly<MutableVector3>;
2232
+ export type ReadonlyVector3 = DeepReadonly_2<MutableVector3>;
2195
2233
  /**
2196
2234
  * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
2197
2235
  * @param x - defines the first coordinates (on X axis)
@@ -2385,6 +2423,9 @@ declare interface Vector3_2 {
2385
2423
  z: number;
2386
2424
  }
2387
2425
 
2426
+ /** @public */
2427
+ export declare const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
2428
+
2388
2429
  declare namespace WireMessage {
2389
2430
  enum Enum {
2390
2431
  RESERVED = 0,