@codehz/ecs 0.3.6 → 0.3.7

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/archetype.d.ts CHANGED
@@ -140,10 +140,7 @@ export declare class Archetype {
140
140
  * implemented as a generator returning each entity/components pair lazily
141
141
  * @param componentTypes Array of component types to retrieve
142
142
  */
143
- iterateWithComponents<const T extends readonly ComponentType<any>[]>(componentTypes: T): IterableIterator<{
144
- entity: EntityId;
145
- components: ComponentTuple<T>;
146
- }>;
143
+ iterateWithComponents<const T extends readonly ComponentType<any>[]>(componentTypes: T): IterableIterator<[EntityId, ...ComponentTuple<T>]>;
147
144
  /**
148
145
  * Iterate over entities with their component data for specified component types
149
146
  * Optimized for bulk component access
package/index.js CHANGED
@@ -479,7 +479,7 @@ class Archetype {
479
479
  for (let entityIndex = 0;entityIndex < this.entities.length; entityIndex++) {
480
480
  const entity = this.entities[entityIndex];
481
481
  const components = this.buildComponentsForIndex(componentTypes, componentDataSources, entityIndex);
482
- yield { entity, components };
482
+ yield [entity, ...components];
483
483
  }
484
484
  }
485
485
  forEachWithComponents(componentTypes, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ecs",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/query.d.ts CHANGED
@@ -36,10 +36,7 @@ export declare class Query {
36
36
  * Iterate over entities with their component data (generator)
37
37
  * @param componentTypes Array of component types to retrieve
38
38
  */
39
- iterate<const T extends readonly ComponentType<any>[]>(componentTypes: T): IterableIterator<{
40
- entity: EntityId;
41
- components: ComponentTuple<T>;
42
- }>;
39
+ iterate<const T extends readonly ComponentType<any>[]>(componentTypes: T): IterableIterator<[EntityId, ...ComponentTuple<T>]>;
43
40
  /**
44
41
  * Get component data arrays for all matching entities
45
42
  * @param componentType The component type to retrieve