@vgai/engine 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (541) hide show
  1. package/README.md +3 -1
  2. package/dist/adapter/authoring.d.ts +404 -0
  3. package/dist/adapter/authoring.d.ts.map +1 -0
  4. package/dist/adapter/authoring.js +22 -0
  5. package/dist/adapter/colyseus-networking-adapter.d.ts +43 -0
  6. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  7. package/dist/adapter/colyseus-networking-adapter.js +38 -0
  8. package/dist/adapter/first-party-systems.d.ts +38 -0
  9. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  10. package/dist/adapter/first-party-systems.js +77 -0
  11. package/dist/adapter/game-adapter.d.ts +133 -0
  12. package/dist/adapter/game-adapter.d.ts.map +1 -0
  13. package/dist/adapter/game-adapter.js +10 -0
  14. package/dist/adapter/host-context.d.ts +73 -0
  15. package/dist/adapter/host-context.d.ts.map +1 -0
  16. package/dist/adapter/host-context.js +16 -0
  17. package/dist/adapter/index.d.ts +22 -0
  18. package/dist/adapter/index.d.ts.map +1 -0
  19. package/dist/adapter/index.js +15 -0
  20. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  21. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  22. package/dist/adapter/ingest/game-contract.js +30 -0
  23. package/dist/adapter/ingest/overlay-applier.d.ts +118 -0
  24. package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
  25. package/dist/adapter/ingest/overlay-applier.js +132 -0
  26. package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
  27. package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
  28. package/dist/adapter/ingest/overlay-apply.js +101 -0
  29. package/dist/adapter/ingest/overlay-file.d.ts +79 -0
  30. package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
  31. package/dist/adapter/ingest/overlay-file.js +66 -0
  32. package/dist/adapter/ingest/overlay-report.d.ts +113 -0
  33. package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
  34. package/dist/adapter/ingest/overlay-report.js +103 -0
  35. package/dist/adapter/ingest/scene-capture.d.ts +97 -0
  36. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  37. package/dist/adapter/ingest/scene-capture.js +248 -0
  38. package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
  39. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  40. package/dist/adapter/ingest/upstream-pin.js +50 -0
  41. package/dist/adapter/loop-gate-report.d.ts +34 -0
  42. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  43. package/dist/adapter/loop-gate-report.js +37 -0
  44. package/dist/adapter/rapier-physics-adapter.d.ts +12 -0
  45. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  46. package/dist/adapter/rapier-physics-adapter.js +46 -0
  47. package/dist/adapter/system-adapter.d.ts +133 -0
  48. package/dist/adapter/system-adapter.d.ts.map +1 -0
  49. package/dist/adapter/system-adapter.js +13 -0
  50. package/dist/adapter/transform.d.ts +18 -0
  51. package/dist/adapter/transform.d.ts.map +1 -0
  52. package/dist/adapter/transform.js +1 -0
  53. package/dist/adapter/vgai-scene-game-adapter.d.ts +116 -0
  54. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
  55. package/dist/adapter/vgai-scene-game-adapter.js +714 -0
  56. package/dist/adapter/world-kind.d.ts +30 -0
  57. package/dist/adapter/world-kind.d.ts.map +1 -0
  58. package/dist/adapter/world-kind.js +18 -0
  59. package/dist/ai/navigation.d.ts +64 -0
  60. package/dist/ai/navigation.d.ts.map +1 -0
  61. package/dist/ai/navigation.js +133 -0
  62. package/dist/animation/anim-graph-types.d.ts +25 -0
  63. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  64. package/dist/animation/anim-graph-types.js +1 -0
  65. package/dist/animation/animation-clock.d.ts +213 -0
  66. package/dist/animation/animation-clock.d.ts.map +1 -0
  67. package/dist/animation/animation-clock.js +301 -0
  68. package/dist/animation/blend-node.d.ts +22 -0
  69. package/dist/animation/blend-node.d.ts.map +1 -0
  70. package/dist/animation/blend-node.js +97 -0
  71. package/dist/animation/camera-ownership.d.ts +250 -0
  72. package/dist/animation/camera-ownership.d.ts.map +1 -0
  73. package/dist/animation/camera-ownership.js +169 -0
  74. package/dist/animation/cinematic-cues.d.ts +200 -0
  75. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  76. package/dist/animation/cinematic-cues.js +213 -0
  77. package/dist/animation/clip-map.d.ts +12 -0
  78. package/dist/animation/clip-map.d.ts.map +1 -0
  79. package/dist/animation/clip-map.js +37 -0
  80. package/dist/animation/gsap-registration.d.ts +119 -0
  81. package/dist/animation/gsap-registration.d.ts.map +1 -0
  82. package/dist/animation/gsap-registration.js +92 -0
  83. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  84. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  85. package/dist/animation/theatre-clock-binding.js +29 -0
  86. package/dist/animation/theatre-director.d.ts +242 -0
  87. package/dist/animation/theatre-director.d.ts.map +1 -0
  88. package/dist/animation/theatre-director.js +235 -0
  89. package/dist/animation/theatre-object-binding.d.ts +305 -0
  90. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  91. package/dist/animation/theatre-object-binding.js +351 -0
  92. package/dist/animation/xstate-animation-binding.d.ts +111 -0
  93. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  94. package/dist/animation/xstate-animation-binding.js +307 -0
  95. package/dist/animation/xstate-animation-meta.d.ts +228 -0
  96. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  97. package/dist/animation/xstate-animation-meta.js +221 -0
  98. package/dist/assets.d.ts +26 -0
  99. package/dist/assets.d.ts.map +1 -0
  100. package/dist/assets.js +55 -0
  101. package/dist/audio/index.d.ts +4 -0
  102. package/dist/audio/index.d.ts.map +1 -0
  103. package/dist/audio/index.js +24 -0
  104. package/dist/audio/tone-clock-binding.d.ts +75 -0
  105. package/dist/audio/tone-clock-binding.d.ts.map +1 -0
  106. package/dist/audio/tone-clock-binding.js +29 -0
  107. package/dist/audio/tone-context.d.ts +114 -0
  108. package/dist/audio/tone-context.d.ts.map +1 -0
  109. package/dist/audio/tone-context.js +39 -0
  110. package/dist/audio/tone-offline-render.d.ts +90 -0
  111. package/dist/audio/tone-offline-render.d.ts.map +1 -0
  112. package/dist/audio/tone-offline-render.js +56 -0
  113. package/dist/audio/wav-encode.d.ts +38 -0
  114. package/dist/audio/wav-encode.d.ts.map +1 -0
  115. package/dist/audio/wav-encode.js +97 -0
  116. package/dist/core/game-loop.d.ts +21 -0
  117. package/dist/core/game-loop.d.ts.map +1 -0
  118. package/dist/core/game-loop.js +130 -0
  119. package/dist/core/system-runner.d.ts +120 -0
  120. package/dist/core/system-runner.d.ts.map +1 -0
  121. package/dist/core/system-runner.js +286 -0
  122. package/dist/core/types.d.ts +58 -0
  123. package/dist/core/types.d.ts.map +1 -0
  124. package/dist/core/types.js +25 -0
  125. package/dist/data/data-asset.d.ts +101 -0
  126. package/dist/data/data-asset.d.ts.map +1 -0
  127. package/dist/data/data-asset.js +122 -0
  128. package/dist/data/data-check-core.d.ts +110 -0
  129. package/dist/data/data-check-core.d.ts.map +1 -0
  130. package/dist/data/data-check-core.js +178 -0
  131. package/dist/data/data-ref.d.ts +79 -0
  132. package/dist/data/data-ref.d.ts.map +1 -0
  133. package/dist/data/data-ref.js +130 -0
  134. package/dist/data/vite-plugin-data.d.ts +79 -0
  135. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  136. package/dist/data/vite-plugin-data.js +217 -0
  137. package/dist/dev/console-bridge.d.ts +22 -0
  138. package/dist/dev/console-bridge.d.ts.map +1 -0
  139. package/dist/dev/console-bridge.js +71 -0
  140. package/dist/dev/debug-draw.d.ts +24 -0
  141. package/dist/dev/debug-draw.d.ts.map +1 -0
  142. package/dist/dev/debug-draw.js +73 -0
  143. package/dist/dev/logger.d.ts +30 -0
  144. package/dist/dev/logger.d.ts.map +1 -0
  145. package/dist/dev/logger.js +90 -0
  146. package/dist/ecs/component-manager.d.ts +189 -0
  147. package/dist/ecs/component-manager.d.ts.map +1 -0
  148. package/dist/ecs/component-manager.js +676 -0
  149. package/dist/ecs/game-component.d.ts +97 -0
  150. package/dist/ecs/game-component.d.ts.map +1 -0
  151. package/dist/ecs/game-component.js +80 -0
  152. package/dist/ecs/hmr-swap-report.d.ts +53 -0
  153. package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
  154. package/dist/ecs/hmr-swap-report.js +55 -0
  155. package/dist/index.d.ts +37 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +30 -0
  158. package/dist/input/input-manager.d.ts +596 -0
  159. package/dist/input/input-manager.d.ts.map +1 -0
  160. package/dist/input/input-manager.js +1564 -0
  161. package/dist/input/input-types.d.ts +171 -0
  162. package/dist/input/input-types.d.ts.map +1 -0
  163. package/dist/input/input-types.js +1 -0
  164. package/dist/input/prompt-labels.d.ts +21 -0
  165. package/dist/input/prompt-labels.d.ts.map +1 -0
  166. package/dist/input/prompt-labels.js +121 -0
  167. package/dist/input/rebind-controller.d.ts +59 -0
  168. package/dist/input/rebind-controller.d.ts.map +1 -0
  169. package/dist/input/rebind-controller.js +85 -0
  170. package/dist/input/schema.d.ts +16 -0
  171. package/dist/input/schema.d.ts.map +1 -0
  172. package/dist/input/schema.js +228 -0
  173. package/dist/loader.d.ts +43 -0
  174. package/dist/loader.d.ts.map +1 -0
  175. package/dist/loader.js +59 -0
  176. package/dist/manifest/index.d.ts +5 -0
  177. package/dist/manifest/index.d.ts.map +1 -0
  178. package/dist/manifest/index.js +8 -0
  179. package/dist/manifest/load-file.d.ts +4 -0
  180. package/dist/manifest/load-file.d.ts.map +1 -0
  181. package/dist/manifest/load-file.js +14 -0
  182. package/dist/manifest/load.d.ts +117 -0
  183. package/dist/manifest/load.d.ts.map +1 -0
  184. package/dist/manifest/load.js +255 -0
  185. package/dist/manifest/schema.d.ts +173 -0
  186. package/dist/manifest/schema.d.ts.map +1 -0
  187. package/dist/manifest/schema.js +302 -0
  188. package/dist/physics/collision-system.d.ts +41 -0
  189. package/dist/physics/collision-system.d.ts.map +1 -0
  190. package/dist/physics/collision-system.js +64 -0
  191. package/dist/physics/physics-registry.d.ts +45 -0
  192. package/dist/physics/physics-registry.d.ts.map +1 -0
  193. package/dist/physics/physics-registry.js +65 -0
  194. package/dist/physics/transform-writer.d.ts +16 -0
  195. package/dist/physics/transform-writer.d.ts.map +1 -0
  196. package/dist/physics/transform-writer.js +38 -0
  197. package/dist/physics/trigger-dispatch.d.ts +24 -0
  198. package/dist/physics/trigger-dispatch.d.ts.map +1 -0
  199. package/dist/physics/trigger-dispatch.js +80 -0
  200. package/dist/react/game-state.d.ts +105 -0
  201. package/dist/react/game-state.d.ts.map +1 -0
  202. package/dist/react/game-state.js +144 -0
  203. package/dist/react/use-data.d.ts +60 -0
  204. package/dist/react/use-data.d.ts.map +1 -0
  205. package/dist/react/use-data.js +96 -0
  206. package/dist/react/use-selection.d.ts +75 -0
  207. package/dist/react/use-selection.d.ts.map +1 -0
  208. package/dist/react/use-selection.js +90 -0
  209. package/dist/render/auto-batcher.d.ts +34 -0
  210. package/dist/render/auto-batcher.d.ts.map +1 -0
  211. package/dist/render/auto-batcher.js +140 -0
  212. package/dist/render/render-batch-system.d.ts +33 -0
  213. package/dist/render/render-batch-system.d.ts.map +1 -0
  214. package/dist/render/render-batch-system.js +230 -0
  215. package/dist/render/render-features.d.ts +47 -0
  216. package/dist/render/render-features.d.ts.map +1 -0
  217. package/dist/render/render-features.js +105 -0
  218. package/dist/render/render-settings.d.ts +36 -0
  219. package/dist/render/render-settings.d.ts.map +1 -0
  220. package/dist/render/render-settings.js +51 -0
  221. package/dist/runtime/create-runtime.d.ts +280 -0
  222. package/dist/runtime/create-runtime.d.ts.map +1 -0
  223. package/dist/runtime/create-runtime.js +795 -0
  224. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  225. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  226. package/dist/runtime/frame-selector-cache.js +65 -0
  227. package/dist/runtime/game.d.ts +433 -0
  228. package/dist/runtime/game.d.ts.map +1 -0
  229. package/dist/runtime/game.js +569 -0
  230. package/dist/runtime/input-router.d.ts +78 -0
  231. package/dist/runtime/input-router.d.ts.map +1 -0
  232. package/dist/runtime/input-router.js +171 -0
  233. package/dist/runtime/mount-game.d.ts +129 -0
  234. package/dist/runtime/mount-game.d.ts.map +1 -0
  235. package/dist/runtime/mount-game.js +152 -0
  236. package/dist/runtime/mount-manifest.d.ts +119 -0
  237. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  238. package/dist/runtime/mount-manifest.js +204 -0
  239. package/dist/runtime/render-audio-control.d.ts +110 -0
  240. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  241. package/dist/runtime/render-audio-control.js +111 -0
  242. package/dist/runtime/render-control.d.ts +291 -0
  243. package/dist/runtime/render-control.d.ts.map +1 -0
  244. package/dist/runtime/render-control.js +264 -0
  245. package/dist/runtime/render-seed.d.ts +57 -0
  246. package/dist/runtime/render-seed.d.ts.map +1 -0
  247. package/dist/runtime/render-seed.js +74 -0
  248. package/dist/runtime/scene-ui-bridge.d.ts +69 -0
  249. package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
  250. package/dist/runtime/scene-ui-bridge.js +23 -0
  251. package/dist/runtime/scene-ui-data.d.ts +13 -0
  252. package/dist/runtime/scene-ui-data.d.ts.map +1 -0
  253. package/dist/runtime/scene-ui-data.js +92 -0
  254. package/dist/runtime/state-bridge.d.ts +47 -0
  255. package/dist/runtime/state-bridge.d.ts.map +1 -0
  256. package/dist/runtime/state-bridge.js +53 -0
  257. package/dist/runtime/types.d.ts +179 -0
  258. package/dist/runtime/types.d.ts.map +1 -0
  259. package/dist/runtime/types.js +1 -0
  260. package/dist/scene/asset-loaders.d.ts +79 -0
  261. package/dist/scene/asset-loaders.d.ts.map +1 -0
  262. package/dist/scene/asset-loaders.js +141 -0
  263. package/dist/scene/asset-paths.d.ts +11 -0
  264. package/dist/scene/asset-paths.d.ts.map +1 -0
  265. package/dist/scene/asset-paths.js +108 -0
  266. package/dist/scene/asset-ref-check.d.ts +88 -0
  267. package/dist/scene/asset-ref-check.d.ts.map +1 -0
  268. package/dist/scene/asset-ref-check.js +214 -0
  269. package/dist/scene/asset-registry.d.ts +30 -0
  270. package/dist/scene/asset-registry.d.ts.map +1 -0
  271. package/dist/scene/asset-registry.js +50 -0
  272. package/dist/scene/collider-dimensions.d.ts +63 -0
  273. package/dist/scene/collider-dimensions.d.ts.map +1 -0
  274. package/dist/scene/collider-dimensions.js +98 -0
  275. package/dist/scene/component-registry.d.ts +17 -0
  276. package/dist/scene/component-registry.d.ts.map +1 -0
  277. package/dist/scene/component-registry.js +28 -0
  278. package/dist/scene/defaults.d.ts +252 -0
  279. package/dist/scene/defaults.d.ts.map +1 -0
  280. package/dist/scene/defaults.js +151 -0
  281. package/dist/scene/geometries/index.d.ts +8 -0
  282. package/dist/scene/geometries/index.d.ts.map +1 -0
  283. package/dist/scene/geometries/index.js +7 -0
  284. package/dist/scene/geometries/terrain.d.ts +2 -0
  285. package/dist/scene/geometries/terrain.d.ts.map +1 -0
  286. package/dist/scene/geometries/terrain.js +37 -0
  287. package/dist/scene/geometry-registry.d.ts +24 -0
  288. package/dist/scene/geometry-registry.d.ts.map +1 -0
  289. package/dist/scene/geometry-registry.js +20 -0
  290. package/dist/scene/instance-registry.d.ts +36 -0
  291. package/dist/scene/instance-registry.d.ts.map +1 -0
  292. package/dist/scene/instance-registry.js +55 -0
  293. package/dist/scene/instancers/grid.d.ts +2 -0
  294. package/dist/scene/instancers/grid.d.ts.map +1 -0
  295. package/dist/scene/instancers/grid.js +36 -0
  296. package/dist/scene/instancers/index.d.ts +8 -0
  297. package/dist/scene/instancers/index.d.ts.map +1 -0
  298. package/dist/scene/instancers/index.js +7 -0
  299. package/dist/scene/light-camera-factory.d.ts +23 -0
  300. package/dist/scene/light-camera-factory.d.ts.map +1 -0
  301. package/dist/scene/light-camera-factory.js +68 -0
  302. package/dist/scene/material-factory.d.ts +17 -0
  303. package/dist/scene/material-factory.d.ts.map +1 -0
  304. package/dist/scene/material-factory.js +197 -0
  305. package/dist/scene/material-registry.d.ts +40 -0
  306. package/dist/scene/material-registry.d.ts.map +1 -0
  307. package/dist/scene/material-registry.js +44 -0
  308. package/dist/scene/materials/index.d.ts +8 -0
  309. package/dist/scene/materials/index.d.ts.map +1 -0
  310. package/dist/scene/materials/index.js +7 -0
  311. package/dist/scene/materials/water.d.ts +2 -0
  312. package/dist/scene/materials/water.d.ts.map +1 -0
  313. package/dist/scene/materials/water.js +54 -0
  314. package/dist/scene/parse.d.ts +23 -0
  315. package/dist/scene/parse.d.ts.map +1 -0
  316. package/dist/scene/parse.js +179 -0
  317. package/dist/scene/particles-factory.d.ts +33 -0
  318. package/dist/scene/particles-factory.d.ts.map +1 -0
  319. package/dist/scene/particles-factory.js +282 -0
  320. package/dist/scene/scene-apply.d.ts +109 -0
  321. package/dist/scene/scene-apply.d.ts.map +1 -0
  322. package/dist/scene/scene-apply.js +326 -0
  323. package/dist/scene/scene-diff-schema.d.ts +285 -0
  324. package/dist/scene/scene-diff-schema.d.ts.map +1 -0
  325. package/dist/scene/scene-diff-schema.js +92 -0
  326. package/dist/scene/scene-diff-types.d.ts +40 -0
  327. package/dist/scene/scene-diff-types.d.ts.map +1 -0
  328. package/dist/scene/scene-diff-types.js +14 -0
  329. package/dist/scene/scene-loader.d.ts +177 -0
  330. package/dist/scene/scene-loader.d.ts.map +1 -0
  331. package/dist/scene/scene-loader.js +1213 -0
  332. package/dist/scene/scene-query.d.ts +11 -0
  333. package/dist/scene/scene-query.d.ts.map +1 -0
  334. package/dist/scene/scene-query.js +63 -0
  335. package/dist/scene/scene-types.d.ts +10 -0
  336. package/dist/scene/scene-types.d.ts.map +1 -0
  337. package/dist/scene/scene-types.js +8 -0
  338. package/dist/scene/scene-version.d.ts +26 -0
  339. package/dist/scene/scene-version.d.ts.map +1 -0
  340. package/dist/scene/scene-version.js +34 -0
  341. package/dist/scene/schema/animation.d.ts +8 -0
  342. package/dist/scene/schema/animation.d.ts.map +1 -0
  343. package/dist/scene/schema/animation.js +42 -0
  344. package/dist/scene/schema/audio.d.ts +13 -0
  345. package/dist/scene/schema/audio.d.ts.map +1 -0
  346. package/dist/scene/schema/audio.js +22 -0
  347. package/dist/scene/schema/camera.d.ts +28 -0
  348. package/dist/scene/schema/camera.d.ts.map +1 -0
  349. package/dist/scene/schema/camera.js +17 -0
  350. package/dist/scene/schema/collider.d.ts +40 -0
  351. package/dist/scene/schema/collider.d.ts.map +1 -0
  352. package/dist/scene/schema/collider.js +55 -0
  353. package/dist/scene/schema/entity-ref.d.ts +31 -0
  354. package/dist/scene/schema/entity-ref.d.ts.map +1 -0
  355. package/dist/scene/schema/entity-ref.js +61 -0
  356. package/dist/scene/schema/entity.d.ts +1036 -0
  357. package/dist/scene/schema/entity.d.ts.map +1 -0
  358. package/dist/scene/schema/entity.js +153 -0
  359. package/dist/scene/schema/environment.d.ts +425 -0
  360. package/dist/scene/schema/environment.d.ts.map +1 -0
  361. package/dist/scene/schema/environment.js +357 -0
  362. package/dist/scene/schema/index.d.ts +39 -0
  363. package/dist/scene/schema/index.d.ts.map +1 -0
  364. package/dist/scene/schema/index.js +20 -0
  365. package/dist/scene/schema/instances.d.ts +14 -0
  366. package/dist/scene/schema/instances.d.ts.map +1 -0
  367. package/dist/scene/schema/instances.js +28 -0
  368. package/dist/scene/schema/joint.d.ts +23 -0
  369. package/dist/scene/schema/joint.d.ts.map +1 -0
  370. package/dist/scene/schema/joint.js +23 -0
  371. package/dist/scene/schema/light.d.ts +38 -0
  372. package/dist/scene/schema/light.d.ts.map +1 -0
  373. package/dist/scene/schema/light.js +26 -0
  374. package/dist/scene/schema/material.d.ts +199 -0
  375. package/dist/scene/schema/material.d.ts.map +1 -0
  376. package/dist/scene/schema/material.js +99 -0
  377. package/dist/scene/schema/mesh.d.ts +48 -0
  378. package/dist/scene/schema/mesh.d.ts.map +1 -0
  379. package/dist/scene/schema/mesh.js +82 -0
  380. package/dist/scene/schema/particles.d.ts +2178 -0
  381. package/dist/scene/schema/particles.d.ts.map +1 -0
  382. package/dist/scene/schema/particles.js +321 -0
  383. package/dist/scene/schema/physics.d.ts +56 -0
  384. package/dist/scene/schema/physics.d.ts.map +1 -0
  385. package/dist/scene/schema/physics.js +37 -0
  386. package/dist/scene/schema/scene-file.d.ts +304 -0
  387. package/dist/scene/schema/scene-file.d.ts.map +1 -0
  388. package/dist/scene/schema/scene-file.js +262 -0
  389. package/dist/scene/schema/shadow.d.ts +28 -0
  390. package/dist/scene/schema/shadow.d.ts.map +1 -0
  391. package/dist/scene/schema/shadow.js +20 -0
  392. package/dist/scene/schema/spline.d.ts +25 -0
  393. package/dist/scene/schema/spline.d.ts.map +1 -0
  394. package/dist/scene/schema/spline.js +15 -0
  395. package/dist/scene/schema/tuples.d.ts +12 -0
  396. package/dist/scene/schema/tuples.d.ts.map +1 -0
  397. package/dist/scene/schema/tuples.js +14 -0
  398. package/dist/scene/schema/ui.d.ts +880 -0
  399. package/dist/scene/schema/ui.d.ts.map +1 -0
  400. package/dist/scene/schema/ui.js +506 -0
  401. package/dist/scene/user-data.d.ts +171 -0
  402. package/dist/scene/user-data.d.ts.map +1 -0
  403. package/dist/scene/user-data.js +137 -0
  404. package/dist/setup/setup-audio.d.ts +20 -0
  405. package/dist/setup/setup-audio.d.ts.map +1 -0
  406. package/dist/setup/setup-audio.js +41 -0
  407. package/dist/setup/setup-particles.d.ts +17 -0
  408. package/dist/setup/setup-particles.d.ts.map +1 -0
  409. package/dist/setup/setup-particles.js +16 -0
  410. package/dist/setup/setup-physics.d.ts +25 -0
  411. package/dist/setup/setup-physics.d.ts.map +1 -0
  412. package/dist/setup/setup-physics.js +51 -0
  413. package/dist/setup/setup-renderer.d.ts +69 -0
  414. package/dist/setup/setup-renderer.d.ts.map +1 -0
  415. package/dist/setup/setup-renderer.js +363 -0
  416. package/dist/tools/define-tool.d.ts +105 -0
  417. package/dist/tools/define-tool.d.ts.map +1 -0
  418. package/dist/tools/define-tool.js +82 -0
  419. package/dist/world2d/authoring-2d.d.ts +76 -0
  420. package/dist/world2d/authoring-2d.d.ts.map +1 -0
  421. package/dist/world2d/authoring-2d.js +176 -0
  422. package/dist/world2d/capture-to-scene2d.d.ts +5 -0
  423. package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
  424. package/dist/world2d/capture-to-scene2d.js +49 -0
  425. package/dist/world2d/collision-2d.d.ts +52 -0
  426. package/dist/world2d/collision-2d.d.ts.map +1 -0
  427. package/dist/world2d/collision-2d.js +70 -0
  428. package/dist/world2d/components-2d.d.ts +47 -0
  429. package/dist/world2d/components-2d.d.ts.map +1 -0
  430. package/dist/world2d/components-2d.js +77 -0
  431. package/dist/world2d/index.d.ts +34 -0
  432. package/dist/world2d/index.d.ts.map +1 -0
  433. package/dist/world2d/index.js +32 -0
  434. package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
  435. package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
  436. package/dist/world2d/ingest-iframe-2d.js +166 -0
  437. package/dist/world2d/ingest2d.d.ts +97 -0
  438. package/dist/world2d/ingest2d.d.ts.map +1 -0
  439. package/dist/world2d/ingest2d.js +40 -0
  440. package/dist/world2d/physics2d-registry.d.ts +24 -0
  441. package/dist/world2d/physics2d-registry.d.ts.map +1 -0
  442. package/dist/world2d/physics2d-registry.js +38 -0
  443. package/dist/world2d/pixi-game-adapter.d.ts +107 -0
  444. package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
  445. package/dist/world2d/pixi-game-adapter.js +211 -0
  446. package/dist/world2d/pixi-surface.d.ts +39 -0
  447. package/dist/world2d/pixi-surface.d.ts.map +1 -0
  448. package/dist/world2d/pixi-surface.js +47 -0
  449. package/dist/world2d/scene-capture-2d.d.ts +43 -0
  450. package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
  451. package/dist/world2d/scene-capture-2d.js +92 -0
  452. package/dist/world2d/scene2d-loader.d.ts +27 -0
  453. package/dist/world2d/scene2d-loader.d.ts.map +1 -0
  454. package/dist/world2d/scene2d-loader.js +274 -0
  455. package/dist/world2d/schema/entity2d.d.ts +102 -0
  456. package/dist/world2d/schema/entity2d.d.ts.map +1 -0
  457. package/dist/world2d/schema/entity2d.js +119 -0
  458. package/dist/world2d/schema/physics2d.d.ts +46 -0
  459. package/dist/world2d/schema/physics2d.d.ts.map +1 -0
  460. package/dist/world2d/schema/physics2d.js +45 -0
  461. package/dist/world2d/schema/sprite.d.ts +42 -0
  462. package/dist/world2d/schema/sprite.d.ts.map +1 -0
  463. package/dist/world2d/schema/sprite.js +63 -0
  464. package/dist/world2d/schema/tilemap.d.ts +15 -0
  465. package/dist/world2d/schema/tilemap.d.ts.map +1 -0
  466. package/dist/world2d/schema/tilemap.js +19 -0
  467. package/dist/world2d/schema/tuples2d.d.ts +20 -0
  468. package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
  469. package/dist/world2d/schema/tuples2d.js +19 -0
  470. package/dist/world2d/system-adapters-2d.d.ts +16 -0
  471. package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
  472. package/dist/world2d/system-adapters-2d.js +37 -0
  473. package/dist/world2d/transform-writer-2d.d.ts +16 -0
  474. package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
  475. package/dist/world2d/transform-writer-2d.js +22 -0
  476. package/dist/world2d/types.d.ts +53 -0
  477. package/dist/world2d/types.d.ts.map +1 -0
  478. package/dist/world2d/types.js +1 -0
  479. package/package.json +18 -4
  480. package/src/adapter/authoring.ts +10 -0
  481. package/src/adapter/first-party-systems.ts +23 -34
  482. package/src/adapter/index.ts +1 -3
  483. package/src/adapter/system-adapter.ts +15 -22
  484. package/src/adapter/vgai-scene-game-adapter.ts +5 -14
  485. package/src/animation/anim-graph-types.ts +12 -43
  486. package/src/animation/animation-clock.ts +479 -0
  487. package/src/animation/camera-ownership.ts +467 -0
  488. package/src/animation/cinematic-cues.ts +451 -0
  489. package/src/animation/clip-map.ts +41 -0
  490. package/src/animation/gsap-registration.ts +184 -0
  491. package/src/animation/theatre-clock-binding.ts +111 -0
  492. package/src/animation/theatre-director.ts +347 -0
  493. package/src/animation/theatre-object-binding.ts +661 -0
  494. package/src/animation/xstate-animation-binding.ts +398 -0
  495. package/src/animation/xstate-animation-meta.ts +282 -0
  496. package/src/audio/index.ts +39 -7
  497. package/src/audio/tone-clock-binding.ts +98 -0
  498. package/src/audio/tone-context.ts +129 -0
  499. package/src/audio/tone-offline-render.ts +167 -0
  500. package/src/audio/wav-encode.ts +119 -0
  501. package/src/core/game-loop.ts +17 -0
  502. package/src/core/types.ts +13 -0
  503. package/src/data/data-asset.ts +167 -0
  504. package/src/data/data-check-core.ts +242 -0
  505. package/src/data/data-ref.ts +145 -0
  506. package/src/data/vite-plugin-data.ts +290 -0
  507. package/src/index.ts +48 -0
  508. package/src/input/input-manager.ts +1206 -32
  509. package/src/input/input-types.ts +155 -3
  510. package/src/input/prompt-labels.ts +122 -0
  511. package/src/input/rebind-controller.ts +105 -0
  512. package/src/input/schema.ts +206 -52
  513. package/src/react/use-data.ts +114 -0
  514. package/src/react/use-selection.tsx +135 -0
  515. package/src/runtime/create-runtime.ts +30 -9
  516. package/src/runtime/render-audio-control.ts +168 -0
  517. package/src/runtime/render-control.ts +522 -0
  518. package/src/runtime/render-seed.ts +79 -0
  519. package/src/runtime/types.ts +0 -5
  520. package/src/scene/asset-loaders.ts +10 -36
  521. package/src/scene/asset-paths.ts +0 -2
  522. package/src/scene/asset-ref-check.ts +248 -0
  523. package/src/scene/parse.ts +133 -0
  524. package/src/scene/scene-loader.ts +81 -96
  525. package/src/scene/schema/animation.ts +30 -79
  526. package/src/scene/schema/entity.ts +20 -0
  527. package/src/scene/schema/index.ts +2 -12
  528. package/src/scene/user-data.ts +8 -9
  529. package/src/setup/setup-renderer.ts +9 -2
  530. package/src/tools/define-tool.ts +152 -0
  531. package/src/animation/anim-graph.ts +0 -406
  532. package/src/animation/anim-system.ts +0 -28
  533. package/src/animation/property-track.ts +0 -178
  534. package/src/animation/schema.ts +0 -204
  535. package/src/audio/ambient.ts +0 -300
  536. package/src/audio/impacts.ts +0 -212
  537. package/src/audio/movement.ts +0 -140
  538. package/src/audio/musical.ts +0 -200
  539. package/src/audio/ui-sounds.ts +0 -171
  540. package/src/audio/vehicle.ts +0 -235
  541. package/src/audio/weapons.ts +0 -152
@@ -3,22 +3,36 @@
3
3
  // Was TS-types-only (`input-types.ts`) until T4.6 authored this Zod schema —
4
4
  // see docs/BACKBONE-TASKS.md T4.6. `InputManager.loadMap` (input-manager.ts)
5
5
  // is this schema's runtime reader: it parses via this schema, then copies
6
- // each action's `bindings` array straight into `this.actions`.
6
+ // each action's `bindings` array (and its declared `valueType`, F1) straight
7
+ // into `this.actions`/`this.actionValueTypes`.
7
8
  //
8
9
  // Every field has a `.describe()` (repo policy — powers
9
10
  // `scripts/generate-schema.ts` and the T4.1/T4.6 schema-walk coverage test).
10
11
  // No runtime dependency beyond `zod`, matching the `scene/schema/` and
11
12
  // `manifest/schema.ts` precedent.
12
13
  //
13
- // T4.1 inheritance: `input-manager.ts`'s `isPressed`/`isJustPressed`/
14
- // `isJustReleased` switch on `binding.type` and only ever handle `key`,
15
- // `mouse_button`, `gamepad_button`, and `gamepad_axis` `mouse_move` and
16
- // `gamepad_axis_pair` are authored-but-unhandled binding kinds (mouse look is
17
- // read via a free-standing `mouseDelta`/`lookStick` accumulator that no
18
- // binding gates, and there is no code path that reads `xAxis`/`yAxis` as a
19
- // pair). Authoring either kind is a confirmed dead stub — REJECTED at parse,
20
- // mirroring the `scene/schema/ui.ts` dead-field mechanism (a `.superRefine`
21
- // that throws naming the field).
14
+ // T4.1 history (now closed by F2): `mouse_move` and `gamepad_axis_pair` were
15
+ // authored-but-unhandled binding kinds REJECTED at parse via a `.superRefine`
16
+ // that threw naming the field, mirroring the `scene/schema/ui.ts` dead-field
17
+ // mechanism. F2 (spec §12 "Complete Device Backends") un-rejects both: real
18
+ // `InputManager` readers now exist for them (`collectPointerDeltaContributions`/
19
+ // `collectVector2Contributions` `mouse_move` feeds pointerDelta/vector2 from
20
+ // the existing mouseDelta accumulator; `gamepad_axis_pair` feeds vector2 from
21
+ // the coupled `xAxis`/`yAxis` gamepad reading). F2 also adds two new LIVE
22
+ // binding kinds, `touch_button`/`touch_stick` (the touch/virtual-control
23
+ // backend — see `InputManager.setTouchButton`/`setTouchStick`).
24
+ //
25
+ // F1 (spec §12 "Define Typed Action Values") adds:
26
+ // - `InputAction.valueType` — an action now DECLARES its value shape
27
+ // (`digital`/`scalar`/`vector2`/`pointerDelta`/`pointerPosition`),
28
+ // defaulted to `digital` so every pre-F1 action stays valid unchanged.
29
+ // - four new, LIVE (not dead-rejected) binding kinds — `test_axis`,
30
+ // `test_vector2`, `test_pointer_delta`, `test_pointer_position` — the
31
+ // "injected test input" backend F2's acceptance criteria names as a
32
+ // peer of keyboard/mouse/gamepad/touch. They read back a caller-injected
33
+ // raw value (InputManager.injectAxis/injectVector2/injectPointerDelta/
34
+ // injectPointerPosition) through the SAME deadzone/normalize/combine path
35
+ // real device bindings use.
22
36
 
23
37
  import { z } from 'zod';
24
38
  import type { InputAction, InputBinding, InputMapFile } from './input-types';
@@ -37,8 +51,18 @@ const MouseMoveBindingSchema = z.object({
37
51
  type: z
38
52
  .literal('mouse_move')
39
53
  .describe(
40
- 'Binding kind: raw mouse movement. REJECTED at parse (T4.1/T4.6): declared but has no ' +
41
- 'runtime reader authoring this binding throws. Do not author.',
54
+ 'Binding kind: raw mouse movement (F2, spec §12 "Complete Device Backends"). Feeds a ' +
55
+ "'pointerDelta'-valueType action with the raw accumulated mouse delta (no deadzone), and " +
56
+ "can also feed a 'vector2'-valueType action (the same delta, radial-deadzoned + unit-" +
57
+ 'circle-clamped via `deadzone`).',
58
+ ),
59
+ deadzone: z
60
+ .number()
61
+ .optional()
62
+ .describe(
63
+ "Radial deadzone magnitude applied only when this binding feeds a 'vector2'-valueType " +
64
+ "action (default 0 — no deadzone; ignored for 'pointerDelta' reads, which are never " +
65
+ 'deadzoned).',
42
66
  ),
43
67
  });
44
68
 
@@ -61,57 +85,187 @@ const GamepadAxisPairBindingSchema = z.object({
61
85
  .literal('gamepad_axis_pair')
62
86
  .describe(
63
87
  'Binding kind: a coupled (x, y) gamepad axis pair, e.g. a stick used as a 2D vector ' +
64
- '(look/aim). REJECTED at parse (T4.1/T4.6): declared but has no runtime reader only ' +
65
- '`gamepad_axis` (a single thresholded axis) is handled by isPressed/isJustPressed/' +
66
- 'isJustReleased. Authoring this binding throws. Do not author.',
88
+ '(look/aim/movement) (F2, spec §12 "Complete Device Backends"). Feeds a ' +
89
+ "'vector2'-valueType action: (xAxis, yAxis) read together, radial-deadzoned + unit-" +
90
+ 'circle-clamped the same way a real analog stick is.',
67
91
  ),
68
92
  xAxis: z.number().describe('Standard Gamepad API axis index for the X component'),
69
93
  yAxis: z.number().describe('Standard Gamepad API axis index for the Y component'),
70
94
  deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
71
95
  });
72
96
 
73
- /**
74
- * A single input binding. `mouse_move`/`gamepad_axis_pair` are dead-by-decision
75
- * (see the per-variant `.describe()` above) — the `.superRefine` below is the
76
- * actual enforcement, mirroring `scene/schema/ui.ts`'s dead-field mechanism.
77
- */
78
- export const InputBindingSchema: z.ZodType<InputBinding> = z
79
- .discriminatedUnion('type', [
80
- KeyBindingSchema,
81
- MouseButtonBindingSchema,
82
- MouseMoveBindingSchema,
83
- GamepadButtonBindingSchema,
84
- GamepadAxisBindingSchema,
85
- GamepadAxisPairBindingSchema,
86
- ])
87
- .superRefine((binding, ctx) => {
88
- if (binding.type === 'mouse_move') {
89
- ctx.addIssue({
90
- code: z.ZodIssueCode.custom,
91
- message:
92
- '`mouse_move` binding kind is authored but not implemented — InputManager.isPressed/' +
93
- 'isJustPressed/isJustReleased never handle it (mouse look is read via a free-standing ' +
94
- 'mouseDelta/lookStick accumulator, not gated by any action binding). See T4.1/T4.6.',
95
- path: ['type'],
96
- });
97
- }
98
- if (binding.type === 'gamepad_axis_pair') {
99
- ctx.addIssue({
100
- code: z.ZodIssueCode.custom,
101
- message:
102
- '`gamepad_axis_pair` binding kind is authored but not implemented — no reader consumes ' +
103
- '`xAxis`/`yAxis` as a coupled pair (only `gamepad_axis`, a single thresholded axis, is ' +
104
- 'handled by isPressed/isJustPressed/isJustReleased). See T4.1/T4.6.',
105
- path: ['type'],
106
- });
107
- }
108
- }) as z.ZodType<InputBinding>;
97
+ // ---------------------------------------------------------------------------
98
+ // F1 (spec §12) — injected test input bindings. LIVE (real runtime readers in
99
+ // InputManager's getScalar/getVector2/getPointerDelta/getPointerPosition),
100
+ // unlike the two dead stubs above. Foreshadows F2's "injected test input"
101
+ // backend: real device kinds F2 adds later feed the same typed-value
102
+ // aggregation path these exercise today.
103
+ // ---------------------------------------------------------------------------
104
+
105
+ const TestAxisBindingSchema = z.object({
106
+ type: z
107
+ .literal('test_axis')
108
+ .describe(
109
+ "Binding kind: an injected synthetic scalar value for a 'scalar'-valueType action " +
110
+ '(InputManager.injectAxis/getScalar) — the "injected test input" backend named in F2, ' +
111
+ "built in F1 as the typed scalar value model's testable source.",
112
+ ),
113
+ sourceId: z
114
+ .string()
115
+ .describe('Names the injected test source this binding reads (InputManager.injectAxis).'),
116
+ deadzone: z
117
+ .number()
118
+ .optional()
119
+ .describe(
120
+ '1D deadzone magnitude applied to the injected raw value before combine (default 0 — no ' +
121
+ 'deadzone). Values below it read as 0; values at/above it rescale from 0 (at the ' +
122
+ 'deadzone edge) to ±1 (at |raw| = 1), sign preserved.',
123
+ ),
124
+ });
125
+
126
+ const TestVector2BindingSchema = z.object({
127
+ type: z
128
+ .literal('test_vector2')
129
+ .describe(
130
+ "Binding kind: an injected synthetic {x,y} value for a 'vector2'-valueType action " +
131
+ '(InputManager.injectVector2/getVector2) — the "injected test input" backend named in ' +
132
+ "F2, built in F1 as the typed Vector2 value model's testable source.",
133
+ ),
134
+ sourceId: z
135
+ .string()
136
+ .describe('Names the injected test source this binding reads (InputManager.injectVector2).'),
137
+ deadzone: z
138
+ .number()
139
+ .optional()
140
+ .describe(
141
+ 'Radial deadzone magnitude applied to the injected raw {x,y} before combine (default 0 ' +
142
+ '— no deadzone). Vectors whose magnitude is below it read as {0,0}; at/above it, ' +
143
+ 'direction is preserved and magnitude rescales the same way the scalar deadzone does, ' +
144
+ 'then the result is clamped to the unit circle (magnitude <= 1).',
145
+ ),
146
+ });
147
+
148
+ const TestPointerDeltaBindingSchema = z.object({
149
+ type: z
150
+ .literal('test_pointer_delta')
151
+ .describe(
152
+ "Binding kind: an injected synthetic per-frame {x,y} delta for a 'pointerDelta'-" +
153
+ 'valueType action (InputManager.injectPointerDelta/getPointerDelta) — the "injected ' +
154
+ 'test input" backend named in F2. No deadzone (deltas are not deadzoned).',
155
+ ),
156
+ sourceId: z
157
+ .string()
158
+ .describe(
159
+ 'Names the injected test source this binding reads (InputManager.injectPointerDelta).',
160
+ ),
161
+ });
162
+
163
+ const TestPointerPositionBindingSchema = z.object({
164
+ type: z
165
+ .literal('test_pointer_position')
166
+ .describe(
167
+ "Binding kind: an injected synthetic absolute {x,y} position for a 'pointerPosition'-" +
168
+ 'valueType action (InputManager.injectPointerPosition/getPointerPosition) — the ' +
169
+ '"injected test input" backend named in F2.',
170
+ ),
171
+ sourceId: z
172
+ .string()
173
+ .describe(
174
+ 'Names the injected test source this binding reads (InputManager.injectPointerPosition).',
175
+ ),
176
+ });
177
+
178
+ // ---------------------------------------------------------------------------
179
+ // F2 (spec §12 "Complete Device Backends") — touch/virtual-control bindings.
180
+ // LIVE (real runtime readers in InputManager's isPressed/isJustPressed/
181
+ // isJustReleased/getDigitalSource and getVector2), driven by
182
+ // InputManager.setTouchButton/setTouchStick — the headless-testable
183
+ // injectable entry points a real on-screen touch-control UI's own
184
+ // touchstart/touchmove/touchend handlers would call (that DOM wiring is a
185
+ // thin adapter at the edge, out of scope here — see input-manager.ts).
186
+ // ---------------------------------------------------------------------------
187
+
188
+ const TouchButtonBindingSchema = z.object({
189
+ type: z
190
+ .literal('touch_button')
191
+ .describe(
192
+ "Binding kind: a virtual on-screen button for a 'digital' action " +
193
+ '(InputManager.setTouchButton/isPressed) — edge-tracked (isJustPressed/isJustReleased) ' +
194
+ 'the same way a real mouse/keyboard button is.',
195
+ ),
196
+ sourceId: z
197
+ .string()
198
+ .describe(
199
+ 'Names the virtual control zone this binding reads (InputManager.setTouchButton) — a ' +
200
+ 'touch-UI-chosen id, not a real device index.',
201
+ ),
202
+ });
203
+
204
+ const TouchStickBindingSchema = z.object({
205
+ type: z
206
+ .literal('touch_stick')
207
+ .describe(
208
+ "Binding kind: a virtual on-screen analog stick for a 'vector2' action " +
209
+ '(InputManager.setTouchStick/getVector2) — radial-deadzoned + unit-circle-clamped the ' +
210
+ 'same way a real gamepad stick is.',
211
+ ),
212
+ sourceId: z
213
+ .string()
214
+ .describe(
215
+ 'Names the virtual control zone this binding reads (InputManager.setTouchStick) — a ' +
216
+ 'touch-UI-chosen id, not a real device index.',
217
+ ),
218
+ deadzone: z
219
+ .number()
220
+ .optional()
221
+ .describe(
222
+ 'Radial deadzone magnitude applied to the raw {x,y} before combine (default 0 — no ' +
223
+ 'deadzone).',
224
+ ),
225
+ });
226
+
227
+ /** A single input binding. Every kind listed here is LIVE — F2 (spec §12) closed the last two
228
+ * dead stubs (`mouse_move`/`gamepad_axis_pair`) by giving both real `InputManager` readers. */
229
+ export const InputBindingSchema: z.ZodType<InputBinding> = z.discriminatedUnion('type', [
230
+ KeyBindingSchema,
231
+ MouseButtonBindingSchema,
232
+ MouseMoveBindingSchema,
233
+ GamepadButtonBindingSchema,
234
+ GamepadAxisBindingSchema,
235
+ GamepadAxisPairBindingSchema,
236
+ TestAxisBindingSchema,
237
+ TestVector2BindingSchema,
238
+ TestPointerDeltaBindingSchema,
239
+ TestPointerPositionBindingSchema,
240
+ TouchButtonBindingSchema,
241
+ TouchStickBindingSchema,
242
+ ]) as z.ZodType<InputBinding>;
109
243
 
110
244
  /** An action has a name (the record key) and one or more bindings. */
111
245
  export const InputActionSchema: z.ZodType<InputAction> = z.object({
246
+ valueType: z
247
+ .enum(['digital', 'scalar', 'vector2', 'pointerDelta', 'pointerPosition'])
248
+ .default('digital')
249
+ .describe(
250
+ "This action's declared value shape (F1, spec §12). 'digital' (boolean, with " +
251
+ 'pressed/justPressed/justReleased edges) is the default when omitted, matching every ' +
252
+ "action authored before F1. 'scalar' is a single deadzone-rescaled float axis. " +
253
+ "'vector2' is a radial-deadzoned, unit-circle-normalized {x,y}. 'pointerDelta' is a " +
254
+ "per-frame {x,y} movement delta, summed across sources. 'pointerPosition' is an " +
255
+ 'absolute {x,y}, last-write-wins across sources. InputManager enforces this at read ' +
256
+ 'time: reading an action through the wrong typed getter (e.g. getScalar on a ' +
257
+ "'digital' action) throws.",
258
+ ),
112
259
  bindings: z
113
260
  .array(InputBindingSchema)
114
- .describe('Bindings that all trigger this action (any one firing is enough)'),
261
+ .describe(
262
+ 'Bindings that all trigger/feed this action. Digital actions combine via OR (any one ' +
263
+ 'binding satisfied is enough). Scalar actions combine via max-magnitude across ' +
264
+ 'contributing bindings (ties keep the first-listed binding). Vector2 actions combine ' +
265
+ 'by summing contributing {x,y} values then clamping to the unit circle. PointerDelta ' +
266
+ 'actions sum contributing deltas. PointerPosition actions use the most-recently-' +
267
+ 'written contributing source (last-write-wins).',
268
+ ),
115
269
  });
116
270
 
117
271
  /**
@@ -0,0 +1,114 @@
1
+ /**
2
+ * React hooks for data assets — the tool-hooks half of
3
+ * `docs/DATA-TOOLS-DESIGN.md` §3.3, shipped with W4 (dock tools).
4
+ *
5
+ * Lives under `packages/engine/src/react/` deliberately: this is the ONE
6
+ * directory of the engine allowed to value-import react (colocated with
7
+ * `game-state.tsx` per the react-free-core rule proved by
8
+ * `test/react-core-import-ban.test.ts`). Game worlds that aren't react keep
9
+ * using `DataHandle.get()`/`subscribe()` directly (§2.3).
10
+ *
11
+ * - {@link useData} — subscribe a component to any W1 `DataHandle`; works in
12
+ * project tools, react worlds, and HUD overlays alike.
13
+ * - {@link writeData} — EDITOR-TOOL plumbing: write a whole `.data.json`
14
+ * back through the editor dev server, closing the live-tuning loop
15
+ * (widget → file write → Vite HMR → `hotSwap` → {@link useData} re-render
16
+ * → the running game reads the new value). Not for game code.
17
+ */
18
+
19
+ import { useSyncExternalStore } from 'react';
20
+ import type { DataHandle } from '../data/data-asset';
21
+
22
+ /**
23
+ * Read a data asset's current values and re-render whenever a hot edit lands
24
+ * (§3.3). A thin `useSyncExternalStore` over the handle's
25
+ * `subscribe`/`get` — any `defineData` handle works, no provider needed:
26
+ *
27
+ * ```tsx
28
+ * import { tuning } from '../data/tuning';
29
+ * const values = useData(tuning); // fresh parsed object after every hotSwap
30
+ * ```
31
+ *
32
+ * `get()` returns the same reference between successful hot swaps, so this
33
+ * re-renders exactly once per accepted edit and never in between.
34
+ */
35
+ export function useData<T>(handle: DataHandle<T>): T {
36
+ return useSyncExternalStore(
37
+ (onStoreChange) => handle.subscribe(() => onStoreChange()),
38
+ () => handle.get(),
39
+ );
40
+ }
41
+
42
+ /**
43
+ * Write a data asset's ENTIRE new value back to its `.data.json` — the write
44
+ * half of a project tool's live-tuning loop (§3.3, D1: writes are file
45
+ * writes, always). POSTs to the editor dev server's `/__editor/data-file`
46
+ * route (see its doc comment in `packages/editor/server/editor-server.ts`),
47
+ * which accepts only `src/data/**\/*.data.json` and writes immediately; the
48
+ * running game then receives the change through the normal `.data.json` HMR
49
+ * path, exactly as if VS Code had saved the file.
50
+ *
51
+ * ```tsx
52
+ * // inside a tool's onChange — spread the live values, replace one field:
53
+ * void writeData('src/data/tuning.data.json', { ...tuning.get(), gravity: v });
54
+ * ```
55
+ *
56
+ * FOR TOOLS, NOT GAME CODE: data assets are immutable at runtime (§2.1) —
57
+ * runtime state belongs in your game's own store, never written back into
58
+ * data files. Outside a running editor there is no `/__editor` server, so
59
+ * this rejects with a teaching error (a shipped game could never reach the
60
+ * route anyway — builds strip `src/tools/` entirely, §4).
61
+ *
62
+ * Serialization matches the editor Data panel's diff-minimal contract:
63
+ * `"$schema"` first, 2-space indent, trailing newline. When `value` carries
64
+ * no `"$schema"` key (the common case — `DataHandle.get()` strips it), the
65
+ * conventional sibling reference (`./<name>.schema.json`, §2.1) is restored
66
+ * so a tool write never silently drops VS Code validation from the file.
67
+ */
68
+ export async function writeData(
69
+ projectRelativePath: string,
70
+ value: Record<string, unknown>,
71
+ ): Promise<void> {
72
+ if (!projectRelativePath.startsWith('src/data/') || !projectRelativePath.endsWith('.data.json')) {
73
+ throw new Error(
74
+ `writeData: invalid path ${JSON.stringify(projectRelativePath)} — data assets live at ` +
75
+ 'src/data/**/*.data.json, addressed project-relative (docs/DATA-TOOLS-DESIGN.md §2.1), ' +
76
+ "e.g. writeData('src/data/tuning.data.json', next).",
77
+ );
78
+ }
79
+
80
+ // "$schema" first for minimal diffs; restore the conventional sibling
81
+ // reference when the caller's object (typically `{ ...handle.get() }`,
82
+ // which never carries it) omits the line.
83
+ const { $schema, ...rest } = value;
84
+ const schemaRef =
85
+ $schema ??
86
+ `./${projectRelativePath
87
+ .split('/')
88
+ .pop()
89
+ ?.replace(/\.data\.json$/, '')}.schema.json`;
90
+ const content = `${JSON.stringify({ $schema: schemaRef, ...rest }, null, 2)}\n`;
91
+
92
+ let res: Response;
93
+ try {
94
+ res = await fetch('/__editor/data-file', {
95
+ method: 'POST',
96
+ headers: { 'Content-Type': 'application/json' },
97
+ body: JSON.stringify({ path: projectRelativePath, content }),
98
+ });
99
+ } catch (err) {
100
+ throw new Error(
101
+ 'writeData: could not reach the editor dev server (/__editor/data-file) — this helper is ' +
102
+ 'editor-tool plumbing (docs/DATA-TOOLS-DESIGN.md §3.3) and only works inside the running ' +
103
+ 'editor. Game code must not write data assets: they are immutable at runtime (§2.1) — ' +
104
+ `keep runtime state in your game's own store. (${String(err)})`,
105
+ );
106
+ }
107
+ if (!res.ok) {
108
+ const detail = await res.text().catch(() => '');
109
+ throw new Error(
110
+ `writeData: the editor rejected the write to "${projectRelativePath}" ` +
111
+ `(HTTP ${res.status}${detail ? `: ${detail}` : ''}).`,
112
+ );
113
+ }
114
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * W3.1 of docs/DATA-TOOLS-DESIGN.md §3.3 — `useSelection()`, the third
3
+ * tool-hooks contract member (alongside `useData`/`writeData` from
4
+ * `use-data.ts`). Where those two hooks are about DATA ASSETS, this one is
5
+ * about the currently-selected ENTITY and the components authored on it —
6
+ * the gap a real consumer (`critter-types-w3b`'s `critter-type.tool.tsx`,
7
+ * §9.4) hit hard: with no way to read a component's own authored config, it
8
+ * had to recover species from `node.label` (a display string, not data).
9
+ *
10
+ * Scope, v1:
11
+ * - INSPECTOR-placement tools only (`placement: 'inspector'`,
12
+ * `define-tool.ts`). `EditorSelectionProvider` is host plumbing —
13
+ * `InspectorToolSection` wraps every tool render in it; dock tools
14
+ * (`ToolHost`/`BottomPanel`) have no adapter/selection in scope and never
15
+ * get a provider. Calling `useSelection()` there throws a teaching error,
16
+ * contained by the tool's `ToolErrorBoundary` (the editor survives).
17
+ * - READ-only. `config` is a shallow copy of the authored record; write
18
+ * through `InspectorProvider.set('components.<Type>.<field>', v)` /
19
+ * `writeData` (the existing paths), never by mutating what this hook
20
+ * returns. Per-entity WRITE-from-tool is deferred with `useTunable` (§10).
21
+ * - Honest degrades, not errors, when the adapter is thinner than the vgai
22
+ * first-party one: no `components` provider at all ⇒ `components: []`;
23
+ * a `components` provider present but with no optional `config()`
24
+ * accessor ⇒ each entry still appears (from `list()`) but with
25
+ * `config: null`. Both mirror the `AuthoringAdapter` optional-provider
26
+ * doctrine (§4) — an ingest/UI adapter that never implements `components`
27
+ * was already legal, and stays legal.
28
+ *
29
+ * Liveness — two existing paths reused, no new mechanism (§4's "reuse that
30
+ * path" rule):
31
+ * 1. Selection changes: `Inspector.tsx`'s own
32
+ * `useSyncExternalStore(store.subscribe, store.getSnapshot)` re-renders
33
+ * the panel, each matched `Section` gets the new `nodeId` prop, and
34
+ * `InspectorToolSection` re-creates this provider's context value.
35
+ * 2. Config edits while the SAME node stays selected: `adapter.subscribe`
36
+ * fires (the vgai adapter's store notifies on every `updateEntity`,
37
+ * which is what `InspectorProvider.set` goes through) — this hook keeps
38
+ * a local version counter bumped per notification (exactly
39
+ * `game-state.tsx`'s `useWorldObservation` pattern: the adapter has no
40
+ * snapshot/version of its own, `subscribe` is fire-only) and recomputes.
41
+ */
42
+
43
+ import {
44
+ createContext,
45
+ type ReactNode,
46
+ useContext,
47
+ useMemo,
48
+ useRef,
49
+ useSyncExternalStore,
50
+ } from 'react';
51
+ import type { AuthoringAdapter, EditorNode } from '../adapter';
52
+
53
+ interface SelectionContextValue {
54
+ adapter: AuthoringAdapter;
55
+ nodeId: string | null;
56
+ }
57
+
58
+ const SelectionContext = createContext<SelectionContextValue | null>(null);
59
+
60
+ /**
61
+ * EDITOR-side host plumbing: `InspectorToolSection` wraps a tool's rendered
62
+ * `<Component/>` in this, passing the adapter + nodeId it already holds.
63
+ * Project tools never render this themselves — it exists so `useSelection()`
64
+ * has something to read.
65
+ */
66
+ export function EditorSelectionProvider({
67
+ adapter,
68
+ nodeId,
69
+ children,
70
+ }: {
71
+ adapter: AuthoringAdapter;
72
+ nodeId: string | null;
73
+ children: ReactNode;
74
+ }) {
75
+ const value = useMemo(() => ({ adapter, nodeId }), [adapter, nodeId]);
76
+ return <SelectionContext.Provider value={value}>{children}</SelectionContext.Provider>;
77
+ }
78
+
79
+ /** One component attached to the selected entity, with its authored config
80
+ * if the adapter can produce one (see the module doc's degrade rules). */
81
+ export interface SelectedComponent {
82
+ type: string;
83
+ config: Record<string, unknown> | null;
84
+ }
85
+
86
+ export interface EditorSelection {
87
+ nodeId: string | null;
88
+ node: EditorNode | null;
89
+ components: SelectedComponent[];
90
+ }
91
+
92
+ /**
93
+ * The selected entity, live: its node, and every component attached to it
94
+ * with that component's own authored config (read-only — see module doc).
95
+ *
96
+ * Throws outside an `EditorSelectionProvider` — inspector tools always render
97
+ * inside one; a dock tool or game-code caller does not, and the error names
98
+ * the fix rather than failing silently.
99
+ */
100
+ export function useSelection(): EditorSelection {
101
+ const ctx = useContext(SelectionContext);
102
+ if (!ctx) {
103
+ throw new Error(
104
+ 'useSelection: no editor selection in context — this hook only works inside an editor-hosted ' +
105
+ "INSPECTOR tool (placement: 'inspector', docs/DATA-TOOLS-DESIGN.md §3.3/§3.2). Dock tools and " +
106
+ 'game code have no selection to read.',
107
+ );
108
+ }
109
+ const { adapter, nodeId } = ctx;
110
+
111
+ // Local version counter bumped per adapter notification — the adapter has
112
+ // no snapshot/version of its own, `subscribe` is fire-only (same pattern
113
+ // as `useWorldObservation`'s `versionRef`, game-state.tsx).
114
+ const versionRef = useRef(0);
115
+ const version = useSyncExternalStore(
116
+ (onStoreChange) =>
117
+ adapter.subscribe?.(() => {
118
+ versionRef.current++;
119
+ onStoreChange();
120
+ }) ?? (() => {}),
121
+ () => versionRef.current,
122
+ );
123
+
124
+ return useMemo(() => {
125
+ const node = nodeId ? adapter.hierarchy.node(nodeId) : null;
126
+ const types = nodeId ? (adapter.components?.list(nodeId) ?? []) : [];
127
+ const components: SelectedComponent[] = types.map(({ type }) => ({
128
+ type,
129
+ config: nodeId ? (adapter.components?.config?.(nodeId, type) ?? null) : null,
130
+ }));
131
+ return { nodeId, node, components };
132
+ // `version` has no value of its own — only its CHANGE matters, as the
133
+ // liveness signal described above.
134
+ }, [adapter, nodeId, version]);
135
+ }
@@ -474,8 +474,8 @@ export async function createGameRuntime(config: RuntimeConfig): Promise<GameSess
474
474
  return createWorldsGameRuntime(config);
475
475
  }
476
476
  const { canvas, width, height, adapter, ...sceneConfig } = config;
477
- const w = width ?? canvas.width;
478
- const h = height ?? canvas.height;
477
+ const w = Math.max(1, width ?? canvas.width);
478
+ const h = Math.max(1, height ?? canvas.height);
479
479
 
480
480
  // --- Host primitives (neutral — no first-party assumptions) ---
481
481
  const renderer = createHostRenderer(canvas, w, h);
@@ -593,8 +593,10 @@ export async function createGameRuntime(config: RuntimeConfig): Promise<GameSess
593
593
  game.play.step();
594
594
  },
595
595
  resize(rw: number, rh: number) {
596
- renderer.setSize(rw, rh);
597
- mounted.resize?.(rw, rh);
596
+ const safeWidth = Math.max(1, rw);
597
+ const safeHeight = Math.max(1, rh);
598
+ renderer.setSize(safeWidth, safeHeight);
599
+ mounted.resize?.(safeWidth, safeHeight);
598
600
  },
599
601
  get scene() {
600
602
  return mounted.scene as THREE.Scene;
@@ -983,8 +985,14 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
983
985
  }
984
986
  const mountSpecs = specs as (ThreeWorldMountSpec | PixiWorldMountSpec | ReactWorldMountSpec)[];
985
987
 
986
- const w = width ?? (container as HTMLElement & { clientWidth?: number }).clientWidth ?? 0;
987
- const h = height ?? (container as HTMLElement & { clientHeight?: number }).clientHeight ?? 0;
988
+ const w = Math.max(
989
+ 1,
990
+ width ?? (container as HTMLElement & { clientWidth?: number }).clientWidth ?? 0,
991
+ );
992
+ const h = Math.max(
993
+ 1,
994
+ height ?? (container as HTMLElement & { clientHeight?: number }).clientHeight ?? 0,
995
+ );
988
996
  const dpr = headless
989
997
  ? 1
990
998
  : Math.min(typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1, 2);
@@ -1031,8 +1039,19 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
1031
1039
  surfacesById.set(entry.id, surface);
1032
1040
  });
1033
1041
 
1034
- // One shared UI overlay, above every canvas.
1042
+ // One shared UI overlay, above every canvas. I8 render-integration seam
1043
+ // (docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §15 I8, C1 review note):
1044
+ // the legacy single-world path (above) reuses/stamps a stable `#example-ui`
1045
+ // id so a capture host has a reliable selector for "the HUD/letterbox
1046
+ // overlay" — this worlds path had no such id at all, so a render-mode page
1047
+ // built on `createWorldsGameRuntime` (multi-world manifests, including a
1048
+ // react-HUD-over-threejs cinematic) had no stable selector to composite-
1049
+ // screenshot. `vgai-ui-overlay` is deliberately a DIFFERENT id than the
1050
+ // legacy path's `example-ui` (not reused/aliased) — the two runtime paths
1051
+ // mount genuinely different DOM subtrees, and collapsing them onto one id
1052
+ // would make a caller's selector ambiguous about which mount produced it.
1035
1053
  const uiContainer = document.createElement('div');
1054
+ uiContainer.id = 'vgai-ui-overlay';
1036
1055
  uiContainer.style.cssText =
1037
1056
  `position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;` +
1038
1057
  `z-index:${stacked.length + 1};`;
@@ -1124,9 +1143,11 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
1124
1143
  game.play.step();
1125
1144
  },
1126
1145
  resize(rw: number, rh: number) {
1146
+ const safeWidth = Math.max(1, rw);
1147
+ const safeHeight = Math.max(1, rh);
1127
1148
  for (const entry of mountedEntries) {
1128
- entry.renderer?.setSize(rw, rh, false);
1129
- entry.mounted.resize?.(rw, rh);
1149
+ entry.renderer?.setSize(safeWidth, safeHeight, false);
1150
+ entry.mounted.resize?.(safeWidth, safeHeight);
1130
1151
  }
1131
1152
  },
1132
1153
  // `GameSession.scene`/`.camera`/`.mounted` alias `Game.defaultWorld` (T6.1