@dcl/playground-assets 7.1.2-4409365701.commit-a58c7a5 → 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
@@ -15005,18 +15005,25 @@
15005
15005
  if (a !== null && b === null)
15006
15006
  return 1;
15007
15007
  if (a instanceof Uint8Array && b instanceof Uint8Array) {
15008
+ const lengthDifference = a.byteLength - b.byteLength;
15009
+ if (lengthDifference !== 0) {
15010
+ return lengthDifference > 0 ? 1 : -1;
15011
+ }
15008
15012
  let res;
15009
- const n = a.byteLength > b.byteLength ? b.byteLength : a.byteLength;
15010
- for (let i = 0; i < n; i++) {
15013
+ for (let i = 0, n = a.byteLength; i < n; i++) {
15011
15014
  res = a[i] - b[i];
15012
15015
  if (res !== 0) {
15013
15016
  return res > 0 ? 1 : -1;
15014
15017
  }
15015
15018
  }
15016
- res = a.byteLength - b.byteLength;
15017
- return res > 0 ? 1 : res < 0 ? -1 : 0;
15019
+ // the data is exactly the same
15020
+ return 0;
15018
15021
  }
15019
15022
  if (typeof a === 'string') {
15023
+ const lengthDifference = a.length - b.length;
15024
+ if (lengthDifference !== 0) {
15025
+ return lengthDifference > 0 ? 1 : -1;
15026
+ }
15020
15027
  return a.localeCompare(b);
15021
15028
  }
15022
15029
  return a > b ? 1 : -1;
@@ -15749,14 +15756,16 @@
15749
15756
  componentsDefinition.set(componentId, newComponent);
15750
15757
  return newComponent;
15751
15758
  }
15752
- function getComponent(componentId) {
15759
+ function getComponent(value) {
15760
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15753
15761
  const component = componentsDefinition.get(componentId);
15754
15762
  if (!component) {
15755
15763
  throw new Error(`Component ${componentId} not found. You need to declare the components at the beginnig of the engine declaration`);
15756
15764
  }
15757
15765
  return component;
15758
15766
  }
15759
- function getComponentOrNull(componentId) {
15767
+ function getComponentOrNull(value) {
15768
+ const componentId = typeof value === 'string' ? componentNumberFromName(value) : value;
15760
15769
  return (componentsDefinition.get(componentId) ??
15761
15770
  /* istanbul ignore next */
15762
15771
  null);