@vworlds/vecs 1.0.61-beta-idle-before.73 → 1.0.61

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
@@ -61,6 +61,9 @@ world.progress(performance.now(), 16); // call once per frame
61
61
 
62
62
  ## Documentation
63
63
 
64
+ Use the optional [`@vworlds/vecs/testing`](./docs/testing.md) equality tester for cheap reference
65
+ comparisons in Vitest; entities and worlds also provide safe diagnostic JSON summaries.
66
+
64
67
  For synchronous world teardown and its allowed call sites, see
65
68
  [Disposing a world](./docs/entities.md#disposing-a-world).
66
69
 
@@ -93,6 +96,9 @@ The full documentation lives in [`docs/`](./docs/README.md). Recommended reading
93
96
  [Subtree snapshots](./docs/snapshots.md)
94
97
  5. [Design guide](./docs/design-guide.md) — patterns and anti-patterns from real designs.
95
98
 
99
+ Use [ECS design diagrams](./docs/diagrams.md) for Mermaid schema, instance, and systems views in
100
+ docs, issues, and PR discussions.
101
+
96
102
  Plus the [Utilities](./docs/utilities.md) guide for helper classes and the
97
103
  [Glossary](./docs/glossary.md) for terminology. The exhaustive per-symbol reference is the JSDoc on
98
104
  the source under [`src/`](./src/) — read it in your IDE.
@@ -45,4 +45,19 @@ export declare class Entity extends IdentityEntity {
45
45
  get destroyed(): boolean;
46
46
  /** True if this entity is alive (not destroyed). */
47
47
  get alive(): boolean;
48
+ /**
49
+ * Return a diagnostic summary for JSON and assertion/snapshot formatting.
50
+ * Live entities include registered component class names and `{ $entity: eid }`
51
+ * for other attachment keys, never component data. Does not initialize key
52
+ * metadata. Destroyed entities include `destroyed: true` instead of a component list.
53
+ * This is not a persistence format or a never-reused identity.
54
+ */
55
+ toJSON(): {
56
+ entity: EID;
57
+ name: string | undefined;
58
+ components?: (string | {
59
+ $entity: EID;
60
+ })[];
61
+ destroyed?: true;
62
+ };
48
63
  }
@@ -56,5 +56,24 @@ export class Entity extends IdentityEntity {
56
56
  get alive() {
57
57
  return !this._destroyed;
58
58
  }
59
+ /**
60
+ * Return a diagnostic summary for JSON and assertion/snapshot formatting.
61
+ * Live entities include registered component class names and `{ $entity: eid }`
62
+ * for other attachment keys, never component data. Does not initialize key
63
+ * metadata. Destroyed entities include `destroyed: true` instead of a component list.
64
+ * This is not a persistence format or a never-reused identity.
65
+ */
66
+ toJSON() {
67
+ if (this.destroyed) {
68
+ return { entity: this.eid, name: this.name, destroyed: true };
69
+ }
70
+ const components = [];
71
+ this.components.forEach((_value, eid) => {
72
+ const key = this.world.getEntity(eid);
73
+ const Class = key?._meta?.Class;
74
+ components.push(Class && this.world._classRegistry.get(Class) === key ? Class.name : { $entity: eid });
75
+ });
76
+ return { entity: this.eid, name: this.name, components };
77
+ }
59
78
  }
60
79
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/entity/entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAWtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,MAAO,SAAQ,cAAc;IACxC,kFAAkF;IAC3E,OAAO,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,wFAAwF;IACxF,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,4EAA4E;IAC5E,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,IAAW,SAAS;QAClB,OAA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AC;QACrD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACtC,MAAM,KAAK,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC;YAChC,UAAU,CAAC,IAAI,CACb,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CACtF,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC;IAC3D,CAAC;CACF"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vworlds/vecs",
3
- "version": "1.0.61-beta-idle-before.73",
3
+ "version": "1.0.61",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -8,6 +8,10 @@
8
8
  ".": {
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.js"
11
+ },
12
+ "./testing": {
13
+ "types": "./dist/testing.d.ts",
14
+ "import": "./dist/testing.js"
11
15
  }
12
16
  },
13
17
  "scripts": {
package/dist/system.js CHANGED
@@ -210,8 +210,10 @@ export class System extends Query {
210
210
  * @internal Execute one tick: drain the inbox in arrival order, then run
211
211
  * the `run` callback, then the `each` callback for every tracked entity.
212
212
  *
213
- * The whole body executes inside a `World.defer` scope; mutations made by
214
- * callbacks land in the world queue and are processed when `_run` returns.
213
+ * When callbacks have work, the body executes inside a `World.defer` scope;
214
+ * mutations land in the world queue and are processed when `_run` returns.
215
+ * An empty inbox with no `run` callback and no populated `each` query bypasses
216
+ * that scope, after updating the injection clock and without changing cadence.
215
217
  * Returns whether the enabled and cadence gates admitted execution, even
216
218
  * when a reactive system has no pending events or an each query is empty.
217
219
  */
@@ -225,6 +227,11 @@ export class System extends Query {
225
227
  const tickDelta = this._tickSource.lastFireDelta;
226
228
  this._injectNow = now;
227
229
  this._injectDelta = tickDelta;
230
+ if (this._inbox.length === 0 &&
231
+ this._runCallback === undefined &&
232
+ (this._eachCallback === undefined || this.count === 0)) {
233
+ return true;
234
+ }
228
235
  const prevSource = this.world._currentSource;
229
236
  this.world._currentSource = this.entity;
230
237
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,8BAA8B,GAQ/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAMrE,OAAO,EACL,gBAAgB,GAIjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAElB,cAAc,GACf,MAAM,YAAY,CAAC;AAsCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,MACX,SAAQ,KAAqB;IA0B7B,YAAY,IAAY,EAAE,KAAY;QACpC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAxB5B,yEAAyE;QAClE,eAAU,GAAG,CAAC,CAAC;QACtB,uEAAuE;QAChE,iBAAY,GAAG,CAAC,CAAC;QACxB,wEAAwE;QACvD,WAAM,GAAwB,EAAE,CAAC;QAClD;;;;;WAKG;QACK,sBAAiB,GAAG,KAAK,CAAC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AC1C,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1F,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACa,IAAI,CAClB,GAAG,KAAa;QAEhB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACrB,OAAO,IAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACa,OAAO,CAAC,GAAG,KAAY;QACrC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,OAAO;QACZ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM;QACX,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qDAAqD;IACrC,OAAO;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED,iEAAiE;IAC9C,eAAe;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Compare entities and worlds by reference, preventing deep traversal of ECS data.
3
+ * Register once with Vitest's `expect.addEqualityTesters([vecsEqualityTester])`.
4
+ * Returns `a === b` if either value is an Entity or World (including subclasses),
5
+ * otherwise `undefined` to preserve the framework's normal equality behavior.
6
+ * This module has no runtime dependency on Vitest.
7
+ */
8
+ export declare function vecsEqualityTester(a: unknown, b: unknown): boolean | undefined;
@@ -0,0 +1,16 @@
1
+ import { Entity } from "./entity/index.js";
2
+ import { World } from "./world/index.js";
3
+ /**
4
+ * Compare entities and worlds by reference, preventing deep traversal of ECS data.
5
+ * Register once with Vitest's `expect.addEqualityTesters([vecsEqualityTester])`.
6
+ * Returns `a === b` if either value is an Entity or World (including subclasses),
7
+ * otherwise `undefined` to preserve the framework's normal equality behavior.
8
+ * This module has no runtime dependency on Vitest.
9
+ */
10
+ export function vecsEqualityTester(a, b) {
11
+ if (a instanceof Entity || b instanceof Entity || a instanceof World || b instanceof World) {
12
+ return a === b;
13
+ }
14
+ return undefined;
15
+ }
16
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAU,EAAE,CAAU;IACvD,IAAI,CAAC,YAAY,MAAM,IAAI,CAAC,YAAY,MAAM,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;QAC3F,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -4,4 +4,13 @@ import { Pools } from "./world.pools.js";
4
4
  export declare class Storage extends Pools {
5
5
  /** Read-only view of the live entities, keyed by entity id. */
6
6
  get entities(): ReadonlyIterableArrayMap<Entity>;
7
+ /**
8
+ * Return the runtime class name and live entity count (including infrastructure)
9
+ * for JSON and assertion/snapshot formatting, without traversing entity data.
10
+ * This diagnostic summary is not a persistence format.
11
+ */
12
+ toJSON(): {
13
+ world: string;
14
+ entities: number;
15
+ };
7
16
  }
@@ -19,6 +19,14 @@ export class Storage extends Pools {
19
19
  get entities() {
20
20
  return this._entities;
21
21
  }
22
+ /**
23
+ * Return the runtime class name and live entity count (including infrastructure)
24
+ * for JSON and assertion/snapshot formatting, without traversing entity data.
25
+ * This diagnostic summary is not a persistence format.
26
+ */
27
+ toJSON() {
28
+ return { world: this.constructor.name, entities: this.entities.size };
29
+ }
22
30
  /** @internal Remove an entity from the world's entity map (called by `Entity._destroy`). */
23
31
  _unregisterEntity(entity) {
24
32
  this._entities.delete(entity.eid);
@@ -1 +1 @@
1
- {"version":3,"file":"world.storage.js","sourceRoot":"","sources":["../../src/world/world.storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAiC,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAAlC;;QACE;;;;;;;WAOG;QACO,cAAS,GAAG,IAAI,gBAAgB,EAAU,CAAC;QAErD,yFAAyF;QAC/E,sBAAiB,GAAG,IAAI,QAAQ,EAAU,CAAC;IAavD,CAAC;IAXC,+DAA+D;IAC/D,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,4FAA4F;IACrF,iBAAiB,CAAC,MAAc;QACrC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF"}
1
+ {"version":3,"file":"world.storage.js","sourceRoot":"","sources":["../../src/world/world.storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAiC,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAAlC;;QACE;;;;;;;WAOG;QACO,cAAS,GAAG,IAAI,gBAAgB,EAAU,CAAC;QAErD,yFAAyF;QAC/E,sBAAiB,GAAG,IAAI,QAAQ,EAAU,CAAC;IAsBvD,CAAC;IApBC,+DAA+D;IAC/D,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,MAAM;QACX,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IAED,4FAA4F;IACrF,iBAAiB,CAAC,MAAc;QACrC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF"}
package/docs/README.md CHANGED
@@ -35,8 +35,12 @@ Read in this order the first time through:
35
35
  6. [Utilities](./utilities.md) — helper classes exported by `@vworlds/vecs` but not part of the ECS
36
36
  lifecycle model.
37
37
 
38
+ Use [ECS design diagrams](./diagrams.md) when illustrating a design in docs, issues, or PR discussions.
39
+
38
40
  Keep the [Glossary](./glossary.md) at hand for terminology.
39
41
 
42
+ For reference comparisons, safe diagnostics and Vitest setup, see [Testing entity and world identity](./testing.md).
43
+
40
44
  ## Map
41
45
 
42
46
  For Node clients that need replicated Phaser poses, see [Headless clients](../../vecs-phaser-client/README.md#headless-clients).
@@ -57,8 +61,10 @@ after reading the execution-model and systems guides.
57
61
  | [modules.md](./modules.md) | `Module<Config>`, `world.module`, `world.scope`, hierarchy provenance, built-in modules. |
58
62
  | [snapshots.md](./snapshots.md) | `snapshotSubtree`, `restoreSubtree`, `moveSubtree`, and `OnSnapshot` capture policies. |
59
63
  | [design-guide.md](./design-guide.md) | Patterns, anti-patterns, and a Phaser render-layer case study. |
64
+ | [diagrams.md](./diagrams.md) | Mermaid notation and copyable schema, instance, and systems templates for ECS designs. |
60
65
  | [utilities.md](./utilities.md) | Public helper classes: `Events`, `ArrayMap`, `IterableArrayMap`, plus `Bitset` cross-ref. |
61
66
  | [glossary.md](./glossary.md) | ECS and vecs terminology. |
67
+ | [testing.md](./testing.md) | Reference equality registration and safe JSON/assertion summaries. |
62
68
 
63
69
  Networking (wire encoding with `@wireType`, protocol component ordering, replication, RPCs, server
64
70
  sessions, and the client world) lives in the `@vworlds/vecs-wire`, `@vworlds/vecs-protocol`,
@@ -0,0 +1,156 @@
1
+ # ECS design diagrams
2
+
3
+ Draw entities, components, relationships, hierarchies, and systems consistently in docs, issues,
4
+ and PR discussions with these Mermaid flowcharts.
5
+
6
+ ## Choose a diagram kind
7
+
8
+ | Kind | Question it answers | Mermaid direction |
9
+ | --------- | ------------------------------------------------------------------------- | ----------------- |
10
+ | Schema | Which kinds of entity carry what, and how do they relate? | `flowchart BT` |
11
+ | Instances | What exists in a concrete scene or hierarchy, at frame N or before/after? | `flowchart BT` |
12
+ | Systems | What runs when, reading and writing what? | `flowchart TB` |
13
+
14
+ Use flowcharts for all three kinds, not `erDiagram`: ER attribute rows require both a type and
15
+ a name, whereas component lists need only one column. Keep diagrams small and give each one a
16
+ caption stating its scope. These are design views, not declarations of new vecs API types.
17
+
18
+ ## Shared notation
19
+
20
+ Put the component-kind emoji immediately before its name in a single column. Use one line per
21
+ component, separated with `<br/>` inside a quoted label.
22
+
23
+ | Emoji | Kind | Example |
24
+ | ----- | ------------------- | ---------------- |
25
+ | 📦 | Component with data | `📦 Position` |
26
+ | 🏷️ | Tag with no data | `🏷️ Networked` |
27
+ | 🎭 | Trait | `🎭 Traversable` |
28
+
29
+ Draw a relationship as a labelled edge from the **carrier (source) to its target**. Always
30
+ write the arrow in that direction: `child --> parent`, never `parent <-- child`. Put the
31
+ target-count emoji first in the label, with no intervening space:
32
+
33
+ | Prefix | Targets allowed per carrier | Example label |
34
+ | ------ | ----------------------------------------------------------- | ------------------------ |
35
+ | 1️⃣ | At most one target (`Exclusive`); omit the word `Exclusive` | `1️⃣ChildOf`, `1️⃣TowedBy` |
36
+ | ♾️ | Many targets | `♾️FriendOf` |
37
+
38
+ The prefix describes the relationship's constraint, not the number of targets drawn. For many
39
+ targets, draw one edge per target, even though vecs stores the targets together in one relationship
40
+ component's array. See [Relationships](./relationships.md) for the runtime semantics.
41
+
42
+ Quote edge labels containing emoji. Only `ChildOf` uses a dotted relationship edge
43
+ (`child -. "1️⃣ChildOf" .-> parent`); every other relationship uses a solid edge
44
+ (`ship -- "1️⃣TowedBy" --> tug`). Do not use dotted edges for other parent-like relationships.
45
+
46
+ ## Schema template
47
+
48
+ Use a box for each entity kind: a **bold** name, then one line per component. Relationships live
49
+ on edges rather than being repeated in the component list.
50
+
51
+ Use `flowchart BT` so parents sit above children. Let `ChildOf` determine the vertical hierarchy;
52
+ fit other relationships around it, including parent-like relationships such as `TowedBy`. Fall
53
+ back to `flowchart LR` only when `BT` becomes cluttered; keep carrier-to-target arrows unchanged.
54
+
55
+ This schema describes possible ship and tug entities inside a sector. `TowedBy` is an example
56
+ custom relationship configured as `Exclusive`, not a built-in.
57
+
58
+ ```mermaid
59
+ flowchart BT
60
+ sector["<b>Sector</b><br/>📦 Bounds"]
61
+ ship["<b>Ship</b><br/>📦 Position<br/>📦 Velocity<br/>🏷️ Networked"]
62
+ tug["<b>Tug</b><br/>📦 Winch"]
63
+ ship -. "1️⃣ChildOf" .-> sector
64
+ tug -. "1️⃣ChildOf" .-> sector
65
+ ship -- "1️⃣TowedBy" --> tug
66
+ ```
67
+
68
+ ## Instances template
69
+
70
+ Use a stadium `([…])` for a concrete entity: its name or `#eid`, then one line per component.
71
+ Keep the schema's `BT` layout rule and relationship notation. State the frame or before/after
72
+ moment in the caption so a snapshot is not mistaken for a schema.
73
+
74
+ When a component's data matters, move it out of the stadium into a small box attached by a
75
+ plain line (`---`). Put its fields in `<small>…</small>` text; do not also list that component
76
+ inside the stadium. Style destroyed or removed entities with `:::gone`: grey fill and a dashed
77
+ border. In a before/after comparison, explain whether retained edges show historical state.
78
+
79
+ At frame N, ship #1100 and tug #1101 belong to sector-3. The ship has two `FriendOf` targets;
80
+ the grey entity is a removed ship shown for comparison, with no live edges.
81
+
82
+ ```mermaid
83
+ flowchart BT
84
+ sector(["sector-3<br/>📦 Bounds"]):::entity
85
+ ship(["ship #1100<br/>📦 Velocity<br/>🏷️ Networked"]):::entity
86
+ friend(["ship #1102"]):::entity
87
+ tug(["tug #1101<br/>📦 Winch"]):::entity
88
+ removed(["ship #1099 (removed)"]):::gone
89
+ position["📦 Position<br/><small>x: 12 · y: 4</small>"]:::comp
90
+ ship -. "1️⃣ChildOf" .-> sector
91
+ tug -. "1️⃣ChildOf" .-> sector
92
+ ship -- "1️⃣TowedBy" --> tug
93
+ ship -- "♾️FriendOf" --> friend
94
+ ship -- "♾️FriendOf" --> tug
95
+ ship --- position
96
+ classDef entity fill:#eef,stroke:#447
97
+ classDef comp fill:#fff,stroke:#999
98
+ classDef gone fill:#eee,stroke:#888,color:#666,stroke-dasharray:5 5
99
+ ```
100
+
101
+ ## Systems template
102
+
103
+ Use `flowchart TB` to follow execution down the page:
104
+
105
+ - Put each phase in a `subgraph` named after that phase, in pipeline order.
106
+ - Draw each system as a hexagon `{{…}}`: name, then kind and query in small text. Use
107
+ `.each(…)`, `.run()`, or `.enter(…)` / `.update(…)` / `.exit(…)` as appropriate. Include cadence
108
+ or disabled state in the label when relevant. These labels summarize callbacks and query
109
+ membership; see [Systems](./systems.md) for API signatures.
110
+ When the callback's arguments show the query, show it only once; add a separate `query:`
111
+ line only when the callback and query differ.
112
+ - Draw components as parallelograms `[/…/]`, with **one node per component** across the entire
113
+ diagram, even when several systems use it. Place each component node in the phase of its first
114
+ writer in the diagram, or, if nothing in the diagram writes it, in the phase of its first reader.
115
+ - Draw a read as a thin arrow (`-->`) entering the system's top, and a write as a thick arrow
116
+ (`==>`) leaving its bottom, where the layout allows.
117
+ - If a read only sees the previous frame's write, draw a dotted arrow labelled `next frame`
118
+ looping back upward. This is a temporal data dependency, not a relationship edge. Do not
119
+ hide the delay by duplicating the component node.
120
+
121
+ Here `move` reads last frame's `Velocity` and writes `Position` in `ON_UPDATE`. Later, `tow`
122
+ reads `Position` and `Winch` and writes `Velocity` in `POST_UPDATE`; `move` sees that write
123
+ next frame. The names describe an illustrative design, not built-in systems.
124
+ Component nodes sit inside phase boxes here to stabilize the layout; that placement does not
125
+ declare component ownership or lifetime.
126
+
127
+ ```mermaid
128
+ flowchart TB
129
+ subgraph ON_UPDATE
130
+ move{{"move<br/><small>.each(Position, Velocity)</small>"}}
131
+ Position[/"📦 Position"/]
132
+ end
133
+ subgraph POST_UPDATE
134
+ tow{{"tow<br/><small>.update(TowedBy)<br/>query: TowedBy + Position + Winch</small>"}}
135
+ Winch[/"📦 Winch"/]
136
+ Velocity[/"📦 Velocity"/]
137
+ end
138
+ move ==> Position
139
+ Position --> tow
140
+ tow ==> Velocity
141
+ Velocity -. next frame .-> move
142
+ Winch --> tow
143
+ ```
144
+
145
+ ## Check before sharing
146
+
147
+ Run `npm exec --no -- vmethod check-markdown <file>` on every Markdown file containing your
148
+ diagrams. This checks fences and parses Mermaid with the pinned GitHub-compatible version;
149
+ it does not inspect the rendered layout.
150
+
151
+ Also render every diagram, for example in GitHub's preview, and check that labels remain readable,
152
+ parents sit above children, phases follow pipeline order, and reads enter from above and writes
153
+ leave below where the layout allows. Layout is automatic: rearrange declarations or simplify a
154
+ crowded diagram rather than reversing a relationship arrow or duplicating a component.
155
+
156
+ For a worked schema and hierarchy, see [Relationships — diagram examples](./relationships.md#diagram-examples).
package/docs/entities.md CHANGED
@@ -9,6 +9,26 @@ An `Entity` (`lib/vecs/src/entity/entity.ts`) is a unique numeric id (`eid`) own
9
9
  with an arbitrary set of component instances attached. Never instantiate `Entity` directly —
10
10
  create entities through the world.
11
11
 
12
+ ## Identity and diagnostic summaries
13
+
14
+ Compare entities and worlds by object reference (`===`, or `expect(a).toBe(b)` in Vitest), never
15
+ by `eid`. An eid is unique only among live entities in one world: freed ids are reused after
16
+ their pool's `reuseWaitFrames`. Each creation gets a new entity object even when its eid is reused.
17
+ Register the [testing equality helper](./testing.md) to prevent Vitest's equality checks and hints
18
+ from recursively comparing entire worlds.
19
+
20
+ `entity.toJSON()` returns `{ entity: eid, name, components: [componentClassName, ...] }` without
21
+ component data. Registered component definitions (including relationships) print their class names;
22
+ other attachment keys print as `{ $entity: eid }`, without initializing metadata on those entities.
23
+ An unnamed entity's `name` is `undefined`. After destruction it returns
24
+ `{ entity: eid, name: undefined, destroyed: true }`, with no component list.
25
+ `world.toJSON()` returns `{ world: world.constructor.name, entities: world.entities.size }`;
26
+ the count includes infrastructure entities. `ServerWorld` also includes its configured `name`.
27
+
28
+ `JSON.stringify(entity)` now returns this summary instead of throwing on the circular world
29
+ reference; JSON omits an undefined `name`. Vitest's pretty-formatted assertion values and snapshots
30
+ also use these summaries. They are diagnostic output, not a serialization of ECS state.
31
+
12
32
  ## Creating and looking up entities
13
33
 
14
34
  ```ts
@@ -297,3 +317,4 @@ is reset in `finally`. Successful disposal leaves nothing, including component-c
297
317
  | `on(event, handler, insert?)` | Register a handler for a hook event on this component's meta. `insert` defaults to `false` (append); `true` prepends. Returns `this`. |
298
318
  | `off(event, handler)` | Remove a previously-registered handler by reference. Idempotent. Returns `this`. |
299
319
  | `toString()` | Returns `"EntityN"`. |
320
+ | `toJSON()` | Returns the [diagnostic summary](#identity-and-diagnostic-summaries), without component data. |
@@ -73,6 +73,51 @@ contact events), and hooks that run while an entity or an edge target is being d
73
73
 
74
74
  `ChildOf` and `DependsOn` are also `Traversable`; all three built-ins above are `Exclusive`.
75
75
 
76
+ ## Diagram examples
77
+
78
+ Use the [ECS diagram notation](./diagrams.md) to distinguish a schema from a concrete scene.
79
+ This schema shows carrier-to-target edges for the three built-ins and two custom examples:
80
+ `InCell` is configured as `Exclusive` (see [Exclusive one-target relationships](#exclusive-one-target-relationships));
81
+ `VisibleTo` allows many targets. Each box names an entity kind, not a particular entity.
82
+ The pipeline branch shows a system attached to a phase and phases chained to other phases,
83
+ not a `ChildOf` hierarchy. The self-edge connects instances of the phase kind, not a phase to itself.
84
+
85
+ ```mermaid
86
+ flowchart BT
87
+ squad["<b>Squad</b>"]
88
+ unit["<b>Unit</b><br/>📦 Position"]
89
+ cell["<b>Cell</b><br/>📦 Bounds"]
90
+ viewer["<b>Viewer</b>"]
91
+ query["<b>Listening query entity</b>"]
92
+ silence["<b>Source query entity</b>"]
93
+ system["<b>System entity</b>"]
94
+ phase["<b>Phase entity</b>"]
95
+ unit -. "1️⃣ChildOf" .-> squad
96
+ unit -- "1️⃣InCell" --> cell
97
+ unit -- "♾️VisibleTo" --> viewer
98
+ query -- "1️⃣SilenceSource" --> silence
99
+ system -- "1️⃣DependsOn" --> phase
100
+ phase -- "1️⃣DependsOn" --> phase
101
+ ```
102
+
103
+ At frame N, a squad and two units form a small `ChildOf` hierarchy under sector-3. Unit #1100
104
+ has two `VisibleTo` targets: the two edges belong to one many-target relationship component.
105
+
106
+ ```mermaid
107
+ flowchart BT
108
+ sector(["sector-3"])
109
+ squad(["squad #1090"])
110
+ unitA(["unit #1100<br/>📦 Position"])
111
+ unitB(["unit #1101<br/>📦 Position"])
112
+ viewerA(["viewer #1200"])
113
+ viewerB(["viewer #1201"])
114
+ squad -. "1️⃣ChildOf" .-> sector
115
+ unitA -. "1️⃣ChildOf" .-> squad
116
+ unitB -. "1️⃣ChildOf" .-> squad
117
+ unitA -- "♾️VisibleTo" --> viewerA
118
+ unitA -- "♾️VisibleTo" --> viewerB
119
+ ```
120
+
76
121
  ## Adding, removing, and setting
77
122
 
78
123
  Create edges explicitly with `add(Relationship, target)`:
package/docs/systems.md CHANGED
@@ -28,6 +28,13 @@ Newly created systems enter the pipeline the next time `world.progress` runs. Co
28
28
  happen before the system is built (the first `progress`/`flush` after creation); builder calls
29
29
  after that throw. Reading `world.pipeline` between frames also builds pending queries.
30
30
 
31
+ Idle systems avoid entering a deferred callback scope when their inbox is empty,
32
+ they have no `run` callback, and any `each` query has no members. Cadence and injection
33
+ clocks still advance normally, and due systems still count in stats. Events routed
34
+ by an earlier system and new query members are processed in the same frame when
35
+ the system is due. A `run` callback always executes when enabled and due, even
36
+ without members or component changes.
37
+
31
38
  ## Measuring systems
32
39
 
33
40
  Enable opt-in synchronous timing for benchmarks, cadence guards, or live diagnostics:
@@ -0,0 +1,28 @@
1
+ # Testing entity and world identity
2
+
3
+ Compare ECS objects without traversing their worlds, and print safe diagnostic summaries.
4
+
5
+ ## Register reference equality
6
+
7
+ Register the optional tester once in your Vitest setup file:
8
+
9
+ ```ts
10
+ import { expect } from "vitest";
11
+ import { vecsEqualityTester } from "@vworlds/vecs/testing";
12
+
13
+ expect.addEqualityTesters([vecsEqualityTester]);
14
+ ```
15
+
16
+ The tester compares by reference whenever either operand is an `Entity` or `World`, including
17
+ subclasses. It prevents `toEqual` and `toBe`'s deep-equality hint from walking the world, even
18
+ inside ordinary objects and arrays. Unrelated values keep Vitest's normal equality behavior.
19
+ The helper itself does not depend on Vitest at runtime.
20
+
21
+ Use `===` or `toBe` for identity, not `eid`: see [entity identity](./entities.md#identity-and-diagnostic-summaries).
22
+
23
+ ## Read diagnostic output
24
+
25
+ `Entity.toJSON()` and `World.toJSON()` give JSON, assertion output and snapshots small summaries
26
+ instead of traversing component data and engine handles. See the [summary shapes](./entities.md#identity-and-diagnostic-summaries).
27
+ These summaries are diagnostics, not persistence snapshots; use [subtree snapshots](./snapshots.md)
28
+ to capture ECS state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vworlds/vecs",
3
- "version": "1.0.61-beta-idle-before.73",
3
+ "version": "1.0.61",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -8,6 +8,10 @@
8
8
  ".": {
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.js"
11
+ },
12
+ "./testing": {
13
+ "types": "./dist/testing.d.ts",
14
+ "import": "./dist/testing.js"
11
15
  }
12
16
  },
13
17
  "scripts": {
@@ -2,6 +2,8 @@
2
2
  "extends": "./tsconfig.json",
3
3
  "include": [
4
4
  "src",
5
+ "tests/testing.test.ts",
6
+ "tests/diagnostic-json.test.ts",
5
7
  "tests/clock-inject.test.ts",
6
8
  "tests/world-scope.test.ts",
7
9
  "tests/system-introspection.test.ts"