@vgai/engine 0.5.5 → 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 (446) 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/setup/setup-renderer.ts +2 -0
  445. package/src/world3d-react/index.ts +9 -0
  446. package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
@@ -0,0 +1,207 @@
1
+ function kindOf(o) {
2
+ const ctor = o.constructor?.name?.toLowerCase() ?? 'container';
3
+ if (ctor.includes('animatedsprite'))
4
+ return 'animatedsprite';
5
+ if (ctor.includes('sprite'))
6
+ return 'sprite';
7
+ if (ctor.includes('text'))
8
+ return 'text';
9
+ return 'container';
10
+ }
11
+ export class AuthoringAdapter2D {
12
+ root;
13
+ byId = new Map();
14
+ overlay = {};
15
+ dirty = false;
16
+ constructor(root, opts = {}) {
17
+ this.root = root;
18
+ if (opts.overlay)
19
+ this.overlay = opts.overlay;
20
+ this.refresh();
21
+ }
22
+ /**
23
+ * Walk the live tree assigning deterministic structural-path ids.
24
+ *
25
+ * Separate from {@link refresh} because the two are wanted at different rates: the ids have to be
26
+ * current whenever the tree is READ (a world that mounts its content asynchronously — a
27
+ * translated port waiting on its resources, anything behind Suspense — commits real nodes after
28
+ * the adapter was handed its root, and an unindexed node is one the hierarchy cannot name), while
29
+ * re-applying the edit overlay is a WRITE and must happen only when something asked for it.
30
+ */
31
+ reindex() {
32
+ this.byId.clear();
33
+ let count = 0;
34
+ let sprites = 0;
35
+ const visit = (o, path) => {
36
+ const id = `w2d:${path}:${kindOf(o)}:${o.label ?? ''}`;
37
+ o.__authId = id;
38
+ this.byId.set(id, o);
39
+ count++;
40
+ if (kindOf(o).includes('sprite'))
41
+ sprites++;
42
+ o.children.forEach((c, i) => {
43
+ visit(c, `${path}/${i}`);
44
+ });
45
+ };
46
+ this.root.children.forEach((c, i) => {
47
+ visit(c, `${i}`);
48
+ });
49
+ return { count, sprites };
50
+ }
51
+ /** {@link reindex}, then reapply every saved overlay edit to the live tree. */
52
+ refresh() {
53
+ const counts = this.reindex();
54
+ for (const [id, ov] of Object.entries(this.overlay))
55
+ this.applyOverride(id, ov);
56
+ return counts;
57
+ }
58
+ roots() {
59
+ return this.root.children.map((c) => this.toNode(c));
60
+ }
61
+ node(id) {
62
+ const o = this.byId.get(id);
63
+ return o ? this.toNode(o) : null;
64
+ }
65
+ displayObject(id) {
66
+ return this.byId.get(id) ?? null;
67
+ }
68
+ toNode(o) {
69
+ const self = o;
70
+ return {
71
+ id: self.__authId ?? '',
72
+ label: o.label ?? kindOf(o),
73
+ kind: kindOf(o),
74
+ parentId: o.parent?.__authId ?? null,
75
+ childIds: o.children.map((c) => c.__authId ?? ''),
76
+ };
77
+ }
78
+ // --- Transforms ---
79
+ getTransform(id) {
80
+ const o = this.byId.get(id);
81
+ // A tracked node isn't guaranteed to be a real PixiJS display object with
82
+ // a transform (e.g. test doubles / non-positional fixture nodes walked
83
+ // via the composite adapter's overlay path) — treat a missing position
84
+ // the same as a missing node: no transform to report, not a crash.
85
+ if (!o || !o.position || !o.scale)
86
+ return null;
87
+ return {
88
+ position: [o.position.x, o.position.y],
89
+ rotation: o.rotation,
90
+ scale: [o.scale.x, o.scale.y],
91
+ };
92
+ }
93
+ setTransform(id, t) {
94
+ const o = this.byId.get(id);
95
+ if (!o)
96
+ return;
97
+ if (t.position)
98
+ o.position.set(t.position[0], t.position[1]);
99
+ if (t.rotation !== undefined)
100
+ o.rotation = t.rotation;
101
+ if (t.scale)
102
+ o.scale.set(t.scale[0], t.scale[1]);
103
+ this.overlay[id] ??= {};
104
+ const ov = this.overlay[id];
105
+ if (t.position)
106
+ ov.position = t.position;
107
+ if (t.rotation !== undefined)
108
+ ov.rotation = t.rotation;
109
+ if (t.scale)
110
+ ov.scale = t.scale;
111
+ this.dirty = true;
112
+ }
113
+ // --- Inspector (reflected fields) ---
114
+ properties(id) {
115
+ const o = this.byId.get(id);
116
+ if (!o)
117
+ return [];
118
+ const props = [
119
+ { path: 'label', label: 'Name', type: 'string', value: o.label ?? '' },
120
+ { path: 'visible', label: 'Visible', type: 'boolean', value: o.visible },
121
+ { path: 'alpha', label: 'Alpha', type: 'number', value: o.alpha },
122
+ ];
123
+ if ('tint' in o)
124
+ props.push({
125
+ path: 'tint',
126
+ label: 'Tint',
127
+ type: 'color',
128
+ value: o.tint,
129
+ });
130
+ return props;
131
+ }
132
+ set(id, path, value) {
133
+ const o = this.byId.get(id);
134
+ if (!o)
135
+ return;
136
+ o[path] = value;
137
+ this.overlay[id] ??= {};
138
+ if (path === 'label')
139
+ this.overlay[id].label = value;
140
+ if (path === 'alpha')
141
+ this.overlay[id].alpha = value;
142
+ if (path === 'tint')
143
+ this.overlay[id].tint = value;
144
+ if (path === 'visible')
145
+ this.overlay[id].visible = value;
146
+ this.dirty = true;
147
+ }
148
+ applyOverride(id, ov) {
149
+ const o = this.byId.get(id);
150
+ if (!o)
151
+ return;
152
+ if (ov.label !== undefined)
153
+ o.label = ov.label;
154
+ if (ov.alpha !== undefined)
155
+ o.alpha = ov.alpha;
156
+ if (ov.position)
157
+ o.position.set(ov.position[0], ov.position[1]);
158
+ if (ov.rotation !== undefined)
159
+ o.rotation = ov.rotation;
160
+ if (ov.scale)
161
+ o.scale.set(ov.scale[0], ov.scale[1]);
162
+ if (ov.tint !== undefined && 'tint' in o)
163
+ o.tint = ov.tint;
164
+ if (ov.visible !== undefined)
165
+ o.visible = ov.visible;
166
+ }
167
+ /**
168
+ * Re-apply a saved/external overlay onto the (already-walked) live tree, merging
169
+ * it into the in-memory overlay so a later `serializeOverlay()`/save preserves it
170
+ * and a later `refresh()` re-applies it again. Ids absent from the current tree
171
+ * are skipped (orphaned, not an error) — the 2D analog of
172
+ * `LiveThreeAuthoringAdapter.applyOverlay` (T3.2 slice 3). Used both for the initial
173
+ * reload (constructor `opts.overlay`) and for `PersistenceProvider.applyExternal`
174
+ * (re-apply a changed overlay file without a full remount).
175
+ */
176
+ applyOverlay(overlay) {
177
+ let applied = 0;
178
+ let orphaned = 0;
179
+ for (const [id, ov] of Object.entries(overlay)) {
180
+ if (!this.byId.has(id)) {
181
+ orphaned++;
182
+ continue;
183
+ }
184
+ this.applyOverride(id, ov);
185
+ this.overlay[id] = { ...this.overlay[id], ...ov };
186
+ applied++;
187
+ }
188
+ return { applied, orphaned };
189
+ }
190
+ isDirty() {
191
+ return this.dirty;
192
+ }
193
+ serializeOverlay() {
194
+ return this.overlay;
195
+ }
196
+ /** Replace, rather than merge, overlay state after an exact history restore. */
197
+ replaceOverlay(overlay) {
198
+ this.overlay = structuredClone(overlay);
199
+ for (const [id, ov] of Object.entries(this.overlay))
200
+ this.applyOverride(id, ov);
201
+ this.dirty = true;
202
+ }
203
+ /** Clear the dirty flag after a successful save (mirrors LiveThreeAuthoringAdapter). */
204
+ markClean() {
205
+ this.dirty = false;
206
+ }
207
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * pixi — the PixiJS surface substrate.
3
+ *
4
+ * PixiJS is opt-in: the engine core never imports it, so a three-only bundle
5
+ * never pays for it. What lives here is what the host needs to mount and
6
+ * inspect a PixiJS game it did not write — the render-call capture trap, the
7
+ * in-realm and iframe mounts, the live display-tree authoring adapter, and the
8
+ * Rapier-2D handle registry the editor's transform coordination reads.
9
+ */
10
+ export { AuthoringAdapter2D, type EditorNode2D, type Overlay2D, type Override2D, type Property2D, type Transform2DValue, } from './authoring';
11
+ export { type ExtraDepsResolution2D, type IngestGame2D, type IngestMount2D, mountIngestGame2D, } from './ingest';
12
+ export { type EmbedMount2D, type IframeReachableMount2D, type IframeReachableMultiOpts, mountIngestGame2DEmbed, mountIngestGame2DIframeReachable, mountIngestGame2DIframeReachableMulti, } from './ingest-iframe';
13
+ export { createPhysics2DRegistry, type Physics2DRefs, type Physics2DRegistry, } from './physics-registry';
14
+ export { type CapturedRuntime2D, installSceneCapture2D, type SceneCapture2DHandle, } from './scene-capture';
15
+ export { createPhysicsAdapter2D, type PhysicsAdapter2D } from './system-adapters';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pixi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,sBAAsB,EACtB,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * pixi — the PixiJS surface substrate.
3
+ *
4
+ * PixiJS is opt-in: the engine core never imports it, so a three-only bundle
5
+ * never pays for it. What lives here is what the host needs to mount and
6
+ * inspect a PixiJS game it did not write — the render-call capture trap, the
7
+ * in-realm and iframe mounts, the live display-tree authoring adapter, and the
8
+ * Rapier-2D handle registry the editor's transform coordination reads.
9
+ */
10
+ export { AuthoringAdapter2D, } from './authoring';
11
+ export { mountIngestGame2D, } from './ingest';
12
+ export { mountIngestGame2DEmbed, mountIngestGame2DIframeReachable, mountIngestGame2DIframeReachableMulti, } from './ingest-iframe';
13
+ export { createPhysics2DRegistry, } from './physics-registry';
14
+ export { installSceneCapture2D, } from './scene-capture';
15
+ export { createPhysicsAdapter2D } from './system-adapters';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Pixi iframe ingest tiers — the PixiJS analogs of the 3D ingest-iframe adapters.
3
+ *
4
+ * - OPAQUE EMBED (tier 0-1): a prebuilt/self-contained bundle runs in a sandboxed
5
+ * iframe; hosted + sized + disposed, NOT introspectable.
6
+ * - IFRAME-REACHABLE (tier 2-3): a bundle runs in its own iframe realm, but its
7
+ * `import 'pixi.js'` is wired (via an importmap) to a blob module re-exporting the
8
+ * HOST's pixi instance, so every Application/Sprite it creates is a HOST-realm
9
+ * object → the host `Application.prototype.render` trap fires and capture works.
10
+ */
11
+ import { type CapturedRuntime2D, type SceneCapture2DHandle } from './scene-capture';
12
+ export interface EmbedMount2D {
13
+ iframe: HTMLIFrameElement;
14
+ dispose: () => void;
15
+ }
16
+ /** OPAQUE EMBED: sandboxed iframe, no scene introspection (tier 0-1). */
17
+ export declare function mountIngestGame2DEmbed(html: string, container: HTMLElement): EmbedMount2D;
18
+ export interface IframeReachableMultiOpts {
19
+ captureTimeoutMs?: number;
20
+ /**
21
+ * Bare-specifier → host module-namespace map. MUST include the pixi.js instance the trap is
22
+ * installed on (passed separately as `pixiNamespace`); list the game's OTHER shared bare deps
23
+ * here (@pixi/sound, @pixi/ui, gsap, pixi-filters) so they resolve to host instances and their
24
+ * extension side-effects register on the host pixi (the trapped instance).
25
+ */
26
+ extraDeps?: Record<string, Record<string, unknown>>;
27
+ /**
28
+ * Bare-specifier -> VERBATIM URL importmap entries (the
29
+ * project-node_modules fallback for a specifier that isn't in the
30
+ * host-namespace registry but IS installed in the open project's own
31
+ * `node_modules`). Written into the importmap DIRECTLY alongside the
32
+ * `extraDeps` blob-namespace entries — no host-side import, no blob
33
+ * wrapping, no decision logic here: this function just merges whatever
34
+ * `Record<specifier, url>` the caller (editor-side
35
+ * `host-namespace-registry.ts`) already decided. The URL's own transitive
36
+ * `import 'pixi.js'` resolves through this SAME importmap back to the host
37
+ * pixi trap (§0.3), keeping module identity converged without a second pixi
38
+ * instance.
39
+ */
40
+ extraDepUrls?: Record<string, string>;
41
+ /** <base href> for the iframe so the game's relative asset URLs (Assets basePath) resolve. */
42
+ baseHref?: string;
43
+ /**
44
+ * HOST-SIDE asset URL remap (the Pixi analog of the three.js DefaultLoadingManager.setURLModifier
45
+ * asset adapter). A document.write iframe keeps the PARENT's window.location, so PixiJS's Assets
46
+ * resolver (which builds absolute URLs from window.location, not document.baseURI) would resolve
47
+ * the game's relative `basePath:'assets'` against the parent page. Wrapping the host pixi's
48
+ * Assets.init to force this ABSOLUTE basePath fixes resolution without touching the game source —
49
+ * pure host library configuration, restored on dispose.
50
+ */
51
+ assetBaseUrl?: string;
52
+ /** Load the game bundle from this absolute URL (a built multi-file game). */
53
+ bundleUrl?: string;
54
+ /** …or run this inline module source (a single-file game). One of bundleUrl/inlineSrc required. */
55
+ inlineSrc?: string;
56
+ /** DOM the game expects to find before it boots (e.g. a `<div id="game-root">` it appends to). */
57
+ bodyHtml?: string;
58
+ }
59
+ /**
60
+ * IFRAME-REACHABLE for REAL MULTI-FILE GAMES (cov2d-bundled-dedupe): run a built game bundle
61
+ * (its OWN unaltered source, externalized against pixi at build time) in its own iframe realm
62
+ * whose importmap maps EVERY shared bare dep — pixi.js + @pixi/sound/@pixi/ui/gsap/… — to the
63
+ * HOST instances, and (optionally) a <base href> so its AssetPack/manifest URLs resolve. The
64
+ * host `Application.prototype.render` trap then captures the live stage IN-REALM. The game's
65
+ * source is never touched; all of this is host-side wiring.
66
+ */
67
+ export declare function mountIngestGame2DIframeReachableMulti(pixiNamespace: unknown, container: HTMLElement, opts: IframeReachableMultiOpts): Promise<IframeReachableMount2D>;
68
+ export interface IframeReachableMount2D {
69
+ iframe: HTMLIFrameElement;
70
+ capture: SceneCapture2DHandle;
71
+ captured: CapturedRuntime2D | null;
72
+ dispose: () => void;
73
+ }
74
+ /**
75
+ * IFRAME-REACHABLE (tier 2-3): run `gameModuleSrc` in an iframe whose importmap maps
76
+ * `pixi.js` to a host-pixi re-export blob, and trap the host `Application.prototype`
77
+ * so the bundle's render is captured in-realm.
78
+ */
79
+ export declare function mountIngestGame2DIframeReachable(pixiNamespace: unknown, gameModuleSrc: string, container: HTMLElement, opts?: {
80
+ captureTimeoutMs?: number;
81
+ }): Promise<IframeReachableMount2D>;
82
+ //# sourceMappingURL=ingest-iframe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest-iframe.d.ts","sourceRoot":"","sources":["../../src/pixi/ingest-iframe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,CASzF;AAsCD,MAAM,WAAW,wBAAwB;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,qCAAqC,CACzD,aAAa,EAAE,OAAO,EACtB,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CA2EjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CACpD,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,WAAW,EACtB,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GACvC,OAAO,CAAC,sBAAsB,CAAC,CAqCjC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Pixi iframe ingest tiers — the PixiJS analogs of the 3D ingest-iframe adapters.
3
+ *
4
+ * - OPAQUE EMBED (tier 0-1): a prebuilt/self-contained bundle runs in a sandboxed
5
+ * iframe; hosted + sized + disposed, NOT introspectable.
6
+ * - IFRAME-REACHABLE (tier 2-3): a bundle runs in its own iframe realm, but its
7
+ * `import 'pixi.js'` is wired (via an importmap) to a blob module re-exporting the
8
+ * HOST's pixi instance, so every Application/Sprite it creates is a HOST-realm
9
+ * object → the host `Application.prototype.render` trap fires and capture works.
10
+ */
11
+ import { installSceneCapture2D, } from './scene-capture';
12
+ /** OPAQUE EMBED: sandboxed iframe, no scene introspection (tier 0-1). */
13
+ export function mountIngestGame2DEmbed(html, container) {
14
+ const iframe = document.createElement('iframe');
15
+ iframe.setAttribute('sandbox', 'allow-scripts');
16
+ iframe.style.border = '0';
17
+ iframe.style.width = '100%';
18
+ iframe.style.height = '100%';
19
+ iframe.srcdoc = html;
20
+ container.appendChild(iframe);
21
+ return { iframe, dispose: () => iframe.remove() };
22
+ }
23
+ const HOST_PIXI_KEY = '__vgaiHostPixi';
24
+ /** Build a blob module that re-exports the host's pixi namespace (for the importmap). */
25
+ function makeHostPixiReexportUrl(pixiNamespace) {
26
+ window[HOST_PIXI_KEY] = pixiNamespace;
27
+ const ident = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
28
+ const keys = Object.keys(pixiNamespace).filter((k) => k !== 'default' && ident.test(k));
29
+ const body = `const T = window.parent[${JSON.stringify(HOST_PIXI_KEY)}];\n` +
30
+ `export default T;\n` +
31
+ keys.map((k) => `export const ${k} = T[${JSON.stringify(k)}];`).join('\n');
32
+ return URL.createObjectURL(new Blob([body], { type: 'text/javascript' }));
33
+ }
34
+ let _reexportKeySeq = 0;
35
+ /**
36
+ * Generalized host-namespace re-export (the multi-dep analog of {@link makeHostPixiReexportUrl}).
37
+ * Stashes `ns` (an ES module namespace object, e.g. `import * as ns from 'gsap'`) on a unique
38
+ * window key and builds a blob module re-exporting it, so the iframe's importmap can map a bare
39
+ * specifier (pixi.js, @pixi/sound, @pixi/ui, gsap, …) to the HOST's single instance. Default-export
40
+ * handling: `export default T.default ?? T` so `import gsap from 'gsap'` gets gsap, while a
41
+ * default-less namespace (pixi.js) re-exports the namespace itself for `import * as`.
42
+ */
43
+ function makeHostNamespaceReexportUrl(ns) {
44
+ const key = `__vgaiHostNs_${_reexportKeySeq++}`;
45
+ window[key] = ns;
46
+ const ident = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
47
+ const keys = Object.keys(ns).filter((k) => k !== 'default' && ident.test(k));
48
+ const body = `const T = window.parent[${JSON.stringify(key)}];\n` +
49
+ `export default (T && T.default !== undefined ? T.default : T);\n` +
50
+ keys.map((k) => `export const ${k} = T[${JSON.stringify(k)}];`).join('\n');
51
+ return URL.createObjectURL(new Blob([body], { type: 'text/javascript' }));
52
+ }
53
+ /**
54
+ * IFRAME-REACHABLE for REAL MULTI-FILE GAMES (cov2d-bundled-dedupe): run a built game bundle
55
+ * (its OWN unaltered source, externalized against pixi at build time) in its own iframe realm
56
+ * whose importmap maps EVERY shared bare dep — pixi.js + @pixi/sound/@pixi/ui/gsap/… — to the
57
+ * HOST instances, and (optionally) a <base href> so its AssetPack/manifest URLs resolve. The
58
+ * host `Application.prototype.render` trap then captures the live stage IN-REALM. The game's
59
+ * source is never touched; all of this is host-side wiring.
60
+ */
61
+ export async function mountIngestGame2DIframeReachableMulti(pixiNamespace, container, opts) {
62
+ const capture = installSceneCapture2D(pixiNamespace);
63
+ const created = [];
64
+ const mkUrl = (ns) => {
65
+ const u = makeHostNamespaceReexportUrl(ns);
66
+ created.push(u);
67
+ return u;
68
+ };
69
+ const imports = {
70
+ 'pixi.js': mkUrl(pixiNamespace),
71
+ };
72
+ for (const [spec, ns] of Object.entries(opts.extraDeps ?? {}))
73
+ imports[spec] = mkUrl(ns);
74
+ // D-Z3 fallback: verbatim URL entries, no blob wrapping, merged in beside
75
+ // the host-namespace ones — decision-free (see `extraDepUrls`'s doc comment).
76
+ for (const [spec, url] of Object.entries(opts.extraDepUrls ?? {}))
77
+ imports[spec] = url;
78
+ // Host-side asset URL remap (asset adapter): force the game's Assets.init basePath to an
79
+ // absolute URL so its assets resolve to the served bundle dir, not the parent page path.
80
+ let restoreInit;
81
+ if (opts.assetBaseUrl) {
82
+ const assetsApi = pixiNamespace.Assets;
83
+ if (assetsApi?.init) {
84
+ const orig = assetsApi.init.bind(assetsApi);
85
+ assetsApi.init = (o = {}) => orig({ ...o, basePath: opts.assetBaseUrl });
86
+ restoreInit = () => {
87
+ assetsApi.init = orig;
88
+ };
89
+ }
90
+ }
91
+ const iframe = document.createElement('iframe');
92
+ iframe.style.border = '0';
93
+ iframe.style.width = '100%';
94
+ iframe.style.height = '100%';
95
+ container.appendChild(iframe);
96
+ // Split the closing script token so this module's own bundling never sees a literal
97
+ // </script> (defensive; matches the single-dep mount's convention).
98
+ const close = `</${'scr'}ipt>`;
99
+ const baseTag = opts.baseHref ? `<base href="${opts.baseHref}">` : '';
100
+ const scriptTag = opts.bundleUrl
101
+ ? `<script type="module" src="${opts.bundleUrl}">${close}`
102
+ : `<script type="module">${opts.inlineSrc ?? ''}${close}`;
103
+ const importmapTag = `<script type="importmap">${JSON.stringify({ imports })}${close}`;
104
+ const bodyHtml = opts.bodyHtml ?? '';
105
+ const doc = iframe.contentDocument;
106
+ doc.open();
107
+ doc.write(`<!doctype html><html><head><meta charset="utf-8">${baseTag}${importmapTag}</head><body>${bodyHtml}${scriptTag}</body></html>`);
108
+ doc.close();
109
+ let captured = null;
110
+ try {
111
+ captured = await capture.waitForCapture(opts.captureTimeoutMs ?? 12_000);
112
+ }
113
+ catch {
114
+ captured = null;
115
+ }
116
+ return {
117
+ iframe,
118
+ capture,
119
+ captured,
120
+ dispose: () => {
121
+ capture.uninstall();
122
+ restoreInit?.();
123
+ for (const u of created)
124
+ URL.revokeObjectURL(u);
125
+ iframe.remove();
126
+ },
127
+ };
128
+ }
129
+ /**
130
+ * IFRAME-REACHABLE (tier 2-3): run `gameModuleSrc` in an iframe whose importmap maps
131
+ * `pixi.js` to a host-pixi re-export blob, and trap the host `Application.prototype`
132
+ * so the bundle's render is captured in-realm.
133
+ */
134
+ export async function mountIngestGame2DIframeReachable(pixiNamespace, gameModuleSrc, container, opts = {}) {
135
+ const capture = installSceneCapture2D(pixiNamespace);
136
+ const reexportUrl = makeHostPixiReexportUrl(pixiNamespace);
137
+ const iframe = document.createElement('iframe');
138
+ iframe.style.border = '0';
139
+ iframe.style.width = '100%';
140
+ iframe.style.height = '100%';
141
+ container.appendChild(iframe);
142
+ const doc = iframe.contentDocument;
143
+ doc.open();
144
+ doc.write(`<!doctype html><html><head><meta charset="utf-8">` +
145
+ `<script type="importmap">${JSON.stringify({ imports: { 'pixi.js': reexportUrl } })}</scr` +
146
+ `ipt></head><body><script type="module">${gameModuleSrc}</scr` +
147
+ `ipt></body></html>`);
148
+ doc.close();
149
+ let captured = null;
150
+ try {
151
+ captured = await capture.waitForCapture(opts.captureTimeoutMs ?? 8000);
152
+ }
153
+ catch {
154
+ captured = null;
155
+ }
156
+ return {
157
+ iframe,
158
+ capture,
159
+ captured,
160
+ dispose: () => {
161
+ capture.uninstall();
162
+ URL.revokeObjectURL(reexportUrl);
163
+ iframe.remove();
164
+ },
165
+ };
166
+ }
@@ -0,0 +1,97 @@
1
+ import { type SceneCapture2DHandle } from './scene-capture';
2
+ /**
3
+ * A manifest's `extraDeps` resolve to TWO kinds of importmap entry:
4
+ * `namespaces` are today's registry-known bare specifiers
5
+ * (host-namespace-registry.ts), re-exported via a blob module
6
+ * (`ingest-iframe-2d.ts`'s `makeHostNamespaceReexportUrl`); `urls` are the
7
+ * D-Z3 fallback — a specifier that isn't registered but IS present in the
8
+ * open project's own `node_modules`, mapped DIRECTLY to its
9
+ * `/project-game-static/node_modules/<spec>/<esm entry>` URL (no host-side
10
+ * import, no blob — the dep executes in the iframe realm and its own
11
+ * transitive `import 'pixi.js'` resolves through the same importmap back to
12
+ * the host pixi trap). All probing/decision logic (which kind a specifier
13
+ * resolves to, exports-map parsing, anti-shim throws) lives editor-side
14
+ * (`host-namespace-registry.ts`) — this engine module only carries the
15
+ * ALREADY-DECIDED shape; `ingest-iframe-2d.ts` stays decision-free and just
16
+ * merges both maps into the iframe importmap.
17
+ */
18
+ export interface ExtraDepsResolution2D {
19
+ namespaces: Record<string, Record<string, unknown>>;
20
+ urls: Record<string, string>;
21
+ }
22
+ /** A registered unmodified PixiJS game (the Pixi analog of `IngestGame`). */
23
+ export interface IngestGame2D {
24
+ id: string;
25
+ name: string;
26
+ description: string;
27
+ /** Shared-pixi path: import + run the unmodified game module. */
28
+ load?: () => Promise<unknown>;
29
+ /** Tier ceiling: how reachable the game's pixi instance is. */
30
+ tier?: 'shared' | 'iframe-reachable' | 'opaque-embed';
31
+ captureTimeoutMs?: number;
32
+ /**
33
+ * IFRAME-REACHABLE-MULTI fields (Track P): an externalized built bundle
34
+ * mounted via `mountIngestGame2DIframeReachableMulti`
35
+ * (`./ingest-iframe-2d.ts`) instead of `load()` — populated only when `tier`
36
+ * is `'iframe-reachable'` AND `load` is absent. Mirror
37
+ * `IframeReachableMultiOpts`'s fields, EXCEPT `extraDeps`/`pixiNamespace` are
38
+ * THUNKS here, not resolved values — the same "lazy, only invoked at mount
39
+ * time" shape `load` already uses, so building this descriptor
40
+ * (`resolveIngest2DDescriptor` / the canvas surface's
41
+ * `ingest/surface-canvas.ts`, editor-side — Wave 0.6 replaced the three
42
+ * per-surface `discovery*.ts` modules with one manifest-driven registry) never
43
+ * has to be async just to wire up which specifiers/ version-skew URL a game
44
+ * needs; only actually MOUNTING it (the ingest-mode mount bridge) pays for the
45
+ * dynamic import of `@pixi/sound`/`gsap`/spine/ a standalone pixi build.
46
+ */
47
+ bundleUrl?: string;
48
+ /** <base href> for the iframe (see `IframeReachableMultiOpts.baseHref`). */
49
+ baseHref?: string;
50
+ /** Host-side Assets.init basePath remap (see `IframeReachableMultiOpts.assetBaseUrl`). */
51
+ assetBaseUrl?: string;
52
+ /**
53
+ * Lazily resolve this game's bare-specifier -> extraDeps resolution via the
54
+ * editor's host-namespace registry. Absent (or omitted) means no extra deps
55
+ * beyond pixi.js.
56
+ */
57
+ extraDeps?: () => Promise<ExtraDepsResolution2D>;
58
+ /**
59
+ * Lazily resolve the trapped-pixi namespace for version-skewed games (a
60
+ * dynamic `import()` of the manifest's `pixiModuleUrl`) — absent means
61
+ * "mount against the host's own `pixi.js`" (no skew).
62
+ */
63
+ pixiNamespace?: () => Promise<unknown>;
64
+ /** DOM the game expects before boot (see `IframeReachableMultiOpts.bodyHtml`). */
65
+ bodyHtml?: string;
66
+ /**
67
+ * Lazily read an OPAQUE prebuilt bundle's self-contained HTML (D-W2) — the pixi
68
+ * twin of `IngestGame.embedHtml`. Always a lazy thunk here (no in-tree Pixi
69
+ * opaque-embed fixture exists yet to need a plain-string form, unlike the three
70
+ * side): `resolveIngest2DDescriptor` (adapter-resolver.ts) builds one that reads
71
+ * the declared `entryHtml` file's bytes through the `/project-game-static/`
72
+ * route, only when the game is actually mounted. The host runs the resolved HTML
73
+ * in a sandboxed iframe at the embed-only floor (Tier 0-1),
74
+ * `mountIngestGame2DEmbed` (`./ingest-iframe-2d.ts`).
75
+ */
76
+ embedHtml?: () => Promise<string>;
77
+ }
78
+ export interface IngestMount2D {
79
+ /** The captured live stage Container (null if capture failed/degraded). */
80
+ stage: unknown | null;
81
+ capture: SceneCapture2DHandle;
82
+ embedOnly: boolean;
83
+ setPaused(paused: boolean): void;
84
+ dispose(): void;
85
+ }
86
+ /**
87
+ * Mount an UNMODIFIED PixiJS game via the shared-instance capture path — the 2D
88
+ * analog of `mountIngestGame`. Installs the render trap on the host's pixi
89
+ * instance, runs the game's `load()`, waits for the game to render its first
90
+ * frame (capturing its live stage), and exposes loop gating + cleanup. If capture
91
+ * times out (pixi unreachable / bundled / mismatched), degrades to embed-only —
92
+ * never a silent failure.
93
+ */
94
+ export declare function mountIngestGame2D(pixiNamespace: unknown, game: IngestGame2D, opts?: {
95
+ captureTimeoutMs?: number;
96
+ }): Promise<IngestMount2D>;
97
+ //# sourceMappingURL=ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/pixi/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEnF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,+DAA+D;IAC/D,IAAI,CAAC,EAAE,QAAQ,GAAG,kBAAkB,GAAG,cAAc,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACjD;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GACvC,OAAO,CAAC,aAAa,CAAC,CA6BxB"}
@@ -0,0 +1,40 @@
1
+ import { installSceneCapture2D } from './scene-capture';
2
+ /**
3
+ * Mount an UNMODIFIED PixiJS game via the shared-instance capture path — the 2D
4
+ * analog of `mountIngestGame`. Installs the render trap on the host's pixi
5
+ * instance, runs the game's `load()`, waits for the game to render its first
6
+ * frame (capturing its live stage), and exposes loop gating + cleanup. If capture
7
+ * times out (pixi unreachable / bundled / mismatched), degrades to embed-only —
8
+ * never a silent failure.
9
+ */
10
+ export async function mountIngestGame2D(pixiNamespace, game, opts = {}) {
11
+ const capture = installSceneCapture2D(pixiNamespace);
12
+ try {
13
+ await game.load?.();
14
+ }
15
+ catch (err) {
16
+ capture.uninstall();
17
+ throw new Error(`pixi ingest: game "${game.id}" failed to load: ${err}`);
18
+ }
19
+ const timeout = opts.captureTimeoutMs ?? game.captureTimeoutMs ?? 8000;
20
+ try {
21
+ const rt = await capture.waitForCapture(timeout);
22
+ return {
23
+ stage: rt.stage,
24
+ capture,
25
+ embedOnly: false,
26
+ setPaused: (p) => capture.setPaused(p),
27
+ dispose: () => capture.uninstall(),
28
+ };
29
+ }
30
+ catch {
31
+ // Capture failed → pixi unreachable/mismatched → degrade to embed-only.
32
+ return {
33
+ stage: null,
34
+ capture,
35
+ embedOnly: true,
36
+ setPaused: () => { },
37
+ dispose: () => capture.uninstall(),
38
+ };
39
+ }
40
+ }
@@ -0,0 +1,24 @@
1
+ import type RAPIER from '@dimforge/rapier2d-compat';
2
+ import type { Container } from 'pixi.js';
3
+ /** The Rapier 2D handles owned by a single display-object entity. */
4
+ export interface Physics2DRefs {
5
+ body: RAPIER.RigidBody;
6
+ collider: RAPIER.Collider;
7
+ }
8
+ /**
9
+ * Maps PixiJS display objects to their Rapier 2D bodies/colliders and back —
10
+ * the Pixi analog of `PhysicsRegistry`. Two indexes:
11
+ * - `Container → {body, collider}` for the postPhysics transform writer.
12
+ * - `colliderHandle → Container` reverse index for collision/trigger dispatch.
13
+ */
14
+ export declare function createPhysics2DRegistry(): {
15
+ add(display: Container, body: RAPIER.RigidBody, collider: RAPIER.Collider): void;
16
+ get(display: Container): Physics2DRefs | undefined;
17
+ getByColliderHandle(handle: number): Container | undefined;
18
+ remove(display: Container): void;
19
+ entries(): IterableIterator<[Container, Physics2DRefs]>;
20
+ readonly size: number;
21
+ clear(): void;
22
+ };
23
+ export type Physics2DRegistry = ReturnType<typeof createPhysics2DRegistry>;
24
+ //# sourceMappingURL=physics-registry.d.ts.map