@vgai/engine 0.5.0 → 0.5.2

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 (538) hide show
  1. package/package.json +1 -1
  2. package/schemas/engine-capabilities.json +4 -4
  3. package/schemas/vgai-game.schema.json +2 -2
  4. package/src/adapter/authoring.ts +42 -0
  5. package/src/adapter/index.ts +3 -0
  6. package/src/adapter/ingest/overlay-apply.ts +50 -6
  7. package/src/adapter/ingest/scene-capture.ts +51 -2
  8. package/src/adapter/vgai-scene-game-adapter.ts +24 -0
  9. package/src/manifest/schema.ts +7 -3
  10. package/src/runtime/create-runtime.ts +97 -0
  11. package/src/runtime/game.ts +11 -1
  12. package/src/scene/asset-ref-check.ts +1 -1
  13. package/src/scene/scene-loader.ts +2 -2
  14. package/src/scene/user-data.ts +18 -0
  15. package/src/world3d-react/behavior.tsx +19 -11
  16. package/src/world3d-react/r3f-adapter.tsx +8 -0
  17. package/dist/adapter/adapter-surface.d.ts +0 -30
  18. package/dist/adapter/adapter-surface.d.ts.map +0 -1
  19. package/dist/adapter/adapter-surface.js +0 -18
  20. package/dist/adapter/authoring.d.ts +0 -461
  21. package/dist/adapter/authoring.d.ts.map +0 -1
  22. package/dist/adapter/authoring.js +0 -22
  23. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  24. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  25. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  26. package/dist/adapter/first-party-systems.d.ts +0 -38
  27. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  28. package/dist/adapter/first-party-systems.js +0 -77
  29. package/dist/adapter/game-adapter.d.ts +0 -133
  30. package/dist/adapter/game-adapter.d.ts.map +0 -1
  31. package/dist/adapter/game-adapter.js +0 -10
  32. package/dist/adapter/host-context.d.ts +0 -71
  33. package/dist/adapter/host-context.d.ts.map +0 -1
  34. package/dist/adapter/host-context.js +0 -16
  35. package/dist/adapter/index.d.ts +0 -22
  36. package/dist/adapter/index.d.ts.map +0 -1
  37. package/dist/adapter/index.js +0 -15
  38. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  39. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  40. package/dist/adapter/ingest/game-contract.js +0 -30
  41. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  42. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  43. package/dist/adapter/ingest/overlay-applier.js +0 -132
  44. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  45. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  46. package/dist/adapter/ingest/overlay-apply.js +0 -101
  47. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  48. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  49. package/dist/adapter/ingest/overlay-file.js +0 -66
  50. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  51. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  52. package/dist/adapter/ingest/overlay-report.js +0 -103
  53. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  54. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  55. package/dist/adapter/ingest/scene-capture.js +0 -248
  56. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  57. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  58. package/dist/adapter/ingest/upstream-pin.js +0 -50
  59. package/dist/adapter/loop-gate-report.d.ts +0 -34
  60. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  61. package/dist/adapter/loop-gate-report.js +0 -37
  62. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  63. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  64. package/dist/adapter/rapier-physics-adapter.js +0 -46
  65. package/dist/adapter/system-adapter.d.ts +0 -206
  66. package/dist/adapter/system-adapter.d.ts.map +0 -1
  67. package/dist/adapter/system-adapter.js +0 -13
  68. package/dist/adapter/transform.d.ts +0 -18
  69. package/dist/adapter/transform.d.ts.map +0 -1
  70. package/dist/adapter/transform.js +0 -1
  71. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
  72. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  73. package/dist/adapter/vgai-scene-game-adapter.js +0 -762
  74. package/dist/ai/navigation.d.ts +0 -64
  75. package/dist/ai/navigation.d.ts.map +0 -1
  76. package/dist/ai/navigation.js +0 -133
  77. package/dist/animation/anim-graph-types.d.ts +0 -25
  78. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  79. package/dist/animation/anim-graph-types.js +0 -1
  80. package/dist/animation/animation-clock.d.ts +0 -213
  81. package/dist/animation/animation-clock.d.ts.map +0 -1
  82. package/dist/animation/animation-clock.js +0 -301
  83. package/dist/animation/blend-node.d.ts +0 -22
  84. package/dist/animation/blend-node.d.ts.map +0 -1
  85. package/dist/animation/blend-node.js +0 -97
  86. package/dist/animation/camera-ownership.d.ts +0 -250
  87. package/dist/animation/camera-ownership.d.ts.map +0 -1
  88. package/dist/animation/camera-ownership.js +0 -169
  89. package/dist/animation/cinematic-cues.d.ts +0 -200
  90. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  91. package/dist/animation/cinematic-cues.js +0 -213
  92. package/dist/animation/clip-map.d.ts +0 -12
  93. package/dist/animation/clip-map.d.ts.map +0 -1
  94. package/dist/animation/clip-map.js +0 -37
  95. package/dist/animation/gsap-registration.d.ts +0 -119
  96. package/dist/animation/gsap-registration.d.ts.map +0 -1
  97. package/dist/animation/gsap-registration.js +0 -92
  98. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  99. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  100. package/dist/animation/theatre-clock-binding.js +0 -29
  101. package/dist/animation/theatre-director.d.ts +0 -242
  102. package/dist/animation/theatre-director.d.ts.map +0 -1
  103. package/dist/animation/theatre-director.js +0 -235
  104. package/dist/animation/theatre-object-binding.d.ts +0 -305
  105. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  106. package/dist/animation/theatre-object-binding.js +0 -351
  107. package/dist/animation/xstate-animation-binding.d.ts +0 -56
  108. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  109. package/dist/animation/xstate-animation-binding.js +0 -331
  110. package/dist/animation/xstate-animation-meta.d.ts +0 -266
  111. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  112. package/dist/animation/xstate-animation-meta.js +0 -252
  113. package/dist/assets.d.ts +0 -26
  114. package/dist/assets.d.ts.map +0 -1
  115. package/dist/assets.js +0 -55
  116. package/dist/audio/index.d.ts +0 -4
  117. package/dist/audio/index.d.ts.map +0 -1
  118. package/dist/audio/index.js +0 -24
  119. package/dist/audio/tone-clock-binding.d.ts +0 -75
  120. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  121. package/dist/audio/tone-clock-binding.js +0 -29
  122. package/dist/audio/tone-context.d.ts +0 -114
  123. package/dist/audio/tone-context.d.ts.map +0 -1
  124. package/dist/audio/tone-context.js +0 -39
  125. package/dist/audio/tone-offline-render.d.ts +0 -90
  126. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  127. package/dist/audio/tone-offline-render.js +0 -56
  128. package/dist/audio/wav-encode.d.ts +0 -38
  129. package/dist/audio/wav-encode.d.ts.map +0 -1
  130. package/dist/audio/wav-encode.js +0 -97
  131. package/dist/character/cloth-sim.d.ts +0 -179
  132. package/dist/character/cloth-sim.d.ts.map +0 -1
  133. package/dist/character/cloth-sim.js +0 -334
  134. package/dist/character/spring-chain.d.ts +0 -135
  135. package/dist/character/spring-chain.d.ts.map +0 -1
  136. package/dist/character/spring-chain.js +0 -165
  137. package/dist/core/game-loop.d.ts +0 -42
  138. package/dist/core/game-loop.d.ts.map +0 -1
  139. package/dist/core/game-loop.js +0 -167
  140. package/dist/core/seeded-random.d.ts +0 -69
  141. package/dist/core/seeded-random.d.ts.map +0 -1
  142. package/dist/core/seeded-random.js +0 -121
  143. package/dist/core/system-runner.d.ts +0 -120
  144. package/dist/core/system-runner.d.ts.map +0 -1
  145. package/dist/core/system-runner.js +0 -297
  146. package/dist/core/types.d.ts +0 -92
  147. package/dist/core/types.d.ts.map +0 -1
  148. package/dist/core/types.js +0 -25
  149. package/dist/data/data-asset.d.ts +0 -101
  150. package/dist/data/data-asset.d.ts.map +0 -1
  151. package/dist/data/data-asset.js +0 -122
  152. package/dist/data/data-check-core.d.ts +0 -110
  153. package/dist/data/data-check-core.d.ts.map +0 -1
  154. package/dist/data/data-check-core.js +0 -178
  155. package/dist/data/data-ref.d.ts +0 -79
  156. package/dist/data/data-ref.d.ts.map +0 -1
  157. package/dist/data/data-ref.js +0 -130
  158. package/dist/data/vite-plugin-data.d.ts +0 -79
  159. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  160. package/dist/data/vite-plugin-data.js +0 -217
  161. package/dist/dev/console-bridge.d.ts +0 -22
  162. package/dist/dev/console-bridge.d.ts.map +0 -1
  163. package/dist/dev/console-bridge.js +0 -71
  164. package/dist/dev/debug-draw.d.ts +0 -24
  165. package/dist/dev/debug-draw.d.ts.map +0 -1
  166. package/dist/dev/debug-draw.js +0 -73
  167. package/dist/dev/logger.d.ts +0 -30
  168. package/dist/dev/logger.d.ts.map +0 -1
  169. package/dist/dev/logger.js +0 -90
  170. package/dist/dev/performance-profiler.d.ts +0 -60
  171. package/dist/dev/performance-profiler.d.ts.map +0 -1
  172. package/dist/dev/performance-profiler.js +0 -181
  173. package/dist/dev/webgl-gpu-timer.d.ts +0 -8
  174. package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
  175. package/dist/dev/webgl-gpu-timer.js +0 -52
  176. package/dist/ecs/component-manager.d.ts +0 -205
  177. package/dist/ecs/component-manager.d.ts.map +0 -1
  178. package/dist/ecs/component-manager.js +0 -706
  179. package/dist/ecs/game-component.d.ts +0 -146
  180. package/dist/ecs/game-component.d.ts.map +0 -1
  181. package/dist/ecs/game-component.js +0 -141
  182. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  183. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  184. package/dist/ecs/hmr-swap-report.js +0 -55
  185. package/dist/humanoid/bake.operation.d.ts +0 -119
  186. package/dist/humanoid/bake.operation.d.ts.map +0 -1
  187. package/dist/humanoid/bake.operation.js +0 -228
  188. package/dist/humanoid/body.d.ts +0 -101
  189. package/dist/humanoid/body.d.ts.map +0 -1
  190. package/dist/humanoid/body.js +0 -530
  191. package/dist/humanoid/clips.d.ts +0 -62
  192. package/dist/humanoid/clips.d.ts.map +0 -1
  193. package/dist/humanoid/clips.js +0 -121
  194. package/dist/humanoid/compose.d.ts +0 -75
  195. package/dist/humanoid/compose.d.ts.map +0 -1
  196. package/dist/humanoid/compose.js +0 -176
  197. package/dist/humanoid/generate.d.ts +0 -92
  198. package/dist/humanoid/generate.d.ts.map +0 -1
  199. package/dist/humanoid/generate.js +0 -124
  200. package/dist/humanoid/index.d.ts +0 -24
  201. package/dist/humanoid/index.d.ts.map +0 -1
  202. package/dist/humanoid/index.js +0 -18
  203. package/dist/humanoid/schema.d.ts +0 -35
  204. package/dist/humanoid/schema.d.ts.map +0 -1
  205. package/dist/humanoid/schema.js +0 -87
  206. package/dist/humanoid/skeleton.d.ts +0 -103
  207. package/dist/humanoid/skeleton.d.ts.map +0 -1
  208. package/dist/humanoid/skeleton.js +0 -289
  209. package/dist/index.d.ts +0 -37
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js +0 -30
  212. package/dist/input/input-manager.d.ts +0 -945
  213. package/dist/input/input-manager.d.ts.map +0 -1
  214. package/dist/input/input-manager.js +0 -2207
  215. package/dist/input/input-types.d.ts +0 -174
  216. package/dist/input/input-types.d.ts.map +0 -1
  217. package/dist/input/input-types.js +0 -1
  218. package/dist/input/prompt-labels.d.ts +0 -21
  219. package/dist/input/prompt-labels.d.ts.map +0 -1
  220. package/dist/input/prompt-labels.js +0 -121
  221. package/dist/input/rebind-controller.d.ts +0 -59
  222. package/dist/input/rebind-controller.d.ts.map +0 -1
  223. package/dist/input/rebind-controller.js +0 -85
  224. package/dist/input/schema.d.ts +0 -16
  225. package/dist/input/schema.d.ts.map +0 -1
  226. package/dist/input/schema.js +0 -228
  227. package/dist/loader.d.ts +0 -43
  228. package/dist/loader.d.ts.map +0 -1
  229. package/dist/loader.js +0 -59
  230. package/dist/manifest/index.d.ts +0 -5
  231. package/dist/manifest/index.d.ts.map +0 -1
  232. package/dist/manifest/index.js +0 -8
  233. package/dist/manifest/load-file.d.ts +0 -4
  234. package/dist/manifest/load-file.d.ts.map +0 -1
  235. package/dist/manifest/load-file.js +0 -14
  236. package/dist/manifest/load.d.ts +0 -144
  237. package/dist/manifest/load.d.ts.map +0 -1
  238. package/dist/manifest/load.js +0 -273
  239. package/dist/manifest/schema.d.ts +0 -230
  240. package/dist/manifest/schema.d.ts.map +0 -1
  241. package/dist/manifest/schema.js +0 -394
  242. package/dist/physics/collision-system.d.ts +0 -41
  243. package/dist/physics/collision-system.d.ts.map +0 -1
  244. package/dist/physics/collision-system.js +0 -64
  245. package/dist/physics/physics-registry.d.ts +0 -45
  246. package/dist/physics/physics-registry.d.ts.map +0 -1
  247. package/dist/physics/physics-registry.js +0 -65
  248. package/dist/physics/transform-writer.d.ts +0 -16
  249. package/dist/physics/transform-writer.d.ts.map +0 -1
  250. package/dist/physics/transform-writer.js +0 -38
  251. package/dist/physics/trigger-dispatch.d.ts +0 -24
  252. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  253. package/dist/physics/trigger-dispatch.js +0 -80
  254. package/dist/react/game-state.d.ts +0 -156
  255. package/dist/react/game-state.d.ts.map +0 -1
  256. package/dist/react/game-state.js +0 -222
  257. package/dist/react/root-adapter.d.ts +0 -11
  258. package/dist/react/root-adapter.d.ts.map +0 -1
  259. package/dist/react/root-adapter.js +0 -41
  260. package/dist/react/unmanaged-root-detector.d.ts +0 -12
  261. package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
  262. package/dist/react/unmanaged-root-detector.js +0 -45
  263. package/dist/react/use-data.d.ts +0 -60
  264. package/dist/react/use-data.d.ts.map +0 -1
  265. package/dist/react/use-data.js +0 -101
  266. package/dist/react/use-selection.d.ts +0 -75
  267. package/dist/react/use-selection.d.ts.map +0 -1
  268. package/dist/react/use-selection.js +0 -90
  269. package/dist/render/auto-batcher.d.ts +0 -34
  270. package/dist/render/auto-batcher.d.ts.map +0 -1
  271. package/dist/render/auto-batcher.js +0 -140
  272. package/dist/render/render-batch-system.d.ts +0 -33
  273. package/dist/render/render-batch-system.d.ts.map +0 -1
  274. package/dist/render/render-batch-system.js +0 -230
  275. package/dist/render/render-features.d.ts +0 -47
  276. package/dist/render/render-features.d.ts.map +0 -1
  277. package/dist/render/render-features.js +0 -105
  278. package/dist/render/render-settings.d.ts +0 -36
  279. package/dist/render/render-settings.d.ts.map +0 -1
  280. package/dist/render/render-settings.js +0 -51
  281. package/dist/runtime/create-runtime.d.ts +0 -249
  282. package/dist/runtime/create-runtime.d.ts.map +0 -1
  283. package/dist/runtime/create-runtime.js +0 -641
  284. package/dist/runtime/debug-bridge.d.ts +0 -257
  285. package/dist/runtime/debug-bridge.d.ts.map +0 -1
  286. package/dist/runtime/debug-bridge.js +0 -224
  287. package/dist/runtime/debug-registry.d.ts +0 -288
  288. package/dist/runtime/debug-registry.d.ts.map +0 -1
  289. package/dist/runtime/debug-registry.js +0 -513
  290. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  291. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  292. package/dist/runtime/frame-selector-cache.js +0 -65
  293. package/dist/runtime/game.d.ts +0 -496
  294. package/dist/runtime/game.d.ts.map +0 -1
  295. package/dist/runtime/game.js +0 -741
  296. package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
  297. package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
  298. package/dist/runtime/gameplay-rng-trap.js +0 -96
  299. package/dist/runtime/input-router.d.ts +0 -78
  300. package/dist/runtime/input-router.d.ts.map +0 -1
  301. package/dist/runtime/input-router.js +0 -171
  302. package/dist/runtime/mount-game.d.ts +0 -129
  303. package/dist/runtime/mount-game.d.ts.map +0 -1
  304. package/dist/runtime/mount-game.js +0 -152
  305. package/dist/runtime/mount-manifest.d.ts +0 -173
  306. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  307. package/dist/runtime/mount-manifest.js +0 -297
  308. package/dist/runtime/render-audio-control.d.ts +0 -110
  309. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  310. package/dist/runtime/render-audio-control.js +0 -111
  311. package/dist/runtime/render-control.d.ts +0 -291
  312. package/dist/runtime/render-control.d.ts.map +0 -1
  313. package/dist/runtime/render-control.js +0 -264
  314. package/dist/runtime/render-seed.d.ts +0 -57
  315. package/dist/runtime/render-seed.d.ts.map +0 -1
  316. package/dist/runtime/render-seed.js +0 -74
  317. package/dist/runtime/state-bridge.d.ts +0 -61
  318. package/dist/runtime/state-bridge.d.ts.map +0 -1
  319. package/dist/runtime/state-bridge.js +0 -63
  320. package/dist/runtime/types.d.ts +0 -253
  321. package/dist/runtime/types.d.ts.map +0 -1
  322. package/dist/runtime/types.js +0 -1
  323. package/dist/scene/asset-loaders.d.ts +0 -79
  324. package/dist/scene/asset-loaders.d.ts.map +0 -1
  325. package/dist/scene/asset-loaders.js +0 -141
  326. package/dist/scene/asset-paths.d.ts +0 -11
  327. package/dist/scene/asset-paths.d.ts.map +0 -1
  328. package/dist/scene/asset-paths.js +0 -108
  329. package/dist/scene/asset-ref-check.d.ts +0 -88
  330. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  331. package/dist/scene/asset-ref-check.js +0 -214
  332. package/dist/scene/asset-registry.d.ts +0 -38
  333. package/dist/scene/asset-registry.d.ts.map +0 -1
  334. package/dist/scene/asset-registry.js +0 -66
  335. package/dist/scene/collider-dimensions.d.ts +0 -63
  336. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  337. package/dist/scene/collider-dimensions.js +0 -98
  338. package/dist/scene/component-registry.d.ts +0 -22
  339. package/dist/scene/component-registry.d.ts.map +0 -1
  340. package/dist/scene/component-registry.js +0 -37
  341. package/dist/scene/defaults.d.ts +0 -252
  342. package/dist/scene/defaults.d.ts.map +0 -1
  343. package/dist/scene/defaults.js +0 -151
  344. package/dist/scene/geometries/index.d.ts +0 -8
  345. package/dist/scene/geometries/index.d.ts.map +0 -1
  346. package/dist/scene/geometries/index.js +0 -7
  347. package/dist/scene/geometries/terrain.d.ts +0 -2
  348. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  349. package/dist/scene/geometries/terrain.js +0 -37
  350. package/dist/scene/geometry-registry.d.ts +0 -24
  351. package/dist/scene/geometry-registry.d.ts.map +0 -1
  352. package/dist/scene/geometry-registry.js +0 -20
  353. package/dist/scene/instance-registry.d.ts +0 -36
  354. package/dist/scene/instance-registry.d.ts.map +0 -1
  355. package/dist/scene/instance-registry.js +0 -55
  356. package/dist/scene/instancers/grid.d.ts +0 -2
  357. package/dist/scene/instancers/grid.d.ts.map +0 -1
  358. package/dist/scene/instancers/grid.js +0 -36
  359. package/dist/scene/instancers/index.d.ts +0 -8
  360. package/dist/scene/instancers/index.d.ts.map +0 -1
  361. package/dist/scene/instancers/index.js +0 -7
  362. package/dist/scene/light-camera-factory.d.ts +0 -23
  363. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  364. package/dist/scene/light-camera-factory.js +0 -68
  365. package/dist/scene/material-factory.d.ts +0 -17
  366. package/dist/scene/material-factory.d.ts.map +0 -1
  367. package/dist/scene/material-factory.js +0 -197
  368. package/dist/scene/material-registry.d.ts +0 -40
  369. package/dist/scene/material-registry.d.ts.map +0 -1
  370. package/dist/scene/material-registry.js +0 -44
  371. package/dist/scene/materials/index.d.ts +0 -8
  372. package/dist/scene/materials/index.d.ts.map +0 -1
  373. package/dist/scene/materials/index.js +0 -7
  374. package/dist/scene/materials/water.d.ts +0 -2
  375. package/dist/scene/materials/water.d.ts.map +0 -1
  376. package/dist/scene/materials/water.js +0 -54
  377. package/dist/scene/parse.d.ts +0 -23
  378. package/dist/scene/parse.d.ts.map +0 -1
  379. package/dist/scene/parse.js +0 -179
  380. package/dist/scene/particles-factory.d.ts +0 -33
  381. package/dist/scene/particles-factory.d.ts.map +0 -1
  382. package/dist/scene/particles-factory.js +0 -282
  383. package/dist/scene/scene-apply.d.ts +0 -109
  384. package/dist/scene/scene-apply.d.ts.map +0 -1
  385. package/dist/scene/scene-apply.js +0 -370
  386. package/dist/scene/scene-diff-schema.d.ts +0 -285
  387. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  388. package/dist/scene/scene-diff-schema.js +0 -92
  389. package/dist/scene/scene-diff-types.d.ts +0 -40
  390. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  391. package/dist/scene/scene-diff-types.js +0 -14
  392. package/dist/scene/scene-loader.d.ts +0 -167
  393. package/dist/scene/scene-loader.d.ts.map +0 -1
  394. package/dist/scene/scene-loader.js +0 -1211
  395. package/dist/scene/scene-query.d.ts +0 -11
  396. package/dist/scene/scene-query.d.ts.map +0 -1
  397. package/dist/scene/scene-query.js +0 -63
  398. package/dist/scene/scene-types.d.ts +0 -10
  399. package/dist/scene/scene-types.d.ts.map +0 -1
  400. package/dist/scene/scene-types.js +0 -8
  401. package/dist/scene/scene-version.d.ts +0 -26
  402. package/dist/scene/scene-version.d.ts.map +0 -1
  403. package/dist/scene/scene-version.js +0 -34
  404. package/dist/scene/schema/animation.d.ts +0 -8
  405. package/dist/scene/schema/animation.d.ts.map +0 -1
  406. package/dist/scene/schema/animation.js +0 -42
  407. package/dist/scene/schema/audio.d.ts +0 -13
  408. package/dist/scene/schema/audio.d.ts.map +0 -1
  409. package/dist/scene/schema/audio.js +0 -22
  410. package/dist/scene/schema/camera.d.ts +0 -28
  411. package/dist/scene/schema/camera.d.ts.map +0 -1
  412. package/dist/scene/schema/camera.js +0 -17
  413. package/dist/scene/schema/collider.d.ts +0 -40
  414. package/dist/scene/schema/collider.d.ts.map +0 -1
  415. package/dist/scene/schema/collider.js +0 -55
  416. package/dist/scene/schema/entity-ref.d.ts +0 -31
  417. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  418. package/dist/scene/schema/entity-ref.js +0 -61
  419. package/dist/scene/schema/entity.d.ts +0 -1036
  420. package/dist/scene/schema/entity.d.ts.map +0 -1
  421. package/dist/scene/schema/entity.js +0 -153
  422. package/dist/scene/schema/environment.d.ts +0 -425
  423. package/dist/scene/schema/environment.d.ts.map +0 -1
  424. package/dist/scene/schema/environment.js +0 -357
  425. package/dist/scene/schema/index.d.ts +0 -37
  426. package/dist/scene/schema/index.d.ts.map +0 -1
  427. package/dist/scene/schema/index.js +0 -19
  428. package/dist/scene/schema/instances.d.ts +0 -14
  429. package/dist/scene/schema/instances.d.ts.map +0 -1
  430. package/dist/scene/schema/instances.js +0 -28
  431. package/dist/scene/schema/joint.d.ts +0 -23
  432. package/dist/scene/schema/joint.d.ts.map +0 -1
  433. package/dist/scene/schema/joint.js +0 -23
  434. package/dist/scene/schema/light.d.ts +0 -38
  435. package/dist/scene/schema/light.d.ts.map +0 -1
  436. package/dist/scene/schema/light.js +0 -26
  437. package/dist/scene/schema/material.d.ts +0 -199
  438. package/dist/scene/schema/material.d.ts.map +0 -1
  439. package/dist/scene/schema/material.js +0 -103
  440. package/dist/scene/schema/mesh.d.ts +0 -48
  441. package/dist/scene/schema/mesh.d.ts.map +0 -1
  442. package/dist/scene/schema/mesh.js +0 -82
  443. package/dist/scene/schema/particles.d.ts +0 -2178
  444. package/dist/scene/schema/particles.d.ts.map +0 -1
  445. package/dist/scene/schema/particles.js +0 -321
  446. package/dist/scene/schema/physics.d.ts +0 -56
  447. package/dist/scene/schema/physics.d.ts.map +0 -1
  448. package/dist/scene/schema/physics.js +0 -37
  449. package/dist/scene/schema/scene-file.d.ts +0 -303
  450. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  451. package/dist/scene/schema/scene-file.js +0 -256
  452. package/dist/scene/schema/shadow.d.ts +0 -28
  453. package/dist/scene/schema/shadow.d.ts.map +0 -1
  454. package/dist/scene/schema/shadow.js +0 -20
  455. package/dist/scene/schema/spline.d.ts +0 -25
  456. package/dist/scene/schema/spline.d.ts.map +0 -1
  457. package/dist/scene/schema/spline.js +0 -15
  458. package/dist/scene/schema/tuples.d.ts +0 -12
  459. package/dist/scene/schema/tuples.d.ts.map +0 -1
  460. package/dist/scene/schema/tuples.js +0 -14
  461. package/dist/scene/user-data.d.ts +0 -185
  462. package/dist/scene/user-data.d.ts.map +0 -1
  463. package/dist/scene/user-data.js +0 -144
  464. package/dist/setup/setup-audio.d.ts +0 -20
  465. package/dist/setup/setup-audio.d.ts.map +0 -1
  466. package/dist/setup/setup-audio.js +0 -41
  467. package/dist/setup/setup-particles.d.ts +0 -17
  468. package/dist/setup/setup-particles.d.ts.map +0 -1
  469. package/dist/setup/setup-particles.js +0 -16
  470. package/dist/setup/setup-physics.d.ts +0 -25
  471. package/dist/setup/setup-physics.d.ts.map +0 -1
  472. package/dist/setup/setup-physics.js +0 -51
  473. package/dist/setup/setup-renderer.d.ts +0 -69
  474. package/dist/setup/setup-renderer.d.ts.map +0 -1
  475. package/dist/setup/setup-renderer.js +0 -363
  476. package/dist/tools/define-tool.d.ts +0 -130
  477. package/dist/tools/define-tool.d.ts.map +0 -1
  478. package/dist/tools/define-tool.js +0 -96
  479. package/dist/world2d/authoring-2d.d.ts +0 -80
  480. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  481. package/dist/world2d/authoring-2d.js +0 -195
  482. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  483. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  484. package/dist/world2d/capture-to-scene2d.js +0 -49
  485. package/dist/world2d/collision-2d.d.ts +0 -52
  486. package/dist/world2d/collision-2d.d.ts.map +0 -1
  487. package/dist/world2d/collision-2d.js +0 -70
  488. package/dist/world2d/components-2d.d.ts +0 -47
  489. package/dist/world2d/components-2d.d.ts.map +0 -1
  490. package/dist/world2d/components-2d.js +0 -77
  491. package/dist/world2d/index.d.ts +0 -34
  492. package/dist/world2d/index.d.ts.map +0 -1
  493. package/dist/world2d/index.js +0 -32
  494. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  495. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  496. package/dist/world2d/ingest-iframe-2d.js +0 -166
  497. package/dist/world2d/ingest2d.d.ts +0 -97
  498. package/dist/world2d/ingest2d.d.ts.map +0 -1
  499. package/dist/world2d/ingest2d.js +0 -40
  500. package/dist/world2d/physics2d-registry.d.ts +0 -24
  501. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  502. package/dist/world2d/physics2d-registry.js +0 -38
  503. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  504. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  505. package/dist/world2d/pixi-game-adapter.js +0 -210
  506. package/dist/world2d/pixi-surface.d.ts +0 -39
  507. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  508. package/dist/world2d/pixi-surface.js +0 -47
  509. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  510. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  511. package/dist/world2d/scene-capture-2d.js +0 -92
  512. package/dist/world2d/scene2d-loader.d.ts +0 -27
  513. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  514. package/dist/world2d/scene2d-loader.js +0 -275
  515. package/dist/world2d/schema/entity2d.d.ts +0 -102
  516. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  517. package/dist/world2d/schema/entity2d.js +0 -119
  518. package/dist/world2d/schema/physics2d.d.ts +0 -46
  519. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  520. package/dist/world2d/schema/physics2d.js +0 -45
  521. package/dist/world2d/schema/sprite.d.ts +0 -42
  522. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  523. package/dist/world2d/schema/sprite.js +0 -63
  524. package/dist/world2d/schema/tilemap.d.ts +0 -15
  525. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  526. package/dist/world2d/schema/tilemap.js +0 -19
  527. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  528. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  529. package/dist/world2d/schema/tuples2d.js +0 -19
  530. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  531. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  532. package/dist/world2d/system-adapters-2d.js +0 -37
  533. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  534. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  535. package/dist/world2d/transform-writer-2d.js +0 -22
  536. package/dist/world2d/types.d.ts +0 -59
  537. package/dist/world2d/types.d.ts.map +0 -1
  538. package/dist/world2d/types.js +0 -1
@@ -1,48 +0,0 @@
1
- /**
2
- * D15 — the dev-mode `Math.random` phase trap (`docs/D15-DETERMINISM-DESIGN.md`
3
- * §2.a enforcer 3, T-D15.3). A project that declares
4
- * `determinism.seededRandom` is claiming ALL gameplay RNG flows through
5
- * `ctx.random` — the burn-down scan (`test/gameplay-rng-ban.test.ts`) catches
6
- * raw `Math.random()`/`Date.now()`/`performance.now()` call sites it can
7
- * SEE in source; this trap catches what the scan structurally can't: a
8
- * TRANSITIVE draw made by a third-party library the game calls into during a
9
- * gameplay tick.
10
- *
11
- * Scope is exactly one fixed-step frame (`GameInternal.runFrame`'s whole
12
- * body — see `game.ts`'s `runFrameImpl`, which brackets its entire call with
13
- * `profiler.beginFrame()`/`endFrame()`; this trap's `enable()`/`disable()`
14
- * are called at those exact two points) — code that runs OUTSIDE a frame
15
- * (module-load-time library init, an unrelated timer callback) never trips
16
- * it. Warn-once PER CALL SITE (not once ever, not once per call) — a
17
- * third-party library that draws from several different internal call sites
18
- * gets one warning per site, so nothing is silently swallowed after the
19
- * first hit, but a hot per-frame draw from the SAME site doesn't spam.
20
- * Never throws: a cosmetic third-party draw is legal, just outside the
21
- * contract (the design doc is explicit about this — "warn, never throw").
22
- */
23
- export interface GameplayRngTrap {
24
- /** Wrap `Math.random` for the duration of one frame — call at frame start. */
25
- enable(): void;
26
- /** Restore whatever `Math.random` was immediately before `enable()` — call
27
- * at frame end. A no-op if something else already replaced `Math.random`
28
- * out from under this trap between `enable()` and `disable()` (defensive;
29
- * should not happen in practice). */
30
- disable(): void;
31
- }
32
- /**
33
- * Construct a fresh trap. `warn` defaults to `console.warn`; tests (and any
34
- * caller that wants to assert on the message) can override it to a plain
35
- * capturing function instead of spying on the global console.
36
- */
37
- export declare function createGameplayRngTrap(warn?: (message: string) => void): GameplayRngTrap;
38
- export interface GameplayRngTrapControl {
39
- setEnabled(enabled: boolean): void;
40
- readonly enabled: boolean;
41
- }
42
- /** Called once by `createGame`, alongside `registerSeededRandom`/
43
- * `registerDebugRegistry`. */
44
- export declare function registerGameplayRngTrapControl(owner: object, control: GameplayRngTrapControl): void;
45
- /** `null` for an owner built without one — same absence precedent as
46
- * `getSeededRandom`/`getDebugRegistry`. */
47
- export declare function getGameplayRngTrapControl(owner: object): GameplayRngTrapControl | null;
48
- //# sourceMappingURL=gameplay-rng-trap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gameplay-rng-trap.d.ts","sourceRoot":"","sources":["../../src/runtime/gameplay-rng-trap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,MAAM,IAAI,IAAI,CAAC;IACf;;;0CAGsC;IACtC,OAAO,IAAI,IAAI,CAAC;CACjB;AAcD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAG1B,GACA,eAAe,CA6CjB;AAaD,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAID;+BAC+B;AAC/B,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAEN;AAED;4CAC4C;AAC5C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAEtF"}
@@ -1,96 +0,0 @@
1
- /**
2
- * D15 — the dev-mode `Math.random` phase trap (`docs/D15-DETERMINISM-DESIGN.md`
3
- * §2.a enforcer 3, T-D15.3). A project that declares
4
- * `determinism.seededRandom` is claiming ALL gameplay RNG flows through
5
- * `ctx.random` — the burn-down scan (`test/gameplay-rng-ban.test.ts`) catches
6
- * raw `Math.random()`/`Date.now()`/`performance.now()` call sites it can
7
- * SEE in source; this trap catches what the scan structurally can't: a
8
- * TRANSITIVE draw made by a third-party library the game calls into during a
9
- * gameplay tick.
10
- *
11
- * Scope is exactly one fixed-step frame (`GameInternal.runFrame`'s whole
12
- * body — see `game.ts`'s `runFrameImpl`, which brackets its entire call with
13
- * `profiler.beginFrame()`/`endFrame()`; this trap's `enable()`/`disable()`
14
- * are called at those exact two points) — code that runs OUTSIDE a frame
15
- * (module-load-time library init, an unrelated timer callback) never trips
16
- * it. Warn-once PER CALL SITE (not once ever, not once per call) — a
17
- * third-party library that draws from several different internal call sites
18
- * gets one warning per site, so nothing is silently swallowed after the
19
- * first hit, but a hot per-frame draw from the SAME site doesn't spam.
20
- * Never throws: a cosmetic third-party draw is legal, just outside the
21
- * contract (the design doc is explicit about this — "warn, never throw").
22
- */
23
- /** Pull a single representative "call site" line out of a captured stack —
24
- * the warn-once dedupe key. `stack[0]` is the `Error:` header line,
25
- * `stack[1]` is this trap's OWN wrapper frame — the caller's frame is the
26
- * next one down. Falls back to a fixed string when `Error().stack` isn't
27
- * populated (some non-V8 engines) so the trap still functions, just with
28
- * coarser (single-bucket) deduping. */
29
- function callSiteFromStack(stack) {
30
- if (!stack)
31
- return '<unknown call site — no stack captured>';
32
- const lines = stack.split('\n');
33
- return (lines[2] ?? lines[1] ?? lines[0] ?? '<unknown call site>').trim();
34
- }
35
- /**
36
- * Construct a fresh trap. `warn` defaults to `console.warn`; tests (and any
37
- * caller that wants to assert on the message) can override it to a plain
38
- * capturing function instead of spying on the global console.
39
- */
40
- export function createGameplayRngTrap(warn = (message) => {
41
- // biome-ignore lint/suspicious/noConsole: the trap's entire purpose is a structured, greppable dev-mode warning (D15) — this IS the console sink, not incidental debug output.
42
- console.warn(message);
43
- }) {
44
- const warnedSites = new Set();
45
- let previous;
46
- function trapped() {
47
- const site = callSiteFromStack(new Error().stack);
48
- if (!warnedSites.has(site)) {
49
- warnedSites.add(site);
50
- warn(
51
- // Deliberately NOT the literal substring "Math.random(" (the phrasing
52
- // below reads fine without it) — this engine repo's OWN gameplay-rng-
53
- // ban scan (`test/gameplay-rng-ban.test.ts`) greps engine src/ for
54
- // that exact pattern, and a plain-text mention of the call inside
55
- // this warning STRING would otherwise false-positive against itself.
56
- '[determinism] the global Math.random generator was drawn from during a gameplay frame ' +
57
- 'while this project declares determinism.seededRandom — use ctx.random() / ' +
58
- `ctx.random.stream(name) instead (docs/D15-DETERMINISM-DESIGN.md). Call site:\n${site}`);
59
- }
60
- // `previous` is always set by the time `trapped` can run — `enable()`
61
- // assigns it before installing `trapped` as `Math.random`, and nothing
62
- // else can invoke this function reference.
63
- return previous();
64
- }
65
- return {
66
- enable() {
67
- previous = Math.random;
68
- Math.random = trapped;
69
- },
70
- disable() {
71
- if (Math.random === trapped && previous) {
72
- Math.random = previous;
73
- previous = undefined;
74
- }
75
- // else: something else replaced `Math.random` out from under this trap
76
- // between `enable()` and `disable()` — leave `previous` untouched.
77
- // `trapped` may still be reachable via a chain built on top of it (e.g.
78
- // a third party did `const wrapped = Math.random; Math.random = () =>
79
- // { ...; return wrapped(); }` while `wrapped` was `trapped`) — nulling
80
- // `previous` here would make that still-chained call to `trapped()`
81
- // throw (`previous!()` on undefined) instead of quietly forwarding to
82
- // the real original generator.
83
- },
84
- };
85
- }
86
- const controlByOwner = new WeakMap();
87
- /** Called once by `createGame`, alongside `registerSeededRandom`/
88
- * `registerDebugRegistry`. */
89
- export function registerGameplayRngTrapControl(owner, control) {
90
- controlByOwner.set(owner, control);
91
- }
92
- /** `null` for an owner built without one — same absence precedent as
93
- * `getSeededRandom`/`getDebugRegistry`. */
94
- export function getGameplayRngTrapControl(owner) {
95
- return controlByOwner.get(owner) ?? null;
96
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * The delegating input router (COMPOSITION-DESIGN.md D5 §2a) —
3
- * `createGameRuntime`'s roots path (T6.1 slice 1,
4
- * docs/MULTI-WORLD-DESIGN.md §1.C) uses this to route pointer input across
5
- * N stacked world canvases with exactly ONE root listener.
6
- *
7
- * Split into two layers so the decision logic is unit-testable with plain
8
- * fake roots — no real DOM/canvas needed:
9
- *
10
- * - `stackOrder` / `resolveClaimingWorld`: pure functions over
11
- * `{id, zOrder, hitTest?}` — "who claims this point".
12
- * - `applyPointerEventsStacking` / `createInputRouter`: the DOM wiring —
13
- * sets `pointer-events` CSS per D5 §2a and forwards a claimed event to
14
- * the claiming world's own canvas.
15
- *
16
- * Per-event fall-through (D5 §2b — the sanctioned mechanism for an
17
- * authoring surface's own interior drag affordances, e.g. the world2d
18
- * editor's gizmos) is explicitly NOT this file's job (MULTI-WORLD-DESIGN.md
19
- * task 4) — it stays inside whatever authoring surface needs it.
20
- */
21
- /** The pure decision inputs — no DOM. */
22
- export interface ClaimEntry {
23
- readonly id: string;
24
- readonly zOrder: number;
25
- /**
26
- * Optional claim predicate over a point RELATIVE TO THE CONTAINER. Absent
27
- * means: "this world claims only if it is the bottom (lowest zOrder)
28
- * world" — D5 §2a's stated default ("transparent upper roots do not
29
- * claim, the bottom world claims everything").
30
- */
31
- readonly hitTest?: ((x: number, y: number) => boolean) | undefined;
32
- }
33
- /** The DOM-wiring inputs — one real canvas per world. */
34
- export interface RouterAdapterRoot extends ClaimEntry {
35
- readonly canvas: HTMLCanvasElement;
36
- }
37
- /**
38
- * Bottom-to-top paint order: ascending `zOrder`, ties -> original array
39
- * order — the SAME rule `manifest/load.ts`'s `loadGameManifest` sorts
40
- * roots by, so a world's DOM stacking position always matches its
41
- * manifest-resolved zOrder. The last element is the topmost (visually on
42
- * top / highest z-index).
43
- */
44
- export declare function stackOrder<T extends ClaimEntry>(entries: readonly T[]): T[];
45
- /**
46
- * Resolve which world's id claims a container-relative point `(x, y)` — D5
47
- * §2a: walk top-down (topmost first); the first world whose `hitTest`
48
- * returns true wins ("topmost-claim wins"). A world with no `hitTest` never
49
- * claims UNLESS it is the bottom-most world, which claims unconditionally
50
- * (or via its own `hitTest`, if it declares one) — "no-claim falls to
51
- * bottom". Returns `null` only when `entries` is empty.
52
- */
53
- export declare function resolveClaimingWorld(entries: readonly ClaimEntry[], x: number, y: number): string | null;
54
- /**
55
- * Sets `canvas.style.pointerEvents` per D5 §1/§2a: the bottom (lowest
56
- * zOrder) world's canvas is `'auto'` (real user input DOM-hit-tests it by
57
- * default); every canvas above it is `'none'` (real user input never
58
- * DOM-hit-tests it — the router's JS-level `hitTest` is what still lets it
59
- * claim a point via `createInputRouter`'s forwarding).
60
- */
61
- export declare function applyPointerEventsStacking(entries: readonly RouterAdapterRoot[]): void;
62
- export interface InputRouterHandle {
63
- /** Resolve which world claims a container-relative point right now — the
64
- * pure decision, exposed for callers/tests that don't want to simulate a
65
- * real DOM event. */
66
- resolveClaim(x: number, y: number): string | null;
67
- /** Detach the container listener(s). Idempotent. */
68
- dispose(): void;
69
- }
70
- /**
71
- * Wire the delegating router onto `container` for `entries` (D5 §2a): apply
72
- * the pointer-events stacking, then attach ONE capture-phase listener per
73
- * routed event type that resolves the claiming world and forwards the event
74
- * to ITS canvas when that world isn't already the natural DOM target (the
75
- * bottom world, whose canvas is the only one with `pointer-events:auto`).
76
- */
77
- export declare function createInputRouter(container: HTMLElement, entries: readonly RouterAdapterRoot[]): InputRouterHandle;
78
- //# sourceMappingURL=input-router.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-router.d.ts","sourceRoot":"","sources":["../../src/runtime/input-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACpE;AAED,yDAAyD;AACzD,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAK3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,MAAM,GAAG,IAAI,CAWf;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,CAKtF;AAyED,MAAM,WAAW,iBAAiB;IAChC;;0BAEsB;IACtB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD,oDAAoD;IACpD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,SAAS,iBAAiB,EAAE,GACpC,iBAAiB,CA8BnB"}
@@ -1,171 +0,0 @@
1
- /**
2
- * The delegating input router (COMPOSITION-DESIGN.md D5 §2a) —
3
- * `createGameRuntime`'s roots path (T6.1 slice 1,
4
- * docs/MULTI-WORLD-DESIGN.md §1.C) uses this to route pointer input across
5
- * N stacked world canvases with exactly ONE root listener.
6
- *
7
- * Split into two layers so the decision logic is unit-testable with plain
8
- * fake roots — no real DOM/canvas needed:
9
- *
10
- * - `stackOrder` / `resolveClaimingWorld`: pure functions over
11
- * `{id, zOrder, hitTest?}` — "who claims this point".
12
- * - `applyPointerEventsStacking` / `createInputRouter`: the DOM wiring —
13
- * sets `pointer-events` CSS per D5 §2a and forwards a claimed event to
14
- * the claiming world's own canvas.
15
- *
16
- * Per-event fall-through (D5 §2b — the sanctioned mechanism for an
17
- * authoring surface's own interior drag affordances, e.g. the world2d
18
- * editor's gizmos) is explicitly NOT this file's job (MULTI-WORLD-DESIGN.md
19
- * task 4) — it stays inside whatever authoring surface needs it.
20
- */
21
- /**
22
- * Bottom-to-top paint order: ascending `zOrder`, ties -> original array
23
- * order — the SAME rule `manifest/load.ts`'s `loadGameManifest` sorts
24
- * roots by, so a world's DOM stacking position always matches its
25
- * manifest-resolved zOrder. The last element is the topmost (visually on
26
- * top / highest z-index).
27
- */
28
- export function stackOrder(entries) {
29
- return entries
30
- .map((entry, index) => ({ entry, index }))
31
- .sort((a, b) => a.entry.zOrder - b.entry.zOrder || a.index - b.index)
32
- .map(({ entry }) => entry);
33
- }
34
- /**
35
- * Resolve which world's id claims a container-relative point `(x, y)` — D5
36
- * §2a: walk top-down (topmost first); the first world whose `hitTest`
37
- * returns true wins ("topmost-claim wins"). A world with no `hitTest` never
38
- * claims UNLESS it is the bottom-most world, which claims unconditionally
39
- * (or via its own `hitTest`, if it declares one) — "no-claim falls to
40
- * bottom". Returns `null` only when `entries` is empty.
41
- */
42
- export function resolveClaimingWorld(entries, x, y) {
43
- if (entries.length === 0)
44
- return null;
45
- const order = stackOrder(entries); // bottom -> top
46
- for (let i = order.length - 1; i >= 1; i--) {
47
- const entry = order[i];
48
- if (entry.hitTest?.(x, y))
49
- return entry.id;
50
- }
51
- // No upper world claimed (or there is only one world) -> the bottom world
52
- // claims — honoring its own hitTest if it declares one (rare: the bottom
53
- // world usually claims everything unconditionally per D5 §2a's default).
54
- return order[0].id;
55
- }
56
- /**
57
- * Sets `canvas.style.pointerEvents` per D5 §1/§2a: the bottom (lowest
58
- * zOrder) world's canvas is `'auto'` (real user input DOM-hit-tests it by
59
- * default); every canvas above it is `'none'` (real user input never
60
- * DOM-hit-tests it — the router's JS-level `hitTest` is what still lets it
61
- * claim a point via `createInputRouter`'s forwarding).
62
- */
63
- export function applyPointerEventsStacking(entries) {
64
- const order = stackOrder(entries);
65
- order.forEach((entry, i) => {
66
- entry.canvas.style.pointerEvents = i === 0 ? 'auto' : 'none';
67
- });
68
- }
69
- const ROUTED_EVENT_TYPES = ['pointerdown', 'pointerup', 'pointermove', 'click', 'wheel'];
70
- /** Common pointer/mouse/wheel event fields this router knows how to carry
71
- * over when forwarding a claimed event to a different canvas (see
72
- * `forwardEvent` below) — not an exhaustive Event surface, just the fields
73
- * games/libraries actually read for hit-testing and input state. */
74
- function pickEventInit(original) {
75
- const src = original;
76
- const keys = [
77
- 'clientX',
78
- 'clientY',
79
- 'screenX',
80
- 'screenY',
81
- 'offsetX',
82
- 'offsetY',
83
- 'button',
84
- 'buttons',
85
- 'ctrlKey',
86
- 'altKey',
87
- 'shiftKey',
88
- 'metaKey',
89
- 'pointerId',
90
- 'pointerType',
91
- 'pressure',
92
- 'isPrimary',
93
- 'deltaX',
94
- 'deltaY',
95
- 'deltaZ',
96
- 'deltaMode',
97
- ];
98
- const init = { bubbles: false, cancelable: true, composed: true };
99
- for (const key of keys)
100
- if (key in src)
101
- init[key] = src[key];
102
- return init;
103
- }
104
- /**
105
- * Forward `original` onto `canvas` as a NEW, non-bubbling event of the same
106
- * event-type family — so a canvas with `pointer-events:none` (never a
107
- * native DOM hit-test target) still receives the interaction its own event
108
- * pipeline (Pixi's `EventSystem`, a raycast-driven three controller, …)
109
- * listens for on ITS canvas. `bubbles:false` is deliberate: it stops the
110
- * clone from re-triggering the container's own capture listener (an
111
- * infinite loop) — re-dispatching the SAME event object is not an option
112
- * either (the DOM forbids re-dispatching an event still being dispatched).
113
- *
114
- * Best-effort: environments with no `PointerEvent`/`MouseEvent`/
115
- * `WheelEvent` global (Node unit tests) skip forwarding silently — those
116
- * tests exercise the pure claim-resolution logic above instead, which needs
117
- * no real `Event` objects at all.
118
- */
119
- function forwardEvent(canvas, original) {
120
- const g = globalThis;
121
- const Ctor = original.type === 'wheel'
122
- ? g.WheelEvent
123
- : original.type.startsWith('pointer')
124
- ? g.PointerEvent
125
- : (g.MouseEvent ?? g.PointerEvent);
126
- if (!Ctor || typeof canvas.dispatchEvent !== 'function')
127
- return;
128
- try {
129
- canvas.dispatchEvent(new Ctor(original.type, pickEventInit(original)));
130
- }
131
- catch {
132
- // Best-effort forwarding — a construction failure here must never break
133
- // the (already-delivered) original event's own handling.
134
- }
135
- }
136
- /**
137
- * Wire the delegating router onto `container` for `entries` (D5 §2a): apply
138
- * the pointer-events stacking, then attach ONE capture-phase listener per
139
- * routed event type that resolves the claiming world and forwards the event
140
- * to ITS canvas when that world isn't already the natural DOM target (the
141
- * bottom world, whose canvas is the only one with `pointer-events:auto`).
142
- */
143
- export function createInputRouter(container, entries) {
144
- applyPointerEventsStacking(entries);
145
- const byId = new Map(entries.map((e) => [e.id, e]));
146
- const bottomId = stackOrder(entries)[0]?.id;
147
- const handler = (evt) => {
148
- const rect = container.getBoundingClientRect?.() ?? { left: 0, top: 0 };
149
- const clientX = evt.clientX ?? 0;
150
- const clientY = evt.clientY ?? 0;
151
- const x = clientX - rect.left;
152
- const y = clientY - rect.top;
153
- const claimant = resolveClaimingWorld(entries, x, y);
154
- if (claimant && claimant !== bottomId) {
155
- const entry = byId.get(claimant);
156
- if (entry)
157
- forwardEvent(entry.canvas, evt);
158
- }
159
- };
160
- for (const type of ROUTED_EVENT_TYPES) {
161
- container.addEventListener?.(type, handler, true);
162
- }
163
- return {
164
- resolveClaim: (x, y) => resolveClaimingWorld(entries, x, y),
165
- dispose() {
166
- for (const type of ROUTED_EVENT_TYPES) {
167
- container.removeEventListener?.(type, handler, true);
168
- }
169
- },
170
- };
171
- }
@@ -1,129 +0,0 @@
1
- import type { ResolvedAdapterRoot } from '../manifest/load';
2
- import type { GameSession } from './create-runtime';
3
- import { type MountEntry } from './mount-manifest';
4
- /**
5
- * What a caller of `mountGameFromManifest` provides. Deliberately minimal —
6
- * this file never fetches/reads the manifest itself (same rule
7
- * `mount-manifest.ts` follows: the caller already has a parsed manifest or a
8
- * raw JSON value in hand).
9
- */
10
- export interface ManifestHost {
11
- /** The host creates one absolutely-positioned surface per world inside
12
- * this element — see `WorldsRuntimeConfig.container`. */
13
- readonly container: HTMLElement;
14
- /**
15
- * Resolve a manifest-declared `entry` (a project-relative module path,
16
- * e.g. `"src/scripts/main.ts"`) to the ALREADY-IMPORTED module namespace a
17
- * registered {@link AdapterSurfaceFactory} needs to build a `MountEntry` from.
18
- *
19
- * Deliberately NOT "import this arbitrary string path" — a static bundler
20
- * (Vite/rollup building a `dist/`) cannot resolve a runtime-computed import
21
- * specifier, so the recommended shape is a small caller-owned lookup table
22
- * of STATIC imports keyed by the manifest's own `entry` strings (see
23
- * `packages/editor/template/src/main.ts` for the worked pattern) rather
24
- * than a literal `import(path)`. Optional — a manifest whose every world
25
- * either declares no `entry` or is fully satisfied by an explicit
26
- * `opts.entries` needs none at all.
27
- */
28
- loadEntryModule?(path: string): Promise<unknown>;
29
- /** Resolve asset/scene URLs relative to the project — forwarded to a
30
- * registered {@link AdapterSurfaceFactory} via {@link AdapterSurfaceFactoryContext},
31
- * never called by this module itself (a factory only needs it for a
32
- * non-default resolution scheme, e.g. a hosted-editor iframe). */
33
- resolveUrl?(path: string): string;
34
- readonly width?: number | undefined;
35
- readonly height?: number | undefined;
36
- /** Forwarded to `createGameRuntime` — Node/headless test harnesses only,
37
- * never a real host. See `WorldsRuntimeConfig.headless`. */
38
- readonly headless?: boolean | undefined;
39
- }
40
- /** What a registered {@link AdapterSurfaceFactory} is handed for one world. */
41
- export interface AdapterSurfaceFactoryContext {
42
- readonly host: ManifestHost;
43
- /**
44
- * The result of `host.loadEntryModule(world.entry)`, if the world declares
45
- * an `entry` AND the host supports loading it — `undefined` for a
46
- * scene-only world, or when the host has no `loadEntryModule`.
47
- */
48
- readonly entryModule?: unknown;
49
- }
50
- /**
51
- * A caller-registered per-kind mount strategy: given the world's resolved
52
- * manifest entry and the loaded entry module (if any), produce the
53
- * `MountEntry` `mountManifestWorlds` needs to mount it (exactly what a
54
- * project used to hand-build inline as its own `entries[id]` — see
55
- * `examples/tri-world/src/main.ts`'s pre-E4 shape). May be async (loading an
56
- * asset, fetching a scene file, etc.).
57
- */
58
- export type AdapterSurfaceFactory = (world: ResolvedAdapterRoot, ctx: AdapterSurfaceFactoryContext) => MountEntry | Promise<MountEntry>;
59
- /**
60
- * Register a `AdapterSurfaceFactory` for a manifest world `kind` (`'threejs'` /
61
- * `'pixijs'` / `'react'`, or any future kind the manifest schema grows).
62
- * Call once, at module load — mirrors `registerSceneUIRenderer()`'s existing
63
- * "call before mounting" convention (`packages/editor/template/src/main.ts`).
64
- *
65
- * Throws on double-registration of the SAME kind: an accidental duplicate
66
- * (two side-effect imports of the same registration module, or a copy-paste)
67
- * is far more likely than an intentional runtime swap — a caller that really
68
- * wants to replace a registration must `unregisterAdapter` first, making
69
- * the intent explicit.
70
- */
71
- export declare function registerAdapter(kind: string, factory: AdapterSurfaceFactory): void;
72
- /** Remove a kind's registration (e.g. before re-registering a replacement). */
73
- export declare function unregisterAdapter(kind: string): void;
74
- /** Whether a factory is currently registered for `kind`. */
75
- export declare function isAdapterRegistered(kind: string): boolean;
76
- /**
77
- * Test-only escape hatch: clears every registration. Registrations are
78
- * meant to be one-time, process-lifetime — production code should never
79
- * call this; it exists so unit tests can start each case from a clean
80
- * registry without cross-test leakage.
81
- */
82
- export declare function __clearAdapterSurfaceRegistryForTests(): void;
83
- /**
84
- * A ready-to-register {@link AdapterSurfaceFactory} for `kind: 'threejs'` roots
85
- * that follow the first-party entry-module convention (`export const
86
- * adapter` and/or `export async function setup`) or are plain scene files
87
- * with an optional named `componentRegistry` export. Threejs is safe to
88
- * ship as an exported convenience (unlike pixijs/react) because `three`/
89
- * `VgaiSceneGameAdapter` are already unconditional engine dependencies —
90
- * see `mount-manifest.ts`'s header comment. Still never auto-registered:
91
- * the registry itself stays zero-policy (see this file's header comment) —
92
- * a caller opts in with `registerAdapter('threejs', defaultThreeAdapterFactory)`.
93
- *
94
- * Resolution mirrors `mount-manifest.ts`'s own `resolveThreeAdapter` branch
95
- * order: an entry module's `adapter` export wins outright; else its `setup`
96
- * export (wrapping via `fromSetup` happens inside `mountManifestWorlds`
97
- * itself — this factory just returns the `MountEntry` shape); else (no
98
- * `entry` at all) a scene-driven world, forwarding `componentRegistry` if
99
- * the entry module supplied one.
100
- */
101
- export declare const defaultThreeAdapterFactory: AdapterSurfaceFactory;
102
- export interface MountGameOptions {
103
- /** Explicit per-world entries, same shape `mountManifestWorlds` accepts —
104
- * ALWAYS wins over a registered kind factory for that world id (backward
105
- * compat: a caller mid-migration, or one that just prefers building one
106
- * entry by hand, never has to touch the registry at all). */
107
- readonly entries?: Readonly<Record<string, MountEntry>> | undefined;
108
- }
109
- /**
110
- * Mount every world declared by a `vgai.game.json` manifest onto `host
111
- * .container`, resolving each world's kind through the `registerAdapter`
112
- * registry — falling back to an explicit `opts.entries[id]` where supplied,
113
- * exactly like `mountManifestWorlds` (so a caller can migrate one world at a
114
- * time, or never touch the registry if it prefers hand-building entries).
115
- *
116
- * This is the "one call" scaffold/example projects mount through (E4
117
- * acceptance): register whatever kinds you need once, then
118
- * `await mountGameFromManifest(manifest, host)` — see
119
- * `packages/editor/template/src/main.ts` for the worked single-world
120
- * example and `examples/tri-world/src/main.ts` for a multi-kind one.
121
- *
122
- * Degrades loudly (`docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md` D-Z2, carried
123
- * into E4): a world whose kind has no registered factory AND no explicit
124
- * entry, and which cannot self-mount from the manifest alone, throws a named
125
- * `Error` identifying the world id + kind and BOTH ways to fix it
126
- * (`registerAdapter` or `opts.entries`) — never a silent skip.
127
- */
128
- export declare function mountGameFromManifest(manifestInput: unknown, host: ManifestHost, opts?: MountGameOptions): Promise<GameSession>;
129
- //# sourceMappingURL=mount-game.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mount-game.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-game.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAwC,MAAM,kBAAkB,CAAC;AAOzF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;8DAC0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD;;;uEAGmE;IACnE,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;iEAC6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AAED,+EAA+E;AAC/E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,4BAA4B,KAC9B,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAQtC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAUlF;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAE5D;AAeD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,EAAE,qBAYxC,CAAC;AAMF,MAAM,WAAW,gBAAgB;IAC/B;;;kEAG8D;IAC9D,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;CACrE;AAcD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAoCtB"}