aiecsjs 0.1.1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/LICENSE +21 -0
  3. package/README.md +881 -0
  4. package/README_ZHTW.md +891 -0
  5. package/STABILITY.md +145 -0
  6. package/STABILITY_ZHTW.md +145 -0
  7. package/api.json +1087 -0
  8. package/dist/commands.cjs +2 -0
  9. package/dist/commands.cjs.map +1 -0
  10. package/dist/commands.d.cts +7 -0
  11. package/dist/commands.d.ts +7 -0
  12. package/dist/commands.js +2 -0
  13. package/dist/commands.js.map +1 -0
  14. package/dist/index.cjs +2 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/index.d.cts +43 -0
  17. package/dist/index.d.ts +43 -0
  18. package/dist/index.js +2 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/loop.cjs +2 -0
  21. package/dist/loop.cjs.map +1 -0
  22. package/dist/loop.d.cts +13 -0
  23. package/dist/loop.d.ts +13 -0
  24. package/dist/loop.js +2 -0
  25. package/dist/loop.js.map +1 -0
  26. package/dist/observers.cjs +2 -0
  27. package/dist/observers.cjs.map +1 -0
  28. package/dist/observers.d.cts +8 -0
  29. package/dist/observers.d.ts +8 -0
  30. package/dist/observers.js +2 -0
  31. package/dist/observers.js.map +1 -0
  32. package/dist/relations.cjs +2 -0
  33. package/dist/relations.cjs.map +1 -0
  34. package/dist/relations.d.cts +11 -0
  35. package/dist/relations.d.ts +11 -0
  36. package/dist/relations.js +2 -0
  37. package/dist/relations.js.map +1 -0
  38. package/dist/serialize.cjs +2 -0
  39. package/dist/serialize.cjs.map +1 -0
  40. package/dist/serialize.d.cts +9 -0
  41. package/dist/serialize.d.ts +9 -0
  42. package/dist/serialize.js +2 -0
  43. package/dist/serialize.js.map +1 -0
  44. package/dist/types-Bbv2u6kb.d.cts +227 -0
  45. package/dist/types-Bbv2u6kb.d.ts +227 -0
  46. package/dist/worker.cjs +2 -0
  47. package/dist/worker.cjs.map +1 -0
  48. package/dist/worker.d.cts +10 -0
  49. package/dist/worker.d.ts +10 -0
  50. package/dist/worker.js +2 -0
  51. package/dist/worker.js.map +1 -0
  52. package/docs/MIGRATION.md +252 -0
  53. package/docs/MIGRATION_ZHTW.md +252 -0
  54. package/llms-full.txt +579 -0
  55. package/llms.txt +31 -0
  56. package/package.json +93 -0
package/api.json ADDED
@@ -0,0 +1,1087 @@
1
+ {
2
+ "$schema": "https://yshengliao.github.io/aiecsjs/api-schema.json",
3
+ "name": "aiecsjs",
4
+ "version": "0.1.0",
5
+ "generated": "2026-05-27",
6
+ "stability": "experimental",
7
+ "license": "MIT",
8
+ "repository": "https://github.com/yshengliao/aiecsjs",
9
+ "runtime": ["browser", "node>=18"],
10
+ "modules": [
11
+ {
12
+ "name": "aiecsjs",
13
+ "description": "Core entry point — world, entity, component, query, system, utilities.",
14
+ "exports": [
15
+ "createWorld", "destroyWorld", "resetWorld", "getWorldSize", "getWorldCapacity",
16
+ "createEntity", "destroyEntity", "entityExists", "getEntityIndex", "getEntityGeneration", "packEntity",
17
+ "defineComponent", "defineTag", "defineObjectComponent",
18
+ "addComponent", "removeComponent", "hasComponent", "getComponent", "setComponent",
19
+ "Types",
20
+ "defineQuery", "runQuery", "forEachEntity", "iterQuery", "enterQuery", "exitQuery", "queryArchetypes",
21
+ "pipe",
22
+ "VERSION", "IS_SAB_SUPPORTED", "isWorld", "isEntity"
23
+ ]
24
+ },
25
+ {
26
+ "name": "aiecsjs/loop",
27
+ "description": "Fixed-timestep accumulator loop helper.",
28
+ "exports": ["createLoop"]
29
+ },
30
+ {
31
+ "name": "aiecsjs/commands",
32
+ "description": "Command buffer for deferred structural mutation during iteration.",
33
+ "exports": ["createCommandBuffer", "flush", "withCommandBuffer"]
34
+ },
35
+ {
36
+ "name": "aiecsjs/observers",
37
+ "description": "Reactive observers for component add/remove/set events.",
38
+ "exports": ["observe", "onAdd", "onRemove", "onSet"]
39
+ },
40
+ {
41
+ "name": "aiecsjs/serialize",
42
+ "description": "Binary, JSON, and delta serialization.",
43
+ "exports": ["serializeWorld", "deserializeWorld", "toJSON", "fromJSON", "createDeltaSerializer"]
44
+ },
45
+ {
46
+ "name": "aiecsjs/worker",
47
+ "description": "SharedArrayBuffer multi-threading helpers (experimental).",
48
+ "exports": ["transferableSnapshot", "adoptSnapshot", "attachWorld", "detachWorld"]
49
+ },
50
+ {
51
+ "name": "aiecsjs/relations",
52
+ "description": "Entity relations and hierarchies (experimental, target 0.2).",
53
+ "exports": ["defineRelation", "addRelation", "removeRelation", "getRelationTargets", "ChildOf"]
54
+ }
55
+ ],
56
+ "exports": [
57
+ {
58
+ "name": "createWorld",
59
+ "kind": "function",
60
+ "module": "aiecsjs",
61
+ "since": "0.1.0",
62
+ "stability": "stable",
63
+ "deprecated": false,
64
+ "signature": "function createWorld(options?: WorldOptions): World",
65
+ "summary": "Create a new ECS world.",
66
+ "params": [
67
+ {
68
+ "name": "options",
69
+ "type": "WorldOptions",
70
+ "optional": true,
71
+ "description": "Configuration; all fields have defaults. See WorldOptions type."
72
+ }
73
+ ],
74
+ "returns": { "type": "World", "description": "Opaque world handle passed to all other API calls." },
75
+ "examples": [
76
+ { "title": "Minimal world", "code": "const world = createWorld()" },
77
+ { "title": "Pre-allocated capacity", "code": "const world = createWorld({ initialCapacity: 16384 })" },
78
+ { "title": "SAB-backed world", "code": "const world = createWorld({ buffer: new SharedArrayBuffer(64*1024*1024) })" }
79
+ ],
80
+ "seeAlso": ["destroyWorld", "resetWorld", "WorldOptions"]
81
+ },
82
+ {
83
+ "name": "destroyWorld",
84
+ "kind": "function",
85
+ "module": "aiecsjs",
86
+ "since": "0.1.0",
87
+ "stability": "stable",
88
+ "deprecated": false,
89
+ "signature": "function destroyWorld(world: World): void",
90
+ "summary": "Release all internal buffers; the world reference becomes invalid.",
91
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "World to destroy." }],
92
+ "returns": { "type": "void", "description": "" },
93
+ "examples": [{ "title": "Cleanup", "code": "destroyWorld(world)" }],
94
+ "seeAlso": ["createWorld", "resetWorld"]
95
+ },
96
+ {
97
+ "name": "resetWorld",
98
+ "kind": "function",
99
+ "module": "aiecsjs",
100
+ "since": "0.1.0",
101
+ "stability": "stable",
102
+ "deprecated": false,
103
+ "signature": "function resetWorld(world: World): void",
104
+ "summary": "Wipe entities and components but keep the world allocated. Useful for hot module reload.",
105
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "World to reset." }],
106
+ "returns": { "type": "void", "description": "" },
107
+ "examples": [{ "title": "Reset for HMR", "code": "if (import.meta.hot) import.meta.hot.dispose(() => resetWorld(world))" }],
108
+ "seeAlso": ["createWorld", "destroyWorld"]
109
+ },
110
+ {
111
+ "name": "getWorldSize",
112
+ "kind": "function",
113
+ "module": "aiecsjs",
114
+ "since": "0.1.0",
115
+ "stability": "stable",
116
+ "deprecated": false,
117
+ "signature": "function getWorldSize(world: World): number",
118
+ "summary": "Number of alive entities in the world.",
119
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Target world." }],
120
+ "returns": { "type": "number", "description": "Alive entity count." },
121
+ "examples": [{ "title": "Status print", "code": "console.log('alive:', getWorldSize(world))" }],
122
+ "seeAlso": ["getWorldCapacity"]
123
+ },
124
+ {
125
+ "name": "getWorldCapacity",
126
+ "kind": "function",
127
+ "module": "aiecsjs",
128
+ "since": "0.1.0",
129
+ "stability": "stable",
130
+ "deprecated": false,
131
+ "signature": "function getWorldCapacity(world: World): number",
132
+ "summary": "Current upper bound on entity slot count. May grow if maxEntities allows.",
133
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Target world." }],
134
+ "returns": { "type": "number", "description": "Capacity." },
135
+ "examples": [],
136
+ "seeAlso": ["getWorldSize", "WorldOptions"]
137
+ },
138
+ {
139
+ "name": "createEntity",
140
+ "kind": "function",
141
+ "module": "aiecsjs",
142
+ "since": "0.1.0",
143
+ "stability": "stable",
144
+ "deprecated": false,
145
+ "signature": "function createEntity(world: World): EntityId",
146
+ "summary": "Allocate a fresh entity. Returns a versioned 32-bit ID.",
147
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Target world." }],
148
+ "returns": { "type": "EntityId", "description": "Branded number containing index + generation." },
149
+ "throws": [{ "type": "Error", "when": "world has reached maxEntities cap." }],
150
+ "examples": [{ "title": "Spawn one entity", "code": "const e = createEntity(world)" }],
151
+ "seeAlso": ["destroyEntity", "entityExists", "packEntity"]
152
+ },
153
+ {
154
+ "name": "destroyEntity",
155
+ "kind": "function",
156
+ "module": "aiecsjs",
157
+ "since": "0.1.0",
158
+ "stability": "stable",
159
+ "deprecated": false,
160
+ "signature": "function destroyEntity(world: World, eid: EntityId): void",
161
+ "summary": "Remove all components, bump generation, free slot.",
162
+ "params": [
163
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
164
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to destroy." }
165
+ ],
166
+ "returns": { "type": "void", "description": "" },
167
+ "examples": [{ "title": "Cleanup dead entity", "code": "if (entityExists(world, e)) destroyEntity(world, e)" }],
168
+ "seeAlso": ["createEntity", "entityExists"]
169
+ },
170
+ {
171
+ "name": "entityExists",
172
+ "kind": "function",
173
+ "module": "aiecsjs",
174
+ "since": "0.1.0",
175
+ "stability": "stable",
176
+ "deprecated": false,
177
+ "signature": "function entityExists(world: World, eid: EntityId): boolean",
178
+ "summary": "True iff the entity's index is allocated AND its generation matches.",
179
+ "params": [
180
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
181
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to check." }
182
+ ],
183
+ "returns": { "type": "boolean", "description": "Liveness." },
184
+ "examples": [],
185
+ "seeAlso": ["destroyEntity"]
186
+ },
187
+ {
188
+ "name": "getEntityIndex",
189
+ "kind": "function",
190
+ "module": "aiecsjs",
191
+ "since": "0.1.0",
192
+ "stability": "stable",
193
+ "deprecated": false,
194
+ "signature": "function getEntityIndex(eid: EntityId): number",
195
+ "summary": "Extract the index portion of a packed entity ID.",
196
+ "params": [{ "name": "eid", "type": "EntityId", "optional": false, "description": "Packed entity ID." }],
197
+ "returns": { "type": "number", "description": "Index in [0, 2^indexBits)." },
198
+ "examples": [],
199
+ "seeAlso": ["getEntityGeneration", "packEntity"]
200
+ },
201
+ {
202
+ "name": "getEntityGeneration",
203
+ "kind": "function",
204
+ "module": "aiecsjs",
205
+ "since": "0.1.0",
206
+ "stability": "stable",
207
+ "deprecated": false,
208
+ "signature": "function getEntityGeneration(eid: EntityId): number",
209
+ "summary": "Extract the generation portion of a packed entity ID.",
210
+ "params": [{ "name": "eid", "type": "EntityId", "optional": false, "description": "Packed entity ID." }],
211
+ "returns": { "type": "number", "description": "Generation in [0, 2^generationBits)." },
212
+ "examples": [],
213
+ "seeAlso": ["getEntityIndex", "packEntity"]
214
+ },
215
+ {
216
+ "name": "packEntity",
217
+ "kind": "function",
218
+ "module": "aiecsjs",
219
+ "since": "0.1.0",
220
+ "stability": "stable",
221
+ "deprecated": false,
222
+ "signature": "function packEntity(index: number, generation: number): EntityId",
223
+ "summary": "Compose an entity ID from its parts. Rarely needed.",
224
+ "params": [
225
+ { "name": "index", "type": "number", "optional": false, "description": "Entity index." },
226
+ { "name": "generation", "type": "number", "optional": false, "description": "Entity generation." }
227
+ ],
228
+ "returns": { "type": "EntityId", "description": "Branded composed ID." },
229
+ "examples": [],
230
+ "seeAlso": ["getEntityIndex", "getEntityGeneration"]
231
+ },
232
+ {
233
+ "name": "defineComponent",
234
+ "kind": "function",
235
+ "module": "aiecsjs",
236
+ "since": "0.1.0",
237
+ "stability": "stable",
238
+ "deprecated": false,
239
+ "signature": "function defineComponent<S extends SoASchema>(schema: S): SoAComponent<S>",
240
+ "summary": "Declare a Structure-of-Arrays component. Each field becomes a TypedArray column indexed by entity ID.",
241
+ "params": [
242
+ {
243
+ "name": "schema",
244
+ "type": "SoASchema",
245
+ "optional": false,
246
+ "description": "Map of field name → field type. Field type is a member of Types, or [type, vectorLength] for fixed-size vectors."
247
+ }
248
+ ],
249
+ "returns": { "type": "SoAComponent<S>", "description": "Component handle used in addComponent/getComponent/etc." },
250
+ "examples": [
251
+ { "title": "Position with two scalars", "code": "const Position = defineComponent({ x: Types.f32, y: Types.f32 })" },
252
+ { "title": "Transform with vector field", "code": "const Transform = defineComponent({ pos: [Types.f32, 3], scale: Types.f32 })" }
253
+ ],
254
+ "seeAlso": ["defineTag", "defineObjectComponent", "Types", "addComponent"]
255
+ },
256
+ {
257
+ "name": "defineTag",
258
+ "kind": "function",
259
+ "module": "aiecsjs",
260
+ "since": "0.1.0",
261
+ "stability": "stable",
262
+ "deprecated": false,
263
+ "signature": "function defineTag(): TagComponent",
264
+ "summary": "Declare a zero-byte tag component. No fields.",
265
+ "params": [],
266
+ "returns": { "type": "TagComponent", "description": "Tag component handle." },
267
+ "examples": [{ "title": "Player tag", "code": "const Player = defineTag()" }],
268
+ "seeAlso": ["defineComponent"]
269
+ },
270
+ {
271
+ "name": "defineObjectComponent",
272
+ "kind": "function",
273
+ "module": "aiecsjs",
274
+ "since": "0.1.0",
275
+ "stability": "stable",
276
+ "deprecated": false,
277
+ "signature": "function defineObjectComponent<T>(factory?: () => T): AoSComponent<T>",
278
+ "summary": "Declare an Array-of-Structures component. Each entity stores a separate JS object. Main-thread only.",
279
+ "params": [
280
+ {
281
+ "name": "factory",
282
+ "type": "() => T",
283
+ "optional": true,
284
+ "description": "Default value factory invoked ONCE at definition time. Mutate per-entity instances via setComponent/getComponent."
285
+ }
286
+ ],
287
+ "returns": { "type": "AoSComponent<T>", "description": "AoS component handle." },
288
+ "examples": [
289
+ { "title": "Reference to a Three.js mesh", "code": "const MeshRef = defineObjectComponent<{ mesh: any }>(() => ({ mesh: null }))" }
290
+ ],
291
+ "seeAlso": ["defineComponent", "setComponent", "getComponent"]
292
+ },
293
+ {
294
+ "name": "addComponent",
295
+ "kind": "function",
296
+ "module": "aiecsjs",
297
+ "since": "0.1.0",
298
+ "stability": "stable",
299
+ "deprecated": false,
300
+ "signature": "function addComponent<C extends ComponentLike>(world: World, eid: EntityId, component: C, initial?: unknown): void",
301
+ "summary": "Attach a component to an entity. Argument order is (world, eid, component, init) — different from bitECS.",
302
+ "params": [
303
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
304
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to attach to." },
305
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." },
306
+ { "name": "initial", "type": "Partial<...> | undefined", "optional": true, "description": "Initial values; shape depends on component kind." }
307
+ ],
308
+ "returns": { "type": "void", "description": "" },
309
+ "throws": [
310
+ { "type": "TypeError", "when": "component is not a ComponentLike." },
311
+ { "type": "Error", "when": "eid does not exist (dev mode only)." }
312
+ ],
313
+ "examples": [
314
+ { "title": "Add SoA component with init", "code": "addComponent(world, e, Position, { x: 10, y: 20 })" },
315
+ { "title": "Add tag", "code": "addComponent(world, e, Player)" }
316
+ ],
317
+ "seeAlso": ["removeComponent", "hasComponent", "getComponent", "setComponent"]
318
+ },
319
+ {
320
+ "name": "removeComponent",
321
+ "kind": "function",
322
+ "module": "aiecsjs",
323
+ "since": "0.1.0",
324
+ "stability": "stable",
325
+ "deprecated": false,
326
+ "signature": "function removeComponent<C extends ComponentLike>(world: World, eid: EntityId, component: C): void",
327
+ "summary": "Detach a component from an entity. Triggers archetype migration.",
328
+ "params": [
329
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
330
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to detach from." },
331
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." }
332
+ ],
333
+ "returns": { "type": "void", "description": "" },
334
+ "examples": [],
335
+ "seeAlso": ["addComponent", "hasComponent"]
336
+ },
337
+ {
338
+ "name": "hasComponent",
339
+ "kind": "function",
340
+ "module": "aiecsjs",
341
+ "since": "0.1.0",
342
+ "stability": "stable",
343
+ "deprecated": false,
344
+ "signature": "function hasComponent<C extends ComponentLike>(world: World, eid: EntityId, component: C): boolean",
345
+ "summary": "Test whether an entity has a component.",
346
+ "params": [
347
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
348
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to test." },
349
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." }
350
+ ],
351
+ "returns": { "type": "boolean", "description": "Presence flag." },
352
+ "examples": [],
353
+ "seeAlso": ["addComponent", "removeComponent"]
354
+ },
355
+ {
356
+ "name": "getComponent",
357
+ "kind": "function",
358
+ "module": "aiecsjs",
359
+ "since": "0.1.0",
360
+ "stability": "stable",
361
+ "deprecated": false,
362
+ "signature": "function getComponent<C extends ComponentLike>(world: World, eid: EntityId, component: C): ComponentView<C>",
363
+ "summary": "Retrieve a component view. For SoA, returns the archetype's column map; index by eid. For AoS, returns the per-entity object.",
364
+ "params": [
365
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
366
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to read." },
367
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." }
368
+ ],
369
+ "returns": { "type": "ComponentView<C>", "description": "Column map (SoA) or per-entity object (AoS)." },
370
+ "examples": [
371
+ { "title": "Read SoA value", "code": "const pos = getComponent(world, e, Position); console.log(pos.x[e], pos.y[e])" }
372
+ ],
373
+ "seeAlso": ["setComponent", "hasComponent"]
374
+ },
375
+ {
376
+ "name": "setComponent",
377
+ "kind": "function",
378
+ "module": "aiecsjs",
379
+ "since": "0.1.0",
380
+ "stability": "stable",
381
+ "deprecated": false,
382
+ "signature": "function setComponent<C extends ComponentLike, V>(world: World, eid: EntityId, component: C, value: V): void",
383
+ "summary": "Bulk-write component fields. For SoA, value is Partial<{field: value}>. For AoS, replaces the per-entity object's fields.",
384
+ "params": [
385
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
386
+ { "name": "eid", "type": "EntityId", "optional": false, "description": "Entity to write." },
387
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." },
388
+ { "name": "value", "type": "V", "optional": false, "description": "New values." }
389
+ ],
390
+ "returns": { "type": "void", "description": "" },
391
+ "examples": [
392
+ { "title": "Set SoA", "code": "setComponent(world, e, Position, { x: 5, y: 10 })" }
393
+ ],
394
+ "seeAlso": ["getComponent", "addComponent"]
395
+ },
396
+ {
397
+ "name": "defineQuery",
398
+ "kind": "function",
399
+ "module": "aiecsjs",
400
+ "since": "0.1.0",
401
+ "stability": "stable",
402
+ "deprecated": false,
403
+ "signature": "function defineQuery(descriptor: ComponentLike[] | QueryDescriptor): Query",
404
+ "summary": "Create a reusable query selector. The same component set always returns the same Query reference within a module.",
405
+ "params": [
406
+ {
407
+ "name": "descriptor",
408
+ "type": "ComponentLike[] | QueryDescriptor",
409
+ "optional": false,
410
+ "description": "Shorthand component list (treated as { all: [...] }) or a full QueryDescriptor with all/any/none arrays."
411
+ }
412
+ ],
413
+ "returns": { "type": "Query", "description": "Cached query handle." },
414
+ "throws": [{ "type": "TypeError", "when": "any descriptor argument is not a Component." }],
415
+ "examples": [
416
+ { "title": "Shorthand all-of", "code": "const movers = defineQuery([Position, Velocity])" },
417
+ { "title": "Full descriptor with exclusions", "code": "const visibleEnemies = defineQuery({ all: [Position, Sprite, Enemy], none: [Hidden] })" }
418
+ ],
419
+ "seeAlso": ["runQuery", "forEachEntity", "iterQuery", "enterQuery", "exitQuery"]
420
+ },
421
+ {
422
+ "name": "runQuery",
423
+ "kind": "function",
424
+ "module": "aiecsjs",
425
+ "since": "0.1.0",
426
+ "stability": "stable",
427
+ "deprecated": false,
428
+ "signature": "function runQuery(world: World, query: Query): readonly EntityId[]",
429
+ "summary": "Return matching entities as a frozen array. Allocates each call; not for hot loops.",
430
+ "params": [
431
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
432
+ { "name": "query", "type": "Query", "optional": false, "description": "Query handle." }
433
+ ],
434
+ "returns": { "type": "readonly EntityId[]", "description": "Frozen array of entity IDs." },
435
+ "examples": [],
436
+ "seeAlso": ["forEachEntity", "iterQuery"]
437
+ },
438
+ {
439
+ "name": "forEachEntity",
440
+ "kind": "function",
441
+ "module": "aiecsjs",
442
+ "since": "0.1.0",
443
+ "stability": "stable",
444
+ "deprecated": false,
445
+ "signature": "function forEachEntity<Q extends Query>(world: World, query: Q, fn: (eid: EntityId, ...columns: any[]) => void): void",
446
+ "summary": "Hot iteration path. Component column views are passed in declaration order after the entity ID.",
447
+ "params": [
448
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
449
+ { "name": "query", "type": "Query", "optional": false, "description": "Query handle." },
450
+ { "name": "fn", "type": "(eid, ...columns) => void", "optional": false, "description": "Per-entity callback. Receives eid then component column views in declaration order." }
451
+ ],
452
+ "returns": { "type": "void", "description": "" },
453
+ "examples": [
454
+ {
455
+ "title": "Update positions",
456
+ "code": "forEachEntity(world, movers, (e, pos, vel) => { pos.x[e] += vel.x[e]; pos.y[e] += vel.y[e] })"
457
+ }
458
+ ],
459
+ "seeAlso": ["defineQuery", "runQuery", "iterQuery"]
460
+ },
461
+ {
462
+ "name": "iterQuery",
463
+ "kind": "function",
464
+ "module": "aiecsjs",
465
+ "since": "0.1.0",
466
+ "stability": "stable",
467
+ "deprecated": false,
468
+ "signature": "function iterQuery(world: World, query: Query): IterableIterator<EntityId>",
469
+ "summary": "Iterator over matching entity IDs. Allocates an iterator; use forEachEntity in hot loops.",
470
+ "params": [
471
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
472
+ { "name": "query", "type": "Query", "optional": false, "description": "Query handle." }
473
+ ],
474
+ "returns": { "type": "IterableIterator<EntityId>", "description": "Iterator." },
475
+ "examples": [{ "title": "for...of usage", "code": "for (const e of iterQuery(world, q)) { /* ... */ }" }],
476
+ "seeAlso": ["forEachEntity"]
477
+ },
478
+ {
479
+ "name": "enterQuery",
480
+ "kind": "function",
481
+ "module": "aiecsjs",
482
+ "since": "0.1.0",
483
+ "stability": "stable",
484
+ "deprecated": false,
485
+ "signature": "function enterQuery(query: Query): Query",
486
+ "summary": "Reactive query that yields only entities newly matching this frame.",
487
+ "params": [{ "name": "query", "type": "Query", "optional": false, "description": "Source query." }],
488
+ "returns": { "type": "Query", "description": "Reactive query handle." },
489
+ "examples": [{ "title": "Mount-on-enter", "code": "const becameVisible = enterQuery(visibleQ)" }],
490
+ "seeAlso": ["exitQuery", "defineQuery"]
491
+ },
492
+ {
493
+ "name": "exitQuery",
494
+ "kind": "function",
495
+ "module": "aiecsjs",
496
+ "since": "0.1.0",
497
+ "stability": "stable",
498
+ "deprecated": false,
499
+ "signature": "function exitQuery(query: Query): Query",
500
+ "summary": "Reactive query that yields only entities that left the match this frame.",
501
+ "params": [{ "name": "query", "type": "Query", "optional": false, "description": "Source query." }],
502
+ "returns": { "type": "Query", "description": "Reactive query handle." },
503
+ "examples": [],
504
+ "seeAlso": ["enterQuery", "defineQuery"]
505
+ },
506
+ {
507
+ "name": "queryArchetypes",
508
+ "kind": "function",
509
+ "module": "aiecsjs",
510
+ "since": "0.1.0",
511
+ "stability": "experimental",
512
+ "deprecated": false,
513
+ "signature": "function queryArchetypes(world: World, query: Query): readonly Archetype[]",
514
+ "summary": "Power-user access to matching archetype tables. For custom iteration, GPU upload, or profiling.",
515
+ "params": [
516
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
517
+ { "name": "query", "type": "Query", "optional": false, "description": "Query handle." }
518
+ ],
519
+ "returns": { "type": "readonly Archetype[]", "description": "Archetype handles." },
520
+ "examples": [{ "title": "Per-archetype upload", "code": "for (const a of queryArchetypes(world, q)) { /* a.size, a.mask */ }" }],
521
+ "seeAlso": ["defineQuery"]
522
+ },
523
+ {
524
+ "name": "pipe",
525
+ "kind": "function",
526
+ "module": "aiecsjs",
527
+ "since": "0.1.0",
528
+ "stability": "stable",
529
+ "deprecated": false,
530
+ "signature": "function pipe<W extends World, Ctx>(...systems: System<W, Ctx>[]): System<W, Ctx>",
531
+ "summary": "Compose systems left-to-right. Associative; always returns the same World reference.",
532
+ "params": [{ "name": "systems", "type": "System<W, Ctx>[]", "optional": false, "description": "Systems to compose." }],
533
+ "returns": { "type": "System<W, Ctx>", "description": "Composed system." },
534
+ "examples": [
535
+ { "title": "Frame tick", "code": "const tick = pipe(input, physics, render); tick(world, dt)" }
536
+ ],
537
+ "seeAlso": ["createLoop"]
538
+ },
539
+ {
540
+ "name": "createLoop",
541
+ "kind": "function",
542
+ "module": "aiecsjs/loop",
543
+ "since": "0.1.0",
544
+ "stability": "stable",
545
+ "deprecated": false,
546
+ "signature": "function createLoop(options: LoopOptions): { start(): void; stop(): void }",
547
+ "summary": "Fixed-timestep accumulator loop. Calls onUpdate with constant dt; onRender once per animation frame with an interpolation alpha.",
548
+ "params": [{ "name": "options", "type": "LoopOptions", "optional": false, "description": "Loop configuration." }],
549
+ "returns": { "type": "{ start(), stop() }", "description": "Loop control handle." },
550
+ "examples": [
551
+ { "title": "60Hz loop", "code": "const loop = createLoop({ fixed: 1/60, onUpdate: dt => tick(world, dt) }); loop.start()" }
552
+ ],
553
+ "seeAlso": ["pipe"]
554
+ },
555
+ {
556
+ "name": "createCommandBuffer",
557
+ "kind": "function",
558
+ "module": "aiecsjs/commands",
559
+ "since": "0.1.0",
560
+ "stability": "stable",
561
+ "deprecated": false,
562
+ "signature": "function createCommandBuffer(world: World): CommandBuffer",
563
+ "summary": "Create a buffer that queues structural mutations until flushed.",
564
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Target world." }],
565
+ "returns": { "type": "CommandBuffer", "description": "Buffer with add/remove/destroy/create methods." },
566
+ "examples": [],
567
+ "seeAlso": ["flush", "withCommandBuffer"]
568
+ },
569
+ {
570
+ "name": "flush",
571
+ "kind": "function",
572
+ "module": "aiecsjs/commands",
573
+ "since": "0.1.0",
574
+ "stability": "stable",
575
+ "deprecated": false,
576
+ "signature": "function flush(cb: CommandBuffer): void",
577
+ "summary": "Apply all queued operations to the world.",
578
+ "params": [{ "name": "cb", "type": "CommandBuffer", "optional": false, "description": "Buffer to flush." }],
579
+ "returns": { "type": "void", "description": "" },
580
+ "examples": [],
581
+ "seeAlso": ["createCommandBuffer", "withCommandBuffer"]
582
+ },
583
+ {
584
+ "name": "withCommandBuffer",
585
+ "kind": "function",
586
+ "module": "aiecsjs/commands",
587
+ "since": "0.1.0",
588
+ "stability": "stable",
589
+ "deprecated": false,
590
+ "signature": "function withCommandBuffer<R>(world: World, fn: (cb: CommandBuffer) => R): R",
591
+ "summary": "Scoped command buffer; auto-flushes at end of callback. Forwards the return value.",
592
+ "params": [
593
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
594
+ { "name": "fn", "type": "(cb: CommandBuffer) => R", "optional": false, "description": "Callback receiving the buffer." }
595
+ ],
596
+ "returns": { "type": "R", "description": "Whatever the callback returned." },
597
+ "examples": [
598
+ { "title": "Safe destroy in iter", "code": "withCommandBuffer(world, cb => { forEachEntity(world, dying, e => cb.destroy(e)) })" }
599
+ ],
600
+ "seeAlso": ["createCommandBuffer"]
601
+ },
602
+ {
603
+ "name": "observe",
604
+ "kind": "function",
605
+ "module": "aiecsjs/observers",
606
+ "since": "0.1.0",
607
+ "stability": "stable",
608
+ "deprecated": false,
609
+ "signature": "function observe(world: World, query: Query, event: 'add' | 'remove' | 'set', handler: (eid: EntityId) => void): () => void",
610
+ "summary": "General-purpose query observer. Returns a disposer.",
611
+ "params": [
612
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
613
+ { "name": "query", "type": "Query", "optional": false, "description": "Query handle." },
614
+ { "name": "event", "type": "'add'|'remove'|'set'", "optional": false, "description": "Event kind." },
615
+ { "name": "handler", "type": "(eid) => void", "optional": false, "description": "Callback." }
616
+ ],
617
+ "returns": { "type": "() => void", "description": "Disposer." },
618
+ "examples": [],
619
+ "seeAlso": ["onAdd", "onRemove", "onSet"]
620
+ },
621
+ {
622
+ "name": "onAdd",
623
+ "kind": "function",
624
+ "module": "aiecsjs/observers",
625
+ "since": "0.1.0",
626
+ "stability": "stable",
627
+ "deprecated": false,
628
+ "signature": "function onAdd(world: World, component: ComponentLike, handler: (eid: EntityId) => void): () => void",
629
+ "summary": "Listen for component-add events on a specific component.",
630
+ "params": [
631
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
632
+ { "name": "component", "type": "ComponentLike", "optional": false, "description": "Component handle." },
633
+ { "name": "handler", "type": "(eid) => void", "optional": false, "description": "Callback." }
634
+ ],
635
+ "returns": { "type": "() => void", "description": "Disposer." },
636
+ "examples": [],
637
+ "seeAlso": ["onRemove", "onSet", "observe"]
638
+ },
639
+ {
640
+ "name": "onRemove",
641
+ "kind": "function",
642
+ "module": "aiecsjs/observers",
643
+ "since": "0.1.0",
644
+ "stability": "stable",
645
+ "deprecated": false,
646
+ "signature": "function onRemove(world: World, component: ComponentLike, handler: (eid: EntityId) => void): () => void",
647
+ "summary": "Listen for component-remove events.",
648
+ "params": [],
649
+ "returns": { "type": "() => void", "description": "Disposer." },
650
+ "examples": [],
651
+ "seeAlso": ["onAdd", "onSet"]
652
+ },
653
+ {
654
+ "name": "onSet",
655
+ "kind": "function",
656
+ "module": "aiecsjs/observers",
657
+ "since": "0.1.0",
658
+ "stability": "stable",
659
+ "deprecated": false,
660
+ "signature": "function onSet<C extends ComponentLike>(world: World, component: C, handler: (eid: EntityId, value: unknown) => void): () => void",
661
+ "summary": "Listen for setComponent calls.",
662
+ "params": [],
663
+ "returns": { "type": "() => void", "description": "Disposer." },
664
+ "examples": [],
665
+ "seeAlso": ["onAdd", "onRemove"]
666
+ },
667
+ {
668
+ "name": "serializeWorld",
669
+ "kind": "function",
670
+ "module": "aiecsjs/serialize",
671
+ "since": "0.1.0",
672
+ "stability": "stable",
673
+ "deprecated": false,
674
+ "signature": "function serializeWorld(world: World, options?: SerializeOptions): Uint8Array",
675
+ "summary": "Produce a versioned binary snapshot of the world.",
676
+ "params": [
677
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
678
+ { "name": "options", "type": "SerializeOptions", "optional": true, "description": "Restrict to a component subset." }
679
+ ],
680
+ "returns": { "type": "Uint8Array", "description": "Binary snapshot." },
681
+ "examples": [{ "title": "Save", "code": "const bytes = serializeWorld(world)" }],
682
+ "seeAlso": ["deserializeWorld", "toJSON", "createDeltaSerializer"]
683
+ },
684
+ {
685
+ "name": "deserializeWorld",
686
+ "kind": "function",
687
+ "module": "aiecsjs/serialize",
688
+ "since": "0.1.0",
689
+ "stability": "stable",
690
+ "deprecated": false,
691
+ "signature": "function deserializeWorld(bytes: Uint8Array, options?: DeserializeOptions): World",
692
+ "summary": "Restore a world from binary bytes.",
693
+ "params": [
694
+ { "name": "bytes", "type": "Uint8Array", "optional": false, "description": "Bytes from serializeWorld." },
695
+ { "name": "options", "type": "DeserializeOptions", "optional": true, "description": "Migration behaviour for unknown versions." }
696
+ ],
697
+ "returns": { "type": "World", "description": "Restored world." },
698
+ "throws": [{ "type": "Error", "when": "version mismatch and onUnknownVersion is 'throw'." }],
699
+ "examples": [],
700
+ "seeAlso": ["serializeWorld"]
701
+ },
702
+ {
703
+ "name": "toJSON",
704
+ "kind": "function",
705
+ "module": "aiecsjs/serialize",
706
+ "since": "0.1.0",
707
+ "stability": "stable",
708
+ "deprecated": false,
709
+ "signature": "function toJSON(world: World): WorldSnapshot",
710
+ "summary": "Produce a human-readable JSON snapshot. Slower than serializeWorld; inspectable in DevTools.",
711
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Target world." }],
712
+ "returns": { "type": "WorldSnapshot", "description": "JSON-serializable object." },
713
+ "examples": [],
714
+ "seeAlso": ["fromJSON", "serializeWorld"]
715
+ },
716
+ {
717
+ "name": "fromJSON",
718
+ "kind": "function",
719
+ "module": "aiecsjs/serialize",
720
+ "since": "0.1.0",
721
+ "stability": "stable",
722
+ "deprecated": false,
723
+ "signature": "function fromJSON(snapshot: WorldSnapshot): World",
724
+ "summary": "Restore from a JSON snapshot.",
725
+ "params": [{ "name": "snapshot", "type": "WorldSnapshot", "optional": false, "description": "Snapshot from toJSON." }],
726
+ "returns": { "type": "World", "description": "Restored world." },
727
+ "examples": [],
728
+ "seeAlso": ["toJSON"]
729
+ },
730
+ {
731
+ "name": "createDeltaSerializer",
732
+ "kind": "function",
733
+ "module": "aiecsjs/serialize",
734
+ "since": "0.1.0",
735
+ "stability": "experimental",
736
+ "deprecated": false,
737
+ "signature": "function createDeltaSerializer(world: World, options?: SerializeOptions): DeltaSerializer",
738
+ "summary": "Capture only changes since the previous capture. For network replication. Wire format may change before 1.0.",
739
+ "params": [
740
+ { "name": "world", "type": "World", "optional": false, "description": "Target world." },
741
+ { "name": "options", "type": "SerializeOptions", "optional": true, "description": "Restrict to a component subset." }
742
+ ],
743
+ "returns": { "type": "DeltaSerializer", "description": "Object with capture/apply/reset methods." },
744
+ "examples": [
745
+ { "title": "Send delta over WS", "code": "const tx = createDeltaSerializer(world, { components: [Position] }); setInterval(() => ws.send(tx.capture()), 50)" }
746
+ ],
747
+ "seeAlso": ["serializeWorld"]
748
+ },
749
+ {
750
+ "name": "transferableSnapshot",
751
+ "kind": "function",
752
+ "module": "aiecsjs/worker",
753
+ "since": "0.1.0",
754
+ "stability": "experimental",
755
+ "deprecated": false,
756
+ "signature": "function transferableSnapshot(world: World): { buffer: SharedArrayBuffer; meta: WorldMeta }",
757
+ "summary": "Package a SAB-backed world for postMessage to a Worker.",
758
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "SAB-backed world." }],
759
+ "returns": { "type": "TransferableSnapshot", "description": "buffer + meta to send." },
760
+ "examples": [{ "title": "Send to worker", "code": "worker.postMessage(transferableSnapshot(world))" }],
761
+ "seeAlso": ["adoptSnapshot", "attachWorld"]
762
+ },
763
+ {
764
+ "name": "adoptSnapshot",
765
+ "kind": "function",
766
+ "module": "aiecsjs/worker",
767
+ "since": "0.1.0",
768
+ "stability": "experimental",
769
+ "deprecated": false,
770
+ "signature": "function adoptSnapshot(snap: { buffer: SharedArrayBuffer; meta: WorldMeta }): World",
771
+ "summary": "On the Worker side, materialise a world from a snapshot sent over postMessage.",
772
+ "params": [{ "name": "snap", "type": "TransferableSnapshot", "optional": false, "description": "Snapshot received via onmessage." }],
773
+ "returns": { "type": "World", "description": "Worker-side world view backed by the same SAB." },
774
+ "examples": [],
775
+ "seeAlso": ["transferableSnapshot"]
776
+ },
777
+ {
778
+ "name": "attachWorld",
779
+ "kind": "function",
780
+ "module": "aiecsjs/worker",
781
+ "since": "0.1.0",
782
+ "stability": "experimental",
783
+ "deprecated": false,
784
+ "signature": "function attachWorld(buffer: SharedArrayBuffer, options?: { readOnly?: boolean }): World",
785
+ "summary": "Attach to a SAB that was set up by another thread. Use readOnly when this thread should only read.",
786
+ "params": [
787
+ { "name": "buffer", "type": "SharedArrayBuffer", "optional": false, "description": "Shared buffer." },
788
+ { "name": "options", "type": "{ readOnly?: boolean }", "optional": true, "description": "Attach flags." }
789
+ ],
790
+ "returns": { "type": "World", "description": "Attached world view." },
791
+ "examples": [],
792
+ "seeAlso": ["detachWorld", "adoptSnapshot"]
793
+ },
794
+ {
795
+ "name": "detachWorld",
796
+ "kind": "function",
797
+ "module": "aiecsjs/worker",
798
+ "since": "0.1.0",
799
+ "stability": "experimental",
800
+ "deprecated": false,
801
+ "signature": "function detachWorld(world: World): void",
802
+ "summary": "Release this thread's view of a shared world. Does NOT free the SAB.",
803
+ "params": [{ "name": "world", "type": "World", "optional": false, "description": "Attached world." }],
804
+ "returns": { "type": "void", "description": "" },
805
+ "examples": [],
806
+ "seeAlso": ["attachWorld"]
807
+ },
808
+ {
809
+ "name": "defineRelation",
810
+ "kind": "function",
811
+ "module": "aiecsjs/relations",
812
+ "since": "0.2.0",
813
+ "stability": "experimental",
814
+ "deprecated": false,
815
+ "signature": "function defineRelation<T = void>(options?: { exclusive?: boolean }): Relation<T>",
816
+ "summary": "Declare a relation type between two entities. Documented for early feedback; implemented in 0.2.",
817
+ "params": [{ "name": "options", "type": "{ exclusive?: boolean }", "optional": true, "description": "If exclusive, each source may relate to at most one target." }],
818
+ "returns": { "type": "Relation<T>", "description": "Relation handle." },
819
+ "examples": [
820
+ { "title": "Likes relation with data", "code": "const Likes = defineRelation<{ since: number }>()" }
821
+ ],
822
+ "seeAlso": ["addRelation", "removeRelation", "getRelationTargets", "ChildOf"]
823
+ },
824
+ {
825
+ "name": "addRelation",
826
+ "kind": "function",
827
+ "module": "aiecsjs/relations",
828
+ "since": "0.2.0",
829
+ "stability": "experimental",
830
+ "deprecated": false,
831
+ "signature": "function addRelation<T>(world: World, source: EntityId, rel: Relation<T>, target: EntityId, data?: T): void",
832
+ "summary": "Add a relation edge from source to target.",
833
+ "params": [],
834
+ "returns": { "type": "void", "description": "" },
835
+ "examples": [{ "title": "Mark Alice as child of Parent", "code": "addRelation(world, alice, ChildOf, parent)" }],
836
+ "seeAlso": ["defineRelation"]
837
+ },
838
+ {
839
+ "name": "removeRelation",
840
+ "kind": "function",
841
+ "module": "aiecsjs/relations",
842
+ "since": "0.2.0",
843
+ "stability": "experimental",
844
+ "deprecated": false,
845
+ "signature": "function removeRelation(world: World, source: EntityId, rel: Relation, target: EntityId): void",
846
+ "summary": "Remove a single relation edge.",
847
+ "params": [],
848
+ "returns": { "type": "void", "description": "" },
849
+ "examples": [],
850
+ "seeAlso": ["defineRelation", "addRelation"]
851
+ },
852
+ {
853
+ "name": "getRelationTargets",
854
+ "kind": "function",
855
+ "module": "aiecsjs/relations",
856
+ "since": "0.2.0",
857
+ "stability": "experimental",
858
+ "deprecated": false,
859
+ "signature": "function getRelationTargets(world: World, source: EntityId, rel: Relation): readonly EntityId[]",
860
+ "summary": "Enumerate targets reachable from source by this relation.",
861
+ "params": [],
862
+ "returns": { "type": "readonly EntityId[]", "description": "Target entity IDs." },
863
+ "examples": [],
864
+ "seeAlso": ["defineRelation"]
865
+ },
866
+ {
867
+ "name": "isWorld",
868
+ "kind": "function",
869
+ "module": "aiecsjs",
870
+ "since": "0.1.0",
871
+ "stability": "stable",
872
+ "deprecated": false,
873
+ "signature": "function isWorld(x: unknown): x is World",
874
+ "summary": "Type guard for World values.",
875
+ "params": [],
876
+ "returns": { "type": "boolean", "description": "Type guard." },
877
+ "examples": [],
878
+ "seeAlso": ["isEntity"]
879
+ },
880
+ {
881
+ "name": "isEntity",
882
+ "kind": "function",
883
+ "module": "aiecsjs",
884
+ "since": "0.1.0",
885
+ "stability": "stable",
886
+ "deprecated": false,
887
+ "signature": "function isEntity(world: World, x: unknown): x is EntityId",
888
+ "summary": "Type guard for live EntityId in the given world.",
889
+ "params": [],
890
+ "returns": { "type": "boolean", "description": "Type guard." },
891
+ "examples": [],
892
+ "seeAlso": ["isWorld", "entityExists"]
893
+ }
894
+ ],
895
+ "types": [
896
+ {
897
+ "name": "WorldOptions",
898
+ "kind": "interface",
899
+ "module": "aiecsjs",
900
+ "since": "0.1.0",
901
+ "stability": "stable",
902
+ "definition": "type WorldOptions = { initialCapacity?: number; maxEntities?: number; indexBits?: 20 | 24; generationBits?: 8 | 12 | 16; buffer?: SharedArrayBuffer; bufferByteOffset?: number }"
903
+ },
904
+ {
905
+ "name": "World",
906
+ "kind": "interface",
907
+ "module": "aiecsjs",
908
+ "since": "0.1.0",
909
+ "stability": "stable",
910
+ "definition": "interface World { readonly id: number; readonly capacity: number; readonly version: string }"
911
+ },
912
+ {
913
+ "name": "EntityId",
914
+ "kind": "type",
915
+ "module": "aiecsjs",
916
+ "since": "0.1.0",
917
+ "stability": "stable",
918
+ "definition": "type EntityId = number & { readonly __brand: 'EntityId' }"
919
+ },
920
+ {
921
+ "name": "SoASchema",
922
+ "kind": "type",
923
+ "module": "aiecsjs",
924
+ "since": "0.1.0",
925
+ "stability": "stable",
926
+ "definition": "type SoASchema = Record<string, SoAFieldDecl>"
927
+ },
928
+ {
929
+ "name": "SoAComponent",
930
+ "kind": "interface",
931
+ "module": "aiecsjs",
932
+ "since": "0.1.0",
933
+ "stability": "stable",
934
+ "definition": "interface SoAComponent<S extends SoASchema> { readonly __schema: S; readonly __soa: true }"
935
+ },
936
+ {
937
+ "name": "AoSComponent",
938
+ "kind": "interface",
939
+ "module": "aiecsjs",
940
+ "since": "0.1.0",
941
+ "stability": "stable",
942
+ "definition": "interface AoSComponent<T> { readonly __aos: true }"
943
+ },
944
+ {
945
+ "name": "TagComponent",
946
+ "kind": "interface",
947
+ "module": "aiecsjs",
948
+ "since": "0.1.0",
949
+ "stability": "stable",
950
+ "definition": "interface TagComponent { readonly __tag: true }"
951
+ },
952
+ {
953
+ "name": "ComponentLike",
954
+ "kind": "type",
955
+ "module": "aiecsjs",
956
+ "since": "0.1.0",
957
+ "stability": "stable",
958
+ "definition": "type ComponentLike = SoAComponent<any> | AoSComponent<any> | TagComponent"
959
+ },
960
+ {
961
+ "name": "QueryDescriptor",
962
+ "kind": "interface",
963
+ "module": "aiecsjs",
964
+ "since": "0.1.0",
965
+ "stability": "stable",
966
+ "definition": "type QueryDescriptor = { all?: ComponentLike[]; any?: ComponentLike[]; none?: ComponentLike[] }"
967
+ },
968
+ {
969
+ "name": "Query",
970
+ "kind": "interface",
971
+ "module": "aiecsjs",
972
+ "since": "0.1.0",
973
+ "stability": "stable",
974
+ "definition": "interface Query { readonly id: number; readonly mask: ReadonlyArray<number> }"
975
+ },
976
+ {
977
+ "name": "System",
978
+ "kind": "type",
979
+ "module": "aiecsjs",
980
+ "since": "0.1.0",
981
+ "stability": "stable",
982
+ "definition": "type System<W extends World = World, Ctx = unknown> = (world: W, ctx: Ctx) => W"
983
+ },
984
+ {
985
+ "name": "LoopOptions",
986
+ "kind": "interface",
987
+ "module": "aiecsjs/loop",
988
+ "since": "0.1.0",
989
+ "stability": "stable",
990
+ "definition": "type LoopOptions = { fixed?: number; maxSubSteps?: number; onUpdate: (dt: number) => void; onRender?: (alpha: number) => void }"
991
+ },
992
+ {
993
+ "name": "CommandBuffer",
994
+ "kind": "interface",
995
+ "module": "aiecsjs/commands",
996
+ "since": "0.1.0",
997
+ "stability": "stable",
998
+ "definition": "interface CommandBuffer { add<C>(eid: EntityId, c: C, init?: unknown): void; remove<C>(eid: EntityId, c: C): void; destroy(eid: EntityId): void; create(): EntityId }"
999
+ },
1000
+ {
1001
+ "name": "SerializeOptions",
1002
+ "kind": "interface",
1003
+ "module": "aiecsjs/serialize",
1004
+ "since": "0.1.0",
1005
+ "stability": "stable",
1006
+ "definition": "type SerializeOptions = { components?: ComponentLike[] }"
1007
+ },
1008
+ {
1009
+ "name": "DeserializeOptions",
1010
+ "kind": "interface",
1011
+ "module": "aiecsjs/serialize",
1012
+ "since": "0.1.0",
1013
+ "stability": "stable",
1014
+ "definition": "type DeserializeOptions = { onUnknownVersion?: 'throw' | 'best-effort' }"
1015
+ },
1016
+ {
1017
+ "name": "WorldSnapshot",
1018
+ "kind": "interface",
1019
+ "module": "aiecsjs/serialize",
1020
+ "since": "0.1.0",
1021
+ "stability": "stable",
1022
+ "definition": "interface WorldSnapshot { /* opaque, JSON-serializable */ }"
1023
+ },
1024
+ {
1025
+ "name": "DeltaSerializer",
1026
+ "kind": "interface",
1027
+ "module": "aiecsjs/serialize",
1028
+ "since": "0.1.0",
1029
+ "stability": "experimental",
1030
+ "definition": "interface DeltaSerializer { capture(): Uint8Array; apply(world: World, delta: Uint8Array): void; reset(): void }"
1031
+ },
1032
+ {
1033
+ "name": "Archetype",
1034
+ "kind": "interface",
1035
+ "module": "aiecsjs",
1036
+ "since": "0.1.0",
1037
+ "stability": "experimental",
1038
+ "definition": "interface Archetype { readonly id: number; readonly mask: ReadonlyArray<number>; readonly size: number }"
1039
+ },
1040
+ {
1041
+ "name": "Relation",
1042
+ "kind": "interface",
1043
+ "module": "aiecsjs/relations",
1044
+ "since": "0.2.0",
1045
+ "stability": "experimental",
1046
+ "definition": "interface Relation<T = void> { readonly __relation: true }"
1047
+ }
1048
+ ],
1049
+ "constants": [
1050
+ {
1051
+ "name": "VERSION",
1052
+ "kind": "constant",
1053
+ "module": "aiecsjs",
1054
+ "type": "string",
1055
+ "stability": "stable",
1056
+ "since": "0.1.0",
1057
+ "description": "Equals the published npm package version."
1058
+ },
1059
+ {
1060
+ "name": "IS_SAB_SUPPORTED",
1061
+ "kind": "constant",
1062
+ "module": "aiecsjs",
1063
+ "type": "boolean",
1064
+ "stability": "stable",
1065
+ "since": "0.1.0",
1066
+ "description": "True iff SharedArrayBuffer is available in the current runtime."
1067
+ },
1068
+ {
1069
+ "name": "Types",
1070
+ "kind": "constant",
1071
+ "module": "aiecsjs",
1072
+ "type": "Readonly<Record<string, string>>",
1073
+ "stability": "stable",
1074
+ "since": "0.1.0",
1075
+ "description": "Map of SoA field type identifiers: i8 u8 i16 u16 i32 u32 f32 f64 eid bool."
1076
+ },
1077
+ {
1078
+ "name": "ChildOf",
1079
+ "kind": "constant",
1080
+ "module": "aiecsjs/relations",
1081
+ "type": "Relation",
1082
+ "stability": "experimental",
1083
+ "since": "0.2.0",
1084
+ "description": "Built-in parent-child relation. Available when aiecsjs/relations is implemented (target 0.2)."
1085
+ }
1086
+ ]
1087
+ }