@fps-games/editor 0.2.1-beta.1 → 0.2.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -1
  2. package/dist/agent-bridge/capabilities/ui-regions.js +16 -0
  3. package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -1
  4. package/dist/build-info.json +43 -43
  5. package/dist/internal/material-preview.d.ts +22 -0
  6. package/dist/internal/material-preview.d.ts.map +1 -0
  7. package/dist/internal/material-preview.js +186 -0
  8. package/dist/internal/material-preview.js.map +1 -0
  9. package/dist/internal/project-model-preview.d.ts +4 -0
  10. package/dist/internal/project-model-preview.d.ts.map +1 -0
  11. package/dist/internal/project-model-preview.js +359 -0
  12. package/dist/internal/project-model-preview.js.map +1 -0
  13. package/dist/local-editor-agent-context.d.ts +12 -1
  14. package/dist/local-editor-agent-context.d.ts.map +1 -1
  15. package/dist/local-editor-agent-context.js +47 -0
  16. package/dist/local-editor-agent-context.js.map +1 -1
  17. package/dist/local-editor-harness.d.ts +15 -2
  18. package/dist/local-editor-harness.d.ts.map +1 -1
  19. package/dist/local-editor-harness.js +310 -21
  20. package/dist/local-editor-harness.js.map +1 -1
  21. package/dist/local-editor-tools.d.ts +1 -0
  22. package/dist/local-editor-tools.d.ts.map +1 -1
  23. package/dist/local-editor-tools.js +3 -0
  24. package/dist/local-editor-tools.js.map +1 -1
  25. package/dist/playable-local-editor-host.d.ts +4 -0
  26. package/dist/playable-local-editor-host.d.ts.map +1 -1
  27. package/dist/playable-local-editor-host.js +27 -0
  28. package/dist/playable-local-editor-host.js.map +1 -1
  29. package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
  30. package/dist/playable-product-scene-capabilities.js +9 -3
  31. package/dist/playable-product-scene-capabilities.js.map +1 -1
  32. package/dist/playable-standard-project.d.ts.map +1 -1
  33. package/dist/playable-standard-project.js +5 -2
  34. package/dist/playable-standard-project.js.map +1 -1
  35. package/node_modules/@fps-games/babylon-renderer/package.json +7 -7
  36. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js +24 -0
  37. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js.map +1 -1
  38. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +10 -1
  39. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
  40. package/node_modules/@fps-games/editor-babylon/dist/projection.js +96 -1
  41. package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
  42. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.d.ts.map +1 -1
  43. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js +85 -22
  44. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js.map +1 -1
  45. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts +2 -0
  46. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
  47. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +150 -4
  48. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
  49. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +1 -0
  50. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
  51. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +249 -15
  52. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
  53. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +1 -1
  54. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -1
  55. package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -1
  56. package/node_modules/@fps-games/editor-babylon/package.json +6 -6
  57. package/node_modules/@fps-games/editor-browser/dist/index.d.ts +5 -0
  58. package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
  59. package/node_modules/@fps-games/editor-browser/dist/index.js +3 -0
  60. package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
  61. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts +35 -0
  62. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts.map +1 -0
  63. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js +136 -0
  64. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js.map +1 -0
  65. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts +46 -0
  66. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts.map +1 -0
  67. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js +283 -0
  68. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js.map +1 -0
  69. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts +12 -0
  70. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts.map +1 -0
  71. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js +67 -0
  72. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js.map +1 -0
  73. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts +6 -0
  74. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts.map +1 -0
  75. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js +9 -0
  76. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js.map +1 -0
  77. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts +7 -0
  78. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts.map +1 -0
  79. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js +20 -0
  80. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js.map +1 -0
  81. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts +9 -0
  82. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts.map +1 -0
  83. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js +219 -0
  84. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js.map +1 -0
  85. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts +14 -0
  86. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts.map +1 -0
  87. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js +42 -0
  88. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js.map +1 -0
  89. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts.map +1 -1
  90. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js +2 -0
  91. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js.map +1 -1
  92. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts +27 -0
  93. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts.map +1 -0
  94. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js +288 -0
  95. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js.map +1 -0
  96. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts +1 -1
  97. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
  98. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +29 -0
  99. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -1
  100. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +20 -1
  101. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
  102. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +321 -60
  103. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
  104. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts +2 -1
  105. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
  106. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +4 -2
  107. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -1
  108. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +63 -3
  109. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
  110. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
  111. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +9 -0
  112. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
  113. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +88 -16
  114. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
  115. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +2 -1
  116. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
  117. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +1463 -356
  118. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
  119. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts +13 -0
  120. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts.map +1 -0
  121. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js +15 -0
  122. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js.map +1 -0
  123. package/node_modules/@fps-games/editor-browser/package.json +7 -7
  124. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts +1 -0
  125. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts.map +1 -1
  126. package/node_modules/@fps-games/editor-core/dist/editor-tools.js +3 -1
  127. package/node_modules/@fps-games/editor-core/dist/editor-tools.js.map +1 -1
  128. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +11 -2
  129. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
  130. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js +12 -1
  131. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
  132. package/node_modules/@fps-games/editor-core/package.json +6 -6
  133. package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
  134. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts +1 -0
  135. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts.map +1 -1
  136. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js +5 -0
  137. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js.map +1 -1
  138. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts +1 -1
  139. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts.map +1 -1
  140. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js +1 -1
  141. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js.map +1 -1
  142. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.d.ts.map +1 -1
  143. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js +15 -1
  144. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js.map +1 -1
  145. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.d.ts.map +1 -1
  146. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js +3 -0
  147. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js.map +1 -1
  148. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts +6 -1
  149. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts.map +1 -1
  150. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.js.map +1 -1
  151. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +1 -0
  152. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
  153. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +1 -0
  154. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
  155. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts +4 -0
  156. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts.map +1 -1
  157. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js +10 -1
  158. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js.map +1 -1
  159. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts +4 -0
  160. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts.map +1 -0
  161. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js +4 -0
  162. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js.map +1 -0
  163. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts +4 -0
  164. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts.map +1 -0
  165. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js +86 -0
  166. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js.map +1 -0
  167. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts +9 -0
  168. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts.map +1 -0
  169. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js +76 -0
  170. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js.map +1 -0
  171. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts +34 -0
  172. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts.map +1 -0
  173. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js +2 -0
  174. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js.map +1 -0
  175. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts +4 -0
  176. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
  177. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +40 -0
  178. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
  179. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +1 -0
  180. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
  181. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +1 -0
  182. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
  183. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts +1 -0
  184. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
  185. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +94 -0
  186. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
  187. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts +14 -0
  188. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts.map +1 -0
  189. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js +101 -0
  190. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js.map +1 -0
  191. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts +23 -0
  192. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts.map +1 -0
  193. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js +180 -0
  194. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js.map +1 -0
  195. package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
  196. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +23 -3
  197. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +1 -1
  198. package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +1 -1
  199. package/node_modules/@fps-games/editor-protocol/package.json +2 -2
  200. package/node_modules/@fps-games/editor-tooling/package.json +3 -3
  201. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.d.ts.map +1 -1
  202. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js +103 -10
  203. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js.map +1 -1
  204. package/node_modules/@fps-games/editor-ui/package.json +1 -1
  205. package/node_modules/@fps-games/playable-assets/package.json +1 -1
  206. package/node_modules/@fps-games/playable-contracts/package.json +1 -1
  207. package/node_modules/@fps-games/playable-rendering/package.json +2 -2
  208. package/node_modules/@fps-games/playable-runtime/package.json +12 -12
  209. package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
  210. package/node_modules/@fps-games/playable-scene/package.json +2 -2
  211. package/node_modules/@fps-games/plugin-api/package.json +1 -1
  212. package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
  213. package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
  214. package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
  215. package/node_modules/@fps-games/plugin-assets/package.json +5 -5
  216. package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
  217. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
  218. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
  219. package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
  220. package/node_modules/@fps-games/plugin-host/package.json +2 -2
  221. package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
  222. package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
  223. package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
  224. package/node_modules/@fps-games/plugin-markers/package.json +5 -5
  225. package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
  226. package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
  227. package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
  228. package/node_modules/@fps-games/plugin-materials/package.json +5 -5
  229. package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
  230. package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
  231. package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
  232. package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
  233. package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
  234. package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
  235. package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
  236. package/node_modules/@fps-games/plugin-scene/package.json +5 -5
  237. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
  238. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
  239. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
  240. package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
  241. package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
  242. package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
  243. package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
  244. package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
  245. package/package.json +22 -22
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/asset-library/catalog.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,6BAA6B,CAK3C,cAA4F;IAE5F,OAAO,cAAc;SAClB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,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AAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAK,KAAgB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CAAI,KAAoB;IAC5C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,sCAAsC,CAAC,IAA0C;IACxF,OAAO,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,CAAC;AACrE,CAAC","sourcesContent":["import type {\n EditorSceneAssetLibraryItem,\n} from '../document/index';\nimport type {\n EditorSceneAssetCatalogEntry,\n} from './types';\n\nexport function createEditorSceneAssetLibrary<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n catalogEntries: readonly EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>[],\n): Array<EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode>> {\n return catalogEntries\n .filter((entry) => isEditorScenePlaceableAssetCatalogKind(entry.kind) && entry.placeable !== false)\n .map(createEditorSceneAssetLibraryItem)\n .sort(compareEditorSceneAssetLibraryItems);\n}\n\nexport function createEditorSceneAssetHydrationCatalog<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n catalogEntries: readonly EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>[],\n): Array<EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode>> {\n return catalogEntries\n .filter((entry) => entry.kind === 'model')\n .map(createEditorSceneAssetLibraryItem)\n .sort(compareEditorSceneAssetLibraryItems);\n}\n\nexport function createEditorSceneAssetLibraryItem<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n entry: EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>,\n): EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode> {\n const type = entry.kind === 'texture'\n ? 'texture'\n : entry.kind === 'prefab'\n ? 'prefab'\n : 'glb';\n const guid = readNonEmptyString(entry.guid);\n const metadata = createEditorSceneAssetCatalogMetadata(entry);\n return {\n id: entry.assetId,\n ...(guid ? { guid } : {}),\n assetId: entry.assetId,\n type,\n kind: entry.kind === 'texture'\n ? 'texture'\n : entry.kind === 'prefab'\n ? 'prefab'\n : 'model',\n displayName: entry.displayName,\n category: entry.category ?? inferEditorSceneAssetCategory(entry),\n warmupCount: entry.warmupCount,\n singleton: entry.singleton,\n materialMode: entry.materialMode,\n defaults: cloneOptional(entry.defaults),\n prefab: cloneOptional(entry.prefab),\n external: cloneOptional(entry.external),\n metadata,\n origin: entry.origin ?? 'project',\n dedupeKey: entry.dedupeKey ?? guid ?? readExternalPlatformAssetId(entry.external) ?? entry.assetId,\n placeable: entry.placeable !== false,\n };\n}\n\nexport function compareEditorSceneAssetLibraryItems(\n a: EditorSceneAssetLibraryItem,\n b: EditorSceneAssetLibraryItem,\n): number {\n return (a.category ?? '').localeCompare(b.category ?? '')\n || a.displayName.localeCompare(b.displayName)\n || a.assetId.localeCompare(b.assetId)\n || a.type.localeCompare(b.type);\n}\n\nfunction inferEditorSceneAssetCategory(entry: EditorSceneAssetCatalogEntry): string {\n if (entry.kind === 'prefab') return 'Prefab';\n if (entry.kind === 'texture') return 'Texture';\n if (entry.kind === 'image') return 'Image';\n if (entry.kind === 'sound') return 'Sound';\n return 'Model';\n}\n\nfunction createEditorSceneAssetCatalogMetadata(\n entry: EditorSceneAssetCatalogEntry,\n): Record<string, unknown> {\n return normalizeEditorSceneAssetCatalogMetadata({\n originalFileName: entry.originalFileName,\n relativePath: entry.relativePath,\n codeKey: entry.codeKey,\n contentHash: entry.contentHash,\n byteSize: entry.byteSize,\n ...cloneOptional(entry.metadata),\n });\n}\n\nfunction normalizeEditorSceneAssetCatalogMetadata(\n metadata: Record<string, unknown>,\n): Record<string, unknown> {\n if (!Array.isArray(metadata.materialSlots)) return metadata;\n const analysis = readRecord(metadata.assetAnalysis);\n const meshes = Array.isArray(analysis?.meshes) ? analysis.meshes : [];\n const nodes = Array.isArray(analysis?.nodes) ? analysis.nodes : [];\n const meshNames = new Map(meshes.flatMap((mesh) => {\n const record = readRecord(mesh);\n const meshIndex = readNonNegativeInteger(record?.meshIndex);\n const name = readNonEmptyString(record?.name);\n return meshIndex == null || !name ? [] : [[meshIndex, name] as const];\n }));\n const nodeMeshNames = new Map(nodes.flatMap((node) => {\n const record = readRecord(node);\n const nodeIndex = readNonNegativeInteger(record?.nodeIndex);\n const name = readNonEmptyString(record?.meshName);\n return nodeIndex == null || !name ? [] : [[nodeIndex, name] as const];\n }));\n const analysisTruncated = isAnalysisCollectionTruncated(analysis, 'meshCount', meshes.length)\n || isAnalysisCollectionTruncated(analysis, 'nodeCount', nodes.length);\n const materialSlots = metadata.materialSlots.map((slot) => {\n const record = readRecord(slot);\n if (!record || readNonEmptyString(record.sourceMeshName)) return slot;\n const meshIndex = readNonNegativeInteger(record.meshIndex);\n if (meshIndex == null) return slot;\n const nodeIndex = readNonNegativeInteger(record.nodeIndex);\n const sourceMeshName = meshNames.get(meshIndex)\n ?? (nodeIndex == null ? undefined : nodeMeshNames.get(nodeIndex))\n ?? (analysisTruncated ? inferLegacyMaterialSlotMeshName(record) : undefined);\n return sourceMeshName ? { ...record, sourceMeshName } : slot;\n });\n return { ...metadata, materialSlots };\n}\n\nfunction inferLegacyMaterialSlotMeshName(slot: Record<string, unknown>): string | undefined {\n const label = readNonEmptyString(slot.label);\n if (label) {\n const baseLabel = label.replace(/\\s+\\/\\s+Primitive\\s+\\d+$/, '').trim();\n if (baseLabel) return baseLabel;\n }\n return readNonEmptyString(slot.ownerNodePath)?.split('/').filter(Boolean).pop();\n}\n\nfunction isAnalysisCollectionTruncated(\n analysis: Record<string, unknown> | undefined,\n countField: 'meshCount' | 'nodeCount',\n returnedCount: number,\n): boolean {\n const totalCount = readNonNegativeInteger(analysis?.[countField]);\n return totalCount != null && totalCount > returnedCount;\n}\n\nfunction readExternalPlatformAssetId(value: unknown): string | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n return readNonEmptyString((value as Record<string, unknown>).platformAssetId);\n}\n\nfunction readNonEmptyString(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n\nfunction readNonNegativeInteger(value: unknown): number | null {\n return Number.isInteger(value) && (value as number) >= 0 ? value as number : null;\n}\n\nfunction readRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? value as Record<string, unknown>\n : undefined;\n}\n\nfunction cloneOptional<T>(value: T | undefined): T | undefined {\n return value == null ? undefined : structuredClone(value);\n}\n\nfunction isEditorScenePlaceableAssetCatalogKind(kind: EditorSceneAssetCatalogEntry['kind']): boolean {\n return kind === 'model' || kind === 'prefab' || kind === 'texture';\n}\n"]}
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/asset-library/catalog.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,6BAA6B,CAK3C,cAA4F;IAE5F,OAAO,cAAc;SAClB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sCAAsC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC;SACl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,CAAC,eAAe,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAK,KAAgB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,aAAa,CAAI,KAAoB;IAC5C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,sCAAsC,CAAC,IAA0C;IACxF,OAAO,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,CAAC;AACrE,CAAC","sourcesContent":["import type {\n EditorSceneAssetLibraryItem,\n} from '../document/index';\nimport type {\n EditorSceneAssetCatalogEntry,\n} from './types';\n\nexport function createEditorSceneAssetLibrary<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n catalogEntries: readonly EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>[],\n): Array<EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode>> {\n return catalogEntries\n .filter((entry) => isEditorScenePlaceableAssetCatalogKind(entry.kind) && entry.placeable !== false)\n .map(createEditorSceneAssetLibraryItem)\n .sort(compareEditorSceneAssetLibraryItems);\n}\n\nexport function createEditorSceneAssetHydrationCatalog<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n catalogEntries: readonly EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>[],\n): Array<EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode>> {\n return catalogEntries\n .filter((entry) => entry.kind === 'model')\n .map(createEditorSceneAssetLibraryItem)\n .sort(compareEditorSceneAssetLibraryItems);\n}\n\nexport function createEditorSceneAssetLibraryItem<\n TExternal = unknown,\n TDefaults = unknown,\n TMaterialMode extends string = string,\n>(\n entry: EditorSceneAssetCatalogEntry<TExternal, TDefaults, TMaterialMode>,\n): EditorSceneAssetLibraryItem<TDefaults, TExternal, TMaterialMode> {\n const type = entry.kind === 'texture'\n ? 'texture'\n : entry.kind === 'prefab'\n ? 'prefab'\n : 'glb';\n const guid = readNonEmptyString(entry.guid);\n const metadata = createEditorSceneAssetCatalogMetadata(entry);\n return {\n id: entry.assetId,\n ...(guid ? { guid } : {}),\n assetId: entry.assetId,\n type,\n kind: entry.kind === 'texture'\n ? 'texture'\n : entry.kind === 'prefab'\n ? 'prefab'\n : 'model',\n displayName: entry.displayName,\n category: entry.category ?? inferEditorSceneAssetCategory(entry),\n warmupCount: entry.warmupCount,\n singleton: entry.singleton,\n materialMode: entry.materialMode,\n defaults: cloneOptional(entry.defaults),\n prefab: cloneOptional(entry.prefab),\n external: cloneOptional(entry.external),\n metadata,\n origin: entry.origin ?? 'project',\n dedupeKey: entry.dedupeKey ?? guid ?? readExternalPlatformAssetId(entry.external) ?? entry.assetId,\n placeable: entry.placeable !== false,\n };\n}\n\nexport function compareEditorSceneAssetLibraryItems(\n a: EditorSceneAssetLibraryItem,\n b: EditorSceneAssetLibraryItem,\n): number {\n return (a.category ?? '').localeCompare(b.category ?? '')\n || a.displayName.localeCompare(b.displayName)\n || a.assetId.localeCompare(b.assetId)\n || a.type.localeCompare(b.type);\n}\n\nexport function resolveEditorSceneAssetLibraryItemRelativePath(\n asset: EditorSceneAssetLibraryItem,\n): string | undefined {\n return readNonEmptyString(asset.relativePath)\n ?? readNonEmptyString(asset.metadata?.relativePath)\n ?? undefined;\n}\n\nfunction inferEditorSceneAssetCategory(entry: EditorSceneAssetCatalogEntry): string {\n if (entry.kind === 'prefab') return 'Prefab';\n if (entry.kind === 'texture') return 'Texture';\n if (entry.kind === 'image') return 'Image';\n if (entry.kind === 'sound') return 'Sound';\n return 'Model';\n}\n\nfunction createEditorSceneAssetCatalogMetadata(\n entry: EditorSceneAssetCatalogEntry,\n): Record<string, unknown> {\n return normalizeEditorSceneAssetCatalogMetadata({\n originalFileName: entry.originalFileName,\n relativePath: entry.relativePath,\n codeKey: entry.codeKey,\n contentHash: entry.contentHash,\n byteSize: entry.byteSize,\n ...cloneOptional(entry.metadata),\n });\n}\n\nfunction normalizeEditorSceneAssetCatalogMetadata(\n metadata: Record<string, unknown>,\n): Record<string, unknown> {\n if (!Array.isArray(metadata.materialSlots)) return metadata;\n const analysis = readRecord(metadata.assetAnalysis);\n const meshes = Array.isArray(analysis?.meshes) ? analysis.meshes : [];\n const nodes = Array.isArray(analysis?.nodes) ? analysis.nodes : [];\n const meshNames = new Map(meshes.flatMap((mesh) => {\n const record = readRecord(mesh);\n const meshIndex = readNonNegativeInteger(record?.meshIndex);\n const name = readNonEmptyString(record?.name);\n return meshIndex == null || !name ? [] : [[meshIndex, name] as const];\n }));\n const nodeMeshNames = new Map(nodes.flatMap((node) => {\n const record = readRecord(node);\n const nodeIndex = readNonNegativeInteger(record?.nodeIndex);\n const name = readNonEmptyString(record?.meshName);\n return nodeIndex == null || !name ? [] : [[nodeIndex, name] as const];\n }));\n const analysisTruncated = isAnalysisCollectionTruncated(analysis, 'meshCount', meshes.length)\n || isAnalysisCollectionTruncated(analysis, 'nodeCount', nodes.length);\n const materialSlots = metadata.materialSlots.map((slot) => {\n const record = readRecord(slot);\n if (!record || readNonEmptyString(record.sourceMeshName)) return slot;\n const meshIndex = readNonNegativeInteger(record.meshIndex);\n if (meshIndex == null) return slot;\n const nodeIndex = readNonNegativeInteger(record.nodeIndex);\n const sourceMeshName = meshNames.get(meshIndex)\n ?? (nodeIndex == null ? undefined : nodeMeshNames.get(nodeIndex))\n ?? (analysisTruncated ? inferLegacyMaterialSlotMeshName(record) : undefined);\n return sourceMeshName ? { ...record, sourceMeshName } : slot;\n });\n return { ...metadata, materialSlots };\n}\n\nfunction inferLegacyMaterialSlotMeshName(slot: Record<string, unknown>): string | undefined {\n const label = readNonEmptyString(slot.label);\n if (label) {\n const baseLabel = label.replace(/\\s+\\/\\s+Primitive\\s+\\d+$/, '').trim();\n if (baseLabel) return baseLabel;\n }\n return readNonEmptyString(slot.ownerNodePath)?.split('/').filter(Boolean).pop();\n}\n\nfunction isAnalysisCollectionTruncated(\n analysis: Record<string, unknown> | undefined,\n countField: 'meshCount' | 'nodeCount',\n returnedCount: number,\n): boolean {\n const totalCount = readNonNegativeInteger(analysis?.[countField]);\n return totalCount != null && totalCount > returnedCount;\n}\n\nfunction readExternalPlatformAssetId(value: unknown): string | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n return readNonEmptyString((value as Record<string, unknown>).platformAssetId);\n}\n\nfunction readNonEmptyString(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n\nfunction readNonNegativeInteger(value: unknown): number | null {\n return Number.isInteger(value) && (value as number) >= 0 ? value as number : null;\n}\n\nfunction readRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? value as Record<string, unknown>\n : undefined;\n}\n\nfunction cloneOptional<T>(value: T | undefined): T | undefined {\n return value == null ? undefined : structuredClone(value);\n}\n\nfunction isEditorScenePlaceableAssetCatalogKind(kind: EditorSceneAssetCatalogEntry['kind']): boolean {\n return kind === 'model' || kind === 'prefab' || kind === 'texture';\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export type { DehydratedEditorSceneAsset, DehydratedEditorSceneDocument, EditorScenePersistedModelAssetReference, } from './document';
2
2
  export type { EditorSceneAssetCatalogEntry, EditorSceneAssetCatalogKind, } from './types';
3
- export { compareEditorSceneAssetLibraryItems, createEditorSceneAssetLibrary, createEditorSceneAssetHydrationCatalog, createEditorSceneAssetLibraryItem, } from './catalog';
3
+ export { compareEditorSceneAssetLibraryItems, createEditorSceneAssetLibrary, createEditorSceneAssetHydrationCatalog, createEditorSceneAssetLibraryItem, resolveEditorSceneAssetLibraryItemRelativePath, } from './catalog';
4
4
  export { assertEditorSceneDocumentAssetCatalogCompleteness, dehydrateEditorSceneDocumentAssets, enrichEditorSceneDocumentAssets, mergeEditorSceneAssetWithLibraryItem, } from './document';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asset-library/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,EAC7B,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asset-library/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,EAC7B,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,EACjC,8CAA8C,GAC/C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,YAAY,CAAC"}
@@ -1,3 +1,3 @@
1
- export { compareEditorSceneAssetLibraryItems, createEditorSceneAssetLibrary, createEditorSceneAssetHydrationCatalog, createEditorSceneAssetLibraryItem, } from './catalog.js';
1
+ export { compareEditorSceneAssetLibraryItems, createEditorSceneAssetLibrary, createEditorSceneAssetHydrationCatalog, createEditorSceneAssetLibraryItem, resolveEditorSceneAssetLibraryItemRelativePath, } from './catalog.js';
2
2
  export { assertEditorSceneDocumentAssetCatalogCompleteness, dehydrateEditorSceneDocumentAssets, enrichEditorSceneDocumentAssets, mergeEditorSceneAssetWithLibraryItem, } from './document.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/asset-library/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,YAAY,CAAC","sourcesContent":["export type {\n DehydratedEditorSceneAsset,\n DehydratedEditorSceneDocument,\n EditorScenePersistedModelAssetReference,\n} from './document';\nexport type {\n EditorSceneAssetCatalogEntry,\n EditorSceneAssetCatalogKind,\n} from './types';\nexport {\n compareEditorSceneAssetLibraryItems,\n createEditorSceneAssetLibrary,\n createEditorSceneAssetHydrationCatalog,\n createEditorSceneAssetLibraryItem,\n} from './catalog';\nexport {\n assertEditorSceneDocumentAssetCatalogCompleteness,\n dehydrateEditorSceneDocumentAssets,\n enrichEditorSceneDocumentAssets,\n mergeEditorSceneAssetWithLibraryItem,\n} from './document';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/asset-library/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,EACjC,8CAA8C,GAC/C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,YAAY,CAAC","sourcesContent":["export type {\n DehydratedEditorSceneAsset,\n DehydratedEditorSceneDocument,\n EditorScenePersistedModelAssetReference,\n} from './document';\nexport type {\n EditorSceneAssetCatalogEntry,\n EditorSceneAssetCatalogKind,\n} from './types';\nexport {\n compareEditorSceneAssetLibraryItems,\n createEditorSceneAssetLibrary,\n createEditorSceneAssetHydrationCatalog,\n createEditorSceneAssetLibraryItem,\n resolveEditorSceneAssetLibraryItemRelativePath,\n} from './catalog';\nexport {\n assertEditorSceneDocumentAssetCatalogCompleteness,\n dehydrateEditorSceneDocumentAssets,\n enrichEditorSceneDocumentAssets,\n mergeEditorSceneAssetWithLibraryItem,\n} from './document';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/authoring-server/handler.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,wBAAsB,oCAAoC,CACxD,OAAO,EAAE,8BAA8B,EACvC,QAAQ,EAAE,+BAA+B,GACxC,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC,CA4BjD"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/authoring-server/handler.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,+BAA+B,EAC/B,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,wBAAsB,oCAAoC,CACxD,OAAO,EAAE,8BAA8B,EACvC,QAAQ,EAAE,+BAA+B,GACxC,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC,CAoCjD"}
@@ -14,6 +14,14 @@ export async function handlePlayableAuthoringServerRequest(request, handlers) {
14
14
  if (method !== 'GET') {
15
15
  return createPlayableAuthoringJsonResponse(405, { ok: false, error: 'method_not_allowed' });
16
16
  }
17
+ if (route.routeName === 'project-file') {
18
+ const rawPath = new URL(request.url ?? '', 'http://localhost').searchParams.get('path')?.trim() ?? '';
19
+ if (!rawPath) {
20
+ return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_file_path' });
21
+ }
22
+ const result = await handlers.loadProjectFile?.({ path: rawPath, route });
23
+ return createPlayableAuthoringJsonResponse(200, result ?? { ok: false, error: 'not_found' });
24
+ }
17
25
  return createPlayableAuthoringJsonResponse(200, await dispatchGetRoute(route, handlers));
18
26
  }
19
27
  if (method !== 'POST') {
@@ -33,7 +41,10 @@ export async function handlePlayableAuthoringServerRequest(request, handlers) {
33
41
  function isGetRoute(routeName) {
34
42
  return routeName === 'manifest'
35
43
  || routeName === 'editor-scene'
36
- || routeName === 'editor-asset-library';
44
+ || routeName === 'editor-asset-library'
45
+ || routeName === 'project-files'
46
+ || routeName === 'project-file'
47
+ || routeName === 'project-media';
37
48
  }
38
49
  async function dispatchGetRoute(route, handlers) {
39
50
  if (route.routeName === 'manifest' && handlers.loadManifest) {
@@ -45,6 +56,9 @@ async function dispatchGetRoute(route, handlers) {
45
56
  if (route.routeName === 'editor-asset-library' && handlers.loadEditorAssetLibrary) {
46
57
  return handlers.loadEditorAssetLibrary(route);
47
58
  }
59
+ if (route.routeName === 'project-files' && handlers.loadProjectFiles) {
60
+ return handlers.loadProjectFiles(route);
61
+ }
48
62
  return { ok: false, error: 'not_found' };
49
63
  }
50
64
  async function dispatchPostRoute(route, body, handlers) {
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/authoring-server/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,2CAA2C,GAC5C,MAAM,WAAW,CAAC;AACnB,OAAO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UAAU,iBAAiB,CAC9B,KAAkC,EAClC,IAA6B,EAC7B,QAAyC;IAEzC,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI;QAC3C,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,gCAAgC;QACvC,OAAO,EAAE,6GAA6G;KACvH,CAAC;AACJ,CAAC","sourcesContent":["import { readRecord } from '../shared/json';\nimport {\n readPlayableAuthoringPayloadPathFromCommand,\n} from './payload';\nimport {\n createPlayableAuthoringEmptyResponse,\n createPlayableAuthoringJsonResponse,\n serializePlayableAuthoringFileContent,\n} from './response';\nimport {\n matchPlayableAuthoringRoute,\n} from './routes';\nimport type {\n PlayableAuthoringRouteMatch,\n PlayableAuthoringRouteName,\n PlayableAuthoringSaveMode,\n PlayableAuthoringServerHandlers,\n PlayableAuthoringServerRequest,\n PlayableAuthoringServerResponse,\n} from './types';\n\nexport async function handlePlayableAuthoringServerRequest(\n request: PlayableAuthoringServerRequest,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse | null> {\n const route = matchPlayableAuthoringRoute(request.url);\n if (!route) return null;\n\n const method = (request.method ?? 'GET').toUpperCase();\n if (method === 'OPTIONS') return createPlayableAuthoringEmptyResponse(204);\n\n try {\n if (isGetRoute(route.routeName)) {\n if (method !== 'GET') {\n return createPlayableAuthoringJsonResponse(405, { ok: false, error: 'method_not_allowed' });\n }\n return createPlayableAuthoringJsonResponse(200, await dispatchGetRoute(route, handlers));\n }\n\n if (method !== 'POST') {\n return createPlayableAuthoringJsonResponse(405, { ok: false, error: 'method_not_allowed' });\n }\n\n const body = request.body ?? await handlers.readBody?.(request, route) ?? {};\n return await dispatchPostRoute(route, body, handlers);\n } catch (error) {\n return createPlayableAuthoringJsonResponse(500, {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n details: readRecord((error as { details?: unknown })?.details),\n });\n }\n}\n\nfunction isGetRoute(routeName: PlayableAuthoringRouteName): boolean {\n return routeName === 'manifest'\n || routeName === 'editor-scene'\n || routeName === 'editor-asset-library';\n}\n\nasync function dispatchGetRoute(\n route: PlayableAuthoringRouteMatch,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<Record<string, unknown>> {\n if (route.routeName === 'manifest' && handlers.loadManifest) {\n return handlers.loadManifest(route);\n }\n if (route.routeName === 'editor-scene' && handlers.loadEditorScene) {\n return handlers.loadEditorScene(route);\n }\n if (route.routeName === 'editor-asset-library' && handlers.loadEditorAssetLibrary) {\n return handlers.loadEditorAssetLibrary(route);\n }\n return { ok: false, error: 'not_found' };\n}\n\nasync function dispatchPostRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n if (route.routeName === 'file') {\n return handleFileRoute(route, body, handlers);\n }\n if (route.routeName === 'exec') {\n return handleExecRoute(route, body, handlers);\n }\n if (route.routeName === 'save-editor-scene') {\n return handleSaveRoute(route, body, handlers);\n }\n if (route.routeName === 'commit') {\n return createPlayableAuthoringJsonResponse(410, await handleCommitRoute(route, body, handlers));\n }\n return createPlayableAuthoringJsonResponse(404, { ok: false, error: 'not_found' });\n}\n\nasync function handleFileRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const rawPath = String(body.path ?? '');\n const path = handlers.normalizeTransportPath?.(rawPath) ?? rawPath;\n if (!path) {\n return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_file_path' });\n }\n const content = body.content;\n const text = serializePlayableAuthoringFileContent(content);\n const result = await handlers.writeFile?.({ body, path, rawPath, content, text, route });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: true, path });\n}\n\nasync function handleExecRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const cmd = String(body.cmd ?? '');\n const rawPayloadPath = readPlayableAuthoringPayloadPathFromCommand(cmd);\n if (!rawPayloadPath) {\n return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_payload_arg', cmd });\n }\n const payloadPath = handlers.normalizeTransportPath?.(rawPayloadPath) ?? rawPayloadPath;\n const result = await handlers.runCommand?.({ body, cmd, payloadPath, rawPayloadPath, route });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: true, cmd });\n}\n\nasync function handleSaveRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const mode: PlayableAuthoringSaveMode = body.mode === 'prepare-platform-save'\n ? 'prepare-platform-save'\n : 'local-commit-save';\n const result = await handlers.saveEditorScene?.({\n body,\n mode,\n rawEditorScene: body.editorScene,\n route,\n });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: false, error: 'not_found' });\n}\n\nasync function handleCommitRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<Record<string, unknown>> {\n return handlers.commit?.({ body, route }) ?? {\n ok: false,\n error: 'platform_commit_route_disabled',\n message: 'Save through /__fps_editor_authoring/save-editor-scene so scene.main remains the authoring source of truth.',\n };\n}\n"]}
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/authoring-server/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,2CAA2C,GAC5C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oCAAoC,EACpC,mCAAmC,EACnC,qCAAqC,GACtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAUlB,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,OAAuC,EACvC,QAAyC;IAEzC,MAAM,KAAK,GAAG,2B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E,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9F,OAAO,mCAAmC,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,KAAkC,EAClC,IAA6B,EAC7B,QAAyC;IAEzC,MAAM,IAAI,GAA8B,IAAI,CAAC,IAAI,KAAK,uBAAuB;QAC3E,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,mBAAmB,CAAC;IACxB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,eAAe,EAAE,CAAC;QAC9C,IAAI;QACJ,IAAI;QACJ,cAAc,EAAE,IAAI,CAAC,WAAW;QAChC,KAAK;KACN,CAAC,CAAC;IACH,OAAO,mCAAmC,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,KAAkC,EAClC,IAA6B,EAC7B,QAAyC;IAEzC,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI;QAC3C,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,gCAAgC;QACvC,OAAO,EAAE,6GAA6G;KACvH,CAAC;AACJ,CAAC","sourcesContent":["import { readRecord } from '../shared/json';\nimport {\n readPlayableAuthoringPayloadPathFromCommand,\n} from './payload';\nimport {\n createPlayableAuthoringEmptyResponse,\n createPlayableAuthoringJsonResponse,\n serializePlayableAuthoringFileContent,\n} from './response';\nimport {\n matchPlayableAuthoringRoute,\n} from './routes';\nimport type {\n PlayableAuthoringRouteMatch,\n PlayableAuthoringRouteName,\n PlayableAuthoringSaveMode,\n PlayableAuthoringServerHandlers,\n PlayableAuthoringServerRequest,\n PlayableAuthoringServerResponse,\n} from './types';\n\nexport async function handlePlayableAuthoringServerRequest(\n request: PlayableAuthoringServerRequest,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse | null> {\n const route = matchPlayableAuthoringRoute(request.url);\n if (!route) return null;\n\n const method = (request.method ?? 'GET').toUpperCase();\n if (method === 'OPTIONS') return createPlayableAuthoringEmptyResponse(204);\n\n try {\n if (isGetRoute(route.routeName)) {\n if (method !== 'GET') {\n return createPlayableAuthoringJsonResponse(405, { ok: false, error: 'method_not_allowed' });\n }\n if (route.routeName === 'project-file') {\n const rawPath = new URL(request.url ?? '', 'http://localhost').searchParams.get('path')?.trim() ?? '';\n if (!rawPath) {\n return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_file_path' });\n }\n const result = await handlers.loadProjectFile?.({ path: rawPath, route });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: false, error: 'not_found' });\n }\n return createPlayableAuthoringJsonResponse(200, await dispatchGetRoute(route, handlers));\n }\n\n if (method !== 'POST') {\n return createPlayableAuthoringJsonResponse(405, { ok: false, error: 'method_not_allowed' });\n }\n\n const body = request.body ?? await handlers.readBody?.(request, route) ?? {};\n return await dispatchPostRoute(route, body, handlers);\n } catch (error) {\n return createPlayableAuthoringJsonResponse(500, {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n details: readRecord((error as { details?: unknown })?.details),\n });\n }\n}\n\nfunction isGetRoute(routeName: PlayableAuthoringRouteName): boolean {\n return routeName === 'manifest'\n || routeName === 'editor-scene'\n || routeName === 'editor-asset-library'\n || routeName === 'project-files'\n || routeName === 'project-file'\n || routeName === 'project-media';\n}\n\nasync function dispatchGetRoute(\n route: PlayableAuthoringRouteMatch,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<Record<string, unknown>> {\n if (route.routeName === 'manifest' && handlers.loadManifest) {\n return handlers.loadManifest(route);\n }\n if (route.routeName === 'editor-scene' && handlers.loadEditorScene) {\n return handlers.loadEditorScene(route);\n }\n if (route.routeName === 'editor-asset-library' && handlers.loadEditorAssetLibrary) {\n return handlers.loadEditorAssetLibrary(route);\n }\n if (route.routeName === 'project-files' && handlers.loadProjectFiles) {\n return handlers.loadProjectFiles(route);\n }\n return { ok: false, error: 'not_found' };\n}\n\nasync function dispatchPostRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n if (route.routeName === 'file') {\n return handleFileRoute(route, body, handlers);\n }\n if (route.routeName === 'exec') {\n return handleExecRoute(route, body, handlers);\n }\n if (route.routeName === 'save-editor-scene') {\n return handleSaveRoute(route, body, handlers);\n }\n if (route.routeName === 'commit') {\n return createPlayableAuthoringJsonResponse(410, await handleCommitRoute(route, body, handlers));\n }\n return createPlayableAuthoringJsonResponse(404, { ok: false, error: 'not_found' });\n}\n\nasync function handleFileRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const rawPath = String(body.path ?? '');\n const path = handlers.normalizeTransportPath?.(rawPath) ?? rawPath;\n if (!path) {\n return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_file_path' });\n }\n const content = body.content;\n const text = serializePlayableAuthoringFileContent(content);\n const result = await handlers.writeFile?.({ body, path, rawPath, content, text, route });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: true, path });\n}\n\nasync function handleExecRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const cmd = String(body.cmd ?? '');\n const rawPayloadPath = readPlayableAuthoringPayloadPathFromCommand(cmd);\n if (!rawPayloadPath) {\n return createPlayableAuthoringJsonResponse(400, { ok: false, error: 'missing_payload_arg', cmd });\n }\n const payloadPath = handlers.normalizeTransportPath?.(rawPayloadPath) ?? rawPayloadPath;\n const result = await handlers.runCommand?.({ body, cmd, payloadPath, rawPayloadPath, route });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: true, cmd });\n}\n\nasync function handleSaveRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<PlayableAuthoringServerResponse> {\n const mode: PlayableAuthoringSaveMode = body.mode === 'prepare-platform-save'\n ? 'prepare-platform-save'\n : 'local-commit-save';\n const result = await handlers.saveEditorScene?.({\n body,\n mode,\n rawEditorScene: body.editorScene,\n route,\n });\n return createPlayableAuthoringJsonResponse(200, result ?? { ok: false, error: 'not_found' });\n}\n\nasync function handleCommitRoute(\n route: PlayableAuthoringRouteMatch,\n body: Record<string, unknown>,\n handlers: PlayableAuthoringServerHandlers,\n): Promise<Record<string, unknown>> {\n return handlers.commit?.({ body, route }) ?? {\n ok: false,\n error: 'platform_commit_route_disabled',\n message: 'Save through /__fps_editor_authoring/save-editor-scene so scene.main remains the authoring source of truth.',\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/authoring-server/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AAcjB,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,GAAE,kCAAuC,GAC/C,2BAA2B,GAAG,IAAI,CAcpC"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/authoring-server/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AAiBjB,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,GAAE,kCAAuC,GAC/C,2BAA2B,GAAG,IAAI,CAcpC"}
@@ -4,6 +4,9 @@ const ROUTE_PREFIXES = [
4
4
  ['commit', '/commit'],
5
5
  ['editor-scene', '/editor-scene'],
6
6
  ['editor-asset-library', '/editor-asset-library'],
7
+ ['project-files', '/project-files'],
8
+ ['project-media', '/project-media'],
9
+ ['project-file', '/project-file'],
7
10
  ['save-editor-scene', '/save-editor-scene'],
8
11
  ['file', '/file'],
9
12
  ['exec', '/exec'],
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/authoring-server/routes.ts"],"names":[],"mappings":"AAMA,MAAM,0BAA0B,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE/D,MAAM,cAAc,GAAyD;IAC3E,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,cAAc,EAAE,eAAe,CAAC;IACjC,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IACjD,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;IAC3C,CAAC,MAAM,EAAE,OAAO,CAAC;IACjB,CAAC,MAAM,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,UAAU,2BAA2B,CACzC,GAAuB,EACvB,UAA8C,EAAE;IAEhD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC;IACjE,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,IAAI,0BAA0B,CAAC;IACzE,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC9D,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAEhC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;IAC1D,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5B,OAAO;QACL,KAAK;QACL,SAAS;QACT,MAAM,EAAE,aAAa;KACtB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB,EAAE,QAA2B;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACpF,CAAC","sourcesContent":["import type {\n PlayableAuthoringRouteMatch,\n PlayableAuthoringRouteMatchOptions,\n PlayableAuthoringRouteName,\n} from './types';\n\nconst DEFAULT_AUTHORING_PREFIXES = ['/__fps_editor_authoring'];\n\nconst ROUTE_PREFIXES: Array<readonly [PlayableAuthoringRouteName, string]> = [\n ['manifest', '/manifest'],\n ['commit', '/commit'],\n ['editor-scene', '/editor-scene'],\n ['editor-asset-library', '/editor-asset-library'],\n ['save-editor-scene', '/save-editor-scene'],\n ['file', '/file'],\n ['exec', '/exec'],\n];\n\nexport function matchPlayableAuthoringRoute(\n url: string | undefined,\n options: PlayableAuthoringRouteMatchOptions = {},\n): PlayableAuthoringRouteMatch | null {\n const pathname = new URL(url ?? '', 'http://localhost').pathname;\n const authoringPrefixes = options.prefixes ?? DEFAULT_AUTHORING_PREFIXES;\n const matchedPrefix = findPrefix(pathname, authoringPrefixes);\n if (!matchedPrefix) return null;\n\n const route = pathname.slice(matchedPrefix.length) || '/';\n const routeName = readRouteName(route);\n if (!routeName) return null;\n return {\n route,\n routeName,\n prefix: matchedPrefix,\n };\n}\n\nfunction findPrefix(pathname: string, prefixes: readonly string[]): string | null {\n return prefixes.find((prefix) => pathname.startsWith(prefix)) ?? null;\n}\n\nfunction readRouteName(route: string): PlayableAuthoringRouteName | null {\n return ROUTE_PREFIXES.find(([, prefix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AgB,EAAE,QAA2B;IAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACpF,CAAC","sourcesContent":["import type {\n PlayableAuthoringRouteMatch,\n PlayableAuthoringRouteMatchOptions,\n PlayableAuthoringRouteName,\n} from './types';\n\nconst DEFAULT_AUTHORING_PREFIXES = ['/__fps_editor_authoring'];\n\nconst ROUTE_PREFIXES: Array<readonly [PlayableAuthoringRouteName, string]> = [\n ['manifest', '/manifest'],\n ['commit', '/commit'],\n ['editor-scene', '/editor-scene'],\n ['editor-asset-library', '/editor-asset-library'],\n ['project-files', '/project-files'],\n ['project-media', '/project-media'],\n ['project-file', '/project-file'],\n ['save-editor-scene', '/save-editor-scene'],\n ['file', '/file'],\n ['exec', '/exec'],\n];\n\nexport function matchPlayableAuthoringRoute(\n url: string | undefined,\n options: PlayableAuthoringRouteMatchOptions = {},\n): PlayableAuthoringRouteMatch | null {\n const pathname = new URL(url ?? '', 'http://localhost').pathname;\n const authoringPrefixes = options.prefixes ?? DEFAULT_AUTHORING_PREFIXES;\n const matchedPrefix = findPrefix(pathname, authoringPrefixes);\n if (!matchedPrefix) return null;\n\n const route = pathname.slice(matchedPrefix.length) || '/';\n const routeName = readRouteName(route);\n if (!routeName) return null;\n return {\n route,\n routeName,\n prefix: matchedPrefix,\n };\n}\n\nfunction findPrefix(pathname: string, prefixes: readonly string[]): string | null {\n return prefixes.find((prefix) => pathname.startsWith(prefix)) ?? null;\n}\n\nfunction readRouteName(route: string): PlayableAuthoringRouteName | null {\n return ROUTE_PREFIXES.find(([, prefix]) => route.startsWith(prefix))?.[0] ?? null;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type PlayableAuthoringRouteName = 'manifest' | 'commit' | 'editor-scene' | 'editor-asset-library' | 'save-editor-scene' | 'file' | 'exec';
1
+ export type PlayableAuthoringRouteName = 'manifest' | 'commit' | 'editor-scene' | 'editor-asset-library' | 'project-files' | 'project-file' | 'project-media' | 'save-editor-scene' | 'file' | 'exec';
2
2
  export type PlayableAuthoringSaveMode = 'local-commit-save' | 'prepare-platform-save';
3
3
  export interface PlayableAuthoringRouteMatch {
4
4
  route: string;
@@ -19,6 +19,11 @@ export interface PlayableAuthoringServerHandlers {
19
19
  normalizeTransportPath?: (path: string) => string;
20
20
  loadManifest?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;
21
21
  loadEditorAssetLibrary?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;
22
+ loadProjectFiles?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;
23
+ loadProjectFile?: (input: {
24
+ path: string;
25
+ route: PlayableAuthoringRouteMatch;
26
+ }) => Record<string, unknown> | Promise<Record<string, unknown>>;
22
27
  loadEditorScene?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;
23
28
  writeFile?: (input: {
24
29
  body: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/authoring-server/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAClC,UAAU,GACV,QAAQ,GACR,cAAc,GACd,sBAAsB,GACtB,mBAAmB,GACnB,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG,uBAAuB,CAAC;AAEtF,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,0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ACpC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,EAAE,yBAAyB,CAAC;QAChC,cAAc,EAAE,OAAO,CAAC;QACxB,KAAK,EAAE,2BAA2B,CAAC;KACpC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,KAAK,EAAE,2BAA2B,CAAC;KACpC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAClE;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/authoring-server/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PlayableAuthoringRouteName =\n | 'manifest'\n | 'commit'\n | 'editor-scene'\n | 'editor-asset-library'\n | 'save-editor-scene'\n | 'file'\n | 'exec';\n\nexport type PlayableAuthoringSaveMode = 'local-commit-save' | 'prepare-platform-save';\n\nexport interface PlayableAuthoringRouteMatch {\n route: string;\n routeName: PlayableAuthoringRouteName;\n prefix: string;\n}\n\nexport interface PlayableAuthoringServerRequest {\n url?: string;\n method?: string;\n body?: Record<string, unknown>;\n}\n\nexport interface PlayableAuthoringServerResponse {\n statusCode: number;\n body: Record<string, unknown> | null;\n}\n\nexport interface PlayableAuthoringServerHandlers {\n readBody?: (\n request: PlayableAuthoringServerRequest,\n route: PlayableAuthoringRouteMatch,\n ) => Record<string, unknown> | Promise<Record<string, unknown>>;\n normalizeTransportPath?: (path: string) => string;\n loadManifest?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadEditorAssetLibrary?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadEditorScene?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n writeFile?: (input: {\n body: Record<string, unknown>;\n path: string;\n rawPath: string;\n content: unknown;\n text: string;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n runCommand?: (input: {\n body: Record<string, unknown>;\n cmd: string;\n payloadPath: string;\n rawPayloadPath: string;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n saveEditorScene?: (input: {\n body: Record<string, unknown>;\n mode: PlayableAuthoringSaveMode;\n rawEditorScene: unknown;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n commit?: (input: {\n body: Record<string, unknown>;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n}\n\nexport interface PlayableAuthoringRouteMatchOptions {\n prefixes?: readonly string[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/authoring-server/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PlayableAuthoringRouteName =\n | 'manifest'\n | 'commit'\n | 'editor-scene'\n | 'editor-asset-library'\n | 'project-files'\n | 'project-file'\n | 'project-media'\n | 'save-editor-scene'\n | 'file'\n | 'exec';\n\nexport type PlayableAuthoringSaveMode = 'local-commit-save' | 'prepare-platform-save';\n\nexport interface PlayableAuthoringRouteMatch {\n route: string;\n routeName: PlayableAuthoringRouteName;\n prefix: string;\n}\n\nexport interface PlayableAuthoringServerRequest {\n url?: string;\n method?: string;\n body?: Record<string, unknown>;\n}\n\nexport interface PlayableAuthoringServerResponse {\n statusCode: number;\n body: Record<string, unknown> | null;\n}\n\nexport interface PlayableAuthoringServerHandlers {\n readBody?: (\n request: PlayableAuthoringServerRequest,\n route: PlayableAuthoringRouteMatch,\n ) => Record<string, unknown> | Promise<Record<string, unknown>>;\n normalizeTransportPath?: (path: string) => string;\n loadManifest?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadEditorAssetLibrary?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadProjectFiles?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadProjectFile?: (input: {\n path: string;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n loadEditorScene?: (route: PlayableAuthoringRouteMatch) => Record<string, unknown> | Promise<Record<string, unknown>>;\n writeFile?: (input: {\n body: Record<string, unknown>;\n path: string;\n rawPath: string;\n content: unknown;\n text: string;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n runCommand?: (input: {\n body: Record<string, unknown>;\n cmd: string;\n payloadPath: string;\n rawPayloadPath: string;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n saveEditorScene?: (input: {\n body: Record<string, unknown>;\n mode: PlayableAuthoringSaveMode;\n rawEditorScene: unknown;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n commit?: (input: {\n body: Record<string, unknown>;\n route: PlayableAuthoringRouteMatch;\n }) => Record<string, unknown> | Promise<Record<string, unknown>>;\n}\n\nexport interface PlayableAuthoringRouteMatchOptions {\n prefixes?: readonly string[];\n}\n"]}
@@ -15,6 +15,7 @@ export * from './session/index';
15
15
  export * from './marker-scene/index';
16
16
  export * from './inspector/index';
17
17
  export * from './asset-library/index';
18
+ export * from './project-files/index';
18
19
  export * from './asset-database/index';
19
20
  export * from './asset-bridge/index';
20
21
  export * from './asset-registration/index';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAItC,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAA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15,6 +15,7 @@ export * from './session/index.js';
15
15
  export * from './marker-scene/index.js';
16
16
  export * from './inspector/index.js';
17
17
  export * from './asset-library/index.js';
18
+ export * from './project-files/index.js';
18
19
  export * from './asset-database/index.js';
19
20
  export * from './asset-bridge/index.js';
20
21
  export * from './asset-registration/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,gFAAgF;AAChF,4EAA4E;AAC5E,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,sEAAsE;AACtE,uDAAuD;AACvD,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './document/index';\nexport * from './product/index';\nexport * from './authoring/index';\nexport * from './authoring-client/index';\nexport * from './authoring-server/index';\nexport * from './bridge-command/index';\nexport * from './core-contracts/index';\nexport * from './package-resolution/index';\nexport * from './upgrade-doctor/types';\nexport * from './upgrade-doctor/report';\nexport * from './upgrade-doctor/host';\nexport * from './scene-source/index';\nexport * from './runtime-preview/index';\nexport * from './session/index';\nexport * from './marker-scene/index';\nexport * from './inspector/index';\nexport * from './asset-library/index';\nexport * from './asset-database/index';\nexport * from './asset-bridge/index';\nexport * from './asset-registration/index';\nexport * from './asset-placement/index';\nexport * from './scene-compiler/index';\nexport * from './field-schema/index';\nexport * from './commands/index';\nexport * from './serialized-property/index';\nexport * from './mutation/index';\nexport * from './local-harness/index';\n// Editor entry resource identity is part of the browser-safe public SDK, but is\n// intentionally kept out of the legacy local-harness barrel consumed by the\n// Vite Tooling graph.\nexport * from './local-harness/editor-entry-manifest';\nexport * from './local-harness/editor-entry-module';\nexport * from './local-harness/editor-entry-performance';\nexport * from './camera-debug/index';\nexport * from './lighting-debug/index';\nexport * from './lighting-preview/index';\nexport * from './material-binding/index';\nexport * from './prefab-stage/index';\nexport * from './rendering-profile/index';\nexport * from './static-shadows/index';\nexport * from './shadow-system/resolver';\nexport { canonicalizePlayableJsonNumbers } from './shared/json';\n// Temporary product-surface bridge. Step 3 moves runtime consumers to\n// @fps-games/playable-runtime and removes this export.\nexport * from '@fps-games/playable-rendering';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,gFAAgF;AAChF,4EAA4E;AAC5E,sBAAsB;AACtB,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,sEAAsE;AACtE,uDAAuD;AACvD,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './document/index';\nexport * from './product/index';\nexport * from './authoring/index';\nexport * from './authoring-client/index';\nexport * from './authoring-server/index';\nexport * from './bridge-command/index';\nexport * from './core-contracts/index';\nexport * from './package-resolution/index';\nexport * from './upgrade-doctor/types';\nexport * from './upgrade-doctor/report';\nexport * from './upgrade-doctor/host';\nexport * from './scene-source/index';\nexport * from './runtime-preview/index';\nexport * from './session/index';\nexport * from './marker-scene/index';\nexport * from './inspector/index';\nexport * from './asset-library/index';\nexport * from './project-files/index';\nexport * from './asset-database/index';\nexport * from './asset-bridge/index';\nexport * from './asset-registration/index';\nexport * from './asset-placement/index';\nexport * from './scene-compiler/index';\nexport * from './field-schema/index';\nexport * from './commands/index';\nexport * from './serialized-property/index';\nexport * from './mutation/index';\nexport * from './local-harness/index';\n// Editor entry resource identity is part of the browser-safe public SDK, but is\n// intentionally kept out of the legacy local-harness barrel consumed by the\n// Vite Tooling graph.\nexport * from './local-harness/editor-entry-manifest';\nexport * from './local-harness/editor-entry-module';\nexport * from './local-harness/editor-entry-performance';\nexport * from './camera-debug/index';\nexport * from './lighting-debug/index';\nexport * from './lighting-preview/index';\nexport * from './material-binding/index';\nexport * from './prefab-stage/index';\nexport * from './rendering-profile/index';\nexport * from './static-shadows/index';\nexport * from './shadow-system/resolver';\nexport { canonicalizePlayableJsonNumbers } from './shared/json';\n// Temporary product-surface bridge. Step 3 moves runtime consumers to\n// @fps-games/playable-runtime and removes this export.\nexport * from '@fps-games/playable-rendering';\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { AuthoringSourceDriver } from '@fps-games/editor-core';
2
2
  import type { EditorSceneAssetLibraryItem, EditorSceneDocument } from '../document/index';
3
3
  import { type SceneMainSourceDriverLoadResult, type SceneMainSourceCompanionConfig, type SceneMainSourceSaveOptions, type SceneMainSourceSaveResult, type SceneSourceFetchJson } from '../scene-source/index';
4
+ import type { EditorProjectFileContent, EditorProjectFileSnapshot, EditorProjectMediaSource } from '../project-files/index';
4
5
  export interface FpsGameEditorCompanionDraft<TValue> {
5
6
  isDirty(): boolean;
6
7
  get(): TValue;
@@ -32,6 +33,9 @@ export interface FpsGameEditorSceneSourceServices<TDocument extends EditorSceneD
32
33
  load(request?: SceneSourceFetchJson): Promise<SceneMainSourceDriverLoadResult<TDocument, TAsset>>;
33
34
  save(document: TDocument, options?: SceneMainSourceSaveOptions): Promise<SceneMainSourceSaveResult<TDocument>>;
34
35
  loadAssets(request?: SceneSourceFetchJson): Promise<TAsset[]>;
36
+ loadProjectFiles?(request?: SceneSourceFetchJson): Promise<EditorProjectFileSnapshot>;
37
+ loadProjectFile?(path: string, request?: SceneSourceFetchJson): Promise<EditorProjectFileContent>;
38
+ resolveProjectMedia?(path: string): EditorProjectMediaSource | null;
35
39
  }
36
40
  export declare function createFpsGameEditorSceneSourceServices<TDocument extends EditorSceneDocument, TRuntimeScene, TAsset = unknown>(options: FpsGameEditorSceneSourceServicesOptions<TDocument, TRuntimeScene, TAsset>): FpsGameEditorSceneSourceServices<TDocument, TAsset>;
37
41
  //# sourceMappingURL=scene-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scene-source.d.ts","sourceRoot":"","sources":["../../src/product/scene-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,2BAA2B,CAAC,MAAM;IACjD,OAAO,IAAI,OAAO,CAAC;IACnB,GAAG,IAAI,MAAM,CAAC;IACd,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,IAAI,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mCAAmC,CAAC,MAAM;IACzD,GAAG,IAA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gB,CAAC,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtF,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAClG,mBAAmB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAAC;CACrE;AASD,wBAAgB,sCAAsC,CAAC,SAAS,SAAS,mBAAmB,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,EAC3H,OAAO,EAAE,uCAAuC,CAAC,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,GACjF,gCAAgC,CAAC,SAAS,EAAE,MAAM,CAAC,CA0IrD"}
@@ -1,5 +1,5 @@
1
1
  import { createRuntimeSceneCompiledArtifact, } from '../scene-source/artifacts.js';
2
- import { createSceneMainSourceDriver, loadEditorAssetLibrary, loadSceneMainSource, saveSceneMainSource, } from '../scene-source/index.js';
2
+ import { createSceneMainSourceDriver, loadEditorAssetLibrary, loadEditorProjectFile, loadEditorProjectFiles, resolveEditorProjectMediaSource, loadSceneMainSource, saveSceneMainSource, } from '../scene-source/index.js';
3
3
  export function createFpsGameEditorSceneSourceServices(options) {
4
4
  let lifecycleEpoch = 0;
5
5
  const compileArtifact = (source, document) => (createRuntimeSceneCompiledArtifact({
@@ -125,6 +125,15 @@ export function createFpsGameEditorSceneSourceServices(options) {
125
125
  const assets = await loadEditorAssetLibrary(request ? { fetchJson: request } : undefined);
126
126
  return options.castAssets ? options.castAssets(assets) : assets;
127
127
  },
128
+ loadProjectFiles(request) {
129
+ return loadEditorProjectFiles(request ? { fetchJson: request } : undefined);
130
+ },
131
+ loadProjectFile(path, request) {
132
+ return loadEditorProjectFile(path, request ? { fetchJson: request } : undefined);
133
+ },
134
+ resolveProjectMedia(path) {
135
+ return resolveEditorProjectMediaSource(path);
136
+ },
128
137
  };
129
138
  }
130
139
  function draftSnapshotMatches(draft, prepared) {
@@ -1 +1 @@
1
- {"version":3,"file":"scene-source.js","sourceRoot":"","sources":["../../src/product/scene-source.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kCAAkC,GACnC,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GAMpB,MAAM,uBAAuB,CAAC;AAgD/B,MAAM,UAAU,sCAAsC,CACpD,OAAkF;IAElF,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,MAAM,eAAe,GAAG,CAAC,MAAiC,EAAE,QAAmB,EAAoB,EAAE,CAAC,CACpG,kCAAkC,CAAC;QACjC,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAC3C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,YAAY;QAC9C,kBAAkB,EAAE,OAAO,CAAC,UAAU;QACtC,uBAAuB,EAAE,OAAO,CAAC,eAAe;KACjD,CAAC,CACH,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE;YACjD,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;YACnD,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,EAAE,OAAO,EAAE,IAAI,KAAK,CAAC;QACxE,MAAM,aAAa,GAAG,iBAAiB;YACrC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC;YAC/D,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,OAAO,GAA0B;YACrC,KAAK,EAAE,EAAE,cAAc;YACvB,SAAS;YACT,iBAAiB;YACjB,aAAa;SACd,CAAC;QACF,OAAO;YACL,WAAW,EAAE,SAAS,IAAI,iBAAiB,CAA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OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAW,CAAC;AACrD,CAAC;AAED,SAAS,+BAA+B,CACtC,SAAiD,EACjD,QAAgD;IAEhD,MAAM,gBAAgB,GAAG,SAAS,EAAE,gBAAgB,IAAI,QAAQ,EAAE,gBAAgB;QAChF,CAAC,CAAC;YACE,GAAG,CAAC,SAAS,EAAE,gBAAgB,IAAI,EAAE,CAAC;YACtC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,IAAI,EAAE,CAAC;SACtC;QACH,CAAC,CAAC,SAAS,CAAC;IACd,OAAO;QACL,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;QACpB,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QACnB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n AuthoringSourceDescriptor,\n AuthoringSourceDriver,\n CompiledArtifact,\n} from '@fps-games/editor-core';\nimport {\n createRuntimeSceneCompiledArtifact,\n} from '../scene-source/artifacts';\nimport type {\n EditorSceneAssetLibraryItem,\n EditorSceneDocument,\n} from '../document/index';\nimport {\n createSceneMainSourceDriver,\n loadEditorAssetLibrary,\n loadSceneMainSource,\n saveSceneMainSource,\n type SceneMainSourceDriverLoadResult,\n type SceneMainSourceCompanionConfig,\n type SceneMainSourceSaveOptions,\n type SceneMainSourceSaveResult,\n type SceneSourceFetchJson,\n} from '../scene-source/index';\n\nexport interface FpsGameEditorCompanionDraft<TValue> {\n isDirty(): boolean;\n get(): TValue;\n markSaved(value: TValue): void;\n setError?(error: unknown): void;\n clearError?(): void;\n}\n\nexport interface FpsGameEditorReadonlyConfigSnapshot<TValue> {\n get(): TValue | null;\n replace(value: TValue | null): void;\n}\n\nexport interface FpsGameEditorSceneSourceServicesOptions<\n TDocument extends EditorSceneDocument,\n TRuntimeScene,\n TAsset = EditorSceneAssetLibraryItem,\n> {\n compilerId: string;\n compilerVersion: string;\n compileRuntimeScene(document: TDocument): TRuntimeScene;\n isRuntimeScene(value: unknown): value is TRuntimeScene;\n onRuntimeScene(value: TRuntimeScene): void;\n renderingDraft?: FpsGameEditorCompanionDraft<Record<string, unknown>>;\n staticShadowDraft?: FpsGameEditorCompanionDraft<SceneMainSourceCompanionConfig>;\n shadowMapExperimentConfigSnapshot?: FpsGameEditorReadonlyConfigSnapshot<\n NonNullable<SceneMainSourceDriverLoadResult<TDocument>['shadowMapExperimentConfig']>\n >;\n artifactId?: string;\n castAssets?(assets: unknown[]): TAsset[];\n}\n\nexport interface FpsGameEditorSceneSourceServices<TDocument extends EditorSceneDocument, TAsset> {\n createDriver(options?: { endpointBase?: string; fetchJson?: SceneSourceFetchJson }): AuthoringSourceDriver<TDocument>;\n load(request?: SceneSourceFetchJson): Promise<SceneMainSourceDriverLoadResult<TDocument, TAsset>>;\n save(document: TDocument, options?: SceneMainSourceSaveOptions): Promise<SceneMainSourceSaveResult<TDocument>>;\n loadAssets(request?: SceneSourceFetchJson): Promise<TAsset[]>;\n}\n\ninterface PreparedCompanionSave {\n epoch: number;\n rendering: Record<string, unknown> | null;\n staticShadowDirty: boolean;\n staticShadows: SceneMainSourceCompanionConfig;\n}\n\nexport function createFpsGameEditorSceneSourceServices<TDocument extends EditorSceneDocument, TRuntimeScene, TAsset = unknown>(\n options: FpsGameEditorSceneSourceServicesOptions<TDocument, TRuntimeScene, TAsset>,\n): FpsGameEditorSceneSourceServices<TDocument, TAsset> {\n let lifecycleEpoch = 0;\n const compileArtifact = (source: AuthoringSourceDescriptor, document: TDocument): CompiledArtifact => (\n createRuntimeSceneCompiledArtifact({\n source,\n data: options.compileRuntimeScene(document),\n artifactId: options.artifactId ?? 'scene.json',\n fallbackCompilerId: options.compilerId,\n fallbackCompilerVersion: options.compilerVersion,\n })\n );\n const prepareSave = () => {\n const rendering = options.renderingDraft?.isDirty()\n ? cloneCompanionValue(options.renderingDraft.get())\n : null;\n const staticShadowDirty = options.staticShadowDraft?.isDirty() ?? false;\n const staticShadows = staticShadowDirty\n ? cloneCompanionValue(options.staticShadowDraft?.get() ?? null)\n : null;\n const context: PreparedCompanionSave = {\n epoch: ++lifecycleEpoch,\n rendering,\n staticShadowDirty,\n staticShadows,\n };\n return {\n saveOptions: rendering || staticShadowDirty ? {\n companionConfigs: {\n ...(rendering ? { rendering } : {}),\n ...(staticShadowDirty ? { staticShadows } : {}),\n },\n } : undefined,\n context,\n };\n };\n const reportSaveError = (error: unknown, prepared: PreparedCompanionSave | undefined) => {\n if (!prepared || prepared.epoch !== lifecycleEpoch) return;\n if (prepared.rendering && draftSnapshotMatches(options.renderingDraft, prepared.rendering)) {\n options.renderingDraft?.setError?.(error);\n }\n if (prepared.staticShadowDirty && draftSnapshotMatches(options.staticShadowDraft, prepared.staticShadows)) {\n options.staticShadowDraft?.setError?.(error);\n }\n };\n const completeSave = (\n saved: SceneMainSourceSaveResult<TDocument>,\n prepared: PreparedCompanionSave | undefined,\n ) => {\n if (!prepared || prepared.epoch !== lifecycleEpoch) return;\n if (prepared?.rendering) {\n if (draftSnapshotMatches(options.renderingDraft, prepared.rendering)) {\n options.renderingDraft?.markSaved(saved.renderingConfig ?? prepared.rendering);\n }\n options.renderingDraft?.clearError?.();\n }\n if (prepared?.staticShadowDirty) {\n if (draftSnapshotMatches(options.staticShadowDraft, prepared.staticShadows)) {\n options.staticShadowDraft?.markSaved(saved.companionConfigs?.staticShadows ?? prepared.staticShadows);\n }\n options.staticShadowDraft?.clearError?.();\n }\n options.shadowMapExperimentConfigSnapshot?.replace(saved.shadowMapExperimentConfig ?? null);\n };\n const prepareLoad = () => ++lifecycleEpoch;\n const completeLoad = (loaded: SceneMainSourceDriverLoadResult<TDocument>, epoch: number) => {\n if (epoch !== lifecycleEpoch) return;\n options.staticShadowDraft?.markSaved(loaded.companionConfigs?.staticShadows ?? null);\n options.staticShadowDraft?.clearError?.();\n options.shadowMapExperimentConfigSnapshot?.replace(loaded.shadowMapExperimentConfig ?? null);\n };\n const createDriver = (\n driverOptions: { endpointBase?: string; fetchJson?: SceneSourceFetchJson } = {},\n ): AuthoringSourceDriver<TDocument> => createSceneMainSourceDriver<TDocument>({\n ...driverOptions,\n prepareLoad,\n afterLoad({ loaded, context }) {\n completeLoad(loaded, context as number);\n },\n prepareSave,\n isSaveCurrent({ context }) {\n const prepared = context as PreparedCompanionSave | undefined;\n return !!prepared && prepared.epoch === lifecycleEpoch;\n },\n onSaveError({ error, context }) {\n reportSaveError(error, context as PreparedCompanionSave | undefined);\n },\n afterSave({ saved, context }) {\n completeSave(saved, context as PreparedCompanionSave | undefined);\n },\n compile: ({ source, document }) => [compileArtifact(source, document)],\n onRuntimeSceneArtifact({ artifact }) {\n if (options.isRuntimeScene(artifact.data)) options.onRuntimeScene(artifact.data);\n },\n });\n\n return {\n createDriver,\n async load(request) {\n const epoch = prepareLoad();\n const loaded = await loadSceneMainSource<TDocument>(request ? { fetchJson: request } : undefined);\n const { assets: loadedAssets, ...loadedSource } = loaded;\n const assets: TAsset[] | undefined = loadedAssets\n ? options.castAssets\n ? options.castAssets(loadedAssets)\n : loadedAssets as unknown as TAsset[]\n : undefined;\n completeLoad(loaded, epoch);\n return {\n ...loadedSource,\n ...(assets ? { assets } : {}),\n };\n },\n async save(document, requestedOptions) {\n const prepared = prepareSave();\n const mergedOptions = mergeSceneMainSourceSaveOptions(requestedOptions, prepared.saveOptions);\n try {\n const saved = await saveSceneMainSource<TDocument>(document, mergedOptions);\n completeSave(saved, prepared.context);\n return saved;\n } catch (error) {\n reportSaveError(error, prepared.context);\n throw error;\n }\n },\n async loadAssets(request) {\n const assets = await loadEditorAssetLibrary(request ? { fetchJson: request } : undefined);\n return options.castAssets ? options.castAssets(assets) : assets as TAsset[];\n },\n };\n}\n\nfunction draftSnapshotMatches<TValue>(\n draft: FpsGameEditorCompanionDraft<TValue> | undefined,\n prepared: TValue,\n): boolean {\n if (!draft) return false;\n return JSON.stringify(draft.get()) === JSON.stringify(prepared);\n}\n\nfunction cloneCompanionValue<TValue>(value: TValue): TValue {\n if (value === undefined) return value;\n return JSON.parse(JSON.stringify(value)) as TValue;\n}\n\nfunction mergeSceneMainSourceSaveOptions(\n requested: SceneMainSourceSaveOptions | undefined,\n prepared: SceneMainSourceSaveOptions | undefined,\n): SceneMainSourceSaveOptions {\n const companionConfigs = requested?.companionConfigs || prepared?.companionConfigs\n ? {\n ...(requested?.companionConfigs ?? {}),\n ...(prepared?.companionConfigs ?? {}),\n }\n : undefined;\n return {\n ...(requested ?? {}),\n ...(prepared ?? {}),\n ...(companionConfigs ? { companionConfigs } : {}),\n };\n}\n"]}
1
+ {"version":3,"file":"scene-source.js","sourceRoot":"","sources":["../../src/product/scene-source.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kCAAkC,GACnC,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,mBAAmB,EACnB,mBAAmB,GAMpB,MAAM,uBAAuB,CAAC;AAoD/B,MAAM,UAAU,sCAAsC,CACpD,OAAkF;IAElF,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,MAAM,eAAe,GAAG,CAAC,MAAiC,EAAE,QAAmB,EAAoB,EAAE,CAAC,CACpG,kCAAkC,CAAC;QACjC,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAC3C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,YAAY;QAC9C,kBAAkB,EAAE,OAAO,CAAC,UAAU;QACtC,uBAAuB,EAAE,OAAO,CAAC,eAAe;KACjD,CAAC,CACH,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE;YACjD,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAA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IACd,OAAO;QACL,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;QACpB,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QACnB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n AuthoringSourceDescriptor,\n AuthoringSourceDriver,\n CompiledArtifact,\n} from '@fps-games/editor-core';\nimport {\n createRuntimeSceneCompiledArtifact,\n} from '../scene-source/artifacts';\nimport type {\n EditorSceneAssetLibraryItem,\n EditorSceneDocument,\n} from '../document/index';\nimport {\n createSceneMainSourceDriver,\n loadEditorAssetLibrary,\n loadEditorProjectFile,\n loadEditorProjectFiles,\n resolveEditorProjectMediaSource,\n loadSceneMainSource,\n saveSceneMainSource,\n type SceneMainSourceDriverLoadResult,\n type SceneMainSourceCompanionConfig,\n type SceneMainSourceSaveOptions,\n type SceneMainSourceSaveResult,\n type SceneSourceFetchJson,\n} from '../scene-source/index';\nimport type { EditorProjectFileContent, EditorProjectFileSnapshot, EditorProjectMediaSource } from '../project-files/index';\n\nexport interface FpsGameEditorCompanionDraft<TValue> {\n isDirty(): boolean;\n get(): TValue;\n markSaved(value: TValue): void;\n setError?(error: unknown): void;\n clearError?(): void;\n}\n\nexport interface FpsGameEditorReadonlyConfigSnapshot<TValue> {\n get(): TValue | null;\n replace(value: TValue | null): void;\n}\n\nexport interface FpsGameEditorSceneSourceServicesOptions<\n TDocument extends EditorSceneDocument,\n TRuntimeScene,\n TAsset = EditorSceneAssetLibraryItem,\n> {\n compilerId: string;\n compilerVersion: string;\n compileRuntimeScene(document: TDocument): TRuntimeScene;\n isRuntimeScene(value: unknown): value is TRuntimeScene;\n onRuntimeScene(value: TRuntimeScene): void;\n renderingDraft?: FpsGameEditorCompanionDraft<Record<string, unknown>>;\n staticShadowDraft?: FpsGameEditorCompanionDraft<SceneMainSourceCompanionConfig>;\n shadowMapExperimentConfigSnapshot?: FpsGameEditorReadonlyConfigSnapshot<\n NonNullable<SceneMainSourceDriverLoadResult<TDocument>['shadowMapExperimentConfig']>\n >;\n artifactId?: string;\n castAssets?(assets: unknown[]): TAsset[];\n}\n\nexport interface FpsGameEditorSceneSourceServices<TDocument extends EditorSceneDocument, TAsset> {\n createDriver(options?: { endpointBase?: string; fetchJson?: SceneSourceFetchJson }): AuthoringSourceDriver<TDocument>;\n load(request?: SceneSourceFetchJson): Promise<SceneMainSourceDriverLoadResult<TDocument, TAsset>>;\n save(document: TDocument, options?: SceneMainSourceSaveOptions): Promise<SceneMainSourceSaveResult<TDocument>>;\n loadAssets(request?: SceneSourceFetchJson): Promise<TAsset[]>;\n loadProjectFiles?(request?: SceneSourceFetchJson): Promise<EditorProjectFileSnapshot>;\n loadProjectFile?(path: string, request?: SceneSourceFetchJson): Promise<EditorProjectFileContent>;\n resolveProjectMedia?(path: string): EditorProjectMediaSource | null;\n}\n\ninterface PreparedCompanionSave {\n epoch: number;\n rendering: Record<string, unknown> | null;\n staticShadowDirty: boolean;\n staticShadows: SceneMainSourceCompanionConfig;\n}\n\nexport function createFpsGameEditorSceneSourceServices<TDocument extends EditorSceneDocument, TRuntimeScene, TAsset = unknown>(\n options: FpsGameEditorSceneSourceServicesOptions<TDocument, TRuntimeScene, TAsset>,\n): FpsGameEditorSceneSourceServices<TDocument, TAsset> {\n let lifecycleEpoch = 0;\n const compileArtifact = (source: AuthoringSourceDescriptor, document: TDocument): CompiledArtifact => (\n createRuntimeSceneCompiledArtifact({\n source,\n data: options.compileRuntimeScene(document),\n artifactId: options.artifactId ?? 'scene.json',\n fallbackCompilerId: options.compilerId,\n fallbackCompilerVersion: options.compilerVersion,\n })\n );\n const prepareSave = () => {\n const rendering = options.renderingDraft?.isDirty()\n ? cloneCompanionValue(options.renderingDraft.get())\n : null;\n const staticShadowDirty = options.staticShadowDraft?.isDirty() ?? false;\n const staticShadows = staticShadowDirty\n ? cloneCompanionValue(options.staticShadowDraft?.get() ?? null)\n : null;\n const context: PreparedCompanionSave = {\n epoch: ++lifecycleEpoch,\n rendering,\n staticShadowDirty,\n staticShadows,\n };\n return {\n saveOptions: rendering || staticShadowDirty ? {\n companionConfigs: {\n ...(rendering ? { rendering } : {}),\n ...(staticShadowDirty ? { staticShadows } : {}),\n },\n } : undefined,\n context,\n };\n };\n const reportSaveError = (error: unknown, prepared: PreparedCompanionSave | undefined) => {\n if (!prepared || prepared.epoch !== lifecycleEpoch) return;\n if (prepared.rendering && draftSnapshotMatches(options.renderingDraft, prepared.rendering)) {\n options.renderingDraft?.setError?.(error);\n }\n if (prepared.staticShadowDirty && draftSnapshotMatches(options.staticShadowDraft, prepared.staticShadows)) {\n options.staticShadowDraft?.setError?.(error);\n }\n };\n const completeSave = (\n saved: SceneMainSourceSaveResult<TDocument>,\n prepared: PreparedCompanionSave | undefined,\n ) => {\n if (!prepared || prepared.epoch !== lifecycleEpoch) return;\n if (prepared?.rendering) {\n if (draftSnapshotMatches(options.renderingDraft, prepared.rendering)) {\n options.renderingDraft?.markSaved(saved.renderingConfig ?? prepared.rendering);\n }\n options.renderingDraft?.clearError?.();\n }\n if (prepared?.staticShadowDirty) {\n if (draftSnapshotMatches(options.staticShadowDraft, prepared.staticShadows)) {\n options.staticShadowDraft?.markSaved(saved.companionConfigs?.staticShadows ?? prepared.staticShadows);\n }\n options.staticShadowDraft?.clearError?.();\n }\n options.shadowMapExperimentConfigSnapshot?.replace(saved.shadowMapExperimentConfig ?? null);\n };\n const prepareLoad = () => ++lifecycleEpoch;\n const completeLoad = (loaded: SceneMainSourceDriverLoadResult<TDocument>, epoch: number) => {\n if (epoch !== lifecycleEpoch) return;\n options.staticShadowDraft?.markSaved(loaded.companionConfigs?.staticShadows ?? null);\n options.staticShadowDraft?.clearError?.();\n options.shadowMapExperimentConfigSnapshot?.replace(loaded.shadowMapExperimentConfig ?? null);\n };\n const createDriver = (\n driverOptions: { endpointBase?: string; fetchJson?: SceneSourceFetchJson } = {},\n ): AuthoringSourceDriver<TDocument> => createSceneMainSourceDriver<TDocument>({\n ...driverOptions,\n prepareLoad,\n afterLoad({ loaded, context }) {\n completeLoad(loaded, context as number);\n },\n prepareSave,\n isSaveCurrent({ context }) {\n const prepared = context as PreparedCompanionSave | undefined;\n return !!prepared && prepared.epoch === lifecycleEpoch;\n },\n onSaveError({ error, context }) {\n reportSaveError(error, context as PreparedCompanionSave | undefined);\n },\n afterSave({ saved, context }) {\n completeSave(saved, context as PreparedCompanionSave | undefined);\n },\n compile: ({ source, document }) => [compileArtifact(source, document)],\n onRuntimeSceneArtifact({ artifact }) {\n if (options.isRuntimeScene(artifact.data)) options.onRuntimeScene(artifact.data);\n },\n });\n\n return {\n createDriver,\n async load(request) {\n const epoch = prepareLoad();\n const loaded = await loadSceneMainSource<TDocument>(request ? { fetchJson: request } : undefined);\n const { assets: loadedAssets, ...loadedSource } = loaded;\n const assets: TAsset[] | undefined = loadedAssets\n ? options.castAssets\n ? options.castAssets(loadedAssets)\n : loadedAssets as unknown as TAsset[]\n : undefined;\n completeLoad(loaded, epoch);\n return {\n ...loadedSource,\n ...(assets ? { assets } : {}),\n };\n },\n async save(document, requestedOptions) {\n const prepared = prepareSave();\n const mergedOptions = mergeSceneMainSourceSaveOptions(requestedOptions, prepared.saveOptions);\n try {\n const saved = await saveSceneMainSource<TDocument>(document, mergedOptions);\n completeSave(saved, prepared.context);\n return saved;\n } catch (error) {\n reportSaveError(error, prepared.context);\n throw error;\n }\n },\n async loadAssets(request) {\n const assets = await loadEditorAssetLibrary(request ? { fetchJson: request } : undefined);\n return options.castAssets ? options.castAssets(assets) : assets as TAsset[];\n },\n loadProjectFiles(request) {\n return loadEditorProjectFiles(request ? { fetchJson: request } : undefined);\n },\n loadProjectFile(path, request) {\n return loadEditorProjectFile(path, request ? { fetchJson: request } : undefined);\n },\n resolveProjectMedia(path) {\n return resolveEditorProjectMediaSource(path);\n },\n };\n}\n\nfunction draftSnapshotMatches<TValue>(\n draft: FpsGameEditorCompanionDraft<TValue> | undefined,\n prepared: TValue,\n): boolean {\n if (!draft) return false;\n return JSON.stringify(draft.get()) === JSON.stringify(prepared);\n}\n\nfunction cloneCompanionValue<TValue>(value: TValue): TValue {\n if (value === undefined) return value;\n return JSON.parse(JSON.stringify(value)) as TValue;\n}\n\nfunction mergeSceneMainSourceSaveOptions(\n requested: SceneMainSourceSaveOptions | undefined,\n prepared: SceneMainSourceSaveOptions | undefined,\n): SceneMainSourceSaveOptions {\n const companionConfigs = requested?.companionConfigs || prepared?.companionConfigs\n ? {\n ...(requested?.companionConfigs ?? {}),\n ...(prepared?.companionConfigs ?? {}),\n }\n : undefined;\n return {\n ...(requested ?? {}),\n ...(prepared ?? {}),\n ...(companionConfigs ? { companionConfigs } : {}),\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './protocol';
3
+ export * from './support';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-files/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './types.js';
2
+ export * from './protocol.js';
3
+ export * from './support.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/project-files/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC","sourcesContent":["export * from './types';\nexport * from './protocol';\nexport * from './support';\n"]}
@@ -0,0 +1,4 @@
1
+ import type { EditorProjectFileContent, EditorProjectFileSnapshot } from './types';
2
+ export declare function readEditorProjectFileSnapshot(value: unknown): EditorProjectFileSnapshot;
3
+ export declare function readEditorProjectFileContent(value: unknown): EditorProjectFileContent;
4
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/project-files/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAExB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAUvF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAwBrF"}
@@ -0,0 +1,86 @@
1
+ export function readEditorProjectFileSnapshot(value) {
2
+ const record = readRecord(value);
3
+ const entries = Array.isArray(record?.entries)
4
+ ? record.entries.flatMap(readEditorProjectFileEntry)
5
+ : [];
6
+ return {
7
+ rootName: readNonEmptyString(record?.rootName) ?? 'Project',
8
+ entries,
9
+ truncated: record?.truncated === true,
10
+ };
11
+ }
12
+ export function readEditorProjectFileContent(value) {
13
+ const record = readRecord(value);
14
+ const path = readCanonicalProjectRelativePath(record?.path);
15
+ const name = readNonEmptyString(record?.name);
16
+ const extension = typeof record?.extension === 'string' ? record.extension : null;
17
+ const language = readNonEmptyString(record?.language);
18
+ const text = typeof record?.text === 'string' ? record.text : null;
19
+ const size = typeof record?.size === 'number' && Number.isSafeInteger(record.size) && record.size >= 0
20
+ ? record.size
21
+ : null;
22
+ if (!path || !name || extension === null || !language || text === null || size === null) {
23
+ throw new Error('schema.invalidProjectFileContent');
24
+ }
25
+ const pathSegments = path.split('/');
26
+ if (name !== pathSegments[pathSegments.length - 1])
27
+ throw new Error('schema.invalidProjectFileContent');
28
+ return {
29
+ path,
30
+ name,
31
+ extension,
32
+ language,
33
+ text,
34
+ size,
35
+ truncated: record?.truncated === true,
36
+ };
37
+ }
38
+ function readEditorProjectFileEntry(value) {
39
+ const record = readRecord(value);
40
+ if (!record)
41
+ return [];
42
+ const path = readCanonicalProjectRelativePath(record?.path);
43
+ const name = readNonEmptyString(record?.name);
44
+ const kind = record?.kind === 'directory' || record?.kind === 'file'
45
+ ? record.kind
46
+ : null;
47
+ const pathSegments = path?.split('/') ?? [];
48
+ if (!path || !name || !kind || name !== pathSegments[pathSegments.length - 1])
49
+ return [];
50
+ if (!Object.prototype.hasOwnProperty.call(record, 'parentPath'))
51
+ return [];
52
+ const parentPath = record.parentPath === null
53
+ ? null
54
+ : readCanonicalProjectRelativePath(record.parentPath);
55
+ const separatorIndex = path.lastIndexOf('/');
56
+ const expectedParentPath = separatorIndex >= 0 ? path.slice(0, separatorIndex) : null;
57
+ if (parentPath !== expectedParentPath)
58
+ return [];
59
+ const extension = readNonEmptyString(record?.extension);
60
+ return [{
61
+ path,
62
+ name,
63
+ parentPath,
64
+ kind,
65
+ ...(extension ? { extension } : {}),
66
+ }];
67
+ }
68
+ function readRecord(value) {
69
+ return value && typeof value === 'object' && !Array.isArray(value)
70
+ ? value
71
+ : null;
72
+ }
73
+ function readNonEmptyString(value) {
74
+ return typeof value === 'string' && value.trim() ? value.trim() : null;
75
+ }
76
+ function readCanonicalProjectRelativePath(value) {
77
+ if (typeof value !== 'string' || !value || value !== value.trim())
78
+ return null;
79
+ if (value.includes('\0') || value.includes('\\') || value.startsWith('/') || /^[A-Za-z]:\//.test(value))
80
+ return null;
81
+ const segments = value.split('/');
82
+ if (segments.some(segment => !segment || segment === '.' || segment === '..'))
83
+ return null;
84
+ return segments.join('/');
85
+ }
86
+ //# sourceMappingURL=protocol.js.map