@dcl/sdk 7.0.0-2957285950.commit-2a77ef6 → 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.
@@ -407,14 +407,36 @@ declare interface CreateByteBufferOptions {
407
407
  /** @public */
408
408
  export declare const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
409
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
+
410
415
  /**
411
416
  * Make each field readonly deeply
412
417
  * @public
413
418
  */
414
- export declare type DeepReadonly<T> = {
415
- 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]>;
416
433
  };
417
434
 
435
+ /**
436
+ * @public
437
+ */
438
+ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
439
+
418
440
  declare function defineSdkComponents(engine: PreEngine): {
419
441
  Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
420
442
  MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
@@ -566,7 +588,7 @@ export declare type IEngine = {
566
588
  *
567
589
  * ```
568
590
  */
569
- 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>;
570
592
  /**
571
593
  * Define a component and add it to the engine.
572
594
  * @param spec An object with schema fields
@@ -601,7 +623,7 @@ export declare type IEngine = {
601
623
  * }
602
624
  * ```
603
625
  */
604
- getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentSchema<T>>]>;
626
+ getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
605
627
  baseComponents: SdkComponents;
606
628
  };
607
629
 
@@ -697,7 +719,7 @@ declare namespace Matrix {
697
719
  _isIdentity3x2Dirty: boolean;
698
720
  _m: Matrix4x4;
699
721
  };
700
- type ReadonlyMatrix = DeepReadonly<MutableMatrix>;
722
+ type ReadonlyMatrix = DeepReadonly_2<MutableMatrix>;
701
723
  /**
702
724
  * Gets the internal data of the matrix
703
725
  */
@@ -1736,7 +1758,7 @@ declare namespace Plane {
1736
1758
  */
1737
1759
  d: number;
1738
1760
  };
1739
- type ReadonlyPlane = DeepReadonly<MutablePlane>;
1761
+ type ReadonlyPlane = DeepReadonly_2<MutablePlane>;
1740
1762
  /**
1741
1763
  * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
1742
1764
  * @param a - a component of the plane
@@ -1856,7 +1878,7 @@ declare function preEngine(): {
1856
1878
  removeSystem: (selector: string | Update) => boolean;
1857
1879
  defineComponent: <T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType | undefined) => ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
1858
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>;
1859
- 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>]>;
1860
1882
  getComponent: <T_3 extends ISchema<any>>(componentId: number) => ComponentDefinition<T_3, EcsResult<T_3>>;
1861
1883
  removeComponentDefinition: (componentId: number) => void;
1862
1884
  };
@@ -1877,7 +1899,7 @@ export declare namespace Quaternion {
1877
1899
  /**
1878
1900
  * @public
1879
1901
  */
1880
- export type ReadonlyQuaternion = DeepReadonly<MutableQuaternion>;
1902
+ export type ReadonlyQuaternion = DeepReadonly_2<MutableQuaternion>;
1881
1903
  /**
1882
1904
  * Creates a new Quaternion from the given floats
1883
1905
  * @param x - defines the first component (0 by default)
@@ -2031,6 +2053,18 @@ export declare namespace Quaternion {
2031
2053
  */
2032
2054
  export declare const RAD2DEG: number;
2033
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
+
2034
2068
  declare type ReceiveMessage = {
2035
2069
  type: WireMessage.Enum;
2036
2070
  entity: Entity;
@@ -2195,7 +2229,7 @@ export declare namespace Vector3 {
2195
2229
  /**
2196
2230
  * @public
2197
2231
  */
2198
- export type ReadonlyVector3 = DeepReadonly<MutableVector3>;
2232
+ export type ReadonlyVector3 = DeepReadonly_2<MutableVector3>;
2199
2233
  /**
2200
2234
  * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
2201
2235
  * @param x - defines the first coordinates (on X axis)