@oasys/oecs 0.5.3 → 0.6.0

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 (510) hide show
  1. package/CHANGELOG.md +1399 -276
  2. package/README.md +327 -169
  3. package/dist/core/ecs/access_check.d.cts +31 -31
  4. package/dist/core/ecs/access_check.d.ts +31 -31
  5. package/dist/core/ecs/access_check.d.ts.map +1 -1
  6. package/dist/core/ecs/archetype.d.cts +273 -205
  7. package/dist/core/ecs/archetype.d.ts +273 -205
  8. package/dist/core/ecs/archetype.d.ts.map +1 -1
  9. package/dist/core/ecs/archetype_closure.d.cts +23 -0
  10. package/dist/core/ecs/archetype_closure.d.ts +23 -0
  11. package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
  12. package/dist/core/ecs/archetype_graph.d.cts +34 -34
  13. package/dist/core/ecs/archetype_graph.d.ts +34 -34
  14. package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
  15. package/dist/core/ecs/archetype_types.d.cts +55 -0
  16. package/dist/core/ecs/archetype_types.d.ts +55 -0
  17. package/dist/core/ecs/archetype_types.d.ts.map +1 -0
  18. package/dist/core/ecs/change_feed.d.cts +53 -0
  19. package/dist/core/ecs/change_feed.d.ts +53 -0
  20. package/dist/core/ecs/change_feed.d.ts.map +1 -0
  21. package/dist/core/ecs/changed_query.d.cts +36 -0
  22. package/dist/core/ecs/changed_query.d.ts +36 -0
  23. package/dist/core/ecs/changed_query.d.ts.map +1 -0
  24. package/dist/core/ecs/chunk_columns.d.cts +49 -0
  25. package/dist/core/ecs/chunk_columns.d.ts +49 -0
  26. package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
  27. package/dist/core/ecs/command_log.d.cts +30 -30
  28. package/dist/core/ecs/command_log.d.ts +30 -30
  29. package/dist/core/ecs/command_log.d.ts.map +1 -1
  30. package/dist/core/ecs/component.d.cts +45 -44
  31. package/dist/core/ecs/component.d.ts +45 -44
  32. package/dist/core/ecs/component.d.ts.map +1 -1
  33. package/dist/core/ecs/component_registry.d.cts +53 -0
  34. package/dist/core/ecs/component_registry.d.ts +53 -0
  35. package/dist/core/ecs/component_registry.d.ts.map +1 -0
  36. package/dist/core/ecs/compute_backend.d.cts +18 -7
  37. package/dist/core/ecs/compute_backend.d.ts +18 -7
  38. package/dist/core/ecs/compute_backend.d.ts.map +1 -1
  39. package/dist/core/ecs/deferred_commands.d.cts +15 -14
  40. package/dist/core/ecs/deferred_commands.d.ts +15 -14
  41. package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
  42. package/dist/core/ecs/dispatch_trace.d.cts +32 -31
  43. package/dist/core/ecs/dispatch_trace.d.ts +32 -31
  44. package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
  45. package/dist/core/ecs/ecs.d.cts +337 -276
  46. package/dist/core/ecs/ecs.d.ts +337 -276
  47. package/dist/core/ecs/ecs.d.ts.map +1 -1
  48. package/dist/core/ecs/ecs_memory.d.cts +134 -136
  49. package/dist/core/ecs/ecs_memory.d.ts +134 -136
  50. package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
  51. package/dist/core/ecs/ecs_options.d.cts +89 -0
  52. package/dist/core/ecs/ecs_options.d.ts +89 -0
  53. package/dist/core/ecs/ecs_options.d.ts.map +1 -0
  54. package/dist/core/ecs/entity.d.cts +4 -4
  55. package/dist/core/ecs/entity.d.ts +4 -4
  56. package/dist/core/ecs/entity_allocator.d.cts +24 -22
  57. package/dist/core/ecs/entity_allocator.d.ts +24 -22
  58. package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
  59. package/dist/core/ecs/event.d.cts +37 -23
  60. package/dist/core/ecs/event.d.ts +37 -23
  61. package/dist/core/ecs/event.d.ts.map +1 -1
  62. package/dist/core/ecs/facades.d.cts +12 -126
  63. package/dist/core/ecs/facades.d.ts +12 -126
  64. package/dist/core/ecs/facades.d.ts.map +1 -1
  65. package/dist/core/ecs/frame_stepper.d.cts +12 -12
  66. package/dist/core/ecs/frame_stepper.d.ts +12 -12
  67. package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
  68. package/dist/core/ecs/frame_trace.d.cts +34 -34
  69. package/dist/core/ecs/frame_trace.d.ts +34 -34
  70. package/dist/core/ecs/frame_trace.d.ts.map +1 -1
  71. package/dist/core/ecs/host_commands.d.cts +107 -89
  72. package/dist/core/ecs/host_commands.d.ts +107 -89
  73. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  74. package/dist/core/ecs/index.d.cts +22 -12
  75. package/dist/core/ecs/index.d.ts +22 -12
  76. package/dist/core/ecs/index.d.ts.map +1 -1
  77. package/dist/core/ecs/observer.d.cts +41 -122
  78. package/dist/core/ecs/observer.d.ts +41 -122
  79. package/dist/core/ecs/observer.d.ts.map +1 -1
  80. package/dist/core/ecs/phase.d.cts +79 -0
  81. package/dist/core/ecs/phase.d.ts +79 -0
  82. package/dist/core/ecs/phase.d.ts.map +1 -0
  83. package/dist/core/ecs/plugin.d.cts +125 -0
  84. package/dist/core/ecs/plugin.d.ts +125 -0
  85. package/dist/core/ecs/plugin.d.ts.map +1 -0
  86. package/dist/core/ecs/plugin_slots.d.cts +26 -0
  87. package/dist/core/ecs/plugin_slots.d.ts +26 -0
  88. package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
  89. package/dist/core/ecs/query.d.cts +219 -568
  90. package/dist/core/ecs/query.d.ts +219 -568
  91. package/dist/core/ecs/query.d.ts.map +1 -1
  92. package/dist/core/ecs/query_cache.d.cts +130 -0
  93. package/dist/core/ecs/query_cache.d.ts +130 -0
  94. package/dist/core/ecs/query_cache.d.ts.map +1 -0
  95. package/dist/core/ecs/query_registry.d.cts +47 -0
  96. package/dist/core/ecs/query_registry.d.ts +47 -0
  97. package/dist/core/ecs/query_registry.d.ts.map +1 -0
  98. package/dist/core/ecs/query_terms.d.cts +126 -0
  99. package/dist/core/ecs/query_terms.d.ts +126 -0
  100. package/dist/core/ecs/query_terms.d.ts.map +1 -0
  101. package/dist/core/ecs/ref.d.cts +129 -16
  102. package/dist/core/ecs/ref.d.ts +129 -16
  103. package/dist/core/ecs/ref.d.ts.map +1 -1
  104. package/dist/core/ecs/relation.d.cts +105 -186
  105. package/dist/core/ecs/relation.d.ts +105 -186
  106. package/dist/core/ecs/relation.d.ts.map +1 -1
  107. package/dist/core/ecs/resource.d.cts +14 -14
  108. package/dist/core/ecs/resource.d.ts +14 -14
  109. package/dist/core/ecs/resource_registry.d.cts +6 -6
  110. package/dist/core/ecs/resource_registry.d.ts +6 -6
  111. package/dist/core/ecs/resource_registry.d.ts.map +1 -1
  112. package/dist/core/ecs/row_kinds.d.cts +24 -0
  113. package/dist/core/ecs/row_kinds.d.ts +24 -0
  114. package/dist/core/ecs/row_kinds.d.ts.map +1 -0
  115. package/dist/core/ecs/run_condition.d.cts +23 -23
  116. package/dist/core/ecs/run_condition.d.ts +23 -23
  117. package/dist/core/ecs/run_condition.d.ts.map +1 -1
  118. package/dist/core/ecs/schedule.d.cts +98 -114
  119. package/dist/core/ecs/schedule.d.ts +98 -114
  120. package/dist/core/ecs/schedule.d.ts.map +1 -1
  121. package/dist/core/ecs/schedule_plan.d.cts +33 -0
  122. package/dist/core/ecs/schedule_plan.d.ts +33 -0
  123. package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
  124. package/dist/core/ecs/snapshot.d.cts +77 -0
  125. package/dist/core/ecs/snapshot.d.ts +77 -0
  126. package/dist/core/ecs/snapshot.d.ts.map +1 -0
  127. package/dist/core/ecs/snapshot_mount.d.cts +42 -0
  128. package/dist/core/ecs/snapshot_mount.d.ts +42 -0
  129. package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
  130. package/dist/core/ecs/sparse_store.d.cts +110 -53
  131. package/dist/core/ecs/sparse_store.d.ts +110 -53
  132. package/dist/core/ecs/sparse_store.d.ts.map +1 -1
  133. package/dist/core/ecs/store.d.cts +644 -511
  134. package/dist/core/ecs/store.d.ts +644 -511
  135. package/dist/core/ecs/store.d.ts.map +1 -1
  136. package/dist/core/ecs/store_layout_listener.d.cts +8 -8
  137. package/dist/core/ecs/store_layout_listener.d.ts +8 -8
  138. package/dist/core/ecs/store_types.d.cts +122 -0
  139. package/dist/core/ecs/store_types.d.ts +122 -0
  140. package/dist/core/ecs/store_types.d.ts.map +1 -0
  141. package/dist/core/ecs/system.d.cts +151 -66
  142. package/dist/core/ecs/system.d.ts +151 -66
  143. package/dist/core/ecs/system.d.ts.map +1 -1
  144. package/dist/core/ecs/system_context.d.cts +296 -0
  145. package/dist/core/ecs/system_context.d.ts +296 -0
  146. package/dist/core/ecs/system_context.d.ts.map +1 -0
  147. package/dist/core/ecs/system_set.d.cts +48 -0
  148. package/dist/core/ecs/system_set.d.ts +48 -0
  149. package/dist/core/ecs/system_set.d.ts.map +1 -0
  150. package/dist/core/ecs/utils/arrays.d.cts +15 -1
  151. package/dist/core/ecs/utils/arrays.d.ts +15 -1
  152. package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
  153. package/dist/core/ecs/utils/error.d.cts +87 -4
  154. package/dist/core/ecs/utils/error.d.ts +87 -4
  155. package/dist/core/ecs/utils/error.d.ts.map +1 -1
  156. package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
  157. package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
  158. package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
  159. package/dist/core/restore_errors.d.cts +30 -0
  160. package/dist/core/restore_errors.d.ts +30 -0
  161. package/dist/core/restore_errors.d.ts.map +1 -0
  162. package/dist/core/store/action_ring.d.cts +48 -49
  163. package/dist/core/store/action_ring.d.ts +48 -49
  164. package/dist/core/store/action_ring.d.ts.map +1 -1
  165. package/dist/core/store/allocator.d.cts +166 -114
  166. package/dist/core/store/allocator.d.ts +166 -114
  167. package/dist/core/store/allocator.d.ts.map +1 -1
  168. package/dist/core/store/buffer_backed_column.d.cts +21 -22
  169. package/dist/core/store/buffer_backed_column.d.ts +21 -22
  170. package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
  171. package/dist/core/store/column_store.d.cts +138 -100
  172. package/dist/core/store/column_store.d.ts +138 -100
  173. package/dist/core/store/column_store.d.ts.map +1 -1
  174. package/dist/core/store/command_dispatch.d.cts +14 -15
  175. package/dist/core/store/command_dispatch.d.ts +14 -15
  176. package/dist/core/store/command_dispatch.d.ts.map +1 -1
  177. package/dist/core/store/command_ring.d.cts +41 -45
  178. package/dist/core/store/command_ring.d.ts +41 -45
  179. package/dist/core/store/command_ring.d.ts.map +1 -1
  180. package/dist/core/store/descriptor.d.cts +35 -18
  181. package/dist/core/store/descriptor.d.ts +35 -18
  182. package/dist/core/store/descriptor.d.ts.map +1 -1
  183. package/dist/core/store/entity_index.d.cts +34 -35
  184. package/dist/core/store/entity_index.d.ts +34 -35
  185. package/dist/core/store/entity_index.d.ts.map +1 -1
  186. package/dist/core/store/event_ring.d.cts +40 -42
  187. package/dist/core/store/event_ring.d.ts +40 -42
  188. package/dist/core/store/event_ring.d.ts.map +1 -1
  189. package/dist/core/store/extend.d.cts +15 -9
  190. package/dist/core/store/extend.d.ts +15 -9
  191. package/dist/core/store/extend.d.ts.map +1 -1
  192. package/dist/core/store/grow.d.cts +3 -3
  193. package/dist/core/store/grow.d.ts +3 -3
  194. package/dist/core/store/grow.d.ts.map +1 -1
  195. package/dist/core/store/header.d.cts +37 -33
  196. package/dist/core/store/header.d.ts +37 -33
  197. package/dist/core/store/header.d.ts.map +1 -1
  198. package/dist/core/store/index.d.cts +10 -10
  199. package/dist/core/store/index.d.ts +10 -10
  200. package/dist/core/store/index.d.ts.map +1 -1
  201. package/dist/core/store/layout_ops.d.cts +72 -63
  202. package/dist/core/store/layout_ops.d.ts +72 -63
  203. package/dist/core/store/layout_ops.d.ts.map +1 -1
  204. package/dist/core/store/region_table.d.cts +28 -21
  205. package/dist/core/store/region_table.d.ts +28 -21
  206. package/dist/core/store/region_table.d.ts.map +1 -1
  207. package/dist/core/store/snapshot.d.cts +31 -16
  208. package/dist/core/store/snapshot.d.ts +31 -16
  209. package/dist/core/store/snapshot.d.ts.map +1 -1
  210. package/dist/core/store/state_hash.d.cts +14 -14
  211. package/dist/core/store/state_hash.d.ts +14 -14
  212. package/dist/core/store/state_hash.d.ts.map +1 -1
  213. package/dist/core/store/store_regions.d.cts +10 -10
  214. package/dist/core/store/store_regions.d.ts +10 -10
  215. package/dist/core/store/store_regions.d.ts.map +1 -1
  216. package/dist/core/store/vendored_abi/abi.d.cts +27 -2
  217. package/dist/core/store/vendored_abi/abi.d.ts +27 -2
  218. package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
  219. package/dist/host_commands-B2KMx8O2.cjs +1 -0
  220. package/dist/host_commands-ClVPvhSa.cjs +2 -0
  221. package/dist/host_commands-CwxVQS1z.js +1524 -0
  222. package/dist/host_commands-nJvTy88E.js +1667 -0
  223. package/dist/index.cjs +1 -1
  224. package/dist/index.d.cts +16 -11
  225. package/dist/index.d.ts +16 -11
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.development.cjs +1 -1
  228. package/dist/index.development.js +6709 -5729
  229. package/dist/index.js +5664 -4743
  230. package/dist/internal.cjs +2 -2
  231. package/dist/internal.d.cts +5 -2
  232. package/dist/internal.d.ts +5 -2
  233. package/dist/internal.d.ts.map +1 -1
  234. package/dist/internal.development.cjs +1 -1
  235. package/dist/internal.development.js +70 -20
  236. package/dist/internal.js +138 -83
  237. package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
  238. package/dist/plugins/abi-NP8pNxpd.js +42 -0
  239. package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
  240. package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
  241. package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
  242. package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
  243. package/dist/{extensions → plugins}/editor/editor.d.cts +56 -56
  244. package/dist/{extensions → plugins}/editor/editor.d.ts +56 -56
  245. package/dist/plugins/editor/editor.d.ts.map +1 -0
  246. package/dist/{extensions → plugins}/editor/field_handle.d.cts +13 -13
  247. package/dist/{extensions → plugins}/editor/field_handle.d.ts +13 -13
  248. package/dist/plugins/editor/field_handle.d.ts.map +1 -0
  249. package/dist/plugins/editor/index.d.cts +22 -0
  250. package/dist/plugins/editor/index.d.ts +22 -0
  251. package/dist/plugins/editor/index.d.ts.map +1 -0
  252. package/dist/plugins/editor.cjs +1 -0
  253. package/dist/plugins/editor.d.cts +1 -0
  254. package/dist/plugins/editor.d.ts +1 -0
  255. package/dist/plugins/editor.development.cjs +1 -0
  256. package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +83 -66
  257. package/dist/{extensions/editor/index.js → plugins/editor.js} +83 -66
  258. package/dist/plugins/events/event_channel.d.cts +13 -0
  259. package/dist/plugins/events/event_channel.d.ts +13 -0
  260. package/dist/plugins/events/event_channel.d.ts.map +1 -0
  261. package/dist/plugins/events/event_registry.d.cts +22 -0
  262. package/dist/plugins/events/event_registry.d.ts +22 -0
  263. package/dist/plugins/events/event_registry.d.ts.map +1 -0
  264. package/dist/plugins/events/facade.d.cts +26 -0
  265. package/dist/plugins/events/facade.d.ts +26 -0
  266. package/dist/plugins/events/facade.d.ts.map +1 -0
  267. package/dist/plugins/events/index.d.cts +10 -0
  268. package/dist/plugins/events/index.d.ts +10 -0
  269. package/dist/plugins/events/index.d.ts.map +1 -0
  270. package/dist/plugins/events.cjs +1 -0
  271. package/dist/plugins/events.d.cts +1 -0
  272. package/dist/plugins/events.d.ts +1 -0
  273. package/dist/plugins/events.development.cjs +1 -0
  274. package/dist/plugins/events.development.js +174 -0
  275. package/dist/plugins/events.js +159 -0
  276. package/dist/plugins/observers/index.d.cts +23 -0
  277. package/dist/plugins/observers/index.d.ts +23 -0
  278. package/dist/plugins/observers/index.d.ts.map +1 -0
  279. package/dist/plugins/observers/observer_registry.d.cts +101 -0
  280. package/dist/plugins/observers/observer_registry.d.ts +101 -0
  281. package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
  282. package/dist/plugins/observers.cjs +1 -0
  283. package/dist/plugins/observers.d.cts +1 -0
  284. package/dist/plugins/observers.d.ts +1 -0
  285. package/dist/plugins/observers.development.cjs +1 -0
  286. package/dist/plugins/observers.development.js +431 -0
  287. package/dist/plugins/observers.js +403 -0
  288. package/dist/plugins/relation_store-BsoegrZh.js +313 -0
  289. package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
  290. package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
  291. package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
  292. package/dist/plugins/relations/builtin_relations.d.cts +48 -0
  293. package/dist/plugins/relations/builtin_relations.d.ts +48 -0
  294. package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
  295. package/dist/plugins/relations/facade.d.cts +73 -0
  296. package/dist/plugins/relations/facade.d.ts +73 -0
  297. package/dist/plugins/relations/facade.d.ts.map +1 -0
  298. package/dist/plugins/relations/index.d.cts +11 -0
  299. package/dist/plugins/relations/index.d.ts +11 -0
  300. package/dist/plugins/relations/index.d.ts.map +1 -0
  301. package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +93 -105
  302. package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +93 -105
  303. package/dist/plugins/relations/relation_service.d.ts.map +1 -0
  304. package/dist/plugins/relations/relation_store.d.cts +177 -0
  305. package/dist/plugins/relations/relation_store.d.ts +177 -0
  306. package/dist/plugins/relations/relation_store.d.ts.map +1 -0
  307. package/dist/plugins/relations.cjs +1 -0
  308. package/dist/plugins/relations.d.cts +1 -0
  309. package/dist/plugins/relations.d.ts +1 -0
  310. package/dist/plugins/relations.development.cjs +1 -0
  311. package/dist/plugins/relations.development.js +603 -0
  312. package/dist/plugins/relations.js +553 -0
  313. package/dist/plugins/snapshots/index.d.cts +33 -0
  314. package/dist/plugins/snapshots/index.d.ts +33 -0
  315. package/dist/plugins/snapshots/index.d.ts.map +1 -0
  316. package/dist/plugins/snapshots/resume.d.cts +57 -0
  317. package/dist/plugins/snapshots/resume.d.ts +57 -0
  318. package/dist/plugins/snapshots/resume.d.ts.map +1 -0
  319. package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
  320. package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
  321. package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
  322. package/dist/plugins/snapshots.cjs +1 -0
  323. package/dist/plugins/snapshots.d.cts +1 -0
  324. package/dist/plugins/snapshots.d.ts +1 -0
  325. package/dist/plugins/snapshots.development.cjs +1 -0
  326. package/dist/plugins/snapshots.development.js +737 -0
  327. package/dist/plugins/snapshots.js +737 -0
  328. package/dist/plugins/solid/index.d.cts +8 -0
  329. package/dist/plugins/solid/index.d.ts +8 -0
  330. package/dist/plugins/solid/index.d.ts.map +1 -0
  331. package/dist/plugins/solid/solid.d.cts +97 -0
  332. package/dist/plugins/solid/solid.d.ts +97 -0
  333. package/dist/plugins/solid/solid.d.ts.map +1 -0
  334. package/dist/plugins/solid.cjs +1 -0
  335. package/dist/plugins/solid.d.cts +1 -0
  336. package/dist/plugins/solid.d.ts +1 -0
  337. package/dist/plugins/solid.development.cjs +1 -0
  338. package/dist/plugins/solid.development.js +319 -0
  339. package/dist/plugins/solid.js +319 -0
  340. package/dist/plugins/workers/index.d.cts +75 -0
  341. package/dist/plugins/workers/index.d.ts +75 -0
  342. package/dist/plugins/workers/index.d.ts.map +1 -0
  343. package/dist/plugins/workers/node_threads.d.cts +25 -0
  344. package/dist/plugins/workers/node_threads.d.ts +25 -0
  345. package/dist/plugins/workers/node_threads.d.ts.map +1 -0
  346. package/dist/plugins/workers/plan.d.cts +61 -0
  347. package/dist/plugins/workers/plan.d.ts +61 -0
  348. package/dist/plugins/workers/plan.d.ts.map +1 -0
  349. package/dist/plugins/workers/pool.d.cts +144 -0
  350. package/dist/plugins/workers/pool.d.ts +144 -0
  351. package/dist/plugins/workers/pool.d.ts.map +1 -0
  352. package/dist/plugins/workers/protocol.d.cts +112 -0
  353. package/dist/plugins/workers/protocol.d.ts +112 -0
  354. package/dist/plugins/workers/protocol.d.ts.map +1 -0
  355. package/dist/plugins/workers/worker_bind.d.cts +64 -0
  356. package/dist/plugins/workers/worker_bind.d.ts +64 -0
  357. package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
  358. package/dist/plugins/workers/worker_loop.d.cts +14 -0
  359. package/dist/plugins/workers/worker_loop.d.ts +14 -0
  360. package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
  361. package/dist/plugins/workers.cjs +1 -0
  362. package/dist/plugins/workers.d.cts +1 -0
  363. package/dist/plugins/workers.d.ts +1 -0
  364. package/dist/plugins/workers.development.cjs +1 -0
  365. package/dist/plugins/workers.development.js +596 -0
  366. package/dist/plugins/workers.js +474 -0
  367. package/dist/primitives.cjs +1 -1
  368. package/dist/primitives.d.cts +4 -4
  369. package/dist/primitives.d.ts +4 -4
  370. package/dist/primitives.development.cjs +1 -1
  371. package/dist/primitives.development.js +66 -22
  372. package/dist/primitives.js +66 -22
  373. package/dist/shared-BKl12xF1.js +132 -0
  374. package/dist/shared-Dk-pACZT.cjs +1 -0
  375. package/dist/shared.cjs +1 -1
  376. package/dist/shared.d.cts +7 -7
  377. package/dist/shared.d.ts +7 -7
  378. package/dist/shared.d.ts.map +1 -1
  379. package/dist/shared.development.cjs +1 -1
  380. package/dist/shared.development.js +4 -3
  381. package/dist/shared.js +4 -3
  382. package/dist/topological_sort-Cc_yXqPT.js +346 -0
  383. package/dist/topological_sort-vp1imU6D.cjs +1 -0
  384. package/dist/type_primitives/assertions.d.cts +12 -16
  385. package/dist/type_primitives/assertions.d.ts +12 -16
  386. package/dist/type_primitives/assertions.d.ts.map +1 -1
  387. package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
  388. package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
  389. package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
  390. package/dist/type_primitives/bitset/bitset.d.cts +7 -11
  391. package/dist/type_primitives/bitset/bitset.d.ts +7 -11
  392. package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
  393. package/dist/type_primitives/brand.d.cts +2 -7
  394. package/dist/type_primitives/brand.d.ts +2 -7
  395. package/dist/type_primitives/brand.d.ts.map +1 -1
  396. package/dist/type_primitives/error.d.cts +1 -2
  397. package/dist/type_primitives/error.d.ts +1 -2
  398. package/dist/type_primitives/error.d.ts.map +1 -1
  399. package/dist/type_primitives/index.d.cts +1 -1
  400. package/dist/type_primitives/index.d.ts +1 -1
  401. package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
  402. package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
  403. package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
  404. package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
  405. package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
  406. package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
  407. package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
  408. package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
  409. package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
  410. package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +18 -17
  411. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +18 -17
  412. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
  413. package/dist/utils/error.d.ts.map +1 -1
  414. package/dist/version.d.cts +4 -4
  415. package/dist/version.d.ts +4 -4
  416. package/dist/worker.cjs +1 -0
  417. package/dist/worker.d.cts +17 -0
  418. package/dist/worker.d.ts +17 -0
  419. package/dist/worker.d.ts.map +1 -0
  420. package/dist/worker.development.cjs +1 -0
  421. package/dist/worker.development.js +253 -0
  422. package/dist/worker.js +253 -0
  423. package/package.json +363 -191
  424. package/dist/core/ecs/builtin_relations.d.cts +0 -43
  425. package/dist/core/ecs/builtin_relations.d.ts +0 -43
  426. package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
  427. package/dist/core/ecs/event_registry.d.cts +0 -22
  428. package/dist/core/ecs/event_registry.d.ts +0 -22
  429. package/dist/core/ecs/event_registry.d.ts.map +0 -1
  430. package/dist/core/ecs/relation_service.d.ts.map +0 -1
  431. package/dist/core/ecs/resume.d.cts +0 -85
  432. package/dist/core/ecs/resume.d.ts +0 -85
  433. package/dist/core/ecs/resume.d.ts.map +0 -1
  434. package/dist/core/ecs/snapshot_service.d.cts +0 -94
  435. package/dist/core/ecs/snapshot_service.d.ts +0 -94
  436. package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
  437. package/dist/extensions/editor/editor.d.ts.map +0 -1
  438. package/dist/extensions/editor/field_handle.d.ts.map +0 -1
  439. package/dist/extensions/editor/index.cjs +0 -1
  440. package/dist/extensions/editor/index.d.cts +0 -21
  441. package/dist/extensions/editor/index.d.ts +0 -21
  442. package/dist/extensions/editor/index.d.ts.map +0 -1
  443. package/dist/extensions/editor/index.development.cjs +0 -1
  444. package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
  445. package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
  446. package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
  447. package/dist/extensions/reactive/index.cjs +0 -1
  448. package/dist/extensions/reactive/index.d.cts +0 -23
  449. package/dist/extensions/reactive/index.d.ts +0 -23
  450. package/dist/extensions/reactive/index.d.ts.map +0 -1
  451. package/dist/extensions/reactive/index.development.cjs +0 -1
  452. package/dist/extensions/reactive/index.development.js +0 -215
  453. package/dist/extensions/reactive/index.js +0 -215
  454. package/dist/extensions/solid/index.cjs +0 -1
  455. package/dist/extensions/solid/index.d.cts +0 -6
  456. package/dist/extensions/solid/index.d.ts +0 -6
  457. package/dist/extensions/solid/index.d.ts.map +0 -1
  458. package/dist/extensions/solid/index.development.cjs +0 -1
  459. package/dist/extensions/solid/index.development.js +0 -40
  460. package/dist/extensions/solid/index.js +0 -36
  461. package/dist/extensions/solid/kernel_solid.d.cts +0 -45
  462. package/dist/extensions/solid/kernel_solid.d.ts +0 -45
  463. package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
  464. package/dist/host_commands-3jyFfWNg.js +0 -2326
  465. package/dist/host_commands-DNf0f6ko.cjs +0 -1
  466. package/dist/internal-C9jjL90H.js +0 -2485
  467. package/dist/internal-RZN14uMw.cjs +0 -2
  468. package/dist/interop-CT-REx0W.cjs +0 -1
  469. package/dist/interop-CcY6ASQc.js +0 -18
  470. package/dist/interop-DqxleBo7.js +0 -18
  471. package/dist/interop-T1HZ-Dpa.cjs +0 -1
  472. package/dist/kernel-Cz2Kxlwl.js +0 -240
  473. package/dist/kernel-DgyrLFjW.js +0 -227
  474. package/dist/kernel-sw7ScKWu.cjs +0 -1
  475. package/dist/kernel-yWV3XnAb.cjs +0 -1
  476. package/dist/reactive/array.d.cts +0 -24
  477. package/dist/reactive/array.d.ts +0 -24
  478. package/dist/reactive/array.d.ts.map +0 -1
  479. package/dist/reactive/index.cjs +0 -1
  480. package/dist/reactive/index.d.cts +0 -11
  481. package/dist/reactive/index.d.ts +0 -11
  482. package/dist/reactive/index.d.ts.map +0 -1
  483. package/dist/reactive/index.development.cjs +0 -1
  484. package/dist/reactive/index.development.js +0 -18
  485. package/dist/reactive/index.js +0 -18
  486. package/dist/reactive/interop.d.cts +0 -19
  487. package/dist/reactive/interop.d.ts +0 -19
  488. package/dist/reactive/interop.d.ts.map +0 -1
  489. package/dist/reactive/kernel.d.cts +0 -73
  490. package/dist/reactive/kernel.d.ts +0 -73
  491. package/dist/reactive/kernel.d.ts.map +0 -1
  492. package/dist/reactive/map.d.cts +0 -16
  493. package/dist/reactive/map.d.ts +0 -16
  494. package/dist/reactive/map.d.ts.map +0 -1
  495. package/dist/reactive/shallow.d.cts +0 -11
  496. package/dist/reactive/shallow.d.ts +0 -11
  497. package/dist/reactive/shallow.d.ts.map +0 -1
  498. package/dist/reactive/struct.d.cts +0 -10
  499. package/dist/reactive/struct.d.ts +0 -10
  500. package/dist/reactive/struct.d.ts.map +0 -1
  501. package/dist/shallow-9S1pY_Iw.js +0 -159
  502. package/dist/shallow-C5YmTbtb.cjs +0 -1
  503. package/dist/shallow-DQ8aG51_.cjs +0 -1
  504. package/dist/shallow-DfnAm9vG.js +0 -150
  505. package/dist/shared-BMXh9hxm.cjs +0 -1
  506. package/dist/shared-DQKK0i-E.js +0 -109
  507. package/dist/topological_sort-BDvEyb9W.cjs +0 -1
  508. package/dist/topological_sort-DK6EjpWa.js +0 -135
  509. package/dist/typed_arrays-BcXcnzB4.js +0 -258
  510. package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
@@ -1,8 +1,10 @@
1
- import { Brand, AnyTypedArray, ColumnBacking, TypedArrayTag, BitSet } from '../../type_primitives/index.cjs';
1
+ import { ArchetypeID, ArchetypeView } from './archetype_types.cjs';
2
+ import { AnyTypedArray, ColumnBacking, TypedArrayTag, BitSet } from '../../type_primitives/index.cjs';
2
3
  import { ColumnStore } from '../store/column_store.cjs';
3
- import { ComponentID, ComponentDef, ComponentSchema, SchemaOf, DeclaredQueryTerm, TagToTypedArray, ColumnsForSchema, MutableColumnsForSchema, ReadonlyColumn } from './component.cjs';
4
+ import { ComponentID, ComponentDef, ComponentSchema, TagToTypedArray, ColumnsForSchema, MutableColumnsForSchema, ReadonlyColumn } from './component.cjs';
4
5
  import { EntityID, ReadonlyEntityIDArray } from './entity.cjs';
5
- export type ArchetypeID = Brand<number, "archetype_id">;
6
+ import { AccessorColumns } from './ref.cjs';
7
+ export type { ArchetypeID, ArchetypeView } from './archetype_types.cjs';
6
8
  export declare const asArchetypeId: (value: number) => ArchetypeID;
7
9
  export interface ArchetypeEdge {
8
10
  add: ArchetypeID | null;
@@ -16,11 +18,11 @@ export interface ArchetypeEdge {
16
18
  * Cached resolution of a *multi*-component add out of this archetype: the
17
19
  * target archetype the union lands in, plus the pre-built src→target batch
18
20
  * transition map. Keyed (on the source archetype) by an exact N-tagged pack of
19
- * the added component ids see `Store.addComponents` (#659).
21
+ * the added component ids, see `Store.addComponents`.
20
22
  *
21
23
  * Where `ArchetypeEdge` is the per-*component* edge the single-add path indexes
22
- * by `edges[component_id]`, this is the per-*set* edge the plural-add path looks
23
- * up by packed key folding the mask hash, `archLookup`, and batch-map fetch
24
+ * by `_edges[component_id]`, this is the per-*set* edge the plural-add path looks
25
+ * up by packed key, folding the mask hash, `archLookup`, and batch-map fetch
24
26
  * the final-mask resolve repeats every call into one `Map.get`. Never
25
27
  * invalidated: the archetype graph is monotonic (archetypes outlive the Store).
26
28
  */
@@ -33,79 +35,30 @@ export interface ArchetypeColumnLayout {
33
35
  fieldNames: string[];
34
36
  fieldIndex: Record<string, number>;
35
37
  fieldTypes: TypedArrayTag[];
36
- }
37
- interface ArchetypeColumnGroup {
38
- layout: ArchetypeColumnLayout;
39
- columns: ColumnBacking<AnyTypedArray>[];
38
+ /** The global name id of each field (`fieldGids` in ref.ts). Optional so a
39
+ * test can build a heap archetype from a bare layout. The archetype then
40
+ * uses the ordinals as ids, which is correct for an archetype that no ref or
41
+ * cursor reaches through the shared prototype. */
42
+ fieldGid?: Int32Array;
40
43
  }
41
44
  /**
42
45
  * Per-column allocator. Returns a `ColumnBacking` for the field at
43
46
  * `fieldIdx` of component `component_id`. The default factory (when none
44
47
  * is supplied to the constructor) allocates a `GrowableTypedArray` on the
45
- * heap; `fromColumnStore` supplies a factory that wraps SAB views instead.
48
+ * heap. `fromColumnStore` supplies a factory that wraps SAB views instead.
46
49
  */
47
50
  export type ColumnFactory = (componentId: ComponentID, fieldIdx: number, tag: TypedArrayTag) => ColumnBacking<AnyTypedArray>;
48
51
  /**
49
52
  * Hook the host installs on every SAB-backed archetype so the Archetype
50
- * can request a SAB grow + refresh from the host BEFORE the insertion
53
+ * can request a SAB grow + refresh from the host before the insertion
51
54
  * that would otherwise throw `StoreColumnOverflowError`. The host (Store)
52
55
  * is responsible for running `growColumnStore` and `refreshViews`
53
- * across every SAB-backed archetype; after the handler returns,
54
- * `arch._flatColumns[i].buf.length` is guaranteed to be `>= arch.length +
55
- * additional`. Heap-backed archetypes leave this unset their
56
- * `GrowableTypedArray` grows in place. (#171 §6.1.9 Phase 3)
56
+ * across every SAB-backed archetype. After the handler returns,
57
+ * `arch.flatColumns[i].buf.length` is guaranteed to be `>= arch.length +
58
+ * additional`. Heap-backed archetypes leave this unset, their
59
+ * `GrowableTypedArray` grows in place.
57
60
  */
58
61
  export type ArchetypeGrowHandler = (arch: Archetype, additional: number) => void;
59
- /**
60
- * Public, read-only window onto an archetype's rows. This is the ONLY
61
- * surface `Query.archetypes`, `Query.forEach`, and `ChangedQuery.forEach`
62
- * hand to callers — the concrete `Archetype` (with its structural mutators
63
- * `removeEntity`, `moveEntityFrom`, `writeFields`, `setEdge`, and the
64
- * mutable `getColumn`) stays internal so query iteration can't bypass the
65
- * deferred-flush path that prevents iterator invalidation. This is the same
66
- * back door PR #163 closed for `Store`; issue #378 closed it again for
67
- * `Query`.
68
- *
69
- * `id` is the archetype's opaque identity (not a mutator) — exposed so the
70
- * public `ECS.batchAddComponent`/`batchRemoveComponent` API can target an
71
- * archetype without the caller holding a concrete `Archetype` reference.
72
- */
73
- export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = readonly ComponentDef<any>[]> {
74
- /** Opaque archetype identity. Pass to `ECS.batch_*_component`. */
75
- readonly id: ArchetypeID;
76
- /** Number of **enabled** entities — the default-iteration bound (#577). Rows
77
- * `0..entityCount-1` are enabled; disabled rows (if any) sit contiguously at
78
- * `entityCount..totalCount-1`. `forEach` SoA loops read this, so they skip
79
- * disabled rows for free. Use `totalCount` to span disabled rows too. */
80
- readonly entityCount: number;
81
- /** Total live rows, enabled + disabled (#577). Equal to `entityCount` unless
82
- * some rows are disabled. Use for full-state work (serialization, snapshot,
83
- * determinism) that must see every entity regardless of enabled state. */
84
- readonly totalCount: number;
85
- /** Number of disabled rows = `totalCount - entityCount` (#577). */
86
- readonly disabledCount: number;
87
- /** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
88
- * 0..totalCount-1 (enabled rows first, then disabled). */
89
- readonly entityIds: ReadonlyEntityIDArray;
90
- /** True if this archetype's mask includes the given component. */
91
- hasComponent(id: ComponentID): boolean;
92
- /** Get a single field's column (read-only). Valid data: indices
93
- * 0..entityCount-1. `def` must be a term of the iterating query
94
- * (POLISH_AUDIT #6); the bare-`ArchetypeView` default stays permissive. */
95
- getColumnRead<D extends ComponentDef<any>, K extends string & keyof SchemaOf<D>>(def: D & DeclaredQueryTerm<Defs, D>, field: K): ReadonlyColumn;
96
- /** Tuple fetch of several of one component's columns —
97
- * `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")`. One small
98
- * array allocation per call; see the class doc on `Archetype`. */
99
- getColumnsRead<D extends ComponentDef<any>, const K extends readonly (string & keyof SchemaOf<D>)[]>(def: D & DeclaredQueryTerm<Defs, D>, ...fields: K): {
100
- [I in keyof K]: ReadonlyColumn;
101
- };
102
- /** Get a single field's column **if this archetype has the component**,
103
- * else `undefined` — the optional-query fetch-if-present accessor (#575).
104
- * The absent branch is expected (resolve the column pointer per archetype
105
- * span: present ⇒ column, absent ⇒ `undefined`), not an error. Same
106
- * advisory-readonly view and `reads`-access-check as `getColumnRead`. */
107
- getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
108
- }
109
62
  export declare class Archetype implements ArchetypeView {
110
63
  readonly id: ArchetypeID;
111
64
  readonly mask: BitSet;
@@ -113,114 +66,220 @@ export declare class Archetype implements ArchetypeView {
113
66
  /**
114
67
  * Whether a member entity occupies a real row here. True for every archetype
115
68
  * except the **empty archetype** (the one with no components), where a
116
- * component-less entity is "alive but unplaced" it points here via
117
- * `entityArchetype` but carries `entityRow === UNASSIGNED` and holds no
69
+ * component-less entity is "alive but unplaced". It points here via
70
+ * `_entityArchetypes` but carries `_entityRows === UNASSIGNED` and holds no
118
71
  * row, exactly like a freshly `createEntity`'d one. Keeping the empty
119
72
  * archetype rowless gives a component-less entity a single canonical form
120
73
  * regardless of how it got there (created bare vs. lost its last component),
121
- * so `stateHash` and zero-require query iteration don't depend on add/remove
74
+ * so `stateHash` and zero-require query iteration don't depend on add and remove
122
75
  * history. The row-materialising methods below honour this flag.
123
76
  */
124
77
  readonly materializesRows: boolean;
125
78
  private readonly _entityIds;
126
79
  length: number;
127
80
  /**
128
- * Enabled/disabled row partition (#577 entity enable/disable). Rows
81
+ * Enabled and disabled row partition (entity enable and disable). Rows
129
82
  * `[0, enabled_count)` are enabled, `[enabled_count, length)` are disabled.
130
- * `enabled_count === length` (no disabled rows) is the common case every
83
+ * `enabled_count === length` (no disabled rows) is the common case, every
131
84
  * fast path below short-circuits on it, so an archetype that never disables
132
- * an entity pays nothing. Disable/enable swap a row across the boundary
133
- * (`disableRow`/`enableRow`); appends place enabled rows in front of the
134
- * disabled tail (`_placeTail`). `entityCount` (the query/iteration bound)
135
- * returns this; `length`/`totalCount` span disabled rows too. Folded into
136
- * `stateHash` and published to the SAB descriptor so the WASM sim and
137
- * snapshot/restore honour it.
85
+ * an entity pays nothing. Disable and enable swap a row across the boundary
86
+ * (`disableRow` and `enableRow`). An append places an enabled row in front of
87
+ * the disabled tail (`_placeTail`). `entityCount` (the query and iteration bound)
88
+ * returns this. `length` and `totalCount` span disabled rows too. Folded into
89
+ * `stateHash` and published to the SAB descriptor so a compute backend and
90
+ * snapshot and restore honour it.
138
91
  */
139
92
  enabledCount: number;
140
93
  /**
141
94
  * Flush-epoch stamp + captured pre-counts for the Store's per-entity flush
142
- * 0-crossing detector (#328, #812): `_flushAdds`/`_flushRemoves` stamp each
95
+ * 0-crossing detector: `_flushAdds` and `_flushRemoves` stamp each
143
96
  * archetype on first sight per flush (a few field accesses) instead of probing
144
- * a `Map<archetype_id, pre_count>` per entity the same per-entity Map
145
- * cost the destroy drain shed in #457. Both `_flushPreLen` and
146
- * `_flushPreEnabled` are recorded so the settle pass can detect a 0-crossing
147
- * on either the total (`length`) or the enabled partition (`enabledCount`)
148
- * an enabled append into an all-disabled archetype crosses only the latter
149
- * (#812). Owned by Store; pure scheduling bookkeeping, never folded into
97
+ * a `Map<archetype_id, pre_count>` per entity, the same per-entity Map
98
+ * cost the destroy drain also avoids. Both `flushPreLen` and
99
+ * `flushPreEnabled` are recorded so the settle pass can detect a 0-crossing
100
+ * on either the total (`length`) or the enabled partition (`enabledCount`),
101
+ * an enabled append into an all-disabled archetype crosses only the latter.
102
+ * Owned by Store. Pure scheduling bookkeeping, never folded into
150
103
  * `stateHash`/snapshot.
151
104
  */
152
- _flushSeenEpoch: number;
153
- _flushPreLen: number;
154
- _flushPreEnabled: number;
105
+ flushSeenEpoch: number;
106
+ flushPreLen: number;
107
+ flushPreEnabled: number;
155
108
  /**
156
- * DEV-only iteration guard: >0 while a dense query iterator (`forEach` /
157
- * `eachChunk` / `forEachUntil` / `ChangedQuery.forEach`) is delivering this
158
- * archetype to a user callback. The row-removing/reordering primitives
159
- * (`removeRow` / `disableRow` / `enableRow`) check it so an immediate
160
- * structural mutation from inside the walk which would swap-remove under
161
- * the iterator and silently skip or repeat entities throws instead.
109
+ * DEV-only iteration guard: >0 while a dense query iterator delivers this
110
+ * archetype to a user callback. Those iterators are `forEach`,
111
+ * `forEachChunk`, `some` and `ChangedQuery.forEach`. The row-removing and
112
+ * reordering primitives `removeRow`, `disableRow` and `enableRow` check it, so an immediate
113
+ * structural mutation from inside the walk, which would swap-remove under
114
+ * the iterator and silently skip or repeat entities, throws instead.
162
115
  * Production builds never read or write it.
163
116
  */
164
- _iterDepth: number;
165
- private readonly edges;
117
+ iterDepth: number;
118
+ private readonly _edges;
166
119
  /**
167
120
  * Cache of pre-computed transition maps for multi-component transitions
168
- * (this → target). Single-component edges live on `edges[].addMap`/`removeMap`;
169
- * multi-component pairs land here. Entries never need invalidation
121
+ * (this → target). Single-component edges live on `_edges[].addMap` and `removeMap`
122
+ * multi-component pairs land here. Entries never need invalidation,
170
123
  * archetypes live for the Store's lifetime.
171
124
  */
172
- private readonly batchTransitionMaps;
125
+ private readonly _batchTransitionMaps;
173
126
  /**
174
- * Per-set add-edge cache for `Store.addComponents` (#659), keyed by an
127
+ * Per-set add-edge cache for `Store.addComponents`, keyed by an
175
128
  * exact pack of the added component ids. Lazily allocated: most archetypes
176
129
  * never originate a plural add, so the Map stays `null` until the first one
177
- * is resolved the single-add `edges[]` path never touches it.
130
+ * is resolved, the single-add `_edges[]` path never touches it.
178
131
  */
179
- private compositeAddEdges;
180
- readonly _flatColumns: ColumnBacking<AnyTypedArray>[];
132
+ private _compositeAddEdges;
133
+ readonly flatColumns: ColumnBacking<AnyTypedArray>[];
134
+ bufs: AnyTypedArray[];
135
+ private _widthBufs;
136
+ readonly rowTicks: (Uint32Array | undefined)[];
137
+ private _tickBufs;
138
+ private _tickCids;
139
+ private _colKind;
140
+ private _allF64;
141
+ private _eids;
142
+ private _rowCap;
143
+ private _colCap;
181
144
  /** Set by `fromColumnStore` to record which SAB archetype this Archetype
182
145
  * draws its column views from. `null` for the default heap-backed path
183
- * (no SAB linkage; `refreshViews` would be a no-op there and so
146
+ * (no SAB linkage, `refreshViews` would be a no-op there and so
184
147
  * isn't supported). */
185
148
  private _storeArchetypeId;
186
- readonly _colOffset: number[];
187
- readonly _fieldCount: number[];
149
+ readonly colOffset: number[];
150
+ readonly fieldCount: number[];
188
151
  private readonly _fieldIndex;
189
152
  private readonly _fieldNames;
190
- readonly columnGroups: (ArchetypeColumnGroup | undefined)[];
191
- readonly _columnIds: number[];
192
- readonly _changedTick: number[];
153
+ readonly accessorColumns: (AccessorColumns | undefined)[];
154
+ private readonly _fieldGid;
155
+ readonly columnIds: number[];
156
+ readonly changedTick: number[];
193
157
  private readonly _mutGroupCache;
194
158
  private readonly _readGroupCache;
195
159
  /** Host-installed grow hook. Set by `Store` on every SAB-backed
196
- * archetype during construction; `null` on heap-backed archetypes (the
160
+ * archetype during construction. `null` on heap-backed archetypes (the
197
161
  * default `GrowableTypedArray` grows in place). Insertion methods call
198
162
  * `_invoke_grow(...)` below before any push that would overflow the
199
- * current SAB row capacity. (#171 §6.1.9 Phase 3) */
163
+ * current SAB row capacity. */
200
164
  growHandler: ArchetypeGrowHandler | null;
201
165
  constructor(id: ArchetypeID, mask: BitSet, layouts?: ArchetypeColumnLayout[], initialCapacity?: number, columnFactory?: ColumnFactory);
166
+ /** Row `from` of `src` → row `to` here. `map[i]` is the source column of
167
+ * column `i`, or negative when the source has no such column. Such a column
168
+ * gets `0`. Both planes are width-canonical, and a shared column has one
169
+ * width on both sides, so the copy is a bit copy. */
170
+ private _copyRowFrom;
171
+ /** A row's ticks travel with the row across a transition, so a record made
172
+ * before the move still drains after it. A component the source lacks gets
173
+ * 0: the add is structural, and `onAdd` reports it. Cold: reached only when
174
+ * this archetype carries a tick plane. */
175
+ private _copyTicksFrom;
176
+ /** Give `cid` a row tick column, the row grain of an entity-level `onSet`.
177
+ * No-op for a component this archetype lacks, for a tag (no field, so no
178
+ * write to record), and when the column exists. Cold: registration of an
179
+ * observer, and the birth of an archetype while one is registered. */
180
+ installTicks(cid: number): void;
181
+ /** Forget every record. A restore replaces the rows under the plane, so a
182
+ * tick that survived it would name a write that never happened. */
183
+ resetTicks(): void;
184
+ /** Grow each tick column to `_rowCap` and place the plane after the data
185
+ * columns in `rowBufs`. Called by `_syncRowPlane`, after it settled the
186
+ * capacity, and only when a plane exists. */
187
+ private _syncTicks;
188
+ /** Row `from` → row `to`, every column. The swap-remove fill. */
189
+ private _moveRow;
190
+ /** Exchange rows `a` and `b`, every column. */
191
+ private _swapRow;
192
+ /** `0` into row `row`, every column. */
193
+ private _zeroRow;
194
+ /** `bits[i]` into row `row` of column `i`, every column, through the
195
+ * width-canonical plane. `bits` must come from `widthBits`, so each entry is
196
+ * already the column's stored representation and no conversion remains. The
197
+ * single-append primitive behind `spawn`. */
198
+ private _writeRowBits;
199
+ /** Re-derive the `bufs`, `_eids` and `_rowCap` row plane from the backing
200
+ * columns. The sole writer of all three, see the `bufs` field doc for the
201
+ * invariant it restores. Cold: construction, `refreshViews`, tail of a grow. */
202
+ private _syncRowPlane;
203
+ /** Re-point every cached `forEachChunk` column group at the current `bufs`.
204
+ *
205
+ * Called only from `_syncRowPlane`, which is the only thing that can change a
206
+ * column's buffer identity, so after this runs, a cached group is correct by
207
+ * construction, and `columnGroupMut` and `columnGroupRead` need no staleness test
208
+ * at all. That absence is the point: those two run once per archetype per
209
+ * `forEachChunk` pass, which for a fragmented query is once per chunk, and this
210
+ * file already carries one hard-won lesson (`_onArchShrink`): one more
211
+ * statement pushed that per-mutation function past V8's inlining budget, and
212
+ * it became much slower. We measured two earlier forms of this optimisation
213
+ * and rejected both for the same cause. A fill through a shared helper made
214
+ * fragmented iteration slower, and an inline test for a stale buffer also made
215
+ * it slower. Each loss was larger than the gain in system dispatch. Move the
216
+ * work to the cold path, and the gain stays with no loss.
217
+ *
218
+ * Refreshes in place, preserving object identity, for the same reason
219
+ * `_syncRowPlane` refills `bufs` in place: a caller that captured the group
220
+ * sees fresh buffers rather than silently stale ones. */
221
+ private _refreshColumnCaches;
222
+ /** DEV-only: assert the row plane still addresses the live buffers.
223
+ *
224
+ * `bufs` and `_eids` and `flatColumns[i].buf` and `_entityIds.buf` are two paths to
225
+ * one buffer, and only the first is cached, the row ops index the cache while
226
+ * `getColumnRead` and `writeFields` read `.buf` fresh. Anything that changes a
227
+ * buffer's identity owes a `_syncRowPlane`. Miss one and the two paths split
228
+ * silently, with row writes landing in an orphan that later reads never see.
229
+ *
230
+ * Checked at the boundaries that read `.buf` directly, and O(1): index 0 alone
231
+ * is enough, because `_syncRowPlane` rewrites every entry together. There is
232
+ * no way to desync one column and not the first. */
233
+ private _assertRowPlaneFresh;
234
+ /** Make room for `additional` more rows, growing if the append would
235
+ * overflow. Replaces the `this.length >= cols[0].buf.length` probe the append
236
+ * paths each open-coded, that read a column object and its buffer's length
237
+ * on every single-row append. This is one compare against a cached number.
238
+ *
239
+ * Every append path calls this, and the spawn path calls it first so it can
240
+ * reserve capacity before it commits an entity slot. A cap grow throws here,
241
+ * with the world untouched, instead of mid-append after the slot is live.
242
+ * See `Store.spawn` and `spawnMany`.
243
+ *
244
+ * Both backings are handled by `_growRows` so callers don't branch: a
245
+ * SAB-backed archetype delegates to the store's `growHandler` (realloc +
246
+ * republish, which re-enters `refreshViews`), a heap-backed one
247
+ * (`growHandler === null`, the unit-test factory) grows each column in place.
248
+ * Either way the buffers may have moved, so the row plane is re-synced before
249
+ * returning, including when the grow throws. */
250
+ reserveRows(additional: number): void;
251
+ /** Cold half of `reserveRows`: the append genuinely doesn't fit, so grow.
252
+ * Never called on the fast path, see the caller. */
253
+ private _growRows;
254
+ /** Push `Archetype.length` down into each column's own logical length (and
255
+ * the entity-id array's). The row plane keeps `length` authoritative and never
256
+ * touches `_len`, so the columns' view of it goes stale between publishes.
257
+ * Nothing on the ECS hot paths reads it. The boundaries that do, a
258
+ * reallocating `reserve`, `refreshView`'s shrink check, `view()`,
259
+ * publish first. */
260
+ private _publishRowCounts;
202
261
  /**
203
262
  * Build an Archetype whose columns are TypedArray views into a single
204
263
  * `ColumnStore`-managed `SharedArrayBuffer`. The store must contain an
205
264
  * archetype entry whose id equals `storeArchetypeId` and whose columns
206
265
  * cover every `(component_id, fieldIdx)` pair declared by `layouts`.
207
266
  *
208
- * The resulting archetype is fixed-capacity at the SAB row capacity
267
+ * The resulting archetype is fixed-capacity at the SAB row capacity,
209
268
  * any operation that would push past it throws `StoreColumnOverflowError`.
210
269
  * To grow capacity, call `growColumnStore(...)` between ticks and then
211
- * `refreshViews(newStore)` on this archetype (#171 §6.1.4 / §8.1).
270
+ * `refreshViews(newStore)` on this archetype.
212
271
  */
213
272
  static fromColumnStore(id: ArchetypeID, mask: BitSet, layouts: ArchetypeColumnLayout[], columnStore: ColumnStore, storeArchetypeId: number): Archetype;
214
273
  /** True iff this archetype was constructed via `fromColumnStore` and its
215
- * `_flatColumns` are SAB-backed. Heap-backed archetypes return `false`
274
+ * `flatColumns` are SAB-backed. Heap-backed archetypes return `false`
216
275
  * and cannot be refreshed (their columns grow in place). */
217
276
  get isBufferBacked(): boolean;
218
277
  /**
219
278
  * Repoint every column at the matching SAB view in `newColumnStore` after
220
279
  * a host-side `growColumnStore` realloc. The archetype keeps its row
221
- * count; each column's logical length is preserved. Caller is responsible
280
+ * count. Each column's logical length is preserved. Caller is responsible
222
281
  * for ensuring `newColumnStore` was built by `growColumnStore` over the
223
- * SAB this archetype was originally drawn from the matching
282
+ * SAB this archetype was originally drawn from, the matching
224
283
  * `storeArchetypeId` was recorded in `fromColumnStore` and is reused here.
225
284
  *
226
285
  * Throws `ECSError` if this archetype is not SAB-backed, or if the new
@@ -228,42 +287,42 @@ export declare class Archetype implements ArchetypeView {
228
287
  * expects.
229
288
  */
230
289
  refreshViews(newColumnStore: ColumnStore): void;
231
- /** Enabled-row count the default iteration bound (#577). See `enabled_count`.
290
+ /** Enabled-row count, the default iteration bound. See `enabled_count`.
232
291
  * Equals `length` whenever no entity is disabled (the common case).
233
292
  *
234
293
  * During an `includeDisabled()` query's `forEach`, the module flag
235
- * `_iterAllRows` is set so this returns `length` (enabled + disabled) the
294
+ * `iterAllRows` is set so this returns `length` (enabled + disabled), the
236
295
  * user's `for i < arch.entityCount` loop then spans disabled rows
237
296
  * transparently, with no change to the loop. Outside such iteration the flag is
238
297
  * false and this is `enabled_count`. */
239
298
  get entityCount(): number;
240
- /** Total live rows incl. disabled (#577). */
299
+ /** Total live rows incl. disabled. */
241
300
  get totalCount(): number;
242
- /** Disabled-row count (#577). */
301
+ /** Disabled-row count. */
243
302
  get disabledCount(): number;
244
303
  /** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
245
304
  * 0..totalCount-1 (enabled rows first, then disabled). */
246
305
  get entityIds(): ReadonlyEntityIDArray;
247
306
  /**
248
- * Swap the two rows `a` and `b` entity ids and every column. Does NOT touch
249
- * `entityRow`; the caller updates the entity→row map for whichever rows it
307
+ * Swap the two rows `a` and `b`, entity ids and every column. Does not touch
308
+ * `entityRows`. The caller updates the entity→row map for whichever rows it
250
309
  * cares about (it knows the two `entityIds` after the swap). The partition
251
- * primitives (`disableRow`/`enableRow`/`removeRow`/`_placeTail`) build on
310
+ * primitives (`disableRow`, `enableRow`, `removeRow` and `_placeTail`) build on
252
311
  * this. Writes through each column's live backing buffer (`buf`), so it works
253
- * for both heap- and SAB-backed columns. No-op when `a === b`. (#577) */
312
+ * for both heap- and SAB-backed columns. No-op when `a === b`. */
254
313
  swapRows(a: number, b: number): void;
255
314
  /**
256
- * Place a freshly-appended ENABLED entity (currently at the tail row `tail`,
315
+ * Place a freshly-appended enabled entity (currently at the tail row `tail`,
257
316
  * already pushed, `length` already incremented) into the enabled region, and
258
317
  * bump `enabled_count`. Returns its final row.
259
318
  *
260
- * Common case no disabled rows (`enabled_count === tail`): the tail row IS
261
- * the next enabled slot, so this is just `enabled_count++` and returns `tail`
262
- * (byte-for-byte the pre-#577 behaviour, `entityRow` untouched). Rare case
319
+ * Common case, no disabled rows (`enabled_count === tail`): the tail row is
320
+ * the next enabled slot, so this is only `enabled_count++` and returns `tail`
321
+ * (byte-for-byte the earlier behaviour, `entityRows` untouched). Rare case,
263
322
  * disabled rows occupy `[enabled_count, tail)`: swap the appended row into the
264
323
  * first disabled slot and push that disabled occupant to the tail, updating
265
- * its `entityRow`. Requires `entityRow` in that case (a `DEV` guard fires
266
- * if a caller appends into a disabled-bearing archetype without passing it). (#577) */
324
+ * its `entityRows`. Requires `entityRows` in that case (a `DEV` guard fires
325
+ * if a caller appends into a disabled-bearing archetype without passing it). */
267
326
  private _placeTail;
268
327
  /**
269
328
  * Bulk analog of `_placeTail` for `count` freshly-appended enabled rows at
@@ -271,64 +330,66 @@ export declare class Archetype implements ArchetypeView {
271
330
  * start`): `enabled_count += count`, return `start`. The bulk callers
272
331
  * (`spawnMany`, batch ops) fall back to a per-entity append loop when the
273
332
  * target already has disabled rows, so the rare branch is a `DEV` guard
274
- * rather than a block-rotation. (#577) */
333
+ * rather than a block-rotation. */
275
334
  private _placeTailBulk;
276
335
  /**
277
336
  * Disable the entity at `row` (precondition: enabled, `row < enabled_count`).
278
337
  * Swaps it to the end of the enabled region and shrinks the region, so it
279
- * lands in the disabled tail with its data intact no archetype transition,
280
- * O(1)+one row swap. Updates `entityRow` for both rows touched. (#577) */
281
- disableRow(row: number, entityRow: Int32Array): void;
338
+ * lands in the disabled tail with its data intact, no archetype transition,
339
+ * O(1)+one row swap. Updates `entityRows` for both rows touched. */
340
+ disableRow(row: number, entityRows: Int32Array): void;
282
341
  /**
283
342
  * Enable the entity at `row` (precondition: disabled, `row >= enabled_count`).
284
343
  * Swaps it to the front of the disabled region and grows the enabled region.
285
- * Updates `entityRow` for both rows touched. (#577) */
286
- enableRow(row: number, entityRow: Int32Array): void;
344
+ * Updates `entityRows` for both rows touched. */
345
+ enableRow(row: number, entityRows: Int32Array): void;
287
346
  /**
288
- * Partition-aware swap-remove that owns its `entityRow` updates (#577). The
289
- * Store's destroy/move paths call this instead of `removeEntity`; it keeps the
347
+ * Partition-aware swap-remove that owns its `entityRows` updates. The
348
+ * Store's destroy and move paths call this instead of `swapRemoveRow`. It keeps the
290
349
  * enabled prefix contiguous in every case:
291
350
  * - disabled row (`row >= enabled_count`): swap-remove within the disabled
292
- * tail (the last row is disabled) `enabled_count` unchanged.
293
- * - last enabled row: swap-remove with the global last; `enabled_count--`.
351
+ * tail (the last row is disabled), `enabled_count` unchanged.
352
+ * - last enabled row: swap-remove with the global last. `enabled_count--`.
294
353
  * - middle enabled row: move the last enabled row into the hole (so the
295
354
  * enabled prefix stays packed), then swap-remove that vacated enabled slot
296
- * with the global last; `enabled_count--`.
297
- * Updates `entityRow` for every relocated entity (never for the removed one
298
- * the caller frees/repoints it). */
299
- removeRow(row: number, entityRow: Int32Array): void;
300
- /** @internal cold partition-aware tail of `removeRow` (#577): the
355
+ * with the global last. `enabled_count--`.
356
+ * Updates `entityRows` for every relocated entity (never for the removed one,
357
+ * the caller frees and repoints it). */
358
+ removeRow(row: number, entityRows: Int32Array): void;
359
+ /** @internal, cold partition-aware tail of `removeRow`: the
301
360
  * disabled-bearing archetype case. Split out so the no-disabled fast path
302
- * above stays small enough to inline (#649); see the doc on `removeRow`. */
361
+ * above stays small enough to inline. See the doc on `removeRow`. */
303
362
  private _removeRowPartitioned;
304
- get entityList(): Uint32Array;
363
+ /** The entity ids of the live rows, bounded by `length`. `entityIds` returns
364
+ * the same buffer at its full capacity, so a walk uses this one. */
365
+ get rowEntityIds(): Uint32Array;
305
366
  hasComponent(id: ComponentID): boolean;
306
367
  matches(required: BitSet): boolean;
307
368
  /**
308
- * Get a single field's column (read-only use when not mutating). Valid
369
+ * Get a single field's column (read-only, use when not mutating). Valid
309
370
  * data: indices 0..entityCount-1. The `ReadonlyColumn` return is an
310
371
  * *advisory* compile-time barrier: it is the live mutable backing buffer,
311
372
  * so the `readonly` index signature blocks writes at the type layer only
312
- * (a §10c-policed cast can still write through). For writes use the
313
- * mutable `getColumn` (tick-bumping) below.
373
+ * (a deliberate cast can still write through). For writes use the
374
+ * mutable `getColumnMut` (tick-bumping) below.
314
375
  */
315
376
  getColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn;
316
377
  /**
317
- * Tuple fetch of several of one component's columns
378
+ * Tuple fetch of several of one component's columns,
318
379
  * `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")` collapses the
319
380
  * per-field `getColumnRead` preamble at the top of an iteration callback
320
381
  * to one line. Same advisory-readonly views and `reads` access-check as
321
- * `getColumnRead`. Allocates one small array per call fine once per
322
- * archetype per tick; in a per-row loop fetch columns individually.
382
+ * `getColumnRead`. Allocates one small array per call, fine once per
383
+ * archetype per tick. In a per-row loop fetch columns individually.
323
384
  */
324
385
  getColumnsRead<S extends ComponentSchema, const K extends readonly (string & keyof S)[]>(def: ComponentDef<S>, ...fields: K): {
325
386
  [I in keyof K]: ReadonlyColumn;
326
387
  };
327
388
  /**
328
389
  * Get a single field's column **if this archetype has the component**, else
329
- * `undefined` the fetch-if-present accessor for optional query terms (#575,
330
- * Bevy `Option<&T>` / flecs `?`). An optional query (`q.optional(T)`) spans
331
- * archetypes both with and without `T`; the caller branches once per
390
+ * `undefined`, the fetch-if-present accessor for optional query terms
391
+ * (Bevy `Option<&T>`, flecs `?`). An optional query (`q.optional(T)`) spans
392
+ * archetypes both with and without `T`. The caller branches once per
332
393
  * archetype span on the return:
333
394
  *
334
395
  * q.forEach((arch) => {
@@ -342,23 +403,23 @@ export declare class Archetype implements ArchetypeView {
342
403
  * **absent** branch, not a thrown error. The `DEV` checks still run
343
404
  * **first** (before the absent short-circuit), so the requirements don't
344
405
  * depend on whether the current span happens to hold `T`. Two checks fire:
345
- * (1) `accessCheck.checkRead` an optional read needs `reads:[T]` coverage
346
- * exactly as a required read does; (2) `accessCheck.checkOptionalFetch` —
347
- * the iterating query must have declared `.optional(T)` (#592), the read-side
406
+ * (1) `accessCheck.assertRead`, an optional read needs `reads:[T]` coverage
407
+ * exactly as a required read does, and (2) `accessCheck.assertOptionalFetch`,
408
+ * the iterating query must have declared `.optional(T)`, the read-side
348
409
  * analog that makes the query term the fetch's authorization rather than inert
349
410
  * decoration. The return is the same advisory-readonly view `getColumnRead`
350
411
  * hands back.
351
412
  */
352
413
  getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
353
- /** Get a single field's column (mutable the default). Marks the component as changed at the given tick. */
354
- getColumn<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K, tick: number): TagToTypedArray[S[K]];
355
- /** Mutable field-keyed column group; stamps the change tick once. */
414
+ /** Get a single field's column (mutable, the default). Marks the component as changed at the given tick. */
415
+ getColumnMut<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K, tick: number): TagToTypedArray[S[K]];
416
+ /** Mutable field-keyed column group. Stamps the change tick once. */
356
417
  columnGroupMut<S extends ComponentSchema>(def: ComponentDef<S>, tick: number): MutableColumnsForSchema<S>;
357
418
  /** Read-only field-keyed column group (no tick bump). */
358
419
  columnGroupRead<S extends ComponentSchema>(def: ComponentDef<S>): ColumnsForSchema<S>;
359
420
  writeFields(row: number, componentId: ComponentID, values: Record<string, number>, tick: number): void;
360
421
  /**
361
- * Bulk variant of `writeFields` fills `count` consecutive rows starting
422
+ * Bulk variant of `writeFields`, fills `count` consecutive rows starting
362
423
  * at `dstStart` with the same field values via per-field `TypedArray.fill`.
363
424
  * For N rows of an F-field component, this is F native fill calls instead
364
425
  * of N×F per-row JS writes. The change-tick is bumped once for the range,
@@ -375,67 +436,74 @@ export declare class Archetype implements ArchetypeView {
375
436
  * Add an entity. Pushes zeroes into all columns and returns the assigned row.
376
437
  * Store is responsible for tracking entityIndex → row.
377
438
  */
378
- addEntity(entityId: EntityID, entityRow?: Int32Array): number;
439
+ addEntity(entityId: EntityID, entityRows?: Int32Array): number;
379
440
  /**
380
441
  * Remove entity at row via swap-and-pop. Swaps the last entity into the
381
442
  * vacated row to keep data dense. Returns the entityIndex of the swapped
382
443
  * entity (so Store can update its row), or NO_SWAP if no swap was needed.
383
444
  */
384
- removeEntity(row: number): number;
445
+ swapRemoveRow(row: number): number;
385
446
  /** Tag-optimized add: skip column push entirely (no data to store). */
386
- addEntityTag(entityId: EntityID, entityRow?: Int32Array): number;
447
+ addEntityTag(entityId: EntityID, entityRows?: Int32Array): number;
387
448
  /**
388
449
  * Bulk add `count` entities, zero-initialising all columns. Returns the
389
450
  * starting dstRow for the batch. Caller is responsible for tracking
390
451
  * entityIndex → row for every entity in the batch.
391
452
  *
392
- * Collapses the N×C `push(0)` cost of N sequential `addEntity` calls
393
- * into C `bulkAppendZeroes(count)` calls the same pattern
394
- * `bulkMoveAllFrom` (`:580`) uses for the move-with-data case (#330).
453
+ * Collapses the N×C per-element cost of N sequential `addEntity` calls into
454
+ * C `fill` calls, one for each column, the same pattern `bulkMoveAllFrom`
455
+ * uses for the move-with-data case.
395
456
  */
396
457
  addEntities(entityIds: Uint32Array, count?: number): number;
397
458
  /** Tag-optimized bulk add: skip the per-column zero-fill entirely. */
398
459
  addEntitiesTag(entityIds: Uint32Array, count?: number): number;
399
- /** Grow column capacity to fit `additional` more rows if the next append
400
- * would overflow the exact grow trigger the `addEntityWithValues` /
401
- * `addEntitiesWithValues` appends run internally, lifted out so the spawn
402
- * path can pre-reserve capacity BEFORE it commits an entity slot. A SAB-cap
403
- * grow throws here (with the world untouched) instead of mid-append after the
404
- * slot is already live see `Store.spawn`/`spawnMany` (#775). No-op for a
405
- * tag-only archetype (no SAB columns) or when no grow handler is installed. */
406
- ensureRowCapacity(additional: number): void;
407
- /** Append one entity, writing `flatValues[i]` straight into column `i`
408
- * (in `_flatColumns` order) no zero-fill-then-overwrite. Bumps every
409
- * column's change tick once. Returns the assigned row. */
410
- addEntityWithValues(entityId: EntityID, flatValues: number[], tick: number, entityRow?: Int32Array): number;
460
+ /** Append one entity, writing `flatBits[i]` straight into column `i` (in
461
+ * `flatColumns` order), no zero-fill-then-overwrite. Bumps every column's
462
+ * change tick once. Returns the assigned row. `flatBits` must come from
463
+ * `widthBits`: each entry is already the column's stored representation, so
464
+ * the write is a bit copy through the width-canonical plane, with no
465
+ * conversion and no call for each column type. A template resolves its
466
+ * defaults into bits one time, so every `spawn` from it takes this path. */
467
+ addEntityWithBits(entityId: EntityID, flatBits: Float64Array, tick: number, entityRows?: Int32Array): number;
468
+ /** Convert `flatValues` (in `flatColumns` order) to the stored bit
469
+ * pattern of each column, as the width-canonical view represents it
470
+ * (`toWidthBits`). The result is what `addEntityWithBits` writes. A
471
+ * `Float64Array`, so the append reads each entry with no hole test and no
472
+ * unboxing. Every bit pattern is an integer below 2^32 or an `f64`, and
473
+ * both are exact in it. */
474
+ widthBits(flatValues: number[]): Float64Array;
475
+ /** Write one value into row `row` of flat column `idx`, converting as the
476
+ * column's type converts, through the access site of that type. The
477
+ * per-instance override path of `spawn`. */
478
+ writeFlatElem(idx: number, row: number, value: number): void;
411
479
  /** Bulk append `count` entities, filling column `i` with `flatValues[i]`
412
480
  * in a single `TypedArray.fill` per column (no zero pass). Returns the
413
481
  * starting row. */
414
482
  addEntitiesWithValues(entityIds: Uint32Array, count: number, flatValues: number[], tick: number): number;
415
- /** Tag-optimized remove via swap-and-pop: skip column swap/pop entirely. */
416
- removeEntityTag(row: number): number;
483
+ /** Tag-optimized remove via swap-and-pop: skip column swap and pop entirely. */
484
+ swapRemoveRowTag(row: number): number;
417
485
  /**
418
486
  * Move an entity from src archetype into this archetype in a single pass.
419
- * Combines addEntity + copySharedFrom + removeEntity(src).
487
+ * Combines addEntity + copySharedFrom + swapRemoveRow(src).
420
488
  * Uses a pre-computed transition map for branchless column copy.
421
489
  * Writes dstRow to _moveResult[0], swapped entity index to _moveResult[1].
422
490
  */
423
- moveEntityFrom(src: Archetype, srcRow: number, entityId: EntityID, transitionMap: Int16Array, tick: number, entityRow: Int32Array): void;
491
+ moveEntityFrom(src: Archetype, srcRow: number, entityId: EntityID, transitionMap: Int16Array, tick: number, entityRows: Int32Array): void;
424
492
  /**
425
493
  * Move an entity from src into this archetype (tag-only: no columns to copy).
426
- * Writes dstRow to _moveResult[0]; _moveResult[1] is always NO_SWAP (the
427
- * partition-aware src/dst updates are owned internally, #577).
494
+ * Writes dstRow to _moveResult[0]. _moveResult[1] is always NO_SWAP (the
495
+ * partition-aware src/dst updates are owned internally).
428
496
  */
429
- moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRow: Int32Array): void;
497
+ moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRows: Int32Array): void;
430
498
  /**
431
- * Bulk-move ALL entities from src into this archetype using TypedArray.set().
499
+ * Bulk-move all entities from src into this archetype using TypedArray.set().
432
500
  * Much faster than per-entity moveEntityFrom when the entire source is moving.
433
501
  * After this call, src is empty. Returns the starting dstRow for the batch.
434
502
  */
435
503
  bulkMoveAllFrom(src: Archetype, transitionMap: Int16Array, tick: number): number;
436
504
  /**
437
- * Drop every row at once length → 0, entity-id list and all columns
438
- * cleared without copying into a destination. Used when an archetype's
505
+ * Drop every row at once, length → 0, entity-id list and all columns
506
+ * cleared, without copying into a destination. Used when an archetype's
439
507
  * entire population leaves in one move: `bulkMoveAllFrom` clears the
440
508
  * source this way, and `Store.batchRemoveComponent` calls it directly when
441
509
  * the destination is the rowless empty archetype (batch-removing the last
@@ -444,16 +512,16 @@ export declare class Archetype implements ArchetypeView {
444
512
  clearRows(): void;
445
513
  /**
446
514
  * Re-derive the host-side row bookkeeping after a snapshot is mounted onto a
447
- * live world (#789, `Store.restoreInto`). A snapshot reloads the column bytes
448
- * (dense SAB) but NOT the host-side `length` / `enabledCount` / `_entityIds`
449
- * back-reference those are reconstructed here. `refreshViews` must have
515
+ * live world (`Store.restore`). A snapshot reloads the column bytes
516
+ * (dense SAB) but not the host-side `length`, `enabledCount` and `_entityIds`
517
+ * back-reference, those are reconstructed here. `refreshViews` must have
450
518
  * already repointed the columns at the restored SAB.
451
519
  *
452
520
  * The caller scans the restored entity-index region to learn which entity
453
521
  * occupies each row and passes them in row order (`rowEntityIds[r]` is the
454
- * packed `EntityID` at row `r`; rows `[0, length)` are dense, enabled rows
455
- * first then disabled per the #577 partition). `enabledCount` is the restored
456
- * partition boundary. This is the inverse of the per-row `addEntity` /
522
+ * packed `EntityID` at row `r`. Rows `[0, length)` are dense, enabled rows
523
+ * first then disabled per the partition). `enabledCount` is the restored
524
+ * partition boundary. This is the inverse of the per-row `addEntity` and
457
525
  * `disableRow` bookkeeping the live run accumulated.
458
526
  */
459
527
  restoreHostRows(rowEntityIds: readonly number[], enabledCount: number): void;
@@ -461,19 +529,20 @@ export declare class Archetype implements ArchetypeView {
461
529
  setEdge(componentId: ComponentID, edge: ArchetypeEdge): void;
462
530
  /**
463
531
  * Get the transition map from this archetype to `target`, building and caching
464
- * it on miss. Used by Store.addComponents / removeComponents the per-edge
465
- * cache only covers single-component steps.
532
+ * it on miss. `Store.addComponents` and `Store.removeComponents` use it. The
533
+ * per-edge cache only covers single-component steps.
466
534
  */
467
- getBatchTransitionMap(target: Archetype): Int16Array;
468
- /** Look up a cached plural-add transition by its packed key (#659). Returns
535
+ transitionMapTo(target: Archetype): Int16Array;
536
+ /** Look up a cached plural-add transition by its packed key. Returns
469
537
  * `undefined` until the first composite add out of this archetype plants the
470
- * lazy Map the common case for archetypes that only ever see single adds. */
538
+ * lazy Map, the common case for archetypes that only ever see single adds. */
471
539
  getCompositeAddEdge(key: number): CompositeAddEdge | undefined;
472
540
  /** Cache a resolved plural-add transition (target + src→target map) under its
473
- * packed key (#659), allocating the backing Map on first use. */
541
+ * packed key, allocating the backing Map on first use. */
474
542
  cacheCompositeAddEdge(key: number, target: ArchetypeID, map: Int16Array): void;
475
543
  }
476
- /** Reusable result buffer for move_entity_from/move_entity_from_tag. [dstRow, swapped_index] */
544
+ /** Reusable result buffer for `moveEntityFrom` and `moveEntityFromTag`.
545
+ * `[dstRow, swappedIndex]`. */
477
546
  export declare const _moveResult: [number, number];
478
547
  export declare function _setIterAllRows(value: boolean): boolean;
479
548
  /**
@@ -481,6 +550,5 @@ export declare function _setIterAllRows(value: boolean): boolean;
481
550
  * For each column in dst, stores the index of the corresponding column in src,
482
551
  * or -1 if the column is new (no source).
483
552
  */
484
- export declare function buildTransitionMap(src: Archetype, dst: Archetype): Int16Array;
485
- export {};
553
+ export declare function createTransitionMap(src: Archetype, dst: Archetype): Int16Array;
486
554
  //# sourceMappingURL=archetype.d.ts.map