@adobe/ecs 0.1.0 → 0.2.1

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 (2159) hide show
  1. package/README.md +58 -0
  2. package/dist/implementation/compiler/access.js +9 -5
  3. package/dist/implementation/compiler/access.js.map +1 -1
  4. package/dist/implementation/compiler/archetypes.d.ts +17 -0
  5. package/dist/implementation/compiler/archetypes.js +141 -0
  6. package/dist/implementation/compiler/archetypes.js.map +1 -0
  7. package/dist/implementation/compiler/assign.js.map +1 -1
  8. package/dist/implementation/compiler/augmentations.d.ts +25 -0
  9. package/dist/implementation/compiler/augmentations.js +943 -0
  10. package/dist/implementation/compiler/augmentations.js.map +1 -0
  11. package/dist/implementation/compiler/bind.js +5 -4
  12. package/dist/implementation/compiler/bind.js.map +1 -1
  13. package/dist/implementation/compiler/body-access.d.ts +20 -3
  14. package/dist/implementation/compiler/body-access.js +138 -36
  15. package/dist/implementation/compiler/body-access.js.map +1 -1
  16. package/dist/implementation/compiler/booleans.js.map +1 -1
  17. package/dist/implementation/compiler/branches.js.map +1 -1
  18. package/dist/implementation/compiler/calls.js +14 -3
  19. package/dist/implementation/compiler/calls.js.map +1 -1
  20. package/dist/implementation/compiler/columns.d.ts +8 -2
  21. package/dist/implementation/compiler/columns.js +19 -3
  22. package/dist/implementation/compiler/columns.js.map +1 -1
  23. package/dist/implementation/compiler/compile-kernel.d.ts +24 -1
  24. package/dist/implementation/compiler/compile-kernel.js +66 -22
  25. package/dist/implementation/compiler/compile-kernel.js.map +1 -1
  26. package/dist/implementation/compiler/compiler.d.ts +6 -0
  27. package/dist/implementation/compiler/compiler.js +7 -0
  28. package/dist/implementation/compiler/compiler.js.map +1 -0
  29. package/dist/implementation/compiler/data.js.map +1 -1
  30. package/dist/implementation/compiler/describe.d.ts +41 -0
  31. package/dist/implementation/compiler/describe.js +510 -0
  32. package/dist/implementation/compiler/describe.js.map +1 -0
  33. package/dist/implementation/compiler/estree.js.map +1 -1
  34. package/dist/implementation/compiler/expression.js +26 -2
  35. package/dist/implementation/compiler/expression.js.map +1 -1
  36. package/dist/implementation/compiler/failure.js.map +1 -1
  37. package/dist/implementation/compiler/identify.d.ts +18 -8
  38. package/dist/implementation/compiler/identify.js +90 -32
  39. package/dist/implementation/compiler/identify.js.map +1 -1
  40. package/dist/implementation/compiler/index.d.ts +5 -1
  41. package/dist/implementation/compiler/index.js +6 -1
  42. package/dist/implementation/compiler/index.js.map +1 -1
  43. package/dist/implementation/compiler/inferred.d.ts +32 -0
  44. package/dist/implementation/compiler/inferred.js +185 -0
  45. package/dist/implementation/compiler/inferred.js.map +1 -0
  46. package/dist/implementation/compiler/inline-kernels.d.ts +7 -0
  47. package/dist/implementation/compiler/inline-kernels.js +16 -0
  48. package/dist/implementation/compiler/inline-kernels.js.map +1 -0
  49. package/dist/implementation/compiler/input-schemas.d.ts +23 -0
  50. package/dist/implementation/compiler/input-schemas.js +102 -0
  51. package/dist/implementation/compiler/input-schemas.js.map +1 -0
  52. package/dist/implementation/compiler/ir.d.ts +13 -1
  53. package/dist/implementation/compiler/ir.js.map +1 -1
  54. package/dist/implementation/compiler/kernel-id.js +1 -0
  55. package/dist/implementation/compiler/kernel-id.js.map +1 -1
  56. package/dist/implementation/compiler/key.js.map +1 -1
  57. package/dist/implementation/compiler/link.d.ts +13 -0
  58. package/dist/implementation/compiler/link.js +17 -0
  59. package/dist/implementation/compiler/link.js.map +1 -1
  60. package/dist/implementation/compiler/lists.d.ts +12 -1
  61. package/dist/implementation/compiler/lists.js +35 -14
  62. package/dist/implementation/compiler/lists.js.map +1 -1
  63. package/dist/implementation/compiler/lookups.js.map +1 -1
  64. package/dist/implementation/compiler/math.js +1 -0
  65. package/dist/implementation/compiler/math.js.map +1 -1
  66. package/dist/implementation/compiler/memory-compiler.d.ts +61 -0
  67. package/dist/implementation/compiler/memory-compiler.js +271 -0
  68. package/dist/implementation/compiler/memory-compiler.js.map +1 -0
  69. package/dist/implementation/compiler/module-scope.js.map +1 -1
  70. package/dist/implementation/compiler/module-value.js +18 -3
  71. package/dist/implementation/compiler/module-value.js.map +1 -1
  72. package/dist/implementation/compiler/out.js.map +1 -1
  73. package/dist/implementation/compiler/oxc.d.ts +41 -0
  74. package/dist/implementation/compiler/oxc.js +80 -0
  75. package/dist/implementation/compiler/oxc.js.map +1 -0
  76. package/dist/implementation/compiler/package-copies.d.ts +60 -0
  77. package/dist/implementation/compiler/package-copies.js +140 -0
  78. package/dist/implementation/compiler/package-copies.js.map +1 -0
  79. package/dist/implementation/compiler/passes.d.ts +25 -0
  80. package/dist/implementation/compiler/passes.js +24 -0
  81. package/dist/implementation/compiler/passes.js.map +1 -0
  82. package/dist/implementation/compiler/paths.d.ts +5 -14
  83. package/dist/implementation/compiler/paths.js +16 -25
  84. package/dist/implementation/compiler/paths.js.map +1 -1
  85. package/dist/implementation/compiler/plugin.d.ts +17 -1
  86. package/dist/implementation/compiler/plugin.js +207 -35
  87. package/dist/implementation/compiler/plugin.js.map +1 -1
  88. package/dist/implementation/compiler/posix.d.ts +8 -0
  89. package/dist/implementation/compiler/posix.js +205 -0
  90. package/dist/implementation/compiler/posix.js.map +1 -0
  91. package/dist/implementation/compiler/predicates.d.ts +11 -0
  92. package/dist/implementation/compiler/predicates.js +281 -0
  93. package/dist/implementation/compiler/predicates.js.map +1 -0
  94. package/dist/implementation/compiler/print.js +27 -7
  95. package/dist/implementation/compiler/print.js.map +1 -1
  96. package/dist/implementation/compiler/program.js +3 -0
  97. package/dist/implementation/compiler/program.js.map +1 -1
  98. package/dist/implementation/compiler/public.d.ts +1 -0
  99. package/dist/implementation/compiler/public.js +3 -0
  100. package/dist/implementation/compiler/public.js.map +1 -0
  101. package/dist/implementation/compiler/scalar.js.map +1 -1
  102. package/dist/implementation/compiler/scope.js.map +1 -1
  103. package/dist/implementation/compiler/serialize.js +1 -0
  104. package/dist/implementation/compiler/serialize.js.map +1 -1
  105. package/dist/implementation/compiler/signature.d.ts +18 -3
  106. package/dist/implementation/compiler/signature.js +68 -30
  107. package/dist/implementation/compiler/signature.js.map +1 -1
  108. package/dist/implementation/compiler/snapshot.d.ts +3 -1
  109. package/dist/implementation/compiler/snapshot.js +1 -1
  110. package/dist/implementation/compiler/snapshot.js.map +1 -1
  111. package/dist/implementation/compiler/source-map.js +1 -0
  112. package/dist/implementation/compiler/source-map.js.map +1 -1
  113. package/dist/implementation/compiler/spawns.d.ts +13 -1
  114. package/dist/implementation/compiler/spawns.js +67 -5
  115. package/dist/implementation/compiler/spawns.js.map +1 -1
  116. package/dist/implementation/compiler/stamps.d.ts +10 -3
  117. package/dist/implementation/compiler/stamps.js +28 -9
  118. package/dist/implementation/compiler/stamps.js.map +1 -1
  119. package/dist/implementation/compiler/statement.js.map +1 -1
  120. package/dist/implementation/compiler/terminal.js.map +1 -1
  121. package/dist/implementation/compiler/transform.d.ts +55 -5
  122. package/dist/implementation/compiler/transform.js +311 -55
  123. package/dist/implementation/compiler/transform.js.map +1 -1
  124. package/dist/implementation/compiler/type-schemas.d.ts +130 -0
  125. package/dist/implementation/compiler/type-schemas.js +701 -0
  126. package/dist/implementation/compiler/type-schemas.js.map +1 -0
  127. package/dist/implementation/compiler/unit.d.ts +20 -3
  128. package/dist/implementation/compiler/unit.js +2 -2
  129. package/dist/implementation/compiler/unit.js.map +1 -1
  130. package/dist/implementation/compiler/value.js.map +1 -1
  131. package/dist/implementation/compiler/wat.d.ts +12 -0
  132. package/dist/implementation/compiler/wat.js +379 -0
  133. package/dist/implementation/compiler/wat.js.map +1 -0
  134. package/dist/implementation/index.js +1 -0
  135. package/dist/implementation/index.js.map +1 -1
  136. package/dist/implementation/world/activate.js +8 -3
  137. package/dist/implementation/world/activate.js.map +1 -1
  138. package/dist/implementation/world/archetype.d.ts +64 -9
  139. package/dist/implementation/world/archetype.js +103 -14
  140. package/dist/implementation/world/archetype.js.map +1 -1
  141. package/dist/implementation/world/arrays.d.ts +6 -1
  142. package/dist/implementation/world/arrays.js +3 -0
  143. package/dist/implementation/world/arrays.js.map +1 -1
  144. package/dist/implementation/world/arrivals.d.ts +52 -0
  145. package/dist/implementation/world/arrivals.js +146 -0
  146. package/dist/implementation/world/arrivals.js.map +1 -0
  147. package/dist/implementation/world/attach-kernel.d.ts +3 -2
  148. package/dist/implementation/world/attach-kernel.js +16 -8
  149. package/dist/implementation/world/attach-kernel.js.map +1 -1
  150. package/dist/implementation/world/batches.d.ts +5 -2
  151. package/dist/implementation/world/batches.js +72 -8
  152. package/dist/implementation/world/batches.js.map +1 -1
  153. package/dist/implementation/world/buffer.js +37 -4
  154. package/dist/implementation/world/buffer.js.map +1 -1
  155. package/dist/implementation/world/cascade.js +1 -1
  156. package/dist/implementation/world/cascade.js.map +1 -1
  157. package/dist/implementation/world/cells.js.map +1 -1
  158. package/dist/implementation/world/check-kernel.d.ts +7 -5
  159. package/dist/implementation/world/check-kernel.js +51 -34
  160. package/dist/implementation/world/check-kernel.js.map +1 -1
  161. package/dist/implementation/world/claims.js +1 -0
  162. package/dist/implementation/world/claims.js.map +1 -1
  163. package/dist/implementation/world/closure.js +1 -0
  164. package/dist/implementation/world/closure.js.map +1 -1
  165. package/dist/implementation/world/command-ring.js +2 -1
  166. package/dist/implementation/world/command-ring.js.map +1 -1
  167. package/dist/implementation/world/commands.js +26 -4
  168. package/dist/implementation/world/commands.js.map +1 -1
  169. package/dist/implementation/world/create.d.ts +40 -0
  170. package/dist/implementation/world/create.js +479 -257
  171. package/dist/implementation/world/create.js.map +1 -1
  172. package/dist/implementation/world/directories.js +2 -1
  173. package/dist/implementation/world/directories.js.map +1 -1
  174. package/dist/implementation/world/entities.js.map +1 -1
  175. package/dist/implementation/world/execute.d.ts +1 -7
  176. package/dist/implementation/world/execute.js +248 -107
  177. package/dist/implementation/world/execute.js.map +1 -1
  178. package/dist/implementation/world/failures.d.ts +48 -5
  179. package/dist/implementation/world/failures.js +36 -4
  180. package/dist/implementation/world/failures.js.map +1 -1
  181. package/dist/implementation/world/finalizers.d.ts +2 -0
  182. package/dist/implementation/world/finalizers.js +42 -14
  183. package/dist/implementation/world/finalizers.js.map +1 -1
  184. package/dist/implementation/world/gpu.d.ts +8 -8
  185. package/dist/implementation/world/gpu.js +21 -12
  186. package/dist/implementation/world/gpu.js.map +1 -1
  187. package/dist/implementation/world/holders.js +1 -0
  188. package/dist/implementation/world/holders.js.map +1 -1
  189. package/dist/implementation/world/index-build.js +1 -0
  190. package/dist/implementation/world/index-build.js.map +1 -1
  191. package/dist/implementation/world/index-hash.d.ts +52 -13
  192. package/dist/implementation/world/index-hash.js +440 -71
  193. package/dist/implementation/world/index-hash.js.map +1 -1
  194. package/dist/implementation/world/index-keys.js +1 -0
  195. package/dist/implementation/world/index-keys.js.map +1 -1
  196. package/dist/implementation/world/index-lookups.d.ts +3 -3
  197. package/dist/implementation/world/index-lookups.js +22 -17
  198. package/dist/implementation/world/index-lookups.js.map +1 -1
  199. package/dist/implementation/world/index-order.js.map +1 -1
  200. package/dist/implementation/world/index-readers.js.map +1 -1
  201. package/dist/implementation/world/index-sorted.d.ts +2 -2
  202. package/dist/implementation/world/index-sorted.js +10 -4
  203. package/dist/implementation/world/index-sorted.js.map +1 -1
  204. package/dist/implementation/world/indexes.d.ts +9 -14
  205. package/dist/implementation/world/indexes.js +57 -115
  206. package/dist/implementation/world/indexes.js.map +1 -1
  207. package/dist/implementation/world/input.js +1 -1
  208. package/dist/implementation/world/input.js.map +1 -1
  209. package/dist/implementation/world/intrinsics.js.map +1 -1
  210. package/dist/implementation/world/join.d.ts +10 -7
  211. package/dist/implementation/world/join.js +116 -59
  212. package/dist/implementation/world/join.js.map +1 -1
  213. package/dist/implementation/world/joined-observer.d.ts +31 -2
  214. package/dist/implementation/world/joined-observer.js +69 -17
  215. package/dist/implementation/world/joined-observer.js.map +1 -1
  216. package/dist/implementation/world/joining.d.ts +60 -6
  217. package/dist/implementation/world/joining.js +47 -3
  218. package/dist/implementation/world/joining.js.map +1 -1
  219. package/dist/implementation/world/journal.d.ts +3 -2
  220. package/dist/implementation/world/journal.js +7 -4
  221. package/dist/implementation/world/journal.js.map +1 -1
  222. package/dist/implementation/world/kernel-indexes.d.ts +9 -2
  223. package/dist/implementation/world/kernel-indexes.js +13 -3
  224. package/dist/implementation/world/kernel-indexes.js.map +1 -1
  225. package/dist/implementation/world/kernel.d.ts +39 -5
  226. package/dist/implementation/world/kernel.js +2 -0
  227. package/dist/implementation/world/kernel.js.map +1 -1
  228. package/dist/implementation/world/kernels.d.ts +10 -2
  229. package/dist/implementation/world/kernels.js +85 -13
  230. package/dist/implementation/world/kernels.js.map +1 -1
  231. package/dist/implementation/world/layout-directory.d.ts +28 -12
  232. package/dist/implementation/world/layout-directory.js +72 -17
  233. package/dist/implementation/world/layout-directory.js.map +1 -1
  234. package/dist/implementation/world/lists.d.ts +37 -7
  235. package/dist/implementation/world/lists.js +169 -29
  236. package/dist/implementation/world/lists.js.map +1 -1
  237. package/dist/implementation/world/lookup-keys.d.ts +9 -8
  238. package/dist/implementation/world/lookup-keys.js.map +1 -1
  239. package/dist/implementation/world/loop.js +4 -5
  240. package/dist/implementation/world/loop.js.map +1 -1
  241. package/dist/implementation/world/memory.js +1 -0
  242. package/dist/implementation/world/memory.js.map +1 -1
  243. package/dist/implementation/world/mirror.d.ts +16 -3
  244. package/dist/implementation/world/mirror.js +37 -9
  245. package/dist/implementation/world/mirror.js.map +1 -1
  246. package/dist/implementation/world/move-log.js.map +1 -1
  247. package/dist/implementation/world/observer.d.ts +1 -1
  248. package/dist/implementation/world/observer.js +1 -2
  249. package/dist/implementation/world/observer.js.map +1 -1
  250. package/dist/implementation/world/order.js +1 -0
  251. package/dist/implementation/world/order.js.map +1 -1
  252. package/dist/implementation/world/out-of-band.d.ts +28 -0
  253. package/dist/implementation/world/out-of-band.js +66 -0
  254. package/dist/implementation/world/out-of-band.js.map +1 -0
  255. package/dist/implementation/world/plan.js.map +1 -1
  256. package/dist/implementation/world/pool.js +1 -0
  257. package/dist/implementation/world/pool.js.map +1 -1
  258. package/dist/implementation/world/port.d.ts +4 -3
  259. package/dist/implementation/world/port.js +14 -9
  260. package/dist/implementation/world/port.js.map +1 -1
  261. package/dist/implementation/world/prepared-lookup.js +1 -0
  262. package/dist/implementation/world/prepared-lookup.js.map +1 -1
  263. package/dist/implementation/world/prepared-spawn.js +13 -9
  264. package/dist/implementation/world/prepared-spawn.js.map +1 -1
  265. package/dist/implementation/world/program.js.map +1 -1
  266. package/dist/implementation/world/protocol.d.ts +8 -1
  267. package/dist/implementation/world/protocol.js.map +1 -1
  268. package/dist/implementation/world/publish.js.map +1 -1
  269. package/dist/implementation/world/ranges.d.ts +13 -3
  270. package/dist/implementation/world/ranges.js +118 -35
  271. package/dist/implementation/world/ranges.js.map +1 -1
  272. package/dist/implementation/world/reclaim.d.ts +27 -0
  273. package/dist/implementation/world/reclaim.js +176 -0
  274. package/dist/implementation/world/reclaim.js.map +1 -0
  275. package/dist/implementation/world/reductions.d.ts +7 -6
  276. package/dist/implementation/world/reductions.js +11 -11
  277. package/dist/implementation/world/reductions.js.map +1 -1
  278. package/dist/implementation/world/register.js +2 -2
  279. package/dist/implementation/world/register.js.map +1 -1
  280. package/dist/implementation/world/remote-systems.d.ts +9 -4
  281. package/dist/implementation/world/remote-systems.js +33 -28
  282. package/dist/implementation/world/remote-systems.js.map +1 -1
  283. package/dist/implementation/world/remote.js +1 -0
  284. package/dist/implementation/world/remote.js.map +1 -1
  285. package/dist/implementation/world/render-order.d.ts +19 -0
  286. package/dist/implementation/world/render-order.js +126 -0
  287. package/dist/implementation/world/render-order.js.map +1 -0
  288. package/dist/implementation/world/required.d.ts +3 -0
  289. package/dist/implementation/world/required.js +9 -0
  290. package/dist/implementation/world/required.js.map +1 -0
  291. package/dist/implementation/world/resources.d.ts +4 -1
  292. package/dist/implementation/world/resources.js +6 -3
  293. package/dist/implementation/world/resources.js.map +1 -1
  294. package/dist/implementation/world/rows.d.ts +15 -12
  295. package/dist/implementation/world/rows.js +90 -20
  296. package/dist/implementation/world/rows.js.map +1 -1
  297. package/dist/implementation/world/runner.d.ts +10 -0
  298. package/dist/implementation/world/runner.js +398 -78
  299. package/dist/implementation/world/runner.js.map +1 -1
  300. package/dist/implementation/world/shared.d.ts +55 -0
  301. package/dist/implementation/world/shared.js +301 -0
  302. package/dist/implementation/world/shared.js.map +1 -0
  303. package/dist/implementation/world/sharing.d.ts +7 -6
  304. package/dist/implementation/world/sharing.js +86 -23
  305. package/dist/implementation/world/sharing.js.map +1 -1
  306. package/dist/implementation/world/staging.d.ts +28 -5
  307. package/dist/implementation/world/staging.js +35 -9
  308. package/dist/implementation/world/staging.js.map +1 -1
  309. package/dist/implementation/world/state.d.ts +72 -13
  310. package/dist/implementation/world/state.js +138 -14
  311. package/dist/implementation/world/state.js.map +1 -1
  312. package/dist/implementation/world/stop-lists.d.ts +25 -2
  313. package/dist/implementation/world/stop-lists.js +63 -8
  314. package/dist/implementation/world/stop-lists.js.map +1 -1
  315. package/dist/implementation/world/strings.js +1 -0
  316. package/dist/implementation/world/strings.js.map +1 -1
  317. package/dist/implementation/world/structure.d.ts +1 -1
  318. package/dist/implementation/world/structure.js +4 -1
  319. package/dist/implementation/world/structure.js.map +1 -1
  320. package/dist/implementation/world/synchronize.d.ts +1 -1
  321. package/dist/implementation/world/synchronize.js +59 -17
  322. package/dist/implementation/world/synchronize.js.map +1 -1
  323. package/dist/implementation/world/tail-blocks.d.ts +5 -2
  324. package/dist/implementation/world/tail-blocks.js +9 -4
  325. package/dist/implementation/world/tail-blocks.js.map +1 -1
  326. package/dist/implementation/world/tails.d.ts +10 -5
  327. package/dist/implementation/world/tails.js +25 -18
  328. package/dist/implementation/world/tails.js.map +1 -1
  329. package/dist/implementation/world/terminal.js +1 -0
  330. package/dist/implementation/world/terminal.js.map +1 -1
  331. package/dist/implementation/world/thread-directory.d.ts +8 -2
  332. package/dist/implementation/world/thread-directory.js +82 -12
  333. package/dist/implementation/world/thread-directory.js.map +1 -1
  334. package/dist/implementation/world/thread-finalizers.d.ts +1 -2
  335. package/dist/implementation/world/thread-finalizers.js +129 -19
  336. package/dist/implementation/world/thread-finalizers.js.map +1 -1
  337. package/dist/implementation/world/thread-indexes.d.ts +3 -1
  338. package/dist/implementation/world/thread-indexes.js +4 -3
  339. package/dist/implementation/world/thread-indexes.js.map +1 -1
  340. package/dist/implementation/world/thread-observer.d.ts +4 -2
  341. package/dist/implementation/world/thread-observer.js +53 -11
  342. package/dist/implementation/world/thread-observer.js.map +1 -1
  343. package/dist/implementation/world/thread-systems.d.ts +10 -2
  344. package/dist/implementation/world/thread-systems.js +396 -78
  345. package/dist/implementation/world/thread-systems.js.map +1 -1
  346. package/dist/implementation/world/thread-tasks.d.ts +8 -4
  347. package/dist/implementation/world/thread-tasks.js +9 -4
  348. package/dist/implementation/world/thread-tasks.js.map +1 -1
  349. package/dist/implementation/world/transfers.js.map +1 -1
  350. package/dist/implementation/world/up.d.ts +9 -6
  351. package/dist/implementation/world/up.js +291 -75
  352. package/dist/implementation/world/up.js.map +1 -1
  353. package/dist/implementation/world/wasm.d.ts +39 -8
  354. package/dist/implementation/world/wasm.js +428 -127
  355. package/dist/implementation/world/wasm.js.map +1 -1
  356. package/dist/implementation/world/wgsl.d.ts +4 -2
  357. package/dist/implementation/world/wgsl.js +20 -8
  358. package/dist/implementation/world/wgsl.js.map +1 -1
  359. package/dist/implementation/world/where.d.ts +74 -0
  360. package/dist/implementation/world/where.js +202 -0
  361. package/dist/implementation/world/where.js.map +1 -0
  362. package/dist/implementation/world/worker-platform.js.map +1 -1
  363. package/dist/implementation/world/worker-window.d.ts +7 -0
  364. package/dist/implementation/world/worker-window.js +47 -0
  365. package/dist/implementation/world/worker-window.js.map +1 -0
  366. package/dist/implementation/world/worker.js +47 -61
  367. package/dist/implementation/world/worker.js.map +1 -1
  368. package/dist/index.d.ts +20 -0
  369. package/dist/index.js +5 -0
  370. package/dist/index.js.map +1 -1
  371. package/dist/interface/component/component.d.ts +7 -1
  372. package/dist/interface/component/component.js.map +1 -1
  373. package/dist/interface/component/index.d.ts +1 -2
  374. package/dist/interface/component/index.js +1 -1
  375. package/dist/interface/component/index.js.map +1 -1
  376. package/dist/interface/component/types.d.ts +2 -2
  377. package/dist/interface/component/value.d.ts +12 -7
  378. package/dist/interface/component/values.d.ts +2 -2
  379. package/dist/interface/entity/entity.js.map +1 -1
  380. package/dist/interface/entity/index.d.ts +2 -0
  381. package/dist/interface/entity/index.js +2 -0
  382. package/dist/interface/entity/index.js.map +1 -1
  383. package/dist/interface/finalizer/body.d.ts +17 -14
  384. package/dist/interface/finalizer/create.d.ts +14 -14
  385. package/dist/interface/finalizer/create.js +43 -10
  386. package/dist/interface/finalizer/create.js.map +1 -1
  387. package/dist/interface/finalizer/created.d.ts +5 -5
  388. package/dist/interface/finalizer/declaration.d.ts +33 -13
  389. package/dist/interface/finalizer/finalizer.d.ts +2 -2
  390. package/dist/interface/finalizer/finalizer.js.map +1 -1
  391. package/dist/interface/finalizer/index.js +1 -0
  392. package/dist/interface/finalizer/index.js.map +1 -1
  393. package/dist/interface/gpu/accessors.d.ts +4 -3
  394. package/dist/interface/gpu/accessors.js +25 -8
  395. package/dist/interface/gpu/accessors.js.map +1 -1
  396. package/dist/interface/gpu/gpu.js.map +1 -1
  397. package/dist/interface/gpu/index.js +1 -0
  398. package/dist/interface/gpu/index.js.map +1 -1
  399. package/dist/interface/gpu/layout.js +1 -0
  400. package/dist/interface/gpu/layout.js.map +1 -1
  401. package/dist/interface/gpu/record.js +1 -0
  402. package/dist/interface/gpu/record.js.map +1 -1
  403. package/dist/interface/gpu/wgsl.d.ts +2 -1
  404. package/dist/interface/gpu/wgsl.js +9 -5
  405. package/dist/interface/gpu/wgsl.js.map +1 -1
  406. package/dist/interface/index.d.ts +0 -3
  407. package/dist/interface/index.js +1 -3
  408. package/dist/interface/index.js.map +1 -1
  409. package/dist/interface/indexes/create.d.ts +18 -9
  410. package/dist/interface/indexes/create.js +16 -13
  411. package/dist/interface/indexes/create.js.map +1 -1
  412. package/dist/interface/indexes/created.d.ts +2 -2
  413. package/dist/interface/indexes/declaration.d.ts +8 -3
  414. package/dist/interface/indexes/index-type.d.ts +3 -3
  415. package/dist/interface/indexes/index-type.js.map +1 -1
  416. package/dist/interface/indexes/index.js +1 -0
  417. package/dist/interface/indexes/index.js.map +1 -1
  418. package/dist/interface/math/f32/default.d.ts +4 -0
  419. package/dist/interface/math/f32/default.js +4 -0
  420. package/dist/interface/math/f32/default.js.map +1 -0
  421. package/dist/interface/math/f32/index.d.ts +3 -1
  422. package/dist/interface/math/f32/index.js.map +1 -1
  423. package/dist/interface/math/f32/public.d.ts +1 -0
  424. package/dist/interface/math/f32/public.js +2 -0
  425. package/dist/interface/math/f32/public.js.map +1 -1
  426. package/dist/interface/math/f32/round-half-even.js +1 -0
  427. package/dist/interface/math/f32/round-half-even.js.map +1 -1
  428. package/dist/interface/math/f32/schema.js.map +1 -1
  429. package/dist/interface/math/i32/default.d.ts +4 -0
  430. package/dist/interface/math/i32/default.js +4 -0
  431. package/dist/interface/math/i32/default.js.map +1 -0
  432. package/dist/interface/math/i32/index.d.ts +3 -1
  433. package/dist/interface/math/i32/index.js.map +1 -1
  434. package/dist/interface/math/i32/public.d.ts +1 -0
  435. package/dist/interface/math/i32/public.js +2 -0
  436. package/dist/interface/math/i32/public.js.map +1 -1
  437. package/dist/interface/math/i32/schema.js.map +1 -1
  438. package/dist/interface/math/i32/shift-right.js.map +1 -1
  439. package/dist/interface/math/index.js +1 -0
  440. package/dist/interface/math/index.js.map +1 -1
  441. package/dist/interface/math/intrinsic.js.map +1 -1
  442. package/dist/interface/math/mat4x4/add.js.map +1 -1
  443. package/dist/interface/math/mat4x4/determinant.js.map +1 -1
  444. package/dist/interface/math/mat4x4/identity.js.map +1 -1
  445. package/dist/interface/math/mat4x4/index.d.ts +3 -1
  446. package/dist/interface/math/mat4x4/index.js.map +1 -1
  447. package/dist/interface/math/mat4x4/inverse.js.map +1 -1
  448. package/dist/interface/math/mat4x4/look-at.js.map +1 -1
  449. package/dist/interface/math/mat4x4/multiply-vec3.js.map +1 -1
  450. package/dist/interface/math/mat4x4/multiply-vec4.js.map +1 -1
  451. package/dist/interface/math/mat4x4/multiply.js.map +1 -1
  452. package/dist/interface/math/mat4x4/orthographic.js.map +1 -1
  453. package/dist/interface/math/mat4x4/perspective.js.map +1 -1
  454. package/dist/interface/math/mat4x4/public.d.ts +1 -0
  455. package/dist/interface/math/mat4x4/public.js +2 -0
  456. package/dist/interface/math/mat4x4/public.js.map +1 -1
  457. package/dist/interface/math/mat4x4/rotation-x.js.map +1 -1
  458. package/dist/interface/math/mat4x4/rotation-y.js.map +1 -1
  459. package/dist/interface/math/mat4x4/rotation-z.js.map +1 -1
  460. package/dist/interface/math/mat4x4/scale.js.map +1 -1
  461. package/dist/interface/math/mat4x4/scaling.js.map +1 -1
  462. package/dist/interface/math/mat4x4/schema.js.map +1 -1
  463. package/dist/interface/math/mat4x4/subtract.js.map +1 -1
  464. package/dist/interface/math/mat4x4/translation.js.map +1 -1
  465. package/dist/interface/math/mat4x4/transpose.js.map +1 -1
  466. package/dist/interface/math/mat4x4/zero.js.map +1 -1
  467. package/dist/interface/math/quat/add.js.map +1 -1
  468. package/dist/interface/math/quat/align-to.js.map +1 -1
  469. package/dist/interface/math/quat/conjugate.js.map +1 -1
  470. package/dist/interface/math/quat/distance.js.map +1 -1
  471. package/dist/interface/math/quat/dot.js.map +1 -1
  472. package/dist/interface/math/quat/from-axis-angle.js.map +1 -1
  473. package/dist/interface/math/quat/from-euler.js.map +1 -1
  474. package/dist/interface/math/quat/identity.js.map +1 -1
  475. package/dist/interface/math/quat/index.d.ts +3 -1
  476. package/dist/interface/math/quat/index.js.map +1 -1
  477. package/dist/interface/math/quat/inverse.js.map +1 -1
  478. package/dist/interface/math/quat/length-squared.js.map +1 -1
  479. package/dist/interface/math/quat/length.js.map +1 -1
  480. package/dist/interface/math/quat/lerp.js.map +1 -1
  481. package/dist/interface/math/quat/look-at.js.map +1 -1
  482. package/dist/interface/math/quat/multiply.js.map +1 -1
  483. package/dist/interface/math/quat/negate.js.map +1 -1
  484. package/dist/interface/math/quat/normalize.js.map +1 -1
  485. package/dist/interface/math/quat/public.d.ts +1 -0
  486. package/dist/interface/math/quat/public.js +2 -0
  487. package/dist/interface/math/quat/public.js.map +1 -1
  488. package/dist/interface/math/quat/rotate-vec3.js.map +1 -1
  489. package/dist/interface/math/quat/scale.js.map +1 -1
  490. package/dist/interface/math/quat/schema.js.map +1 -1
  491. package/dist/interface/math/quat/slerp.js.map +1 -1
  492. package/dist/interface/math/quat/subtract.js.map +1 -1
  493. package/dist/interface/math/quat/to-axis-angle.js.map +1 -1
  494. package/dist/interface/math/quat/to-euler.js.map +1 -1
  495. package/dist/interface/math/quat/to-mat4.js.map +1 -1
  496. package/dist/interface/math/u32/count-leading-zeros.js.map +1 -1
  497. package/dist/interface/math/u32/count-one-bits.js.map +1 -1
  498. package/dist/interface/math/u32/count-trailing-zeros.js.map +1 -1
  499. package/dist/interface/math/u32/default.d.ts +4 -0
  500. package/dist/interface/math/u32/default.js +4 -0
  501. package/dist/interface/math/u32/default.js.map +1 -0
  502. package/dist/interface/math/u32/index.d.ts +3 -1
  503. package/dist/interface/math/u32/index.js.map +1 -1
  504. package/dist/interface/math/u32/public.d.ts +1 -0
  505. package/dist/interface/math/u32/public.js +2 -0
  506. package/dist/interface/math/u32/public.js.map +1 -1
  507. package/dist/interface/math/u32/reverse-bits.js.map +1 -1
  508. package/dist/interface/math/u32/schema.js.map +1 -1
  509. package/dist/interface/math/u32/shift-right.js.map +1 -1
  510. package/dist/interface/math/vec2/f32/abs.js.map +1 -1
  511. package/dist/interface/math/vec2/f32/acos.js.map +1 -1
  512. package/dist/interface/math/vec2/f32/acosh.js.map +1 -1
  513. package/dist/interface/math/vec2/f32/add.js.map +1 -1
  514. package/dist/interface/math/vec2/f32/asin.js.map +1 -1
  515. package/dist/interface/math/vec2/f32/asinh.js.map +1 -1
  516. package/dist/interface/math/vec2/f32/atan.js.map +1 -1
  517. package/dist/interface/math/vec2/f32/atanh.js.map +1 -1
  518. package/dist/interface/math/vec2/f32/ceil.js.map +1 -1
  519. package/dist/interface/math/vec2/f32/clamp.js.map +1 -1
  520. package/dist/interface/math/vec2/f32/cos.js.map +1 -1
  521. package/dist/interface/math/vec2/f32/cosh.js.map +1 -1
  522. package/dist/interface/math/vec2/f32/distance.js.map +1 -1
  523. package/dist/interface/math/vec2/f32/dot.js.map +1 -1
  524. package/dist/interface/math/vec2/f32/equals.js.map +1 -1
  525. package/dist/interface/math/vec2/f32/exp.js.map +1 -1
  526. package/dist/interface/math/vec2/f32/exp2.js.map +1 -1
  527. package/dist/interface/math/vec2/f32/f32.d.ts +3 -1
  528. package/dist/interface/math/vec2/f32/f32.js.map +1 -1
  529. package/dist/interface/math/vec2/f32/faceforward.js.map +1 -1
  530. package/dist/interface/math/vec2/f32/floor.js.map +1 -1
  531. package/dist/interface/math/vec2/f32/fract.js.map +1 -1
  532. package/dist/interface/math/vec2/f32/length.js.map +1 -1
  533. package/dist/interface/math/vec2/f32/log.js.map +1 -1
  534. package/dist/interface/math/vec2/f32/log2.js.map +1 -1
  535. package/dist/interface/math/vec2/f32/max.js.map +1 -1
  536. package/dist/interface/math/vec2/f32/min.js.map +1 -1
  537. package/dist/interface/math/vec2/f32/mix.js.map +1 -1
  538. package/dist/interface/math/vec2/f32/mod.js.map +1 -1
  539. package/dist/interface/math/vec2/f32/modf.js.map +1 -1
  540. package/dist/interface/math/vec2/f32/negate.js.map +1 -1
  541. package/dist/interface/math/vec2/f32/normalize.js.map +1 -1
  542. package/dist/interface/math/vec2/f32/pow.js.map +1 -1
  543. package/dist/interface/math/vec2/f32/public.d.ts +1 -0
  544. package/dist/interface/math/vec2/f32/public.js +2 -0
  545. package/dist/interface/math/vec2/f32/public.js.map +1 -1
  546. package/dist/interface/math/vec2/f32/reflect.js.map +1 -1
  547. package/dist/interface/math/vec2/f32/refract.js.map +1 -1
  548. package/dist/interface/math/vec2/f32/round.js.map +1 -1
  549. package/dist/interface/math/vec2/f32/scale.js.map +1 -1
  550. package/dist/interface/math/vec2/f32/schema.js.map +1 -1
  551. package/dist/interface/math/vec2/f32/sign.js.map +1 -1
  552. package/dist/interface/math/vec2/f32/sin.js.map +1 -1
  553. package/dist/interface/math/vec2/f32/sinh.js.map +1 -1
  554. package/dist/interface/math/vec2/f32/smoothstep.js.map +1 -1
  555. package/dist/interface/math/vec2/f32/sqrt.js.map +1 -1
  556. package/dist/interface/math/vec2/f32/step.js.map +1 -1
  557. package/dist/interface/math/vec2/f32/subtract.js.map +1 -1
  558. package/dist/interface/math/vec2/f32/tan.js.map +1 -1
  559. package/dist/interface/math/vec2/f32/tanh.js.map +1 -1
  560. package/dist/interface/math/vec2/f32/trunc.js.map +1 -1
  561. package/dist/interface/math/vec2/f32/zero.js.map +1 -1
  562. package/dist/interface/math/vec2/i32/abs.js.map +1 -1
  563. package/dist/interface/math/vec2/i32/add.js.map +1 -1
  564. package/dist/interface/math/vec2/i32/bitwise-and.js.map +1 -1
  565. package/dist/interface/math/vec2/i32/bitwise-not.js.map +1 -1
  566. package/dist/interface/math/vec2/i32/bitwise-or.js.map +1 -1
  567. package/dist/interface/math/vec2/i32/bitwise-xor.js.map +1 -1
  568. package/dist/interface/math/vec2/i32/clamp.js.map +1 -1
  569. package/dist/interface/math/vec2/i32/count-leading-zeros.js.map +1 -1
  570. package/dist/interface/math/vec2/i32/count-one-bits.js.map +1 -1
  571. package/dist/interface/math/vec2/i32/count-trailing-zeros.js.map +1 -1
  572. package/dist/interface/math/vec2/i32/equals.js.map +1 -1
  573. package/dist/interface/math/vec2/i32/i32.d.ts +3 -1
  574. package/dist/interface/math/vec2/i32/i32.js.map +1 -1
  575. package/dist/interface/math/vec2/i32/max.js.map +1 -1
  576. package/dist/interface/math/vec2/i32/min.js.map +1 -1
  577. package/dist/interface/math/vec2/i32/negate.js.map +1 -1
  578. package/dist/interface/math/vec2/i32/public.d.ts +1 -0
  579. package/dist/interface/math/vec2/i32/public.js +2 -0
  580. package/dist/interface/math/vec2/i32/public.js.map +1 -1
  581. package/dist/interface/math/vec2/i32/reverse-bits.js.map +1 -1
  582. package/dist/interface/math/vec2/i32/scale.js.map +1 -1
  583. package/dist/interface/math/vec2/i32/schema.js.map +1 -1
  584. package/dist/interface/math/vec2/i32/shift-left.js.map +1 -1
  585. package/dist/interface/math/vec2/i32/shift-right.js.map +1 -1
  586. package/dist/interface/math/vec2/i32/subtract.js.map +1 -1
  587. package/dist/interface/math/vec2/i32/zero.js.map +1 -1
  588. package/dist/interface/math/vec2/index.js.map +1 -1
  589. package/dist/interface/math/vec2/public.d.ts +1 -0
  590. package/dist/interface/math/vec2/public.js +2 -0
  591. package/dist/interface/math/vec2/public.js.map +1 -1
  592. package/dist/interface/math/vec2/u32/add.js.map +1 -1
  593. package/dist/interface/math/vec2/u32/bitwise-and.js.map +1 -1
  594. package/dist/interface/math/vec2/u32/bitwise-not.js.map +1 -1
  595. package/dist/interface/math/vec2/u32/bitwise-or.js.map +1 -1
  596. package/dist/interface/math/vec2/u32/bitwise-xor.js.map +1 -1
  597. package/dist/interface/math/vec2/u32/clamp.js.map +1 -1
  598. package/dist/interface/math/vec2/u32/count-leading-zeros.js.map +1 -1
  599. package/dist/interface/math/vec2/u32/count-one-bits.js.map +1 -1
  600. package/dist/interface/math/vec2/u32/count-trailing-zeros.js.map +1 -1
  601. package/dist/interface/math/vec2/u32/equals.js.map +1 -1
  602. package/dist/interface/math/vec2/u32/max.js.map +1 -1
  603. package/dist/interface/math/vec2/u32/min.js.map +1 -1
  604. package/dist/interface/math/vec2/u32/negate.js.map +1 -1
  605. package/dist/interface/math/vec2/u32/public.d.ts +1 -0
  606. package/dist/interface/math/vec2/u32/public.js +2 -0
  607. package/dist/interface/math/vec2/u32/public.js.map +1 -1
  608. package/dist/interface/math/vec2/u32/reverse-bits.js.map +1 -1
  609. package/dist/interface/math/vec2/u32/scale.js.map +1 -1
  610. package/dist/interface/math/vec2/u32/schema.js.map +1 -1
  611. package/dist/interface/math/vec2/u32/shift-left.js.map +1 -1
  612. package/dist/interface/math/vec2/u32/shift-right.js.map +1 -1
  613. package/dist/interface/math/vec2/u32/subtract.js.map +1 -1
  614. package/dist/interface/math/vec2/u32/u32.d.ts +3 -1
  615. package/dist/interface/math/vec2/u32/u32.js.map +1 -1
  616. package/dist/interface/math/vec2/u32/zero.js.map +1 -1
  617. package/dist/interface/math/vec3/f32/abs.js.map +1 -1
  618. package/dist/interface/math/vec3/f32/acos.js.map +1 -1
  619. package/dist/interface/math/vec3/f32/acosh.js.map +1 -1
  620. package/dist/interface/math/vec3/f32/add.js.map +1 -1
  621. package/dist/interface/math/vec3/f32/asin.js.map +1 -1
  622. package/dist/interface/math/vec3/f32/asinh.js.map +1 -1
  623. package/dist/interface/math/vec3/f32/atan.js.map +1 -1
  624. package/dist/interface/math/vec3/f32/atanh.js.map +1 -1
  625. package/dist/interface/math/vec3/f32/ceil.js.map +1 -1
  626. package/dist/interface/math/vec3/f32/clamp.js.map +1 -1
  627. package/dist/interface/math/vec3/f32/cos.js.map +1 -1
  628. package/dist/interface/math/vec3/f32/cosh.js.map +1 -1
  629. package/dist/interface/math/vec3/f32/cross.js.map +1 -1
  630. package/dist/interface/math/vec3/f32/distance-squared.js.map +1 -1
  631. package/dist/interface/math/vec3/f32/distance.js.map +1 -1
  632. package/dist/interface/math/vec3/f32/dot.js.map +1 -1
  633. package/dist/interface/math/vec3/f32/equals.js.map +1 -1
  634. package/dist/interface/math/vec3/f32/exp.js.map +1 -1
  635. package/dist/interface/math/vec3/f32/exp2.js.map +1 -1
  636. package/dist/interface/math/vec3/f32/f32.d.ts +3 -1
  637. package/dist/interface/math/vec3/f32/f32.js.map +1 -1
  638. package/dist/interface/math/vec3/f32/faceforward.js.map +1 -1
  639. package/dist/interface/math/vec3/f32/floor.js.map +1 -1
  640. package/dist/interface/math/vec3/f32/fract.js.map +1 -1
  641. package/dist/interface/math/vec3/f32/length-squared.js.map +1 -1
  642. package/dist/interface/math/vec3/f32/length.js.map +1 -1
  643. package/dist/interface/math/vec3/f32/log.js.map +1 -1
  644. package/dist/interface/math/vec3/f32/log2.js.map +1 -1
  645. package/dist/interface/math/vec3/f32/max.js.map +1 -1
  646. package/dist/interface/math/vec3/f32/min.js.map +1 -1
  647. package/dist/interface/math/vec3/f32/mix.js.map +1 -1
  648. package/dist/interface/math/vec3/f32/mod.js.map +1 -1
  649. package/dist/interface/math/vec3/f32/modf.js.map +1 -1
  650. package/dist/interface/math/vec3/f32/multiply.js.map +1 -1
  651. package/dist/interface/math/vec3/f32/negate.js.map +1 -1
  652. package/dist/interface/math/vec3/f32/normalize.js.map +1 -1
  653. package/dist/interface/math/vec3/f32/one.js.map +1 -1
  654. package/dist/interface/math/vec3/f32/pow.js.map +1 -1
  655. package/dist/interface/math/vec3/f32/public.d.ts +1 -0
  656. package/dist/interface/math/vec3/f32/public.js +2 -0
  657. package/dist/interface/math/vec3/f32/public.js.map +1 -1
  658. package/dist/interface/math/vec3/f32/random.js.map +1 -1
  659. package/dist/interface/math/vec3/f32/reflect.js.map +1 -1
  660. package/dist/interface/math/vec3/f32/refract.js.map +1 -1
  661. package/dist/interface/math/vec3/f32/round.js.map +1 -1
  662. package/dist/interface/math/vec3/f32/scale.js.map +1 -1
  663. package/dist/interface/math/vec3/f32/schema.js.map +1 -1
  664. package/dist/interface/math/vec3/f32/sign.js.map +1 -1
  665. package/dist/interface/math/vec3/f32/sin.js.map +1 -1
  666. package/dist/interface/math/vec3/f32/sinh.js.map +1 -1
  667. package/dist/interface/math/vec3/f32/smoothstep.js.map +1 -1
  668. package/dist/interface/math/vec3/f32/sqrt.js.map +1 -1
  669. package/dist/interface/math/vec3/f32/step.js.map +1 -1
  670. package/dist/interface/math/vec3/f32/subtract.js.map +1 -1
  671. package/dist/interface/math/vec3/f32/tan.js.map +1 -1
  672. package/dist/interface/math/vec3/f32/tanh.js.map +1 -1
  673. package/dist/interface/math/vec3/f32/trunc.js.map +1 -1
  674. package/dist/interface/math/vec3/f32/zero.js.map +1 -1
  675. package/dist/interface/math/vec3/i32/abs.js.map +1 -1
  676. package/dist/interface/math/vec3/i32/add.js.map +1 -1
  677. package/dist/interface/math/vec3/i32/bitwise-and.js.map +1 -1
  678. package/dist/interface/math/vec3/i32/bitwise-not.js.map +1 -1
  679. package/dist/interface/math/vec3/i32/bitwise-or.js.map +1 -1
  680. package/dist/interface/math/vec3/i32/bitwise-xor.js.map +1 -1
  681. package/dist/interface/math/vec3/i32/clamp.js.map +1 -1
  682. package/dist/interface/math/vec3/i32/count-leading-zeros.js.map +1 -1
  683. package/dist/interface/math/vec3/i32/count-one-bits.js.map +1 -1
  684. package/dist/interface/math/vec3/i32/count-trailing-zeros.js.map +1 -1
  685. package/dist/interface/math/vec3/i32/equals.js.map +1 -1
  686. package/dist/interface/math/vec3/i32/i32.d.ts +3 -1
  687. package/dist/interface/math/vec3/i32/i32.js.map +1 -1
  688. package/dist/interface/math/vec3/i32/max.js.map +1 -1
  689. package/dist/interface/math/vec3/i32/min.js.map +1 -1
  690. package/dist/interface/math/vec3/i32/multiply.js.map +1 -1
  691. package/dist/interface/math/vec3/i32/negate.js.map +1 -1
  692. package/dist/interface/math/vec3/i32/one.js.map +1 -1
  693. package/dist/interface/math/vec3/i32/public.d.ts +1 -0
  694. package/dist/interface/math/vec3/i32/public.js +2 -0
  695. package/dist/interface/math/vec3/i32/public.js.map +1 -1
  696. package/dist/interface/math/vec3/i32/reverse-bits.js.map +1 -1
  697. package/dist/interface/math/vec3/i32/scale.js.map +1 -1
  698. package/dist/interface/math/vec3/i32/schema.js.map +1 -1
  699. package/dist/interface/math/vec3/i32/shift-left.js.map +1 -1
  700. package/dist/interface/math/vec3/i32/shift-right.js.map +1 -1
  701. package/dist/interface/math/vec3/i32/subtract.js.map +1 -1
  702. package/dist/interface/math/vec3/i32/zero.js.map +1 -1
  703. package/dist/interface/math/vec3/index.js.map +1 -1
  704. package/dist/interface/math/vec3/public.d.ts +1 -0
  705. package/dist/interface/math/vec3/public.js +2 -0
  706. package/dist/interface/math/vec3/public.js.map +1 -1
  707. package/dist/interface/math/vec3/u32/add.js.map +1 -1
  708. package/dist/interface/math/vec3/u32/bitwise-and.js.map +1 -1
  709. package/dist/interface/math/vec3/u32/bitwise-not.js.map +1 -1
  710. package/dist/interface/math/vec3/u32/bitwise-or.js.map +1 -1
  711. package/dist/interface/math/vec3/u32/bitwise-xor.js.map +1 -1
  712. package/dist/interface/math/vec3/u32/clamp.js.map +1 -1
  713. package/dist/interface/math/vec3/u32/count-leading-zeros.js.map +1 -1
  714. package/dist/interface/math/vec3/u32/count-one-bits.js.map +1 -1
  715. package/dist/interface/math/vec3/u32/count-trailing-zeros.js.map +1 -1
  716. package/dist/interface/math/vec3/u32/equals.js.map +1 -1
  717. package/dist/interface/math/vec3/u32/max.js.map +1 -1
  718. package/dist/interface/math/vec3/u32/min.js.map +1 -1
  719. package/dist/interface/math/vec3/u32/multiply.js.map +1 -1
  720. package/dist/interface/math/vec3/u32/negate.js.map +1 -1
  721. package/dist/interface/math/vec3/u32/one.js.map +1 -1
  722. package/dist/interface/math/vec3/u32/public.d.ts +1 -0
  723. package/dist/interface/math/vec3/u32/public.js +2 -0
  724. package/dist/interface/math/vec3/u32/public.js.map +1 -1
  725. package/dist/interface/math/vec3/u32/reverse-bits.js.map +1 -1
  726. package/dist/interface/math/vec3/u32/scale.js.map +1 -1
  727. package/dist/interface/math/vec3/u32/schema.js.map +1 -1
  728. package/dist/interface/math/vec3/u32/shift-left.js.map +1 -1
  729. package/dist/interface/math/vec3/u32/shift-right.js.map +1 -1
  730. package/dist/interface/math/vec3/u32/subtract.js.map +1 -1
  731. package/dist/interface/math/vec3/u32/u32.d.ts +3 -1
  732. package/dist/interface/math/vec3/u32/u32.js.map +1 -1
  733. package/dist/interface/math/vec3/u32/volume.js.map +1 -1
  734. package/dist/interface/math/vec3/u32/zero.js.map +1 -1
  735. package/dist/interface/math/vec4/f32/abs.js.map +1 -1
  736. package/dist/interface/math/vec4/f32/acos.js.map +1 -1
  737. package/dist/interface/math/vec4/f32/acosh.js.map +1 -1
  738. package/dist/interface/math/vec4/f32/add.js.map +1 -1
  739. package/dist/interface/math/vec4/f32/asin.js.map +1 -1
  740. package/dist/interface/math/vec4/f32/asinh.js.map +1 -1
  741. package/dist/interface/math/vec4/f32/atan.js.map +1 -1
  742. package/dist/interface/math/vec4/f32/atanh.js.map +1 -1
  743. package/dist/interface/math/vec4/f32/ceil.js.map +1 -1
  744. package/dist/interface/math/vec4/f32/clamp.js.map +1 -1
  745. package/dist/interface/math/vec4/f32/cos.js.map +1 -1
  746. package/dist/interface/math/vec4/f32/cosh.js.map +1 -1
  747. package/dist/interface/math/vec4/f32/default.d.ts +4 -0
  748. package/dist/interface/math/vec4/f32/default.js +4 -0
  749. package/dist/interface/math/vec4/f32/default.js.map +1 -0
  750. package/dist/interface/math/vec4/f32/distance.js.map +1 -1
  751. package/dist/interface/math/vec4/f32/dot.js.map +1 -1
  752. package/dist/interface/math/vec4/f32/exp.js.map +1 -1
  753. package/dist/interface/math/vec4/f32/exp2.js.map +1 -1
  754. package/dist/interface/math/vec4/f32/f32.d.ts +3 -1
  755. package/dist/interface/math/vec4/f32/f32.js.map +1 -1
  756. package/dist/interface/math/vec4/f32/faceforward.js.map +1 -1
  757. package/dist/interface/math/vec4/f32/floor.js.map +1 -1
  758. package/dist/interface/math/vec4/f32/fract.js.map +1 -1
  759. package/dist/interface/math/vec4/f32/length.js.map +1 -1
  760. package/dist/interface/math/vec4/f32/log.js.map +1 -1
  761. package/dist/interface/math/vec4/f32/log2.js.map +1 -1
  762. package/dist/interface/math/vec4/f32/max.js.map +1 -1
  763. package/dist/interface/math/vec4/f32/min.js.map +1 -1
  764. package/dist/interface/math/vec4/f32/mix.js.map +1 -1
  765. package/dist/interface/math/vec4/f32/mod.js.map +1 -1
  766. package/dist/interface/math/vec4/f32/modf.js.map +1 -1
  767. package/dist/interface/math/vec4/f32/multiply.js.map +1 -1
  768. package/dist/interface/math/vec4/f32/negate.js.map +1 -1
  769. package/dist/interface/math/vec4/f32/normalize.js.map +1 -1
  770. package/dist/interface/math/vec4/f32/pow.js.map +1 -1
  771. package/dist/interface/math/vec4/f32/public.d.ts +1 -0
  772. package/dist/interface/math/vec4/f32/public.js +2 -0
  773. package/dist/interface/math/vec4/f32/public.js.map +1 -1
  774. package/dist/interface/math/vec4/f32/reflect.js.map +1 -1
  775. package/dist/interface/math/vec4/f32/refract.js.map +1 -1
  776. package/dist/interface/math/vec4/f32/round.js.map +1 -1
  777. package/dist/interface/math/vec4/f32/scale.js.map +1 -1
  778. package/dist/interface/math/vec4/f32/schema.js.map +1 -1
  779. package/dist/interface/math/vec4/f32/sign.js.map +1 -1
  780. package/dist/interface/math/vec4/f32/sin.js.map +1 -1
  781. package/dist/interface/math/vec4/f32/sinh.js.map +1 -1
  782. package/dist/interface/math/vec4/f32/smoothstep.js.map +1 -1
  783. package/dist/interface/math/vec4/f32/sqrt.js.map +1 -1
  784. package/dist/interface/math/vec4/f32/step.js.map +1 -1
  785. package/dist/interface/math/vec4/f32/subtract.js.map +1 -1
  786. package/dist/interface/math/vec4/f32/tan.js.map +1 -1
  787. package/dist/interface/math/vec4/f32/tanh.js.map +1 -1
  788. package/dist/interface/math/vec4/f32/trunc.js.map +1 -1
  789. package/dist/interface/math/vec4/i32/abs.js.map +1 -1
  790. package/dist/interface/math/vec4/i32/add.js.map +1 -1
  791. package/dist/interface/math/vec4/i32/bitwise-and.js.map +1 -1
  792. package/dist/interface/math/vec4/i32/bitwise-not.js.map +1 -1
  793. package/dist/interface/math/vec4/i32/bitwise-or.js.map +1 -1
  794. package/dist/interface/math/vec4/i32/bitwise-xor.js.map +1 -1
  795. package/dist/interface/math/vec4/i32/clamp.js.map +1 -1
  796. package/dist/interface/math/vec4/i32/count-leading-zeros.js.map +1 -1
  797. package/dist/interface/math/vec4/i32/count-one-bits.js.map +1 -1
  798. package/dist/interface/math/vec4/i32/count-trailing-zeros.js.map +1 -1
  799. package/dist/interface/math/vec4/i32/equals.js.map +1 -1
  800. package/dist/interface/math/vec4/i32/i32.d.ts +3 -1
  801. package/dist/interface/math/vec4/i32/i32.js.map +1 -1
  802. package/dist/interface/math/vec4/i32/max.js.map +1 -1
  803. package/dist/interface/math/vec4/i32/min.js.map +1 -1
  804. package/dist/interface/math/vec4/i32/multiply.js.map +1 -1
  805. package/dist/interface/math/vec4/i32/negate.js.map +1 -1
  806. package/dist/interface/math/vec4/i32/one.js.map +1 -1
  807. package/dist/interface/math/vec4/i32/public.d.ts +1 -0
  808. package/dist/interface/math/vec4/i32/public.js +2 -0
  809. package/dist/interface/math/vec4/i32/public.js.map +1 -1
  810. package/dist/interface/math/vec4/i32/reverse-bits.js.map +1 -1
  811. package/dist/interface/math/vec4/i32/scale.js.map +1 -1
  812. package/dist/interface/math/vec4/i32/schema.js.map +1 -1
  813. package/dist/interface/math/vec4/i32/shift-left.js.map +1 -1
  814. package/dist/interface/math/vec4/i32/shift-right.js.map +1 -1
  815. package/dist/interface/math/vec4/i32/subtract.js.map +1 -1
  816. package/dist/interface/math/vec4/i32/zero.js.map +1 -1
  817. package/dist/interface/math/vec4/index.js.map +1 -1
  818. package/dist/interface/math/vec4/public.d.ts +1 -0
  819. package/dist/interface/math/vec4/public.js +2 -0
  820. package/dist/interface/math/vec4/public.js.map +1 -1
  821. package/dist/interface/math/vec4/u32/add.js.map +1 -1
  822. package/dist/interface/math/vec4/u32/bitwise-and.js.map +1 -1
  823. package/dist/interface/math/vec4/u32/bitwise-not.js.map +1 -1
  824. package/dist/interface/math/vec4/u32/bitwise-or.js.map +1 -1
  825. package/dist/interface/math/vec4/u32/bitwise-xor.js.map +1 -1
  826. package/dist/interface/math/vec4/u32/clamp.js.map +1 -1
  827. package/dist/interface/math/vec4/u32/count-leading-zeros.js.map +1 -1
  828. package/dist/interface/math/vec4/u32/count-one-bits.js.map +1 -1
  829. package/dist/interface/math/vec4/u32/count-trailing-zeros.js.map +1 -1
  830. package/dist/interface/math/vec4/u32/equals.js.map +1 -1
  831. package/dist/interface/math/vec4/u32/max.js.map +1 -1
  832. package/dist/interface/math/vec4/u32/min.js.map +1 -1
  833. package/dist/interface/math/vec4/u32/multiply.js.map +1 -1
  834. package/dist/interface/math/vec4/u32/negate.js.map +1 -1
  835. package/dist/interface/math/vec4/u32/one.js.map +1 -1
  836. package/dist/interface/math/vec4/u32/public.d.ts +1 -0
  837. package/dist/interface/math/vec4/u32/public.js +2 -0
  838. package/dist/interface/math/vec4/u32/public.js.map +1 -1
  839. package/dist/interface/math/vec4/u32/reverse-bits.js.map +1 -1
  840. package/dist/interface/math/vec4/u32/scale.js.map +1 -1
  841. package/dist/interface/math/vec4/u32/schema.js.map +1 -1
  842. package/dist/interface/math/vec4/u32/shift-left.js.map +1 -1
  843. package/dist/interface/math/vec4/u32/shift-right.js.map +1 -1
  844. package/dist/interface/math/vec4/u32/subtract.js.map +1 -1
  845. package/dist/interface/math/vec4/u32/u32.d.ts +3 -1
  846. package/dist/interface/math/vec4/u32/u32.js.map +1 -1
  847. package/dist/interface/math/vec4/u32/zero.js.map +1 -1
  848. package/dist/interface/registry/archetypes.d.ts +25 -3
  849. package/dist/interface/registry/archetypes.js +40 -10
  850. package/dist/interface/registry/archetypes.js.map +1 -1
  851. package/dist/interface/registry/declarations.d.ts +7 -7
  852. package/dist/interface/registry/declarations.js +120 -10
  853. package/dist/interface/registry/declarations.js.map +1 -1
  854. package/dist/interface/registry/finalizer-order.js +3 -3
  855. package/dist/interface/registry/finalizer-order.js.map +1 -1
  856. package/dist/interface/registry/ids.d.ts +23 -0
  857. package/dist/interface/registry/ids.js +42 -0
  858. package/dist/interface/registry/ids.js.map +1 -1
  859. package/dist/interface/registry/index.d.ts +3 -3
  860. package/dist/interface/registry/index.js +3 -3
  861. package/dist/interface/registry/index.js.map +1 -1
  862. package/dist/interface/registry/indexes.js +2 -2
  863. package/dist/interface/registry/indexes.js.map +1 -1
  864. package/dist/interface/registry/items.d.ts +6 -11
  865. package/dist/interface/registry/items.js +14 -43
  866. package/dist/interface/registry/items.js.map +1 -1
  867. package/dist/interface/registry/layout.d.ts +3 -1
  868. package/dist/interface/registry/layout.js +7 -1
  869. package/dist/interface/registry/layout.js.map +1 -1
  870. package/dist/interface/registry/names.d.ts +13 -5
  871. package/dist/interface/registry/names.js +55 -38
  872. package/dist/interface/registry/names.js.map +1 -1
  873. package/dist/interface/registry/program.js.map +1 -1
  874. package/dist/interface/registry/reduction.js.map +1 -1
  875. package/dist/interface/registry/schedule.d.ts +5 -1
  876. package/dist/interface/registry/schedule.js +8 -13
  877. package/dist/interface/registry/schedule.js.map +1 -1
  878. package/dist/interface/registry/schemas.d.ts +9 -0
  879. package/dist/interface/registry/schemas.js +65 -0
  880. package/dist/interface/registry/schemas.js.map +1 -1
  881. package/dist/interface/registry/strata.js +1 -0
  882. package/dist/interface/registry/strata.js.map +1 -1
  883. package/dist/interface/registry/threads.js +3 -2
  884. package/dist/interface/registry/threads.js.map +1 -1
  885. package/dist/interface/registry/traits.js +2 -1
  886. package/dist/interface/registry/traits.js.map +1 -1
  887. package/dist/interface/registry/written.js +1 -0
  888. package/dist/interface/registry/written.js.map +1 -1
  889. package/dist/interface/resource/condition.d.ts +3 -3
  890. package/dist/interface/resource/index.d.ts +0 -2
  891. package/dist/interface/resource/index.js +1 -1
  892. package/dist/interface/resource/index.js.map +1 -1
  893. package/dist/interface/resource/resource.d.ts +4 -1
  894. package/dist/interface/resource/resource.js.map +1 -1
  895. package/dist/interface/resource/types.d.ts +4 -1
  896. package/dist/interface/resource/value.d.ts +5 -5
  897. package/dist/interface/resources/always.js +3 -2
  898. package/dist/interface/resources/always.js.map +1 -1
  899. package/dist/interface/resources/cadence.d.ts +1 -1
  900. package/dist/interface/resources/cadence.js +4 -3
  901. package/dist/interface/resources/cadence.js.map +1 -1
  902. package/dist/interface/resources/clock.js +5 -3
  903. package/dist/interface/resources/clock.js.map +1 -1
  904. package/dist/interface/resources/gpu-device.js +3 -2
  905. package/dist/interface/resources/gpu-device.js.map +1 -1
  906. package/dist/interface/resources/index.js +1 -0
  907. package/dist/interface/resources/index.js.map +1 -1
  908. package/dist/interface/resources/wake.js +3 -2
  909. package/dist/interface/resources/wake.js.map +1 -1
  910. package/dist/interface/resources/workers.js +3 -2
  911. package/dist/interface/resources/workers.js.map +1 -1
  912. package/dist/interface/rule/create.d.ts +6 -2
  913. package/dist/interface/rule/create.js +8 -6
  914. package/dist/interface/rule/create.js.map +1 -1
  915. package/dist/interface/rule/created.d.ts +3 -3
  916. package/dist/interface/rule/declaration.d.ts +8 -3
  917. package/dist/interface/rule/index.js +1 -0
  918. package/dist/interface/rule/index.js.map +1 -1
  919. package/dist/interface/rule/rule.js.map +1 -1
  920. package/dist/interface/schema/is-struct.d.ts +15 -0
  921. package/dist/interface/schema/schema.d.ts +21 -1
  922. package/dist/interface/system/access.d.ts +87 -26
  923. package/dist/interface/system/body.d.ts +53 -26
  924. package/dist/interface/system/check.d.ts +13 -3
  925. package/dist/interface/system/check.js +87 -47
  926. package/dist/interface/system/check.js.map +1 -1
  927. package/dist/interface/system/commands.d.ts +55 -6
  928. package/dist/interface/system/composite-declaration.d.ts +0 -2
  929. package/dist/interface/system/create-resolved.d.ts +9 -0
  930. package/dist/interface/system/create-resolved.js +18 -0
  931. package/dist/interface/system/create-resolved.js.map +1 -0
  932. package/dist/interface/system/create.d.ts +116 -110
  933. package/dist/interface/system/create.js +34 -8
  934. package/dist/interface/system/create.js.map +1 -1
  935. package/dist/interface/system/declaration.d.ts +33 -29
  936. package/dist/interface/system/index.js.map +1 -1
  937. package/dist/interface/system/input.d.ts +37 -6
  938. package/dist/interface/system/leaf.d.ts +10 -3
  939. package/dist/interface/system/name.d.ts +3 -3
  940. package/dist/interface/system/property.js +1 -0
  941. package/dist/interface/system/property.js.map +1 -1
  942. package/dist/interface/system/render.d.ts +35 -16
  943. package/dist/interface/system/render.js +19 -5
  944. package/dist/interface/system/render.js.map +1 -1
  945. package/dist/interface/system/resolve.d.ts +68 -0
  946. package/dist/interface/system/resolve.js +138 -0
  947. package/dist/interface/system/resolve.js.map +1 -0
  948. package/dist/interface/system/struct.d.ts +2 -2
  949. package/dist/interface/system/system.d.ts +5 -3
  950. package/dist/interface/system/system.js.map +1 -1
  951. package/dist/interface/system/threads.d.ts +8 -7
  952. package/dist/interface/system/values-of.d.ts +17 -0
  953. package/dist/interface/system/values-of.js.map +1 -0
  954. package/dist/interface/system/values.d.ts +15 -15
  955. package/dist/interface/thread/of.d.ts +4 -2
  956. package/dist/interface/trait/key.d.ts +1 -1
  957. package/dist/interface/trait/types.d.ts +26 -8
  958. package/dist/interface/world/create.d.ts +9 -7
  959. package/dist/interface/world/declarations.d.ts +37 -0
  960. package/dist/interface/world/declarations.js +2 -0
  961. package/dist/interface/world/declarations.js.map +1 -0
  962. package/dist/interface/world/filter.js +1 -0
  963. package/dist/interface/world/filter.js.map +1 -1
  964. package/dist/interface/world/join.d.ts +3 -5
  965. package/dist/interface/world/world.d.ts +31 -17
  966. package/package.json +18 -5
  967. package/src/exports.test.ts +149 -44
  968. package/src/guide/00-keys.md +34 -0
  969. package/src/guide/00-keys.out +1 -0
  970. package/src/guide/00-keys.ts +35 -0
  971. package/src/guide/00-setup.md +24 -0
  972. package/src/guide/01-resources.md +22 -0
  973. package/src/guide/01-resources.out +2 -0
  974. package/src/guide/01-resources.ts +33 -0
  975. package/src/guide/02-entities.md +19 -0
  976. package/src/guide/02-entities.out +2 -0
  977. package/src/guide/02-entities.ts +43 -0
  978. package/src/guide/03-systems.md +22 -0
  979. package/src/guide/03-systems.out +5 -0
  980. package/src/guide/03-systems.ts +68 -0
  981. package/src/guide/04-ticks.md +18 -0
  982. package/src/guide/04-ticks.out +3 -0
  983. package/src/guide/04-ticks.ts +53 -0
  984. package/src/guide/05-scheduling.md +14 -0
  985. package/src/guide/05-scheduling.out +2 -0
  986. package/src/guide/05-scheduling.ts +46 -0
  987. package/src/guide/06-sync-points.md +14 -0
  988. package/src/guide/06-sync-points.out +3 -0
  989. package/src/guide/06-sync-points.ts +42 -0
  990. package/src/guide/07-change-filters.md +14 -0
  991. package/src/guide/07-change-filters.out +6 -0
  992. package/src/guide/07-change-filters.ts +70 -0
  993. package/src/guide/08-input.md +12 -0
  994. package/src/guide/08-input.out +1 -0
  995. package/src/guide/08-input.ts +45 -0
  996. package/src/guide/09-rules.md +12 -0
  997. package/src/guide/09-rules.out +2 -0
  998. package/src/guide/09-rules.ts +50 -0
  999. package/src/guide/10-finalizers.md +13 -0
  1000. package/src/guide/10-finalizers.out +4 -0
  1001. package/src/guide/10-finalizers.ts +48 -0
  1002. package/src/guide/11-traits.md +16 -0
  1003. package/src/guide/11-traits.out +2 -0
  1004. package/src/guide/11-traits.ts +51 -0
  1005. package/src/guide/11-traits.type-test.ts +12 -14
  1006. package/src/guide/12-lookups.md +14 -0
  1007. package/src/guide/12-lookups.out +3 -0
  1008. package/src/guide/12-lookups.ts +59 -0
  1009. package/src/guide/13-indexes.md +21 -0
  1010. package/src/guide/13-indexes.out +8 -0
  1011. package/src/guide/13-indexes.ts +73 -0
  1012. package/src/guide/14-kernels.md +15 -0
  1013. package/src/guide/14-kernels.out +1 -0
  1014. package/src/guide/14-kernels.ts +48 -0
  1015. package/src/guide/15-reductions.md +12 -0
  1016. package/src/guide/15-reductions.out +1 -0
  1017. package/src/guide/15-reductions.ts +38 -0
  1018. package/src/guide/16-gpu.md +18 -0
  1019. package/src/guide/16-gpu.out +3 -0
  1020. package/src/guide/16-gpu.ts +51 -0
  1021. package/src/guide/17-hierarchies.md +11 -0
  1022. package/src/guide/17-hierarchies.out +1 -0
  1023. package/src/guide/17-hierarchies.ts +40 -0
  1024. package/src/guide/18-identity.md +10 -0
  1025. package/src/guide/18-identity.out +1 -0
  1026. package/src/guide/18-identity.ts +11 -0
  1027. package/src/guide/19-threads.md +16 -0
  1028. package/src/guide/19-threads.out +2 -0
  1029. package/src/guide/19-threads.ts +65 -0
  1030. package/src/guide/20-shared.md +29 -0
  1031. package/src/guide/20-shared.out +4 -0
  1032. package/src/guide/20-shared.ts +118 -0
  1033. package/src/guide/21-dom.md +22 -0
  1034. package/src/guide/21-dom.out +5 -0
  1035. package/src/guide/21-dom.ts +117 -0
  1036. package/src/guide/22-canvas.md +15 -0
  1037. package/src/guide/22-canvas.out +3 -0
  1038. package/src/guide/22-canvas.ts +119 -0
  1039. package/src/guide/CLAUDE.md +40 -25
  1040. package/src/guide/README.md +42 -0
  1041. package/src/guide/guide.test.ts +215 -0
  1042. package/src/implementation/compiler/access.ts +10 -4
  1043. package/src/implementation/compiler/archetypes.test.ts +64 -0
  1044. package/src/implementation/compiler/archetypes.ts +134 -0
  1045. package/src/implementation/compiler/assign.ts +1 -0
  1046. package/src/implementation/compiler/augmentations.test.ts +418 -0
  1047. package/src/implementation/compiler/augmentations.ts +871 -0
  1048. package/src/implementation/compiler/bind.ts +6 -4
  1049. package/src/implementation/compiler/body-access.ts +135 -33
  1050. package/src/implementation/compiler/booleans.ts +1 -0
  1051. package/src/implementation/compiler/branches.ts +1 -0
  1052. package/src/implementation/compiler/calls.ts +14 -3
  1053. package/src/implementation/compiler/columns.ts +21 -5
  1054. package/src/implementation/compiler/compile-kernel.ts +88 -23
  1055. package/src/implementation/compiler/compiler.ts +9 -0
  1056. package/src/implementation/compiler/data.ts +1 -0
  1057. package/src/implementation/compiler/describe.test-helper.ts +97 -0
  1058. package/src/implementation/compiler/describe.test.ts +168 -0
  1059. package/src/implementation/compiler/describe.ts +489 -0
  1060. package/src/implementation/compiler/estree.ts +1 -0
  1061. package/src/implementation/compiler/expression.ts +24 -2
  1062. package/src/implementation/compiler/failure.ts +1 -0
  1063. package/src/implementation/compiler/hygiene.test.ts +4 -11
  1064. package/src/implementation/compiler/identify.test.ts +100 -46
  1065. package/src/implementation/compiler/identify.ts +89 -32
  1066. package/src/implementation/compiler/index.ts +6 -1
  1067. package/src/implementation/compiler/inferred.test.ts +32 -0
  1068. package/src/implementation/compiler/inferred.ts +197 -0
  1069. package/src/implementation/compiler/inline-kernels.test.ts +10 -0
  1070. package/src/implementation/compiler/inline-kernels.ts +21 -0
  1071. package/src/implementation/compiler/input-schemas.test.ts +182 -0
  1072. package/src/implementation/compiler/input-schemas.ts +107 -0
  1073. package/src/implementation/compiler/ir.ts +7 -2
  1074. package/src/implementation/compiler/kernel-id.ts +1 -0
  1075. package/src/implementation/compiler/key.ts +1 -0
  1076. package/src/implementation/compiler/link.test.ts +3 -0
  1077. package/src/implementation/compiler/link.ts +29 -0
  1078. package/src/implementation/compiler/lists.ts +41 -13
  1079. package/src/implementation/compiler/lookups.ts +1 -0
  1080. package/src/implementation/compiler/math.ts +1 -0
  1081. package/src/implementation/compiler/memory-compiler.browser.test.ts +85 -0
  1082. package/src/implementation/compiler/memory-compiler.test.ts +147 -0
  1083. package/src/implementation/compiler/memory-compiler.ts +307 -0
  1084. package/src/implementation/compiler/module-scope.ts +1 -0
  1085. package/src/implementation/compiler/module-value.ts +18 -3
  1086. package/src/implementation/compiler/out.ts +1 -0
  1087. package/src/implementation/compiler/oxc.test-helper.ts +20 -0
  1088. package/src/implementation/compiler/oxc.test.ts +69 -0
  1089. package/src/implementation/compiler/oxc.ts +90 -0
  1090. package/src/implementation/compiler/package-copies.ts +208 -0
  1091. package/src/implementation/compiler/passes.ts +34 -0
  1092. package/src/implementation/compiler/paths.ts +19 -38
  1093. package/src/implementation/compiler/plugin.test.ts +373 -62
  1094. package/src/implementation/compiler/plugin.ts +199 -38
  1095. package/src/implementation/compiler/posix.test.ts +34 -0
  1096. package/src/implementation/compiler/posix.ts +183 -0
  1097. package/src/implementation/compiler/predicates.test.ts +90 -0
  1098. package/src/implementation/compiler/predicates.ts +250 -0
  1099. package/src/implementation/compiler/print.ts +26 -6
  1100. package/src/implementation/compiler/program.ts +4 -1
  1101. package/src/implementation/compiler/public.ts +2 -0
  1102. package/src/implementation/compiler/scalar.ts +1 -0
  1103. package/src/implementation/compiler/scope.ts +1 -0
  1104. package/src/implementation/compiler/serialize.ts +1 -0
  1105. package/src/implementation/compiler/shared-kernels.test.ts +57 -0
  1106. package/src/implementation/compiler/signature.ts +70 -30
  1107. package/src/implementation/compiler/snapshot.ts +5 -2
  1108. package/src/implementation/compiler/source-map.test.ts +1 -0
  1109. package/src/implementation/compiler/source-map.ts +1 -0
  1110. package/src/implementation/compiler/spawns.ts +62 -5
  1111. package/src/implementation/compiler/stamps.ts +30 -8
  1112. package/src/implementation/compiler/statement.ts +1 -0
  1113. package/src/implementation/compiler/subset.md +4 -3
  1114. package/src/implementation/compiler/terminal.ts +1 -0
  1115. package/src/implementation/compiler/transform.test.ts +371 -258
  1116. package/src/implementation/compiler/transform.ts +321 -62
  1117. package/src/implementation/compiler/type-host.test-helper.ts +27 -0
  1118. package/src/implementation/compiler/type-schemas.ts +714 -0
  1119. package/src/implementation/compiler/unit.ts +22 -4
  1120. package/src/implementation/compiler/value.ts +1 -0
  1121. package/src/implementation/compiler/wat.test.ts +135 -0
  1122. package/src/implementation/compiler/wat.ts +365 -0
  1123. package/src/implementation/index.ts +1 -0
  1124. package/src/implementation/world/activate.ts +10 -3
  1125. package/src/implementation/world/archetype.ts +133 -19
  1126. package/src/implementation/world/arrays.test.ts +1 -0
  1127. package/src/implementation/world/arrays.ts +6 -1
  1128. package/src/implementation/world/arrivals.test.ts +89 -0
  1129. package/src/implementation/world/arrivals.ts +165 -0
  1130. package/src/implementation/world/async-loading.test.ts +13 -28
  1131. package/src/implementation/world/attach-kernel.test.ts +10 -2
  1132. package/src/implementation/world/attach-kernel.ts +14 -7
  1133. package/src/implementation/world/batches.test.ts +14 -17
  1134. package/src/implementation/world/batches.ts +67 -8
  1135. package/src/implementation/world/buffer.ts +35 -4
  1136. package/src/implementation/world/builtins.test.ts +5 -10
  1137. package/src/implementation/world/cascade.ts +2 -1
  1138. package/src/implementation/world/cells.ts +1 -0
  1139. package/src/implementation/world/change-blocks.browser.test.ts +76 -0
  1140. package/src/implementation/world/change-blocks.cases.ts +14 -0
  1141. package/src/implementation/world/change-blocks.fixture.ts +70 -0
  1142. package/src/implementation/world/change-blocks.test.ts +264 -0
  1143. package/src/implementation/world/changes-finalizers.test.ts +6 -8
  1144. package/src/implementation/world/check-kernel.ts +46 -32
  1145. package/src/implementation/world/claims.test.ts +1 -0
  1146. package/src/implementation/world/claims.ts +1 -0
  1147. package/src/implementation/world/closure.test.ts +1 -0
  1148. package/src/implementation/world/closure.ts +1 -0
  1149. package/src/implementation/world/command-ring.ts +2 -1
  1150. package/src/implementation/world/command-rings.cases.ts +5 -2
  1151. package/src/implementation/world/command-rings.fixture.ts +27 -36
  1152. package/src/implementation/world/commands.test.ts +84 -43
  1153. package/src/implementation/world/commands.ts +26 -4
  1154. package/src/implementation/world/composite-input.test.ts +17 -15
  1155. package/src/implementation/world/conditions.test.ts +17 -28
  1156. package/src/implementation/world/constant-unions.test.ts +43 -0
  1157. package/src/implementation/world/create.test.ts +50 -71
  1158. package/src/implementation/world/create.ts +489 -253
  1159. package/src/implementation/world/defaults.test.ts +86 -0
  1160. package/src/implementation/world/directories.ts +2 -1
  1161. package/src/implementation/world/directory.test.ts +2 -3
  1162. package/src/implementation/world/dispatch.cases.ts +1 -0
  1163. package/src/implementation/world/dispatch.fixture.ts +16 -25
  1164. package/src/implementation/world/entities.ts +1 -0
  1165. package/src/implementation/world/entity-lookup-workers.cases.ts +1 -0
  1166. package/src/implementation/world/entity-lookup-workers.fixture.ts +9 -16
  1167. package/src/implementation/world/entity-lookups.browser.test.ts +8 -14
  1168. package/src/implementation/world/entity-lookups.test-helper.ts +28 -34
  1169. package/src/implementation/world/entity-lookups.test.ts +9 -16
  1170. package/src/implementation/world/execute.ts +232 -96
  1171. package/src/implementation/world/failing-worker.fixture.ts +3 -0
  1172. package/src/implementation/world/failures.ts +64 -7
  1173. package/src/implementation/world/finalizers.test.ts +33 -49
  1174. package/src/implementation/world/finalizers.ts +49 -17
  1175. package/src/implementation/world/fixtures.test-helper.ts +1 -0
  1176. package/src/implementation/world/generated-code.md +10 -6
  1177. package/src/implementation/world/gpu.browser.test.ts +100 -92
  1178. package/src/implementation/world/gpu.test-helper.ts +12 -0
  1179. package/src/implementation/world/gpu.ts +26 -14
  1180. package/src/implementation/world/holders.ts +1 -0
  1181. package/src/implementation/world/ids-changes.test-helper.ts +4 -0
  1182. package/src/implementation/world/ids-keys.test-helper.ts +21 -0
  1183. package/src/implementation/world/ids.test.ts +12 -49
  1184. package/src/implementation/world/imported-lists.test-helper.ts +2 -6
  1185. package/src/implementation/world/imported-lists.test.ts +4 -5
  1186. package/src/implementation/world/index-buckets.test.ts +276 -0
  1187. package/src/implementation/world/index-build-csp.test.ts +8 -9
  1188. package/src/implementation/world/index-build.cases.ts +1 -0
  1189. package/src/implementation/world/index-build.fixture.ts +12 -15
  1190. package/src/implementation/world/index-build.ts +1 -0
  1191. package/src/implementation/world/index-changed.test.ts +27 -34
  1192. package/src/implementation/world/index-hash.test.ts +34 -0
  1193. package/src/implementation/world/index-hash.ts +454 -74
  1194. package/src/implementation/world/index-joined.test.ts +232 -74
  1195. package/src/implementation/world/index-kernels.test.ts +26 -35
  1196. package/src/implementation/world/index-keyless.test.ts +21 -28
  1197. package/src/implementation/world/index-keys.ts +1 -0
  1198. package/src/implementation/world/index-lookups-csp.test.ts +5 -6
  1199. package/src/implementation/world/index-lookups.ts +28 -22
  1200. package/src/implementation/world/index-order.test.ts +13 -17
  1201. package/src/implementation/world/index-order.ts +1 -0
  1202. package/src/implementation/world/index-readers.ts +1 -0
  1203. package/src/implementation/world/index-sorted.test.ts +1 -0
  1204. package/src/implementation/world/index-sorted.ts +10 -5
  1205. package/src/implementation/world/index-workers.cases.ts +10 -0
  1206. package/src/implementation/world/index-workers.fixture.ts +98 -39
  1207. package/src/implementation/world/indexes.test.ts +62 -74
  1208. package/src/implementation/world/indexes.ts +62 -108
  1209. package/src/implementation/world/input.ts +2 -1
  1210. package/src/implementation/world/intrinsics-coverage.test.ts +1 -0
  1211. package/src/implementation/world/intrinsics.browser.test.ts +22 -62
  1212. package/src/implementation/world/intrinsics.ts +1 -0
  1213. package/src/implementation/world/join.test.ts +182 -43
  1214. package/src/implementation/world/join.ts +112 -59
  1215. package/src/implementation/world/join.type-test.ts +7 -5
  1216. package/src/implementation/world/joined-observer.test.ts +58 -0
  1217. package/src/implementation/world/joined-observer.ts +85 -19
  1218. package/src/implementation/world/joining-worker.fixture.ts +51 -11
  1219. package/src/implementation/world/joining.cases.ts +43 -7
  1220. package/src/implementation/world/joining.fixture.ts +114 -14
  1221. package/src/implementation/world/joining.test-helper.ts +25 -27
  1222. package/src/implementation/world/joining.ts +85 -7
  1223. package/src/implementation/world/journal.ts +8 -4
  1224. package/src/implementation/world/kernel-imports-sparks.test-helper.ts +3 -4
  1225. package/src/implementation/world/kernel-imports-steer.test-helper.ts +1 -0
  1226. package/src/implementation/world/kernel-imports.test.ts +10 -12
  1227. package/src/implementation/world/kernel-indexes.ts +12 -3
  1228. package/src/implementation/world/kernel-lookup.test-helper.ts +6 -10
  1229. package/src/implementation/world/kernel-path.test-helper.ts +2 -4
  1230. package/src/implementation/world/kernel-spawns.test.ts +17 -28
  1231. package/src/implementation/world/kernel-tried.test-helper.ts +31 -0
  1232. package/src/implementation/world/kernel.ts +30 -6
  1233. package/src/implementation/world/kernels-csp.test.ts +5 -5
  1234. package/src/implementation/world/kernels.test.ts +18 -14
  1235. package/src/implementation/world/kernels.ts +82 -13
  1236. package/src/implementation/world/layout-directory.browser.test.ts +18 -28
  1237. package/src/implementation/world/layout-directory.cases.ts +1 -0
  1238. package/src/implementation/world/layout-directory.fixture.ts +18 -28
  1239. package/src/implementation/world/layout-directory.ts +69 -17
  1240. package/src/implementation/world/lifetime.cases.ts +2 -1
  1241. package/src/implementation/world/lifetime.fixture.ts +12 -21
  1242. package/src/implementation/world/lifetime.test-helper.ts +2 -1
  1243. package/src/implementation/world/lifetime.test.ts +7 -14
  1244. package/src/implementation/world/lists.ts +179 -28
  1245. package/src/implementation/world/lookup-keys.ts +10 -9
  1246. package/src/implementation/world/loop.test.ts +19 -8
  1247. package/src/implementation/world/loop.ts +4 -4
  1248. package/src/implementation/world/memory.test.ts +1 -0
  1249. package/src/implementation/world/memory.ts +1 -0
  1250. package/src/implementation/world/mirror.ts +45 -10
  1251. package/src/implementation/world/move-log.test.ts +114 -11
  1252. package/src/implementation/world/move-log.ts +1 -0
  1253. package/src/implementation/world/names.test.ts +31 -31
  1254. package/src/implementation/world/observe-cases.browser.test.ts +11 -11
  1255. package/src/implementation/world/observe-cases.test.ts +49 -95
  1256. package/src/implementation/world/observe-factories.test.ts +17 -19
  1257. package/src/implementation/world/observe-joined-cases.test.ts +34 -45
  1258. package/src/implementation/world/observe-ticks-cases.test.ts +33 -35
  1259. package/src/implementation/world/observe.test-helper.ts +2 -1
  1260. package/src/implementation/world/observed-workers.cases.ts +1 -0
  1261. package/src/implementation/world/observed-workers.fixture.ts +7 -8
  1262. package/src/implementation/world/observer-contained-worker.fixture.ts +4 -3
  1263. package/src/implementation/world/observer-contained.browser.test.ts +1 -0
  1264. package/src/implementation/world/observer-contained.cases.ts +1 -0
  1265. package/src/implementation/world/observer-contained.fixture.ts +3 -7
  1266. package/src/implementation/world/observer-contained.test-helper.ts +7 -8
  1267. package/src/implementation/world/observer-contained.test.ts +11 -19
  1268. package/src/implementation/world/observer-joined-worker.fixture.ts +2 -1
  1269. package/src/implementation/world/observer-joined.cases.ts +1 -0
  1270. package/src/implementation/world/observer-joined.fixture.ts +8 -6
  1271. package/src/implementation/world/observer-joined.test-helper.ts +25 -34
  1272. package/src/implementation/world/observer-joined.test.ts +78 -62
  1273. package/src/implementation/world/observer.browser.test.ts +13 -13
  1274. package/src/implementation/world/observer.test.ts +34 -44
  1275. package/src/implementation/world/observer.ts +3 -3
  1276. package/src/implementation/world/optional-workers.cases.ts +19 -0
  1277. package/src/implementation/world/optional-workers.fixture.ts +55 -0
  1278. package/src/implementation/world/optional.test.ts +351 -0
  1279. package/src/implementation/world/order.ts +1 -0
  1280. package/src/implementation/world/out-of-band.ts +61 -0
  1281. package/src/implementation/world/outcomes.test-helper.ts +138 -0
  1282. package/src/implementation/world/package-id.test-helper.ts +9 -0
  1283. package/src/implementation/world/perf.md +124 -4
  1284. package/src/implementation/world/plan.ts +1 -0
  1285. package/src/implementation/world/platforms.test-helper.ts +1 -0
  1286. package/src/implementation/world/pool-size.cases.ts +21 -1
  1287. package/src/implementation/world/pool-size.fixture.ts +98 -6
  1288. package/src/implementation/world/pool.cases.ts +1 -0
  1289. package/src/implementation/world/pool.fixture.ts +1 -0
  1290. package/src/implementation/world/pool.ts +1 -0
  1291. package/src/implementation/world/port.test.ts +45 -0
  1292. package/src/implementation/world/port.ts +18 -11
  1293. package/src/implementation/world/ports.cases.ts +2 -2
  1294. package/src/implementation/world/ports.fixture.ts +4 -5
  1295. package/src/implementation/world/ports.type-test.ts +1 -0
  1296. package/src/implementation/world/precision.test.ts +174 -0
  1297. package/src/implementation/world/prepared-lookup.ts +1 -0
  1298. package/src/implementation/world/prepared-spawn.ts +14 -10
  1299. package/src/implementation/world/program.ts +1 -0
  1300. package/src/implementation/world/protocol.ts +9 -2
  1301. package/src/implementation/world/publish.ts +1 -0
  1302. package/src/implementation/world/ranges.test.ts +66 -0
  1303. package/src/implementation/world/ranges.ts +98 -32
  1304. package/src/implementation/world/reads.test-helper.ts +7 -6
  1305. package/src/implementation/world/reclaim.test.ts +214 -0
  1306. package/src/implementation/world/reclaim.ts +170 -0
  1307. package/src/implementation/world/reductions.cases.ts +1 -0
  1308. package/src/implementation/world/reductions.fixture.ts +5 -10
  1309. package/src/implementation/world/reductions.test.ts +36 -49
  1310. package/src/implementation/world/reductions.ts +14 -12
  1311. package/src/implementation/world/reevaluation.test-helper.ts +3 -3
  1312. package/src/implementation/world/reevaluation.test.ts +9 -8
  1313. package/src/implementation/world/register.ts +3 -2
  1314. package/src/implementation/world/remote-finalizers-worker.fixture.ts +25 -10
  1315. package/src/implementation/world/remote-finalizers.cases.ts +19 -1
  1316. package/src/implementation/world/remote-finalizers.fixture.ts +86 -11
  1317. package/src/implementation/world/remote-finalizers.test-helper.ts +119 -27
  1318. package/src/implementation/world/remote-finalizers.test.ts +86 -20
  1319. package/src/implementation/world/remote-objects-worker.fixture.ts +2 -1
  1320. package/src/implementation/world/remote-objects.cases.ts +1 -0
  1321. package/src/implementation/world/remote-objects.fixture.ts +3 -1
  1322. package/src/implementation/world/remote-objects.test-helper.ts +9 -10
  1323. package/src/implementation/world/remote-systems.ts +42 -28
  1324. package/src/implementation/world/remote.test.ts +46 -48
  1325. package/src/implementation/world/remote.ts +1 -0
  1326. package/src/implementation/world/removal-worker.fixture.ts +3 -2
  1327. package/src/implementation/world/removal.cases.ts +1 -0
  1328. package/src/implementation/world/removal.fixture.ts +3 -2
  1329. package/src/implementation/world/remove-joined.test.ts +4 -3
  1330. package/src/implementation/world/remove.test-helper.ts +11 -13
  1331. package/src/implementation/world/remove.test.ts +14 -17
  1332. package/src/implementation/world/render-order.browser.test.ts +209 -0
  1333. package/src/implementation/world/render-order.ts +150 -0
  1334. package/src/implementation/world/required.ts +10 -0
  1335. package/src/implementation/world/resources.ts +7 -3
  1336. package/src/implementation/world/rows.test.ts +8 -11
  1337. package/src/implementation/world/rows.ts +99 -30
  1338. package/src/implementation/world/rules.test.ts +38 -39
  1339. package/src/implementation/world/run-results.test.ts +374 -0
  1340. package/src/implementation/world/runner.ts +379 -73
  1341. package/src/implementation/world/schedule.test.ts +65 -67
  1342. package/src/implementation/world/semantics.test.ts +11 -16
  1343. package/src/implementation/world/share.test.ts +4 -3
  1344. package/src/implementation/world/shared-gpu.browser.test.ts +109 -0
  1345. package/src/implementation/world/shared-kernels.test.ts +117 -0
  1346. package/src/implementation/world/shared-workers.cases.ts +20 -0
  1347. package/src/implementation/world/shared-workers.fixture.ts +74 -0
  1348. package/src/implementation/world/shared.test.ts +348 -0
  1349. package/src/implementation/world/shared.ts +316 -0
  1350. package/src/implementation/world/sharing.ts +96 -32
  1351. package/src/implementation/world/staging.ts +53 -10
  1352. package/src/implementation/world/state.ts +180 -23
  1353. package/src/implementation/world/stop-lists.ts +78 -9
  1354. package/src/implementation/world/strings.test.ts +23 -34
  1355. package/src/implementation/world/strings.ts +1 -0
  1356. package/src/implementation/world/structure.ts +6 -2
  1357. package/src/implementation/world/synchronize.test.ts +1 -0
  1358. package/src/implementation/world/synchronize.ts +60 -17
  1359. package/src/implementation/world/tail-blocks.ts +9 -4
  1360. package/src/implementation/world/tails-worker.fixture.ts +9 -13
  1361. package/src/implementation/world/tails.cases.ts +3 -2
  1362. package/src/implementation/world/tails.fixture.ts +5 -2
  1363. package/src/implementation/world/tails.test-helper.ts +48 -41
  1364. package/src/implementation/world/tails.test.ts +24 -29
  1365. package/src/implementation/world/tails.ts +35 -22
  1366. package/src/implementation/world/target.test.ts +10 -13
  1367. package/src/implementation/world/terminal.ts +1 -0
  1368. package/src/implementation/world/thread-directory.ts +85 -16
  1369. package/src/implementation/world/thread-finalizers.ts +128 -22
  1370. package/src/implementation/world/thread-indexes.ts +5 -3
  1371. package/src/implementation/world/thread-observer.ts +60 -13
  1372. package/src/implementation/world/thread-systems-worker.fixture.ts +5 -6
  1373. package/src/implementation/world/thread-systems.cases.ts +15 -2
  1374. package/src/implementation/world/thread-systems.fixture.ts +41 -12
  1375. package/src/implementation/world/thread-systems.test-helper.ts +57 -52
  1376. package/src/implementation/world/thread-systems.test.ts +51 -26
  1377. package/src/implementation/world/thread-systems.ts +398 -84
  1378. package/src/implementation/world/thread-tasks.ts +9 -4
  1379. package/src/implementation/world/threads.browser.test.ts +5 -0
  1380. package/src/implementation/world/threads.test.ts +10 -0
  1381. package/src/implementation/world/ticks.browser.test.ts +3 -4
  1382. package/src/implementation/world/ticks.test.ts +5 -5
  1383. package/src/implementation/world/traits.test.ts +4 -8
  1384. package/src/implementation/world/transfers-worker.fixture.ts +17 -12
  1385. package/src/implementation/world/transfers.cases.ts +1 -0
  1386. package/src/implementation/world/transfers.fixture.ts +18 -25
  1387. package/src/implementation/world/transfers.test-helper.ts +18 -28
  1388. package/src/implementation/world/transfers.test.ts +19 -23
  1389. package/src/implementation/world/transfers.ts +1 -0
  1390. package/src/implementation/world/unidentified-finalizers.test.ts +58 -0
  1391. package/src/implementation/world/up-tree.test.ts +181 -21
  1392. package/src/implementation/world/up-workers.cases.ts +1 -0
  1393. package/src/implementation/world/up-workers.fixture.ts +6 -10
  1394. package/src/implementation/world/up.browser.test.ts +9 -12
  1395. package/src/implementation/world/up.test.ts +56 -42
  1396. package/src/implementation/world/up.ts +299 -71
  1397. package/src/implementation/world/wasm-kernels.test.ts +55 -49
  1398. package/src/implementation/world/wasm.test.ts +200 -22
  1399. package/src/implementation/world/wasm.ts +399 -127
  1400. package/src/implementation/world/wgsl.test.ts +1 -0
  1401. package/src/implementation/world/wgsl.ts +22 -5
  1402. package/src/implementation/world/where.test.ts +342 -0
  1403. package/src/implementation/world/where.ts +236 -0
  1404. package/src/implementation/world/worker-platform.ts +1 -0
  1405. package/src/implementation/world/worker-window.test.ts +43 -0
  1406. package/src/implementation/world/worker-window.ts +43 -0
  1407. package/src/implementation/world/worker.ts +47 -59
  1408. package/src/implementation/world/workers-follow.test.ts +51 -0
  1409. package/src/implementation/world/workers.cases.ts +1 -0
  1410. package/src/implementation/world/workers.fixture.ts +31 -54
  1411. package/src/implementation/world/world-host.fixture.ts +1 -0
  1412. package/src/index.ts +29 -1
  1413. package/src/interface/CLAUDE.md +1 -1
  1414. package/src/interface/component/component.ts +8 -1
  1415. package/src/interface/component/index.ts +2 -2
  1416. package/src/interface/component/key.ts +1 -0
  1417. package/src/interface/component/key.type-test.ts +1 -2
  1418. package/src/interface/component/register.test.ts +27 -34
  1419. package/src/interface/component/types.ts +3 -2
  1420. package/src/interface/component/value.ts +14 -7
  1421. package/src/interface/component/values.ts +3 -2
  1422. package/src/interface/entity/entity.ts +1 -0
  1423. package/src/interface/entity/index.ts +4 -0
  1424. package/src/interface/finalizer/body.ts +15 -14
  1425. package/src/interface/finalizer/create.test.ts +67 -72
  1426. package/src/interface/finalizer/create.ts +52 -22
  1427. package/src/interface/finalizer/created.ts +6 -5
  1428. package/src/interface/finalizer/declaration.ts +28 -9
  1429. package/src/interface/finalizer/finalizer.ts +3 -2
  1430. package/src/interface/finalizer/index.ts +1 -0
  1431. package/src/interface/gpu/accessors.ts +26 -8
  1432. package/src/interface/gpu/gpu.ts +1 -0
  1433. package/src/interface/gpu/gpu.type-test.ts +2 -2
  1434. package/src/interface/gpu/index.ts +1 -0
  1435. package/src/interface/gpu/layout.ts +1 -0
  1436. package/src/interface/gpu/record.ts +1 -0
  1437. package/src/interface/gpu/wgsl.ts +9 -6
  1438. package/src/interface/index.ts +1 -3
  1439. package/src/interface/index.type-test.ts +12 -15
  1440. package/src/interface/indexes/create.test.ts +44 -43
  1441. package/src/interface/indexes/create.ts +24 -16
  1442. package/src/interface/indexes/created.ts +3 -2
  1443. package/src/interface/indexes/declaration.ts +7 -3
  1444. package/src/interface/indexes/index-type.ts +4 -3
  1445. package/src/interface/indexes/index.ts +1 -0
  1446. package/src/interface/indexes/index.type-test.ts +45 -94
  1447. package/src/interface/math/f32/default.ts +6 -0
  1448. package/src/interface/math/f32/index.ts +5 -1
  1449. package/src/interface/math/f32/public.ts +2 -0
  1450. package/src/interface/math/f32/round-half-even.ts +1 -0
  1451. package/src/interface/math/f32/schema.ts +1 -0
  1452. package/src/interface/math/i32/default.ts +6 -0
  1453. package/src/interface/math/i32/index.ts +5 -1
  1454. package/src/interface/math/i32/public.ts +2 -0
  1455. package/src/interface/math/i32/schema.ts +1 -0
  1456. package/src/interface/math/i32/shift-right.ts +1 -0
  1457. package/src/interface/math/index.ts +1 -0
  1458. package/src/interface/math/intrinsic.ts +1 -0
  1459. package/src/interface/math/mat4x4/add.ts +1 -0
  1460. package/src/interface/math/mat4x4/determinant.ts +1 -0
  1461. package/src/interface/math/mat4x4/identity.ts +1 -0
  1462. package/src/interface/math/mat4x4/index.ts +4 -1
  1463. package/src/interface/math/mat4x4/inverse.ts +1 -0
  1464. package/src/interface/math/mat4x4/look-at.test.ts +1 -0
  1465. package/src/interface/math/mat4x4/look-at.ts +1 -0
  1466. package/src/interface/math/mat4x4/multiply-vec3.ts +1 -0
  1467. package/src/interface/math/mat4x4/multiply-vec4.ts +1 -0
  1468. package/src/interface/math/mat4x4/multiply.ts +1 -0
  1469. package/src/interface/math/mat4x4/orthographic.ts +1 -0
  1470. package/src/interface/math/mat4x4/perspective.ts +1 -0
  1471. package/src/interface/math/mat4x4/public.ts +2 -0
  1472. package/src/interface/math/mat4x4/rotation-x.ts +1 -0
  1473. package/src/interface/math/mat4x4/rotation-y.ts +1 -0
  1474. package/src/interface/math/mat4x4/rotation-z.ts +1 -0
  1475. package/src/interface/math/mat4x4/rotation.test.ts +1 -0
  1476. package/src/interface/math/mat4x4/scale.ts +1 -0
  1477. package/src/interface/math/mat4x4/scaling.ts +1 -0
  1478. package/src/interface/math/mat4x4/schema.ts +1 -0
  1479. package/src/interface/math/mat4x4/subtract.ts +1 -0
  1480. package/src/interface/math/mat4x4/translation.ts +1 -0
  1481. package/src/interface/math/mat4x4/transpose.ts +1 -0
  1482. package/src/interface/math/mat4x4/zero.ts +1 -0
  1483. package/src/interface/math/math.type-test.ts +24 -1
  1484. package/src/interface/math/quat/add.ts +1 -0
  1485. package/src/interface/math/quat/align-to.ts +1 -0
  1486. package/src/interface/math/quat/conjugate.ts +1 -0
  1487. package/src/interface/math/quat/distance.ts +1 -0
  1488. package/src/interface/math/quat/dot.ts +1 -0
  1489. package/src/interface/math/quat/from-axis-angle.ts +1 -0
  1490. package/src/interface/math/quat/from-euler.ts +1 -0
  1491. package/src/interface/math/quat/identity.ts +1 -0
  1492. package/src/interface/math/quat/index.ts +5 -1
  1493. package/src/interface/math/quat/inverse.ts +1 -0
  1494. package/src/interface/math/quat/length-squared.ts +1 -0
  1495. package/src/interface/math/quat/length.ts +1 -0
  1496. package/src/interface/math/quat/lerp.ts +1 -0
  1497. package/src/interface/math/quat/look-at.ts +1 -0
  1498. package/src/interface/math/quat/multiply.ts +1 -0
  1499. package/src/interface/math/quat/negate.ts +1 -0
  1500. package/src/interface/math/quat/normalize.ts +1 -0
  1501. package/src/interface/math/quat/public.ts +2 -0
  1502. package/src/interface/math/quat/rotate-vec3.ts +1 -0
  1503. package/src/interface/math/quat/scale.ts +1 -0
  1504. package/src/interface/math/quat/schema.ts +1 -0
  1505. package/src/interface/math/quat/slerp.ts +1 -0
  1506. package/src/interface/math/quat/subtract.ts +1 -0
  1507. package/src/interface/math/quat/to-axis-angle.ts +1 -0
  1508. package/src/interface/math/quat/to-euler.ts +1 -0
  1509. package/src/interface/math/quat/to-mat4.ts +1 -0
  1510. package/src/interface/math/semantics.test.ts +1 -0
  1511. package/src/interface/math/u32/count-leading-zeros.ts +1 -0
  1512. package/src/interface/math/u32/count-one-bits.ts +1 -0
  1513. package/src/interface/math/u32/count-trailing-zeros.ts +1 -0
  1514. package/src/interface/math/u32/default.ts +6 -0
  1515. package/src/interface/math/u32/index.ts +5 -1
  1516. package/src/interface/math/u32/public.ts +2 -0
  1517. package/src/interface/math/u32/reverse-bits.ts +1 -0
  1518. package/src/interface/math/u32/schema.ts +1 -0
  1519. package/src/interface/math/u32/shift-right.ts +1 -0
  1520. package/src/interface/math/vec2/f32/abs.ts +1 -0
  1521. package/src/interface/math/vec2/f32/acos.ts +1 -0
  1522. package/src/interface/math/vec2/f32/acosh.ts +1 -0
  1523. package/src/interface/math/vec2/f32/add.ts +1 -0
  1524. package/src/interface/math/vec2/f32/asin.ts +1 -0
  1525. package/src/interface/math/vec2/f32/asinh.ts +1 -0
  1526. package/src/interface/math/vec2/f32/atan.ts +1 -0
  1527. package/src/interface/math/vec2/f32/atanh.ts +1 -0
  1528. package/src/interface/math/vec2/f32/ceil.ts +1 -0
  1529. package/src/interface/math/vec2/f32/clamp.ts +1 -0
  1530. package/src/interface/math/vec2/f32/cos.ts +1 -0
  1531. package/src/interface/math/vec2/f32/cosh.ts +1 -0
  1532. package/src/interface/math/vec2/f32/distance.ts +1 -0
  1533. package/src/interface/math/vec2/f32/dot.ts +1 -0
  1534. package/src/interface/math/vec2/f32/equals.ts +1 -0
  1535. package/src/interface/math/vec2/f32/exp.ts +1 -0
  1536. package/src/interface/math/vec2/f32/exp2.ts +1 -0
  1537. package/src/interface/math/vec2/f32/f32.ts +5 -1
  1538. package/src/interface/math/vec2/f32/faceforward.ts +1 -0
  1539. package/src/interface/math/vec2/f32/floor.ts +1 -0
  1540. package/src/interface/math/vec2/f32/fract.ts +1 -0
  1541. package/src/interface/math/vec2/f32/length.ts +1 -0
  1542. package/src/interface/math/vec2/f32/log.ts +1 -0
  1543. package/src/interface/math/vec2/f32/log2.ts +1 -0
  1544. package/src/interface/math/vec2/f32/max.ts +1 -0
  1545. package/src/interface/math/vec2/f32/min.ts +1 -0
  1546. package/src/interface/math/vec2/f32/mix.ts +1 -0
  1547. package/src/interface/math/vec2/f32/mod.ts +1 -0
  1548. package/src/interface/math/vec2/f32/modf.ts +1 -0
  1549. package/src/interface/math/vec2/f32/negate.ts +1 -0
  1550. package/src/interface/math/vec2/f32/normalize.ts +1 -0
  1551. package/src/interface/math/vec2/f32/pow.ts +1 -0
  1552. package/src/interface/math/vec2/f32/public.ts +2 -0
  1553. package/src/interface/math/vec2/f32/reflect.ts +1 -0
  1554. package/src/interface/math/vec2/f32/refract.ts +1 -0
  1555. package/src/interface/math/vec2/f32/round.ts +1 -0
  1556. package/src/interface/math/vec2/f32/scale.ts +1 -0
  1557. package/src/interface/math/vec2/f32/schema.ts +1 -0
  1558. package/src/interface/math/vec2/f32/sign.ts +1 -0
  1559. package/src/interface/math/vec2/f32/sin.ts +1 -0
  1560. package/src/interface/math/vec2/f32/sinh.ts +1 -0
  1561. package/src/interface/math/vec2/f32/smoothstep.ts +1 -0
  1562. package/src/interface/math/vec2/f32/sqrt.ts +1 -0
  1563. package/src/interface/math/vec2/f32/step.ts +1 -0
  1564. package/src/interface/math/vec2/f32/subtract.ts +1 -0
  1565. package/src/interface/math/vec2/f32/tan.ts +1 -0
  1566. package/src/interface/math/vec2/f32/tanh.ts +1 -0
  1567. package/src/interface/math/vec2/f32/trunc.ts +1 -0
  1568. package/src/interface/math/vec2/f32/zero.ts +1 -0
  1569. package/src/interface/math/vec2/i32/abs.ts +1 -0
  1570. package/src/interface/math/vec2/i32/add.ts +1 -0
  1571. package/src/interface/math/vec2/i32/bitwise-and.ts +1 -0
  1572. package/src/interface/math/vec2/i32/bitwise-not.ts +1 -0
  1573. package/src/interface/math/vec2/i32/bitwise-or.ts +1 -0
  1574. package/src/interface/math/vec2/i32/bitwise-xor.ts +1 -0
  1575. package/src/interface/math/vec2/i32/clamp.ts +1 -0
  1576. package/src/interface/math/vec2/i32/count-leading-zeros.ts +1 -0
  1577. package/src/interface/math/vec2/i32/count-one-bits.ts +1 -0
  1578. package/src/interface/math/vec2/i32/count-trailing-zeros.ts +1 -0
  1579. package/src/interface/math/vec2/i32/equals.ts +1 -0
  1580. package/src/interface/math/vec2/i32/i32.ts +5 -1
  1581. package/src/interface/math/vec2/i32/max.ts +1 -0
  1582. package/src/interface/math/vec2/i32/min.ts +1 -0
  1583. package/src/interface/math/vec2/i32/negate.ts +1 -0
  1584. package/src/interface/math/vec2/i32/public.ts +2 -0
  1585. package/src/interface/math/vec2/i32/reverse-bits.ts +1 -0
  1586. package/src/interface/math/vec2/i32/scale.ts +1 -0
  1587. package/src/interface/math/vec2/i32/schema.ts +1 -0
  1588. package/src/interface/math/vec2/i32/shift-left.ts +1 -0
  1589. package/src/interface/math/vec2/i32/shift-right.ts +1 -0
  1590. package/src/interface/math/vec2/i32/subtract.ts +1 -0
  1591. package/src/interface/math/vec2/i32/zero.ts +1 -0
  1592. package/src/interface/math/vec2/index.ts +1 -0
  1593. package/src/interface/math/vec2/public.ts +2 -0
  1594. package/src/interface/math/vec2/u32/add.ts +1 -0
  1595. package/src/interface/math/vec2/u32/bitwise-and.ts +1 -0
  1596. package/src/interface/math/vec2/u32/bitwise-not.ts +1 -0
  1597. package/src/interface/math/vec2/u32/bitwise-or.ts +1 -0
  1598. package/src/interface/math/vec2/u32/bitwise-xor.ts +1 -0
  1599. package/src/interface/math/vec2/u32/clamp.ts +1 -0
  1600. package/src/interface/math/vec2/u32/count-leading-zeros.ts +1 -0
  1601. package/src/interface/math/vec2/u32/count-one-bits.ts +1 -0
  1602. package/src/interface/math/vec2/u32/count-trailing-zeros.ts +1 -0
  1603. package/src/interface/math/vec2/u32/equals.ts +1 -0
  1604. package/src/interface/math/vec2/u32/max.ts +1 -0
  1605. package/src/interface/math/vec2/u32/min.ts +1 -0
  1606. package/src/interface/math/vec2/u32/negate.ts +1 -0
  1607. package/src/interface/math/vec2/u32/public.ts +2 -0
  1608. package/src/interface/math/vec2/u32/reverse-bits.ts +1 -0
  1609. package/src/interface/math/vec2/u32/scale.ts +1 -0
  1610. package/src/interface/math/vec2/u32/schema.ts +1 -0
  1611. package/src/interface/math/vec2/u32/shift-left.ts +1 -0
  1612. package/src/interface/math/vec2/u32/shift-right.ts +1 -0
  1613. package/src/interface/math/vec2/u32/subtract.ts +1 -0
  1614. package/src/interface/math/vec2/u32/u32.ts +5 -1
  1615. package/src/interface/math/vec2/u32/zero.ts +1 -0
  1616. package/src/interface/math/vec3/f32/abs.ts +1 -0
  1617. package/src/interface/math/vec3/f32/acos.ts +1 -0
  1618. package/src/interface/math/vec3/f32/acosh.ts +1 -0
  1619. package/src/interface/math/vec3/f32/add.ts +1 -0
  1620. package/src/interface/math/vec3/f32/asin.ts +1 -0
  1621. package/src/interface/math/vec3/f32/asinh.ts +1 -0
  1622. package/src/interface/math/vec3/f32/atan.ts +1 -0
  1623. package/src/interface/math/vec3/f32/atanh.ts +1 -0
  1624. package/src/interface/math/vec3/f32/ceil.ts +1 -0
  1625. package/src/interface/math/vec3/f32/clamp.ts +1 -0
  1626. package/src/interface/math/vec3/f32/cos.ts +1 -0
  1627. package/src/interface/math/vec3/f32/cosh.ts +1 -0
  1628. package/src/interface/math/vec3/f32/cross.ts +1 -0
  1629. package/src/interface/math/vec3/f32/distance-squared.ts +1 -0
  1630. package/src/interface/math/vec3/f32/distance.ts +1 -0
  1631. package/src/interface/math/vec3/f32/dot.ts +1 -0
  1632. package/src/interface/math/vec3/f32/equals.ts +1 -0
  1633. package/src/interface/math/vec3/f32/exp.ts +1 -0
  1634. package/src/interface/math/vec3/f32/exp2.ts +1 -0
  1635. package/src/interface/math/vec3/f32/f32.ts +5 -1
  1636. package/src/interface/math/vec3/f32/faceforward.ts +1 -0
  1637. package/src/interface/math/vec3/f32/floor.ts +1 -0
  1638. package/src/interface/math/vec3/f32/fract.ts +1 -0
  1639. package/src/interface/math/vec3/f32/length-squared.ts +1 -0
  1640. package/src/interface/math/vec3/f32/length.ts +1 -0
  1641. package/src/interface/math/vec3/f32/log.ts +1 -0
  1642. package/src/interface/math/vec3/f32/log2.ts +1 -0
  1643. package/src/interface/math/vec3/f32/max.ts +1 -0
  1644. package/src/interface/math/vec3/f32/min.ts +1 -0
  1645. package/src/interface/math/vec3/f32/mix.ts +1 -0
  1646. package/src/interface/math/vec3/f32/mod.ts +1 -0
  1647. package/src/interface/math/vec3/f32/modf.ts +1 -0
  1648. package/src/interface/math/vec3/f32/multiply.ts +1 -0
  1649. package/src/interface/math/vec3/f32/negate.ts +1 -0
  1650. package/src/interface/math/vec3/f32/normalize.ts +1 -0
  1651. package/src/interface/math/vec3/f32/one.ts +1 -0
  1652. package/src/interface/math/vec3/f32/pow.ts +1 -0
  1653. package/src/interface/math/vec3/f32/public.ts +2 -0
  1654. package/src/interface/math/vec3/f32/random.ts +1 -0
  1655. package/src/interface/math/vec3/f32/reflect.ts +1 -0
  1656. package/src/interface/math/vec3/f32/refract.ts +1 -0
  1657. package/src/interface/math/vec3/f32/round.ts +1 -0
  1658. package/src/interface/math/vec3/f32/scale.ts +1 -0
  1659. package/src/interface/math/vec3/f32/schema.ts +1 -0
  1660. package/src/interface/math/vec3/f32/sign.ts +1 -0
  1661. package/src/interface/math/vec3/f32/sin.ts +1 -0
  1662. package/src/interface/math/vec3/f32/sinh.ts +1 -0
  1663. package/src/interface/math/vec3/f32/smoothstep.ts +1 -0
  1664. package/src/interface/math/vec3/f32/sqrt.ts +1 -0
  1665. package/src/interface/math/vec3/f32/step.ts +1 -0
  1666. package/src/interface/math/vec3/f32/subtract.ts +1 -0
  1667. package/src/interface/math/vec3/f32/tan.ts +1 -0
  1668. package/src/interface/math/vec3/f32/tanh.ts +1 -0
  1669. package/src/interface/math/vec3/f32/trunc.ts +1 -0
  1670. package/src/interface/math/vec3/f32/zero.ts +1 -0
  1671. package/src/interface/math/vec3/i32/abs.ts +1 -0
  1672. package/src/interface/math/vec3/i32/add.ts +1 -0
  1673. package/src/interface/math/vec3/i32/bitwise-and.ts +1 -0
  1674. package/src/interface/math/vec3/i32/bitwise-not.ts +1 -0
  1675. package/src/interface/math/vec3/i32/bitwise-or.ts +1 -0
  1676. package/src/interface/math/vec3/i32/bitwise-xor.ts +1 -0
  1677. package/src/interface/math/vec3/i32/clamp.ts +1 -0
  1678. package/src/interface/math/vec3/i32/count-leading-zeros.ts +1 -0
  1679. package/src/interface/math/vec3/i32/count-one-bits.ts +1 -0
  1680. package/src/interface/math/vec3/i32/count-trailing-zeros.ts +1 -0
  1681. package/src/interface/math/vec3/i32/equals.ts +1 -0
  1682. package/src/interface/math/vec3/i32/i32.ts +5 -1
  1683. package/src/interface/math/vec3/i32/max.ts +1 -0
  1684. package/src/interface/math/vec3/i32/min.ts +1 -0
  1685. package/src/interface/math/vec3/i32/multiply.ts +1 -0
  1686. package/src/interface/math/vec3/i32/negate.ts +1 -0
  1687. package/src/interface/math/vec3/i32/one.ts +1 -0
  1688. package/src/interface/math/vec3/i32/public.ts +2 -0
  1689. package/src/interface/math/vec3/i32/reverse-bits.ts +1 -0
  1690. package/src/interface/math/vec3/i32/scale.ts +1 -0
  1691. package/src/interface/math/vec3/i32/schema.ts +1 -0
  1692. package/src/interface/math/vec3/i32/shift-left.ts +1 -0
  1693. package/src/interface/math/vec3/i32/shift-right.ts +1 -0
  1694. package/src/interface/math/vec3/i32/subtract.ts +1 -0
  1695. package/src/interface/math/vec3/i32/zero.ts +1 -0
  1696. package/src/interface/math/vec3/index.ts +1 -0
  1697. package/src/interface/math/vec3/public.ts +2 -0
  1698. package/src/interface/math/vec3/u32/add.ts +1 -0
  1699. package/src/interface/math/vec3/u32/bitwise-and.ts +1 -0
  1700. package/src/interface/math/vec3/u32/bitwise-not.ts +1 -0
  1701. package/src/interface/math/vec3/u32/bitwise-or.ts +1 -0
  1702. package/src/interface/math/vec3/u32/bitwise-xor.ts +1 -0
  1703. package/src/interface/math/vec3/u32/clamp.ts +1 -0
  1704. package/src/interface/math/vec3/u32/count-leading-zeros.ts +1 -0
  1705. package/src/interface/math/vec3/u32/count-one-bits.ts +1 -0
  1706. package/src/interface/math/vec3/u32/count-trailing-zeros.ts +1 -0
  1707. package/src/interface/math/vec3/u32/equals.ts +1 -0
  1708. package/src/interface/math/vec3/u32/max.ts +1 -0
  1709. package/src/interface/math/vec3/u32/min.ts +1 -0
  1710. package/src/interface/math/vec3/u32/multiply.ts +1 -0
  1711. package/src/interface/math/vec3/u32/negate.ts +1 -0
  1712. package/src/interface/math/vec3/u32/one.ts +1 -0
  1713. package/src/interface/math/vec3/u32/public.ts +2 -0
  1714. package/src/interface/math/vec3/u32/reverse-bits.ts +1 -0
  1715. package/src/interface/math/vec3/u32/scale.ts +1 -0
  1716. package/src/interface/math/vec3/u32/schema.ts +1 -0
  1717. package/src/interface/math/vec3/u32/shift-left.ts +1 -0
  1718. package/src/interface/math/vec3/u32/shift-right.ts +1 -0
  1719. package/src/interface/math/vec3/u32/subtract.ts +1 -0
  1720. package/src/interface/math/vec3/u32/u32.ts +5 -1
  1721. package/src/interface/math/vec3/u32/volume.ts +1 -0
  1722. package/src/interface/math/vec3/u32/zero.ts +1 -0
  1723. package/src/interface/math/vec4/f32/abs.ts +1 -0
  1724. package/src/interface/math/vec4/f32/acos.ts +1 -0
  1725. package/src/interface/math/vec4/f32/acosh.ts +1 -0
  1726. package/src/interface/math/vec4/f32/add.ts +1 -0
  1727. package/src/interface/math/vec4/f32/asin.ts +1 -0
  1728. package/src/interface/math/vec4/f32/asinh.ts +1 -0
  1729. package/src/interface/math/vec4/f32/atan.ts +1 -0
  1730. package/src/interface/math/vec4/f32/atanh.ts +1 -0
  1731. package/src/interface/math/vec4/f32/ceil.ts +1 -0
  1732. package/src/interface/math/vec4/f32/clamp.ts +1 -0
  1733. package/src/interface/math/vec4/f32/cos.ts +1 -0
  1734. package/src/interface/math/vec4/f32/cosh.ts +1 -0
  1735. package/src/interface/math/vec4/f32/default.ts +6 -0
  1736. package/src/interface/math/vec4/f32/distance.ts +1 -0
  1737. package/src/interface/math/vec4/f32/dot.ts +1 -0
  1738. package/src/interface/math/vec4/f32/exp.ts +1 -0
  1739. package/src/interface/math/vec4/f32/exp2.ts +1 -0
  1740. package/src/interface/math/vec4/f32/f32.ts +5 -1
  1741. package/src/interface/math/vec4/f32/faceforward.ts +1 -0
  1742. package/src/interface/math/vec4/f32/floor.ts +1 -0
  1743. package/src/interface/math/vec4/f32/fract.ts +1 -0
  1744. package/src/interface/math/vec4/f32/length.ts +1 -0
  1745. package/src/interface/math/vec4/f32/log.ts +1 -0
  1746. package/src/interface/math/vec4/f32/log2.ts +1 -0
  1747. package/src/interface/math/vec4/f32/max.ts +1 -0
  1748. package/src/interface/math/vec4/f32/min.ts +1 -0
  1749. package/src/interface/math/vec4/f32/mix.ts +1 -0
  1750. package/src/interface/math/vec4/f32/mod.ts +1 -0
  1751. package/src/interface/math/vec4/f32/modf.ts +1 -0
  1752. package/src/interface/math/vec4/f32/multiply.ts +1 -0
  1753. package/src/interface/math/vec4/f32/negate.ts +1 -0
  1754. package/src/interface/math/vec4/f32/normalize.ts +1 -0
  1755. package/src/interface/math/vec4/f32/pow.ts +1 -0
  1756. package/src/interface/math/vec4/f32/public.ts +2 -0
  1757. package/src/interface/math/vec4/f32/reflect.ts +1 -0
  1758. package/src/interface/math/vec4/f32/refract.ts +1 -0
  1759. package/src/interface/math/vec4/f32/round.ts +1 -0
  1760. package/src/interface/math/vec4/f32/scale.ts +1 -0
  1761. package/src/interface/math/vec4/f32/schema.ts +1 -0
  1762. package/src/interface/math/vec4/f32/sign.ts +1 -0
  1763. package/src/interface/math/vec4/f32/sin.ts +1 -0
  1764. package/src/interface/math/vec4/f32/sinh.ts +1 -0
  1765. package/src/interface/math/vec4/f32/smoothstep.ts +1 -0
  1766. package/src/interface/math/vec4/f32/sqrt.ts +1 -0
  1767. package/src/interface/math/vec4/f32/step.ts +1 -0
  1768. package/src/interface/math/vec4/f32/subtract.ts +1 -0
  1769. package/src/interface/math/vec4/f32/tan.ts +1 -0
  1770. package/src/interface/math/vec4/f32/tanh.ts +1 -0
  1771. package/src/interface/math/vec4/f32/trunc.ts +1 -0
  1772. package/src/interface/math/vec4/i32/abs.ts +1 -0
  1773. package/src/interface/math/vec4/i32/add.ts +1 -0
  1774. package/src/interface/math/vec4/i32/bitwise-and.ts +1 -0
  1775. package/src/interface/math/vec4/i32/bitwise-not.ts +1 -0
  1776. package/src/interface/math/vec4/i32/bitwise-or.ts +1 -0
  1777. package/src/interface/math/vec4/i32/bitwise-xor.ts +1 -0
  1778. package/src/interface/math/vec4/i32/clamp.ts +1 -0
  1779. package/src/interface/math/vec4/i32/count-leading-zeros.ts +1 -0
  1780. package/src/interface/math/vec4/i32/count-one-bits.ts +1 -0
  1781. package/src/interface/math/vec4/i32/count-trailing-zeros.ts +1 -0
  1782. package/src/interface/math/vec4/i32/equals.ts +1 -0
  1783. package/src/interface/math/vec4/i32/i32.ts +5 -1
  1784. package/src/interface/math/vec4/i32/max.ts +1 -0
  1785. package/src/interface/math/vec4/i32/min.ts +1 -0
  1786. package/src/interface/math/vec4/i32/multiply.ts +1 -0
  1787. package/src/interface/math/vec4/i32/negate.ts +1 -0
  1788. package/src/interface/math/vec4/i32/one.ts +1 -0
  1789. package/src/interface/math/vec4/i32/public.ts +2 -0
  1790. package/src/interface/math/vec4/i32/reverse-bits.ts +1 -0
  1791. package/src/interface/math/vec4/i32/scale.ts +1 -0
  1792. package/src/interface/math/vec4/i32/schema.ts +1 -0
  1793. package/src/interface/math/vec4/i32/shift-left.ts +1 -0
  1794. package/src/interface/math/vec4/i32/shift-right.ts +1 -0
  1795. package/src/interface/math/vec4/i32/subtract.ts +1 -0
  1796. package/src/interface/math/vec4/i32/zero.ts +1 -0
  1797. package/src/interface/math/vec4/index.ts +1 -0
  1798. package/src/interface/math/vec4/public.ts +2 -0
  1799. package/src/interface/math/vec4/u32/add.ts +1 -0
  1800. package/src/interface/math/vec4/u32/bitwise-and.ts +1 -0
  1801. package/src/interface/math/vec4/u32/bitwise-not.ts +1 -0
  1802. package/src/interface/math/vec4/u32/bitwise-or.ts +1 -0
  1803. package/src/interface/math/vec4/u32/bitwise-xor.ts +1 -0
  1804. package/src/interface/math/vec4/u32/clamp.ts +1 -0
  1805. package/src/interface/math/vec4/u32/count-leading-zeros.ts +1 -0
  1806. package/src/interface/math/vec4/u32/count-one-bits.ts +1 -0
  1807. package/src/interface/math/vec4/u32/count-trailing-zeros.ts +1 -0
  1808. package/src/interface/math/vec4/u32/equals.ts +1 -0
  1809. package/src/interface/math/vec4/u32/max.ts +1 -0
  1810. package/src/interface/math/vec4/u32/min.ts +1 -0
  1811. package/src/interface/math/vec4/u32/multiply.ts +1 -0
  1812. package/src/interface/math/vec4/u32/negate.ts +1 -0
  1813. package/src/interface/math/vec4/u32/one.ts +1 -0
  1814. package/src/interface/math/vec4/u32/public.ts +2 -0
  1815. package/src/interface/math/vec4/u32/reverse-bits.ts +1 -0
  1816. package/src/interface/math/vec4/u32/scale.ts +1 -0
  1817. package/src/interface/math/vec4/u32/schema.ts +1 -0
  1818. package/src/interface/math/vec4/u32/shift-left.ts +1 -0
  1819. package/src/interface/math/vec4/u32/shift-right.ts +1 -0
  1820. package/src/interface/math/vec4/u32/subtract.ts +1 -0
  1821. package/src/interface/math/vec4/u32/u32.ts +5 -1
  1822. package/src/interface/math/vec4/u32/zero.ts +1 -0
  1823. package/src/interface/platform/platform.ts +1 -0
  1824. package/src/interface/registry/archetypes.test.ts +50 -0
  1825. package/src/interface/registry/archetypes.ts +45 -9
  1826. package/src/interface/registry/declarations.ts +107 -13
  1827. package/src/interface/registry/declared.test.ts +40 -0
  1828. package/src/interface/registry/finalizer-order.ts +4 -3
  1829. package/src/interface/registry/ids.test-helper.ts +35 -1
  1830. package/src/interface/registry/ids.test.ts +43 -56
  1831. package/src/interface/registry/ids.ts +46 -0
  1832. package/src/interface/registry/index.ts +4 -3
  1833. package/src/interface/registry/indexes.ts +3 -2
  1834. package/src/interface/registry/items.ts +17 -47
  1835. package/src/interface/registry/layout.test.ts +20 -0
  1836. package/src/interface/registry/layout.ts +11 -3
  1837. package/src/interface/registry/names.test.ts +16 -18
  1838. package/src/interface/registry/names.ts +62 -42
  1839. package/src/interface/registry/program.ts +1 -0
  1840. package/src/interface/registry/reduction.ts +1 -0
  1841. package/src/interface/registry/schedule.ts +10 -14
  1842. package/src/interface/registry/schemas.ts +58 -0
  1843. package/src/interface/registry/strata.ts +1 -0
  1844. package/src/interface/registry/threads.ts +3 -2
  1845. package/src/interface/registry/traits.ts +2 -1
  1846. package/src/interface/registry/written.ts +1 -0
  1847. package/src/interface/resource/condition.ts +4 -3
  1848. package/src/interface/resource/index.ts +1 -2
  1849. package/src/interface/resource/key.ts +1 -0
  1850. package/src/interface/resource/reduction.ts +1 -0
  1851. package/src/interface/resource/register.test.ts +42 -56
  1852. package/src/interface/resource/resource.ts +5 -1
  1853. package/src/interface/resource/types.ts +5 -1
  1854. package/src/interface/resource/value.ts +6 -5
  1855. package/src/interface/resource/written.ts +1 -0
  1856. package/src/interface/resources/always.ts +3 -2
  1857. package/src/interface/resources/cadence.ts +5 -4
  1858. package/src/interface/resources/clock.ts +5 -3
  1859. package/src/interface/resources/gpu-device.ts +3 -2
  1860. package/src/interface/resources/index.ts +1 -0
  1861. package/src/interface/resources/wake.ts +3 -2
  1862. package/src/interface/resources/workers.ts +3 -2
  1863. package/src/interface/rule/create.ts +9 -7
  1864. package/src/interface/rule/created.ts +3 -2
  1865. package/src/interface/rule/declaration.ts +7 -3
  1866. package/src/interface/rule/index.ts +1 -0
  1867. package/src/interface/rule/rule.ts +1 -0
  1868. package/src/interface/rule/rule.type-test.ts +17 -27
  1869. package/src/interface/schema/is-struct.ts +12 -0
  1870. package/src/interface/schema/schema.ts +23 -1
  1871. package/src/interface/schema/schema.type-test.ts +18 -16
  1872. package/src/interface/schema/schemas.type-test.ts +1 -0
  1873. package/src/interface/system/access.ts +68 -28
  1874. package/src/interface/system/body.ts +53 -23
  1875. package/src/interface/system/check.ts +82 -44
  1876. package/src/interface/system/commands.ts +51 -6
  1877. package/src/interface/system/commands.type-test.ts +2 -8
  1878. package/src/interface/system/composite-declaration.ts +1 -2
  1879. package/src/interface/system/composite-input.type-test.ts +13 -29
  1880. package/src/interface/system/composite.ts +1 -0
  1881. package/src/interface/system/conditions.type-test.ts +11 -22
  1882. package/src/interface/system/create-resolved.ts +21 -0
  1883. package/src/interface/system/create.test.ts +96 -116
  1884. package/src/interface/system/create.ts +121 -94
  1885. package/src/interface/system/declaration.ts +33 -25
  1886. package/src/interface/system/definition.ts +1 -0
  1887. package/src/interface/system/index.ts +1 -0
  1888. package/src/interface/system/input.ts +35 -4
  1889. package/src/interface/system/leaf.ts +10 -3
  1890. package/src/interface/system/lists.type-test.ts +53 -0
  1891. package/src/interface/system/name.ts +4 -3
  1892. package/src/interface/system/optional.type-test.ts +51 -0
  1893. package/src/interface/system/property.ts +1 -0
  1894. package/src/interface/system/render.ts +45 -20
  1895. package/src/interface/system/resolve.test.ts +49 -0
  1896. package/src/interface/system/resolve.ts +165 -0
  1897. package/src/interface/system/shared.type-test.ts +205 -0
  1898. package/src/interface/system/struct.ts +3 -2
  1899. package/src/interface/system/system.ts +5 -3
  1900. package/src/interface/system/system.type-test.ts +160 -197
  1901. package/src/interface/system/threads.ts +9 -8
  1902. package/src/interface/system/threads.type-test.ts +29 -60
  1903. package/src/interface/system/up.type-test.ts +15 -28
  1904. package/src/interface/system/values-of.ts +17 -0
  1905. package/src/interface/system/values.ts +18 -15
  1906. package/src/interface/thread/of.ts +4 -3
  1907. package/src/interface/thread/thread.ts +1 -0
  1908. package/src/interface/thread/thread.type-test.ts +4 -69
  1909. package/src/interface/trait/key.ts +2 -1
  1910. package/src/interface/trait/trait.type-test.ts +8 -81
  1911. package/src/interface/trait/types.ts +21 -8
  1912. package/src/interface/tsconfig.json +1 -1
  1913. package/src/interface/world/create.ts +10 -7
  1914. package/src/interface/world/declarations.ts +34 -0
  1915. package/src/interface/world/filter.ts +1 -0
  1916. package/src/interface/world/index.ts +1 -0
  1917. package/src/interface/world/join.ts +4 -5
  1918. package/src/interface/world/loop.type-test.ts +21 -16
  1919. package/src/interface/world/run.type-test.ts +87 -0
  1920. package/src/interface/world/share.type-test.ts +8 -2
  1921. package/src/interface/world/world.ts +32 -17
  1922. package/src/interface/world/world.type-test.ts +6 -10
  1923. package/src/observe/compare.ts +1 -0
  1924. package/src/observe/entity.ts +21 -13
  1925. package/src/observe/index.ts +1 -0
  1926. package/src/observe/members.ts +4 -3
  1927. package/src/observe/observe.ts +1 -0
  1928. package/src/observe/observe.type-test.ts +1 -4
  1929. package/src/observe/plans.ts +1 -0
  1930. package/src/observe/query.ts +2 -1
  1931. package/src/observe/resource.ts +5 -4
  1932. package/src/observe/select.ts +14 -13
  1933. package/src/observe/to-promise.ts +1 -0
  1934. package/src/observe/tsconfig.json +1 -1
  1935. package/src/observe/values.ts +3 -2
  1936. package/src/observe/world-state.ts +41 -34
  1937. package/src/observe-imports.test.ts +1 -0
  1938. package/src/perftest/benchmark.ts +1 -0
  1939. package/src/perftest/benchmarks.ts +24 -8
  1940. package/src/perftest/editor.ts +126 -0
  1941. package/src/perftest/filters.ts +124 -0
  1942. package/src/perftest/finalized.ts +72 -24
  1943. package/src/perftest/flat.ts +16 -26
  1944. package/src/perftest/growth.ts +7 -15
  1945. package/src/perftest/handoff.ts +30 -37
  1946. package/src/perftest/hierarchy.ts +23 -40
  1947. package/src/perftest/indexes.ts +132 -64
  1948. package/src/perftest/invariants.ts +63 -0
  1949. package/src/perftest/joined.ts +13 -5
  1950. package/src/perftest/journal.ts +55 -0
  1951. package/src/perftest/keys.ts +1 -0
  1952. package/src/perftest/log.ts +6 -6
  1953. package/src/perftest/loop.ts +2 -1
  1954. package/src/perftest/observed-gpu.ts +6 -7
  1955. package/src/perftest/observed.ts +6 -12
  1956. package/src/perftest/observer.ts +5 -4
  1957. package/src/perftest/optional.ts +102 -0
  1958. package/src/perftest/particles.ts +13 -20
  1959. package/src/perftest/placed.ts +1 -0
  1960. package/src/perftest/reads.ts +13 -18
  1961. package/src/perftest/remote.ts +26 -28
  1962. package/src/perftest/render-order.ts +86 -0
  1963. package/src/perftest/run.ts +1 -0
  1964. package/src/perftest/shared.ts +416 -0
  1965. package/src/perftest/strings.ts +14 -12
  1966. package/src/perftest/structural.ts +32 -46
  1967. package/src/perftest/suite.perf-browser-test.ts +3 -0
  1968. package/src/perftest/suite.perf-test.ts +1 -0
  1969. package/src/perftest/suite.ts +41 -59
  1970. package/src/perftest/systems.ts +4 -6
  1971. package/src/perftest/tails.ts +40 -48
  1972. package/src/perftest/transfers.ts +25 -20
  1973. package/src/perftest/uploads.ts +11 -13
  1974. package/src/perftest/values.ts +8 -12
  1975. package/src/perftest/wake.ts +1 -0
  1976. package/src/world.test.ts +10 -10
  1977. package/dist/implementation/compiler/exact.d.ts +0 -24
  1978. package/dist/implementation/compiler/exact.js +0 -64
  1979. package/dist/implementation/compiler/exact.js.map +0 -1
  1980. package/dist/implementation/world/reports.d.ts +0 -63
  1981. package/dist/implementation/world/reports.js +0 -180
  1982. package/dist/implementation/world/reports.js.map +0 -1
  1983. package/dist/interface/archetype/archetype.d.ts +0 -2
  1984. package/dist/interface/archetype/archetype.js +0 -2
  1985. package/dist/interface/archetype/archetype.js.map +0 -1
  1986. package/dist/interface/archetype/create.d.ts +0 -7
  1987. package/dist/interface/archetype/create.js +0 -11
  1988. package/dist/interface/archetype/create.js.map +0 -1
  1989. package/dist/interface/archetype/index.d.ts +0 -1
  1990. package/dist/interface/archetype/index.js +0 -2
  1991. package/dist/interface/archetype/index.js.map +0 -1
  1992. package/dist/interface/archetype/values-of.d.ts +0 -17
  1993. package/dist/interface/archetype/values-of.js.map +0 -1
  1994. package/dist/interface/component/declaration.d.ts +0 -74
  1995. package/dist/interface/component/declaration.js +0 -2
  1996. package/dist/interface/component/declaration.js.map +0 -1
  1997. package/dist/interface/component/register.d.ts +0 -23
  1998. package/dist/interface/component/register.js +0 -6
  1999. package/dist/interface/component/register.js.map +0 -1
  2000. package/dist/interface/finalizer/name.d.ts +0 -6
  2001. package/dist/interface/finalizer/name.js +0 -2
  2002. package/dist/interface/finalizer/name.js.map +0 -1
  2003. package/dist/interface/indexes/name.d.ts +0 -5
  2004. package/dist/interface/indexes/name.js +0 -2
  2005. package/dist/interface/indexes/name.js.map +0 -1
  2006. package/dist/interface/report/components.d.ts +0 -38
  2007. package/dist/interface/report/components.js +0 -48
  2008. package/dist/interface/report/components.js.map +0 -1
  2009. package/dist/interface/report/failure.d.ts +0 -29
  2010. package/dist/interface/report/failure.js +0 -2
  2011. package/dist/interface/report/failure.js.map +0 -1
  2012. package/dist/interface/report/index.d.ts +0 -5
  2013. package/dist/interface/report/index.js +0 -6
  2014. package/dist/interface/report/index.js.map +0 -1
  2015. package/dist/interface/report/report.d.ts +0 -12
  2016. package/dist/interface/report/report.js +0 -2
  2017. package/dist/interface/report/report.js.map +0 -1
  2018. package/dist/interface/resource/declaration.d.ts +0 -31
  2019. package/dist/interface/resource/declaration.js +0 -2
  2020. package/dist/interface/resource/declaration.js.map +0 -1
  2021. package/dist/interface/resource/register.d.ts +0 -13
  2022. package/dist/interface/resource/register.js +0 -6
  2023. package/dist/interface/resource/register.js.map +0 -1
  2024. package/dist/interface/rule/name.d.ts +0 -6
  2025. package/dist/interface/rule/name.js +0 -2
  2026. package/dist/interface/rule/name.js.map +0 -1
  2027. package/dist/interface/schema/is-data.d.ts +0 -19
  2028. package/dist/interface/schema/is-data.js +0 -2
  2029. package/dist/interface/schema/is-data.js.map +0 -1
  2030. package/dist/interface/trait/index.d.ts +0 -1
  2031. package/dist/interface/trait/index.js +0 -2
  2032. package/dist/interface/trait/index.js.map +0 -1
  2033. package/dist/interface/trait/register.d.ts +0 -7
  2034. package/dist/interface/trait/register.js +0 -8
  2035. package/dist/interface/trait/register.js.map +0 -1
  2036. package/dist/interface/trait/required.d.ts +0 -10
  2037. package/dist/interface/trait/required.js +0 -2
  2038. package/dist/interface/trait/required.js.map +0 -1
  2039. package/dist/interface/trait/symbol-keys.d.ts +0 -16
  2040. package/dist/interface/trait/symbol-keys.js +0 -2
  2041. package/dist/interface/trait/symbol-keys.js.map +0 -1
  2042. package/dist/interface/trait/trait.d.ts +0 -2
  2043. package/dist/interface/trait/trait.js +0 -2
  2044. package/dist/interface/trait/trait.js.map +0 -1
  2045. package/src/guide/01-resources.test.ts +0 -44
  2046. package/src/guide/02-entities.test.ts +0 -57
  2047. package/src/guide/03-systems.test.ts +0 -87
  2048. package/src/guide/04-ticks.test.ts +0 -73
  2049. package/src/guide/05-scheduling.test.ts +0 -60
  2050. package/src/guide/06-sync-points.test.ts +0 -59
  2051. package/src/guide/07-change-filters.test.ts +0 -87
  2052. package/src/guide/08-input.test.ts +0 -47
  2053. package/src/guide/09-rules.test.ts +0 -57
  2054. package/src/guide/10-finalizers.test.ts +0 -64
  2055. package/src/guide/11-traits.test.ts +0 -58
  2056. package/src/guide/13-indexes.test.ts +0 -95
  2057. package/src/guide/guide.md +0 -551
  2058. package/src/implementation/compiler/exact.ts +0 -77
  2059. package/src/implementation/world/reports.test-helper.ts +0 -117
  2060. package/src/implementation/world/reports.test.ts +0 -167
  2061. package/src/implementation/world/reports.ts +0 -203
  2062. package/src/interface/archetype/archetype.ts +0 -3
  2063. package/src/interface/archetype/archetype.type-test.ts +0 -37
  2064. package/src/interface/archetype/create.test.ts +0 -40
  2065. package/src/interface/archetype/create.ts +0 -12
  2066. package/src/interface/archetype/index.ts +0 -1
  2067. package/src/interface/archetype/values-of.ts +0 -16
  2068. package/src/interface/component/declaration.ts +0 -67
  2069. package/src/interface/component/declaration.type-test.ts +0 -87
  2070. package/src/interface/component/register.ts +0 -28
  2071. package/src/interface/finalizer/name.ts +0 -6
  2072. package/src/interface/indexes/name.ts +0 -5
  2073. package/src/interface/report/components.ts +0 -69
  2074. package/src/interface/report/failure.ts +0 -26
  2075. package/src/interface/report/index.ts +0 -8
  2076. package/src/interface/report/report.ts +0 -11
  2077. package/src/interface/report/report.type-test.ts +0 -63
  2078. package/src/interface/resource/declaration.ts +0 -29
  2079. package/src/interface/resource/declaration.type-test.ts +0 -89
  2080. package/src/interface/resource/register.ts +0 -18
  2081. package/src/interface/rule/name.ts +0 -6
  2082. package/src/interface/schema/is-data.ts +0 -25
  2083. package/src/interface/trait/index.ts +0 -1
  2084. package/src/interface/trait/register.ts +0 -9
  2085. package/src/interface/trait/required.ts +0 -7
  2086. package/src/interface/trait/symbol-keys.ts +0 -19
  2087. package/src/interface/trait/symbol-keys.type-test.ts +0 -14
  2088. package/src/interface/trait/trait.ts +0 -3
  2089. package/src/samples/particles/build.test.ts +0 -23
  2090. package/src/samples/particles/gpu/main.ts +0 -96
  2091. package/src/samples/particles/gpu/particles.ts +0 -138
  2092. package/src/samples/particles/index.html +0 -22
  2093. package/src/samples/particles/particles.test.ts +0 -31
  2094. package/src/samples/particles/particles.ts +0 -85
  2095. package/src/samples/particles/particles.type-test.ts +0 -7
  2096. package/src/samples/todo/README.md +0 -174
  2097. package/src/samples/todo/app/app.browser.test.ts +0 -215
  2098. package/src/samples/todo/app/app.ts +0 -30
  2099. package/src/samples/todo/app/log-failures.test.ts +0 -28
  2100. package/src/samples/todo/app/log-failures.ts +0 -7
  2101. package/src/samples/todo/app/main.ts +0 -4
  2102. package/src/samples/todo/app/profile.perf-browser-test.ts +0 -100
  2103. package/src/samples/todo/app/proportional.browser.test.ts +0 -157
  2104. package/src/samples/todo/app/todo.perf-browser-test.ts +0 -207
  2105. package/src/samples/todo/build.test.ts +0 -23
  2106. package/src/samples/todo/features/completion/data.ts +0 -5
  2107. package/src/samples/todo/features/completion/dom.browser.test.ts +0 -53
  2108. package/src/samples/todo/features/completion/dom.ts +0 -39
  2109. package/src/samples/todo/features/completion/elements/elements.browser.test.ts +0 -68
  2110. package/src/samples/todo/features/completion/elements/todo-summary.ts +0 -82
  2111. package/src/samples/todo/features/completion/elements/todo-toggle-all.ts +0 -69
  2112. package/src/samples/todo/features/completion/events.ts +0 -7
  2113. package/src/samples/todo/features/completion/feature.ts +0 -13
  2114. package/src/samples/todo/features/completion/model.test.ts +0 -40
  2115. package/src/samples/todo/features/completion/model.ts +0 -21
  2116. package/src/samples/todo/features/filter/data.ts +0 -16
  2117. package/src/samples/todo/features/filter/dom.browser.test.ts +0 -84
  2118. package/src/samples/todo/features/filter/dom.ts +0 -63
  2119. package/src/samples/todo/features/filter/elements/elements.browser.test.ts +0 -43
  2120. package/src/samples/todo/features/filter/elements/todo-filters.ts +0 -70
  2121. package/src/samples/todo/features/filter/events.ts +0 -4
  2122. package/src/samples/todo/features/filter/feature.ts +0 -12
  2123. package/src/samples/todo/features/filter/model.test.ts +0 -18
  2124. package/src/samples/todo/features/filter/model.ts +0 -10
  2125. package/src/samples/todo/features/generate/elements/elements.browser.test.ts +0 -18
  2126. package/src/samples/todo/features/generate/elements/todo-generate.ts +0 -36
  2127. package/src/samples/todo/features/generate/events.ts +0 -4
  2128. package/src/samples/todo/features/generate/feature.ts +0 -11
  2129. package/src/samples/todo/features/generate/model.test.ts +0 -13
  2130. package/src/samples/todo/features/generate/model.ts +0 -19
  2131. package/src/samples/todo/features/index.ts +0 -4
  2132. package/src/samples/todo/features/todos/data.ts +0 -31
  2133. package/src/samples/todo/features/todos/dom.browser.test.ts +0 -205
  2134. package/src/samples/todo/features/todos/dom.ts +0 -90
  2135. package/src/samples/todo/features/todos/elements/elements.browser.test.ts +0 -211
  2136. package/src/samples/todo/features/todos/elements/todo-entry.ts +0 -45
  2137. package/src/samples/todo/features/todos/elements/todo-list.ts +0 -93
  2138. package/src/samples/todo/features/todos/elements/todo-row.ts +0 -138
  2139. package/src/samples/todo/features/todos/events.ts +0 -11
  2140. package/src/samples/todo/features/todos/feature.ts +0 -14
  2141. package/src/samples/todo/features/todos/model.test.ts +0 -77
  2142. package/src/samples/todo/features/todos/model.ts +0 -80
  2143. package/src/samples/todo/features/todos/todos.test-helper.ts +0 -34
  2144. package/src/samples/todo/imports.test.ts +0 -113
  2145. package/src/samples/todo/index.html +0 -51
  2146. package/src/samples/todo/shared/attach.browser.test.ts +0 -73
  2147. package/src/samples/todo/shared/attach.ts +0 -32
  2148. package/src/samples/todo/shared/connect.ts +0 -21
  2149. package/src/samples/todo/shared/elements/define.ts +0 -7
  2150. package/src/samples/todo/shared/elements/elements.test-helper.ts +0 -28
  2151. package/src/samples/todo/shared/feature.ts +0 -20
  2152. package/src/samples/todo/shared/ticks.test-helper.ts +0 -25
  2153. package/src/samples/transfers/build.test.ts +0 -22
  2154. package/src/samples/transfers/index.html +0 -18
  2155. package/src/samples/transfers/loader.ts +0 -42
  2156. package/src/samples/transfers/main.ts +0 -46
  2157. package/src/samples/transfers/sprites.ts +0 -96
  2158. package/src/samples/transfers/world.ts +0 -11
  2159. /package/dist/interface/{archetype → system}/values-of.js +0 -0
@@ -0,0 +1,871 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ import { reductionOperators } from '../../interface/registry/reduction.js';
3
+ import { isComparable, isEntity, isString, isStruct, matchesSchema } from '../../interface/registry/schemas.js';
4
+ import type { Schema } from '../../interface/schema/schema.js';
5
+ import { declarationsName } from '../../interface/registry/ids.js';
6
+ import type { PassResult } from './input-schemas.js';
7
+ import type { Insertion } from './source-map.js';
8
+ import { createConverter, isNotData, isThrown, type Declarator, type Module, type Node, type Statement, type TypedProgram, type TypeHost, type TypeNode } from './type-schemas.js';
9
+
10
+ export type AugmentationHost = TypeHost;
11
+
12
+ type Block = Extract<Statement, { readonly type: "TSModuleDeclaration"; readonly global: false }>;
13
+ type Interface = Extract<Statement, { readonly type: "TSInterfaceDeclaration" }>;
14
+ type Member = Interface["body"]["body"][number];
15
+ type Property = Extract<Member, { readonly type: "TSPropertySignature" }>;
16
+ type Value = string | number | boolean | null | readonly Value[] | { readonly [field: string]: Value };
17
+
18
+ const kinds = { Components: "component", Resources: "resource", Traits: "trait" } as const;
19
+ const isKind = (name: string): name is keyof typeof kinds => name in kinds;
20
+
21
+ /** The interfaces of each top-level `declare module "@adobe/ecs"` block, with the block. */
22
+ const augmentationsOf = (module: Pick<Module, "program">): readonly { readonly block: Block; readonly interfaces: readonly Interface[] }[] =>
23
+ module.program.body.flatMap(statement => {
24
+ if (statement.type !== "TSModuleDeclaration" || statement.global !== false || statement.id.type !== "Literal" || statement.id.value !== "@adobe/ecs") return [];
25
+ const body = statement.body?.type === "TSModuleBlock" ? statement.body.body : [];
26
+ const interfaces = body.flatMap(inner => {
27
+ const declared = inner.type === "ExportNamedDeclaration" ? inner.declaration : inner;
28
+ return declared?.type === "TSInterfaceDeclaration" && isKind(declared.id.name) ? [declared] : [];
29
+ });
30
+ return [{ block: statement, interfaces }];
31
+ });
32
+
33
+ /**
34
+ * The literal value of `trait` each key of `kind` a module's `declare module "@adobe/ecs"` blocks declare it on has, by
35
+ * its key's binding.
36
+ */
37
+ const declaredTraitsIn = (program: TypedProgram, kind: "Components" | "Resources", trait: string): ReadonlyMap<string, string | number | boolean> => {
38
+ const found = new Map<string, string | number | boolean>();
39
+ for (const { interfaces } of augmentationsOf({ program })) {
40
+ for (const declared of interfaces) {
41
+ if (declared.id.name !== kind) continue;
42
+ for (const member of declared.body.body) {
43
+ if (member.type !== "TSPropertySignature" || !member.computed || member.key.type !== "Identifier") continue;
44
+ const declaration = member.typeAnnotation?.typeAnnotation;
45
+ if (declaration?.type !== "TSTypeLiteral") continue;
46
+ for (const property of declaration.members) {
47
+ if (property.type !== "TSPropertySignature" || property.computed || property.key.type !== "Identifier" || property.key.name !== trait) continue;
48
+ const value = property.typeAnnotation?.typeAnnotation;
49
+ if (value?.type === "TSLiteralType" && value.literal.type === "Literal" && (typeof value.literal.value === "string" || typeof value.literal.value === "number" || typeof value.literal.value === "boolean")) found.set(member.key.name, value.literal.value);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ return found;
55
+ };
56
+
57
+ /**
58
+ * The operator each resource a module's `declare module "@adobe/ecs"` blocks declare with a `reduce` trait reduces
59
+ * with, by its key's binding: what a kernel reducing into it folds with.
60
+ */
61
+ export const reductionsIn = (program: TypedProgram): ReadonlyMap<string, string> =>
62
+ new Map([...declaredTraitsIn(program, "Resources", "reduce")].flatMap(([binding, value]) => typeof value === "string" ? [[binding, value] as const] : []));
63
+
64
+ /** The components a module's `declare module "@adobe/ecs"` blocks declare `shared: true`, by their keys' bindings: what kernels read as parameters. */
65
+ export const sharedIn = (program: TypedProgram): ReadonlySet<string> =>
66
+ new Set([...declaredTraitsIn(program, "Components", "shared")].flatMap(([binding, value]) => value === true ? [binding] : []));
67
+
68
+ type Expression = Extract<Statement, { readonly type: "ExpressionStatement" }>["expression"];
69
+ type Call = Extract<Expression, { readonly type: "CallExpression" }>;
70
+
71
+ /** A call's statement forms as a bundle leaves them: alone, in a sequence, or `void`ed. */
72
+ const callsOf = (expression: Expression): readonly Call[] => {
73
+ if (expression.type === "CallExpression") return [expression];
74
+ if (expression.type === "SequenceExpression") return expression.expressions.flatMap(callsOf);
75
+ if (expression.type === "UnaryExpression" && expression.operator === "void") return callsOf(expression.argument);
76
+ return [];
77
+ };
78
+
79
+ /** An object literal's property named `name`, unless computed. */
80
+ const propertyNamed = (object: Extract<Expression, { readonly type: "ObjectExpression" }>, name: string): Expression | null => {
81
+ for (const property of object.properties) {
82
+ if (property.type === "Property" && !property.computed && property.key.type === "Identifier" && property.key.name === name) return property.value;
83
+ }
84
+ return null;
85
+ };
86
+
87
+ /**
88
+ * The literal value of `trait` each key of `kind` a module's generated declarations give, by its key's binding: what a
89
+ * library's build in library mode leaves of its declarations in its JavaScript. They record `key, kind, { ..., trait }`
90
+ * through the function appended to the module, under any name a bundle gives it, or, inlined, set
91
+ * `{ kind, declaration }` on the declarations map; the key is a top-level `Symbol()` constant.
92
+ */
93
+ const registeredTraitsIn = (program: TypedProgram, kind: "component" | "resource", trait: string): ReadonlyMap<string, unknown> => {
94
+ const symbols = new Set<string>();
95
+ for (const statement of program.body) {
96
+ const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
97
+ if (declaration?.type !== "VariableDeclaration" || declaration.kind !== "const") continue;
98
+ for (const declarator of declaration.declarations) {
99
+ const init = declarator.init;
100
+ if (declarator.id.type === "Identifier" && init?.type === "CallExpression" && init.callee.type === "Identifier" && init.callee.name === "Symbol") symbols.add(declarator.id.name);
101
+ }
102
+ }
103
+ /** The declaration a call records for a key of `kind` keyed by a `Symbol()` constant, by either form, with its key. */
104
+ const recorded = ({ callee, arguments: parameters }: Call): { readonly key: string; readonly declaration: Expression } | null => {
105
+ const [key, second, third] = parameters;
106
+ if (key?.type !== "Identifier" || !symbols.has(key.name)) return null;
107
+ if (second?.type === "Literal" && second.value === kind && third?.type === "ObjectExpression") return { key: key.name, declaration: third };
108
+ const setsEntry = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" && callee.property.name === "set";
109
+ if (!setsEntry || second?.type !== "ObjectExpression") return null;
110
+ const recordedKind = propertyNamed(second, "kind");
111
+ const declaration = propertyNamed(second, "declaration");
112
+ return recordedKind?.type === "Literal" && recordedKind.value === kind && declaration !== null ? { key: key.name, declaration } : null;
113
+ };
114
+ const found = new Map<string, unknown>();
115
+ for (const statement of program.body) {
116
+ if (statement.type !== "ExpressionStatement") continue;
117
+ for (const call of callsOf(statement.expression)) {
118
+ const entry = recorded(call);
119
+ if (entry === null || entry.declaration.type !== "ObjectExpression") continue;
120
+ const value = propertyNamed(entry.declaration, trait);
121
+ if (value?.type === "Literal") found.set(entry.key, value.value);
122
+ }
123
+ }
124
+ return found;
125
+ };
126
+
127
+ /** The operator each resource a module's generated declarations give it reduces with, by its key's binding (`registeredTraitsIn`). */
128
+ export const registeredReductionsIn = (program: TypedProgram): ReadonlyMap<string, string> =>
129
+ new Map([...registeredTraitsIn(program, "resource", "reduce")].flatMap(([binding, value]) => typeof value === "string" ? [[binding, value] as const] : []));
130
+
131
+ /** The components a module's generated declarations declare shared, by their keys' bindings (`registeredTraitsIn`). */
132
+ export const registeredSharedIn = (program: TypedProgram): ReadonlySet<string> =>
133
+ new Set([...registeredTraitsIn(program, "component", "shared")].flatMap(([binding, value]) => value === true ? [binding] : []));
134
+
135
+ type QueryName = Exclude<Extract<TypeNode, { readonly type: "TSTypeQuery" }>["exprName"], { readonly type: "TSImportType" }>;
136
+
137
+ type TypeName = Extract<TypeNode, { readonly type: "TSTypeReference" }>["typeName"];
138
+
139
+ /** A type reference's name and the namespaces it's read through. */
140
+ const typeNameParts = (name: TypeName | Extract<TypeName, { readonly type: "TSQualifiedName" }>["left"]): readonly string[] =>
141
+ name.type === "Identifier" ? [name.name] : name.type === "TSQualifiedName" ? [...typeNameParts(name.left), name.right.name] : [];
142
+
143
+ /** A `typeof` query's name and the properties read from it; null for `this`. */
144
+ const qualifiedParts = (name: QueryName | Extract<QueryName, { readonly type: "TSQualifiedName" }>["left"]): readonly string[] | null => {
145
+ if (name.type === "Identifier") return [name.name];
146
+ if (name.type !== "TSQualifiedName") return null;
147
+ const left = qualifiedParts(name.left);
148
+ return left === null ? null : [...left, name.right.name];
149
+ };
150
+
151
+ /** The platform's Transferable classes, which `transfer` takes. */
152
+ const transferables: ReadonlySet<string> = new Set([
153
+ "ArrayBuffer", "ImageBitmap", "OffscreenCanvas", "MessagePort", "VideoFrame", "AudioData",
154
+ "ReadableStream", "WritableStream", "TransformStream", "RTCDataChannel",
155
+ ]);
156
+
157
+ /** Tests and their helpers in the package, which declare keys as consumers do. */
158
+ const testModule = /\.(test|type-test|fixture|test-helper|cases)\.tsx?$/;
159
+
160
+ /** Whether a file is one of the package's own modules, whose built-in keys register themselves. */
161
+ const isLibraryModule = (path: string | null, file: string): boolean =>
162
+ path !== null && (path.startsWith("interface/") || path.startsWith("implementation/")) && !testModule.test(file);
163
+
164
+ /** Whether a module's top level binds `name`: imported, or declared by a variable, function or class. */
165
+ const bindsAtTopLevel = (program: TypedProgram, name: string): boolean => program.body.some(statement => {
166
+ if (statement.type === "ImportDeclaration") return statement.specifiers.some(specifier => specifier.local.name === name);
167
+ const declared = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
168
+ if (declared?.type === "VariableDeclaration") return declared.declarations.some(declarator => declarator.id.type === "Identifier" && declarator.id.name === name);
169
+ return (declared?.type === "FunctionDeclaration" || declared?.type === "ClassDeclaration") && declared.id?.name === name;
170
+ });
171
+
172
+ /** `base`, or it numbered, so the name appears nowhere in the code. */
173
+ const uniqueName = (code: string, base: string): string => {
174
+ let name = base;
175
+ for (let n = 1; new RegExp(`${name.replace("$", "\\$")}(?![\\w$])`).test(code); n++) name = `${base}${n}`;
176
+ return name;
177
+ };
178
+
179
+ const allowsNullSchema = (schema: Schema): boolean =>
180
+ ("type" in schema && schema.type === "null") || ("const" in schema && schema.const === null) || ("anyOf" in schema && schema.anyOf.some(allowsNullSchema));
181
+
182
+ /** A value as code: JSON, but -0 and the numbers JSON can't write as themselves. */
183
+ const codeOf = (value: unknown): string => {
184
+ if (Object.is(value, -0)) return "-0";
185
+ if (typeof value === "number" && !Number.isFinite(value)) return Number.isNaN(value) ? "NaN" : value > 0 ? "Infinity" : "-Infinity";
186
+ if (Array.isArray(value)) return `[${value.map(codeOf).join(",")}]`;
187
+ if (typeof value === "object" && value !== null) return `{${Object.entries(value).map(([field, item]) => `${JSON.stringify(field)}:${codeOf(item)}`).join(",")}}`;
188
+ return JSON.stringify(value);
189
+ };
190
+
191
+ /** Whether a schema's value is one a literal default can be: what the build reads from literal types. */
192
+ const isValue = (value: unknown): value is Value =>
193
+ value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean"
194
+ || (Array.isArray(value) ? value.every(isValue) : typeof value === "object" && Object.values(value).every(isValue));
195
+
196
+ /** What a value declared without a default starts at, by its type: a value, a fresh `Map` or `Set` per world, or why neither. */
197
+ type Start = { readonly value: Value } | { readonly fresh: "Map" | "Set" } | { readonly none: string };
198
+
199
+ /** A schema's zero value: 0, false or "", each item's and field's, a union's literal that is one, or a fresh set or map. */
200
+ const zeroOf = (schema: Schema): Start => {
201
+ if ("const" in schema) return { value: schema.const };
202
+ if ("anyOf" in schema) {
203
+ for (const member of schema.anyOf) if ("const" in member && (member.const === 0 || member.const === false || member.const === "")) return { value: member.const };
204
+ return { none: schema.anyOf.every(member => "const" in member) ? `a union of literals without 0, false or "" starts at none of them: declare \`default:\` one of them` : "a union of types starts at none of them" };
205
+ }
206
+ if ("allOf" in schema) return { none: "a value of any type has no zero value" };
207
+ switch (schema.type) {
208
+ case "number": case "integer": {
209
+ const minimum = "minimum" in schema ? schema.minimum ?? -Infinity : -Infinity;
210
+ const maximum = "maximum" in schema ? schema.maximum ?? Infinity : Infinity;
211
+ return minimum <= 0 && maximum >= 0 ? { value: 0 } : { none: "0 isn't one of its values" };
212
+ }
213
+ case "boolean": return { value: false };
214
+ case "string": return (schema.minLength ?? 0) === 0 ? { value: "" } : { none: `"" isn't one of its values` };
215
+ case "null": return { value: null };
216
+ case "set": return { fresh: "Set" };
217
+ case "map": return { fresh: "Map" };
218
+ case "array": {
219
+ const count = schema.minItems ?? 0;
220
+ if (count === 0) return { value: [] };
221
+ if (schema.maxItems !== count) return { none: `an array of ${count} items or more has no zero value` };
222
+ const item = zeroOf(schema.items);
223
+ return "value" in item ? { value: Array.from({ length: count }, () => item.value) } : { none: "fresh" in item ? "an item that's a set or a map has no zero value" : item.none };
224
+ }
225
+ case "object": {
226
+ const value: { [field: string]: Value } = {};
227
+ for (const field of schema.required ?? Object.keys(schema.properties)) {
228
+ const property = schema.properties[field];
229
+ const zero = property === undefined ? { none: "it isn't a property" } : zeroOf(property);
230
+ if (!("value" in zero)) return { none: `its field ${field} starts at nothing: ${"fresh" in zero ? "a set or a map in a struct has no zero value" : zero.none}` };
231
+ value[field] = zero.value;
232
+ }
233
+ return { value };
234
+ }
235
+ }
236
+ };
237
+
238
+ /**
239
+ * What a resource reduced with `operator` starts at when it declares no start: the operator's identity, leaf by leaf,
240
+ * as a fold of no contributions leaves it; null for a schema of other leaves. Used only when it's one of the
241
+ * schema's values.
242
+ */
243
+ const identityOf = (schema: Schema, operator: unknown): Value | null => {
244
+ if ("type" in schema && schema.type === "boolean") return operator === "&";
245
+ if ("type" in schema && (schema.type === "number" || schema.type === "integer")) {
246
+ const minimum = "minimum" in schema ? schema.minimum : undefined;
247
+ const maximum = "maximum" in schema ? schema.maximum : undefined;
248
+ switch (operator) {
249
+ case "+": case "|": case "^": return 0;
250
+ case "*": return 1;
251
+ // Every bit of its column set: u32's all ones, else -1.
252
+ case "&": return minimum !== undefined && minimum >= 0 && maximum !== undefined && maximum <= 0xFFFFFFFF ? 0xFFFFFFFF : -1;
253
+ case "min": return maximum ?? Infinity;
254
+ case "max": return minimum ?? -Infinity;
255
+ default: return null;
256
+ }
257
+ }
258
+ if ("type" in schema && schema.type === "array" && schema.minItems !== undefined && schema.minItems === schema.maxItems) {
259
+ const item = identityOf(schema.items, operator);
260
+ return item === null ? null : Array.from({ length: schema.minItems }, () => item);
261
+ }
262
+ if ("type" in schema && schema.type === "object") {
263
+ const value: { [field: string]: Value } = {};
264
+ for (const [field, property] of Object.entries(schema.properties)) {
265
+ const leaf = identityOf(property, operator);
266
+ if (leaf === null) return null;
267
+ value[field] = leaf;
268
+ }
269
+ return value;
270
+ }
271
+ return null;
272
+ };
273
+
274
+ /**
275
+ * Registers what each `declare module "@adobe/ecs"` block declares, so consumers never write registration: each
276
+ * component and resource of `Components` and `Resources`, with the schema of its `type`, its `default` and its other
277
+ * traits as declared, and each trait of `Traits` keyed by a symbol. A key is a top-level `Symbol()` constant of this
278
+ * module, so importing a key registers it: its registration comes right after it, after any binding its declaration
279
+ * names, and after a trait of this module it declares, wherever the block is. A literal default and the built-in
280
+ * traits' values are checked as far as literals and types show. A resource or derived component without a literal
281
+ * default starts at its type's: its namespaced schema's, null, a zero value, or a fresh `Map` or `Set` per world.
282
+ * Returns null when the module declares nothing.
283
+ */
284
+ export const augmentationInsertions = async (module: Module, host: AugmentationHost): Promise<PassResult | null> => {
285
+ const { code, file } = module;
286
+ if (!code.includes("@adobe/ecs") || !code.includes("declare module") || isLibraryModule(host.packagePath(file), file)) return null;
287
+ const augmentations = augmentationsOf(module);
288
+ if (augmentations.length === 0) return null;
289
+ const converter = createConverter(host, file);
290
+ const { fail } = converter;
291
+ const insertions: Insertion[] = [];
292
+ // A name the module doesn't use for the function appended to record its declarations.
293
+ const record = uniqueName(code, "declare$");
294
+
295
+ /**
296
+ * Where a local binding has its value, which a registration naming it comes after: the end of the top-level
297
+ * statement declaring it, and 0 for a function, hoisted with its value, or anything imported.
298
+ */
299
+ const endOfLocal = (name: string): number => {
300
+ for (const statement of module.program.body) {
301
+ const declared = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
302
+ if (declared?.type === "VariableDeclaration" && declared.declarations.some(declarator => declarator.id.type === "Identifier" && declarator.id.name === name)) return statement.end;
303
+ if ((declared?.type === "ClassDeclaration" || declared?.type === "TSEnumDeclaration") && declared.id?.name === name) return statement.end;
304
+ }
305
+ return 0;
306
+ };
307
+
308
+ /** Whether an initializer is a call of the global `Symbol`. */
309
+ const isSymbolCall = (init: Declarator["init"]): boolean => {
310
+ let expression = init;
311
+ while (expression !== null && (expression.type === "TSAsExpression" || expression.type === "TSSatisfiesExpression" || expression.type === "ParenthesizedExpression")) expression = expression.expression;
312
+ return expression?.type === "CallExpression" && expression.callee.type === "Identifier" && expression.callee.name === "Symbol";
313
+ };
314
+
315
+ /**
316
+ * Fails unless a key a block declares is a top-level `Symbol()` constant of this module, so importing the key
317
+ * registers it.
318
+ */
319
+ const requireOwnKey = (name: string, at: Node, what: string): void => {
320
+ const imported = module.imports.get(name);
321
+ if (imported !== undefined) fail(module, at, `${what} ${name} is imported from "${imported.source}": declare it in the module that declares the key`);
322
+ if (!isSymbolCall(module.constants.get(name)?.init ?? null)) fail(module, at, `${what} ${name} is a top-level \`Symbol()\` constant of this module`);
323
+ };
324
+
325
+ /** Fails unless a trait key a declaration names is a `Symbol()` constant, here or imported as a value. */
326
+ const requireTraitKey = async (name: string, at: Node): Promise<void> => {
327
+ const imported = module.imports.get(name);
328
+ if (imported !== undefined && !imported.value) fail(module, at, `a trait's key names ${name}, imported as a type only: import it as a value, which the registration passes`);
329
+ const found = await converter.constantNamed([name], module);
330
+ if (!isSymbolCall(found?.declaration.init ?? null)) fail(module, at, `a trait's key ${name} is a top-level \`Symbol()\` constant, of this module or one it imports`);
331
+ };
332
+
333
+ /** Whether a type, as written, allows `null`, through the aliases it names. */
334
+ const allowsNullType = async (type: TypeNode, at: Module, seen: Set<object>): Promise<boolean> => {
335
+ if (type.type === "TSNullKeyword") return true;
336
+ if (type.type === "TSParenthesizedType") return await allowsNullType(type.typeAnnotation, at, seen);
337
+ if (type.type === "TSUnionType") {
338
+ for (const member of type.types) if (await allowsNullType(member, at, seen)) return true;
339
+ return false;
340
+ }
341
+ if (type.type !== "TSTypeReference" || type.typeArguments !== null) return false;
342
+ const found = await converter.typeNamed(typeNameParts(type.typeName), at);
343
+ if (found === null || typeof found === "string" || found.declaration.type !== "TSTypeAliasDeclaration" || seen.has(found.declaration)) return false;
344
+ seen.add(found.declaration);
345
+ return await allowsNullType(found.declaration.typeAnnotation, found.module, seen);
346
+ };
347
+
348
+ /** Whether a type, as written, is a Transferable class, or one or null, through the aliases it names. */
349
+ const isTransferableType = async (type: TypeNode, at: Module, seen: Set<object>): Promise<boolean> => {
350
+ if (type.type === "TSParenthesizedType") return await isTransferableType(type.typeAnnotation, at, seen);
351
+ if (type.type === "TSUnionType") {
352
+ const members = type.types.filter(member => member.type !== "TSNullKeyword");
353
+ if (members.length === 0) return false;
354
+ for (const member of members) if (!await isTransferableType(member, at, seen)) return false;
355
+ return true;
356
+ }
357
+ if (type.type !== "TSTypeReference" || type.typeArguments !== null) return false;
358
+ const parts = typeNameParts(type.typeName);
359
+ const found = await converter.typeNamed(parts, at);
360
+ if (found === "global") return parts.length === 1 && transferables.has(parts[0] ?? "");
361
+ if (found === null || typeof found === "string" || found.declaration.type !== "TSTypeAliasDeclaration" || seen.has(found.declaration)) return false;
362
+ seen.add(found.declaration);
363
+ return await isTransferableType(found.declaration.typeAnnotation, found.module, seen);
364
+ };
365
+
366
+ /** Fails for a built-in trait whose value, or whose key's type, its literal and type show can't hold. */
367
+ const checkBuiltIns = async (name: string, kind: "component" | "resource", type: TypeNode, schema: Schema | undefined, builtIns: ReadonlyMap<string, { readonly node: TypeNode; readonly text: string }>): Promise<void> => {
368
+ const derived = builtIns.get("derived");
369
+ if (derived !== undefined && derived.text !== "true") fail(module, derived.node, `${name}'s derived is \`true\``);
370
+ if (derived !== undefined && kind !== "component") fail(module, derived.node, `${name} is a resource: only a component is derived`);
371
+ const reference = builtIns.get("reference");
372
+ if (reference !== undefined && reference.text !== `"owner"` && reference.text !== `"weak"`) fail(module, reference.node, `${name}'s reference is "owner" or "weak"`);
373
+ if (reference !== undefined && (schema === undefined || !isEntity(schema))) fail(module, reference.node, `${name} is a reference, so a reference's type is Entity`);
374
+ const within = builtIns.get("within");
375
+ if (within !== undefined) {
376
+ const host = within.node.type === "TSTypeQuery" && within.node.exprName.type === "Identifier" ? within.node.exprName.name : null;
377
+ const found = host === null ? null : await converter.constantNamed([host], module);
378
+ if (found === null || !isSymbolCall(found.declaration.init)) fail(module, within.node, `${name}'s within is \`typeof\` a component's key, a \`Symbol()\` constant`);
379
+ }
380
+ const transfer = builtIns.get("transfer");
381
+ if (transfer !== undefined && (transfer.text !== "true" || schema !== undefined || !await isTransferableType(type, module, new Set()))) {
382
+ fail(module, transfer.node, `${name}'s transfer takes a Transferable class: ${[...transferables].join(", ")}`);
383
+ }
384
+ const reduce = builtIns.get("reduce");
385
+ if (reduce !== undefined && kind !== "resource") fail(module, reduce.node, `${name} is a component: only a resource is reduced`);
386
+ if (reduce !== undefined && !reductionOperators.some(operator => JSON.stringify(operator) === reduce.text)) fail(module, reduce.node, `${name}'s reduce is one of ${reductionOperators.map(operator => `"${operator}"`).join(", ")}`);
387
+ const placed = builtIns.get("thread");
388
+ if (placed !== undefined && !/^"[^"]+"$/.test(placed.text)) fail(module, placed.node, `${name}'s thread is a thread's name`);
389
+ if (placed !== undefined && schema !== undefined && isString(schema)) fail(module, placed.node, `${name} is a string: a string lives in shared memory, so it has no thread`);
390
+ if (placed !== undefined && schema !== undefined && isStruct(schema)) fail(module, placed.node, `${name} is a struct: a struct lives in shared memory, so it has no thread`);
391
+ const shared = builtIns.get("shared");
392
+ if (shared !== undefined) {
393
+ if (shared.text !== "true") fail(module, shared.node, `${name}'s shared is \`true\``);
394
+ if (kind !== "component") fail(module, shared.node, `${name} is a resource: only a component is shared`);
395
+ if (schema === undefined || !isComparable(schema)) fail(module, shared.node, `${name} is shared, so its value is comparable data: numbers, booleans, strings, and arrays and objects of those`);
396
+ if (placed !== undefined) fail(module, placed.node, `${name} is shared: a shared value lives in shared memory, so it has no thread`);
397
+ if (derived !== undefined) fail(module, derived.node, `${name} is shared, so it isn't derived: its rule would add it with its default`);
398
+ if (reference !== undefined) fail(module, reference.node, `${name} is shared, so it isn't a reference: its target despawning acts on each holder`);
399
+ }
400
+ };
401
+
402
+ /** An expression without the casts and parentheses around it. */
403
+ const unwrapped = (expression: Declarator["init"]): Declarator["init"] => {
404
+ let inner = expression;
405
+ while (inner !== null && (inner.type === "TSAsExpression" || inner.type === "TSSatisfiesExpression" || inner.type === "TSNonNullExpression" || inner.type === "ParenthesizedExpression")) inner = inner.expression;
406
+ return inner;
407
+ };
408
+
409
+ /** The names a name or a chain of non-computed property reads reads; null for any other expression. */
410
+ const pathOf = (expression: NonNullable<Declarator["init"]>): readonly string[] | null => {
411
+ if (expression.type === "Identifier") return [expression.name];
412
+ if (expression.type !== "MemberExpression" || expression.computed || expression.property.type !== "Identifier" || expression.object.type === "Super") return null;
413
+ const object = pathOf(expression.object);
414
+ return object === null ? null : [...object, expression.property.name];
415
+ };
416
+
417
+ /** A value as its module writes it, and whether an `as const` around it makes what it writes in place readonly. */
418
+ type Written = { readonly expression: NonNullable<Declarator["init"]>; readonly module: Module; readonly constant: boolean; readonly annotation?: TypeNode };
419
+
420
+ /**
421
+ * The outermost assertion on an expression, under parentheses, `satisfies` and `!`: "const" for `as const`, the
422
+ * type of any other `as`, or null without one.
423
+ */
424
+ const outerAssertion = (expression: Declarator["init"]): "const" | TypeNode | null => {
425
+ let inner = expression;
426
+ while (inner !== null && (inner.type === "TSSatisfiesExpression" || inner.type === "TSNonNullExpression" || inner.type === "ParenthesizedExpression")) inner = inner.expression;
427
+ if (inner?.type !== "TSAsExpression") return null;
428
+ const { typeAnnotation } = inner;
429
+ return typeAnnotation.type === "TSTypeReference" && typeAnnotation.typeName.type === "Identifier" && typeAnnotation.typeName.name === "const" ? "const" : typeAnnotation;
430
+ };
431
+
432
+ /** Whether an expression's outermost assertion is `as const`. */
433
+ const isConstAssertion = (expression: Declarator["init"]): boolean => outerAssertion(expression) === "const";
434
+
435
+ /** The `default` property's value of an object a module writes: in place, or through constants and spreads. */
436
+ const defaultProperty = async (expression: Declarator["init"], at: Module, constant: boolean, seen: Set<object>): Promise<Written | null> => {
437
+ const value = unwrapped(expression);
438
+ if (value === null || seen.has(value)) return null;
439
+ seen.add(value);
440
+ const inConst = constant || isConstAssertion(expression);
441
+ if (value.type === "Identifier" || value.type === "MemberExpression") {
442
+ const path = pathOf(value);
443
+ const found = path === null ? null : await converter.constantNamed(path, at);
444
+ return found === null ? null : await defaultProperty(found.declaration.init, found.module, false, seen);
445
+ }
446
+ if (value.type !== "ObjectExpression") return null;
447
+ for (const property of value.properties) {
448
+ if (property.type === "SpreadElement") {
449
+ const found = await defaultProperty(property.argument, at, inConst, seen);
450
+ if (found !== null) return found;
451
+ }
452
+ else if (!property.computed && property.key.type === "Identifier" && property.key.name === "default") {
453
+ return { expression: property.value, module: at, constant: inConst };
454
+ }
455
+ }
456
+ return null;
457
+ };
458
+
459
+ /** The value of a type's namespace's `default`, as `Vec3` names its namespace beside its type: a namespace's export, or a constant object's property. */
460
+ const defaultWritten = async (path: readonly string[]): Promise<Written | null> => {
461
+ const member = await converter.constantNamed([...path, "default"], module);
462
+ if (member !== null && member.declaration.init !== null) {
463
+ const annotation = member.declaration.id.type === "Identifier" ? member.declaration.id.typeAnnotation?.typeAnnotation : undefined;
464
+ return { expression: member.declaration.init, module: member.module, constant: false, annotation };
465
+ }
466
+ const holder = await converter.constantNamed(path, module);
467
+ return holder === null ? null : await defaultProperty(holder.declaration.init, holder.module, false, new Set());
468
+ };
469
+
470
+ /**
471
+ * Whether a type is deeply readonly as written: no array, field, map or set of it can change in place. `fields`
472
+ * takes an object's fields as readonly, as `Readonly<...>` makes them.
473
+ */
474
+ const readonlyType = async (type: TypeNode, at: Module, seen: Set<object>, fields = false): Promise<boolean> => {
475
+ switch (type.type) {
476
+ case "TSNumberKeyword": case "TSStringKeyword": case "TSBooleanKeyword": case "TSBigIntKeyword": case "TSNullKeyword": case "TSUndefinedKeyword": case "TSLiteralType": return true;
477
+ case "TSParenthesizedType": return await readonlyType(type.typeAnnotation, at, seen);
478
+ case "TSUnionType": return (await Promise.all(type.types.map(member => readonlyType(member, at, seen)))).every(Boolean);
479
+ case "TSTypeOperator": {
480
+ if (type.operator !== "readonly") return false;
481
+ const inner = type.typeAnnotation.type === "TSParenthesizedType" ? type.typeAnnotation.typeAnnotation : type.typeAnnotation;
482
+ if (inner.type === "TSArrayType") return await readonlyType(inner.elementType, at, seen);
483
+ if (inner.type === "TSTupleType") {
484
+ return (await Promise.all(inner.elementTypes.map(element => element.type === "TSOptionalType" || element.type === "TSRestType" || element.type === "TSNamedTupleMember" ? false : readonlyType(element, at, seen)))).every(Boolean);
485
+ }
486
+ return false;
487
+ }
488
+ case "TSTypeLiteral": {
489
+ for (const member of type.members) {
490
+ if (member.type !== "TSPropertySignature" || (member.readonly !== true && !fields) || member.typeAnnotation === null || !await readonlyType(member.typeAnnotation.typeAnnotation, at, seen)) return false;
491
+ }
492
+ return true;
493
+ }
494
+ case "TSTypeReference": {
495
+ const parts = typeNameParts(type.typeName);
496
+ const parameters = type.typeArguments?.params ?? [];
497
+ const [only] = parts;
498
+ if (parts.length === 1 && only !== undefined && !at.types.has(only) && !at.imports.has(only) && (only === "ReadonlyMap" || only === "ReadonlySet" || only === "ReadonlyArray")) {
499
+ return (await Promise.all(parameters.map(parameter => readonlyType(parameter, at, seen)))).every(Boolean);
500
+ }
501
+ const [argument] = parameters;
502
+ if (parts.length === 1 && only === "Readonly" && !at.types.has(only) && !at.imports.has(only) && argument !== undefined) return await readonlyType(argument, at, seen, true);
503
+ const found = await converter.typeNamed(parts, at);
504
+ if (found === null || typeof found === "string" || seen.has(found.declaration)) return false;
505
+ // A type a schema names, as the package's math types are, is a readonly value.
506
+ if (host.packagePath(found.module.file) === "interface/schema/schema" && found.declaration.id?.name === "Type") return true;
507
+ if (host.packagePath(found.module.file) === "interface/entity/entity" && found.declaration.id?.name === "Entity") return true;
508
+ seen.add(found.declaration);
509
+ if (found.declaration.type === "TSTypeAliasDeclaration") return found.declaration.typeParameters === null && await readonlyType(found.declaration.typeAnnotation, found.module, seen, fields);
510
+ if (found.declaration.type !== "TSInterfaceDeclaration" || found.declaration.extends.length > 0) return false;
511
+ for (const member of found.declaration.body.body) {
512
+ if (member.type !== "TSPropertySignature" || (member.readonly !== true && !fields) || member.typeAnnotation === null || !await readonlyType(member.typeAnnotation.typeAnnotation, found.module, seen)) return false;
513
+ }
514
+ return true;
515
+ }
516
+ default: return false;
517
+ }
518
+ };
519
+
520
+ /** Where a value a module writes isn't evidently readonly: the part that isn't, and why. */
521
+ type Unreadonly = { readonly module: Module; readonly expression: NonNullable<Declarator["init"]>; readonly why: string };
522
+
523
+ /** The source text of a part of a module, for failures. */
524
+ const textOf = (at: Module, expression: { readonly start: number; readonly end: number }): string => at.code.slice(expression.start, expression.end);
525
+
526
+ /**
527
+ * Where a value a module writes isn't deeply readonly by its type, or null when it is: a literal, `as const` data, a
528
+ * binding typed readonly, or a call of a function whose declared return type is readonly.
529
+ */
530
+ const unreadonly = async (written: Written, seen: Set<object>): Promise<Unreadonly | null> => {
531
+ const { module: at, annotation, expression } = written;
532
+ const failing = (why: string): Unreadonly => ({ module: at, expression, why: `\`${textOf(at, expression)}\` ${why}` });
533
+ if (annotation !== undefined) return await readonlyType(annotation, at, seen) ? null : failing("is typed with a type that isn't readonly");
534
+ // A cast to a type is that type, whatever `as const` around it says.
535
+ const assertion = outerAssertion(expression);
536
+ if (assertion !== null && assertion !== "const") return await readonlyType(assertion, at, seen) ? null : failing("is cast to a type that isn't readonly");
537
+ const constant = written.constant || assertion === "const";
538
+ const value = unwrapped(expression);
539
+ if (value === null || seen.has(value)) return failing("isn't a value the build can read");
540
+ seen.add(value);
541
+ const each = async (items: readonly Written[]): Promise<Unreadonly | null> => {
542
+ for (const item of items) {
543
+ const found = await unreadonly(item, seen);
544
+ if (found !== null) return found;
545
+ }
546
+ return null;
547
+ };
548
+ switch (value.type) {
549
+ case "Literal": return null;
550
+ case "TemplateLiteral": return value.expressions.length === 0 ? null : failing("isn't a literal");
551
+ case "UnaryExpression":
552
+ return value.operator === "-" && (value.argument.type === "Literal" || (value.argument.type === "Identifier" && (value.argument.name === "Infinity" || value.argument.name === "NaN"))) ? null : failing("isn't a literal");
553
+ case "ArrayExpression": {
554
+ if (!constant) return failing("isn't under `as const`");
555
+ const items: Written[] = [];
556
+ for (const element of value.elements) {
557
+ if (element === null || element.type === "SpreadElement") return failing("spreads or skips items, which the build can't see are readonly");
558
+ items.push({ expression: element, module: at, constant });
559
+ }
560
+ return await each(items);
561
+ }
562
+ case "ObjectExpression": {
563
+ if (!constant) return failing("isn't under `as const`");
564
+ const fields: Written[] = [];
565
+ for (const property of value.properties) {
566
+ if (property.type === "SpreadElement" || property.computed) return failing("spreads or computes a field, which the build can't see is readonly");
567
+ fields.push({ expression: property.value, module: at, constant });
568
+ }
569
+ return await each(fields);
570
+ }
571
+ case "CallExpression": {
572
+ const path = value.callee.type === "Super" ? null : pathOf(value.callee);
573
+ const returned = path === null ? null : await converter.returnTypeNamed(path, at);
574
+ if (returned === null) return failing("calls a function the build can't find");
575
+ if (returned === undefined) return failing("returns a type the build can't see is readonly: annotate its return type");
576
+ return await readonlyType(returned.type, returned.module, seen) ? null : failing("returns a type that isn't readonly");
577
+ }
578
+ case "Identifier": case "MemberExpression": {
579
+ if (value.type === "Identifier" && (value.name === "Infinity" || value.name === "NaN" || value.name === "undefined")) return null;
580
+ const path = pathOf(value);
581
+ const found = path === null ? null : await converter.constantNamed(path, at);
582
+ if (found === null || found.declaration.init === null) return failing("names a value the build can't read");
583
+ const declared = found.declaration.id.type === "Identifier" ? found.declaration.id.typeAnnotation?.typeAnnotation : undefined;
584
+ return await unreadonly({ expression: found.declaration.init, module: found.module, constant: false, annotation: declared }, seen);
585
+ }
586
+ default: return failing("isn't a literal, `as const` data, a constant typed readonly or a call returning a readonly type");
587
+ }
588
+ };
589
+
590
+ /** The value a module writes, when it's data the build reads: literals, and arrays and objects of them, through constants; else undefined. */
591
+ const staticValue = async (written: Written, seen: Set<object>): Promise<Value | undefined> => {
592
+ const value = unwrapped(written.expression);
593
+ if (value === null || seen.has(value)) return undefined;
594
+ seen.add(value);
595
+ const at = written.module;
596
+ switch (value.type) {
597
+ case "Literal": return typeof value.value === "string" || typeof value.value === "number" || typeof value.value === "boolean" || value.value === null ? value.value : undefined;
598
+ case "UnaryExpression":
599
+ if (value.operator !== "-") return undefined;
600
+ if (value.argument.type === "Identifier" && (value.argument.name === "Infinity" || value.argument.name === "NaN")) return -(value.argument.name === "Infinity" ? Infinity : NaN);
601
+ return value.argument.type === "Literal" && typeof value.argument.value === "number" ? -value.argument.value : undefined;
602
+ case "ArrayExpression": {
603
+ const items: Value[] = [];
604
+ for (const element of value.elements) {
605
+ const item = element === null || element.type === "SpreadElement" ? undefined : await staticValue({ expression: element, module: at, constant: written.constant }, seen);
606
+ if (item === undefined) return undefined;
607
+ items.push(item);
608
+ }
609
+ return items;
610
+ }
611
+ case "ObjectExpression": {
612
+ const fields: { [field: string]: Value } = {};
613
+ for (const property of value.properties) {
614
+ if (property.type === "SpreadElement" || property.computed || property.key.type !== "Identifier") return undefined;
615
+ const field = await staticValue({ expression: property.value, module: at, constant: written.constant }, seen);
616
+ if (field === undefined) return undefined;
617
+ fields[property.key.name] = field;
618
+ }
619
+ return fields;
620
+ }
621
+ case "Identifier": case "MemberExpression": {
622
+ if (value.type === "Identifier" && (value.name === "Infinity" || value.name === "NaN")) return value.name === "Infinity" ? Infinity : NaN;
623
+ const path = pathOf(value);
624
+ const found = path === null ? null : await converter.constantNamed(path, at);
625
+ return found === null || found.declaration.init === null ? undefined : await staticValue({ expression: found.declaration.init, module: found.module, constant: false }, seen);
626
+ }
627
+ default: return undefined;
628
+ }
629
+ };
630
+
631
+ /**
632
+ * A declaration's type's namespace's default, `T.default`, as code reading it, and the local binding it reads; null
633
+ * without one. Checked against `schema` when the build can read it. `oneObject` is for a start a joined thread
634
+ * knows by identity, which is read, never copied.
635
+ */
636
+ const namespacedDefault = async (type: TypeNode, name: string, schema: Schema | undefined, oneObject: boolean): Promise<{ readonly text: string; readonly value?: Value; readonly local?: string; readonly packaged: boolean } | null> => {
637
+ const inner = type.type === "TSParenthesizedType" ? type.typeAnnotation : type;
638
+ if (inner.type !== "TSTypeReference" || inner.typeArguments !== null) return null;
639
+ const path = typeNameParts(inner.typeName);
640
+ const [first] = path;
641
+ const written = first === undefined ? null : await defaultWritten(path);
642
+ if (first === undefined || written === null) return null;
643
+ // The package's own types' defaults are their zero values and identities, which a reduction's identity outranks.
644
+ const packaged = host.packagePath(written.module.file) !== null;
645
+ const mutable = await unreadonly(written, new Set());
646
+ if (mutable !== null) {
647
+ fail(mutable.module, mutable.expression, `${path.join(".")}.default is shared by every row and world that starts from it, so it's deeply readonly, but ${mutable.why}. Readonly values are \`const ${path.at(-1) ?? "T"} = { default: ... } as const\`, consts typed readonly (ReadonlyMap, ReadonlySet, Readonly<...>, readonly arrays and fields), and calls of functions whose declared return type is readonly`);
648
+ }
649
+ const value = await staticValue(written, new Set());
650
+ if (schema !== undefined && value !== undefined && !matchesSchema(schema, value)) fail(written.module, written.expression, `${path.join(".")}.default, ${codeOf(value)}, isn't one of its type's values`);
651
+ const imported = module.imports.get(first);
652
+ if (imported !== undefined && !imported.value) {
653
+ // Imported as a type alone, the namespace can't be read here, so a default the build can read is written in.
654
+ if (value === undefined || (oneObject && typeof value === "object" && value !== null)) {
655
+ fail(module, inner, `${name}'s type ${path.join(".")} starts at ${path.join(".")}.default${oneObject ? ", one object a joined thread knows by identity" : ""}: import ${first} as a value, which the registration reads`);
656
+ }
657
+ return { text: codeOf(value ?? null), value: value ?? null, packaged };
658
+ }
659
+ return { text: `${path.join(".")}.default`, local: imported === undefined ? first : undefined, packaged };
660
+ };
661
+
662
+ /**
663
+ * A start as code, the local bindings it reads, whether a namespace or an identity gave it, not zero values alone,
664
+ * and its value when it's data the build wrote in.
665
+ */
666
+ type Started = { readonly text: string; readonly locals: readonly string[]; readonly given: boolean; readonly value?: Value };
667
+
668
+ /**
669
+ * What a value of `type`, of `schema`, starts at as code: its namespace's default of yours; else for a reduction by
670
+ * `operator`, its identity when that's one of its values; else the package's namespace's; else each field of a
671
+ * struct and item of a tuple by these rules; else its zero value, as `zeroOf` says.
672
+ */
673
+ const startOf = async (type: TypeNode, schema: Schema, operator: unknown, oneObject: boolean): Promise<Started | { readonly fresh: "Map" | "Set" } | { readonly none: string }> => {
674
+ const unwrapped = type.type === "TSParenthesizedType" ? type.typeAnnotation : type;
675
+ const inner = unwrapped.type === "TSTypeOperator" && unwrapped.operator === "readonly" && unwrapped.typeAnnotation !== undefined ? unwrapped.typeAnnotation : unwrapped;
676
+ const namespaced = await namespacedDefault(inner, "it", schema, oneObject);
677
+ const named = namespaced === null ? null : { text: namespaced.text, value: namespaced.value, locals: namespaced.local === undefined ? [] : [namespaced.local], given: true };
678
+ if (named !== null && namespaced !== null && !namespaced.packaged) return named;
679
+ const parts = inner.type === "TSTypeLiteral" && "type" in schema && schema.type === "object"
680
+ ? inner.members.flatMap(field => field.type === "TSPropertySignature" && !field.computed && field.key.type === "Identifier" && field.typeAnnotation !== null
681
+ ? [{ name: field.key.name, type: field.typeAnnotation.typeAnnotation, schema: schema.properties[field.key.name] }] : [])
682
+ : inner.type === "TSTupleType" && "type" in schema && schema.type === "array"
683
+ ? inner.elementTypes.flatMap((element, k) => element.type === "TSOptionalType" || element.type === "TSRestType" || element.type === "TSNamedTupleMember" ? [] : [{ name: String(k), type: element, schema: schema.items }])
684
+ : null;
685
+ if (parts === null || parts.length === 0) {
686
+ const identity = operator === null ? null : identityOf(schema, operator);
687
+ if (identity !== null && matchesSchema(schema, identity)) return { text: codeOf(identity), value: identity, locals: [], given: true };
688
+ if (named !== null) return named;
689
+ const zero = zeroOf(schema);
690
+ return "value" in zero ? { text: codeOf(zero.value), value: zero.value, locals: [], given: false } : zero;
691
+ }
692
+ const texts: string[] = [];
693
+ const locals: string[] = [];
694
+ const values: Value[] = [];
695
+ const fields: { [field: string]: Value } = {};
696
+ let given = false;
697
+ let data = true;
698
+ for (const part of parts) {
699
+ const started = part.schema === undefined ? { none: "it isn't a property" } : await startOf(part.type, part.schema, operator, false);
700
+ if (!("text" in started)) return { none: `its ${inner.type === "TSTupleType" ? "item" : "field"} ${part.name} starts at nothing: ${"fresh" in started ? "a set or a map in a struct has no zero value" : started.none}` };
701
+ texts.push(inner.type === "TSTupleType" ? started.text : `${JSON.stringify(part.name)}: ${started.text}`);
702
+ locals.push(...started.locals);
703
+ given ||= started.given;
704
+ if (started.value === undefined) data = false;
705
+ else {
706
+ values.push(started.value);
707
+ fields[part.name] = started.value;
708
+ }
709
+ }
710
+ // With zero values alone, the schema's zero value says the same, as data.
711
+ if (!given) {
712
+ const zero = zeroOf(schema);
713
+ if ("value" in zero) return { text: codeOf(zero.value), value: zero.value, locals, given };
714
+ }
715
+ if (data) {
716
+ const value = inner.type === "TSTupleType" ? values : fields;
717
+ return { text: codeOf(value), value, locals, given };
718
+ }
719
+ return { text: inner.type === "TSTupleType" ? `[${texts.join(", ")}]` : `{ ${texts.join(", ")} }`, locals, given };
720
+ };
721
+
722
+ /** A declared default: a literal type, never `typeof` a value. */
723
+ const literalDefault = async (type: TypeNode, name: string): Promise<Value> => {
724
+ if (type.type === "TSTypeQuery") fail(module, type, `${name}'s default is a literal type, never \`typeof\` a value: without one, it starts at its type's namespace's \`default\`, its reduction's identity, null, or its type's zero value`);
725
+ return await converter.valueOfType(type, module, new Set());
726
+ };
727
+
728
+ /** How to give a type's values a start no zero value gives: a literal, or its type's namespace's `default`. */
729
+ const workaround = (type: TypeNode): string => {
730
+ const name = type.type === "TSTypeReference" && type.typeArguments === null ? typeNameParts(type.typeName).join(".") : null;
731
+ return name === null
732
+ ? "declare `default:` as a literal, or name its type and give the type a namespace with a `default`: `type Start = ...; const Start = { default: ... }`"
733
+ : `declare \`default:\` as a literal, or give ${name} a namespace with a \`default\`: \`const ${name} = { default: ... }\``;
734
+ };
735
+
736
+ /** Where a trait a block of this module declares is registered, which what declares it comes after. */
737
+ const traitPoints = new Map<string, number>();
738
+
739
+ /** A trait's value as code: a literal, or `typeof` a value, which names it; and that value's local binding. */
740
+ const valueText = async (type: TypeNode, what: string): Promise<{ readonly text: string; readonly value?: Value; readonly local?: string }> => {
741
+ if (type.type === "TSTypeQuery") {
742
+ const named = type.exprName.type === "TSImportType" ? null : qualifiedParts(type.exprName);
743
+ const [first] = named ?? [];
744
+ if (named === null || first === undefined || type.typeArguments !== null) return fail(module, type, `${what} is a literal type, or \`typeof\` a value`);
745
+ const imported = module.imports.get(first);
746
+ if (imported !== undefined && !imported.value) fail(module, type, `${what} names ${first}, imported as a type only: import it as a value, which the registration passes`);
747
+ return { text: named.join("."), local: imported === undefined ? first : undefined };
748
+ }
749
+ const value = await converter.valueOfType(type, module, new Set());
750
+ return { text: codeOf(value), value };
751
+ };
752
+
753
+ try {
754
+ const shadowed = ["globalThis", "Symbol", "Map"].find(name => bindsAtTopLevel(module.program, name));
755
+ const first = augmentations[0];
756
+ if (shadowed !== undefined && first !== undefined) fail(module, first.block, `the module binds ${shadowed}, which the code recording its declarations uses`);
757
+ // Traits first, so a component declaring one registers after it.
758
+ const ordered = augmentations.flatMap(({ block, interfaces }) => interfaces.map(declared => ({ block, declared })))
759
+ .sort((a, b) => Number(b.declared.id.name === "Traits") - Number(a.declared.id.name === "Traits"));
760
+ for (const { declared } of ordered) {
761
+ const interfaceName = declared.id.name;
762
+ if (!isKind(interfaceName)) continue;
763
+ const kind = kinds[interfaceName];
764
+ for (const member of declared.body.body) {
765
+ if (member.type !== "TSPropertySignature") {
766
+ if (member.type === "TSIndexSignature" || member.type === "TSMethodSignature") fail(module, member, `${interfaceName}'s members are keys and their declarations`);
767
+ continue;
768
+ }
769
+ const { key } = member;
770
+ if (kind === "trait") {
771
+ // String-named traits are the package's own.
772
+ if (!member.computed || key.type !== "Identifier") return fail(module, member, "a trait of your own is keyed by a `Symbol()` constant: `[layer]: ...`");
773
+ requireOwnKey(key.name, member, "a trait's key");
774
+ const point = endOfLocal(key.name);
775
+ traitPoints.set(key.name, point);
776
+ insertions.push({ at: point, text: `\n${record}(${key.name}, "trait");` });
777
+ continue;
778
+ }
779
+ if (!member.computed || key.type !== "Identifier") return fail(module, member, `a ${kind}'s key is a \`Symbol()\` constant, declared as \`[key]: { type: ... }\``);
780
+ requireOwnKey(key.name, member, `a ${kind}'s key`);
781
+ const declaration = member.typeAnnotation?.typeAnnotation;
782
+ if (declaration?.type !== "TSTypeLiteral") return fail(module, member, `${key.name}'s declaration is a type literal of its traits: \`{ type: ... }\``);
783
+ converter.site.at = member.start;
784
+ let at = endOfLocal(key.name);
785
+ let typeNode: TypeNode | undefined;
786
+ let defaultNode: TypeNode | undefined;
787
+ const traits: string[] = [];
788
+ let thread = false;
789
+ /** The built-in traits declared, by name: their values' types and code. */
790
+ const builtIns = new Map<string, { readonly node: TypeNode; readonly text: string }>();
791
+ for (const trait of declaration.members) {
792
+ if (trait.type !== "TSPropertySignature" || trait.typeAnnotation === null) return fail(module, trait, `${key.name}'s traits are properties with values`);
793
+ const property: Property = trait;
794
+ const value = trait.typeAnnotation.typeAnnotation;
795
+ const name = !property.computed && property.key.type === "Identifier" ? property.key.name
796
+ : property.computed && property.key.type === "Identifier" ? null
797
+ : fail(module, trait, `${key.name}'s traits are named, or keyed by a trait's \`Symbol()\` constant`);
798
+ if (name === "type") typeNode = value;
799
+ else if (name === "default") defaultNode = value;
800
+ else {
801
+ const text = await valueText(value, `${key.name}'s trait`);
802
+ if (text.local !== undefined) at = Math.max(at, endOfLocal(text.local));
803
+ if (name === "thread") thread = true;
804
+ if (name !== null) builtIns.set(name, { node: value, text: text.text });
805
+ if (name === null && property.key.type === "Identifier") {
806
+ await requireTraitKey(property.key.name, trait);
807
+ at = Math.max(at, endOfLocal(property.key.name), traitPoints.get(property.key.name) ?? 0);
808
+ }
809
+ traits.push(name === null ? `[${property.key.type === "Identifier" ? property.key.name : ""}]: ${text.text}` : `${name}: ${text.text}`);
810
+ }
811
+ }
812
+ if (typeNode === undefined) return fail(module, member, `${key.name} declares its type: \`{ type: ... }\``);
813
+ let schema: Schema | undefined;
814
+ try {
815
+ schema = await converter.convert(typeNode, module, new Set(), "declaration");
816
+ }
817
+ catch (error) {
818
+ if (!isNotData(error)) throw error;
819
+ if (error.notData.node && !thread) fail(module, member, `${key.name} is a DOM Node, which lives on "main": declare \`thread: "main"\``);
820
+ }
821
+ await checkBuiltIns(key.name, kind, typeNode, schema, builtIns);
822
+ const given = defaultNode === undefined ? undefined : await literalDefault(defaultNode, key.name);
823
+ if (schema !== undefined && given !== undefined && !matchesSchema(schema, given)) fail(module, defaultNode ?? member, `${key.name}'s default isn't of its declared type`);
824
+ let start = given === undefined ? undefined : codeOf(given);
825
+ let fresh: "Map" | "Set" | null = null;
826
+ // Without a literal, only resources and derived components need a start of their own, and a component
827
+ // holding an object, whose start a joined thread knows by identity.
828
+ const needed = kind === "resource" || builtIns.has("derived");
829
+ const oneObject = kind === "component" && (schema === undefined || !isStruct(schema));
830
+ const reduced = builtIns.get("reduce");
831
+ const operator: unknown = kind === "resource" && reduced !== undefined ? JSON.parse(reduced.text) : null;
832
+ const read = (found: Started): void => {
833
+ start = found.text;
834
+ for (const local of found.locals) at = Math.max(at, endOfLocal(local));
835
+ };
836
+ if (given === undefined && (needed || oneObject)) {
837
+ if (schema === undefined) {
838
+ const namespaced = await namespacedDefault(typeNode, key.name, undefined, oneObject);
839
+ if (namespaced !== null) read({ text: namespaced.text, locals: namespaced.local === undefined ? [] : [namespaced.local], given: true });
840
+ else if (needed && !await allowsNullType(typeNode, module, new Set())) {
841
+ fail(module, member, `${kind} ${key.name} holds a value that isn't data, so nothing gives it a start: let its type allow null, or give its type a namespace with a deeply readonly \`default\`; a ReadonlyMap or ReadonlySet starts fresh in each world, a Map or Set doesn't`);
842
+ }
843
+ }
844
+ else {
845
+ const found = await startOf(typeNode, schema, operator, oneObject);
846
+ if ("text" in found && found.given) read(found);
847
+ // Else it starts at null, as the world reads a value with neither, when its type allows it.
848
+ else if (needed && !allowsNullSchema(schema)) {
849
+ if ("fresh" in found) fresh = found.fresh;
850
+ else if ("none" in found) fail(module, member, `${kind} ${key.name} starts at no value its type gives, since ${found.none}; ${workaround(typeNode)}`);
851
+ // A constant is the one value it can start at, which the world reads from its schema.
852
+ else if (!("const" in schema)) read(found);
853
+ }
854
+ }
855
+ }
856
+ const parts = schema === undefined ? [] : [`type: ${codeOf(schema)}`];
857
+ if (start !== undefined) parts.push(`default: ${start}`);
858
+ parts.push(...traits);
859
+ if (fresh !== null) parts.push(`fresh: "${fresh}"`);
860
+ insertions.push({ at, text: `\n${record}(${key.name}, "${kind}", ${parts.length === 0 ? "{}" : `{ ${parts.join(", ")} }`});` });
861
+ }
862
+ }
863
+ }
864
+ catch (error) {
865
+ if (isThrown(error)) return { failure: error.typeFailure, dependencies: [...converter.read] };
866
+ throw error;
867
+ }
868
+ if (insertions.length === 0) return null;
869
+ insertions.push({ at: code.length, text: `\nfunction ${record}(key, kind, declaration) { (globalThis[Symbol.for(${JSON.stringify(declarationsName)})] ??= new Map()).set(key, { kind, declaration }); }\n` });
870
+ return { insertions, dependencies: [...converter.read] };
871
+ };