@vgai/engine 0.5.4 → 0.5.6

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 (448) hide show
  1. package/dist/adapter/adapter-surface.d.ts +30 -0
  2. package/dist/adapter/adapter-surface.d.ts.map +1 -0
  3. package/dist/adapter/adapter-surface.js +18 -0
  4. package/dist/adapter/authoring.d.ts +597 -0
  5. package/dist/adapter/authoring.d.ts.map +1 -0
  6. package/dist/adapter/authoring.js +22 -0
  7. package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
  8. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  9. package/dist/adapter/colyseus-networking-adapter.js +76 -0
  10. package/dist/adapter/first-party-systems.d.ts +23 -0
  11. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  12. package/dist/adapter/first-party-systems.js +196 -0
  13. package/dist/adapter/host-context.d.ts +194 -0
  14. package/dist/adapter/host-context.d.ts.map +1 -0
  15. package/dist/adapter/host-context.js +80 -0
  16. package/dist/adapter/index.d.ts +33 -0
  17. package/dist/adapter/index.d.ts.map +1 -0
  18. package/dist/adapter/index.js +25 -0
  19. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  20. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  21. package/dist/adapter/ingest/game-contract.js +30 -0
  22. package/dist/adapter/ingest/scene-capture.d.ts +121 -0
  23. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  24. package/dist/adapter/ingest/scene-capture.js +270 -0
  25. package/dist/adapter/ingest/structural-ids.d.ts +64 -0
  26. package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
  27. package/dist/adapter/ingest/structural-ids.js +110 -0
  28. package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
  29. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  30. package/dist/adapter/ingest/upstream-pin.js +47 -0
  31. package/dist/adapter/loop-gate-report.d.ts +34 -0
  32. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  33. package/dist/adapter/loop-gate-report.js +37 -0
  34. package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
  35. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  36. package/dist/adapter/rapier-physics-adapter.js +135 -0
  37. package/dist/adapter/root-adapter.d.ts +195 -0
  38. package/dist/adapter/root-adapter.d.ts.map +1 -0
  39. package/dist/adapter/root-adapter.js +25 -0
  40. package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
  41. package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
  42. package/dist/adapter/setup-three-root-adapter.js +791 -0
  43. package/dist/adapter/system-adapter.d.ts +453 -0
  44. package/dist/adapter/system-adapter.d.ts.map +1 -0
  45. package/dist/adapter/system-adapter.js +13 -0
  46. package/dist/adapter/transform.d.ts +18 -0
  47. package/dist/adapter/transform.d.ts.map +1 -0
  48. package/dist/adapter/transform.js +1 -0
  49. package/dist/ai/navigation.d.ts +78 -0
  50. package/dist/ai/navigation.d.ts.map +1 -0
  51. package/dist/ai/navigation.js +152 -0
  52. package/dist/animation/anim-graph-types.d.ts +25 -0
  53. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  54. package/dist/animation/anim-graph-types.js +1 -0
  55. package/dist/animation/animation-clock.d.ts +213 -0
  56. package/dist/animation/animation-clock.d.ts.map +1 -0
  57. package/dist/animation/animation-clock.js +301 -0
  58. package/dist/animation/blend-node.d.ts +22 -0
  59. package/dist/animation/blend-node.d.ts.map +1 -0
  60. package/dist/animation/blend-node.js +97 -0
  61. package/dist/animation/camera-ownership.d.ts +249 -0
  62. package/dist/animation/camera-ownership.d.ts.map +1 -0
  63. package/dist/animation/camera-ownership.js +169 -0
  64. package/dist/animation/cinematic-cues.d.ts +200 -0
  65. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  66. package/dist/animation/cinematic-cues.js +213 -0
  67. package/dist/animation/clip-map.d.ts +12 -0
  68. package/dist/animation/clip-map.d.ts.map +1 -0
  69. package/dist/animation/clip-map.js +31 -0
  70. package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
  71. package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
  72. package/dist/animation/cubic-spline-interpolant.js +111 -0
  73. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  74. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  75. package/dist/animation/theatre-clock-binding.js +29 -0
  76. package/dist/animation/theatre-director.d.ts +277 -0
  77. package/dist/animation/theatre-director.d.ts.map +1 -0
  78. package/dist/animation/theatre-director.js +248 -0
  79. package/dist/animation/theatre-object-binding.d.ts +305 -0
  80. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  81. package/dist/animation/theatre-object-binding.js +351 -0
  82. package/dist/animation/xstate-animation-binding.d.ts +119 -0
  83. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  84. package/dist/animation/xstate-animation-binding.js +349 -0
  85. package/dist/animation/xstate-animation-meta.d.ts +266 -0
  86. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  87. package/dist/animation/xstate-animation-meta.js +252 -0
  88. package/dist/asset-formats/camera.d.ts +15 -0
  89. package/dist/asset-formats/camera.d.ts.map +1 -0
  90. package/dist/asset-formats/camera.js +15 -0
  91. package/dist/asset-formats/collider.d.ts +21 -0
  92. package/dist/asset-formats/collider.d.ts.map +1 -0
  93. package/dist/asset-formats/collider.js +53 -0
  94. package/dist/asset-formats/index.d.ts +46 -0
  95. package/dist/asset-formats/index.d.ts.map +1 -0
  96. package/dist/asset-formats/index.js +36 -0
  97. package/dist/asset-formats/instances.d.ts +17 -0
  98. package/dist/asset-formats/instances.d.ts.map +1 -0
  99. package/dist/asset-formats/instances.js +31 -0
  100. package/dist/asset-formats/light.d.ts +21 -0
  101. package/dist/asset-formats/light.d.ts.map +1 -0
  102. package/dist/asset-formats/light.js +35 -0
  103. package/dist/asset-formats/material.d.ts +129 -0
  104. package/dist/asset-formats/material.d.ts.map +1 -0
  105. package/dist/asset-formats/material.js +88 -0
  106. package/dist/asset-formats/mesh.d.ts +22 -0
  107. package/dist/asset-formats/mesh.d.ts.map +1 -0
  108. package/dist/asset-formats/mesh.js +64 -0
  109. package/dist/asset-formats/parse.d.ts +20 -0
  110. package/dist/asset-formats/parse.d.ts.map +1 -0
  111. package/dist/asset-formats/parse.js +34 -0
  112. package/dist/asset-formats/particles.d.ts +1390 -0
  113. package/dist/asset-formats/particles.d.ts.map +1 -0
  114. package/dist/asset-formats/particles.js +319 -0
  115. package/dist/asset-formats/render-env.d.ts +387 -0
  116. package/dist/asset-formats/render-env.d.ts.map +1 -0
  117. package/dist/asset-formats/render-env.js +300 -0
  118. package/dist/asset-formats/tuples.d.ts +12 -0
  119. package/dist/asset-formats/tuples.d.ts.map +1 -0
  120. package/dist/asset-formats/tuples.js +14 -0
  121. package/dist/asset-loaders.d.ts +97 -0
  122. package/dist/asset-loaders.d.ts.map +1 -0
  123. package/dist/asset-loaders.js +209 -0
  124. package/dist/asset-parse-error.d.ts +24 -0
  125. package/dist/asset-parse-error.d.ts.map +1 -0
  126. package/dist/asset-parse-error.js +29 -0
  127. package/dist/asset-registry.d.ts +38 -0
  128. package/dist/asset-registry.d.ts.map +1 -0
  129. package/dist/asset-registry.js +66 -0
  130. package/dist/assets.d.ts +26 -0
  131. package/dist/assets.d.ts.map +1 -0
  132. package/dist/assets.js +55 -0
  133. package/dist/audio/wav-encode.d.ts +38 -0
  134. package/dist/audio/wav-encode.d.ts.map +1 -0
  135. package/dist/audio/wav-encode.js +97 -0
  136. package/dist/canvas-react/engine-bridge.d.ts +45 -0
  137. package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
  138. package/dist/canvas-react/engine-bridge.js +45 -0
  139. package/dist/canvas-react/index.d.ts +42 -0
  140. package/dist/canvas-react/index.d.ts.map +1 -0
  141. package/dist/canvas-react/index.js +41 -0
  142. package/dist/canvas-react/pixi-primitive.d.ts +85 -0
  143. package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
  144. package/dist/canvas-react/pixi-primitive.js +181 -0
  145. package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
  146. package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
  147. package/dist/canvas-react/pixi-react-adapter.js +229 -0
  148. package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
  149. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
  150. package/dist/canvas-react/pixi-react-root-factory.js +73 -0
  151. package/dist/canvas-react/world-context.d.ts +88 -0
  152. package/dist/canvas-react/world-context.d.ts.map +1 -0
  153. package/dist/canvas-react/world-context.js +212 -0
  154. package/dist/config.d.ts +9 -0
  155. package/dist/config.d.ts.map +1 -0
  156. package/dist/config.js +8 -0
  157. package/dist/core/frame-pacing.d.ts +90 -0
  158. package/dist/core/frame-pacing.d.ts.map +1 -0
  159. package/dist/core/frame-pacing.js +89 -0
  160. package/dist/core/game-loop.d.ts +62 -0
  161. package/dist/core/game-loop.d.ts.map +1 -0
  162. package/dist/core/game-loop.js +189 -0
  163. package/dist/core/seeded-random.d.ts +69 -0
  164. package/dist/core/seeded-random.d.ts.map +1 -0
  165. package/dist/core/seeded-random.js +121 -0
  166. package/dist/core/sim-clock.d.ts +199 -0
  167. package/dist/core/sim-clock.d.ts.map +1 -0
  168. package/dist/core/sim-clock.js +291 -0
  169. package/dist/core/system-runner.d.ts +96 -0
  170. package/dist/core/system-runner.d.ts.map +1 -0
  171. package/dist/core/system-runner.js +253 -0
  172. package/dist/core/types.d.ts +111 -0
  173. package/dist/core/types.d.ts.map +1 -0
  174. package/dist/core/types.js +25 -0
  175. package/dist/data/data-asset.d.ts +101 -0
  176. package/dist/data/data-asset.d.ts.map +1 -0
  177. package/dist/data/data-asset.js +122 -0
  178. package/dist/data/data-check-core.d.ts +109 -0
  179. package/dist/data/data-check-core.d.ts.map +1 -0
  180. package/dist/data/data-check-core.js +177 -0
  181. package/dist/data/data-ref.d.ts +79 -0
  182. package/dist/data/data-ref.d.ts.map +1 -0
  183. package/dist/data/data-ref.js +130 -0
  184. package/dist/data/vite-plugin-data.d.ts +79 -0
  185. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  186. package/dist/data/vite-plugin-data.js +217 -0
  187. package/dist/defaults.d.ts +233 -0
  188. package/dist/defaults.d.ts.map +1 -0
  189. package/dist/defaults.js +137 -0
  190. package/dist/dev/chrome-trace.d.ts +45 -0
  191. package/dist/dev/chrome-trace.d.ts.map +1 -0
  192. package/dist/dev/chrome-trace.js +114 -0
  193. package/dist/dev/console-bridge.d.ts +22 -0
  194. package/dist/dev/console-bridge.d.ts.map +1 -0
  195. package/dist/dev/console-bridge.js +71 -0
  196. package/dist/dev/debug-draw.d.ts +24 -0
  197. package/dist/dev/debug-draw.d.ts.map +1 -0
  198. package/dist/dev/debug-draw.js +73 -0
  199. package/dist/dev/instruments.d.ts +133 -0
  200. package/dist/dev/instruments.d.ts.map +1 -0
  201. package/dist/dev/instruments.js +231 -0
  202. package/dist/dev/logger.d.ts +30 -0
  203. package/dist/dev/logger.d.ts.map +1 -0
  204. package/dist/dev/logger.js +90 -0
  205. package/dist/dev/performance-profiler.d.ts +111 -0
  206. package/dist/dev/performance-profiler.d.ts.map +1 -0
  207. package/dist/dev/performance-profiler.js +215 -0
  208. package/dist/dev/render-debug-adapter.d.ts +57 -0
  209. package/dist/dev/render-debug-adapter.d.ts.map +1 -0
  210. package/dist/dev/render-debug-adapter.js +141 -0
  211. package/dist/dev/render-memory.d.ts +53 -0
  212. package/dist/dev/render-memory.d.ts.map +1 -0
  213. package/dist/dev/render-memory.js +190 -0
  214. package/dist/dev/webgl-frame-capture.d.ts +134 -0
  215. package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
  216. package/dist/dev/webgl-frame-capture.js +270 -0
  217. package/dist/dev/webgl-gpu-timer.d.ts +8 -0
  218. package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
  219. package/dist/dev/webgl-gpu-timer.js +52 -0
  220. package/dist/ecs/scene-index.d.ts +179 -0
  221. package/dist/ecs/scene-index.d.ts.map +1 -0
  222. package/dist/ecs/scene-index.js +331 -0
  223. package/dist/ecs/scene-query.d.ts +6 -0
  224. package/dist/ecs/scene-query.d.ts.map +1 -0
  225. package/dist/ecs/scene-query.js +40 -0
  226. package/dist/ecs/user-data.d.ts +193 -0
  227. package/dist/ecs/user-data.d.ts.map +1 -0
  228. package/dist/ecs/user-data.js +145 -0
  229. package/dist/index.d.ts +35 -0
  230. package/dist/index.d.ts.map +1 -0
  231. package/dist/index.js +29 -0
  232. package/dist/input/input-manager.d.ts +944 -0
  233. package/dist/input/input-manager.d.ts.map +1 -0
  234. package/dist/input/input-manager.js +2209 -0
  235. package/dist/input/input-types.d.ts +174 -0
  236. package/dist/input/input-types.d.ts.map +1 -0
  237. package/dist/input/input-types.js +1 -0
  238. package/dist/input/prompt-labels.d.ts +21 -0
  239. package/dist/input/prompt-labels.d.ts.map +1 -0
  240. package/dist/input/prompt-labels.js +121 -0
  241. package/dist/input/rebind-controller.d.ts +59 -0
  242. package/dist/input/rebind-controller.d.ts.map +1 -0
  243. package/dist/input/rebind-controller.js +85 -0
  244. package/dist/input/schema.d.ts +16 -0
  245. package/dist/input/schema.d.ts.map +1 -0
  246. package/dist/input/schema.js +228 -0
  247. package/dist/loader.d.ts +76 -0
  248. package/dist/loader.d.ts.map +1 -0
  249. package/dist/loader.js +114 -0
  250. package/dist/manifest/editor-port.d.ts +53 -0
  251. package/dist/manifest/editor-port.d.ts.map +1 -0
  252. package/dist/manifest/editor-port.js +67 -0
  253. package/dist/manifest/filename.d.ts +14 -0
  254. package/dist/manifest/filename.d.ts.map +1 -0
  255. package/dist/manifest/filename.js +43 -0
  256. package/dist/manifest/index.d.ts +6 -0
  257. package/dist/manifest/index.d.ts.map +1 -0
  258. package/dist/manifest/index.js +9 -0
  259. package/dist/manifest/load-file.d.ts +7 -0
  260. package/dist/manifest/load-file.d.ts.map +1 -0
  261. package/dist/manifest/load-file.js +23 -0
  262. package/dist/manifest/load.d.ts +161 -0
  263. package/dist/manifest/load.d.ts.map +1 -0
  264. package/dist/manifest/load.js +269 -0
  265. package/dist/manifest/locate.d.ts +24 -0
  266. package/dist/manifest/locate.d.ts.map +1 -0
  267. package/dist/manifest/locate.js +48 -0
  268. package/dist/manifest/schema.d.ts +293 -0
  269. package/dist/manifest/schema.d.ts.map +1 -0
  270. package/dist/manifest/schema.js +633 -0
  271. package/dist/physics/collider-dimensions.d.ts +63 -0
  272. package/dist/physics/collider-dimensions.d.ts.map +1 -0
  273. package/dist/physics/collider-dimensions.js +98 -0
  274. package/dist/physics/collision-system.d.ts +41 -0
  275. package/dist/physics/collision-system.d.ts.map +1 -0
  276. package/dist/physics/collision-system.js +64 -0
  277. package/dist/physics/physics-registry.d.ts +45 -0
  278. package/dist/physics/physics-registry.d.ts.map +1 -0
  279. package/dist/physics/physics-registry.js +65 -0
  280. package/dist/physics/transform-writer.d.ts +16 -0
  281. package/dist/physics/transform-writer.d.ts.map +1 -0
  282. package/dist/physics/transform-writer.js +38 -0
  283. package/dist/pixi/authoring.d.ts +93 -0
  284. package/dist/pixi/authoring.d.ts.map +1 -0
  285. package/dist/pixi/authoring.js +207 -0
  286. package/dist/pixi/index.d.ts +16 -0
  287. package/dist/pixi/index.d.ts.map +1 -0
  288. package/dist/pixi/index.js +15 -0
  289. package/dist/pixi/ingest-iframe.d.ts +82 -0
  290. package/dist/pixi/ingest-iframe.d.ts.map +1 -0
  291. package/dist/pixi/ingest-iframe.js +166 -0
  292. package/dist/pixi/ingest.d.ts +97 -0
  293. package/dist/pixi/ingest.d.ts.map +1 -0
  294. package/dist/pixi/ingest.js +40 -0
  295. package/dist/pixi/physics-registry.d.ts +24 -0
  296. package/dist/pixi/physics-registry.d.ts.map +1 -0
  297. package/dist/pixi/physics-registry.js +38 -0
  298. package/dist/pixi/scene-capture.d.ts +43 -0
  299. package/dist/pixi/scene-capture.d.ts.map +1 -0
  300. package/dist/pixi/scene-capture.js +92 -0
  301. package/dist/pixi/system-adapters.d.ts +16 -0
  302. package/dist/pixi/system-adapters.d.ts.map +1 -0
  303. package/dist/pixi/system-adapters.js +37 -0
  304. package/dist/react/unmanaged-root-detector.d.ts +18 -0
  305. package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
  306. package/dist/react/unmanaged-root-detector.js +70 -0
  307. package/dist/react/use-data.d.ts +60 -0
  308. package/dist/react/use-data.d.ts.map +1 -0
  309. package/dist/react/use-data.js +101 -0
  310. package/dist/react/use-selection.d.ts +54 -0
  311. package/dist/react/use-selection.d.ts.map +1 -0
  312. package/dist/react/use-selection.js +71 -0
  313. package/dist/react/world-state.d.ts +154 -0
  314. package/dist/react/world-state.d.ts.map +1 -0
  315. package/dist/react/world-state.js +220 -0
  316. package/dist/render/auto-batcher.d.ts +34 -0
  317. package/dist/render/auto-batcher.d.ts.map +1 -0
  318. package/dist/render/auto-batcher.js +140 -0
  319. package/dist/render/instance-mesh.d.ts +5 -0
  320. package/dist/render/instance-mesh.d.ts.map +1 -0
  321. package/dist/render/instance-mesh.js +19 -0
  322. package/dist/render/light-camera-factory.d.ts +24 -0
  323. package/dist/render/light-camera-factory.d.ts.map +1 -0
  324. package/dist/render/light-camera-factory.js +71 -0
  325. package/dist/render/lod.d.ts +13 -0
  326. package/dist/render/lod.d.ts.map +1 -0
  327. package/dist/render/lod.js +16 -0
  328. package/dist/render/material-factory.d.ts +15 -0
  329. package/dist/render/material-factory.d.ts.map +1 -0
  330. package/dist/render/material-factory.js +186 -0
  331. package/dist/render/mesh-shadow.d.ts +11 -0
  332. package/dist/render/mesh-shadow.d.ts.map +1 -0
  333. package/dist/render/mesh-shadow.js +19 -0
  334. package/dist/render/particles-factory.d.ts +99 -0
  335. package/dist/render/particles-factory.d.ts.map +1 -0
  336. package/dist/render/particles-factory.js +361 -0
  337. package/dist/render/render-batch-system.d.ts +33 -0
  338. package/dist/render/render-batch-system.d.ts.map +1 -0
  339. package/dist/render/render-batch-system.js +223 -0
  340. package/dist/render/render-features.d.ts +47 -0
  341. package/dist/render/render-features.d.ts.map +1 -0
  342. package/dist/render/render-features.js +105 -0
  343. package/dist/render/render-settings.d.ts +35 -0
  344. package/dist/render/render-settings.d.ts.map +1 -0
  345. package/dist/render/render-settings.js +51 -0
  346. package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
  347. package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
  348. package/dist/render/spark-renderer-lifecycle.js +57 -0
  349. package/dist/render/viewport-shading.d.ts +17 -0
  350. package/dist/render/viewport-shading.d.ts.map +1 -0
  351. package/dist/render/viewport-shading.js +87 -0
  352. package/dist/runtime/create-runtime.d.ts +259 -0
  353. package/dist/runtime/create-runtime.d.ts.map +1 -0
  354. package/dist/runtime/create-runtime.js +666 -0
  355. package/dist/runtime/debug-bridge.d.ts +288 -0
  356. package/dist/runtime/debug-bridge.d.ts.map +1 -0
  357. package/dist/runtime/debug-bridge.js +277 -0
  358. package/dist/runtime/debug-registry.d.ts +287 -0
  359. package/dist/runtime/debug-registry.d.ts.map +1 -0
  360. package/dist/runtime/debug-registry.js +528 -0
  361. package/dist/runtime/dev-layers.d.ts +34 -0
  362. package/dist/runtime/dev-layers.d.ts.map +1 -0
  363. package/dist/runtime/dev-layers.js +40 -0
  364. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  365. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  366. package/dist/runtime/frame-selector-cache.js +65 -0
  367. package/dist/runtime/game.d.ts +576 -0
  368. package/dist/runtime/game.d.ts.map +1 -0
  369. package/dist/runtime/game.js +1003 -0
  370. package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
  371. package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
  372. package/dist/runtime/gameplay-rng-trap.js +95 -0
  373. package/dist/runtime/input-router.d.ts +78 -0
  374. package/dist/runtime/input-router.d.ts.map +1 -0
  375. package/dist/runtime/input-router.js +171 -0
  376. package/dist/runtime/mount-game.d.ts +126 -0
  377. package/dist/runtime/mount-game.d.ts.map +1 -0
  378. package/dist/runtime/mount-game.js +159 -0
  379. package/dist/runtime/mount-manifest.d.ts +174 -0
  380. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  381. package/dist/runtime/mount-manifest.js +304 -0
  382. package/dist/runtime/presentation.d.ts +85 -0
  383. package/dist/runtime/presentation.d.ts.map +1 -0
  384. package/dist/runtime/presentation.js +92 -0
  385. package/dist/runtime/render-audio-control.d.ts +126 -0
  386. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  387. package/dist/runtime/render-audio-control.js +116 -0
  388. package/dist/runtime/render-control.d.ts +347 -0
  389. package/dist/runtime/render-control.d.ts.map +1 -0
  390. package/dist/runtime/render-control.js +317 -0
  391. package/dist/runtime/render-seed.d.ts +56 -0
  392. package/dist/runtime/render-seed.d.ts.map +1 -0
  393. package/dist/runtime/render-seed.js +73 -0
  394. package/dist/runtime/state-bridge.d.ts +60 -0
  395. package/dist/runtime/state-bridge.d.ts.map +1 -0
  396. package/dist/runtime/state-bridge.js +62 -0
  397. package/dist/runtime/types.d.ts +285 -0
  398. package/dist/runtime/types.d.ts.map +1 -0
  399. package/dist/runtime/types.js +1 -0
  400. package/dist/runtime/unexported-game-trap.d.ts +36 -0
  401. package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
  402. package/dist/runtime/unexported-game-trap.js +80 -0
  403. package/dist/setup/setup-audio.d.ts +20 -0
  404. package/dist/setup/setup-audio.d.ts.map +1 -0
  405. package/dist/setup/setup-audio.js +41 -0
  406. package/dist/setup/setup-particles.d.ts +17 -0
  407. package/dist/setup/setup-particles.d.ts.map +1 -0
  408. package/dist/setup/setup-particles.js +16 -0
  409. package/dist/setup/setup-physics.d.ts +25 -0
  410. package/dist/setup/setup-physics.d.ts.map +1 -0
  411. package/dist/setup/setup-physics.js +51 -0
  412. package/dist/setup/setup-renderer.d.ts +82 -0
  413. package/dist/setup/setup-renderer.d.ts.map +1 -0
  414. package/dist/setup/setup-renderer.js +381 -0
  415. package/dist/world3d-react/engine-bridge.d.ts +47 -0
  416. package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
  417. package/dist/world3d-react/engine-bridge.js +48 -0
  418. package/dist/world3d-react/index.d.ts +47 -0
  419. package/dist/world3d-react/index.d.ts.map +1 -0
  420. package/dist/world3d-react/index.js +46 -0
  421. package/dist/world3d-react/r3f-adapter.d.ts +51 -0
  422. package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
  423. package/dist/world3d-react/r3f-adapter.js +368 -0
  424. package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
  425. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
  426. package/dist/world3d-react/r3f-root-factory.js +79 -0
  427. package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
  428. package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
  429. package/dist/world3d-react/rapier-physics-bridge.js +120 -0
  430. package/dist/world3d-react/renderer-config.d.ts +58 -0
  431. package/dist/world3d-react/renderer-config.d.ts.map +1 -0
  432. package/dist/world3d-react/renderer-config.js +96 -0
  433. package/dist/world3d-react/world-context.d.ts +123 -0
  434. package/dist/world3d-react/world-context.d.ts.map +1 -0
  435. package/dist/world3d-react/world-context.js +204 -0
  436. package/dist-config/config.js +303 -0
  437. package/dist-config/config.js.map +7 -0
  438. package/package.json +14 -3
  439. package/src/adapter/rapier-physics-adapter.ts +77 -34
  440. package/src/config.ts +8 -0
  441. package/src/core/frame-pacing.ts +26 -0
  442. package/src/core/game-loop.ts +4 -3
  443. package/src/dev/instruments.ts +302 -0
  444. package/src/runtime/mount-game.ts +6 -0
  445. package/src/runtime/unexported-game-trap.ts +82 -0
  446. package/src/setup/setup-renderer.ts +2 -0
  447. package/src/world3d-react/index.ts +9 -0
  448. package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
@@ -0,0 +1,351 @@
1
+ /**
2
+ * D3 — stable binding from a Theatre Sheet Object to a `THREE.Object3D`/
3
+ * camera (spec §10 D3, §5.3). This is the "thin integration code" the spec
4
+ * calls for: it reads a Theatre object's pull-based `.value` on every clock
5
+ * crossing and writes the (small, fixed) set of known sub-props straight
6
+ * onto the target's real Three.js properties. It is deliberately NOT a
7
+ * generic/arbitrary property-path evaluator — the only shapes understood are
8
+ * the ones declared below (`TransformProps`, `CameraLensProps`), matching
9
+ * "No arbitrary unsafe property-path evaluator is introduced" (D3 AC).
10
+ *
11
+ * Reads `sheetObject.value` rather than subscribing to Theatre's
12
+ * `onValuesChange` push channel — see `theatre-clock-binding.ts`'s module doc
13
+ * for why: `.value` is synchronously fresh immediately after
14
+ * `sequence.position` is set, while `onValuesChange` is batched on Theatre's
15
+ * own raf-driven ticker and is not delivered 1:1 with each synchronous clock
16
+ * seek (it may coalesce several writes into one notification, or — headless,
17
+ * no-raf — never fire at all).
18
+ *
19
+ * Object identity: a Theatre Sheet Object always carries both its stable,
20
+ * readable Theatre name (`sheetObject.address.objectKey`) and, since the
21
+ * caller supplies the bound `THREE.Object3D` directly, that object's own
22
+ * engine identity (`Object3D.uuid`/`.name`/`userData['entityId']`) — both are
23
+ * inspectable from the object references the binding already holds; nothing
24
+ * further to thread through.
25
+ *
26
+ * ## Remaining D3 channels: quaternion/material/light/post-processing/UI/Pixi
27
+ *
28
+ * The rest of the D3 AC's channel list (spec §10 D3: "Position,
29
+ * rotation/quaternion, scale, camera lens, material/light, post-processing,
30
+ * and selected UI properties have tested bindings") is implemented below,
31
+ * each as its own small, explicit, TYPED helper — never a generic
32
+ * property-path evaluator:
33
+ *
34
+ * - `bindObject3DQuaternion` — `Object3D.quaternion`, authored as a plain
35
+ * `{x,y,z,w}` compound (see `QuaternionProps`'s doc for the interpolation
36
+ * caveat and why the binding always normalizes).
37
+ * - `bindMaterialProperties` — `color`/`opacity`/`emissiveIntensity`/
38
+ * `roughness`/`metalness` on a real `THREE.Material`, feature-detecting
39
+ * which sub-props the concrete material subtype actually has.
40
+ * - `bindLightProperties` — `intensity`/`color` on a real `THREE.Light`.
41
+ * - `bindBloomEffect` / `bindVignetteEffect` — `intensity`/`opacity` and
42
+ * `offset`/`darkness` on real `postprocessing` `BloomEffect`/
43
+ * `VignetteEffect` instances (the SAME package `setup-renderer.ts` already
44
+ * wires into the engine's composer — no new post-processing stack).
45
+ * - `bindDomElementStyle` — `opacity`/`translateX`/`translateY` on a
46
+ * DOM-style-writable target (`DomStyleTarget`, a narrow structural
47
+ * interface a real `HTMLElement` satisfies with no adapter).
48
+ * - `bindPixiContainerTransform` — `x`/`y`/`rotation`/`scaleX`/`scaleY`/
49
+ * `alpha` on a real `PIXI.Container`/`PIXI.Sprite`.
50
+ *
51
+ * All of the above are proven against REAL target objects in
52
+ * `theatre-object-binding-d3.test.ts` — `BloomEffect`/`VignetteEffect`/
53
+ * `PIXI.Container`/`PIXI.Sprite` all construct and expose plain,
54
+ * synchronously-settable properties with no WebGL/canvas/renderer required,
55
+ * so nothing here is a mock of the underlying library. The one channel that
56
+ * genuinely cannot construct real headlessly in THIS repo's `environment:
57
+ * 'node'` vitest lane (`vitest.config.ts` — no DOM) is a real `HTMLElement`;
58
+ * `bindDomElementStyle` is typed against the narrow `DomStyleTarget`
59
+ * structural interface instead of full `HTMLElement`, and its test exercises
60
+ * a plain object literal shaped like one — the exact same binding code path
61
+ * a real `HTMLElement`/React-overlay ref runs through in a browser or a
62
+ * jsdom-backed test. Nothing here is deferred.
63
+ */
64
+ /** Thrown when a binding is constructed with a missing/falsy target. */
65
+ export class TheatreBindingError extends Error {
66
+ objectKey;
67
+ constructor(message, objectKey) {
68
+ super(message);
69
+ this.objectKey = objectKey;
70
+ this.name = 'TheatreBindingError';
71
+ }
72
+ }
73
+ /**
74
+ * Shared disposer wiring for every binding below (same one-shot-dispose
75
+ * shape `bindObject3DTransform`/`bindCameraLens` each inline above) — pulled
76
+ * into one helper only because six more binding functions follow, to avoid
77
+ * repeating the identical five lines six more times. Behavior is identical
78
+ * to the inline version: idempotent `dispose()`, no further writes after.
79
+ */
80
+ function toBinding(handle) {
81
+ let disposed = false;
82
+ return {
83
+ dispose() {
84
+ if (disposed)
85
+ return;
86
+ disposed = true;
87
+ handle.dispose();
88
+ },
89
+ };
90
+ }
91
+ /**
92
+ * Bind a Theatre Sheet Object's `position`/`rotation`/`scale` sub-props (any
93
+ * subset) to a `THREE.Object3D`. Whichever of the three keys are present on
94
+ * `sheetObject.value` are applied; missing keys are left untouched on the
95
+ * target.
96
+ *
97
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
98
+ */
99
+ export function bindObject3DTransform(clock, sheetObject, target, options = {}) {
100
+ if (!target) {
101
+ throw new TheatreBindingError(`[bindObject3DTransform] missing target Object3D for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
102
+ }
103
+ const phase = options.phase ?? 'preRender';
104
+ const handle = clock.subscribe(phase, () => {
105
+ const value = sheetObject.value;
106
+ if (value.position) {
107
+ target.position.set(value.position.x, value.position.y, value.position.z);
108
+ }
109
+ if (value.rotation) {
110
+ target.rotation.set(value.rotation.x, value.rotation.y, value.rotation.z);
111
+ }
112
+ if (value.scale) {
113
+ target.scale.set(value.scale.x, value.scale.y, value.scale.z);
114
+ }
115
+ });
116
+ let disposed = false;
117
+ return {
118
+ dispose() {
119
+ if (disposed)
120
+ return;
121
+ disposed = true;
122
+ handle.dispose();
123
+ },
124
+ };
125
+ }
126
+ /**
127
+ * Bind a Theatre Sheet Object's `fov`/`near`/`far` sub-props (any subset) to
128
+ * a `THREE.PerspectiveCamera`'s lens, calling `updateProjectionMatrix()`
129
+ * whenever any of them change.
130
+ *
131
+ * @throws {TheatreBindingError} if `camera` is null/undefined at bind time.
132
+ */
133
+ export function bindCameraLens(clock, sheetObject, camera, options = {}) {
134
+ if (!camera) {
135
+ throw new TheatreBindingError(`[bindCameraLens] missing target PerspectiveCamera for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
136
+ }
137
+ const phase = options.phase ?? 'preRender';
138
+ const handle = clock.subscribe(phase, () => {
139
+ const value = sheetObject.value;
140
+ let changed = false;
141
+ if (typeof value.fov === 'number' && camera.fov !== value.fov) {
142
+ camera.fov = value.fov;
143
+ changed = true;
144
+ }
145
+ if (typeof value.near === 'number' && camera.near !== value.near) {
146
+ camera.near = value.near;
147
+ changed = true;
148
+ }
149
+ if (typeof value.far === 'number' && camera.far !== value.far) {
150
+ camera.far = value.far;
151
+ changed = true;
152
+ }
153
+ if (changed)
154
+ camera.updateProjectionMatrix();
155
+ });
156
+ let disposed = false;
157
+ return {
158
+ dispose() {
159
+ if (disposed)
160
+ return;
161
+ disposed = true;
162
+ handle.dispose();
163
+ },
164
+ };
165
+ }
166
+ /**
167
+ * Bind a Theatre Sheet Object's `quaternion` sub-prop to a `THREE.Object3D`'s
168
+ * `.quaternion`. See `QuaternionProps`'s doc for the authored shape and its
169
+ * interpolation caveat.
170
+ *
171
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
172
+ */
173
+ export function bindObject3DQuaternion(clock, sheetObject, target, options = {}) {
174
+ if (!target) {
175
+ throw new TheatreBindingError(`[bindObject3DQuaternion] missing target Object3D for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
176
+ }
177
+ const phase = options.phase ?? 'preRender';
178
+ const handle = clock.subscribe(phase, () => {
179
+ const value = sheetObject.value;
180
+ if (value.quaternion) {
181
+ const { x, y, z, w } = value.quaternion;
182
+ target.quaternion.set(x, y, z, w);
183
+ target.quaternion.normalize();
184
+ }
185
+ });
186
+ return toBinding(handle);
187
+ }
188
+ /**
189
+ * Bind a Theatre Sheet Object's `color`/`opacity`/`emissiveIntensity`/
190
+ * `roughness`/`metalness` sub-props (any subset the target material
191
+ * supports) to a `THREE.Material`.
192
+ *
193
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
194
+ */
195
+ export function bindMaterialProperties(clock, sheetObject, target, options = {}) {
196
+ if (!target) {
197
+ throw new TheatreBindingError(`[bindMaterialProperties] missing target Material for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
198
+ }
199
+ const material = target;
200
+ const phase = options.phase ?? 'preRender';
201
+ const handle = clock.subscribe(phase, () => {
202
+ const value = sheetObject.value;
203
+ if (value.color && material.color) {
204
+ material.color.setRGB(value.color.r, value.color.g, value.color.b);
205
+ }
206
+ if (typeof value.opacity === 'number') {
207
+ material.opacity = value.opacity;
208
+ }
209
+ if (typeof value.emissiveIntensity === 'number' && 'emissiveIntensity' in material) {
210
+ material.emissiveIntensity = value.emissiveIntensity;
211
+ }
212
+ if (typeof value.roughness === 'number' && 'roughness' in material) {
213
+ material.roughness = value.roughness;
214
+ }
215
+ if (typeof value.metalness === 'number' && 'metalness' in material) {
216
+ material.metalness = value.metalness;
217
+ }
218
+ });
219
+ return toBinding(handle);
220
+ }
221
+ /**
222
+ * Bind a Theatre Sheet Object's `intensity`/`color` sub-props (any subset)
223
+ * to a `THREE.Light`.
224
+ *
225
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
226
+ */
227
+ export function bindLightProperties(clock, sheetObject, target, options = {}) {
228
+ if (!target) {
229
+ throw new TheatreBindingError(`[bindLightProperties] missing target Light for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
230
+ }
231
+ const phase = options.phase ?? 'preRender';
232
+ const handle = clock.subscribe(phase, () => {
233
+ const value = sheetObject.value;
234
+ if (typeof value.intensity === 'number') {
235
+ target.intensity = value.intensity;
236
+ }
237
+ if (value.color) {
238
+ target.color.setRGB(value.color.r, value.color.g, value.color.b);
239
+ }
240
+ });
241
+ return toBinding(handle);
242
+ }
243
+ /**
244
+ * Bind a Theatre Sheet Object's `intensity`/`opacity` sub-props (any subset)
245
+ * to a real `postprocessing` `BloomEffect` — the SAME `postprocessing` npm
246
+ * package the engine's own composer pipeline already uses directly
247
+ * (`setup-renderer.ts`), not a new post-processing stack.
248
+ *
249
+ * @throws {TheatreBindingError} if `effect` is null/undefined at bind time.
250
+ */
251
+ export function bindBloomEffect(clock, sheetObject, effect, options = {}) {
252
+ if (!effect) {
253
+ throw new TheatreBindingError(`[bindBloomEffect] missing target BloomEffect for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
254
+ }
255
+ const phase = options.phase ?? 'preRender';
256
+ const handle = clock.subscribe(phase, () => {
257
+ const value = sheetObject.value;
258
+ if (typeof value.intensity === 'number') {
259
+ effect.intensity = value.intensity;
260
+ }
261
+ if (typeof value.opacity === 'number') {
262
+ effect.blendMode.opacity.value = value.opacity;
263
+ }
264
+ });
265
+ return toBinding(handle);
266
+ }
267
+ /**
268
+ * Bind a Theatre Sheet Object's `offset`/`darkness` sub-props (any subset) to
269
+ * a real `postprocessing` `VignetteEffect` — same package/no-wrapper note as
270
+ * `bindBloomEffect` above.
271
+ *
272
+ * @throws {TheatreBindingError} if `effect` is null/undefined at bind time.
273
+ */
274
+ export function bindVignetteEffect(clock, sheetObject, effect, options = {}) {
275
+ if (!effect) {
276
+ throw new TheatreBindingError(`[bindVignetteEffect] missing target VignetteEffect for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
277
+ }
278
+ const phase = options.phase ?? 'preRender';
279
+ const handle = clock.subscribe(phase, () => {
280
+ const value = sheetObject.value;
281
+ if (typeof value.offset === 'number') {
282
+ effect.offset = value.offset;
283
+ }
284
+ if (typeof value.darkness === 'number') {
285
+ effect.darkness = value.darkness;
286
+ }
287
+ });
288
+ return toBinding(handle);
289
+ }
290
+ /**
291
+ * Bind a Theatre Sheet Object's `opacity`/`translateX`/`translateY`
292
+ * sub-props (any subset) to a DOM-style-writable target's inline style. See
293
+ * `DomStyleTarget`'s doc for how this is proven without a real browser DOM.
294
+ *
295
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
296
+ */
297
+ export function bindDomElementStyle(clock, sheetObject, target, options = {}) {
298
+ if (!target) {
299
+ throw new TheatreBindingError(`[bindDomElementStyle] missing target DOM element for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
300
+ }
301
+ const phase = options.phase ?? 'preRender';
302
+ let lastTranslateX = 0;
303
+ let lastTranslateY = 0;
304
+ const handle = clock.subscribe(phase, () => {
305
+ const value = sheetObject.value;
306
+ if (typeof value.opacity === 'number') {
307
+ target.style.opacity = String(value.opacity);
308
+ }
309
+ if (typeof value.translateX === 'number')
310
+ lastTranslateX = value.translateX;
311
+ if (typeof value.translateY === 'number')
312
+ lastTranslateY = value.translateY;
313
+ if (typeof value.translateX === 'number' || typeof value.translateY === 'number') {
314
+ target.style.transform = `translate(${lastTranslateX}px, ${lastTranslateY}px)`;
315
+ }
316
+ });
317
+ return toBinding(handle);
318
+ }
319
+ /**
320
+ * Bind a Theatre Sheet Object's `x`/`y`/`rotation`/`scaleX`/`scaleY`/`alpha`
321
+ * sub-props (any subset) to a real `PIXI.Container`/`PIXI.Sprite` (reusing
322
+ * the Pixi surface's own `pixi.js` dependency — see this module's
323
+ * type-only `pixi.js` import above and its doc note on why the engine core
324
+ * never value-imports it). Plain `Container`/`Sprite` construction needs no
325
+ * canvas/WebGL context, so this is proven against a REAL Pixi object in
326
+ * `theatre-object-binding-d3.test.ts`, not a stand-in.
327
+ *
328
+ * @throws {TheatreBindingError} if `target` is null/undefined at bind time.
329
+ */
330
+ export function bindPixiContainerTransform(clock, sheetObject, target, options = {}) {
331
+ if (!target) {
332
+ throw new TheatreBindingError(`[bindPixiContainerTransform] missing target PIXI.Container for Theatre object "${sheetObject.address.objectKey}"`, sheetObject.address.objectKey);
333
+ }
334
+ const phase = options.phase ?? 'preRender';
335
+ const handle = clock.subscribe(phase, () => {
336
+ const value = sheetObject.value;
337
+ if (typeof value.x === 'number')
338
+ target.x = value.x;
339
+ if (typeof value.y === 'number')
340
+ target.y = value.y;
341
+ if (typeof value.rotation === 'number')
342
+ target.rotation = value.rotation;
343
+ if (typeof value.scaleX === 'number')
344
+ target.scale.x = value.scaleX;
345
+ if (typeof value.scaleY === 'number')
346
+ target.scale.y = value.scaleY;
347
+ if (typeof value.alpha === 'number')
348
+ target.alpha = value.alpha;
349
+ });
350
+ return toBinding(handle);
351
+ }
@@ -0,0 +1,119 @@
1
+ import * as THREE from 'three';
2
+ import type { AnyStateMachine } from 'xstate';
3
+ import type { createSystemRunner } from '../core/system-runner';
4
+ import { type AnimationBoneMask } from './xstate-animation-meta';
5
+ /**
6
+ * The snapshot half of {@link XStateAnimationActor} — the three members this
7
+ * binder and the editor's machine inspectors actually read off a snapshot.
8
+ * Named here rather than imported so the seam stays XState-free; see the
9
+ * actor's own note for why that matters.
10
+ */
11
+ export interface XStateAnimationSnapshot {
12
+ /** Active state value (`'idle'`, `{ locomotion: 'run' }`). XState's
13
+ * `StateValue`, kept as `unknown` here — only the inspector interprets it. */
14
+ readonly value: unknown;
15
+ /** Live machine context, read for blend-tree parameters. */
16
+ readonly context: unknown;
17
+ /** Meta of every active state, keyed by state id — how the binder learns
18
+ * which states are active and what `meta.animation` they carry. */
19
+ readonly getMeta: () => Record<string, unknown>;
20
+ }
21
+ /**
22
+ * What this binder needs from a running actor — a MINIMAL STRUCTURAL shape
23
+ * that names no XState type at all. It is satisfied by `Actor<TMachine>`, by
24
+ * `ActorRefFrom<typeof machine>`, and by anything else that can report a
25
+ * snapshot and be subscribed to.
26
+ *
27
+ * TWO REASONS IT IS SPELLED OUT INSTEAD OF IMPORTED, both measured:
28
+ *
29
+ * - A nominal `Actor<AnyStateMachine>` parameter rejects the type XState's own
30
+ * React docs reach for — `ActorRefFrom<typeof machine>`, e.g. in a
31
+ * `useRef<ActorRefFrom<typeof machine> | null>` — which carries no `logic`,
32
+ * `clock` or `options`. The call then fails with a wall of "missing the
33
+ * following properties" and the only obvious escape is
34
+ * `bindXStateAnimation(actor as any, …)`, a cast that also disables checking
35
+ * of the clip map and options.
36
+ * - XState's own `AnyActorRef` fixes that but is DEEP, and a game does not
37
+ * compile against the same physical copy of `xstate` the engine does: a
38
+ * scaffolded project installs its own, and the moment those two copies
39
+ * differ in version TypeScript stops deduplicating them by package id (the
40
+ * id is name + subpath + VERSION) and has to
41
+ * compare `Actor<StateMachine<…>>` from one copy against `AnyActorRef` from
42
+ * the other — structurally, through `system`, `src`, `_parent` and a generic
43
+ * `select`, until it gives up with `TS2321: Excessive stack depth`. Measured
44
+ * on a fresh `vgai create` + `vgai add humanoid`, where every in-repo gate
45
+ * stayed green because the monorepo resolves exactly one copy. A shape this
46
+ * shallow cannot blow that budget however many copies are in play.
47
+ *
48
+ * Both actor shapes still carry the machine — `Actor.logic`, and `machine` on
49
+ * every `MachineSnapshot` — so {@link machineOfXStateActor} reads it and no
50
+ * caller casts.
51
+ */
52
+ export interface XStateAnimationActor {
53
+ readonly getSnapshot: () => XStateAnimationSnapshot;
54
+ readonly subscribe: (next: (snapshot: XStateAnimationSnapshot) => void) => {
55
+ unsubscribe: () => void;
56
+ };
57
+ }
58
+ /** A binding-time problem such as a missing clip, bone, or ambiguous layer. */
59
+ export declare class AnimationBindingError extends Error {
60
+ readonly stateId?: string | undefined;
61
+ constructor(message: string, stateId?: string | undefined);
62
+ }
63
+ /** The state machine behind a bound actor, from whichever half of the actor
64
+ * shape carries it. Throws rather than silently binding nothing when the
65
+ * actor is not a state-machine actor (a promise/callback actor has no
66
+ * `meta.animation` to collect). */
67
+ export declare function machineOfXStateActor(actor: XStateAnimationActor): AnyStateMachine;
68
+ export interface XStateAnimationBindingOptions {
69
+ /** Select live numeric/boolean blend-tree parameters from actor context. */
70
+ selectParameters?: (context: unknown) => Record<string, number | boolean>;
71
+ /** Root whose named Bone/Object3D hierarchy is used by `boneMask`. Defaults to mixer root. */
72
+ root?: THREE.Object3D;
73
+ /** Entity that exposes this binding to editor/runtime inspection. Defaults to `root`. */
74
+ owner?: THREE.Object3D;
75
+ /**
76
+ * Engine runner used to register `tick` in the canonical animation phase.
77
+ * Pass `ctx.systems`; disposal removes the callback automatically. When
78
+ * omitted, the caller owns ticking (useful for standalone Three tests).
79
+ */
80
+ systems?: Pick<ReturnType<typeof createSystemRunner>, 'add' | 'remove'>;
81
+ }
82
+ export interface XStateAnimationLayerState {
83
+ readonly layer: string;
84
+ readonly stateId: string;
85
+ readonly clips: readonly string[];
86
+ /** Live native AnimationAction weights, including an in-progress crossfade. */
87
+ readonly clipWeights: readonly {
88
+ readonly clip: string;
89
+ readonly weight: number;
90
+ }[];
91
+ readonly weight: number;
92
+ readonly blendMode: 'override' | 'additive';
93
+ readonly boneMask?: AnimationBoneMask;
94
+ }
95
+ export interface XStateAnimationBinding {
96
+ /** Advance native actions/mixer. Register this in the engine animation phase. */
97
+ tick: (dt: number) => void;
98
+ readonly actor: XStateAnimationActor;
99
+ /** Current native composition, useful to the editor and game diagnostics. */
100
+ getActiveLayers: () => readonly XStateAnimationLayerState[];
101
+ /** Unsubscribe, stop/uncache actions, and remove owner inspection data. Idempotent. */
102
+ dispose: () => void;
103
+ }
104
+ /** React/useSyncExternalStore-compatible lifecycle signal for live editor inspection. */
105
+ export declare function subscribeXStateAnimationBindings(listener: () => void): () => void;
106
+ /** Monotonic snapshot changed whenever a binding is attached or disposed. */
107
+ export declare function getXStateAnimationBindingsVersion(): number;
108
+ /**
109
+ * Bind a native XState actor to native Three actions.
110
+ *
111
+ * One active animated state is allowed per named layer. Parallel XState
112
+ * regions therefore compose lower-body locomotion, upper-body weapon states,
113
+ * facial animation, and other independent layers without introducing a
114
+ * second transition language. Bone masks clone/filter native clip tracks;
115
+ * additive layers use `AnimationUtils.makeClipAdditive` and Three's additive
116
+ * blend mode. Single unlayered machines retain the original clip/action path.
117
+ */
118
+ export declare function bindXStateAnimation(actor: XStateAnimationActor, mixer: THREE.AnimationMixer, clips: Map<string, THREE.AnimationClip>, options?: XStateAnimationBindingOptions): XStateAnimationBinding;
119
+ //# sourceMappingURL=xstate-animation-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xstate-animation-binding.d.ts","sourceRoot":"","sources":["../../src/animation/xstate-animation-binding.ts"],"names":[],"mappings":"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"}