@dcl/playground-assets 7.0.6-3874914632.commit-eb56237 → 7.0.6-3942933325.commit-70f967f

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 CHANGED
@@ -990,7 +990,8 @@ export declare type CommonProps = {
990
990
  * @public
991
991
  */
992
992
  export declare type ComponentDefinition<T> = {
993
- _id: number;
993
+ readonly componentId: number;
994
+ readonly componentName: string;
994
995
  /**
995
996
  * Return the default value of the current component
996
997
  */
@@ -1107,6 +1108,8 @@ export declare enum CrdtMessageType {
1107
1108
  MAX_MESSAGE_TYPE = 4
1108
1109
  }
1109
1110
 
1111
+ export declare function createComponentDefinitionFromSchema<T>(componentName: string, componentId: number, schema: ISchema<T>): ComponentDefinition<T>;
1112
+
1110
1113
  export declare function createEthereumProvider(): {
1111
1114
  send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
1112
1115
  sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
@@ -1192,8 +1195,6 @@ export declare type DeepReadonlyObject<T> = {
1192
1195
  */
1193
1196
  export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1194
1197
 
1195
- export declare function defineComponent<T>(componentId: number, spec: ISchema<T>): ComponentDefinition<T>;
1196
-
1197
1198
  /**
1198
1199
  * Constant used to convert from Euler degrees to radians
1199
1200
  * @public
@@ -1445,42 +1446,40 @@ export declare type IEngine = {
1445
1446
  removeSystem(selector: string | SystemFn): boolean;
1446
1447
  /**
1447
1448
  * Registers a custom component definition.
1448
- * @param component - The component definition
1449
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1449
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1450
+ * @param componentDefinition - The component definition
1450
1451
  */
1451
- registerCustomComponent<T>(component: ComponentDefinition<T>, componentId: number): ComponentDefinition<T>;
1452
+ registerComponentDefinition<T>(componentName: string, componentDefinition: ComponentDefinition<T>): ComponentDefinition<T>;
1452
1453
  /**
1453
1454
  * Define a component and add it to the engine.
1454
1455
  * @param spec - An object with schema fields
1455
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1456
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1456
1457
  * @param constructorDefault - the initial value prefilled when a component is created without a value
1457
1458
  * @returns The component definition
1458
1459
  *
1459
1460
  * ```ts
1460
- * const DoorComponentId = 10017
1461
- * const Door = engine.defineComponent({
1461
+ * const Door = engine.defineComponent("my-scene::Door", {
1462
1462
  * id: Schemas.Int,
1463
1463
  * name: Schemas.String
1464
- * }, DoorComponentId)
1465
- *
1464
+ * })
1466
1465
  * ```
1467
1466
  */
1468
- defineComponent<T extends Spec>(spec: T, componentId: number, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1467
+ defineComponent<T extends Spec>(componentName: string, spec: T, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1469
1468
  /**
1470
1469
  * Define a component and add it to the engine.
1470
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1471
1471
  * @param spec - An object with schema fields
1472
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1473
1472
  * @returns The component definition
1474
1473
  *
1475
1474
  * ```ts
1476
1475
  * const StateComponentId = 10023
1477
- * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
1476
+ * const StateComponent = engine.defineComponentFromSchema("my-lib::VisibleComponent", Schemas.Bool)
1478
1477
  * ```
1479
1478
  */
1480
- defineComponentFromSchema<T>(spec: ISchema<T>, componentId: number): ComponentDefinition<T>;
1479
+ defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>): ComponentDefinition<T>;
1481
1480
  /**
1482
1481
  * Get the component definition from the component id.
1483
- * @param componentId - component number used to identify the component descriptor
1482
+ * @param componentId - component number or name used to identify the component descriptor
1484
1483
  * @returns the component definition, throw an error if it doesn't exist
1485
1484
  * ```ts
1486
1485
  * const StateComponentId = 10023
@@ -1490,7 +1489,7 @@ export declare type IEngine = {
1490
1489
  getComponent<T>(componentId: number): ComponentDefinition<T>;
1491
1490
  /**
1492
1491
  * Get the component definition from the component id.
1493
- * @param componentId - component number used to identify the component descriptor
1492
+ * @param componentId - component number or name used to identify the component descriptor
1494
1493
  * @returns the component definition or null if its not founded
1495
1494
  * ```ts
1496
1495
  * const StateComponentId = 10023
@@ -1542,6 +1541,11 @@ export declare type IEngine = {
1542
1541
  * Iterator of registered components
1543
1542
  */
1544
1543
  componentsIter(): Iterable<ComponentDefinition<unknown>>;
1544
+ /**
1545
+ * Seals the engine components. It is used to clearly define the scope of the
1546
+ * components that will be available to this engine and to run optimizations.
1547
+ */
1548
+ seal(): void;
1545
1549
  };
1546
1550
 
1547
1551
  /**
@@ -2837,6 +2841,8 @@ export declare const onRealmChangedObservable: Observable<{
2837
2841
 
2838
2842
  export declare const onSceneReadyObservable: Observable<unknown>;
2839
2843
 
2844
+ export declare function onStart(): Promise<void>;
2845
+
2840
2846
  export declare function onUpdate(deltaTime: number): Promise<void>;
2841
2847
 
2842
2848
  export declare const onVideoEvent: Observable<{
package/dist/beta.d.ts CHANGED
@@ -990,7 +990,8 @@ export declare type CommonProps = {
990
990
  * @public
991
991
  */
992
992
  export declare type ComponentDefinition<T> = {
993
- _id: number;
993
+ readonly componentId: number;
994
+ readonly componentName: string;
994
995
  /**
995
996
  * Return the default value of the current component
996
997
  */
@@ -1107,6 +1108,8 @@ export declare enum CrdtMessageType {
1107
1108
  MAX_MESSAGE_TYPE = 4
1108
1109
  }
1109
1110
 
1111
+ export declare function createComponentDefinitionFromSchema<T>(componentName: string, componentId: number, schema: ISchema<T>): ComponentDefinition<T>;
1112
+
1110
1113
  export declare function createEthereumProvider(): {
1111
1114
  send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
1112
1115
  sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
@@ -1192,8 +1195,6 @@ export declare type DeepReadonlyObject<T> = {
1192
1195
  */
1193
1196
  export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1194
1197
 
1195
- export declare function defineComponent<T>(componentId: number, spec: ISchema<T>): ComponentDefinition<T>;
1196
-
1197
1198
  /**
1198
1199
  * Constant used to convert from Euler degrees to radians
1199
1200
  * @public
@@ -1445,42 +1446,40 @@ export declare type IEngine = {
1445
1446
  removeSystem(selector: string | SystemFn): boolean;
1446
1447
  /**
1447
1448
  * Registers a custom component definition.
1448
- * @param component - The component definition
1449
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1449
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1450
+ * @param componentDefinition - The component definition
1450
1451
  */
1451
- registerCustomComponent<T>(component: ComponentDefinition<T>, componentId: number): ComponentDefinition<T>;
1452
+ registerComponentDefinition<T>(componentName: string, componentDefinition: ComponentDefinition<T>): ComponentDefinition<T>;
1452
1453
  /**
1453
1454
  * Define a component and add it to the engine.
1454
1455
  * @param spec - An object with schema fields
1455
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1456
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1456
1457
  * @param constructorDefault - the initial value prefilled when a component is created without a value
1457
1458
  * @returns The component definition
1458
1459
  *
1459
1460
  * ```ts
1460
- * const DoorComponentId = 10017
1461
- * const Door = engine.defineComponent({
1461
+ * const Door = engine.defineComponent("my-scene::Door", {
1462
1462
  * id: Schemas.Int,
1463
1463
  * name: Schemas.String
1464
- * }, DoorComponentId)
1465
- *
1464
+ * })
1466
1465
  * ```
1467
1466
  */
1468
- defineComponent<T extends Spec>(spec: T, componentId: number, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1467
+ defineComponent<T extends Spec>(componentName: string, spec: T, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1469
1468
  /**
1470
1469
  * Define a component and add it to the engine.
1470
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1471
1471
  * @param spec - An object with schema fields
1472
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1473
1472
  * @returns The component definition
1474
1473
  *
1475
1474
  * ```ts
1476
1475
  * const StateComponentId = 10023
1477
- * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
1476
+ * const StateComponent = engine.defineComponentFromSchema("my-lib::VisibleComponent", Schemas.Bool)
1478
1477
  * ```
1479
1478
  */
1480
- defineComponentFromSchema<T>(spec: ISchema<T>, componentId: number): ComponentDefinition<T>;
1479
+ defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>): ComponentDefinition<T>;
1481
1480
  /**
1482
1481
  * Get the component definition from the component id.
1483
- * @param componentId - component number used to identify the component descriptor
1482
+ * @param componentId - component number or name used to identify the component descriptor
1484
1483
  * @returns the component definition, throw an error if it doesn't exist
1485
1484
  * ```ts
1486
1485
  * const StateComponentId = 10023
@@ -1490,7 +1489,7 @@ export declare type IEngine = {
1490
1489
  getComponent<T>(componentId: number): ComponentDefinition<T>;
1491
1490
  /**
1492
1491
  * Get the component definition from the component id.
1493
- * @param componentId - component number used to identify the component descriptor
1492
+ * @param componentId - component number or name used to identify the component descriptor
1494
1493
  * @returns the component definition or null if its not founded
1495
1494
  * ```ts
1496
1495
  * const StateComponentId = 10023
@@ -1542,6 +1541,11 @@ export declare type IEngine = {
1542
1541
  * Iterator of registered components
1543
1542
  */
1544
1543
  componentsIter(): Iterable<ComponentDefinition<unknown>>;
1544
+ /**
1545
+ * Seals the engine components. It is used to clearly define the scope of the
1546
+ * components that will be available to this engine and to run optimizations.
1547
+ */
1548
+ seal(): void;
1545
1549
  };
1546
1550
 
1547
1551
  /**
@@ -2837,6 +2841,8 @@ export declare const onRealmChangedObservable: Observable<{
2837
2841
 
2838
2842
  export declare const onSceneReadyObservable: Observable<unknown>;
2839
2843
 
2844
+ export declare function onStart(): Promise<void>;
2845
+
2840
2846
  export declare function onUpdate(deltaTime: number): Promise<void>;
2841
2847
 
2842
2848
  export declare const onVideoEvent: Observable<{
@@ -990,7 +990,8 @@ export declare type CommonProps = {
990
990
  * @public
991
991
  */
992
992
  export declare type ComponentDefinition<T> = {
993
- _id: number;
993
+ readonly componentId: number;
994
+ readonly componentName: string;
994
995
  /**
995
996
  * Return the default value of the current component
996
997
  */
@@ -1107,6 +1108,8 @@ export declare enum CrdtMessageType {
1107
1108
  MAX_MESSAGE_TYPE = 4
1108
1109
  }
1109
1110
 
1111
+ export declare function createComponentDefinitionFromSchema<T>(componentName: string, componentId: number, schema: ISchema<T>): ComponentDefinition<T>;
1112
+
1110
1113
  export declare function createEthereumProvider(): {
1111
1114
  send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
1112
1115
  sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
@@ -1192,8 +1195,6 @@ export declare type DeepReadonlyObject<T> = {
1192
1195
  */
1193
1196
  export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1194
1197
 
1195
- export declare function defineComponent<T>(componentId: number, spec: ISchema<T>): ComponentDefinition<T>;
1196
-
1197
1198
  /**
1198
1199
  * Constant used to convert from Euler degrees to radians
1199
1200
  * @public
@@ -1445,42 +1446,40 @@ export declare type IEngine = {
1445
1446
  removeSystem(selector: string | SystemFn): boolean;
1446
1447
  /**
1447
1448
  * Registers a custom component definition.
1448
- * @param component - The component definition
1449
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1449
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1450
+ * @param componentDefinition - The component definition
1450
1451
  */
1451
- registerCustomComponent<T>(component: ComponentDefinition<T>, componentId: number): ComponentDefinition<T>;
1452
+ registerComponentDefinition<T>(componentName: string, componentDefinition: ComponentDefinition<T>): ComponentDefinition<T>;
1452
1453
  /**
1453
1454
  * Define a component and add it to the engine.
1454
1455
  * @param spec - An object with schema fields
1455
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1456
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1456
1457
  * @param constructorDefault - the initial value prefilled when a component is created without a value
1457
1458
  * @returns The component definition
1458
1459
  *
1459
1460
  * ```ts
1460
- * const DoorComponentId = 10017
1461
- * const Door = engine.defineComponent({
1461
+ * const Door = engine.defineComponent("my-scene::Door", {
1462
1462
  * id: Schemas.Int,
1463
1463
  * name: Schemas.String
1464
- * }, DoorComponentId)
1465
- *
1464
+ * })
1466
1465
  * ```
1467
1466
  */
1468
- defineComponent<T extends Spec>(spec: T, componentId: number, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1467
+ defineComponent<T extends Spec>(componentName: string, spec: T, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1469
1468
  /**
1470
1469
  * Define a component and add it to the engine.
1470
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1471
1471
  * @param spec - An object with schema fields
1472
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1473
1472
  * @returns The component definition
1474
1473
  *
1475
1474
  * ```ts
1476
1475
  * const StateComponentId = 10023
1477
- * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
1476
+ * const StateComponent = engine.defineComponentFromSchema("my-lib::VisibleComponent", Schemas.Bool)
1478
1477
  * ```
1479
1478
  */
1480
- defineComponentFromSchema<T>(spec: ISchema<T>, componentId: number): ComponentDefinition<T>;
1479
+ defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>): ComponentDefinition<T>;
1481
1480
  /**
1482
1481
  * Get the component definition from the component id.
1483
- * @param componentId - component number used to identify the component descriptor
1482
+ * @param componentId - component number or name used to identify the component descriptor
1484
1483
  * @returns the component definition, throw an error if it doesn't exist
1485
1484
  * ```ts
1486
1485
  * const StateComponentId = 10023
@@ -1490,7 +1489,7 @@ export declare type IEngine = {
1490
1489
  getComponent<T>(componentId: number): ComponentDefinition<T>;
1491
1490
  /**
1492
1491
  * Get the component definition from the component id.
1493
- * @param componentId - component number used to identify the component descriptor
1492
+ * @param componentId - component number or name used to identify the component descriptor
1494
1493
  * @returns the component definition or null if its not founded
1495
1494
  * ```ts
1496
1495
  * const StateComponentId = 10023
@@ -1542,6 +1541,11 @@ export declare type IEngine = {
1542
1541
  * Iterator of registered components
1543
1542
  */
1544
1543
  componentsIter(): Iterable<ComponentDefinition<unknown>>;
1544
+ /**
1545
+ * Seals the engine components. It is used to clearly define the scope of the
1546
+ * components that will be available to this engine and to run optimizations.
1547
+ */
1548
+ seal(): void;
1545
1549
  };
1546
1550
 
1547
1551
  /**
@@ -2837,6 +2841,8 @@ export declare const onRealmChangedObservable: Observable<{
2837
2841
 
2838
2842
  export declare const onSceneReadyObservable: Observable<unknown>;
2839
2843
 
2844
+ export declare function onStart(): Promise<void>;
2845
+
2840
2846
  export declare function onUpdate(deltaTime: number): Promise<void>;
2841
2847
 
2842
2848
  export declare const onVideoEvent: Observable<{