@forgeax/engine-ecs 0.1.35 → 0.1.36

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/README.md CHANGED
@@ -378,6 +378,13 @@ diagnostics. It is not a live registry and is not a storage escape hatch.
378
378
  Consumers should use entity counts, active component names, schedule summaries,
379
379
  and resource keys; gameplay code should use queries.
380
380
 
381
+ `world.componentsOf(entity)` returns a detached array of the live entity's
382
+ component tokens, including sparse tags, or the normal stale-entity error.
383
+ Unlike `world.components.entries()`, it reflects actual archetype membership
384
+ without requiring a plugin catalog lease. Inspection plugins combine it with
385
+ public component reflection and `world.get`; it adds no inspection state or
386
+ per-frame work to the World.
387
+
381
388
  ## Public surface and subpaths
382
389
 
383
390
  The root barrel is intentionally small. Advanced capabilities are named by
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entity-components.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-components.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/entity-components.unit.test.ts"],"names":[],"mappings":""}
package/dist/index.mjs CHANGED
@@ -5374,6 +5374,12 @@ var World = class {
5374
5374
  inspect() {
5375
5375
  return detachWorldInspection(worldInspect(this));
5376
5376
  }
5377
+ /** Read the actual component vocabulary of one live entity, including sparse tags. */
5378
+ componentsOf(entity) {
5379
+ const record = this.lookupAlive(entity, "componentsOf");
5380
+ if (!record.ok) return record;
5381
+ return ok([...this.graph.archetypes[record.value.archetypeId]?.components ?? []]);
5382
+ }
5377
5383
  /** Return the registered schedule graphs and their declared access metadata. */
5378
5384
  scheduleData() {
5379
5385
  return worldScheduleData(this);