@oasys/oecs 0.5.4 → 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 +1223 -266
  2. package/README.md +217 -112
  3. package/dist/core/ecs/access_check.d.cts +29 -29
  4. package/dist/core/ecs/access_check.d.ts +29 -29
  5. package/dist/core/ecs/access_check.d.ts.map +1 -1
  6. package/dist/core/ecs/archetype.d.cts +217 -209
  7. package/dist/core/ecs/archetype.d.ts +217 -209
  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 +33 -33
  13. package/dist/core/ecs/archetype_graph.d.ts +33 -33
  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 +26 -26
  28. package/dist/core/ecs/command_log.d.ts +26 -26
  29. package/dist/core/ecs/command_log.d.ts.map +1 -1
  30. package/dist/core/ecs/component.d.cts +43 -42
  31. package/dist/core/ecs/component.d.ts +43 -42
  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 +289 -270
  46. package/dist/core/ecs/ecs.d.ts +289 -270
  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 +20 -18
  57. package/dist/core/ecs/entity_allocator.d.ts +20 -18
  58. package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
  59. package/dist/core/ecs/event.d.cts +36 -22
  60. package/dist/core/ecs/event.d.ts +36 -22
  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 +32 -32
  69. package/dist/core/ecs/frame_trace.d.ts +32 -32
  70. package/dist/core/ecs/frame_trace.d.ts.map +1 -1
  71. package/dist/core/ecs/host_commands.d.cts +103 -85
  72. package/dist/core/ecs/host_commands.d.ts +103 -85
  73. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  74. package/dist/core/ecs/index.d.cts +21 -11
  75. package/dist/core/ecs/index.d.ts +21 -11
  76. package/dist/core/ecs/index.d.ts.map +1 -1
  77. package/dist/core/ecs/observer.d.cts +39 -120
  78. package/dist/core/ecs/observer.d.ts +39 -120
  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 +208 -578
  90. package/dist/core/ecs/query.d.ts +208 -578
  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 +100 -39
  102. package/dist/core/ecs/ref.d.ts +100 -39
  103. package/dist/core/ecs/ref.d.ts.map +1 -1
  104. package/dist/core/ecs/relation.d.cts +101 -182
  105. package/dist/core/ecs/relation.d.ts +101 -182
  106. package/dist/core/ecs/relation.d.ts.map +1 -1
  107. package/dist/core/ecs/resource.d.cts +13 -13
  108. package/dist/core/ecs/resource.d.ts +13 -13
  109. package/dist/core/ecs/resource_registry.d.cts +5 -5
  110. package/dist/core/ecs/resource_registry.d.ts +5 -5
  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 +91 -120
  119. package/dist/core/ecs/schedule.d.ts +91 -120
  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 +108 -51
  131. package/dist/core/ecs/sparse_store.d.ts +108 -51
  132. package/dist/core/ecs/sparse_store.d.ts.map +1 -1
  133. package/dist/core/ecs/store.d.cts +527 -473
  134. package/dist/core/ecs/store.d.ts +527 -473
  135. package/dist/core/ecs/store.d.ts.map +1 -1
  136. package/dist/core/ecs/store_layout_listener.d.cts +6 -6
  137. package/dist/core/ecs/store_layout_listener.d.ts +6 -6
  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 +146 -61
  142. package/dist/core/ecs/system.d.ts +146 -61
  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 +82 -6
  154. package/dist/core/ecs/utils/error.d.ts +82 -6
  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 +44 -44
  163. package/dist/core/store/action_ring.d.ts +44 -44
  164. package/dist/core/store/action_ring.d.ts.map +1 -1
  165. package/dist/core/store/allocator.d.cts +149 -95
  166. package/dist/core/store/allocator.d.ts +149 -95
  167. package/dist/core/store/allocator.d.ts.map +1 -1
  168. package/dist/core/store/buffer_backed_column.d.cts +17 -17
  169. package/dist/core/store/buffer_backed_column.d.ts +17 -17
  170. package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
  171. package/dist/core/store/column_store.d.cts +124 -86
  172. package/dist/core/store/column_store.d.ts +124 -86
  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 +36 -39
  178. package/dist/core/store/command_ring.d.ts +36 -39
  179. package/dist/core/store/command_ring.d.ts.map +1 -1
  180. package/dist/core/store/descriptor.d.cts +34 -17
  181. package/dist/core/store/descriptor.d.ts +34 -17
  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 +36 -38
  187. package/dist/core/store/event_ring.d.ts +36 -38
  188. package/dist/core/store/event_ring.d.ts.map +1 -1
  189. package/dist/core/store/extend.d.cts +13 -7
  190. package/dist/core/store/extend.d.ts +13 -7
  191. package/dist/core/store/extend.d.ts.map +1 -1
  192. package/dist/core/store/grow.d.cts +2 -2
  193. package/dist/core/store/grow.d.ts +2 -2
  194. package/dist/core/store/grow.d.ts.map +1 -1
  195. package/dist/core/store/header.d.cts +31 -27
  196. package/dist/core/store/header.d.ts +31 -27
  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 +71 -62
  202. package/dist/core/store/layout_ops.d.ts +71 -62
  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 +12 -12
  211. package/dist/core/store/state_hash.d.ts +12 -12
  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 +15 -10
  225. package/dist/index.d.ts +15 -10
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.development.cjs +1 -1
  228. package/dist/index.development.js +5804 -5203
  229. package/dist/index.js +5323 -4764
  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 +54 -54
  244. package/dist/{extensions → plugins}/editor/editor.d.ts +54 -54
  245. package/dist/plugins/editor/editor.d.ts.map +1 -0
  246. package/dist/{extensions → plugins}/editor/field_handle.d.cts +12 -12
  247. package/dist/{extensions → plugins}/editor/field_handle.d.ts +12 -12
  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} +81 -64
  257. package/dist/{extensions/editor/index.js → plugins/editor.js} +81 -64
  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 +85 -97
  302. package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +85 -97
  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 +16 -15
  411. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +16 -15
  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 +3 -3
  415. package/dist/version.d.ts +3 -3
  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-BlR3oZ3x.js +0 -2406
  465. package/dist/host_commands-C2cpU3yC.cjs +0 -1
  466. package/dist/internal-BoxWl4dG.js +0 -2565
  467. package/dist/internal-CGBEwfeB.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-Bs39EPh1.js +0 -150
  502. package/dist/shallow-C5YmTbtb.cjs +0 -1
  503. package/dist/shallow-CiFC70Dz.js +0 -159
  504. package/dist/shallow-DQ8aG51_.cjs +0 -1
  505. package/dist/shared-B4v0L1cw.js +0 -109
  506. package/dist/shared-DU78k0pU.cjs +0 -1
  507. package/dist/topological_sort-BDvEyb9W.cjs +0 -1
  508. package/dist/topological_sort-DK6EjpWa.js +0 -135
  509. package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
  510. package/dist/typed_arrays-DIVwVy5_.js +0 -258
@@ -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`.
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,78 +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
+ * 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
56
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 that is closed for `Store` and closed again for `Query`.
67
- *
68
- * `id` is the archetype's opaque identity (not a mutator) — exposed so the
69
- * public `ECS.batchAddComponent`/`batchRemoveComponent` API can target an
70
- * archetype without the caller holding a concrete `Archetype` reference.
71
- */
72
- export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = readonly ComponentDef<any>[]> {
73
- /** Opaque archetype identity. Pass to `ECS.batch_*_component`. */
74
- readonly id: ArchetypeID;
75
- /** Number of **enabled** entities — the default-iteration bound. Rows
76
- * `0..entityCount-1` are enabled; disabled rows (if any) sit contiguously at
77
- * `entityCount..totalCount-1`. `forEach` SoA loops read this, so they skip
78
- * disabled rows for free. Use `totalCount` to span disabled rows too. */
79
- readonly entityCount: number;
80
- /** Total live rows, enabled + disabled. Equal to `entityCount` unless
81
- * some rows are disabled. Use for full-state work (serialization, snapshot,
82
- * determinism) that must see every entity regardless of enabled state. */
83
- readonly totalCount: number;
84
- /** Number of disabled rows = `totalCount - entityCount`. */
85
- readonly disabledCount: number;
86
- /** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
87
- * 0..totalCount-1 (enabled rows first, then disabled). */
88
- readonly entityIds: ReadonlyEntityIDArray;
89
- /** True if this archetype's mask includes the given component. */
90
- hasComponent(id: ComponentID): boolean;
91
- /** Get a single field's column (read-only). Valid data: indices
92
- * 0..entityCount-1. `def` must be a term of the iterating query
93
- *; the bare-`ArchetypeView` default stays permissive. */
94
- getColumnRead<D extends ComponentDef<any>, K extends string & keyof SchemaOf<D>>(def: D & DeclaredQueryTerm<Defs, D>, field: K): ReadonlyColumn;
95
- /** Tuple fetch of several of one component's columns —
96
- * `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")`. One small
97
- * array allocation per call; see the class doc on `Archetype`. */
98
- getColumnsRead<D extends ComponentDef<any>, const K extends readonly (string & keyof SchemaOf<D>)[]>(def: D & DeclaredQueryTerm<Defs, D>, ...fields: K): {
99
- [I in keyof K]: ReadonlyColumn;
100
- };
101
- /** Get a single field's column **if this archetype has the component**,
102
- * else `undefined` — the optional-query fetch-if-present accessor.
103
- * The absent branch is expected (resolve the column pointer per archetype
104
- * span: present ⇒ column, absent ⇒ `undefined`), not an error. Same
105
- * advisory-readonly view and `reads`-access-check as `getColumnRead`. */
106
- getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
107
- }
108
62
  export declare class Archetype implements ArchetypeView {
109
63
  readonly id: ArchetypeID;
110
64
  readonly mask: BitSet;
@@ -112,108 +66,148 @@ export declare class Archetype implements ArchetypeView {
112
66
  /**
113
67
  * Whether a member entity occupies a real row here. True for every archetype
114
68
  * except the **empty archetype** (the one with no components), where a
115
- * component-less entity is "alive but unplaced" it points here via
116
- * `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
117
71
  * row, exactly like a freshly `createEntity`'d one. Keeping the empty
118
72
  * archetype rowless gives a component-less entity a single canonical form
119
73
  * regardless of how it got there (created bare vs. lost its last component),
120
- * 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
121
75
  * history. The row-materialising methods below honour this flag.
122
76
  */
123
77
  readonly materializesRows: boolean;
124
78
  private readonly _entityIds;
125
79
  length: number;
126
80
  /**
127
- * Enabled/disabled row partition (entity enable/disable). Rows
81
+ * Enabled and disabled row partition (entity enable and disable). Rows
128
82
  * `[0, enabled_count)` are enabled, `[enabled_count, length)` are disabled.
129
- * `enabled_count === length` (no disabled rows) is the common case every
83
+ * `enabled_count === length` (no disabled rows) is the common case, every
130
84
  * fast path below short-circuits on it, so an archetype that never disables
131
- * an entity pays nothing. Disable/enable swap a row across the boundary
132
- * (`disableRow`/`enableRow`); appends place enabled rows in front of the
133
- * disabled tail (`_placeTail`). `entityCount` (the query/iteration bound)
134
- * returns this; `length`/`totalCount` span disabled rows too. Folded into
135
- * `stateHash` and published to the SAB descriptor so the WASM sim and
136
- * 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.
137
91
  */
138
92
  enabledCount: number;
139
93
  /**
140
94
  * Flush-epoch stamp + captured pre-counts for the Store's per-entity flush
141
- * 0-crossing detector: `_flushAdds`/`_flushRemoves` stamp each
95
+ * 0-crossing detector: `_flushAdds` and `_flushRemoves` stamp each
142
96
  * archetype on first sight per flush (a few field accesses) instead of probing
143
- * a `Map<archetype_id, pre_count>` per entity the same per-entity Map
144
- * cost the destroy drain also avoids. Both `_flushPreLen` and
145
- * `_flushPreEnabled` are recorded so the settle pass can detect a 0-crossing
146
- * on either the total (`length`) or the enabled partition (`enabledCount`)
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`),
147
101
  * an enabled append into an all-disabled archetype crosses only the latter.
148
- * Owned by Store; pure scheduling bookkeeping, never folded into
102
+ * Owned by Store. Pure scheduling bookkeeping, never folded into
149
103
  * `stateHash`/snapshot.
150
104
  */
151
- _flushSeenEpoch: number;
152
- _flushPreLen: number;
153
- _flushPreEnabled: number;
105
+ flushSeenEpoch: number;
106
+ flushPreLen: number;
107
+ flushPreEnabled: number;
154
108
  /**
155
- * DEV-only iteration guard: >0 while a dense query iterator (`forEach` /
156
- * `eachChunk` / `forEachUntil` / `ChangedQuery.forEach`) is delivering this
157
- * archetype to a user callback. The row-removing/reordering primitives
158
- * (`removeRow` / `disableRow` / `enableRow`) check it so an immediate
159
- * structural mutation from inside the walk which would swap-remove under
160
- * 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.
161
115
  * Production builds never read or write it.
162
116
  */
163
- _iterDepth: number;
164
- private readonly edges;
117
+ iterDepth: number;
118
+ private readonly _edges;
165
119
  /**
166
120
  * Cache of pre-computed transition maps for multi-component transitions
167
- * (this → target). Single-component edges live on `edges[].addMap`/`removeMap`;
168
- * 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,
169
123
  * archetypes live for the Store's lifetime.
170
124
  */
171
- private readonly batchTransitionMaps;
125
+ private readonly _batchTransitionMaps;
172
126
  /**
173
127
  * Per-set add-edge cache for `Store.addComponents`, keyed by an
174
128
  * exact pack of the added component ids. Lazily allocated: most archetypes
175
129
  * never originate a plural add, so the Map stays `null` until the first one
176
- * is resolved the single-add `edges[]` path never touches it.
130
+ * is resolved, the single-add `_edges[]` path never touches it.
177
131
  */
178
- private compositeAddEdges;
179
- readonly _flatColumns: ColumnBacking<AnyTypedArray>[];
180
- _bufs: 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;
181
141
  private _eids;
182
142
  private _rowCap;
183
143
  private _colCap;
184
144
  /** Set by `fromColumnStore` to record which SAB archetype this Archetype
185
145
  * draws its column views from. `null` for the default heap-backed path
186
- * (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
187
147
  * isn't supported). */
188
148
  private _storeArchetypeId;
189
- readonly _colOffset: number[];
190
- readonly _fieldCount: number[];
149
+ readonly colOffset: number[];
150
+ readonly fieldCount: number[];
191
151
  private readonly _fieldIndex;
192
152
  private readonly _fieldNames;
193
- readonly columnGroups: (ArchetypeColumnGroup | undefined)[];
194
- readonly _columnIds: number[];
195
- readonly _changedTick: number[];
153
+ readonly accessorColumns: (AccessorColumns | undefined)[];
154
+ private readonly _fieldGid;
155
+ readonly columnIds: number[];
156
+ readonly changedTick: number[];
196
157
  private readonly _mutGroupCache;
197
158
  private readonly _readGroupCache;
198
159
  /** Host-installed grow hook. Set by `Store` on every SAB-backed
199
- * archetype during construction; `null` on heap-backed archetypes (the
160
+ * archetype during construction. `null` on heap-backed archetypes (the
200
161
  * default `GrowableTypedArray` grows in place). Insertion methods call
201
162
  * `_invoke_grow(...)` below before any push that would overflow the
202
163
  * current SAB row capacity. */
203
164
  growHandler: ArchetypeGrowHandler | null;
204
165
  constructor(id: ArchetypeID, mask: BitSet, layouts?: ArchetypeColumnLayout[], initialCapacity?: number, columnFactory?: ColumnFactory);
205
- /** Re-derive the `_bufs` / `_eids` / `_rowCap` row plane from the backing
206
- * columns. The sole writer of all three see the `_bufs` field doc for the
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
207
201
  * invariant it restores. Cold: construction, `refreshViews`, tail of a grow. */
208
202
  private _syncRowPlane;
209
- /** Re-point every cached `eachChunk` column group at the current `_bufs`.
203
+ /** Re-point every cached `forEachChunk` column group at the current `bufs`.
210
204
  *
211
205
  * Called only from `_syncRowPlane`, which is the only thing that can change a
212
- * column's buffer identity so after this runs, a cached group is correct by
213
- * construction and `columnGroupMut` / `columnGroupRead` need no staleness test
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
214
208
  * at all. That absence is the point: those two run once per archetype per
215
- * `eachChunk` pass, which for a fragmented query is once per chunk, and this
216
- * file already carries one hard-won lesson (`_onArchLenChange`): one more
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
217
211
  * statement pushed that per-mutation function past V8's inlining budget, and
218
212
  * it became much slower. We measured two earlier forms of this optimisation
219
213
  * and rejected both for the same cause. A fill through a shared helper made
@@ -222,41 +216,46 @@ export declare class Archetype implements ArchetypeView {
222
216
  * work to the cold path, and the gain stays with no loss.
223
217
  *
224
218
  * Refreshes in place, preserving object identity, for the same reason
225
- * `_syncRowPlane` refills `_bufs` in place: a caller that captured the group
219
+ * `_syncRowPlane` refills `bufs` in place: a caller that captured the group
226
220
  * sees fresh buffers rather than silently stale ones. */
227
- private _refreshGroupCaches;
221
+ private _refreshColumnCaches;
228
222
  /** DEV-only: assert the row plane still addresses the live buffers.
229
223
  *
230
- * `_bufs`/`_eids` and `_flatColumns[i].buf`/`_entityIds.buf` are two paths to
231
- * one buffer, and only the first is cached the row ops index the cache while
232
- * `getColumnRead` / `writeFields` read `.buf` fresh. Anything that changes a
233
- * buffer's identity owes a `_syncRowPlane`; miss one and the two paths split
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
234
228
  * silently, with row writes landing in an orphan that later reads never see.
235
229
  *
236
230
  * Checked at the boundaries that read `.buf` directly, and O(1): index 0 alone
237
- * is enough, because `_syncRowPlane` rewrites every entry together there is
231
+ * is enough, because `_syncRowPlane` rewrites every entry together. There is
238
232
  * no way to desync one column and not the first. */
239
233
  private _assertRowPlaneFresh;
240
234
  /** Make room for `additional` more rows, growing if the append would
241
235
  * overflow. Replaces the `this.length >= cols[0].buf.length` probe the append
242
- * paths each open-coded that read a column object and its buffer's length
243
- * on every single-row append; this is one compare against a cached number.
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`.
244
243
  *
245
244
  * Both backings are handled by `_growRows` so callers don't branch: a
246
245
  * SAB-backed archetype delegates to the store's `growHandler` (realloc +
247
246
  * republish, which re-enters `refreshViews`), a heap-backed one
248
247
  * (`growHandler === null`, the unit-test factory) grows each column in place.
249
248
  * Either way the buffers may have moved, so the row plane is re-synced before
250
- * returning including when the grow throws. */
251
- private _reserveRows;
252
- /** Cold half of `_reserveRows`: the append genuinely doesn't fit, so grow.
253
- * Never called on the fast path see the caller. */
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. */
254
253
  private _growRows;
255
254
  /** Push `Archetype.length` down into each column's own logical length (and
256
255
  * the entity-id array's). The row plane keeps `length` authoritative and never
257
256
  * touches `_len`, so the columns' view of it goes stale between publishes.
258
- * Nothing on the ECS hot paths reads it; the boundaries that DO a
259
- * reallocating `ensureCapacity`, `refreshView`'s shrink check, `view()` —
257
+ * Nothing on the ECS hot paths reads it. The boundaries that do, a
258
+ * reallocating `reserve`, `refreshView`'s shrink check, `view()`,
260
259
  * publish first. */
261
260
  private _publishRowCounts;
262
261
  /**
@@ -265,22 +264,22 @@ export declare class Archetype implements ArchetypeView {
265
264
  * archetype entry whose id equals `storeArchetypeId` and whose columns
266
265
  * cover every `(component_id, fieldIdx)` pair declared by `layouts`.
267
266
  *
268
- * The resulting archetype is fixed-capacity at the SAB row capacity
267
+ * The resulting archetype is fixed-capacity at the SAB row capacity,
269
268
  * any operation that would push past it throws `StoreColumnOverflowError`.
270
269
  * To grow capacity, call `growColumnStore(...)` between ticks and then
271
270
  * `refreshViews(newStore)` on this archetype.
272
271
  */
273
272
  static fromColumnStore(id: ArchetypeID, mask: BitSet, layouts: ArchetypeColumnLayout[], columnStore: ColumnStore, storeArchetypeId: number): Archetype;
274
273
  /** True iff this archetype was constructed via `fromColumnStore` and its
275
- * `_flatColumns` are SAB-backed. Heap-backed archetypes return `false`
274
+ * `flatColumns` are SAB-backed. Heap-backed archetypes return `false`
276
275
  * and cannot be refreshed (their columns grow in place). */
277
276
  get isBufferBacked(): boolean;
278
277
  /**
279
278
  * Repoint every column at the matching SAB view in `newColumnStore` after
280
279
  * a host-side `growColumnStore` realloc. The archetype keeps its row
281
- * count; each column's logical length is preserved. Caller is responsible
280
+ * count. Each column's logical length is preserved. Caller is responsible
282
281
  * for ensuring `newColumnStore` was built by `growColumnStore` over the
283
- * SAB this archetype was originally drawn from the matching
282
+ * SAB this archetype was originally drawn from, the matching
284
283
  * `storeArchetypeId` was recorded in `fromColumnStore` and is reused here.
285
284
  *
286
285
  * Throws `ECSError` if this archetype is not SAB-backed, or if the new
@@ -288,11 +287,11 @@ export declare class Archetype implements ArchetypeView {
288
287
  * expects.
289
288
  */
290
289
  refreshViews(newColumnStore: ColumnStore): void;
291
- /** Enabled-row count the default iteration bound. See `enabled_count`.
290
+ /** Enabled-row count, the default iteration bound. See `enabled_count`.
292
291
  * Equals `length` whenever no entity is disabled (the common case).
293
292
  *
294
293
  * During an `includeDisabled()` query's `forEach`, the module flag
295
- * `_iterAllRows` is set so this returns `length` (enabled + disabled) the
294
+ * `iterAllRows` is set so this returns `length` (enabled + disabled), the
296
295
  * user's `for i < arch.entityCount` loop then spans disabled rows
297
296
  * transparently, with no change to the loop. Outside such iteration the flag is
298
297
  * false and this is `enabled_count`. */
@@ -305,24 +304,24 @@ export declare class Archetype implements ArchetypeView {
305
304
  * 0..totalCount-1 (enabled rows first, then disabled). */
306
305
  get entityIds(): ReadonlyEntityIDArray;
307
306
  /**
308
- * Swap the two rows `a` and `b` entity ids and every column. Does NOT touch
309
- * `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
310
309
  * cares about (it knows the two `entityIds` after the swap). The partition
311
- * primitives (`disableRow`/`enableRow`/`removeRow`/`_placeTail`) build on
310
+ * primitives (`disableRow`, `enableRow`, `removeRow` and `_placeTail`) build on
312
311
  * this. Writes through each column's live backing buffer (`buf`), so it works
313
312
  * for both heap- and SAB-backed columns. No-op when `a === b`. */
314
313
  swapRows(a: number, b: number): void;
315
314
  /**
316
- * 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`,
317
316
  * already pushed, `length` already incremented) into the enabled region, and
318
317
  * bump `enabled_count`. Returns its final row.
319
318
  *
320
- * Common case no disabled rows (`enabled_count === tail`): the tail row IS
321
- * the next enabled slot, so this is just `enabled_count++` and returns `tail`
322
- * (byte-for-byte the earlier 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,
323
322
  * disabled rows occupy `[enabled_count, tail)`: swap the appended row into the
324
323
  * first disabled slot and push that disabled occupant to the tail, updating
325
- * its `entityRow`. Requires `entityRow` in that case (a `DEV` guard fires
324
+ * its `entityRows`. Requires `entityRows` in that case (a `DEV` guard fires
326
325
  * if a caller appends into a disabled-bearing archetype without passing it). */
327
326
  private _placeTail;
328
327
  /**
@@ -336,59 +335,61 @@ export declare class Archetype implements ArchetypeView {
336
335
  /**
337
336
  * Disable the entity at `row` (precondition: enabled, `row < enabled_count`).
338
337
  * Swaps it to the end of the enabled region and shrinks the region, so it
339
- * lands in the disabled tail with its data intact no archetype transition,
340
- * O(1)+one row swap. Updates `entityRow` for both rows touched. */
341
- 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;
342
341
  /**
343
342
  * Enable the entity at `row` (precondition: disabled, `row >= enabled_count`).
344
343
  * Swaps it to the front of the disabled region and grows the enabled region.
345
- * Updates `entityRow` for both rows touched. */
346
- enableRow(row: number, entityRow: Int32Array): void;
344
+ * Updates `entityRows` for both rows touched. */
345
+ enableRow(row: number, entityRows: Int32Array): void;
347
346
  /**
348
- * Partition-aware swap-remove that owns its `entityRow` updates. The
349
- * 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
350
349
  * enabled prefix contiguous in every case:
351
350
  * - disabled row (`row >= enabled_count`): swap-remove within the disabled
352
- * tail (the last row is disabled) `enabled_count` unchanged.
353
- * - 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--`.
354
353
  * - middle enabled row: move the last enabled row into the hole (so the
355
354
  * enabled prefix stays packed), then swap-remove that vacated enabled slot
356
- * with the global last; `enabled_count--`.
357
- * Updates `entityRow` for every relocated entity (never for the removed one
358
- * the caller frees/repoints it). */
359
- removeRow(row: number, entityRow: Int32Array): void;
360
- /** @internal cold partition-aware tail of `removeRow`: 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
361
360
  * disabled-bearing archetype case. Split out so the no-disabled fast path
362
- * above stays small enough to inline; see the doc on `removeRow`. */
361
+ * above stays small enough to inline. See the doc on `removeRow`. */
363
362
  private _removeRowPartitioned;
364
- 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;
365
366
  hasComponent(id: ComponentID): boolean;
366
367
  matches(required: BitSet): boolean;
367
368
  /**
368
- * 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
369
370
  * data: indices 0..entityCount-1. The `ReadonlyColumn` return is an
370
371
  * *advisory* compile-time barrier: it is the live mutable backing buffer,
371
372
  * so the `readonly` index signature blocks writes at the type layer only
372
373
  * (a deliberate cast can still write through). For writes use the
373
- * mutable `getColumn` (tick-bumping) below.
374
+ * mutable `getColumnMut` (tick-bumping) below.
374
375
  */
375
376
  getColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn;
376
377
  /**
377
- * Tuple fetch of several of one component's columns
378
+ * Tuple fetch of several of one component's columns,
378
379
  * `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")` collapses the
379
380
  * per-field `getColumnRead` preamble at the top of an iteration callback
380
381
  * to one line. Same advisory-readonly views and `reads` access-check as
381
- * `getColumnRead`. Allocates one small array per call fine once per
382
- * 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.
383
384
  */
384
385
  getColumnsRead<S extends ComponentSchema, const K extends readonly (string & keyof S)[]>(def: ComponentDef<S>, ...fields: K): {
385
386
  [I in keyof K]: ReadonlyColumn;
386
387
  };
387
388
  /**
388
389
  * Get a single field's column **if this archetype has the component**, else
389
- * `undefined` the fetch-if-present accessor for optional query terms
390
- * (Bevy `Option<&T>` / flecs `?`). An optional query (`q.optional(T)`) spans
391
- * 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
392
393
  * archetype span on the return:
393
394
  *
394
395
  * q.forEach((arch) => {
@@ -402,23 +403,23 @@ export declare class Archetype implements ArchetypeView {
402
403
  * **absent** branch, not a thrown error. The `DEV` checks still run
403
404
  * **first** (before the absent short-circuit), so the requirements don't
404
405
  * depend on whether the current span happens to hold `T`. Two checks fire:
405
- * (1) `accessCheck.checkRead` an optional read needs `reads:[T]` coverage
406
- * exactly as a required read does; (2) `accessCheck.checkOptionalFetch` —
406
+ * (1) `accessCheck.assertRead`, an optional read needs `reads:[T]` coverage
407
+ * exactly as a required read does, and (2) `accessCheck.assertOptionalFetch`,
407
408
  * the iterating query must have declared `.optional(T)`, the read-side
408
409
  * analog that makes the query term the fetch's authorization rather than inert
409
410
  * decoration. The return is the same advisory-readonly view `getColumnRead`
410
411
  * hands back.
411
412
  */
412
413
  getOptionalColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn | undefined;
413
- /** Get a single field's column (mutable the default). Marks the component as changed at the given tick. */
414
- getColumn<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K, tick: number): TagToTypedArray[S[K]];
415
- /** 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. */
416
417
  columnGroupMut<S extends ComponentSchema>(def: ComponentDef<S>, tick: number): MutableColumnsForSchema<S>;
417
418
  /** Read-only field-keyed column group (no tick bump). */
418
419
  columnGroupRead<S extends ComponentSchema>(def: ComponentDef<S>): ColumnsForSchema<S>;
419
420
  writeFields(row: number, componentId: ComponentID, values: Record<string, number>, tick: number): void;
420
421
  /**
421
- * Bulk variant of `writeFields` fills `count` consecutive rows starting
422
+ * Bulk variant of `writeFields`, fills `count` consecutive rows starting
422
423
  * at `dstStart` with the same field values via per-field `TypedArray.fill`.
423
424
  * For N rows of an F-field component, this is F native fill calls instead
424
425
  * of N×F per-row JS writes. The change-tick is bumped once for the range,
@@ -435,67 +436,74 @@ export declare class Archetype implements ArchetypeView {
435
436
  * Add an entity. Pushes zeroes into all columns and returns the assigned row.
436
437
  * Store is responsible for tracking entityIndex → row.
437
438
  */
438
- addEntity(entityId: EntityID, entityRow?: Int32Array): number;
439
+ addEntity(entityId: EntityID, entityRows?: Int32Array): number;
439
440
  /**
440
441
  * Remove entity at row via swap-and-pop. Swaps the last entity into the
441
442
  * vacated row to keep data dense. Returns the entityIndex of the swapped
442
443
  * entity (so Store can update its row), or NO_SWAP if no swap was needed.
443
444
  */
444
- removeEntity(row: number): number;
445
+ swapRemoveRow(row: number): number;
445
446
  /** Tag-optimized add: skip column push entirely (no data to store). */
446
- addEntityTag(entityId: EntityID, entityRow?: Int32Array): number;
447
+ addEntityTag(entityId: EntityID, entityRows?: Int32Array): number;
447
448
  /**
448
449
  * Bulk add `count` entities, zero-initialising all columns. Returns the
449
450
  * starting dstRow for the batch. Caller is responsible for tracking
450
451
  * entityIndex → row for every entity in the batch.
451
452
  *
452
453
  * Collapses the N×C per-element cost of N sequential `addEntity` calls into
453
- * C `fill` calls, one for each column the same pattern `bulkMoveAllFrom`
454
+ * C `fill` calls, one for each column, the same pattern `bulkMoveAllFrom`
454
455
  * uses for the move-with-data case.
455
456
  */
456
457
  addEntities(entityIds: Uint32Array, count?: number): number;
457
458
  /** Tag-optimized bulk add: skip the per-column zero-fill entirely. */
458
459
  addEntitiesTag(entityIds: Uint32Array, count?: number): number;
459
- /** Grow column capacity to fit `additional` more rows if the next append
460
- * would overflow the exact grow trigger the `addEntityWithValues` /
461
- * `addEntitiesWithValues` appends run internally, lifted out so the spawn
462
- * path can pre-reserve capacity BEFORE it commits an entity slot. A SAB-cap
463
- * grow throws here (with the world untouched) instead of mid-append after the
464
- * slot is already live see `Store.spawn`/`spawnMany`. Now just the
465
- * public name for `_reserveRows`, which every append path shares. */
466
- ensureRowCapacity(additional: number): void;
467
- /** Append one entity, writing `flatValues[i]` straight into column `i`
468
- * (in `_flatColumns` order) no zero-fill-then-overwrite. Bumps every
469
- * column's change tick once. Returns the assigned row. */
470
- 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;
471
479
  /** Bulk append `count` entities, filling column `i` with `flatValues[i]`
472
480
  * in a single `TypedArray.fill` per column (no zero pass). Returns the
473
481
  * starting row. */
474
482
  addEntitiesWithValues(entityIds: Uint32Array, count: number, flatValues: number[], tick: number): number;
475
- /** Tag-optimized remove via swap-and-pop: skip column swap/pop entirely. */
476
- removeEntityTag(row: number): number;
483
+ /** Tag-optimized remove via swap-and-pop: skip column swap and pop entirely. */
484
+ swapRemoveRowTag(row: number): number;
477
485
  /**
478
486
  * Move an entity from src archetype into this archetype in a single pass.
479
- * Combines addEntity + copySharedFrom + removeEntity(src).
487
+ * Combines addEntity + copySharedFrom + swapRemoveRow(src).
480
488
  * Uses a pre-computed transition map for branchless column copy.
481
489
  * Writes dstRow to _moveResult[0], swapped entity index to _moveResult[1].
482
490
  */
483
- 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;
484
492
  /**
485
493
  * Move an entity from src into this archetype (tag-only: no columns to copy).
486
- * Writes dstRow to _moveResult[0]; _moveResult[1] is always NO_SWAP (the
494
+ * Writes dstRow to _moveResult[0]. _moveResult[1] is always NO_SWAP (the
487
495
  * partition-aware src/dst updates are owned internally).
488
496
  */
489
- moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRow: Int32Array): void;
497
+ moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRows: Int32Array): void;
490
498
  /**
491
- * 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().
492
500
  * Much faster than per-entity moveEntityFrom when the entire source is moving.
493
501
  * After this call, src is empty. Returns the starting dstRow for the batch.
494
502
  */
495
503
  bulkMoveAllFrom(src: Archetype, transitionMap: Int16Array, tick: number): number;
496
504
  /**
497
- * Drop every row at once length → 0, entity-id list and all columns
498
- * 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
499
507
  * entire population leaves in one move: `bulkMoveAllFrom` clears the
500
508
  * source this way, and `Store.batchRemoveComponent` calls it directly when
501
509
  * the destination is the rowless empty archetype (batch-removing the last
@@ -504,16 +512,16 @@ export declare class Archetype implements ArchetypeView {
504
512
  clearRows(): void;
505
513
  /**
506
514
  * Re-derive the host-side row bookkeeping after a snapshot is mounted onto a
507
- * live world (`Store.restoreInto`). A snapshot reloads the column bytes
508
- * (dense SAB) but NOT the host-side `length` / `enabledCount` / `_entityIds`
509
- * 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
510
518
  * already repointed the columns at the restored SAB.
511
519
  *
512
520
  * The caller scans the restored entity-index region to learn which entity
513
521
  * occupies each row and passes them in row order (`rowEntityIds[r]` is the
514
- * packed `EntityID` at row `r`; rows `[0, length)` are dense, enabled rows
522
+ * packed `EntityID` at row `r`. Rows `[0, length)` are dense, enabled rows
515
523
  * first then disabled per the partition). `enabledCount` is the restored
516
- * partition boundary. This is the inverse of the per-row `addEntity` /
524
+ * partition boundary. This is the inverse of the per-row `addEntity` and
517
525
  * `disableRow` bookkeeping the live run accumulated.
518
526
  */
519
527
  restoreHostRows(rowEntityIds: readonly number[], enabledCount: number): void;
@@ -521,19 +529,20 @@ export declare class Archetype implements ArchetypeView {
521
529
  setEdge(componentId: ComponentID, edge: ArchetypeEdge): void;
522
530
  /**
523
531
  * Get the transition map from this archetype to `target`, building and caching
524
- * it on miss. Used by Store.addComponents / removeComponents the per-edge
525
- * 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.
526
534
  */
527
- getBatchTransitionMap(target: Archetype): Int16Array;
535
+ transitionMapTo(target: Archetype): Int16Array;
528
536
  /** Look up a cached plural-add transition by its packed key. Returns
529
537
  * `undefined` until the first composite add out of this archetype plants the
530
- * 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. */
531
539
  getCompositeAddEdge(key: number): CompositeAddEdge | undefined;
532
540
  /** Cache a resolved plural-add transition (target + src→target map) under its
533
541
  * packed key, allocating the backing Map on first use. */
534
542
  cacheCompositeAddEdge(key: number, target: ArchetypeID, map: Int16Array): void;
535
543
  }
536
- /** 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]`. */
537
546
  export declare const _moveResult: [number, number];
538
547
  export declare function _setIterAllRows(value: boolean): boolean;
539
548
  /**
@@ -541,6 +550,5 @@ export declare function _setIterAllRows(value: boolean): boolean;
541
550
  * For each column in dst, stores the index of the corresponding column in src,
542
551
  * or -1 if the column is new (no source).
543
552
  */
544
- export declare function buildTransitionMap(src: Archetype, dst: Archetype): Int16Array;
545
- export {};
553
+ export declare function createTransitionMap(src: Archetype, dst: Archetype): Int16Array;
546
554
  //# sourceMappingURL=archetype.d.ts.map