@oasys/oecs 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/CHANGELOG.md +1399 -276
  2. package/README.md +327 -169
  3. package/dist/core/ecs/access_check.d.cts +31 -31
  4. package/dist/core/ecs/access_check.d.ts +31 -31
  5. package/dist/core/ecs/access_check.d.ts.map +1 -1
  6. package/dist/core/ecs/archetype.d.cts +273 -205
  7. package/dist/core/ecs/archetype.d.ts +273 -205
  8. package/dist/core/ecs/archetype.d.ts.map +1 -1
  9. package/dist/core/ecs/archetype_closure.d.cts +23 -0
  10. package/dist/core/ecs/archetype_closure.d.ts +23 -0
  11. package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
  12. package/dist/core/ecs/archetype_graph.d.cts +34 -34
  13. package/dist/core/ecs/archetype_graph.d.ts +34 -34
  14. package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
  15. package/dist/core/ecs/archetype_types.d.cts +55 -0
  16. package/dist/core/ecs/archetype_types.d.ts +55 -0
  17. package/dist/core/ecs/archetype_types.d.ts.map +1 -0
  18. package/dist/core/ecs/change_feed.d.cts +53 -0
  19. package/dist/core/ecs/change_feed.d.ts +53 -0
  20. package/dist/core/ecs/change_feed.d.ts.map +1 -0
  21. package/dist/core/ecs/changed_query.d.cts +36 -0
  22. package/dist/core/ecs/changed_query.d.ts +36 -0
  23. package/dist/core/ecs/changed_query.d.ts.map +1 -0
  24. package/dist/core/ecs/chunk_columns.d.cts +49 -0
  25. package/dist/core/ecs/chunk_columns.d.ts +49 -0
  26. package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
  27. package/dist/core/ecs/command_log.d.cts +30 -30
  28. package/dist/core/ecs/command_log.d.ts +30 -30
  29. package/dist/core/ecs/command_log.d.ts.map +1 -1
  30. package/dist/core/ecs/component.d.cts +45 -44
  31. package/dist/core/ecs/component.d.ts +45 -44
  32. package/dist/core/ecs/component.d.ts.map +1 -1
  33. package/dist/core/ecs/component_registry.d.cts +53 -0
  34. package/dist/core/ecs/component_registry.d.ts +53 -0
  35. package/dist/core/ecs/component_registry.d.ts.map +1 -0
  36. package/dist/core/ecs/compute_backend.d.cts +18 -7
  37. package/dist/core/ecs/compute_backend.d.ts +18 -7
  38. package/dist/core/ecs/compute_backend.d.ts.map +1 -1
  39. package/dist/core/ecs/deferred_commands.d.cts +15 -14
  40. package/dist/core/ecs/deferred_commands.d.ts +15 -14
  41. package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
  42. package/dist/core/ecs/dispatch_trace.d.cts +32 -31
  43. package/dist/core/ecs/dispatch_trace.d.ts +32 -31
  44. package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
  45. package/dist/core/ecs/ecs.d.cts +337 -276
  46. package/dist/core/ecs/ecs.d.ts +337 -276
  47. package/dist/core/ecs/ecs.d.ts.map +1 -1
  48. package/dist/core/ecs/ecs_memory.d.cts +134 -136
  49. package/dist/core/ecs/ecs_memory.d.ts +134 -136
  50. package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
  51. package/dist/core/ecs/ecs_options.d.cts +89 -0
  52. package/dist/core/ecs/ecs_options.d.ts +89 -0
  53. package/dist/core/ecs/ecs_options.d.ts.map +1 -0
  54. package/dist/core/ecs/entity.d.cts +4 -4
  55. package/dist/core/ecs/entity.d.ts +4 -4
  56. package/dist/core/ecs/entity_allocator.d.cts +24 -22
  57. package/dist/core/ecs/entity_allocator.d.ts +24 -22
  58. package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
  59. package/dist/core/ecs/event.d.cts +37 -23
  60. package/dist/core/ecs/event.d.ts +37 -23
  61. package/dist/core/ecs/event.d.ts.map +1 -1
  62. package/dist/core/ecs/facades.d.cts +12 -126
  63. package/dist/core/ecs/facades.d.ts +12 -126
  64. package/dist/core/ecs/facades.d.ts.map +1 -1
  65. package/dist/core/ecs/frame_stepper.d.cts +12 -12
  66. package/dist/core/ecs/frame_stepper.d.ts +12 -12
  67. package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
  68. package/dist/core/ecs/frame_trace.d.cts +34 -34
  69. package/dist/core/ecs/frame_trace.d.ts +34 -34
  70. package/dist/core/ecs/frame_trace.d.ts.map +1 -1
  71. package/dist/core/ecs/host_commands.d.cts +107 -89
  72. package/dist/core/ecs/host_commands.d.ts +107 -89
  73. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  74. package/dist/core/ecs/index.d.cts +22 -12
  75. package/dist/core/ecs/index.d.ts +22 -12
  76. package/dist/core/ecs/index.d.ts.map +1 -1
  77. package/dist/core/ecs/observer.d.cts +41 -122
  78. package/dist/core/ecs/observer.d.ts +41 -122
  79. package/dist/core/ecs/observer.d.ts.map +1 -1
  80. package/dist/core/ecs/phase.d.cts +79 -0
  81. package/dist/core/ecs/phase.d.ts +79 -0
  82. package/dist/core/ecs/phase.d.ts.map +1 -0
  83. package/dist/core/ecs/plugin.d.cts +125 -0
  84. package/dist/core/ecs/plugin.d.ts +125 -0
  85. package/dist/core/ecs/plugin.d.ts.map +1 -0
  86. package/dist/core/ecs/plugin_slots.d.cts +26 -0
  87. package/dist/core/ecs/plugin_slots.d.ts +26 -0
  88. package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
  89. package/dist/core/ecs/query.d.cts +219 -568
  90. package/dist/core/ecs/query.d.ts +219 -568
  91. package/dist/core/ecs/query.d.ts.map +1 -1
  92. package/dist/core/ecs/query_cache.d.cts +130 -0
  93. package/dist/core/ecs/query_cache.d.ts +130 -0
  94. package/dist/core/ecs/query_cache.d.ts.map +1 -0
  95. package/dist/core/ecs/query_registry.d.cts +47 -0
  96. package/dist/core/ecs/query_registry.d.ts +47 -0
  97. package/dist/core/ecs/query_registry.d.ts.map +1 -0
  98. package/dist/core/ecs/query_terms.d.cts +126 -0
  99. package/dist/core/ecs/query_terms.d.ts +126 -0
  100. package/dist/core/ecs/query_terms.d.ts.map +1 -0
  101. package/dist/core/ecs/ref.d.cts +129 -16
  102. package/dist/core/ecs/ref.d.ts +129 -16
  103. package/dist/core/ecs/ref.d.ts.map +1 -1
  104. package/dist/core/ecs/relation.d.cts +105 -186
  105. package/dist/core/ecs/relation.d.ts +105 -186
  106. package/dist/core/ecs/relation.d.ts.map +1 -1
  107. package/dist/core/ecs/resource.d.cts +14 -14
  108. package/dist/core/ecs/resource.d.ts +14 -14
  109. package/dist/core/ecs/resource_registry.d.cts +6 -6
  110. package/dist/core/ecs/resource_registry.d.ts +6 -6
  111. package/dist/core/ecs/resource_registry.d.ts.map +1 -1
  112. package/dist/core/ecs/row_kinds.d.cts +24 -0
  113. package/dist/core/ecs/row_kinds.d.ts +24 -0
  114. package/dist/core/ecs/row_kinds.d.ts.map +1 -0
  115. package/dist/core/ecs/run_condition.d.cts +23 -23
  116. package/dist/core/ecs/run_condition.d.ts +23 -23
  117. package/dist/core/ecs/run_condition.d.ts.map +1 -1
  118. package/dist/core/ecs/schedule.d.cts +98 -114
  119. package/dist/core/ecs/schedule.d.ts +98 -114
  120. package/dist/core/ecs/schedule.d.ts.map +1 -1
  121. package/dist/core/ecs/schedule_plan.d.cts +33 -0
  122. package/dist/core/ecs/schedule_plan.d.ts +33 -0
  123. package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
  124. package/dist/core/ecs/snapshot.d.cts +77 -0
  125. package/dist/core/ecs/snapshot.d.ts +77 -0
  126. package/dist/core/ecs/snapshot.d.ts.map +1 -0
  127. package/dist/core/ecs/snapshot_mount.d.cts +42 -0
  128. package/dist/core/ecs/snapshot_mount.d.ts +42 -0
  129. package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
  130. package/dist/core/ecs/sparse_store.d.cts +110 -53
  131. package/dist/core/ecs/sparse_store.d.ts +110 -53
  132. package/dist/core/ecs/sparse_store.d.ts.map +1 -1
  133. package/dist/core/ecs/store.d.cts +644 -511
  134. package/dist/core/ecs/store.d.ts +644 -511
  135. package/dist/core/ecs/store.d.ts.map +1 -1
  136. package/dist/core/ecs/store_layout_listener.d.cts +8 -8
  137. package/dist/core/ecs/store_layout_listener.d.ts +8 -8
  138. package/dist/core/ecs/store_types.d.cts +122 -0
  139. package/dist/core/ecs/store_types.d.ts +122 -0
  140. package/dist/core/ecs/store_types.d.ts.map +1 -0
  141. package/dist/core/ecs/system.d.cts +151 -66
  142. package/dist/core/ecs/system.d.ts +151 -66
  143. package/dist/core/ecs/system.d.ts.map +1 -1
  144. package/dist/core/ecs/system_context.d.cts +296 -0
  145. package/dist/core/ecs/system_context.d.ts +296 -0
  146. package/dist/core/ecs/system_context.d.ts.map +1 -0
  147. package/dist/core/ecs/system_set.d.cts +48 -0
  148. package/dist/core/ecs/system_set.d.ts +48 -0
  149. package/dist/core/ecs/system_set.d.ts.map +1 -0
  150. package/dist/core/ecs/utils/arrays.d.cts +15 -1
  151. package/dist/core/ecs/utils/arrays.d.ts +15 -1
  152. package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
  153. package/dist/core/ecs/utils/error.d.cts +87 -4
  154. package/dist/core/ecs/utils/error.d.ts +87 -4
  155. package/dist/core/ecs/utils/error.d.ts.map +1 -1
  156. package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
  157. package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
  158. package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
  159. package/dist/core/restore_errors.d.cts +30 -0
  160. package/dist/core/restore_errors.d.ts +30 -0
  161. package/dist/core/restore_errors.d.ts.map +1 -0
  162. package/dist/core/store/action_ring.d.cts +48 -49
  163. package/dist/core/store/action_ring.d.ts +48 -49
  164. package/dist/core/store/action_ring.d.ts.map +1 -1
  165. package/dist/core/store/allocator.d.cts +166 -114
  166. package/dist/core/store/allocator.d.ts +166 -114
  167. package/dist/core/store/allocator.d.ts.map +1 -1
  168. package/dist/core/store/buffer_backed_column.d.cts +21 -22
  169. package/dist/core/store/buffer_backed_column.d.ts +21 -22
  170. package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
  171. package/dist/core/store/column_store.d.cts +138 -100
  172. package/dist/core/store/column_store.d.ts +138 -100
  173. package/dist/core/store/column_store.d.ts.map +1 -1
  174. package/dist/core/store/command_dispatch.d.cts +14 -15
  175. package/dist/core/store/command_dispatch.d.ts +14 -15
  176. package/dist/core/store/command_dispatch.d.ts.map +1 -1
  177. package/dist/core/store/command_ring.d.cts +41 -45
  178. package/dist/core/store/command_ring.d.ts +41 -45
  179. package/dist/core/store/command_ring.d.ts.map +1 -1
  180. package/dist/core/store/descriptor.d.cts +35 -18
  181. package/dist/core/store/descriptor.d.ts +35 -18
  182. package/dist/core/store/descriptor.d.ts.map +1 -1
  183. package/dist/core/store/entity_index.d.cts +34 -35
  184. package/dist/core/store/entity_index.d.ts +34 -35
  185. package/dist/core/store/entity_index.d.ts.map +1 -1
  186. package/dist/core/store/event_ring.d.cts +40 -42
  187. package/dist/core/store/event_ring.d.ts +40 -42
  188. package/dist/core/store/event_ring.d.ts.map +1 -1
  189. package/dist/core/store/extend.d.cts +15 -9
  190. package/dist/core/store/extend.d.ts +15 -9
  191. package/dist/core/store/extend.d.ts.map +1 -1
  192. package/dist/core/store/grow.d.cts +3 -3
  193. package/dist/core/store/grow.d.ts +3 -3
  194. package/dist/core/store/grow.d.ts.map +1 -1
  195. package/dist/core/store/header.d.cts +37 -33
  196. package/dist/core/store/header.d.ts +37 -33
  197. package/dist/core/store/header.d.ts.map +1 -1
  198. package/dist/core/store/index.d.cts +10 -10
  199. package/dist/core/store/index.d.ts +10 -10
  200. package/dist/core/store/index.d.ts.map +1 -1
  201. package/dist/core/store/layout_ops.d.cts +72 -63
  202. package/dist/core/store/layout_ops.d.ts +72 -63
  203. package/dist/core/store/layout_ops.d.ts.map +1 -1
  204. package/dist/core/store/region_table.d.cts +28 -21
  205. package/dist/core/store/region_table.d.ts +28 -21
  206. package/dist/core/store/region_table.d.ts.map +1 -1
  207. package/dist/core/store/snapshot.d.cts +31 -16
  208. package/dist/core/store/snapshot.d.ts +31 -16
  209. package/dist/core/store/snapshot.d.ts.map +1 -1
  210. package/dist/core/store/state_hash.d.cts +14 -14
  211. package/dist/core/store/state_hash.d.ts +14 -14
  212. package/dist/core/store/state_hash.d.ts.map +1 -1
  213. package/dist/core/store/store_regions.d.cts +10 -10
  214. package/dist/core/store/store_regions.d.ts +10 -10
  215. package/dist/core/store/store_regions.d.ts.map +1 -1
  216. package/dist/core/store/vendored_abi/abi.d.cts +27 -2
  217. package/dist/core/store/vendored_abi/abi.d.ts +27 -2
  218. package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
  219. package/dist/host_commands-B2KMx8O2.cjs +1 -0
  220. package/dist/host_commands-ClVPvhSa.cjs +2 -0
  221. package/dist/host_commands-CwxVQS1z.js +1524 -0
  222. package/dist/host_commands-nJvTy88E.js +1667 -0
  223. package/dist/index.cjs +1 -1
  224. package/dist/index.d.cts +16 -11
  225. package/dist/index.d.ts +16 -11
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.development.cjs +1 -1
  228. package/dist/index.development.js +6709 -5729
  229. package/dist/index.js +5664 -4743
  230. package/dist/internal.cjs +2 -2
  231. package/dist/internal.d.cts +5 -2
  232. package/dist/internal.d.ts +5 -2
  233. package/dist/internal.d.ts.map +1 -1
  234. package/dist/internal.development.cjs +1 -1
  235. package/dist/internal.development.js +70 -20
  236. package/dist/internal.js +138 -83
  237. package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
  238. package/dist/plugins/abi-NP8pNxpd.js +42 -0
  239. package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
  240. package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
  241. package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
  242. package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
  243. package/dist/{extensions → plugins}/editor/editor.d.cts +56 -56
  244. package/dist/{extensions → plugins}/editor/editor.d.ts +56 -56
  245. package/dist/plugins/editor/editor.d.ts.map +1 -0
  246. package/dist/{extensions → plugins}/editor/field_handle.d.cts +13 -13
  247. package/dist/{extensions → plugins}/editor/field_handle.d.ts +13 -13
  248. package/dist/plugins/editor/field_handle.d.ts.map +1 -0
  249. package/dist/plugins/editor/index.d.cts +22 -0
  250. package/dist/plugins/editor/index.d.ts +22 -0
  251. package/dist/plugins/editor/index.d.ts.map +1 -0
  252. package/dist/plugins/editor.cjs +1 -0
  253. package/dist/plugins/editor.d.cts +1 -0
  254. package/dist/plugins/editor.d.ts +1 -0
  255. package/dist/plugins/editor.development.cjs +1 -0
  256. package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +83 -66
  257. package/dist/{extensions/editor/index.js → plugins/editor.js} +83 -66
  258. package/dist/plugins/events/event_channel.d.cts +13 -0
  259. package/dist/plugins/events/event_channel.d.ts +13 -0
  260. package/dist/plugins/events/event_channel.d.ts.map +1 -0
  261. package/dist/plugins/events/event_registry.d.cts +22 -0
  262. package/dist/plugins/events/event_registry.d.ts +22 -0
  263. package/dist/plugins/events/event_registry.d.ts.map +1 -0
  264. package/dist/plugins/events/facade.d.cts +26 -0
  265. package/dist/plugins/events/facade.d.ts +26 -0
  266. package/dist/plugins/events/facade.d.ts.map +1 -0
  267. package/dist/plugins/events/index.d.cts +10 -0
  268. package/dist/plugins/events/index.d.ts +10 -0
  269. package/dist/plugins/events/index.d.ts.map +1 -0
  270. package/dist/plugins/events.cjs +1 -0
  271. package/dist/plugins/events.d.cts +1 -0
  272. package/dist/plugins/events.d.ts +1 -0
  273. package/dist/plugins/events.development.cjs +1 -0
  274. package/dist/plugins/events.development.js +174 -0
  275. package/dist/plugins/events.js +159 -0
  276. package/dist/plugins/observers/index.d.cts +23 -0
  277. package/dist/plugins/observers/index.d.ts +23 -0
  278. package/dist/plugins/observers/index.d.ts.map +1 -0
  279. package/dist/plugins/observers/observer_registry.d.cts +101 -0
  280. package/dist/plugins/observers/observer_registry.d.ts +101 -0
  281. package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
  282. package/dist/plugins/observers.cjs +1 -0
  283. package/dist/plugins/observers.d.cts +1 -0
  284. package/dist/plugins/observers.d.ts +1 -0
  285. package/dist/plugins/observers.development.cjs +1 -0
  286. package/dist/plugins/observers.development.js +431 -0
  287. package/dist/plugins/observers.js +403 -0
  288. package/dist/plugins/relation_store-BsoegrZh.js +313 -0
  289. package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
  290. package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
  291. package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
  292. package/dist/plugins/relations/builtin_relations.d.cts +48 -0
  293. package/dist/plugins/relations/builtin_relations.d.ts +48 -0
  294. package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
  295. package/dist/plugins/relations/facade.d.cts +73 -0
  296. package/dist/plugins/relations/facade.d.ts +73 -0
  297. package/dist/plugins/relations/facade.d.ts.map +1 -0
  298. package/dist/plugins/relations/index.d.cts +11 -0
  299. package/dist/plugins/relations/index.d.ts +11 -0
  300. package/dist/plugins/relations/index.d.ts.map +1 -0
  301. package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +93 -105
  302. package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +93 -105
  303. package/dist/plugins/relations/relation_service.d.ts.map +1 -0
  304. package/dist/plugins/relations/relation_store.d.cts +177 -0
  305. package/dist/plugins/relations/relation_store.d.ts +177 -0
  306. package/dist/plugins/relations/relation_store.d.ts.map +1 -0
  307. package/dist/plugins/relations.cjs +1 -0
  308. package/dist/plugins/relations.d.cts +1 -0
  309. package/dist/plugins/relations.d.ts +1 -0
  310. package/dist/plugins/relations.development.cjs +1 -0
  311. package/dist/plugins/relations.development.js +603 -0
  312. package/dist/plugins/relations.js +553 -0
  313. package/dist/plugins/snapshots/index.d.cts +33 -0
  314. package/dist/plugins/snapshots/index.d.ts +33 -0
  315. package/dist/plugins/snapshots/index.d.ts.map +1 -0
  316. package/dist/plugins/snapshots/resume.d.cts +57 -0
  317. package/dist/plugins/snapshots/resume.d.ts +57 -0
  318. package/dist/plugins/snapshots/resume.d.ts.map +1 -0
  319. package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
  320. package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
  321. package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
  322. package/dist/plugins/snapshots.cjs +1 -0
  323. package/dist/plugins/snapshots.d.cts +1 -0
  324. package/dist/plugins/snapshots.d.ts +1 -0
  325. package/dist/plugins/snapshots.development.cjs +1 -0
  326. package/dist/plugins/snapshots.development.js +737 -0
  327. package/dist/plugins/snapshots.js +737 -0
  328. package/dist/plugins/solid/index.d.cts +8 -0
  329. package/dist/plugins/solid/index.d.ts +8 -0
  330. package/dist/plugins/solid/index.d.ts.map +1 -0
  331. package/dist/plugins/solid/solid.d.cts +97 -0
  332. package/dist/plugins/solid/solid.d.ts +97 -0
  333. package/dist/plugins/solid/solid.d.ts.map +1 -0
  334. package/dist/plugins/solid.cjs +1 -0
  335. package/dist/plugins/solid.d.cts +1 -0
  336. package/dist/plugins/solid.d.ts +1 -0
  337. package/dist/plugins/solid.development.cjs +1 -0
  338. package/dist/plugins/solid.development.js +319 -0
  339. package/dist/plugins/solid.js +319 -0
  340. package/dist/plugins/workers/index.d.cts +75 -0
  341. package/dist/plugins/workers/index.d.ts +75 -0
  342. package/dist/plugins/workers/index.d.ts.map +1 -0
  343. package/dist/plugins/workers/node_threads.d.cts +25 -0
  344. package/dist/plugins/workers/node_threads.d.ts +25 -0
  345. package/dist/plugins/workers/node_threads.d.ts.map +1 -0
  346. package/dist/plugins/workers/plan.d.cts +61 -0
  347. package/dist/plugins/workers/plan.d.ts +61 -0
  348. package/dist/plugins/workers/plan.d.ts.map +1 -0
  349. package/dist/plugins/workers/pool.d.cts +144 -0
  350. package/dist/plugins/workers/pool.d.ts +144 -0
  351. package/dist/plugins/workers/pool.d.ts.map +1 -0
  352. package/dist/plugins/workers/protocol.d.cts +112 -0
  353. package/dist/plugins/workers/protocol.d.ts +112 -0
  354. package/dist/plugins/workers/protocol.d.ts.map +1 -0
  355. package/dist/plugins/workers/worker_bind.d.cts +64 -0
  356. package/dist/plugins/workers/worker_bind.d.ts +64 -0
  357. package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
  358. package/dist/plugins/workers/worker_loop.d.cts +14 -0
  359. package/dist/plugins/workers/worker_loop.d.ts +14 -0
  360. package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
  361. package/dist/plugins/workers.cjs +1 -0
  362. package/dist/plugins/workers.d.cts +1 -0
  363. package/dist/plugins/workers.d.ts +1 -0
  364. package/dist/plugins/workers.development.cjs +1 -0
  365. package/dist/plugins/workers.development.js +596 -0
  366. package/dist/plugins/workers.js +474 -0
  367. package/dist/primitives.cjs +1 -1
  368. package/dist/primitives.d.cts +4 -4
  369. package/dist/primitives.d.ts +4 -4
  370. package/dist/primitives.development.cjs +1 -1
  371. package/dist/primitives.development.js +66 -22
  372. package/dist/primitives.js +66 -22
  373. package/dist/shared-BKl12xF1.js +132 -0
  374. package/dist/shared-Dk-pACZT.cjs +1 -0
  375. package/dist/shared.cjs +1 -1
  376. package/dist/shared.d.cts +7 -7
  377. package/dist/shared.d.ts +7 -7
  378. package/dist/shared.d.ts.map +1 -1
  379. package/dist/shared.development.cjs +1 -1
  380. package/dist/shared.development.js +4 -3
  381. package/dist/shared.js +4 -3
  382. package/dist/topological_sort-Cc_yXqPT.js +346 -0
  383. package/dist/topological_sort-vp1imU6D.cjs +1 -0
  384. package/dist/type_primitives/assertions.d.cts +12 -16
  385. package/dist/type_primitives/assertions.d.ts +12 -16
  386. package/dist/type_primitives/assertions.d.ts.map +1 -1
  387. package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
  388. package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
  389. package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
  390. package/dist/type_primitives/bitset/bitset.d.cts +7 -11
  391. package/dist/type_primitives/bitset/bitset.d.ts +7 -11
  392. package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
  393. package/dist/type_primitives/brand.d.cts +2 -7
  394. package/dist/type_primitives/brand.d.ts +2 -7
  395. package/dist/type_primitives/brand.d.ts.map +1 -1
  396. package/dist/type_primitives/error.d.cts +1 -2
  397. package/dist/type_primitives/error.d.ts +1 -2
  398. package/dist/type_primitives/error.d.ts.map +1 -1
  399. package/dist/type_primitives/index.d.cts +1 -1
  400. package/dist/type_primitives/index.d.ts +1 -1
  401. package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
  402. package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
  403. package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
  404. package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
  405. package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
  406. package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
  407. package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
  408. package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
  409. package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
  410. package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +18 -17
  411. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +18 -17
  412. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
  413. package/dist/utils/error.d.ts.map +1 -1
  414. package/dist/version.d.cts +4 -4
  415. package/dist/version.d.ts +4 -4
  416. package/dist/worker.cjs +1 -0
  417. package/dist/worker.d.cts +17 -0
  418. package/dist/worker.d.ts +17 -0
  419. package/dist/worker.d.ts.map +1 -0
  420. package/dist/worker.development.cjs +1 -0
  421. package/dist/worker.development.js +253 -0
  422. package/dist/worker.js +253 -0
  423. package/package.json +363 -191
  424. package/dist/core/ecs/builtin_relations.d.cts +0 -43
  425. package/dist/core/ecs/builtin_relations.d.ts +0 -43
  426. package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
  427. package/dist/core/ecs/event_registry.d.cts +0 -22
  428. package/dist/core/ecs/event_registry.d.ts +0 -22
  429. package/dist/core/ecs/event_registry.d.ts.map +0 -1
  430. package/dist/core/ecs/relation_service.d.ts.map +0 -1
  431. package/dist/core/ecs/resume.d.cts +0 -85
  432. package/dist/core/ecs/resume.d.ts +0 -85
  433. package/dist/core/ecs/resume.d.ts.map +0 -1
  434. package/dist/core/ecs/snapshot_service.d.cts +0 -94
  435. package/dist/core/ecs/snapshot_service.d.ts +0 -94
  436. package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
  437. package/dist/extensions/editor/editor.d.ts.map +0 -1
  438. package/dist/extensions/editor/field_handle.d.ts.map +0 -1
  439. package/dist/extensions/editor/index.cjs +0 -1
  440. package/dist/extensions/editor/index.d.cts +0 -21
  441. package/dist/extensions/editor/index.d.ts +0 -21
  442. package/dist/extensions/editor/index.d.ts.map +0 -1
  443. package/dist/extensions/editor/index.development.cjs +0 -1
  444. package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
  445. package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
  446. package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
  447. package/dist/extensions/reactive/index.cjs +0 -1
  448. package/dist/extensions/reactive/index.d.cts +0 -23
  449. package/dist/extensions/reactive/index.d.ts +0 -23
  450. package/dist/extensions/reactive/index.d.ts.map +0 -1
  451. package/dist/extensions/reactive/index.development.cjs +0 -1
  452. package/dist/extensions/reactive/index.development.js +0 -215
  453. package/dist/extensions/reactive/index.js +0 -215
  454. package/dist/extensions/solid/index.cjs +0 -1
  455. package/dist/extensions/solid/index.d.cts +0 -6
  456. package/dist/extensions/solid/index.d.ts +0 -6
  457. package/dist/extensions/solid/index.d.ts.map +0 -1
  458. package/dist/extensions/solid/index.development.cjs +0 -1
  459. package/dist/extensions/solid/index.development.js +0 -40
  460. package/dist/extensions/solid/index.js +0 -36
  461. package/dist/extensions/solid/kernel_solid.d.cts +0 -45
  462. package/dist/extensions/solid/kernel_solid.d.ts +0 -45
  463. package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
  464. package/dist/host_commands-3jyFfWNg.js +0 -2326
  465. package/dist/host_commands-DNf0f6ko.cjs +0 -1
  466. package/dist/internal-C9jjL90H.js +0 -2485
  467. package/dist/internal-RZN14uMw.cjs +0 -2
  468. package/dist/interop-CT-REx0W.cjs +0 -1
  469. package/dist/interop-CcY6ASQc.js +0 -18
  470. package/dist/interop-DqxleBo7.js +0 -18
  471. package/dist/interop-T1HZ-Dpa.cjs +0 -1
  472. package/dist/kernel-Cz2Kxlwl.js +0 -240
  473. package/dist/kernel-DgyrLFjW.js +0 -227
  474. package/dist/kernel-sw7ScKWu.cjs +0 -1
  475. package/dist/kernel-yWV3XnAb.cjs +0 -1
  476. package/dist/reactive/array.d.cts +0 -24
  477. package/dist/reactive/array.d.ts +0 -24
  478. package/dist/reactive/array.d.ts.map +0 -1
  479. package/dist/reactive/index.cjs +0 -1
  480. package/dist/reactive/index.d.cts +0 -11
  481. package/dist/reactive/index.d.ts +0 -11
  482. package/dist/reactive/index.d.ts.map +0 -1
  483. package/dist/reactive/index.development.cjs +0 -1
  484. package/dist/reactive/index.development.js +0 -18
  485. package/dist/reactive/index.js +0 -18
  486. package/dist/reactive/interop.d.cts +0 -19
  487. package/dist/reactive/interop.d.ts +0 -19
  488. package/dist/reactive/interop.d.ts.map +0 -1
  489. package/dist/reactive/kernel.d.cts +0 -73
  490. package/dist/reactive/kernel.d.ts +0 -73
  491. package/dist/reactive/kernel.d.ts.map +0 -1
  492. package/dist/reactive/map.d.cts +0 -16
  493. package/dist/reactive/map.d.ts +0 -16
  494. package/dist/reactive/map.d.ts.map +0 -1
  495. package/dist/reactive/shallow.d.cts +0 -11
  496. package/dist/reactive/shallow.d.ts +0 -11
  497. package/dist/reactive/shallow.d.ts.map +0 -1
  498. package/dist/reactive/struct.d.cts +0 -10
  499. package/dist/reactive/struct.d.ts +0 -10
  500. package/dist/reactive/struct.d.ts.map +0 -1
  501. package/dist/shallow-9S1pY_Iw.js +0 -159
  502. package/dist/shallow-C5YmTbtb.cjs +0 -1
  503. package/dist/shallow-DQ8aG51_.cjs +0 -1
  504. package/dist/shallow-DfnAm9vG.js +0 -150
  505. package/dist/shared-BMXh9hxm.cjs +0 -1
  506. package/dist/shared-DQKK0i-E.js +0 -109
  507. package/dist/topological_sort-BDvEyb9W.cjs +0 -1
  508. package/dist/topological_sort-DK6EjpWa.js +0 -135
  509. package/dist/typed_arrays-BcXcnzB4.js +0 -258
  510. package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
@@ -0,0 +1,177 @@
1
+ import { EntityID } from '../../core/ecs/entity.js';
2
+ import { SparseComponentDef, SparseComponentStore } from '../../core/ecs/sparse_store.js';
3
+ import { CanonicalPairFn, CanonicalTargetSetFn, MakeSourceID, OnDeleteTarget, RelationStoreView } from '../../core/ecs/relation.js';
4
+ /** One relation's derived side state. **Abstract over cardinality:** the
5
+ * base owns the cardinality-agnostic **reverse index** (target → sources, keyed
6
+ * by full `EntityID` so a recycled slot can't alias a dead target's sources) and
7
+ * a handle on the backing `SparseComponentStore`. The forward representation and
8
+ * its sparse interaction are owned by the concrete `ExclusiveRelationStore` and
9
+ * `MultiRelationStore` (built by `createRelationStore`).
10
+ *
11
+ * The registry level (`Store` and `RelationService`) owns what is genuinely its
12
+ * own, entity liveness, registration, and destroy orchestration, and drives
13
+ * a relation through the virtual `link`,
14
+ * `unlink`, `purgeSource`, `forEachCanonicalPair` and their peers, without ever
15
+ * branching on cardinality. Each cardinality keeps the forward link, the reverse
16
+ * index and the sparse membership in lockstep inside one method on one class, so the
17
+ * lockstep can't be broken by missing a scattered `if (rs.exclusive)` site. */
18
+ export declare abstract class RelationStore implements RelationStoreView {
19
+ /** `true` → one target per source, held in the sparse field. `false` →
20
+ * a set of targets per source. The cardinality discriminant survives as a
21
+ * field because the snapshot header and the traversal and `targetOf`
22
+ * mode guards carry it. The forward mechanics stay virtual, never branched
23
+ * on it. */
24
+ readonly exclusive: boolean;
25
+ /** Backing sparse component def: `{ target: f64 }` when exclusive, a tag when
26
+ * multi. Carries membership (and the target, when exclusive). */
27
+ readonly sparse: SparseComponentDef;
28
+ /** Cleanup policy applied to this relation's sources when a target is
29
+ * destroyed. `orphan` (the default) is a no-op, the link dangles
30
+ * safely. `Store` reads this at destroy-flush off `sourcesOf`. */
31
+ readonly onDeleteTarget: OnDeleteTarget;
32
+ /** The backing sparse store instance. Owned for registration and liveness by
33
+ * `Store`, but the relation drives the forward and membership rows on it directly.
34
+ * That is the cardinality interaction this class now encapsulates. */
35
+ protected readonly _store: SparseComponentStore;
36
+ /** target `EntityID` → set of source `EntityID`s. Keyed by the full id, not
37
+ * the index, so a recycled target slot can't alias a dead target's sources.
38
+ * An entry is dropped the moment its set empties (`_unlinkReverse`). */
39
+ private readonly _reverse;
40
+ constructor(exclusive: boolean, sparse: SparseComponentDef, store: SparseComponentStore, onDeleteTarget: OnDeleteTarget);
41
+ /** Record that `src` points at `tgt` in the reverse index. */
42
+ protected _linkReverse(tgt: EntityID, src: EntityID): void;
43
+ /** Drop the `src → tgt` edge from the reverse index, removing the target's
44
+ * entry entirely once its last source is gone (so a dead-target key doesn't
45
+ * linger with an empty set). */
46
+ protected _unlinkReverse(tgt: EntityID, src: EntityID): void;
47
+ /** Drop every reverse-index entry whose **target** is no longer alive,
48
+ * returning the count dropped. The `orphan` policy intentionally
49
+ * leaves a destroyed target's reverse entry intact (the link dangles
50
+ * safely), so a long-lived source that orphan-points at a stream of
51
+ * short-lived targets and never re-targets or dies accumulates dead-target keys
52
+ * without bound. This is the reclaim primitive behind `ecs.relations.compact`,
53
+ * a cold path the host calls at scene and snapshot boundaries. It is
54
+ * cardinality-free (reverse-index only), so it lives on the base unchanged.
55
+ *
56
+ * Pure index reclaim: the **forward** links (the exclusive sparse target
57
+ * field, the multi forward set) are left untouched, so `targetOf` and
58
+ * `targetsOf` still return the dangling dead handle exactly as `orphan`
59
+ * promises. The reverse index is derived, so dropping a dead-target entry
60
+ * changes nothing observable except `sourcesOf` on that dead handle (which
61
+ * goes from the dangling sources to `[]`, meaningless either way, the target
62
+ * is gone) and is faithfully rebuilt by snapshot and restore from the surviving
63
+ * forward links. Only the **target** role can leak here: a destroyed *source*
64
+ * is already unlinked from every reverse set by `purgeSource`, so a live
65
+ * target's set never holds a dead source. `isAlive` is supplied by `Store`,
66
+ * which owns entity liveness. Deleting during `Map` key iteration is
67
+ * well-defined, already-visited and not-yet-reached keys are unaffected. */
68
+ pruneDeadReverse(isAlive: (id: EntityID) => boolean): number;
69
+ /** Sources that point at `tgt`, ascending by id (deterministic, cold-path
70
+ * sort), empty when none. */
71
+ sourcesOf(tgt: EntityID): EntityID[];
72
+ /** Drop every derived side index, the reverse index and (for multi) the
73
+ * forward target sets. Restore path only (`restoreRelations`): the side
74
+ * indices are rebuilt from scratch, so they're cleared first to stay
75
+ * idempotent when restoring into a dirty world. The backing sparse store is
76
+ * cleared separately by `restoreSparseStores`. */
77
+ resetIndices(): void;
78
+ /** Clear this relation's forward representation. Multi clears the side map.
79
+ * Exclusive clears nothing, because its forward links live in the sparse
80
+ * store, which `restoreSparseStores` clears. */
81
+ protected abstract _resetForward(): void;
82
+ /** Add a `(R, tgt)` link from `src`, keeping the forward link, the membership
83
+ * row and the reverse index in lockstep. Exclusive: replaces any existing target
84
+ * (idempotent if `tgt` is already the target). Multi: adds to the set
85
+ * (idempotent on a duplicate), establishing the membership tag on the first
86
+ * target. `src` must be live, `Store` checks before delegating. */
87
+ abstract link(src: EntityID, tgt: EntityID): void;
88
+ /** Remove `(R, tgt)` from `src`, or, when `tgt` is omitted, every target of
89
+ * `src`, keeping the forward link, the membership row and the reverse index
90
+ * in lockstep. A
91
+ * no-op when the link isn't present. */
92
+ abstract unlink(src: EntityID, tgt?: EntityID): void;
93
+ /** Purge a destroyed **source**: drop its forward link(s) and unlink it from
94
+ * every target's reverse set, but leave the sparse **membership** row alone,
95
+ * `Store._purgeSparse` drops that (for every store) right after, so this
96
+ * runs first and must not double-remove. */
97
+ abstract purgeSource(src: EntityID): void;
98
+ /** The single target of source `index`, or `undefined`. Exclusive reads the
99
+ * sparse field. Multi has no single target and returns `undefined` (matching
100
+ * the production `targetOf`-on-multi read, which the `DEV` guard rejects). */
101
+ abstract singleTargetAt(index: number): EntityID | undefined;
102
+ /** All targets of source `index`, ascending by id, one or zero for
103
+ * exclusive, the full sorted set for multi. The symmetric counterpart to
104
+ * `sourcesOf`. */
105
+ abstract targetsAt(index: number): EntityID[];
106
+ /** Whether source `index` holds any target under this relation (sparse
107
+ * membership). */
108
+ abstract hasIndex(index: number): boolean;
109
+ /** Fold `cb` over this relation's **multi** forward target sets in canonical
110
+ * order (sources ascending by index, each source's targets ascending by id),
111
+ * skipping empty sets. The single source of truth for the canonical multi
112
+ * traversal shared by `stateHash`, `snapshotRelations`, and `pairsOf`.
113
+ * Exclusive relations contribute via the sparse store, so this
114
+ * is a no-op for them. */
115
+ abstract forEachCanonicalTargetSet(cb: CanonicalTargetSetFn): void;
116
+ /** Fold `cb` over every `(source, target)` pair of this relation in canonical
117
+ * order, the `(R, *)` wildcard drive order. `createId` maps a source
118
+ * index to its full `EntityID`. Exclusive rides the backing store's
119
+ * `canonicalIndices`. Multi rides `forEachCanonicalTargetSet`. */
120
+ abstract forEachCanonicalPair(createId: MakeSourceID, cb: CanonicalPairFn): void;
121
+ /** Rebuild the reverse index from the forward links after a restore.
122
+ * Exclusive reads it back from the newly restored sparse target field (the
123
+ * reverse index is never serialized). Multi already rebuilt its reverse edges
124
+ * in `restoreAddTarget`, so this is a no-op for it. `createId` maps a source
125
+ * index to its full `EntityID`. */
126
+ abstract rebuildReverse(createId: MakeSourceID): void;
127
+ /** Restore one decoded multi forward edge `(source index → tgt)` plus its
128
+ * reverse edge (the source's full `EntityID` is `src`). Multi only, the
129
+ * snapshot header guards exclusive relations out before this is reached, so
130
+ * the exclusive override throws defensively. */
131
+ abstract restoreAddTarget(index: number, tgt: EntityID, src: EntityID): void;
132
+ }
133
+ /** Build the right `RelationStore` for a cardinality. The only construction
134
+ * site is `Store.registerRelation`, which resolves the backing sparse store and
135
+ * hands it in so the relation can drive forward and membership rows directly. */
136
+ export declare function createRelationStore(exclusive: boolean, sparse: SparseComponentDef, store: SparseComponentStore, onDeleteTarget: OnDeleteTarget): RelationStore;
137
+ /** Serialize the relation side data that does **not** live in the sparse store,
138
+ * i.e. each **multi** relation's forward target sets (`Map<source index,
139
+ * Set<target>>`). Exclusive relations store their target in the backing sparse
140
+ * field, so they ride `snapshotSparseStores` and contribute only a header
141
+ * here. The reverse index is fully derivable (from the sparse store for
142
+ * exclusive, from these sets for multi), so it is never serialized. It is
143
+ * rebuilt by `restoreRelations` + the caller's exclusive-reverse pass.
144
+ *
145
+ * Members are emitted in canonical order (sources ascending by entity index,
146
+ * each source's targets ascending by id) so the bytes are independent of
147
+ * add and remove history, the same byte-level determinism invariant the sparse
148
+ * snapshot holds. Layout (integers little-endian):
149
+ *
150
+ * u32 relationCount
151
+ * repeat relationCount times (registration and id order):
152
+ * u32 isMulti
153
+ * if multi:
154
+ * u32 sourceCount
155
+ * repeat sourceCount times (ascending source index):
156
+ * u32 sourceIndex
157
+ * u32 targetCount
158
+ * f64 × targetCount (target EntityIDs, ascending) */
159
+ export declare function snapshotRelations(relations: readonly RelationStoreView[]): Uint8Array;
160
+ /** Rebuild every relation's side indices from a `snapshotRelations` buffer and
161
+ * the already-restored sparse stores. Each relation's indices are reset first
162
+ * (idempotent into a dirty world), then:
163
+ *
164
+ * - **multi**, forward target sets and their reverse edges are rebuilt from
165
+ * `bytes` (the sets aren't in the sparse store, so the bytes are the only
166
+ * source). `createId` maps a source entity index to its full `EntityID`
167
+ * (generation from the live slot) so reverse edges key correctly.
168
+ * - **exclusive**, only the reset happens here. The reverse index is rebuilt
169
+ * by the caller from the backing sparse store (which already round-tripped
170
+ * through `restoreSparseStores`), since this function can't read it.
171
+ *
172
+ * Throws `SparseRestoreError` on any shape mismatch (relation count, an
173
+ * exclusive or multi flag that disagrees with the registered relation, a multi
174
+ * source index past `MAX_INDEX`, or a truncated or over-long buffer) rather than
175
+ * silently building a corrupt index. */
176
+ export declare function restoreRelations(relations: readonly RelationStoreView[], bytes: Uint8Array, createId: (index: number) => EntityID): void;
177
+ //# sourceMappingURL=relation_store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation_store.d.ts","sourceRoot":"","sources":["../../../src/plugins/relations/relation_store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqDK;AAGL,OAAO,EAAE,KAAK,QAAQ,EAA4C,MAAM,uBAAuB,CAAC;AAChG,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAEzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,MAAM,yBAAyB,CAAC;AAOjC;;;;;;;;;;;;;+EAa+E;AAC/E,8BAAsB,aAAc,YAAW,iBAAiB;IAC/D;;;;gBAIY;IACZ,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC;qEACiE;IACjE,SAAgB,MAAM,EAAE,kBAAkB,CAAC;IAC3C;;sEAEkE;IAClE,SAAgB,cAAc,EAAE,cAAc,CAAC;IAC/C;;0EAEsE;IACtE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAChD;;4EAEwE;IACxE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;gBAG1D,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,cAAc;IAU/B,8DAA8D;IAC9D,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;IAS1D;;oCAEgC;IAChC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;IAO5D;;;;;;;;;;;;;;;;;;;;gFAoB4E;IACrE,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,GAAG,MAAM;IAWnE;iCAC6B;IACtB,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ,EAAE;IAY3C;;;;sDAIkD;IAC3C,YAAY,IAAI,IAAI;IAO3B;;oDAEgD;IAChD,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI;IAExC;;;;uEAImE;aACnD,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;IAExD;;;4CAGwC;aACxB,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI;IAE3D;;;gDAG4C;aAC5B,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAEhD;;kFAE8E;aAC9D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAEnE;;sBAEkB;aACF,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE;IAEpD;sBACkB;aACF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAEhD;;;;;8BAK0B;aACV,yBAAyB,CAAC,EAAE,EAAE,oBAAoB,GAAG,IAAI;IAEzE;;;sEAGkE;aAClD,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,GAAG,IAAI;IAEvF;;;;uCAImC;aACnB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAE5D;;;oDAGgD;aAChC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;CACnF;AAyMD;;iFAEiF;AACjF,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,cAAc,GAC5B,aAAa,CAIf;AAYD;;;;;;;;;;;;;;;;;;;;;+DAqB+D;AAC/D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,GAAG,UAAU,CAqDrF;AAED;;;;;;;;;;;;;;;wCAewC;AACxC,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,GACnC,IAAI,CA8EN"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./relation_store-DQKSnxsm.cjs"),w=require("./arrays-Dt-Joc4i.cjs"),I=require("../index.cjs"),y=require("./assertions-z5GQd_bB.cjs");class D{constructor(t){this._host=t}_relations=[];_hasTargetCleanup=!1;_hierarchyRadixOut=new Uint32Array(1024);_hierarchyRadixC0=new Int32Array(1024);_hierarchyRadixC1=new Int32Array(1024);get stores(){return this._relations}get count(){return this._relations.length}get hasTargetCleanup(){return this._hasTargetCleanup}registerRelation(t){const e=t?.multi===!0,s=t?.exclusive===!0;if(e&&s)throw new I.ECSError(I.ECS_ERROR.RELATION_MODE_INVALID,"relations.register: a relation cannot be both exclusive and multi-target");const r=!e,i=t?.onDeleteTarget??l.DEFAULT_ON_DELETE_TARGET,n=r?this._host.pushSparseStore([l.RELATION_TARGET_FIELD],["f64"]):this._host.pushSparseStore([],[]),o=this._relations.length;return this._relations.push(l.createRelationStore(r,n,this._host.sparseStoreOf(n),i)),i!=="orphan"&&(this._hasTargetCleanup=!0),y.unsafeCast(o)}_relationOf(t){const e=t,s=this._relations[e];if(s===void 0)throw new I.ECSError(I.ECS_ERROR.RELATION_NOT_REGISTERED,`relation ${e} is not registered`);return s}addRelation(t,e,s){const r=this._relationOf(e);this._host.isAlive(t)&&this._host.isAlive(s)&&r.link(t,s)}removeRelation(t,e,s){const r=this._relationOf(e);this._host.isAlive(t)&&r.unlink(t,s)}targetOf(t,e){return this._relationOf(e).singleTargetAt(l.getEntityIndex(t))}targetsOf(t,e){return this._relationOf(e).targetsAt(l.getEntityIndex(t))}sourcesOf(t,e){return this._relationOf(e).sourcesOf(t)}hasRelation(t,e){return this._host.hasSparse(t,this._relationOf(e).sparse)}pairsOf(t){const e=this._relationOf(t),s=[],r=this._host.generations();return e.forEachCanonicalPair(i=>l.createEntityId(i,r[i]),(i,n)=>s.push([i,n])),s}sourcesOfAny(t){const e=[],s=this._relations;for(let r=0;r<s.length;r++){const i=y.unsafeCast(r),n=s[r].sourcesOf(t);for(let o=0;o<n.length;o++)e.push([i,n[o]])}return e}relationBackingSparseId(t){return this._relationOf(t).sparse}forEachTargetMatch(t,e,s,r,i,n){const{sparseIncludes:o,sparseExcludes:u,includesDisabled:a}=i,c=this._relations;if(c.length===0)return;const g=new Set;for(let h=0;h<c.length;h++){const f=c[h].sourcesOf(t);for(let p=0;p<f.length;p++)g.add(f[p])}if(g.size===0)return;const v=Array.from(g).sort((h,f)=>h-f),S=this._host.sparseStores(),R=this._host.entityArchetypes(),_=this._host.entityRows(),O=this._host.archetypes();for(let h=0;h<v.length;h++){const f=y.unsafeCast(v[h]),p=l.getEntityIndex(f),T=R[p];if(T===l.UNASSIGNED)continue;const C=O[T],A=C.mask;if(!A.contains(e)||s!==null&&A.overlaps(s)||r!==null&&!A.overlaps(r))continue;let x=!0;for(let d=0;d<o.length;d++)if(!S[o[d]].has(p)){x=!1;break}if(x){for(let d=0;d<u.length;d++)if(S[u[d]].has(p)){x=!1;break}if(x){if(!a){const d=_[p];if(d!==l.UNASSIGNED&&d>=C.enabledCount)continue}n(f)}}}}compactRelations(){const t=this._relations;if(t.length===0)return 0;const e=r=>this._host.isAlive(r);let s=0;for(let r=0;r<t.length;r++)s+=t[r].pruneDeadReverse(e);return s}ancestorsOf(t,e){const s=this._relationOf(e),r=this._host.sparseStoreOf(s.sparse),i=[t],n=new Set([l.getEntityIndex(t)]);let o=t;for(;;){const u=r.getField(l.getEntityIndex(o),0);if(u===void 0)break;const a=y.unsafeCast(u);if(!this._host.isAlive(a)){i.push(a);break}const c=l.getEntityIndex(a);if(n.has(c))break;n.add(c),o=a,i.push(o)}return i}rootOf(t,e){const s=this.ancestorsOf(t,e);return s[s.length-1]}cascadeOf(t,e){const s=this._relationOf(e),r=[t],i=new Set([l.getEntityIndex(t)]);for(let n=0;n<r.length;n++){const o=s.sourcesOf(r[n]);for(let u=0;u<o.length;u++){const a=o[u],c=l.getEntityIndex(a);i.has(c)||(i.add(c),r.push(a))}}return r}purgeSource(t){const e=this._relations;for(let s=0;s<e.length;s++)e[s].purgeSource(t)}cleanupTarget(t,e){const s=this._relations;for(let r=0;r<s.length;r++){const i=s[r];if(i.onDeleteTarget==="orphan")continue;const n=i.sourcesOf(t);if(n.length!==0){if(i.onDeleteTarget==="delete"){for(let o=0;o<n.length;o++)e.push(n[o]);continue}for(let o=0;o<n.length;o++)i.unlink(n[o],t)}}}forEachHierarchyMatch(t,e,s,r,i,n,o,u){const a=this._relationOf(n),c=[];if(this._host.forEachSparseMatch(t,e,s,r,i,_=>c.push(_)),c.length===0)return;this._hierarchyRadixOut=w.radixSortByIndex(c,this._hierarchyRadixOut,this._hierarchyRadixC0,this._hierarchyRadixC1);const g=this._host.sparseStoreOf(a.sparse),v=new Map,S=new Set,R=[];for(let _=0;_<c.length;_++){const O=c[_],h=this._hierarchyDepthOf(l.getEntityIndex(O),g,v,S);if(h>o)continue;let f=R[h];f===void 0&&(f=[],R[h]=f),f.push(O)}for(let _=0;_<R.length;_++){const O=R[_];if(O!==void 0)for(let h=0;h<O.length;h++)u(O[h])}}_hierarchyDepthOf(t,e,s,r){const i=[];let n=t,o=0;for(;;){const a=s.get(n);if(a!==void 0){o=a;break}const c=e.getField(n,0);let g=-1;if(c!==void 0){const v=y.unsafeCast(c);this._host.isAlive(v)&&(g=l.getEntityIndex(v))}if(g===-1){s.set(n,0),o=0;break}if(r.has(g)){s.set(n,0),o=0;break}i.push(n),r.add(n),n=g}let u=o;for(let a=i.length-1;a>=0;a--)u+=1,s.set(i[a],u),r.delete(i[a]);return s.get(t)}}class k{_service;constructor(t){this._service=t}register(t){return this._service.registerRelation(t)}get count(){return this._service.count}add(t,e,s){return this._service.addRelation(t,e,s),this}remove(t,e,s){return this._service.removeRelation(t,e,s),this}has(t,e){return this._service.hasRelation(t,e)}targetOf(t,e){return this._service.targetOf(t,e)}targetsOf(t,e){return this._service.targetsOf(t,e)}sourcesOf(t,e){return this._service.sourcesOf(t,e)}pairsOf(t){return this._service.pairsOf(t)}sourcesOfAny(t){return this._service.sourcesOfAny(t)}ancestorsOf(t,e){return this._service.ancestorsOf(t,e)}rootOf(t,e){return this._service.rootOf(t,e)}cascadeOf(t,e){return this._service.cascadeOf(t,e)}compact(){return this._service.compactRelations()}}function b(E,t){return E.relations.register({exclusive:!0,onDeleteTarget:t?.onDeleteTarget??"clear"})}function N(E,t){return E.relations.register({exclusive:!0,onDeleteTarget:t?.onDeleteTarget??"delete"})}function M(){return{name:"relations",install(E){const t=E.store,e=new D(t.relationHost());return t.installRelations(e),{relations:new k(e)}}}}exports.ECSRelations=k;exports.registerChildOf=N;exports.registerIsA=b;exports.relations=M;
@@ -0,0 +1 @@
1
+ export * from "./relations/index.cjs";
@@ -0,0 +1 @@
1
+ export * from "./relations/index.js";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./relation_store-RBhpcE28.cjs"),D=require("./arrays-Dt-Joc4i.cjs"),l=require("../index.development.cjs"),A=require("./assertions-z5GQd_bB.cjs");class N{constructor(e){this._host=e}_relations=[];_hasTargetCleanup=!1;_hierarchyRadixOut=new Uint32Array(1024);_hierarchyRadixC0=new Int32Array(1024);_hierarchyRadixC1=new Int32Array(1024);get stores(){return this._relations}get count(){return this._relations.length}get hasTargetCleanup(){return this._hasTargetCleanup}registerRelation(e){const t=e?.multi===!0,r=e?.exclusive===!0;if(t&&r)throw new l.ECSError(l.ECS_ERROR.RELATION_MODE_INVALID,"relations.register: a relation cannot be both exclusive and multi-target");const s=!t,i=e?.onDeleteTarget??a.DEFAULT_ON_DELETE_TARGET,n=s?this._host.pushSparseStore([a.RELATION_TARGET_FIELD],["f64"]):this._host.pushSparseStore([],[]),o=this._relations.length;return this._relations.push(a.createRelationStore(s,n,this._host.sparseStoreOf(n),i)),i!=="orphan"&&(this._hasTargetCleanup=!0),A.unsafeCast(o)}_relationOf(e){const t=e,r=this._relations[t];if(r===void 0)throw new l.ECSError(l.ECS_ERROR.RELATION_NOT_REGISTERED,`relation ${t} is not registered`);return r}addRelation(e,t,r){const s=this._relationOf(t);if(!this._host.isAlive(e))throw a.entityNotAliveError("addRelation",e,"source");if(!this._host.isAlive(r))throw a.entityNotAliveError("addRelation",r,"target");s.link(e,r)}removeRelation(e,t,r){const s=this._relationOf(t);if(!this._host.isAlive(e))throw a.entityNotAliveError("removeRelation",e,"source");s.unlink(e,r)}targetOf(e,t){const r=this._relationOf(t);{if(!r.exclusive)throw new l.ECSError(l.ECS_ERROR.RELATION_MODE_MISMATCH,"targetOf: relation is multi-target, use targetsOf");if(!this._host.isAlive(e))throw a.entityNotAliveError("targetOf",e)}return r.singleTargetAt(a.getEntityIndex(e))}targetsOf(e,t){const r=this._relationOf(t);if(!this._host.isAlive(e))throw a.entityNotAliveError("targetsOf",e);return r.targetsAt(a.getEntityIndex(e))}sourcesOf(e,t){return this._relationOf(t).sourcesOf(e)}hasRelation(e,t){return this._host.hasSparse(e,this._relationOf(t).sparse)}pairsOf(e){const t=this._relationOf(e),r=[],s=this._host.generations();return t.forEachCanonicalPair(i=>a.createEntityId(i,s[i]),(i,n)=>r.push([i,n])),r}sourcesOfAny(e){const t=[],r=this._relations;for(let s=0;s<r.length;s++){const i=A.unsafeCast(s),n=r[s].sourcesOf(e);for(let o=0;o<n.length;o++)t.push([i,n[o]])}return t}relationBackingSparseId(e){return this._relationOf(e).sparse}forEachTargetMatch(e,t,r,s,i,n){const{sparseIncludes:o,sparseExcludes:f,includesDisabled:c}=i,h=this._relations;if(h.length===0)return;const d=new Set;for(let u=0;u<h.length;u++){const _=h[u].sourcesOf(e);for(let R=0;R<_.length;R++)d.add(_[R])}if(d.size===0)return;const p=Array.from(d).sort((u,_)=>u-_),S=this._host.sparseStores(),y=this._host.entityArchetypes(),E=this._host.entityRows(),O=this._host.archetypes();for(let u=0;u<p.length;u++){const _=A.unsafeCast(p[u]),R=a.getEntityIndex(_),x=y[R];if(x===a.UNASSIGNED)continue;const w=O[x],I=w.mask;if(!I.contains(t)||r!==null&&I.overlaps(r)||s!==null&&!I.overlaps(s))continue;let C=!0;for(let g=0;g<o.length;g++)if(!S[o[g]].has(R)){C=!1;break}if(C){for(let g=0;g<f.length;g++)if(S[f[g]].has(R)){C=!1;break}if(C){if(!c){const g=E[R];if(g!==a.UNASSIGNED&&g>=w.enabledCount)continue}n(_)}}}}compactRelations(){const e=this._relations;if(e.length===0)return 0;const t=s=>this._host.isAlive(s);let r=0;for(let s=0;s<e.length;s++)r+=e[s].pruneDeadReverse(t);return r}ancestorsOf(e,t){const r=this._relationOf(t);{if(!r.exclusive)throw new l.ECSError(l.ECS_ERROR.RELATION_MODE_MISMATCH,"ancestorsOf: relation is multi-target, traversal needs an exclusive (parent) chain");if(!this._host.isAlive(e))throw a.entityNotAliveError("ancestorsOf",e)}const s=this._host.sparseStoreOf(r.sparse),i=[e],n=new Set([a.getEntityIndex(e)]);let o=e;for(;;){const f=s.getField(a.getEntityIndex(o),0);if(f===void 0)break;const c=A.unsafeCast(f);if(!this._host.isAlive(c)){i.push(c);break}const h=a.getEntityIndex(c);if(n.has(h))throw new l.ECSError(l.ECS_ERROR.RELATION_CYCLE,`ancestorsOf: cycle in relation chain at entity index ${h}`);n.add(h),o=c,i.push(o)}return i}rootOf(e,t){const r=this.ancestorsOf(e,t);return r[r.length-1]}cascadeOf(e,t){const r=this._relationOf(t);{if(!r.exclusive)throw new l.ECSError(l.ECS_ERROR.RELATION_MODE_MISMATCH,"cascadeOf: relation is multi-target, traversal needs an exclusive (parent) chain");if(!this._host.isAlive(e))throw a.entityNotAliveError("cascadeOf",e)}const s=[e],i=new Set([a.getEntityIndex(e)]);for(let n=0;n<s.length;n++){const o=r.sourcesOf(s[n]);for(let f=0;f<o.length;f++){const c=o[f],h=a.getEntityIndex(c);if(i.has(h))throw new l.ECSError(l.ECS_ERROR.RELATION_CYCLE,`cascadeOf: cycle in relation chain at entity index ${h}`);i.add(h),s.push(c)}}return s}purgeSource(e){const t=this._relations;for(let r=0;r<t.length;r++)t[r].purgeSource(e)}cleanupTarget(e,t){const r=this._relations;for(let s=0;s<r.length;s++){const i=r[s];if(i.onDeleteTarget==="orphan")continue;const n=i.sourcesOf(e);if(n.length!==0){if(i.onDeleteTarget==="delete"){for(let o=0;o<n.length;o++)t.push(n[o]);continue}for(let o=0;o<n.length;o++)i.unlink(n[o],e)}}}forEachHierarchyMatch(e,t,r,s,i,n,o,f){const c=this._relationOf(n);if(!c.exclusive)throw new l.ECSError(l.ECS_ERROR.RELATION_MODE_MISMATCH,"hierarchy(): relation is multi-target, depth ordering needs an exclusive (parent) chain");const h=[];if(this._host.forEachSparseMatch(e,t,r,s,i,E=>h.push(E)),h.length===0)return;this._hierarchyRadixOut=D.radixSortByIndex(h,this._hierarchyRadixOut,this._hierarchyRadixC0,this._hierarchyRadixC1);const d=this._host.sparseStoreOf(c.sparse),p=new Map,S=new Set,y=[];for(let E=0;E<h.length;E++){const O=h[E],u=this._hierarchyDepthOf(a.getEntityIndex(O),d,p,S);if(u>o)continue;let _=y[u];_===void 0&&(_=[],y[u]=_),_.push(O)}for(let E=0;E<y.length;E++){const O=y[E];if(O!==void 0)for(let u=0;u<O.length;u++)f(O[u])}}_hierarchyDepthOf(e,t,r,s){const i=[];let n=e,o=0;for(;;){const c=r.get(n);if(c!==void 0){o=c;break}const h=t.getField(n,0);let d=-1;if(h!==void 0){const p=A.unsafeCast(h);this._host.isAlive(p)&&(d=a.getEntityIndex(p))}if(d===-1){r.set(n,0),o=0;break}if(s.has(d))throw new l.ECSError(l.ECS_ERROR.RELATION_CYCLE,`hierarchy(): cycle in relation chain at entity index ${d}`);i.push(n),s.add(n),n=d}let f=o;for(let c=i.length-1;c>=0;c--)f+=1,r.set(i[c],f),s.delete(i[c]);return r.get(e)}}class T{_service;constructor(e){this._service=e}register(e){return this._service.registerRelation(e)}get count(){return this._service.count}add(e,t,r){return this._service.addRelation(e,t,r),this}remove(e,t,r){return this._service.removeRelation(e,t,r),this}has(e,t){return this._service.hasRelation(e,t)}targetOf(e,t){return this._service.targetOf(e,t)}targetsOf(e,t){return this._service.targetsOf(e,t)}sourcesOf(e,t){return this._service.sourcesOf(e,t)}pairsOf(e){return this._service.pairsOf(e)}sourcesOfAny(e){return this._service.sourcesOfAny(e)}ancestorsOf(e,t){return this._service.ancestorsOf(e,t)}rootOf(e,t){return this._service.rootOf(e,t)}cascadeOf(e,t){return this._service.cascadeOf(e,t)}compact(){return this._service.compactRelations()}}function M(v,e){return v.relations.register({exclusive:!0,onDeleteTarget:e?.onDeleteTarget??"clear"})}function k(v,e){return v.relations.register({exclusive:!0,onDeleteTarget:e?.onDeleteTarget??"delete"})}function L(){return{name:"relations",install(v){const e=v.store,t=new N(e.relationHost());return e.installRelations(t),{relations:new T(t)}}}}exports.ECSRelations=T;exports.registerChildOf=k;exports.registerIsA=M;exports.relations=L;