@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,62 +1,60 @@
1
- import { ArchetypeView } from './archetype.cjs';
2
- import { ComponentHandle } from './component.cjs';
1
+ import { ArchetypeView } from './archetype_types.cjs';
2
+ import { ChangeFeed } from './change_feed.cjs';
3
3
  import { EntityID } from './entity.cjs';
4
4
  import { FrameTraceSink } from './frame_trace.cjs';
5
- import { SystemContext } from './query.cjs';
6
- import { StructuralObserverEvents } from './store.cjs';
5
+ import { SystemContext } from './system_context.cjs';
7
6
  import { SystemAccessDeclaration, SystemDescriptor } from './system.cjs';
8
- /** What the observer registry needs from `Store` the typed seam replacing
9
- * bare underscore-convention reach-through. `Store` implements this; the
7
+ /** What the observer registry needs from `Store`: the change feed every
8
+ * consumer shares, plus the dev-only trace sink. `Store` implements this. The
10
9
  * registry holds only this view, so the compiler bounds what observer dispatch
11
- * can touch. Underscore names are kept so `Store`'s members stay one
12
- * declaration (they read as "internal" at every other call site). */
13
- export interface ObserverHost {
14
- /** Current change tick — read for onSet baselines. */
15
- readonly _tick: number;
16
- /** Dev-only frame-trace sink (`null` when unset; always null in prod). */
17
- readonly _trace: FrameTraceSink | null;
18
- /** Sync a component's observation flags (add/remove/disable/enable/dirty). */
19
- _configureComponentObservation(cid: number, hasAdd: boolean, hasRem: boolean, hasDisable: boolean, hasEnable: boolean, trackDirty: boolean): void;
20
- /** Drain the per-entity onSet dirty list for `cid` (clears marks). */
21
- _takeDirty(cid: number): EntityID[];
22
- /** Visit archetypes whose `cid` column changed since `baseline`, in
23
- * canonical (creation-id) order. */
24
- _forEachChangedArchetype(cid: number, baseline: number, cb: (arch: ArchetypeView) => void): void;
25
- /** Every live entity currently holding `cid` (dispose-on-disable sweep). */
26
- _collectEntitiesWithComponent(cid: number): EntityID[];
27
- isAlive(id: EntityID): boolean;
28
- isDisabled(id: EntityID): boolean;
29
- hasComponent(entityId: EntityID, def: ComponentHandle): boolean;
10
+ * can touch, and the registry is one consumer of the feed among others. */
11
+ export interface ObserverHost extends ChangeFeed {
12
+ /** Dev-only frame-trace sink (`null` when unset, always null in prod). */
13
+ readonly trace: FrameTraceSink | null;
30
14
  }
31
- /** Per-entity observer callback (onAdd / onRemove / onDisable / onEnable, and
15
+ /** What the world calls into an observer registry it did not build.
16
+ *
17
+ * `ECS.update` runs `dispatchSet` at the tick-tail detection point, through
18
+ * the settle hook the install pushed. A `DEV` build reads `descriptors` once
19
+ * per frame trace. Both are cold. The structural dispatch does not appear
20
+ * here: the plugin subscribes to it through the change feed. */
21
+ export interface ObserverHooks {
22
+ /** The synthesized descriptor of each registered observer, for the access
23
+ * check and the frame trace. */
24
+ descriptors(): SystemDescriptor[];
25
+ /** Fire the `onSet` observers for the change tick `run`. */
26
+ dispatchSet(run: number): void;
27
+ }
28
+ /** Per-entity observer callback (onAdd, onRemove, onDisable and onEnable, and
32
29
  * per-entity onSet). */
33
30
  export type ObserverFn = (entityId: EntityID, ctx: SystemContext) => void;
34
- /** Archetype-granular onSet callback fires once per changed archetype-column;
35
- * the consumer iterates `arch.entityCount` rows itself. */
31
+ /** Archetype-granular onSet callback, fires once per changed archetype-column.
32
+ * The consumer iterates `arch.entityCount` rows itself. */
36
33
  export type ArchetypeObserverFn = (arch: ArchetypeView, ctx: SystemContext) => void;
37
34
  /** Fields common to every observer registration. `access` drives both the
38
- * dev-mode `accessCheck` and the access-topological firing order; it is merged
35
+ * dev-mode `accessCheck` and the access-topological firing order. It is merged
39
36
  * over an all-empty declaration, so a caller spells out only what it touches. */
40
37
  interface ObserverConfigBase {
41
38
  onAdd?: ObserverFn;
42
39
  onRemove?: ObserverFn;
43
- /** Fires when an entity carrying this component is *disabled* at the
40
+ /** Fires when an entity carrying this component is *disabled*, at the
44
41
  * deferred toggle drain, once per net transition. Mirrors `onRemove`:
45
42
  * a disable is a soft remove of the whole mask from default queries. An immediate
46
43
  * host-side `ecs.disable()` does not fire (like immediate `addComponent`). */
47
44
  onDisable?: ObserverFn;
48
45
  /** Fires when an entity carrying this component is *enabled*, symmetric
49
- * with `onDisable` / `onAdd`. */
46
+ * with `onDisable` and `onAdd`. */
50
47
  onEnable?: ObserverFn;
51
- /** Access surface the callbacks touch (reads / writes / spawns / ). Partial:
48
+ /** Access surface the callbacks touch (reads, writes, spawns and the rest). Partial:
52
49
  * merged over `_INTERNAL_EMPTY_ACCESS`. Undeclared access throws in `DEV`. */
53
50
  access?: Partial<SystemAccessDeclaration>;
54
- /** flecs-style replay of current matches on registration (onAdd only seeds the
55
- * *enabled* members; a disabled entity is simply absent, matching default-query
56
- * semantics), for order-independence of register-vs-spawn. */
51
+ /** flecs-style replay of current matches on registration, so the order of
52
+ * register and spawn does not matter. `onAdd` only, and it seeds the
53
+ * *enabled* members. A disabled entity is absent, which matches the
54
+ * default-query semantics. */
57
55
  yieldExisting?: boolean;
58
56
  /** Diagnostic label for this observer, surfaced by the frame-trace seam
59
- * as the `observer_fired.observer` field the same role a system's
57
+ * as the `observer_fired.observer` field, the same role a system's
60
58
  * `name` plays. Optional and observe-only: it never touches `stateHash` or
61
59
  * dispatch. Defaults to `observer(<component debug name>)` when the component
62
60
  * was registered with a name, else `observer(<cid>)`. */
@@ -64,7 +62,7 @@ interface ObserverConfigBase {
64
62
  }
65
63
  /** Per-entity onSet: `onSet(eid, ctx)` fires once per changed entity, drained
66
64
  * from the opt-in per-row dirty list (registering this enables dirty tracking
67
- * for the component the dirty list + dedup bit). */
65
+ * for the component, the dirty list + dedup bit). */
68
66
  export interface EntitySetObserverConfig extends ObserverConfigBase {
69
67
  onSet: ObserverFn;
70
68
  granularity: "entity";
@@ -76,98 +74,19 @@ export interface ArchetypeSetObserverConfig extends ObserverConfigBase {
76
74
  onSet: ArchetypeObserverFn;
77
75
  granularity?: "archetype";
78
76
  }
79
- /** Structural-only observer no onSet. */
77
+ /** Structural-only observer, no onSet. */
80
78
  export interface StructuralObserverConfig extends ObserverConfigBase {
81
79
  onSet?: undefined;
82
80
  granularity?: undefined;
83
81
  }
84
82
  export type ObserverConfig = StructuralObserverConfig | EntitySetObserverConfig | ArchetypeSetObserverConfig;
83
+ /** Handle returned by `ecs.observe(...)`. `dispose()` unregisters. Safe to
84
+ * call more than once. */
85
85
  export interface ObserverHandle {
86
86
  dispose(): void;
87
- /** `using h = ecs.observe(C, {...})` explicit-resource-management sugar
87
+ /** `using h = ecs.observe(C, {...})`, explicit-resource-management sugar
88
88
  * over {@link dispose} (TC39 `Symbol.dispose`). */
89
89
  [Symbol.dispose](): void;
90
90
  }
91
- /**
92
- * Registry of component observers. Owned by `ECS`; the `Store` calls back into
93
- * `dispatchStructural` between fixed-point rounds during `flushStructural`,
94
- * and `ECS.update` calls `dispatchSet` at the post-update detection point.
95
- */
96
- export declare class ObserverRegistry {
97
- private readonly store;
98
- private readonly ctx;
99
- private readonly entries;
100
- /** ComponentID → its observers (structural + onSet). */
101
- private readonly byCid;
102
- /** Cached access-topological order; invalidated on register / dispose. */
103
- private _topo;
104
- private readonly _addBuckets;
105
- private readonly _remBuckets;
106
- private readonly _disBuckets;
107
- private readonly _enaBuckets;
108
- private readonly _radixOut;
109
- private readonly _radixC0;
110
- private readonly _radixC1;
111
- private readonly _setDrainCache;
112
- constructor(store: ObserverHost, ctx: SystemContext);
113
- get count(): number;
114
- /** The synthesized `SystemDescriptor`s of every registered observer, in
115
- * registration order (`dispose()` splices entries out, so none are stale).
116
- * Fed into the `startup()` archetype-prewarm closure so an observer's declared
117
- * `spawns` / `transitions` create their target archetypes eagerly, exactly as a
118
- * system's do. Without this an observer-spawned/-transitioned archetype
119
- * first-touches lazily mid-tick — the one asymmetry left in the otherwise
120
- * uniform "no lazy archetypes" prewarm. */
121
- descriptors(): SystemDescriptor[];
122
- register(def: ComponentHandle, config: ObserverConfig): ObserverHandle;
123
- private _dispose;
124
- /** Recompute the component's hot-path observation flags from its live
125
- * observers and push them to the store (which owns the flags + fast-path
126
- * counters). */
127
- private _reconfigureComponent;
128
- private getTopo;
129
- /**
130
- * Fire onAdd / onRemove / onDisable / onEnable for one fixed-point round's
131
- * effective events, in canonical order: access-topological across observers,
132
- * entity-id order (radix) within each observer. Called by
133
- * `Store.flushStructural` after the batch commits; observer callbacks may
134
- * enqueue further structural ops (or toggles) onto the deferred buffers (the
135
- * store loops until quiescent).
136
- *
137
- * The events arrive as flat `(comp, eid)` parallel arrays collected during the
138
- * flush; we bucket by component once (O(K)), then walk observers in topo order
139
- * so a producer's writes are visible to a consumer (glitch-free). A round
140
- * carries either structural (add/rem) OR toggle (dis/ena) events, never both —
141
- * toggles drain only once add/remove/destroy are quiescent (`flushStructural`)
142
- * — but we bucket all four uniformly; the empty pairs are no-ops. Within an
143
- * observer the fire order is remove, add, disable, enable (the "leaving" edges
144
- * before the "entering" edges).
145
- */
146
- dispatchStructural(ev: StructuralObserverEvents): void;
147
- /** Radix-sort `eids` by entity index (canonical within-observer order), then
148
- * fire `fn` per entity under the observer's access scope. */
149
- private _fireEach;
150
- private _bucket;
151
- private _clearBuckets;
152
- /**
153
- * Fire onSet observers for the current tick, in canonical order. Per-entity
154
- * onSet drains the opt-in dirty list (once per changed entity); archetype-
155
- * granular onSet scans the change tick (once per changed archetype-column).
156
- * Called by `ECS.update` after all phases, with `tick === store._tick`.
157
- */
158
- dispatchSet(tick: number): void;
159
- private _dispatchSetEntity;
160
- private _dispatchSetArch;
161
- private _yieldExisting;
162
- }
163
- /**
164
- * O(K) LSD radix sort of entity ids by their 20-bit dense index (two 10-bit
165
- * passes), in place. This is the canonical within-observer order — *never* a
166
- * comparator `Array.sort`, which the bench measured as much slower than the
167
- * entire flush. Distinct live entities have distinct indices,
168
- * so index order is a total canonical order. `out` is scratch (grown to length);
169
- * `c0` / `c1` are 1024-entry histograms (reused).
170
- */
171
- export declare function radixSortByIndex(eids: number[], out: number[], c0: Int32Array, c1: Int32Array): void;
172
91
  export {};
173
92
  //# sourceMappingURL=observer.d.ts.map
@@ -1,62 +1,60 @@
1
- import { ArchetypeView } from './archetype.js';
2
- import { ComponentHandle } from './component.js';
1
+ import { ArchetypeView } from './archetype_types.js';
2
+ import { ChangeFeed } from './change_feed.js';
3
3
  import { EntityID } from './entity.js';
4
4
  import { FrameTraceSink } from './frame_trace.js';
5
- import { SystemContext } from './query.js';
6
- import { StructuralObserverEvents } from './store.js';
5
+ import { SystemContext } from './system_context.js';
7
6
  import { SystemAccessDeclaration, SystemDescriptor } from './system.js';
8
- /** What the observer registry needs from `Store` the typed seam replacing
9
- * bare underscore-convention reach-through. `Store` implements this; the
7
+ /** What the observer registry needs from `Store`: the change feed every
8
+ * consumer shares, plus the dev-only trace sink. `Store` implements this. The
10
9
  * registry holds only this view, so the compiler bounds what observer dispatch
11
- * can touch. Underscore names are kept so `Store`'s members stay one
12
- * declaration (they read as "internal" at every other call site). */
13
- export interface ObserverHost {
14
- /** Current change tick — read for onSet baselines. */
15
- readonly _tick: number;
16
- /** Dev-only frame-trace sink (`null` when unset; always null in prod). */
17
- readonly _trace: FrameTraceSink | null;
18
- /** Sync a component's observation flags (add/remove/disable/enable/dirty). */
19
- _configureComponentObservation(cid: number, hasAdd: boolean, hasRem: boolean, hasDisable: boolean, hasEnable: boolean, trackDirty: boolean): void;
20
- /** Drain the per-entity onSet dirty list for `cid` (clears marks). */
21
- _takeDirty(cid: number): EntityID[];
22
- /** Visit archetypes whose `cid` column changed since `baseline`, in
23
- * canonical (creation-id) order. */
24
- _forEachChangedArchetype(cid: number, baseline: number, cb: (arch: ArchetypeView) => void): void;
25
- /** Every live entity currently holding `cid` (dispose-on-disable sweep). */
26
- _collectEntitiesWithComponent(cid: number): EntityID[];
27
- isAlive(id: EntityID): boolean;
28
- isDisabled(id: EntityID): boolean;
29
- hasComponent(entityId: EntityID, def: ComponentHandle): boolean;
10
+ * can touch, and the registry is one consumer of the feed among others. */
11
+ export interface ObserverHost extends ChangeFeed {
12
+ /** Dev-only frame-trace sink (`null` when unset, always null in prod). */
13
+ readonly trace: FrameTraceSink | null;
30
14
  }
31
- /** Per-entity observer callback (onAdd / onRemove / onDisable / onEnable, and
15
+ /** What the world calls into an observer registry it did not build.
16
+ *
17
+ * `ECS.update` runs `dispatchSet` at the tick-tail detection point, through
18
+ * the settle hook the install pushed. A `DEV` build reads `descriptors` once
19
+ * per frame trace. Both are cold. The structural dispatch does not appear
20
+ * here: the plugin subscribes to it through the change feed. */
21
+ export interface ObserverHooks {
22
+ /** The synthesized descriptor of each registered observer, for the access
23
+ * check and the frame trace. */
24
+ descriptors(): SystemDescriptor[];
25
+ /** Fire the `onSet` observers for the change tick `run`. */
26
+ dispatchSet(run: number): void;
27
+ }
28
+ /** Per-entity observer callback (onAdd, onRemove, onDisable and onEnable, and
32
29
  * per-entity onSet). */
33
30
  export type ObserverFn = (entityId: EntityID, ctx: SystemContext) => void;
34
- /** Archetype-granular onSet callback fires once per changed archetype-column;
35
- * the consumer iterates `arch.entityCount` rows itself. */
31
+ /** Archetype-granular onSet callback, fires once per changed archetype-column.
32
+ * The consumer iterates `arch.entityCount` rows itself. */
36
33
  export type ArchetypeObserverFn = (arch: ArchetypeView, ctx: SystemContext) => void;
37
34
  /** Fields common to every observer registration. `access` drives both the
38
- * dev-mode `accessCheck` and the access-topological firing order; it is merged
35
+ * dev-mode `accessCheck` and the access-topological firing order. It is merged
39
36
  * over an all-empty declaration, so a caller spells out only what it touches. */
40
37
  interface ObserverConfigBase {
41
38
  onAdd?: ObserverFn;
42
39
  onRemove?: ObserverFn;
43
- /** Fires when an entity carrying this component is *disabled* at the
40
+ /** Fires when an entity carrying this component is *disabled*, at the
44
41
  * deferred toggle drain, once per net transition. Mirrors `onRemove`:
45
42
  * a disable is a soft remove of the whole mask from default queries. An immediate
46
43
  * host-side `ecs.disable()` does not fire (like immediate `addComponent`). */
47
44
  onDisable?: ObserverFn;
48
45
  /** Fires when an entity carrying this component is *enabled*, symmetric
49
- * with `onDisable` / `onAdd`. */
46
+ * with `onDisable` and `onAdd`. */
50
47
  onEnable?: ObserverFn;
51
- /** Access surface the callbacks touch (reads / writes / spawns / ). Partial:
48
+ /** Access surface the callbacks touch (reads, writes, spawns and the rest). Partial:
52
49
  * merged over `_INTERNAL_EMPTY_ACCESS`. Undeclared access throws in `DEV`. */
53
50
  access?: Partial<SystemAccessDeclaration>;
54
- /** flecs-style replay of current matches on registration (onAdd only seeds the
55
- * *enabled* members; a disabled entity is simply absent, matching default-query
56
- * semantics), for order-independence of register-vs-spawn. */
51
+ /** flecs-style replay of current matches on registration, so the order of
52
+ * register and spawn does not matter. `onAdd` only, and it seeds the
53
+ * *enabled* members. A disabled entity is absent, which matches the
54
+ * default-query semantics. */
57
55
  yieldExisting?: boolean;
58
56
  /** Diagnostic label for this observer, surfaced by the frame-trace seam
59
- * as the `observer_fired.observer` field the same role a system's
57
+ * as the `observer_fired.observer` field, the same role a system's
60
58
  * `name` plays. Optional and observe-only: it never touches `stateHash` or
61
59
  * dispatch. Defaults to `observer(<component debug name>)` when the component
62
60
  * was registered with a name, else `observer(<cid>)`. */
@@ -64,7 +62,7 @@ interface ObserverConfigBase {
64
62
  }
65
63
  /** Per-entity onSet: `onSet(eid, ctx)` fires once per changed entity, drained
66
64
  * from the opt-in per-row dirty list (registering this enables dirty tracking
67
- * for the component the dirty list + dedup bit). */
65
+ * for the component, the dirty list + dedup bit). */
68
66
  export interface EntitySetObserverConfig extends ObserverConfigBase {
69
67
  onSet: ObserverFn;
70
68
  granularity: "entity";
@@ -76,98 +74,19 @@ export interface ArchetypeSetObserverConfig extends ObserverConfigBase {
76
74
  onSet: ArchetypeObserverFn;
77
75
  granularity?: "archetype";
78
76
  }
79
- /** Structural-only observer no onSet. */
77
+ /** Structural-only observer, no onSet. */
80
78
  export interface StructuralObserverConfig extends ObserverConfigBase {
81
79
  onSet?: undefined;
82
80
  granularity?: undefined;
83
81
  }
84
82
  export type ObserverConfig = StructuralObserverConfig | EntitySetObserverConfig | ArchetypeSetObserverConfig;
83
+ /** Handle returned by `ecs.observe(...)`. `dispose()` unregisters. Safe to
84
+ * call more than once. */
85
85
  export interface ObserverHandle {
86
86
  dispose(): void;
87
- /** `using h = ecs.observe(C, {...})` explicit-resource-management sugar
87
+ /** `using h = ecs.observe(C, {...})`, explicit-resource-management sugar
88
88
  * over {@link dispose} (TC39 `Symbol.dispose`). */
89
89
  [Symbol.dispose](): void;
90
90
  }
91
- /**
92
- * Registry of component observers. Owned by `ECS`; the `Store` calls back into
93
- * `dispatchStructural` between fixed-point rounds during `flushStructural`,
94
- * and `ECS.update` calls `dispatchSet` at the post-update detection point.
95
- */
96
- export declare class ObserverRegistry {
97
- private readonly store;
98
- private readonly ctx;
99
- private readonly entries;
100
- /** ComponentID → its observers (structural + onSet). */
101
- private readonly byCid;
102
- /** Cached access-topological order; invalidated on register / dispose. */
103
- private _topo;
104
- private readonly _addBuckets;
105
- private readonly _remBuckets;
106
- private readonly _disBuckets;
107
- private readonly _enaBuckets;
108
- private readonly _radixOut;
109
- private readonly _radixC0;
110
- private readonly _radixC1;
111
- private readonly _setDrainCache;
112
- constructor(store: ObserverHost, ctx: SystemContext);
113
- get count(): number;
114
- /** The synthesized `SystemDescriptor`s of every registered observer, in
115
- * registration order (`dispose()` splices entries out, so none are stale).
116
- * Fed into the `startup()` archetype-prewarm closure so an observer's declared
117
- * `spawns` / `transitions` create their target archetypes eagerly, exactly as a
118
- * system's do. Without this an observer-spawned/-transitioned archetype
119
- * first-touches lazily mid-tick — the one asymmetry left in the otherwise
120
- * uniform "no lazy archetypes" prewarm. */
121
- descriptors(): SystemDescriptor[];
122
- register(def: ComponentHandle, config: ObserverConfig): ObserverHandle;
123
- private _dispose;
124
- /** Recompute the component's hot-path observation flags from its live
125
- * observers and push them to the store (which owns the flags + fast-path
126
- * counters). */
127
- private _reconfigureComponent;
128
- private getTopo;
129
- /**
130
- * Fire onAdd / onRemove / onDisable / onEnable for one fixed-point round's
131
- * effective events, in canonical order: access-topological across observers,
132
- * entity-id order (radix) within each observer. Called by
133
- * `Store.flushStructural` after the batch commits; observer callbacks may
134
- * enqueue further structural ops (or toggles) onto the deferred buffers (the
135
- * store loops until quiescent).
136
- *
137
- * The events arrive as flat `(comp, eid)` parallel arrays collected during the
138
- * flush; we bucket by component once (O(K)), then walk observers in topo order
139
- * so a producer's writes are visible to a consumer (glitch-free). A round
140
- * carries either structural (add/rem) OR toggle (dis/ena) events, never both —
141
- * toggles drain only once add/remove/destroy are quiescent (`flushStructural`)
142
- * — but we bucket all four uniformly; the empty pairs are no-ops. Within an
143
- * observer the fire order is remove, add, disable, enable (the "leaving" edges
144
- * before the "entering" edges).
145
- */
146
- dispatchStructural(ev: StructuralObserverEvents): void;
147
- /** Radix-sort `eids` by entity index (canonical within-observer order), then
148
- * fire `fn` per entity under the observer's access scope. */
149
- private _fireEach;
150
- private _bucket;
151
- private _clearBuckets;
152
- /**
153
- * Fire onSet observers for the current tick, in canonical order. Per-entity
154
- * onSet drains the opt-in dirty list (once per changed entity); archetype-
155
- * granular onSet scans the change tick (once per changed archetype-column).
156
- * Called by `ECS.update` after all phases, with `tick === store._tick`.
157
- */
158
- dispatchSet(tick: number): void;
159
- private _dispatchSetEntity;
160
- private _dispatchSetArch;
161
- private _yieldExisting;
162
- }
163
- /**
164
- * O(K) LSD radix sort of entity ids by their 20-bit dense index (two 10-bit
165
- * passes), in place. This is the canonical within-observer order — *never* a
166
- * comparator `Array.sort`, which the bench measured as much slower than the
167
- * entire flush. Distinct live entities have distinct indices,
168
- * so index order is a total canonical order. `out` is scratch (grown to length);
169
- * `c0` / `c1` are 1024-entry histograms (reused).
170
- */
171
- export declare function radixSortByIndex(eids: number[], out: number[], c0: Int32Array, c1: Int32Array): void;
172
91
  export {};
173
92
  //# sourceMappingURL=observer.d.ts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point at one slot of the frame.
3
+ *
4
+ * This file owns the seven built-in `SCHEDULE` members, the `Phase` handle
5
+ * `ecs.addPhase` hands back, the loop a phase belongs to, and the two pure
6
+ * classifiers over either spelling.
7
+ *
8
+ * It imports nothing. That is the point, and not an accident. A phase name is
9
+ * the one piece of schedule vocabulary that `frame_trace.ts` and
10
+ * `host_commands.ts` need, and reaching it through `schedule.ts` dragged the
11
+ * whole schedule, the system descriptor and the run condition behind it. With
12
+ * no import here the module sits outside every type cycle in `src`, and
13
+ * `import_graph.test.ts` records the smaller tangle.
14
+ *
15
+ * It refuses state. `PhaseNode`, the object behind a handle, stays in
16
+ * `schedule.ts` beside the drive loops that read its `plan` field.
17
+ ***/
18
+ export declare enum SCHEDULE {
19
+ PRE_STARTUP = "PRE_STARTUP",
20
+ STARTUP = "STARTUP",
21
+ POST_STARTUP = "POST_STARTUP",
22
+ FIXED_UPDATE = "FIXED_UPDATE",
23
+ PRE_UPDATE = "PRE_UPDATE",
24
+ UPDATE = "UPDATE",
25
+ POST_UPDATE = "POST_UPDATE"
26
+ }
27
+ /** Which drive runs a phase.
28
+ *
29
+ * `startup` runs once, from `ecs.startup()`. `fixed` runs once per fixed step,
30
+ * inside the accumulator loop. `update` runs once per `ecs.update(dt)`. A
31
+ * phase belongs to one loop for its life, because the loop decides the delta
32
+ * time it receives and how often it runs. */
33
+ export type PhaseLoop = "startup" | "fixed" | "update";
34
+ /**
35
+ * An opaque handle for one slot in the schedule, returned by `ecs.addPhase`.
36
+ *
37
+ * A phase is identified by **object identity**, not by name, exactly like a
38
+ * `SystemSet`. Two `addPhase` calls with the same name are two phases. The
39
+ * handle belongs to the world that made it, so passing one to another world's
40
+ * `addSystems` is a fault and not silent cross-world scheduling.
41
+ *
42
+ * The seven built-ins have no handle. `SCHEDULE.UPDATE` names one directly,
43
+ * and every place that takes a `SchedulePhase` takes either spelling. A string
44
+ * enum member is already a string, so the built-in needs no wrapper object,
45
+ * and a plugin author reads `after: [SCHEDULE.PRE_UPDATE]` without an import
46
+ * of a handle table.
47
+ */
48
+ export interface Phase {
49
+ readonly name: string;
50
+ readonly loop: PhaseLoop;
51
+ }
52
+ /** Where a new phase sits. `before` and `after` order it against other phases
53
+ * of the same loop, and a target in another loop is dropped. A phase with
54
+ * neither runs after every phase declared before it, so an unordered plugin
55
+ * phase lands at the tail of its loop. */
56
+ export interface PhaseConfig {
57
+ readonly loop: PhaseLoop;
58
+ readonly before?: readonly SchedulePhase[];
59
+ readonly after?: readonly SchedulePhase[];
60
+ }
61
+ /** Either spelling of a phase: a built-in `SCHEDULE` member, or the handle
62
+ * `addPhase` returned. */
63
+ export type SchedulePhase = SCHEDULE | Phase;
64
+ /** The name a trace event carries for a phase. A built-in spells its `SCHEDULE`
65
+ * member. A phase from `addPhase` spells the name it was given, so the set of
66
+ * values is open and a consumer switching on it needs a default arm. */
67
+ export type PhaseName = SCHEDULE | (string & {});
68
+ /** The loop that drives either spelling of a phase.
69
+ *
70
+ * A handle from `addPhase` carries its loop. A built-in is one of seven, and
71
+ * its loop is fixed at construction. Pure and cold, so a caller outside the
72
+ * schedule classifies a phase without holding the world. `installHostCommandSeam`
73
+ * is that caller. It refuses a recorder on a fixed-loop phase, and `addPhase`
74
+ * can put a phase of any name in that loop. */
75
+ export declare function phaseLoopOf(phase: SchedulePhase): PhaseLoop;
76
+ /** The name either spelling of a phase carries, for a diagnostic and for a
77
+ * system name. Pure and cold. */
78
+ export declare function phaseNameOf(phase: SchedulePhase): PhaseName;
79
+ //# sourceMappingURL=phase.d.ts.map
@@ -0,0 +1,79 @@
1
+ /***
2
+ * Phase vocabulary. The names a caller uses to point at one slot of the frame.
3
+ *
4
+ * This file owns the seven built-in `SCHEDULE` members, the `Phase` handle
5
+ * `ecs.addPhase` hands back, the loop a phase belongs to, and the two pure
6
+ * classifiers over either spelling.
7
+ *
8
+ * It imports nothing. That is the point, and not an accident. A phase name is
9
+ * the one piece of schedule vocabulary that `frame_trace.ts` and
10
+ * `host_commands.ts` need, and reaching it through `schedule.ts` dragged the
11
+ * whole schedule, the system descriptor and the run condition behind it. With
12
+ * no import here the module sits outside every type cycle in `src`, and
13
+ * `import_graph.test.ts` records the smaller tangle.
14
+ *
15
+ * It refuses state. `PhaseNode`, the object behind a handle, stays in
16
+ * `schedule.ts` beside the drive loops that read its `plan` field.
17
+ ***/
18
+ export declare enum SCHEDULE {
19
+ PRE_STARTUP = "PRE_STARTUP",
20
+ STARTUP = "STARTUP",
21
+ POST_STARTUP = "POST_STARTUP",
22
+ FIXED_UPDATE = "FIXED_UPDATE",
23
+ PRE_UPDATE = "PRE_UPDATE",
24
+ UPDATE = "UPDATE",
25
+ POST_UPDATE = "POST_UPDATE"
26
+ }
27
+ /** Which drive runs a phase.
28
+ *
29
+ * `startup` runs once, from `ecs.startup()`. `fixed` runs once per fixed step,
30
+ * inside the accumulator loop. `update` runs once per `ecs.update(dt)`. A
31
+ * phase belongs to one loop for its life, because the loop decides the delta
32
+ * time it receives and how often it runs. */
33
+ export type PhaseLoop = "startup" | "fixed" | "update";
34
+ /**
35
+ * An opaque handle for one slot in the schedule, returned by `ecs.addPhase`.
36
+ *
37
+ * A phase is identified by **object identity**, not by name, exactly like a
38
+ * `SystemSet`. Two `addPhase` calls with the same name are two phases. The
39
+ * handle belongs to the world that made it, so passing one to another world's
40
+ * `addSystems` is a fault and not silent cross-world scheduling.
41
+ *
42
+ * The seven built-ins have no handle. `SCHEDULE.UPDATE` names one directly,
43
+ * and every place that takes a `SchedulePhase` takes either spelling. A string
44
+ * enum member is already a string, so the built-in needs no wrapper object,
45
+ * and a plugin author reads `after: [SCHEDULE.PRE_UPDATE]` without an import
46
+ * of a handle table.
47
+ */
48
+ export interface Phase {
49
+ readonly name: string;
50
+ readonly loop: PhaseLoop;
51
+ }
52
+ /** Where a new phase sits. `before` and `after` order it against other phases
53
+ * of the same loop, and a target in another loop is dropped. A phase with
54
+ * neither runs after every phase declared before it, so an unordered plugin
55
+ * phase lands at the tail of its loop. */
56
+ export interface PhaseConfig {
57
+ readonly loop: PhaseLoop;
58
+ readonly before?: readonly SchedulePhase[];
59
+ readonly after?: readonly SchedulePhase[];
60
+ }
61
+ /** Either spelling of a phase: a built-in `SCHEDULE` member, or the handle
62
+ * `addPhase` returned. */
63
+ export type SchedulePhase = SCHEDULE | Phase;
64
+ /** The name a trace event carries for a phase. A built-in spells its `SCHEDULE`
65
+ * member. A phase from `addPhase` spells the name it was given, so the set of
66
+ * values is open and a consumer switching on it needs a default arm. */
67
+ export type PhaseName = SCHEDULE | (string & {});
68
+ /** The loop that drives either spelling of a phase.
69
+ *
70
+ * A handle from `addPhase` carries its loop. A built-in is one of seven, and
71
+ * its loop is fixed at construction. Pure and cold, so a caller outside the
72
+ * schedule classifies a phase without holding the world. `installHostCommandSeam`
73
+ * is that caller. It refuses a recorder on a fixed-loop phase, and `addPhase`
74
+ * can put a phase of any name in that loop. */
75
+ export declare function phaseLoopOf(phase: SchedulePhase): PhaseLoop;
76
+ /** The name either spelling of a phase carries, for a diagnostic and for a
77
+ * system name. Pure and cold. */
78
+ export declare function phaseNameOf(phase: SchedulePhase): PhaseName;
79
+ //# sourceMappingURL=phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;KAgBK;AAEL,oBAAY,QAAQ;IACnB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC3B;AAED;;;;;6CAK6C;AAC7C,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB;AAED;;;0CAG0C;AAC1C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C;AAED;0BAC0B;AAC1B,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7C;;wEAEwE;AACxE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjD;;;;;;+CAM+C;AAC/C,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAc3D;AAED;iCACiC;AACjC,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAE3D"}