@dcl/playground-assets 7.1.2-4415683908.commit-0a210fd → 7.1.2-4419392799.commit-7961b54

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
@@ -1628,7 +1628,7 @@ export declare interface IEngine {
1628
1628
  * const StateComponent = engine.getComponent(StateComponentId)
1629
1629
  * ```
1630
1630
  */
1631
- getComponent<T>(componentId: number): ComponentDefinition<T>;
1631
+ getComponent<T>(componentId: number | string): ComponentDefinition<T>;
1632
1632
  /**
1633
1633
  * Get the component definition from the component id.
1634
1634
  * @param componentId - component number or name used to identify the component descriptor
@@ -1638,7 +1638,7 @@ export declare interface IEngine {
1638
1638
  * const StateComponent = engine.getComponent(StateComponentId)
1639
1639
  * ```
1640
1640
  */
1641
- getComponentOrNull<T>(componentId: number): ComponentDefinition<T> | null;
1641
+ getComponentOrNull<T>(componentId: number | string): ComponentDefinition<T> | null;
1642
1642
  /**
1643
1643
  * @public
1644
1644
  * Get a iterator of entities that has all the component requested.
package/dist/beta.d.ts CHANGED
@@ -1628,7 +1628,7 @@ export declare interface IEngine {
1628
1628
  * const StateComponent = engine.getComponent(StateComponentId)
1629
1629
  * ```
1630
1630
  */
1631
- getComponent<T>(componentId: number): ComponentDefinition<T>;
1631
+ getComponent<T>(componentId: number | string): ComponentDefinition<T>;
1632
1632
  /**
1633
1633
  * Get the component definition from the component id.
1634
1634
  * @param componentId - component number or name used to identify the component descriptor
@@ -1638,7 +1638,7 @@ export declare interface IEngine {
1638
1638
  * const StateComponent = engine.getComponent(StateComponentId)
1639
1639
  * ```
1640
1640
  */
1641
- getComponentOrNull<T>(componentId: number): ComponentDefinition<T> | null;
1641
+ getComponentOrNull<T>(componentId: number | string): ComponentDefinition<T> | null;
1642
1642
  /**
1643
1643
  * @public
1644
1644
  * Get a iterator of entities that has all the component requested.
@@ -1628,7 +1628,7 @@ export declare interface IEngine {
1628
1628
  * const StateComponent = engine.getComponent(StateComponentId)
1629
1629
  * ```
1630
1630
  */
1631
- getComponent<T>(componentId: number): ComponentDefinition<T>;
1631
+ getComponent<T>(componentId: number | string): ComponentDefinition<T>;
1632
1632
  /**
1633
1633
  * Get the component definition from the component id.
1634
1634
  * @param componentId - component number or name used to identify the component descriptor
@@ -1638,7 +1638,7 @@ export declare interface IEngine {
1638
1638
  * const StateComponent = engine.getComponent(StateComponentId)
1639
1639
  * ```
1640
1640
  */
1641
- getComponentOrNull<T>(componentId: number): ComponentDefinition<T> | null;
1641
+ getComponentOrNull<T>(componentId: number | string): ComponentDefinition<T> | null;
1642
1642
  /**
1643
1643
  * @public
1644
1644
  * Get a iterator of entities that has all the component requested.
package/dist/index.js CHANGED
@@ -15756,14 +15756,16 @@
15756
15756
  componentsDefinition.set(componentId, newComponent);
15757
15757
  return newComponent;
15758
15758
  }
15759
- function getComponent(componentId) {
15759
+ function getComponent(value) {
15760
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15760
15761
  const component = componentsDefinition.get(componentId);
15761
15762
  if (!component) {
15762
15763
  throw new Error(`Component ${componentId} not found. You need to declare the components at the beginnig of the engine declaration`);
15763
15764
  }
15764
15765
  return component;
15765
15766
  }
15766
- function getComponentOrNull(componentId) {
15767
+ function getComponentOrNull(value) {
15768
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15767
15769
  return (componentsDefinition.get(componentId) ??
15768
15770
  /* istanbul ignore next */
15769
15771
  null);