@adobe/ecs 0.0.0-stage → 0.2.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 (2883) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/dist/implementation/compiler/access.d.ts +6 -0
  4. package/dist/implementation/compiler/access.js +159 -0
  5. package/dist/implementation/compiler/access.js.map +1 -0
  6. package/dist/implementation/compiler/archetypes.d.ts +17 -0
  7. package/dist/implementation/compiler/archetypes.js +141 -0
  8. package/dist/implementation/compiler/archetypes.js.map +1 -0
  9. package/dist/implementation/compiler/assign.d.ts +7 -0
  10. package/dist/implementation/compiler/assign.js +162 -0
  11. package/dist/implementation/compiler/assign.js.map +1 -0
  12. package/dist/implementation/compiler/augmentations.d.ts +25 -0
  13. package/dist/implementation/compiler/augmentations.js +943 -0
  14. package/dist/implementation/compiler/augmentations.js.map +1 -0
  15. package/dist/implementation/compiler/bind.d.ts +9 -0
  16. package/dist/implementation/compiler/bind.js +83 -0
  17. package/dist/implementation/compiler/bind.js.map +1 -0
  18. package/dist/implementation/compiler/body-access.d.ts +32 -0
  19. package/dist/implementation/compiler/body-access.js +479 -0
  20. package/dist/implementation/compiler/body-access.js.map +1 -0
  21. package/dist/implementation/compiler/booleans.d.ts +8 -0
  22. package/dist/implementation/compiler/booleans.js +35 -0
  23. package/dist/implementation/compiler/booleans.js.map +1 -0
  24. package/dist/implementation/compiler/branches.d.ts +16 -0
  25. package/dist/implementation/compiler/branches.js +38 -0
  26. package/dist/implementation/compiler/branches.js.map +1 -0
  27. package/dist/implementation/compiler/calls.d.ts +6 -0
  28. package/dist/implementation/compiler/calls.js +401 -0
  29. package/dist/implementation/compiler/calls.js.map +1 -0
  30. package/dist/implementation/compiler/columns.d.ts +26 -0
  31. package/dist/implementation/compiler/columns.js +53 -0
  32. package/dist/implementation/compiler/columns.js.map +1 -0
  33. package/dist/implementation/compiler/compile-kernel.d.ts +37 -0
  34. package/dist/implementation/compiler/compile-kernel.js +183 -0
  35. package/dist/implementation/compiler/compile-kernel.js.map +1 -0
  36. package/dist/implementation/compiler/compiler.d.ts +6 -0
  37. package/dist/implementation/compiler/compiler.js +7 -0
  38. package/dist/implementation/compiler/compiler.js.map +1 -0
  39. package/dist/implementation/compiler/data.d.ts +30 -0
  40. package/dist/implementation/compiler/data.js +77 -0
  41. package/dist/implementation/compiler/data.js.map +1 -0
  42. package/dist/implementation/compiler/describe.d.ts +41 -0
  43. package/dist/implementation/compiler/describe.js +510 -0
  44. package/dist/implementation/compiler/describe.js.map +1 -0
  45. package/dist/implementation/compiler/estree.d.ts +18 -0
  46. package/dist/implementation/compiler/estree.js +62 -0
  47. package/dist/implementation/compiler/estree.js.map +1 -0
  48. package/dist/implementation/compiler/expression.d.ts +6 -0
  49. package/dist/implementation/compiler/expression.js +153 -0
  50. package/dist/implementation/compiler/expression.js.map +1 -0
  51. package/dist/implementation/compiler/failure.d.ts +27 -0
  52. package/dist/implementation/compiler/failure.js +24 -0
  53. package/dist/implementation/compiler/failure.js.map +1 -0
  54. package/dist/implementation/compiler/identify.d.ts +43 -0
  55. package/dist/implementation/compiler/identify.js +207 -0
  56. package/dist/implementation/compiler/identify.js.map +1 -0
  57. package/dist/implementation/compiler/index.d.ts +5 -0
  58. package/dist/implementation/compiler/index.js +7 -0
  59. package/dist/implementation/compiler/index.js.map +1 -0
  60. package/dist/implementation/compiler/inferred.d.ts +32 -0
  61. package/dist/implementation/compiler/inferred.js +185 -0
  62. package/dist/implementation/compiler/inferred.js.map +1 -0
  63. package/dist/implementation/compiler/inline-kernels.d.ts +7 -0
  64. package/dist/implementation/compiler/inline-kernels.js +16 -0
  65. package/dist/implementation/compiler/inline-kernels.js.map +1 -0
  66. package/dist/implementation/compiler/input-schemas.d.ts +23 -0
  67. package/dist/implementation/compiler/input-schemas.js +102 -0
  68. package/dist/implementation/compiler/input-schemas.js.map +1 -0
  69. package/dist/implementation/compiler/ir.d.ts +226 -0
  70. package/dist/implementation/compiler/ir.js +28 -0
  71. package/dist/implementation/compiler/ir.js.map +1 -0
  72. package/dist/implementation/compiler/kernel-id.d.ts +17 -0
  73. package/dist/implementation/compiler/kernel-id.js +28 -0
  74. package/dist/implementation/compiler/kernel-id.js.map +1 -0
  75. package/dist/implementation/compiler/key.d.ts +21 -0
  76. package/dist/implementation/compiler/key.js +21 -0
  77. package/dist/implementation/compiler/key.js.map +1 -0
  78. package/dist/implementation/compiler/link.d.ts +83 -0
  79. package/dist/implementation/compiler/link.js +186 -0
  80. package/dist/implementation/compiler/link.js.map +1 -0
  81. package/dist/implementation/compiler/lists.d.ts +50 -0
  82. package/dist/implementation/compiler/lists.js +210 -0
  83. package/dist/implementation/compiler/lists.js.map +1 -0
  84. package/dist/implementation/compiler/lookups.d.ts +24 -0
  85. package/dist/implementation/compiler/lookups.js +118 -0
  86. package/dist/implementation/compiler/lookups.js.map +1 -0
  87. package/dist/implementation/compiler/math.d.ts +3 -0
  88. package/dist/implementation/compiler/math.js +10 -0
  89. package/dist/implementation/compiler/math.js.map +1 -0
  90. package/dist/implementation/compiler/memory-compiler.d.ts +61 -0
  91. package/dist/implementation/compiler/memory-compiler.js +271 -0
  92. package/dist/implementation/compiler/memory-compiler.js.map +1 -0
  93. package/dist/implementation/compiler/module-scope.d.ts +53 -0
  94. package/dist/implementation/compiler/module-scope.js +121 -0
  95. package/dist/implementation/compiler/module-scope.js.map +1 -0
  96. package/dist/implementation/compiler/module-value.d.ts +15 -0
  97. package/dist/implementation/compiler/module-value.js +139 -0
  98. package/dist/implementation/compiler/module-value.js.map +1 -0
  99. package/dist/implementation/compiler/out.d.ts +4 -0
  100. package/dist/implementation/compiler/out.js +2 -0
  101. package/dist/implementation/compiler/out.js.map +1 -0
  102. package/dist/implementation/compiler/oxc.d.ts +41 -0
  103. package/dist/implementation/compiler/oxc.js +80 -0
  104. package/dist/implementation/compiler/oxc.js.map +1 -0
  105. package/dist/implementation/compiler/package-copies.d.ts +60 -0
  106. package/dist/implementation/compiler/package-copies.js +140 -0
  107. package/dist/implementation/compiler/package-copies.js.map +1 -0
  108. package/dist/implementation/compiler/passes.d.ts +25 -0
  109. package/dist/implementation/compiler/passes.js +24 -0
  110. package/dist/implementation/compiler/passes.js.map +1 -0
  111. package/dist/implementation/compiler/paths.d.ts +5 -0
  112. package/dist/implementation/compiler/paths.js +20 -0
  113. package/dist/implementation/compiler/paths.js.map +1 -0
  114. package/dist/implementation/compiler/plugin.d.ts +18 -0
  115. package/dist/implementation/compiler/plugin.js +397 -0
  116. package/dist/implementation/compiler/plugin.js.map +1 -0
  117. package/dist/implementation/compiler/posix.d.ts +8 -0
  118. package/dist/implementation/compiler/posix.js +205 -0
  119. package/dist/implementation/compiler/posix.js.map +1 -0
  120. package/dist/implementation/compiler/predicates.d.ts +11 -0
  121. package/dist/implementation/compiler/predicates.js +281 -0
  122. package/dist/implementation/compiler/predicates.js.map +1 -0
  123. package/dist/implementation/compiler/print.d.ts +12 -0
  124. package/dist/implementation/compiler/print.js +116 -0
  125. package/dist/implementation/compiler/print.js.map +1 -0
  126. package/dist/implementation/compiler/program.d.ts +10 -0
  127. package/dist/implementation/compiler/program.js +258 -0
  128. package/dist/implementation/compiler/program.js.map +1 -0
  129. package/dist/implementation/compiler/public.d.ts +1 -0
  130. package/dist/implementation/compiler/public.js +3 -0
  131. package/dist/implementation/compiler/public.js.map +1 -0
  132. package/dist/implementation/compiler/scalar.d.ts +8 -0
  133. package/dist/implementation/compiler/scalar.js +47 -0
  134. package/dist/implementation/compiler/scalar.js.map +1 -0
  135. package/dist/implementation/compiler/scope.d.ts +24 -0
  136. package/dist/implementation/compiler/scope.js +4 -0
  137. package/dist/implementation/compiler/scope.js.map +1 -0
  138. package/dist/implementation/compiler/serialize.d.ts +2 -0
  139. package/dist/implementation/compiler/serialize.js +15 -0
  140. package/dist/implementation/compiler/serialize.js.map +1 -0
  141. package/dist/implementation/compiler/signature.d.ts +60 -0
  142. package/dist/implementation/compiler/signature.js +188 -0
  143. package/dist/implementation/compiler/signature.js.map +1 -0
  144. package/dist/implementation/compiler/snapshot.d.ts +23 -0
  145. package/dist/implementation/compiler/snapshot.js +18 -0
  146. package/dist/implementation/compiler/snapshot.js.map +1 -0
  147. package/dist/implementation/compiler/source-map.d.ts +34 -0
  148. package/dist/implementation/compiler/source-map.js +131 -0
  149. package/dist/implementation/compiler/source-map.js.map +1 -0
  150. package/dist/implementation/compiler/spawns.d.ts +41 -0
  151. package/dist/implementation/compiler/spawns.js +164 -0
  152. package/dist/implementation/compiler/spawns.js.map +1 -0
  153. package/dist/implementation/compiler/stamps.d.ts +13 -0
  154. package/dist/implementation/compiler/stamps.js +44 -0
  155. package/dist/implementation/compiler/stamps.js.map +1 -0
  156. package/dist/implementation/compiler/statement.d.ts +7 -0
  157. package/dist/implementation/compiler/statement.js +112 -0
  158. package/dist/implementation/compiler/statement.js.map +1 -0
  159. package/dist/implementation/compiler/terminal.d.ts +8 -0
  160. package/dist/implementation/compiler/terminal.js +51 -0
  161. package/dist/implementation/compiler/terminal.js.map +1 -0
  162. package/dist/implementation/compiler/transform.d.ts +81 -0
  163. package/dist/implementation/compiler/transform.js +483 -0
  164. package/dist/implementation/compiler/transform.js.map +1 -0
  165. package/dist/implementation/compiler/type-schemas.d.ts +130 -0
  166. package/dist/implementation/compiler/type-schemas.js +701 -0
  167. package/dist/implementation/compiler/type-schemas.js.map +1 -0
  168. package/dist/implementation/compiler/unit.d.ts +108 -0
  169. package/dist/implementation/compiler/unit.js +39 -0
  170. package/dist/implementation/compiler/unit.js.map +1 -0
  171. package/dist/implementation/compiler/value.d.ts +115 -0
  172. package/dist/implementation/compiler/value.js +9 -0
  173. package/dist/implementation/compiler/value.js.map +1 -0
  174. package/dist/implementation/compiler/wat.d.ts +12 -0
  175. package/dist/implementation/compiler/wat.js +379 -0
  176. package/dist/implementation/compiler/wat.js.map +1 -0
  177. package/dist/implementation/index.d.ts +2 -0
  178. package/dist/implementation/index.js +4 -0
  179. package/dist/implementation/index.js.map +1 -0
  180. package/dist/implementation/world/activate.d.ts +21 -0
  181. package/dist/implementation/world/activate.js +137 -0
  182. package/dist/implementation/world/activate.js.map +1 -0
  183. package/dist/implementation/world/archetype.d.ts +191 -0
  184. package/dist/implementation/world/archetype.js +402 -0
  185. package/dist/implementation/world/archetype.js.map +1 -0
  186. package/dist/implementation/world/arrays.d.ts +29 -0
  187. package/dist/implementation/world/arrays.js +34 -0
  188. package/dist/implementation/world/arrays.js.map +1 -0
  189. package/dist/implementation/world/arrivals.d.ts +52 -0
  190. package/dist/implementation/world/arrivals.js +146 -0
  191. package/dist/implementation/world/arrivals.js.map +1 -0
  192. package/dist/implementation/world/attach-kernel.d.ts +10 -0
  193. package/dist/implementation/world/attach-kernel.js +30 -0
  194. package/dist/implementation/world/attach-kernel.js.map +1 -0
  195. package/dist/implementation/world/batches.d.ts +18 -0
  196. package/dist/implementation/world/batches.js +208 -0
  197. package/dist/implementation/world/batches.js.map +1 -0
  198. package/dist/implementation/world/buffer.d.ts +60 -0
  199. package/dist/implementation/world/buffer.js +138 -0
  200. package/dist/implementation/world/buffer.js.map +1 -0
  201. package/dist/implementation/world/cascade.d.ts +28 -0
  202. package/dist/implementation/world/cascade.js +139 -0
  203. package/dist/implementation/world/cascade.js.map +1 -0
  204. package/dist/implementation/world/cells.d.ts +7 -0
  205. package/dist/implementation/world/cells.js +22 -0
  206. package/dist/implementation/world/cells.js.map +1 -0
  207. package/dist/implementation/world/check-kernel.d.ts +12 -0
  208. package/dist/implementation/world/check-kernel.js +119 -0
  209. package/dist/implementation/world/check-kernel.js.map +1 -0
  210. package/dist/implementation/world/claims.d.ts +13 -0
  211. package/dist/implementation/world/claims.js +51 -0
  212. package/dist/implementation/world/claims.js.map +1 -0
  213. package/dist/implementation/world/closure.d.ts +12 -0
  214. package/dist/implementation/world/closure.js +44 -0
  215. package/dist/implementation/world/closure.js.map +1 -0
  216. package/dist/implementation/world/command-ring.d.ts +97 -0
  217. package/dist/implementation/world/command-ring.js +439 -0
  218. package/dist/implementation/world/command-ring.js.map +1 -0
  219. package/dist/implementation/world/commands.d.ts +25 -0
  220. package/dist/implementation/world/commands.js +96 -0
  221. package/dist/implementation/world/commands.js.map +1 -0
  222. package/dist/implementation/world/create.d.ts +101 -0
  223. package/dist/implementation/world/create.js +1009 -0
  224. package/dist/implementation/world/create.js.map +1 -0
  225. package/dist/implementation/world/directories.d.ts +28 -0
  226. package/dist/implementation/world/directories.js +68 -0
  227. package/dist/implementation/world/directories.js.map +1 -0
  228. package/dist/implementation/world/entities.d.ts +77 -0
  229. package/dist/implementation/world/entities.js +137 -0
  230. package/dist/implementation/world/entities.js.map +1 -0
  231. package/dist/implementation/world/execute.d.ts +30 -0
  232. package/dist/implementation/world/execute.js +757 -0
  233. package/dist/implementation/world/execute.js.map +1 -0
  234. package/dist/implementation/world/failures.d.ts +53 -0
  235. package/dist/implementation/world/failures.js +37 -0
  236. package/dist/implementation/world/failures.js.map +1 -0
  237. package/dist/implementation/world/finalizers.d.ts +65 -0
  238. package/dist/implementation/world/finalizers.js +436 -0
  239. package/dist/implementation/world/finalizers.js.map +1 -0
  240. package/dist/implementation/world/gpu.d.ts +64 -0
  241. package/dist/implementation/world/gpu.js +326 -0
  242. package/dist/implementation/world/gpu.js.map +1 -0
  243. package/dist/implementation/world/holders.d.ts +21 -0
  244. package/dist/implementation/world/holders.js +66 -0
  245. package/dist/implementation/world/holders.js.map +1 -0
  246. package/dist/implementation/world/index-build.d.ts +88 -0
  247. package/dist/implementation/world/index-build.js +405 -0
  248. package/dist/implementation/world/index-build.js.map +1 -0
  249. package/dist/implementation/world/index-hash.d.ts +138 -0
  250. package/dist/implementation/world/index-hash.js +809 -0
  251. package/dist/implementation/world/index-hash.js.map +1 -0
  252. package/dist/implementation/world/index-keys.d.ts +75 -0
  253. package/dist/implementation/world/index-keys.js +252 -0
  254. package/dist/implementation/world/index-keys.js.map +1 -0
  255. package/dist/implementation/world/index-lookups.d.ts +76 -0
  256. package/dist/implementation/world/index-lookups.js +572 -0
  257. package/dist/implementation/world/index-lookups.js.map +1 -0
  258. package/dist/implementation/world/index-order.d.ts +21 -0
  259. package/dist/implementation/world/index-order.js +174 -0
  260. package/dist/implementation/world/index-order.js.map +1 -0
  261. package/dist/implementation/world/index-readers.d.ts +101 -0
  262. package/dist/implementation/world/index-readers.js +341 -0
  263. package/dist/implementation/world/index-readers.js.map +1 -0
  264. package/dist/implementation/world/index-sorted.d.ts +120 -0
  265. package/dist/implementation/world/index-sorted.js +637 -0
  266. package/dist/implementation/world/index-sorted.js.map +1 -0
  267. package/dist/implementation/world/indexes.d.ts +134 -0
  268. package/dist/implementation/world/indexes.js +1116 -0
  269. package/dist/implementation/world/indexes.js.map +1 -0
  270. package/dist/implementation/world/input.d.ts +3 -0
  271. package/dist/implementation/world/input.js +17 -0
  272. package/dist/implementation/world/input.js.map +1 -0
  273. package/dist/implementation/world/intrinsics.d.ts +5 -0
  274. package/dist/implementation/world/intrinsics.js +33 -0
  275. package/dist/implementation/world/intrinsics.js.map +1 -0
  276. package/dist/implementation/world/join.d.ts +26 -0
  277. package/dist/implementation/world/join.js +766 -0
  278. package/dist/implementation/world/join.js.map +1 -0
  279. package/dist/implementation/world/joined-observer.d.ts +208 -0
  280. package/dist/implementation/world/joined-observer.js +810 -0
  281. package/dist/implementation/world/joined-observer.js.map +1 -0
  282. package/dist/implementation/world/joining.d.ts +392 -0
  283. package/dist/implementation/world/joining.js +187 -0
  284. package/dist/implementation/world/joining.js.map +1 -0
  285. package/dist/implementation/world/journal.d.ts +22 -0
  286. package/dist/implementation/world/journal.js +25 -0
  287. package/dist/implementation/world/journal.js.map +1 -0
  288. package/dist/implementation/world/kernel-indexes.d.ts +37 -0
  289. package/dist/implementation/world/kernel-indexes.js +182 -0
  290. package/dist/implementation/world/kernel-indexes.js.map +1 -0
  291. package/dist/implementation/world/kernel.d.ts +392 -0
  292. package/dist/implementation/world/kernel.js +5 -0
  293. package/dist/implementation/world/kernel.js.map +1 -0
  294. package/dist/implementation/world/kernels.d.ts +88 -0
  295. package/dist/implementation/world/kernels.js +356 -0
  296. package/dist/implementation/world/kernels.js.map +1 -0
  297. package/dist/implementation/world/layout-directory.d.ts +123 -0
  298. package/dist/implementation/world/layout-directory.js +273 -0
  299. package/dist/implementation/world/layout-directory.js.map +1 -0
  300. package/dist/implementation/world/lists.d.ts +86 -0
  301. package/dist/implementation/world/lists.js +258 -0
  302. package/dist/implementation/world/lists.js.map +1 -0
  303. package/dist/implementation/world/lookup-keys.d.ts +20 -0
  304. package/dist/implementation/world/lookup-keys.js +48 -0
  305. package/dist/implementation/world/lookup-keys.js.map +1 -0
  306. package/dist/implementation/world/loop.d.ts +73 -0
  307. package/dist/implementation/world/loop.js +252 -0
  308. package/dist/implementation/world/loop.js.map +1 -0
  309. package/dist/implementation/world/memory.d.ts +40 -0
  310. package/dist/implementation/world/memory.js +65 -0
  311. package/dist/implementation/world/memory.js.map +1 -0
  312. package/dist/implementation/world/mirror.d.ts +125 -0
  313. package/dist/implementation/world/mirror.js +570 -0
  314. package/dist/implementation/world/mirror.js.map +1 -0
  315. package/dist/implementation/world/move-log.d.ts +107 -0
  316. package/dist/implementation/world/move-log.js +165 -0
  317. package/dist/implementation/world/move-log.js.map +1 -0
  318. package/dist/implementation/world/observer.d.ts +16 -0
  319. package/dist/implementation/world/observer.js +130 -0
  320. package/dist/implementation/world/observer.js.map +1 -0
  321. package/dist/implementation/world/order.d.ts +38 -0
  322. package/dist/implementation/world/order.js +324 -0
  323. package/dist/implementation/world/order.js.map +1 -0
  324. package/dist/implementation/world/out-of-band.d.ts +28 -0
  325. package/dist/implementation/world/out-of-band.js +66 -0
  326. package/dist/implementation/world/out-of-band.js.map +1 -0
  327. package/dist/implementation/world/plan.d.ts +50 -0
  328. package/dist/implementation/world/plan.js +20 -0
  329. package/dist/implementation/world/plan.js.map +1 -0
  330. package/dist/implementation/world/pool.d.ts +70 -0
  331. package/dist/implementation/world/pool.js +264 -0
  332. package/dist/implementation/world/pool.js.map +1 -0
  333. package/dist/implementation/world/port.d.ts +62 -0
  334. package/dist/implementation/world/port.js +109 -0
  335. package/dist/implementation/world/port.js.map +1 -0
  336. package/dist/implementation/world/prepared-lookup.d.ts +11 -0
  337. package/dist/implementation/world/prepared-lookup.js +99 -0
  338. package/dist/implementation/world/prepared-lookup.js.map +1 -0
  339. package/dist/implementation/world/prepared-spawn.d.ts +39 -0
  340. package/dist/implementation/world/prepared-spawn.js +119 -0
  341. package/dist/implementation/world/prepared-spawn.js.map +1 -0
  342. package/dist/implementation/world/program.d.ts +11 -0
  343. package/dist/implementation/world/program.js +12 -0
  344. package/dist/implementation/world/program.js.map +1 -0
  345. package/dist/implementation/world/protocol.d.ts +192 -0
  346. package/dist/implementation/world/protocol.js +41 -0
  347. package/dist/implementation/world/protocol.js.map +1 -0
  348. package/dist/implementation/world/publish.d.ts +9 -0
  349. package/dist/implementation/world/publish.js +28 -0
  350. package/dist/implementation/world/publish.js.map +1 -0
  351. package/dist/implementation/world/ranges.d.ts +21 -0
  352. package/dist/implementation/world/ranges.js +130 -0
  353. package/dist/implementation/world/ranges.js.map +1 -0
  354. package/dist/implementation/world/reclaim.d.ts +27 -0
  355. package/dist/implementation/world/reclaim.js +176 -0
  356. package/dist/implementation/world/reclaim.js.map +1 -0
  357. package/dist/implementation/world/reductions.d.ts +33 -0
  358. package/dist/implementation/world/reductions.js +92 -0
  359. package/dist/implementation/world/reductions.js.map +1 -0
  360. package/dist/implementation/world/register.d.ts +64 -0
  361. package/dist/implementation/world/register.js +368 -0
  362. package/dist/implementation/world/register.js.map +1 -0
  363. package/dist/implementation/world/remote-systems.d.ts +144 -0
  364. package/dist/implementation/world/remote-systems.js +556 -0
  365. package/dist/implementation/world/remote-systems.js.map +1 -0
  366. package/dist/implementation/world/remote.d.ts +25 -0
  367. package/dist/implementation/world/remote.js +138 -0
  368. package/dist/implementation/world/remote.js.map +1 -0
  369. package/dist/implementation/world/render-order.d.ts +19 -0
  370. package/dist/implementation/world/render-order.js +126 -0
  371. package/dist/implementation/world/render-order.js.map +1 -0
  372. package/dist/implementation/world/required.d.ts +3 -0
  373. package/dist/implementation/world/required.js +9 -0
  374. package/dist/implementation/world/required.js.map +1 -0
  375. package/dist/implementation/world/resources.d.ts +23 -0
  376. package/dist/implementation/world/resources.js +66 -0
  377. package/dist/implementation/world/resources.js.map +1 -0
  378. package/dist/implementation/world/rows.d.ts +111 -0
  379. package/dist/implementation/world/rows.js +549 -0
  380. package/dist/implementation/world/rows.js.map +1 -0
  381. package/dist/implementation/world/runner.d.ts +133 -0
  382. package/dist/implementation/world/runner.js +1334 -0
  383. package/dist/implementation/world/runner.js.map +1 -0
  384. package/dist/implementation/world/shared.d.ts +55 -0
  385. package/dist/implementation/world/shared.js +301 -0
  386. package/dist/implementation/world/shared.js.map +1 -0
  387. package/dist/implementation/world/sharing.d.ts +48 -0
  388. package/dist/implementation/world/sharing.js +611 -0
  389. package/dist/implementation/world/sharing.js.map +1 -0
  390. package/dist/implementation/world/staging.d.ts +83 -0
  391. package/dist/implementation/world/staging.js +195 -0
  392. package/dist/implementation/world/staging.js.map +1 -0
  393. package/dist/implementation/world/state.d.ts +320 -0
  394. package/dist/implementation/world/state.js +459 -0
  395. package/dist/implementation/world/state.js.map +1 -0
  396. package/dist/implementation/world/stop-lists.d.ts +137 -0
  397. package/dist/implementation/world/stop-lists.js +305 -0
  398. package/dist/implementation/world/stop-lists.js.map +1 -0
  399. package/dist/implementation/world/strings.d.ts +48 -0
  400. package/dist/implementation/world/strings.js +214 -0
  401. package/dist/implementation/world/strings.js.map +1 -0
  402. package/dist/implementation/world/structure.d.ts +39 -0
  403. package/dist/implementation/world/structure.js +42 -0
  404. package/dist/implementation/world/structure.js.map +1 -0
  405. package/dist/implementation/world/synchronize.d.ts +32 -0
  406. package/dist/implementation/world/synchronize.js +910 -0
  407. package/dist/implementation/world/synchronize.js.map +1 -0
  408. package/dist/implementation/world/tail-blocks.d.ts +43 -0
  409. package/dist/implementation/world/tail-blocks.js +59 -0
  410. package/dist/implementation/world/tail-blocks.js.map +1 -0
  411. package/dist/implementation/world/tails.d.ts +119 -0
  412. package/dist/implementation/world/tails.js +448 -0
  413. package/dist/implementation/world/tails.js.map +1 -0
  414. package/dist/implementation/world/terminal.d.ts +7 -0
  415. package/dist/implementation/world/terminal.js +13 -0
  416. package/dist/implementation/world/terminal.js.map +1 -0
  417. package/dist/implementation/world/thread-directory.d.ts +72 -0
  418. package/dist/implementation/world/thread-directory.js +243 -0
  419. package/dist/implementation/world/thread-directory.js.map +1 -0
  420. package/dist/implementation/world/thread-finalizers.d.ts +51 -0
  421. package/dist/implementation/world/thread-finalizers.js +376 -0
  422. package/dist/implementation/world/thread-finalizers.js.map +1 -0
  423. package/dist/implementation/world/thread-indexes.d.ts +28 -0
  424. package/dist/implementation/world/thread-indexes.js +72 -0
  425. package/dist/implementation/world/thread-indexes.js.map +1 -0
  426. package/dist/implementation/world/thread-observer.d.ts +43 -0
  427. package/dist/implementation/world/thread-observer.js +223 -0
  428. package/dist/implementation/world/thread-observer.js.map +1 -0
  429. package/dist/implementation/world/thread-systems.d.ts +121 -0
  430. package/dist/implementation/world/thread-systems.js +1487 -0
  431. package/dist/implementation/world/thread-systems.js.map +1 -0
  432. package/dist/implementation/world/thread-tasks.d.ts +65 -0
  433. package/dist/implementation/world/thread-tasks.js +74 -0
  434. package/dist/implementation/world/thread-tasks.js.map +1 -0
  435. package/dist/implementation/world/transfers.d.ts +30 -0
  436. package/dist/implementation/world/transfers.js +101 -0
  437. package/dist/implementation/world/transfers.js.map +1 -0
  438. package/dist/implementation/world/up.d.ts +35 -0
  439. package/dist/implementation/world/up.js +939 -0
  440. package/dist/implementation/world/up.js.map +1 -0
  441. package/dist/implementation/world/wasm.d.ts +143 -0
  442. package/dist/implementation/world/wasm.js +2460 -0
  443. package/dist/implementation/world/wasm.js.map +1 -0
  444. package/dist/implementation/world/wgsl.d.ts +22 -0
  445. package/dist/implementation/world/wgsl.js +497 -0
  446. package/dist/implementation/world/wgsl.js.map +1 -0
  447. package/dist/implementation/world/where.d.ts +74 -0
  448. package/dist/implementation/world/where.js +202 -0
  449. package/dist/implementation/world/where.js.map +1 -0
  450. package/dist/implementation/world/worker-platform.d.ts +37 -0
  451. package/dist/implementation/world/worker-platform.js +80 -0
  452. package/dist/implementation/world/worker-platform.js.map +1 -0
  453. package/dist/implementation/world/worker-window.d.ts +7 -0
  454. package/dist/implementation/world/worker-window.js +47 -0
  455. package/dist/implementation/world/worker-window.js.map +1 -0
  456. package/dist/implementation/world/worker.d.ts +1 -0
  457. package/dist/implementation/world/worker.js +496 -0
  458. package/dist/implementation/world/worker.js.map +1 -0
  459. package/dist/index.d.ts +15 -0
  460. package/dist/index.js +14 -0
  461. package/dist/index.js.map +1 -0
  462. package/dist/interface/component/component.d.ts +2 -0
  463. package/dist/interface/component/component.js +3 -0
  464. package/dist/interface/component/component.js.map +1 -0
  465. package/dist/interface/component/index.d.ts +2 -0
  466. package/dist/interface/component/index.js +2 -0
  467. package/dist/interface/component/index.js.map +1 -0
  468. package/dist/interface/component/key.d.ts +2 -0
  469. package/dist/interface/component/key.js +2 -0
  470. package/dist/interface/component/key.js.map +1 -0
  471. package/dist/interface/component/types.d.ts +6 -0
  472. package/dist/interface/component/types.js +2 -0
  473. package/dist/interface/component/types.js.map +1 -0
  474. package/dist/interface/component/value.d.ts +39 -0
  475. package/dist/interface/component/value.js +2 -0
  476. package/dist/interface/component/value.js.map +1 -0
  477. package/dist/interface/component/values.d.ts +6 -0
  478. package/dist/interface/component/values.js +2 -0
  479. package/dist/interface/component/values.js.map +1 -0
  480. package/dist/interface/entity/entity.d.ts +9 -0
  481. package/dist/interface/entity/entity.js +2 -0
  482. package/dist/interface/entity/entity.js.map +1 -0
  483. package/dist/interface/entity/index.d.ts +10 -0
  484. package/dist/interface/entity/index.js +7 -0
  485. package/dist/interface/entity/index.js.map +1 -0
  486. package/dist/interface/finalizer/body.d.ts +53 -0
  487. package/dist/interface/finalizer/body.js +2 -0
  488. package/dist/interface/finalizer/body.js.map +1 -0
  489. package/dist/interface/finalizer/create.d.ts +43 -0
  490. package/dist/interface/finalizer/create.js +130 -0
  491. package/dist/interface/finalizer/create.js.map +1 -0
  492. package/dist/interface/finalizer/created.d.ts +16 -0
  493. package/dist/interface/finalizer/created.js +2 -0
  494. package/dist/interface/finalizer/created.js.map +1 -0
  495. package/dist/interface/finalizer/declaration.d.ts +58 -0
  496. package/dist/interface/finalizer/declaration.js +2 -0
  497. package/dist/interface/finalizer/declaration.js.map +1 -0
  498. package/dist/interface/finalizer/finalizer.d.ts +8 -0
  499. package/dist/interface/finalizer/finalizer.js +2 -0
  500. package/dist/interface/finalizer/finalizer.js.map +1 -0
  501. package/dist/interface/finalizer/index.d.ts +1 -0
  502. package/dist/interface/finalizer/index.js +3 -0
  503. package/dist/interface/finalizer/index.js.map +1 -0
  504. package/dist/interface/gpu/accessors.d.ts +15 -0
  505. package/dist/interface/gpu/accessors.js +87 -0
  506. package/dist/interface/gpu/accessors.js.map +1 -0
  507. package/dist/interface/gpu/gpu.d.ts +3 -0
  508. package/dist/interface/gpu/gpu.js +2 -0
  509. package/dist/interface/gpu/gpu.js.map +1 -0
  510. package/dist/interface/gpu/index.d.ts +2 -0
  511. package/dist/interface/gpu/index.js +4 -0
  512. package/dist/interface/gpu/index.js.map +1 -0
  513. package/dist/interface/gpu/layout.d.ts +5 -0
  514. package/dist/interface/gpu/layout.js +22 -0
  515. package/dist/interface/gpu/layout.js.map +1 -0
  516. package/dist/interface/gpu/record.d.ts +5 -0
  517. package/dist/interface/gpu/record.js +7 -0
  518. package/dist/interface/gpu/record.js.map +1 -0
  519. package/dist/interface/gpu/wgsl.d.ts +9 -0
  520. package/dist/interface/gpu/wgsl.js +24 -0
  521. package/dist/interface/gpu/wgsl.js.map +1 -0
  522. package/dist/interface/index.d.ts +16 -0
  523. package/dist/interface/index.js +12 -0
  524. package/dist/interface/index.js.map +1 -0
  525. package/dist/interface/indexes/create.d.ts +39 -0
  526. package/dist/interface/indexes/create.js +82 -0
  527. package/dist/interface/indexes/create.js.map +1 -0
  528. package/dist/interface/indexes/created.d.ts +7 -0
  529. package/dist/interface/indexes/created.js +2 -0
  530. package/dist/interface/indexes/created.js.map +1 -0
  531. package/dist/interface/indexes/declaration.d.ts +18 -0
  532. package/dist/interface/indexes/declaration.js +2 -0
  533. package/dist/interface/indexes/declaration.js.map +1 -0
  534. package/dist/interface/indexes/index-type.d.ts +12 -0
  535. package/dist/interface/indexes/index-type.js +2 -0
  536. package/dist/interface/indexes/index-type.js.map +1 -0
  537. package/dist/interface/indexes/index.d.ts +1 -0
  538. package/dist/interface/indexes/index.js +3 -0
  539. package/dist/interface/indexes/index.js.map +1 -0
  540. package/dist/interface/math/f32/default.d.ts +4 -0
  541. package/dist/interface/math/f32/default.js +4 -0
  542. package/dist/interface/math/f32/default.js.map +1 -0
  543. package/dist/interface/math/f32/index.d.ts +4 -0
  544. package/dist/interface/math/f32/index.js +2 -0
  545. package/dist/interface/math/f32/index.js.map +1 -0
  546. package/dist/interface/math/f32/public.d.ts +2 -0
  547. package/dist/interface/math/f32/public.js +4 -0
  548. package/dist/interface/math/f32/public.js.map +1 -0
  549. package/dist/interface/math/f32/round-half-even.d.ts +2 -0
  550. package/dist/interface/math/f32/round-half-even.js +7 -0
  551. package/dist/interface/math/f32/round-half-even.js.map +1 -0
  552. package/dist/interface/math/f32/schema.d.ts +4 -0
  553. package/dist/interface/math/f32/schema.js +2 -0
  554. package/dist/interface/math/f32/schema.js.map +1 -0
  555. package/dist/interface/math/i32/default.d.ts +4 -0
  556. package/dist/interface/math/i32/default.js +4 -0
  557. package/dist/interface/math/i32/default.js.map +1 -0
  558. package/dist/interface/math/i32/index.d.ts +5 -0
  559. package/dist/interface/math/i32/index.js +2 -0
  560. package/dist/interface/math/i32/index.js.map +1 -0
  561. package/dist/interface/math/i32/public.d.ts +3 -0
  562. package/dist/interface/math/i32/public.js +5 -0
  563. package/dist/interface/math/i32/public.js.map +1 -0
  564. package/dist/interface/math/i32/schema.d.ts +5 -0
  565. package/dist/interface/math/i32/schema.js +2 -0
  566. package/dist/interface/math/i32/schema.js.map +1 -0
  567. package/dist/interface/math/i32/shift-right.d.ts +2 -0
  568. package/dist/interface/math/i32/shift-right.js +2 -0
  569. package/dist/interface/math/i32/shift-right.js.map +1 -0
  570. package/dist/interface/math/index.d.ts +8 -0
  571. package/dist/interface/math/index.js +10 -0
  572. package/dist/interface/math/index.js.map +1 -0
  573. package/dist/interface/math/intrinsic.d.ts +13 -0
  574. package/dist/interface/math/intrinsic.js +10 -0
  575. package/dist/interface/math/intrinsic.js.map +1 -0
  576. package/dist/interface/math/mat4x4/add.d.ts +2 -0
  577. package/dist/interface/math/mat4x4/add.js +8 -0
  578. package/dist/interface/math/mat4x4/add.js.map +1 -0
  579. package/dist/interface/math/mat4x4/determinant.d.ts +2 -0
  580. package/dist/interface/math/mat4x4/determinant.js +18 -0
  581. package/dist/interface/math/mat4x4/determinant.js.map +1 -0
  582. package/dist/interface/math/mat4x4/identity.d.ts +2 -0
  583. package/dist/interface/math/mat4x4/identity.js +7 -0
  584. package/dist/interface/math/mat4x4/identity.js.map +1 -0
  585. package/dist/interface/math/mat4x4/index.d.ts +26 -0
  586. package/dist/interface/math/mat4x4/index.js +24 -0
  587. package/dist/interface/math/mat4x4/index.js.map +1 -0
  588. package/dist/interface/math/mat4x4/inverse.d.ts +2 -0
  589. package/dist/interface/math/mat4x4/inverse.js +40 -0
  590. package/dist/interface/math/mat4x4/inverse.js.map +1 -0
  591. package/dist/interface/math/mat4x4/look-at.d.ts +3 -0
  592. package/dist/interface/math/mat4x4/look-at.js +22 -0
  593. package/dist/interface/math/mat4x4/look-at.js.map +1 -0
  594. package/dist/interface/math/mat4x4/multiply-vec3.d.ts +3 -0
  595. package/dist/interface/math/mat4x4/multiply-vec3.js +6 -0
  596. package/dist/interface/math/mat4x4/multiply-vec3.js.map +1 -0
  597. package/dist/interface/math/mat4x4/multiply-vec4.d.ts +3 -0
  598. package/dist/interface/math/mat4x4/multiply-vec4.js +8 -0
  599. package/dist/interface/math/mat4x4/multiply-vec4.js.map +1 -0
  600. package/dist/interface/math/mat4x4/multiply.d.ts +3 -0
  601. package/dist/interface/math/mat4x4/multiply.js +21 -0
  602. package/dist/interface/math/mat4x4/multiply.js.map +1 -0
  603. package/dist/interface/math/mat4x4/orthographic.d.ts +2 -0
  604. package/dist/interface/math/mat4x4/orthographic.js +12 -0
  605. package/dist/interface/math/mat4x4/orthographic.js.map +1 -0
  606. package/dist/interface/math/mat4x4/perspective.d.ts +2 -0
  607. package/dist/interface/math/mat4x4/perspective.js +22 -0
  608. package/dist/interface/math/mat4x4/perspective.js.map +1 -0
  609. package/dist/interface/math/mat4x4/public.d.ts +21 -0
  610. package/dist/interface/math/mat4x4/public.js +23 -0
  611. package/dist/interface/math/mat4x4/public.js.map +1 -0
  612. package/dist/interface/math/mat4x4/rotation-x.d.ts +2 -0
  613. package/dist/interface/math/mat4x4/rotation-x.js +11 -0
  614. package/dist/interface/math/mat4x4/rotation-x.js.map +1 -0
  615. package/dist/interface/math/mat4x4/rotation-y.d.ts +2 -0
  616. package/dist/interface/math/mat4x4/rotation-y.js +11 -0
  617. package/dist/interface/math/mat4x4/rotation-y.js.map +1 -0
  618. package/dist/interface/math/mat4x4/rotation-z.d.ts +2 -0
  619. package/dist/interface/math/mat4x4/rotation-z.js +11 -0
  620. package/dist/interface/math/mat4x4/rotation-z.js.map +1 -0
  621. package/dist/interface/math/mat4x4/scale.d.ts +2 -0
  622. package/dist/interface/math/mat4x4/scale.js +8 -0
  623. package/dist/interface/math/mat4x4/scale.js.map +1 -0
  624. package/dist/interface/math/mat4x4/scaling.d.ts +2 -0
  625. package/dist/interface/math/mat4x4/scaling.js +7 -0
  626. package/dist/interface/math/mat4x4/scaling.js.map +1 -0
  627. package/dist/interface/math/mat4x4/schema.d.ts +9 -0
  628. package/dist/interface/math/mat4x4/schema.js +3 -0
  629. package/dist/interface/math/mat4x4/schema.js.map +1 -0
  630. package/dist/interface/math/mat4x4/subtract.d.ts +2 -0
  631. package/dist/interface/math/mat4x4/subtract.js +8 -0
  632. package/dist/interface/math/mat4x4/subtract.js.map +1 -0
  633. package/dist/interface/math/mat4x4/translation.d.ts +2 -0
  634. package/dist/interface/math/mat4x4/translation.js +7 -0
  635. package/dist/interface/math/mat4x4/translation.js.map +1 -0
  636. package/dist/interface/math/mat4x4/transpose.d.ts +2 -0
  637. package/dist/interface/math/mat4x4/transpose.js +8 -0
  638. package/dist/interface/math/mat4x4/transpose.js.map +1 -0
  639. package/dist/interface/math/mat4x4/zero.d.ts +2 -0
  640. package/dist/interface/math/mat4x4/zero.js +7 -0
  641. package/dist/interface/math/mat4x4/zero.js.map +1 -0
  642. package/dist/interface/math/quat/add.d.ts +2 -0
  643. package/dist/interface/math/quat/add.js +8 -0
  644. package/dist/interface/math/quat/add.js.map +1 -0
  645. package/dist/interface/math/quat/align-to.d.ts +12 -0
  646. package/dist/interface/math/quat/align-to.js +42 -0
  647. package/dist/interface/math/quat/align-to.js.map +1 -0
  648. package/dist/interface/math/quat/conjugate.d.ts +2 -0
  649. package/dist/interface/math/quat/conjugate.js +2 -0
  650. package/dist/interface/math/quat/conjugate.js.map +1 -0
  651. package/dist/interface/math/quat/distance.d.ts +2 -0
  652. package/dist/interface/math/quat/distance.js +4 -0
  653. package/dist/interface/math/quat/distance.js.map +1 -0
  654. package/dist/interface/math/quat/dot.d.ts +2 -0
  655. package/dist/interface/math/quat/dot.js +3 -0
  656. package/dist/interface/math/quat/dot.js.map +1 -0
  657. package/dist/interface/math/quat/from-axis-angle.d.ts +3 -0
  658. package/dist/interface/math/quat/from-axis-angle.js +13 -0
  659. package/dist/interface/math/quat/from-axis-angle.js.map +1 -0
  660. package/dist/interface/math/quat/from-euler.d.ts +2 -0
  661. package/dist/interface/math/quat/from-euler.js +15 -0
  662. package/dist/interface/math/quat/from-euler.js.map +1 -0
  663. package/dist/interface/math/quat/identity.d.ts +2 -0
  664. package/dist/interface/math/quat/identity.js +2 -0
  665. package/dist/interface/math/quat/identity.js.map +1 -0
  666. package/dist/interface/math/quat/index.d.ts +4 -0
  667. package/dist/interface/math/quat/index.js +2 -0
  668. package/dist/interface/math/quat/index.js.map +1 -0
  669. package/dist/interface/math/quat/inverse.d.ts +2 -0
  670. package/dist/interface/math/quat/inverse.js +10 -0
  671. package/dist/interface/math/quat/inverse.js.map +1 -0
  672. package/dist/interface/math/quat/length-squared.d.ts +2 -0
  673. package/dist/interface/math/quat/length-squared.js +2 -0
  674. package/dist/interface/math/quat/length-squared.js.map +1 -0
  675. package/dist/interface/math/quat/length.d.ts +2 -0
  676. package/dist/interface/math/quat/length.js +3 -0
  677. package/dist/interface/math/quat/length.js.map +1 -0
  678. package/dist/interface/math/quat/lerp.d.ts +2 -0
  679. package/dist/interface/math/quat/lerp.js +7 -0
  680. package/dist/interface/math/quat/lerp.js.map +1 -0
  681. package/dist/interface/math/quat/look-at.d.ts +3 -0
  682. package/dist/interface/math/quat/look-at.js +49 -0
  683. package/dist/interface/math/quat/look-at.js.map +1 -0
  684. package/dist/interface/math/quat/multiply.d.ts +2 -0
  685. package/dist/interface/math/quat/multiply.js +7 -0
  686. package/dist/interface/math/quat/multiply.js.map +1 -0
  687. package/dist/interface/math/quat/negate.d.ts +2 -0
  688. package/dist/interface/math/quat/negate.js +3 -0
  689. package/dist/interface/math/quat/negate.js.map +1 -0
  690. package/dist/interface/math/quat/normalize.d.ts +2 -0
  691. package/dist/interface/math/quat/normalize.js +7 -0
  692. package/dist/interface/math/quat/normalize.js.map +1 -0
  693. package/dist/interface/math/quat/public.d.ts +25 -0
  694. package/dist/interface/math/quat/public.js +27 -0
  695. package/dist/interface/math/quat/public.js.map +1 -0
  696. package/dist/interface/math/quat/rotate-vec3.d.ts +3 -0
  697. package/dist/interface/math/quat/rotate-vec3.js +14 -0
  698. package/dist/interface/math/quat/rotate-vec3.js.map +1 -0
  699. package/dist/interface/math/quat/scale.d.ts +2 -0
  700. package/dist/interface/math/quat/scale.js +3 -0
  701. package/dist/interface/math/quat/scale.js.map +1 -0
  702. package/dist/interface/math/quat/schema.d.ts +9 -0
  703. package/dist/interface/math/quat/schema.js +3 -0
  704. package/dist/interface/math/quat/schema.js.map +1 -0
  705. package/dist/interface/math/quat/slerp.d.ts +2 -0
  706. package/dist/interface/math/quat/slerp.js +21 -0
  707. package/dist/interface/math/quat/slerp.js.map +1 -0
  708. package/dist/interface/math/quat/subtract.d.ts +2 -0
  709. package/dist/interface/math/quat/subtract.js +8 -0
  710. package/dist/interface/math/quat/subtract.js.map +1 -0
  711. package/dist/interface/math/quat/to-axis-angle.d.ts +6 -0
  712. package/dist/interface/math/quat/to-axis-angle.js +12 -0
  713. package/dist/interface/math/quat/to-axis-angle.js.map +1 -0
  714. package/dist/interface/math/quat/to-euler.d.ts +3 -0
  715. package/dist/interface/math/quat/to-euler.js +21 -0
  716. package/dist/interface/math/quat/to-euler.js.map +1 -0
  717. package/dist/interface/math/quat/to-mat4.d.ts +8 -0
  718. package/dist/interface/math/quat/to-mat4.js +24 -0
  719. package/dist/interface/math/quat/to-mat4.js.map +1 -0
  720. package/dist/interface/math/u32/count-leading-zeros.d.ts +2 -0
  721. package/dist/interface/math/u32/count-leading-zeros.js +3 -0
  722. package/dist/interface/math/u32/count-leading-zeros.js.map +1 -0
  723. package/dist/interface/math/u32/count-one-bits.d.ts +2 -0
  724. package/dist/interface/math/u32/count-one-bits.js +9 -0
  725. package/dist/interface/math/u32/count-one-bits.js.map +1 -0
  726. package/dist/interface/math/u32/count-trailing-zeros.d.ts +2 -0
  727. package/dist/interface/math/u32/count-trailing-zeros.js +6 -0
  728. package/dist/interface/math/u32/count-trailing-zeros.js.map +1 -0
  729. package/dist/interface/math/u32/default.d.ts +4 -0
  730. package/dist/interface/math/u32/default.js +4 -0
  731. package/dist/interface/math/u32/default.js.map +1 -0
  732. package/dist/interface/math/u32/index.d.ts +5 -0
  733. package/dist/interface/math/u32/index.js +2 -0
  734. package/dist/interface/math/u32/index.js.map +1 -0
  735. package/dist/interface/math/u32/public.d.ts +7 -0
  736. package/dist/interface/math/u32/public.js +9 -0
  737. package/dist/interface/math/u32/public.js.map +1 -0
  738. package/dist/interface/math/u32/reverse-bits.d.ts +2 -0
  739. package/dist/interface/math/u32/reverse-bits.js +10 -0
  740. package/dist/interface/math/u32/reverse-bits.js.map +1 -0
  741. package/dist/interface/math/u32/schema.d.ts +5 -0
  742. package/dist/interface/math/u32/schema.js +2 -0
  743. package/dist/interface/math/u32/schema.js.map +1 -0
  744. package/dist/interface/math/u32/shift-right.d.ts +2 -0
  745. package/dist/interface/math/u32/shift-right.js +2 -0
  746. package/dist/interface/math/u32/shift-right.js.map +1 -0
  747. package/dist/interface/math/vec2/f32/abs.d.ts +2 -0
  748. package/dist/interface/math/vec2/f32/abs.js +3 -0
  749. package/dist/interface/math/vec2/f32/abs.js.map +1 -0
  750. package/dist/interface/math/vec2/f32/acos.d.ts +2 -0
  751. package/dist/interface/math/vec2/f32/acos.js +3 -0
  752. package/dist/interface/math/vec2/f32/acos.js.map +1 -0
  753. package/dist/interface/math/vec2/f32/acosh.d.ts +2 -0
  754. package/dist/interface/math/vec2/f32/acosh.js +3 -0
  755. package/dist/interface/math/vec2/f32/acosh.js.map +1 -0
  756. package/dist/interface/math/vec2/f32/add.d.ts +2 -0
  757. package/dist/interface/math/vec2/f32/add.js +3 -0
  758. package/dist/interface/math/vec2/f32/add.js.map +1 -0
  759. package/dist/interface/math/vec2/f32/asin.d.ts +2 -0
  760. package/dist/interface/math/vec2/f32/asin.js +3 -0
  761. package/dist/interface/math/vec2/f32/asin.js.map +1 -0
  762. package/dist/interface/math/vec2/f32/asinh.d.ts +2 -0
  763. package/dist/interface/math/vec2/f32/asinh.js +3 -0
  764. package/dist/interface/math/vec2/f32/asinh.js.map +1 -0
  765. package/dist/interface/math/vec2/f32/atan.d.ts +2 -0
  766. package/dist/interface/math/vec2/f32/atan.js +3 -0
  767. package/dist/interface/math/vec2/f32/atan.js.map +1 -0
  768. package/dist/interface/math/vec2/f32/atanh.d.ts +2 -0
  769. package/dist/interface/math/vec2/f32/atanh.js +3 -0
  770. package/dist/interface/math/vec2/f32/atanh.js.map +1 -0
  771. package/dist/interface/math/vec2/f32/ceil.d.ts +2 -0
  772. package/dist/interface/math/vec2/f32/ceil.js +3 -0
  773. package/dist/interface/math/vec2/f32/ceil.js.map +1 -0
  774. package/dist/interface/math/vec2/f32/clamp.d.ts +2 -0
  775. package/dist/interface/math/vec2/f32/clamp.js +5 -0
  776. package/dist/interface/math/vec2/f32/clamp.js.map +1 -0
  777. package/dist/interface/math/vec2/f32/cos.d.ts +2 -0
  778. package/dist/interface/math/vec2/f32/cos.js +3 -0
  779. package/dist/interface/math/vec2/f32/cos.js.map +1 -0
  780. package/dist/interface/math/vec2/f32/cosh.d.ts +2 -0
  781. package/dist/interface/math/vec2/f32/cosh.js +3 -0
  782. package/dist/interface/math/vec2/f32/cosh.js.map +1 -0
  783. package/dist/interface/math/vec2/f32/distance.d.ts +2 -0
  784. package/dist/interface/math/vec2/f32/distance.js +5 -0
  785. package/dist/interface/math/vec2/f32/distance.js.map +1 -0
  786. package/dist/interface/math/vec2/f32/dot.d.ts +2 -0
  787. package/dist/interface/math/vec2/f32/dot.js +3 -0
  788. package/dist/interface/math/vec2/f32/dot.js.map +1 -0
  789. package/dist/interface/math/vec2/f32/equals.d.ts +2 -0
  790. package/dist/interface/math/vec2/f32/equals.js +2 -0
  791. package/dist/interface/math/vec2/f32/equals.js.map +1 -0
  792. package/dist/interface/math/vec2/f32/exp.d.ts +2 -0
  793. package/dist/interface/math/vec2/f32/exp.js +3 -0
  794. package/dist/interface/math/vec2/f32/exp.js.map +1 -0
  795. package/dist/interface/math/vec2/f32/exp2.d.ts +2 -0
  796. package/dist/interface/math/vec2/f32/exp2.js +3 -0
  797. package/dist/interface/math/vec2/f32/exp2.js.map +1 -0
  798. package/dist/interface/math/vec2/f32/f32.d.ts +4 -0
  799. package/dist/interface/math/vec2/f32/f32.js +2 -0
  800. package/dist/interface/math/vec2/f32/f32.js.map +1 -0
  801. package/dist/interface/math/vec2/f32/faceforward.d.ts +2 -0
  802. package/dist/interface/math/vec2/f32/faceforward.js +5 -0
  803. package/dist/interface/math/vec2/f32/faceforward.js.map +1 -0
  804. package/dist/interface/math/vec2/f32/floor.d.ts +2 -0
  805. package/dist/interface/math/vec2/f32/floor.js +3 -0
  806. package/dist/interface/math/vec2/f32/floor.js.map +1 -0
  807. package/dist/interface/math/vec2/f32/fract.d.ts +2 -0
  808. package/dist/interface/math/vec2/f32/fract.js +3 -0
  809. package/dist/interface/math/vec2/f32/fract.js.map +1 -0
  810. package/dist/interface/math/vec2/f32/length.d.ts +2 -0
  811. package/dist/interface/math/vec2/f32/length.js +3 -0
  812. package/dist/interface/math/vec2/f32/length.js.map +1 -0
  813. package/dist/interface/math/vec2/f32/log.d.ts +2 -0
  814. package/dist/interface/math/vec2/f32/log.js +3 -0
  815. package/dist/interface/math/vec2/f32/log.js.map +1 -0
  816. package/dist/interface/math/vec2/f32/log2.d.ts +2 -0
  817. package/dist/interface/math/vec2/f32/log2.js +3 -0
  818. package/dist/interface/math/vec2/f32/log2.js.map +1 -0
  819. package/dist/interface/math/vec2/f32/max.d.ts +2 -0
  820. package/dist/interface/math/vec2/f32/max.js +3 -0
  821. package/dist/interface/math/vec2/f32/max.js.map +1 -0
  822. package/dist/interface/math/vec2/f32/min.d.ts +2 -0
  823. package/dist/interface/math/vec2/f32/min.js +3 -0
  824. package/dist/interface/math/vec2/f32/min.js.map +1 -0
  825. package/dist/interface/math/vec2/f32/mix.d.ts +2 -0
  826. package/dist/interface/math/vec2/f32/mix.js +6 -0
  827. package/dist/interface/math/vec2/f32/mix.js.map +1 -0
  828. package/dist/interface/math/vec2/f32/mod.d.ts +2 -0
  829. package/dist/interface/math/vec2/f32/mod.js +2 -0
  830. package/dist/interface/math/vec2/f32/mod.js.map +1 -0
  831. package/dist/interface/math/vec2/f32/modf.d.ts +5 -0
  832. package/dist/interface/math/vec2/f32/modf.js +5 -0
  833. package/dist/interface/math/vec2/f32/modf.js.map +1 -0
  834. package/dist/interface/math/vec2/f32/negate.d.ts +2 -0
  835. package/dist/interface/math/vec2/f32/negate.js +3 -0
  836. package/dist/interface/math/vec2/f32/negate.js.map +1 -0
  837. package/dist/interface/math/vec2/f32/normalize.d.ts +2 -0
  838. package/dist/interface/math/vec2/f32/normalize.js +5 -0
  839. package/dist/interface/math/vec2/f32/normalize.js.map +1 -0
  840. package/dist/interface/math/vec2/f32/pow.d.ts +3 -0
  841. package/dist/interface/math/vec2/f32/pow.js +7 -0
  842. package/dist/interface/math/vec2/f32/pow.js.map +1 -0
  843. package/dist/interface/math/vec2/f32/public.d.ts +48 -0
  844. package/dist/interface/math/vec2/f32/public.js +50 -0
  845. package/dist/interface/math/vec2/f32/public.js.map +1 -0
  846. package/dist/interface/math/vec2/f32/reflect.d.ts +2 -0
  847. package/dist/interface/math/vec2/f32/reflect.js +9 -0
  848. package/dist/interface/math/vec2/f32/reflect.js.map +1 -0
  849. package/dist/interface/math/vec2/f32/refract.d.ts +2 -0
  850. package/dist/interface/math/vec2/f32/refract.js +14 -0
  851. package/dist/interface/math/vec2/f32/refract.js.map +1 -0
  852. package/dist/interface/math/vec2/f32/round.d.ts +2 -0
  853. package/dist/interface/math/vec2/f32/round.js +4 -0
  854. package/dist/interface/math/vec2/f32/round.js.map +1 -0
  855. package/dist/interface/math/vec2/f32/scale.d.ts +2 -0
  856. package/dist/interface/math/vec2/f32/scale.js +3 -0
  857. package/dist/interface/math/vec2/f32/scale.js.map +1 -0
  858. package/dist/interface/math/vec2/f32/schema.d.ts +9 -0
  859. package/dist/interface/math/vec2/f32/schema.js +3 -0
  860. package/dist/interface/math/vec2/f32/schema.js.map +1 -0
  861. package/dist/interface/math/vec2/f32/sign.d.ts +2 -0
  862. package/dist/interface/math/vec2/f32/sign.js +3 -0
  863. package/dist/interface/math/vec2/f32/sign.js.map +1 -0
  864. package/dist/interface/math/vec2/f32/sin.d.ts +2 -0
  865. package/dist/interface/math/vec2/f32/sin.js +3 -0
  866. package/dist/interface/math/vec2/f32/sin.js.map +1 -0
  867. package/dist/interface/math/vec2/f32/sinh.d.ts +2 -0
  868. package/dist/interface/math/vec2/f32/sinh.js +3 -0
  869. package/dist/interface/math/vec2/f32/sinh.js.map +1 -0
  870. package/dist/interface/math/vec2/f32/smoothstep.d.ts +2 -0
  871. package/dist/interface/math/vec2/f32/smoothstep.js +7 -0
  872. package/dist/interface/math/vec2/f32/smoothstep.js.map +1 -0
  873. package/dist/interface/math/vec2/f32/sqrt.d.ts +2 -0
  874. package/dist/interface/math/vec2/f32/sqrt.js +3 -0
  875. package/dist/interface/math/vec2/f32/sqrt.js.map +1 -0
  876. package/dist/interface/math/vec2/f32/step.d.ts +2 -0
  877. package/dist/interface/math/vec2/f32/step.js +6 -0
  878. package/dist/interface/math/vec2/f32/step.js.map +1 -0
  879. package/dist/interface/math/vec2/f32/subtract.d.ts +2 -0
  880. package/dist/interface/math/vec2/f32/subtract.js +3 -0
  881. package/dist/interface/math/vec2/f32/subtract.js.map +1 -0
  882. package/dist/interface/math/vec2/f32/tan.d.ts +2 -0
  883. package/dist/interface/math/vec2/f32/tan.js +3 -0
  884. package/dist/interface/math/vec2/f32/tan.js.map +1 -0
  885. package/dist/interface/math/vec2/f32/tanh.d.ts +2 -0
  886. package/dist/interface/math/vec2/f32/tanh.js +3 -0
  887. package/dist/interface/math/vec2/f32/tanh.js.map +1 -0
  888. package/dist/interface/math/vec2/f32/trunc.d.ts +2 -0
  889. package/dist/interface/math/vec2/f32/trunc.js +3 -0
  890. package/dist/interface/math/vec2/f32/trunc.js.map +1 -0
  891. package/dist/interface/math/vec2/f32/zero.d.ts +2 -0
  892. package/dist/interface/math/vec2/f32/zero.js +2 -0
  893. package/dist/interface/math/vec2/f32/zero.js.map +1 -0
  894. package/dist/interface/math/vec2/i32/abs.d.ts +2 -0
  895. package/dist/interface/math/vec2/i32/abs.js +3 -0
  896. package/dist/interface/math/vec2/i32/abs.js.map +1 -0
  897. package/dist/interface/math/vec2/i32/add.d.ts +2 -0
  898. package/dist/interface/math/vec2/i32/add.js +3 -0
  899. package/dist/interface/math/vec2/i32/add.js.map +1 -0
  900. package/dist/interface/math/vec2/i32/bitwise-and.d.ts +2 -0
  901. package/dist/interface/math/vec2/i32/bitwise-and.js +3 -0
  902. package/dist/interface/math/vec2/i32/bitwise-and.js.map +1 -0
  903. package/dist/interface/math/vec2/i32/bitwise-not.d.ts +2 -0
  904. package/dist/interface/math/vec2/i32/bitwise-not.js +3 -0
  905. package/dist/interface/math/vec2/i32/bitwise-not.js.map +1 -0
  906. package/dist/interface/math/vec2/i32/bitwise-or.d.ts +2 -0
  907. package/dist/interface/math/vec2/i32/bitwise-or.js +3 -0
  908. package/dist/interface/math/vec2/i32/bitwise-or.js.map +1 -0
  909. package/dist/interface/math/vec2/i32/bitwise-xor.d.ts +2 -0
  910. package/dist/interface/math/vec2/i32/bitwise-xor.js +3 -0
  911. package/dist/interface/math/vec2/i32/bitwise-xor.js.map +1 -0
  912. package/dist/interface/math/vec2/i32/clamp.d.ts +2 -0
  913. package/dist/interface/math/vec2/i32/clamp.js +5 -0
  914. package/dist/interface/math/vec2/i32/clamp.js.map +1 -0
  915. package/dist/interface/math/vec2/i32/count-leading-zeros.d.ts +2 -0
  916. package/dist/interface/math/vec2/i32/count-leading-zeros.js +7 -0
  917. package/dist/interface/math/vec2/i32/count-leading-zeros.js.map +1 -0
  918. package/dist/interface/math/vec2/i32/count-one-bits.d.ts +2 -0
  919. package/dist/interface/math/vec2/i32/count-one-bits.js +7 -0
  920. package/dist/interface/math/vec2/i32/count-one-bits.js.map +1 -0
  921. package/dist/interface/math/vec2/i32/count-trailing-zeros.d.ts +2 -0
  922. package/dist/interface/math/vec2/i32/count-trailing-zeros.js +7 -0
  923. package/dist/interface/math/vec2/i32/count-trailing-zeros.js.map +1 -0
  924. package/dist/interface/math/vec2/i32/equals.d.ts +2 -0
  925. package/dist/interface/math/vec2/i32/equals.js +2 -0
  926. package/dist/interface/math/vec2/i32/equals.js.map +1 -0
  927. package/dist/interface/math/vec2/i32/i32.d.ts +5 -0
  928. package/dist/interface/math/vec2/i32/i32.js +2 -0
  929. package/dist/interface/math/vec2/i32/i32.js.map +1 -0
  930. package/dist/interface/math/vec2/i32/max.d.ts +2 -0
  931. package/dist/interface/math/vec2/i32/max.js +3 -0
  932. package/dist/interface/math/vec2/i32/max.js.map +1 -0
  933. package/dist/interface/math/vec2/i32/min.d.ts +2 -0
  934. package/dist/interface/math/vec2/i32/min.js +3 -0
  935. package/dist/interface/math/vec2/i32/min.js.map +1 -0
  936. package/dist/interface/math/vec2/i32/negate.d.ts +2 -0
  937. package/dist/interface/math/vec2/i32/negate.js +3 -0
  938. package/dist/interface/math/vec2/i32/negate.js.map +1 -0
  939. package/dist/interface/math/vec2/i32/public.d.ts +22 -0
  940. package/dist/interface/math/vec2/i32/public.js +24 -0
  941. package/dist/interface/math/vec2/i32/public.js.map +1 -0
  942. package/dist/interface/math/vec2/i32/reverse-bits.d.ts +2 -0
  943. package/dist/interface/math/vec2/i32/reverse-bits.js +4 -0
  944. package/dist/interface/math/vec2/i32/reverse-bits.js.map +1 -0
  945. package/dist/interface/math/vec2/i32/scale.d.ts +3 -0
  946. package/dist/interface/math/vec2/i32/scale.js +3 -0
  947. package/dist/interface/math/vec2/i32/scale.js.map +1 -0
  948. package/dist/interface/math/vec2/i32/schema.d.ts +10 -0
  949. package/dist/interface/math/vec2/i32/schema.js +3 -0
  950. package/dist/interface/math/vec2/i32/schema.js.map +1 -0
  951. package/dist/interface/math/vec2/i32/shift-left.d.ts +2 -0
  952. package/dist/interface/math/vec2/i32/shift-left.js +2 -0
  953. package/dist/interface/math/vec2/i32/shift-left.js.map +1 -0
  954. package/dist/interface/math/vec2/i32/shift-right.d.ts +2 -0
  955. package/dist/interface/math/vec2/i32/shift-right.js +6 -0
  956. package/dist/interface/math/vec2/i32/shift-right.js.map +1 -0
  957. package/dist/interface/math/vec2/i32/subtract.d.ts +2 -0
  958. package/dist/interface/math/vec2/i32/subtract.js +3 -0
  959. package/dist/interface/math/vec2/i32/subtract.js.map +1 -0
  960. package/dist/interface/math/vec2/i32/zero.d.ts +2 -0
  961. package/dist/interface/math/vec2/i32/zero.js +2 -0
  962. package/dist/interface/math/vec2/i32/zero.js.map +1 -0
  963. package/dist/interface/math/vec2/index.d.ts +4 -0
  964. package/dist/interface/math/vec2/index.js +2 -0
  965. package/dist/interface/math/vec2/index.js.map +1 -0
  966. package/dist/interface/math/vec2/public.d.ts +5 -0
  967. package/dist/interface/math/vec2/public.js +7 -0
  968. package/dist/interface/math/vec2/public.js.map +1 -0
  969. package/dist/interface/math/vec2/u32/add.d.ts +2 -0
  970. package/dist/interface/math/vec2/u32/add.js +6 -0
  971. package/dist/interface/math/vec2/u32/add.js.map +1 -0
  972. package/dist/interface/math/vec2/u32/bitwise-and.d.ts +2 -0
  973. package/dist/interface/math/vec2/u32/bitwise-and.js +6 -0
  974. package/dist/interface/math/vec2/u32/bitwise-and.js.map +1 -0
  975. package/dist/interface/math/vec2/u32/bitwise-not.d.ts +2 -0
  976. package/dist/interface/math/vec2/u32/bitwise-not.js +3 -0
  977. package/dist/interface/math/vec2/u32/bitwise-not.js.map +1 -0
  978. package/dist/interface/math/vec2/u32/bitwise-or.d.ts +2 -0
  979. package/dist/interface/math/vec2/u32/bitwise-or.js +6 -0
  980. package/dist/interface/math/vec2/u32/bitwise-or.js.map +1 -0
  981. package/dist/interface/math/vec2/u32/bitwise-xor.d.ts +2 -0
  982. package/dist/interface/math/vec2/u32/bitwise-xor.js +6 -0
  983. package/dist/interface/math/vec2/u32/bitwise-xor.js.map +1 -0
  984. package/dist/interface/math/vec2/u32/clamp.d.ts +2 -0
  985. package/dist/interface/math/vec2/u32/clamp.js +5 -0
  986. package/dist/interface/math/vec2/u32/clamp.js.map +1 -0
  987. package/dist/interface/math/vec2/u32/count-leading-zeros.d.ts +2 -0
  988. package/dist/interface/math/vec2/u32/count-leading-zeros.js +7 -0
  989. package/dist/interface/math/vec2/u32/count-leading-zeros.js.map +1 -0
  990. package/dist/interface/math/vec2/u32/count-one-bits.d.ts +2 -0
  991. package/dist/interface/math/vec2/u32/count-one-bits.js +7 -0
  992. package/dist/interface/math/vec2/u32/count-one-bits.js.map +1 -0
  993. package/dist/interface/math/vec2/u32/count-trailing-zeros.d.ts +2 -0
  994. package/dist/interface/math/vec2/u32/count-trailing-zeros.js +7 -0
  995. package/dist/interface/math/vec2/u32/count-trailing-zeros.js.map +1 -0
  996. package/dist/interface/math/vec2/u32/equals.d.ts +2 -0
  997. package/dist/interface/math/vec2/u32/equals.js +2 -0
  998. package/dist/interface/math/vec2/u32/equals.js.map +1 -0
  999. package/dist/interface/math/vec2/u32/max.d.ts +2 -0
  1000. package/dist/interface/math/vec2/u32/max.js +6 -0
  1001. package/dist/interface/math/vec2/u32/max.js.map +1 -0
  1002. package/dist/interface/math/vec2/u32/min.d.ts +2 -0
  1003. package/dist/interface/math/vec2/u32/min.js +6 -0
  1004. package/dist/interface/math/vec2/u32/min.js.map +1 -0
  1005. package/dist/interface/math/vec2/u32/negate.d.ts +2 -0
  1006. package/dist/interface/math/vec2/u32/negate.js +2 -0
  1007. package/dist/interface/math/vec2/u32/negate.js.map +1 -0
  1008. package/dist/interface/math/vec2/u32/public.d.ts +21 -0
  1009. package/dist/interface/math/vec2/u32/public.js +23 -0
  1010. package/dist/interface/math/vec2/u32/public.js.map +1 -0
  1011. package/dist/interface/math/vec2/u32/reverse-bits.d.ts +2 -0
  1012. package/dist/interface/math/vec2/u32/reverse-bits.js +7 -0
  1013. package/dist/interface/math/vec2/u32/reverse-bits.js.map +1 -0
  1014. package/dist/interface/math/vec2/u32/scale.d.ts +3 -0
  1015. package/dist/interface/math/vec2/u32/scale.js +3 -0
  1016. package/dist/interface/math/vec2/u32/scale.js.map +1 -0
  1017. package/dist/interface/math/vec2/u32/schema.d.ts +10 -0
  1018. package/dist/interface/math/vec2/u32/schema.js +3 -0
  1019. package/dist/interface/math/vec2/u32/schema.js.map +1 -0
  1020. package/dist/interface/math/vec2/u32/shift-left.d.ts +2 -0
  1021. package/dist/interface/math/vec2/u32/shift-left.js +2 -0
  1022. package/dist/interface/math/vec2/u32/shift-left.js.map +1 -0
  1023. package/dist/interface/math/vec2/u32/shift-right.d.ts +2 -0
  1024. package/dist/interface/math/vec2/u32/shift-right.js +6 -0
  1025. package/dist/interface/math/vec2/u32/shift-right.js.map +1 -0
  1026. package/dist/interface/math/vec2/u32/subtract.d.ts +2 -0
  1027. package/dist/interface/math/vec2/u32/subtract.js +6 -0
  1028. package/dist/interface/math/vec2/u32/subtract.js.map +1 -0
  1029. package/dist/interface/math/vec2/u32/u32.d.ts +5 -0
  1030. package/dist/interface/math/vec2/u32/u32.js +2 -0
  1031. package/dist/interface/math/vec2/u32/u32.js.map +1 -0
  1032. package/dist/interface/math/vec2/u32/zero.d.ts +2 -0
  1033. package/dist/interface/math/vec2/u32/zero.js +2 -0
  1034. package/dist/interface/math/vec2/u32/zero.js.map +1 -0
  1035. package/dist/interface/math/vec3/f32/abs.d.ts +2 -0
  1036. package/dist/interface/math/vec3/f32/abs.js +3 -0
  1037. package/dist/interface/math/vec3/f32/abs.js.map +1 -0
  1038. package/dist/interface/math/vec3/f32/acos.d.ts +2 -0
  1039. package/dist/interface/math/vec3/f32/acos.js +3 -0
  1040. package/dist/interface/math/vec3/f32/acos.js.map +1 -0
  1041. package/dist/interface/math/vec3/f32/acosh.d.ts +2 -0
  1042. package/dist/interface/math/vec3/f32/acosh.js +3 -0
  1043. package/dist/interface/math/vec3/f32/acosh.js.map +1 -0
  1044. package/dist/interface/math/vec3/f32/add.d.ts +2 -0
  1045. package/dist/interface/math/vec3/f32/add.js +7 -0
  1046. package/dist/interface/math/vec3/f32/add.js.map +1 -0
  1047. package/dist/interface/math/vec3/f32/asin.d.ts +2 -0
  1048. package/dist/interface/math/vec3/f32/asin.js +3 -0
  1049. package/dist/interface/math/vec3/f32/asin.js.map +1 -0
  1050. package/dist/interface/math/vec3/f32/asinh.d.ts +2 -0
  1051. package/dist/interface/math/vec3/f32/asinh.js +3 -0
  1052. package/dist/interface/math/vec3/f32/asinh.js.map +1 -0
  1053. package/dist/interface/math/vec3/f32/atan.d.ts +2 -0
  1054. package/dist/interface/math/vec3/f32/atan.js +3 -0
  1055. package/dist/interface/math/vec3/f32/atan.js.map +1 -0
  1056. package/dist/interface/math/vec3/f32/atanh.d.ts +2 -0
  1057. package/dist/interface/math/vec3/f32/atanh.js +3 -0
  1058. package/dist/interface/math/vec3/f32/atanh.js.map +1 -0
  1059. package/dist/interface/math/vec3/f32/ceil.d.ts +2 -0
  1060. package/dist/interface/math/vec3/f32/ceil.js +3 -0
  1061. package/dist/interface/math/vec3/f32/ceil.js.map +1 -0
  1062. package/dist/interface/math/vec3/f32/clamp.d.ts +2 -0
  1063. package/dist/interface/math/vec3/f32/clamp.js +5 -0
  1064. package/dist/interface/math/vec3/f32/clamp.js.map +1 -0
  1065. package/dist/interface/math/vec3/f32/cos.d.ts +2 -0
  1066. package/dist/interface/math/vec3/f32/cos.js +3 -0
  1067. package/dist/interface/math/vec3/f32/cos.js.map +1 -0
  1068. package/dist/interface/math/vec3/f32/cosh.d.ts +2 -0
  1069. package/dist/interface/math/vec3/f32/cosh.js +3 -0
  1070. package/dist/interface/math/vec3/f32/cosh.js.map +1 -0
  1071. package/dist/interface/math/vec3/f32/cross.d.ts +2 -0
  1072. package/dist/interface/math/vec3/f32/cross.js +7 -0
  1073. package/dist/interface/math/vec3/f32/cross.js.map +1 -0
  1074. package/dist/interface/math/vec3/f32/distance-squared.d.ts +2 -0
  1075. package/dist/interface/math/vec3/f32/distance-squared.js +7 -0
  1076. package/dist/interface/math/vec3/f32/distance-squared.js.map +1 -0
  1077. package/dist/interface/math/vec3/f32/distance.d.ts +2 -0
  1078. package/dist/interface/math/vec3/f32/distance.js +5 -0
  1079. package/dist/interface/math/vec3/f32/distance.js.map +1 -0
  1080. package/dist/interface/math/vec3/f32/dot.d.ts +2 -0
  1081. package/dist/interface/math/vec3/f32/dot.js +3 -0
  1082. package/dist/interface/math/vec3/f32/dot.js.map +1 -0
  1083. package/dist/interface/math/vec3/f32/equals.d.ts +2 -0
  1084. package/dist/interface/math/vec3/f32/equals.js +2 -0
  1085. package/dist/interface/math/vec3/f32/equals.js.map +1 -0
  1086. package/dist/interface/math/vec3/f32/exp.d.ts +2 -0
  1087. package/dist/interface/math/vec3/f32/exp.js +3 -0
  1088. package/dist/interface/math/vec3/f32/exp.js.map +1 -0
  1089. package/dist/interface/math/vec3/f32/exp2.d.ts +2 -0
  1090. package/dist/interface/math/vec3/f32/exp2.js +3 -0
  1091. package/dist/interface/math/vec3/f32/exp2.js.map +1 -0
  1092. package/dist/interface/math/vec3/f32/f32.d.ts +4 -0
  1093. package/dist/interface/math/vec3/f32/f32.js +2 -0
  1094. package/dist/interface/math/vec3/f32/f32.js.map +1 -0
  1095. package/dist/interface/math/vec3/f32/faceforward.d.ts +2 -0
  1096. package/dist/interface/math/vec3/f32/faceforward.js +5 -0
  1097. package/dist/interface/math/vec3/f32/faceforward.js.map +1 -0
  1098. package/dist/interface/math/vec3/f32/floor.d.ts +2 -0
  1099. package/dist/interface/math/vec3/f32/floor.js +3 -0
  1100. package/dist/interface/math/vec3/f32/floor.js.map +1 -0
  1101. package/dist/interface/math/vec3/f32/fract.d.ts +2 -0
  1102. package/dist/interface/math/vec3/f32/fract.js +7 -0
  1103. package/dist/interface/math/vec3/f32/fract.js.map +1 -0
  1104. package/dist/interface/math/vec3/f32/length-squared.d.ts +2 -0
  1105. package/dist/interface/math/vec3/f32/length-squared.js +3 -0
  1106. package/dist/interface/math/vec3/f32/length-squared.js.map +1 -0
  1107. package/dist/interface/math/vec3/f32/length.d.ts +2 -0
  1108. package/dist/interface/math/vec3/f32/length.js +3 -0
  1109. package/dist/interface/math/vec3/f32/length.js.map +1 -0
  1110. package/dist/interface/math/vec3/f32/log.d.ts +2 -0
  1111. package/dist/interface/math/vec3/f32/log.js +3 -0
  1112. package/dist/interface/math/vec3/f32/log.js.map +1 -0
  1113. package/dist/interface/math/vec3/f32/log2.d.ts +2 -0
  1114. package/dist/interface/math/vec3/f32/log2.js +3 -0
  1115. package/dist/interface/math/vec3/f32/log2.js.map +1 -0
  1116. package/dist/interface/math/vec3/f32/max.d.ts +2 -0
  1117. package/dist/interface/math/vec3/f32/max.js +7 -0
  1118. package/dist/interface/math/vec3/f32/max.js.map +1 -0
  1119. package/dist/interface/math/vec3/f32/min.d.ts +2 -0
  1120. package/dist/interface/math/vec3/f32/min.js +7 -0
  1121. package/dist/interface/math/vec3/f32/min.js.map +1 -0
  1122. package/dist/interface/math/vec3/f32/mix.d.ts +2 -0
  1123. package/dist/interface/math/vec3/f32/mix.js +7 -0
  1124. package/dist/interface/math/vec3/f32/mix.js.map +1 -0
  1125. package/dist/interface/math/vec3/f32/mod.d.ts +2 -0
  1126. package/dist/interface/math/vec3/f32/mod.js +6 -0
  1127. package/dist/interface/math/vec3/f32/mod.js.map +1 -0
  1128. package/dist/interface/math/vec3/f32/modf.d.ts +5 -0
  1129. package/dist/interface/math/vec3/f32/modf.js +5 -0
  1130. package/dist/interface/math/vec3/f32/modf.js.map +1 -0
  1131. package/dist/interface/math/vec3/f32/multiply.d.ts +5 -0
  1132. package/dist/interface/math/vec3/f32/multiply.js +10 -0
  1133. package/dist/interface/math/vec3/f32/multiply.js.map +1 -0
  1134. package/dist/interface/math/vec3/f32/negate.d.ts +2 -0
  1135. package/dist/interface/math/vec3/f32/negate.js +3 -0
  1136. package/dist/interface/math/vec3/f32/negate.js.map +1 -0
  1137. package/dist/interface/math/vec3/f32/normalize.d.ts +2 -0
  1138. package/dist/interface/math/vec3/f32/normalize.js +5 -0
  1139. package/dist/interface/math/vec3/f32/normalize.js.map +1 -0
  1140. package/dist/interface/math/vec3/f32/one.d.ts +2 -0
  1141. package/dist/interface/math/vec3/f32/one.js +2 -0
  1142. package/dist/interface/math/vec3/f32/one.js.map +1 -0
  1143. package/dist/interface/math/vec3/f32/pow.d.ts +3 -0
  1144. package/dist/interface/math/vec3/f32/pow.js +8 -0
  1145. package/dist/interface/math/vec3/f32/pow.js.map +1 -0
  1146. package/dist/interface/math/vec3/f32/public.d.ts +54 -0
  1147. package/dist/interface/math/vec3/f32/public.js +56 -0
  1148. package/dist/interface/math/vec3/f32/public.js.map +1 -0
  1149. package/dist/interface/math/vec3/f32/random.d.ts +2 -0
  1150. package/dist/interface/math/vec3/f32/random.js +4 -0
  1151. package/dist/interface/math/vec3/f32/random.js.map +1 -0
  1152. package/dist/interface/math/vec3/f32/reflect.d.ts +2 -0
  1153. package/dist/interface/math/vec3/f32/reflect.js +9 -0
  1154. package/dist/interface/math/vec3/f32/reflect.js.map +1 -0
  1155. package/dist/interface/math/vec3/f32/refract.d.ts +2 -0
  1156. package/dist/interface/math/vec3/f32/refract.js +14 -0
  1157. package/dist/interface/math/vec3/f32/refract.js.map +1 -0
  1158. package/dist/interface/math/vec3/f32/round.d.ts +2 -0
  1159. package/dist/interface/math/vec3/f32/round.js +8 -0
  1160. package/dist/interface/math/vec3/f32/round.js.map +1 -0
  1161. package/dist/interface/math/vec3/f32/scale.d.ts +2 -0
  1162. package/dist/interface/math/vec3/f32/scale.js +3 -0
  1163. package/dist/interface/math/vec3/f32/scale.js.map +1 -0
  1164. package/dist/interface/math/vec3/f32/schema.d.ts +9 -0
  1165. package/dist/interface/math/vec3/f32/schema.js +3 -0
  1166. package/dist/interface/math/vec3/f32/schema.js.map +1 -0
  1167. package/dist/interface/math/vec3/f32/sign.d.ts +2 -0
  1168. package/dist/interface/math/vec3/f32/sign.js +3 -0
  1169. package/dist/interface/math/vec3/f32/sign.js.map +1 -0
  1170. package/dist/interface/math/vec3/f32/sin.d.ts +2 -0
  1171. package/dist/interface/math/vec3/f32/sin.js +3 -0
  1172. package/dist/interface/math/vec3/f32/sin.js.map +1 -0
  1173. package/dist/interface/math/vec3/f32/sinh.d.ts +2 -0
  1174. package/dist/interface/math/vec3/f32/sinh.js +3 -0
  1175. package/dist/interface/math/vec3/f32/sinh.js.map +1 -0
  1176. package/dist/interface/math/vec3/f32/smoothstep.d.ts +2 -0
  1177. package/dist/interface/math/vec3/f32/smoothstep.js +12 -0
  1178. package/dist/interface/math/vec3/f32/smoothstep.js.map +1 -0
  1179. package/dist/interface/math/vec3/f32/sqrt.d.ts +2 -0
  1180. package/dist/interface/math/vec3/f32/sqrt.js +3 -0
  1181. package/dist/interface/math/vec3/f32/sqrt.js.map +1 -0
  1182. package/dist/interface/math/vec3/f32/step.d.ts +2 -0
  1183. package/dist/interface/math/vec3/f32/step.js +7 -0
  1184. package/dist/interface/math/vec3/f32/step.js.map +1 -0
  1185. package/dist/interface/math/vec3/f32/subtract.d.ts +2 -0
  1186. package/dist/interface/math/vec3/f32/subtract.js +7 -0
  1187. package/dist/interface/math/vec3/f32/subtract.js.map +1 -0
  1188. package/dist/interface/math/vec3/f32/tan.d.ts +2 -0
  1189. package/dist/interface/math/vec3/f32/tan.js +3 -0
  1190. package/dist/interface/math/vec3/f32/tan.js.map +1 -0
  1191. package/dist/interface/math/vec3/f32/tanh.d.ts +2 -0
  1192. package/dist/interface/math/vec3/f32/tanh.js +3 -0
  1193. package/dist/interface/math/vec3/f32/tanh.js.map +1 -0
  1194. package/dist/interface/math/vec3/f32/trunc.d.ts +2 -0
  1195. package/dist/interface/math/vec3/f32/trunc.js +3 -0
  1196. package/dist/interface/math/vec3/f32/trunc.js.map +1 -0
  1197. package/dist/interface/math/vec3/f32/zero.d.ts +2 -0
  1198. package/dist/interface/math/vec3/f32/zero.js +2 -0
  1199. package/dist/interface/math/vec3/f32/zero.js.map +1 -0
  1200. package/dist/interface/math/vec3/i32/abs.d.ts +2 -0
  1201. package/dist/interface/math/vec3/i32/abs.js +7 -0
  1202. package/dist/interface/math/vec3/i32/abs.js.map +1 -0
  1203. package/dist/interface/math/vec3/i32/add.d.ts +2 -0
  1204. package/dist/interface/math/vec3/i32/add.js +7 -0
  1205. package/dist/interface/math/vec3/i32/add.js.map +1 -0
  1206. package/dist/interface/math/vec3/i32/bitwise-and.d.ts +2 -0
  1207. package/dist/interface/math/vec3/i32/bitwise-and.js +7 -0
  1208. package/dist/interface/math/vec3/i32/bitwise-and.js.map +1 -0
  1209. package/dist/interface/math/vec3/i32/bitwise-not.d.ts +2 -0
  1210. package/dist/interface/math/vec3/i32/bitwise-not.js +3 -0
  1211. package/dist/interface/math/vec3/i32/bitwise-not.js.map +1 -0
  1212. package/dist/interface/math/vec3/i32/bitwise-or.d.ts +2 -0
  1213. package/dist/interface/math/vec3/i32/bitwise-or.js +7 -0
  1214. package/dist/interface/math/vec3/i32/bitwise-or.js.map +1 -0
  1215. package/dist/interface/math/vec3/i32/bitwise-xor.d.ts +2 -0
  1216. package/dist/interface/math/vec3/i32/bitwise-xor.js +7 -0
  1217. package/dist/interface/math/vec3/i32/bitwise-xor.js.map +1 -0
  1218. package/dist/interface/math/vec3/i32/clamp.d.ts +2 -0
  1219. package/dist/interface/math/vec3/i32/clamp.js +5 -0
  1220. package/dist/interface/math/vec3/i32/clamp.js.map +1 -0
  1221. package/dist/interface/math/vec3/i32/count-leading-zeros.d.ts +2 -0
  1222. package/dist/interface/math/vec3/i32/count-leading-zeros.js +8 -0
  1223. package/dist/interface/math/vec3/i32/count-leading-zeros.js.map +1 -0
  1224. package/dist/interface/math/vec3/i32/count-one-bits.d.ts +2 -0
  1225. package/dist/interface/math/vec3/i32/count-one-bits.js +8 -0
  1226. package/dist/interface/math/vec3/i32/count-one-bits.js.map +1 -0
  1227. package/dist/interface/math/vec3/i32/count-trailing-zeros.d.ts +2 -0
  1228. package/dist/interface/math/vec3/i32/count-trailing-zeros.js +8 -0
  1229. package/dist/interface/math/vec3/i32/count-trailing-zeros.js.map +1 -0
  1230. package/dist/interface/math/vec3/i32/equals.d.ts +2 -0
  1231. package/dist/interface/math/vec3/i32/equals.js +2 -0
  1232. package/dist/interface/math/vec3/i32/equals.js.map +1 -0
  1233. package/dist/interface/math/vec3/i32/i32.d.ts +5 -0
  1234. package/dist/interface/math/vec3/i32/i32.js +2 -0
  1235. package/dist/interface/math/vec3/i32/i32.js.map +1 -0
  1236. package/dist/interface/math/vec3/i32/max.d.ts +2 -0
  1237. package/dist/interface/math/vec3/i32/max.js +7 -0
  1238. package/dist/interface/math/vec3/i32/max.js.map +1 -0
  1239. package/dist/interface/math/vec3/i32/min.d.ts +2 -0
  1240. package/dist/interface/math/vec3/i32/min.js +7 -0
  1241. package/dist/interface/math/vec3/i32/min.js.map +1 -0
  1242. package/dist/interface/math/vec3/i32/multiply.d.ts +2 -0
  1243. package/dist/interface/math/vec3/i32/multiply.js +7 -0
  1244. package/dist/interface/math/vec3/i32/multiply.js.map +1 -0
  1245. package/dist/interface/math/vec3/i32/negate.d.ts +2 -0
  1246. package/dist/interface/math/vec3/i32/negate.js +7 -0
  1247. package/dist/interface/math/vec3/i32/negate.js.map +1 -0
  1248. package/dist/interface/math/vec3/i32/one.d.ts +2 -0
  1249. package/dist/interface/math/vec3/i32/one.js +2 -0
  1250. package/dist/interface/math/vec3/i32/one.js.map +1 -0
  1251. package/dist/interface/math/vec3/i32/public.d.ts +24 -0
  1252. package/dist/interface/math/vec3/i32/public.js +26 -0
  1253. package/dist/interface/math/vec3/i32/public.js.map +1 -0
  1254. package/dist/interface/math/vec3/i32/reverse-bits.d.ts +2 -0
  1255. package/dist/interface/math/vec3/i32/reverse-bits.js +8 -0
  1256. package/dist/interface/math/vec3/i32/reverse-bits.js.map +1 -0
  1257. package/dist/interface/math/vec3/i32/scale.d.ts +3 -0
  1258. package/dist/interface/math/vec3/i32/scale.js +7 -0
  1259. package/dist/interface/math/vec3/i32/scale.js.map +1 -0
  1260. package/dist/interface/math/vec3/i32/schema.d.ts +10 -0
  1261. package/dist/interface/math/vec3/i32/schema.js +3 -0
  1262. package/dist/interface/math/vec3/i32/schema.js.map +1 -0
  1263. package/dist/interface/math/vec3/i32/shift-left.d.ts +2 -0
  1264. package/dist/interface/math/vec3/i32/shift-left.js +2 -0
  1265. package/dist/interface/math/vec3/i32/shift-left.js.map +1 -0
  1266. package/dist/interface/math/vec3/i32/shift-right.d.ts +2 -0
  1267. package/dist/interface/math/vec3/i32/shift-right.js +7 -0
  1268. package/dist/interface/math/vec3/i32/shift-right.js.map +1 -0
  1269. package/dist/interface/math/vec3/i32/subtract.d.ts +2 -0
  1270. package/dist/interface/math/vec3/i32/subtract.js +7 -0
  1271. package/dist/interface/math/vec3/i32/subtract.js.map +1 -0
  1272. package/dist/interface/math/vec3/i32/zero.d.ts +2 -0
  1273. package/dist/interface/math/vec3/i32/zero.js +2 -0
  1274. package/dist/interface/math/vec3/i32/zero.js.map +1 -0
  1275. package/dist/interface/math/vec3/index.d.ts +4 -0
  1276. package/dist/interface/math/vec3/index.js +2 -0
  1277. package/dist/interface/math/vec3/index.js.map +1 -0
  1278. package/dist/interface/math/vec3/public.d.ts +5 -0
  1279. package/dist/interface/math/vec3/public.js +7 -0
  1280. package/dist/interface/math/vec3/public.js.map +1 -0
  1281. package/dist/interface/math/vec3/u32/add.d.ts +2 -0
  1282. package/dist/interface/math/vec3/u32/add.js +7 -0
  1283. package/dist/interface/math/vec3/u32/add.js.map +1 -0
  1284. package/dist/interface/math/vec3/u32/bitwise-and.d.ts +2 -0
  1285. package/dist/interface/math/vec3/u32/bitwise-and.js +7 -0
  1286. package/dist/interface/math/vec3/u32/bitwise-and.js.map +1 -0
  1287. package/dist/interface/math/vec3/u32/bitwise-not.d.ts +2 -0
  1288. package/dist/interface/math/vec3/u32/bitwise-not.js +3 -0
  1289. package/dist/interface/math/vec3/u32/bitwise-not.js.map +1 -0
  1290. package/dist/interface/math/vec3/u32/bitwise-or.d.ts +2 -0
  1291. package/dist/interface/math/vec3/u32/bitwise-or.js +7 -0
  1292. package/dist/interface/math/vec3/u32/bitwise-or.js.map +1 -0
  1293. package/dist/interface/math/vec3/u32/bitwise-xor.d.ts +2 -0
  1294. package/dist/interface/math/vec3/u32/bitwise-xor.js +7 -0
  1295. package/dist/interface/math/vec3/u32/bitwise-xor.js.map +1 -0
  1296. package/dist/interface/math/vec3/u32/clamp.d.ts +2 -0
  1297. package/dist/interface/math/vec3/u32/clamp.js +5 -0
  1298. package/dist/interface/math/vec3/u32/clamp.js.map +1 -0
  1299. package/dist/interface/math/vec3/u32/count-leading-zeros.d.ts +2 -0
  1300. package/dist/interface/math/vec3/u32/count-leading-zeros.js +8 -0
  1301. package/dist/interface/math/vec3/u32/count-leading-zeros.js.map +1 -0
  1302. package/dist/interface/math/vec3/u32/count-one-bits.d.ts +2 -0
  1303. package/dist/interface/math/vec3/u32/count-one-bits.js +8 -0
  1304. package/dist/interface/math/vec3/u32/count-one-bits.js.map +1 -0
  1305. package/dist/interface/math/vec3/u32/count-trailing-zeros.d.ts +2 -0
  1306. package/dist/interface/math/vec3/u32/count-trailing-zeros.js +8 -0
  1307. package/dist/interface/math/vec3/u32/count-trailing-zeros.js.map +1 -0
  1308. package/dist/interface/math/vec3/u32/equals.d.ts +2 -0
  1309. package/dist/interface/math/vec3/u32/equals.js +2 -0
  1310. package/dist/interface/math/vec3/u32/equals.js.map +1 -0
  1311. package/dist/interface/math/vec3/u32/max.d.ts +2 -0
  1312. package/dist/interface/math/vec3/u32/max.js +7 -0
  1313. package/dist/interface/math/vec3/u32/max.js.map +1 -0
  1314. package/dist/interface/math/vec3/u32/min.d.ts +2 -0
  1315. package/dist/interface/math/vec3/u32/min.js +7 -0
  1316. package/dist/interface/math/vec3/u32/min.js.map +1 -0
  1317. package/dist/interface/math/vec3/u32/multiply.d.ts +2 -0
  1318. package/dist/interface/math/vec3/u32/multiply.js +7 -0
  1319. package/dist/interface/math/vec3/u32/multiply.js.map +1 -0
  1320. package/dist/interface/math/vec3/u32/negate.d.ts +2 -0
  1321. package/dist/interface/math/vec3/u32/negate.js +2 -0
  1322. package/dist/interface/math/vec3/u32/negate.js.map +1 -0
  1323. package/dist/interface/math/vec3/u32/one.d.ts +2 -0
  1324. package/dist/interface/math/vec3/u32/one.js +2 -0
  1325. package/dist/interface/math/vec3/u32/one.js.map +1 -0
  1326. package/dist/interface/math/vec3/u32/public.d.ts +24 -0
  1327. package/dist/interface/math/vec3/u32/public.js +26 -0
  1328. package/dist/interface/math/vec3/u32/public.js.map +1 -0
  1329. package/dist/interface/math/vec3/u32/reverse-bits.d.ts +2 -0
  1330. package/dist/interface/math/vec3/u32/reverse-bits.js +8 -0
  1331. package/dist/interface/math/vec3/u32/reverse-bits.js.map +1 -0
  1332. package/dist/interface/math/vec3/u32/scale.d.ts +3 -0
  1333. package/dist/interface/math/vec3/u32/scale.js +7 -0
  1334. package/dist/interface/math/vec3/u32/scale.js.map +1 -0
  1335. package/dist/interface/math/vec3/u32/schema.d.ts +10 -0
  1336. package/dist/interface/math/vec3/u32/schema.js +3 -0
  1337. package/dist/interface/math/vec3/u32/schema.js.map +1 -0
  1338. package/dist/interface/math/vec3/u32/shift-left.d.ts +2 -0
  1339. package/dist/interface/math/vec3/u32/shift-left.js +6 -0
  1340. package/dist/interface/math/vec3/u32/shift-left.js.map +1 -0
  1341. package/dist/interface/math/vec3/u32/shift-right.d.ts +2 -0
  1342. package/dist/interface/math/vec3/u32/shift-right.js +7 -0
  1343. package/dist/interface/math/vec3/u32/shift-right.js.map +1 -0
  1344. package/dist/interface/math/vec3/u32/subtract.d.ts +2 -0
  1345. package/dist/interface/math/vec3/u32/subtract.js +7 -0
  1346. package/dist/interface/math/vec3/u32/subtract.js.map +1 -0
  1347. package/dist/interface/math/vec3/u32/u32.d.ts +5 -0
  1348. package/dist/interface/math/vec3/u32/u32.js +2 -0
  1349. package/dist/interface/math/vec3/u32/u32.js.map +1 -0
  1350. package/dist/interface/math/vec3/u32/volume.d.ts +2 -0
  1351. package/dist/interface/math/vec3/u32/volume.js +2 -0
  1352. package/dist/interface/math/vec3/u32/volume.js.map +1 -0
  1353. package/dist/interface/math/vec3/u32/zero.d.ts +2 -0
  1354. package/dist/interface/math/vec3/u32/zero.js +2 -0
  1355. package/dist/interface/math/vec3/u32/zero.js.map +1 -0
  1356. package/dist/interface/math/vec4/f32/abs.d.ts +2 -0
  1357. package/dist/interface/math/vec4/f32/abs.js +3 -0
  1358. package/dist/interface/math/vec4/f32/abs.js.map +1 -0
  1359. package/dist/interface/math/vec4/f32/acos.d.ts +2 -0
  1360. package/dist/interface/math/vec4/f32/acos.js +3 -0
  1361. package/dist/interface/math/vec4/f32/acos.js.map +1 -0
  1362. package/dist/interface/math/vec4/f32/acosh.d.ts +2 -0
  1363. package/dist/interface/math/vec4/f32/acosh.js +3 -0
  1364. package/dist/interface/math/vec4/f32/acosh.js.map +1 -0
  1365. package/dist/interface/math/vec4/f32/add.d.ts +2 -0
  1366. package/dist/interface/math/vec4/f32/add.js +8 -0
  1367. package/dist/interface/math/vec4/f32/add.js.map +1 -0
  1368. package/dist/interface/math/vec4/f32/asin.d.ts +2 -0
  1369. package/dist/interface/math/vec4/f32/asin.js +3 -0
  1370. package/dist/interface/math/vec4/f32/asin.js.map +1 -0
  1371. package/dist/interface/math/vec4/f32/asinh.d.ts +2 -0
  1372. package/dist/interface/math/vec4/f32/asinh.js +3 -0
  1373. package/dist/interface/math/vec4/f32/asinh.js.map +1 -0
  1374. package/dist/interface/math/vec4/f32/atan.d.ts +2 -0
  1375. package/dist/interface/math/vec4/f32/atan.js +3 -0
  1376. package/dist/interface/math/vec4/f32/atan.js.map +1 -0
  1377. package/dist/interface/math/vec4/f32/atanh.d.ts +2 -0
  1378. package/dist/interface/math/vec4/f32/atanh.js +3 -0
  1379. package/dist/interface/math/vec4/f32/atanh.js.map +1 -0
  1380. package/dist/interface/math/vec4/f32/ceil.d.ts +2 -0
  1381. package/dist/interface/math/vec4/f32/ceil.js +3 -0
  1382. package/dist/interface/math/vec4/f32/ceil.js.map +1 -0
  1383. package/dist/interface/math/vec4/f32/clamp.d.ts +2 -0
  1384. package/dist/interface/math/vec4/f32/clamp.js +5 -0
  1385. package/dist/interface/math/vec4/f32/clamp.js.map +1 -0
  1386. package/dist/interface/math/vec4/f32/cos.d.ts +2 -0
  1387. package/dist/interface/math/vec4/f32/cos.js +3 -0
  1388. package/dist/interface/math/vec4/f32/cos.js.map +1 -0
  1389. package/dist/interface/math/vec4/f32/cosh.d.ts +2 -0
  1390. package/dist/interface/math/vec4/f32/cosh.js +3 -0
  1391. package/dist/interface/math/vec4/f32/cosh.js.map +1 -0
  1392. package/dist/interface/math/vec4/f32/default.d.ts +4 -0
  1393. package/dist/interface/math/vec4/f32/default.js +4 -0
  1394. package/dist/interface/math/vec4/f32/default.js.map +1 -0
  1395. package/dist/interface/math/vec4/f32/distance.d.ts +2 -0
  1396. package/dist/interface/math/vec4/f32/distance.js +5 -0
  1397. package/dist/interface/math/vec4/f32/distance.js.map +1 -0
  1398. package/dist/interface/math/vec4/f32/dot.d.ts +2 -0
  1399. package/dist/interface/math/vec4/f32/dot.js +3 -0
  1400. package/dist/interface/math/vec4/f32/dot.js.map +1 -0
  1401. package/dist/interface/math/vec4/f32/exp.d.ts +2 -0
  1402. package/dist/interface/math/vec4/f32/exp.js +3 -0
  1403. package/dist/interface/math/vec4/f32/exp.js.map +1 -0
  1404. package/dist/interface/math/vec4/f32/exp2.d.ts +2 -0
  1405. package/dist/interface/math/vec4/f32/exp2.js +3 -0
  1406. package/dist/interface/math/vec4/f32/exp2.js.map +1 -0
  1407. package/dist/interface/math/vec4/f32/f32.d.ts +4 -0
  1408. package/dist/interface/math/vec4/f32/f32.js +2 -0
  1409. package/dist/interface/math/vec4/f32/f32.js.map +1 -0
  1410. package/dist/interface/math/vec4/f32/faceforward.d.ts +2 -0
  1411. package/dist/interface/math/vec4/f32/faceforward.js +5 -0
  1412. package/dist/interface/math/vec4/f32/faceforward.js.map +1 -0
  1413. package/dist/interface/math/vec4/f32/floor.d.ts +2 -0
  1414. package/dist/interface/math/vec4/f32/floor.js +3 -0
  1415. package/dist/interface/math/vec4/f32/floor.js.map +1 -0
  1416. package/dist/interface/math/vec4/f32/fract.d.ts +2 -0
  1417. package/dist/interface/math/vec4/f32/fract.js +8 -0
  1418. package/dist/interface/math/vec4/f32/fract.js.map +1 -0
  1419. package/dist/interface/math/vec4/f32/length.d.ts +2 -0
  1420. package/dist/interface/math/vec4/f32/length.js +3 -0
  1421. package/dist/interface/math/vec4/f32/length.js.map +1 -0
  1422. package/dist/interface/math/vec4/f32/log.d.ts +2 -0
  1423. package/dist/interface/math/vec4/f32/log.js +3 -0
  1424. package/dist/interface/math/vec4/f32/log.js.map +1 -0
  1425. package/dist/interface/math/vec4/f32/log2.d.ts +2 -0
  1426. package/dist/interface/math/vec4/f32/log2.js +3 -0
  1427. package/dist/interface/math/vec4/f32/log2.js.map +1 -0
  1428. package/dist/interface/math/vec4/f32/max.d.ts +2 -0
  1429. package/dist/interface/math/vec4/f32/max.js +8 -0
  1430. package/dist/interface/math/vec4/f32/max.js.map +1 -0
  1431. package/dist/interface/math/vec4/f32/min.d.ts +2 -0
  1432. package/dist/interface/math/vec4/f32/min.js +8 -0
  1433. package/dist/interface/math/vec4/f32/min.js.map +1 -0
  1434. package/dist/interface/math/vec4/f32/mix.d.ts +2 -0
  1435. package/dist/interface/math/vec4/f32/mix.js +8 -0
  1436. package/dist/interface/math/vec4/f32/mix.js.map +1 -0
  1437. package/dist/interface/math/vec4/f32/mod.d.ts +2 -0
  1438. package/dist/interface/math/vec4/f32/mod.js +7 -0
  1439. package/dist/interface/math/vec4/f32/mod.js.map +1 -0
  1440. package/dist/interface/math/vec4/f32/modf.d.ts +5 -0
  1441. package/dist/interface/math/vec4/f32/modf.js +5 -0
  1442. package/dist/interface/math/vec4/f32/modf.js.map +1 -0
  1443. package/dist/interface/math/vec4/f32/multiply.d.ts +2 -0
  1444. package/dist/interface/math/vec4/f32/multiply.js +8 -0
  1445. package/dist/interface/math/vec4/f32/multiply.js.map +1 -0
  1446. package/dist/interface/math/vec4/f32/negate.d.ts +2 -0
  1447. package/dist/interface/math/vec4/f32/negate.js +3 -0
  1448. package/dist/interface/math/vec4/f32/negate.js.map +1 -0
  1449. package/dist/interface/math/vec4/f32/normalize.d.ts +2 -0
  1450. package/dist/interface/math/vec4/f32/normalize.js +5 -0
  1451. package/dist/interface/math/vec4/f32/normalize.js.map +1 -0
  1452. package/dist/interface/math/vec4/f32/pow.d.ts +3 -0
  1453. package/dist/interface/math/vec4/f32/pow.js +9 -0
  1454. package/dist/interface/math/vec4/f32/pow.js.map +1 -0
  1455. package/dist/interface/math/vec4/f32/public.d.ts +47 -0
  1456. package/dist/interface/math/vec4/f32/public.js +49 -0
  1457. package/dist/interface/math/vec4/f32/public.js.map +1 -0
  1458. package/dist/interface/math/vec4/f32/reflect.d.ts +2 -0
  1459. package/dist/interface/math/vec4/f32/reflect.js +9 -0
  1460. package/dist/interface/math/vec4/f32/reflect.js.map +1 -0
  1461. package/dist/interface/math/vec4/f32/refract.d.ts +2 -0
  1462. package/dist/interface/math/vec4/f32/refract.js +14 -0
  1463. package/dist/interface/math/vec4/f32/refract.js.map +1 -0
  1464. package/dist/interface/math/vec4/f32/round.d.ts +2 -0
  1465. package/dist/interface/math/vec4/f32/round.js +9 -0
  1466. package/dist/interface/math/vec4/f32/round.js.map +1 -0
  1467. package/dist/interface/math/vec4/f32/scale.d.ts +2 -0
  1468. package/dist/interface/math/vec4/f32/scale.js +3 -0
  1469. package/dist/interface/math/vec4/f32/scale.js.map +1 -0
  1470. package/dist/interface/math/vec4/f32/schema.d.ts +9 -0
  1471. package/dist/interface/math/vec4/f32/schema.js +3 -0
  1472. package/dist/interface/math/vec4/f32/schema.js.map +1 -0
  1473. package/dist/interface/math/vec4/f32/sign.d.ts +2 -0
  1474. package/dist/interface/math/vec4/f32/sign.js +3 -0
  1475. package/dist/interface/math/vec4/f32/sign.js.map +1 -0
  1476. package/dist/interface/math/vec4/f32/sin.d.ts +2 -0
  1477. package/dist/interface/math/vec4/f32/sin.js +3 -0
  1478. package/dist/interface/math/vec4/f32/sin.js.map +1 -0
  1479. package/dist/interface/math/vec4/f32/sinh.d.ts +2 -0
  1480. package/dist/interface/math/vec4/f32/sinh.js +3 -0
  1481. package/dist/interface/math/vec4/f32/sinh.js.map +1 -0
  1482. package/dist/interface/math/vec4/f32/smoothstep.d.ts +2 -0
  1483. package/dist/interface/math/vec4/f32/smoothstep.js +14 -0
  1484. package/dist/interface/math/vec4/f32/smoothstep.js.map +1 -0
  1485. package/dist/interface/math/vec4/f32/sqrt.d.ts +2 -0
  1486. package/dist/interface/math/vec4/f32/sqrt.js +3 -0
  1487. package/dist/interface/math/vec4/f32/sqrt.js.map +1 -0
  1488. package/dist/interface/math/vec4/f32/step.d.ts +2 -0
  1489. package/dist/interface/math/vec4/f32/step.js +8 -0
  1490. package/dist/interface/math/vec4/f32/step.js.map +1 -0
  1491. package/dist/interface/math/vec4/f32/subtract.d.ts +2 -0
  1492. package/dist/interface/math/vec4/f32/subtract.js +8 -0
  1493. package/dist/interface/math/vec4/f32/subtract.js.map +1 -0
  1494. package/dist/interface/math/vec4/f32/tan.d.ts +2 -0
  1495. package/dist/interface/math/vec4/f32/tan.js +3 -0
  1496. package/dist/interface/math/vec4/f32/tan.js.map +1 -0
  1497. package/dist/interface/math/vec4/f32/tanh.d.ts +2 -0
  1498. package/dist/interface/math/vec4/f32/tanh.js +3 -0
  1499. package/dist/interface/math/vec4/f32/tanh.js.map +1 -0
  1500. package/dist/interface/math/vec4/f32/trunc.d.ts +2 -0
  1501. package/dist/interface/math/vec4/f32/trunc.js +3 -0
  1502. package/dist/interface/math/vec4/f32/trunc.js.map +1 -0
  1503. package/dist/interface/math/vec4/i32/abs.d.ts +2 -0
  1504. package/dist/interface/math/vec4/i32/abs.js +8 -0
  1505. package/dist/interface/math/vec4/i32/abs.js.map +1 -0
  1506. package/dist/interface/math/vec4/i32/add.d.ts +2 -0
  1507. package/dist/interface/math/vec4/i32/add.js +8 -0
  1508. package/dist/interface/math/vec4/i32/add.js.map +1 -0
  1509. package/dist/interface/math/vec4/i32/bitwise-and.d.ts +2 -0
  1510. package/dist/interface/math/vec4/i32/bitwise-and.js +8 -0
  1511. package/dist/interface/math/vec4/i32/bitwise-and.js.map +1 -0
  1512. package/dist/interface/math/vec4/i32/bitwise-not.d.ts +2 -0
  1513. package/dist/interface/math/vec4/i32/bitwise-not.js +3 -0
  1514. package/dist/interface/math/vec4/i32/bitwise-not.js.map +1 -0
  1515. package/dist/interface/math/vec4/i32/bitwise-or.d.ts +2 -0
  1516. package/dist/interface/math/vec4/i32/bitwise-or.js +8 -0
  1517. package/dist/interface/math/vec4/i32/bitwise-or.js.map +1 -0
  1518. package/dist/interface/math/vec4/i32/bitwise-xor.d.ts +2 -0
  1519. package/dist/interface/math/vec4/i32/bitwise-xor.js +8 -0
  1520. package/dist/interface/math/vec4/i32/bitwise-xor.js.map +1 -0
  1521. package/dist/interface/math/vec4/i32/clamp.d.ts +2 -0
  1522. package/dist/interface/math/vec4/i32/clamp.js +5 -0
  1523. package/dist/interface/math/vec4/i32/clamp.js.map +1 -0
  1524. package/dist/interface/math/vec4/i32/count-leading-zeros.d.ts +2 -0
  1525. package/dist/interface/math/vec4/i32/count-leading-zeros.js +9 -0
  1526. package/dist/interface/math/vec4/i32/count-leading-zeros.js.map +1 -0
  1527. package/dist/interface/math/vec4/i32/count-one-bits.d.ts +2 -0
  1528. package/dist/interface/math/vec4/i32/count-one-bits.js +9 -0
  1529. package/dist/interface/math/vec4/i32/count-one-bits.js.map +1 -0
  1530. package/dist/interface/math/vec4/i32/count-trailing-zeros.d.ts +2 -0
  1531. package/dist/interface/math/vec4/i32/count-trailing-zeros.js +9 -0
  1532. package/dist/interface/math/vec4/i32/count-trailing-zeros.js.map +1 -0
  1533. package/dist/interface/math/vec4/i32/equals.d.ts +2 -0
  1534. package/dist/interface/math/vec4/i32/equals.js +2 -0
  1535. package/dist/interface/math/vec4/i32/equals.js.map +1 -0
  1536. package/dist/interface/math/vec4/i32/i32.d.ts +5 -0
  1537. package/dist/interface/math/vec4/i32/i32.js +2 -0
  1538. package/dist/interface/math/vec4/i32/i32.js.map +1 -0
  1539. package/dist/interface/math/vec4/i32/max.d.ts +2 -0
  1540. package/dist/interface/math/vec4/i32/max.js +8 -0
  1541. package/dist/interface/math/vec4/i32/max.js.map +1 -0
  1542. package/dist/interface/math/vec4/i32/min.d.ts +2 -0
  1543. package/dist/interface/math/vec4/i32/min.js +8 -0
  1544. package/dist/interface/math/vec4/i32/min.js.map +1 -0
  1545. package/dist/interface/math/vec4/i32/multiply.d.ts +2 -0
  1546. package/dist/interface/math/vec4/i32/multiply.js +8 -0
  1547. package/dist/interface/math/vec4/i32/multiply.js.map +1 -0
  1548. package/dist/interface/math/vec4/i32/negate.d.ts +2 -0
  1549. package/dist/interface/math/vec4/i32/negate.js +8 -0
  1550. package/dist/interface/math/vec4/i32/negate.js.map +1 -0
  1551. package/dist/interface/math/vec4/i32/one.d.ts +2 -0
  1552. package/dist/interface/math/vec4/i32/one.js +2 -0
  1553. package/dist/interface/math/vec4/i32/one.js.map +1 -0
  1554. package/dist/interface/math/vec4/i32/public.d.ts +24 -0
  1555. package/dist/interface/math/vec4/i32/public.js +26 -0
  1556. package/dist/interface/math/vec4/i32/public.js.map +1 -0
  1557. package/dist/interface/math/vec4/i32/reverse-bits.d.ts +2 -0
  1558. package/dist/interface/math/vec4/i32/reverse-bits.js +9 -0
  1559. package/dist/interface/math/vec4/i32/reverse-bits.js.map +1 -0
  1560. package/dist/interface/math/vec4/i32/scale.d.ts +3 -0
  1561. package/dist/interface/math/vec4/i32/scale.js +8 -0
  1562. package/dist/interface/math/vec4/i32/scale.js.map +1 -0
  1563. package/dist/interface/math/vec4/i32/schema.d.ts +10 -0
  1564. package/dist/interface/math/vec4/i32/schema.js +3 -0
  1565. package/dist/interface/math/vec4/i32/schema.js.map +1 -0
  1566. package/dist/interface/math/vec4/i32/shift-left.d.ts +2 -0
  1567. package/dist/interface/math/vec4/i32/shift-left.js +2 -0
  1568. package/dist/interface/math/vec4/i32/shift-left.js.map +1 -0
  1569. package/dist/interface/math/vec4/i32/shift-right.d.ts +2 -0
  1570. package/dist/interface/math/vec4/i32/shift-right.js +8 -0
  1571. package/dist/interface/math/vec4/i32/shift-right.js.map +1 -0
  1572. package/dist/interface/math/vec4/i32/subtract.d.ts +2 -0
  1573. package/dist/interface/math/vec4/i32/subtract.js +8 -0
  1574. package/dist/interface/math/vec4/i32/subtract.js.map +1 -0
  1575. package/dist/interface/math/vec4/i32/zero.d.ts +2 -0
  1576. package/dist/interface/math/vec4/i32/zero.js +2 -0
  1577. package/dist/interface/math/vec4/i32/zero.js.map +1 -0
  1578. package/dist/interface/math/vec4/index.d.ts +4 -0
  1579. package/dist/interface/math/vec4/index.js +2 -0
  1580. package/dist/interface/math/vec4/index.js.map +1 -0
  1581. package/dist/interface/math/vec4/public.d.ts +5 -0
  1582. package/dist/interface/math/vec4/public.js +7 -0
  1583. package/dist/interface/math/vec4/public.js.map +1 -0
  1584. package/dist/interface/math/vec4/u32/add.d.ts +2 -0
  1585. package/dist/interface/math/vec4/u32/add.js +8 -0
  1586. package/dist/interface/math/vec4/u32/add.js.map +1 -0
  1587. package/dist/interface/math/vec4/u32/bitwise-and.d.ts +2 -0
  1588. package/dist/interface/math/vec4/u32/bitwise-and.js +8 -0
  1589. package/dist/interface/math/vec4/u32/bitwise-and.js.map +1 -0
  1590. package/dist/interface/math/vec4/u32/bitwise-not.d.ts +2 -0
  1591. package/dist/interface/math/vec4/u32/bitwise-not.js +3 -0
  1592. package/dist/interface/math/vec4/u32/bitwise-not.js.map +1 -0
  1593. package/dist/interface/math/vec4/u32/bitwise-or.d.ts +2 -0
  1594. package/dist/interface/math/vec4/u32/bitwise-or.js +8 -0
  1595. package/dist/interface/math/vec4/u32/bitwise-or.js.map +1 -0
  1596. package/dist/interface/math/vec4/u32/bitwise-xor.d.ts +2 -0
  1597. package/dist/interface/math/vec4/u32/bitwise-xor.js +8 -0
  1598. package/dist/interface/math/vec4/u32/bitwise-xor.js.map +1 -0
  1599. package/dist/interface/math/vec4/u32/clamp.d.ts +2 -0
  1600. package/dist/interface/math/vec4/u32/clamp.js +5 -0
  1601. package/dist/interface/math/vec4/u32/clamp.js.map +1 -0
  1602. package/dist/interface/math/vec4/u32/count-leading-zeros.d.ts +2 -0
  1603. package/dist/interface/math/vec4/u32/count-leading-zeros.js +9 -0
  1604. package/dist/interface/math/vec4/u32/count-leading-zeros.js.map +1 -0
  1605. package/dist/interface/math/vec4/u32/count-one-bits.d.ts +2 -0
  1606. package/dist/interface/math/vec4/u32/count-one-bits.js +9 -0
  1607. package/dist/interface/math/vec4/u32/count-one-bits.js.map +1 -0
  1608. package/dist/interface/math/vec4/u32/count-trailing-zeros.d.ts +2 -0
  1609. package/dist/interface/math/vec4/u32/count-trailing-zeros.js +9 -0
  1610. package/dist/interface/math/vec4/u32/count-trailing-zeros.js.map +1 -0
  1611. package/dist/interface/math/vec4/u32/equals.d.ts +2 -0
  1612. package/dist/interface/math/vec4/u32/equals.js +2 -0
  1613. package/dist/interface/math/vec4/u32/equals.js.map +1 -0
  1614. package/dist/interface/math/vec4/u32/max.d.ts +2 -0
  1615. package/dist/interface/math/vec4/u32/max.js +8 -0
  1616. package/dist/interface/math/vec4/u32/max.js.map +1 -0
  1617. package/dist/interface/math/vec4/u32/min.d.ts +2 -0
  1618. package/dist/interface/math/vec4/u32/min.js +8 -0
  1619. package/dist/interface/math/vec4/u32/min.js.map +1 -0
  1620. package/dist/interface/math/vec4/u32/multiply.d.ts +2 -0
  1621. package/dist/interface/math/vec4/u32/multiply.js +8 -0
  1622. package/dist/interface/math/vec4/u32/multiply.js.map +1 -0
  1623. package/dist/interface/math/vec4/u32/negate.d.ts +2 -0
  1624. package/dist/interface/math/vec4/u32/negate.js +2 -0
  1625. package/dist/interface/math/vec4/u32/negate.js.map +1 -0
  1626. package/dist/interface/math/vec4/u32/one.d.ts +2 -0
  1627. package/dist/interface/math/vec4/u32/one.js +2 -0
  1628. package/dist/interface/math/vec4/u32/one.js.map +1 -0
  1629. package/dist/interface/math/vec4/u32/public.d.ts +23 -0
  1630. package/dist/interface/math/vec4/u32/public.js +25 -0
  1631. package/dist/interface/math/vec4/u32/public.js.map +1 -0
  1632. package/dist/interface/math/vec4/u32/reverse-bits.d.ts +2 -0
  1633. package/dist/interface/math/vec4/u32/reverse-bits.js +9 -0
  1634. package/dist/interface/math/vec4/u32/reverse-bits.js.map +1 -0
  1635. package/dist/interface/math/vec4/u32/scale.d.ts +3 -0
  1636. package/dist/interface/math/vec4/u32/scale.js +8 -0
  1637. package/dist/interface/math/vec4/u32/scale.js.map +1 -0
  1638. package/dist/interface/math/vec4/u32/schema.d.ts +10 -0
  1639. package/dist/interface/math/vec4/u32/schema.js +3 -0
  1640. package/dist/interface/math/vec4/u32/schema.js.map +1 -0
  1641. package/dist/interface/math/vec4/u32/shift-left.d.ts +2 -0
  1642. package/dist/interface/math/vec4/u32/shift-left.js +7 -0
  1643. package/dist/interface/math/vec4/u32/shift-left.js.map +1 -0
  1644. package/dist/interface/math/vec4/u32/shift-right.d.ts +2 -0
  1645. package/dist/interface/math/vec4/u32/shift-right.js +8 -0
  1646. package/dist/interface/math/vec4/u32/shift-right.js.map +1 -0
  1647. package/dist/interface/math/vec4/u32/subtract.d.ts +2 -0
  1648. package/dist/interface/math/vec4/u32/subtract.js +8 -0
  1649. package/dist/interface/math/vec4/u32/subtract.js.map +1 -0
  1650. package/dist/interface/math/vec4/u32/u32.d.ts +5 -0
  1651. package/dist/interface/math/vec4/u32/u32.js +2 -0
  1652. package/dist/interface/math/vec4/u32/u32.js.map +1 -0
  1653. package/dist/interface/math/vec4/u32/zero.d.ts +2 -0
  1654. package/dist/interface/math/vec4/u32/zero.js +2 -0
  1655. package/dist/interface/math/vec4/u32/zero.js.map +1 -0
  1656. package/dist/interface/platform/platform.d.ts +28 -0
  1657. package/dist/interface/platform/platform.js +2 -0
  1658. package/dist/interface/platform/platform.js.map +1 -0
  1659. package/dist/interface/registry/archetypes.d.ts +29 -0
  1660. package/dist/interface/registry/archetypes.js +52 -0
  1661. package/dist/interface/registry/archetypes.js.map +1 -0
  1662. package/dist/interface/registry/declarations.d.ts +25 -0
  1663. package/dist/interface/registry/declarations.js +217 -0
  1664. package/dist/interface/registry/declarations.js.map +1 -0
  1665. package/dist/interface/registry/finalizer-order.d.ts +6 -0
  1666. package/dist/interface/registry/finalizer-order.js +66 -0
  1667. package/dist/interface/registry/finalizer-order.js.map +1 -0
  1668. package/dist/interface/registry/ids.d.ts +35 -0
  1669. package/dist/interface/registry/ids.js +70 -0
  1670. package/dist/interface/registry/ids.js.map +1 -0
  1671. package/dist/interface/registry/index.d.ts +29 -0
  1672. package/dist/interface/registry/index.js +16 -0
  1673. package/dist/interface/registry/index.js.map +1 -0
  1674. package/dist/interface/registry/indexes.d.ts +38 -0
  1675. package/dist/interface/registry/indexes.js +63 -0
  1676. package/dist/interface/registry/indexes.js.map +1 -0
  1677. package/dist/interface/registry/items.d.ts +38 -0
  1678. package/dist/interface/registry/items.js +79 -0
  1679. package/dist/interface/registry/items.js.map +1 -0
  1680. package/dist/interface/registry/layout.d.ts +61 -0
  1681. package/dist/interface/registry/layout.js +318 -0
  1682. package/dist/interface/registry/layout.js.map +1 -0
  1683. package/dist/interface/registry/names.d.ts +46 -0
  1684. package/dist/interface/registry/names.js +153 -0
  1685. package/dist/interface/registry/names.js.map +1 -0
  1686. package/dist/interface/registry/program.d.ts +36 -0
  1687. package/dist/interface/registry/program.js +96 -0
  1688. package/dist/interface/registry/program.js.map +1 -0
  1689. package/dist/interface/registry/reduction.d.ts +5 -0
  1690. package/dist/interface/registry/reduction.js +5 -0
  1691. package/dist/interface/registry/reduction.js.map +1 -0
  1692. package/dist/interface/registry/schedule.d.ts +36 -0
  1693. package/dist/interface/registry/schedule.js +202 -0
  1694. package/dist/interface/registry/schedule.js.map +1 -0
  1695. package/dist/interface/registry/schemas.d.ts +22 -0
  1696. package/dist/interface/registry/schemas.js +122 -0
  1697. package/dist/interface/registry/schemas.js.map +1 -0
  1698. package/dist/interface/registry/strata.d.ts +29 -0
  1699. package/dist/interface/registry/strata.js +95 -0
  1700. package/dist/interface/registry/strata.js.map +1 -0
  1701. package/dist/interface/registry/threads.d.ts +34 -0
  1702. package/dist/interface/registry/threads.js +53 -0
  1703. package/dist/interface/registry/threads.js.map +1 -0
  1704. package/dist/interface/registry/traits.d.ts +4 -0
  1705. package/dist/interface/registry/traits.js +11 -0
  1706. package/dist/interface/registry/traits.js.map +1 -0
  1707. package/dist/interface/registry/written.d.ts +4 -0
  1708. package/dist/interface/registry/written.js +14 -0
  1709. package/dist/interface/registry/written.js.map +1 -0
  1710. package/dist/interface/resource/condition.d.ts +8 -0
  1711. package/dist/interface/resource/condition.js +2 -0
  1712. package/dist/interface/resource/condition.js.map +1 -0
  1713. package/dist/interface/resource/index.d.ts +2 -0
  1714. package/dist/interface/resource/index.js +2 -0
  1715. package/dist/interface/resource/index.js.map +1 -0
  1716. package/dist/interface/resource/key.d.ts +2 -0
  1717. package/dist/interface/resource/key.js +2 -0
  1718. package/dist/interface/resource/key.js.map +1 -0
  1719. package/dist/interface/resource/reduction.d.ts +14 -0
  1720. package/dist/interface/resource/reduction.js +2 -0
  1721. package/dist/interface/resource/reduction.js.map +1 -0
  1722. package/dist/interface/resource/resource.d.ts +2 -0
  1723. package/dist/interface/resource/resource.js +3 -0
  1724. package/dist/interface/resource/resource.js.map +1 -0
  1725. package/dist/interface/resource/types.d.ts +6 -0
  1726. package/dist/interface/resource/types.js +2 -0
  1727. package/dist/interface/resource/types.js.map +1 -0
  1728. package/dist/interface/resource/value.d.ts +21 -0
  1729. package/dist/interface/resource/value.js +2 -0
  1730. package/dist/interface/resource/value.js.map +1 -0
  1731. package/dist/interface/resource/written.d.ts +3 -0
  1732. package/dist/interface/resource/written.js +2 -0
  1733. package/dist/interface/resource/written.js.map +1 -0
  1734. package/dist/interface/resources/always.d.ts +9 -0
  1735. package/dist/interface/resources/always.js +6 -0
  1736. package/dist/interface/resources/always.js.map +1 -0
  1737. package/dist/interface/resources/cadence.d.ts +21 -0
  1738. package/dist/interface/resources/cadence.js +18 -0
  1739. package/dist/interface/resources/cadence.js.map +1 -0
  1740. package/dist/interface/resources/clock.d.ts +16 -0
  1741. package/dist/interface/resources/clock.js +12 -0
  1742. package/dist/interface/resources/clock.js.map +1 -0
  1743. package/dist/interface/resources/gpu-device.d.ts +13 -0
  1744. package/dist/interface/resources/gpu-device.js +10 -0
  1745. package/dist/interface/resources/gpu-device.js.map +1 -0
  1746. package/dist/interface/resources/index.d.ts +6 -0
  1747. package/dist/interface/resources/index.js +8 -0
  1748. package/dist/interface/resources/index.js.map +1 -0
  1749. package/dist/interface/resources/wake.d.ts +13 -0
  1750. package/dist/interface/resources/wake.js +9 -0
  1751. package/dist/interface/resources/wake.js.map +1 -0
  1752. package/dist/interface/resources/workers.d.ts +9 -0
  1753. package/dist/interface/resources/workers.js +6 -0
  1754. package/dist/interface/resources/workers.js.map +1 -0
  1755. package/dist/interface/rule/create.d.ts +13 -0
  1756. package/dist/interface/rule/create.js +27 -0
  1757. package/dist/interface/rule/create.js.map +1 -0
  1758. package/dist/interface/rule/created.d.ts +7 -0
  1759. package/dist/interface/rule/created.js +2 -0
  1760. package/dist/interface/rule/created.js.map +1 -0
  1761. package/dist/interface/rule/declaration.d.ts +18 -0
  1762. package/dist/interface/rule/declaration.js +2 -0
  1763. package/dist/interface/rule/declaration.js.map +1 -0
  1764. package/dist/interface/rule/index.d.ts +1 -0
  1765. package/dist/interface/rule/index.js +3 -0
  1766. package/dist/interface/rule/index.js.map +1 -0
  1767. package/dist/interface/rule/rule.d.ts +2 -0
  1768. package/dist/interface/rule/rule.js +2 -0
  1769. package/dist/interface/rule/rule.js.map +1 -0
  1770. package/dist/interface/schema/is-struct.d.ts +43 -0
  1771. package/dist/interface/schema/is-struct.js +2 -0
  1772. package/dist/interface/schema/is-struct.js.map +1 -0
  1773. package/dist/interface/schema/schema.d.ts +171 -0
  1774. package/dist/interface/schema/schema.js +2 -0
  1775. package/dist/interface/schema/schema.js.map +1 -0
  1776. package/dist/interface/system/access.d.ts +132 -0
  1777. package/dist/interface/system/access.js +2 -0
  1778. package/dist/interface/system/access.js.map +1 -0
  1779. package/dist/interface/system/body.d.ts +83 -0
  1780. package/dist/interface/system/body.js +2 -0
  1781. package/dist/interface/system/body.js.map +1 -0
  1782. package/dist/interface/system/check.d.ts +24 -0
  1783. package/dist/interface/system/check.js +296 -0
  1784. package/dist/interface/system/check.js.map +1 -0
  1785. package/dist/interface/system/commands.d.ts +74 -0
  1786. package/dist/interface/system/commands.js +2 -0
  1787. package/dist/interface/system/commands.js.map +1 -0
  1788. package/dist/interface/system/composite-declaration.d.ts +11 -0
  1789. package/dist/interface/system/composite-declaration.js +2 -0
  1790. package/dist/interface/system/composite-declaration.js.map +1 -0
  1791. package/dist/interface/system/composite.d.ts +8 -0
  1792. package/dist/interface/system/composite.js +2 -0
  1793. package/dist/interface/system/composite.js.map +1 -0
  1794. package/dist/interface/system/create-resolved.d.ts +9 -0
  1795. package/dist/interface/system/create-resolved.js +18 -0
  1796. package/dist/interface/system/create-resolved.js.map +1 -0
  1797. package/dist/interface/system/create.d.ts +218 -0
  1798. package/dist/interface/system/create.js +55 -0
  1799. package/dist/interface/system/create.js.map +1 -0
  1800. package/dist/interface/system/declaration.d.ts +75 -0
  1801. package/dist/interface/system/declaration.js +2 -0
  1802. package/dist/interface/system/declaration.js.map +1 -0
  1803. package/dist/interface/system/definition.d.ts +4 -0
  1804. package/dist/interface/system/definition.js +2 -0
  1805. package/dist/interface/system/definition.js.map +1 -0
  1806. package/dist/interface/system/index.d.ts +3 -0
  1807. package/dist/interface/system/index.js +3 -0
  1808. package/dist/interface/system/index.js.map +1 -0
  1809. package/dist/interface/system/input.d.ts +59 -0
  1810. package/dist/interface/system/input.js +2 -0
  1811. package/dist/interface/system/input.js.map +1 -0
  1812. package/dist/interface/system/leaf.d.ts +19 -0
  1813. package/dist/interface/system/leaf.js +2 -0
  1814. package/dist/interface/system/leaf.js.map +1 -0
  1815. package/dist/interface/system/name.d.ts +6 -0
  1816. package/dist/interface/system/name.js +2 -0
  1817. package/dist/interface/system/name.js.map +1 -0
  1818. package/dist/interface/system/property.d.ts +4 -0
  1819. package/dist/interface/system/property.js +3 -0
  1820. package/dist/interface/system/property.js.map +1 -0
  1821. package/dist/interface/system/render.d.ts +84 -0
  1822. package/dist/interface/system/render.js +46 -0
  1823. package/dist/interface/system/render.js.map +1 -0
  1824. package/dist/interface/system/resolve.d.ts +68 -0
  1825. package/dist/interface/system/resolve.js +138 -0
  1826. package/dist/interface/system/resolve.js.map +1 -0
  1827. package/dist/interface/system/struct.d.ts +11 -0
  1828. package/dist/interface/system/struct.js +2 -0
  1829. package/dist/interface/system/struct.js.map +1 -0
  1830. package/dist/interface/system/system.d.ts +12 -0
  1831. package/dist/interface/system/system.js +2 -0
  1832. package/dist/interface/system/system.js.map +1 -0
  1833. package/dist/interface/system/threads.d.ts +47 -0
  1834. package/dist/interface/system/threads.js +2 -0
  1835. package/dist/interface/system/threads.js.map +1 -0
  1836. package/dist/interface/system/values-of.d.ts +17 -0
  1837. package/dist/interface/system/values-of.js +2 -0
  1838. package/dist/interface/system/values-of.js.map +1 -0
  1839. package/dist/interface/system/values.d.ts +73 -0
  1840. package/dist/interface/system/values.js +2 -0
  1841. package/dist/interface/system/values.js.map +1 -0
  1842. package/dist/interface/thread/of.d.ts +11 -0
  1843. package/dist/interface/thread/of.js +2 -0
  1844. package/dist/interface/thread/of.js.map +1 -0
  1845. package/dist/interface/thread/thread.d.ts +12 -0
  1846. package/dist/interface/thread/thread.js +2 -0
  1847. package/dist/interface/thread/thread.js.map +1 -0
  1848. package/dist/interface/trait/key.d.ts +4 -0
  1849. package/dist/interface/trait/key.js +2 -0
  1850. package/dist/interface/trait/key.js.map +1 -0
  1851. package/dist/interface/trait/types.d.ts +74 -0
  1852. package/dist/interface/trait/types.js +2 -0
  1853. package/dist/interface/trait/types.js.map +1 -0
  1854. package/dist/interface/world/create.d.ts +21 -0
  1855. package/dist/interface/world/create.js +2 -0
  1856. package/dist/interface/world/create.js.map +1 -0
  1857. package/dist/interface/world/declarations.d.ts +37 -0
  1858. package/dist/interface/world/declarations.js +2 -0
  1859. package/dist/interface/world/declarations.js.map +1 -0
  1860. package/dist/interface/world/filter.d.ts +8 -0
  1861. package/dist/interface/world/filter.js +3 -0
  1862. package/dist/interface/world/filter.js.map +1 -0
  1863. package/dist/interface/world/index.d.ts +1 -0
  1864. package/dist/interface/world/index.js +2 -0
  1865. package/dist/interface/world/index.js.map +1 -0
  1866. package/dist/interface/world/join.d.ts +17 -0
  1867. package/dist/interface/world/join.js +2 -0
  1868. package/dist/interface/world/join.js.map +1 -0
  1869. package/dist/interface/world/world.d.ts +73 -0
  1870. package/dist/interface/world/world.js +2 -0
  1871. package/dist/interface/world/world.js.map +1 -0
  1872. package/package.json +79 -3
  1873. package/src/exports.test.ts +276 -0
  1874. package/src/guide/00-keys.md +34 -0
  1875. package/src/guide/00-keys.out +1 -0
  1876. package/src/guide/00-keys.ts +35 -0
  1877. package/src/guide/00-setup.md +24 -0
  1878. package/src/guide/01-resources.md +22 -0
  1879. package/src/guide/01-resources.out +2 -0
  1880. package/src/guide/01-resources.ts +33 -0
  1881. package/src/guide/02-entities.md +19 -0
  1882. package/src/guide/02-entities.out +2 -0
  1883. package/src/guide/02-entities.ts +43 -0
  1884. package/src/guide/03-systems.md +22 -0
  1885. package/src/guide/03-systems.out +5 -0
  1886. package/src/guide/03-systems.ts +68 -0
  1887. package/src/guide/04-ticks.md +18 -0
  1888. package/src/guide/04-ticks.out +3 -0
  1889. package/src/guide/04-ticks.ts +53 -0
  1890. package/src/guide/05-scheduling.md +14 -0
  1891. package/src/guide/05-scheduling.out +2 -0
  1892. package/src/guide/05-scheduling.ts +46 -0
  1893. package/src/guide/06-sync-points.md +14 -0
  1894. package/src/guide/06-sync-points.out +3 -0
  1895. package/src/guide/06-sync-points.ts +42 -0
  1896. package/src/guide/07-change-filters.md +14 -0
  1897. package/src/guide/07-change-filters.out +6 -0
  1898. package/src/guide/07-change-filters.ts +70 -0
  1899. package/src/guide/08-input.md +12 -0
  1900. package/src/guide/08-input.out +1 -0
  1901. package/src/guide/08-input.ts +45 -0
  1902. package/src/guide/09-rules.md +12 -0
  1903. package/src/guide/09-rules.out +2 -0
  1904. package/src/guide/09-rules.ts +50 -0
  1905. package/src/guide/10-finalizers.md +13 -0
  1906. package/src/guide/10-finalizers.out +4 -0
  1907. package/src/guide/10-finalizers.ts +48 -0
  1908. package/src/guide/11-traits.md +16 -0
  1909. package/src/guide/11-traits.out +2 -0
  1910. package/src/guide/11-traits.ts +51 -0
  1911. package/src/guide/11-traits.type-test.ts +25 -0
  1912. package/src/guide/12-lookups.md +14 -0
  1913. package/src/guide/12-lookups.out +3 -0
  1914. package/src/guide/12-lookups.ts +59 -0
  1915. package/src/guide/13-indexes.md +21 -0
  1916. package/src/guide/13-indexes.out +8 -0
  1917. package/src/guide/13-indexes.ts +73 -0
  1918. package/src/guide/14-kernels.md +15 -0
  1919. package/src/guide/14-kernels.out +1 -0
  1920. package/src/guide/14-kernels.ts +48 -0
  1921. package/src/guide/15-reductions.md +12 -0
  1922. package/src/guide/15-reductions.out +1 -0
  1923. package/src/guide/15-reductions.ts +38 -0
  1924. package/src/guide/16-gpu.md +18 -0
  1925. package/src/guide/16-gpu.out +3 -0
  1926. package/src/guide/16-gpu.ts +51 -0
  1927. package/src/guide/17-hierarchies.md +11 -0
  1928. package/src/guide/17-hierarchies.out +1 -0
  1929. package/src/guide/17-hierarchies.ts +40 -0
  1930. package/src/guide/18-identity.md +10 -0
  1931. package/src/guide/18-identity.out +1 -0
  1932. package/src/guide/18-identity.ts +11 -0
  1933. package/src/guide/19-threads.md +16 -0
  1934. package/src/guide/19-threads.out +2 -0
  1935. package/src/guide/19-threads.ts +65 -0
  1936. package/src/guide/20-shared.md +29 -0
  1937. package/src/guide/20-shared.out +4 -0
  1938. package/src/guide/20-shared.ts +118 -0
  1939. package/src/guide/21-dom.md +22 -0
  1940. package/src/guide/21-dom.out +5 -0
  1941. package/src/guide/21-dom.ts +117 -0
  1942. package/src/guide/22-canvas.md +15 -0
  1943. package/src/guide/22-canvas.out +3 -0
  1944. package/src/guide/22-canvas.ts +119 -0
  1945. package/src/guide/CLAUDE.md +49 -0
  1946. package/src/guide/README.md +42 -0
  1947. package/src/guide/guide.test.ts +215 -0
  1948. package/src/implementation/compiler/access.ts +149 -0
  1949. package/src/implementation/compiler/archetypes.test.ts +64 -0
  1950. package/src/implementation/compiler/archetypes.ts +134 -0
  1951. package/src/implementation/compiler/assign.ts +168 -0
  1952. package/src/implementation/compiler/augmentations.test.ts +418 -0
  1953. package/src/implementation/compiler/augmentations.ts +871 -0
  1954. package/src/implementation/compiler/bind.ts +89 -0
  1955. package/src/implementation/compiler/body-access.ts +434 -0
  1956. package/src/implementation/compiler/booleans.ts +39 -0
  1957. package/src/implementation/compiler/branches.ts +46 -0
  1958. package/src/implementation/compiler/calls.ts +395 -0
  1959. package/src/implementation/compiler/columns.ts +62 -0
  1960. package/src/implementation/compiler/compile-kernel.ts +204 -0
  1961. package/src/implementation/compiler/compiler.ts +9 -0
  1962. package/src/implementation/compiler/data.ts +95 -0
  1963. package/src/implementation/compiler/describe.test-helper.ts +97 -0
  1964. package/src/implementation/compiler/describe.test.ts +168 -0
  1965. package/src/implementation/compiler/describe.ts +489 -0
  1966. package/src/implementation/compiler/estree.ts +64 -0
  1967. package/src/implementation/compiler/expression.ts +146 -0
  1968. package/src/implementation/compiler/failure.ts +38 -0
  1969. package/src/implementation/compiler/hygiene.test.ts +66 -0
  1970. package/src/implementation/compiler/identify.test.ts +209 -0
  1971. package/src/implementation/compiler/identify.ts +212 -0
  1972. package/src/implementation/compiler/index.ts +6 -0
  1973. package/src/implementation/compiler/inferred.test.ts +32 -0
  1974. package/src/implementation/compiler/inferred.ts +197 -0
  1975. package/src/implementation/compiler/inline-kernels.test.ts +10 -0
  1976. package/src/implementation/compiler/inline-kernels.ts +21 -0
  1977. package/src/implementation/compiler/input-schemas.test.ts +182 -0
  1978. package/src/implementation/compiler/input-schemas.ts +107 -0
  1979. package/src/implementation/compiler/ir.ts +106 -0
  1980. package/src/implementation/compiler/kernel-id.ts +34 -0
  1981. package/src/implementation/compiler/key.ts +33 -0
  1982. package/src/implementation/compiler/link.test.ts +73 -0
  1983. package/src/implementation/compiler/link.ts +231 -0
  1984. package/src/implementation/compiler/lists.ts +230 -0
  1985. package/src/implementation/compiler/lookups.ts +121 -0
  1986. package/src/implementation/compiler/math.ts +10 -0
  1987. package/src/implementation/compiler/memory-compiler.browser.test.ts +85 -0
  1988. package/src/implementation/compiler/memory-compiler.test.ts +147 -0
  1989. package/src/implementation/compiler/memory-compiler.ts +307 -0
  1990. package/src/implementation/compiler/module-scope.ts +141 -0
  1991. package/src/implementation/compiler/module-value.ts +136 -0
  1992. package/src/implementation/compiler/out.ts +7 -0
  1993. package/src/implementation/compiler/oxc.test-helper.ts +20 -0
  1994. package/src/implementation/compiler/oxc.test.ts +69 -0
  1995. package/src/implementation/compiler/oxc.ts +90 -0
  1996. package/src/implementation/compiler/package-copies.ts +208 -0
  1997. package/src/implementation/compiler/passes.ts +34 -0
  1998. package/src/implementation/compiler/paths.ts +24 -0
  1999. package/src/implementation/compiler/plugin.test.ts +686 -0
  2000. package/src/implementation/compiler/plugin.ts +384 -0
  2001. package/src/implementation/compiler/posix.test.ts +34 -0
  2002. package/src/implementation/compiler/posix.ts +183 -0
  2003. package/src/implementation/compiler/predicates.test.ts +90 -0
  2004. package/src/implementation/compiler/predicates.ts +250 -0
  2005. package/src/implementation/compiler/print.ts +124 -0
  2006. package/src/implementation/compiler/program.ts +235 -0
  2007. package/src/implementation/compiler/public.ts +2 -0
  2008. package/src/implementation/compiler/scalar.ts +47 -0
  2009. package/src/implementation/compiler/scope.ts +28 -0
  2010. package/src/implementation/compiler/serialize.ts +11 -0
  2011. package/src/implementation/compiler/shared-kernels.test.ts +57 -0
  2012. package/src/implementation/compiler/signature.ts +210 -0
  2013. package/src/implementation/compiler/snapshot.ts +37 -0
  2014. package/src/implementation/compiler/source-map.test.ts +41 -0
  2015. package/src/implementation/compiler/source-map.ts +135 -0
  2016. package/src/implementation/compiler/spawns.ts +171 -0
  2017. package/src/implementation/compiler/stamps.ts +46 -0
  2018. package/src/implementation/compiler/statement.ts +103 -0
  2019. package/src/implementation/compiler/subset.md +83 -0
  2020. package/src/implementation/compiler/terminal.ts +50 -0
  2021. package/src/implementation/compiler/transform.test.ts +1534 -0
  2022. package/src/implementation/compiler/transform.ts +498 -0
  2023. package/src/implementation/compiler/type-host.test-helper.ts +27 -0
  2024. package/src/implementation/compiler/type-schemas.ts +714 -0
  2025. package/src/implementation/compiler/unit.ts +132 -0
  2026. package/src/implementation/compiler/value.ts +61 -0
  2027. package/src/implementation/compiler/wat.test.ts +135 -0
  2028. package/src/implementation/compiler/wat.ts +365 -0
  2029. package/src/implementation/index.ts +3 -0
  2030. package/src/implementation/world/activate.ts +134 -0
  2031. package/src/implementation/world/archetype.ts +501 -0
  2032. package/src/implementation/world/arrays.test.ts +25 -0
  2033. package/src/implementation/world/arrays.ts +48 -0
  2034. package/src/implementation/world/arrivals.test.ts +89 -0
  2035. package/src/implementation/world/arrivals.ts +165 -0
  2036. package/src/implementation/world/async-loading.test.ts +86 -0
  2037. package/src/implementation/world/attach-kernel.test.ts +17 -0
  2038. package/src/implementation/world/attach-kernel.ts +31 -0
  2039. package/src/implementation/world/batches.test.ts +126 -0
  2040. package/src/implementation/world/batches.ts +185 -0
  2041. package/src/implementation/world/buffer.ts +176 -0
  2042. package/src/implementation/world/builtins.test.ts +87 -0
  2043. package/src/implementation/world/cascade.ts +145 -0
  2044. package/src/implementation/world/cells.ts +25 -0
  2045. package/src/implementation/world/change-blocks.browser.test.ts +76 -0
  2046. package/src/implementation/world/change-blocks.cases.ts +14 -0
  2047. package/src/implementation/world/change-blocks.fixture.ts +70 -0
  2048. package/src/implementation/world/change-blocks.test.ts +264 -0
  2049. package/src/implementation/world/changes-finalizers.test.ts +38 -0
  2050. package/src/implementation/world/check-kernel.ts +100 -0
  2051. package/src/implementation/world/claims.test.ts +42 -0
  2052. package/src/implementation/world/claims.ts +51 -0
  2053. package/src/implementation/world/closure.test.ts +40 -0
  2054. package/src/implementation/world/closure.ts +41 -0
  2055. package/src/implementation/world/command-ring.ts +475 -0
  2056. package/src/implementation/world/command-rings.cases.ts +48 -0
  2057. package/src/implementation/world/command-rings.fixture.ts +180 -0
  2058. package/src/implementation/world/commands.test.ts +385 -0
  2059. package/src/implementation/world/commands.ts +100 -0
  2060. package/src/implementation/world/composite-input.test.ts +39 -0
  2061. package/src/implementation/world/conditions.test.ts +113 -0
  2062. package/src/implementation/world/constant-unions.test.ts +43 -0
  2063. package/src/implementation/world/create.test.ts +362 -0
  2064. package/src/implementation/world/create.ts +1061 -0
  2065. package/src/implementation/world/defaults.test.ts +86 -0
  2066. package/src/implementation/world/directories.ts +87 -0
  2067. package/src/implementation/world/directory.test.ts +53 -0
  2068. package/src/implementation/world/dispatch.cases.ts +33 -0
  2069. package/src/implementation/world/dispatch.fixture.ts +163 -0
  2070. package/src/implementation/world/entities.ts +190 -0
  2071. package/src/implementation/world/entity-lookup-workers.cases.ts +19 -0
  2072. package/src/implementation/world/entity-lookup-workers.fixture.ts +102 -0
  2073. package/src/implementation/world/entity-lookups.browser.test.ts +51 -0
  2074. package/src/implementation/world/entity-lookups.test-helper.ts +195 -0
  2075. package/src/implementation/world/entity-lookups.test.ts +105 -0
  2076. package/src/implementation/world/execute.ts +745 -0
  2077. package/src/implementation/world/failing-worker.fixture.ts +3 -0
  2078. package/src/implementation/world/failures.ts +71 -0
  2079. package/src/implementation/world/finalizers.test.ts +302 -0
  2080. package/src/implementation/world/finalizers.ts +451 -0
  2081. package/src/implementation/world/fixtures.test-helper.ts +20 -0
  2082. package/src/implementation/world/generated-code.md +144 -0
  2083. package/src/implementation/world/gpu.browser.test.ts +701 -0
  2084. package/src/implementation/world/gpu.test-helper.ts +12 -0
  2085. package/src/implementation/world/gpu.ts +405 -0
  2086. package/src/implementation/world/holders.ts +69 -0
  2087. package/src/implementation/world/ids-changes.test-helper.ts +4 -0
  2088. package/src/implementation/world/ids-keys.test-helper.ts +21 -0
  2089. package/src/implementation/world/ids.test.ts +31 -0
  2090. package/src/implementation/world/imported-lists.test-helper.ts +18 -0
  2091. package/src/implementation/world/imported-lists.test.ts +44 -0
  2092. package/src/implementation/world/index-buckets.test.ts +276 -0
  2093. package/src/implementation/world/index-build-csp.test.ts +58 -0
  2094. package/src/implementation/world/index-build.cases.ts +21 -0
  2095. package/src/implementation/world/index-build.fixture.ts +122 -0
  2096. package/src/implementation/world/index-build.ts +459 -0
  2097. package/src/implementation/world/index-changed.test.ts +235 -0
  2098. package/src/implementation/world/index-hash.test.ts +34 -0
  2099. package/src/implementation/world/index-hash.ts +858 -0
  2100. package/src/implementation/world/index-joined.test.ts +451 -0
  2101. package/src/implementation/world/index-kernels.test.ts +195 -0
  2102. package/src/implementation/world/index-keyless.test.ts +271 -0
  2103. package/src/implementation/world/index-keys.ts +272 -0
  2104. package/src/implementation/world/index-lookups-csp.test.ts +43 -0
  2105. package/src/implementation/world/index-lookups.ts +629 -0
  2106. package/src/implementation/world/index-order.test.ts +150 -0
  2107. package/src/implementation/world/index-order.ts +183 -0
  2108. package/src/implementation/world/index-readers.ts +325 -0
  2109. package/src/implementation/world/index-sorted.test.ts +76 -0
  2110. package/src/implementation/world/index-sorted.ts +656 -0
  2111. package/src/implementation/world/index-workers.cases.ts +27 -0
  2112. package/src/implementation/world/index-workers.fixture.ts +250 -0
  2113. package/src/implementation/world/indexes.test.ts +719 -0
  2114. package/src/implementation/world/indexes.ts +1163 -0
  2115. package/src/implementation/world/input.ts +15 -0
  2116. package/src/implementation/world/intrinsics-coverage.test.ts +26 -0
  2117. package/src/implementation/world/intrinsics.browser.test.ts +544 -0
  2118. package/src/implementation/world/intrinsics.ts +41 -0
  2119. package/src/implementation/world/join.test.ts +309 -0
  2120. package/src/implementation/world/join.ts +729 -0
  2121. package/src/implementation/world/join.type-test.ts +29 -0
  2122. package/src/implementation/world/joined-observer.test.ts +58 -0
  2123. package/src/implementation/world/joined-observer.ts +875 -0
  2124. package/src/implementation/world/joining-worker.fixture.ts +109 -0
  2125. package/src/implementation/world/joining.cases.ts +88 -0
  2126. package/src/implementation/world/joining.fixture.ts +238 -0
  2127. package/src/implementation/world/joining.test-helper.ts +90 -0
  2128. package/src/implementation/world/joining.ts +387 -0
  2129. package/src/implementation/world/journal.ts +40 -0
  2130. package/src/implementation/world/kernel-imports-sparks.test-helper.ts +16 -0
  2131. package/src/implementation/world/kernel-imports-steer.test-helper.ts +10 -0
  2132. package/src/implementation/world/kernel-imports.test.ts +71 -0
  2133. package/src/implementation/world/kernel-indexes.ts +174 -0
  2134. package/src/implementation/world/kernel-lookup.test-helper.ts +26 -0
  2135. package/src/implementation/world/kernel-path.test-helper.ts +18 -0
  2136. package/src/implementation/world/kernel-spawns.test.ts +148 -0
  2137. package/src/implementation/world/kernel-tried.test-helper.ts +31 -0
  2138. package/src/implementation/world/kernel.ts +268 -0
  2139. package/src/implementation/world/kernels-csp.test.ts +42 -0
  2140. package/src/implementation/world/kernels.test.ts +82 -0
  2141. package/src/implementation/world/kernels.ts +398 -0
  2142. package/src/implementation/world/layout-directory.browser.test.ts +195 -0
  2143. package/src/implementation/world/layout-directory.cases.ts +38 -0
  2144. package/src/implementation/world/layout-directory.fixture.ts +176 -0
  2145. package/src/implementation/world/layout-directory.ts +282 -0
  2146. package/src/implementation/world/lifetime.cases.ts +19 -0
  2147. package/src/implementation/world/lifetime.fixture.ts +68 -0
  2148. package/src/implementation/world/lifetime.test-helper.ts +79 -0
  2149. package/src/implementation/world/lifetime.test.ts +80 -0
  2150. package/src/implementation/world/lists.ts +303 -0
  2151. package/src/implementation/world/lookup-keys.ts +49 -0
  2152. package/src/implementation/world/loop.test.ts +193 -0
  2153. package/src/implementation/world/loop.ts +295 -0
  2154. package/src/implementation/world/memory.test.ts +42 -0
  2155. package/src/implementation/world/memory.ts +90 -0
  2156. package/src/implementation/world/mirror.ts +638 -0
  2157. package/src/implementation/world/move-log.test.ts +429 -0
  2158. package/src/implementation/world/move-log.ts +216 -0
  2159. package/src/implementation/world/names.test.ts +80 -0
  2160. package/src/implementation/world/observe-cases.browser.test.ts +97 -0
  2161. package/src/implementation/world/observe-cases.test.ts +752 -0
  2162. package/src/implementation/world/observe-factories.test.ts +301 -0
  2163. package/src/implementation/world/observe-joined-cases.test.ts +221 -0
  2164. package/src/implementation/world/observe-ticks-cases.test.ts +211 -0
  2165. package/src/implementation/world/observe.test-helper.ts +14 -0
  2166. package/src/implementation/world/observed-workers.cases.ts +13 -0
  2167. package/src/implementation/world/observed-workers.fixture.ts +54 -0
  2168. package/src/implementation/world/observer-contained-worker.fixture.ts +41 -0
  2169. package/src/implementation/world/observer-contained.browser.test.ts +5 -0
  2170. package/src/implementation/world/observer-contained.cases.ts +17 -0
  2171. package/src/implementation/world/observer-contained.fixture.ts +121 -0
  2172. package/src/implementation/world/observer-contained.test-helper.ts +42 -0
  2173. package/src/implementation/world/observer-contained.test.ts +88 -0
  2174. package/src/implementation/world/observer-joined-worker.fixture.ts +81 -0
  2175. package/src/implementation/world/observer-joined.cases.ts +29 -0
  2176. package/src/implementation/world/observer-joined.fixture.ts +288 -0
  2177. package/src/implementation/world/observer-joined.test-helper.ts +171 -0
  2178. package/src/implementation/world/observer-joined.test.ts +366 -0
  2179. package/src/implementation/world/observer.browser.test.ts +73 -0
  2180. package/src/implementation/world/observer.test.ts +291 -0
  2181. package/src/implementation/world/observer.ts +139 -0
  2182. package/src/implementation/world/optional-workers.cases.ts +19 -0
  2183. package/src/implementation/world/optional-workers.fixture.ts +55 -0
  2184. package/src/implementation/world/optional.test.ts +351 -0
  2185. package/src/implementation/world/order.ts +352 -0
  2186. package/src/implementation/world/out-of-band.ts +61 -0
  2187. package/src/implementation/world/outcomes.test-helper.ts +138 -0
  2188. package/src/implementation/world/package-id.test-helper.ts +9 -0
  2189. package/src/implementation/world/perf.md +476 -0
  2190. package/src/implementation/world/plan.md +81 -0
  2191. package/src/implementation/world/plan.ts +72 -0
  2192. package/src/implementation/world/platforms.test-helper.ts +68 -0
  2193. package/src/implementation/world/pool-size.cases.ts +41 -0
  2194. package/src/implementation/world/pool-size.fixture.ts +158 -0
  2195. package/src/implementation/world/pool.cases.ts +31 -0
  2196. package/src/implementation/world/pool.fixture.ts +55 -0
  2197. package/src/implementation/world/pool.ts +324 -0
  2198. package/src/implementation/world/port.test.ts +45 -0
  2199. package/src/implementation/world/port.ts +148 -0
  2200. package/src/implementation/world/ports.cases.ts +37 -0
  2201. package/src/implementation/world/ports.fixture.ts +106 -0
  2202. package/src/implementation/world/ports.type-test.ts +15 -0
  2203. package/src/implementation/world/precision.test.ts +174 -0
  2204. package/src/implementation/world/prepared-lookup.ts +96 -0
  2205. package/src/implementation/world/prepared-spawn.ts +165 -0
  2206. package/src/implementation/world/program.ts +14 -0
  2207. package/src/implementation/world/protocol.ts +134 -0
  2208. package/src/implementation/world/publish.ts +29 -0
  2209. package/src/implementation/world/ranges.test.ts +66 -0
  2210. package/src/implementation/world/ranges.ts +110 -0
  2211. package/src/implementation/world/reads.test-helper.ts +30 -0
  2212. package/src/implementation/world/reclaim.test.ts +214 -0
  2213. package/src/implementation/world/reclaim.ts +170 -0
  2214. package/src/implementation/world/reductions.cases.ts +23 -0
  2215. package/src/implementation/world/reductions.fixture.ts +60 -0
  2216. package/src/implementation/world/reductions.test.ts +266 -0
  2217. package/src/implementation/world/reductions.ts +107 -0
  2218. package/src/implementation/world/reevaluation.test-helper.ts +16 -0
  2219. package/src/implementation/world/reevaluation.test.ts +33 -0
  2220. package/src/implementation/world/register.ts +413 -0
  2221. package/src/implementation/world/remote-finalizers-worker.fixture.ts +59 -0
  2222. package/src/implementation/world/remote-finalizers.cases.ts +42 -0
  2223. package/src/implementation/world/remote-finalizers.fixture.ts +215 -0
  2224. package/src/implementation/world/remote-finalizers.test-helper.ts +252 -0
  2225. package/src/implementation/world/remote-finalizers.test.ts +254 -0
  2226. package/src/implementation/world/remote-objects-worker.fixture.ts +21 -0
  2227. package/src/implementation/world/remote-objects.cases.ts +17 -0
  2228. package/src/implementation/world/remote-objects.fixture.ts +61 -0
  2229. package/src/implementation/world/remote-objects.test-helper.ts +106 -0
  2230. package/src/implementation/world/remote-systems.ts +641 -0
  2231. package/src/implementation/world/remote.test.ts +184 -0
  2232. package/src/implementation/world/remote.ts +126 -0
  2233. package/src/implementation/world/removal-worker.fixture.ts +21 -0
  2234. package/src/implementation/world/removal.cases.ts +17 -0
  2235. package/src/implementation/world/removal.fixture.ts +96 -0
  2236. package/src/implementation/world/remove-joined.test.ts +182 -0
  2237. package/src/implementation/world/remove.test-helper.ts +82 -0
  2238. package/src/implementation/world/remove.test.ts +191 -0
  2239. package/src/implementation/world/render-order.browser.test.ts +209 -0
  2240. package/src/implementation/world/render-order.ts +150 -0
  2241. package/src/implementation/world/required.ts +10 -0
  2242. package/src/implementation/world/resources.ts +71 -0
  2243. package/src/implementation/world/rows.test.ts +75 -0
  2244. package/src/implementation/world/rows.ts +584 -0
  2245. package/src/implementation/world/rules.test.ts +242 -0
  2246. package/src/implementation/world/run-results.test.ts +374 -0
  2247. package/src/implementation/world/runner.ts +1379 -0
  2248. package/src/implementation/world/schedule.test.ts +122 -0
  2249. package/src/implementation/world/semantics.test.ts +95 -0
  2250. package/src/implementation/world/share.test.ts +18 -0
  2251. package/src/implementation/world/shared-gpu.browser.test.ts +109 -0
  2252. package/src/implementation/world/shared-kernels.test.ts +117 -0
  2253. package/src/implementation/world/shared-workers.cases.ts +20 -0
  2254. package/src/implementation/world/shared-workers.fixture.ts +74 -0
  2255. package/src/implementation/world/shared.test.ts +348 -0
  2256. package/src/implementation/world/shared.ts +316 -0
  2257. package/src/implementation/world/sharing.ts +652 -0
  2258. package/src/implementation/world/staging.ts +239 -0
  2259. package/src/implementation/world/state.ts +678 -0
  2260. package/src/implementation/world/stop-lists.ts +377 -0
  2261. package/src/implementation/world/strings.test.ts +189 -0
  2262. package/src/implementation/world/strings.ts +247 -0
  2263. package/src/implementation/world/structure.ts +74 -0
  2264. package/src/implementation/world/synchronize.test.ts +55 -0
  2265. package/src/implementation/world/synchronize.ts +805 -0
  2266. package/src/implementation/world/tail-blocks.ts +79 -0
  2267. package/src/implementation/world/tails-worker.fixture.ts +62 -0
  2268. package/src/implementation/world/tails.cases.ts +45 -0
  2269. package/src/implementation/world/tails.fixture.ts +257 -0
  2270. package/src/implementation/world/tails.test-helper.ts +173 -0
  2271. package/src/implementation/world/tails.test.ts +109 -0
  2272. package/src/implementation/world/tails.ts +490 -0
  2273. package/src/implementation/world/target.test.ts +70 -0
  2274. package/src/implementation/world/terminal.ts +14 -0
  2275. package/src/implementation/world/thread-directory.ts +279 -0
  2276. package/src/implementation/world/thread-finalizers.ts +424 -0
  2277. package/src/implementation/world/thread-indexes.ts +92 -0
  2278. package/src/implementation/world/thread-observer.ts +281 -0
  2279. package/src/implementation/world/thread-systems-worker.fixture.ts +69 -0
  2280. package/src/implementation/world/thread-systems.cases.ts +54 -0
  2281. package/src/implementation/world/thread-systems.fixture.ts +234 -0
  2282. package/src/implementation/world/thread-systems.test-helper.ts +330 -0
  2283. package/src/implementation/world/thread-systems.test.ts +145 -0
  2284. package/src/implementation/world/thread-systems.ts +1514 -0
  2285. package/src/implementation/world/thread-tasks.ts +80 -0
  2286. package/src/implementation/world/threads.browser.test.ts +51 -0
  2287. package/src/implementation/world/threads.test.ts +83 -0
  2288. package/src/implementation/world/ticks.browser.test.ts +43 -0
  2289. package/src/implementation/world/ticks.test.ts +34 -0
  2290. package/src/implementation/world/traits.test.ts +62 -0
  2291. package/src/implementation/world/transfers-worker.fixture.ts +119 -0
  2292. package/src/implementation/world/transfers.cases.ts +31 -0
  2293. package/src/implementation/world/transfers.fixture.ts +140 -0
  2294. package/src/implementation/world/transfers.test-helper.ts +101 -0
  2295. package/src/implementation/world/transfers.test.ts +153 -0
  2296. package/src/implementation/world/transfers.ts +105 -0
  2297. package/src/implementation/world/unidentified-finalizers.test.ts +58 -0
  2298. package/src/implementation/world/up-tree.test.ts +312 -0
  2299. package/src/implementation/world/up-workers.cases.ts +14 -0
  2300. package/src/implementation/world/up-workers.fixture.ts +63 -0
  2301. package/src/implementation/world/up.browser.test.ts +75 -0
  2302. package/src/implementation/world/up.test.ts +298 -0
  2303. package/src/implementation/world/up.ts +912 -0
  2304. package/src/implementation/world/wasm-kernels.test.ts +275 -0
  2305. package/src/implementation/world/wasm.test.ts +559 -0
  2306. package/src/implementation/world/wasm.ts +2365 -0
  2307. package/src/implementation/world/wgsl.test.ts +42 -0
  2308. package/src/implementation/world/wgsl.ts +481 -0
  2309. package/src/implementation/world/where.test.ts +342 -0
  2310. package/src/implementation/world/where.ts +236 -0
  2311. package/src/implementation/world/worker-platform.ts +106 -0
  2312. package/src/implementation/world/worker-window.test.ts +43 -0
  2313. package/src/implementation/world/worker-window.ts +43 -0
  2314. package/src/implementation/world/worker.ts +548 -0
  2315. package/src/implementation/world/workers-follow.test.ts +51 -0
  2316. package/src/implementation/world/workers.cases.ts +60 -0
  2317. package/src/implementation/world/workers.fixture.ts +238 -0
  2318. package/src/implementation/world/world-host.fixture.ts +11 -0
  2319. package/src/index.ts +21 -0
  2320. package/src/interface/CLAUDE.md +33 -0
  2321. package/src/interface/component/component.ts +5 -0
  2322. package/src/interface/component/index.ts +3 -0
  2323. package/src/interface/component/key.ts +4 -0
  2324. package/src/interface/component/key.type-test.ts +30 -0
  2325. package/src/interface/component/register.test.ts +117 -0
  2326. package/src/interface/component/types.ts +7 -0
  2327. package/src/interface/component/value.ts +41 -0
  2328. package/src/interface/component/values.ts +6 -0
  2329. package/src/interface/entity/entity.ts +10 -0
  2330. package/src/interface/entity/index.ts +12 -0
  2331. package/src/interface/finalizer/body.ts +52 -0
  2332. package/src/interface/finalizer/create.test.ts +143 -0
  2333. package/src/interface/finalizer/create.ts +158 -0
  2334. package/src/interface/finalizer/created.ts +22 -0
  2335. package/src/interface/finalizer/declaration.ts +48 -0
  2336. package/src/interface/finalizer/finalizer.ts +8 -0
  2337. package/src/interface/finalizer/index.ts +2 -0
  2338. package/src/interface/gpu/accessors.ts +90 -0
  2339. package/src/interface/gpu/gpu.ts +5 -0
  2340. package/src/interface/gpu/gpu.type-test.ts +27 -0
  2341. package/src/interface/gpu/index.ts +3 -0
  2342. package/src/interface/gpu/layout.ts +23 -0
  2343. package/src/interface/gpu/record.ts +6 -0
  2344. package/src/interface/gpu/wgsl.ts +23 -0
  2345. package/src/interface/index.ts +17 -0
  2346. package/src/interface/index.type-test.ts +52 -0
  2347. package/src/interface/indexes/create.test.ts +146 -0
  2348. package/src/interface/indexes/create.ts +88 -0
  2349. package/src/interface/indexes/created.ts +5 -0
  2350. package/src/interface/indexes/declaration.ts +15 -0
  2351. package/src/interface/indexes/index-type.ts +13 -0
  2352. package/src/interface/indexes/index.ts +2 -0
  2353. package/src/interface/indexes/index.type-test.ts +244 -0
  2354. package/src/interface/math/f32/default.ts +6 -0
  2355. package/src/interface/math/f32/index.ts +7 -0
  2356. package/src/interface/math/f32/public.ts +3 -0
  2357. package/src/interface/math/f32/round-half-even.ts +6 -0
  2358. package/src/interface/math/f32/schema.ts +4 -0
  2359. package/src/interface/math/i32/default.ts +6 -0
  2360. package/src/interface/math/i32/index.ts +8 -0
  2361. package/src/interface/math/i32/public.ts +4 -0
  2362. package/src/interface/math/i32/schema.ts +4 -0
  2363. package/src/interface/math/i32/shift-right.ts +4 -0
  2364. package/src/interface/math/index.ts +9 -0
  2365. package/src/interface/math/intrinsic.ts +19 -0
  2366. package/src/interface/math/mat4x4/add.ts +10 -0
  2367. package/src/interface/math/mat4x4/determinant.ts +27 -0
  2368. package/src/interface/math/mat4x4/identity.ts +9 -0
  2369. package/src/interface/math/mat4x4/index.ts +29 -0
  2370. package/src/interface/math/mat4x4/inverse.ts +50 -0
  2371. package/src/interface/math/mat4x4/look-at.test.ts +14 -0
  2372. package/src/interface/math/mat4x4/look-at.ts +27 -0
  2373. package/src/interface/math/mat4x4/multiply-vec3.ts +9 -0
  2374. package/src/interface/math/mat4x4/multiply-vec4.ts +11 -0
  2375. package/src/interface/math/mat4x4/multiply.ts +23 -0
  2376. package/src/interface/math/mat4x4/orthographic.ts +21 -0
  2377. package/src/interface/math/mat4x4/perspective.ts +21 -0
  2378. package/src/interface/math/mat4x4/public.ts +22 -0
  2379. package/src/interface/math/mat4x4/rotation-x.ts +13 -0
  2380. package/src/interface/math/mat4x4/rotation-y.ts +13 -0
  2381. package/src/interface/math/mat4x4/rotation-z.ts +13 -0
  2382. package/src/interface/math/mat4x4/rotation.test.ts +17 -0
  2383. package/src/interface/math/mat4x4/scale.ts +10 -0
  2384. package/src/interface/math/mat4x4/scaling.ts +9 -0
  2385. package/src/interface/math/mat4x4/schema.ts +5 -0
  2386. package/src/interface/math/mat4x4/subtract.ts +10 -0
  2387. package/src/interface/math/mat4x4/translation.ts +9 -0
  2388. package/src/interface/math/mat4x4/transpose.ts +10 -0
  2389. package/src/interface/math/mat4x4/zero.ts +9 -0
  2390. package/src/interface/math/math.type-test.ts +43 -0
  2391. package/src/interface/math/quat/add.ts +10 -0
  2392. package/src/interface/math/quat/align-to.ts +45 -0
  2393. package/src/interface/math/quat/conjugate.ts +4 -0
  2394. package/src/interface/math/quat/distance.ts +6 -0
  2395. package/src/interface/math/quat/dot.ts +6 -0
  2396. package/src/interface/math/quat/from-axis-angle.ts +15 -0
  2397. package/src/interface/math/quat/from-euler.ts +18 -0
  2398. package/src/interface/math/quat/identity.ts +4 -0
  2399. package/src/interface/math/quat/index.ts +7 -0
  2400. package/src/interface/math/quat/inverse.ts +11 -0
  2401. package/src/interface/math/quat/length-squared.ts +4 -0
  2402. package/src/interface/math/quat/length.ts +5 -0
  2403. package/src/interface/math/quat/lerp.ts +9 -0
  2404. package/src/interface/math/quat/look-at.ts +53 -0
  2405. package/src/interface/math/quat/multiply.ts +9 -0
  2406. package/src/interface/math/quat/negate.ts +5 -0
  2407. package/src/interface/math/quat/normalize.ts +9 -0
  2408. package/src/interface/math/quat/public.ts +26 -0
  2409. package/src/interface/math/quat/rotate-vec3.ts +17 -0
  2410. package/src/interface/math/quat/scale.ts +5 -0
  2411. package/src/interface/math/quat/schema.ts +5 -0
  2412. package/src/interface/math/quat/slerp.ts +27 -0
  2413. package/src/interface/math/quat/subtract.ts +10 -0
  2414. package/src/interface/math/quat/to-axis-angle.ts +15 -0
  2415. package/src/interface/math/quat/to-euler.ts +26 -0
  2416. package/src/interface/math/quat/to-mat4.ts +28 -0
  2417. package/src/interface/math/semantics.test.ts +51 -0
  2418. package/src/interface/math/u32/count-leading-zeros.ts +5 -0
  2419. package/src/interface/math/u32/count-one-bits.ts +11 -0
  2420. package/src/interface/math/u32/count-trailing-zeros.ts +8 -0
  2421. package/src/interface/math/u32/default.ts +6 -0
  2422. package/src/interface/math/u32/index.ts +8 -0
  2423. package/src/interface/math/u32/public.ts +8 -0
  2424. package/src/interface/math/u32/reverse-bits.ts +12 -0
  2425. package/src/interface/math/u32/schema.ts +4 -0
  2426. package/src/interface/math/u32/shift-right.ts +4 -0
  2427. package/src/interface/math/vec2/f32/abs.ts +5 -0
  2428. package/src/interface/math/vec2/f32/acos.ts +5 -0
  2429. package/src/interface/math/vec2/f32/acosh.ts +5 -0
  2430. package/src/interface/math/vec2/f32/add.ts +5 -0
  2431. package/src/interface/math/vec2/f32/asin.ts +5 -0
  2432. package/src/interface/math/vec2/f32/asinh.ts +5 -0
  2433. package/src/interface/math/vec2/f32/atan.ts +5 -0
  2434. package/src/interface/math/vec2/f32/atanh.ts +5 -0
  2435. package/src/interface/math/vec2/f32/ceil.ts +5 -0
  2436. package/src/interface/math/vec2/f32/clamp.ts +7 -0
  2437. package/src/interface/math/vec2/f32/cos.ts +5 -0
  2438. package/src/interface/math/vec2/f32/cosh.ts +5 -0
  2439. package/src/interface/math/vec2/f32/distance.ts +7 -0
  2440. package/src/interface/math/vec2/f32/dot.ts +5 -0
  2441. package/src/interface/math/vec2/f32/equals.ts +4 -0
  2442. package/src/interface/math/vec2/f32/exp.ts +5 -0
  2443. package/src/interface/math/vec2/f32/exp2.ts +5 -0
  2444. package/src/interface/math/vec2/f32/f32.ts +7 -0
  2445. package/src/interface/math/vec2/f32/faceforward.ts +8 -0
  2446. package/src/interface/math/vec2/f32/floor.ts +5 -0
  2447. package/src/interface/math/vec2/f32/fract.ts +5 -0
  2448. package/src/interface/math/vec2/f32/length.ts +5 -0
  2449. package/src/interface/math/vec2/f32/log.ts +5 -0
  2450. package/src/interface/math/vec2/f32/log2.ts +5 -0
  2451. package/src/interface/math/vec2/f32/max.ts +5 -0
  2452. package/src/interface/math/vec2/f32/min.ts +5 -0
  2453. package/src/interface/math/vec2/f32/mix.ts +8 -0
  2454. package/src/interface/math/vec2/f32/mod.ts +4 -0
  2455. package/src/interface/math/vec2/f32/modf.ts +8 -0
  2456. package/src/interface/math/vec2/f32/negate.ts +5 -0
  2457. package/src/interface/math/vec2/f32/normalize.ts +7 -0
  2458. package/src/interface/math/vec2/f32/pow.ts +9 -0
  2459. package/src/interface/math/vec2/f32/public.ts +49 -0
  2460. package/src/interface/math/vec2/f32/reflect.ts +11 -0
  2461. package/src/interface/math/vec2/f32/refract.ts +16 -0
  2462. package/src/interface/math/vec2/f32/round.ts +6 -0
  2463. package/src/interface/math/vec2/f32/scale.ts +5 -0
  2464. package/src/interface/math/vec2/f32/schema.ts +5 -0
  2465. package/src/interface/math/vec2/f32/sign.ts +5 -0
  2466. package/src/interface/math/vec2/f32/sin.ts +5 -0
  2467. package/src/interface/math/vec2/f32/sinh.ts +5 -0
  2468. package/src/interface/math/vec2/f32/smoothstep.ts +9 -0
  2469. package/src/interface/math/vec2/f32/sqrt.ts +5 -0
  2470. package/src/interface/math/vec2/f32/step.ts +8 -0
  2471. package/src/interface/math/vec2/f32/subtract.ts +5 -0
  2472. package/src/interface/math/vec2/f32/tan.ts +5 -0
  2473. package/src/interface/math/vec2/f32/tanh.ts +5 -0
  2474. package/src/interface/math/vec2/f32/trunc.ts +5 -0
  2475. package/src/interface/math/vec2/f32/zero.ts +4 -0
  2476. package/src/interface/math/vec2/i32/abs.ts +5 -0
  2477. package/src/interface/math/vec2/i32/add.ts +5 -0
  2478. package/src/interface/math/vec2/i32/bitwise-and.ts +5 -0
  2479. package/src/interface/math/vec2/i32/bitwise-not.ts +5 -0
  2480. package/src/interface/math/vec2/i32/bitwise-or.ts +5 -0
  2481. package/src/interface/math/vec2/i32/bitwise-xor.ts +5 -0
  2482. package/src/interface/math/vec2/i32/clamp.ts +7 -0
  2483. package/src/interface/math/vec2/i32/count-leading-zeros.ts +9 -0
  2484. package/src/interface/math/vec2/i32/count-one-bits.ts +9 -0
  2485. package/src/interface/math/vec2/i32/count-trailing-zeros.ts +9 -0
  2486. package/src/interface/math/vec2/i32/equals.ts +4 -0
  2487. package/src/interface/math/vec2/i32/i32.ts +8 -0
  2488. package/src/interface/math/vec2/i32/max.ts +5 -0
  2489. package/src/interface/math/vec2/i32/min.ts +5 -0
  2490. package/src/interface/math/vec2/i32/negate.ts +5 -0
  2491. package/src/interface/math/vec2/i32/public.ts +23 -0
  2492. package/src/interface/math/vec2/i32/reverse-bits.ts +6 -0
  2493. package/src/interface/math/vec2/i32/scale.ts +6 -0
  2494. package/src/interface/math/vec2/i32/schema.ts +5 -0
  2495. package/src/interface/math/vec2/i32/shift-left.ts +4 -0
  2496. package/src/interface/math/vec2/i32/shift-right.ts +8 -0
  2497. package/src/interface/math/vec2/i32/subtract.ts +5 -0
  2498. package/src/interface/math/vec2/i32/zero.ts +4 -0
  2499. package/src/interface/math/vec2/index.ts +7 -0
  2500. package/src/interface/math/vec2/public.ts +6 -0
  2501. package/src/interface/math/vec2/u32/add.ts +8 -0
  2502. package/src/interface/math/vec2/u32/bitwise-and.ts +8 -0
  2503. package/src/interface/math/vec2/u32/bitwise-not.ts +5 -0
  2504. package/src/interface/math/vec2/u32/bitwise-or.ts +8 -0
  2505. package/src/interface/math/vec2/u32/bitwise-xor.ts +8 -0
  2506. package/src/interface/math/vec2/u32/clamp.ts +7 -0
  2507. package/src/interface/math/vec2/u32/count-leading-zeros.ts +9 -0
  2508. package/src/interface/math/vec2/u32/count-one-bits.ts +9 -0
  2509. package/src/interface/math/vec2/u32/count-trailing-zeros.ts +9 -0
  2510. package/src/interface/math/vec2/u32/equals.ts +4 -0
  2511. package/src/interface/math/vec2/u32/max.ts +8 -0
  2512. package/src/interface/math/vec2/u32/min.ts +8 -0
  2513. package/src/interface/math/vec2/u32/negate.ts +4 -0
  2514. package/src/interface/math/vec2/u32/public.ts +22 -0
  2515. package/src/interface/math/vec2/u32/reverse-bits.ts +9 -0
  2516. package/src/interface/math/vec2/u32/scale.ts +6 -0
  2517. package/src/interface/math/vec2/u32/schema.ts +5 -0
  2518. package/src/interface/math/vec2/u32/shift-left.ts +4 -0
  2519. package/src/interface/math/vec2/u32/shift-right.ts +8 -0
  2520. package/src/interface/math/vec2/u32/subtract.ts +8 -0
  2521. package/src/interface/math/vec2/u32/u32.ts +8 -0
  2522. package/src/interface/math/vec2/u32/zero.ts +4 -0
  2523. package/src/interface/math/vec3/f32/abs.ts +5 -0
  2524. package/src/interface/math/vec3/f32/acos.ts +5 -0
  2525. package/src/interface/math/vec3/f32/acosh.ts +5 -0
  2526. package/src/interface/math/vec3/f32/add.ts +9 -0
  2527. package/src/interface/math/vec3/f32/asin.ts +5 -0
  2528. package/src/interface/math/vec3/f32/asinh.ts +5 -0
  2529. package/src/interface/math/vec3/f32/atan.ts +5 -0
  2530. package/src/interface/math/vec3/f32/atanh.ts +5 -0
  2531. package/src/interface/math/vec3/f32/ceil.ts +5 -0
  2532. package/src/interface/math/vec3/f32/clamp.ts +7 -0
  2533. package/src/interface/math/vec3/f32/cos.ts +5 -0
  2534. package/src/interface/math/vec3/f32/cosh.ts +5 -0
  2535. package/src/interface/math/vec3/f32/cross.ts +9 -0
  2536. package/src/interface/math/vec3/f32/distance-squared.ts +9 -0
  2537. package/src/interface/math/vec3/f32/distance.ts +7 -0
  2538. package/src/interface/math/vec3/f32/dot.ts +6 -0
  2539. package/src/interface/math/vec3/f32/equals.ts +4 -0
  2540. package/src/interface/math/vec3/f32/exp.ts +5 -0
  2541. package/src/interface/math/vec3/f32/exp2.ts +5 -0
  2542. package/src/interface/math/vec3/f32/f32.ts +7 -0
  2543. package/src/interface/math/vec3/f32/faceforward.ts +8 -0
  2544. package/src/interface/math/vec3/f32/floor.ts +5 -0
  2545. package/src/interface/math/vec3/f32/fract.ts +9 -0
  2546. package/src/interface/math/vec3/f32/length-squared.ts +5 -0
  2547. package/src/interface/math/vec3/f32/length.ts +5 -0
  2548. package/src/interface/math/vec3/f32/log.ts +5 -0
  2549. package/src/interface/math/vec3/f32/log2.ts +5 -0
  2550. package/src/interface/math/vec3/f32/max.ts +9 -0
  2551. package/src/interface/math/vec3/f32/min.ts +9 -0
  2552. package/src/interface/math/vec3/f32/mix.ts +9 -0
  2553. package/src/interface/math/vec3/f32/mod.ts +8 -0
  2554. package/src/interface/math/vec3/f32/modf.ts +8 -0
  2555. package/src/interface/math/vec3/f32/multiply.ts +12 -0
  2556. package/src/interface/math/vec3/f32/negate.ts +5 -0
  2557. package/src/interface/math/vec3/f32/normalize.ts +7 -0
  2558. package/src/interface/math/vec3/f32/one.ts +4 -0
  2559. package/src/interface/math/vec3/f32/pow.ts +10 -0
  2560. package/src/interface/math/vec3/f32/public.ts +55 -0
  2561. package/src/interface/math/vec3/f32/random.ts +6 -0
  2562. package/src/interface/math/vec3/f32/reflect.ts +11 -0
  2563. package/src/interface/math/vec3/f32/refract.ts +16 -0
  2564. package/src/interface/math/vec3/f32/round.ts +10 -0
  2565. package/src/interface/math/vec3/f32/scale.ts +5 -0
  2566. package/src/interface/math/vec3/f32/schema.ts +5 -0
  2567. package/src/interface/math/vec3/f32/sign.ts +5 -0
  2568. package/src/interface/math/vec3/f32/sin.ts +5 -0
  2569. package/src/interface/math/vec3/f32/sinh.ts +5 -0
  2570. package/src/interface/math/vec3/f32/smoothstep.ts +14 -0
  2571. package/src/interface/math/vec3/f32/sqrt.ts +5 -0
  2572. package/src/interface/math/vec3/f32/step.ts +9 -0
  2573. package/src/interface/math/vec3/f32/subtract.ts +9 -0
  2574. package/src/interface/math/vec3/f32/tan.ts +5 -0
  2575. package/src/interface/math/vec3/f32/tanh.ts +5 -0
  2576. package/src/interface/math/vec3/f32/trunc.ts +5 -0
  2577. package/src/interface/math/vec3/f32/zero.ts +4 -0
  2578. package/src/interface/math/vec3/i32/abs.ts +9 -0
  2579. package/src/interface/math/vec3/i32/add.ts +9 -0
  2580. package/src/interface/math/vec3/i32/bitwise-and.ts +9 -0
  2581. package/src/interface/math/vec3/i32/bitwise-not.ts +5 -0
  2582. package/src/interface/math/vec3/i32/bitwise-or.ts +9 -0
  2583. package/src/interface/math/vec3/i32/bitwise-xor.ts +9 -0
  2584. package/src/interface/math/vec3/i32/clamp.ts +7 -0
  2585. package/src/interface/math/vec3/i32/count-leading-zeros.ts +10 -0
  2586. package/src/interface/math/vec3/i32/count-one-bits.ts +10 -0
  2587. package/src/interface/math/vec3/i32/count-trailing-zeros.ts +10 -0
  2588. package/src/interface/math/vec3/i32/equals.ts +4 -0
  2589. package/src/interface/math/vec3/i32/i32.ts +8 -0
  2590. package/src/interface/math/vec3/i32/max.ts +9 -0
  2591. package/src/interface/math/vec3/i32/min.ts +9 -0
  2592. package/src/interface/math/vec3/i32/multiply.ts +9 -0
  2593. package/src/interface/math/vec3/i32/negate.ts +9 -0
  2594. package/src/interface/math/vec3/i32/one.ts +4 -0
  2595. package/src/interface/math/vec3/i32/public.ts +25 -0
  2596. package/src/interface/math/vec3/i32/reverse-bits.ts +10 -0
  2597. package/src/interface/math/vec3/i32/scale.ts +10 -0
  2598. package/src/interface/math/vec3/i32/schema.ts +5 -0
  2599. package/src/interface/math/vec3/i32/shift-left.ts +4 -0
  2600. package/src/interface/math/vec3/i32/shift-right.ts +9 -0
  2601. package/src/interface/math/vec3/i32/subtract.ts +9 -0
  2602. package/src/interface/math/vec3/i32/zero.ts +4 -0
  2603. package/src/interface/math/vec3/index.ts +7 -0
  2604. package/src/interface/math/vec3/public.ts +6 -0
  2605. package/src/interface/math/vec3/u32/add.ts +9 -0
  2606. package/src/interface/math/vec3/u32/bitwise-and.ts +9 -0
  2607. package/src/interface/math/vec3/u32/bitwise-not.ts +5 -0
  2608. package/src/interface/math/vec3/u32/bitwise-or.ts +9 -0
  2609. package/src/interface/math/vec3/u32/bitwise-xor.ts +9 -0
  2610. package/src/interface/math/vec3/u32/clamp.ts +7 -0
  2611. package/src/interface/math/vec3/u32/count-leading-zeros.ts +10 -0
  2612. package/src/interface/math/vec3/u32/count-one-bits.ts +10 -0
  2613. package/src/interface/math/vec3/u32/count-trailing-zeros.ts +10 -0
  2614. package/src/interface/math/vec3/u32/equals.ts +4 -0
  2615. package/src/interface/math/vec3/u32/max.ts +9 -0
  2616. package/src/interface/math/vec3/u32/min.ts +9 -0
  2617. package/src/interface/math/vec3/u32/multiply.ts +9 -0
  2618. package/src/interface/math/vec3/u32/negate.ts +4 -0
  2619. package/src/interface/math/vec3/u32/one.ts +4 -0
  2620. package/src/interface/math/vec3/u32/public.ts +25 -0
  2621. package/src/interface/math/vec3/u32/reverse-bits.ts +10 -0
  2622. package/src/interface/math/vec3/u32/scale.ts +10 -0
  2623. package/src/interface/math/vec3/u32/schema.ts +5 -0
  2624. package/src/interface/math/vec3/u32/shift-left.ts +8 -0
  2625. package/src/interface/math/vec3/u32/shift-right.ts +9 -0
  2626. package/src/interface/math/vec3/u32/subtract.ts +9 -0
  2627. package/src/interface/math/vec3/u32/u32.ts +8 -0
  2628. package/src/interface/math/vec3/u32/volume.ts +4 -0
  2629. package/src/interface/math/vec3/u32/zero.ts +4 -0
  2630. package/src/interface/math/vec4/f32/abs.ts +5 -0
  2631. package/src/interface/math/vec4/f32/acos.ts +5 -0
  2632. package/src/interface/math/vec4/f32/acosh.ts +5 -0
  2633. package/src/interface/math/vec4/f32/add.ts +10 -0
  2634. package/src/interface/math/vec4/f32/asin.ts +5 -0
  2635. package/src/interface/math/vec4/f32/asinh.ts +5 -0
  2636. package/src/interface/math/vec4/f32/atan.ts +5 -0
  2637. package/src/interface/math/vec4/f32/atanh.ts +5 -0
  2638. package/src/interface/math/vec4/f32/ceil.ts +5 -0
  2639. package/src/interface/math/vec4/f32/clamp.ts +7 -0
  2640. package/src/interface/math/vec4/f32/cos.ts +5 -0
  2641. package/src/interface/math/vec4/f32/cosh.ts +5 -0
  2642. package/src/interface/math/vec4/f32/default.ts +6 -0
  2643. package/src/interface/math/vec4/f32/distance.ts +7 -0
  2644. package/src/interface/math/vec4/f32/dot.ts +6 -0
  2645. package/src/interface/math/vec4/f32/exp.ts +5 -0
  2646. package/src/interface/math/vec4/f32/exp2.ts +5 -0
  2647. package/src/interface/math/vec4/f32/f32.ts +7 -0
  2648. package/src/interface/math/vec4/f32/faceforward.ts +8 -0
  2649. package/src/interface/math/vec4/f32/floor.ts +5 -0
  2650. package/src/interface/math/vec4/f32/fract.ts +10 -0
  2651. package/src/interface/math/vec4/f32/length.ts +5 -0
  2652. package/src/interface/math/vec4/f32/log.ts +5 -0
  2653. package/src/interface/math/vec4/f32/log2.ts +5 -0
  2654. package/src/interface/math/vec4/f32/max.ts +10 -0
  2655. package/src/interface/math/vec4/f32/min.ts +10 -0
  2656. package/src/interface/math/vec4/f32/mix.ts +10 -0
  2657. package/src/interface/math/vec4/f32/mod.ts +9 -0
  2658. package/src/interface/math/vec4/f32/modf.ts +8 -0
  2659. package/src/interface/math/vec4/f32/multiply.ts +10 -0
  2660. package/src/interface/math/vec4/f32/negate.ts +5 -0
  2661. package/src/interface/math/vec4/f32/normalize.ts +7 -0
  2662. package/src/interface/math/vec4/f32/pow.ts +11 -0
  2663. package/src/interface/math/vec4/f32/public.ts +48 -0
  2664. package/src/interface/math/vec4/f32/reflect.ts +11 -0
  2665. package/src/interface/math/vec4/f32/refract.ts +16 -0
  2666. package/src/interface/math/vec4/f32/round.ts +11 -0
  2667. package/src/interface/math/vec4/f32/scale.ts +5 -0
  2668. package/src/interface/math/vec4/f32/schema.ts +5 -0
  2669. package/src/interface/math/vec4/f32/sign.ts +5 -0
  2670. package/src/interface/math/vec4/f32/sin.ts +5 -0
  2671. package/src/interface/math/vec4/f32/sinh.ts +5 -0
  2672. package/src/interface/math/vec4/f32/smoothstep.ts +16 -0
  2673. package/src/interface/math/vec4/f32/sqrt.ts +5 -0
  2674. package/src/interface/math/vec4/f32/step.ts +10 -0
  2675. package/src/interface/math/vec4/f32/subtract.ts +10 -0
  2676. package/src/interface/math/vec4/f32/tan.ts +5 -0
  2677. package/src/interface/math/vec4/f32/tanh.ts +5 -0
  2678. package/src/interface/math/vec4/f32/trunc.ts +5 -0
  2679. package/src/interface/math/vec4/i32/abs.ts +10 -0
  2680. package/src/interface/math/vec4/i32/add.ts +10 -0
  2681. package/src/interface/math/vec4/i32/bitwise-and.ts +10 -0
  2682. package/src/interface/math/vec4/i32/bitwise-not.ts +5 -0
  2683. package/src/interface/math/vec4/i32/bitwise-or.ts +10 -0
  2684. package/src/interface/math/vec4/i32/bitwise-xor.ts +10 -0
  2685. package/src/interface/math/vec4/i32/clamp.ts +7 -0
  2686. package/src/interface/math/vec4/i32/count-leading-zeros.ts +11 -0
  2687. package/src/interface/math/vec4/i32/count-one-bits.ts +11 -0
  2688. package/src/interface/math/vec4/i32/count-trailing-zeros.ts +11 -0
  2689. package/src/interface/math/vec4/i32/equals.ts +5 -0
  2690. package/src/interface/math/vec4/i32/i32.ts +8 -0
  2691. package/src/interface/math/vec4/i32/max.ts +10 -0
  2692. package/src/interface/math/vec4/i32/min.ts +10 -0
  2693. package/src/interface/math/vec4/i32/multiply.ts +10 -0
  2694. package/src/interface/math/vec4/i32/negate.ts +10 -0
  2695. package/src/interface/math/vec4/i32/one.ts +4 -0
  2696. package/src/interface/math/vec4/i32/public.ts +25 -0
  2697. package/src/interface/math/vec4/i32/reverse-bits.ts +11 -0
  2698. package/src/interface/math/vec4/i32/scale.ts +11 -0
  2699. package/src/interface/math/vec4/i32/schema.ts +5 -0
  2700. package/src/interface/math/vec4/i32/shift-left.ts +4 -0
  2701. package/src/interface/math/vec4/i32/shift-right.ts +10 -0
  2702. package/src/interface/math/vec4/i32/subtract.ts +10 -0
  2703. package/src/interface/math/vec4/i32/zero.ts +4 -0
  2704. package/src/interface/math/vec4/index.ts +7 -0
  2705. package/src/interface/math/vec4/public.ts +6 -0
  2706. package/src/interface/math/vec4/u32/add.ts +10 -0
  2707. package/src/interface/math/vec4/u32/bitwise-and.ts +10 -0
  2708. package/src/interface/math/vec4/u32/bitwise-not.ts +5 -0
  2709. package/src/interface/math/vec4/u32/bitwise-or.ts +10 -0
  2710. package/src/interface/math/vec4/u32/bitwise-xor.ts +10 -0
  2711. package/src/interface/math/vec4/u32/clamp.ts +7 -0
  2712. package/src/interface/math/vec4/u32/count-leading-zeros.ts +11 -0
  2713. package/src/interface/math/vec4/u32/count-one-bits.ts +11 -0
  2714. package/src/interface/math/vec4/u32/count-trailing-zeros.ts +11 -0
  2715. package/src/interface/math/vec4/u32/equals.ts +5 -0
  2716. package/src/interface/math/vec4/u32/max.ts +10 -0
  2717. package/src/interface/math/vec4/u32/min.ts +10 -0
  2718. package/src/interface/math/vec4/u32/multiply.ts +10 -0
  2719. package/src/interface/math/vec4/u32/negate.ts +4 -0
  2720. package/src/interface/math/vec4/u32/one.ts +4 -0
  2721. package/src/interface/math/vec4/u32/public.ts +24 -0
  2722. package/src/interface/math/vec4/u32/reverse-bits.ts +11 -0
  2723. package/src/interface/math/vec4/u32/scale.ts +11 -0
  2724. package/src/interface/math/vec4/u32/schema.ts +5 -0
  2725. package/src/interface/math/vec4/u32/shift-left.ts +9 -0
  2726. package/src/interface/math/vec4/u32/shift-right.ts +10 -0
  2727. package/src/interface/math/vec4/u32/subtract.ts +10 -0
  2728. package/src/interface/math/vec4/u32/u32.ts +8 -0
  2729. package/src/interface/math/vec4/u32/zero.ts +4 -0
  2730. package/src/interface/platform/platform.ts +36 -0
  2731. package/src/interface/registry/archetypes.test.ts +50 -0
  2732. package/src/interface/registry/archetypes.ts +59 -0
  2733. package/src/interface/registry/declarations.ts +196 -0
  2734. package/src/interface/registry/declared.test.ts +40 -0
  2735. package/src/interface/registry/finalizer-order.ts +53 -0
  2736. package/src/interface/registry/ids.test-helper.ts +48 -0
  2737. package/src/interface/registry/ids.test.ts +111 -0
  2738. package/src/interface/registry/ids.ts +76 -0
  2739. package/src/interface/registry/index.ts +30 -0
  2740. package/src/interface/registry/indexes.ts +74 -0
  2741. package/src/interface/registry/items.ts +95 -0
  2742. package/src/interface/registry/layout.test.ts +106 -0
  2743. package/src/interface/registry/layout.ts +372 -0
  2744. package/src/interface/registry/names.test.ts +73 -0
  2745. package/src/interface/registry/names.ts +174 -0
  2746. package/src/interface/registry/program.ts +112 -0
  2747. package/src/interface/registry/reduction.ts +8 -0
  2748. package/src/interface/registry/schedule.ts +211 -0
  2749. package/src/interface/registry/schemas.ts +119 -0
  2750. package/src/interface/registry/strata.ts +94 -0
  2751. package/src/interface/registry/threads.ts +74 -0
  2752. package/src/interface/registry/traits.ts +13 -0
  2753. package/src/interface/registry/written.ts +15 -0
  2754. package/src/interface/resource/condition.ts +9 -0
  2755. package/src/interface/resource/index.ts +3 -0
  2756. package/src/interface/resource/key.ts +4 -0
  2757. package/src/interface/resource/reduction.ts +12 -0
  2758. package/src/interface/resource/register.test.ts +93 -0
  2759. package/src/interface/resource/resource.ts +5 -0
  2760. package/src/interface/resource/types.ts +7 -0
  2761. package/src/interface/resource/value.ts +21 -0
  2762. package/src/interface/resource/written.ts +5 -0
  2763. package/src/interface/resources/always.ts +13 -0
  2764. package/src/interface/resources/cadence.ts +28 -0
  2765. package/src/interface/resources/clock.ts +19 -0
  2766. package/src/interface/resources/gpu-device.ts +17 -0
  2767. package/src/interface/resources/index.ts +7 -0
  2768. package/src/interface/resources/wake.ts +16 -0
  2769. package/src/interface/resources/workers.ts +13 -0
  2770. package/src/interface/rule/create.ts +27 -0
  2771. package/src/interface/rule/created.ts +5 -0
  2772. package/src/interface/rule/declaration.ts +15 -0
  2773. package/src/interface/rule/index.ts +2 -0
  2774. package/src/interface/rule/rule.ts +4 -0
  2775. package/src/interface/rule/rule.type-test.ts +107 -0
  2776. package/src/interface/schema/is-struct.ts +36 -0
  2777. package/src/interface/schema/schema.ts +190 -0
  2778. package/src/interface/schema/schema.type-test.ts +155 -0
  2779. package/src/interface/schema/schemas.type-test.ts +13 -0
  2780. package/src/interface/system/access.ts +107 -0
  2781. package/src/interface/system/body.ts +79 -0
  2782. package/src/interface/system/check.ts +265 -0
  2783. package/src/interface/system/commands.ts +71 -0
  2784. package/src/interface/system/commands.type-test.ts +87 -0
  2785. package/src/interface/system/composite-declaration.ts +13 -0
  2786. package/src/interface/system/composite-input.type-test.ts +47 -0
  2787. package/src/interface/system/composite.ts +6 -0
  2788. package/src/interface/system/conditions.type-test.ts +57 -0
  2789. package/src/interface/system/create-resolved.ts +21 -0
  2790. package/src/interface/system/create.test.ts +210 -0
  2791. package/src/interface/system/create.ts +208 -0
  2792. package/src/interface/system/declaration.ts +73 -0
  2793. package/src/interface/system/definition.ts +6 -0
  2794. package/src/interface/system/index.ts +4 -0
  2795. package/src/interface/system/input.ts +59 -0
  2796. package/src/interface/system/leaf.ts +20 -0
  2797. package/src/interface/system/lists.type-test.ts +53 -0
  2798. package/src/interface/system/name.ts +7 -0
  2799. package/src/interface/system/optional.type-test.ts +51 -0
  2800. package/src/interface/system/property.ts +5 -0
  2801. package/src/interface/system/render.ts +106 -0
  2802. package/src/interface/system/resolve.test.ts +49 -0
  2803. package/src/interface/system/resolve.ts +165 -0
  2804. package/src/interface/system/shared.type-test.ts +205 -0
  2805. package/src/interface/system/struct.ts +10 -0
  2806. package/src/interface/system/system.ts +11 -0
  2807. package/src/interface/system/system.type-test.ts +423 -0
  2808. package/src/interface/system/threads.ts +47 -0
  2809. package/src/interface/system/threads.type-test.ts +83 -0
  2810. package/src/interface/system/up.type-test.ts +67 -0
  2811. package/src/interface/system/values-of.ts +17 -0
  2812. package/src/interface/system/values.ts +73 -0
  2813. package/src/interface/thread/of.ts +9 -0
  2814. package/src/interface/thread/thread.ts +14 -0
  2815. package/src/interface/thread/thread.type-test.ts +75 -0
  2816. package/src/interface/trait/key.ts +7 -0
  2817. package/src/interface/trait/trait.type-test.ts +85 -0
  2818. package/src/interface/trait/types.ts +69 -0
  2819. package/src/interface/tsconfig.json +28 -0
  2820. package/src/interface/world/create.ts +22 -0
  2821. package/src/interface/world/declarations.ts +34 -0
  2822. package/src/interface/world/filter.ts +10 -0
  2823. package/src/interface/world/index.ts +3 -0
  2824. package/src/interface/world/join.ts +17 -0
  2825. package/src/interface/world/loop.type-test.ts +72 -0
  2826. package/src/interface/world/run.type-test.ts +87 -0
  2827. package/src/interface/world/share.type-test.ts +31 -0
  2828. package/src/interface/world/world.ts +73 -0
  2829. package/src/interface/world/world.type-test.ts +77 -0
  2830. package/src/observe/compare.ts +87 -0
  2831. package/src/observe/entity.ts +232 -0
  2832. package/src/observe/index.ts +2 -0
  2833. package/src/observe/members.ts +43 -0
  2834. package/src/observe/observe.ts +25 -0
  2835. package/src/observe/observe.type-test.ts +85 -0
  2836. package/src/observe/plans.ts +273 -0
  2837. package/src/observe/query.ts +27 -0
  2838. package/src/observe/resource.ts +81 -0
  2839. package/src/observe/select.ts +649 -0
  2840. package/src/observe/to-promise.ts +23 -0
  2841. package/src/observe/tsconfig.json +31 -0
  2842. package/src/observe/values.ts +10 -0
  2843. package/src/observe/world-state.ts +421 -0
  2844. package/src/observe-imports.test.ts +49 -0
  2845. package/src/perftest/benchmark.ts +107 -0
  2846. package/src/perftest/benchmarks.ts +708 -0
  2847. package/src/perftest/editor.ts +126 -0
  2848. package/src/perftest/filters.ts +124 -0
  2849. package/src/perftest/finalized.ts +170 -0
  2850. package/src/perftest/flat.ts +57 -0
  2851. package/src/perftest/growth.ts +47 -0
  2852. package/src/perftest/handoff.ts +147 -0
  2853. package/src/perftest/hierarchy.ts +115 -0
  2854. package/src/perftest/indexes.ts +759 -0
  2855. package/src/perftest/invariants.ts +63 -0
  2856. package/src/perftest/joined.ts +103 -0
  2857. package/src/perftest/journal.ts +55 -0
  2858. package/src/perftest/keys.ts +101 -0
  2859. package/src/perftest/log.ts +126 -0
  2860. package/src/perftest/loop.ts +50 -0
  2861. package/src/perftest/observed-gpu.ts +57 -0
  2862. package/src/perftest/observed.ts +292 -0
  2863. package/src/perftest/observer.ts +58 -0
  2864. package/src/perftest/optional.ts +102 -0
  2865. package/src/perftest/particles.ts +69 -0
  2866. package/src/perftest/placed.ts +178 -0
  2867. package/src/perftest/reads.ts +205 -0
  2868. package/src/perftest/remote.ts +362 -0
  2869. package/src/perftest/render-order.ts +86 -0
  2870. package/src/perftest/run.ts +44 -0
  2871. package/src/perftest/shared.ts +416 -0
  2872. package/src/perftest/strings.ts +135 -0
  2873. package/src/perftest/structural.ts +150 -0
  2874. package/src/perftest/suite.perf-browser-test.ts +136 -0
  2875. package/src/perftest/suite.perf-test.ts +8 -0
  2876. package/src/perftest/suite.ts +214 -0
  2877. package/src/perftest/systems.ts +132 -0
  2878. package/src/perftest/tails.ts +298 -0
  2879. package/src/perftest/transfers.ts +98 -0
  2880. package/src/perftest/uploads.ts +80 -0
  2881. package/src/perftest/values.ts +107 -0
  2882. package/src/perftest/wake.ts +41 -0
  2883. package/src/world.test.ts +46 -0
@@ -0,0 +1,1534 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ /// <reference types="node" />
3
+ import { existsSync } from 'node:fs';
4
+ import { readFile } from 'node:fs/promises';
5
+ import { dirname, resolve } from 'node:path';
6
+ import { describe, expect, test } from 'vitest';
7
+ import { parseAst } from 'vite';
8
+ import { blockShift, chunkShift, type KernelDescription, type KernelModule, type Program } from '../world/kernel.js';
9
+ import { transformKernels } from './transform.js';
10
+ import { createLinker, type LinkHost } from './link.js';
11
+ import { nodeCopies, ownCopy } from './paths.js';
12
+ import { locateThroughMap } from './source-map.js';
13
+ import { estreeOf } from './estree.js';
14
+ import { Mat4x4, Quat, Vec3 } from '../../interface/math/index.js';
15
+ import { generateWgsl } from '../world/wgsl.js';
16
+ import { identityOf } from '../world/reductions.js';
17
+ import type { WasmColumn } from '../world/wasm.js';
18
+
19
+ const parse = (code: string) => estreeOf(parseAst(code));
20
+
21
+ const header = `import { System } from "ecs";
22
+ const position = "position";
23
+ const velocity = "velocity";
24
+ const mass = "mass";
25
+ const alive = "alive";
26
+ const score = "score";
27
+ const delta = "delta";
28
+ const target = "target";
29
+ `;
30
+
31
+ /** The operators the test module's resources declare in their `reduce` traits, by binding. */
32
+ type Reductions = { readonly [binding: string]: string };
33
+ const reductions: Reductions = { total: "+", low: "min", bits: "|" };
34
+
35
+ /**
36
+ * Modules by absolute path, for tests of imports: real files for anything not in `files`, and "ecs" for the package;
37
+ * the test module's resources reduce with `reduced`.
38
+ */
39
+ const host = (files: { readonly [file: string]: string }, reduced: Reductions = reductions): LinkHost => ({
40
+ packages: nodeCopies,
41
+ reductions: file => new Map(file === "/test.js" ? Object.entries(reduced) : []),
42
+ resolve: async (specifier, importer) => {
43
+ if (specifier === "ecs") return ownCopy.index;
44
+ if (specifier === "external") return { error: "external is external to the build", unreadable: true };
45
+ if (!specifier.startsWith(".")) return { error: `${specifier} can't be resolved from ${importer}` };
46
+ const path = resolve(dirname(importer), specifier);
47
+ const typescript = path.replace(/\.js$/, ".ts");
48
+ return files[typescript] !== undefined || (files[path] === undefined && existsSync(typescript)) ? typescript : path;
49
+ },
50
+ load: async file => {
51
+ const code = files[file] ?? await readFile(file, "utf8");
52
+ if (!file.endsWith(".ts")) return { code };
53
+ const { transformWithOxc } = await import("vite");
54
+ const result = await transformWithOxc(code, file, { lang: "ts", sourcemap: true });
55
+ return { code: result.code, locate: result.map === undefined ? undefined : locateThroughMap(result.code, result.map.mappings) };
56
+ },
57
+ });
58
+
59
+ const transform = (source: string, files: { readonly [file: string]: string } = {}, reduced: Reductions = reductions, automatic = true) => transformKernels(`${header}${source}`, "/test.js", parse,
60
+ async specifier => specifier === "ecs" ? ownCopy : null, index => JSON.stringify(`kernel:${index}`), createLinker(host(files, reduced), parse), automatic);
61
+
62
+ type Compiled = KernelDescription & KernelModule;
63
+
64
+ /**
65
+ * Compiles `source`, which assigns its kernel system to `kernel`: the attached description plus its kernel module's
66
+ * `create`. `imported` gives the values of the bindings `source` imports, since its imports aren't evaluated.
67
+ */
68
+ const compile = async (source: string, files: { readonly [file: string]: string } = {}, imported: { readonly [name: string]: unknown } = {}, reduced: Reductions = reductions): Promise<Compiled> => {
69
+ const result = await transform(source, files, reduced);
70
+ if (result === null || "failure" in result) throw new Error(result === null ? "no kernel" : result.failure.message);
71
+ const module = result.code.split("\n").filter(line => !line.startsWith("import ")).join("\n");
72
+ const evaluate = new Function("System", "attachKernel$", "Archetype", ...Object.keys(imported), `${module}\nreturn kernel;`);
73
+ const description: KernelDescription = evaluate({ create: (declaration: unknown, body: unknown) => ({ declaration, body }) }, (_: unknown, attached: unknown) => attached, { create: (list: unknown) => list }, ...Object.values(imported));
74
+ const index = Number(description.url.slice("kernel:".length));
75
+ const kernelModule: KernelModule = new Function(`${result.kernels[index]?.replace("export const create =", "const create =")}\nreturn { create };`)();
76
+ expect(kernelModule.create.toString()).not.toMatch(/\b(position|velocity|mass|alive|score|delta|target)\b/);
77
+ return { ...description, ...kernelModule };
78
+ };
79
+
80
+ const failure = async (source: string, files: { readonly [file: string]: string } = {}, reduced: Reductions = reductions): Promise<string> => {
81
+ const result = await transform(source, files, reduced);
82
+ return result !== null && "failure" in result ? result.failure.message : "compiled";
83
+ };
84
+
85
+ type Fields = { readonly [component: string]: { readonly [path: string]: readonly number[] } };
86
+ type Call = readonly unknown[];
87
+ type Options = {
88
+ readonly resources?: readonly unknown[];
89
+ readonly lookups?: readonly ((entity: number) => readonly unknown[] | null)[];
90
+ readonly args?: unknown;
91
+ readonly booleans?: readonly string[];
92
+ /** Whether the kernel has a `program`; when it does, the program must give the same results as the JS. */
93
+ readonly program?: boolean;
94
+ /** The rows to run, `[start, end)`; all rows by default. */
95
+ readonly range?: readonly [number, number];
96
+ readonly interleaved?: { readonly [component: string]: { readonly stride: number; readonly offsets: { readonly [path: string]: number } } };
97
+ };
98
+
99
+ const tick = 7;
100
+
101
+ type Scalar = number | boolean;
102
+ type Signal = { readonly kind: "normal" } | { readonly kind: "branch"; readonly depth: number } | { readonly kind: "next" };
103
+ const normal: Signal = { kind: "normal" };
104
+
105
+ /** A reference interpreter for `Program`: JS number semantics, boolean typing of columns from `booleans`. */
106
+ type Layout = { readonly strides: readonly number[]; readonly offsets: readonly number[] };
107
+
108
+ /** A reference interpreter for `Program`, indexing columns by the layout as the WASM generator does. */
109
+ const interpret = (program: Program, columns: readonly (Float64Array | Uint32Array)[], booleans: readonly boolean[], layout: Layout, start: number, end: number, resources: readonly unknown[], args: unknown,
110
+ lookups: readonly ((entity: number) => readonly unknown[] | null)[], partials: Float64Array, shared: readonly unknown[] = []): void => {
111
+ const accumulators = program.reductions ?? [];
112
+ /** Accumulators carry from row to row, from their partials and back. */
113
+ const carried = accumulators.map((_, k) => partials[k] ?? NaN);
114
+ const at = (column: number, row: number): number => row * (layout.strides[column] ?? 1) + (layout.offsets[column] ?? 0);
115
+ const scalarAt = (root: unknown, path: readonly (number | string)[]): Scalar => {
116
+ const value = path.reduce<unknown>((item, key) => Reflect.get(Object(item), key), root);
117
+ if (typeof value !== "number" && typeof value !== "boolean") throw new Error(`not a scalar: ${String(value)}`);
118
+ return value;
119
+ };
120
+ for (let row = start; row < end; row++) {
121
+ const locals: Scalar[] = new Array<Scalar>(program.locals).fill(0);
122
+ const handles: (readonly unknown[] | null)[] = new Array<readonly unknown[] | null>(program.handles ?? 0).fill(null);
123
+ const evaluate = (node: Program.Expression): Scalar => {
124
+ switch (node.kind) {
125
+ case "number": case "boolean": return node.value;
126
+ case "column": {
127
+ const value = columns[node.column]?.[at(node.column, row)] ?? NaN;
128
+ return booleans[node.column] === true ? value !== 0 : value;
129
+ }
130
+ case "resource": return scalarAt(resources[node.index], node.path);
131
+ case "args": return scalarAt(args, node.path);
132
+ case "shared": return scalarAt(shared[node.index], node.path);
133
+ case "local": return locals[node.local] ?? NaN;
134
+ case "unary": {
135
+ const operand = evaluate(node.operand);
136
+ switch (node.operator) {
137
+ case "-": return -Number(operand);
138
+ case "+": return Number(operand);
139
+ case "!": return !operand;
140
+ case "~": return ~Number(operand);
141
+ }
142
+ }
143
+ case "binary": {
144
+ const left = evaluate(node.left);
145
+ const right = evaluate(node.right);
146
+ const a = Number(left);
147
+ const b = Number(right);
148
+ switch (node.operator) {
149
+ case "+": return a + b;
150
+ case "-": return a - b;
151
+ case "*": return a * b;
152
+ case "/": return a / b;
153
+ case "%": return a % b;
154
+ case "**": return a ** b;
155
+ case "<": return a < b;
156
+ case ">": return a > b;
157
+ case "<=": return a <= b;
158
+ case ">=": return a >= b;
159
+ case "==": return a === b;
160
+ case "!=": return a !== b;
161
+ case "===": return left === right;
162
+ case "!==": return left !== right;
163
+ case "&": return a & b;
164
+ case "|": return a | b;
165
+ case "^": return a ^ b;
166
+ case "<<": return a << b;
167
+ case ">>": return a >> b;
168
+ case ">>>": return a >>> b;
169
+ }
170
+ }
171
+ case "logical": {
172
+ const left = evaluate(node.left);
173
+ return node.operator === "&&" ? (left ? evaluate(node.right) : left) : (left ? left : evaluate(node.right));
174
+ }
175
+ case "conditional": return evaluate(node.test) ? evaluate(node.consequent) : evaluate(node.alternate);
176
+ case "found": return handles[node.handle] !== null;
177
+ case "lookupLeaf": {
178
+ // Not found reads NaN, as the WASM generator does.
179
+ const values = handles[node.handle];
180
+ if (values === null || values === undefined) return NaN;
181
+ return scalarAt(values[node.read], node.path);
182
+ }
183
+ case "math": {
184
+ const method: unknown = Reflect.get(Math, node.name);
185
+ if (typeof method !== "function") throw new Error(`no Math.${node.name}`);
186
+ const result: unknown = Reflect.apply(method, Math, node.arguments.map(item => Number(evaluate(item))));
187
+ return typeof result === "number" ? result : NaN;
188
+ }
189
+ case "lane": return evaluate(node.value);
190
+ case "upFound": case "upLeaf": throw new Error("programs reading up aren't interpreted here");
191
+ case "listLength": case "listChanged": case "rowLeaf": case "rowEntity": throw new Error("lookups through indexes aren't interpreted here");
192
+ }
193
+ };
194
+ const execute = (statements: readonly Program.Statement[]): Signal => {
195
+ for (const statement of statements) {
196
+ const signal = step(statement);
197
+ if (signal.kind !== "normal") return signal;
198
+ }
199
+ return normal;
200
+ };
201
+ const outward = (signal: Signal): Signal => signal.kind === "branch" ? (signal.depth === 0 ? normal : { kind: "branch", depth: signal.depth - 1 }) : signal;
202
+ const step = (statement: Program.Statement): Signal => {
203
+ switch (statement.kind) {
204
+ case "set": locals[statement.local] = evaluate(statement.value); return normal;
205
+ case "store": { const column = columns[statement.column]; if (column) column[at(statement.column, row)] = Number(evaluate(statement.value)); return normal; }
206
+ case "stamp": {
207
+ const column = columns[statement.column];
208
+ const chunks = columns[statement.chunks];
209
+ const blocks = columns[statement.blocks];
210
+ if (column) column[at(statement.column, row)] = tick;
211
+ if (chunks) chunks[row >> chunkShift] = tick;
212
+ if (blocks) blocks[row >> blockShift] = tick;
213
+ return normal;
214
+ }
215
+ case "if": return execute(evaluate(statement.test) ? statement.consequent : statement.alternate);
216
+ case "block": return outward(execute(statement.body));
217
+ case "loop":
218
+ for (let iteration = 0; iteration < 1e6; iteration++) {
219
+ const signal = execute(statement.body);
220
+ if (signal.kind === "branch" && signal.depth === 0) continue;
221
+ return signal.kind === "normal" ? normal : outward(signal);
222
+ }
223
+ throw new Error("runaway loop");
224
+ case "branch": return { kind: "branch", depth: statement.depth };
225
+ case "branchIf": return evaluate(statement.test) ? { kind: "branch", depth: statement.depth } : normal;
226
+ case "next": return { kind: "next" };
227
+ case "intrinsic": return execute(statement.body);
228
+ case "find": {
229
+ const lookup = lookups[statement.lookup];
230
+ if (lookup === undefined) throw new Error(`no lookup ${statement.lookup}`);
231
+ handles[statement.handle] = lookup(Number(evaluate(statement.entity)));
232
+ return normal;
233
+ }
234
+ case "probe": case "listRow": throw new Error("lookups through indexes aren't interpreted here");
235
+ }
236
+ };
237
+ accumulators.forEach((local, k) => { locals[local] = carried[k] ?? NaN; });
238
+ execute(program.body);
239
+ accumulators.forEach((local, k) => { carried[k] = Number(locals[local]); });
240
+ }
241
+ carried.forEach((value, k) => { partials[k] = value; });
242
+ };
243
+
244
+ /** Padding in interleaved components, which kernels must never touch. */
245
+ const padding = -12345;
246
+
247
+ /**
248
+ * Runs a kernel over hand-built columns; `fields` maps a component to its leaves by JSON path. A component in
249
+ * `options.interleaved` stores its leaves in one array with that stride, at the given offsets per path; others are dense.
250
+ */
251
+ const run = (description: Compiled, rows: number, fields: Fields, options: Options = {}) => {
252
+ const interleaved = options.interleaved ?? {};
253
+ const layout: Layout = {
254
+ strides: description.columns.map(column => column.kind === "field" ? interleaved[String(column.component)]?.stride ?? 1 : 1),
255
+ offsets: description.columns.map(column => column.kind === "field" ? interleaved[String(column.component)]?.offsets[JSON.stringify(column.path)] ?? 0 : 0),
256
+ };
257
+ const build = () => {
258
+ const shared = new Map<string, Float64Array>();
259
+ return description.columns.map((column, index) => {
260
+ if (column.kind === "entity") return Float64Array.from({ length: rows }, (_, row) => 100 + row);
261
+ if (column.kind === "changed") return new Uint32Array(rows);
262
+ if (column.kind === "chunks") return new Float64Array(Math.ceil(rows / 2 ** chunkShift));
263
+ if (column.kind === "blocks") return new Float64Array(Math.ceil(rows / 2 ** blockShift));
264
+ if (column.kind === "present") return new Float64Array(rows);
265
+ const component = String(column.component);
266
+ const values = fields[component]?.[JSON.stringify(column.path)] ?? new Array<number>(rows).fill(0);
267
+ const stride = interleaved[component]?.stride;
268
+ if (stride === undefined) return Float64Array.from(values);
269
+ const array = shared.get(component) ?? new Float64Array(rows * stride).fill(padding);
270
+ shared.set(component, array);
271
+ values.forEach((value, row) => { array[row * stride + (layout.offsets[index] ?? 0)] = value; });
272
+ return array;
273
+ });
274
+ };
275
+ const columns = build();
276
+ const calls: Call[] = [];
277
+ // Records each command start as [kind, entity], and each value or component as [kind, entity, key index, value?].
278
+ let current: readonly [number | "spawn", number] = ["spawn", 0];
279
+ const commands = {
280
+ spawners: description.spawns.map(list => (...values: unknown[]) => {
281
+ current = ["spawn", 999];
282
+ calls.push(current);
283
+ list.forEach((key, k) => calls.push([...current, key, values[k]]));
284
+ return 999;
285
+ }),
286
+ begin: (kind: number, entity: number) => { current = [kind, entity]; calls.push(current); },
287
+ value: (key: number, value: unknown) => { calls.push([...current, key, value]); },
288
+ component: (key: number) => { calls.push([...current, key]); },
289
+ };
290
+ const booleans = description.columns.map(column => column.kind === "field" && (options.booleans ?? []).includes(String(column.component)));
291
+ const [start, end] = options.range ?? [0, rows];
292
+ const partials = Float64Array.from(description.reductions, reduction => identityOf(reduction.operator));
293
+ const interpretedPartials = Float64Array.from(partials);
294
+ description.create(booleans, layout.strides, layout.offsets)(columns, start, end, options.resources ?? [], options.lookups ?? [], description.keys, options.args, commands, tick, partials, 0);
295
+ expect(description.program !== null).toBe(options.program ?? true);
296
+ if (description.program !== null) {
297
+ const interpreted = build();
298
+ interpret(description.program, interpreted, booleans, layout, start, end, options.resources ?? [], options.args, options.lookups ?? [], interpretedPartials);
299
+ expect([...interpretedPartials]).toEqual([...partials]);
300
+ // Bit-identical, including NaN and -0.
301
+ expect(interpreted.map(column => [...column].map(value => Object.is(value, -0) ? "-0" : String(value))))
302
+ .toEqual(columns.map(column => [...column].map(value => Object.is(value, -0) ? "-0" : String(value))));
303
+ }
304
+ const index = (kind: string, component: string, path: readonly (number | string)[] = []) => description.columns.findIndex(column =>
305
+ column.kind === kind && column.kind !== "entity" && column.component === component
306
+ && (column.kind !== "field" || JSON.stringify(column.path) === JSON.stringify(path)));
307
+ return {
308
+ field: (component: string, path: readonly (number | string)[] = []) => {
309
+ const column = index("field", component, path);
310
+ return Array.from({ length: rows }, (_, row) => columns[column]?.[row * (layout.strides[column] ?? 1) + (layout.offsets[column] ?? 0)]);
311
+ },
312
+ /** A component's whole interleaved array, padding included. */
313
+ array: (component: string) => [...columns[index("field", component, [0])] ?? []],
314
+ changed: (component: string) => [...columns[index("changed", component)] ?? []],
315
+ /** A reduced resource's leaf, folded over the rows from its identity. */
316
+ reduced: (resource: string, path: readonly (number | string)[] = []) =>
317
+ partials[description.reductions.findIndex(reduction => reduction.resource === resource && JSON.stringify(reduction.path) === JSON.stringify(path))],
318
+ chunks: (component: string) => [...columns[index("chunks", component)] ?? []],
319
+ calls,
320
+ };
321
+ };
322
+
323
+ const vec3 = (x: readonly number[], y: readonly number[], z: readonly number[]) => ({ "[0]": x, "[1]": y, "[2]": z });
324
+
325
+ describe("kernels by default", () => {
326
+ /** Whether the transform attached a kernel to the module's system, and the failure if it failed. */
327
+ const attached = async (source: string, automatic = true): Promise<boolean | string> => {
328
+ const result = await transform(source, {}, reductions, automatic);
329
+ if (result === null) return false;
330
+ return "failure" in result ? result.failure.message : result.code.includes("attachKernel$(");
331
+ };
332
+ test("compiles a system with components whose body is in the subset, unflagged", async () => {
333
+ expect(await attached(`const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`)).toBe(true);
334
+ });
335
+ test("runs as written, without failing, a body that leaves the subset or a declaration a kernel can't have", async () => {
336
+ expect(await attached(`const log = []; const kernel = System.create({ components: { with: [mass] } }, row => { log.push(row[mass]); });`)).toBe(false);
337
+ expect(await attached(`const kernel = System.create({ components: { with: [mass] } }, (row, { resources }) => { resources[delta] = row[mass]; });`)).toBe(false);
338
+ expect(await attached(`const kernel = System.create({ observer: true, components: { with: [mass] } }, row => { void row[mass]; });`)).toBe(false);
339
+ expect(await attached(`const kernel = System.create({ target: "entity", components: { with: [score] } }, row => { row[score] = 1; });`)).toBe(false);
340
+ expect(await attached(`const make = () => System.create({ components: { with: [score] } }, row => { row[score] = 1; });`)).toBe(false);
341
+ });
342
+ test("runs as written a body reading data of a module object or array, which may change, and compiles one reading constants and functions", async () => {
343
+ expect(await attached(`export const scene = { subject: 0 }; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = scene.subject; });`)).toBe(false);
344
+ expect(await attached(`const values = [1, 2]; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = values[0]; });`)).toBe(false);
345
+ expect(await attached(`const make = () => ({ speed: 2 }); export const settings = make(); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = settings.speed; });`)).toBe(false);
346
+ expect(await attached(`const pair = (a, b) => [a, b]; export const range = pair(1, 2); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = range[1]; });`)).toBe(false);
347
+ expect(await attached(`const wide = true; export const shape = wide ? { size: 2 } : { size: 1 }; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = shape.size; });`)).toBe(false);
348
+ expect(await attached(`const make = () => 3; const three = make(); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = three; });`)).toBe(true);
349
+ expect(await attached(`const half = 0.5; const twice = x => x * 2; const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = twice(row[mass]) * half; });`)).toBe(true);
350
+ expect(await failure(`export const scene = { subject: 0 }; const kernel = System.create({ kernel: true, components: { with: [score] } }, row => { row[score] = scene.subject; });`)).toBe("compiled");
351
+ });
352
+ test("tries none unflagged when automatic compilation is off, as the suites of bodies as written turn it", async () => {
353
+ expect(await attached(`const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`, false)).toBe(false);
354
+ expect(await attached(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`, false)).toBe(true);
355
+ });
356
+ test("never compiles a system without components or with kernel: false", async () => {
357
+ expect(await attached(`const kernel = System.create({ resources: {} }, ({ resources }) => { void resources[delta]; });`)).toBe(false);
358
+ expect(await attached(`const kernel = System.create({ kernel: false, components: { with: [mass, score] } }, row => { row[score] = row[mass]; });`)).toBe(false);
359
+ });
360
+ test("compiles a system with optional components, testing their presence once per call, and fails a GPU kernel with them", async () => {
361
+ expect(await attached(`const kernel = System.create({ components: { with: [score], optional: [mass] } }, row => { const found = row[mass]; if (found !== undefined) row[score] = found; });`)).toBe(true);
362
+ expect(await attached(`const kernel = System.create({ kernel: true, components: { with: [score], optional: [mass] } }, row => { if (row[mass] !== undefined) row[mass] = row[score]; });`)).toBe(true);
363
+ expect(await failure(`const kernel = System.create({ kernel: "gpu", components: { with: [score], optional: [mass] } }, row => { row[score] = 1; });`))
364
+ .toBe("a GPU kernel can't have optional components: WGSL has no undefined to read where an archetype lacks one, and a GPU kernel can't fail its system for one row; list them in with, or use kernel: true to run it on the CPU");
365
+ expect(await failure(`const kernel = System.create({ components: { with: [score] } }, row => { row[score] = row[mass]; });`))
366
+ .toBe("mass isn't in components with or optional, so the system doesn't require it: add it there to use it");
367
+ });
368
+ test("fails, saying why, a system with kernel: true that can't compile", async () => {
369
+ expect(await attached(`const kernel = System.create({ kernel: true }, ({ resources }) => { void resources[delta]; });`))
370
+ .toBe("a system without components runs once, so there's nothing to compile");
371
+ expect(await attached(`const log = []; const kernel = System.create({ kernel: true, components: { with: [mass] } }, row => { log.push(row[mass]); });`)).not.toBe(true);
372
+ expect(await attached(`const make = () => System.create({ kernel: true, components: { with: [score] } }, row => { row[score] = 1; });`))
373
+ .toBe("kernel systems must be declared at module scope");
374
+ });
375
+ });
376
+
377
+ describe("particles", () => {
378
+ test("gravity and integrate", async () => {
379
+ const gravity = await compile(`const kernel = System.create({
380
+ kernel: true,
381
+ components: { with: [velocity] },
382
+ }, (row, { resources }) => {
383
+ const [x, y, z] = row[velocity];
384
+ row[velocity] = [x, y - 9.8 * resources[delta], z];
385
+ });`);
386
+ const fallen = run(gravity, 2, { velocity: vec3([1, 2], [0, 10], [3, 4]) }, { resources: [0.5] });
387
+ expect([fallen.field("velocity", [0]), fallen.field("velocity", [1]), fallen.field("velocity", [2])]).toEqual([[1, 2], [-4.9, 5.1], [3, 4]]);
388
+ expect(fallen.changed("velocity")).toEqual([tick, tick]);
389
+ expect(gravity.shapes).toEqual([{ component: "velocity", leaves: [[0], [1], [2]] }]);
390
+ expect(gravity.resources).toEqual(["delta"]);
391
+
392
+ const integrate = await compile(`const kernel = System.create({
393
+ kernel: true,
394
+ components: { with: [velocity, position] }, after: [{}],
395
+ }, (row, { resources }) => {
396
+ const [px, py, pz] = row[position];
397
+ const [vx, vy, vz] = row[velocity];
398
+ const t = resources[delta];
399
+ row[position] = [px + vx * t, py + vy * t, pz + vz * t];
400
+ });`);
401
+ const moved = run(integrate, 1, { position: vec3([1], [2], [3]), velocity: vec3([2], [4], [6]) }, { resources: [0.5] });
402
+ expect([moved.field("position", [0]), moved.field("position", [1]), moved.field("position", [2])]).toEqual([[2], [4], [6]]);
403
+ expect(moved.changed("position")).toEqual([tick]);
404
+ expect(integrate.columns.some(column => column.kind === "changed" && column.component === "velocity")).toBe(false);
405
+ // Plain reads: no boolean conversion where it isn't observable.
406
+ for (const kernel of [gravity, integrate]) expect(String(kernel.create)).not.toMatch(/\?|booleans\[/);
407
+ });
408
+ });
409
+
410
+ describe("layout", () => {
411
+ test("interleaved components are read and written at row * stride + offset, leaving padding untouched", async () => {
412
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, velocity] } }, (row) => {
413
+ const [x, y, z] = row[velocity];
414
+ row[velocity] = [z, row[alive] === true ? y * 10 : y, x];
415
+ });`);
416
+ const result = run(kernel, 2, { velocity: vec3([1, 4], [2, 5], [3, 6]), alive: { "[]": [1, 0] } }, {
417
+ booleans: ["alive"],
418
+ interleaved: { velocity: { stride: 4, offsets: { "[0]": 0, "[1]": 1, "[2]": 2 } }, alive: { stride: 3, offsets: { "[]": 2 } } },
419
+ });
420
+ expect(result.array("velocity")).toEqual([3, 20, 1, padding, 6, 5, 4, padding]);
421
+ expect(result.changed("velocity")).toEqual([tick, tick]);
422
+ });
423
+
424
+ test("stamps set the changed row and its chunk; each changed column is followed by its chunk column", async () => {
425
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
426
+ if (row[mass] > 0) row[score] = 1;
427
+ });`);
428
+ const rows = 2 * 2 ** chunkShift + 5;
429
+ const mass = new Array<number>(rows).fill(0);
430
+ mass[2 ** chunkShift + 3] = 1;
431
+ const result = run(kernel, rows, { mass: { "[]": mass } });
432
+ const changed = kernel.columns.findIndex(column => column.kind === "changed");
433
+ expect(kernel.columns[changed + 1]).toEqual({ kind: "chunks", component: "score" });
434
+ expect(result.chunks("score")).toEqual([0, tick, 0]);
435
+ expect(result.changed("score").flatMap((value, row) => value === 0 ? [] : [row])).toEqual([2 ** chunkShift + 3]);
436
+ });
437
+
438
+ test("an unconditional stamp stamps the call's chunks once; a stamp after return stays per row", async () => {
439
+ const always = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
440
+ row[score] = row[mass];
441
+ });`);
442
+ expect(String(always.create)).not.toContain(">> 10] = tick");
443
+ expect(run(always, 3200, {}, { range: [1000, 2100] }).chunks("score")).toEqual([tick, tick, tick, 0]);
444
+ const after = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
445
+ if (row[mass] > 0) return;
446
+ row[score] = 1;
447
+ });`);
448
+ expect(String(after.create)).toContain("[i >> 10] = tick");
449
+ const mass = Array.from({ length: 3200 }, (_, row) => row >= 1024 && row < 2048 ? 1 : 0);
450
+ expect(run(after, 3200, { mass: { "[]": mass } }, { range: [1000, 2100] }).chunks("score")).toEqual([tick, 0, tick, 0]);
451
+ });
452
+
453
+ test("indices stay in step when return skips the rest of a row", async () => {
454
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [velocity] } }, (row) => {
455
+ const [x, y, z] = row[velocity];
456
+ if (x > 1 && x < 5) return;
457
+ row[velocity] = [z, y, x];
458
+ });`);
459
+ const result = run(kernel, 3, { velocity: vec3([1, 4, 7], [2, 5, 8], [3, 6, 9]) }, { interleaved: { velocity: { stride: 4, offsets: { "[0]": 1, "[1]": 2, "[2]": 3 } } } });
460
+ expect(result.array("velocity")).toEqual([padding, 3, 2, 1, padding, 4, 5, 6, padding, 9, 8, 7]);
461
+ expect(result.changed("velocity")).toEqual([tick, 0, tick]);
462
+ });
463
+ });
464
+
465
+ describe("reductions", () => {
466
+ const reducing = (body: string, read = "[position, mass]") => `const total = "total";
467
+ const low = "low";
468
+ const bits = "bits";
469
+ const kernel = System.create({ kernel: true, components: { with: ${read} } }, (row, { reduce, resources }) => { ${body} });`;
470
+ const fields = { position: vec3([1, -4, 2], [5, 0, -1], [3, 9, 6]), mass: { "[]": [2, 3, 12] } };
471
+
472
+ test("fold each contribution into its resource, leaf by leaf, from the partial", async () => {
473
+ const kernel = await compile(reducing(`
474
+ const [x, y, z] = row[position];
475
+ reduce[total](row[mass]);
476
+ reduce[total](1);
477
+ reduce[low]([x, y, z]);
478
+ reduce[bits](row[mass]);
479
+ `));
480
+ const result = run(kernel, 3, fields);
481
+ expect(result.reduced("total")).toBe(2 + 3 + 12 + 3);
482
+ expect([0, 1, 2].map(k => result.reduced("low", [k]))).toEqual([-4, -1, 3]);
483
+ expect(result.reduced("bits")).toBe(2 | 3 | 12);
484
+ expect(kernel.reductions.map(reduction => reduction.operator)).toEqual(["+", "min", "min", "min", "|"]);
485
+ });
486
+
487
+ test("fold the values of inlined functions", async () => {
488
+ const kernel = await compile(`import { Vec3 } from "ecs";\n${reducing("reduce[low](Vec3.scale(row[position], 2));", "[position]")}`, {}, {}, { low: "max" });
489
+ expect([0, 1, 2].map(k => run(kernel, 3, fields).reduced("low", [k]))).toEqual([4, 10, 18]);
490
+ });
491
+
492
+ test("that can't be compiled fail with the reason", async () => {
493
+ expect(await failure(reducing("reduce[total](1, 2);"))).toBe("total takes the one value it reduces");
494
+ expect(await failure(reducing("reduce[total](1);"), {}, { total: "avg" })).toBe(`total is reduced, so the build reads its operator from its declaration's reduce trait, "avg", which isn't one of "+", "*", "min", "max", "&", "|", "^"`);
495
+ expect(await failure(reducing("reduce[total](1);"), {}, {})).toBe(`total is reduced, so the build reads its operator from its declaration's reduce trait, ${"which its module's JavaScript doesn't register: declare it in TypeScript, and build a library declaring it with Compiler.plugin({ library: true })"}`);
496
+ expect(await failure(reducing("reduce[total](1);").replace(`kernel: true`, `kernel: "gpu"`))).toBe("a GPU kernel can't use reductions yet");
497
+ expect(await failure(reducing("reduce[total](resources[total]);"))).toBe("total is reduced, so it can't also be read or filtered on");
498
+ });
499
+ });
500
+
501
+ describe("let locals of component values", () => {
502
+ test("written back whole after a tuple assignment have the tuple's shape", async () => {
503
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, position] } }, (row) => {
504
+ let v = row[position];
505
+ if (row[alive]) v = [7, 8, 9];
506
+ row[position] = v;
507
+ });`);
508
+ expect(kernel.columns.some(column => column.kind === "field" && column.path.length === 0 && column.component === "position")).toBe(false);
509
+ const result = run(kernel, 2, { position: vec3([1, 4], [2, 5], [3, 6]), alive: { "[]": [1, 0] } });
510
+ expect([0, 1, 2].map(k => result.field("position", [k]))).toEqual([[7, 4], [8, 5], [9, 6]]);
511
+ });
512
+ });
513
+
514
+ describe("binding identity", () => {
515
+ test("a local shadowing a component key is not that component", async () => {
516
+ expect(await failure(`const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
517
+ const velocity = 1;
518
+ row[position] = row[velocity];
519
+ });`)).toBe("a kernel's body indexes its row and context by key directly, or destructures them by key, so the build sees what it reads and writes; it can't pass them on, alias or spread them");
520
+ });
521
+
522
+ test("another binding with the same key string is not the declared component", async () => {
523
+ expect(await failure(`const speed = "velocity";
524
+ const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
525
+ row[position] = row[speed];
526
+ });`)).toBe("speed isn't in components with or optional, so the system doesn't require it: add it there to use it");
527
+ });
528
+
529
+ test("a helper parameter shadows a module binding only inside the helper", async () => {
530
+ const kernel = await compile(`const twice = (velocity) => velocity * 2;
531
+ const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
532
+ row[position] = twice(row[velocity]) + row[velocity];
533
+ });`);
534
+ expect(run(kernel, 1, { velocity: { "[]": [3] } }).field("position")).toEqual([9]);
535
+ });
536
+ });
537
+
538
+ describe("value semantics", () => {
539
+ test("tuple locals are copies, and snapshots read before later writes", async () => {
540
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
541
+ const before = row[position];
542
+ let v = [before[0], before[1]];
543
+ const w = v;
544
+ v = [10, v[1]];
545
+ row[position] = [v[0], 20];
546
+ row[score] = w[0] * 100 + before[1] + row[position][1];
547
+ });`);
548
+ const result = run(kernel, 1, { position: { "[0]": [1], "[1]": [2] } });
549
+ expect(result.field("position", [0])).toEqual([10]);
550
+ expect(result.field("score")).toEqual([100 + 2 + 20]);
551
+ });
552
+
553
+ test("whole-value writes evaluate every leaf before storing", async () => {
554
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
555
+ row[position] = [row[position][1], row[position][0]];
556
+ let a = 1;
557
+ let b = 2;
558
+ [a, b] = [b, a];
559
+ row[score] = a * 10 + b;
560
+ });`);
561
+ const result = run(kernel, 1, { position: { "[0]": [1], "[1]": [2] } });
562
+ expect([result.field("position", [0]), result.field("position", [1])]).toEqual([[2], [1]]);
563
+ expect(result.field("score")).toEqual([21]);
564
+ });
565
+
566
+ test("struct values and conditional tuples", async () => {
567
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, position] } }, (row) => {
568
+ const p = row[mass] > 1 ? { x: 1, y: [2, 3] } : { x: 4, y: [5, 6] };
569
+ row[position] = p;
570
+ });`);
571
+ expect(kernel.shapes).toEqual([{ component: "position", leaves: [["x"], ["y", 0], ["y", 1]] }]);
572
+ const result = run(kernel, 2, { mass: { "[]": [2, 0] } });
573
+ expect(result.field("position", ["y", 1])).toEqual([3, 6]);
574
+ });
575
+ });
576
+
577
+ describe("helpers", () => {
578
+ test("block helpers inline hygienically with tuples flowing through", async () => {
579
+ const kernel = await compile(`const scale = (v, s) => {
580
+ const [x, y] = v;
581
+ const k = s * 2;
582
+ return [x * k, y * k];
583
+ };
584
+ const length = ([x, y]) => Math.sqrt(x * x + y * y);
585
+ const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
586
+ const k = 100;
587
+ const x = 1;
588
+ row[position] = scale(row[position], 0.5);
589
+ row[score] = length(row[position]) + k + x;
590
+ });`);
591
+ const result = run(kernel, 1, { position: { "[0]": [3], "[1]": [4] } });
592
+ expect([result.field("position", [0]), result.field("position", [1])]).toEqual([[3], [4]]);
593
+ expect(result.field("score")).toEqual([106]);
594
+ });
595
+
596
+ test("recursive helpers are rejected", async () => {
597
+ expect(await failure(`const f = (x) => f(x);
598
+ const kernel = System.create({ kernel: true, components: { with: [score] } }, (row) => { row[score] = f(1); });`))
599
+ .toBe("f is recursive");
600
+ });
601
+ });
602
+
603
+ describe("control flow", () => {
604
+ test("return ends the row, also from inside a loop", async () => {
605
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
606
+ if (row[mass] < 0) return;
607
+ let total = 0;
608
+ for (let i = 0; i < 10; i++) {
609
+ if (i % 2 === 0) continue;
610
+ if (i > row[mass]) return;
611
+ total += i;
612
+ }
613
+ row[score] = total;
614
+ });`);
615
+ expect(run(kernel, 3, { mass: { "[]": [-1, 20, 3] }, score: { "[]": [5, 5, 5] } }).field("score")).toEqual([5, 25, 5]);
616
+ });
617
+
618
+ test("a loop test that inlines a helper is re-evaluated each iteration", async () => {
619
+ const kernel = await compile(`const below = (a, b) => { const limit = b * 2; return a < limit; };
620
+ const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
621
+ let n = 0;
622
+ while (below(n, row[mass])) { n++; }
623
+ let m = 0;
624
+ do { m += 1; } while (m < 3);
625
+ row[score] = n * 10 + m;
626
+ });`);
627
+ expect(run(kernel, 1, { mass: { "[]": [3] } }).field("score")).toEqual([63]);
628
+ });
629
+ });
630
+
631
+ describe("context", () => {
632
+ test("lookups map components to their read index, with null guards", async () => {
633
+ const kernel = await compile(`const half = (value) => { const h = value / 2; return h; };
634
+ const kernel = System.create({ kernel: true, components: { with: [target, position, score] }, lookup: { targets: { with: [mass, position] } } }, (row, { lookup: { targets } }) => {
635
+ const other = targets(row[target]);
636
+ if (other !== null) { row[position] = other[position] - other[mass]; }
637
+ row[score] = (other !== null && half(other[position])) || -1;
638
+ });`);
639
+ expect(kernel.lookups).toEqual(["targets"]);
640
+ const found = (entity: number) => entity === 1 ? [3, 10] : null;
641
+ const result = run(kernel, 2, { target: { "[]": [1, 2] }, position: { "[]": [0, 0] } }, { lookups: [found], program: false });
642
+ expect(result.field("position")).toEqual([7, 0]);
643
+ expect(result.field("score")).toEqual([5, -1]);
644
+ });
645
+
646
+ test("optional lookup access, destructured context groups and input", async () => {
647
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [target, score] }, lookup: { targets: { with: [mass] } } }, (row, { resources: { [delta]: d }, lookup: { targets } }, input) => {
648
+ row[score] = (targets(row[target])?.[mass] ?? 0) + d + input;
649
+ });`);
650
+ const found = (entity: number) => entity === 1 ? [3] : null;
651
+ expect(run(kernel, 2, { target: { "[]": [1, 2] } }, { lookups: [found], resources: [10], args: 100, program: false }).field("score")).toEqual([113, 110]);
652
+ });
653
+
654
+ test("context groups reached through the context parameter", async () => {
655
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [target, score] }, lookup: { targets: { with: [mass] } } }, (row, context, input) => {
656
+ const { resources } = context;
657
+ row[score] = (context.lookup.targets(row[target])?.[mass] ?? 0) + resources[delta] + input;
658
+ });`);
659
+ const found = (entity: number) => entity === 1 ? [3] : null;
660
+ expect(run(kernel, 2, { target: { "[]": [1, 2] } }, { lookups: [found], resources: [10], args: 100, program: false }).field("score")).toEqual([113, 110]);
661
+ });
662
+
663
+ test("boolean columns read as booleans", async () => {
664
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, score] } }, (row) => {
665
+ row[score] = row[alive] === true ? 1 : 2;
666
+ });`);
667
+ expect(run(kernel, 2, { alive: { "[]": [1, 0] } }, { booleans: ["alive"] }).field("score")).toEqual([1, 2]);
668
+ expect(run(kernel, 1, { alive: { "[]": [1] } }).field("score")).toEqual([2]);
669
+ });
670
+
671
+ test("boolean reads convert only where observable, including through locals", async () => {
672
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, mass, score] } }, (row, { commands }) => {
673
+ const flag = row[alive];
674
+ const copy = flag;
675
+ row[score] = (copy === true ? 10 : 20) + row[mass] * 2 + (flag ? 1 : 0);
676
+ commands.spawn([alive, mass])({ [alive]: flag, [mass]: row[mass] });
677
+ });`);
678
+ const result = run(kernel, 2, { alive: { "[]": [1, 0] }, mass: { "[]": [3, 4] } }, { booleans: ["alive"], program: false });
679
+ expect(result.field("score")).toEqual([17, 28]);
680
+ expect(result.calls).toEqual([
681
+ ["spawn", 999], ["spawn", 999, 0, true], ["spawn", 999, 1, 3],
682
+ ["spawn", 999], ["spawn", 999, 0, false], ["spawn", 999, 1, 4],
683
+ ]);
684
+ const source = String(kernel.create);
685
+ // Converted: the snapshot of `flag` (observed through `copy ===` and spawn) and `mass` in the spawn value.
686
+ expect(source.match(/ \? c\d+\[x\d+\] !== 0/g)?.length).toBe(2);
687
+ expect(source.match(/booleans\[/g)?.length).toBe(2);
688
+ });
689
+
690
+ test("a spawn nested in an add's value is issued before the add begins", async () => {
691
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => {
692
+ commands.add(row.entity, [target, score], { [target]: commands.spawn([mass])({ [mass]: row[mass] }), [score]: 1 });
693
+ commands.despawn(row.entity);
694
+ });`);
695
+ expect(kernel.keys).toEqual(["mass", "target", "score"]);
696
+ expect(String(kernel.create)).not.toMatch(/\bkeys\[/);
697
+ expect(run(kernel, 1, { mass: { "[]": [5] } }, { program: false }).calls).toEqual([
698
+ ["spawn", 999], ["spawn", 999, 0, 5],
699
+ [2, 100], [2, 100, 1, 999], [2, 100, 2, 1],
700
+ [1, 100],
701
+ ]);
702
+ });
703
+
704
+ test("commands name components through keys", async () => {
705
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position] } }, (row, context) => {
706
+ const { commands } = context;
707
+ const spawned = commands.spawn([position, alive])({ [position]: [row[position][0], 1] });
708
+ commands.add(spawned, score, row.entity);
709
+ commands.add(spawned, alive);
710
+ commands.remove(row.entity, [alive, score]);
711
+ commands.remove(row.entity, mass);
712
+ });`);
713
+ expect(kernel.keys).toEqual(["position", "alive", "score", "mass"]);
714
+ // Only position is given a tuple; registration checks such components are stored in linear memory.
715
+ expect(kernel.structuredValues).toEqual([0]);
716
+ // A component given no value is given undefined, which the runtime writes as the component's start.
717
+ expect(run(kernel, 1, { position: { "[0]": [5] } }, { program: false }).calls).toEqual([
718
+ ["spawn", 999], ["spawn", 999, 0, [5, 1]], ["spawn", 999, 1, undefined],
719
+ [2, 999], [2, 999, 2, 100],
720
+ [2, 999], [2, 999, 1, undefined],
721
+ [3, 100], [3, 100, 1], [3, 100, 2],
722
+ [3, 100], [3, 100, 3],
723
+ ]);
724
+ });
725
+
726
+ test("commands name lists through module constants: array literals, and lists the build gave an index", async () => {
727
+ const kernel = await compile(`function archetype$(list) { return list; }
728
+ const unit = archetype$([position, alive, score]);
729
+ const pair = [mass, score];
730
+ const kernel = System.create({ kernel: true, components: { with: [position] } }, (row, { commands }) => {
731
+ const spawned = commands.spawn(unit)({ [score]: 2, [position]: [row[position][0], 1] });
732
+ commands.add(spawned, pair, { [mass]: 3 });
733
+ commands.remove(row.entity, unit);
734
+ });`);
735
+ expect(kernel.keys).toEqual(["position", "alive", "score", "mass"]);
736
+ expect(kernel.structuredValues).toEqual([0]);
737
+ expect(run(kernel, 1, { position: { "[0]": [5] } }, { program: false }).calls).toEqual([
738
+ ["spawn", 999], ["spawn", 999, 0, [5, 1]], ["spawn", 999, 1, undefined], ["spawn", 999, 2, 2],
739
+ [2, 999], [2, 999, 3, 3], [2, 999, 2, undefined],
740
+ [3, 100], [3, 100, 0], [3, 100, 1], [3, 100, 2],
741
+ ]);
742
+ });
743
+
744
+ test("kernel declarations list components through module constants", async () => {
745
+ const kernel = await compile(`
746
+ const moving = [position, velocity];
747
+ const kernel = System.create({ kernel: true, components: { with: [score, ...moving] } }, row => {
748
+ row[score] = row[position] + row[velocity];
749
+ });`);
750
+ expect(run(kernel, 2, { position: { "[]": [1, 2] }, velocity: { "[]": [10, 20] } }).field("score")).toEqual([11, 22]);
751
+ });
752
+
753
+ test.each([
754
+ ["a value for a component the list doesn't name", "commands.spawn([mass])({ [mass]: 1, [score]: 2 });", "score isn't one of the command's components"],
755
+ ["a spawner kept rather than called", "const spawn = commands.spawn([mass]); spawn({ [mass]: 1 });", "a kernel calls the spawner where it gets it, as commands.spawn(components)(values)"],
756
+ ["a list holding a spread of what isn't a list", "commands.spawn([...mass])({});", "commands.spawn: mass is a key, not a list of components; list it as [mass]"],
757
+ ["a list that isn't a module constant", "const list = 1; commands.add(row.entity, list, {});", "commands name components by identifiers bound at module scope"],
758
+ ["a component listed twice", "commands.remove(row.entity, [mass, mass]);", "mass is listed twice"],
759
+ ["an add with too many arguments", "commands.add(row.entity, mass, 1, 2);", "an add is commands.add(entity, component, value) or commands.add(entity, components, values)"],
760
+ ["a remove with rest components", "commands.remove(row.entity, mass, score);", "a remove is commands.remove(entity, component) or commands.remove(entity, components)"],
761
+ ])("fail the build for %s", async (_, body, message) => {
762
+ expect(await failure(`const pair = [mass, score];\nconst kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => { const m = row[mass]; ${body} });`)).toBe(message);
763
+ });
764
+ });
765
+
766
+ describe("program", () => {
767
+ test("input and resource paths are scalars in the program", async () => {
768
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [score] } }, (row, { resources: { [delta]: d } }, input) => {
769
+ const [, y] = d;
770
+ row[score] = y * input.scale + Math.max(input.scale, Math.PI) + (input.flag ? 1 : 0);
771
+ });`);
772
+ const result = run(kernel, 1, {}, { resources: [[1, 2]], args: { scale: 3, flag: true } });
773
+ expect(result.field("score")).toEqual([2 * 3 + Math.PI + 1]);
774
+ expect(JSON.stringify(kernel.program)).toContain(`{"kind":"resource","index":0,"path":[1]}`);
775
+ expect(JSON.stringify(kernel.program)).toContain(`{"kind":"args","path":["scale"]}`);
776
+ });
777
+
778
+ test("runtime indexing into a resource has no program", async () => {
779
+ const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row, { resources: { [delta]: d } }) => {
780
+ row[score] = d[row[mass]];
781
+ });`);
782
+ expect(run(kernel, 1, { mass: { "[]": [1] } }, { resources: [[5, 6]], program: false }).field("score")).toEqual([6]);
783
+ });
784
+ });
785
+
786
+ describe("composites", () => {
787
+ test("one argument to System.create that isn't a body is a composite, never a kernel", async () => {
788
+ const result = await transform(`const a = System.create({}, () => {});
789
+ const listed = System.create([a]);
790
+ const declared = System.create({ kernel: true, systems: [a], components: { with: [score] } });`);
791
+ expect(result !== null && "failure" in result ? result.failure.message : result?.kernels ?? []).toEqual([]);
792
+ });
793
+ });
794
+
795
+ describe("lookups in the program", () => {
796
+ const targets = (entity: number) => entity === 1 ? [3, [10, 20, 30]] : entity === 2 ? [4, [40, 50, 60]] : null;
797
+ const declaration = (body: string, read = "[target]", lookup = "targets: { with: [mass, position] }") => `const kernel = System.create({ kernel: true,
798
+ components: { with: ${read.replace("]", ", score]")} }, lookup: { ${lookup} } },
799
+ (row, { lookup: { ${lookup.includes("others") ? "targets, others" : "targets"} } }) => { ${body} });`;
800
+
801
+ test("guarded leaf access, early return and a second lookup in its own handle", async () => {
802
+ const kernel = await compile(declaration(`
803
+ const other = targets(row[target]);
804
+ if (other === null) return;
805
+ const [tx, ty] = other[position];
806
+ const second = others(row[mass]);
807
+ const extra = second !== null ? second[position][2] : 0;
808
+ row[score] = tx - other[mass] + ty * 0 + extra;
809
+ `, "[target, mass]", "targets: { with: [mass, position] }, others: { with: [position] }"));
810
+ expect(kernel.program?.handles).toBe(2);
811
+ const others = (entity: number) => entity === 2 ? [[0, 0, 7]] : null;
812
+ expect(run(kernel, 3, { target: { "[]": [1, 2, 3] }, mass: { "[]": [2, 0, 0] }, score: { "[]": [-1, -1, -1] } }, { lookups: [targets, others] }).field("score"))
813
+ .toEqual([10 - 3 + 7, 40 - 4, -1]);
814
+ });
815
+
816
+ test("optional chains read NaN when nothing was found, anywhere", async () => {
817
+ const kernel = await compile(declaration(`row[score] = targets(row[target])?.[position]?.[1] * 2;`, "[target]", "targets: { with: [position] }"));
818
+ expect(kernel.program).not.toBeNull();
819
+ expect(run(kernel, 2, { target: { "[]": [1, 5] } }, { lookups: [entity => targets(entity)?.slice(1) ?? null] }).field("score")).toEqual([40, NaN]);
820
+ });
821
+
822
+ test("guards through && and conditional tests", async () => {
823
+ const kernel = await compile(declaration(`
824
+ const other = targets(row[target]);
825
+ row[score] = other && other[mass] > 3 ? other[position][0] : -other?.[mass];
826
+ `));
827
+ expect(kernel.program).not.toBeNull();
828
+ expect(run(kernel, 3, { target: { "[]": [1, 2, 3] } }, { lookups: [targets, () => null] }).field("score")).toEqual([-3, 40, NaN]);
829
+ });
830
+
831
+ test.each([
832
+ ["an unguarded leaf access", `const other = targets(row[target]); row[score] = other[mass];`, "targets: { with: [mass] }"],
833
+ ["a lookup result used whole", `const other = targets(row[target]); row[score] = other;`, "targets: { with: [mass] }"],
834
+ ["a leaf access after the guard's scope", `const other = targets(row[target]); if (other !== null) { row[score] = 1; } row[score] = other[mass];`, "targets: { with: [mass] }"],
835
+ ])("no program for %s", async (_, body, lookup) => {
836
+ const kernel = await compile(declaration(body, "[target]", lookup));
837
+ expect(kernel.program).toBeNull();
838
+ });
839
+ });
840
+
841
+ describe("subset", () => {
842
+ const kernel = (body: string, components = "{ with: [mass, score] }") =>
843
+ `const kernel = System.create({ kernel: true, components: ${components} }, (row, { commands }) => { ${body} });`;
844
+
845
+ test.each([
846
+ ["row[mass] = 1;", "compiled"],
847
+ ["row[score] = row[score] + row[mass];", "compiled"],
848
+ ["const f = () => 1;", "functions can't be created in a kernel; define helpers at module scope"],
849
+ ["row[score] = \"a\";", "only number, boolean and null literals are in the kernel subset"],
850
+ ["var x = 1;", "use const or let, not var"],
851
+ ["return 1;", "a kernel returns nothing; return ends the current row"],
852
+ ["row[score] = new Float32Array(1)[0];", "NewExpression is not in the kernel subset"],
853
+ ["row[score] = Math.random();", "Math.random is not in the kernel subset"],
854
+ ["row[score] = mass;", "mass is a key; use it to index, as in row[mass]"],
855
+ ["const v = [1, 2]; row[score] = v[row[mass]];", "tuple elements are indexed by an in-range literal"],
856
+ ["let v = [1, 2]; v[0] = 3;", "values are immutable; assign a whole new value to a let local"],
857
+ ])("%s", async (body, message) => {
858
+ expect(await failure(kernel(body))).toBe(message);
859
+ });
860
+
861
+ test("component values are written whole", async () => {
862
+ expect(await failure(kernel("row[position][0] = 1;", "{ with: [position] }"))).toBe("component values are immutable; write the whole value");
863
+ });
864
+
865
+ test("GPU kernels", async () => {
866
+ const gpu = (declaration: string, body: string) =>
867
+ `const kernel = System.create({ kernel: "gpu", ${declaration} }, (row, context) => { ${body} });`;
868
+ expect(await failure(gpu("components: { with: [mass, score] }", "row[score] = row[mass] * 2;"))).toBe("compiled");
869
+ expect(await failure(gpu("components: { with: [target, score] }, lookup: { targets: { with: [mass] } }", "row[score] = 1;")))
870
+ .toBe("a GPU kernel can't use lookups yet");
871
+ expect(await failure(gpu("components: { with: [score], changed: [mass] }", "row[score] = 1;"))).toBe("a GPU kernel can't use change filters yet");
872
+ expect(await failure(gpu("components: { with: [mass, score] }", "context.commands.despawn(row.entity);")))
873
+ .toBe("a GPU kernel can't issue commands or use values that aren't numbers or booleans");
874
+ expect(await failure(gpu("components: { with: [mass, score] }", "let s = 0; for (let i = 0; i < 3; i++) s += i; row[score] = s;")))
875
+ .toBe("a GPU kernel can't use loops or labeled blocks yet");
876
+ expect(await failure(`const kernel = System.create({ kernel: "cpu", components: { with: [score] } }, (row) => {});`))
877
+ .toBe(`kernel must be the literal true, false or "gpu"`);
878
+ });
879
+
880
+ test("GPU programs carry their locals' names", async () => {
881
+ const body = "(row) => { const doubled = row[mass] * 2; row[score] = doubled; }";
882
+ const gpu = await compile(`const kernel = System.create({ kernel: "gpu", components: { with: [mass, score] } }, ${body});`);
883
+ const cpu = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, ${body});`);
884
+ expect(gpu.program?.names).toEqual([expect.stringMatching(/^doubled_\d+$/)]);
885
+ expect(cpu.program?.names).toBeUndefined();
886
+ });
887
+
888
+ test("kernels inside functions", async () => {
889
+ expect(await failure(`const make = () => System.create({ kernel: true, components: { with: [score] } }, (row) => {});`))
890
+ .toBe("kernel systems must be declared at module scope");
891
+ });
892
+
893
+ test("failures carry the offending position", async () => {
894
+ const source = kernel("var x = 1;");
895
+ const result = await transform(source);
896
+ const position = `${header}${source}`.indexOf("var x = 1");
897
+ expect(result !== null && "failure" in result ? result.failure.position : -1).toBe(position);
898
+ });
899
+
900
+ test("non-kernel systems that may reach their commands and other modules are left untouched", async () => {
901
+ const reaching = await transform(`const s = System.create({ components: { with: [mass] } }, (row, context) => { const f = () => [row, context]; });`);
902
+ expect(reaching !== null && "code" in reaching ? reaching.code : "").not.toContain("terminal$(");
903
+ expect(await transformKernels(`import { System } from "other";\nSystem.create({ kernel: true }, () => {});`, "/x.js", parse, async () => null, () => "")).toBeNull();
904
+ });
905
+ });
906
+
907
+ describe("without a linker", () => {
908
+ test("a kernel tried in the package's interface inlines that module's data, which the interface keeps fixed", async () => {
909
+ const file = ownCopy.index.replace(/\/index\.[jt]s$/, "/interface/fixed.js");
910
+ const source = `import { System } from "ecs";\nconst position = "position";\nconst weights = [1, 2];\nexport const scaled = System.create({ components: { with: [position] } }, (row) => { row[position] = weights[0]; });\n`;
911
+ const result = await transformKernels(source, file, parse, async () => ownCopy, index => JSON.stringify(`kernel:${index}`), undefined, true, undefined, nodeCopies);
912
+ expect(result !== null && "kernels" in result ? result.kernels.length : 0).toBe(1);
913
+ const elsewhere = await transformKernels(source, "/app/fixed.js", parse, async () => ownCopy, index => JSON.stringify(`kernel:${index}`), undefined, true, undefined, nodeCopies);
914
+ expect(elsewhere !== null && "kernels" in elsewhere ? elsewhere.kernels.length : 0).toBe(0);
915
+ });
916
+ });
917
+
918
+ describe("terminal bodies", () => {
919
+ /** Whether the transform marks a main-thread system's body as one that never reaches its commands. */
920
+ const marked = async (parameters: string, body: string, declaration = `{}`): Promise<boolean> => {
921
+ const result = await transform(`const system = System.create(${declaration}, ${parameters} => { ${body} });`);
922
+ if (result !== null && "failure" in result) throw new Error(result.failure.message);
923
+ const code = result?.code ?? "";
924
+ return code.includes("terminal$((") && code.includes("function terminal$(body)");
925
+ };
926
+ test.each([
927
+ ["no context", "(row)", "console.log(row);", `{ components: { with: [mass] } }`],
928
+ ["a context destructured without commands", "({ resources })", "console.log(resources);", `{}`],
929
+ ["a context used only through its other properties", "(context)", "console.log(context.resources);", `{ resources: {} }`],
930
+ ["a context reaching resources and lookups", "(row, context)", "console.log(context.resources, context.lookup, row);", `{ components: { with: [mass] } }`],
931
+ ["nested destructuring", "({ resources: { [delta]: d } })", "console.log(d);", `{ resources: {} }`],
932
+ ])("mark a body with %s", async (_, parameters, body, declaration) => {
933
+ expect(await marked(parameters, body, declaration)).toBe(true);
934
+ });
935
+ test.each([
936
+ ["destructured commands", "({ commands })", "commands.despawn(1);"],
937
+ ["renamed commands", "({ commands: issue })", "issue.despawn(1);"],
938
+ ["the context's commands", "(context)", "context.commands.despawn(1);"],
939
+ ["the context's commands by a computed key", "(context)", `context["commands"].despawn(1);`],
940
+ ["the context passed on", "(context)", "console.log(context);"],
941
+ ["the context aliased", "(context)", "const c = context; console.log(c);"],
942
+ ["a rest of the context", "({ ...rest })", "console.log(rest);"],
943
+ ["a computed key of the context", "({ [score]: s })", "console.log(s);"],
944
+ ["the context redeclared", "(context)", "{ const context = 1; console.log(context); }"],
945
+ ["eval", "(context)", "eval('context.commands');"],
946
+ ["a rest parameter", "(...parameters)", "console.log(parameters);"],
947
+ ])("leave a body unmarked that reaches its commands through %s", async (_, parameters, body) => {
948
+ expect(await marked(parameters, body)).toBe(false);
949
+ });
950
+ test("leave a function body unmarked that uses arguments", async () => {
951
+ const result = await transform(`const system = System.create({}, function () { console.log(arguments); });`);
952
+ expect(result !== null && "code" in result ? result.code : "").not.toContain("terminal$(");
953
+ });
954
+ test("mark a system made from its body alone, and no kernel or finalizer", async () => {
955
+ const alone = await transform("const system = System.create(() => { console.log(1); });");
956
+ expect(alone !== null && "code" in alone ? alone.code : "").toContain("System.create(access$(terminal$(() =>");
957
+ const kernel = await transform(`const kernel = System.create({ kernel: true, components: { with: [score] } }, (row) => { row[score] = 1; });`);
958
+ expect(kernel !== null && "code" in kernel ? kernel.code : "").not.toContain("terminal$");
959
+ const finalizer = await transformKernels(`import { Finalizer } from "ecs";\nconst f = Finalizer.create({ components: { with: [] } }, () => {});`, "/x.js", parse, async () => ownCopy, () => "");
960
+ expect(finalizer !== null && "code" in finalizer ? finalizer.code : "").not.toContain("terminal$(");
961
+ });
962
+ });
963
+
964
+ describe("index lookups in main-thread systems", () => {
965
+ /** Runs the transformed body once, recording each lookup as the runtime hook receives it. */
966
+ const looked = async (body: string, parameters = "({ lookup })", lookup = "near: { index: grid }"): Promise<{ readonly code: string; readonly calls: readonly unknown[] }> => {
967
+ const source = `const grid = "grid";\nconst system = System.create({ lookup: { ${lookup} } }, ${parameters} => { ${body} });`;
968
+ const result = await transform(source);
969
+ if (result !== null && "failure" in result) return { code: result.failure.message, calls: [] };
970
+ const module = (result?.code ?? `${header}${source}`).split("\n").filter(line => !line.startsWith("import ")).join("\n");
971
+ const calls: unknown[] = [];
972
+ const prepare = (shape: unknown) => ({ find: (lookup: unknown, ...values: unknown[]) => { calls.push(["site", shape, Reflect.apply(String, undefined, [lookup]), values]); return { length: 0 }; } });
973
+ const system = new Function("System", "prepareLookup$", `${module}\nreturn system;`)({ create: (declaration: unknown, run: unknown) => ({ declaration, run }) }, prepare);
974
+ const named = (name: string) => Object.assign((...values: unknown[]) => { calls.push(["call", name, values]); return { length: 0 }; }, { toString: () => name });
975
+ system.run({ lookup: { near: named("near"), due: named("due"), other: named("other") } });
976
+ return { code: result?.code ?? source, calls };
977
+ };
978
+
979
+ test("pass literal tuples and comparisons flattened, through a site of each call", async () => {
980
+ const { calls } = await looked(`const x = 1; lookup.near([x, x + 1]); lookup.near([3, 4]); lookup.near(x); lookup.due(x, { ">=": x, "<": [x, 9] });`, "({ lookup })", "near: { index: grid }, due: { index: grid }");
981
+ expect(calls).toEqual([["site", [2], "near", [1, 2]], ["site", [2], "near", [3, 4]], ["site", [0], "near", [1]], ["site", [0, [[">=", 0], ["<", 2]]], "due", [1, 1, 1, 9]]]);
982
+ });
983
+
984
+ test.each([
985
+ ["the context's lookup", "context.lookup.near([1, 2]);", "(context)"],
986
+ ["a destructured lookup", "near([1, 2]);", "({ lookup: { near } })"],
987
+ ])("rewrite %s", async (_, body, parameters) => {
988
+ const { calls } = await looked(body, parameters);
989
+ expect(calls).toEqual([["site", [2], "near", [1, 2]]]);
990
+ });
991
+
992
+ test.each([
993
+ ["a lookup by entity", "lookup.other(1);", "near: { index: grid }, other: { read: [] }"],
994
+ ["a spread", "const key = [[1, 2]]; lookup.near(...key);", "near: { index: grid }"],
995
+ ["a lookup kept", "const near = lookup.near; near([1, 2]);", "near: { index: grid }"],
996
+ ["redeclared lookups", "{ const lookup = {}; } lookup.near([1, 2]);", "near: { index: grid }"],
997
+ ["a call inside another's key", "lookup.near(lookup.near(1).length);", "near: { index: grid }"],
998
+ ])("leave %s as written", async (_, body, lookup) => {
999
+ const { calls } = await looked(body, "({ lookup })", lookup);
1000
+ expect(calls.some(call => Array.isArray(call) && call[0] === "call")).toBe(true);
1001
+ });
1002
+ });
1003
+
1004
+ describe("commands in main-thread systems", () => {
1005
+ /** Runs the transformed system's body once, recording each spawn's and add's keys and values as the runtime hooks receive them. */
1006
+ const spawned = async (body: string, parameters = "({ commands })", declaration = `{}`): Promise<{ readonly code: string; readonly calls: readonly unknown[] }> => {
1007
+ const source = `const system = System.create(${declaration}, ${parameters} => { ${body} });`;
1008
+ const result = await transform(source);
1009
+ if (result !== null && "failure" in result) return { code: result.failure.message, calls: [] };
1010
+ const module = (result?.code ?? `${header}${source}`).split("\n").filter(line => !line.startsWith("import ")).join("\n");
1011
+ const calls: unknown[] = [];
1012
+ const prepare = (keys: () => readonly unknown[]) => ({
1013
+ begin: (_: unknown, components: unknown) => (...values: unknown[]) => { calls.push(["prepared", components, keys(), values]); return 0; },
1014
+ fallback: () => 0,
1015
+ });
1016
+ const prepareAdd = (keys: () => readonly unknown[]) => {
1017
+ let entity: unknown = undefined;
1018
+ let list: unknown = undefined;
1019
+ let values: unknown[] = [];
1020
+ return {
1021
+ begin: (_: unknown, target: unknown, components: unknown) => { entity = target; list = components; values = []; return true; },
1022
+ value: (k: number, value: unknown) => { values[k] = value; },
1023
+ end: () => { calls.push(["prepared add", list, keys(), entity, values]); },
1024
+ fallback: () => {},
1025
+ };
1026
+ };
1027
+ const system = new Function("System", "prepareSpawn$", "prepareAdd$", `${module}\nreturn system;`)({ create: (declaration: unknown, run: unknown) => ({ declaration, run }) }, prepare, prepareAdd);
1028
+ const context = { commands: { spawn: (list: unknown) => (values: unknown) => { calls.push(["spawn", list, values]); }, add: (entity: unknown, list: unknown, values: unknown) => { calls.push(["add", entity, list, values]); } } };
1029
+ if (parameters.startsWith("(row")) system.run({}, context);
1030
+ else system.run(context);
1031
+ return { code: result?.code ?? source, calls };
1032
+ };
1033
+
1034
+ test("pass literal values positionally, in source order", async () => {
1035
+ const { calls } = await spawned(`let i = 0; commands.spawn([++i, score, mass])({ [position]: [++i, 0, 0], [score]: ++i, [mass]: 3 }); commands.spawn([])({});`);
1036
+ expect(calls).toEqual([["prepared", [1, "score", "mass"], ["position", "score", "mass"], [[2, 0, 0], 3, 3]], ["prepared", [], [], []]]);
1037
+ });
1038
+
1039
+ test.each([
1040
+ ["a string literal key", `commands.spawn([score, mass])({ [score]: 1, "mass": 3 });`],
1041
+ ["a plain key", "commands.spawn([score, mass])({ [score]: 1, mass: 3 });"],
1042
+ ["a number key", "commands.spawn([score])({ 1: 3 });"],
1043
+ ])("fail the build for %s, since component keys are symbols", async (_, body) => {
1044
+ const { code, calls } = await spawned(body);
1045
+ expect(code).toBe("a command's keys are its components' symbols, as [key]; a plain or string key is never a component's");
1046
+ expect(calls).toEqual([]);
1047
+ });
1048
+
1049
+ test.each([
1050
+ ["the context's commands", "context.commands.spawn([score])({ [score]: 1 });", "(context)", `{}`],
1051
+ ["renamed commands", "issue.spawn([score])({ [score]: 1 });", "({ commands: issue })", `{}`],
1052
+ ["a system with components", "commands.spawn([score])({ [score]: 1 });", "(row, { commands })", `{ kernel: false, components: { with: [mass] } }`],
1053
+ ["the context of a system with components", "context.commands.spawn([score])({ [score]: 1 });", "(row, context)", `{ kernel: false, components: { with: [mass] } }`],
1054
+ ])("pass values positionally through %s", async (_, body, parameters, declaration) => {
1055
+ const { calls } = await spawned(body, parameters, declaration);
1056
+ expect(calls).toEqual([["prepared", ["score"], ["score"], [1]]]);
1057
+ });
1058
+
1059
+ test("pass values positionally in a system made from its body alone", async () => {
1060
+ const result = await transform("const system = System.create(({ commands }) => { commands.spawn([score])({ [score]: 1 }); });");
1061
+ expect(result !== null && "code" in result ? result.code : null).toContain("spawn$0(commands, [score], 1)");
1062
+ });
1063
+
1064
+ test.each([
1065
+ ["a value object built first", "const values = { [score]: 1 }; commands.spawn([score])(values);"],
1066
+ ["a spread", "const values = { [score]: 1 }; commands.spawn([score, mass])({ ...values, [mass]: 2 });"],
1067
+ ["a key that isn't a module constant", "const key = score; commands.spawn([score])({ [key]: 1 });"],
1068
+ ["a shadowed key", "const score = \"other\"; commands.spawn([score])({ [score]: 1 });"],
1069
+ ["redeclared commands", "{ const commands = { spawn: () => {} }; } commands.spawn([score])({ [score]: 1 });"],
1070
+ ["a spawner kept", "const spawn = commands.spawn([score]); spawn({ [score]: 1 });"],
1071
+ ])("leave %s as written", async (_, body) => {
1072
+ const { calls } = await spawned(body);
1073
+ expect(calls.every(call => Array.isArray(call) && call[0] === "spawn")).toBe(true);
1074
+ expect(calls.length).toBe(1);
1075
+ });
1076
+ describe("lists of keys", () => {
1077
+ const keys = "const a = Symbol(); const b = Symbol();\n";
1078
+ test("are made once, with an index, for spawns, adds and removes", async () => {
1079
+ const result = await transform(`${keys}const system = System.create(({ commands }) => { commands.spawn([a, b])({ [a]: 1, [b]: 2 }); commands.add(1, [b], { [b]: 3 }); commands.remove(1, [a, b]); commands.spawn([a]); });`);
1080
+ const transformed = result !== null && "code" in result ? result.code : "";
1081
+ expect(transformed.match(/\(list\$\d+ \?\?= archetype\$\(\[[ab, ]+\]\)\)/g)).toEqual([
1082
+ "(list$0 ??= archetype$([a, b]))", "(list$1 ??= archetype$([b]))", "(list$2 ??= archetype$([a, b]))", "(list$3 ??= archetype$([a]))",
1083
+ ]);
1084
+ expect(transformed).toContain("function archetype$(list)");
1085
+ });
1086
+ test("leave a list naming anything but module keys as written", async () => {
1087
+ const result = await transform(`${keys}const system = System.create(({ commands }) => { const c = a; commands.spawn([a, c]); commands.remove(1, [a, 2]); });`);
1088
+ const transformed = result !== null && "code" in result ? result.code : "";
1089
+ expect(transformed).toContain("commands.spawn([a, c]); commands.remove(1, [a, 2]);");
1090
+ expect(transformed).not.toContain("archetype$");
1091
+ });
1092
+ test("leave a list naming a key shadowed around the body, or by its parameters, as written", async () => {
1093
+ const result = await transform(`${keys}const make = (a) => System.create(({ commands }) => { commands.spawn([a]); });
1094
+ const remove = System.create(({ commands }, b) => { commands.remove(1, [a, b]); });`);
1095
+ const transformed = result !== null && "code" in result ? result.code : "";
1096
+ expect(transformed).toContain("commands.spawn([a]);");
1097
+ expect(transformed).toContain("commands.remove(1, [a, b]);");
1098
+ expect(transformed).not.toContain("archetype$");
1099
+ });
1100
+ test("fail the build for a list naming a key twice", async () => {
1101
+ const result = await transform(`${keys}const system = System.create(({ commands }) => { commands.remove(1, [a, b, a]); });`);
1102
+ expect(result !== null && "failure" in result ? result.failure.message : null).toBe("this list names a twice; a list of components names each once");
1103
+ });
1104
+ });
1105
+ describe("adds", () => {
1106
+ test("pass literal values positionally, after the entity, in source order", async () => {
1107
+ const { code, calls } = await spawned("let i = 0; commands.add(++i, [score, mass, ++i], { [score]: ++i, [mass]: ++i });");
1108
+ expect(code).toContain("prepareAdd$");
1109
+ expect(calls).toEqual([["prepared add", ["score", "mass", 2], ["score", "mass"], 1, [3, 4]]]);
1110
+ });
1111
+ test.each([
1112
+ ["a value object built first", "const values = { [score]: 1 }; commands.add(1, [score], values);"],
1113
+ ["a spread", "const values = { [score]: 1 }; commands.add(1, [score, mass], { ...values, [mass]: 2 });"],
1114
+ ["a key that isn't a module constant", "const key = score; commands.add(1, [score], { [key]: 1 });"],
1115
+ ["one component", "commands.add(1, score, 1);"],
1116
+ ["one component's object value", `commands.add(1, score, { text: "a", "size": 2 });`],
1117
+ ])("leave %s as written", async (_, body) => {
1118
+ const { calls } = await spawned(body);
1119
+ expect(calls).toEqual([["add", 1, expect.anything(), expect.anything()]]);
1120
+ });
1121
+ test("fail the build for a plain or string key", async () => {
1122
+ expect((await spawned(`commands.add(1, [score, mass], { [score]: 1, "mass": 3 });`)).code).toBe("a command's keys are its components' symbols, as [key]; a plain or string key is never a component's");
1123
+ });
1124
+ });
1125
+ });
1126
+
1127
+ describe("helpers that return early", () => {
1128
+ test("take each path's value, with later statements on the paths that fall through", async () => {
1129
+ const kernel = await compile(`const pick = (a, b) => {
1130
+ if (a > b) return [a, 0];
1131
+ const c = b * 2;
1132
+ if (c > 10) {
1133
+ const d = c - 10;
1134
+ return [d, 1];
1135
+ }
1136
+ return [c, 2];
1137
+ };
1138
+ const kernel = System.create({ kernel: true, components: { with: [mass, position] } }, (row) => {
1139
+ const [value, path] = pick(row[mass], 4);
1140
+ row[position] = [value, path, 0];
1141
+ });`);
1142
+ const result = run(kernel, 3, { mass: { "[]": [5, 3, 1] }, position: vec3([0, 0, 0], [0, 0, 0], [0, 0, 0]) });
1143
+ expect([result.field("position", [0]), result.field("position", [1])]).toEqual([[5, 8, 8], [0, 2, 2]]);
1144
+ });
1145
+ });
1146
+
1147
+ describe("math builtins", () => {
1148
+ const math = `import { Vec3, Quat, Mat4x4 } from "ecs";\n`;
1149
+ const points = vec3([1, -2, 0.5], [0, 3, 4], [2, 1, -1]);
1150
+ const at = (row: number): readonly [number, number, number] => [points["[0]"][row], points["[1]"][row], points["[2]"][row]];
1151
+ const results = (result: ReturnType<typeof run>) => [0, 1, 2].map(row => [0, 1, 2].map(k => result.field("position", [k])[row]));
1152
+
1153
+ test("inline as scalar code, nested namespaces and helpers they call included", async () => {
1154
+ const kernel = await compile(`${math}const kernel = System.create({ kernel: true, components: { with: [velocity, position, score] } }, (row) => {
1155
+ const p = row[position];
1156
+ const v = row[velocity];
1157
+ row[position] = Vec3.add(Vec3.normalize(Vec3.cross(p, v)), Vec3.F32.scale(Vec3.clamp(v, Vec3.zero, [1, 1, 1]), Vec3.dot(p, v)));
1158
+ row[score] = Vec3.distance(p, v) + Vec3.length(Vec3.mix(p, v, 0.25));
1159
+ });`);
1160
+ const result = run(kernel, 3, { position: points, velocity: vec3([0.5, 1, 2], [1, 0, -1], [3, -2, 0]) });
1161
+ const velocities: readonly (readonly [number, number, number])[] = [[0.5, 1, 3], [1, 0, -2], [2, -1, 0]];
1162
+ const expected = [0, 1, 2].map(row => {
1163
+ const p = at(row);
1164
+ const v = velocities[row];
1165
+ return Vec3.add(Vec3.normalize(Vec3.cross(p, v)), Vec3.scale(Vec3.clamp(v, Vec3.zero, [1, 1, 1]), Vec3.dot(p, v)));
1166
+ });
1167
+ expect(results(result)).toEqual(expected.map(value => [...value]));
1168
+ expect(result.field("score")).toEqual([0, 1, 2].map(row => Vec3.distance(at(row), velocities[row]) + Vec3.length(Vec3.mix(at(row), velocities[row], 0.25))));
1169
+ expect(String(kernel.create)).not.toMatch(/Vec3|normalize|cross/);
1170
+ });
1171
+
1172
+ test("across namespaces: quaternions rotating vectors, and matrices", async () => {
1173
+ const kernel = await compile(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
1174
+ const q = Quat.fromAxisAngle([0, 0, 1], Math.PI / 2);
1175
+ const m = Mat4x4.multiply(Mat4x4.translation(1, 2, 3), Mat4x4.scaling(2, 2, 2));
1176
+ row[position] = Mat4x4.multiplyVec3(m, Quat.rotateVec3(q, row[position]));
1177
+ });`);
1178
+ const result = run(kernel, 3, { position: points });
1179
+ const q = Quat.fromAxisAngle([0, 0, 1], Math.PI / 2);
1180
+ const m = Mat4x4.multiply(Mat4x4.translation(1, 2, 3), Mat4x4.scaling(2, 2, 2));
1181
+ expect(results(result)).toEqual([0, 1, 2].map(row => [...Mat4x4.multiplyVec3(m, Quat.rotateVec3(q, at(row)))]));
1182
+ });
1183
+
1184
+ test("in GPU kernels, become regions WGSL emits as builtins, and other backends run as the inlined body", async () => {
1185
+ const body = `(row) => { row[position] = Vec3.scale(Vec3.normalize(Vec3.cross(row[position], row[velocity])), Vec3.dot(row[position], row[velocity])); }`;
1186
+ const declaration = `components: { with: [velocity, position] }`;
1187
+ const gpu = await compile(`${math}const kernel = System.create({ kernel: "gpu", ${declaration} }, ${body});`);
1188
+ const cpu = await compile(`${math}const kernel = System.create({ kernel: true, ${declaration} }, ${body});`);
1189
+ const regions = (gpu.program?.body ?? []).flatMap(statement => statement.kind === "intrinsic" ? [statement.intrinsic.operation] : []);
1190
+ expect(regions).toEqual(["cross", "normalize", "dot", "*"]);
1191
+ expect((cpu.program?.body ?? []).some(statement => statement.kind === "intrinsic")).toBe(false);
1192
+ const fields = { position: points, velocity: vec3([0.5, 1, 2], [1, 0, -1], [3, -2, 0]) };
1193
+ expect(results(run(gpu, 3, fields))).toEqual(results(run(cpu, 3, fields)));
1194
+ const columns = gpu.columns.map((column): WasmColumn => ({ view: column.kind === "field" ? "f32" : "f64", stride: 4, offset: 0, boolean: false, component: 0 }));
1195
+ const shader = gpu.program === null ? "" : generateWgsl(gpu.program, columns, () => "number");
1196
+ const code = typeof shader === "string" ? shader : shader.code;
1197
+ expect(code).toMatch(/(normalize_\d+) = normalize\((cross_\d+)\);/);
1198
+ expect(code).toMatch(/= \(normalize_\d+ \* dot_\d+\);/);
1199
+ });
1200
+
1201
+ test("that leave the kernel subset fail with the function's reason", async () => {
1202
+ expect(await failure(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
1203
+ row[position] = Vec3.random();
1204
+ });`)).toBe("Math.random is not in the kernel subset");
1205
+ expect(await failure(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
1206
+ row[position] = Vec3.missing([1, 2, 3]);
1207
+ });`)).toMatch(/^missing isn't exported by .*\/math\/vec3\/public\.ts$/);
1208
+ });
1209
+ });
1210
+
1211
+ describe("imported functions and constants", () => {
1212
+ const kernel = (imports: string, body: string) => `${imports}\nconst kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => { ${body} });`;
1213
+ const scores = async (source: string, files: { readonly [file: string]: string }) =>
1214
+ run(await compile(source, files), 2, { mass: { "[]": [2, 3] } }).field("score");
1215
+
1216
+ test("inline through named, default, namespace and re-exported imports", async () => {
1217
+ const files = {
1218
+ "/shapes.js": "const TWO = 2;\nexport const twice = (x) => x * TWO;\nexport default function square(x) { return x * x; }\nexport const pair = (x) => [x, x + 1];",
1219
+ "/second.js": "const ONE = 1;\nexport const second = (v) => v[ONE];",
1220
+ "/barrel.js": "export { twice as double } from './shapes.js';\nexport * as Shapes from './shapes.js';\nexport * from './second.js';",
1221
+ };
1222
+ expect(await scores(kernel(`import square, { twice } from "./shapes.js";\nimport * as Barrel from "./barrel.js";`,
1223
+ "row[score] = square(twice(row[mass])) + Barrel.double(1) + Barrel.Shapes.default(3) + Barrel.second(Barrel.Shapes.pair(row[mass]));"), files))
1224
+ .toEqual([16 + 2 + 9 + 3, 36 + 2 + 9 + 4]);
1225
+ });
1226
+
1227
+ test("report the files kernels inline from, also when they fail, so fixing them compiles again", async () => {
1228
+ const result = await transform(kernel(`import { twice } from "./shapes.js";`, "row[score] = twice(row[mass]);"), { "/shapes.js": "export const twice = (x) => x * 2;" });
1229
+ expect(result?.dependencies).toEqual(["/shapes.js"]);
1230
+ const failed = await transform(kernel(`import { twice } from "./shapes.js";`, "row[score] = twice(row[mass]);"), { "/shapes.js": "export const twice = (x) => x * Math.random();" });
1231
+ expect(failed !== null && "failure" in failed).toBe(true);
1232
+ expect(failed?.dependencies).toEqual(["/shapes.js"]);
1233
+ });
1234
+
1235
+ test("that leave the subset fail at the call, with a frame for each inlined function", async () => {
1236
+ const source = kernel(`import { outer } from "./outer.js";`, "row[score] = outer(row[mass]);");
1237
+ const result = await transform(source, {
1238
+ "/outer.js": "import { inner } from './inner.js';\nexport const outer = (x) => inner(x) + 1;",
1239
+ "/inner.ts": "type Unused = {\n readonly a: number;\n};\nexport const inner = (x: number): number =>\n x * Math.random();",
1240
+ });
1241
+ const failure = result !== null && "failure" in result ? result.failure : undefined;
1242
+ expect(failure?.message).toBe("Math.random is not in the kernel subset");
1243
+ expect(failure?.position).toBe(`${header}${source}`.indexOf("outer(row[mass])"));
1244
+ expect(failure?.frames).toEqual([
1245
+ { name: "inner", file: "/inner.ts", line: 5, column: 9 },
1246
+ { name: "outer", file: "/outer.js", line: 2, column: 29 },
1247
+ ]);
1248
+ });
1249
+
1250
+ test("frame each function of a module that fails inside another of its functions", async () => {
1251
+ const result = await transform(kernel(`import { outer } from "./outer.js";`, "row[score] = outer(row[mass]);"), {
1252
+ "/outer.js": "const inner = (x) => x * Math.random();\nexport const outer = (x) => inner(x) + 1;",
1253
+ });
1254
+ const failure = result !== null && "failure" in result ? result.failure : undefined;
1255
+ expect(failure?.frames).toEqual([
1256
+ { name: "inner", file: "/outer.js", line: 1, column: 26 },
1257
+ { name: "outer", file: "/outer.js", line: 2, column: 29 },
1258
+ ]);
1259
+ });
1260
+
1261
+ test("fail on recursion across modules, module state, and names they can't resolve", async () => {
1262
+ expect(await failure(kernel(`import { even } from "./even.js";`, "row[score] = even(row[mass]);"), {
1263
+ "/even.js": "import { odd } from './odd.js';\nexport const even = (n) => n === 0 ? 1 : odd(n - 1);",
1264
+ "/odd.js": "import { even } from './even.js';\nexport const odd = (n) => n === 0 ? 0 : even(n - 1);",
1265
+ })).toBe("even is recursive");
1266
+ expect(await failure(kernel(`import { next } from "./counter.js";`, "row[score] = next();"), { "/counter.js": "let count = 0;\nexport const next = () => count;" }))
1267
+ .toBe("count is not a module-scope const");
1268
+ expect(await failure(kernel(`import { missing } from "./shapes.js";`, "row[score] = missing(1);"), { "/shapes.js": "export const twice = (x) => x * 2;" }))
1269
+ .toBe("missing isn't exported by /shapes.js");
1270
+ expect(await failure(kernel(`import { f } from "./both.js";`, "row[score] = f(1);"), {
1271
+ "/both.js": "export * from './a.js';\nexport * from './b.js';", "/a.js": "export const f = (x) => x;", "/b.js": "export const f = (x) => -x;",
1272
+ })).toBe("f is exported by more than one export * of /both.js");
1273
+ expect(await failure(kernel(`import { f } from "lodash";`, "row[score] = f(1);"))).toBe("lodash can't be resolved from /test.js");
1274
+ });
1275
+ });
1276
+
1277
+ describe("imported lists", () => {
1278
+ const files = {
1279
+ "/components.js": `export const health = "health";\nexport const armor = "armor";\nexport const tagged = "tagged";\n`,
1280
+ "/archetypes.js": [
1281
+ `import { health, armor, tagged } from "./components.js";`,
1282
+ `export const shield = "shield";`,
1283
+ `export const Unit = archetype$([health, armor, tagged]);`,
1284
+ `function archetype$(list) { return list; }`,
1285
+ `export const Guard = [shield, armor];`,
1286
+ `export const Alias = Unit;`,
1287
+ `export const Computed = [health].concat([armor]);`,
1288
+ `export let Changing = [health];`,
1289
+ `export const Spread = [...Guard];`,
1290
+ ].join("\n"),
1291
+ "/barrel.js": `export { Unit as Soldier } from "./archetypes.js";\nexport * from "./archetypes.js";\nexport * as Kinds from "./archetypes.js";\n`,
1292
+ };
1293
+ /** The values the archetypes' module gives its lists, for evaluating the kernel's module. */
1294
+ const Unit = ["health", "armor", "tagged"];
1295
+ const Guard = ["shield", "armor"];
1296
+ const commanding = (imports: string, body: string) =>
1297
+ `${imports}\nconst kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => { ${body} });`;
1298
+
1299
+ test("name the keys of a list imported from another module, by the kernel's bindings or else through the list", async () => {
1300
+ const source = commanding(`import { health, armor } from "./components.js";\nimport { Unit, Guard } from "./archetypes.js";`, `
1301
+ const spawned = commands.spawn(Unit)({ [health]: row[mass], [armor]: 2 });
1302
+ commands.add(spawned, Guard, { [armor]: 3 });
1303
+ commands.remove(row.entity, Unit);`);
1304
+ const result = await transform(source, files);
1305
+ expect(result !== null && "code" in result ? result.code : "").toContain("keys: [health, armor, Unit[2], Guard[0]],");
1306
+ expect(result?.dependencies).toEqual(expect.arrayContaining(["/archetypes.js", "/components.js"]));
1307
+ const kernel = await compile(source, files, { health: "health", armor: "armor", Unit, Guard });
1308
+ expect(kernel.keys).toEqual(["health", "armor", "tagged", "shield"]);
1309
+ expect(run(kernel, 1, { mass: { "[]": [5] } }, { program: false }).calls).toEqual([
1310
+ ["spawn", 999], ["spawn", 999, 0, 5], ["spawn", 999, 1, 2], ["spawn", 999, 2, undefined],
1311
+ [2, 999], [2, 999, 3, undefined], [2, 999, 1, 3],
1312
+ [3, 100], [3, 100, 0], [3, 100, 1], [3, 100, 2],
1313
+ ]);
1314
+ });
1315
+
1316
+ test("follow re-exports, namespace imports and constants naming another list", async () => {
1317
+ const source = commanding(`import { health } from "./components.js";\nimport { Soldier, Alias } from "./barrel.js";\nimport * as Archetypes from "./archetypes.js";\nimport * as Barrel from "./barrel.js";\nconst Local = Alias;`, `
1318
+ commands.spawn(Soldier)({ [health]: row[mass] });
1319
+ commands.spawn(Archetypes.Unit)({ [health]: 2 });
1320
+ commands.add(row.entity, Barrel.Kinds.Guard, {});
1321
+ commands.remove(row.entity, Local);`);
1322
+ const result = await transform(source, files);
1323
+ expect(result !== null && "code" in result ? result.code : result?.failure.message).toContain("keys: [health, Soldier[1], Soldier[2], Barrel.Kinds.Guard[0]],");
1324
+ const kernel = await compile(source, files, { health: "health", Soldier: Unit, Alias: Unit, Archetypes: { Unit, Guard }, Barrel: { Kinds: { Guard } } });
1325
+ expect(kernel.keys).toEqual(["health", "armor", "tagged", "shield"]);
1326
+ expect(run(kernel, 1, { mass: { "[]": [5] } }, { program: false }).calls).toEqual([
1327
+ ["spawn", 999], ["spawn", 999, 0, 5], ["spawn", 999, 1, undefined], ["spawn", 999, 2, undefined],
1328
+ ["spawn", 999], ["spawn", 999, 0, 2], ["spawn", 999, 1, undefined], ["spawn", 999, 2, undefined],
1329
+ [2, 100], [2, 100, 3, undefined], [2, 100, 1, undefined],
1330
+ [3, 100], [3, 100, 0], [3, 100, 1], [3, 100, 2],
1331
+ ]);
1332
+ });
1333
+
1334
+ test("in a declaration, bind keys the list's module defines to the kernel's imports of them, under any name", async () => {
1335
+ const source = `import { shield, Guard } from "./archetypes.js";\nimport { armor as plate } from "./components.js";
1336
+ const kernel = System.create({ kernel: true, components: { with: [score, ...Guard] } }, (row) => { row[score] = row[shield] * 10 + row[plate]; });`;
1337
+ const kernel = await compile(source, files, { shield: "shield", Guard, plate: "armor" });
1338
+ expect(run(kernel, 2, { shield: { "[]": [1, 2] }, armor: { "[]": [3, 4] } }).field("score")).toEqual([13, 24]);
1339
+ // What it requires but doesn't use, it only requires.
1340
+ expect(await failure(`import { shield, Guard } from "./archetypes.js";
1341
+ const kernel = System.create({ kernel: true, components: { with: [score, ...Guard] } }, (row) => { row[score] = row[shield]; });`, files)).toBe("compiled");
1342
+ });
1343
+
1344
+ test.each([
1345
+ ["computed when its module runs", "commands.spawn(Computed)({});", "commands.spawn: Computed is computed when /archetypes.js runs, so the compiler can't read its components; declare it as an array literal, `as const`"],
1346
+ ["not a const", "commands.spawn(Changing)({});", "commands.spawn: Changing isn't a module-scope const, so the compiler can't read its components"],
1347
+ ["holding a spread", "commands.spawn(Spread)({});", "commands.spawn: Spread names a key by something other than an identifier bound at the scope of /archetypes.js"],
1348
+ ["not exported", "commands.spawn(Missing)({});", "commands.spawn: Missing isn't exported by /archetypes.js"],
1349
+ ["a namespace", "commands.spawn(Archetypes)({});", "commands.spawn: Archetypes is a module namespace, not a list of components"],
1350
+ ["a member of a namespace it doesn't export", "commands.remove(row.entity, Archetypes.Missing);", "commands.remove: Missing isn't exported by /archetypes.js"],
1351
+ ])("fail the build for a list %s", async (_, body, message) => {
1352
+ expect(await failure(commanding(`import { Computed, Changing, Spread, Missing } from "./archetypes.js";\nimport * as Archetypes from "./archetypes.js";`, body), files)).toBe(message);
1353
+ });
1354
+
1355
+ test("take an imported name as one key when it resolves to a key, followed through namespaces and constants", async () => {
1356
+ const keys = {
1357
+ ...files,
1358
+ "/keys.js": [
1359
+ `export const ember = Symbol("ember");`,
1360
+ `export const glow = identify$(Symbol("glow"), "keys.js#glow");`,
1361
+ `export const spark = ember;`,
1362
+ `function identify$(symbol, id) { return symbol; }`,
1363
+ ].join("\n"),
1364
+ };
1365
+ const source = commanding(`import { ember, glow, spark } from "./keys.js";\nimport * as Keys from "./keys.js";\nimport { heat } from "external";`, `
1366
+ commands.add(row.entity, ember, row[mass]);
1367
+ commands.add(row.entity, glow, true);
1368
+ commands.remove(row.entity, Keys.ember);
1369
+ commands.remove(row.entity, spark);
1370
+ commands.add(row.entity, heat, 2);`);
1371
+ const result = await transform(source, keys);
1372
+ expect(result !== null && "code" in result ? result.code : result?.failure.message).toContain("keys: [ember, glow, spark, heat],");
1373
+ });
1374
+
1375
+ test.each([
1376
+ ["computed when its module runs", "commands.add(row.entity, Computed, {});", "commands.add: Computed is computed when /archetypes.js runs, so the compiler can't tell whether it's a key or a list; declare a key as Symbol(...), or a list as an array literal, `as const`"],
1377
+ ["not a const", "commands.remove(row.entity, Changing);", "commands.remove: Changing isn't a module-scope const, so the compiler can't tell whether it's a key or a list"],
1378
+ ["not exported", "commands.remove(row.entity, Missing);", "commands.remove: Missing isn't exported by /archetypes.js"],
1379
+ ["a namespace", "commands.add(row.entity, Archetypes, 1);", "commands.add: Archetypes is a module namespace, not a key or a list of components"],
1380
+ ["of a module that can't be resolved", "commands.add(row.entity, Lost, 1);", "commands.add: nowhere can't be resolved from /test.js"],
1381
+ ])("fail the build for an added or removed name %s", async (_, body, message) => {
1382
+ expect(await failure(commanding(`import { Computed, Changing, Missing } from "./archetypes.js";\nimport * as Archetypes from "./archetypes.js";\nimport { Lost } from "nowhere";`, body), files)).toBe(message);
1383
+ });
1384
+
1385
+ test("fail the build for a list that names a key", async () => {
1386
+ expect(await failure(commanding(`import { health } from "./components.js";`, "commands.spawn(health)({});"), files))
1387
+ .toBe("commands.spawn: health is a key, not a list of components; list it as [health]");
1388
+ });
1389
+
1390
+ test("fail the build for a declaration's list computed when its module runs", async () => {
1391
+ expect(await failure(`import { Computed } from "./archetypes.js";
1392
+ const kernel = System.create({ kernel: true, components: { with: Computed } }, (row) => { void row.entity; });`, files))
1393
+ .toBe("components.with: Computed is computed when /archetypes.js runs, so the compiler can't read its components; declare it as an array literal, `as const`");
1394
+ });
1395
+ });
1396
+
1397
+ describe("inferred access", () => {
1398
+ /** What the build inferred the first system's body uses, as the source it gives its declaration, or why it failed. */
1399
+ const inferred = async (source: string): Promise<string> => {
1400
+ const result = await transform(source);
1401
+ if (result === null) return "none";
1402
+ if ("failure" in result) return result.failure.message;
1403
+ return /\{ components: .*?, at: "[^"]*" \}/.exec(result.code)?.[0] ?? "none";
1404
+ };
1405
+ const system = (declaration: string, body: string) => `const system = System.create({ ${declaration} }, ${body});`;
1406
+
1407
+ test("a row's reads and writes, its members in with's order", async () => {
1408
+ expect(await inferred(system("components: { with: [position, velocity, mass] }", "(row) => { row[velocity] = row[mass] + row[position]; }")))
1409
+ .toContain("components: { read: [position, mass], write: [velocity] }");
1410
+ expect(await inferred(system("components: { with: [score] }", "(row) => { row[score] += 1; }"))).toContain("components: { read: [], write: [score] }");
1411
+ expect(await inferred(system("components: { with: [position, mass] }", "({ [position]: p, entity }) => { console.log(p, entity); }")))
1412
+ .toContain("components: { read: [position], write: [] }");
1413
+ });
1414
+
1415
+ test("a row it can't follow as unknown, which the world takes as every member written, with a warning", async () => {
1416
+ const result = await transform(system("components: { with: [position] }", "(row) => { helper(row); }"));
1417
+ expect(result !== null && "code" in result ? [result.code.includes("components: null"), result.warnings.length] : null).toEqual([true, 1]);
1418
+ });
1419
+
1420
+ test("an observer's row it can't follow as unknown without a warning, since the world takes an observer's as read", async () => {
1421
+ const result = await transform(system("observer: true, components: { with: [position] }", "(row) => { helper(row); }"));
1422
+ expect(result !== null && "code" in result ? [result.code.includes("components: null"), result.warnings] : null).toEqual([true, []]);
1423
+ });
1424
+
1425
+ test("a row it can't follow with a warning unless the declaration says observer: true, as the world reads it", async () => {
1426
+ for (const observer of ["observer: false, ", "observer: watching, "]) {
1427
+ const result = await transform(`const watching = true;\n${system(`${observer}components: { with: [position] }`, "(row) => { helper(row); }")}`);
1428
+ expect(result !== null && "code" in result ? result.warnings.length : null).toBe(1);
1429
+ }
1430
+ });
1431
+
1432
+ test("a lookup's rows it can't follow without a warning, since what they hold is what the declaration says", async () => {
1433
+ const result = await transform(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }", "(row, { lookup }) => { helper(lookup.targets(row[target])); }"));
1434
+ expect(result !== null && "code" in result ? [result.code.includes(`"targets": null`), result.warnings] : null).toEqual([true, []]);
1435
+ });
1436
+
1437
+ test("warnings name the module by the label given, with line and column", async () => {
1438
+ const result = await transformKernels(`${header}${system("components: { with: [position] }", "(row) => { helper(row); }")}`, "/repo/app/src/features/a/model.ts", parse,
1439
+ async specifier => specifier === "ecs" ? ownCopy : null, () => "", createLinker(host({}, reductions), parse), true, "src/features/a/model.ts");
1440
+ expect(result !== null && "code" in result ? result.warnings.map(warning => /^[^ ]*:/.exec(warning)?.[0]) : null).toEqual([`src/features/a/model.ts:${header.split("\n").length}:${"const system = System.create({ components: { with: [position] } }, ".length + 1}:`]);
1441
+ });
1442
+
1443
+ test("resources read, written and reduced, however its context reaches them", async () => {
1444
+ expect(await inferred(system("", "(context) => { context.resources[score] = context.resources[delta]; }")))
1445
+ .toContain("resources: { read: [delta], write: [score], reduce: [] }");
1446
+ expect(await inferred(system("", "(context) => { const { resources } = context; resources[score] += 1; }")))
1447
+ .toContain("resources: { read: [score], write: [score], reduce: [] }");
1448
+ expect(await inferred(system("", "({ resources: { [delta]: d } }) => { console.log(d); }"))).toContain("resources: { read: [delta], write: [], reduce: [] }");
1449
+ expect(await inferred(`const total = "total";\n${system("components: { with: [mass] }", "(row, { reduce }) => { reduce[total](row[mass]); }")}`))
1450
+ .toContain("resources: { read: [], write: [], reduce: [total] }");
1451
+ expect(await inferred(system("", "(context) => { helper(context); }"))).toContain("resources: null");
1452
+ });
1453
+
1454
+ test("what a lookup's rows are read for, by entity and through an index, or unknown", async () => {
1455
+ expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass, position] } }",
1456
+ "(row, { lookup }) => { console.log(lookup.targets(row[target])?.[mass]); }"))).toContain(`lookup: { "targets": [mass] }`);
1457
+ expect(await inferred(system("components: { with: [target] }, lookup: { near: { index: grid } }",
1458
+ "(row, { lookup }) => { const near = lookup.near(row[target]); console.log(near.at(0)[mass], near.length); }"))).toContain(`lookup: { "near": [mass] }`);
1459
+ expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }",
1460
+ "(row, { lookup }) => { helper(lookup.targets(row[target])); }"))).toContain(`lookup: { "targets": null }`);
1461
+ });
1462
+
1463
+ test("what its body reads of its parent", async () => {
1464
+ expect(await inferred(system("components: { with: [mass, score] }, up: { through: target }", "(row, { up }) => { row[score] = (up === null ? 0 : up[score]) + row[mass]; }")))
1465
+ .toContain("up: [score]");
1466
+ });
1467
+
1468
+ test("fail the build for a key a body uses that its declaration doesn't require", async () => {
1469
+ expect(await inferred(system("components: { with: [position] }", "(row) => { console.log(row[mass]); }")))
1470
+ .toBe("mass isn't in components with or optional, so the system doesn't require it: add it there to use it");
1471
+ expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }", "(row, { lookup }) => { console.log(lookup.targets(row[target])?.[position]); }")))
1472
+ .toBe("position isn't in lookup.targets.with or optional, so the system doesn't require it: add it there to use it");
1473
+ });
1474
+
1475
+ test("finalizers, in files that import only Finalizer", async () => {
1476
+ const result = await transformKernels(`import { Finalizer } from "ecs";\nconst handle = "handle";\nconst count = "count";\nconst f = Finalizer.create({ components: { with: [handle, count] } }, (row, { resources }) => { console.log(row[handle], resources[count]); });`,
1477
+ "/finalizer.js", parse, async specifier => specifier === "ecs" ? ownCopy : null, index => JSON.stringify(`kernel:${index}`));
1478
+ expect(result !== null && "code" in result ? result.code : "").toContain("{ components: { read: [handle], write: [] }, resources: { read: [count], write: [], reduce: [] }");
1479
+ });
1480
+
1481
+ test("a destructuring target, or a for…of target, written", async () => {
1482
+ expect(await inferred(system("components: { with: [position] }", "(row) => { ({ x: row[position] } = source); }")))
1483
+ .toContain("components: { read: [], write: [position] }");
1484
+ expect(await inferred(system("components: { with: [position] }", "(row) => { for ({ x: row[position] } of sources); }")))
1485
+ .toContain("components: { read: [], write: [position] }");
1486
+ expect(await inferred(system("components: { with: [position] }", "(row) => { [row[position]] = pair; }")))
1487
+ .toContain("components: { read: [], write: [position] }");
1488
+ expect(await inferred(system("", "(context) => { ({ x: context.resources[score] } = source); }")))
1489
+ .toContain("resources: { read: [], write: [score], reduce: [] }");
1490
+ });
1491
+
1492
+ test("defaults and computed keys of declared patterns, and of parameters, as uses", async () => {
1493
+ expect(await inferred(system("components: { with: [position] }", "(row) => { const { a = (row[position] = 5) } = {}; }")))
1494
+ .toContain("components: { read: [], write: [position] }");
1495
+ expect(await inferred(system("components: { with: [position, velocity] }", "(row) => { const { [row[velocity]]: v } = table; console.log(v); }")))
1496
+ .toContain("components: { read: [velocity], write: [] }");
1497
+ expect(await inferred(system("", "(context) => { const { a = context.resources[delta] } = {}; console.log(a); }")))
1498
+ .toContain("resources: { read: [delta], write: [], reduce: [] }");
1499
+ expect(await inferred(system("components: { with: [position, velocity] }", "(row, context, step = row[velocity]) => { console.log(step); }")))
1500
+ .toContain("components: { read: [velocity], write: [] }");
1501
+ });
1502
+
1503
+ test("what a for…of or for…in loop goes over, as a read", async () => {
1504
+ expect(await inferred(system("", "({ resources }) => { for (const name of resources[delta]) console.log(name); }")))
1505
+ .toContain("resources: { read: [delta], write: [], reduce: [] }");
1506
+ expect(await inferred(system("components: { with: [position] }", "(row) => { for (const x of row[position]) console.log(x); }")))
1507
+ .toContain("components: { read: [position], write: [] }");
1508
+ });
1509
+
1510
+ test("a change inside a value, at any depth, as a change in place, for registration to judge by its kind", async () => {
1511
+ expect(await inferred(system("components: { with: [position] }", "(row) => { row[position].a.b = 1; }")))
1512
+ .toContain("components: { read: [position], write: [], mutate: [position] }");
1513
+ expect(await inferred(system("components: { with: [position] }", "(row) => { delete row[position].a; }")))
1514
+ .toContain("components: { read: [position], write: [], mutate: [position] }");
1515
+ expect(await inferred(system("components: { with: [position] }", "(row) => { [row[position][0]] = pair; }")))
1516
+ .toContain("components: { read: [position], write: [], mutate: [position] }");
1517
+ expect(await inferred(system("", "(context) => { context.resources[score].a = 1; }")))
1518
+ .toContain("resources: { read: [score], write: [], reduce: [], mutate: [score] }");
1519
+ });
1520
+
1521
+ test("a body mentioning eval as one it can't follow", async () => {
1522
+ expect(await inferred(system("components: { with: [position] }", "(row) => { eval(\"row[position] = 1\"); }"))).toContain("components: null");
1523
+ });
1524
+
1525
+ test("fail the build for an async or generator body", async () => {
1526
+ expect(await inferred(system("components: { with: [position] }", "async (row) => { row[position] = 1; }"))).toContain("a body can't be async");
1527
+ expect(await inferred(system("components: { with: [position] }", "function* (row) { row[position] = 1; }"))).toContain("a body can't be a generator");
1528
+ });
1529
+
1530
+ test("a body given by name, read where it's bound", async () => {
1531
+ expect(await inferred(`const move = (row) => { row[position] = row[velocity]; };\n${system("components: { with: [position, velocity] }", "move")}`))
1532
+ .toContain("components: { read: [velocity], write: [position] }");
1533
+ });
1534
+ });