rn-gamekit 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 (601) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +97 -16
  3. package/lib/module/assets/defineAssets.js +28 -3
  4. package/lib/module/assets/defineAssets.js.map +1 -1
  5. package/lib/module/assets.js +11 -0
  6. package/lib/module/assets.js.map +1 -0
  7. package/lib/module/audio/createGameAudio.js +784 -0
  8. package/lib/module/audio/createGameAudio.js.map +1 -0
  9. package/lib/module/audio/errors.js +12 -0
  10. package/lib/module/audio/errors.js.map +1 -0
  11. package/lib/module/audio/index.js +5 -0
  12. package/lib/module/audio/index.js.map +1 -0
  13. package/lib/module/audio/resolver.js +37 -0
  14. package/lib/module/audio/resolver.js.map +1 -0
  15. package/lib/module/audio/types.js +4 -0
  16. package/lib/module/audio/types.js.map +1 -0
  17. package/lib/module/audio.js +9 -0
  18. package/lib/module/audio.js.map +1 -0
  19. package/lib/module/camera2d/bounds.js +59 -0
  20. package/lib/module/camera2d/bounds.js.map +1 -0
  21. package/lib/module/camera2d/extents.js +25 -0
  22. package/lib/module/camera2d/extents.js.map +1 -0
  23. package/lib/module/camera2d/follow.js +138 -0
  24. package/lib/module/camera2d/follow.js.map +1 -0
  25. package/lib/module/camera2d/index.js +20 -0
  26. package/lib/module/camera2d/index.js.map +1 -0
  27. package/lib/module/camera2d/interpolation.js +98 -0
  28. package/lib/module/camera2d/interpolation.js.map +1 -0
  29. package/lib/module/camera2d/shake.js +85 -0
  30. package/lib/module/camera2d/shake.js.map +1 -0
  31. package/lib/module/camera2d/transform.js +151 -0
  32. package/lib/module/camera2d/transform.js.map +1 -0
  33. package/lib/module/camera2d/types.js +4 -0
  34. package/lib/module/camera2d/types.js.map +1 -0
  35. package/lib/module/camera2d/validation.js +98 -0
  36. package/lib/module/camera2d/validation.js.map +1 -0
  37. package/lib/module/camera2d/visibility.js +138 -0
  38. package/lib/module/camera2d/visibility.js.map +1 -0
  39. package/lib/module/camera2d.js +9 -0
  40. package/lib/module/camera2d.js.map +1 -0
  41. package/lib/module/collision2d/colliders.js +266 -0
  42. package/lib/module/collision2d/colliders.js.map +1 -0
  43. package/lib/module/collision2d/debug.js +105 -0
  44. package/lib/module/collision2d/debug.js.map +1 -0
  45. package/lib/module/collision2d/filters.js +40 -0
  46. package/lib/module/collision2d/filters.js.map +1 -0
  47. package/lib/module/collision2d/index.js +12 -0
  48. package/lib/module/collision2d/index.js.map +1 -0
  49. package/lib/module/collision2d/intersections.js +67 -0
  50. package/lib/module/collision2d/intersections.js.map +1 -0
  51. package/lib/module/collision2d/manifolds.js +218 -0
  52. package/lib/module/collision2d/manifolds.js.map +1 -0
  53. package/lib/module/collision2d/segments.js +187 -0
  54. package/lib/module/collision2d/segments.js.map +1 -0
  55. package/lib/module/collision2d/spatialHash.js +167 -0
  56. package/lib/module/collision2d/spatialHash.js.map +1 -0
  57. package/lib/module/collision2d/sweeps.js +255 -0
  58. package/lib/module/collision2d/sweeps.js.map +1 -0
  59. package/lib/module/collision2d.js +9 -0
  60. package/lib/module/collision2d.js.map +1 -0
  61. package/lib/module/core/input/buttonPad.js +214 -0
  62. package/lib/module/core/input/buttonPad.js.map +1 -0
  63. package/lib/module/core/input/createInputBuffer.js +66 -14
  64. package/lib/module/core/input/createInputBuffer.js.map +1 -1
  65. package/lib/module/core/session/createGameSession.js +454 -50
  66. package/lib/module/core/session/createGameSession.js.map +1 -1
  67. package/lib/module/core/session/deepFreeze.js +92 -2
  68. package/lib/module/core/session/deepFreeze.js.map +1 -1
  69. package/lib/module/core/session/types.js +12 -0
  70. package/lib/module/core/session/types.js.map +1 -1
  71. package/lib/module/definition/defineGame.js +23 -0
  72. package/lib/module/definition/defineGame.js.map +1 -1
  73. package/lib/module/events/defineGameEvents.js +46 -0
  74. package/lib/module/events/defineGameEvents.js.map +1 -0
  75. package/lib/module/events/errors.js +16 -0
  76. package/lib/module/events/errors.js.map +1 -0
  77. package/lib/module/events/index.js +7 -0
  78. package/lib/module/events/index.js.map +1 -0
  79. package/lib/module/events/payload.js +219 -0
  80. package/lib/module/events/payload.js.map +1 -0
  81. package/lib/module/events/seed.js +33 -0
  82. package/lib/module/events/seed.js.map +1 -0
  83. package/lib/module/events/types.js +4 -0
  84. package/lib/module/events/types.js.map +1 -0
  85. package/lib/module/events.js +13 -0
  86. package/lib/module/events.js.map +1 -0
  87. package/lib/module/geometry/helpers.js +140 -0
  88. package/lib/module/geometry/helpers.js.map +1 -0
  89. package/lib/module/geometry/index.js +5 -0
  90. package/lib/module/geometry/index.js.map +1 -0
  91. package/lib/module/geometry/validation.js +104 -0
  92. package/lib/module/geometry/validation.js.map +1 -0
  93. package/lib/module/geometry.js +9 -0
  94. package/lib/module/geometry.js.map +1 -0
  95. package/lib/module/haptics/createGameHaptics.js +214 -0
  96. package/lib/module/haptics/createGameHaptics.js.map +1 -0
  97. package/lib/module/haptics/errors.js +12 -0
  98. package/lib/module/haptics/errors.js.map +1 -0
  99. package/lib/module/haptics/index.js +5 -0
  100. package/lib/module/haptics/index.js.map +1 -0
  101. package/lib/module/haptics/resolver.js +37 -0
  102. package/lib/module/haptics/resolver.js.map +1 -0
  103. package/lib/module/haptics/types.js +4 -0
  104. package/lib/module/haptics/types.js.map +1 -0
  105. package/lib/module/haptics.js +9 -0
  106. package/lib/module/haptics.js.map +1 -0
  107. package/lib/module/index.js +8 -1
  108. package/lib/module/index.js.map +1 -1
  109. package/lib/module/particles/createParticleSystem.js +481 -0
  110. package/lib/module/particles/createParticleSystem.js.map +1 -0
  111. package/lib/module/particles/defineParticleEffect.js +178 -0
  112. package/lib/module/particles/defineParticleEffect.js.map +1 -0
  113. package/lib/module/particles/errors.js +9 -0
  114. package/lib/module/particles/errors.js.map +1 -0
  115. package/lib/module/particles/index.js +8 -0
  116. package/lib/module/particles/index.js.map +1 -0
  117. package/lib/module/particles/sampling.js +121 -0
  118. package/lib/module/particles/sampling.js.map +1 -0
  119. package/lib/module/particles/types.js +4 -0
  120. package/lib/module/particles/types.js.map +1 -0
  121. package/lib/module/particles.js +4 -0
  122. package/lib/module/particles.js.map +1 -0
  123. package/lib/module/react/GameButtonPad.js +344 -0
  124. package/lib/module/react/GameButtonPad.js.map +1 -0
  125. package/lib/module/react/GamePointerInput.js +74 -16
  126. package/lib/module/react/GamePointerInput.js.map +1 -1
  127. package/lib/module/react/GameView.js +139 -60
  128. package/lib/module/react/GameView.js.map +1 -1
  129. package/lib/module/react/assets/createGameAssetStore.js +145 -95
  130. package/lib/module/react/assets/createGameAssetStore.js.map +1 -1
  131. package/lib/module/react/assets/useGameAssets.js +60 -35
  132. package/lib/module/react/assets/useGameAssets.js.map +1 -1
  133. package/lib/module/react/bindAppLifecycle.js +46 -17
  134. package/lib/module/react/bindAppLifecycle.js.map +1 -1
  135. package/lib/module/react/bindGameSession.js +13 -2
  136. package/lib/module/react/bindGameSession.js.map +1 -1
  137. package/lib/module/react/camera2d/GameLayer2D.js +50 -0
  138. package/lib/module/react/camera2d/GameLayer2D.js.map +1 -0
  139. package/lib/module/react/camera2d/defineGameCamera2D.js +30 -0
  140. package/lib/module/react/camera2d/defineGameCamera2D.js.map +1 -0
  141. package/lib/module/react/camera2d/usePresentedCameraBinding.js +177 -0
  142. package/lib/module/react/camera2d/usePresentedCameraBinding.js.map +1 -0
  143. package/lib/module/react/cleanupList.js +38 -0
  144. package/lib/module/react/cleanupList.js.map +1 -0
  145. package/lib/module/react/lifecycleSource.js +49 -0
  146. package/lib/module/react/lifecycleSource.js.map +1 -0
  147. package/lib/module/react/particles/ParticleView.js +308 -0
  148. package/lib/module/react/particles/ParticleView.js.map +1 -0
  149. package/lib/module/react/particles/culling.js +115 -0
  150. package/lib/module/react/particles/culling.js.map +1 -0
  151. package/lib/module/react/particles/index.js +7 -0
  152. package/lib/module/react/particles/index.js.map +1 -0
  153. package/lib/module/react/particles/spriteXForm.js +45 -0
  154. package/lib/module/react/particles/spriteXForm.js.map +1 -0
  155. package/lib/module/react/particles/useParticlePresentation.js +204 -0
  156. package/lib/module/react/particles/useParticlePresentation.js.map +1 -0
  157. package/lib/module/react/pointerBinding.js +55 -17
  158. package/lib/module/react/pointerBinding.js.map +1 -1
  159. package/lib/module/react/pointerCamera.js +28 -0
  160. package/lib/module/react/pointerCamera.js.map +1 -0
  161. package/lib/module/react/pointerCoalescer.js +16 -9
  162. package/lib/module/react/pointerCoalescer.js.map +1 -1
  163. package/lib/module/react/sprites/GameSprite.js +5 -17
  164. package/lib/module/react/sprites/GameSprite.js.map +1 -1
  165. package/lib/module/react/sprites/GameWorld2D.js +112 -9
  166. package/lib/module/react/sprites/GameWorld2D.js.map +1 -1
  167. package/lib/module/react/sprites/Sprite.js +48 -63
  168. package/lib/module/react/sprites/Sprite.js.map +1 -1
  169. package/lib/module/react/sprites/SpriteBatch.js +53 -28
  170. package/lib/module/react/sprites/SpriteBatch.js.map +1 -1
  171. package/lib/module/react/sprites/batchVisibility.js +58 -0
  172. package/lib/module/react/sprites/batchVisibility.js.map +1 -0
  173. package/lib/module/react/sprites/spriteSelection.js +103 -0
  174. package/lib/module/react/sprites/spriteSelection.js.map +1 -0
  175. package/lib/module/react/sprites/spriteTransform.js +46 -25
  176. package/lib/module/react/sprites/spriteTransform.js.map +1 -1
  177. package/lib/module/react/tilemap/TileMapLayer2D.js +217 -0
  178. package/lib/module/react/tilemap/TileMapLayer2D.js.map +1 -0
  179. package/lib/module/react/tilemap/tilePresentation.js +374 -0
  180. package/lib/module/react/tilemap/tilePresentation.js.map +1 -0
  181. package/lib/module/react/useGameSession.js +70 -0
  182. package/lib/module/react/useGameSession.js.map +1 -0
  183. package/lib/module/react/useGameSessionStatus.js +46 -0
  184. package/lib/module/react/useGameSessionStatus.js.map +1 -0
  185. package/lib/module/react/viewportBinding.js +5 -1
  186. package/lib/module/react/viewportBinding.js.map +1 -1
  187. package/lib/module/react.js +12 -1
  188. package/lib/module/react.js.map +1 -1
  189. package/lib/module/scene/defineScene.js +17 -0
  190. package/lib/module/scene/defineScene.js.map +1 -1
  191. package/lib/module/sprites/sampleSpriteClip.js +66 -6
  192. package/lib/module/sprites/sampleSpriteClip.js.map +1 -1
  193. package/lib/module/sprites/spriteAnimationState.js +10 -20
  194. package/lib/module/sprites/spriteAnimationState.js.map +1 -1
  195. package/lib/module/sprites.js +11 -0
  196. package/lib/module/sprites.js.map +1 -0
  197. package/lib/module/storage/adapters/asyncStorage.js +57 -0
  198. package/lib/module/storage/adapters/asyncStorage.js.map +1 -0
  199. package/lib/module/storage/adapters/memory.js +50 -0
  200. package/lib/module/storage/adapters/memory.js.map +1 -0
  201. package/lib/module/storage/errors.js +34 -0
  202. package/lib/module/storage/errors.js.map +1 -0
  203. package/lib/module/storage/index.js +11 -0
  204. package/lib/module/storage/index.js.map +1 -0
  205. package/lib/module/storage/schema.js +151 -0
  206. package/lib/module/storage/schema.js.map +1 -0
  207. package/lib/module/storage/serialization.js +249 -0
  208. package/lib/module/storage/serialization.js.map +1 -0
  209. package/lib/module/storage/store.js +387 -0
  210. package/lib/module/storage/store.js.map +1 -0
  211. package/lib/module/storage/types.js +16 -0
  212. package/lib/module/storage/types.js.map +1 -0
  213. package/lib/module/storage/validation.js +111 -0
  214. package/lib/module/storage/validation.js.map +1 -0
  215. package/lib/module/storage.js +4 -0
  216. package/lib/module/storage.js.map +1 -0
  217. package/lib/module/testing.js +4 -0
  218. package/lib/module/testing.js.map +1 -1
  219. package/lib/module/tilemap/chunkStats.js +27 -0
  220. package/lib/module/tilemap/chunkStats.js.map +1 -0
  221. package/lib/module/tilemap/definitions.js +308 -0
  222. package/lib/module/tilemap/definitions.js.map +1 -0
  223. package/lib/module/tilemap/errors.js +13 -0
  224. package/lib/module/tilemap/errors.js.map +1 -0
  225. package/lib/module/tilemap/index.js +10 -0
  226. package/lib/module/tilemap/index.js.map +1 -0
  227. package/lib/module/tilemap/movement.js +379 -0
  228. package/lib/module/tilemap/movement.js.map +1 -0
  229. package/lib/module/tilemap/queries.js +114 -0
  230. package/lib/module/tilemap/queries.js.map +1 -0
  231. package/lib/module/tilemap/tiledAdapter.js +141 -0
  232. package/lib/module/tilemap/tiledAdapter.js.map +1 -0
  233. package/lib/module/tilemap/types.js +4 -0
  234. package/lib/module/tilemap/types.js.map +1 -0
  235. package/lib/module/tilemap.js +4 -0
  236. package/lib/module/tilemap.js.map +1 -0
  237. package/lib/typescript/src/assets/defineAssets.d.ts +1 -1
  238. package/lib/typescript/src/assets/defineAssets.d.ts.map +1 -1
  239. package/lib/typescript/src/assets.d.ts +11 -0
  240. package/lib/typescript/src/assets.d.ts.map +1 -0
  241. package/lib/typescript/src/audio/createGameAudio.d.ts +5 -0
  242. package/lib/typescript/src/audio/createGameAudio.d.ts.map +1 -0
  243. package/lib/typescript/src/audio/errors.d.ts +6 -0
  244. package/lib/typescript/src/audio/errors.d.ts.map +1 -0
  245. package/lib/typescript/src/audio/index.d.ts +4 -0
  246. package/lib/typescript/src/audio/index.d.ts.map +1 -0
  247. package/lib/typescript/src/audio/resolver.d.ts +44 -0
  248. package/lib/typescript/src/audio/resolver.d.ts.map +1 -0
  249. package/lib/typescript/src/audio/types.d.ts +42 -0
  250. package/lib/typescript/src/audio/types.d.ts.map +1 -0
  251. package/lib/typescript/src/audio.d.ts +8 -0
  252. package/lib/typescript/src/audio.d.ts.map +1 -0
  253. package/lib/typescript/src/camera2d/bounds.d.ts +25 -0
  254. package/lib/typescript/src/camera2d/bounds.d.ts.map +1 -0
  255. package/lib/typescript/src/camera2d/extents.d.ts +17 -0
  256. package/lib/typescript/src/camera2d/extents.d.ts.map +1 -0
  257. package/lib/typescript/src/camera2d/follow.d.ts +24 -0
  258. package/lib/typescript/src/camera2d/follow.d.ts.map +1 -0
  259. package/lib/typescript/src/camera2d/index.d.ts +19 -0
  260. package/lib/typescript/src/camera2d/index.d.ts.map +1 -0
  261. package/lib/typescript/src/camera2d/interpolation.d.ts +17 -0
  262. package/lib/typescript/src/camera2d/interpolation.d.ts.map +1 -0
  263. package/lib/typescript/src/camera2d/shake.d.ts +20 -0
  264. package/lib/typescript/src/camera2d/shake.d.ts.map +1 -0
  265. package/lib/typescript/src/camera2d/transform.d.ts +44 -0
  266. package/lib/typescript/src/camera2d/transform.d.ts.map +1 -0
  267. package/lib/typescript/src/camera2d/types.d.ts +74 -0
  268. package/lib/typescript/src/camera2d/types.d.ts.map +1 -0
  269. package/lib/typescript/src/camera2d/validation.d.ts +30 -0
  270. package/lib/typescript/src/camera2d/validation.d.ts.map +1 -0
  271. package/lib/typescript/src/camera2d/visibility.d.ts +47 -0
  272. package/lib/typescript/src/camera2d/visibility.d.ts.map +1 -0
  273. package/lib/typescript/src/camera2d.d.ts +7 -0
  274. package/lib/typescript/src/camera2d.d.ts.map +1 -0
  275. package/lib/typescript/src/collision2d/colliders.d.ts +120 -0
  276. package/lib/typescript/src/collision2d/colliders.d.ts.map +1 -0
  277. package/lib/typescript/src/collision2d/debug.d.ts +67 -0
  278. package/lib/typescript/src/collision2d/debug.d.ts.map +1 -0
  279. package/lib/typescript/src/collision2d/filters.d.ts +28 -0
  280. package/lib/typescript/src/collision2d/filters.d.ts.map +1 -0
  281. package/lib/typescript/src/collision2d/index.d.ts +17 -0
  282. package/lib/typescript/src/collision2d/index.d.ts.map +1 -0
  283. package/lib/typescript/src/collision2d/intersections.d.ts +24 -0
  284. package/lib/typescript/src/collision2d/intersections.d.ts.map +1 -0
  285. package/lib/typescript/src/collision2d/manifolds.d.ts +39 -0
  286. package/lib/typescript/src/collision2d/manifolds.d.ts.map +1 -0
  287. package/lib/typescript/src/collision2d/segments.d.ts +24 -0
  288. package/lib/typescript/src/collision2d/segments.d.ts.map +1 -0
  289. package/lib/typescript/src/collision2d/spatialHash.d.ts +50 -0
  290. package/lib/typescript/src/collision2d/spatialHash.d.ts.map +1 -0
  291. package/lib/typescript/src/collision2d/sweeps.d.ts +60 -0
  292. package/lib/typescript/src/collision2d/sweeps.d.ts.map +1 -0
  293. package/lib/typescript/src/collision2d.d.ts +7 -0
  294. package/lib/typescript/src/collision2d.d.ts.map +1 -0
  295. package/lib/typescript/src/core/input/buttonPad.d.ts +59 -0
  296. package/lib/typescript/src/core/input/buttonPad.d.ts.map +1 -0
  297. package/lib/typescript/src/core/input/createInputBuffer.d.ts +1 -1
  298. package/lib/typescript/src/core/input/createInputBuffer.d.ts.map +1 -1
  299. package/lib/typescript/src/core/input/types.d.ts +7 -0
  300. package/lib/typescript/src/core/input/types.d.ts.map +1 -1
  301. package/lib/typescript/src/core/session/createGameSession.d.ts +4 -2
  302. package/lib/typescript/src/core/session/createGameSession.d.ts.map +1 -1
  303. package/lib/typescript/src/core/session/deepFreeze.d.ts +21 -1
  304. package/lib/typescript/src/core/session/deepFreeze.d.ts.map +1 -1
  305. package/lib/typescript/src/core/session/diagnostics.d.ts +2 -0
  306. package/lib/typescript/src/core/session/diagnostics.d.ts.map +1 -1
  307. package/lib/typescript/src/core/session/types.d.ts +69 -4
  308. package/lib/typescript/src/core/session/types.d.ts.map +1 -1
  309. package/lib/typescript/src/definition/defineGame.d.ts +12 -1
  310. package/lib/typescript/src/definition/defineGame.d.ts.map +1 -1
  311. package/lib/typescript/src/definition/types.d.ts +10 -1
  312. package/lib/typescript/src/definition/types.d.ts.map +1 -1
  313. package/lib/typescript/src/events/defineGameEvents.d.ts +26 -0
  314. package/lib/typescript/src/events/defineGameEvents.d.ts.map +1 -0
  315. package/lib/typescript/src/events/errors.d.ts +12 -0
  316. package/lib/typescript/src/events/errors.d.ts.map +1 -0
  317. package/lib/typescript/src/events/index.d.ts +6 -0
  318. package/lib/typescript/src/events/index.d.ts.map +1 -0
  319. package/lib/typescript/src/events/payload.d.ts +21 -0
  320. package/lib/typescript/src/events/payload.d.ts.map +1 -0
  321. package/lib/typescript/src/events/seed.d.ts +3 -0
  322. package/lib/typescript/src/events/seed.d.ts.map +1 -0
  323. package/lib/typescript/src/events/types.d.ts +42 -0
  324. package/lib/typescript/src/events/types.d.ts.map +1 -0
  325. package/lib/typescript/src/events.d.ts +12 -0
  326. package/lib/typescript/src/events.d.ts.map +1 -0
  327. package/lib/typescript/src/geometry/helpers.d.ts +35 -0
  328. package/lib/typescript/src/geometry/helpers.d.ts.map +1 -0
  329. package/lib/typescript/src/geometry/index.d.ts +4 -0
  330. package/lib/typescript/src/geometry/index.d.ts.map +1 -0
  331. package/lib/typescript/src/geometry/types.d.ts +49 -0
  332. package/lib/typescript/src/geometry/types.d.ts.map +1 -1
  333. package/lib/typescript/src/geometry/validation.d.ts +44 -0
  334. package/lib/typescript/src/geometry/validation.d.ts.map +1 -0
  335. package/lib/typescript/src/geometry.d.ts +7 -0
  336. package/lib/typescript/src/geometry.d.ts.map +1 -0
  337. package/lib/typescript/src/haptics/createGameHaptics.d.ts +3 -0
  338. package/lib/typescript/src/haptics/createGameHaptics.d.ts.map +1 -0
  339. package/lib/typescript/src/haptics/errors.d.ts +6 -0
  340. package/lib/typescript/src/haptics/errors.d.ts.map +1 -0
  341. package/lib/typescript/src/haptics/index.d.ts +4 -0
  342. package/lib/typescript/src/haptics/index.d.ts.map +1 -0
  343. package/lib/typescript/src/haptics/resolver.d.ts +22 -0
  344. package/lib/typescript/src/haptics/resolver.d.ts.map +1 -0
  345. package/lib/typescript/src/haptics/types.d.ts +37 -0
  346. package/lib/typescript/src/haptics/types.d.ts.map +1 -0
  347. package/lib/typescript/src/haptics.d.ts +8 -0
  348. package/lib/typescript/src/haptics.d.ts.map +1 -0
  349. package/lib/typescript/src/index.d.ts +10 -2
  350. package/lib/typescript/src/index.d.ts.map +1 -1
  351. package/lib/typescript/src/particles/createParticleSystem.d.ts +5 -0
  352. package/lib/typescript/src/particles/createParticleSystem.d.ts.map +1 -0
  353. package/lib/typescript/src/particles/defineParticleEffect.d.ts +3 -0
  354. package/lib/typescript/src/particles/defineParticleEffect.d.ts.map +1 -0
  355. package/lib/typescript/src/particles/errors.d.ts +5 -0
  356. package/lib/typescript/src/particles/errors.d.ts.map +1 -0
  357. package/lib/typescript/src/particles/index.d.ts +6 -0
  358. package/lib/typescript/src/particles/index.d.ts.map +1 -0
  359. package/lib/typescript/src/particles/sampling.d.ts +54 -0
  360. package/lib/typescript/src/particles/sampling.d.ts.map +1 -0
  361. package/lib/typescript/src/particles/types.d.ts +292 -0
  362. package/lib/typescript/src/particles/types.d.ts.map +1 -0
  363. package/lib/typescript/src/particles.d.ts +2 -0
  364. package/lib/typescript/src/particles.d.ts.map +1 -0
  365. package/lib/typescript/src/react/GameButtonPad.d.ts +84 -0
  366. package/lib/typescript/src/react/GameButtonPad.d.ts.map +1 -0
  367. package/lib/typescript/src/react/GamePointerInput.d.ts.map +1 -1
  368. package/lib/typescript/src/react/GameView.d.ts +27 -1
  369. package/lib/typescript/src/react/GameView.d.ts.map +1 -1
  370. package/lib/typescript/src/react/assets/createGameAssetStore.d.ts.map +1 -1
  371. package/lib/typescript/src/react/assets/useGameAssets.d.ts.map +1 -1
  372. package/lib/typescript/src/react/bindAppLifecycle.d.ts +7 -1
  373. package/lib/typescript/src/react/bindAppLifecycle.d.ts.map +1 -1
  374. package/lib/typescript/src/react/bindGameSession.d.ts.map +1 -1
  375. package/lib/typescript/src/react/camera2d/GameLayer2D.d.ts +24 -0
  376. package/lib/typescript/src/react/camera2d/GameLayer2D.d.ts.map +1 -0
  377. package/lib/typescript/src/react/camera2d/defineGameCamera2D.d.ts +44 -0
  378. package/lib/typescript/src/react/camera2d/defineGameCamera2D.d.ts.map +1 -0
  379. package/lib/typescript/src/react/camera2d/usePresentedCameraBinding.d.ts +22 -0
  380. package/lib/typescript/src/react/camera2d/usePresentedCameraBinding.d.ts.map +1 -0
  381. package/lib/typescript/src/react/cleanupList.d.ts +21 -0
  382. package/lib/typescript/src/react/cleanupList.d.ts.map +1 -0
  383. package/lib/typescript/src/react/instrumentation.d.ts +33 -3
  384. package/lib/typescript/src/react/instrumentation.d.ts.map +1 -1
  385. package/lib/typescript/src/react/lifecycleSource.d.ts +21 -0
  386. package/lib/typescript/src/react/lifecycleSource.d.ts.map +1 -0
  387. package/lib/typescript/src/react/particles/ParticleView.d.ts +65 -0
  388. package/lib/typescript/src/react/particles/ParticleView.d.ts.map +1 -0
  389. package/lib/typescript/src/react/particles/culling.d.ts +70 -0
  390. package/lib/typescript/src/react/particles/culling.d.ts.map +1 -0
  391. package/lib/typescript/src/react/particles/index.d.ts +7 -0
  392. package/lib/typescript/src/react/particles/index.d.ts.map +1 -0
  393. package/lib/typescript/src/react/particles/spriteXForm.d.ts +28 -0
  394. package/lib/typescript/src/react/particles/spriteXForm.d.ts.map +1 -0
  395. package/lib/typescript/src/react/particles/useParticlePresentation.d.ts +48 -0
  396. package/lib/typescript/src/react/particles/useParticlePresentation.d.ts.map +1 -0
  397. package/lib/typescript/src/react/pointerBinding.d.ts +38 -8
  398. package/lib/typescript/src/react/pointerBinding.d.ts.map +1 -1
  399. package/lib/typescript/src/react/pointerCamera.d.ts +20 -0
  400. package/lib/typescript/src/react/pointerCamera.d.ts.map +1 -0
  401. package/lib/typescript/src/react/pointerCoalescer.d.ts +17 -1
  402. package/lib/typescript/src/react/pointerCoalescer.d.ts.map +1 -1
  403. package/lib/typescript/src/react/sprites/GameSprite.d.ts +3 -10
  404. package/lib/typescript/src/react/sprites/GameSprite.d.ts.map +1 -1
  405. package/lib/typescript/src/react/sprites/GameWorld2D.d.ts +51 -6
  406. package/lib/typescript/src/react/sprites/GameWorld2D.d.ts.map +1 -1
  407. package/lib/typescript/src/react/sprites/Sprite.d.ts.map +1 -1
  408. package/lib/typescript/src/react/sprites/SpriteBatch.d.ts +22 -1
  409. package/lib/typescript/src/react/sprites/SpriteBatch.d.ts.map +1 -1
  410. package/lib/typescript/src/react/sprites/batchVisibility.d.ts +28 -0
  411. package/lib/typescript/src/react/sprites/batchVisibility.d.ts.map +1 -0
  412. package/lib/typescript/src/react/sprites/spriteSelection.d.ts +58 -0
  413. package/lib/typescript/src/react/sprites/spriteSelection.d.ts.map +1 -0
  414. package/lib/typescript/src/react/sprites/spriteTransform.d.ts +27 -12
  415. package/lib/typescript/src/react/sprites/spriteTransform.d.ts.map +1 -1
  416. package/lib/typescript/src/react/tilemap/TileMapLayer2D.d.ts +69 -0
  417. package/lib/typescript/src/react/tilemap/TileMapLayer2D.d.ts.map +1 -0
  418. package/lib/typescript/src/react/tilemap/tilePresentation.d.ts +217 -0
  419. package/lib/typescript/src/react/tilemap/tilePresentation.d.ts.map +1 -0
  420. package/lib/typescript/src/react/useGameSession.d.ts +48 -0
  421. package/lib/typescript/src/react/useGameSession.d.ts.map +1 -0
  422. package/lib/typescript/src/react/useGameSessionStatus.d.ts +23 -0
  423. package/lib/typescript/src/react/useGameSessionStatus.d.ts.map +1 -0
  424. package/lib/typescript/src/react/viewportBinding.d.ts +5 -1
  425. package/lib/typescript/src/react/viewportBinding.d.ts.map +1 -1
  426. package/lib/typescript/src/react.d.ts +18 -1
  427. package/lib/typescript/src/react.d.ts.map +1 -1
  428. package/lib/typescript/src/scene/defineScene.d.ts +22 -2
  429. package/lib/typescript/src/scene/defineScene.d.ts.map +1 -1
  430. package/lib/typescript/src/scene/types.d.ts +24 -4
  431. package/lib/typescript/src/scene/types.d.ts.map +1 -1
  432. package/lib/typescript/src/sprites/sampleSpriteClip.d.ts +26 -2
  433. package/lib/typescript/src/sprites/sampleSpriteClip.d.ts.map +1 -1
  434. package/lib/typescript/src/sprites/spriteAnimationState.d.ts +6 -7
  435. package/lib/typescript/src/sprites/spriteAnimationState.d.ts.map +1 -1
  436. package/lib/typescript/src/sprites.d.ts +10 -0
  437. package/lib/typescript/src/sprites.d.ts.map +1 -0
  438. package/lib/typescript/src/storage/adapters/asyncStorage.d.ts +18 -0
  439. package/lib/typescript/src/storage/adapters/asyncStorage.d.ts.map +1 -0
  440. package/lib/typescript/src/storage/adapters/memory.d.ts +16 -0
  441. package/lib/typescript/src/storage/adapters/memory.d.ts.map +1 -0
  442. package/lib/typescript/src/storage/errors.d.ts +37 -0
  443. package/lib/typescript/src/storage/errors.d.ts.map +1 -0
  444. package/lib/typescript/src/storage/index.d.ts +11 -0
  445. package/lib/typescript/src/storage/index.d.ts.map +1 -0
  446. package/lib/typescript/src/storage/schema.d.ts +22 -0
  447. package/lib/typescript/src/storage/schema.d.ts.map +1 -0
  448. package/lib/typescript/src/storage/serialization.d.ts +23 -0
  449. package/lib/typescript/src/storage/serialization.d.ts.map +1 -0
  450. package/lib/typescript/src/storage/store.d.ts +3 -0
  451. package/lib/typescript/src/storage/store.d.ts.map +1 -0
  452. package/lib/typescript/src/storage/types.d.ts +69 -0
  453. package/lib/typescript/src/storage/types.d.ts.map +1 -0
  454. package/lib/typescript/src/storage/validation.d.ts +24 -0
  455. package/lib/typescript/src/storage/validation.d.ts.map +1 -0
  456. package/lib/typescript/src/storage.d.ts +2 -0
  457. package/lib/typescript/src/storage.d.ts.map +1 -0
  458. package/lib/typescript/src/testing.d.ts +1 -0
  459. package/lib/typescript/src/testing.d.ts.map +1 -1
  460. package/lib/typescript/src/tilemap/chunkStats.d.ts +14 -0
  461. package/lib/typescript/src/tilemap/chunkStats.d.ts.map +1 -0
  462. package/lib/typescript/src/tilemap/definitions.d.ts +38 -0
  463. package/lib/typescript/src/tilemap/definitions.d.ts.map +1 -0
  464. package/lib/typescript/src/tilemap/errors.d.ts +7 -0
  465. package/lib/typescript/src/tilemap/errors.d.ts.map +1 -0
  466. package/lib/typescript/src/tilemap/index.d.ts +8 -0
  467. package/lib/typescript/src/tilemap/index.d.ts.map +1 -0
  468. package/lib/typescript/src/tilemap/movement.d.ts +52 -0
  469. package/lib/typescript/src/tilemap/movement.d.ts.map +1 -0
  470. package/lib/typescript/src/tilemap/queries.d.ts +21 -0
  471. package/lib/typescript/src/tilemap/queries.d.ts.map +1 -0
  472. package/lib/typescript/src/tilemap/tiledAdapter.d.ts +32 -0
  473. package/lib/typescript/src/tilemap/tiledAdapter.d.ts.map +1 -0
  474. package/lib/typescript/src/tilemap/types.d.ts +127 -0
  475. package/lib/typescript/src/tilemap/types.d.ts.map +1 -0
  476. package/lib/typescript/src/tilemap.d.ts +2 -0
  477. package/lib/typescript/src/tilemap.d.ts.map +1 -0
  478. package/package.json +100 -10
  479. package/src/assets/defineAssets.ts +31 -5
  480. package/src/assets.ts +27 -0
  481. package/src/audio/createGameAudio.ts +749 -0
  482. package/src/audio/errors.ts +12 -0
  483. package/src/audio/index.ts +9 -0
  484. package/src/audio/resolver.ts +74 -0
  485. package/src/audio/types.ts +47 -0
  486. package/src/audio.ts +13 -0
  487. package/src/camera2d/bounds.ts +69 -0
  488. package/src/camera2d/extents.ts +25 -0
  489. package/src/camera2d/follow.ts +165 -0
  490. package/src/camera2d/index.ts +29 -0
  491. package/src/camera2d/interpolation.ts +113 -0
  492. package/src/camera2d/shake.ts +90 -0
  493. package/src/camera2d/transform.ts +148 -0
  494. package/src/camera2d/types.ts +73 -0
  495. package/src/camera2d/validation.ts +126 -0
  496. package/src/camera2d/visibility.ts +181 -0
  497. package/src/camera2d.ts +6 -0
  498. package/src/collision2d/colliders.ts +292 -0
  499. package/src/collision2d/debug.ts +133 -0
  500. package/src/collision2d/filters.ts +48 -0
  501. package/src/collision2d/index.ts +74 -0
  502. package/src/collision2d/intersections.ts +82 -0
  503. package/src/collision2d/manifolds.ts +191 -0
  504. package/src/collision2d/segments.ts +176 -0
  505. package/src/collision2d/spatialHash.ts +211 -0
  506. package/src/collision2d/sweeps.ts +269 -0
  507. package/src/collision2d.ts +6 -0
  508. package/src/core/input/buttonPad.ts +235 -0
  509. package/src/core/input/createInputBuffer.ts +95 -14
  510. package/src/core/input/types.ts +7 -0
  511. package/src/core/session/createGameSession.ts +480 -53
  512. package/src/core/session/deepFreeze.ts +104 -3
  513. package/src/core/session/diagnostics.ts +2 -0
  514. package/src/core/session/types.ts +77 -4
  515. package/src/definition/defineGame.ts +61 -3
  516. package/src/definition/types.ts +10 -0
  517. package/src/events/defineGameEvents.ts +46 -0
  518. package/src/events/errors.ts +14 -0
  519. package/src/events/index.ts +14 -0
  520. package/src/events/payload.ts +234 -0
  521. package/src/events/seed.ts +33 -0
  522. package/src/events/types.ts +53 -0
  523. package/src/events.ts +20 -0
  524. package/src/geometry/helpers.ts +136 -0
  525. package/src/geometry/index.ts +14 -0
  526. package/src/geometry/types.ts +54 -0
  527. package/src/geometry/validation.ts +131 -0
  528. package/src/geometry.ts +6 -0
  529. package/src/haptics/createGameHaptics.ts +214 -0
  530. package/src/haptics/errors.ts +12 -0
  531. package/src/haptics/index.ts +3 -0
  532. package/src/haptics/resolver.ts +58 -0
  533. package/src/haptics/types.ts +48 -0
  534. package/src/haptics.ts +7 -0
  535. package/src/index.ts +37 -1
  536. package/src/particles/createParticleSystem.ts +505 -0
  537. package/src/particles/defineParticleEffect.ts +164 -0
  538. package/src/particles/errors.ts +6 -0
  539. package/src/particles/index.ts +5 -0
  540. package/src/particles/sampling.ts +141 -0
  541. package/src/particles/types.ts +327 -0
  542. package/src/particles.ts +1 -0
  543. package/src/react/GameButtonPad.tsx +436 -0
  544. package/src/react/GamePointerInput.tsx +73 -8
  545. package/src/react/GameView.tsx +160 -61
  546. package/src/react/assets/createGameAssetStore.ts +140 -107
  547. package/src/react/assets/useGameAssets.ts +63 -31
  548. package/src/react/bindAppLifecycle.ts +55 -19
  549. package/src/react/bindGameSession.ts +12 -2
  550. package/src/react/camera2d/GameLayer2D.tsx +43 -0
  551. package/src/react/camera2d/defineGameCamera2D.ts +59 -0
  552. package/src/react/camera2d/usePresentedCameraBinding.ts +185 -0
  553. package/src/react/cleanupList.ts +48 -0
  554. package/src/react/instrumentation.ts +31 -3
  555. package/src/react/lifecycleSource.ts +58 -0
  556. package/src/react/particles/ParticleView.tsx +358 -0
  557. package/src/react/particles/culling.ts +145 -0
  558. package/src/react/particles/index.ts +6 -0
  559. package/src/react/particles/spriteXForm.ts +72 -0
  560. package/src/react/particles/useParticlePresentation.ts +261 -0
  561. package/src/react/pointerBinding.ts +74 -16
  562. package/src/react/pointerCamera.ts +33 -0
  563. package/src/react/pointerCoalescer.ts +36 -10
  564. package/src/react/sprites/GameSprite.tsx +4 -33
  565. package/src/react/sprites/GameWorld2D.tsx +113 -7
  566. package/src/react/sprites/Sprite.tsx +51 -72
  567. package/src/react/sprites/SpriteBatch.tsx +74 -22
  568. package/src/react/sprites/batchVisibility.ts +76 -0
  569. package/src/react/sprites/spriteSelection.ts +133 -0
  570. package/src/react/sprites/spriteTransform.ts +46 -26
  571. package/src/react/tilemap/TileMapLayer2D.tsx +274 -0
  572. package/src/react/tilemap/tilePresentation.ts +491 -0
  573. package/src/react/useGameSession.ts +90 -0
  574. package/src/react/useGameSessionStatus.ts +53 -0
  575. package/src/react/viewportBinding.ts +5 -1
  576. package/src/react.ts +18 -1
  577. package/src/scene/defineScene.ts +47 -5
  578. package/src/scene/types.ts +37 -3
  579. package/src/sprites/sampleSpriteClip.ts +82 -14
  580. package/src/sprites/spriteAnimationState.ts +29 -25
  581. package/src/sprites.ts +22 -0
  582. package/src/storage/adapters/asyncStorage.ts +77 -0
  583. package/src/storage/adapters/memory.ts +58 -0
  584. package/src/storage/errors.ts +88 -0
  585. package/src/storage/index.ts +18 -0
  586. package/src/storage/schema.ts +147 -0
  587. package/src/storage/serialization.ts +248 -0
  588. package/src/storage/store.ts +380 -0
  589. package/src/storage/types.ts +76 -0
  590. package/src/storage/validation.ts +102 -0
  591. package/src/storage.ts +1 -0
  592. package/src/testing.ts +4 -0
  593. package/src/tilemap/chunkStats.ts +24 -0
  594. package/src/tilemap/definitions.ts +327 -0
  595. package/src/tilemap/errors.ts +11 -0
  596. package/src/tilemap/index.ts +10 -0
  597. package/src/tilemap/movement.ts +368 -0
  598. package/src/tilemap/queries.ts +136 -0
  599. package/src/tilemap/tiledAdapter.ts +165 -0
  600. package/src/tilemap/types.ts +119 -0
  601. package/src/tilemap.ts +1 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * V1 storage contracts — game-owned projections, engine envelope, adapter.
3
+ */
4
+ export interface GameSaveSchema<TData> {
5
+ readonly id: string;
6
+ readonly version: number;
7
+ readonly createDefault: () => TData;
8
+ readonly validate: (value: unknown) => TData;
9
+ readonly migrations: Readonly<Record<number, (value: unknown) => unknown>>;
10
+ }
11
+ export interface GameStorageAdapter {
12
+ read(key: string): Promise<string | undefined>;
13
+ write(key: string, value: string): Promise<void>;
14
+ remove(key: string): Promise<void>;
15
+ }
16
+ export interface StoredGameEnvelope {
17
+ readonly format: 'rn-gamekit.save';
18
+ readonly schemaId: string;
19
+ readonly schemaVersion: number;
20
+ readonly savedAtMs: number;
21
+ readonly payload: unknown;
22
+ }
23
+ export type GameSaveLoadStatus = 'default' | 'stored' | 'migrated';
24
+ export interface GameSaveLoadResult<TData> {
25
+ readonly status: GameSaveLoadStatus;
26
+ readonly data: TData;
27
+ /** Present only when status === 'migrated' */
28
+ readonly fromVersion?: number;
29
+ /** Present only when status === 'migrated' */
30
+ readonly toVersion?: number;
31
+ }
32
+ export interface CreateGameSaveStoreOptions<TData> {
33
+ readonly schema: GameSaveSchema<TData>;
34
+ readonly adapter: GameStorageAdapter;
35
+ readonly namespace: string;
36
+ }
37
+ export interface GameSaveStore<TData> {
38
+ load(slot: string): Promise<GameSaveLoadResult<TData>>;
39
+ save(slot: string, data: TData): Promise<void>;
40
+ /**
41
+ * Delete a slot's record (GS-STORAGE-04): `remove` is the canonical
42
+ * verb; `delete` is a same-behavior alias kept for preview
43
+ * compatibility. Removes the versioned record and its legacy heritage.
44
+ */
45
+ remove(slot: string): Promise<void>;
46
+ /** Alias for remove — both names are accepted. */
47
+ delete(slot: string): Promise<void>;
48
+ /**
49
+ * Drain operations accepted before the call (GS-STORAGE-04): snapshots
50
+ * the in-flight set, waits for every snapshot member to settle —
51
+ * including failures — and never waits for later work. Always resolves
52
+ * (never rejects): each operation's own returned promise carries its
53
+ * success or failure. Per-slot ordering is per store instance, not a
54
+ * global cross-store lock; disposal rejects new work while accepted
55
+ * work still settles normally.
56
+ */
57
+ flush(): Promise<void>;
58
+ dispose(): void;
59
+ readonly disposed: boolean;
60
+ }
61
+ export declare const STORAGE_LIMITS: {
62
+ readonly MAX_SERIALIZED_BYTES: 262144;
63
+ readonly MAX_DEPTH: 16;
64
+ readonly MAX_NODES: 4096;
65
+ readonly MAX_ARRAY_LENGTH: 1024;
66
+ readonly MAX_OBJECT_FIELDS: 1024;
67
+ readonly MAX_STRING_LENGTH: 16384;
68
+ };
69
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/storage/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,KAAK,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,kBAAkB,CAAC,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,0BAA0B,CAAC,KAAK;IAC/C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa,CAAC,KAAK;IAClC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,kDAAkD;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;;;;;;OAQG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare function validateSchemaId(id: string): void;
2
+ export declare function validateVersion(version: number): void;
3
+ export declare function validateNamespace(namespace: string): void;
4
+ export declare function validateSlot(slot: string): void;
5
+ export declare function validateMigrations(migrations: Readonly<Record<number, (value: unknown) => unknown>>, currentVersion: number): void;
6
+ export declare function storageKey(namespace: string, slot: string): string;
7
+ /**
8
+ * Recovery/compatibility policy (GS-STORAGE-01, preview release):
9
+ *
10
+ * - Writes go to v2 keys only. Reads try v2, then fall back to the legacy
11
+ * dotted key, so pre-upgrade records load without any rewrite.
12
+ * - The first v2 save for a slot lazily migrates it; no blanket rewrite
13
+ * ever runs, and legacy records are never deleted after an ambiguous
14
+ * read (a legacy key cannot identify which pair wrote it).
15
+ * - `remove` deletes both the v2 and legacy keys. Under v1, colliding
16
+ * pairs already shared one record (shared fate on delete); v2 converges
17
+ * to independence as each pair saves. A pair that never saves under v2
18
+ * keeps reading its legacy record until it does.
19
+ * - A legacy collision (`('game.a','b')` vs `('game','a.b')`) cannot be
20
+ * disambiguated from the key alone: both pairs read the same heritage
21
+ * record, exactly as v1 behaved. New writes never collide.
22
+ */
23
+ export declare function legacyStorageKey(namespace: string, slot: string): string;
24
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/storage/validation.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAOzD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAO/C;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,EACjE,cAAc,EAAE,MAAM,GACrB,IAAI,CAuBN;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE"}
@@ -0,0 +1,2 @@
1
+ export * from './storage/index.js';
2
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/storage.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAiB,CAAC"}
@@ -25,4 +25,5 @@ export declare class ManualFrameDriver implements FrameDriver {
25
25
  */
26
26
  fireCancelled(handle: FrameHandle, timestampMs: number): void;
27
27
  }
28
+ export { __resetChunkReadStats, __chunkReadCount } from './tilemap/chunkStats.js';
28
29
  //# sourceMappingURL=testing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAkC,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AAErE,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW;;IAKnD,+CAA+C;IAC/C,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,YAAY,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,GAAG,WAAW;IAQlE,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAItC,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW;IAW1C;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;CAO9D"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAkC,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AAErE,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW;;IAKnD,+CAA+C;IAC/C,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,YAAY,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,GAAG,WAAW;IAQlE,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAItC,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW;IAW1C;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;CAO9D;AAID,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAsB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Test-only chunk-read instrumentation (T16-F6/T16-RF4).
3
+ *
4
+ * Lives OUTSIDE the public `rn-gamekit/tilemap` entry: the counters are
5
+ * re-exported only through the `rn-gamekit/testing` subpath so published
6
+ * diagnostics never leak double-underscore seams into app code.
7
+ */
8
+ /** Internal: record one chunk-region lookup. */
9
+ export declare function recordChunkRead(): void;
10
+ /** Test-only: reset the chunk-visit counter. */
11
+ export declare function __resetChunkReadStats(): void;
12
+ /** Test-only: number of chunk lookups since the last reset. */
13
+ export declare function __chunkReadCount(): number;
14
+ //# sourceMappingURL=chunkStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunkStats.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/chunkStats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,gDAAgD;AAChD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,gDAAgD;AAChD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
@@ -0,0 +1,38 @@
1
+ import type { TileCell2D, TileLayer2D, TileMap2D, TileSet2D, TileLayerInput2D, TileMapInput2D } from './types.js';
2
+ import type { Aabb2D } from '../geometry/types.js';
3
+ /** Frozen internal chunk size in cells (both axes). T16.0 contract. */
4
+ export declare const TILE_CHUNK_SIZE = 16;
5
+ /**
6
+ * Maximum cells per layer (GS-TILE-04). The per-axis bound alone permits
7
+ * 8192x8192 = 67M cells per layer (~0.5GB dense data plus index copies),
8
+ * so total authored cells are capped at 2048x2048 worth — far above real
9
+ * levels, far below the footgun.
10
+ */
11
+ export declare const MAX_TILE_LAYER_CELLS = 4194304;
12
+ /**
13
+ * Floor division truncating toward negative infinity — REQUIRED for
14
+ * negative cell coordinates (T16.0 contract).
15
+ */
16
+ export declare function floorDiv(a: number, b: number): number;
17
+ export declare function defineTileSet2D(input: {
18
+ readonly tiles: Readonly<Record<string, {
19
+ readonly frame: string;
20
+ readonly collision?: 'solid' | 'one-way-up';
21
+ }>>;
22
+ }): TileSet2D;
23
+ export declare function defineTileLayer2D(input: TileLayerInput2D, tileset: TileSet2D): TileLayer2D;
24
+ export declare function defineTileMap2D(input: TileMapInput2D): TileMap2D;
25
+ /** Internal: read one cell's tile id (0 when outside the finite map). */
26
+ export declare function tileAt(map: TileMap2D, layerId: string, cx: number, cy: number): number;
27
+ /**
28
+ * Internal: iterate non-empty cells inside an inclusive cell span in
29
+ * global row-major order, fetching each overlapped chunk region once
30
+ * (T16-F6). `visit` receives (layerId, cx, cy, tileId); returning false
31
+ * from `visit` stops iteration early.
32
+ */
33
+ export declare function forEachCellInSpan(map: TileMap2D, layerId: string, x0: number, y0: number, x1: number, y1: number, visit: (cx: number, cy: number, tileId: number) => boolean | void): void;
34
+ /** Convert a cell coordinate to its world AABB. */
35
+ export declare function cellAabb(map: TileMap2D, cx: number, cy: number): Aabb2D;
36
+ /** Frozen immutable query result builder. */
37
+ export declare function makeCell(map: TileMap2D, layerId: string, cx: number, cy: number, tileId: number): TileCell2D;
38
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/definitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAS,CAAC;AACjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAmB,CAAC;AAGhD,uEAAuE;AACvE,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UAAY,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAiDD,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,YAAY,CAAA;KAAE,CAAC,CAAC,CAAC;CACnH,GAAG,SAAS,CAqCZ;AAQD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,SAAS,GACjB,WAAW,CA6Cb;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAoDhE;AAOD,yEAAyE;AACzE,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAatF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAC9C,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,GAChE,IAAI,CAuCN;AAED,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAa5G"}
@@ -0,0 +1,7 @@
1
+ /** Tilemap definition/query/movement errors with exact field paths. */
2
+ export declare class TileMapError extends Error {
3
+ name: string;
4
+ constructor(message: string);
5
+ }
6
+ export declare function tileError(path: string, message: string): TileMapError;
7
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/errors.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,qBAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,SAAkB;gBACnB,OAAO,EAAE,MAAM;CAG5B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAErE"}
@@ -0,0 +1,8 @@
1
+ export * from './types.js';
2
+ export * from './errors.js';
3
+ export * from './definitions.js';
4
+ export * from './queries.js';
5
+ export * from './movement.js';
6
+ export * from './tiledAdapter.js';
7
+ export { TILE_CHUNK_SIZE, floorDiv, } from './definitions.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAS,CAAC;AACxB,cAAc,aAAU,CAAC;AACzB,cAAc,kBAAe,CAAC;AAC9B,cAAc,cAAW,CAAC;AAC1B,cAAc,eAAY,CAAC;AAC3B,cAAc,mBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,QAAQ,GACT,MAAM,kBAAe,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { PlatformerMoveResult2D, TileMap2D } from './types.js';
2
+ import type { Aabb2D, Vector2D } from '../geometry/types.js';
3
+ /** Frozen v1 movement semantics (T16.0). */
4
+ export declare const PLATFORMER_MAX_ITERATIONS = 4;
5
+ export declare const PLATFORMER_SKIN = 0.000001;
6
+ /** Previous-bottom must be at or above the platform top by this tolerance. */
7
+ export declare const ONE_WAY_TOLERANCE = 0.0001;
8
+ export interface PlatformerMoveOptions2D {
9
+ /** Explicit per-call drop-through intent; the helper owns no timer. */
10
+ readonly dropThroughOneWay?: boolean;
11
+ /**
12
+ * Snap downward onto floor tops within this many world units when the
13
+ * body ends the step falling or resting and no floor contact was resolved.
14
+ * Default 0 (disabled).
15
+ */
16
+ readonly floorSnapDistance?: number;
17
+ }
18
+ /**
19
+ * Pure fixed-step AABB platformer movement (T16.3, T16-F5).
20
+ *
21
+ * Frozen semantics:
22
+ * - Axis order X then Y.
23
+ * - Solid tiles block both axes; one-way tiles block descent only when the
24
+ * previous bottom was at/above the platform top (ONE_WAY_TOLERANCE) and
25
+ * `dropThroughOneWay` is not set.
26
+ * - Starting overlap resolves along the least-penetration face preferring UP
27
+ * on ties (up = negative y in y-down space), up to PLATFORMER_MAX_ITERATIONS;
28
+ * unresolved spawn overlap throws deterministically. The reported contact is
29
+ * always the tile that supplied the winning face.
30
+ * - Each axis resolves against the NEAREST blocking plane and reports contacts
31
+ * ONLY for tiles touching that winning plane — farther crossed rows/columns
32
+ * are never reported.
33
+ * - Floor snap pulls a falling/resting body down onto tops within
34
+ * `floorSnapDistance`.
35
+ * - Candidate order is layer order then row-major cell order; equal physical
36
+ * candidates preserve that deterministic order.
37
+ *
38
+ * Displacement contract (GS-TILE-03): `displacement` reports requested-motion
39
+ * resolution only — starting-overlap recovery moves the body and reports its
40
+ * contact, but never contributes to displacement. The caller's body object is
41
+ * never mutated or frozen; every returned body/contact/normal is an owned
42
+ * frozen value.
43
+ */
44
+ export declare function movePlatformerBody2D(options: {
45
+ readonly body: Aabb2D;
46
+ readonly velocity: Vector2D;
47
+ readonly deltaSeconds: number;
48
+ readonly map: TileMap2D;
49
+ /** Layer ids that contribute collision; others render only. */
50
+ readonly collisionLayers: readonly string[];
51
+ } & PlatformerMoveOptions2D): PlatformerMoveResult2D;
52
+ //# sourceMappingURL=movement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"movement.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/movement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,SAAS,EACV,MAAM,YAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAmB,CAAC;AAG1D,4CAA4C;AAC5C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,eAAe,WAAO,CAAC;AACpC,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,SAAO,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C,GAAG,uBAAuB,GAAG,sBAAsB,CA+QnD"}
@@ -0,0 +1,21 @@
1
+ import type { Aabb2D, Point2D } from '../geometry/types.js';
2
+ import type { TileCell2D, TileMap2D } from './types.js';
3
+ /** All non-empty cells in the given layers overlapping the point. */
4
+ export declare function cellsAtPoint(map: TileMap2D, point: Point2D, layerIds?: readonly string[]): readonly TileCell2D[];
5
+ /** All non-empty cells whose AABBs intersect the query AABB. */
6
+ export declare function cellsInAabb(map: TileMap2D, aabb: Aabb2D, layerIds?: readonly string[]): readonly TileCell2D[];
7
+ /**
8
+ * Cells overlapped by the swept bounds of a body moving by `displacement`.
9
+ * The swept bounds are the union AABB of start and end positions — bounded,
10
+ * never unbounded even for very large displacements (clamped to the map).
11
+ */
12
+ export declare function cellsInSweptBounds(map: TileMap2D, body: Aabb2D, displacement: {
13
+ x: number;
14
+ y: number;
15
+ }, layerIds?: readonly string[]): readonly TileCell2D[];
16
+ /**
17
+ * Non-empty cells inside the visible region (camera bounds + overscan).
18
+ * Same deterministic ordering as `cellsInAabb`.
19
+ */
20
+ export declare function visibleCells(map: TileMap2D, visibleBounds: Aabb2D, overscanCells: number, layerIds?: readonly string[]): readonly TileCell2D[];
21
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAmCrD,qEAAqE;AACrE,wBAAgB,YAAY,CAC1B,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAC3B,SAAS,UAAU,EAAE,CAWvB;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CACzB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAC3B,SAAS,UAAU,EAAE,CAkBvB;AAcD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACtC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAC3B,SAAS,UAAU,EAAE,CAQvB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAC3B,SAAS,UAAU,EAAE,CAevB"}
@@ -0,0 +1,32 @@
1
+ import type { TileMapInput2D, TileSet2D } from './types.js';
2
+ /**
3
+ * Narrow Tiled JSON adapter (T16.5, hardened per T16-F6).
4
+ *
5
+ * Accepts ONLY the finite orthogonal subset used by the reference level:
6
+ * - `orientation: "orthogonal"`, `infinite: false`
7
+ * - `layers` of `type: "tilelayer"` with inline numeric `data` (no base64,
8
+ * no compression, no chunks)
9
+ * - EVERY other layer type (objectgroup, group, imagelayer, ...) is rejected
10
+ * with its exact source path — nothing silently disappears
11
+ * - Nonzero `offsetx`/`offsety` are rejected (v1 has no layer offsets)
12
+ * - No per-tile flips (high GID bits) — rejected with a source path
13
+ *
14
+ * The root value, options object, and every layer entry are validated BEFORE
15
+ * any property access, so malformed input always surfaces as a structured
16
+ * TileMapError instead of a TypeError. Raw Tiled JSON never enters
17
+ * fixed-step or rendering hot paths; the output is a normalized Gamekit map
18
+ * input.
19
+ */
20
+ export interface TiledAdapterOptions {
21
+ /**
22
+ * Map Tiled global tile ids to Gamekit tile names. The referenced names
23
+ * must exist on the provided tileset.
24
+ */
25
+ readonly gidToTileName: Readonly<Record<number, string>>;
26
+ /** Layers to convert, in order. Defaults to every tilelayer. */
27
+ readonly layerIds?: readonly string[];
28
+ /** Layers that contribute collision; unlisted layers stay decorative. */
29
+ readonly collidableLayers?: readonly string[];
30
+ }
31
+ export declare function parseTiledMap2D(json: unknown, tileset: TileSet2D, options: TiledAdapterOptions): TileMapInput2D;
32
+ //# sourceMappingURL=tiledAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiledAdapter.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/tiledAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAEzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,yEAAyE;IACzE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C;AAYD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,mBAAmB,GAC3B,cAAc,CAqHhB"}
@@ -0,0 +1,127 @@
1
+ import type { Aabb2D, Point2D } from '../geometry/types.js';
2
+ /**
3
+ * Tilemap v1 contract (Task 16).
4
+ *
5
+ * Finite orthogonal maps, y-down world coordinates matching Gamekit
6
+ * geometry. All public values are immutable plain data; mutable author
7
+ * buffers are cloned at definition time and never exposed.
8
+ */
9
+ /** Collision behavior contributed by one tile kind. */
10
+ export type TileCollisionKind2D = 'solid' | 'one-way-up';
11
+ /** One named tile: render frame plus optional collision role. */
12
+ export interface TileDef2D {
13
+ /** Frame name inside the bound sprite sheet. */
14
+ readonly frame: string;
15
+ /** Collision role; absent means purely decorative. */
16
+ readonly collision?: TileCollisionKind2D;
17
+ }
18
+ /**
19
+ * Named tile registry. Numeric tile ids are assigned by declaration order
20
+ * starting at 1; id 0 always means EMPTY.
21
+ */
22
+ export interface TileSet2D {
23
+ /** Insertion-ordered tile names; index i corresponds to tile id i+1. */
24
+ readonly names: readonly string[];
25
+ /** Frozen tile defs by name. */
26
+ readonly tiles: Readonly<Record<string, TileDef2D>>;
27
+ /** name -> numeric id (≥1). */
28
+ readonly idOfName: Readonly<Record<string, number>>;
29
+ /** numeric id -> name. */
30
+ readonly nameOfId: Readonly<Record<number, string>>;
31
+ /** collision kind by numeric id (absent = decorative). */
32
+ readonly collisionOfId: Readonly<Record<number, TileCollisionKind2D>>;
33
+ }
34
+ /** Author input for one layer: row-major tile ids, 0 = empty. */
35
+ export interface TileLayerInput2D {
36
+ readonly id: string;
37
+ readonly width: number;
38
+ readonly height: number;
39
+ /** Row-major tile ids; length MUST equal width*height; 0 = empty. */
40
+ readonly data: readonly number[];
41
+ /** Purely decorative layers skip collision queries entirely. */
42
+ readonly collidable?: boolean;
43
+ }
44
+ /** Normalized immutable layer with owned storage. */
45
+ export interface TileLayer2D {
46
+ readonly id: string;
47
+ readonly width: number;
48
+ readonly height: number;
49
+ readonly collidable: boolean;
50
+ /** Owned row-major copy; index = y*width + x; 0 = empty. */
51
+ readonly data: readonly number[];
52
+ }
53
+ export interface TileMapInput2D {
54
+ /** Finite positive cell size in world units. */
55
+ readonly cellSize: {
56
+ readonly width: number;
57
+ readonly height: number;
58
+ };
59
+ readonly tileset: TileSet2D;
60
+ /** Ordered layers; later entries render above earlier ones. */
61
+ readonly layers: TileLayerInput2D[];
62
+ /** World origin of cell (0,0)'s top-left corner. Defaults to {x:0,y:0}. */
63
+ readonly origin?: Point2D;
64
+ }
65
+ /** Normalized immutable map with precomputed bounds and chunk indexes. */
66
+ export interface TileMap2D {
67
+ readonly cellSize: {
68
+ readonly width: number;
69
+ readonly height: number;
70
+ };
71
+ readonly origin: Point2D;
72
+ readonly tileset: TileSet2D;
73
+ /** Frozen ordered layer list. */
74
+ readonly layers: readonly TileLayer2D[];
75
+ /** layer id -> layer. */
76
+ readonly layerById: Readonly<Record<string, TileLayer2D>>;
77
+ /** World-space AABB covering every layer's cells. */
78
+ readonly worldBounds: Aabb2D;
79
+ /** Frozen chunk size in cells (both axes). Internal detail. */
80
+ readonly chunkSize: number;
81
+ }
82
+ /** Immutable query result for one non-empty cell. */
83
+ export interface TileCell2D {
84
+ readonly layerId: string;
85
+ readonly tileId: number;
86
+ readonly tileName: string;
87
+ readonly collision: TileCollisionKind2D | undefined;
88
+ /** Cell coordinate (signed safe integers). */
89
+ readonly cell: Point2D;
90
+ /** World AABB of the cell. */
91
+ readonly aabb: Aabb2D;
92
+ }
93
+ /** Classified contact between a platformer body and one tile. */
94
+ export interface PlatformerContact2D {
95
+ readonly cell: TileCell2D;
96
+ /** Contact normal pointing OUT of the tile toward the body. */
97
+ readonly normal: {
98
+ readonly x: number;
99
+ readonly y: number;
100
+ };
101
+ }
102
+ /** Result of one fixed-step platformer movement. */
103
+ export interface PlatformerMoveResult2D {
104
+ readonly body: Aabb2D;
105
+ readonly velocity: {
106
+ readonly x: number;
107
+ readonly y: number;
108
+ };
109
+ /** Displacement actually applied. */
110
+ readonly displacement: {
111
+ readonly x: number;
112
+ readonly y: number;
113
+ };
114
+ /** intended − applied. */
115
+ readonly remainingDisplacement: {
116
+ readonly x: number;
117
+ readonly y: number;
118
+ };
119
+ readonly contacts: {
120
+ readonly floor: PlatformerContact2D | undefined;
121
+ readonly ceiling: PlatformerContact2D | undefined;
122
+ readonly leftWall: PlatformerContact2D | undefined;
123
+ readonly rightWall: PlatformerContact2D | undefined;
124
+ readonly all: readonly PlatformerContact2D[];
125
+ };
126
+ }
127
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/tilemap/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export * from './tilemap/index.js';
2
+ //# sourceMappingURL=tilemap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tilemap.d.ts","sourceRoot":"","sources":["../../../src/tilemap.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-gamekit",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "A headless-first 2D game toolkit for React Native and Expo, built for mobile and tablet.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -45,6 +45,72 @@
45
45
  "source": "./src/testing.ts",
46
46
  "types": "./lib/typescript/src/testing.d.ts",
47
47
  "default": "./lib/module/testing.js"
48
+ },
49
+ "./audio": {
50
+ "react-native": "./src/audio.ts",
51
+ "source": "./src/audio.ts",
52
+ "types": "./lib/typescript/src/audio.d.ts",
53
+ "default": "./lib/module/audio.js"
54
+ },
55
+ "./haptics": {
56
+ "react-native": "./src/haptics.ts",
57
+ "source": "./src/haptics.ts",
58
+ "types": "./lib/typescript/src/haptics.d.ts",
59
+ "default": "./lib/module/haptics.js"
60
+ },
61
+ "./particles": {
62
+ "react-native": "./src/particles.ts",
63
+ "source": "./src/particles.ts",
64
+ "types": "./lib/typescript/src/particles.d.ts",
65
+ "default": "./lib/module/particles.js"
66
+ },
67
+ "./tilemap": {
68
+ "react-native": "./src/tilemap.ts",
69
+ "source": "./src/tilemap.ts",
70
+ "types": "./lib/typescript/src/tilemap.d.ts",
71
+ "default": "./lib/module/tilemap.js"
72
+ },
73
+ "./geometry": {
74
+ "react-native": "./src/geometry.ts",
75
+ "source": "./src/geometry.ts",
76
+ "types": "./lib/typescript/src/geometry.d.ts",
77
+ "default": "./lib/module/geometry.js"
78
+ },
79
+ "./collision2d": {
80
+ "react-native": "./src/collision2d.ts",
81
+ "source": "./src/collision2d.ts",
82
+ "types": "./lib/typescript/src/collision2d.d.ts",
83
+ "default": "./lib/module/collision2d.js"
84
+ },
85
+ "./camera2d": {
86
+ "react-native": "./src/camera2d.ts",
87
+ "source": "./src/camera2d.ts",
88
+ "types": "./lib/typescript/src/camera2d.d.ts",
89
+ "default": "./lib/module/camera2d.js"
90
+ },
91
+ "./events": {
92
+ "react-native": "./src/events.ts",
93
+ "source": "./src/events.ts",
94
+ "types": "./lib/typescript/src/events.d.ts",
95
+ "default": "./lib/module/events.js"
96
+ },
97
+ "./assets": {
98
+ "react-native": "./src/assets.ts",
99
+ "source": "./src/assets.ts",
100
+ "types": "./lib/typescript/src/assets.d.ts",
101
+ "default": "./lib/module/assets.js"
102
+ },
103
+ "./sprites": {
104
+ "react-native": "./src/sprites.ts",
105
+ "source": "./src/sprites.ts",
106
+ "types": "./lib/typescript/src/sprites.d.ts",
107
+ "default": "./lib/module/sprites.js"
108
+ },
109
+ "./storage": {
110
+ "react-native": "./src/storage.ts",
111
+ "source": "./src/storage.ts",
112
+ "types": "./lib/typescript/src/storage.d.ts",
113
+ "default": "./lib/module/storage.js"
48
114
  }
49
115
  },
50
116
  "react-native": "./src/index.ts",
@@ -60,39 +126,52 @@
60
126
  "clean": "del-cli lib",
61
127
  "lint": "eslint .",
62
128
  "typecheck": "tsc --noEmit",
63
- "test": "node --import tsx --test test/*.test.ts",
64
- "test:coverage": "node --import tsx --experimental-test-coverage --test test/*.test.ts",
129
+ "test": "node --expose-gc --import tsx --experimental-test-module-mocks --test \"test/*.test.ts\" \"test/*.test.tsx\"",
130
+ "test:coverage": "node --expose-gc --import tsx --experimental-test-module-mocks --experimental-test-coverage --test \"test/*.test.ts\" \"test/*.test.tsx\"",
65
131
  "prepack": "bob build",
66
132
  "pack:inspect": "pnpm pack --dry-run",
67
133
  "bench:deepfreeze": "node --import tsx bench/deepFreeze.bench.ts",
134
+ "bench:spatialhash": "node --import tsx bench/spatialHash.bench.ts",
135
+ "bench:tilequeries": "node --import tsx bench/tileQueries.bench.ts",
136
+ "bench:particles": "node --import tsx bench/particles.bench.ts",
137
+ "bench:storage": "node --import tsx bench/storage.bench.ts",
68
138
  "test:coverage:gate": "node scripts/coverage-gate.mjs",
69
- "typecheck:assets": "tsc -p tsconfig.assets.json"
139
+ "typecheck:assets": "tsc -p tsconfig.assets.json",
140
+ "typecheck:api": "tsc -p tsconfig.assets.json"
70
141
  },
71
142
  "peerDependencies": {
143
+ "@react-native-async-storage/async-storage": "^2.2.0",
72
144
  "@shopify/react-native-skia": "2.11.0",
73
- "expo": "~57.0.10",
74
- "expo-asset": "~57.0.8",
145
+ "expo": "~57.0.25",
146
+ "expo-asset": "~57.0.18",
75
147
  "react": "^19.2.3",
76
- "react-native": "~0.86.2",
148
+ "react-native": "~0.86.3",
149
+ "react-native-audio-api": "^0.13.3",
77
150
  "react-native-gesture-handler": "~3.1.0",
151
+ "react-native-pulsar": "^1.7.0",
78
152
  "react-native-reanimated": "4.5.3",
79
153
  "react-native-worklets": "0.10.3"
80
154
  },
81
155
  "devDependencies": {
156
+ "@react-native-async-storage/async-storage": "2.2.0",
82
157
  "@shopify/react-native-skia": "2.11.0",
83
158
  "@types/node": "^22.0.0",
84
159
  "@types/react": "19.2.18",
85
160
  "@types/react-test-renderer": "^19.1.0",
86
161
  "del-cli": "^7.0.0",
87
162
  "eslint": "^9.39.0",
88
- "expo": "57.0.10",
89
- "expo-asset": "57.0.8",
163
+ "expo": "57.0.25",
164
+ "expo-asset": "57.0.18",
165
+ "planck": "1.5.0",
90
166
  "react": "19.2.3",
91
167
  "react-dom": "19.2.3",
92
- "react-native": "0.86.2",
168
+ "react-native": "0.86.3",
169
+ "react-native-audio-api": "0.13.3",
93
170
  "react-native-builder-bob": "^0.43.0",
94
171
  "react-native-gesture-handler": "3.1.0",
172
+ "react-native-pulsar": "1.7.0",
95
173
  "react-native-reanimated": "4.5.3",
174
+ "react-native-safe-area-context": "~5.7.0",
96
175
  "react-native-worklets": "0.10.3",
97
176
  "react-test-renderer": "19.2.3",
98
177
  "tsx": "^4.19.0",
@@ -116,5 +195,16 @@
116
195
  }
117
196
  ]
118
197
  ]
198
+ },
199
+ "peerDependenciesMeta": {
200
+ "react-native-audio-api": {
201
+ "optional": true
202
+ },
203
+ "react-native-pulsar": {
204
+ "optional": true
205
+ },
206
+ "@react-native-async-storage/async-storage": {
207
+ "optional": true
208
+ }
119
209
  }
120
210
  }