@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,60 +0,0 @@
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 roots 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 roots, 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
- import type { DataHandle } from '../data/data-asset';
19
- /**
20
- * Read a data asset's current values and re-render whenever a hot edit lands
21
- * (§3.3). A thin `useSyncExternalStore` over the handle's
22
- * `subscribe`/`get` — any `defineData` handle works, no provider needed:
23
- *
24
- * ```tsx
25
- * import { tuning } from '../data/tuning';
26
- * const values = useData(tuning); // fresh parsed object after every hotSwap
27
- * ```
28
- *
29
- * `get()` returns the same reference between successful hot swaps, so this
30
- * re-renders exactly once per accepted edit and never in between.
31
- */
32
- export declare function useData<T>(handle: DataHandle<T>): T;
33
- /**
34
- * Write a data asset's ENTIRE new value back to its `.data.json` — the write
35
- * half of a project tool's live-tuning loop (§3.3, D1: writes are file
36
- * writes, always). POSTs to the editor dev server's `/__editor/data-file`
37
- * route (see its doc comment in `packages/editor/server/editor-server.ts`),
38
- * which accepts only `src/data/**\/*.data.json` and writes immediately; the
39
- * running game then receives the change through the normal `.data.json` HMR
40
- * path, exactly as if VS Code had saved the file.
41
- *
42
- * ```tsx
43
- * // inside a tool's onChange — spread the live values, replace one field:
44
- * void writeData('src/data/tuning.data.json', { ...tuning.get(), gravity: v });
45
- * ```
46
- *
47
- * FOR TOOLS, NOT GAME CODE: data assets are immutable at runtime (§2.1) —
48
- * runtime state belongs in your game's own store, never written back into
49
- * data files. Outside a running editor there is no `/__editor` server, so
50
- * this rejects with a teaching error (a shipped game could never reach the
51
- * route anyway — builds strip `src/tools/` entirely, §4).
52
- *
53
- * Serialization matches the editor Data panel's diff-minimal contract:
54
- * `"$schema"` first, 2-space indent, trailing newline. When `value` carries
55
- * no `"$schema"` key (the common case — `DataHandle.get()` strips it), the
56
- * conventional sibling reference (`./<name>.schema.json`, §2.1) is restored
57
- * so a tool write never silently drops VS Code validation from the file.
58
- */
59
- export declare function writeData(projectRelativePath: string, value: Record<string, unknown>): Promise<void>;
60
- //# sourceMappingURL=use-data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-data.d.ts","sourceRoot":"","sources":["../../src/react/use-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAKnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,SAAS,CAC7B,mBAAmB,EAAE,MAAM,EAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAqDf"}
@@ -1,101 +0,0 @@
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 roots 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 roots, 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
- import { useSyncExternalStore } from 'react';
19
- /**
20
- * Read a data asset's current values and re-render whenever a hot edit lands
21
- * (§3.3). A thin `useSyncExternalStore` over the handle's
22
- * `subscribe`/`get` — any `defineData` handle works, no provider needed:
23
- *
24
- * ```tsx
25
- * import { tuning } from '../data/tuning';
26
- * const values = useData(tuning); // fresh parsed object after every hotSwap
27
- * ```
28
- *
29
- * `get()` returns the same reference between successful hot swaps, so this
30
- * re-renders exactly once per accepted edit and never in between.
31
- */
32
- export function useData(handle) {
33
- return useSyncExternalStore((onStoreChange) => handle.subscribe(() => onStoreChange()), () => handle.get());
34
- }
35
- /**
36
- * Write a data asset's ENTIRE new value back to its `.data.json` — the write
37
- * half of a project tool's live-tuning loop (§3.3, D1: writes are file
38
- * writes, always). POSTs to the editor dev server's `/__editor/data-file`
39
- * route (see its doc comment in `packages/editor/server/editor-server.ts`),
40
- * which accepts only `src/data/**\/*.data.json` and writes immediately; the
41
- * running game then receives the change through the normal `.data.json` HMR
42
- * path, exactly as if VS Code had saved the file.
43
- *
44
- * ```tsx
45
- * // inside a tool's onChange — spread the live values, replace one field:
46
- * void writeData('src/data/tuning.data.json', { ...tuning.get(), gravity: v });
47
- * ```
48
- *
49
- * FOR TOOLS, NOT GAME CODE: data assets are immutable at runtime (§2.1) —
50
- * runtime state belongs in your game's own store, never written back into
51
- * data files. Outside a running editor there is no `/__editor` server, so
52
- * this rejects with a teaching error (a shipped game could never reach the
53
- * route anyway — builds strip `src/tools/` entirely, §4).
54
- *
55
- * Serialization matches the editor Data panel's diff-minimal contract:
56
- * `"$schema"` first, 2-space indent, trailing newline. When `value` carries
57
- * no `"$schema"` key (the common case — `DataHandle.get()` strips it), the
58
- * conventional sibling reference (`./<name>.schema.json`, §2.1) is restored
59
- * so a tool write never silently drops VS Code validation from the file.
60
- */
61
- export async function writeData(projectRelativePath, value) {
62
- if (!projectRelativePath.startsWith('src/data/') || !projectRelativePath.endsWith('.data.json')) {
63
- throw new Error(`writeData: invalid path ${JSON.stringify(projectRelativePath)} — data assets live at ` +
64
- 'src/data/**/*.data.json, addressed project-relative (docs/DATA-TOOLS-DESIGN.md §2.1), ' +
65
- "e.g. writeData('src/data/tuning.data.json', next).");
66
- }
67
- // "$schema" first for minimal diffs; restore the conventional sibling
68
- // reference when the caller's object (typically `{ ...handle.get() }`,
69
- // which never carries it) omits the line.
70
- const { $schema, ...rest } = value;
71
- const schemaRef = $schema ??
72
- `./${projectRelativePath
73
- .split('/')
74
- .pop()
75
- ?.replace(/\.data\.json$/, '')}.schema.json`;
76
- const content = `${JSON.stringify({ $schema: schemaRef, ...rest }, null, 2)}\n`;
77
- const transactionalWriter = globalThis.__vgaiHistoryWriteData;
78
- if (transactionalWriter) {
79
- await transactionalWriter(projectRelativePath, content);
80
- return;
81
- }
82
- let res;
83
- try {
84
- res = await fetch('/__editor/data-file', {
85
- method: 'POST',
86
- headers: { 'Content-Type': 'application/json' },
87
- body: JSON.stringify({ path: projectRelativePath, content }),
88
- });
89
- }
90
- catch (err) {
91
- throw new Error('writeData: could not reach the editor dev server (/__editor/data-file) — this helper is ' +
92
- 'editor-tool plumbing (docs/DATA-TOOLS-DESIGN.md §3.3) and only works inside the running ' +
93
- 'editor. Game code must not write data assets: they are immutable at runtime (§2.1) — ' +
94
- `keep runtime state in your game's own store. (${String(err)})`);
95
- }
96
- if (!res.ok) {
97
- const detail = await res.text().catch(() => '');
98
- throw new Error(`writeData: the editor rejected the write to "${projectRelativePath}" ` +
99
- `(HTTP ${res.status}${detail ? `: ${detail}` : ''}).`);
100
- }
101
- }
@@ -1,75 +0,0 @@
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
- import { type ReactNode } from 'react';
43
- import type { AuthoringAdapter, EditorNode } from '../adapter';
44
- /**
45
- * EDITOR-side host plumbing: `InspectorToolSection` wraps a tool's rendered
46
- * `<Component/>` in this, passing the adapter + nodeId it already holds.
47
- * Project tools never render this themselves — it exists so `useSelection()`
48
- * has something to read.
49
- */
50
- export declare function EditorSelectionProvider({ adapter, nodeId, children, }: {
51
- adapter: AuthoringAdapter;
52
- nodeId: string | null;
53
- children: ReactNode;
54
- }): import("react").JSX.Element;
55
- /** One component attached to the selected entity, with its authored config
56
- * if the adapter can produce one (see the module doc's degrade rules). */
57
- export interface SelectedComponent {
58
- type: string;
59
- config: Record<string, unknown> | null;
60
- }
61
- export interface EditorSelection {
62
- nodeId: string | null;
63
- node: EditorNode | null;
64
- components: SelectedComponent[];
65
- }
66
- /**
67
- * The selected entity, live: its node, and every component attached to it
68
- * with that component's own authored config (read-only — see module doc).
69
- *
70
- * Throws outside an `EditorSelectionProvider` — inspector tools always render
71
- * inside one; a dock tool or game-code caller does not, and the error names
72
- * the fix rather than failing silently.
73
- */
74
- export declare function useSelection(): EditorSelection;
75
- //# sourceMappingURL=use-selection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-selection.d.ts","sourceRoot":"","sources":["../../src/react/use-selection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAS/D;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,MAAM,EACN,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAGA;AAED;2EAC2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAmC9C"}
@@ -1,90 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * W3.1 of docs/DATA-TOOLS-DESIGN.md §3.3 — `useSelection()`, the third
4
- * tool-hooks contract member (alongside `useData`/`writeData` from
5
- * `use-data.ts`). Where those two hooks are about DATA ASSETS, this one is
6
- * about the currently-selected ENTITY and the components authored on it —
7
- * the gap a real consumer (`critter-types-w3b`'s `critter-type.tool.tsx`,
8
- * §9.4) hit hard: with no way to read a component's own authored config, it
9
- * had to recover species from `node.label` (a display string, not data).
10
- *
11
- * Scope, v1:
12
- * - INSPECTOR-placement tools only (`placement: 'inspector'`,
13
- * `define-tool.ts`). `EditorSelectionProvider` is host plumbing —
14
- * `InspectorToolSection` wraps every tool render in it; dock tools
15
- * (`ToolHost`/`BottomPanel`) have no adapter/selection in scope and never
16
- * get a provider. Calling `useSelection()` there throws a teaching error,
17
- * contained by the tool's `ToolErrorBoundary` (the editor survives).
18
- * - READ-only. `config` is a shallow copy of the authored record; write
19
- * through `InspectorProvider.set('components.<Type>.<field>', v)` /
20
- * `writeData` (the existing paths), never by mutating what this hook
21
- * returns. Per-entity WRITE-from-tool is deferred with `useTunable` (§10).
22
- * - Honest degrades, not errors, when the adapter is thinner than the vgai
23
- * first-party one: no `components` provider at all ⇒ `components: []`;
24
- * a `components` provider present but with no optional `config()`
25
- * accessor ⇒ each entry still appears (from `list()`) but with
26
- * `config: null`. Both mirror the `AuthoringAdapter` optional-provider
27
- * doctrine (§4) — an ingest/UI adapter that never implements `components`
28
- * was already legal, and stays legal.
29
- *
30
- * Liveness — two existing paths reused, no new mechanism (§4's "reuse that
31
- * path" rule):
32
- * 1. Selection changes: `Inspector.tsx`'s own
33
- * `useSyncExternalStore(store.subscribe, store.getSnapshot)` re-renders
34
- * the panel, each matched `Section` gets the new `nodeId` prop, and
35
- * `InspectorToolSection` re-creates this provider's context value.
36
- * 2. Config edits while the SAME node stays selected: `adapter.subscribe`
37
- * fires (the vgai adapter's store notifies on every `updateEntity`,
38
- * which is what `InspectorProvider.set` goes through) — this hook keeps
39
- * a local version counter bumped per notification (exactly
40
- * `game-state.tsx`'s `useWorldObservation` pattern: the adapter has no
41
- * snapshot/version of its own, `subscribe` is fire-only) and recomputes.
42
- */
43
- import { createContext, useContext, useMemo, useRef, useSyncExternalStore, } from 'react';
44
- const SelectionContext = createContext(null);
45
- /**
46
- * EDITOR-side host plumbing: `InspectorToolSection` wraps a tool's rendered
47
- * `<Component/>` in this, passing the adapter + nodeId it already holds.
48
- * Project tools never render this themselves — it exists so `useSelection()`
49
- * has something to read.
50
- */
51
- export function EditorSelectionProvider({ adapter, nodeId, children, }) {
52
- const value = useMemo(() => ({ adapter, nodeId }), [adapter, nodeId]);
53
- return _jsx(SelectionContext.Provider, { value: value, children: children });
54
- }
55
- /**
56
- * The selected entity, live: its node, and every component attached to it
57
- * with that component's own authored config (read-only — see module doc).
58
- *
59
- * Throws outside an `EditorSelectionProvider` — inspector tools always render
60
- * inside one; a dock tool or game-code caller does not, and the error names
61
- * the fix rather than failing silently.
62
- */
63
- export function useSelection() {
64
- const ctx = useContext(SelectionContext);
65
- if (!ctx) {
66
- throw new Error('useSelection: no editor selection in context — this hook only works inside an editor-hosted ' +
67
- "INSPECTOR tool (placement: 'inspector', docs/DATA-TOOLS-DESIGN.md §3.3/§3.2). Dock tools and " +
68
- 'game code have no selection to read.');
69
- }
70
- const { adapter, nodeId } = ctx;
71
- // Local version counter bumped per adapter notification — the adapter has
72
- // no snapshot/version of its own, `subscribe` is fire-only (same pattern
73
- // as `useWorldObservation`'s `versionRef`, game-state.tsx).
74
- const versionRef = useRef(0);
75
- const version = useSyncExternalStore((onStoreChange) => adapter.subscribe?.(() => {
76
- versionRef.current++;
77
- onStoreChange();
78
- }) ?? (() => { }), () => versionRef.current);
79
- return useMemo(() => {
80
- const node = nodeId ? adapter.hierarchy.node(nodeId) : null;
81
- const types = nodeId ? (adapter.components?.list(nodeId) ?? []) : [];
82
- const components = types.map(({ type }) => ({
83
- type,
84
- config: nodeId ? (adapter.components?.config?.(nodeId, type) ?? null) : null,
85
- }));
86
- return { nodeId, node, components };
87
- // `version` has no value of its own — only its CHANGE matters, as the
88
- // liveness signal described above.
89
- }, [adapter, nodeId, version]);
90
- }
@@ -1,34 +0,0 @@
1
- import * as THREE from 'three';
2
- export declare class AutoBatcher {
3
- /** Root the batcher owns under the scene (instanced meshes when on, entities when off). */
4
- readonly root: THREE.Group<THREE.Object3DEventMap>;
5
- private entities;
6
- private batches;
7
- private enabled;
8
- /** Indices of entities whose transform changed since last sync. */
9
- private dirty;
10
- private touchedBatches;
11
- private indexOf;
12
- private optOut;
13
- private batchOf;
14
- private membersOf;
15
- constructor(parent: THREE.Object3D, enabled?: boolean);
16
- /** Register an entity (a Mesh) as the logical handle. Call build() after adding. */
17
- add(entity: THREE.Mesh, optOut?: boolean): void;
18
- /** Mark an entity moved this frame (dirty-tracking input). */
19
- markMoved(entity: THREE.Mesh): void;
20
- /** (Re)build the render representation for the current enabled state. */
21
- build(): void;
22
- /** Apply the dirty set to the instance buffers. Cheap when few moved. */
23
- sync(): void;
24
- /** Live toggle: rebuilds the representation (one-time cost, not per-frame). */
25
- setEnabled(on: boolean): void;
26
- isEnabled(): boolean;
27
- /** Map a raycast hit on a batch back to the logical entity (editor/gameplay picking). */
28
- resolvePick(intersection: THREE.Intersection): THREE.Mesh | null;
29
- /** Per-frame draw-call count this batcher contributes (for stats). */
30
- get drawCallCount(): number;
31
- private get optOutCount();
32
- private clearRoot;
33
- }
34
- //# sourceMappingURL=auto-batcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-batcher.d.ts","sourceRoot":"","sources":["../../src/render/auto-batcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiC/B,qBAAa,WAAW;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,sCAAqB;IAElC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAAU;IACzB,mEAAmE;IACnE,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,cAAc,CAAoB;IAG1C,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,OAAO,CAAkE;IACjF,OAAO,CAAC,SAAS,CAAoD;gBAEzD,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,UAAO;IAMlD,oFAAoF;IACpF,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,UAAQ,GAAG,IAAI;IAM7C,8DAA8D;IAC9D,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,GAAG,IAAI;IAKnC,yEAAyE;IACzE,KAAK,IAAI,IAAI;IAuCb,yEAAyE;IACzE,IAAI,IAAI,IAAI;IAmBZ,+EAA+E;IAC/E,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;IAM7B,SAAS,IAAI,OAAO;IAIpB,yFAAyF;IACzF,WAAW,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,GAAG,IAAI;IAShE,sEAAsE;IACtE,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,OAAO,KAAK,WAAW,GAItB;IAED,OAAO,CAAC,SAAS;CAOlB"}
@@ -1,140 +0,0 @@
1
- import * as THREE from 'three';
2
- const SIG = (m) => {
3
- const mat = Array.isArray(m.material) ? m.material[0] : m.material;
4
- return `${m.geometry.uuid}|${mat.uuid}`;
5
- };
6
- export class AutoBatcher {
7
- /** Root the batcher owns under the scene (instanced meshes when on, entities when off). */
8
- root = new THREE.Group();
9
- entities = [];
10
- batches = new Map();
11
- enabled;
12
- /** Indices of entities whose transform changed since last sync. */
13
- dirty = new Set();
14
- touchedBatches = new Set();
15
- // Per-mesh bookkeeping is kept in WeakMaps, NOT on userData (the typed userData
16
- // registry is reserved for documented engine keys — see user-data.ts).
17
- indexOf = new WeakMap();
18
- optOut = new WeakSet();
19
- batchOf = new WeakMap();
20
- membersOf = new WeakMap();
21
- constructor(parent, enabled = true) {
22
- this.enabled = enabled;
23
- this.root.name = 'AutoBatcher';
24
- parent.add(this.root);
25
- }
26
- /** Register an entity (a Mesh) as the logical handle. Call build() after adding. */
27
- add(entity, optOut = false) {
28
- this.indexOf.set(entity, this.entities.length);
29
- if (optOut)
30
- this.optOut.add(entity);
31
- this.entities.push(entity);
32
- }
33
- /** Mark an entity moved this frame (dirty-tracking input). */
34
- markMoved(entity) {
35
- const i = this.indexOf.get(entity);
36
- if (i !== undefined)
37
- this.dirty.add(i);
38
- }
39
- /** (Re)build the render representation for the current enabled state. */
40
- build() {
41
- this.clearRoot();
42
- this.batches.clear();
43
- if (!this.enabled) {
44
- for (const e of this.entities)
45
- this.root.add(e);
46
- return;
47
- }
48
- const m = new THREE.Matrix4();
49
- // group eligible entities; opt-outs render individually
50
- const groups = new Map();
51
- for (const e of this.entities) {
52
- if (this.optOut.has(e)) {
53
- this.root.add(e);
54
- continue;
55
- }
56
- const key = SIG(e);
57
- const arr = groups.get(key) ?? [];
58
- arr.push(e);
59
- groups.set(key, arr);
60
- }
61
- for (const [key, members] of groups) {
62
- const proto = members[0];
63
- const mat = Array.isArray(proto.material) ? proto.material[0] : proto.material;
64
- const inst = new THREE.InstancedMesh(proto.geometry, mat, members.length);
65
- inst.frustumCulled = false;
66
- for (let i = 0; i < members.length; i++) {
67
- const e = members[i];
68
- e.updateMatrix();
69
- m.copy(e.matrix);
70
- inst.setMatrixAt(i, m);
71
- this.batchOf.set(e, { key, localIndex: i });
72
- }
73
- inst.instanceMatrix.needsUpdate = true;
74
- this.membersOf.set(inst, members); // localIndex → entity (picking)
75
- this.root.add(inst);
76
- this.batches.set(key, { key, instanced: inst, members });
77
- }
78
- }
79
- /** Apply the dirty set to the instance buffers. Cheap when few moved. */
80
- sync() {
81
- if (!this.enabled)
82
- return;
83
- const m = new THREE.Matrix4();
84
- this.touchedBatches.clear();
85
- for (const i of this.dirty) {
86
- const e = this.entities[i];
87
- const info = this.batchOf.get(e);
88
- if (!info)
89
- continue; // opt-out or not batched
90
- const batch = this.batches.get(info.key);
91
- if (!batch)
92
- continue;
93
- e.updateMatrix();
94
- m.copy(e.matrix);
95
- batch.instanced.setMatrixAt(info.localIndex, m);
96
- this.touchedBatches.add(batch);
97
- }
98
- for (const b of this.touchedBatches)
99
- b.instanced.instanceMatrix.needsUpdate = true;
100
- this.dirty.clear();
101
- }
102
- /** Live toggle: rebuilds the representation (one-time cost, not per-frame). */
103
- setEnabled(on) {
104
- if (on === this.enabled)
105
- return;
106
- this.enabled = on;
107
- this.build();
108
- }
109
- isEnabled() {
110
- return this.enabled;
111
- }
112
- /** Map a raycast hit on a batch back to the logical entity (editor/gameplay picking). */
113
- resolvePick(intersection) {
114
- const obj = intersection.object;
115
- if (obj.isInstancedMesh && intersection.instanceId != null) {
116
- const members = this.membersOf.get(obj);
117
- return members?.[intersection.instanceId] ?? null;
118
- }
119
- return obj instanceof THREE.Mesh ? obj : null;
120
- }
121
- /** Per-frame draw-call count this batcher contributes (for stats). */
122
- get drawCallCount() {
123
- return this.enabled ? this.batches.size + this.optOutCount : this.entities.length;
124
- }
125
- get optOutCount() {
126
- let n = 0;
127
- for (const e of this.entities)
128
- if (this.optOut.has(e))
129
- n++;
130
- return n;
131
- }
132
- clearRoot() {
133
- for (let i = this.root.children.length - 1; i >= 0; i--) {
134
- const c = this.root.children[i];
135
- this.root.remove(c);
136
- if (c.isInstancedMesh)
137
- c.dispose();
138
- }
139
- }
140
- }
@@ -1,33 +0,0 @@
1
- import * as THREE from 'three';
2
- import type { ResolvedRenderSettings } from './render-settings';
3
- export declare class RenderBatchSystem {
4
- private scene;
5
- private settings;
6
- private root;
7
- private groups;
8
- private dynamicGroups;
9
- private parentOf;
10
- private membersOf;
11
- constructor(scene: THREE.Scene, settings: ResolvedRenderSettings);
12
- /** Scan the scene and build instanced groups. Idempotent (rebuilds). */
13
- build(): void;
14
- private makeGroup;
15
- /**
16
- * Per-frame sync for DYNAMIC groups only (static are detached & immutable → free).
17
- * Called in the preRender phase. Refreshes world matrices once (the engine's movers
18
- * set matrixWorldNeedsUpdate via physics/animation), then re-writes only the instances
19
- * whose source moved (element-wise cache compare). No-op when there are no movers.
20
- */
21
- update(): void;
22
- /**
23
- * Raycast against the batched instances, mapping a hit back to the logical source
24
- * Object3D (so editor/gameplay picking still resolves a detached entity).
25
- */
26
- raycast(raycaster: THREE.Raycaster): THREE.Mesh | null;
27
- /** Number of draw calls the batcher contributes (1 per group). */
28
- get drawCalls(): number;
29
- /** How many source meshes were collapsed into instances. */
30
- get batchedCount(): number;
31
- teardown(): void;
32
- }
33
- //# sourceMappingURL=render-batch-system.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-batch-system.d.ts","sourceRoot":"","sources":["../../src/render/render-batch-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAoGhE,qBAAa,iBAAiB;IAU1B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAVlB,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,aAAa,CAAe;IAEpC,OAAO,CAAC,QAAQ,CAA6C;IAE7D,OAAO,CAAC,SAAS,CAAoD;gBAG3D,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,QAAQ,EAAE,sBAAsB;IAM1C,wEAAwE;IACxE,KAAK,IAAI,IAAI;IAmCb,OAAO,CAAC,SAAS;IAyCjB;;;;;OAKG;IACH,MAAM,IAAI,IAAI;IAyBd;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,IAAI;IAStD,kEAAkE;IAClE,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,4DAA4D;IAC5D,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,QAAQ,IAAI,IAAI;CAiBjB"}